Received: by 2002:a05:6602:2086:0:0:0:0 with SMTP id a6csp4721232ioa; Wed, 27 Apr 2022 09:38:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxhlb8Yr45AAtyvVCVBhBymX11EIMe7P3WEWuBNPwUUTOwTw+t4FIB6914vvogVy38Eq0SN X-Received: by 2002:a17:902:c2d0:b0:15a:2344:f8a4 with SMTP id c16-20020a170902c2d000b0015a2344f8a4mr29783968pla.28.1651077516566; Wed, 27 Apr 2022 09:38:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651077516; cv=none; d=google.com; s=arc-20160816; b=ltlCkT/y4+PWt5IYzMsU1SBV5xfGZTF8klUFhqzmK+IY518A7mLNZj4X+Bjw7ruxJO 5n9svmFuCC0WqjrGL+TAYbU48ZtAHcQj3B1UVqB4wkorTBSZcYo8oCE1hNxVoJZO7bly dvxuPf9Icf9Ptmq2EbDZ15ctaovrjqCNXK5iQ54oGTVeJlqP6Aoj4Q0xhGsKAG4F7C/v xwyDmB746UfW7+JbeeN4DVVVPbH+/gWnisLFKJKX1xv/mY9hNdJQYzA8sGese2jtKktk SuP9CSjWI6sgNYk1XxxYajkhUPk9QkYePjRmA8bQK6zK8pb5wtxfTJpKzjVJGalatZus JYJw== 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=Z59AramoBMIFuOXUYYH05DZBLjfbCNMGUst3i9j3Z7Q=; b=rr7YJ82sOZeJcocb691+EXfqz0fWe+2q4ps1ceEtrg2DvOamWM3H8JgqmKreORVSNA GiBcL3Gdk36R6icl+26Qres1neacGnvVmmy1KcQ3S4OafGt9xI+K0t1U8bjhDaaufOTP al/tC5wsOvXBFyvEFqirBP11RRBY2hr1EteOqZzmKYGbfpcP9fS1zB+rmnOgfNJYhy0Q DQrRVregt9cjZIGkxU+pp0BiRdjhtakIV5Ogl+L4rfGoHCjho3KWHwJ+G+Meyp9Ka5z1 lGCCg5BkzUvhghUViXxPgHCrFViPBFC7wE+0YOtNiMw5F2wj4SaY8blxJZSNe3S0hdix 2kaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=W7RCwmZt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id l14-20020a170903120e00b0015d5f04f328si1429526plh.372.2022.04.27.09.38.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Apr 2022 09:38:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=W7RCwmZt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 04D05490259; Wed, 27 Apr 2022 09:08:07 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241846AbiD0QIS (ORCPT + 99 others); Wed, 27 Apr 2022 12:08:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49276 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241769AbiD0QHV (ORCPT ); Wed, 27 Apr 2022 12:07:21 -0400 Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D82043D282E for ; Wed, 27 Apr 2022 09:03:15 -0700 (PDT) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20220427160310euoutp0289e6c81864e559e7d15f213e1d6dc7b1~pzFHNMRGO1615616156euoutp02N for ; Wed, 27 Apr 2022 16:03:10 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20220427160310euoutp0289e6c81864e559e7d15f213e1d6dc7b1~pzFHNMRGO1615616156euoutp02N DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1651075390; bh=Z59AramoBMIFuOXUYYH05DZBLjfbCNMGUst3i9j3Z7Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=W7RCwmZtNSpvqE8y4evit2Zuyld27ntnSWb6JvmMVBxMaxqsV2CNMLB1BGalJnTQP YU0C/GItlU594cRcvi1Dbxne/WVtaDdWMEvWlL9JbbHa5tK/3iAwedjLyWAn8J47KM uIoIWOO+pVS0kGYKL9LDlUfRYQeyBV2VT2nUvGbg= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20220427160308eucas1p29e66b3685c84483f3fdd5a90299d93e1~pzFFvrXVn2333623336eucas1p2p; Wed, 27 Apr 2022 16:03:08 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id 8C.0A.10260.C3969626; Wed, 27 Apr 2022 17:03:08 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20220427160307eucas1p229f9ebae38fcca9974909799e5e63ccf~pzFFKDoBX2335623356eucas1p2h; Wed, 27 Apr 2022 16:03:07 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20220427160307eusmtrp194cac78e29ca037961137d3a49caf9ec~pzFFDipZN2142221422eusmtrp1D; Wed, 27 Apr 2022 16:03:07 +0000 (GMT) X-AuditID: cbfec7f5-bddff70000002814-96-6269693c7e10 Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 85.A7.09404.B3969626; Wed, 27 Apr 2022 17:03:07 +0100 (BST) Received: from localhost (unknown [106.210.248.162]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20220427160307eusmtip1fe2208eed35a4c2cc164aecccf9c648a~pzFEt7JbD1109611096eusmtip1x; Wed, 27 Apr 2022 16:03:07 +0000 (GMT) From: Pankaj Raghav To: jaegeuk@kernel.org, axboe@kernel.dk, snitzer@kernel.org, hch@lst.de, mcgrof@kernel.org, naohiro.aota@wdc.com, sagi@grimberg.me, damien.lemoal@opensource.wdc.com, dsterba@suse.com, johannes.thumshirn@wdc.com Cc: linux-kernel@vger.kernel.org, linux-btrfs@vger.kernel.org, clm@fb.com, gost.dev@samsung.com, chao@kernel.org, linux-f2fs-devel@lists.sourceforge.net, josef@toxicpanda.com, jonathan.derrick@linux.dev, agk@redhat.com, kbusch@kernel.org, kch@nvidia.com, linux-nvme@lists.infradead.org, dm-devel@redhat.com, bvanassche@acm.org, jiangbo.365@bytedance.com, linux-fsdevel@vger.kernel.org, matias.bjorling@wdc.com, linux-block@vger.kernel.org, Pankaj Raghav Subject: [PATCH 11/16] btrfs: zoned: relax the alignment constraint for zoned devices Date: Wed, 27 Apr 2022 18:02:50 +0200 Message-Id: <20220427160255.300418-12-p.raghav@samsung.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220427160255.300418-1-p.raghav@samsung.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Brightmail-Tracker: H4sIAAAAAAAAA01Se0xTZxzNd+/t7S2z7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a/J+if9fbyVPcrR819umO4l9WfiedHM9K3yc/6Gbyg62Tsx7MYf/zfPimqaavWu+PZK MFqoGGlO1k35krMgp0nx9Pnrk9v+V+5Oj9WaYmo1f90kBvnlXxa+kvf/lb3Zf/fVXQn9s8vy mlri9jQ9lBUtLUw71Ht/Pu/8Sx8y+xa/z3qlkhm3PE9bSebp4+RTjpGcG7Rv817UnFhZHV72 4sg0++ZHk1j8eddUrNkx64SjxfM/27/d+Mxw52zurrkCx825z/sceibeyelzr+vJC48DMxy0 3zutXD6Fa2E1z7w1r6a1PD37+/TBpn/VXgebj/CvDIt2udqfe01MzXFXetXfVRx1z3r8lViK MxINtZiLihMBMHgdG7EDAAA= X-CMS-MailID: 20220427160307eucas1p229f9ebae38fcca9974909799e5e63ccf X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20220427160307eucas1p229f9ebae38fcca9974909799e5e63ccf X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20220427160307eucas1p229f9ebae38fcca9974909799e5e63ccf References: <20220427160255.300418-1-p.raghav@samsung.com> X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE 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 Checks were in place to return error when a non power-of-2 zoned devices is detected. Remove those checks as non power-of-2 zoned devices are now supported. Relax the zone size constraint to align with the BTRFS_STRIPE_LEN(64k) so that block groups are aligned to the BTRFS_STRIPE_LEN. Reviewed-by: Luis Chamberlain Signed-off-by: Pankaj Raghav --- fs/btrfs/zoned.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/fs/btrfs/zoned.c b/fs/btrfs/zoned.c index 8f3f542e174c..3ed085762f14 100644 --- a/fs/btrfs/zoned.c +++ b/fs/btrfs/zoned.c @@ -395,8 +395,7 @@ int btrfs_get_dev_zone_info(struct btrfs_device *device, bool populate_cache) zone_sectors = bdev_zone_sectors(bdev); } - /* Check if it's power of 2 (see is_power_of_2) */ - ASSERT(zone_sectors != 0 && (zone_sectors & (zone_sectors - 1)) == 0); + ASSERT(zone_sectors != 0 && IS_ALIGNED(zone_sectors, BTRFS_STRIPE_LEN)); zone_info->zone_size = zone_sectors << SECTOR_SHIFT; /* We reject devices with a zone size larger than 8GB */ @@ -835,9 +834,11 @@ int btrfs_sb_log_location_bdev(struct block_device *bdev, int mirror, int rw, ASSERT(rw == READ || rw == WRITE); - if (!is_power_of_2(bdev_zone_sectors(bdev))) - return -EINVAL; nr_sectors = bdev_nr_sectors(bdev); + + if (!IS_ALIGNED(nr_sectors, BTRFS_STRIPE_LEN)) + return -EINVAL; + nr_zones = bdev_zone_no(bdev, nr_sectors); sb_zone = sb_zone_number(bdev, mirror); -- 2.25.1