1 // SPDX-License-Identifier: GPL-2.0
6 #include <linux/nospec.h>
10 struct io_ring_ctx *ctx;
12 /* cqe->user_data, io_notif_slot::tag if not overridden */
14 /* see struct io_notif_slot::seq */
18 struct callback_head task_work;
19 struct work_struct commit_work;
23 struct io_notif_slot {
25 * Current/active notifier. A slot holds only one active notifier at a
26 * time and keeps one reference to it. Flush releases the reference and
27 * lazily replaces it with a new notifier.
29 struct io_notif *notif;
32 * Default ->user_data for this slot notifiers CQEs
36 * Notifiers of a slot live in generations, we create a new notifier
37 * only after flushing the previous one. Track the sequential number
38 * for all notifiers and copy it into notifiers's cqe->cflags
43 int io_notif_unregister(struct io_ring_ctx *ctx);
45 struct io_notif *io_alloc_notif(struct io_ring_ctx *ctx,
46 struct io_notif_slot *slot);
48 static inline struct io_notif *io_get_notif(struct io_ring_ctx *ctx,
49 struct io_notif_slot *slot)
52 slot->notif = io_alloc_notif(ctx, slot);
56 static inline struct io_notif_slot *io_get_notif_slot(struct io_ring_ctx *ctx,
58 __must_hold(&ctx->uring_lock)
60 if (idx >= ctx->nr_notif_slots)
62 idx = array_index_nospec(idx, ctx->nr_notif_slots);
63 return &ctx->notif_slots[idx];