OpenZFS 9256 - zfs send space estimation off by > 10% on some datasets
Authored by: Paul Dagnelie <pcd@delphix.com> Reviewed by: Matt Ahrens <matt@delphix.com> Reviewed by: John Kennedy <john.kennedy@delphix.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Approved by: Richard Lowe <richlowe@richlowe.net> Ported-by: Giuseppe Di Natale <dinatale2@llnl.gov> Porting Notes: * Added tuning to man page. * Test case changes dropped, default behavior unchanged. OpenZFS-issue: https://www.illumos.org/issues/9256 OpenZFS-commit: https://github.com/openzfs/openzfs/commit/32356b3c56 Closes #7470
This commit is contained in:
parent
4ceb8dd6fd
commit
ca0845d59e
@ -1143,6 +1143,17 @@ Maximum number of blocks freed in a single txg.
|
|||||||
Default value: \fB100,000\fR.
|
Default value: \fB100,000\fR.
|
||||||
.RE
|
.RE
|
||||||
|
|
||||||
|
.sp
|
||||||
|
.ne 2
|
||||||
|
.na
|
||||||
|
\fBzfs_override_estimate_recordsize\fR (ulong)
|
||||||
|
.ad
|
||||||
|
.RS 12n
|
||||||
|
Record size calculation override for zfs send estimates.
|
||||||
|
.sp
|
||||||
|
Default value: \fB0\fR.
|
||||||
|
.RE
|
||||||
|
|
||||||
.sp
|
.sp
|
||||||
.ne 2
|
.ne 2
|
||||||
.na
|
.na
|
||||||
|
@ -69,6 +69,11 @@ int zfs_send_set_freerecords_bit = B_TRUE;
|
|||||||
static char *dmu_recv_tag = "dmu_recv_tag";
|
static char *dmu_recv_tag = "dmu_recv_tag";
|
||||||
const char *recv_clone_name = "%recv";
|
const char *recv_clone_name = "%recv";
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Use this to override the recordsize calculation for fast zfs send estimates.
|
||||||
|
*/
|
||||||
|
unsigned long zfs_override_estimate_recordsize = 0;
|
||||||
|
|
||||||
#define BP_SPAN(datablkszsec, indblkshift, level) \
|
#define BP_SPAN(datablkszsec, indblkshift, level) \
|
||||||
(((uint64_t)datablkszsec) << (SPA_MINBLOCKSHIFT + \
|
(((uint64_t)datablkszsec) << (SPA_MINBLOCKSHIFT + \
|
||||||
(level) * (indblkshift - SPA_BLKPTRSHIFT)))
|
(level) * (indblkshift - SPA_BLKPTRSHIFT)))
|
||||||
@ -1360,7 +1365,7 @@ static int
|
|||||||
dmu_adjust_send_estimate_for_indirects(dsl_dataset_t *ds, uint64_t uncompressed,
|
dmu_adjust_send_estimate_for_indirects(dsl_dataset_t *ds, uint64_t uncompressed,
|
||||||
uint64_t compressed, boolean_t stream_compressed, uint64_t *sizep)
|
uint64_t compressed, boolean_t stream_compressed, uint64_t *sizep)
|
||||||
{
|
{
|
||||||
int err;
|
int err = 0;
|
||||||
uint64_t size;
|
uint64_t size;
|
||||||
/*
|
/*
|
||||||
* Assume that space (both on-disk and in-stream) is dominated by
|
* Assume that space (both on-disk and in-stream) is dominated by
|
||||||
@ -1374,7 +1379,9 @@ dmu_adjust_send_estimate_for_indirects(dsl_dataset_t *ds, uint64_t uncompressed,
|
|||||||
VERIFY0(dmu_objset_from_ds(ds, &os));
|
VERIFY0(dmu_objset_from_ds(ds, &os));
|
||||||
|
|
||||||
/* Assume all (uncompressed) blocks are recordsize. */
|
/* Assume all (uncompressed) blocks are recordsize. */
|
||||||
if (os->os_phys->os_type == DMU_OST_ZVOL) {
|
if (zfs_override_estimate_recordsize != 0) {
|
||||||
|
recordsize = zfs_override_estimate_recordsize;
|
||||||
|
} else if (os->os_phys->os_type == DMU_OST_ZVOL) {
|
||||||
err = dsl_prop_get_int_ds(ds,
|
err = dsl_prop_get_int_ds(ds,
|
||||||
zfs_prop_to_name(ZFS_PROP_VOLBLOCKSIZE), &recordsize);
|
zfs_prop_to_name(ZFS_PROP_VOLBLOCKSIZE), &recordsize);
|
||||||
} else {
|
} else {
|
||||||
@ -4223,6 +4230,12 @@ dmu_objset_is_receiving(objset_t *os)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if defined(_KERNEL)
|
#if defined(_KERNEL)
|
||||||
|
/* BEGIN CSTYLED */
|
||||||
|
module_param(zfs_override_estimate_recordsize, ulong, 0644);
|
||||||
|
MODULE_PARM_DESC(zfs_override_estimate_recordsize,
|
||||||
|
"Record size calculation override for zfs send estimates");
|
||||||
|
/* END CSTYLED */
|
||||||
|
|
||||||
module_param(zfs_send_corrupt_data, int, 0644);
|
module_param(zfs_send_corrupt_data, int, 0644);
|
||||||
MODULE_PARM_DESC(zfs_send_corrupt_data, "Allow sending corrupt data");
|
MODULE_PARM_DESC(zfs_send_corrupt_data, "Allow sending corrupt data");
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ verify_runnable "both"
|
|||||||
function cleanup
|
function cleanup
|
||||||
{
|
{
|
||||||
for ds in $datasets; do
|
for ds in $datasets; do
|
||||||
datasetexists $ds && zfs destroy -rf $ds
|
destroy_dataset $ds "-rf"
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user