Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 377659
b: refs/heads/master
c: 74d0b91
h: refs/heads/master
i:
  377657: 41040c8
  377655: 247449c
v: v3
  • Loading branch information
Jaegeuk Kim committed May 28, 2013
1 parent c540b90 commit af95697
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 8c26d7d5717adf7f06d98c4416852d09566edd7c
refs/heads/master: 74d0b917ef7789097e12d60fc054efa427ce9171
23 changes: 23 additions & 0 deletions trunk/fs/f2fs/checkpoint.c
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,29 @@ void remove_dirty_dir_inode(struct inode *inode)
}
out:
spin_unlock(&sbi->dir_inode_lock);

/* Only from the recovery routine */
if (is_inode_flag_set(F2FS_I(inode), FI_DELAY_IPUT))
iput(inode);
}

struct inode *check_dirty_dir_inode(struct f2fs_sb_info *sbi, nid_t ino)
{
struct list_head *head = &sbi->dir_inode_list;
struct list_head *this;
struct inode *inode = NULL;

spin_lock(&sbi->dir_inode_lock);
list_for_each(this, head) {
struct dir_inode_entry *entry;
entry = list_entry(this, struct dir_inode_entry, list);
if (entry->inode->i_ino == ino) {
inode = entry->inode;
break;
}
}
spin_unlock(&sbi->dir_inode_lock);
return inode;
}

void sync_dirty_dir_inodes(struct f2fs_sb_info *sbi)
Expand Down
2 changes: 2 additions & 0 deletions trunk/fs/f2fs/f2fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -846,6 +846,7 @@ enum {
FI_INC_LINK, /* need to increment i_nlink */
FI_ACL_MODE, /* indicate acl mode */
FI_NO_ALLOC, /* should not allocate any blocks */
FI_DELAY_IPUT, /* used for the recovery */
};

static inline void set_inode_flag(struct f2fs_inode_info *fi, int flag)
Expand Down Expand Up @@ -1012,6 +1013,7 @@ int recover_orphan_inodes(struct f2fs_sb_info *);
int get_valid_checkpoint(struct f2fs_sb_info *);
void set_dirty_dir_page(struct inode *, struct page *);
void remove_dirty_dir_inode(struct inode *);
struct inode *check_dirty_dir_inode(struct f2fs_sb_info *, nid_t);
void sync_dirty_dir_inodes(struct f2fs_sb_info *);
void write_checkpoint(struct f2fs_sb_info *, bool);
void init_orphan_info(struct f2fs_sb_info *);
Expand Down
14 changes: 9 additions & 5 deletions trunk/fs/f2fs/recovery.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ static int recover_dentry(struct page *ipage, struct inode *inode)
{
struct f2fs_node *raw_node = (struct f2fs_node *)kmap(ipage);
struct f2fs_inode *raw_inode = &(raw_node->i);
nid_t pino = le32_to_cpu(raw_inode->i_pino);
struct qstr name;
struct f2fs_dir_entry *de;
struct page *page;
Expand All @@ -51,10 +52,14 @@ static int recover_dentry(struct page *ipage, struct inode *inode)
if (!is_dent_dnode(ipage))
goto out;

dir = f2fs_iget(inode->i_sb, le32_to_cpu(raw_inode->i_pino));
if (IS_ERR(dir)) {
err = PTR_ERR(dir);
goto out;
dir = check_dirty_dir_inode(F2FS_SB(inode->i_sb), pino);
if (!dir) {
dir = f2fs_iget(inode->i_sb, pino);
if (IS_ERR(dir)) {
err = PTR_ERR(dir);
goto out;
}
set_inode_flag(F2FS_I(dir), FI_DELAY_IPUT);
}

name.len = le32_to_cpu(raw_inode->i_namelen);
Expand All @@ -67,7 +72,6 @@ static int recover_dentry(struct page *ipage, struct inode *inode)
} else {
err = __f2fs_add_link(dir, &name, inode);
}
iput(dir);
out:
kunmap(ipage);
return err;
Expand Down

0 comments on commit af95697

Please sign in to comment.