From 74af9cc6e83304baacaa9946d962844ae895da9d Mon Sep 17 00:00:00 2001 From: yanxiaodan Date: Wed, 24 Aug 2022 06:23:37 +0000 Subject: [PATCH 1/7] debugfs: teach logdump the -n option Signed-off-by: yanxiaodan --- ...teach-logdump-the-n-num_trans-option.patch | 165 ++++++++++++++++++ 1 file changed, 165 insertions(+) create mode 100644 0045-debugfs-teach-logdump-the-n-num_trans-option.patch diff --git a/0045-debugfs-teach-logdump-the-n-num_trans-option.patch b/0045-debugfs-teach-logdump-the-n-num_trans-option.patch new file mode 100644 index 0000000..af93c98 --- /dev/null +++ b/0045-debugfs-teach-logdump-the-n-num_trans-option.patch @@ -0,0 +1,165 @@ +From 6e4cc3d5eeb2dfaa055e652b5390beaa6c3d05da Mon Sep 17 00:00:00 2001 +From: "lihaoxiang (F)" +Date: Thu, 14 Jul 2022 09:32:48 +0800 +Subject: [PATCH] debugfs: teach logdump the -n option + +The current version's debugfs possessed the function +logdump. Executing with option -O could output the log history. But +when it occurred the block which had no magic number in it's header, +the program would exit. + +Sometimes we were locating problems, needed for more transactions that +had replayed instead of the latest batch of transactions and we +weren't hope to display all the history in the meanwhile. So we +introduced the option -n used for controlling the print of history +transactions. Specially, this parameter was depending on the option +-O otherwise it couldn't work. + +So in this modification, we used logdump with -O -n . The +-n options causes logdump to continue past a block with a missing +magic nuber. Instead, it will terminate only when the entire log has +been printed or after transactions. + +Link: https://lore.kernel.org/r/608df030-593f-8c69-cb65-632a34729d23@huawei.com +Signed-off-by: lihaoxiang +Signed-off-by: Theodore Ts'o +--- + debugfs/debugfs.8.in | 13 +++++++++++-- + debugfs/logdump.c | 32 ++++++++++++++++++++++++++++---- + 2 files changed, 39 insertions(+), 6 deletions(-) + +diff --git a/debugfs/debugfs.8.in b/debugfs/debugfs.8.in +index 393c000..c4be831 100644 +--- a/debugfs/debugfs.8.in ++++ b/debugfs/debugfs.8.in +@@ -505,7 +505,7 @@ which is a hard link to + .IR filespec . + Note this does not adjust the inode reference counts. + .TP +-.BI logdump " [-acsOS] [-b block] [-i filespec] [-f journal_file] [output_file]" ++.BI logdump " [-acsOS] [-b block] [-n num_trans ] [-i filespec] [-f journal_file] [output_file]" + Dump the contents of the ext3 journal. By default, dump the journal inode as + specified in the superblock. However, this can be overridden with the + .I \-i +@@ -528,7 +528,7 @@ The + .I \-a + option causes the + .B logdump +-program to print the contents of all of the descriptor blocks. ++to print the contents of all of the descriptor blocks. + The + .I \-b + option causes +@@ -548,6 +548,15 @@ The + option causes logdump to display old (checkpointed) journal entries. + This can be used to try to track down journal problems even after the + journal has been replayed. ++.IP ++The ++.I \-n ++option causes ++.B logdump ++to continue past a journal block which is missing a magic number. ++Instead, it will stop only when the entire log is printed or after ++.I num_trans ++transactions. + .TP + .BI ls " [-l] [-c] [-d] [-p] [-r] filespec" + Print a listing of the files in the directory +diff --git a/debugfs/logdump.c b/debugfs/logdump.c +index cdd47a3..12fca9f 100644 +--- a/debugfs/logdump.c ++++ b/debugfs/logdump.c +@@ -40,6 +40,7 @@ enum journal_location {JOURNAL_IS_INTERNAL, JOURNAL_IS_EXTERNAL}; + #define ANY_BLOCK ((blk64_t) -1) + + static int dump_all, dump_super, dump_old, dump_contents, dump_descriptors; ++static int64_t dump_counts; + static blk64_t block_to_dump, bitmap_to_dump, inode_block_to_dump; + static unsigned int group_to_dump, inode_offset_to_dump; + static ext2_ino_t inode_to_dump; +@@ -103,9 +104,10 @@ void do_logdump(int argc, char **argv, int sci_idx EXT2FS_ATTR((unused)), + bitmap_to_dump = -1; + inode_block_to_dump = ANY_BLOCK; + inode_to_dump = -1; ++ dump_counts = -1; + + reset_getopt(); +- while ((c = getopt (argc, argv, "ab:ci:f:OsS")) != EOF) { ++ while ((c = getopt (argc, argv, "ab:ci:f:OsSn:")) != EOF) { + switch (c) { + case 'a': + dump_all++; +@@ -138,6 +140,14 @@ void do_logdump(int argc, char **argv, int sci_idx EXT2FS_ATTR((unused)), + case 'S': + dump_super++; + break; ++ case 'n': ++ dump_counts = strtol(optarg, &tmp, 10); ++ if (*tmp) { ++ com_err(argv[0], 0, ++ "Bad log counts number - %s", optarg); ++ return; ++ } ++ break; + default: + goto print_usage; + } +@@ -276,7 +286,7 @@ errout: + return; + + print_usage: +- fprintf(stderr, "%s: Usage: logdump [-acsOS] [-b] [-i]\n\t" ++ fprintf(stderr, "%s: Usage: logdump [-acsOS] [-n] [-b] [-i]\n\t" + "[-f] [output_file]\n", argv[0]); + } + +@@ -353,6 +363,8 @@ static void dump_journal(char *cmdname, FILE *out_file, + journal_header_t *header; + tid_t transaction; + unsigned int blocknr = 0; ++ int64_t cur_counts = 0; ++ bool exist_no_magic = false; + + /* First, check to see if there's an ext2 superblock header */ + retval = read_journal_block(cmdname, source, 0, buf, 2048); +@@ -416,6 +428,9 @@ static void dump_journal(char *cmdname, FILE *out_file, + } + + while (1) { ++ if (dump_old && (dump_counts != -1) && (cur_counts >= dump_counts)) ++ break; ++ + retval = read_journal_block(cmdname, source, + ((ext2_loff_t) blocknr) * blocksize, + buf, blocksize); +@@ -429,8 +444,16 @@ static void dump_journal(char *cmdname, FILE *out_file, + blocktype = be32_to_cpu(header->h_blocktype); + + if (magic != JFS_MAGIC_NUMBER) { +- fprintf (out_file, "No magic number at block %u: " +- "end of journal.\n", blocknr); ++ if (exist_no_magic == false) { ++ exist_no_magic = true; ++ fprintf(out_file, "No magic number at block %u: " ++ "end of journal.\n", blocknr); ++ } ++ if (dump_old && (dump_counts != -1)) { ++ blocknr++; ++ WRAP(jsb, blocknr, maxlen); ++ continue; ++ } + return; + } + +@@ -457,6 +480,7 @@ static void dump_journal(char *cmdname, FILE *out_file, + continue; + + case JFS_COMMIT_BLOCK: ++ cur_counts++; + transaction++; + blocknr++; + WRAP(jsb, blocknr); +-- +2.23.0 + -- Gitee From 2df602cf11a182c4a95b304c1be037926a10d252 Mon Sep 17 00:00:00 2001 From: yanxiaodan Date: Wed, 24 Aug 2022 06:26:59 +0000 Subject: [PATCH 2/7] update e2fsprogs.spec. Signed-off-by: yanxiaodan --- e2fsprogs.spec | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/e2fsprogs.spec b/e2fsprogs.spec index 95fa747..e447cd5 100644 --- a/e2fsprogs.spec +++ b/e2fsprogs.spec @@ -1,6 +1,6 @@ Name: e2fsprogs Version: 1.45.6 -Release: 12 +Release: 13 Summary: Second extended file system management tools License: GPLv2 and LGPLv2 and GPLv2+ URL: http://e2fsprogs.sourceforge.net/ @@ -51,6 +51,7 @@ Patch41: 0041-e2fsck-do-not-clean-up-file-acl-if-the-inode-is-trun.patch Patch42: 0042-e2fsck-handle-level-is-overflow-in-ext2fs_extent_get.patch Patch43: 0043-libext2fs-add-sanity-check-to-extent-manipulation.patch Patch44: 0044-tune2fs-do-not-change-j_tail_sequence-in-journal-sup.patch +Patch45: 0045-debugfs-teach-logdump-the-n-num_trans-option.patch BuildRequires: gcc pkgconfig texinfo BuildRequires: fuse-devel libblkid-devel libuuid-devel @@ -172,6 +173,9 @@ exit 0 %{_mandir}/man8/* %changelog +* Wed Aug 24 2022 yanxiaodan - 1.45.6-13 +- debugfs: teach logdump the -n option + * Mon Aug 15 2022 yanxiaodan - 1.45.6-12 - tune2fs: do not change j_tail_sequence in journal superblock -- Gitee From 4c3d71cab026f547b0ba8938f127fd6b0129969b Mon Sep 17 00:00:00 2001 From: yanxiaodan Date: Wed, 24 Aug 2022 07:39:35 +0000 Subject: [PATCH 3/7] update 0044-tune2fs-do-not-change-j_tail_sequence-in-journal-sup.patch. Signed-off-by: yanxiaodan --- 0044-tune2fs-do-not-change-j_tail_sequence-in-journal-sup.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/0044-tune2fs-do-not-change-j_tail_sequence-in-journal-sup.patch b/0044-tune2fs-do-not-change-j_tail_sequence-in-journal-sup.patch index dfb0608..2bc7d1c 100644 --- a/0044-tune2fs-do-not-change-j_tail_sequence-in-journal-sup.patch +++ b/0044-tune2fs-do-not-change-j_tail_sequence-in-journal-sup.patch @@ -32,7 +32,7 @@ index 095fff00..5bac0d3b 100644 + errout: jbd2_journal_destroy_revoke(journal); - jbd2_journal_destroy_revoke_record_cache(); + journal_destroy_revoke_caches(); -- 2.37.1 -- Gitee From 30b9cedd3906e2d438fb93c3aceb9ce9f2ffab7d Mon Sep 17 00:00:00 2001 From: yanxiaodan Date: Wed, 24 Aug 2022 07:44:57 +0000 Subject: [PATCH 4/7] update 0044-tune2fs-do-not-change-j_tail_sequence-in-journal-sup.patch. Signed-off-by: yanxiaodan --- 0044-tune2fs-do-not-change-j_tail_sequence-in-journal-sup.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/0044-tune2fs-do-not-change-j_tail_sequence-in-journal-sup.patch b/0044-tune2fs-do-not-change-j_tail_sequence-in-journal-sup.patch index 2bc7d1c..a239751 100644 --- a/0044-tune2fs-do-not-change-j_tail_sequence-in-journal-sup.patch +++ b/0044-tune2fs-do-not-change-j_tail_sequence-in-journal-sup.patch @@ -31,7 +31,7 @@ index 095fff00..5bac0d3b 100644 + journal->j_tail_sequence = journal->j_transaction_sequence; + errout: - jbd2_journal_destroy_revoke(journal); + journal_destroy_revoke(journal); journal_destroy_revoke_caches(); -- 2.37.1 -- Gitee From 2e8d80020349e8abf07fd75eb3371859044408ed Mon Sep 17 00:00:00 2001 From: yanxiaodan Date: Sat, 27 Aug 2022 06:53:58 +0000 Subject: [PATCH 5/7] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=200045?= =?UTF-8?q?-debugfs-teach-logdump-the-n-num=5Ftrans-option.patch?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...teach-logdump-the-n-num_trans-option.patch | 165 ------------------ 1 file changed, 165 deletions(-) delete mode 100644 0045-debugfs-teach-logdump-the-n-num_trans-option.patch diff --git a/0045-debugfs-teach-logdump-the-n-num_trans-option.patch b/0045-debugfs-teach-logdump-the-n-num_trans-option.patch deleted file mode 100644 index af93c98..0000000 --- a/0045-debugfs-teach-logdump-the-n-num_trans-option.patch +++ /dev/null @@ -1,165 +0,0 @@ -From 6e4cc3d5eeb2dfaa055e652b5390beaa6c3d05da Mon Sep 17 00:00:00 2001 -From: "lihaoxiang (F)" -Date: Thu, 14 Jul 2022 09:32:48 +0800 -Subject: [PATCH] debugfs: teach logdump the -n option - -The current version's debugfs possessed the function -logdump. Executing with option -O could output the log history. But -when it occurred the block which had no magic number in it's header, -the program would exit. - -Sometimes we were locating problems, needed for more transactions that -had replayed instead of the latest batch of transactions and we -weren't hope to display all the history in the meanwhile. So we -introduced the option -n used for controlling the print of history -transactions. Specially, this parameter was depending on the option --O otherwise it couldn't work. - -So in this modification, we used logdump with -O -n . The --n options causes logdump to continue past a block with a missing -magic nuber. Instead, it will terminate only when the entire log has -been printed or after transactions. - -Link: https://lore.kernel.org/r/608df030-593f-8c69-cb65-632a34729d23@huawei.com -Signed-off-by: lihaoxiang -Signed-off-by: Theodore Ts'o ---- - debugfs/debugfs.8.in | 13 +++++++++++-- - debugfs/logdump.c | 32 ++++++++++++++++++++++++++++---- - 2 files changed, 39 insertions(+), 6 deletions(-) - -diff --git a/debugfs/debugfs.8.in b/debugfs/debugfs.8.in -index 393c000..c4be831 100644 ---- a/debugfs/debugfs.8.in -+++ b/debugfs/debugfs.8.in -@@ -505,7 +505,7 @@ which is a hard link to - .IR filespec . - Note this does not adjust the inode reference counts. - .TP --.BI logdump " [-acsOS] [-b block] [-i filespec] [-f journal_file] [output_file]" -+.BI logdump " [-acsOS] [-b block] [-n num_trans ] [-i filespec] [-f journal_file] [output_file]" - Dump the contents of the ext3 journal. By default, dump the journal inode as - specified in the superblock. However, this can be overridden with the - .I \-i -@@ -528,7 +528,7 @@ The - .I \-a - option causes the - .B logdump --program to print the contents of all of the descriptor blocks. -+to print the contents of all of the descriptor blocks. - The - .I \-b - option causes -@@ -548,6 +548,15 @@ The - option causes logdump to display old (checkpointed) journal entries. - This can be used to try to track down journal problems even after the - journal has been replayed. -+.IP -+The -+.I \-n -+option causes -+.B logdump -+to continue past a journal block which is missing a magic number. -+Instead, it will stop only when the entire log is printed or after -+.I num_trans -+transactions. - .TP - .BI ls " [-l] [-c] [-d] [-p] [-r] filespec" - Print a listing of the files in the directory -diff --git a/debugfs/logdump.c b/debugfs/logdump.c -index cdd47a3..12fca9f 100644 ---- a/debugfs/logdump.c -+++ b/debugfs/logdump.c -@@ -40,6 +40,7 @@ enum journal_location {JOURNAL_IS_INTERNAL, JOURNAL_IS_EXTERNAL}; - #define ANY_BLOCK ((blk64_t) -1) - - static int dump_all, dump_super, dump_old, dump_contents, dump_descriptors; -+static int64_t dump_counts; - static blk64_t block_to_dump, bitmap_to_dump, inode_block_to_dump; - static unsigned int group_to_dump, inode_offset_to_dump; - static ext2_ino_t inode_to_dump; -@@ -103,9 +104,10 @@ void do_logdump(int argc, char **argv, int sci_idx EXT2FS_ATTR((unused)), - bitmap_to_dump = -1; - inode_block_to_dump = ANY_BLOCK; - inode_to_dump = -1; -+ dump_counts = -1; - - reset_getopt(); -- while ((c = getopt (argc, argv, "ab:ci:f:OsS")) != EOF) { -+ while ((c = getopt (argc, argv, "ab:ci:f:OsSn:")) != EOF) { - switch (c) { - case 'a': - dump_all++; -@@ -138,6 +140,14 @@ void do_logdump(int argc, char **argv, int sci_idx EXT2FS_ATTR((unused)), - case 'S': - dump_super++; - break; -+ case 'n': -+ dump_counts = strtol(optarg, &tmp, 10); -+ if (*tmp) { -+ com_err(argv[0], 0, -+ "Bad log counts number - %s", optarg); -+ return; -+ } -+ break; - default: - goto print_usage; - } -@@ -276,7 +286,7 @@ errout: - return; - - print_usage: -- fprintf(stderr, "%s: Usage: logdump [-acsOS] [-b] [-i]\n\t" -+ fprintf(stderr, "%s: Usage: logdump [-acsOS] [-n] [-b] [-i]\n\t" - "[-f] [output_file]\n", argv[0]); - } - -@@ -353,6 +363,8 @@ static void dump_journal(char *cmdname, FILE *out_file, - journal_header_t *header; - tid_t transaction; - unsigned int blocknr = 0; -+ int64_t cur_counts = 0; -+ bool exist_no_magic = false; - - /* First, check to see if there's an ext2 superblock header */ - retval = read_journal_block(cmdname, source, 0, buf, 2048); -@@ -416,6 +428,9 @@ static void dump_journal(char *cmdname, FILE *out_file, - } - - while (1) { -+ if (dump_old && (dump_counts != -1) && (cur_counts >= dump_counts)) -+ break; -+ - retval = read_journal_block(cmdname, source, - ((ext2_loff_t) blocknr) * blocksize, - buf, blocksize); -@@ -429,8 +444,16 @@ static void dump_journal(char *cmdname, FILE *out_file, - blocktype = be32_to_cpu(header->h_blocktype); - - if (magic != JFS_MAGIC_NUMBER) { -- fprintf (out_file, "No magic number at block %u: " -- "end of journal.\n", blocknr); -+ if (exist_no_magic == false) { -+ exist_no_magic = true; -+ fprintf(out_file, "No magic number at block %u: " -+ "end of journal.\n", blocknr); -+ } -+ if (dump_old && (dump_counts != -1)) { -+ blocknr++; -+ WRAP(jsb, blocknr, maxlen); -+ continue; -+ } - return; - } - -@@ -457,6 +480,7 @@ static void dump_journal(char *cmdname, FILE *out_file, - continue; - - case JFS_COMMIT_BLOCK: -+ cur_counts++; - transaction++; - blocknr++; - WRAP(jsb, blocknr); --- -2.23.0 - -- Gitee From 2da0e6293dd6650683f140c19d52deef03e3c596 Mon Sep 17 00:00:00 2001 From: yanxiaodan Date: Sat, 27 Aug 2022 06:54:41 +0000 Subject: [PATCH 6/7] debugfs: teach logdump the -n option debugfs: teach logdump the -n option Signed-off-by: yanxiaodan --- ...teach-logdump-the-n-num_trans-option.patch | 174 ++++++++++++++++++ 1 file changed, 174 insertions(+) create mode 100644 0045-debugfs-teach-logdump-the-n-num_trans-option.patch diff --git a/0045-debugfs-teach-logdump-the-n-num_trans-option.patch b/0045-debugfs-teach-logdump-the-n-num_trans-option.patch new file mode 100644 index 0000000..8b86ad3 --- /dev/null +++ b/0045-debugfs-teach-logdump-the-n-num_trans-option.patch @@ -0,0 +1,174 @@ +From 6cb297790b8c8e881278342a290d10fc1df1813a Mon Sep 17 00:00:00 2001 +From: "lihaoxiang (F)" +Date: Thu, 14 Jul 2022 09:32:48 +0800 +Subject: [PATCH] debugfs: teach logdump the -n option + +The current version's debugfs possessed the function +logdump. Executing with option -O could output the log history. But +when it occurred the block which had no magic number in it's header, +the program would exit. + +Sometimes we were locating problems, needed for more transactions that +had replayed instead of the latest batch of transactions and we +weren't hope to display all the history in the meanwhile. So we +introduced the option -n used for controlling the print of history +transactions. Specially, this parameter was depending on the option +-O otherwise it couldn't work. + +So in this modification, we used logdump with -O -n . The +-n options causes logdump to continue past a block with a missing +magic nuber. Instead, it will terminate only when the entire log has +been printed or after transactions. + +conflict: context adaptation + +Link: https://lore.kernel.org/r/608df030-593f-8c69-cb65-632a34729d23@huawei.com +Signed-off-by: lihaoxiang +Signed-off-by: Theodore Ts'o +--- + debugfs/debugfs.8.in | 13 +++++++++++-- + debugfs/logdump.c | 33 +++++++++++++++++++++++++++++---- + 2 files changed, 40 insertions(+), 6 deletions(-) + +diff --git a/debugfs/debugfs.8.in b/debugfs/debugfs.8.in +index 393c000..c4be831 100644 +--- a/debugfs/debugfs.8.in ++++ b/debugfs/debugfs.8.in +@@ -505,7 +505,7 @@ which is a hard link to + .IR filespec . + Note this does not adjust the inode reference counts. + .TP +-.BI logdump " [-acsOS] [-b block] [-i filespec] [-f journal_file] [output_file]" ++.BI logdump " [-acsOS] [-b block] [-n num_trans ] [-i filespec] [-f journal_file] [output_file]" + Dump the contents of the ext3 journal. By default, dump the journal inode as + specified in the superblock. However, this can be overridden with the + .I \-i +@@ -528,7 +528,7 @@ The + .I \-a + option causes the + .B logdump +-program to print the contents of all of the descriptor blocks. ++to print the contents of all of the descriptor blocks. + The + .I \-b + option causes +@@ -548,6 +548,15 @@ The + option causes logdump to display old (checkpointed) journal entries. + This can be used to try to track down journal problems even after the + journal has been replayed. ++.IP ++The ++.I \-n ++option causes ++.B logdump ++to continue past a journal block which is missing a magic number. ++Instead, it will stop only when the entire log is printed or after ++.I num_trans ++transactions. + .TP + .BI ls " [-l] [-c] [-d] [-p] [-r] filespec" + Print a listing of the files in the directory +diff --git a/debugfs/logdump.c b/debugfs/logdump.c +index cdd47a3..cf36e19 100644 +--- a/debugfs/logdump.c ++++ b/debugfs/logdump.c +@@ -34,12 +34,14 @@ extern char *optarg; + #include "blkid/blkid.h" + #include "jfs_user.h" + #include ++#include + + enum journal_location {JOURNAL_IS_INTERNAL, JOURNAL_IS_EXTERNAL}; + + #define ANY_BLOCK ((blk64_t) -1) + + static int dump_all, dump_super, dump_old, dump_contents, dump_descriptors; ++static int64_t dump_counts; + static blk64_t block_to_dump, bitmap_to_dump, inode_block_to_dump; + static unsigned int group_to_dump, inode_offset_to_dump; + static ext2_ino_t inode_to_dump; +@@ -103,9 +105,10 @@ void do_logdump(int argc, char **argv, int sci_idx EXT2FS_ATTR((unused)), + bitmap_to_dump = -1; + inode_block_to_dump = ANY_BLOCK; + inode_to_dump = -1; ++ dump_counts = -1; + + reset_getopt(); +- while ((c = getopt (argc, argv, "ab:ci:f:OsS")) != EOF) { ++ while ((c = getopt (argc, argv, "ab:ci:f:OsSn:")) != EOF) { + switch (c) { + case 'a': + dump_all++; +@@ -138,6 +141,14 @@ void do_logdump(int argc, char **argv, int sci_idx EXT2FS_ATTR((unused)), + case 'S': + dump_super++; + break; ++ case 'n': ++ dump_counts = strtol(optarg, &tmp, 10); ++ if (*tmp) { ++ com_err(argv[0], 0, ++ "Bad log counts number - %s", optarg); ++ return; ++ } ++ break; + default: + goto print_usage; + } +@@ -276,7 +287,7 @@ errout: + return; + + print_usage: +- fprintf(stderr, "%s: Usage: logdump [-acsOS] [-b] [-i]\n\t" ++ fprintf(stderr, "%s: Usage: logdump [-acsOS] [-n] [-b] [-i]\n\t" + "[-f] [output_file]\n", argv[0]); + } + +@@ -353,6 +364,8 @@ static void dump_journal(char *cmdname, FILE *out_file, + journal_header_t *header; + tid_t transaction; + unsigned int blocknr = 0; ++ int64_t cur_counts = 0; ++ bool exist_no_magic = false; + + /* First, check to see if there's an ext2 superblock header */ + retval = read_journal_block(cmdname, source, 0, buf, 2048); +@@ -416,6 +429,9 @@ static void dump_journal(char *cmdname, FILE *out_file, + } + + while (1) { ++ if (dump_old && (dump_counts != -1) && (cur_counts >= dump_counts)) ++ break; ++ + retval = read_journal_block(cmdname, source, + ((ext2_loff_t) blocknr) * blocksize, + buf, blocksize); +@@ -429,8 +445,16 @@ static void dump_journal(char *cmdname, FILE *out_file, + blocktype = be32_to_cpu(header->h_blocktype); + + if (magic != JFS_MAGIC_NUMBER) { +- fprintf (out_file, "No magic number at block %u: " +- "end of journal.\n", blocknr); ++ if (exist_no_magic == false) { ++ exist_no_magic = true; ++ fprintf(out_file, "No magic number at block %u: " ++ "end of journal.\n", blocknr); ++ } ++ if (dump_old && (dump_counts != -1)) { ++ blocknr++; ++ WRAP(jsb, blocknr); ++ continue; ++ } + return; + } + +@@ -457,6 +481,7 @@ static void dump_journal(char *cmdname, FILE *out_file, + continue; + + case JFS_COMMIT_BLOCK: ++ cur_counts++; + transaction++; + blocknr++; + WRAP(jsb, blocknr); +-- +2.33.0 + -- Gitee From b64532bf67e574a4c86215ebaba9f3260e36d641 Mon Sep 17 00:00:00 2001 From: yanxiaodan Date: Sat, 27 Aug 2022 06:55:23 +0000 Subject: [PATCH 7/7] update e2fsprogs.spec. Signed-off-by: yanxiaodan --- e2fsprogs.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2fsprogs.spec b/e2fsprogs.spec index e447cd5..96928ad 100644 --- a/e2fsprogs.spec +++ b/e2fsprogs.spec @@ -173,7 +173,7 @@ exit 0 %{_mandir}/man8/* %changelog -* Wed Aug 24 2022 yanxiaodan - 1.45.6-13 +* Sat Aug 27 2022 yanxiaodan - 1.45.6-13 - debugfs: teach logdump the -n option * Mon Aug 15 2022 yanxiaodan - 1.45.6-12 -- Gitee