From patchwork Wed Jun 15 10:19:08 2022
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Pankaj Raghav
X-Patchwork-Id: 12882056
Return-Path:
X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on
aws-us-west-2-korg-lkml-1.web.codeaurora.org
Received: from vger.kernel.org (vger.kernel.org [23.128.96.18])
by smtp.lore.kernel.org (Postfix) with ESMTP id 38433C433EF
for ; Wed, 15 Jun 2022 10:19:44 +0000 (UTC)
Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand
id S1347000AbiFOKTl (ORCPT );
Wed, 15 Jun 2022 06:19:41 -0400
Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37124 "EHLO
lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org
with ESMTP id S242859AbiFOKTg (ORCPT
);
Wed, 15 Jun 2022 06:19:36 -0400
Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com
[210.118.77.12])
by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6D9A33DDCF
for ;
Wed, 15 Jun 2022 03:19:31 -0700 (PDT)
Received: from eucas1p1.samsung.com (unknown [182.198.249.206])
by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id
20220615101930euoutp021cf97da13637a36d150d52b3f8439f6e~4xACsnrls2552225522euoutp02g
for ;
Wed, 15 Jun 2022 10:19:30 +0000 (GMT)
DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com
20220615101930euoutp021cf97da13637a36d150d52b3f8439f6e~4xACsnrls2552225522euoutp02g
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com;
s=mail20170921; t=1655288370;
bh=Owj5SwDy5cIi235KyiliqrWe09HaL8B16ylUw06/YSQ=;
h=From:To:Cc:Subject:Date:In-Reply-To:References:From;
b=jtXOC52fvw37hNrubcz1a6F9mtfmezXeGipERA4vXY/EXRwA/1rXreHjJotmcopow
by1Zu7fyx04YH79lQrGQhoYIs6H3q2EM2rMCgriWfKn+HIj+V84Beq/tBfhs/s+2Kd
GQZgt1idh7YvWW/pKCMwu8u+jYgai/Poag5CBTYU=
Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by
eucas1p1.samsung.com (KnoxPortal) with ESMTP id
20220615101928eucas1p1b977b0e4c5103c43695d0073172d222d~4xAA3t8X30963309633eucas1p1n;
Wed, 15 Jun 2022 10:19:28 +0000 (GMT)
Received: from eucas1p2.samsung.com ( [182.198.249.207]) by
eusmges1new.samsung.com (EUCPMTA) with SMTP id D5.2B.09664.032B9A26;
Wed, 15
Jun 2022 11:19:28 +0100 (BST)
Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by
eucas1p1.samsung.com (KnoxPortal) with ESMTPA id
20220615101927eucas1p17220c7a36f69f59ff8ddd560b42967ec~4xAAaJBok2789027890eucas1p1_;
Wed, 15 Jun 2022 10:19:27 +0000 (GMT)
Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by
eusmtrp2.samsung.com (KnoxPortal) with ESMTP id
20220615101927eusmtrp21290cb4f6f1f11203710eaa6a045886f~4xAAZHNrb0349503495eusmtrp2H;
Wed, 15 Jun 2022 10:19:27 +0000 (GMT)
X-AuditID: cbfec7f2-d81ff700000025c0-b9-62a9b2307870
Received: from eusmtip2.samsung.com ( [203.254.199.222]) by
eusmgms1.samsung.com (EUCPMTA) with SMTP id 15.45.09095.F22B9A26;
Wed, 15
Jun 2022 11:19:27 +0100 (BST)
Received: from localhost (unknown [106.210.248.244]) by eusmtip2.samsung.com
(KnoxPortal) with ESMTPA id
20220615101926eusmtip2a4d1534f6d9fb211105b6da848dd27ef~4w--OR_FM0785907859eusmtip2F;
Wed, 15 Jun 2022 10:19:26 +0000 (GMT)
From: Pankaj Raghav
To: hch@lst.de, snitzer@redhat.com, damien.lemoal@opensource.wdc.com,
axboe@kernel.dk
Cc: bvanassche@acm.org, linux-kernel@vger.kernel.org,
jiangbo.365@bytedance.com, hare@suse.de, pankydev8@gmail.com,
dm-devel@redhat.com, jonathan.derrick@linux.dev,
gost.dev@samsung.com, dsterba@suse.com, jaegeuk@kernel.org,
linux-nvme@lists.infradead.org, Johannes.Thumshirn@wdc.com,
linux-block@vger.kernel.org, Pankaj Raghav ,
Luis Chamberlain
Subject: [PATCH v7 01/13] block: make blkdev_nr_zones and blk_queue_zone_no
generic for npo2 zsze
Date: Wed, 15 Jun 2022 12:19:08 +0200
Message-Id: <20220615101920.329421-2-p.raghav@samsung.com>
X-Mailer: git-send-email 2.25.1
In-Reply-To: <20220615101920.329421-1-p.raghav@samsung.com>
MIME-Version: 1.0
X-Brightmail-Tracker:
H4sIAAAAAAAAA+NgFvrJKsWRmVeSWpSXmKPExsWy7djP87oGm1YmGSz5wWOx+m4/m8W0Dz+Z
LX6fPc9ssffdbFaLCz8amSxuHtjJZLFn0SQmi5WrjzJZPFk/i9mi58AHFou/XfeAYi0PgYpv
aVtc3jWHzWL+sqfsFjcmPGW0+Ly0hd1izc2nLBZtG78yOgh7XL7i7fHvxBo2j52z7rJ7XD5b
6rFpVSebx8KGqcwem5fUe+y+2QCUa73P6vF+31U2j74tqxg91m+5yuKx+XS1x+dNch7tB7qZ
AvijuGxSUnMyy1KL9O0SuDKWn2tiLmgTqfh/dAtzA+NVgS5GTg4JAROJrUvXs3cxcnEICaxg
lFi3/xmU84VR4v+rk4wQzmdGiSOdn5lgWtbsPQ+VWM4oMWtGPwuE85JRYs7hv8xdjBwcbAJa
Eo2d7CANIgLhEkf33ANrZhboY5Z48rIOxBYWSJZY8nopK4jNIqAqsfvobhYQm1fASqJ30Reo
ZfISMy99B5vDKWAtsWN2DytEjaDEyZlPWCBmyks0b53NDHKDhMAlTom+2fdZIJpdJI6+3ssI
YQtLvDq+hR3ClpH4v3M+1IJqiac3fkM1tzBK9O9czwbygATQtr4zOSAms4CmxPpd+hDljhJX
7n9hhqjgk7jxVhDiBD6JSdumQ4V5JTrahCCqlSR2/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TnaQGhGBaInOm+/BapgFFjBLnL4zASwhLJAoMXVXP9gg
FgFVid1Hd7OA2LwCVhK9i74wQSyQl5h56TtYPaeAtcSO2T2sIPOFgGp2vYuHKBeUODnzCVgr
M1B589bZzBMYBWYhSc1CklrAyLSKUSS1tDg3PbfYUK84Mbe4NC9dLzk/dxMjMMq3Hfu5eQfj
vFcf9Q4xMnEwHmKU4GBWEuE1C16ZJMSbklhZlVqUH19UmpNafIjRFOjsicxSosn5wDSTVxJv
aGZgamhiZmlgamlmrCTO61nQkSgkkJ5YkpqdmlqQWgTTx8TBKdXAFBNS5ufWOfVzzaOzt+ew
bLi6Lfn2PpWmCcdKJHJYXa62XH21J4lDoXnF2huz1rCenv3htnuK2rXVT3vvigWUzfG17f5x
bt/Ue8tMzO4/P5UxXyRxb9sqtWivu3qFO9sjrux+mmP/tfm9mLL+pccXl+87sWTP+dTUifuX
za7iYdv1pKTpgM2+Go6r5/8GGAXyF4QzhfMYnuuwmTjZ8d+ZjML793JO+DVJfVDaEHfVgflz
QOSDM6acTBO1nu/0PDnRl/v71itK92+dqj0dtlNgilJlhtJjG8NMZR+xZwtF38i96p+68d1k
xyWbHCYwq9YLr50Sr+z6UHvGleqqK9vXzjv7L+GJLHdg5bvbwgtfzWlXYinOSDTUYi4qTgQA
q9mqDXsDAAA=
X-CMS-MailID: 20220615101927eucas1p17220c7a36f69f59ff8ddd560b42967ec
X-Msg-Generator: CA
X-RootMTR: 20220615101927eucas1p17220c7a36f69f59ff8ddd560b42967ec
X-EPHeader: CA
CMS-TYPE: 201P
X-CMS-RootMailID: 20220615101927eucas1p17220c7a36f69f59ff8ddd560b42967ec
References: <20220615101920.329421-1-p.raghav@samsung.com>
Precedence: bulk
List-ID:
X-Mailing-List: linux-block@vger.kernel.org
Adapt blkdev_nr_zones and blk_queue_zone_no function so that it can
also work for non-power-of-2 zone sizes.
As the existing deployments of zoned devices had power-of-2
assumption, power-of-2 optimized calculation is kept 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 | 12 +++++++++---
include/linux/blkdev.h | 8 +++++++-
2 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/block/blk-zoned.c b/block/blk-zoned.c
index 38cd840d8..8b0615287 100644
--- a/block/blk-zoned.c
+++ b/block/blk-zoned.c
@@ -111,16 +111,22 @@ EXPORT_SYMBOL_GPL(__blk_req_zone_write_unlock);
* blkdev_nr_zones - Get number of zones
* @disk: Target gendisk
*
- * 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 blkdev_nr_zones(struct gendisk *disk)
{
sector_t zone_sectors = blk_queue_zone_sectors(disk->queue);
+ sector_t capacity = get_capacity(disk);
if (!blk_queue_is_zoned(disk->queue))
return 0;
- return (get_capacity(disk) + 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(blkdev_nr_zones);
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 914c613d8..39017ae9d 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -681,9 +681,15 @@ static inline unsigned int blk_queue_nr_zones(struct request_queue *q)
static inline unsigned int blk_queue_zone_no(struct request_queue *q,
sector_t sector)
{
+ sector_t zone_sectors = blk_queue_zone_sectors(q);
+
if (!blk_queue_is_zoned(q))
return 0;
- return sector >> ilog2(q->limits.chunk_sectors);
+
+ if (is_power_of_2(zone_sectors))
+ return sector >> ilog2(zone_sectors);
+
+ return div64_u64(sector, zone_sectors);
}
static inline bool blk_queue_zone_is_seq(struct request_queue *q,
From patchwork Wed Jun 15 10:19:09 2022
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Pankaj Raghav
X-Patchwork-Id: 12882057
Return-Path:
X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on
aws-us-west-2-korg-lkml-1.web.codeaurora.org
Received: from vger.kernel.org (vger.kernel.org [23.128.96.18])
by smtp.lore.kernel.org (Postfix) with ESMTP id 6EC0CCCA47F
for ; Wed, 15 Jun 2022 10:19:46 +0000 (UTC)
Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand
id S237034AbiFOKTp (ORCPT );
Wed, 15 Jun 2022 06:19:45 -0400
Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37258 "EHLO
lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org
with ESMTP id S1346907AbiFOKTl (ORCPT
);
Wed, 15 Jun 2022 06:19:41 -0400
Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com
[210.118.77.11])
by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3F9C145067
for ;
Wed, 15 Jun 2022 03:19:35 -0700 (PDT)
Received: from eucas1p1.samsung.com (unknown [182.198.249.206])
by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id
20220615101934euoutp016dbe64a7d16b37419ff295910f054e0e~4xAGRFwmI2579825798euoutp01F
for ;
Wed, 15 Jun 2022 10:19:34 +0000 (GMT)
DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com
20220615101934euoutp016dbe64a7d16b37419ff295910f054e0e~4xAGRFwmI2579825798euoutp01F
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com;
s=mail20170921; t=1655288374;
bh=IrOIYIqVIk7B/3DWPQ10ndq9aeC4LKt1LaG03ECSoHw=;
h=From:To:Cc:Subject:Date:In-Reply-To:References:From;
b=D018ArsWozm5Ya11eT/4je5sygr8VMMcEceNOHX32Miu3hg5sgzr+G+nN06p1ZIMO
OCfo/B4zKtCL3p676aYxTHyzFjJJR7wgrHlPB39w+EBnQib9RE9rTuRG6h07RHgYeg
9nmMmZUnFaz2SJXHuQ2vb/9md6oE4wZ7zeSO74Q0=
Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by
eucas1p2.samsung.com (KnoxPortal) with ESMTP id
20220615101932eucas1p2660b95125dabbb1744287f9d299c6460~4xAEayiPp0710307103eucas1p24;
Wed, 15 Jun 2022 10:19:32 +0000 (GMT)
Received: from eucas1p2.samsung.com ( [182.198.249.207]) by
eusmges1new.samsung.com (EUCPMTA) with SMTP id 1D.2B.09664.332B9A26;
Wed, 15
Jun 2022 11:19:32 +0100 (BST)
Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by
eucas1p1.samsung.com (KnoxPortal) with ESMTPA id
20220615101931eucas1p15ed09ae433a2c378b599e9086130d8eb~4xAD9YEc10100501005eucas1p1N;
Wed, 15 Jun 2022 10:19:31 +0000 (GMT)
Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by
eusmtrp2.samsung.com (KnoxPortal) with ESMTP id
20220615101931eusmtrp2b70e8cbdfb93fd8f578e936104ade6c6~4xAD8lqBD0308003080eusmtrp2f;
Wed, 15 Jun 2022 10:19:31 +0000 (GMT)
X-AuditID: cbfec7f2-d97ff700000025c0-cd-62a9b233f413
Received: from eusmtip2.samsung.com ( [203.254.199.222]) by
eusmgms1.samsung.com (EUCPMTA) with SMTP id 5B.45.09095.332B9A26;
Wed, 15
Jun 2022 11:19:31 +0100 (BST)
Received: from localhost (unknown [106.210.248.244]) by eusmtip2.samsung.com
(KnoxPortal) with ESMTPA id
20220615101930eusmtip20501ba33701d46b01bdb1087349cb48e~4xAC0W5x_0785907859eusmtip2G;
Wed, 15 Jun 2022 10:19:30 +0000 (GMT)
From: Pankaj Raghav
To: hch@lst.de, snitzer@redhat.com, damien.lemoal@opensource.wdc.com,
axboe@kernel.dk
Cc: bvanassche@acm.org, linux-kernel@vger.kernel.org,
jiangbo.365@bytedance.com, hare@suse.de, pankydev8@gmail.com,
dm-devel@redhat.com, jonathan.derrick@linux.dev,
gost.dev@samsung.com, dsterba@suse.com, jaegeuk@kernel.org,
linux-nvme@lists.infradead.org, Johannes.Thumshirn@wdc.com,
linux-block@vger.kernel.org, Pankaj Raghav ,
Luis Chamberlain
Subject: [PATCH v7 02/13] block: allow blk-zoned devices to have
non-power-of-2 zone size
Date: Wed, 15 Jun 2022 12:19:09 +0200
Message-Id: <20220615101920.329421-3-p.raghav@samsung.com>
X-Mailer: git-send-email 2.25.1
In-Reply-To: <20220615101920.329421-1-p.raghav@samsung.com>
MIME-Version: 1.0
X-Brightmail-Tracker:
H4sIAAAAAAAAA+NgFvrOKsWRmVeSWpSXmKPExsWy7djP87omm1YmGZxdxmix+m4/m8W0Dz+Z
LX6fPc9ssffdbFaLCz8amSxuHtjJZLFn0SQmi5WrjzJZPFk/i9mi58AHFou/XfeAYi0PgYpv
aVtc3jWHzWL+sqfsFjcmPGW0+Ly0hd1izc2nLBZtG78yOgh7XL7i7fHvxBo2j52z7rJ7XD5b
6rFpVSebx8KGqcwem5fUe+y+2QCUa73P6vF+31U2j74tqxg91m+5yuKx+XS1x+dNch7tB7qZ
AvijuGxSUnMyy1KL9O0SuDJm3HnPVPBMvWLehqOMDYxLFboYOTkkBEwk7l36zNzFyMUhJLCC
UWLJ/6WMEM4XRolll1azQjifGSUWfOpgh2npanzHDpFYzihxfk8HlPOSUWLfzV9ALRwcbAJa
Eo2dYA0iAuESR/fcYwKxmQX6mCWevKwDKREWiJZ411AIYrIIqEo8euwMUsErYCUx78dqRohV
8hIzL30Hm8IpYC2xY3YPK0SNoMTJmU9YICbKSzRvnQ32gYTAOU6Jp89fs0A0u0i86b4LdbOw
xKvjW6BsGYn/O+czQdjVEk9v/IZqbmGU6N+5ng3kIAmgbX1nckBMZgFNifW79CHKHSWeXOiE
quCTuPFWEOIEPolJ26YzQ4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jYBLQkGjvZQWpEBKIlOm++B6thFljALHH6zgSwhLBApETPtaXs
IPUsAqoSjx47g4R5Bawk5v1YDTVfXmLmpe9g5ZwC1hI7ZvewgpQLAdXsehcPUS4ocXLmExYQ
mxmovHnrbOYJjAKzkKRmIUktYGRaxSiSWlqcm55bbKhXnJhbXJqXrpecn7uJERjj24793LyD
cd6rj3qHGJk4GA8xSnAwK4nwmgWvTBLiTUmsrEotyo8vKs1JLT7EaAp09URmKdHkfGCSySuJ
NzQzMDU0MbM0MLU0M1YS5/Us6EgUEkhPLEnNTk0tSC2C6WPi4JRqYIrTuLHU7OzP6zauH8+Y
r7918HKB56r3L9gnaX2W4w+Yu8OW49feqsgNs7yvKn1XbQ6d7OIVsWODU9MczlzbuM7EsCtm
TxewH3XM9XlaumzxbeEt+1fXVvdP6hBa7l1x5LrqOVsBv0/2T+tS+JuMbus/Dqw1L9X/kZqV
tOZk3vV9in+0DCxz+pNull5iq/sh/9+IS7h9k/PpW4mLdjuYLf5/49uPXjZFxXcWCSeCy3fK
v0zYwrWka3mQr9HLEoXll07d/vVVw/61bKl4A9fPhwkxmvNkZzs+b5VTkjTp46qLON075V26
3d3vD1bNsrMNeirsfnGm5Cp9/xSGOa8Kc2ZcCFC/v7uklOHe6u0nXZVYijMSDbWYi4oTAXP6
75x6AwAA
X-CMS-MailID: 20220615101931eucas1p15ed09ae433a2c378b599e9086130d8eb
X-Msg-Generator: CA
X-RootMTR: 20220615101931eucas1p15ed09ae433a2c378b599e9086130d8eb
X-EPHeader: CA
CMS-TYPE: 201P
X-CMS-RootMailID: 20220615101931eucas1p15ed09ae433a2c378b599e9086130d8eb
References: <20220615101920.329421-1-p.raghav@samsung.com>
Precedence: bulk
List-ID:
X-Mailing-List: linux-block@vger.kernel.org
Checking if a given sector is aligned to a zone is a common
operation that is performed for zoned devices. Add
blk_queue_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 based logic in the block layer using the helpers wherever
possible.
The only hot path affected by this change for power_of_2 zoned devices
is in blk_check_zone_append() but blk_queue_is_zone_start() helper is
used to optimize the calculation for po2 zone sizes. Note that the append
path cannot be accessed by direct raw access to the block device but only
through a filesystem abstraction.
Finally, allow non power of 2 zoned devices provided that their zone
capacity and zone size are equal. The main motivation to allow non
power_of_2 zoned device is to remove the unmapped LBA between zcap and
zsze for devices that cannot have a power_of_2 zcap.
Reviewed-by: Luis Chamberlain
Reviewed-by: Hannes Reinecke
Signed-off-by: Pankaj Raghav
---
block/blk-core.c | 3 +--
block/blk-zoned.c | 25 +++++++++++++++++++------
include/linux/blkdev.h | 33 +++++++++++++++++++++++++++++++++
3 files changed, 53 insertions(+), 8 deletions(-)
diff --git a/block/blk-core.c b/block/blk-core.c
index 06ff5bbfe..248b947e5 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -629,8 +629,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 (pos & (blk_queue_zone_sectors(q) - 1) ||
- !blk_queue_zone_is_seq(q, pos))
+ if (!blk_queue_is_zone_start(q, pos) || !blk_queue_zone_is_seq(q, pos))
return BLK_STS_IOERR;
/*
diff --git a/block/blk-zoned.c b/block/blk-zoned.c
index 8b0615287..7957eec04 100644
--- a/block/blk-zoned.c
+++ b/block/blk-zoned.c
@@ -288,10 +288,10 @@ int blkdev_zone_mgmt(struct block_device *bdev, enum req_opf op,
return -EINVAL;
/* Check alignment (handle eventual smaller last zone) */
- if (sector & (zone_sectors - 1))
+ if (!blk_queue_is_zone_start(q, sector))
return -EINVAL;
- if ((nr_sectors & (zone_sectors - 1)) && end_sector != capacity)
+ if (!blk_queue_is_zone_start(q, nr_sectors) && end_sector != capacity)
return -EINVAL;
/*
@@ -489,14 +489,27 @@ 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 zone size", disk->disk_name);
+ return -ENODEV;
+ }
+
+ /*
+ * Don't allow zoned device with non power_of_2 zone size with
+ * zone capacity less than zone size.
+ */
+ if (!is_power_of_2(zone->len) && zone->capacity < zone->len) {
+ pr_warn("%s: Invalid zone capacity for non power of 2 zone size",
+ disk->disk_name);
return -ENODEV;
}
args->zone_sectors = zone->len;
- args->nr_zones = (capacity + zone->len - 1) >> ilog2(zone->len);
+ /*
+ * Division is used to calculate nr_zones for both power_of_2
+ * and non power_of_2 zone sizes as it is not in the hot path.
+ */
+ 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 39017ae9d..3c106dba1 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -692,6 +692,27 @@ static inline unsigned int blk_queue_zone_no(struct request_queue *q,
return div64_u64(sector, zone_sectors);
}
+static inline sector_t blk_queue_offset_from_zone_start(struct request_queue *q,
+ sector_t sec)
+{
+ sector_t zone_sectors = blk_queue_zone_sectors(q);
+ u64 remainder = 0;
+
+ if (!blk_queue_is_zoned(q))
+ return false;
+
+ if (is_power_of_2(zone_sectors))
+ return sec & (zone_sectors - 1);
+
+ div64_u64_rem(sec, zone_sectors, &remainder);
+ return remainder;
+}
+
+static inline bool blk_queue_is_zone_start(struct request_queue *q, sector_t sec)
+{
+ return blk_queue_offset_from_zone_start(q, sec) == 0;
+}
+
static inline bool blk_queue_zone_is_seq(struct request_queue *q,
sector_t sector)
{
@@ -738,6 +759,18 @@ static inline unsigned int blk_queue_zone_no(struct request_queue *q,
{
return 0;
}
+
+static inline sector_t blk_queue_offset_from_zone_start(struct request_queue *q,
+ sector_t sec)
+{
+ return 0;
+}
+
+static inline bool blk_queue_is_zone_start(struct request_queue *q, sector_t sec)
+{
+ return false;
+}
+
static inline unsigned int queue_max_open_zones(const struct request_queue *q)
{
return 0;
From patchwork Wed Jun 15 10:19:10 2022
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Pankaj Raghav
X-Patchwork-Id: 12882058
Return-Path:
X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on
aws-us-west-2-korg-lkml-1.web.codeaurora.org
Received: from vger.kernel.org (vger.kernel.org [23.128.96.18])
by smtp.lore.kernel.org (Postfix) with ESMTP id 8E8C5CCA473
for ; Wed, 15 Jun 2022 10:19:47 +0000 (UTC)
Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand
id S1346825AbiFOKTq (ORCPT );
Wed, 15 Jun 2022 06:19:46 -0400
Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37266 "EHLO
lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org
with ESMTP id S1347170AbiFOKTl (ORCPT
);
Wed, 15 Jun 2022 06:19:41 -0400
Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com
[210.118.77.12])
by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E2FC94B1FD
for ;
Wed, 15 Jun 2022 03:19:38 -0700 (PDT)
Received: from eucas1p1.samsung.com (unknown [182.198.249.206])
by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id
20220615101937euoutp02e617a3cc6c1499a775aa48cafb7c85c6~4xAJtQth52915729157euoutp02H
for ;
Wed, 15 Jun 2022 10:19:37 +0000 (GMT)
DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com
20220615101937euoutp02e617a3cc6c1499a775aa48cafb7c85c6~4xAJtQth52915729157euoutp02H
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com;
s=mail20170921; t=1655288377;
bh=n7XaZhjVWbFZ2/k/mWYQcCuMTNuq4erdEz+rKfQHKk8=;
h=From:To:Cc:Subject:Date:In-Reply-To:References:From;
b=mwyHqnqlJPQf1nvO27U1gKfsCWpKtuHmx0xz0C97JM3SN5IqTo7KS8ad55jj3Ooyn
3uM7opMrgnvkznX2Q0vkiRYP7BNcAaa6aRHQ/GxMXpsgjap4Vg5TtefdtdFDBDR2su
ZkL0e6CLygkBZDEq2FklkdAgLcMSavOV43o67iqY=
Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by
eucas1p2.samsung.com (KnoxPortal) with ESMTP id
20220615101935eucas1p28855fe6444bf0d736a79f31c7e260f2e~4xAH-GRyc1132211322eucas1p2x;
Wed, 15 Jun 2022 10:19:35 +0000 (GMT)
Received: from eucas1p1.samsung.com ( [182.198.249.206]) by
eusmges2new.samsung.com (EUCPMTA) with SMTP id 28.67.10067.732B9A26;
Wed, 15
Jun 2022 11:19:35 +0100 (BST)
Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by
eucas1p2.samsung.com (KnoxPortal) with ESMTPA id
20220615101935eucas1p26a7bc245d88a89312158d7a265f64aef~4xAHQro9O1132211322eucas1p2w;
Wed, 15 Jun 2022 10:19:35 +0000 (GMT)
Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by
eusmtrp2.samsung.com (KnoxPortal) with ESMTP id
20220615101935eusmtrp25b8235c373fbcc302cd299295374e82b~4xAHPZ7Ei0361403614eusmtrp2B;
Wed, 15 Jun 2022 10:19:34 +0000 (GMT)
X-AuditID: cbfec7f4-dc1ff70000002753-6a-62a9b23727ab
Received: from eusmtip1.samsung.com ( [203.254.199.221]) by
eusmgms2.samsung.com (EUCPMTA) with SMTP id 0B.14.09038.632B9A26;
Wed, 15
Jun 2022 11:19:34 +0100 (BST)
Received: from localhost (unknown [106.210.248.244]) by eusmtip1.samsung.com
(KnoxPortal) with ESMTPA id
20220615101934eusmtip1d8b298e6c644ba681b491ec040203480~4xAGNVgnE1144211442eusmtip1H;
Wed, 15 Jun 2022 10:19:34 +0000 (GMT)
From: Pankaj Raghav
To: hch@lst.de, snitzer@redhat.com, damien.lemoal@opensource.wdc.com,
axboe@kernel.dk
Cc: bvanassche@acm.org, linux-kernel@vger.kernel.org,
jiangbo.365@bytedance.com, hare@suse.de, pankydev8@gmail.com,
dm-devel@redhat.com, jonathan.derrick@linux.dev,
gost.dev@samsung.com, dsterba@suse.com, jaegeuk@kernel.org,
linux-nvme@lists.infradead.org, Johannes.Thumshirn@wdc.com,
linux-block@vger.kernel.org, Pankaj Raghav ,
Luis Chamberlain
Subject: [PATCH v7 03/13] nvme: zns: Allow ZNS drives that have
non-power_of_2 zone size
Date: Wed, 15 Jun 2022 12:19:10 +0200
Message-Id: <20220615101920.329421-4-p.raghav@samsung.com>
X-Mailer: git-send-email 2.25.1
In-Reply-To: <20220615101920.329421-1-p.raghav@samsung.com>
MIME-Version: 1.0
X-Brightmail-Tracker:
H4sIAAAAAAAAA+NgFvrGKsWRmVeSWpSXmKPExsWy7djPc7rmm1YmGcztNLJYfbefzWLah5/M
Fr/Pnme22PtuNqvFhR+NTBY3D+xkstizaBKTxcrVR5ksnqyfxWzRc+ADi8XfrntAsZaHQMW3
tC0u75rDZjF/2VN2ixsTnjJafF7awm6x5uZTFou2jV8ZHYQ9Ll/x9vh3Yg2bx85Zd9k9Lp8t
9di0qpPNY2HDVGaPzUvqPXbfbADKtd5n9Xi/7yqbR9+WVYwe67dcZfHYfLra4/MmOY/2A91M
AfxRXDYpqTmZZalF+nYJXBlzNm5jLfgtWvH4oFQDY4dQFyMnh4SAicSNe6uZuxi5OIQEVjBK
XNy2iw3C+cIocWzCB3aQKiGBz4wST755wXScPvSGHaJoOaPErWdbWSGKXjJKzG4I7GLk4GAT
0JJo7ATrFREIlzi65x4TiM0s0Mcs8eRlHYgtLBAl8eP9eTYQm0VAVeLpsXdgY3gFrCQmvVzF
CLFLXmLmpe9gczgFrCV2zO6BqhGUODnzCQvETHmJ5q2zwT6QELjEKfHo53cmiG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
bNzGWvBbtOLxQakGxg6hLkZODgkBE4nTh96wdzFycQgJLGWU2Pf9HxtEQkLi9sImRghbWOLP
tS42iKLnjBI/Dh1j6mLk4GAT0JJo7GQHqRERiJbovPkerIZZYAGzxOk7E9hBaoQFIiT+PjIB
qWERUJV4euwdK4jNK2AlMenlKqj58hIzL30Hm8MpYC2xY3YPK0irEFDNrnfxEOWCEidnPmEB
sZmBypu3zmaewCgwC0lqFpLUAkamVYwiqaXFuem5xUZ6xYm5xaV56XrJ+bmbGIERvu3Yzy07
GFe++qh3iJGJg/EQowQHs5IIr1nwyiQh3pTEyqrUovz4otKc1OJDjKZAZ09klhJNzgemmLyS
eEMzA1NDEzNLA1NLM2MlcV7Pgo5EIYH0xJLU7NTUgtQimD4mDk6pBqaWk6Y35X1bNPc/efzh
l/Khc1Exm9fl3A19E+h2f9P2jugu8SO/7820OX76z/6HbtvVrS+dT6xet2FD96yNQXltRz8z
1N6WMXyn+kLaYHtbX0nW4dfaNn432o5aLihoX7ex7PdtuTU/v79fVRmSWRwbZjODq79HheXW
ApbmxQbdUpNjXJfJsa65wxsYuWlOXLNKf+qu9b/zirJU/0mlqgdHb/a43GX+Oezr1Fv515lE
H07bxueqvjHb+fQ/gwdunYEm4eJslzm3cpjfUzJb9+Ji4CePq0JzVt/xWrNGe24X4yxTGZ/o
fYJ70+ND13tEBJxmuCEVVOfQx+S1btWS/qXpb2V2BJkkXs9MuhlU6K7EUpyRaKjFXFScCACL
+j2SeQMAAA==
X-CMS-MailID: 20220615101935eucas1p26a7bc245d88a89312158d7a265f64aef
X-Msg-Generator: CA
X-RootMTR: 20220615101935eucas1p26a7bc245d88a89312158d7a265f64aef
X-EPHeader: CA
CMS-TYPE: 201P
X-CMS-RootMailID: 20220615101935eucas1p26a7bc245d88a89312158d7a265f64aef
References: <20220615101920.329421-1-p.raghav@samsung.com>
Precedence: bulk
List-ID:
X-Mailing-List: linux-block@vger.kernel.org
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 | 21 ++++++++++++---------
1 file changed, 12 insertions(+), 9 deletions(-)
diff --git a/drivers/nvme/host/zns.c b/drivers/nvme/host/zns.c
index 9f81beb4d..d92f937d5 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;
- }
blk_queue_set_zoned(ns->disk, BLK_ZONED_HM);
blk_queue_flag_set(QUEUE_FLAG_ZONE_RESETALL, q);
@@ -128,8 +121,13 @@ static void *nvme_zns_alloc_report_buffer(struct nvme_ns *ns,
const size_t min_bufsize = sizeof(struct nvme_zone_report) +
sizeof(struct nvme_zone_descriptor);
+ /*
+ * Division is used to calculate nr_zones with no special handling
+ * for power of 2 zone sizes as this function is not invoked in a
+ * hot path
+ */
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 +180,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 +196,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 Jun 15 10:19:11 2022
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Pankaj Raghav
X-Patchwork-Id: 12882059
Return-Path:
X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on
aws-us-west-2-korg-lkml-1.web.codeaurora.org
Received: from vger.kernel.org (vger.kernel.org [23.128.96.18])
by smtp.lore.kernel.org (Postfix) with ESMTP id 1C3E0CCA47F
for ; Wed, 15 Jun 2022 10:19:49 +0000 (UTC)
Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand
id S1346988AbiFOKTq (ORCPT );
Wed, 15 Jun 2022 06:19:46 -0400
Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37298 "EHLO
lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org
with ESMTP id S1346997AbiFOKTn (ORCPT
);
Wed, 15 Jun 2022 06:19:43 -0400
Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com
[210.118.77.11])
by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A281C43AE0
for ;
Wed, 15 Jun 2022 03:19:42 -0700 (PDT)
Received: from eucas1p1.samsung.com (unknown [182.198.249.206])
by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id
20220615101941euoutp012d4ced820c530488bc31815cad811ac3~4xANMq6Nq2585525855euoutp01F
for ;
Wed, 15 Jun 2022 10:19:41 +0000 (GMT)
DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com
20220615101941euoutp012d4ced820c530488bc31815cad811ac3~4xANMq6Nq2585525855euoutp01F
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com;
s=mail20170921; t=1655288381;
bh=fB5oDuaGkkcETTJw89yvusi2uN29/80pENYiXN8LNH8=;
h=From:To:Cc:Subject:Date:In-Reply-To:References:From;
b=Q51rVz4lL7ZuSYH9mXRLyvapyJvbr/9nRcRaakStOmD4Mzxv5gjso8EOe+/gx9/Z6
04vmLa4aKTmtU7C524y3CD7yQCxgK9rcNAS8GWuHOIWl6/m8f4wMpM0bayZJpdblnS
PPzU9H31ZWnpCNfY1RTfnvsEFAkgBleEKLYgYnyQ=
Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by
eucas1p2.samsung.com (KnoxPortal) with ESMTP id
20220615101939eucas1p2eb2c5ef6e00ebaa4a2acbb8d2deb2eea~4xALZ4g0g1912519125eucas1p2g;
Wed, 15 Jun 2022 10:19:39 +0000 (GMT)
Received: from eucas1p1.samsung.com ( [182.198.249.206]) by
eusmges3new.samsung.com (EUCPMTA) with SMTP id 5C.69.09580.A32B9A26;
Wed, 15
Jun 2022 11:19:38 +0100 (BST)
Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by
eucas1p2.samsung.com (KnoxPortal) with ESMTPA id
20220615101938eucas1p26ab159a1ffd0fa5a16d7f202ba7206e7~4xAKNP28S2111721117eucas1p2V;
Wed, 15 Jun 2022 10:19:38 +0000 (GMT)
Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by
eusmtrp2.samsung.com (KnoxPortal) with ESMTP id
20220615101938eusmtrp246a65538e1923130b814cf2be9b59611~4xAKMLDK-0361403614eusmtrp2H;
Wed, 15 Jun 2022 10:19:38 +0000 (GMT)
X-AuditID: cbfec7f5-9c3ff7000000256c-19-62a9b23a0857
Received: from eusmtip1.samsung.com ( [203.254.199.221]) by
eusmgms1.samsung.com (EUCPMTA) with SMTP id BF.45.09095.A32B9A26;
Wed, 15
Jun 2022 11:19:38 +0100 (BST)
Received: from localhost (unknown [106.210.248.244]) by eusmtip1.samsung.com
(KnoxPortal) with ESMTPA id
20220615101937eusmtip1e4794119142cb0d2fedd8d7073fa370c~4xAJR_qbe1151011510eusmtip1D;
Wed, 15 Jun 2022 10:19:37 +0000 (GMT)
From: Pankaj Raghav
To: hch@lst.de, snitzer@redhat.com, damien.lemoal@opensource.wdc.com,
axboe@kernel.dk
Cc: bvanassche@acm.org, linux-kernel@vger.kernel.org,
jiangbo.365@bytedance.com, hare@suse.de, pankydev8@gmail.com,
dm-devel@redhat.com, jonathan.derrick@linux.dev,
gost.dev@samsung.com, dsterba@suse.com, jaegeuk@kernel.org,
linux-nvme@lists.infradead.org, Johannes.Thumshirn@wdc.com,
linux-block@vger.kernel.org, Pankaj Raghav ,
Johannes Thumshirn ,
Luis Chamberlain
Subject: [PATCH v7 04/13] nvmet: Allow ZNS target to support non-power_of_2
zone sizes
Date: Wed, 15 Jun 2022 12:19:11 +0200
Message-Id: <20220615101920.329421-5-p.raghav@samsung.com>
X-Mailer: git-send-email 2.25.1
In-Reply-To: <20220615101920.329421-1-p.raghav@samsung.com>
MIME-Version: 1.0
X-Brightmail-Tracker:
H4sIAAAAAAAAA+NgFvrBKsWRmVeSWpSXmKPExsWy7djPc7rWm1YmGWxcw2qx+m4/m8W0Dz+Z
LX6fPc9ssffdbFaLCz8amSxuHtjJZLFn0SQmi5WrjzJZPFk/i9mi58AHFou/XfeAYi0PgYpv
aVtc3jWHzWL+sqfsFjcmPGW0+Ly0hd1izc2nLBZtG78yOgh7XL7i7fHvxBo2j52z7rJ7XD5b
6rFpVSebx8KGqcwem5fUe+y+2QCUa73P6vF+31U2j74tqxg91m+5yuKx+XS1x+dNch7tB7qZ
AvijuGxSUnMyy1KL9O0SuDI2X1zFWrCXv+LD2t1sDYyTeLsYOTkkBEwk1u/tZO5i5OIQEljB
KPG0s5EVwvnC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ba7206e7
X-Msg-Generator: CA
X-RootMTR: 20220615101938eucas1p26ab159a1ffd0fa5a16d7f202ba7206e7
X-EPHeader: CA
CMS-TYPE: 201P
X-CMS-RootMailID: 20220615101938eucas1p26ab159a1ffd0fa5a16d7f202ba7206e7
References: <20220615101920.329421-1-p.raghav@samsung.com>
Precedence: bulk
List-ID:
X-Mailing-List: linux-block@vger.kernel.org
A generic bdev_zone_no helper is added to calculate zone number for a given
sector in a block device. This helper internally uses blk_queue_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 npo2 zone devices.
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 | 2 +-
include/linux/blkdev.h | 7 +++++++
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/drivers/nvme/target/zns.c b/drivers/nvme/target/zns.c
index 82b61acf7..5516dd6cc 100644
--- a/drivers/nvme/target/zns.c
+++ b/drivers/nvme/target/zns.c
@@ -242,7 +242,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 blkdev_nr_zones(req->ns->bdev->bd_disk) -
- (sect >> ilog2(bdev_zone_sectors(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 3c106dba1..e09d73473 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -1387,6 +1387,13 @@ static inline sector_t bdev_zone_sectors(struct block_device *bdev)
return 0;
}
+static inline unsigned int bdev_zone_no(struct block_device *bdev, sector_t sec)
+{
+ struct request_queue *q = bdev_get_queue(bdev);
+
+ return blk_queue_zone_no(q, sec);
+}
+
static inline unsigned int bdev_max_open_zones(struct block_device *bdev)
{
struct request_queue *q = bdev_get_queue(bdev);
From patchwork Wed Jun 15 10:19:12 2022
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Pankaj Raghav
X-Patchwork-Id: 12882060
Return-Path:
X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on
aws-us-west-2-korg-lkml-1.web.codeaurora.org
Received: from vger.kernel.org (vger.kernel.org [23.128.96.18])
by smtp.lore.kernel.org (Postfix) with ESMTP id C5CEAC43334
for ; Wed, 15 Jun 2022 10:20:14 +0000 (UTC)
Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand
id S1347578AbiFOKUL (ORCPT );
Wed, 15 Jun 2022 06:20:11 -0400
Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37458 "EHLO
lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org
with ESMTP id S1346933AbiFOKTq (ORCPT
);
Wed, 15 Jun 2022 06:19:46 -0400
Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com
[210.118.77.12])
by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 94C0A483B3
for ;
Wed, 15 Jun 2022 03:19:45 -0700 (PDT)
Received: from eucas1p2.samsung.com (unknown [182.198.249.207])
by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id
20220615101944euoutp029103ccb5fe575bd524b40a529fc15d6e~4xAP6V8j62551825518euoutp02i
for ;
Wed, 15 Jun 2022 10:19:44 +0000 (GMT)
DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com
20220615101944euoutp029103ccb5fe575bd524b40a529fc15d6e~4xAP6V8j62551825518euoutp02i
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com;
s=mail20170921; t=1655288384;
bh=lLGMwfb5PJ6NL047GLNc1b0pwU2MRBCwYBHDN82Un+w=;
h=From:To:Cc:Subject:Date:In-Reply-To:References:From;
b=cdrNB5U4teXlJ07QyJI5RreD3ZSKda2lOTrsSMtUwWZRNKw16ihkVKx0980mO7A28
41az5D4tITuTSVO12DRSxNeQgxdUonyULn/a9xj4VqWcvdwHMPiLOm4J4Fmf0l45e9
d+V+56Ck/gG2urEjKbEnzwulUEx0eBU+5gBT5qGc=
Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by
eucas1p2.samsung.com (KnoxPortal) with ESMTP id
20220615101942eucas1p2fd692c0d27a96cd40f5934749dd545cb~4xAN_mTaf1910819108eucas1p2k;
Wed, 15 Jun 2022 10:19:42 +0000 (GMT)
Received: from eucas1p1.samsung.com ( [182.198.249.206]) by
eusmges2new.samsung.com (EUCPMTA) with SMTP id DB.67.10067.E32B9A26;
Wed, 15
Jun 2022 11:19:42 +0100 (BST)
Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by
eucas1p2.samsung.com (KnoxPortal) with ESMTPA id
20220615101941eucas1p25e1c27b363e6b288b848521298e31705~4xANeL5hf2111721117eucas1p2a;
Wed, 15 Jun 2022 10:19:41 +0000 (GMT)
Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by
eusmtrp2.samsung.com (KnoxPortal) with ESMTP id
20220615101941eusmtrp2ae19a360edb4529854235d5eddd10b32~4xANdYsXz0349503495eusmtrp2g;
Wed, 15 Jun 2022 10:19:41 +0000 (GMT)
X-AuditID: cbfec7f4-dc1ff70000002753-7c-62a9b23ea0ec
Received: from eusmtip1.samsung.com ( [203.254.199.221]) by
eusmgms1.samsung.com (EUCPMTA) with SMTP id 42.55.09095.D32B9A26;
Wed, 15
Jun 2022 11:19:41 +0100 (BST)
Received: from localhost (unknown [106.210.248.244]) by eusmtip1.samsung.com
(KnoxPortal) with ESMTPA id
20220615101940eusmtip1c41b5b3584b730806ea14d0625152f0a~4xAMZrl_t0899908999eusmtip17;
Wed, 15 Jun 2022 10:19:40 +0000 (GMT)
From: Pankaj Raghav
To: hch@lst.de, snitzer@redhat.com, damien.lemoal@opensource.wdc.com,
axboe@kernel.dk
Cc: bvanassche@acm.org, linux-kernel@vger.kernel.org,
jiangbo.365@bytedance.com, hare@suse.de, pankydev8@gmail.com,
dm-devel@redhat.com, jonathan.derrick@linux.dev,
gost.dev@samsung.com, dsterba@suse.com, jaegeuk@kernel.org,
linux-nvme@lists.infradead.org, Johannes.Thumshirn@wdc.com,
linux-block@vger.kernel.org, Pankaj Raghav ,
Luis Chamberlain
Subject: [PATCH v7 05/13] null_blk: allow non power of 2 zoned devices
Date: Wed, 15 Jun 2022 12:19:12 +0200
Message-Id: <20220615101920.329421-6-p.raghav@samsung.com>
X-Mailer: git-send-email 2.25.1
In-Reply-To: <20220615101920.329421-1-p.raghav@samsung.com>
MIME-Version: 1.0
X-Brightmail-Tracker:
H4sIAAAAAAAAA+NgFvrKKsWRmVeSWpSXmKPExsWy7djPc7p2m1YmGTz7wW2x+m4/m8W0Dz+Z
LX6fPc9ssffdbFaLCz8amSxuHtjJZLFn0SQmi5WrjzJZPFk/i9mi58AHFou/XfeAYi0PgYpv
aVtc3jWHzWL+sqfsFjcmPGW0+Ly0hd1izc2nLBZtG78yOgh7XL7i7fHvxBo2j52z7rJ7XD5b
6rFpVSebx8KGqcwem5fUe+y+2QCUa73P6vF+31U2j74tqxg91m+5yuKx+XS1x+dNch7tB7qZ
AvijuGxSUnMyy1KL9O0SuDJaWq6wFpzVrdjYsIW9gXGGShcjJ4eEgInEoq5+xi5GLg4hgRWM
Er/O3oZyvjBKrL24Dsr5zCgx7/1L5i5GDrCW1XeSIeLLGSX2rmxhAhklJPCSUeLaJ0+QGjYB
LYnGTnaQsIhAuMTRPffASpgF+pglnrysA7GFBdwkfpz6xQJiswioSmzs2cIE0sorYCWx57Ev
xHHyEjMvfQcbwylgLbFjdg8riM0rIChxcuYTFoiR8hLNW2czg5wjIXCJU6L/QB87RLOLxPuZ
DVC2sMSr41ugbBmJ/zvnM0HY1RJPb/yGam5hlOjfuZ4N4kd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vJXYxcHEICSxklZk5cxNrFyAkUl5C4vbCJEcIW
lvhzrYsNoug5o8TUli/sIM1sAloSjZ3sIDUiAtESnTffg9UwCyxgljh9ZwJYQljATeLHqV8s
IDaLgKrExp4tTCC9vAJWEnse+0LMl5eYeek7WDmngLXEjtk9rCAlQkAlu97Fg4R5BQQlTs58
AjaFGai8eets5gmMArOQpGYhSS1gZFrFKJJaWpybnltsqFecmFtcmpeul5yfu4kRGOHbjv3c
vINx3quPeocYmTgYDzFKcDArifCaBa9MEuJNSaysSi3Kjy8qzUktPsRoCnT1RGYp0eR8YIrJ
K4k3NDMwNTQxszQwtTQzVhLn9SzoSBQSSE8sSc1OTS1ILYLpY+LglGpgilxjtmVVXYLa5/L2
fnZOqRtvl8V1LN7w4aBrZ+97z7zqGVl2d+7lG65cLZQnGf84Y7Iby/UtByacv/PN8/716Z3P
5CavubqS37lT4MWNgvxOFu1LV6+JxZd5BRomT9knYzJHtoa572AA29NHU/2viFWFPrt2V2Dr
24cTXZ9/KeUxqNd8aXbuXPODAx577j9ycmKXz5ioxidn1fYm9OeVmX+M7lrPFY0U5v3gveDL
Q/NFXZlP7A9w/l3/P1t564zkC+Ef+DwmHj9lzv/A8RbDBdHqGzwMnompSU5vw0wmRFcWbvo3
6VehSmbHHRb30x//rAl8ZWFvMzHTZ+bXvX9X2/vyvV7FGGC0NFGI/8FiDiWW4oxEQy3mouJE
AENZ9i55AwAA
X-CMS-MailID: 20220615101941eucas1p25e1c27b363e6b288b848521298e31705
X-Msg-Generator: CA
X-RootMTR: 20220615101941eucas1p25e1c27b363e6b288b848521298e31705
X-EPHeader: CA
CMS-TYPE: 201P
X-CMS-RootMailID: 20220615101941eucas1p25e1c27b363e6b288b848521298e31705
References: <20220615101920.329421-1-p.raghav@samsung.com>
Precedence: bulk
List-ID:
X-Mailing-List: linux-block@vger.kernel.org
Convert the power of 2 based calculation with zone size to be generic in
null_zone_no with optimization for power of 2 based zone sizes.
The nr_zones calculation in null_init_zoned_dev has been replaced with a
division without special handling for power of 2 based zone sizes as
this function is called only during the initialization and will not
invoked in the hot path.
Performance Measurement:
Device:
zone size = 128M, blocksize=4k
FIO cmd:
fio --name=zbc --filename=/dev/nullb0 --direct=1 --zonemode=zbd --size=23G
--io_size= --ioengine=io_uring --iodepth= --rw= --bs=4k
--loops=4
The following results are an average of 4 runs on AMD Ryzen 5 5600X with
32GB of RAM:
Sequential Write:
x-----------------x---------------------------------x---------------------------------x
| IOdepth | 8 | 16 |
x-----------------x---------------------------------x---------------------------------x
| | KIOPS |BW(MiB/s) | Lat(usec) | KIOPS |BW(MiB/s) | Lat(usec) |
x-----------------x---------------------------------x---------------------------------x
| Without patch | 578 | 2257 | 12.80 | 576 | 2248 | 25.78 |
x-----------------x---------------------------------x---------------------------------x
| With patch | 581 | 2268 | 12.74 | 576 | 2248 | 25.85 |
x-----------------x---------------------------------x---------------------------------x
Sequential read:
x-----------------x---------------------------------x---------------------------------x
| IOdepth | 8 | 16 |
x-----------------x---------------------------------x---------------------------------x
| | KIOPS |BW(MiB/s) | Lat(usec) | KIOPS |BW(MiB/s) | Lat(usec) |
x-----------------x---------------------------------x---------------------------------x
| Without patch | 667 | 2605 | 11.79 | 675 | 2637 | 23.49 |
x-----------------x---------------------------------x---------------------------------x
| With patch | 667 | 2605 | 11.79 | 675 | 2638 | 23.48 |
x-----------------x---------------------------------x---------------------------------x
Random read:
x-----------------x---------------------------------x---------------------------------x
| IOdepth | 8 | 16 |
x-----------------x---------------------------------x---------------------------------x
| | KIOPS |BW(MiB/s) | Lat(usec) | KIOPS |BW(MiB/s) | Lat(usec) |
x-----------------x---------------------------------x---------------------------------x
| Without patch | 522 | 2038 | 15.05 | 514 | 2006 | 30.87 |
x-----------------x---------------------------------x---------------------------------x
| With patch | 522 | 2039 | 15.04 | 523 | 2042 | 30.33 |
x-----------------x---------------------------------x---------------------------------x
Minor variations are noticed in Sequential write with io depth 8 and
in random read with io depth 16. But overall no noticeable differences
were noticed
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/zoned.c | 13 ++++++-------
2 files changed, 8 insertions(+), 10 deletions(-)
diff --git a/drivers/block/null_blk/main.c b/drivers/block/null_blk/main.c
index 6b67088f4..6c170927c 100644
--- a/drivers/block/null_blk/main.c
+++ b/drivers/block/null_blk/main.c
@@ -1929,9 +1929,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/zoned.c b/drivers/block/null_blk/zoned.c
index 2fdd7b20c..daf327015 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 (is_power_of_2(dev->zone_size_sects))
+ return sect >> ilog2(dev->zone_size_sects);
+
+ 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,8 +85,8 @@ 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);
+ 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);
From patchwork Wed Jun 15 10:19:13 2022
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Pankaj Raghav
X-Patchwork-Id: 12882061
Return-Path:
X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on
aws-us-west-2-korg-lkml-1.web.codeaurora.org
Received: from vger.kernel.org (vger.kernel.org [23.128.96.18])
by smtp.lore.kernel.org (Postfix) with ESMTP id B9FBBC433EF
for ; Wed, 15 Jun 2022 10:20:17 +0000 (UTC)
Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand
id S1347697AbiFOKUQ (ORCPT );
Wed, 15 Jun 2022 06:20:16 -0400
Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37796 "EHLO
lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org
with ESMTP id S1347422AbiFOKT6 (ORCPT
);
Wed, 15 Jun 2022 06:19:58 -0400
Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com
[210.118.77.12])
by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C6AA94B843
for ;
Wed, 15 Jun 2022 03:19:48 -0700 (PDT)
Received: from eucas1p1.samsung.com (unknown [182.198.249.206])
by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id
20220615101947euoutp025dd3a03b5432e2b5d054321291ebe6f5~4xAS136S52915629156euoutp02S
for ;
Wed, 15 Jun 2022 10:19:47 +0000 (GMT)
DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com
20220615101947euoutp025dd3a03b5432e2b5d054321291ebe6f5~4xAS136S52915629156euoutp02S
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com;
s=mail20170921; t=1655288387;
bh=4jPwwWbQfF9zLvI8kpVWdO4LLyoyD4CJkiZ6uOQN+Sw=;
h=From:To:Cc:Subject:Date:In-Reply-To:References:From;
b=G+HJxDk4JOont+x2vYqrrxujtLibpvxEN8f7FL/OFKCfGrBc29lBxwQgaXDl5OulC
RIW5fnWaTdVC4DzCFKXhdhCdicwkEwP1hlUNEKbsu8fq3UNaNWcnrmNDovTXnvz+1m
8gvAw/WE46ez8dd1YRy3HdPfGBRr4mBA1Esz38pM=
Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by
eucas1p1.samsung.com (KnoxPortal) with ESMTP id
20220615101945eucas1p1d5342ae55cf549f7f52be0f3f500a61c~4xARRJUWa2260522605eucas1p1F;
Wed, 15 Jun 2022 10:19:45 +0000 (GMT)
Received: from eucas1p1.samsung.com ( [182.198.249.206]) by
eusmges1new.samsung.com (EUCPMTA) with SMTP id 39.3B.09664.142B9A26;
Wed, 15
Jun 2022 11:19:45 +0100 (BST)
Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by
eucas1p1.samsung.com (KnoxPortal) with ESMTPA id
20220615101945eucas1p16fa264e81d9b6027ff131dd311ed91e2~4xAQvVa5T1177311773eucas1p1k;
Wed, 15 Jun 2022 10:19:45 +0000 (GMT)
Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by
eusmtrp2.samsung.com (KnoxPortal) with ESMTP id
20220615101945eusmtrp22c89343c319808137c8290492d5eddfa~4xAQudBoS0361403614eusmtrp2X;
Wed, 15 Jun 2022 10:19:45 +0000 (GMT)
X-AuditID: cbfec7f2-d97ff700000025c0-f7-62a9b24146d1
Received: from eusmtip1.samsung.com ( [203.254.199.221]) by
eusmgms1.samsung.com (EUCPMTA) with SMTP id B5.55.09095.142B9A26;
Wed, 15
Jun 2022 11:19:45 +0100 (BST)
Received: from localhost (unknown [106.210.248.244]) by eusmtip1.samsung.com
(KnoxPortal) with ESMTPA id
20220615101943eusmtip1dcf863a2a0f7ec36b4725dadaac7a2c0~4xAPefbdk0536005360eusmtip1f;
Wed, 15 Jun 2022 10:19:43 +0000 (GMT)
From: Pankaj Raghav
To: hch@lst.de, snitzer@redhat.com, damien.lemoal@opensource.wdc.com,
axboe@kernel.dk
Cc: bvanassche@acm.org, linux-kernel@vger.kernel.org,
jiangbo.365@bytedance.com, hare@suse.de, pankydev8@gmail.com,
dm-devel@redhat.com, jonathan.derrick@linux.dev,
gost.dev@samsung.com, dsterba@suse.com, jaegeuk@kernel.org,
linux-nvme@lists.infradead.org, Johannes.Thumshirn@wdc.com,
linux-block@vger.kernel.org, Pankaj Raghav ,
Damien Le Moal ,
Luis Chamberlain
Subject: [PATCH v7 06/13] null_blk: use zone_size_sects_shift for power of 2
zoned devices
Date: Wed, 15 Jun 2022 12:19:13 +0200
Message-Id: <20220615101920.329421-7-p.raghav@samsung.com>
X-Mailer: git-send-email 2.25.1
In-Reply-To: <20220615101920.329421-1-p.raghav@samsung.com>
MIME-Version: 1.0
X-Brightmail-Tracker:
H4sIAAAAAAAAA+NgFvrDKsWRmVeSWpSXmKPExsWy7djPc7qOm1YmGVzYbWSx+m4/m8W0Dz+Z
LX6fPc9s0dr+jcli77vZrBYXfjQyWdw8sJPJYs+iSUwWK1cfZbJ4sn4Ws0XPgQ8sFn+77gHF
Wh4yW+y9pW1xedccNov5y56yW9yY8JTR4vPSFnaLNTefsli0bfzK6CDicfmKt8e/E2vYPHbO
usvucflsqcemVZ1sHgsbpjJ7bF5S77H7ZgNQrvU+q8f7fVfZPPq2rGL0WL/lKovH5tPVHp83
yXm0H+hmCuCP4rJJSc3JLEst0rdL4MpofXqaseC7UMWqX0vYGxh/8HcxcnJICJhI9H/6xQZi
CwmsYJSYsjWpi5ELyP7CKPFu0zJGCOczo8Si0y+ZYDren13NBJFYziixt3E7M4TzklFixdJ1
7F2MHBxsAloSjZ3sIA0iAuESR/fcA2tgFtjBLLGs5SHYPmGBGIljm6eBTWUR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WL/lKovH5tPVHp83
yXm0H+hmCuCP0rMpyi8tSVXIyC8usVWKNrQw0jO0tNAzMrHUMzQ2j7UyMlXSt7NJSc3JLEst
0rdL0MtofXqaseC7UMWqX0vYGxh/8HcxcnJICJhIvD+7mqmLkYtDSGApo8TJRQ3sEAkJidsL
mxghbGGJP9e62CCKnjNKHF23lrmLkYODTUBLorETrF5EIFqi8+Z7sBpmgVPMEltmvWcCSQgL
RElsObmFBcRmEVCVOH/2GCNIL6+AlcSSaxkQ8+UlZl76DjaHU8BaYsfsHlaQEiGgkl3v4kHC
vAKCEidnPgGbwgxU3rx1NvMERoFZSFKzkKQWMDKtYhRJLS3OTc8tNtQrTswtLs1L10vOz93E
CIz2bcd+bt7BOO/VR71DjEwcjIcYJTiYlUR4zYJXJgnxpiRWVqUW5ccXleakFh9iNAW6eiKz
lGhyPjDd5JXEG5oZmBqamFkamFqaGSuJ83oWdCQKCaQnlqRmp6YWpBbB9DFxcEo1MG3/4vx+
ZuC+DPEPhw4bi3SvWiSTp625OfFez8MyJaZLxqpGr1wepvrsFZ8w797jmnc/RPfurPm+u2e2
ZsltLi/ZuI7OSsb/9adXPrtl82516wauLTE1Pa9SE5cYKgXe159+MMK0uIKd++VM9doju/su
r9t8Mu7yomUTOIPESqbOdJUOPjz/RvSta7djshc49G34efXxjdQ1Vp497BWell4qXw9H21zL
6VwaafBh5bck4btl2e8vLzr66Elr1tXfs5/cufhv0tVb4rO/2VzpWRK0+kCQ9Q+ZGp3yv/b7
J/6YHV71Ju69/hGdsq6i5c73f5ltidkvHHtEUdwok1NYRuK2yJ7W7IOVmnyrUlwvMy1VYinO
SDTUYi4qTgQABDAVGH8DAAA=
X-CMS-MailID: 20220615101945eucas1p16fa264e81d9b6027ff131dd311ed91e2
X-Msg-Generator: CA
X-RootMTR: 20220615101945eucas1p16fa264e81d9b6027ff131dd311ed91e2
X-EPHeader: CA
CMS-TYPE: 201P
X-CMS-RootMailID: 20220615101945eucas1p16fa264e81d9b6027ff131dd311ed91e2
References: <20220615101920.329421-1-p.raghav@samsung.com>
Precedence: bulk
List-ID:
X-Mailing-List: linux-block@vger.kernel.org
Instead of doing is_power_of_2 and ilog2 operation for every IO, cache
the zone_size_sects_shift variable and use it for power of 2 zoned
devices.
This variable will be set to zero for non power of 2 zoned devices.
Suggested-by: Damien Le Moal
Reviewed-by: Hannes Reinecke
Reviewed-by: Luis Chamberlain
Signed-off-by: Pankaj Raghav
---
drivers/block/null_blk/null_blk.h | 6 ++++++
drivers/block/null_blk/zoned.c | 11 ++++++++---
2 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/drivers/block/null_blk/null_blk.h b/drivers/block/null_blk/null_blk.h
index 8359b4384..3bc7cbf25 100644
--- a/drivers/block/null_blk/null_blk.h
+++ b/drivers/block/null_blk/null_blk.h
@@ -83,6 +83,12 @@ struct nullb_device {
unsigned int imp_close_zone_no;
struct nullb_zone *zones;
sector_t zone_size_sects;
+ /*
+ * zone_size_sects_shift is only useful when the zone size is
+ * power of 2. This variable is set to zero when zone size is non
+ * power of 2.
+ */
+ 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 daf327015..5f929944b 100644
--- a/drivers/block/null_blk/zoned.c
+++ b/drivers/block/null_blk/zoned.c
@@ -16,8 +16,8 @@ static inline sector_t mb_to_sects(unsigned long mb)
static inline unsigned int null_zone_no(struct nullb_device *dev, sector_t sect)
{
- if (is_power_of_2(dev->zone_size_sects))
- 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);
}
@@ -85,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);
+
+ 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 Jun 15 10:19:14 2022
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Pankaj Raghav
X-Patchwork-Id: 12882062
Return-Path:
X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on
aws-us-west-2-korg-lkml-1.web.codeaurora.org
Received: from vger.kernel.org (vger.kernel.org [23.128.96.18])
by smtp.lore.kernel.org (Postfix) with ESMTP id E4BBDC43334
for ; Wed, 15 Jun 2022 10:20:19 +0000 (UTC)
Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand
id S1347534AbiFOKUR (ORCPT );
Wed, 15 Jun 2022 06:20:17 -0400
Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37458 "EHLO
lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org
with ESMTP id S1346820AbiFOKUJ (ORCPT
);
Wed, 15 Jun 2022 06:20:09 -0400
Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com
[210.118.77.11])
by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ED8A04BBB9
for ;
Wed, 15 Jun 2022 03:19:51 -0700 (PDT)
Received: from eucas1p1.samsung.com (unknown [182.198.249.206])
by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id
20220615101950euoutp01343457c92986f2452f2f6722ef5a842e~4xAV3Lx5u2526325263euoutp01i
for ;
Wed, 15 Jun 2022 10:19:50 +0000 (GMT)
DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com
20220615101950euoutp01343457c92986f2452f2f6722ef5a842e~4xAV3Lx5u2526325263euoutp01i
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com;
s=mail20170921; t=1655288390;
bh=zCtvccOkeF161CZuc2mF7+nuN0EZElrN97XeueFslLw=;
h=From:To:Cc:Subject:Date:In-Reply-To:References:From;
b=g1hduzeUsFJ+qq5V9gzUEOZ6PWjuD/4fWegw7Gf89yGB2p5QL1xoS3r1sxjBoTNdf
Cl4q6TcJjp5k0CYIksrLWtTtX6OVSl5t3dl3mvwug6Ap57of/F4p2ccUo/OWOa15Q5
RFop/cBO21RgjxB9JRU3mNzSsVnisxEM2rWpBxng=
Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by
eucas1p2.samsung.com (KnoxPortal) with ESMTP id
20220615101948eucas1p2db62e1a1d72812c89f83ad4da9df0d80~4xAUIacym1910819108eucas1p2s;
Wed, 15 Jun 2022 10:19:48 +0000 (GMT)
Received: from eucas1p2.samsung.com ( [182.198.249.207]) by
eusmges2new.samsung.com (EUCPMTA) with SMTP id C4.77.10067.442B9A26;
Wed, 15
Jun 2022 11:19:48 +0100 (BST)
Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by
eucas1p2.samsung.com (KnoxPortal) with ESMTPA id
20220615101948eucas1p2d8d801735c39b25256a019134adb0c6f~4xATjX3Rj2114221142eucas1p2W;
Wed, 15 Jun 2022 10:19:48 +0000 (GMT)
Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by
eusmtrp2.samsung.com (KnoxPortal) with ESMTP id
20220615101948eusmtrp2a7a7cca347d91d529dfe7e6734f73b3f~4xATiefYB0361403614eusmtrp2f;
Wed, 15 Jun 2022 10:19:48 +0000 (GMT)
X-AuditID: cbfec7f4-dd7ff70000002753-93-62a9b2444355
Received: from eusmtip1.samsung.com ( [203.254.199.221]) by
eusmgms1.samsung.com (EUCPMTA) with SMTP id 58.55.09095.442B9A26;
Wed, 15
Jun 2022 11:19:48 +0100 (BST)
Received: from localhost (unknown [106.210.248.244]) by eusmtip1.samsung.com
(KnoxPortal) with ESMTPA id
20220615101947eusmtip13c89af2230fa641d50955a11bfcf71c9~4xASsSOCP1144211442eusmtip1M;
Wed, 15 Jun 2022 10:19:47 +0000 (GMT)
From: Pankaj Raghav
To: hch@lst.de, snitzer@redhat.com, damien.lemoal@opensource.wdc.com,
axboe@kernel.dk
Cc: bvanassche@acm.org, linux-kernel@vger.kernel.org,
jiangbo.365@bytedance.com, hare@suse.de, pankydev8@gmail.com,
dm-devel@redhat.com, jonathan.derrick@linux.dev,
gost.dev@samsung.com, dsterba@suse.com, jaegeuk@kernel.org,
linux-nvme@lists.infradead.org, Johannes.Thumshirn@wdc.com,
linux-block@vger.kernel.org, Pankaj Raghav ,
Luis Chamberlain
Subject: [PATCH v7 07/13] zonefs: allow non power of 2 zoned devices
Date: Wed, 15 Jun 2022 12:19:14 +0200
Message-Id: <20220615101920.329421-8-p.raghav@samsung.com>
X-Mailer: git-send-email 2.25.1
In-Reply-To: <20220615101920.329421-1-p.raghav@samsung.com>
MIME-Version: 1.0
X-Brightmail-Tracker:
H4sIAAAAAAAAA+NgFvrOKsWRmVeSWpSXmKPExsWy7djP87oum1YmGby7aGKx+m4/m8W0Dz+Z
LX6fPc9ssffdbFaLCz8amSxuHtjJZLFn0SQmi5WrjzJZPFk/i9mi58AHFou/XfeAYi0PgYpv
aVtc3jWHzWL+sqfsFjcmPGW0+Ly0hd1izc2nLBZtG78yOgh7XL7i7fHvxBo2j52z7rJ7XD5b
6rFpVSebx8KGqcwem5fUe+y+2QCUa73P6vF+31U2j74tqxg91m+5yuKx+XS1x+dNch7tB7qZ
AvijuGxSUnMyy1KL9O0SuDI+LNjAWLBboOLYmg7GBsbzvF2MnBwSAiYSx2a8ZOti5OIQEljB
KPFk3ioWCOcLo8SSO/fZIZzPjBLbXx5n7WLkAGs53ysMEV/OKPFu2TKo9peMEmtfnGYBKWIT
0JJo7GQHWSEiEC5xdM89JhCbWaCPWeLJyzoQW1jAReLN3a1gNSwCqhLnd+1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qbR9+WVYwe67dcZfHYfLra4/MmOY/2A91M
AfxRejZF+aUlqQoZ+cUltkrRhhZGeoaWFnpGJpZ6hsbmsVZGpkr6djYpqTmZZalF+nYJehkf
FmxgLNgtUHFsTQdjA+N53i5GDg4JAROJ873CXYxcHEICSxklVh3bz97FyAkUl5C4vbCJEcIW
lvhzrYsNoug5o8SHnSuYQJrZBLQkGjvB6kUEoiU6b74Hq2EWWMAscfrOBLCEsICLxJu7W8Fs
FgFVifO7djOD2LwCVhK/jn1kglggLzHz0newGk4Ba4kds3tYQeYLAdXsehcPUS4ocXLmExYQ
mxmovHnrbOYJjAKzkKRmIUktYGRaxSiSWlqcm55bbKhXnJhbXJqXrpecn7uJERjj24793LyD
cd6rj3qHGJk4GA8xSnAwK4nwmgWvTBLiTUmsrEotyo8vKs1JLT7EaAp09kRmKdHkfGCSySuJ
NzQzMDU0MbM0MLU0M1YS5/Us6EgUEkhPLEnNTk0tSC2C6WPi4JRqYDp6wkLb9f5ri9yV76b9
TbxxUqXM4NWmt6aqr/fdSV1wbHWzrv+tqUyBO/+pJSXsuvA+/sAjb+EFL8t6S6sKVspezrr5
0W5bzosEMwPxMx08q2bfkysXmpnOyPp5xn6r2756F4T3OrzcX894YL9o1IR+LxHhWK60wEf6
W2VE+2938U7JfqVitk989pqNSjFlrsnlTZ2hzfNmc829/fuaaHKYtZ/n8pqp1wKX81Wfuchh
t9DT6vlm456WD4cqMw5U/Z48pULVoPGf9jFnthdrqr+v387JvXaBZ2POgh7B+bGTPj6pW6c7
6aStIbdkgjSPB3fbi949j9ncNTk0z+/7ud0oacb+Bwo7z9jN9cwxaFZiKc5INNRiLipOBAA/
+S8iegMAAA==
X-CMS-MailID: 20220615101948eucas1p2d8d801735c39b25256a019134adb0c6f
X-Msg-Generator: CA
X-RootMTR: 20220615101948eucas1p2d8d801735c39b25256a019134adb0c6f
X-EPHeader: CA
CMS-TYPE: 201P
X-CMS-RootMailID: 20220615101948eucas1p2d8d801735c39b25256a019134adb0c6f
References: <20220615101920.329421-1-p.raghav@samsung.com>
Precedence: bulk
List-ID:
X-Mailing-List: linux-block@vger.kernel.org
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.
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 cc6d4cf58..0b737c2fb 100644
--- a/fs/zonefs/super.c
+++ b/fs/zonefs/super.c
@@ -485,10 +485,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,
@@ -1410,7 +1409,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;
@@ -1787,7 +1786,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 4b3de66c3..39895195c 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 Jun 15 10:19:15 2022
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Pankaj Raghav
X-Patchwork-Id: 12882063
Return-Path:
X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on
aws-us-west-2-korg-lkml-1.web.codeaurora.org
Received: from vger.kernel.org (vger.kernel.org [23.128.96.18])
by smtp.lore.kernel.org (Postfix) with ESMTP id EB5BDCCA47B
for ; Wed, 15 Jun 2022 10:20:20 +0000 (UTC)
Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand
id S1347005AbiFOKUS (ORCPT );
Wed, 15 Jun 2022 06:20:18 -0400
Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37534 "EHLO
lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org
with ESMTP id S1347596AbiFOKUN (ORCPT
);
Wed, 15 Jun 2022 06:20:13 -0400
Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com
[210.118.77.11])
by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 196A84BFF3
for ;
Wed, 15 Jun 2022 03:19:55 -0700 (PDT)
Received: from eucas1p2.samsung.com (unknown [182.198.249.207])
by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id
20220615101953euoutp01f02a63aeba314709eb55ce0c84b82c66~4xAYvC5bY2585525855euoutp01Q
for ;
Wed, 15 Jun 2022 10:19:53 +0000 (GMT)
DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com
20220615101953euoutp01f02a63aeba314709eb55ce0c84b82c66~4xAYvC5bY2585525855euoutp01Q
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com;
s=mail20170921; t=1655288393;
bh=bwZDXQMCqMHhu3ZuVm0AocKjdjGbQSZlDWP1ndwgqcc=;
h=From:To:Cc:Subject:Date:In-Reply-To:References:From;
b=IsnRcezjOXiALz83wEzrvdnlRnY+kZXZoQVFFEWvYvw9evcptXtOsuvwqnMJSYc0P
8IIlnoqCRamVvxdHGftchVRgmOuQt0530yccfh5h8RPRuyp1OqdjjesqSGh4Cl9Ia9
x3jSn9zK07ksmxSos9HsltT1N96m03ezesyOhA6k=
Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by
eucas1p1.samsung.com (KnoxPortal) with ESMTP id
20220615101951eucas1p18d84bd7b38d6657a6c512bd382ceedf6~4xAW0wNp51438314383eucas1p1I;
Wed, 15 Jun 2022 10:19:51 +0000 (GMT)
Received: from eucas1p2.samsung.com ( [182.198.249.207]) by
eusmges2new.samsung.com (EUCPMTA) with SMTP id 39.77.10067.742B9A26;
Wed, 15
Jun 2022 11:19:51 +0100 (BST)
Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by
eucas1p2.samsung.com (KnoxPortal) with ESMTPA id
20220615101951eucas1p238eb45e563bd9645af81bf16c56d98ec~4xAWbmb-F2114221142eucas1p2b;
Wed, 15 Jun 2022 10:19:51 +0000 (GMT)
Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by
eusmtrp2.samsung.com (KnoxPortal) with ESMTP id
20220615101951eusmtrp2c759d4ee173fff60b6c81fb090bf1131~4xAWarPxE0361403614eusmtrp2l;
Wed, 15 Jun 2022 10:19:51 +0000 (GMT)
X-AuditID: cbfec7f4-dc1ff70000002753-9e-62a9b247678f
Received: from eusmtip1.samsung.com ( [203.254.199.221]) by
eusmgms2.samsung.com (EUCPMTA) with SMTP id 07.24.09038.742B9A26;
Wed, 15
Jun 2022 11:19:51 +0100 (BST)
Received: from localhost (unknown [106.210.248.244]) by eusmtip1.samsung.com
(KnoxPortal) with ESMTPA id
20220615101950eusmtip1b23a4a7a289c85a785fe400b913c2e54~4xAVmPX1i1152711527eusmtip1J;
Wed, 15 Jun 2022 10:19:50 +0000 (GMT)
From: Pankaj Raghav
To: hch@lst.de, snitzer@redhat.com, damien.lemoal@opensource.wdc.com,
axboe@kernel.dk
Cc: bvanassche@acm.org, linux-kernel@vger.kernel.org,
jiangbo.365@bytedance.com, hare@suse.de, pankydev8@gmail.com,
dm-devel@redhat.com, jonathan.derrick@linux.dev,
gost.dev@samsung.com, dsterba@suse.com, jaegeuk@kernel.org,
linux-nvme@lists.infradead.org, Johannes.Thumshirn@wdc.com,
linux-block@vger.kernel.org, Luis Chamberlain ,
Pankaj Raghav
Subject: [PATCH v7 08/13] dm-zoned: ensure only power of 2 zone sizes are
allowed
Date: Wed, 15 Jun 2022 12:19:15 +0200
Message-Id: <20220615101920.329421-9-p.raghav@samsung.com>
X-Mailer: git-send-email 2.25.1
In-Reply-To: <20220615101920.329421-1-p.raghav@samsung.com>
MIME-Version: 1.0
X-Brightmail-Tracker:
H4sIAAAAAAAAA+NgFvrBKsWRmVeSWpSXmKPExsWy7djP87rum1YmGdyfpG+x+m4/m8W0Dz+Z
LX6fPc9ssffdbFaLCz8amSxuHtjJZLFn0SQmi5WrjzJZPFk/i9mi58AHFou/XfeAYi0PgYpv
aVtc3jWHzWL+sqfsFjcmPGW0+Ly0hd1izc2nLBZtG78yOgh7XL7i7fHvxBo2j52z7rJ7XD5b
6rFpVSebx8KGqcwem5fUe+y+2QCUa73P6vF+31U2j74tqxg91m+5yuKx+XS1x+dNch7tB7qZ
AvijuGxSUnMyy1KL9O0SuDJ+3znDVvCLu6Jj3mGmBsY3nF2MnBwSAiYSE9vfsIPYQgIrGCW2
bLTrYuQCsr8wSvTs3MgKkfjMKPHsQx1Mw8PDS5ghipYzSjS8Pc4K4bxklLi0Yx1TFyMHB5uA
lkRjJ9hUEYFwiaN77jGB1DAL9DFLbD3XBzZVWCBYYv/BfUwgNouAqsTfvqMsIDavgJXE8Y6D
bBDb5CVmX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Avij9GyK8ktLUhUy8otLbJWiDS2M9AwtLfSMTCz1DI3NY62MTJX07WxSUnMyy1KL9O0S9DJ+
3znDVvCLu6Jj3mGmBsY3nF2MnBwSAiYSDw8vYe5i5OIQEljKKLEB6CqIhITE7YVNjBC2sMSf
a11sEEXPGSUaT+0DSnBwsAloSTR2gtWLCERLdN58D1bDLLCAWeL57VlsIAlhgUCJZccbmUBs
FgFVib99R1lAbF4BK4njHQfZIBbIS8y89B1sEKeAtcSO2T2sIPOFgGp2vYuHKBeUODnzCVgr
M1B589bZzBMYBWYhSc1CklrAyLSKUSS1tDg3PbfYSK84Mbe4NC9dLzk/dxMjMMq3Hfu5ZQfj
ylcf9Q4xMnEwHmKU4GBWEuE1C16ZJMSbklhZlVqUH19UmpNafIjRFOjsicxSosn5wDSTVxJv
aGZgamhiZmlgamlmrCTO61nQkSgkkJ5YkpqdmlqQWgTTx8TBKdXAVGqfM/9J7trGTYu3n9tg
4f+6KSlr6sv5XMxR4TEBV8I/7rsd7JjDtLRgWejBXSq/Yg8ucnnRobpMQmLKu7+l8w4sdJ5e
n8f+4FAJx0PWK3Z8z3gZsgMfSAh8i/HQWWHlZP/n3IatOxkaljuevx8hevV6r6pM/7bYL4+f
XWO0On3zzhMpv8Dj/J2lDRPLrV48XfZ+l131eaZHtncMtDR0BGf69/9MVEq8zXRhzi4HR9tl
uvb8L/QX3PeQOxcX4TXpQFrRw5kHIhfUbVCLWre/p64y6xDPxAI92YwA9VqRVy9Vf7von9cL
CGo44dS10dFQ0fvkjzXRh4KdJ2gE2554ryL78Ohj7jufGreXXkhtU2Ipzkg01GIuKk4EAHwS
U/N7AwAA
X-CMS-MailID: 20220615101951eucas1p238eb45e563bd9645af81bf16c56d98ec
X-Msg-Generator: CA
X-RootMTR: 20220615101951eucas1p238eb45e563bd9645af81bf16c56d98ec
X-EPHeader: CA
CMS-TYPE: 201P
X-CMS-RootMailID: 20220615101951eucas1p238eb45e563bd9645af81bf16c56d98ec
References: <20220615101920.329421-1-p.raghav@samsung.com>
Precedence: bulk
List-ID:
X-Mailing-List: linux-block@vger.kernel.org
From: Luis Chamberlain
Today dm-zoned relies on the assumption that you have a zone size
with a power of 2. Even though the block layer today enforces this
requirement, these devices do exist and so provide a stop-gap measure
to ensure these devices cannot be used by mistake
Reviewed-by: Hannes Reinecke
Signed-off-by: Luis Chamberlain
Signed-off-by: Pankaj Raghav
---
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 0ec5d8b9b..ad4228db5 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 = blk_queue_zone_sectors(q);
+ if (!is_power_of_2(zone_nr_sectors)) {
+ ti->error = "Zone size not power of 2";
+ return -EINVAL;
+ }
zoned_dev->zone_nr_sectors = zone_nr_sectors;
zoned_dev->nr_zones =
blkdev_nr_zones(zoned_dev->bdev->bd_disk);
@@ -806,6 +810,10 @@ static int dmz_fixup_devices(struct dm_target *ti)
q = bdev_get_queue(zoned_dev->bdev);
zoned_dev->zone_nr_sectors = blk_queue_zone_sectors(q);
zoned_dev->nr_zones = blkdev_nr_zones(zoned_dev->bdev->bd_disk);
+ if (!is_power_of_2(zoned_dev->zone_nr_sectors)) {
+ ti->error = "Zone size not power of 2";
+ return -EINVAL;
+ }
}
if (reg_dev) {
From patchwork Wed Jun 15 10:19:16 2022
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Pankaj Raghav
X-Patchwork-Id: 12882064
Return-Path:
X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on
aws-us-west-2-korg-lkml-1.web.codeaurora.org
Received: from vger.kernel.org (vger.kernel.org [23.128.96.18])
by smtp.lore.kernel.org (Postfix) with ESMTP id 60DB9C43334
for ; Wed, 15 Jun 2022 10:20:35 +0000 (UTC)
Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand
id S1347207AbiFOKUd (ORCPT );
Wed, 15 Jun 2022 06:20:33 -0400
Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37546 "EHLO
lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org
with ESMTP id S1347625AbiFOKUN (ORCPT
);
Wed, 15 Jun 2022 06:20:13 -0400
Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com
[210.118.77.12])
by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8DD0E4C429
for ;
Wed, 15 Jun 2022 03:19:58 -0700 (PDT)
Received: from eucas1p2.samsung.com (unknown [182.198.249.207])
by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id
20220615101957euoutp021d8395b7086d67e52a956b083fca05de~4xAb_oHpX2915529155euoutp02d
for ;
Wed, 15 Jun 2022 10:19:57 +0000 (GMT)
DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com
20220615101957euoutp021d8395b7086d67e52a956b083fca05de~4xAb_oHpX2915529155euoutp02d
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com;
s=mail20170921; t=1655288397;
bh=HHYtJL7MZ8mJp034AQQHrXH5XtcFjyCN4mgNmFKgAG8=;
h=From:To:Cc:Subject:Date:In-Reply-To:References:From;
b=Q6YMlDAXenX/cuoxfQW0lVotmTKVWJ6NUsScGHFoXpHaDcKk5elsjwhxyPDym6/YP
T2nw6Drce9TIZRDxnI8mNuWwoL5LxAYBx2InN6Hgw/+eap3a9SXX/dFx42ztSdbD8D
cP12bEUTq9iwCcRGjiWWT78ORrAhNBlmKLh7sWP8=
Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by
eucas1p2.samsung.com (KnoxPortal) with ESMTP id
20220615101955eucas1p2eee10b45941965e4935abb0ebb017993~4xAaUbccm1132211322eucas1p2C;
Wed, 15 Jun 2022 10:19:55 +0000 (GMT)
Received: from eucas1p2.samsung.com ( [182.198.249.207]) by
eusmges1new.samsung.com (EUCPMTA) with SMTP id 1E.3B.09664.B42B9A26;
Wed, 15
Jun 2022 11:19:55 +0100 (BST)
Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by
eucas1p1.samsung.com (KnoxPortal) with ESMTPA id
20220615101955eucas1p19b9d42ead7331f69f7dad1ec100312c2~4xAZ4G7zF1177311773eucas1p1q;
Wed, 15 Jun 2022 10:19:55 +0000 (GMT)
Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by
eusmtrp2.samsung.com (KnoxPortal) with ESMTP id
20220615101955eusmtrp2c7777997ad5bfc414e0f88aef0add88c~4xAZ3Pb9R0349503495eusmtrp28;
Wed, 15 Jun 2022 10:19:55 +0000 (GMT)
X-AuditID: cbfec7f2-d81ff700000025c0-14-62a9b24bd01e
Received: from eusmtip2.samsung.com ( [203.254.199.222]) by
eusmgms2.samsung.com (EUCPMTA) with SMTP id E8.24.09038.A42B9A26;
Wed, 15
Jun 2022 11:19:54 +0100 (BST)
Received: from localhost (unknown [106.210.248.244]) by eusmtip2.samsung.com
(KnoxPortal) with ESMTPA id
20220615101954eusmtip2aae9fd8bd11cf5ddb8d433d9ef34f41f~4xAZGNSD70755407554eusmtip2f;
Wed, 15 Jun 2022 10:19:54 +0000 (GMT)
From: Pankaj Raghav
To: hch@lst.de, snitzer@redhat.com, damien.lemoal@opensource.wdc.com,
axboe@kernel.dk
Cc: bvanassche@acm.org, linux-kernel@vger.kernel.org,
jiangbo.365@bytedance.com, hare@suse.de, pankydev8@gmail.com,
dm-devel@redhat.com, jonathan.derrick@linux.dev,
gost.dev@samsung.com, dsterba@suse.com, jaegeuk@kernel.org,
linux-nvme@lists.infradead.org, Johannes.Thumshirn@wdc.com,
linux-block@vger.kernel.org, Pankaj Raghav ,
Luis Chamberlain
Subject: [PATCH v7 09/13] dm-zone: use generic helpers to calculate offset
from zone start
Date: Wed, 15 Jun 2022 12:19:16 +0200
Message-Id: <20220615101920.329421-10-p.raghav@samsung.com>
X-Mailer: git-send-email 2.25.1
In-Reply-To: <20220615101920.329421-1-p.raghav@samsung.com>
MIME-Version: 1.0
X-Brightmail-Tracker:
H4sIAAAAAAAAA+NgFvrCKsWRmVeSWpSXmKPExsWy7djP87rem1YmGcx9J2+x+m4/m8W0Dz+Z
LX6fPc9ssffdbFaLCz8amSxuHtjJZLFn0SQmi5WrjzJZPFk/i9mi58AHFou/XfeAYi0PgYpv
aVtc3jWHzWL+sqfsFjcmPGW0+Ly0hd1izc2nLBZtG78yOgh7XL7i7fHvxBo2j52z7rJ7XD5b
6rFpVSebx8KGqcwem5fUe+y+2QCUa73P6vF+31U2j74tqxg91m+5yuKx+XS1x+dNch7tB7qZ
AvijuGxSUnMyy1KL9O0SuDIm7hMt2MtV8XvKbPYGxuMcXYycHBICJhK7f55g7WLk4hASWMEo
8Wr+R3YI5wujxIplj9kgnM+MEtO3HgMq4wBraT6qDBFfziix/ss+NpBRQgIvgZx5hiA1bAJa
Eo2d7CBhEYFwiaN77jGB2MwCfcwST17WgdjCAjEST782g41kEVCVuP64BiTMK2AtsXzCTBaI
4+QlZl76DjaGEyi+Y3YPK0SNoMTJmU9YIEbKSzRvnc0Mco6EwDlOiaWzG5ggml0kDi7fxQhh
C0u8Or6FHcKWkfi/cz5UTbXE0xu/oZpbGCX6d65ng/jRWqLvTA6IySygKbF+lz5EuaPE1ul3
WCAq+CRuvBWEOIFPYtK26cwQYV6JjjYhiGoliZ0/n0AtlZC43DQHqtNDov9/yARGxVlIfpmF
5JdZCGsXMDKvYhRPLS3OTU8tNsxLLdcrTswtLs1L10vOz93ECEyYp/8d/7SDce6rj3qHGJk4
GA8xSnAwK4nwmgWvTBLiTUmsrEotyo8vKs1JLT7EKM3BoiTOm5y5IVFIID2xJDU7NbUgtQgm
y8TBKdXA1PY4f6WvsEnbiw/3VMVT+qb9Uezhj/yeaKUutPnFoaDwuoPP3lcVxznOClQV2bG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SwNTSzFhJnNezoCNRSCA9sSQ1OzW1ILUIpo+Jg1OqgWnm4qZLge3dfFP7Tk3bt8fM
LK0keMM0Odc5fIvz3v5R+3Jqs51MavjaNQEls+SzPj98rauveXcL437umzLx+Z8+/v9x3Glb
a+VN2QsbUxdPtTixq6Ptrc/yFYkpHbnMOsflL5xq5r1sl/bSpLS0rPpgy1Pj93cPh39f/uWe
V6NOqE8c4y/P5ZtnNK5Y85b/tP7asJrsZ28OZAvdN7Q7Fem2bf3TBPd7euHP18Xcna2zunD+
yz8KTBd4Vq1r/Tcj+816t0kVSYn6sybLuf/6eCvfxGGfe5lE9seXNxfcuNEuN0Pjvv7mgk1T
Pp6oVk3td7D6s/zepNo96xR3Z3S8uelw9OJj3vyNTFdzOq7N/qkXqMRSnJFoqMVcVJwIAGEU
qwx3AwAA
X-CMS-MailID: 20220615101955eucas1p19b9d42ead7331f69f7dad1ec100312c2
X-Msg-Generator: CA
X-RootMTR: 20220615101955eucas1p19b9d42ead7331f69f7dad1ec100312c2
X-EPHeader: CA
CMS-TYPE: 201P
X-CMS-RootMailID: 20220615101955eucas1p19b9d42ead7331f69f7dad1ec100312c2
References: <20220615101920.329421-1-p.raghav@samsung.com>
Precedence: bulk
List-ID:
X-Mailing-List: linux-block@vger.kernel.org
Use the blk_queue_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
---
drivers/md/dm-zone.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/md/dm-zone.c b/drivers/md/dm-zone.c
index 3e7b1fe15..af36d33f9 100644
--- a/drivers/md/dm-zone.c
+++ b/drivers/md/dm-zone.c
@@ -395,7 +395,8 @@ 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 ((blk_queue_offset_from_zone_start(md->queue,
+ clone->bi_iter.bi_sector)) != zwp_offset)
return false;
break;
case REQ_OP_ZONE_APPEND:
@@ -608,10 +609,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)blk_queue_zone_sectors(q) - 1;
-
orig_bio->bi_iter.bi_sector +=
- clone->bi_iter.bi_sector & mask;
+ blk_queue_offset_from_zone_start(q, clone->bi_iter.bi_sector);
}
return;
From patchwork Wed Jun 15 10:19:17 2022
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Pankaj Raghav
X-Patchwork-Id: 12882065
Return-Path:
X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on
aws-us-west-2-korg-lkml-1.web.codeaurora.org
Received: from vger.kernel.org (vger.kernel.org [23.128.96.18])
by smtp.lore.kernel.org (Postfix) with ESMTP id 23310C43334
for ; Wed, 15 Jun 2022 10:20:53 +0000 (UTC)
Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand
id S1347470AbiFOKUt (ORCPT );
Wed, 15 Jun 2022 06:20:49 -0400
Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38210 "EHLO
lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org
with ESMTP id S1347656AbiFOKUO (ORCPT
);
Wed, 15 Jun 2022 06:20:14 -0400
Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com
[210.118.77.11])
by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4C7AC4CD77
for ;
Wed, 15 Jun 2022 03:20:05 -0700 (PDT)
Received: from eucas1p2.samsung.com (unknown [182.198.249.207])
by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id
20220615102003euoutp0142f46c91c1edc91a69b9b94fcb1ad330~4xAiFW5_E2495924959euoutp01q
for ;
Wed, 15 Jun 2022 10:20:03 +0000 (GMT)
DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com
20220615102003euoutp0142f46c91c1edc91a69b9b94fcb1ad330~4xAiFW5_E2495924959euoutp01q
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com;
s=mail20170921; t=1655288403;
bh=unj+wNyhFPITbvGE3viUqmlATeoyeQTs0Irz7fIV/Z8=;
h=From:To:Cc:Subject:Date:In-Reply-To:References:From;
b=UMJYiM24f2u4jVZwawNifTPoHmhTa9Y0J6Go84LX1a2mFNaUH8hACFq34d7Vag0MT
7aYGDjgzHXcq424+zu3U8k7RrZT3gsjSJf5XRliwGzJLHuXchC3L4+TyNbYfugIRRw
jDgsI4tCscbr7QPUKAHtRlSJM+he+n4b0quEXOIQ=
Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by
eucas1p1.samsung.com (KnoxPortal) with ESMTP id
20220615102001eucas1p14900ffba109adf1d6ad58fb31b6d3662~4xAgLQcWb1438314383eucas1p1Q;
Wed, 15 Jun 2022 10:20:01 +0000 (GMT)
Received: from eucas1p1.samsung.com ( [182.198.249.206]) by
eusmges2new.samsung.com (EUCPMTA) with SMTP id 0F.77.10067.152B9A26;
Wed, 15
Jun 2022 11:20:01 +0100 (BST)
Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by
eucas1p2.samsung.com (KnoxPortal) with ESMTPA id
20220615102000eucas1p27720aaa3c309327b2b9a33c5f840f498~4xAfSu7uw2162921629eucas1p2v;
Wed, 15 Jun 2022 10:20:00 +0000 (GMT)
Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by
eusmtrp2.samsung.com (KnoxPortal) with ESMTP id
20220615102000eusmtrp2756cf6a4b8bd2122ff7819f99032710c~4xAfRraCL0349503495eusmtrp2N;
Wed, 15 Jun 2022 10:20:00 +0000 (GMT)
X-AuditID: cbfec7f4-dc1ff70000002753-ba-62a9b251a009
Received: from eusmtip1.samsung.com ( [203.254.199.221]) by
eusmgms2.samsung.com (EUCPMTA) with SMTP id EF.24.09038.052B9A26;
Wed, 15
Jun 2022 11:20:00 +0100 (BST)
Received: from localhost (unknown [106.210.248.244]) by eusmtip1.samsung.com
(KnoxPortal) with ESMTPA id
20220615101959eusmtip1f228020010ced5b70c8bfdd433177605~4xAd8XbKh1152711527eusmtip1L;
Wed, 15 Jun 2022 10:19:59 +0000 (GMT)
From: Pankaj Raghav
To: hch@lst.de, snitzer@redhat.com, damien.lemoal@opensource.wdc.com,
axboe@kernel.dk
Cc: bvanassche@acm.org, linux-kernel@vger.kernel.org,
jiangbo.365@bytedance.com, hare@suse.de, pankydev8@gmail.com,
dm-devel@redhat.com, jonathan.derrick@linux.dev,
gost.dev@samsung.com, dsterba@suse.com, jaegeuk@kernel.org,
linux-nvme@lists.infradead.org, Johannes.Thumshirn@wdc.com,
linux-block@vger.kernel.org, Pankaj Raghav ,
Luis Chamberlain
Subject: [PATCH v7 10/13] dm-table: use bdev_is_zone_start helper in
device_area_is_invalid()
Date: Wed, 15 Jun 2022 12:19:17 +0200
Message-Id: <20220615101920.329421-11-p.raghav@samsung.com>
X-Mailer: git-send-email 2.25.1
In-Reply-To: <20220615101920.329421-1-p.raghav@samsung.com>
MIME-Version: 1.0
X-Brightmail-Tracker:
H4sIAAAAAAAAA+NgFvrJKsWRmVeSWpSXmKPExsWy7djPc7qBm1YmGfzar2ux+m4/m8W0Dz+Z
LX6fPc9ssffdbFaLCz8amSxuHtjJZLFn0SQmi5WrjzJZPFk/i9mi58AHFou/XfeAYi0PgYpv
aVtc3jWHzWL+sqfsFjcmPGW0+Ly0hd1izc2nLBZtG78yOgh7XL7i7fHvxBo2j52z7rJ7XD5b
6rFpVSebx8KGqcwem5fUe+y+2QCUa73P6vF+31U2j74tqxg91m+5yuKx+XS1x+dNch7tB7qZ
AvijuGxSUnMyy1KL9O0SuDLmNpxjL3jKVXGzbRlrA+Nlji5GTg4JAROJ6w/XsnUxcnEICaxg
lFj+/BWU84V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eucas1p27720aaa3c309327b2b9a33c5f840f498
X-EPHeader: CA
CMS-TYPE: 201P
X-CMS-RootMailID: 20220615102000eucas1p27720aaa3c309327b2b9a33c5f840f498
References: <20220615101920.329421-1-p.raghav@samsung.com>
Precedence: bulk
List-ID:
X-Mailing-List: linux-block@vger.kernel.org
Use bdev_is_zone_start() helper that uses generic calculation to check
for zone alignment instead of using po2 based alignment check.
Signed-off-by: Pankaj Raghav
Reviewed-by: Luis Chamberlain
---
drivers/md/dm-table.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
index bd539afbf..b553cdb6d 100644
--- a/drivers/md/dm-table.c
+++ b/drivers/md/dm-table.c
@@ -251,7 +251,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 (blk_queue_is_zone_start(bdev_get_queue(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,
@@ -268,7 +268,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 (blk_queue_is_zone_start(bdev_get_queue(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,
From patchwork Wed Jun 15 10:19:18 2022
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Pankaj Raghav
X-Patchwork-Id: 12882066
Return-Path:
X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on
aws-us-west-2-korg-lkml-1.web.codeaurora.org
Received: from vger.kernel.org (vger.kernel.org [23.128.96.18])
by smtp.lore.kernel.org (Postfix) with ESMTP id BE1ECC433EF
for ; Wed, 15 Jun 2022 10:20:58 +0000 (UTC)
Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand
id S1347680AbiFOKU5 (ORCPT );
Wed, 15 Jun 2022 06:20:57 -0400
Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38264 "EHLO
lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org
with ESMTP id S1347686AbiFOKUQ (ORCPT
);
Wed, 15 Jun 2022 06:20:16 -0400
Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com
[210.118.77.11])
by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 36BA74D6B2
for ;
Wed, 15 Jun 2022 03:20:08 -0700 (PDT)
Received: from eucas1p2.samsung.com (unknown [182.198.249.207])
by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id
20220615102007euoutp010ee730594c85c69b7edd786648d9cbc1~4xAk_8JIm2585525855euoutp01Y
for ;
Wed, 15 Jun 2022 10:20:07 +0000 (GMT)
DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com
20220615102007euoutp010ee730594c85c69b7edd786648d9cbc1~4xAk_8JIm2585525855euoutp01Y
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com;
s=mail20170921; t=1655288407;
bh=2x4a7MWIZaoS9EpNftzI215np6IWsBpMSE6yLnny6oA=;
h=From:To:Cc:Subject:Date:In-Reply-To:References:From;
b=oOCZSlvokOj7/McdYG//bVJvHaHOwivKCJeDdUua+DMrm/RdggDQ29r4RDa45qtu8
wPLBeekjhR++8wfNMyhqX4mZiPzzR5OlklmTJda08SUPDcbTNtFzJk6iyqmoT3E27Z
EmS+lMv60uxbaovAp9Y/NzPsIggmut5k62Yv36Fc=
Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by
eucas1p2.samsung.com (KnoxPortal) with ESMTP id
20220615102005eucas1p2e51799f03f95acf5c1f7703f8351de94~4xAjFUQzG2114721147eucas1p2r;
Wed, 15 Jun 2022 10:20:04 +0000 (GMT)
Received: from eucas1p2.samsung.com ( [182.198.249.207]) by
eusmges1new.samsung.com (EUCPMTA) with SMTP id 6A.4B.09664.452B9A26;
Wed, 15
Jun 2022 11:20:04 +0100 (BST)
Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by
eucas1p1.samsung.com (KnoxPortal) with ESMTPA id
20220615102004eucas1p1e458ea097d381058b16fc6daa3eec998~4xAipn0SG1175911759eucas1p1l;
Wed, 15 Jun 2022 10:20:04 +0000 (GMT)
Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by
eusmtrp2.samsung.com (KnoxPortal) with ESMTP id
20220615102004eusmtrp2ba89836fb0aa21ef02b3525c2b0f566c~4xAiouw-J0361403614eusmtrp2F;
Wed, 15 Jun 2022 10:20:04 +0000 (GMT)
X-AuditID: cbfec7f2-d97ff700000025c0-37-62a9b254e53c
Received: from eusmtip1.samsung.com ( [203.254.199.221]) by
eusmgms2.samsung.com (EUCPMTA) with SMTP id 63.34.09038.452B9A26;
Wed, 15
Jun 2022 11:20:04 +0100 (BST)
Received: from localhost (unknown [106.210.248.244]) by eusmtip1.samsung.com
(KnoxPortal) with ESMTPA id
20220615102003eusmtip1d5651274b4871f0239331522fba58745~4xAhxZ7w90653206532eusmtip1U;
Wed, 15 Jun 2022 10:20:03 +0000 (GMT)
From: Pankaj Raghav
To: hch@lst.de, snitzer@redhat.com, damien.lemoal@opensource.wdc.com,
axboe@kernel.dk
Cc: bvanassche@acm.org, linux-kernel@vger.kernel.org,
jiangbo.365@bytedance.com, hare@suse.de, pankydev8@gmail.com,
dm-devel@redhat.com, jonathan.derrick@linux.dev,
gost.dev@samsung.com, dsterba@suse.com, jaegeuk@kernel.org,
linux-nvme@lists.infradead.org, Johannes.Thumshirn@wdc.com,
linux-block@vger.kernel.org, Pankaj Raghav
Subject: [PATCH v7 11/13] dm-table: allow non po2 zoned devices
Date: Wed, 15 Jun 2022 12:19:18 +0200
Message-Id: <20220615101920.329421-12-p.raghav@samsung.com>
X-Mailer: git-send-email 2.25.1
In-Reply-To: <20220615101920.329421-1-p.raghav@samsung.com>
MIME-Version: 1.0
X-Brightmail-Tracker:
H4sIAAAAAAAAA+NgFvrCKsWRmVeSWpSXmKPExsWy7djP87ohm1YmGfT8trBYfbefzWLah5/M
Fr/Pnme22PtuNqvFhR+NTBY3D+xkstizaBKTxcrVR5ksnqyfxWzRc+ADi8XfrntAsZaHQMW3
tC0u75rDZjF/2VN2i89LW9gt1tx8ymLRtvEro4OQx+Ur3h7/Tqxh89g56y67x+WzpR6bVnWy
eSxsmMrssXlJvcfumw1Audb7rB7v911l8+jbsorRY/2Wqywem09Xe3zeJOfRfqCbKYA/issm
JTUnsyy1SN8ugSuj7+VjloLJvBVbNyxgaWC8xtXFyMkhIWAisbZnIWsXIxeHkMAKRontP3uh
nC+MEvfmb2aCcD4zSjzfep0VpuX/nW6oxHJGidYt/6Ccl4wS/18uZOxi5OBgE9CSaOxkB2kQ
EQiXOLrnHlgNs8ALJonFt+eCTRIWsJc4fPchWBGLgKrE08nvGEFsXgFriRXTvjBDbJOXmHnp
O1gNJ1B8x+weVogaQYmTM5+wgNjMQDXNW2czgyyQEDjFKTHn8yuoU10krmx7DTVIWOLV8S3s
ELaMxP+d85kg7GqJpzd+QzW3MEr071zPBvKBBNC2vjM5ICazgKbE+l36EOWOErdmP2eCqOCT
uPFWEOIEPolJ26YzQ4R5JTrahCCqlSR2/nwCtVRC4nLTHBaIEg+JzbOYJzAqzkLyyywkv8xC
WLuAkXkVo3hqaXFuemqxYV5quV5xYm5xaV66XnJ+7iZGYMI8/e/4px2Mc1991DvEyMTBeIhR
goNZSYTXLHhlkhBvSmJlVWpRfnxRaU5q8SFGaQ4WJXHe5MwNiUIC6YklqdmpqQWpRTBZJg5O
qQamKK/9um/e/jupPGOmQ/LsBLupL8/Ec7DWNEUmFd2ZWVD7T2mTFofy67+37m/WFhUunaXv
EL7/R2z9JuPvPu9XPChTXfhiWo1w06cmz+wtQt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ct12DbUWbio1Cz6x3t4ncua
GUItl5xyTF5/07x3uVKMR981dD9faUhh3v6XRiutYuJ9fl9ZI9DC5PEssnxitvdfYa/bvpfe
v/1VZPr291u2fRdv/bvKdMkmc/3PmnuZDkHPt++ut7FVsSg+8Vs1s3TD6gfXXq99tf9i8Prf
tlK/yz7v5vC9szB3y6qOzeGBH6O8L0pdydm9jndC4J3zJeydhYEm02/5f2wKv7XA00BLLz3E
Qs/ts//pWZGpYjy/WQ9+/vnkjvXdz/+S7Hs1Su4aBuqFp0x7PmUtJ8u0wLc7Nbvi+VIennvu
qL3q5dWlqUs9p/I3bBD+de70vRiPWd0Tzmyqbea8wbTDoUGJpTgj0VCLuag4EQDxEq7qdgMA
AA==
X-CMS-MailID: 20220615102004eucas1p1e458ea097d381058b16fc6daa3eec998
X-Msg-Generator: CA
X-RootMTR: 20220615102004eucas1p1e458ea097d381058b16fc6daa3eec998
X-EPHeader: CA
CMS-TYPE: 201P
X-CMS-RootMailID: 20220615102004eucas1p1e458ea097d381058b16fc6daa3eec998
References: <20220615101920.329421-1-p.raghav@samsung.com>
Precedence: bulk
List-ID:
X-Mailing-List: linux-block@vger.kernel.org
As the block layer now supports non po2 zoned devices, allow dm to
support non po2 zoned device.
Signed-off-by: Pankaj Raghav
---
drivers/md/dm-table.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
index b553cdb6d..ec77e7830 100644
--- a/drivers/md/dm-table.c
+++ b/drivers/md/dm-table.c
@@ -251,7 +251,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 (blk_queue_is_zone_start(bdev_get_queue(bdev), start)) {
+ if (!blk_queue_is_zone_start(bdev_get_queue(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,
@@ -268,7 +268,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 (blk_queue_is_zone_start(bdev_get_queue(bdev), len)) {
+ if (!blk_queue_is_zone_start(bdev_get_queue(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,
@@ -1648,7 +1648,7 @@ static int validate_hardware_zoned_model(struct dm_table *table,
}
/* 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(table, device_not_matches_zone_sectors, &zone_sectors)) {
From patchwork Wed Jun 15 10:19:19 2022
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Pankaj Raghav
X-Patchwork-Id: 12882067
Return-Path:
X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on
aws-us-west-2-korg-lkml-1.web.codeaurora.org
Received: from vger.kernel.org (vger.kernel.org [23.128.96.18])
by smtp.lore.kernel.org (Postfix) with ESMTP id AF35BC433EF
for ; Wed, 15 Jun 2022 10:21:06 +0000 (UTC)
Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand
id S1348053AbiFOKVF (ORCPT );
Wed, 15 Jun 2022 06:21:05 -0400
Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38278 "EHLO
lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org
with ESMTP id S1346842AbiFOKUQ (ORCPT
);
Wed, 15 Jun 2022 06:20:16 -0400
Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com
[210.118.77.11])
by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E05BF49F12
for ;
Wed, 15 Jun 2022 03:20:10 -0700 (PDT)
Received: from eucas1p2.samsung.com (unknown [182.198.249.207])
by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id
20220615102009euoutp017443cf770fe913490b44f043ad8c8c51~4xAnfI9h92495924959euoutp01w
for ;
Wed, 15 Jun 2022 10:20:09 +0000 (GMT)
DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com
20220615102009euoutp017443cf770fe913490b44f043ad8c8c51~4xAnfI9h92495924959euoutp01w
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com;
s=mail20170921; t=1655288409;
bh=kqhXofjv7uMNz96r4u8PvIfIck7OqraAvR3Oyb3bfow=;
h=From:To:Cc:Subject:Date:In-Reply-To:References:From;
b=WJ3t1W+eNQfrvwZKzB6amYZi431qe/H6WRpU+W9ElOALAawJ5yDpLXfRQjYIhr2zP
mDt7e+itcSQfQDlNqS/miA2ohP5oOlXdwVIXsdyKZua1/I8QddU5nK4OGfhY4T7WJP
j1nwLVSDhUA3OXNPwoDcF04QunxliyHRoG7AOm4w=
Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by
eucas1p2.samsung.com (KnoxPortal) with ESMTP id
20220615102008eucas1p2e85d5e1cf2fc269992852614bac65244~4xAl5vWjX0710507105eucas1p2n;
Wed, 15 Jun 2022 10:20:08 +0000 (GMT)
Received: from eucas1p2.samsung.com ( [182.198.249.207]) by
eusmges1new.samsung.com (EUCPMTA) with SMTP id DD.4B.09664.752B9A26;
Wed, 15
Jun 2022 11:20:07 +0100 (BST)
Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by
eucas1p1.samsung.com (KnoxPortal) with ESMTPA id
20220615102007eucas1p1106f9520e2a86beb3792107dffd8071b~4xAlg-xfo0963309633eucas1p1M;
Wed, 15 Jun 2022 10:20:07 +0000 (GMT)
Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by
eusmtrp2.samsung.com (KnoxPortal) with ESMTP id
20220615102007eusmtrp2669d4daff88954051642382b44d5908f~4xAlgN9xL0361403614eusmtrp2O;
Wed, 15 Jun 2022 10:20:07 +0000 (GMT)
X-AuditID: cbfec7f2-d81ff700000025c0-42-62a9b2577ce6
Received: from eusmtip2.samsung.com ( [203.254.199.222]) by
eusmgms2.samsung.com (EUCPMTA) with SMTP id 96.34.09038.752B9A26;
Wed, 15
Jun 2022 11:20:07 +0100 (BST)
Received: from localhost (unknown [106.210.248.244]) by eusmtip2.samsung.com
(KnoxPortal) with ESMTPA id
20220615102006eusmtip2a812fe6e28f7649ef0489c27adfb5e9f~4xAkoisYR0472904729eusmtip2d;
Wed, 15 Jun 2022 10:20:06 +0000 (GMT)
From: Pankaj Raghav
To: hch@lst.de, snitzer@redhat.com, damien.lemoal@opensource.wdc.com,
axboe@kernel.dk
Cc: bvanassche@acm.org, linux-kernel@vger.kernel.org,
jiangbo.365@bytedance.com, hare@suse.de, pankydev8@gmail.com,
dm-devel@redhat.com, jonathan.derrick@linux.dev,
gost.dev@samsung.com, dsterba@suse.com, jaegeuk@kernel.org,
linux-nvme@lists.infradead.org, Johannes.Thumshirn@wdc.com,
linux-block@vger.kernel.org, Pankaj Raghav
Subject: [PATCH v7 12/13] dm: call dm_zone_endio after the target endio
callback for zoned devices
Date: Wed, 15 Jun 2022 12:19:19 +0200
Message-Id: <20220615101920.329421-13-p.raghav@samsung.com>
X-Mailer: git-send-email 2.25.1
In-Reply-To: <20220615101920.329421-1-p.raghav@samsung.com>
MIME-Version: 1.0
X-Brightmail-Tracker:
H4sIAAAAAAAAA+NgFvrCKsWRmVeSWpSXmKPExsWy7djP87rhm1YmGXTvMLdYfbefzWLah5/M
Fr/Pnme22PtuNqvFhR+NTBY3D+xkstizaBKTxcrVR5ksnqyfxWzRc+ADi8XfrntAsZaHQMW3
tC0u75rDZjF/2VN2i89LW9gt1tx8ymLRtvEro4OQx+Ur3h7/Tqxh89g56y67x+WzpR6bVnWy
eSxsmMrssXlJvcfumw1Audb7rB7v911l8+jbsorRY/2Wqywem09Xe3zeJOfRfqCbKYA/issm
JTUnsyy1SN8ugStj0d925oK/vBWr2neyNTDu4O5i5OSQEDCR6J+/lLmLkYtDSG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ootMTR: 20220615102007eucas1p1106f9520e2a86beb3792107dffd8071b
X-EPHeader: CA
CMS-TYPE: 201P
X-CMS-RootMailID: 20220615102007eucas1p1106f9520e2a86beb3792107dffd8071b
References: <20220615101920.329421-1-p.raghav@samsung.com>
Precedence: bulk
List-ID:
X-Mailing-List: linux-block@vger.kernel.org
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. Call dm_zone_endio for zoned devices
after calling the target's endio function
Signed-off-by: Pankaj Raghav
---
@Damien and @Hannes: I couldn't come up with a testcase that uses endio callback and
zone append or append emulation for zoned devices to test for
regression in this change. It would be great if you can suggest
something. This change is required for the npo2 target as we update the
clone bio sector in the endio callback function and the orig bio should
be updated only after the endio callback for zone appends.
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 3f17fe1de..3a74e1038 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -1025,10 +1025,6 @@ static void clone_endio(struct bio *bio)
disable_write_zeroes(md);
}
- if (static_branch_unlikely(&zoned_enabled) &&
- unlikely(blk_queue_is_zoned(bdev_get_queue(bio->bi_bdev))))
- dm_zone_endio(io, bio);
-
if (endio) {
int r = endio(ti, bio, &error);
switch (r) {
@@ -1057,6 +1053,10 @@ static void clone_endio(struct bio *bio)
}
}
+ if (static_branch_unlikely(&zoned_enabled) &&
+ unlikely(blk_queue_is_zoned(bdev_get_queue(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 Jun 15 10:19:20 2022
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Pankaj Raghav
X-Patchwork-Id: 12882068
Return-Path:
X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on
aws-us-west-2-korg-lkml-1.web.codeaurora.org
Received: from vger.kernel.org (vger.kernel.org [23.128.96.18])
by smtp.lore.kernel.org (Postfix) with ESMTP id 87F1CCCA473
for ; Wed, 15 Jun 2022 10:21:13 +0000 (UTC)
Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand
id S1347586AbiFOKVM (ORCPT );
Wed, 15 Jun 2022 06:21:12 -0400
Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37534 "EHLO
lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org
with ESMTP id S240029AbiFOKUR (ORCPT
);
Wed, 15 Jun 2022 06:20:17 -0400
Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com
[210.118.77.12])
by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AF2904B403
for ;
Wed, 15 Jun 2022 03:20:14 -0700 (PDT)
Received: from eucas1p1.samsung.com (unknown [182.198.249.206])
by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id
20220615102013euoutp027c77c8587d2774bf17f2d65f2a1ae8c9~4xArAmwzB2943629436euoutp02T
for ;
Wed, 15 Jun 2022 10:20:13 +0000 (GMT)
DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com
20220615102013euoutp027c77c8587d2774bf17f2d65f2a1ae8c9~4xArAmwzB2943629436euoutp02T
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com;
s=mail20170921; t=1655288413;
bh=QqPz2OWxGMD8uCb8jReBS97cNwDJ8EJVxZGORNAnUdo=;
h=From:To:Cc:Subject:Date:In-Reply-To:References:From;
b=iLL5b2vtEgRJs2TbtMn9Tfo2u6mfRMBjIEUbDaAVM8O2ra6qhVb8CN7i92Syp285T
1tB3K29ZU3LEKvLqDz4oLxcPTQx1IpMHw1YactdVZmnKeExd01JhV71AzixJek0QV2
WGG578YKOhha7MRRlh8xxpC1DqdlyjjP/gd4eV8Y=
Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by
eucas1p2.samsung.com (KnoxPortal) with ESMTP id
20220615102011eucas1p27927ddf4d6c43741b27aa5073cb46fc2~4xApc1BVV1912519125eucas1p2M;
Wed, 15 Jun 2022 10:20:11 +0000 (GMT)
Received: from eucas1p2.samsung.com ( [182.198.249.207]) by
eusmges1new.samsung.com (EUCPMTA) with SMTP id 10.5B.09664.B52B9A26;
Wed, 15
Jun 2022 11:20:11 +0100 (BST)
Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by
eucas1p2.samsung.com (KnoxPortal) with ESMTPA id
20220615102011eucas1p220368db4a186181b1927dea50a79e5d4~4xAo7795N0710507105eucas1p2s;
Wed, 15 Jun 2022 10:20:11 +0000 (GMT)
Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by
eusmtrp2.samsung.com (KnoxPortal) with ESMTP id
20220615102011eusmtrp2227b720bc5fb53cd1c83b1d6c4bc4bce~4xAo6uDdB0361403614eusmtrp2W;
Wed, 15 Jun 2022 10:20:11 +0000 (GMT)
X-AuditID: cbfec7f2-d81ff700000025c0-4c-62a9b25bf383
Received: from eusmtip2.samsung.com ( [203.254.199.222]) by
eusmgms1.samsung.com (EUCPMTA) with SMTP id 2A.65.09095.B52B9A26;
Wed, 15
Jun 2022 11:20:11 +0100 (BST)
Received: from localhost (unknown [106.210.248.244]) by eusmtip2.samsung.com
(KnoxPortal) with ESMTPA id
20220615102010eusmtip2dbad86de53e6f9e7136701b3cc5cabba~4xAnvRvtz0472904729eusmtip2g;
Wed, 15 Jun 2022 10:20:09 +0000 (GMT)
From: Pankaj Raghav
To: hch@lst.de, snitzer@redhat.com, damien.lemoal@opensource.wdc.com,
axboe@kernel.dk
Cc: bvanassche@acm.org, linux-kernel@vger.kernel.org,
jiangbo.365@bytedance.com, hare@suse.de, pankydev8@gmail.com,
dm-devel@redhat.com, jonathan.derrick@linux.dev,
gost.dev@samsung.com, dsterba@suse.com, jaegeuk@kernel.org,
linux-nvme@lists.infradead.org, Johannes.Thumshirn@wdc.com,
linux-block@vger.kernel.org, Pankaj Raghav ,
Johannes Thumshirn ,
Damien Le Moal
Subject: [PATCH v7 13/13] dm: add non power of 2 zoned target
Date: Wed, 15 Jun 2022 12:19:20 +0200
Message-Id: <20220615101920.329421-14-p.raghav@samsung.com>
X-Mailer: git-send-email 2.25.1
In-Reply-To: <20220615101920.329421-1-p.raghav@samsung.com>
MIME-Version: 1.0
X-Brightmail-Tracker:
H4sIAAAAAAAAA+NgFvrJKsWRmVeSWpSXmKPExsWy7djP87rRm1YmGezfr2mx+m4/m8W0Dz+Z
LX6fPc9s0dr+jcli77vZrBYXfjQyWdw8sJPJYs+iSUwWK1cfZbJ4sn4Ws0XPgQ8sFn+77gHF
Wh4yW+y9pW1xedccNov5y56yW3xe2sJusebmUxaLto1fGR2EPS5f8fb4d2INm8fOWXfZPS6f
LfXYtKqTzWNhw1Rmj81L6j1232wAyrXeZ/V4v+8qm0ffllWMHuu3XGXx2Hy62uPzJjmP9gPd
TAH8UVw2Kak5mWWpRfp2CVwZvV3rmAo6oyvObWplaWDc4NXFyMkhIWAicfrNfcYuRi4OIYEV
jBJfdjezQThfGCX+n21kgXA+M0p0z73MCNNyaflpJojEckaJGU8WQzkvGSWmXf8I1MLBwSag
JdHYyQ7SICIQLnF0zz2wGmaBw8wSt1d2gyWEBWwlNm59xAZiswioSmw884QFxOYVsJY48/M/
O8Q2eYmZl76D2ZxA8R2ze1ghagQlTs6EqGcGqmneOpsZov4Sp8Smbh0I20Vi3q0DLBC2sMSr
41ugZspI/N85nwnCrpZ4euM3M8hxEgItjBL9O9ezgTwgAbSs70wOiMksoCmxfpc+RLmjxKqW
J4wQFXwSN94KQlzAJzFp23RmiDCvREebEES1ksTOn0+glkpIXG6aA3WMh8Sp80uYJjAqzkLy
yywkv8xC2LuAkXkVo3hqaXFuemqxYV5quV5xYm5xaV66XnJ+7iZGYOo8/e/4px2Mc1991DvE
yM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
QrQyA5U3b53NPIFRYBaS1CwkqQWMTKsYRVJLi3PTc4sN9YoTc4tL89L1kvNzNzECY3zbsZ+b
dzDOe/VR7xAjEwfjIUYJDmYlEV6z4JVJQrwpiZVVqUX58UWlOanFhxhNgc6eyCwlmpwPTDJ5
JfGGZgamhiZmlgamlmbGSuK8ngUdiUIC6YklqdmpqQWpRTB9TBycUg1MLusnXT7wbF+fdX9z
bOnsuTFXu3c7rQkRVUkTvBvSKJ7DveVO0Zm9Z6Yq28vtPDnvtqqLQcUkMT1LjhfnbaZ4CnF0
ZZ+YuOCf8iqJU1EelhXvZta28v4+m3VbhHlS3xH2rsu5SvoWHQF9lzzkNzGVFk7gij+8Lt9S
/UuK0GcNg9snWh4KJH9lP3Ne/ajFvl+JjUznE7+5z14jcS3pZYltaruhfeC21umzY2/29fba
7+9a/8R3bt6eEBsZl4k9O6vuq57dOPcnO6/uTjb7J5sa86sbul6XK1f9Loq+Y/ezKPKdn6/V
xd6jfW/Ot+/Zrb7ewDXVMDF+7/TzAfGvLjk9/BHp8vTx7hX1lTkJ5dFKLMUZiYZazEXFiQDr
6t5jegMAAA==
X-CMS-MailID: 20220615102011eucas1p220368db4a186181b1927dea50a79e5d4
X-Msg-Generator: CA
X-RootMTR: 20220615102011eucas1p220368db4a186181b1927dea50a79e5d4
X-EPHeader: CA
CMS-TYPE: 201P
X-CMS-RootMailID: 20220615102011eucas1p220368db4a186181b1927dea50a79e5d4
References: <20220615101920.329421-1-p.raghav@samsung.com>
Precedence: bulk
List-ID:
X-Mailing-List: linux-block@vger.kernel.org
Only power of 2(po2) zoned devices were supported in linux but now non
power of 2(npo2) zoned device support has been added to the block layer.
Filesystems such as F2FS and btrfs have support for zoned devices with
po2 zone size assumption. Before adding native support for npo2 zoned
devices, it was suggested to create a dm target for npo2 zoned device to
appear as po2 device so that file systems can initially work without any
explicit changes by using this target.
The design of this target is very simple: introduce gaps between the zone
capacity and the po2 zone size of the underlying device. All IOs will be
remapped from target to the actual device location. For devices that use
zone append, the bi_sector is remapped from device to target's layout.
The read IOs that fall in the "emulated" gap area will return 0 and all
the other IOs in that area will result in an error. If an read IO span
across the zone capacity boundary, then the IOs are split between the
boundary. All other IO operations that span across a zone capacity
boundary will result in an error.
The target can be easily updated as follows:
dmsetup create