summaryrefslogtreecommitdiffstats
path: root/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c
diff options
context:
space:
mode:
authormm <mm@FreeBSD.org>2012-11-25 16:32:07 +0000
committermm <mm@FreeBSD.org>2012-11-25 16:32:07 +0000
commit3a0bfecf052237768517963f169d0797e2978f59 (patch)
tree35856bc2042e24d142ce48d78e222231eeb62646 /sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c
parent081fe7e2837cd17182c14d95cfe3d9cf8b82e05d (diff)
downloadFreeBSD-src-3a0bfecf052237768517963f169d0797e2978f59.zip
FreeBSD-src-3a0bfecf052237768517963f169d0797e2978f59.tar.gz
MFV r243013 and r243267:
Import the zio nop-write improvement from Illumos. To reduce I/O, nop-write omits overwriting data if the checksum (cryptographically secure) of new data matches the checksum of existing data. It also saves space if snapshots are in use. It currently works only on datasets with enabled compression, disabled deduplication and sha256 checksums. IllumOS 13887:196932ec9e6a and 13888:7204b3392a58 3236 zio nop-write References: https://www.illumos.org/issues/3236 MFC after: 2 weeks
Diffstat (limited to 'sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c')
-rw-r--r--sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c
index 07fd3c6..e5d159b 100644
--- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c
+++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c
@@ -78,6 +78,7 @@
#include <sys/vdev_impl.h>
#include <sys/zvol.h>
#include <sys/zil_impl.h>
+#include <sys/dbuf.h>
#include <geom/geom.h>
#include "zfs_namecheck.h"
@@ -1051,6 +1052,12 @@ zvol_get_data(void *arg, lr_write_t *lr, char *buf, zio_t *zio)
error = dmu_buf_hold(os, object, offset, zgd, &db,
DMU_READ_NO_PREFETCH);
if (error == 0) {
+ blkptr_t *obp = dmu_buf_get_blkptr(db);
+ if (obp) {
+ ASSERT(BP_IS_HOLE(bp));
+ *bp = *obp;
+ }
+
zgd->zgd_db = db;
zgd->zgd_bp = bp;
OpenPOWER on IntegriCloud