public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xfs_io: Avoid using __kernel_rwf_t for older kernels
@ 2024-11-25 22:26 Florian Fainelli
  2024-11-26  1:22 ` Darrick J. Wong
  2024-11-26  4:53 ` Christoph Hellwig
  0 siblings, 2 replies; 5+ messages in thread
From: Florian Fainelli @ 2024-11-25 22:26 UTC (permalink / raw)
  To: linux-xfs; +Cc: mmayer, justin.chen, catherine.hoang, Florian Fainelli

__kernel_rwf_t was defined with upstream Linux commit
ddef7ed2b5cbafae692d1d580bb5a07808926a9c ("annotate RWF_... flags")
which has been included in Linux v4.14 and newer. When building xfsprogs
against older kernel headers, this type is not defined, leading to the
following build error:

pwrite.c: In function 'pwrite_f':
../include/xfs/linux.h:236:22: error: '__kernel_rwf_t' undeclared (first use in this function); did you mean '__kernel_off_t'?
 #define RWF_ATOMIC ((__kernel_rwf_t)0x00000040)
                      ^~~~~~~~~~~~~~
pwrite.c:329:22: note: in expansion of macro 'RWF_ATOMIC'
    pwritev2_flags |= RWF_ATOMIC;

Fixes: ee6c5941352a ("xfs_io: add RWF_ATOMIC support to pwrite")
Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
---
 include/linux.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux.h b/include/linux.h
index e9eb7bfb26a1..68b43393aad7 100644
--- a/include/linux.h
+++ b/include/linux.h
@@ -233,7 +233,7 @@ struct fsxattr {
 
 /* Atomic Write */
 #ifndef RWF_ATOMIC
-#define RWF_ATOMIC	((__kernel_rwf_t)0x00000040)
+#define RWF_ATOMIC	(0x00000040)
 #endif
 
 /*
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] xfs_io: Avoid using __kernel_rwf_t for older kernels
  2024-11-25 22:26 [PATCH] xfs_io: Avoid using __kernel_rwf_t for older kernels Florian Fainelli
@ 2024-11-26  1:22 ` Darrick J. Wong
  2024-11-26  1:29   ` Florian Fainelli
  2025-01-07 19:13   ` Florian Fainelli
  2024-11-26  4:53 ` Christoph Hellwig
  1 sibling, 2 replies; 5+ messages in thread
From: Darrick J. Wong @ 2024-11-26  1:22 UTC (permalink / raw)
  To: Florian Fainelli; +Cc: linux-xfs, mmayer, justin.chen, catherine.hoang

On Mon, Nov 25, 2024 at 02:26:18PM -0800, Florian Fainelli wrote:
> __kernel_rwf_t was defined with upstream Linux commit
> ddef7ed2b5cbafae692d1d580bb5a07808926a9c ("annotate RWF_... flags")
> which has been included in Linux v4.14 and newer. When building xfsprogs

/methinks you should upgrade your kernel, 4.14 is quite dead now, and
you're not even running something /that/ new.

> against older kernel headers, this type is not defined, leading to the
> following build error:
> 
> pwrite.c: In function 'pwrite_f':
> ../include/xfs/linux.h:236:22: error: '__kernel_rwf_t' undeclared (first use in this function); did you mean '__kernel_off_t'?
>  #define RWF_ATOMIC ((__kernel_rwf_t)0x00000040)
>                       ^~~~~~~~~~~~~~
> pwrite.c:329:22: note: in expansion of macro 'RWF_ATOMIC'
>     pwritev2_flags |= RWF_ATOMIC;
> 
> Fixes: ee6c5941352a ("xfs_io: add RWF_ATOMIC support to pwrite")
> Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>

That said, if this doesn't break anything with a ~2020s distro then I
don't have any objections to this, so:

Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>

--D

> ---
>  include/linux.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/linux.h b/include/linux.h
> index e9eb7bfb26a1..68b43393aad7 100644
> --- a/include/linux.h
> +++ b/include/linux.h
> @@ -233,7 +233,7 @@ struct fsxattr {
>  
>  /* Atomic Write */
>  #ifndef RWF_ATOMIC
> -#define RWF_ATOMIC	((__kernel_rwf_t)0x00000040)
> +#define RWF_ATOMIC	(0x00000040)
>  #endif
>  
>  /*
> -- 
> 2.34.1
> 
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] xfs_io: Avoid using __kernel_rwf_t for older kernels
  2024-11-26  1:22 ` Darrick J. Wong
@ 2024-11-26  1:29   ` Florian Fainelli
  2025-01-07 19:13   ` Florian Fainelli
  1 sibling, 0 replies; 5+ messages in thread
From: Florian Fainelli @ 2024-11-26  1:29 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: linux-xfs, mmayer, justin.chen, catherine.hoang

On 11/25/24 17:22, Darrick J. Wong wrote:
> On Mon, Nov 25, 2024 at 02:26:18PM -0800, Florian Fainelli wrote:
>> __kernel_rwf_t was defined with upstream Linux commit
>> ddef7ed2b5cbafae692d1d580bb5a07808926a9c ("annotate RWF_... flags")
>> which has been included in Linux v4.14 and newer. When building xfsprogs
> 
> /methinks you should upgrade your kernel, 4.14 is quite dead now, and
> you're not even running something /that/ new.

For sure, we happen to build a root filesystem against old (4.9) kernel 
headers and this is how we caught it. It was good to see that thought 
had been put into defining RWF_ATOMIC is not already defined, not having 
a type for __kernel_rwf_t was the next thing.

> 
>> against older kernel headers, this type is not defined, leading to the
>> following build error:
>>
>> pwrite.c: In function 'pwrite_f':
>> ../include/xfs/linux.h:236:22: error: '__kernel_rwf_t' undeclared (first use in this function); did you mean '__kernel_off_t'?
>>   #define RWF_ATOMIC ((__kernel_rwf_t)0x00000040)
>>                        ^~~~~~~~~~~~~~
>> pwrite.c:329:22: note: in expansion of macro 'RWF_ATOMIC'
>>      pwritev2_flags |= RWF_ATOMIC;
>>
>> Fixes: ee6c5941352a ("xfs_io: add RWF_ATOMIC support to pwrite")
>> Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
> 
> That said, if this doesn't break anything with a ~2020s distro then I
> don't have any objections to this, so:
> 
> Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>

Thanks!
-- 
Florian

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] xfs_io: Avoid using __kernel_rwf_t for older kernels
  2024-11-25 22:26 [PATCH] xfs_io: Avoid using __kernel_rwf_t for older kernels Florian Fainelli
  2024-11-26  1:22 ` Darrick J. Wong
@ 2024-11-26  4:53 ` Christoph Hellwig
  1 sibling, 0 replies; 5+ messages in thread
From: Christoph Hellwig @ 2024-11-26  4:53 UTC (permalink / raw)
  To: Florian Fainelli; +Cc: linux-xfs, mmayer, justin.chen, catherine.hoang

On Mon, Nov 25, 2024 at 02:26:18PM -0800, Florian Fainelli wrote:
> __kernel_rwf_t was defined with upstream Linux commit
> ddef7ed2b5cbafae692d1d580bb5a07808926a9c ("annotate RWF_... flags")
> which has been included in Linux v4.14 and newer. When building xfsprogs
> against older kernel headers, this type is not defined, leading to the
> following build error:

As notjign else in xfsprogs uses it this looks fine:

Reviewed-by: Christoph Hellwig <hch@lst.de>

Although I wonder about the state of sparse checking in xfsprogs,
which to be fair I haven't run for a while.  I guss it's time to
restart them and sort out the mess..


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] xfs_io: Avoid using __kernel_rwf_t for older kernels
  2024-11-26  1:22 ` Darrick J. Wong
  2024-11-26  1:29   ` Florian Fainelli
@ 2025-01-07 19:13   ` Florian Fainelli
  1 sibling, 0 replies; 5+ messages in thread
From: Florian Fainelli @ 2025-01-07 19:13 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: linux-xfs, mmayer, justin.chen, catherine.hoang

On 11/25/24 17:22, Darrick J. Wong wrote:
> On Mon, Nov 25, 2024 at 02:26:18PM -0800, Florian Fainelli wrote:
>> __kernel_rwf_t was defined with upstream Linux commit
>> ddef7ed2b5cbafae692d1d580bb5a07808926a9c ("annotate RWF_... flags")
>> which has been included in Linux v4.14 and newer. When building xfsprogs
> 
> /methinks you should upgrade your kernel, 4.14 is quite dead now, and
> you're not even running something /that/ new.

No disagreement here, we provide a toolchain whose kernel headers are 
intentional set to 4.9.x to maximize the compatibility with what our 
customers would be using at the time and that is how we caught that 
build failure. In general though, we should not be intentionally 
breaking the build against older kernel headers IMHO, especially when it 
is possible to do so.

The intent in the commit in the Fixes tag clearly had taken into account 
that RWF_ATOMIC might not have been defined.

> 
>> against older kernel headers, this type is not defined, leading to the
>> following build error:
>>
>> pwrite.c: In function 'pwrite_f':
>> ../include/xfs/linux.h:236:22: error: '__kernel_rwf_t' undeclared (first use in this function); did you mean '__kernel_off_t'?
>>   #define RWF_ATOMIC ((__kernel_rwf_t)0x00000040)
>>                        ^~~~~~~~~~~~~~
>> pwrite.c:329:22: note: in expansion of macro 'RWF_ATOMIC'
>>      pwritev2_flags |= RWF_ATOMIC;
>>
>> Fixes: ee6c5941352a ("xfs_io: add RWF_ATOMIC support to pwrite")
>> Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
> 
> That said, if this doesn't break anything with a ~2020s distro then I
> don't have any objections to this, so:
> 
> Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>

Thanks, any chance this can be applied?
-- 
Florian

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-01-07 19:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-25 22:26 [PATCH] xfs_io: Avoid using __kernel_rwf_t for older kernels Florian Fainelli
2024-11-26  1:22 ` Darrick J. Wong
2024-11-26  1:29   ` Florian Fainelli
2025-01-07 19:13   ` Florian Fainelli
2024-11-26  4:53 ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox