Commit Graph

151 Commits

Author SHA1 Message Date
Kirk McKusick
33493b1820 Correctly calculate the initial number of fragments in a filesystem
so that fsck does not complain with `SUMMARY BLK COUNT(S) WRONG IN
SUPERBLK' the first time it is run on a new filesystem.

Reported by:	Poul-Henning Kamp <phk@freebsd.org>
Sponsored by:   DARPA & NAI Labs.
2002-12-02 19:31:53 +00:00
Kirk McKusick
41e20344a2 Add some more checks to newfs so that it will not build filesystems
that the kernel will refuse to mount. Specifically it now enforces
the MAXBSIZE blocksize limit. This update also fixes a problem where
newfs could segment fault if the selected fragment size was too large.

PR:		bin/30959
Submitted by:	Ceri Davies <setantae@submonkey.net>
Sponsored by:   DARPA & NAI Labs.
2002-11-30 18:28:26 +00:00
Kirk McKusick
ada981b228 Create a new 32-bit fs_flags word in the superblock. Add code to move
the old 8-bit fs_old_flags to the new location the first time that the
filesystem is mounted by a new kernel. One of the unused flags in
fs_old_flags is used to indicate that the flags have been moved.
Leave the fs_old_flags word intact so that it will work properly if
used on an old kernel.

Change the fs_sblockloc superblock location field to be in units
of bytes instead of in units of filesystem fragments. The old units
did not work properly when the fragment size exceeeded the superblock
size (8192). Update old fs_sblockloc values at the same time that
the flags are moved.

Suggested by:	BOUWSMA Barry <freebsd-misuser@netscum.dyndns.dk>
Sponsored by:   DARPA & NAI Labs.
2002-11-27 02:18:58 +00:00
Kirk McKusick
59a825617f Properly calculate the initial number of fragments in a large filesystem.
Sponsored by:   DARPA & NAI Labs.
2002-11-15 23:50:14 +00:00
Kirk McKusick
ecfc865a4b Bound the size of the superblock to SBLOCKSIZE.
Submitted by:	BOUWSMA Beery <freebsd-misuser@netscum.dyndns.dk>
Sponsored by:	DARPA & NAI Labs.
2002-10-18 23:17:30 +00:00
Poul-Henning Kamp
3f8322d6b8 Remove a comma trailing an if clause.
According to Kirk: "Luckily, the statement is usually true".

Spotted by:	FlexeLint
2002-10-01 17:31:28 +00:00
Mike Barcroft
89fdc4e117 Use the standardized CHAR_BIT constant instead of NBBY in userland. 2002-09-25 04:06:37 +00:00
Poul-Henning Kamp
1851342297 Failure to rewrite the disklabel should not be fatal.
Sponsored by:	DARPA & NAI Labs.
2002-09-22 09:41:41 +00:00
Tom Rhodes
5af4935a22 Fix some 'SYNOPSIS' and 'usage' messages. 2002-08-27 00:49:27 +00:00
Tom Rhodes
ce66ddb763 s/filesystem/file system/g as discussed on -developers 2002-08-21 18:11:48 +00:00
Ruslan Ermilov
3e40554f06 mdoc(7) police: Consistently name options' arguments in the SYNOPSIS and DESCRIPTION sections.. 2002-08-13 13:13:20 +00:00
Ollivier Robert
752c7d0862 di_createtime -> di_birthtime.
Submitted by:	Udo Schweigert <Udo.Schweigert@siemens.com>
2002-07-17 10:31:38 +00:00
Bruce Evans
ffcaf36b2c Fixed 4 printf format errors that were fatal on alphas. %qd is not even
suitable for printing quad_t's since it is equivalent to %lld but quad_t
is unsigned long on alphas.  quad_t shouldn't be used anyway.
2002-07-11 17:49:41 +00:00
Philippe Charnier
e1205e80e5 The .Nm utility 2002-07-06 19:34:18 +00:00
Kirk McKusick
5e5d87ff36 Get rid of paranoia that zeros the boot block area as this has
bad effect on existing bootstraps.

Submitted by:	Jake Burkholder <jake@locore.ca>
Sponsored by:	DARPA & NAI Labs.
2002-06-22 22:44:09 +00:00
Kirk McKusick
1c85e6a35d This commit adds basic support for the UFS2 filesystem. The UFS2
filesystem expands the inode to 256 bytes to make space for 64-bit
block pointers. It also adds a file-creation time field, an ability
to use jumbo blocks per inode to allow extent like pointer density,
and space for extended attributes (up to twice the filesystem block
size worth of attributes, e.g., on a 16K filesystem, there is space
for 32K of attributes). UFS2 fully supports and runs existing UFS1
filesystems. New filesystems built using newfs can be built in either
UFS1 or UFS2 format using the -O option. In this commit UFS1 is
the default format, so if you want to build UFS2 format filesystems,
you must specify -O 2. This default will be changed to UFS2 when
UFS2 proves itself to be stable. In this commit the boot code for
reading UFS2 filesystems is not compiled (see /sys/boot/common/ufsread.c)
as there is insufficient space in the boot block. Once the size of the
boot block is increased, this code can be defined.

Things to note: the definition of SBSIZE has changed to SBLOCKSIZE.
The header file <ufs/ufs/dinode.h> must be included before
<ufs/ffs/fs.h> so as to get the definitions of ufs2_daddr_t and
ufs_lbn_t.

Still TODO:
Verify that the first level bootstraps work for all the architectures.
Convert the utility ffsinfo to understand UFS2 and test growfs.
Add support for the extended attribute storage. Update soft updates
to ensure integrity of extended attribute storage. Switch the
current extended attribute interfaces to use the extended attribute
storage. Add the extent like functionality (framework is there,
but is currently never used).

Sponsored by: DARPA & NAI Labs.
Reviewed by:	Poul-Henning Kamp <phk@freebsd.org>
2002-06-21 06:18:05 +00:00
Tom Rhodes
3468b317cb more file system > filesystem 2002-05-16 04:10:46 +00:00
Poul-Henning Kamp
4ab9c1d126 Remove the -v option, it is now default behaviour.
Sponsored by:	DARPA & NAI Labs
2002-04-24 12:27:03 +00:00
Poul-Henning Kamp
9aba332745 Continue the cleanup preparations for UFS2 (& GEOM):
Use only one filedescriptor.  Open in R/O or R/W based in the '-N' option.
Make the filedescriptor a global variable instead of passing it around
as semi-global variable(s).

Remove the undocumented ability to specify type without '-T' option.

Replace fatal() with straight err(3)/errx(3).  Save calls to strerror()
where applicable.  Loose the progname variable.

Get the sense of the cpgflag test correct so we only issue warnings if
people specify cpg and can't get that.  It can be argued that this
should be an error.

Remove the check to see if the disk is mounted:  Open for writing
would fail if it were mounted.

Attempt to get the sectorsize and mediasize with the generic disk
ioctls, fall back to disklabel and /etc/disktab as we can.

Notice that on-disk labels still take precedence over /etc/disktab,
this is probably wrong, but not as wrong as the entire concept of
/etc/disktab is.

Sponsored by:   DARPA & NAI Labs.
2002-04-24 11:44:02 +00:00
Poul-Henning Kamp
ebdb43a2f8 bbsize and sbsize cannot ever be trusted from the disklabel, in
particular as there may not be one.  Remove #if 0'ed code which might
mislead people to think otherwise.

unifdef -ULOSTDIR, fsck can make lost+found on the fly.

Sponsored by:	DARPA & NAI Labs
2002-04-07 14:57:57 +00:00
Bruce Evans
73c36e3672 Fixed some style bugs in axings. Whitespace before __P was not axed when
__P was axed.  The ordering of several things was bogotified by axing
ifdefs.
2002-04-04 09:56:51 +00:00
Bruce Evans
a2f4e30c8c Fixed some English errors in previous commit.
Fixed some style bugs in the removal of __P(()).  Whitespace before
"__P((" was not removed.
2002-04-04 09:45:11 +00:00
Poul-Henning Kamp
1f35193bdc Add more DWIM/autoadjustment and less evil style(9) banned exit(2) codes.
Add some missing statics.

Sponsored by: DARPA & NAI Labs.
2002-04-03 20:48:05 +00:00
Poul-Henning Kamp
fa8d75e0a1 Unifdef -DCOMPAT 2002-04-03 19:53:09 +00:00
Poul-Henning Kamp
5dccd5c649 Swing the axe and remove some archaic features from newfs which modern
diskdrives do neither need nor want:

	-O create a 4.3BSD format filesystem
	-d rotational delay between contiguous blocks
	-k sector 0 skew, per track
	-l hardware sector interleave
	-n number of distinguished rotational positions
	-p spare sectors per track
	-r revolutions/minute
	-t tracks/cylinder
	-x spare sectors per cylinder

No change in the produced filesystem image unless one or more of
these options were used.

Approved by:	mckusick
2002-03-20 07:16:15 +00:00
Poul-Henning Kamp
89fb8ee796 Add the undocumented -R option to disable randomness for regression-testing.
Add a couple of simple regression tests accessible with "make test", they
depend on the md(4) driver.

FYI I have also tried running the test against a week old newfs and it
passed.
2002-03-19 21:05:29 +00:00
Poul-Henning Kamp
8409849dd0 Further cleanups. 2002-03-19 20:01:38 +00:00
Ian Dowse
475df34ac2 Replace a number of similar for' loops with a new ilog2()' function
that computes the base-2 log of a power of 2.
2002-03-19 17:39:01 +00:00
Ian Dowse
bf57cced53 Complete the ANSIfication of newfs by converting function declarations
to C89 style.
2002-03-19 17:20:02 +00:00
Ian Dowse
f7b48c89c8 The FSIRAND code is always compiled in, and it is unlikely that
anyone needs a newfs without it. Remove the #ifdef's from around
the code and the -DFSIRAND from the Makefile. Also remove redundant
declarations of random() and srandomdev().
2002-03-19 17:03:14 +00:00
Ian Dowse
9710700cb1 Remove the ancient STANDALONE code.
Approved by:	phk
2002-03-19 16:47:20 +00:00
Ian Dowse
af53d6d86e Remove yet more vestiges of mount_mfs. 2002-03-18 15:31:44 +00:00
Bruce Evans
0c08079e26 Fixed some style bugs (mainly ones not fixed or made worse by rev.1.44).
Don't use ISO string concatentation to obfuscate long single-line
messages...
2002-03-18 03:04:58 +00:00
Bruce Evans
63dab85cea Fixed some style bugs (mainly ones not fixed or made worse by rev.1.41).
Old code obfuscates long (but single-line) messages by printing them in
pieces using %s.  Rev.1.41 obfuscated some new long messages using ISO
string concatenation.  This commit only fixes the new obfuscations.
2002-03-18 02:43:14 +00:00
Bruce Evans
3ac7f11229 Removed vestiges of mount_mfs. Sorted the Makefile a bit. 2002-03-18 02:23:43 +00:00
Bruce Evans
3f305db0a2 Fixed 2 layers of breakage of WARNS. Setting WARNS unconditionally to
0 was bad and setting it unconditionally to 2 was worse.
2002-03-18 02:13:38 +00:00
Poul-Henning Kamp
345b78a301 Remove __P() and register.
Set WARNS=2

This is the beginning of a pre-UFS2 cleanup of newfs.

Sponsored by:	DARPA, NAI Labs
2002-03-17 09:01:41 +00:00
Sheldon Hearn
3626f83327 Update the default newfs block and fragment sizes from 8192/1024 to
16384/2048.

Following recent discussions on the -arch mailing list, involving dillon
and mckusick, this change parallels the one made over a decade ago when
the default was bumped up from 4096/512.

This should provide significant performance improvements for most
folks, less significant performance losses for a few folks and
wasted space lost to large fragments for many folks.

For discussion, please see the following thread in the -arch archive:

Subject: Using a larger block size on large filesystems

The discussion ceases to be relevant when the issue of partitioning
schemes is raised.
2001-12-11 16:21:40 +00:00
Sheldon Hearn
be42c56328 Fix typo: 'fragement' -> 'fragment' 2001-12-07 13:18:28 +00:00
David E. O'Brien
2d68bf45bf Default to WARNS=2.
Binary builds that cannot handle this must explicitly set WARNS=0.

Reviewed by:	mike
2001-12-04 02:19:58 +00:00
Sheldon Hearn
629c25d4a9 Fix the example of suggested default settings. It stated that settings
were only of benefit to large filesystems, which recent research
suggests is not the case, and which the original author of the text
no longer endorses.
2001-11-27 19:39:07 +00:00
Sheldon Hearn
2441e154ef Correct the example introduced in rev 1.29, which suggested a block:frag
size ratio other than 8:1.  Currently, we only recommend an 8:1
ratio, because the impact of others ratios has not been adequately
investigated.

Also, do not recommend the use of the -c option in the example, since
newfs now automatically calculates the best cyl:cylgrp ratio.

This change was discussed with the author of rev 1.29.
2001-11-27 17:01:17 +00:00
Peter Wemm
1165817956 Remove support for FreeBSD/tahoe
Submitted by:	phk
2001-11-03 08:35:11 +00:00
Poul-Henning Kamp
bfd1f63d44 style(9) cleanup.
Submitted by:	j mckitrick <jcm@freebsd-uk.eu.org>
Reviewed by:	phk, /sbin/md5
2001-11-02 09:23:34 +00:00
Ollivier Robert
4f63c70a2b Fix diskless clients by removing the code for calculating the minimum
value for cpg. The change was bogus.

Submitted by:	bde
MFC after:	2 days
2001-10-18 09:48:28 +00:00
Doug Barton
eb9d1d2716 Document the optimal block:fragment ratio, per discussion
on -arch and cvs-all.

Reviewed by:	dillon
2001-10-15 22:47:55 +00:00
Ollivier Robert
08870345f5 Following the discussion in -arch and the submission of a patch by bde, here
it is. I added the manpage change.

Submitted by:	bde
MFC after:	1 week
2001-10-04 12:15:50 +00:00
Brian Somers
9cfe90fe1f Handle snprintf() returning < 0 (not just -1)
MFC after:	2 weeks
2001-08-20 14:53:05 +00:00
Brian Somers
327e849ae1 Handle snprintf() returning -1.
MFC after:	2 weeks
2001-08-20 12:56:45 +00:00
Kris Kennaway
5979df34a6 Silence non-constant format string warnings by marking functions
as __printflike()/__printf0like(), adding const, or adding missing "%s"
format strings, as appropriate.

MFC after:	2 weeks
2001-08-19 08:19:37 +00:00