diff options
author | Shaohua Li <shaohua.li@intel.com> | 2011-11-16 03:21:50 -0500 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2011-11-16 03:21:50 -0500 |
commit | 3540d5e89b2ac268fcfc9b07a50a9ba4acc2e5e5 (patch) | |
tree | 10bb06165130e4ffe90bd990fbba497be8fb4e8a /block | |
parent | 0007a4c90a11a5371c8b3f80b220fa402a399189 (diff) |
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: Shaohua Li <shaohua.li@intel.com>
Reviewed-by: Namhyung Kim <namhyung@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block')
-rw-r--r-- | block/blk-core.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/block/blk-core.c b/block/blk-core.c index f43c8a5840ae..6403c12f8aad 100644 --- a/block/blk-core.c +++ b/block/blk-core.c | |||
@@ -1379,15 +1379,17 @@ get_rq: | |||
1379 | */ | 1379 | */ |
1380 | if (list_empty(&plug->list)) | 1380 | if (list_empty(&plug->list)) |
1381 | trace_block_plug(q); | 1381 | trace_block_plug(q); |
1382 | else if (!plug->should_sort) { | 1382 | else { |
1383 | struct request *__rq; | 1383 | if (!plug->should_sort) { |
1384 | struct request *__rq; | ||
1384 | 1385 | ||
1385 | __rq = list_entry_rq(plug->list.prev); | 1386 | __rq = list_entry_rq(plug->list.prev); |
1386 | if (__rq->q != q) | 1387 | if (__rq->q != q) |
1387 | plug->should_sort = 1; | 1388 | plug->should_sort = 1; |
1389 | } | ||
1390 | if (request_count >= BLK_MAX_REQUEST_COUNT) | ||
1391 | blk_flush_plug_list(plug, false); | ||
1388 | } | 1392 | } |
1389 | if (request_count >= BLK_MAX_REQUEST_COUNT) | ||
1390 | blk_flush_plug_list(plug, false); | ||
1391 | list_add_tail(&req->queuelist, &plug->list); | 1393 | list_add_tail(&req->queuelist, &plug->list); |
1392 | drive_stat_acct(req, 1); | 1394 | drive_stat_acct(req, 1); |
1393 | } else { | 1395 | } else { |