summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2016-04-16 20:08:15 -0800
committerKent Overstreet <kent.overstreet@gmail.com>2017-01-18 21:39:11 -0900
commita047d4c7329a55ddbd4c7866549655b99ce1c52a (patch)
tree6036c19bef02c45ee2e0cd5b54ad47f829556c5a
parenta4dd47058dc14714c558b08584c76740ea38a723 (diff)
bcache: optimize continue_at_nobarrier()
-rw-r--r--drivers/md/bcache/closure.h11
1 files changed, 8 insertions, 3 deletions
diff --git a/drivers/md/bcache/closure.h b/drivers/md/bcache/closure.h
index ba5595a85055..83d45321155f 100644
--- a/drivers/md/bcache/closure.h
+++ b/drivers/md/bcache/closure.h
@@ -237,7 +237,7 @@ static inline void closure_queue(struct closure *cl)
if (wq) {
INIT_WORK(&cl->work, cl->work.func);
- BUG_ON(!queue_work(wq, &cl->work));
+ queue_work(wq, &cl->work);
} else
cl->fn(cl);
}
@@ -338,8 +338,13 @@ do { \
*/
#define continue_at_nobarrier(_cl, _fn, _wq) \
do { \
- set_closure_fn(_cl, _fn, _wq); \
- closure_queue(_cl); \
+ closure_set_ip(cl); \
+ if (_wq) { \
+ INIT_WORK(&(_cl)->work, (void *) _fn); \
+ queue_work((_wq), &(_cl)->work); \
+ } else { \
+ (_fn)(_cl); \
+ } \
return; \
} while (0)