Skip to content

Commit 77b5a08

Browse files
committed
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>
1 parent 06b285b commit 77b5a08

File tree

4 files changed

+14
-6
lines changed

4 files changed

+14
-6
lines changed

drivers/md/bcache/closure.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,6 @@ static inline void closure_wake_up(struct closure_waitlist *list)
320320
do { \
321321
set_closure_fn(_cl, _fn, _wq); \
322322
closure_sub(_cl, CLOSURE_RUNNING + 1); \
323-
return; \
324323
} while (0)
325324

326325
/**
@@ -349,7 +348,6 @@ do { \
349348
do { \
350349
set_closure_fn(_cl, _fn, _wq); \
351350
closure_queue(_cl); \
352-
return; \
353351
} while (0)
354352

355353
/**
@@ -365,7 +363,6 @@ do { \
365363
do { \
366364
set_closure_fn(_cl, _destructor, NULL); \
367365
closure_sub(_cl, CLOSURE_RUNNING - CLOSURE_DESTRUCTOR + 1); \
368-
return; \
369366
} while (0)
370367

371368
/**

drivers/md/bcache/io.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ void bch_generic_make_request(struct bio *bio, struct bio_split_pool *p)
105105
} while (n != bio);
106106

107107
continue_at(&s->cl, bch_bio_submit_split_done, NULL);
108+
return;
108109
submit:
109110
generic_make_request(bio);
110111
}

drivers/md/bcache/journal.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -592,12 +592,14 @@ static void journal_write_unlocked(struct closure *cl)
592592

593593
if (!w->need_write) {
594594
closure_return_with_destructor(cl, journal_write_unlock);
595+
return;
595596
} else if (journal_full(&c->journal)) {
596597
journal_reclaim(c);
597598
spin_unlock(&c->journal.lock);
598599

599600
btree_flush_write(c);
600601
continue_at(cl, journal_write, system_wq);
602+
return;
601603
}
602604

603605
c->journal.blocks_free -= set_blocks(w->data, block_bytes(c));

drivers/md/bcache/request.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,10 @@ static void bch_data_insert_keys(struct closure *cl)
8888
if (journal_ref)
8989
atomic_dec_bug(journal_ref);
9090

91-
if (!op->insert_data_done)
91+
if (!op->insert_data_done) {
9292
continue_at(cl, bch_data_insert_start, op->wq);
93+
return;
94+
}
9395

9496
bch_keylist_free(&op->insert_keys);
9597
closure_return(cl);
@@ -216,8 +218,10 @@ static void bch_data_insert_start(struct closure *cl)
216218
/* 1 for the device pointer and 1 for the chksum */
217219
if (bch_keylist_realloc(&op->insert_keys,
218220
3 + (op->csum ? 1 : 0),
219-
op->c))
221+
op->c)) {
220222
continue_at(cl, bch_data_insert_keys, op->wq);
223+
return;
224+
}
221225

222226
k = op->insert_keys.top;
223227
bkey_init(k);
@@ -255,6 +259,7 @@ static void bch_data_insert_start(struct closure *cl)
255259

256260
op->insert_data_done = true;
257261
continue_at(cl, bch_data_insert_keys, op->wq);
262+
return;
258263
err:
259264
/* bch_alloc_sectors() blocks if s->writeback = true */
260265
BUG_ON(op->writeback);
@@ -576,8 +581,10 @@ static void cache_lookup(struct closure *cl)
576581
ret = bch_btree_map_keys(&s->op, s->iop.c,
577582
&KEY(s->iop.inode, bio->bi_iter.bi_sector, 0),
578583
cache_lookup_fn, MAP_END_KEY);
579-
if (ret == -EAGAIN)
584+
if (ret == -EAGAIN) {
580585
continue_at(cl, cache_lookup, bcache_wq);
586+
return;
587+
}
581588

582589
closure_return(cl);
583590
}
@@ -1085,6 +1092,7 @@ static void flash_dev_make_request(struct request_queue *q, struct bio *bio)
10851092
continue_at_nobarrier(&s->cl,
10861093
flash_dev_nodata,
10871094
bcache_wq);
1095+
return;
10881096
} else if (rw) {
10891097
bch_keybuf_check_overlapping(&s->iop.c->moving_gc_keys,
10901098
&KEY(d->id, bio->bi_iter.bi_sector, 0),

0 commit comments

Comments
 (0)