Skip to content

Commit

Permalink
blk-mq: do not reset plug->rq_count before the list is sorted
Browse files Browse the repository at this point in the history
We would never be able to sort the list if we first reset plug->rq_count
which is used in conditional check later.

Fixes: ce5b009 ("block: improve logic around when to sort a plug list")
Reviewed-by: Ming Lei <[email protected]>
Signed-off-by: Dongli Zhang <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
Dongli Zhang authored and axboe committed Apr 4, 2019
1 parent 58ccd2d commit bcc816d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion block/blk-mq.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit bcc816d

Please sign in to comment.