aboutsummaryrefslogtreecommitdiffstats
path: root/fs/f2fs
diff options
context:
space:
mode:
authorJaegeuk Kim <jaegeuk@kernel.org>2014-11-10 01:15:31 -0500
committerJaegeuk Kim <jaegeuk@kernel.org>2014-11-10 09:51:39 -0500
commitb7e1d800031c827a80c9a9d03cf15e4dd5405a44 (patch)
treed83d7218682af55c6867334b069161a1ed6f8aca /fs/f2fs
parent510184c89f21f40634e1585790714be060cd49c5 (diff)
f2fs: implement -o dirsync
If a mount option has dirsync, we should call checkpoint for all the directory operations. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs')
-rw-r--r--fs/f2fs/namei.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c
index 6312dd2e53f7..2bee559a690f 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,
138 stat_inc_inline_inode(inode); 138 stat_inc_inline_inode(inode);
139 d_instantiate(dentry, inode); 139 d_instantiate(dentry, inode);
140 unlock_new_inode(inode); 140 unlock_new_inode(inode);
141
142 if (IS_DIRSYNC(dir))
143 f2fs_sync_fs(sbi->sb, 1);
141 return 0; 144 return 0;
142out: 145out:
143 handle_failed_inode(inode); 146 handle_failed_inode(inode);
@@ -164,6 +167,9 @@ static int f2fs_link(struct dentry *old_dentry, struct inode *dir,
164 f2fs_unlock_op(sbi); 167 f2fs_unlock_op(sbi);
165 168
166 d_instantiate(dentry, inode); 169 d_instantiate(dentry, inode);
170
171 if (IS_DIRSYNC(dir))
172 f2fs_sync_fs(sbi->sb, 1);
167 return 0; 173 return 0;
168out: 174out:
169 clear_inode_flag(F2FS_I(inode), FI_INC_LINK); 175 clear_inode_flag(F2FS_I(inode), FI_INC_LINK);
@@ -235,6 +241,9 @@ static int f2fs_unlink(struct inode *dir, struct dentry *dentry)
235 241
236 /* In order to evict this inode, we set it dirty */ 242 /* In order to evict this inode, we set it dirty */
237 mark_inode_dirty(inode); 243 mark_inode_dirty(inode);
244
245 if (IS_DIRSYNC(dir))
246 f2fs_sync_fs(sbi->sb, 1);
238fail: 247fail:
239 trace_f2fs_unlink_exit(inode, err); 248 trace_f2fs_unlink_exit(inode, err);
240 return err; 249 return err;
@@ -268,6 +277,9 @@ static int f2fs_symlink(struct inode *dir, struct dentry *dentry,
268 277
269 d_instantiate(dentry, inode); 278 d_instantiate(dentry, inode);
270 unlock_new_inode(inode); 279 unlock_new_inode(inode);
280
281 if (IS_DIRSYNC(dir))
282 f2fs_sync_fs(sbi->sb, 1);
271 return err; 283 return err;
272out: 284out:
273 handle_failed_inode(inode); 285 handle_failed_inode(inode);
@@ -304,6 +316,8 @@ static int f2fs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
304 d_instantiate(dentry, inode); 316 d_instantiate(dentry, inode);
305 unlock_new_inode(inode); 317 unlock_new_inode(inode);
306 318
319 if (IS_DIRSYNC(dir))
320 f2fs_sync_fs(sbi->sb, 1);
307 return 0; 321 return 0;
308 322
309out_fail: 323out_fail:
@@ -346,8 +360,12 @@ static int f2fs_mknod(struct inode *dir, struct dentry *dentry,
346 f2fs_unlock_op(sbi); 360 f2fs_unlock_op(sbi);
347 361
348 alloc_nid_done(sbi, inode->i_ino); 362 alloc_nid_done(sbi, inode->i_ino);
363
349 d_instantiate(dentry, inode); 364 d_instantiate(dentry, inode);
350 unlock_new_inode(inode); 365 unlock_new_inode(inode);
366
367 if (IS_DIRSYNC(dir))
368 f2fs_sync_fs(sbi->sb, 1);
351 return 0; 369 return 0;
352out: 370out:
353 handle_failed_inode(inode); 371 handle_failed_inode(inode);
@@ -461,6 +479,9 @@ static int f2fs_rename(struct inode *old_dir, struct dentry *old_dentry,
461 } 479 }
462 480
463 f2fs_unlock_op(sbi); 481 f2fs_unlock_op(sbi);
482
483 if (IS_DIRSYNC(old_dir) || IS_DIRSYNC(new_dir))
484 f2fs_sync_fs(sbi->sb, 1);
464 return 0; 485 return 0;
465 486
466put_out_dir: 487put_out_dir:
@@ -600,6 +621,9 @@ static int f2fs_cross_rename(struct inode *old_dir, struct dentry *old_dentry,
600 update_inode_page(new_dir); 621 update_inode_page(new_dir);
601 622
602 f2fs_unlock_op(sbi); 623 f2fs_unlock_op(sbi);
624
625 if (IS_DIRSYNC(old_dir) || IS_DIRSYNC(new_dir))
626 f2fs_sync_fs(sbi->sb, 1);
603 return 0; 627 return 0;
604out_undo: 628out_undo:
605 /* Still we may fail to recover name info of f2fs_inode here */ 629 /* Still we may fail to recover name info of f2fs_inode here */