svn commit: r218726 - head/sbin/newfs
Kirk McKusick
mckusick at FreeBSD.org
Wed Feb 16 06:00:27 UTC 2011
Author: mckusick
Date: Wed Feb 16 06:00:27 2011
New Revision: 218726
URL: http://svn.freebsd.org/changeset/base/218726
Log:
Add the -j option to enable soft updates journaling when creating
a new file system.
Reviewed by: Kostik Belousov <kostikbel at gmail.com>
Modified:
head/sbin/newfs/newfs.8
head/sbin/newfs/newfs.c
Modified: head/sbin/newfs/newfs.8
==============================================================================
--- head/sbin/newfs/newfs.8 Tue Feb 15 22:28:15 2011 (r218725)
+++ head/sbin/newfs/newfs.8 Wed Feb 16 06:00:27 2011 (r218726)
@@ -36,7 +36,7 @@
.Nd construct a new UFS1/UFS2 file system
.Sh SYNOPSIS
.Nm
-.Op Fl EJNUlnt
+.Op Fl EJNUjlnt
.Op Fl L Ar volname
.Op Fl O Ar filesystem-type
.Op Fl S Ar sector-size
@@ -157,6 +157,12 @@ If fewer inodes are desired, a larger nu
to create more inodes a smaller number should be given.
One inode is required for each distinct file, so this value effectively
specifies the average file size on the file system.
+.It Fl j
+Enable soft updates journaling on the new file system.
+This flag is implemented by running the
+.Xr tunefs 8
+utility found in the user's
+.Dv $PATH .
.It Fl l
Enable multilabel MAC on the new file system.
.It Fl m Ar free-space
Modified: head/sbin/newfs/newfs.c
==============================================================================
--- head/sbin/newfs/newfs.c Tue Feb 15 22:28:15 2011 (r218725)
+++ head/sbin/newfs/newfs.c Wed Feb 16 06:00:27 2011 (r218726)
@@ -87,6 +87,7 @@ int Nflag; /* run without writing file
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");
More information about the svn-src-all
mailing list