From 82644107c4e7f3e899ebde18f65cbac7c604583c Mon Sep 17 00:00:00 2001 From: Matthew Ahrens Date: Thu, 23 Mar 2017 09:07:27 -0700 Subject: OpenZFS 8155 - simplify dmu_write_policy handling of pre-compressed buffers Authored by: Matthew Ahrens Reviewed by: Dan Kimmel Reviewed by: George Wilson Approved by: Robert Mustacchi Reviewed-by: Brian Behlendorf Ported-by: Giuseppe Di Natale 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 --- module/zfs/dbuf.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'module/zfs/dbuf.c') diff --git a/module/zfs/dbuf.c b/module/zfs/dbuf.c index 1575cc1b4..611382686 100644 --- a/module/zfs/dbuf.c +++ b/module/zfs/dbuf.c @@ -3736,9 +3736,7 @@ dbuf_write(dbuf_dirty_record_t *dr, arc_buf_t *data, dmu_tx_t *tx) wp_flag = WP_SPILL; wp_flag |= (db->db_state == DB_NOFILL) ? WP_NOFILL : 0; - dmu_write_policy(os, dn, db->db_level, wp_flag, - (data != NULL && arc_get_compression(data) != ZIO_COMPRESS_OFF) ? - arc_get_compression(data) : ZIO_COMPRESS_INHERIT, &zp); + dmu_write_policy(os, dn, db->db_level, wp_flag, &zp); DB_DNODE_EXIT(db); /* -- cgit v1.2.3