There is no need for bdev_nr_zones() to be an exported function calculating the number of zones of a block device. Instead, given that all callers use this helper with a fully initialized block device that has a gendisk, we can redefine this function as an inline helper in blkdev.h.
Showing the changes to include/linux/blkdev.h (1 of 2 files). Show all
Unified · Split
| @@ -673,7 +673,6 @@ static inline bool blk_queue_is_zoned(struct request_queue *q) · 672 unmodified lines | |||
| 673 | } | 673 | } |
| 674 | 674 | ||
| 675 | #ifdef CONFIG_BLK_DEV_ZONED | 675 | #ifdef CONFIG_BLK_DEV_ZONED |
| 676 | unsigned int bdev_nr_zones(struct block_device *bdev); | ||
| 677 | 676 | ||
| 678 | static inline unsigned int disk_nr_zones(struct gendisk *disk) | 677 | static inline unsigned int disk_nr_zones(struct gendisk *disk) |
| 679 | { | 678 | { |
| @@ -687,6 +686,11 @@ static inline unsigned int disk_zone_no(struct gendisk *disk, sector_t sector) · 7 unmodified lines | |||
| 687 | return sector >> ilog2(disk->queue->limits.chunk_sectors); | 686 | return sector >> ilog2(disk->queue->limits.chunk_sectors); |
| 688 | } | 687 | } |
| 689 | 688 | ||
| 689 | static inline unsigned int bdev_nr_zones(struct block_device *bdev) | ||
| 690 | { | ||
| 691 | return disk_nr_zones(bdev->bd_disk); | ||
| 692 | } | ||
| 693 | |||
| 690 | static inline unsigned int bdev_max_open_zones(struct block_device *bdev) | 694 | static inline unsigned int bdev_max_open_zones(struct block_device *bdev) |
| 691 | { | 695 | { |
| 692 | return bdev->bd_disk->queue->limits.max_open_zones; | 696 | return bdev->bd_disk->queue->limits.max_open_zones; |