Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3711028rwb; Tue, 16 Aug 2022 07:36:27 -0700 (PDT) X-Google-Smtp-Source: AA6agR53RasXPZhhVbvdV4twy0Jkd63+rsdHUNeghXyvowySbdqmW0ZAhPYfiQ1IxYIh2uwNi248 X-Received: by 2002:a05:6402:5488:b0:443:39c5:5347 with SMTP id fg8-20020a056402548800b0044339c55347mr18218983edb.204.1660660587628; Tue, 16 Aug 2022 07:36:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660660587; cv=none; d=google.com; s=arc-20160816; b=WM9Og2/2bAdoUF8Fd9Du3dMejA1afLBIrNNes0+m1OML6DkaK5IyuBm17/BhkNx87N ZoegdNoFp2JuKgTqV1r3bBx1UaukfJUdnJ6j9PgNtI70h9IBWcI4u3bwzpgZgrjJ8Pwm ftReG87neHWtIyjegzOu0RzJtRCkMc2a1gbVIxUIfai9qpfyGHHRFUcUSY0PZjIeL5eg tFtvqkBdXw0IkId6A5+4dFltmG6eHAwArF+z08Syd1skXh+bsJeMsJTDcWjyhYodPxhB /c3ha4F1S0JMiPpPOhuv5tLHPgYvIEVryT7/AMzGxcKQo3oZSxwD2o4U45Et6pwHPozr kUHw== 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=IFNpMDn/peVRwuWwPPPGFtajD39by7y/JM0u0WkVMBb8kDcvsv/gP0qjoPpuzYcU2j tqccJgUXdBdVk5HjULVbmuniIM7W/72rSdUTSdSkH1y61bvInWZ4vxPl0NfC52vneMue X0uy8U1hsOnC55B0l5ZeN+TyZymNYV4XuHPJw/L/B2SfFJq3RS2y9lROFLAfjO3ev/Sl PjSKGXnnU8E5YB95H9VYZYVp4u5/VT4B502Q5wVbTUD0bjA5g6lzRyeEFxunUWUdfkhm UVlIK1J3sTArJ9nGbRMlpIO6s+d5S1XRuQY2dzsNEO7R9RnrX7IA+fLMloxxKXvH3q7W KqPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=qFHmCgW3; 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 fy15-20020a170906b7cf00b007309350f2f9si8648322ejb.555.2022.08.16.07.36.00; Tue, 16 Aug 2022 07:36:27 -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=qFHmCgW3; 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 S235484AbiHPNQg (ORCPT + 99 others); Tue, 16 Aug 2022 09:16:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45814 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231701AbiHPNPw (ORCPT ); Tue, 16 Aug 2022 09:15:52 -0400 Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E36855A2F7 for ; Tue, 16 Aug 2022 06:15:50 -0700 (PDT) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20220816131549euoutp012d191db8b79258dcc018bb3cc18a6d1d~L1ZscEx4g0136201362euoutp01S for ; Tue, 16 Aug 2022 13:15:49 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20220816131549euoutp012d191db8b79258dcc018bb3cc18a6d1d~L1ZscEx4g0136201362euoutp01S DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1660655749; bh=rIbhfxDBpj+Ii51tIIt4kTVb6ZA8NV8eQeaNrvmy2UQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qFHmCgW3scAwFETWgtohASUPy96lLu279gtR4xXWKKnOc2aAvfbb1Xwx+anLwtQ5p cUSJDJ7b2AZLQJCw4T2EwznPWbT0esV5ONj6njbS/+oODe5CtkIvmoQDYgR/27pS12 M37na7QEV1qHMAkb++L+0/+k0QsS1QKJHwlSJGWw= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20220816131547eucas1p117ca36a8d41704af1b16d1b46b5efa8e~L1ZqrC7Nm0139001390eucas1p1O; Tue, 16 Aug 2022 13:15:47 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id 62.C7.10067.3889BF26; Tue, 16 Aug 2022 14:15:47 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20220816131547eucas1p1b38862475577332351efe91e5428e295~L1ZqCucnG0139001390eucas1p1N; Tue, 16 Aug 2022 13:15:47 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20220816131547eusmtrp1e5ef2ac3da3c85514713642b4ff8e425~L1ZqBB7Ss0149801498eusmtrp1M; Tue, 16 Aug 2022 13:15:47 +0000 (GMT) X-AuditID: cbfec7f4-dc1ff70000002753-24-62fb9883d59f Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 23.B0.09095.3889BF26; Tue, 16 Aug 2022 14:15:47 +0100 (BST) Received: from localhost (unknown [106.210.248.74]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20220816131546eusmtip1b8b1d7f74048b66552e093a2a310cee5~L1ZpvD_qw2676726767eusmtip1X; Tue, 16 Aug 2022 13:15:46 +0000 (GMT) From: Pankaj Raghav To: damien.lemoal@opensource.wdc.com, axboe@kernel.dk, snitzer@kernel.org, hch@lst.de, agk@redhat.com Cc: pankydev8@gmail.com, gost.dev@samsung.com, matias.bjorling@wdc.com, hare@suse.de, bvanassche@acm.org, linux-kernel@vger.kernel.org, dm-devel@redhat.com, linux-nvme@lists.infradead.org, jaegeuk@kernel.org, Johannes.Thumshirn@wdc.com, linux-block@vger.kernel.org, Pankaj Raghav , Luis Chamberlain Subject: [PATCH v11 09/13] dm-zone: use generic helpers to calculate offset from zone start Date: Tue, 16 Aug 2022 15:15:32 +0200 Message-Id: <20220816131536.189406-10-p.raghav@samsung.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220816131536.189406-1-p.raghav@samsung.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrIKsWRmVeSWpSXmKPExsWy7djP87rNM34nGWz9qGux/tQxZovVd/vZ LKZ9+Mls8fvseWaLve9ms1rcPLCTyWLPoklMFitXH2WyeLJ+FrPF3657TBZ7b2lbXN41h81i /rKn7BYT2r4yW9yY8JTR4vPSFnaLNTefslicuCXtIORx+Yq3x85Zd9k9Lp8t9di0qpPNY/OS eo/dNxvYPHa23mf1eL/vKptH35ZVjB6bT1d7fN4k59F+oJspgCeKyyYlNSezLLVI3y6BK2PZ 4W/MBR3cFVffKzUw9nJ2MXJySAiYSOx6O425i5GLQ0hgBaPE2dYrTBD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/rKn7BYT2r4yW9yY8JTR4vPSFnaLNTefslicuCXtIORx+Yq3x85Zd9k9Lp8t9di0qpPNY/OS eo/dNxvYPHa23mf1eL/vKptH35ZVjB6bT1d7fN4k59F+oJspgCdKz6Yov7QkVSEjv7jEVina 0MJIz9DSQs/IxFLP0Ng81srIVEnfziYlNSezLLVI3y5BL2PZ4W/MBR3cFVffKzUw9nJ2MXJy SAiYSEyafp+5i5GLQ0hgKaPE0S2tLBAJCYnbC5sYIWxhiT/Xutggip4xSuxZNBuog4ODTUBL orGTHaRGRCBXYtGyDlaQGmaBN0wSH+Z/YgJJCAtES7zafh1sEIuAqsT65dfZQHp5BawlGt9k QsyXl5h56TvYHE6g8L+GVWA3CAlYSbQdu8wMYvMKCEqcnPkELM4MVN+8dTbzBEaBWUhSs5Ck FjAyrWIUSS0tzk3PLTbUK07MLS7NS9dLzs/dxAiM3G3Hfm7ewTjv1Ue9Q4xMHIyHGCU4mJVE eAVf/EgS4k1JrKxKLcqPLyrNSS0+xGgKdPZEZinR5Hxg6sgriTc0MzA1NDGzNDC1NDNWEuf1 LOhIFBJITyxJzU5NLUgtgulj4uCUamBaUyflGGLNmJvIsPwMlxqPmajmL2ZfJpm8U2W+Z5Ou vFnYfjFFuCKOXeyT5cKJSwsi7SJ5d26+HaAsMaPD3cTzZ+uv/QEv6+aKG70MnXihiqHvUMgn o0495Xe7t387vXdTkm3O630T17X9ElqqodW/TM3rhLuBpPJmSaHsO++vczR/Z1PONuN6dDT6 csqDG+dtlYsfvL9+4xRvyFvn6IQrnmbHRe8LXvu237zv4NQHn73S9ycbsz41tvB+557/8F3+ pIXhn2e7BHHM0ecWK1rN9OV65bXbJ2v8dX4s1/v64r3PluCt9s9WW/BcDLihKM/083y2xJTL cz8c9915Y12NyPb/lrPnzeP/Uubm9u68EktxRqKhFnNRcSIA2wH34GUDAAA= X-CMS-MailID: 20220816131547eucas1p1b38862475577332351efe91e5428e295 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20220816131547eucas1p1b38862475577332351efe91e5428e295 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20220816131547eucas1p1b38862475577332351efe91e5428e295 References: <20220816131536.189406-1-p.raghav@samsung.com> X-Spam-Status: No, score=-7.1 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=ham 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