aboutsummaryrefslogtreecommitdiffstats
path: root/fs/f2fs/recovery.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/f2fs/recovery.c')
-rw-r--r--fs/f2fs/recovery.c24
1 files changed, 10 insertions, 14 deletions
diff --git a/fs/f2fs/recovery.c b/fs/f2fs/recovery.c
index b571fee677d5..b235215ac138 100644
--- a/fs/f2fs/recovery.c
+++ b/fs/f2fs/recovery.c
@@ -42,7 +42,7 @@ static int recover_dentry(struct page *ipage, struct inode *inode)
42{ 42{
43 struct f2fs_node *raw_node = (struct f2fs_node *)kmap(ipage); 43 struct f2fs_node *raw_node = (struct f2fs_node *)kmap(ipage);
44 struct f2fs_inode *raw_inode = &(raw_node->i); 44 struct f2fs_inode *raw_inode = &(raw_node->i);
45 struct dentry dent, parent; 45 struct qstr name;
46 struct f2fs_dir_entry *de; 46 struct f2fs_dir_entry *de;
47 struct page *page; 47 struct page *page;
48 struct inode *dir; 48 struct inode *dir;
@@ -57,17 +57,15 @@ static int recover_dentry(struct page *ipage, struct inode *inode)
57 goto out; 57 goto out;
58 } 58 }
59 59
60 parent.d_inode = dir; 60 name.len = le32_to_cpu(raw_inode->i_namelen);
61 dent.d_parent = &parent; 61 name.name = raw_inode->i_name;
62 dent.d_name.len = le32_to_cpu(raw_inode->i_namelen);
63 dent.d_name.name = raw_inode->i_name;
64 62
65 de = f2fs_find_entry(dir, &dent.d_name, &page); 63 de = f2fs_find_entry(dir, &name, &page);
66 if (de) { 64 if (de) {
67 kunmap(page); 65 kunmap(page);
68 f2fs_put_page(page, 0); 66 f2fs_put_page(page, 0);
69 } else { 67 } else {
70 f2fs_add_link(&dent, inode); 68 err = __f2fs_add_link(dir, &name, inode);
71 } 69 }
72 iput(dir); 70 iput(dir);
73out: 71out:
@@ -151,7 +149,6 @@ static int find_fsync_dnodes(struct f2fs_sb_info *sbi, struct list_head *head)
151 goto out; 149 goto out;
152 } 150 }
153 151
154 INIT_LIST_HEAD(&entry->list);
155 list_add_tail(&entry->list, head); 152 list_add_tail(&entry->list, head);
156 entry->blkaddr = blkaddr; 153 entry->blkaddr = blkaddr;
157 } 154 }
@@ -174,10 +171,9 @@ out:
174static void destroy_fsync_dnodes(struct f2fs_sb_info *sbi, 171static void destroy_fsync_dnodes(struct f2fs_sb_info *sbi,
175 struct list_head *head) 172 struct list_head *head)
176{ 173{
177 struct list_head *this; 174 struct fsync_inode_entry *entry, *tmp;
178 struct fsync_inode_entry *entry; 175
179 list_for_each(this, head) { 176 list_for_each_entry_safe(entry, tmp, head, list) {
180 entry = list_entry(this, struct fsync_inode_entry, list);
181 iput(entry->inode); 177 iput(entry->inode);
182 list_del(&entry->list); 178 list_del(&entry->list);
183 kmem_cache_free(fsync_entry_slab, entry); 179 kmem_cache_free(fsync_entry_slab, entry);
@@ -228,7 +224,7 @@ static void check_index_in_prev_nodes(struct f2fs_sb_info *sbi,
228 f2fs_put_page(node_page, 1); 224 f2fs_put_page(node_page, 1);
229 225
230 /* Deallocate previous index in the node page */ 226 /* Deallocate previous index in the node page */
231 inode = f2fs_iget_nowait(sbi->sb, ino); 227 inode = f2fs_iget(sbi->sb, ino);
232 if (IS_ERR(inode)) 228 if (IS_ERR(inode))
233 return; 229 return;
234 230
@@ -375,5 +371,5 @@ void recover_fsync_data(struct f2fs_sb_info *sbi)
375out: 371out:
376 destroy_fsync_dnodes(sbi, &inode_list); 372 destroy_fsync_dnodes(sbi, &inode_list);
377 kmem_cache_destroy(fsync_entry_slab); 373 kmem_cache_destroy(fsync_entry_slab);
378 write_checkpoint(sbi, false, false); 374 write_checkpoint(sbi, false);
379} 375}