xfs_io: Avoid using __kernel_rwf_t for older kernels
PATCH 1/1 xfs_io: Avoid using __kernel_rwf_t for older kernels
__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;--- include/linux.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux.h +1 -1
@@ -233,7 +233,7 @@ struct fsxattr {/* Atomic Write */ #ifndef RWF_ATOMIC -#define RWF_ATOMIC ((__kernel_rwf_t)0x00000040) +#define RWF_ATOMIC (0x00000040)#endif /*
Signature · 1 line
2.34.1
Quoted 3 lines · Florian Fainelli
__kernel_rwf_twas defined with upstream Linux commitddef7ed2b5cbafae692d1d580bb5a07808926a9c("annotateRWF_... 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.
Quoted 5 lines
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'?
Quoted 7 lines
#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 <[email protected]>
That said, if this doesn't break anything with a ~2020s distro then I don't have any objections to this, so:
--D
Quoted 21 lines
--- include/linux.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)include/linux.h +1
-1@@ -233,7 +233,7 @@ struct fsxattr {/* Atomic Write */ #ifndef RWF_ATOMIC -#define RWF_ATOMIC ((__kernel_rwf_t)0x00000040) +#define RWF_ATOMIC (0x00000040)#endif /* Signature · 1 line
2.34.1
Quoted 7 lines · Darrick J. Wong
Quoted 3 lines · Florian Fainelli
__kernel_rwf_twas defined with upstream Linux commitddef7ed2b5cbafae692d1d580bb5a07808926a9c("annotateRWF_... 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.
Quoted 11 lines
Quoted 11 lines
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;
Quoted 7 lines
Quoted 2 lines
Fixes ee6c5941352a ("xfs_io: add RWF_ATOMIC support to pwrite")Signed-off-by Florian Fainelli <[email protected]>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" <[email protected]>
Thanks!
Signature · 1 line
Florian
Quoted 7 lines · Darrick J. Wong
Quoted 3 lines · Florian Fainelli
__kernel_rwf_twas defined with upstream Linux commitddef7ed2b5cbafae692d1d580bb5a07808926a9c("annotateRWF_... 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.
Quoted 11 lines
Quoted 11 lines
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;
Quoted 7 lines
Quoted 2 lines
Fixes ee6c5941352a ("xfs_io: add RWF_ATOMIC support to pwrite")Signed-off-by Florian Fainelli <[email protected]>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" <[email protected]>
Thanks, any chance this can be applied?
Signature · 1 line
Florian
Quoted 5 lines · Florian Fainelli
__kernel_rwf_twas defined with upstream Linux commitddef7ed2b5cbafae692d1d580bb5a07808926a9c("annotateRWF_... 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:
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..