diff options
author | Jens Axboe <jens.axboe@oracle.com> | 2008-08-01 20:31:32 +0200 |
---|---|---|
committer | Jens Axboe <jens.axboe@oracle.com> | 2008-08-01 20:31:32 +0200 |
commit | 6c5e0c4d518a37e1d5d794c14433e80284415079 (patch) | |
tree | 26208a4fe4115a37c000a13d50df8c1a5e393553 /block | |
parent | Fix off-by-one error in iov_iter_advance() (diff) | |
download | linux-6c5e0c4d518a37e1d5d794c14433e80284415079.tar.xz linux-6c5e0c4d518a37e1d5d794c14433e80284415079.zip |
block: add a blk_plug_device_unlocked() that grabs the queue lock
blk_plug_device() must be called with the queue lock held, so callers
often just grab and release the lock for that purpose. Add a helper
that does just that.
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'block')
-rw-r--r-- | block/blk-core.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/block/blk-core.c b/block/blk-core.c index fef79ccb2a11..4889eb86a39e 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -212,6 +212,24 @@ void blk_plug_device(struct request_queue *q) } EXPORT_SYMBOL(blk_plug_device); +/** + * blk_plug_device_unlocked - plug a device without queue lock held + * @q: The &struct request_queue to plug + * + * Description: + * Like @blk_plug_device(), but grabs the queue lock and disables + * interrupts. + **/ +void blk_plug_device_unlocked(struct request_queue *q) +{ + unsigned long flags; + + spin_lock_irqsave(q->queue_lock, flags); + blk_plug_device(q); + spin_unlock_irqrestore(q->queue_lock, flags); +} +EXPORT_SYMBOL(blk_plug_device_unlocked); + /* * remove the queue from the plugged list, if present. called with * queue lock held and interrupts disabled. |