[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20231120095410.3604801-1-frank.li@vivo.com>
Date: Mon, 20 Nov 2023 02:54:09 -0700
From: Yangtao Li <frank.li@...o.com>
To: Jaegeuk Kim <jaegeuk@...nel.org>, Chao Yu <chao@...nel.org>
Cc: Yangtao Li <frank.li@...o.com>,
linux-f2fs-devel@...ts.sourceforge.net,
linux-kernel@...r.kernel.org
Subject: [PATCH] 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.
Signed-off-by: Yangtao Li <frank.li@...o.com>
---
fs/f2fs/f2fs.h | 1 +
fs/f2fs/inode.c | 1 +
fs/f2fs/super.c | 1 +
3 files changed, 3 insertions(+)
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index 9043cedfa12b..68fd2ef35104 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -28,6 +28,7 @@
#include <linux/fscrypt.h>
#include <linux/fsverity.h>
+#include <linux/iversion.h>
struct pagevec;
diff --git a/fs/f2fs/inode.c b/fs/f2fs/inode.c
index 560bfcad1af2..2604fa4a0704 100644
--- a/fs/f2fs/inode.c
+++ b/fs/f2fs/inode.c
@@ -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);
}
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index 033af907c3b1..2bddccd47e3a 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -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))
--
2.39.0
Powered by blists - more mailing lists