[RFC PATCH v3 02/10] ovl: introduce waiting list for syncfs

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

 



Introduce extra waiting list to collect inodes
which are in writeback process.

Signed-off-by: Chengguang Xu <cgxu519@xxxxxxxxxxxx>
---
 fs/overlayfs/ovl_entry.h | 5 +++++
 fs/overlayfs/super.c     | 4 ++++
 2 files changed, 9 insertions(+)

diff --git a/fs/overlayfs/ovl_entry.h b/fs/overlayfs/ovl_entry.h
index 1b5a2094df8e..72334662253a 100644
--- a/fs/overlayfs/ovl_entry.h
+++ b/fs/overlayfs/ovl_entry.h
@@ -79,6 +79,9 @@ struct ovl_fs {
 	atomic_long_t last_ino;
 	/* Whiteout dentry cache */
 	struct dentry *whiteout;
+	/* syncfs waiting list and lock */
+	struct list_head syncfs_wait_list;
+	spinlock_t syncfs_wait_list_lock;
 };
 
 static inline struct vfsmount *ovl_upper_mnt(struct ovl_fs *ofs)
@@ -129,6 +132,8 @@ struct ovl_inode {
 
 	/* synchronize copy up and more */
 	struct mutex lock;
+	/* link to ofs->syncfs_wait_list */
+	struct list_head wait_list;
 };
 
 static inline struct ovl_inode *OVL_I(struct inode *inode)
diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c
index d1e546abce87..1e21feb87297 100644
--- a/fs/overlayfs/super.c
+++ b/fs/overlayfs/super.c
@@ -184,6 +184,7 @@ static struct inode *ovl_alloc_inode(struct super_block *sb)
 	oi->lower = NULL;
 	oi->lowerdata = NULL;
 	mutex_init(&oi->lock);
+	INIT_LIST_HEAD(&oi->wait_list);
 
 	return &oi->vfs_inode;
 }
@@ -1869,6 +1870,9 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent)
 	if (!ofs)
 		goto out;
 
+	INIT_LIST_HEAD(&ofs->syncfs_wait_list);
+	spin_lock_init(&ofs->syncfs_wait_list_lock);
+
 	err = super_setup_bdi(sb);
 	if (err)
 		goto out_err;
-- 
2.26.2






[Index of Archives]     [Linux Filesystems Devel]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux