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 number
ext2_fill_super
sb_min_blocksize
sb_set_blocksize
ext2_check_descriptors
ext2_count_free_blocks
ext2_count_inodes
ext2_count_dirs
ext2_setup_super ext2_write_super
sb_bread
sb_bread
parse_options
Set default options
Check features
Block size not equal sb_min_blocksize?
Fill in super_block_info
Read in group descriptors
Set up approximate per-CPU counters
Figure 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.