159915143SJens Axboe // SPDX-License-Identifier: GPL-2.0
259915143SJens Axboe
359915143SJens Axboe struct io_timeout_data {
459915143SJens Axboe struct io_kiocb *req;
559915143SJens Axboe struct hrtimer timer;
659915143SJens Axboe struct timespec64 ts;
759915143SJens Axboe enum hrtimer_mode mode;
859915143SJens Axboe u32 flags;
959915143SJens Axboe };
1059915143SJens Axboe
1159915143SJens Axboe struct io_kiocb *__io_disarm_linked_timeout(struct io_kiocb *req,
1259915143SJens Axboe struct io_kiocb *link);
1359915143SJens Axboe
io_disarm_linked_timeout(struct io_kiocb * req)1459915143SJens Axboe static inline struct io_kiocb *io_disarm_linked_timeout(struct io_kiocb *req)
1559915143SJens Axboe {
1659915143SJens Axboe struct io_kiocb *link = req->link;
1759915143SJens Axboe
1859915143SJens Axboe if (link && link->opcode == IORING_OP_LINK_TIMEOUT)
1959915143SJens Axboe return __io_disarm_linked_timeout(req, link);
2059915143SJens Axboe
2159915143SJens Axboe return NULL;
2259915143SJens Axboe }
2359915143SJens Axboe
2459915143SJens Axboe __cold void io_flush_timeouts(struct io_ring_ctx *ctx);
25ad163a7eSJens Axboe struct io_cancel_data;
2659915143SJens Axboe int io_timeout_cancel(struct io_ring_ctx *ctx, struct io_cancel_data *cd);
2759915143SJens Axboe __cold bool io_kill_timeouts(struct io_ring_ctx *ctx, struct task_struct *tsk,
2859915143SJens Axboe bool cancel_all);
2959915143SJens Axboe void io_queue_linked_timeout(struct io_kiocb *req);
30*c0dc995eSPavel Begunkov void io_disarm_next(struct io_kiocb *req);
3159915143SJens Axboe
3259915143SJens Axboe int io_timeout_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe);
3359915143SJens Axboe int io_link_timeout_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe);
3459915143SJens Axboe int io_timeout(struct io_kiocb *req, unsigned int issue_flags);
3559915143SJens Axboe int io_timeout_remove_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe);
3659915143SJens Axboe int io_timeout_remove(struct io_kiocb *req, unsigned int issue_flags);
37