[PATCH] f2fs: drop recover_xattr_data

From: Chao Yu
Date: Mon Jan 12 2015 - 04:25:44 EST


Because xattr node will be written to cold node segment, so in current procedure
it's wrong that we try to find and recover it from warm node chain in
recover_xattr_data.

Let's drop this related function and invoking.

Signed-off-by: Chao Yu <chao2.yu@xxxxxxxxxxx>
---
fs/f2fs/f2fs.h | 1 -
fs/f2fs/node.c | 36 ------------------------------------
fs/f2fs/recovery.c | 8 ++------
3 files changed, 2 insertions(+), 43 deletions(-)

diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index 209532c..3b18072 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -1392,7 +1392,6 @@ bool alloc_nid(struct f2fs_sb_info *, nid_t *);
void alloc_nid_done(struct f2fs_sb_info *, nid_t);
void alloc_nid_failed(struct f2fs_sb_info *, nid_t);
void recover_inline_xattr(struct inode *, struct page *);
-void recover_xattr_data(struct inode *, struct page *, block_t);
int recover_inode_page(struct f2fs_sb_info *, struct page *);
int restore_node_summary(struct f2fs_sb_info *, unsigned int,
struct f2fs_summary_block *);
diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
index d7c1436..75aa233 100644
--- a/fs/f2fs/node.c
+++ b/fs/f2fs/node.c
@@ -1656,42 +1656,6 @@ update_inode:
f2fs_put_page(ipage, 1);
}

-void recover_xattr_data(struct inode *inode, struct page *page, block_t blkaddr)
-{
- struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
- nid_t prev_xnid = F2FS_I(inode)->i_xattr_nid;
- nid_t new_xnid = nid_of_node(page);
- struct node_info ni;
-
- /* 1: invalidate the previous xattr nid */
- if (!prev_xnid)
- goto recover_xnid;
-
- /* Deallocate node address */
- get_node_info(sbi, prev_xnid, &ni);
- f2fs_bug_on(sbi, ni.blk_addr == NULL_ADDR);
- invalidate_blocks(sbi, ni.blk_addr);
- dec_valid_node_count(sbi, inode);
- set_node_addr(sbi, &ni, NULL_ADDR, false);
-
-recover_xnid:
- /* 2: allocate new xattr nid */
- if (unlikely(!inc_valid_node_count(sbi, inode)))
- f2fs_bug_on(sbi, 1);
-
- remove_free_nid(NM_I(sbi), new_xnid);
- get_node_info(sbi, new_xnid, &ni);
- ni.ino = inode->i_ino;
- set_node_addr(sbi, &ni, NEW_ADDR, false);
- F2FS_I(inode)->i_xattr_nid = new_xnid;
-
- /* 3: update xattr blkaddr */
- refresh_sit_entry(sbi, NEW_ADDR, blkaddr);
- set_node_addr(sbi, &ni, blkaddr, false);
-
- update_inode_page(inode);
-}
-
int recover_inode_page(struct f2fs_sb_info *sbi, struct page *page)
{
struct f2fs_inode *src, *dst;
diff --git a/fs/f2fs/recovery.c b/fs/f2fs/recovery.c
index c4211a5..f70c2e7 100644
--- a/fs/f2fs/recovery.c
+++ b/fs/f2fs/recovery.c
@@ -342,13 +342,9 @@ static int do_recover_data(struct f2fs_sb_info *sbi, struct inode *inode,
struct node_info ni;
int err = 0, recovered = 0;

- /* step 1: recover xattr */
- if (IS_INODE(page)) {
+ /* step 1: recover inline xattr */
+ if (IS_INODE(page))
recover_inline_xattr(inode, page);
- } else if (f2fs_has_xattr_block(ofs_of_node(page))) {
- recover_xattr_data(inode, page, blkaddr);
- goto out;
- }

/* step 2: recover inline data */
if (recover_inline_data(inode, page))
--
2.2.1


>
> Thanks,
>
> >
> > Thanks,
> > Yu

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/