tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Why does the fs_lookup need?



ok, let me try to answer this...

On Fri, Apr 11, 2014 at 12:13:52PM +0400, Ilia Zykov wrote:
 > I don't understand why now LOOKUP() is implemented on the two
 > levels - RFS and VFS.

Dividing a pathname into components (by splitting on '/') and
processing those components one at a time is done at the VFS level
because it's common to all file system types.

(One could have a file system that used different path syntax; but we
don't and aren't likely to, and pushing this logic into the file
system would make handling symbolic links much more complicated.)

However, looking up a filename and producing a vnode for it is done at
the file system ("RFS") level because it's file system specific. To do
lookup requires knowledge of file system data structures.

(The reason implementing file-system-level lookup using readdir isn't
good is that many file systems use data structures for directories
that provide fast lookup access; e.g. if directories are btrees,
listing the directory and searching the listing would be silly.)

As for why the lookup vnode operation we currently have is a horrible
mess -- that is because the design was not carefully worked out in the
first place and then was allowed to agglomerate for 15 years or so
without receiving any attention. Now it's a legacy mess and the
cleanup process is slow and expensive.

-- 
David A. Holland
dholland%netbsd.org@localhost


Home | Main Index | Thread Index | Old Index