In the Linux kernel source, the block numbers in an on-disk inode struct are 32-bit. Why? Surely Linux can support more than 2^32 blocks...
Asked
Active
Viewed 286 times
1 Answers
4
The interpretation of the array inode.i_block
is different in Ext4 compared to previous on-disk filesystem formats. In Ext4, when the inode has the EXT4_EXTENT_FL
set in i_flags
this array stores the root of the extent tree and up to four extent descriptors (struct ext4_extent
or struct ext4_extent_idx
). You will notice that in the extent descriptor there are 48 bits for the block address. For older on-disk formats, e.g. Ext3, the maximum number of block does indeed fit in 32 bits.
See Ext4 data structures and algorithms, section 4.2 The Contents of inode.i_block.
-
Why isn't it declared as a union? – extremeaxe5 Nov 21 '19 at 03:53
-
@extremeaxe5: I have no idea. – AlexP Nov 21 '19 at 05:37