add STATX_DIO_READ_ALIGN v2
Subsystems (4)
Hi all,
file systems that write out of place usually require different alignment for direct I/O writes than what they can do for reads. This series tries to address this by adding yet another statx field.
Changes from v1:
- improve the comment in xfs_report_dioalign based on a contribution from Darrick
- improve man page wording and formatting
- also report the larger alignment in XFS_IOC_DIOINFO
Changes from RFC:
- add a cleanup patch for xfs_vn_getattr
- use xfs_inode_alloc_unitsize in xfs_vn_getattr
- improve a comment in XFS
Diffstat:
fs/stat.c | 1 fs/xfs/xfs_ioctl.c | 11 ++++- fs/xfs/xfs_iops.c | 62 +++++++++++++++++----------- include/linux/stat.h | 1 include/uapi/linux/stat.h | 99 ++++++++++++++++++++++++++++++++++------------ 5 files changed, 125 insertions(+), 49 deletions(-)
PATCH 1/5 fs: reformat the statx definition
The comments after the declaration are becoming rather unreadable with long enough comments. Move them into lines of their own.
--- include/uapi/linux/stat.h | 95 +++++++++++++++++++++++++++++---------- 1 file changed, 72 insertions(+), 23 deletions(-)
include/uapi/linux/stat.h +72 -23
@@ -98,43 +98,92 @@ 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 */ +/* Max atomic write segment count */ +__u32 stx_atomic_write_segments_max; +__u32 __spare1[1 ]; +/* 0xb8 */ __u64 __spare3[9 ];/* Spare space for future expansion */ +/* 0x100 */ };
Signature · 1 line
2.45.2
Re: [PATCH 1/5] fs: reformat the statx definition
Quoted 7 lines · Christoph Hellwig
The comments after the declaration are becoming rather unreadable with long enough comments. Move them into lines of their own.
Signed-off-by Christoph Hellwig<[email protected]>Reviewed-by Jan Kara<[email protected]>Reviewed-by Darrick J. Wong<[email protected]>---
FWIW:
PATCH 2/5 fs: add STATX_DIO_READ_ALIGN
In reply to Christoph HellwigAdd 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.
--- fs/stat.c | 1 + include/linux/stat.h | 1 + include/uapi/linux/stat.h | 4 +++- 3 files changed, 5 insertions(+), 1 deletion(-)
fs/stat.c +1 -0
@@ -725,6 +725,7 @@ cp_statx(const struct kstat *stat, struct statx __user *buffer) tmp.stx_mnt_id = stat->mnt_id; tmp.stx_dio_mem_align = stat->dio_mem_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_atomic_write_unit_min = stat->atomic_write_unit_min; tmp.stx_atomic_write_unit_max = stat->atomic_write_unit_max;
include/linux/stat.h +1 -0
@@ -52,6 +52,7 @@ struct kstat {u64 mnt_id;u32 dio_mem_align;u32 dio_offset_align; +u32 dio_read_offset_align;u64 change_cookie;u64 subvol;u32 atomic_write_unit_min;
include/uapi/linux/stat.h +3 -1
@@ -179,7 +179,8 @@ struct statx {/* Max atomic write segment count */ __u32 stx_atomic_write_segments_max; -__u32 __spare1[1 ]; +/* File offset alignment for direct I/O reads */ +__u32 stx_dio_read_offset_align;/* 0xb8 */ __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_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__RESERVED 0x80000000U/* Reserved for future struct statx expansion */
Signature · 1 line
2.45.2
Re: [PATCH 2/5] fs: add STATX_DIO_READ_ALIGN
Quoted 11 lines · Christoph Hellwig
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<[email protected]>Reviewed-by Jan Kara<[email protected]>Reviewed-by Darrick J. Wong<[email protected]>
FWIW:
PATCH 3/5 xfs: cleanup xfs_vn_getattr
In reply to Christoph HellwigSplit the two bits of optional statx reporting into their own helpers so that they are self-contained instead of deeply indented in the main getattr handler.
--- fs/xfs/xfs_iops.c | 47 +++++++++++++++++++++++------------------------ 1 file changed, 23 insertions(+), 24 deletions(-)
fs/xfs/xfs_iops.c +23 -24
@@ -573,17 +573,28 @@ xfs_stat_blksize( }static void -xfs_get_atomic_write_attr ( +xfs_report_dioalign (struct xfs_inode *ip, -unsigned int *unit_min, -unsigned int *unit_max) +struct kstat *stat) { -if (!xfs_inode_can_atomicwrite (ip)) { - *unit_min = *unit_max =0 ; -return ; - } +struct xfs_buftarg *target =xfs_inode_buftarg (ip); +struct block_device *bdev = target->bt_bdev; - *unit_min = *unit_max = ip->i_mount->m_sb.sb_blocksize; + stat->result_mask |=STATX_DIOALIGN ; + stat->dio_mem_align =bdev_dma_alignment (bdev) +1 ; + stat->dio_offset_align =bdev_logical_block_size (bdev); +} + +static void +xfs_report_atomic_write ( +struct xfs_inode *ip, +struct kstat *stat) +{ +unsigned int unit_min =0 , unit_max =0 ; + +if (xfs_inode_can_atomicwrite (ip)) + unit_min = unit_max = ip->i_mount->m_sb.sb_blocksize; +generic_fill_statx_atomic_writes (stat, unit_min, unit_max); }STATIC int
@@ -647,22 +658,10 @@ xfs_vn_getattr( stat->rdev = inode->i_rdev;break ;case S_IFREG : -if (request_mask &STATX_DIOALIGN ) { -struct xfs_buftarg *target =xfs_inode_buftarg (ip); -struct block_device *bdev = target->bt_bdev; - - stat->result_mask |=STATX_DIOALIGN ; - stat->dio_mem_align =bdev_dma_alignment (bdev) +1 ; - stat->dio_offset_align =bdev_logical_block_size (bdev); - } -if (request_mask &STATX_WRITE_ATOMIC ) { -unsigned int unit_min, unit_max; - -xfs_get_atomic_write_attr (ip, &unit_min, - &unit_max); -generic_fill_statx_atomic_writes (stat, - unit_min, unit_max); - } +if (request_mask &STATX_DIOALIGN ) +xfs_report_dioalign (ip, stat); +if (request_mask &STATX_WRITE_ATOMIC ) +xfs_report_atomic_write (ip, stat); fallthrough;default : stat->blksize =xfs_stat_blksize (ip);
Signature · 1 line
2.45.2
PATCH 4/5 xfs: report the correct read/write dio alignment for reflinked inodes
In reply to Christoph HellwigFor I/O to reflinked blocks we always need to write an entire new file system block, and the code enforces the file system block alignment for the entire file if it has any reflinked blocks.
Use the new STATX_DIO_READ_ALIGN flag to report the asymmetric read vs write alignments for reflinked files.
--- fs/xfs/xfs_iops.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-)
fs/xfs/xfs_iops.c +18 -3
@@ -580,9 +580,24 @@ xfs_report_dioalign(struct xfs_buftarg *target =xfs_inode_buftarg (ip);struct block_device *bdev = target->bt_bdev; - stat->result_mask |=STATX_DIOALIGN ; + stat->result_mask |=STATX_DIOALIGN |STATX_DIO_READ_ALIGN ; stat->dio_mem_align =bdev_dma_alignment (bdev) +1 ; - stat->dio_offset_align =bdev_logical_block_size (bdev); + +/* +* For COW inodes, we can only perform out of place writes of entire +* allocation units (blocks or RT extents). +* For writes smaller than the allocation unit, we must fall back to +* buffered I/O to perform read-modify-write cycles. At best this is +* highly inefficient; at worst it leads to page cache invalidation +* races. Tell applications to avoid this by reporting the larger write +* alignment in dio_offset_align, and the smaller read alignment in +* dio_read_offset_align. +*/ + stat->dio_read_offset_align =bdev_logical_block_size (bdev); +if (xfs_is_cow_inode (ip)) + stat->dio_offset_align =xfs_inode_alloc_unitsize (ip); +else + stat->dio_offset_align = stat->dio_read_offset_align; } static void
@@ -658,7 +673,7 @@ xfs_vn_getattr( stat->rdev = inode->i_rdev;break ;case S_IFREG : -if (request_mask &STATX_DIOALIGN ) +if (request_mask & (STATX_DIOALIGN |STATX_DIO_READ_ALIGN ))xfs_report_dioalign (ip, stat);if (request_mask &STATX_WRITE_ATOMIC )xfs_report_atomic_write (ip, stat);
Signature · 1 line
2.45.2
Re: [PATCH 4/5] xfs: report the correct read/write dio alignment for reflinked inodes
Quoted 9 lines · Christoph Hellwig
For I/O to reflinked blocks we always need to write an entire new file system block, and the code enforces the file system block alignment for the entire file if it has any reflinked blocks.
Use the new
STATX_DIO_READ_ALIGNflag to report the asymmetric read vs write alignments for reflinked files.Signed-off-by Christoph Hellwig<[email protected]>Reviewed-by "Darrick J. Wong"<[email protected]>
FWIW:
Re: [PATCH 4/5] xfs: report the correct read/write dio alignment for reflinked inodes
In reply to Christoph Hellwigfs/xfs/xfs_iops.c xfs_report_dioalign( · line 583
Quoted 6 lines · Christoph Hellwig
fs/xfs/xfs_iops.c +1
-1@@ -580,9 +580,24 @@ xfs_report_dioalign(struct xfs_buftarg *target =xfs_inode_buftarg (ip);struct block_device *bdev = target->bt_bdev; - stat->result_mask |=STATX_DIOALIGN ; + stat->result_mask |=STATX_DIOALIGN |STATX_DIO_READ_ALIGN ;
BTW, it would be a crappy userspace which can't handle fields which it did not ask for, e.g. asked for STATX_DIOALIGN, but got STATX_DIOALIGN and STATX_DIO_READ_ALIGN
Re: [PATCH 4/5] xfs: report the correct read/write dio alignment for reflinked inodes
Quoted 10 lines · John Garry
fs/xfs/xfs_iops.c xfs_report_dioalign( · line 583
Quoted 5 lines · Christoph Hellwig
fs/xfs/xfs_iops.c +1
-0@@ -580,9 +580,24 @@ xfs_report_dioalign(struct xfs_buftarg *target =xfs_inode_buftarg (ip);struct block_device *bdev = target->bt_bdev; - stat->result_mask |=STATX_DIOALIGN ; + stat->result_mask |=STATX_DIOALIGN |STATX_DIO_READ_ALIGN ;BTW, it would be a crappy userspace which can't handle fields which it did not ask for, e.g. asked for
STATX_DIOALIGN, but gotSTATX_DIOALIGNandSTATX_DIO_READ_ALIGN
Well, the space is marked for extension. I don't think there ever was a requirement only fields asked for are reported, but if that feels safer I could switch to that.
Re: [PATCH 4/5] xfs: report the correct read/write dio alignment for reflinked inodes
Quoted 12 lines · Christoph Hellwig
Quoted 10 lines · John Garry
fs/xfs/xfs_iops.c xfs_report_dioalign( · line 583
Quoted 5 lines · Christoph Hellwig
fs/xfs/xfs_iops.c +1
-0@@ -580,9 +580,24 @@ xfs_report_dioalign(struct xfs_buftarg *target =xfs_inode_buftarg (ip);struct block_device *bdev = target->bt_bdev; - stat->result_mask |=STATX_DIOALIGN ; + stat->result_mask |=STATX_DIOALIGN |STATX_DIO_READ_ALIGN ;BTW, it would be a crappy userspace which can't handle fields which it did not ask for, e.g. asked for
STATX_DIOALIGN, but gotSTATX_DIOALIGNandSTATX_DIO_READ_ALIGN
Quoted 3 lines
Well, the space is marked for extension. I don't think there ever was a requirement only fields asked for are reported, but if that feels safer I could switch to that.
From the "Returned information" section of the statx manpage:
"It should be noted that the kernel may return fields that weren't requested and may fail to return fields that were requested, depending on what the backing filesystem supports. (Fields that are given values despite being unrequested can just be ignored.) In either case, stx_mask will not be equal mask.
<snip>
"A filesystem may also fill in fields that the caller didn't ask for if it has values for them available and the information is available at no extra cost. If this happens, the corresponding bits will be set in stx_mask."
In other words, the kernel is allowed to return information/flags that weren't requested, and userspace can ignore it.
--D
Re: [PATCH 4/5] xfs: report the correct read/write dio alignment for reflinked inodes
In reply to Christoph HellwigQuoted 31 lines · Christoph Hellwig
For I/O to reflinked blocks we always need to write an entire new file system block, and the code enforces the file system block alignment for the entire file if it has any reflinked blocks.
Use the new
STATX_DIO_READ_ALIGNflag to report the asymmetric read vs write alignments for reflinked files.Signed-off-by Christoph Hellwig <[email protected]>Reviewed-by "Darrick J. Wong" <[email protected]>--- fs/xfs/xfs_iops.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-)fs/xfs/xfs_iops.c +7
-2@@ -580,9 +580,24 @@ xfs_report_dioalign(struct xfs_buftarg *target =xfs_inode_buftarg (ip);struct block_device *bdev = target->bt_bdev; - stat->result_mask |=STATX_DIOALIGN ; + stat->result_mask |=STATX_DIOALIGN |STATX_DIO_READ_ALIGN ; stat->dio_mem_align =bdev_dma_alignment (bdev) +1 ; - stat->dio_offset_align =bdev_logical_block_size (bdev); + +/* +* For COW inodes, we can only perform out of place writes of entire +* allocation units (blocks or RT extents). +* For writes smaller than the allocation unit, we must fall back to +* buffered I/O to perform read-modify-write cycles. At best this is
fs/xfs/xfs_iops.c xfs_report_dioalign( · line 600
Quoted 10 lines
fs/xfs/xfs_iops.c +10
-0+* highly inefficient; at worst it leads to page cache invalidation +* races. Tell applications to avoid this by reporting the larger write +* alignment in dio_offset_align, and the smaller read alignment in +* dio_read_offset_align. +*/ + stat->dio_read_offset_align =bdev_logical_block_size (bdev); +if (xfs_is_cow_inode (ip)) + stat->dio_offset_align =xfs_inode_alloc_unitsize (ip); +else + stat->dio_offset_align = stat->dio_read_offset_align;
This contradicts the proposed man page, which says the following about stx_dio_read_offset_align offset:
If non-zero this value must be smaller than stx_dio_offset_align which must be provided by the file system.
The proposed code sets stx_dio_read_offset_align and stx_dio_offset_align to the same value in some cases.
Perhaps the documentation should say "less than or equal to"?
Also, the claim that stx_dio_offset_align "must be provided by the file system" if stx_dio_read_offset_align is nonzero should probably be conditional on STATX_DIOALIGN being provided too.
- Eric
Re: [PATCH 4/5] xfs: report the correct read/write dio alignment for reflinked inodes
Quoted 10 lines · Eric Biggers
This contradicts the proposed man page, which says the following about
stx_dio_read_offset_alignoffset:If non-zero this value must be smaller than
stx_dio_offset_alignwhich must be provided by the file system.The proposed code sets
stx_dio_read_offset_alignandstx_dio_offset_alignto the same value in some cases.Perhaps the documentation should say "less than or equal to"?
Yes, I'll fix it up.
Quoted 3 lines
Also, the claim that
stx_dio_offset_align"must be provided by the file system" ifstx_dio_read_offset_alignis nonzero should probably be conditional onSTATX_DIOALIGNbeing provided too.
I'll add a "if requested" to the man page.
PATCH 5/5 xfs: report larger dio alignment for COW inodes
In reply to Christoph HellwigFor I/O to reflinked blocks we always need to write an entire new file system block, and the code enforces the file system block alignment for the entire file if it has any reflinked blocks. Mirror the larger value reported in the statx in the dio_offset_align in the xfs-specific XFS_IOC_DIOINFO ioctl for the same reason.
Don't bother adding a new field for the read alignment to this legacy ioctl as all new users should use statx instead.
--- fs/xfs/xfs_ioctl.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
fs/xfs/xfs_ioctl.c +10 -1
@@ -1204,7 +1204,16 @@ xfs_file_ioctl(struct xfs_buftarg *target =xfs_inode_buftarg (ip);struct dioattr da; - da.d_mem = da.d_miniosz = target->bt_logical_sectorsize; + da.d_mem = target->bt_logical_sectorsize; + +/* +* See xfs_report_dioalign() why report a potential larger than +* sector sizevalue here for COW inodes. +*/ +if (xfs_is_cow_inode (ip)) + da.d_miniosz =xfs_inode_alloc_unitsize (ip); +else + da.d_miniosz = target->bt_logical_sectorsize; da.d_maxiosz =INT_MAX & ~(da.d_miniosz -1 );if (copy_to_user (arg, &da,sizeof (da)))
Signature · 1 line
2.45.2
Re: [PATCH 5/5] xfs: report larger dio alignment for COW inodes
Quoted 19 lines · Christoph Hellwig
For I/O to reflinked blocks we always need to write an entire new file system block, and the code enforces the file system block alignment for the entire file if it has any reflinked blocks. Mirror the larger value reported in the statx in the
dio_offset_alignin the xfs-specificXFS_IOC_DIOINFOioctl for the same reason.Don't bother adding a new field for the read alignment to this legacy ioctl as all new users should use statx instead.
Signed-off-by Christoph Hellwig <[email protected]>--- fs/xfs/xfs_ioctl.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)fs/xfs/xfs_ioctl.c +0
-0
fs/xfs/xfs_ioctl.c xfs_file_ioctl( · line 1211
Quoted 9 lines
fs/xfs/xfs_ioctl.c +5
-1@@ -1204,7 +1204,16 @@ xfs_file_ioctl(struct xfs_buftarg *target =xfs_inode_buftarg (ip);struct dioattr da; - da.d_mem = da.d_miniosz = target->bt_logical_sectorsize; + da.d_mem = target->bt_logical_sectorsize; + +/* +* See xfs_report_dioalign() why report a potential larger than +* sector sizevalue here for COW inodes.
nit: sizevalue
Quoted 8 lines
fs/xfs/xfs_ioctl.c +5
-0+*/ +if (xfs_is_cow_inode (ip)) + da.d_miniosz =xfs_inode_alloc_unitsize (ip); +else + da.d_miniosz = target->bt_logical_sectorsize; da.d_maxiosz =INT_MAX & ~(da.d_miniosz -1 );if (copy_to_user (arg, &da,sizeof (da)))
Darrick J. Wong
Reviewed-byRe: [PATCH 5/5] xfs: report larger dio alignment for COW inodes
Quoted 15 lines · John Garry
Quoted 14 lines · Christoph Hellwig
For I/O to reflinked blocks we always need to write an entire new file system block, and the code enforces the file system block alignment for the entire file if it has any reflinked blocks. Mirror the larger value reported in the statx in the
dio_offset_alignin the xfs-specificXFS_IOC_DIOINFOioctl for the same reason.Don't bother adding a new field for the read alignment to this legacy ioctl as all new users should use statx instead.
Signed-off-by Christoph Hellwig <[email protected]>--- fs/xfs/xfs_ioctl.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
Quoted 15 lines
fs/xfs/xfs_ioctl.c xfs_file_ioctl( · line 1210
Quoted 13 lines
fs/xfs/xfs_ioctl.c +5
-1@@ -1204,7 +1204,16 @@ xfs_file_ioctl(struct xfs_buftarg *target =xfs_inode_buftarg (ip);struct dioattr da; - da.d_mem = da.d_miniosz = target->bt_logical_sectorsize; + da.d_mem = target->bt_logical_sectorsize; + +/* +* See xfs_report_dioalign() why report a potential larger than +* sector sizevalue here for COW inodes. nit: sizevalue
The sentence reads oddly to me; how about:
"See xfs_report_dioalign() for an explanation about why we report a value larger than the sector size for COW inodes."?
The code change looks ok though.
--D
Quoted 9 lines
Quoted 7 lines
fs/xfs/xfs_ioctl.c +5
-0+*/ +if (xfs_is_cow_inode (ip)) + da.d_miniosz =xfs_inode_alloc_unitsize (ip); +else + da.d_miniosz = target->bt_logical_sectorsize; da.d_maxiosz =INT_MAX & ~(da.d_miniosz -1 );if (copy_to_user (arg, &da,sizeof (da)))
PATCH 1/1 statx.2: document STATX_DIO_READ_ALIGN
In reply to Christoph HellwigDocument the new STATX_DIO_READ_ALIGN flag and the new stx_dio_read_offset_align field guarded by it.
--- man/man2/statx.2 | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-)
man/man2/statx.2 +25 -1
@@ -76,6 +76,9 @@ struct statx { __u32 stx_atomic_write_unit_min; __u32 stx_atomic_write_unit_max; __u32 stx_atomic_write_segments_max; + + /* File offset alignment for direct I/O reads */ + __u32 stx_dio_read_offset_align; }; .EE .in
@@ -261,7 +264,7 @@ STATX_BTIME Want stx_btime STATX_ALL The same as STATX_BASIC_STATS | STATX_BTIME. It is deprecated and should not be used. STATX_MNT_ID Want stx_mnt_id (since Linux 5.8) -STATX_DIOALIGN Want stx_dio_mem_align and stx_dio_offset_align +STATX_DIOALIGN Want stx_dio_mem_align and stx_dio_offset_align. (since Linux 6.1; support varies by filesystem) STATX_MNT_ID_UNIQUE Want unique stx_mnt_id (since Linux 6.8) STATX_SUBVOL Want stx_subvol
@@ -270,6 +273,8 @@ STATX_WRITE_ATOMIC Want stx_atomic_write_unit_min, stx_atomic_write_unit_max, and stx_atomic_write_segments_max. (since Linux 6.11; support varies by filesystem) +STATX_DIO_READ_ALIGN Want stx_dio_read_offset_align. + (since Linux 6.14; support varies by filesystem) .TE .in .P
@@ -467,6 +472,25 @@ This will only be nonzero if .I stx_dio_mem_align is nonzero, and vice versa. .TP +.I stx_dio_read_offset_align +The alignment (in bytes) required for file offsets and I/O segment lengths for +direct I/O reads +.RB ( O_DIRECT ) +on this file. +If zero the limit in +.I stx_dio_offset_align +applies for reads as well. +If non-zero this value must be smaller than +.I stx_dio_offset_align +which must be provided by the file system. +The memory alignment in +.I stx_dio_mem_align +is not affected by this value. +.IP +.B STATX_DIO_READ_ALIGN +.RI ( stx_dio_offset_align ) +is supported by xfs on regular files since Linux 6.14. +.TP .I stx_subvol Subvolume number of the current file. .IP
Signature · 1 line
2.45.2
Re: [PATCH] statx.2: document STATX_DIO_READ_ALIGN
Quoted 41 lines · Christoph Hellwig
Document the new
STATX_DIO_READ_ALIGNflag and the newstx_dio_read_offset_alignfield guarded by it.Signed-off-by Christoph Hellwig <[email protected]>--- man/man2/statx.2 | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-)man/man2/statx.2 +6
-1@@ -76,6 +76,9 @@ struct statx { __u32 stx_atomic_write_unit_min; __u32 stx_atomic_write_unit_max; __u32 stx_atomic_write_segments_max; + + /* File offset alignment for direct I/O reads */ + __u32 stx_dio_read_offset_align; }; .EE .in@@ -261,7 +264,7 @@ STATX_BTIME Want stx_btime STATX_ALL The same as STATX_BASIC_STATS | STATX_BTIME. It is deprecated and should not be used. STATX_MNT_ID Want stx_mnt_id (since Linux 5.8) -STATX_DIOALIGN Want stx_dio_mem_align and stx_dio_offset_align +STATX_DIOALIGN Want stx_dio_mem_align and stx_dio_offset_align. (since Linux 6.1; support varies by filesystem) STATX_MNT_ID_UNIQUE Want unique stx_mnt_id (since Linux 6.8) STATX_SUBVOL Want stx_subvol@@ -270,6 +273,8 @@ STATX_WRITE_ATOMIC Want stx_atomic_write_unit_min, stx_atomic_write_unit_max, and stx_atomic_write_segments_max. (since Linux 6.11; support varies by filesystem) +STATX_DIO_READ_ALIGN Want stx_dio_read_offset_align. + (since Linux 6.14; support varies by filesystem) .TE .in .P
man/man2/statx.2 This will only be nonzero if · line 480
Quoted 9 lines
man/man2/statx.2 +6
-0@@ -467,6 +472,25 @@ This will only be nonzero if .I stx_dio_mem_align is nonzero, and vice versa. .TP +.I stx_dio_read_offset_align +The alignment (in bytes) required for file offsets and I/O segment lengths for +direct I/O reads +.RB ( O_DIRECT ) +on this file. +If zero the limit in
nit: add a comma here (really a dependent clause) to make it clearer that 'zero' isn't being used as a verb here:
"If zero, the limit in..."
man/man2/statx.2 This will only be nonzero if · line 483
Quoted 3 lines
man/man2/statx.2 +3
-0+.I stx_dio_offset_align +applies for reads as well. +If non-zero this value must be smaller than
Same here.
"If non-zero, this value..."
With that fixed,
--D
Quoted 17 lines
man/man2/statx.2 +10
-0+.I stx_dio_offset_align +which must be provided by the file system. +The memory alignment in +.I stx_dio_mem_align +is not affected by this value. +.IP +.B STATX_DIO_READ_ALIGN +.RI ( stx_dio_offset_align ) +is supported by xfs on regular files since Linux 6.14. +.TP .I stx_subvol Subvolume number of the current file. .IPSignature · 1 line
2.45.2