diff options
-rw-r--r-- | man/man5/zfs-module-parameters.5 | 11 | ||||
-rw-r--r-- | module/zfs/dmu_send.c | 17 | ||||
-rwxr-xr-x | tests/zfs-tests/tests/functional/cli_root/zfs_send/zfs_send_006_pos.ksh | 2 |
3 files changed, 27 insertions, 3 deletions
diff --git a/man/man5/zfs-module-parameters.5 b/man/man5/zfs-module-parameters.5 index 9d5735bd4..822146a7a 100644 --- a/man/man5/zfs-module-parameters.5 +++ b/man/man5/zfs-module-parameters.5 @@ -1146,6 +1146,17 @@ Default value: \fB100,000\fR. .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 +.ne 2 +.na \fBzfs_vdev_async_read_max_active\fR (int) .ad .RS 12n diff --git a/module/zfs/dmu_send.c b/module/zfs/dmu_send.c index 9422f3444..9b6160254 100644 --- a/module/zfs/dmu_send.c +++ b/module/zfs/dmu_send.c @@ -69,6 +69,11 @@ int zfs_send_set_freerecords_bit = B_TRUE; static char *dmu_recv_tag = "dmu_recv_tag"; 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) \ (((uint64_t)datablkszsec) << (SPA_MINBLOCKSHIFT + \ (level) * (indblkshift - SPA_BLKPTRSHIFT))) @@ -1360,7 +1365,7 @@ static int dmu_adjust_send_estimate_for_indirects(dsl_dataset_t *ds, uint64_t uncompressed, uint64_t compressed, boolean_t stream_compressed, uint64_t *sizep) { - int err; + int err = 0; uint64_t size; /* * 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)); /* 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, zfs_prop_to_name(ZFS_PROP_VOLBLOCKSIZE), &recordsize); } else { @@ -4223,6 +4230,12 @@ dmu_objset_is_receiving(objset_t *os) } #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_PARM_DESC(zfs_send_corrupt_data, "Allow sending corrupt data"); diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_send/zfs_send_006_pos.ksh b/tests/zfs-tests/tests/functional/cli_root/zfs_send/zfs_send_006_pos.ksh index 1fe10a760..7192551b6 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zfs_send/zfs_send_006_pos.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zfs_send/zfs_send_006_pos.ksh @@ -37,7 +37,7 @@ verify_runnable "both" function cleanup { for ds in $datasets; do - datasetexists $ds && zfs destroy -rf $ds + destroy_dataset $ds "-rf" done } |