[PATCH] ext4: Fix sparse warning in extents kunit test when EXT4_KUNIT_TESTS=m

Ojaswin Mujoo posted 1 patch 2 days ago
There is a newer version of this series
fs/ext4/extents-test.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] ext4: Fix sparse warning in extents kunit test when EXT4_KUNIT_TESTS=m
Posted by Ojaswin Mujoo 2 days ago
When kunit tests are compiled as modules, the extents kunit test emits
a sparse warning:

>> fs/ext4/extents-test.c:59:3: sparse: sparse: symbol 'k_ctx' was not
   declared. Should it be static?

Fix this by declaring it as static.

Fixes: cb1e0c1d1fad ("ext4: kunit tests for extent splitting and conversion")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202609221900.Pgwrcp41-lkp@intel.com/
---
 fs/ext4/extents-test.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/ext4/extents-test.c b/fs/ext4/extents-test.c
index bd7795a82607..9669b2197fca 100644
--- a/fs/ext4/extents-test.c
+++ b/fs/ext4/extents-test.c
@@ -48,7 +48,7 @@
 #define EXT_DATA_LBLK 10
 #define EXT_DATA_LEN 3
 
-struct kunit_ctx {
+static struct kunit_ctx {
 	/*
 	 * Ext4 inode which has only 1 unwrit extent
 	 */
-- 
2.55.0
Re: [PATCH] ext4: Fix sparse warning in extents kunit test when EXT4_KUNIT_TESTS=m
Posted by Baokun Li 7 hours ago
Hi Ojaswin,

On 2026/9/22 21:58, Ojaswin Mujoo wrote:
> When kunit tests are compiled as modules, the extents kunit test emits
> a sparse warning:

This is not module-specific, it also shows up with
EXT4_KUNIT_TESTS=y, so maybe the "=m" can be dropped.

>>> fs/ext4/extents-test.c:59:3: sparse: sparse: symbol 'k_ctx' was not
>    declared. Should it be static?
>
> Fix this by declaring it as static.
>
> Fixes: cb1e0c1d1fad ("ext4: kunit tests for extent splitting and conversion")
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202609221900.Pgwrcp41-lkp@intel.com/


Missing Signed-off-by, otherwise looks good to me.

Reviewed-by: Baokun Li <libaokun@linux.alibaba.com>


> ---
>  fs/ext4/extents-test.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/ext4/extents-test.c b/fs/ext4/extents-test.c
> index bd7795a82607..9669b2197fca 100644
> --- a/fs/ext4/extents-test.c
> +++ b/fs/ext4/extents-test.c
> @@ -48,7 +48,7 @@
>  #define EXT_DATA_LBLK 10
>  #define EXT_DATA_LEN 3
>  
> -struct kunit_ctx {
> +static struct kunit_ctx {
>  	/*
>  	 * Ext4 inode which has only 1 unwrit extent
>  	 */
Re: [PATCH] ext4: Fix sparse warning in extents kunit test when EXT4_KUNIT_TESTS=m
Posted by Ojaswin Mujoo 6 hours ago
On Thu, Sep 24, 2026 at 02:57:50PM +0800, Baokun Li wrote:
> Hi Ojaswin,
> 
> On 2026/9/22 21:58, Ojaswin Mujoo wrote:
> > When kunit tests are compiled as modules, the extents kunit test emits
> > a sparse warning:
> 
> This is not module-specific, it also shows up with
> EXT4_KUNIT_TESTS=y, so maybe the "=m" can be dropped.
> 
> >>> fs/ext4/extents-test.c:59:3: sparse: sparse: symbol 'k_ctx' was not
> >    declared. Should it be static?
> >
> > Fix this by declaring it as static.
> >
> > Fixes: cb1e0c1d1fad ("ext4: kunit tests for extent splitting and conversion")
> > Reported-by: kernel test robot <lkp@intel.com>
> > Closes: https://lore.kernel.org/oe-kbuild-all/202609221900.Pgwrcp41-lkp@intel.com/
> 
> 
> Missing Signed-off-by, otherwise looks good to me.

Ahh idk how that got missed :) Thanks I'll fix it.

Regards,
ojaswin

> 
> Reviewed-by: Baokun Li <libaokun@linux.alibaba.com>
> 
> 
> > ---
> >  fs/ext4/extents-test.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/fs/ext4/extents-test.c b/fs/ext4/extents-test.c
> > index bd7795a82607..9669b2197fca 100644
> > --- a/fs/ext4/extents-test.c
> > +++ b/fs/ext4/extents-test.c
> > @@ -48,7 +48,7 @@
> >  #define EXT_DATA_LBLK 10
> >  #define EXT_DATA_LEN 3
> >  
> > -struct kunit_ctx {
> > +static struct kunit_ctx {
> >  	/*
> >  	 * Ext4 inode which has only 1 unwrit extent
> >  	 */
> 
>
Re: [PATCH] ext4: Fix sparse warning in extents kunit test when EXT4_KUNIT_TESTS=m
Posted by Zhang Yi 1 day, 1 hour ago
On 9/22/2026 9:58 PM, Ojaswin Mujoo wrote:
> When kunit tests are compiled as modules, the extents kunit test emits
> a sparse warning:
> 
>>> fs/ext4/extents-test.c:59:3: sparse: sparse: symbol 'k_ctx' was not
>     declared. Should it be static?
> 
> Fix this by declaring it as static.
> 
> Fixes: cb1e0c1d1fad ("ext4: kunit tests for extent splitting and conversion")
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202609221900.Pgwrcp41-lkp@intel.com/

Looks good to me.

Reviewed-by: Zhang Yi <yi.zhang@huawei.com>

> ---
>   fs/ext4/extents-test.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/ext4/extents-test.c b/fs/ext4/extents-test.c
> index bd7795a82607..9669b2197fca 100644
> --- a/fs/ext4/extents-test.c
> +++ b/fs/ext4/extents-test.c
> @@ -48,7 +48,7 @@
>   #define EXT_DATA_LBLK 10
>   #define EXT_DATA_LEN 3
>   
> -struct kunit_ctx {
> +static struct kunit_ctx {
>   	/*
>   	 * Ext4 inode which has only 1 unwrit extent
>   	 */
Re: [PATCH] ext4: Fix sparse warning in extents kunit test when EXT4_KUNIT_TESTS=m
Posted by Jan Kara 1 day, 2 hours ago
On Tue 22-09-26 19:28:08, Ojaswin Mujoo wrote:
> When kunit tests are compiled as modules, the extents kunit test emits
> a sparse warning:
> 
> >> fs/ext4/extents-test.c:59:3: sparse: sparse: symbol 'k_ctx' was not
>    declared. Should it be static?
> 
> Fix this by declaring it as static.
> 
> Fixes: cb1e0c1d1fad ("ext4: kunit tests for extent splitting and conversion")
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202609221900.Pgwrcp41-lkp@intel.com/

Looks good. Feel free to add:

Reviewed-by: Jan Kara <jack@suse.cz>

								Honza

> ---
>  fs/ext4/extents-test.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/ext4/extents-test.c b/fs/ext4/extents-test.c
> index bd7795a82607..9669b2197fca 100644
> --- a/fs/ext4/extents-test.c
> +++ b/fs/ext4/extents-test.c
> @@ -48,7 +48,7 @@
>  #define EXT_DATA_LBLK 10
>  #define EXT_DATA_LEN 3
>  
> -struct kunit_ctx {
> +static struct kunit_ctx {
>  	/*
>  	 * Ext4 inode which has only 1 unwrit extent
>  	 */
> -- 
> 2.55.0
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR