aboutsummaryrefslogtreecommitdiffstats
path: root/module/zfs/dmu.c
diff options
context:
space:
mode:
authorMatthew Ahrens <[email protected]>2017-03-23 09:07:27 -0700
committerBrian Behlendorf <[email protected]>2017-06-07 14:16:01 -0400
commit82644107c4e7f3e899ebde18f65cbac7c604583c (patch)
tree8111a1ac9ea396e0a9f092fc5a97f50b8078d4bb /module/zfs/dmu.c
parent4070bfd85282eda582cd0050367478da5e29ca2e (diff)
OpenZFS 8155 - simplify dmu_write_policy handling of pre-compressed buffers
Authored by: Matthew Ahrens <[email protected]> Reviewed by: Dan Kimmel <[email protected]> Reviewed by: George Wilson <[email protected]> Approved by: Robert Mustacchi <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Ported-by: Giuseppe Di Natale <[email protected]> When writing pre-compressed buffers, arc_write() requires that the compression algorithm used to compress the buffer matches the compression algorithm requested by the zio_prop_t, which is set by dmu_write_policy(). This makes dmu_write_policy() and its callers a bit more complicated. We simplify this by making arc_write() trust the caller to supply the type of pre-compressed buffer that it wants to write, and override the compression setting in the zio_prop_t. OpenZFS-issue: https://www.illumos.org/issues/8155 OpenZFS-commit: https://github.com/openzfs/openzfs/commit/b55ff58 Closes #6200
Diffstat (limited to 'module/zfs/dmu.c')
-rw-r--r--module/zfs/dmu.c20
1 files changed, 4 insertions, 16 deletions
diff --git a/module/zfs/dmu.c b/module/zfs/dmu.c
index 4203ddb16..5cf09412f 100644
--- a/module/zfs/dmu.c
+++ b/module/zfs/dmu.c
@@ -20,7 +20,7 @@
*/
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2011, 2016 by Delphix. All rights reserved.
+ * Copyright (c) 2011, 2017 by Delphix. All rights reserved.
* Copyright (c) 2013 by Saso Kiselkov. All rights reserved.
* Copyright (c) 2013, Joyent, Inc. All rights reserved.
* Copyright (c) 2016, Nexenta Systems, Inc. All rights reserved.
@@ -1705,8 +1705,7 @@ dmu_sync(zio_t *pio, uint64_t txg, dmu_sync_cb_t *done, zgd_t *zgd)
DB_DNODE_ENTER(db);
dn = DB_DNODE(db);
- dmu_write_policy(os, dn, db->db_level, WP_DMU_SYNC,
- ZIO_COMPRESS_INHERIT, &zp);
+ dmu_write_policy(os, dn, db->db_level, WP_DMU_SYNC, &zp);
DB_DNODE_EXIT(db);
/*
@@ -1876,8 +1875,7 @@ int zfs_mdcomp_disable = 0;
int zfs_redundant_metadata_most_ditto_level = 2;
void
-dmu_write_policy(objset_t *os, dnode_t *dn, int level, int wp,
- enum zio_compress override_compress, zio_prop_t *zp)
+dmu_write_policy(objset_t *os, dnode_t *dn, int level, int wp, zio_prop_t *zp)
{
dmu_object_type_t type = dn ? dn->dn_type : DMU_OT_OBJSET;
boolean_t ismd = (level > 0 || DMU_OT_IS_METADATA(type) ||
@@ -1890,9 +1888,6 @@ dmu_write_policy(objset_t *os, dnode_t *dn, int level, int wp,
boolean_t dedup_verify = os->os_dedup_verify;
int copies = os->os_copies;
- IMPLY(override_compress == ZIO_COMPRESS_LZ4,
- spa_feature_is_active(os->os_spa, SPA_FEATURE_LZ4_COMPRESS));
-
/*
* We maintain different write policies for each of the following
* types of data:
@@ -1979,14 +1974,7 @@ dmu_write_policy(objset_t *os, dnode_t *dn, int level, int wp,
}
zp->zp_checksum = checksum;
-
- /*
- * If we're writing a pre-compressed buffer, the compression type we use
- * must match the data. If it hasn't been compressed yet, then we should
- * use the value dictated by the policies above.
- */
- zp->zp_compress = override_compress != ZIO_COMPRESS_INHERIT
- ? override_compress : compress;
+ zp->zp_compress = compress;
ASSERT3U(zp->zp_compress, !=, ZIO_COMPRESS_INHERIT);
zp->zp_type = (wp & WP_SPILL) ? dn->dn_bonustype : type;