summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcsapuntz <csapuntz@openbsd.org>1997-11-06 20:27:14 +0000
committercsapuntz <csapuntz@openbsd.org>1997-11-06 20:27:14 +0000
commit7cdac52036a02a1b27764d66d4bd3edc7e55ab3a (patch)
treed96a6455a4e940b5aa7a656206d2ee266bb3772b
parentindent (diff)
downloadwireguard-openbsd-7cdac52036a02a1b27764d66d4bd3edc7e55ab3a.tar.xz
wireguard-openbsd-7cdac52036a02a1b27764d66d4bd3edc7e55ab3a.zip
Added support for enabling soft updates.
-rw-r--r--sbin/tunefs/tunefs.810
-rw-r--r--sbin/tunefs/tunefs.c30
2 files changed, 35 insertions, 5 deletions
diff --git a/sbin/tunefs/tunefs.8 b/sbin/tunefs/tunefs.8
index 5179fbb43a4..faab7e58ee1 100644
--- a/sbin/tunefs/tunefs.8
+++ b/sbin/tunefs/tunefs.8
@@ -1,4 +1,4 @@
-.\" $OpenBSD: tunefs.8,v 1.3 1996/08/02 11:23:34 deraadt Exp $
+.\" $OpenBSD: tunefs.8,v 1.4 1997/11/06 20:27:14 csapuntz Exp $
.\" $NetBSD: tunefs.8,v 1.8 1995/03/18 15:01:29 cgd Exp $
.\"
.\" Copyright (c) 1983, 1991, 1993
@@ -118,6 +118,14 @@ are on the selected file system. More detailed information can be
obtained in the
.Xr dumpfs 8
manual page.
+.It Fl s Ar enable_or_disable
+This option enables soft updates on the file system. Soft updates
+eliminates most synchronous writes to disk by maintaining
+a partial order of writes to the disk. This significantly improves
+meta-data operations (file creation and deletion) at the expense of
+subjecting them to the same potential 30-second delay as file data.
+Recovery is made simpler, however, by maintaining a strict ordering of
+writes to disk.
.El
.Sh SEE ALSO
.Xr fs 5 ,
diff --git a/sbin/tunefs/tunefs.c b/sbin/tunefs/tunefs.c
index db34d979262..185deaeeda8 100644
--- a/sbin/tunefs/tunefs.c
+++ b/sbin/tunefs/tunefs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tunefs.c,v 1.6 1997/10/06 20:22:38 deraadt Exp $ */
+/* $OpenBSD: tunefs.c,v 1.7 1997/11/06 20:27:16 csapuntz Exp $ */
/* $NetBSD: tunefs.c,v 1.10 1995/03/18 15:01:31 cgd Exp $ */
/*
@@ -44,7 +44,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)tunefs.c 8.2 (Berkeley) 4/19/94";
#else
-static char rcsid[] = "$OpenBSD: tunefs.c,v 1.6 1997/10/06 20:22:38 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: tunefs.c,v 1.7 1997/11/06 20:27:16 csapuntz Exp $";
#endif
#endif /* not lint */
@@ -90,7 +90,7 @@ main(argc, argv)
int argc;
char *argv[];
{
- char *cp, *special, *name;
+ char *cp, *special, *name, *action;
struct stat st;
int i;
int Aflag = 0;
@@ -190,6 +190,25 @@ again:
warnx(OPTWARN, "space", "<", MINFREE);
continue;
+ case 's':
+ name = "soft updates";
+ if (argc < 1)
+ errx(10, "-s: missing %s", name);
+ argc--, argv++;
+ if (strcmp(*argv, "enable") == 0) {
+ sblock.fs_flags |= FS_DOSOFTDEP;
+ action = "set";
+ } else if (strcmp(*argv, "disable") == 0) {
+ sblock.fs_flags &= ~FS_DOSOFTDEP;
+ action = "cleared";
+ } else {
+ errx(10, "bad %s (options are %s)",
+ name, "`enable' or `disable'");
+ }
+ warnx("%s %s", name, action);
+ continue;
+
+
case 'o':
name = "optimization preference";
if (argc < 1)
@@ -246,7 +265,8 @@ usage()
"\t-e maximum blocks per file in a cylinder group\n"
"\t-m minimum percentage of free space\n"
"\t-o optimization preference (`space' or `time')\n"
- "\t-p no change - just prints current tuneable settings\n",
+ "\t-p no change - just prints current tuneable settings\n"
+ "\t-s soft updates ('enable' or 'disable')\n",
__progname);
exit(2);
}
@@ -270,6 +290,8 @@ getsb(fs, file)
void
printfs()
{
+ warnx("soft updates: (-s) %s",
+ (sblock.fs_flags & FS_DOSOFTDEP) ? "yes" : "no");
warnx("maximum contiguous block count: (-a) %d",
sblock.fs_maxcontig);
warnx("rotational delay between contiguous blocks: (-d) %d ms",