summaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authorGrigoriy Orlov <gluk@cvs.openbsd.org>2001-04-06 20:43:32 +0000
committerGrigoriy Orlov <gluk@cvs.openbsd.org>2001-04-06 20:43:32 +0000
commit65a1b707e2d081bfbfe6c798edb82c41ab8be403 (patch)
tree1c3cacd9807632a3a7a61198f0fd424cd3122231 /sbin
parentf6bdf17af468a62e07c78cc9982c18424d050403 (diff)
Replace FFS directory preference algorithm(dirpref) by new one.
It allocates directory inode in the same cylinder group as a parent directory in. This speedup file/directory intensive operations on a big file systems in times. Don't forget to recompile fsck_ffs with updated fs.h or you will get "VALUES IN SUPER BLOCK DISAGREE WITH THOSE IN FIRST ALTERNATE" at the next boot. In any case you can ignore this error safely. Requested by deraadt@
Diffstat (limited to 'sbin')
-rw-r--r--sbin/fsck_ffs/setup.c7
-rw-r--r--sbin/tunefs/tunefs.c34
2 files changed, 37 insertions, 4 deletions
diff --git a/sbin/fsck_ffs/setup.c b/sbin/fsck_ffs/setup.c
index 75c04b77e7a..624efbe3dac 100644
--- a/sbin/fsck_ffs/setup.c
+++ b/sbin/fsck_ffs/setup.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: setup.c,v 1.8 2001/03/02 08:33:55 art Exp $ */
+/* $OpenBSD: setup.c,v 1.9 2001/04/06 20:43:31 gluk Exp $ */
/* $NetBSD: setup.c,v 1.27 1996/09/27 22:45:19 christos Exp $ */
/*
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)setup.c 8.5 (Berkeley) 11/23/94";
#else
-static char rcsid[] = "$OpenBSD: setup.c,v 1.8 2001/03/02 08:33:55 art Exp $";
+static char rcsid[] = "$OpenBSD: setup.c,v 1.9 2001/04/06 20:43:31 gluk Exp $";
#endif
#endif /* not lint */
@@ -459,6 +459,9 @@ readsb(listerr)
memcpy(altsblock.fs_csp, sblock.fs_csp,
sizeof sblock.fs_csp);
altsblock.fs_maxcluster = sblock.fs_maxcluster;
+ altsblock.fs_contigdirs = sblock.fs_contigdirs;
+ altsblock.fs_avgfilesize = sblock.fs_avgfilesize;
+ altsblock.fs_avgfpdir = sblock.fs_avgfpdir;
memcpy(altsblock.fs_fsmnt, sblock.fs_fsmnt,
sizeof sblock.fs_fsmnt);
memcpy(altsblock.fs_sparecon, sblock.fs_sparecon,
diff --git a/sbin/tunefs/tunefs.c b/sbin/tunefs/tunefs.c
index 3a33a94ea25..b63a4eaa332 100644
--- a/sbin/tunefs/tunefs.c
+++ b/sbin/tunefs/tunefs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tunefs.c,v 1.9 2001/03/22 21:30:00 gluk Exp $ */
+/* $OpenBSD: tunefs.c,v 1.10 2001/04/06 20:43:31 gluk 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.9 2001/03/22 21:30:00 gluk Exp $";
+static char rcsid[] = "$OpenBSD: tunefs.c,v 1.10 2001/04/06 20:43:31 gluk Exp $";
#endif
#endif /* not lint */
@@ -172,6 +172,20 @@ again:
sblock.fs_maxbpg = i;
continue;
+ case 'f':
+ name = "average file size";
+ if (argc < 1)
+ errx(10, "-f: missing %s", name);
+ argc--, argv++;
+ i = atoi(*argv);
+ if (i < 0)
+ errx(10, "%s must be >= 0 (was %s)",
+ name, *argv);
+ warnx("%s changes from %d to %d",
+ name, sblock.fs_avgfilesize, i);
+ sblock.fs_avgfilesize = i;
+ continue;
+
case 'm':
name = "minimum percentage of free space";
if (argc < 1)
@@ -191,6 +205,20 @@ again:
warnx(OPTWARN, "space", "<", MINFREE);
continue;
+ case 'n':
+ name = "expected number of files per directory";
+ if (argc < 1)
+ errx(10, "-n: missing %s", name);
+ argc--, argv++;
+ i = atoi(*argv);
+ if (i < 0)
+ errx(10, "%s must be >= 0 (was %s)",
+ name, *argv);
+ warnx("%s changes from %d to %d",
+ name, sblock.fs_avgfpdir, i);
+ sblock.fs_avgfpdir = i;
+ continue;
+
case 's':
name = "soft updates";
if (argc < 1)
@@ -263,7 +291,9 @@ usage()
"\t-a maximum contiguous blocks\n"
"\t-d rotational delay between contiguous blocks\n"
"\t-e maximum blocks per file in a cylinder group\n"
+ "\t-f expected average file size\n"
"\t-m minimum percentage of free space\n"
+ "\t-n expected number of files per directory\n"
"\t-o optimization preference (`space' or `time')\n"
"\t-p no change - just prints current tuneable settings\n"
"\t-s soft updates ('enable' or 'disable')\n",