diff options
author | Pavel Begunkov <asml.silence@gmail.com> | 2025-02-05 11:36:48 +0000 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2025-02-17 05:34:45 -0700 |
commit | 54e00d9a612ab93f37f612a5ccd7c0c4f8a31cea (patch) | |
tree | 6a9837cdf9c30ccee4e3345b26e9233c9cef3c4a /io_uring/kbuf.c | |
parent | e150e70fce425e1cdfc227974893cad9fb90a0d3 (diff) |
io_uring/kbuf: introduce io_kbuf_drop_legacy()
io_kbuf_drop() is only used for legacy provided buffers, and so
__io_put_kbuf_list() is never called for REQ_F_BUFFER_RING. Remove the
dead branch out of __io_put_kbuf_list(), rename it into
io_kbuf_drop_legacy() and use it directly instead of io_kbuf_drop().
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/c8cc73e2272f09a86ecbdad9ebdd8304f8e583c0.1738724373.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'io_uring/kbuf.c')
-rw-r--r-- | io_uring/kbuf.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/io_uring/kbuf.c b/io_uring/kbuf.c index d612e4c15b0e..815fb58da3ba 100644 --- a/io_uring/kbuf.c +++ b/io_uring/kbuf.c @@ -50,6 +50,16 @@ static int io_buffer_add_list(struct io_ring_ctx *ctx, return xa_err(xa_store(&ctx->io_bl_xa, bgid, bl, GFP_KERNEL)); } +void io_kbuf_drop_legacy(struct io_kiocb *req) +{ + if (WARN_ON_ONCE(!(req->flags & REQ_F_BUFFER_SELECTED))) + return; + req->buf_index = req->kbuf->bgid; + req->flags &= ~REQ_F_BUFFER_SELECTED; + kfree(req->kbuf); + req->kbuf = NULL; +} + bool io_kbuf_recycle_legacy(struct io_kiocb *req, unsigned issue_flags) { struct io_ring_ctx *ctx = req->ctx; |