diff options
| author | Ritesh Harjani (IBM) <ritesh.list@gmail.com> | 2024-11-04 16:22:57 -0800 |
|---|---|---|
| committer | Darrick J. Wong <djwong@djwong.org> | 2024-11-05 16:20:40 -0800 |
| commit | 6dfc1c1d597f8b6ebffe25f51f013494994f9b84 (patch) | |
| tree | e64660607ace30ab81969d672e8bc0c11be3cc84 /fs/ext4/inode.c | |
| parent | 3af5298ce94bb672845adadf347874ba5bcfad2c (diff) | |
| download | linux-next-6dfc1c1d597f8b6ebffe25f51f013494994f9b84.tar.gz linux-next-6dfc1c1d597f8b6ebffe25f51f013494994f9b84.zip | |
ext4: Add statx support for atomic writes
This patch adds base support for atomic writes via statx getattr.
On bs < ps systems, we can create FS with say bs of 16k. That means
both atomic write min and max unit can be set to 16k for supporting
atomic writes.
Co-developed-by: Ojaswin Mujoo <ojaswin@linux.ibm.com>
Signed-off-by: Ojaswin Mujoo <ojaswin@linux.ibm.com>
Signed-off-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/ext4/inode.c')
| -rw-r--r-- | fs/ext4/inode.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 54bdd4884fe6..3e827cfa762e 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -5578,6 +5578,18 @@ int ext4_getattr(struct mnt_idmap *idmap, const struct path *path, } } + if ((request_mask & STATX_WRITE_ATOMIC) && S_ISREG(inode->i_mode)) { + struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb); + unsigned int awu_min = 0, awu_max = 0; + + if (ext4_inode_can_atomic_write(inode)) { + awu_min = sbi->s_awu_min; + awu_max = sbi->s_awu_max; + } + + generic_fill_statx_atomic_writes(stat, awu_min, awu_max); + } + flags = ei->i_flags & EXT4_FL_USER_VISIBLE; if (flags & EXT4_APPEND_FL) stat->attributes |= STATX_ATTR_APPEND; |
