linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 4/5] f2fs: support data flush in ioctl
@ 2015-12-24 10:10 Chao Yu
  2015-12-24 21:06 ` Jaegeuk Kim
  0 siblings, 1 reply; 3+ messages in thread
From: Chao Yu @ 2015-12-24 10:10 UTC (permalink / raw)
  To: Jaegeuk Kim; +Cc: linux-f2fs-devel, linux-kernel

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



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 4/5] f2fs: support data flush in ioctl
  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-26  9:26   ` [f2fs-dev] " Chao Yu
  0 siblings, 1 reply; 3+ messages in thread
From: Jaegeuk Kim @ 2015-12-24 21:06 UTC (permalink / raw)
  To: Chao Yu; +Cc: linux-f2fs-devel, linux-kernel

Hi Chao,

On Thu, Dec 24, 2015 at 06:10:25PM +0800, Chao Yu wrote:
> 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.

There is compatibility issue, since you're trying to change pre-defined
ioctl; it needs to change F2FS_IOC_WRITE_CHECKPOINT too, right?
I'm in doubt that we really need to expose this too.

Thanks,

> 
> 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
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [f2fs-dev] [PATCH 4/5] f2fs: support data flush in ioctl
  2015-12-24 21:06 ` Jaegeuk Kim
@ 2015-12-26  9:26   ` Chao Yu
  0 siblings, 0 replies; 3+ messages in thread
From: Chao Yu @ 2015-12-26  9:26 UTC (permalink / raw)
  To: Jaegeuk Kim; +Cc: linux-kernel, linux-f2fs-devel

Hi Jaegeuk,

On 12/25/15 5:06 AM, Jaegeuk Kim wrote:
> Hi Chao,
> 
> On Thu, Dec 24, 2015 at 06:10:25PM +0800, Chao Yu wrote:
>> 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.
> 
> There is compatibility issue, since you're trying to change pre-defined
> ioctl;

Agreed.

> it needs to change F2FS_IOC_WRITE_CHECKPOINT too, right?

Yes, maybe F2FS_IOC_WRITE_CHECKPOINT_V2 if we have to change this interface.

> I'm in doubt that we really need to expose this too.

There is no obviously demands, but for Marc Lehmann's scenario I expect this can
provide less latency by concurrently writebacking when syncing the whole f2fs
partition.

Thanks,

> 
> Thanks,
> 
>>
>> 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
>>
> 
> ------------------------------------------------------------------------------
> _______________________________________________
> Linux-f2fs-devel mailing list
> Linux-f2fs-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-12-26  9:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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-26  9:26   ` [f2fs-dev] " Chao Yu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).