From mboxrd@z Thu Jan 1 00:00:00 1970 From: Changman Lee Subject: Re: [PATCH] f2fs: implement -o dirsync Date: Mon, 10 Nov 2014 16:47:12 +0900 Message-ID: <20141110074712.GD14659@lcm> References: <1415600662-23337-1-git-send-email-jaegeuk@kernel.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from sog-mx-2.v43.ch3.sourceforge.com ([172.29.43.192] helo=mx.sourceforge.net) by sfs-ml-2.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1XnjiH-0004Z5-2e for linux-f2fs-devel@lists.sourceforge.net; Mon, 10 Nov 2014 07:48:37 +0000 Received: from mailout4.samsung.com ([203.254.224.34]) by sog-mx-2.v43.ch3.sourceforge.com with esmtps (TLSv1:RC4-MD5:128) (Exim 4.76) id 1XnjiE-0007am-WC for linux-f2fs-devel@lists.sourceforge.net; Mon, 10 Nov 2014 07:48:37 +0000 Received: from epcpsbgr3.samsung.com (u143.gpu120.samsung.co.kr [203.254.230.143]) by mailout4.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0NET00KIFCCRRK70@mailout4.samsung.com> for linux-f2fs-devel@lists.sourceforge.net; Mon, 10 Nov 2014 16:48:27 +0900 (KST) Content-disposition: inline In-reply-to: <1415600662-23337-1-git-send-email-jaegeuk@kernel.org> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net To: Jaegeuk Kim Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net 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 > --- > 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 ------------------------------------------------------------------------------