From: Chaitanya Kulkarni <kch@nvidia.com>
To: <linux-block@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Cc: <axboe@kernel.dk>, <damien.lemoal@opensource.wdc.com>,
<bvanassche@acm.org>, <shinichiro.kawasaki@wdc.com>,
<vincent.fu@samsung.com>, Chaitanya Kulkarni <kch@nvidia.com>
Subject: [PATCH V4 8/8] null-blk: allow REQ_OP_ZONE_RESET_ALL to configure
Date: Tue, 29 Nov 2022 15:28:13 -0800 [thread overview]
Message-ID: <20221129232813.37968-9-kch@nvidia.com> (raw)
In-Reply-To: <20221129232813.37968-1-kch@nvidia.com>
For a Zoned Block Device zone reset all is emulated if underlaying
device doesn't support REQ_OP_ZONE_RESET_ALL operation. In null_blk
Zoned mode there is no way to test zone reset all emulation present in
the block layer since we enable it by default :-
blkdev_zone_mgmt()
blkdev_zone_reset_all_emulation() <---
blkdev_zone_reset_all()
Add a module parameter zone_reset_all to enable or disable
REQ_OP_ZONE_RESET_ALL, enable it by default to retain the existing
behaviour.
Signed-off-by: Chaitanya Kulkarni <kch@nvidia.com>
Reviewed-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
---
drivers/block/null_blk/main.c | 9 ++++++++-
drivers/block/null_blk/null_blk.h | 1 +
drivers/block/null_blk/zoned.c | 3 ++-
3 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/drivers/block/null_blk/main.c b/drivers/block/null_blk/main.c
index 8b7f42024f14..5dc69f42b46c 100644
--- a/drivers/block/null_blk/main.c
+++ b/drivers/block/null_blk/main.c
@@ -260,6 +260,10 @@ static unsigned int g_zone_max_active;
module_param_named(zone_max_active, g_zone_max_active, uint, 0444);
MODULE_PARM_DESC(zone_max_active, "Maximum number of active zones when block device is zoned. Default: 0 (no limit)");
+static bool g_zone_reset_all = true;
+module_param_named(zone_reset_all, g_zone_reset_all, bool, 0444);
+MODULE_PARM_DESC(zone_reset_all, "Allow REQ_OP_ZONE_RESET_ALL. Default: true");
+
static struct nullb_device *null_alloc_dev(void);
static void null_free_dev(struct nullb_device *dev);
static void null_del_dev(struct nullb *nullb);
@@ -446,6 +450,7 @@ NULLB_DEVICE_ATTR(zone_capacity, ulong, NULL);
NULLB_DEVICE_ATTR(zone_nr_conv, uint, NULL);
NULLB_DEVICE_ATTR(zone_max_open, uint, NULL);
NULLB_DEVICE_ATTR(zone_max_active, uint, NULL);
+NULLB_DEVICE_ATTR(zone_reset_all, bool, NULL);
NULLB_DEVICE_ATTR(virt_boundary, bool, NULL);
NULLB_DEVICE_ATTR(no_sched, bool, NULL);
NULLB_DEVICE_ATTR(shared_tag_bitmap, bool, NULL);
@@ -574,6 +579,7 @@ static struct configfs_attribute *nullb_device_attrs[] = {
&nullb_device_attr_zone_nr_conv,
&nullb_device_attr_zone_max_open,
&nullb_device_attr_zone_max_active,
+ &nullb_device_attr_zone_reset_all,
&nullb_device_attr_virt_boundary,
&nullb_device_attr_no_sched,
&nullb_device_attr_shared_tag_bitmap,
@@ -639,7 +645,7 @@ static ssize_t memb_group_features_show(struct config_item *item, char *page)
"poll_queues,power,queue_mode,shared_tag_bitmap,size,"
"submit_queues,use_per_node_hctx,virt_boundary,zoned,"
"zone_capacity,zone_max_active,zone_max_open,"
- "zone_nr_conv,zone_size,write_zeroes\n");
+ "zone_nr_conv,zone_size,zone_reset_all,write_zeroes\n");
}
CONFIGFS_ATTR_RO(memb_group_, features);
@@ -715,6 +721,7 @@ static struct nullb_device *null_alloc_dev(void)
dev->zone_nr_conv = g_zone_nr_conv;
dev->zone_max_open = g_zone_max_open;
dev->zone_max_active = g_zone_max_active;
+ dev->zone_reset_all = g_zone_reset_all;
dev->virt_boundary = g_virt_boundary;
dev->no_sched = g_no_sched;
dev->shared_tag_bitmap = g_shared_tag_bitmap;
diff --git a/drivers/block/null_blk/null_blk.h b/drivers/block/null_blk/null_blk.h
index e692c2a7369e..e7efe8de4ebf 100644
--- a/drivers/block/null_blk/null_blk.h
+++ b/drivers/block/null_blk/null_blk.h
@@ -115,6 +115,7 @@ struct nullb_device {
bool discard; /* if support discard */
bool write_zeroes; /* if support write_zeroes */
bool zoned; /* if device is zoned */
+ bool zone_reset_all; /* if support REQ_OP_ZONE_RESET_ALL */
bool virt_boundary; /* virtual boundary on/off for the device */
bool no_sched; /* no IO scheduler for the device */
bool shared_tag_bitmap; /* use hostwide shared tags */
diff --git a/drivers/block/null_blk/zoned.c b/drivers/block/null_blk/zoned.c
index 55a69e48ef8b..7310d1c3f9ec 100644
--- a/drivers/block/null_blk/zoned.c
+++ b/drivers/block/null_blk/zoned.c
@@ -160,7 +160,8 @@ int null_register_zoned_dev(struct nullb *nullb)
struct request_queue *q = nullb->q;
disk_set_zoned(nullb->disk, BLK_ZONED_HM);
- blk_queue_flag_set(QUEUE_FLAG_ZONE_RESETALL, q);
+ if (dev->zone_reset_all)
+ blk_queue_flag_set(QUEUE_FLAG_ZONE_RESETALL, q);
blk_queue_required_elevator_features(q, ELEVATOR_F_ZBD_SEQ_WRITE);
if (queue_is_mq(q)) {
--
2.29.0
prev parent reply other threads:[~2022-11-29 23:30 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-29 23:28 [PATCH V4 0/7] null_blk: allow REQ_OP_WRITE_ZEROES and cleanup Chaitanya Kulkarni
2022-11-29 23:28 ` [PATCH V4 1/8] null_blk: allow REQ_OP_WRITE_ZEROES Chaitanya Kulkarni
2022-11-30 7:59 ` Shinichiro Kawasaki
2022-11-30 23:29 ` Chaitanya Kulkarni
2022-12-01 1:21 ` Shinichiro Kawasaki
2022-11-29 23:28 ` [PATCH V4 2/8] null_blk: code cleaup Chaitanya Kulkarni
2022-11-30 8:00 ` Shinichiro Kawasaki
2022-11-29 23:28 ` [PATCH V4 3/8] null_blk: initialize cmd->bio in __alloc_cmd() Chaitanya Kulkarni
2022-11-30 8:01 ` Shinichiro Kawasaki
2022-11-29 23:28 ` [PATCH V4 4/8] null_blk: don't use magic numbers in the code Chaitanya Kulkarni
2022-11-29 23:28 ` [PATCH V4 5/8] null_blk: remove extra space in switch condition Chaitanya Kulkarni
2022-11-29 23:28 ` [PATCH V4 6/8] null_blk: add param to set max disacrd sectors Chaitanya Kulkarni
2022-11-30 8:07 ` Shinichiro Kawasaki
2022-11-29 23:28 ` [PATCH V4 7/8] null_blk: add param to set max write-zeroes sects Chaitanya Kulkarni
2022-11-30 8:09 ` Shinichiro Kawasaki
2022-11-29 23:28 ` Chaitanya Kulkarni [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221129232813.37968-9-kch@nvidia.com \
--to=kch@nvidia.com \
--cc=axboe@kernel.dk \
--cc=bvanassche@acm.org \
--cc=damien.lemoal@opensource.wdc.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=shinichiro.kawasaki@wdc.com \
--cc=vincent.fu@samsung.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox