README revision 1.1.1.1 1 1.1.1.1 fvdl # @(#)README 8.1 (Berkeley) 6/11/93
2 1.1 mycroft
3 1.1 mycroft The file system is reasonably stable, but incomplete. There are
4 1.1 mycroft places where cleaning performance can be improved dramatically (see
5 1.1 mycroft comments in lfs_syscalls.c). For details on the implementation,
6 1.1 mycroft performance and why garbage collection always wins, see Dr. Margo
7 1.1 mycroft Seltzer's thesis available for anonymous ftp from toe.cs.berkeley.edu,
8 1.1 mycroft in the directory pub/personal/margo/thesis.ps.Z, or the January 1993
9 1.1 mycroft USENIX paper.
10 1.1 mycroft
11 1.1 mycroft Missing Functionality:
12 1.1 mycroft Multiple block sizes and/or fragments are not yet implemented.
13 1.1 mycroft
14 1.1 mycroft ----------
15 1.1 mycroft The disk is laid out in segments. The first segment starts 8K into the
16 1.1 mycroft disk (the first 8K is used for boot information). Each segment is composed
17 1.1 mycroft of the following:
18 1.1 mycroft
19 1.1 mycroft An optional super block
20 1.1 mycroft One or more groups of:
21 1.1 mycroft segment summary
22 1.1 mycroft 0 or more data blocks
23 1.1 mycroft 0 or more inode blocks
24 1.1 mycroft
25 1.1 mycroft The segment summary and inode/data blocks start after the super block (if
26 1.1 mycroft present), and grow toward the end of the segment.
27 1.1 mycroft
28 1.1 mycroft _______________________________________________
29 1.1 mycroft | | | | |
30 1.1 mycroft | summary | data/inode | summary | data/inode |
31 1.1 mycroft | block | blocks | block | blocks | ...
32 1.1 mycroft |_________|____________|_________|____________|
33 1.1 mycroft
34 1.1 mycroft The data/inode blocks following a summary block are described by the
35 1.1 mycroft summary block. In order to permit the segment to be written in any order
36 1.1 mycroft and in a forward direction only, a checksum is calculated across the
37 1.1 mycroft blocks described by the summary. Additionally, the summary is checksummed
38 1.1 mycroft and timestamped. Both of these are intended for recovery; the former is
39 1.1 mycroft to make it easy to determine that it *is* a summary block and the latter
40 1.1 mycroft is to make it easy to determine when recovery is finished for partially
41 1.1 mycroft written segments. These checksums are also used by the cleaner.
42 1.1 mycroft
43 1.1 mycroft Summary block (detail)
44 1.1 mycroft ________________
45 1.1 mycroft | sum cksum |
46 1.1 mycroft | data cksum |
47 1.1 mycroft | next segment |
48 1.1 mycroft | timestamp |
49 1.1 mycroft | FINFO count |
50 1.1 mycroft | inode count |
51 1.1 mycroft | flags |
52 1.1 mycroft |______________|
53 1.1 mycroft | FINFO-1 | 0 or more file info structures, identifying the
54 1.1 mycroft | . | blocks in the segment.
55 1.1 mycroft | . |
56 1.1 mycroft | . |
57 1.1 mycroft | FINFO-N |
58 1.1 mycroft | inode-N |
59 1.1 mycroft | . |
60 1.1 mycroft | . |
61 1.1 mycroft | . | 0 or more inode daddr_t's, identifying the inode
62 1.1 mycroft | inode-1 | blocks in the segment.
63 1.1 mycroft |______________|
64 1.1 mycroft
65 1.1 mycroft Inode blocks are blocks of on-disk inodes in the same format as those in
66 1.1 mycroft the FFS. However, spare[0] contains the inode number of the inode so we
67 1.1 mycroft can find a particular inode on a page. They are packed page_size /
68 1.1 mycroft sizeof(inode) to a block. Data blocks are exactly as in the FFS. Both
69 1.1 mycroft inodes and data blocks move around the file system at will.
70 1.1 mycroft
71 1.1 mycroft The file system is described by a super-block which is replicated and
72 1.1 mycroft occurs as the first block of the first and other segments. (The maximum
73 1.1 mycroft number of super-blocks is MAXNUMSB). Each super-block maintains a list
74 1.1 mycroft of the disk addresses of all the super-blocks. The super-block maintains
75 1.1 mycroft a small amount of checkpoint information, essentially just enough to find
76 1.1 mycroft the inode for the IFILE (fs->lfs_idaddr).
77 1.1 mycroft
78 1.1 mycroft The IFILE is visible in the file system, as inode number IFILE_INUM. It
79 1.1 mycroft contains information shared between the kernel and various user processes.
80 1.1 mycroft
81 1.1 mycroft Ifile (detail)
82 1.1 mycroft ________________
83 1.1 mycroft | cleaner info | Cleaner information per file system. (Page
84 1.1 mycroft | | granularity.)
85 1.1 mycroft |______________|
86 1.1 mycroft | segment | Space available and last modified times per
87 1.1 mycroft | usage table | segment. (Page granularity.)
88 1.1 mycroft |______________|
89 1.1 mycroft | IFILE-1 | Per inode status information: current version #,
90 1.1 mycroft | . | if currently allocated, last access time and
91 1.1 mycroft | . | current disk address of containing inode block.
92 1.1 mycroft | . | If current disk address is LFS_UNUSED_DADDR, the
93 1.1 mycroft | IFILE-N | inode is not in use, and it's on the free list.
94 1.1 mycroft |______________|
95 1.1 mycroft
96 1.1 mycroft
97 1.1 mycroft First Segment at Creation Time:
98 1.1 mycroft _____________________________________________________________
99 1.1 mycroft | | | | | | | |
100 1.1 mycroft | 8K pad | Super | summary | inode | ifile | root | l + f |
101 1.1 mycroft | | block | | block | | dir | dir |
102 1.1 mycroft |________|_______|_________|_______|_______|_______|_______|
103 1.1 mycroft ^
104 1.1 mycroft Segment starts here.
105 1.1 mycroft
106 1.1 mycroft Some differences from the Sprite LFS implementation.
107 1.1 mycroft
108 1.1 mycroft 1. The LFS implementation placed the ifile metadata and the super block
109 1.1 mycroft at fixed locations. This implementation replicates the super block
110 1.1 mycroft and puts each at a fixed location. The checkpoint data is divided into
111 1.1 mycroft two parts -- just enough information to find the IFILE is stored in
112 1.1 mycroft two of the super blocks, although it is not toggled between them as in
113 1.1 mycroft the Sprite implementation. (This was deliberate, to avoid a single
114 1.1 mycroft point of failure.) The remaining checkpoint information is treated as
115 1.1 mycroft a regular file, which means that the cleaner info, the segment usage
116 1.1 mycroft table and the ifile meta-data are stored in normal log segments.
117 1.1 mycroft (Tastes great, less filling...)
118 1.1 mycroft
119 1.1 mycroft 2. The segment layout is radically different in Sprite; this implementation
120 1.1 mycroft uses something a lot like network framing, where data/inode blocks are
121 1.1 mycroft written asynchronously, and a checksum is used to validate any set of
122 1.1 mycroft summary and data/inode blocks. Sprite writes summary blocks synchronously
123 1.1 mycroft after the data/inode blocks have been written and the existence of the
124 1.1 mycroft summary block validates the data/inode blocks. This permits us to write
125 1.1 mycroft everything contiguously, even partial segments and their summaries, whereas
126 1.1 mycroft Sprite is forced to seek (from the end of the data inode to the summary
127 1.1 mycroft which lives at the end of the segment). Additionally, writing the summary
128 1.1 mycroft synchronously should cost about 1/2 a rotation per summary.
129 1.1 mycroft
130 1.1 mycroft 3. Sprite LFS distinguishes between different types of blocks in the segment.
131 1.1 mycroft Other than inode blocks and data blocks, we don't.
132 1.1 mycroft
133 1.1 mycroft 4. Sprite LFS traverses the IFILE looking for free blocks. We maintain a
134 1.1 mycroft free list threaded through the IFILE entries.
135 1.1 mycroft
136 1.1 mycroft 5. The cleaner runs in user space, as opposed to kernel space. It shares
137 1.1 mycroft information with the kernel by reading/writing the IFILE and through
138 1.1 mycroft cleaner specific system calls.
139 1.1 mycroft
140