aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/ext4/ext4.h4
-rw-r--r--fs/ext4/super.c4
2 files changed, 6 insertions, 2 deletions
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index 1483d9c6061f..c55a1faaed58 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -2333,8 +2333,8 @@ extern int ext4_register_li_request(struct super_block *sb,
2333static inline int ext4_has_group_desc_csum(struct super_block *sb) 2333static inline int ext4_has_group_desc_csum(struct super_block *sb)
2334{ 2334{
2335 return EXT4_HAS_RO_COMPAT_FEATURE(sb, 2335 return EXT4_HAS_RO_COMPAT_FEATURE(sb,
2336 EXT4_FEATURE_RO_COMPAT_GDT_CSUM | 2336 EXT4_FEATURE_RO_COMPAT_GDT_CSUM) ||
2337 EXT4_FEATURE_RO_COMPAT_METADATA_CSUM); 2337 (EXT4_SB(sb)->s_chksum_driver != NULL);
2338} 2338}
2339 2339
2340static inline int ext4_has_metadata_csum(struct super_block *sb) 2340static inline int ext4_has_metadata_csum(struct super_block *sb)
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 5afe42db303c..e96b6ecc8d34 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -2005,6 +2005,10 @@ static __le16 ext4_group_desc_csum(struct ext4_sb_info *sbi, __u32 block_group,
2005 } 2005 }
2006 2006
2007 /* old crc16 code */ 2007 /* old crc16 code */
2008 if (!(sbi->s_es->s_feature_ro_compat &
2009 cpu_to_le32(EXT4_FEATURE_RO_COMPAT_GDT_CSUM)))
2010 return 0;
2011
2008 offset = offsetof(struct ext4_group_desc, bg_checksum); 2012 offset = offsetof(struct ext4_group_desc, bg_checksum);
2009 2013
2010 crc = crc16(~0, sbi->s_es->s_uuid, sizeof(sbi->s_es->s_uuid)); 2014 crc = crc16(~0, sbi->s_es->s_uuid, sizeof(sbi->s_es->s_uuid));