Pardon if this question has an exact duplicate somewhere else, but so far all of the answers I have found on SE or other sites in general do not answer this question specifically. I am taking an operating systems course in my college and hence I am pretty new to file systems in general.
I understand that in most file systems, there is a root directory which contains file directory entries. These entries contain a mapping from filename to inode number, and are variable size in length.
According to this answer, I guess these entries are stored in a linear fashion, like below:
I can fully understand what inodes are and how they map to a file's data block numbers on the physical disk, using their Table of Contents (TOC) entries.
However, my question is: How and where are subdirectory file directory entries stored?
I would believe that they are either stored in the same location as the root directory, at some offset. However, I cannot envision how this offset can be retrieved from the inode.
Hence, I have a feeling that the directory entries of subdirectories are actually stored in the data region of the disk, instead of with the root directory's entries.
Hence, if this is the case, traversing from one directory to another requires the disk to read from seemingly arbitrary locations, which seems a little inefficient to me.
Nevertheless, I would like to simply clear up my misconceptions on the location of the file directory entries of a subdirectory.
Much help is appreciated.