dump.f2fs: Test blkaddr is valid or not in option '-b'
PATCH 1/1 dump.f2fs: Test blkaddr is valid or not in option '-b'
Test blkaddr is valid or not in option '-b'
Signed-off-by Yunlei He <[email protected]>
--- fsck/dump.c | 9 +++++++++ fsck/mount.c | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-)
fsck/dump.c +9 -0
@@ -586,6 +586,8 @@ 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 ret =0 ;MSG (0 ,"\n== Dump data from block address ==\n\n" );
@@ -617,6 +619,13 @@ 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 ) { +MSG (0 ,"\nblkaddr is not valid\n" ); + } + type =get_sum_entry (sbi, blk_addr, &sum_entry); nid =le32_to_cpu (sum_entry.nid);
fsck/mount.c +1 -1
@@ -1869,7 +1869,7 @@ int find_next_free_block(struct f2fs_sb_info *sbi, u64 *to, int left, int type)struct f2fs_super_block *sb =F2FS_RAW_SUPER (sbi);struct seg_entry *se;u32 segno; -u64 offset; +u32 offset;int not_enough =0 ;u64 end_blkaddr = (get_sb (segment_count_main) <<get_sb (log_blocks_per_seg)) +get_sb (main_blkaddr);
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
Quoted 3 lines · Yunlei He
Test blkaddr is valid or not in option '-b'
Signed-off-by Yunlei He <[email protected]>
Reviewed-by Chao Yu <[email protected]>
Thanks,
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot