Final Year Project: Using Linux Filesystems Under Windows   Chris Bryden BEng. Electronics and Software Engineering    School of Computer Science   University of Birmingham 40 These  caches  provide  a  good  boost  to  the  performance  of  the  ext2lib library, as they greatly reduce the amount of disk reads necessary. 5.12  Layer 1: The ReadSuperBlock and GetSuperBlock Functions The   ReadSuperBlock   function   is   called   once,   when   a   filesystem   is mounted. It reads the superblock information from block 1 of the filesystem into memory.   The   data   structure   used   to   hold   the   superblock   is   given   a   type, SUPERBLOCK. The form of this structure is defined in ext2_fs.h, and is stored in memory in the same form as it is stored on disk. The superblock is stored in a variable, SuperBlock, of this type that is global to all the layer 1 functions.   . The  GetSuperBlock  function  is  used  by  layer  2  functions  to  read  the superblock  information.  The  layer  2  functions  cannot  simply  read  it  from  the SuperBlock variable, as this is only global to layer 1 to preserve the integrity of the  three  layer  structure.  It  simply  copies  the  superblock  information  from  the variable  SuperBlock  into  the  memory  location  pointed  to  by  lpSBlock,  which  is passed to the function. Please see section 3.3.2 for details of the superblock structure Request for block N recieved by the ReadBlock function Is  block 'N' in the read-ahead cache YES NO Copy block from cache into buffer and return Is block 'N' in the FIFO cache YES NO Copy block from cache into buffer and return Copy last requested block from the first position in the read-ahead cache to the next position in the FIFO cache Read the requested block into the buffer and fill the read-ahead cache with the next CACHE_SIZE blocks. return