您的位置:首页 > 运维架构

The Design of Unix Operating System (5) the internal presentation of file

2010-04-01 16:07 519 查看
A inode contains information like owner, permissions, updated time and something elese, but doesn’t include the path name(s) of the file.     
owner
group
type(regular file, directory, pipe, )
permissions
last accessed time
last modified time
inode last modified time
file size
disk address
The in-core copy of the inode contains some additional fields: the status of the in-core node
the logical device number
the inode number
pointers to other in-core inodes. the in-core inodes are linked in the same way as the buffers.
a reference count indicating the number of instances of the file.

each disk node should have at most one in-core copy.
the in-core copy node will be locked when the process is executing a system call. And the lock will be released at the conclusion of the system call. A inode is never locked across system calls.
The reference count remains between system calls set to prevent kernel from reallocating an active in-core indoe.
The system call open() will encrement/decrement the reference count; while other system calls will allocate/release indoes.
If there’s no in-core inode in the free list, the kernel will return error instead of making the process asleep waiting for an inode. While the situation for buffer is different: since a buffer should not be locked across system calls, a buffer will be available after a system call.
(direcotry 和  super block, mount, link 等需要再好好看~)
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息