From patchwork Wed Aug 3 09:47:49 2022
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Pankaj Raghav
X-Patchwork-Id: 12935318
X-Patchwork-Delegate: snitzer@redhat.com
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 us-smtp-delivery-124.mimecast.com
(us-smtp-delivery-124.mimecast.com [170.10.129.124])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by smtp.lore.kernel.org (Postfix) with ESMTPS id 57CD5C25B0E
for ; Wed, 3 Aug 2022 09:48:19 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
s=mimecast20190719; t=1659520098;
h=from:from:sender:sender:reply-to:subject:subject:date:date:
message-id:message-id:to:to:cc:cc:mime-version:mime-version:
content-type:content-type:
content-transfer-encoding:content-transfer-encoding:
in-reply-to:in-reply-to:references:references:list-id:list-help:
list-unsubscribe:list-subscribe:list-post;
bh=6RZsm9Z0aI+d2x0ZJCGqfSlNbphX3h1kHVaRONg2a4E=;
b=LDcwNs78utEumsWNDE8GfCYiFmooiT+/N0qjpQP+TNgTyhX3Wi0/z6HW4mt0DZ/ZscO6sL
1/VaJctQ1iQA9qM7IJxxiCBOijbHqshfi1IbG8mUWHLYXujxXlFY6uN0fd4j/YAbRuiR41
uRsFLctTn/4mHMS+l5HPxjY2qILmcrY=
Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com
[66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS
(version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
us-mta-131-nByRmZw3Oj65tABUMLfC4Q-1; Wed, 03 Aug 2022 05:48:15 -0400
X-MC-Unique: nByRmZw3Oj65tABUMLfC4Q-1
Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com
[10.11.54.7])
(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
(No client certificate requested)
by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1DB5B38217F1;
Wed, 3 Aug 2022 09:48:13 +0000 (UTC)
Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com
(unknown [10.30.29.100])
by smtp.corp.redhat.com (Postfix) with ESMTP id 19A411410F3C;
Wed, 3 Aug 2022 09:48:10 +0000 (UTC)
Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com
(localhost [IPv6:::1])
by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with
ESMTP id 0AEAD1946A4E;
Wed, 3 Aug 2022 09:48:10 +0000 (UTC)
Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com
[10.11.54.10])
by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with
ESMTP id 1277D1946A4E
for ; Wed, 3 Aug 2022 09:48:09 +0000 (UTC)
Received: by smtp.corp.redhat.com (Postfix)
id F3E19401E23; Wed, 3 Aug 2022 09:48:08 +0000 (UTC)
Received: from mimecast-mx02.redhat.com
(mimecast05.extmail.prod.ext.rdu2.redhat.com [10.11.55.21])
by smtp.corp.redhat.com (Postfix) with ESMTPS id EF455492C3B
for ; Wed, 3 Aug 2022 09:48:08 +0000 (UTC)
Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com
[205.139.110.61])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D6DAC8032F6
for ; Wed, 3 Aug 2022 09:48:08 +0000 (UTC)
Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com
[210.118.77.11]) by relay.mimecast.com with ESMTP with STARTTLS
(version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
us-mta-482-4efk681qOY2J75He3SMzlw-1; Wed, 03 Aug 2022 05:48:07 -0400
X-MC-Unique: 4efk681qOY2J75He3SMzlw-1
Received: from eucas1p1.samsung.com (unknown [182.198.249.206])
by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id
20220803094806euoutp011c7cf63abd02ec84b3b202b9acf8e20d~HzLnN4sFo3021530215euoutp01S
for ; Wed, 3 Aug 2022 09:48:06 +0000 (GMT)
DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com
20220803094806euoutp011c7cf63abd02ec84b3b202b9acf8e20d~HzLnN4sFo3021530215euoutp01S
Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by
eucas1p2.samsung.com (KnoxPortal) with ESMTP id
20220803094804eucas1p23f4f95acc37debaf32ebca7b7461228e~HzLlsvk8B2078320783eucas1p2-;
Wed, 3 Aug 2022 09:48:04 +0000 (GMT)
Received: from eucas1p2.samsung.com ( [182.198.249.207]) by
eusmges3new.samsung.com (EUCPMTA) with SMTP id 47.F2.09580.4544AE26; Wed, 3
Aug 2022 10:48:04 +0100 (BST)
Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by
eucas1p2.samsung.com (KnoxPortal) with ESMTPA id
20220803094803eucas1p2ee8d16f3b6e08203ac9b4e0df6f53d9d~HzLlKJBYJ2274622746eucas1p2y;
Wed, 3 Aug 2022 09:48:03 +0000 (GMT)
Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by
eusmtrp2.samsung.com (KnoxPortal) with ESMTP id
20220803094803eusmtrp29abd99fd25b82a7151d193ea5f023056~HzLlJU8T40985609856eusmtrp2q;
Wed, 3 Aug 2022 09:48:03 +0000 (GMT)
X-AuditID: cbfec7f5-9c3ff7000000256c-08-62ea44546ac3
Received: from eusmtip2.samsung.com ( [203.254.199.222]) by
eusmgms1.samsung.com (EUCPMTA) with SMTP id 9A.DB.09095.3544AE26; Wed, 3
Aug 2022 10:48:03 +0100 (BST)
Received: from localhost (unknown [106.210.248.112]) by eusmtip2.samsung.com
(KnoxPortal) with ESMTPA id
20220803094803eusmtip28563b2ce9e5f1b5ca2b66ba8b64b2160~HzLkybMHr1682216822eusmtip2o;
Wed, 3 Aug 2022 09:48:03 +0000 (GMT)
From: Pankaj Raghav
To: Johannes.Thumshirn@wdc.com, snitzer@kernel.org, axboe@kernel.dk,
damien.lemoal@opensource.wdc.com, agk@redhat.com, hch@lst.de
Date: Wed, 3 Aug 2022 11:47:49 +0200
Message-Id: <20220803094801.177490-2-p.raghav@samsung.com>
In-Reply-To: <20220803094801.177490-1-p.raghav@samsung.com>
MIME-Version: 1.0
X-Brightmail-Tracker:
H4sIAAAAAAAAA+NgFnrJKsWRmVeSWpSXmKPExsWy7djP87ohLq+SDC4sFrWYfljRYv2pY8wW
q+/2s1lM+/CT2eL32fPMFnvfzWa1uHlgJ5PFnkWTmCxWrj7KZPFk/Sxmi79d95gs9t7Stri8
aw6bxfxlT9ktJrR9Zba4MeEpo8XnpS3sFmtuPmWxOHFL2kHY4/IVb4+ds+6ye1w+W+qxaVUn
m8fmJfUeu282sHnsbL3P6vF+31U2j74tqxg9Np+u9vi8Sc6j/UA3UwBPFJdNSmpOZllqkb5d
AlfG36ntTAVXRSqeTXjF1sA4S7CLkZNDQsBE4vb5NcxdjFwcQgIrGCW2H3jFBuF8YZS4tLKP
CcL5zChx7cMe1i5GDrCW7mO6EPHljBL7b/+Dan/JKPFt2kI2kCI2AS2Jxk52kLiIQDOjxN2/
PawgDrPAGyaJZct/s4MsFxZIlNjV/ZwNxGYRUJVouPGCCcTmFbCSmHn4OwvEgfISMy99B6vn
FLCWmPIPZBtIjaDEyZlPwGqYgWqat84Gu0JC4DCnxIYbS1ghml0kLm89ywRhC0u8Or6FHcKW
kfi/cz5UvFri6Y3fUM0tjBL9O9ezQfxpLdF3JgfEZBbQlFi/Sx+i3FHiRtt7dogKPokbbwUh
TuCTmLRtOjNEmFeio00IolpJYufPJ1BLJSQuN82B+spDYsLRzewTGBVn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0+3soLYLAKqEg03XoAt
4BWwkph5+DsLxAJ5iZmXvrOD2JwC1hJT/v1jhlhmJbHu7yxWiHpBiZMzn4DVMwPVN2+dzTyB
UWAWktQsJKkFjEyrGEVSS4tz03OLDfWKE3OLS/PS9ZLzczcxAmN427Gfm3cwznv1Ue8QIxMH
4yFGCQ5mJRHeOy7Pk4R4UxIrq1KL8uOLSnNSiw8xmgLdPZFZSjQ5H5hE8kriDc0MTA1NzCwN
TC3NjJXEeT0LOhKFBNITS1KzU1MLUotg+pg4OKUamPxrN894KbnldNZ3Ltf+tq3Wf4If6rB+
2flbIsxEsPpoUI/KNOMV0q171MMDT3iLbn3Ivia8wHvrqlV+M1xWLjtku/z0+VPBC5W4fPwm
1STvd1j+su5mReUF73X7l66tst3rm7dI/+1z1Q6W2T6bfm1ruc1skbV2S/PsRVsczr29ovpY
f4d+udXLTzs2fa/a2SJodV5HJmNjXLl6hOFiM+kKh0U5j18wb39rXNUSfnmywPaiCU+vc0+8
vfG8p9RM4cK5s5edEMg5sGbf2UO6O5R9lV5Y/NK9ucLen7cw4pIkM+/UQ+V7b/pl/JDfrxex
JY59yR41JT6WM49iDwfrSvfo/ZKfnL3yeNM5ybX8E1KUWIozEg21mIuKEwGNwBmyagMAAA==
X-CMS-MailID: 20220803094803eucas1p2ee8d16f3b6e08203ac9b4e0df6f53d9d
X-Msg-Generator: CA
X-RootMTR: 20220803094803eucas1p2ee8d16f3b6e08203ac9b4e0df6f53d9d
X-EPHeader: CA
CMS-TYPE: 201P
X-CMS-RootMailID: 20220803094803eucas1p2ee8d16f3b6e08203ac9b4e0df6f53d9d
References: <20220803094801.177490-1-p.raghav@samsung.com>
X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection
Definition; Similar Internal Domain=false;
Similar Monitored External Domain=false; Custom External Domain=false;
Mimecast External Domain=false; Newly Observed Domain=false;
Internal User Name=false; Custom Display Name List=false;
Reply-to Address Mismatch=false; Targeted Threat Dictionary=false;
Mimecast Threat Dictionary=false; Custom Threat Dictionary=false
X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10
Subject: [dm-devel] [PATCH v9 01/13] block: make bdev_nr_zones and
disk_zone_no generic for npo2 zone size
X-BeenThere: dm-devel@redhat.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: device-mapper development
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Cc: Pankaj Raghav , bvanassche@acm.org,
pankydev8@gmail.com, gost.dev@samsung.com, linux-kernel@vger.kernel.org,
linux-nvme@lists.infradead.org, linux-block@vger.kernel.org,
dm-devel@redhat.com, Adam Manzanares ,
jaegeuk@kernel.org, matias.bjorling@wdc.com,
Luis Chamberlain
Errors-To: dm-devel-bounces@redhat.com
Sender: "dm-devel"
X-Scanned-By: MIMEDefang 2.85 on 10.11.54.7
X-Mimecast-Spam-Score: 0
X-Mimecast-Originator: redhat.com
Adapt bdev_nr_zones and disk_zone_no functions so that they can
also work for non-power-of-2 zone sizes.
As the existing deployments assume that a device zone size is a power of
2 number of sectors, power-of-2 optimized calculation is used for those
devices.
There are no direct hot paths modified and the changes just
introduce one new branch per call.
Reviewed-by: Luis Chamberlain
Reviewed-by: Adam Manzanares
Reviewed-by: Hannes Reinecke
Signed-off-by: Pankaj Raghav
Reviewed-by: Bart Van Assche
---
block/blk-zoned.c | 13 +++++++++----
include/linux/blkdev.h | 8 +++++++-
2 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/block/blk-zoned.c b/block/blk-zoned.c
index a264621d4905..dce9c95b4bcd 100644
--- a/block/blk-zoned.c
+++ b/block/blk-zoned.c
@@ -111,17 +111,22 @@ EXPORT_SYMBOL_GPL(__blk_req_zone_write_unlock);
* bdev_nr_zones - Get number of zones
* @bdev: Target device
*
- * Return the total number of zones of a zoned block device. For a block
- * device without zone capabilities, the number of zones is always 0.
+ * Return the total number of zones of a zoned block device, including the
+ * eventual small last zone if present. For a block device without zone
+ * capabilities, the number of zones is always 0.
*/
unsigned int bdev_nr_zones(struct block_device *bdev)
{
sector_t zone_sectors = bdev_zone_sectors(bdev);
+ sector_t capacity = bdev_nr_sectors(bdev);
if (!bdev_is_zoned(bdev))
return 0;
- return (bdev_nr_sectors(bdev) + zone_sectors - 1) >>
- ilog2(zone_sectors);
+
+ if (is_power_of_2(zone_sectors))
+ return (capacity + zone_sectors - 1) >> ilog2(zone_sectors);
+
+ return DIV_ROUND_UP_SECTOR_T(capacity, zone_sectors);
}
EXPORT_SYMBOL_GPL(bdev_nr_zones);
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 84b13fdd34a7..ab82d1ff0cce 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -674,9 +674,15 @@ static inline unsigned int disk_nr_zones(struct gendisk *disk)
static inline unsigned int disk_zone_no(struct gendisk *disk, sector_t sector)
{
+ sector_t zone_sectors = disk->queue->limits.chunk_sectors;
+
if (!blk_queue_is_zoned(disk->queue))
return 0;
- return sector >> ilog2(disk->queue->limits.chunk_sectors);
+
+ if (is_power_of_2(zone_sectors))
+ return sector >> ilog2(zone_sectors);
+
+ return div64_u64(sector, zone_sectors);
}
static inline bool disk_zone_is_seq(struct gendisk *disk, sector_t sector)
From patchwork Wed Aug 3 09:47:50 2022
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Pankaj Raghav
X-Patchwork-Id: 12935317
X-Patchwork-Delegate: snitzer@redhat.com
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 us-smtp-delivery-124.mimecast.com
(us-smtp-delivery-124.mimecast.com [170.10.133.124])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by smtp.lore.kernel.org (Postfix) with ESMTPS id 9B7BCC19F28
for ; Wed, 3 Aug 2022 09:48:18 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
s=mimecast20190719; t=1659520097;
h=from:from:sender:sender:reply-to:subject:subject:date:date:
message-id:message-id:to:to:cc:cc:mime-version:mime-version:
content-type:content-type:
content-transfer-encoding:content-transfer-encoding:
in-reply-to:in-reply-to:references:references:list-id:list-help:
list-unsubscribe:list-subscribe:list-post;
bh=tOYrkVcNTwBdNlHWghogxzn0jZrNdoF2DeGKd0a6sBg=;
b=Hn2x7VMf76OxLMrmt5Ykjt1g3XQPWYtfBhqsderBhLCnlmh93p5uluMIpMFbLx2i9iVeQh
tL+OK9eovV+8HjyD68foCnDfbxRUz91rVKbLAbh3iFNr6cM87ZvKazMcxuAVFEJyqvbMim
GuyulF5DWtkUuheAySJmArc84TUhA/k=
Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com
[66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS
(version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
us-mta-344-ZOr3QY5iPY62_owNungf7w-1; Wed, 03 Aug 2022 05:48:14 -0400
X-MC-Unique: ZOr3QY5iPY62_owNungf7w-1
Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com
[10.11.54.7])
(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
(No client certificate requested)
by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1CD1E38217EF;
Wed, 3 Aug 2022 09:48:13 +0000 (UTC)
Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com
(unknown [10.30.29.100])
by smtp.corp.redhat.com (Postfix) with ESMTP id C6601141510F;
Wed, 3 Aug 2022 09:48:12 +0000 (UTC)
Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com
(localhost [IPv6:::1])
by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with
ESMTP id 8025E1946A52;
Wed, 3 Aug 2022 09:48:12 +0000 (UTC)
Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com
[10.11.54.4])
by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with
ESMTP id F1B861946A52
for ; Wed, 3 Aug 2022 09:48:09 +0000 (UTC)
Received: by smtp.corp.redhat.com (Postfix)
id D2B012026D64; Wed, 3 Aug 2022 09:48:09 +0000 (UTC)
Received: from mimecast-mx02.redhat.com
(mimecast02.extmail.prod.ext.rdu2.redhat.com [10.11.55.18])
by smtp.corp.redhat.com (Postfix) with ESMTPS id CEB8D2026D4C
for ; Wed, 3 Aug 2022 09:48:09 +0000 (UTC)
Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com
[205.139.110.61])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B933F801755
for ; Wed, 3 Aug 2022 09:48:09 +0000 (UTC)
Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com
[210.118.77.11]) by relay.mimecast.com with ESMTP with STARTTLS
(version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
us-mta-426-pTVYY7i3Npa8QeVfxL2o7Q-1; Wed, 03 Aug 2022 05:48:08 -0400
X-MC-Unique: pTVYY7i3Npa8QeVfxL2o7Q-1
Received: from eucas1p1.samsung.com (unknown [182.198.249.206])
by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id
20220803094807euoutp013b87cf2ba22dbee478d815d819fc9a3f~HzLoGdkH83128231282euoutp01_
for ; Wed, 3 Aug 2022 09:48:07 +0000 (GMT)
DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com
20220803094807euoutp013b87cf2ba22dbee478d815d819fc9a3f~HzLoGdkH83128231282euoutp01_
Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by
eucas1p2.samsung.com (KnoxPortal) with ESMTP id
20220803094805eucas1p2fb2e6683b85d89ad1c79c6978055ad18~HzLmlH4_X1615116151eucas1p2u;
Wed, 3 Aug 2022 09:48:05 +0000 (GMT)
Received: from eucas1p1.samsung.com ( [182.198.249.206]) by
eusmges1new.samsung.com (EUCPMTA) with SMTP id A0.FF.09664.5544AE26; Wed, 3
Aug 2022 10:48:05 +0100 (BST)
Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by
eucas1p1.samsung.com (KnoxPortal) with ESMTPA id
20220803094804eucas1p1feea4b1bdae819f4c8750994ddd94803~HzLmH9IqN1902519025eucas1p1H;
Wed, 3 Aug 2022 09:48:04 +0000 (GMT)
Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by
eusmtrp2.samsung.com (KnoxPortal) with ESMTP id
20220803094804eusmtrp28c08a2adda8796fdf9c233c636159095~HzLmHClmQ0972009720eusmtrp2Y;
Wed, 3 Aug 2022 09:48:04 +0000 (GMT)
X-AuditID: cbfec7f2-d97ff700000025c0-79-62ea44553828
Received: from eusmtip2.samsung.com ( [203.254.199.222]) by
eusmgms2.samsung.com (EUCPMTA) with SMTP id 40.9B.09038.4544AE26; Wed, 3
Aug 2022 10:48:04 +0100 (BST)
Received: from localhost (unknown [106.210.248.112]) by eusmtip2.samsung.com
(KnoxPortal) with ESMTPA id
20220803094804eusmtip23b70977da7da3b653211630caa4bac3a~HzLlvVUMC1623516235eusmtip2k;
Wed, 3 Aug 2022 09:48:04 +0000 (GMT)
From: Pankaj Raghav
To: Johannes.Thumshirn@wdc.com, snitzer@kernel.org, axboe@kernel.dk,
damien.lemoal@opensource.wdc.com, agk@redhat.com, hch@lst.de
Date: Wed, 3 Aug 2022 11:47:50 +0200
Message-Id: <20220803094801.177490-3-p.raghav@samsung.com>
In-Reply-To: <20220803094801.177490-1-p.raghav@samsung.com>
MIME-Version: 1.0
X-Brightmail-Tracker:
H4sIAAAAAAAAA+NgFrrPKsWRmVeSWpSXmKPExsWy7djPc7qhLq+SDBr2iVqsP3WM2WL13X42
i2kffjJb/D57ntli77vZrBY3D+xkst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Tb1lWen36Rdm7nmz9UqcNmkwLip88kPvcsR84siHvH2/WZjemm/bomEVmCFYGKv
lXfTXdFa9ZKLSgb/VCYaT2/d5avEUpyRaKjFXFScCAAG7hpFYwMAAA==
X-CMS-MailID: 20220803094804eucas1p1feea4b1bdae819f4c8750994ddd94803
X-Msg-Generator: CA
X-RootMTR: 20220803094804eucas1p1feea4b1bdae819f4c8750994ddd94803
X-EPHeader: CA
CMS-TYPE: 201P
X-CMS-RootMailID: 20220803094804eucas1p1feea4b1bdae819f4c8750994ddd94803
References: <20220803094801.177490-1-p.raghav@samsung.com>
X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection
Definition; Similar Internal Domain=false;
Similar Monitored External Domain=false; Custom External Domain=false;
Mimecast External Domain=false; Newly Observed Domain=false;
Internal User Name=false; Custom Display Name List=false;
Reply-to Address Mismatch=false; Targeted Threat Dictionary=false;
Mimecast Threat Dictionary=false; Custom Threat Dictionary=false
X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4
Subject: [dm-devel] [PATCH v9 02/13] block:rearrange bdev_{is_zoned,
zone_sectors, get_queue} helpers in blkdev.h
X-BeenThere: dm-devel@redhat.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: device-mapper development
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Cc: Pankaj Raghav , bvanassche@acm.org,
pankydev8@gmail.com, gost.dev@samsung.com, linux-kernel@vger.kernel.org,
linux-nvme@lists.infradead.org, linux-block@vger.kernel.org,
dm-devel@redhat.com, jaegeuk@kernel.org, matias.bjorling@wdc.com
Errors-To: dm-devel-bounces@redhat.com
Sender: "dm-devel"
X-Scanned-By: MIMEDefang 2.85 on 10.11.54.7
X-Mimecast-Spam-Score: 0
X-Mimecast-Originator: redhat.com
Define bdev_is_zoned(), bdev_zone_sectors() and bdev_get_queue() earlier
in the blkdev.h include file.
This commit has no functional change, and it is a prep patch for allowing
zoned devices with non-power-of-2 zone sizes in the block layer.
Signed-off-by: Pankaj Raghav
Suggested-by: Bart Van Assche
Reviewed-by: Bart Van Assche
---
include/linux/blkdev.h | 48 +++++++++++++++++++++---------------------
1 file changed, 24 insertions(+), 24 deletions(-)
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index ab82d1ff0cce..22f97427b60b 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -635,6 +635,11 @@ static inline bool queue_is_mq(struct request_queue *q)
return q->mq_ops;
}
+static inline struct request_queue *bdev_get_queue(struct block_device *bdev)
+{
+ return bdev->bd_queue; /* this is never NULL */
+}
+
#ifdef CONFIG_PM
static inline enum rpm_status queue_rpm_status(struct request_queue *q)
{
@@ -666,6 +671,25 @@ static inline bool blk_queue_is_zoned(struct request_queue *q)
}
}
+static inline bool bdev_is_zoned(struct block_device *bdev)
+{
+ struct request_queue *q = bdev_get_queue(bdev);
+
+ if (q)
+ return blk_queue_is_zoned(q);
+
+ return false;
+}
+
+static inline sector_t bdev_zone_sectors(struct block_device *bdev)
+{
+ struct request_queue *q = bdev_get_queue(bdev);
+
+ if (!blk_queue_is_zoned(q))
+ return 0;
+ return q->limits.chunk_sectors;
+}
+
#ifdef CONFIG_BLK_DEV_ZONED
static inline unsigned int disk_nr_zones(struct gendisk *disk)
{
@@ -892,11 +916,6 @@ int bio_poll(struct bio *bio, struct io_comp_batch *iob, unsigned int flags);
int iocb_bio_iopoll(struct kiocb *kiocb, struct io_comp_batch *iob,
unsigned int flags);
-static inline struct request_queue *bdev_get_queue(struct block_device *bdev)
-{
- return bdev->bd_queue; /* this is never NULL */
-}
-
/* Helper to convert BLK_ZONE_ZONE_XXX to its string format XXX */
const char *blk_zone_cond_str(enum blk_zone_cond zone_cond);
@@ -1296,25 +1315,6 @@ static inline enum blk_zoned_model bdev_zoned_model(struct block_device *bdev)
return BLK_ZONED_NONE;
}
-static inline bool bdev_is_zoned(struct block_device *bdev)
-{
- struct request_queue *q = bdev_get_queue(bdev);
-
- if (q)
- return blk_queue_is_zoned(q);
-
- return false;
-}
-
-static inline sector_t bdev_zone_sectors(struct block_device *bdev)
-{
- struct request_queue *q = bdev_get_queue(bdev);
-
- if (!blk_queue_is_zoned(q))
- return 0;
- return q->limits.chunk_sectors;
-}
-
static inline int queue_dma_alignment(const struct request_queue *q)
{
return q ? q->dma_alignment : 511;
From patchwork Wed Aug 3 09:47:51 2022
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Pankaj Raghav
X-Patchwork-Id: 12935316
X-Patchwork-Delegate: snitzer@redhat.com
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 us-smtp-delivery-124.mimecast.com
(us-smtp-delivery-124.mimecast.com [170.10.133.124])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by smtp.lore.kernel.org (Postfix) with ESMTPS id 9B7FCC25B07
for ; Wed, 3 Aug 2022 09:48:18 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
s=mimecast20190719; t=1659520097;
h=from:from:sender:sender:reply-to:subject:subject:date:date:
message-id:message-id:to:to:cc:cc:mime-version:mime-version:
content-type:content-type:
content-transfer-encoding:content-transfer-encoding:
in-reply-to:in-reply-to:references:references:list-id:list-help:
list-unsubscribe:list-subscribe:list-post;
bh=6NlSrfVWjMn+L1jniD80iNTDZEvnLnuOkbSgbpAogEU=;
b=Yo3JXcoq1X3cSol/Xii/E3waIEAcNAi1GVSTYuJ+xElcSjHhEfNaYsFfnh6SVUvoLR/zZb
9FgDj8B/ZnTRgVwHMTU0k1x5EdwKllYtoh9h+OaZOOkegCIXG4FoFHwrI+SVKMBw9NWIFo
zDKCTqeo74za7e4c5QLH2YejG8N1ef0=
Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com
[66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS
(version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
us-mta-626-D8XwpdK9Ne62pMTfKXCq1A-1; Wed, 03 Aug 2022 05:48:14 -0400
X-MC-Unique: D8XwpdK9Ne62pMTfKXCq1A-1
Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com
[10.11.54.8])
(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
(No client certificate requested)
by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1E78A85A58D;
Wed, 3 Aug 2022 09:48:13 +0000 (UTC)
Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com
(unknown [10.30.29.100])
by smtp.corp.redhat.com (Postfix) with ESMTP id C725DC15D62;
Wed, 3 Aug 2022 09:48:12 +0000 (UTC)
Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com
(localhost [IPv6:::1])
by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with
ESMTP id 94C821946A60;
Wed, 3 Aug 2022 09:48:12 +0000 (UTC)
Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com
[10.11.54.1])
by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with
ESMTP id 124E41946A56
for ; Wed, 3 Aug 2022 09:48:11 +0000 (UTC)
Received: by smtp.corp.redhat.com (Postfix)
id 07E0940CFD0A; Wed, 3 Aug 2022 09:48:11 +0000 (UTC)
Received: from mimecast-mx02.redhat.com
(mimecast09.extmail.prod.ext.rdu2.redhat.com [10.11.55.25])
by smtp.corp.redhat.com (Postfix) with ESMTPS id 029D440CF8F0
for ; Wed, 3 Aug 2022 09:48:10 +0000 (UTC)
Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com
[205.139.110.120])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by mimecast-mx02.redhat.com (Postfix) with ESMTPS id DC2C2280F2B6
for ; Wed, 3 Aug 2022 09:48:10 +0000 (UTC)
Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com
[210.118.77.11]) by relay.mimecast.com with ESMTP with STARTTLS
(version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
us-mta-632-ngWSX8KsPsKKAnin3pO4-g-1; Wed, 03 Aug 2022 05:48:09 -0400
X-MC-Unique: ngWSX8KsPsKKAnin3pO4-g-1
Received: from eucas1p2.samsung.com (unknown [182.198.249.207])
by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id
20220803094808euoutp01e5b9313977df2198552e52de8608f7dc~HzLpHqD5n3207932079euoutp01g
for ; Wed, 3 Aug 2022 09:48:08 +0000 (GMT)
DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com
20220803094808euoutp01e5b9313977df2198552e52de8608f7dc~HzLpHqD5n3207932079euoutp01g
Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by
eucas1p2.samsung.com (KnoxPortal) with ESMTP id
20220803094806eucas1p28e4acaa00f0bcede2828c6f7798de3ea~HzLnfy-8w3120331203eucas1p2s;
Wed, 3 Aug 2022 09:48:06 +0000 (GMT)
Received: from eucas1p1.samsung.com ( [182.198.249.206]) by
eusmges1new.samsung.com (EUCPMTA) with SMTP id 42.FF.09664.6544AE26; Wed, 3
Aug 2022 10:48:06 +0100 (BST)
Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by
eucas1p1.samsung.com (KnoxPortal) with ESMTPA id
20220803094805eucas1p1c68ba40d319331c2c34059f966ba2d83~HzLnD0WR_0754607546eucas1p16;
Wed, 3 Aug 2022 09:48:05 +0000 (GMT)
Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by
eusmtrp2.samsung.com (KnoxPortal) with ESMTP id
20220803094805eusmtrp25e56a76f66728139fcf1a55fd7baa169~HzLnC2gES0985609856eusmtrp2u;
Wed, 3 Aug 2022 09:48:05 +0000 (GMT)
X-AuditID: cbfec7f2-d97ff700000025c0-7f-62ea44563ea2
Received: from eusmtip1.samsung.com ( [203.254.199.221]) by
eusmgms2.samsung.com (EUCPMTA) with SMTP id A1.9B.09038.5544AE26; Wed, 3
Aug 2022 10:48:05 +0100 (BST)
Received: from localhost (unknown [106.210.248.112]) by eusmtip1.samsung.com
(KnoxPortal) with ESMTPA id
20220803094805eusmtip19192ed3b0cdfd5c11a6f449fcf12697b~HzLmtXW9L2551225512eusmtip1e;
Wed, 3 Aug 2022 09:48:05 +0000 (GMT)
From: Pankaj Raghav
To: Johannes.Thumshirn@wdc.com, snitzer@kernel.org, axboe@kernel.dk,
damien.lemoal@opensource.wdc.com, agk@redhat.com, hch@lst.de
Date: Wed, 3 Aug 2022 11:47:51 +0200
Message-Id: <20220803094801.177490-4-p.raghav@samsung.com>
In-Reply-To: <20220803094801.177490-1-p.raghav@samsung.com>
MIME-Version: 1.0
X-Brightmail-Tracker:
H4sIAAAAAAAAA+NgFnrCKsWRmVeSWpSXmKPExsWy7djPc7phLq+SDE7MErVYf+oYs8Xqu/1s
FtM+/GS2+H32PLPF3nezWS1uHtjJZLFn0SQmi5WrjzJZPFk/i9nib9c9Jou9t7QtLu+aw2Yx
f9lTdosJbV+ZLW5MeMpo8XlpC7vFmptPWSxO3JJ2EPK4fMXbY+esu+wel8+Wemxa1cnmsXlJ
vcfumw1sHjtb77N6vN93lc2jb8sqRo/Np6s9Pm+S82g/0M0UwBPFZZOSmpNZllqkb5fAldG/
7yt7wS71ioOnPjI2MPYqdDFyckgImEg09v9l72Lk4hASWMEoMXniOSjnC6PEv+5mJgjnM6PE
zNuzGWFaVnSvYwWxhQSWM0qs+1QOUfSSUeLP0QssXYwcHGwCWhKNnWCTRASaGSXu/u1hBXGY
BQ4wSdzccosJpFtYIFri96LnYJNYBFQlZn37BdbMK2Al8fBIFsQyeYmZl76zg9icAtYSU/79
YwaxeQUEJU7OfMICYjMD1TRvnc0MMl9CYDenxN99v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5egl9G/7yt7wS71ioOnPjI2MPYqdDFy
ckgImEis6F7HCmILCSxllGg+XwgRl5C4vbCJEcIWlvhzrYuti5ELqOY5o0R/80WgBg4ONgEt
icZOdpC4iEA3o8TlM+dYQRxmgXNMEnOePmAD6RYWiJSYfLyJGcRmEVCVmPXtFwtIM6+AlcTD
I1kQC+QlZl76zg5icwpYS0z5948Z4iAriXV/Z4EdxysgKHFy5hMWEJsZqL5562zmCYwCs5Ck
ZiFJLWBkWsUoklpanJueW2ykV5yYW1yal66XnJ+7iREYu9uO/dyyg3Hlq496hxiZOBgPMUpw
MCuJ8N5xeZ4kxJuSWFmVWpQfX1Sak1p8iNEU6OyJzFKiyfnA5JFXEm9oZmBqaGJmaWBqaWas
JM7rWdCRKCSQnliSmp2aWpBaBNPHxMEp1cDkcG06p8ZbJ7nSSP0Z4S/XKAjzljiH8Xx2K7ZQ
Wq05a9LeO6dOrJJV3yMp770h8dPX7H8KfO0buCcyVdvnHLggqnQ++pPggsS1e6taec/eWbTn
8QyzzmIV15cJM8rMjoYd1bJozdFY+G1z4rdrgQxC07ZMvajx+9nh905tjRd15+pa6iumKqi8
mMR9+N78qUtUBE5IqPpnzOStmTx76T/39JU6gne/J2t6sX5MXm3+zvf5I11D5Y3f5zbZrZXd
uMhbZMqfSV8yqwoMeSZkHerXdtgsut3+n5f+4T82959ELAmavFLpF9dpvf+RHnvPTKt5xfuc
1fiBU9QjWav6Fx9Vmnm8/TvP1Aqfrf3IpmGpxFKckWioxVxUnAgAqxFEeGYDAAA=
X-CMS-MailID: 20220803094805eucas1p1c68ba40d319331c2c34059f966ba2d83
X-Msg-Generator: CA
X-RootMTR: 20220803094805eucas1p1c68ba40d319331c2c34059f966ba2d83
X-EPHeader: CA
CMS-TYPE: 201P
X-CMS-RootMailID: 20220803094805eucas1p1c68ba40d319331c2c34059f966ba2d83
References: <20220803094801.177490-1-p.raghav@samsung.com>
X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection
Definition; Similar Internal Domain=false;
Similar Monitored External Domain=false; Custom External Domain=false;
Mimecast External Domain=false; Newly Observed Domain=false;
Internal User Name=false; Custom Display Name List=false;
Reply-to Address Mismatch=false; Targeted Threat Dictionary=false;
Mimecast Threat Dictionary=false; Custom Threat Dictionary=false
X-Scanned-By: MIMEDefang 2.84 on 10.11.54.1
Subject: [dm-devel] [PATCH v9 03/13] block: allow blk-zoned devices to have
non-power-of-2 zone size
X-BeenThere: dm-devel@redhat.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: device-mapper development
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Cc: Pankaj Raghav , bvanassche@acm.org,
pankydev8@gmail.com, gost.dev@samsung.com, linux-kernel@vger.kernel.org,
linux-nvme@lists.infradead.org, linux-block@vger.kernel.org,
dm-devel@redhat.com, jaegeuk@kernel.org, matias.bjorling@wdc.com,
Luis Chamberlain
Errors-To: dm-devel-bounces@redhat.com
Sender: "dm-devel"
X-Scanned-By: MIMEDefang 2.85 on 10.11.54.8
X-Mimecast-Spam-Score: 0
X-Mimecast-Originator: redhat.com
Checking if a given sector is aligned to a zone is a common
operation that is performed for zoned devices. Add
bdev_is_zone_start helper to check for this instead of opencoding it
everywhere.
Convert the calculations on zone size to be generic instead of relying on
power-of-2(po2) based arithmetic in the block layer using the helpers
wherever possible.
The only hot path affected by this change for zoned devices with po2
zone size is in blk_check_zone_append() but bdev_is_zone_start() helper is
used to optimize the calculation for po2 zone sizes.
Finally, allow zoned devices with non po2 zone sizes provided that their
zone capacity and zone size are equal. The main motivation to allow zoned
devices with non po2 zone size is to remove the unmapped LBA between
zone capcity and zone size for devices that cannot have a po2 zone
capacity.
Reviewed-by: Luis Chamberlain
Reviewed-by: Hannes Reinecke
Signed-off-by: Pankaj Raghav
Reviewed-by: Bart Van Assche
---
block/blk-core.c | 2 +-
block/blk-zoned.c | 24 ++++++++++++++++++------
include/linux/blkdev.h | 30 ++++++++++++++++++++++++++++++
3 files changed, 49 insertions(+), 7 deletions(-)
diff --git a/block/blk-core.c b/block/blk-core.c
index a0d1104c5590..1cb519220ffb 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -563,7 +563,7 @@ static inline blk_status_t blk_check_zone_append(struct request_queue *q,
return BLK_STS_NOTSUPP;
/* The bio sector must point to the start of a sequential zone */
- if (bio->bi_iter.bi_sector & (bdev_zone_sectors(bio->bi_bdev) - 1) ||
+ if (!bdev_is_zone_start(bio->bi_bdev, bio->bi_iter.bi_sector) ||
!bio_zone_is_seq(bio))
return BLK_STS_IOERR;
diff --git a/block/blk-zoned.c b/block/blk-zoned.c
index dce9c95b4bcd..665b822d13f9 100644
--- a/block/blk-zoned.c
+++ b/block/blk-zoned.c
@@ -285,10 +285,10 @@ int blkdev_zone_mgmt(struct block_device *bdev, enum req_op op,
return -EINVAL;
/* Check alignment (handle eventual smaller last zone) */
- if (sector & (zone_sectors - 1))
+ if (!bdev_is_zone_start(bdev, sector))
return -EINVAL;
- if ((nr_sectors & (zone_sectors - 1)) && end_sector != capacity)
+ if (!bdev_is_zone_start(bdev, nr_sectors) && end_sector != capacity)
return -EINVAL;
/*
@@ -486,14 +486,26 @@ static int blk_revalidate_zone_cb(struct blk_zone *zone, unsigned int idx,
* smaller last zone.
*/
if (zone->start == 0) {
- if (zone->len == 0 || !is_power_of_2(zone->len)) {
- pr_warn("%s: Invalid zoned device with non power of two zone size (%llu)\n",
- disk->disk_name, zone->len);
+ if (zone->len == 0) {
+ pr_warn("%s: Invalid zero zone size", disk->disk_name);
+ return -ENODEV;
+ }
+
+ /*
+ * Non power-of-2 zone size support was added to remove the
+ * gap between zone capacity and zone size. Though it is technically
+ * possible to have gaps in a non power-of-2 device, Linux requires
+ * the zone size to be equal to zone capacity for non power-of-2
+ * zoned devices.
+ */
+ if (!is_power_of_2(zone->len) && zone->capacity < zone->len) {
+ pr_err("%s: Invalid zone capacity: %lld with non power-of-2 zone size: %lld",
+ disk->disk_name, zone->capacity, zone->len);
return -ENODEV;
}
args->zone_sectors = zone->len;
- args->nr_zones = (capacity + zone->len - 1) >> ilog2(zone->len);
+ args->nr_zones = div64_u64(capacity + zone->len - 1, zone->len);
} else if (zone->start + args->zone_sectors < capacity) {
if (zone->len != args->zone_sectors) {
pr_warn("%s: Invalid zoned device with non constant zone size\n",
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 22f97427b60b..5aa15172299d 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -709,6 +709,30 @@ static inline unsigned int disk_zone_no(struct gendisk *disk, sector_t sector)
return div64_u64(sector, zone_sectors);
}
+static inline sector_t bdev_offset_from_zone_start(struct block_device *bdev,
+ sector_t sec)
+{
+ sector_t zone_sectors = bdev_zone_sectors(bdev);
+ u64 remainder = 0;
+
+ if (!bdev_is_zoned(bdev))
+ return 0;
+
+ if (is_power_of_2(zone_sectors))
+ return sec & (zone_sectors - 1);
+
+ div64_u64_rem(sec, zone_sectors, &remainder);
+ return remainder;
+}
+
+static inline bool bdev_is_zone_start(struct block_device *bdev, sector_t sec)
+{
+ if (!bdev_is_zoned(bdev))
+ return false;
+
+ return bdev_offset_from_zone_start(bdev, sec) == 0;
+}
+
static inline bool disk_zone_is_seq(struct gendisk *disk, sector_t sector)
{
if (!blk_queue_is_zoned(disk->queue))
@@ -753,6 +777,12 @@ static inline unsigned int disk_zone_no(struct gendisk *disk, sector_t sector)
{
return 0;
}
+
+static inline bool bdev_is_zone_start(struct block_device *bdev, sector_t sec)
+{
+ return false;
+}
+
static inline unsigned int bdev_max_open_zones(struct block_device *bdev)
{
return 0;
From patchwork Wed Aug 3 09:47:52 2022
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Pankaj Raghav
X-Patchwork-Id: 12935319
X-Patchwork-Delegate: snitzer@redhat.com
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 us-smtp-delivery-124.mimecast.com
(us-smtp-delivery-124.mimecast.com [170.10.129.124])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by smtp.lore.kernel.org (Postfix) with ESMTPS id E80FEC19F2A
for ; Wed, 3 Aug 2022 09:48:20 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
s=mimecast20190719; t=1659520100;
h=from:from:sender:sender:reply-to:subject:subject:date:date:
message-id:message-id:to:to:cc:cc:mime-version:mime-version:
content-type:content-type:
content-transfer-encoding:content-transfer-encoding:
in-reply-to:in-reply-to:references:references:list-id:list-help:
list-unsubscribe:list-subscribe:list-post;
bh=3qAieJW0OvX3BUM0nPw8CY0v1N/qAe5zs+EVgcZ4McM=;
b=NzAizFALAGH7hcFoh7Bbg4AQSHjec3fnomDWQuYTMxaFFQU+YJ0DrgaCGtCRrAZEOO7eK6
XWV1G+7X5gGhnjrcYZ6gXQH0PTjCxHd3IrMSriQSOzsCnuscWqbUaPi+4J2yAeOtn/swau
434v0/LwLx3Gv4aFwunzYgRtYoCaUKo=
Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com
[66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS
(version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
us-mta-49-MjedjiPJM_2AH396FBr9SA-1; Wed, 03 Aug 2022 05:48:15 -0400
X-MC-Unique: MjedjiPJM_2AH396FBr9SA-1
Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com
[10.11.54.7])
(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
(No client certificate requested)
by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0BC9F3C0D852;
Wed, 3 Aug 2022 09:48:14 +0000 (UTC)
Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com
(unknown [10.30.29.100])
by smtp.corp.redhat.com (Postfix) with ESMTP id EF744141510F;
Wed, 3 Aug 2022 09:48:13 +0000 (UTC)
Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com
(localhost [IPv6:::1])
by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with
ESMTP id D3C0C1946A5D;
Wed, 3 Aug 2022 09:48:13 +0000 (UTC)
Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com
[10.11.54.2])
by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with
ESMTP id 5F5671946A50
for ; Wed, 3 Aug 2022 09:48:12 +0000 (UTC)
Received: by smtp.corp.redhat.com (Postfix)
id 53DE340C1288; Wed, 3 Aug 2022 09:48:12 +0000 (UTC)
Received: from mimecast-mx02.redhat.com
(mimecast06.extmail.prod.ext.rdu2.redhat.com [10.11.55.22])
by smtp.corp.redhat.com (Postfix) with ESMTPS id 5013B4010E37
for ; Wed, 3 Aug 2022 09:48:12 +0000 (UTC)
Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256
bits)) (No client certificate requested)
by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3736F185A794
for ; Wed, 3 Aug 2022 09:48:12 +0000 (UTC)
Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com
[210.118.77.12]) by relay.mimecast.com with ESMTP with STARTTLS
(version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
us-mta-515-XcexsLpvMXuZdph3oydNKQ-1; Wed, 03 Aug 2022 05:48:10 -0400
X-MC-Unique: XcexsLpvMXuZdph3oydNKQ-1
Received: from eucas1p2.samsung.com (unknown [182.198.249.207])
by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id
20220803094809euoutp02c30e1dff47ecae288585b7588bb447cb~HzLqGHtsn1892618926euoutp02h
for ; Wed, 3 Aug 2022 09:48:09 +0000 (GMT)
DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com
20220803094809euoutp02c30e1dff47ecae288585b7588bb447cb~HzLqGHtsn1892618926euoutp02h
Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by
eucas1p2.samsung.com (KnoxPortal) with ESMTP id
20220803094807eucas1p224884eb226c7b424aed2ee5802687c73~HzLonXeKL2470524705eucas1p2m;
Wed, 3 Aug 2022 09:48:07 +0000 (GMT)
Received: from eucas1p1.samsung.com ( [182.198.249.206]) by
eusmges1new.samsung.com (EUCPMTA) with SMTP id B3.FF.09664.7544AE26; Wed, 3
Aug 2022 10:48:07 +0100 (BST)
Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by
eucas1p2.samsung.com (KnoxPortal) with ESMTPA id
20220803094806eucas1p24e1fd0f3a595e050d79c4315559d97ae~HzLn-ja4E1528815288eucas1p2h;
Wed, 3 Aug 2022 09:48:06 +0000 (GMT)
Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by
eusmtrp1.samsung.com (KnoxPortal) with ESMTP id
20220803094806eusmtrp1f74e4c3e6a78656816aba9457baeed04~HzLn_o3YC2000320003eusmtrp1Q;
Wed, 3 Aug 2022 09:48:06 +0000 (GMT)
X-AuditID: cbfec7f2-d97ff700000025c0-81-62ea44573f19
Received: from eusmtip1.samsung.com ( [203.254.199.221]) by
eusmgms2.samsung.com (EUCPMTA) with SMTP id 53.9B.09038.6544AE26; Wed, 3
Aug 2022 10:48:06 +0100 (BST)
Received: from localhost (unknown [106.210.248.112]) by eusmtip1.samsung.com
(KnoxPortal) with ESMTPA id
20220803094806eusmtip10b1dba597f608a76d1a515ca1f44a551~HzLnqIBVq2267222672eusmtip1h;
Wed, 3 Aug 2022 09:48:06 +0000 (GMT)
From: Pankaj Raghav
To: Johannes.Thumshirn@wdc.com, snitzer@kernel.org, axboe@kernel.dk,
damien.lemoal@opensource.wdc.com, agk@redhat.com, hch@lst.de
Date: Wed, 3 Aug 2022 11:47:52 +0200
Message-Id: <20220803094801.177490-5-p.raghav@samsung.com>
In-Reply-To: <20220803094801.177490-1-p.raghav@samsung.com>
MIME-Version: 1.0
X-Brightmail-Tracker:
H4sIAAAAAAAAA+NgFnrMKsWRmVeSWpSXmKPExsWy7djPc7rhLq+SDLr3K1qsP3WM2WL13X42
i2kffjJb/D57ntli77vZrBY3D+xkstizaBKTxcrVR5ksnqyfxWzxt+sek8XeW9oWl3fNYbOY
v+wpu8WEtq/MFjcmPGW0+Ly0hd1izc2nLBYnbkk7CHlcvuLtsXPWXXaPy2dLPTat6mTz2Lyk
3mP3zQY2j52t91k93u+7yubRt2UVo8fm09UenzfJebQf6GYK4InisklJzcksSy3St0vgyvg7
+zxzwSn+iobHF5kbGJfwdjFyckgImEh8XbeOrYuRi0NIYAWjRNvPqcwQzhdGiQXrJ7GCVAkJ
fGaUmPE3AKZjzaKpUB3LGSUuz//EDlH0klHiaaN9FyMHB5uAlkRjJztIjYhAM6PE3b89rCAO
s8BHJolH2zcygRQJC0RIfDkhBNLLIqAqsXHrbSYQm1fASuLKpW9sEMvkJWZe+g42n1PAWmLK
v3/MEDWCEidnPmEBsZmBapq3zga7WkJgO6fE3b2/WSCaXSTmL7/GCGELS7w6voUdwpaROD25
B6qmWuLpjd9QzS2MEv0717OBHCcBtK3vTA6IySygKbF+lz5EuaPE9YPHWSAq+CRuvBWEOIFP
YtK26cwQYV6JjjYhiGoliZ0/n0AtlZC43DQHaqmHxONJ7UwTGBVnIXlmFpJnZiHsXcDIvIpR
PLW0ODc9tdgwL7Vcrzgxt7g0L10vOT93EyMwHZ7+d/zTDsa5rz7qHWJk4mA8xCjBwawkwnvH
5XmSEG9KYmVValF+fFFpTmrxIUZpDhYlcd7kzA2JQgLpiSWp2ampBalFMFkmDk6pBqZpkjYM
wUe6FRQNVgln/fraVflylbxolYW4RGfeJP7Ne+PnTwkRWdT85N+v9fXhsorO2XO/hnZW5F34
drrq0d93Ae9fVMe79vD/zA1XOVhd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nbd3PGp8V59zFMscixCfrynydv+oHqqtfyS4/pPrrct2uOSM8Gh2f+vX8ui802nPl+XXt0
nxuT54/eW+xvGZ8l7Thm6lD2Sf4oW+Tn1en528QtKixj+tbn/OmZLRU3a+OBayE8i3ddinsr
envCyZrKF0LeDfarU3hbps472vJJX563vX9CiN+vdeHKDu+uGGi/ntapZVjiYNdVnt920PPb
BoGoXF3bRlbRX0mPBC3fH1y6xFvomPEEP+4NYnfXHzYrtjXoPvIh91/dFK8fYpVsjsWbfj48
f/DIzUVq6w07ihXK7dbVPtghfXS7IZMSS3FGoqEWc1FxIgAwwu7wZwMAAA==
X-CMS-MailID: 20220803094806eucas1p24e1fd0f3a595e050d79c4315559d97ae
X-Msg-Generator: CA
X-RootMTR: 20220803094806eucas1p24e1fd0f3a595e050d79c4315559d97ae
X-EPHeader: CA
CMS-TYPE: 201P
X-CMS-RootMailID: 20220803094806eucas1p24e1fd0f3a595e050d79c4315559d97ae
References: <20220803094801.177490-1-p.raghav@samsung.com>
X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection
Definition; Similar Internal Domain=false;
Similar Monitored External Domain=false; Custom External Domain=false;
Mimecast External Domain=false; Newly Observed Domain=false;
Internal User Name=false; Custom Display Name List=false;
Reply-to Address Mismatch=false; Targeted Threat Dictionary=false;
Mimecast Threat Dictionary=false; Custom Threat Dictionary=false
X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2
Subject: [dm-devel] [PATCH v9 04/13] nvmet: Allow ZNS target to support
non-power_of_2 zone sizes
X-BeenThere: dm-devel@redhat.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: device-mapper development
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Cc: Pankaj Raghav , bvanassche@acm.org,
pankydev8@gmail.com, gost.dev@samsung.com, linux-kernel@vger.kernel.org,
linux-nvme@lists.infradead.org, linux-block@vger.kernel.org,
dm-devel@redhat.com, Johannes Thumshirn ,
jaegeuk@kernel.org, matias.bjorling@wdc.com,
Luis Chamberlain
Errors-To: dm-devel-bounces@redhat.com
Sender: "dm-devel"
X-Scanned-By: MIMEDefang 2.85 on 10.11.54.7
X-Mimecast-Spam-Score: 0
X-Mimecast-Originator: redhat.com
A generic bdev_zone_no() helper is added to calculate zone number for a
given sector in a block device. This helper internally uses disk_zone_no()
to find the zone number.
Use the helper bdev_zone_no() to calculate nr of zones. This let's us
make modifications to the math if needed in one place and adds now
support for zoned devices with non po2 zone size.
Reviewed by: Adam Manzanares
Reviewed-by: Bart Van Assche
Reviewed-by: Hannes Reinecke
Reviewed-by: Johannes Thumshirn
Signed-off-by: Luis Chamberlain
Signed-off-by: Pankaj Raghav
---
drivers/nvme/target/zns.c | 3 +--
include/linux/blkdev.h | 5 +++++
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/nvme/target/zns.c b/drivers/nvme/target/zns.c
index c7ef69f29fe4..662f1a92f39b 100644
--- a/drivers/nvme/target/zns.c
+++ b/drivers/nvme/target/zns.c
@@ -241,8 +241,7 @@ static unsigned long nvmet_req_nr_zones_from_slba(struct nvmet_req *req)
{
unsigned int sect = nvmet_lba_to_sect(req->ns, req->cmd->zmr.slba);
- return bdev_nr_zones(req->ns->bdev) -
- (sect >> ilog2(bdev_zone_sectors(req->ns->bdev)));
+ return bdev_nr_zones(req->ns->bdev) - bdev_zone_no(req->ns->bdev, sect);
}
static unsigned long get_nr_zones_from_buf(struct nvmet_req *req, u32 bufsize)
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 5aa15172299d..ead848a15946 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -1345,6 +1345,11 @@ static inline enum blk_zoned_model bdev_zoned_model(struct block_device *bdev)
return BLK_ZONED_NONE;
}
+static inline unsigned int bdev_zone_no(struct block_device *bdev, sector_t sec)
+{
+ return disk_zone_no(bdev->bd_disk, sec);
+}
+
static inline int queue_dma_alignment(const struct request_queue *q)
{
return q ? q->dma_alignment : 511;
From patchwork Wed Aug 3 09:47:53 2022
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Pankaj Raghav
X-Patchwork-Id: 12935314
X-Patchwork-Delegate: snitzer@redhat.com
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 us-smtp-delivery-124.mimecast.com
(us-smtp-delivery-124.mimecast.com [170.10.133.124])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by smtp.lore.kernel.org (Postfix) with ESMTPS id A4ABBC19F2C
for ; Wed, 3 Aug 2022 09:48:17 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
s=mimecast20190719; t=1659520096;
h=from:from:sender:sender:reply-to:subject:subject:date:date:
message-id:message-id:to:to:cc:cc:mime-version:mime-version:
content-type:content-type:
content-transfer-encoding:content-transfer-encoding:
in-reply-to:in-reply-to:references:references:list-id:list-help:
list-unsubscribe:list-subscribe:list-post;
bh=yT3dmacz2EKSkOdLkqrGdjDeENqxcYkAsl92+ZIljOs=;
b=eKtdYXzeQtopDcjmMNRRn47YJQVsGGpXMKNbIMxvIWtid3CDaapDc/qkna5Jhk1kb5rjIs
FCScjgRrLUiQ4cy1rxkMndSJKjcTNThAE2B5N4AgA7OsTUBIycyfdok0ToEtLKCD6MUCjX
WlWx+dxMXShn1M77cUkdpYi4nv9RVvw=
Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com
[66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS
(version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
us-mta-618-kl88HH9VM2aki3JI-1-iLw-1; Wed, 03 Aug 2022 05:48:15 -0400
X-MC-Unique: kl88HH9VM2aki3JI-1-iLw-1
Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com
[10.11.54.4])
(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
(No client certificate requested)
by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0CF3A811E75;
Wed, 3 Aug 2022 09:48:14 +0000 (UTC)
Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com
(unknown [10.30.29.100])
by smtp.corp.redhat.com (Postfix) with ESMTP id EF7972026D4C;
Wed, 3 Aug 2022 09:48:13 +0000 (UTC)
Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com
(localhost [IPv6:::1])
by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with
ESMTP id C0E1B1946A50;
Wed, 3 Aug 2022 09:48:13 +0000 (UTC)
Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com
[10.11.54.2])
by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with
ESMTP id 7E3D71946A4E
for ; Wed, 3 Aug 2022 09:48:13 +0000 (UTC)
Received: by smtp.corp.redhat.com (Postfix)
id 6521D40E80E5; Wed, 3 Aug 2022 09:48:13 +0000 (UTC)
Received: from mimecast-mx02.redhat.com
(mimecast06.extmail.prod.ext.rdu2.redhat.com [10.11.55.22])
by smtp.corp.redhat.com (Postfix) with ESMTPS id 2DEB940E80E0
for ; Wed, 3 Aug 2022 09:48:13 +0000 (UTC)
Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com
[205.139.110.120])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 17E041824607
for ; Wed, 3 Aug 2022 09:48:13 +0000 (UTC)
Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com
[210.118.77.12]) by relay.mimecast.com with ESMTP with STARTTLS
(version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
us-mta-86-gFMtH__-ORy-3ehCoFWiMg-1; Wed, 03 Aug 2022 05:48:11 -0400
X-MC-Unique: gFMtH__-ORy-3ehCoFWiMg-1
Received: from eucas1p2.samsung.com (unknown [182.198.249.207])
by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id
20220803094810euoutp0224d3ef8e38560cae397b92f3ee49e27a~HzLrPAGDB1891118911euoutp02S
for ; Wed, 3 Aug 2022 09:48:10 +0000 (GMT)
DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com
20220803094810euoutp0224d3ef8e38560cae397b92f3ee49e27a~HzLrPAGDB1891118911euoutp02S
Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by
eucas1p2.samsung.com (KnoxPortal) with ESMTP id
20220803094808eucas1p20fccdbf39db130f1fcffa078d5c3ffd0~HzLpo-yKd1615116151eucas1p21;
Wed, 3 Aug 2022 09:48:08 +0000 (GMT)
Received: from eucas1p1.samsung.com ( [182.198.249.206]) by
eusmges3new.samsung.com (EUCPMTA) with SMTP id 2C.F2.09580.8544AE26; Wed, 3
Aug 2022 10:48:08 +0100 (BST)
Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by
eucas1p1.samsung.com (KnoxPortal) with ESMTPA id
20220803094808eucas1p1a6a800161d32fe4242d39e669e5f3527~HzLpBPANP1078810788eucas1p1N;
Wed, 3 Aug 2022 09:48:08 +0000 (GMT)
Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by
eusmtrp1.samsung.com (KnoxPortal) with ESMTP id
20220803094808eusmtrp111d241cef0397c0689130cd7d8eb2553~HzLpAXxR92000320003eusmtrp1R;
Wed, 3 Aug 2022 09:48:08 +0000 (GMT)
X-AuditID: cbfec7f5-9c3ff7000000256c-14-62ea4458fe5e
Received: from eusmtip2.samsung.com ( [203.254.199.222]) by
eusmgms2.samsung.com (EUCPMTA) with SMTP id 94.9B.09038.7544AE26; Wed, 3
Aug 2022 10:48:07 +0100 (BST)
Received: from localhost (unknown [106.210.248.112]) by eusmtip2.samsung.com
(KnoxPortal) with ESMTPA id
20220803094807eusmtip2c69438db6f11c983d60b36accf56cbb4~HzLosQXnL1679416794eusmtip2n;
Wed, 3 Aug 2022 09:48:07 +0000 (GMT)
From: Pankaj Raghav
To: Johannes.Thumshirn@wdc.com, snitzer@kernel.org, axboe@kernel.dk,
damien.lemoal@opensource.wdc.com, agk@redhat.com, hch@lst.de
Date: Wed, 3 Aug 2022 11:47:53 +0200
Message-Id: <20220803094801.177490-6-p.raghav@samsung.com>
In-Reply-To: <20220803094801.177490-1-p.raghav@samsung.com>
MIME-Version: 1.0
X-Brightmail-Tracker:
H4sIAAAAAAAAA+NgFnrGKsWRmVeSWpSXmKPExsWy7djPc7oRLq+SDFZu0LBYf+oYs8Xqu/1s
FtM+/GS2+H32PLPF3nezWS1uHtjJZLFn0SQmi5WrjzJZPFk/i9nib9c9Jou9t7QtLu+aw2Yx
f9lTdosJbV+ZLW5MeMpo8XlpC7vFmptPWSxO3JJ2EPK4fMXbY+esu+wel8+Wemxa1cnmsXlJ
vcfumw1sHjtb77N6vN93lc2jb8sqRo/Np6s9Pm+S82g/0M0UwBPFZZOSmpNZllqkb5fAlbF5
/1b2gj6RiiOdk1kaGC8JdDFyckgImEjcOP6crYuRi0NIYAWjxIKDr1kgnC+MEv8m9jNDOJ8Z
Jfa9bWOCadmybQEjRGI5o8TsVxtZIZyXjBKtmxcAtXBwsAloSTR2soPERQSaGSXu/u0BK2IW
OMAkcXPLLbBRwgJREjvunWAGsVkEVCVOr5kCZvMKWElsvTCRHWKdvMTMS9/BbE4Ba4kp//5B
1QhKnJz5hAXEZgaqad46G+xWCYHtnBJ3l3SzQTS7SHxZuBJqkLDEq+NboGwZidOTe1gg7GqJ
pzd+QzW3MEr071zPBvKCBNC2vjM5ICazgKbE+l36EOWOEotnzmCFqOCTuPFWEOIEPolJ26Yz
Q4R5JTrahCCqlSR2/nwCtVRC4nLTHKilHhKXz35lm8CoOAvJM7OQPDMLYe8CRuZVj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OFGcTmFbCS
2HphIjvEBnmJmZe+g9mcAtYSU/79A6sRAqpZ93cWK0S9oMTJmU/ArmMGqm/eOpt5AqPALCSp
WUhSCxiZVjGKpJYW56bnFhvpFSfmFpfmpesl5+duYgTG77ZjP7fsYFz56qPeIUYmDsZDjBIc
zEoivHdcnicJ8aYkVlalFuXHF5XmpBYfYjQFunsis5Rocj4wgeSVxBuaGZgamphZGphamhkr
ifN6FnQkCgmkJ5akZqemFqQWwfQxcXBKNTAl+sp25f3lqDz+RSuO29Y9z3DFlsNdmnpzghR/
F1u98So+PoH7yo6M2jKWeQK5ObMXsFZx1lYx+BeIBRQZOqvne3LM+6i6iTUtk+H5LqYIhv+z
JV4qfeWwiNSzn3VH77SJRFTou/j0+PvPrj6SsuF8UqPwKPZ52EPnZJP0KysSPTyj8qbxXO/5
/6kg8PYqxXO5uoFtu+UZz04Oit02zWqGd9W/+Xuj03kn3UrVmzpX9I3LSc79u/qjozhsdq8t
WdL/me1q0epZK7Sac+/kXnr4Z47V7b8cRXNsGrw0kmZIrN6p8j6Z1WRjyvujqQbLL/ntiFjk
PEPlkM1emaiyxvmM3s9Ld245VdHvFXjSSYmlOCPRUIu5qDgRAAllp1doAwAA
X-CMS-MailID: 20220803094808eucas1p1a6a800161d32fe4242d39e669e5f3527
X-Msg-Generator: CA
X-RootMTR: 20220803094808eucas1p1a6a800161d32fe4242d39e669e5f3527
X-EPHeader: CA
CMS-TYPE: 201P
X-CMS-RootMailID: 20220803094808eucas1p1a6a800161d32fe4242d39e669e5f3527
References: <20220803094801.177490-1-p.raghav@samsung.com>
X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection
Definition; Similar Internal Domain=false;
Similar Monitored External Domain=false; Custom External Domain=false;
Mimecast External Domain=false; Newly Observed Domain=false;
Internal User Name=false; Custom Display Name List=false;
Reply-to Address Mismatch=false; Targeted Threat Dictionary=false;
Mimecast Threat Dictionary=false; Custom Threat Dictionary=false
X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2
Subject: [dm-devel] [PATCH v9 05/13] nvme: zns: Allow ZNS drives that have
non-power_of_2 zone size
X-BeenThere: dm-devel@redhat.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: device-mapper development
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Cc: Pankaj Raghav , bvanassche@acm.org,
pankydev8@gmail.com, gost.dev@samsung.com, linux-kernel@vger.kernel.org,
linux-nvme@lists.infradead.org, linux-block@vger.kernel.org,
dm-devel@redhat.com, jaegeuk@kernel.org, matias.bjorling@wdc.com,
Luis Chamberlain
Errors-To: dm-devel-bounces@redhat.com
Sender: "dm-devel"
X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4
X-Mimecast-Spam-Score: 0
X-Mimecast-Originator: redhat.com
Remove the condition which disallows non-power_of_2 zone size ZNS drive
to be updated and use generic method to calculate number of zones
instead of relying on log and shift based calculation on zone size.
The power_of_2 calculation has been replaced directly with generic
calculation without special handling. Both modified functions are not
used in hot paths, they are only used during initialization &
revalidation of the ZNS device.
As rounddown macro from math.h does not work for 32 bit architectures,
round down operation is open coded.
Reviewed-by: Luis Chamberlain
Reviewed by: Adam Manzanares
Reviewed-by: Hannes Reinecke
Signed-off-by: Pankaj Raghav
---
drivers/nvme/host/zns.c | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)
diff --git a/drivers/nvme/host/zns.c b/drivers/nvme/host/zns.c
index 12316ab51bda..73e4ad495ae8 100644
--- a/drivers/nvme/host/zns.c
+++ b/drivers/nvme/host/zns.c
@@ -101,13 +101,6 @@ int nvme_update_zone_info(struct nvme_ns *ns, unsigned lbaf)
}
ns->zsze = nvme_lba_to_sect(ns, le64_to_cpu(id->lbafe[lbaf].zsze));
- if (!is_power_of_2(ns->zsze)) {
- dev_warn(ns->ctrl->device,
- "invalid zone size:%llu for namespace:%u\n",
- ns->zsze, ns->head->ns_id);
- status = -ENODEV;
- goto free_data;
- }
disk_set_zoned(ns->disk, BLK_ZONED_HM);
blk_queue_flag_set(QUEUE_FLAG_ZONE_RESETALL, q);
@@ -129,7 +122,7 @@ static void *nvme_zns_alloc_report_buffer(struct nvme_ns *ns,
sizeof(struct nvme_zone_descriptor);
nr_zones = min_t(unsigned int, nr_zones,
- get_capacity(ns->disk) >> ilog2(ns->zsze));
+ div64_u64(get_capacity(ns->disk), ns->zsze));
bufsize = sizeof(struct nvme_zone_report) +
nr_zones * sizeof(struct nvme_zone_descriptor);
@@ -182,6 +175,7 @@ int nvme_ns_report_zones(struct nvme_ns *ns, sector_t sector,
int ret, zone_idx = 0;
unsigned int nz, i;
size_t buflen;
+ u64 remainder = 0;
if (ns->head->ids.csi != NVME_CSI_ZNS)
return -EINVAL;
@@ -197,7 +191,11 @@ int nvme_ns_report_zones(struct nvme_ns *ns, sector_t sector,
c.zmr.zrasf = NVME_ZRASF_ZONE_REPORT_ALL;
c.zmr.pr = NVME_REPORT_ZONE_PARTIAL;
- sector &= ~(ns->zsze - 1);
+ /*
+ * Round down the sector value to the nearest zone start
+ */
+ div64_u64_rem(sector, ns->zsze, &remainder);
+ sector -= remainder;
while (zone_idx < nr_zones && sector < get_capacity(ns->disk)) {
memset(report, 0, buflen);
From patchwork Wed Aug 3 09:47:54 2022
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Pankaj Raghav
X-Patchwork-Id: 12935320
X-Patchwork-Delegate: snitzer@redhat.com
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 us-smtp-delivery-124.mimecast.com
(us-smtp-delivery-124.mimecast.com [170.10.129.124])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by smtp.lore.kernel.org (Postfix) with ESMTPS id 7B240C19F2D
for ; Wed, 3 Aug 2022 09:48:21 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
s=mimecast20190719; t=1659520100;
h=from:from:sender:sender:reply-to:subject:subject:date:date:
message-id:message-id:to:to:cc:cc:mime-version:mime-version:
content-type:content-type:
content-transfer-encoding:content-transfer-encoding:
in-reply-to:in-reply-to:references:references:list-id:list-help:
list-unsubscribe:list-subscribe:list-post;
bh=CBMMmQsQlnn+7ISybUOoYI2oRk2LH6k3AXcEGX2ILpk=;
b=EwQidYyCeStOJlf53/CJcba4vvkkVVMeVNXY13bPlH1wyeBpqJlHcKCjt65x90FTveLpqs
EZ8gZlz4SXbrmPmvEthH8osbAsX0LrmFChWgv26uWUPvwOUIFwLNqTYL5X3zPngmUrboBW
iVP8i+NXJF89iCbDPqn74S5LhLyr5aw=
Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com
[66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS
(version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
us-mta-651-OG4qMx6mNKehyQ-UmX3t8g-1; Wed, 03 Aug 2022 05:48:17 -0400
X-MC-Unique: OG4qMx6mNKehyQ-UmX3t8g-1
Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com
[10.11.54.4])
(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
(No client certificate requested)
by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 69E03185A794;
Wed, 3 Aug 2022 09:48:15 +0000 (UTC)
Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com
(unknown [10.30.29.100])
by smtp.corp.redhat.com (Postfix) with ESMTP id 587F52026D4C;
Wed, 3 Aug 2022 09:48:15 +0000 (UTC)
Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com
(localhost [IPv6:::1])
by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with
ESMTP id 2480D1946A53;
Wed, 3 Aug 2022 09:48:15 +0000 (UTC)
Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com
[10.11.54.6])
by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with
ESMTP id D11511946A4E
for ; Wed, 3 Aug 2022 09:48:14 +0000 (UTC)
Received: by smtp.corp.redhat.com (Postfix)
id B227F2166B2A; Wed, 3 Aug 2022 09:48:14 +0000 (UTC)
Received: from mimecast-mx02.redhat.com
(mimecast03.extmail.prod.ext.rdu2.redhat.com [10.11.55.19])
by smtp.corp.redhat.com (Postfix) with ESMTPS id ADCE62166B26
for ; Wed, 3 Aug 2022 09:48:14 +0000 (UTC)
Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com
[207.211.31.120])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 90D508115B1
for ; Wed, 3 Aug 2022 09:48:14 +0000 (UTC)
Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com
[210.118.77.11]) by relay.mimecast.com with ESMTP with STARTTLS
(version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
us-mta-369-j7Ti5HDZNTGFdlr1Cp1cAQ-1; Wed, 03 Aug 2022 05:48:12 -0400
X-MC-Unique: j7Ti5HDZNTGFdlr1Cp1cAQ-1
Received: from eucas1p1.samsung.com (unknown [182.198.249.206])
by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id
20220803094811euoutp011200a67923ca1731a6aaba67e60cb10c~HzLsFm7Tm3128231282euoutp01E
for ; Wed, 3 Aug 2022 09:48:11 +0000 (GMT)
DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com
20220803094811euoutp011200a67923ca1731a6aaba67e60cb10c~HzLsFm7Tm3128231282euoutp01E
Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by
eucas1p1.samsung.com (KnoxPortal) with ESMTP id
20220803094809eucas1p19bd8547e3fcb23e3f951c4f85f06f852~HzLqgfac10754107541eucas1p1_;
Wed, 3 Aug 2022 09:48:09 +0000 (GMT)
Received: from eucas1p2.samsung.com ( [182.198.249.207]) by
eusmges2new.samsung.com (EUCPMTA) with SMTP id 7D.F5.10067.9544AE26; Wed, 3
Aug 2022 10:48:09 +0100 (BST)
Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by
eucas1p1.samsung.com (KnoxPortal) with ESMTPA id
20220803094809eucas1p1e24ddc3076eaa05db0658b88fd34ffd4~HzLqABfkC1902519025eucas1p1K;
Wed, 3 Aug 2022 09:48:09 +0000 (GMT)
Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by
eusmtrp2.samsung.com (KnoxPortal) with ESMTP id
20220803094809eusmtrp261e43580a71933c10a45bfb080762358~HzLp_Bq0z0985609856eusmtrp2w;
Wed, 3 Aug 2022 09:48:09 +0000 (GMT)
X-AuditID: cbfec7f4-dd7ff70000002753-46-62ea4459ad8a
Received: from eusmtip1.samsung.com ( [203.254.199.221]) by
eusmgms1.samsung.com (EUCPMTA) with SMTP id 7E.DB.09095.8544AE26; Wed, 3
Aug 2022 10:48:08 +0100 (BST)
Received: from localhost (unknown [106.210.248.112]) by eusmtip1.samsung.com
(KnoxPortal) with ESMTPA id
20220803094808eusmtip11dc1bc750fcb0c384f4ce3c02685227a~HzLppsgZ-2551225512eusmtip1f;
Wed, 3 Aug 2022 09:48:08 +0000 (GMT)
From: Pankaj Raghav
To: Johannes.Thumshirn@wdc.com, snitzer@kernel.org, axboe@kernel.dk,
damien.lemoal@opensource.wdc.com, agk@redhat.com, hch@lst.de
Date: Wed, 3 Aug 2022 11:47:54 +0200
Message-Id: <20220803094801.177490-7-p.raghav@samsung.com>
In-Reply-To: <20220803094801.177490-1-p.raghav@samsung.com>
MIME-Version: 1.0
X-Brightmail-Tracker:
H4sIAAAAAAAAA+NgFnrKKsWRmVeSWpSXmKPExsWy7djP87qRLq+SDI4sVLBYf+oYs8Xqu/1s
FtM+/G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0e
jSuCL7Y89bd5mPNHbVbZG62Ytx/+Kz48Udy2dNW9dhXPMOtS9cRfOyRdZz8IXDRFovxUdeva
t8sWMzo/fLv+44cqz16WYr519x46vg21q3xi/v4y47bulTacX/JvNO20u6H8Vez0Ep5oQ0cP
nfaO1q6fjzzEgi+uDecvfHlw7QWVA/V1hgI1SizFGYmGWsxFxYkAB/+Yf2YDAAA=
X-CMS-MailID: 20220803094809eucas1p1e24ddc3076eaa05db0658b88fd34ffd4
X-Msg-Generator: CA
X-RootMTR: 20220803094809eucas1p1e24ddc3076eaa05db0658b88fd34ffd4
X-EPHeader: CA
CMS-TYPE: 201P
X-CMS-RootMailID: 20220803094809eucas1p1e24ddc3076eaa05db0658b88fd34ffd4
References: <20220803094801.177490-1-p.raghav@samsung.com>
X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection
Definition; Similar Internal Domain=false;
Similar Monitored External Domain=false; Custom External Domain=false;
Mimecast External Domain=false; Newly Observed Domain=false;
Internal User Name=false; Custom Display Name List=false;
Reply-to Address Mismatch=false; Targeted Threat Dictionary=false;
Mimecast Threat Dictionary=false; Custom Threat Dictionary=false
X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6
Subject: [dm-devel] [PATCH v9 06/13] null_blk: allow zoned devices with non
power-of-2 zone sizes
X-BeenThere: dm-devel@redhat.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: device-mapper development
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Cc: Pankaj Raghav , bvanassche@acm.org,
pankydev8@gmail.com, gost.dev@samsung.com, linux-kernel@vger.kernel.org,
linux-nvme@lists.infradead.org, linux-block@vger.kernel.org,
dm-devel@redhat.com, jaegeuk@kernel.org, matias.bjorling@wdc.com,
Luis Chamberlain
Errors-To: dm-devel-bounces@redhat.com
Sender: "dm-devel"
X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4
X-Mimecast-Spam-Score: 0
X-Mimecast-Originator: redhat.com
Convert the power-of-2(po2) based calculation with zone size to be generic
in null_zone_no with optimization for po2 based zone sizes.
The nr_zones calculation in null_init_zoned_dev has been replaced with a
division without special handling for po2 based zone sizes as
this function is called only during the initialization and will not be
invoked in the hot path.
Reviewed-by: Luis Chamberlain
Reviewed by: Adam Manzanares
Reviewed-by: Hannes Reinecke
Signed-off-by: Pankaj Raghav
---
drivers/block/null_blk/main.c | 5 ++---
drivers/block/null_blk/null_blk.h | 1 +
drivers/block/null_blk/zoned.c | 18 +++++++++++-------
3 files changed, 14 insertions(+), 10 deletions(-)
diff --git a/drivers/block/null_blk/main.c b/drivers/block/null_blk/main.c
index c451c477978f..f1e0605dee94 100644
--- a/drivers/block/null_blk/main.c
+++ b/drivers/block/null_blk/main.c
@@ -1976,9 +1976,8 @@ static int null_validate_conf(struct nullb_device *dev)
if (dev->queue_mode == NULL_Q_BIO)
dev->mbps = 0;
- if (dev->zoned &&
- (!dev->zone_size || !is_power_of_2(dev->zone_size))) {
- pr_err("zone_size must be power-of-two\n");
+ if (dev->zoned && !dev->zone_size) {
+ pr_err("Invalid zero zone size\n");
return -EINVAL;
}
diff --git a/drivers/block/null_blk/null_blk.h b/drivers/block/null_blk/null_blk.h
index 94ff68052b1e..f63b6bed1bb3 100644
--- a/drivers/block/null_blk/null_blk.h
+++ b/drivers/block/null_blk/null_blk.h
@@ -83,6 +83,7 @@ struct nullb_device {
unsigned int imp_close_zone_no;
struct nullb_zone *zones;
sector_t zone_size_sects;
+ unsigned int zone_size_sects_shift;
bool need_zone_res_mgmt;
spinlock_t zone_res_lock;
diff --git a/drivers/block/null_blk/zoned.c b/drivers/block/null_blk/zoned.c
index 55a69e48ef8b..015f6823706c 100644
--- a/drivers/block/null_blk/zoned.c
+++ b/drivers/block/null_blk/zoned.c
@@ -16,7 +16,10 @@ static inline sector_t mb_to_sects(unsigned long mb)
static inline unsigned int null_zone_no(struct nullb_device *dev, sector_t sect)
{
- return sect >> ilog2(dev->zone_size_sects);
+ if (dev->zone_size_sects_shift)
+ return sect >> dev->zone_size_sects_shift;
+
+ return div64_u64(sect, dev->zone_size_sects);
}
static inline void null_lock_zone_res(struct nullb_device *dev)
@@ -65,10 +68,6 @@ int null_init_zoned_dev(struct nullb_device *dev, struct request_queue *q)
sector_t sector = 0;
unsigned int i;
- if (!is_power_of_2(dev->zone_size)) {
- pr_err("zone_size must be power-of-two\n");
- return -EINVAL;
- }
if (dev->zone_size > dev->size) {
pr_err("Zone size larger than device capacity\n");
return -EINVAL;
@@ -86,9 +85,14 @@ int null_init_zoned_dev(struct nullb_device *dev, struct request_queue *q)
zone_capacity_sects = mb_to_sects(dev->zone_capacity);
dev_capacity_sects = mb_to_sects(dev->size);
dev->zone_size_sects = mb_to_sects(dev->zone_size);
- dev->nr_zones = round_up(dev_capacity_sects, dev->zone_size_sects)
- >> ilog2(dev->zone_size_sects);
+ if (is_power_of_2(dev->zone_size_sects))
+ dev->zone_size_sects_shift = ilog2(dev->zone_size_sects);
+ else
+ dev->zone_size_sects_shift = 0;
+
+ dev->nr_zones = DIV_ROUND_UP_SECTOR_T(dev_capacity_sects,
+ dev->zone_size_sects);
dev->zones = kvmalloc_array(dev->nr_zones, sizeof(struct nullb_zone),
GFP_KERNEL | __GFP_ZERO);
if (!dev->zones)
From patchwork Wed Aug 3 09:47:55 2022
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Pankaj Raghav
X-Patchwork-Id: 12935321
X-Patchwork-Delegate: snitzer@redhat.com
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 us-smtp-delivery-124.mimecast.com
(us-smtp-delivery-124.mimecast.com [170.10.133.124])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by smtp.lore.kernel.org (Postfix) with ESMTPS id DFCD4C25B06
for ; Wed, 3 Aug 2022 09:48:21 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
s=mimecast20190719; t=1659520100;
h=from:from:sender:sender:reply-to:subject:subject:date:date:
message-id:message-id:to:to:cc:cc:mime-version:mime-version:
content-type:content-type:
content-transfer-encoding:content-transfer-encoding:
in-reply-to:in-reply-to:references:references:list-id:list-help:
list-unsubscribe:list-subscribe:list-post;
bh=jamXr8quZrda2gm/OeXqwXaoHJv1i7HvaixEeOY243M=;
b=Wgl9IINf1kbcYXmUY+hFa08Tg8tnXPYcciLrWDKQxMfZzSGfoFAaYC8Thv1zyUx1gL+K7S
14rEUDXTEQwyp9KQv0LBY3y/seHJmS9KbbfDPdKlNOaHU1vDIjiIhLQSKB5e/uXGxk2rhT
cUM4jCnCi8jLMgfKo7Vl1rZShiKqzig=
Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com
[66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS
(version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
us-mta-630-BNAsFB_bN7qPrsPMPj1ODQ-1; Wed, 03 Aug 2022 05:48:17 -0400
X-MC-Unique: BNAsFB_bN7qPrsPMPj1ODQ-1
Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com
[10.11.54.1])
(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
(No client certificate requested)
by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8A22F280F2AA;
Wed, 3 Aug 2022 09:48:16 +0000 (UTC)
Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com
(unknown [10.30.29.100])
by smtp.corp.redhat.com (Postfix) with ESMTP id 76E2640CFD0A;
Wed, 3 Aug 2022 09:48:16 +0000 (UTC)
Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com
(localhost [IPv6:::1])
by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with
ESMTP id 5BFDB1946A53;
Wed, 3 Aug 2022 09:48:16 +0000 (UTC)
Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com
[10.11.54.5])
by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with
ESMTP id CC0CC1946A4E
for ; Wed, 3 Aug 2022 09:48:15 +0000 (UTC)
Received: by smtp.corp.redhat.com (Postfix)
id BC5B718EAA; Wed, 3 Aug 2022 09:48:15 +0000 (UTC)
Received: from mimecast-mx02.redhat.com
(mimecast07.extmail.prod.ext.rdu2.redhat.com [10.11.55.23])
by smtp.corp.redhat.com (Postfix) with ESMTPS id B818718EA8
for ; Wed, 3 Aug 2022 09:48:15 +0000 (UTC)
Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com
[207.211.31.120])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9C1DD3C0D859
for ; Wed, 3 Aug 2022 09:48:15 +0000 (UTC)
Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com
[210.118.77.12]) by relay.mimecast.com with ESMTP with STARTTLS
(version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
us-mta-661-g-Cltl6FNp-L8zNDt70sqg-1; Wed, 03 Aug 2022 05:48:14 -0400
X-MC-Unique: g-Cltl6FNp-L8zNDt70sqg-1
Received: from eucas1p1.samsung.com (unknown [182.198.249.206])
by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id
20220803094812euoutp021222b63d583198baff9668f3b9e7cf2d~HzLtc9lYX1921619216euoutp02M
for ; Wed, 3 Aug 2022 09:48:12 +0000 (GMT)
DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com
20220803094812euoutp021222b63d583198baff9668f3b9e7cf2d~HzLtc9lYX1921619216euoutp02M
Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by
eucas1p1.samsung.com (KnoxPortal) with ESMTP id
20220803094810eucas1p13ef520e51d3ca7b5822a11e2d1d1af1b~HzLrqKrSc1447714477eucas1p1G;
Wed, 3 Aug 2022 09:48:10 +0000 (GMT)
Received: from eucas1p1.samsung.com ( [182.198.249.206]) by
eusmges2new.samsung.com (EUCPMTA) with SMTP id 11.06.10067.A544AE26; Wed, 3
Aug 2022 10:48:10 +0100 (BST)
Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by
eucas1p1.samsung.com (KnoxPortal) with ESMTPA id
20220803094810eucas1p1304a82ba94d0265c3f6a8a371e5127a7~HzLq8-nPY3109731097eucas1p1S;
Wed, 3 Aug 2022 09:48:10 +0000 (GMT)
Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by
eusmtrp2.samsung.com (KnoxPortal) with ESMTP id
20220803094810eusmtrp2d87915093087080592522be7fa4346e1~HzLq8LrDT0972009720eusmtrp2d;
Wed, 3 Aug 2022 09:48:10 +0000 (GMT)
X-AuditID: cbfec7f4-dd7ff70000002753-4c-62ea445afc23
Received: from eusmtip1.samsung.com ( [203.254.199.221]) by
eusmgms1.samsung.com (EUCPMTA) with SMTP id 10.EB.09095.9544AE26; Wed, 3
Aug 2022 10:48:09 +0100 (BST)
Received: from localhost (unknown [106.210.248.112]) by eusmtip1.samsung.com
(KnoxPortal) with ESMTPA id
20220803094809eusmtip1d73b9053f698e1f43a7bd40d4f7d177b~HzLqlR4Nk2555925559eusmtip1j;
Wed, 3 Aug 2022 09:48:09 +0000 (GMT)
From: Pankaj Raghav
To: Johannes.Thumshirn@wdc.com, snitzer@kernel.org, axboe@kernel.dk,
damien.lemoal@opensource.wdc.com, agk@redhat.com, hch@lst.de
Date: Wed, 3 Aug 2022 11:47:55 +0200
Message-Id: <20220803094801.177490-8-p.raghav@samsung.com>
In-Reply-To: <20220803094801.177490-1-p.raghav@samsung.com>
MIME-Version: 1.0
X-Brightmail-Tracker:
H4sIAAAAAAAAA+NgFnrMKsWRmVeSWpSXmKPExsWy7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niXO53iqs89h8L+S6u/qZTPUMhcLw/Qzaq02n/wtOO3X5tPGFuPTZ
9zSnsrl929M82XfWtB+3+/p69/1fGDIv5a3OrXm+bFbvNLiUllbKb//Q8/WayKscsY0fhW0y
gxKuM3BJWPOxVqocn7cgeZfQdhOO4w9lt0SueRb6K2mRWc+u+LI/XGxmoremL2hzCpihvGfn
6wPrXWfN4VgkPfHb7ScPf6fOsT+lma7EUpyRaKjFXFScCAAFxu0AZgMAAA==
X-CMS-MailID: 20220803094810eucas1p1304a82ba94d0265c3f6a8a371e5127a7
X-Msg-Generator: CA
X-RootMTR: 20220803094810eucas1p1304a82ba94d0265c3f6a8a371e5127a7
X-EPHeader: CA
CMS-TYPE: 201P
X-CMS-RootMailID: 20220803094810eucas1p1304a82ba94d0265c3f6a8a371e5127a7
References: <20220803094801.177490-1-p.raghav@samsung.com>
X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection
Definition; Similar Internal Domain=false;
Similar Monitored External Domain=false; Custom External Domain=false;
Mimecast External Domain=false; Newly Observed Domain=false;
Internal User Name=false; Custom Display Name List=false;
Reply-to Address Mismatch=false; Targeted Threat Dictionary=false;
Mimecast Threat Dictionary=false; Custom Threat Dictionary=false
X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5
Subject: [dm-devel] [PATCH v9 07/13] zonefs: allow non power of 2 zoned
devices
X-BeenThere: dm-devel@redhat.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: device-mapper development
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Cc: Pankaj Raghav , bvanassche@acm.org,
pankydev8@gmail.com, gost.dev@samsung.com, linux-kernel@vger.kernel.org,
linux-nvme@lists.infradead.org, linux-block@vger.kernel.org,
dm-devel@redhat.com, jaegeuk@kernel.org, matias.bjorling@wdc.com,
Luis Chamberlain
Errors-To: dm-devel-bounces@redhat.com
Sender: "dm-devel"
X-Scanned-By: MIMEDefang 2.84 on 10.11.54.1
X-Mimecast-Spam-Score: 0
X-Mimecast-Originator: redhat.com
The zone size shift variable is useful only if the zone sizes are known
to be power of 2. Remove that variable and use generic helpers from
block layer to calculate zone index in zonefs.
Acked-by: Damien Le Moal
Reviewed-by: Luis Chamberlain
Signed-off-by: Pankaj Raghav
---
fs/zonefs/super.c | 6 ++----
fs/zonefs/zonefs.h | 1 -
2 files changed, 2 insertions(+), 5 deletions(-)
diff --git a/fs/zonefs/super.c b/fs/zonefs/super.c
index 860f0b1032c6..e549ef16738c 100644
--- a/fs/zonefs/super.c
+++ b/fs/zonefs/super.c
@@ -476,10 +476,9 @@ static void __zonefs_io_error(struct inode *inode, bool write)
{
struct zonefs_inode_info *zi = ZONEFS_I(inode);
struct super_block *sb = inode->i_sb;
- struct zonefs_sb_info *sbi = ZONEFS_SB(sb);
unsigned int noio_flag;
unsigned int nr_zones =
- zi->i_zone_size >> (sbi->s_zone_sectors_shift + SECTOR_SHIFT);
+ bdev_zone_no(sb->s_bdev, zi->i_zone_size >> SECTOR_SHIFT);
struct zonefs_ioerr_data err = {
.inode = inode,
.write = write,
@@ -1401,7 +1400,7 @@ static int zonefs_init_file_inode(struct inode *inode, struct blk_zone *zone,
struct zonefs_inode_info *zi = ZONEFS_I(inode);
int ret = 0;
- inode->i_ino = zone->start >> sbi->s_zone_sectors_shift;
+ inode->i_ino = bdev_zone_no(sb->s_bdev, zone->start);
inode->i_mode = S_IFREG | sbi->s_perm;
zi->i_ztype = type;
@@ -1776,7 +1775,6 @@ static int zonefs_fill_super(struct super_block *sb, void *data, int silent)
* interface constraints.
*/
sb_set_blocksize(sb, bdev_zone_write_granularity(sb->s_bdev));
- sbi->s_zone_sectors_shift = ilog2(bdev_zone_sectors(sb->s_bdev));
sbi->s_uid = GLOBAL_ROOT_UID;
sbi->s_gid = GLOBAL_ROOT_GID;
sbi->s_perm = 0640;
diff --git a/fs/zonefs/zonefs.h b/fs/zonefs/zonefs.h
index 4b3de66c3233..39895195cda6 100644
--- a/fs/zonefs/zonefs.h
+++ b/fs/zonefs/zonefs.h
@@ -177,7 +177,6 @@ struct zonefs_sb_info {
kgid_t s_gid;
umode_t s_perm;
uuid_t s_uuid;
- unsigned int s_zone_sectors_shift;
unsigned int s_nr_files[ZONEFS_ZTYPE_MAX];
From patchwork Wed Aug 3 09:47:56 2022
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Pankaj Raghav
X-Patchwork-Id: 12935324
X-Patchwork-Delegate: snitzer@redhat.com
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 us-smtp-delivery-124.mimecast.com
(us-smtp-delivery-124.mimecast.com [170.10.129.124])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by smtp.lore.kernel.org (Postfix) with ESMTPS id 151F1C19F2C
for ; Wed, 3 Aug 2022 09:48:24 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
s=mimecast20190719; t=1659520104;
h=from:from:sender:sender:reply-to:subject:subject:date:date:
message-id:message-id:to:to:cc:cc:mime-version:mime-version:
content-type:content-type:
content-transfer-encoding:content-transfer-encoding:
in-reply-to:in-reply-to:references:references:list-id:list-help:
list-unsubscribe:list-subscribe:list-post;
bh=iAGkZQXRt2Tjwrmli5Rn4yHVD76WsF92xnssrAogFgU=;
b=HI2rvUk2s2VAaGwj+FoJnCD4FjwRtRmPv/V0vZf0IvlkrwR02FSWNMYrLxU6t8SGkbzQmh
sZ2PM9q5yZYsvmMDgprYRTSXLqDg6xMHFsHRTLnuZusg7VOb96JWfuB+Ueyggv2o+urr92
1zmShHuhWeVpFBq0DRjyPgwe0To5KXo=
Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com
[66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS
(version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
us-mta-583-L7RjbJNIOiW39RdHvQijEQ-1; Wed, 03 Aug 2022 05:48:20 -0400
X-MC-Unique: L7RjbJNIOiW39RdHvQijEQ-1
Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com
[10.11.54.4])
(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
(No client certificate requested)
by mimecast-mx02.redhat.com (Postfix) with ESMTPS id AB8AB280F2AD;
Wed, 3 Aug 2022 09:48:18 +0000 (UTC)
Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com
(unknown [10.30.29.100])
by smtp.corp.redhat.com (Postfix) with ESMTP id 92C8C2026D4C;
Wed, 3 Aug 2022 09:48:18 +0000 (UTC)
Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com
(localhost [IPv6:::1])
by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with
ESMTP id 4CC4B1946A53;
Wed, 3 Aug 2022 09:48:18 +0000 (UTC)
Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com
[10.11.54.9])
by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with
ESMTP id 3B0641946A50
for ; Wed, 3 Aug 2022 09:48:17 +0000 (UTC)
Received: by smtp.corp.redhat.com (Postfix)
id 17647492CA4; Wed, 3 Aug 2022 09:48:17 +0000 (UTC)
Received: from mimecast-mx02.redhat.com
(mimecast08.extmail.prod.ext.rdu2.redhat.com [10.11.55.24])
by smtp.corp.redhat.com (Postfix) with ESMTPS id 130A4492C3B
for ; Wed, 3 Aug 2022 09:48:17 +0000 (UTC)
Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256
bits)) (No client certificate requested)
by mimecast-mx02.redhat.com (Postfix) with ESMTPS id EDC6438217F0
for ; Wed, 3 Aug 2022 09:48:16 +0000 (UTC)
Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com
[210.118.77.11]) by relay.mimecast.com with ESMTP with STARTTLS
(version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
us-mta-155-HR2H1FQ_P6GyF3ssKHFghA-1; Wed, 03 Aug 2022 05:48:15 -0400
X-MC-Unique: HR2H1FQ_P6GyF3ssKHFghA-1
Received: from eucas1p2.samsung.com (unknown [182.198.249.207])
by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id
20220803094813euoutp01f8aadfee5b844cddbe26997659a36d3f~HzLuhmVTv3242932429euoutp01S
for ; Wed, 3 Aug 2022 09:48:13 +0000 (GMT)
DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com
20220803094813euoutp01f8aadfee5b844cddbe26997659a36d3f~HzLuhmVTv3242932429euoutp01S
Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by
eucas1p2.samsung.com (KnoxPortal) with ESMTP id
20220803094811eucas1p28cd48175b9feac0080f9be506dd1b5b5~HzLspo2by1532415324eucas1p2S;
Wed, 3 Aug 2022 09:48:11 +0000 (GMT)
Received: from eucas1p1.samsung.com ( [182.198.249.206]) by
eusmges1new.samsung.com (EUCPMTA) with SMTP id 08.FF.09664.B544AE26; Wed, 3
Aug 2022 10:48:11 +0100 (BST)
Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by
eucas1p1.samsung.com (KnoxPortal) with ESMTPA id
20220803094811eucas1p17a2ac191899bba7938de6b9e3a55352f~HzLsBClpH3109631096eucas1p18;
Wed, 3 Aug 2022 09:48:11 +0000 (GMT)
Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by
eusmtrp1.samsung.com (KnoxPortal) with ESMTP id
20220803094811eusmtrp1ba4f7f94f43e6937f2a29d964ceaf11c~HzLr5us1F2000320003eusmtrp1Y;
Wed, 3 Aug 2022 09:48:11 +0000 (GMT)
X-AuditID: cbfec7f2-d81ff700000025c0-8e-62ea445bc010
Received: from eusmtip2.samsung.com ( [203.254.199.222]) by
eusmgms2.samsung.com (EUCPMTA) with SMTP id 07.9B.09038.A544AE26; Wed, 3
Aug 2022 10:48:11 +0100 (BST)
Received: from localhost (unknown [106.210.248.112]) by eusmtip2.samsung.com
(KnoxPortal) with ESMTPA id
20220803094810eusmtip2b837e592c0d57ed90af9168ead84a75c~HzLrkbg3V1623616236eusmtip29;
Wed, 3 Aug 2022 09:48:10 +0000 (GMT)
From: Pankaj Raghav
To: Johannes.Thumshirn@wdc.com, snitzer@kernel.org, axboe@kernel.dk,
damien.lemoal@opensource.wdc.com, agk@redhat.com, hch@lst.de
Date: Wed, 3 Aug 2022 11:47:56 +0200
Message-Id: <20220803094801.177490-9-p.raghav@samsung.com>
In-Reply-To: <20220803094801.177490-1-p.raghav@samsung.com>
MIME-Version: 1.0
X-Brightmail-Tracker:
H4sIAAAAAAAAA+NgFnrCKsWRmVeSWpSXmKPExsWy7djPc7rRLq+SDM5+NrZYf+oYs8Xqu/1s
FtM+/GS2+H32PLPF3nezWS1uHtjJZLFn0SQmi5WrjzJZPFk/i9nib9c9Jou9t7QtLu+aw2Yx
f9lTdosJbV+ZLW5MeMpo8XlpC7vFmptPWSxO3JJ2EPK4fMXbY+esu+wel8+Wemxa1cnmsXlJ
vcfumw1sHjtb77N6vN93lc2jb8sqRo/Np6s9Pm+S82g/0M0UwBPFZZOSmpNZllqkb5fAlXF8
+hmWgr3cFX/nvmdtYFzH2cXIySEhYCKxc9cV1i5GLg4hgRWMEpvO72OHcL4wSix9vxjK+cwo
8fT9RRaYlv0PH0G1LGeU2PtoEpTzklHi7OofQA4HB5uAlkRjJ1i3iEAzo8Tdvz1gRcwCB5gk
Fr3+wQgySlggWGLqqx1MIA0sAqoSJ65EgoR5Bawkmg89Y4bYJi8x89J3dhCbU8BaYsq/f8wQ
NYISJ2c+AbuIGaimeetsZpD5EgK7OSUe3z7LCNHsIvH14nGos4UlXh3fwg5hy0icntwDFa+W
eH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QcQmJ2wubGCFsYYk/17rYuhi5gGqeM0osOvCduYuRg4NN
QEuisZMdJC4i0M0ocfnMOVYQh1ngHJPE8+9dYN3CAoESy7dfZwFpYBFQlThxJRIkzCtgJdF8
6BkzxAJ5iZmXvrOD2JwC1hJT/v1jhjjISmLd31msEPWCEidnPmEBsZmB6pu3zmaewCgwC0lq
FpLUAkamVYwiqaXFuem5xUZ6xYm5xaV56XrJ+bmbGIGxu+3Yzy07GFe++qh3iJGJg/EQowQH
s5II7x2X50lCvCmJlVWpRfnxRaU5qcWHGE2Bzp7ILCWanA9MHnkl8YZmBqaGJmaWBqaWZsZK
4ryeBR2JQgLpiSWp2ampBalFMH1MHJxSDUy8DglX0y5Os9431+SK32yn9srn2cviUpdsjzvU
+Pm0pvmsys28b973PDlXf2V1bHqUiPOurFzhokVHlMq3RMSm9H97/HdRvVznunfmdcdqM+Zo
qSZLPmqxPB951fb9ar+Lrz5YTl7w5NXkl4Hbiw6631adkyf+jlGJ42ez6DsfaS5BNY0ZiT88
NXsNVjxjSH+YH7rpzwGV+yGx/YcLHZsiMqpqV5znuBx8aOpa9x0vf8i6zzz9lJ9vGV9J8DOd
uQw3dOS27eovfJUT7SZyJmjT1wn7rgZvc/rbKBQZYLdx5zNbZe5vJQxbeW8mJWzea/2j7kPt
wjXF4i1blRNj9zou0WXfWFjwbMs1jYe+Oz8qsRRnJBpqMRcVJwIARSsy8WYDAAA=
X-CMS-MailID: 20220803094811eucas1p17a2ac191899bba7938de6b9e3a55352f
X-Msg-Generator: CA
X-RootMTR: 20220803094811eucas1p17a2ac191899bba7938de6b9e3a55352f
X-EPHeader: CA
CMS-TYPE: 201P
X-CMS-RootMailID: 20220803094811eucas1p17a2ac191899bba7938de6b9e3a55352f
References: <20220803094801.177490-1-p.raghav@samsung.com>
X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection
Definition; Similar Internal Domain=false;
Similar Monitored External Domain=false; Custom External Domain=false;
Mimecast External Domain=false; Newly Observed Domain=false;
Internal User Name=false; Custom Display Name List=false;
Reply-to Address Mismatch=false; Targeted Threat Dictionary=false;
Mimecast Threat Dictionary=false; Custom Threat Dictionary=false
X-Scanned-By: MIMEDefang 2.85 on 10.11.54.9
Subject: [dm-devel] [PATCH v9 08/13] dm-zoned: ensure only power of 2 zone
sizes are allowed
X-BeenThere: dm-devel@redhat.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: device-mapper development
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Cc: Pankaj Raghav , bvanassche@acm.org,
pankydev8@gmail.com, gost.dev@samsung.com, linux-kernel@vger.kernel.org,
linux-nvme@lists.infradead.org, linux-block@vger.kernel.org,
dm-devel@redhat.com, jaegeuk@kernel.org, matias.bjorling@wdc.com,
Luis Chamberlain
Errors-To: dm-devel-bounces@redhat.com
Sender: "dm-devel"
X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4
X-Mimecast-Spam-Score: 0
X-Mimecast-Originator: redhat.com
From: Luis Chamberlain
dm-zoned relies on the assumption that the zone size is a
power-of-2(po2) and the zone capacity is same as the zone size.
Ensure only po2 devices can be used as dm-zoned target until a native
non po2 support is added.
Reviewed-by: Hannes Reinecke
Signed-off-by: Luis Chamberlain
Signed-off-by: Pankaj Raghav
Reviewed-by: Damien Le Moal
---
drivers/md/dm-zoned-target.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/md/dm-zoned-target.c b/drivers/md/dm-zoned-target.c
index 95b132b52f33..9325bf5dee81 100644
--- a/drivers/md/dm-zoned-target.c
+++ b/drivers/md/dm-zoned-target.c
@@ -792,6 +792,10 @@ static int dmz_fixup_devices(struct dm_target *ti)
return -EINVAL;
}
zone_nr_sectors = bdev_zone_sectors(bdev);
+ if (!is_power_of_2(zone_nr_sectors)) {
+ ti->error = "Zone size is not a power-of-2 number of sectors";
+ return -EINVAL;
+ }
zoned_dev->zone_nr_sectors = zone_nr_sectors;
zoned_dev->nr_zones = bdev_nr_zones(bdev);
}
@@ -804,6 +808,10 @@ static int dmz_fixup_devices(struct dm_target *ti)
return -EINVAL;
}
zoned_dev->zone_nr_sectors = bdev_zone_sectors(bdev);
+ if (!is_power_of_2(zoned_dev->zone_nr_sectors)) {
+ ti->error = "Zone size is not a power-of-2 number of sectors";
+ return -EINVAL;
+ }
zoned_dev->nr_zones = bdev_nr_zones(bdev);
}
From patchwork Wed Aug 3 09:47:57 2022
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Pankaj Raghav
X-Patchwork-Id: 12935323
X-Patchwork-Delegate: snitzer@redhat.com
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 us-smtp-delivery-124.mimecast.com
(us-smtp-delivery-124.mimecast.com [170.10.133.124])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by smtp.lore.kernel.org (Postfix) with ESMTPS id 839E1C19F2A
for ; Wed, 3 Aug 2022 09:48:24 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
s=mimecast20190719; t=1659520103;
h=from:from:sender:sender:reply-to:subject:subject:date:date:
message-id:message-id:to:to:cc:cc:mime-version:mime-version:
content-type:content-type:
content-transfer-encoding:content-transfer-encoding:
in-reply-to:in-reply-to:references:references:list-id:list-help:
list-unsubscribe:list-subscribe:list-post;
bh=pFZmg5OgK2CWY8b27rhkPhcTOKEq8EiWAQHdbmeHPCc=;
b=Unj4Jeh/Gb5SgZ27Yk8YSA+9dNiv+ZGTUA8VszVuNxGhcpq+sl9yQech59Wd6WL/MxNiCE
2uaCSM814jiYO91KRPgmN56zHlWSDNVTsF8W6k+5g6poI8tnEZ8nAUrWohqAt1D5T4HSsc
Rb8W312Y4KfXdz6/qg6s70H83eB14S4=
Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com
[66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS
(version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
us-mta-596-ggPYZXmMNY6oEK8kvSA1CQ-1; Wed, 03 Aug 2022 05:48:20 -0400
X-MC-Unique: ggPYZXmMNY6oEK8kvSA1CQ-1
Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com
[10.11.54.5])
(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
(No client certificate requested)
by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0DBC385A58B;
Wed, 3 Aug 2022 09:48:19 +0000 (UTC)
Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com
(unknown [10.30.29.100])
by smtp.corp.redhat.com (Postfix) with ESMTP id BD19790A04;
Wed, 3 Aug 2022 09:48:18 +0000 (UTC)
Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com
(localhost [IPv6:::1])
by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with
ESMTP id 842431946A60;
Wed, 3 Aug 2022 09:48:18 +0000 (UTC)
Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com
[10.11.54.10])
by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with
ESMTP id 9969A1946A50
for ; Wed, 3 Aug 2022 09:48:17 +0000 (UTC)
Received: by smtp.corp.redhat.com (Postfix)
id 8D0DE403166; Wed, 3 Aug 2022 09:48:17 +0000 (UTC)
Received: from mimecast-mx02.redhat.com
(mimecast06.extmail.prod.ext.rdu2.redhat.com [10.11.55.22])
by smtp.corp.redhat.com (Postfix) with ESMTPS id 88D63492C3B
for ; Wed, 3 Aug 2022 09:48:17 +0000 (UTC)
Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256
bits)) (No client certificate requested)
by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 71306185A7B2
for ; Wed, 3 Aug 2022 09:48:17 +0000 (UTC)
Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com
[210.118.77.12]) by relay.mimecast.com with ESMTP with STARTTLS
(version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
us-mta-227-2V1Buw4DNDS2JbZFbnZ1KA-1; Wed, 03 Aug 2022 05:48:15 -0400
X-MC-Unique: 2V1Buw4DNDS2JbZFbnZ1KA-1
Received: from eucas1p1.samsung.com (unknown [182.198.249.206])
by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id
20220803094814euoutp0232c7c78b341cddacc69405904d4d80fa~HzLvBSRyj2040620406euoutp02o
for ; Wed, 3 Aug 2022 09:48:14 +0000 (GMT)
DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com
20220803094814euoutp0232c7c78b341cddacc69405904d4d80fa~HzLvBSRyj2040620406euoutp02o
Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by
eucas1p2.samsung.com (KnoxPortal) with ESMTP id
20220803094812eucas1p2bd850e62b8b1e5b102ce5cf367481d37~HzLti7ILc2471124711eucas1p2q;
Wed, 3 Aug 2022 09:48:12 +0000 (GMT)
Received: from eucas1p2.samsung.com ( [182.198.249.207]) by
eusmges3new.samsung.com (EUCPMTA) with SMTP id A3.03.09580.C544AE26; Wed, 3
Aug 2022 10:48:12 +0100 (BST)
Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by
eucas1p2.samsung.com (KnoxPortal) with ESMTPA id
20220803094812eucas1p271cea804453d9dd379b919067fe5b154~HzLs1fMOB1615116151eucas1p26;
Wed, 3 Aug 2022 09:48:12 +0000 (GMT)
Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by
eusmtrp1.samsung.com (KnoxPortal) with ESMTP id
20220803094812eusmtrp1a4c85857281fce3a66bd62cdfdd094cf~HzLs0miIg2000320003eusmtrp1c;
Wed, 3 Aug 2022 09:48:12 +0000 (GMT)
X-AuditID: cbfec7f5-9adff7000000256c-27-62ea445c55ce
Received: from eusmtip2.samsung.com ( [203.254.199.222]) by
eusmgms2.samsung.com (EUCPMTA) with SMTP id A8.9B.09038.C544AE26; Wed, 3
Aug 2022 10:48:12 +0100 (BST)
Received: from localhost (unknown [106.210.248.112]) by eusmtip2.samsung.com
(KnoxPortal) with ESMTPA id
20220803094811eusmtip2c6b37f361d28822a8c01f5e0fb4f3c34~HzLsg0_a31632116321eusmtip2w;
Wed, 3 Aug 2022 09:48:11 +0000 (GMT)
From: Pankaj Raghav
To: Johannes.Thumshirn@wdc.com, snitzer@kernel.org, axboe@kernel.dk,
damien.lemoal@opensource.wdc.com, agk@redhat.com, hch@lst.de
Date: Wed, 3 Aug 2022 11:47:57 +0200
Message-Id: <20220803094801.177490-10-p.raghav@samsung.com>
In-Reply-To: <20220803094801.177490-1-p.raghav@samsung.com>
MIME-Version: 1.0
X-Brightmail-Tracker:
H4sIAAAAAAAAA+NgFnrKKsWRmVeSWpSXmKPExsWy7djP87oxLq+SDI53GVusP3WM2WL13X42
i2kffjJb/D57ntli77vZrBY3D+xkstizaBKTxcrVR5ksnqyfxWzxt+sek8XeW9oWl3fNYbOY
v+wpu8WEtq/MFjcmPGW0+Ly0hd1izc2nLBYnbkk7CHlcvuLtsXPWXXaPy2dLPTat6mTz2Lyk
3mP3zQY2j52t91k93u+7yubRt2UVo8fm09UenzfJebQf6GYK4InisklJzcksSy3St0vgyph9
t42toJ+74vPL6cwNjBM5uxg5OSQETCQ+rW9l6mLk4hASWMEocWRTJyNIQkjgC6PEjH2xEInP
jBKT975mhelofnuUESKxnFFi87ImVgjnJaNE/4oWoAwHB5uAlkRjJztIXESgmVHi7t8esCJm
gQNMEje33GICGSUsECMx+dJJsH0sAqoSsx4vYwGxeQWsJa7Oa4daJy8x89J3dhCbEyg+5d8/
ZogaQYmTM5+A1TMD1TRvnc0MskBCYDenxPx1cxghml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NjBM5uxg5
OSQETCSa3x5l7GLk4hASWMooserDSzaIhITE7YVNjBC2sMSfa11sEEXPGSX+PrzH2sXIwcEm
oCXR2MkOEhcR6GaUuHzmHCuIwyxwjkliztMHYJOEBaIkFj39zQxiswioSsx6vIwFxOYVsJa4
Oq+dFWKDvMTMS9/ZQWxOoPiUf//A6oUErCTW/Z3FClEvKHFy5hOwXmag+uats5knMArMQpKa
hSS1gJFpFaNIamlxbnpusZFecWJucWleul5yfu4mRmD8bjv2c8sOxpWvPuodYmTiYDzEKMHB
rCTCe8fleZIQb0piZVVqUX58UWlOavEhRlOguycyS4km5wMTSF5JvKGZgamhiZmlgamlmbGS
OK9nQUeikEB6YklqdmpqQWoRTB8TB6dUA5Pj+jXduyYqpYi5BFtr7Nted+21X57+xfnOpnpL
b02/sWnrAUfRaZcOM10V+HtAt/xpwcyEm1/5uCd/+i6j/bP09O070T/O1//b0XhaOG9FwsPo
TzlOmpd0L9ucCdOuF33Be3tbR+ryoD3827gvMqw3s+dd0zTr/IRrD9xP9llMUdDkjkm+VChe
WfJ4kfXSnkjxi8V+W4pM8z5d6Oi4Fel+vrXBI+L55+Xns+6pddff8lrPvfX/psVdPvO3rArf
d6xP227fNL92xyTfO47Pp6pEzpR+45N8afOdhavPTeh8fUYj/F6c6u2G0/cWulbzTE57ezv+
2EoJR8813l+tv6n+ONj57WvGOtV1vbxnTU6EKbEUZyQaajEXFScCAPgIuAloAwAA
X-CMS-MailID: 20220803094812eucas1p271cea804453d9dd379b919067fe5b154
X-Msg-Generator: CA
X-RootMTR: 20220803094812eucas1p271cea804453d9dd379b919067fe5b154
X-EPHeader: CA
CMS-TYPE: 201P
X-CMS-RootMailID: 20220803094812eucas1p271cea804453d9dd379b919067fe5b154
References: <20220803094801.177490-1-p.raghav@samsung.com>
X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection
Definition; Similar Internal Domain=false;
Similar Monitored External Domain=false; Custom External Domain=false;
Mimecast External Domain=false; Newly Observed Domain=false;
Internal User Name=false; Custom Display Name List=false;
Reply-to Address Mismatch=false; Targeted Threat Dictionary=false;
Mimecast Threat Dictionary=false; Custom Threat Dictionary=false
X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10
Subject: [dm-devel] [PATCH v9 09/13] dm-zone: use generic helpers to
calculate offset from zone start
X-BeenThere: dm-devel@redhat.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: device-mapper development
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Cc: Pankaj Raghav , bvanassche@acm.org,
pankydev8@gmail.com, gost.dev@samsung.com, linux-kernel@vger.kernel.org,
linux-nvme@lists.infradead.org, linux-block@vger.kernel.org,
dm-devel@redhat.com, jaegeuk@kernel.org, matias.bjorling@wdc.com,
Luis Chamberlain
Errors-To: dm-devel-bounces@redhat.com
Sender: "dm-devel"
X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5
X-Mimecast-Spam-Score: 0
X-Mimecast-Originator: redhat.com
Use the bdev_offset_from_zone_start() helper function to calculate
the offset from zone start instead of using power of 2 based
calculation.
Signed-off-by: Pankaj Raghav
Reviewed-by: Luis Chamberlain
Reviewed-by: Damien Le Moal
---
drivers/md/dm-zone.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/drivers/md/dm-zone.c b/drivers/md/dm-zone.c
index 3dafc0e8b7a9..31c16aafdbfc 100644
--- a/drivers/md/dm-zone.c
+++ b/drivers/md/dm-zone.c
@@ -390,7 +390,9 @@ static bool dm_zone_map_bio_begin(struct mapped_device *md,
case REQ_OP_WRITE_ZEROES:
case REQ_OP_WRITE:
/* Writes must be aligned to the zone write pointer */
- if ((clone->bi_iter.bi_sector & (zsectors - 1)) != zwp_offset)
+ if ((bdev_offset_from_zone_start(md->disk->part0,
+ clone->bi_iter.bi_sector)) != zwp_offset)
+
return false;
break;
case REQ_OP_ZONE_APPEND:
@@ -602,11 +604,8 @@ void dm_zone_endio(struct dm_io *io, struct bio *clone)
*/
if (clone->bi_status == BLK_STS_OK &&
bio_op(clone) == REQ_OP_ZONE_APPEND) {
- sector_t mask =
- (sector_t)bdev_zone_sectors(disk->part0) - 1;
-
orig_bio->bi_iter.bi_sector +=
- clone->bi_iter.bi_sector & mask;
+ bdev_offset_from_zone_start(disk->part0, clone->bi_iter.bi_sector);
}
return;
From patchwork Wed Aug 3 09:47:58 2022
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Pankaj Raghav
X-Patchwork-Id: 12935322
X-Patchwork-Delegate: snitzer@redhat.com
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 us-smtp-delivery-124.mimecast.com
(us-smtp-delivery-124.mimecast.com [170.10.133.124])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by smtp.lore.kernel.org (Postfix) with ESMTPS id 6A834C25B0C
for ; Wed, 3 Aug 2022 09:48:23 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
s=mimecast20190719; t=1659520102;
h=from:from:sender:sender:reply-to:subject:subject:date:date:
message-id:message-id:to:to:cc:cc:mime-version:mime-version:
content-type:content-type:
content-transfer-encoding:content-transfer-encoding:
in-reply-to:in-reply-to:references:references:list-id:list-help:
list-unsubscribe:list-subscribe:list-post;
bh=P2ijAOrj3EQvRt8HEUH68Cr49EMwEqwYN1C1f0Kv7Ww=;
b=hk2uEPibDytXm+bcKvS//ZHRLINd1/dvBdvVPen9Agwma7+IZDcrVIICGWpdqftEjHIZx4
w70IgWpS2mTmf3oQuzvoEDVvDufMXaAM8wsGaaRRZuCemHrevN+uBAHqJjo24Bmapjxhj0
PCJBi0DaSeCmyojy75ucn3V5ns5efn8=
Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com
[66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS
(version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
us-mta-640-uYmNlpwjNmqdQ_WmBQ2otA-1; Wed, 03 Aug 2022 05:48:21 -0400
X-MC-Unique: uYmNlpwjNmqdQ_WmBQ2otA-1
Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com
[10.11.54.5])
(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
(No client certificate requested)
by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E7C21802D2C;
Wed, 3 Aug 2022 09:48:19 +0000 (UTC)
Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com
(unknown [10.30.29.100])
by smtp.corp.redhat.com (Postfix) with ESMTP id D309C90A04;
Wed, 3 Aug 2022 09:48:19 +0000 (UTC)
Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com
(localhost [IPv6:::1])
by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with
ESMTP id 93A9C1946A52;
Wed, 3 Aug 2022 09:48:19 +0000 (UTC)
Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com
[10.11.54.1])
by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with
ESMTP id D8A801946A5E
for ; Wed, 3 Aug 2022 09:48:18 +0000 (UTC)
Received: by smtp.corp.redhat.com (Postfix)
id BD0CA40CFD0A; Wed, 3 Aug 2022 09:48:18 +0000 (UTC)
Received: from mimecast-mx02.redhat.com
(mimecast04.extmail.prod.ext.rdu2.redhat.com [10.11.55.20])
by smtp.corp.redhat.com (Postfix) with ESMTPS id B897E40CF8F0
for ; Wed, 3 Aug 2022 09:48:18 +0000 (UTC)
Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com
[205.139.110.120])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A2BB31019C95
for ; Wed, 3 Aug 2022 09:48:18 +0000 (UTC)
Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com
[210.118.77.12]) by relay.mimecast.com with ESMTP with STARTTLS
(version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
us-mta-384-sFFFTCF6OCi1_-QhYMjoQg-1; Wed, 03 Aug 2022 05:48:16 -0400
X-MC-Unique: sFFFTCF6OCi1_-QhYMjoQg-1
Received: from eucas1p1.samsung.com (unknown [182.198.249.206])
by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id
20220803094815euoutp02b0a6c9319d58db99f05bd4f3a474bd82~HzLwRkIB32085520855euoutp02C
for ; Wed, 3 Aug 2022 09:48:15 +0000 (GMT)
DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com
20220803094815euoutp02b0a6c9319d58db99f05bd4f3a474bd82~HzLwRkIB32085520855euoutp02C
Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by
eucas1p2.samsung.com (KnoxPortal) with ESMTP id
20220803094813eucas1p298cfe017fbfdca6d5c606989f4a95a2e~HzLucPuni2470524705eucas1p2s;
Wed, 3 Aug 2022 09:48:13 +0000 (GMT)
Received: from eucas1p1.samsung.com ( [182.198.249.206]) by
eusmges3new.samsung.com (EUCPMTA) with SMTP id 37.03.09580.D544AE26; Wed, 3
Aug 2022 10:48:13 +0100 (BST)
Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by
eucas1p2.samsung.com (KnoxPortal) with ESMTPA id
20220803094813eucas1p2eab78901e97417ad52be1f8023db3d82~HzLt5TeNj2471024710eucas1p2t;
Wed, 3 Aug 2022 09:48:13 +0000 (GMT)
Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by
eusmtrp2.samsung.com (KnoxPortal) with ESMTP id
20220803094813eusmtrp236987c6f523104e1e5ca3c0b8fa8741c~HzLt4bV-v0985709857eusmtrp2v;
Wed, 3 Aug 2022 09:48:13 +0000 (GMT)
X-AuditID: cbfec7f5-9c3ff7000000256c-2a-62ea445daf58
Received: from eusmtip2.samsung.com ( [203.254.199.222]) by
eusmgms1.samsung.com (EUCPMTA) with SMTP id 93.EB.09095.D544AE26; Wed, 3
Aug 2022 10:48:13 +0100 (BST)
Received: from localhost (unknown [106.210.248.112]) by eusmtip2.samsung.com
(KnoxPortal) with ESMTPA id
20220803094812eusmtip235cf51eca89103da97520a59ca801576~HzLtdCtG01623516235eusmtip2n;
Wed, 3 Aug 2022 09:48:12 +0000 (GMT)
From: Pankaj Raghav
To: Johannes.Thumshirn@wdc.com, snitzer@kernel.org, axboe@kernel.dk,
damien.lemoal@opensource.wdc.com, agk@redhat.com, hch@lst.de
Date: Wed, 3 Aug 2022 11:47:58 +0200
Message-Id: <20220803094801.177490-11-p.raghav@samsung.com>
In-Reply-To: <20220803094801.177490-1-p.raghav@samsung.com>
MIME-Version: 1.0
X-Brightmail-Tracker:
H4sIAAAAAAAAA+NgFnrIKsWRmVeSWpSXmKPExsWy7djPc7qxLq+SDNZ161isP3WM2WL13X42
i2kffjJb/D57ntli77vZrBY3D+xkstizaBKTxcrVR5ksnqyfxWzxt+sek8XeW9oWl3fNYbOY
v+wpu8WEtq/MFp+XtrBbrLn5lMXixC1pB0GPy1e8PXbOusvucflsqcemVZ1sHpuX1HvsvtnA
5rGz9T6rx/t9V9k8+rasYvTYfLra4/MmOY/2A91MATxRXDYpqTmZZalF+nYJXBlfjvSwFFzk
qXhw6SxbA2MnVxcjJ4eEgInEjnvN7F2MXBxCAisYJRZs74FyvjBKzLjWyArhfGaUWPTxFxNM
S/u9OUwQieWMEvuOr4aqeskocadtL1sXIwcHm4CWRGMn2CgRgWZGibt/e8CKmAVmMEl0fOxj
ARklLBAhceP8O7CxLAKqEldnbgSzeQWsJf5M28YGsU5eYual7+wgNidQfMq/f8wQNYISJ2c+
AZvDDFTTvHU2M8gCCYHNnBIz+p4wQjS7SEz/9YkVwhaWeHV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AROJ
9ntzmLoYuTiEBJYySsxau5gFIiEhcXthEyOELSzx51oXG0TRc0aJhjsHWLsYOTjYBLQkGjvZ
QeIiAt2MEpfPnGMFcZgFljFJNH25zgZSJCwQJrH4exXIIBYBVYmrMzcygdi8AtYSf6ZtY4NY
IC8x89J3dhCbEyg+5d8/ZhBbSMBKYt3fWawQ9YISJ2c+ATuOGai+eets5gmMArOQpGYhSS1g
ZFrFKJJaWpybnltsqFecmFtcmpeul5yfu4kRGLPbjv3cvINx3quPeocYmTgYDzFKcDArifDe
cXmeJMSbklhZlVqUH19UmpNafIjRFOjuicxSosn5wKSRVxJvaGZgamhiZmlgamlmrCTO61nQ
kSgkkJ5YkpqdmlqQWgTTx8TBKdXA1KNx4/0D7+4L58O0d9+y5FIq9Tdf0H5/Uh3XwZyyZ2q+
F+ytfaevTj0Q/+nofN2QFdK2EbvKpKaUdWh6eQUG6va4HPqylYlv0tsAYPqaf8BY4OX5aRcd
6hKsJnM9kOdPLjwpNvvoX0HNum3KZRPF63X3TOAM2LW/vO0pe6R46PHWoMdv01jK3OJuhiUk
SAZ+yz1qpT3BbL7XwnCBw3uO3vteffT++y9Hm+t/VUqvVTz4UfyE448oNg/T6n+czMFrGCKd
2L3/HnxjlPb18IXZH/IzH/X/W8L+QO3EweW8l48EO04tvGfINKNidtCMw0qbJ8Tvvax3b+5F
u6lSJRem/mLR/C0dfnlS7JwgRlFpJZbijERDLeai4kQAvr79AmIDAAA=
X-CMS-MailID: 20220803094813eucas1p2eab78901e97417ad52be1f8023db3d82
X-Msg-Generator: CA
X-RootMTR: 20220803094813eucas1p2eab78901e97417ad52be1f8023db3d82
X-EPHeader: CA
CMS-TYPE: 201P
X-CMS-RootMailID: 20220803094813eucas1p2eab78901e97417ad52be1f8023db3d82
References: <20220803094801.177490-1-p.raghav@samsung.com>
X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection
Definition; Similar Internal Domain=false;
Similar Monitored External Domain=false; Custom External Domain=false;
Mimecast External Domain=false; Newly Observed Domain=false;
Internal User Name=false; Custom Display Name List=false;
Reply-to Address Mismatch=false; Targeted Threat Dictionary=false;
Mimecast Threat Dictionary=false; Custom Threat Dictionary=false
X-Scanned-By: MIMEDefang 2.84 on 10.11.54.1
Subject: [dm-devel] [PATCH v9 10/13] dm-table: allow zoned devices with non
power-of-2 zone sizes
X-BeenThere: dm-devel@redhat.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: device-mapper development
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Cc: Pankaj Raghav , bvanassche@acm.org,
pankydev8@gmail.com, gost.dev@samsung.com, linux-kernel@vger.kernel.org,
linux-nvme@lists.infradead.org, linux-block@vger.kernel.org,
dm-devel@redhat.com, jaegeuk@kernel.org, matias.bjorling@wdc.com
Errors-To: dm-devel-bounces@redhat.com
Sender: "dm-devel"
X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5
X-Mimecast-Spam-Score: 0
X-Mimecast-Originator: redhat.com
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)) {
From patchwork Wed Aug 3 09:47:59 2022
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Pankaj Raghav
X-Patchwork-Id: 12935327
X-Patchwork-Delegate: snitzer@redhat.com
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 us-smtp-delivery-124.mimecast.com
(us-smtp-delivery-124.mimecast.com [170.10.133.124])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by smtp.lore.kernel.org (Postfix) with ESMTPS id 1CB1DC19F28
for ; Wed, 3 Aug 2022 09:48:32 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
s=mimecast20190719; t=1659520111;
h=from:from:sender:sender:reply-to:subject:subject:date:date:
message-id:message-id:to:to:cc:cc:mime-version:mime-version:
content-type:content-type:
content-transfer-encoding:content-transfer-encoding:
in-reply-to:in-reply-to:references:references:list-id:list-help:
list-unsubscribe:list-subscribe:list-post;
bh=DLoCA5AG3DPz2ir309OYfPLSGYi6e1wOfcH4H2YQE+U=;
b=Sx/HTYvX+mtaG6p2poN7yXhr7Yoiug0XMRyc7gu2qwWlkz2ketoIRe7SIYCnWh9BHZfd2A
FiiFXKfVsNwu9Ph1/pmYCEplzTzyIPtNzdChOfUExCyOTes7WiW4Su/fC2AX8GWcZkrEVe
Mbyo7fItQ8FgYCjMS7biyiaKzubDLHc=
Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com
[66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS
(version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
us-mta-644-otl7rGYUP9Sek1RCEhB8Dw-1; Wed, 03 Aug 2022 05:48:24 -0400
X-MC-Unique: otl7rGYUP9Sek1RCEhB8Dw-1
Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com
[10.11.54.9])
(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
(No client certificate requested)
by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0FFF038217E2;
Wed, 3 Aug 2022 09:48:21 +0000 (UTC)
Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com
(unknown [10.30.29.100])
by smtp.corp.redhat.com (Postfix) with ESMTP id F355C492C3B;
Wed, 3 Aug 2022 09:48:20 +0000 (UTC)
Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com
(localhost [IPv6:::1])
by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with
ESMTP id D34DB1946A50;
Wed, 3 Aug 2022 09:48:20 +0000 (UTC)
Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com
[10.11.54.8])
by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with
ESMTP id 814471946A4E
for ; Wed, 3 Aug 2022 09:48:19 +0000 (UTC)
Received: by smtp.corp.redhat.com (Postfix)
id 6443FC15D62; Wed, 3 Aug 2022 09:48:19 +0000 (UTC)
Received: from mimecast-mx02.redhat.com
(mimecast06.extmail.prod.ext.rdu2.redhat.com [10.11.55.22])
by smtp.corp.redhat.com (Postfix) with ESMTPS id 60382C15D4F
for ; Wed, 3 Aug 2022 09:48:19 +0000 (UTC)
Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256
bits)) (No client certificate requested)
by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 46532185A79C
for ; Wed, 3 Aug 2022 09:48:19 +0000 (UTC)
Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com
[210.118.77.11]) by relay.mimecast.com with ESMTP with STARTTLS
(version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
us-mta-185-l00gfPQUNcuo3rc_cK0qKQ-1; Wed, 03 Aug 2022 05:48:17 -0400
X-MC-Unique: l00gfPQUNcuo3rc_cK0qKQ-1
Received: from eucas1p2.samsung.com (unknown [182.198.249.207])
by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id
20220803094816euoutp01c24e77ccd11bd91ddae7d4230fa938e6~HzLwrW9Lk3128231282euoutp01O
for ; Wed, 3 Aug 2022 09:48:16 +0000 (GMT)
DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com
20220803094816euoutp01c24e77ccd11bd91ddae7d4230fa938e6~HzLwrW9Lk3128231282euoutp01O
Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by
eucas1p2.samsung.com (KnoxPortal) with ESMTP id
20220803094814eucas1p26e088e4d1902813c1d06ef0dd994f407~HzLvOmBkY2470524705eucas1p2x;
Wed, 3 Aug 2022 09:48:14 +0000 (GMT)
Received: from eucas1p1.samsung.com ( [182.198.249.206]) by
eusmges1new.samsung.com (EUCPMTA) with SMTP id DB.FF.09664.E544AE26; Wed, 3
Aug 2022 10:48:14 +0100 (BST)
Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by
eucas1p2.samsung.com (KnoxPortal) with ESMTPA id
20220803094814eucas1p2789149466d095cc16710ee09a380cbdb~HzLuz7QyB1531915319eucas1p2L;
Wed, 3 Aug 2022 09:48:14 +0000 (GMT)
Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by
eusmtrp1.samsung.com (KnoxPortal) with ESMTP id
20220803094814eusmtrp1addc32d50c84a58b17d01be64653b93c~HzLuy7eRs2000320003eusmtrp1m;
Wed, 3 Aug 2022 09:48:14 +0000 (GMT)
X-AuditID: cbfec7f2-d97ff700000025c0-9f-62ea445e1e5a
Received: from eusmtip1.samsung.com ( [203.254.199.221]) by
eusmgms2.samsung.com (EUCPMTA) with SMTP id 9D.9B.09038.E544AE26; Wed, 3
Aug 2022 10:48:14 +0100 (BST)
Received: from localhost (unknown [106.210.248.112]) by eusmtip1.samsung.com
(KnoxPortal) with ESMTPA id
20220803094813eusmtip148af0e15644aab588a871f6c749a8ca7~HzLudRlMc2554125541eusmtip1o;
Wed, 3 Aug 2022 09:48:13 +0000 (GMT)
From: Pankaj Raghav
To: Johannes.Thumshirn@wdc.com, snitzer@kernel.org, axboe@kernel.dk,
damien.lemoal@opensource.wdc.com, agk@redhat.com, hch@lst.de
Date: Wed, 3 Aug 2022 11:47:59 +0200
Message-Id: <20220803094801.177490-12-p.raghav@samsung.com>
In-Reply-To: <20220803094801.177490-1-p.raghav@samsung.com>
MIME-Version: 1.0
X-Brightmail-Tracker:
H4sIAAAAAAAAA+NgFnrAKsWRmVeSWpSXmKPExsWy7djPc7pxLq+SDNY8UrdYf+oYs8Xqu/1s
FtM+/GS2+H32PLPF3nezWS1uHtjJZLFn0SQmi5WrjzJZPFk/i9nib9c9Jou9t7QtLu+aw2Yx
f9lTdosJbV+ZLT4vbWG3WHPzKYvFiVvSDoIel694e+ycdZfd4/LZUo9NqzrZPDYvqffYfbOB
zWNn631Wj/f7rrJ59G1Zxeix+XS1x+dNch7tB7qZAniiuGxSUnMyy1KL9O0SuDJWnlcteMtb
MetPL3sD41LuLkZODgkBE4mDL2cwdzFycQgJrGCU2PD1NhuE84VRYt3O4+wQzmdGida7k1lh
WtovPmGCSCxnlJi//h4LhPOSUaLx1EWgfg4ONgEticZOsG4RgWZGibt/e1hBHGaBGUwSHR/7
WEBGCQukSLy/P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Anii9GyK8ktLUhUy8otLbJWiDS2M9Awt
LfSMTCz1DI3NY62MTJX07WxSUnMyy1KL9O0S9DJWnlcteMtbMetPL3sD41LuLkZODgkBE4n2
i0+Yuhi5OIQEljJKtE0/xAaRkJC4vbCJEcIWlvhzrYsNoug5o8SdpyeAEhwcbAJaEo2d7CBx
EYFuRonLZ86xgjjMAsuYJJq+XAebJCyQJHHsykFWEJtFQFVi2o2PYFN5Bawl7k38yQyxQV5i
5qXv7CA2J1B8yr9/YHEhASuJdX9nsULUC0qcnPmEBcRmBqpv3jqbeQKjwCwkqVlIUgsYmVYx
iqSWFuem5xYb6RUn5haX5qXrJefnbmIExuy2Yz+37GBc+eqj3iFGJg7GQ4wSHMxKIrx3XJ4n
CfGmJFZWpRblxxeV5qQWH2I0Bbp7IrOUaHI+MGnklcQbmhmYGpqYWRqYWpoZK4nzehZ0JAoJ
pCeWpGanphakFsH0MXFwSjUwWViar29cW30op0pJn+/BunfmD0ykbxjc9mV8PWtm9R7e1y7T
RM8u/y/PJiXzofPjduYbXTGd6xOX6N0TWOmcNklUa+8nF7uVvhKvFWam19poiCuvipmrbfBA
IKLnypmVlzTTVhx4I5k4o2mv3Oy7b/rn289l/ndfR21lwL/iD1WyM6x6jG8c8H946/WyGW7x
BbXLyvNmGU+bdYPHeTfTj50/XkT8j9NbfHtT3DRt2dNPjpZd0Vjg9vWTxvbc6M8PtuzYJ669
RGR1g8bkufut1mRHxDJOVuz680iu6cC8FcvNLqf6+0x9GrC+c7a8vJHfRtvaPLvyf64Gsv51
GVNXuugZGKzc5ZWlud4qaQcntxJLcUaioRZzUXEiAIcg50liAwAA
X-CMS-MailID: 20220803094814eucas1p2789149466d095cc16710ee09a380cbdb
X-Msg-Generator: CA
X-RootMTR: 20220803094814eucas1p2789149466d095cc16710ee09a380cbdb
X-EPHeader: CA
CMS-TYPE: 201P
X-CMS-RootMailID: 20220803094814eucas1p2789149466d095cc16710ee09a380cbdb
References: <20220803094801.177490-1-p.raghav@samsung.com>
X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection
Definition; Similar Internal Domain=false;
Similar Monitored External Domain=false; Custom External Domain=false;
Mimecast External Domain=false; Newly Observed Domain=false;
Internal User Name=false; Custom Display Name List=false;
Reply-to Address Mismatch=false; Targeted Threat Dictionary=false;
Mimecast Threat Dictionary=false; Custom Threat Dictionary=false
X-Scanned-By: MIMEDefang 2.85 on 10.11.54.8
Subject: [dm-devel] [PATCH v9 11/13] dm: call dm_zone_endio after the target
endio callback for zoned devices
X-BeenThere: dm-devel@redhat.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: device-mapper development
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Cc: Pankaj Raghav , bvanassche@acm.org,
pankydev8@gmail.com, gost.dev@samsung.com, linux-kernel@vger.kernel.org,
linux-nvme@lists.infradead.org, linux-block@vger.kernel.org,
dm-devel@redhat.com, jaegeuk@kernel.org, matias.bjorling@wdc.com
Errors-To: dm-devel-bounces@redhat.com
Sender: "dm-devel"
X-Scanned-By: MIMEDefang 2.85 on 10.11.54.9
X-Mimecast-Spam-Score: 0
X-Mimecast-Originator: redhat.com
dm_zone_endio() updates the bi_sector of orig bio for zoned devices that
uses either native append or append emulation, and it is called before the
endio of the target. But target endio can still update the clone bio
after dm_zone_endio is called, thereby, the orig bio does not contain
the updated information anymore.
Currently, this is not a problem as the targets that support zoned devices
such as dm-zoned, dm-linear, and dm-crypt do not have an endio function,
and even if they do (such as dm-flakey), they don't modify the
bio->bi_iter.bi_sector of the cloned bio that is used to update the
orig_bio's bi_sector in dm_zone_endio function.
This is a prep patch for the new dm-po2zone target as it modifies
bi_sector in the endio callback.
Call dm_zone_endio for zoned devices after calling the target's endio
function.
Signed-off-by: Pankaj Raghav
---
drivers/md/dm.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index 60549b65c799..58b392c51d04 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -1122,10 +1122,6 @@ static void clone_endio(struct bio *bio)
disable_write_zeroes(md);
}
- if (static_branch_unlikely(&zoned_enabled) &&
- unlikely(bdev_is_zoned(bio->bi_bdev)))
- dm_zone_endio(io, bio);
-
if (endio) {
int r = endio(ti, bio, &error);
switch (r) {
@@ -1154,6 +1150,10 @@ static void clone_endio(struct bio *bio)
}
}
+ if (static_branch_unlikely(&zoned_enabled) &&
+ unlikely(bdev_is_zoned(bio->bi_bdev)))
+ dm_zone_endio(io, bio);
+
if (static_branch_unlikely(&swap_bios_enabled) &&
unlikely(swap_bios_limit(ti, bio)))
up(&md->swap_bios_semaphore);
From patchwork Wed Aug 3 09:48:00 2022
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Pankaj Raghav
X-Patchwork-Id: 12935326
X-Patchwork-Delegate: snitzer@redhat.com
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 us-smtp-delivery-124.mimecast.com
(us-smtp-delivery-124.mimecast.com [170.10.129.124])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by smtp.lore.kernel.org (Postfix) with ESMTPS id B1B52C19F2C
for ; Wed, 3 Aug 2022 09:48:29 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
s=mimecast20190719; t=1659520108;
h=from:from:sender:sender:reply-to:subject:subject:date:date:
message-id:message-id:to:to:cc:cc:mime-version:mime-version:
content-type:content-type:
content-transfer-encoding:content-transfer-encoding:
in-reply-to:in-reply-to:references:references:list-id:list-help:
list-unsubscribe:list-subscribe:list-post;
bh=D5x6FXx63zvTQK5nRI/vVTHN9IaGSKBi/uK99dLT41E=;
b=UzotE7fBxCvIzLDD7UtJAt3ijQwykRdFCqNCR5jXeSMkb9r7hCetGXr/7ngHKWOL2Z+pnY
uiwVYI/wckSFpoqQQ3ZDepwtW2HVGLN2i82FqT1Ive0IDWUTqB+VGvTlkZpYhngxpc/p+A
gIqtUKEkDoXLDzL4T4Xk8QK5rIIPJwo=
Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com
[66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS
(version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
us-mta-659-cfaLyIVpN5qkvZYiitsu2Q-1; Wed, 03 Aug 2022 05:48:24 -0400
X-MC-Unique: cfaLyIVpN5qkvZYiitsu2Q-1
Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com
[10.11.54.2])
(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
(No client certificate requested)
by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 291AA8037AE;
Wed, 3 Aug 2022 09:48:22 +0000 (UTC)
Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com
(unknown [10.30.29.100])
by smtp.corp.redhat.com (Postfix) with ESMTP id 180CF40D282F;
Wed, 3 Aug 2022 09:48:22 +0000 (UTC)
Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com
(localhost [IPv6:::1])
by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with
ESMTP id DEC921946A52;
Wed, 3 Aug 2022 09:48:21 +0000 (UTC)
Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com
[10.11.54.5])
by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with
ESMTP id 52A631946A4E
for ; Wed, 3 Aug 2022 09:48:20 +0000 (UTC)
Received: by smtp.corp.redhat.com (Postfix)
id 4531718EAA; Wed, 3 Aug 2022 09:48:20 +0000 (UTC)
Received: from mimecast-mx02.redhat.com
(mimecast07.extmail.prod.ext.rdu2.redhat.com [10.11.55.23])
by smtp.corp.redhat.com (Postfix) with ESMTPS id 4081A90A00
for