Add the -j option to enable soft updates journaling when creating

a new file system.

Reviewed by: Kostik Belousov <kostikbel@gmail.com>
This commit is contained in:
Kirk McKusick 2011-02-16 06:00:27 +00:00
parent 38d82872c6
commit d92f0739ab
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=218726
2 changed files with 18 additions and 3 deletions

View File

@ -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 number should be used;
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

View File

@ -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");