summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPedro Martelletto <pedro@cvs.openbsd.org>2006-03-09 13:35:03 +0000
committerPedro Martelletto <pedro@cvs.openbsd.org>2006-03-09 13:35:03 +0000
commit164a6b1ad593049aa35d3d58446a7a517a3e75eb (patch)
treea1c2195d552e950ef96fb1fd3bd19f6ebcf93c2c
parentdce26f6ae64a51315f5998964911ac7b83859ced (diff)
Remove option -n from newfs as well as all references to fs_postbl()
Various testing for a while, okay krw@
-rw-r--r--sbin/dumpfs/dumpfs.c28
-rw-r--r--sbin/fsck_ffs/setup.c6
-rw-r--r--sbin/newfs/mkfs.c56
-rw-r--r--sbin/newfs/newfs.85
-rw-r--r--sbin/newfs/newfs.c24
-rw-r--r--sys/ufs/ffs/fs.h9
6 files changed, 33 insertions, 95 deletions
diff --git a/sbin/dumpfs/dumpfs.c b/sbin/dumpfs/dumpfs.c
index dbc0f372a21..b18005a4e3e 100644
--- a/sbin/dumpfs/dumpfs.c
+++ b/sbin/dumpfs/dumpfs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dumpfs.c,v 1.18 2003/06/25 21:23:53 deraadt Exp $ */
+/* $OpenBSD: dumpfs.c,v 1.19 2006/03/09 13:35:02 pedro Exp $ */
/* $NetBSD: dumpfs.c,v 1.12 1997/04/26 05:41:33 lukem Exp $ */
/*
@@ -40,7 +40,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)dumpfs.c 8.2 (Berkeley) 2/2/94";
#else
-static char rcsid[] = "$OpenBSD: dumpfs.c,v 1.18 2003/06/25 21:23:53 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: dumpfs.c,v 1.19 2006/03/09 13:35:02 pedro Exp $";
#endif
#endif /* not lint */
@@ -108,7 +108,7 @@ int
dumpfs(char *name)
{
ssize_t n;
- int fd, c, i, j, k, size;
+ int fd, i, j, size;
if ((fd = open(name, O_RDONLY, 0)) < 0)
goto err;
@@ -199,22 +199,6 @@ dumpfs(char *name)
afs.fs_nrpos);
else
printf("insufficient space to maintain rotational tables\n");
- for (c = 0; c < afs.fs_cpc; c++) {
- printf("\ncylinder number %d:", c);
- for (i = 0; i < afs.fs_nrpos; i++) {
- if (fs_postbl(&afs, c)[i] == -1)
- continue;
- printf("\n position %d:\t", i);
- for (j = fs_postbl(&afs, c)[i], k = 1; ;
- j += fs_rotbl(&afs)[j], k++) {
- printf("%5d", j);
- if (k % 12 == 0)
- printf("\n\t\t");
- if (fs_rotbl(&afs)[j] == 0)
- break;
- }
- }
- }
printf("\ncs[].cs_(nbfree,ndir,nifree,nffree):\n\t");
afs.fs_csp = calloc(1, afs.fs_cssize);
for (i = 0, j = 0; i < afs.fs_cssize; i += afs.fs_bsize, j++) {
@@ -308,12 +292,6 @@ dumpcg(char *name, int fd, int c)
if (cg_blktot(&acg)[i] == 0)
continue;
printf(" c%d:\t(%d)\t", i, cg_blktot(&acg)[i]);
- for (j = 0; j < afs.fs_nrpos; j++) {
- if (afs.fs_cpc > 0 &&
- fs_postbl(&afs, i % afs.fs_cpc)[j] == -1)
- continue;
- printf(" %d", cg_blks(&afs, &acg, i)[j]);
- }
printf("\n");
}
return (0);
diff --git a/sbin/fsck_ffs/setup.c b/sbin/fsck_ffs/setup.c
index 2c6e0a75952..3b07c25d519 100644
--- a/sbin/fsck_ffs/setup.c
+++ b/sbin/fsck_ffs/setup.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: setup.c,v 1.22 2005/12/19 15:18:01 pedro Exp $ */
+/* $OpenBSD: setup.c,v 1.23 2006/03/09 13:35:02 pedro Exp $ */
/* $NetBSD: setup.c,v 1.27 1996/09/27 22:45:19 christos Exp $ */
/*
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)setup.c 8.5 (Berkeley) 11/23/94";
#else
-static const char rcsid[] = "$OpenBSD: setup.c,v 1.22 2005/12/19 15:18:01 pedro Exp $";
+static const char rcsid[] = "$OpenBSD: setup.c,v 1.23 2006/03/09 13:35:02 pedro Exp $";
#endif
#endif /* not lint */
@@ -309,7 +309,7 @@ setup(char *dev)
sblock.fs_postblformat = FS_DYNAMICPOSTBLFMT;
sblock.fs_nrpos = 8;
sblock.fs_postbloff =
- (char *)(&sblock.fs_opostbl[0][0]) -
+ (char *)(&sblock.fs_opostbl_start) -
(char *)(&sblock.fs_firstfield);
sblock.fs_rotbloff = &sblock.fs_space[0] -
(u_char *)(&sblock.fs_firstfield);
diff --git a/sbin/newfs/mkfs.c b/sbin/newfs/mkfs.c
index 1c7629e0b97..27656019802 100644
--- a/sbin/newfs/mkfs.c
+++ b/sbin/newfs/mkfs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mkfs.c,v 1.49 2005/12/19 15:18:01 pedro Exp $ */
+/* $OpenBSD: mkfs.c,v 1.50 2006/03/09 13:35:02 pedro Exp $ */
/* $NetBSD: mkfs.c,v 1.25 1995/06/18 21:35:38 cgd Exp $ */
/*
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)mkfs.c 8.3 (Berkeley) 2/3/94";
#else
-static char rcsid[] = "$OpenBSD: mkfs.c,v 1.49 2005/12/19 15:18:01 pedro Exp $";
+static char rcsid[] = "$OpenBSD: mkfs.c,v 1.50 2006/03/09 13:35:02 pedro Exp $";
#endif
#endif /* not lint */
@@ -76,6 +76,17 @@ static char rcsid[] = "$OpenBSD: mkfs.c,v 1.49 2005/12/19 15:18:01 pedro Exp $";
#define POWEROF2(num) (((num) & ((num) - 1)) == 0)
/*
+ * For each cylinder we keep track of the availability of blocks at different
+ * rotational positions, so that we can lay out the data to be picked
+ * up with minimum rotational latency. NRPOS is the default number of
+ * rotational positions that we distinguish. With NRPOS of 8 the resolution
+ * of our summary information is 2ms for a typical 3600 rpm drive. Caching
+ * and zoning pretty much defeats rotational optimization, so we now use a
+ * default of 1.
+ */
+#define NRPOS 1 /* number distinct rotational positions */
+
+/*
* variables set up by front end.
*/
extern int mfs; /* run as the memory based filesystem */
@@ -100,7 +111,6 @@ extern int density; /* number of bytes per inode */
extern int maxcontig; /* max contiguous blocks to allocate */
extern int rotdelay; /* rotational delay between blocks */
extern int maxbpg; /* maximum blocks per file in a cyl group */
-extern int nrpos; /* # of distinguished rotational positions */
extern int bbsize; /* boot block size */
extern int sbsize; /* superblock size */
extern int avgfilesize; /* expected average file size */
@@ -163,7 +173,7 @@ mkfs(struct partition *pp, char *fsys, int fi, int fo,
mode_t mfsmode, uid_t mfsuid, gid_t mfsgid)
{
long i, mincpc, mincpg, inospercg;
- long cylno, rpos, blk, j, warn = 0;
+ long cylno, j, warn = 0;
long used, mincpgcnt, bpcg;
long mapcramped, inodecramped;
long postblsize, rotblsize, totalsbsize;
@@ -276,7 +286,7 @@ recalc:
sblock.fs_fsize, sblock.fs_bsize,
sblock.fs_bsize / MAXFRAG);
}
- sblock.fs_nrpos = nrpos;
+ sblock.fs_nrpos = NRPOS;
sblock.fs_nindir = sblock.fs_bsize / sizeof(daddr_t);
sblock.fs_inopb = sblock.fs_bsize / sizeof(struct ufs1_dinode);
sblock.fs_nspf = sblock.fs_fsize / sectorsize;
@@ -509,19 +519,11 @@ recalc:
postblsize = sblock.fs_nrpos * sblock.fs_cpc * sizeof(int16_t);
rotblsize = sblock.fs_cpc * sblock.fs_spc / NSPB(&sblock);
totalsbsize = sizeof(struct fs) + rotblsize;
- if (sblock.fs_nrpos == 8 && sblock.fs_cpc <= 16) {
- /* use old static table space */
- sblock.fs_postbloff = (char *)(&sblock.fs_opostbl[0][0]) -
- (char *)(&sblock.fs_firstfield);
- sblock.fs_rotbloff = &sblock.fs_space[0] -
- (u_char *)(&sblock.fs_firstfield);
- } else {
- /* use dynamic table space */
- sblock.fs_postbloff = &sblock.fs_space[0] -
- (u_char *)(&sblock.fs_firstfield);
- sblock.fs_rotbloff = sblock.fs_postbloff + postblsize;
- totalsbsize += postblsize;
- }
+ /* use dynamic table space */
+ sblock.fs_postbloff = &sblock.fs_space[0] -
+ (u_char *)(&sblock.fs_firstfield);
+ sblock.fs_rotbloff = sblock.fs_postbloff + postblsize;
+ totalsbsize += postblsize;
if (totalsbsize > SBSIZE || fragroundup(&sblock, totalsbsize) > SBSIZE
|| sblock.fs_nsect > (1 << NBBY) * NSPB(&sblock)) {
printf("%s %s %d %s %d.%s",
@@ -533,24 +535,6 @@ recalc:
goto next;
}
sblock.fs_sbsize = fragroundup(&sblock, totalsbsize);
- /*
- * calculate the available blocks for each rotational position
- */
- for (cylno = 0; cylno < sblock.fs_cpc; cylno++)
- for (rpos = 0; rpos < sblock.fs_nrpos; rpos++)
- fs_postbl(&sblock, cylno)[rpos] = -1;
- for (i = (rotblsize - 1) * sblock.fs_frag;
- i >= 0; i -= sblock.fs_frag) {
- cylno = cbtocylno(&sblock, i);
- rpos = cbtorpos(&sblock, i);
- blk = fragstoblks(&sblock, i);
- if (fs_postbl(&sblock, cylno)[rpos] == -1)
- fs_rotbl(&sblock)[blk] = 0;
- else
- fs_rotbl(&sblock)[blk] =
- fs_postbl(&sblock, cylno)[rpos] - blk;
- fs_postbl(&sblock, cylno)[rpos] = blk;
- }
next:
/*
* Compute/validate number of cylinder groups.
diff --git a/sbin/newfs/newfs.8 b/sbin/newfs/newfs.8
index 0ed183bbcd5..ff7019ac9b9 100644
--- a/sbin/newfs/newfs.8
+++ b/sbin/newfs/newfs.8
@@ -1,4 +1,4 @@
-.\" $OpenBSD: newfs.8,v 1.45 2005/06/27 10:07:15 jmc Exp $
+.\" $OpenBSD: newfs.8,v 1.46 2006/03/09 13:35:02 pedro Exp $
.\" $NetBSD: newfs.8,v 1.12 1995/03/18 14:58:41 cgd Exp $
.\"
.\" Copyright (c) 1983, 1987, 1991, 1993, 1994
@@ -192,9 +192,6 @@ for more details on how to set this option.
.It Fl N
Causes the file system parameters to be printed out
without really creating the file system.
-.It Fl n Ar nrpos
-The number of distinct rotational positions.
-The default is 1.
.It Fl O
Creates a
.Bx 4.3
diff --git a/sbin/newfs/newfs.c b/sbin/newfs/newfs.c
index bf9643cfa9f..989439c7a48 100644
--- a/sbin/newfs/newfs.c
+++ b/sbin/newfs/newfs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: newfs.c,v 1.51 2005/10/28 19:10:57 otto Exp $ */
+/* $OpenBSD: newfs.c,v 1.52 2006/03/09 13:35:02 pedro Exp $ */
/* $NetBSD: newfs.c,v 1.20 1996/05/16 07:13:03 thorpej Exp $ */
/*
@@ -40,7 +40,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)newfs.c 8.8 (Berkeley) 4/18/94";
#else
-static char rcsid[] = "$OpenBSD: newfs.c,v 1.51 2005/10/28 19:10:57 otto Exp $";
+static char rcsid[] = "$OpenBSD: newfs.c,v 1.52 2006/03/09 13:35:02 pedro Exp $";
#endif
#endif /* not lint */
@@ -132,18 +132,6 @@ u_short dkcksum(struct disklabel *);
*/
#define NFPI 4
-/*
- * For each cylinder we keep track of the availability of blocks at different
- * rotational positions, so that we can lay out the data to be picked
- * up with minimum rotational latency. NRPOS is the default number of
- * rotational positions that we distinguish. With NRPOS of 8 the resolution
- * of our summary information is 2ms for a typical 3600 rpm drive. Caching
- * and zoning pretty much defeats rotational optimization, so we now use a
- * default of 1.
- */
-#define NRPOS 1 /* number distinct rotational positions */
-
-
int mfs; /* run as the memory based filesystem */
int Nflag; /* run without writing file system */
int Oflag; /* format as an 4.3BSD file system */
@@ -170,7 +158,6 @@ int density; /* number of bytes per inode */
int maxcontig = 0; /* max contiguous blocks to allocate */
int rotdelay = ROTDELAY; /* rotational delay between blocks */
int maxbpg; /* maximum blocks per file in a cyl group */
-int nrpos = NRPOS; /* # of distinguished rotational positions */
int avgfilesize = AVFILESIZ;/* expected average file size */
int avgfilesperdir = AFPDIR;/* expected number of files per directory */
int bbsize = BBSIZE; /* boot block size */
@@ -233,7 +220,7 @@ main(int argc, char *argv[])
opstring = mfs ?
"P:T:a:b:c:d:e:f:i:m:o:s:" :
- "NOS:T:a:b:c:d:e:f:g:h:i:k:l:m:n:o:p:qr:s:t:u:x:z:";
+ "NOS:T:a:b:c:d:e:f:g:h:i:k:l:m:o:p:qr:s:t:u:x:z:";
while ((ch = getopt(argc, argv, opstring)) != -1) {
switch (ch) {
case 'N':
@@ -302,11 +289,6 @@ main(int argc, char *argv[])
if ((minfree = atoi(optarg)) < 0 || minfree > 99)
fatal("%s: bad free space %%\n", optarg);
break;
- case 'n':
- if ((nrpos = atoi(optarg)) <= 0)
- fatal("%s: bad rotational layout count\n",
- optarg);
- break;
case 'o':
if (mfs)
getmntopts(optarg, mopts, &mntflags);
diff --git a/sys/ufs/ffs/fs.h b/sys/ufs/ffs/fs.h
index 8899cefc07e..dae84da2c74 100644
--- a/sys/ufs/ffs/fs.h
+++ b/sys/ufs/ffs/fs.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: fs.h,v 1.18 2005/12/28 20:48:18 pedro Exp $ */
+/* $OpenBSD: fs.h,v 1.19 2006/03/09 13:35:02 pedro Exp $ */
/* $NetBSD: fs.h,v 1.6 1995/04/12 21:21:02 mycroft Exp $ */
/*
@@ -267,6 +267,8 @@ struct fs {
/* actually longer */
};
+#define fs_opostbl_start fs_opostbl[0][0]
+
/*
* Filesystem identification
*/
@@ -303,11 +305,6 @@ struct fs {
/*
* Macros for access to superblock array structures
*/
-#define fs_postbl(fs, cylno) \
- (((fs)->fs_postblformat == FS_42POSTBLFMT) \
- ? ((fs)->fs_opostbl[cylno]) \
- : ((int16_t *)((u_int8_t *)(fs) + \
- (fs)->fs_postbloff) + (cylno) * (fs)->fs_nrpos))
#define fs_rotbl(fs) \
(((fs)->fs_postblformat == FS_42POSTBLFMT) \
? ((fs)->fs_space) \