Search code examples
linuxext4ext3ext2

Ext2/3: Block Type Clarification: IND vs DIND vs TIND


I'm seeing references to "IND" vs "DIND" vs "TIND" block-types in a few places, whereas the definition in the code is very terse:

(https://github.com/torvalds/linux/blob/master/fs/ext4/ext4.h#L362)

#define EXT4_NDIR_BLOCKS        12
#define EXT4_IND_BLOCK          EXT4_NDIR_BLOCKS
#define EXT4_DIND_BLOCK         (EXT4_IND_BLOCK + 1)
#define EXT4_TIND_BLOCK         (EXT4_DIND_BLOCK + 1)
#define EXT4_N_BLOCKS           (EXT4_TIND_BLOCK + 1)

Can someone clarify what they are, as well as, potentially, why the definitions imply that a TIND block includes a DIND, and a DIND block includes a IND block.

I've looked, feverishly, but there aren't any obvious discussions or comments on the subject and it's going to take me a bit more time to figure it out from the code.


Solution

  • #define EXT4_NDIR_BLOCKS                            /* number of direct blocks */
    #define EXT4_IND_BLOCK                              /* single indirect block   */
    #define EXT4_DIND_BLOCK                             /*  double indirect block  */
    #define EXT4_TIND_BLOCK                             /* trible indirect block   */
    #define EXT4_N_BLOCKS                               /* total number of blocks  */
    
    • NDIR is the number of direct blocks.
    • IND is the single indirect block.
    • DIND is the double indirect block.
    • TIND is the trible indirect block
    • N is the total number of blocks.