ext4: calculate and verify checksums for inode bitmaps
Compute and verify the checksum of the inode bitmap; the checkum is stored in the block group descriptor. Signed-off-by: Darrick J. Wong <djwong@us.ibm.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
This commit is contained in:
committed by
Theodore Ts'o
parent
814525f4df
commit
41a246d1ff
@@ -317,6 +317,13 @@ struct ext4_group_desc
|
||||
__u32 bg_reserved;
|
||||
};
|
||||
|
||||
#define EXT4_BG_INODE_BITMAP_CSUM_HI_END \
|
||||
(offsetof(struct ext4_group_desc, bg_inode_bitmap_csum_hi) + \
|
||||
sizeof(__le16))
|
||||
#define EXT4_BG_BLOCK_BITMAP_CSUM_HI_END \
|
||||
(offsetof(struct ext4_group_desc, bg_block_bitmap_csum_hi) + \
|
||||
sizeof(__le16))
|
||||
|
||||
/*
|
||||
* Structure of a flex block group info
|
||||
*/
|
||||
@@ -1844,6 +1851,12 @@ struct mmpd_data {
|
||||
|
||||
/* bitmap.c */
|
||||
extern unsigned int ext4_count_free(struct buffer_head *, unsigned);
|
||||
void ext4_inode_bitmap_csum_set(struct super_block *sb, ext4_group_t group,
|
||||
struct ext4_group_desc *gdp,
|
||||
struct buffer_head *bh, int sz);
|
||||
int ext4_inode_bitmap_csum_verify(struct super_block *sb, ext4_group_t group,
|
||||
struct ext4_group_desc *gdp,
|
||||
struct buffer_head *bh, int sz);
|
||||
|
||||
/* balloc.c */
|
||||
extern unsigned int ext4_block_group(struct super_block *sb,
|
||||
@@ -2094,6 +2107,13 @@ extern __le16 ext4_group_desc_csum(struct ext4_sb_info *sbi, __u32 group,
|
||||
extern int ext4_group_desc_csum_verify(struct ext4_sb_info *sbi, __u32 group,
|
||||
struct ext4_group_desc *gdp);
|
||||
|
||||
static inline int ext4_has_group_desc_csum(struct super_block *sb)
|
||||
{
|
||||
return EXT4_HAS_RO_COMPAT_FEATURE(sb,
|
||||
EXT4_FEATURE_RO_COMPAT_GDT_CSUM |
|
||||
EXT4_FEATURE_RO_COMPAT_METADATA_CSUM);
|
||||
}
|
||||
|
||||
static inline ext4_fsblk_t ext4_blocks_count(struct ext4_super_block *es)
|
||||
{
|
||||
return ((ext4_fsblk_t)le32_to_cpu(es->s_blocks_count_hi) << 32) |
|
||||
|
||||
Reference in New Issue
Block a user