tech-kern archive

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

Why does the fs_lookup need?



Hello!
Please, help me!
I don't understand fundamental thing.
And can't find info about this.

Acronyms:
VFS     - VFS/VNODE level and all functions VOP_READ, namei ...
RFS     - File System level and all functions fs_lookup, fs_read ...            
LOOKUP() - namei, VOP_LOOKUP ...


I don't understand why now LOOKUP() is implemented on the two levels - RFS and 
VFS.
LOOKUP() and VFS – RFS API, very complicated, historically(when UNIX had 
only one FS and hadn't readdir() at all), it is clear how it happened, 
but it is unclear why has not changed?

fs_lookup() - now have RFS functionality and many VFS too(getnewvnode() ...),
in many cases it opens file, catalog... when real fs_open()... does nothing.

Why don't use, for example, the algorithm described below,
I understand that it is necessary to make changes in the VFS – RFS API,
but it is significantly offset by the creation of new simplification FSs,
significant reduction of duplicated code, and clear separation
VFS and RFS levels.

I am taking interest possibility make so in theory.
Every opinion can help me.


How LOOKUP() should works(IMHO):

1. RFS shouldn't have fs_lookup() at all, and this level shouldn't
request vnode, by invoking getnewvnode(), maybe, only for fs_root().

2. Vnode is requested and released only on VFS level, inside
functions LOOKUP(), VOP_OPEN, VOP_READDIR, VOP_CLOSE ...

3. Therefore RFS level's fs_open(), fs_readdir() can get uninitialized 
(struct vnode *vp) with vp->v_data == NULL, but vnode should contain
certain field vp->v_dataID(example) every FS has had this, presumably,
inode number(dirent->fileno), by which, the RFS may identify the 
requested file, directory and to undertake the necessary steps
for opening file, reading catalog and fills vp->v_data.

4. Most importantly: LOOKUP() and VFS don’t use fs_lookup() at all(see 1), 
but can use getnewvnode(), if needed, for get vnode, and use fs_readdir() 
for the primary initialization(vp->dataID = dirent->fileno) and path name 
traverse.

5. Vnode cache and dir cache can be maintained at VFS level.

6. We have only one LOOKUP() instance in one place.

7. We have real Virtual FS irrespective of RFS.

8. We simplifying VFS – RFS API.

Please, tell me, why not?
Maybe in theory only.


Home | Main Index | Thread Index | Old Index