[PATCH 1/3] vfs: redesign sb state flags

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Super block has special variable for fssync tracking. This is not
optimal. Let's rename it to general s_state variable.
Other bits will be used in later patches.

Signed-off-by: Dmitry Monakhov <dmonakhov@xxxxxxxxxx>
---
 fs/sync.c          |    6 +++---
 include/linux/fs.h |    5 ++++-
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/fs/sync.c b/fs/sync.c
index 418727a..6e540fc 100644
--- a/fs/sync.c
+++ b/fs/sync.c
@@ -97,13 +97,13 @@ static void sync_filesystems(int wait)
 	mutex_lock(&mutex);		/* Could be down_interruptible */
 	spin_lock(&sb_lock);
 	list_for_each_entry(sb, &super_blocks, s_list)
-		sb->s_need_sync = 1;
+		set_bit(ST_FS_SYNC, &sb->s_state);
 
 restart:
 	list_for_each_entry(sb, &super_blocks, s_list) {
-		if (!sb->s_need_sync)
+		if (!test_bit(ST_FS_SYNC, &sb->s_state))
 			continue;
-		sb->s_need_sync = 0;
+		clear_bit(ST_FS_SYNC, &sb->s_state);
 		sb->s_count++;
 		spin_unlock(&sb_lock);
 
diff --git a/include/linux/fs.h b/include/linux/fs.h
index cd32f1b..66369f6 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1306,6 +1306,9 @@ extern int send_sigurg(struct fown_struct *fown);
 #define MNT_DETACH	0x00000002	/* Just detach from the tree */
 #define MNT_EXPIRE	0x00000004	/* Mark for expiry */
 
+enum {
+	ST_FS_SYNC, 	/* fssync is about to happen */
+};
 extern struct list_head super_blocks;
 extern spinlock_t sb_lock;
 
@@ -1325,11 +1328,11 @@ struct super_block {
 	const struct export_operations *s_export_op;
 	unsigned long		s_flags;
 	unsigned long		s_magic;
+	unsigned long		s_state;
 	struct dentry		*s_root;
 	struct rw_semaphore	s_umount;
 	struct mutex		s_lock;
 	int			s_count;
-	int			s_need_sync;
 	atomic_t		s_active;
 #ifdef CONFIG_SECURITY
 	void                    *s_security;
-- 
1.6.6

--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux