The VFS abstraction: the common file model (superblock/inode/dentry/file) and operations tables, the dentry & inode caches, path lookup, a syscall's route through the VFS to a concrete filesystem, mount namespaces, pseudo-filesystems (proc/sys/tmpfs), FUSE and network filesystems.
How one set of syscalls (open, read, stat…) works across ext4, XFS, NFS,
tmpfs, and /proc alike — the Virtual Filesystem is the abstraction that makes "everything is a file" real.
Original, interview-focused notes.
The VFS defines a common file model — superblock, inode, dentry, file — and a table of operations each filesystem implements. A syscall calls the generic VFS op, which dispatches to the concrete filesystem. Add a new FS by filling in the ops; userspace never changes.
| Object | Represents |
|---|---|
| superblock | A mounted filesystem instance (its metadata, and super_operations). |
| inode | A file's on-disk metadata & identity (type, perms, size, owner, block pointers) — not the name. Has inode_operations. |
| dentry | A directory entry: maps a name → an inode, and links the tree. The path-lookup building block. |
| file | An open file: a process's view (current offset, flags), pointing at a dentry/inode. Has file_operations (read/write/…). |
Note the split: the inode is the file; the dentry is a name for it (hence hard
links = many dentries, one inode), and the file is one open handle. A file descriptor points at a
file. (This is exactly the inode/fd story in
Linux Troubleshooting.)
/var/log/app.log walks dentry by dentry. To avoid re-reading directories, the kernel
keeps a dentry cache (dcache) and inode cache — hot paths resolve without touching disk.SReclaimable in /proc/meminfo.open("/etc/hosts") → VFS path walk (dcache) → dentry → inode
→ allocate a file object + fd in the process
read(fd, ...) → file->f_op->read_iter → ext4/xfs/nfs implementation
→ (usually) the page cache → copy_to_user
The generic layer handles the fd table, offsets, and permission checks; the concrete filesystem only implements the operations that touch its storage.
/proc/PID/status is a VFS read into a generated buffer./proc and /sys be "files"? (pseudo-filesystems on the VFS)read(fd) from syscall to filesystem.