f2fs-tools: cleanup is_sit_bitmap_set
PATCH 1/1 f2fs-tools: cleanup is_sit_bitmap_set
Remove redundant function definition of is_sit_bitmap_set() and export it.
--- fsck/dump.c | 2 +- fsck/fsck.c | 12 ------------ fsck/fsck.h | 2 +- 3 files changed, 2 insertions(+), 14 deletions(-)
fsck/dump.c +1 -1
@@ -660,7 +660,7 @@ dump:return 0 ; } -static bool is_sit_bitmap_set (struct f2fs_sb_info *sbi,u32 blk_addr) +bool is_sit_bitmap_set (struct f2fs_sb_info *sbi,u32 blk_addr) {struct seg_entry *se;u32 offset;
fsck/fsck.c +0 -12
@@ -633,18 +633,6 @@ err:return -EINVAL ; } -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 ; -} -int fsck_chk_root_inode (struct f2fs_sb_info *sbi) {struct f2fs_node *node_blk;
fsck/fsck.h +1 -1
@@ -281,7 +281,7 @@ extern int dump_node(struct f2fs_sb_info *, nid_t, int, char *, int, int);extern int dump_info_from_blkaddr (struct f2fs_sb_info *,u32 );extern unsigned int start_bidx_of_node (unsigned int ,struct f2fs_node *);extern void dump_node_scan_disk (struct f2fs_sb_info *sbi,nid_t nid); - +extern bool is_sit_bitmap_set (struct f2fs_sb_info *sbi,u32 blk_addr);/* defrag.c */ int f2fs_defragment (struct f2fs_sb_info *,u64 ,u64 ,u64 ,int );
Signature · 8 lines
2.40.1 _______________________________________________ Linux-f2fs-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
PATCH 1/1 f2fs-tools: show device info of sb->devs
Show multidevice infomation like the follwoing:
devs[i].path [meta.img] devs[i].total_segments [0x 3f : 63] devs[i].path [data.img] devs[i].total_segments [0x 80 : 128]
--- fsck/mount.c | 8 ++++++++ 1 file changed, 8 insertions(+)
fsck/mount.c +8 -0
@@ -469,6 +469,7 @@ void print_raw_sb_info(struct f2fs_super_block *sb)char uuid[40 ];char encrypt_pw_salt[40 ];#endif +int i;if (c.layout) goto printout;
@@ -537,6 +538,13 @@ printout:DISP_raw_str ("%-.36s" , encrypt_pw_salt);#endif +for (i =0 ; i <MAX_DEVICES ; i++) { +if (!sb->devs[i].path[0 ]) +break ; +DISP_str ("%s" , sb, devs[i].path); +DISP_u32 (sb, devs[i].total_segments); + } +DISP_u32 (sb, qf_ino[USRQUOTA ]);DISP_u32 (sb, qf_ino[GRPQUOTA ]);DISP_u32 (sb, qf_ino[PRJQUOTA ]);
Signature · 8 lines
2.40.1 _______________________________________________ Linux-f2fs-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Re: [f2fs-dev] [PATCH] f2fs-tools: show device info of sb->devs
Quoted 8 lines · Sheng Yong
Show multidevice infomation like the follwoing:
devs[i].path [meta.img] devs[i].total_segments [0x 3f : 63] devs[i].path [data.img] devs[i].total_segments [0x 80 : 128]Signed-off-by Sheng Yong <[email protected]>
Thanks,
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
PATCH 1/1 fsck.f2fs: check all-zero inline data with helper is_zeroed
In reply to Sheng Yong via Linux-f2fs-devel--- fsck/fsck.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
fsck/fsck.c +1 -4
@@ -1081,10 +1081,7 @@ check_next: } }if (!(node_blk->i.i_inline &F2FS_DATA_EXIST )) { -char buf[MAX_INLINE_DATA (node_blk)]; -memset (buf,0 ,MAX_INLINE_DATA (node_blk)); - -if (memcmp (buf,inline_data_addr (node_blk), +if (!is_zeroed (inline_data_addr (node_blk),MAX_INLINE_DATA (node_blk))) {ASSERT_MSG ("[0x%x] junk inline data" , nid);if (c.fix_on) {
Signature · 8 lines
2.40.1 _______________________________________________ Linux-f2fs-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Re: [f2fs-dev] [PATCH] fsck.f2fs: check all-zero inline data with helper is_zeroed
Quoted 1 line · Sheng Yong
Signed-off-by Sheng Yong <[email protected]>
Thanks,
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
PATCH 1/1 fsck.f2fs: fix checking wp of all devices
In reply to Sheng Yong via Linux-f2fs-develFor zoned model, the first device (devices[0]) is not zoned device, whose zoned_model is not F2FS_ZONED_HM. Let's skip it and check write pointer of left devices continuously.
--- fsck/fsck.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fsck/fsck.c +1 -1
@@ -3351,7 +3351,7 @@ static void fix_wp_sit_alignment(struct f2fs_sb_info *sbi)if (!c.devices[i].path)break ;if (c.devices[i].zoned_model !=F2FS_ZONED_HM ) -break ; +continue ; wpd.dev_index = i;if (f2fs_report_zones (i, chk_and_fix_wp_with_sit, &wpd)) {
Signature · 8 lines
2.40.1 _______________________________________________ Linux-f2fs-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Re: [f2fs-dev] [PATCH] fsck.f2fs: fix checking wp of all devices
Quoted 5 lines · Sheng Yong
For zoned model, the first device (devices[0]) is not zoned device, whose
zoned_modelis notF2FS_ZONED_HM. Let's skip it and check write pointer of left devices continuously.Signed-off-by Sheng Yong <[email protected]>
Thanks,
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
PATCH 1/1 fsck.f2fs: update superblock if invalid
In reply to Sheng Yong via Linux-f2fs-develIf a superblock failed in sanity check, it should be fixed. This patch add a new state `sb_invalid' to tell fsck needs to update superblock at the end of all checkings.
This patch also cleans up force_stop, abnormal_stop, fs_errors and sb_invalid by merging them into an `invalid_sb' flags, and each of them is indicated using one bit.
--- fsck/fsck.c | 6 +++--- fsck/mount.c | 16 ++++++++++------ include/f2fs_fs.h | 11 ++++++++--- 3 files changed, 21 insertions(+), 12 deletions(-)
fsck/fsck.c +3 -3
@@ -3661,13 +3661,13 @@ int fsck_verify(struct f2fs_sb_info *sbi)write_checkpoints (sbi); } -if (c.abnormal_stop) +if (c.invalid_sb &SB_ABNORMAL_STOP )memset (sb->s_stop_reason,0 ,MAX_STOP_REASON ); -if (c.fs_errors) +if (c.invalid_sb &SB_FS_ERRORS )memset (sb->s_errors,0 ,MAX_F2FS_ERRORS ); -if (c.abnormal_stop || c.fs_errors) +if (c.invalid_sb &SB_NEED_FIX )update_superblock (sb,SB_MASK_ALL );/* to return FSCK_ERROR_CORRECTED */
fsck/mount.c +10 -6
@@ -701,7 +701,7 @@ void print_sb_stop_reason(struct f2fs_super_block *sb)u8 *reason = sb->s_stop_reason;int i; -if (!c.force_stop) +if (!(c.invalid_sb &SB_FORCE_STOP ))return ;MSG (0 ,"Info: checkpoint stop reason: " );
@@ -739,7 +739,7 @@ void print_sb_errors(struct f2fs_super_block *sb)u8 *errors = sb->s_errors;int i; -if (!c.fs_errors) +if (!(c.invalid_sb &SB_FS_ERRORS ))return ;MSG (0 ,"Info: fs errors: " );
@@ -1171,9 +1171,12 @@ int validate_super_block(struct f2fs_sb_info *sbi, enum SB_ADDR sb_addr) VERSION_NAME_LEN);get_kernel_version (c.init_version); - c.force_stop =is_checkpoint_stop (sbi->raw_super, false); - c.abnormal_stop =is_checkpoint_stop (sbi->raw_super, true); - c.fs_errors =is_inconsistent_error (sbi->raw_super); +if (is_checkpoint_stop (sbi->raw_super, false)) + c.invalid_sb |=SB_FORCE_STOP ; +if (is_checkpoint_stop (sbi->raw_super, true)) + c.invalid_sb |=SB_ABNORMAL_STOP ; +if (is_inconsistent_error (sbi->raw_super)) + c.invalid_sb |=SB_FS_ERRORS ;MSG (0 ,"Info: MKFS version\n \"%s\"\n" , c.init_version); MSG(0, "Info: FSCK version\n from \"%s\"\n to \"%s\"\n",
@@ -1186,6 +1189,7 @@ int validate_super_block(struct f2fs_sb_info *sbi, enum SB_ADDR sb_addr)free (sbi->raw_super); sbi->raw_super =NULL ; + c.invalid_sb |=SB_INVALID ;MSG (0 ,"\tCan't find a valid F2FS superblock at 0x%x\n" , sb_addr);return -EINVAL ;
@@ -1456,7 +1460,7 @@ static int f2fs_should_proceed(struct f2fs_super_block *sb, u32 flag)if (flag &CP_FSCK_FLAG || flag &CP_DISABLED_FLAG || flag &CP_QUOTA_NEED_FSCK_FLAG || - c.abnormal_stop || c.fs_errors || + c.invalid_sb &SB_NEED_FIX || (exist_qf_ino (sb) && (flag &CP_ERROR_FLAG ))) { c.fix_on =1 ; }else if (!c.preen_mode) {
include/f2fs_fs.h +8 -3
@@ -1443,6 +1443,13 @@ enum {SSR }; +/* invalid sb types */ +#define SB_FORCE_STOP 0x1/* s_stop_reason is set */ +#define SB_ABNORMAL_STOP 0x2/* s_stop_reason is set except shutdown */ +#define SB_FS_ERRORS 0x4/* s_erros is set */ +#define SB_INVALID 0x8/* sb is invalid */ +#define SB_NEED_FIX (SB_ABNORMAL_STOP | SB_FS_ERRORS | SB_INVALID) +#define MAX_CACHE_SUMS 8struct f2fs_configuration {
@@ -1494,9 +1501,7 @@ struct f2fs_configuration {int force;int defset;int bug_on; -int force_stop; -int abnormal_stop; -int fs_errors; +unsigned int invalid_sb;int bug_nat_bits;bool quota_fixed;int alloc_failed;
Signature · 8 lines
2.40.1 _______________________________________________ Linux-f2fs-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Re: [f2fs-dev] [PATCH] fsck.f2fs: update superblock if invalid
Quoted 9 lines · Sheng Yong
If a superblock failed in sanity check, it should be fixed. This patch add a new state `sb_invalid' to tell fsck needs to update superblock at the end of all checkings.
This patch also cleans up
force_stop,abnormal_stop,fs_errorsandsb_invalidby merging them into an `invalid_sb' flags, and each of them is indicated using one bit.Signed-off-by Sheng Yong <[email protected]>
Thanks,
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Quoted 4 lines · Sheng Yong
Remove redundant function definition of
is_sit_bitmap_set()and export it.Signed-off-by Sheng Yong <[email protected]>
Thanks,
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel