[PATCH 1/2] vfs: move MS_I_VERSION to new s_feature_flags field

J. Bruce Fields bfields at redhat.com
Mon Apr 30 15:43:57 CDT 2012


This is a property of the file system rather than a mount flag (even if
it happens that ext4 uses a mount option to turn i_version updating on
and off.)

We expect there to be other such flags.

Cc: Christoph Hellwig <hch at infradead.org>
Signed-off-by: J. Bruce Fields <bfields at redhat.com>
---
 fs/ext4/super.c    |    4 ++--
 include/linux/fs.h |   12 ++++++++----
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 6da1935..003648d 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -1483,7 +1483,7 @@ static int handle_mount_opt(struct super_block *sb, char *opt, int token,
 		sbi->s_mount_flags |= EXT4_MF_FS_ABORTED;
 		return 1;
 	case Opt_i_version:
-		sb->s_flags |= MS_I_VERSION;
+		sb->s_feature_flags |= SF_I_VERSION;
 		return 1;
 	case Opt_journal_dev:
 		if (is_remount) {
@@ -1749,7 +1749,7 @@ static int _ext4_show_options(struct seq_file *seq, struct super_block *sb,
 		SEQ_OPTS_PRINT("min_batch_time=%u", sbi->s_min_batch_time);
 	if (nodefs || sbi->s_max_batch_time != EXT4_DEF_MAX_BATCH_TIME)
 		SEQ_OPTS_PRINT("max_batch_time=%u", sbi->s_max_batch_time);
-	if (sb->s_flags & MS_I_VERSION)
+	if (sb->s_flags & SF_I_VERSION)
 		SEQ_OPTS_PUTS("i_version");
 	if (nodefs || sbi->s_stripe)
 		SEQ_OPTS_PRINT("stripe=%lu", sbi->s_stripe);
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 99cbb1f..1b0eef8 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -212,7 +212,7 @@ struct inodes_stat_t {
 #define MS_SHARED	(1<<20)	/* change to shared */
 #define MS_RELATIME	(1<<21)	/* Update atime relative to mtime/ctime. */
 #define MS_KERNMOUNT	(1<<22) /* this is a kern_mount call */
-#define MS_I_VERSION	(1<<23) /* Update inode I_version field */
+/* Free bit */
 #define MS_STRICTATIME	(1<<24) /* Always perform atime updates */
 #define MS_NOSEC	(1<<28)
 #define MS_BORN		(1<<29)
@@ -222,7 +222,7 @@ struct inodes_stat_t {
 /*
  * Superblock flags that can be altered by MS_REMOUNT
  */
-#define MS_RMT_MASK	(MS_RDONLY|MS_SYNCHRONOUS|MS_MANDLOCK|MS_I_VERSION)
+#define MS_RMT_MASK	(MS_RDONLY|MS_SYNCHRONOUS|MS_MANDLOCK)
 
 /*
  * Old magic mount flag and mask
@@ -230,6 +230,9 @@ struct inodes_stat_t {
 #define MS_MGC_VAL 0xC0ED0000
 #define MS_MGC_MSK 0xffff0000
 
+/* Superblock feature flags: */
+#define SF_I_VERSION	(1<<0)	/* Update inode i_version field */
+
 /* Inode flags - they have nothing to superblock flags now */
 
 #define S_SYNC		1	/* Writes are synced at once */
@@ -268,7 +271,7 @@ struct inodes_stat_t {
 					((inode)->i_flags & (S_SYNC|S_DIRSYNC)))
 #define IS_MANDLOCK(inode)	__IS_FLG(inode, MS_MANDLOCK)
 #define IS_NOATIME(inode)   __IS_FLG(inode, MS_RDONLY|MS_NOATIME)
-#define IS_I_VERSION(inode)   __IS_FLG(inode, MS_I_VERSION)
+#define IS_I_VERSION(inode)  ((inode)->i_sb->s_flags & SF_I_VERSION)
 
 #define IS_NOQUOTA(inode)	((inode)->i_flags & S_NOQUOTA)
 #define IS_APPEND(inode)	((inode)->i_flags & S_APPEND)
@@ -1428,7 +1431,8 @@ struct super_block {
 	const struct dquot_operations	*dq_op;
 	const struct quotactl_ops	*s_qcop;
 	const struct export_operations *s_export_op;
-	unsigned long		s_flags;
+	unsigned long		s_flags; /* mount flags */
+	unsigned int		s_feature_flags;
 	unsigned long		s_magic;
 	struct dentry		*s_root;
 	struct rw_semaphore	s_umount;
-- 
1.7.7.6




More information about the xfs mailing list