diff options
Diffstat (limited to 'drivers/md/bcache/request.c')
-rw-r--r-- | drivers/md/bcache/request.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/drivers/md/bcache/request.c b/drivers/md/bcache/request.c index ab43faddb447..f292790997d7 100644 --- a/drivers/md/bcache/request.c +++ b/drivers/md/bcache/request.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/module.h> | 15 | #include <linux/module.h> |
16 | #include <linux/hash.h> | 16 | #include <linux/hash.h> |
17 | #include <linux/random.h> | 17 | #include <linux/random.h> |
18 | #include <linux/backing-dev.h> | ||
18 | 19 | ||
19 | #include <trace/events/bcache.h> | 20 | #include <trace/events/bcache.h> |
20 | 21 | ||
@@ -87,8 +88,10 @@ static void bch_data_insert_keys(struct closure *cl) | |||
87 | if (journal_ref) | 88 | if (journal_ref) |
88 | atomic_dec_bug(journal_ref); | 89 | atomic_dec_bug(journal_ref); |
89 | 90 | ||
90 | if (!op->insert_data_done) | 91 | if (!op->insert_data_done) { |
91 | continue_at(cl, bch_data_insert_start, op->wq); | 92 | continue_at(cl, bch_data_insert_start, op->wq); |
93 | return; | ||
94 | } | ||
92 | 95 | ||
93 | bch_keylist_free(&op->insert_keys); | 96 | bch_keylist_free(&op->insert_keys); |
94 | closure_return(cl); | 97 | closure_return(cl); |
@@ -215,8 +218,10 @@ static void bch_data_insert_start(struct closure *cl) | |||
215 | /* 1 for the device pointer and 1 for the chksum */ | 218 | /* 1 for the device pointer and 1 for the chksum */ |
216 | if (bch_keylist_realloc(&op->insert_keys, | 219 | if (bch_keylist_realloc(&op->insert_keys, |
217 | 3 + (op->csum ? 1 : 0), | 220 | 3 + (op->csum ? 1 : 0), |
218 | op->c)) | 221 | op->c)) { |
219 | continue_at(cl, bch_data_insert_keys, op->wq); | 222 | continue_at(cl, bch_data_insert_keys, op->wq); |
223 | return; | ||
224 | } | ||
220 | 225 | ||
221 | k = op->insert_keys.top; | 226 | k = op->insert_keys.top; |
222 | bkey_init(k); | 227 | bkey_init(k); |
@@ -254,6 +259,7 @@ static void bch_data_insert_start(struct closure *cl) | |||
254 | 259 | ||
255 | op->insert_data_done = true; | 260 | op->insert_data_done = true; |
256 | continue_at(cl, bch_data_insert_keys, op->wq); | 261 | continue_at(cl, bch_data_insert_keys, op->wq); |
262 | return; | ||
257 | err: | 263 | err: |
258 | /* bch_alloc_sectors() blocks if s->writeback = true */ | 264 | /* bch_alloc_sectors() blocks if s->writeback = true */ |
259 | BUG_ON(op->writeback); | 265 | BUG_ON(op->writeback); |
@@ -575,8 +581,10 @@ static void cache_lookup(struct closure *cl) | |||
575 | ret = bch_btree_map_keys(&s->op, s->iop.c, | 581 | ret = bch_btree_map_keys(&s->op, s->iop.c, |
576 | &KEY(s->iop.inode, bio->bi_iter.bi_sector, 0), | 582 | &KEY(s->iop.inode, bio->bi_iter.bi_sector, 0), |
577 | cache_lookup_fn, MAP_END_KEY); | 583 | cache_lookup_fn, MAP_END_KEY); |
578 | if (ret == -EAGAIN) | 584 | if (ret == -EAGAIN) { |
579 | continue_at(cl, cache_lookup, bcache_wq); | 585 | continue_at(cl, cache_lookup, bcache_wq); |
586 | return; | ||
587 | } | ||
580 | 588 | ||
581 | closure_return(cl); | 589 | closure_return(cl); |
582 | } | 590 | } |
@@ -619,7 +627,7 @@ static void do_bio_hook(struct search *s, struct bio *orig_bio) | |||
619 | bio->bi_end_io = request_endio; | 627 | bio->bi_end_io = request_endio; |
620 | bio->bi_private = &s->cl; | 628 | bio->bi_private = &s->cl; |
621 | 629 | ||
622 | atomic_set(&bio->bi_cnt, 3); | 630 | bio_cnt_set(bio, 3); |
623 | } | 631 | } |
624 | 632 | ||
625 | static void search_free(struct closure *cl) | 633 | static void search_free(struct closure *cl) |
@@ -1084,6 +1092,7 @@ static void flash_dev_make_request(struct request_queue *q, struct bio *bio) | |||
1084 | continue_at_nobarrier(&s->cl, | 1092 | continue_at_nobarrier(&s->cl, |
1085 | flash_dev_nodata, | 1093 | flash_dev_nodata, |
1086 | bcache_wq); | 1094 | bcache_wq); |
1095 | return; | ||
1087 | } else if (rw) { | 1096 | } else if (rw) { |
1088 | bch_keybuf_check_overlapping(&s->iop.c->moving_gc_keys, | 1097 | bch_keybuf_check_overlapping(&s->iop.c->moving_gc_keys, |
1089 | &KEY(d->id, bio->bi_iter.bi_sector, 0), | 1098 | &KEY(d->id, bio->bi_iter.bi_sector, 0), |