Lines Matching refs:ev_fd

28 	struct io_ev_fd *ev_fd = container_of(rcu, struct io_ev_fd, rcu);  in io_eventfd_free()  local
30 eventfd_ctx_put(ev_fd->cq_ev_fd); in io_eventfd_free()
31 kfree(ev_fd); in io_eventfd_free()
36 struct io_ev_fd *ev_fd = container_of(rcu, struct io_ev_fd, rcu); in io_eventfd_do_signal() local
38 eventfd_signal_mask(ev_fd->cq_ev_fd, EPOLL_URING_WAKE); in io_eventfd_do_signal()
40 if (refcount_dec_and_test(&ev_fd->refs)) in io_eventfd_do_signal()
46 struct io_ev_fd *ev_fd = NULL; in io_eventfd_signal() local
57 ev_fd = rcu_dereference(ctx->io_ev_fd); in io_eventfd_signal()
64 if (unlikely(!ev_fd)) in io_eventfd_signal()
66 if (!refcount_inc_not_zero(&ev_fd->refs)) in io_eventfd_signal()
68 if (ev_fd->eventfd_async && !io_wq_current_is_worker()) in io_eventfd_signal()
72 eventfd_signal_mask(ev_fd->cq_ev_fd, EPOLL_URING_WAKE); in io_eventfd_signal()
74 if (!atomic_fetch_or(BIT(IO_EVENTFD_OP_SIGNAL_BIT), &ev_fd->ops)) { in io_eventfd_signal()
75 call_rcu_hurry(&ev_fd->rcu, io_eventfd_do_signal); in io_eventfd_signal()
80 if (refcount_dec_and_test(&ev_fd->refs)) in io_eventfd_signal()
81 call_rcu(&ev_fd->rcu, io_eventfd_free); in io_eventfd_signal()
110 struct io_ev_fd *ev_fd; in io_eventfd_register() local
114 ev_fd = rcu_dereference_protected(ctx->io_ev_fd, in io_eventfd_register()
116 if (ev_fd) in io_eventfd_register()
122 ev_fd = kmalloc(sizeof(*ev_fd), GFP_KERNEL); in io_eventfd_register()
123 if (!ev_fd) in io_eventfd_register()
126 ev_fd->cq_ev_fd = eventfd_ctx_fdget(fd); in io_eventfd_register()
127 if (IS_ERR(ev_fd->cq_ev_fd)) { in io_eventfd_register()
128 int ret = PTR_ERR(ev_fd->cq_ev_fd); in io_eventfd_register()
130 kfree(ev_fd); in io_eventfd_register()
138 ev_fd->eventfd_async = eventfd_async; in io_eventfd_register()
140 refcount_set(&ev_fd->refs, 1); in io_eventfd_register()
141 atomic_set(&ev_fd->ops, 0); in io_eventfd_register()
142 rcu_assign_pointer(ctx->io_ev_fd, ev_fd); in io_eventfd_register()
148 struct io_ev_fd *ev_fd; in io_eventfd_unregister() local
150 ev_fd = rcu_dereference_protected(ctx->io_ev_fd, in io_eventfd_unregister()
152 if (ev_fd) { in io_eventfd_unregister()
155 if (refcount_dec_and_test(&ev_fd->refs)) in io_eventfd_unregister()
156 call_rcu(&ev_fd->rcu, io_eventfd_free); in io_eventfd_unregister()