Commit Graph

126 Commits

Author SHA1 Message Date
perseant
fabf2934ae On-disk inode accounting fix for roll-forward. 2006-07-19 22:48:11 +00:00
perseant
a37f15f04c Don't doubly free an inode remove_ino() during roll-forward. 2006-07-19 02:45:10 +00:00
perseant
a0a4c29df0 Quell uninitialized-variable warning that appeared when compiling for macppc. 2006-07-18 23:47:44 +00:00
perseant
29f1062b46 Various improvements to fsck_lfs, to wit:
* Add lfs_balloc capability to the lfs library.
* Extend the Ifile if we run out of free inodes when creating lost+found.
* Don't roll forward if we have allocated a lost+found, to avoid
  conflicts when adding new files in roll-forward.
* Make some messages slightly more verbose (e.g. include inode number,
  and use pwarn() instead of printf() so the messages include the device
  name when preening).
* Change superblock detection/avoidance to use the offset table in the
  primary superblock, rather than looking at the contents.
* Be more verbose about various operations when passed the -d flag,
  especially roll-forward.
* Be more careful about dirops during roll forward, since the cleaner can
  sometimes write blocks from dirop vnodes.  Detect and avoid this problem.
* Always check the free list, even if given -i; if we're going to write
  it we have to check it first.
* Mark inodes dirty when blocks are found during roll forward, so the
  inodes are written with the new block locations.
* Update size of inodes if blocks beyond EOF are found during roll
  forward.
* Fix segment accounting for blocks and inodes found during roll
  forward.
* Report statistics on roll forward: how many new/deleted/moved files
  and how many updated blocks (or "nothing new").
* Don't care if the device being checked is really a device, if we have
  been passed the -f flag (to facilitate automated testing).
* When writing to the disk, use the current time in the segment headers
  rathern than time 0.
* When passed the -i flag, locate the partial segment containing the
  Ifile inode and use that to calculate lfs_offset, lfs_curseg,
  lfs_nextseg.  (Again for automated testing.)
2006-07-18 23:37:13 +00:00
christos
657e8b0071 fsck_lfs does not us fsutil.c; perhaps it should? revert to perror for now. 2006-06-05 23:27:36 +00:00
christos
0268f6ea4e s/perror/perr 2006-06-05 16:53:14 +00:00
jnemeth
13eb323a11 Coverity CID 3447: Add extraneous checks to shut up Coverity. 2006-05-23 22:35:20 +00:00
yamt
69f5e94d4e define dummy NOCRED by ourselves, rather than assuming that kernel headers
provide it.
2006-05-03 15:04:51 +00:00
perseant
00d9f4be09 Avoid a core dump if ginode() returns NULL. Correct an error message
while we're here.
2006-04-28 00:07:54 +00:00
christos
23be85ae7f "struct ucred" should not be exposed to userland. Instead make it a "void *"
since it is not really used.
2006-04-19 15:52:58 +00:00
perseant
7700866e01 Remove the free list ordering/disordering code, since the kernel now keeps
the list in order (ordering it on mount).

Regularize error messages: these are now all in ALL CAPS, with all hex
numbers (not reported in caps) prefixed by 0x.  (The non-fsck-specific
messages are an exception to this all-caps rule.)
2006-04-17 19:05:16 +00:00
perseant
1f429c3724 Don't update the superblock if we were run with -n, regardless of whether
the "clean" bit is set.
2006-04-13 19:50:10 +00:00
christos
0794bfc81d Coverity CID 2551: Don't use LIST_FOREACH() if you are going to free the
current element (bp) in the body of the loop; the foreach does bp = bp->next;
2006-03-20 01:20:55 +00:00
perseant
16cb5d93b2 Make it compile again. 2006-03-17 19:24:08 +00:00
rumble
e948e1b17f Check for allocation failures in malloc, calloc, realloc, asprintf, and
vasprintf and try to handle them.
2006-03-17 15:53:46 +00:00
jmc
49c83b8ea2 Put back removed initializer. gcc on sh3 still doesn't get it correct... 2005-10-13 21:14:45 +00:00
chs
6c50e54c82 avoid the need for a bogus initializer. 2005-10-08 03:21:17 +00:00
jmmv
2a3e5eeb7c 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.
2005-09-23 12:10:31 +00:00
christos
100801ed72 rename lfs.h to lfs_user.h so that it does not conflict. 2005-09-13 04:14:17 +00:00
christos
8a2ba8f0f7 This should be LFS_MAXNAMLEN 2005-08-23 11:44:25 +00:00
tron
0989a73965 Use FFS_MAXNAMLEN instead of MAXNAMLEN. 2005-08-23 11:26:59 +00:00
kent
2fd38e91a5 fix a compilation problem on LP64 2005-08-20 14:59:20 +00:00
christos
c4ee9f6d2e 64 bit inode changes 2005-08-19 02:07:18 +00:00
christos
9be35a638f more const. 2005-06-27 02:49:32 +00:00
christos
e0dd0ca293 constify 2005-06-27 02:48:28 +00:00
perseant
4b8db8388e Use the correct method to create a new inode, when we allocate lost+found.
Correct uninitialized variable issues in pass6.c and dir.c (PR#30411 and
PR#30394, respectively).
2005-06-08 19:09:55 +00:00
he
e82dc5dc94 Initialize metalbn in ufs_getlbns to appease -Wuninitialized.
Marked with XXXGCC for dreamcast (found while compiling for it).

Reviewed by lukem.
2005-06-07 09:08:07 +00:00
lukem
1ab5811713 Disable -Wuninitialized on dir.c (until PR 30394 is addressed)
and pass6.c (until PR 30411 is addressed)
2005-06-03 18:02:03 +00:00
lukem
2b11c546a4 appease gcc -Wuninitialized 2005-06-02 01:02:21 +00:00
agc
d5a81777aa Make this build on arm platforms by using the correct printf formats. 2005-05-24 06:51:49 +00:00
perseant
b1dbcbaa26 Check some error conditions that would otherwise cause fsck_lfs to dump core.
Pointed out by Pavel Cahyna in a follow-on to PR #29151.
2005-05-23 22:17:20 +00:00
perseant
9bf7a991c5 Fail gracefully if we are asked to expand the buffer cache hash table size
when there is no memory available to do so.  Use the uvnode's strategy
routine to retrieve data from the device, rather than always using pread().
Add a buffer header flag that specifies external management of the buffer's
data area.

All of this in support of a new cleaner, which is not included in this commit.
2005-05-20 18:59:36 +00:00
perseant
a73b3b19ea Check parts of pass 5 even if only rolling forward. We can't check the true
segment holdings against the blocks held by the inodes, but we can still
check the cleanerinfo data against the segment table.
2005-04-23 20:21:03 +00:00
wiz
049635f546 Sync usage with man page. 2005-04-14 21:30:11 +00:00
wiz
21a2722f35 Quote a word that would otherwise be interpreted as macro;
increase width argument to .Bl so that all options fit.
2005-04-14 21:29:29 +00:00
wiz
b4508f65fb Bump date for new -q; use Dq; capitalize NetBSD
in the usual way; new sentence, new line; some nits.
2005-04-14 21:26:11 +00:00
perseant
68db799864 Document "-f" (force check) flag. Implement and document "-q" (quiet). 2005-04-14 21:15:59 +00:00
perseant
b0a56e6928 Take care preserving the integrity of the free list during roll forward.
Also, avoid freeing a deleted vnode twice when a file is remove during
roll forward.
2005-04-12 23:14:18 +00:00
martin
9edc493234 When creating an int hash value from pointer, go via intptr_t.
Fixes PR 29953.
2005-04-12 12:42:02 +00:00
perseant
1d4cc6a17b Be more efficient with the hash tables for the buffer and vnode caches.
Note that roll-forward can add more inodes to the filesystem; don't overflow
the tables but reallocate them.
2005-04-11 23:19:24 +00:00
perseant
e6e33f374d Correct phase 0 message 2005-04-06 04:32:59 +00:00
perseant
aafc65baa9 Note that fsck_lfs may not know beforehand whether a given block is a
superblock or a segment summary, and tries both.  These may be different
sizes.  Fix a broken assertion that they are the same size.

Fixes PR # 29151.
2005-04-06 02:38:17 +00:00
he
2d66b2737e Move the definition of simple_lock() and simple_unlock() to a common
header, since more of the LFS macros now use these functions.  Since
we're outside of the kernel, these are defined to be empty.
2005-04-01 23:45:59 +00:00
perseant
dcba0206d6 "#define lfs_devvp lfs_unlockvp" for readability, since that's what we
use it for in fsck_lfs/newfs_lfs.
2005-03-25 20:16:37 +00:00
perseant
3118a7b178 Make fsck_lfs optimize the inode free list, if it appears to have become
too disordered.  This should improve file creation speed on aged filesystems.
Include code to disorder the list for debugging purposes, though this is
of course not compiled in by default.
2005-03-25 20:14:43 +00:00
perseant
9740d8d0b2 Buffer cache fixes: make sure we initialize all the hash lists, and allow
the cache to grow in size irrespective of how many buffers may be in the
locked queue, since we can't write those in any case.  Prevents fsck_lfs
from spinning when it has too much to write.
2005-03-19 00:43:17 +00:00
perseant
5d2f3e4908 Various minor LFS improvements:
* Extend the lfs library from fsck_lfs(8) so that it can be used with a
  not-yet-existent LFS.  Make newfs_lfs(8) use this library, so it can
  create LFSs whose Ifile is larger than one segment.
* Make newfs_lfs(8) use strsuftoi64() for its arguments, a la newfs(8).
* Make fsck_lfs(8) respect the "file system is clean" flag.
* Don't let fsck_lfs(8) think it has dirty blocks when invoked with the
  -n flag.
2005-02-26 05:45:54 +00:00
perry
5c9f370160 remove obsolete "register" declarations. 2005-02-06 06:13:47 +00:00
perry
251f7f5990 ANSIfy a function declaration, remove obsolete "register" declarations. 2005-02-06 06:13:12 +00:00
xtraeme
76500fc2f9 WARNS=2 is the default defined in sbin/Makefile.inc. (thanks wiz) 2005-01-20 16:39:22 +00:00