Files
Ming Lei 288688eb82 io_uring: introduce type alias for io_tw_state
JIRA: https://issues.redhat.com/browse/RHEL-106845

commit bcf8a0293a019bb0c4aebafdebe9a1e7a923249a
Author: Caleb Sander Mateos <csander@purestorage.com>
Date:   Sun Feb 16 19:25:04 2025 -0700

    io_uring: introduce type alias for io_tw_state

    In preparation for changing how io_tw_state is passed, introduce a type
    alias io_tw_token_t for struct io_tw_state *. This allows for changing
    the representation in one place, without having to update the many
    functions that just forward their struct io_tw_state * argument.

    Also add a comment to struct io_tw_state to explain its purpose.

    Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>
    Link: https://lore.kernel.org/r/20250217022511.1150145-1-csander@purestorage.com
    Signed-off-by: Jens Axboe <axboe@kernel.dk>

Signed-off-by: Ming Lei <ming.lei@redhat.com>
2025-08-26 12:16:52 +08:00

49 lines
1.2 KiB
C

// SPDX-License-Identifier: GPL-2.0
#include <linux/io_uring_types.h>
#define IO_POLL_ALLOC_CACHE_MAX 32
enum {
IO_APOLL_OK,
IO_APOLL_ABORTED,
IO_APOLL_READY
};
struct io_poll {
struct file *file;
struct wait_queue_head *head;
__poll_t events;
int retries;
struct wait_queue_entry wait;
};
struct async_poll {
struct io_poll poll;
struct io_poll *double_poll;
};
/*
* Must only be called inside issue_flags & IO_URING_F_MULTISHOT, or
* potentially other cases where we already "own" this poll request.
*/
static inline void io_poll_multishot_retry(struct io_kiocb *req)
{
atomic_inc(&req->poll_refs);
}
int io_poll_add_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe);
int io_poll_add(struct io_kiocb *req, unsigned int issue_flags);
int io_poll_remove_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe);
int io_poll_remove(struct io_kiocb *req, unsigned int issue_flags);
struct io_cancel_data;
int io_poll_cancel(struct io_ring_ctx *ctx, struct io_cancel_data *cd,
unsigned issue_flags);
int io_arm_poll_handler(struct io_kiocb *req, unsigned issue_flags);
bool io_poll_remove_all(struct io_ring_ctx *ctx, struct io_uring_task *tctx,
bool cancel_all);
void io_poll_task_func(struct io_kiocb *req, io_tw_token_t tw);