diff options
author | Jens Axboe <axboe@fb.com> | 2015-03-06 10:37:46 -0500 |
---|---|---|
committer | Jens Axboe <axboe@fb.com> | 2015-07-11 11:57:32 -0400 |
commit | 77b5a08427e87514c33730afc18cd02c9475e2c3 (patch) | |
tree | b0d325533280f47253871044e875c0f71a369896 | |
parent | 06b285bd11257bccc5a1b85a835507e33656aff2 (diff) |
bcache: don't embed 'return' statements in closure macros
This is horribly confusing, it breaks the flow of the code without
it being apparent in the caller.
Signed-off-by: Jens Axboe <axboe@fb.com>
Acked-by: Christoph Hellwig <hch@lst.de>
-rw-r--r-- | drivers/md/bcache/closure.h | 3 | ||||
-rw-r--r-- | drivers/md/bcache/io.c | 1 | ||||
-rw-r--r-- | drivers/md/bcache/journal.c | 2 | ||||
-rw-r--r-- | drivers/md/bcache/request.c | 14 |
4 files changed, 14 insertions, 6 deletions
diff --git a/drivers/md/bcache/closure.h b/drivers/md/bcache/closure.h index a08e3eeac3c5..79a6d63e8ed3 100644 --- a/drivers/md/bcache/closure.h +++ b/drivers/md/bcache/closure.h | |||
@@ -320,7 +320,6 @@ static inline void closure_wake_up(struct closure_waitlist *list) | |||
320 | do { \ | 320 | do { \ |
321 | set_closure_fn(_cl, _fn, _wq); \ | 321 | set_closure_fn(_cl, _fn, _wq); \ |
322 | closure_sub(_cl, CLOSURE_RUNNING + 1); \ | 322 | closure_sub(_cl, CLOSURE_RUNNING + 1); \ |
323 | return; \ | ||
324 | } while (0) | 323 | } while (0) |
325 | 324 | ||
326 | /** | 325 | /** |
@@ -349,7 +348,6 @@ do { \ | |||
349 | do { \ | 348 | do { \ |
350 | set_closure_fn(_cl, _fn, _wq); \ | 349 | set_closure_fn(_cl, _fn, _wq); \ |
351 | closure_queue(_cl); \ | 350 | closure_queue(_cl); \ |
352 | return; \ | ||
353 | } while (0) | 351 | } while (0) |
354 | 352 | ||
355 | /** | 353 | /** |
@@ -365,7 +363,6 @@ do { \ | |||
365 | do { \ | 363 | do { \ |
366 | set_closure_fn(_cl, _destructor, NULL); \ | 364 | set_closure_fn(_cl, _destructor, NULL); \ |
367 | closure_sub(_cl, CLOSURE_RUNNING - CLOSURE_DESTRUCTOR + 1); \ | 365 | closure_sub(_cl, CLOSURE_RUNNING - CLOSURE_DESTRUCTOR + 1); \ |
368 | return; \ | ||
369 | } while (0) | 366 | } while (0) |
370 | 367 | ||
371 | /** | 368 | /** |
diff --git a/drivers/md/bcache/io.c b/drivers/md/bcache/io.c index cb64e64a4789..bf6a9ca18403 100644 --- a/drivers/md/bcache/io.c +++ b/drivers/md/bcache/io.c | |||
@@ -105,6 +105,7 @@ void bch_generic_make_request(struct bio *bio, struct bio_split_pool *p) | |||
105 | } while (n != bio); | 105 | } while (n != bio); |
106 | 106 | ||
107 | continue_at(&s->cl, bch_bio_submit_split_done, NULL); | 107 | continue_at(&s->cl, bch_bio_submit_split_done, NULL); |
108 | return; | ||
108 | submit: | 109 | submit: |
109 | generic_make_request(bio); | 110 | generic_make_request(bio); |
110 | } | 111 | } |
diff --git a/drivers/md/bcache/journal.c b/drivers/md/bcache/journal.c index ce64fc851251..418607a6ba33 100644 --- a/drivers/md/bcache/journal.c +++ b/drivers/md/bcache/journal.c | |||
@@ -592,12 +592,14 @@ static void journal_write_unlocked(struct closure *cl) | |||
592 | 592 | ||
593 | if (!w->need_write) { | 593 | if (!w->need_write) { |
594 | closure_return_with_destructor(cl, journal_write_unlock); | 594 | closure_return_with_destructor(cl, journal_write_unlock); |
595 | return; | ||
595 | } else if (journal_full(&c->journal)) { | 596 | } else if (journal_full(&c->journal)) { |
596 | journal_reclaim(c); | 597 | journal_reclaim(c); |
597 | spin_unlock(&c->journal.lock); | 598 | spin_unlock(&c->journal.lock); |
598 | 599 | ||
599 | btree_flush_write(c); | 600 | btree_flush_write(c); |
600 | continue_at(cl, journal_write, system_wq); | 601 | continue_at(cl, journal_write, system_wq); |
602 | return; | ||
601 | } | 603 | } |
602 | 604 | ||
603 | c->journal.blocks_free -= set_blocks(w->data, block_bytes(c)); | 605 | c->journal.blocks_free -= set_blocks(w->data, block_bytes(c)); |
diff --git a/drivers/md/bcache/request.c b/drivers/md/bcache/request.c index 4afb2d26b148..f292790997d7 100644 --- a/drivers/md/bcache/request.c +++ b/drivers/md/bcache/request.c | |||
@@ -88,8 +88,10 @@ static void bch_data_insert_keys(struct closure *cl) | |||
88 | if (journal_ref) | 88 | if (journal_ref) |
89 | atomic_dec_bug(journal_ref); | 89 | atomic_dec_bug(journal_ref); |
90 | 90 | ||
91 | if (!op->insert_data_done) | 91 | if (!op->insert_data_done) { |
92 | continue_at(cl, bch_data_insert_start, op->wq); | 92 | continue_at(cl, bch_data_insert_start, op->wq); |
93 | return; | ||
94 | } | ||
93 | 95 | ||
94 | bch_keylist_free(&op->insert_keys); | 96 | bch_keylist_free(&op->insert_keys); |
95 | closure_return(cl); | 97 | closure_return(cl); |
@@ -216,8 +218,10 @@ static void bch_data_insert_start(struct closure *cl) | |||
216 | /* 1 for the device pointer and 1 for the chksum */ | 218 | /* 1 for the device pointer and 1 for the chksum */ |
217 | if (bch_keylist_realloc(&op->insert_keys, | 219 | if (bch_keylist_realloc(&op->insert_keys, |
218 | 3 + (op->csum ? 1 : 0), | 220 | 3 + (op->csum ? 1 : 0), |
219 | op->c)) | 221 | op->c)) { |
220 | continue_at(cl, bch_data_insert_keys, op->wq); | 222 | continue_at(cl, bch_data_insert_keys, op->wq); |
223 | return; | ||
224 | } | ||
221 | 225 | ||
222 | k = op->insert_keys.top; | 226 | k = op->insert_keys.top; |
223 | bkey_init(k); | 227 | bkey_init(k); |
@@ -255,6 +259,7 @@ static void bch_data_insert_start(struct closure *cl) | |||
255 | 259 | ||
256 | op->insert_data_done = true; | 260 | op->insert_data_done = true; |
257 | continue_at(cl, bch_data_insert_keys, op->wq); | 261 | continue_at(cl, bch_data_insert_keys, op->wq); |
262 | return; | ||
258 | err: | 263 | err: |
259 | /* bch_alloc_sectors() blocks if s->writeback = true */ | 264 | /* bch_alloc_sectors() blocks if s->writeback = true */ |
260 | BUG_ON(op->writeback); | 265 | BUG_ON(op->writeback); |
@@ -576,8 +581,10 @@ static void cache_lookup(struct closure *cl) | |||
576 | ret = bch_btree_map_keys(&s->op, s->iop.c, | 581 | ret = bch_btree_map_keys(&s->op, s->iop.c, |
577 | &KEY(s->iop.inode, bio->bi_iter.bi_sector, 0), | 582 | &KEY(s->iop.inode, bio->bi_iter.bi_sector, 0), |
578 | cache_lookup_fn, MAP_END_KEY); | 583 | cache_lookup_fn, MAP_END_KEY); |
579 | if (ret == -EAGAIN) | 584 | if (ret == -EAGAIN) { |
580 | continue_at(cl, cache_lookup, bcache_wq); | 585 | continue_at(cl, cache_lookup, bcache_wq); |
586 | return; | ||
587 | } | ||
581 | 588 | ||
582 | closure_return(cl); | 589 | closure_return(cl); |
583 | } | 590 | } |
@@ -1085,6 +1092,7 @@ static void flash_dev_make_request(struct request_queue *q, struct bio *bio) | |||
1085 | continue_at_nobarrier(&s->cl, | 1092 | continue_at_nobarrier(&s->cl, |
1086 | flash_dev_nodata, | 1093 | flash_dev_nodata, |
1087 | bcache_wq); | 1094 | bcache_wq); |
1095 | return; | ||
1088 | } else if (rw) { | 1096 | } else if (rw) { |
1089 | bch_keybuf_check_overlapping(&s->iop.c->moving_gc_keys, | 1097 | bch_keybuf_check_overlapping(&s->iop.c->moving_gc_keys, |
1090 | &KEY(d->id, bio->bi_iter.bi_sector, 0), | 1098 | &KEY(d->id, bio->bi_iter.bi_sector, 0), |