Lines Matching refs:cl

16 static inline void closure_put_after_sub(struct closure *cl, int flags)
24 if (cl->fn && !(flags & CLOSURE_DESTRUCTOR)) {
25 atomic_set(&cl->remaining,
27 closure_queue(cl);
29 struct closure *parent = cl->parent;
30 closure_fn *destructor = cl->fn;
32 closure_debug_destroy(cl);
35 destructor(cl);
44 void closure_sub(struct closure *cl, int v)
46 closure_put_after_sub(cl, atomic_sub_return(v, &cl->remaining));
52 void closure_put(struct closure *cl)
54 closure_put_after_sub(cl, atomic_dec_return(&cl->remaining));
63 struct closure *cl, *t;
72 llist_for_each_entry_safe(cl, t, reverse, list) {
73 closure_set_waiting(cl, 0);
74 closure_sub(cl, CLOSURE_WAITING + 1);
80 * @waitlist: will own a ref on @cl, which will be released when
82 * @cl: closure pointer.
85 bool closure_wait(struct closure_waitlist *waitlist, struct closure *cl)
87 if (atomic_read(&cl->remaining) & CLOSURE_WAITING)
90 closure_set_waiting(cl, _RET_IP_);
91 atomic_add(CLOSURE_WAITING + 1, &cl->remaining);
92 llist_add(&cl->list, &waitlist->list);
102 static void closure_sync_fn(struct closure *cl)
104 struct closure_syncer *s = cl->s;
114 void __sched __closure_sync(struct closure *cl)
118 cl->s = &s;
119 continue_at(cl, closure_sync_fn, NULL);
136 void closure_debug_create(struct closure *cl)
140 BUG_ON(cl->magic == CLOSURE_MAGIC_ALIVE);
141 cl->magic = CLOSURE_MAGIC_ALIVE;
144 list_add(&cl->all, &closure_list);
148 void closure_debug_destroy(struct closure *cl)
152 BUG_ON(cl->magic != CLOSURE_MAGIC_ALIVE);
153 cl->magic = CLOSURE_MAGIC_DEAD;
156 list_del(&cl->all);
164 struct closure *cl;
168 list_for_each_entry(cl, &closure_list, all) {
169 int r = atomic_read(&cl->remaining);
172 cl, (void *) cl->ip, cl->fn, cl->parent,
177 work_data_bits(&cl->work)) ? "Q" : "",
182 (void *) cl->waiting_on);