Home

This document is a cache from http://www.nobius.org/~dbg/practical-file-system-design.pdf


Practical File System Design

Document source : www.nobius.org


168
1 0
T H E V N O D E L AY E R
Once this
new path()
function is called, the
walk()
routine can release the
vnode of the symbolic link that it loaded. To release the vnode, the
walk()
function calls
put vnode()
, which is the opposite of
get vnode()
. From there
the vnode layer continues parsing with the new path as filled in by
walk()
.
Although the
walk()
routine may seem complex, it is not. The semantics
are difficult to explain, but the actual implementation can be quite short (the
BFS
walk()
routine is only 50 lines of code). The key point of
walk()
is that it
maps from a name in a directory to the vnode that underlies the name. The
walk()
function must also handle symbolic links, either traversing the link
and returning the path contained in the symbolic link, or simply returning
the vnode of the symbolic link itself.
The
read vnode()
operation of a file system has a straightforward job. It is
given a vnid, and it must load that vnid into memory and build any neces-
sary structures that the file system will need to access the file or directory
associated with the vnid. The
read vnode()
function is guaranteed to be sin-
gle threaded for any vnid. That is, no locking must be done, and although
read vnode()
calls for multiple vnids may happen in parallel, the
read vnode()
for any given vnid will never happen multiple times unless the vnid is flushed
from memory.
If the
read vnode()
function succeeds, it fills in a pointer to the data struc-
ture it allocated. If
read vnode()
fails, it returns an error code. No other
requirements are placed on
read vnode()
.
The
write vnode()
operation is somewhat misnamed. No data is written to
disk at the time
write vnode()
is called. Rather
write vnode()
is called after
the reference count for a vnode drops to zero and the vnode layer decides
to flush the vnode from memory. The
write vnode()
call is also guaranteed
to be called only once. The
write vnode()
call need not lock the node in
question because the vnode layer will ensure that no other access is made to
the vnode. The
write vnode()
call should free any resources associated with
the node, including any extra allocated memory, the lock for the node, and so
on. Despite its name,
write vnode()
does not write data to disk.
The
read vnode()
and
write vnode()
calls always happen in pairs for any
given vnid. The
read vnode()
call is made once to load the vnid and allocate
any necessary structures. The
write vnode()
call is made once and should
free all in-memory resources associated with the node. Neither call should
ever modify any on-disk data structures.
Securing Vnodes
There are two other routines in this group of functions:
op_secure_vnode
(*secure_vnode);
op_access
(*access);
Practical File System Design:The Be File System
, Dominic Giampaolo
page 168







Summary :

To release the vnode, the walk() function calls put vnode() , which is the opposite of get vnode() . That is, no locking must be done, and although read vnode() calls for multiple vnids may happen in parallel, the read vnode() for any given vnid will never happen multiple times unless the vnid is flushed from memory. Rather write vnode() is called after the reference count for a vnode drops to zero and the vnode layer decides to flush the vnode from memory. The read vnode() and write vnode() calls always happen in pairs for any given vnid.


Tags : read,any,nid,walk,call,function,file,system,data,symbolic,link,memory,called





Terms    |    Link pdf-search-files.com    |    Site Map
   |    Content Removal Notice   
   |    Contact   

All books are the property of their respective owners.
Please respect the publisher and the author for their creations if their books copyrighted