10 April 2002 Operating Systems File Management Read Nutt Ch 13 ------------------- UNIX File system small is beautiful no types - just bit sequence 255 char names /dev/lp writes to the printer mount multiple disks Berkely "improvements" Directory Dir entries are sorted inode num entry size type filename length filename efficiency - disk divided into cylinder groups if possible, keep inode and data blocks close 2 block sizes - small for small files large for large files complexity of code ------------------ ------------------ ------------------ file store strategies ffs - file file store - 1980s modest buffer space, minimize read latency lfs - log based dile store - 1990s lots of buffer space, max write bandwidth FFS - unix BSD roots, now UFS (UNIX file system) originally, inodes kept at beginning of partition makes alloction of data blocks suboptimal makes read of file suboptimal - jumping between inodes and data new organization superblock - beg of partition - stable info - replicated count of max number files - inodes static - block size - fixed at FS creation time cylinder groups - divide partition bookkeeping per cylinder group separate namely, keep bitmat of free blocks block size minimum of 4096, but now there is a problem with small files see table fragments - divide blocks, reduce internal fragmentation single block = 2, 4, or 8 fragments each fragment is addressable bitmap per block space allocated on write be careful not to have too many fragments in one file be careful not to copy data too much empiically observed wasted space is as if you had a smaller block size block selection/ layout policies try to allocate new blocks on the same cylinder as other blocks of the same file layout w.r.t. rotational delay - may not want sequential not imp. for disks with rull track buffer goals: increase locality of reference, minimize seek latency inodes: place all the indoes of files in a directory in the same cylinder group new directory placed in cyl group that has a greater than average number of free inodes and smallest num directories inodes chose with next free strategy data: try to place all data in single cylinder group but cyl group will fill up quickly - don't want this heuristic: break up file at first indirect block ----------- log structured file systems faster CPU, larger RAM, larger disk caches satisfy most read requests from cache therefore, most disk traffic will be writes problems with FFS small writes are inefficient turns out that less than 5% of disk's potential bandwidth is used rest of time is spent doing disk seeks need sequential writes to metadata (e.g., inodes) for consistency does not effectively use available buffering idea: structure disk as a log write to disk when enough buffered, or periodically segment ~ 1MB inodes mixed with data randomly two big issues: 1. how to retrieve information from the log 2. how to manage free space 1. need inode map - keep in cache once an inode has been found, the number of disk IOs frequired to read the file is identical to FFS see figure 2. compact or not compact (threading) threading turns out to be inefficient compacting - need policies for "cleaner thread" careful not to copy persistent data multiple times put persistent data into stable segments see performance graphs - 4k block size, 1MB segment size