The Virtual Filesystem

Typically, a full Linux system consists of somewhere between several thousand and a few million files that store programs, data, and all kinds of information. Hierarchical directory structures are used to catalog and group files together. Various approaches are adopted to permanently store the required structures and data.

Every operating system has at least one ''standard filesystem'' that features functions, some good, some less so, to carry out required tasks reliably and efficiently. The Second/Third Extended Filesystem that comes with Linux is a kind of standard filesystem that has proved itself to be very robust and suitable for everyday use over the past few years. Nevertheless, there are other filesystems written for or ported to Linux, all of which are acceptable alternatives to the Ext2 standard. Of course, this does not mean that programmers must apply different file access methods for each filesystem they use — this would run totally counter to the concept of an operating system as an abstraction mechanism.

To support various native filesystems and, at the same time, to allow access to files of other operating systems, the Linux kernel includes a layer between user processes (or the standard library) and the filesystem implementation. This layer is known as the Virtual File System, or VFS for short.1 Figure 8-1 shows the significance of the layer.

The task of VFS is not a simple one. On the one hand, it is intended to provide uniform ways of manipulating files, directories, and other objects. On the other, it must be able to come to terms with the concrete implementations of the various approaches, which differ in part not only in specific details but also in their overall design. However, the rewards are high because VFS adds substantial flexibility to the Linux kernel.

The kernel supports more than 40 filesystems of various origins — ranging from the FAT filesystem from the MS-DOS era through UFS (Berkeley Unix) and iso9660 for CD-ROMs to network filesystems such as coda and NFS and virtual versions such as proofs.

^The term virtual filesystem switch is also used occasionally.

System-

System-

calls

Application

Application

1

Application

C-Standard Library (Libc)

t ;

i '

r

Virtual Filesystem (VFS)

Ext2/3

Reiserfs

Kernelspace

Figure 8-1: VFS layer for filesystem abstraction.

Continue reading here: Filesystem Types

Was this article helpful?

0 0