Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp646851rwb; Thu, 11 Aug 2022 07:42:40 -0700 (PDT) X-Google-Smtp-Source: AA6agR4j02K5WHoLqd3xTV67e8pRxckA4RUeic98IlcAnv3h+8KSjeYrAZHPtPEqwXTsQ7TZHkw9 X-Received: by 2002:a17:907:728c:b0:730:c005:5d93 with SMTP id dt12-20020a170907728c00b00730c0055d93mr24813171ejc.265.1660228960269; Thu, 11 Aug 2022 07:42:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660228960; cv=none; d=google.com; s=arc-20160816; b=SVkOO4lG55xa+bbWwCkjzbjqMHcArVFvCbbG2uvbsLq9tgJpn84yNqyGTnIq8eroNp AXohA9alDrJ9XWBdfoAuokWpttFNVYn3NkAku8lwZn2IO+IMttQxlOnHx+3bhHIKMDu0 raH1IPHMIDCr7gKx/WbNTBvcoelM4jPROAtMPgQ4SW4BlZ7Z/lNuKxL1JNVZHA7hn0hN xlmfZC6byfDXCazPP3wdIO+e8xIzarj4Cz+7Sslb/C4ixgeybVFkfqA96ccofleqw8PN GFu+LyXbkghLxalk62jAg/0AS/mdIQurZ5xzrCkYYZpkjzoDhw4Qz7bV/dzvAKydXfl9 4JcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:cms-type:content-transfer-encoding :mime-version:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter; bh=rIbhfxDBpj+Ii51tIIt4kTVb6ZA8NV8eQeaNrvmy2UQ=; b=sXVPdRQV90wYUhaYkzJxgeba1CvdlQnKjcFZ3qj+pYKPAhCgQ0WTOXGYPHiB9OAEGm phD2GuQG2wKTWpYWjf+RBLZSH9M3u2u7fNFrz4YrsxKsfIcp4f5ejsfs8iKaSfT2PZ0R vTaUFwquu94TC1yc3JiRZoMDysw+rGLYRyk03TX5NoLGgyitJCte0L+XmOsmOY/qAoaV kDiiOuxB5VSYJr7QtmWE4YtZfTzV7SZI6OkBawsjYKpWJoHSxKQutVWZib/4+IVU6hBC +2sy6N1gj7ewCZvuB6emzmePRViOaToAOsUhSobdJgmw63qcCj2/762LXq0yp53XdqCc GUDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=h9zUUwI5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t1-20020a50d701000000b0043e84f94612si15250200edi.614.2022.08.11.07.42.11; Thu, 11 Aug 2022 07:42:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=h9zUUwI5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235212AbiHKObh (ORCPT + 99 others); Thu, 11 Aug 2022 10:31:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43922 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235531AbiHKObA (ORCPT ); Thu, 11 Aug 2022 10:31:00 -0400 Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 035C674E33 for ; Thu, 11 Aug 2022 07:30:58 -0700 (PDT) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20220811143056euoutp0118bff8dbe907954c55aa8c912cd3d3ad~KUM2adLRC2164821648euoutp01S for ; Thu, 11 Aug 2022 14:30:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20220811143056euoutp0118bff8dbe907954c55aa8c912cd3d3ad~KUM2adLRC2164821648euoutp01S DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1660228256; bh=rIbhfxDBpj+Ii51tIIt4kTVb6ZA8NV8eQeaNrvmy2UQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=h9zUUwI568qVkNe5i6/uPwINDBUowXjf+xysvYJfHj2NweRWsmAq12Ik7aj73bfNH F+GcV8ggkZtv01mKwlu8719WprtWCPlstIIFaKcuZ2DdjTuU6lTCmDkuw1OYusit9I mKPcgDm6jNu4CbWxz7a56b/B56+Bko/Vqkg8VefY= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20220811143055eucas1p2d51c4b46b22206be2fa360812fdffb61~KUM08FzKq1001410014eucas1p2E; Thu, 11 Aug 2022 14:30:55 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id D1.9C.09580.E9215F26; Thu, 11 Aug 2022 15:30:54 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20220811143054eucas1p219e5b31b24cca97e2bc563351436543d~KUM0gN7qH2359623596eucas1p2H; Thu, 11 Aug 2022 14:30:54 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20220811143054eusmtrp287d06731f2d99f572e10a6e3fb2ba578~KUM0fcGiW0788907889eusmtrp2w; Thu, 11 Aug 2022 14:30:54 +0000 (GMT) X-AuditID: cbfec7f5-9c3ff7000000256c-be-62f5129ea721 Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 34.9F.09095.E9215F26; Thu, 11 Aug 2022 15:30:54 +0100 (BST) Received: from localhost (unknown [106.210.248.43]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20220811143054eusmtip1fd57ba199cdde6dcf3aee0684ec592b4~KUM0IuVmv3243332433eusmtip1C; Thu, 11 Aug 2022 14:30:54 +0000 (GMT) From: Pankaj Raghav To: snitzer@kernel.org, axboe@kernel.dk, hch@lst.de, agk@redhat.com, damien.lemoal@opensource.wdc.com Cc: linux-block@vger.kernel.org, Johannes.Thumshirn@wdc.com, bvanassche@acm.org, matias.bjorling@wdc.com, hare@suse.de, gost.dev@samsung.com, linux-nvme@lists.infradead.org, jaegeuk@kernel.org, pankydev8@gmail.com, linux-kernel@vger.kernel.org, dm-devel@redhat.com, Pankaj Raghav , Luis Chamberlain Subject: [PATCH v10 09/13] dm-zone: use generic helpers to calculate offset from zone start Date: Thu, 11 Aug 2022 16:30:39 +0200 Message-Id: <20220811143043.126029-10-p.raghav@samsung.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220811143043.126029-1-p.raghav@samsung.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Brightmail-Tracker: H4sIAAAAAAAAA01SbUxTZxjNe+/t7S1acylG3yjqdrWLslE1mOxdZIILW27ij0kiMcOYWfCK pC2a1gpKFhjiB98dyUBax9coX7qU0KKtCtPKp6gEK1qIbUnWxlmzAUFkDSi23Jr575znnPOe 50leCpd4BeuozKxTnDpLrmTICOJ6f2AktlYyl7ajdzEeme734+iqq4JEVdMBHC08HMFR978G ARq/Y8PQ7cZKDLVd7cOQ16TH0dtiN4a6Jz5HjptXSFTX7BMi3YU5HDl1PoBmjYVCdG3cR6DB ifWJEtbxZB9r07uErOOhlu1sLyJZc1Mee2s8n2Rt5z0CdqpnjGTLLe2ANQ/nsrO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O3JJ2EPK4fMXbY+esu+wel8+Wemxa1cnmsXlJ vcfumw1sHjtb77N6vN93lc2jb8sqRo/Np6s9Pm+S82g/0M0UwBOlZ1OUX1qSqpCRX1xiqxRt aGGkZ2hpoWdkYqlnaGwea2VkqqRvZ5OSmpNZllqkb5egl7Hs8Dfmgg7uiqvvlRoYezm7GDk5 JARMJPZ3TWDsYuTiEBJYyihxu28SC0RCQuL2wiZGCFtY4s+1LjaIomeMElvvLmTuYuTgYBPQ kmjsZAcxRQRyJQ4eCQQpYRZ4wyTReX0P2BxhgWiJjefnM4HYLAKqEj+P3gWL8wpYS3xbCTIG ZL68xMxL39lBbE6g+IRFF8HqhQSsJCZ0HGOHqBeUODnzCVgvM1B989bZzBMYBWYhSc1CklrA yLSKUSS1tDg3PbfYUK84Mbe4NC9dLzk/dxMjMHK3Hfu5eQfjvFcf9Q4xMnEwHmKU4GBWEuEt W/Q5SYg3JbGyKrUoP76oNCe1+BCjKdDdE5mlRJPzgakjryTe0MzA1NDEzNLA1NLMWEmc17Og I1FIID2xJDU7NbUgtQimj4mDU6qBaWp59vMHOZrt9ndrVgjZpGSILijcfvhzdEbglIotBkKR 2RuXbP516O33uewz2Koa9xRsyvBln5teu3eqn7xU0aMdweEVfS3RW3ZlMiYs6N9iIjtv33We TUZWiyQYT5y/qBe+w0qJ+b5ImGGypYtmRfcT8+OiBvKpsxf8vmedHPMyOu3x/S0lO87afyjs vCXx5eYdv9mXqt52rbDknHBt76krBrd13dqs96R/Xfmhb787U8HHeZafJxzOrqi+y2IQed7z 7PP5jS3LTinwX7yYHzz59gWhvs9H0vfekYtJStxSrdu4pf7NT84o/8oOO8UqrT1miiXVr1Mn TE0RWL4lLvXSq5nPKj3cNtbE5HduVGIpzkg01GIuKk4EAHvjSxNlAwAA X-CMS-MailID: 20220811143054eucas1p219e5b31b24cca97e2bc563351436543d X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20220811143054eucas1p219e5b31b24cca97e2bc563351436543d X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20220811143054eucas1p219e5b31b24cca97e2bc563351436543d References: <20220811143043.126029-1-p.raghav@samsung.com> X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use the bdev_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 Reviewed-by: Luis Chamberlain Reviewed-by: Damien Le Moal --- 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) return false; break; case REQ_OP_ZONE_APPEND: @@ -602,11 +603,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)bdev_zone_sectors(disk->part0) - 1; - orig_bio->bi_iter.bi_sector += - clone->bi_iter.bi_sector & mask; + bdev_offset_from_zone_start(disk->part0, clone->bi_iter.bi_sector); } return; -- 2.25.1