Why is the inode cache needed

cacheinode

I'm confused because all dentries have pointers to inode objects. As far as I know, you always look through dentries to find your inode. Then, why is there an inode cache?

Best Answer

You're asking about the inode cache implemented as part of the Linux Virtual File System (VFS). Caches, including the inode cache are not just used to provide functionality, like accessing inode entries, as there are other mechanisms for this as you point out.

Caches can be used to improve performance and in this case looking up inode data from an io device such as a disk is very slow, so storing previously accessed inode data in memory makes file system access much quicker.

Related Question