linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche@acm.org>
To: Jens Axboe <axboe@kernel.dk>
Cc: linux-block@vger.kernel.org, linux-scsi@vger.kernel.org,
	Jaegeuk Kim <jaegeuk@kernel.org>, Christoph Hellwig <hch@lst.de>,
	Bart Van Assche <bvanassche@acm.org>,
	Damien Le Moal <dlemoal@kernel.org>,
	Ming Lei <ming.lei@redhat.com>
Subject: [PATCH v7 1/7] block: Introduce the use_zone_write_lock member variable
Date: Wed,  9 Aug 2023 13:23:42 -0700	[thread overview]
Message-ID: <20230809202355.1171455-2-bvanassche@acm.org> (raw)
In-Reply-To: <20230809202355.1171455-1-bvanassche@acm.org>

Writes in sequential write required zones must happen at the write
pointer. Even if the submitter of the write commands (e.g. a filesystem)
submits writes for sequential write required zones in order, the block
layer or the storage controller may reorder these write commands.

The zone locking mechanism in the mq-deadline I/O scheduler serializes
write commands for sequential zones. Some but not all storage controllers
require this serialization. Introduce a new request queue limit member
variable to allow block drivers to indicate that they preserve the order
of write commands and thus do not require serialization of writes per
zone.

Cc: Damien Le Moal <dlemoal@kernel.org>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 block/blk-settings.c   | 6 ++++++
 include/linux/blkdev.h | 1 +
 2 files changed, 7 insertions(+)

diff --git a/block/blk-settings.c b/block/blk-settings.c
index 0046b447268f..b75c97971860 100644
--- a/block/blk-settings.c
+++ b/block/blk-settings.c
@@ -56,6 +56,7 @@ void blk_set_default_limits(struct queue_limits *lim)
 	lim->alignment_offset = 0;
 	lim->io_opt = 0;
 	lim->misaligned = 0;
+	lim->use_zone_write_lock = true;
 	lim->zoned = BLK_ZONED_NONE;
 	lim->zone_write_granularity = 0;
 	lim->dma_alignment = 511;
@@ -685,6 +686,11 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b,
 						   b->max_secure_erase_sectors);
 	t->zone_write_granularity = max(t->zone_write_granularity,
 					b->zone_write_granularity);
+	/*
+	 * Whether or not the zone write lock should be used depends on the
+	 * bottom driver only.
+	 */
+	t->use_zone_write_lock = b->use_zone_write_lock;
 	t->zoned = max(t->zoned, b->zoned);
 	return ret;
 }
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 2f5371b8482c..deffa1f13444 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -316,6 +316,7 @@ struct queue_limits {
 	unsigned char		misaligned;
 	unsigned char		discard_misaligned;
 	unsigned char		raid_partial_stripes_expensive;
+	bool			use_zone_write_lock;
 	enum blk_zoned_model	zoned;
 
 	/*

  reply	other threads:[~2023-08-09 20:24 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-09 20:23 [PATCH v7 0/7] Improve performance for zoned UFS devices Bart Van Assche
2023-08-09 20:23 ` Bart Van Assche [this message]
2023-08-10  1:33   ` [PATCH v7 1/7] block: Introduce the use_zone_write_lock member variable Damien Le Moal
2023-08-10 14:02     ` Bart Van Assche
2023-08-11  0:39       ` Damien Le Moal
2023-08-11 15:41         ` Bart Van Assche
2023-08-12  2:44           ` Damien Le Moal
2023-08-09 20:23 ` [PATCH v7 2/7] block/mq-deadline: Only use zone locking if necessary Bart Van Assche
2023-08-10  1:36   ` Damien Le Moal
2023-08-10 14:00     ` Bart Van Assche
2023-08-11  0:45       ` Damien Le Moal
2023-08-11 15:49         ` Bart Van Assche
2023-08-12  2:49           ` Damien Le Moal
2023-08-09 20:23 ` [PATCH v7 3/7] scsi: core: Retry unaligned zoned writes Bart Van Assche
2023-08-11 13:29   ` Christoph Hellwig
2023-08-09 20:23 ` [PATCH v7 4/7] scsi: scsi_debug: Support disabling zone write locking Bart Van Assche
2023-08-09 20:23 ` [PATCH v7 5/7] scsi: scsi_debug: Support injecting unaligned write errors Bart Van Assche
2023-08-09 20:23 ` [PATCH v7 6/7] scsi: ufs: Split an if-condition Bart Van Assche
2023-08-09 20:23 ` [PATCH v7 7/7] scsi: ufs: Disable zone write locking Bart Van Assche

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=20230809202355.1171455-2-bvanassche@acm.org \
    --to=bvanassche@acm.org \
    --cc=axboe@kernel.dk \
    --cc=dlemoal@kernel.org \
    --cc=hch@lst.de \
    --cc=jaegeuk@kernel.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=ming.lei@redhat.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;
as well as URLs for NNTP newsgroup(s).