summaryrefslogtreecommitdiffstats
path: root/sbin/tunefs
diff options
context:
space:
mode:
authorpjd <pjd@FreeBSD.org>2006-10-31 21:52:28 +0000
committerpjd <pjd@FreeBSD.org>2006-10-31 21:52:28 +0000
commitad87251c1a1185717a0f74277ecd4a6def65e583 (patch)
treeb48f4736ca193851013f4dcfe8f64cc8cedffd00 /sbin/tunefs
parent036e929548382eba04c176d581bb24928a5d4155 (diff)
downloadFreeBSD-src-ad87251c1a1185717a0f74277ecd4a6def65e583.zip
FreeBSD-src-ad87251c1a1185717a0f74277ecd4a6def65e583.tar.gz
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
Diffstat (limited to 'sbin/tunefs')
-rw-r--r--sbin/tunefs/tunefs.83
-rw-r--r--sbin/tunefs/tunefs.c49
2 files changed, 45 insertions, 7 deletions
diff --git a/sbin/tunefs/tunefs.8 b/sbin/tunefs/tunefs.8
index ac8641c..e82b42b 100644
--- a/sbin/tunefs/tunefs.8
+++ b/sbin/tunefs/tunefs.8
@@ -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
diff --git a/sbin/tunefs/tunefs.c b/sbin/tunefs/tunefs.c
index e8ab8d3..2b263bb 100644
--- a/sbin/tunefs/tunefs.c
+++ b/sbin/tunefs/tunefs.c
@@ -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",
OpenPOWER on IntegriCloud