diff mbox series

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

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

Commit Message

Chaitanya Kulkarni July 2, 2019, 5:42 p.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().

Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
---
 block/blk-zoned.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Minwoo Im July 3, 2019, 12:23 a.m. UTC | #1
On 19-07-02 10:42:30, Chaitanya Kulkarni wrote:
> 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().

Chaitanya,

Are the first three patches split for a special reason?  IMHO, it could
be squashed into a single one.

It looks good to me, by the way.

Reviewed-by: Minwoo Im <minwoo.im.dev@gmail.com>
Chaitanya Kulkarni July 3, 2019, 2:29 a.m. UTC | #2
On 7/2/19 5:23 PM, Minwoo Im wrote:
> On 19-07-02 10:42:30, Chaitanya Kulkarni wrote:
>> 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().
> Chaitanya,
>
> Are the first three patches split for a special reason?  IMHO, it could
> be squashed into a single one.
>
> It looks good to me, by the way.

In the blk-zoned.c in this way it is easier to bisect if/when the problem

comes.

>
> Reviewed-by: Minwoo Im <minwoo.im.dev@gmail.com>
>
Minwoo Im July 3, 2019, 5:25 a.m. UTC | #3
On 19-07-03 02:29:33, Chaitanya Kulkarni wrote:
> On 7/2/19 5:23 PM, Minwoo Im wrote:
> > On 19-07-02 10:42:30, Chaitanya Kulkarni wrote:
> >> 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().
> > Chaitanya,
> >
> > Are the first three patches split for a special reason?  IMHO, it could
> > be squashed into a single one.
> >
> > It looks good to me, by the way.
> 
> In the blk-zoned.c in this way it is easier to bisect if/when the problem
> 
> comes.

Oh okay.  That makes sense.

Thanks, Chaitanya.
diff mbox series

Patch

diff --git a/block/blk-zoned.c b/block/blk-zoned.c
index 9faf4488339d..e7f2874b5d37 100644
--- a/block/blk-zoned.c
+++ b/block/blk-zoned.c
@@ -229,7 +229,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;
 
@@ -239,7 +239,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);