Skip to content

Commit 4f219fc

Browse files
Ming Leiaxboe
authored andcommitted
io_uring/rsrc: remove '->ctx_ptr' of 'struct io_rsrc_node'
Remove '->ctx_ptr' of 'struct io_rsrc_node', and add 'type' field, meantime remove io_rsrc_node_type(). Signed-off-by: Ming Lei <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent 0d98c50 commit 4f219fc

File tree

2 files changed

+3
-10
lines changed

2 files changed

+3
-10
lines changed

io_uring/rsrc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ struct io_rsrc_node *io_rsrc_node_alloc(struct io_ring_ctx *ctx, int type)
124124

125125
node = kzalloc(sizeof(*node), GFP_KERNEL);
126126
if (node) {
127-
node->ctx_ptr = (unsigned long) ctx | type;
127+
node->type = type;
128128
node->refs = 1;
129129
}
130130
return node;
@@ -449,7 +449,7 @@ void io_free_rsrc_node(struct io_ring_ctx *ctx, struct io_rsrc_node *node)
449449
if (node->tag)
450450
io_post_aux_cqe(ctx, node->tag, 0, 0);
451451

452-
switch (io_rsrc_node_type(node)) {
452+
switch (node->type) {
453453
case IORING_RSRC_FILE:
454454
if (io_slot_file(node))
455455
fput(io_slot_file(node));

io_uring/rsrc.h

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,10 @@
1111
enum {
1212
IORING_RSRC_FILE = 0,
1313
IORING_RSRC_BUFFER = 1,
14-
15-
IORING_RSRC_TYPE_MASK = 0x3UL,
1614
};
1715

1816
struct io_rsrc_node {
19-
unsigned long ctx_ptr;
17+
unsigned char type;
2018
int refs;
2119

2220
u64 tag;
@@ -106,11 +104,6 @@ static inline void io_req_put_rsrc_nodes(struct io_kiocb *req)
106104
}
107105
}
108106

109-
static inline int io_rsrc_node_type(struct io_rsrc_node *node)
110-
{
111-
return node->ctx_ptr & IORING_RSRC_TYPE_MASK;
112-
}
113-
114107
static inline void io_req_assign_rsrc_node(struct io_rsrc_node **dst_node,
115108
struct io_rsrc_node *node)
116109
{

0 commit comments

Comments
 (0)