VFS 概念的一点小补充
虽说VFS是介于应用程序和特定文件系统之间的一层但在一些情况下VFS可以不用唤醒底层的程序而进行一个文件操作。
比如进程关掉一个open file,其实磁盘上的文件甚至连碰都不需要碰。
VFS只需要释放掉相应的file object就可以了。
同样的,当系统调用lseek()去修改一个文件指针时,
其实是open file 和进程之间的互相影响,VFS只需要修改相应的file object,
而不需要实际访问磁盘上的文件,所以同样不需要调用一个特别的文件系统程序。
顺便把英文贴上来
We said earlier that the VFS is a layer between application programs and specific filesystems. However, in some cases, a file operation can be performed by the VFS itself, without invoking a lower-level procedure. For instance, when a process closes an open file, the file on disk doesn't usually need to be touched, and hence the VFS simply releases the corresponding file object. Similarly, when the lseek( ) system call modifies a file pointer, which is an attribute related to the interaction between an opened file and a process, the VFS needs to modify only the corresponding file object without accessing the file on disk, and therefore it does not have to invoke a specific filesystem procedure. In some sense, the VFS could be considered a "generic" filesystem that relies, when necessary, on specific ones.
[ 本帖最后由 madfrogme 于 2012-8-2 00:54 编辑 ]