On Fri, May 10, 2019 at 01:15:45PM +0200, Johannes Thumshirn wrote: > btrfs_csum_data() and btrfs_csum_final() still have assumptions on the > checksums' type and size. Remove it so we can plumb in more types. > > Signed-off-by: Johannes Thumshirn <jthumshirn@xxxxxxx> > --- > fs/btrfs/check-integrity.c | 6 ++--- > fs/btrfs/compression.c | 13 ++++++----- > fs/btrfs/disk-io.c | 58 +++++++++++++++++++++++++--------------------- > fs/btrfs/disk-io.h | 6 ++--- > fs/btrfs/file-item.c | 13 +++++------ > fs/btrfs/inode.c | 18 +++++++------- > fs/btrfs/scrub.c | 20 +++++++++------- > 7 files changed, 72 insertions(+), 62 deletions(-) > > diff --git a/fs/btrfs/check-integrity.c b/fs/btrfs/check-integrity.c > index 6aad0c3d197f..54c8a549b505 100644 > --- a/fs/btrfs/check-integrity.c > +++ b/fs/btrfs/check-integrity.c > @@ -1712,7 +1712,6 @@ static int btrfsic_test_for_metadata(struct btrfsic_state *state, > struct btrfs_fs_info *fs_info = state->fs_info; > struct btrfs_header *h; > u8 csum[BTRFS_CSUM_SIZE]; > - u32 crc = ~(u32)0; > unsigned int i; > > if (num_pages * PAGE_SIZE < state->metablock_size) > @@ -1723,14 +1722,15 @@ static int btrfsic_test_for_metadata(struct btrfsic_state *state, > if (memcmp(h->fsid, fs_info->fs_devices->fsid, BTRFS_FSID_SIZE)) > return 1; > > + memset(csum, 0xff, btrfs_super_csum_size(fs_info->super_copy)); This should be added to the csum API as eg. btrfs_csum_init and not opencoded.
