Commit Graph

25 Commits

Author SHA1 Message Date
perseant 4e3fced95b Merge the short-lived perseant-lfsv2 branch into the trunk.
Kernels and tools understand both v1 and v2 filesystems; newfs_lfs
generates v2 by default.  Changes for the v2 layout include:

- Segments of non-PO2 size and arbitrary block offset, so these can be
  matched to convenient physical characteristics of the partition (e.g.,
  stripe or track size and offset).

- Address by fragment instead of by disk sector, paving the way for
  non-512-byte-sector devices.  In theory fragments can be as large
  as you like, though in reality they must be smaller than MAXBSIZE in size.

- Use serial number and filesystem identifier to ensure that roll-forward
  doesn't get old data and think it's new.  Roll-forward is enabled for
  v2 filesystems, though not for v1 filesystems by default.

- The inode free list is now a tailq, paving the way for undelete (undelete
  is not yet implemented, but can be without further non-backwards-compatible
  changes to disk structures).

- Inode atime information is kept in the Ifile, instead of on the inode;
  that is, the inode is never written *just* because atime was changed.
  Because of this the inodes remain near the file data on the disk, rather
  than wandering all over as the disk is read repeatedly.  This speeds up
  repeated reads by a small but noticeable amount.

Other changes of note include:

- The ifile written by newfs_lfs can now be of arbitrary length, it is no
  longer restricted to a single indirect block.

- Fixed an old bug where ctime was changed every time a vnode was created.
  I need to look more closely to make sure that the times are only updated
  during write(2) and friends, not after-the-fact during a segment write,
  and certainly not by the cleaner.
2001-07-13 20:30:18 +00:00
wiz 73f545bb5b Drop arguments of .Os. 2001-06-05 11:22:41 +00:00
wiz 93709797b6 Xref newfs_lfs instead of newlfs; whitespace fixes while I'm here. 2001-04-03 11:07:50 +00:00
cgd 8a986b2e96 convert to use getprogname() 2001-02-19 22:48:57 +00:00
christos aceee3f06d fix redundant decls 2001-02-04 21:52:02 +00:00
joff 42ac80ad6d Fixed blockmap handling to properly use disk blocks rather than fragments.
Fixes an issue with fsck_lfs not detecting all duplicate blocks that may
exist in a corrupted filesystem.
2001-01-06 23:08:24 +00:00
lukem f7650338ca use %ll_ instead of the less standard %q_ 2001-01-05 02:02:57 +00:00
perseant 7c5a881d60 Check/fix accounting of lfs_dmeta. Patch from Jesse Off
<joff@gci-net.com> (PR #11534).
2000-11-21 06:24:26 +00:00
perseant a3bb9e16b4 Report, and detect and correct inconsistencies in, the number of clean
segments.  Patches from Jesse Off <joff@gci-net.com> (PR #11470).
2000-11-13 00:30:48 +00:00
perseant 5975446609 Add "-f" flag to match fsck(8) manual page. This flag currently has no
effect.  Fixes PR #11129.
2000-11-11 22:26:10 +00:00
lukem 279552d3db fix up various .Nm abuses:
- keep the case consistent between the actual name and what's referenced.
  e.g, if it's `foo', don't use '.Nm Foo' at the start of a sentence.
- remove unnecessary `.Nm foo' after the first occurrence (except for
  using `.Nm ""' if there's stuff following, or for the 2nd and so on
  occurrences in a SYNOPSIS
- use Sx, Ic, Li, Em, Sq, and Xr as appropriate
2000-11-07 06:43:24 +00:00
fvdl 2753597fd4 Disable VERBOSE_BLOCKMAP by default; it allocates huge amounts of
memory, causing immediate fsck_lfs failure for big filesystems.
2000-10-19 14:58:40 +00:00
is 9979da6cbb Format string cleanups by Bill Sommerfeld. 2000-10-10 20:24:49 +00:00
jdolecek cf8b00f58b setup(): use calloc() for blockmap allocation, instead of malloc() followed
by bzero(); the net result is that the test for allocation failure
is actually sensible now
2000-10-04 11:37:54 +00:00
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
perseant 75453f286d Add "-i" flag to specify the location of the index file inode, to
examine alternate checkpoints.  Regularize usage of maxino.  Remove olf
debugging cruft.
2000-06-14 18:43:57 +00:00
perseant 9e80654bda Check for cycles in the inode free list, and for free inodes not on the free
list.
2000-05-30 04:33:14 +00:00
perseant 1d2596714b Convert to NetBSD source code style 2000-05-23 01:48:52 +00:00
perseant e6c7065240 fsck_lfs can now write to the filesystem, allowing it to correct most
(though still not all) errors in a damaged lfs.  Segment byte accounting
is corrected in pass 5.  "fsck_lfs -p" will do a partial roll-forward,
verifying the checkpoint from the newer superblock.  fscknames[] is
updated so that fsck knows about fsck_lfs.
2000-05-16 04:55:58 +00:00
simonb 48a5c3efa9 Don't declare 'extern opt*' getopt variables. 2000-04-14 05:58:01 +00:00
perseant ad4e686817 Rename lfs_ifind so that it does not conflict with new kernel prototype.
Addresses PR #9253.
2000-01-20 21:32:31 +00:00
kleink 9d343b25ca RCS Id police. 1999-07-03 19:55:03 +00:00
nathanw 210c7f5748 printf format fixes for Alpha. 1999-03-24 05:32:23 +00:00
perseant d5c144cf97 "LFS" really stands for "Log-*structured* File System" 1999-03-19 17:29:44 +00:00
perseant 369e9cadf8 Initial checkin of fsck_lfs. This version cannot do any repair (-p flag
does nothing, and one of -p or -n is required) but can be useful as a
diagnostic tool.
1999-03-18 02:02:18 +00:00