diff options
author | Christoph Hellwig <hch@lst.de> | 2023-12-17 17:53:58 +0100 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2023-12-19 20:17:43 -0700 |
commit | d73e93b4dfab10c80688b061c30048df05585c7e (patch) | |
tree | 64fe5d6da0ad0053c9d42f6356ec2032e928024c /block | |
parent | 7437bb73f087e5f216f9c6603f5149d354e315af (diff) |
block: simplify disk_set_zoned
Only use disk_set_zoned to actually enable zoned device support.
For clearing it, call disk_clear_zoned, which is renamed from
disk_clear_zone_settings and now directly clears the zoned flag as
well.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Link: https://lore.kernel.org/r/20231217165359.604246-5-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block')
-rw-r--r-- | block/blk-settings.c | 32 | ||||
-rw-r--r-- | block/blk-zoned.c | 3 | ||||
-rw-r--r-- | block/blk.h | 2 |
3 files changed, 13 insertions, 24 deletions
diff --git a/block/blk-settings.c b/block/blk-settings.c index 50e9efb59f67..bb94a3d471f4 100644 --- a/block/blk-settings.c +++ b/block/blk-settings.c @@ -881,31 +881,21 @@ bool blk_queue_can_use_dma_map_merging(struct request_queue *q, EXPORT_SYMBOL_GPL(blk_queue_can_use_dma_map_merging); /** - * disk_set_zoned - configure the zoned model for a disk - * @disk: the gendisk of the queue to configure - * @zoned: zoned or not. - * - * When @zoned is %true, this should be called only if zoned block device - * support is enabled (CONFIG_BLK_DEV_ZONED option). + * disk_set_zoned - inidicate a zoned device + * @disk: gendisk to configure */ -void disk_set_zoned(struct gendisk *disk, bool zoned) +void disk_set_zoned(struct gendisk *disk) { struct request_queue *q = disk->queue; - if (zoned) { - WARN_ON_ONCE(!IS_ENABLED(CONFIG_BLK_DEV_ZONED)); - - /* - * Set the zone write granularity to the device logical block - * size by default. The driver can change this value if needed. - */ - q->limits.zoned = true; - blk_queue_zone_write_granularity(q, - queue_logical_block_size(q)); - } else if (q->limits.zoned) { - q->limits.zoned = false; - disk_clear_zone_settings(disk); - } + WARN_ON_ONCE(!IS_ENABLED(CONFIG_BLK_DEV_ZONED)); + + /* + * Set the zone write granularity to the device logical block + * size by default. The driver can change this value if needed. + */ + q->limits.zoned = true; + blk_queue_zone_write_granularity(q, queue_logical_block_size(q)); } EXPORT_SYMBOL_GPL(disk_set_zoned); diff --git a/block/blk-zoned.c b/block/blk-zoned.c index 619ee41a51cc..580a58e53efd 100644 --- a/block/blk-zoned.c +++ b/block/blk-zoned.c @@ -616,12 +616,13 @@ int blk_revalidate_disk_zones(struct gendisk *disk, } EXPORT_SYMBOL_GPL(blk_revalidate_disk_zones); -void disk_clear_zone_settings(struct gendisk *disk) +void disk_clear_zoned(struct gendisk *disk) { struct request_queue *q = disk->queue; blk_mq_freeze_queue(q); + q->limits.zoned = false; disk_free_zone_bitmaps(disk); blk_queue_flag_clear(QUEUE_FLAG_ZONE_RESETALL, q); q->required_elevator_features &= ~ELEVATOR_F_ZBD_SEQ_WRITE; diff --git a/block/blk.h b/block/blk.h index 08a358bc0919..1ef920f72e0f 100644 --- a/block/blk.h +++ b/block/blk.h @@ -395,14 +395,12 @@ static inline struct bio *blk_queue_bounce(struct bio *bio, #ifdef CONFIG_BLK_DEV_ZONED void disk_free_zone_bitmaps(struct gendisk *disk); -void disk_clear_zone_settings(struct gendisk *disk); int blkdev_report_zones_ioctl(struct block_device *bdev, unsigned int cmd, unsigned long arg); int blkdev_zone_mgmt_ioctl(struct block_device *bdev, blk_mode_t mode, unsigned int cmd, unsigned long arg); #else /* CONFIG_BLK_DEV_ZONED */ static inline void disk_free_zone_bitmaps(struct gendisk *disk) {} -static inline void disk_clear_zone_settings(struct gendisk *disk) {} static inline int blkdev_report_zones_ioctl(struct block_device *bdev, unsigned int cmd, unsigned long arg) { |