io_uring/kbuf: pass bgid to io_buffer_select()
authorPavel Begunkov <asml.silence@gmail.com>
Mon, 31 Mar 2025 16:18:01 +0000 (17:18 +0100)
committerJens Axboe <axboe@kernel.dk>
Mon, 21 Apr 2025 11:06:58 +0000 (05:06 -0600)
commitc0e965052149c883317774711205456d08285741
tree7753d80a020299c70d6f8c3f8c8f7fa18db4b10a
parente6f74fd67d50c8a938fcfa83c97cd06995f6aaa1
io_uring/kbuf: pass bgid to io_buffer_select()

The current situation with buffer group id juggling is not ideal.
req->buf_index first stores the bgid, then it's overwritten by a buffer
id, and then it can get restored back no recycling / etc. It's not so
easy to control, and it's not handled consistently across request types
with receive requests saving and restoring the bgid it by hand.

It's a prep patch that adds a buffer group id argument to
io_buffer_select(). The caller will be responsible for stashing a copy
somewhere and passing it into the function.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/a210d6427cc3f4f42271a6853274cd5a50e56820.1743437358.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
io_uring/kbuf.c
io_uring/kbuf.h
io_uring/net.c
io_uring/rw.c
io_uring/rw.h