• Qu Wenruo's avatar
    btrfs: introduce a data checksum checking helper · ae643a74
    Qu Wenruo authored
    Although we have several data csum verification code, we never have a
    function really just to verify checksum for one sector.
    
    Function check_data_csum() do extra work for error reporting, thus it
    requires a lot of extra things like file offset, bio_offset etc.
    
    Function btrfs_verify_data_csum() is even worse, it will utilize page
    checked flag, which means it can not be utilized for direct IO pages.
    
    Here we introduce a new helper, btrfs_check_sector_csum(), which really
    only accept a sector in page, and expected checksum pointer.
    
    We use this function to implement check_data_csum(), and export it for
    incoming patch.
    Reviewed-by: default avatarNikolay Borisov <nborisov@suse.com>
    Signed-off-by: default avatarQu Wenruo <wqu@suse.com>
    [hch: keep passing the csum array as an arguments, as the callers want
          to print it, rename per request]
    Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
    Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
    Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
    ae643a74
compression.c 50 KB