Virtual file system¶
VFS supplies the common filesystem interface used by pathname lookup, file
descriptors, mounts, and filesystem implementations. Most of its common
implementation is in sys/kern/vfs_*.c. Filesystem-specific operations
are implemented elsewhere, including under sys/fs and sys/ufs.
The central objects are a mount, which represents a mounted filesystem, and a vnode, which represents a filesystem object through a common interface. A name, an open file description, and a vnode are related but different objects with different ownership rules.
Finding the implementation¶
Source |
Responsibility |
|---|---|
|
Vnode layout, flags, reference interfaces, and operation-vector types. |
|
Mount state and filesystem-level operations. |
|
Pathname-lookup state, flags, and ownership interfaces. |
|
Path traversal, name caching, and the fast lookup path. |
|
Vnode lifecycle, mount busying, and vnode identity helpers. |
|
Mount creation, unmounting, references, and root mounting. |
|
Common vnode I/O helpers and syscall-facing operations. |
|
Buffer-cache operations and clustered I/O. |
|
Source descriptions for generated vnode-operation interfaces. |
The API references in this topic select the kern XML project, just as
the separate Scheduling topic does. A reading topic need
not have its own extraction project.
File-backed mappings connect to Virtual memory through the vnode pager. Blocking lookup, I/O, and unmount operations also interact with Scheduling, but VFS’s resource ownership remains separate from the scheduler’s thread-state bookkeeping.