README revision 1.2
11.2Scgd# $NetBSD: README,v 1.2 1994/06/29 06:46:43 cgd Exp $ 21.2Scgd 31.2Scgd# @(#)README 8.1 (Berkeley) 6/11/93 41.1Smycroft 51.1SmycroftThe file system is reasonably stable, but incomplete. There are 61.1Smycroftplaces where cleaning performance can be improved dramatically (see 71.1Smycroftcomments in lfs_syscalls.c). For details on the implementation, 81.1Smycroftperformance and why garbage collection always wins, see Dr. Margo 91.1SmycroftSeltzer's thesis available for anonymous ftp from toe.cs.berkeley.edu, 101.1Smycroftin the directory pub/personal/margo/thesis.ps.Z, or the January 1993 111.1SmycroftUSENIX paper. 121.1Smycroft 131.1SmycroftMissing Functionality: 141.1Smycroft Multiple block sizes and/or fragments are not yet implemented. 151.1Smycroft 161.1Smycroft---------- 171.1SmycroftThe disk is laid out in segments. The first segment starts 8K into the 181.1Smycroftdisk (the first 8K is used for boot information). Each segment is composed 191.1Smycroftof the following: 201.1Smycroft 211.1Smycroft An optional super block 221.1Smycroft One or more groups of: 231.1Smycroft segment summary 241.1Smycroft 0 or more data blocks 251.1Smycroft 0 or more inode blocks 261.1Smycroft 271.1SmycroftThe segment summary and inode/data blocks start after the super block (if 281.1Smycroftpresent), and grow toward the end of the segment. 291.1Smycroft 301.1Smycroft _______________________________________________ 311.1Smycroft | | | | | 321.1Smycroft | summary | data/inode | summary | data/inode | 331.1Smycroft | block | blocks | block | blocks | ... 341.1Smycroft |_________|____________|_________|____________| 351.1Smycroft 361.1SmycroftThe data/inode blocks following a summary block are described by the 371.1Smycroftsummary block. In order to permit the segment to be written in any order 381.1Smycroftand in a forward direction only, a checksum is calculated across the 391.1Smycroftblocks described by the summary. Additionally, the summary is checksummed 401.1Smycroftand timestamped. Both of these are intended for recovery; the former is 411.1Smycroftto make it easy to determine that it *is* a summary block and the latter 421.1Smycroftis to make it easy to determine when recovery is finished for partially 431.1Smycroftwritten segments. These checksums are also used by the cleaner. 441.1Smycroft 451.1Smycroft Summary block (detail) 461.1Smycroft ________________ 471.1Smycroft | sum cksum | 481.1Smycroft | data cksum | 491.1Smycroft | next segment | 501.1Smycroft | timestamp | 511.1Smycroft | FINFO count | 521.1Smycroft | inode count | 531.1Smycroft | flags | 541.1Smycroft |______________| 551.1Smycroft | FINFO-1 | 0 or more file info structures, identifying the 561.1Smycroft | . | blocks in the segment. 571.1Smycroft | . | 581.1Smycroft | . | 591.1Smycroft | FINFO-N | 601.1Smycroft | inode-N | 611.1Smycroft | . | 621.1Smycroft | . | 631.1Smycroft | . | 0 or more inode daddr_t's, identifying the inode 641.1Smycroft | inode-1 | blocks in the segment. 651.1Smycroft |______________| 661.1Smycroft 671.1SmycroftInode blocks are blocks of on-disk inodes in the same format as those in 681.1Smycroftthe FFS. However, spare[0] contains the inode number of the inode so we 691.1Smycroftcan find a particular inode on a page. They are packed page_size / 701.1Smycroftsizeof(inode) to a block. Data blocks are exactly as in the FFS. Both 711.1Smycroftinodes and data blocks move around the file system at will. 721.1Smycroft 731.1SmycroftThe file system is described by a super-block which is replicated and 741.1Smycroftoccurs as the first block of the first and other segments. (The maximum 751.1Smycroftnumber of super-blocks is MAXNUMSB). Each super-block maintains a list 761.1Smycroftof the disk addresses of all the super-blocks. The super-block maintains 771.1Smycrofta small amount of checkpoint information, essentially just enough to find 781.1Smycroftthe inode for the IFILE (fs->lfs_idaddr). 791.1Smycroft 801.1SmycroftThe IFILE is visible in the file system, as inode number IFILE_INUM. It 811.1Smycroftcontains information shared between the kernel and various user processes. 821.1Smycroft 831.1Smycroft Ifile (detail) 841.1Smycroft ________________ 851.1Smycroft | cleaner info | Cleaner information per file system. (Page 861.1Smycroft | | granularity.) 871.1Smycroft |______________| 881.1Smycroft | segment | Space available and last modified times per 891.1Smycroft | usage table | segment. (Page granularity.) 901.1Smycroft |______________| 911.1Smycroft | IFILE-1 | Per inode status information: current version #, 921.1Smycroft | . | if currently allocated, last access time and 931.1Smycroft | . | current disk address of containing inode block. 941.1Smycroft | . | If current disk address is LFS_UNUSED_DADDR, the 951.1Smycroft | IFILE-N | inode is not in use, and it's on the free list. 961.1Smycroft |______________| 971.1Smycroft 981.1Smycroft 991.1SmycroftFirst Segment at Creation Time: 1001.1Smycroft_____________________________________________________________ 1011.1Smycroft| | | | | | | | 1021.1Smycroft| 8K pad | Super | summary | inode | ifile | root | l + f | 1031.1Smycroft| | block | | block | | dir | dir | 1041.1Smycroft|________|_______|_________|_______|_______|_______|_______| 1051.1Smycroft ^ 1061.1Smycroft Segment starts here. 1071.1Smycroft 1081.1SmycroftSome differences from the Sprite LFS implementation. 1091.1Smycroft 1101.1Smycroft1. The LFS implementation placed the ifile metadata and the super block 1111.1Smycroft at fixed locations. This implementation replicates the super block 1121.1Smycroft and puts each at a fixed location. The checkpoint data is divided into 1131.1Smycroft two parts -- just enough information to find the IFILE is stored in 1141.1Smycroft two of the super blocks, although it is not toggled between them as in 1151.1Smycroft the Sprite implementation. (This was deliberate, to avoid a single 1161.1Smycroft point of failure.) The remaining checkpoint information is treated as 1171.1Smycroft a regular file, which means that the cleaner info, the segment usage 1181.1Smycroft table and the ifile meta-data are stored in normal log segments. 1191.1Smycroft (Tastes great, less filling...) 1201.1Smycroft 1211.1Smycroft2. The segment layout is radically different in Sprite; this implementation 1221.1Smycroft uses something a lot like network framing, where data/inode blocks are 1231.1Smycroft written asynchronously, and a checksum is used to validate any set of 1241.1Smycroft summary and data/inode blocks. Sprite writes summary blocks synchronously 1251.1Smycroft after the data/inode blocks have been written and the existence of the 1261.1Smycroft summary block validates the data/inode blocks. This permits us to write 1271.1Smycroft everything contiguously, even partial segments and their summaries, whereas 1281.1Smycroft Sprite is forced to seek (from the end of the data inode to the summary 1291.1Smycroft which lives at the end of the segment). Additionally, writing the summary 1301.1Smycroft synchronously should cost about 1/2 a rotation per summary. 1311.1Smycroft 1321.1Smycroft3. Sprite LFS distinguishes between different types of blocks in the segment. 1331.1Smycroft Other than inode blocks and data blocks, we don't. 1341.1Smycroft 1351.1Smycroft4. Sprite LFS traverses the IFILE looking for free blocks. We maintain a 1361.1Smycroft free list threaded through the IFILE entries. 1371.1Smycroft 1381.1Smycroft5. The cleaner runs in user space, as opposed to kernel space. It shares 1391.1Smycroft information with the kernel by reading/writing the IFILE and through 1401.1Smycroft cleaner specific system calls. 1411.1Smycroft 142