12.3. Filesystem Mounting

Now we'll focus on how the VFS keeps track of the filesystems it is supposed to support. Two basic operations must be performed before making use of a filesystem: registration and mounting.

Registration is done either when the system boots or when the module implementing the filesystem is being loaded. Once a filesystem has been registered, its specific functions are available to the kernel, so that kind of filesystem can be mounted on the system's directory tree.

Each filesystem has its own root directory. The filesystem whose root directory is the root of the system's directory tree is called root filesystem. Other filesystems can be mounted on the system's directory tree: the directories on which they are inserted are called mount points.

12.3.1. Filesystem Registration

Often, the user configures Linux to recognize all the filesystems needed when compiling the kernel for her system. But the code for a filesystem actually may either be included in the kernel image or dynamically loaded as a module (see Appendix B). The VFS must keep track of all filesystems whose code is currently included in the kernel. It does this by performing filesystem registrations.

Each registered filesystem is represented as a file_system_type object whose fields are illustrated in Table 12-7. All filesystem-type objects are inserted into a simply linked list. The file_systems variable points to the first item.

Table 12-7. The Fields of the file_system_type Object
Type

Get Understanding the Linux Kernel now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.