From patchwork Mon Sep 12 08:22:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pankaj Raghav X-Patchwork-Id: 12973440 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 6945BECAAA1 for ; Mon, 12 Sep 2022 08:23:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230399AbiILIXo (ORCPT ); Mon, 12 Sep 2022 04:23:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56396 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230188AbiILIWr (ORCPT ); Mon, 12 Sep 2022 04:22:47 -0400 Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EAA472F386 for ; Mon, 12 Sep 2022 01:22:41 -0700 (PDT) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20220912082228euoutp0197573f01d46763f4f76c3a3f44f263db~UD0RlopNc1428914289euoutp01X for ; Mon, 12 Sep 2022 08:22:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20220912082228euoutp0197573f01d46763f4f76c3a3f44f263db~UD0RlopNc1428914289euoutp01X DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1662970948; bh=TpfC5qsHCn42VD0VfMrShkUip45l4QnJQo5SdQLOwtI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oZPoYBx2dKfdCinH2zMCwcqWzTFokBq8qrH9UUQBXq4wUNW8Kf0Xuuf92lC0AkldG T5CTEw7JiJnxKb99dRwV+ptMlCvxVKtVziDnZkUNktSOj0AfFqJEFaccF187RyLCt+ 92x007/LPdEoUwNUc/lZFQ9PwuBMxBcFeRn6Vag8= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20220912082217eucas1p2f7bf2d8409887d0b45bb91d5e0838a8b~UD0HPCGjb2080820808eucas1p2G; Mon, 12 Sep 2022 08:22:17 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id D7.A3.19378.93CEE136; Mon, 12 Sep 2022 09:22:17 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20220912082217eucas1p15e4ba29d1438990db4acf5c3f6ca5d4f~UD0Gx0szG1088110881eucas1p1_; Mon, 12 Sep 2022 08:22:17 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20220912082217eusmtrp2054a1249e949edbdccfec0c6c6024005~UD0Gw9xSo3116631166eusmtrp2M; Mon, 12 Sep 2022 08:22:17 +0000 (GMT) X-AuditID: cbfec7f5-a35ff70000014bb2-6b-631eec39b733 Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 01.43.10862.93CEE136; Mon, 12 Sep 2022 09:22:17 +0100 (BST) Received: from localhost (unknown [106.210.248.191]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20220912082216eusmtip12dbcb83e6c6a0b4a645929a361eb1f31~UD0GZZdty0898808988eusmtip1i; Mon, 12 Sep 2022 08:22:16 +0000 (GMT) From: Pankaj Raghav To: hch@lst.de, agk@redhat.com, damien.lemoal@opensource.wdc.com, axboe@kernel.dk, snitzer@kernel.org Cc: linux-kernel@vger.kernel.org, Johannes.Thumshirn@wdc.com, linux-nvme@lists.infradead.org, pankydev8@gmail.com, matias.bjorling@wdc.com, linux-block@vger.kernel.org, bvanassche@acm.org, gost.dev@samsung.com, dm-devel@redhat.com, hare@suse.de, jaegeuk@kernel.org, Pankaj Raghav Subject: [PATCH v13 10/13] dm-table: allow zoned devices with non power-of-2 zone sizes Date: Mon, 12 Sep 2022 10:22:01 +0200 Message-Id: <20220912082204.51189-11-p.raghav@samsung.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220912082204.51189-1-p.raghav@samsung.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrHKsWRmVeSWpSXmKPExsWy7djP87qWb+SSDXbfULVYf+oYs8Xqu/1s FtM+/GS2+H32PLPF3nezWS1uHtjJZLFn0SQmi5WrjzJZPFk/i9nib9c9Jou9t7QtLu+aw2Yx f9lTdosJbV+ZLT4vbWG3WHPzKYvFiVvSDoIel694e+ycdZfd4/LZUo9NqzrZPDYvqffYfbOB zWNn631Wj/f7rrJ59G1Zxeix+XS1x+dNch7tB7qZAniiuGxSUnMyy1KL9O0SuDIevLnKUvCO t2LP7CamBsaZ3F2MnBwSAiYSq5YuZe5i5OIQEljBKPHv9ldGCOcLo8T9eYdYQKqEBD4zSkxf 5QjTcWv7RiaIouWMEl93NrNDOC8ZJT682QTUwcHBJqAl0djJDtIgIpAu8X36O7AGZoFtTBL3 H75gBkkIC0RKTPvbwARiswioSsyb3swIYvMKWEk8OryVGWKbvMTMS9/BBnECxV+vaoWqEZQ4 OfMJ2HXMQDXNW2dD1W/mlHg7RQjCdpHo7jvHBGELS7w6voUdwpaR+L9zPlS8WuLpjd9g/0sI tDBK9O9czwbygISAtUTfmRwQk1lAU2L9Ln2IckeJ13enM0FU8EnceCsIcQGfxKRt05khwrwS HW1QByhJ7Pz5BGqphMTlpjksELaHxO21b9knMCrOQvLLLCS/zELYu4CReRWjeGppcW56arFx Xmq5XnFibnFpXrpecn7uJkZgEjz97/jXHYwrXn3UO8TIxMF4iFGCg1lJhJfFUDpZi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v3csoNx5auPeocYmTgYDzFKcDArifCyGEon C/GmJFZWpRblxxeV5qQWH2I0Bbp7IrOUaHI+MGXklcQbmhmYGpqYWRqYWpoZK4nzehZ0JAoJ pCeWpGanphakFsH0MXFwSjUw7cmqNvL9e3jp6Sfnexp9apbMenLnXMI+mbK3XsvmsuU/DfsX MUXB/Sf3EnatbOUzgryLme8v5n2/1GWOF+vuJ6Gpf34svCrVs9LQIYy3UPbcnZMzMrfP13oc 4qfapeomteDY586pC5q7ZV/ufrbbJSKwWfBtgdGcBTdOWkifmaWjfeL/5aj8Y1cN82Y63ec7 eLFl5tw90w/sv6v/b93U75rH/3atE/5jE/9Tqundg43fkh4/V5wqVqxTt9T+80INja9eS+z3 Hmm/GvLw/TXRzOO8JtdTORqXbX0seX1lZk+1fsWfQ4KlZYI1mfyJAWtPc516f9HM4vnNHZn1 PCmu+2ed2fbx2p8I1oIr93dru79UYinOSDTUYi4qTgQAPQVwpmEDAAA= X-CMS-MailID: 20220912082217eucas1p15e4ba29d1438990db4acf5c3f6ca5d4f X-Msg-Generator: CA X-RootMTR: 20220912082217eucas1p15e4ba29d1438990db4acf5c3f6ca5d4f X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20220912082217eucas1p15e4ba29d1438990db4acf5c3f6ca5d4f References: <20220912082204.51189-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: Mike Snitzer Reviewed-by: Johannes Thumshirn --- 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)) {