diff options
author | Qu Wenruo <wqu@suse.com> | 2022-05-22 13:47:48 +0200 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2022-07-25 17:44:33 +0200 |
commit | ae643a74ebdb150b004601d0d5fe5a1faba9b04d (patch) | |
tree | ba06fd8d41ddbaee9ba824da4efe5b85e9a6cb87 /fs/btrfs/ctree.h | |
parent | b036f47996c5c9b4926d47f31bcd156e16c53617 (diff) | |
download | linux-stable-ae643a74ebdb150b004601d0d5fe5a1faba9b04d.tar.gz linux-stable-ae643a74ebdb150b004601d0d5fe5a1faba9b04d.tar.bz2 linux-stable-ae643a74ebdb150b004601d0d5fe5a1faba9b04d.zip |
btrfs: introduce a data checksum checking helper
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: Nikolay Borisov <nborisov@suse.com>
Signed-off-by: Qu 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: Christoph Hellwig <hch@lst.de>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/ctree.h')
-rw-r--r-- | fs/btrfs/ctree.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index ad31cc5cdd50..6e65778040ed 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h @@ -3253,6 +3253,8 @@ u64 btrfs_file_extent_end(const struct btrfs_path *path); /* inode.c */ void btrfs_submit_data_bio(struct inode *inode, struct bio *bio, int mirror_num, enum btrfs_compression_type compress_type); +int btrfs_check_sector_csum(struct btrfs_fs_info *fs_info, struct page *page, + u32 pgoff, u8 *csum, const u8 * const csum_expected); unsigned int btrfs_verify_data_csum(struct btrfs_bio *bbio, u32 bio_offset, struct page *page, u64 start, u64 end); |