diff options
author | Bijan Mottahedeh <bijan.mottahedeh@oracle.com> | 2021-01-15 17:37:48 +0000 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2021-02-01 10:02:42 -0700 |
commit | 6802535df7bf807c94de32a9d0bf0401d3109671 (patch) | |
tree | 11aaf40c9d706d63cebb686e10d6a48f2af269b9 /fs/io_uring.c | |
parent | 2a63b2d9c30b2029892c368d11ede1434de6c565 (diff) | |
download | lwn-6802535df7bf807c94de32a9d0bf0401d3109671.tar.gz lwn-6802535df7bf807c94de32a9d0bf0401d3109671.zip |
io_uring: split alloc_fixed_file_ref_node
Split alloc_fixed_file_ref_node into resource generic/specific parts,
to be leveraged for fixed buffers.
Signed-off-by: Bijan Mottahedeh <bijan.mottahedeh@oracle.com>
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Reviewed-by: Pavel Begunkov <asml.silence@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'fs/io_uring.c')
-rw-r--r-- | fs/io_uring.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/fs/io_uring.c b/fs/io_uring.c index a129192c20d3..ab5bf1bf0779 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -7799,7 +7799,7 @@ static void io_rsrc_data_ref_zero(struct percpu_ref *ref) queue_delayed_work(system_wq, &ctx->rsrc_put_work, delay); } -static struct fixed_rsrc_ref_node *alloc_fixed_file_ref_node( +static struct fixed_rsrc_ref_node *alloc_fixed_rsrc_ref_node( struct io_ring_ctx *ctx) { struct fixed_rsrc_ref_node *ref_node; @@ -7815,9 +7815,21 @@ static struct fixed_rsrc_ref_node *alloc_fixed_file_ref_node( } INIT_LIST_HEAD(&ref_node->node); INIT_LIST_HEAD(&ref_node->rsrc_list); + ref_node->done = false; + return ref_node; +} + +static struct fixed_rsrc_ref_node *alloc_fixed_file_ref_node( + struct io_ring_ctx *ctx) +{ + struct fixed_rsrc_ref_node *ref_node; + + ref_node = alloc_fixed_rsrc_ref_node(ctx); + if (!ref_node) + return NULL; + ref_node->rsrc_data = ctx->file_data; ref_node->rsrc_put = io_ring_file_put; - ref_node->done = false; return ref_node; } |