1
0
Fork 0
mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git synced 2025-01-22 07:53:11 -05:00

fs: add STATX_DIO_READ_ALIGN

Add a separate dio read align field, as many out of place write
file systems can easily do reads aligned to the device sector size,
but require bigger alignment for writes.

This is usually papered over by falling back to buffered I/O for smaller
writes and doing read-modify-write cycles, but performance for this
sucks, so applications benefit from knowing the actual write alignment.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20250109083109.1441561-3-hch@lst.de
Reviewed-by: John Garry <john.g.garry@oracle.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Christian Brauner <brauner@kernel.org>
This commit is contained in:
Christoph Hellwig 2025-01-09 09:31:02 +01:00 committed by Christian Brauner
parent 8fc7e23a9b
commit 7ed6cbe0f8
No known key found for this signature in database
GPG key ID: 91C61BC06578DCA2
3 changed files with 5 additions and 1 deletions

View file

@ -725,6 +725,7 @@ cp_statx(const struct kstat *stat, struct statx __user *buffer)
tmp.stx_mnt_id = stat->mnt_id; tmp.stx_mnt_id = stat->mnt_id;
tmp.stx_dio_mem_align = stat->dio_mem_align; tmp.stx_dio_mem_align = stat->dio_mem_align;
tmp.stx_dio_offset_align = stat->dio_offset_align; tmp.stx_dio_offset_align = stat->dio_offset_align;
tmp.stx_dio_read_offset_align = stat->dio_read_offset_align;
tmp.stx_subvol = stat->subvol; tmp.stx_subvol = stat->subvol;
tmp.stx_atomic_write_unit_min = stat->atomic_write_unit_min; tmp.stx_atomic_write_unit_min = stat->atomic_write_unit_min;
tmp.stx_atomic_write_unit_max = stat->atomic_write_unit_max; tmp.stx_atomic_write_unit_max = stat->atomic_write_unit_max;

View file

@ -52,6 +52,7 @@ struct kstat {
u64 mnt_id; u64 mnt_id;
u32 dio_mem_align; u32 dio_mem_align;
u32 dio_offset_align; u32 dio_offset_align;
u32 dio_read_offset_align;
u64 change_cookie; u64 change_cookie;
u64 subvol; u64 subvol;
u32 atomic_write_unit_min; u32 atomic_write_unit_min;

View file

@ -179,7 +179,8 @@ struct statx {
/* Max atomic write segment count */ /* Max atomic write segment count */
__u32 stx_atomic_write_segments_max; __u32 stx_atomic_write_segments_max;
__u32 __spare1[1]; /* File offset alignment for direct I/O reads */
__u32 stx_dio_read_offset_align;
/* 0xb8 */ /* 0xb8 */
__u64 __spare3[9]; /* Spare space for future expansion */ __u64 __spare3[9]; /* Spare space for future expansion */
@ -213,6 +214,7 @@ struct statx {
#define STATX_MNT_ID_UNIQUE 0x00004000U /* Want/got extended stx_mount_id */ #define STATX_MNT_ID_UNIQUE 0x00004000U /* Want/got extended stx_mount_id */
#define STATX_SUBVOL 0x00008000U /* Want/got stx_subvol */ #define STATX_SUBVOL 0x00008000U /* Want/got stx_subvol */
#define STATX_WRITE_ATOMIC 0x00010000U /* Want/got atomic_write_* fields */ #define STATX_WRITE_ATOMIC 0x00010000U /* Want/got atomic_write_* fields */
#define STATX_DIO_READ_ALIGN 0x00020000U /* Want/got dio read alignment info */
#define STATX__RESERVED 0x80000000U /* Reserved for future struct statx expansion */ #define STATX__RESERVED 0x80000000U /* Reserved for future struct statx expansion */