public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH block/for-linus] block: blk-throttle should be drained regardless of q->elevator
@ 2012-02-13 22:52 Tejun Heo
  2012-02-13 23:27 ` Vivek Goyal
  2012-02-14  1:14 ` [PATCH UPDATED " Tejun Heo
  0 siblings, 2 replies; 7+ messages in thread
From: Tejun Heo @ 2012-02-13 22:52 UTC (permalink / raw)
  To: Jens Axboe, linux-kernel, Vivek Goyal

Currently, blk_cleanup_queue() doesn't call elv_drain_elevator() if
q->elevator doesn't exist; however, bio based drivers don't have
elevator initialized but can still use blk-throttle.  This patch moves
q->elevator test inside blk_drain_queue() such that only
elv_drain_elevator() is skipped if !q->elevator.

Signed-off-by: Tejun Heo <tj@kernel.org>
Reported-by: Vivek Goyal <vgoyal@redhat.com>
---
 block/blk-core.c |   17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

Index: work/block/blk-core.c
===================================================================
--- work.orig/block/blk-core.c
+++ work/block/blk-core.c
@@ -365,7 +365,13 @@ void blk_drain_queue(struct request_queu
 
 		spin_lock_irq(q->queue_lock);
 
-		elv_drain_elevator(q);
+		/*
+		 * The caller might be trying to drain @q before its
+		 * elevator is initialized.
+		 */
+		if (q->elevator)
+			elv_drain_elevator(q);
+
 		if (drain_all)
 			blk_throtl_drain(q);
 
@@ -428,13 +434,8 @@ void blk_cleanup_queue(struct request_qu
 	spin_unlock_irq(lock);
 	mutex_unlock(&q->sysfs_lock);
 
-	/*
-	 * Drain all requests queued before DEAD marking.  The caller might
-	 * be trying to tear down @q before its elevator is initialized, in
-	 * which case we don't want to call into draining.
-	 */
-	if (q->elevator)
-		blk_drain_queue(q, true);
+	/* drain all requests queued before DEAD marking */
+	blk_drain_queue(q, true);
 
 	/* @q won't process any more request, flush async actions */
 	del_timer_sync(&q->backing_dev_info.laptop_mode_wb_timer);

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-02-15 15:58 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-13 22:52 [PATCH block/for-linus] block: blk-throttle should be drained regardless of q->elevator Tejun Heo
2012-02-13 23:27 ` Vivek Goyal
2012-02-13 23:40   ` Tejun Heo
2012-02-15 15:53     ` Vivek Goyal
2012-02-14  1:14 ` [PATCH UPDATED " Tejun Heo
2012-02-15 15:57   ` Vivek Goyal
2012-02-15 15:57   ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox