From patchwork Thu Aug 11 14:30:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pankaj Raghav X-Patchwork-Id: 12941482 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 41435C25B0C for ; Thu, 11 Aug 2022 14:31:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235518AbiHKObK (ORCPT ); Thu, 11 Aug 2022 10:31:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43924 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235540AbiHKObB (ORCPT ); Thu, 11 Aug 2022 10:31:01 -0400 Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F3BC8753A6 for ; Thu, 11 Aug 2022 07:30:58 -0700 (PDT) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20220811143057euoutp02e8937afa64d43cfd0d5241a629b8080d~KUM3ivhdr1911919119euoutp02V for ; Thu, 11 Aug 2022 14:30:57 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20220811143057euoutp02e8937afa64d43cfd0d5241a629b8080d~KUM3ivhdr1911919119euoutp02V DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1660228257; bh=rwrR95VBKntQTDKdi+ldY8ggDErFsfT3t9lp/si7I3M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ai6aDrNkh0eQwL/qofv+ISxJWVGmLw4uuTo9XT81CcoUbMFTCV/Yd+fpYssbfazrU G6f9sa/6MC1Pfjh6REpiCrjUXLNF8EHUj3wkcu1+Y4xtIbRTfXG6Np3OSDSI/7lYRD eLcZWS03lU7z+gDoTBs6dp6UrvchnKFdrgSELeDM= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20220811143056eucas1p29b49d12b0338a4711a28d327fff7e6ef~KUM2A2ali2350223502eucas1p2N; Thu, 11 Aug 2022 14:30:56 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id C8.3A.09664.0A215F26; Thu, 11 Aug 2022 15:30:56 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20220811143055eucas1p2211be7f9ed867e40df58c25e6222be2d~KUM1h4IZp1002510025eucas1p2N; Thu, 11 Aug 2022 14:30:55 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20220811143055eusmtrp21d2729a01fe711c562dc7208725ba968~KUM1g-qmk0788907889eusmtrp2y; Thu, 11 Aug 2022 14:30:55 +0000 (GMT) X-AuditID: cbfec7f2-d81ff700000025c0-06-62f512a0328a Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id C5.9F.09095.F9215F26; Thu, 11 Aug 2022 15:30:55 +0100 (BST) Received: from localhost (unknown [106.210.248.43]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20220811143055eusmtip27cf972cf7bdafadf6e46b39ae5ae2fed~KUM1NLS-a1262412624eusmtip2y; Thu, 11 Aug 2022 14:30:55 +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 Subject: [PATCH v10 10/13] dm-table: allow zoned devices with non power-of-2 zone sizes Date: Thu, 11 Aug 2022 16:30:40 +0200 Message-Id: <20220811143043.126029-11-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 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrDKsWRmVeSWpSXmKPExsWy7djP87oLhL4mGcxdzG6x/tQxZovVd/vZ LKZ9+Mls8fvseWaLve9ms1rcPLCTyWLPoklMFitXH2WyeLJ+FrPF3657TBZ7b2lbXN41h81i /rKn7BYT2r4yW3xe2sJusebmUxaLE7ekHQQ9Ll/x9tg56y67x+WzpR6bVnWyeWxeUu+x+2YD m8fO1vusHu/3XWXz6NuyitFj8+lqj8+b5DzaD3QzBfBEcdmkpOZklqUW6dslcGVcvn+HteAI b8Wqhy2MDYwfuLoYOTkkBEwk1h3Zxd7FyMUhJLCCUWLnzw3MIAkhgS+MEtfnikIkPjNKvD+4 ggWm49uGfVAdyxklFu6exwTR8YJR4t/LiC5GDg42AS2Jxk52kLCIQLrE+gXLwXqZBbYxSWx5 IAxiCwtESrTe6gCrYRFQlbi5/isbiM0rYC1xaskSVohd8hIzL30Hq+EEik9YdJEJokZQ4uTM J1Az5SWat85mBrlHQmA9p8TSS+eYIJpdJNbeWAFlC0u8Or6FHcKWkfi/cz5UvFri6Y3fUM0t jBL9O9ezgTwgAbSt70wOiMksoCmxfpc+RNRRYtJHWwiTT+LGW0GIC/gkJm2bzgwR5pXoaBOC mK0EDM0nUDslJC43zYEGoIdEz4oupgmMirOQ/DILyS+zENYuYGRexSieWlqcm55abJiXWq5X nJhbXJqXrpecn7uJEZgAT/87/mkH49xXH/UOMTJxMB5ilOBgVhLhLVv0OUmINyW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yz8372Cc9+qj3iFGJg7GQ4wSHMxKIrxliz4n CfGmJFZWpRblxxeV5qQWH2I0Bbp7IrOUaHI+MGXklcQbmhmYGpqYWRqYWpoZK4nzehZ0JAoJ pCeWpGanphakFsH0MXFwSjUwce1/6Ljx3l6GRN/Xnx3m8p54dIHzrE+sDFO1mYBIxw6DR4kt rSaRWR488ziUVY4G2q7Q9zrx7D8r55+IMwZLw/601cc/16hMnR9aoGAY7ylrN+1lzGSfSRtU 2/n+f165780Et9VzZ/pJvn37UtRexfcIe9q63thDSvf9k6/PeDrj80Z7vv+CpmFuPDN0cs9G BMxr9/yxaefz/ZLbO5ii7c5niy+M+fYnPefRVs3s+O3KMtfjahZXpzY1X4u4sbDN2pvj7WLh 7Hkmv3uFXKR/Wk62VuafU/swomfOxRNa3+ZtdvXnZn2oIVP3kHmZ760FBxuFvqiv9Lit+tXe vLXu+Sft/48DGKbfVS+p3j1PiaU4I9FQi7moOBEAYdrlj2EDAAA= X-CMS-MailID: 20220811143055eucas1p2211be7f9ed867e40df58c25e6222be2d X-Msg-Generator: CA X-RootMTR: 20220811143055eucas1p2211be7f9ed867e40df58c25e6222be2d X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20220811143055eucas1p2211be7f9ed867e40df58c25e6222be2d References: <20220811143043.126029-1-p.raghav@samsung.com> Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Allow dm to support zoned devices with non power-of-2(po2) zone sizes as the block layer now supports it. Signed-off-by: Pankaj Raghav Reviewed-by: Bart Van Assche Reviewed-by: Damien Le Moal --- drivers/md/dm-table.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c index 332f96b58252..31eb1d29d136 100644 --- a/drivers/md/dm-table.c +++ b/drivers/md/dm-table.c @@ -250,7 +250,7 @@ static int device_area_is_invalid(struct dm_target *ti, struct dm_dev *dev, if (bdev_is_zoned(bdev)) { unsigned int zone_sectors = bdev_zone_sectors(bdev); - if (start & (zone_sectors - 1)) { + if (!bdev_is_zone_start(bdev, start)) { DMWARN("%s: start=%llu not aligned to h/w zone size %u of %pg", dm_device_name(ti->table->md), (unsigned long long)start, @@ -267,7 +267,7 @@ static int device_area_is_invalid(struct dm_target *ti, struct dm_dev *dev, * devices do not end up with a smaller zone in the middle of * the sector range. */ - if (len & (zone_sectors - 1)) { + if (!bdev_is_zone_start(bdev, len)) { DMWARN("%s: len=%llu not aligned to h/w zone size %u of %pg", dm_device_name(ti->table->md), (unsigned long long)len, @@ -1642,8 +1642,7 @@ static int validate_hardware_zoned_model(struct dm_table *t, return -EINVAL; } - /* Check zone size validity and compatibility */ - if (!zone_sectors || !is_power_of_2(zone_sectors)) + if (!zone_sectors) return -EINVAL; if (dm_table_any_dev_attr(t, device_not_matches_zone_sectors, &zone_sectors)) {