Skip to content

Commit

Permalink
blk-mq: provide mq_ops->busy() hook
Browse files Browse the repository at this point in the history
We'll hook into this from blk_lld_busy(), allowing blk-mq to also
return whether or not a given queue currently has requests in
progress.

Reviewed-by: Hannes Reinecke <[email protected]>
Tested-by: Ming Lei <[email protected]>
Reviewed-by: Omar Sandoval <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
axboe committed Nov 7, 2018
1 parent ba7b443 commit 9ba2052
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions block/blk-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -3431,6 +3431,8 @@ int blk_lld_busy(struct request_queue *q)
{
if (q->lld_busy_fn)
return q->lld_busy_fn(q);
if (q->mq_ops && q->mq_ops->busy)
return q->mq_ops->busy(q);

return 0;
}
Expand Down
6 changes: 6 additions & 0 deletions include/linux/blk-mq.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ typedef void (busy_iter_fn)(struct blk_mq_hw_ctx *, struct request *, void *,
typedef void (busy_tag_iter_fn)(struct request *, void *, bool);
typedef int (poll_fn)(struct blk_mq_hw_ctx *, unsigned int);
typedef int (map_queues_fn)(struct blk_mq_tag_set *set);
typedef bool (busy_fn)(struct request_queue *);


struct blk_mq_ops {
Expand Down Expand Up @@ -165,6 +166,11 @@ struct blk_mq_ops {
/* Called from inside blk_get_request() */
void (*initialize_rq_fn)(struct request *rq);

/*
* If set, returns whether or not this queue currently is busy
*/
busy_fn *busy;

map_queues_fn *map_queues;

#ifdef CONFIG_BLK_DEBUG_FS
Expand Down

0 comments on commit 9ba2052

Please sign in to comment.