Add -J flag to both newfs(8) and tunefs(8) which allows to enable gjournal
support. I left -j flag for UFS journal implementation which we may gain at some point. Sponsored by: home.pl
This commit is contained in:
parent
1a60c7fc8e
commit
868c68ed1d
@ -135,6 +135,8 @@ mkfs(struct partition *pp, char *fsys)
|
||||
sblock.fs_flags |= FS_DOSOFTDEP;
|
||||
if (Lflag)
|
||||
strlcpy(sblock.fs_volname, volumelabel, MAXVOLLEN);
|
||||
if (Jflag)
|
||||
sblock.fs_flags |= FS_GJOURNAL;
|
||||
if (lflag)
|
||||
sblock.fs_flags |= FS_MULTILABEL;
|
||||
/*
|
||||
|
@ -36,7 +36,7 @@
|
||||
.Nd construct a new UFS1/UFS2 file system
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Op Fl NUln
|
||||
.Op Fl JNUln
|
||||
.Op Fl L Ar volname
|
||||
.Op Fl O Ar filesystem-type
|
||||
.Op Fl S Ar sector-size
|
||||
@ -77,6 +77,8 @@ has numerous options to allow the defaults to be selectively overridden.
|
||||
.Pp
|
||||
The following options define the general layout policies:
|
||||
.Bl -tag -width indent
|
||||
.It Fl J
|
||||
Enable journaling on the new file system via gjournal.
|
||||
.It Fl L Ar volname
|
||||
Add a volume label to the new file system.
|
||||
.It Fl N
|
||||
|
@ -117,6 +117,7 @@ int Oflag = 2; /* file system format (1 => UFS1, 2 => UFS2) */
|
||||
int Rflag; /* regression test */
|
||||
int Uflag; /* enable soft updates for file system */
|
||||
int Eflag = 0; /* exit in middle of newfs for testing */
|
||||
int Jflag; /* enable gjournal for file system */
|
||||
int lflag; /* enable multilabel for file system */
|
||||
int nflag; /* do not create .snap directory */
|
||||
quad_t fssize; /* file system size */
|
||||
@ -156,11 +157,14 @@ main(int argc, char *argv[])
|
||||
off_t mediasize;
|
||||
|
||||
while ((ch = getopt(argc, argv,
|
||||
"EL:NO:RS:T:Ua:b:c:d:e:f:g:h:i:lm:no:s:")) != -1)
|
||||
"EJL:NO:RS:T:Ua:b:c:d:e:f:g:h:i:lm:no:s:")) != -1)
|
||||
switch (ch) {
|
||||
case 'E':
|
||||
Eflag++;
|
||||
break;
|
||||
case 'J':
|
||||
Jflag = 1;
|
||||
break;
|
||||
case 'L':
|
||||
volumelabel = optarg;
|
||||
i = -1;
|
||||
|
@ -49,6 +49,7 @@ extern int Oflag; /* build UFS1 format file system */
|
||||
extern int Rflag; /* regression test */
|
||||
extern int Uflag; /* enable soft updates for file system */
|
||||
extern int Eflag; /* exit as if error, for testing */
|
||||
extern int Jflag; /* enable gjournal for file system */
|
||||
extern int lflag; /* enable multilabel MAC for file system */
|
||||
extern int nflag; /* do not create .snap directory */
|
||||
extern quad_t fssize; /* file system size */
|
||||
|
@ -40,6 +40,7 @@
|
||||
.Op Fl a Cm enable | disable
|
||||
.Op Fl e Ar maxbpg
|
||||
.Op Fl f Ar avgfilesize
|
||||
.Op Fl J Cm enable | disable
|
||||
.Op Fl L Ar volname
|
||||
.Op Fl l Cm enable | disable
|
||||
.Op Fl m Ar minfree
|
||||
@ -87,6 +88,8 @@ For file systems with exclusively large files,
|
||||
this parameter should be set higher.
|
||||
.It Fl f Ar avgfilesize
|
||||
Specify the expected average file size.
|
||||
.It Fl J Cm enable | disable
|
||||
Turn on/off GJournal flag.
|
||||
.It Fl L Ar volname
|
||||
Add/modify an optional file system volume label.
|
||||
.It Fl l Cm enable | disable
|
||||
|
@ -76,11 +76,11 @@ void printfs(void);
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
char *avalue, *Lvalue, *lvalue, *nvalue;
|
||||
char *avalue, *Jvalue, *Lvalue, *lvalue, *nvalue;
|
||||
const char *special, *on;
|
||||
const char *name;
|
||||
int active;
|
||||
int Aflag, aflag, eflag, evalue, fflag, fvalue, Lflag, lflag;
|
||||
int Aflag, aflag, eflag, evalue, fflag, fvalue, Jflag, Lflag, lflag;
|
||||
int mflag, mvalue, nflag, oflag, ovalue, pflag, sflag, svalue;
|
||||
int ch, found_arg, i;
|
||||
const char *chg[2];
|
||||
@ -89,13 +89,13 @@ main(int argc, char *argv[])
|
||||
|
||||
if (argc < 3)
|
||||
usage();
|
||||
Aflag = aflag = eflag = fflag = Lflag = lflag = mflag = 0;
|
||||
Aflag = aflag = eflag = fflag = Jflag = Lflag = lflag = mflag = 0;
|
||||
nflag = oflag = pflag = sflag = 0;
|
||||
avalue = Lvalue = lvalue = nvalue = NULL;
|
||||
avalue = Jvalue = Lvalue = lvalue = nvalue = NULL;
|
||||
evalue = fvalue = mvalue = ovalue = svalue = 0;
|
||||
active = 0;
|
||||
found_arg = 0; /* At least one arg is required. */
|
||||
while ((ch = getopt(argc, argv, "Aa:e:f:L:l:m:n:o:ps:")) != -1)
|
||||
while ((ch = getopt(argc, argv, "Aa:e:f:J:L:l:m:n:o:ps:")) != -1)
|
||||
switch (ch) {
|
||||
|
||||
case 'A':
|
||||
@ -135,6 +135,19 @@ main(int argc, char *argv[])
|
||||
fflag = 1;
|
||||
break;
|
||||
|
||||
case 'J':
|
||||
found_arg = 1;
|
||||
name = "gjournaled file system";
|
||||
Jvalue = optarg;
|
||||
if (strcmp(Jvalue, "enable") &&
|
||||
strcmp(Jvalue, "disable")) {
|
||||
errx(10, "bad %s (options are %s)",
|
||||
name, "`enable' or `disable'");
|
||||
}
|
||||
Jflag = 1;
|
||||
break;
|
||||
|
||||
|
||||
case 'L':
|
||||
found_arg = 1;
|
||||
name = "volume label";
|
||||
@ -282,6 +295,26 @@ main(int argc, char *argv[])
|
||||
sblock.fs_avgfilesize = fvalue;
|
||||
}
|
||||
}
|
||||
if (Jflag) {
|
||||
name = "gjournal";
|
||||
if (strcmp(Jvalue, "enable") == 0) {
|
||||
if (sblock.fs_flags & FS_GJOURNAL) {
|
||||
warnx("%s remains unchanged as enabled", name);
|
||||
} else {
|
||||
sblock.fs_flags |= FS_GJOURNAL;
|
||||
warnx("%s set", name);
|
||||
}
|
||||
} else if (strcmp(Jvalue, "disable") == 0) {
|
||||
if ((~sblock.fs_flags & FS_GJOURNAL) ==
|
||||
FS_GJOURNAL) {
|
||||
warnx("%s remains unchanged as disabled",
|
||||
name);
|
||||
} else {
|
||||
sblock.fs_flags &= ~FS_GJOURNAL;
|
||||
warnx("%s cleared", name);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (lflag) {
|
||||
name = "multilabel";
|
||||
if (strcmp(lvalue, "enable") == 0) {
|
||||
@ -389,8 +422,8 @@ usage(void)
|
||||
{
|
||||
fprintf(stderr, "%s\n%s\n%s\n%s\n",
|
||||
"usage: tunefs [-A] [-a enable | disable] [-e maxbpg] [-f avgfilesize]",
|
||||
" [-L volname] [-l enable | disable] [-m minfree]",
|
||||
" [-n enable | disable] [-o space | time] [-p]",
|
||||
" [-J enable | disable ] [-L volname] [-l enable | disable]",
|
||||
" [-m minfree] [-n enable | disable] [-o space | time] [-p]",
|
||||
" [-s avgfpdir] special | filesystem");
|
||||
exit(2);
|
||||
}
|
||||
@ -404,6 +437,8 @@ printfs(void)
|
||||
(sblock.fs_flags & FS_MULTILABEL)? "enabled" : "disabled");
|
||||
warnx("soft updates: (-n) %s",
|
||||
(sblock.fs_flags & FS_DOSOFTDEP)? "enabled" : "disabled");
|
||||
warnx("gjournal: (-J) %s",
|
||||
(sblock.fs_flags & FS_GJOURNAL)? "enabled" : "disabled");
|
||||
warnx("maximum blocks per file in a cylinder group: (-e) %d",
|
||||
sblock.fs_maxbpg);
|
||||
warnx("average file size: (-f) %d",
|
||||
|
Loading…
x
Reference in New Issue
Block a user