The ext2sbinfo and ext2inodeinfo Structures

When an Ext2 filesystem is mounted, the u field of the VFS superblock, which contains filesystem-specific data, is loaded with a structure of type ext2_sb_info so that the kernel can find out things related to the filesystem as a whole. This structure includes the following information:

• Most of the disk superblock fields

• The block bitmap cache, tracked by the s_block_bitmap and s_block_bitmap_number arrays (see the next section)

• The inode bitmap cache, tracked by the s_inode_bitmap and s_inode_bitmap_number arrays (see the next section)

• An s_sbh pointer to the buffer head of the buffer containing the disk superblock

• An s_es pointer to the buffer containing the disk superblock

• The number of group descriptors, s_desc_ per_block, that can be packed in a block

• An s_group_desc pointer to an array of buffer heads of buffers containing the group descriptors (usually, a single entry is sufficient)

• Other data related to mount state, mount options, and so on

Similarly, when an inode object pertaining to an Ext2 file is initialized, the u field is loaded with a structure of type ext2_inode_info, which includes this information:

• Most of the fields found in the disk's inode structure that are not kept in the generic VFS inode object (see Table 12-3 in Chapter 12)

• The fragment size and the fragment number (not yet used)

• The block_group block group index at which the inode belongs (see Section 17.2 earlier in this chapter)

• The i_prealloc_block and i_prealloc_count fields, which are used for data block preallocation (see Section 17.6.5 later in this chapter)

• The i_osync field, which is a flag specifying whether the disk inode should be synchronously updated

Was this article helpful?

0 0

Post a comment