Home | History | Annotate | Download | only in fsck_ffs
History log of /src/sbin/fsck_ffs/main.c
RevisionDateAuthorComments
 1.92  04-Jul-2023  riastradh fsck_ffs(8): Fix whitespace issues.

- Nix trailing whitespace.
- Omit excessive blank lines.
- Insert missing blank lines between $NetBSD$ and copyright.

No functional change intended.
 1.91  07-Jan-2023  chs ufs: fixed signed/unsigned bugs affecting large file systems

Apply these commits from FreeBSD:

commit e870d1e6f97cc73308c11c40684b775bcfa906a2
Author: Kirk McKusick <mckusick@FreeBSD.org>
Date: Wed Feb 10 20:10:35 2010 +0000

This fix corrects a problem in the file system that treats 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.

To fully handle this problem, newfs must be updated to ensure that
it will never create a filesystem with more than 2^32 inodes. That
patch will be forthcoming soon.

Reported by: Scott Burns, John Kilburg, Bruce Evans
Followup by: Jeff Roberson
PR: 133980
MFC after: 2 weeks

commit 81479e688b0f643ffacd3f335b4b4bba460b769d
Author: Kirk McKusick <mckusick@FreeBSD.org>
Date: Thu Feb 11 18:14:53 2010 +0000

One last pass to get all the unsigned comparisons correct.


In additional to the changes from FreeBSD, this commit includes quite a few
related changes to appease -Wsign-compare.
 1.90  17-Nov-2022  chs branches: 1.90.2;
Restore backward compatibility of UFS2 with previous NetBSD releases by
disabling support in UFS2 for extended attributes (including ACLs).
Add a new variant of UFS2 called "UFS2ea" that does support extended attributes.
Add new fsck_ffs operations "-c ea" and "-c no-ea" to convert file systems
from UFS2 to UFS2ea and vice-versa (both of which delete all existing extended
attributes in the process).
 1.89  06-Apr-2020  martin Sync "common" declarations with ifdefs in header.
 1.88  06-Apr-2020  mrg dion't define endian as well as try to declare it as a variable.
 1.87  05-Apr-2020  joerg Fix depenency on common symbols in sbin.
 1.86  15-Aug-2019  kamil fsck: Stop defining the same variable concurrently in bss and data

returntosingle was defined in multiple places:

- fsck_lfs/main.c
- fsck_ffs/main.c
- fsck_ext2fs/main.c
- fsck/fsutil.c

Keep the fsutil.c definition as the only one.

Detected during the build of telned with Address Sanitizer (MKSANITIZER).
 1.85  05-May-2019  christos branches: 1.85.2;
Add a -z flag to zero out the up to 4 bytes of padding in directory entry
names (including the terminating NUL), as well as directory entries with
extra free space (d->d_reclen > UFS_DIRSIZ(d)).

Inspired from FreeBSD:
https://svnweb.freebsd.org/base?view=revision&revision=347066

While the kernel has been fixed to deal with the padding bytes (new
kernels will correctly zero out all the padding after the name), it
appears that there is still an issue with directory entries with extra
free space, since a newly created and populated filesystem gets modified
with "fsck_ffs -z".
 1.84  08-Feb-2017  rin branches: 1.84.12;
Add smaller versions of fsck_ffs(8) and newfs(8) for install media, where
support for Endian-Independent FFS and Apple UFS is disabled unless FFS_EI=1
and APPLE_UFS=1 are added to CRUNCHENV, respectively.

This reduces the size of ramdisk image for atari by over 15KB.

Thanks tsutsui and christos for their useful comments.
 1.83  16-Jun-2015  christos branches: 1.83.2; 1.83.4;
a few more \n's in errors
 1.82  16-Jun-2015  christos fix error messages containing \n
 1.81  22-Jan-2013  dholland Stuff UFS_ in front of a few of ufs's symbols to reduce namespace
pollution. Specifically:
ROOTINO -> UFS_ROOTINO
WINO -> UFS_WINO
NXADDR -> UFS_NXADDR
NDADDR -> UFS_NDADDR
NIADDR -> UFS_NIADDR
MAXSYMLINKLEN -> UFS_MAXSYMLINKLEN
MAXSYMLINKLEN_UFS[12] -> UFS[12]_MAXSYMLINKLEN (for consistency)

Sort out ext2fs's misuse of NDADDR and NIADDR; fortunately, these have
the same values in ext2fs and ffs.

No functional change intended.
 1.80  29-Aug-2011  joerg branches: 1.80.2; 1.80.8;
Use __dead
 1.79  09-Jun-2011  christos share more code.
 1.78  06-Mar-2011  bouyer branches: 1.78.2;
merge the bouyer-quota2 branch. This adds a new on-disk format
to store disk quota usage and limits, integrated with ffs
metadata. Usage is checked by fsck_ffs (no more quotacheck)
and is covered by the WAPBL journal. Enabled with kernel
option QUOTA2 (added where QUOTA was enabled in kernel config files),
turned on with tunefs(8) on a per-filesystem
basis. mount_mfs(8) can also turn quotas on.

See http://mail-index.netbsd.org/tech-kern/2011/02/19/msg010025.html
for details.
 1.77  06-Feb-2011  njoly Do Skip device checks, which ends up parsing fstab, when working on a
filesystem image with -F option set.
 1.76  11-Apr-2010  hannken branches: 1.76.2;
Add -x option which allows to run `fsck_msdos -n' on a snapshot of
a live file system.

While here modify snap_open() to accept a character device as its
first arg and remove now unneeded get_snap_device().

Reviewed by: Manuel Bouyer <bouyer@netbsd.org>
 1.75  07-Jan-2010  christos make this compile again.
 1.74  06-Jan-2010  christos PR/42568: Pedro F. Giffuni: Better signal handling from OpenBSD, but simplified.
 1.73  12-Oct-2008  wiz Don't use unicode in usage.
Noted by Anon Ymous.
 1.72  09-Oct-2008  wiz Sync usage with man page.
 1.71  09-Oct-2008  christos Disable userid to username lookups by default. Add a -U flag to perform them.
In single user mode lookups that involve the network might not work and they
slow down fsck.
 1.70  30-Aug-2008  dogcow Make it compile. (HI BOUYER!)
 1.69  30-Aug-2008  bouyer Add fss(4) snapshot support to fsck_ffs(8) (via -x or -X options, like
dump(8)). This allows fsck_ffs -n to work on a snapshot of a R/W mounted
filesystem, and avoid errors related to filesystem activity.
 1.68  20-Jul-2008  lukem Remove the \n and tabs from the __COPYRIGHT() strings.
(Tweak some to use a consistent format.)
 1.67  23-Feb-2008  christos branches: 1.67.4; 1.67.6;
Make sure that the exit values are always sane, and use symbolic instead
of magic constants. Reviewed by go@
 1.66  16-Jul-2007  pooka branches: 1.66.4; 1.66.10; 1.66.12;
Make all mount(2) return value error checks against -1. Some file
systems just checked != 0, breaking MNT_GETARGS. Others worked with < 0,
but make them check against -1 too for consistency. And sprinkle some
stylish line wrapping where appropriate.
 1.65  14-Jul-2007  dsl Add additional 'sizeof args' parameter to mount(2).
 1.64  08-Feb-2007  drochner include <signal.h> where signal(3) is used
 1.63  17-Jan-2007  hubertf Remove more duplicate #includes,
from Slava Semushin <slava.semushin@gmail.com>
 1.62  14-Nov-2006  apb branches: 1.62.2;
Fix error in previous. Pass 1 needs to use progress_setrange(),
not progress_sethighlim().
 1.61  14-Nov-2006  apb Improve the progress bar displayed by fsck_ffs -p -P.

The progress bar will now travel from 0 to 20% during pass 1, from 20%
to 95% during pass 2, and from 95% to 100% during passes 3, 4, and 5.
Previously, the progress bar was not displayed at all during pass 1,
slowly traveled from 0 to about 50% during pass 2, and then very rapidly
traveled from 50% to 100% during passes 3, 4, and 5.

Note that fsck_ffs is the only user of fsck/progress.{c,h}.
 1.60  23-Sep-2005  jmmv Apply the NFS exports list rototill patch:

- Remove all NFS related stuff from file system specific code.
- Drop the vfs_checkexp hook and generalize it in the new nfs_check_export
function, thus removing redundancy from all file systems.
- Move all NFS export-related stuff from kern/vfs_subr.c to the new
file sys/nfs/nfs_export.c. The former was becoming large and its code
is always compiled, regardless of the build options. Using the latter,
the code is only compiled in when NFSSERVER is enabled. While doing this,
also make some functions in nfs_subs.c conditional to NFSSERVER.
- Add a new command in nfssvc(2), called NFSSVC_SETEXPORTSLIST, that takes a
path and a set of export entries. At the moment it can only clear the
exports list or append entries, one by one, but it is done in a way that
allows setting the whole set of entries atomically in the future (see the
comment in mountd_set_exports_list or in doc/TODO).
- Change mountd(8) to use the nfssvc(2) system call instead of mount(2) so
that it becomes file system agnostic. In fact, all this whole thing was
done to remove a 'XXX' block from this utility!
- Change the mount*, newfs and fsck* userland utilities to not deal with NFS
exports initialization; done internally by the kernel when initializing
the NFS support for each file system.
- Implement an interface for VFS (called VFS hooks) so that several kernel
subsystems can run arbitrary code upon receipt of specific VFS events.
At the moment, this only provides support for unmount and is used to
destroy NFS exports lists from the file systems being unmounted, though it
has room for extension.

Thanks go to yamt@, chs@, thorpej@, wrstuden@ and others for their comments
and advice in the development of this patch.
 1.59  19-Aug-2005  christos 64 bit inode changes
 1.58  27-Jun-2005  christos sprinkle const.
 1.57  20-Jan-2005  xtraeme branches: 1.57.2;
whitespace (pointed out by wiz@)
 1.56  19-Jan-2005  xtraeme Kill __P(), ANSIfy and WARNS=2
 1.55  19-Jan-2005  wiz Add -P to usage.
 1.54  13-Jan-2005  christos Use -DPROGRESS to enable the progress bar, don't depend on SMALL.
 1.53  13-Jan-2005  christos Add a progress meter to fsck_ffs based on the work by thorpej presented
to the mailing lists last January. This is optional.
 1.52  11-Oct-2004  dbj always print warning and return non-zero exit when there are unresolved inconsistencies.
 1.51  25-Jun-2004  wiz Add -a to usage. Closes PR 25916 by Kouichirou Hiratsuka.
 1.50  21-Apr-2004  christos Replace the statfs() family of system calls with statvfs().
Retain binary compatibility.
 1.49  17-Jan-2004  dbj print warning if the user specifies a conversion level greater than implemented
 1.48  05-Jan-2004  jmmv Homogenize usage messages: make the 'usage' word all lowercase, as this seems
to be the most common practice in our tree.
 1.47  20-Oct-2003  dsl Add a -q (quiet) option to print nothing for clean filesystems.
Support in fsck_ffs and stub in fsck_xxx.
Push a few more messages through pwarn() instead of printf() to ensure
disk name is shown.
 1.46  07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22308, verified by myself.
 1.45  02-Apr-2003  fvdl Add support for UFS2. UFS2 is an enhanced FFS, adding support for
64 bit block pointers, extended attribute storage, and a few
other things.

This commit does not yet include the code to manipulate the extended
storage (for e.g. ACLs), this will be done later.

Originally written by Kirk McKusick and Network Associates Laboratories for
FreeBSD.
 1.44  28-Jan-2003  mrg make this build on alpha after daddr_t->64bit
 1.43  24-Jan-2003  fvdl Bump daddr_t to 64 bits. Replace it with int32_t in all places where
it was used on-disk, so that on-disk formats remain the same.
Remove ufs_daddr_t and ufs_lbn_t for the time being.
 1.42  28-Sep-2002  dbj Add support for the Apple UFS variation on ffs
This is the bulk of PR #17345

The general approach is to use a run time deteriminable value
for DIRBLKSIZ. Additional allowances are included for using
MAXSYMLINKLEN with FS_42INODEFMT and a shift in the cylinder group
cluster summary count array. Support is added for managing
the Apple UFS volume label.
 1.41  06-May-2002  lukem If SIGINFO is received, display summary information to stderr.
Based on changes in FreeBSD, via Chuck Cranor <chuck@research.att.com>
 1.40  15-Aug-2001  lukem - implement -F; treat provided filesystems as images in regular files
- replace "filesystem" with "file system" as appropriate
- grammar fixes
 1.39  23-Feb-2001  christos fix compile errors.
 1.38  19-Feb-2001  cgd convert to use getprogname()
 1.37  04-Feb-2001  christos remove redundant declarations
 1.36  26-Jan-2001  thorpej In pass 5, check alternate superblocks for consistency with
the current in-core master superblock, and fix them up if
they're incorrect. Move the code that writes the alternate
superblocks if (cvtlevel || doswap) into pass 5 for efficiency.

Reviewd by Charles Hannum, and used by me to fix up a curdled
file system.
 1.35  13-Dec-2000  mycroft Fix an annoyingly incorrect message.
 1.34  15-Nov-1999  fvdl branches: 1.34.4;
Changes for softdep code.
 1.33  26-Jul-1998  mycroft branches: 1.33.4; 1.33.8;
const poisoning.
 1.32  01-Apr-1998  kleink Need <time.h> for time() prototype.
 1.31  18-Mar-1998  bouyer Add support for non-native byteorder FFS, and converting byteorder.
Also, be a bit more conservative with the clean flag: don't mark the FS
clean when we know there may still be errors (user anserwed 'n' to
a question, or fsck says "you must rerun fsck").
 1.30  01-Mar-1998  fvdl Merge with Lite2 + local changes
 1.29  02-Nov-1997  mjacob Hmmm..fsck_ffs has to really be able to alwasy work, and if you've got
a *huge* (like 600GB) filesystem, you need to not be limited by resource
limits.
 1.28  01-Oct-1997  enami branches: 1.28.2;
Don't declare optind and optarg.
 1.27  24-Sep-1997  lukem for now, #ifdef out a couple of chunks that were added in the lite2 merge
 1.26  20-Sep-1997  lukem - don't indiscriminately include <stdlib.h> and <unistd.h> in "fsck.h"
- explicitly pull in <stdio.h>, <stdlib.h> and <unistd.h> in *.c as necessary
 1.25  16-Sep-1997  lukem resolve conflicts from lite-2 merge.
 1.24  14-Sep-1997  lukem * cleanup for WARNS=1
* deprecate register
* cleanup manpage
* remove unused docheck() func
* prefix hex numbers with '0x'
* getopt returns -1 not EOF
 1.23  22-Oct-1996  christos - sort and remove unused options.
- If no filesystem is specified or an incorrect option, print usage information
 1.22  11-Oct-1996  thorpej Bug fix from Kirk McKusick <mckusick@McKusick.COM>:

Fix a bug in fsck_ffs where if a directory somehow develops a hole
(that is a block pointer that has a value of zero), fsck would give the
filesystem a clean bill of health, but the kernel would panic when
accessing the directory with the hole. Fsck now checks for holes
in directories. If found in preen mode, fsck fails. In manual
mode, it can be directed to shorten the directory to the beginning of
the hole. A more complete solution would be to allocate a block to fill
the hole. However, this is a lot more work for a `cannot happen' error,
so the extra effort seems unwarranted.
 1.21  27-Sep-1996  christos - util.h -> fsutil.h
 1.20  23-Sep-1996  christos - fixed all printf formats [there were a lot of %l? <-> %? mistakes]
- added missing prototypes, and made local functions static
- removed parallel preening code; this is part of fsck(8)
- use printing utilities from fsck(8)
- Makefile does not make links to fsck and fsck.8
- removed -l maxparallel option. It has no meaning anymore.
 1.19  28-Nov-1995  jtc branches: 1.19.4;
merge in changes from 1.1 release branch
 1.18  12-Jul-1995  cgd branches: 1.18.2;
recognize 'ffs' and 'ufs' as meaning the same thing.
 1.17  12-Jul-1995  cgd implement a 'force check' flag, '-f'. I used the SunOS name, but the Digital
semantics. now:
(1) dirty file systems will always be checked; nothing new there.
(2) if not '-f' clean file systems will _NEVER_ be checked,
i.e. they won't be checked even if -p isn't specified. This
allows one to 'fsck -p ; fsck' to preen, then clean up
anything that 'fsck -p' barfs on, without waiting for the
clean file systems to be checked again.
(3) if '-f' clean file systems will ALWAYS be checked. This
allows people to put 'fsck -fp' into /etc/rc on systems
where they're leery of the FS clean flag state, need
the extra reliability, and can afford time 'wasted'
in checks.
The assumption made here is that if a file system is marked clean, it
_IS CLEAN_, really, and shouldn't be checked unless fsck is explicitly
told to (with -f). This should be a valid assumption, but may not be in
the presence of file system bugs. Documentation updated to note '-f'.
 1.16  12-Apr-1995  mycroft Set the clean flag if necessary. If preening, don't check `clean' file
systems.
 1.15  18-Mar-1995  cgd convert to new RCS Id conventions; reduce my headache
 1.14  05-Dec-1994  cgd more cleanups from Jim Jegers, passed over by me.
 1.13  08-Jun-1994  mycroft Update from 4.4-Lite, with local changes.
 1.12  25-Apr-1994  cgd need <sys/time.h>
 1.11  06-Apr-1994  cgd kill the evil U word! from Mike Long <mike.long@analog.com>
 1.10  15-Oct-1993  cgd try again to keep it from rebooting endlessly
 1.9  06-Oct-1993  cgd set the 'clean' flag sometimes, but ignore it when deciding to clean
or not. this allows you to use this fsck and... reboot your system;
otherwise it would inf-loop rebooting and marking the FS clean,
which would then mark the fs modified, cause a reboot, etc.
 1.8  03-Oct-1993  mycroft #if 0 the fs_clean check for now.
 1.7  01-Oct-1993  mycroft Don't set clean flag if -n.
 1.6  01-Oct-1993  mycroft Initial count for fs_state is `FS_CLEANFREQ'.
 1.5  01-Oct-1993  mycroft Skip check if filesystem is marked clean and isn't too dusty, only with -p.
Set clean flag after checking a filesystem.
 1.4  01-Aug-1993  mycroft Add RCS identifiers.
 1.3  23-Mar-1993  cgd changed "Id" to "Header" for rcsids
 1.2  22-Mar-1993  cgd added rcs ids to all files
 1.1  21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.3  16-Sep-1997  lukem imported from lite-2
 1.1.1.2  13-Jun-1994  mycroft Import 4.4-Lite version.
 1.1.1.1  21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.18.2.1  01-Nov-1995  jtc complete ufs -> ffs change (From John Kohl; PR #1403)
 1.19.4.1  02-Mar-1997  mycroft Pull up changes from Kirk McKusick to check for holes in directories.
 1.28.2.1  02-Nov-1997  mellon Pull rev 1.29 up from trunk (mjacob)
 1.33.8.1  27-Dec-1999  wrstuden Pull up to last week's -current.
 1.33.4.1  19-Oct-1999  fvdl Bring in Kirk McKusick's FFS softdep code on a branch.
 1.34.4.2  25-Nov-2001  he Pull up revision 1.39 (requested by lukem):
Use int32_t for on-disk time_t representation.
Convert %q_ to %ll_ in print formats.
 1.34.4.1  24-Nov-2001  he Pull up revisions 1.35-1.37 (requested by lukem):
Jumbo pullup for fsck_ffs:
o fix incorrect error message
o mark initialized globals with ``extern''
o make reconnect algorithm O(n) instead of O(n^4)
o remove dead code
o don't swap cg_clustersum(cg)[0], it's a bitmap
o ensure rotor values are positive
o some code restructuring
o fix byte swapping bug
o pass5: check alternate superblocks for consistency with in-core master
o fix usage message
 1.57.2.2  20-Nov-2006  tron Pull up following revision(s) (requested by ghen in ticket #1590):
sbin/fsck_ffs/main.c: revision 1.62
Fix error in previous. Pass 1 needs to use progress_setrange(),
not progress_sethighlim().
 1.57.2.1  20-Nov-2006  tron Pull up following revision(s) (requested by ghen in ticket #1590):
sbin/fsck_ffs/pass4.c: revision 1.23
sbin/fsck_ffs/pass5.c: revision 1.47
sbin/fsck_ffs/pass2.c: revision 1.44
sbin/fsck_ffs/pass1.c: revision 1.43
sbin/fsck_ffs/pass3.c: revision 1.19
sbin/fsck/progress.c: revision 1.3
sbin/fsck_ffs/main.c: revision 1.61
sbin/fsck/progress.h: revision 1.2
Improve the progress bar displayed by fsck_ffs -p -P.
The progress bar will now travel from 0 to 20% during pass 1, from 20%
to 95% during pass 2, and from 95% to 100% during passes 3, 4, and 5.
Previously, the progress bar was not displayed at all during pass 1,
slowly traveled from 0 to about 50% during pass 2, and then very rapidly
traveled from 50% to 100% during passes 3, 4, and 5.
Note that fsck_ffs is the only user of fsck/progress.{c,h}.
 1.62.2.1  24-Mar-2009  bouyer Pull up following revision(s) (requested by manu in ticket #1288):
sbin/fsck_lfs/inode.c: revision 1.40 via patch
sbin/fsck_ffs/fsck_ffs.8: revision 1.44 via patch
sbin/fsck_ext2fs/fsck.h: revision 1.14 via patch
sbin/fsck_ext2fs/main.c: revision 1.30 via patch
sbin/fsck_ffs/inode.c: revision 1.61 via patch
sbin/fsck_ffs/main.c: revision 1.71 via patch
sbin/fsck_ext2fs/inode.c: revision 1.23 via patch
sbin/fsck_lfs/fsck.h: revision 1.18 via patch
sbin/fsck_lfs/fsck_lfs.8: revision 1.21 via patch
sbin/fsck_lfs/main.c: revision 1.38 via patch
sbin/fsck_ext2fs/fsck_ext2fs.8: revision 1.15 via patch
sbin/fsck_ffs/fsck.h: revision 1.47 via patch
Disable userid to username lookups by default. Add a -U flag to perform them.
In single user mode lookups that involve the network might not work and they
slow down fsck.
 1.66.12.3  17-Jan-2009  mjf Sync with HEAD.
 1.66.12.2  28-Sep-2008  mjf Sync with HEAD.
 1.66.12.1  03-Apr-2008  mjf Sync with HEAD.
 1.66.10.1  24-Mar-2008  keiichi sync with head.
 1.66.4.1  23-Mar-2008  matt sync with HEAD
 1.67.6.1  28-Jul-2008  simonb Sync with head.
 1.67.4.1  18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.76.2.2  08-Feb-2011  bouyer Sync with HEAD
 1.76.2.1  20-Jan-2011  bouyer Snapshot of work in progress on a modernised disk quota system:
- new quotactl syscall (versionned for backward compat), which takes
as parameter a path to a mount point, and a prop_dictionary
(in plistref format) describing commands and arguments.
For each command, status and data are returned as a prop_dictionary.
quota commands features will be added to take advantage of this,
exporting quota data or getting quota commands as plists.

- new on disk-format storage (all 64bit wide), integrated to metadata for
ffs (and playing nicely with wapbl).
Quotas are enabled on a ffs filesystem via superblock flags.
tunefs(8) can enable or disable quotas.
On a quota-enabled filesystem, fsck_ffs(8) will track per-uid/gid
block and inode usages, and will check and update quotas in Pass 6.
quota usage and limits are stored in unliked files (one for users,
one for groups)l fsck_ffs(8) will create the files if needed, or
free them if needed. This means that after enabling or disabling
quotas on a filesystem; a fsck_ffs(8) run is required.
quotacheck(8) is not needed any more, on a unclean shutdown
fsck or journal replay will take care of fixing quotas.
newfs(8) can create a ready-to-mount quota-enabled filesystem
(superblock flags are set and quota inodes are created).
Other new features or semantic changes:
- default quota datas, applied to users or groups which don't already
have a quota entry
- per-user/group grace time (instead of a filesystem global one)
- 0 really means "nothing allowed at all", not "no limit".
If you want "no limit", set the limit to UQUAD_MAX (tools will
understand "unlimited" and "-")

A quota file is structured as follow:
it starts with a header, containing a few per-filesystem values,
and the default quota limits.
Quota entries are linked together as a simple list, each entry has a
pointer (as an offset withing the file) to the next.
The header has a pointer to a list of free quota entries, and
a hash table of in-use entries. The size of the hash table depends
on the filesystem block size (header+hash table should fit in the
first block). The file is not sparse and is a multiple of
filesystem block size (when the free quota entry list is empty a new
filesystem block is allocated). quota entries to not cross
filesystem block boundaries.

In memory, the kernel keeps a cache of recently used quota entries
as a reference to the block number, and offset withing the block.
The quota entry itself is keept in the buf cache.

fsck_ffs(8), tunefs(8) and newfs(8) supports are completed (with
related atf tests :)
The kernel can update disk usage and report it via quotactl(2).

Todo: enforce quotas limits (limits are not checked by kernel yet)
update repquota, edquota and rpc.rquotad to the new world
implement compat_50_quotactl ioctl.
update quotactl(2) man page

fsck_ffs required fixes so that allocating new blocks or inodes will
properly update the superblock and cg sumaries. This was not an issue up
to now because superblock and cg sumaries check happened last, but now
allocations or frees can happen in pass 6.
 1.78.2.1  23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.80.8.1  25-Feb-2013  tls resync with head
 1.80.2.1  23-Jan-2013  yamt sync with head
 1.83.4.1  21-Apr-2017  bouyer Sync with HEAD
 1.83.2.1  20-Mar-2017  pgoyette Sync with HEAD
 1.84.12.3  13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.84.12.2  08-Apr-2020  martin Merge changes from current as of 20200406
 1.84.12.1  10-Jun-2019  christos Sync with HEAD
 1.85.2.1  16-Aug-2019  martin Pull up following revision(s) (requested by kamil in ticket #73):

sbin/fsck_lfs/main.c: revision 1.54
sbin/fsck_ext2fs/main.c: revision 1.40
sbin/fsck_ffs/main.c: revision 1.86

fsck: Stop defining the same variable concurrently in bss and data
returntosingle was defined in multiple places:
- fsck_lfs/main.c
- fsck_ffs/main.c
- fsck_ext2fs/main.c
- fsck/fsutil.c

Keep the fsutil.c definition as the only one.

Detected during the build of telned with Address Sanitizer (MKSANITIZER).
 1.90.2.1  13-May-2023  martin Pull up following revision(s) (requested by chs in ticket #160):

usr.sbin/makefs/ffs/ffs_alloc.c: revision 1.31
sbin/tunefs/tunefs.c: revision 1.58
sbin/fsck_ffs/setup.c: revision 1.105
sbin/fsck_ffs/pass5.c: revision 1.56
usr.sbin/makefs/ffs.c: revision 1.74
usr.sbin/makefs/ffs/mkfs.c: revision 1.42
usr.sbin/makefs/Makefile: revision 1.40
sys/ufs/ffs/fs.h: revision 1.71
sbin/fsdb/fsdb.c: revision 1.54
sbin/resize_ffs/resize_ffs.c: revision 1.58
sbin/fsck_ffs/pass4.c: revision 1.29
usr.sbin/makefs/ffs/ffs_extern.h: revision 1.9
sbin/newfs/mkfs.c: revision 1.133
sys/ufs/ffs/ffs_alloc.c: revision 1.172
sbin/fsck_ffs/pass1b.c: revision 1.24
usr.sbin/dumpfs/dumpfs.c: revision 1.68
sys/ufs/ffs/ffs_extern.h: revision 1.88
usr.sbin/quotacheck/quotacheck.c: revision 1.51
sys/ufs/ffs/ffs_subr.c: revision 1.54
sbin/fsck_ffs/main.c: revision 1.91
sbin/fsck_ffs/pass1.c: revision 1.63

ufs: fixed signed/unsigned bugs affecting large file systems

Apply these commits from FreeBSD:
commit e870d1e6f97cc73308c11c40684b775bcfa906a2
Author: Kirk McKusick <mckusick@FreeBSD.org>
Date: Wed Feb 10 20:10:35 2010 +0000
This fix corrects a problem in the file system that treats 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.
To fully handle this problem, newfs must be updated to ensure that
it will never create a filesystem with more than 2^32 inodes. That
patch will be forthcoming soon.
Reported by: Scott Burns, John Kilburg, Bruce Evans
Followup by: Jeff Roberson
PR: 133980
MFC after: 2 weeks

commit 81479e688b0f643ffacd3f335b4b4bba460b769d
Author: Kirk McKusick <mckusick@FreeBSD.org>
Date: Thu Feb 11 18:14:53 2010 +0000
One last pass to get all the unsigned comparisons correct.

In additional to the changes from FreeBSD, this commit includes quite a few
related changes to appease -Wsign-compare.

RSS XML Feed