[PATCH] misc: Add support for Linux uio.h RWF_DONTCACHE flag

Adhemerval Zanella Netto adhemerval.zanella@linaro.org
Sat Sep 6 20:35:28 GMT 2025



On 28/08/25 02:56, Xi Ruoyao wrote:
> Linux 6.14 adds the new flag for uncached buffered IO on a filesystem
> supporting it.
> 
> This caused two test failures as these tests expected the flag
> 0x00000080 is unused.  Add the flag definition to fix these tests on
> Linux >= 6.14:
> 
>     FAIL: misc/tst-preadvwritev2
>     FAIL: misc/tst-preadvwritev64v2
> 
> The test failures were not detected in routine test suite runs because
> normally we create the test file in /tmp, where a tmpfs is usually
> mounted, and tmpfs does not support this flag.  But it can be reproduced
> with TMPDIR set to some directory in an ext4 file system.
> 
> Link: https://git.kernel.org/torvalds/c/af6505e5745b
> Signed-off-by: Xi Ruoyao <xry111@xry111.site>
> ---
> 
> Tested on x86_64 and loongarch64.

LGTM, thanks.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>

> 
>  manual/llio.texi                       | 4 ++++
>  misc/tst-preadvwritev2-common.c        | 6 +++++-
>  sysdeps/unix/sysv/linux/bits/uio-ext.h | 1 +
>  3 files changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/manual/llio.texi b/manual/llio.texi
> index e7fd6ca0e9..806ff0a27d 100644
> --- a/manual/llio.texi
> +++ b/manual/llio.texi
> @@ -1414,6 +1414,10 @@ naturally-aligned with regard to total write length.
>  The @code{atomic_*} values can be obtained with @code{statx} along with
>  @code{STATX_WRITE_ATOMIC} flag.
>  
> +@item RWF_DONTCACHE
> +Use uncached buffered IO.  If the file system does not support it, the
> +call will fail and set @code{errno} to @code{EOPNOTSUPP}.
> +
>  This is a Linux-specific extension.
>  @end vtable
>  
> diff --git a/misc/tst-preadvwritev2-common.c b/misc/tst-preadvwritev2-common.c
> index ff1007d6d2..8a59ff2f9d 100644
> --- a/misc/tst-preadvwritev2-common.c
> +++ b/misc/tst-preadvwritev2-common.c
> @@ -40,8 +40,12 @@
>  #ifndef RWF_ATOMIC
>  # define RWF_ATOMIC 0
>  #endif
> +#ifndef RWF_DONTCACHE
> +# define RWF_DONTCACHE 0
> +#endif
>  #define RWF_SUPPORTED	(RWF_HIPRI | RWF_DSYNC | RWF_SYNC | RWF_NOWAIT \
> -			 | RWF_APPEND | RWF_NOAPPEND | RWF_ATOMIC)
> +			 | RWF_APPEND | RWF_NOAPPEND | RWF_ATOMIC \
> +			 | RWF_DONTCACHE)
>  
>  /* Generic uio_lim.h does not define IOV_MAX.  */
>  #ifndef IOV_MAX
> diff --git a/sysdeps/unix/sysv/linux/bits/uio-ext.h b/sysdeps/unix/sysv/linux/bits/uio-ext.h
> index 040cb8dd48..1b7ab4b495 100644
> --- a/sysdeps/unix/sysv/linux/bits/uio-ext.h
> +++ b/sysdeps/unix/sysv/linux/bits/uio-ext.h
> @@ -50,6 +50,7 @@ extern ssize_t process_vm_writev (pid_t __pid, const struct iovec *__lvec,
>  #define RWF_NOAPPEND	0x00000020 /* per-IO negation of O_APPEND */
>  #define RWF_ATOMIC	0x00000040 /* Write is to be issued with torn-write
>  				      prevention.  */
> +#define RWF_DONTCACHE	0x00000080 /* Uncached buffered IO.  */
>  
>  __END_DECLS
>  



More information about the Libc-alpha mailing list