Commit 3540d5e8 authored by Shaohua Li's avatar Shaohua Li Committed by Jens Axboe

block: avoid unnecessary plug list flush

get_request_wait() could sleep and flush the plug list.  If the list is
already flushed, don't flush again.
Signed-off-by: default avatarShaohua Li <shaohua.li@intel.com>
Reviewed-by: default avatarNamhyung Kim <namhyung@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 0007a4c9
...@@ -1379,15 +1379,17 @@ void blk_queue_bio(struct request_queue *q, struct bio *bio) ...@@ -1379,15 +1379,17 @@ void blk_queue_bio(struct request_queue *q, struct bio *bio)
*/ */
if (list_empty(&plug->list)) if (list_empty(&plug->list))
trace_block_plug(q); trace_block_plug(q);
else if (!plug->should_sort) { else {
struct request *__rq; if (!plug->should_sort) {
struct request *__rq;
__rq = list_entry_rq(plug->list.prev); __rq = list_entry_rq(plug->list.prev);
if (__rq->q != q) if (__rq->q != q)
plug->should_sort = 1; plug->should_sort = 1;
}
if (request_count >= BLK_MAX_REQUEST_COUNT)
blk_flush_plug_list(plug, false);
} }
if (request_count >= BLK_MAX_REQUEST_COUNT)
blk_flush_plug_list(plug, false);
list_add_tail(&req->queuelist, &plug->list); list_add_tail(&req->queuelist, &plug->list);
drive_stat_acct(req, 1); drive_stat_acct(req, 1);
} else { } else {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment