mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-25 18:59:33 +03:00
Remove limit on number of async zio_frees of non-dedup blocks
The module parameter zfs_async_block_max_blocks limits the number of blocks that can be freed by the background freeing of filesystems and snapshots (from "zfs destroy"), in one TXG. This is useful when freeing dedup blocks, becuase each zio_free() of a dedup block can require an i/o to read the relevant part of the dedup table (DDT), and will also dirty that block. zfs_async_block_max_blocks is set to 100,000 by default. For the more typical case where dedup is not used, this can have a negative performance impact on the rate of background freeing (from "zfs destroy"). For example, with recordsize=8k, and TXG's syncing once every 5 seconds, we can free only 160MB of data per second, which may be much less than the rate we can write data. This change increases zfs_async_block_max_blocks to be unlimited by default. To address the dedup freeing issue, a new tunable is introduced, zfs_max_async_dedup_frees, which limits the number of zio_free()'s of dedup blocks done by background destroys, per txg. The default is 100,000 free's (same as the old zfs_async_block_max_blocks default). Reviewed-by: Paul Dagnelie <pcd@delphix.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Matthew Ahrens <mahrens@delphix.com> Closes #10000
This commit is contained in:
parent
0f1832106d
commit
4fe3a842bb
@ -138,6 +138,7 @@ typedef struct dsl_scan {
|
|||||||
|
|
||||||
/* per txg statistics */
|
/* per txg statistics */
|
||||||
uint64_t scn_visited_this_txg; /* total bps visited this txg */
|
uint64_t scn_visited_this_txg; /* total bps visited this txg */
|
||||||
|
uint64_t scn_dedup_frees_this_txg; /* dedup bps freed this txg */
|
||||||
uint64_t scn_holes_this_txg;
|
uint64_t scn_holes_this_txg;
|
||||||
uint64_t scn_lt_min_this_txg;
|
uint64_t scn_lt_min_this_txg;
|
||||||
uint64_t scn_gt_max_this_txg;
|
uint64_t scn_gt_max_this_txg;
|
||||||
|
@ -1642,6 +1642,17 @@ Default value: \fB1\fR.
|
|||||||
.RS 12n
|
.RS 12n
|
||||||
Maximum number of blocks freed in a single txg.
|
Maximum number of blocks freed in a single txg.
|
||||||
.sp
|
.sp
|
||||||
|
Default value: \fBULONG_MAX\fR (unlimited).
|
||||||
|
.RE
|
||||||
|
|
||||||
|
.sp
|
||||||
|
.ne 2
|
||||||
|
.na
|
||||||
|
\fBzfs_max_async_dedup_frees\fR (ulong)
|
||||||
|
.ad
|
||||||
|
.RS 12n
|
||||||
|
Maximum number of dedup blocks freed in a single txg.
|
||||||
|
.sp
|
||||||
Default value: \fB100,000\fR.
|
Default value: \fB100,000\fR.
|
||||||
.RE
|
.RE
|
||||||
|
|
||||||
|
@ -175,7 +175,9 @@ int zfs_no_scrub_io = B_FALSE; /* set to disable scrub i/o */
|
|||||||
int zfs_no_scrub_prefetch = B_FALSE; /* set to disable scrub prefetch */
|
int zfs_no_scrub_prefetch = B_FALSE; /* set to disable scrub prefetch */
|
||||||
enum ddt_class zfs_scrub_ddt_class_max = DDT_CLASS_DUPLICATE;
|
enum ddt_class zfs_scrub_ddt_class_max = DDT_CLASS_DUPLICATE;
|
||||||
/* max number of blocks to free in a single TXG */
|
/* max number of blocks to free in a single TXG */
|
||||||
unsigned long zfs_async_block_max_blocks = 100000;
|
unsigned long zfs_async_block_max_blocks = ULONG_MAX;
|
||||||
|
/* max number of dedup blocks to free in a single TXG */
|
||||||
|
unsigned long zfs_max_async_dedup_frees = 100000;
|
||||||
|
|
||||||
int zfs_resilver_disable_defer = 0; /* set to disable resilver deferring */
|
int zfs_resilver_disable_defer = 0; /* set to disable resilver deferring */
|
||||||
|
|
||||||
@ -3101,6 +3103,11 @@ dsl_scan_async_block_should_pause(dsl_scan_t *scn)
|
|||||||
return (B_TRUE);
|
return (B_TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (zfs_max_async_dedup_frees != 0 &&
|
||||||
|
scn->scn_dedup_frees_this_txg >= zfs_max_async_dedup_frees) {
|
||||||
|
return (B_TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
elapsed_nanosecs = gethrtime() - scn->scn_sync_start_time;
|
elapsed_nanosecs = gethrtime() - scn->scn_sync_start_time;
|
||||||
return (elapsed_nanosecs / NANOSEC > zfs_txg_timeout ||
|
return (elapsed_nanosecs / NANOSEC > zfs_txg_timeout ||
|
||||||
(NSEC2MSEC(elapsed_nanosecs) > scn->scn_async_block_min_time_ms &&
|
(NSEC2MSEC(elapsed_nanosecs) > scn->scn_async_block_min_time_ms &&
|
||||||
@ -3125,6 +3132,8 @@ dsl_scan_free_block_cb(void *arg, const blkptr_t *bp, dmu_tx_t *tx)
|
|||||||
-bp_get_dsize_sync(scn->scn_dp->dp_spa, bp),
|
-bp_get_dsize_sync(scn->scn_dp->dp_spa, bp),
|
||||||
-BP_GET_PSIZE(bp), -BP_GET_UCSIZE(bp), tx);
|
-BP_GET_PSIZE(bp), -BP_GET_UCSIZE(bp), tx);
|
||||||
scn->scn_visited_this_txg++;
|
scn->scn_visited_this_txg++;
|
||||||
|
if (BP_GET_DEDUP(bp))
|
||||||
|
scn->scn_dedup_frees_this_txg++;
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3365,6 +3374,7 @@ dsl_process_async_destroys(dsl_pool_t *dp, dmu_tx_t *tx)
|
|||||||
NSEC2MSEC(gethrtime() - scn->scn_sync_start_time),
|
NSEC2MSEC(gethrtime() - scn->scn_sync_start_time),
|
||||||
(longlong_t)tx->tx_txg, err);
|
(longlong_t)tx->tx_txg, err);
|
||||||
scn->scn_visited_this_txg = 0;
|
scn->scn_visited_this_txg = 0;
|
||||||
|
scn->scn_dedup_frees_this_txg = 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Write out changes to the DDT that may be required as a
|
* Write out changes to the DDT that may be required as a
|
||||||
@ -3493,6 +3503,7 @@ dsl_scan_sync(dsl_pool_t *dp, dmu_tx_t *tx)
|
|||||||
|
|
||||||
/* reset scan statistics */
|
/* reset scan statistics */
|
||||||
scn->scn_visited_this_txg = 0;
|
scn->scn_visited_this_txg = 0;
|
||||||
|
scn->scn_dedup_frees_this_txg = 0;
|
||||||
scn->scn_holes_this_txg = 0;
|
scn->scn_holes_this_txg = 0;
|
||||||
scn->scn_lt_min_this_txg = 0;
|
scn->scn_lt_min_this_txg = 0;
|
||||||
scn->scn_gt_max_this_txg = 0;
|
scn->scn_gt_max_this_txg = 0;
|
||||||
@ -4327,6 +4338,9 @@ ZFS_MODULE_PARAM(zfs, zfs_, no_scrub_prefetch, INT, ZMOD_RW,
|
|||||||
ZFS_MODULE_PARAM(zfs, zfs_, async_block_max_blocks, ULONG, ZMOD_RW,
|
ZFS_MODULE_PARAM(zfs, zfs_, async_block_max_blocks, ULONG, ZMOD_RW,
|
||||||
"Max number of blocks freed in one txg");
|
"Max number of blocks freed in one txg");
|
||||||
|
|
||||||
|
ZFS_MODULE_PARAM(zfs, zfs_, max_async_dedup_frees, ULONG, ZMOD_RW,
|
||||||
|
"Max number of dedup blocks freed in one txg");
|
||||||
|
|
||||||
ZFS_MODULE_PARAM(zfs, zfs_, free_bpobj_enabled, INT, ZMOD_RW,
|
ZFS_MODULE_PARAM(zfs, zfs_, free_bpobj_enabled, INT, ZMOD_RW,
|
||||||
"Enable processing of the free_bpobj");
|
"Enable processing of the free_bpobj");
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user