.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
.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
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
#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;
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++;
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;
}
return;
print_usage:
- fprintf(stderr, "%s: Usage: logdump [-acsOS] [-b<block>] [-i<filespec>]\n\t"
+ fprintf(stderr, "%s: Usage: logdump [-acsOS] [-n<num_trans>] [-b<block>] [-i<filespec>]\n\t"
"[-f<journal_file>] [output_file]\n", argv[0]);
}
int fc_done;
__u64 total_len;
__u32 maxlen;
+ 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);
}
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);
blocktype = be32_to_cpu(header->h_blocktype);
if (magic != JBD2_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;
+ }
break;
}
continue;
case JBD2_COMMIT_BLOCK:
+ cur_counts++;
transaction++;
blocknr++;
WRAP(jsb, blocknr, maxlen);