Deleted Added
full compact
dmu.c (321549) dmu.c (321573)
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE

--- 6 unchanged lines hidden (view full) ---

15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21/*
22 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE

--- 6 unchanged lines hidden (view full) ---

15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21/*
22 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
23 * Copyright (c) 2011, 2016 by Delphix. All rights reserved.
23 * Copyright (c) 2011, 2017 by Delphix. All rights reserved.
24 */
25/* Copyright (c) 2013 by Saso Kiselkov. All rights reserved. */
26/* Copyright (c) 2013, Joyent, Inc. All rights reserved. */
27/* Copyright (c) 2014, Nexenta Systems, Inc. All rights reserved. */
28
29#include <sys/dmu.h>
30#include <sys/dmu_impl.h>
31#include <sys/dmu_tx.h>

--- 1757 unchanged lines hidden (view full) ---

1789 ASSERT(pio != NULL);
1790 ASSERT(txg != 0);
1791
1792 SET_BOOKMARK(&zb, ds->ds_object,
1793 db->db.db_object, db->db_level, db->db_blkid);
1794
1795 DB_DNODE_ENTER(db);
1796 dn = DB_DNODE(db);
24 */
25/* Copyright (c) 2013 by Saso Kiselkov. All rights reserved. */
26/* Copyright (c) 2013, Joyent, Inc. All rights reserved. */
27/* Copyright (c) 2014, Nexenta Systems, Inc. All rights reserved. */
28
29#include <sys/dmu.h>
30#include <sys/dmu_impl.h>
31#include <sys/dmu_tx.h>

--- 1757 unchanged lines hidden (view full) ---

1789 ASSERT(pio != NULL);
1790 ASSERT(txg != 0);
1791
1792 SET_BOOKMARK(&zb, ds->ds_object,
1793 db->db.db_object, db->db_level, db->db_blkid);
1794
1795 DB_DNODE_ENTER(db);
1796 dn = DB_DNODE(db);
1797 dmu_write_policy(os, dn, db->db_level, WP_DMU_SYNC,
1798 ZIO_COMPRESS_INHERIT, &zp);
1797 dmu_write_policy(os, dn, db->db_level, WP_DMU_SYNC, &zp);
1799 DB_DNODE_EXIT(db);
1800
1801 /*
1802 * If we're frozen (running ziltest), we always need to generate a bp.
1803 */
1804 if (txg > spa_freeze_txg(os->os_spa))
1805 return (dmu_sync_late_arrival(pio, os, done, zgd, &zp, &zb));
1806

--- 155 unchanged lines hidden (view full) ---

1962
1963/*
1964 * When the "redundant_metadata" property is set to "most", only indirect
1965 * blocks of this level and higher will have an additional ditto block.
1966 */
1967int zfs_redundant_metadata_most_ditto_level = 2;
1968
1969void
1798 DB_DNODE_EXIT(db);
1799
1800 /*
1801 * If we're frozen (running ziltest), we always need to generate a bp.
1802 */
1803 if (txg > spa_freeze_txg(os->os_spa))
1804 return (dmu_sync_late_arrival(pio, os, done, zgd, &zp, &zb));
1805

--- 155 unchanged lines hidden (view full) ---

1961
1962/*
1963 * When the "redundant_metadata" property is set to "most", only indirect
1964 * blocks of this level and higher will have an additional ditto block.
1965 */
1966int zfs_redundant_metadata_most_ditto_level = 2;
1967
1968void
1970dmu_write_policy(objset_t *os, dnode_t *dn, int level, int wp,
1971 enum zio_compress override_compress, zio_prop_t *zp)
1969dmu_write_policy(objset_t *os, dnode_t *dn, int level, int wp, zio_prop_t *zp)
1972{
1973 dmu_object_type_t type = dn ? dn->dn_type : DMU_OT_OBJSET;
1974 boolean_t ismd = (level > 0 || DMU_OT_IS_METADATA(type) ||
1975 (wp & WP_SPILL));
1976 enum zio_checksum checksum = os->os_checksum;
1977 enum zio_compress compress = os->os_compress;
1978 enum zio_checksum dedup_checksum = os->os_dedup_checksum;
1979 boolean_t dedup = B_FALSE;
1980 boolean_t nopwrite = B_FALSE;
1981 boolean_t dedup_verify = os->os_dedup_verify;
1982 int copies = os->os_copies;
1970{
1971 dmu_object_type_t type = dn ? dn->dn_type : DMU_OT_OBJSET;
1972 boolean_t ismd = (level > 0 || DMU_OT_IS_METADATA(type) ||
1973 (wp & WP_SPILL));
1974 enum zio_checksum checksum = os->os_checksum;
1975 enum zio_compress compress = os->os_compress;
1976 enum zio_checksum dedup_checksum = os->os_dedup_checksum;
1977 boolean_t dedup = B_FALSE;
1978 boolean_t nopwrite = B_FALSE;
1979 boolean_t dedup_verify = os->os_dedup_verify;
1980 int copies = os->os_copies;
1983 boolean_t lz4_ac = spa_feature_is_active(os->os_spa,
1984 SPA_FEATURE_LZ4_COMPRESS);
1985
1981
1986 IMPLY(override_compress == ZIO_COMPRESS_LZ4, lz4_ac);
1987
1988 /*
1989 * We maintain different write policies for each of the following
1990 * types of data:
1991 * 1. metadata
1992 * 2. preallocated blocks (i.e. level-0 blocks of a dump device)
1993 * 3. all other level 0 blocks
1994 */
1995 if (ismd) {

--- 70 unchanged lines hidden (view full) ---

2066 * exclusive.
2067 */
2068 nopwrite = (!dedup && (zio_checksum_table[checksum].ci_flags &
2069 ZCHECKSUM_FLAG_NOPWRITE) &&
2070 compress != ZIO_COMPRESS_OFF && zfs_nopwrite_enabled);
2071 }
2072
2073 zp->zp_checksum = checksum;
1982 /*
1983 * We maintain different write policies for each of the following
1984 * types of data:
1985 * 1. metadata
1986 * 2. preallocated blocks (i.e. level-0 blocks of a dump device)
1987 * 3. all other level 0 blocks
1988 */
1989 if (ismd) {

--- 70 unchanged lines hidden (view full) ---

2060 * exclusive.
2061 */
2062 nopwrite = (!dedup && (zio_checksum_table[checksum].ci_flags &
2063 ZCHECKSUM_FLAG_NOPWRITE) &&
2064 compress != ZIO_COMPRESS_OFF && zfs_nopwrite_enabled);
2065 }
2066
2067 zp->zp_checksum = checksum;
2074
2075 /*
2076 * If we're writing a pre-compressed buffer, the compression type we use
2077 * must match the data. If it hasn't been compressed yet, then we should
2078 * use the value dictated by the policies above.
2079 */
2080 zp->zp_compress = override_compress != ZIO_COMPRESS_INHERIT
2081 ? override_compress : compress;
2068 zp->zp_compress = compress;
2082 ASSERT3U(zp->zp_compress, !=, ZIO_COMPRESS_INHERIT);
2083
2084 zp->zp_type = (wp & WP_SPILL) ? dn->dn_bonustype : type;
2085 zp->zp_level = level;
2086 zp->zp_copies = MIN(copies, spa_max_replication(os->os_spa));
2087 zp->zp_dedup = dedup;
2088 zp->zp_dedup_verify = dedup && dedup_verify;
2089 zp->zp_nopwrite = nopwrite;

--- 217 unchanged lines hidden ---
2069 ASSERT3U(zp->zp_compress, !=, ZIO_COMPRESS_INHERIT);
2070
2071 zp->zp_type = (wp & WP_SPILL) ? dn->dn_bonustype : type;
2072 zp->zp_level = level;
2073 zp->zp_copies = MIN(copies, spa_max_replication(os->os_spa));
2074 zp->zp_dedup = dedup;
2075 zp->zp_dedup_verify = dedup && dedup_verify;
2076 zp->zp_nopwrite = nopwrite;

--- 217 unchanged lines hidden ---