How does a directory inode keep its file list

directoryfilesystemsinode

Does a directory inode use a plain array storing ( filename, inode ) pairs, or some kind of associative array { filename: inode }to speed up file lookup, or any other optimizations on a plain array?

Take ext2/3/4 as example if you think the question is too broad or filesystem-specific.

This question is specifically focused on the internal representation of directory inodes.

Best Answer

As we know, everything is a file in Linux even the directories. Also every file has an inode.

That said, a directory's inode has a map of it's contents (files and subdirectories) into blocks (a block is part of a inode structure), it can be described with the following image:

enter image description here

Related Question