diff options
author | Damien Le Moal <damien.lemoal@wdc.com> | 2018-10-12 19:08:43 +0900 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2018-10-25 11:17:40 -0600 |
commit | a91e138022bc29b5d2bbc56b41de3e0db6261e28 (patch) | |
tree | 858cb365d8459eed119c9e51371ee25d99d53e2a /drivers | |
parent | 5f832a395859de7191e638e3777ae57f37d46d08 (diff) | |
download | linux-a91e138022bc29b5d2bbc56b41de3e0db6261e28.tar.bz2 |
block: Introduce blkdev_nr_zones() helper
Introduce the blkdev_nr_zones() helper function to get the total
number of zones of a zoned block device. This number is always 0 for a
regular block device (q->limits.zoned == BLK_ZONED_NONE case).
Replace hard-coded number of zones calculation in dmz_get_zoned_device()
with a call to this helper.
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/md/dm-zoned-target.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/md/dm-zoned-target.c b/drivers/md/dm-zoned-target.c index a44183ff4be0..12d96a263623 100644 --- a/drivers/md/dm-zoned-target.c +++ b/drivers/md/dm-zoned-target.c @@ -702,8 +702,7 @@ static int dmz_get_zoned_device(struct dm_target *ti, char *path) dev->zone_nr_blocks = dmz_sect2blk(dev->zone_nr_sectors); dev->zone_nr_blocks_shift = ilog2(dev->zone_nr_blocks); - dev->nr_zones = (dev->capacity + dev->zone_nr_sectors - 1) - >> dev->zone_nr_sectors_shift; + dev->nr_zones = blkdev_nr_zones(dev->bdev); dmz->dev = dev; |