On Thu, Jul 27, 2023 at 2:22 AM Bart Van Assche <bvanassche@xxxxxxx> wrote: > > Add a new configfs attribute for disabling zone write locking. Tests > show a performance of 250 K IOPS with no I/O scheduler, 6 K IOPS with > mq-deadline and write locking enabled and 123 K IOPS with mq-deadline > and write locking disabled. This shows that disabling write locking > results in about 20 times more IOPS for this particular test case. > > Cc: Christoph Hellwig <hch@xxxxxx> > Cc: Damien Le Moal <dlemoal@xxxxxxxxxx> > Cc: Ming Lei <ming.lei@xxxxxxxxxx> > Signed-off-by: Bart Van Assche <bvanassche@xxxxxxx> > --- > drivers/block/null_blk/main.c | 2 ++ > drivers/block/null_blk/null_blk.h | 1 + > drivers/block/null_blk/zoned.c | 3 +++ > 3 files changed, 6 insertions(+) > > diff --git a/drivers/block/null_blk/main.c b/drivers/block/null_blk/main.c > index 864013019d6b..5c0578137f51 100644 > --- a/drivers/block/null_blk/main.c > +++ b/drivers/block/null_blk/main.c > @@ -424,6 +424,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(no_zone_write_lock, bool, NULL); > NULLB_DEVICE_ATTR(virt_boundary, bool, NULL); > NULLB_DEVICE_ATTR(no_sched, bool, NULL); > NULLB_DEVICE_ATTR(shared_tag_bitmap, bool, NULL); > @@ -569,6 +570,7 @@ static struct configfs_attribute *nullb_device_attrs[] = { > &nullb_device_attr_zone_max_active, > &nullb_device_attr_zone_readonly, > &nullb_device_attr_zone_offline, > + &nullb_device_attr_no_zone_write_lock, > &nullb_device_attr_virt_boundary, > &nullb_device_attr_no_sched, > &nullb_device_attr_shared_tag_bitmap, > diff --git a/drivers/block/null_blk/null_blk.h b/drivers/block/null_blk/null_blk.h > index 929f659dd255..b521096bcc3f 100644 > --- a/drivers/block/null_blk/null_blk.h > +++ b/drivers/block/null_blk/null_blk.h > @@ -117,6 +117,7 @@ struct nullb_device { > bool memory_backed; /* if data is stored in memory */ > bool discard; /* if support discard */ > bool zoned; /* if device is zoned */ > + bool no_zone_write_lock; > 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 55c5b48bc276..31c8364a63e9 100644 > --- a/drivers/block/null_blk/zoned.c > +++ b/drivers/block/null_blk/zoned.c > @@ -96,6 +96,9 @@ int null_init_zoned_dev(struct nullb_device *dev, struct request_queue *q) > > spin_lock_init(&dev->zone_res_lock); > > + if (dev->no_zone_write_lock) > + blk_queue_flag_set(QUEUE_FLAG_NO_ZONE_WRITE_LOCK, q); > + > if (dev->zone_nr_conv >= dev->nr_zones) { > dev->zone_nr_conv = dev->nr_zones - 1; > pr_info("changed the number of conventional zones to %u", Reviewed-by: Nitesh Shetty <nj.shetty@xxxxxxxxxxx>