diff options
author | Tahsin Erdogan <tahsin@google.com> | 2018-05-17 18:23:04 +0200 |
---|---|---|
committer | Ben Hutchings <ben@decadent.org.uk> | 2020-06-11 19:05:53 +0100 |
commit | f9c6ffd9190290d3d2502c297e3df4aef3d034c0 (patch) | |
tree | 47c9e6e85e76da36c6bcce262707ea398a8c47a6 | |
parent | d126cf46f829d146dde3e6a8963e095ac6cfcd1c (diff) | |
download | linux-stable-f9c6ffd9190290d3d2502c297e3df4aef3d034c0.tar.gz linux-stable-f9c6ffd9190290d3d2502c297e3df4aef3d034c0.tar.bz2 linux-stable-f9c6ffd9190290d3d2502c297e3df4aef3d034c0.zip |
ext4: Make checks for metadata_csum feature safer
This is just a small part of commit dec214d00e0d7 "ext4: xattr inode
deduplication" that makes checks for metadata_csum feature safer and is
actually needed by following fixes.
Signed-off-by: Tahsin Erdogan <tahsin@google.com>
Acked-by: Jan Kara <jack@suse.cz>
[bwh: Ported to 3.16: Use EXT4_HAS_RO_COMPAT_FEATURE()]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
-rw-r--r-- | fs/ext4/ext4.h | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index 09e978818474..929834c9a85c 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h @@ -2411,21 +2411,24 @@ extern void ext4_group_desc_csum_set(struct super_block *sb, __u32 group, extern int ext4_register_li_request(struct super_block *sb, ext4_group_t first_not_zeroed); -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_SB(sb)->s_chksum_driver != NULL); -} - static inline int ext4_has_metadata_csum(struct super_block *sb) { WARN_ON_ONCE(EXT4_HAS_RO_COMPAT_FEATURE(sb, EXT4_FEATURE_RO_COMPAT_METADATA_CSUM) && !EXT4_SB(sb)->s_chksum_driver); - return (EXT4_SB(sb)->s_chksum_driver != NULL); + return EXT4_HAS_RO_COMPAT_FEATURE(sb, + EXT4_FEATURE_RO_COMPAT_METADATA_CSUM) && + (EXT4_SB(sb)->s_chksum_driver != NULL); +} + +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_has_metadata_csum(sb); } + 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) | |