Whamcloud - gitweb
On-disk format definition for group descriptor checksums
authorTheodore Ts'o <tytso@mit.edu>
Sat, 11 Nov 2006 14:41:52 +0000 (09:41 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Sat, 11 Nov 2006 14:41:52 +0000 (09:41 -0500)
- 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" <tytso@mit.edu>
lib/ext2fs/ChangeLog
lib/ext2fs/ext2_fs.h
lib/ext2fs/swapfs.c

index 024363d..4112e34 100644 (file)
@@ -1,8 +1,16 @@
 2006-11-11  Theodore Tso  <tytso@mit.edu>
 
-       * 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.
index c6c9aca..d0b57f4 100644 (file)
@@ -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
index 39e23b2..b18bb4a 100644 (file)
@@ -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)