1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0 */
2*4882a593Smuzhiyun #ifndef _LINUX_CLOSURE_H
3*4882a593Smuzhiyun #define _LINUX_CLOSURE_H
4*4882a593Smuzhiyun
5*4882a593Smuzhiyun #include <linux/llist.h>
6*4882a593Smuzhiyun #include <linux/sched.h>
7*4882a593Smuzhiyun #include <linux/sched/task_stack.h>
8*4882a593Smuzhiyun #include <linux/workqueue.h>
9*4882a593Smuzhiyun
10*4882a593Smuzhiyun /*
11*4882a593Smuzhiyun * Closure is perhaps the most overused and abused term in computer science, but
12*4882a593Smuzhiyun * since I've been unable to come up with anything better you're stuck with it
13*4882a593Smuzhiyun * again.
14*4882a593Smuzhiyun *
15*4882a593Smuzhiyun * What are closures?
16*4882a593Smuzhiyun *
17*4882a593Smuzhiyun * They embed a refcount. The basic idea is they count "things that are in
18*4882a593Smuzhiyun * progress" - in flight bios, some other thread that's doing something else -
19*4882a593Smuzhiyun * anything you might want to wait on.
20*4882a593Smuzhiyun *
21*4882a593Smuzhiyun * The refcount may be manipulated with closure_get() and closure_put().
22*4882a593Smuzhiyun * closure_put() is where many of the interesting things happen, when it causes
23*4882a593Smuzhiyun * the refcount to go to 0.
24*4882a593Smuzhiyun *
25*4882a593Smuzhiyun * Closures can be used to wait on things both synchronously and asynchronously,
26*4882a593Smuzhiyun * and synchronous and asynchronous use can be mixed without restriction. To
27*4882a593Smuzhiyun * wait synchronously, use closure_sync() - you will sleep until your closure's
28*4882a593Smuzhiyun * refcount hits 1.
29*4882a593Smuzhiyun *
30*4882a593Smuzhiyun * To wait asynchronously, use
31*4882a593Smuzhiyun * continue_at(cl, next_function, workqueue);
32*4882a593Smuzhiyun *
33*4882a593Smuzhiyun * passing it, as you might expect, the function to run when nothing is pending
34*4882a593Smuzhiyun * and the workqueue to run that function out of.
35*4882a593Smuzhiyun *
36*4882a593Smuzhiyun * continue_at() also, critically, requires a 'return' immediately following the
37*4882a593Smuzhiyun * location where this macro is referenced, to return to the calling function.
38*4882a593Smuzhiyun * There's good reason for this.
39*4882a593Smuzhiyun *
40*4882a593Smuzhiyun * To use safely closures asynchronously, they must always have a refcount while
41*4882a593Smuzhiyun * they are running owned by the thread that is running them. Otherwise, suppose
42*4882a593Smuzhiyun * you submit some bios and wish to have a function run when they all complete:
43*4882a593Smuzhiyun *
44*4882a593Smuzhiyun * foo_endio(struct bio *bio)
45*4882a593Smuzhiyun * {
46*4882a593Smuzhiyun * closure_put(cl);
47*4882a593Smuzhiyun * }
48*4882a593Smuzhiyun *
49*4882a593Smuzhiyun * closure_init(cl);
50*4882a593Smuzhiyun *
51*4882a593Smuzhiyun * do_stuff();
52*4882a593Smuzhiyun * closure_get(cl);
53*4882a593Smuzhiyun * bio1->bi_endio = foo_endio;
54*4882a593Smuzhiyun * bio_submit(bio1);
55*4882a593Smuzhiyun *
56*4882a593Smuzhiyun * do_more_stuff();
57*4882a593Smuzhiyun * closure_get(cl);
58*4882a593Smuzhiyun * bio2->bi_endio = foo_endio;
59*4882a593Smuzhiyun * bio_submit(bio2);
60*4882a593Smuzhiyun *
61*4882a593Smuzhiyun * continue_at(cl, complete_some_read, system_wq);
62*4882a593Smuzhiyun *
63*4882a593Smuzhiyun * If closure's refcount started at 0, complete_some_read() could run before the
64*4882a593Smuzhiyun * second bio was submitted - which is almost always not what you want! More
65*4882a593Smuzhiyun * importantly, it wouldn't be possible to say whether the original thread or
66*4882a593Smuzhiyun * complete_some_read()'s thread owned the closure - and whatever state it was
67*4882a593Smuzhiyun * associated with!
68*4882a593Smuzhiyun *
69*4882a593Smuzhiyun * So, closure_init() initializes a closure's refcount to 1 - and when a
70*4882a593Smuzhiyun * closure_fn is run, the refcount will be reset to 1 first.
71*4882a593Smuzhiyun *
72*4882a593Smuzhiyun * Then, the rule is - if you got the refcount with closure_get(), release it
73*4882a593Smuzhiyun * with closure_put() (i.e, in a bio->bi_endio function). If you have a refcount
74*4882a593Smuzhiyun * on a closure because you called closure_init() or you were run out of a
75*4882a593Smuzhiyun * closure - _always_ use continue_at(). Doing so consistently will help
76*4882a593Smuzhiyun * eliminate an entire class of particularly pernicious races.
77*4882a593Smuzhiyun *
78*4882a593Smuzhiyun * Lastly, you might have a wait list dedicated to a specific event, and have no
79*4882a593Smuzhiyun * need for specifying the condition - you just want to wait until someone runs
80*4882a593Smuzhiyun * closure_wake_up() on the appropriate wait list. In that case, just use
81*4882a593Smuzhiyun * closure_wait(). It will return either true or false, depending on whether the
82*4882a593Smuzhiyun * closure was already on a wait list or not - a closure can only be on one wait
83*4882a593Smuzhiyun * list at a time.
84*4882a593Smuzhiyun *
85*4882a593Smuzhiyun * Parents:
86*4882a593Smuzhiyun *
87*4882a593Smuzhiyun * closure_init() takes two arguments - it takes the closure to initialize, and
88*4882a593Smuzhiyun * a (possibly null) parent.
89*4882a593Smuzhiyun *
90*4882a593Smuzhiyun * If parent is non null, the new closure will have a refcount for its lifetime;
91*4882a593Smuzhiyun * a closure is considered to be "finished" when its refcount hits 0 and the
92*4882a593Smuzhiyun * function to run is null. Hence
93*4882a593Smuzhiyun *
94*4882a593Smuzhiyun * continue_at(cl, NULL, NULL);
95*4882a593Smuzhiyun *
96*4882a593Smuzhiyun * returns up the (spaghetti) stack of closures, precisely like normal return
97*4882a593Smuzhiyun * returns up the C stack. continue_at() with non null fn is better thought of
98*4882a593Smuzhiyun * as doing a tail call.
99*4882a593Smuzhiyun *
100*4882a593Smuzhiyun * All this implies that a closure should typically be embedded in a particular
101*4882a593Smuzhiyun * struct (which its refcount will normally control the lifetime of), and that
102*4882a593Smuzhiyun * struct can very much be thought of as a stack frame.
103*4882a593Smuzhiyun */
104*4882a593Smuzhiyun
105*4882a593Smuzhiyun struct closure;
106*4882a593Smuzhiyun struct closure_syncer;
107*4882a593Smuzhiyun typedef void (closure_fn) (struct closure *);
108*4882a593Smuzhiyun extern struct dentry *bcache_debug;
109*4882a593Smuzhiyun
110*4882a593Smuzhiyun struct closure_waitlist {
111*4882a593Smuzhiyun struct llist_head list;
112*4882a593Smuzhiyun };
113*4882a593Smuzhiyun
114*4882a593Smuzhiyun enum closure_state {
115*4882a593Smuzhiyun /*
116*4882a593Smuzhiyun * CLOSURE_WAITING: Set iff the closure is on a waitlist. Must be set by
117*4882a593Smuzhiyun * the thread that owns the closure, and cleared by the thread that's
118*4882a593Smuzhiyun * waking up the closure.
119*4882a593Smuzhiyun *
120*4882a593Smuzhiyun * The rest are for debugging and don't affect behaviour:
121*4882a593Smuzhiyun *
122*4882a593Smuzhiyun * CLOSURE_RUNNING: Set when a closure is running (i.e. by
123*4882a593Smuzhiyun * closure_init() and when closure_put() runs then next function), and
124*4882a593Smuzhiyun * must be cleared before remaining hits 0. Primarily to help guard
125*4882a593Smuzhiyun * against incorrect usage and accidentally transferring references.
126*4882a593Smuzhiyun * continue_at() and closure_return() clear it for you, if you're doing
127*4882a593Smuzhiyun * something unusual you can use closure_set_dead() which also helps
128*4882a593Smuzhiyun * annotate where references are being transferred.
129*4882a593Smuzhiyun */
130*4882a593Smuzhiyun
131*4882a593Smuzhiyun CLOSURE_BITS_START = (1U << 26),
132*4882a593Smuzhiyun CLOSURE_DESTRUCTOR = (1U << 26),
133*4882a593Smuzhiyun CLOSURE_WAITING = (1U << 28),
134*4882a593Smuzhiyun CLOSURE_RUNNING = (1U << 30),
135*4882a593Smuzhiyun };
136*4882a593Smuzhiyun
137*4882a593Smuzhiyun #define CLOSURE_GUARD_MASK \
138*4882a593Smuzhiyun ((CLOSURE_DESTRUCTOR|CLOSURE_WAITING|CLOSURE_RUNNING) << 1)
139*4882a593Smuzhiyun
140*4882a593Smuzhiyun #define CLOSURE_REMAINING_MASK (CLOSURE_BITS_START - 1)
141*4882a593Smuzhiyun #define CLOSURE_REMAINING_INITIALIZER (1|CLOSURE_RUNNING)
142*4882a593Smuzhiyun
143*4882a593Smuzhiyun struct closure {
144*4882a593Smuzhiyun union {
145*4882a593Smuzhiyun struct {
146*4882a593Smuzhiyun struct workqueue_struct *wq;
147*4882a593Smuzhiyun struct closure_syncer *s;
148*4882a593Smuzhiyun struct llist_node list;
149*4882a593Smuzhiyun closure_fn *fn;
150*4882a593Smuzhiyun };
151*4882a593Smuzhiyun struct work_struct work;
152*4882a593Smuzhiyun };
153*4882a593Smuzhiyun
154*4882a593Smuzhiyun struct closure *parent;
155*4882a593Smuzhiyun
156*4882a593Smuzhiyun atomic_t remaining;
157*4882a593Smuzhiyun
158*4882a593Smuzhiyun #ifdef CONFIG_BCACHE_CLOSURES_DEBUG
159*4882a593Smuzhiyun #define CLOSURE_MAGIC_DEAD 0xc054dead
160*4882a593Smuzhiyun #define CLOSURE_MAGIC_ALIVE 0xc054a11e
161*4882a593Smuzhiyun
162*4882a593Smuzhiyun unsigned int magic;
163*4882a593Smuzhiyun struct list_head all;
164*4882a593Smuzhiyun unsigned long ip;
165*4882a593Smuzhiyun unsigned long waiting_on;
166*4882a593Smuzhiyun #endif
167*4882a593Smuzhiyun };
168*4882a593Smuzhiyun
169*4882a593Smuzhiyun void closure_sub(struct closure *cl, int v);
170*4882a593Smuzhiyun void closure_put(struct closure *cl);
171*4882a593Smuzhiyun void __closure_wake_up(struct closure_waitlist *list);
172*4882a593Smuzhiyun bool closure_wait(struct closure_waitlist *list, struct closure *cl);
173*4882a593Smuzhiyun void __closure_sync(struct closure *cl);
174*4882a593Smuzhiyun
175*4882a593Smuzhiyun /**
176*4882a593Smuzhiyun * closure_sync - sleep until a closure a closure has nothing left to wait on
177*4882a593Smuzhiyun *
178*4882a593Smuzhiyun * Sleeps until the refcount hits 1 - the thread that's running the closure owns
179*4882a593Smuzhiyun * the last refcount.
180*4882a593Smuzhiyun */
closure_sync(struct closure * cl)181*4882a593Smuzhiyun static inline void closure_sync(struct closure *cl)
182*4882a593Smuzhiyun {
183*4882a593Smuzhiyun if ((atomic_read(&cl->remaining) & CLOSURE_REMAINING_MASK) != 1)
184*4882a593Smuzhiyun __closure_sync(cl);
185*4882a593Smuzhiyun }
186*4882a593Smuzhiyun
187*4882a593Smuzhiyun #ifdef CONFIG_BCACHE_CLOSURES_DEBUG
188*4882a593Smuzhiyun
189*4882a593Smuzhiyun void closure_debug_init(void);
190*4882a593Smuzhiyun void closure_debug_create(struct closure *cl);
191*4882a593Smuzhiyun void closure_debug_destroy(struct closure *cl);
192*4882a593Smuzhiyun
193*4882a593Smuzhiyun #else
194*4882a593Smuzhiyun
closure_debug_init(void)195*4882a593Smuzhiyun static inline void closure_debug_init(void) {}
closure_debug_create(struct closure * cl)196*4882a593Smuzhiyun static inline void closure_debug_create(struct closure *cl) {}
closure_debug_destroy(struct closure * cl)197*4882a593Smuzhiyun static inline void closure_debug_destroy(struct closure *cl) {}
198*4882a593Smuzhiyun
199*4882a593Smuzhiyun #endif
200*4882a593Smuzhiyun
closure_set_ip(struct closure * cl)201*4882a593Smuzhiyun static inline void closure_set_ip(struct closure *cl)
202*4882a593Smuzhiyun {
203*4882a593Smuzhiyun #ifdef CONFIG_BCACHE_CLOSURES_DEBUG
204*4882a593Smuzhiyun cl->ip = _THIS_IP_;
205*4882a593Smuzhiyun #endif
206*4882a593Smuzhiyun }
207*4882a593Smuzhiyun
closure_set_ret_ip(struct closure * cl)208*4882a593Smuzhiyun static inline void closure_set_ret_ip(struct closure *cl)
209*4882a593Smuzhiyun {
210*4882a593Smuzhiyun #ifdef CONFIG_BCACHE_CLOSURES_DEBUG
211*4882a593Smuzhiyun cl->ip = _RET_IP_;
212*4882a593Smuzhiyun #endif
213*4882a593Smuzhiyun }
214*4882a593Smuzhiyun
closure_set_waiting(struct closure * cl,unsigned long f)215*4882a593Smuzhiyun static inline void closure_set_waiting(struct closure *cl, unsigned long f)
216*4882a593Smuzhiyun {
217*4882a593Smuzhiyun #ifdef CONFIG_BCACHE_CLOSURES_DEBUG
218*4882a593Smuzhiyun cl->waiting_on = f;
219*4882a593Smuzhiyun #endif
220*4882a593Smuzhiyun }
221*4882a593Smuzhiyun
closure_set_stopped(struct closure * cl)222*4882a593Smuzhiyun static inline void closure_set_stopped(struct closure *cl)
223*4882a593Smuzhiyun {
224*4882a593Smuzhiyun atomic_sub(CLOSURE_RUNNING, &cl->remaining);
225*4882a593Smuzhiyun }
226*4882a593Smuzhiyun
set_closure_fn(struct closure * cl,closure_fn * fn,struct workqueue_struct * wq)227*4882a593Smuzhiyun static inline void set_closure_fn(struct closure *cl, closure_fn *fn,
228*4882a593Smuzhiyun struct workqueue_struct *wq)
229*4882a593Smuzhiyun {
230*4882a593Smuzhiyun closure_set_ip(cl);
231*4882a593Smuzhiyun cl->fn = fn;
232*4882a593Smuzhiyun cl->wq = wq;
233*4882a593Smuzhiyun /* between atomic_dec() in closure_put() */
234*4882a593Smuzhiyun smp_mb__before_atomic();
235*4882a593Smuzhiyun }
236*4882a593Smuzhiyun
closure_queue(struct closure * cl)237*4882a593Smuzhiyun static inline void closure_queue(struct closure *cl)
238*4882a593Smuzhiyun {
239*4882a593Smuzhiyun struct workqueue_struct *wq = cl->wq;
240*4882a593Smuzhiyun /**
241*4882a593Smuzhiyun * Changes made to closure, work_struct, or a couple of other structs
242*4882a593Smuzhiyun * may cause work.func not pointing to the right location.
243*4882a593Smuzhiyun */
244*4882a593Smuzhiyun BUILD_BUG_ON(offsetof(struct closure, fn)
245*4882a593Smuzhiyun != offsetof(struct work_struct, func));
246*4882a593Smuzhiyun if (wq) {
247*4882a593Smuzhiyun INIT_WORK(&cl->work, cl->work.func);
248*4882a593Smuzhiyun BUG_ON(!queue_work(wq, &cl->work));
249*4882a593Smuzhiyun } else
250*4882a593Smuzhiyun cl->fn(cl);
251*4882a593Smuzhiyun }
252*4882a593Smuzhiyun
253*4882a593Smuzhiyun /**
254*4882a593Smuzhiyun * closure_get - increment a closure's refcount
255*4882a593Smuzhiyun */
closure_get(struct closure * cl)256*4882a593Smuzhiyun static inline void closure_get(struct closure *cl)
257*4882a593Smuzhiyun {
258*4882a593Smuzhiyun #ifdef CONFIG_BCACHE_CLOSURES_DEBUG
259*4882a593Smuzhiyun BUG_ON((atomic_inc_return(&cl->remaining) &
260*4882a593Smuzhiyun CLOSURE_REMAINING_MASK) <= 1);
261*4882a593Smuzhiyun #else
262*4882a593Smuzhiyun atomic_inc(&cl->remaining);
263*4882a593Smuzhiyun #endif
264*4882a593Smuzhiyun }
265*4882a593Smuzhiyun
266*4882a593Smuzhiyun /**
267*4882a593Smuzhiyun * closure_init - Initialize a closure, setting the refcount to 1
268*4882a593Smuzhiyun * @cl: closure to initialize
269*4882a593Smuzhiyun * @parent: parent of the new closure. cl will take a refcount on it for its
270*4882a593Smuzhiyun * lifetime; may be NULL.
271*4882a593Smuzhiyun */
closure_init(struct closure * cl,struct closure * parent)272*4882a593Smuzhiyun static inline void closure_init(struct closure *cl, struct closure *parent)
273*4882a593Smuzhiyun {
274*4882a593Smuzhiyun memset(cl, 0, sizeof(struct closure));
275*4882a593Smuzhiyun cl->parent = parent;
276*4882a593Smuzhiyun if (parent)
277*4882a593Smuzhiyun closure_get(parent);
278*4882a593Smuzhiyun
279*4882a593Smuzhiyun atomic_set(&cl->remaining, CLOSURE_REMAINING_INITIALIZER);
280*4882a593Smuzhiyun
281*4882a593Smuzhiyun closure_debug_create(cl);
282*4882a593Smuzhiyun closure_set_ip(cl);
283*4882a593Smuzhiyun }
284*4882a593Smuzhiyun
closure_init_stack(struct closure * cl)285*4882a593Smuzhiyun static inline void closure_init_stack(struct closure *cl)
286*4882a593Smuzhiyun {
287*4882a593Smuzhiyun memset(cl, 0, sizeof(struct closure));
288*4882a593Smuzhiyun atomic_set(&cl->remaining, CLOSURE_REMAINING_INITIALIZER);
289*4882a593Smuzhiyun }
290*4882a593Smuzhiyun
291*4882a593Smuzhiyun /**
292*4882a593Smuzhiyun * closure_wake_up - wake up all closures on a wait list,
293*4882a593Smuzhiyun * with memory barrier
294*4882a593Smuzhiyun */
closure_wake_up(struct closure_waitlist * list)295*4882a593Smuzhiyun static inline void closure_wake_up(struct closure_waitlist *list)
296*4882a593Smuzhiyun {
297*4882a593Smuzhiyun /* Memory barrier for the wait list */
298*4882a593Smuzhiyun smp_mb();
299*4882a593Smuzhiyun __closure_wake_up(list);
300*4882a593Smuzhiyun }
301*4882a593Smuzhiyun
302*4882a593Smuzhiyun /**
303*4882a593Smuzhiyun * continue_at - jump to another function with barrier
304*4882a593Smuzhiyun *
305*4882a593Smuzhiyun * After @cl is no longer waiting on anything (i.e. all outstanding refs have
306*4882a593Smuzhiyun * been dropped with closure_put()), it will resume execution at @fn running out
307*4882a593Smuzhiyun * of @wq (or, if @wq is NULL, @fn will be called by closure_put() directly).
308*4882a593Smuzhiyun *
309*4882a593Smuzhiyun * This is because after calling continue_at() you no longer have a ref on @cl,
310*4882a593Smuzhiyun * and whatever @cl owns may be freed out from under you - a running closure fn
311*4882a593Smuzhiyun * has a ref on its own closure which continue_at() drops.
312*4882a593Smuzhiyun *
313*4882a593Smuzhiyun * Note you are expected to immediately return after using this macro.
314*4882a593Smuzhiyun */
315*4882a593Smuzhiyun #define continue_at(_cl, _fn, _wq) \
316*4882a593Smuzhiyun do { \
317*4882a593Smuzhiyun set_closure_fn(_cl, _fn, _wq); \
318*4882a593Smuzhiyun closure_sub(_cl, CLOSURE_RUNNING + 1); \
319*4882a593Smuzhiyun } while (0)
320*4882a593Smuzhiyun
321*4882a593Smuzhiyun /**
322*4882a593Smuzhiyun * closure_return - finish execution of a closure
323*4882a593Smuzhiyun *
324*4882a593Smuzhiyun * This is used to indicate that @cl is finished: when all outstanding refs on
325*4882a593Smuzhiyun * @cl have been dropped @cl's ref on its parent closure (as passed to
326*4882a593Smuzhiyun * closure_init()) will be dropped, if one was specified - thus this can be
327*4882a593Smuzhiyun * thought of as returning to the parent closure.
328*4882a593Smuzhiyun */
329*4882a593Smuzhiyun #define closure_return(_cl) continue_at((_cl), NULL, NULL)
330*4882a593Smuzhiyun
331*4882a593Smuzhiyun /**
332*4882a593Smuzhiyun * continue_at_nobarrier - jump to another function without barrier
333*4882a593Smuzhiyun *
334*4882a593Smuzhiyun * Causes @fn to be executed out of @cl, in @wq context (or called directly if
335*4882a593Smuzhiyun * @wq is NULL).
336*4882a593Smuzhiyun *
337*4882a593Smuzhiyun * The ref the caller of continue_at_nobarrier() had on @cl is now owned by @fn,
338*4882a593Smuzhiyun * thus it's not safe to touch anything protected by @cl after a
339*4882a593Smuzhiyun * continue_at_nobarrier().
340*4882a593Smuzhiyun */
341*4882a593Smuzhiyun #define continue_at_nobarrier(_cl, _fn, _wq) \
342*4882a593Smuzhiyun do { \
343*4882a593Smuzhiyun set_closure_fn(_cl, _fn, _wq); \
344*4882a593Smuzhiyun closure_queue(_cl); \
345*4882a593Smuzhiyun } while (0)
346*4882a593Smuzhiyun
347*4882a593Smuzhiyun /**
348*4882a593Smuzhiyun * closure_return_with_destructor - finish execution of a closure,
349*4882a593Smuzhiyun * with destructor
350*4882a593Smuzhiyun *
351*4882a593Smuzhiyun * Works like closure_return(), except @destructor will be called when all
352*4882a593Smuzhiyun * outstanding refs on @cl have been dropped; @destructor may be used to safely
353*4882a593Smuzhiyun * free the memory occupied by @cl, and it is called with the ref on the parent
354*4882a593Smuzhiyun * closure still held - so @destructor could safely return an item to a
355*4882a593Smuzhiyun * freelist protected by @cl's parent.
356*4882a593Smuzhiyun */
357*4882a593Smuzhiyun #define closure_return_with_destructor(_cl, _destructor) \
358*4882a593Smuzhiyun do { \
359*4882a593Smuzhiyun set_closure_fn(_cl, _destructor, NULL); \
360*4882a593Smuzhiyun closure_sub(_cl, CLOSURE_RUNNING - CLOSURE_DESTRUCTOR + 1); \
361*4882a593Smuzhiyun } while (0)
362*4882a593Smuzhiyun
363*4882a593Smuzhiyun /**
364*4882a593Smuzhiyun * closure_call - execute @fn out of a new, uninitialized closure
365*4882a593Smuzhiyun *
366*4882a593Smuzhiyun * Typically used when running out of one closure, and we want to run @fn
367*4882a593Smuzhiyun * asynchronously out of a new closure - @parent will then wait for @cl to
368*4882a593Smuzhiyun * finish.
369*4882a593Smuzhiyun */
closure_call(struct closure * cl,closure_fn fn,struct workqueue_struct * wq,struct closure * parent)370*4882a593Smuzhiyun static inline void closure_call(struct closure *cl, closure_fn fn,
371*4882a593Smuzhiyun struct workqueue_struct *wq,
372*4882a593Smuzhiyun struct closure *parent)
373*4882a593Smuzhiyun {
374*4882a593Smuzhiyun closure_init(cl, parent);
375*4882a593Smuzhiyun continue_at_nobarrier(cl, fn, wq);
376*4882a593Smuzhiyun }
377*4882a593Smuzhiyun
378*4882a593Smuzhiyun #endif /* _LINUX_CLOSURE_H */
379