All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chao Yu <chao2.yu@samsung.com>
To: Jaegeuk Kim <jaegeuk@kernel.org>
Cc: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net
Subject: [PATCH 4/5] f2fs: support data flush in ioctl
Date: Thu, 24 Dec 2015 18:10:25 +0800	[thread overview]
Message-ID: <016701d13e33$676f0bc0$364d2340$@samsung.com> (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



------------------------------------------------------------------------------

WARNING: multiple messages have this Message-ID (diff)
From: Chao Yu <chao2.yu@samsung.com>
To: Jaegeuk Kim <jaegeuk@kernel.org>
Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org
Subject: [PATCH 4/5] f2fs: support data flush in ioctl
Date: Thu, 24 Dec 2015 18:10:25 +0800	[thread overview]
Message-ID: <016701d13e33$676f0bc0$364d2340$@samsung.com> (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



             reply	other threads:[~2015-12-24 10:11 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-24 10:10 Chao Yu [this message]
2015-12-24 10:10 ` [PATCH 4/5] f2fs: support data flush in ioctl Chao Yu
2015-12-24 21:06 ` Jaegeuk Kim
2015-12-24 21:06   ` Jaegeuk Kim
2015-12-26  9:26   ` Chao Yu
2015-12-26  9:26     ` [f2fs-dev] " Chao Yu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='016701d13e33$676f0bc0$364d2340$@samsung.com' \
    --to=chao2.yu@samsung.com \
    --cc=jaegeuk@kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.