Add a generic bdev_zone_no() helper to calculate zone number for a given sector in a block device. This helper internally uses disk_zone_no() to find the zone number. Use the helper bdev_zone_no() to calculate nr of zones. This lets us make modifications to the math if needed in one place.
Showing the changes to include/linux/blkdev.h (1 of 2 files). Show all
Unified · Split
| @@ -1288,6 +1288,11 @@ static inline bool bdev_is_zoned(struct block_device *bdev) · 1287 unmodified lines | |||
| 1288 | return blk_queue_is_zoned(bdev_get_queue(bdev)); | 1288 | return blk_queue_is_zoned(bdev_get_queue(bdev)); |
| 1289 | } | 1289 | } |
| 1290 | 1290 | ||
| 1291 | static inline unsigned int bdev_zone_no(struct block_device *bdev, sector_t sec) | ||
| 1292 | { | ||
| 1293 | return disk_zone_no(bdev->bd_disk, sec); | ||
| 1294 | } | ||
| 1295 | |||
| 1291 | static inline bool bdev_op_is_zoned_write(struct block_device *bdev, | 1296 | static inline bool bdev_op_is_zoned_write(struct block_device *bdev, |
| 1292 | blk_opf_t op) | 1297 | blk_opf_t op) |
| 1293 | { | 1298 | { |