OSDN Git Service

Enhance dumpe2fs to print the size of journal
authorTheodore Ts'o <tytso@mit.edu>
Wed, 29 Mar 2006 19:03:07 +0000 (14:03 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Wed, 29 Mar 2006 19:03:07 +0000 (14:03 -0500)
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
misc/ChangeLog
misc/dumpe2fs.c

index ce928ca..4140ad6 100644 (file)
@@ -1,3 +1,8 @@
+2006-03-29  Theodore Ts'o  <tytso@mit.edu>
+
+       * dumpe2fs.c (print_inline_journal_information): Print the size of
+               the journal.
+
 2006-03-27  Theodore Ts'o  <tytso@mit.edu>
 
        * badblocks.8.in: Fix typo's in man page.  (Addresses Debian Bug:
index 0af1bad..2e42cb3 100644 (file)
@@ -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);