Commit 6c5e0c4d authored by Jens Axboe's avatar Jens Axboe
Browse files

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: default avatarJens Axboe <>
parent 94ad374a
......@@ -212,6 +212,24 @@ void blk_plug_device(struct request_queue *q)
* 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);
spin_unlock_irqrestore(q->queue_lock, flags);
* remove the queue from the plugged list, if present. called with
* queue lock held and interrupts disabled.
......@@ -655,6 +655,7 @@ extern struct request *blk_get_request(struct request_queue *, int, gfp_t);
extern void blk_insert_request(struct request_queue *, struct request *, int, void *);
extern void blk_requeue_request(struct request_queue *, struct request *);
extern void blk_plug_device(struct request_queue *);
extern void blk_plug_device_unlocked(struct request_queue *);
extern int blk_remove_plug(struct request_queue *);
extern void blk_recount_segments(struct request_queue *, struct bio *);
extern int scsi_cmd_ioctl(struct file *, struct request_queue *,
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment