diff options
author | David Sterba <dsterba@suse.com> | 2020-05-29 16:43:14 +0300 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2020-07-27 13:55:22 +0300 |
commit | 74710cf1fbdc74b1593be953e85b3f392c9f43a4 (patch) | |
tree | e8864f03c9e8774770a9c97ec38bae6b4a9bd9ba /fs/btrfs/scrub.c | |
parent | 83cf6d5eae54eb40727210e825f8d656a33e7d30 (diff) | |
download | linux-74710cf1fbdc74b1593be953e85b3f392c9f43a4.tar.xz |
btrfs: scrub: remove temporary csum array in scrub_checksum_super
The page contents with the checksum is available during the entire
function so we don't need to make a copy.
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/scrub.c')
-rw-r--r-- | fs/btrfs/scrub.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c index 13ee43f29751..abb39c5255d2 100644 --- a/fs/btrfs/scrub.c +++ b/fs/btrfs/scrub.c @@ -1904,7 +1904,6 @@ static int scrub_checksum_super(struct scrub_block *sblock) struct btrfs_fs_info *fs_info = sctx->fs_info; SHASH_DESC_ON_STACK(shash, fs_info->csum_shash); u8 calculated_csum[BTRFS_CSUM_SIZE]; - u8 on_disk_csum[BTRFS_CSUM_SIZE]; struct page *page; char *kaddr; int fail_gen = 0; @@ -1914,7 +1913,6 @@ static int scrub_checksum_super(struct scrub_block *sblock) page = sblock->pagev[0]->page; kaddr = page_address(page); s = (struct btrfs_super_block *)kaddr; - memcpy(on_disk_csum, s->csum, sctx->csum_size); if (sblock->pagev[0]->logical != btrfs_super_bytenr(s)) ++fail_cor; @@ -1930,7 +1928,7 @@ static int scrub_checksum_super(struct scrub_block *sblock) crypto_shash_digest(shash, kaddr + BTRFS_CSUM_SIZE, BTRFS_SUPER_INFO_SIZE - BTRFS_CSUM_SIZE, calculated_csum); - if (memcmp(calculated_csum, on_disk_csum, sctx->csum_size)) + if (memcmp(calculated_csum, s->csum, sctx->csum_size)) ++fail_cor; if (fail_cor + fail_gen) { |