public inbox for [email protected]
 help / color / mirror / Atom feed
From: Ming Lei <[email protected]>
To: Jens Axboe <[email protected]>,
	[email protected], Pavel Begunkov <[email protected]>
Cc: [email protected],
	Uday Shankar <[email protected]>,
	Akilesh Kailash <[email protected]>,
	Ming Lei <[email protected]>
Subject: [PATCH V9 2/7] io_uring: rename ubuf of io_mapped_buf as start
Date: Wed,  6 Nov 2024 20:26:51 +0800	[thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>

->ubuf of `io_mapped_buf` stores the start address of userspace fixed
buffer. `io_mapped_buf` will be extended for covering kernel buffer,
so rename ->ubuf as ->start.

Signed-off-by: Ming Lei <[email protected]>
---
 io_uring/fdinfo.c | 2 +-
 io_uring/rsrc.c   | 6 +++---
 io_uring/rsrc.h   | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/io_uring/fdinfo.c b/io_uring/fdinfo.c
index 9ca95f877312..9b39cb596136 100644
--- a/io_uring/fdinfo.c
+++ b/io_uring/fdinfo.c
@@ -223,7 +223,7 @@ __cold void io_uring_show_fdinfo(struct seq_file *m, struct file *file)
 		if (ctx->buf_table.nodes[i])
 			buf = ctx->buf_table.nodes[i]->buf;
 		if (buf)
-			seq_printf(m, "%5u: 0x%llx/%u\n", i, buf->ubuf, buf->len);
+			seq_printf(m, "%5u: 0x%llx/%u\n", i, buf->start, buf->len);
 		else
 			seq_printf(m, "%5u: <none>\n", i);
 	}
diff --git a/io_uring/rsrc.c b/io_uring/rsrc.c
index 70dba4a4de1d..9b8827c72230 100644
--- a/io_uring/rsrc.c
+++ b/io_uring/rsrc.c
@@ -765,7 +765,7 @@ static struct io_rsrc_node *io_sqe_buffer_register(struct io_ring_ctx *ctx,
 
 	size = iov->iov_len;
 	/* store original address for later verification */
-	imu->ubuf = (unsigned long) iov->iov_base;
+	imu->start = (unsigned long) iov->iov_base;
 	imu->len = iov->iov_len;
 	imu->nr_bvecs = nr_pages;
 	imu->folio_shift = PAGE_SHIFT;
@@ -877,14 +877,14 @@ int io_import_fixed(int ddir, struct iov_iter *iter,
 	if (unlikely(check_add_overflow(buf_addr, (u64)len, &buf_end)))
 		return -EFAULT;
 	/* not inside the mapped region */
-	if (unlikely(buf_addr < imu->ubuf || buf_end > (imu->ubuf + imu->len)))
+	if (unlikely(buf_addr < imu->start || buf_end > (imu->start + imu->len)))
 		return -EFAULT;
 
 	/*
 	 * Might not be a start of buffer, set size appropriately
 	 * and advance us to the beginning.
 	 */
-	offset = buf_addr - imu->ubuf;
+	offset = buf_addr - imu->start;
 	iov_iter_bvec(iter, ddir, imu->bvec, imu->nr_bvecs, offset + len);
 
 	if (offset) {
diff --git a/io_uring/rsrc.h b/io_uring/rsrc.h
index 9d55f9769c77..887699400e29 100644
--- a/io_uring/rsrc.h
+++ b/io_uring/rsrc.h
@@ -27,7 +27,7 @@ struct io_rsrc_node {
 };
 
 struct io_mapped_buf {
-	u64		ubuf;
+	u64		start;
 	unsigned int	len;
 	unsigned int	nr_bvecs;
 	unsigned int    folio_shift;
-- 
2.47.0


  parent reply	other threads:[~2024-11-06 12:27 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-06 12:26 [PATCH V9 0/7] io_uring: support group buffer & ublk zc Ming Lei
2024-11-06 12:26 ` [PATCH V9 1/7] io_uring: rename io_mapped_ubuf as io_mapped_buf Ming Lei
2024-11-06 12:26 ` Ming Lei [this message]
2024-11-06 15:07   ` [PATCH V9 2/7] io_uring: rename ubuf of io_mapped_buf as start Jens Axboe
2024-11-06 12:26 ` [PATCH V9 3/7] io_uring: shrink io_mapped_buf Ming Lei
2024-11-06 15:09   ` Jens Axboe
2024-11-07  1:04     ` Ming Lei
2024-11-07  2:13       ` Jens Axboe
2024-11-06 12:26 ` [PATCH V9 4/7] io_uring: reuse io_mapped_buf for kernel buffer Ming Lei
2024-11-06 15:15   ` Jens Axboe
2024-11-07  1:22     ` Ming Lei
2024-11-07  2:16       ` Jens Axboe
2024-11-06 12:26 ` [PATCH V9 5/7] io_uring: support leased group buffer with REQ_F_GROUP_BUF Ming Lei
2024-11-06 15:17   ` Jens Axboe
2024-11-06 12:26 ` [PATCH V9 6/7] io_uring/uring_cmd: support leasing device kernel buffer to io_uring Ming Lei
2024-11-06 12:26 ` [PATCH V9 7/7] ublk: support leasing io " 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 \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    /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