diff options
author | Coly Li <colyli@suse.de> | 2018-11-14 15:55:03 +0800 |
---|---|---|
committer | Coly Li <colyli@suse.de> | 2018-11-14 15:55:03 +0800 |
commit | 78f5bd244bc4c9939a93e43b0c4f22ce750b5df4 (patch) | |
tree | e9a212c782958c7113d81f853bbac108ed95f2e7 | |
parent | 2ebe1893b38e98d406678589f6520ce4ab42fc52 (diff) | |
download | bcache-patches-78f5bd244bc4c9939a93e43b0c4f22ce750b5df4.tar.gz |
for-next: add more patches
-rw-r--r-- | for-next/0001-bcache-add-comment-for-cache_set-fill_iter.patch | 76 | ||||
-rw-r--r-- | for-next/0001-bcache-do-not-check-if-debug-dentry-is-ERR-or-NULL-e.patch | 49 |
2 files changed, 125 insertions, 0 deletions
diff --git a/for-next/0001-bcache-add-comment-for-cache_set-fill_iter.patch b/for-next/0001-bcache-add-comment-for-cache_set-fill_iter.patch new file mode 100644 index 0000000..8d5d4a2 --- /dev/null +++ b/for-next/0001-bcache-add-comment-for-cache_set-fill_iter.patch @@ -0,0 +1,76 @@ +From c2ba59854eada992b8c5e0a725bedfb4b325bec4 Mon Sep 17 00:00:00 2001 +From: Shenghui Wang <shhuiw@foxmail.com> +Date: Wed, 24 Oct 2018 10:35:38 +0800 +Subject: [PATCH] bcache: add comment for cache_set->fill_iter + +We have the following define for btree iterator: + struct btree_iter { + size_t size, used; + #ifdef CONFIG_BCACHE_DEBUG + struct btree_keys *b; + #endif + struct btree_iter_set { + struct bkey *k, *end; + } data[MAX_BSETS]; + }; + +We can see that the length of data[] field is static MAX_BSETS, which is +defined as 4 currently. + +But a btree node on disk could have too many bsets for an iterator to fit +on the stack - maybe far more that MAX_BSETS. Have to dynamically allocate +space to host more btree_iter_sets. + +bch_cache_set_alloc() will make sure the pool cache_set->fill_iter can +allocate an iterator equipped with enough room that can host + (sb.bucket_size / sb.block_size) +btree_iter_sets, which is more than static MAX_BSETS. + +bch_btree_node_read_done() will use that pool to allocate one iterator, to +host many bsets in one btree node. + +Add more comment around cache_set->fill_iter to make code less confusing. + +Signed-off-by: Shenghui Wang <shhuiw@foxmail.com> +Signed-off-by: Coly Li <colyli@suse.de> +--- + drivers/md/bcache/bcache.h | 6 +++++- + drivers/md/bcache/btree.c | 5 +++++ + 2 files changed, 10 insertions(+), 1 deletion(-) + +diff --git a/drivers/md/bcache/bcache.h b/drivers/md/bcache/bcache.h +index b61b83bbcfff..96d2213f279e 100644 +--- a/drivers/md/bcache/bcache.h ++++ b/drivers/md/bcache/bcache.h +@@ -658,7 +658,11 @@ struct cache_set { + + /* + * A btree node on disk could have too many bsets for an iterator to fit +- * on the stack - have to dynamically allocate them ++ * on the stack - have to dynamically allocate them. ++ * bch_cache_set_alloc() will make sure the pool can allocate iterators ++ * equipped with enough room that can host ++ * (sb.bucket_size / sb.block_size) ++ * btree_iter_sets, which is more than static MAX_BSETS. + */ + mempool_t fill_iter; + +diff --git a/drivers/md/bcache/btree.c b/drivers/md/bcache/btree.c +index 3f4211b5cd33..23cb1dc7296b 100644 +--- a/drivers/md/bcache/btree.c ++++ b/drivers/md/bcache/btree.c +@@ -207,6 +207,11 @@ void bch_btree_node_read_done(struct btree *b) + struct bset *i = btree_bset_first(b); + struct btree_iter *iter; + ++ /* ++ * c->fill_iter can allocate an iterator with more memory space ++ * than static MAX_BSETS. ++ * See the comment arount cache_set->fill_iter. ++ */ + iter = mempool_alloc(&b->c->fill_iter, GFP_NOIO); + iter->size = b->c->sb.bucket_size / b->c->sb.block_size; + iter->used = 0; +-- +2.19.1 + diff --git a/for-next/0001-bcache-do-not-check-if-debug-dentry-is-ERR-or-NULL-e.patch b/for-next/0001-bcache-do-not-check-if-debug-dentry-is-ERR-or-NULL-e.patch new file mode 100644 index 0000000..67209a5 --- /dev/null +++ b/for-next/0001-bcache-do-not-check-if-debug-dentry-is-ERR-or-NULL-e.patch @@ -0,0 +1,49 @@ +From 0a4e4e850f452aa14aad9d077b7ed7d3b39b18e2 Mon Sep 17 00:00:00 2001 +From: Shenghui Wang <shhuiw@foxmail.com> +Date: Thu, 18 Oct 2018 20:44:57 +0800 +Subject: [PATCH] bcache: do not check if debug dentry is ERR or NULL + explicitly on remove + +debugfs_remove and debugfs_remove_recursive will check if the dentry +pointer is NULL or ERR, and will do nothing in that case. + +Remove the check in cache_set_free and bch_debug_init. + +Signed-off-by: Shenghui Wang <shhuiw@foxmail.com> +Signed-off-by: Coly Li <colyli@suse.de> +--- + drivers/md/bcache/debug.c | 3 +-- + drivers/md/bcache/super.c | 3 +-- + 2 files changed, 2 insertions(+), 4 deletions(-) + +diff --git a/drivers/md/bcache/debug.c b/drivers/md/bcache/debug.c +index 8f448b9c96a1..8b123be05254 100644 +--- a/drivers/md/bcache/debug.c ++++ b/drivers/md/bcache/debug.c +@@ -249,8 +249,7 @@ void bch_debug_init_cache_set(struct cache_set *c) + + void bch_debug_exit(void) + { +- if (!IS_ERR_OR_NULL(bcache_debug)) +- debugfs_remove_recursive(bcache_debug); ++ debugfs_remove_recursive(bcache_debug); + } + + void __init bch_debug_init(void) +diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c +index 7bbd670a5a84..5b59d44656c0 100644 +--- a/drivers/md/bcache/super.c ++++ b/drivers/md/bcache/super.c +@@ -1510,8 +1510,7 @@ static void cache_set_free(struct closure *cl) + struct cache *ca; + unsigned int i; + +- if (!IS_ERR_OR_NULL(c->debug)) +- debugfs_remove(c->debug); ++ debugfs_remove(c->debug); + + bch_open_buckets_free(c); + bch_btree_cache_free(c); +-- +2.19.1 + |