aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJens Axboe <jens.axboe@oracle.com>2008-08-01 14:31:32 -0400
committerJens Axboe <jens.axboe@oracle.com>2008-08-01 14:31:32 -0400
commit6c5e0c4d518a37e1d5d794c14433e80284415079 (patch)
tree26208a4fe4115a37c000a13d50df8c1a5e393553
parent94ad374a0751f40d25e22e036c37f7263569d24c (diff)
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>
-rw-r--r--block/blk-core.c18
-rw-r--r--include/linux/blkdev.h1
2 files changed, 19 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)
212} 212}
213EXPORT_SYMBOL(blk_plug_device); 213EXPORT_SYMBOL(blk_plug_device);
214 214
215/**
216 * blk_plug_device_unlocked - plug a device without queue lock held
217 * @q: The &struct request_queue to plug
218 *
219 * Description:
220 * Like @blk_plug_device(), but grabs the queue lock and disables
221 * interrupts.
222 **/
223void blk_plug_device_unlocked(struct request_queue *q)
224{
225 unsigned long flags;
226
227 spin_lock_irqsave(q->queue_lock, flags);
228 blk_plug_device(q);
229 spin_unlock_irqrestore(q->queue_lock, flags);
230}
231EXPORT_SYMBOL(blk_plug_device_unlocked);
232
215/* 233/*
216 * remove the queue from the plugged list, if present. called with 234 * remove the queue from the plugged list, if present. called with
217 * queue lock held and interrupts disabled. 235 * queue lock held and interrupts disabled.
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 88d68081a0f1..e61f22be4d0e 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -655,6 +655,7 @@ extern struct request *blk_get_request(struct request_queue *, int, gfp_t);
655extern void blk_insert_request(struct request_queue *, struct request *, int, void *); 655extern void blk_insert_request(struct request_queue *, struct request *, int, void *);
656extern void blk_requeue_request(struct request_queue *, struct request *); 656extern void blk_requeue_request(struct request_queue *, struct request *);
657extern void blk_plug_device(struct request_queue *); 657extern void blk_plug_device(struct request_queue *);
658extern void blk_plug_device_unlocked(struct request_queue *);
658extern int blk_remove_plug(struct request_queue *); 659extern int blk_remove_plug(struct request_queue *);
659extern void blk_recount_segments(struct request_queue *, struct bio *); 660extern void blk_recount_segments(struct request_queue *, struct bio *);
660extern int scsi_cmd_ioctl(struct file *, struct request_queue *, 661extern int scsi_cmd_ioctl(struct file *, struct request_queue *,