Sixty Bytes Of Map

A 1 GiB file is written to a fresh ext4 filesystem and the allocator places it in one perfectly contiguous run. Blocks are 4 KiB.

An ext4_extent record is 12 bytes and maps at most 32768 blocks. The inode's i_block area is 60 bytes and starts with a 12-byte ext4_extent_header.

How many extents describe this file, and do they fit inside the inode?

A

262144 extents, and they do not fit: an extent still needs one record per 4 KiB block, it just stores them more compactly.

B

8 extents, and they do not fit: only 4 records fit in the 48 bytes left after the header, so ext4 allocates an extent tree node.

C

1 extent, and it fits: the run is contiguous, so a single (start, length) pair covers all of it.

D

8 extents, and they fit: 60 bytes holds 5 records, which is more than enough.