include/linux/io_uring_types.h

Source file repositories/reference/linux-study-clean/include/linux/io_uring_types.h

File Facts

System
Linux kernel
Corpus path
include/linux/io_uring_types.h
Extension
.h
Size
22787 bytes
Lines
826
Domain
Core OS
Bucket
Core Kernel Interface
Inferred role
Core OS: implementation source
Status
source implementation candidate

Why This File Exists

Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.

Dependency Surface

Detected Declarations

Annotated Snippet

struct io_wq_work_node {
	struct io_wq_work_node *next;
};

struct io_wq_work_list {
	struct io_wq_work_node *first;
	struct io_wq_work_node *last;
};

/*
 * Lockless multi-producer, single-consumer FIFO queue, see
 * io_uring/mpscq.h for the implementation and rules. Defined here so
 * that it can be embedded in io_ring_ctx. This is the producer side
 * only - the consumer cursor is kept separately, on a cacheline that
 * isn't dirtied by the producers.
 */
struct mpscq {
	struct llist_node	*tail;		/* producers */
	struct llist_node	stub;
};

struct io_wq_work {
	struct io_wq_work_node list;
	atomic_t flags;
	/* place it here instead of io_kiocb as it fills padding and saves 4B */
	int cancel_seq;
};

struct io_rsrc_data {
	unsigned int			nr;
	struct io_rsrc_node		**nodes;
};

struct io_file_table {
	struct io_rsrc_data data;
	unsigned long *bitmap;
	unsigned int alloc_hint;
};

struct io_hash_bucket {
	struct hlist_head	list;
} ____cacheline_aligned_in_smp;

struct io_hash_table {
	struct io_hash_bucket	*hbs;
	unsigned		hash_bits;
};

struct io_mapped_region {
	struct page		**pages;
	void			*ptr;
	unsigned		nr_pages;
	unsigned		flags;
};

/*
 * Return value from io_buffer_list selection, to avoid stashing it in
 * struct io_kiocb. For legacy/classic provided buffers, keeping a reference
 * across execution contexts are fine. But for ring provided buffers, the
 * list may go away as soon as ->uring_lock is dropped. As the io_kiocb
 * persists, it's better to just keep the buffer local for those cases.
 */
struct io_br_sel {
	struct io_buffer_list *buf_list;
	/*
	 * Some selection parts return the user address, others return an error.
	 */
	union {
		void __user *addr;
		ssize_t val;
	};
};


/*
 * Arbitrary limit, can be raised if need be
 */
#define IO_RINGFD_REG_MAX 16

struct io_uring_task {
	/* submission side */
	int				cached_refs;
	const struct io_ring_ctx 	*last;
	struct task_struct		*task;
	struct io_wq			*io_wq;
	/*
	 * Consumer cursor for ->task_list. Only popped by the task itself,
	 * or by ->fallback_work once the task can no longer run task_work.
	 */
	struct llist_node		*task_head;

Annotation

Implementation Notes