@@ -144,18 +144,17 @@ static void io_buffer_unmap(struct io_ring_ctx *ctx, struct io_mapped_ubuf **slo
144
144
145
145
static void io_rsrc_put_work (struct io_rsrc_node * node )
146
146
{
147
- struct io_rsrc_data * data = node -> rsrc_data ;
148
147
struct io_rsrc_put * prsrc = & node -> item ;
149
148
150
149
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 );
152
151
153
- switch (data -> rsrc_type ) {
152
+ switch (node -> type ) {
154
153
case IORING_RSRC_FILE :
155
- io_rsrc_file_put (data -> ctx , prsrc );
154
+ io_rsrc_file_put (node -> ctx , prsrc );
156
155
break ;
157
156
case IORING_RSRC_BUFFER :
158
- io_rsrc_buf_put (data -> ctx , prsrc );
157
+ io_rsrc_buf_put (node -> ctx , prsrc );
159
158
break ;
160
159
default :
161
160
WARN_ON_ONCE (1 );
@@ -170,9 +169,9 @@ void io_rsrc_node_destroy(struct io_ring_ctx *ctx, struct io_rsrc_node *node)
170
169
}
171
170
172
171
void 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 )
174
173
{
175
- struct io_ring_ctx * ctx = node -> rsrc_data -> ctx ;
174
+ struct io_ring_ctx * ctx = node -> ctx ;
176
175
177
176
while (!list_empty (& ctx -> rsrc_ref_list )) {
178
177
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)
204
203
return NULL ;
205
204
}
206
205
207
- ref_node -> rsrc_data = NULL ;
206
+ ref_node -> ctx = ctx ;
208
207
ref_node -> empty = 0 ;
209
208
ref_node -> refs = 1 ;
210
209
return ref_node ;
@@ -225,7 +224,7 @@ __cold static int io_rsrc_ref_quiesce(struct io_rsrc_data *data,
225
224
if (!backup )
226
225
return - ENOMEM ;
227
226
ctx -> rsrc_node -> empty = true;
228
- ctx -> rsrc_node -> rsrc_data = data ;
227
+ ctx -> rsrc_node -> type = -1 ;
229
228
list_add_tail (& ctx -> rsrc_node -> node , & ctx -> rsrc_ref_list );
230
229
io_put_rsrc_node (ctx , ctx -> rsrc_node );
231
230
ctx -> rsrc_node = backup ;
@@ -655,10 +654,9 @@ int io_queue_rsrc_removal(struct io_rsrc_data *data, unsigned idx, void *rsrc)
655
654
}
656
655
657
656
node -> item .rsrc = rsrc ;
657
+ node -> type = data -> rsrc_type ;
658
658
node -> item .tag = * tag_slot ;
659
659
* tag_slot = 0 ;
660
-
661
- node -> rsrc_data = data ;
662
660
list_add_tail (& node -> node , & ctx -> rsrc_ref_list );
663
661
io_put_rsrc_node (ctx , node );
664
662
return 0 ;
0 commit comments