Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1297806

[PATCH 4/5] f2fs: support data flush in ioctl

From Chao Yu <chao2.yu@samsung.com>
Newsgroups linux.kernel
Subject [PATCH 4/5] f2fs: support data flush in ioctl
Date 2015-12-24 11:20 +0100
Message-ID <qJba1-5to-7@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


Sometimes user want to sync all data belong to superblock into storage
for persistence, 'syncfs' syscall is one option, still f2fs supports
similar one through ioctl, difference is that sb releted kworker is
online for writebacking concurrently.

Signed-off-by: Chao Yu <chao2.yu@samsung.com>
---
 fs/f2fs/file.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index a60d088..91997a5 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -1621,6 +1621,7 @@ static int f2fs_ioc_write_checkpoint(struct file *filp, unsigned long arg)
 	struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
 	struct cp_control cpc;
 	int err;
+	int flush_data;
 
 	if (!capable(CAP_SYS_ADMIN))
 		return -EPERM;
@@ -1628,6 +1629,15 @@ static int f2fs_ioc_write_checkpoint(struct file *filp, unsigned long arg)
 	if (f2fs_readonly(sbi->sb))
 		return -EROFS;
 
+	if (get_user(flush_data, (__u32 __user *)arg))
+		return -EFAULT;
+
+	if (flush_data) {
+		err = sync_dirty_inodes(sbi, FILE_INODE);
+		if (err)
+			return err;
+	}
+
 	cpc.reason = __get_cp_reason(sbi);
 
 	mutex_lock(&sbi->gc_mutex);
-- 
2.6.3


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH 4/5] f2fs: support data flush in ioctl Chao Yu <chao2.yu@samsung.com> - 2015-12-24 11:20 +0100
  Re: [PATCH 4/5] f2fs: support data flush in ioctl Jaegeuk Kim <jaegeuk@kernel.org> - 2015-12-24 22:10 +0100
    Re: [f2fs-dev] [PATCH 4/5] f2fs: support data flush in ioctl Chao Yu <chao@kernel.org> - 2015-12-26 10:30 +0100

csiph-web