diff options
author | David Sterba <dsterba@suse.com> | 2020-05-29 16:20:35 +0200 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2020-07-27 12:55:23 +0200 |
commit | d41ebef2005f3b1669da334183088668c168c74a (patch) | |
tree | ec88e0c502ec1406e922d7f91fbeb121400dfc03 /fs/btrfs | |
parent | 771aba0d12dd945132e2c3bbb512f96edc0efbaa (diff) | |
download | linux-d41ebef2005f3b1669da334183088668c168c74a.tar.bz2 |
btrfs: scrub: clean up temporary page variables in scrub_checksum_data
Add proper variable for the scrub page and use it instead of repeatedly
dereferencing the other structures.
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs')
-rw-r--r-- | fs/btrfs/scrub.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c index 16c83130d884..19a64c72f38e 100644 --- a/fs/btrfs/scrub.c +++ b/fs/btrfs/scrub.c @@ -1786,23 +1786,21 @@ static int scrub_checksum_data(struct scrub_block *sblock) struct btrfs_fs_info *fs_info = sctx->fs_info; SHASH_DESC_ON_STACK(shash, fs_info->csum_shash); u8 csum[BTRFS_CSUM_SIZE]; - u8 *on_disk_csum; - struct page *page; + struct scrub_page *spage; char *kaddr; BUG_ON(sblock->page_count < 1); - if (!sblock->pagev[0]->have_csum) + spage = sblock->pagev[0]; + if (!spage->have_csum) return 0; - on_disk_csum = sblock->pagev[0]->csum; - page = sblock->pagev[0]->page; - kaddr = page_address(page); + kaddr = page_address(spage->page); shash->tfm = fs_info->csum_shash; crypto_shash_init(shash); crypto_shash_digest(shash, kaddr, PAGE_SIZE, csum); - if (memcmp(csum, on_disk_csum, sctx->csum_size)) + if (memcmp(csum, spage->csum, sctx->csum_size)) sblock->checksum_error = 1; return sblock->checksum_error; |