[PATCH RFC 6/7] fs: xfs: buffered atomic writes statx support

From: John Garry
Date: Mon Apr 22 2024 - 10:41:34 EST


For filling in the statx fields, we use the extent alignment as the
buffered atomic writes size. Only a single size is permitted.

Signed-off-by: John Garry <john.g.garry@xxxxxxxxxx>
---
fs/xfs/xfs_iops.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c
index 05b20c88ff77..d2226df567ca 100644
--- a/fs/xfs/xfs_iops.c
+++ b/fs/xfs/xfs_iops.c
@@ -650,12 +650,19 @@ xfs_vn_getattr(
stat->dio_mem_align = bdev_dma_alignment(bdev) + 1;
stat->dio_offset_align = bdev_logical_block_size(bdev);
}
- if (request_mask & STATX_WRITE_ATOMIC_DIO) {
+ if (request_mask & STATX_WRITE_ATOMIC_DIO &&
+ !(request_mask & STATX_WRITE_ATOMIC_BUF)) {
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, true);
+ } else if (request_mask & STATX_WRITE_ATOMIC_BUF) {
+ unsigned int unit_min, unit_max;
+
+ xfs_get_atomic_write_attr(ip, &unit_min, &unit_max);
+ generic_fill_statx_atomic_writes(stat,
+ unit_max, unit_max, false);
}
fallthrough;
default:
--
2.31.1