From eeda21606275a235e79970917433adff0f1571ed Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Wed, 24 Jul 2002 20:07:03 +0200 Subject: [PATCH] add __blk_stop_queue() as locked variant of blk_stop_queue() and make cpqarray and cciss use these --- drivers/block/cciss.c | 2 +- drivers/block/cpqarray.c | 2 +- drivers/block/ll_rw_blk.c | 20 ++++++++++++++++---- include/linux/blkdev.h | 1 + 4 files changed, 19 insertions(+), 6 deletions(-) diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c index 939d70269415..360a1468e5c0 100644 --- a/drivers/block/cciss.c +++ b/drivers/block/cciss.c @@ -1863,7 +1863,7 @@ queue: goto queue; startio: - blk_stop_queue(q); + __blk_stop_queue(q); start_io(h); } diff --git a/drivers/block/cpqarray.c b/drivers/block/cpqarray.c index 31276ef0e87c..21139414d6c5 100644 --- a/drivers/block/cpqarray.c +++ b/drivers/block/cpqarray.c @@ -918,7 +918,7 @@ DBGPX( printk("Submitting %d sectors in %d segments\n", creq->nr_sectors, seg); goto queue_next; startio: - blk_stop_queue(q); + __blk_stop_queue(q); start_io(h); } diff --git a/drivers/block/ll_rw_blk.c b/drivers/block/ll_rw_blk.c index c23f57a0ed16..e73c1d823428 100644 --- a/drivers/block/ll_rw_blk.c +++ b/drivers/block/ll_rw_blk.c @@ -900,7 +900,8 @@ void generic_unplug_device(void *data) * Description: * blk_start_queue() will clear the stop flag on the queue, and call * the request_fn for the queue if it was in a stopped state when - * entered. Also see blk_stop_queue() + * entered. Also see blk_stop_queue(). Must not be called from driver + * request function due to recursion issues. **/ void blk_start_queue(request_queue_t *q) { @@ -914,6 +915,18 @@ void blk_start_queue(request_queue_t *q) } } +/** + * __blk_stop_queue: see blk_stop_queue() + * + * Description: + * Like blk_stop_queue(), bust queue_lock must be held + **/ +void __blk_stop_queue(request_queue_t *q) +{ + blk_remove_plug(q); + set_bit(QUEUE_FLAG_STOPPED, &q->queue_flags); +} + /** * blk_stop_queue - stop a queue * @q: The &request_queue_t in question @@ -933,10 +946,8 @@ void blk_stop_queue(request_queue_t *q) unsigned long flags; spin_lock_irqsave(q->queue_lock, flags); - blk_remove_plug(q); + __blk_stop_queue(q); spin_unlock_irqrestore(q->queue_lock, flags); - - set_bit(QUEUE_FLAG_STOPPED, &q->queue_flags); } /** @@ -2089,4 +2100,5 @@ EXPORT_SYMBOL(blk_queue_invalidate_tags); EXPORT_SYMBOL(blk_start_queue); EXPORT_SYMBOL(blk_stop_queue); +EXPORT_SYMBOL(__blk_stop_queue); EXPORT_SYMBOL(blk_run_queues); diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 7460a98bb0b3..726492d4c45a 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -295,6 +295,7 @@ extern inline int blk_hw_contig_segment(request_queue_t *q, struct bio *, struct extern int block_ioctl(struct block_device *, unsigned int, unsigned long); extern void blk_start_queue(request_queue_t *q); extern void blk_stop_queue(request_queue_t *q); +extern void __blk_stop_queue(request_queue_t *q); /* * get ready for proper ref counting -- 2.39.5