All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: io-uring@vger.kernel.org
Cc: Jens Axboe <axboe@kernel.dk>
Subject: [PATCH 2/4] io_uring/kbuf: move io_ring_head_to_buf() to kbuf.h
Date: Fri, 23 Aug 2024 08:42:35 -0600	[thread overview]
Message-ID: <20240823145104.20600-4-axboe@kernel.dk> (raw)
In-Reply-To: <20240823145104.20600-2-axboe@kernel.dk>

In preparation for using this helper in kbuf.h as well, move it there and
turn it into a macro.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
---
 io_uring/kbuf.c | 6 ------
 io_uring/kbuf.h | 3 +++
 2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/io_uring/kbuf.c b/io_uring/kbuf.c
index e43f761fa073..0aa12703bac7 100644
--- a/io_uring/kbuf.c
+++ b/io_uring/kbuf.c
@@ -132,12 +132,6 @@ static int io_provided_buffers_select(struct io_kiocb *req, size_t *len,
 	return 0;
 }
 
-static struct io_uring_buf *io_ring_head_to_buf(struct io_uring_buf_ring *br,
-						__u16 head, __u16 mask)
-{
-	return &br->bufs[head & mask];
-}
-
 static void __user *io_ring_buffer_select(struct io_kiocb *req, size_t *len,
 					  struct io_buffer_list *bl,
 					  unsigned int issue_flags)
diff --git a/io_uring/kbuf.h b/io_uring/kbuf.h
index c9798663cd9f..b7da3ce880bf 100644
--- a/io_uring/kbuf.h
+++ b/io_uring/kbuf.h
@@ -121,6 +121,9 @@ static inline bool io_kbuf_recycle(struct io_kiocb *req, unsigned issue_flags)
 	return false;
 }
 
+/* Mapped buffer ring, return io_uring_buf from head */
+#define io_ring_head_to_buf(br, head, mask)	&(br)->bufs[(head) & (mask)]
+
 static inline void io_kbuf_commit(struct io_kiocb *req,
 				  struct io_buffer_list *bl, int nr)
 {
-- 
2.43.0


  parent reply	other threads:[~2024-08-23 14:51 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-23 14:42 [PATCHSET v2 RFC 0/4] Add support for incremental buffer consumption Jens Axboe
2024-08-23 14:42 ` [PATCH 1/4] io_uring/kbuf: add io_kbuf_commit() helper Jens Axboe
2024-08-23 14:42 ` Jens Axboe [this message]
2024-08-23 14:42 ` [PATCH 3/4] Revert "io_uring: Require zeroed sqe->len on provided-buffers send" Jens Axboe
2024-08-23 14:42 ` [PATCH 4/4] io_uring/kbuf: add support for incremental buffer consumption Jens Axboe
  -- strict thread matches above, loose matches on Subject: below --
2024-08-24 15:43 [PATCHSET v3 0/4] Add " Jens Axboe
2024-08-24 15:43 ` [PATCH 2/4] io_uring/kbuf: move io_ring_head_to_buf() to kbuf.h Jens Axboe

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=20240823145104.20600-4-axboe@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=io-uring@vger.kernel.org \
    /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.