Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Damien Le Moal and committed by
Jens Axboe
9b3c08b9 63b5385e

+14 -22
+7 -14
block/blk-zoned.c
··· 1713 1713 /** 1714 1714 * blk_revalidate_disk_zones - (re)allocate and initialize zone bitmaps 1715 1715 * @disk: Target disk 1716 - * @update_driver_data: Callback to update driver data on the frozen disk 1717 1716 * 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). 1721 1721 * Before calling this function, the device driver must already have set the 1722 1722 * device zone size (chunk_sector limit) and the max zone append limit. 1723 1723 * BIO based drivers can also use this function as long as the device queue 1724 1724 * 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. 1728 1725 */ 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) 1731 1727 { 1732 1728 struct request_queue *q = disk->queue; 1733 1729 sector_t zone_sectors = q->limits.chunk_sectors; ··· 1790 1794 * referencing the bitmaps). 1791 1795 */ 1792 1796 blk_mq_freeze_queue(q); 1793 - if (ret > 0) { 1797 + if (ret > 0) 1794 1798 ret = disk_update_zone_resources(disk, &args); 1795 - if (update_driver_data) 1796 - update_driver_data(disk); 1797 - } else { 1799 + else 1798 1800 pr_warn("%s: failed to revalidate zones\n", disk->disk_name); 1799 - } 1800 1801 if (ret) 1801 1802 disk_free_zone_resources(disk); 1802 1803 blk_mq_unfreeze_queue(q);
+1 -1
drivers/block/null_blk/zoned.c
··· 177 177 disk->disk_name, 178 178 queue_emulates_zone_append(q) ? "emulated" : "native"); 179 179 180 - return blk_revalidate_disk_zones(disk, NULL); 180 + return blk_revalidate_disk_zones(disk); 181 181 } 182 182 183 183 void null_free_zoned_dev(struct nullb_device *dev)
+1 -1
drivers/block/ublk_drv.c
··· 221 221 222 222 static int ublk_revalidate_disk_zones(struct ublk_device *ub) 223 223 { 224 - return blk_revalidate_disk_zones(ub->ub_disk, NULL); 224 + return blk_revalidate_disk_zones(ub->ub_disk); 225 225 } 226 226 227 227 static int ublk_dev_param_zoned_validate(const struct ublk_device *ub)
+1 -1
drivers/block/virtio_blk.c
··· 1543 1543 */ 1544 1544 if (IS_ENABLED(CONFIG_BLK_DEV_ZONED) && lim.zoned) { 1545 1545 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); 1547 1547 if (err) 1548 1548 goto out_cleanup_disk; 1549 1549 }
+1 -1
drivers/md/dm-zone.c
··· 169 169 * our table for dm_blk_report_zones() to use directly. 170 170 */ 171 171 md->zone_revalidate_map = t; 172 - ret = blk_revalidate_disk_zones(disk, NULL); 172 + ret = blk_revalidate_disk_zones(disk); 173 173 md->zone_revalidate_map = NULL; 174 174 175 175 if (ret) {
+1 -1
drivers/nvme/host/core.c
··· 2150 2150 blk_mq_unfreeze_queue(ns->disk->queue); 2151 2151 2152 2152 if (blk_queue_is_zoned(ns->queue)) { 2153 - ret = blk_revalidate_disk_zones(ns->disk, NULL); 2153 + ret = blk_revalidate_disk_zones(ns->disk); 2154 2154 if (ret && !nvme_first_scan(ns->disk)) 2155 2155 goto out; 2156 2156 }
+1 -1
drivers/scsi/sd_zbc.c
··· 572 572 blk_queue_max_zone_append_sectors(q, 0); 573 573 574 574 flags = memalloc_noio_save(); 575 - ret = blk_revalidate_disk_zones(disk, NULL); 575 + ret = blk_revalidate_disk_zones(disk); 576 576 memalloc_noio_restore(flags); 577 577 if (ret) { 578 578 sdkp->zone_info = (struct zoned_disk_info){ };
+1 -2
include/linux/blkdev.h
··· 336 336 unsigned int nr_zones, report_zones_cb cb, void *data); 337 337 int blkdev_zone_mgmt(struct block_device *bdev, enum req_op op, 338 338 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); 341 340 342 341 /* 343 342 * Independent access ranges: struct blk_independent_access_range describes