From: Shenghui Wang shhuiw@foxmail.com
mainline inclusion from mainline-4.20-rc1 commit 8792099f9ad487cf381f4e8199ff2158ba0f6eb5 category: backport
Current cache_set has MAX_CACHES_PER_SET caches most, and the macro is used for " struct cache *cache_by_alloc[MAX_CACHES_PER_SET]; " in the define of struct cache_set.
Use MAX_CACHES_PER_SET instead of magic number 8 in __bch_bucket_alloc_set.
Signed-off-by: Shenghui Wang shhuiw@foxmail.com Signed-off-by: Coly Li colyli@suse.de Signed-off-by: Jens Axboe axboe@kernel.dk --- drivers/md/bcache/alloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/md/bcache/alloc.c b/drivers/md/bcache/alloc.c index 9c3beb1e382b..6f776823b9ba 100644 --- a/drivers/md/bcache/alloc.c +++ b/drivers/md/bcache/alloc.c @@ -494,7 +494,7 @@ int __bch_bucket_alloc_set(struct cache_set *c, unsigned int reserve, return -1;
lockdep_assert_held(&c->bucket_lock); - BUG_ON(!n || n > c->caches_loaded || n > 8); + BUG_ON(!n || n > c->caches_loaded || n > MAX_CACHES_PER_SET);
bkey_init(k);