All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ming Lei <ming.lei@redhat.com>
To: Jens Axboe <axboe@kernel.dk>, io-uring@vger.kernel.org
Cc: linux-block@vger.kernel.org, Miklos Szeredi <mszeredi@redhat.com>,
	ZiyangZhang <ZiyangZhang@linux.alibaba.com>,
	Xiaoguang Wang <xiaoguang.wang@linux.alibaba.com>,
	Bernd Schubert <bschubert@ddn.com>,
	Ming Lei <ming.lei@redhat.com>
Subject: [RFC PATCH 05/12] io_uring: export 'struct io_mapped_buf' for fused cmd buffer
Date: Wed,  1 Mar 2023 22:06:04 +0800	[thread overview]
Message-ID: <20230301140611.163055-6-ming.lei@redhat.com> (raw)
In-Reply-To: <20230301140611.163055-1-ming.lei@redhat.com>

Export 'struct io_mapped_buf' for the coming fused cmd buffer,
which is based on bvec too.

This instance is supposed to be immutable in its whole lifetime.

Signed-off-by: Ming Lei <ming.lei@redhat.com>
---
 include/linux/io_uring.h | 19 +++++++++++++++++++
 io_uring/rsrc.h          |  9 ---------
 2 files changed, 19 insertions(+), 9 deletions(-)

diff --git a/include/linux/io_uring.h b/include/linux/io_uring.h
index 934e5dd4ccc0..88205ea566d3 100644
--- a/include/linux/io_uring.h
+++ b/include/linux/io_uring.h
@@ -4,6 +4,7 @@
 
 #include <linux/sched.h>
 #include <linux/xarray.h>
+#include <linux/bvec.h>
 #include <uapi/linux/io_uring.h>
 
 enum io_uring_cmd_flags {
@@ -36,6 +37,24 @@ struct io_uring_cmd {
 	u8		pdu[32]; /* available inline for free use */
 };
 
+/* The mapper buffer is supposed to be immutable */
+struct io_mapped_buf {
+	u64		buf;
+	u64		buf_end;
+	unsigned int	nr_bvecs;
+	union {
+		unsigned int	acct_pages;
+
+		/*
+		 * offset into the bvecs, use for external user; with
+		 * 'offset', immutable bvecs can be provided for io_uring
+		 */
+		unsigned int	offset;
+	};
+	struct bio_vec	*bvec;
+	struct bio_vec	__bvec[];
+};
+
 #if defined(CONFIG_IO_URING)
 int io_uring_cmd_import_fixed(u64 ubuf, unsigned long len, int rw,
 			      struct iov_iter *iter, void *ioucmd);
diff --git a/io_uring/rsrc.h b/io_uring/rsrc.h
index 5da54702cad1..4bd17877d53a 100644
--- a/io_uring/rsrc.h
+++ b/io_uring/rsrc.h
@@ -45,15 +45,6 @@ struct io_rsrc_node {
 	bool				done;
 };
 
-struct io_mapped_buf {
-	u64		buf;
-	u64		buf_end;
-	unsigned int	nr_bvecs;
-	unsigned int	acct_pages;
-	struct bio_vec	*bvec;
-	struct bio_vec	__bvec[];
-};
-
 void io_rsrc_put_tw(struct callback_head *cb);
 void io_rsrc_put_work(struct work_struct *work);
 void io_rsrc_refs_refill(struct io_ring_ctx *ctx);
-- 
2.31.1


  parent reply	other threads:[~2023-03-01 14:09 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-01 14:05 [RFC PATCH 00/12] io_uring: add IORING_OP_FUSED_CMD Ming Lei
2023-03-01 14:06 ` [RFC PATCH 01/12] io_uring: increase io_kiocb->flags into 64bit Ming Lei
2023-03-01 14:06 ` [RFC PATCH 02/12] io_uring: define io_mapped_ubuf->acct_pages as unsigned integer Ming Lei
2023-03-01 14:06 ` [RFC PATCH 03/12] io_uring: extend io_mapped_ubuf to cover external bvec table Ming Lei
2023-03-01 14:06 ` [RFC PATCH 04/12] io_uring: rename io_mapped_ubuf as io_mapped_buf Ming Lei
2023-03-01 14:06 ` Ming Lei [this message]
2023-03-01 14:06 ` [RFC PATCH 06/12] io_uring: add IO_URING_F_FUSED and prepare for supporting OP_FUSED_CMD Ming Lei
2023-03-01 14:06 ` [RFC PATCH 07/12] io_uring: add IORING_OP_FUSED_CMD Ming Lei
2023-03-02 19:16   ` kernel test robot
2023-03-02 20:49   ` kernel test robot
2023-03-01 14:06 ` [RFC PATCH 08/12] io_uring: support OP_READ/OP_WRITE for fused slave request Ming Lei
2023-03-01 14:06 ` [RFC PATCH 09/12] io_uring: support OP_SEND_ZC/OP_RECV " Ming Lei
2023-03-01 14:06 ` [RFC PATCH 10/12] block: ublk_drv: mark device as LIVE before adding disk Ming Lei
2023-03-03  2:25   ` Ziyang Zhang
2023-03-01 14:06 ` [RFC PATCH 11/12] block: ublk_drv: add common exit handling Ming Lei
2023-03-03  2:15   ` Ziyang Zhang
2023-03-01 14:06 ` [RFC PATCH 12/12] block: ublk_drv: apply io_uring FUSED_CMD for supporting zero copy Ming Lei
2023-03-03  2:52 ` [RFC PATCH 00/12] io_uring: add IORING_OP_FUSED_CMD Ziyang Zhang
2023-03-03  3:01   ` Ming Lei

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=20230301140611.163055-6-ming.lei@redhat.com \
    --to=ming.lei@redhat.com \
    --cc=ZiyangZhang@linux.alibaba.com \
    --cc=axboe@kernel.dk \
    --cc=bschubert@ddn.com \
    --cc=io-uring@vger.kernel.org \
    --cc=linux-block@vger.kernel.org \
    --cc=mszeredi@redhat.com \
    --cc=xiaoguang.wang@linux.alibaba.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 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.