Chapter 8: The Virtual Filesystem
address_
space_
operationsdentry_
operationss_filessuper_blockhost
page_treea_opsaddress_spacef_op
f_dentryf_op
f_dentryf_op
f_dentryfile instances of the superblockd_inode
d_sb
d_ops
NAMEtask_structfiles files_structinode_
operationsfile_
operationsi_op
i_dentry
i_fop
i_sb
i_mappinginodestruct page
Doubly chained
list (schematically)Figure 8-3: Interplay of the VFS components.Because opened files are always assigned to a specific system process, the kernel must store the connec-
tion between the file and the process in its data structures. As discussed briefly in Chapter 2, the task
structure includes an element in which all opened files are held (via a roundabout route). This element is
an array that is accessed using the file descriptor as an index. The objects it contains are not only linked
with the inode of the corresponding file, but also have a pointer to an element of thedentry cacheused to
speed lookup operations.The individual filesystem implementations are also able to store their own data (that is not manipulated
by the VFS layer) in the VFS inode.Filesystemand SuperblockInformation
The supported filesystem types are linked by means of a special kernel object that features a method of
reading thesuperblock. As well as key information on the filesystem (block size, maximum file size, etc.),
the superblock contains function pointersto read, write, and manipulate inodes.The kernel also creates a list of the superblock instances of all active filesystems. I use the termactive
instead ofmountedbecause, in certain circumstances, it is possible to use a single superblock for several
mount points.^4(^4) When a filesystem of a block device is mounted at several points in the directory hierarchy.