summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Axboe <jens.axboe@oracle.com>2009-08-11 10:31:14 +0400
committerJens Axboe <jens.axboe@oracle.com>2009-09-11 16:33:32 +0400
commitd62f843b295393124970d29316344150c7de009b (patch)
treee4ed17a6e34f43a7c292e7d6f8fe64652b075dd6
parent1b379d8daf4e981b2220f057683e35af022d45bc (diff)
downloadlinux-d62f843b295393124970d29316344150c7de009b.tar.xz
block: make blk_iopoll_prep_sched() follow normal 0/1 return convention
Return 0 if we successfully marked this iopoll structure as ours for scheduling, instead of 1. Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
-rw-r--r--include/linux/blk-iopoll.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/include/linux/blk-iopoll.h b/include/linux/blk-iopoll.h
index b2e1739a2e7b..308734d3d4a2 100644
--- a/include/linux/blk-iopoll.h
+++ b/include/linux/blk-iopoll.h
@@ -18,10 +18,17 @@ enum {
IOPOLL_F_DISABLE = 1,
};
+/*
+ * Returns 0 if we successfully set the IOPOLL_F_SCHED bit, indicating
+ * that we were the first to acquire this iop for scheduling. If this iop
+ * is currently disabled, return "failure".
+ */
static inline int blk_iopoll_sched_prep(struct blk_iopoll *iop)
{
- return !test_bit(IOPOLL_F_DISABLE, &iop->state) &&
- !test_and_set_bit(IOPOLL_F_SCHED, &iop->state);
+ if (!test_bit(IOPOLL_F_DISABLE, &iop->state))
+ return test_and_set_bit(IOPOLL_F_SCHED, &iop->state);
+
+ return 1;
}
static inline int blk_iopoll_disable_pending(struct blk_iopoll *iop)