dump.f2fs: fix a wrong report for dump an {d, id, did}node
PATCH 1/1 dump.f2fs: fix a wrong report for dump an {d, id, did}node
fix a wrong report for dump an {d,id,did}node like this:
[print_node_info: 283] Node ID [0x6820:26656] is direct node or indirect node.
[0] [0x 16b6684 : 23815812] [1] [0x 16b6685 : 23815813] [2] [0x 16b6686 : 23815814] [3] [0x 16b6687 : 23815815] [4] [0x 16b6688 : 23815816] [5] [0x 16b6689 : 23815817] [6] [0x 16b668a : 23815818] [7] [0x 16b668b : 23815819] [8] [0x 16b668c : 23815820] [9] [0x 16b668d : 23815821] [10] [0x 16b668e : 23815822]
Invalid (i)node block
--- fsck/dump.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-)
fsck/dump.c +16 -9
@@ -475,6 +475,18 @@ dump: } } +static bool is_sit_bitmap_set (struct f2fs_sb_info *sbi,u32 blk_addr) +{ +struct seg_entry *se; +u32 offset; + + se =get_seg_entry (sbi,GET_SEGNO (sbi, blk_addr)); + offset =OFFSET_IN_SEG (sbi, blk_addr); + +return f2fs_test_bit (offset, + (const char *)se->cur_valid_map) !=0 ; +} +void dump_node (struct f2fs_sb_info *sbi,nid_t nid,int force) {struct node_info ni;
@@ -492,13 +504,14 @@ void dump_node(struct f2fs_sb_info *sbi, nid_t nid, int force)if (ni.blk_addr ==0x0 )MSG (force,"Invalid nat entry\n\n" ); +else if (!is_sit_bitmap_set (sbi, ni.blk_addr)) +MSG (force,"Invalid node blk addr\n\n" );DBG (1 ,"node_blk.footer.ino [0x%x]\n" ,le32_to_cpu (node_blk->footer.ino));DBG (1 ,"node_blk.footer.nid [0x%x]\n" ,le32_to_cpu (node_blk->footer.nid));if (le32_to_cpu (node_blk->footer.ino) == ni.ino && -le32_to_cpu (node_blk->footer.nid) == ni.nid && - ni.ino == ni.nid) { +le32_to_cpu (node_blk->footer.nid) == ni.nid) {print_node_info (sbi, node_blk, force);dump_file (sbi, &ni, node_blk, force); }else {
@@ -678,8 +691,6 @@ int dump_info_from_blkaddr(struct f2fs_sb_info *sbi, u32 blk_addr)int type;struct f2fs_summary sum_entry;struct node_info ni, ino_ni; -struct seg_entry *se; -u32 offset;int enc_name;int ret =0 ;
@@ -712,12 +723,8 @@ int dump_info_from_blkaddr(struct f2fs_sb_info *sbi, u32 blk_addr)return ret; } - se =get_seg_entry (sbi,GET_SEGNO (sbi, blk_addr)); - offset =OFFSET_IN_SEG (sbi, blk_addr); - -if (f2fs_test_bit (offset, (const char *)se->cur_valid_map) ==0 ) { +if (!is_sit_bitmap_set (sbi, blk_addr))MSG (0 ,"\nblkaddr is not valid\n" ); - } type =get_sum_entry (sbi, blk_addr, &sum_entry); nid =le32_to_cpu (sum_entry.nid);
Signature · 6 lines
1.9.1 ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Hi, Yunlei,
Quoted 48 lines · Yunlei He
fix a wrong report for dump an {d,id,did}node like this:
[
print_node_info: 283] Node ID [0x6820:26656] is direct node or indirect node.[0] [0x 16b6684 : 23815812] [1] [0x 16b6685 : 23815813] [2] [0x 16b6686 : 23815814] [3] [0x 16b6687 : 23815815] [4] [0x 16b6688 : 23815816] [5] [0x 16b6689 : 23815817] [6] [0x 16b668a : 23815818] [7] [0x 16b668b : 23815819] [8] [0x 16b668c : 23815820] [9] [0x 16b668d : 23815821] [10] [0x 16b668e : 23815822]Invalid (i)node block
Signed-off-by Yunlei He <[email protected]>--- fsck/dump.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-)fsck/dump.c +12
-0@@ -475,6 +475,18 @@ dump: } } +static bool is_sit_bitmap_set (struct f2fs_sb_info *sbi,u32 blk_addr) +{ +struct seg_entry *se; +u32 offset; + + se =get_seg_entry (sbi,GET_SEGNO (sbi, blk_addr)); + offset =OFFSET_IN_SEG (sbi, blk_addr); + +return f2fs_test_bit (offset, + (const char *)se->cur_valid_map) !=0 ; +} +void dump_node (struct f2fs_sb_info *sbi,nid_t nid,int force) {struct node_info ni;@@ -492,13 +504,14 @@ void dump_node(struct f2fs_sb_info *sbi, nid_t nid, int force)if (ni.blk_addr ==0x0 )MSG (force,"Invalid nat entry\n\n" );
fsck/dump.c void dump_node(struct f2fs_sb_info *sbi, nid_t nid, int force) · line 514
Quoted 10 lines
fsck/dump.c +3
-2+else if (!is_sit_bitmap_set (sbi, ni.blk_addr)) +MSG (force,"Invalid node blk addr\n\n" );DBG (1 ,"node_blk.footer.ino [0x%x]\n" ,le32_to_cpu (node_blk->footer.ino));DBG (1 ,"node_blk.footer.nid [0x%x]\n" ,le32_to_cpu (node_blk->footer.nid));if (le32_to_cpu (node_blk->footer.ino) == ni.ino && -le32_to_cpu (node_blk->footer.nid) == ni.nid && - ni.ino == ni.nid) { +le32_to_cpu (node_blk->footer.nid) == ni.nid) {
I think we should not remove "ni.ino == ni.nid" here. dump_file() can only be called on inode.
Thanks,
Sheng
Quoted 17 lines
fsck/dump.c +0
-2print_node_info (sbi, node_blk, force);dump_file (sbi, &ni, node_blk, force); }else {@@ -678,8 +691,6 @@ int dump_info_from_blkaddr(struct f2fs_sb_info *sbi, u32 blk_addr)int type;struct f2fs_summary sum_entry;struct node_info ni, ino_ni; -struct seg_entry *se; -u32 offset;int enc_name;int ret =0 ;@@ -712,12 +723,8 @@ int dump_info_from_blkaddr(struct f2fs_sb_info *sbi, u32 blk_addr)return ret; }
fsck/dump.c int dump_info_from_blkaddr(struct f2fs_sb_info *sbi, u32 blk_addr) · line 730
Quoted 10 lines
fsck/dump.c +1
-5- se =get_seg_entry (sbi,GET_SEGNO (sbi, blk_addr)); - offset =OFFSET_IN_SEG (sbi, blk_addr); - -if (f2fs_test_bit (offset, (const char *)se->cur_valid_map) ==0 ) { +if (!is_sit_bitmap_set (sbi, blk_addr))MSG (0 ,"\nblkaddr is not valid\n" ); - } type =get_sum_entry (sbi, blk_addr, &sum_entry); nid =le32_to_cpu (sum_entry.nid);
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Quoted 73 lines
-----Original Message-----
From: shengyong (A)
Sent: Wednesday, March 07, 2018 11:21 AM
To: heyunlei; [email protected]; Yuchao (T); [email protected]
Subject: Re: [f2fs-dev] [PATCH] dump.f2fs: fix a wrong report for dump an {d, id, did}nodeHi, Yunlei,
Quoted 48 lines · Yunlei He
fix a wrong report for dump an {d,id,did}node like this:
[
print_node_info: 283] Node ID [0x6820:26656] is direct node or indirect node.[0] [0x 16b6684 : 23815812] [1] [0x 16b6685 : 23815813] [2] [0x 16b6686 : 23815814] [3] [0x 16b6687 : 23815815] [4] [0x 16b6688 : 23815816] [5] [0x 16b6689 : 23815817] [6] [0x 16b668a : 23815818] [7] [0x 16b668b : 23815819] [8] [0x 16b668c : 23815820] [9] [0x 16b668d : 23815821] [10] [0x 16b668e : 23815822]Invalid (i)node block
Signed-off-by Yunlei He <[email protected]>--- fsck/dump.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-)fsck/dump.c +12
-0@@ -475,6 +475,18 @@ dump: } } +static bool is_sit_bitmap_set (struct f2fs_sb_info *sbi,u32 blk_addr) +{ +struct seg_entry *se; +u32 offset; + + se =get_seg_entry (sbi,GET_SEGNO (sbi, blk_addr)); + offset =OFFSET_IN_SEG (sbi, blk_addr); + +return f2fs_test_bit (offset, + (const char *)se->cur_valid_map) !=0 ; +} +void dump_node (struct f2fs_sb_info *sbi,nid_t nid,int force) {struct node_info ni;@@ -492,13 +504,14 @@ void dump_node(struct f2fs_sb_info *sbi, nid_t nid, int force)if (ni.blk_addr ==0x0 )MSG (force,"Invalid nat entry\n\n" );fsck/dump.c void dump_node(struct f2fs_sb_info *sbi, nid_t nid, int force) · line 514
Quoted 10 lines
fsck/dump.c +3
-2+else if (!is_sit_bitmap_set (sbi, ni.blk_addr)) +MSG (force,"Invalid node blk addr\n\n" );DBG (1 ,"node_blk.footer.ino [0x%x]\n" ,le32_to_cpu (node_blk->footer.ino));DBG (1 ,"node_blk.footer.nid [0x%x]\n" ,le32_to_cpu (node_blk->footer.nid));if (le32_to_cpu (node_blk->footer.ino) == ni.ino && -le32_to_cpu (node_blk->footer.nid) == ni.nid && - ni.ino == ni.nid) { +le32_to_cpu (node_blk->footer.nid) == ni.nid) {I think we should not remove "ni.ino == ni.nid" here.
dump_file()can only be called on inode.
Quoted 4 lines
Thanks,
ShengQuoted 1 line
fsck/dump.c +0
-0print_node_info (sbi, node_blk, force);
How about move the judgement before dump_file?
Thanks.
Quoted 23 lines
Quoted 23 lines
fsck/dump.c +1
-7dump_file (sbi, &ni, node_blk, force); }else {@@ -678,8 +691,6 @@ int dump_info_from_blkaddr(struct f2fs_sb_info *sbi, u32 blk_addr)int type;struct f2fs_summary sum_entry;struct node_info ni, ino_ni; -struct seg_entry *se; -u32 offset;int enc_name;int ret =0 ;@@ -712,12 +723,8 @@ int dump_info_from_blkaddr(struct f2fs_sb_info *sbi, u32 blk_addr)return ret; } - se =get_seg_entry (sbi,GET_SEGNO (sbi, blk_addr)); - offset =OFFSET_IN_SEG (sbi, blk_addr); - -if (f2fs_test_bit (offset, (const char *)se->cur_valid_map) ==0 ) { +if (!is_sit_bitmap_set (sbi, blk_addr))MSG (0 ,"\nblkaddr is not valid\n" ); - }
Quoted 3 lines
fsck/dump.c int dump_info_from_blkaddr(struct f2fs_sb_info *sbi, u32 blk_addr) · line 730
Quoted 3 lines
fsck/dump.c +0
-0type =get_sum_entry (sbi, blk_addr, &sum_entry); nid =le32_to_cpu (sum_entry.nid);
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Quoted 73 lines · heyunlei
Quoted 73 lines
-----Original Message-----
From: shengyong (A)
Sent: Wednesday, March 07, 2018 11:21 AM
To: heyunlei; [email protected]; Yuchao (T); [email protected]
Subject: Re: [f2fs-dev] [PATCH] dump.f2fs: fix a wrong report for dump an {d, id, did}nodeHi, Yunlei,
Quoted 48 lines · Yunlei He
fix a wrong report for dump an {d,id,did}node like this:
[
print_node_info: 283] Node ID [0x6820:26656] is direct node or indirect node.[0] [0x 16b6684 : 23815812] [1] [0x 16b6685 : 23815813] [2] [0x 16b6686 : 23815814] [3] [0x 16b6687 : 23815815] [4] [0x 16b6688 : 23815816] [5] [0x 16b6689 : 23815817] [6] [0x 16b668a : 23815818] [7] [0x 16b668b : 23815819] [8] [0x 16b668c : 23815820] [9] [0x 16b668d : 23815821] [10] [0x 16b668e : 23815822]Invalid (i)node block
Signed-off-by Yunlei He <[email protected]>--- fsck/dump.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-)fsck/dump.c +12
-0@@ -475,6 +475,18 @@ dump: } } +static bool is_sit_bitmap_set (struct f2fs_sb_info *sbi,u32 blk_addr) +{ +struct seg_entry *se; +u32 offset; + + se =get_seg_entry (sbi,GET_SEGNO (sbi, blk_addr)); + offset =OFFSET_IN_SEG (sbi, blk_addr); + +return f2fs_test_bit (offset, + (const char *)se->cur_valid_map) !=0 ; +} +void dump_node (struct f2fs_sb_info *sbi,nid_t nid,int force) {struct node_info ni;@@ -492,13 +504,14 @@ void dump_node(struct f2fs_sb_info *sbi, nid_t nid, int force)if (ni.blk_addr ==0x0 )MSG (force,"Invalid nat entry\n\n" );fsck/dump.c void dump_node(struct f2fs_sb_info *sbi, nid_t nid, int force) · line 514
Quoted 10 lines
fsck/dump.c +3
-2+else if (!is_sit_bitmap_set (sbi, ni.blk_addr)) +MSG (force,"Invalid node blk addr\n\n" );DBG (1 ,"node_blk.footer.ino [0x%x]\n" ,le32_to_cpu (node_blk->footer.ino));DBG (1 ,"node_blk.footer.nid [0x%x]\n" ,le32_to_cpu (node_blk->footer.nid));if (le32_to_cpu (node_blk->footer.ino) == ni.ino && -le32_to_cpu (node_blk->footer.nid) == ni.nid && - ni.ino == ni.nid) { +le32_to_cpu (node_blk->footer.nid) == ni.nid) {I think we should not remove "ni.ino == ni.nid" here.
dump_file()can only be called on inode.
Quoted 7 lines
Quoted 4 lines
Thanks,
ShengQuoted 1 line
fsck/dump.c +0
-0print_node_info (sbi, node_blk, force);How about move the judgement before
dump_file?
OK. We could do that :)
thanks,
Sheng
Quoted 24 lines
Thanks.
Quoted 23 lines
Quoted 23 lines
fsck/dump.c +1
-7dump_file (sbi, &ni, node_blk, force); }else {@@ -678,8 +691,6 @@ int dump_info_from_blkaddr(struct f2fs_sb_info *sbi, u32 blk_addr)int type;struct f2fs_summary sum_entry;struct node_info ni, ino_ni; -struct seg_entry *se; -u32 offset;int enc_name;int ret =0 ;@@ -712,12 +723,8 @@ int dump_info_from_blkaddr(struct f2fs_sb_info *sbi, u32 blk_addr)return ret; } - se =get_seg_entry (sbi,GET_SEGNO (sbi, blk_addr)); - offset =OFFSET_IN_SEG (sbi, blk_addr); - -if (f2fs_test_bit (offset, (const char *)se->cur_valid_map) ==0 ) { +if (!is_sit_bitmap_set (sbi, blk_addr))MSG (0 ,"\nblkaddr is not valid\n" ); - }
Quoted 4 lines
Quoted 3 lines
fsck/dump.c int dump_info_from_blkaddr(struct f2fs_sb_info *sbi, u32 blk_addr) · line 730
Quoted 3 lines
fsck/dump.c +0
-0type =get_sum_entry (sbi, blk_addr, &sum_entry); nid =le32_to_cpu (sum_entry.nid);
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot