All of lore.kernel.org
 help / color / mirror / Atom feed
From: yebin <yebin@huaweicloud.com>
To: Ojaswin Mujoo <ojaswin@linux.ibm.com>
Cc: tytso@mit.edu, adilger.kernel@dilger.ca,
	linux-ext4@vger.kernel.org, jack@suse.cz
Subject: Re: [PATCH] ext4: fix mballoc-test.c is not compiled when EXT4_KUNIT_TESTS=M
Date: Wed, 21 Jan 2026 17:04:12 +0800	[thread overview]
Message-ID: <6970968C.1050507@huaweicloud.com> (raw)
In-Reply-To: <aW9AofPgVKEL6bk1@li-dc0c254c-257c-11b2-a85c-98b6c1322444.ibm.com>



On 2026/1/20 16:45, Ojaswin Mujoo wrote:
> On Mon, Jan 19, 2026 at 09:12:57PM +0800, Ye Bin wrote:
>> From: Ye Bin <yebin10@huawei.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@huawei.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
>
> Hi Ye Bin,
>
> Thanks for pointing out this issue but your solution seems to be having
> a side effect of making ext4.ko depend on kunit.ko.
>
>    modinfo ext4.ko
>    license:        GPL
>    license:        GPL
>    description:    Fourth Extended Filesystem
>    author:         Remy Card, Stephen Tweedie, Andrew Morton, Andreas Dilger, Theodore Ts'o and others
>    alias:          fs-ext4
>    alias:          ext3
>    alias:          fs-ext3
>    depends:        kunit
>    intree:         Y
>    name:           ext4
>    retpoline:      Y
>    vermagic:       6.19.0-rc4-xfstests-g326263653b81-dirty SMP preempt mod_unload
>
> That means we won't be able to insert ext4 module without having kunit.

Thank you for your reply.
In my opinion, if the CONFIG_EXT4_KUNIT_TESTS configuration is enabled 
and ext4.ko uses symbols from kunit.ko, then it is normal for ext4.ko to 
depend on kunit.ko.

> This is not the behavior we want. I think a more simpler fix here could
> be:
>
>    #if IS_BUILTIN(CONFIG_KUNIT) && IS_ENABLED(CONFIG_EXT4_KUNIT_TESTS)
>    #include "mballoc-test.c"
>    #endif
>
> So basically, as long as KUNIT=y and EXT4_KUNIT_TESTS=y/m we will run
> these tests, otherwise we won't. This also removes the dependency issue.
>
> What do you think?
>
> Regards,
> ojaswin
>
>> --
>> 2.34.1
>>
>


  reply	other threads:[~2026-01-21  9:04 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-19 13:12 [PATCH] ext4: fix mballoc-test.c is not compiled when EXT4_KUNIT_TESTS=M Ye Bin
2026-01-20  8:45 ` Ojaswin Mujoo
2026-01-21  9:04   ` yebin [this message]
2026-01-21  9:51     ` Ojaswin Mujoo
  -- strict thread matches above, loose matches on Subject: below --
2026-02-26 11:09 Ye Bin
2026-02-26 13:42 ` Jan Kara
2026-02-27  2:44   ` yebin (H)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6970968C.1050507@huaweicloud.com \
    --to=yebin@huaweicloud.com \
    --cc=adilger.kernel@dilger.ca \
    --cc=jack@suse.cz \
    --cc=linux-ext4@vger.kernel.org \
    --cc=ojaswin@linux.ibm.com \
    --cc=tytso@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.