Chapter 9: The Extended Filesystem Family
Afunctionpointertoext2_fill_superis passed as a parameter forget_sb_bdev. This function fills
a superblock object with data that must be read from the hard disk if there is no suitable superblock
object in memory.^14 In this section, we need therefore only examine theext2_fill_superfunction in
fs/ext2/super.c. Its code flow diagram is shown in Figure 9-8.
Check magic numberext2_fill_supersb_min_blocksizesb_set_blocksizeext2_check_descriptorsext2_count_free_blocksext2_count_inodesext2_count_dirsext2_setup_super ext2_write_supersb_breadsb_breadparse_optionsSet default optionsCheck featuresBlock size not equal sb_min_blocksize?Fill in super_block_infoRead in group descriptorsSet up approximate per-CPU countersFigure 9-8: Code flow diagram forext2_fill_super.ext2_fill_superstarts by setting an initial block size for reading the superblock. Because the block size
usedin the file systemis not yet known, the kernel first attempts to find the minimum possible value with
the help ofsb_min_blocksize. This function normally sets 1,024 bytes as the block size. If, however, the
block device has a larger minimum block size, this is used instead.
(^14) This is naturally only the case when the desired filesystem is already mounted on the system but needs to be mounted somewhere
else, a comparatively rare occurrence.