summaryrefslogtreecommitdiff
path: root/lib/ext2fs/swapfs.c
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2011-09-15 10:38:55 -0400
committerTheodore Ts'o <tytso@mit.edu>2011-09-16 10:24:09 -0400
commit89efc88e65136ece22708cc28ec4124a33feeecd (patch)
tree2f86bf3338a716d40fd6edc0308aad27e65ac359 /lib/ext2fs/swapfs.c
parent2418dfd7b934ee6bf3dc9a0aa4ffee8b37f4384f (diff)
downloade2fsprogs-89efc88e65136ece22708cc28ec4124a33feeecd.tar.gz
libext2fs: add metadata checksum and snapshot feature flags
Reserve EXT4_FEATURE_RO_COMPAT_METADATA_CSUM and EXT2_FEATURE_COMPAT_EXCLUDE_BITMAP. Also reserve fields in the superblock and the inode for the checksums. In the block group descriptor, reserve the exclude bitmap field for the snapshot feature, and checksums for the inode and block allocation bitmaps. With this commit, the metadata checksum and exclude bitmap features should have reserved all of the fields they need in ext4's on-disk format. This commit also fixes an a missing byte swap for s_overhead_blocks. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu> Cc: Darrick J. Wong <djwong@us.ibm.com> Cc: Amir Goldstein <amir73il@gmail.com>
Diffstat (limited to 'lib/ext2fs/swapfs.c')
-rw-r--r--lib/ext2fs/swapfs.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/lib/ext2fs/swapfs.c b/lib/ext2fs/swapfs.c
index 87b1a2e7..d1c4a567 100644
--- a/lib/ext2fs/swapfs.c
+++ b/lib/ext2fs/swapfs.c
@@ -78,6 +78,8 @@ void ext2fs_swap_super(struct ext2_super_block * sb)
sb->s_snapshot_list = ext2fs_swab32(sb->s_snapshot_list);
sb->s_usr_quota_inum = ext2fs_swab32(sb->s_usr_quota_inum);
sb->s_grp_quota_inum = ext2fs_swab32(sb->s_grp_quota_inum);
+ sb->s_overhead_blocks = ext2fs_swab32(sb->s_overhead_blocks);
+ sb->s_checksum = ext2fs_swab32(sb->s_checksum);
for (i=0; i < 4; i++)
sb->s_hash_seed[i] = ext2fs_swab32(sb->s_hash_seed[i]);
@@ -106,6 +108,11 @@ void ext2fs_swap_group_desc2(ext2_filsys fs, 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_exclude_bitmap_lo = ext2fs_swab32(gdp->bg_exclude_bitmap_lo);
+ gdp->bg_block_bitmap_csum_lo =
+ ext2fs_swab16(gdp->bg_block_bitmap_csum_lo);
+ gdp->bg_inode_bitmap_csum_lo =
+ ext2fs_swab16(gdp->bg_inode_bitmap_csum_lo);
gdp->bg_itable_unused = ext2fs_swab16(gdp->bg_itable_unused);
gdp->bg_checksum = ext2fs_swab16(gdp->bg_checksum);
/* If we're 32-bit, we're done */
@@ -125,6 +132,11 @@ void ext2fs_swap_group_desc2(ext2_filsys fs, struct ext2_group_desc *gdp)
gdp4->bg_used_dirs_count_hi =
ext2fs_swab16(gdp4->bg_used_dirs_count_hi);
gdp4->bg_itable_unused_hi = ext2fs_swab16(gdp4->bg_itable_unused_hi);
+ gdp->bg_exclude_bitmap_hi = ext2fs_swab16(gdp->bg_exclude_bitmap_hi);
+ gdp->bg_block_bitmap_csum_hi =
+ ext2fs_swab16(gdp->bg_block_bitmap_csum_hi);
+ gdp->bg_inode_bitmap_csum_hi =
+ ext2fs_swab16(gdp->bg_inode_bitmap_csum_hi);
}
void ext2fs_swap_group_desc(struct ext2_group_desc *gdp)
@@ -244,8 +256,8 @@ void ext2fs_swap_inode_full(ext2_filsys fs, struct ext2_inode_large *t,
ext2fs_swab16 (f->osd2.linux2.l_i_uid_high);
t->osd2.linux2.l_i_gid_high =
ext2fs_swab16 (f->osd2.linux2.l_i_gid_high);
- t->osd2.linux2.l_i_reserved2 =
- ext2fs_swab32(f->osd2.linux2.l_i_reserved2);
+ t->osd2.linux2.l_i_checksum =
+ ext2fs_swab32(f->osd2.linux2.checksum);
break;
case EXT2_OS_HURD:
t->osd1.hurd1.h_i_translator =