On 2025/6/30 23:10, Darrick J. Wong wrote:
On Tue, Jun 17, 2025 at 07:31:35PM +0800, zhanchengbin wrote:
When filesystem errors occur, inspect journal sequences with parameter t to
dump commit timestamps.
Signed-off-by: zhanchengbin <zhanchengbin@xxxxxxxxxx>
---
debugfs/logdump.c | 63 ++++++++++++++++++++++++++++++++++++++++-------
1 file changed, 54 insertions(+), 9 deletions(-)
diff --git a/debugfs/logdump.c b/debugfs/logdump.c
index 324ed42..bbe1384 100644
--- a/debugfs/logdump.c
+++ b/debugfs/logdump.c
@@ -47,7 +47,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 int dump_all, dump_super, dump_old, dump_contents,
dump_descriptors, dump_time;
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;
@@ -67,6 +67,8 @@ static void dump_descriptor_block(FILE *, struct
journal_source *,
char *, journal_superblock_t *,
unsigned int *, unsigned int, __u32, tid_t);
+static void dump_commit_time(FILE *out_file, char *buf);
+
static void dump_revoke_block(FILE *, char *, journal_superblock_t *,
unsigned int, unsigned int, tid_t);
@@ -118,10 +120,11 @@ void do_logdump(int argc, ss_argv_t argv, int sci_idx
EXT2FS_ATTR((unused)),
inode_block_to_dump = ANY_BLOCK;
inode_to_dump = -1;
dump_counts = -1;
+ dump_time = 0;
Globals are initialized to zero if not given an explicit value so this
isn't necessary.
When I run 'logdump -t', it displays the time,but when I run 'logdump'
without parameters for the second time, it still shows the time. Globals
retain their assigned values, which affects subsequent execution
results. So I think initializing the globals here is necessary.
Thanks,
- bin.
.