diff options
author | Coly Li <colyli@suse.de> | 2018-08-11 01:19:45 -0400 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2018-08-11 17:46:41 -0400 |
commit | 1fae7cf05293d3a2c9e59c1bc59372322386467c (patch) | |
tree | c6ac9b2e0c717f8a7f2f2e75cfcd941726f14d47 | |
parent | 6f10f7d1b02b1bbc305f88d7696445dd38b13881 (diff) |
bcache: style fix to add a blank line after declarations
Signed-off-by: Coly Li <colyli@suse.de>
Reviewed-by: Shenghui Wang <shhuiw@foxmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r-- | drivers/md/bcache/alloc.c | 3 | ||||
-rw-r--r-- | drivers/md/bcache/bcache.h | 1 | ||||
-rw-r--r-- | drivers/md/bcache/bset.c | 5 | ||||
-rw-r--r-- | drivers/md/bcache/btree.c | 7 | ||||
-rw-r--r-- | drivers/md/bcache/closure.c | 1 | ||||
-rw-r--r-- | drivers/md/bcache/debug.c | 4 | ||||
-rw-r--r-- | drivers/md/bcache/extents.c | 5 | ||||
-rw-r--r-- | drivers/md/bcache/io.c | 4 | ||||
-rw-r--r-- | drivers/md/bcache/journal.c | 2 | ||||
-rw-r--r-- | drivers/md/bcache/movinggc.c | 2 | ||||
-rw-r--r-- | drivers/md/bcache/request.c | 5 | ||||
-rw-r--r-- | drivers/md/bcache/stats.c | 3 | ||||
-rw-r--r-- | drivers/md/bcache/super.c | 13 | ||||
-rw-r--r-- | drivers/md/bcache/sysfs.c | 5 | ||||
-rw-r--r-- | drivers/md/bcache/util.c | 1 | ||||
-rw-r--r-- | drivers/md/bcache/writeback.c | 1 | ||||
-rw-r--r-- | include/uapi/linux/bcache.h | 2 |
17 files changed, 57 insertions, 7 deletions
diff --git a/drivers/md/bcache/alloc.c b/drivers/md/bcache/alloc.c index 89f663d22551..7a28232d868b 100644 --- a/drivers/md/bcache/alloc.c +++ b/drivers/md/bcache/alloc.c | |||
@@ -244,6 +244,7 @@ static void invalidate_buckets_random(struct cache *ca) | |||
244 | 244 | ||
245 | while (!fifo_full(&ca->free_inc)) { | 245 | while (!fifo_full(&ca->free_inc)) { |
246 | size_t n; | 246 | size_t n; |
247 | |||
247 | get_random_bytes(&n, sizeof(n)); | 248 | get_random_bytes(&n, sizeof(n)); |
248 | 249 | ||
249 | n %= (size_t) (ca->sb.nbuckets - ca->sb.first_bucket); | 250 | n %= (size_t) (ca->sb.nbuckets - ca->sb.first_bucket); |
@@ -514,6 +515,7 @@ int bch_bucket_alloc_set(struct cache_set *c, unsigned int reserve, | |||
514 | struct bkey *k, int n, bool wait) | 515 | struct bkey *k, int n, bool wait) |
515 | { | 516 | { |
516 | int ret; | 517 | int ret; |
518 | |||
517 | mutex_lock(&c->bucket_lock); | 519 | mutex_lock(&c->bucket_lock); |
518 | ret = __bch_bucket_alloc_set(c, reserve, k, n, wait); | 520 | ret = __bch_bucket_alloc_set(c, reserve, k, n, wait); |
519 | mutex_unlock(&c->bucket_lock); | 521 | mutex_unlock(&c->bucket_lock); |
@@ -706,6 +708,7 @@ int bch_open_buckets_alloc(struct cache_set *c) | |||
706 | 708 | ||
707 | for (i = 0; i < MAX_OPEN_BUCKETS; i++) { | 709 | for (i = 0; i < MAX_OPEN_BUCKETS; i++) { |
708 | struct open_bucket *b = kzalloc(sizeof(*b), GFP_KERNEL); | 710 | struct open_bucket *b = kzalloc(sizeof(*b), GFP_KERNEL); |
711 | |||
709 | if (!b) | 712 | if (!b) |
710 | return -ENOMEM; | 713 | return -ENOMEM; |
711 | 714 | ||
diff --git a/drivers/md/bcache/bcache.h b/drivers/md/bcache/bcache.h index 1ebd2d9d90d5..fd74dd075951 100644 --- a/drivers/md/bcache/bcache.h +++ b/drivers/md/bcache/bcache.h | |||
@@ -783,6 +783,7 @@ static inline struct bucket *PTR_BUCKET(struct cache_set *c, | |||
783 | static inline uint8_t gen_after(uint8_t a, uint8_t b) | 783 | static inline uint8_t gen_after(uint8_t a, uint8_t b) |
784 | { | 784 | { |
785 | uint8_t r = a - b; | 785 | uint8_t r = a - b; |
786 | |||
786 | return r > 128U ? 0 : r; | 787 | return r > 128U ? 0 : r; |
787 | } | 788 | } |
788 | 789 | ||
diff --git a/drivers/md/bcache/bset.c b/drivers/md/bcache/bset.c index dfda7e9efc3e..6fd5623b2e63 100644 --- a/drivers/md/bcache/bset.c +++ b/drivers/md/bcache/bset.c | |||
@@ -585,6 +585,7 @@ static inline unsigned int bfloat_mantissa(const struct bkey *k, | |||
585 | struct bkey_float *f) | 585 | struct bkey_float *f) |
586 | { | 586 | { |
587 | const uint64_t *p = &k->low - (f->exponent >> 6); | 587 | const uint64_t *p = &k->low - (f->exponent >> 6); |
588 | |||
588 | return shrd128(p[-1], p[0], f->exponent & 63) & BKEY_MANTISSA_MASK; | 589 | return shrd128(p[-1], p[0], f->exponent & 63) & BKEY_MANTISSA_MASK; |
589 | } | 590 | } |
590 | 591 | ||
@@ -964,6 +965,7 @@ static struct bset_search_iter bset_search_tree(struct bset_tree *t, | |||
964 | * but a branch instruction is avoided. | 965 | * but a branch instruction is avoided. |
965 | */ | 966 | */ |
966 | unsigned int p = n << 4; | 967 | unsigned int p = n << 4; |
968 | |||
967 | p &= ((int) (p - t->size)) >> 31; | 969 | p &= ((int) (p - t->size)) >> 31; |
968 | 970 | ||
969 | prefetch(&t->tree[p]); | 971 | prefetch(&t->tree[p]); |
@@ -1114,6 +1116,7 @@ static struct bkey *__bch_btree_iter_init(struct btree_keys *b, | |||
1114 | struct bset_tree *start) | 1116 | struct bset_tree *start) |
1115 | { | 1117 | { |
1116 | struct bkey *ret = NULL; | 1118 | struct bkey *ret = NULL; |
1119 | |||
1117 | iter->size = ARRAY_SIZE(iter->data); | 1120 | iter->size = ARRAY_SIZE(iter->data); |
1118 | iter->used = 0; | 1121 | iter->used = 0; |
1119 | 1122 | ||
@@ -1329,8 +1332,8 @@ void bch_btree_sort_into(struct btree_keys *b, struct btree_keys *new, | |||
1329 | struct bset_sort_state *state) | 1332 | struct bset_sort_state *state) |
1330 | { | 1333 | { |
1331 | uint64_t start_time = local_clock(); | 1334 | uint64_t start_time = local_clock(); |
1332 | |||
1333 | struct btree_iter iter; | 1335 | struct btree_iter iter; |
1336 | |||
1334 | bch_btree_iter_init(b, &iter, NULL); | 1337 | bch_btree_iter_init(b, &iter, NULL); |
1335 | 1338 | ||
1336 | btree_mergesort(b, new->set->data, &iter, false, true); | 1339 | btree_mergesort(b, new->set->data, &iter, false, true); |
diff --git a/drivers/md/bcache/btree.c b/drivers/md/bcache/btree.c index 96c39a8db895..4003f92f4d2c 100644 --- a/drivers/md/bcache/btree.c +++ b/drivers/md/bcache/btree.c | |||
@@ -287,6 +287,7 @@ err: | |||
287 | static void btree_node_read_endio(struct bio *bio) | 287 | static void btree_node_read_endio(struct bio *bio) |
288 | { | 288 | { |
289 | struct closure *cl = bio->bi_private; | 289 | struct closure *cl = bio->bi_private; |
290 | |||
290 | closure_put(cl); | 291 | closure_put(cl); |
291 | } | 292 | } |
292 | 293 | ||
@@ -604,6 +605,7 @@ static struct btree *mca_bucket_alloc(struct cache_set *c, | |||
604 | struct bkey *k, gfp_t gfp) | 605 | struct bkey *k, gfp_t gfp) |
605 | { | 606 | { |
606 | struct btree *b = kzalloc(sizeof(struct btree), gfp); | 607 | struct btree *b = kzalloc(sizeof(struct btree), gfp); |
608 | |||
607 | if (!b) | 609 | if (!b) |
608 | return NULL; | 610 | return NULL; |
609 | 611 | ||
@@ -746,6 +748,7 @@ void bch_btree_cache_free(struct cache_set *c) | |||
746 | { | 748 | { |
747 | struct btree *b; | 749 | struct btree *b; |
748 | struct closure cl; | 750 | struct closure cl; |
751 | |||
749 | closure_init_stack(&cl); | 752 | closure_init_stack(&cl); |
750 | 753 | ||
751 | if (c->shrink.list.next) | 754 | if (c->shrink.list.next) |
@@ -1124,6 +1127,7 @@ static struct btree *btree_node_alloc_replacement(struct btree *b, | |||
1124 | struct btree_op *op) | 1127 | struct btree_op *op) |
1125 | { | 1128 | { |
1126 | struct btree *n = bch_btree_node_alloc(b->c, op, b->level, b->parent); | 1129 | struct btree *n = bch_btree_node_alloc(b->c, op, b->level, b->parent); |
1130 | |||
1127 | if (!IS_ERR_OR_NULL(n)) { | 1131 | if (!IS_ERR_OR_NULL(n)) { |
1128 | mutex_lock(&n->write_lock); | 1132 | mutex_lock(&n->write_lock); |
1129 | bch_btree_sort_into(&b->keys, &n->keys, &b->c->sort); | 1133 | bch_btree_sort_into(&b->keys, &n->keys, &b->c->sort); |
@@ -2488,6 +2492,7 @@ void bch_refill_keybuf(struct cache_set *c, struct keybuf *buf, | |||
2488 | 2492 | ||
2489 | if (!RB_EMPTY_ROOT(&buf->keys)) { | 2493 | if (!RB_EMPTY_ROOT(&buf->keys)) { |
2490 | struct keybuf_key *w; | 2494 | struct keybuf_key *w; |
2495 | |||
2491 | w = RB_FIRST(&buf->keys, struct keybuf_key, node); | 2496 | w = RB_FIRST(&buf->keys, struct keybuf_key, node); |
2492 | buf->start = START_KEY(&w->key); | 2497 | buf->start = START_KEY(&w->key); |
2493 | 2498 | ||
@@ -2519,6 +2524,7 @@ bool bch_keybuf_check_overlapping(struct keybuf *buf, struct bkey *start, | |||
2519 | { | 2524 | { |
2520 | bool ret = false; | 2525 | bool ret = false; |
2521 | struct keybuf_key *p, *w, s; | 2526 | struct keybuf_key *p, *w, s; |
2527 | |||
2522 | s.key = *start; | 2528 | s.key = *start; |
2523 | 2529 | ||
2524 | if (bkey_cmp(end, &buf->start) <= 0 || | 2530 | if (bkey_cmp(end, &buf->start) <= 0 || |
@@ -2545,6 +2551,7 @@ bool bch_keybuf_check_overlapping(struct keybuf *buf, struct bkey *start, | |||
2545 | struct keybuf_key *bch_keybuf_next(struct keybuf *buf) | 2551 | struct keybuf_key *bch_keybuf_next(struct keybuf *buf) |
2546 | { | 2552 | { |
2547 | struct keybuf_key *w; | 2553 | struct keybuf_key *w; |
2554 | |||
2548 | spin_lock(&buf->lock); | 2555 | spin_lock(&buf->lock); |
2549 | 2556 | ||
2550 | w = RB_FIRST(&buf->keys, struct keybuf_key, node); | 2557 | w = RB_FIRST(&buf->keys, struct keybuf_key, node); |
diff --git a/drivers/md/bcache/closure.c b/drivers/md/bcache/closure.c index 618253683d40..8570fc426e31 100644 --- a/drivers/md/bcache/closure.c +++ b/drivers/md/bcache/closure.c | |||
@@ -162,6 +162,7 @@ static struct dentry *closure_debug; | |||
162 | static int debug_seq_show(struct seq_file *f, void *data) | 162 | static int debug_seq_show(struct seq_file *f, void *data) |
163 | { | 163 | { |
164 | struct closure *cl; | 164 | struct closure *cl; |
165 | |||
165 | spin_lock_irq(&closure_list_lock); | 166 | spin_lock_irq(&closure_list_lock); |
166 | 167 | ||
167 | list_for_each_entry(cl, &closure_list, all) { | 168 | list_for_each_entry(cl, &closure_list, all) { |
diff --git a/drivers/md/bcache/debug.c b/drivers/md/bcache/debug.c index 0caad145902b..f0eb37a14dab 100644 --- a/drivers/md/bcache/debug.c +++ b/drivers/md/bcache/debug.c | |||
@@ -177,8 +177,8 @@ static ssize_t bch_dump_read(struct file *file, char __user *buf, | |||
177 | while (size) { | 177 | while (size) { |
178 | struct keybuf_key *w; | 178 | struct keybuf_key *w; |
179 | unsigned int bytes = min(i->bytes, size); | 179 | unsigned int bytes = min(i->bytes, size); |
180 | |||
181 | int err = copy_to_user(buf, i->buf, bytes); | 180 | int err = copy_to_user(buf, i->buf, bytes); |
181 | |||
182 | if (err) | 182 | if (err) |
183 | return err; | 183 | return err; |
184 | 184 | ||
@@ -237,8 +237,8 @@ void bch_debug_init_cache_set(struct cache_set *c) | |||
237 | { | 237 | { |
238 | if (!IS_ERR_OR_NULL(bcache_debug)) { | 238 | if (!IS_ERR_OR_NULL(bcache_debug)) { |
239 | char name[50]; | 239 | char name[50]; |
240 | snprintf(name, 50, "bcache-%pU", c->sb.set_uuid); | ||
241 | 240 | ||
241 | snprintf(name, 50, "bcache-%pU", c->sb.set_uuid); | ||
242 | c->debug = debugfs_create_file(name, 0400, bcache_debug, c, | 242 | c->debug = debugfs_create_file(name, 0400, bcache_debug, c, |
243 | &cache_set_debug_ops); | 243 | &cache_set_debug_ops); |
244 | } | 244 | } |
diff --git a/drivers/md/bcache/extents.c b/drivers/md/bcache/extents.c index e96ba928eeb6..8f5de61e1a90 100644 --- a/drivers/md/bcache/extents.c +++ b/drivers/md/bcache/extents.c | |||
@@ -134,8 +134,8 @@ static void bch_bkey_dump(struct btree_keys *keys, const struct bkey *k) | |||
134 | 134 | ||
135 | for (j = 0; j < KEY_PTRS(k); j++) { | 135 | for (j = 0; j < KEY_PTRS(k); j++) { |
136 | size_t n = PTR_BUCKET_NR(b->c, k, j); | 136 | size_t n = PTR_BUCKET_NR(b->c, k, j); |
137 | printk(" bucket %zu", n); | ||
138 | 137 | ||
138 | printk(" bucket %zu", n); | ||
139 | if (n >= b->c->sb.first_bucket && n < b->c->sb.nbuckets) | 139 | if (n >= b->c->sb.first_bucket && n < b->c->sb.nbuckets) |
140 | printk(" prio %i", | 140 | printk(" prio %i", |
141 | PTR_BUCKET(b->c, k, j)->prio); | 141 | PTR_BUCKET(b->c, k, j)->prio); |
@@ -166,6 +166,7 @@ bad: | |||
166 | static bool bch_btree_ptr_invalid(struct btree_keys *bk, const struct bkey *k) | 166 | static bool bch_btree_ptr_invalid(struct btree_keys *bk, const struct bkey *k) |
167 | { | 167 | { |
168 | struct btree *b = container_of(bk, struct btree, keys); | 168 | struct btree *b = container_of(bk, struct btree, keys); |
169 | |||
169 | return __bch_btree_ptr_invalid(b->c, k); | 170 | return __bch_btree_ptr_invalid(b->c, k); |
170 | } | 171 | } |
171 | 172 | ||
@@ -334,6 +335,7 @@ static bool bch_extent_insert_fixup(struct btree_keys *b, | |||
334 | 335 | ||
335 | while (1) { | 336 | while (1) { |
336 | struct bkey *k = bch_btree_iter_next(iter); | 337 | struct bkey *k = bch_btree_iter_next(iter); |
338 | |||
337 | if (!k) | 339 | if (!k) |
338 | break; | 340 | break; |
339 | 341 | ||
@@ -498,6 +500,7 @@ bad: | |||
498 | static bool bch_extent_invalid(struct btree_keys *bk, const struct bkey *k) | 500 | static bool bch_extent_invalid(struct btree_keys *bk, const struct bkey *k) |
499 | { | 501 | { |
500 | struct btree *b = container_of(bk, struct btree, keys); | 502 | struct btree *b = container_of(bk, struct btree, keys); |
503 | |||
501 | return __bch_extent_invalid(b->c, k); | 504 | return __bch_extent_invalid(b->c, k); |
502 | } | 505 | } |
503 | 506 | ||
diff --git a/drivers/md/bcache/io.c b/drivers/md/bcache/io.c index c6b41a09f550..cfc56add799a 100644 --- a/drivers/md/bcache/io.c +++ b/drivers/md/bcache/io.c | |||
@@ -17,6 +17,7 @@ | |||
17 | void bch_bbio_free(struct bio *bio, struct cache_set *c) | 17 | void bch_bbio_free(struct bio *bio, struct cache_set *c) |
18 | { | 18 | { |
19 | struct bbio *b = container_of(bio, struct bbio, bio); | 19 | struct bbio *b = container_of(bio, struct bbio, bio); |
20 | |||
20 | mempool_free(b, &c->bio_meta); | 21 | mempool_free(b, &c->bio_meta); |
21 | } | 22 | } |
22 | 23 | ||
@@ -45,6 +46,7 @@ void bch_submit_bbio(struct bio *bio, struct cache_set *c, | |||
45 | struct bkey *k, unsigned int ptr) | 46 | struct bkey *k, unsigned int ptr) |
46 | { | 47 | { |
47 | struct bbio *b = container_of(bio, struct bbio, bio); | 48 | struct bbio *b = container_of(bio, struct bbio, bio); |
49 | |||
48 | bch_bkey_copy_single_ptr(&b->key, k, ptr); | 50 | bch_bkey_copy_single_ptr(&b->key, k, ptr); |
49 | __bch_submit_bbio(bio, c); | 51 | __bch_submit_bbio(bio, c); |
50 | } | 52 | } |
@@ -132,12 +134,12 @@ void bch_bbio_count_io_errors(struct cache_set *c, struct bio *bio, | |||
132 | 134 | ||
133 | if (threshold) { | 135 | if (threshold) { |
134 | unsigned int t = local_clock_us(); | 136 | unsigned int t = local_clock_us(); |
135 | |||
136 | int us = t - b->submit_time_us; | 137 | int us = t - b->submit_time_us; |
137 | int congested = atomic_read(&c->congested); | 138 | int congested = atomic_read(&c->congested); |
138 | 139 | ||
139 | if (us > (int) threshold) { | 140 | if (us > (int) threshold) { |
140 | int ms = us / 1024; | 141 | int ms = us / 1024; |
142 | |||
141 | c->congested_last_us = t; | 143 | c->congested_last_us = t; |
142 | 144 | ||
143 | ms = min(ms, CONGESTED_MAX + congested); | 145 | ms = min(ms, CONGESTED_MAX + congested); |
diff --git a/drivers/md/bcache/journal.c b/drivers/md/bcache/journal.c index ee61062b58fc..301cbb43a78f 100644 --- a/drivers/md/bcache/journal.c +++ b/drivers/md/bcache/journal.c | |||
@@ -28,6 +28,7 @@ | |||
28 | static void journal_read_endio(struct bio *bio) | 28 | static void journal_read_endio(struct bio *bio) |
29 | { | 29 | { |
30 | struct closure *cl = bio->bi_private; | 30 | struct closure *cl = bio->bi_private; |
31 | |||
31 | closure_put(cl); | 32 | closure_put(cl); |
32 | } | 33 | } |
33 | 34 | ||
@@ -614,6 +615,7 @@ static void journal_write_unlocked(struct closure *cl) | |||
614 | 615 | ||
615 | struct bio *bio; | 616 | struct bio *bio; |
616 | struct bio_list list; | 617 | struct bio_list list; |
618 | |||
617 | bio_list_init(&list); | 619 | bio_list_init(&list); |
618 | 620 | ||
619 | if (!w->need_write) { | 621 | if (!w->need_write) { |
diff --git a/drivers/md/bcache/movinggc.c b/drivers/md/bcache/movinggc.c index 0790d710f911..7891fb512736 100644 --- a/drivers/md/bcache/movinggc.c +++ b/drivers/md/bcache/movinggc.c | |||
@@ -38,6 +38,7 @@ static bool moving_pred(struct keybuf *buf, struct bkey *k) | |||
38 | static void moving_io_destructor(struct closure *cl) | 38 | static void moving_io_destructor(struct closure *cl) |
39 | { | 39 | { |
40 | struct moving_io *io = container_of(cl, struct moving_io, cl); | 40 | struct moving_io *io = container_of(cl, struct moving_io, cl); |
41 | |||
41 | kfree(io); | 42 | kfree(io); |
42 | } | 43 | } |
43 | 44 | ||
@@ -189,6 +190,7 @@ static bool bucket_cmp(struct bucket *l, struct bucket *r) | |||
189 | static unsigned int bucket_heap_top(struct cache *ca) | 190 | static unsigned int bucket_heap_top(struct cache *ca) |
190 | { | 191 | { |
191 | struct bucket *b; | 192 | struct bucket *b; |
193 | |||
192 | return (b = heap_peek(&ca->heap)) ? GC_SECTORS_USED(b) : 0; | 194 | return (b = heap_peek(&ca->heap)) ? GC_SECTORS_USED(b) : 0; |
193 | } | 195 | } |
194 | 196 | ||
diff --git a/drivers/md/bcache/request.c b/drivers/md/bcache/request.c index 6e1a60dd1742..d15d8c5778ed 100644 --- a/drivers/md/bcache/request.c +++ b/drivers/md/bcache/request.c | |||
@@ -45,6 +45,7 @@ static void bio_csum(struct bio *bio, struct bkey *k) | |||
45 | 45 | ||
46 | bio_for_each_segment(bv, bio, iter) { | 46 | bio_for_each_segment(bv, bio, iter) { |
47 | void *d = kmap(bv.bv_page) + bv.bv_offset; | 47 | void *d = kmap(bv.bv_page) + bv.bv_offset; |
48 | |||
48 | csum = bch_crc64_update(csum, d, bv.bv_len); | 49 | csum = bch_crc64_update(csum, d, bv.bv_len); |
49 | kunmap(bv.bv_page); | 50 | kunmap(bv.bv_page); |
50 | } | 51 | } |
@@ -526,8 +527,8 @@ static int cache_lookup_fn(struct btree_op *op, struct btree *b, struct bkey *k) | |||
526 | ? min_t(uint64_t, INT_MAX, | 527 | ? min_t(uint64_t, INT_MAX, |
527 | KEY_START(k) - bio->bi_iter.bi_sector) | 528 | KEY_START(k) - bio->bi_iter.bi_sector) |
528 | : INT_MAX; | 529 | : INT_MAX; |
529 | |||
530 | int ret = s->d->cache_miss(b, s, bio, sectors); | 530 | int ret = s->d->cache_miss(b, s, bio, sectors); |
531 | |||
531 | if (ret != MAP_CONTINUE) | 532 | if (ret != MAP_CONTINUE) |
532 | return ret; | 533 | return ret; |
533 | 534 | ||
@@ -623,6 +624,7 @@ static void request_endio(struct bio *bio) | |||
623 | 624 | ||
624 | if (bio->bi_status) { | 625 | if (bio->bi_status) { |
625 | struct search *s = container_of(cl, struct search, cl); | 626 | struct search *s = container_of(cl, struct search, cl); |
627 | |||
626 | s->iop.status = bio->bi_status; | 628 | s->iop.status = bio->bi_status; |
627 | /* Only cache read errors are recoverable */ | 629 | /* Only cache read errors are recoverable */ |
628 | s->recoverable = false; | 630 | s->recoverable = false; |
@@ -1212,6 +1214,7 @@ static int cached_dev_ioctl(struct bcache_device *d, fmode_t mode, | |||
1212 | unsigned int cmd, unsigned long arg) | 1214 | unsigned int cmd, unsigned long arg) |
1213 | { | 1215 | { |
1214 | struct cached_dev *dc = container_of(d, struct cached_dev, disk); | 1216 | struct cached_dev *dc = container_of(d, struct cached_dev, disk); |
1217 | |||
1215 | return __blkdev_driver_ioctl(dc->bdev, mode, cmd, arg); | 1218 | return __blkdev_driver_ioctl(dc->bdev, mode, cmd, arg); |
1216 | } | 1219 | } |
1217 | 1220 | ||
diff --git a/drivers/md/bcache/stats.c b/drivers/md/bcache/stats.c index 2331a0d5aa28..894410f3f829 100644 --- a/drivers/md/bcache/stats.c +++ b/drivers/md/bcache/stats.c | |||
@@ -200,6 +200,7 @@ void bch_mark_cache_accounting(struct cache_set *c, struct bcache_device *d, | |||
200 | bool hit, bool bypass) | 200 | bool hit, bool bypass) |
201 | { | 201 | { |
202 | struct cached_dev *dc = container_of(d, struct cached_dev, disk); | 202 | struct cached_dev *dc = container_of(d, struct cached_dev, disk); |
203 | |||
203 | mark_cache_stats(&dc->accounting.collector, hit, bypass); | 204 | mark_cache_stats(&dc->accounting.collector, hit, bypass); |
204 | mark_cache_stats(&c->accounting.collector, hit, bypass); | 205 | mark_cache_stats(&c->accounting.collector, hit, bypass); |
205 | } | 206 | } |
@@ -207,6 +208,7 @@ void bch_mark_cache_accounting(struct cache_set *c, struct bcache_device *d, | |||
207 | void bch_mark_cache_readahead(struct cache_set *c, struct bcache_device *d) | 208 | void bch_mark_cache_readahead(struct cache_set *c, struct bcache_device *d) |
208 | { | 209 | { |
209 | struct cached_dev *dc = container_of(d, struct cached_dev, disk); | 210 | struct cached_dev *dc = container_of(d, struct cached_dev, disk); |
211 | |||
210 | atomic_inc(&dc->accounting.collector.cache_readaheads); | 212 | atomic_inc(&dc->accounting.collector.cache_readaheads); |
211 | atomic_inc(&c->accounting.collector.cache_readaheads); | 213 | atomic_inc(&c->accounting.collector.cache_readaheads); |
212 | } | 214 | } |
@@ -214,6 +216,7 @@ void bch_mark_cache_readahead(struct cache_set *c, struct bcache_device *d) | |||
214 | void bch_mark_cache_miss_collision(struct cache_set *c, struct bcache_device *d) | 216 | void bch_mark_cache_miss_collision(struct cache_set *c, struct bcache_device *d) |
215 | { | 217 | { |
216 | struct cached_dev *dc = container_of(d, struct cached_dev, disk); | 218 | struct cached_dev *dc = container_of(d, struct cached_dev, disk); |
219 | |||
217 | atomic_inc(&dc->accounting.collector.cache_miss_collisions); | 220 | atomic_inc(&dc->accounting.collector.cache_miss_collisions); |
218 | atomic_inc(&c->accounting.collector.cache_miss_collisions); | 221 | atomic_inc(&c->accounting.collector.cache_miss_collisions); |
219 | } | 222 | } |
diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c index 4ab1b1968d9a..c11cf852715c 100644 --- a/drivers/md/bcache/super.c +++ b/drivers/md/bcache/super.c | |||
@@ -415,8 +415,8 @@ static int __uuid_write(struct cache_set *c) | |||
415 | { | 415 | { |
416 | BKEY_PADDED(key) k; | 416 | BKEY_PADDED(key) k; |
417 | struct closure cl; | 417 | struct closure cl; |
418 | closure_init_stack(&cl); | ||
419 | 418 | ||
419 | closure_init_stack(&cl); | ||
420 | lockdep_assert_held(&bch_register_lock); | 420 | lockdep_assert_held(&bch_register_lock); |
421 | 421 | ||
422 | if (bch_bucket_alloc_set(c, RESERVE_BTREE, &k.key, 1, true)) | 422 | if (bch_bucket_alloc_set(c, RESERVE_BTREE, &k.key, 1, true)) |
@@ -456,6 +456,7 @@ static struct uuid_entry *uuid_find(struct cache_set *c, const char *uuid) | |||
456 | static struct uuid_entry *uuid_find_empty(struct cache_set *c) | 456 | static struct uuid_entry *uuid_find_empty(struct cache_set *c) |
457 | { | 457 | { |
458 | static const char zero_uuid[16] = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"; | 458 | static const char zero_uuid[16] = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"; |
459 | |||
459 | return uuid_find(c, zero_uuid); | 460 | return uuid_find(c, zero_uuid); |
460 | } | 461 | } |
461 | 462 | ||
@@ -619,6 +620,7 @@ static void prio_read(struct cache *ca, uint64_t bucket) | |||
619 | static int open_dev(struct block_device *b, fmode_t mode) | 620 | static int open_dev(struct block_device *b, fmode_t mode) |
620 | { | 621 | { |
621 | struct bcache_device *d = b->bd_disk->private_data; | 622 | struct bcache_device *d = b->bd_disk->private_data; |
623 | |||
622 | if (test_bit(BCACHE_DEV_CLOSING, &d->flags)) | 624 | if (test_bit(BCACHE_DEV_CLOSING, &d->flags)) |
623 | return -ENXIO; | 625 | return -ENXIO; |
624 | 626 | ||
@@ -629,6 +631,7 @@ static int open_dev(struct block_device *b, fmode_t mode) | |||
629 | static void release_dev(struct gendisk *b, fmode_t mode) | 631 | static void release_dev(struct gendisk *b, fmode_t mode) |
630 | { | 632 | { |
631 | struct bcache_device *d = b->private_data; | 633 | struct bcache_device *d = b->private_data; |
634 | |||
632 | closure_put(&d->cl); | 635 | closure_put(&d->cl); |
633 | } | 636 | } |
634 | 637 | ||
@@ -919,6 +922,7 @@ void bch_cached_dev_run(struct cached_dev *dc) | |||
919 | if (!d->c && | 922 | if (!d->c && |
920 | BDEV_STATE(&dc->sb) != BDEV_STATE_NONE) { | 923 | BDEV_STATE(&dc->sb) != BDEV_STATE_NONE) { |
921 | struct closure cl; | 924 | struct closure cl; |
925 | |||
922 | closure_init_stack(&cl); | 926 | closure_init_stack(&cl); |
923 | 927 | ||
924 | SET_BDEV_STATE(&dc->sb, BDEV_STATE_STALE); | 928 | SET_BDEV_STATE(&dc->sb, BDEV_STATE_STALE); |
@@ -976,6 +980,7 @@ static void cached_dev_detach_finish(struct work_struct *w) | |||
976 | { | 980 | { |
977 | struct cached_dev *dc = container_of(w, struct cached_dev, detach); | 981 | struct cached_dev *dc = container_of(w, struct cached_dev, detach); |
978 | struct closure cl; | 982 | struct closure cl; |
983 | |||
979 | closure_init_stack(&cl); | 984 | closure_init_stack(&cl); |
980 | 985 | ||
981 | BUG_ON(!test_bit(BCACHE_DEV_DETACHING, &dc->disk.flags)); | 986 | BUG_ON(!test_bit(BCACHE_DEV_DETACHING, &dc->disk.flags)); |
@@ -1103,6 +1108,7 @@ int bch_cached_dev_attach(struct cached_dev *dc, struct cache_set *c, | |||
1103 | 1108 | ||
1104 | if (bch_is_zero(u->uuid, 16)) { | 1109 | if (bch_is_zero(u->uuid, 16)) { |
1105 | struct closure cl; | 1110 | struct closure cl; |
1111 | |||
1106 | closure_init_stack(&cl); | 1112 | closure_init_stack(&cl); |
1107 | 1113 | ||
1108 | memcpy(u->uuid, dc->sb.uuid, 16); | 1114 | memcpy(u->uuid, dc->sb.uuid, 16); |
@@ -1320,6 +1326,7 @@ void bch_flash_dev_release(struct kobject *kobj) | |||
1320 | static void flash_dev_free(struct closure *cl) | 1326 | static void flash_dev_free(struct closure *cl) |
1321 | { | 1327 | { |
1322 | struct bcache_device *d = container_of(cl, struct bcache_device, cl); | 1328 | struct bcache_device *d = container_of(cl, struct bcache_device, cl); |
1329 | |||
1323 | mutex_lock(&bch_register_lock); | 1330 | mutex_lock(&bch_register_lock); |
1324 | atomic_long_sub(bcache_dev_sectors_dirty(d), | 1331 | atomic_long_sub(bcache_dev_sectors_dirty(d), |
1325 | &d->c->flash_dev_dirty_sectors); | 1332 | &d->c->flash_dev_dirty_sectors); |
@@ -1481,6 +1488,7 @@ bool bch_cache_set_error(struct cache_set *c, const char *fmt, ...) | |||
1481 | void bch_cache_set_release(struct kobject *kobj) | 1488 | void bch_cache_set_release(struct kobject *kobj) |
1482 | { | 1489 | { |
1483 | struct cache_set *c = container_of(kobj, struct cache_set, kobj); | 1490 | struct cache_set *c = container_of(kobj, struct cache_set, kobj); |
1491 | |||
1484 | kfree(c); | 1492 | kfree(c); |
1485 | module_put(THIS_MODULE); | 1493 | module_put(THIS_MODULE); |
1486 | } | 1494 | } |
@@ -1671,6 +1679,7 @@ struct cache_set *bch_cache_set_alloc(struct cache_sb *sb) | |||
1671 | { | 1679 | { |
1672 | int iter_size; | 1680 | int iter_size; |
1673 | struct cache_set *c = kzalloc(sizeof(struct cache_set), GFP_KERNEL); | 1681 | struct cache_set *c = kzalloc(sizeof(struct cache_set), GFP_KERNEL); |
1682 | |||
1674 | if (!c) | 1683 | if (!c) |
1675 | return NULL; | 1684 | return NULL; |
1676 | 1685 | ||
@@ -2216,6 +2225,7 @@ static ssize_t register_bcache(struct kobject *k, struct kobj_attribute *attr, | |||
2216 | err = "failed to register device"; | 2225 | err = "failed to register device"; |
2217 | if (SB_IS_BDEV(sb)) { | 2226 | if (SB_IS_BDEV(sb)) { |
2218 | struct cached_dev *dc = kzalloc(sizeof(*dc), GFP_KERNEL); | 2227 | struct cached_dev *dc = kzalloc(sizeof(*dc), GFP_KERNEL); |
2228 | |||
2219 | if (!dc) | 2229 | if (!dc) |
2220 | goto err_close; | 2230 | goto err_close; |
2221 | 2231 | ||
@@ -2224,6 +2234,7 @@ static ssize_t register_bcache(struct kobject *k, struct kobj_attribute *attr, | |||
2224 | mutex_unlock(&bch_register_lock); | 2234 | mutex_unlock(&bch_register_lock); |
2225 | } else { | 2235 | } else { |
2226 | struct cache *ca = kzalloc(sizeof(*ca), GFP_KERNEL); | 2236 | struct cache *ca = kzalloc(sizeof(*ca), GFP_KERNEL); |
2237 | |||
2227 | if (!ca) | 2238 | if (!ca) |
2228 | goto err_close; | 2239 | goto err_close; |
2229 | 2240 | ||
diff --git a/drivers/md/bcache/sysfs.c b/drivers/md/bcache/sysfs.c index 3f2b7964d6a9..ba4cd7efca8e 100644 --- a/drivers/md/bcache/sysfs.c +++ b/drivers/md/bcache/sysfs.c | |||
@@ -459,6 +459,7 @@ STORE(__bch_flash_dev) | |||
459 | 459 | ||
460 | if (attr == &sysfs_size) { | 460 | if (attr == &sysfs_size) { |
461 | uint64_t v; | 461 | uint64_t v; |
462 | |||
462 | strtoi_h_or_return(buf, v); | 463 | strtoi_h_or_return(buf, v); |
463 | 464 | ||
464 | u->sectors = v >> 9; | 465 | u->sectors = v >> 9; |
@@ -703,6 +704,7 @@ STORE(__bch_cache_set) | |||
703 | if (attr == &sysfs_flash_vol_create) { | 704 | if (attr == &sysfs_flash_vol_create) { |
704 | int r; | 705 | int r; |
705 | uint64_t v; | 706 | uint64_t v; |
707 | |||
706 | strtoi_h_or_return(buf, v); | 708 | strtoi_h_or_return(buf, v); |
707 | 709 | ||
708 | r = bch_flash_dev_create(c, v); | 710 | r = bch_flash_dev_create(c, v); |
@@ -736,6 +738,7 @@ STORE(__bch_cache_set) | |||
736 | 738 | ||
737 | if (attr == &sysfs_prune_cache) { | 739 | if (attr == &sysfs_prune_cache) { |
738 | struct shrink_control sc; | 740 | struct shrink_control sc; |
741 | |||
739 | sc.gfp_mask = GFP_KERNEL; | 742 | sc.gfp_mask = GFP_KERNEL; |
740 | sc.nr_to_scan = strtoul_or_return(buf); | 743 | sc.nr_to_scan = strtoul_or_return(buf); |
741 | c->shrink.scan_objects(&c->shrink, &sc); | 744 | c->shrink.scan_objects(&c->shrink, &sc); |
@@ -789,12 +792,14 @@ STORE_LOCKED(bch_cache_set) | |||
789 | SHOW(bch_cache_set_internal) | 792 | SHOW(bch_cache_set_internal) |
790 | { | 793 | { |
791 | struct cache_set *c = container_of(kobj, struct cache_set, internal); | 794 | struct cache_set *c = container_of(kobj, struct cache_set, internal); |
795 | |||
792 | return bch_cache_set_show(&c->kobj, attr, buf); | 796 | return bch_cache_set_show(&c->kobj, attr, buf); |
793 | } | 797 | } |
794 | 798 | ||
795 | STORE(bch_cache_set_internal) | 799 | STORE(bch_cache_set_internal) |
796 | { | 800 | { |
797 | struct cache_set *c = container_of(kobj, struct cache_set, internal); | 801 | struct cache_set *c = container_of(kobj, struct cache_set, internal); |
802 | |||
798 | return bch_cache_set_store(&c->kobj, attr, buf, size); | 803 | return bch_cache_set_store(&c->kobj, attr, buf, size); |
799 | } | 804 | } |
800 | 805 | ||
diff --git a/drivers/md/bcache/util.c b/drivers/md/bcache/util.c index b15256bcf0e7..18016e7bb32c 100644 --- a/drivers/md/bcache/util.c +++ b/drivers/md/bcache/util.c | |||
@@ -133,6 +133,7 @@ bool bch_is_zero(const char *p, size_t n) | |||
133 | int bch_parse_uuid(const char *s, char *uuid) | 133 | int bch_parse_uuid(const char *s, char *uuid) |
134 | { | 134 | { |
135 | size_t i, j, x; | 135 | size_t i, j, x; |
136 | |||
136 | memset(uuid, 0, 16); | 137 | memset(uuid, 0, 16); |
137 | 138 | ||
138 | for (i = 0, j = 0; | 139 | for (i = 0, j = 0; |
diff --git a/drivers/md/bcache/writeback.c b/drivers/md/bcache/writeback.c index 39ee38ffb2db..44f1b0f1f4d9 100644 --- a/drivers/md/bcache/writeback.c +++ b/drivers/md/bcache/writeback.c | |||
@@ -250,6 +250,7 @@ static void dirty_init(struct keybuf_key *w) | |||
250 | static void dirty_io_destructor(struct closure *cl) | 250 | static void dirty_io_destructor(struct closure *cl) |
251 | { | 251 | { |
252 | struct dirty_io *io = container_of(cl, struct dirty_io, cl); | 252 | struct dirty_io *io = container_of(cl, struct dirty_io, cl); |
253 | |||
253 | kfree(io); | 254 | kfree(io); |
254 | } | 255 | } |
255 | 256 | ||
diff --git a/include/uapi/linux/bcache.h b/include/uapi/linux/bcache.h index 6bdcb48ee8cf..5d4f58e059fd 100644 --- a/include/uapi/linux/bcache.h +++ b/include/uapi/linux/bcache.h | |||
@@ -117,12 +117,14 @@ static inline void bkey_copy_key(struct bkey *dest, const struct bkey *src) | |||
117 | static inline struct bkey *bkey_next(const struct bkey *k) | 117 | static inline struct bkey *bkey_next(const struct bkey *k) |
118 | { | 118 | { |
119 | __u64 *d = (void *) k; | 119 | __u64 *d = (void *) k; |
120 | |||
120 | return (struct bkey *) (d + bkey_u64s(k)); | 121 | return (struct bkey *) (d + bkey_u64s(k)); |
121 | } | 122 | } |
122 | 123 | ||
123 | static inline struct bkey *bkey_idx(const struct bkey *k, unsigned int nr_keys) | 124 | static inline struct bkey *bkey_idx(const struct bkey *k, unsigned int nr_keys) |
124 | { | 125 | { |
125 | __u64 *d = (void *) k; | 126 | __u64 *d = (void *) k; |
127 | |||
126 | return (struct bkey *) (d + nr_keys); | 128 | return (struct bkey *) (d + nr_keys); |
127 | } | 129 | } |
128 | /* Enough for a key with 6 pointers */ | 130 | /* Enough for a key with 6 pointers */ |