提交 c7460541 编写于 作者: D 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: NDavid Sterba <dsterba@suse.com>
上级 74710cf1
......@@ -1904,23 +1904,23 @@ 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];
struct page *page;
struct scrub_page *spage;
char *kaddr;
int fail_gen = 0;
int fail_cor = 0;
BUG_ON(sblock->page_count < 1);
page = sblock->pagev[0]->page;
kaddr = page_address(page);
spage = sblock->pagev[0];
kaddr = page_address(spage->page);
s = (struct btrfs_super_block *)kaddr;
if (sblock->pagev[0]->logical != btrfs_super_bytenr(s))
if (spage->logical != btrfs_super_bytenr(s))
++fail_cor;
if (sblock->pagev[0]->generation != btrfs_super_generation(s))
if (spage->generation != btrfs_super_generation(s))
++fail_gen;
if (!scrub_check_fsid(s->fsid, sblock->pagev[0]))
if (!scrub_check_fsid(s->fsid, spage))
++fail_cor;
shash->tfm = fs_info->csum_shash;
......@@ -1941,10 +1941,10 @@ static int scrub_checksum_super(struct scrub_block *sblock)
++sctx->stat.super_errors;
spin_unlock(&sctx->stat_lock);
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);
else
btrfs_dev_stat_inc_and_print(sblock->pagev[0]->dev,
btrfs_dev_stat_inc_and_print(spage->dev,
BTRFS_DEV_STAT_GENERATION_ERRS);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册