* [PATCH 1/5] statx.h: update to latest kernel UAPI
2024-08-13 7:34 improve minalign handling Christoph Hellwig
@ 2024-08-13 7:35 ` Christoph Hellwig
2024-08-13 14:37 ` Darrick J. Wong
0 siblings, 1 reply; 17+ messages in thread
From: Christoph Hellwig @ 2024-08-13 7:35 UTC (permalink / raw)
To: Zorro Lang; +Cc: Darrick J. Wong, fstests, linux-xfs
Update the localy provided statx definition to the latest kernel UAPI,
and use it unconditionally instead only if no kernel version is provided.
This allows using more recent additions than provided in the system
headers.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
src/statx.h | 32 ++++++++++++++++++++++++++------
1 file changed, 26 insertions(+), 6 deletions(-)
diff --git a/src/statx.h b/src/statx.h
index 3f239d791..ab29fe22d 100644
--- a/src/statx.h
+++ b/src/statx.h
@@ -28,8 +28,6 @@
# endif
#endif
-#ifndef STATX_TYPE
-
/*
* Timestamp structure for the timestamps in struct statx.
*
@@ -44,6 +42,7 @@
*
* __reserved is held in case we need a yet finer resolution.
*/
+#define statx_timestamp statx_timestamp_fstests
struct statx_timestamp {
__s64 tv_sec;
__s32 tv_nsec;
@@ -87,6 +86,7 @@ struct statx_timestamp {
* will have values installed for compatibility purposes so that stat() and
* co. can be emulated in userspace.
*/
+#define statx statx_fstests
struct statx {
/* 0x00 */
__u32 stx_mask; /* What results were written [uncond] */
@@ -102,7 +102,8 @@ struct statx {
__u64 stx_ino; /* Inode number */
__u64 stx_size; /* File size */
__u64 stx_blocks; /* Number of 512-byte blocks allocated */
- __u64 __spare1[1];
+ __u64 stx_attributes_mask; /* Mask to show what's supported in stx_attributes */
+
/* 0x40 */
struct statx_timestamp stx_atime; /* Last access time */
struct statx_timestamp stx_btime; /* File creation time */
@@ -114,7 +115,18 @@ struct statx {
__u32 stx_dev_major; /* ID of device containing file [uncond] */
__u32 stx_dev_minor;
/* 0x90 */
- __u64 __spare2[14]; /* Spare space for future expansion */
+ __u64 stx_mnt_id;
+ __u32 stx_dio_mem_align; /* Memory buffer alignment for direct I/O */
+ __u32 stx_dio_offset_align; /* File offset alignment for direct I/O */
+ /* 0xa0 */
+ __u64 stx_subvol; /* Subvolume identifier */
+ __u32 stx_atomic_write_unit_min; /* Min atomic write unit in bytes */
+ __u32 stx_atomic_write_unit_max; /* Max atomic write unit in bytes */
+ /* 0xb0 */
+ __u32 stx_atomic_write_segments_max; /* Max atomic write segment count */
+ __u32 __spare1[1];
+ /* 0xb8 */
+ __u64 __spare3[9]; /* Spare space for future expansion */
/* 0x100 */
};
@@ -139,6 +151,12 @@ struct statx {
#define STATX_BLOCKS 0x00000400U /* Want/got stx_blocks */
#define STATX_BASIC_STATS 0x000007ffU /* The stuff in the normal stat struct */
#define STATX_BTIME 0x00000800U /* Want/got stx_btime */
+#define STATX_MNT_ID 0x00001000U /* Got stx_mnt_id */
+#define STATX_DIOALIGN 0x00002000U /* Want/got direct I/O alignment info */
+#define STATX_MNT_ID_UNIQUE 0x00004000U /* Want/got extended stx_mount_id */
+#define STATX_SUBVOL 0x00008000U /* Want/got stx_subvol */
+#define STATX_WRITE_ATOMIC 0x00010000U /* Want/got atomic_write_* fields */
+
#define STATX_ALL 0x00000fffU /* All currently supported flags */
/*
@@ -157,9 +175,11 @@ struct statx {
#define STATX_ATTR_APPEND 0x00000020 /* [I] File is append-only */
#define STATX_ATTR_NODUMP 0x00000040 /* [I] File is not to be dumped */
#define STATX_ATTR_ENCRYPTED 0x00000800 /* [I] File requires key to decrypt in fs */
-
#define STATX_ATTR_AUTOMOUNT 0x00001000 /* Dir: Automount trigger */
-#endif /* STATX_TYPE */
+#define STATX_ATTR_MOUNT_ROOT 0x00002000 /* Root of a mount */
+#define STATX_ATTR_VERITY 0x00100000 /* [I] Verity protected file */
+#define STATX_ATTR_DAX 0x00200000 /* File is currently in DAX state */
+#define STATX_ATTR_WRITE_ATOMIC 0x00400000 /* File supports atomic write operations */
static inline
int xfstests_statx(int dfd, const char *filename, unsigned flags,
--
2.43.0
^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [PATCH 1/5] statx.h: update to latest kernel UAPI
2024-08-13 7:35 ` [PATCH 1/5] statx.h: update to latest kernel UAPI Christoph Hellwig
@ 2024-08-13 14:37 ` Darrick J. Wong
2024-08-13 14:54 ` Christoph Hellwig
0 siblings, 1 reply; 17+ messages in thread
From: Darrick J. Wong @ 2024-08-13 14:37 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: Zorro Lang, fstests, linux-xfs
On Tue, Aug 13, 2024 at 09:35:00AM +0200, Christoph Hellwig wrote:
> Update the localy provided statx definition to the latest kernel UAPI,
> and use it unconditionally instead only if no kernel version is provided.
>
> This allows using more recent additions than provided in the system
> headers.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
> src/statx.h | 32 ++++++++++++++++++++++++++------
> 1 file changed, 26 insertions(+), 6 deletions(-)
>
> diff --git a/src/statx.h b/src/statx.h
> index 3f239d791..ab29fe22d 100644
> --- a/src/statx.h
> +++ b/src/statx.h
> @@ -28,8 +28,6 @@
> # endif
> #endif
>
> -#ifndef STATX_TYPE
> -
> /*
> * Timestamp structure for the timestamps in struct statx.
> *
> @@ -44,6 +42,7 @@
> *
> * __reserved is held in case we need a yet finer resolution.
> */
> +#define statx_timestamp statx_timestamp_fstests
Might want to put these #defines at the top with a comment so that
future people copy-pastaing too fast (i.e. me) don't obliterate them
accidentally.
/*
* Use a fstests-specific name for these structures so we can always
* find the latest version of the abi.
*/
#define statx_timestamp statx_timestamp_fstests
#define statx statx_fstests
[all the statx.h stuff here]
Otherwise looks fine to me.
--D
> struct statx_timestamp {
> __s64 tv_sec;
> __s32 tv_nsec;
> @@ -87,6 +86,7 @@ struct statx_timestamp {
> * will have values installed for compatibility purposes so that stat() and
> * co. can be emulated in userspace.
> */
> +#define statx statx_fstests
> struct statx {
> /* 0x00 */
> __u32 stx_mask; /* What results were written [uncond] */
> @@ -102,7 +102,8 @@ struct statx {
> __u64 stx_ino; /* Inode number */
> __u64 stx_size; /* File size */
> __u64 stx_blocks; /* Number of 512-byte blocks allocated */
> - __u64 __spare1[1];
> + __u64 stx_attributes_mask; /* Mask to show what's supported in stx_attributes */
> +
> /* 0x40 */
> struct statx_timestamp stx_atime; /* Last access time */
> struct statx_timestamp stx_btime; /* File creation time */
> @@ -114,7 +115,18 @@ struct statx {
> __u32 stx_dev_major; /* ID of device containing file [uncond] */
> __u32 stx_dev_minor;
> /* 0x90 */
> - __u64 __spare2[14]; /* Spare space for future expansion */
> + __u64 stx_mnt_id;
> + __u32 stx_dio_mem_align; /* Memory buffer alignment for direct I/O */
> + __u32 stx_dio_offset_align; /* File offset alignment for direct I/O */
> + /* 0xa0 */
> + __u64 stx_subvol; /* Subvolume identifier */
> + __u32 stx_atomic_write_unit_min; /* Min atomic write unit in bytes */
> + __u32 stx_atomic_write_unit_max; /* Max atomic write unit in bytes */
> + /* 0xb0 */
> + __u32 stx_atomic_write_segments_max; /* Max atomic write segment count */
> + __u32 __spare1[1];
> + /* 0xb8 */
> + __u64 __spare3[9]; /* Spare space for future expansion */
> /* 0x100 */
> };
>
> @@ -139,6 +151,12 @@ struct statx {
> #define STATX_BLOCKS 0x00000400U /* Want/got stx_blocks */
> #define STATX_BASIC_STATS 0x000007ffU /* The stuff in the normal stat struct */
> #define STATX_BTIME 0x00000800U /* Want/got stx_btime */
> +#define STATX_MNT_ID 0x00001000U /* Got stx_mnt_id */
> +#define STATX_DIOALIGN 0x00002000U /* Want/got direct I/O alignment info */
> +#define STATX_MNT_ID_UNIQUE 0x00004000U /* Want/got extended stx_mount_id */
> +#define STATX_SUBVOL 0x00008000U /* Want/got stx_subvol */
> +#define STATX_WRITE_ATOMIC 0x00010000U /* Want/got atomic_write_* fields */
> +
> #define STATX_ALL 0x00000fffU /* All currently supported flags */
>
> /*
> @@ -157,9 +175,11 @@ struct statx {
> #define STATX_ATTR_APPEND 0x00000020 /* [I] File is append-only */
> #define STATX_ATTR_NODUMP 0x00000040 /* [I] File is not to be dumped */
> #define STATX_ATTR_ENCRYPTED 0x00000800 /* [I] File requires key to decrypt in fs */
> -
> #define STATX_ATTR_AUTOMOUNT 0x00001000 /* Dir: Automount trigger */
> -#endif /* STATX_TYPE */
> +#define STATX_ATTR_MOUNT_ROOT 0x00002000 /* Root of a mount */
> +#define STATX_ATTR_VERITY 0x00100000 /* [I] Verity protected file */
> +#define STATX_ATTR_DAX 0x00200000 /* File is currently in DAX state */
> +#define STATX_ATTR_WRITE_ATOMIC 0x00400000 /* File supports atomic write operations */
>
> static inline
> int xfstests_statx(int dfd, const char *filename, unsigned flags,
> --
> 2.43.0
>
>
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 1/5] statx.h: update to latest kernel UAPI
2024-08-13 14:37 ` Darrick J. Wong
@ 2024-08-13 14:54 ` Christoph Hellwig
0 siblings, 0 replies; 17+ messages in thread
From: Christoph Hellwig @ 2024-08-13 14:54 UTC (permalink / raw)
To: Darrick J. Wong; +Cc: Christoph Hellwig, Zorro Lang, fstests, linux-xfs
On Tue, Aug 13, 2024 at 07:37:15AM -0700, Darrick J. Wong wrote:
> Might want to put these #defines at the top with a comment so that
> future people copy-pastaing too fast (i.e. me) don't obliterate them
> accidentally.
Sure.
> /*
> * Use a fstests-specific name for these structures so we can always
> * find the latest version of the abi.
> */
> #define statx_timestamp statx_timestamp_fstests
> #define statx statx_fstests
The comment might need a bit twiddling as we're not really using
different name we're just avoiding the conflict, but I'll see if
I can come up with a coherent enough explanation.
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 1/5] statx.h: update to latest kernel UAPI
2024-08-14 4:52 improve minalign handling v2 Christoph Hellwig
@ 2024-08-14 4:52 ` Christoph Hellwig
2024-08-14 5:12 ` Darrick J. Wong
0 siblings, 1 reply; 17+ messages in thread
From: Christoph Hellwig @ 2024-08-14 4:52 UTC (permalink / raw)
To: Zorro Lang; +Cc: Darrick J. Wong, fstests, linux-xfs
Update the localy provided statx definition to the latest kernel UAPI,
and use it unconditionally instead only if no kernel version is provided.
This allows using more recent additions than provided in the system
headers.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
src/statx.h | 38 ++++++++++++++++++++++++++++++++------
1 file changed, 32 insertions(+), 6 deletions(-)
diff --git a/src/statx.h b/src/statx.h
index 3f239d791..bae1c86f6 100644
--- a/src/statx.h
+++ b/src/statx.h
@@ -5,6 +5,14 @@
#include <sys/syscall.h>
#include <linux/types.h>
+/*
+ * Swizzle the symbol namespace so that we can provide our own version
+ * overriding the system one that might now have all the latest fields
+ * under the standard names even when <sys/stat.h> is included.
+ */
+#define statx_timestamp statx_timestamp_fstests
+#define statx statx_fstests
+
#ifndef AT_STATX_SYNC_TYPE
#define AT_STATX_SYNC_TYPE 0x6000 /* Type of synchronisation required from statx() */
#define AT_STATX_SYNC_AS_STAT 0x0000 /* - Do whatever stat() does */
@@ -28,8 +36,6 @@
# endif
#endif
-#ifndef STATX_TYPE
-
/*
* Timestamp structure for the timestamps in struct statx.
*
@@ -102,7 +108,8 @@ struct statx {
__u64 stx_ino; /* Inode number */
__u64 stx_size; /* File size */
__u64 stx_blocks; /* Number of 512-byte blocks allocated */
- __u64 __spare1[1];
+ __u64 stx_attributes_mask; /* Mask to show what's supported in stx_attributes */
+
/* 0x40 */
struct statx_timestamp stx_atime; /* Last access time */
struct statx_timestamp stx_btime; /* File creation time */
@@ -114,7 +121,18 @@ struct statx {
__u32 stx_dev_major; /* ID of device containing file [uncond] */
__u32 stx_dev_minor;
/* 0x90 */
- __u64 __spare2[14]; /* Spare space for future expansion */
+ __u64 stx_mnt_id;
+ __u32 stx_dio_mem_align; /* Memory buffer alignment for direct I/O */
+ __u32 stx_dio_offset_align; /* File offset alignment for direct I/O */
+ /* 0xa0 */
+ __u64 stx_subvol; /* Subvolume identifier */
+ __u32 stx_atomic_write_unit_min; /* Min atomic write unit in bytes */
+ __u32 stx_atomic_write_unit_max; /* Max atomic write unit in bytes */
+ /* 0xb0 */
+ __u32 stx_atomic_write_segments_max; /* Max atomic write segment count */
+ __u32 __spare1[1];
+ /* 0xb8 */
+ __u64 __spare3[9]; /* Spare space for future expansion */
/* 0x100 */
};
@@ -139,6 +157,12 @@ struct statx {
#define STATX_BLOCKS 0x00000400U /* Want/got stx_blocks */
#define STATX_BASIC_STATS 0x000007ffU /* The stuff in the normal stat struct */
#define STATX_BTIME 0x00000800U /* Want/got stx_btime */
+#define STATX_MNT_ID 0x00001000U /* Got stx_mnt_id */
+#define STATX_DIOALIGN 0x00002000U /* Want/got direct I/O alignment info */
+#define STATX_MNT_ID_UNIQUE 0x00004000U /* Want/got extended stx_mount_id */
+#define STATX_SUBVOL 0x00008000U /* Want/got stx_subvol */
+#define STATX_WRITE_ATOMIC 0x00010000U /* Want/got atomic_write_* fields */
+
#define STATX_ALL 0x00000fffU /* All currently supported flags */
/*
@@ -157,9 +181,11 @@ struct statx {
#define STATX_ATTR_APPEND 0x00000020 /* [I] File is append-only */
#define STATX_ATTR_NODUMP 0x00000040 /* [I] File is not to be dumped */
#define STATX_ATTR_ENCRYPTED 0x00000800 /* [I] File requires key to decrypt in fs */
-
#define STATX_ATTR_AUTOMOUNT 0x00001000 /* Dir: Automount trigger */
-#endif /* STATX_TYPE */
+#define STATX_ATTR_MOUNT_ROOT 0x00002000 /* Root of a mount */
+#define STATX_ATTR_VERITY 0x00100000 /* [I] Verity protected file */
+#define STATX_ATTR_DAX 0x00200000 /* File is currently in DAX state */
+#define STATX_ATTR_WRITE_ATOMIC 0x00400000 /* File supports atomic write operations */
static inline
int xfstests_statx(int dfd, const char *filename, unsigned flags,
--
2.43.0
^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [PATCH 1/5] statx.h: update to latest kernel UAPI
2024-08-14 4:52 ` [PATCH 1/5] statx.h: update to latest kernel UAPI Christoph Hellwig
@ 2024-08-14 5:12 ` Darrick J. Wong
0 siblings, 0 replies; 17+ messages in thread
From: Darrick J. Wong @ 2024-08-14 5:12 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: Zorro Lang, fstests, linux-xfs
On Wed, Aug 14, 2024 at 06:52:10AM +0200, Christoph Hellwig wrote:
> Update the localy provided statx definition to the latest kernel UAPI,
> and use it unconditionally instead only if no kernel version is provided.
>
> This allows using more recent additions than provided in the system
> headers.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
Looks good to me,
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
--D
> ---
> src/statx.h | 38 ++++++++++++++++++++++++++++++++------
> 1 file changed, 32 insertions(+), 6 deletions(-)
>
> diff --git a/src/statx.h b/src/statx.h
> index 3f239d791..bae1c86f6 100644
> --- a/src/statx.h
> +++ b/src/statx.h
> @@ -5,6 +5,14 @@
> #include <sys/syscall.h>
> #include <linux/types.h>
>
> +/*
> + * Swizzle the symbol namespace so that we can provide our own version
> + * overriding the system one that might now have all the latest fields
> + * under the standard names even when <sys/stat.h> is included.
> + */
> +#define statx_timestamp statx_timestamp_fstests
> +#define statx statx_fstests
> +
> #ifndef AT_STATX_SYNC_TYPE
> #define AT_STATX_SYNC_TYPE 0x6000 /* Type of synchronisation required from statx() */
> #define AT_STATX_SYNC_AS_STAT 0x0000 /* - Do whatever stat() does */
> @@ -28,8 +36,6 @@
> # endif
> #endif
>
> -#ifndef STATX_TYPE
> -
> /*
> * Timestamp structure for the timestamps in struct statx.
> *
> @@ -102,7 +108,8 @@ struct statx {
> __u64 stx_ino; /* Inode number */
> __u64 stx_size; /* File size */
> __u64 stx_blocks; /* Number of 512-byte blocks allocated */
> - __u64 __spare1[1];
> + __u64 stx_attributes_mask; /* Mask to show what's supported in stx_attributes */
> +
> /* 0x40 */
> struct statx_timestamp stx_atime; /* Last access time */
> struct statx_timestamp stx_btime; /* File creation time */
> @@ -114,7 +121,18 @@ struct statx {
> __u32 stx_dev_major; /* ID of device containing file [uncond] */
> __u32 stx_dev_minor;
> /* 0x90 */
> - __u64 __spare2[14]; /* Spare space for future expansion */
> + __u64 stx_mnt_id;
> + __u32 stx_dio_mem_align; /* Memory buffer alignment for direct I/O */
> + __u32 stx_dio_offset_align; /* File offset alignment for direct I/O */
> + /* 0xa0 */
> + __u64 stx_subvol; /* Subvolume identifier */
> + __u32 stx_atomic_write_unit_min; /* Min atomic write unit in bytes */
> + __u32 stx_atomic_write_unit_max; /* Max atomic write unit in bytes */
> + /* 0xb0 */
> + __u32 stx_atomic_write_segments_max; /* Max atomic write segment count */
> + __u32 __spare1[1];
> + /* 0xb8 */
> + __u64 __spare3[9]; /* Spare space for future expansion */
> /* 0x100 */
> };
>
> @@ -139,6 +157,12 @@ struct statx {
> #define STATX_BLOCKS 0x00000400U /* Want/got stx_blocks */
> #define STATX_BASIC_STATS 0x000007ffU /* The stuff in the normal stat struct */
> #define STATX_BTIME 0x00000800U /* Want/got stx_btime */
> +#define STATX_MNT_ID 0x00001000U /* Got stx_mnt_id */
> +#define STATX_DIOALIGN 0x00002000U /* Want/got direct I/O alignment info */
> +#define STATX_MNT_ID_UNIQUE 0x00004000U /* Want/got extended stx_mount_id */
> +#define STATX_SUBVOL 0x00008000U /* Want/got stx_subvol */
> +#define STATX_WRITE_ATOMIC 0x00010000U /* Want/got atomic_write_* fields */
> +
> #define STATX_ALL 0x00000fffU /* All currently supported flags */
>
> /*
> @@ -157,9 +181,11 @@ struct statx {
> #define STATX_ATTR_APPEND 0x00000020 /* [I] File is append-only */
> #define STATX_ATTR_NODUMP 0x00000040 /* [I] File is not to be dumped */
> #define STATX_ATTR_ENCRYPTED 0x00000800 /* [I] File requires key to decrypt in fs */
> -
> #define STATX_ATTR_AUTOMOUNT 0x00001000 /* Dir: Automount trigger */
> -#endif /* STATX_TYPE */
> +#define STATX_ATTR_MOUNT_ROOT 0x00002000 /* Root of a mount */
> +#define STATX_ATTR_VERITY 0x00100000 /* [I] Verity protected file */
> +#define STATX_ATTR_DAX 0x00200000 /* File is currently in DAX state */
> +#define STATX_ATTR_WRITE_ATOMIC 0x00400000 /* File supports atomic write operations */
>
> static inline
> int xfstests_statx(int dfd, const char *filename, unsigned flags,
> --
> 2.43.0
>
>
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 1/5] statx.h: update to latest kernel UAPI
2026-08-31 6:51 actually exercise sub-block direct I/O reads Christoph Hellwig
@ 2026-08-31 6:51 ` Christoph Hellwig
2026-08-31 17:12 ` Darrick J. Wong
2026-09-02 15:31 ` Zorro Lang
0 siblings, 2 replies; 17+ messages in thread
From: Christoph Hellwig @ 2026-08-31 6:51 UTC (permalink / raw)
To: Zorro Lang; +Cc: fstests
Update the localy provided statx definition to the kernel UAPI as of
7.3-rc1.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
src/statx.h | 126 +++++++++++++++++++++++++++++++++++++++-------------
1 file changed, 96 insertions(+), 30 deletions(-)
diff --git a/src/statx.h b/src/statx.h
index bae1c86f6201..0a27bf030b1d 100644
--- a/src/statx.h
+++ b/src/statx.h
@@ -95,44 +95,97 @@ struct statx_timestamp {
*/
struct statx {
/* 0x00 */
- __u32 stx_mask; /* What results were written [uncond] */
- __u32 stx_blksize; /* Preferred general I/O size [uncond] */
- __u64 stx_attributes; /* Flags conveying information about the file [uncond] */
+ /* What results were written [uncond] */
+ __u32 stx_mask;
+
+ /* Preferred general I/O size [uncond] */
+ __u32 stx_blksize;
+
+ /* Flags conveying information about the file [uncond] */
+ __u64 stx_attributes;
+
/* 0x10 */
- __u32 stx_nlink; /* Number of hard links */
- __u32 stx_uid; /* User ID of owner */
- __u32 stx_gid; /* Group ID of owner */
- __u16 stx_mode; /* File mode */
+ /* Number of hard links */
+ __u32 stx_nlink;
+
+ /* User ID of owner */
+ __u32 stx_uid;
+
+ /* Group ID of owner */
+ __u32 stx_gid;
+
+ /* File mode */
+ __u16 stx_mode;
__u16 __spare0[1];
+
/* 0x20 */
- __u64 stx_ino; /* Inode number */
- __u64 stx_size; /* File size */
- __u64 stx_blocks; /* Number of 512-byte blocks allocated */
- __u64 stx_attributes_mask; /* Mask to show what's supported in stx_attributes */
+ /* Inode number */
+ __u64 stx_ino;
+
+ /* File size */
+ __u64 stx_size;
+
+ /* Number of 512-byte blocks allocated */
+ __u64 stx_blocks;
+
+ /* Mask to show what's supported in stx_attributes */
+ __u64 stx_attributes_mask;
/* 0x40 */
- struct statx_timestamp stx_atime; /* Last access time */
- struct statx_timestamp stx_btime; /* File creation time */
- struct statx_timestamp stx_ctime; /* Last attribute change time */
- struct statx_timestamp stx_mtime; /* Last data modification time */
+ /* Last access time */
+ struct statx_timestamp stx_atime;
+
+ /* File creation time */
+ struct statx_timestamp stx_btime;
+
+ /* Last attribute change time */
+ struct statx_timestamp stx_ctime;
+
+ /* Last data modification time */
+ struct statx_timestamp stx_mtime;
+
/* 0x80 */
- __u32 stx_rdev_major; /* Device ID of special file [if bdev/cdev] */
+ /* Device ID of special file [if bdev/cdev] */
+ __u32 stx_rdev_major;
__u32 stx_rdev_minor;
- __u32 stx_dev_major; /* ID of device containing file [uncond] */
+
+ /* ID of device containing file [uncond] */
+ __u32 stx_dev_major;
__u32 stx_dev_minor;
+
/* 0x90 */
__u64 stx_mnt_id;
- __u32 stx_dio_mem_align; /* Memory buffer alignment for direct I/O */
- __u32 stx_dio_offset_align; /* File offset alignment for direct I/O */
+
+ /* Memory buffer alignment for direct I/O */
+ __u32 stx_dio_mem_align;
+
+ /* File offset alignment for direct I/O */
+ __u32 stx_dio_offset_align;
+
/* 0xa0 */
- __u64 stx_subvol; /* Subvolume identifier */
- __u32 stx_atomic_write_unit_min; /* Min atomic write unit in bytes */
- __u32 stx_atomic_write_unit_max; /* Max atomic write unit in bytes */
+ /* Subvolume identifier */
+ __u64 stx_subvol;
+
+ /* Min atomic write unit in bytes */
+ __u32 stx_atomic_write_unit_min;
+
+ /* Max atomic write unit in bytes */
+ __u32 stx_atomic_write_unit_max;
+
/* 0xb0 */
- __u32 stx_atomic_write_segments_max; /* Max atomic write segment count */
- __u32 __spare1[1];
- /* 0xb8 */
- __u64 __spare3[9]; /* Spare space for future expansion */
+ /* Max atomic write segment count */
+ __u32 stx_atomic_write_segments_max;
+
+ /* File offset alignment for direct I/O reads */
+ __u32 stx_dio_read_offset_align;
+
+ /* Optimised max atomic write unit in bytes */
+ __u32 stx_atomic_write_unit_max_opt;
+ __u32 __spare2[1];
+
+ /* 0xc0 */
+ __u64 __spare3[8]; /* Spare space for future expansion */
+
/* 0x100 */
};
@@ -162,19 +215,32 @@ struct statx {
#define STATX_MNT_ID_UNIQUE 0x00004000U /* Want/got extended stx_mount_id */
#define STATX_SUBVOL 0x00008000U /* Want/got stx_subvol */
#define STATX_WRITE_ATOMIC 0x00010000U /* Want/got atomic_write_* fields */
+#define STATX_DIO_READ_ALIGN 0x00020000U /* Want/got dio read alignment info */
-#define STATX_ALL 0x00000fffU /* All currently supported flags */
+#define STATX__RESERVED 0x80000000U /* Reserved for future struct statx expansion */
+#ifndef __KERNEL__
/*
- * Attributes to be found in stx_attributes
+ * This is deprecated, and shall remain the same value in the future. To avoid
+ * confusion please use the equivalent (STATX_BASIC_STATS | STATX_BTIME)
+ * instead.
+ */
+#define STATX_ALL 0x00000fffU
+#endif
+
+/*
+ * Attributes to be found in stx_attributes and masked in stx_attributes_mask.
*
* These give information about the features or the state of a file that might
* be of use to ordinary userspace programs such as GUIs or ls rather than
* specialised tools.
*
- * Note that the flags marked [I] correspond to generic FS_IOC_FLAGS
+ * Note that the flags marked [I] correspond to the FS_IOC_SETFLAGS flags
* semantically. Where possible, the numerical value is picked to correspond
- * also.
+ * also. Note that the DAX attribute indicates that the file is in the CPU
+ * direct access state. It does not correspond to the per-inode flag that
+ * some filesystems support.
+ *
*/
#define STATX_ATTR_COMPRESSED 0x00000004 /* [I] File is compressed by the fs */
#define STATX_ATTR_IMMUTABLE 0x00000010 /* [I] File is marked immutable */
--
2.53.0
^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [PATCH 1/5] statx.h: update to latest kernel UAPI
2026-08-31 6:51 ` [PATCH 1/5] statx.h: update to latest kernel UAPI Christoph Hellwig
@ 2026-08-31 17:12 ` Darrick J. Wong
2026-09-02 15:31 ` Zorro Lang
1 sibling, 0 replies; 17+ messages in thread
From: Darrick J. Wong @ 2026-08-31 17:12 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: Zorro Lang, fstests
On Mon, Aug 31, 2026 at 09:51:04AM +0300, Christoph Hellwig wrote:
> Update the localy provided statx definition to the kernel UAPI as of
> 7.3-rc1.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
Seems fine to me;
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
--D
> ---
> src/statx.h | 126 +++++++++++++++++++++++++++++++++++++++-------------
> 1 file changed, 96 insertions(+), 30 deletions(-)
>
> diff --git a/src/statx.h b/src/statx.h
> index bae1c86f6201..0a27bf030b1d 100644
> --- a/src/statx.h
> +++ b/src/statx.h
> @@ -95,44 +95,97 @@ struct statx_timestamp {
> */
> struct statx {
> /* 0x00 */
> - __u32 stx_mask; /* What results were written [uncond] */
> - __u32 stx_blksize; /* Preferred general I/O size [uncond] */
> - __u64 stx_attributes; /* Flags conveying information about the file [uncond] */
> + /* What results were written [uncond] */
> + __u32 stx_mask;
> +
> + /* Preferred general I/O size [uncond] */
> + __u32 stx_blksize;
> +
> + /* Flags conveying information about the file [uncond] */
> + __u64 stx_attributes;
> +
> /* 0x10 */
> - __u32 stx_nlink; /* Number of hard links */
> - __u32 stx_uid; /* User ID of owner */
> - __u32 stx_gid; /* Group ID of owner */
> - __u16 stx_mode; /* File mode */
> + /* Number of hard links */
> + __u32 stx_nlink;
> +
> + /* User ID of owner */
> + __u32 stx_uid;
> +
> + /* Group ID of owner */
> + __u32 stx_gid;
> +
> + /* File mode */
> + __u16 stx_mode;
> __u16 __spare0[1];
> +
> /* 0x20 */
> - __u64 stx_ino; /* Inode number */
> - __u64 stx_size; /* File size */
> - __u64 stx_blocks; /* Number of 512-byte blocks allocated */
> - __u64 stx_attributes_mask; /* Mask to show what's supported in stx_attributes */
> + /* Inode number */
> + __u64 stx_ino;
> +
> + /* File size */
> + __u64 stx_size;
> +
> + /* Number of 512-byte blocks allocated */
> + __u64 stx_blocks;
> +
> + /* Mask to show what's supported in stx_attributes */
> + __u64 stx_attributes_mask;
>
> /* 0x40 */
> - struct statx_timestamp stx_atime; /* Last access time */
> - struct statx_timestamp stx_btime; /* File creation time */
> - struct statx_timestamp stx_ctime; /* Last attribute change time */
> - struct statx_timestamp stx_mtime; /* Last data modification time */
> + /* Last access time */
> + struct statx_timestamp stx_atime;
> +
> + /* File creation time */
> + struct statx_timestamp stx_btime;
> +
> + /* Last attribute change time */
> + struct statx_timestamp stx_ctime;
> +
> + /* Last data modification time */
> + struct statx_timestamp stx_mtime;
> +
> /* 0x80 */
> - __u32 stx_rdev_major; /* Device ID of special file [if bdev/cdev] */
> + /* Device ID of special file [if bdev/cdev] */
> + __u32 stx_rdev_major;
> __u32 stx_rdev_minor;
> - __u32 stx_dev_major; /* ID of device containing file [uncond] */
> +
> + /* ID of device containing file [uncond] */
> + __u32 stx_dev_major;
> __u32 stx_dev_minor;
> +
> /* 0x90 */
> __u64 stx_mnt_id;
> - __u32 stx_dio_mem_align; /* Memory buffer alignment for direct I/O */
> - __u32 stx_dio_offset_align; /* File offset alignment for direct I/O */
> +
> + /* Memory buffer alignment for direct I/O */
> + __u32 stx_dio_mem_align;
> +
> + /* File offset alignment for direct I/O */
> + __u32 stx_dio_offset_align;
> +
> /* 0xa0 */
> - __u64 stx_subvol; /* Subvolume identifier */
> - __u32 stx_atomic_write_unit_min; /* Min atomic write unit in bytes */
> - __u32 stx_atomic_write_unit_max; /* Max atomic write unit in bytes */
> + /* Subvolume identifier */
> + __u64 stx_subvol;
> +
> + /* Min atomic write unit in bytes */
> + __u32 stx_atomic_write_unit_min;
> +
> + /* Max atomic write unit in bytes */
> + __u32 stx_atomic_write_unit_max;
> +
> /* 0xb0 */
> - __u32 stx_atomic_write_segments_max; /* Max atomic write segment count */
> - __u32 __spare1[1];
> - /* 0xb8 */
> - __u64 __spare3[9]; /* Spare space for future expansion */
> + /* Max atomic write segment count */
> + __u32 stx_atomic_write_segments_max;
> +
> + /* File offset alignment for direct I/O reads */
> + __u32 stx_dio_read_offset_align;
> +
> + /* Optimised max atomic write unit in bytes */
> + __u32 stx_atomic_write_unit_max_opt;
> + __u32 __spare2[1];
> +
> + /* 0xc0 */
> + __u64 __spare3[8]; /* Spare space for future expansion */
> +
> /* 0x100 */
> };
>
> @@ -162,19 +215,32 @@ struct statx {
> #define STATX_MNT_ID_UNIQUE 0x00004000U /* Want/got extended stx_mount_id */
> #define STATX_SUBVOL 0x00008000U /* Want/got stx_subvol */
> #define STATX_WRITE_ATOMIC 0x00010000U /* Want/got atomic_write_* fields */
> +#define STATX_DIO_READ_ALIGN 0x00020000U /* Want/got dio read alignment info */
>
> -#define STATX_ALL 0x00000fffU /* All currently supported flags */
> +#define STATX__RESERVED 0x80000000U /* Reserved for future struct statx expansion */
>
> +#ifndef __KERNEL__
> /*
> - * Attributes to be found in stx_attributes
> + * This is deprecated, and shall remain the same value in the future. To avoid
> + * confusion please use the equivalent (STATX_BASIC_STATS | STATX_BTIME)
> + * instead.
> + */
> +#define STATX_ALL 0x00000fffU
> +#endif
> +
> +/*
> + * Attributes to be found in stx_attributes and masked in stx_attributes_mask.
> *
> * These give information about the features or the state of a file that might
> * be of use to ordinary userspace programs such as GUIs or ls rather than
> * specialised tools.
> *
> - * Note that the flags marked [I] correspond to generic FS_IOC_FLAGS
> + * Note that the flags marked [I] correspond to the FS_IOC_SETFLAGS flags
> * semantically. Where possible, the numerical value is picked to correspond
> - * also.
> + * also. Note that the DAX attribute indicates that the file is in the CPU
> + * direct access state. It does not correspond to the per-inode flag that
> + * some filesystems support.
> + *
> */
> #define STATX_ATTR_COMPRESSED 0x00000004 /* [I] File is compressed by the fs */
> #define STATX_ATTR_IMMUTABLE 0x00000010 /* [I] File is marked immutable */
> --
> 2.53.0
>
>
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 1/5] statx.h: update to latest kernel UAPI
2026-08-31 6:51 ` [PATCH 1/5] statx.h: update to latest kernel UAPI Christoph Hellwig
2026-08-31 17:12 ` Darrick J. Wong
@ 2026-09-02 15:31 ` Zorro Lang
1 sibling, 0 replies; 17+ messages in thread
From: Zorro Lang @ 2026-09-02 15:31 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: fstests
On Mon, Aug 31, 2026 at 09:51:04AM +0300, Christoph Hellwig wrote:
> Update the localy provided statx definition to the kernel UAPI as of
This patch looks good to me, I'll change "localy" to "locally" when I
merge it. Thanks!
Reviewed-by: Zorro Lang <zlang@kernel.org>
> 7.3-rc1.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
> src/statx.h | 126 +++++++++++++++++++++++++++++++++++++++-------------
> 1 file changed, 96 insertions(+), 30 deletions(-)
>
> diff --git a/src/statx.h b/src/statx.h
> index bae1c86f6201..0a27bf030b1d 100644
> --- a/src/statx.h
> +++ b/src/statx.h
> @@ -95,44 +95,97 @@ struct statx_timestamp {
> */
> struct statx {
> /* 0x00 */
> - __u32 stx_mask; /* What results were written [uncond] */
> - __u32 stx_blksize; /* Preferred general I/O size [uncond] */
> - __u64 stx_attributes; /* Flags conveying information about the file [uncond] */
> + /* What results were written [uncond] */
> + __u32 stx_mask;
> +
> + /* Preferred general I/O size [uncond] */
> + __u32 stx_blksize;
> +
> + /* Flags conveying information about the file [uncond] */
> + __u64 stx_attributes;
> +
> /* 0x10 */
> - __u32 stx_nlink; /* Number of hard links */
> - __u32 stx_uid; /* User ID of owner */
> - __u32 stx_gid; /* Group ID of owner */
> - __u16 stx_mode; /* File mode */
> + /* Number of hard links */
> + __u32 stx_nlink;
> +
> + /* User ID of owner */
> + __u32 stx_uid;
> +
> + /* Group ID of owner */
> + __u32 stx_gid;
> +
> + /* File mode */
> + __u16 stx_mode;
> __u16 __spare0[1];
> +
> /* 0x20 */
> - __u64 stx_ino; /* Inode number */
> - __u64 stx_size; /* File size */
> - __u64 stx_blocks; /* Number of 512-byte blocks allocated */
> - __u64 stx_attributes_mask; /* Mask to show what's supported in stx_attributes */
> + /* Inode number */
> + __u64 stx_ino;
> +
> + /* File size */
> + __u64 stx_size;
> +
> + /* Number of 512-byte blocks allocated */
> + __u64 stx_blocks;
> +
> + /* Mask to show what's supported in stx_attributes */
> + __u64 stx_attributes_mask;
>
> /* 0x40 */
> - struct statx_timestamp stx_atime; /* Last access time */
> - struct statx_timestamp stx_btime; /* File creation time */
> - struct statx_timestamp stx_ctime; /* Last attribute change time */
> - struct statx_timestamp stx_mtime; /* Last data modification time */
> + /* Last access time */
> + struct statx_timestamp stx_atime;
> +
> + /* File creation time */
> + struct statx_timestamp stx_btime;
> +
> + /* Last attribute change time */
> + struct statx_timestamp stx_ctime;
> +
> + /* Last data modification time */
> + struct statx_timestamp stx_mtime;
> +
> /* 0x80 */
> - __u32 stx_rdev_major; /* Device ID of special file [if bdev/cdev] */
> + /* Device ID of special file [if bdev/cdev] */
> + __u32 stx_rdev_major;
> __u32 stx_rdev_minor;
> - __u32 stx_dev_major; /* ID of device containing file [uncond] */
> +
> + /* ID of device containing file [uncond] */
> + __u32 stx_dev_major;
> __u32 stx_dev_minor;
> +
> /* 0x90 */
> __u64 stx_mnt_id;
> - __u32 stx_dio_mem_align; /* Memory buffer alignment for direct I/O */
> - __u32 stx_dio_offset_align; /* File offset alignment for direct I/O */
> +
> + /* Memory buffer alignment for direct I/O */
> + __u32 stx_dio_mem_align;
> +
> + /* File offset alignment for direct I/O */
> + __u32 stx_dio_offset_align;
> +
> /* 0xa0 */
> - __u64 stx_subvol; /* Subvolume identifier */
> - __u32 stx_atomic_write_unit_min; /* Min atomic write unit in bytes */
> - __u32 stx_atomic_write_unit_max; /* Max atomic write unit in bytes */
> + /* Subvolume identifier */
> + __u64 stx_subvol;
> +
> + /* Min atomic write unit in bytes */
> + __u32 stx_atomic_write_unit_min;
> +
> + /* Max atomic write unit in bytes */
> + __u32 stx_atomic_write_unit_max;
> +
> /* 0xb0 */
> - __u32 stx_atomic_write_segments_max; /* Max atomic write segment count */
> - __u32 __spare1[1];
> - /* 0xb8 */
> - __u64 __spare3[9]; /* Spare space for future expansion */
> + /* Max atomic write segment count */
> + __u32 stx_atomic_write_segments_max;
> +
> + /* File offset alignment for direct I/O reads */
> + __u32 stx_dio_read_offset_align;
> +
> + /* Optimised max atomic write unit in bytes */
> + __u32 stx_atomic_write_unit_max_opt;
> + __u32 __spare2[1];
> +
> + /* 0xc0 */
> + __u64 __spare3[8]; /* Spare space for future expansion */
> +
> /* 0x100 */
> };
>
> @@ -162,19 +215,32 @@ struct statx {
> #define STATX_MNT_ID_UNIQUE 0x00004000U /* Want/got extended stx_mount_id */
> #define STATX_SUBVOL 0x00008000U /* Want/got stx_subvol */
> #define STATX_WRITE_ATOMIC 0x00010000U /* Want/got atomic_write_* fields */
> +#define STATX_DIO_READ_ALIGN 0x00020000U /* Want/got dio read alignment info */
>
> -#define STATX_ALL 0x00000fffU /* All currently supported flags */
> +#define STATX__RESERVED 0x80000000U /* Reserved for future struct statx expansion */
>
> +#ifndef __KERNEL__
> /*
> - * Attributes to be found in stx_attributes
> + * This is deprecated, and shall remain the same value in the future. To avoid
> + * confusion please use the equivalent (STATX_BASIC_STATS | STATX_BTIME)
> + * instead.
> + */
> +#define STATX_ALL 0x00000fffU
> +#endif
> +
> +/*
> + * Attributes to be found in stx_attributes and masked in stx_attributes_mask.
> *
> * These give information about the features or the state of a file that might
> * be of use to ordinary userspace programs such as GUIs or ls rather than
> * specialised tools.
> *
> - * Note that the flags marked [I] correspond to generic FS_IOC_FLAGS
> + * Note that the flags marked [I] correspond to the FS_IOC_SETFLAGS flags
> * semantically. Where possible, the numerical value is picked to correspond
> - * also.
> + * also. Note that the DAX attribute indicates that the file is in the CPU
> + * direct access state. It does not correspond to the per-inode flag that
> + * some filesystems support.
> + *
> */
> #define STATX_ATTR_COMPRESSED 0x00000004 /* [I] File is compressed by the fs */
> #define STATX_ATTR_IMMUTABLE 0x00000010 /* [I] File is marked immutable */
> --
> 2.53.0
>
^ permalink raw reply [flat|nested] 17+ messages in thread
* actually exercise sub-block direct I/O reads v2
@ 2026-09-14 11:45 Christoph Hellwig
2026-09-14 11:45 ` [PATCH 1/5] statx.h: update to latest kernel UAPI Christoph Hellwig
` (4 more replies)
0 siblings, 5 replies; 17+ messages in thread
From: Christoph Hellwig @ 2026-09-14 11:45 UTC (permalink / raw)
To: Zorro Lang; +Cc: fstests
Hi all,
when looking into testing changes that might require a minimum read size
larger than a page size, I realized that various tests hard code
PAGE_SIZE as a direct I/O read size despite claiming that they exercise
sub-block direct I/O.
This series adds support to query the minimum read size and actually uses
that for testing.
Changes since v1:
- explicitly request STATX_DIO_READ_ALIGN
- spelling fixes
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 1/5] statx.h: update to latest kernel UAPI
2026-09-14 11:45 actually exercise sub-block direct I/O reads v2 Christoph Hellwig
@ 2026-09-14 11:45 ` Christoph Hellwig
2026-09-14 14:35 ` Darrick J. Wong
2026-09-14 11:45 ` [PATCH 2/5] min_dio_alignment: add a -r option to query read alignment Christoph Hellwig
` (3 subsequent siblings)
4 siblings, 1 reply; 17+ messages in thread
From: Christoph Hellwig @ 2026-09-14 11:45 UTC (permalink / raw)
To: Zorro Lang; +Cc: fstests, Darrick J. Wong
Update the locally provided statx definition to the kernel UAPI as of
7.3-rc1.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Zorro Lang <zlang@kernel.org>
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
---
src/statx.h | 126 +++++++++++++++++++++++++++++++++++++++-------------
1 file changed, 96 insertions(+), 30 deletions(-)
diff --git a/src/statx.h b/src/statx.h
index bae1c86f6201..0a27bf030b1d 100644
--- a/src/statx.h
+++ b/src/statx.h
@@ -95,44 +95,97 @@ struct statx_timestamp {
*/
struct statx {
/* 0x00 */
- __u32 stx_mask; /* What results were written [uncond] */
- __u32 stx_blksize; /* Preferred general I/O size [uncond] */
- __u64 stx_attributes; /* Flags conveying information about the file [uncond] */
+ /* What results were written [uncond] */
+ __u32 stx_mask;
+
+ /* Preferred general I/O size [uncond] */
+ __u32 stx_blksize;
+
+ /* Flags conveying information about the file [uncond] */
+ __u64 stx_attributes;
+
/* 0x10 */
- __u32 stx_nlink; /* Number of hard links */
- __u32 stx_uid; /* User ID of owner */
- __u32 stx_gid; /* Group ID of owner */
- __u16 stx_mode; /* File mode */
+ /* Number of hard links */
+ __u32 stx_nlink;
+
+ /* User ID of owner */
+ __u32 stx_uid;
+
+ /* Group ID of owner */
+ __u32 stx_gid;
+
+ /* File mode */
+ __u16 stx_mode;
__u16 __spare0[1];
+
/* 0x20 */
- __u64 stx_ino; /* Inode number */
- __u64 stx_size; /* File size */
- __u64 stx_blocks; /* Number of 512-byte blocks allocated */
- __u64 stx_attributes_mask; /* Mask to show what's supported in stx_attributes */
+ /* Inode number */
+ __u64 stx_ino;
+
+ /* File size */
+ __u64 stx_size;
+
+ /* Number of 512-byte blocks allocated */
+ __u64 stx_blocks;
+
+ /* Mask to show what's supported in stx_attributes */
+ __u64 stx_attributes_mask;
/* 0x40 */
- struct statx_timestamp stx_atime; /* Last access time */
- struct statx_timestamp stx_btime; /* File creation time */
- struct statx_timestamp stx_ctime; /* Last attribute change time */
- struct statx_timestamp stx_mtime; /* Last data modification time */
+ /* Last access time */
+ struct statx_timestamp stx_atime;
+
+ /* File creation time */
+ struct statx_timestamp stx_btime;
+
+ /* Last attribute change time */
+ struct statx_timestamp stx_ctime;
+
+ /* Last data modification time */
+ struct statx_timestamp stx_mtime;
+
/* 0x80 */
- __u32 stx_rdev_major; /* Device ID of special file [if bdev/cdev] */
+ /* Device ID of special file [if bdev/cdev] */
+ __u32 stx_rdev_major;
__u32 stx_rdev_minor;
- __u32 stx_dev_major; /* ID of device containing file [uncond] */
+
+ /* ID of device containing file [uncond] */
+ __u32 stx_dev_major;
__u32 stx_dev_minor;
+
/* 0x90 */
__u64 stx_mnt_id;
- __u32 stx_dio_mem_align; /* Memory buffer alignment for direct I/O */
- __u32 stx_dio_offset_align; /* File offset alignment for direct I/O */
+
+ /* Memory buffer alignment for direct I/O */
+ __u32 stx_dio_mem_align;
+
+ /* File offset alignment for direct I/O */
+ __u32 stx_dio_offset_align;
+
/* 0xa0 */
- __u64 stx_subvol; /* Subvolume identifier */
- __u32 stx_atomic_write_unit_min; /* Min atomic write unit in bytes */
- __u32 stx_atomic_write_unit_max; /* Max atomic write unit in bytes */
+ /* Subvolume identifier */
+ __u64 stx_subvol;
+
+ /* Min atomic write unit in bytes */
+ __u32 stx_atomic_write_unit_min;
+
+ /* Max atomic write unit in bytes */
+ __u32 stx_atomic_write_unit_max;
+
/* 0xb0 */
- __u32 stx_atomic_write_segments_max; /* Max atomic write segment count */
- __u32 __spare1[1];
- /* 0xb8 */
- __u64 __spare3[9]; /* Spare space for future expansion */
+ /* Max atomic write segment count */
+ __u32 stx_atomic_write_segments_max;
+
+ /* File offset alignment for direct I/O reads */
+ __u32 stx_dio_read_offset_align;
+
+ /* Optimised max atomic write unit in bytes */
+ __u32 stx_atomic_write_unit_max_opt;
+ __u32 __spare2[1];
+
+ /* 0xc0 */
+ __u64 __spare3[8]; /* Spare space for future expansion */
+
/* 0x100 */
};
@@ -162,19 +215,32 @@ struct statx {
#define STATX_MNT_ID_UNIQUE 0x00004000U /* Want/got extended stx_mount_id */
#define STATX_SUBVOL 0x00008000U /* Want/got stx_subvol */
#define STATX_WRITE_ATOMIC 0x00010000U /* Want/got atomic_write_* fields */
+#define STATX_DIO_READ_ALIGN 0x00020000U /* Want/got dio read alignment info */
-#define STATX_ALL 0x00000fffU /* All currently supported flags */
+#define STATX__RESERVED 0x80000000U /* Reserved for future struct statx expansion */
+#ifndef __KERNEL__
/*
- * Attributes to be found in stx_attributes
+ * This is deprecated, and shall remain the same value in the future. To avoid
+ * confusion please use the equivalent (STATX_BASIC_STATS | STATX_BTIME)
+ * instead.
+ */
+#define STATX_ALL 0x00000fffU
+#endif
+
+/*
+ * Attributes to be found in stx_attributes and masked in stx_attributes_mask.
*
* These give information about the features or the state of a file that might
* be of use to ordinary userspace programs such as GUIs or ls rather than
* specialised tools.
*
- * Note that the flags marked [I] correspond to generic FS_IOC_FLAGS
+ * Note that the flags marked [I] correspond to the FS_IOC_SETFLAGS flags
* semantically. Where possible, the numerical value is picked to correspond
- * also.
+ * also. Note that the DAX attribute indicates that the file is in the CPU
+ * direct access state. It does not correspond to the per-inode flag that
+ * some filesystems support.
+ *
*/
#define STATX_ATTR_COMPRESSED 0x00000004 /* [I] File is compressed by the fs */
#define STATX_ATTR_IMMUTABLE 0x00000010 /* [I] File is marked immutable */
--
2.53.0
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 2/5] min_dio_alignment: add a -r option to query read alignment
2026-09-14 11:45 actually exercise sub-block direct I/O reads v2 Christoph Hellwig
2026-09-14 11:45 ` [PATCH 1/5] statx.h: update to latest kernel UAPI Christoph Hellwig
@ 2026-09-14 11:45 ` Christoph Hellwig
2026-09-14 17:43 ` Zorro Lang
2026-09-14 11:45 ` [PATCH 3/5] generic/091: enable sub-block reads Christoph Hellwig
` (2 subsequent siblings)
4 siblings, 1 reply; 17+ messages in thread
From: Christoph Hellwig @ 2026-09-14 11:45 UTC (permalink / raw)
To: Zorro Lang; +Cc: fstests, Darrick J. Wong
Add an option to query the STATX_DIO_READ_ALIGN if provided.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
---
src/min_dio_alignment.c | 45 +++++++++++++++++++++++++++++++----------
1 file changed, 34 insertions(+), 11 deletions(-)
diff --git a/src/min_dio_alignment.c b/src/min_dio_alignment.c
index 866fba1546c4..a557ce93a5d6 100644
--- a/src/min_dio_alignment.c
+++ b/src/min_dio_alignment.c
@@ -1,17 +1,19 @@
// SPDX-License-Identifier: GPL-2.0
/*
- * Copyright (c) 2024 Christoph Hellwig
+ * Copyright (c) 2024,2026 Christoph Hellwig
*/
#include <fcntl.h>
+#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
+#include <getopt.h>
#include <sys/mount.h>
#include <sys/ioctl.h>
#include <sys/stat.h>
#include "statx.h"
-static int min_dio_alignment(const char *mntpnt, const char *devname)
+static int min_dio_alignment(const char *mntpnt, const char *devname, bool read)
{
struct statx stx = { };
struct stat st;
@@ -27,9 +29,17 @@ static int min_dio_alignment(const char *mntpnt, const char *devname)
*/
fd = open(mntpnt, O_TMPFILE | O_RDWR | O_EXCL, 0600);
if (fd >= 0 &&
- xfstests_statx(fd, "", AT_EMPTY_PATH, STATX_DIOALIGN, &stx) == 0 &&
- (stx.stx_mask & STATX_DIOALIGN) && stx.stx_dio_offset_align != 0)
- return stx.stx_dio_offset_align;
+ xfstests_statx(fd, "", AT_EMPTY_PATH,
+ STATX_DIOALIGN | STATX_DIO_READ_ALIGN, &stx) == 0) {
+ if (read &&
+ (stx.stx_mask & STATX_DIO_READ_ALIGN) &&
+ stx.stx_dio_read_offset_align != 0)
+ return stx.stx_dio_read_offset_align;
+
+ if ((stx.stx_mask & STATX_DIOALIGN) &&
+ stx.stx_dio_offset_align != 0)
+ return stx.stx_dio_offset_align;
+ }
/*
* If we are on a block device and no explicit aligned is reported, use
@@ -42,9 +52,8 @@ static int min_dio_alignment(const char *mntpnt, const char *devname)
if (dev_fd > 0 &&
fstat(dev_fd, &st) == 0 &&
S_ISBLK(st.st_mode) &&
- ioctl(dev_fd, BLKSSZGET, &logical_block_size) == 0) {
+ ioctl(dev_fd, BLKSSZGET, &logical_block_size) == 0)
return logical_block_size;
- }
}
/*
@@ -56,11 +65,25 @@ static int min_dio_alignment(const char *mntpnt, const char *devname)
int main(int argc, char **argv)
{
- if (argc != 3) {
- fprintf(stderr, "usage: %s mountpoint devicename\n", argv[0]);
- exit(1);
+ bool read = false;
+ int c;
+
+ while ((c = getopt(argc, argv, "r")) != -1) {
+ switch(c) {
+ case 'r':
+ read = 1;
+ break;
+ default:
+ goto usage;
+ }
}
- printf("%d\n", min_dio_alignment(argv[1], argv[2]));
+ if (argc - optind != 2)
+ goto usage;
+
+ printf("%d\n", min_dio_alignment(argv[optind], argv[optind + 1], read));
exit(0);
+usage:
+ fprintf(stderr, "usage: %s [-r] mountpoint devicename\n", argv[0]);
+ exit(1);
}
--
2.53.0
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 3/5] generic/091: enable sub-block reads
2026-09-14 11:45 actually exercise sub-block direct I/O reads v2 Christoph Hellwig
2026-09-14 11:45 ` [PATCH 1/5] statx.h: update to latest kernel UAPI Christoph Hellwig
2026-09-14 11:45 ` [PATCH 2/5] min_dio_alignment: add a -r option to query read alignment Christoph Hellwig
@ 2026-09-14 11:45 ` Christoph Hellwig
2026-09-14 11:45 ` [PATCH 4/5] generic/263: " Christoph Hellwig
2026-09-14 11:45 ` [PATCH 5/5] generic/760: " Christoph Hellwig
4 siblings, 0 replies; 17+ messages in thread
From: Christoph Hellwig @ 2026-09-14 11:45 UTC (permalink / raw)
To: Zorro Lang; +Cc: fstests, Darrick J. Wong
The description of generic/091 claims that it tries to exercise sub-block
direct I/O, but the test currently limits reads to PAGE_SIZE alignment.
Use the new min_dio_alignment -r option to query the minimal read
alignment and only limit the read alignment to that.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Zorro Lang <zlang@kernel.org>
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
---
tests/generic/091 | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/generic/091 b/tests/generic/091
index 5cdf04890c0e..b2fba09d39ef 100755
--- a/tests/generic/091
+++ b/tests/generic/091
@@ -15,8 +15,8 @@ _begin_fstest rw auto quick
_require_test
_require_odirect
-psize=`$here/src/feature -s`
bsize=`$here/src/min_dio_alignment $TEST_DIR $TEST_DEV`
+psize=`$here/src/min_dio_alignment -r $TEST_DIR $TEST_DEV`
# fsx usage:
#
--
2.53.0
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 4/5] generic/263: enable sub-block reads
2026-09-14 11:45 actually exercise sub-block direct I/O reads v2 Christoph Hellwig
` (2 preceding siblings ...)
2026-09-14 11:45 ` [PATCH 3/5] generic/091: enable sub-block reads Christoph Hellwig
@ 2026-09-14 11:45 ` Christoph Hellwig
2026-09-14 11:45 ` [PATCH 5/5] generic/760: " Christoph Hellwig
4 siblings, 0 replies; 17+ messages in thread
From: Christoph Hellwig @ 2026-09-14 11:45 UTC (permalink / raw)
To: Zorro Lang; +Cc: fstests, Darrick J. Wong
The description of generic/263 claims that it tries to exercise sub-block
direct I/O, but the test currently limits reads to PAGE_SIZE alignment.
Use the new min_dio_alignment -r option to query the minimal read
alignment and only limit the read alignment to that.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Zorro Lang <zlang@kernel.org>
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
---
tests/generic/263 | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/generic/263 b/tests/generic/263
index 91cfbe5253bd..c456d62ebd43 100755
--- a/tests/generic/263
+++ b/tests/generic/263
@@ -15,7 +15,7 @@ _begin_fstest rw auto quick
_require_test
_require_odirect
-psize=`$here/src/feature -s`
+psize=`$here/src/min_dio_alignment -r $TEST_DIR $TEST_DEV`
bsize=`$here/src/min_dio_alignment $TEST_DIR $TEST_DEV`
run_fsx -N 10000 -o 8192 -l 500000 -r PSIZE -t BSIZE -w BSIZE -Z
--
2.53.0
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 5/5] generic/760: enable sub-block reads
2026-09-14 11:45 actually exercise sub-block direct I/O reads v2 Christoph Hellwig
` (3 preceding siblings ...)
2026-09-14 11:45 ` [PATCH 4/5] generic/263: " Christoph Hellwig
@ 2026-09-14 11:45 ` Christoph Hellwig
4 siblings, 0 replies; 17+ messages in thread
From: Christoph Hellwig @ 2026-09-14 11:45 UTC (permalink / raw)
To: Zorro Lang; +Cc: fstests, Darrick J. Wong
generic/760 currently limits reads to PAGE_SIZE alignments while allowing
smaller writes. Use the new min_dio_alignment -r option to query the minimal
read alignment and only limit the read alignment to that.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Zorro Lang <zlang@kernel.org>
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
---
tests/generic/760 | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/generic/760 b/tests/generic/760
index f270636e56a3..facd83e4af0c 100755
--- a/tests/generic/760
+++ b/tests/generic/760
@@ -16,7 +16,7 @@ _require_odirect
_require_thp
_require_hugepage_fsx
-psize=`$here/src/feature -s`
+psize=`$here/src/min_dio_alignment -r $TEST_DIR $TEST_DEV`
bsize=`$here/src/min_dio_alignment $TEST_DIR $TEST_DEV`
_run_hugepage_fsx -N 10000 -l 500000 -r PSIZE -t BSIZE -w BSIZE -Z -R -W
--
2.53.0
^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [PATCH 1/5] statx.h: update to latest kernel UAPI
2026-09-14 11:45 ` [PATCH 1/5] statx.h: update to latest kernel UAPI Christoph Hellwig
@ 2026-09-14 14:35 ` Darrick J. Wong
2026-09-14 17:43 ` Zorro Lang
0 siblings, 1 reply; 17+ messages in thread
From: Darrick J. Wong @ 2026-09-14 14:35 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: Zorro Lang, fstests
On Mon, Sep 14, 2026 at 01:45:43PM +0200, Christoph Hellwig wrote:
> Update the locally provided statx definition to the kernel UAPI as of
> 7.3-rc1.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> Reviewed-by: Zorro Lang <zlang@kernel.org>
>
> Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
Nit: no blank line between RVB tags. Otherwise this still looks ok.
--D
> ---
> src/statx.h | 126 +++++++++++++++++++++++++++++++++++++++-------------
> 1 file changed, 96 insertions(+), 30 deletions(-)
>
> diff --git a/src/statx.h b/src/statx.h
> index bae1c86f6201..0a27bf030b1d 100644
> --- a/src/statx.h
> +++ b/src/statx.h
> @@ -95,44 +95,97 @@ struct statx_timestamp {
> */
> struct statx {
> /* 0x00 */
> - __u32 stx_mask; /* What results were written [uncond] */
> - __u32 stx_blksize; /* Preferred general I/O size [uncond] */
> - __u64 stx_attributes; /* Flags conveying information about the file [uncond] */
> + /* What results were written [uncond] */
> + __u32 stx_mask;
> +
> + /* Preferred general I/O size [uncond] */
> + __u32 stx_blksize;
> +
> + /* Flags conveying information about the file [uncond] */
> + __u64 stx_attributes;
> +
> /* 0x10 */
> - __u32 stx_nlink; /* Number of hard links */
> - __u32 stx_uid; /* User ID of owner */
> - __u32 stx_gid; /* Group ID of owner */
> - __u16 stx_mode; /* File mode */
> + /* Number of hard links */
> + __u32 stx_nlink;
> +
> + /* User ID of owner */
> + __u32 stx_uid;
> +
> + /* Group ID of owner */
> + __u32 stx_gid;
> +
> + /* File mode */
> + __u16 stx_mode;
> __u16 __spare0[1];
> +
> /* 0x20 */
> - __u64 stx_ino; /* Inode number */
> - __u64 stx_size; /* File size */
> - __u64 stx_blocks; /* Number of 512-byte blocks allocated */
> - __u64 stx_attributes_mask; /* Mask to show what's supported in stx_attributes */
> + /* Inode number */
> + __u64 stx_ino;
> +
> + /* File size */
> + __u64 stx_size;
> +
> + /* Number of 512-byte blocks allocated */
> + __u64 stx_blocks;
> +
> + /* Mask to show what's supported in stx_attributes */
> + __u64 stx_attributes_mask;
>
> /* 0x40 */
> - struct statx_timestamp stx_atime; /* Last access time */
> - struct statx_timestamp stx_btime; /* File creation time */
> - struct statx_timestamp stx_ctime; /* Last attribute change time */
> - struct statx_timestamp stx_mtime; /* Last data modification time */
> + /* Last access time */
> + struct statx_timestamp stx_atime;
> +
> + /* File creation time */
> + struct statx_timestamp stx_btime;
> +
> + /* Last attribute change time */
> + struct statx_timestamp stx_ctime;
> +
> + /* Last data modification time */
> + struct statx_timestamp stx_mtime;
> +
> /* 0x80 */
> - __u32 stx_rdev_major; /* Device ID of special file [if bdev/cdev] */
> + /* Device ID of special file [if bdev/cdev] */
> + __u32 stx_rdev_major;
> __u32 stx_rdev_minor;
> - __u32 stx_dev_major; /* ID of device containing file [uncond] */
> +
> + /* ID of device containing file [uncond] */
> + __u32 stx_dev_major;
> __u32 stx_dev_minor;
> +
> /* 0x90 */
> __u64 stx_mnt_id;
> - __u32 stx_dio_mem_align; /* Memory buffer alignment for direct I/O */
> - __u32 stx_dio_offset_align; /* File offset alignment for direct I/O */
> +
> + /* Memory buffer alignment for direct I/O */
> + __u32 stx_dio_mem_align;
> +
> + /* File offset alignment for direct I/O */
> + __u32 stx_dio_offset_align;
> +
> /* 0xa0 */
> - __u64 stx_subvol; /* Subvolume identifier */
> - __u32 stx_atomic_write_unit_min; /* Min atomic write unit in bytes */
> - __u32 stx_atomic_write_unit_max; /* Max atomic write unit in bytes */
> + /* Subvolume identifier */
> + __u64 stx_subvol;
> +
> + /* Min atomic write unit in bytes */
> + __u32 stx_atomic_write_unit_min;
> +
> + /* Max atomic write unit in bytes */
> + __u32 stx_atomic_write_unit_max;
> +
> /* 0xb0 */
> - __u32 stx_atomic_write_segments_max; /* Max atomic write segment count */
> - __u32 __spare1[1];
> - /* 0xb8 */
> - __u64 __spare3[9]; /* Spare space for future expansion */
> + /* Max atomic write segment count */
> + __u32 stx_atomic_write_segments_max;
> +
> + /* File offset alignment for direct I/O reads */
> + __u32 stx_dio_read_offset_align;
> +
> + /* Optimised max atomic write unit in bytes */
> + __u32 stx_atomic_write_unit_max_opt;
> + __u32 __spare2[1];
> +
> + /* 0xc0 */
> + __u64 __spare3[8]; /* Spare space for future expansion */
> +
> /* 0x100 */
> };
>
> @@ -162,19 +215,32 @@ struct statx {
> #define STATX_MNT_ID_UNIQUE 0x00004000U /* Want/got extended stx_mount_id */
> #define STATX_SUBVOL 0x00008000U /* Want/got stx_subvol */
> #define STATX_WRITE_ATOMIC 0x00010000U /* Want/got atomic_write_* fields */
> +#define STATX_DIO_READ_ALIGN 0x00020000U /* Want/got dio read alignment info */
>
> -#define STATX_ALL 0x00000fffU /* All currently supported flags */
> +#define STATX__RESERVED 0x80000000U /* Reserved for future struct statx expansion */
>
> +#ifndef __KERNEL__
> /*
> - * Attributes to be found in stx_attributes
> + * This is deprecated, and shall remain the same value in the future. To avoid
> + * confusion please use the equivalent (STATX_BASIC_STATS | STATX_BTIME)
> + * instead.
> + */
> +#define STATX_ALL 0x00000fffU
> +#endif
> +
> +/*
> + * Attributes to be found in stx_attributes and masked in stx_attributes_mask.
> *
> * These give information about the features or the state of a file that might
> * be of use to ordinary userspace programs such as GUIs or ls rather than
> * specialised tools.
> *
> - * Note that the flags marked [I] correspond to generic FS_IOC_FLAGS
> + * Note that the flags marked [I] correspond to the FS_IOC_SETFLAGS flags
> * semantically. Where possible, the numerical value is picked to correspond
> - * also.
> + * also. Note that the DAX attribute indicates that the file is in the CPU
> + * direct access state. It does not correspond to the per-inode flag that
> + * some filesystems support.
> + *
> */
> #define STATX_ATTR_COMPRESSED 0x00000004 /* [I] File is compressed by the fs */
> #define STATX_ATTR_IMMUTABLE 0x00000010 /* [I] File is marked immutable */
> --
> 2.53.0
>
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 2/5] min_dio_alignment: add a -r option to query read alignment
2026-09-14 11:45 ` [PATCH 2/5] min_dio_alignment: add a -r option to query read alignment Christoph Hellwig
@ 2026-09-14 17:43 ` Zorro Lang
0 siblings, 0 replies; 17+ messages in thread
From: Zorro Lang @ 2026-09-14 17:43 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: fstests, Darrick J. Wong
On Mon, Sep 14, 2026 at 01:45:44PM +0200, Christoph Hellwig wrote:
> Add an option to query the STATX_DIO_READ_ALIGN if provided.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
> ---
Thanks Christoph, this version is good to me:)
Reviewed-by: Zorro Lang <zlang@kernel.org>
> src/min_dio_alignment.c | 45 +++++++++++++++++++++++++++++++----------
> 1 file changed, 34 insertions(+), 11 deletions(-)
>
> diff --git a/src/min_dio_alignment.c b/src/min_dio_alignment.c
> index 866fba1546c4..a557ce93a5d6 100644
> --- a/src/min_dio_alignment.c
> +++ b/src/min_dio_alignment.c
> @@ -1,17 +1,19 @@
> // SPDX-License-Identifier: GPL-2.0
> /*
> - * Copyright (c) 2024 Christoph Hellwig
> + * Copyright (c) 2024,2026 Christoph Hellwig
> */
> #include <fcntl.h>
> +#include <stdbool.h>
> #include <stdio.h>
> #include <stdlib.h>
> #include <unistd.h>
> +#include <getopt.h>
> #include <sys/mount.h>
> #include <sys/ioctl.h>
> #include <sys/stat.h>
> #include "statx.h"
>
> -static int min_dio_alignment(const char *mntpnt, const char *devname)
> +static int min_dio_alignment(const char *mntpnt, const char *devname, bool read)
> {
> struct statx stx = { };
> struct stat st;
> @@ -27,9 +29,17 @@ static int min_dio_alignment(const char *mntpnt, const char *devname)
> */
> fd = open(mntpnt, O_TMPFILE | O_RDWR | O_EXCL, 0600);
> if (fd >= 0 &&
> - xfstests_statx(fd, "", AT_EMPTY_PATH, STATX_DIOALIGN, &stx) == 0 &&
> - (stx.stx_mask & STATX_DIOALIGN) && stx.stx_dio_offset_align != 0)
> - return stx.stx_dio_offset_align;
> + xfstests_statx(fd, "", AT_EMPTY_PATH,
> + STATX_DIOALIGN | STATX_DIO_READ_ALIGN, &stx) == 0) {
> + if (read &&
> + (stx.stx_mask & STATX_DIO_READ_ALIGN) &&
> + stx.stx_dio_read_offset_align != 0)
> + return stx.stx_dio_read_offset_align;
> +
> + if ((stx.stx_mask & STATX_DIOALIGN) &&
> + stx.stx_dio_offset_align != 0)
> + return stx.stx_dio_offset_align;
> + }
>
> /*
> * If we are on a block device and no explicit aligned is reported, use
> @@ -42,9 +52,8 @@ static int min_dio_alignment(const char *mntpnt, const char *devname)
> if (dev_fd > 0 &&
> fstat(dev_fd, &st) == 0 &&
> S_ISBLK(st.st_mode) &&
> - ioctl(dev_fd, BLKSSZGET, &logical_block_size) == 0) {
> + ioctl(dev_fd, BLKSSZGET, &logical_block_size) == 0)
> return logical_block_size;
> - }
> }
>
> /*
> @@ -56,11 +65,25 @@ static int min_dio_alignment(const char *mntpnt, const char *devname)
>
> int main(int argc, char **argv)
> {
> - if (argc != 3) {
> - fprintf(stderr, "usage: %s mountpoint devicename\n", argv[0]);
> - exit(1);
> + bool read = false;
> + int c;
> +
> + while ((c = getopt(argc, argv, "r")) != -1) {
> + switch(c) {
> + case 'r':
> + read = 1;
> + break;
> + default:
> + goto usage;
> + }
> }
>
> - printf("%d\n", min_dio_alignment(argv[1], argv[2]));
> + if (argc - optind != 2)
> + goto usage;
> +
> + printf("%d\n", min_dio_alignment(argv[optind], argv[optind + 1], read));
> exit(0);
> +usage:
> + fprintf(stderr, "usage: %s [-r] mountpoint devicename\n", argv[0]);
> + exit(1);
> }
> --
> 2.53.0
>
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 1/5] statx.h: update to latest kernel UAPI
2026-09-14 14:35 ` Darrick J. Wong
@ 2026-09-14 17:43 ` Zorro Lang
0 siblings, 0 replies; 17+ messages in thread
From: Zorro Lang @ 2026-09-14 17:43 UTC (permalink / raw)
To: Darrick J. Wong; +Cc: Christoph Hellwig, fstests
On Mon, Sep 14, 2026 at 07:35:43AM -0700, Darrick J. Wong wrote:
> On Mon, Sep 14, 2026 at 01:45:43PM +0200, Christoph Hellwig wrote:
> > Update the locally provided statx definition to the kernel UAPI as of
> > 7.3-rc1.
> >
> > Signed-off-by: Christoph Hellwig <hch@lst.de>
> > Reviewed-by: Zorro Lang <zlang@kernel.org>
> >
> > Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
>
> Nit: no blank line between RVB tags. Otherwise this still looks ok.
Thanks Darrick, I'll remove that blank line.
>
> --D
>
> > ---
> > src/statx.h | 126 +++++++++++++++++++++++++++++++++++++++-------------
> > 1 file changed, 96 insertions(+), 30 deletions(-)
> >
> > diff --git a/src/statx.h b/src/statx.h
> > index bae1c86f6201..0a27bf030b1d 100644
> > --- a/src/statx.h
> > +++ b/src/statx.h
> > @@ -95,44 +95,97 @@ struct statx_timestamp {
> > */
> > struct statx {
> > /* 0x00 */
> > - __u32 stx_mask; /* What results were written [uncond] */
> > - __u32 stx_blksize; /* Preferred general I/O size [uncond] */
> > - __u64 stx_attributes; /* Flags conveying information about the file [uncond] */
> > + /* What results were written [uncond] */
> > + __u32 stx_mask;
> > +
> > + /* Preferred general I/O size [uncond] */
> > + __u32 stx_blksize;
> > +
> > + /* Flags conveying information about the file [uncond] */
> > + __u64 stx_attributes;
> > +
> > /* 0x10 */
> > - __u32 stx_nlink; /* Number of hard links */
> > - __u32 stx_uid; /* User ID of owner */
> > - __u32 stx_gid; /* Group ID of owner */
> > - __u16 stx_mode; /* File mode */
> > + /* Number of hard links */
> > + __u32 stx_nlink;
> > +
> > + /* User ID of owner */
> > + __u32 stx_uid;
> > +
> > + /* Group ID of owner */
> > + __u32 stx_gid;
> > +
> > + /* File mode */
> > + __u16 stx_mode;
> > __u16 __spare0[1];
> > +
> > /* 0x20 */
> > - __u64 stx_ino; /* Inode number */
> > - __u64 stx_size; /* File size */
> > - __u64 stx_blocks; /* Number of 512-byte blocks allocated */
> > - __u64 stx_attributes_mask; /* Mask to show what's supported in stx_attributes */
> > + /* Inode number */
> > + __u64 stx_ino;
> > +
> > + /* File size */
> > + __u64 stx_size;
> > +
> > + /* Number of 512-byte blocks allocated */
> > + __u64 stx_blocks;
> > +
> > + /* Mask to show what's supported in stx_attributes */
> > + __u64 stx_attributes_mask;
> >
> > /* 0x40 */
> > - struct statx_timestamp stx_atime; /* Last access time */
> > - struct statx_timestamp stx_btime; /* File creation time */
> > - struct statx_timestamp stx_ctime; /* Last attribute change time */
> > - struct statx_timestamp stx_mtime; /* Last data modification time */
> > + /* Last access time */
> > + struct statx_timestamp stx_atime;
> > +
> > + /* File creation time */
> > + struct statx_timestamp stx_btime;
> > +
> > + /* Last attribute change time */
> > + struct statx_timestamp stx_ctime;
> > +
> > + /* Last data modification time */
> > + struct statx_timestamp stx_mtime;
> > +
> > /* 0x80 */
> > - __u32 stx_rdev_major; /* Device ID of special file [if bdev/cdev] */
> > + /* Device ID of special file [if bdev/cdev] */
> > + __u32 stx_rdev_major;
> > __u32 stx_rdev_minor;
> > - __u32 stx_dev_major; /* ID of device containing file [uncond] */
> > +
> > + /* ID of device containing file [uncond] */
> > + __u32 stx_dev_major;
> > __u32 stx_dev_minor;
> > +
> > /* 0x90 */
> > __u64 stx_mnt_id;
> > - __u32 stx_dio_mem_align; /* Memory buffer alignment for direct I/O */
> > - __u32 stx_dio_offset_align; /* File offset alignment for direct I/O */
> > +
> > + /* Memory buffer alignment for direct I/O */
> > + __u32 stx_dio_mem_align;
> > +
> > + /* File offset alignment for direct I/O */
> > + __u32 stx_dio_offset_align;
> > +
> > /* 0xa0 */
> > - __u64 stx_subvol; /* Subvolume identifier */
> > - __u32 stx_atomic_write_unit_min; /* Min atomic write unit in bytes */
> > - __u32 stx_atomic_write_unit_max; /* Max atomic write unit in bytes */
> > + /* Subvolume identifier */
> > + __u64 stx_subvol;
> > +
> > + /* Min atomic write unit in bytes */
> > + __u32 stx_atomic_write_unit_min;
> > +
> > + /* Max atomic write unit in bytes */
> > + __u32 stx_atomic_write_unit_max;
> > +
> > /* 0xb0 */
> > - __u32 stx_atomic_write_segments_max; /* Max atomic write segment count */
> > - __u32 __spare1[1];
> > - /* 0xb8 */
> > - __u64 __spare3[9]; /* Spare space for future expansion */
> > + /* Max atomic write segment count */
> > + __u32 stx_atomic_write_segments_max;
> > +
> > + /* File offset alignment for direct I/O reads */
> > + __u32 stx_dio_read_offset_align;
> > +
> > + /* Optimised max atomic write unit in bytes */
> > + __u32 stx_atomic_write_unit_max_opt;
> > + __u32 __spare2[1];
> > +
> > + /* 0xc0 */
> > + __u64 __spare3[8]; /* Spare space for future expansion */
> > +
> > /* 0x100 */
> > };
> >
> > @@ -162,19 +215,32 @@ struct statx {
> > #define STATX_MNT_ID_UNIQUE 0x00004000U /* Want/got extended stx_mount_id */
> > #define STATX_SUBVOL 0x00008000U /* Want/got stx_subvol */
> > #define STATX_WRITE_ATOMIC 0x00010000U /* Want/got atomic_write_* fields */
> > +#define STATX_DIO_READ_ALIGN 0x00020000U /* Want/got dio read alignment info */
> >
> > -#define STATX_ALL 0x00000fffU /* All currently supported flags */
> > +#define STATX__RESERVED 0x80000000U /* Reserved for future struct statx expansion */
> >
> > +#ifndef __KERNEL__
> > /*
> > - * Attributes to be found in stx_attributes
> > + * This is deprecated, and shall remain the same value in the future. To avoid
> > + * confusion please use the equivalent (STATX_BASIC_STATS | STATX_BTIME)
> > + * instead.
> > + */
> > +#define STATX_ALL 0x00000fffU
> > +#endif
> > +
> > +/*
> > + * Attributes to be found in stx_attributes and masked in stx_attributes_mask.
> > *
> > * These give information about the features or the state of a file that might
> > * be of use to ordinary userspace programs such as GUIs or ls rather than
> > * specialised tools.
> > *
> > - * Note that the flags marked [I] correspond to generic FS_IOC_FLAGS
> > + * Note that the flags marked [I] correspond to the FS_IOC_SETFLAGS flags
> > * semantically. Where possible, the numerical value is picked to correspond
> > - * also.
> > + * also. Note that the DAX attribute indicates that the file is in the CPU
> > + * direct access state. It does not correspond to the per-inode flag that
> > + * some filesystems support.
> > + *
> > */
> > #define STATX_ATTR_COMPRESSED 0x00000004 /* [I] File is compressed by the fs */
> > #define STATX_ATTR_IMMUTABLE 0x00000010 /* [I] File is marked immutable */
> > --
> > 2.53.0
> >
^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2026-09-14 17:43 UTC | newest]
Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-14 11:45 actually exercise sub-block direct I/O reads v2 Christoph Hellwig
2026-09-14 11:45 ` [PATCH 1/5] statx.h: update to latest kernel UAPI Christoph Hellwig
2026-09-14 14:35 ` Darrick J. Wong
2026-09-14 17:43 ` Zorro Lang
2026-09-14 11:45 ` [PATCH 2/5] min_dio_alignment: add a -r option to query read alignment Christoph Hellwig
2026-09-14 17:43 ` Zorro Lang
2026-09-14 11:45 ` [PATCH 3/5] generic/091: enable sub-block reads Christoph Hellwig
2026-09-14 11:45 ` [PATCH 4/5] generic/263: " Christoph Hellwig
2026-09-14 11:45 ` [PATCH 5/5] generic/760: " Christoph Hellwig
-- strict thread matches above, loose matches on Subject: below --
2026-08-31 6:51 actually exercise sub-block direct I/O reads Christoph Hellwig
2026-08-31 6:51 ` [PATCH 1/5] statx.h: update to latest kernel UAPI Christoph Hellwig
2026-08-31 17:12 ` Darrick J. Wong
2026-09-02 15:31 ` Zorro Lang
2024-08-14 4:52 improve minalign handling v2 Christoph Hellwig
2024-08-14 4:52 ` [PATCH 1/5] statx.h: update to latest kernel UAPI Christoph Hellwig
2024-08-14 5:12 ` Darrick J. Wong
2024-08-13 7:34 improve minalign handling Christoph Hellwig
2024-08-13 7:35 ` [PATCH 1/5] statx.h: update to latest kernel UAPI Christoph Hellwig
2024-08-13 14:37 ` Darrick J. Wong
2024-08-13 14:54 ` Christoph Hellwig
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox