📜  Inode 与 Vnode

📅  最后修改于: 2022-05-13 01:57:01.932000             🧑  作者: Mango

Inode 与 Vnode

Inode不包含文件的实际数据,但它包含有关文件的元数据,例如文件大小、用户 ID、保护信息等。它不是内核数据结构,可以快速访问,它们始终有效,因为它们包含总是需要的信息。它们独立于文件名,即使文件名更改,inode 也不会更改。

Vnode是一个内核内存对象,它在 UNIX 文件接口上打开、读取写入、关闭并执行类似的操作。它也可以定义为 inode 的抽象。它仅在打开文件时存在。作为一个对象,与 inode 相比,它具有更多的访问时间。它包含在文件的生命周期内不会更改的数据。

Inode-vs-Vnode

以下是 Inode 和 Vnode 之间的差异表:

 

Inode

Vnode

1.Inodes have metadata about the file which is not related to the content of the fileVnodes contain attributes that do not change over the file’s lifetime
2.Inode is an on-disk structure that explains the storage of a file in terms of diskVnode is an in-memory structure abstraction of inode
3.Inode isn’t a data structure of the kernel  Vnode is an in-kernel representation of the inode.
4.It can be accessed quickly It has more access time than Inode
5.Inodes are always valid Vnode are not necessarily always valid
6.It contains information that is always needed (Ex. protection, admin power)Vnode only exists when a file is opened
7.Inode is associated with unique number within a partitionVnode doesn’t have a unique number within a partition
8.It is however a data structure in UNIX operating systemsVnode is an object in kernel memory that speaks for the UNIX file interface