The main idea here is to make make rsrc nodes (aka ref nodes) to be per ctx rather than per rsrc_data, that is a requirement for having multiple resource types. All the meat to it in 7/7. Also rsrc API is complicated and too misuse. 1-6 may be considered to be preps but also together with 7/7 gradually make the API simpler and so more resilient. The only nuisance is additional handling in ctx_free in 7/7, and added for that struct io_rsrc_node::completion, because now we always retain a valid node in ctx after first files_register, and so we need to kill it in the end. Ideas how to make it better? Pavel Begunkov (7): io_uring: name rsrc bits consistently io_uring: simplify io_rsrc_node_ref_zero io_uring: use rsrc prealloc infra for files reg io_uring: encapsulate rsrc node manipulations io_uring: move rsrc_put callback into io_rsrc_data io_uring: refactor io_queue_rsrc_removal() io_uring: ctx-wide rsrc nodes fs/io_uring.c | 253 +++++++++++++++++++++++--------------------------- 1 file changed, 115 insertions(+), 138 deletions(-) -- 2.24.0