Commit a2997382 authored by Ken Chen's avatar Ken Chen Committed by Linus Torvalds

[PATCH] use cheaper elv_queue_empty when unplug a device

In function __generic_unplug_device(), kernel can use a cheaper function
elv_queue_empty() instead of more expensive elv_next_request to find
whether the queue is empty or not.  blk_run_queue can also made conditional
on whether queue's emptiness before calling request_fn().
Signed-off-by: default avatarJens Axboe <axboe@suse.de>
Signed-off-by: default avatarKen Chen <kenneth.w.chen@intel.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 975e046c
...@@ -1589,6 +1589,7 @@ void blk_run_queue(struct request_queue *q) ...@@ -1589,6 +1589,7 @@ void blk_run_queue(struct request_queue *q)
spin_lock_irqsave(q->queue_lock, flags); spin_lock_irqsave(q->queue_lock, flags);
blk_remove_plug(q); blk_remove_plug(q);
if (!elv_queue_empty(q))
q->request_fn(q); q->request_fn(q);
spin_unlock_irqrestore(q->queue_lock, flags); spin_unlock_irqrestore(q->queue_lock, flags);
} }
......
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