Commit 1c35a90e8ab57cd34b8e806b9c75ba05b3b5c7a3

Authored by Jaegeuk Kim
1 parent e3b4d43f7c

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>

Showing 3 changed files with 11 additions and 13 deletions Side-by-side Diff

... ... @@ -1205,7 +1205,7 @@
1205 1205 void recover_node_page(struct f2fs_sb_info *, struct page *,
1206 1206 struct f2fs_summary *, struct node_info *, block_t);
1207 1207 void recover_inline_xattr(struct inode *, struct page *);
1208   -bool recover_xattr_data(struct inode *, struct page *, block_t);
  1208 +void recover_xattr_data(struct inode *, struct page *, block_t);
1209 1209 int recover_inode_page(struct f2fs_sb_info *, struct page *);
1210 1210 int restore_node_summary(struct f2fs_sb_info *, unsigned int,
1211 1211 struct f2fs_summary_block *);
... ... @@ -1557,9 +1557,6 @@
1557 1557 struct page *ipage;
1558 1558 struct f2fs_inode *ri;
1559 1559  
1560   - if (!IS_INODE(page))
1561   - return;
1562   -
1563 1560 ipage = get_node_page(sbi, inode->i_ino);
1564 1561 f2fs_bug_on(IS_ERR(ipage));
1565 1562  
1566 1563  
... ... @@ -1580,16 +1577,13 @@
1580 1577 f2fs_put_page(ipage, 1);
1581 1578 }
1582 1579  
1583   -bool recover_xattr_data(struct inode *inode, struct page *page, block_t blkaddr)
  1580 +void recover_xattr_data(struct inode *inode, struct page *page, block_t blkaddr)
1584 1581 {
1585 1582 struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb);
1586 1583 nid_t prev_xnid = F2FS_I(inode)->i_xattr_nid;
1587 1584 nid_t new_xnid = nid_of_node(page);
1588 1585 struct node_info ni;
1589 1586  
1590   - if (!f2fs_has_xattr_block(ofs_of_node(page)))
1591   - return false;
1592   -
1593 1587 /* 1: invalidate the previous xattr nid */
1594 1588 if (!prev_xnid)
1595 1589 goto recover_xnid;
... ... @@ -1617,7 +1611,6 @@
1617 1611 set_node_addr(sbi, &ni, blkaddr, false);
1618 1612  
1619 1613 update_inode_page(inode);
1620   - return true;
1621 1614 }
1622 1615  
1623 1616 int recover_inode_page(struct f2fs_sb_info *sbi, struct page *page)
... ... @@ -302,14 +302,19 @@
302 302 struct node_info ni;
303 303 int err = 0, recovered = 0;
304 304  
305   - recover_inline_xattr(inode, page);
  305 + /* step 1: recover xattr */
  306 + if (IS_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);
  310 + goto out;
  311 + }
306 312  
  313 + /* step 2: recover inline data */
307 314 if (recover_inline_data(inode, page))
308 315 goto out;
309 316  
310   - if (recover_xattr_data(inode, page, blkaddr))
311   - goto out;
312   -
  317 + /* step 3: recover data indices */
313 318 start = start_bidx_of_node(ofs_of_node(page), fi);
314 319 end = start + ADDRS_PER_PAGE(page, fi);
315 320