f2fs: add support for an i_version counter
PATCH 1/1 f2fs: add support for an i_version counter
NFSv4 mandates a change attribute to avoid problems with timestamp granularity, which Linux implements using the i_version counter. This is particularly important when the underlying filesystem is fast.
--- fs/f2fs/f2fs.h | 1 + fs/f2fs/inode.c | 1 + fs/f2fs/super.c | 1 + 3 files changed, 3 insertions(+)
fs/f2fs/f2fs.h +1 -0
@@ -28,6 +28,7 @@#include <linux/fscrypt.h> #include <linux/fsverity.h> +#include <linux/iversion.h> struct pagevec ;
fs/f2fs/inode.c +1 -0
@@ -32,6 +32,7 @@ void f2fs_mark_inode_dirty_sync(struct inode *inode, bool sync)if (f2fs_inode_dirtied (inode, sync))return ; +inode_inc_iversion (inode);mark_inode_dirty_sync (inode); }
fs/f2fs/super.c +1 -0
@@ -2204,6 +2204,7 @@ static void default_options(struct f2fs_sb_info *sbi, bool remount)set_opt (sbi,MERGE_CHECKPOINT );F2FS_OPTION (sbi).unusable_cap =0 ; sbi->sb->s_flags |=SB_LAZYTIME ; + sbi->sb->s_flags |=SB_I_VERSION ;if (!f2fs_is_readonly (sbi))set_opt (sbi,FLUSH_MERGE );if (f2fs_sb_has_blkzoned (sbi))
Signature · 1 line
2.39.0
Chao Yu
maintainerQuoted 28 lines · Yangtao Li
NFSv4 mandates a change attribute to avoid problems with timestamp granularity, which Linux implements using the
i_versioncounter. This is particularly important when the underlying filesystem is fast.Signed-off-by Yangtao Li <[email protected]>--- fs/f2fs/f2fs.h | 1 + fs/f2fs/inode.c | 1 + fs/f2fs/super.c | 1 + 3 files changed, 3 insertions(+)fs/f2fs/f2fs.h +1
-0@@ -28,6 +28,7 @@#include <linux/fscrypt.h> #include <linux/fsverity.h> +#include <linux/iversion.h> struct pagevec ;fs/f2fs/inode.c +0
-0
fs/f2fs/inode.c void f2fs_mark_inode_dirty_sync(struct inode *inode, bool sync) · line 35
Quoted 4 lines
fs/f2fs/inode.c +1
-0@@ -32,6 +32,7 @@ void f2fs_mark_inode_dirty_sync(struct inode *inode, bool sync)if (f2fs_inode_dirtied (inode, sync))return ; +inode_inc_iversion (inode);
For the case f2fs is not used by nfs as backend storage, there will be overhead for iversion update logic.
So what about introducing a new mount option to enable the iversion functionality, and disabling it by default?
Thanks,
Quoted 15 lines
fs/f2fs/inode.c +0
-0mark_inode_dirty_sync (inode); }fs/f2fs/super.c +1
-0@@ -2204,6 +2204,7 @@ static void default_options(struct f2fs_sb_info *sbi, bool remount)set_opt (sbi,MERGE_CHECKPOINT );F2FS_OPTION (sbi).unusable_cap =0 ; sbi->sb->s_flags |=SB_LAZYTIME ; + sbi->sb->s_flags |=SB_I_VERSION ;if (!f2fs_is_readonly (sbi))set_opt (sbi,FLUSH_MERGE );if (f2fs_sb_has_blkzoned (sbi))