From: Theodore Ts'o Date: Wed, 29 Mar 2006 19:03:07 +0000 (-0500) Subject: Enhance dumpe2fs to print the size of journal X-Git-Tag: E2FSPROGS-1.39-WIP-0330~6 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=6515a6f1bc8dbf2f69d7a33a56a4ebf3e4f1910b;p=tools%2Fe2fsprogs.git Enhance dumpe2fs to print the size of journal Signed-off-by: "Theodore Ts'o" --- diff --git a/misc/ChangeLog b/misc/ChangeLog index ce928ca..4140ad6 100644 --- a/misc/ChangeLog +++ b/misc/ChangeLog @@ -1,3 +1,8 @@ +2006-03-29 Theodore Ts'o + + * dumpe2fs.c (print_inline_journal_information): Print the size of + the journal. + 2006-03-27 Theodore Ts'o * badblocks.8.in: Fix typo's in man page. (Addresses Debian Bug: diff --git a/misc/dumpe2fs.c b/misc/dumpe2fs.c index 0af1bad..2e42cb3 100644 --- a/misc/dumpe2fs.c +++ b/misc/dumpe2fs.c @@ -230,6 +230,27 @@ static void list_bad_blocks(ext2_filsys fs, int dump) fputc('\n', stdout); } +static void print_inline_journal_information(ext2_filsys fs) +{ + struct ext2_inode inode; + errcode_t retval; + ino_t ino = fs->super->s_journal_inum; + int size; + + retval = ext2fs_read_inode(fs, ino, &inode); + if (retval) { + com_err(program_name, retval, + _("while reading journal inode")); + exit(1); + } + fputs(_("Journal size: "), stdout); + size = inode.i_blocks >> 1; + if (size < 8192) + printf("%uk\n", size); + else + printf("%uM\n", size >> 10); +} + static void print_journal_information(ext2_filsys fs) { errcode_t retval; @@ -366,6 +387,9 @@ int main (int argc, char ** argv) ext2fs_close(fs); exit(0); } + if (fs->super->s_feature_compat & + EXT3_FEATURE_COMPAT_HAS_JOURNAL) + print_inline_journal_information(fs); list_bad_blocks(fs, 0); if (header_only) { ext2fs_close (fs);