aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/bcache
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/md/bcache')
-rw-r--r--drivers/md/bcache/closure.h3
-rw-r--r--drivers/md/bcache/io.c3
-rw-r--r--drivers/md/bcache/journal.c4
-rw-r--r--drivers/md/bcache/request.c17
-rw-r--r--drivers/md/bcache/super.c10
-rw-r--r--drivers/md/bcache/util.h10
6 files changed, 22 insertions, 25 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)
320do { \ 320do { \
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 { \
349do { \ 348do { \
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 { \
365do { \ 363do { \
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 fa028fa82df4..bf6a9ca18403 100644
--- a/drivers/md/bcache/io.c
+++ b/drivers/md/bcache/io.c
@@ -55,7 +55,7 @@ static void bch_bio_submit_split_done(struct closure *cl)
55 55
56 s->bio->bi_end_io = s->bi_end_io; 56 s->bio->bi_end_io = s->bi_end_io;
57 s->bio->bi_private = s->bi_private; 57 s->bio->bi_private = s->bi_private;
58 bio_endio_nodec(s->bio, 0); 58 bio_endio(s->bio, 0);
59 59
60 closure_debug_destroy(&s->cl); 60 closure_debug_destroy(&s->cl);
61 mempool_free(s, s->p->bio_split_hook); 61 mempool_free(s, s->p->bio_split_hook);
@@ -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;
108submit: 109submit:
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 fe080ad0e558..418607a6ba33 100644
--- a/drivers/md/bcache/journal.c
+++ b/drivers/md/bcache/journal.c
@@ -157,7 +157,7 @@ int bch_journal_read(struct cache_set *c, struct list_head *list)
157 157
158 for_each_cache(ca, c, iter) { 158 for_each_cache(ca, c, iter) {
159 struct journal_device *ja = &ca->journal; 159 struct journal_device *ja = &ca->journal;
160 unsigned long bitmap[SB_JOURNAL_BUCKETS / BITS_PER_LONG]; 160 DECLARE_BITMAP(bitmap, SB_JOURNAL_BUCKETS);
161 unsigned i, l, r, m; 161 unsigned i, l, r, m;
162 uint64_t seq; 162 uint64_t seq;
163 163
@@ -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 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;
257err: 263err:
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
625static void search_free(struct closure *cl) 633static 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),
diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c
index 4dd2bb7167f0..94980bfca434 100644
--- a/drivers/md/bcache/super.c
+++ b/drivers/md/bcache/super.c
@@ -760,14 +760,8 @@ static void bcache_device_free(struct bcache_device *d)
760 bio_split_pool_free(&d->bio_split_hook); 760 bio_split_pool_free(&d->bio_split_hook);
761 if (d->bio_split) 761 if (d->bio_split)
762 bioset_free(d->bio_split); 762 bioset_free(d->bio_split);
763 if (is_vmalloc_addr(d->full_dirty_stripes)) 763 kvfree(d->full_dirty_stripes);
764 vfree(d->full_dirty_stripes); 764 kvfree(d->stripe_sectors_dirty);
765 else
766 kfree(d->full_dirty_stripes);
767 if (is_vmalloc_addr(d->stripe_sectors_dirty))
768 vfree(d->stripe_sectors_dirty);
769 else
770 kfree(d->stripe_sectors_dirty);
771 765
772 closure_debug_destroy(&d->cl); 766 closure_debug_destroy(&d->cl);
773} 767}
diff --git a/drivers/md/bcache/util.h b/drivers/md/bcache/util.h
index 98df7572b5f7..1d04c4859c70 100644
--- a/drivers/md/bcache/util.h
+++ b/drivers/md/bcache/util.h
@@ -52,10 +52,7 @@ struct closure;
52 52
53#define free_heap(heap) \ 53#define free_heap(heap) \
54do { \ 54do { \
55 if (is_vmalloc_addr((heap)->data)) \ 55 kvfree((heap)->data); \
56 vfree((heap)->data); \
57 else \
58 kfree((heap)->data); \
59 (heap)->data = NULL; \ 56 (heap)->data = NULL; \
60} while (0) 57} while (0)
61 58
@@ -163,10 +160,7 @@ do { \
163 160
164#define free_fifo(fifo) \ 161#define free_fifo(fifo) \
165do { \ 162do { \
166 if (is_vmalloc_addr((fifo)->data)) \ 163 kvfree((fifo)->data); \
167 vfree((fifo)->data); \
168 else \
169 kfree((fifo)->data); \
170 (fifo)->data = NULL; \ 164 (fifo)->data = NULL; \
171} while (0) 165} while (0)
172 166