Commit Graph

246 Commits

Author SHA1 Message Date
Simon J. Gerraty
ccfb965433 Add META_MODE support.
Off by default, build behaves normally.
WITH_META_MODE we get auto objdir creation, the ability to
start build from anywhere in the tree.

Still need to add real targets under targets/ to build packages.

Differential Revision:       D2796
Reviewed by: brooks imp
2015-06-13 19:20:56 +00:00
Simon J. Gerraty
44d314f704 dirdeps.mk now sets DEP_RELDIR 2015-06-08 23:35:17 +00:00
Simon J. Gerraty
98e0ffaefb Merge sync of head 2015-05-27 01:19:58 +00:00
Warner Losh
a91275f72f Remove old ioctl use and support, once and for all. 2015-01-06 05:28:37 +00:00
Joel Dahl
c09eb46601 mdoc: improvements to SEE ALSO. 2014-12-27 08:22:58 +00:00
Baptiste Daroussin
13eb765f2d Convert sbin/ to LIBADD
Reduce overlinking
2014-11-25 11:23:12 +00:00
Simon J. Gerraty
fae50821ae Updated dependencies 2014-05-16 14:09:51 +00:00
Simon J. Gerraty
76b28ad6ab Updated dependencies 2014-05-10 05:16:28 +00:00
Simon J. Gerraty
3b8f084595 Merge head 2014-04-28 07:50:45 +00:00
Christian Brueffer
295a5bd78c Refer newfs and growfs users to fsck_ffs instead of
fsck, the latter does not accept the referred to "-b" flag.

This change was accidently committed directly to 9-STABLE in
r237505.

PR:		82720
Submitted by:	David D.W. Downey
MFC after:	1 week
2014-02-09 14:28:47 +00:00
Xin LI
9da19cd746 Don't call arc4random_stir() explicitly. To quote arc4random(3)
manual page:

    There is no need to call arc4random_stir() before using
    arc4random() functions family, since they automatically
    initialize themselves.

No objection:	des
MFC after:	2 weeks
2013-10-29 17:34:15 +00:00
Simon J. Gerraty
3caf0790a8 Merge head@256284 2013-10-13 02:35:19 +00:00
Sergey Kandaurov
05d98029e9 Sweep man pages replacing ad -> ada.
Approved by:	re (blackend)
MFC after:	1 week
X-MFC note:	stable/9 only
2013-10-01 18:41:53 +00:00
Simon J. Gerraty
69e6d7b75e sync from head 2013-04-12 20:48:55 +00:00
Joel Dahl
b1edef175b Remove contractions. 2013-04-11 18:46:41 +00:00
Kirk McKusick
baa12a84a7 The purpose of this change to the FFS layout policy is to reduce the
running time for a full fsck. It also reduces the random access time
for large files and speeds the traversal time for directory tree walks.

The key idea is to reserve a small area in each cylinder group
immediately following the inode blocks for the use of metadata,
specifically indirect blocks and directory contents. The new policy
is to preferentially place metadata in the metadata area and
everything else in the blocks that follow the metadata area.

The size of this area can be set when creating a filesystem using
newfs(8) or changed in an existing filesystem using tunefs(8).
Both utilities use the `-k held-for-metadata-blocks' option to
specify the amount of space to be held for metadata blocks in each
cylinder group. By default, newfs(8) sets this area to half of
minfree (typically 4% of the data area).

This work was inspired by a paper presented at Usenix's FAST '13:
www.usenix.org/conference/fast13/ffsck-fast-file-system-checker

Details of this implementation appears in the April 2013 of ;login:
www.usenix.org/publications/login/april-2013-volume-38-number-2.
A copy of the April 2013 ;login: paper can also be downloaded
from: www.mckusick.com/publications/faster_fsck.pdf.

Reviewed by: kib
Tested by:   Peter Holm
MFC after:   4 weeks
2013-03-22 21:45:28 +00:00
Simon J. Gerraty
7cf3a1c6b2 Updated dependencies 2013-03-11 17:21:52 +00:00
Simon J. Gerraty
f5f7c05209 Updated dependencies 2013-02-16 01:23:54 +00:00
Simon J. Gerraty
23090366f7 Sync from head 2012-11-04 02:52:03 +00:00
Edward Tomasz Napierala
549f62fa42 Fix problem with geom_label(4) not recognizing UFS labels on filesystems
extended using growfs(8).  The problem here is that geom_label checks if
the filesystem size recorded in UFS superblock is equal to the provider
(i.e. device) size.  This check cannot be removed due to backward
compatibility.  On the other hand, in most cases growfs(8) cannot set
fs_size in the superblock to match the provider size, because, differently
from newfs(8), it cannot recompute cylinder group sizes.

To fix this problem, add another superblock field, fs_providersize, used
only for this purpose.  The geom_label(4) will attach if either fs_size
(filesystem created with newfs(8)) or fs_providersize (filesystem expanded
using growfs(8)) matches the device size.

PR:		kern/165962
Reviewed by:	mckusick
Sponsored by:	FreeBSD Foundation
2012-10-30 21:32:10 +00:00
Matthew D Fleming
e25a029eb2 Fix sbin/ build with a 64-bit ino_t.
Original code by:	Gleb Kurtsou
2012-09-27 23:31:06 +00:00
Marcel Moolenaar
7750ad47a9 Sync FreeBSD's bmake branch with Juniper's internal bmake branch.
Requested by: Simon Gerraty <sjg@juniper.net>
2012-08-22 19:25:57 +00:00
Eitan Adler
08084125ee Fix warning when compiling with gcc46:
error: variable 'c' set but not used

Approved by:	dim
MFC after:	3 days
2012-01-10 02:59:09 +00:00
Kirk McKusick
1300433a2e Reduce NFPI by half to keep the default number of inodes the same with
the now default 32K/4K filesystem the same as the number of inodes in
the previously default 16K/2K filesystem.

PR:          bin/16265
Reported by: Olivier Cochard-Labbe <olivier@cochard.me>
MFC:         4 weeks (9 is the only affected branch)
2011-12-21 22:49:16 +00:00
Ed Schouten
1efe3c6b58 Add missing static keywords for global variables to tools in sbin/.
These tools declare global variables without using the static keyword,
even though their use is limited to a single C-file, or without placing
an extern declaration of them in the proper header file.
2011-11-04 13:36:02 +00:00
Edward Tomasz Napierala
89d8548ce6 Advertise growfs(8) a little better. 2011-06-22 18:02:28 +00:00
Kirk McKusick
3fa3e267de Update the manual page to reflect the new 32K/4K defaults.
Reminded by: Ivan Voras
2011-05-28 15:14:50 +00:00
Kirk McKusick
20f2694aa9 Raise the default blocksize for UFS/FFS filesystems from
16K to 32K and the default fragment size from 2K to 4K.

The rational is that most disks are now running with 4K
sectors.  While they can (slowly) simulate 512-byte sectors
by doing a read-modify-write, it is desirable to avoid this
functionality.  By raising the minimum filesystem allocation
to 4K, the filesystem will never trigger the small sector
emulation.

Also, the growth of disk sizes has lead us to double the
default block size about every ten years.  The rise from 8K
to 16K blocks was done in 2001.  So, by the 10-year metric,
the time has come for 32K blocks.

Discussed at: May 2011 BSDCan Developer Summit
Reference: http://wiki.freebsd.org/201105DevSummit/FileSystems
2011-05-26 18:22:49 +00:00
Colin Percival
c2805605f7 Stop trying to zero UFS1 superblocks if we fall off the end of the disk.
This avoids a potentially many-hours-long loop of failed writes if newfs
finds a partially-overwritten superblock (or, for that matter, random
garbage which happens to have superblock magic bytes); on one occasion I
found newfs trying to zero 800 million superblocks on a 50 MB disk.

Reviewed by:	mckusick
MFC after:	1 week
2011-04-26 02:06:31 +00:00
Jaakko Heinonen
75297f6e48 Xref makefs(8).
PR:		154708
Submitted by:	jhs
2011-02-22 15:31:40 +00:00
Kirk McKusick
d92f0739ab Add the -j option to enable soft updates journaling when creating
a new file system.

Reviewed by: Kostik Belousov <kostikbel@gmail.com>
2011-02-16 06:00:27 +00:00
Kirk McKusick
7649cb0043 The dump, fsck_ffs, fsdb, fsirand, newfs, makefs, and quot utilities
include sys/time.h instead of time.h. This include is incorrect as
per the manpages for the APIs and the POSIX definitions. This commit
replaces sys/time.h where necessary with time.h.

The commit also includes some minor style(9) header fixup in newfs.

This commit is part of a larger effort by Garrett Cooper started in
//depot/user/gcooper/posix-conformance-work/ -- to make FreeBSD more
POSIX compliant.

Submitted by:  Garrett Cooper   yanegomi at gmail dot com
2011-01-24 06:17:05 +00:00
Konstantin Belousov
a738d4cf20 Add support for FS_TRIM to user-mode UFS utilities.
Reviewed by:	mckusick, pjd, pho
Tested by:	pho
MFC after:	1 month
2010-12-29 12:31:18 +00:00
Konstantin Belousov
03ee10d8e4 Add the missed 'p' flag to getopt() optstring argument.
MFC after:	1 week
2010-12-15 12:45:28 +00:00
Kirk McKusick
8d408dff91 Reported problem:
Large (60GB) filesystems created using "newfs -U -O 1 -b 65536 -f 8192"
show incorrect results from "df" for free and used space when mounted
immediately after creation. fsck on the new filesystem (before ever
mounting it once) gives a "SUMMARY INFORMATION BAD" error in phase 5.

This error hasn't occurred in any runs of fsck immediately after
"newfs -U -b 65536 -f 8192" (leaving out the "-O 1" option).

Solution:
The default UFS1 superblock is located at offset 8K in the filesystem
partition; the default UFS2 superblock is located at offset 64K in
the filesystem partition. For UFS1 filesystems with a blocksize of
64K, the first alternate superblock resides at 64K which is the the
location used for the default UFS2 superblock. By default, the
system first checks for a valid superblock at the default location
for a UFS2 filoesystem. For a UFS1 filesystem with a blocksize of
64K, there is a valid UFS1 superblock at this location.  Thus, even
though it is expected to be a backup superblock, the system will
use it as its default superblock. So, we have to ensure that all the
statistcs on usage are correct in this first alternate superblock
as it is the superblock that will actually be used.

While tracking down this problem, another limitation of UFS1 became
evident. For UFS1, the number of inodes per cylinder group is stored
in an int16_t. Thus the maximum number of inodes per cylinder group
is limited to 2^15 - 1. This limit can easily be exceeded for block
sizes of 32K and above. Thus when building UFS1 filesystems, newfs
must limit the number of inodes per cylinder group to 2^15 - 1.

Reported by: Guy Helmer<ghelmer@palisadesys.com>
Followup by: Bruce Cran <brucec@freebsd.org>
PR:          107692
MFC after:   4 weeks
2010-09-24 19:08:56 +00:00
Glen Barber
75f01cd104 Synchronize newfs(8) manual with code.
PR:		61716
Submitted by:	Radim Kolar <hsn at netmag cz>
Patch by:	arundel
Approved by:	keramida (mentor)
MFC after:	1 week
2010-09-14 12:12:07 +00:00
Glen Barber
92d01db21c Rewording and typo fixes in newfs(8).
PR:		150490
Submitted by:	Eitan Adler <foreignuser at eitanadler com>
Additional fixes by:	Warren Block <wblock at wonkity com>, keramida
Approved by:	keramida (mentor)
MFC after:	1 week
2010-09-12 17:50:07 +00:00
Maxim Sobolev
8c04d588c5 Fix "Empty input line" mdoc warning.
Submitted by:	Alexander Best
2010-03-10 00:47:09 +00:00
Maxim Sobolev
e0999e592b o bdeficize expand_number_int() function;
o revert most of the recent changes (int -> int64_t conversion) by using
this functon for parsing all options.
2010-03-09 19:31:08 +00:00
Maxim Sobolev
eb8d193be2 Change secrorsize back to int, since that's the data type expected by the
ioctl(DIOCGSECTORSIZE). It creates issues on some architectures.

MFC after:	1 week
Reported by:	Jayachandran C.
2010-03-09 10:31:03 +00:00
Warner Losh
683d4eac76 Cast these to intmax_t before printing to fix build bustage. Better
solutions welcome.
2010-03-03 21:53:25 +00:00
Maxim Sobolev
32bdc2b685 Use expand_number(3) from libutil instead of home-grown function to parse
human-friendly power-of-two numbers (i.e. 2k, 5M etc).

Suggested by:	many
MFC after:	1 week
2010-03-03 19:25:28 +00:00
Maxim Sobolev
83b5ab2770 Teach newfs(8) to understand size modifiers for all options taking
size or size-like argument. I.e. "-s 32k" instead of "-s 32768".
Size parsing function has been shamelessly stolen from the truncate(1).
I'm sure many sysadmins out there will appreciate this small
improvement.

MFC after:	1 week
2010-03-03 02:05:09 +00:00
Kirk McKusick
81479e688b One last pass to get all the unsigned comparisons correct. 2010-02-11 18:14:53 +00:00
Kirk McKusick
cb464c69c0 Ensure that newfs will never create a filesystem with more than 2^32
inodes by cutting back on the number of inodes per cylinder group if
necessary to stay under the limit. For a default (16K block) file
system, this limit begins to take effect for file systems above 32Tb.

This fix is in addition to -r203763 which corrected a problem in the
kernel that treated large inode numbers as negative rather than unsigned.
For a default (16K block) file system, this bug began to show up at a
file system size above about 16Tb.

Reported by: Scott Burns, John Kilburg, Bruce Evans
Followup by: Jeff Roberson
PR:          133980
MFC after:   2 weeks
2010-02-10 20:17:46 +00:00
Xin LI
e475c594e4 Correct two typos.
Reported by:	Brandon Falk <falkman gamozo org>
MFC after:	1 week
2010-02-06 00:25:46 +00:00
Ed Schouten
f6d189a9e4 Raise WARNS for various tools where possible.
Submitted by:	Marius Nünnerich <marius@nuenneri.ch>
2010-01-17 21:56:27 +00:00
Martin Blapp
1457e0cdac Fix typo: s/partion/partition/
Submitted by:	Marc Balmer <marc@msys.ch>
MFC after:	3 days
2010-01-02 17:32:40 +00:00
Edward Tomasz Napierala
4e6430a67f Slightly improve gjournal documentation.
Reviewed by:	pjd
2009-04-29 10:02:50 +00:00
Olivier Houchard
02dda28606 Don't add a bwrite() symbol, it breaks the build when building newfs
statically.
Instead, bring in a stripped down version of sbwrite(), and add the offset
to every bwrite() calls.
2009-02-12 15:28:15 +00:00