this section, we illustrate how the VFS derives an inode from the
corresponding file pathname. When a process must identify a file, it
passes its file pathname to some VFS system call, such as
rename( ), or
The standard procedure for performing this task consists of analyzing the pathname and breaking it into a sequence of filenames. All filenames except the last must identify directories.
If the first character of the pathname is
the pathname is absolute, and the search starts from the directory
current->fs->root (the process
root directory). Otherwise, the pathname is relative and the search
starts from the directory identified by
current->fs->pwd (the process-current
Having in hand the inode of the initial directory, the code examines the entry matching the first name to derive the corresponding inode. Then the directory file that has that inode is read from disk and the entry matching the second name is examined to derive the corresponding inode. This procedure is repeated for each name included in the path.
The dentry cache considerably speeds up the procedure, since it keeps the most recently used dentry objects in memory. As we saw before, each such object associates a filename in a specific directory to its corresponding inode. In many cases, therefore, the analysis of the pathname can avoid reading the intermediate directories from the disk.
However, things are not as simple as they look, since ...