diff mbox series

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

Message ID 20240422143923.3927601-7-john.g.garry@oracle.com (mailing list archive)
State New
Headers show
Series buffered block atomic writes | expand

Commit Message

John Garry April 22, 2024, 2:39 p.m. UTC
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@oracle.com>
---
 fs/xfs/xfs_iops.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
diff mbox series

Patch

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: