summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
authorPaul Dagnelie <pcd@delphix.com>2016-07-07 15:00:51 -0700
committerPrakash Surya <prakash.surya@delphix.com>2017-06-07 18:57:05 -0700
commit0255edcc85fc0cd1dda0e49bcd52eb66c06a1b16 (patch)
tree060cc0805d8ee222a0343e54bda9fe84138437d0 /usr/src
parentdbfd9f930004c390a2ce2cf850c71b4f880eef9c (diff)
downloadillumos-joyent-0255edcc85fc0cd1dda0e49bcd52eb66c06a1b16.tar.gz
8056 zfs send size estimate is inaccurate for some zvols
Reviewed by: Matthew Ahrens <mahrens@delphix.com> Reviewed by: Pavel Zakharov <pavel.zakharov@delphix.com> Approved by: Robert Mustacchi <rm@joyent.com>
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/uts/common/fs/zfs/dmu_send.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/usr/src/uts/common/fs/zfs/dmu_send.c b/usr/src/uts/common/fs/zfs/dmu_send.c
index ac71c5a11a..9a2dad4073 100644
--- a/usr/src/uts/common/fs/zfs/dmu_send.c
+++ b/usr/src/uts/common/fs/zfs/dmu_send.c
@@ -1102,10 +1102,17 @@ dmu_adjust_send_estimate_for_indirects(dsl_dataset_t *ds, uint64_t uncompressed,
*/
uint64_t recordsize;
uint64_t record_count;
+ objset_t *os;
+ VERIFY0(dmu_objset_from_ds(ds, &os));
/* Assume all (uncompressed) blocks are recordsize. */
- err = dsl_prop_get_int_ds(ds, zfs_prop_to_name(ZFS_PROP_RECORDSIZE),
- &recordsize);
+ 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 {
+ err = dsl_prop_get_int_ds(ds,
+ zfs_prop_to_name(ZFS_PROP_RECORDSIZE), &recordsize);
+ }
if (err != 0)
return (err);
record_count = uncompressed / recordsize;
@@ -1174,6 +1181,10 @@ dmu_send_estimate(dsl_dataset_t *ds, dsl_dataset_t *fromds,
err = dmu_adjust_send_estimate_for_indirects(ds, uncomp, comp,
stream_compressed, sizep);
+ /*
+ * Add the size of the BEGIN and END records to the estimate.
+ */
+ *sizep += 2 * sizeof (dmu_replay_record_t);
return (err);
}