linux-f2fs-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
* [PATCH] f2fs: implement -o dirsync
@ 2014-11-10  6:24 Jaegeuk Kim
  2014-11-10  7:47 ` Changman Lee
  0 siblings, 1 reply; 5+ messages in thread
From: Jaegeuk Kim @ 2014-11-10  6:24 UTC (permalink / raw)
  To: linux-kernel, linux-fsdevel, linux-f2fs-devel; +Cc: Jaegeuk Kim

If a mount option has dirsync, we should call checkpoint for all the directory
operations.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
---
 fs/f2fs/namei.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c
index 6312dd2..db3ee09 100644
--- a/fs/f2fs/namei.c
+++ b/fs/f2fs/namei.c
@@ -138,6 +138,9 @@ static int f2fs_create(struct inode *dir, struct dentry *dentry, umode_t mode,
 	stat_inc_inline_inode(inode);
 	d_instantiate(dentry, inode);
 	unlock_new_inode(inode);
+
+	if (IS_DIRSYNC(dir))
+		f2fs_sync_fs(sbi->sb, 1);
 	return 0;
 out:
 	handle_failed_inode(inode);
@@ -164,6 +167,9 @@ static int f2fs_link(struct dentry *old_dentry, struct inode *dir,
 	f2fs_unlock_op(sbi);
 
 	d_instantiate(dentry, inode);
+
+	if (IS_DIRSYNC(dir))
+		f2fs_sync_fs(sbi->sb, 1);
 	return 0;
 out:
 	clear_inode_flag(F2FS_I(inode), FI_INC_LINK);
@@ -233,6 +239,9 @@ static int f2fs_unlink(struct inode *dir, struct dentry *dentry)
 	f2fs_delete_entry(de, page, dir, inode);
 	f2fs_unlock_op(sbi);
 
+	if (IS_DIRSYNC(dir))
+		f2fs_sync_fs(sbi->sb, 1);
+
 	/* In order to evict this inode, we set it dirty */
 	mark_inode_dirty(inode);
 fail:
@@ -268,6 +277,9 @@ static int f2fs_symlink(struct inode *dir, struct dentry *dentry,
 
 	d_instantiate(dentry, inode);
 	unlock_new_inode(inode);
+
+	if (IS_DIRSYNC(dir))
+		f2fs_sync_fs(sbi->sb, 1);
 	return err;
 out:
 	handle_failed_inode(inode);
@@ -304,6 +316,8 @@ static int f2fs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
 	d_instantiate(dentry, inode);
 	unlock_new_inode(inode);
 
+	if (IS_DIRSYNC(dir))
+		f2fs_sync_fs(sbi->sb, 1);
 	return 0;
 
 out_fail:
@@ -346,8 +360,12 @@ static int f2fs_mknod(struct inode *dir, struct dentry *dentry,
 	f2fs_unlock_op(sbi);
 
 	alloc_nid_done(sbi, inode->i_ino);
+
 	d_instantiate(dentry, inode);
 	unlock_new_inode(inode);
+
+	if (IS_DIRSYNC(dir))
+		f2fs_sync_fs(sbi->sb, 1);
 	return 0;
 out:
 	handle_failed_inode(inode);
@@ -461,6 +479,9 @@ static int f2fs_rename(struct inode *old_dir, struct dentry *old_dentry,
 	}
 
 	f2fs_unlock_op(sbi);
+
+	if (IS_DIRSYNC(old_dir) || IS_DIRSYNC(new_dir))
+		f2fs_sync_fs(sbi->sb, 1);
 	return 0;
 
 put_out_dir:
@@ -600,6 +621,9 @@ static int f2fs_cross_rename(struct inode *old_dir, struct dentry *old_dentry,
 	update_inode_page(new_dir);
 
 	f2fs_unlock_op(sbi);
+
+	if (IS_DIRSYNC(old_dir) || IS_DIRSYNC(new_dir))
+		f2fs_sync_fs(sbi->sb, 1);
 	return 0;
 out_undo:
 	/* Still we may fail to recover name info of f2fs_inode here */
-- 
2.1.1


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

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

* Re: [PATCH] f2fs: implement -o dirsync
  2014-11-10  6:24 [PATCH] f2fs: implement -o dirsync Jaegeuk Kim
@ 2014-11-10  7:47 ` Changman Lee
  2014-11-10  9:19   ` Paolo Minazzi
  2014-11-10 14:49   ` [f2fs-dev] [PATCH v2] " Jaegeuk Kim
  0 siblings, 2 replies; 5+ messages in thread
From: Changman Lee @ 2014-11-10  7:47 UTC (permalink / raw)
  To: Jaegeuk Kim; +Cc: linux-fsdevel, linux-kernel, linux-f2fs-devel

On Sun, Nov 09, 2014 at 10:24:22PM -0800, Jaegeuk Kim wrote:
> If a mount option has dirsync, we should call checkpoint for all the directory
> operations.
> 
> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
> ---
>  fs/f2fs/namei.c | 24 ++++++++++++++++++++++++
>  1 file changed, 24 insertions(+)
> 
> diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c
> index 6312dd2..db3ee09 100644
> --- a/fs/f2fs/namei.c
> +++ b/fs/f2fs/namei.c
> @@ -138,6 +138,9 @@ static int f2fs_create(struct inode *dir, struct dentry *dentry, umode_t mode,
>  	stat_inc_inline_inode(inode);
>  	d_instantiate(dentry, inode);
>  	unlock_new_inode(inode);
> +
> +	if (IS_DIRSYNC(dir))
> +		f2fs_sync_fs(sbi->sb, 1);
>  	return 0;
>  out:
>  	handle_failed_inode(inode);
> @@ -164,6 +167,9 @@ static int f2fs_link(struct dentry *old_dentry, struct inode *dir,
>  	f2fs_unlock_op(sbi);
>  
>  	d_instantiate(dentry, inode);
> +
> +	if (IS_DIRSYNC(dir))
> +		f2fs_sync_fs(sbi->sb, 1);
>  	return 0;
>  out:
>  	clear_inode_flag(F2FS_I(inode), FI_INC_LINK);
> @@ -233,6 +239,9 @@ static int f2fs_unlink(struct inode *dir, struct dentry *dentry)
>  	f2fs_delete_entry(de, page, dir, inode);
>  	f2fs_unlock_op(sbi);
>  
> +	if (IS_DIRSYNC(dir))
> +		f2fs_sync_fs(sbi->sb, 1);
> +
>  	/* In order to evict this inode, we set it dirty */
>  	mark_inode_dirty(inode);

Let's move it below mark_inode_dirty.
After sync, it's unnecessary inserting inode into dirty_list.


>  fail:
> @@ -268,6 +277,9 @@ static int f2fs_symlink(struct inode *dir, struct dentry *dentry,
>  
>  	d_instantiate(dentry, inode);
>  	unlock_new_inode(inode);
> +
> +	if (IS_DIRSYNC(dir))
> +		f2fs_sync_fs(sbi->sb, 1);
>  	return err;
>  out:
>  	handle_failed_inode(inode);
> @@ -304,6 +316,8 @@ static int f2fs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
>  	d_instantiate(dentry, inode);
>  	unlock_new_inode(inode);
>  
> +	if (IS_DIRSYNC(dir))
> +		f2fs_sync_fs(sbi->sb, 1);
>  	return 0;
>  
>  out_fail:
> @@ -346,8 +360,12 @@ static int f2fs_mknod(struct inode *dir, struct dentry *dentry,
>  	f2fs_unlock_op(sbi);
>  
>  	alloc_nid_done(sbi, inode->i_ino);
> +
>  	d_instantiate(dentry, inode);
>  	unlock_new_inode(inode);
> +
> +	if (IS_DIRSYNC(dir))
> +		f2fs_sync_fs(sbi->sb, 1);
>  	return 0;
>  out:
>  	handle_failed_inode(inode);
> @@ -461,6 +479,9 @@ static int f2fs_rename(struct inode *old_dir, struct dentry *old_dentry,
>  	}
>  
>  	f2fs_unlock_op(sbi);
> +
> +	if (IS_DIRSYNC(old_dir) || IS_DIRSYNC(new_dir))
> +		f2fs_sync_fs(sbi->sb, 1);
>  	return 0;
>  
>  put_out_dir:
> @@ -600,6 +621,9 @@ static int f2fs_cross_rename(struct inode *old_dir, struct dentry *old_dentry,
>  	update_inode_page(new_dir);
>  
>  	f2fs_unlock_op(sbi);
> +
> +	if (IS_DIRSYNC(old_dir) || IS_DIRSYNC(new_dir))
> +		f2fs_sync_fs(sbi->sb, 1);
>  	return 0;
>  out_undo:
>  	/* Still we may fail to recover name info of f2fs_inode here */
> -- 
> 2.1.1
> 
> 
> ------------------------------------------------------------------------------
> _______________________________________________
> 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] 5+ messages in thread

* Re: [PATCH] f2fs: implement -o dirsync
  2014-11-10  7:47 ` Changman Lee
@ 2014-11-10  9:19   ` Paolo Minazzi
  2014-11-10 14:49   ` [f2fs-dev] [PATCH v2] " Jaegeuk Kim
  1 sibling, 0 replies; 5+ messages in thread
From: Paolo Minazzi @ 2014-11-10  9:19 UTC (permalink / raw)
  To: linux-f2fs-devel

Thanks Kim and Lee, I will try as soon I can.
Thanks for support
Paolo


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

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

* Re: [f2fs-dev] [PATCH v2] f2fs: implement -o dirsync
  2014-11-10  7:47 ` Changman Lee
  2014-11-10  9:19   ` Paolo Minazzi
@ 2014-11-10 14:49   ` Jaegeuk Kim
  2014-11-14  9:49     ` Paolo Minazzi
  1 sibling, 1 reply; 5+ messages in thread
From: Jaegeuk Kim @ 2014-11-10 14:49 UTC (permalink / raw)
  To: Changman Lee; +Cc: linux-kernel, linux-fsdevel, linux-f2fs-devel

Change log from v1:
 o call sync after mark_inode_dirty

If a mount option has dirsync, we should call checkpoint for all the directory
operations.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
---
 fs/f2fs/namei.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c
index 6312dd2..2bee559 100644
--- a/fs/f2fs/namei.c
+++ b/fs/f2fs/namei.c
@@ -138,6 +138,9 @@ static int f2fs_create(struct inode *dir, struct dentry *dentry, umode_t mode,
 	stat_inc_inline_inode(inode);
 	d_instantiate(dentry, inode);
 	unlock_new_inode(inode);
+
+	if (IS_DIRSYNC(dir))
+		f2fs_sync_fs(sbi->sb, 1);
 	return 0;
 out:
 	handle_failed_inode(inode);
@@ -164,6 +167,9 @@ static int f2fs_link(struct dentry *old_dentry, struct inode *dir,
 	f2fs_unlock_op(sbi);
 
 	d_instantiate(dentry, inode);
+
+	if (IS_DIRSYNC(dir))
+		f2fs_sync_fs(sbi->sb, 1);
 	return 0;
 out:
 	clear_inode_flag(F2FS_I(inode), FI_INC_LINK);
@@ -235,6 +241,9 @@ static int f2fs_unlink(struct inode *dir, struct dentry *dentry)
 
 	/* In order to evict this inode, we set it dirty */
 	mark_inode_dirty(inode);
+
+	if (IS_DIRSYNC(dir))
+		f2fs_sync_fs(sbi->sb, 1);
 fail:
 	trace_f2fs_unlink_exit(inode, err);
 	return err;
@@ -268,6 +277,9 @@ static int f2fs_symlink(struct inode *dir, struct dentry *dentry,
 
 	d_instantiate(dentry, inode);
 	unlock_new_inode(inode);
+
+	if (IS_DIRSYNC(dir))
+		f2fs_sync_fs(sbi->sb, 1);
 	return err;
 out:
 	handle_failed_inode(inode);
@@ -304,6 +316,8 @@ static int f2fs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
 	d_instantiate(dentry, inode);
 	unlock_new_inode(inode);
 
+	if (IS_DIRSYNC(dir))
+		f2fs_sync_fs(sbi->sb, 1);
 	return 0;
 
 out_fail:
@@ -346,8 +360,12 @@ static int f2fs_mknod(struct inode *dir, struct dentry *dentry,
 	f2fs_unlock_op(sbi);
 
 	alloc_nid_done(sbi, inode->i_ino);
+
 	d_instantiate(dentry, inode);
 	unlock_new_inode(inode);
+
+	if (IS_DIRSYNC(dir))
+		f2fs_sync_fs(sbi->sb, 1);
 	return 0;
 out:
 	handle_failed_inode(inode);
@@ -461,6 +479,9 @@ static int f2fs_rename(struct inode *old_dir, struct dentry *old_dentry,
 	}
 
 	f2fs_unlock_op(sbi);
+
+	if (IS_DIRSYNC(old_dir) || IS_DIRSYNC(new_dir))
+		f2fs_sync_fs(sbi->sb, 1);
 	return 0;
 
 put_out_dir:
@@ -600,6 +621,9 @@ static int f2fs_cross_rename(struct inode *old_dir, struct dentry *old_dentry,
 	update_inode_page(new_dir);
 
 	f2fs_unlock_op(sbi);
+
+	if (IS_DIRSYNC(old_dir) || IS_DIRSYNC(new_dir))
+		f2fs_sync_fs(sbi->sb, 1);
 	return 0;
 out_undo:
 	/* Still we may fail to recover name info of f2fs_inode here */
-- 
2.1.1

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

* Re: [PATCH v2] f2fs: implement -o dirsync
  2014-11-10 14:49   ` [f2fs-dev] [PATCH v2] " Jaegeuk Kim
@ 2014-11-14  9:49     ` Paolo Minazzi
  0 siblings, 0 replies; 5+ messages in thread
From: Paolo Minazzi @ 2014-11-14  9:49 UTC (permalink / raw)
  To: linux-f2fs-devel

I tried the patches (fastboot and dirsync) with user mode linux (3.0.101).
It seems works.

Only 2 points :
1) The -o fastboot seems necessary to avoid the recovery at mount.
     I agree.

2)  If I use
         mount -o sync ...
     IS_DIRSYNC(...) is always true! It seems that I do not need -o 
dirsync (-o sync seems enough).
     Do you agree ?

So, finally, it seems to me that if I use
     mount -o sync,fastboot
I mount in synced mode, that is good gor power cut-off.

Now I will investigate stressing my ARM system with power cut-off.
Thanks,
Paolo


Il 10/11/2014 15:49, Jaegeuk Kim ha scritto:
> Change log from v1:
>   o call sync after mark_inode_dirty
>
> If a mount option has dirsync, we should call checkpoint for all the directory
> operations.
>
> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
> ---
>   fs/f2fs/namei.c | 24 ++++++++++++++++++++++++
>   1 file changed, 24 insertions(+)
>
> diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c
> index 6312dd2..2bee559 100644
> --- a/fs/f2fs/namei.c
> +++ b/fs/f2fs/namei.c
> @@ -138,6 +138,9 @@ static int f2fs_create(struct inode *dir, struct dentry *dentry, umode_t mode,
>   	stat_inc_inline_inode(inode);
>   	d_instantiate(dentry, inode);
>   	unlock_new_inode(inode);
> +
> +	if (IS_DIRSYNC(dir))
> +		f2fs_sync_fs(sbi->sb, 1);
>   	return 0;
>   out:
>   	handle_failed_inode(inode);
> @@ -164,6 +167,9 @@ static int f2fs_link(struct dentry *old_dentry, struct inode *dir,
>   	f2fs_unlock_op(sbi);
>   
>   	d_instantiate(dentry, inode);
> +
> +	if (IS_DIRSYNC(dir))
> +		f2fs_sync_fs(sbi->sb, 1);
>   	return 0;
>   out:
>   	clear_inode_flag(F2FS_I(inode), FI_INC_LINK);
> @@ -235,6 +241,9 @@ static int f2fs_unlink(struct inode *dir, struct dentry *dentry)
>   
>   	/* In order to evict this inode, we set it dirty */
>   	mark_inode_dirty(inode);
> +
> +	if (IS_DIRSYNC(dir))
> +		f2fs_sync_fs(sbi->sb, 1);
>   fail:
>   	trace_f2fs_unlink_exit(inode, err);
>   	return err;
> @@ -268,6 +277,9 @@ static int f2fs_symlink(struct inode *dir, struct dentry *dentry,
>   
>   	d_instantiate(dentry, inode);
>   	unlock_new_inode(inode);
> +
> +	if (IS_DIRSYNC(dir))
> +		f2fs_sync_fs(sbi->sb, 1);
>   	return err;
>   out:
>   	handle_failed_inode(inode);
> @@ -304,6 +316,8 @@ static int f2fs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
>   	d_instantiate(dentry, inode);
>   	unlock_new_inode(inode);
>   
> +	if (IS_DIRSYNC(dir))
> +		f2fs_sync_fs(sbi->sb, 1);
>   	return 0;
>   
>   out_fail:
> @@ -346,8 +360,12 @@ static int f2fs_mknod(struct inode *dir, struct dentry *dentry,
>   	f2fs_unlock_op(sbi);
>   
>   	alloc_nid_done(sbi, inode->i_ino);
> +
>   	d_instantiate(dentry, inode);
>   	unlock_new_inode(inode);
> +
> +	if (IS_DIRSYNC(dir))
> +		f2fs_sync_fs(sbi->sb, 1);
>   	return 0;
>   out:
>   	handle_failed_inode(inode);
> @@ -461,6 +479,9 @@ static int f2fs_rename(struct inode *old_dir, struct dentry *old_dentry,
>   	}
>   
>   	f2fs_unlock_op(sbi);
> +
> +	if (IS_DIRSYNC(old_dir) || IS_DIRSYNC(new_dir))
> +		f2fs_sync_fs(sbi->sb, 1);
>   	return 0;
>   
>   put_out_dir:
> @@ -600,6 +621,9 @@ static int f2fs_cross_rename(struct inode *old_dir, struct dentry *old_dentry,
>   	update_inode_page(new_dir);
>   
>   	f2fs_unlock_op(sbi);
> +
> +	if (IS_DIRSYNC(old_dir) || IS_DIRSYNC(new_dir))
> +		f2fs_sync_fs(sbi->sb, 1);
>   	return 0;
>   out_undo:
>   	/* Still we may fail to recover name info of f2fs_inode here */


------------------------------------------------------------------------------
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://pubads.g.doubleclick.net/gampad/clk?id=154624111&iu=/4140/ostg.clktrk

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

end of thread, other threads:[~2014-11-14  9:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-10  6:24 [PATCH] f2fs: implement -o dirsync Jaegeuk Kim
2014-11-10  7:47 ` Changman Lee
2014-11-10  9:19   ` Paolo Minazzi
2014-11-10 14:49   ` [f2fs-dev] [PATCH v2] " Jaegeuk Kim
2014-11-14  9:49     ` Paolo Minazzi

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