* [PATCH V2] null-blk: allow REQ_OP_ZONE_RESET_ALL to configure
@ 2022-11-15 1:10 Chaitanya Kulkarni
2022-11-15 2:20 ` Damien Le Moal
0 siblings, 1 reply; 2+ messages in thread
From: Chaitanya Kulkarni @ 2022-11-15 1:10 UTC (permalink / raw)
To: linux-block; +Cc: axboe, vincent.fu, Chaitanya Kulkarni, Damien Le Moal
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.
Reviewed-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Signed-off-by: Chaitanya Kulkarni <kch@nvidia.com>
---
v1-v2:-
Add configfs parameter to set the zone reset all.
---
drivers/block/null_blk/main.c | 7 +++++++
drivers/block/null_blk/null_blk.h | 1 +
drivers/block/null_blk/zoned.c | 3 ++-
3 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/drivers/block/null_blk/main.c b/drivers/block/null_blk/main.c
index 8b7f42024f14..995449919d5e 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,
@@ -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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH V2] null-blk: allow REQ_OP_ZONE_RESET_ALL to configure
2022-11-15 1:10 [PATCH V2] null-blk: allow REQ_OP_ZONE_RESET_ALL to configure Chaitanya Kulkarni
@ 2022-11-15 2:20 ` Damien Le Moal
0 siblings, 0 replies; 2+ messages in thread
From: Damien Le Moal @ 2022-11-15 2:20 UTC (permalink / raw)
To: Chaitanya Kulkarni, linux-block; +Cc: axboe, vincent.fu
On 11/15/22 10:10, Chaitanya Kulkarni wrote:
> 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.
>
> Reviewed-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
> Signed-off-by: Chaitanya Kulkarni <kch@nvidia.com>
> ---
> v1-v2:-
>
> Add configfs parameter to set the zone reset all.
>
> ---
> drivers/block/null_blk/main.c | 7 +++++++
> drivers/block/null_blk/null_blk.h | 1 +
> drivers/block/null_blk/zoned.c | 3 ++-
> 3 files changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/block/null_blk/main.c b/drivers/block/null_blk/main.c
> index 8b7f42024f14..995449919d5e 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,
I think you forgot to list this new parameter in
memb_group_features_show(), no ?
> &nullb_device_attr_virt_boundary,
> &nullb_device_attr_no_sched,
> &nullb_device_attr_shared_tag_bitmap,
> @@ -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)) {
--
Damien Le Moal
Western Digital Research
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-11-15 2:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-15 1:10 [PATCH V2] null-blk: allow REQ_OP_ZONE_RESET_ALL to configure Chaitanya Kulkarni
2022-11-15 2:20 ` Damien Le Moal
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.