]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
blk-mq: Invert check in blk_mq_update_nr_requests()
authorJohn Garry <john.garry@huawei.com>
Tue, 5 Oct 2021 10:23:29 +0000 (18:23 +0800)
committerJens Axboe <axboe@kernel.dk>
Mon, 18 Oct 2021 12:17:02 +0000 (06:17 -0600)
It's easier to read:

if (x)
X;
else
Y;

over:

if (!x)
Y;
else
X;

No functional change intended.

Signed-off-by: John Garry <john.garry@huawei.com>
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Link: https://lore.kernel.org/r/1633429419-228500-5-git-send-email-john.garry@huawei.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/blk-mq.c

index 240c04aaa3f8fae9305cce5d828bacb25c16e007..ca0e65117064e4f83f00ffc82b0d2346b475f1d3 100644 (file)
@@ -3622,18 +3622,18 @@ int blk_mq_update_nr_requests(struct request_queue *q, unsigned int nr)
                 * If we're using an MQ scheduler, just update the scheduler
                 * queue depth. This is similar to what the old code would do.
                 */
-               if (!hctx->sched_tags) {
-                       ret = blk_mq_tag_update_depth(hctx, &hctx->tags, nr,
-                                                       false);
-               } else {
+               if (hctx->sched_tags) {
                        ret = blk_mq_tag_update_depth(hctx, &hctx->sched_tags,
-                                                       nr, true);
+                                                     nr, true);
                        if (blk_mq_is_sbitmap_shared(set->flags)) {
                                hctx->sched_tags->bitmap_tags =
                                        &q->sched_bitmap_tags;
                                hctx->sched_tags->breserved_tags =
                                        &q->sched_breserved_tags;
                        }
+               } else {
+                       ret = blk_mq_tag_update_depth(hctx, &hctx->tags, nr,
+                                                     false);
                }
                if (ret)
                        break;