[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220615101920.329421-10-p.raghav@samsung.com>
Date: Wed, 15 Jun 2022 12:19:16 +0200
From: Pankaj Raghav <p.raghav@...sung.com>
To: hch@....de, snitzer@...hat.com, damien.lemoal@...nsource.wdc.com,
axboe@...nel.dk
Cc: bvanassche@....org, linux-kernel@...r.kernel.org,
jiangbo.365@...edance.com, hare@...e.de, pankydev8@...il.com,
dm-devel@...hat.com, jonathan.derrick@...ux.dev,
gost.dev@...sung.com, dsterba@...e.com, jaegeuk@...nel.org,
linux-nvme@...ts.infradead.org, Johannes.Thumshirn@....com,
linux-block@...r.kernel.org, Pankaj Raghav <p.raghav@...sung.com>,
Luis Chamberlain <mcgrof@...nel.org>
Subject: [PATCH v7 09/13] dm-zone: use generic helpers to calculate offset
from zone start
Use the blk_queue_offset_from_zone_start() helper function to calculate
the offset from zone start instead of using power of 2 based
calculation.
Signed-off-by: Pankaj Raghav <p.raghav@...sung.com>
Reviewed-by: Luis Chamberlain <mcgrof@...nel.org>
---
drivers/md/dm-zone.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/md/dm-zone.c b/drivers/md/dm-zone.c
index 3e7b1fe15..af36d33f9 100644
--- a/drivers/md/dm-zone.c
+++ b/drivers/md/dm-zone.c
@@ -395,7 +395,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 ((blk_queue_offset_from_zone_start(md->queue,
+ clone->bi_iter.bi_sector)) != zwp_offset)
return false;
break;
case REQ_OP_ZONE_APPEND:
@@ -608,10 +609,8 @@ void dm_zone_endio(struct dm_io *io, struct bio *clone)
*/
if (clone->bi_status == BLK_STS_OK &&
bio_op(clone) == REQ_OP_ZONE_APPEND) {
- sector_t mask = (sector_t)blk_queue_zone_sectors(q) - 1;
-
orig_bio->bi_iter.bi_sector +=
- clone->bi_iter.bi_sector & mask;
+ blk_queue_offset_from_zone_start(q, clone->bi_iter.bi_sector);
}
return;
--
2.25.1
Powered by blists - more mailing lists