@@ -144,18 +144,17 @@ static void io_buffer_unmap(struct io_ring_ctx *ctx, struct io_mapped_ubuf **slo
144144
145145static void io_rsrc_put_work (struct io_rsrc_node * node )
146146{
147- struct io_rsrc_data * data = node -> rsrc_data ;
148147 struct io_rsrc_put * prsrc = & node -> item ;
149148
150149 if (prsrc -> tag )
151- io_post_aux_cqe (data -> ctx , prsrc -> tag , 0 , 0 );
150+ io_post_aux_cqe (node -> ctx , prsrc -> tag , 0 , 0 );
152151
153- switch (data -> rsrc_type ) {
152+ switch (node -> type ) {
154153 case IORING_RSRC_FILE :
155- io_rsrc_file_put (data -> ctx , prsrc );
154+ io_rsrc_file_put (node -> ctx , prsrc );
156155 break ;
157156 case IORING_RSRC_BUFFER :
158- io_rsrc_buf_put (data -> ctx , prsrc );
157+ io_rsrc_buf_put (node -> ctx , prsrc );
159158 break ;
160159 default :
161160 WARN_ON_ONCE (1 );
@@ -170,9 +169,9 @@ void io_rsrc_node_destroy(struct io_ring_ctx *ctx, struct io_rsrc_node *node)
170169}
171170
172171void io_rsrc_node_ref_zero (struct io_rsrc_node * node )
173- __must_hold (& node - > rsrc_data - > ctx - > uring_lock )
172+ __must_hold (& node - > ctx - > uring_lock )
174173{
175- struct io_ring_ctx * ctx = node -> rsrc_data -> ctx ;
174+ struct io_ring_ctx * ctx = node -> ctx ;
176175
177176 while (!list_empty (& ctx -> rsrc_ref_list )) {
178177 node = list_first_entry (& ctx -> rsrc_ref_list ,
@@ -204,7 +203,7 @@ struct io_rsrc_node *io_rsrc_node_alloc(struct io_ring_ctx *ctx)
204203 return NULL ;
205204 }
206205
207- ref_node -> rsrc_data = NULL ;
206+ ref_node -> ctx = ctx ;
208207 ref_node -> empty = 0 ;
209208 ref_node -> refs = 1 ;
210209 return ref_node ;
@@ -225,7 +224,7 @@ __cold static int io_rsrc_ref_quiesce(struct io_rsrc_data *data,
225224 if (!backup )
226225 return - ENOMEM ;
227226 ctx -> rsrc_node -> empty = true;
228- ctx -> rsrc_node -> rsrc_data = data ;
227+ ctx -> rsrc_node -> type = -1 ;
229228 list_add_tail (& ctx -> rsrc_node -> node , & ctx -> rsrc_ref_list );
230229 io_put_rsrc_node (ctx , ctx -> rsrc_node );
231230 ctx -> rsrc_node = backup ;
@@ -655,10 +654,9 @@ int io_queue_rsrc_removal(struct io_rsrc_data *data, unsigned idx, void *rsrc)
655654 }
656655
657656 node -> item .rsrc = rsrc ;
657+ node -> type = data -> rsrc_type ;
658658 node -> item .tag = * tag_slot ;
659659 * tag_slot = 0 ;
660-
661- node -> rsrc_data = data ;
662660 list_add_tail (& node -> node , & ctx -> rsrc_ref_list );
663661 io_put_rsrc_node (ctx , node );
664662 return 0 ;
0 commit comments