[RFC PATCH V6 6/7] ovl: introduce ovl_sync_upper_blockdev()

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

 



From: Chengguang Xu <charliecgxu@xxxxxxxxxxx>

Introduce new helper ovl_sync_upper_blockdev() to sync
upper blockdev.

Signed-off-by: Chengguang Xu <charliecgxu@xxxxxxxxxxx>
---
 fs/overlayfs/super.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c
index 12acf0ec7395..ccffcd96491d 100644
--- a/fs/overlayfs/super.c
+++ b/fs/overlayfs/super.c
@@ -258,6 +258,16 @@ static void ovl_put_super(struct super_block *sb)
 	ovl_free_fs(ofs);
 }
 
+static int ovl_sync_upper_blockdev(struct super_block *sb, int wait)
+{
+	if (!sb->s_bdev)
+		return 0;
+
+	if (!wait)
+		return filemap_flush(sb->s_bdev->bd_inode->i_mapping);
+	return filemap_write_and_wait_range(sb->s_bdev->bd_inode->i_mapping, 0, LLONG_MAX);
+}
+
 /* Sync real dirty inodes in upper filesystem (if it exists) */
 static int ovl_sync_fs(struct super_block *sb, int wait)
 {
-- 
2.27.0






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

  Powered by Linux