dmu.c (226620) | dmu.c (236884) |
---|---|
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) 2012 by Delphix. All rights reserved. |
|
23 */ 24 25#include <sys/dmu.h> 26#include <sys/dmu_impl.h> 27#include <sys/dmu_tx.h> 28#include <sys/dbuf.h> 29#include <sys/dnode.h> 30#include <sys/zfs_context.h> --- 9 unchanged lines hidden (view full) --- 40#include <sys/zap.h> 41#include <sys/zio_checksum.h> 42#include <sys/sa.h> 43#ifdef _KERNEL 44#include <sys/zfs_znode.h> 45#endif 46 47const dmu_object_type_info_t dmu_ot[DMU_OT_NUMTYPES] = { | 24 */ 25 26#include <sys/dmu.h> 27#include <sys/dmu_impl.h> 28#include <sys/dmu_tx.h> 29#include <sys/dbuf.h> 30#include <sys/dnode.h> 31#include <sys/zfs_context.h> --- 9 unchanged lines hidden (view full) --- 41#include <sys/zap.h> 42#include <sys/zio_checksum.h> 43#include <sys/sa.h> 44#ifdef _KERNEL 45#include <sys/zfs_znode.h> 46#endif 47 48const dmu_object_type_info_t dmu_ot[DMU_OT_NUMTYPES] = { |
48 { byteswap_uint8_array, TRUE, "unallocated" }, 49 { zap_byteswap, TRUE, "object directory" }, 50 { byteswap_uint64_array, TRUE, "object array" }, 51 { byteswap_uint8_array, TRUE, "packed nvlist" }, 52 { byteswap_uint64_array, TRUE, "packed nvlist size" }, 53 { byteswap_uint64_array, TRUE, "bpobj" }, 54 { byteswap_uint64_array, TRUE, "bpobj header" }, 55 { byteswap_uint64_array, TRUE, "SPA space map header" }, 56 { byteswap_uint64_array, TRUE, "SPA space map" }, 57 { byteswap_uint64_array, TRUE, "ZIL intent log" }, 58 { dnode_buf_byteswap, TRUE, "DMU dnode" }, 59 { dmu_objset_byteswap, TRUE, "DMU objset" }, 60 { byteswap_uint64_array, TRUE, "DSL directory" }, 61 { zap_byteswap, TRUE, "DSL directory child map"}, 62 { zap_byteswap, TRUE, "DSL dataset snap map" }, 63 { zap_byteswap, TRUE, "DSL props" }, 64 { byteswap_uint64_array, TRUE, "DSL dataset" }, 65 { zfs_znode_byteswap, TRUE, "ZFS znode" }, 66 { zfs_oldacl_byteswap, TRUE, "ZFS V0 ACL" }, 67 { byteswap_uint8_array, FALSE, "ZFS plain file" }, 68 { zap_byteswap, TRUE, "ZFS directory" }, 69 { zap_byteswap, TRUE, "ZFS master node" }, 70 { zap_byteswap, TRUE, "ZFS delete queue" }, 71 { byteswap_uint8_array, FALSE, "zvol object" }, 72 { zap_byteswap, TRUE, "zvol prop" }, 73 { byteswap_uint8_array, FALSE, "other uint8[]" }, 74 { byteswap_uint64_array, FALSE, "other uint64[]" }, 75 { zap_byteswap, TRUE, "other ZAP" }, 76 { zap_byteswap, TRUE, "persistent error log" }, 77 { byteswap_uint8_array, TRUE, "SPA history" }, 78 { byteswap_uint64_array, TRUE, "SPA history offsets" }, 79 { zap_byteswap, TRUE, "Pool properties" }, 80 { zap_byteswap, TRUE, "DSL permissions" }, 81 { zfs_acl_byteswap, TRUE, "ZFS ACL" }, 82 { byteswap_uint8_array, TRUE, "ZFS SYSACL" }, 83 { byteswap_uint8_array, TRUE, "FUID table" }, 84 { byteswap_uint64_array, TRUE, "FUID table size" }, 85 { zap_byteswap, TRUE, "DSL dataset next clones"}, 86 { zap_byteswap, TRUE, "scan work queue" }, 87 { zap_byteswap, TRUE, "ZFS user/group used" }, 88 { zap_byteswap, TRUE, "ZFS user/group quota" }, 89 { zap_byteswap, TRUE, "snapshot refcount tags"}, 90 { zap_byteswap, TRUE, "DDT ZAP algorithm" }, 91 { zap_byteswap, TRUE, "DDT statistics" }, 92 { byteswap_uint8_array, TRUE, "System attributes" }, 93 { zap_byteswap, TRUE, "SA master node" }, 94 { zap_byteswap, TRUE, "SA attr registration" }, 95 { zap_byteswap, TRUE, "SA attr layouts" }, 96 { zap_byteswap, TRUE, "scan translations" }, 97 { byteswap_uint8_array, FALSE, "deduplicated block" }, 98 { zap_byteswap, TRUE, "DSL deadlist map" }, 99 { byteswap_uint64_array, TRUE, "DSL deadlist map hdr" }, 100 { zap_byteswap, TRUE, "DSL dir clones" }, 101 { byteswap_uint64_array, TRUE, "bpobj subobj" }, | 49 { DMU_BSWAP_UINT8, TRUE, "unallocated" }, 50 { DMU_BSWAP_ZAP, TRUE, "object directory" }, 51 { DMU_BSWAP_UINT64, TRUE, "object array" }, 52 { DMU_BSWAP_UINT8, TRUE, "packed nvlist" }, 53 { DMU_BSWAP_UINT64, TRUE, "packed nvlist size" }, 54 { DMU_BSWAP_UINT64, TRUE, "bpobj" }, 55 { DMU_BSWAP_UINT64, TRUE, "bpobj header" }, 56 { DMU_BSWAP_UINT64, TRUE, "SPA space map header" }, 57 { DMU_BSWAP_UINT64, TRUE, "SPA space map" }, 58 { DMU_BSWAP_UINT64, TRUE, "ZIL intent log" }, 59 { DMU_BSWAP_DNODE, TRUE, "DMU dnode" }, 60 { DMU_BSWAP_OBJSET, TRUE, "DMU objset" }, 61 { DMU_BSWAP_UINT64, TRUE, "DSL directory" }, 62 { DMU_BSWAP_ZAP, TRUE, "DSL directory child map"}, 63 { DMU_BSWAP_ZAP, TRUE, "DSL dataset snap map" }, 64 { DMU_BSWAP_ZAP, TRUE, "DSL props" }, 65 { DMU_BSWAP_UINT64, TRUE, "DSL dataset" }, 66 { DMU_BSWAP_ZNODE, TRUE, "ZFS znode" }, 67 { DMU_BSWAP_OLDACL, TRUE, "ZFS V0 ACL" }, 68 { DMU_BSWAP_UINT8, FALSE, "ZFS plain file" }, 69 { DMU_BSWAP_ZAP, TRUE, "ZFS directory" }, 70 { DMU_BSWAP_ZAP, TRUE, "ZFS master node" }, 71 { DMU_BSWAP_ZAP, TRUE, "ZFS delete queue" }, 72 { DMU_BSWAP_UINT8, FALSE, "zvol object" }, 73 { DMU_BSWAP_ZAP, TRUE, "zvol prop" }, 74 { DMU_BSWAP_UINT8, FALSE, "other uint8[]" }, 75 { DMU_BSWAP_UINT64, FALSE, "other uint64[]" }, 76 { DMU_BSWAP_ZAP, TRUE, "other ZAP" }, 77 { DMU_BSWAP_ZAP, TRUE, "persistent error log" }, 78 { DMU_BSWAP_UINT8, TRUE, "SPA history" }, 79 { DMU_BSWAP_UINT64, TRUE, "SPA history offsets" }, 80 { DMU_BSWAP_ZAP, TRUE, "Pool properties" }, 81 { DMU_BSWAP_ZAP, TRUE, "DSL permissions" }, 82 { DMU_BSWAP_ACL, TRUE, "ZFS ACL" }, 83 { DMU_BSWAP_UINT8, TRUE, "ZFS SYSACL" }, 84 { DMU_BSWAP_UINT8, TRUE, "FUID table" }, 85 { DMU_BSWAP_UINT64, TRUE, "FUID table size" }, 86 { DMU_BSWAP_ZAP, TRUE, "DSL dataset next clones"}, 87 { DMU_BSWAP_ZAP, TRUE, "scan work queue" }, 88 { DMU_BSWAP_ZAP, TRUE, "ZFS user/group used" }, 89 { DMU_BSWAP_ZAP, TRUE, "ZFS user/group quota" }, 90 { DMU_BSWAP_ZAP, TRUE, "snapshot refcount tags"}, 91 { DMU_BSWAP_ZAP, TRUE, "DDT ZAP algorithm" }, 92 { DMU_BSWAP_ZAP, TRUE, "DDT statistics" }, 93 { DMU_BSWAP_UINT8, TRUE, "System attributes" }, 94 { DMU_BSWAP_ZAP, TRUE, "SA master node" }, 95 { DMU_BSWAP_ZAP, TRUE, "SA attr registration" }, 96 { DMU_BSWAP_ZAP, TRUE, "SA attr layouts" }, 97 { DMU_BSWAP_ZAP, TRUE, "scan translations" }, 98 { DMU_BSWAP_UINT8, FALSE, "deduplicated block" }, 99 { DMU_BSWAP_ZAP, TRUE, "DSL deadlist map" }, 100 { DMU_BSWAP_UINT64, TRUE, "DSL deadlist map hdr" }, 101 { DMU_BSWAP_ZAP, TRUE, "DSL dir clones" }, 102 { DMU_BSWAP_UINT64, TRUE, "bpobj subobj" } |
102}; 103 | 103}; 104 |
105const dmu_object_byteswap_info_t dmu_ot_byteswap[DMU_BSWAP_NUMFUNCS] = { 106 { byteswap_uint8_array, "uint8" }, 107 { byteswap_uint16_array, "uint16" }, 108 { byteswap_uint32_array, "uint32" }, 109 { byteswap_uint64_array, "uint64" }, 110 { zap_byteswap, "zap" }, 111 { dnode_buf_byteswap, "dnode" }, 112 { dmu_objset_byteswap, "objset" }, 113 { zfs_znode_byteswap, "znode" }, 114 { zfs_oldacl_byteswap, "oldacl" }, 115 { zfs_acl_byteswap, "acl" } 116}; 117 |
|
104int 105dmu_buf_hold(objset_t *os, uint64_t object, uint64_t offset, 106 void *tag, dmu_buf_t **dbp, int flags) 107{ 108 dnode_t *dn; 109 uint64_t blkid; 110 dmu_buf_impl_t *db; 111 int err; --- 58 unchanged lines hidden (view full) --- 170{ 171 dmu_buf_impl_t *db = (dmu_buf_impl_t *)db_fake; 172 dnode_t *dn; 173 int error; 174 175 DB_DNODE_ENTER(db); 176 dn = DB_DNODE(db); 177 | 118int 119dmu_buf_hold(objset_t *os, uint64_t object, uint64_t offset, 120 void *tag, dmu_buf_t **dbp, int flags) 121{ 122 dnode_t *dn; 123 uint64_t blkid; 124 dmu_buf_impl_t *db; 125 int err; --- 58 unchanged lines hidden (view full) --- 184{ 185 dmu_buf_impl_t *db = (dmu_buf_impl_t *)db_fake; 186 dnode_t *dn; 187 int error; 188 189 DB_DNODE_ENTER(db); 190 dn = DB_DNODE(db); 191 |
178 if (type > DMU_OT_NUMTYPES) { | 192 if (!DMU_OT_IS_VALID(type)) { |
179 error = EINVAL; 180 } else if (dn->dn_bonus != db) { 181 error = EINVAL; 182 } else { 183 dnode_setbonus_type(dn, type, tx); 184 error = 0; 185 } 186 --- 1321 unchanged lines hidden (view full) --- 1508SYSCTL_DECL(_vfs_zfs); 1509SYSCTL_INT(_vfs_zfs, OID_AUTO, mdcomp_disable, CTLFLAG_RW, 1510 &zfs_mdcomp_disable, 0, "Disable metadata compression"); 1511 1512void 1513dmu_write_policy(objset_t *os, dnode_t *dn, int level, int wp, zio_prop_t *zp) 1514{ 1515 dmu_object_type_t type = dn ? dn->dn_type : DMU_OT_OBJSET; | 193 error = EINVAL; 194 } else if (dn->dn_bonus != db) { 195 error = EINVAL; 196 } else { 197 dnode_setbonus_type(dn, type, tx); 198 error = 0; 199 } 200 --- 1321 unchanged lines hidden (view full) --- 1522SYSCTL_DECL(_vfs_zfs); 1523SYSCTL_INT(_vfs_zfs, OID_AUTO, mdcomp_disable, CTLFLAG_RW, 1524 &zfs_mdcomp_disable, 0, "Disable metadata compression"); 1525 1526void 1527dmu_write_policy(objset_t *os, dnode_t *dn, int level, int wp, zio_prop_t *zp) 1528{ 1529 dmu_object_type_t type = dn ? dn->dn_type : DMU_OT_OBJSET; |
1516 boolean_t ismd = (level > 0 || dmu_ot[type].ot_metadata || | 1530 boolean_t ismd = (level > 0 || DMU_OT_IS_METADATA(type) || |
1517 (wp & WP_SPILL)); 1518 enum zio_checksum checksum = os->os_checksum; 1519 enum zio_compress compress = os->os_compress; 1520 enum zio_checksum dedup_checksum = os->os_dedup_checksum; 1521 boolean_t dedup; 1522 boolean_t dedup_verify = os->os_dedup_verify; 1523 int copies = os->os_copies; 1524 --- 250 unchanged lines hidden --- | 1531 (wp & WP_SPILL)); 1532 enum zio_checksum checksum = os->os_checksum; 1533 enum zio_compress compress = os->os_compress; 1534 enum zio_checksum dedup_checksum = os->os_dedup_checksum; 1535 boolean_t dedup; 1536 boolean_t dedup_verify = os->os_dedup_verify; 1537 int copies = os->os_copies; 1538 --- 250 unchanged lines hidden --- |