summaryrefslogtreecommitdiffstats
path: root/sbin/fsck_ffs/fsck.h
Commit message (Collapse)AuthorAgeFilesLines
* Arguments for malloc and calloc should be size_t, not int.mckusick2014-02-251-2/+2
| | | | | | | | Use proper bounds check when trying to free cached memory. Spotted by: Xin Li Tested by: Dmitry Sivachenko MFC after: 2 weeks
* Add the -R option to allow fsck_ffs to restart itself when too many criticalscottl2013-12-301-66/+70
| | | | | | | | | | | | | | | | | | | | | | | | errors have been detected in a particular run. Clean up the global state variables so that a restart can happen correctly. Separate the global variables in fsck_ffs and fsdb to their own file. This fixes header sharing with fscd. Correctly initialize, static-ize, and remove global variables as needed in dir.c. This fixes a problem with lost+found directories that was causing a segfault. Correctly initialize, static-ize, and remove global variables as needed in suj.c. Initialize the suj globals before allocating the disk object, not after. Also ensure that 'preen' mode doesn't conflict with 'restart' mode Submitted by: scottl, max Reviewed by: max, mckusick (earlier version) Obtained from: Netflix MFC after: 3 days
* Add a 'surrender' mode to fsck_ffs. With the -S flag, once hard read errorsscottl2013-07-301-0/+1
| | | | | | | | are encountered, the fsck will stop instead of wasting time chewing through possibly other errors. Obtained from: Netflix MFC after: 3 days
* Add a -Z option which zeroes unused blocks. It can be combined with -E,des2013-04-291-1/+4
| | | | | | | in which case unused blocks are first zeroed and then erased. Reviewed by: mckusick MFC after: 3 weeks
* Revert 248634 and 248643 (e.g., restoring 248625 and 248639).mckusick2013-03-231-4/+33
| | | | Build verified by: Glen Barber (gjb@)
* Revert svn r248625sbruno2013-03-231-33/+4
| | | | | | | | Clang errors around printf could be trivially fixed, but the breakage in sbin/fsdb were to significant for this type of change. Submitter of this changeset has been notified and hopefully this can be restored soon.
* Speed up fsck by caching the cylinder group maps in pass1 somckusick2013-03-221-4/+33
| | | | | | | | | | | | | | | | | | | | that they do not need to be read again in pass5. As this nearly doubles the memory requirement for fsck, the cache is thrown away if other memory needs in fsck would otherwise fail. Thus, the memory footprint of fsck remains unchanged in memory constrained environments. 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
* When running with the -d option, instrument fsck_ffs to track the number,mckusick2013-02-241-2/+36
| | | | | | data type, and running time of its I/O operations. No functional changes.
* Update fsck_ffs buffer cache manager to use TAILQ macros.mckusick2013-02-151-7/+10
| | | | No functional changes.
* Remove needless (int) casts of write(2)'s 3rd argument.obrien2012-09-121-1/+1
| | | | | Also change blwrite() 'size' parameter to a ssize_t to better match write(2).
* Spelling fixes for sbin/uqs2012-01-071-1/+1
|
* Change the type of real_dev_bsize variable from long to u_int.kib2011-12-201-1/+1
| | | | | | | | | | The DIOCGSECTORSIZE takes u_int * as an argument, using long * causes failures on big-endian targets. Diagnosed by: Michiel Boland <boland37 xs4all nl> PR: sparc64/163460 Tested by: pho (x86), flo (sparc64) MFC after: 1 week
* Break out the pass 5 inode and block map updating into a separate functionmckusick2011-07-151-0/+1
| | | | so that the function can be used by the journaling soft updates recovery.
* Add an -E option to mirror newfs's. The idea is that if you have a systemdes2011-04-291-0/+2
| | | | | | | | | | | | | | | | | | | that was built before ffs grew support for TRIM, your filesystem will have plenty of free blocks that the flash chip doesn't know are free, so it can't take advantage of them for wear leveling. Once you've upgraded your kernel, you enable TRIM on the filesystem (tunefs -t enable), then run fsck_ffs -E on it before mounting it. I tested this patch by half-filling an mdconfig'ed filesystem image, running fsck_ffs -E on it, then verifying that the contents were not damaged by comparing them to a pristine copy using rsync's checksum functionality. There is no reliable way to test it on real hardware. Many thanks to mckusick@, who provided the tricky parts of this patch and reviewed the final version. Reviewed by: mckusick@ MFC after: 3 weeks
* In checker, read journal by sectors.kib2011-02-121-0/+1
| | | | | | | | | | | Due to UFS insistence to pretend that device sector size is 512 bytes, sector size is obtained from ioctl(DIOCGSECTORSIZE) for real devices, and from the label otherwise. The file images without label have to be made with 512 sector size. In collaboration with: pho Reviewed by: jeff Tested by: bz, pho
* Protect fsck.h from being included twice.pjd2010-04-241-0/+5
|
* - Merge soft-updates journaling from projects/suj/head into head. Thisjeff2010-04-241-4/+1
| | | | | | | | brings in support for an optional intent log which eliminates the need for background fsck on unclean shutdown. Sponsored by: iXsystems, Yahoo!, and Juniper. With help from: McKusick and Peter Holm
* - Use volatile for signal variables.lulf2009-06-021-2/+2
| | | | Suggested by: Jaakko Heinonen <jh -at- saunalahti.fi>
* - Use sig_atomic_t for signal handler variables.lulf2009-05-291-2/+2
| | | | MFC after: 1 week
* Update the actions previously attempted by the -D option to make themmckusick2009-02-041-3/+3
| | | | | | | | | | | | | | | | | | robust. With these changes fsck is now able to detect and reliably rebuild corrupted cylinder group maps. The -D option is no longer necessary as it has been replaced by a prompt asking whether the corrupted cylinder group should be rebuilt and doing so when requested. These actions are only offered and taken when running fsck in manual mode. Corrupted cylinder groups found during preen mode cause the fsck to fail. Add the -r option to free up excess unused inodes. Decreasing the number of preallocated inodes reduces the running time of future runs of fsck and frees up space that can allocated to files. The -r option is ignored when running in preen mode. Reviewed by: Xin LI <delphij@> Sponsored by: Rsync.net
* Add the '-C' "check clean" flag. If the FS is marked clean, skip fileobrien2009-01-301-0/+1
| | | | | | | | system checking. However, if the file system is not clean, perform a full fsck. Reviewed by: delphij Obtained from: Juniper Networks
* Rename option 'C' to 'D' (damaged) in order to avoid a conflict with upcomingdelphij2009-01-201-1/+1
| | | | | | | Juniper 'C' (clean) flag. Requested by: obrien MFC after: 1 week
* Add a new flag, '-C' which enables a special mode that is intended fordelphij2008-04-101-0/+2
| | | | | | | | | | catastrophic recovery. Currently, this mode only validates whether a cylindergroup has good signature data, and prompts the user to decide whether to clear it as a whole. This mode is useful when there is data damage on a disk and you are working on copy of the original disk, as fsck_ffs(8) tends to abnormally exit in such case, as a last resort to recover data from the disk.
* Implements gjournal support. If file system has gjournal support enabledpjd2006-10-311-2/+3
| | | | | | | | | | and -p flag was given perform fast file system checking (bascially only garbage collecting of orphaned objects). Rename bread() to blread() and bwrite() to blwrite() as we now link to the libufs library, which also implement functions with that names. Sponsored by: home.pl
* Make background fsck based summary adjustments actually work bydelphij2005-03-071-0/+1
| | | | | | | | | | | | | | | | | | | | | | | initializing the sysctl mibs data before actually using them. The original patchset (which is the actual version that is running on my testboxes) have checked whether all of these sysctls and refuses to do background fsck if we don't have them. Kirk has pointed out that refusing running fsck on old kernels is pointless, as old kernels will recompute the summary at mount time, so I have removed these checks. Unfortunatelly, as the checks will initialize the mib values of those sysctl's, and which are vital for the runtime summary adjustment to work, we can not simply remove the check, which will lead to problem when running background fsck over a dirty volume. Add these checks in a different way: give a warning rather than refusing to work, and complain if the functionality is not available when adjustments are necessary. Noticed by: A power failure at my lab Pointy hat: me MFC After: 3 days
* The recomputation of file system summary at mount time can be adelphij2005-02-201-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | very slow process, especially for large file systems that is just recovered from a crash. Since the summary is already re-sync'ed every 30 second, we will not lag behind too much after a crash. With this consideration in mind, it is more reasonable to transfer the responsibility to background fsck, to reduce the delay after a crash. Add a new sysctl variable, vfs.ffs.compute_summary_at_mount, to control this behavior. When set to nonzero, we will get the "old" behavior, that the summary is computed immediately at mount time. Add five new sysctl variables to adjust ndir, nbfree, nifree, nffree and numclusters respectively. Teach fsck_ffs about these API, however, intentionally not to check the existence, since kernels without these sysctls must have recomputed the summary and hence no adjustments are necessary. This change has eliminated the usual tens of minutes of delay of mounting large dirty volumes. Reviewed by: mckusick MFC After: 1 week
* Explicitly break out NETA license from Berkeley license to clearlyrwatson2004-10-201-0/+21
| | | | | | | indicate license grant, as well as to indicate that NETA is asserting only two clauses, not four clauses. Requested by: imp
* Eliminate linked list used to track inodes with an initial linktruckman2004-10-081-15/+15
| | | | | | | | | count of zero and instead encode this information in the inode state. Pass 4 performed a linear search of this list for each inode in the file system, which performs poorly if the list is long. Reviewed by: sam & keramida (an earlier version of the patch), mckusick MFC after: 1 month
* Create DIP_SET() and IBLK_SET() macros to fix lvalue warnings.scottl2004-09-011-0/+15
| | | | Inspired by: kan
* Remove advertising clause from University of California Regent's license,markm2004-04-091-4/+0
| | | | | | per letter dated July 22, 1999. Approved by: core, imp
* In the case of a background fsck, periodically update the process titlescottl2004-02-281-0/+2
| | | | with a progress update.
* Correct lines incorrectly added to the copyright message. Add missing period.mckusick2003-02-141-4/+1
| | | | | Submitted by: Bruce Evans <bde@zeta.org.au> Sponsored by: DARPA & NAI Labs.
* Add a source file where EXTATTR checks will happen and hook it in evenphk2002-09-161-0/+1
| | | | | | if it doesn't do anything yet. Sponsored by: DARPA & NAI Labs.
* s/filesystem/file system/g as discussed on -developerstrhodes2002-08-211-10/+10
|
* Warning cleanup.phk2002-07-301-11/+12
| | | | Format changes by peter
* This commit adds basic support for the UFS2 filesystem. The UFS2mckusick2002-06-211-32/+63
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* more file system > filesystemtrhodes2002-05-161-8/+8
|
* UFS2 preparation commit:phk2002-05-121-3/+0
| | | | | | | Remove support for converting old FFS formats to newer. Submitted by: mckusick Sponspored by: DARPA & NAI Labs.
* o __P removedimp2002-03-201-64/+64
| | | | | | | o ansi function prototypes o unifdef -D__STDC__ o __dead2 on usage prototype o remove now-bogus main prototype
* Fix a large number of -Wall, -Wformat and -W compiler warnings.iedowse2001-11-171-5/+6
| | | | | | | | | These were mainly missing casts or wrong format strings in printf statements, but there were also missing includes, unused variables, functions and arguments. The choice of `long' vs `int' still seems almost random in a lot of places though.
* Silence non-constant format string warnings by marking functionskris2001-08-191-3/+3
| | | | | | | as __printflike()/__printf0like(), adding const, or adding missing "%s" format strings, as appropriate. MFC after: 2 weeks
* Add support for the -F flag which determines whether a specifiedmckusick2001-04-241-0/+1
| | | | | | | | | | | | filesystem needs foreground checking (usually at boot time) or can defer to background checking (after the system is up and running). See the manual page, fsck_ffs(8), for details on the -F and -B options. These options are primarily intended for use by the fsck front end. All output is directed to stdout so that the output is coherent when redirected to a file or a pipe. Unify the code with the fsck front end that allows either a device or a mount point to be specified as the argument to be checked.
* In fsdb, call sblock_init() which is now necessary to initialiseiedowse2001-04-231-0/+1
| | | | | the global variable dev_bsize. Add a prototype for sblock_init() to fsck.h, and set the return type correctly.
* Minor background cleanups:mckusick2001-04-161-1/+1
| | | | | | | | | | | 1) Set the FS_NEEDSFSCK flag when unexpected problems are encountered. 2) Clear the FS_NEEDSFSCK flag after a successful foreground cleanup. 3) Refuse to run in background when the FS_NEEDSFSCK flag is set. 4) Avoid taking and removing a snapshot when the filesystem is already clean. 5) Properly implement the force cleaning (-f) flag when in preen mode. Note that you need to have revision 1.21 (date: 2001/04/14 05:26:28) of fs.h installed in <ufs/ffs/fs.h> defining FS_NEEDSFSCK for this to compile.
* Additions to run checks on live filesystems. This change will notmckusick2001-03-211-4/+17
| | | | | | | | | affect current systems until fsck is modified to use these new facilities. To try out this change, set the fsck passno to zero in /etc/fstab to cause the filesystem to be mounted without running fsck, then run `fsck_ffs -p -B <filesystem>' after the system has been brought up multiuser to run a background cleanup on <filesystem>. Note that the <filesystem> in question must have soft updates enabled.
* Add a simple SIGINFO handler to fsck_ffs. Shortly after receipt ofiedowse2000-12-151-0/+3
| | | | | | | | a SIGINFO (normally via Ctrl-T), a line will be output indicating the current phase number and progress information relevant to the current phase. Approved by: mckusick
* Reviewed by: rwatson, bpadrian2000-10-091-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | Approved by: rwatson Obtained from: NetBSD-current source tree The beginnings of the fsck wrappers stuff from NetBSD. This particular commit brings a newly repo-copied sbin/fsck_ffs/ (from sbin/fsck/) into fsck wrappers mode. A quick overview (the code reflects this): * Documentation changed to reflect fsck_ffs instead of fsck * Simply acts on a single filesystem, doesn't try to do any multiple filesystem magic - this is done by the fsck wrappers now And then specific to fsck_ffs: * link to /sbin/fsck_4.2bsd and /sbin/fsck_ufs. This is because right now the filesystem is of type ufs not ffs, and that during autodetection the labeltype rather than the VFS type is used - this is because when doing an autodetection of filesystem type in the fsck wrapper program, it does not have any link between label type (4.2bsd, vinum, etc) and VFS string. Note that this shouldn't break a build since the required buildworld Makefile magic and import of the fsck wrapper code into src/sbin/fsck/ will happen in a seperate commit.
* Teach fsck about snapshot files. These changes should have nomckusick2000-07-061-2/+5
| | | | | | | effect on operation of fsck on filesystems without snapshots. If you get compilation errors, be sure that you have copies of /usr/include/sys/mount.h (1.94), /usr/include/sys/stat.h (1.21), and /usr/include/ufs/ffs/fs.h (1.16) as of July 4, 2000 or later.
* Yesterday I had to fix a badly broken disk, and found that fsck kept dying:mckusick2000-02-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | DIR I=64512 CONNECTED. PARENT WAS I=4032 fsck: cannot find inode 995904 fsdb found the inodes with no problem: fsdb (inum: 64512)> inode 995904 current inode: directory I=995904 MODE=40777 SIZE=512 MTIME=Feb 14 15:27:07 2000 [0 nsec] CTIME=Feb 14 15:27:07 2000 [0 nsec] ATIME=Feb 24 10:31:58 2000 [0 nsec] OWNER=nobody GRP=nobody LINKCNT=4 FLAGS=0 BLKCNT=2 GEN=38a41386 Direct blocks: 8094568 0 0 0 0 0 0 0 0 0 0 0 Indirect blocks: 0 0 0 The problem turns out to be a program logic error in fsck. It stores directory inodes internally in hash lists, using the number of directories to form the hash key: inpp = &inphead[inumber % numdirs]; Elsewhere, however, it increments numdirs when it finds unattached directories. I've made the following fix, which solved the problem in the case in hand. Submitted by: Greg Lehey <grog@lemis.com> Reviewed by: Matthew Dillon <dillon@apollo.backplane.com> Approved by: Kirk McKusick <mckusick@mckusick.com>
* - Forgot to nuke hotroot completely.peter2000-01-101-1/+1
| | | | Submitted by: Paul Saab <ps@yahoo-inc.com>
OpenPOWER on IntegriCloud