NetBSD/sys/ufs/lfs
hannken fc48ac80f9 Fix copy and paste errors from last commits.
- Kernel i386/ALL and amd64/ALL compile again.
- Resolves CID 1304138 (DEADCODE) and 1304139 (IDENTICAL_BRANCHES).
2015-06-07 13:39:48 +00:00
..
CHANGES
Makefile Split the definitions suitable for userland out of ulfs_inode.h into 2013-06-08 02:04:31 +00:00
README
README.wc Update the line-count standings. 2013-06-06 01:01:42 +00:00
TODO
lfs.h Use VFS_PROTOS() for lfs. 2015-05-31 15:44:30 +00:00
lfs_alloc.c Change lfs from hash table to vcache. 2015-05-31 15:48:02 +00:00
lfs_balloc.c Remove the 'cred' argument from bread(). Remove a now unused var in 2015-03-28 19:24:04 +00:00
lfs_bio.c Change the queue.3 *_END(&head) macros to NULL. Since we don't have CIRCLEQ 2013-11-27 17:24:43 +00:00
lfs_cksum.c Cleanups and hacks to make lfs userland stuff build: 2013-06-06 00:54:49 +00:00
lfs_debug.c Prefix most of the cpp macros with lfs_ and LFS_ to avoid conflicts with ffs. 2013-06-18 18:18:57 +00:00
lfs_extern.h Change lfs from hash table to vcache. 2015-05-31 15:48:02 +00:00
lfs_inode.c - remove unused variables 2013-10-17 21:01:08 +00:00
lfs_inode.h Close comments 2014-05-26 19:12:43 +00:00
lfs_itimes.c Tidy up the LFS userland build hacks. 2013-06-08 02:16:03 +00:00
lfs_kernel.h Add lfs_kernel.h for declarations that don't need to be exposed to userland. 2013-07-28 01:05:52 +00:00
lfs_pages.c Move lfs_getpages and lfs_putpages to their own file. 2014-05-16 09:34:03 +00:00
lfs_rename.c Disentangle buffer-cached I/O from page-cached I/O in UFS. 2015-03-27 17:27:55 +00:00
lfs_rfw.c Change lfs from hash table to vcache. 2015-05-31 15:48:02 +00:00
lfs_segment.c Fix copy and paste errors from last commits. 2015-06-07 13:39:48 +00:00
lfs_subr.c Add lfs_kernel.h for declarations that don't need to be exposed to userland. 2013-07-28 01:05:52 +00:00
lfs_syscalls.c Change lfs from hash table to vcache. 2015-05-31 15:48:02 +00:00
lfs_vfsops.c Fix copy and paste errors from last commits. 2015-06-07 13:39:48 +00:00
lfs_vnops.c Fix copy and paste errors from last commits. 2015-06-07 13:39:48 +00:00
ulfs_bmap.c Migrate the miscellaneous ulfs-level info from struct ulfsmount to 2013-07-28 01:10:49 +00:00
ulfs_bswap.h use __USE() in the right place, instead of (void)var. 2013-10-18 15:15:22 +00:00
ulfs_dinode.h Move a comment to lfs.h that belongs better there. 2013-06-08 22:19:01 +00:00
ulfs_dirhash.c Ensure that the top level sysctl nodes (kern, vfs, net, ...) exist before 2014-02-25 18:30:08 +00:00
ulfs_dirhash.h DIRBLKSIZ -> LFS_DIRBLKSIZ 2013-06-08 02:14:46 +00:00
ulfs_extattr.c Change vnode operation lookup to return the resulting vnode *vpp unlocked. 2014-02-07 15:29:20 +00:00
ulfs_extattr.h Split lfs from ufs step 4: 2013-06-06 00:48:04 +00:00
ulfs_extern.h Change lfs from hash table to vcache. 2015-05-31 15:48:02 +00:00
ulfs_inode.c Change lfs from hash table to vcache. 2015-05-31 15:48:02 +00:00
ulfs_inode.h Remove the DIROP macros. They are evil, especially the CREATE ones. 2014-05-17 07:08:35 +00:00
ulfs_lookup.c Change lfs from hash table to vcache. 2015-05-31 15:48:02 +00:00
ulfs_quota.c Revert the following changes: 2014-06-28 22:27:50 +00:00
ulfs_quota.h Revert the following changes: 2014-06-28 22:27:50 +00:00
ulfs_quota1.c Introduce a selector function to the vfs vnode iterator so that we don't 2014-05-24 16:34:03 +00:00
ulfs_quota1.h Add lfs_ or ulfs_ in front of extern symbols lacking them, mostly 2013-06-06 00:49:28 +00:00
ulfs_quota1_subr.c Add lfs_ or ulfs_ in front of extern symbols lacking them, mostly 2013-06-06 00:49:28 +00:00
ulfs_quota2.c Remove the 'cred' argument from bread(). Remove a now unused var in 2015-03-28 19:24:04 +00:00
ulfs_quota2.h Add lfs_ or ulfs_ in front of extern symbols lacking them, mostly 2013-06-06 00:49:28 +00:00
ulfs_quota2_subr.c Cleanups to reduce symbol and header exposure: 2013-06-06 00:51:50 +00:00
ulfs_quotacommon.h Split the definitions suitable for userland out of ulfs_inode.h into 2013-06-08 02:04:31 +00:00
ulfs_readwrite.c Strip IO_JOURNALLOCKED, PGO_JOURNALLOCKED out of ulfs_readwrite.c. 2015-04-12 22:51:23 +00:00
ulfs_snapshot.c There is no WAPBL in LFS. 2013-06-08 22:05:15 +00:00
ulfs_vfsops.c Change lfs from hash table to vcache. 2015-05-31 15:48:02 +00:00
ulfs_vnops.c Change lfs from hash table to vcache. 2015-05-31 15:48:02 +00:00
ulfsmount.h Change lfs from hash table to vcache. 2015-05-31 15:48:02 +00:00

README

#	$NetBSD: README,v 1.3 1999/03/15 00:46:47 perseant Exp $

#	@(#)README	8.1 (Berkeley) 6/11/93

The file system is reasonably stable...I think.

For details on the implementation, performance and why garbage
collection always wins, see Dr. Margo Seltzer's thesis available for
anonymous ftp from toe.cs.berkeley.edu, in the directory
pub/personal/margo/thesis.ps.Z, or the January 1993 USENIX paper.

----------
The disk is laid out in segments.  The first segment starts 8K into the
disk (the first 8K is used for boot information).  Each segment is composed
of the following:

	An optional super block
	One or more groups of:
		segment summary
		0 or more data blocks
		0 or more inode blocks

The segment summary and inode/data blocks start after the super block (if
present), and grow toward the end of the segment.

	_______________________________________________
	|         |            |         |            |
	| summary | data/inode | summary | data/inode |
	|  block  |   blocks   |  block  |   blocks   | ...
	|_________|____________|_________|____________|

The data/inode blocks following a summary block are described by the
summary block.  In order to permit the segment to be written in any order
and in a forward direction only, a checksum is calculated across the
blocks described by the summary.  Additionally, the summary is checksummed
and timestamped.  Both of these are intended for recovery; the former is
to make it easy to determine that it *is* a summary block and the latter
is to make it easy to determine when recovery is finished for partially
written segments.  These checksums are also used by the cleaner.

	Summary block (detail)
	________________
	| sum cksum    |
	| data cksum   |
	| next segment |
	| timestamp    |
	| FINFO count  |
	| inode count  |
	| flags        |
	|______________|
	|   FINFO-1    | 0 or more file info structures, identifying the
	|     .        | blocks in the segment.
	|     .        |
	|     .        |
	|   FINFO-N    |
	|   inode-N    |
	|     .        |
	|     .        |
	|     .        | 0 or more inode daddr_t's, identifying the inode
	|   inode-1    | blocks in the segment.
	|______________|

Inode blocks are blocks of on-disk inodes in the same format as those in
the FFS.  However, spare[0] contains the inode number of the inode so we
can find a particular inode on a page.  They are packed page_size /
sizeof(inode) to a block.  Data blocks are exactly as in the FFS.  Both
inodes and data blocks move around the file system at will.

The file system is described by a super-block which is replicated and
occurs as the first block of the first and other segments.  (The maximum
number of super-blocks is MAXNUMSB).  Each super-block maintains a list
of the disk addresses of all the super-blocks.  The super-block maintains
a small amount of checkpoint information, essentially just enough to find
the inode for the IFILE (fs->lfs_idaddr).

The IFILE is visible in the file system, as inode number IFILE_INUM.  It
contains information shared between the kernel and various user processes.

	Ifile (detail)
	________________
	| cleaner info | Cleaner information per file system.  (Page
	|              | granularity.)
	|______________|
	| segment      | Space available and last modified times per
	| usage table  | segment.  (Page granularity.)
	|______________|
	|   IFILE-1    | Per inode status information: current version #,
	|     .        | if currently allocated, last access time and
	|     .        | current disk address of containing inode block.
	|     .        | If current disk address is LFS_UNUSED_DADDR, the
	|   IFILE-N    | inode is not in use, and it's on the free list.
	|______________|


First Segment at Creation Time:
_____________________________________________________________
|        |       |         |       |       |       |       |
| 8K pad | Super | summary | inode | ifile | root  | l + f |
|        | block |         | block |       | dir   | dir   |
|________|_______|_________|_______|_______|_______|_______|
	  ^
           Segment starts here.

Some differences from the Sprite LFS implementation.

1. The LFS implementation placed the ifile metadata and the super block
   at fixed locations.  This implementation replicates the super block
   and puts each at a fixed location.  The checkpoint data is divided into
   two parts -- just enough information to find the IFILE is stored in
   two of the super blocks, although it is not toggled between them as in
   the Sprite implementation.  (This was deliberate, to avoid a single
   point of failure.)  The remaining checkpoint information is treated as
   a regular file, which means that the cleaner info, the segment usage
   table and the ifile meta-data are stored in normal log segments.
   (Tastes great, less filling...)

2. The segment layout is radically different in Sprite; this implementation
   uses something a lot like network framing, where data/inode blocks are
   written asynchronously, and a checksum is used to validate any set of
   summary and data/inode blocks.  Sprite writes summary blocks synchronously
   after the data/inode blocks have been written and the existence of the
   summary block validates the data/inode blocks.  This permits us to write
   everything contiguously, even partial segments and their summaries, whereas
   Sprite is forced to seek (from the end of the data inode to the summary
   which lives at the end of the segment).  Additionally, writing the summary
   synchronously should cost about 1/2 a rotation per summary.

3. Sprite LFS distinguishes between different types of blocks in the segment.
   Other than inode blocks and data blocks, we don't.

4. Sprite LFS traverses the IFILE looking for free blocks.  We maintain a
   free list threaded through the IFILE entries.

5. The cleaner runs in user space, as opposed to kernel space.  It shares
   information with the kernel by reading/writing the IFILE and through
   cleaner specific system calls.