Skip to content

Commit 9b3c08b

Browse files
damien-lemoalaxboe
authored andcommitted
block: Simplify blk_revalidate_disk_zones() interface
The only user of blk_revalidate_disk_zones() second argument was the SCSI disk driver (sd). Now that this driver does not require this update_driver_data argument, remove it to simplify the interface of blk_revalidate_disk_zones(). Also update the function kdoc comment to be more accurate (i.e. there is no gendisk ->revalidate method). Signed-off-by: Damien Le Moal <dlemoal@kernel.org> Reviewed-by: Hannes Reinecke <hare@suse.de> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Bart Van Assche <bvanassche@acm.org> Tested-by: Hans Holmberg <hans.holmberg@wdc.com> Tested-by: Dennis Maisenbacher <dennis.maisenbacher@wdc.com> Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com> Link: https://lore.kernel.org/r/20240408014128.205141-21-dlemoal@kernel.org Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 63b5385 commit 9b3c08b

8 files changed

Lines changed: 14 additions & 22 deletions

File tree

block/blk-zoned.c

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1713,21 +1713,17 @@ static int blk_revalidate_zone_cb(struct blk_zone *zone, unsigned int idx,
17131713
/**
17141714
* blk_revalidate_disk_zones - (re)allocate and initialize zone bitmaps
17151715
* @disk: Target disk
1716-
* @update_driver_data: Callback to update driver data on the frozen disk
17171716
*
1718-
* Helper function for low-level device drivers to check and (re) allocate and
1719-
* initialize a disk request queue zone bitmaps. This functions should normally
1720-
* be called within the disk ->revalidate method for blk-mq based drivers.
1717+
* Helper function for low-level device drivers to check, (re) allocate and
1718+
* initialize resources used for managing zoned disks. This function should
1719+
* normally be called by blk-mq based drivers when a zoned gendisk is probed
1720+
* and when the zone configuration of the gendisk changes (e.g. after a format).
17211721
* Before calling this function, the device driver must already have set the
17221722
* device zone size (chunk_sector limit) and the max zone append limit.
17231723
* BIO based drivers can also use this function as long as the device queue
17241724
* can be safely frozen.
1725-
* If the @update_driver_data callback function is not NULL, the callback is
1726-
* executed with the device request queue frozen after all zones have been
1727-
* checked.
17281725
*/
1729-
int blk_revalidate_disk_zones(struct gendisk *disk,
1730-
void (*update_driver_data)(struct gendisk *disk))
1726+
int blk_revalidate_disk_zones(struct gendisk *disk)
17311727
{
17321728
struct request_queue *q = disk->queue;
17331729
sector_t zone_sectors = q->limits.chunk_sectors;
@@ -1794,13 +1790,10 @@ int blk_revalidate_disk_zones(struct gendisk *disk,
17941790
* referencing the bitmaps).
17951791
*/
17961792
blk_mq_freeze_queue(q);
1797-
if (ret > 0) {
1793+
if (ret > 0)
17981794
ret = disk_update_zone_resources(disk, &args);
1799-
if (update_driver_data)
1800-
update_driver_data(disk);
1801-
} else {
1795+
else
18021796
pr_warn("%s: failed to revalidate zones\n", disk->disk_name);
1803-
}
18041797
if (ret)
18051798
disk_free_zone_resources(disk);
18061799
blk_mq_unfreeze_queue(q);

drivers/block/null_blk/zoned.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ int null_register_zoned_dev(struct nullb *nullb)
177177
disk->disk_name,
178178
queue_emulates_zone_append(q) ? "emulated" : "native");
179179

180-
return blk_revalidate_disk_zones(disk, NULL);
180+
return blk_revalidate_disk_zones(disk);
181181
}
182182

183183
void null_free_zoned_dev(struct nullb_device *dev)

drivers/block/ublk_drv.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ static int ublk_get_nr_zones(const struct ublk_device *ub)
221221

222222
static int ublk_revalidate_disk_zones(struct ublk_device *ub)
223223
{
224-
return blk_revalidate_disk_zones(ub->ub_disk, NULL);
224+
return blk_revalidate_disk_zones(ub->ub_disk);
225225
}
226226

227227
static int ublk_dev_param_zoned_validate(const struct ublk_device *ub)

drivers/block/virtio_blk.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1543,7 +1543,7 @@ static int virtblk_probe(struct virtio_device *vdev)
15431543
*/
15441544
if (IS_ENABLED(CONFIG_BLK_DEV_ZONED) && lim.zoned) {
15451545
blk_queue_flag_set(QUEUE_FLAG_ZONE_RESETALL, vblk->disk->queue);
1546-
err = blk_revalidate_disk_zones(vblk->disk, NULL);
1546+
err = blk_revalidate_disk_zones(vblk->disk);
15471547
if (err)
15481548
goto out_cleanup_disk;
15491549
}

drivers/md/dm-zone.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ static int dm_revalidate_zones(struct mapped_device *md, struct dm_table *t)
169169
* our table for dm_blk_report_zones() to use directly.
170170
*/
171171
md->zone_revalidate_map = t;
172-
ret = blk_revalidate_disk_zones(disk, NULL);
172+
ret = blk_revalidate_disk_zones(disk);
173173
md->zone_revalidate_map = NULL;
174174

175175
if (ret) {

drivers/nvme/host/core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2150,7 +2150,7 @@ static int nvme_update_ns_info_block(struct nvme_ns *ns,
21502150
blk_mq_unfreeze_queue(ns->disk->queue);
21512151

21522152
if (blk_queue_is_zoned(ns->queue)) {
2153-
ret = blk_revalidate_disk_zones(ns->disk, NULL);
2153+
ret = blk_revalidate_disk_zones(ns->disk);
21542154
if (ret && !nvme_first_scan(ns->disk))
21552155
goto out;
21562156
}

drivers/scsi/sd_zbc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,7 @@ int sd_zbc_revalidate_zones(struct scsi_disk *sdkp)
572572
blk_queue_max_zone_append_sectors(q, 0);
573573

574574
flags = memalloc_noio_save();
575-
ret = blk_revalidate_disk_zones(disk, NULL);
575+
ret = blk_revalidate_disk_zones(disk);
576576
memalloc_noio_restore(flags);
577577
if (ret) {
578578
sdkp->zone_info = (struct zoned_disk_info){ };

include/linux/blkdev.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -336,8 +336,7 @@ int blkdev_report_zones(struct block_device *bdev, sector_t sector,
336336
unsigned int nr_zones, report_zones_cb cb, void *data);
337337
int blkdev_zone_mgmt(struct block_device *bdev, enum req_op op,
338338
sector_t sectors, sector_t nr_sectors);
339-
int blk_revalidate_disk_zones(struct gendisk *disk,
340-
void (*update_driver_data)(struct gendisk *disk));
339+
int blk_revalidate_disk_zones(struct gendisk *disk);
341340

342341
/*
343342
* Independent access ranges: struct blk_independent_access_range describes

0 commit comments

Comments
 (0)