diff options
author | Chung-Chiang Cheng <cccheng@synology.com> | 2022-05-03 23:25:35 +0800 |
---|---|---|
committer | akpm <akpm@linux-foundation.org> | 2022-05-19 14:10:31 -0700 |
commit | 30abce053f811f52688a5b739c3e4ba98d34070d (patch) | |
tree | 80a64ff42bcb18125fa8a36c58054356f37fbee6 /fs/fat/file.c | |
parent | 0f9d148167c53a7029aba29cdc45072027033b72 (diff) |
fat: report creation time in statx
creation time is no longer mixed with change time. Add an in-memory field
for it, and report it in statx if supported.
Link: https://lkml.kernel.org/r/20220503152536.2503003-3-cccheng@synology.com
Signed-off-by: Chung-Chiang Cheng <cccheng@synology.com>
Acked-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'fs/fat/file.c')
-rw-r--r-- | fs/fat/file.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/fs/fat/file.c b/fs/fat/file.c index a5a309fcc7fa..8f5218450a3a 100644 --- a/fs/fat/file.c +++ b/fs/fat/file.c @@ -399,13 +399,21 @@ int fat_getattr(struct user_namespace *mnt_userns, const struct path *path, struct kstat *stat, u32 request_mask, unsigned int flags) { struct inode *inode = d_inode(path->dentry); + struct msdos_sb_info *sbi = MSDOS_SB(inode->i_sb); + generic_fillattr(mnt_userns, inode, stat); - stat->blksize = MSDOS_SB(inode->i_sb)->cluster_size; + stat->blksize = sbi->cluster_size; - if (MSDOS_SB(inode->i_sb)->options.nfs == FAT_NFS_NOSTALE_RO) { + if (sbi->options.nfs == FAT_NFS_NOSTALE_RO) { /* Use i_pos for ino. This is used as fileid of nfs. */ - stat->ino = fat_i_pos_read(MSDOS_SB(inode->i_sb), inode); + stat->ino = fat_i_pos_read(sbi, inode); } + + if (sbi->options.isvfat && request_mask & STATX_BTIME) { + stat->result_mask |= STATX_BTIME; + stat->btime = MSDOS_I(inode)->i_crtime; + } + return 0; } EXPORT_SYMBOL_GPL(fat_getattr); |