aboutsummaryrefslogtreecommitdiffstats
path: root/fs/f2fs
diff options
context:
space:
mode:
authorJaegeuk Kim <jaegeuk@kernel.org>2014-08-08 02:49:17 -0400
committerJaegeuk Kim <jaegeuk@kernel.org>2014-08-19 13:01:34 -0400
commit1c35a90e8ab57cd34b8e806b9c75ba05b3b5c7a3 (patch)
tree876d33439e04eaf67714f2818650e78024f36279 /fs/f2fs
parente3b4d43f7c233c6fce21fe4b4cb55b6d59afddae (diff)
f2fs: fix to recover inline_xattr/data and blocks
This patch fixes not to skip xattr recovery and inline xattr/data recovery order. Reviewed-by: Chao Yu <chao2.yu@samsung.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs')
-rw-r--r--fs/f2fs/f2fs.h2
-rw-r--r--fs/f2fs/node.c9
-rw-r--r--fs/f2fs/recovery.c13
3 files changed, 11 insertions, 13 deletions
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index 2e4aa3a51b0d..cc5ead1bd378 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -1205,7 +1205,7 @@ void alloc_nid_failed(struct f2fs_sb_info *, nid_t);
1205void recover_node_page(struct f2fs_sb_info *, struct page *, 1205void recover_node_page(struct f2fs_sb_info *, struct page *,
1206 struct f2fs_summary *, struct node_info *, block_t); 1206 struct f2fs_summary *, struct node_info *, block_t);
1207void recover_inline_xattr(struct inode *, struct page *); 1207void recover_inline_xattr(struct inode *, struct page *);
1208bool recover_xattr_data(struct inode *, struct page *, block_t); 1208void recover_xattr_data(struct inode *, struct page *, block_t);
1209int recover_inode_page(struct f2fs_sb_info *, struct page *); 1209int recover_inode_page(struct f2fs_sb_info *, struct page *);
1210int restore_node_summary(struct f2fs_sb_info *, unsigned int, 1210int restore_node_summary(struct f2fs_sb_info *, unsigned int,
1211 struct f2fs_summary_block *); 1211 struct f2fs_summary_block *);
diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
index 151045f3e7b7..c80e3d59314d 100644
--- a/fs/f2fs/node.c
+++ b/fs/f2fs/node.c
@@ -1557,9 +1557,6 @@ void recover_inline_xattr(struct inode *inode, struct page *page)
1557 struct page *ipage; 1557 struct page *ipage;
1558 struct f2fs_inode *ri; 1558 struct f2fs_inode *ri;
1559 1559
1560 if (!IS_INODE(page))
1561 return;
1562
1563 ipage = get_node_page(sbi, inode->i_ino); 1560 ipage = get_node_page(sbi, inode->i_ino);
1564 f2fs_bug_on(IS_ERR(ipage)); 1561 f2fs_bug_on(IS_ERR(ipage));
1565 1562
@@ -1580,16 +1577,13 @@ update_inode:
1580 f2fs_put_page(ipage, 1); 1577 f2fs_put_page(ipage, 1);
1581} 1578}
1582 1579
1583bool recover_xattr_data(struct inode *inode, struct page *page, block_t blkaddr) 1580void recover_xattr_data(struct inode *inode, struct page *page, block_t blkaddr)
1584{ 1581{
1585 struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb); 1582 struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb);
1586 nid_t prev_xnid = F2FS_I(inode)->i_xattr_nid; 1583 nid_t prev_xnid = F2FS_I(inode)->i_xattr_nid;
1587 nid_t new_xnid = nid_of_node(page); 1584 nid_t new_xnid = nid_of_node(page);
1588 struct node_info ni; 1585 struct node_info ni;
1589 1586
1590 if (!f2fs_has_xattr_block(ofs_of_node(page)))
1591 return false;
1592
1593 /* 1: invalidate the previous xattr nid */ 1587 /* 1: invalidate the previous xattr nid */
1594 if (!prev_xnid) 1588 if (!prev_xnid)
1595 goto recover_xnid; 1589 goto recover_xnid;
@@ -1617,7 +1611,6 @@ recover_xnid:
1617 set_node_addr(sbi, &ni, blkaddr, false); 1611 set_node_addr(sbi, &ni, blkaddr, false);
1618 1612
1619 update_inode_page(inode); 1613 update_inode_page(inode);
1620 return true;
1621} 1614}
1622 1615
1623int recover_inode_page(struct f2fs_sb_info *sbi, struct page *page) 1616int recover_inode_page(struct f2fs_sb_info *sbi, struct page *page)
diff --git a/fs/f2fs/recovery.c b/fs/f2fs/recovery.c
index cfb2aa9bfc20..d7b67b86f607 100644
--- a/fs/f2fs/recovery.c
+++ b/fs/f2fs/recovery.c
@@ -302,14 +302,19 @@ static int do_recover_data(struct f2fs_sb_info *sbi, struct inode *inode,
302 struct node_info ni; 302 struct node_info ni;
303 int err = 0, recovered = 0; 303 int err = 0, recovered = 0;
304 304
305 recover_inline_xattr(inode, page); 305 /* step 1: recover xattr */
306 306 if (IS_INODE(page)) {
307 if (recover_inline_data(inode, page)) 307 recover_inline_xattr(inode, page);
308 } else if (f2fs_has_xattr_block(ofs_of_node(page))) {
309 recover_xattr_data(inode, page, blkaddr);
308 goto out; 310 goto out;
311 }
309 312
310 if (recover_xattr_data(inode, page, blkaddr)) 313 /* step 2: recover inline data */
314 if (recover_inline_data(inode, page))
311 goto out; 315 goto out;
312 316
317 /* step 3: recover data indices */
313 start = start_bidx_of_node(ofs_of_node(page), fi); 318 start = start_bidx_of_node(ofs_of_node(page), fi);
314 end = start + ADDRS_PER_PAGE(page, fi); 319 end = start + ADDRS_PER_PAGE(page, fi);
315 320