vfs
时间:2007-02-14 来源:ffjnfj
super_operations:
alloc_inode(sb): alloc一个in memory的inode结构,一般情况下,会alloc一个包含inode的结构
destroy_inode(inode): release这个in memory的inode的结构,就是undo alloc_inode的操作
read_inode(inode): 读入disk中的inode结构,并给in memory的inode赋值
write_inode(inode): 根据memory中的inode,更新disk中的inode
put_inode(inode): called when the VFS inode is removed from the inode cache.
ext2中只是discard prealloc
drop_inode(inode): 在最后一次access这个inode后调用,会删除memory和disk中的所有记录,包括调用
delete_inode,destroy_inode等
clear_inode(inode): vfs clears the inode
ext2中为空
delete_inode(inode): 在引用计数为0时调用,会真正的删除disk中的inode及其blocks
put_super(sb): 释放memory中super_block,比如umount时
write_super(sb): 更新disk中的super_block
inode_operations:
对于file来讲,需要实现的操作是很少的。
truncate: 改变文件的大小
对于dir来讲,需要实现的相对较多
create: 创建一个disk上的inode,比如open,create系统调用
lookup: 根据父dir找到对应名字的子文件
link: hard link
unlink: 删除一个hard link,只需要修改父dir的数据
...
对于symlink之类的文件又要有另外的inode_operations
dentry_operations:
一般的fs只需要使用default的操作,不过也可以自己定义
address_space_operations:
prepare_write: 主要做的一件事就是read那些parts of basic-blocks,这在写之前是必须做的,因为
磁盘读写都是基于block的
nameidata.saved_names
比如有如下情况:
f: b
l b -> d/e/
l d -> g/f/
d g
d f
d e
如果要lookup b/c,
1. b是symlink,将d/e/放入saved_names[0],这样e/是必须保存的
2. d也是symlink,将g/f/放入saved_names[1]
3. lookup g, -> f,
4. lookup d, -> e,
5. lookup c
所经过的路径为:g,f,d,e,c
alloc_inode(sb): alloc一个in memory的inode结构,一般情况下,会alloc一个包含inode的结构
destroy_inode(inode): release这个in memory的inode的结构,就是undo alloc_inode的操作
read_inode(inode): 读入disk中的inode结构,并给in memory的inode赋值
write_inode(inode): 根据memory中的inode,更新disk中的inode
put_inode(inode): called when the VFS inode is removed from the inode cache.
ext2中只是discard prealloc
drop_inode(inode): 在最后一次access这个inode后调用,会删除memory和disk中的所有记录,包括调用
delete_inode,destroy_inode等
clear_inode(inode): vfs clears the inode
ext2中为空
delete_inode(inode): 在引用计数为0时调用,会真正的删除disk中的inode及其blocks
put_super(sb): 释放memory中super_block,比如umount时
write_super(sb): 更新disk中的super_block
inode_operations:
对于file来讲,需要实现的操作是很少的。
truncate: 改变文件的大小
对于dir来讲,需要实现的相对较多
create: 创建一个disk上的inode,比如open,create系统调用
lookup: 根据父dir找到对应名字的子文件
link: hard link
unlink: 删除一个hard link,只需要修改父dir的数据
...
对于symlink之类的文件又要有另外的inode_operations
dentry_operations:
一般的fs只需要使用default的操作,不过也可以自己定义
address_space_operations:
prepare_write: 主要做的一件事就是read那些parts of basic-blocks,这在写之前是必须做的,因为
磁盘读写都是基于block的
nameidata.saved_names
比如有如下情况:
f: b
l b -> d/e/
l d -> g/f/
d g
d f
d e
如果要lookup b/c,
1. b是symlink,将d/e/放入saved_names[0],这样e/是必须保存的
2. d也是symlink,将g/f/放入saved_names[1]
3. lookup g, -> f,
4. lookup d, -> e,
5. lookup c
所经过的路径为:g,f,d,e,c
相关阅读 更多 +