History

block: introduce bdev_zone_no helper

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.

Pankaj Raghav committed 3 years ago

Commit d67ea691 parent e29b2102 files · +6 −2Browse files

Showing the changes to include (1 of 2 files). Show all

Unified · Split

include/linux/blkdev.h+5−0
@@ -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
1291static 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
1291static inline bool bdev_op_is_zoned_write(struct block_device *bdev,1296static inline bool bdev_op_is_zoned_write(struct block_device *bdev,
1292 blk_opf_t op)1297 blk_opf_t op)
1293{1298{