diff options
author | Coly Li <colyli@suse.de> | 2018-09-25 18:53:55 +0800 |
---|---|---|
committer | Coly Li <colyli@suse.de> | 2018-09-25 18:53:55 +0800 |
commit | c4cacf688dbc4f8e7477fc7d28a983cd89ed81ad (patch) | |
tree | 08f1dc92345ddc850e363c648e8fd824c56d20a0 | |
parent | f630bd4767a5b9f690745da7c49676784b0d1d0f (diff) | |
download | bcache-patches-c4cacf688dbc4f8e7477fc7d28a983cd89ed81ad.tar.gz |
for-next: update patches
10 files changed, 247 insertions, 32 deletions
diff --git a/for-next/0001-bcache-account-size-of-buckets-used-in-uuid-write-to.patch b/for-next/0001-bcache-account-size-of-buckets-used-in-uuid-write-to.patch index 4ddfa20..804272e 100644 --- a/for-next/0001-bcache-account-size-of-buckets-used-in-uuid-write-to.patch +++ b/for-next/0001-bcache-account-size-of-buckets-used-in-uuid-write-to.patch @@ -1,7 +1,7 @@ -From 95fa937b67c5270496f8f0894c9abdf85e3cdbb1 Mon Sep 17 00:00:00 2001 +From 3eb3e43aa68134c7f7d86005e34045099b0fe992 Mon Sep 17 00:00:00 2001 From: Shenghui Wang <shhuiw@foxmail.com> Date: Fri, 7 Sep 2018 18:40:40 +0800 -Subject: [PATCH] bcache: account size of buckets used in uuid write to +Subject: [PATCH 01/10] bcache: account size of buckets used in uuid write to ca->meta_sectors_written UUIDs are considered as metadata. __uuid_write should add the number @@ -28,7 +28,7 @@ Signed-off-by: Coly Li <colyli@suse.de> 1 file changed, 5 insertions(+) diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c -index 75620ab0c67b..bc6e057ad1bb 100644 +index 94c756c66bd7..448e531e8c2d 100644 --- a/drivers/md/bcache/super.c +++ b/drivers/md/bcache/super.c @@ -417,6 +417,7 @@ static int __uuid_write(struct cache_set *c) @@ -51,5 +51,5 @@ index 75620ab0c67b..bc6e057ad1bb 100644 bkey_put(c, &k.key); return 0; -- -2.18.0 +2.19.0 diff --git a/for-next/0001-bcache-fix-typo-in-code-comments-of-closure_return_w.patch b/for-next/0002-bcache-fix-typo-in-code-comments-of-closure_return_w.patch index 4a88d10..50fa3ab 100644 --- a/for-next/0001-bcache-fix-typo-in-code-comments-of-closure_return_w.patch +++ b/for-next/0002-bcache-fix-typo-in-code-comments-of-closure_return_w.patch @@ -1,7 +1,7 @@ -From 95d7326fffe90e03ce27c57b6186decc1f07a238 Mon Sep 17 00:00:00 2001 +From 09b5cdb9def38b926653f42f6669c2a371ba7053 Mon Sep 17 00:00:00 2001 From: Coly Li <colyli@suse.de> Date: Mon, 17 Sep 2018 01:37:53 +0800 -Subject: [PATCH] bcache: fix typo in code comments of +Subject: [PATCH 02/10] bcache: fix typo in code comments of closure_return_with_destructor() The code comments of closure_return_with_destructor() in closure.h makrs @@ -28,5 +28,5 @@ index eca0d496b686..c88cdc4ae4ec 100644 * Works like closure_return(), except @destructor will be called when all * outstanding refs on @cl have been dropped; @destructor may be used to safely -- -2.16.4 +2.19.0 diff --git a/for-next/0001-bcache-Populate-writeback_rate_minimum-attribute.patch b/for-next/0003-bcache-Populate-writeback_rate_minimum-attribute.patch index 079dfd0..04d04f2 100644 --- a/for-next/0001-bcache-Populate-writeback_rate_minimum-attribute.patch +++ b/for-next/0003-bcache-Populate-writeback_rate_minimum-attribute.patch @@ -1,7 +1,7 @@ -From 7d9becb538aebd660e6eb43077fe14652f6470c5 Mon Sep 17 00:00:00 2001 +From 0580dab87bfec8c3e336caee467c289526221e3c Mon Sep 17 00:00:00 2001 From: Ben Peddell <klightspeed@killerwolves.net> Date: Fri, 14 Sep 2018 08:27:34 +1000 -Subject: [PATCH] bcache: Populate writeback_rate_minimum attribute +Subject: [PATCH 03/10] bcache: Populate writeback_rate_minimum attribute Forgot to include the maintainers with my first email. @@ -22,10 +22,10 @@ Signed-off-by: Coly Li <colyli@suse.de> 1 file changed, 2 insertions(+) diff --git a/drivers/md/bcache/sysfs.c b/drivers/md/bcache/sysfs.c -index 225b15aa0340..34819f2c257d 100644 +index 150cf4f4cf74..26f035a0c5b9 100644 --- a/drivers/md/bcache/sysfs.c +++ b/drivers/md/bcache/sysfs.c -@@ -263,6 +263,7 @@ STORE(__cached_dev) +@@ -285,6 +285,7 @@ STORE(__cached_dev) 1, WRITEBACK_RATE_UPDATE_SECS_MAX); d_strtoul(writeback_rate_i_term_inverse); d_strtoul_nonzero(writeback_rate_p_term_inverse); @@ -33,7 +33,7 @@ index 225b15aa0340..34819f2c257d 100644 sysfs_strtoul_clamp(io_error_limit, dc->error_limit, 0, INT_MAX); -@@ -389,6 +390,7 @@ static struct attribute *bch_cached_dev_files[] = { +@@ -412,6 +413,7 @@ static struct attribute *bch_cached_dev_files[] = { &sysfs_writeback_rate_update_seconds, &sysfs_writeback_rate_i_term_inverse, &sysfs_writeback_rate_p_term_inverse, @@ -42,5 +42,5 @@ index 225b15aa0340..34819f2c257d 100644 &sysfs_errors, &sysfs_io_error_limit, -- -2.16.4 +2.19.0 diff --git a/for-next/0004-bcache-recal-cached_dev_sectors-on-detach.patch b/for-next/0004-bcache-recal-cached_dev_sectors-on-detach.patch new file mode 100644 index 0000000..2ede341 --- /dev/null +++ b/for-next/0004-bcache-recal-cached_dev_sectors-on-detach.patch @@ -0,0 +1,32 @@ +From 5eaad9627d01697ef8b7d73ce89647e9d254b3c0 Mon Sep 17 00:00:00 2001 +From: Shenghui Wang <shhuiw@foxmail.com> +Date: Tue, 25 Sep 2018 17:50:37 +0800 +Subject: [PATCH 04/10] bcache: recal cached_dev_sectors on detach + +Recal cached_dev_sectors on cached_dev detached, as recal done on +cached_dev attached. + +Update the cached_dev_sectors before bcache_device_detach called +as bcache_device_detach will set bcache_device->c to NULL. + +Signed-off-by: Shenghui Wang <shhuiw@foxmail.com> +Signed-off-by: Coly Li <colyli@suse.de> +--- + drivers/md/bcache/super.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c +index 448e531e8c2d..29196021ba7d 100644 +--- a/drivers/md/bcache/super.c ++++ b/drivers/md/bcache/super.c +@@ -1012,6 +1012,7 @@ static void cached_dev_detach_finish(struct work_struct *w) + bch_write_bdev_super(dc, &cl); + closure_sync(&cl); + ++ calc_cached_dev_sectors(dc->disk.c); + bcache_device_detach(&dc->disk); + list_move(&dc->list, &uncached_devices); + +-- +2.19.0 + diff --git a/for-next/0001-bcache-remove-unused-bch_passthrough_cache.patch b/for-next/0005-bcache-remove-unused-bch_passthrough_cache.patch index 83842a6..635c3a4 100644 --- a/for-next/0001-bcache-remove-unused-bch_passthrough_cache.patch +++ b/for-next/0005-bcache-remove-unused-bch_passthrough_cache.patch @@ -1,7 +1,7 @@ -From a39a99fe19509fbd2e46b859ab59d5776a75f1ba Mon Sep 17 00:00:00 2001 -From: Shenghui Wang <shhuiw@foxmail.com> +From 1cae4aafeedb53e555d4cc0b048dda4f61451b53 Mon Sep 17 00:00:00 2001 +From: Shenghui Wang <shhuiw@foxmail.com> Date: Fri, 10 Aug 2018 15:31:39 +0800 -Subject: [PATCH] bcache: remove unused bch_passthrough_cache +Subject: [PATCH 05/10] bcache: remove unused bch_passthrough_cache struct kmem_cache *bch_passthrough_cache is not used in bcache code. Remove it. @@ -25,5 +25,5 @@ index aa055cfeb099..721bf336ed1a 100644 #endif /* _BCACHE_REQUEST_H_ */ -- -2.18.0 +2.19.0 diff --git a/for-next/0001-bcache-remove-useless-parameter-of-bch_debug_init.patch b/for-next/0006-bcache-remove-useless-parameter-of-bch_debug_init.patch index 80edfca..e32e133 100644 --- a/for-next/0001-bcache-remove-useless-parameter-of-bch_debug_init.patch +++ b/for-next/0006-bcache-remove-useless-parameter-of-bch_debug_init.patch @@ -1,7 +1,7 @@ -From 45cb2593142c4bfbc1686cb5b3f27345f5fb461a Mon Sep 17 00:00:00 2001 -From: Dongbo Cao <cdbdyx@163.com> +From 3bbce7b75cd21ded15d771b2daf850b69de7cb6d Mon Sep 17 00:00:00 2001 +From: Dongbo Cao <cdbdyx@163.com> Date: Fri, 10 Aug 2018 16:58:18 +0800 -Subject: [PATCH] bcache: remove useless parameter of bch_debug_init() +Subject: [PATCH 06/10] bcache: remove useless parameter of bch_debug_init() Parameter "struct kobject *kobj" in bch_debug_init() is useless, remove it in this patch. @@ -41,10 +41,10 @@ index 06da66b2488a..8f448b9c96a1 100644 /* * it is unnecessary to check return value of diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c -index 0dbd1bcb0d38..6cc0262e0d93 100644 +index 29196021ba7d..71dd26696dc7 100644 --- a/drivers/md/bcache/super.c +++ b/drivers/md/bcache/super.c -@@ -2378,7 +2378,7 @@ static int __init bcache_init(void) +@@ -2384,7 +2384,7 @@ static int __init bcache_init(void) sysfs_create_files(bcache_kobj, files)) goto err; @@ -54,5 +54,5 @@ index 0dbd1bcb0d38..6cc0262e0d93 100644 return 0; -- -2.18.0 +2.19.0 diff --git a/for-next/0001-bcache-replace-hard-coded-number-with-BUCKET_GC_GEN_.patch b/for-next/0007-bcache-replace-hard-coded-number-with-BUCKET_GC_GEN_.patch index 405707e..ab2d3c2 100644 --- a/for-next/0001-bcache-replace-hard-coded-number-with-BUCKET_GC_GEN_.patch +++ b/for-next/0007-bcache-replace-hard-coded-number-with-BUCKET_GC_GEN_.patch @@ -1,7 +1,8 @@ -From 22f3e99d62f845c8a2343179df8dc0c265afa79c Mon Sep 17 00:00:00 2001 +From 62007c74fabc71e34654caa40f4e7b23a6b0db6d Mon Sep 17 00:00:00 2001 From: Coly Li <colyli@suse.de> Date: Thu, 13 Sep 2018 21:31:14 +0800 -Subject: [PATCH] bcache: replace hard coded number with BUCKET_GC_GEN_MAX +Subject: [PATCH 07/10] bcache: replace hard coded number with + BUCKET_GC_GEN_MAX In extents.c:bch_extent_bad(), number 96 is used as parameter to call btree_bug_on(). The purpose is to check whether stale gen value exceeds @@ -14,10 +15,10 @@ Signed-off-by: Coly Li <colyli@suse.de> 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/md/bcache/extents.c b/drivers/md/bcache/extents.c -index 1d096742eb41..144b1d0f9b84 100644 +index c809724e6571..956004366699 100644 --- a/drivers/md/bcache/extents.c +++ b/drivers/md/bcache/extents.c -@@ -550,7 +550,7 @@ static bool bch_extent_bad(struct btree_keys *bk, const struct bkey *k) +@@ -553,7 +553,7 @@ static bool bch_extent_bad(struct btree_keys *bk, const struct bkey *k) for (i = 0; i < KEY_PTRS(k); i++) { stale = ptr_stale(b->c, k, i); @@ -27,5 +28,5 @@ index 1d096742eb41..144b1d0f9b84 100644 stale, b->c->need_gc); -- -2.16.4 +2.19.0 diff --git a/for-next/0001-bcache-use-MAX_CACHES_PER_SET-instead-of-magic-numbe.patch b/for-next/0008-bcache-use-MAX_CACHES_PER_SET-instead-of-magic-numbe.patch index 9448e95..86cb5a9 100644 --- a/for-next/0001-bcache-use-MAX_CACHES_PER_SET-instead-of-magic-numbe.patch +++ b/for-next/0008-bcache-use-MAX_CACHES_PER_SET-instead-of-magic-numbe.patch @@ -1,8 +1,8 @@ -From fd6ca3dec31113144a3f0af19854c33e64bd6ee6 Mon Sep 17 00:00:00 2001 +From e8636ed2c0aae136d269dfd4c3e707d32902cc8f Mon Sep 17 00:00:00 2001 From: Shenghui Wang <shhuiw@foxmail.com> Date: Tue, 4 Sep 2018 21:35:01 +0800 -Subject: [PATCH] bcache: use MAX_CACHES_PER_SET instead of magic number 8 in - __bch_bucket_alloc_set +Subject: [PATCH 08/10] bcache: use MAX_CACHES_PER_SET instead of magic number + 8 in __bch_bucket_alloc_set Current cache_set has MAX_CACHES_PER_SET caches most, and the macro is used for @@ -34,5 +34,5 @@ index 7a28232d868b..5002838ea476 100644 bkey_init(k); -- -2.18.0 +2.19.0 diff --git a/for-next/0009-split-original-if-condition-code-into-separate-ones.patch b/for-next/0009-split-original-if-condition-code-into-separate-ones.patch new file mode 100644 index 0000000..03d4a76 --- /dev/null +++ b/for-next/0009-split-original-if-condition-code-into-separate-ones.patch @@ -0,0 +1,131 @@ +From 39b3b52bb47dabed477bbe24e1cde01572833c3c Mon Sep 17 00:00:00 2001 +From: Dongbo Cao <cdbdyx@163.com> +Date: Tue, 25 Sep 2018 14:09:44 +0800 +Subject: [PATCH 09/10] split original if-condition code into separate ones + +Split the combined '||' statements in if() check, to make the code easier +for debug. + +Signed-off-by: Dongbo Cao <cdbdyx@163.com> +Signed-off-by: Coly Li <colyli@suse.de> +--- + drivers/md/bcache/super.c | 90 +++++++++++++++++++++++++++++++++------ + 1 file changed, 76 insertions(+), 14 deletions(-) + +diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c +index 71dd26696dc7..97df68f00bac 100644 +--- a/drivers/md/bcache/super.c ++++ b/drivers/md/bcache/super.c +@@ -2054,6 +2054,8 @@ static int cache_alloc(struct cache *ca) + size_t free; + size_t btree_buckets; + struct bucket *b; ++ int ret = -ENOMEM; ++ const char *err = NULL; + + __module_get(THIS_MODULE); + kobject_init(&ca->kobj, &bch_cache_ktype); +@@ -2072,26 +2074,86 @@ static int cache_alloc(struct cache *ca) + btree_buckets = ca->sb.njournal_buckets ?: 8; + free = roundup_pow_of_two(ca->sb.nbuckets) >> 10; + +- if (!init_fifo(&ca->free[RESERVE_BTREE], btree_buckets, GFP_KERNEL) || +- !init_fifo_exact(&ca->free[RESERVE_PRIO], prio_buckets(ca), GFP_KERNEL) || +- !init_fifo(&ca->free[RESERVE_MOVINGGC], free, GFP_KERNEL) || +- !init_fifo(&ca->free[RESERVE_NONE], free, GFP_KERNEL) || +- !init_fifo(&ca->free_inc, free << 2, GFP_KERNEL) || +- !init_heap(&ca->heap, free << 3, GFP_KERNEL) || +- !(ca->buckets = vzalloc(array_size(sizeof(struct bucket), +- ca->sb.nbuckets))) || +- !(ca->prio_buckets = kzalloc(array3_size(sizeof(uint64_t), +- prio_buckets(ca), 2), +- GFP_KERNEL)) || +- !(ca->disk_buckets = alloc_bucket_pages(GFP_KERNEL, ca))) +- return -ENOMEM; ++ if (!init_fifo(&ca->free[RESERVE_BTREE], btree_buckets, ++ GFP_KERNEL)) { ++ err = "ca->free[RESERVE_BTREE] alloc failed"; ++ goto err_btree_alloc; ++ } ++ ++ if (!init_fifo_exact(&ca->free[RESERVE_PRIO], prio_buckets(ca), ++ GFP_KERNEL)) { ++ err = "ca->free[RESERVE_PRIO] alloc failed"; ++ goto err_prio_alloc; ++ } ++ ++ if (!init_fifo(&ca->free[RESERVE_MOVINGGC], free, GFP_KERNEL)) { ++ err = "ca->free[RESERVE_MOVINGGC] alloc failed"; ++ goto err_movinggc_alloc; ++ } ++ ++ if (!init_fifo(&ca->free[RESERVE_NONE], free, GFP_KERNEL)) { ++ err = "ca->free[RESERVE_NONE] alloc failed"; ++ goto err_none_alloc; ++ } ++ ++ if (!init_fifo(&ca->free_inc, free << 2, GFP_KERNEL)) { ++ err = "ca->free_inc alloc failed"; ++ goto err_free_inc_alloc; ++ } ++ ++ if (!init_heap(&ca->heap, free << 3, GFP_KERNEL)) { ++ err = "ca->heap alloc failed"; ++ goto err_heap_alloc; ++ } ++ ++ ca->buckets = vzalloc(array_size(sizeof(struct bucket), ++ ca->sb.nbuckets)); ++ if (!ca->buckets) { ++ err = "ca->buckets alloc failed"; ++ goto err_buckets_alloc; ++ } ++ ++ ca->prio_buckets = kzalloc(array3_size(sizeof(uint64_t), ++ prio_buckets(ca), 2), ++ GFP_KERNEL); ++ if (!ca->prio_buckets) { ++ err = "ca->prio_buckets alloc failed"; ++ goto err_prio_buckets_alloc; ++ } ++ ++ ca->disk_buckets = alloc_bucket_pages(GFP_KERNEL, ca); ++ if (!ca->disk_buckets) { ++ err = "ca->disk_buckets alloc failed"; ++ goto err_disk_buckets_alloc; ++ } + + ca->prio_last_buckets = ca->prio_buckets + prio_buckets(ca); + + for_each_bucket(b, ca) + atomic_set(&b->pin, 0); +- + return 0; ++ ++err_disk_buckets_alloc: ++ kfree(ca->prio_buckets); ++err_prio_buckets_alloc: ++ vfree(ca->buckets); ++err_buckets_alloc: ++ free_heap(&ca->heap); ++err_heap_alloc: ++ free_fifo(&ca->free_inc); ++err_free_inc_alloc: ++ free_fifo(&ca->free[RESERVE_NONE]); ++err_none_alloc: ++ free_fifo(&ca->free[RESERVE_MOVINGGC]); ++err_movinggc_alloc: ++ free_fifo(&ca->free[RESERVE_PRIO]); ++err_prio_alloc: ++ free_fifo(&ca->free[RESERVE_BTREE]); ++err_btree_alloc: ++ module_put(THIS_MODULE); ++ if (err) ++ pr_notice("error %s: %s", ca->cache_dev_name, err); ++ return ret; + } + + static int register_cache(struct cache_sb *sb, struct page *sb_page, +-- +2.19.0 + diff --git a/for-next/0010-panic-fix-for-making-cache-device.patch b/for-next/0010-panic-fix-for-making-cache-device.patch new file mode 100644 index 0000000..eb7bba7 --- /dev/null +++ b/for-next/0010-panic-fix-for-making-cache-device.patch @@ -0,0 +1,51 @@ +From 7860ba549ab6e7021ccebbdac102af85a66ad038 Mon Sep 17 00:00:00 2001 +From: Dongbo Cao <cdbdyx@163.com> +Date: Tue, 25 Sep 2018 14:09:45 +0800 +Subject: [PATCH 10/10] panic fix for making cache device + +when the nbuckets of cache device is smaller than 1024, making cache +device will trigger BUG_ON in kernel, add a condition to avoid this. + +Reported-by: nitroxis <n@nxs.re> +Signed-off-by: Dongbo Cao <cdbdyx@163.com> +Signed-off-by: Coly Li <colyli@suse.de> +--- + drivers/md/bcache/super.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c +index 97df68f00bac..a2cc354caf05 100644 +--- a/drivers/md/bcache/super.c ++++ b/drivers/md/bcache/super.c +@@ -2073,6 +2073,11 @@ static int cache_alloc(struct cache *ca) + */ + btree_buckets = ca->sb.njournal_buckets ?: 8; + free = roundup_pow_of_two(ca->sb.nbuckets) >> 10; ++ if (!free) { ++ ret = -EPERM; ++ err = "ca->sb.nbuckets is too small"; ++ goto err_free; ++ } + + if (!init_fifo(&ca->free[RESERVE_BTREE], btree_buckets, + GFP_KERNEL)) { +@@ -2150,6 +2155,7 @@ static int cache_alloc(struct cache *ca) + err_prio_alloc: + free_fifo(&ca->free[RESERVE_BTREE]); + err_btree_alloc: ++err_free: + module_put(THIS_MODULE); + if (err) + pr_notice("error %s: %s", ca->cache_dev_name, err); +@@ -2179,6 +2185,8 @@ static int register_cache(struct cache_sb *sb, struct page *sb_page, + blkdev_put(bdev, FMODE_READ|FMODE_WRITE|FMODE_EXCL); + if (ret == -ENOMEM) + err = "cache_alloc(): -ENOMEM"; ++ else if (ret == -EPERM) ++ err = "cache_alloc(): cache device is too small"; + else + err = "cache_alloc(): unknown error"; + goto err; +-- +2.19.0 + |