You seem to have answered your questions yourself :)
Let's consider the case of EXT4:
The file system inode is stored on disk in the format as exactly described by struct ext4_inode
. The struct ext4_inode_info
is just an in-memory representation of the same. The VFS inode also an in-memory object that contains inode information that is common irrespective of the file system type and thus can be abstracted. It is allocated from the inode cache (a memory pool got using the slab allocator).The VFS struct inode is embedded in the filesystem specific in-memory struct inode. For example, struct ext4_inode_info
has a member called struct inode vfs_inode
. Given a VFS inode, you can get the FS specific inode using the standard container_of macro found in the kernel code. Thus any FS can get to it's own inode struct when it is handed over the generic inode struct by VFS.
Checkout what happens when a new inode is created using __ext4_new_inode()
FAT usually stores the metadata (i.e. inode information) on a directory entry. So the linux fat driver just reads it, populates the necessary fields in memory. Since there's no concept of inodes in FAT, the inode number is a random number- a call to iunique() to be precise.
Some good resources on VFS:
http://www.win.tue.nl/~aeb/linux/lk/lk-8.html
http://lxr.free-electrons.com/source/Documentation/filesystems/vfs.txt