f2fs: introduce f2fs_i_links_write with mark_inode_dirty_sync
This patch introduces f2fs_i_links_write() to call mark_inode_dirty_sync() when
changing inode->i_links.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
diff --git a/fs/f2fs/dir.c b/fs/f2fs/dir.c
index dc4beae..f8ca0f3 100644
--- a/fs/f2fs/dir.c
+++ b/fs/f2fs/dir.c
@@ -437,7 +437,7 @@
*/
if (inode->i_nlink == 0)
remove_orphan_inode(F2FS_I_SB(dir), inode->i_ino);
- inc_nlink(inode);
+ f2fs_i_links_write(inode, true);
}
return page;
@@ -456,7 +456,7 @@
{
if (inode && is_inode_flag_set(inode, FI_NEW_INODE)) {
if (S_ISDIR(inode->i_mode)) {
- inc_nlink(dir);
+ f2fs_i_links_write(dir, true);
set_inode_flag(dir, FI_UPDATE_DIR);
}
clear_inode_flag(inode, FI_NEW_INODE);
@@ -675,7 +675,7 @@
down_write(&F2FS_I(inode)->i_sem);
if (S_ISDIR(inode->i_mode)) {
- drop_nlink(dir);
+ f2fs_i_links_write(dir, false);
if (page)
update_inode(dir, page);
else
@@ -683,9 +683,9 @@
}
inode->i_ctime = CURRENT_TIME;
- drop_nlink(inode);
+ f2fs_i_links_write(inode, false);
if (S_ISDIR(inode->i_mode)) {
- drop_nlink(inode);
+ f2fs_i_links_write(inode, false);
f2fs_i_size_write(inode, 0);
}
up_write(&F2FS_I(inode)->i_sem);