Re: [PATCH md 3 of 4] Delete unplug timer before shutting down md array.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sunday November 7, akpm@xxxxxxxx wrote:
> > I couldn't find blk_sync_queue in 2.6.10-rc1-mm2 ....
> 
> I added it in -mm3 to replace all the open-coded del_timer_sync()s.

Yeh... right... of course ... I saw that mail...

I think I missed the trust of Jens' mail.

I now see the point was that:

  .... you have to prevent new requests from setting it (the timer)
  off again.

That isn't a problem in my case. By the time I  to want to remove
the timer, I know that no-one has the device open, and so no requests
are going to arrive.
The blk_wait_queue_drained has no relevance for md as we don't use the
same sort of queue.
So I think blk_sync_queue is all that is needed.

> 
> We should be able to stick all the above inside block_sync_queue()


Maybe:

###Comments for ChangeSet
Document blk_sync_queue and complete it's functionality.

blk_sync_queue needs to call kblock_flush as the unplug function
is not actually called by the timer, but rather by a work_queue that
the timer triggers.

Also, use blk_sync_queue to abstract identical functionality from 
blk_cleanup_queue.

Signed-off-by: Neil Brown <neilb@xxxxxxxxxxxxxxx>

### Diffstat output
 ./drivers/block/ll_rw_blk.c |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)

diff ./drivers/block/ll_rw_blk.c~current~ ./drivers/block/ll_rw_blk.c
--- ./drivers/block/ll_rw_blk.c~current~	2004-11-08 11:57:40.000000000 +1100
+++ ./drivers/block/ll_rw_blk.c	2004-11-08 12:17:53.000000000 +1100
@@ -1361,12 +1361,21 @@ void blk_stop_queue(request_queue_t *q)
 EXPORT_SYMBOL(blk_stop_queue);
 
 /**
- * blk_sync_queue - prepare to destroy a queue
+ * blk_sync_queue - cancel any pending callbacks a queue
  * @q: the queue
+ *
+ * Description:
+ *     The block layer may perform asynchronous callback activity
+ *     on a queue, such as calling the unplug function after a timeout.
+ *     A block device may call blk_sync_queue to ensure that any
+ *     such activity is cancelled, thus allowing it to release resources
+ *     the the callbacks might use.
+ *
  */
 void blk_sync_queue(struct request_queue *q)
 {
 	del_timer_sync(&q->unplug_timer);
+	kblockd_flush();
 }
 EXPORT_SYMBOL(blk_sync_queue);
 
@@ -1410,8 +1419,7 @@ void blk_cleanup_queue(request_queue_t *
 	if (q->elevator)
 		elevator_exit(q->elevator);
 
-	del_timer_sync(&q->unplug_timer);
-	kblockd_flush();
+	blk_sync_queue(q);
 
 	if (rl->rq_pool)
 		mempool_destroy(rl->rq_pool);
-
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux