From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 07748C54EBE for ; Tue, 10 Jan 2023 06:57:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234969AbjAJG5q (ORCPT ); Tue, 10 Jan 2023 01:57:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34376 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230510AbjAJG5n (ORCPT ); Tue, 10 Jan 2023 01:57:43 -0500 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B62BE392D8; Mon, 9 Jan 2023 22:57:41 -0800 (PST) Received: by verein.lst.de (Postfix, from userid 2407) id BFF2F68D06; Tue, 10 Jan 2023 07:57:38 +0100 (CET) Date: Tue, 10 Jan 2023 07:57:38 +0100 From: Christoph Hellwig To: Pankaj Raghav Cc: axboe@kernel.dk, kernel@pankajraghav.com, linux-kernel@vger.kernel.org, hare@suse.de, bvanassche@acm.org, snitzer@kernel.org, dm-devel@redhat.com, damien.lemoal@opensource.wdc.com, linux-nvme@lists.infradead.org, hch@lst.de, linux-block@vger.kernel.org, gost.dev@samsung.com, Luis Chamberlain , Johannes Thumshirn Subject: Re: [PATCH 6/7] dm-zone: use generic helpers to calculate offset from zone start Message-ID: <20230110065738.GE10289@lst.de> References: <20230106083317.93938-1-p.raghav@samsung.com> <20230106083317.93938-7-p.raghav@samsung.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230106083317.93938-7-p.raghav@samsung.com> User-Agent: Mutt/1.5.17 (2007-11-01) Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org 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 > Reviewed-by: Luis Chamberlain > Reviewed-by: Damien Le Moal > Reviewed-by: Bart Van Assche > Reviewed-by: Johannes Thumshirn > Reviewed-by: Mike Snitzer > --- > 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.