lkml.org 
[lkml]   [2012]   [Feb]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 02/11] block: relocate elevator initialized test from blk_cleanup_queue() to blk_drain_queue()
Date
blk_cleanup_queue() may be called for a queue which doesn't have
elevator initialized to skip invoking blk_drain_queue().
blk_drain_queue() will be used for other purposes too and may be
called for such half-initialized queues from other paths. Move
q->elevator test into blk_drain_queue().

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Vivek Goyal <vgoyal@redhat.com>
---
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 1b73d06..ddda1cc 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -359,6 +359,13 @@ EXPORT_SYMBOL(blk_put_queue);
*/
void blk_drain_queue(struct request_queue *q, bool drain_all)
{
+ /*
+ * The caller might be trying to tear down @q before its elevator
+ * is initialized, in which case we don't want to call into it.
+ */
+ if (!q->elevator)
+ return;
+
while (true) {
bool drain = false;
int i;
@@ -468,13 +475,8 @@ void blk_cleanup_queue(struct request_queue *q)
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);
--
1.7.7.3


\
 
 \ /
  Last update: 2012-02-01 22:23    [from the cache]
©2003-2014 Jasper Spaans. Advertise on this site