Allow enabling soft updates (with -U) on a new filesystem.

[I first added this functionality, and thought to check prior art.  Seeing
OpenBSD had already done this, I changed my addition to reduce the diffs
between the two and went with their option letter.]
Obtained from:	OpenBSD
This commit is contained in:
David E. O'Brien 2001-04-02 01:25:55 +00:00
parent aad65d6f79
commit b2cd1ce8ee
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=75078
3 changed files with 18 additions and 6 deletions

View File

@ -95,6 +95,7 @@ extern char *mfs_mtpt; /* mount point for mfs */
extern struct stat mfs_mtstat; /* stat prior to mount */
extern int Nflag; /* run mkfs without writing file system */
extern int Oflag; /* format as an 4.3BSD file system */
extern int Uflag; /* enable soft updates for file system */
extern int fssize; /* file system size */
extern int ntracks; /* # tracks/cylinder */
extern int nsectors; /* # sectors/track */
@ -253,6 +254,9 @@ mkfs(pp, fsys, fi, fo)
sblock.fs_inodefmt = FS_44INODEFMT;
sblock.fs_maxsymlinklen = MAXSYMLINKLEN;
}
if (Uflag) {
sblock.fs_flags |= FS_DOSOFTDEP;
}
/*
* Validate the given file system size.
* Verify that its last block can actually be accessed.
@ -673,11 +677,12 @@ mkfs(pp, fsys, fi, fo)
fsys, sblock.fs_size * NSPF(&sblock), sblock.fs_ncyl,
"cylinders", sblock.fs_ntrak, sblock.fs_nsect);
#define B2MBFACTOR (1 / (1024.0 * 1024.0))
printf("\t%.1fMB in %d cyl groups (%d c/g, %.2fMB/g, %d i/g)\n",
printf("\t%.1fMB in %d cyl groups (%d c/g, %.2fMB/g, %d i/g)%s\n",
(float)sblock.fs_size * sblock.fs_fsize * B2MBFACTOR,
sblock.fs_ncg, sblock.fs_cpg,
(float)sblock.fs_fpg * sblock.fs_fsize * B2MBFACTOR,
sblock.fs_ipg);
sblock.fs_ipg,
sblock.fs_flags & FS_DOSOFTDEP ? " SOFTUPDATES" : "");
#undef B2MBFACTOR
}
/*

View File

@ -41,7 +41,7 @@
.Nd construct a new file system
.Sh SYNOPSIS
.Nm
.Op Fl NO
.Op Fl NOU
.Op Fl S Ar sector-size
.Op Fl T Ar disktype
.Op Fl a Ar maxcontig
@ -65,7 +65,7 @@
.Op Fl x Ar sectors
.Ar special
.Nm mount_mfs
.Op Fl N
.Op Fl NU
.Op Fl F Ar file
.Op Fl T Ar disktype
.Op Fl a Ar maxcontig
@ -148,6 +148,8 @@ Cause the file system parameters to be printed out
without really creating the file system.
.It Fl O
Create a
.It Fl U
Enables soft updates on the new filesystem.
.Bx 4.3
format filesystem.
This options is primarily used to build root filesystems

View File

@ -173,6 +173,7 @@ char *mfs_mtpt; /* mount point for mfs */
struct stat mfs_mtstat; /* stat prior to mount */
int Nflag; /* run without writing file system */
int Oflag; /* format as an 4.3BSD file system */
int Uflag; /* enable soft updates for file system */
int fssize; /* file system size */
int ntracks = NTRACKS; /* # tracks/cylinder */
int nsectors = NSECTORS; /* # sectors/track */
@ -255,8 +256,8 @@ main(argc, argv)
}
opstring = mfs ?
"NF:T:a:b:c:d:e:f:i:m:o:s:" :
"NOS:T:a:b:c:d:e:f:i:k:l:m:n:o:p:r:s:t:u:vx:";
"NF:T:Ua:b:c:d:e:f:i:m:o:s:" :
"NOS:T:Ua:b:c:d:e:f:i:k:l:m:n:o:p:r:s:t:u:vx:";
while ((ch = getopt(argc, argv, opstring)) != -1)
switch (ch) {
case 'N':
@ -277,6 +278,9 @@ main(argc, argv)
case 'F':
filename = optarg;
break;
case 'U':
Uflag = 1;
break;
case 'a':
if ((maxcontig = atoi(optarg)) <= 0)
fatal("%s: bad maximum contiguous blocks",
@ -757,6 +761,7 @@ usage()
#ifdef COMPAT
fprintf(stderr, "\t-T disktype\n");
#endif
fprintf(stderr, "\t-U enable soft updates\n");
fprintf(stderr, "\t-a maximum contiguous blocks\n");
fprintf(stderr, "\t-b block size\n");
fprintf(stderr, "\t-c cylinders/group\n");