2020-09-13 19:09:39 +00:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
|
|
#ifndef _LINUX_IO_URING_H
|
|
|
|
#define _LINUX_IO_URING_H
|
|
|
|
|
|
|
|
#include <linux/sched.h>
|
|
|
|
#include <linux/xarray.h>
|
2020-10-14 16:48:51 +00:00
|
|
|
|
2021-02-10 00:03:20 +00:00
|
|
|
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;
|
|
|
|
};
|
|
|
|
|
2020-09-13 19:09:39 +00:00
|
|
|
struct io_uring_task {
|
|
|
|
/* submission side */
|
|
|
|
struct xarray xa;
|
|
|
|
struct wait_queue_head wait;
|
|
|
|
struct file *last;
|
2021-02-16 19:56:50 +00:00
|
|
|
void *io_wq;
|
2020-10-15 22:24:45 +00:00
|
|
|
struct percpu_counter inflight;
|
2020-10-30 15:37:30 +00:00
|
|
|
atomic_t in_idle;
|
|
|
|
bool sqpoll;
|
2021-02-10 00:03:20 +00:00
|
|
|
|
|
|
|
spinlock_t task_lock;
|
|
|
|
struct io_wq_work_list task_list;
|
|
|
|
unsigned long task_state;
|
|
|
|
struct callback_head task_work;
|
2020-09-13 19:09:39 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#if defined(CONFIG_IO_URING)
|
2020-09-19 02:41:00 +00:00
|
|
|
struct sock *io_uring_get_socket(struct file *file);
|
2020-09-13 19:09:39 +00:00
|
|
|
void __io_uring_task_cancel(void);
|
|
|
|
void __io_uring_files_cancel(struct files_struct *files);
|
|
|
|
void __io_uring_free(struct task_struct *tsk);
|
|
|
|
|
|
|
|
static inline void io_uring_task_cancel(void)
|
|
|
|
{
|
|
|
|
if (current->io_uring && !xa_empty(¤t->io_uring->xa))
|
|
|
|
__io_uring_task_cancel();
|
|
|
|
}
|
|
|
|
static inline void io_uring_files_cancel(struct files_struct *files)
|
|
|
|
{
|
2021-02-23 19:27:49 +00:00
|
|
|
if (current->io_uring)
|
2020-09-13 19:09:39 +00:00
|
|
|
__io_uring_files_cancel(files);
|
|
|
|
}
|
|
|
|
static inline void io_uring_free(struct task_struct *tsk)
|
|
|
|
{
|
|
|
|
if (tsk->io_uring)
|
|
|
|
__io_uring_free(tsk);
|
|
|
|
}
|
|
|
|
#else
|
2020-09-19 02:41:00 +00:00
|
|
|
static inline struct sock *io_uring_get_socket(struct file *file)
|
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
2020-09-13 19:09:39 +00:00
|
|
|
static inline void io_uring_task_cancel(void)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
static inline void io_uring_files_cancel(struct files_struct *files)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
static inline void io_uring_free(struct task_struct *tsk)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|