Lines Matching refs:cl
31 * continue_at(cl, next_function, workqueue);
46 * closure_put(cl);
49 * closure_init(cl);
52 * closure_get(cl);
57 * closure_get(cl);
61 * continue_at(cl, complete_some_read, system_wq);
94 * continue_at(cl, NULL, NULL);
169 void closure_sub(struct closure *cl, int v);
170 void closure_put(struct closure *cl);
172 bool closure_wait(struct closure_waitlist *list, struct closure *cl);
173 void __closure_sync(struct closure *cl);
181 static inline void closure_sync(struct closure *cl)
183 if ((atomic_read(&cl->remaining) & CLOSURE_REMAINING_MASK) != 1)
184 __closure_sync(cl);
190 void closure_debug_create(struct closure *cl);
191 void closure_debug_destroy(struct closure *cl);
196 static inline void closure_debug_create(struct closure *cl) {}
197 static inline void closure_debug_destroy(struct closure *cl) {}
201 static inline void closure_set_ip(struct closure *cl)
204 cl->ip = _THIS_IP_;
208 static inline void closure_set_ret_ip(struct closure *cl)
211 cl->ip = _RET_IP_;
215 static inline void closure_set_waiting(struct closure *cl, unsigned long f)
218 cl->waiting_on = f;
222 static inline void closure_set_stopped(struct closure *cl)
224 atomic_sub(CLOSURE_RUNNING, &cl->remaining);
227 static inline void set_closure_fn(struct closure *cl, closure_fn *fn,
230 closure_set_ip(cl);
231 cl->fn = fn;
232 cl->wq = wq;
237 static inline void closure_queue(struct closure *cl)
239 struct workqueue_struct *wq = cl->wq;
247 INIT_WORK(&cl->work, cl->work.func);
248 BUG_ON(!queue_work(wq, &cl->work));
250 cl->fn(cl);
256 static inline void closure_get(struct closure *cl)
259 BUG_ON((atomic_inc_return(&cl->remaining) &
262 atomic_inc(&cl->remaining);
268 * @cl: closure to initialize
269 * @parent: parent of the new closure. cl will take a refcount on it for its
272 static inline void closure_init(struct closure *cl, struct closure *parent)
274 memset(cl, 0, sizeof(struct closure));
275 cl->parent = parent;
279 atomic_set(&cl->remaining, CLOSURE_REMAINING_INITIALIZER);
281 closure_debug_create(cl);
282 closure_set_ip(cl);
285 static inline void closure_init_stack(struct closure *cl)
287 memset(cl, 0, sizeof(struct closure));
288 atomic_set(&cl->remaining, CLOSURE_REMAINING_INITIALIZER);
305 * After @cl is no longer waiting on anything (i.e. all outstanding refs have
309 * This is because after calling continue_at() you no longer have a ref on @cl,
310 * and whatever @cl owns may be freed out from under you - a running closure fn
324 * This is used to indicate that @cl is finished: when all outstanding refs on
325 * @cl have been dropped @cl's ref on its parent closure (as passed to
334 * Causes @fn to be executed out of @cl, in @wq context (or called directly if
337 * The ref the caller of continue_at_nobarrier() had on @cl is now owned by @fn,
338 * thus it's not safe to touch anything protected by @cl after a
352 * outstanding refs on @cl have been dropped; @destructor may be used to safely
353 * free the memory occupied by @cl, and it is called with the ref on the parent
355 * freelist protected by @cl's parent.
367 * asynchronously out of a new closure - @parent will then wait for @cl to
370 static inline void closure_call(struct closure *cl, closure_fn fn,
374 closure_init(cl, parent);
375 continue_at_nobarrier(cl, fn, wq);