Next: 9. Appendix: Typical Stackable
Up: 8.5 How It All
Previous: 8.5.1 Mounting
8.5.2 Path Traversal
Figure fig-vnode-fs-xyz also shows the new structure of file system
X, after Y had been mounted, as file system Z.
The sequence of in-kernel operations to, say, read the file /usr/local/bin/tex would be as follows:
- 1.
- The system call read() is executed. It begins by looking up the
file.
- 2.
- The generic lookup function performs a VOP_LOOKUP(rootvp,
"usr"). It tries to look for the next component in the path, starting from
the current lookup directory (root vnode).
- 3.
- The lookup function is translated into ufs_lookup. The vnode
X2 is found. Note that X2 is not the same vnode as Z2! X2 is hidden,
while Z2 overshadows it.
- 4.
- The lookup function now notices that X2's v_vfsmountedhere
field is non-null, so it knows that X2 is a mount point. It calls the VOP_ROOT function on the vfs that is ``mounted here,'' that translates to
nfs_lookup. This function returns the root vnode of the Y file
system as it is mounted on X. This root vnode is X2. The ``magic'' part
that happens at this point is that the lookup routine now resumes its path
traversal but on the mounted file system.
- 5.
- An nfs_lookup is performed on the Z2 vnode for the component
"local", that will return the vnode Z5.
- 6.
- An NFS lookup is performed on vnode Z5 for the component "bin",
that will return the vnode Z8.
- 7.
- An NFS lookup is performed on vnode Z8 for the component "tex",
that will return the vnode for the file.
- 8.
- The lookup is complete and returns the newly found vnode for
component "tex" to the read() system call.
- 9.
- The generic read function performs a VOP_READ on the newly
found vnode. Since that vnode is an NFS one, the read is translated into
nfs_read.
- 10.
- Actual reading of the file /usr/local/bin/tex begins in earnest.
Next: 9. Appendix: Typical Stackable
Up: 8.5 How It All
Previous: 8.5.1 Mounting
Erez Zadok
1999-12-07