2024-04-22 14:42:02

by John Garry

[permalink] [raw]
Subject: [PATCH RFC 1/7] fs: Rename STATX{_ATTR}_WRITE_ATOMIC -> STATX{_ATTR}_WRITE_ATOMIC_DIO

Rename STATX_WRITE_ATOMIC -> STATX_WRITE_ATOMIC_DIO and
STATX_ATTR_WRITE_ATOMIC -> STATX_ATTR_WRITE_ATOMIC_DIO, to make it clear
that they are only relevant to direct IO.

Signed-off-by: John Garry <[email protected]>
---
block/bdev.c | 6 +++---
fs/stat.c | 10 +++++-----
fs/xfs/xfs_iops.c | 2 +-
include/uapi/linux/stat.h | 4 ++--
4 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/block/bdev.c b/block/bdev.c
index f3dd9f3c8838..e2a9951bd2e9 100644
--- a/block/bdev.c
+++ b/block/bdev.c
@@ -1182,14 +1182,14 @@ void sync_bdevs(bool wait)
}

/*
- * Handle STATX_{DIOALIGN, WRITE_ATOMIC} for block devices.
+ * Handle STATX_{DIOALIGN, WRITE_ATOMIC_DIO} for block devices.
*/
void bdev_statx(struct inode *backing_inode, struct kstat *stat,
u32 request_mask)
{
struct block_device *bdev;

- if (!(request_mask & (STATX_DIOALIGN | STATX_WRITE_ATOMIC)))
+ if (!(request_mask & (STATX_DIOALIGN | STATX_WRITE_ATOMIC_DIO)))
return;

/*
@@ -1208,7 +1208,7 @@ void bdev_statx(struct inode *backing_inode, struct kstat *stat,
stat->result_mask |= STATX_DIOALIGN;
}

- if (request_mask & STATX_WRITE_ATOMIC && bdev_can_atomic_write(bdev)) {
+ if (request_mask & STATX_WRITE_ATOMIC_DIO && bdev_can_atomic_write(bdev)) {
struct request_queue *bd_queue = bdev->bd_queue;

generic_fill_statx_atomic_writes(stat,
diff --git a/fs/stat.c b/fs/stat.c
index 0e296925a56b..0c0c4c22c563 100644
--- a/fs/stat.c
+++ b/fs/stat.c
@@ -95,18 +95,18 @@ EXPORT_SYMBOL(generic_fill_statx_attr);
* @unit_min: Minimum supported atomic write length in bytes
* @unit_max: Maximum supported atomic write length in bytes
*
- * Fill in the STATX{_ATTR}_WRITE_ATOMIC flags in the kstat structure from
- * atomic write unit_min and unit_max values.
+ * Fill in the STATX{_ATTR}_WRITE_ATOMIC_DIO flags in the kstat structure
+ * from atomic write unit_min and unit_max values.
*/
void generic_fill_statx_atomic_writes(struct kstat *stat,
unsigned int unit_min,
unsigned int unit_max)
{
/* Confirm that the request type is known */
- stat->result_mask |= STATX_WRITE_ATOMIC;
+ stat->result_mask |= STATX_WRITE_ATOMIC_DIO;

/* Confirm that the file attribute type is known */
- stat->attributes_mask |= STATX_ATTR_WRITE_ATOMIC;
+ stat->attributes_mask |= STATX_ATTR_WRITE_ATOMIC_DIO;

if (unit_min) {
stat->atomic_write_unit_min = unit_min;
@@ -115,7 +115,7 @@ void generic_fill_statx_atomic_writes(struct kstat *stat,
stat->atomic_write_segments_max = 1;

/* Confirm atomic writes are actually supported */
- stat->attributes |= STATX_ATTR_WRITE_ATOMIC;
+ stat->attributes |= STATX_ATTR_WRITE_ATOMIC_DIO;
}
}
EXPORT_SYMBOL_GPL(generic_fill_statx_atomic_writes);
diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c
index 2de0a9c4e6e0..37076176db67 100644
--- a/fs/xfs/xfs_iops.c
+++ b/fs/xfs/xfs_iops.c
@@ -650,7 +650,7 @@ 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) {
+ if (request_mask & STATX_WRITE_ATOMIC_DIO) {
unsigned int unit_min, unit_max;

xfs_get_atomic_write_attr(ip, &unit_min, &unit_max);
diff --git a/include/uapi/linux/stat.h b/include/uapi/linux/stat.h
index 319ef4afb89e..05f9720d4030 100644
--- a/include/uapi/linux/stat.h
+++ b/include/uapi/linux/stat.h
@@ -160,7 +160,7 @@ struct statx {
#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_WRITE_ATOMIC 0x00008000U /* Want/got atomic_write_* fields */
+#define STATX_WRITE_ATOMIC_DIO 0x00008000U /* Want/got atomic_write_* fields for dio */

#define STATX__RESERVED 0x80000000U /* Reserved for future struct statx expansion */

@@ -196,7 +196,7 @@ struct statx {
#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 */
+#define STATX_ATTR_WRITE_ATOMIC_DIO 0x00400000 /* File supports atomic write dio operations */


#endif /* _UAPI_LINUX_STAT_H */
--
2.31.1