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>
This commit is contained in:
Родитель
510184c89f
Коммит
b7e1d80003
|
@ -138,6 +138,9 @@ static int f2fs_create(struct inode *dir, struct dentry *dentry, umode_t mode,
|
||||||
stat_inc_inline_inode(inode);
|
stat_inc_inline_inode(inode);
|
||||||
d_instantiate(dentry, inode);
|
d_instantiate(dentry, inode);
|
||||||
unlock_new_inode(inode);
|
unlock_new_inode(inode);
|
||||||
|
|
||||||
|
if (IS_DIRSYNC(dir))
|
||||||
|
f2fs_sync_fs(sbi->sb, 1);
|
||||||
return 0;
|
return 0;
|
||||||
out:
|
out:
|
||||||
handle_failed_inode(inode);
|
handle_failed_inode(inode);
|
||||||
|
@ -164,6 +167,9 @@ static int f2fs_link(struct dentry *old_dentry, struct inode *dir,
|
||||||
f2fs_unlock_op(sbi);
|
f2fs_unlock_op(sbi);
|
||||||
|
|
||||||
d_instantiate(dentry, inode);
|
d_instantiate(dentry, inode);
|
||||||
|
|
||||||
|
if (IS_DIRSYNC(dir))
|
||||||
|
f2fs_sync_fs(sbi->sb, 1);
|
||||||
return 0;
|
return 0;
|
||||||
out:
|
out:
|
||||||
clear_inode_flag(F2FS_I(inode), FI_INC_LINK);
|
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 */
|
/* In order to evict this inode, we set it dirty */
|
||||||
mark_inode_dirty(inode);
|
mark_inode_dirty(inode);
|
||||||
|
|
||||||
|
if (IS_DIRSYNC(dir))
|
||||||
|
f2fs_sync_fs(sbi->sb, 1);
|
||||||
fail:
|
fail:
|
||||||
trace_f2fs_unlink_exit(inode, err);
|
trace_f2fs_unlink_exit(inode, err);
|
||||||
return err;
|
return err;
|
||||||
|
@ -268,6 +277,9 @@ static int f2fs_symlink(struct inode *dir, struct dentry *dentry,
|
||||||
|
|
||||||
d_instantiate(dentry, inode);
|
d_instantiate(dentry, inode);
|
||||||
unlock_new_inode(inode);
|
unlock_new_inode(inode);
|
||||||
|
|
||||||
|
if (IS_DIRSYNC(dir))
|
||||||
|
f2fs_sync_fs(sbi->sb, 1);
|
||||||
return err;
|
return err;
|
||||||
out:
|
out:
|
||||||
handle_failed_inode(inode);
|
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);
|
d_instantiate(dentry, inode);
|
||||||
unlock_new_inode(inode);
|
unlock_new_inode(inode);
|
||||||
|
|
||||||
|
if (IS_DIRSYNC(dir))
|
||||||
|
f2fs_sync_fs(sbi->sb, 1);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
out_fail:
|
out_fail:
|
||||||
|
@ -346,8 +360,12 @@ static int f2fs_mknod(struct inode *dir, struct dentry *dentry,
|
||||||
f2fs_unlock_op(sbi);
|
f2fs_unlock_op(sbi);
|
||||||
|
|
||||||
alloc_nid_done(sbi, inode->i_ino);
|
alloc_nid_done(sbi, inode->i_ino);
|
||||||
|
|
||||||
d_instantiate(dentry, inode);
|
d_instantiate(dentry, inode);
|
||||||
unlock_new_inode(inode);
|
unlock_new_inode(inode);
|
||||||
|
|
||||||
|
if (IS_DIRSYNC(dir))
|
||||||
|
f2fs_sync_fs(sbi->sb, 1);
|
||||||
return 0;
|
return 0;
|
||||||
out:
|
out:
|
||||||
handle_failed_inode(inode);
|
handle_failed_inode(inode);
|
||||||
|
@ -461,6 +479,9 @@ static int f2fs_rename(struct inode *old_dir, struct dentry *old_dentry,
|
||||||
}
|
}
|
||||||
|
|
||||||
f2fs_unlock_op(sbi);
|
f2fs_unlock_op(sbi);
|
||||||
|
|
||||||
|
if (IS_DIRSYNC(old_dir) || IS_DIRSYNC(new_dir))
|
||||||
|
f2fs_sync_fs(sbi->sb, 1);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
put_out_dir:
|
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);
|
update_inode_page(new_dir);
|
||||||
|
|
||||||
f2fs_unlock_op(sbi);
|
f2fs_unlock_op(sbi);
|
||||||
|
|
||||||
|
if (IS_DIRSYNC(old_dir) || IS_DIRSYNC(new_dir))
|
||||||
|
f2fs_sync_fs(sbi->sb, 1);
|
||||||
return 0;
|
return 0;
|
||||||
out_undo:
|
out_undo:
|
||||||
/* Still we may fail to recover name info of f2fs_inode here */
|
/* Still we may fail to recover name info of f2fs_inode here */
|
||||||
|
|
Загрузка…
Ссылка в новой задаче