File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -230,15 +230,13 @@ void io_rsrc_node_switch(struct io_ring_ctx *ctx,
230230 ctx -> rsrc_node = backup ;
231231}
232232
233- int io_rsrc_node_switch_start (struct io_ring_ctx * ctx )
233+ int __io_rsrc_node_switch_start (struct io_ring_ctx * ctx )
234234{
235- if (io_alloc_cache_empty (& ctx -> rsrc_node_cache )) {
236- struct io_rsrc_node * node = kzalloc (sizeof (* node ), GFP_KERNEL );
235+ struct io_rsrc_node * node = kzalloc (sizeof (* node ), GFP_KERNEL );
237236
238- if (!node )
239- return - ENOMEM ;
240- io_alloc_cache_put (& ctx -> rsrc_node_cache , & node -> cache );
241- }
237+ if (!node )
238+ return - ENOMEM ;
239+ io_alloc_cache_put (& ctx -> rsrc_node_cache , & node -> cache );
242240 return 0 ;
243241}
244242
Original file line number Diff line number Diff line change @@ -69,7 +69,7 @@ void io_rsrc_put_tw(struct callback_head *cb);
6969void io_rsrc_node_ref_zero (struct io_rsrc_node * node );
7070void io_rsrc_put_work (struct work_struct * work );
7171void io_rsrc_node_destroy (struct io_ring_ctx * ctx , struct io_rsrc_node * ref_node );
72- int io_rsrc_node_switch_start (struct io_ring_ctx * ctx );
72+ int __io_rsrc_node_switch_start (struct io_ring_ctx * ctx );
7373struct io_rsrc_node * io_rsrc_node_alloc (struct io_ring_ctx * ctx );
7474int io_queue_rsrc_removal (struct io_rsrc_data * data , unsigned idx ,
7575 struct io_rsrc_node * node , void * rsrc );
@@ -111,6 +111,13 @@ static inline int io_scm_file_account(struct io_ring_ctx *ctx,
111111 return __io_scm_file_account (ctx , file );
112112}
113113
114+ static inline int io_rsrc_node_switch_start (struct io_ring_ctx * ctx )
115+ {
116+ if (unlikely (io_alloc_cache_empty (& ctx -> rsrc_node_cache )))
117+ return __io_rsrc_node_switch_start (ctx );
118+ return 0 ;
119+ }
120+
114121int io_register_files_update (struct io_ring_ctx * ctx , void __user * arg ,
115122 unsigned nr_args );
116123int io_register_rsrc_update (struct io_ring_ctx * ctx , void __user * arg ,
You can’t perform that action at this time.
0 commit comments