Skip to content

Commit 2149141

Browse files
committed
block: add blk_start_queue_async()
We currently only have an inline/sync helper to restart a stopped queue. If drivers need an async version, they have to roll their own. Add a generic helper instead. Signed-off-by: Jens Axboe <axboe@fb.com>
1 parent d380561 commit 2149141

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

block/blk-core.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,22 @@ void blk_delay_queue(struct request_queue *q, unsigned long msecs)
206206
}
207207
EXPORT_SYMBOL(blk_delay_queue);
208208

209+
/**
210+
* blk_start_queue_async - asynchronously restart a previously stopped queue
211+
* @q: The &struct request_queue in question
212+
*
213+
* Description:
214+
* blk_start_queue_async() will clear the stop flag on the queue, and
215+
* ensure that the request_fn for the queue is run from an async
216+
* context.
217+
**/
218+
void blk_start_queue_async(struct request_queue *q)
219+
{
220+
queue_flag_clear(QUEUE_FLAG_STOPPED, q);
221+
blk_run_queue_async(q);
222+
}
223+
EXPORT_SYMBOL(blk_start_queue_async);
224+
209225
/**
210226
* blk_start_queue - restart a previously stopped queue
211227
* @q: The &struct request_queue in question

include/linux/blkdev.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -797,6 +797,7 @@ extern int sg_scsi_ioctl(struct request_queue *, struct gendisk *, fmode_t,
797797
extern int blk_queue_enter(struct request_queue *q, gfp_t gfp);
798798
extern void blk_queue_exit(struct request_queue *q);
799799
extern void blk_start_queue(struct request_queue *q);
800+
extern void blk_start_queue_async(struct request_queue *q);
800801
extern void blk_stop_queue(struct request_queue *q);
801802
extern void blk_sync_queue(struct request_queue *q);
802803
extern void __blk_stop_queue(struct request_queue *q);

0 commit comments

Comments
 (0)