diff mbox series

[V5,4/9] blk-zoned: update blkdev_reset_zones() with helper

Message ID 20190821061423.3408-5-chaitanya.kulkarni@wdc.com (mailing list archive)
State Not Applicable
Headers show
Series block: use right accessor to read nr_sects | expand

Commit Message

Chaitanya Kulkarni Aug. 21, 2019, 6:14 a.m. UTC
This patch updates the blkdev_reset_zones() with newly introduced
helper function to read the nr_sects from block device's hd_parts with
the help of part_nr_sects_read().

Reviewed-by: Minwoo Im <minwoo.im.dev@gmail.com>
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
---
 block/blk-zoned.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/block/blk-zoned.c b/block/blk-zoned.c
index 7e0c0b54d194..53f9df376cfb 100644
--- a/block/blk-zoned.c
+++ b/block/blk-zoned.c
@@ -267,7 +267,7 @@  int blkdev_reset_zones(struct block_device *bdev,
 	if (bdev_read_only(bdev))
 		return -EPERM;
 
-	if (!nr_sectors || end_sector > bdev->bd_part->nr_sects)
+	if (!nr_sectors || end_sector > bdev_nr_sects(bdev))
 		/* Out of range */
 		return -EINVAL;
 
@@ -280,7 +280,7 @@  int blkdev_reset_zones(struct block_device *bdev,
 		return -EINVAL;
 
 	if ((nr_sectors & (zone_sectors - 1)) &&
-	    end_sector != bdev->bd_part->nr_sects)
+	    end_sector != bdev_nr_sects(bdev))
 		return -EINVAL;
 
 	blk_start_plug(&plug);