It is unnecessary to initialize the EXPERIMENTAL nvm-pages allocator when CONFIG_BCACHE_NVM_PAGES is not configured. This patch uses "#ifdef CONFIG_BCACHE_NVM_PAGES" to wrap bch_nvm_init() and bch_nvm_exit(), and only calls them when bch_nvm_exit is configured. Signed-off-by: Coly Li <colyli@xxxxxxx> Cc: Jianpeng Ma <jianpeng.ma@xxxxxxxxx> Cc: Qiaowei Ren <qiaowei.ren@xxxxxxxxx> --- drivers/md/bcache/super.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c index 61fd5802a627..c273eeef0d38 100644 --- a/drivers/md/bcache/super.c +++ b/drivers/md/bcache/super.c @@ -2845,7 +2845,9 @@ static void bcache_exit(void) { bch_debug_exit(); bch_request_exit(); +#ifdef CONFIG_BCACHE_NVM_PAGES bch_nvm_exit(); +#endif if (bcache_kobj) kobject_put(bcache_kobj); if (bcache_wq) @@ -2947,7 +2949,9 @@ static int __init bcache_init(void) bch_debug_init(); closure_debug_init(); +#ifdef CONFIG_BCACHE_NVM_PAGES bch_nvm_init(); +#endif bcache_is_reboot = false; -- 2.26.2