Message ID | 20240408131140.4100090-1-shengyong@oppo.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | [f2fs-dev] f2fs-tools: print extension list properly | expand |
On 2024/4/8 21:11, Sheng Yong wrote: > The "hot file extensions" list does not print properly. > > **Before** > > extension_count [0x 23 : 35] > cold file extentsions > [mp wm og jp ] > [avi m4v m4p mkv ] > [mov webm wav m4a ] > [3gp opus flac gif ] > [png svg webp jar ] > [deb iso gz xz ] > [zst pdf pyc ttc ] > [ttf exe apk cnt ] > [exo odex vdex ] > hot_ext_count [0x 1 : 1] > hot file extentsions > db ] > cp_payload [0x 0 : 0] > > **After** > > extension_count [0x 23 : 35] > cold file extentsions > [mp wm og jp ] > [avi m4v m4p mkv ] > [mov webm wav m4a ] > [3gp opus flac gif ] > [png svg webp jar ] > [deb iso gz xz ] > [zst pdf pyc ttc ] > [ttf exe apk cnt ] > [exo odex vdex ] > hot_ext_count [0x 1 : 1] > hot file extentsions > [db ] > cp_payload [0x 0 : 0] > > Signed-off-by: Sheng Yong <shengyong@oppo.com> Reviewed-by: Chao Yu <chao@kernel.org> Thanks,
diff --git a/fsck/mount.c b/fsck/mount.c index b983920..8524335 100644 --- a/fsck/mount.c +++ b/fsck/mount.c @@ -429,20 +429,26 @@ void print_extention_list(struct f2fs_super_block *sb, int cold) printf("%s file extentsions\n", cold ? "cold" : "hot"); - for (i = start; i < end; i++) { + for (i = 0; i < end - start; i++) { if (c.layout) { printf("%-30s %-8.8s\n", "extension_list", - sb->extension_list[i]); + sb->extension_list[start + i]); } else { if (i % 4 == 0) printf("%-30s\t\t[", ""); - printf("%-8.8s", sb->extension_list[i]); + printf("%-8.8s", sb->extension_list[start + i]); - if (i % 4 == 4 - 1 || i == end - start - 1) + if (i % 4 == 4 - 1) printf("]\n"); } } + + for (; i < round_up(end - start, 4) * 4; i++) { + printf("%-8.8s", ""); + if (i % 4 == 4 - 1) + printf("]\n"); + } } static void DISP_label(const char *name)
The "hot file extensions" list does not print properly. **Before** extension_count [0x 23 : 35] cold file extentsions [mp wm og jp ] [avi m4v m4p mkv ] [mov webm wav m4a ] [3gp opus flac gif ] [png svg webp jar ] [deb iso gz xz ] [zst pdf pyc ttc ] [ttf exe apk cnt ] [exo odex vdex ] hot_ext_count [0x 1 : 1] hot file extentsions db ] cp_payload [0x 0 : 0] **After** extension_count [0x 23 : 35] cold file extentsions [mp wm og jp ] [avi m4v m4p mkv ] [mov webm wav m4a ] [3gp opus flac gif ] [png svg webp jar ] [deb iso gz xz ] [zst pdf pyc ttc ] [ttf exe apk cnt ] [exo odex vdex ] hot_ext_count [0x 1 : 1] hot file extentsions [db ] cp_payload [0x 0 : 0] Signed-off-by: Sheng Yong <shengyong@oppo.com> --- fsck/mount.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)