File System Assignment

Copyright Tristan Aubrey-Jones and Dale Caffull December 2006.

readme.txt

home Home   up Up   ( Download )


/* COMP2009 File System Assignment
 * Tristan Aubrey-Jones (taj105) and Dale Caffull (dc1005)
 * ----------------------------------------------------------
 * This code implements the methods myfs_read_file, myfs_write_file and
 * myfs_delete_file and requires myfs_write_sector and myfs_read_sector.
 * It provides a single directoried file system for a 1.44MB floppy disk
 * with 2880 sectors of 512B each. Max file size: 1458176B (1.39MB)
 *
 * Features:
 *
 * - The file system uses a block size of 4 sectors
 *   which limits disk fragmentation but means that the disk has a maximum capacity of 712 files.
 *
 * - The file system contains two FAT-16 tables with a adler-32 checksums so that if one becomes corrupted
 *   it is restored on the next file read or write. 
 *
 * - The FAT is cached between subsequent file read, write and delete calls. On a call the first
 *   sector of the FAT is read and it's checksum is compared to the cached FAT's version.
 *   If the cache's checksum matches the disk's the cache is used, otherwise the rest of the FAT
 *   is read, and its checksum is computed and checked to ensure that the FAT is valid.
 *
 * - The directory information is stored in a 26 sector hashtable so that on average only 1 sector must be
 *   read to find a file's information.
 *
 * - Files are allocated optimally by finding all free space in the FAT, sorting by descending "gap" size and
 *   selecting the smallest gap that will fit the file. If the file is too big for one gap, the 
 *   largest gap is used and the smallest gap is found that will fit the rest and so on. 
 *   Before writing the file these block ranges are sorted by ascending LBA (using quick sort),
 *   so that reads and writes are sequential.
*/