On Fri, Jan 06, 2023 at 09:33:16AM +0100, Pankaj Raghav wrote:
> Use the bdev_offset_from_zone_start() helper function to calculate
> the offset from zone start instead of open coding.
> 
> Signed-off-by: Pankaj Raghav <[email protected]>
> Reviewed-by: Luis Chamberlain <[email protected]>
> Reviewed-by: Damien Le Moal <[email protected]>
> Reviewed-by: Bart Van Assche <[email protected]>
> Reviewed-by: Johannes Thumshirn <[email protected]>
> Reviewed-by: Mike Snitzer <[email protected]>
> ---
>  drivers/md/dm-zone.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/md/dm-zone.c b/drivers/md/dm-zone.c
> index 3dafc0e8b7a9..ac6fc1293d41 100644
> --- a/drivers/md/dm-zone.c
> +++ b/drivers/md/dm-zone.c
> @@ -390,7 +390,8 @@ static bool dm_zone_map_bio_begin(struct mapped_device 
> *md,
>       case REQ_OP_WRITE_ZEROES:
>       case REQ_OP_WRITE:
>               /* Writes must be aligned to the zone write pointer */
> -             if ((clone->bi_iter.bi_sector & (zsectors - 1)) != zwp_offset)
> +             if (bdev_offset_from_zone_start(md->disk->part0,
> +                                             clone->bi_iter.bi_sector) != 
> zwp_offset)

I can't see how this actually cleans antyhing up, while it does add an
overly long line.

>               if (clone->bi_status == BLK_STS_OK &&
>                   bio_op(clone) == REQ_OP_ZONE_APPEND) {
>                       orig_bio->bi_iter.bi_sector +=
> -                             clone->bi_iter.bi_sector & mask;
> +                             bdev_offset_from_zone_start(disk->part0, 
> clone->bi_iter.bi_sector);

Same here.

--
dm-devel mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/dm-devel

Reply via email to