NetBSD/sbin/fsck_lfs
perseant 9c7f8050f4 Various bug-fixes to LFS, to wit:
Kernel:

* Add runtime quantity lfs_ravail, the number of disk-blocks reserved
  for writing.  Writes to the filesystem first reserve a maximum amount
  of blocks before their write is allowed to proceed; after the blocks
  are allocated the reserved total is reduced by a corresponding amount.

  If the lfs_reserve function cannot immediately reserve the requested
  number of blocks, the inode is unlocked, and the thread sleeps until
  the cleaner has made enough space available for the blocks to be
  reserved.  In this way large files can be written to the filesystem
  (or, smaller files can be written to a nearly-full but thoroughly
  clean filesystem) and the cleaner can still function properly.

* Remove explicit switching on dlfs_minfreeseg from the kernel code; it
  is now merely a fs-creation parameter used to compute dlfs_avail and
  dlfs_bfree (and used by fsck_lfs(8) to check their accuracy).  Its
  former role is better assumed by a properly computed dlfs_avail.

* Bounds-check inode numbers submitted through lfs_bmapv and lfs_markv.
  This prevents a panic, but, if the cleaner is feeding the filesystem
  the wrong data, you are still in a world of hurt.

* Cleanup: remove explicit references of DEV_BSIZE in favor of
  btodb()/dbtob().

lfs_cleanerd:

* Make -n mean "send N segments' blocks through a single call to
  lfs_markv".  Previously it had meant "clean N segments though N calls
  to lfs_markv, before looking again to see if more need to be cleaned".
  The new behavior gives better packing of direct data on disk with as
  little metadata as possible, largely alleviating the problem that the
  cleaner can consume more disk through inefficient use of metadata than
  it frees by moving dirty data away from clean "holes" to produce
  entirely clean segments.

* Make -b mean "read as many segments as necessary to write N segments
  of dirty data back to disk", rather than its former meaning of "read
  as many segments as necessary to free N segments worth of space".  The
  new meaning, combined with the new -n behavior described above,
  further aids in cleaning storage efficiency as entire segments can be
  written at once, using as few blocks as possible for segment summaries
  and inode blocks.

* Make the cleaner take note of segments which could not be cleaned due
  to error, and not attempt to clean them until they are entirely free
  of dirty blocks.  This prevents the case in which a cleanerd running
  with -n 1 and without -b (formerly the default) would spin trying
  repeatedly to clean a corrupt segment, while the remaining space
  filled and deadlocked the filesystem.

* Update the lfs_cleanerd manual page to describe all the options,
  including the changes mentioned here (in particular, the -b and -n
  flags were previously undocumented).

fsck_lfs:

* Check, and optionally fix, lfs_avail (to an exact figure) and
  lfs_bfree (within a margin of error) in pass 5.

newfs_lfs:

* Reduce the default dlfs_minfreeseg to 1/20 of the total segments.

* Add a warning if the sgs disklabel field is 16 (the default for FFS'
  cpg, but not usually desirable for LFS' sgs: 5--8 is a better range).

* Change the calculation of lfs_avail and lfs_bfree, corresponding to
  the kernel changes mentioned above.

mount_lfs:

* Add -N and -b options to pass corresponding -n and -b options to
  lfs_cleanerd.

* Default to calling lfs_cleanerd with "-b -n 4".


[All of these changes were largely tested in the 1.5 branch, with the
idea that they (along with previous un-pulled-up work) could be applied
to the branch while it was still in ALPHA2; however my test system has
experienced corruption on another filesystem (/dev/console has gone
missing :^), and, while I believe this unrelated to the LFS changes, I
cannot with good conscience request that the changes be pulled up.]
2000-09-09 04:49:54 +00:00
..
Makefile Check for cycles in the inode free list, and for free inodes not on the free 2000-05-30 04:33:14 +00:00
dir.c Add "-i" flag to specify the location of the index file inode, to 2000-06-14 18:43:57 +00:00
extern.h Convert to NetBSD source code style 2000-05-23 01:48:52 +00:00
fsck.h Convert to NetBSD source code style 2000-05-23 01:48:52 +00:00
fsck_lfs.8 fsck_lfs can now write to the filesystem, allowing it to correct most 2000-05-16 04:55:58 +00:00
fsck_vars.h Add "-i" flag to specify the location of the index file inode, to 2000-06-14 18:43:57 +00:00
inode.c Add "-i" flag to specify the location of the index file inode, to 2000-06-14 18:43:57 +00:00
main.c Add "-i" flag to specify the location of the index file inode, to 2000-06-14 18:43:57 +00:00
pass0.c Add "-i" flag to specify the location of the index file inode, to 2000-06-14 18:43:57 +00:00
pass1.c Add "-i" flag to specify the location of the index file inode, to 2000-06-14 18:43:57 +00:00
pass2.c Add "-i" flag to specify the location of the index file inode, to 2000-06-14 18:43:57 +00:00
pass3.c Convert to NetBSD source code style 2000-05-23 01:48:52 +00:00
pass4.c Convert to NetBSD source code style 2000-05-23 01:48:52 +00:00
pass5.c Various bug-fixes to LFS, to wit: 2000-09-09 04:49:54 +00:00
setup.c Add "-i" flag to specify the location of the index file inode, to 2000-06-14 18:43:57 +00:00
utilities.c Add "-i" flag to specify the location of the index file inode, to 2000-06-14 18:43:57 +00:00
vars.c Add "-i" flag to specify the location of the index file inode, to 2000-06-14 18:43:57 +00:00