block: pass a gendisk to blk_queue_max_open_zones and blk_queue_max_active_zones
authorChristoph Hellwig <hch@lst.de>
Wed, 6 Jul 2022 07:03:44 +0000 (09:03 +0200)
committerJens Axboe <axboe@kernel.dk>
Wed, 6 Jul 2022 12:46:26 +0000 (06:46 -0600)
Switch to a gendisk based API in preparation for moving all zone related
fields from the request_queue to the gendisk.

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-11-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/block/null_blk/zoned.c
drivers/nvme/host/zns.c
drivers/scsi/sd_zbc.c
include/linux/blkdev.h

index b47bbd1..576ab3e 100644 (file)
@@ -174,8 +174,8 @@ int null_register_zoned_dev(struct nullb *nullb)
        }
 
        blk_queue_max_zone_append_sectors(q, dev->zone_size_sects);
-       blk_queue_max_open_zones(q, dev->zone_max_open);
-       blk_queue_max_active_zones(q, dev->zone_max_active);
+       disk_set_max_open_zones(nullb->disk, dev->zone_max_open);
+       disk_set_max_active_zones(nullb->disk, dev->zone_max_active);
 
        return 0;
 }
index 0ed15c2..12316ab 100644 (file)
@@ -111,8 +111,8 @@ int nvme_update_zone_info(struct nvme_ns *ns, unsigned lbaf)
 
        disk_set_zoned(ns->disk, BLK_ZONED_HM);
        blk_queue_flag_set(QUEUE_FLAG_ZONE_RESETALL, q);
-       blk_queue_max_open_zones(q, le32_to_cpu(id->mor) + 1);
-       blk_queue_max_active_zones(q, le32_to_cpu(id->mar) + 1);
+       disk_set_max_open_zones(ns->disk, le32_to_cpu(id->mor) + 1);
+       disk_set_max_active_zones(ns->disk, le32_to_cpu(id->mar) + 1);
 free_data:
        kfree(id);
        return status;
index 0f5823b..b4106f8 100644 (file)
@@ -950,10 +950,10 @@ int sd_zbc_read_zones(struct scsi_disk *sdkp, u8 buf[SD_BUF_SIZE])
        blk_queue_flag_set(QUEUE_FLAG_ZONE_RESETALL, q);
        blk_queue_required_elevator_features(q, ELEVATOR_F_ZBD_SEQ_WRITE);
        if (sdkp->zones_max_open == U32_MAX)
-               blk_queue_max_open_zones(q, 0);
+               disk_set_max_open_zones(disk, 0);
        else
-               blk_queue_max_open_zones(q, sdkp->zones_max_open);
-       blk_queue_max_active_zones(q, 0);
+               disk_set_max_open_zones(disk, sdkp->zones_max_open);
+       disk_set_max_active_zones(disk, 0);
        nr_zones = round_up(sdkp->capacity, zone_blocks) >> ilog2(zone_blocks);
 
        /*
index 7d4105d..c05e1cc 100644 (file)
@@ -696,16 +696,16 @@ static inline bool blk_queue_zone_is_seq(struct request_queue *q,
        return !test_bit(blk_queue_zone_no(q, sector), q->conv_zones_bitmap);
 }
 
-static inline void blk_queue_max_open_zones(struct request_queue *q,
+static inline void disk_set_max_open_zones(struct gendisk *disk,
                unsigned int max_open_zones)
 {
-       q->max_open_zones = max_open_zones;
+       disk->queue->max_open_zones = max_open_zones;
 }
 
-static inline void blk_queue_max_active_zones(struct request_queue *q,
+static inline void disk_set_max_active_zones(struct gendisk *disk,
                unsigned int max_active_zones)
 {
-       q->max_active_zones = max_active_zones;
+       disk->queue->max_active_zones = max_active_zones;
 }
 
 static inline unsigned int bdev_max_open_zones(struct block_device *bdev)