Final Year Project:
Using Linux Filesystems Under Windows
Chris Bryden
BEng. Electronics and Software Engineering
School of Computer Science
University of Birmingham
20
3.3.7 How the Second Extended Filesystem Works: A Mini Case Study
To illustrate how the kernel, or another application, uses the structures
defined above to navigate a filesystem we shall examine the case study of
reading a text file. Suppose we want to read the file /home/dave/test.txt . The
following steps are necessary to read the file:
1. The filesystem must be mounted. The superblock information and the group
descriptors are read from disk and checked for validity.
2. Locating the inode for any file begins at the root directory. This has a special
inode number, defined by EXT2_ROOT_INO in ext2_fs.h, currently 2.
3. This inode is located in the first group, the group descriptor is read and the
location of the block address of the inode table found.
4. The inode is located and read into memory. To determine which group an
inode is in, a simple calculation can be done. The group is given by:
Integer_Part(<Inode Number> / s_inodes_per_group)
5. The blocks pointed to by the inode contain the directory file. These are read,
in effect reading the directory listing into memory.
6. A search through the entries in the root directory is carried out for the filename
home. Once it is found its inode can be read into memory. This inode points
to the file containing the directory listing for the home directory. As with the
root directory, the listing is read into memory.
7. The home directory listing is searched for the entry named dave. Once this
is found, as before, its inode and the directory file pointed to by the inode are
read into memory.
8. The directory listing now in memory is for the directory named dave. It is
searched for the entry with name test.txt. Once this is found, just as with the
directories, its inode is read into memory.
9. This inode points to all the blocks making up the file test.txt. These can now
be read, thus reading the file.
Steps 2 to 8 from a process known as path to inode resolution.