diff options
author | mckusick <mckusick@FreeBSD.org> | 2011-02-16 06:00:27 +0000 |
---|---|---|
committer | mckusick <mckusick@FreeBSD.org> | 2011-02-16 06:00:27 +0000 |
commit | 4b076b8c49b50e0895d6c621ea87f7eb5b1e58a9 (patch) | |
tree | dcddbe783d92a6e2a870905692891e4c4ff323ba /sbin/newfs/newfs.c | |
parent | 8ca1e470b6e6f3a4e4290c3e37e23dffb55d81a1 (diff) | |
download | FreeBSD-src-4b076b8c49b50e0895d6c621ea87f7eb5b1e58a9.zip FreeBSD-src-4b076b8c49b50e0895d6c621ea87f7eb5b1e58a9.tar.gz |
Add the -j option to enable soft updates journaling when creating
a new file system.
Reviewed by: Kostik Belousov <kostikbel@gmail.com>
Diffstat (limited to 'sbin/newfs/newfs.c')
-rw-r--r-- | sbin/newfs/newfs.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/sbin/newfs/newfs.c b/sbin/newfs/newfs.c index 0e5b7da..6163774 100644 --- a/sbin/newfs/newfs.c +++ b/sbin/newfs/newfs.c @@ -87,6 +87,7 @@ int Nflag; /* run without writing file system */ int Oflag = 2; /* file system format (1 => UFS1, 2 => UFS2) */ int Rflag; /* regression test */ int Uflag; /* enable soft updates for file system */ +int jflag; /* enable soft updates journaling for filesys */ int Xflag = 0; /* exit in middle of newfs for testing */ int Jflag; /* enable gjournal for file system */ int lflag; /* enable multilabel for file system */ @@ -140,7 +141,7 @@ main(int argc, char *argv[]) part_name = 'c'; reserved = 0; while ((ch = getopt(argc, argv, - "EJL:NO:RS:T:UXa:b:c:d:e:f:g:h:i:lm:no:p:r:s:t")) != -1) + "EJL:NO:RS:T:UXa:b:c:d:e:f:g:h:i:jlm:no:p:r:s:t")) != -1) switch (ch) { case 'E': Eflag = 1; @@ -180,6 +181,9 @@ main(int argc, char *argv[]) case 'T': disktype = optarg; break; + case 'j': + jflag = 1; + /* fall through to enable soft updates */ case 'U': Uflag = 1; break; @@ -397,7 +401,11 @@ main(int argc, char *argv[]) rewritelabel(special, lp); } ufs_disk_close(&disk); - exit(0); + if (!jflag) + exit(0); + if (execlp("tunefs", "newfs", "-j", "enable", special, NULL) < 0) + err(1, "Cannot enable soft updates journaling, tunefs"); + /* NOT REACHED */ } void @@ -492,6 +500,7 @@ usage() fprintf(stderr, "\t-g average file size\n"); fprintf(stderr, "\t-h average files per directory\n"); fprintf(stderr, "\t-i number of bytes per inode\n"); + fprintf(stderr, "\t-j enable soft updates journaling\n"); fprintf(stderr, "\t-l enable multilabel MAC\n"); fprintf(stderr, "\t-n do not create .snap directory\n"); fprintf(stderr, "\t-m minimum free space %%\n"); |