block: introduce bdev_zone_no helper
authorPankaj Raghav <p.raghav@samsung.com>
Tue, 10 Jan 2023 14:36:35 +0000 (15:36 +0100)
committerJens Axboe <axboe@kernel.dk>
Sun, 29 Jan 2023 22:18:34 +0000 (15:18 -0700)
commitd67ea690ce0983dadf59cd06facc18f3acc89cea
tree5fbcbf0decc41e7b6c99e44bb290ce554c02ff81
parente29b210021dcf8e03e0dcc035107afaeb55e6631
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.

Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Reviewed-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Signed-off-by: Pankaj Raghav <p.raghav@samsung.com>
Link: https://lore.kernel.org/r/20230110143635.77300-4-p.raghav@samsung.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/nvme/target/zns.c
include/linux/blkdev.h