The Runtime Theory

File Open Path

The file open path: VFS path walk, dentry cache, inode lookup, file objects, fd table, and page cache reads.

The Runtime Theory Team07 stages

trace / request.md

OPEN() ENTERSTHE KERNELPATH WALK THROUGHTHE DENTRY CACHEINODE RESOLVEDSTRUCT FILEALLOCATEDFD ASSIGNEDFIRST READ TOUCHESTHE PAGE CACHECLOSE() RELEASES

readyThe open syscall arrives with a filename, flags (O_RDONLY, O_CREAT, ...), and mode bits. The VFS begins a path lookup, resolving one component at a time.

Opening a file is a path walk with caching at every level. This diagram follows open() from the syscall boundary through the VFS: each path component is resolved through the dentry cache, misses read directory blocks from disk, the dentry resolves to an inode, the kernel allocates a file object holding the offset and mode, and the fd table hands back a small integer. The ordering matters because the fd is the least interesting part — the real state lives in kernel objects that persist across reads. First read shows the page cache in action: data is brought in once and served from memory after that. The done state: fd N is open, its file object and inode cached, and subsequent reads are page-cache hits.