From patchwork Fri Sep 23 17:36:15 2022
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Pankaj Raghav
X-Patchwork-Id: 12986844
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 E9288C6FA82
for ; Fri, 23 Sep 2022 17:37:22 +0000 (UTC)
Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand
id S230421AbiIWRhU (ORCPT );
Fri, 23 Sep 2022 13:37:20 -0400
Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54956 "EHLO
lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org
with ESMTP id S232255AbiIWRgx (ORCPT
);
Fri, 23 Sep 2022 13:36:53 -0400
Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com
[210.118.77.12])
by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 268E715310A
for ;
Fri, 23 Sep 2022 10:36:35 -0700 (PDT)
Received: from eucas1p2.samsung.com (unknown [182.198.249.207])
by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id
20220923173633euoutp02539a26464984d3b04deb4802b0baefe2~XjeL8XPZn3258632586euoutp02O
for ;
Fri, 23 Sep 2022 17:36:33 +0000 (GMT)
DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com
20220923173633euoutp02539a26464984d3b04deb4802b0baefe2~XjeL8XPZn3258632586euoutp02O
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com;
s=mail20170921; t=1663954593;
bh=mYF3BflLJSX6KlMqYwCikWQ6QWnNIFxRzvAPPTHfZ4k=;
h=From:To:Cc:Subject:Date:In-Reply-To:References:From;
b=iuQrzx4sIW4o+NBRCp86K6arW0t0JQgqeMAGt9Cti/XKmgp8BMtRw08snkw8yp38f
mNee7EYxfela7GPPrfO+TZ45+lKHLIt/zReuNkPu/nAAhC34v3Y2hi71KghH0ZRKwD
+HjNMKD0vXt4Rn7k73yRfdvsr90hCYrhAp36adzE=
Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by
eucas1p2.samsung.com (KnoxPortal) with ESMTP id
20220923173631eucas1p270e18bb3079ae98a1dabe39d5c523112~XjeJ3s-8e2090220902eucas1p2j;
Fri, 23 Sep 2022 17:36:31 +0000 (GMT)
Received: from eucas1p2.samsung.com ( [182.198.249.207]) by
eusmges3new.samsung.com (EUCPMTA) with SMTP id 8A.97.19378.E9EED236;
Fri, 23
Sep 2022 18:36:30 +0100 (BST)
Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by
eucas1p2.samsung.com (KnoxPortal) with ESMTPA id
20220923173630eucas1p2bae6918f0c165051464e62c5172a80e0~XjeJaXYe12090620906eucas1p2q;
Fri, 23 Sep 2022 17:36:30 +0000 (GMT)
Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by
eusmtrp2.samsung.com (KnoxPortal) with ESMTP id
20220923173630eusmtrp237cccf5026ff5eaef52d2f5f142c38f2~XjeJZrk661023410234eusmtrp2_;
Fri, 23 Sep 2022 17:36:30 +0000 (GMT)
X-AuditID: cbfec7f5-a35ff70000014bb2-c0-632dee9e0e20
Received: from eusmtip2.samsung.com ( [203.254.199.222]) by
eusmgms2.samsung.com (EUCPMTA) with SMTP id CB.5F.10862.E9EED236;
Fri, 23
Sep 2022 18:36:30 +0100 (BST)
Received: from localhost (unknown [106.210.248.168]) by eusmtip2.samsung.com
(KnoxPortal) with ESMTPA id
20220923173630eusmtip22323d39c07b74819b2046f769f84a3ef~XjeJFAcbY2300023000eusmtip2l;
Fri, 23 Sep 2022 17:36:30 +0000 (GMT)
From: Pankaj Raghav
To: snitzer@kernel.org, axboe@kernel.dk, agk@redhat.com, hch@lst.de,
damien.lemoal@opensource.wdc.com
Cc: jaegeuk@kernel.org, gost.dev@samsung.com, bvanassche@acm.org,
linux-kernel@vger.kernel.org, hare@suse.de,
matias.bjorling@wdc.com, Johannes.Thumshirn@wdc.com,
linux-block@vger.kernel.org, linux-nvme@lists.infradead.org,
pankydev8@gmail.com, dm-devel@redhat.com,
Pankaj Raghav ,
Johannes Thumshirn
Subject: [PATCH v15 10/13] dm-table: allow zoned devices with non power-of-2
zone sizes
Date: Fri, 23 Sep 2022 19:36:15 +0200
Message-Id: <20220923173618.6899-11-p.raghav@samsung.com>
X-Mailer: git-send-email 2.25.1
In-Reply-To: <20220923173618.6899-1-p.raghav@samsung.com>
MIME-Version: 1.0
X-Brightmail-Tracker:
H4sIAAAAAAAAA+NgFrrHKsWRmVeSWpSXmKPExsWy7djP87rz3ukmG6xcZmOx/tQxZovVd/vZ
LKZ9+Mls8fvseWaLve9ms1rcPLCTyWLPoklMFitXH2WyeLJ+FrPF3657TBZ7b2lbXN41h81i
/rKn7BYT2r4yW3xe2sJusebmUxaLE7ekHQQ9Ll/x9tg56y67x+WzpR6bVnWyeWxeUu+x+2YD
m8fO1vusHu/3XWXz6NuyitFj8+lqj8+b5DzaD3QzBfBEcdmkpOZklqUW6dslcGV8WP6XrWAN
X8X8DxcYGxgvcXcxcnJICJhI9J9+wdrFyMUhJLCCUeLY9pdsEM4XRomHy6dDOZ8ZJSZNvsYM
07Lr9QJ2iMRyRon2zdcYIZyXjBIbzk4GynBwsAloSTR2soM0iAikSxzfehOsgVngJZPEg9N3
WUASwgKREo8eXACbyiKgKrGou5EJpJdXwFJi8m5HiGXyEjMvfQcbyQkU7m+sAQnzCghKnJz5
BGwKM1BJ89bZzCDjJQQ2c0rc/HyPBaLXReL3nLtQRwtLvDq+hR3ClpH4v3M+E4RdLfH0xm+o
5hZGif6d69lAlkkIWEv0nckBMZkFNCXW79KHKHeU2POtlRWigk/ixltBiBP4JCZtm84MEeaV
6GgTgqhWktj58wnUUgmJy01zoA7zkNi7/iPLBEbFWUiemYXkmVkIexcwMq9iFE8tL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ix+BTecVEJQ4OfMJC4jNDFTevHU28wRGgVlIUrOQpBYwMq1i
FEktLc5Nzy020itOzC0uzUvXS87P3cQIjNZtx35u2cG48tVHvUOMTByMhxglOJiVRHhTLuom
C/GmJFZWpRblxxeV5qQWH2I0Bbp6IrOUaHI+MF3klcQbmhmYGpqYWRqYWpoZK4nzehZ0JAoJ
pCeWpGanphakFsH0MXFwSjUw+SzfFNuwhLX13NGVG56JCEf5Bm+2673H7fouS3POXOsZCSwL
VbMnhF8y+3tsPmuAzsNX1uv6u2znpid/6Fbbd/dvut/hnOq7Boz/Jj/e0xtq97HfvXDn2cnP
zzHufsnw5Jfnjrip8pF9/47PvMXG4zOv6ch6ji1z8+pXPzPkfRkzZX/OVLeHrtyMlq++lyX+
izwfkbUrwWCbxb+SOaE/zEXOBd38e/zp8dsts7dNYPs43UlNN/jTzw+/I4x3fDmtXC+UdPKU
WkHHs6TDfycUyya+OOoaamG848ivKy47D8kflLHoKhBoy/F/77lgG2/XgkcTjk7k2m6lsik1
LIdpzbepPBUtLz7zvLPdtbrsBocSS3FGoqEWc1FxIgDY+CU0XwMAAA==
X-CMS-MailID: 20220923173630eucas1p2bae6918f0c165051464e62c5172a80e0
X-Msg-Generator: CA
X-RootMTR: 20220923173630eucas1p2bae6918f0c165051464e62c5172a80e0
X-EPHeader: CA
CMS-TYPE: 201P
X-CMS-RootMailID: 20220923173630eucas1p2bae6918f0c165051464e62c5172a80e0
References: <20220923173618.6899-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
Reviewed-by: Johannes Thumshirn
Reviewed-by: Mike Snitzer
---
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 e42016359a77..38b83c383e8f 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)) {
DMERR("%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)) {
DMERR("%s: len=%llu not aligned to h/w zone size %u of %pg",
dm_device_name(ti->table->md),
(unsigned long long)len,
@@ -1647,8 +1647,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)) {