[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20260119131257.306564-1-yebin@huaweicloud.com>
Date: Mon, 19 Jan 2026 21:12:57 +0800
From: Ye Bin <yebin@...weicloud.com>
To: tytso@....edu,
adilger.kernel@...ger.ca,
linux-ext4@...r.kernel.org
Cc: jack@...e.cz
Subject: [PATCH] ext4: fix mballoc-test.c is not compiled when EXT4_KUNIT_TESTS=M
From: Ye Bin <yebin10@...wei.com>
Now, only EXT4_KUNIT_TESTS=Y testcase will be compiled in 'mballoc.c'.
EXT4_FS KUNIT EXT4_KUNIT_TESTS
Y Y Y
Y Y M
Y M M // This case will lead to link error
M Y M
M M M
Fixes: 7c9fa399a369 ("ext4: add first unit test for ext4_mb_new_blocks_simple in mballoc")
Signed-off-by: Ye Bin <yebin10@...wei.com>
---
fs/ext4/mballoc.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index e817a758801d..0fbd2dfae497 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -7191,6 +7191,10 @@ ext4_mballoc_query_range(
return error;
}
-#ifdef CONFIG_EXT4_KUNIT_TESTS
+#if IS_ENABLED(CONFIG_EXT4_KUNIT_TESTS)
+#if IS_BUILTIN(CONFIG_EXT4_FS) && IS_MODULE(CONFIG_KUNIT)
+/* This case will lead to link error. */
+#else
#include "mballoc-test.c"
#endif
+#endif
--
2.34.1
Powered by blists - more mailing lists