VFS and block I/O
Quick answer
The Virtual File System provides a common interface for filesystems. Path lookup and file reads can complete without physical storage access when the required data is cached.
Two reads of the same file may both succeed while only one reaches the storage device. The page cache explains why application bytes read and device bytes read need not match. Compare observations at each layer and specify whether the workload is cached.
Prepare the practice environment
Run python3 lab-fixtures/kernel/setup.py from the extracted root as an ordinary user. Enter the printed fresh private path and check pwd. Use fresh fixtures, Bash with set -e -o pipefail, LC_ALL=C and umask 077. Run each snippet in a separate Bash process, not your interactive shell. Only private files are used; optional examples require an authorized snapshot VM. Do not write kernel attributes, load modules, or change boot settings. Supplied records are fictional; read only the selected non-sensitive live fields. Review the lab guide.
Prerequisites
Review: Allocation, reclaim and writeback.
How it works
Path lookup walks directory entries (dentries) in a mount namespace and resolves filesystem inodes. An inode represents an object, while a dentry associates a name with an object in the lookup cache. Opening a file creates an open file description referenced by file descriptors; duplicated descriptors can share its offset. A buffered read may use page cache; on a miss the filesystem may map file offsets to storage and submit block I/O. The block layer queues requests to drivers and devices when applicable. Network and memory-backed filesystems differ; not every file has an underlying local block device. Symlinks are separate objects that resolve a path; hard links reference the same inode within a filesystem.
Try the examples
This reports metadata of a private file.
Expected stdout:
regular fileThe helper makes two names in a private temporary directory and compares st_dev and st_ino.
Expected stdout:
same device and inode; links=2dup shares the open file description; a second read advances from the first read.
Expected stdout:
first=k second=eCommon mistakes
Do not identify an inode by number alone across filesystems or assume every read reaches a disk.
Practice
Draw pathname → dentry → inode → open file description; show where cache and optional block I/O enter a read.
Related references
Study: stat. These are reference names, not deployed links.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
VFS and block I/O — Knowledge Check
Apply kernel concepts to read-only observations and synthetic models.
What associates a name with an object in lookup?
What does dup share?
What may satisfy a buffered read?
Which pair identifies a local inode within the observed filesystem context?