diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2007-04-02 20:20:40 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2007-04-02 20:20:40 +0000 |
commit | ba7fcf757a5b9071071703809042c6c0a3648ee3 (patch) | |
tree | 4b1a71edc128f712d25155753093a0d8b120aba7 /sbin | |
parent | 8698f83560263a8052aad378bbf8504be37aab3d (diff) |
Modern disks do bad sector replacement themselves. There is no
need to reserve space for them in the filesystem itself.
OK deraadt@ pedro@
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/newfs/mkfs.c | 7 | ||||
-rw-r--r-- | sbin/newfs/newfs.8 | 16 | ||||
-rw-r--r-- | sbin/newfs/newfs.c | 36 |
3 files changed, 8 insertions, 51 deletions
diff --git a/sbin/newfs/mkfs.c b/sbin/newfs/mkfs.c index 045e00ae28a..d2e954395e5 100644 --- a/sbin/newfs/mkfs.c +++ b/sbin/newfs/mkfs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mkfs.c,v 1.51 2007/03/19 13:27:47 pedro Exp $ */ +/* $OpenBSD: mkfs.c,v 1.52 2007/04/02 20:20:39 millert 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.51 2007/03/19 13:27:47 pedro Exp $"; +static char rcsid[] = "$OpenBSD: mkfs.c,v 1.52 2007/04/02 20:20:39 millert Exp $"; #endif #endif /* not lint */ @@ -95,7 +95,6 @@ extern int Oflag; /* format as an 4.3BSD file system */ extern int fssize; /* file system size */ extern int ntracks; /* # tracks/cylinder */ extern int nsectors; /* # sectors/track */ -extern int nphyssectors; /* # sectors/track including spares */ extern int secpercyl; /* sectors per cylinder */ extern int sectorsize; /* bytes/sector */ extern int rpm; /* revolutions/minute of drive */ @@ -507,7 +506,7 @@ recalc: */ sblock.fs_interleave = interleave; sblock.fs_trackskew = trackskew; - sblock.fs_npsect = nphyssectors; + sblock.fs_npsect = sblock.fs_nsect; sblock.fs_postblformat = FS_DYNAMICPOSTBLFMT; sblock.fs_sbsize = fragroundup(&sblock, sizeof(struct fs)); if (sblock.fs_sbsize > SBSIZE) diff --git a/sbin/newfs/newfs.8 b/sbin/newfs/newfs.8 index 0ecff04f0da..34fb154f2de 100644 --- a/sbin/newfs/newfs.8 +++ b/sbin/newfs/newfs.8 @@ -1,4 +1,4 @@ -.\" $OpenBSD: newfs.8,v 1.49 2006/11/14 10:28:11 otto Exp $ +.\" $OpenBSD: newfs.8,v 1.50 2007/04/02 20:20:39 millert Exp $ .\" $NetBSD: newfs.8,v 1.12 1995/03/18 14:58:41 cgd Exp $ .\" .\" Copyright (c) 1983, 1987, 1991, 1993, 1994 @@ -53,13 +53,11 @@ .Op Fl l Ar interleave .Op Fl m Ar free-space .Op Fl o Ar optimization -.Op Fl p Ar sectors .Op Fl r Ar revolutions .Op Fl S Ar sector-size .Op Fl s Ar size .Op Fl t Ar fstype .Op Fl u Ar sectors -.Op Fl x Ar sectors .Op Fl z Ar tracks .Ar special .Ek @@ -256,10 +254,6 @@ specified as the denominator of the ratio: .Dl sectors read/sectors passed over Thus an interleave of 1/1 implies contiguous layout, while 1/2 implies logical sector 0 is separated by one sector from logical sector 1. -.It Fl p Ar sectors -Spare sectors (bad sector replacements) are physical sectors that occupy -space at the end of each track. -They are not counted as part of the sectors/track .Pq Fl u since they are not available to the file system for data allocation. .It Fl r Ar revolutions @@ -273,14 +267,6 @@ will be smart enough to run the alternate newfs_XXX program instead. .It Fl u Ar sectors The number of sectors per track available for data allocation by the file system. -This does not include sectors reserved at the end of each track for bad -block replacement (see the -.Fl p -option). -.It Fl x Ar sectors -Spare sectors (bad sector replacements) are physical sectors that occupy -space at the end of the last track in the cylinder. -They are deducted from the sectors/track .Pq Fl u of the last track of each cylinder since they are not available to the file system for data allocation. diff --git a/sbin/newfs/newfs.c b/sbin/newfs/newfs.c index 989439c7a48..36d7a7eac44 100644 --- a/sbin/newfs/newfs.c +++ b/sbin/newfs/newfs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: newfs.c,v 1.52 2006/03/09 13:35:02 pedro Exp $ */ +/* $OpenBSD: newfs.c,v 1.53 2007/04/02 20:20:39 millert 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.52 2006/03/09 13:35:02 pedro Exp $"; +static char rcsid[] = "$OpenBSD: newfs.c,v 1.53 2007/04/02 20:20:39 millert Exp $"; #endif #endif /* not lint */ @@ -138,10 +138,7 @@ int Oflag; /* format as an 4.3BSD file system */ int fssize; /* file system size */ int ntracks; /* # tracks/cylinder */ int nsectors; /* # sectors/track */ -int nphyssectors; /* # sectors/track including spares */ int secpercyl; /* sectors per cylinder */ -int trackspares = -1; /* spare sectors per track */ -int cylspares = -1; /* spare sectors per cylinder */ int sectorsize; /* bytes/sector */ int realsectorsize; /* bytes/sector in hardware */ int rpm; /* revolutions/minute of drive */ @@ -220,7 +217,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:o:p:qr:s:t:u:x:z:"; + "NOS:T:a:b:c:d:e:f:g:h:i:k:l:m:o:qr:s:t:u:z:"; while ((ch = getopt(argc, argv, opstring)) != -1) { switch (ch) { case 'N': @@ -302,11 +299,6 @@ main(int argc, char *argv[]) "preference: use `space' or `time'."); } break; - case 'p': - if ((trackspares = atoi(optarg)) < 0) - fatal("%s: bad spare sectors per track", - optarg); - break; case 'q': quiet = 1; break; @@ -331,11 +323,6 @@ main(int argc, char *argv[]) if ((nsectors = atoi(optarg)) <= 0) fatal("%s: bad sectors/track", optarg); break; - case 'x': - if ((cylspares = atoi(optarg)) < 0) - fatal("%s: bad spare sectors per cylinder", - optarg); - break; #ifdef MFS case 'P': pop = optarg; @@ -542,18 +529,7 @@ havelabel: fprintf(stderr, "because minfree is less than %d%%\n", MINFREE); opt = FS_OPTSPACE; } - if (trackspares == -1) { - trackspares = lp->d_sparespertrack; - if (trackspares < 0) - trackspares = 0; - } - nphyssectors = nsectors + trackspares; - if (cylspares == -1) { - cylspares = lp->d_sparespercyl; - if (cylspares < 0) - cylspares = 0; - } - secpercyl = nsectors * ntracks - cylspares; + secpercyl = nsectors * ntracks; if (secpercyl != lp->d_secpercyl) fprintf(stderr, "%s (%d) %s (%lu)\n", "Warning: calculated sectors per cylinder", secpercyl, @@ -572,7 +548,6 @@ havelabel: sectorsize = DEV_BSIZE; nsectors /= secperblk; - nphyssectors /= secperblk; secpercyl /= secperblk; fssize /= secperblk; pp->p_size /= secperblk; @@ -581,7 +556,6 @@ havelabel: sectorsize = DEV_BSIZE; nsectors *= blkpersec; - nphyssectors *= blkpersec; secpercyl *= blkpersec; fssize *= blkpersec; pp->p_size *= blkpersec; @@ -817,12 +791,10 @@ struct fsoptions { { "-m minimum free space %%", 1 }, { "-n number of distinguished rotational positions", 0 }, { "-o optimization preference (`space' or `time')", 1 }, - { "-p spare sectors per track", 0 }, { "-r revolutions/minute", 0 }, { "-s file system size (sectors)", 1 }, { "-t file system type", 0 }, { "-u sectors/track", 0 }, - { "-x spare sectors per cylinder", 0 }, { "-z tracks/cylinder", 0 }, { NULL, NULL } }; |