Skip to content

Commit

Permalink
block: avoid unnecessary plug list flush
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Shaohua Li authored and axboe committed Nov 16, 2011
1 parent 0007a4c commit 3540d5e
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions block/blk-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1379,15 +1379,17 @@ void blk_queue_bio(struct request_queue *q, struct bio *bio)
*/
if (list_empty(&plug->list))
trace_block_plug(q);
else if (!plug->should_sort) {
struct request *__rq;
else {
if (!plug->should_sort) {
struct request *__rq;

__rq = list_entry_rq(plug->list.prev);
if (__rq->q != q)
plug->should_sort = 1;
__rq = list_entry_rq(plug->list.prev);
if (__rq->q != q)
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);
drive_stat_acct(req, 1);
} else {
Expand Down

0 comments on commit 3540d5e

Please sign in to comment.