Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 22 Jun 2017 16:58:09 +0000 (UTC)
From:      Andriy Gapon <avg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r320238 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
Message-ID:  <201706221658.v5MGw9ni024466@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: avg
Date: Thu Jun 22 16:58:09 2017
New Revision: 320238
URL: https://svnweb.freebsd.org/changeset/base/320238

Log:
  MFV r319742: 8056 zfs send size estimate is inaccurate for some zvols
  
  illumos/illumos-gate@0255edcc85fc0cd1dda0e49bcd52eb66c06a1b16
  https://github.com/illumos/illumos-gate/commit/0255edcc85fc0cd1dda0e49bcd52eb66c06a1b16
  
  https://www.illumos.org/issues/8056
    The send size estimate for a zvol can be too low, if the size of the record
    headers (dmu_replay_record_t's) is a significant portion of the size.
    This is typically the case when the data is highly compressible, especially
    with embedded blocks.
    The problem is that dmu_adjust_send_estimate_for_indirects() assumes that
    blocks are the size of the "recordsize" property (128KB).
    However, for zvols, the blocks are the size of the "volblocksize" property
    (8KB). Therefore, we estimate that there will be 16x less record headers than
    there really will be.
  
  Reviewed by: Matthew Ahrens <mahrens@delphix.com>
  Reviewed by: Pavel Zakharov <pavel.zakharov@delphix.com>
  Approved by: Robert Mustacchi <rm@joyent.com>
  Author: Paul Dagnelie <pcd@delphix.com>
  
  MFC after:	3 weeks

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c
Directory Properties:
  head/sys/cddl/contrib/opensolaris/   (props changed)

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c
==============================================================================
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c	Thu Jun 22 16:52:22 2017	(r320237)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c	Thu Jun 22 16:58:09 2017	(r320238)
@@ -1140,10 +1140,17 @@ dmu_adjust_send_estimate_for_indirects(dsl_dataset_t *
 	 */
 	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;
@@ -1212,6 +1219,10 @@ dmu_send_estimate(dsl_dataset_t *ds, dsl_dataset_t *fr
 
 	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);
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201706221658.v5MGw9ni024466>