From: Theodore Ts'o Date: Sat, 11 Nov 2006 14:41:52 +0000 (-0500) Subject: On-disk format definition for group descriptor checksums X-Git-Tag: E2FSPROGS-1_40-WIP-1114~22 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=8815fb8a00f5a441eb62f035353db9e0cca90b38;p=tools%2Fe2fsprogs.git On-disk format definition for group descriptor checksums - EXT4_FEATURE_RO_COMPAT_GDT_CSUM (0x0010?) - store a crc16 checksum in the group descriptor (s_uuid[16] | __u32 group | ext3_group_desc (excluding gd_checksum itself)). This allows the kernel to more safely manage UNINIT groups. Signed-off-by: "Theodore Ts'o" --- diff --git a/lib/ext2fs/ChangeLog b/lib/ext2fs/ChangeLog index 024363d..4112e34 100644 --- a/lib/ext2fs/ChangeLog +++ b/lib/ext2fs/ChangeLog @@ -1,8 +1,16 @@ 2006-11-11 Theodore Tso - * swapfs.c (ext2fs_swap_inode_full): Byte swap inode->l_i_blocks_hi - - * ext2_fs.h: Add definition of EXT4_FEATURE_RO_COMPAT_HUGE_FILE, + * swapfs.c (ext2fs_swap_group_desc): + ext2_fs.h: Add definition of EXT4_FEATURE_RO_COMPAT_GDT_CSUM, + which adds a crc16 checksum in the group descriptor, + (s_uuid[16] | __u32 group | ext3_group_desc + (excluding gd_checksum itself)). This allows the kernel + to more safely manage UNINIT groups. Also adds an + bg_itable_unsued which indicates how many inodes are + uninitialized in the block group. + + * swapfs.c (ext2fs_swap_inode_full): + ext2_fs.h: Add definition of EXT4_FEATURE_RO_COMPAT_HUGE_FILE, which changes i_blocks to be in units of s_blocksize units instead of 512-byte sectors, use l_i_frag and l_i_fsize as i_blocks_hi. diff --git a/lib/ext2fs/ext2_fs.h b/lib/ext2fs/ext2_fs.h index c6c9aca..d0b57f4 100644 --- a/lib/ext2fs/ext2_fs.h +++ b/lib/ext2fs/ext2_fs.h @@ -144,7 +144,9 @@ struct ext2_group_desc __u16 bg_free_inodes_count; /* Free inodes count */ __u16 bg_used_dirs_count; /* Directories count */ __u16 bg_flags; - __u32 bg_reserved[3]; + __u32 bg_reserved[2]; + __u16 bg_itable_unused; /* Unused inodes count */ + __u16 bg_checksum; /* crc16(s_uuid+grouo_num+group_desc)*/ }; #define EXT2_BG_INODE_UNINIT 0x0001 /* Inode table/bitmap not initialized */ @@ -575,6 +577,7 @@ struct ext2_super_block { #define EXT2_FEATURE_RO_COMPAT_LARGE_FILE 0x0002 /* #define EXT2_FEATURE_RO_COMPAT_BTREE_DIR 0x0004 not used */ #define EXT4_FEATURE_RO_COMPAT_HUGE_FILE 0x0008 +#define EXT4_FEATURE_RO_COMPAT_GDT_CSUM 0x0010 #define EXT2_FEATURE_INCOMPAT_COMPRESSION 0x0001 #define EXT2_FEATURE_INCOMPAT_FILETYPE 0x0002 diff --git a/lib/ext2fs/swapfs.c b/lib/ext2fs/swapfs.c index 39e23b2..b18bb4a 100644 --- a/lib/ext2fs/swapfs.c +++ b/lib/ext2fs/swapfs.c @@ -79,6 +79,8 @@ void ext2fs_swap_group_desc(struct ext2_group_desc *gdp) gdp->bg_free_inodes_count = ext2fs_swab16(gdp->bg_free_inodes_count); gdp->bg_used_dirs_count = ext2fs_swab16(gdp->bg_used_dirs_count); gdp->bg_flags = ext2fs_swab16(gdp->bg_flags); + gdp->bg_itable_unused = ext2fs_swab16(gdp->bg_itable_unused); + gdp->bg_checksum = ext2fs_swab16(gdp->bg_checksum); } void ext2fs_swap_ext_attr(char *to, char *from, int bufsize, int has_header)