blk-mq: fix wrong usage of hctx->state vs hctx->flags
authorJens Axboe <axboe@fb.com>
Wed, 19 Mar 2014 21:25:02 +0000 (15:25 -0600)
committerJens Axboe <axboe@fb.com>
Wed, 19 Mar 2014 21:25:02 +0000 (15:25 -0600)
BLK_MQ_F_* flags are for hctx->flags, and are non-atomic and
set at registration time. BLK_MQ_S_* flags are dynamic and
atomic, and are accessed through hctx->state.

Some of the BLK_MQ_S_STOPPED uses were wrong. Additionally,
the header file should not use a bit shift for the _S_ flags,
as they are done through the set/test_bit functions.

Signed-off-by: Jens Axboe <axboe@fb.com>
block/blk-mq.c
include/linux/blk-mq.h

index 92284af4e0df35583b2a691f377752d332b3183e..ed216f27e3b8ef79c7dd2c8728ccf043f7426ca8 100644 (file)
@@ -547,7 +547,7 @@ static void __blk_mq_run_hw_queue(struct blk_mq_hw_ctx *hctx)
        LIST_HEAD(rq_list);
        int bit, queued;
 
-       if (unlikely(test_bit(BLK_MQ_S_STOPPED, &hctx->flags)))
+       if (unlikely(test_bit(BLK_MQ_S_STOPPED, &hctx->state)))
                return;
 
        hctx->run++;
@@ -636,7 +636,7 @@ static void __blk_mq_run_hw_queue(struct blk_mq_hw_ctx *hctx)
 
 void blk_mq_run_hw_queue(struct blk_mq_hw_ctx *hctx, bool async)
 {
-       if (unlikely(test_bit(BLK_MQ_S_STOPPED, &hctx->flags)))
+       if (unlikely(test_bit(BLK_MQ_S_STOPPED, &hctx->state)))
                return;
 
        if (!async)
@@ -656,7 +656,7 @@ void blk_mq_run_queues(struct request_queue *q, bool async)
        queue_for_each_hw_ctx(q, hctx, i) {
                if ((!blk_mq_hctx_has_pending(hctx) &&
                    list_empty_careful(&hctx->dispatch)) ||
-                   test_bit(BLK_MQ_S_STOPPED, &hctx->flags))
+                   test_bit(BLK_MQ_S_STOPPED, &hctx->state))
                        continue;
 
                blk_mq_run_hw_queue(hctx, async);
index 33ff10ebcabb804d57d34f24ed88a33b0c331b67..bb68b03741be87e42e3ff94d346ce278a9de2378 100644 (file)
@@ -109,7 +109,7 @@ enum {
        BLK_MQ_F_SHOULD_SORT    = 1 << 1,
        BLK_MQ_F_SHOULD_IPI     = 1 << 2,
 
-       BLK_MQ_S_STOPPED        = 1 << 0,
+       BLK_MQ_S_STOPPED        = 0,
 
        BLK_MQ_MAX_DEPTH        = 2048,
 };