Commit 67c3758d authored by Jaegeuk Kim's avatar Jaegeuk Kim

f2fs: call update_inode_page for orphan inodes

Let's store orphan inode pages right away.
Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
parent 3e19886e
...@@ -508,10 +508,11 @@ void release_orphan_inode(struct f2fs_sb_info *sbi) ...@@ -508,10 +508,11 @@ void release_orphan_inode(struct f2fs_sb_info *sbi)
spin_unlock(&im->ino_lock); spin_unlock(&im->ino_lock);
} }
void add_orphan_inode(struct f2fs_sb_info *sbi, nid_t ino) void add_orphan_inode(struct inode *inode)
{ {
/* add new orphan ino entry into list */ /* add new orphan ino entry into list */
__add_ino_entry(sbi, ino, ORPHAN_INO); __add_ino_entry(F2FS_I_SB(inode), inode->i_ino, ORPHAN_INO);
update_inode_page(inode);
} }
void remove_orphan_inode(struct f2fs_sb_info *sbi, nid_t ino) void remove_orphan_inode(struct f2fs_sb_info *sbi, nid_t ino)
...@@ -535,7 +536,6 @@ static int recover_orphan_inode(struct f2fs_sb_info *sbi, nid_t ino) ...@@ -535,7 +536,6 @@ static int recover_orphan_inode(struct f2fs_sb_info *sbi, nid_t ino)
} }
clear_nlink(inode); clear_nlink(inode);
mark_inode_dirty_sync(inode);
/* truncate all the data during iput */ /* truncate all the data during iput */
iput(inode); iput(inode);
......
...@@ -666,7 +666,7 @@ void f2fs_drop_nlink(struct inode *dir, struct inode *inode) ...@@ -666,7 +666,7 @@ void f2fs_drop_nlink(struct inode *dir, struct inode *inode)
up_write(&F2FS_I(inode)->i_sem); up_write(&F2FS_I(inode)->i_sem);
if (inode->i_nlink == 0) if (inode->i_nlink == 0)
add_orphan_inode(sbi, inode->i_ino); add_orphan_inode(inode);
else else
release_orphan_inode(sbi); release_orphan_inode(sbi);
} }
......
...@@ -2040,7 +2040,7 @@ bool exist_written_data(struct f2fs_sb_info *, nid_t, int); ...@@ -2040,7 +2040,7 @@ bool exist_written_data(struct f2fs_sb_info *, nid_t, int);
int f2fs_sync_inode_meta(struct f2fs_sb_info *); int f2fs_sync_inode_meta(struct f2fs_sb_info *);
int acquire_orphan_inode(struct f2fs_sb_info *); int acquire_orphan_inode(struct f2fs_sb_info *);
void release_orphan_inode(struct f2fs_sb_info *); void release_orphan_inode(struct f2fs_sb_info *);
void add_orphan_inode(struct f2fs_sb_info *, nid_t); void add_orphan_inode(struct inode *);
void remove_orphan_inode(struct f2fs_sb_info *, nid_t); void remove_orphan_inode(struct f2fs_sb_info *, nid_t);
int recover_orphan_inodes(struct f2fs_sb_info *); int recover_orphan_inodes(struct f2fs_sb_info *);
int get_valid_checkpoint(struct f2fs_sb_info *); int get_valid_checkpoint(struct f2fs_sb_info *);
......
...@@ -393,8 +393,6 @@ void f2fs_evict_inode(struct inode *inode) ...@@ -393,8 +393,6 @@ void f2fs_evict_inode(struct inode *inode)
!exist_written_data(sbi, inode->i_ino, ORPHAN_INO)); !exist_written_data(sbi, inode->i_ino, ORPHAN_INO));
out_clear: out_clear:
fscrypt_put_encryption_info(inode, NULL); fscrypt_put_encryption_info(inode, NULL);
f2fs_bug_on(sbi, is_inode_flag_set(inode, FI_DIRTY_INODE));
clear_inode(inode); clear_inode(inode);
} }
...@@ -421,7 +419,7 @@ void handle_failed_inode(struct inode *inode) ...@@ -421,7 +419,7 @@ void handle_failed_inode(struct inode *inode)
f2fs_msg(sbi->sb, KERN_WARNING, f2fs_msg(sbi->sb, KERN_WARNING,
"Too many orphan inodes, run fsck to fix."); "Too many orphan inodes, run fsck to fix.");
} else { } else {
add_orphan_inode(sbi, inode->i_ino); add_orphan_inode(inode);
} }
alloc_nid_done(sbi, inode->i_ino); alloc_nid_done(sbi, inode->i_ino);
} else { } else {
......
...@@ -598,7 +598,7 @@ static int __f2fs_tmpfile(struct inode *dir, struct dentry *dentry, ...@@ -598,7 +598,7 @@ static int __f2fs_tmpfile(struct inode *dir, struct dentry *dentry,
* add this non-linked tmpfile to orphan list, in this way we could * add this non-linked tmpfile to orphan list, in this way we could
* remove all unused data of tmpfile after abnormal power-off. * remove all unused data of tmpfile after abnormal power-off.
*/ */
add_orphan_inode(sbi, inode->i_ino); add_orphan_inode(inode);
alloc_nid_done(sbi, inode->i_ino); alloc_nid_done(sbi, inode->i_ino);
if (whiteout) { if (whiteout) {
...@@ -712,7 +712,7 @@ static int f2fs_rename(struct inode *old_dir, struct dentry *old_dentry, ...@@ -712,7 +712,7 @@ static int f2fs_rename(struct inode *old_dir, struct dentry *old_dentry,
up_write(&F2FS_I(new_inode)->i_sem); up_write(&F2FS_I(new_inode)->i_sem);
if (!new_inode->i_nlink) if (!new_inode->i_nlink)
add_orphan_inode(sbi, new_inode->i_ino); add_orphan_inode(new_inode);
else else
release_orphan_inode(sbi); release_orphan_inode(sbi);
} else { } else {
......
...@@ -585,8 +585,6 @@ static struct inode *f2fs_alloc_inode(struct super_block *sb) ...@@ -585,8 +585,6 @@ static struct inode *f2fs_alloc_inode(struct super_block *sb)
static int f2fs_drop_inode(struct inode *inode) static int f2fs_drop_inode(struct inode *inode)
{ {
int ret;
/* /*
* This is to avoid a deadlock condition like below. * This is to avoid a deadlock condition like below.
* writeback_single_inode(inode) * writeback_single_inode(inode)
...@@ -622,19 +620,7 @@ static int f2fs_drop_inode(struct inode *inode) ...@@ -622,19 +620,7 @@ static int f2fs_drop_inode(struct inode *inode)
return 0; return 0;
} }
ret = generic_drop_inode(inode); return generic_drop_inode(inode);
if (is_inode_flag_set(inode, FI_DIRTY_INODE)) {
if (ret)
inode->i_state |= I_WILL_FREE;
spin_unlock(&inode->i_lock);
update_inode_page(inode);
spin_lock(&inode->i_lock);
if (ret)
inode->i_state &= ~I_WILL_FREE;
}
return ret;
} }
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment