From: Keith Busch <kbusch@meta.com>
To: <linux-block@vger.kernel.org>, <linux-nvme@lists.infradead.org>,
<linux-scsi@vger.kernel.org>, <io-uring@vger.kernel.org>
Cc: <linux-fsdevel@vger.kernel.org>, <hch@lst.de>,
<joshi.k@samsung.com>, <javier.gonz@samsung.com>,
<bvanassche@acm.org>, Hannes Reinecke <hare@suse.de>,
Nitesh Shetty <nj.shetty@samsung.com>,
Keith Busch <kbusch@kernel.org>
Subject: [PATCHv9 5/7] io_uring: enable per-io hinting capability
Date: Fri, 25 Oct 2024 14:36:43 -0700 [thread overview]
Message-ID: <20241025213645.3464331-6-kbusch@meta.com> (raw)
In-Reply-To: <20241025213645.3464331-1-kbusch@meta.com>
From: Kanchan Joshi <joshi.k@samsung.com>
With F_SET_RW_HINT fcntl, user can set a hint on the file inode, and
all the subsequent writes on the file pass that hint value down. This
can be limiting for block device as all the writes will be tagged with
only one lifetime hint value. Concurrent writes (with different hint
values) are hard to manage. Per-IO hinting solves that problem.
Allow userspace to pass additional metadata in the SQE.
__u16 write_hint;
If the hint is provided, filesystems may optionally use it. A filesytem
may ignore this field if it does not support per-io hints, or if the
value is invalid for its backing storage. Just like the inode hints,
requesting values that are not supported by the hardware are not an
error.
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Kanchan Joshi <joshi.k@samsung.com>
Signed-off-by: Nitesh Shetty <nj.shetty@samsung.com>
Signed-off-by: Keith Busch <kbusch@kernel.org>
---
include/uapi/linux/io_uring.h | 4 ++++
io_uring/rw.c | 3 ++-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/include/uapi/linux/io_uring.h b/include/uapi/linux/io_uring.h
index 60b9c98595faf..8cdcc461d464c 100644
--- a/include/uapi/linux/io_uring.h
+++ b/include/uapi/linux/io_uring.h
@@ -92,6 +92,10 @@ struct io_uring_sqe {
__u16 addr_len;
__u16 __pad3[1];
};
+ struct {
+ __u16 write_hint;
+ __u16 __pad4[1];
+ };
};
union {
struct {
diff --git a/io_uring/rw.c b/io_uring/rw.c
index 8080ffd6d5712..5a1231bfecc3a 100644
--- a/io_uring/rw.c
+++ b/io_uring/rw.c
@@ -279,7 +279,8 @@ static int io_prep_rw(struct io_kiocb *req, const struct io_uring_sqe *sqe,
rw->kiocb.ki_ioprio = get_current_ioprio();
}
rw->kiocb.dio_complete = NULL;
-
+ if (ddir == ITER_SOURCE)
+ rw->kiocb.ki_write_hint = READ_ONCE(sqe->write_hint);
rw->addr = READ_ONCE(sqe->addr);
rw->len = READ_ONCE(sqe->len);
rw->flags = READ_ONCE(sqe->rw_flags);
--
2.43.5
next prev parent reply other threads:[~2024-10-25 21:43 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-25 21:36 [PATCHv9 0/7] write hints with nvme fdp, scsi streams Keith Busch
2024-10-25 21:36 ` [PATCHv9 1/7] block: use generic u16 for write hints Keith Busch
2024-10-28 18:19 ` Bart Van Assche
2024-10-28 18:38 ` Keith Busch
2024-10-25 21:36 ` [PATCHv9 2/7] block: introduce max_write_hints queue limit Keith Busch
2024-10-28 11:51 ` Christoph Hellwig
2024-10-28 11:52 ` Christoph Hellwig
2024-10-25 21:36 ` [PATCHv9 3/7] block: allow ability to limit partition write hints Keith Busch
2024-10-28 11:58 ` Christoph Hellwig
2024-10-28 14:49 ` Keith Busch
2024-10-28 14:40 ` Kanchan Joshi
2024-10-28 18:27 ` Bart Van Assche
2024-10-28 19:46 ` Keith Busch
2024-10-25 21:36 ` [PATCHv9 4/7] block, fs: add write hint to kiocb Keith Busch
2024-10-28 11:59 ` Christoph Hellwig
2024-10-28 14:38 ` Keith Busch
2024-10-28 16:08 ` Christoph Hellwig
2024-10-25 21:36 ` Keith Busch [this message]
2024-10-29 12:46 ` [PATCHv9 5/7] io_uring: enable per-io hinting capability Anuj gupta
2024-10-25 21:36 ` [PATCHv9 7/7] scsi: set permanent stream count in block limits Keith Busch
2024-10-28 16:13 ` Bart Van Assche
2024-10-29 7:10 ` Hannes Reinecke
2024-10-28 11:49 ` [PATCHv9 0/7] write hints with nvme fdp, scsi streams Christoph Hellwig
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=20241025213645.3464331-6-kbusch@meta.com \
--to=kbusch@meta.com \
--cc=bvanassche@acm.org \
--cc=hare@suse.de \
--cc=hch@lst.de \
--cc=io-uring@vger.kernel.org \
--cc=javier.gonz@samsung.com \
--cc=joshi.k@samsung.com \
--cc=kbusch@kernel.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=linux-scsi@vger.kernel.org \
--cc=nj.shetty@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;
as well as URLs for NNTP newsgroup(s).