From: Theodore Ts'o Date: Sat, 11 Nov 2006 14:44:47 +0000 (-0500) Subject: On-disk format definition for 64-bit support X-Git-Tag: android-x86-6.0-r1~26^2~1742 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=8061d2c144bf22ce3e170e40a194932da4baf8fb;p=android-x86%2Fexternal-e2fsprogs.git On-disk format definition for 64-bit support - EXT4_FEATURE_INCOMPAT_64BIT (0x0080) - support for 64-bit block count fields in the superblock (s_blocks_count_hi, s_free_blocks_count_hi), large group descriptors (s_desc_size), extents with high 16 bits (ee_start_hi, ei_leaf_hi), inode ACL (i_file_acl_hi). May also grow to encompass the previously proposed BIG_BG. Signed-off-by: "Theodore Ts'o" --- diff --git a/lib/ext2fs/ChangeLog b/lib/ext2fs/ChangeLog index 58d54bcb..dedd6b9a 100644 --- a/lib/ext2fs/ChangeLog +++ b/lib/ext2fs/ChangeLog @@ -1,5 +1,12 @@ 2006-11-11 Theodore Tso + * swapfs.c (ext2fs_swap_super): + ext2_fs.h: Add definition of EXT4_FEATURE_INCOMPAT_64BIT, + which adds supports for 64-bit block count fields in the + superblock (s_blocks_count_hi, s_free_blocks_count_hi), + large group descriptors (s_desc_size), extents with high + 16 bits (ee_start_hi, ei_leaf_hi), inode ACL (i_file_acl_hi) + * ext2_fs.h: Add definition of EXT4_FEATURE_RO_COMPAT_DIR_NLINK, which allow directories to have > 65000 subdirectories (i_nlinks) by setting i_nlinks = 1 for such directories. diff --git a/lib/ext2fs/ext2_fs.h b/lib/ext2fs/ext2_fs.h index f9c0199e..f3c27abc 100644 --- a/lib/ext2fs/ext2_fs.h +++ b/lib/ext2fs/ext2_fs.h @@ -137,8 +137,8 @@ struct ext2_acl_entry /* Access Control List Entry */ */ struct ext2_group_desc { - __u32 bg_block_bitmap; /* Blocks bitmap block */ - __u32 bg_inode_bitmap; /* Inodes bitmap block */ + __u32 bg_block_bitmap; /* Blocks bitmap block */ + __u32 bg_inode_bitmap; /* Inodes bitmap block */ __u32 bg_inode_table; /* Inodes table block */ __u16 bg_free_blocks_count; /* Free blocks count */ __u16 bg_free_inodes_count; /* Free inodes count */ @@ -149,6 +149,27 @@ struct ext2_group_desc __u16 bg_checksum; /* crc16(s_uuid+grouo_num+group_desc)*/ }; +struct ext4_group_desc +{ + __u32 bg_block_bitmap; /* Blocks bitmap block */ + __u32 bg_inode_bitmap; /* Inodes bitmap block */ + __u32 bg_inode_table; /* Inodes table block */ + __u16 bg_free_blocks_count; /* Free blocks count */ + __u16 bg_free_inodes_count; /* Free inodes count */ + __u16 bg_used_dirs_count; /* Directories count */ + __u16 bg_flags; + __u32 bg_reserved[2]; + __u16 bg_itable_unused; /* Unused inodes count */ + __u16 bg_checksum; /* crc16(s_uuid+grouo_num+group_desc)*/ + __u32 bg_block_bitmap_hi; /* Blocks bitmap block MSB */ + __u32 bg_inode_bitmap_hi; /* Inodes bitmap block MSB */ + __u32 bg_inode_table_hi; /* Inodes table block MSB */ + __u16 bg_free_blocks_count_hi;/* Free blocks count MSB */ + __u16 bg_free_inodes_count_hi;/* Free inodes count MSB */ + __u16 bg_used_dirs_count_hi; /* Directories count MSB */ + __u32 bg_reserved2[3]; +}; + #define EXT2_BG_INODE_UNINIT 0x0001 /* Inode table/bitmap not initialized */ #define EXT2_BG_BLOCK_UNINIT 0x0002 /* Block bitmap not initialized */ @@ -521,12 +542,15 @@ struct ext2_super_block { __u32 s_hash_seed[4]; /* HTREE hash seed */ __u8 s_def_hash_version; /* Default hash version to use */ __u8 s_jnl_backup_type; /* Default type of journal backup */ - __u16 s_reserved_word_pad; + __u16 s_desc_size; /* Group desc. size: INCOMPAT_64BIT */ __u32 s_default_mount_opts; __u32 s_first_meta_bg; /* First metablock group */ __u32 s_mkfs_time; /* When the filesystem was created */ __u32 s_jnl_blocks[17]; /* Backup of the journal inode */ - __u32 s_reserved[172]; /* Padding to the end of the block */ + __u32 s_blocks_count_hi; /* Blocks count high 32bits */ + __u32 s_r_blocks_count_hi; /* Reserved blocks count high 32 bits*/ + __u32 s_free_blocks_hi; /* Free blocks count */ + __u32 s_reserved[169]; /* Padding to the end of the block */ }; /* @@ -586,6 +610,7 @@ struct ext2_super_block { #define EXT3_FEATURE_INCOMPAT_JOURNAL_DEV 0x0008 /* Journal device */ #define EXT2_FEATURE_INCOMPAT_META_BG 0x0010 #define EXT3_FEATURE_INCOMPAT_EXTENTS 0x0040 +#define EXT4_FEATURE_INCOMPAT_64BIT 0x0080 #define EXT2_FEATURE_COMPAT_SUPP 0 diff --git a/lib/ext2fs/swapfs.c b/lib/ext2fs/swapfs.c index b18bb4aa..f332e87a 100644 --- a/lib/ext2fs/swapfs.c +++ b/lib/ext2fs/swapfs.c @@ -60,6 +60,7 @@ void ext2fs_swap_super(struct ext2_super_block * sb) sb->s_journal_inum = ext2fs_swab32(sb->s_journal_inum); sb->s_journal_dev = ext2fs_swab32(sb->s_journal_dev); sb->s_last_orphan = ext2fs_swab32(sb->s_last_orphan); + sb->s_desc_size = ext2fs_swab16(sb->s_desc_size); sb->s_default_mount_opts = ext2fs_swab32(sb->s_default_mount_opts); sb->s_first_meta_bg = ext2fs_swab32(sb->s_first_meta_bg); sb->s_mkfs_time = ext2fs_swab32(sb->s_mkfs_time);