Skip to content

Commit

Permalink
blk-mq: Pass driver tags to blk_mq_clear_rq_mapping()
Browse files Browse the repository at this point in the history
Function blk_mq_clear_rq_mapping() will be used for shared sbitmap tags
in future, so pass a driver tags pointer instead of the tagset container
and HW queue index.

Signed-off-by: John Garry <john.garry@huawei.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Link: https://lore.kernel.org/r/1633429419-228500-8-git-send-email-john.garry@huawei.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
  • Loading branch information
John Garry authored and Jens Axboe committed Oct 18, 2021
1 parent 1820f4f commit f32e4ea
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions block/blk-mq.c
Original file line number Diff line number Diff line change
Expand Up @@ -2311,10 +2311,9 @@ static size_t order_to_size(unsigned int order)
}

/* called before freeing request pool in @tags */
static void blk_mq_clear_rq_mapping(struct blk_mq_tag_set *set,
struct blk_mq_tags *tags, unsigned int hctx_idx)
static void blk_mq_clear_rq_mapping(struct blk_mq_tags *drv_tags,
struct blk_mq_tags *tags)
{
struct blk_mq_tags *drv_tags = set->tags[hctx_idx];
struct page *page;
unsigned long flags;

Expand All @@ -2323,7 +2322,7 @@ static void blk_mq_clear_rq_mapping(struct blk_mq_tag_set *set,
unsigned long end = start + order_to_size(page->private);
int i;

for (i = 0; i < set->queue_depth; i++) {
for (i = 0; i < drv_tags->nr_tags; i++) {
struct request *rq = drv_tags->rqs[i];
unsigned long rq_addr = (unsigned long)rq;

Expand All @@ -2347,8 +2346,11 @@ static void blk_mq_clear_rq_mapping(struct blk_mq_tag_set *set,
void blk_mq_free_rqs(struct blk_mq_tag_set *set, struct blk_mq_tags *tags,
unsigned int hctx_idx)
{
struct blk_mq_tags *drv_tags;
struct page *page;

drv_tags = set->tags[hctx_idx];

if (tags->static_rqs && set->ops->exit_request) {
int i;

Expand All @@ -2362,7 +2364,7 @@ void blk_mq_free_rqs(struct blk_mq_tag_set *set, struct blk_mq_tags *tags,
}
}

blk_mq_clear_rq_mapping(set, tags, hctx_idx);
blk_mq_clear_rq_mapping(drv_tags, tags);

while (!list_empty(&tags->page_list)) {
page = list_first_entry(&tags->page_list, struct page, lru);
Expand Down

0 comments on commit f32e4ea

Please sign in to comment.