Linux Kernel Architecture

(Jacob Rumans) #1

Chapter 9: The Extended Filesystem Family


Other incompatible features are:
ext2_fs.h

#define EXT2_FEATURE_INCOMPAT_COMPRESSION 0x0001
#define EXT2_FEATURE_INCOMPAT_FILETYPE 0x0002
#define EXT3_FEATURE_INCOMPAT_RECOVER 0x0004
#define EXT3_FEATURE_INCOMPAT_JOURNAL_DEV 0x0008
#define EXT2_FEATURE_INCOMPAT_META_BG 0x0010
#define EXT2_FEATURE_INCOMPAT_ANY 0xffffffff

All three field elements are bitmaps whose individual bits represent a specific kernel enhance-
ment. This enables the kernel to determine (by means of comparisons with pre-defined con-
stants) which of the features it knows can be used on a filesystem. It is also able to scan the
entries for features it doesn’t know (these are marked by bits set at positions it doesn’t know)
and to decide, according to category, how to handle the filesystem.

Some elements of the structure are not used by the Ext2 code as they are provided
for future enhancements envisaged when the structure was designed. This is
intended to dispense with the need to reformat filesystems when new features are
added. Reformatting is often impracticable on heavily loaded server systems.

In the further course of the present description, reference is made to some of these fields when discussing
potential enhancements to existing functionality.

Group Descriptor


As Figure 9-2 shows, each block group has a collection of group descriptors arranged directly after the
superblock. The information they hold reflects the contents of each block group of the filesystem and
therefore relates not only to the data blocks associated with the local block group but also to the data and
inode blocks of other block groups.

The data structure used to define a single group descriptor is much shorter than the superblock structure,
as the following section of kernel source code demonstrates:

<ext2_fs.h>
struct ext2_group_desc
{
__le32 bg_block_bitmap; /* Blocks bitmap block */
__le32 bg_inode_bitmap; /* Inodes bitmap block */
__le32 bg_inode_table; /* Inodes table block */
__le16 bg_free_blocks_count; /* Free blocks count */
__le16 bg_free_inodes_count; /* Free inodes count */
__le16 bg_used_dirs_count; /* Directories count */
__le16 bg_pad;
__le32 bg_reserved[3];
};

The kernel uses a copy of this structure for each block group described in the group descriptor collection.
Free download pdf