The VFS Inode

The VFS Inode

Like the EXT2 file system, every file, directory and so on in the VFS is represented by one and only one VFS inode.

The information in each VFS inode is built from information in the underlying file system by file system specific routines. VFS inodes exist only in the kernel’s memory and are kept in the VFS inode cache as long as they are useful to the system. Amongst other information, VFS inodes contain the following fields:

device
This is the device identifer of the device holding the file or whatever that this VFS inode represents,
inode number
This is the number of the inode and is unique within this file system. The combination of device and inode number is unique within the Virtual File System,
mode
Like EXT2 this field describes what this VFS inode represents as well as access rights to it,
user ids
The owner identifiers,
times
The creation, modification and write times,
block size
The size of a block for this file in bytes, for example 1024 bytes,
inode operations
A pointer to a block of routine addresses. These routines are specific to the file system and they perform operations for this inode, for example, truncate the file that is represented by this inode.
count
The number of system components currently using this VFS inode. A count of zero means that the inode is free to be discarded or reused,
lock
This field is used to lock the VFS inode, for example, when it is being read from the file system,
dirty
Indicates whether this VFS inode has been written to, if so the underlying file system will need modifying,
file system specific information