Whamcloud - gitweb
ChangeLog, mke2fs.8.in, mke2fs.c:
authorTheodore Ts'o <tytso@mit.edu>
Tue, 24 Oct 2000 19:33:45 +0000 (19:33 +0000)
committerTheodore Ts'o <tytso@mit.edu>
Tue, 24 Oct 2000 19:33:45 +0000 (19:33 +0000)
  mke2fs.c (PRS, main), mke2fs.8.in: Add support for the -j option,
   which builds an ext2/3 filesystem with an ext3 journal.

misc/ChangeLog
misc/mke2fs.8.in
misc/mke2fs.c

index 745b25a..266e49c 100644 (file)
@@ -1,3 +1,9 @@
+2000-10-24    <tytso@snap.thunk.org>
+
+       * mke2fs.c (PRS, main), mke2fs.8.in: Add support for the -j
+               option, which builds an ext2/3 filesystem with an ext3
+               journal.
+
 2000-10-24    <tytso@valinux.com>
 
        * mke2fs.c (zap_sector): Fix really stupid typo which gcc 2.95
index 1ce7069..9c04326 100644 (file)
@@ -29,6 +29,10 @@ mke2fs \- create a Linux second extended file system
 .I bytes-per-inode
 ]
 [
+.B \-j
+.I megabytes-for-journal
+]
+[
 .B \-N
 .I number-of-inodes
 ]
@@ -134,6 +138,12 @@ Be warned that is not possible to expand the number of inodes on a
 filesystem after it is created, so be careful decided the correct
 value for this parameter. 
 .TP
+.BI \-j " megabytes-for-journal"
+Build the ext2 filesystem with the ext3 journaling feature enabled.  
+Megabyts-for-journal specifies the size of the journal in MB 
+(1024*1024 bytes).  Any size between 4MB and 100MB may be used.
+Of course, the journal must be small enough to fit into the filesystem.
+.TP
 .B \-n
 causes mke2fs to not actually create a filesystem, but display what it 
 would do if it were to create a filesystem.
index 23e92b4..4062bb4 100644 (file)
@@ -79,6 +79,7 @@ int   quiet = 0;
 int    super_only = 0;
 int    force = 0;
 int    noaction = 0;
+int    journal_size = 0;
 char   *bad_blocks_filename = 0;
 __u32  fs_stride = 0;
 
@@ -779,7 +780,7 @@ static void PRS(int argc, char *argv[])
        if (argc && *argv)
                program_name = *argv;
        while ((c = getopt (argc, argv,
-                   "b:cf:g:i:l:m:no:qr:R:s:tvI:ST:FL:M:N:O:V")) != EOF)
+                   "b:cf:g:i:j:l:m:no:qr:R:s:tvI:ST:FL:M:N:O:V")) != EOF)
                switch (c) {
                case 'b':
                        blocksize = strtoul(optarg, &tmp, 0);
@@ -831,6 +832,14 @@ static void PRS(int argc, char *argv[])
                                exit(1);
                        }
                        break;
+               case 'j':
+                       journal_size = strtoul(optarg, &tmp, 0);
+                       if (journal_size < 4 || journal_size > 100 || *tmp) {
+                               com_err(program_name, 0,
+                                       _("bad journal size - %s"), optarg);
+                               exit(1);
+                       }
+                       break;
                case 'l':
                        bad_blocks_filename = malloc(strlen(optarg)+1);
                        if (!bad_blocks_filename) {
@@ -1015,6 +1024,7 @@ int main (int argc, char *argv[])
        errcode_t       retval = 0;
        ext2_filsys     fs;
        badblocks_list  bb_list = 0;
+       int             journal_blocks;
        struct ext2fs_sb *s;
 
 #ifdef ENABLE_NLS
@@ -1111,6 +1121,20 @@ int main (int argc, char *argv[])
                zap_sector(fs, 0);
 #endif
        }
+       if (journal_size) {
+               if (!quiet)
+                       printf(_("Creating journal: "));
+               journal_blocks = journal_size * 1024 /
+                       (fs->blocksize  / 1024);
+               retval = ext2fs_add_journal_fs(fs, journal_blocks);
+               if (retval) {
+                       com_err (program_name, retval,
+                                _("while trying to create journal"));
+                       exit(1);
+               }
+               if (!quiet)
+                       printf(_("done\n"));
+       }
        
        if (!quiet)
                printf(_("Writing superblocks and "