From 69ae34076f227478a505438d958578eb30548443 Mon Sep 17 00:00:00 2001 From: Tom Caputi Date: Sat, 25 May 2019 16:52:23 -0400 Subject: [PATCH] Fix embedded bp accounting in count_block() Currently, count_block() does not correctly account for the possibility that the bp that is passed to it could be embedded. These blocks shouldn't be counted since the work of scanning these blocks in already handled when the containing block is scanned. This patch simply resolves this issue by returning early in this case. Reviewed by: Allan Jude Reviewed-by: Brian Behlendorf Authored-by: Bill Sommerfeld Signed-off-by: Tom Caputi Closes #8800 Closes #8766 --- module/zfs/dsl_scan.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/module/zfs/dsl_scan.c b/module/zfs/dsl_scan.c index eee122aa6..b15c39ac9 100644 --- a/module/zfs/dsl_scan.c +++ b/module/zfs/dsl_scan.c @@ -3629,6 +3629,13 @@ count_block(dsl_scan_t *scn, zfs_all_blkstats_t *zab, const blkptr_t *bp) { int i; + /* + * Don't count embedded bp's, since we already did the work of + * scanning these when we scanned the containing block. + */ + if (BP_IS_EMBEDDED(bp)) + return; + /* * Update the spa's stats on how many bytes we have issued. * Sequential scrubs create a zio for each DVA of the bp. Each