mirror of
https://github.com/torvalds/linux.git
synced 2024-11-21 19:41:42 +00:00
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 <ming.lei@redhat.com> Link: https://lore.kernel.org/r/20241107110149.890530-3-ming.lei@redhat.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
0d98c50908
commit
4f219fcce5
@ -124,7 +124,7 @@ struct io_rsrc_node *io_rsrc_node_alloc(struct io_ring_ctx *ctx, int type)
|
|||||||
|
|
||||||
node = kzalloc(sizeof(*node), GFP_KERNEL);
|
node = kzalloc(sizeof(*node), GFP_KERNEL);
|
||||||
if (node) {
|
if (node) {
|
||||||
node->ctx_ptr = (unsigned long) ctx | type;
|
node->type = type;
|
||||||
node->refs = 1;
|
node->refs = 1;
|
||||||
}
|
}
|
||||||
return node;
|
return node;
|
||||||
@ -449,7 +449,7 @@ void io_free_rsrc_node(struct io_ring_ctx *ctx, struct io_rsrc_node *node)
|
|||||||
if (node->tag)
|
if (node->tag)
|
||||||
io_post_aux_cqe(ctx, node->tag, 0, 0);
|
io_post_aux_cqe(ctx, node->tag, 0, 0);
|
||||||
|
|
||||||
switch (io_rsrc_node_type(node)) {
|
switch (node->type) {
|
||||||
case IORING_RSRC_FILE:
|
case IORING_RSRC_FILE:
|
||||||
if (io_slot_file(node))
|
if (io_slot_file(node))
|
||||||
fput(io_slot_file(node));
|
fput(io_slot_file(node));
|
||||||
|
@ -11,12 +11,10 @@
|
|||||||
enum {
|
enum {
|
||||||
IORING_RSRC_FILE = 0,
|
IORING_RSRC_FILE = 0,
|
||||||
IORING_RSRC_BUFFER = 1,
|
IORING_RSRC_BUFFER = 1,
|
||||||
|
|
||||||
IORING_RSRC_TYPE_MASK = 0x3UL,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct io_rsrc_node {
|
struct io_rsrc_node {
|
||||||
unsigned long ctx_ptr;
|
unsigned char type;
|
||||||
int refs;
|
int refs;
|
||||||
|
|
||||||
u64 tag;
|
u64 tag;
|
||||||
@ -106,11 +104,6 @@ static inline void io_req_put_rsrc_nodes(struct io_kiocb *req)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int io_rsrc_node_type(struct io_rsrc_node *node)
|
|
||||||
{
|
|
||||||
return node->ctx_ptr & IORING_RSRC_TYPE_MASK;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void io_req_assign_rsrc_node(struct io_rsrc_node **dst_node,
|
static inline void io_req_assign_rsrc_node(struct io_rsrc_node **dst_node,
|
||||||
struct io_rsrc_node *node)
|
struct io_rsrc_node *node)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user