* [f2fs-dev] [PATCH v7 01/13] fs: remove silly warning from current_time
2023-08-07 19:38 [f2fs-dev] [PATCH v7 00/13] fs: implement multigrain timestamps Jeff Layton
@ 2023-08-07 19:38 ` Jeff Layton
2023-08-08 9:05 ` Jan Kara
2023-08-07 19:38 ` [f2fs-dev] [PATCH v7 02/13] fs: pass the request_mask to generic_fillattr Jeff Layton
` (13 subsequent siblings)
14 siblings, 1 reply; 76+ messages in thread
From: Jeff Layton @ 2023-08-07 19:38 UTC (permalink / raw)
To: Alexander Viro, Christian Brauner, Eric Van Hensbergen,
Latchesar Ionkov, Dominique Martinet, Christian Schoenebeck,
David Howells, Marc Dionne, Chris Mason, Josef Bacik,
David Sterba, Xiubo Li, Ilya Dryomov, Jan Harkes, coda,
Tyler Hicks, Gao Xiang, Chao Yu, Yue Hu, Jeffle Xu, Namjae Jeon,
Sungjong Seo, Jan Kara, Theodore Ts'o, Andreas Dilger,
Jaegeuk Kim, OGAWA Hirofumi, Miklos Szeredi, Bob Peterson,
Andreas Gruenbacher, Greg Kroah-Hartman, Tejun Heo,
Trond Myklebust, Anna Schumaker, Konstantin Komarov, Mark Fasheh,
Joel Becker, Joseph Qi, Mike Marshall, Martin Brandenburg,
Luis Chamberlain, Kees Cook, Iurii Zaikin, Steve French,
Paulo Alcantara, Ronnie Sahlberg, Shyam Prasad N, Tom Talpey,
Sergey Senozhatsky, Richard Weinberger, Hans de Goede,
Hugh Dickins, Andrew Morton, Amir Goldstein, Darrick J. Wong,
Benjamin Coddington
Cc: Jeff Layton, linux-kernel, linux-mm, linux-mtd, linux-afs,
linux-cifs, codalist, cluster-devel, linux-ext4, devel, ecryptfs,
ocfs2-devel, ceph-devel, linux-nfs, v9fs, samba-technical,
linux-unionfs, linux-f2fs-devel, linux-xfs, linux-fsdevel, ntfs3,
linux-erofs, linux-btrfs
An inode with no superblock? Unpossible!
Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
fs/inode.c | 6 ------
1 file changed, 6 deletions(-)
diff --git a/fs/inode.c b/fs/inode.c
index d4ab92233062..3fc251bfaf73 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -2495,12 +2495,6 @@ struct timespec64 current_time(struct inode *inode)
struct timespec64 now;
ktime_get_coarse_real_ts64(&now);
-
- if (unlikely(!inode->i_sb)) {
- WARN(1, "current_time() called with uninitialized super_block in the inode");
- return now;
- }
-
return timestamp_truncate(now, inode);
}
EXPORT_SYMBOL(current_time);
--
2.41.0
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply related [flat|nested] 76+ messages in thread
* Re: [f2fs-dev] [PATCH v7 01/13] fs: remove silly warning from current_time
2023-08-07 19:38 ` [f2fs-dev] [PATCH v7 01/13] fs: remove silly warning from current_time Jeff Layton
@ 2023-08-08 9:05 ` Jan Kara
0 siblings, 0 replies; 76+ messages in thread
From: Jan Kara @ 2023-08-08 9:05 UTC (permalink / raw)
To: Jeff Layton
Cc: Latchesar Ionkov, Martin Brandenburg, Konstantin Komarov,
linux-xfs, Darrick J. Wong, Dominique Martinet,
Christian Schoenebeck, ecryptfs, linux-unionfs, David Howells,
Chris Mason, Andreas Dilger, Hans de Goede, Marc Dionne, codalist,
linux-afs, linux-mtd, Mike Marshall, Paulo Alcantara, linux-cifs,
Eric Van Hensbergen, Andreas Gruenbacher, Miklos Szeredi,
Richard Weinberger, Mark Fasheh, Hugh Dickins,
Benjamin Coddington, Tyler Hicks, cluster-devel, coda, linux-mm,
Ilya Dryomov, Iurii Zaikin, Namjae Jeon, Trond Myklebust,
Shyam Prasad N, Amir Goldstein, Kees Cook, ocfs2-devel,
Josef Bacik, Tom Talpey, Tejun Heo, Yue Hu, Alexander Viro,
Ronnie Sahlberg, David Sterba, Jaegeuk Kim, ceph-devel, Xiubo Li,
Gao Xiang, OGAWA Hirofumi, Jan Harkes, Christian Brauner,
linux-ext4, Theodore Ts'o, Joseph Qi, Greg Kroah-Hartman,
v9fs, ntfs3, samba-technical, linux-kernel, linux-f2fs-devel,
Steve French, Sergey Senozhatsky, Luis Chamberlain, Jeffle Xu,
devel, Anna Schumaker, Jan Kara, Bob Peterson, linux-fsdevel,
Andrew Morton, Sungjong Seo, linux-erofs, linux-nfs, linux-btrfs,
Joel Becker
On Mon 07-08-23 15:38:32, Jeff Layton wrote:
> An inode with no superblock? Unpossible!
>
> Signed-off-by: Jeff Layton <jlayton@kernel.org>
Looks good. Feel free to add:
Reviewed-by: Jan Kara <jack@suse.cz>
Honza
> ---
> fs/inode.c | 6 ------
> 1 file changed, 6 deletions(-)
>
> diff --git a/fs/inode.c b/fs/inode.c
> index d4ab92233062..3fc251bfaf73 100644
> --- a/fs/inode.c
> +++ b/fs/inode.c
> @@ -2495,12 +2495,6 @@ struct timespec64 current_time(struct inode *inode)
> struct timespec64 now;
>
> ktime_get_coarse_real_ts64(&now);
> -
> - if (unlikely(!inode->i_sb)) {
> - WARN(1, "current_time() called with uninitialized super_block in the inode");
> - return now;
> - }
> -
> return timestamp_truncate(now, inode);
> }
> EXPORT_SYMBOL(current_time);
>
> --
> 2.41.0
>
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply [flat|nested] 76+ messages in thread
* [f2fs-dev] [PATCH v7 02/13] fs: pass the request_mask to generic_fillattr
2023-08-07 19:38 [f2fs-dev] [PATCH v7 00/13] fs: implement multigrain timestamps Jeff Layton
2023-08-07 19:38 ` [f2fs-dev] [PATCH v7 01/13] fs: remove silly warning from current_time Jeff Layton
@ 2023-08-07 19:38 ` Jeff Layton
2023-08-07 19:38 ` [f2fs-dev] [PATCH v7 03/13] fs: drop the timespec64 arg from generic_update_time Jeff Layton
` (12 subsequent siblings)
14 siblings, 0 replies; 76+ messages in thread
From: Jeff Layton @ 2023-08-07 19:38 UTC (permalink / raw)
To: Alexander Viro, Christian Brauner, Eric Van Hensbergen,
Latchesar Ionkov, Dominique Martinet, Christian Schoenebeck,
David Howells, Marc Dionne, Chris Mason, Josef Bacik,
David Sterba, Xiubo Li, Ilya Dryomov, Jan Harkes, coda,
Tyler Hicks, Gao Xiang, Chao Yu, Yue Hu, Jeffle Xu, Namjae Jeon,
Sungjong Seo, Jan Kara, Theodore Ts'o, Andreas Dilger,
Jaegeuk Kim, OGAWA Hirofumi, Miklos Szeredi, Bob Peterson,
Andreas Gruenbacher, Greg Kroah-Hartman, Tejun Heo,
Trond Myklebust, Anna Schumaker, Konstantin Komarov, Mark Fasheh,
Joel Becker, Joseph Qi, Mike Marshall, Martin Brandenburg,
Luis Chamberlain, Kees Cook, Iurii Zaikin, Steve French,
Paulo Alcantara, Ronnie Sahlberg, Shyam Prasad N, Tom Talpey,
Sergey Senozhatsky, Richard Weinberger, Hans de Goede,
Hugh Dickins, Andrew Morton, Amir Goldstein, Darrick J. Wong,
Benjamin Coddington
Cc: Jan Kara, Jeff Layton, linux-kernel, linux-mm, linux-mtd,
linux-afs, linux-cifs, codalist, cluster-devel, linux-ext4, devel,
ecryptfs, ocfs2-devel, ceph-devel, linux-nfs, v9fs,
samba-technical, linux-unionfs, linux-f2fs-devel, linux-xfs,
linux-fsdevel, ntfs3, linux-erofs, linux-btrfs
generic_fillattr just fills in the entire stat struct indiscriminately
today, copying data from the inode. There is at least one attribute
(STATX_CHANGE_COOKIE) that can have side effects when it is reported,
and we're looking at adding more with the addition of multigrain
timestamps.
Add a request_mask argument to generic_fillattr and have most callers
just pass in the value that is passed to getattr. Have other callers
(e.g. ksmbd) just pass in STATX_BASIC_STATS. Also move the setting of
STATX_CHANGE_COOKIE into generic_fillattr.
Acked-by: Joseph Qi <joseph.qi@linux.alibaba.com>
Reviewed-by: Xiubo Li <xiubli@redhat.com>
Reviewed-by: "Paulo Alcantara (SUSE)" <pc@manguebit.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
fs/9p/vfs_inode.c | 4 ++--
fs/9p/vfs_inode_dotl.c | 4 ++--
fs/afs/inode.c | 2 +-
fs/btrfs/inode.c | 2 +-
fs/ceph/inode.c | 2 +-
fs/coda/inode.c | 3 ++-
fs/ecryptfs/inode.c | 5 +++--
fs/erofs/inode.c | 2 +-
fs/exfat/file.c | 2 +-
fs/ext2/inode.c | 2 +-
fs/ext4/inode.c | 2 +-
fs/f2fs/file.c | 2 +-
fs/fat/file.c | 2 +-
fs/fuse/dir.c | 2 +-
fs/gfs2/inode.c | 2 +-
fs/hfsplus/inode.c | 2 +-
fs/kernfs/inode.c | 2 +-
fs/libfs.c | 4 ++--
fs/minix/inode.c | 2 +-
fs/nfs/inode.c | 2 +-
fs/nfs/namespace.c | 3 ++-
fs/ntfs3/file.c | 2 +-
fs/ocfs2/file.c | 2 +-
fs/orangefs/inode.c | 2 +-
fs/proc/base.c | 4 ++--
fs/proc/fd.c | 2 +-
fs/proc/generic.c | 2 +-
fs/proc/proc_net.c | 2 +-
fs/proc/proc_sysctl.c | 2 +-
fs/proc/root.c | 3 ++-
fs/smb/client/inode.c | 2 +-
fs/smb/server/smb2pdu.c | 22 +++++++++++-----------
fs/smb/server/vfs.c | 3 ++-
fs/stat.c | 24 +++++++++++++-----------
fs/sysv/itree.c | 3 ++-
fs/ubifs/dir.c | 2 +-
fs/udf/symlink.c | 2 +-
fs/vboxsf/utils.c | 2 +-
include/linux/fs.h | 2 +-
mm/shmem.c | 2 +-
40 files changed, 73 insertions(+), 65 deletions(-)
diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c
index 16d85e6033a3..d24d1f20e922 100644
--- a/fs/9p/vfs_inode.c
+++ b/fs/9p/vfs_inode.c
@@ -1016,7 +1016,7 @@ v9fs_vfs_getattr(struct mnt_idmap *idmap, const struct path *path,
p9_debug(P9_DEBUG_VFS, "dentry: %p\n", dentry);
v9ses = v9fs_dentry2v9ses(dentry);
if (v9ses->cache & (CACHE_META|CACHE_LOOSE)) {
- generic_fillattr(&nop_mnt_idmap, inode, stat);
+ generic_fillattr(&nop_mnt_idmap, request_mask, inode, stat);
return 0;
} else if (v9ses->cache & CACHE_WRITEBACK) {
if (S_ISREG(inode->i_mode)) {
@@ -1037,7 +1037,7 @@ v9fs_vfs_getattr(struct mnt_idmap *idmap, const struct path *path,
return PTR_ERR(st);
v9fs_stat2inode(st, d_inode(dentry), dentry->d_sb, 0);
- generic_fillattr(&nop_mnt_idmap, d_inode(dentry), stat);
+ generic_fillattr(&nop_mnt_idmap, request_mask, d_inode(dentry), stat);
p9stat_free(st);
kfree(st);
diff --git a/fs/9p/vfs_inode_dotl.c b/fs/9p/vfs_inode_dotl.c
index 464ea73d1bf8..8e8d5d2a13d8 100644
--- a/fs/9p/vfs_inode_dotl.c
+++ b/fs/9p/vfs_inode_dotl.c
@@ -451,7 +451,7 @@ v9fs_vfs_getattr_dotl(struct mnt_idmap *idmap,
p9_debug(P9_DEBUG_VFS, "dentry: %p\n", dentry);
v9ses = v9fs_dentry2v9ses(dentry);
if (v9ses->cache & (CACHE_META|CACHE_LOOSE)) {
- generic_fillattr(&nop_mnt_idmap, inode, stat);
+ generic_fillattr(&nop_mnt_idmap, request_mask, inode, stat);
return 0;
} else if (v9ses->cache) {
if (S_ISREG(inode->i_mode)) {
@@ -476,7 +476,7 @@ v9fs_vfs_getattr_dotl(struct mnt_idmap *idmap,
return PTR_ERR(st);
v9fs_stat2inode_dotl(st, d_inode(dentry), 0);
- generic_fillattr(&nop_mnt_idmap, d_inode(dentry), stat);
+ generic_fillattr(&nop_mnt_idmap, request_mask, d_inode(dentry), stat);
/* Change block size to what the server returned */
stat->blksize = st->st_blksize;
diff --git a/fs/afs/inode.c b/fs/afs/inode.c
index 6b636f43f548..1c794a1896aa 100644
--- a/fs/afs/inode.c
+++ b/fs/afs/inode.c
@@ -773,7 +773,7 @@ int afs_getattr(struct mnt_idmap *idmap, const struct path *path,
do {
read_seqbegin_or_lock(&vnode->cb_lock, &seq);
- generic_fillattr(&nop_mnt_idmap, inode, stat);
+ generic_fillattr(&nop_mnt_idmap, request_mask, inode, stat);
if (test_bit(AFS_VNODE_SILLY_DELETED, &vnode->flags) &&
stat->nlink > 0)
stat->nlink -= 1;
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index ceac62c1cbfc..29a20f828dda 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -8746,7 +8746,7 @@ static int btrfs_getattr(struct mnt_idmap *idmap,
STATX_ATTR_IMMUTABLE |
STATX_ATTR_NODUMP);
- generic_fillattr(idmap, inode, stat);
+ generic_fillattr(idmap, request_mask, inode, stat);
stat->dev = BTRFS_I(inode)->root->anon_dev;
spin_lock(&BTRFS_I(inode)->lock);
diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c
index 5f6e93714f5a..fd05d68e2990 100644
--- a/fs/ceph/inode.c
+++ b/fs/ceph/inode.c
@@ -2467,7 +2467,7 @@ int ceph_getattr(struct mnt_idmap *idmap, const struct path *path,
return err;
}
- generic_fillattr(&nop_mnt_idmap, inode, stat);
+ generic_fillattr(&nop_mnt_idmap, request_mask, inode, stat);
stat->ino = ceph_present_inode(inode);
/*
diff --git a/fs/coda/inode.c b/fs/coda/inode.c
index 3e64679c1620..0c7c2528791e 100644
--- a/fs/coda/inode.c
+++ b/fs/coda/inode.c
@@ -256,7 +256,8 @@ int coda_getattr(struct mnt_idmap *idmap, const struct path *path,
{
int err = coda_revalidate_inode(d_inode(path->dentry));
if (!err)
- generic_fillattr(&nop_mnt_idmap, d_inode(path->dentry), stat);
+ generic_fillattr(&nop_mnt_idmap, request_mask,
+ d_inode(path->dentry), stat);
return err;
}
diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c
index b491bb239c8f..992d9c7e64ae 100644
--- a/fs/ecryptfs/inode.c
+++ b/fs/ecryptfs/inode.c
@@ -982,7 +982,7 @@ static int ecryptfs_getattr_link(struct mnt_idmap *idmap,
mount_crypt_stat = &ecryptfs_superblock_to_private(
dentry->d_sb)->mount_crypt_stat;
- generic_fillattr(&nop_mnt_idmap, d_inode(dentry), stat);
+ generic_fillattr(&nop_mnt_idmap, request_mask, d_inode(dentry), stat);
if (mount_crypt_stat->flags & ECRYPTFS_GLOBAL_ENCRYPT_FILENAMES) {
char *target;
size_t targetsiz;
@@ -1011,7 +1011,8 @@ static int ecryptfs_getattr(struct mnt_idmap *idmap,
if (!rc) {
fsstack_copy_attr_all(d_inode(dentry),
ecryptfs_inode_to_lower(d_inode(dentry)));
- generic_fillattr(&nop_mnt_idmap, d_inode(dentry), stat);
+ generic_fillattr(&nop_mnt_idmap, request_mask,
+ d_inode(dentry), stat);
stat->blocks = lower_stat.blocks;
}
return rc;
diff --git a/fs/erofs/inode.c b/fs/erofs/inode.c
index 567c0d305ea4..f3053f0dd6e1 100644
--- a/fs/erofs/inode.c
+++ b/fs/erofs/inode.c
@@ -368,7 +368,7 @@ int erofs_getattr(struct mnt_idmap *idmap, const struct path *path,
stat->attributes_mask |= (STATX_ATTR_COMPRESSED |
STATX_ATTR_IMMUTABLE);
- generic_fillattr(idmap, inode, stat);
+ generic_fillattr(idmap, request_mask, inode, stat);
return 0;
}
diff --git a/fs/exfat/file.c b/fs/exfat/file.c
index f40ecfeee3a4..32395ef686a2 100644
--- a/fs/exfat/file.c
+++ b/fs/exfat/file.c
@@ -232,7 +232,7 @@ int exfat_getattr(struct mnt_idmap *idmap, const struct path *path,
struct inode *inode = d_backing_inode(path->dentry);
struct exfat_inode_info *ei = EXFAT_I(inode);
- generic_fillattr(&nop_mnt_idmap, inode, stat);
+ generic_fillattr(&nop_mnt_idmap, request_mask, inode, stat);
exfat_truncate_atime(&stat->atime);
stat->result_mask |= STATX_BTIME;
stat->btime.tv_sec = ei->i_crtime.tv_sec;
diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c
index 1259995977d2..acbab27fe957 100644
--- a/fs/ext2/inode.c
+++ b/fs/ext2/inode.c
@@ -1628,7 +1628,7 @@ int ext2_getattr(struct mnt_idmap *idmap, const struct path *path,
STATX_ATTR_IMMUTABLE |
STATX_ATTR_NODUMP);
- generic_fillattr(&nop_mnt_idmap, inode, stat);
+ generic_fillattr(&nop_mnt_idmap, request_mask, inode, stat);
return 0;
}
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 86696b40c58f..6683076ecb2f 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -5535,7 +5535,7 @@ int ext4_getattr(struct mnt_idmap *idmap, const struct path *path,
STATX_ATTR_NODUMP |
STATX_ATTR_VERITY);
- generic_fillattr(idmap, inode, stat);
+ generic_fillattr(idmap, request_mask, inode, stat);
return 0;
}
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index b018800223c4..35886a52edfb 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -882,7 +882,7 @@ int f2fs_getattr(struct mnt_idmap *idmap, const struct path *path,
STATX_ATTR_NODUMP |
STATX_ATTR_VERITY);
- generic_fillattr(idmap, inode, stat);
+ generic_fillattr(idmap, request_mask, inode, stat);
/* we need to show initial sectors used for inline_data/dentries */
if ((S_ISREG(inode->i_mode) && f2fs_has_inline_data(inode)) ||
diff --git a/fs/fat/file.c b/fs/fat/file.c
index 456477946dd9..e887e9ab7472 100644
--- a/fs/fat/file.c
+++ b/fs/fat/file.c
@@ -401,7 +401,7 @@ int fat_getattr(struct mnt_idmap *idmap, const struct path *path,
struct inode *inode = d_inode(path->dentry);
struct msdos_sb_info *sbi = MSDOS_SB(inode->i_sb);
- generic_fillattr(idmap, inode, stat);
+ generic_fillattr(idmap, request_mask, inode, stat);
stat->blksize = sbi->cluster_size;
if (sbi->options.nfs == FAT_NFS_NOSTALE_RO) {
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
index a210c231c7d3..645fae48dc6b 100644
--- a/fs/fuse/dir.c
+++ b/fs/fuse/dir.c
@@ -1224,7 +1224,7 @@ static int fuse_update_get_attr(struct inode *inode, struct file *file,
forget_all_cached_acls(inode);
err = fuse_do_getattr(inode, stat, file);
} else if (stat) {
- generic_fillattr(&nop_mnt_idmap, inode, stat);
+ generic_fillattr(&nop_mnt_idmap, request_mask, inode, stat);
stat->mode = fi->orig_i_mode;
stat->ino = fi->orig_ino;
}
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c
index 2ded6c813f20..200cabf3b393 100644
--- a/fs/gfs2/inode.c
+++ b/fs/gfs2/inode.c
@@ -2071,7 +2071,7 @@ static int gfs2_getattr(struct mnt_idmap *idmap,
STATX_ATTR_IMMUTABLE |
STATX_ATTR_NODUMP);
- generic_fillattr(&nop_mnt_idmap, inode, stat);
+ generic_fillattr(&nop_mnt_idmap, request_mask, inode, stat);
if (gfs2_holder_initialized(&gh))
gfs2_glock_dq_uninit(&gh);
diff --git a/fs/hfsplus/inode.c b/fs/hfsplus/inode.c
index 40c61ab4a918..c65c8c4b03dd 100644
--- a/fs/hfsplus/inode.c
+++ b/fs/hfsplus/inode.c
@@ -298,7 +298,7 @@ int hfsplus_getattr(struct mnt_idmap *idmap, const struct path *path,
stat->attributes_mask |= STATX_ATTR_APPEND | STATX_ATTR_IMMUTABLE |
STATX_ATTR_NODUMP;
- generic_fillattr(&nop_mnt_idmap, inode, stat);
+ generic_fillattr(&nop_mnt_idmap, request_mask, inode, stat);
return 0;
}
diff --git a/fs/kernfs/inode.c b/fs/kernfs/inode.c
index 89a9b4dcf109..af37be68bf06 100644
--- a/fs/kernfs/inode.c
+++ b/fs/kernfs/inode.c
@@ -190,7 +190,7 @@ int kernfs_iop_getattr(struct mnt_idmap *idmap,
down_read(&root->kernfs_iattr_rwsem);
kernfs_refresh_inode(kn, inode);
- generic_fillattr(&nop_mnt_idmap, inode, stat);
+ generic_fillattr(&nop_mnt_idmap, request_mask, inode, stat);
up_read(&root->kernfs_iattr_rwsem);
return 0;
diff --git a/fs/libfs.c b/fs/libfs.c
index 1f5245e8bfdc..a61878469dcd 100644
--- a/fs/libfs.c
+++ b/fs/libfs.c
@@ -33,7 +33,7 @@ int simple_getattr(struct mnt_idmap *idmap, const struct path *path,
unsigned int query_flags)
{
struct inode *inode = d_inode(path->dentry);
- generic_fillattr(&nop_mnt_idmap, inode, stat);
+ generic_fillattr(&nop_mnt_idmap, request_mask, inode, stat);
stat->blocks = inode->i_mapping->nrpages << (PAGE_SHIFT - 9);
return 0;
}
@@ -1334,7 +1334,7 @@ static int empty_dir_getattr(struct mnt_idmap *idmap,
u32 request_mask, unsigned int query_flags)
{
struct inode *inode = d_inode(path->dentry);
- generic_fillattr(&nop_mnt_idmap, inode, stat);
+ generic_fillattr(&nop_mnt_idmap, request_mask, inode, stat);
return 0;
}
diff --git a/fs/minix/inode.c b/fs/minix/inode.c
index 8a4fc9420b36..df575473c1cc 100644
--- a/fs/minix/inode.c
+++ b/fs/minix/inode.c
@@ -656,7 +656,7 @@ int minix_getattr(struct mnt_idmap *idmap, const struct path *path,
struct super_block *sb = path->dentry->d_sb;
struct inode *inode = d_inode(path->dentry);
- generic_fillattr(&nop_mnt_idmap, inode, stat);
+ generic_fillattr(&nop_mnt_idmap, request_mask, inode, stat);
if (INODE_VERSION(inode) == MINIX_V1)
stat->blocks = (BLOCK_SIZE / 512) * V1_minix_blocks(stat->size, sb);
else
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index 1283fdfa4b0a..e21c073158e5 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -912,7 +912,7 @@ int nfs_getattr(struct mnt_idmap *idmap, const struct path *path,
/* Only return attributes that were revalidated. */
stat->result_mask = nfs_get_valid_attrmask(inode) | request_mask;
- generic_fillattr(&nop_mnt_idmap, inode, stat);
+ generic_fillattr(&nop_mnt_idmap, request_mask, inode, stat);
stat->ino = nfs_compat_user_ino64(NFS_FILEID(inode));
stat->change_cookie = inode_peek_iversion_raw(inode);
stat->attributes_mask |= STATX_ATTR_CHANGE_MONOTONIC;
diff --git a/fs/nfs/namespace.c b/fs/nfs/namespace.c
index 19d51ebf842c..e7494cdd957e 100644
--- a/fs/nfs/namespace.c
+++ b/fs/nfs/namespace.c
@@ -215,7 +215,8 @@ nfs_namespace_getattr(struct mnt_idmap *idmap,
if (NFS_FH(d_inode(path->dentry))->size != 0)
return nfs_getattr(idmap, path, stat, request_mask,
query_flags);
- generic_fillattr(&nop_mnt_idmap, d_inode(path->dentry), stat);
+ generic_fillattr(&nop_mnt_idmap, request_mask, d_inode(path->dentry),
+ stat);
return 0;
}
diff --git a/fs/ntfs3/file.c b/fs/ntfs3/file.c
index 12788601dc84..962f12ce6c0a 100644
--- a/fs/ntfs3/file.c
+++ b/fs/ntfs3/file.c
@@ -85,7 +85,7 @@ int ntfs_getattr(struct mnt_idmap *idmap, const struct path *path,
stat->attributes_mask |= STATX_ATTR_COMPRESSED | STATX_ATTR_ENCRYPTED;
- generic_fillattr(idmap, inode, stat);
+ generic_fillattr(idmap, request_mask, inode, stat);
stat->result_mask |= STATX_BTIME;
stat->btime = ni->i_crtime;
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
index 1b337ebce4df..8184499ae7a5 100644
--- a/fs/ocfs2/file.c
+++ b/fs/ocfs2/file.c
@@ -1319,7 +1319,7 @@ int ocfs2_getattr(struct mnt_idmap *idmap, const struct path *path,
goto bail;
}
- generic_fillattr(&nop_mnt_idmap, inode, stat);
+ generic_fillattr(&nop_mnt_idmap, request_mask, inode, stat);
/*
* If there is inline data in the inode, the inode will normally not
* have data blocks allocated (it may have an external xattr block).
diff --git a/fs/orangefs/inode.c b/fs/orangefs/inode.c
index 9014bbcc8031..a52c30e80f45 100644
--- a/fs/orangefs/inode.c
+++ b/fs/orangefs/inode.c
@@ -871,7 +871,7 @@ int orangefs_getattr(struct mnt_idmap *idmap, const struct path *path,
ret = orangefs_inode_getattr(inode,
request_mask & STATX_SIZE ? ORANGEFS_GETATTR_SIZE : 0);
if (ret == 0) {
- generic_fillattr(&nop_mnt_idmap, inode, stat);
+ generic_fillattr(&nop_mnt_idmap, request_mask, inode, stat);
/* override block size reported to stat */
if (!(request_mask & STATX_SIZE))
diff --git a/fs/proc/base.c b/fs/proc/base.c
index 3c644a822bca..2fcb393836ab 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -1966,7 +1966,7 @@ int pid_getattr(struct mnt_idmap *idmap, const struct path *path,
struct proc_fs_info *fs_info = proc_sb_info(inode->i_sb);
struct task_struct *task;
- generic_fillattr(&nop_mnt_idmap, inode, stat);
+ generic_fillattr(&nop_mnt_idmap, request_mask, inode, stat);
stat->uid = GLOBAL_ROOT_UID;
stat->gid = GLOBAL_ROOT_GID;
@@ -3899,7 +3899,7 @@ static int proc_task_getattr(struct mnt_idmap *idmap,
{
struct inode *inode = d_inode(path->dentry);
struct task_struct *p = get_proc_task(inode);
- generic_fillattr(&nop_mnt_idmap, inode, stat);
+ generic_fillattr(&nop_mnt_idmap, request_mask, inode, stat);
if (p) {
stat->nlink += get_nr_threads(p);
diff --git a/fs/proc/fd.c b/fs/proc/fd.c
index b3140deebbbf..6276b3938842 100644
--- a/fs/proc/fd.c
+++ b/fs/proc/fd.c
@@ -352,7 +352,7 @@ static int proc_fd_getattr(struct mnt_idmap *idmap,
struct inode *inode = d_inode(path->dentry);
int rv = 0;
- generic_fillattr(&nop_mnt_idmap, inode, stat);
+ generic_fillattr(&nop_mnt_idmap, request_mask, inode, stat);
/* If it's a directory, put the number of open fds there */
if (S_ISDIR(inode->i_mode)) {
diff --git a/fs/proc/generic.c b/fs/proc/generic.c
index 42ae38ff6e7e..775ce0bcf08c 100644
--- a/fs/proc/generic.c
+++ b/fs/proc/generic.c
@@ -146,7 +146,7 @@ static int proc_getattr(struct mnt_idmap *idmap,
}
}
- generic_fillattr(&nop_mnt_idmap, inode, stat);
+ generic_fillattr(&nop_mnt_idmap, request_mask, inode, stat);
return 0;
}
diff --git a/fs/proc/proc_net.c b/fs/proc/proc_net.c
index a0c0419872e3..75f35f128e63 100644
--- a/fs/proc/proc_net.c
+++ b/fs/proc/proc_net.c
@@ -308,7 +308,7 @@ static int proc_tgid_net_getattr(struct mnt_idmap *idmap,
net = get_proc_task_net(inode);
- generic_fillattr(&nop_mnt_idmap, inode, stat);
+ generic_fillattr(&nop_mnt_idmap, request_mask, inode, stat);
if (net != NULL) {
stat->nlink = net->proc_net->nlink;
diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c
index 6bc10e7e0ff7..bf06344a42cc 100644
--- a/fs/proc/proc_sysctl.c
+++ b/fs/proc/proc_sysctl.c
@@ -849,7 +849,7 @@ static int proc_sys_getattr(struct mnt_idmap *idmap,
if (IS_ERR(head))
return PTR_ERR(head);
- generic_fillattr(&nop_mnt_idmap, inode, stat);
+ generic_fillattr(&nop_mnt_idmap, request_mask, inode, stat);
if (table)
stat->mode = (stat->mode & S_IFMT) | table->mode;
diff --git a/fs/proc/root.c b/fs/proc/root.c
index a86e65a608da..9191248f2dac 100644
--- a/fs/proc/root.c
+++ b/fs/proc/root.c
@@ -314,7 +314,8 @@ static int proc_root_getattr(struct mnt_idmap *idmap,
const struct path *path, struct kstat *stat,
u32 request_mask, unsigned int query_flags)
{
- generic_fillattr(&nop_mnt_idmap, d_inode(path->dentry), stat);
+ generic_fillattr(&nop_mnt_idmap, request_mask, d_inode(path->dentry),
+ stat);
stat->nlink = proc_root.nlink + nr_processes();
return 0;
}
diff --git a/fs/smb/client/inode.c b/fs/smb/client/inode.c
index 218f03dd3f52..93fe43789d7a 100644
--- a/fs/smb/client/inode.c
+++ b/fs/smb/client/inode.c
@@ -2540,7 +2540,7 @@ int cifs_getattr(struct mnt_idmap *idmap, const struct path *path,
return rc;
}
- generic_fillattr(&nop_mnt_idmap, inode, stat);
+ generic_fillattr(&nop_mnt_idmap, request_mask, inode, stat);
stat->blksize = cifs_sb->ctx->bsize;
stat->ino = CIFS_I(inode)->uniqueid;
diff --git a/fs/smb/server/smb2pdu.c b/fs/smb/server/smb2pdu.c
index f9099831c8ff..2a084d35233a 100644
--- a/fs/smb/server/smb2pdu.c
+++ b/fs/smb/server/smb2pdu.c
@@ -4391,8 +4391,8 @@ static int get_file_basic_info(struct smb2_query_info_rsp *rsp,
}
basic_info = (struct smb2_file_basic_info *)rsp->Buffer;
- generic_fillattr(file_mnt_idmap(fp->filp), file_inode(fp->filp),
- &stat);
+ generic_fillattr(file_mnt_idmap(fp->filp), STATX_BASIC_STATS,
+ file_inode(fp->filp), &stat);
basic_info->CreationTime = cpu_to_le64(fp->create_time);
time = ksmbd_UnixTimeToNT(stat.atime);
basic_info->LastAccessTime = cpu_to_le64(time);
@@ -4417,7 +4417,7 @@ static void get_file_standard_info(struct smb2_query_info_rsp *rsp,
struct kstat stat;
inode = file_inode(fp->filp);
- generic_fillattr(file_mnt_idmap(fp->filp), inode, &stat);
+ generic_fillattr(file_mnt_idmap(fp->filp), STATX_BASIC_STATS, inode, &stat);
sinfo = (struct smb2_file_standard_info *)rsp->Buffer;
delete_pending = ksmbd_inode_pending_delete(fp);
@@ -4471,7 +4471,7 @@ static int get_file_all_info(struct ksmbd_work *work,
return PTR_ERR(filename);
inode = file_inode(fp->filp);
- generic_fillattr(file_mnt_idmap(fp->filp), inode, &stat);
+ generic_fillattr(file_mnt_idmap(fp->filp), STATX_BASIC_STATS, inode, &stat);
ksmbd_debug(SMB, "filename = %s\n", filename);
delete_pending = ksmbd_inode_pending_delete(fp);
@@ -4548,8 +4548,8 @@ static void get_file_stream_info(struct ksmbd_work *work,
int buf_free_len;
struct smb2_query_info_req *req = ksmbd_req_buf_next(work);
- generic_fillattr(file_mnt_idmap(fp->filp), file_inode(fp->filp),
- &stat);
+ generic_fillattr(file_mnt_idmap(fp->filp), STATX_BASIC_STATS,
+ file_inode(fp->filp), &stat);
file_info = (struct smb2_file_stream_info *)rsp->Buffer;
buf_free_len =
@@ -4639,8 +4639,8 @@ static void get_file_internal_info(struct smb2_query_info_rsp *rsp,
struct smb2_file_internal_info *file_info;
struct kstat stat;
- generic_fillattr(file_mnt_idmap(fp->filp), file_inode(fp->filp),
- &stat);
+ generic_fillattr(file_mnt_idmap(fp->filp), STATX_BASIC_STATS,
+ file_inode(fp->filp), &stat);
file_info = (struct smb2_file_internal_info *)rsp->Buffer;
file_info->IndexNumber = cpu_to_le64(stat.ino);
rsp->OutputBufferLength =
@@ -4665,7 +4665,7 @@ static int get_file_network_open_info(struct smb2_query_info_rsp *rsp,
file_info = (struct smb2_file_ntwrk_info *)rsp->Buffer;
inode = file_inode(fp->filp);
- generic_fillattr(file_mnt_idmap(fp->filp), inode, &stat);
+ generic_fillattr(file_mnt_idmap(fp->filp), STATX_BASIC_STATS, inode, &stat);
file_info->CreationTime = cpu_to_le64(fp->create_time);
time = ksmbd_UnixTimeToNT(stat.atime);
@@ -4726,8 +4726,8 @@ static void get_file_compression_info(struct smb2_query_info_rsp *rsp,
struct smb2_file_comp_info *file_info;
struct kstat stat;
- generic_fillattr(file_mnt_idmap(fp->filp), file_inode(fp->filp),
- &stat);
+ generic_fillattr(file_mnt_idmap(fp->filp), STATX_BASIC_STATS,
+ file_inode(fp->filp), &stat);
file_info = (struct smb2_file_comp_info *)rsp->Buffer;
file_info->CompressedFileSize = cpu_to_le64(stat.blocks << 9);
diff --git a/fs/smb/server/vfs.c b/fs/smb/server/vfs.c
index e35914457350..d0e94b73931a 100644
--- a/fs/smb/server/vfs.c
+++ b/fs/smb/server/vfs.c
@@ -1650,7 +1650,8 @@ int ksmbd_vfs_fill_dentry_attrs(struct ksmbd_work *work,
u64 time;
int rc;
- generic_fillattr(idmap, d_inode(dentry), ksmbd_kstat->kstat);
+ generic_fillattr(idmap, STATX_BASIC_STATS, d_inode(dentry),
+ ksmbd_kstat->kstat);
time = ksmbd_UnixTimeToNT(ksmbd_kstat->kstat->ctime);
ksmbd_kstat->create_time = time;
diff --git a/fs/stat.c b/fs/stat.c
index 8c2b30af19f5..7644e5997035 100644
--- a/fs/stat.c
+++ b/fs/stat.c
@@ -28,9 +28,10 @@
/**
* generic_fillattr - Fill in the basic attributes from the inode struct
- * @idmap: idmap of the mount the inode was found from
- * @inode: Inode to use as the source
- * @stat: Where to fill in the attributes
+ * @idmap: idmap of the mount the inode was found from
+ * @request_mask: statx request_mask
+ * @inode: Inode to use as the source
+ * @stat: Where to fill in the attributes
*
* Fill in the basic attributes in the kstat structure from data that's to be
* found on the VFS inode structure. This is the default if no getattr inode
@@ -42,8 +43,8 @@
* uid and gid filds. On non-idmapped mounts or if permission checking is to be
* performed on the raw inode simply passs @nop_mnt_idmap.
*/
-void generic_fillattr(struct mnt_idmap *idmap, struct inode *inode,
- struct kstat *stat)
+void generic_fillattr(struct mnt_idmap *idmap, u32 request_mask,
+ struct inode *inode, struct kstat *stat)
{
vfsuid_t vfsuid = i_uid_into_vfsuid(idmap, inode);
vfsgid_t vfsgid = i_gid_into_vfsgid(idmap, inode);
@@ -61,6 +62,12 @@ void generic_fillattr(struct mnt_idmap *idmap, struct inode *inode,
stat->ctime = inode_get_ctime(inode);
stat->blksize = i_blocksize(inode);
stat->blocks = inode->i_blocks;
+
+ if ((request_mask & STATX_CHANGE_COOKIE) && IS_I_VERSION(inode)) {
+ stat->result_mask |= STATX_CHANGE_COOKIE;
+ stat->change_cookie = inode_query_iversion(inode);
+ }
+
}
EXPORT_SYMBOL(generic_fillattr);
@@ -123,17 +130,12 @@ int vfs_getattr_nosec(const struct path *path, struct kstat *stat,
stat->attributes_mask |= (STATX_ATTR_AUTOMOUNT |
STATX_ATTR_DAX);
- if ((request_mask & STATX_CHANGE_COOKIE) && IS_I_VERSION(inode)) {
- stat->result_mask |= STATX_CHANGE_COOKIE;
- stat->change_cookie = inode_query_iversion(inode);
- }
-
idmap = mnt_idmap(path->mnt);
if (inode->i_op->getattr)
return inode->i_op->getattr(idmap, path, stat,
request_mask, query_flags);
- generic_fillattr(idmap, inode, stat);
+ generic_fillattr(idmap, request_mask, inode, stat);
return 0;
}
EXPORT_SYMBOL(vfs_getattr_nosec);
diff --git a/fs/sysv/itree.c b/fs/sysv/itree.c
index dba6a2ef26f1..edb94e55de8e 100644
--- a/fs/sysv/itree.c
+++ b/fs/sysv/itree.c
@@ -449,7 +449,8 @@ int sysv_getattr(struct mnt_idmap *idmap, const struct path *path,
struct kstat *stat, u32 request_mask, unsigned int flags)
{
struct super_block *s = path->dentry->d_sb;
- generic_fillattr(&nop_mnt_idmap, d_inode(path->dentry), stat);
+ generic_fillattr(&nop_mnt_idmap, request_mask, d_inode(path->dentry),
+ stat);
stat->blocks = (s->s_blocksize / 512) * sysv_nblocks(s, stat->size);
stat->blksize = s->s_blocksize;
return 0;
diff --git a/fs/ubifs/dir.c b/fs/ubifs/dir.c
index 3a1ba8ba308a..2f48c58d47cd 100644
--- a/fs/ubifs/dir.c
+++ b/fs/ubifs/dir.c
@@ -1654,7 +1654,7 @@ int ubifs_getattr(struct mnt_idmap *idmap, const struct path *path,
STATX_ATTR_ENCRYPTED |
STATX_ATTR_IMMUTABLE);
- generic_fillattr(&nop_mnt_idmap, inode, stat);
+ generic_fillattr(&nop_mnt_idmap, request_mask, inode, stat);
stat->blksize = UBIFS_BLOCK_SIZE;
stat->size = ui->ui_size;
diff --git a/fs/udf/symlink.c b/fs/udf/symlink.c
index 779b5c2c75f6..f7eaf7b14594 100644
--- a/fs/udf/symlink.c
+++ b/fs/udf/symlink.c
@@ -149,7 +149,7 @@ static int udf_symlink_getattr(struct mnt_idmap *idmap,
struct inode *inode = d_backing_inode(dentry);
struct page *page;
- generic_fillattr(&nop_mnt_idmap, inode, stat);
+ generic_fillattr(&nop_mnt_idmap, request_mask, inode, stat);
page = read_mapping_page(inode->i_mapping, 0, NULL);
if (IS_ERR(page))
return PTR_ERR(page);
diff --git a/fs/vboxsf/utils.c b/fs/vboxsf/utils.c
index 576b91d571c5..83f20dd15522 100644
--- a/fs/vboxsf/utils.c
+++ b/fs/vboxsf/utils.c
@@ -252,7 +252,7 @@ int vboxsf_getattr(struct mnt_idmap *idmap, const struct path *path,
if (err)
return err;
- generic_fillattr(&nop_mnt_idmap, d_inode(dentry), kstat);
+ generic_fillattr(&nop_mnt_idmap, request_mask, d_inode(dentry), kstat);
return 0;
}
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 61f27011fd04..85977cdeda94 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -2917,7 +2917,7 @@ extern void page_put_link(void *);
extern int page_symlink(struct inode *inode, const char *symname, int len);
extern const struct inode_operations page_symlink_inode_operations;
extern void kfree_link(void *);
-void generic_fillattr(struct mnt_idmap *, struct inode *, struct kstat *);
+void generic_fillattr(struct mnt_idmap *, u32, struct inode *, struct kstat *);
void generic_fill_statx_attr(struct inode *inode, struct kstat *stat);
extern int vfs_getattr_nosec(const struct path *, struct kstat *, u32, unsigned int);
extern int vfs_getattr(const struct path *, struct kstat *, u32, unsigned int);
diff --git a/mm/shmem.c b/mm/shmem.c
index 72129c101800..142ead70e8c1 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -1073,7 +1073,7 @@ static int shmem_getattr(struct mnt_idmap *idmap,
stat->attributes_mask |= (STATX_ATTR_APPEND |
STATX_ATTR_IMMUTABLE |
STATX_ATTR_NODUMP);
- generic_fillattr(idmap, inode, stat);
+ generic_fillattr(idmap, request_mask, inode, stat);
if (shmem_is_huge(inode, 0, false, NULL, 0))
stat->blksize = HPAGE_PMD_SIZE;
--
2.41.0
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply related [flat|nested] 76+ messages in thread
* [f2fs-dev] [PATCH v7 03/13] fs: drop the timespec64 arg from generic_update_time
2023-08-07 19:38 [f2fs-dev] [PATCH v7 00/13] fs: implement multigrain timestamps Jeff Layton
2023-08-07 19:38 ` [f2fs-dev] [PATCH v7 01/13] fs: remove silly warning from current_time Jeff Layton
2023-08-07 19:38 ` [f2fs-dev] [PATCH v7 02/13] fs: pass the request_mask to generic_fillattr Jeff Layton
@ 2023-08-07 19:38 ` Jeff Layton
2023-08-08 9:25 ` Jan Kara
2023-08-07 19:38 ` [f2fs-dev] [PATCH v7 04/13] btrfs: have it use inode_update_timestamps Jeff Layton
` (11 subsequent siblings)
14 siblings, 1 reply; 76+ messages in thread
From: Jeff Layton @ 2023-08-07 19:38 UTC (permalink / raw)
To: Alexander Viro, Christian Brauner, Eric Van Hensbergen,
Latchesar Ionkov, Dominique Martinet, Christian Schoenebeck,
David Howells, Marc Dionne, Chris Mason, Josef Bacik,
David Sterba, Xiubo Li, Ilya Dryomov, Jan Harkes, coda,
Tyler Hicks, Gao Xiang, Chao Yu, Yue Hu, Jeffle Xu, Namjae Jeon,
Sungjong Seo, Jan Kara, Theodore Ts'o, Andreas Dilger,
Jaegeuk Kim, OGAWA Hirofumi, Miklos Szeredi, Bob Peterson,
Andreas Gruenbacher, Greg Kroah-Hartman, Tejun Heo,
Trond Myklebust, Anna Schumaker, Konstantin Komarov, Mark Fasheh,
Joel Becker, Joseph Qi, Mike Marshall, Martin Brandenburg,
Luis Chamberlain, Kees Cook, Iurii Zaikin, Steve French,
Paulo Alcantara, Ronnie Sahlberg, Shyam Prasad N, Tom Talpey,
Sergey Senozhatsky, Richard Weinberger, Hans de Goede,
Hugh Dickins, Andrew Morton, Amir Goldstein, Darrick J. Wong,
Benjamin Coddington
Cc: Jeff Layton, linux-kernel, linux-mm, linux-mtd, linux-afs,
linux-cifs, codalist, cluster-devel, linux-ext4, devel, ecryptfs,
ocfs2-devel, ceph-devel, linux-nfs, v9fs, samba-technical,
linux-unionfs, linux-f2fs-devel, linux-xfs, linux-fsdevel, ntfs3,
linux-erofs, linux-btrfs
In future patches we're going to change how the ctime is updated
to keep track of when it has been queried. The way that the update_time
operation works (and a lot of its callers) make this difficult, since
they grab a timestamp early and then pass it down to eventually be
copied into the inode.
All of the existing update_time callers pass in the result of
current_time() in some fashion. Drop the "time" parameter from
generic_update_time, and rework it to fetch its own timestamp.
This change means that an update_time could fetch a different timestamp
than was seen in inode_needs_update_time. update_time is only ever
called with one of two flag combinations: Either S_ATIME is set, or
S_MTIME|S_CTIME|S_VERSION are set.
With this change we now treat the flags argument as an indicator that
some value needed to be updated when last checked, rather than an
indication to update specific timestamps.
Rework the logic for updating the timestamps and put it in a new
inode_update_timestamps helper that other update_time routines can use.
S_ATIME is as treated as we always have, but if any of the other three
are set, then we attempt to update all three.
Also, some callers of generic_update_time need to know what timestamps
were actually updated. Change it to return an S_* flag mask to indicate
that and rework the callers to expect it.
Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
fs/gfs2/inode.c | 3 +-
fs/inode.c | 84 +++++++++++++++++++++++++++++++++++++++++------------
fs/orangefs/inode.c | 3 +-
fs/ubifs/file.c | 6 ++--
fs/xfs/xfs_iops.c | 6 ++--
include/linux/fs.h | 3 +-
6 files changed, 80 insertions(+), 25 deletions(-)
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c
index 200cabf3b393..f1f04557aa21 100644
--- a/fs/gfs2/inode.c
+++ b/fs/gfs2/inode.c
@@ -2155,7 +2155,8 @@ static int gfs2_update_time(struct inode *inode, struct timespec64 *time,
if (error)
return error;
}
- return generic_update_time(inode, time, flags);
+ generic_update_time(inode, flags);
+ return 0;
}
static const struct inode_operations gfs2_file_iops = {
diff --git a/fs/inode.c b/fs/inode.c
index 3fc251bfaf73..e07e45f6cd01 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -1881,29 +1881,76 @@ static int relatime_need_update(struct vfsmount *mnt, struct inode *inode,
return 0;
}
-int generic_update_time(struct inode *inode, struct timespec64 *time, int flags)
+/**
+ * inode_update_timestamps - update the timestamps on the inode
+ * @inode: inode to be updated
+ * @flags: S_* flags that needed to be updated
+ *
+ * The update_time function is called when an inode's timestamps need to be
+ * updated for a read or write operation. This function handles updating the
+ * actual timestamps. It's up to the caller to ensure that the inode is marked
+ * dirty appropriately.
+ *
+ * In the case where any of S_MTIME, S_CTIME, or S_VERSION need to be updated,
+ * attempt to update all three of them. S_ATIME updates can be handled
+ * independently of the rest.
+ *
+ * Returns a set of S_* flags indicating which values changed.
+ */
+int inode_update_timestamps(struct inode *inode, int flags)
{
- int dirty_flags = 0;
+ int updated = 0;
+ struct timespec64 now;
+
+ if (flags & (S_MTIME|S_CTIME|S_VERSION)) {
+ struct timespec64 ctime = inode_get_ctime(inode);
- if (flags & (S_ATIME | S_CTIME | S_MTIME)) {
- if (flags & S_ATIME)
- inode->i_atime = *time;
- if (flags & S_CTIME)
- inode_set_ctime_to_ts(inode, *time);
- if (flags & S_MTIME)
- inode->i_mtime = *time;
-
- if (inode->i_sb->s_flags & SB_LAZYTIME)
- dirty_flags |= I_DIRTY_TIME;
- else
- dirty_flags |= I_DIRTY_SYNC;
+ now = inode_set_ctime_current(inode);
+ if (!timespec64_equal(&now, &ctime))
+ updated |= S_CTIME;
+ if (!timespec64_equal(&now, &inode->i_mtime)) {
+ inode->i_mtime = now;
+ updated |= S_MTIME;
+ }
+ if (IS_I_VERSION(inode) && inode_maybe_inc_iversion(inode, updated))
+ updated |= S_VERSION;
+ } else {
+ now = current_time(inode);
}
- if ((flags & S_VERSION) && inode_maybe_inc_iversion(inode, false))
- dirty_flags |= I_DIRTY_SYNC;
+ if (flags & S_ATIME) {
+ if (!timespec64_equal(&now, &inode->i_atime)) {
+ inode->i_atime = now;
+ updated |= S_ATIME;
+ }
+ }
+ return updated;
+}
+EXPORT_SYMBOL(inode_update_timestamps);
+
+/**
+ * generic_update_time - update the timestamps on the inode
+ * @inode: inode to be updated
+ * @flags: S_* flags that needed to be updated
+ *
+ * The update_time function is called when an inode's timestamps need to be
+ * updated for a read or write operation. In the case where any of S_MTIME, S_CTIME,
+ * or S_VERSION need to be updated we attempt to update all three of them. S_ATIME
+ * updates can be handled done independently of the rest.
+ *
+ * Returns a S_* mask indicating which fields were updated.
+ */
+int generic_update_time(struct inode *inode, int flags)
+{
+ int updated = inode_update_timestamps(inode, flags);
+ int dirty_flags = 0;
+ if (updated & (S_ATIME|S_MTIME|S_CTIME))
+ dirty_flags = inode->i_sb->s_flags & SB_LAZYTIME ? I_DIRTY_TIME : I_DIRTY_SYNC;
+ if (updated & S_VERSION)
+ dirty_flags |= I_DIRTY_SYNC;
__mark_inode_dirty(inode, dirty_flags);
- return 0;
+ return updated;
}
EXPORT_SYMBOL(generic_update_time);
@@ -1915,7 +1962,8 @@ int inode_update_time(struct inode *inode, struct timespec64 *time, int flags)
{
if (inode->i_op->update_time)
return inode->i_op->update_time(inode, time, flags);
- return generic_update_time(inode, time, flags);
+ generic_update_time(inode, flags);
+ return 0;
}
EXPORT_SYMBOL(inode_update_time);
diff --git a/fs/orangefs/inode.c b/fs/orangefs/inode.c
index a52c30e80f45..3afa2a69bc63 100644
--- a/fs/orangefs/inode.c
+++ b/fs/orangefs/inode.c
@@ -903,9 +903,10 @@ int orangefs_permission(struct mnt_idmap *idmap,
int orangefs_update_time(struct inode *inode, struct timespec64 *time, int flags)
{
struct iattr iattr;
+
gossip_debug(GOSSIP_INODE_DEBUG, "orangefs_update_time: %pU\n",
get_khandle_from_ino(inode));
- generic_update_time(inode, time, flags);
+ flags = generic_update_time(inode, flags);
memset(&iattr, 0, sizeof iattr);
if (flags & S_ATIME)
iattr.ia_valid |= ATTR_ATIME;
diff --git a/fs/ubifs/file.c b/fs/ubifs/file.c
index 436b27d7c58f..df9086b19cd0 100644
--- a/fs/ubifs/file.c
+++ b/fs/ubifs/file.c
@@ -1387,8 +1387,10 @@ int ubifs_update_time(struct inode *inode, struct timespec64 *time,
.dirtied_ino_d = ALIGN(ui->data_len, 8) };
int err, release;
- if (!IS_ENABLED(CONFIG_UBIFS_ATIME_SUPPORT))
- return generic_update_time(inode, time, flags);
+ if (!IS_ENABLED(CONFIG_UBIFS_ATIME_SUPPORT)) {
+ generic_update_time(inode, flags);
+ return 0;
+ }
err = ubifs_budget_space(c, &req);
if (err)
diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c
index 3a9363953ef2..731f45391baa 100644
--- a/fs/xfs/xfs_iops.c
+++ b/fs/xfs/xfs_iops.c
@@ -1042,8 +1042,10 @@ xfs_vn_update_time(
if (inode->i_sb->s_flags & SB_LAZYTIME) {
if (!((flags & S_VERSION) &&
- inode_maybe_inc_iversion(inode, false)))
- return generic_update_time(inode, now, flags);
+ inode_maybe_inc_iversion(inode, false))) {
+ generic_update_time(inode, flags);
+ return 0;
+ }
/* Capture the iversion update that just occurred */
log_flags |= XFS_ILOG_CORE;
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 85977cdeda94..bb3c2c4f871f 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -2343,7 +2343,8 @@ extern int current_umask(void);
extern void ihold(struct inode * inode);
extern void iput(struct inode *);
-extern int generic_update_time(struct inode *, struct timespec64 *, int);
+int inode_update_timestamps(struct inode *inode, int flags);
+int generic_update_time(struct inode *, int);
/* /sys/fs */
extern struct kobject *fs_kobj;
--
2.41.0
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply related [flat|nested] 76+ messages in thread
* Re: [f2fs-dev] [PATCH v7 03/13] fs: drop the timespec64 arg from generic_update_time
2023-08-07 19:38 ` [f2fs-dev] [PATCH v7 03/13] fs: drop the timespec64 arg from generic_update_time Jeff Layton
@ 2023-08-08 9:25 ` Jan Kara
0 siblings, 0 replies; 76+ messages in thread
From: Jan Kara @ 2023-08-08 9:25 UTC (permalink / raw)
To: Jeff Layton
Cc: Latchesar Ionkov, Martin Brandenburg, Konstantin Komarov,
linux-xfs, Darrick J. Wong, Dominique Martinet,
Christian Schoenebeck, ecryptfs, linux-unionfs, David Howells,
Chris Mason, Andreas Dilger, Hans de Goede, Marc Dionne, codalist,
linux-afs, linux-mtd, Mike Marshall, Paulo Alcantara, linux-cifs,
Eric Van Hensbergen, Andreas Gruenbacher, Miklos Szeredi,
Richard Weinberger, Mark Fasheh, Hugh Dickins,
Benjamin Coddington, Tyler Hicks, cluster-devel, coda, linux-mm,
Ilya Dryomov, Iurii Zaikin, Namjae Jeon, Trond Myklebust,
Shyam Prasad N, Amir Goldstein, Kees Cook, ocfs2-devel,
Josef Bacik, Tom Talpey, Tejun Heo, Yue Hu, Alexander Viro,
Ronnie Sahlberg, David Sterba, Jaegeuk Kim, ceph-devel, Xiubo Li,
Gao Xiang, OGAWA Hirofumi, Jan Harkes, Christian Brauner,
linux-ext4, Theodore Ts'o, Joseph Qi, Greg Kroah-Hartman,
v9fs, ntfs3, samba-technical, linux-kernel, linux-f2fs-devel,
Steve French, Sergey Senozhatsky, Luis Chamberlain, Jeffle Xu,
devel, Anna Schumaker, Jan Kara, Bob Peterson, linux-fsdevel,
Andrew Morton, Sungjong Seo, linux-erofs, linux-nfs, linux-btrfs,
Joel Becker
On Mon 07-08-23 15:38:34, Jeff Layton wrote:
> In future patches we're going to change how the ctime is updated
> to keep track of when it has been queried. The way that the update_time
> operation works (and a lot of its callers) make this difficult, since
> they grab a timestamp early and then pass it down to eventually be
> copied into the inode.
>
> All of the existing update_time callers pass in the result of
> current_time() in some fashion. Drop the "time" parameter from
> generic_update_time, and rework it to fetch its own timestamp.
>
> This change means that an update_time could fetch a different timestamp
> than was seen in inode_needs_update_time. update_time is only ever
> called with one of two flag combinations: Either S_ATIME is set, or
> S_MTIME|S_CTIME|S_VERSION are set.
>
> With this change we now treat the flags argument as an indicator that
> some value needed to be updated when last checked, rather than an
> indication to update specific timestamps.
>
> Rework the logic for updating the timestamps and put it in a new
> inode_update_timestamps helper that other update_time routines can use.
> S_ATIME is as treated as we always have, but if any of the other three
> are set, then we attempt to update all three.
>
> Also, some callers of generic_update_time need to know what timestamps
> were actually updated. Change it to return an S_* flag mask to indicate
> that and rework the callers to expect it.
>
> Signed-off-by: Jeff Layton <jlayton@kernel.org>
Looks good to me. Feel free to add:
Reviewed-by: Jan Kara <jack@suse.cz>
Honza
> ---
> fs/gfs2/inode.c | 3 +-
> fs/inode.c | 84 +++++++++++++++++++++++++++++++++++++++++------------
> fs/orangefs/inode.c | 3 +-
> fs/ubifs/file.c | 6 ++--
> fs/xfs/xfs_iops.c | 6 ++--
> include/linux/fs.h | 3 +-
> 6 files changed, 80 insertions(+), 25 deletions(-)
>
> diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c
> index 200cabf3b393..f1f04557aa21 100644
> --- a/fs/gfs2/inode.c
> +++ b/fs/gfs2/inode.c
> @@ -2155,7 +2155,8 @@ static int gfs2_update_time(struct inode *inode, struct timespec64 *time,
> if (error)
> return error;
> }
> - return generic_update_time(inode, time, flags);
> + generic_update_time(inode, flags);
> + return 0;
> }
>
> static const struct inode_operations gfs2_file_iops = {
> diff --git a/fs/inode.c b/fs/inode.c
> index 3fc251bfaf73..e07e45f6cd01 100644
> --- a/fs/inode.c
> +++ b/fs/inode.c
> @@ -1881,29 +1881,76 @@ static int relatime_need_update(struct vfsmount *mnt, struct inode *inode,
> return 0;
> }
>
> -int generic_update_time(struct inode *inode, struct timespec64 *time, int flags)
> +/**
> + * inode_update_timestamps - update the timestamps on the inode
> + * @inode: inode to be updated
> + * @flags: S_* flags that needed to be updated
> + *
> + * The update_time function is called when an inode's timestamps need to be
> + * updated for a read or write operation. This function handles updating the
> + * actual timestamps. It's up to the caller to ensure that the inode is marked
> + * dirty appropriately.
> + *
> + * In the case where any of S_MTIME, S_CTIME, or S_VERSION need to be updated,
> + * attempt to update all three of them. S_ATIME updates can be handled
> + * independently of the rest.
> + *
> + * Returns a set of S_* flags indicating which values changed.
> + */
> +int inode_update_timestamps(struct inode *inode, int flags)
> {
> - int dirty_flags = 0;
> + int updated = 0;
> + struct timespec64 now;
> +
> + if (flags & (S_MTIME|S_CTIME|S_VERSION)) {
> + struct timespec64 ctime = inode_get_ctime(inode);
>
> - if (flags & (S_ATIME | S_CTIME | S_MTIME)) {
> - if (flags & S_ATIME)
> - inode->i_atime = *time;
> - if (flags & S_CTIME)
> - inode_set_ctime_to_ts(inode, *time);
> - if (flags & S_MTIME)
> - inode->i_mtime = *time;
> -
> - if (inode->i_sb->s_flags & SB_LAZYTIME)
> - dirty_flags |= I_DIRTY_TIME;
> - else
> - dirty_flags |= I_DIRTY_SYNC;
> + now = inode_set_ctime_current(inode);
> + if (!timespec64_equal(&now, &ctime))
> + updated |= S_CTIME;
> + if (!timespec64_equal(&now, &inode->i_mtime)) {
> + inode->i_mtime = now;
> + updated |= S_MTIME;
> + }
> + if (IS_I_VERSION(inode) && inode_maybe_inc_iversion(inode, updated))
> + updated |= S_VERSION;
> + } else {
> + now = current_time(inode);
> }
>
> - if ((flags & S_VERSION) && inode_maybe_inc_iversion(inode, false))
> - dirty_flags |= I_DIRTY_SYNC;
> + if (flags & S_ATIME) {
> + if (!timespec64_equal(&now, &inode->i_atime)) {
> + inode->i_atime = now;
> + updated |= S_ATIME;
> + }
> + }
> + return updated;
> +}
> +EXPORT_SYMBOL(inode_update_timestamps);
> +
> +/**
> + * generic_update_time - update the timestamps on the inode
> + * @inode: inode to be updated
> + * @flags: S_* flags that needed to be updated
> + *
> + * The update_time function is called when an inode's timestamps need to be
> + * updated for a read or write operation. In the case where any of S_MTIME, S_CTIME,
> + * or S_VERSION need to be updated we attempt to update all three of them. S_ATIME
> + * updates can be handled done independently of the rest.
> + *
> + * Returns a S_* mask indicating which fields were updated.
> + */
> +int generic_update_time(struct inode *inode, int flags)
> +{
> + int updated = inode_update_timestamps(inode, flags);
> + int dirty_flags = 0;
>
> + if (updated & (S_ATIME|S_MTIME|S_CTIME))
> + dirty_flags = inode->i_sb->s_flags & SB_LAZYTIME ? I_DIRTY_TIME : I_DIRTY_SYNC;
> + if (updated & S_VERSION)
> + dirty_flags |= I_DIRTY_SYNC;
> __mark_inode_dirty(inode, dirty_flags);
> - return 0;
> + return updated;
> }
> EXPORT_SYMBOL(generic_update_time);
>
> @@ -1915,7 +1962,8 @@ int inode_update_time(struct inode *inode, struct timespec64 *time, int flags)
> {
> if (inode->i_op->update_time)
> return inode->i_op->update_time(inode, time, flags);
> - return generic_update_time(inode, time, flags);
> + generic_update_time(inode, flags);
> + return 0;
> }
> EXPORT_SYMBOL(inode_update_time);
>
> diff --git a/fs/orangefs/inode.c b/fs/orangefs/inode.c
> index a52c30e80f45..3afa2a69bc63 100644
> --- a/fs/orangefs/inode.c
> +++ b/fs/orangefs/inode.c
> @@ -903,9 +903,10 @@ int orangefs_permission(struct mnt_idmap *idmap,
> int orangefs_update_time(struct inode *inode, struct timespec64 *time, int flags)
> {
> struct iattr iattr;
> +
> gossip_debug(GOSSIP_INODE_DEBUG, "orangefs_update_time: %pU\n",
> get_khandle_from_ino(inode));
> - generic_update_time(inode, time, flags);
> + flags = generic_update_time(inode, flags);
> memset(&iattr, 0, sizeof iattr);
> if (flags & S_ATIME)
> iattr.ia_valid |= ATTR_ATIME;
> diff --git a/fs/ubifs/file.c b/fs/ubifs/file.c
> index 436b27d7c58f..df9086b19cd0 100644
> --- a/fs/ubifs/file.c
> +++ b/fs/ubifs/file.c
> @@ -1387,8 +1387,10 @@ int ubifs_update_time(struct inode *inode, struct timespec64 *time,
> .dirtied_ino_d = ALIGN(ui->data_len, 8) };
> int err, release;
>
> - if (!IS_ENABLED(CONFIG_UBIFS_ATIME_SUPPORT))
> - return generic_update_time(inode, time, flags);
> + if (!IS_ENABLED(CONFIG_UBIFS_ATIME_SUPPORT)) {
> + generic_update_time(inode, flags);
> + return 0;
> + }
>
> err = ubifs_budget_space(c, &req);
> if (err)
> diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c
> index 3a9363953ef2..731f45391baa 100644
> --- a/fs/xfs/xfs_iops.c
> +++ b/fs/xfs/xfs_iops.c
> @@ -1042,8 +1042,10 @@ xfs_vn_update_time(
>
> if (inode->i_sb->s_flags & SB_LAZYTIME) {
> if (!((flags & S_VERSION) &&
> - inode_maybe_inc_iversion(inode, false)))
> - return generic_update_time(inode, now, flags);
> + inode_maybe_inc_iversion(inode, false))) {
> + generic_update_time(inode, flags);
> + return 0;
> + }
>
> /* Capture the iversion update that just occurred */
> log_flags |= XFS_ILOG_CORE;
> diff --git a/include/linux/fs.h b/include/linux/fs.h
> index 85977cdeda94..bb3c2c4f871f 100644
> --- a/include/linux/fs.h
> +++ b/include/linux/fs.h
> @@ -2343,7 +2343,8 @@ extern int current_umask(void);
>
> extern void ihold(struct inode * inode);
> extern void iput(struct inode *);
> -extern int generic_update_time(struct inode *, struct timespec64 *, int);
> +int inode_update_timestamps(struct inode *inode, int flags);
> +int generic_update_time(struct inode *, int);
>
> /* /sys/fs */
> extern struct kobject *fs_kobj;
>
> --
> 2.41.0
>
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply [flat|nested] 76+ messages in thread
* [f2fs-dev] [PATCH v7 04/13] btrfs: have it use inode_update_timestamps
2023-08-07 19:38 [f2fs-dev] [PATCH v7 00/13] fs: implement multigrain timestamps Jeff Layton
` (2 preceding siblings ...)
2023-08-07 19:38 ` [f2fs-dev] [PATCH v7 03/13] fs: drop the timespec64 arg from generic_update_time Jeff Layton
@ 2023-08-07 19:38 ` Jeff Layton
2023-08-08 9:26 ` Jan Kara
2023-08-07 19:38 ` [f2fs-dev] [PATCH v7 05/13] fat: make fat_update_time get its own timestamp Jeff Layton
` (10 subsequent siblings)
14 siblings, 1 reply; 76+ messages in thread
From: Jeff Layton @ 2023-08-07 19:38 UTC (permalink / raw)
To: Alexander Viro, Christian Brauner, Eric Van Hensbergen,
Latchesar Ionkov, Dominique Martinet, Christian Schoenebeck,
David Howells, Marc Dionne, Chris Mason, Josef Bacik,
David Sterba, Xiubo Li, Ilya Dryomov, Jan Harkes, coda,
Tyler Hicks, Gao Xiang, Chao Yu, Yue Hu, Jeffle Xu, Namjae Jeon,
Sungjong Seo, Jan Kara, Theodore Ts'o, Andreas Dilger,
Jaegeuk Kim, OGAWA Hirofumi, Miklos Szeredi, Bob Peterson,
Andreas Gruenbacher, Greg Kroah-Hartman, Tejun Heo,
Trond Myklebust, Anna Schumaker, Konstantin Komarov, Mark Fasheh,
Joel Becker, Joseph Qi, Mike Marshall, Martin Brandenburg,
Luis Chamberlain, Kees Cook, Iurii Zaikin, Steve French,
Paulo Alcantara, Ronnie Sahlberg, Shyam Prasad N, Tom Talpey,
Sergey Senozhatsky, Richard Weinberger, Hans de Goede,
Hugh Dickins, Andrew Morton, Amir Goldstein, Darrick J. Wong,
Benjamin Coddington
Cc: Jeff Layton, linux-kernel, linux-mm, linux-mtd, linux-afs,
linux-cifs, codalist, cluster-devel, linux-ext4, devel, ecryptfs,
ocfs2-devel, ceph-devel, linux-nfs, v9fs, samba-technical,
linux-unionfs, linux-f2fs-devel, linux-xfs, linux-fsdevel, ntfs3,
linux-erofs, linux-btrfs
In later patches, we're going to drop the "now" argument from the
update_time operation. Have btrfs_update_time use the new
inode_update_timestamps helper to fetch a new timestamp and update it
properly.
Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
fs/btrfs/inode.c | 9 +--------
1 file changed, 1 insertion(+), 8 deletions(-)
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 29a20f828dda..d52e7d64570a 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -6068,14 +6068,7 @@ static int btrfs_update_time(struct inode *inode, struct timespec64 *now,
if (btrfs_root_readonly(root))
return -EROFS;
- if (flags & S_VERSION)
- dirty |= inode_maybe_inc_iversion(inode, dirty);
- if (flags & S_CTIME)
- inode_set_ctime_to_ts(inode, *now);
- if (flags & S_MTIME)
- inode->i_mtime = *now;
- if (flags & S_ATIME)
- inode->i_atime = *now;
+ dirty = inode_update_timestamps(inode, flags);
return dirty ? btrfs_dirty_inode(BTRFS_I(inode)) : 0;
}
--
2.41.0
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply related [flat|nested] 76+ messages in thread
* Re: [f2fs-dev] [PATCH v7 04/13] btrfs: have it use inode_update_timestamps
2023-08-07 19:38 ` [f2fs-dev] [PATCH v7 04/13] btrfs: have it use inode_update_timestamps Jeff Layton
@ 2023-08-08 9:26 ` Jan Kara
0 siblings, 0 replies; 76+ messages in thread
From: Jan Kara @ 2023-08-08 9:26 UTC (permalink / raw)
To: Jeff Layton
Cc: Latchesar Ionkov, Martin Brandenburg, Konstantin Komarov,
linux-xfs, Darrick J. Wong, Dominique Martinet,
Christian Schoenebeck, ecryptfs, linux-unionfs, David Howells,
Chris Mason, Andreas Dilger, Hans de Goede, Marc Dionne, codalist,
linux-afs, linux-mtd, Mike Marshall, Paulo Alcantara, linux-cifs,
Eric Van Hensbergen, Andreas Gruenbacher, Miklos Szeredi,
Richard Weinberger, Mark Fasheh, Hugh Dickins,
Benjamin Coddington, Tyler Hicks, cluster-devel, coda, linux-mm,
Ilya Dryomov, Iurii Zaikin, Namjae Jeon, Trond Myklebust,
Shyam Prasad N, Amir Goldstein, Kees Cook, ocfs2-devel,
Josef Bacik, Tom Talpey, Tejun Heo, Yue Hu, Alexander Viro,
Ronnie Sahlberg, David Sterba, Jaegeuk Kim, ceph-devel, Xiubo Li,
Gao Xiang, OGAWA Hirofumi, Jan Harkes, Christian Brauner,
linux-ext4, Theodore Ts'o, Joseph Qi, Greg Kroah-Hartman,
v9fs, ntfs3, samba-technical, linux-kernel, linux-f2fs-devel,
Steve French, Sergey Senozhatsky, Luis Chamberlain, Jeffle Xu,
devel, Anna Schumaker, Jan Kara, Bob Peterson, linux-fsdevel,
Andrew Morton, Sungjong Seo, linux-erofs, linux-nfs, linux-btrfs,
Joel Becker
On Mon 07-08-23 15:38:35, Jeff Layton wrote:
> In later patches, we're going to drop the "now" argument from the
> update_time operation. Have btrfs_update_time use the new
> inode_update_timestamps helper to fetch a new timestamp and update it
> properly.
>
> Signed-off-by: Jeff Layton <jlayton@kernel.org>
Nice cleanup! Feel free to add:
Reviewed-by: Jan Kara <jack@suse.cz>
Honza
> ---
> fs/btrfs/inode.c | 9 +--------
> 1 file changed, 1 insertion(+), 8 deletions(-)
>
> diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
> index 29a20f828dda..d52e7d64570a 100644
> --- a/fs/btrfs/inode.c
> +++ b/fs/btrfs/inode.c
> @@ -6068,14 +6068,7 @@ static int btrfs_update_time(struct inode *inode, struct timespec64 *now,
> if (btrfs_root_readonly(root))
> return -EROFS;
>
> - if (flags & S_VERSION)
> - dirty |= inode_maybe_inc_iversion(inode, dirty);
> - if (flags & S_CTIME)
> - inode_set_ctime_to_ts(inode, *now);
> - if (flags & S_MTIME)
> - inode->i_mtime = *now;
> - if (flags & S_ATIME)
> - inode->i_atime = *now;
> + dirty = inode_update_timestamps(inode, flags);
> return dirty ? btrfs_dirty_inode(BTRFS_I(inode)) : 0;
> }
>
>
> --
> 2.41.0
>
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply [flat|nested] 76+ messages in thread
* [f2fs-dev] [PATCH v7 05/13] fat: make fat_update_time get its own timestamp
2023-08-07 19:38 [f2fs-dev] [PATCH v7 00/13] fs: implement multigrain timestamps Jeff Layton
` (3 preceding siblings ...)
2023-08-07 19:38 ` [f2fs-dev] [PATCH v7 04/13] btrfs: have it use inode_update_timestamps Jeff Layton
@ 2023-08-07 19:38 ` Jeff Layton
2023-08-08 9:32 ` Jan Kara
2023-08-09 8:37 ` OGAWA Hirofumi
2023-08-07 19:38 ` [f2fs-dev] [PATCH v7 06/13] ubifs: have ubifs_update_time use inode_update_timestamps Jeff Layton
` (9 subsequent siblings)
14 siblings, 2 replies; 76+ messages in thread
From: Jeff Layton @ 2023-08-07 19:38 UTC (permalink / raw)
To: Alexander Viro, Christian Brauner, Eric Van Hensbergen,
Latchesar Ionkov, Dominique Martinet, Christian Schoenebeck,
David Howells, Marc Dionne, Chris Mason, Josef Bacik,
David Sterba, Xiubo Li, Ilya Dryomov, Jan Harkes, coda,
Tyler Hicks, Gao Xiang, Chao Yu, Yue Hu, Jeffle Xu, Namjae Jeon,
Sungjong Seo, Jan Kara, Theodore Ts'o, Andreas Dilger,
Jaegeuk Kim, OGAWA Hirofumi, Miklos Szeredi, Bob Peterson,
Andreas Gruenbacher, Greg Kroah-Hartman, Tejun Heo,
Trond Myklebust, Anna Schumaker, Konstantin Komarov, Mark Fasheh,
Joel Becker, Joseph Qi, Mike Marshall, Martin Brandenburg,
Luis Chamberlain, Kees Cook, Iurii Zaikin, Steve French,
Paulo Alcantara, Ronnie Sahlberg, Shyam Prasad N, Tom Talpey,
Sergey Senozhatsky, Richard Weinberger, Hans de Goede,
Hugh Dickins, Andrew Morton, Amir Goldstein, Darrick J. Wong,
Benjamin Coddington
Cc: Jeff Layton, linux-kernel, linux-mm, linux-mtd, linux-afs,
linux-cifs, codalist, cluster-devel, linux-ext4, devel, ecryptfs,
ocfs2-devel, ceph-devel, linux-nfs, v9fs, samba-technical,
linux-unionfs, linux-f2fs-devel, linux-xfs, linux-fsdevel, ntfs3,
linux-erofs, linux-btrfs
In later patches, we're going to drop the "now" parameter from the
update_time operation. Fix fat_update_time to fetch its own timestamp.
It turns out that this is easily done by just passing a NULL timestamp
pointer to fat_update_time.
Also, it may be that things have changed by the time we get to calling
fat_update_time after checking inode_needs_update_time. Ensure that we
attempt the i_version bump if any of the S_* flags besides S_ATIME are
set.
Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
fs/fat/misc.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/fat/misc.c b/fs/fat/misc.c
index 67006ea08db6..8cab87145d63 100644
--- a/fs/fat/misc.c
+++ b/fs/fat/misc.c
@@ -347,14 +347,14 @@ int fat_update_time(struct inode *inode, struct timespec64 *now, int flags)
return 0;
if (flags & (S_ATIME | S_CTIME | S_MTIME)) {
- fat_truncate_time(inode, now, flags);
+ fat_truncate_time(inode, NULL, flags);
if (inode->i_sb->s_flags & SB_LAZYTIME)
dirty_flags |= I_DIRTY_TIME;
else
dirty_flags |= I_DIRTY_SYNC;
}
- if ((flags & S_VERSION) && inode_maybe_inc_iversion(inode, false))
+ if ((flags & (S_VERSION|S_CTIME|S_MTIME)) && inode_maybe_inc_iversion(inode, false))
dirty_flags |= I_DIRTY_SYNC;
__mark_inode_dirty(inode, dirty_flags);
--
2.41.0
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply related [flat|nested] 76+ messages in thread
* Re: [f2fs-dev] [PATCH v7 05/13] fat: make fat_update_time get its own timestamp
2023-08-07 19:38 ` [f2fs-dev] [PATCH v7 05/13] fat: make fat_update_time get its own timestamp Jeff Layton
@ 2023-08-08 9:32 ` Jan Kara
2023-08-09 7:08 ` Christian Brauner
2023-08-09 8:37 ` OGAWA Hirofumi
1 sibling, 1 reply; 76+ messages in thread
From: Jan Kara @ 2023-08-08 9:32 UTC (permalink / raw)
To: Jeff Layton
Cc: Latchesar Ionkov, Martin Brandenburg, Konstantin Komarov,
linux-xfs, Darrick J. Wong, Dominique Martinet,
Christian Schoenebeck, ecryptfs, linux-unionfs, David Howells,
Chris Mason, Andreas Dilger, Hans de Goede, Marc Dionne, codalist,
linux-afs, linux-mtd, Mike Marshall, Paulo Alcantara, linux-cifs,
Eric Van Hensbergen, Andreas Gruenbacher, Miklos Szeredi,
Richard Weinberger, Mark Fasheh, Hugh Dickins,
Benjamin Coddington, Tyler Hicks, cluster-devel, coda, linux-mm,
Ilya Dryomov, Iurii Zaikin, Namjae Jeon, Trond Myklebust,
Shyam Prasad N, Amir Goldstein, Kees Cook, ocfs2-devel,
Josef Bacik, Tom Talpey, Tejun Heo, Yue Hu, Alexander Viro,
Ronnie Sahlberg, David Sterba, Jaegeuk Kim, ceph-devel, Xiubo Li,
Gao Xiang, OGAWA Hirofumi, Jan Harkes, Christian Brauner,
linux-ext4, Theodore Ts'o, Joseph Qi, Greg Kroah-Hartman,
v9fs, ntfs3, samba-technical, linux-kernel, linux-f2fs-devel,
Steve French, Sergey Senozhatsky, Luis Chamberlain, Jeffle Xu,
devel, Anna Schumaker, Jan Kara, Bob Peterson, linux-fsdevel,
Andrew Morton, Sungjong Seo, linux-erofs, linux-nfs, linux-btrfs,
Joel Becker
On Mon 07-08-23 15:38:36, Jeff Layton wrote:
> In later patches, we're going to drop the "now" parameter from the
> update_time operation. Fix fat_update_time to fetch its own timestamp.
> It turns out that this is easily done by just passing a NULL timestamp
> pointer to fat_update_time.
^^^ fat_truncate_time()
> Also, it may be that things have changed by the time we get to calling
> fat_update_time after checking inode_needs_update_time. Ensure that we
> attempt the i_version bump if any of the S_* flags besides S_ATIME are
> set.
>
> Signed-off-by: Jeff Layton <jlayton@kernel.org>
Looks good. Feel free to add:
Reviewed-by: Jan Kara <jack@suse.cz>
Honza
> ---
> fs/fat/misc.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/fs/fat/misc.c b/fs/fat/misc.c
> index 67006ea08db6..8cab87145d63 100644
> --- a/fs/fat/misc.c
> +++ b/fs/fat/misc.c
> @@ -347,14 +347,14 @@ int fat_update_time(struct inode *inode, struct timespec64 *now, int flags)
> return 0;
>
> if (flags & (S_ATIME | S_CTIME | S_MTIME)) {
> - fat_truncate_time(inode, now, flags);
> + fat_truncate_time(inode, NULL, flags);
> if (inode->i_sb->s_flags & SB_LAZYTIME)
> dirty_flags |= I_DIRTY_TIME;
> else
> dirty_flags |= I_DIRTY_SYNC;
> }
>
> - if ((flags & S_VERSION) && inode_maybe_inc_iversion(inode, false))
> + if ((flags & (S_VERSION|S_CTIME|S_MTIME)) && inode_maybe_inc_iversion(inode, false))
> dirty_flags |= I_DIRTY_SYNC;
>
> __mark_inode_dirty(inode, dirty_flags);
>
> --
> 2.41.0
>
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply [flat|nested] 76+ messages in thread
* Re: [f2fs-dev] [PATCH v7 05/13] fat: make fat_update_time get its own timestamp
2023-08-08 9:32 ` Jan Kara
@ 2023-08-09 7:08 ` Christian Brauner
0 siblings, 0 replies; 76+ messages in thread
From: Christian Brauner @ 2023-08-09 7:08 UTC (permalink / raw)
To: Jan Kara
Cc: Latchesar Ionkov, Martin Brandenburg, Konstantin Komarov,
linux-xfs, Darrick J. Wong, Dominique Martinet,
Christian Schoenebeck, ecryptfs, linux-unionfs, David Howells,
Chris Mason, Andreas Dilger, Hans de Goede, Marc Dionne,
samba-technical, codalist, linux-afs, linux-mtd, Mike Marshall,
Paulo Alcantara, linux-cifs, Eric Van Hensbergen,
Andreas Gruenbacher, Miklos Szeredi, Richard Weinberger,
Mark Fasheh, Hugh Dickins, Benjamin Coddington, Tyler Hicks,
cluster-devel, coda, linux-mm, Ilya Dryomov, Iurii Zaikin,
Namjae Jeon, Trond Myklebust, Shyam Prasad N, Amir Goldstein,
Kees Cook, ocfs2-devel, Josef Bacik, Tom Talpey, Tejun Heo,
Yue Hu, Alexander Viro, Ronnie Sahlberg, David Sterba,
Jaegeuk Kim, ceph-devel, Xiubo Li, Gao Xiang, OGAWA Hirofumi,
Jan Harkes, linux-nfs, linux-ext4, Theodore Ts'o, Joseph Qi,
Greg Kroah-Hartman, v9fs, ntfs3, Jeff Layton, linux-kernel,
linux-f2fs-devel, Steve French, Sergey Senozhatsky,
Luis Chamberlain, Jeffle Xu, devel, Anna Schumaker, Jan Kara,
Bob Peterson, linux-fsdevel, Andrew Morton, Sungjong Seo,
linux-erofs, linux-btrfs, Joel Becker
On Tue, Aug 08, 2023 at 11:32:26AM +0200, Jan Kara wrote:
> On Mon 07-08-23 15:38:36, Jeff Layton wrote:
> > In later patches, we're going to drop the "now" parameter from the
> > update_time operation. Fix fat_update_time to fetch its own timestamp.
> > It turns out that this is easily done by just passing a NULL timestamp
> > pointer to fat_update_time.
> ^^^ fat_truncate_time()
Fixed in-tree, thanks!
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply [flat|nested] 76+ messages in thread
* Re: [f2fs-dev] [PATCH v7 05/13] fat: make fat_update_time get its own timestamp
2023-08-07 19:38 ` [f2fs-dev] [PATCH v7 05/13] fat: make fat_update_time get its own timestamp Jeff Layton
2023-08-08 9:32 ` Jan Kara
@ 2023-08-09 8:37 ` OGAWA Hirofumi
2023-08-09 8:41 ` OGAWA Hirofumi
2023-08-09 10:10 ` Jeff Layton
1 sibling, 2 replies; 76+ messages in thread
From: OGAWA Hirofumi @ 2023-08-09 8:37 UTC (permalink / raw)
To: Jeff Layton
Cc: Latchesar Ionkov, Martin Brandenburg, Konstantin Komarov,
Darrick J. Wong, Dominique Martinet, Christian Schoenebeck,
ecryptfs, Yue Hu, David Howells, Chris Mason, Andreas Dilger,
Hans de Goede, Marc Dionne, linux-xfs, linux-afs, linux-mtd,
Mike Marshall, Paulo Alcantara, linux-cifs, Eric Van Hensbergen,
Andreas Gruenbacher, Miklos Szeredi, Richard Weinberger,
Mark Fasheh, linux-unionfs, Hugh Dickins, Benjamin Coddington,
Tyler Hicks, cluster-devel, coda, linux-mm, Ilya Dryomov,
Iurii Zaikin, Namjae Jeon, Trond Myklebust, codalist,
Shyam Prasad N, Amir Goldstein, Kees Cook, ocfs2-devel,
Josef Bacik, Tom Talpey, Tejun Heo, Alexander Viro,
Ronnie Sahlberg, David Sterba, Jaegeuk Kim, ceph-devel, Xiubo Li,
Gao Xiang, Jan Harkes, Christian Brauner, linux-ext4,
Theodore Ts'o, Joseph Qi, Greg Kroah-Hartman, v9fs, ntfs3,
samba-technical, linux-kernel, linux-f2fs-devel, Steve French,
Sergey Senozhatsky, Luis Chamberlain, Jeffle Xu, devel,
Anna Schumaker, Jan Kara, Bob Peterson, linux-fsdevel,
Andrew Morton, Sungjong Seo, linux-erofs, linux-nfs, linux-btrfs,
Joel Becker
Jeff Layton <jlayton@kernel.org> writes:
> Also, it may be that things have changed by the time we get to calling
> fat_update_time after checking inode_needs_update_time. Ensure that we
> attempt the i_version bump if any of the S_* flags besides S_ATIME are
> set.
I'm not sure what it meaning though, this is from
generic_update_time(). Are you going to change generic_update_time()
too? If so, it doesn't break lazytime feature?
Thanks.
> Signed-off-by: Jeff Layton <jlayton@kernel.org>
> ---
> fs/fat/misc.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/fs/fat/misc.c b/fs/fat/misc.c
> index 67006ea08db6..8cab87145d63 100644
> --- a/fs/fat/misc.c
> +++ b/fs/fat/misc.c
> @@ -347,14 +347,14 @@ int fat_update_time(struct inode *inode, struct timespec64 *now, int flags)
> return 0;
>
> if (flags & (S_ATIME | S_CTIME | S_MTIME)) {
> - fat_truncate_time(inode, now, flags);
> + fat_truncate_time(inode, NULL, flags);
> if (inode->i_sb->s_flags & SB_LAZYTIME)
> dirty_flags |= I_DIRTY_TIME;
> else
> dirty_flags |= I_DIRTY_SYNC;
> }
>
> - if ((flags & S_VERSION) && inode_maybe_inc_iversion(inode, false))
> + if ((flags & (S_VERSION|S_CTIME|S_MTIME)) && inode_maybe_inc_iversion(inode, false))
> dirty_flags |= I_DIRTY_SYNC;
>
> __mark_inode_dirty(inode, dirty_flags);
--
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply [flat|nested] 76+ messages in thread
* Re: [f2fs-dev] [PATCH v7 05/13] fat: make fat_update_time get its own timestamp
2023-08-09 8:37 ` OGAWA Hirofumi
@ 2023-08-09 8:41 ` OGAWA Hirofumi
2023-08-09 10:10 ` Jeff Layton
1 sibling, 0 replies; 76+ messages in thread
From: OGAWA Hirofumi @ 2023-08-09 8:41 UTC (permalink / raw)
To: Jeff Layton
Cc: Latchesar Ionkov, Martin Brandenburg, Konstantin Komarov,
Darrick J. Wong, Dominique Martinet, Christian Schoenebeck,
ecryptfs, Yue Hu, David Howells, Chris Mason, Andreas Dilger,
Hans de Goede, Marc Dionne, linux-xfs, linux-afs, linux-mtd,
Mike Marshall, Paulo Alcantara, linux-cifs, Eric Van Hensbergen,
Andreas Gruenbacher, Miklos Szeredi, Richard Weinberger,
Mark Fasheh, linux-unionfs, Hugh Dickins, Benjamin Coddington,
Tyler Hicks, cluster-devel, coda, linux-mm, Ilya Dryomov,
Iurii Zaikin, Namjae Jeon, Trond Myklebust, codalist,
Shyam Prasad N, Amir Goldstein, Kees Cook, ocfs2-devel,
Josef Bacik, Tom Talpey, Tejun Heo, Alexander Viro,
Ronnie Sahlberg, David Sterba, Jaegeuk Kim, ceph-devel, Xiubo Li,
Gao Xiang, Jan Harkes, Christian Brauner, linux-ext4,
Theodore Ts'o, Joseph Qi, Greg Kroah-Hartman, v9fs, ntfs3,
samba-technical, linux-kernel, linux-f2fs-devel, Steve French,
Sergey Senozhatsky, Luis Chamberlain, Jeffle Xu, devel,
Anna Schumaker, Jan Kara, Bob Peterson, linux-fsdevel,
Andrew Morton, Sungjong Seo, linux-erofs, linux-nfs, linux-btrfs,
Joel Becker
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp> writes:
> Jeff Layton <jlayton@kernel.org> writes:
>
>> Also, it may be that things have changed by the time we get to calling
>> fat_update_time after checking inode_needs_update_time. Ensure that we
>> attempt the i_version bump if any of the S_* flags besides S_ATIME are
>> set.
>
> I'm not sure what it meaning though, this is from
> generic_update_time(). Are you going to change generic_update_time()
> too? If so, it doesn't break lazytime feature?
>
> Thanks.
BTW, fat is not implementing lazytime now, but it is for future.
--
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply [flat|nested] 76+ messages in thread
* Re: [f2fs-dev] [PATCH v7 05/13] fat: make fat_update_time get its own timestamp
2023-08-09 8:37 ` OGAWA Hirofumi
2023-08-09 8:41 ` OGAWA Hirofumi
@ 2023-08-09 10:10 ` Jeff Layton
2023-08-09 13:36 ` OGAWA Hirofumi
1 sibling, 1 reply; 76+ messages in thread
From: Jeff Layton @ 2023-08-09 10:10 UTC (permalink / raw)
To: OGAWA Hirofumi
Cc: Latchesar Ionkov, Martin Brandenburg, Konstantin Komarov,
Darrick J. Wong, Dominique Martinet, Christian Schoenebeck,
ecryptfs, Yue Hu, David Howells, Chris Mason, Andreas Dilger,
Hans de Goede, Marc Dionne, linux-xfs, linux-afs, linux-mtd,
Mike Marshall, Paulo Alcantara, linux-cifs, Eric Van Hensbergen,
Andreas Gruenbacher, Miklos Szeredi, Richard Weinberger,
Mark Fasheh, linux-unionfs, Hugh Dickins, Benjamin Coddington,
Tyler Hicks, cluster-devel, coda, linux-mm, Ilya Dryomov,
Iurii Zaikin, Namjae Jeon, Trond Myklebust, codalist,
Shyam Prasad N, Amir Goldstein, Kees Cook, ocfs2-devel,
Josef Bacik, Tom Talpey, Tejun Heo, Alexander Viro,
Ronnie Sahlberg, David Sterba, Jaegeuk Kim, ceph-devel, Xiubo Li,
Gao Xiang, Jan Harkes, Christian Brauner, linux-ext4,
Theodore Ts'o, Joseph Qi, Greg Kroah-Hartman, v9fs, ntfs3,
samba-technical, linux-kernel, linux-f2fs-devel, Steve French,
Sergey Senozhatsky, Luis Chamberlain, Jeffle Xu, devel,
Anna Schumaker, Jan Kara, Bob Peterson, linux-fsdevel,
Andrew Morton, Sungjong Seo, linux-erofs, linux-nfs, linux-btrfs,
Joel Becker
On Wed, 2023-08-09 at 17:37 +0900, OGAWA Hirofumi wrote:
> Jeff Layton <jlayton@kernel.org> writes:
>
> > Also, it may be that things have changed by the time we get to calling
> > fat_update_time after checking inode_needs_update_time. Ensure that we
> > attempt the i_version bump if any of the S_* flags besides S_ATIME are
> > set.
>
> I'm not sure what it meaning though, this is from
> generic_update_time(). Are you going to change generic_update_time()
> too? If so, it doesn't break lazytime feature?
>
Yes. generic_update_time is also being changed in a similar fashion.
This shouldn't break the lazytime feature: lazytime is all about how and
when timestamps get written to disk. This work is all about which
clocksource the timestamps originally come from.
> Thanks.
>
> > Signed-off-by: Jeff Layton <jlayton@kernel.org>
> > ---
> > fs/fat/misc.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/fs/fat/misc.c b/fs/fat/misc.c
> > index 67006ea08db6..8cab87145d63 100644
> > --- a/fs/fat/misc.c
> > +++ b/fs/fat/misc.c
> > @@ -347,14 +347,14 @@ int fat_update_time(struct inode *inode, struct timespec64 *now, int flags)
> > return 0;
> >
> > if (flags & (S_ATIME | S_CTIME | S_MTIME)) {
> > - fat_truncate_time(inode, now, flags);
> > + fat_truncate_time(inode, NULL, flags);
> > if (inode->i_sb->s_flags & SB_LAZYTIME)
> > dirty_flags |= I_DIRTY_TIME;
> > else
> > dirty_flags |= I_DIRTY_SYNC;
> > }
> >
> > - if ((flags & S_VERSION) && inode_maybe_inc_iversion(inode, false))
> > + if ((flags & (S_VERSION|S_CTIME|S_MTIME)) && inode_maybe_inc_iversion(inode, false))
> > dirty_flags |= I_DIRTY_SYNC;
> >
> > __mark_inode_dirty(inode, dirty_flags);
>
--
Jeff Layton <jlayton@kernel.org>
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply [flat|nested] 76+ messages in thread
* Re: [f2fs-dev] [PATCH v7 05/13] fat: make fat_update_time get its own timestamp
2023-08-09 10:10 ` Jeff Layton
@ 2023-08-09 13:36 ` OGAWA Hirofumi
2023-08-09 14:22 ` Jeff Layton
2023-08-09 15:00 ` Jan Kara
0 siblings, 2 replies; 76+ messages in thread
From: OGAWA Hirofumi @ 2023-08-09 13:36 UTC (permalink / raw)
To: Jeff Layton
Cc: Latchesar Ionkov, Martin Brandenburg, Konstantin Komarov,
Darrick J. Wong, Dominique Martinet, Christian Schoenebeck,
ecryptfs, Yue Hu, David Howells, Chris Mason, Andreas Dilger,
Hans de Goede, Marc Dionne, linux-xfs, linux-afs, linux-mtd,
Mike Marshall, Paulo Alcantara, linux-cifs, Eric Van Hensbergen,
Andreas Gruenbacher, Miklos Szeredi, Richard Weinberger,
Mark Fasheh, linux-unionfs, Hugh Dickins, Benjamin Coddington,
Tyler Hicks, cluster-devel, coda, linux-mm, Ilya Dryomov,
Iurii Zaikin, Namjae Jeon, Trond Myklebust, codalist,
Shyam Prasad N, Amir Goldstein, Kees Cook, ocfs2-devel,
Josef Bacik, Tom Talpey, Tejun Heo, Alexander Viro,
Ronnie Sahlberg, David Sterba, Jaegeuk Kim, ceph-devel, Xiubo Li,
Gao Xiang, Jan Harkes, Christian Brauner, linux-ext4,
Theodore Ts'o, Joseph Qi, Greg Kroah-Hartman, v9fs, ntfs3,
samba-technical, linux-kernel, linux-f2fs-devel, Steve French,
Sergey Senozhatsky, Luis Chamberlain, Jeffle Xu, devel,
Anna Schumaker, Jan Kara, Bob Peterson, linux-fsdevel,
Andrew Morton, Sungjong Seo, linux-erofs, linux-nfs, linux-btrfs,
Joel Becker
Jeff Layton <jlayton@kernel.org> writes:
> On Wed, 2023-08-09 at 17:37 +0900, OGAWA Hirofumi wrote:
>> Jeff Layton <jlayton@kernel.org> writes:
>>
>> > Also, it may be that things have changed by the time we get to calling
>> > fat_update_time after checking inode_needs_update_time. Ensure that we
>> > attempt the i_version bump if any of the S_* flags besides S_ATIME are
>> > set.
>>
>> I'm not sure what it meaning though, this is from
>> generic_update_time(). Are you going to change generic_update_time()
>> too? If so, it doesn't break lazytime feature?
>>
>
> Yes. generic_update_time is also being changed in a similar fashion.
> This shouldn't break the lazytime feature: lazytime is all about how and
> when timestamps get written to disk. This work is all about which
> clocksource the timestamps originally come from.
I can only find the following update in this series, another series
updates generic_update_time()? The patch updates only if S_VERSION is
set.
Your fat patch sets I_DIRTY_SYNC always instead of I_DIRTY_TIME. When I
last time checked lazytime, and it was depending on I_DIRTY_TIME.
Are you sure it doesn't break lazytime? I'm totally confusing, and
really similar with generic_update_time()?
Thanks.
+/**
+ * generic_update_time - update the timestamps on the inode
+ * @inode: inode to be updated
+ * @flags: S_* flags that needed to be updated
+ *
+ * The update_time function is called when an inode's timestamps need to be
+ * updated for a read or write operation. In the case where any of S_MTIME, S_CTIME,
+ * or S_VERSION need to be updated we attempt to update all three of them. S_ATIME
+ * updates can be handled done independently of the rest.
+ *
+ * Returns a S_* mask indicating which fields were updated.
+ */
+int generic_update_time(struct inode *inode, int flags)
+{
+ int updated = inode_update_timestamps(inode, flags);
+ int dirty_flags = 0;
+ if (updated & (S_ATIME|S_MTIME|S_CTIME))
+ dirty_flags = inode->i_sb->s_flags & SB_LAZYTIME ? I_DIRTY_TIME : I_DIRTY_SYNC;
+ if (updated & S_VERSION)
+ dirty_flags |= I_DIRTY_SYNC;
__mark_inode_dirty(inode, dirty_flags);
- return 0;
+ return updated;
}
>> > - if ((flags & S_VERSION) && inode_maybe_inc_iversion(inode, false))
>> > + if ((flags & (S_VERSION|S_CTIME|S_MTIME)) && inode_maybe_inc_iversion(inode, false))
>> > dirty_flags |= I_DIRTY_SYNC;
>> >
>> > __mark_inode_dirty(inode, dirty_flags);
>>
--
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply [flat|nested] 76+ messages in thread
* Re: [f2fs-dev] [PATCH v7 05/13] fat: make fat_update_time get its own timestamp
2023-08-09 13:36 ` OGAWA Hirofumi
@ 2023-08-09 14:22 ` Jeff Layton
2023-08-09 14:44 ` OGAWA Hirofumi
2023-08-09 15:00 ` Jan Kara
1 sibling, 1 reply; 76+ messages in thread
From: Jeff Layton @ 2023-08-09 14:22 UTC (permalink / raw)
To: OGAWA Hirofumi
Cc: Latchesar Ionkov, Martin Brandenburg, Konstantin Komarov,
Darrick J. Wong, Dominique Martinet, Christian Schoenebeck,
ecryptfs, Yue Hu, David Howells, Chris Mason, Andreas Dilger,
Hans de Goede, Marc Dionne, linux-xfs, linux-afs, linux-mtd,
Mike Marshall, Paulo Alcantara, linux-cifs, Eric Van Hensbergen,
Andreas Gruenbacher, Miklos Szeredi, Richard Weinberger,
Mark Fasheh, linux-unionfs, Hugh Dickins, Benjamin Coddington,
Tyler Hicks, cluster-devel, coda, linux-mm, Ilya Dryomov,
Iurii Zaikin, Namjae Jeon, Trond Myklebust, codalist,
Shyam Prasad N, Amir Goldstein, Kees Cook, ocfs2-devel,
Josef Bacik, Tom Talpey, Tejun Heo, Alexander Viro,
Ronnie Sahlberg, David Sterba, Jaegeuk Kim, ceph-devel, Xiubo Li,
Gao Xiang, Jan Harkes, Christian Brauner, linux-ext4,
Theodore Ts'o, Joseph Qi, Greg Kroah-Hartman, v9fs, ntfs3,
samba-technical, linux-kernel, linux-f2fs-devel, Steve French,
Sergey Senozhatsky, Luis Chamberlain, Jeffle Xu, devel,
Anna Schumaker, Jan Kara, Bob Peterson, linux-fsdevel,
Andrew Morton, Sungjong Seo, linux-erofs, linux-nfs, linux-btrfs,
Joel Becker
On Wed, 2023-08-09 at 22:36 +0900, OGAWA Hirofumi wrote:
> Jeff Layton <jlayton@kernel.org> writes:
>
> > On Wed, 2023-08-09 at 17:37 +0900, OGAWA Hirofumi wrote:
> > > Jeff Layton <jlayton@kernel.org> writes:
> > >
> > > > Also, it may be that things have changed by the time we get to calling
> > > > fat_update_time after checking inode_needs_update_time. Ensure that we
> > > > attempt the i_version bump if any of the S_* flags besides S_ATIME are
> > > > set.
> > >
> > > I'm not sure what it meaning though, this is from
> > > generic_update_time(). Are you going to change generic_update_time()
> > > too? If so, it doesn't break lazytime feature?
> > >
> >
> > Yes. generic_update_time is also being changed in a similar fashion.
> > This shouldn't break the lazytime feature: lazytime is all about how and
> > when timestamps get written to disk. This work is all about which
> > clocksource the timestamps originally come from.
>
> I can only find the following update in this series, another series
> updates generic_update_time()? The patch updates only if S_VERSION is
> set.
>
> Your fat patch sets I_DIRTY_SYNC always instead of I_DIRTY_TIME. When I
> last time checked lazytime, and it was depending on I_DIRTY_TIME.
>
> Are you sure it doesn't break lazytime? I'm totally confusing, and
> really similar with generic_update_time()?
>
I'm a little confused too. Why do you believe this will break
-o relatime handling? This patch changes two things:
1/ it has fat_update_time fetch its own timestamp (and ignore the "now"
parameter). This is in line with the changes in patch #3 of this series,
which explains the rationale for this in more detail.
2/ it changes fat_update_time to also update the i_version if any of
S_CTIME|S_MTIME|S_VERSION are set. relatime is all about the S_ATIME,
and it is specifically excluded from that set.
The rationale for the second change is is also in patch #3, but
basically, we can't guarantee that current_time hasn't changed since we
last checked for inode_needs_update_time, so if any of
S_CTIME/S_MTIME/S_VERSION have changed, then we need to assume that any
of them may need to be changed and attempt to update all 3.
That said, I think the logic in fat_update_time isn't quite right. I
think want something like this on top of this patch to ensure that the
S_CTIME and S_MTIME get updated, even if the flags only have S_VERSION
set.
Thoughts?
---------------------8<-----------------------
diff --git a/fs/fat/misc.c b/fs/fat/misc.c
index 080a5035483f..313eef02f45c 100644
--- a/fs/fat/misc.c
+++ b/fs/fat/misc.c
@@ -346,15 +346,21 @@ int fat_update_time(struct inode *inode, int flags)
if (inode->i_ino == MSDOS_ROOT_INO)
return 0;
- if (flags & (S_ATIME | S_CTIME | S_MTIME)) {
- fat_truncate_time(inode, NULL, flags);
- if (inode->i_sb->s_flags & SB_LAZYTIME)
- dirty_flags |= I_DIRTY_TIME;
- else
- dirty_flags |= I_DIRTY_SYNC;
- }
+ /*
+ * If any of the flags indicate an expicit change to the file, then we
+ * need to ensure that we attempt to update all of 3. We do not do
+ * this in the case of an S_ATIME-only update.
+ */
+ if (flags & (S_CTIME | S_MTIME | S_VERSION))
+ flags |= S_CTIME | S_MTIME | S_VERSION;
+
+ fat_truncate_time(inode, NULL, flags);
+ if (inode->i_sb->s_flags & SB_LAZYTIME)
+ dirty_flags |= I_DIRTY_TIME;
+ else
+ dirty_flags |= I_DIRTY_SYNC;
- if ((flags & (S_VERSION|S_CTIME|S_MTIME)) && inode_maybe_inc_iversion(inode, false))
+ if ((flags & S_VERSION) && inode_maybe_inc_iversion(inode, false))
dirty_flags |= I_DIRTY_SYNC;
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply related [flat|nested] 76+ messages in thread
* Re: [f2fs-dev] [PATCH v7 05/13] fat: make fat_update_time get its own timestamp
2023-08-09 14:22 ` Jeff Layton
@ 2023-08-09 14:44 ` OGAWA Hirofumi
2023-08-09 14:52 ` OGAWA Hirofumi
0 siblings, 1 reply; 76+ messages in thread
From: OGAWA Hirofumi @ 2023-08-09 14:44 UTC (permalink / raw)
To: Jeff Layton
Cc: Latchesar Ionkov, Martin Brandenburg, Konstantin Komarov,
Darrick J. Wong, Dominique Martinet, Christian Schoenebeck,
ecryptfs, Yue Hu, David Howells, Chris Mason, Andreas Dilger,
Hans de Goede, Marc Dionne, linux-xfs, linux-afs, linux-mtd,
Mike Marshall, Paulo Alcantara, linux-cifs, Eric Van Hensbergen,
Andreas Gruenbacher, Miklos Szeredi, Richard Weinberger,
Mark Fasheh, linux-unionfs, Hugh Dickins, Benjamin Coddington,
Tyler Hicks, cluster-devel, coda, linux-mm, Ilya Dryomov,
Iurii Zaikin, Namjae Jeon, Trond Myklebust, codalist,
Shyam Prasad N, Amir Goldstein, Kees Cook, ocfs2-devel,
Josef Bacik, Tom Talpey, Tejun Heo, Alexander Viro,
Ronnie Sahlberg, David Sterba, Jaegeuk Kim, ceph-devel, Xiubo Li,
Gao Xiang, Jan Harkes, Christian Brauner, linux-ext4,
Theodore Ts'o, Joseph Qi, Greg Kroah-Hartman, v9fs, ntfs3,
samba-technical, linux-kernel, linux-f2fs-devel, Steve French,
Sergey Senozhatsky, Luis Chamberlain, Jeffle Xu, devel,
Anna Schumaker, Jan Kara, Bob Peterson, linux-fsdevel,
Andrew Morton, Sungjong Seo, linux-erofs, linux-nfs, linux-btrfs,
Joel Becker
Jeff Layton <jlayton@kernel.org> writes:
> I'm a little confused too. Why do you believe this will break
> -o relatime handling? This patch changes two things:
>
> 1/ it has fat_update_time fetch its own timestamp (and ignore the "now"
> parameter). This is in line with the changes in patch #3 of this series,
> which explains the rationale for this in more detail.
>
> 2/ it changes fat_update_time to also update the i_version if any of
> S_CTIME|S_MTIME|S_VERSION are set. relatime is all about the S_ATIME,
> and it is specifically excluded from that set.
>
> The rationale for the second change is is also in patch #3, but
> basically, we can't guarantee that current_time hasn't changed since we
> last checked for inode_needs_update_time, so if any of
> S_CTIME/S_MTIME/S_VERSION have changed, then we need to assume that any
> of them may need to be changed and attempt to update all 3.
>
> That said, I think the logic in fat_update_time isn't quite right. I
> think want something like this on top of this patch to ensure that the
> S_CTIME and S_MTIME get updated, even if the flags only have S_VERSION
> set.
>
> Thoughts?
I'm not talking about "relatime" at all, I'm always talking about
"lazytime".
I_DIRTY_TIME delays to update on disk inode only if changed
timestamp. But you changed it to I_DIRTY_SYNC, i.e. always update on
disk inode by timestamp.
Thanks.
> ---------------------8<-----------------------
>
> diff --git a/fs/fat/misc.c b/fs/fat/misc.c
> index 080a5035483f..313eef02f45c 100644
> --- a/fs/fat/misc.c
> +++ b/fs/fat/misc.c
> @@ -346,15 +346,21 @@ int fat_update_time(struct inode *inode, int flags)
> if (inode->i_ino == MSDOS_ROOT_INO)
> return 0;
>
> - if (flags & (S_ATIME | S_CTIME | S_MTIME)) {
> - fat_truncate_time(inode, NULL, flags);
> - if (inode->i_sb->s_flags & SB_LAZYTIME)
> - dirty_flags |= I_DIRTY_TIME;
> - else
> - dirty_flags |= I_DIRTY_SYNC;
> - }
> + /*
> + * If any of the flags indicate an expicit change to the file, then we
> + * need to ensure that we attempt to update all of 3. We do not do
> + * this in the case of an S_ATIME-only update.
> + */
> + if (flags & (S_CTIME | S_MTIME | S_VERSION))
> + flags |= S_CTIME | S_MTIME | S_VERSION;
> +
> + fat_truncate_time(inode, NULL, flags);
> + if (inode->i_sb->s_flags & SB_LAZYTIME)
> + dirty_flags |= I_DIRTY_TIME;
> + else
> + dirty_flags |= I_DIRTY_SYNC;
>
> - if ((flags & (S_VERSION|S_CTIME|S_MTIME)) && inode_maybe_inc_iversion(inode, false))
> + if ((flags & S_VERSION) && inode_maybe_inc_iversion(inode, false))
> dirty_flags |= I_DIRTY_SYNC;
>
--
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply [flat|nested] 76+ messages in thread
* Re: [f2fs-dev] [PATCH v7 05/13] fat: make fat_update_time get its own timestamp
2023-08-09 14:44 ` OGAWA Hirofumi
@ 2023-08-09 14:52 ` OGAWA Hirofumi
0 siblings, 0 replies; 76+ messages in thread
From: OGAWA Hirofumi @ 2023-08-09 14:52 UTC (permalink / raw)
To: Jeff Layton
Cc: Latchesar Ionkov, Martin Brandenburg, Konstantin Komarov,
Darrick J. Wong, Dominique Martinet, Christian Schoenebeck,
ecryptfs, Yue Hu, David Howells, Chris Mason, Andreas Dilger,
Hans de Goede, Marc Dionne, linux-xfs, linux-afs, linux-mtd,
Mike Marshall, Paulo Alcantara, linux-cifs, Eric Van Hensbergen,
Andreas Gruenbacher, Miklos Szeredi, Richard Weinberger,
Mark Fasheh, linux-unionfs, Hugh Dickins, Benjamin Coddington,
Tyler Hicks, cluster-devel, coda, linux-mm, Ilya Dryomov,
Iurii Zaikin, Namjae Jeon, Trond Myklebust, codalist,
Shyam Prasad N, Amir Goldstein, Kees Cook, ocfs2-devel,
Josef Bacik, Tom Talpey, Tejun Heo, Alexander Viro,
Ronnie Sahlberg, David Sterba, Jaegeuk Kim, ceph-devel, Xiubo Li,
Gao Xiang, Jan Harkes, Christian Brauner, linux-ext4,
Theodore Ts'o, Joseph Qi, Greg Kroah-Hartman, v9fs, ntfs3,
samba-technical, linux-kernel, linux-f2fs-devel, Steve French,
Sergey Senozhatsky, Luis Chamberlain, Jeffle Xu, devel,
Anna Schumaker, Jan Kara, Bob Peterson, linux-fsdevel,
Andrew Morton, Sungjong Seo, linux-erofs, linux-nfs, linux-btrfs,
Joel Becker
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp> writes:
> Jeff Layton <jlayton@kernel.org> writes:
>
>> I'm a little confused too. Why do you believe this will break
>> -o relatime handling? This patch changes two things:
>>
>> 1/ it has fat_update_time fetch its own timestamp (and ignore the "now"
>> parameter). This is in line with the changes in patch #3 of this series,
>> which explains the rationale for this in more detail.
>>
>> 2/ it changes fat_update_time to also update the i_version if any of
>> S_CTIME|S_MTIME|S_VERSION are set. relatime is all about the S_ATIME,
>> and it is specifically excluded from that set.
>>
>> The rationale for the second change is is also in patch #3, but
>> basically, we can't guarantee that current_time hasn't changed since we
>> last checked for inode_needs_update_time, so if any of
>> S_CTIME/S_MTIME/S_VERSION have changed, then we need to assume that any
>> of them may need to be changed and attempt to update all 3.
>>
>> That said, I think the logic in fat_update_time isn't quite right. I
>> think want something like this on top of this patch to ensure that the
>> S_CTIME and S_MTIME get updated, even if the flags only have S_VERSION
>> set.
>>
>> Thoughts?
>
> I'm not talking about "relatime" at all, I'm always talking about
> "lazytime".
>
> I_DIRTY_TIME delays to update on disk inode only if changed
> timestamp. But you changed it to I_DIRTY_SYNC, i.e. always update on
> disk inode by timestamp.
And if change like it, why doesn't same change goes to generic_update_time()?
It looks like generic_update_time() in this series doesn't work like you said.
--
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply [flat|nested] 76+ messages in thread
* Re: [f2fs-dev] [PATCH v7 05/13] fat: make fat_update_time get its own timestamp
2023-08-09 13:36 ` OGAWA Hirofumi
2023-08-09 14:22 ` Jeff Layton
@ 2023-08-09 15:00 ` Jan Kara
2023-08-09 15:17 ` OGAWA Hirofumi
1 sibling, 1 reply; 76+ messages in thread
From: Jan Kara @ 2023-08-09 15:00 UTC (permalink / raw)
To: OGAWA Hirofumi
Cc: Latchesar Ionkov, Martin Brandenburg, Konstantin Komarov,
Darrick J. Wong, Dominique Martinet, Christian Schoenebeck,
ecryptfs, Yue Hu, David Howells, Chris Mason, Andreas Dilger,
Hans de Goede, Marc Dionne, samba-technical, linux-xfs, linux-afs,
linux-mtd, Mike Marshall, Paulo Alcantara, linux-cifs,
Eric Van Hensbergen, Andreas Gruenbacher, Miklos Szeredi,
Richard Weinberger, Mark Fasheh, linux-unionfs, Hugh Dickins,
Benjamin Coddington, Tyler Hicks, cluster-devel, coda, linux-mm,
Ilya Dryomov, Iurii Zaikin, Namjae Jeon, Trond Myklebust,
codalist, Shyam Prasad N, Amir Goldstein, Kees Cook, ocfs2-devel,
Josef Bacik, Tom Talpey, Tejun Heo, Alexander Viro,
Ronnie Sahlberg, David Sterba, Jaegeuk Kim, ceph-devel, Xiubo Li,
Gao Xiang, Jan Harkes, Christian Brauner, linux-ext4,
Theodore Ts'o, Joseph Qi, Greg Kroah-Hartman, v9fs, ntfs3,
Jeff Layton, linux-kernel, linux-f2fs-devel, Steve French,
Sergey Senozhatsky, Luis Chamberlain, Jeffle Xu, devel,
Anna Schumaker, Jan Kara, Bob Peterson, linux-fsdevel,
Andrew Morton, Sungjong Seo, linux-erofs, linux-nfs, linux-btrfs,
Joel Becker
On Wed 09-08-23 22:36:29, OGAWA Hirofumi wrote:
> Jeff Layton <jlayton@kernel.org> writes:
>
> > On Wed, 2023-08-09 at 17:37 +0900, OGAWA Hirofumi wrote:
> >> Jeff Layton <jlayton@kernel.org> writes:
> >>
> >> > Also, it may be that things have changed by the time we get to calling
> >> > fat_update_time after checking inode_needs_update_time. Ensure that we
> >> > attempt the i_version bump if any of the S_* flags besides S_ATIME are
> >> > set.
> >>
> >> I'm not sure what it meaning though, this is from
> >> generic_update_time(). Are you going to change generic_update_time()
> >> too? If so, it doesn't break lazytime feature?
> >>
> >
> > Yes. generic_update_time is also being changed in a similar fashion.
> > This shouldn't break the lazytime feature: lazytime is all about how and
> > when timestamps get written to disk. This work is all about which
> > clocksource the timestamps originally come from.
>
> I can only find the following update in this series, another series
> updates generic_update_time()? The patch updates only if S_VERSION is
> set.
>
> Your fat patch sets I_DIRTY_SYNC always instead of I_DIRTY_TIME. When I
> last time checked lazytime, and it was depending on I_DIRTY_TIME.
>
> Are you sure it doesn't break lazytime? I'm totally confusing, and
> really similar with generic_update_time()?
Since you are talking past one another with Jeff let me chime in here :). I
think you are worried about this hunk:
- if ((flags & S_VERSION) && inode_maybe_inc_iversion(inode, false))
+ if ((flags & (S_VERSION|S_CTIME|S_MTIME)) && inode_maybe_inc_iversion(inode, false))
dirty_flags |= I_DIRTY_SYNC;
which makes the 'flags' test pass even if we just modified ctime or mtime.
But do note the second part of the if - inode_maybe_inc_iversion() - so we
are going to mark the inode dirty with I_DIRTY_SYNC only if someone queried
iversion since the last time we have incremented it.
So this hunk is not really changing how inode is marked dirty, it only
changes how often we check whether iversion needs increment and that should
be fine (and desirable). Hence lazytime isn't really broken by this in any
way.
Honza
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply [flat|nested] 76+ messages in thread
* Re: [f2fs-dev] [PATCH v7 05/13] fat: make fat_update_time get its own timestamp
2023-08-09 15:00 ` Jan Kara
@ 2023-08-09 15:17 ` OGAWA Hirofumi
2023-08-09 16:30 ` Jeff Layton
0 siblings, 1 reply; 76+ messages in thread
From: OGAWA Hirofumi @ 2023-08-09 15:17 UTC (permalink / raw)
To: Jan Kara
Cc: Latchesar Ionkov, Martin Brandenburg, Konstantin Komarov,
Darrick J. Wong, Dominique Martinet, Christian Schoenebeck,
ecryptfs, Yue Hu, David Howells, Chris Mason, Andreas Dilger,
Hans de Goede, Marc Dionne, samba-technical, linux-xfs, linux-afs,
linux-mtd, Mike Marshall, Paulo Alcantara, linux-cifs,
Eric Van Hensbergen, Andreas Gruenbacher, Miklos Szeredi,
Richard Weinberger, Mark Fasheh, linux-unionfs, Hugh Dickins,
Benjamin Coddington, Tyler Hicks, cluster-devel, coda, linux-mm,
Ilya Dryomov, Iurii Zaikin, Namjae Jeon, Trond Myklebust,
codalist, Shyam Prasad N, Amir Goldstein, Kees Cook, ocfs2-devel,
Josef Bacik, Tom Talpey, Tejun Heo, Alexander Viro,
Ronnie Sahlberg, David Sterba, Jaegeuk Kim, ceph-devel, Xiubo Li,
Gao Xiang, Jan Harkes, Christian Brauner, linux-ext4,
Theodore Ts'o, Joseph Qi, Greg Kroah-Hartman, v9fs, ntfs3,
Jeff Layton, linux-kernel, linux-f2fs-devel, Steve French,
Sergey Senozhatsky, Luis Chamberlain, Jeffle Xu, devel,
Anna Schumaker, Jan Kara, Bob Peterson, linux-fsdevel,
Andrew Morton, Sungjong Seo, linux-erofs, linux-nfs, linux-btrfs,
Joel Becker
Jan Kara <jack@suse.cz> writes:
> Since you are talking past one another with Jeff let me chime in here :). I
> think you are worried about this hunk:
Right.
> - if ((flags & S_VERSION) && inode_maybe_inc_iversion(inode, false))
> + if ((flags & (S_VERSION|S_CTIME|S_MTIME)) && inode_maybe_inc_iversion(inode, false))
> dirty_flags |= I_DIRTY_SYNC;
>
> which makes the 'flags' test pass even if we just modified ctime or mtime.
> But do note the second part of the if - inode_maybe_inc_iversion() - so we
> are going to mark the inode dirty with I_DIRTY_SYNC only if someone queried
> iversion since the last time we have incremented it.
>
> So this hunk is not really changing how inode is marked dirty, it only
> changes how often we check whether iversion needs increment and that should
> be fine (and desirable). Hence lazytime isn't really broken by this in any
> way.
OK. However, then it doesn't explain what I asked. This is not same with
generic_update_time(), only FAT does.
If thinks it is right thing, why generic_update_time() doesn't? I said
first reply, this was from generic_update_time(). (Or I'm misreading
updated generic_update_time()?)
Thanks.
--
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply [flat|nested] 76+ messages in thread
* Re: [f2fs-dev] [PATCH v7 05/13] fat: make fat_update_time get its own timestamp
2023-08-09 15:17 ` OGAWA Hirofumi
@ 2023-08-09 16:30 ` Jeff Layton
2023-08-09 17:44 ` OGAWA Hirofumi
0 siblings, 1 reply; 76+ messages in thread
From: Jeff Layton @ 2023-08-09 16:30 UTC (permalink / raw)
To: OGAWA Hirofumi, Jan Kara
Cc: Latchesar Ionkov, Martin Brandenburg, Konstantin Komarov,
Darrick J. Wong, Dominique Martinet, Christian Schoenebeck,
ecryptfs, Yue Hu, David Howells, Chris Mason, Andreas Dilger,
Hans de Goede, Marc Dionne, linux-xfs, linux-afs, linux-mtd,
Mike Marshall, Paulo Alcantara, linux-cifs, Eric Van Hensbergen,
Andreas Gruenbacher, Miklos Szeredi, Richard Weinberger,
Mark Fasheh, linux-unionfs, Hugh Dickins, Benjamin Coddington,
Tyler Hicks, cluster-devel, coda, linux-mm, Ilya Dryomov,
Iurii Zaikin, Namjae Jeon, Trond Myklebust, codalist,
Shyam Prasad N, Amir Goldstein, Kees Cook, ocfs2-devel,
Josef Bacik, Tom Talpey, Tejun Heo, Alexander Viro,
Ronnie Sahlberg, David Sterba, Jaegeuk Kim, ceph-devel, Xiubo Li,
Gao Xiang, Jan Harkes, Christian Brauner, linux-ext4,
Theodore Ts'o, Joseph Qi, Greg Kroah-Hartman, v9fs, ntfs3,
samba-technical, linux-kernel, linux-f2fs-devel, Steve French,
Sergey Senozhatsky, Luis Chamberlain, Jeffle Xu, devel,
Anna Schumaker, Jan Kara, Bob Peterson, linux-fsdevel,
Andrew Morton, Sungjong Seo, linux-erofs, linux-nfs, linux-btrfs,
Joel Becker
On Thu, 2023-08-10 at 00:17 +0900, OGAWA Hirofumi wrote:
> Jan Kara <jack@suse.cz> writes:
>
> > Since you are talking past one another with Jeff let me chime in here :). I
> > think you are worried about this hunk:
>
> Right.
>
> > - if ((flags & S_VERSION) && inode_maybe_inc_iversion(inode, false))
> > + if ((flags & (S_VERSION|S_CTIME|S_MTIME)) && inode_maybe_inc_iversion(inode, false))
> > dirty_flags |= I_DIRTY_SYNC;
> >
> > which makes the 'flags' test pass even if we just modified ctime or mtime.
> > But do note the second part of the if - inode_maybe_inc_iversion() - so we
> > are going to mark the inode dirty with I_DIRTY_SYNC only if someone queried
> > iversion since the last time we have incremented it.
> >
> > So this hunk is not really changing how inode is marked dirty, it only
> > changes how often we check whether iversion needs increment and that should
> > be fine (and desirable). Hence lazytime isn't really broken by this in any
> > way.
>
> OK. However, then it doesn't explain what I asked. This is not same with
> generic_update_time(), only FAT does.
>
> If thinks it is right thing, why generic_update_time() doesn't? I said
> first reply, this was from generic_update_time(). (Or I'm misreading
> updated generic_update_time()?)
>
My mistake re: lazytime vs. relatime, but Jan is correct that this
shouldn't break anything there.
The logic in the revised generic_update_time is different because FAT is
is a bit strange. fat_update_time does extra truncation on the timestamp
that it is handed beyond what timestamp_truncate() does.
fat_truncate_time is called in many different places too, so I don't
feel comfortable making big changes to how that works.
In the case of generic_update_time, it calls inode_update_timestamps
which returns a mask that shows which timestamps got updated. It then
marks the dirty_flags appropriately for what was actually changed.
generic_update_time is used across many filesystems so we need to ensure
that it's OK to use even when multigrain timestamps are enabled. Those
haven't been enabled in FAT though, so I didn't bother, and left it to
dirtying the inode in the same way it was before, even though it now
fetches its own timestamps from the clock. Given the way that the mtime
and ctime are smooshed together in FAT, that seemed reasonable.
Is there a particular case or flag combination you're concerned about
here?
--
Jeff Layton <jlayton@kernel.org>
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply [flat|nested] 76+ messages in thread
* Re: [f2fs-dev] [PATCH v7 05/13] fat: make fat_update_time get its own timestamp
2023-08-09 16:30 ` Jeff Layton
@ 2023-08-09 17:44 ` OGAWA Hirofumi
2023-08-09 17:59 ` Jeff Layton
0 siblings, 1 reply; 76+ messages in thread
From: OGAWA Hirofumi @ 2023-08-09 17:44 UTC (permalink / raw)
To: Jeff Layton
Cc: Latchesar Ionkov, Martin Brandenburg, Konstantin Komarov,
Jan Kara, Darrick J. Wong, Dominique Martinet,
Christian Schoenebeck, ecryptfs, Yue Hu, David Howells,
Chris Mason, Andreas Dilger, Hans de Goede, Marc Dionne,
linux-xfs, linux-afs, linux-mtd, Mike Marshall, Paulo Alcantara,
linux-cifs, Eric Van Hensbergen, Andreas Gruenbacher,
Miklos Szeredi, Richard Weinberger, Mark Fasheh, linux-unionfs,
Hugh Dickins, Benjamin Coddington, Tyler Hicks, cluster-devel,
coda, linux-mm, Ilya Dryomov, Iurii Zaikin, Namjae Jeon,
Trond Myklebust, codalist, Shyam Prasad N, Amir Goldstein,
Kees Cook, ocfs2-devel, Josef Bacik, Tom Talpey, Tejun Heo,
Alexander Viro, Ronnie Sahlberg, David Sterba, Jaegeuk Kim,
ceph-devel, Xiubo Li, Gao Xiang, Jan Harkes, Christian Brauner,
linux-ext4, Theodore Ts'o, Joseph Qi, Greg Kroah-Hartman,
v9fs, ntfs3, samba-technical, linux-kernel, linux-f2fs-devel,
Steve French, Sergey Senozhatsky, Luis Chamberlain, Jeffle Xu,
devel, Anna Schumaker, Jan Kara, Bob Peterson, linux-fsdevel,
Andrew Morton, Sungjong Seo, linux-erofs, linux-nfs, linux-btrfs,
Joel Becker
Jeff Layton <jlayton@kernel.org> writes:
> On Thu, 2023-08-10 at 00:17 +0900, OGAWA Hirofumi wrote:
>> Jan Kara <jack@suse.cz> writes:
[...]
> My mistake re: lazytime vs. relatime, but Jan is correct that this
> shouldn't break anything there.
Actually breaks ("break" means not corrupt fs, means it breaks lazytime
optimization). It is just not always, but it should be always for some
userspaces.
> The logic in the revised generic_update_time is different because FAT is
> is a bit strange. fat_update_time does extra truncation on the timestamp
> that it is handed beyond what timestamp_truncate() does.
> fat_truncate_time is called in many different places too, so I don't
> feel comfortable making big changes to how that works.
>
> In the case of generic_update_time, it calls inode_update_timestamps
> which returns a mask that shows which timestamps got updated. It then
> marks the dirty_flags appropriately for what was actually changed.
>
> generic_update_time is used across many filesystems so we need to ensure
> that it's OK to use even when multigrain timestamps are enabled. Those
> haven't been enabled in FAT though, so I didn't bother, and left it to
> dirtying the inode in the same way it was before, even though it now
> fetches its own timestamps from the clock. Given the way that the mtime
> and ctime are smooshed together in FAT, that seemed reasonable.
>
> Is there a particular case or flag combination you're concerned about
> here?
Yes. Because FAT has strange timestamps that different granularity on
disk . This is why generic time truncation doesn't work for FAT.
Well anyway, my concern is the only following part. In
generic_update_time(), S_[CM]TIME are not the cause of I_DIRTY_SYNC if
lazytime mode.
- if ((flags & S_VERSION) && inode_maybe_inc_iversion(inode, false))
+ if ((flags & (S_VERSION|S_CTIME|S_MTIME)) && inode_maybe_inc_iversion(inode, false))
dirty_flags |= I_DIRTY_SYNC;
If reverted this part to check only S_VERSION, I'm fine.
Thanks.
--
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply [flat|nested] 76+ messages in thread
* Re: [f2fs-dev] [PATCH v7 05/13] fat: make fat_update_time get its own timestamp
2023-08-09 17:44 ` OGAWA Hirofumi
@ 2023-08-09 17:59 ` Jeff Layton
2023-08-09 18:31 ` OGAWA Hirofumi
0 siblings, 1 reply; 76+ messages in thread
From: Jeff Layton @ 2023-08-09 17:59 UTC (permalink / raw)
To: OGAWA Hirofumi
Cc: Latchesar Ionkov, Martin Brandenburg, Konstantin Komarov,
Jan Kara, Darrick J. Wong, Dominique Martinet,
Christian Schoenebeck, ecryptfs, Yue Hu, David Howells,
Chris Mason, Andreas Dilger, Hans de Goede, Marc Dionne,
linux-xfs, linux-afs, linux-mtd, Mike Marshall, Paulo Alcantara,
linux-cifs, Eric Van Hensbergen, Andreas Gruenbacher,
Miklos Szeredi, Richard Weinberger, Mark Fasheh, linux-unionfs,
Hugh Dickins, Benjamin Coddington, Tyler Hicks, cluster-devel,
coda, linux-mm, Ilya Dryomov, Iurii Zaikin, Namjae Jeon,
Trond Myklebust, codalist, Shyam Prasad N, Amir Goldstein,
Kees Cook, ocfs2-devel, Josef Bacik, Tom Talpey, Tejun Heo,
Alexander Viro, Ronnie Sahlberg, David Sterba, Jaegeuk Kim,
ceph-devel, Xiubo Li, Gao Xiang, Jan Harkes, Christian Brauner,
linux-ext4, Theodore Ts'o, Joseph Qi, Greg Kroah-Hartman,
v9fs, ntfs3, samba-technical, linux-kernel, linux-f2fs-devel,
Steve French, Sergey Senozhatsky, Luis Chamberlain, Jeffle Xu,
devel, Anna Schumaker, Jan Kara, Bob Peterson, linux-fsdevel,
Andrew Morton, Sungjong Seo, linux-erofs, linux-nfs, linux-btrfs,
Joel Becker
On Thu, 2023-08-10 at 02:44 +0900, OGAWA Hirofumi wrote:
> Jeff Layton <jlayton@kernel.org> writes:
>
> > On Thu, 2023-08-10 at 00:17 +0900, OGAWA Hirofumi wrote:
> > > Jan Kara <jack@suse.cz> writes:
>
> [...]
>
> > My mistake re: lazytime vs. relatime, but Jan is correct that this
> > shouldn't break anything there.
>
> Actually breaks ("break" means not corrupt fs, means it breaks lazytime
> optimization). It is just not always, but it should be always for some
> userspaces.
>
> > The logic in the revised generic_update_time is different because FAT is
> > is a bit strange. fat_update_time does extra truncation on the timestamp
> > that it is handed beyond what timestamp_truncate() does.
> > fat_truncate_time is called in many different places too, so I don't
> > feel comfortable making big changes to how that works.
> >
> > In the case of generic_update_time, it calls inode_update_timestamps
> > which returns a mask that shows which timestamps got updated. It then
> > marks the dirty_flags appropriately for what was actually changed.
> >
> > generic_update_time is used across many filesystems so we need to ensure
> > that it's OK to use even when multigrain timestamps are enabled. Those
> > haven't been enabled in FAT though, so I didn't bother, and left it to
> > dirtying the inode in the same way it was before, even though it now
> > fetches its own timestamps from the clock. Given the way that the mtime
> > and ctime are smooshed together in FAT, that seemed reasonable.
> >
> > Is there a particular case or flag combination you're concerned about
> > here?
>
> Yes. Because FAT has strange timestamps that different granularity on
> disk . This is why generic time truncation doesn't work for FAT.
>
> Well anyway, my concern is the only following part. In
> generic_update_time(), S_[CM]TIME are not the cause of I_DIRTY_SYNC if
> lazytime mode.
>
> - if ((flags & S_VERSION) && inode_maybe_inc_iversion(inode, false))
> + if ((flags & (S_VERSION|S_CTIME|S_MTIME)) && inode_maybe_inc_iversion(inode, false))
> dirty_flags |= I_DIRTY_SYNC;
>
That would be wrong. The problem is that we're changing how update_time
works:
Previously, update_time was given a timestamp and a set of S_* flags to
indicate which fields should be updated. Now, update_time is not given a
timestamp. It needs to fetch it itself, but that subtly changes the
meaning of the flags field.
It now means "these fields needed to be updated when I last checked".
The timestamp and i_version may now be different from when the flags
field was set. This means that if any of S_CTIME/S_MTIME/S_VERSION were
set that we need to attempt to update all 3 of them. They may now be
different from the timestamp or version that we ultimately end up with.
The above may look to you like it would always cause I_DIRTY_SYNC to be
set on any ctime or mtime update, but inode_maybe_inc_iversion only
returns true if it actually updated i_version, and it only does that if
someone issued a ->getattr against the file since the last time it was
updated.
So, this shouldn't generate any more DIRTY_SYNC updates than it did
before.
--
Jeff Layton <jlayton@kernel.org>
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply [flat|nested] 76+ messages in thread
* Re: [f2fs-dev] [PATCH v7 05/13] fat: make fat_update_time get its own timestamp
2023-08-09 17:59 ` Jeff Layton
@ 2023-08-09 18:31 ` OGAWA Hirofumi
2023-08-09 19:04 ` Jeff Layton
0 siblings, 1 reply; 76+ messages in thread
From: OGAWA Hirofumi @ 2023-08-09 18:31 UTC (permalink / raw)
To: Jeff Layton
Cc: Latchesar Ionkov, Martin Brandenburg, Konstantin Komarov,
Jan Kara, Darrick J. Wong, Dominique Martinet,
Christian Schoenebeck, ecryptfs, Yue Hu, David Howells,
Chris Mason, Andreas Dilger, Hans de Goede, Marc Dionne,
linux-xfs, linux-afs, linux-mtd, Mike Marshall, Paulo Alcantara,
linux-cifs, Eric Van Hensbergen, Andreas Gruenbacher,
Miklos Szeredi, Richard Weinberger, Mark Fasheh, linux-unionfs,
Hugh Dickins, Benjamin Coddington, Tyler Hicks, cluster-devel,
coda, linux-mm, Ilya Dryomov, Iurii Zaikin, Namjae Jeon,
Trond Myklebust, codalist, Shyam Prasad N, Amir Goldstein,
Kees Cook, ocfs2-devel, Josef Bacik, Tom Talpey, Tejun Heo,
Alexander Viro, Ronnie Sahlberg, David Sterba, Jaegeuk Kim,
ceph-devel, Xiubo Li, Gao Xiang, Jan Harkes, Christian Brauner,
linux-ext4, Theodore Ts'o, Joseph Qi, Greg Kroah-Hartman,
v9fs, ntfs3, samba-technical, linux-kernel, linux-f2fs-devel,
Steve French, Sergey Senozhatsky, Luis Chamberlain, Jeffle Xu,
devel, Anna Schumaker, Jan Kara, Bob Peterson, linux-fsdevel,
Andrew Morton, Sungjong Seo, linux-erofs, linux-nfs, linux-btrfs,
Joel Becker
Jeff Layton <jlayton@kernel.org> writes:
> On Thu, 2023-08-10 at 02:44 +0900, OGAWA Hirofumi wrote:
>> Jeff Layton <jlayton@kernel.org> writes:
>>
> That would be wrong. The problem is that we're changing how update_time
> works:
>
> Previously, update_time was given a timestamp and a set of S_* flags to
> indicate which fields should be updated. Now, update_time is not given a
> timestamp. It needs to fetch it itself, but that subtly changes the
> meaning of the flags field.
>
> It now means "these fields needed to be updated when I last checked".
> The timestamp and i_version may now be different from when the flags
> field was set. This means that if any of S_CTIME/S_MTIME/S_VERSION were
> set that we need to attempt to update all 3 of them. They may now be
> different from the timestamp or version that we ultimately end up with.
>
> The above may look to you like it would always cause I_DIRTY_SYNC to be
> set on any ctime or mtime update, but inode_maybe_inc_iversion only
> returns true if it actually updated i_version, and it only does that if
> someone issued a ->getattr against the file since the last time it was
> updated.
>
> So, this shouldn't generate any more DIRTY_SYNC updates than it did
> before.
Again, if you claim so, why generic_update_time() doesn't work same? Why
only FAT does?
Or I'm misreading generic_update_time() patch?
Thanks.
--
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply [flat|nested] 76+ messages in thread
* Re: [f2fs-dev] [PATCH v7 05/13] fat: make fat_update_time get its own timestamp
2023-08-09 18:31 ` OGAWA Hirofumi
@ 2023-08-09 19:04 ` Jeff Layton
2023-08-09 20:14 ` OGAWA Hirofumi
0 siblings, 1 reply; 76+ messages in thread
From: Jeff Layton @ 2023-08-09 19:04 UTC (permalink / raw)
To: OGAWA Hirofumi
Cc: Latchesar Ionkov, Martin Brandenburg, Konstantin Komarov,
Jan Kara, Darrick J. Wong, Dominique Martinet,
Christian Schoenebeck, ecryptfs, Yue Hu, David Howells,
Chris Mason, Andreas Dilger, Hans de Goede, Marc Dionne,
linux-xfs, linux-afs, linux-mtd, Mike Marshall, Paulo Alcantara,
linux-cifs, Eric Van Hensbergen, Andreas Gruenbacher,
Miklos Szeredi, Richard Weinberger, Mark Fasheh, linux-unionfs,
Hugh Dickins, Benjamin Coddington, Tyler Hicks, cluster-devel,
coda, linux-mm, Ilya Dryomov, Iurii Zaikin, Namjae Jeon,
Trond Myklebust, codalist, Shyam Prasad N, Amir Goldstein,
Kees Cook, ocfs2-devel, Josef Bacik, Tom Talpey, Tejun Heo,
Alexander Viro, Ronnie Sahlberg, David Sterba, Jaegeuk Kim,
ceph-devel, Xiubo Li, Gao Xiang, Jan Harkes, Christian Brauner,
linux-ext4, Theodore Ts'o, Joseph Qi, Greg Kroah-Hartman,
v9fs, ntfs3, samba-technical, linux-kernel, linux-f2fs-devel,
Steve French, Sergey Senozhatsky, Luis Chamberlain, Jeffle Xu,
devel, Anna Schumaker, Jan Kara, Bob Peterson, linux-fsdevel,
Andrew Morton, Sungjong Seo, linux-erofs, linux-nfs, linux-btrfs,
Joel Becker
On Thu, 2023-08-10 at 03:31 +0900, OGAWA Hirofumi wrote:
> Jeff Layton <jlayton@kernel.org> writes:
>
> > On Thu, 2023-08-10 at 02:44 +0900, OGAWA Hirofumi wrote:
> > > Jeff Layton <jlayton@kernel.org> writes:
> > >
> > That would be wrong. The problem is that we're changing how update_time
> > works:
> >
> > Previously, update_time was given a timestamp and a set of S_* flags to
> > indicate which fields should be updated. Now, update_time is not given a
> > timestamp. It needs to fetch it itself, but that subtly changes the
> > meaning of the flags field.
> >
> > It now means "these fields needed to be updated when I last checked".
> > The timestamp and i_version may now be different from when the flags
> > field was set. This means that if any of S_CTIME/S_MTIME/S_VERSION were
> > set that we need to attempt to update all 3 of them. They may now be
> > different from the timestamp or version that we ultimately end up with.
> >
> > The above may look to you like it would always cause I_DIRTY_SYNC to be
> > set on any ctime or mtime update, but inode_maybe_inc_iversion only
> > returns true if it actually updated i_version, and it only does that if
> > someone issued a ->getattr against the file since the last time it was
> > updated.
> >
> > So, this shouldn't generate any more DIRTY_SYNC updates than it did
> > before.
>
> Again, if you claim so, why generic_update_time() doesn't work same? Why
> only FAT does?
>
> Or I'm misreading generic_update_time() patch?
>
When you say it "doesn't work the same", what do you mean, specifically?
I had to make some allowances for the fact that FAT is substantially
different in its timestamp handling, and I tried to preserve existing
behavior as best I could.
--
Jeff Layton <jlayton@kernel.org>
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply [flat|nested] 76+ messages in thread
* Re: [f2fs-dev] [PATCH v7 05/13] fat: make fat_update_time get its own timestamp
2023-08-09 19:04 ` Jeff Layton
@ 2023-08-09 20:14 ` OGAWA Hirofumi
2023-08-09 22:07 ` Jeff Layton
0 siblings, 1 reply; 76+ messages in thread
From: OGAWA Hirofumi @ 2023-08-09 20:14 UTC (permalink / raw)
To: Jeff Layton
Cc: Latchesar Ionkov, Martin Brandenburg, Konstantin Komarov,
Jan Kara, Darrick J. Wong, Dominique Martinet,
Christian Schoenebeck, ecryptfs, Yue Hu, David Howells,
Chris Mason, Andreas Dilger, Hans de Goede, Marc Dionne,
linux-xfs, linux-afs, linux-mtd, Mike Marshall, Paulo Alcantara,
linux-cifs, Eric Van Hensbergen, Andreas Gruenbacher,
Miklos Szeredi, Richard Weinberger, Mark Fasheh, linux-unionfs,
Hugh Dickins, Benjamin Coddington, Tyler Hicks, cluster-devel,
coda, linux-mm, Ilya Dryomov, Iurii Zaikin, Namjae Jeon,
Trond Myklebust, codalist, Shyam Prasad N, Amir Goldstein,
Kees Cook, ocfs2-devel, Josef Bacik, Tom Talpey, Tejun Heo,
Alexander Viro, Ronnie Sahlberg, David Sterba, Jaegeuk Kim,
ceph-devel, Xiubo Li, Gao Xiang, Jan Harkes, Christian Brauner,
linux-ext4, Theodore Ts'o, Joseph Qi, Greg Kroah-Hartman,
v9fs, ntfs3, samba-technical, linux-kernel, linux-f2fs-devel,
Steve French, Sergey Senozhatsky, Luis Chamberlain, Jeffle Xu,
devel, Anna Schumaker, Jan Kara, Bob Peterson, linux-fsdevel,
Andrew Morton, Sungjong Seo, linux-erofs, linux-nfs, linux-btrfs,
Joel Becker
Jeff Layton <jlayton@kernel.org> writes:
> When you say it "doesn't work the same", what do you mean, specifically?
> I had to make some allowances for the fact that FAT is substantially
> different in its timestamp handling, and I tried to preserve existing
> behavior as best I could.
Ah, ok. I was misreading some.
inode_update_timestamps() checks IS_I_VERSION() now, not S_VERSION. So,
if adding the check of IS_I_VERSION() and (S_MTIME|S_CTIME|S_VERSION) to
FAT?
With it, IS_I_VERSION() would be false on FAT, and I'm fine.
I.e. something like
if ((flags & (S_VERSION|S_CTIME|S_MTIME)) && IS_I_VERSION(inode)
&& inode_maybe_inc_iversion(inode, false))
dirty_flags |= I_DIRTY_SYNC;
Thanks.
--
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply [flat|nested] 76+ messages in thread
* Re: [f2fs-dev] [PATCH v7 05/13] fat: make fat_update_time get its own timestamp
2023-08-09 20:14 ` OGAWA Hirofumi
@ 2023-08-09 22:07 ` Jeff Layton
2023-08-09 22:37 ` OGAWA Hirofumi
0 siblings, 1 reply; 76+ messages in thread
From: Jeff Layton @ 2023-08-09 22:07 UTC (permalink / raw)
To: OGAWA Hirofumi, Frank Sorenson
Cc: Latchesar Ionkov, Martin Brandenburg, Konstantin Komarov,
Jan Kara, Darrick J. Wong, Dominique Martinet,
Christian Schoenebeck, ecryptfs, Yue Hu, David Howells,
Chris Mason, Andreas Dilger, Hans de Goede, Marc Dionne,
linux-xfs, linux-afs, linux-mtd, Mike Marshall, Paulo Alcantara,
linux-cifs, Eric Van Hensbergen, Andreas Gruenbacher,
Miklos Szeredi, Richard Weinberger, Mark Fasheh, linux-unionfs,
Hugh Dickins, Benjamin Coddington, Tyler Hicks, cluster-devel,
coda, linux-mm, Ilya Dryomov, Iurii Zaikin, Namjae Jeon,
Trond Myklebust, codalist, Shyam Prasad N, Amir Goldstein,
Kees Cook, ocfs2-devel, Josef Bacik, Tom Talpey, Tejun Heo,
Alexander Viro, Ronnie Sahlberg, David Sterba, Jaegeuk Kim,
ceph-devel, Xiubo Li, Gao Xiang, Jan Harkes, Christian Brauner,
linux-ext4, Theodore Ts'o, Joseph Qi, Greg Kroah-Hartman,
v9fs, ntfs3, samba-technical, linux-kernel, linux-f2fs-devel,
Steve French, Sergey Senozhatsky, Luis Chamberlain, Jeffle Xu,
devel, Anna Schumaker, Jan Kara, Bob Peterson, linux-fsdevel,
Andrew Morton, Sungjong Seo, linux-erofs, linux-nfs, linux-btrfs,
Joel Becker
On Thu, 2023-08-10 at 05:14 +0900, OGAWA Hirofumi wrote:
> Jeff Layton <jlayton@kernel.org> writes:
>
> > When you say it "doesn't work the same", what do you mean, specifically?
> > I had to make some allowances for the fact that FAT is substantially
> > different in its timestamp handling, and I tried to preserve existing
> > behavior as best I could.
>
> Ah, ok. I was misreading some.
>
> inode_update_timestamps() checks IS_I_VERSION() now, not S_VERSION. So,
> if adding the check of IS_I_VERSION() and (S_MTIME|S_CTIME|S_VERSION) to
> FAT?
>
> With it, IS_I_VERSION() would be false on FAT, and I'm fine.
>
> I.e. something like
>
> if ((flags & (S_VERSION|S_CTIME|S_MTIME)) && IS_I_VERSION(inode)
> && inode_maybe_inc_iversion(inode, false))
> dirty_flags |= I_DIRTY_SYNC;
>
> Thanks.
If you do that then the i_version counter would never be incremented.
But...I think I see what you're getting at.
Most filesystems that support the i_version counter have an on-disk
field for it. FAT obviously has no such thing. I suspect the i_version
bits in fat_update_time were added by mistake. FAT doesn't set
SB_I_VERSION so there's no need to do anything to the i_version field at
all.
Also, given that the mtime and ctime are always kept in sync on FAT,
we're probably fine to have it look something like this:
--------------------8<------------------
int fat_update_time(struct inode *inode, int flags)
{
int dirty_flags = 0;
if (inode->i_ino == MSDOS_ROOT_INO)
return 0;
fat_truncate_time(inode, NULL, flags);
if (inode->i_sb->s_flags & SB_LAZYTIME)
dirty_flags |= I_DIRTY_TIME;
else
dirty_flags |= I_DIRTY_SYNC;
__mark_inode_dirty(inode, dirty_flags);
return 0;
}
--------------------8<------------------
...and we should probably do that in a separate patch in advance of the
update_time rework, since it's really a different change.
If you're in agreement, then I'll plan to respin the series with this
fixed and resend.
Thanks for being patient!
--
Jeff Layton <jlayton@kernel.org>
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply [flat|nested] 76+ messages in thread
* Re: [f2fs-dev] [PATCH v7 05/13] fat: make fat_update_time get its own timestamp
2023-08-09 22:07 ` Jeff Layton
@ 2023-08-09 22:37 ` OGAWA Hirofumi
0 siblings, 0 replies; 76+ messages in thread
From: OGAWA Hirofumi @ 2023-08-09 22:37 UTC (permalink / raw)
To: Jeff Layton
Cc: Latchesar Ionkov, Martin Brandenburg, Konstantin Komarov,
Jan Kara, Darrick J. Wong, Dominique Martinet,
Christian Schoenebeck, ecryptfs, Yue Hu, David Howells,
Chris Mason, Andreas Dilger, Hans de Goede, Marc Dionne,
linux-xfs, linux-afs, linux-mtd, Mike Marshall, Paulo Alcantara,
linux-cifs, Eric Van Hensbergen, Andreas Gruenbacher,
Miklos Szeredi, Richard Weinberger, Mark Fasheh, linux-unionfs,
Hugh Dickins, Benjamin Coddington, Tyler Hicks, cluster-devel,
coda, linux-mm, Gao Xiang, Iurii Zaikin, Namjae Jeon,
Trond Myklebust, codalist, Shyam Prasad N, Amir Goldstein,
Kees Cook, ocfs2-devel, linux-erofs, Josef Bacik, Tom Talpey,
Tejun Heo, Alexander Viro, Ronnie Sahlberg, David Sterba,
Jaegeuk Kim, ceph-devel, Xiubo Li, Ilya Dryomov, Jan Harkes,
Christian Brauner, linux-ext4, Theodore Ts'o, Frank Sorenson,
Greg Kroah-Hartman, v9fs, ntfs3, samba-technical, linux-kernel,
linux-f2fs-devel, Steve French, Sergey Senozhatsky,
Luis Chamberlain, Jeffle Xu, devel, Anna Schumaker, Jan Kara,
Bob Peterson, linux-fsdevel, Andrew Morton, Sungjong Seo,
Joseph Qi, linux-nfs, linux-btrfs, Joel Becker
Jeff Layton <jlayton@kernel.org> writes:
> If you do that then the i_version counter would never be incremented.
> But...I think I see what you're getting at.
>
> Most filesystems that support the i_version counter have an on-disk
> field for it. FAT obviously has no such thing. I suspect the i_version
> bits in fat_update_time were added by mistake. FAT doesn't set
> SB_I_VERSION so there's no need to do anything to the i_version field at
> all.
>
> Also, given that the mtime and ctime are always kept in sync on FAT,
> we're probably fine to have it look something like this:
Yes.
IIRC, when I wrote, I decided to make it keep similar with generic
function, instead of heavily customize for FAT (for maintenance
reason). It is why. There would be other places with same reason.
E.g. LAZYTIME check is same reason too. (current FAT doesn't support it)
So I personally I would prefer to leave it. But if you want to remove
it, it would be ok too.
Thanks.
> --------------------8<------------------
> int fat_update_time(struct inode *inode, int flags)
> {
> int dirty_flags = 0;
>
> if (inode->i_ino == MSDOS_ROOT_INO)
> return 0;
>
> fat_truncate_time(inode, NULL, flags);
> if (inode->i_sb->s_flags & SB_LAZYTIME)
> dirty_flags |= I_DIRTY_TIME;
> else
> dirty_flags |= I_DIRTY_SYNC;
>
> __mark_inode_dirty(inode, dirty_flags);
> return 0;
> }
> --------------------8<------------------
>
> ...and we should probably do that in a separate patch in advance of the
> update_time rework, since it's really a different change.
>
> If you're in agreement, then I'll plan to respin the series with this
> fixed and resend.
>
> Thanks for being patient!
--
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply [flat|nested] 76+ messages in thread
* [f2fs-dev] [PATCH v7 06/13] ubifs: have ubifs_update_time use inode_update_timestamps
2023-08-07 19:38 [f2fs-dev] [PATCH v7 00/13] fs: implement multigrain timestamps Jeff Layton
` (4 preceding siblings ...)
2023-08-07 19:38 ` [f2fs-dev] [PATCH v7 05/13] fat: make fat_update_time get its own timestamp Jeff Layton
@ 2023-08-07 19:38 ` Jeff Layton
2023-08-08 9:37 ` Jan Kara
2023-08-07 19:38 ` [f2fs-dev] [PATCH v7 07/13] xfs: have xfs_vn_update_time gets its own timestamp Jeff Layton
` (8 subsequent siblings)
14 siblings, 1 reply; 76+ messages in thread
From: Jeff Layton @ 2023-08-07 19:38 UTC (permalink / raw)
To: Alexander Viro, Christian Brauner, Eric Van Hensbergen,
Latchesar Ionkov, Dominique Martinet, Christian Schoenebeck,
David Howells, Marc Dionne, Chris Mason, Josef Bacik,
David Sterba, Xiubo Li, Ilya Dryomov, Jan Harkes, coda,
Tyler Hicks, Gao Xiang, Chao Yu, Yue Hu, Jeffle Xu, Namjae Jeon,
Sungjong Seo, Jan Kara, Theodore Ts'o, Andreas Dilger,
Jaegeuk Kim, OGAWA Hirofumi, Miklos Szeredi, Bob Peterson,
Andreas Gruenbacher, Greg Kroah-Hartman, Tejun Heo,
Trond Myklebust, Anna Schumaker, Konstantin Komarov, Mark Fasheh,
Joel Becker, Joseph Qi, Mike Marshall, Martin Brandenburg,
Luis Chamberlain, Kees Cook, Iurii Zaikin, Steve French,
Paulo Alcantara, Ronnie Sahlberg, Shyam Prasad N, Tom Talpey,
Sergey Senozhatsky, Richard Weinberger, Hans de Goede,
Hugh Dickins, Andrew Morton, Amir Goldstein, Darrick J. Wong,
Benjamin Coddington
Cc: Jeff Layton, linux-kernel, linux-mm, linux-mtd, linux-afs,
linux-cifs, codalist, cluster-devel, linux-ext4, devel, ecryptfs,
ocfs2-devel, ceph-devel, linux-nfs, v9fs, samba-technical,
linux-unionfs, linux-f2fs-devel, linux-xfs, linux-fsdevel, ntfs3,
linux-erofs, linux-btrfs
In later patches, we're going to drop the "now" parameter from the
update_time operation. Prepare ubifs for this, by having it use the new
inode_update_timestamps helper.
Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
fs/ubifs/file.c | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/fs/ubifs/file.c b/fs/ubifs/file.c
index df9086b19cd0..2d0178922e19 100644
--- a/fs/ubifs/file.c
+++ b/fs/ubifs/file.c
@@ -1397,15 +1397,9 @@ int ubifs_update_time(struct inode *inode, struct timespec64 *time,
return err;
mutex_lock(&ui->ui_mutex);
- if (flags & S_ATIME)
- inode->i_atime = *time;
- if (flags & S_CTIME)
- inode_set_ctime_to_ts(inode, *time);
- if (flags & S_MTIME)
- inode->i_mtime = *time;
-
- release = ui->dirty;
+ inode_update_timestamps(inode, flags);
__mark_inode_dirty(inode, I_DIRTY_SYNC);
+ release = ui->dirty;
mutex_unlock(&ui->ui_mutex);
if (release)
ubifs_release_budget(c, &req);
--
2.41.0
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply related [flat|nested] 76+ messages in thread
* Re: [f2fs-dev] [PATCH v7 06/13] ubifs: have ubifs_update_time use inode_update_timestamps
2023-08-07 19:38 ` [f2fs-dev] [PATCH v7 06/13] ubifs: have ubifs_update_time use inode_update_timestamps Jeff Layton
@ 2023-08-08 9:37 ` Jan Kara
2023-08-09 7:06 ` Christian Brauner
0 siblings, 1 reply; 76+ messages in thread
From: Jan Kara @ 2023-08-08 9:37 UTC (permalink / raw)
To: Jeff Layton
Cc: Latchesar Ionkov, Martin Brandenburg, Konstantin Komarov,
linux-xfs, Darrick J. Wong, Dominique Martinet,
Christian Schoenebeck, ecryptfs, linux-unionfs, David Howells,
Chris Mason, Andreas Dilger, Hans de Goede, Marc Dionne, codalist,
linux-afs, linux-mtd, Mike Marshall, Paulo Alcantara, linux-cifs,
Eric Van Hensbergen, Andreas Gruenbacher, Miklos Szeredi,
Richard Weinberger, Mark Fasheh, Hugh Dickins,
Benjamin Coddington, Tyler Hicks, cluster-devel, coda, linux-mm,
Ilya Dryomov, Iurii Zaikin, Namjae Jeon, Trond Myklebust,
Shyam Prasad N, Amir Goldstein, Kees Cook, ocfs2-devel,
Josef Bacik, Tom Talpey, Tejun Heo, Yue Hu, Alexander Viro,
Ronnie Sahlberg, David Sterba, Jaegeuk Kim, ceph-devel, Xiubo Li,
Gao Xiang, OGAWA Hirofumi, Jan Harkes, Christian Brauner,
linux-ext4, Theodore Ts'o, Joseph Qi, Greg Kroah-Hartman,
v9fs, ntfs3, samba-technical, linux-kernel, linux-f2fs-devel,
Steve French, Sergey Senozhatsky, Luis Chamberlain, Jeffle Xu,
devel, Anna Schumaker, Jan Kara, Bob Peterson, linux-fsdevel,
Andrew Morton, Sungjong Seo, linux-erofs, linux-nfs, linux-btrfs,
Joel Becker
On Mon 07-08-23 15:38:37, Jeff Layton wrote:
> In later patches, we're going to drop the "now" parameter from the
> update_time operation. Prepare ubifs for this, by having it use the new
> inode_update_timestamps helper.
>
> Signed-off-by: Jeff Layton <jlayton@kernel.org>
One comment below:
> diff --git a/fs/ubifs/file.c b/fs/ubifs/file.c
> index df9086b19cd0..2d0178922e19 100644
> --- a/fs/ubifs/file.c
> +++ b/fs/ubifs/file.c
> @@ -1397,15 +1397,9 @@ int ubifs_update_time(struct inode *inode, struct timespec64 *time,
> return err;
>
> mutex_lock(&ui->ui_mutex);
> - if (flags & S_ATIME)
> - inode->i_atime = *time;
> - if (flags & S_CTIME)
> - inode_set_ctime_to_ts(inode, *time);
> - if (flags & S_MTIME)
> - inode->i_mtime = *time;
> -
> - release = ui->dirty;
> + inode_update_timestamps(inode, flags);
> __mark_inode_dirty(inode, I_DIRTY_SYNC);
> + release = ui->dirty;
> mutex_unlock(&ui->ui_mutex);
I think this is wrong. You need to keep sampling ui->dirty before calling
__mark_inode_dirty(). Otherwise you could release budget for inode update
you really need...
> if (release)
> ubifs_release_budget(c, &req);
Honza
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply [flat|nested] 76+ messages in thread
* Re: [f2fs-dev] [PATCH v7 06/13] ubifs: have ubifs_update_time use inode_update_timestamps
2023-08-08 9:37 ` Jan Kara
@ 2023-08-09 7:06 ` Christian Brauner
2023-08-09 8:23 ` Jan Kara
0 siblings, 1 reply; 76+ messages in thread
From: Christian Brauner @ 2023-08-09 7:06 UTC (permalink / raw)
To: Jan Kara
Cc: Latchesar Ionkov, Martin Brandenburg, Konstantin Komarov,
linux-xfs, Darrick J. Wong, Dominique Martinet,
Christian Schoenebeck, ecryptfs, linux-unionfs, David Howells,
Chris Mason, Andreas Dilger, Hans de Goede, Marc Dionne,
samba-technical, codalist, linux-afs, linux-mtd, Mike Marshall,
Paulo Alcantara, linux-cifs, Eric Van Hensbergen,
Andreas Gruenbacher, Miklos Szeredi, Richard Weinberger,
Mark Fasheh, Hugh Dickins, Benjamin Coddington, Tyler Hicks,
cluster-devel, coda, linux-mm, Ilya Dryomov, Iurii Zaikin,
Namjae Jeon, Trond Myklebust, Shyam Prasad N, Amir Goldstein,
Kees Cook, ocfs2-devel, Josef Bacik, Tom Talpey, Tejun Heo,
Yue Hu, Alexander Viro, Ronnie Sahlberg, David Sterba,
Jaegeuk Kim, ceph-devel, Xiubo Li, Gao Xiang, OGAWA Hirofumi,
Jan Harkes, linux-nfs, linux-ext4, Theodore Ts'o, Joseph Qi,
Greg Kroah-Hartman, v9fs, ntfs3, Jeff Layton, linux-kernel,
linux-f2fs-devel, Steve French, Sergey Senozhatsky,
Luis Chamberlain, Jeffle Xu, devel, Anna Schumaker, Jan Kara,
Bob Peterson, linux-fsdevel, Andrew Morton, Sungjong Seo,
linux-erofs, linux-btrfs, Joel Becker
On Tue, Aug 08, 2023 at 11:37:01AM +0200, Jan Kara wrote:
> On Mon 07-08-23 15:38:37, Jeff Layton wrote:
> > In later patches, we're going to drop the "now" parameter from the
> > update_time operation. Prepare ubifs for this, by having it use the new
> > inode_update_timestamps helper.
> >
> > Signed-off-by: Jeff Layton <jlayton@kernel.org>
>
> One comment below:
>
> > diff --git a/fs/ubifs/file.c b/fs/ubifs/file.c
> > index df9086b19cd0..2d0178922e19 100644
> > --- a/fs/ubifs/file.c
> > +++ b/fs/ubifs/file.c
> > @@ -1397,15 +1397,9 @@ int ubifs_update_time(struct inode *inode, struct timespec64 *time,
> > return err;
> >
> > mutex_lock(&ui->ui_mutex);
> > - if (flags & S_ATIME)
> > - inode->i_atime = *time;
> > - if (flags & S_CTIME)
> > - inode_set_ctime_to_ts(inode, *time);
> > - if (flags & S_MTIME)
> > - inode->i_mtime = *time;
> > -
> > - release = ui->dirty;
> > + inode_update_timestamps(inode, flags);
> > __mark_inode_dirty(inode, I_DIRTY_SYNC);
> > + release = ui->dirty;
> > mutex_unlock(&ui->ui_mutex);
>
> I think this is wrong. You need to keep sampling ui->dirty before calling
> __mark_inode_dirty(). Otherwise you could release budget for inode update
> you really need...
Fixed in-tree.
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply [flat|nested] 76+ messages in thread
* Re: [f2fs-dev] [PATCH v7 06/13] ubifs: have ubifs_update_time use inode_update_timestamps
2023-08-09 7:06 ` Christian Brauner
@ 2023-08-09 8:23 ` Jan Kara
0 siblings, 0 replies; 76+ messages in thread
From: Jan Kara @ 2023-08-09 8:23 UTC (permalink / raw)
To: Christian Brauner
Cc: Latchesar Ionkov, Martin Brandenburg, Konstantin Komarov,
Jan Kara, linux-xfs, Darrick J. Wong, Dominique Martinet,
Christian Schoenebeck, ecryptfs, linux-unionfs, David Howells,
Chris Mason, Andreas Dilger, Hans de Goede, Marc Dionne,
samba-technical, codalist, linux-afs, linux-mtd, Mike Marshall,
Paulo Alcantara, linux-cifs, Eric Van Hensbergen,
Andreas Gruenbacher, Miklos Szeredi, Richard Weinberger,
Mark Fasheh, Hugh Dickins, Benjamin Coddington, Tyler Hicks,
cluster-devel, coda, linux-mm, Ilya Dryomov, Iurii Zaikin,
Namjae Jeon, Trond Myklebust, Shyam Prasad N, Amir Goldstein,
Kees Cook, ocfs2-devel, Josef Bacik, Tom Talpey, Tejun Heo,
Yue Hu, Alexander Viro, Ronnie Sahlberg, David Sterba,
Jaegeuk Kim, ceph-devel, Xiubo Li, Gao Xiang, OGAWA Hirofumi,
Jan Harkes, linux-nfs, linux-ext4, Theodore Ts'o, Joseph Qi,
Greg Kroah-Hartman, v9fs, ntfs3, Jeff Layton, linux-kernel,
linux-f2fs-devel, Steve French, Sergey Senozhatsky,
Luis Chamberlain, Jeffle Xu, devel, Anna Schumaker, Jan Kara,
Bob Peterson, linux-fsdevel, Andrew Morton, Sungjong Seo,
linux-erofs, linux-btrfs, Joel Becker
On Wed 09-08-23 09:06:34, Christian Brauner wrote:
> On Tue, Aug 08, 2023 at 11:37:01AM +0200, Jan Kara wrote:
> > On Mon 07-08-23 15:38:37, Jeff Layton wrote:
> > > In later patches, we're going to drop the "now" parameter from the
> > > update_time operation. Prepare ubifs for this, by having it use the new
> > > inode_update_timestamps helper.
> > >
> > > Signed-off-by: Jeff Layton <jlayton@kernel.org>
> >
> > One comment below:
> >
> > > diff --git a/fs/ubifs/file.c b/fs/ubifs/file.c
> > > index df9086b19cd0..2d0178922e19 100644
> > > --- a/fs/ubifs/file.c
> > > +++ b/fs/ubifs/file.c
> > > @@ -1397,15 +1397,9 @@ int ubifs_update_time(struct inode *inode, struct timespec64 *time,
> > > return err;
> > >
> > > mutex_lock(&ui->ui_mutex);
> > > - if (flags & S_ATIME)
> > > - inode->i_atime = *time;
> > > - if (flags & S_CTIME)
> > > - inode_set_ctime_to_ts(inode, *time);
> > > - if (flags & S_MTIME)
> > > - inode->i_mtime = *time;
> > > -
> > > - release = ui->dirty;
> > > + inode_update_timestamps(inode, flags);
> > > __mark_inode_dirty(inode, I_DIRTY_SYNC);
> > > + release = ui->dirty;
> > > mutex_unlock(&ui->ui_mutex);
> >
> > I think this is wrong. You need to keep sampling ui->dirty before calling
> > __mark_inode_dirty(). Otherwise you could release budget for inode update
> > you really need...
>
> Fixed in-tree.
Thanks. With that feel free to add:
Reviewed-by: Jan Kara <jack@suse.cz>
Honza
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply [flat|nested] 76+ messages in thread
* [f2fs-dev] [PATCH v7 07/13] xfs: have xfs_vn_update_time gets its own timestamp
2023-08-07 19:38 [f2fs-dev] [PATCH v7 00/13] fs: implement multigrain timestamps Jeff Layton
` (5 preceding siblings ...)
2023-08-07 19:38 ` [f2fs-dev] [PATCH v7 06/13] ubifs: have ubifs_update_time use inode_update_timestamps Jeff Layton
@ 2023-08-07 19:38 ` Jeff Layton
2023-08-08 9:39 ` Jan Kara
2023-08-09 15:57 ` Darrick J. Wong
2023-08-07 19:38 ` [f2fs-dev] [PATCH v7 08/13] fs: drop the timespec64 argument from update_time Jeff Layton
` (7 subsequent siblings)
14 siblings, 2 replies; 76+ messages in thread
From: Jeff Layton @ 2023-08-07 19:38 UTC (permalink / raw)
To: Alexander Viro, Christian Brauner, Eric Van Hensbergen,
Latchesar Ionkov, Dominique Martinet, Christian Schoenebeck,
David Howells, Marc Dionne, Chris Mason, Josef Bacik,
David Sterba, Xiubo Li, Ilya Dryomov, Jan Harkes, coda,
Tyler Hicks, Gao Xiang, Chao Yu, Yue Hu, Jeffle Xu, Namjae Jeon,
Sungjong Seo, Jan Kara, Theodore Ts'o, Andreas Dilger,
Jaegeuk Kim, OGAWA Hirofumi, Miklos Szeredi, Bob Peterson,
Andreas Gruenbacher, Greg Kroah-Hartman, Tejun Heo,
Trond Myklebust, Anna Schumaker, Konstantin Komarov, Mark Fasheh,
Joel Becker, Joseph Qi, Mike Marshall, Martin Brandenburg,
Luis Chamberlain, Kees Cook, Iurii Zaikin, Steve French,
Paulo Alcantara, Ronnie Sahlberg, Shyam Prasad N, Tom Talpey,
Sergey Senozhatsky, Richard Weinberger, Hans de Goede,
Hugh Dickins, Andrew Morton, Amir Goldstein, Darrick J. Wong,
Benjamin Coddington
Cc: Jeff Layton, linux-kernel, linux-mm, linux-mtd, linux-afs,
linux-cifs, codalist, cluster-devel, linux-ext4, devel, ecryptfs,
ocfs2-devel, ceph-devel, linux-nfs, v9fs, samba-technical,
linux-unionfs, linux-f2fs-devel, linux-xfs, linux-fsdevel, ntfs3,
linux-erofs, linux-btrfs
In later patches we're going to drop the "now" parameter from the
update_time operation. Prepare XFS for this by reworking how it fetches
timestamps and sets them in the inode. Ensure that we update the ctime
even if only S_MTIME is set.
Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
fs/xfs/xfs_iops.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c
index 731f45391baa..72d18e7840f5 100644
--- a/fs/xfs/xfs_iops.c
+++ b/fs/xfs/xfs_iops.c
@@ -1037,6 +1037,7 @@ xfs_vn_update_time(
int log_flags = XFS_ILOG_TIMESTAMP;
struct xfs_trans *tp;
int error;
+ struct timespec64 now = current_time(inode);
trace_xfs_update_time(ip);
@@ -1056,12 +1057,15 @@ xfs_vn_update_time(
return error;
xfs_ilock(ip, XFS_ILOCK_EXCL);
- if (flags & S_CTIME)
- inode_set_ctime_to_ts(inode, *now);
+ if (flags & (S_CTIME|S_MTIME))
+ now = inode_set_ctime_current(inode);
+ else
+ now = current_time(inode);
+
if (flags & S_MTIME)
- inode->i_mtime = *now;
+ inode->i_mtime = now;
if (flags & S_ATIME)
- inode->i_atime = *now;
+ inode->i_atime = now;
xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL);
xfs_trans_log_inode(tp, ip, log_flags);
--
2.41.0
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply related [flat|nested] 76+ messages in thread
* Re: [f2fs-dev] [PATCH v7 07/13] xfs: have xfs_vn_update_time gets its own timestamp
2023-08-07 19:38 ` [f2fs-dev] [PATCH v7 07/13] xfs: have xfs_vn_update_time gets its own timestamp Jeff Layton
@ 2023-08-08 9:39 ` Jan Kara
2023-08-09 7:04 ` Christian Brauner
2023-08-09 15:57 ` Darrick J. Wong
1 sibling, 1 reply; 76+ messages in thread
From: Jan Kara @ 2023-08-08 9:39 UTC (permalink / raw)
To: Jeff Layton
Cc: Latchesar Ionkov, Martin Brandenburg, Konstantin Komarov,
linux-xfs, Darrick J. Wong, Dominique Martinet,
Christian Schoenebeck, ecryptfs, linux-unionfs, David Howells,
Chris Mason, Andreas Dilger, Hans de Goede, Marc Dionne, codalist,
linux-afs, linux-mtd, Mike Marshall, Paulo Alcantara, linux-cifs,
Eric Van Hensbergen, Andreas Gruenbacher, Miklos Szeredi,
Richard Weinberger, Mark Fasheh, Hugh Dickins,
Benjamin Coddington, Tyler Hicks, cluster-devel, coda, linux-mm,
Ilya Dryomov, Iurii Zaikin, Namjae Jeon, Trond Myklebust,
Shyam Prasad N, Amir Goldstein, Kees Cook, ocfs2-devel,
Josef Bacik, Tom Talpey, Tejun Heo, Yue Hu, Alexander Viro,
Ronnie Sahlberg, David Sterba, Jaegeuk Kim, ceph-devel, Xiubo Li,
Gao Xiang, OGAWA Hirofumi, Jan Harkes, Christian Brauner,
linux-ext4, Theodore Ts'o, Joseph Qi, Greg Kroah-Hartman,
v9fs, ntfs3, samba-technical, linux-kernel, linux-f2fs-devel,
Steve French, Sergey Senozhatsky, Luis Chamberlain, Jeffle Xu,
devel, Anna Schumaker, Jan Kara, Bob Peterson, linux-fsdevel,
Andrew Morton, Sungjong Seo, linux-erofs, linux-nfs, linux-btrfs,
Joel Becker
On Mon 07-08-23 15:38:38, Jeff Layton wrote:
> In later patches we're going to drop the "now" parameter from the
> update_time operation. Prepare XFS for this by reworking how it fetches
> timestamps and sets them in the inode. Ensure that we update the ctime
> even if only S_MTIME is set.
>
> Signed-off-by: Jeff Layton <jlayton@kernel.org>
> ---
> fs/xfs/xfs_iops.c | 12 ++++++++----
> 1 file changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c
> index 731f45391baa..72d18e7840f5 100644
> --- a/fs/xfs/xfs_iops.c
> +++ b/fs/xfs/xfs_iops.c
> @@ -1037,6 +1037,7 @@ xfs_vn_update_time(
> int log_flags = XFS_ILOG_TIMESTAMP;
> struct xfs_trans *tp;
> int error;
> + struct timespec64 now = current_time(inode);
No need to fetch current_time() here where you overwrite it just a bit
later...
> @@ -1056,12 +1057,15 @@ xfs_vn_update_time(
> return error;
>
> xfs_ilock(ip, XFS_ILOCK_EXCL);
> - if (flags & S_CTIME)
> - inode_set_ctime_to_ts(inode, *now);
> + if (flags & (S_CTIME|S_MTIME))
> + now = inode_set_ctime_current(inode);
> + else
> + now = current_time(inode);
> +
> if (flags & S_MTIME)
> - inode->i_mtime = *now;
> + inode->i_mtime = now;
> if (flags & S_ATIME)
> - inode->i_atime = *now;
> + inode->i_atime = now;
>
> xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL);
> xfs_trans_log_inode(tp, ip, log_flags);
Otherwise the patch looks good to me so feel free to add:
Reviewed-by: Jan Kara <jack@suse.cz>
Honza
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply [flat|nested] 76+ messages in thread
* Re: [f2fs-dev] [PATCH v7 07/13] xfs: have xfs_vn_update_time gets its own timestamp
2023-08-08 9:39 ` Jan Kara
@ 2023-08-09 7:04 ` Christian Brauner
0 siblings, 0 replies; 76+ messages in thread
From: Christian Brauner @ 2023-08-09 7:04 UTC (permalink / raw)
To: Jan Kara
Cc: Latchesar Ionkov, Martin Brandenburg, Konstantin Komarov,
linux-xfs, Darrick J. Wong, Dominique Martinet,
Christian Schoenebeck, ecryptfs, linux-unionfs, David Howells,
Chris Mason, Andreas Dilger, Hans de Goede, Marc Dionne,
samba-technical, codalist, linux-afs, linux-mtd, Mike Marshall,
Paulo Alcantara, linux-cifs, Eric Van Hensbergen,
Andreas Gruenbacher, Miklos Szeredi, Richard Weinberger,
Mark Fasheh, Hugh Dickins, Benjamin Coddington, Tyler Hicks,
cluster-devel, coda, linux-mm, Ilya Dryomov, Iurii Zaikin,
Namjae Jeon, Trond Myklebust, Shyam Prasad N, Amir Goldstein,
Kees Cook, ocfs2-devel, Josef Bacik, Tom Talpey, Tejun Heo,
Yue Hu, Alexander Viro, Ronnie Sahlberg, David Sterba,
Jaegeuk Kim, ceph-devel, Xiubo Li, Gao Xiang, OGAWA Hirofumi,
Jan Harkes, linux-nfs, linux-ext4, Theodore Ts'o, Joseph Qi,
Greg Kroah-Hartman, v9fs, ntfs3, Jeff Layton, linux-kernel,
linux-f2fs-devel, Steve French, Sergey Senozhatsky,
Luis Chamberlain, Jeffle Xu, devel, Anna Schumaker, Jan Kara,
Bob Peterson, linux-fsdevel, Andrew Morton, Sungjong Seo,
linux-erofs, linux-btrfs, Joel Becker
On Tue, Aug 08, 2023 at 11:39:03AM +0200, Jan Kara wrote:
> On Mon 07-08-23 15:38:38, Jeff Layton wrote:
> > In later patches we're going to drop the "now" parameter from the
> > update_time operation. Prepare XFS for this by reworking how it fetches
> > timestamps and sets them in the inode. Ensure that we update the ctime
> > even if only S_MTIME is set.
> >
> > Signed-off-by: Jeff Layton <jlayton@kernel.org>
> > ---
> > fs/xfs/xfs_iops.c | 12 ++++++++----
> > 1 file changed, 8 insertions(+), 4 deletions(-)
> >
> > diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c
> > index 731f45391baa..72d18e7840f5 100644
> > --- a/fs/xfs/xfs_iops.c
> > +++ b/fs/xfs/xfs_iops.c
> > @@ -1037,6 +1037,7 @@ xfs_vn_update_time(
> > int log_flags = XFS_ILOG_TIMESTAMP;
> > struct xfs_trans *tp;
> > int error;
> > + struct timespec64 now = current_time(inode);
>
> No need to fetch current_time() here where you overwrite it just a bit
> later...
It also shadows the @now parameter of that function. Since that function
parameter is dropped in follow-up patches I simply s/now/time/g it here.
In any case, fixed in-tree.
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply [flat|nested] 76+ messages in thread
* Re: [f2fs-dev] [PATCH v7 07/13] xfs: have xfs_vn_update_time gets its own timestamp
2023-08-07 19:38 ` [f2fs-dev] [PATCH v7 07/13] xfs: have xfs_vn_update_time gets its own timestamp Jeff Layton
2023-08-08 9:39 ` Jan Kara
@ 2023-08-09 15:57 ` Darrick J. Wong
1 sibling, 0 replies; 76+ messages in thread
From: Darrick J. Wong @ 2023-08-09 15:57 UTC (permalink / raw)
To: Jeff Layton
Cc: Latchesar Ionkov, Martin Brandenburg, Konstantin Komarov,
linux-xfs, Dominique Martinet, Christian Schoenebeck, ecryptfs,
linux-unionfs, David Howells, Chris Mason, Andreas Dilger,
Hans de Goede, Marc Dionne, codalist, linux-afs, linux-mtd,
Mike Marshall, Paulo Alcantara, linux-cifs, Eric Van Hensbergen,
Andreas Gruenbacher, Miklos Szeredi, Richard Weinberger,
Mark Fasheh, Hugh Dickins, Benjamin Coddington, Tyler Hicks,
cluster-devel, coda, linux-mm, Ilya Dryomov, Iurii Zaikin,
Namjae Jeon, Trond Myklebust, Shyam Prasad N, Amir Goldstein,
Kees Cook, ocfs2-devel, Josef Bacik, Tom Talpey, Tejun Heo,
Yue Hu, Alexander Viro, Ronnie Sahlberg, David Sterba,
Jaegeuk Kim, ceph-devel, Xiubo Li, Gao Xiang, OGAWA Hirofumi,
Jan Harkes, Christian Brauner, linux-ext4, Theodore Ts'o,
Joseph Qi, Greg Kroah-Hartman, v9fs, ntfs3, samba-technical,
linux-kernel, linux-f2fs-devel, Steve French, Sergey Senozhatsky,
Luis Chamberlain, Jeffle Xu, devel, Anna Schumaker, Jan Kara,
Bob Peterson, linux-fsdevel, Andrew Morton, Sungjong Seo,
linux-erofs, linux-nfs, linux-btrfs, Joel Becker
On Mon, Aug 07, 2023 at 03:38:38PM -0400, Jeff Layton wrote:
> In later patches we're going to drop the "now" parameter from the
> update_time operation. Prepare XFS for this by reworking how it fetches
> timestamps and sets them in the inode. Ensure that we update the ctime
> even if only S_MTIME is set.
>
> Signed-off-by: Jeff Layton <jlayton@kernel.org>
> ---
> fs/xfs/xfs_iops.c | 12 ++++++++----
> 1 file changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c
> index 731f45391baa..72d18e7840f5 100644
> --- a/fs/xfs/xfs_iops.c
> +++ b/fs/xfs/xfs_iops.c
> @@ -1037,6 +1037,7 @@ xfs_vn_update_time(
> int log_flags = XFS_ILOG_TIMESTAMP;
> struct xfs_trans *tp;
> int error;
> + struct timespec64 now = current_time(inode);
>
> trace_xfs_update_time(ip);
>
> @@ -1056,12 +1057,15 @@ xfs_vn_update_time(
> return error;
>
> xfs_ilock(ip, XFS_ILOCK_EXCL);
> - if (flags & S_CTIME)
> - inode_set_ctime_to_ts(inode, *now);
> + if (flags & (S_CTIME|S_MTIME))
Minor nit: spaces around ^ the operator.
Otherwise looks ok to me...
Acked-by: Darrick J. Wong <djwong@kernel.org>
--D
> + now = inode_set_ctime_current(inode);
> + else
> + now = current_time(inode);
> +
> if (flags & S_MTIME)
> - inode->i_mtime = *now;
> + inode->i_mtime = now;
> if (flags & S_ATIME)
> - inode->i_atime = *now;
> + inode->i_atime = now;
>
> xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL);
> xfs_trans_log_inode(tp, ip, log_flags);
>
> --
> 2.41.0
>
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply [flat|nested] 76+ messages in thread
* [f2fs-dev] [PATCH v7 08/13] fs: drop the timespec64 argument from update_time
2023-08-07 19:38 [f2fs-dev] [PATCH v7 00/13] fs: implement multigrain timestamps Jeff Layton
` (6 preceding siblings ...)
2023-08-07 19:38 ` [f2fs-dev] [PATCH v7 07/13] xfs: have xfs_vn_update_time gets its own timestamp Jeff Layton
@ 2023-08-07 19:38 ` Jeff Layton
2023-08-08 9:45 ` Jan Kara
2023-08-09 12:31 ` Christian Brauner
2023-08-07 19:38 ` [f2fs-dev] [PATCH v7 09/13] fs: add infrastructure for multigrain timestamps Jeff Layton
` (6 subsequent siblings)
14 siblings, 2 replies; 76+ messages in thread
From: Jeff Layton @ 2023-08-07 19:38 UTC (permalink / raw)
To: Alexander Viro, Christian Brauner, Eric Van Hensbergen,
Latchesar Ionkov, Dominique Martinet, Christian Schoenebeck,
David Howells, Marc Dionne, Chris Mason, Josef Bacik,
David Sterba, Xiubo Li, Ilya Dryomov, Jan Harkes, coda,
Tyler Hicks, Gao Xiang, Chao Yu, Yue Hu, Jeffle Xu, Namjae Jeon,
Sungjong Seo, Jan Kara, Theodore Ts'o, Andreas Dilger,
Jaegeuk Kim, OGAWA Hirofumi, Miklos Szeredi, Bob Peterson,
Andreas Gruenbacher, Greg Kroah-Hartman, Tejun Heo,
Trond Myklebust, Anna Schumaker, Konstantin Komarov, Mark Fasheh,
Joel Becker, Joseph Qi, Mike Marshall, Martin Brandenburg,
Luis Chamberlain, Kees Cook, Iurii Zaikin, Steve French,
Paulo Alcantara, Ronnie Sahlberg, Shyam Prasad N, Tom Talpey,
Sergey Senozhatsky, Richard Weinberger, Hans de Goede,
Hugh Dickins, Andrew Morton, Amir Goldstein, Darrick J. Wong,
Benjamin Coddington
Cc: Jeff Layton, linux-kernel, linux-mm, linux-mtd, linux-afs,
linux-cifs, codalist, cluster-devel, linux-ext4, devel, ecryptfs,
ocfs2-devel, ceph-devel, linux-nfs, v9fs, samba-technical,
linux-unionfs, linux-f2fs-devel, linux-xfs, linux-fsdevel, ntfs3,
linux-erofs, linux-btrfs
Now that all of the update_time operations are prepared for it, we can
drop the timespec64 argument from the update_time operation. Do that and
remove it from some associated functions like inode_update_time and
inode_needs_update_time.
Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
fs/bad_inode.c | 3 +--
fs/btrfs/inode.c | 3 +--
fs/btrfs/volumes.c | 4 +---
fs/fat/fat.h | 3 +--
fs/fat/misc.c | 2 +-
fs/gfs2/inode.c | 3 +--
fs/inode.c | 30 +++++++++++++-----------------
fs/overlayfs/inode.c | 2 +-
fs/overlayfs/overlayfs.h | 2 +-
fs/ubifs/file.c | 3 +--
fs/ubifs/ubifs.h | 2 +-
fs/xfs/xfs_iops.c | 1 -
include/linux/fs.h | 4 ++--
13 files changed, 25 insertions(+), 37 deletions(-)
diff --git a/fs/bad_inode.c b/fs/bad_inode.c
index 6e21f7412a85..83f9566c973b 100644
--- a/fs/bad_inode.c
+++ b/fs/bad_inode.c
@@ -133,8 +133,7 @@ static int bad_inode_fiemap(struct inode *inode,
return -EIO;
}
-static int bad_inode_update_time(struct inode *inode, struct timespec64 *time,
- int flags)
+static int bad_inode_update_time(struct inode *inode, int flags)
{
return -EIO;
}
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index d52e7d64570a..0964c66411a1 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -6059,8 +6059,7 @@ static int btrfs_dirty_inode(struct btrfs_inode *inode)
* This is a copy of file_update_time. We need this so we can return error on
* ENOSPC for updating the inode in the case of file write and mmap writes.
*/
-static int btrfs_update_time(struct inode *inode, struct timespec64 *now,
- int flags)
+static int btrfs_update_time(struct inode *inode, int flags)
{
struct btrfs_root *root = BTRFS_I(inode)->root;
bool dirty = flags & ~S_VERSION;
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 73f9ea7672db..264c71590370 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -1917,15 +1917,13 @@ static int btrfs_add_dev_item(struct btrfs_trans_handle *trans,
static void update_dev_time(const char *device_path)
{
struct path path;
- struct timespec64 now;
int ret;
ret = kern_path(device_path, LOOKUP_FOLLOW, &path);
if (ret)
return;
- now = current_time(d_inode(path.dentry));
- inode_update_time(d_inode(path.dentry), &now, S_MTIME | S_CTIME | S_VERSION);
+ inode_update_time(d_inode(path.dentry), S_MTIME | S_CTIME | S_VERSION);
path_put(&path);
}
diff --git a/fs/fat/fat.h b/fs/fat/fat.h
index e3b690b48e3e..66cf4778cf3b 100644
--- a/fs/fat/fat.h
+++ b/fs/fat/fat.h
@@ -460,8 +460,7 @@ extern struct timespec64 fat_truncate_mtime(const struct msdos_sb_info *sbi,
const struct timespec64 *ts);
extern int fat_truncate_time(struct inode *inode, struct timespec64 *now,
int flags);
-extern int fat_update_time(struct inode *inode, struct timespec64 *now,
- int flags);
+extern int fat_update_time(struct inode *inode, int flags);
extern int fat_sync_bhs(struct buffer_head **bhs, int nr_bhs);
int fat_cache_init(void);
diff --git a/fs/fat/misc.c b/fs/fat/misc.c
index 8cab87145d63..080a5035483f 100644
--- a/fs/fat/misc.c
+++ b/fs/fat/misc.c
@@ -339,7 +339,7 @@ int fat_truncate_time(struct inode *inode, struct timespec64 *now, int flags)
}
EXPORT_SYMBOL_GPL(fat_truncate_time);
-int fat_update_time(struct inode *inode, struct timespec64 *now, int flags)
+int fat_update_time(struct inode *inode, int flags)
{
int dirty_flags = 0;
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c
index f1f04557aa21..a21ac41d6669 100644
--- a/fs/gfs2/inode.c
+++ b/fs/gfs2/inode.c
@@ -2139,8 +2139,7 @@ loff_t gfs2_seek_hole(struct file *file, loff_t offset)
return vfs_setpos(file, ret, inode->i_sb->s_maxbytes);
}
-static int gfs2_update_time(struct inode *inode, struct timespec64 *time,
- int flags)
+static int gfs2_update_time(struct inode *inode, int flags)
{
struct gfs2_inode *ip = GFS2_I(inode);
struct gfs2_glock *gl = ip->i_gl;
diff --git a/fs/inode.c b/fs/inode.c
index e07e45f6cd01..e50d94a136fe 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -1958,10 +1958,10 @@ EXPORT_SYMBOL(generic_update_time);
* This does the actual work of updating an inodes time or version. Must have
* had called mnt_want_write() before calling this.
*/
-int inode_update_time(struct inode *inode, struct timespec64 *time, int flags)
+int inode_update_time(struct inode *inode, int flags)
{
if (inode->i_op->update_time)
- return inode->i_op->update_time(inode, time, flags);
+ return inode->i_op->update_time(inode, flags);
generic_update_time(inode, flags);
return 0;
}
@@ -2015,7 +2015,6 @@ void touch_atime(const struct path *path)
{
struct vfsmount *mnt = path->mnt;
struct inode *inode = d_inode(path->dentry);
- struct timespec64 now;
if (!atime_needs_update(path, inode))
return;
@@ -2034,8 +2033,7 @@ void touch_atime(const struct path *path)
* We may also fail on filesystems that have the ability to make parts
* of the fs read only, e.g. subvolumes in Btrfs.
*/
- now = current_time(inode);
- inode_update_time(inode, &now, S_ATIME);
+ inode_update_time(inode, S_ATIME);
__mnt_drop_write(mnt);
skip_update:
sb_end_write(inode->i_sb);
@@ -2120,20 +2118,21 @@ int file_remove_privs(struct file *file)
}
EXPORT_SYMBOL(file_remove_privs);
-static int inode_needs_update_time(struct inode *inode, struct timespec64 *now)
+static int inode_needs_update_time(struct inode *inode)
{
int sync_it = 0;
+ struct timespec64 now = current_time(inode);
struct timespec64 ctime;
/* First try to exhaust all avenues to not sync */
if (IS_NOCMTIME(inode))
return 0;
- if (!timespec64_equal(&inode->i_mtime, now))
+ if (!timespec64_equal(&inode->i_mtime, &now))
sync_it = S_MTIME;
ctime = inode_get_ctime(inode);
- if (!timespec64_equal(&ctime, now))
+ if (!timespec64_equal(&ctime, &now))
sync_it |= S_CTIME;
if (IS_I_VERSION(inode) && inode_iversion_need_inc(inode))
@@ -2142,15 +2141,14 @@ static int inode_needs_update_time(struct inode *inode, struct timespec64 *now)
return sync_it;
}
-static int __file_update_time(struct file *file, struct timespec64 *now,
- int sync_mode)
+static int __file_update_time(struct file *file, int sync_mode)
{
int ret = 0;
struct inode *inode = file_inode(file);
/* try to update time settings */
if (!__mnt_want_write_file(file)) {
- ret = inode_update_time(inode, now, sync_mode);
+ ret = inode_update_time(inode, sync_mode);
__mnt_drop_write_file(file);
}
@@ -2175,13 +2173,12 @@ int file_update_time(struct file *file)
{
int ret;
struct inode *inode = file_inode(file);
- struct timespec64 now = current_time(inode);
- ret = inode_needs_update_time(inode, &now);
+ ret = inode_needs_update_time(inode);
if (ret <= 0)
return ret;
- return __file_update_time(file, &now, ret);
+ return __file_update_time(file, ret);
}
EXPORT_SYMBOL(file_update_time);
@@ -2204,7 +2201,6 @@ static int file_modified_flags(struct file *file, int flags)
{
int ret;
struct inode *inode = file_inode(file);
- struct timespec64 now = current_time(inode);
/*
* Clear the security bits if the process is not being run by root.
@@ -2217,13 +2213,13 @@ static int file_modified_flags(struct file *file, int flags)
if (unlikely(file->f_mode & FMODE_NOCMTIME))
return 0;
- ret = inode_needs_update_time(inode, &now);
+ ret = inode_needs_update_time(inode);
if (ret <= 0)
return ret;
if (flags & IOCB_NOWAIT)
return -EAGAIN;
- return __file_update_time(file, &now, ret);
+ return __file_update_time(file, ret);
}
/**
diff --git a/fs/overlayfs/inode.c b/fs/overlayfs/inode.c
index a63e57447be9..f22e27b78025 100644
--- a/fs/overlayfs/inode.c
+++ b/fs/overlayfs/inode.c
@@ -693,7 +693,7 @@ int ovl_set_acl(struct mnt_idmap *idmap, struct dentry *dentry,
}
#endif
-int ovl_update_time(struct inode *inode, struct timespec64 *ts, int flags)
+int ovl_update_time(struct inode *inode, int flags)
{
if (flags & S_ATIME) {
struct ovl_fs *ofs = inode->i_sb->s_fs_info;
diff --git a/fs/overlayfs/overlayfs.h b/fs/overlayfs/overlayfs.h
index 9402591f12aa..8bbe6173bef4 100644
--- a/fs/overlayfs/overlayfs.h
+++ b/fs/overlayfs/overlayfs.h
@@ -665,7 +665,7 @@ static inline struct posix_acl *ovl_get_acl_path(const struct path *path,
}
#endif
-int ovl_update_time(struct inode *inode, struct timespec64 *ts, int flags);
+int ovl_update_time(struct inode *inode, int flags);
bool ovl_is_private_xattr(struct super_block *sb, const char *name);
struct ovl_inode_params {
diff --git a/fs/ubifs/file.c b/fs/ubifs/file.c
index 2d0178922e19..eae4001ac92f 100644
--- a/fs/ubifs/file.c
+++ b/fs/ubifs/file.c
@@ -1378,8 +1378,7 @@ static inline int mctime_update_needed(const struct inode *inode,
*
* This function updates time of the inode.
*/
-int ubifs_update_time(struct inode *inode, struct timespec64 *time,
- int flags)
+int ubifs_update_time(struct inode *inode, int flags)
{
struct ubifs_inode *ui = ubifs_inode(inode);
struct ubifs_info *c = inode->i_sb->s_fs_info;
diff --git a/fs/ubifs/ubifs.h b/fs/ubifs/ubifs.h
index 4c36044140e7..ebb3ad6b5e7e 100644
--- a/fs/ubifs/ubifs.h
+++ b/fs/ubifs/ubifs.h
@@ -2027,7 +2027,7 @@ int ubifs_calc_dark(const struct ubifs_info *c, int spc);
int ubifs_fsync(struct file *file, loff_t start, loff_t end, int datasync);
int ubifs_setattr(struct mnt_idmap *idmap, struct dentry *dentry,
struct iattr *attr);
-int ubifs_update_time(struct inode *inode, struct timespec64 *time, int flags);
+int ubifs_update_time(struct inode *inode, int flags);
/* dir.c */
struct inode *ubifs_new_inode(struct ubifs_info *c, struct inode *dir,
diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c
index 72d18e7840f5..c73529f77bac 100644
--- a/fs/xfs/xfs_iops.c
+++ b/fs/xfs/xfs_iops.c
@@ -1029,7 +1029,6 @@ xfs_vn_setattr(
STATIC int
xfs_vn_update_time(
struct inode *inode,
- struct timespec64 *now,
int flags)
{
struct xfs_inode *ip = XFS_I(inode);
diff --git a/include/linux/fs.h b/include/linux/fs.h
index bb3c2c4f871f..a83313f90fe3 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1887,7 +1887,7 @@ struct inode_operations {
ssize_t (*listxattr) (struct dentry *, char *, size_t);
int (*fiemap)(struct inode *, struct fiemap_extent_info *, u64 start,
u64 len);
- int (*update_time)(struct inode *, struct timespec64 *, int);
+ int (*update_time)(struct inode *, int);
int (*atomic_open)(struct inode *, struct dentry *,
struct file *, unsigned open_flag,
umode_t create_mode);
@@ -2237,7 +2237,7 @@ enum file_time_flags {
extern bool atime_needs_update(const struct path *, struct inode *);
extern void touch_atime(const struct path *);
-int inode_update_time(struct inode *inode, struct timespec64 *time, int flags);
+int inode_update_time(struct inode *inode, int flags);
static inline void file_accessed(struct file *file)
{
--
2.41.0
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply related [flat|nested] 76+ messages in thread
* Re: [f2fs-dev] [PATCH v7 08/13] fs: drop the timespec64 argument from update_time
2023-08-07 19:38 ` [f2fs-dev] [PATCH v7 08/13] fs: drop the timespec64 argument from update_time Jeff Layton
@ 2023-08-08 9:45 ` Jan Kara
2023-08-09 12:31 ` Christian Brauner
1 sibling, 0 replies; 76+ messages in thread
From: Jan Kara @ 2023-08-08 9:45 UTC (permalink / raw)
To: Jeff Layton
Cc: Latchesar Ionkov, Martin Brandenburg, Konstantin Komarov,
linux-xfs, Darrick J. Wong, Dominique Martinet,
Christian Schoenebeck, ecryptfs, linux-unionfs, David Howells,
Chris Mason, Andreas Dilger, Hans de Goede, Marc Dionne, codalist,
linux-afs, linux-mtd, Mike Marshall, Paulo Alcantara, linux-cifs,
Eric Van Hensbergen, Andreas Gruenbacher, Miklos Szeredi,
Richard Weinberger, Mark Fasheh, Hugh Dickins,
Benjamin Coddington, Tyler Hicks, cluster-devel, coda, linux-mm,
Ilya Dryomov, Iurii Zaikin, Namjae Jeon, Trond Myklebust,
Shyam Prasad N, Amir Goldstein, Kees Cook, ocfs2-devel,
Josef Bacik, Tom Talpey, Tejun Heo, Yue Hu, Alexander Viro,
Ronnie Sahlberg, David Sterba, Jaegeuk Kim, ceph-devel, Xiubo Li,
Gao Xiang, OGAWA Hirofumi, Jan Harkes, Christian Brauner,
linux-ext4, Theodore Ts'o, Joseph Qi, Greg Kroah-Hartman,
v9fs, ntfs3, samba-technical, linux-kernel, linux-f2fs-devel,
Steve French, Sergey Senozhatsky, Luis Chamberlain, Jeffle Xu,
devel, Anna Schumaker, Jan Kara, Bob Peterson, linux-fsdevel,
Andrew Morton, Sungjong Seo, linux-erofs, linux-nfs, linux-btrfs,
Joel Becker
On Mon 07-08-23 15:38:39, Jeff Layton wrote:
> Now that all of the update_time operations are prepared for it, we can
> drop the timespec64 argument from the update_time operation. Do that and
> remove it from some associated functions like inode_update_time and
> inode_needs_update_time.
>
> Signed-off-by: Jeff Layton <jlayton@kernel.org>
Looks good to me. Feel free to add:
Reviewed-by: Jan Kara <jack@suse.cz>
Honza
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply [flat|nested] 76+ messages in thread
* Re: [f2fs-dev] [PATCH v7 08/13] fs: drop the timespec64 argument from update_time
2023-08-07 19:38 ` [f2fs-dev] [PATCH v7 08/13] fs: drop the timespec64 argument from update_time Jeff Layton
2023-08-08 9:45 ` Jan Kara
@ 2023-08-09 12:31 ` Christian Brauner
2023-08-09 18:38 ` Mike Marshall
1 sibling, 1 reply; 76+ messages in thread
From: Christian Brauner @ 2023-08-09 12:31 UTC (permalink / raw)
To: Jeff Layton
Cc: Latchesar Ionkov, Martin Brandenburg, Konstantin Komarov,
linux-xfs, Darrick J. Wong, Dominique Martinet,
Christian Schoenebeck, ecryptfs, linux-unionfs, David Howells,
Chris Mason, Andreas Dilger, Hans de Goede, Marc Dionne, codalist,
linux-afs, linux-mtd, Mike Marshall, Paulo Alcantara, linux-cifs,
Eric Van Hensbergen, Andreas Gruenbacher, Miklos Szeredi,
Richard Weinberger, Mark Fasheh, Hugh Dickins,
Benjamin Coddington, Tyler Hicks, cluster-devel, coda, linux-mm,
Ilya Dryomov, Iurii Zaikin, Namjae Jeon, Trond Myklebust,
Shyam Prasad N, Amir Goldstein, Kees Cook, ocfs2-devel,
Josef Bacik, Tom Talpey, Tejun Heo, Yue Hu, Alexander Viro,
Ronnie Sahlberg, David Sterba, Jaegeuk Kim, ceph-devel, Xiubo Li,
Gao Xiang, OGAWA Hirofumi, Jan Harkes, linux-nfs, linux-ext4,
Theodore Ts'o, Joseph Qi, Greg Kroah-Hartman, v9fs, ntfs3,
samba-technical, linux-kernel, linux-f2fs-devel, Steve French,
Sergey Senozhatsky, Luis Chamberlain, Jeffle Xu, devel,
Anna Schumaker, Jan Kara, Bob Peterson, linux-fsdevel,
Andrew Morton, Sungjong Seo, linux-erofs, linux-btrfs,
Joel Becker
On Mon, Aug 07, 2023 at 03:38:39PM -0400, Jeff Layton wrote:
> Now that all of the update_time operations are prepared for it, we can
> drop the timespec64 argument from the update_time operation. Do that and
> remove it from some associated functions like inode_update_time and
> inode_needs_update_time.
>
> Signed-off-by: Jeff Layton <jlayton@kernel.org>
> ---
> fs/bad_inode.c | 3 +--
> fs/btrfs/inode.c | 3 +--
> fs/btrfs/volumes.c | 4 +---
> fs/fat/fat.h | 3 +--
> fs/fat/misc.c | 2 +-
> fs/gfs2/inode.c | 3 +--
> fs/inode.c | 30 +++++++++++++-----------------
> fs/overlayfs/inode.c | 2 +-
> fs/overlayfs/overlayfs.h | 2 +-
> fs/ubifs/file.c | 3 +--
> fs/ubifs/ubifs.h | 2 +-
> fs/xfs/xfs_iops.c | 1 -
> include/linux/fs.h | 4 ++--
This was missing the conversion of fs/orangefs orangefs_update_time()
causing the build to fail. So at some point kbuild will yell here.
Fwiw, I've fixed that up in-tree.
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply [flat|nested] 76+ messages in thread
* Re: [f2fs-dev] [PATCH v7 08/13] fs: drop the timespec64 argument from update_time
2023-08-09 12:31 ` Christian Brauner
@ 2023-08-09 18:38 ` Mike Marshall
2023-08-09 19:05 ` Jeff Layton
0 siblings, 1 reply; 76+ messages in thread
From: Mike Marshall @ 2023-08-09 18:38 UTC (permalink / raw)
To: Christian Brauner
Cc: Latchesar Ionkov, Martin Brandenburg, Konstantin Komarov,
linux-xfs, Darrick J. Wong, Dominique Martinet,
Christian Schoenebeck, ecryptfs, linux-unionfs, David Howells,
Chris Mason, Andreas Dilger, Hans de Goede, Marc Dionne,
samba-technical, codalist, linux-afs, linux-mtd, Paulo Alcantara,
linux-cifs, Eric Van Hensbergen, Andreas Gruenbacher,
Miklos Szeredi, Richard Weinberger, Mark Fasheh, Hugh Dickins,
Benjamin Coddington, Tyler Hicks, cluster-devel, coda, linux-mm,
Ilya Dryomov, Iurii Zaikin, Namjae Jeon, Trond Myklebust,
Shyam Prasad N, Amir Goldstein, Kees Cook, ocfs2-devel,
Josef Bacik, Tom Talpey, Tejun Heo, Yue Hu, Alexander Viro,
Ronnie Sahlberg, David Sterba, Jaegeuk Kim, ceph-devel, Xiubo Li,
Gao Xiang, OGAWA Hirofumi, Jan Harkes, linux-nfs, linux-ext4,
Theodore Ts'o, Joseph Qi, Greg Kroah-Hartman, v9fs, ntfs3,
Jeff Layton, linux-kernel, linux-f2fs-devel, Steve French,
Sergey Senozhatsky, Luis Chamberlain, Jeffle Xu, devel,
Anna Schumaker, Jan Kara, Bob Peterson, linux-fsdevel,
Andrew Morton, Sungjong Seo, linux-erofs, linux-btrfs,
Joel Becker
I've been following this patch on fsdevel... is there a
remote I could fetch with a branch that has this in it?
-Mike
On Wed, Aug 9, 2023 at 8:32 AM Christian Brauner <brauner@kernel.org> wrote:
>
> On Mon, Aug 07, 2023 at 03:38:39PM -0400, Jeff Layton wrote:
> > Now that all of the update_time operations are prepared for it, we can
> > drop the timespec64 argument from the update_time operation. Do that and
> > remove it from some associated functions like inode_update_time and
> > inode_needs_update_time.
> >
> > Signed-off-by: Jeff Layton <jlayton@kernel.org>
> > ---
> > fs/bad_inode.c | 3 +--
> > fs/btrfs/inode.c | 3 +--
> > fs/btrfs/volumes.c | 4 +---
> > fs/fat/fat.h | 3 +--
> > fs/fat/misc.c | 2 +-
> > fs/gfs2/inode.c | 3 +--
> > fs/inode.c | 30 +++++++++++++-----------------
> > fs/overlayfs/inode.c | 2 +-
> > fs/overlayfs/overlayfs.h | 2 +-
> > fs/ubifs/file.c | 3 +--
> > fs/ubifs/ubifs.h | 2 +-
> > fs/xfs/xfs_iops.c | 1 -
> > include/linux/fs.h | 4 ++--
>
> This was missing the conversion of fs/orangefs orangefs_update_time()
> causing the build to fail. So at some point kbuild will yell here.
> Fwiw, I've fixed that up in-tree.
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply [flat|nested] 76+ messages in thread
* Re: [f2fs-dev] [PATCH v7 08/13] fs: drop the timespec64 argument from update_time
2023-08-09 18:38 ` Mike Marshall
@ 2023-08-09 19:05 ` Jeff Layton
0 siblings, 0 replies; 76+ messages in thread
From: Jeff Layton @ 2023-08-09 19:05 UTC (permalink / raw)
To: Mike Marshall, Christian Brauner
Cc: Latchesar Ionkov, Martin Brandenburg, Konstantin Komarov,
linux-xfs, Darrick J. Wong, Dominique Martinet,
Christian Schoenebeck, ecryptfs, linux-unionfs, David Howells,
Chris Mason, Andreas Dilger, Hans de Goede, Marc Dionne, codalist,
linux-afs, linux-mtd, Paulo Alcantara, linux-cifs,
Eric Van Hensbergen, Andreas Gruenbacher, Miklos Szeredi,
Richard Weinberger, Mark Fasheh, Hugh Dickins,
Benjamin Coddington, Tyler Hicks, cluster-devel, coda, linux-mm,
Ilya Dryomov, Iurii Zaikin, Namjae Jeon, Trond Myklebust,
Shyam Prasad N, Amir Goldstein, Kees Cook, ocfs2-devel,
Josef Bacik, Tom Talpey, Tejun Heo, Yue Hu, Alexander Viro,
Ronnie Sahlberg, David Sterba, Jaegeuk Kim, ceph-devel, Xiubo Li,
Gao Xiang, OGAWA Hirofumi, Jan Harkes, linux-nfs, linux-ext4,
Theodore Ts'o, Joseph Qi, Greg Kroah-Hartman, v9fs, ntfs3,
samba-technical, linux-kernel, linux-f2fs-devel, Steve French,
Sergey Senozhatsky, Luis Chamberlain, Jeffle Xu, devel,
Anna Schumaker, Jan Kara, Bob Peterson, linux-fsdevel,
Andrew Morton, Sungjong Seo, linux-erofs, linux-btrfs,
Joel Becker
Yes. It's in Christian's vfs.ctime branch:
https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git/log/?h=vfs.ctime
On Wed, 2023-08-09 at 14:38 -0400, Mike Marshall wrote:
> I've been following this patch on fsdevel... is there a
> remote I could fetch with a branch that has this in it?
>
> -Mike
>
> On Wed, Aug 9, 2023 at 8:32 AM Christian Brauner <brauner@kernel.org> wrote:
> >
> > On Mon, Aug 07, 2023 at 03:38:39PM -0400, Jeff Layton wrote:
> > > Now that all of the update_time operations are prepared for it, we can
> > > drop the timespec64 argument from the update_time operation. Do that and
> > > remove it from some associated functions like inode_update_time and
> > > inode_needs_update_time.
> > >
> > > Signed-off-by: Jeff Layton <jlayton@kernel.org>
> > > ---
> > > fs/bad_inode.c | 3 +--
> > > fs/btrfs/inode.c | 3 +--
> > > fs/btrfs/volumes.c | 4 +---
> > > fs/fat/fat.h | 3 +--
> > > fs/fat/misc.c | 2 +-
> > > fs/gfs2/inode.c | 3 +--
> > > fs/inode.c | 30 +++++++++++++-----------------
> > > fs/overlayfs/inode.c | 2 +-
> > > fs/overlayfs/overlayfs.h | 2 +-
> > > fs/ubifs/file.c | 3 +--
> > > fs/ubifs/ubifs.h | 2 +-
> > > fs/xfs/xfs_iops.c | 1 -
> > > include/linux/fs.h | 4 ++--
> >
> > This was missing the conversion of fs/orangefs orangefs_update_time()
> > causing the build to fail. So at some point kbuild will yell here.
> > Fwiw, I've fixed that up in-tree.
Cheers,
--
Jeff Layton <jlayton@kernel.org>
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply [flat|nested] 76+ messages in thread
* [f2fs-dev] [PATCH v7 09/13] fs: add infrastructure for multigrain timestamps
2023-08-07 19:38 [f2fs-dev] [PATCH v7 00/13] fs: implement multigrain timestamps Jeff Layton
` (7 preceding siblings ...)
2023-08-07 19:38 ` [f2fs-dev] [PATCH v7 08/13] fs: drop the timespec64 argument from update_time Jeff Layton
@ 2023-08-07 19:38 ` Jeff Layton
2023-08-08 10:02 ` Jan Kara
2023-08-07 19:38 ` [f2fs-dev] [PATCH v7 10/13] tmpfs: add support " Jeff Layton
` (5 subsequent siblings)
14 siblings, 1 reply; 76+ messages in thread
From: Jeff Layton @ 2023-08-07 19:38 UTC (permalink / raw)
To: Alexander Viro, Christian Brauner, Eric Van Hensbergen,
Latchesar Ionkov, Dominique Martinet, Christian Schoenebeck,
David Howells, Marc Dionne, Chris Mason, Josef Bacik,
David Sterba, Xiubo Li, Ilya Dryomov, Jan Harkes, coda,
Tyler Hicks, Gao Xiang, Chao Yu, Yue Hu, Jeffle Xu, Namjae Jeon,
Sungjong Seo, Jan Kara, Theodore Ts'o, Andreas Dilger,
Jaegeuk Kim, OGAWA Hirofumi, Miklos Szeredi, Bob Peterson,
Andreas Gruenbacher, Greg Kroah-Hartman, Tejun Heo,
Trond Myklebust, Anna Schumaker, Konstantin Komarov, Mark Fasheh,
Joel Becker, Joseph Qi, Mike Marshall, Martin Brandenburg,
Luis Chamberlain, Kees Cook, Iurii Zaikin, Steve French,
Paulo Alcantara, Ronnie Sahlberg, Shyam Prasad N, Tom Talpey,
Sergey Senozhatsky, Richard Weinberger, Hans de Goede,
Hugh Dickins, Andrew Morton, Amir Goldstein, Darrick J. Wong,
Benjamin Coddington
Cc: Jeff Layton, linux-kernel, linux-mm, linux-mtd, linux-afs,
linux-cifs, codalist, cluster-devel, linux-ext4, devel, ecryptfs,
ocfs2-devel, ceph-devel, linux-nfs, v9fs, samba-technical,
linux-unionfs, linux-f2fs-devel, linux-xfs, linux-fsdevel, ntfs3,
linux-erofs, linux-btrfs
The VFS always uses coarse-grained timestamps when updating the ctime
and mtime after a change. This has the benefit of allowing filesystems
to optimize away a lot metadata updates, down to around 1 per jiffy,
even when a file is under heavy writes.
Unfortunately, this has always been an issue when we're exporting via
NFSv3, which relies on timestamps to validate caches. A lot of changes
can happen in a jiffy, so timestamps aren't sufficient to help the
client decide to invalidate the cache. Even with NFSv4, a lot of
exported filesystems don't properly support a change attribute and are
subject to the same problems with timestamp granularity. Other
applications have similar issues with timestamps (e.g backup
applications).
If we were to always use fine-grained timestamps, that would improve the
situation, but that becomes rather expensive, as the underlying
filesystem would have to log a lot more metadata updates.
What we need is a way to only use fine-grained timestamps when they are
being actively queried.
POSIX generally mandates that when the the mtime changes, the ctime must
also change. The kernel always stores normalized ctime values, so only
the first 30 bits of the tv_nsec field are ever used.
Use the 31st bit of the ctime tv_nsec field to indicate that something
has queried the inode for the mtime or ctime. When this flag is set,
on the next mtime or ctime update, the kernel will fetch a fine-grained
timestamp instead of the usual coarse-grained one.
Filesytems can opt into this behavior by setting the FS_MGTIME flag in
the fstype. Filesystems that don't set this flag will continue to use
coarse-grained timestamps.
Later patches will convert individual filesystems to use the new
infrastructure.
Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
fs/inode.c | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++++--
fs/stat.c | 41 +++++++++++++++++++++++++--
include/linux/fs.h | 46 ++++++++++++++++++++++++++++--
3 files changed, 162 insertions(+), 7 deletions(-)
diff --git a/fs/inode.c b/fs/inode.c
index e50d94a136fe..f55957ac80e6 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -2118,10 +2118,52 @@ int file_remove_privs(struct file *file)
}
EXPORT_SYMBOL(file_remove_privs);
+/**
+ * current_mgtime - Return FS time (possibly fine-grained)
+ * @inode: inode.
+ *
+ * Return the current time truncated to the time granularity supported by
+ * the fs, as suitable for a ctime/mtime change. If the ctime is flagged
+ * as having been QUERIED, get a fine-grained timestamp.
+ */
+struct timespec64 current_mgtime(struct inode *inode)
+{
+ struct timespec64 now, ctime;
+ atomic_long_t *pnsec = (atomic_long_t *)&inode->__i_ctime.tv_nsec;
+ long nsec = atomic_long_read(pnsec);
+
+ if (nsec & I_CTIME_QUERIED) {
+ ktime_get_real_ts64(&now);
+ return timestamp_truncate(now, inode);
+ }
+
+ ktime_get_coarse_real_ts64(&now);
+ now = timestamp_truncate(now, inode);
+
+ /*
+ * If we've recently fetched a fine-grained timestamp
+ * then the coarse-grained one may still be earlier than the
+ * existing ctime. Just keep the existing value if so.
+ */
+ ctime = inode_get_ctime(inode);
+ if (timespec64_compare(&ctime, &now) > 0)
+ now = ctime;
+
+ return now;
+}
+EXPORT_SYMBOL(current_mgtime);
+
+static struct timespec64 current_ctime(struct inode *inode)
+{
+ if (is_mgtime(inode))
+ return current_mgtime(inode);
+ return current_time(inode);
+}
+
static int inode_needs_update_time(struct inode *inode)
{
int sync_it = 0;
- struct timespec64 now = current_time(inode);
+ struct timespec64 now = current_ctime(inode);
struct timespec64 ctime;
/* First try to exhaust all avenues to not sync */
@@ -2552,9 +2594,43 @@ EXPORT_SYMBOL(current_time);
*/
struct timespec64 inode_set_ctime_current(struct inode *inode)
{
- struct timespec64 now = current_time(inode);
+ struct timespec64 now;
+ struct timespec64 ctime;
+
+ ctime.tv_nsec = READ_ONCE(inode->__i_ctime.tv_nsec);
+ if (!(ctime.tv_nsec & I_CTIME_QUERIED)) {
+ now = current_time(inode);
- inode_set_ctime(inode, now.tv_sec, now.tv_nsec);
+ /* Just copy it into place if it's not multigrain */
+ if (!is_mgtime(inode)) {
+ inode_set_ctime_to_ts(inode, now);
+ return now;
+ }
+
+ /*
+ * If we've recently updated with a fine-grained timestamp,
+ * then the coarse-grained one may still be earlier than the
+ * existing ctime. Just keep the existing value if so.
+ */
+ ctime.tv_sec = inode->__i_ctime.tv_sec;
+ if (timespec64_compare(&ctime, &now) > 0)
+ return ctime;
+
+ /*
+ * Ctime updates are usually protected by the inode_lock, but
+ * we can still race with someone setting the QUERIED flag.
+ * Try to swap the new nsec value into place. If it's changed
+ * in the interim, then just go with a fine-grained timestamp.
+ */
+ if (cmpxchg(&inode->__i_ctime.tv_nsec, ctime.tv_nsec,
+ now.tv_nsec) != ctime.tv_nsec)
+ goto fine_grained;
+ inode->__i_ctime.tv_sec = now.tv_sec;
+ return now;
+ }
+fine_grained:
+ ktime_get_real_ts64(&now);
+ inode_set_ctime_to_ts(inode, timestamp_truncate(now, inode));
return now;
}
EXPORT_SYMBOL(inode_set_ctime_current);
diff --git a/fs/stat.c b/fs/stat.c
index 7644e5997035..136711ae72fb 100644
--- a/fs/stat.c
+++ b/fs/stat.c
@@ -26,6 +26,37 @@
#include "internal.h"
#include "mount.h"
+/**
+ * fill_mg_cmtime - Fill in the mtime and ctime and flag ctime as QUERIED
+ * @stat: where to store the resulting values
+ * @request_mask: STATX_* values requested
+ * @inode: inode from which to grab the c/mtime
+ *
+ * Given @inode, grab the ctime and mtime out if it and store the result
+ * in @stat. When fetching the value, flag it as queried so the next write
+ * will use a fine-grained timestamp.
+ */
+void fill_mg_cmtime(struct kstat *stat, u32 request_mask, struct inode *inode)
+{
+ atomic_long_t *pnsec = (atomic_long_t *)&inode->__i_ctime.tv_nsec;
+
+ /* If neither time was requested, then don't report them */
+ if (!(request_mask & (STATX_CTIME|STATX_MTIME))) {
+ stat->result_mask &= ~(STATX_CTIME|STATX_MTIME);
+ return;
+ }
+
+ stat->mtime = inode->i_mtime;
+ stat->ctime.tv_sec = inode->__i_ctime.tv_sec;
+ /*
+ * Atomically set the QUERIED flag and fetch the new value with
+ * the flag masked off.
+ */
+ stat->ctime.tv_nsec = atomic_long_fetch_or(I_CTIME_QUERIED, pnsec) &
+ ~I_CTIME_QUERIED;
+}
+EXPORT_SYMBOL(fill_mg_cmtime);
+
/**
* generic_fillattr - Fill in the basic attributes from the inode struct
* @idmap: idmap of the mount the inode was found from
@@ -58,8 +89,14 @@ void generic_fillattr(struct mnt_idmap *idmap, u32 request_mask,
stat->rdev = inode->i_rdev;
stat->size = i_size_read(inode);
stat->atime = inode->i_atime;
- stat->mtime = inode->i_mtime;
- stat->ctime = inode_get_ctime(inode);
+
+ if (is_mgtime(inode)) {
+ fill_mg_cmtime(stat, request_mask, inode);
+ } else {
+ stat->mtime = inode->i_mtime;
+ stat->ctime = inode_get_ctime(inode);
+ }
+
stat->blksize = i_blocksize(inode);
stat->blocks = inode->i_blocks;
diff --git a/include/linux/fs.h b/include/linux/fs.h
index a83313f90fe3..455835d0e963 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1474,18 +1474,47 @@ static inline bool fsuidgid_has_mapping(struct super_block *sb,
kgid_has_mapping(fs_userns, kgid);
}
+struct timespec64 current_mgtime(struct inode *inode);
struct timespec64 current_time(struct inode *inode);
struct timespec64 inode_set_ctime_current(struct inode *inode);
+/*
+ * Multigrain timestamps
+ *
+ * Conditionally use fine-grained ctime and mtime timestamps when there
+ * are users actively observing them via getattr. The primary use-case
+ * for this is NFS clients that use the ctime to distinguish between
+ * different states of the file, and that are often fooled by multiple
+ * operations that occur in the same coarse-grained timer tick.
+ *
+ * The kernel always keeps normalized struct timespec64 values in the ctime,
+ * which means that only the first 30 bits of the value are used. Use the
+ * 31st bit of the ctime's tv_nsec field as a flag to indicate that the value
+ * has been queried since it was last updated.
+ */
+#define I_CTIME_QUERIED (1L<<30)
+
/**
* inode_get_ctime - fetch the current ctime from the inode
* @inode: inode from which to fetch ctime
*
- * Grab the current ctime from the inode and return it.
+ * Grab the current ctime tv_nsec field from the inode, mask off the
+ * I_CTIME_QUERIED flag and return it. This is mostly intended for use by
+ * internal consumers of the ctime that aren't concerned with ensuring a
+ * fine-grained update on the next change (e.g. when preparing to store
+ * the value in the backing store for later retrieval).
+ *
+ * This is safe to call regardless of whether the underlying filesystem
+ * is using multigrain timestamps.
*/
static inline struct timespec64 inode_get_ctime(const struct inode *inode)
{
- return inode->__i_ctime;
+ struct timespec64 ctime;
+
+ ctime.tv_sec = inode->__i_ctime.tv_sec;
+ ctime.tv_nsec = inode->__i_ctime.tv_nsec & ~I_CTIME_QUERIED;
+
+ return ctime;
}
/**
@@ -2259,6 +2288,7 @@ struct file_system_type {
#define FS_USERNS_MOUNT 8 /* Can be mounted by userns root */
#define FS_DISALLOW_NOTIFY_PERM 16 /* Disable fanotify permission events */
#define FS_ALLOW_IDMAP 32 /* FS has been updated to handle vfs idmappings. */
+#define FS_MGTIME 64 /* FS uses multigrain timestamps */
#define FS_RENAME_DOES_D_MOVE 32768 /* FS will handle d_move() during rename() internally. */
int (*init_fs_context)(struct fs_context *);
const struct fs_parameter_spec *parameters;
@@ -2282,6 +2312,17 @@ struct file_system_type {
#define MODULE_ALIAS_FS(NAME) MODULE_ALIAS("fs-" NAME)
+/**
+ * is_mgtime: is this inode using multigrain timestamps
+ * @inode: inode to test for multigrain timestamps
+ *
+ * Return true if the inode uses multigrain timestamps, false otherwise.
+ */
+static inline bool is_mgtime(const struct inode *inode)
+{
+ return inode->i_sb->s_type->fs_flags & FS_MGTIME;
+}
+
extern struct dentry *mount_bdev(struct file_system_type *fs_type,
int flags, const char *dev_name, void *data,
int (*fill_super)(struct super_block *, void *, int));
@@ -2918,6 +2959,7 @@ extern void page_put_link(void *);
extern int page_symlink(struct inode *inode, const char *symname, int len);
extern const struct inode_operations page_symlink_inode_operations;
extern void kfree_link(void *);
+void fill_mg_cmtime(struct kstat *stat, u32 request_mask, struct inode *inode);
void generic_fillattr(struct mnt_idmap *, u32, struct inode *, struct kstat *);
void generic_fill_statx_attr(struct inode *inode, struct kstat *stat);
extern int vfs_getattr_nosec(const struct path *, struct kstat *, u32, unsigned int);
--
2.41.0
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply related [flat|nested] 76+ messages in thread
* Re: [f2fs-dev] [PATCH v7 09/13] fs: add infrastructure for multigrain timestamps
2023-08-07 19:38 ` [f2fs-dev] [PATCH v7 09/13] fs: add infrastructure for multigrain timestamps Jeff Layton
@ 2023-08-08 10:02 ` Jan Kara
0 siblings, 0 replies; 76+ messages in thread
From: Jan Kara @ 2023-08-08 10:02 UTC (permalink / raw)
To: Jeff Layton
Cc: Latchesar Ionkov, Martin Brandenburg, Konstantin Komarov,
linux-xfs, Darrick J. Wong, Dominique Martinet,
Christian Schoenebeck, ecryptfs, linux-unionfs, David Howells,
Chris Mason, Andreas Dilger, Hans de Goede, Marc Dionne, codalist,
linux-afs, linux-mtd, Mike Marshall, Paulo Alcantara, linux-cifs,
Eric Van Hensbergen, Andreas Gruenbacher, Miklos Szeredi,
Richard Weinberger, Mark Fasheh, Hugh Dickins,
Benjamin Coddington, Tyler Hicks, cluster-devel, coda, linux-mm,
Ilya Dryomov, Iurii Zaikin, Namjae Jeon, Trond Myklebust,
Shyam Prasad N, Amir Goldstein, Kees Cook, ocfs2-devel,
Josef Bacik, Tom Talpey, Tejun Heo, Yue Hu, Alexander Viro,
Ronnie Sahlberg, David Sterba, Jaegeuk Kim, ceph-devel, Xiubo Li,
Gao Xiang, OGAWA Hirofumi, Jan Harkes, Christian Brauner,
linux-ext4, Theodore Ts'o, Joseph Qi, Greg Kroah-Hartman,
v9fs, ntfs3, samba-technical, linux-kernel, linux-f2fs-devel,
Steve French, Sergey Senozhatsky, Luis Chamberlain, Jeffle Xu,
devel, Anna Schumaker, Jan Kara, Bob Peterson, linux-fsdevel,
Andrew Morton, Sungjong Seo, linux-erofs, linux-nfs, linux-btrfs,
Joel Becker
On Mon 07-08-23 15:38:40, Jeff Layton wrote:
> The VFS always uses coarse-grained timestamps when updating the ctime
> and mtime after a change. This has the benefit of allowing filesystems
> to optimize away a lot metadata updates, down to around 1 per jiffy,
> even when a file is under heavy writes.
>
> Unfortunately, this has always been an issue when we're exporting via
> NFSv3, which relies on timestamps to validate caches. A lot of changes
> can happen in a jiffy, so timestamps aren't sufficient to help the
> client decide to invalidate the cache. Even with NFSv4, a lot of
> exported filesystems don't properly support a change attribute and are
> subject to the same problems with timestamp granularity. Other
> applications have similar issues with timestamps (e.g backup
> applications).
>
> If we were to always use fine-grained timestamps, that would improve the
> situation, but that becomes rather expensive, as the underlying
> filesystem would have to log a lot more metadata updates.
>
> What we need is a way to only use fine-grained timestamps when they are
> being actively queried.
>
> POSIX generally mandates that when the the mtime changes, the ctime must
> also change. The kernel always stores normalized ctime values, so only
> the first 30 bits of the tv_nsec field are ever used.
>
> Use the 31st bit of the ctime tv_nsec field to indicate that something
> has queried the inode for the mtime or ctime. When this flag is set,
> on the next mtime or ctime update, the kernel will fetch a fine-grained
> timestamp instead of the usual coarse-grained one.
>
> Filesytems can opt into this behavior by setting the FS_MGTIME flag in
> the fstype. Filesystems that don't set this flag will continue to use
> coarse-grained timestamps.
>
> Later patches will convert individual filesystems to use the new
> infrastructure.
>
> Signed-off-by: Jeff Layton <jlayton@kernel.org>
Looks good to me. Feel free to add:
Reviewed-by: Jan Kara <jack@suse.cz>
Honza
> ---
> fs/inode.c | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++++--
> fs/stat.c | 41 +++++++++++++++++++++++++--
> include/linux/fs.h | 46 ++++++++++++++++++++++++++++--
> 3 files changed, 162 insertions(+), 7 deletions(-)
>
> diff --git a/fs/inode.c b/fs/inode.c
> index e50d94a136fe..f55957ac80e6 100644
> --- a/fs/inode.c
> +++ b/fs/inode.c
> @@ -2118,10 +2118,52 @@ int file_remove_privs(struct file *file)
> }
> EXPORT_SYMBOL(file_remove_privs);
>
> +/**
> + * current_mgtime - Return FS time (possibly fine-grained)
> + * @inode: inode.
> + *
> + * Return the current time truncated to the time granularity supported by
> + * the fs, as suitable for a ctime/mtime change. If the ctime is flagged
> + * as having been QUERIED, get a fine-grained timestamp.
> + */
> +struct timespec64 current_mgtime(struct inode *inode)
> +{
> + struct timespec64 now, ctime;
> + atomic_long_t *pnsec = (atomic_long_t *)&inode->__i_ctime.tv_nsec;
> + long nsec = atomic_long_read(pnsec);
> +
> + if (nsec & I_CTIME_QUERIED) {
> + ktime_get_real_ts64(&now);
> + return timestamp_truncate(now, inode);
> + }
> +
> + ktime_get_coarse_real_ts64(&now);
> + now = timestamp_truncate(now, inode);
> +
> + /*
> + * If we've recently fetched a fine-grained timestamp
> + * then the coarse-grained one may still be earlier than the
> + * existing ctime. Just keep the existing value if so.
> + */
> + ctime = inode_get_ctime(inode);
> + if (timespec64_compare(&ctime, &now) > 0)
> + now = ctime;
> +
> + return now;
> +}
> +EXPORT_SYMBOL(current_mgtime);
> +
> +static struct timespec64 current_ctime(struct inode *inode)
> +{
> + if (is_mgtime(inode))
> + return current_mgtime(inode);
> + return current_time(inode);
> +}
> +
> static int inode_needs_update_time(struct inode *inode)
> {
> int sync_it = 0;
> - struct timespec64 now = current_time(inode);
> + struct timespec64 now = current_ctime(inode);
> struct timespec64 ctime;
>
> /* First try to exhaust all avenues to not sync */
> @@ -2552,9 +2594,43 @@ EXPORT_SYMBOL(current_time);
> */
> struct timespec64 inode_set_ctime_current(struct inode *inode)
> {
> - struct timespec64 now = current_time(inode);
> + struct timespec64 now;
> + struct timespec64 ctime;
> +
> + ctime.tv_nsec = READ_ONCE(inode->__i_ctime.tv_nsec);
> + if (!(ctime.tv_nsec & I_CTIME_QUERIED)) {
> + now = current_time(inode);
>
> - inode_set_ctime(inode, now.tv_sec, now.tv_nsec);
> + /* Just copy it into place if it's not multigrain */
> + if (!is_mgtime(inode)) {
> + inode_set_ctime_to_ts(inode, now);
> + return now;
> + }
> +
> + /*
> + * If we've recently updated with a fine-grained timestamp,
> + * then the coarse-grained one may still be earlier than the
> + * existing ctime. Just keep the existing value if so.
> + */
> + ctime.tv_sec = inode->__i_ctime.tv_sec;
> + if (timespec64_compare(&ctime, &now) > 0)
> + return ctime;
> +
> + /*
> + * Ctime updates are usually protected by the inode_lock, but
> + * we can still race with someone setting the QUERIED flag.
> + * Try to swap the new nsec value into place. If it's changed
> + * in the interim, then just go with a fine-grained timestamp.
> + */
> + if (cmpxchg(&inode->__i_ctime.tv_nsec, ctime.tv_nsec,
> + now.tv_nsec) != ctime.tv_nsec)
> + goto fine_grained;
> + inode->__i_ctime.tv_sec = now.tv_sec;
> + return now;
> + }
> +fine_grained:
> + ktime_get_real_ts64(&now);
> + inode_set_ctime_to_ts(inode, timestamp_truncate(now, inode));
> return now;
> }
> EXPORT_SYMBOL(inode_set_ctime_current);
> diff --git a/fs/stat.c b/fs/stat.c
> index 7644e5997035..136711ae72fb 100644
> --- a/fs/stat.c
> +++ b/fs/stat.c
> @@ -26,6 +26,37 @@
> #include "internal.h"
> #include "mount.h"
>
> +/**
> + * fill_mg_cmtime - Fill in the mtime and ctime and flag ctime as QUERIED
> + * @stat: where to store the resulting values
> + * @request_mask: STATX_* values requested
> + * @inode: inode from which to grab the c/mtime
> + *
> + * Given @inode, grab the ctime and mtime out if it and store the result
> + * in @stat. When fetching the value, flag it as queried so the next write
> + * will use a fine-grained timestamp.
> + */
> +void fill_mg_cmtime(struct kstat *stat, u32 request_mask, struct inode *inode)
> +{
> + atomic_long_t *pnsec = (atomic_long_t *)&inode->__i_ctime.tv_nsec;
> +
> + /* If neither time was requested, then don't report them */
> + if (!(request_mask & (STATX_CTIME|STATX_MTIME))) {
> + stat->result_mask &= ~(STATX_CTIME|STATX_MTIME);
> + return;
> + }
> +
> + stat->mtime = inode->i_mtime;
> + stat->ctime.tv_sec = inode->__i_ctime.tv_sec;
> + /*
> + * Atomically set the QUERIED flag and fetch the new value with
> + * the flag masked off.
> + */
> + stat->ctime.tv_nsec = atomic_long_fetch_or(I_CTIME_QUERIED, pnsec) &
> + ~I_CTIME_QUERIED;
> +}
> +EXPORT_SYMBOL(fill_mg_cmtime);
> +
> /**
> * generic_fillattr - Fill in the basic attributes from the inode struct
> * @idmap: idmap of the mount the inode was found from
> @@ -58,8 +89,14 @@ void generic_fillattr(struct mnt_idmap *idmap, u32 request_mask,
> stat->rdev = inode->i_rdev;
> stat->size = i_size_read(inode);
> stat->atime = inode->i_atime;
> - stat->mtime = inode->i_mtime;
> - stat->ctime = inode_get_ctime(inode);
> +
> + if (is_mgtime(inode)) {
> + fill_mg_cmtime(stat, request_mask, inode);
> + } else {
> + stat->mtime = inode->i_mtime;
> + stat->ctime = inode_get_ctime(inode);
> + }
> +
> stat->blksize = i_blocksize(inode);
> stat->blocks = inode->i_blocks;
>
> diff --git a/include/linux/fs.h b/include/linux/fs.h
> index a83313f90fe3..455835d0e963 100644
> --- a/include/linux/fs.h
> +++ b/include/linux/fs.h
> @@ -1474,18 +1474,47 @@ static inline bool fsuidgid_has_mapping(struct super_block *sb,
> kgid_has_mapping(fs_userns, kgid);
> }
>
> +struct timespec64 current_mgtime(struct inode *inode);
> struct timespec64 current_time(struct inode *inode);
> struct timespec64 inode_set_ctime_current(struct inode *inode);
>
> +/*
> + * Multigrain timestamps
> + *
> + * Conditionally use fine-grained ctime and mtime timestamps when there
> + * are users actively observing them via getattr. The primary use-case
> + * for this is NFS clients that use the ctime to distinguish between
> + * different states of the file, and that are often fooled by multiple
> + * operations that occur in the same coarse-grained timer tick.
> + *
> + * The kernel always keeps normalized struct timespec64 values in the ctime,
> + * which means that only the first 30 bits of the value are used. Use the
> + * 31st bit of the ctime's tv_nsec field as a flag to indicate that the value
> + * has been queried since it was last updated.
> + */
> +#define I_CTIME_QUERIED (1L<<30)
> +
> /**
> * inode_get_ctime - fetch the current ctime from the inode
> * @inode: inode from which to fetch ctime
> *
> - * Grab the current ctime from the inode and return it.
> + * Grab the current ctime tv_nsec field from the inode, mask off the
> + * I_CTIME_QUERIED flag and return it. This is mostly intended for use by
> + * internal consumers of the ctime that aren't concerned with ensuring a
> + * fine-grained update on the next change (e.g. when preparing to store
> + * the value in the backing store for later retrieval).
> + *
> + * This is safe to call regardless of whether the underlying filesystem
> + * is using multigrain timestamps.
> */
> static inline struct timespec64 inode_get_ctime(const struct inode *inode)
> {
> - return inode->__i_ctime;
> + struct timespec64 ctime;
> +
> + ctime.tv_sec = inode->__i_ctime.tv_sec;
> + ctime.tv_nsec = inode->__i_ctime.tv_nsec & ~I_CTIME_QUERIED;
> +
> + return ctime;
> }
>
> /**
> @@ -2259,6 +2288,7 @@ struct file_system_type {
> #define FS_USERNS_MOUNT 8 /* Can be mounted by userns root */
> #define FS_DISALLOW_NOTIFY_PERM 16 /* Disable fanotify permission events */
> #define FS_ALLOW_IDMAP 32 /* FS has been updated to handle vfs idmappings. */
> +#define FS_MGTIME 64 /* FS uses multigrain timestamps */
> #define FS_RENAME_DOES_D_MOVE 32768 /* FS will handle d_move() during rename() internally. */
> int (*init_fs_context)(struct fs_context *);
> const struct fs_parameter_spec *parameters;
> @@ -2282,6 +2312,17 @@ struct file_system_type {
>
> #define MODULE_ALIAS_FS(NAME) MODULE_ALIAS("fs-" NAME)
>
> +/**
> + * is_mgtime: is this inode using multigrain timestamps
> + * @inode: inode to test for multigrain timestamps
> + *
> + * Return true if the inode uses multigrain timestamps, false otherwise.
> + */
> +static inline bool is_mgtime(const struct inode *inode)
> +{
> + return inode->i_sb->s_type->fs_flags & FS_MGTIME;
> +}
> +
> extern struct dentry *mount_bdev(struct file_system_type *fs_type,
> int flags, const char *dev_name, void *data,
> int (*fill_super)(struct super_block *, void *, int));
> @@ -2918,6 +2959,7 @@ extern void page_put_link(void *);
> extern int page_symlink(struct inode *inode, const char *symname, int len);
> extern const struct inode_operations page_symlink_inode_operations;
> extern void kfree_link(void *);
> +void fill_mg_cmtime(struct kstat *stat, u32 request_mask, struct inode *inode);
> void generic_fillattr(struct mnt_idmap *, u32, struct inode *, struct kstat *);
> void generic_fill_statx_attr(struct inode *inode, struct kstat *stat);
> extern int vfs_getattr_nosec(const struct path *, struct kstat *, u32, unsigned int);
>
> --
> 2.41.0
>
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply [flat|nested] 76+ messages in thread
* [f2fs-dev] [PATCH v7 10/13] tmpfs: add support for multigrain timestamps
2023-08-07 19:38 [f2fs-dev] [PATCH v7 00/13] fs: implement multigrain timestamps Jeff Layton
` (8 preceding siblings ...)
2023-08-07 19:38 ` [f2fs-dev] [PATCH v7 09/13] fs: add infrastructure for multigrain timestamps Jeff Layton
@ 2023-08-07 19:38 ` Jeff Layton
2023-08-07 19:38 ` [f2fs-dev] [PATCH v7 11/13] xfs: switch to " Jeff Layton
` (4 subsequent siblings)
14 siblings, 0 replies; 76+ messages in thread
From: Jeff Layton @ 2023-08-07 19:38 UTC (permalink / raw)
To: Alexander Viro, Christian Brauner, Eric Van Hensbergen,
Latchesar Ionkov, Dominique Martinet, Christian Schoenebeck,
David Howells, Marc Dionne, Chris Mason, Josef Bacik,
David Sterba, Xiubo Li, Ilya Dryomov, Jan Harkes, coda,
Tyler Hicks, Gao Xiang, Chao Yu, Yue Hu, Jeffle Xu, Namjae Jeon,
Sungjong Seo, Jan Kara, Theodore Ts'o, Andreas Dilger,
Jaegeuk Kim, OGAWA Hirofumi, Miklos Szeredi, Bob Peterson,
Andreas Gruenbacher, Greg Kroah-Hartman, Tejun Heo,
Trond Myklebust, Anna Schumaker, Konstantin Komarov, Mark Fasheh,
Joel Becker, Joseph Qi, Mike Marshall, Martin Brandenburg,
Luis Chamberlain, Kees Cook, Iurii Zaikin, Steve French,
Paulo Alcantara, Ronnie Sahlberg, Shyam Prasad N, Tom Talpey,
Sergey Senozhatsky, Richard Weinberger, Hans de Goede,
Hugh Dickins, Andrew Morton, Amir Goldstein, Darrick J. Wong,
Benjamin Coddington
Cc: Jan Kara, Jeff Layton, linux-kernel, linux-mm, linux-mtd,
linux-afs, linux-cifs, codalist, cluster-devel, linux-ext4, devel,
ecryptfs, ocfs2-devel, ceph-devel, linux-nfs, v9fs,
samba-technical, linux-unionfs, linux-f2fs-devel, linux-xfs,
linux-fsdevel, ntfs3, linux-erofs, linux-btrfs
Enable multigrain timestamps, which should ensure that there is an
apparent change to the timestamp whenever it has been written after
being actively observed via getattr.
tmpfs only requires the FS_MGTIME flag.
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
mm/shmem.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mm/shmem.c b/mm/shmem.c
index 142ead70e8c1..98cc4be7a8a8 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -4220,7 +4220,7 @@ static struct file_system_type shmem_fs_type = {
#endif
.kill_sb = kill_litter_super,
#ifdef CONFIG_SHMEM
- .fs_flags = FS_USERNS_MOUNT | FS_ALLOW_IDMAP,
+ .fs_flags = FS_USERNS_MOUNT | FS_ALLOW_IDMAP | FS_MGTIME,
#else
.fs_flags = FS_USERNS_MOUNT,
#endif
--
2.41.0
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply related [flat|nested] 76+ messages in thread
* [f2fs-dev] [PATCH v7 11/13] xfs: switch to multigrain timestamps
2023-08-07 19:38 [f2fs-dev] [PATCH v7 00/13] fs: implement multigrain timestamps Jeff Layton
` (9 preceding siblings ...)
2023-08-07 19:38 ` [f2fs-dev] [PATCH v7 10/13] tmpfs: add support " Jeff Layton
@ 2023-08-07 19:38 ` Jeff Layton
2023-08-07 19:38 ` [f2fs-dev] [PATCH v7 12/13] ext4: " Jeff Layton
` (3 subsequent siblings)
14 siblings, 0 replies; 76+ messages in thread
From: Jeff Layton @ 2023-08-07 19:38 UTC (permalink / raw)
To: Alexander Viro, Christian Brauner, Eric Van Hensbergen,
Latchesar Ionkov, Dominique Martinet, Christian Schoenebeck,
David Howells, Marc Dionne, Chris Mason, Josef Bacik,
David Sterba, Xiubo Li, Ilya Dryomov, Jan Harkes, coda,
Tyler Hicks, Gao Xiang, Chao Yu, Yue Hu, Jeffle Xu, Namjae Jeon,
Sungjong Seo, Jan Kara, Theodore Ts'o, Andreas Dilger,
Jaegeuk Kim, OGAWA Hirofumi, Miklos Szeredi, Bob Peterson,
Andreas Gruenbacher, Greg Kroah-Hartman, Tejun Heo,
Trond Myklebust, Anna Schumaker, Konstantin Komarov, Mark Fasheh,
Joel Becker, Joseph Qi, Mike Marshall, Martin Brandenburg,
Luis Chamberlain, Kees Cook, Iurii Zaikin, Steve French,
Paulo Alcantara, Ronnie Sahlberg, Shyam Prasad N, Tom Talpey,
Sergey Senozhatsky, Richard Weinberger, Hans de Goede,
Hugh Dickins, Andrew Morton, Amir Goldstein, Darrick J. Wong,
Benjamin Coddington
Cc: Jeff Layton, linux-kernel, linux-mm, linux-mtd, linux-afs,
linux-cifs, codalist, cluster-devel, linux-ext4, devel, ecryptfs,
ocfs2-devel, ceph-devel, linux-nfs, v9fs, samba-technical,
linux-unionfs, linux-f2fs-devel, linux-xfs, linux-fsdevel, ntfs3,
linux-erofs, linux-btrfs
Enable multigrain timestamps, which should ensure that there is an
apparent change to the timestamp whenever it has been written after
being actively observed via getattr.
Also, anytime the mtime changes, the ctime must also change, and those
are now the only two options for xfs_trans_ichgtime. Have that function
unconditionally bump the ctime, and ASSERT that XFS_ICHGTIME_CHG is
always set.
Acked-by: "Darrick J. Wong" <djwong@kernel.org>
Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
fs/xfs/libxfs/xfs_trans_inode.c | 6 +++---
fs/xfs/xfs_iops.c | 8 ++++----
fs/xfs/xfs_super.c | 2 +-
3 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/fs/xfs/libxfs/xfs_trans_inode.c b/fs/xfs/libxfs/xfs_trans_inode.c
index 6b2296ff248a..ad22656376d3 100644
--- a/fs/xfs/libxfs/xfs_trans_inode.c
+++ b/fs/xfs/libxfs/xfs_trans_inode.c
@@ -62,12 +62,12 @@ xfs_trans_ichgtime(
ASSERT(tp);
ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL));
- tv = current_time(inode);
+ /* If the mtime changes, then ctime must also change */
+ ASSERT(flags & XFS_ICHGTIME_CHG);
+ tv = inode_set_ctime_current(inode);
if (flags & XFS_ICHGTIME_MOD)
inode->i_mtime = tv;
- if (flags & XFS_ICHGTIME_CHG)
- inode_set_ctime_to_ts(inode, tv);
if (flags & XFS_ICHGTIME_CREATE)
ip->i_crtime = tv;
}
diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c
index c73529f77bac..2ededd3f6b8c 100644
--- a/fs/xfs/xfs_iops.c
+++ b/fs/xfs/xfs_iops.c
@@ -573,10 +573,10 @@ xfs_vn_getattr(
stat->gid = vfsgid_into_kgid(vfsgid);
stat->ino = ip->i_ino;
stat->atime = inode->i_atime;
- stat->mtime = inode->i_mtime;
- stat->ctime = inode_get_ctime(inode);
stat->blocks = XFS_FSB_TO_BB(mp, ip->i_nblocks + ip->i_delayed_blks);
+ fill_mg_cmtime(stat, request_mask, inode);
+
if (xfs_has_v3inodes(mp)) {
if (request_mask & STATX_BTIME) {
stat->result_mask |= STATX_BTIME;
@@ -917,7 +917,7 @@ xfs_setattr_size(
if (newsize != oldsize &&
!(iattr->ia_valid & (ATTR_CTIME | ATTR_MTIME))) {
iattr->ia_ctime = iattr->ia_mtime =
- current_time(inode);
+ current_mgtime(inode);
iattr->ia_valid |= ATTR_CTIME | ATTR_MTIME;
}
@@ -1036,7 +1036,7 @@ xfs_vn_update_time(
int log_flags = XFS_ILOG_TIMESTAMP;
struct xfs_trans *tp;
int error;
- struct timespec64 now = current_time(inode);
+ struct timespec64 now;
trace_xfs_update_time(ip);
diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
index 818510243130..4b10edb2c972 100644
--- a/fs/xfs/xfs_super.c
+++ b/fs/xfs/xfs_super.c
@@ -2009,7 +2009,7 @@ static struct file_system_type xfs_fs_type = {
.init_fs_context = xfs_init_fs_context,
.parameters = xfs_fs_parameters,
.kill_sb = kill_block_super,
- .fs_flags = FS_REQUIRES_DEV | FS_ALLOW_IDMAP,
+ .fs_flags = FS_REQUIRES_DEV | FS_ALLOW_IDMAP | FS_MGTIME,
};
MODULE_ALIAS_FS("xfs");
--
2.41.0
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply related [flat|nested] 76+ messages in thread
* [f2fs-dev] [PATCH v7 12/13] ext4: switch to multigrain timestamps
2023-08-07 19:38 [f2fs-dev] [PATCH v7 00/13] fs: implement multigrain timestamps Jeff Layton
` (10 preceding siblings ...)
2023-08-07 19:38 ` [f2fs-dev] [PATCH v7 11/13] xfs: switch to " Jeff Layton
@ 2023-08-07 19:38 ` Jeff Layton
2023-09-19 7:05 ` Xi Ruoyao via Linux-f2fs-devel
2023-08-07 19:38 ` [f2fs-dev] [PATCH v7 13/13] btrfs: convert " Jeff Layton
` (2 subsequent siblings)
14 siblings, 1 reply; 76+ messages in thread
From: Jeff Layton @ 2023-08-07 19:38 UTC (permalink / raw)
To: Alexander Viro, Christian Brauner, Eric Van Hensbergen,
Latchesar Ionkov, Dominique Martinet, Christian Schoenebeck,
David Howells, Marc Dionne, Chris Mason, Josef Bacik,
David Sterba, Xiubo Li, Ilya Dryomov, Jan Harkes, coda,
Tyler Hicks, Gao Xiang, Chao Yu, Yue Hu, Jeffle Xu, Namjae Jeon,
Sungjong Seo, Jan Kara, Theodore Ts'o, Andreas Dilger,
Jaegeuk Kim, OGAWA Hirofumi, Miklos Szeredi, Bob Peterson,
Andreas Gruenbacher, Greg Kroah-Hartman, Tejun Heo,
Trond Myklebust, Anna Schumaker, Konstantin Komarov, Mark Fasheh,
Joel Becker, Joseph Qi, Mike Marshall, Martin Brandenburg,
Luis Chamberlain, Kees Cook, Iurii Zaikin, Steve French,
Paulo Alcantara, Ronnie Sahlberg, Shyam Prasad N, Tom Talpey,
Sergey Senozhatsky, Richard Weinberger, Hans de Goede,
Hugh Dickins, Andrew Morton, Amir Goldstein, Darrick J. Wong,
Benjamin Coddington
Cc: Jan Kara, Jeff Layton, linux-kernel, linux-mm, linux-mtd,
linux-afs, linux-cifs, codalist, cluster-devel, linux-ext4, devel,
ecryptfs, ocfs2-devel, ceph-devel, linux-nfs, v9fs,
samba-technical, linux-unionfs, linux-f2fs-devel, linux-xfs,
linux-fsdevel, ntfs3, linux-erofs, linux-btrfs
Enable multigrain timestamps, which should ensure that there is an
apparent change to the timestamp whenever it has been written after
being actively observed via getattr.
For ext4, we only need to enable the FS_MGTIME flag.
Acked-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
fs/ext4/super.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index b54c70e1a74e..cb1ff47af156 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -7279,7 +7279,7 @@ static struct file_system_type ext4_fs_type = {
.init_fs_context = ext4_init_fs_context,
.parameters = ext4_param_specs,
.kill_sb = kill_block_super,
- .fs_flags = FS_REQUIRES_DEV | FS_ALLOW_IDMAP,
+ .fs_flags = FS_REQUIRES_DEV | FS_ALLOW_IDMAP | FS_MGTIME,
};
MODULE_ALIAS_FS("ext4");
--
2.41.0
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply related [flat|nested] 76+ messages in thread
* Re: [f2fs-dev] [PATCH v7 12/13] ext4: switch to multigrain timestamps
2023-08-07 19:38 ` [f2fs-dev] [PATCH v7 12/13] ext4: " Jeff Layton
@ 2023-09-19 7:05 ` Xi Ruoyao via Linux-f2fs-devel
2023-09-19 11:04 ` Jan Kara
0 siblings, 1 reply; 76+ messages in thread
From: Xi Ruoyao via Linux-f2fs-devel @ 2023-09-19 7:05 UTC (permalink / raw)
To: Jeff Layton, Alexander Viro, Christian Brauner,
Eric Van Hensbergen, Latchesar Ionkov, Dominique Martinet,
Christian Schoenebeck, David Howells, Marc Dionne, Chris Mason,
Josef Bacik, David Sterba, Xiubo Li, Ilya Dryomov, Jan Harkes,
coda, Tyler Hicks, Gao Xiang, Chao Yu, Yue Hu, Jeffle Xu,
Namjae Jeon, Sungjong Seo, Jan Kara, Theodore Ts'o,
Andreas Dilger, Jaegeuk Kim, OGAWA Hirofumi, Miklos Szeredi,
Bob Peterson, Andreas Gruenbacher, Greg Kroah-Hartman, Tejun Heo,
Trond Myklebust, Anna Schumaker, Konstantin Komarov, Mark Fasheh,
Joel Becker, Joseph Qi, Mike Marshall, Martin Brandenburg,
Luis Chamberlain, Kees Cook, Iurii Zaikin, Steve French,
Paulo Alcantara, Ronnie Sahlberg, Shyam Prasad N, Tom Talpey,
Sergey Senozhatsky, Richard Weinberger, Hans de Goede,
Hugh Dickins, Andrew Morton, Amir Goldstein, Darrick J. Wong,
Benjamin Coddington
Cc: Jan Kara, linux-kernel, linux-mm, linux-mtd, linux-afs,
linux-cifs, bug-gnulib, codalist, cluster-devel, linux-ext4,
devel, ecryptfs, ocfs2-devel, ceph-devel, linux-nfs, v9fs,
samba-technical, linux-unionfs, linux-f2fs-devel, linux-xfs,
linux-fsdevel, ntfs3, linux-erofs, linux-btrfs
On Mon, 2023-08-07 at 15:38 -0400, Jeff Layton wrote:
> Enable multigrain timestamps, which should ensure that there is an
> apparent change to the timestamp whenever it has been written after
> being actively observed via getattr.
>
> For ext4, we only need to enable the FS_MGTIME flag.
Hi Jeff,
This patch causes a gnulib test failure:
$ ~/sources/lfs/grep-3.11/gnulib-tests/test-stat-time
test-stat-time.c:141: assertion 'statinfo[0].st_mtime < statinfo[2].st_mtime || (statinfo[0].st_mtime == statinfo[2].st_mtime && (get_stat_mtime_ns (&statinfo[0]) < get_stat_mtime_ns (&statinfo[2])))' failed
Aborted (core dumped)
The source code of the test:
https://git.savannah.gnu.org/cgit/gnulib.git/tree/tests/test-stat-time.c
Is this an expected change?
> Acked-by: Theodore Ts'o <tytso@mit.edu>
> Reviewed-by: Jan Kara <jack@suse.cz>
> Signed-off-by: Jeff Layton <jlayton@kernel.org>
> ---
> fs/ext4/super.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/ext4/super.c b/fs/ext4/super.c
> index b54c70e1a74e..cb1ff47af156 100644
> --- a/fs/ext4/super.c
> +++ b/fs/ext4/super.c
> @@ -7279,7 +7279,7 @@ static struct file_system_type ext4_fs_type = {
> .init_fs_context = ext4_init_fs_context,
> .parameters = ext4_param_specs,
> .kill_sb = kill_block_super,
> - .fs_flags = FS_REQUIRES_DEV | FS_ALLOW_IDMAP,
> + .fs_flags = FS_REQUIRES_DEV | FS_ALLOW_IDMAP |
> FS_MGTIME,
> };
> MODULE_ALIAS_FS("ext4");
>
>
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply [flat|nested] 76+ messages in thread
* Re: [f2fs-dev] [PATCH v7 12/13] ext4: switch to multigrain timestamps
2023-09-19 7:05 ` Xi Ruoyao via Linux-f2fs-devel
@ 2023-09-19 11:04 ` Jan Kara
2023-09-19 11:33 ` Jeff Layton
0 siblings, 1 reply; 76+ messages in thread
From: Jan Kara @ 2023-09-19 11:04 UTC (permalink / raw)
To: Xi Ruoyao
Cc: Latchesar Ionkov, Martin Brandenburg, Konstantin Komarov,
Jan Kara, linux-xfs, Darrick J. Wong, Dominique Martinet,
Christian Schoenebeck, ecryptfs, linux-unionfs, David Howells,
Chris Mason, Andreas Dilger, Hans de Goede, Marc Dionne,
samba-technical, codalist, linux-afs, linux-mtd, Mike Marshall,
Paulo Alcantara, linux-cifs, Eric Van Hensbergen, bug-gnulib,
Andreas Gruenbacher, Miklos Szeredi, Richard Weinberger,
Mark Fasheh, Hugh Dickins, Benjamin Coddington, Tyler Hicks,
cluster-devel, coda, linux-mm, Ilya Dryomov, Iurii Zaikin,
Namjae Jeon, Trond Myklebust, Shyam Prasad N, Amir Goldstein,
Kees Cook, ocfs2-devel, Josef Bacik, Tom Talpey, Tejun Heo,
Yue Hu, Alexander Viro, Ronnie Sahlberg, David Sterba,
Jaegeuk Kim, ceph-devel, Xiubo Li, Gao Xiang, OGAWA Hirofumi,
Jan Harkes, Christian Brauner, linux-ext4, Theodore Ts'o,
Joseph Qi, Greg Kroah-Hartman, v9fs, ntfs3, Jeff Layton,
linux-kernel, linux-f2fs-devel, Steve French, Sergey Senozhatsky,
Luis Chamberlain, Jeffle Xu, devel, Anna Schumaker, Jan Kara,
Bob Peterson, linux-fsdevel, Andrew Morton, Sungjong Seo,
linux-erofs, linux-nfs, linux-btrfs, Joel Becker
On Tue 19-09-23 15:05:24, Xi Ruoyao wrote:
> On Mon, 2023-08-07 at 15:38 -0400, Jeff Layton wrote:
> > Enable multigrain timestamps, which should ensure that there is an
> > apparent change to the timestamp whenever it has been written after
> > being actively observed via getattr.
> >
> > For ext4, we only need to enable the FS_MGTIME flag.
>
> Hi Jeff,
>
> This patch causes a gnulib test failure:
>
> $ ~/sources/lfs/grep-3.11/gnulib-tests/test-stat-time
> test-stat-time.c:141: assertion 'statinfo[0].st_mtime < statinfo[2].st_mtime || (statinfo[0].st_mtime == statinfo[2].st_mtime && (get_stat_mtime_ns (&statinfo[0]) < get_stat_mtime_ns (&statinfo[2])))' failed
> Aborted (core dumped)
>
> The source code of the test:
> https://git.savannah.gnu.org/cgit/gnulib.git/tree/tests/test-stat-time.c
>
> Is this an expected change?
Kind of yes. The test first tries to estimate filesystem timestamp
granularity in nap() function - due to this patch, the detected granularity
will likely be 1 ns so effectively all the test calls will happen
immediately one after another. But we don't bother setting the timestamps
with more than 1 jiffy (usually 4 ms) precision unless we think someone is
watching. So as a result timestamps of all stamp1 and stamp2 files are
going to be equal which makes the test fail.
The ultimate problem is that a sequence like:
write(f1)
stat(f2)
write(f2)
stat(f2)
write(f1)
stat(f1)
can result in f1 timestamp to be (slightly) lower than the final f2
timestamp because the second write to f1 didn't bother updating the
timestamp. That can indeed be a bit confusing to programs if they compare
timestamps between two files. Jeff?
Honza
> > Acked-by: Theodore Ts'o <tytso@mit.edu>
> > Reviewed-by: Jan Kara <jack@suse.cz>
> > Signed-off-by: Jeff Layton <jlayton@kernel.org>
> > ---
> > fs/ext4/super.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/fs/ext4/super.c b/fs/ext4/super.c
> > index b54c70e1a74e..cb1ff47af156 100644
> > --- a/fs/ext4/super.c
> > +++ b/fs/ext4/super.c
> > @@ -7279,7 +7279,7 @@ static struct file_system_type ext4_fs_type = {
> > .init_fs_context = ext4_init_fs_context,
> > .parameters = ext4_param_specs,
> > .kill_sb = kill_block_super,
> > - .fs_flags = FS_REQUIRES_DEV | FS_ALLOW_IDMAP,
> > + .fs_flags = FS_REQUIRES_DEV | FS_ALLOW_IDMAP |
> > FS_MGTIME,
> > };
> > MODULE_ALIAS_FS("ext4");
> >
> >
>
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply [flat|nested] 76+ messages in thread
* Re: [f2fs-dev] [PATCH v7 12/13] ext4: switch to multigrain timestamps
2023-09-19 11:04 ` Jan Kara
@ 2023-09-19 11:33 ` Jeff Layton
[not found] ` <4511209.uG2h0Jr0uP@nimes>
0 siblings, 1 reply; 76+ messages in thread
From: Jeff Layton @ 2023-09-19 11:33 UTC (permalink / raw)
To: Jan Kara, Xi Ruoyao
Cc: Latchesar Ionkov, Martin Brandenburg, Konstantin Komarov,
linux-xfs, Darrick J. Wong, Dominique Martinet,
Christian Schoenebeck, ecryptfs, linux-unionfs, David Howells,
Chris Mason, Andreas Dilger, Hans de Goede, Marc Dionne, codalist,
linux-afs, linux-mtd, Mike Marshall, Paulo Alcantara, linux-cifs,
Eric Van Hensbergen, bug-gnulib, Andreas Gruenbacher,
Miklos Szeredi, Richard Weinberger, Mark Fasheh, Hugh Dickins,
Benjamin Coddington, Tyler Hicks, cluster-devel, coda, linux-mm,
Ilya Dryomov, Iurii Zaikin, Namjae Jeon, Trond Myklebust,
Shyam Prasad N, Amir Goldstein, Kees Cook, ocfs2-devel,
Josef Bacik, Tom Talpey, Tejun Heo, Yue Hu, Alexander Viro,
Ronnie Sahlberg, David Sterba, Jaegeuk Kim, ceph-devel, Xiubo Li,
Gao Xiang, OGAWA Hirofumi, Jan Harkes, Christian Brauner,
linux-ext4, Theodore Ts'o, Joseph Qi, Greg Kroah-Hartman,
v9fs, ntfs3, samba-technical, linux-kernel, linux-f2fs-devel,
Steve French, Sergey Senozhatsky, Luis Chamberlain, Jeffle Xu,
devel, Anna Schumaker, Jan Kara, Bob Peterson, linux-fsdevel,
Andrew Morton, Sungjong Seo, linux-erofs, linux-nfs, linux-btrfs,
Joel Becker
On Tue, 2023-09-19 at 13:04 +0200, Jan Kara wrote:
> On Tue 19-09-23 15:05:24, Xi Ruoyao wrote:
> > On Mon, 2023-08-07 at 15:38 -0400, Jeff Layton wrote:
> > > Enable multigrain timestamps, which should ensure that there is an
> > > apparent change to the timestamp whenever it has been written after
> > > being actively observed via getattr.
> > >
> > > For ext4, we only need to enable the FS_MGTIME flag.
> >
> > Hi Jeff,
> >
> > This patch causes a gnulib test failure:
> >
> > $ ~/sources/lfs/grep-3.11/gnulib-tests/test-stat-time
> > test-stat-time.c:141: assertion 'statinfo[0].st_mtime < statinfo[2].st_mtime || (statinfo[0].st_mtime == statinfo[2].st_mtime && (get_stat_mtime_ns (&statinfo[0]) < get_stat_mtime_ns (&statinfo[2])))' failed
> > Aborted (core dumped)
> >
> > The source code of the test:
> > https://git.savannah.gnu.org/cgit/gnulib.git/tree/tests/test-stat-time.c
> >
> > Is this an expected change?
>
> Kind of yes. The test first tries to estimate filesystem timestamp
> granularity in nap() function - due to this patch, the detected granularity
> will likely be 1 ns so effectively all the test calls will happen
> immediately one after another. But we don't bother setting the timestamps
> with more than 1 jiffy (usually 4 ms) precision unless we think someone is
> watching. So as a result timestamps of all stamp1 and stamp2 files are
> going to be equal which makes the test fail.
>
That was my take too. The multigrain ctime changes are probably causing
nap() to settle on too small a time delta.
> The ultimate problem is that a sequence like:
>
> write(f1)
> stat(f2)
> write(f2)
> stat(f2)
> write(f1)
> stat(f1)
>
> can result in f1 timestamp to be (slightly) lower than the final f2
> timestamp because the second write to f1 didn't bother updating the
> timestamp. That can indeed be a bit confusing to programs if they compare
> timestamps between two files. Jeff?
>
Basically yes. When there is no stat() call issued on the file in
between writes, the kernel will use coarse-grained timestamps when
updating it (since no one is watching).
I'm not sure what we can do for this test. The nap() function is making
an assumption that the timestamp granularity will be constant, and that
isn't necessarily the case now.
--
Jeff Layton <jlayton@kernel.org>
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply [flat|nested] 76+ messages in thread
* [f2fs-dev] [PATCH v7 13/13] btrfs: convert to multigrain timestamps
2023-08-07 19:38 [f2fs-dev] [PATCH v7 00/13] fs: implement multigrain timestamps Jeff Layton
` (11 preceding siblings ...)
2023-08-07 19:38 ` [f2fs-dev] [PATCH v7 12/13] ext4: " Jeff Layton
@ 2023-08-07 19:38 ` Jeff Layton
2023-08-08 10:05 ` Jan Kara
2023-08-09 7:09 ` [f2fs-dev] [PATCH v7 00/13] fs: implement " Christian Brauner
2023-09-04 18:11 ` patchwork-bot+f2fs
14 siblings, 1 reply; 76+ messages in thread
From: Jeff Layton @ 2023-08-07 19:38 UTC (permalink / raw)
To: Alexander Viro, Christian Brauner, Eric Van Hensbergen,
Latchesar Ionkov, Dominique Martinet, Christian Schoenebeck,
David Howells, Marc Dionne, Chris Mason, Josef Bacik,
David Sterba, Xiubo Li, Ilya Dryomov, Jan Harkes, coda,
Tyler Hicks, Gao Xiang, Chao Yu, Yue Hu, Jeffle Xu, Namjae Jeon,
Sungjong Seo, Jan Kara, Theodore Ts'o, Andreas Dilger,
Jaegeuk Kim, OGAWA Hirofumi, Miklos Szeredi, Bob Peterson,
Andreas Gruenbacher, Greg Kroah-Hartman, Tejun Heo,
Trond Myklebust, Anna Schumaker, Konstantin Komarov, Mark Fasheh,
Joel Becker, Joseph Qi, Mike Marshall, Martin Brandenburg,
Luis Chamberlain, Kees Cook, Iurii Zaikin, Steve French,
Paulo Alcantara, Ronnie Sahlberg, Shyam Prasad N, Tom Talpey,
Sergey Senozhatsky, Richard Weinberger, Hans de Goede,
Hugh Dickins, Andrew Morton, Amir Goldstein, Darrick J. Wong,
Benjamin Coddington
Cc: Jeff Layton, linux-kernel, linux-mm, linux-mtd, linux-afs,
linux-cifs, codalist, cluster-devel, linux-ext4, devel, ecryptfs,
ocfs2-devel, ceph-devel, linux-nfs, v9fs, samba-technical,
linux-unionfs, linux-f2fs-devel, linux-xfs, linux-fsdevel, ntfs3,
linux-erofs, linux-btrfs
Enable multigrain timestamps, which should ensure that there is an
apparent change to the timestamp whenever it has been written after
being actively observed via getattr.
Beyond enabling the FS_MGTIME flag, this patch eliminates
update_time_for_write, which goes to great pains to avoid in-memory
stores. Just have it overwrite the timestamps unconditionally.
Signed-off-by: Jeff Layton <jlayton@kernel.org>
Acked-by: David Sterba <dsterba@suse.com>
---
fs/btrfs/file.c | 24 ++++--------------------
fs/btrfs/super.c | 5 +++--
2 files changed, 7 insertions(+), 22 deletions(-)
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index d7a9ece7a40b..b9e75c9f95ac 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -1106,25 +1106,6 @@ void btrfs_check_nocow_unlock(struct btrfs_inode *inode)
btrfs_drew_write_unlock(&inode->root->snapshot_lock);
}
-static void update_time_for_write(struct inode *inode)
-{
- struct timespec64 now, ctime;
-
- if (IS_NOCMTIME(inode))
- return;
-
- now = current_time(inode);
- if (!timespec64_equal(&inode->i_mtime, &now))
- inode->i_mtime = now;
-
- ctime = inode_get_ctime(inode);
- if (!timespec64_equal(&ctime, &now))
- inode_set_ctime_to_ts(inode, now);
-
- if (IS_I_VERSION(inode))
- inode_inc_iversion(inode);
-}
-
static int btrfs_write_check(struct kiocb *iocb, struct iov_iter *from,
size_t count)
{
@@ -1156,7 +1137,10 @@ static int btrfs_write_check(struct kiocb *iocb, struct iov_iter *from,
* need to start yet another transaction to update the inode as we will
* update the inode when we finish writing whatever data we write.
*/
- update_time_for_write(inode);
+ if (!IS_NOCMTIME(inode)) {
+ inode->i_mtime = inode_set_ctime_current(inode);
+ inode_inc_iversion(inode);
+ }
start_pos = round_down(pos, fs_info->sectorsize);
oldsize = i_size_read(inode);
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index f1dd172d8d5b..8eda51b095c9 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -2144,7 +2144,7 @@ static struct file_system_type btrfs_fs_type = {
.name = "btrfs",
.mount = btrfs_mount,
.kill_sb = btrfs_kill_super,
- .fs_flags = FS_REQUIRES_DEV | FS_BINARY_MOUNTDATA,
+ .fs_flags = FS_REQUIRES_DEV | FS_BINARY_MOUNTDATA | FS_MGTIME,
};
static struct file_system_type btrfs_root_fs_type = {
@@ -2152,7 +2152,8 @@ static struct file_system_type btrfs_root_fs_type = {
.name = "btrfs",
.mount = btrfs_mount_root,
.kill_sb = btrfs_kill_super,
- .fs_flags = FS_REQUIRES_DEV | FS_BINARY_MOUNTDATA | FS_ALLOW_IDMAP,
+ .fs_flags = FS_REQUIRES_DEV | FS_BINARY_MOUNTDATA |
+ FS_ALLOW_IDMAP | FS_MGTIME,
};
MODULE_ALIAS_FS("btrfs");
--
2.41.0
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply related [flat|nested] 76+ messages in thread
* Re: [f2fs-dev] [PATCH v7 13/13] btrfs: convert to multigrain timestamps
2023-08-07 19:38 ` [f2fs-dev] [PATCH v7 13/13] btrfs: convert " Jeff Layton
@ 2023-08-08 10:05 ` Jan Kara
0 siblings, 0 replies; 76+ messages in thread
From: Jan Kara @ 2023-08-08 10:05 UTC (permalink / raw)
To: Jeff Layton
Cc: Latchesar Ionkov, Martin Brandenburg, Konstantin Komarov,
linux-xfs, Darrick J. Wong, Dominique Martinet,
Christian Schoenebeck, ecryptfs, linux-unionfs, David Howells,
Chris Mason, Andreas Dilger, Hans de Goede, Marc Dionne, codalist,
linux-afs, linux-mtd, Mike Marshall, Paulo Alcantara, linux-cifs,
Eric Van Hensbergen, Andreas Gruenbacher, Miklos Szeredi,
Richard Weinberger, Mark Fasheh, Hugh Dickins,
Benjamin Coddington, Tyler Hicks, cluster-devel, coda, linux-mm,
Ilya Dryomov, Iurii Zaikin, Namjae Jeon, Trond Myklebust,
Shyam Prasad N, Amir Goldstein, Kees Cook, ocfs2-devel,
Josef Bacik, Tom Talpey, Tejun Heo, Yue Hu, Alexander Viro,
Ronnie Sahlberg, David Sterba, Jaegeuk Kim, ceph-devel, Xiubo Li,
Gao Xiang, OGAWA Hirofumi, Jan Harkes, Christian Brauner,
linux-ext4, Theodore Ts'o, Joseph Qi, Greg Kroah-Hartman,
v9fs, ntfs3, samba-technical, linux-kernel, linux-f2fs-devel,
Steve French, Sergey Senozhatsky, Luis Chamberlain, Jeffle Xu,
devel, Anna Schumaker, Jan Kara, Bob Peterson, linux-fsdevel,
Andrew Morton, Sungjong Seo, linux-erofs, linux-nfs, linux-btrfs,
Joel Becker
On Mon 07-08-23 15:38:44, Jeff Layton wrote:
> Enable multigrain timestamps, which should ensure that there is an
> apparent change to the timestamp whenever it has been written after
> being actively observed via getattr.
>
> Beyond enabling the FS_MGTIME flag, this patch eliminates
> update_time_for_write, which goes to great pains to avoid in-memory
> stores. Just have it overwrite the timestamps unconditionally.
>
> Signed-off-by: Jeff Layton <jlayton@kernel.org>
> Acked-by: David Sterba <dsterba@suse.com>
Looks good to me. Feel free to add:
Reviewed-by: Jan Kara <jack@suse.cz>
Honza
> ---
> fs/btrfs/file.c | 24 ++++--------------------
> fs/btrfs/super.c | 5 +++--
> 2 files changed, 7 insertions(+), 22 deletions(-)
>
> diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
> index d7a9ece7a40b..b9e75c9f95ac 100644
> --- a/fs/btrfs/file.c
> +++ b/fs/btrfs/file.c
> @@ -1106,25 +1106,6 @@ void btrfs_check_nocow_unlock(struct btrfs_inode *inode)
> btrfs_drew_write_unlock(&inode->root->snapshot_lock);
> }
>
> -static void update_time_for_write(struct inode *inode)
> -{
> - struct timespec64 now, ctime;
> -
> - if (IS_NOCMTIME(inode))
> - return;
> -
> - now = current_time(inode);
> - if (!timespec64_equal(&inode->i_mtime, &now))
> - inode->i_mtime = now;
> -
> - ctime = inode_get_ctime(inode);
> - if (!timespec64_equal(&ctime, &now))
> - inode_set_ctime_to_ts(inode, now);
> -
> - if (IS_I_VERSION(inode))
> - inode_inc_iversion(inode);
> -}
> -
> static int btrfs_write_check(struct kiocb *iocb, struct iov_iter *from,
> size_t count)
> {
> @@ -1156,7 +1137,10 @@ static int btrfs_write_check(struct kiocb *iocb, struct iov_iter *from,
> * need to start yet another transaction to update the inode as we will
> * update the inode when we finish writing whatever data we write.
> */
> - update_time_for_write(inode);
> + if (!IS_NOCMTIME(inode)) {
> + inode->i_mtime = inode_set_ctime_current(inode);
> + inode_inc_iversion(inode);
> + }
>
> start_pos = round_down(pos, fs_info->sectorsize);
> oldsize = i_size_read(inode);
> diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
> index f1dd172d8d5b..8eda51b095c9 100644
> --- a/fs/btrfs/super.c
> +++ b/fs/btrfs/super.c
> @@ -2144,7 +2144,7 @@ static struct file_system_type btrfs_fs_type = {
> .name = "btrfs",
> .mount = btrfs_mount,
> .kill_sb = btrfs_kill_super,
> - .fs_flags = FS_REQUIRES_DEV | FS_BINARY_MOUNTDATA,
> + .fs_flags = FS_REQUIRES_DEV | FS_BINARY_MOUNTDATA | FS_MGTIME,
> };
>
> static struct file_system_type btrfs_root_fs_type = {
> @@ -2152,7 +2152,8 @@ static struct file_system_type btrfs_root_fs_type = {
> .name = "btrfs",
> .mount = btrfs_mount_root,
> .kill_sb = btrfs_kill_super,
> - .fs_flags = FS_REQUIRES_DEV | FS_BINARY_MOUNTDATA | FS_ALLOW_IDMAP,
> + .fs_flags = FS_REQUIRES_DEV | FS_BINARY_MOUNTDATA |
> + FS_ALLOW_IDMAP | FS_MGTIME,
> };
>
> MODULE_ALIAS_FS("btrfs");
>
> --
> 2.41.0
>
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply [flat|nested] 76+ messages in thread
* Re: [f2fs-dev] [PATCH v7 00/13] fs: implement multigrain timestamps
2023-08-07 19:38 [f2fs-dev] [PATCH v7 00/13] fs: implement multigrain timestamps Jeff Layton
` (12 preceding siblings ...)
2023-08-07 19:38 ` [f2fs-dev] [PATCH v7 13/13] btrfs: convert " Jeff Layton
@ 2023-08-09 7:09 ` Christian Brauner
2023-09-04 18:11 ` patchwork-bot+f2fs
14 siblings, 0 replies; 76+ messages in thread
From: Christian Brauner @ 2023-08-09 7:09 UTC (permalink / raw)
To: Jeff Layton
Cc: Latchesar Ionkov, Martin Brandenburg, Konstantin Komarov,
Jan Kara, Joseph Qi, Darrick J. Wong, Dominique Martinet,
Christian Schoenebeck, linux-kernel, David Howells, linux-mm,
linux-mtd, Benjamin Coddington, Hans de Goede, Marc Dionne,
Steve French, Tyler Hicks, linux-afs, Mike Marshall,
Paulo Alcantara, linux-cifs, Xiubo Li, Andreas Gruenbacher,
Miklos Szeredi, Richard Weinberger, Mark Fasheh, Hugh Dickins,
Luis Chamberlain, codalist, cluster-devel, coda, Iurii Zaikin,
Ilya Dryomov, linux-ext4, Namjae Jeon, devel, Bob Peterson,
Shyam Prasad N, Kees Cook, ecryptfs, linux-nfs, Josef Bacik,
Tom Talpey, ocfs2-devel, Yue Hu, Alexander Viro, Ronnie Sahlberg,
David Sterba, Jaegeuk Kim, ceph-devel, Eric Van Hensbergen,
Amir Goldstein, Gao Xiang, OGAWA Hirofumi, Jan Harkes,
Christian Brauner, Sungjong Seo, Theodore Ts'o, Chris Mason,
Greg Kroah-Hartman, v9fs, samba-technical, linux-unionfs,
linux-f2fs-devel, linux-xfs, Sergey Senozhatsky, Tejun Heo,
Trond Myklebust, Jeffle Xu, Anna Schumaker, Jan Kara,
linux-fsdevel, Andreas Dilger, Andrew Morton, ntfs3, linux-erofs,
linux-btrfs, Joel Becker
On Mon, 07 Aug 2023 15:38:31 -0400, Jeff Layton wrote:
> The VFS always uses coarse-grained timestamps when updating the
> ctime and mtime after a change. This has the benefit of allowing
> filesystems to optimize away a lot metadata updates, down to around 1
> per jiffy, even when a file is under heavy writes.
>
> Unfortunately, this coarseness has always been an issue when we're
> exporting via NFSv3, which relies on timestamps to validate caches. A
> lot of changes can happen in a jiffy, so timestamps aren't sufficient to
> help the client decide to invalidate the cache.
>
> [...]
Applied to the vfs.ctime branch of the vfs/vfs.git tree.
Patches in the vfs.ctime branch should appear in linux-next soon.
Please report any outstanding bugs that were missed during review in a
new review to the original patch series allowing us to drop it.
It's encouraged to provide Acked-bys and Reviewed-bys even though the
patch has now been applied. If possible patch trailers will be updated.
Note that commit hashes shown below are subject to change due to rebase,
trailer updates or similar. If in doubt, please check the listed branch.
tree: https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git
branch: vfs.ctime
[01/13] fs: remove silly warning from current_time
https://git.kernel.org/vfs/vfs/c/562bcab11bf4
[02/13] fs: pass the request_mask to generic_fillattr
https://git.kernel.org/vfs/vfs/c/3592165f4378
[03/13] fs: drop the timespec64 arg from generic_update_time
https://git.kernel.org/vfs/vfs/c/32586bb50943
[04/13] btrfs: have it use inode_update_timestamps
https://git.kernel.org/vfs/vfs/c/51fc38e7c7d1
[05/13] fat: make fat_update_time get its own timestamp
https://git.kernel.org/vfs/vfs/c/d6e7faae82dc
[06/13] ubifs: have ubifs_update_time use inode_update_timestamps
https://git.kernel.org/vfs/vfs/c/853ff59b434a
[07/13] xfs: have xfs_vn_update_time gets its own timestamp
https://git.kernel.org/vfs/vfs/c/7ad056c2cf36
[08/13] fs: drop the timespec64 argument from update_time
https://git.kernel.org/vfs/vfs/c/3beae086b71f
[09/13] fs: add infrastructure for multigrain timestamps
https://git.kernel.org/vfs/vfs/c/b16956ed812f
[10/13] tmpfs: add support for multigrain timestamps
https://git.kernel.org/vfs/vfs/c/bd21ec574f16
[11/13] xfs: switch to multigrain timestamps
https://git.kernel.org/vfs/vfs/c/fb9812d2c39e
[12/13] ext4: switch to multigrain timestamps
https://git.kernel.org/vfs/vfs/c/7fdf02299f5d
[13/13] btrfs: convert to multigrain timestamps
https://git.kernel.org/vfs/vfs/c/2ebbf04988b9
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply [flat|nested] 76+ messages in thread
* Re: [f2fs-dev] [PATCH v7 00/13] fs: implement multigrain timestamps
2023-08-07 19:38 [f2fs-dev] [PATCH v7 00/13] fs: implement multigrain timestamps Jeff Layton
` (13 preceding siblings ...)
2023-08-09 7:09 ` [f2fs-dev] [PATCH v7 00/13] fs: implement " Christian Brauner
@ 2023-09-04 18:11 ` patchwork-bot+f2fs
14 siblings, 0 replies; 76+ messages in thread
From: patchwork-bot+f2fs @ 2023-09-04 18:11 UTC (permalink / raw)
To: Jeff Layton
Cc: lucho, martin, almaz.alexandrovich, jack, linux-xfs, djwong,
asmadeus, linux_oss, ecryptfs, linux-unionfs, dhowells, clm,
adilger.kernel, hdegoede, marc.dionne, codalist, linux-afs,
hubcap, pc, linux-cifs, ericvh, agruenba, miklos, richard, mark,
hughd, bcodding, code, cluster-devel, coda, linux-mm, ntfs3,
idryomov, yzaikin, linkinjeon, trond.myklebust, sprasad, amir73il,
keescook, ocfs2-devel, josef, tom, tj, huyue2, viro,
ronniesahlberg, dsterba, jaegeuk, ceph-devel, xiubli, xiang,
hirofumi, jaharkes, brauner, linux-ext4, tytso, joseph.qi, gregkh,
v9fs, linux-fsdevel, samba-technical, linux-kernel,
linux-f2fs-devel, sfrench, senozhatsky, mcgrof, jefflexu, devel,
anna, jack, rpeterso, linux-mtd, akpm, sj1557.seo, linux-erofs,
linux-nfs, linux-btrfs, jlbec
Hello:
This series was applied to jaegeuk/f2fs.git (dev)
by Christian Brauner <brauner@kernel.org>:
On Mon, 07 Aug 2023 15:38:31 -0400 you wrote:
> The VFS always uses coarse-grained timestamps when updating the
> ctime and mtime after a change. This has the benefit of allowing
> filesystems to optimize away a lot metadata updates, down to around 1
> per jiffy, even when a file is under heavy writes.
>
> Unfortunately, this coarseness has always been an issue when we're
> exporting via NFSv3, which relies on timestamps to validate caches. A
> lot of changes can happen in a jiffy, so timestamps aren't sufficient to
> help the client decide to invalidate the cache.
>
> [...]
Here is the summary with links:
- [f2fs-dev,v7,01/13] fs: remove silly warning from current_time
https://git.kernel.org/jaegeuk/f2fs/c/b3030e4f2344
- [f2fs-dev,v7,02/13] fs: pass the request_mask to generic_fillattr
https://git.kernel.org/jaegeuk/f2fs/c/0d72b92883c6
- [f2fs-dev,v7,03/13] fs: drop the timespec64 arg from generic_update_time
https://git.kernel.org/jaegeuk/f2fs/c/541d4c798a59
- [f2fs-dev,v7,04/13] btrfs: have it use inode_update_timestamps
https://git.kernel.org/jaegeuk/f2fs/c/bb7cc0a62e47
- [f2fs-dev,v7,05/13] fat: make fat_update_time get its own timestamp
(no matching commit)
- [f2fs-dev,v7,06/13] ubifs: have ubifs_update_time use inode_update_timestamps
(no matching commit)
- [f2fs-dev,v7,07/13] xfs: have xfs_vn_update_time gets its own timestamp
(no matching commit)
- [f2fs-dev,v7,08/13] fs: drop the timespec64 argument from update_time
(no matching commit)
- [f2fs-dev,v7,09/13] fs: add infrastructure for multigrain timestamps
https://git.kernel.org/jaegeuk/f2fs/c/ffb6cf19e063
- [f2fs-dev,v7,10/13] tmpfs: add support for multigrain timestamps
https://git.kernel.org/jaegeuk/f2fs/c/d48c33972916
- [f2fs-dev,v7,11/13] xfs: switch to multigrain timestamps
(no matching commit)
- [f2fs-dev,v7,12/13] ext4: switch to multigrain timestamps
https://git.kernel.org/jaegeuk/f2fs/c/0269b585868e
- [f2fs-dev,v7,13/13] btrfs: convert to multigrain timestamps
https://git.kernel.org/jaegeuk/f2fs/c/50e9ceef1d4f
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply [flat|nested] 76+ messages in thread