In preparation for calling it from __io_put_kbuf(), move it up a bit to avoid a forward declaration. Signed-off-by: Jens Axboe <axboe@xxxxxxxxx> --- fs/io_uring.c | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/fs/io_uring.c b/fs/io_uring.c index 7f9b9aa57ddb..5b0deba430ca 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -1558,6 +1558,27 @@ static inline void io_req_set_rsrc_node(struct io_kiocb *req, } } +static struct io_buffer_list *io_buffer_get_list(struct io_ring_ctx *ctx, + unsigned int bgid) +{ + struct list_head *hash_list; + struct io_buffer_list *bl; + + if (bgid == ctx->io_bl_bgid) + return ctx->io_bl_last; + + hash_list = &ctx->io_buffers[hash_32(bgid, IO_BUFFERS_HASH_BITS)]; + list_for_each_entry(bl, hash_list, list) { + if (bl->bgid == bgid || bgid == -1U) { + ctx->io_bl_bgid = bgid; + ctx->io_bl_last = bl; + return bl; + } + } + + return NULL; +} + static unsigned int __io_put_kbuf(struct io_kiocb *req, struct list_head *list) { struct io_buffer *kbuf = req->kbuf; @@ -1614,27 +1635,6 @@ static inline unsigned int io_put_kbuf(struct io_kiocb *req, return cflags; } -static struct io_buffer_list *io_buffer_get_list(struct io_ring_ctx *ctx, - unsigned int bgid) -{ - struct list_head *hash_list; - struct io_buffer_list *bl; - - if (bgid == ctx->io_bl_bgid) - return ctx->io_bl_last; - - hash_list = &ctx->io_buffers[hash_32(bgid, IO_BUFFERS_HASH_BITS)]; - list_for_each_entry(bl, hash_list, list) { - if (bl->bgid == bgid || bgid == -1U) { - ctx->io_bl_bgid = bgid; - ctx->io_bl_last = bl; - return bl; - } - } - - return NULL; -} - static void io_kbuf_recycle(struct io_kiocb *req, unsigned issue_flags) { struct io_ring_ctx *ctx = req->ctx; -- 2.35.1