Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp3771717rwa; Tue, 23 Aug 2022 09:51:48 -0700 (PDT) X-Google-Smtp-Source: AA6agR67uyngHq6Z9oNkYoUvT0e8nhH4TiebFmXfqv6EDww1u8N+W4/Aql3/daav5NJtc+MKp46X X-Received: by 2002:a63:85c1:0:b0:42a:1230:e3c2 with SMTP id u184-20020a6385c1000000b0042a1230e3c2mr20514687pgd.370.1661273508682; Tue, 23 Aug 2022 09:51:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661273508; cv=none; d=google.com; s=arc-20160816; b=n1Ih+QdTDC3xr/1o7xmMSi0TPuqcFQXanP2l3Ra0EQ45zapOaVPo9g0G30xwupKCtd bNEbo+nsVzgW9lPDk5CyQHzejQOd6vYAboKJirseKEzP8w6/EkRLzEH6bW/kEt6MHKvM 0WEVnmVao/cBIt+aCSSpeBNfhIRMSor4vXKIbuZjzuECfpA4VgiIuiv62KXTk8VKcfZv jcPb1/sXbfRPnF8j+VvfToFN5IL5dgUKkVLbtzl5neOzmS/igGk7v1tzVu3GTwVIT+75 KTa8WegouGk6fygpSogifMx9mIltzwEFJfReFIsGQzVPOx7GdBv/4eNyM4m/XfYplELz 0AQw== 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=rwrR95VBKntQTDKdi+ldY8ggDErFsfT3t9lp/si7I3M=; b=kuRcg5BrZ66D+qIvMXhPM6qMSRjwsf61OfWXvlQeWuVqRKAe3ppINfqNmXBVURdsXc QKf5wlIg1OoH+1ieJxHh87z/WvBQM1rvHN/6JJGP2wZa4L6IesW8Wul+Aedxx1qqqjdU NsSiu72evVdoe7ja/9mk+ru+DHgpOQIMsy1kHQpgDsMK2vU0gsRqcq8XmH9mBiPZ1dFG fEKXkKsspQ07QzRJGyv50L1oxDp0VCRpHBmDM/gs2u0jCIEpNwdw4BXbPEdHiYDGuiH+ hGZ13u0gu/bDn2bIYtIot6K62beBD63iOjPAK6uygalVEndgrYDCjbOaSg8hII4c95Gr 5d3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b="EHrcAM/f"; 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 d17-20020a170903231100b001729bbf257fsi1591252plh.112.2022.08.23.09.51.38; Tue, 23 Aug 2022 09:51:48 -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="EHrcAM/f"; 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 S244107AbiHWQPw (ORCPT + 99 others); Tue, 23 Aug 2022 12:15:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56466 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244459AbiHWQP0 (ORCPT ); Tue, 23 Aug 2022 12:15:26 -0400 Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 35E248E4FE for ; Tue, 23 Aug 2022 05:36:42 -0700 (PDT) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20220823121914euoutp01d8b3264d1c79f84ad130c0753e8d8a0e~N_JSfw3Ft1729817298euoutp01a for ; Tue, 23 Aug 2022 12:19:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20220823121914euoutp01d8b3264d1c79f84ad130c0753e8d8a0e~N_JSfw3Ft1729817298euoutp01a DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1661257154; bh=rwrR95VBKntQTDKdi+ldY8ggDErFsfT3t9lp/si7I3M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EHrcAM/fECWHA4d264kl7GeMzsolp3NwaIFh2GpZgHC+0QT4cRHxt5HF+LnAV8mWw fKy0n1MH7q2tNhvQ81xvpkvRgDLu5oNC/ASA1+SrGpnROenbZ+sHsEhhCBrQCZN6cF c07y1ggnMNJ5S+sVAKdNsxD9AIaxTeN6Ui+UrXbU= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20220823121912eucas1p2e8f19f59fde5e7242ae317e574bfe0ec~N_JQo_25C2219222192eucas1p2f; Tue, 23 Aug 2022 12:19:12 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id 51.92.29727.0C5C4036; Tue, 23 Aug 2022 13:19:12 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20220823121912eucas1p18223e1b04b65a8a10f6c50187e7474ea~N_JP-yQ0B1882018820eucas1p1W; Tue, 23 Aug 2022 12:19:12 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20220823121912eusmtrp25ede222dcc699b75396ed2ec6947dd4e~N_JP_5LBT2723427234eusmtrp2l; Tue, 23 Aug 2022 12:19:12 +0000 (GMT) X-AuditID: cbfec7f2-21dff7000001741f-97-6304c5c0c0c5 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 3A.12.07473.FB5C4036; Tue, 23 Aug 2022 13:19:12 +0100 (BST) Received: from localhost (unknown [106.210.248.52]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20220823121911eusmtip21e834d44802a27da7ae0b65ee5c12be9~N_JPr2CtE1999619996eusmtip2Q; Tue, 23 Aug 2022 12:19:11 +0000 (GMT) From: Pankaj Raghav To: agk@redhat.com, snitzer@kernel.org, axboe@kernel.dk, damien.lemoal@opensource.wdc.com, hch@lst.de Cc: pankydev8@gmail.com, Johannes.Thumshirn@wdc.com, linux-block@vger.kernel.org, dm-devel@redhat.com, hare@suse.de, jaegeuk@kernel.org, linux-kernel@vger.kernel.org, matias.bjorling@wdc.com, gost.dev@samsung.com, bvanassche@acm.org, linux-nvme@lists.infradead.org, Pankaj Raghav Subject: [PATCH v12 10/13] dm-table: allow zoned devices with non power-of-2 zone sizes Date: Tue, 23 Aug 2022 14:18:56 +0200 Message-Id: <20220823121859.163903-11-p.raghav@samsung.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220823121859.163903-1-p.raghav@samsung.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrPKsWRmVeSWpSXmKPExsWy7djP87oHjrIkG9yZpmOx/tQxZovVd/vZ LKZ9+Mls8fvseWaLve9ms1rcPLCTyWLPoklMFitXH2WyeLJ+FrPF3657TBZ7b2lbXN41h81i /rKn7BYT2r4yW3xe2sJusebmUxaLE7ekHQQ9Ll/x9tg56y67x+WzpR6bVnWyeWxeUu+x+2YD m8fO1vusHu/3XWXz6NuyitFj8+lqj8+b5DzaD3QzBfBEcdmkpOZklqUW6dslcGVcvn+HteAI b8Wqhy2MDYwfuLoYOTkkBEwkPiw4xNjFyMUhJLCCUeLZu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2r4yW3xe2sJusebmUxaLE7ekHQQ9Ll/x9tg56y67x+WzpR6bVnWyeWxeUu+x+2YD m8fO1vusHu/3XWXz6NuyitFj8+lqj8+b5DzaD3QzBfBE6dkU5ZeWpCpk5BeX2CpFG1oY6Rla WugZmVjqGRqbx1oZmSrp29mkpOZklqUW6dsl6GVcvn+HteAIb8Wqhy2MDYwfuLoYOTgkBEwk jk1L72Lk4hASWMoo8fblP5YuRk6guITE7YVNjBC2sMSfa11sEEXPGCXOz9nMBtLMJqAl0djJ DlIjIpArcXjzBCaQGmaBI0wSqxvXsoIkhAXCJSZfPMUEYrMIqEr8an4PtoBXwFrix5UGJogF 8hIzL30HG8QJFJ+39BTYYiEBK4n5tz6xQdQLSpyc+QSslxmovnnrbOYJjAKzkKRmIUktYGRa xSiSWlqcm55bbKhXnJhbXJqXrpecn7uJERix24793LyDcd6rj3qHGJk4GA8xSnAwK4nwVl9k SBbiTUmsrEotyo8vKs1JLT7EaAp090RmKdHkfGDKyCuJNzQzMDU0MbM0MLU0M1YS5/Us6EgU EkhPLEnNTk0tSC2C6WPi4JRqYNr2N3V3WdvXH3GSXyqOF0xe9u7xw3lzzhus2GwTb6Xv5hhR Xnsq+TTjlf/fLRj6/lp+PHRQPjLkwG8tzSN2mu0vpnZNK3n85sDjHYyZhx6rlrKzh3YFXz2z 4GBU65s5H47YW2v07fg5vXa75QXtlZMcz2rMLQhssdfe2JtxO2+N7tHXm20znkUk9Eositlf 4SbYVjDt6/frEsqlv3blXPLkZT4/U7SM7yp7l7j1xoc3zx6ISfv5sU25IG3KXre/7Dxh9x9V 5Jz6Uv/OTWzdSemcf599zvnHfvXdd8f+e9wa9dh3/723cSfKn5yUZxOy8e6z/S0F5Vtv3+H+ /+h71ZurK+qfTvVZVXel+89GpV3eSizFGYmGWsxFxYkAvoYeHWEDAAA= X-CMS-MailID: 20220823121912eucas1p18223e1b04b65a8a10f6c50187e7474ea X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20220823121912eucas1p18223e1b04b65a8a10f6c50187e7474ea X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20220823121912eucas1p18223e1b04b65a8a10f6c50187e7474ea References: <20220823121859.163903-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 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)) { -- 2.25.1