Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

f2fs: remove unused sbi argument from checksum functions

Since __f2fs_crc32() now calls crc32() directly, it no longer uses its
sbi argument. Remove that, and simplify its callers accordingly.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>

authored by

Eric Biggers and committed by
Jaegeuk Kim
d005af3b 13be8795

+24 -35
+6 -7
fs/f2fs/checkpoint.c
··· 826 826 } 827 827 } 828 828 829 - static __u32 f2fs_checkpoint_chksum(struct f2fs_sb_info *sbi, 830 - struct f2fs_checkpoint *ckpt) 829 + static __u32 f2fs_checkpoint_chksum(struct f2fs_checkpoint *ckpt) 831 830 { 832 831 unsigned int chksum_ofs = le32_to_cpu(ckpt->checksum_offset); 833 832 __u32 chksum; 834 833 835 - chksum = f2fs_crc32(sbi, ckpt, chksum_ofs); 834 + chksum = f2fs_crc32(ckpt, chksum_ofs); 836 835 if (chksum_ofs < CP_CHKSUM_OFFSET) { 837 836 chksum_ofs += sizeof(chksum); 838 - chksum = f2fs_chksum(sbi, chksum, (__u8 *)ckpt + chksum_ofs, 839 - F2FS_BLKSIZE - chksum_ofs); 837 + chksum = f2fs_chksum(chksum, (__u8 *)ckpt + chksum_ofs, 838 + F2FS_BLKSIZE - chksum_ofs); 840 839 } 841 840 return chksum; 842 841 } ··· 861 862 return -EINVAL; 862 863 } 863 864 864 - crc = f2fs_checkpoint_chksum(sbi, *cp_block); 865 + crc = f2fs_checkpoint_chksum(*cp_block); 865 866 if (crc != cur_cp_crc(*cp_block)) { 866 867 f2fs_folio_put(*cp_folio, true); 867 868 f2fs_warn(sbi, "invalid crc value"); ··· 1504 1505 get_sit_bitmap(sbi, __bitmap_ptr(sbi, SIT_BITMAP)); 1505 1506 get_nat_bitmap(sbi, __bitmap_ptr(sbi, NAT_BITMAP)); 1506 1507 1507 - crc32 = f2fs_checkpoint_chksum(sbi, ckpt); 1508 + crc32 = f2fs_checkpoint_chksum(ckpt); 1508 1509 *((__le32 *)((unsigned char *)ckpt + 1509 1510 le32_to_cpu(ckpt->checksum_offset))) 1510 1511 = cpu_to_le32(crc32);
+2 -3
fs/f2fs/compress.c
··· 679 679 cc->cbuf->clen = cpu_to_le32(cc->clen); 680 680 681 681 if (fi->i_compress_flag & BIT(COMPRESS_CHKSUM)) 682 - chksum = f2fs_crc32(F2FS_I_SB(cc->inode), 683 - cc->cbuf->cdata, cc->clen); 682 + chksum = f2fs_crc32(cc->cbuf->cdata, cc->clen); 684 683 cc->cbuf->chksum = cpu_to_le32(chksum); 685 684 686 685 for (i = 0; i < COMPRESS_DATA_RESERVED_SIZE; i++) ··· 775 776 776 777 if (!ret && (fi->i_compress_flag & BIT(COMPRESS_CHKSUM))) { 777 778 u32 provided = le32_to_cpu(dic->cbuf->chksum); 778 - u32 calculated = f2fs_crc32(sbi, dic->cbuf->cdata, dic->clen); 779 + u32 calculated = f2fs_crc32(dic->cbuf->cdata, dic->clen); 779 780 780 781 if (provided != calculated) { 781 782 if (!is_inode_flag_set(dic->inode, FI_COMPRESS_CORRUPT)) {
+6 -14
fs/f2fs/f2fs.h
··· 1976 1976 /* 1977 1977 * Inline functions 1978 1978 */ 1979 - static inline u32 __f2fs_crc32(struct f2fs_sb_info *sbi, u32 crc, 1980 - const void *address, unsigned int length) 1979 + static inline u32 __f2fs_crc32(u32 crc, const void *address, 1980 + unsigned int length) 1981 1981 { 1982 1982 return crc32(crc, address, length); 1983 1983 } 1984 1984 1985 - static inline u32 f2fs_crc32(struct f2fs_sb_info *sbi, const void *address, 1986 - unsigned int length) 1985 + static inline u32 f2fs_crc32(const void *address, unsigned int length) 1987 1986 { 1988 - return __f2fs_crc32(sbi, F2FS_SUPER_MAGIC, address, length); 1987 + return __f2fs_crc32(F2FS_SUPER_MAGIC, address, length); 1989 1988 } 1990 1989 1991 - static inline bool f2fs_crc_valid(struct f2fs_sb_info *sbi, __u32 blk_crc, 1992 - void *buf, size_t buf_size) 1990 + static inline u32 f2fs_chksum(u32 crc, const void *address, unsigned int length) 1993 1991 { 1994 - return f2fs_crc32(sbi, buf, buf_size) == blk_crc; 1995 - } 1996 - 1997 - static inline u32 f2fs_chksum(struct f2fs_sb_info *sbi, u32 crc, 1998 - const void *address, unsigned int length) 1999 - { 2000 - return __f2fs_crc32(sbi, crc, address, length); 1992 + return __f2fs_crc32(crc, address, length); 2001 1993 } 2002 1994 2003 1995 static inline struct f2fs_inode_info *F2FS_I(struct inode *inode)
+6 -7
fs/f2fs/inode.c
··· 144 144 unsigned int offset = offsetof(struct f2fs_inode, i_inode_checksum); 145 145 unsigned int cs_size = sizeof(dummy_cs); 146 146 147 - chksum = f2fs_chksum(sbi, sbi->s_chksum_seed, (__u8 *)&ino, 148 - sizeof(ino)); 149 - chksum_seed = f2fs_chksum(sbi, chksum, (__u8 *)&gen, sizeof(gen)); 147 + chksum = f2fs_chksum(sbi->s_chksum_seed, (__u8 *)&ino, sizeof(ino)); 148 + chksum_seed = f2fs_chksum(chksum, (__u8 *)&gen, sizeof(gen)); 150 149 151 - chksum = f2fs_chksum(sbi, chksum_seed, (__u8 *)ri, offset); 152 - chksum = f2fs_chksum(sbi, chksum, (__u8 *)&dummy_cs, cs_size); 150 + chksum = f2fs_chksum(chksum_seed, (__u8 *)ri, offset); 151 + chksum = f2fs_chksum(chksum, (__u8 *)&dummy_cs, cs_size); 153 152 offset += cs_size; 154 - chksum = f2fs_chksum(sbi, chksum, (__u8 *)ri + offset, 155 - F2FS_BLKSIZE - offset); 153 + chksum = f2fs_chksum(chksum, (__u8 *)ri + offset, 154 + F2FS_BLKSIZE - offset); 156 155 return chksum; 157 156 } 158 157
+4 -4
fs/f2fs/super.c
··· 3564 3564 return -EFSCORRUPTED; 3565 3565 } 3566 3566 crc = le32_to_cpu(raw_super->crc); 3567 - if (!f2fs_crc_valid(sbi, crc, raw_super, crc_offset)) { 3567 + if (crc != f2fs_crc32(raw_super, crc_offset)) { 3568 3568 f2fs_info(sbi, "Invalid SB checksum value: %u", crc); 3569 3569 return -EFSCORRUPTED; 3570 3570 } ··· 4120 4120 4121 4121 /* we should update superblock crc here */ 4122 4122 if (!recover && f2fs_sb_has_sb_chksum(sbi)) { 4123 - crc = f2fs_crc32(sbi, F2FS_RAW_SUPER(sbi), 4123 + crc = f2fs_crc32(F2FS_RAW_SUPER(sbi), 4124 4124 offsetof(struct f2fs_super_block, crc)); 4125 4125 F2FS_RAW_SUPER(sbi)->crc = cpu_to_le32(crc); 4126 4126 } ··· 4581 4581 4582 4582 /* precompute checksum seed for metadata */ 4583 4583 if (f2fs_sb_has_inode_chksum(sbi)) 4584 - sbi->s_chksum_seed = f2fs_chksum(sbi, ~0, raw_super->uuid, 4585 - sizeof(raw_super->uuid)); 4584 + sbi->s_chksum_seed = f2fs_chksum(~0, raw_super->uuid, 4585 + sizeof(raw_super->uuid)); 4586 4586 4587 4587 default_options(sbi, false); 4588 4588 /* parse mount options */