fsck.f2fs: clean up codes with IS_INODE()
PATCH v2 1/1 fsck.f2fs: clean up codes with IS_INODE()
and change return value's type of IS_INODE() from int to bool.
Signed-off-by Chao Yu <[email protected]>
---
v2:
- remove unnecessary le32_to_cpu()
- change return value's type of IS_INODE()
fsck/fsck.c | 7 +++---- fsck/mount.c | 4 ++-- fsck/node.h | 4 ++-- 3 files changed, 7 insertions(+), 8 deletions(-)
fsck/fsck.c +3 -4
@@ -247,7 +247,7 @@ static int is_valid_summary(struct f2fs_sb_info *sbi, struct f2fs_summary *sum, goto out;/* check its block address */ -if (node_blk->footer.nid == node_blk->footer.ino) { +if (IS_INODE (node_blk)) {int ofs =get_extra_isize (node_blk);if (ofs + ofs_in_node >=DEF_ADDRS_PER_INODE )
@@ -447,8 +447,7 @@ static int sanity_check_nid(struct f2fs_sb_info *sbi, u32 nid, nid, ni->ino, le32_to_cpu(node_blk->footer.ino));return -EINVAL ; } -if (ntype !=TYPE_INODE && - node_blk->footer.nid == node_blk->footer.ino) { +if (ntype !=TYPE_INODE &&IS_INODE (node_blk)) {ASSERT_MSG ("nid[0x%x] footer.nid[0x%x] footer.ino[0x%x]" , nid,le32_to_cpu (node_blk->footer.nid),le32_to_cpu (node_blk->footer.ino));
@@ -3080,7 +3079,7 @@ static int fsck_reconnect_file(struct f2fs_sb_info *sbi)ASSERT (err >=0 );/* reconnection will restore these nodes if needed */ -if (node->footer.ino != node->footer.nid) { +if (!IS_INODE (node)) {DBG (1 ,"Not support non-inode node [0x%x]\n" , nid);continue ;
fsck/mount.c +2 -2
@@ -2394,7 +2394,7 @@ void update_data_blkaddr(struct f2fs_sb_info *sbi, nid_t nid,ASSERT (ret >=0 );/* check its block address */ -if (node_blk->footer.nid == node_blk->footer.ino) { +if (IS_INODE (node_blk)) {int ofs =get_extra_isize (node_blk); oldaddr =le32_to_cpu (node_blk->i.i_addr[ofs + ofs_in_node]);
@@ -2409,7 +2409,7 @@ void update_data_blkaddr(struct f2fs_sb_info *sbi, nid_t nid, }/* check extent cache entry */ -if (node_blk->footer.nid != node_blk->footer.ino) { +if (!IS_INODE (node_blk)) {get_node_info (sbi,le32_to_cpu (node_blk->footer.ino), &ni);/* read inode block */
fsck/node.h +2 -2
@@ -18,9 +18,9 @@#include "fsck.h" -static inline int IS_INODE (struct f2fs_node *node) +static inline bool IS_INODE (struct f2fs_node *node) { -return ((node)->footer.nid == (node)->footer.ino); +return node->footer.ino == node->footer.nid; } static inline unsigned int ADDRS_PER_PAGE(struct f2fs_sb_info *sbi,
Signature · 8 lines
2.40.1 _______________________________________________ Linux-f2fs-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel