* [f2fs-dev] [PATCH] f2fs-tools: cleanup is_sit_bitmap_set
@ 2024-07-12 2:01 Sheng Yong via Linux-f2fs-devel
2024-07-12 2:01 ` [f2fs-dev] [PATCH] f2fs-tools: show device info of sb->devs Sheng Yong via Linux-f2fs-devel
` (4 more replies)
0 siblings, 5 replies; 10+ messages in thread
From: Sheng Yong via Linux-f2fs-devel @ 2024-07-12 2:01 UTC (permalink / raw)
To: chao, jaegeuk; +Cc: linux-f2fs-devel
Remove redundant function definition of is_sit_bitmap_set() and
export it.
Signed-off-by: Sheng Yong <shengyong@oppo.com>
---
fsck/dump.c | 2 +-
fsck/fsck.c | 12 ------------
fsck/fsck.h | 2 +-
3 files changed, 2 insertions(+), 14 deletions(-)
diff --git a/fsck/dump.c b/fsck/dump.c
index 90e3e0e93c61..4c1d4d3cdb19 100644
--- a/fsck/dump.c
+++ b/fsck/dump.c
@@ -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;
diff --git a/fsck/fsck.c b/fsck/fsck.c
index 7400dcf35a11..e2fb042d3dec 100644
--- a/fsck/fsck.c
+++ b/fsck/fsck.c
@@ -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;
diff --git a/fsck/fsck.h b/fsck/fsck.h
index 6cac926037bb..79cf08522873 100644
--- a/fsck/fsck.h
+++ b/fsck/fsck.h
@@ -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);
--
2.40.1
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply related [flat|nested] 10+ messages in thread* [f2fs-dev] [PATCH] f2fs-tools: show device info of sb->devs 2024-07-12 2:01 [f2fs-dev] [PATCH] f2fs-tools: cleanup is_sit_bitmap_set Sheng Yong via Linux-f2fs-devel @ 2024-07-12 2:01 ` Sheng Yong via Linux-f2fs-devel 2024-07-12 7:13 ` Chao Yu 2024-07-12 2:01 ` [f2fs-dev] [PATCH] fsck.f2fs: check all-zero inline data with helper is_zeroed Sheng Yong via Linux-f2fs-devel ` (3 subsequent siblings) 4 siblings, 1 reply; 10+ messages in thread From: Sheng Yong via Linux-f2fs-devel @ 2024-07-12 2:01 UTC (permalink / raw) To: chao, jaegeuk; +Cc: linux-f2fs-devel 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 <shengyong@oppo.com> --- fsck/mount.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/fsck/mount.c b/fsck/mount.c index 8524335da4da..ad1a49a84109 100644 --- a/fsck/mount.c +++ b/fsck/mount.c @@ -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]); -- 2.40.1 _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel ^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [f2fs-dev] [PATCH] f2fs-tools: show device info of sb->devs 2024-07-12 2:01 ` [f2fs-dev] [PATCH] f2fs-tools: show device info of sb->devs Sheng Yong via Linux-f2fs-devel @ 2024-07-12 7:13 ` Chao Yu 0 siblings, 0 replies; 10+ messages in thread From: Chao Yu @ 2024-07-12 7:13 UTC (permalink / raw) To: Sheng Yong, jaegeuk; +Cc: linux-f2fs-devel On 2024/7/12 10:01, Sheng Yong wrote: > 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 <shengyong@oppo.com> Reviewed-by: Chao Yu <chao@kernel.org> Thanks, _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel ^ permalink raw reply [flat|nested] 10+ messages in thread
* [f2fs-dev] [PATCH] fsck.f2fs: check all-zero inline data with helper is_zeroed 2024-07-12 2:01 [f2fs-dev] [PATCH] f2fs-tools: cleanup is_sit_bitmap_set Sheng Yong via Linux-f2fs-devel 2024-07-12 2:01 ` [f2fs-dev] [PATCH] f2fs-tools: show device info of sb->devs Sheng Yong via Linux-f2fs-devel @ 2024-07-12 2:01 ` Sheng Yong via Linux-f2fs-devel 2024-07-12 7:14 ` Chao Yu 2024-07-12 2:01 ` [f2fs-dev] [PATCH] fsck.f2fs: fix checking wp of all devices Sheng Yong via Linux-f2fs-devel ` (2 subsequent siblings) 4 siblings, 1 reply; 10+ messages in thread From: Sheng Yong via Linux-f2fs-devel @ 2024-07-12 2:01 UTC (permalink / raw) To: chao, jaegeuk; +Cc: linux-f2fs-devel Signed-off-by: Sheng Yong <shengyong@oppo.com> --- fsck/fsck.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/fsck/fsck.c b/fsck/fsck.c index e2fb042d3dec..6cb02729aec7 100644 --- a/fsck/fsck.c +++ b/fsck/fsck.c @@ -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) { -- 2.40.1 _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel ^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [f2fs-dev] [PATCH] fsck.f2fs: check all-zero inline data with helper is_zeroed 2024-07-12 2:01 ` [f2fs-dev] [PATCH] fsck.f2fs: check all-zero inline data with helper is_zeroed Sheng Yong via Linux-f2fs-devel @ 2024-07-12 7:14 ` Chao Yu 0 siblings, 0 replies; 10+ messages in thread From: Chao Yu @ 2024-07-12 7:14 UTC (permalink / raw) To: Sheng Yong, jaegeuk; +Cc: linux-f2fs-devel On 2024/7/12 10:01, Sheng Yong wrote: > Signed-off-by: Sheng Yong <shengyong@oppo.com> Reviewed-by: Chao Yu <chao@kernel.org> Thanks, _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel ^ permalink raw reply [flat|nested] 10+ messages in thread
* [f2fs-dev] [PATCH] fsck.f2fs: fix checking wp of all devices 2024-07-12 2:01 [f2fs-dev] [PATCH] f2fs-tools: cleanup is_sit_bitmap_set Sheng Yong via Linux-f2fs-devel 2024-07-12 2:01 ` [f2fs-dev] [PATCH] f2fs-tools: show device info of sb->devs Sheng Yong via Linux-f2fs-devel 2024-07-12 2:01 ` [f2fs-dev] [PATCH] fsck.f2fs: check all-zero inline data with helper is_zeroed Sheng Yong via Linux-f2fs-devel @ 2024-07-12 2:01 ` Sheng Yong via Linux-f2fs-devel 2024-07-12 7:23 ` Chao Yu 2024-07-12 2:01 ` [f2fs-dev] [PATCH] fsck.f2fs: update superblock if invalid Sheng Yong via Linux-f2fs-devel 2024-07-12 7:13 ` [f2fs-dev] [PATCH] f2fs-tools: cleanup is_sit_bitmap_set Chao Yu 4 siblings, 1 reply; 10+ messages in thread From: Sheng Yong via Linux-f2fs-devel @ 2024-07-12 2:01 UTC (permalink / raw) To: chao, jaegeuk; +Cc: linux-f2fs-devel For 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. Signed-off-by: Sheng Yong <shengyong@oppo.com> --- fsck/fsck.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fsck/fsck.c b/fsck/fsck.c index 6cb02729aec7..b15931eba3a0 100644 --- a/fsck/fsck.c +++ b/fsck/fsck.c @@ -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)) { -- 2.40.1 _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel ^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [f2fs-dev] [PATCH] fsck.f2fs: fix checking wp of all devices 2024-07-12 2:01 ` [f2fs-dev] [PATCH] fsck.f2fs: fix checking wp of all devices Sheng Yong via Linux-f2fs-devel @ 2024-07-12 7:23 ` Chao Yu 0 siblings, 0 replies; 10+ messages in thread From: Chao Yu @ 2024-07-12 7:23 UTC (permalink / raw) To: Sheng Yong, jaegeuk; +Cc: linux-f2fs-devel On 2024/7/12 10:01, Sheng Yong wrote: > For 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. > > Signed-off-by: Sheng Yong <shengyong@oppo.com> Reviewed-by: Chao Yu <chao@kernel.org> Thanks, _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel ^ permalink raw reply [flat|nested] 10+ messages in thread
* [f2fs-dev] [PATCH] fsck.f2fs: update superblock if invalid 2024-07-12 2:01 [f2fs-dev] [PATCH] f2fs-tools: cleanup is_sit_bitmap_set Sheng Yong via Linux-f2fs-devel ` (2 preceding siblings ...) 2024-07-12 2:01 ` [f2fs-dev] [PATCH] fsck.f2fs: fix checking wp of all devices Sheng Yong via Linux-f2fs-devel @ 2024-07-12 2:01 ` Sheng Yong via Linux-f2fs-devel 2024-07-12 7:33 ` Chao Yu 2024-07-12 7:13 ` [f2fs-dev] [PATCH] f2fs-tools: cleanup is_sit_bitmap_set Chao Yu 4 siblings, 1 reply; 10+ messages in thread From: Sheng Yong via Linux-f2fs-devel @ 2024-07-12 2:01 UTC (permalink / raw) To: chao, jaegeuk; +Cc: linux-f2fs-devel 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_errors and sb_invalid by merging them into an `invalid_sb' flags, and each of them is indicated using one bit. Signed-off-by: Sheng Yong <shengyong@oppo.com> --- fsck/fsck.c | 6 +++--- fsck/mount.c | 16 ++++++++++------ include/f2fs_fs.h | 11 ++++++++--- 3 files changed, 21 insertions(+), 12 deletions(-) diff --git a/fsck/fsck.c b/fsck/fsck.c index b15931eba3a0..89a5913f4a26 100644 --- a/fsck/fsck.c +++ b/fsck/fsck.c @@ -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 */ diff --git a/fsck/mount.c b/fsck/mount.c index 93ca351ef41c..e92e64e6feab 100644 --- a/fsck/mount.c +++ b/fsck/mount.c @@ -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) { diff --git a/include/f2fs_fs.h b/include/f2fs_fs.h index 870a6e4823d2..fbd20d207e42 100644 --- a/include/f2fs_fs.h +++ b/include/f2fs_fs.h @@ -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 8 struct 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; -- 2.40.1 _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel ^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [f2fs-dev] [PATCH] fsck.f2fs: update superblock if invalid 2024-07-12 2:01 ` [f2fs-dev] [PATCH] fsck.f2fs: update superblock if invalid Sheng Yong via Linux-f2fs-devel @ 2024-07-12 7:33 ` Chao Yu 0 siblings, 0 replies; 10+ messages in thread From: Chao Yu @ 2024-07-12 7:33 UTC (permalink / raw) To: Sheng Yong, jaegeuk; +Cc: linux-f2fs-devel On 2024/7/12 10:01, Sheng Yong wrote: > 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_errors and > sb_invalid by merging them into an `invalid_sb' flags, and each of > them is indicated using one bit. > > Signed-off-by: Sheng Yong <shengyong@oppo.com> Reviewed-by: Chao Yu <chao@kernel.org> Thanks, _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [f2fs-dev] [PATCH] f2fs-tools: cleanup is_sit_bitmap_set 2024-07-12 2:01 [f2fs-dev] [PATCH] f2fs-tools: cleanup is_sit_bitmap_set Sheng Yong via Linux-f2fs-devel ` (3 preceding siblings ...) 2024-07-12 2:01 ` [f2fs-dev] [PATCH] fsck.f2fs: update superblock if invalid Sheng Yong via Linux-f2fs-devel @ 2024-07-12 7:13 ` Chao Yu 4 siblings, 0 replies; 10+ messages in thread From: Chao Yu @ 2024-07-12 7:13 UTC (permalink / raw) To: Sheng Yong, jaegeuk; +Cc: linux-f2fs-devel On 2024/7/12 10:01, Sheng Yong wrote: > Remove redundant function definition of is_sit_bitmap_set() and > export it. > > Signed-off-by: Sheng Yong <shengyong@oppo.com> Reviewed-by: Chao Yu <chao@kernel.org> Thanks, _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2024-07-12 7:33 UTC | newest] Thread overview: 10+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2024-07-12 2:01 [f2fs-dev] [PATCH] f2fs-tools: cleanup is_sit_bitmap_set Sheng Yong via Linux-f2fs-devel 2024-07-12 2:01 ` [f2fs-dev] [PATCH] f2fs-tools: show device info of sb->devs Sheng Yong via Linux-f2fs-devel 2024-07-12 7:13 ` Chao Yu 2024-07-12 2:01 ` [f2fs-dev] [PATCH] fsck.f2fs: check all-zero inline data with helper is_zeroed Sheng Yong via Linux-f2fs-devel 2024-07-12 7:14 ` Chao Yu 2024-07-12 2:01 ` [f2fs-dev] [PATCH] fsck.f2fs: fix checking wp of all devices Sheng Yong via Linux-f2fs-devel 2024-07-12 7:23 ` Chao Yu 2024-07-12 2:01 ` [f2fs-dev] [PATCH] fsck.f2fs: update superblock if invalid Sheng Yong via Linux-f2fs-devel 2024-07-12 7:33 ` Chao Yu 2024-07-12 7:13 ` [f2fs-dev] [PATCH] f2fs-tools: cleanup is_sit_bitmap_set Chao Yu
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.