From f2b51fa65536f7172de4252b56c7b16d222d8178 Mon Sep 17 00:00:00 2001 From: "Darrick J. Wong" Date: Thu, 24 Apr 2025 14:42:36 -0700 Subject: [PATCH] fuse2fs: report nanoseconds resolution through getattr Report the nanonseconds component of timestamps via getattr, and tell fuse that we actually support nanosecond granularity. Signed-off-by: Darrick J. Wong Link: https://lore.kernel.org/r/174553065051.1160461.5080284869849276746.stgit@frogsfrogsfrogs Signed-off-by: Theodore Ts'o --- misc/fuse2fs.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/misc/fuse2fs.c b/misc/fuse2fs.c index bacbec2..a35986f 100644 --- a/misc/fuse2fs.c +++ b/misc/fuse2fs.c @@ -587,6 +587,9 @@ static void *op_init(struct fuse_conn_info *conn #ifdef FUSE_CAP_IOCTL_DIR conn->want |= FUSE_CAP_IOCTL_DIR; #endif +#if FUSE_VERSION >= FUSE_MAKE_VERSION(3, 0) + conn->time_gran = 1; +#endif if (fs->flags & EXT2_FLAG_RW) { fs->super->s_mnt_count++; ext2fs_set_tstamp(fs->super, s_mtime, time(NULL)); @@ -635,10 +638,13 @@ static int stat_inode(ext2_filsys fs, ext2_ino_t ino, struct stat *statbuf) (struct ext2_inode *)&inode); EXT4_INODE_GET_XTIME(i_atime, &tv, &inode); statbuf->st_atime = tv.tv_sec; + statbuf->st_atim.tv_nsec = tv.tv_nsec; EXT4_INODE_GET_XTIME(i_mtime, &tv, &inode); statbuf->st_mtime = tv.tv_sec; + statbuf->st_mtim.tv_nsec = tv.tv_nsec; EXT4_INODE_GET_XTIME(i_ctime, &tv, &inode); statbuf->st_ctime = tv.tv_sec; + statbuf->st_ctim.tv_nsec = tv.tv_nsec; if (LINUX_S_ISCHR(inode.i_mode) || LINUX_S_ISBLK(inode.i_mode)) { if (inode.i_block[0]) -- 1.8.3.1