Do not verify checksum upon seeking in the directory.
[lwext4.git] / lwext4 / ext4_xattr.c
index 5273094b0c03e5b248a86ee428ed1da3f8b09d42..d50f5cd25cd98946f726dd9683323915054a656d 100644 (file)
@@ -112,6 +112,7 @@ static void ext4_xattr_rehash(struct ext4_xattr_header *header,
        header->h_hash = to_le32(hash);
 }
 
+#if CONFIG_META_CSUM_ENABLE
 static uint32_t
 ext4_xattr_block_checksum(struct ext4_inode_ref *inode_ref,
                          ext4_fsblk_t blocknr,
@@ -121,15 +122,15 @@ ext4_xattr_block_checksum(struct ext4_inode_ref *inode_ref,
        uint64_t le64_blocknr = blocknr;
        struct ext4_sblock *sb = &inode_ref->fs->sb;
 
-       if (ext4_sb_has_feature_read_only(sb,
-                               EXT4_FEATURE_RO_COMPAT_METADATA_CSUM)) {
+       if (ext4_sb_feature_ro_com(sb, EXT4_FRO_COM_METADATA_CSUM)) {
                uint32_t orig_checksum;
 
                /* Preparation: temporarily set bg checksum to 0 */
                orig_checksum = header->h_checksum;
                header->h_checksum = 0;
                /* First calculate crc32 checksum against fs uuid */
-               checksum = ext4_crc32c(~0, sb->uuid, sizeof(sb->uuid));
+               checksum = ext4_crc32c(EXT4_CRC32_INIT, sb->uuid,
+                               sizeof(sb->uuid));
                /* Then calculate crc32 checksum block number */
                checksum = ext4_crc32c(checksum, &le64_blocknr,
                                     sizeof(le64_blocknr));
@@ -141,15 +142,17 @@ ext4_xattr_block_checksum(struct ext4_inode_ref *inode_ref,
        }
        return checksum;
 }
+#else
+#define ext4_xattr_block_checksum(...) 0
+#endif
 
 static void
 ext4_xattr_set_block_checksum(struct ext4_inode_ref *inode_ref,
-                             ext4_fsblk_t blocknr,
+                             ext4_fsblk_t blocknr __unused,
                              struct ext4_xattr_header *header)
 {
        struct ext4_sblock *sb = &inode_ref->fs->sb;
-       if (!ext4_sb_has_feature_read_only(sb,
-                               EXT4_FEATURE_RO_COMPAT_METADATA_CSUM))
+       if (!ext4_sb_feature_ro_com(sb, EXT4_FRO_COM_METADATA_CSUM))
                return;
 
        header->h_checksum =