Virtual File Systems in Operating System

Data structures and procedures are used to isolate the basic system call functionality from the implementation details. Thus, the file-system implementation consists of three major layers. The first layer is the file-system interface, based on the open(), read(), write(), and close() calls and on file descriptors

The second layer is called the virtual file system (VFS) layer. The VFS layer serves two important functions:

  • It separates file-system-generic operations from their implementation by defining a clean VFS interface. Several implementations for the VFS interface may coexist on the same machine, allowing transparent access to different types of file systems mounted locally
  • It provides a mechanism for uniquely representing a file throughout a network. The VFS is based on a file-representation structure, called a vnode, that contains a numerical designator for a network-wide unique file. (UNIX inodes are unique within only a single file system.) This network-wide uniqueness is required for support of network file systems. The kernel maintains one vnode structure for each active node (file or directory)

Thus, the VFS distinguishes local files from remote ones, and local files are further distinguished according to their file-system types.

The VFS activates file-system-specific operations to handle local requests according to their file-system types and calls the NFS protocol procedures for remote requests. File handles are constructed from the relevant vnodes and are passed as arguments to these procedures. The layer implementing the file-system type or the remote-file-system protocol is the third layer of the architecture

Schematic view of a virtual file system
Schematic view of a virtual file system

The four main object types defined by the Linux VFS are

  • The inode object, which represents an individual file
  • The file object, which represents an open file
  • The superblock object, which represents an entire file system
  • The dentry object, which represents an individual directory entry

Leave a Comment