On 3/18/25 9:59 AM, Naohiro Aota wrote: > {bdev,disk}_zone_capacity() takes block_device or gendisk and sector position > and returns the zone capacity of the corresponding zone. > > With that, move disk_nr_zones() and blk_zone_plug_bio() to consolidate them in > the same #ifdef block. > > Signed-off-by: Naohiro Aota <naohiro.aota@xxxxxxx> > --- > include/linux/blkdev.h | 67 ++++++++++++++++++++++++++++-------------- > 1 file changed, 45 insertions(+), 22 deletions(-) > > diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h > index d37751789bf5..6f1bdec27ac7 100644 > --- a/include/linux/blkdev.h > +++ b/include/linux/blkdev.h > @@ -691,23 +691,6 @@ static inline bool blk_queue_is_zoned(struct request_queue *q) > (q->limits.features & BLK_FEAT_ZONED); > } > > -#ifdef CONFIG_BLK_DEV_ZONED > -static inline unsigned int disk_nr_zones(struct gendisk *disk) > -{ > - return disk->nr_zones; > -} > -bool blk_zone_plug_bio(struct bio *bio, unsigned int nr_segs); > -#else /* CONFIG_BLK_DEV_ZONED */ > -static inline unsigned int disk_nr_zones(struct gendisk *disk) > -{ > - return 0; > -} > -static inline bool blk_zone_plug_bio(struct bio *bio, unsigned int nr_segs) > -{ > - return false; > -} > -#endif /* CONFIG_BLK_DEV_ZONED */ > - > static inline unsigned int disk_zone_no(struct gendisk *disk, sector_t sector) > { > if (!blk_queue_is_zoned(disk->queue)) > @@ -715,11 +698,6 @@ static inline unsigned int disk_zone_no(struct gendisk *disk, sector_t sector) > return sector >> ilog2(disk->queue->limits.chunk_sectors); > } > > -static inline unsigned int bdev_nr_zones(struct block_device *bdev) > -{ > - return disk_nr_zones(bdev->bd_disk); > -} > - > static inline unsigned int bdev_max_open_zones(struct block_device *bdev) > { > return bdev->bd_disk->queue->limits.max_open_zones; > @@ -826,6 +804,51 @@ static inline u64 sb_bdev_nr_blocks(struct super_block *sb) > (sb->s_blocksize_bits - SECTOR_SHIFT); > } > > +#ifdef CONFIG_BLK_DEV_ZONED > +static inline unsigned int disk_nr_zones(struct gendisk *disk) > +{ > + return disk->nr_zones; > +} > +bool blk_zone_plug_bio(struct bio *bio, unsigned int nr_segs); > + > +/** > + * disk_zone_capacity - returns the zone capacity of zone at @pos @pos is not the start of the zone, so this should be: * disk_zone_capacity - returns the capacity of the zone containing @sect And rename pos to sect. With that, this looks good to me, so feel free to add: Reviewed-by: Damien Le Moal <dlemoal@xxxxxxxxxx> -- Damien Le Moal Western Digital Research