Final Year Project:
Using Linux Filesystems Under Windows
Chris Bryden
BEng. Electronics and Software Engineering
School of Computer Science
University of Birmingham
14
3.3.3 The Group Descriptors
A group descriptor exists for every group on the filesystem, it gives
information about the location of the group on disk and the free space within the
group. A copy of all the group descriptors for the filesystem is stored in each
block group, after the superblock. The group descriptors simply follow one after
another, in the order that the groups they refer to are located on disk. The
structure of a group descriptor is shown below, taken from ext2_fs.h.
·
=bg_block_bitmap - The block address of the block containing the block bitmap
for the group.
·
=bg_inode_bitmap
- The block address of the block containing the inode
bitmap for the group.
·
=bg_inode_table - The block address of the first block of the inode table for the
group.
·
=bg_free_blocks_count - The number of free blocks within the group.
·
=bg_free_inodes_count - The number of free inodes within the group.
·
=bg_used_dirs_count - The number of inodes allocated to directories within the
group.
·
=bg_pad - Padding.
·
=bg_reserved - Not Used.
The group descriptors are used by the kernel for locating a particular
group on disk and for balancing the allocation of blocks between the groups on a
filesystem. The kernel only uses the first copy of the group descriptors, the
others are for backup purposes only.
/*
* Structure of a blocks group descriptor
*/
struct ext2_group_desc
{
unsigned long bg_block_bitmap;
unsigned long bg_inode_bitmap;
unsigned long bg_inode_table;
unsigned short bg_free_blocks_count;
unsigned short bg_free_inodes_count;
unsigned short bg_used_dirs_count;
unsigned short bg_pad;
unsigned long bg_reserved[3];
};