blk-mq: Make bt_clear_tag() easier to read
authorBart Van Assche <bvanassche@acm.org>
Tue, 7 Oct 2014 14:45:21 +0000 (08:45 -0600)
committerJens Axboe <axboe@fb.com>
Tue, 7 Oct 2014 14:45:21 +0000 (08:45 -0600)
Eliminate a backwards goto statement from bt_clear_tag().

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Jens Axboe <axboe@fb.com>
block/blk-mq-tag.c

index 146fd02659ecf2bd477010da617d73bebab43c20..8317175a3009cb994d66f1f6128de6d9591ee249 100644 (file)
@@ -351,15 +351,12 @@ static void bt_clear_tag(struct blk_mq_bitmap_tags *bt, unsigned int tag)
                return;
 
        wait_cnt = atomic_dec_return(&bs->wait_cnt);
+       if (unlikely(wait_cnt < 0))
+               wait_cnt = atomic_inc_return(&bs->wait_cnt);
        if (wait_cnt == 0) {
-wake:
                atomic_add(bt->wake_cnt, &bs->wait_cnt);
                bt_index_atomic_inc(&bt->wake_index);
                wake_up(&bs->wait);
-       } else if (wait_cnt < 0) {
-               wait_cnt = atomic_inc_return(&bs->wait_cnt);
-               if (!wait_cnt)
-                       goto wake;
        }
 }