]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
blk-mq: do not reset plug->rq_count before the list is sorted
authorDongli Zhang <dongli.zhang@oracle.com>
Thu, 4 Apr 2019 02:57:44 +0000 (10:57 +0800)
committerJens Axboe <axboe@kernel.dk>
Thu, 4 Apr 2019 14:37:34 +0000 (08:37 -0600)
We would never be able to sort the list if we first reset plug->rq_count
which is used in conditional check later.

Fixes: ce5b009cff19 ("block: improve logic around when to sort a plug list")
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Dongli Zhang <dongli.zhang@oracle.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/blk-mq.c

index 22074a1e37cd48e4ec56a961b34364a36fb1294b..ac61bcc67a89e00324c59c743ad5c76623fcb4f2 100644 (file)
@@ -1711,11 +1711,12 @@ void blk_mq_flush_plug_list(struct blk_plug *plug, bool from_schedule)
        unsigned int depth;
 
        list_splice_init(&plug->mq_list, &list);
-       plug->rq_count = 0;
 
        if (plug->rq_count > 2 && plug->multiple_queues)
                list_sort(NULL, &list, plug_rq_cmp);
 
+       plug->rq_count = 0;
+
        this_q = NULL;
        this_hctx = NULL;
        this_ctx = NULL;