From 6515a6f1bc8dbf2f69d7a33a56a4ebf3e4f1910b Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Wed, 29 Mar 2006 14:03:07 -0500 Subject: [PATCH] Enhance dumpe2fs to print the size of journal Signed-off-by: "Theodore Ts'o" --- misc/ChangeLog | 5 +++++ misc/dumpe2fs.c | 24 ++++++++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/misc/ChangeLog b/misc/ChangeLog index ce928ca0..4140ad6c 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 0af1bad5..2e42cb3d 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); -- 2.11.0