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:
parent
aad65d6f79
commit
b2cd1ce8ee
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=75078
@ -95,6 +95,7 @@ extern char *mfs_mtpt; /* mount point for mfs */
|
|||||||
extern struct stat mfs_mtstat; /* stat prior to mount */
|
extern struct stat mfs_mtstat; /* stat prior to mount */
|
||||||
extern int Nflag; /* run mkfs without writing file system */
|
extern int Nflag; /* run mkfs without writing file system */
|
||||||
extern int Oflag; /* format as an 4.3BSD 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 fssize; /* file system size */
|
||||||
extern int ntracks; /* # tracks/cylinder */
|
extern int ntracks; /* # tracks/cylinder */
|
||||||
extern int nsectors; /* # sectors/track */
|
extern int nsectors; /* # sectors/track */
|
||||||
@ -253,6 +254,9 @@ mkfs(pp, fsys, fi, fo)
|
|||||||
sblock.fs_inodefmt = FS_44INODEFMT;
|
sblock.fs_inodefmt = FS_44INODEFMT;
|
||||||
sblock.fs_maxsymlinklen = MAXSYMLINKLEN;
|
sblock.fs_maxsymlinklen = MAXSYMLINKLEN;
|
||||||
}
|
}
|
||||||
|
if (Uflag) {
|
||||||
|
sblock.fs_flags |= FS_DOSOFTDEP;
|
||||||
|
}
|
||||||
/*
|
/*
|
||||||
* Validate the given file system size.
|
* Validate the given file system size.
|
||||||
* Verify that its last block can actually be accessed.
|
* 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,
|
fsys, sblock.fs_size * NSPF(&sblock), sblock.fs_ncyl,
|
||||||
"cylinders", sblock.fs_ntrak, sblock.fs_nsect);
|
"cylinders", sblock.fs_ntrak, sblock.fs_nsect);
|
||||||
#define B2MBFACTOR (1 / (1024.0 * 1024.0))
|
#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,
|
(float)sblock.fs_size * sblock.fs_fsize * B2MBFACTOR,
|
||||||
sblock.fs_ncg, sblock.fs_cpg,
|
sblock.fs_ncg, sblock.fs_cpg,
|
||||||
(float)sblock.fs_fpg * sblock.fs_fsize * B2MBFACTOR,
|
(float)sblock.fs_fpg * sblock.fs_fsize * B2MBFACTOR,
|
||||||
sblock.fs_ipg);
|
sblock.fs_ipg,
|
||||||
|
sblock.fs_flags & FS_DOSOFTDEP ? " SOFTUPDATES" : "");
|
||||||
#undef B2MBFACTOR
|
#undef B2MBFACTOR
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
|
@ -41,7 +41,7 @@
|
|||||||
.Nd construct a new file system
|
.Nd construct a new file system
|
||||||
.Sh SYNOPSIS
|
.Sh SYNOPSIS
|
||||||
.Nm
|
.Nm
|
||||||
.Op Fl NO
|
.Op Fl NOU
|
||||||
.Op Fl S Ar sector-size
|
.Op Fl S Ar sector-size
|
||||||
.Op Fl T Ar disktype
|
.Op Fl T Ar disktype
|
||||||
.Op Fl a Ar maxcontig
|
.Op Fl a Ar maxcontig
|
||||||
@ -65,7 +65,7 @@
|
|||||||
.Op Fl x Ar sectors
|
.Op Fl x Ar sectors
|
||||||
.Ar special
|
.Ar special
|
||||||
.Nm mount_mfs
|
.Nm mount_mfs
|
||||||
.Op Fl N
|
.Op Fl NU
|
||||||
.Op Fl F Ar file
|
.Op Fl F Ar file
|
||||||
.Op Fl T Ar disktype
|
.Op Fl T Ar disktype
|
||||||
.Op Fl a Ar maxcontig
|
.Op Fl a Ar maxcontig
|
||||||
@ -148,6 +148,8 @@ Cause the file system parameters to be printed out
|
|||||||
without really creating the file system.
|
without really creating the file system.
|
||||||
.It Fl O
|
.It Fl O
|
||||||
Create a
|
Create a
|
||||||
|
.It Fl U
|
||||||
|
Enables soft updates on the new filesystem.
|
||||||
.Bx 4.3
|
.Bx 4.3
|
||||||
format filesystem.
|
format filesystem.
|
||||||
This options is primarily used to build root filesystems
|
This options is primarily used to build root filesystems
|
||||||
|
@ -173,6 +173,7 @@ char *mfs_mtpt; /* mount point for mfs */
|
|||||||
struct stat mfs_mtstat; /* stat prior to mount */
|
struct stat mfs_mtstat; /* stat prior to mount */
|
||||||
int Nflag; /* run without writing file system */
|
int Nflag; /* run without writing file system */
|
||||||
int Oflag; /* format as an 4.3BSD 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 fssize; /* file system size */
|
||||||
int ntracks = NTRACKS; /* # tracks/cylinder */
|
int ntracks = NTRACKS; /* # tracks/cylinder */
|
||||||
int nsectors = NSECTORS; /* # sectors/track */
|
int nsectors = NSECTORS; /* # sectors/track */
|
||||||
@ -255,8 +256,8 @@ main(argc, argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
opstring = mfs ?
|
opstring = mfs ?
|
||||||
"NF:T:a:b:c:d:e:f:i:m:o:s:" :
|
"NF:T:Ua: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:";
|
"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)
|
while ((ch = getopt(argc, argv, opstring)) != -1)
|
||||||
switch (ch) {
|
switch (ch) {
|
||||||
case 'N':
|
case 'N':
|
||||||
@ -277,6 +278,9 @@ main(argc, argv)
|
|||||||
case 'F':
|
case 'F':
|
||||||
filename = optarg;
|
filename = optarg;
|
||||||
break;
|
break;
|
||||||
|
case 'U':
|
||||||
|
Uflag = 1;
|
||||||
|
break;
|
||||||
case 'a':
|
case 'a':
|
||||||
if ((maxcontig = atoi(optarg)) <= 0)
|
if ((maxcontig = atoi(optarg)) <= 0)
|
||||||
fatal("%s: bad maximum contiguous blocks",
|
fatal("%s: bad maximum contiguous blocks",
|
||||||
@ -757,6 +761,7 @@ usage()
|
|||||||
#ifdef COMPAT
|
#ifdef COMPAT
|
||||||
fprintf(stderr, "\t-T disktype\n");
|
fprintf(stderr, "\t-T disktype\n");
|
||||||
#endif
|
#endif
|
||||||
|
fprintf(stderr, "\t-U enable soft updates\n");
|
||||||
fprintf(stderr, "\t-a maximum contiguous blocks\n");
|
fprintf(stderr, "\t-a maximum contiguous blocks\n");
|
||||||
fprintf(stderr, "\t-b block size\n");
|
fprintf(stderr, "\t-b block size\n");
|
||||||
fprintf(stderr, "\t-c cylinders/group\n");
|
fprintf(stderr, "\t-c cylinders/group\n");
|
||||||
|
Loading…
Reference in New Issue
Block a user