block: call blk_queue_free_zone_bitmaps from disk_release
authorChristoph Hellwig <hch@lst.de>
Wed, 6 Jul 2022 07:03:36 +0000 (09:03 +0200)
committerJens Axboe <axboe@kernel.dk>
Wed, 6 Jul 2022 12:46:25 +0000 (06:46 -0600)
The zone bitmaps are only used for non-passthrough I/O, so free them as
soon as the disk is released.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
Reviewed-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Link: https://lore.kernel.org/r/20220706070350.1703384-3-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/blk-sysfs.c
block/genhd.c

index 58cb9cb..7590810 100644 (file)
@@ -776,8 +776,6 @@ static void blk_release_queue(struct kobject *kobj)
        blk_free_queue_stats(q->stats);
        kfree(q->poll_stat);
 
-       blk_queue_free_zone_bitmaps(q);
-
        if (queue_is_mq(q))
                blk_mq_release(q);
 
index b1fb7e0..d0bdeb9 100644 (file)
@@ -1165,6 +1165,7 @@ static void disk_release(struct device *dev)
 
        disk_release_events(disk);
        kfree(disk->random);
+       blk_queue_free_zone_bitmaps(disk->queue);
        xa_destroy(&disk->part_tbl);
 
        disk->queue->disk = NULL;