Commit c7460541 authored by David Sterba's avatar David Sterba

btrfs: scrub: clean up temporary page variables in scrub_checksum_super

Add proper variable for the scrub page and use it instead of repeatedly
dereferencing the other structures.
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 74710cf1
...@@ -1904,23 +1904,23 @@ static int scrub_checksum_super(struct scrub_block *sblock) ...@@ -1904,23 +1904,23 @@ static int scrub_checksum_super(struct scrub_block *sblock)
struct btrfs_fs_info *fs_info = sctx->fs_info; struct btrfs_fs_info *fs_info = sctx->fs_info;
SHASH_DESC_ON_STACK(shash, fs_info->csum_shash); SHASH_DESC_ON_STACK(shash, fs_info->csum_shash);
u8 calculated_csum[BTRFS_CSUM_SIZE]; u8 calculated_csum[BTRFS_CSUM_SIZE];
struct page *page; struct scrub_page *spage;
char *kaddr; char *kaddr;
int fail_gen = 0; int fail_gen = 0;
int fail_cor = 0; int fail_cor = 0;
BUG_ON(sblock->page_count < 1); BUG_ON(sblock->page_count < 1);
page = sblock->pagev[0]->page; spage = sblock->pagev[0];
kaddr = page_address(page); kaddr = page_address(spage->page);
s = (struct btrfs_super_block *)kaddr; s = (struct btrfs_super_block *)kaddr;
if (sblock->pagev[0]->logical != btrfs_super_bytenr(s)) if (spage->logical != btrfs_super_bytenr(s))
++fail_cor; ++fail_cor;
if (sblock->pagev[0]->generation != btrfs_super_generation(s)) if (spage->generation != btrfs_super_generation(s))
++fail_gen; ++fail_gen;
if (!scrub_check_fsid(s->fsid, sblock->pagev[0])) if (!scrub_check_fsid(s->fsid, spage))
++fail_cor; ++fail_cor;
shash->tfm = fs_info->csum_shash; shash->tfm = fs_info->csum_shash;
...@@ -1941,10 +1941,10 @@ static int scrub_checksum_super(struct scrub_block *sblock) ...@@ -1941,10 +1941,10 @@ static int scrub_checksum_super(struct scrub_block *sblock)
++sctx->stat.super_errors; ++sctx->stat.super_errors;
spin_unlock(&sctx->stat_lock); spin_unlock(&sctx->stat_lock);
if (fail_cor) if (fail_cor)
btrfs_dev_stat_inc_and_print(sblock->pagev[0]->dev, btrfs_dev_stat_inc_and_print(spage->dev,
BTRFS_DEV_STAT_CORRUPTION_ERRS); BTRFS_DEV_STAT_CORRUPTION_ERRS);
else else
btrfs_dev_stat_inc_and_print(sblock->pagev[0]->dev, btrfs_dev_stat_inc_and_print(spage->dev,
BTRFS_DEV_STAT_GENERATION_ERRS); BTRFS_DEV_STAT_GENERATION_ERRS);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment