Mercurial > illumos > illumos-gate
annotate usr/src/uts/common/fs/zfs/dmu.c @ 13887:196932ec9e6a
3236 zio nop-write
Reviewed by: Matt Ahrens <matthew.ahrens@delphix.com>
Reviewed by: Adam Leventhal <ahl@delphix.com>
Reviewed by: Christopher Siden <chris.siden@delphix.com>
Approved by: Garrett D'Amore <garrett@damore.org>
author | George Wilson <george.wilson@delphix.com> |
---|---|
date | Tue, 13 Nov 2012 14:55:48 -0800 |
parents | cd512c80fd75 |
children | 7204b3392a58 |
rev | line source |
---|---|
789 | 1 /* |
2 * CDDL HEADER START | |
3 * | |
4 * The contents of this file are subject to the terms of the | |
1544 | 5 * Common Development and Distribution License (the "License"). |
6 * You may not use this file except in compliance with the License. | |
789 | 7 * |
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE | |
9 * or http://www.opensolaris.org/os/licensing. | |
10 * See the License for the specific language governing permissions | |
11 * and limitations under the License. | |
12 * | |
13 * When distributing Covered Code, include this CDDL HEADER in each | |
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. | |
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 /* | |
12123
bb40732a982e
6572591 meta dnode lookup causes bucket lock contention in dbuf hash
Tim Haley <Tim.Haley@Sun.COM>
parents:
11935
diff
changeset
|
22 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. |
13700
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12684
diff
changeset
|
23 * Copyright (c) 2012 by Delphix. All rights reserved. |
789 | 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> | |
32 #include <sys/dmu_objset.h> | |
33 #include <sys/dmu_traverse.h> | |
34 #include <sys/dsl_dataset.h> | |
35 #include <sys/dsl_dir.h> | |
36 #include <sys/dsl_pool.h> | |
2199 | 37 #include <sys/dsl_synctask.h> |
2885 | 38 #include <sys/dsl_prop.h> |
789 | 39 #include <sys/dmu_zfetch.h> |
40 #include <sys/zfs_ioctl.h> | |
41 #include <sys/zap.h> | |
1544 | 42 #include <sys/zio_checksum.h> |
13887
196932ec9e6a
3236 zio nop-write
George Wilson <george.wilson@delphix.com>
parents:
13776
diff
changeset
|
43 #include <sys/zio_compress.h> |
11935
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11670
diff
changeset
|
44 #include <sys/sa.h> |
2688
12e2ad22b970
6447701 ZFS hangs when iSCSI Target attempts to initialize its backing store
maybee
parents:
2676
diff
changeset
|
45 #ifdef _KERNEL |
12e2ad22b970
6447701 ZFS hangs when iSCSI Target attempts to initialize its backing store
maybee
parents:
2676
diff
changeset
|
46 #include <sys/vmsystm.h> |
7315
cdba25672122
6735592 "zio" vmem arenas are confusing, not reported separately
Jonathan W Adams <Jonathan.Adams@Sun.COM>
parents:
7237
diff
changeset
|
47 #include <sys/zfs_znode.h> |
2688
12e2ad22b970
6447701 ZFS hangs when iSCSI Target attempts to initialize its backing store
maybee
parents:
2676
diff
changeset
|
48 #endif |
789 | 49 |
13887
196932ec9e6a
3236 zio nop-write
George Wilson <george.wilson@delphix.com>
parents:
13776
diff
changeset
|
50 /* |
196932ec9e6a
3236 zio nop-write
George Wilson <george.wilson@delphix.com>
parents:
13776
diff
changeset
|
51 * Enable/disable nopwrite feature. |
196932ec9e6a
3236 zio nop-write
George Wilson <george.wilson@delphix.com>
parents:
13776
diff
changeset
|
52 */ |
196932ec9e6a
3236 zio nop-write
George Wilson <george.wilson@delphix.com>
parents:
13776
diff
changeset
|
53 int zfs_nopwrite_enabled = 1; |
196932ec9e6a
3236 zio nop-write
George Wilson <george.wilson@delphix.com>
parents:
13776
diff
changeset
|
54 |
789 | 55 const dmu_object_type_info_t dmu_ot[DMU_OT_NUMTYPES] = { |
13700
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12684
diff
changeset
|
56 { DMU_BSWAP_UINT8, TRUE, "unallocated" }, |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12684
diff
changeset
|
57 { DMU_BSWAP_ZAP, TRUE, "object directory" }, |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12684
diff
changeset
|
58 { DMU_BSWAP_UINT64, TRUE, "object array" }, |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12684
diff
changeset
|
59 { DMU_BSWAP_UINT8, TRUE, "packed nvlist" }, |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12684
diff
changeset
|
60 { DMU_BSWAP_UINT64, TRUE, "packed nvlist size" }, |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12684
diff
changeset
|
61 { DMU_BSWAP_UINT64, TRUE, "bpobj" }, |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12684
diff
changeset
|
62 { DMU_BSWAP_UINT64, TRUE, "bpobj header" }, |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12684
diff
changeset
|
63 { DMU_BSWAP_UINT64, TRUE, "SPA space map header" }, |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12684
diff
changeset
|
64 { DMU_BSWAP_UINT64, TRUE, "SPA space map" }, |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12684
diff
changeset
|
65 { DMU_BSWAP_UINT64, TRUE, "ZIL intent log" }, |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12684
diff
changeset
|
66 { DMU_BSWAP_DNODE, TRUE, "DMU dnode" }, |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12684
diff
changeset
|
67 { DMU_BSWAP_OBJSET, TRUE, "DMU objset" }, |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12684
diff
changeset
|
68 { DMU_BSWAP_UINT64, TRUE, "DSL directory" }, |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12684
diff
changeset
|
69 { DMU_BSWAP_ZAP, TRUE, "DSL directory child map"}, |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12684
diff
changeset
|
70 { DMU_BSWAP_ZAP, TRUE, "DSL dataset snap map" }, |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12684
diff
changeset
|
71 { DMU_BSWAP_ZAP, TRUE, "DSL props" }, |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12684
diff
changeset
|
72 { DMU_BSWAP_UINT64, TRUE, "DSL dataset" }, |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12684
diff
changeset
|
73 { DMU_BSWAP_ZNODE, TRUE, "ZFS znode" }, |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12684
diff
changeset
|
74 { DMU_BSWAP_OLDACL, TRUE, "ZFS V0 ACL" }, |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12684
diff
changeset
|
75 { DMU_BSWAP_UINT8, FALSE, "ZFS plain file" }, |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12684
diff
changeset
|
76 { DMU_BSWAP_ZAP, TRUE, "ZFS directory" }, |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12684
diff
changeset
|
77 { DMU_BSWAP_ZAP, TRUE, "ZFS master node" }, |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12684
diff
changeset
|
78 { DMU_BSWAP_ZAP, TRUE, "ZFS delete queue" }, |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12684
diff
changeset
|
79 { DMU_BSWAP_UINT8, FALSE, "zvol object" }, |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12684
diff
changeset
|
80 { DMU_BSWAP_ZAP, TRUE, "zvol prop" }, |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12684
diff
changeset
|
81 { DMU_BSWAP_UINT8, FALSE, "other uint8[]" }, |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12684
diff
changeset
|
82 { DMU_BSWAP_UINT64, FALSE, "other uint64[]" }, |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12684
diff
changeset
|
83 { DMU_BSWAP_ZAP, TRUE, "other ZAP" }, |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12684
diff
changeset
|
84 { DMU_BSWAP_ZAP, TRUE, "persistent error log" }, |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12684
diff
changeset
|
85 { DMU_BSWAP_UINT8, TRUE, "SPA history" }, |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12684
diff
changeset
|
86 { DMU_BSWAP_UINT64, TRUE, "SPA history offsets" }, |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12684
diff
changeset
|
87 { DMU_BSWAP_ZAP, TRUE, "Pool properties" }, |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12684
diff
changeset
|
88 { DMU_BSWAP_ZAP, TRUE, "DSL permissions" }, |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12684
diff
changeset
|
89 { DMU_BSWAP_ACL, TRUE, "ZFS ACL" }, |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12684
diff
changeset
|
90 { DMU_BSWAP_UINT8, TRUE, "ZFS SYSACL" }, |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12684
diff
changeset
|
91 { DMU_BSWAP_UINT8, TRUE, "FUID table" }, |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12684
diff
changeset
|
92 { DMU_BSWAP_UINT64, TRUE, "FUID table size" }, |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12684
diff
changeset
|
93 { DMU_BSWAP_ZAP, TRUE, "DSL dataset next clones"}, |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12684
diff
changeset
|
94 { DMU_BSWAP_ZAP, TRUE, "scan work queue" }, |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12684
diff
changeset
|
95 { DMU_BSWAP_ZAP, TRUE, "ZFS user/group used" }, |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12684
diff
changeset
|
96 { DMU_BSWAP_ZAP, TRUE, "ZFS user/group quota" }, |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12684
diff
changeset
|
97 { DMU_BSWAP_ZAP, TRUE, "snapshot refcount tags"}, |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12684
diff
changeset
|
98 { DMU_BSWAP_ZAP, TRUE, "DDT ZAP algorithm" }, |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12684
diff
changeset
|
99 { DMU_BSWAP_ZAP, TRUE, "DDT statistics" }, |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12684
diff
changeset
|
100 { DMU_BSWAP_UINT8, TRUE, "System attributes" }, |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12684
diff
changeset
|
101 { DMU_BSWAP_ZAP, TRUE, "SA master node" }, |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12684
diff
changeset
|
102 { DMU_BSWAP_ZAP, TRUE, "SA attr registration" }, |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12684
diff
changeset
|
103 { DMU_BSWAP_ZAP, TRUE, "SA attr layouts" }, |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12684
diff
changeset
|
104 { DMU_BSWAP_ZAP, TRUE, "scan translations" }, |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12684
diff
changeset
|
105 { DMU_BSWAP_UINT8, FALSE, "deduplicated block" }, |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12684
diff
changeset
|
106 { DMU_BSWAP_ZAP, TRUE, "DSL deadlist map" }, |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12684
diff
changeset
|
107 { DMU_BSWAP_UINT64, TRUE, "DSL deadlist map hdr" }, |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12684
diff
changeset
|
108 { DMU_BSWAP_ZAP, TRUE, "DSL dir clones" }, |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12684
diff
changeset
|
109 { DMU_BSWAP_UINT64, TRUE, "bpobj subobj" } |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12684
diff
changeset
|
110 }; |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12684
diff
changeset
|
111 |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12684
diff
changeset
|
112 const dmu_object_byteswap_info_t dmu_ot_byteswap[DMU_BSWAP_NUMFUNCS] = { |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12684
diff
changeset
|
113 { byteswap_uint8_array, "uint8" }, |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12684
diff
changeset
|
114 { byteswap_uint16_array, "uint16" }, |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12684
diff
changeset
|
115 { byteswap_uint32_array, "uint32" }, |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12684
diff
changeset
|
116 { byteswap_uint64_array, "uint64" }, |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12684
diff
changeset
|
117 { zap_byteswap, "zap" }, |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12684
diff
changeset
|
118 { dnode_buf_byteswap, "dnode" }, |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12684
diff
changeset
|
119 { dmu_objset_byteswap, "objset" }, |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12684
diff
changeset
|
120 { zfs_znode_byteswap, "znode" }, |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12684
diff
changeset
|
121 { zfs_oldacl_byteswap, "oldacl" }, |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12684
diff
changeset
|
122 { zfs_acl_byteswap, "acl" } |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12285
diff
changeset
|
123 }; |
789 | 124 |
125 int | |
1544 | 126 dmu_buf_hold(objset_t *os, uint64_t object, uint64_t offset, |
12285
d736d62dcca2
6944833 Avoid prefetching dbufs in dmu_sync() path
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
12178
diff
changeset
|
127 void *tag, dmu_buf_t **dbp, int flags) |
789 | 128 { |
129 dnode_t *dn; | |
130 uint64_t blkid; | |
131 dmu_buf_impl_t *db; | |
1544 | 132 int err; |
12285
d736d62dcca2
6944833 Avoid prefetching dbufs in dmu_sync() path
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
12178
diff
changeset
|
133 int db_flags = DB_RF_CANFAIL; |
d736d62dcca2
6944833 Avoid prefetching dbufs in dmu_sync() path
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
12178
diff
changeset
|
134 |
d736d62dcca2
6944833 Avoid prefetching dbufs in dmu_sync() path
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
12178
diff
changeset
|
135 if (flags & DMU_READ_NO_PREFETCH) |
d736d62dcca2
6944833 Avoid prefetching dbufs in dmu_sync() path
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
12178
diff
changeset
|
136 db_flags |= DB_RF_NOPREFETCH; |
789 | 137 |
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
138 err = dnode_hold(os, object, FTAG, &dn); |
1544 | 139 if (err) |
140 return (err); | |
789 | 141 blkid = dbuf_whichblock(dn, offset); |
142 rw_enter(&dn->dn_struct_rwlock, RW_READER); | |
1544 | 143 db = dbuf_hold(dn, blkid, tag); |
789 | 144 rw_exit(&dn->dn_struct_rwlock); |
1544 | 145 if (db == NULL) { |
146 err = EIO; | |
147 } else { | |
12285
d736d62dcca2
6944833 Avoid prefetching dbufs in dmu_sync() path
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
12178
diff
changeset
|
148 err = dbuf_read(db, NULL, db_flags); |
1544 | 149 if (err) { |
150 dbuf_rele(db, tag); | |
151 db = NULL; | |
152 } | |
153 } | |
154 | |
789 | 155 dnode_rele(dn, FTAG); |
12684
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
156 *dbp = &db->db; /* NULL db plus first field offset is NULL */ |
1544 | 157 return (err); |
789 | 158 } |
159 | |
160 int | |
161 dmu_bonus_max(void) | |
162 { | |
163 return (DN_MAX_BONUSLEN); | |
164 } | |
165 | |
4944
96d96f8de974
6569719 panic dangling dbufs (dn=ffffffff28814d30, dbuf=ffffffff20756008)
maybee
parents:
4543
diff
changeset
|
166 int |
12684
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
167 dmu_set_bonus(dmu_buf_t *db_fake, int newsize, dmu_tx_t *tx) |
4944
96d96f8de974
6569719 panic dangling dbufs (dn=ffffffff28814d30, dbuf=ffffffff20756008)
maybee
parents:
4543
diff
changeset
|
168 { |
12684
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
169 dmu_buf_impl_t *db = (dmu_buf_impl_t *)db_fake; |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
170 dnode_t *dn; |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
171 int error; |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
172 |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
173 DB_DNODE_ENTER(db); |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
174 dn = DB_DNODE(db); |
4944
96d96f8de974
6569719 panic dangling dbufs (dn=ffffffff28814d30, dbuf=ffffffff20756008)
maybee
parents:
4543
diff
changeset
|
175 |
12684
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
176 if (dn->dn_bonus != db) { |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
177 error = EINVAL; |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
178 } else if (newsize < 0 || newsize > db_fake->db_size) { |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
179 error = EINVAL; |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
180 } else { |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
181 dnode_setbonuslen(dn, newsize, tx); |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
182 error = 0; |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
183 } |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
184 |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
185 DB_DNODE_EXIT(db); |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
186 return (error); |
4944
96d96f8de974
6569719 panic dangling dbufs (dn=ffffffff28814d30, dbuf=ffffffff20756008)
maybee
parents:
4543
diff
changeset
|
187 } |
96d96f8de974
6569719 panic dangling dbufs (dn=ffffffff28814d30, dbuf=ffffffff20756008)
maybee
parents:
4543
diff
changeset
|
188 |
11935
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11670
diff
changeset
|
189 int |
12684
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
190 dmu_set_bonustype(dmu_buf_t *db_fake, dmu_object_type_t type, dmu_tx_t *tx) |
11935
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11670
diff
changeset
|
191 { |
12684
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
192 dmu_buf_impl_t *db = (dmu_buf_impl_t *)db_fake; |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
193 dnode_t *dn; |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
194 int error; |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
195 |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
196 DB_DNODE_ENTER(db); |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
197 dn = DB_DNODE(db); |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
198 |
13700
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12684
diff
changeset
|
199 if (!DMU_OT_IS_VALID(type)) { |
12684
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
200 error = EINVAL; |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
201 } else if (dn->dn_bonus != db) { |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
202 error = EINVAL; |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
203 } else { |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
204 dnode_setbonus_type(dn, type, tx); |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
205 error = 0; |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
206 } |
11935
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11670
diff
changeset
|
207 |
12684
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
208 DB_DNODE_EXIT(db); |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
209 return (error); |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
210 } |
11935
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11670
diff
changeset
|
211 |
12684
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
212 dmu_object_type_t |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
213 dmu_get_bonustype(dmu_buf_t *db_fake) |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
214 { |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
215 dmu_buf_impl_t *db = (dmu_buf_impl_t *)db_fake; |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
216 dnode_t *dn; |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
217 dmu_object_type_t type; |
11935
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11670
diff
changeset
|
218 |
12684
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
219 DB_DNODE_ENTER(db); |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
220 dn = DB_DNODE(db); |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
221 type = dn->dn_bonustype; |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
222 DB_DNODE_EXIT(db); |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
223 |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
224 return (type); |
11935
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11670
diff
changeset
|
225 } |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11670
diff
changeset
|
226 |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11670
diff
changeset
|
227 int |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11670
diff
changeset
|
228 dmu_rm_spill(objset_t *os, uint64_t object, dmu_tx_t *tx) |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11670
diff
changeset
|
229 { |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11670
diff
changeset
|
230 dnode_t *dn; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11670
diff
changeset
|
231 int error; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11670
diff
changeset
|
232 |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11670
diff
changeset
|
233 error = dnode_hold(os, object, FTAG, &dn); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11670
diff
changeset
|
234 dbuf_rm_spill(dn, tx); |
12178
93ec1371f750
6939983 assertion failed: zap_count(os, DMU_USERUSED_OBJECT, &count) != 0||count == 0, in dsl_dataset.c
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
12123
diff
changeset
|
235 rw_enter(&dn->dn_struct_rwlock, RW_WRITER); |
93ec1371f750
6939983 assertion failed: zap_count(os, DMU_USERUSED_OBJECT, &count) != 0||count == 0, in dsl_dataset.c
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
12123
diff
changeset
|
236 dnode_rm_spill(dn, tx); |
93ec1371f750
6939983 assertion failed: zap_count(os, DMU_USERUSED_OBJECT, &count) != 0||count == 0, in dsl_dataset.c
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
12123
diff
changeset
|
237 rw_exit(&dn->dn_struct_rwlock); |
11935
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11670
diff
changeset
|
238 dnode_rele(dn, FTAG); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11670
diff
changeset
|
239 return (error); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11670
diff
changeset
|
240 } |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11670
diff
changeset
|
241 |
789 | 242 /* |
1544 | 243 * returns ENOENT, EIO, or 0. |
789 | 244 */ |
1544 | 245 int |
246 dmu_bonus_hold(objset_t *os, uint64_t object, void *tag, dmu_buf_t **dbp) | |
789 | 247 { |
1544 | 248 dnode_t *dn; |
789 | 249 dmu_buf_impl_t *db; |
4944
96d96f8de974
6569719 panic dangling dbufs (dn=ffffffff28814d30, dbuf=ffffffff20756008)
maybee
parents:
4543
diff
changeset
|
250 int error; |
789 | 251 |
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
252 error = dnode_hold(os, object, FTAG, &dn); |
4944
96d96f8de974
6569719 panic dangling dbufs (dn=ffffffff28814d30, dbuf=ffffffff20756008)
maybee
parents:
4543
diff
changeset
|
253 if (error) |
96d96f8de974
6569719 panic dangling dbufs (dn=ffffffff28814d30, dbuf=ffffffff20756008)
maybee
parents:
4543
diff
changeset
|
254 return (error); |
789 | 255 |
1544 | 256 rw_enter(&dn->dn_struct_rwlock, RW_READER); |
257 if (dn->dn_bonus == NULL) { | |
789 | 258 rw_exit(&dn->dn_struct_rwlock); |
1544 | 259 rw_enter(&dn->dn_struct_rwlock, RW_WRITER); |
260 if (dn->dn_bonus == NULL) | |
4944
96d96f8de974
6569719 panic dangling dbufs (dn=ffffffff28814d30, dbuf=ffffffff20756008)
maybee
parents:
4543
diff
changeset
|
261 dbuf_create_bonus(dn); |
789 | 262 } |
1544 | 263 db = dn->dn_bonus; |
4944
96d96f8de974
6569719 panic dangling dbufs (dn=ffffffff28814d30, dbuf=ffffffff20756008)
maybee
parents:
4543
diff
changeset
|
264 |
96d96f8de974
6569719 panic dangling dbufs (dn=ffffffff28814d30, dbuf=ffffffff20756008)
maybee
parents:
4543
diff
changeset
|
265 /* as long as the bonus buf is held, the dnode will be held */ |
12684
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
266 if (refcount_add(&db->db_holds, tag) == 1) { |
4944
96d96f8de974
6569719 panic dangling dbufs (dn=ffffffff28814d30, dbuf=ffffffff20756008)
maybee
parents:
4543
diff
changeset
|
267 VERIFY(dnode_add_ref(dn, db)); |
12684
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
268 (void) atomic_inc_32_nv(&dn->dn_dbufs_count); |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
269 } |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
270 |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
271 /* |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
272 * Wait to drop dn_struct_rwlock until after adding the bonus dbuf's |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
273 * hold and incrementing the dbuf count to ensure that dnode_move() sees |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
274 * a dnode hold for every dbuf. |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
275 */ |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
276 rw_exit(&dn->dn_struct_rwlock); |
4944
96d96f8de974
6569719 panic dangling dbufs (dn=ffffffff28814d30, dbuf=ffffffff20756008)
maybee
parents:
4543
diff
changeset
|
277 |
789 | 278 dnode_rele(dn, FTAG); |
1544 | 279 |
12285
d736d62dcca2
6944833 Avoid prefetching dbufs in dmu_sync() path
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
12178
diff
changeset
|
280 VERIFY(0 == dbuf_read(db, NULL, DB_RF_MUST_SUCCEED | DB_RF_NOPREFETCH)); |
1544 | 281 |
282 *dbp = &db->db; | |
283 return (0); | |
789 | 284 } |
285 | |
2391 | 286 /* |
11935
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11670
diff
changeset
|
287 * returns ENOENT, EIO, or 0. |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11670
diff
changeset
|
288 * |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11670
diff
changeset
|
289 * This interface will allocate a blank spill dbuf when a spill blk |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11670
diff
changeset
|
290 * doesn't already exist on the dnode. |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11670
diff
changeset
|
291 * |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11670
diff
changeset
|
292 * if you only want to find an already existing spill db, then |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11670
diff
changeset
|
293 * dmu_spill_hold_existing() should be used. |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11670
diff
changeset
|
294 */ |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11670
diff
changeset
|
295 int |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11670
diff
changeset
|
296 dmu_spill_hold_by_dnode(dnode_t *dn, uint32_t flags, void *tag, dmu_buf_t **dbp) |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11670
diff
changeset
|
297 { |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11670
diff
changeset
|
298 dmu_buf_impl_t *db = NULL; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11670
diff
changeset
|
299 int err; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11670
diff
changeset
|
300 |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11670
diff
changeset
|
301 if ((flags & DB_RF_HAVESTRUCT) == 0) |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11670
diff
changeset
|
302 rw_enter(&dn->dn_struct_rwlock, RW_READER); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11670
diff
changeset
|
303 |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11670
diff
changeset
|
304 db = dbuf_hold(dn, DMU_SPILL_BLKID, tag); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11670
diff
changeset
|
305 |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11670
diff
changeset
|
306 if ((flags & DB_RF_HAVESTRUCT) == 0) |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11670
diff
changeset
|
307 rw_exit(&dn->dn_struct_rwlock); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11670
diff
changeset
|
308 |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11670
diff
changeset
|
309 ASSERT(db != NULL); |
12493
89ce40422cea
6952177 SA handling of on-disk corruption can be improved
Mark Shellenbaum <Mark.Shellenbaum@Oracle.COM>
parents:
12470
diff
changeset
|
310 err = dbuf_read(db, NULL, flags); |
89ce40422cea
6952177 SA handling of on-disk corruption can be improved
Mark Shellenbaum <Mark.Shellenbaum@Oracle.COM>
parents:
12470
diff
changeset
|
311 if (err == 0) |
89ce40422cea
6952177 SA handling of on-disk corruption can be improved
Mark Shellenbaum <Mark.Shellenbaum@Oracle.COM>
parents:
12470
diff
changeset
|
312 *dbp = &db->db; |
89ce40422cea
6952177 SA handling of on-disk corruption can be improved
Mark Shellenbaum <Mark.Shellenbaum@Oracle.COM>
parents:
12470
diff
changeset
|
313 else |
89ce40422cea
6952177 SA handling of on-disk corruption can be improved
Mark Shellenbaum <Mark.Shellenbaum@Oracle.COM>
parents:
12470
diff
changeset
|
314 dbuf_rele(db, tag); |
11935
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11670
diff
changeset
|
315 return (err); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11670
diff
changeset
|
316 } |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11670
diff
changeset
|
317 |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11670
diff
changeset
|
318 int |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11670
diff
changeset
|
319 dmu_spill_hold_existing(dmu_buf_t *bonus, void *tag, dmu_buf_t **dbp) |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11670
diff
changeset
|
320 { |
12684
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
321 dmu_buf_impl_t *db = (dmu_buf_impl_t *)bonus; |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
322 dnode_t *dn; |
11935
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11670
diff
changeset
|
323 int err; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11670
diff
changeset
|
324 |
12684
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
325 DB_DNODE_ENTER(db); |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
326 dn = DB_DNODE(db); |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
327 |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
328 if (spa_version(dn->dn_objset->os_spa) < SPA_VERSION_SA) { |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
329 err = EINVAL; |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
330 } else { |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
331 rw_enter(&dn->dn_struct_rwlock, RW_READER); |
11935
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11670
diff
changeset
|
332 |
12684
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
333 if (!dn->dn_have_spill) { |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
334 err = ENOENT; |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
335 } else { |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
336 err = dmu_spill_hold_by_dnode(dn, |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
337 DB_RF_HAVESTRUCT | DB_RF_CANFAIL, tag, dbp); |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
338 } |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
339 |
11935
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11670
diff
changeset
|
340 rw_exit(&dn->dn_struct_rwlock); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11670
diff
changeset
|
341 } |
12684
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
342 |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
343 DB_DNODE_EXIT(db); |
11935
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11670
diff
changeset
|
344 return (err); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11670
diff
changeset
|
345 } |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11670
diff
changeset
|
346 |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11670
diff
changeset
|
347 int |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11670
diff
changeset
|
348 dmu_spill_hold_by_bonus(dmu_buf_t *bonus, void *tag, dmu_buf_t **dbp) |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11670
diff
changeset
|
349 { |
12684
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
350 dmu_buf_impl_t *db = (dmu_buf_impl_t *)bonus; |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
351 dnode_t *dn; |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
352 int err; |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
353 |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
354 DB_DNODE_ENTER(db); |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
355 dn = DB_DNODE(db); |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
356 err = dmu_spill_hold_by_dnode(dn, DB_RF_CANFAIL, tag, dbp); |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
357 DB_DNODE_EXIT(db); |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
358 |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
359 return (err); |
11935
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11670
diff
changeset
|
360 } |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11670
diff
changeset
|
361 |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11670
diff
changeset
|
362 /* |
2391 | 363 * Note: longer-term, we should modify all of the dmu_buf_*() interfaces |
364 * to take a held dnode rather than <os, object> -- the lookup is wasteful, | |
365 * and can induce severe lock contention when writing to several files | |
366 * whose dnodes are in the same block. | |
367 */ | |
368 static int | |
9512
64cafcbcc337
6801810 Commit of aligned streaming rewrites to ZIL device causes unwanted disk reads
Neil Perrin <Neil.Perrin@Sun.COM>
parents:
9412
diff
changeset
|
369 dmu_buf_hold_array_by_dnode(dnode_t *dn, uint64_t offset, uint64_t length, |
64cafcbcc337
6801810 Commit of aligned streaming rewrites to ZIL device causes unwanted disk reads
Neil Perrin <Neil.Perrin@Sun.COM>
parents:
9412
diff
changeset
|
370 int read, void *tag, int *numbufsp, dmu_buf_t ***dbpp, uint32_t flags) |
789 | 371 { |
7468
23915842aa09
6687412 zfs stuck issuing small txg
Mark Maybee <Mark.Maybee@Sun.COM>
parents:
7385
diff
changeset
|
372 dsl_pool_t *dp = NULL; |
789 | 373 dmu_buf_t **dbp; |
374 uint64_t blkid, nblks, i; | |
9512
64cafcbcc337
6801810 Commit of aligned streaming rewrites to ZIL device causes unwanted disk reads
Neil Perrin <Neil.Perrin@Sun.COM>
parents:
9412
diff
changeset
|
375 uint32_t dbuf_flags; |
1544 | 376 int err; |
377 zio_t *zio; | |
7468
23915842aa09
6687412 zfs stuck issuing small txg
Mark Maybee <Mark.Maybee@Sun.COM>
parents:
7385
diff
changeset
|
378 hrtime_t start; |
1544 | 379 |
380 ASSERT(length <= DMU_MAX_ACCESS); | |
789 | 381 |
10209
91f47f0e7728
6830541 zfs_get_data trips on a verify
Mark J Musante <Mark.Musante@Sun.COM>
parents:
9951
diff
changeset
|
382 dbuf_flags = DB_RF_CANFAIL | DB_RF_NEVERWAIT | DB_RF_HAVESTRUCT; |
9512
64cafcbcc337
6801810 Commit of aligned streaming rewrites to ZIL device causes unwanted disk reads
Neil Perrin <Neil.Perrin@Sun.COM>
parents:
9412
diff
changeset
|
383 if (flags & DMU_READ_NO_PREFETCH || length > zfetch_array_rd_sz) |
64cafcbcc337
6801810 Commit of aligned streaming rewrites to ZIL device causes unwanted disk reads
Neil Perrin <Neil.Perrin@Sun.COM>
parents:
9412
diff
changeset
|
384 dbuf_flags |= DB_RF_NOPREFETCH; |
1544 | 385 |
789 | 386 rw_enter(&dn->dn_struct_rwlock, RW_READER); |
387 if (dn->dn_datablkshift) { | |
388 int blkshift = dn->dn_datablkshift; | |
389 nblks = (P2ROUNDUP(offset+length, 1ULL<<blkshift) - | |
3912 | 390 P2ALIGN(offset, 1ULL<<blkshift)) >> blkshift; |
789 | 391 } else { |
3713 | 392 if (offset + length > dn->dn_datablksz) { |
393 zfs_panic_recover("zfs: accessing past end of object " | |
394 "%llx/%llx (size=%u access=%llu+%llu)", | |
395 (longlong_t)dn->dn_objset-> | |
396 os_dsl_dataset->ds_object, | |
397 (longlong_t)dn->dn_object, dn->dn_datablksz, | |
398 (longlong_t)offset, (longlong_t)length); | |
10209
91f47f0e7728
6830541 zfs_get_data trips on a verify
Mark J Musante <Mark.Musante@Sun.COM>
parents:
9951
diff
changeset
|
399 rw_exit(&dn->dn_struct_rwlock); |
3713 | 400 return (EIO); |
401 } | |
789 | 402 nblks = 1; |
403 } | |
1544 | 404 dbp = kmem_zalloc(sizeof (dmu_buf_t *) * nblks, KM_SLEEP); |
789 | 405 |
7468
23915842aa09
6687412 zfs stuck issuing small txg
Mark Maybee <Mark.Maybee@Sun.COM>
parents:
7385
diff
changeset
|
406 if (dn->dn_objset->os_dsl_dataset) |
23915842aa09
6687412 zfs stuck issuing small txg
Mark Maybee <Mark.Maybee@Sun.COM>
parents:
7385
diff
changeset
|
407 dp = dn->dn_objset->os_dsl_dataset->ds_dir->dd_pool; |
23915842aa09
6687412 zfs stuck issuing small txg
Mark Maybee <Mark.Maybee@Sun.COM>
parents:
7385
diff
changeset
|
408 if (dp && dsl_pool_sync_context(dp)) |
23915842aa09
6687412 zfs stuck issuing small txg
Mark Maybee <Mark.Maybee@Sun.COM>
parents:
7385
diff
changeset
|
409 start = gethrtime(); |
7754
b80e4842ad54
6754011 SPA 3.0: lock breakup, i/o pipeline refactoring, device failure handling
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
7468
diff
changeset
|
410 zio = zio_root(dn->dn_objset->os_spa, NULL, NULL, ZIO_FLAG_CANFAIL); |
789 | 411 blkid = dbuf_whichblock(dn, offset); |
412 for (i = 0; i < nblks; i++) { | |
1544 | 413 dmu_buf_impl_t *db = dbuf_hold(dn, blkid+i, tag); |
414 if (db == NULL) { | |
415 rw_exit(&dn->dn_struct_rwlock); | |
416 dmu_buf_rele_array(dbp, nblks, tag); | |
417 zio_nowait(zio); | |
418 return (EIO); | |
419 } | |
420 /* initiate async i/o */ | |
2391 | 421 if (read) { |
9512
64cafcbcc337
6801810 Commit of aligned streaming rewrites to ZIL device causes unwanted disk reads
Neil Perrin <Neil.Perrin@Sun.COM>
parents:
9412
diff
changeset
|
422 (void) dbuf_read(db, zio, dbuf_flags); |
1544 | 423 } |
424 dbp[i] = &db->db; | |
789 | 425 } |
426 rw_exit(&dn->dn_struct_rwlock); | |
427 | |
1544 | 428 /* wait for async i/o */ |
429 err = zio_wait(zio); | |
7468
23915842aa09
6687412 zfs stuck issuing small txg
Mark Maybee <Mark.Maybee@Sun.COM>
parents:
7385
diff
changeset
|
430 /* track read overhead when we are in sync context */ |
23915842aa09
6687412 zfs stuck issuing small txg
Mark Maybee <Mark.Maybee@Sun.COM>
parents:
7385
diff
changeset
|
431 if (dp && dsl_pool_sync_context(dp)) |
23915842aa09
6687412 zfs stuck issuing small txg
Mark Maybee <Mark.Maybee@Sun.COM>
parents:
7385
diff
changeset
|
432 dp->dp_read_overhead += gethrtime() - start; |
1544 | 433 if (err) { |
434 dmu_buf_rele_array(dbp, nblks, tag); | |
435 return (err); | |
789 | 436 } |
437 | |
1544 | 438 /* wait for other io to complete */ |
439 if (read) { | |
440 for (i = 0; i < nblks; i++) { | |
441 dmu_buf_impl_t *db = (dmu_buf_impl_t *)dbp[i]; | |
442 mutex_enter(&db->db_mtx); | |
443 while (db->db_state == DB_READ || | |
444 db->db_state == DB_FILL) | |
445 cv_wait(&db->db_changed, &db->db_mtx); | |
446 if (db->db_state == DB_UNCACHED) | |
447 err = EIO; | |
448 mutex_exit(&db->db_mtx); | |
449 if (err) { | |
450 dmu_buf_rele_array(dbp, nblks, tag); | |
451 return (err); | |
452 } | |
453 } | |
454 } | |
789 | 455 |
1544 | 456 *numbufsp = nblks; |
457 *dbpp = dbp; | |
458 return (0); | |
789 | 459 } |
460 | |
2885 | 461 static int |
2391 | 462 dmu_buf_hold_array(objset_t *os, uint64_t object, uint64_t offset, |
463 uint64_t length, int read, void *tag, int *numbufsp, dmu_buf_t ***dbpp) | |
464 { | |
465 dnode_t *dn; | |
466 int err; | |
467 | |
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
468 err = dnode_hold(os, object, FTAG, &dn); |
2391 | 469 if (err) |
470 return (err); | |
471 | |
472 err = dmu_buf_hold_array_by_dnode(dn, offset, length, read, tag, | |
9512
64cafcbcc337
6801810 Commit of aligned streaming rewrites to ZIL device causes unwanted disk reads
Neil Perrin <Neil.Perrin@Sun.COM>
parents:
9412
diff
changeset
|
473 numbufsp, dbpp, DMU_READ_PREFETCH); |
2391 | 474 |
475 dnode_rele(dn, FTAG); | |
476 | |
477 return (err); | |
478 } | |
479 | |
480 int | |
12684
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
481 dmu_buf_hold_array_by_bonus(dmu_buf_t *db_fake, uint64_t offset, |
2391 | 482 uint64_t length, int read, void *tag, int *numbufsp, dmu_buf_t ***dbpp) |
483 { | |
12684
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
484 dmu_buf_impl_t *db = (dmu_buf_impl_t *)db_fake; |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
485 dnode_t *dn; |
2391 | 486 int err; |
487 | |
12684
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
488 DB_DNODE_ENTER(db); |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
489 dn = DB_DNODE(db); |
2391 | 490 err = dmu_buf_hold_array_by_dnode(dn, offset, length, read, tag, |
9512
64cafcbcc337
6801810 Commit of aligned streaming rewrites to ZIL device causes unwanted disk reads
Neil Perrin <Neil.Perrin@Sun.COM>
parents:
9412
diff
changeset
|
491 numbufsp, dbpp, DMU_READ_PREFETCH); |
12684
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
492 DB_DNODE_EXIT(db); |
2391 | 493 |
494 return (err); | |
495 } | |
496 | |
789 | 497 void |
1544 | 498 dmu_buf_rele_array(dmu_buf_t **dbp_fake, int numbufs, void *tag) |
789 | 499 { |
500 int i; | |
501 dmu_buf_impl_t **dbp = (dmu_buf_impl_t **)dbp_fake; | |
502 | |
503 if (numbufs == 0) | |
504 return; | |
505 | |
1544 | 506 for (i = 0; i < numbufs; i++) { |
507 if (dbp[i]) | |
508 dbuf_rele(dbp[i], tag); | |
509 } | |
789 | 510 |
511 kmem_free(dbp, sizeof (dmu_buf_t *) * numbufs); | |
512 } | |
513 | |
514 void | |
515 dmu_prefetch(objset_t *os, uint64_t object, uint64_t offset, uint64_t len) | |
516 { | |
517 dnode_t *dn; | |
518 uint64_t blkid; | |
1544 | 519 int nblks, i, err; |
789 | 520 |
2986 | 521 if (zfs_prefetch_disable) |
522 return; | |
523 | |
789 | 524 if (len == 0) { /* they're interested in the bonus buffer */ |
12684
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
525 dn = DMU_META_DNODE(os); |
789 | 526 |
527 if (object == 0 || object >= DN_MAX_OBJECT) | |
528 return; | |
529 | |
530 rw_enter(&dn->dn_struct_rwlock, RW_READER); | |
531 blkid = dbuf_whichblock(dn, object * sizeof (dnode_phys_t)); | |
532 dbuf_prefetch(dn, blkid); | |
533 rw_exit(&dn->dn_struct_rwlock); | |
534 return; | |
535 } | |
536 | |
537 /* | |
538 * XXX - Note, if the dnode for the requested object is not | |
539 * already cached, we will do a *synchronous* read in the | |
540 * dnode_hold() call. The same is true for any indirects. | |
541 */ | |
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
542 err = dnode_hold(os, object, FTAG, &dn); |
1544 | 543 if (err != 0) |
789 | 544 return; |
545 | |
546 rw_enter(&dn->dn_struct_rwlock, RW_READER); | |
547 if (dn->dn_datablkshift) { | |
548 int blkshift = dn->dn_datablkshift; | |
549 nblks = (P2ROUNDUP(offset+len, 1<<blkshift) - | |
3912 | 550 P2ALIGN(offset, 1<<blkshift)) >> blkshift; |
789 | 551 } else { |
552 nblks = (offset < dn->dn_datablksz); | |
553 } | |
554 | |
555 if (nblks != 0) { | |
556 blkid = dbuf_whichblock(dn, offset); | |
557 for (i = 0; i < nblks; i++) | |
558 dbuf_prefetch(dn, blkid+i); | |
559 } | |
560 | |
561 rw_exit(&dn->dn_struct_rwlock); | |
562 | |
563 dnode_rele(dn, FTAG); | |
564 } | |
565 | |
9950
78fc41aa9bc5
6792701 Removing large holey file does not free space
Mark Maybee <Mark.Maybee@Sun.COM>
parents:
9512
diff
changeset
|
566 /* |
78fc41aa9bc5
6792701 Removing large holey file does not free space
Mark Maybee <Mark.Maybee@Sun.COM>
parents:
9512
diff
changeset
|
567 * Get the next "chunk" of file data to free. We traverse the file from |
78fc41aa9bc5
6792701 Removing large holey file does not free space
Mark Maybee <Mark.Maybee@Sun.COM>
parents:
9512
diff
changeset
|
568 * the end so that the file gets shorter over time (if we crashes in the |
78fc41aa9bc5
6792701 Removing large holey file does not free space
Mark Maybee <Mark.Maybee@Sun.COM>
parents:
9512
diff
changeset
|
569 * middle, this will leave us in a better state). We find allocated file |
78fc41aa9bc5
6792701 Removing large holey file does not free space
Mark Maybee <Mark.Maybee@Sun.COM>
parents:
9512
diff
changeset
|
570 * data by simply searching the allocated level 1 indirects. |
78fc41aa9bc5
6792701 Removing large holey file does not free space
Mark Maybee <Mark.Maybee@Sun.COM>
parents:
9512
diff
changeset
|
571 */ |
6992 | 572 static int |
9950
78fc41aa9bc5
6792701 Removing large holey file does not free space
Mark Maybee <Mark.Maybee@Sun.COM>
parents:
9512
diff
changeset
|
573 get_next_chunk(dnode_t *dn, uint64_t *start, uint64_t limit) |
6992 | 574 { |
9950
78fc41aa9bc5
6792701 Removing large holey file does not free space
Mark Maybee <Mark.Maybee@Sun.COM>
parents:
9512
diff
changeset
|
575 uint64_t len = *start - limit; |
78fc41aa9bc5
6792701 Removing large holey file does not free space
Mark Maybee <Mark.Maybee@Sun.COM>
parents:
9512
diff
changeset
|
576 uint64_t blkcnt = 0; |
78fc41aa9bc5
6792701 Removing large holey file does not free space
Mark Maybee <Mark.Maybee@Sun.COM>
parents:
9512
diff
changeset
|
577 uint64_t maxblks = DMU_MAX_ACCESS / (1ULL << (dn->dn_indblkshift + 1)); |
78fc41aa9bc5
6792701 Removing large holey file does not free space
Mark Maybee <Mark.Maybee@Sun.COM>
parents:
9512
diff
changeset
|
578 uint64_t iblkrange = |
7385
f69ff8507427
6727817 ZFS assertion failure (zero length arc_buf_alloc) during NFS I/O
Mark Maybee <Mark.Maybee@Sun.COM>
parents:
7315
diff
changeset
|
579 dn->dn_datablksz * EPB(dn->dn_indblkshift, SPA_BLKPTRSHIFT); |
6992 | 580 |
9950
78fc41aa9bc5
6792701 Removing large holey file does not free space
Mark Maybee <Mark.Maybee@Sun.COM>
parents:
9512
diff
changeset
|
581 ASSERT(limit <= *start); |
6992 | 582 |
9950
78fc41aa9bc5
6792701 Removing large holey file does not free space
Mark Maybee <Mark.Maybee@Sun.COM>
parents:
9512
diff
changeset
|
583 if (len <= iblkrange * maxblks) { |
78fc41aa9bc5
6792701 Removing large holey file does not free space
Mark Maybee <Mark.Maybee@Sun.COM>
parents:
9512
diff
changeset
|
584 *start = limit; |
6992 | 585 return (0); |
586 } | |
9950
78fc41aa9bc5
6792701 Removing large holey file does not free space
Mark Maybee <Mark.Maybee@Sun.COM>
parents:
9512
diff
changeset
|
587 ASSERT(ISP2(iblkrange)); |
7385
f69ff8507427
6727817 ZFS assertion failure (zero length arc_buf_alloc) during NFS I/O
Mark Maybee <Mark.Maybee@Sun.COM>
parents:
7315
diff
changeset
|
588 |
9950
78fc41aa9bc5
6792701 Removing large holey file does not free space
Mark Maybee <Mark.Maybee@Sun.COM>
parents:
9512
diff
changeset
|
589 while (*start > limit && blkcnt < maxblks) { |
7385
f69ff8507427
6727817 ZFS assertion failure (zero length arc_buf_alloc) during NFS I/O
Mark Maybee <Mark.Maybee@Sun.COM>
parents:
7315
diff
changeset
|
590 int err; |
6992 | 591 |
9950
78fc41aa9bc5
6792701 Removing large holey file does not free space
Mark Maybee <Mark.Maybee@Sun.COM>
parents:
9512
diff
changeset
|
592 /* find next allocated L1 indirect */ |
6992 | 593 err = dnode_next_offset(dn, |
9950
78fc41aa9bc5
6792701 Removing large holey file does not free space
Mark Maybee <Mark.Maybee@Sun.COM>
parents:
9512
diff
changeset
|
594 DNODE_FIND_BACKWARDS, start, 2, 1, 0); |
6992 | 595 |
9950
78fc41aa9bc5
6792701 Removing large holey file does not free space
Mark Maybee <Mark.Maybee@Sun.COM>
parents:
9512
diff
changeset
|
596 /* if there are no more, then we are done */ |
78fc41aa9bc5
6792701 Removing large holey file does not free space
Mark Maybee <Mark.Maybee@Sun.COM>
parents:
9512
diff
changeset
|
597 if (err == ESRCH) { |
78fc41aa9bc5
6792701 Removing large holey file does not free space
Mark Maybee <Mark.Maybee@Sun.COM>
parents:
9512
diff
changeset
|
598 *start = limit; |
6992 | 599 return (0); |
9950
78fc41aa9bc5
6792701 Removing large holey file does not free space
Mark Maybee <Mark.Maybee@Sun.COM>
parents:
9512
diff
changeset
|
600 } else if (err) { |
78fc41aa9bc5
6792701 Removing large holey file does not free space
Mark Maybee <Mark.Maybee@Sun.COM>
parents:
9512
diff
changeset
|
601 return (err); |
6992 | 602 } |
9950
78fc41aa9bc5
6792701 Removing large holey file does not free space
Mark Maybee <Mark.Maybee@Sun.COM>
parents:
9512
diff
changeset
|
603 blkcnt += 1; |
6992 | 604 |
9950
78fc41aa9bc5
6792701 Removing large holey file does not free space
Mark Maybee <Mark.Maybee@Sun.COM>
parents:
9512
diff
changeset
|
605 /* reset offset to end of "next" block back */ |
78fc41aa9bc5
6792701 Removing large holey file does not free space
Mark Maybee <Mark.Maybee@Sun.COM>
parents:
9512
diff
changeset
|
606 *start = P2ALIGN(*start, iblkrange); |
78fc41aa9bc5
6792701 Removing large holey file does not free space
Mark Maybee <Mark.Maybee@Sun.COM>
parents:
9512
diff
changeset
|
607 if (*start <= limit) |
78fc41aa9bc5
6792701 Removing large holey file does not free space
Mark Maybee <Mark.Maybee@Sun.COM>
parents:
9512
diff
changeset
|
608 *start = limit; |
78fc41aa9bc5
6792701 Removing large holey file does not free space
Mark Maybee <Mark.Maybee@Sun.COM>
parents:
9512
diff
changeset
|
609 else |
78fc41aa9bc5
6792701 Removing large holey file does not free space
Mark Maybee <Mark.Maybee@Sun.COM>
parents:
9512
diff
changeset
|
610 *start -= 1; |
6992 | 611 } |
612 return (0); | |
613 } | |
614 | |
615 static int | |
616 dmu_free_long_range_impl(objset_t *os, dnode_t *dn, uint64_t offset, | |
617 uint64_t length, boolean_t free_dnode) | |
618 { | |
619 dmu_tx_t *tx; | |
620 uint64_t object_size, start, end, len; | |
621 boolean_t trunc = (length == DMU_OBJECT_END); | |
622 int align, err; | |
623 | |
624 align = 1 << dn->dn_datablkshift; | |
625 ASSERT(align > 0); | |
626 object_size = align == 1 ? dn->dn_datablksz : | |
627 (dn->dn_maxblkid + 1) << dn->dn_datablkshift; | |
628 | |
9396
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7872
diff
changeset
|
629 end = offset + length; |
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7872
diff
changeset
|
630 if (trunc || end > object_size) |
6992 | 631 end = object_size; |
632 if (end <= offset) | |
633 return (0); | |
634 length = end - offset; | |
635 | |
636 while (length) { | |
637 start = end; | |
9396
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7872
diff
changeset
|
638 /* assert(offset <= start) */ |
6992 | 639 err = get_next_chunk(dn, &start, offset); |
640 if (err) | |
641 return (err); | |
642 len = trunc ? DMU_OBJECT_END : end - start; | |
643 | |
644 tx = dmu_tx_create(os); | |
645 dmu_tx_hold_free(tx, dn->dn_object, start, len); | |
646 err = dmu_tx_assign(tx, TXG_WAIT); | |
647 if (err) { | |
648 dmu_tx_abort(tx); | |
649 return (err); | |
650 } | |
651 | |
652 dnode_free_range(dn, start, trunc ? -1 : len, tx); | |
653 | |
7385
f69ff8507427
6727817 ZFS assertion failure (zero length arc_buf_alloc) during NFS I/O
Mark Maybee <Mark.Maybee@Sun.COM>
parents:
7315
diff
changeset
|
654 if (start == 0 && free_dnode) { |
f69ff8507427
6727817 ZFS assertion failure (zero length arc_buf_alloc) during NFS I/O
Mark Maybee <Mark.Maybee@Sun.COM>
parents:
7315
diff
changeset
|
655 ASSERT(trunc); |
6992 | 656 dnode_free(dn, tx); |
7385
f69ff8507427
6727817 ZFS assertion failure (zero length arc_buf_alloc) during NFS I/O
Mark Maybee <Mark.Maybee@Sun.COM>
parents:
7315
diff
changeset
|
657 } |
6992 | 658 |
659 length -= end - start; | |
660 | |
661 dmu_tx_commit(tx); | |
662 end = start; | |
663 } | |
664 return (0); | |
665 } | |
666 | |
667 int | |
668 dmu_free_long_range(objset_t *os, uint64_t object, | |
669 uint64_t offset, uint64_t length) | |
670 { | |
671 dnode_t *dn; | |
672 int err; | |
673 | |
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
674 err = dnode_hold(os, object, FTAG, &dn); |
6992 | 675 if (err != 0) |
676 return (err); | |
677 err = dmu_free_long_range_impl(os, dn, offset, length, FALSE); | |
678 dnode_rele(dn, FTAG); | |
679 return (err); | |
680 } | |
681 | |
682 int | |
683 dmu_free_object(objset_t *os, uint64_t object) | |
684 { | |
685 dnode_t *dn; | |
686 dmu_tx_t *tx; | |
687 int err; | |
688 | |
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
689 err = dnode_hold_impl(os, object, DNODE_MUST_BE_ALLOCATED, |
6992 | 690 FTAG, &dn); |
691 if (err != 0) | |
692 return (err); | |
693 if (dn->dn_nlevels == 1) { | |
694 tx = dmu_tx_create(os); | |
695 dmu_tx_hold_bonus(tx, object); | |
696 dmu_tx_hold_free(tx, dn->dn_object, 0, DMU_OBJECT_END); | |
697 err = dmu_tx_assign(tx, TXG_WAIT); | |
698 if (err == 0) { | |
699 dnode_free_range(dn, 0, DMU_OBJECT_END, tx); | |
700 dnode_free(dn, tx); | |
701 dmu_tx_commit(tx); | |
702 } else { | |
703 dmu_tx_abort(tx); | |
704 } | |
705 } else { | |
706 err = dmu_free_long_range_impl(os, dn, 0, DMU_OBJECT_END, TRUE); | |
707 } | |
708 dnode_rele(dn, FTAG); | |
709 return (err); | |
710 } | |
711 | |
1544 | 712 int |
789 | 713 dmu_free_range(objset_t *os, uint64_t object, uint64_t offset, |
714 uint64_t size, dmu_tx_t *tx) | |
715 { | |
1544 | 716 dnode_t *dn; |
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
717 int err = dnode_hold(os, object, FTAG, &dn); |
1544 | 718 if (err) |
719 return (err); | |
789 | 720 ASSERT(offset < UINT64_MAX); |
721 ASSERT(size == -1ULL || size <= UINT64_MAX - offset); | |
722 dnode_free_range(dn, offset, size, tx); | |
723 dnode_rele(dn, FTAG); | |
1544 | 724 return (0); |
789 | 725 } |
726 | |
1544 | 727 int |
728 dmu_read(objset_t *os, uint64_t object, uint64_t offset, uint64_t size, | |
9512
64cafcbcc337
6801810 Commit of aligned streaming rewrites to ZIL device causes unwanted disk reads
Neil Perrin <Neil.Perrin@Sun.COM>
parents:
9412
diff
changeset
|
729 void *buf, uint32_t flags) |
789 | 730 { |
731 dnode_t *dn; | |
732 dmu_buf_t **dbp; | |
10209
91f47f0e7728
6830541 zfs_get_data trips on a verify
Mark J Musante <Mark.Musante@Sun.COM>
parents:
9951
diff
changeset
|
733 int numbufs, err; |
789 | 734 |
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
735 err = dnode_hold(os, object, FTAG, &dn); |
1544 | 736 if (err) |
737 return (err); | |
3638
6b28ebc717aa
6496357 spec_fsync() is useless on devices that do write caching
billm
parents:
3547
diff
changeset
|
738 |
6b28ebc717aa
6496357 spec_fsync() is useless on devices that do write caching
billm
parents:
3547
diff
changeset
|
739 /* |
6b28ebc717aa
6496357 spec_fsync() is useless on devices that do write caching
billm
parents:
3547
diff
changeset
|
740 * Deal with odd block sizes, where there can't be data past the first |
6b28ebc717aa
6496357 spec_fsync() is useless on devices that do write caching
billm
parents:
3547
diff
changeset
|
741 * block. If we ever do the tail block optimization, we will need to |
6b28ebc717aa
6496357 spec_fsync() is useless on devices that do write caching
billm
parents:
3547
diff
changeset
|
742 * handle that here as well. |
6b28ebc717aa
6496357 spec_fsync() is useless on devices that do write caching
billm
parents:
3547
diff
changeset
|
743 */ |
10209
91f47f0e7728
6830541 zfs_get_data trips on a verify
Mark J Musante <Mark.Musante@Sun.COM>
parents:
9951
diff
changeset
|
744 if (dn->dn_maxblkid == 0) { |
789 | 745 int newsz = offset > dn->dn_datablksz ? 0 : |
746 MIN(size, dn->dn_datablksz - offset); | |
747 bzero((char *)buf + newsz, size - newsz); | |
748 size = newsz; | |
749 } | |
750 | |
751 while (size > 0) { | |
752 uint64_t mylen = MIN(size, DMU_MAX_ACCESS / 2); | |
10209
91f47f0e7728
6830541 zfs_get_data trips on a verify
Mark J Musante <Mark.Musante@Sun.COM>
parents:
9951
diff
changeset
|
753 int i; |
789 | 754 |
755 /* | |
756 * NB: we could do this block-at-a-time, but it's nice | |
757 * to be reading in parallel. | |
758 */ | |
2885 | 759 err = dmu_buf_hold_array_by_dnode(dn, offset, mylen, |
9512
64cafcbcc337
6801810 Commit of aligned streaming rewrites to ZIL device causes unwanted disk reads
Neil Perrin <Neil.Perrin@Sun.COM>
parents:
9412
diff
changeset
|
760 TRUE, FTAG, &numbufs, &dbp, flags); |
1544 | 761 if (err) |
4944
96d96f8de974
6569719 panic dangling dbufs (dn=ffffffff28814d30, dbuf=ffffffff20756008)
maybee
parents:
4543
diff
changeset
|
762 break; |
789 | 763 |
764 for (i = 0; i < numbufs; i++) { | |
765 int tocpy; | |
766 int bufoff; | |
767 dmu_buf_t *db = dbp[i]; | |
768 | |
769 ASSERT(size > 0); | |
770 | |
771 bufoff = offset - db->db_offset; | |
772 tocpy = (int)MIN(db->db_size - bufoff, size); | |
773 | |
774 bcopy((char *)db->db_data + bufoff, buf, tocpy); | |
775 | |
776 offset += tocpy; | |
777 size -= tocpy; | |
778 buf = (char *)buf + tocpy; | |
779 } | |
1544 | 780 dmu_buf_rele_array(dbp, numbufs, FTAG); |
789 | 781 } |
2885 | 782 dnode_rele(dn, FTAG); |
4944
96d96f8de974
6569719 panic dangling dbufs (dn=ffffffff28814d30, dbuf=ffffffff20756008)
maybee
parents:
4543
diff
changeset
|
783 return (err); |
789 | 784 } |
785 | |
786 void | |
787 dmu_write(objset_t *os, uint64_t object, uint64_t offset, uint64_t size, | |
788 const void *buf, dmu_tx_t *tx) | |
789 { | |
790 dmu_buf_t **dbp; | |
791 int numbufs, i; | |
792 | |
2391 | 793 if (size == 0) |
794 return; | |
795 | |
1544 | 796 VERIFY(0 == dmu_buf_hold_array(os, object, offset, size, |
797 FALSE, FTAG, &numbufs, &dbp)); | |
789 | 798 |
799 for (i = 0; i < numbufs; i++) { | |
800 int tocpy; | |
801 int bufoff; | |
802 dmu_buf_t *db = dbp[i]; | |
803 | |
804 ASSERT(size > 0); | |
805 | |
806 bufoff = offset - db->db_offset; | |
807 tocpy = (int)MIN(db->db_size - bufoff, size); | |
808 | |
809 ASSERT(i == 0 || i == numbufs-1 || tocpy == db->db_size); | |
810 | |
811 if (tocpy == db->db_size) | |
812 dmu_buf_will_fill(db, tx); | |
813 else | |
814 dmu_buf_will_dirty(db, tx); | |
815 | |
816 bcopy(buf, (char *)db->db_data + bufoff, tocpy); | |
817 | |
818 if (tocpy == db->db_size) | |
819 dmu_buf_fill_done(db, tx); | |
820 | |
821 offset += tocpy; | |
822 size -= tocpy; | |
823 buf = (char *)buf + tocpy; | |
824 } | |
1544 | 825 dmu_buf_rele_array(dbp, numbufs, FTAG); |
789 | 826 } |
827 | |
7872
40a9434212f6
6646775 Speed up the dumpifying process for zvols
Tim Haley <Tim.Haley@Sun.COM>
parents:
7754
diff
changeset
|
828 void |
40a9434212f6
6646775 Speed up the dumpifying process for zvols
Tim Haley <Tim.Haley@Sun.COM>
parents:
7754
diff
changeset
|
829 dmu_prealloc(objset_t *os, uint64_t object, uint64_t offset, uint64_t size, |
40a9434212f6
6646775 Speed up the dumpifying process for zvols
Tim Haley <Tim.Haley@Sun.COM>
parents:
7754
diff
changeset
|
830 dmu_tx_t *tx) |
40a9434212f6
6646775 Speed up the dumpifying process for zvols
Tim Haley <Tim.Haley@Sun.COM>
parents:
7754
diff
changeset
|
831 { |
40a9434212f6
6646775 Speed up the dumpifying process for zvols
Tim Haley <Tim.Haley@Sun.COM>
parents:
7754
diff
changeset
|
832 dmu_buf_t **dbp; |
40a9434212f6
6646775 Speed up the dumpifying process for zvols
Tim Haley <Tim.Haley@Sun.COM>
parents:
7754
diff
changeset
|
833 int numbufs, i; |
40a9434212f6
6646775 Speed up the dumpifying process for zvols
Tim Haley <Tim.Haley@Sun.COM>
parents:
7754
diff
changeset
|
834 |
40a9434212f6
6646775 Speed up the dumpifying process for zvols
Tim Haley <Tim.Haley@Sun.COM>
parents:
7754
diff
changeset
|
835 if (size == 0) |
40a9434212f6
6646775 Speed up the dumpifying process for zvols
Tim Haley <Tim.Haley@Sun.COM>
parents:
7754
diff
changeset
|
836 return; |
40a9434212f6
6646775 Speed up the dumpifying process for zvols
Tim Haley <Tim.Haley@Sun.COM>
parents:
7754
diff
changeset
|
837 |
40a9434212f6
6646775 Speed up the dumpifying process for zvols
Tim Haley <Tim.Haley@Sun.COM>
parents:
7754
diff
changeset
|
838 VERIFY(0 == dmu_buf_hold_array(os, object, offset, size, |
40a9434212f6
6646775 Speed up the dumpifying process for zvols
Tim Haley <Tim.Haley@Sun.COM>
parents:
7754
diff
changeset
|
839 FALSE, FTAG, &numbufs, &dbp)); |
40a9434212f6
6646775 Speed up the dumpifying process for zvols
Tim Haley <Tim.Haley@Sun.COM>
parents:
7754
diff
changeset
|
840 |
40a9434212f6
6646775 Speed up the dumpifying process for zvols
Tim Haley <Tim.Haley@Sun.COM>
parents:
7754
diff
changeset
|
841 for (i = 0; i < numbufs; i++) { |
40a9434212f6
6646775 Speed up the dumpifying process for zvols
Tim Haley <Tim.Haley@Sun.COM>
parents:
7754
diff
changeset
|
842 dmu_buf_t *db = dbp[i]; |
40a9434212f6
6646775 Speed up the dumpifying process for zvols
Tim Haley <Tim.Haley@Sun.COM>
parents:
7754
diff
changeset
|
843 |
40a9434212f6
6646775 Speed up the dumpifying process for zvols
Tim Haley <Tim.Haley@Sun.COM>
parents:
7754
diff
changeset
|
844 dmu_buf_will_not_fill(db, tx); |
40a9434212f6
6646775 Speed up the dumpifying process for zvols
Tim Haley <Tim.Haley@Sun.COM>
parents:
7754
diff
changeset
|
845 } |
40a9434212f6
6646775 Speed up the dumpifying process for zvols
Tim Haley <Tim.Haley@Sun.COM>
parents:
7754
diff
changeset
|
846 dmu_buf_rele_array(dbp, numbufs, FTAG); |
40a9434212f6
6646775 Speed up the dumpifying process for zvols
Tim Haley <Tim.Haley@Sun.COM>
parents:
7754
diff
changeset
|
847 } |
40a9434212f6
6646775 Speed up the dumpifying process for zvols
Tim Haley <Tim.Haley@Sun.COM>
parents:
7754
diff
changeset
|
848 |
11539
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
849 /* |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
850 * DMU support for xuio |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
851 */ |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
852 kstat_t *xuio_ksp = NULL; |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
853 |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
854 int |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
855 dmu_xuio_init(xuio_t *xuio, int nblk) |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
856 { |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
857 dmu_xuio_t *priv; |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
858 uio_t *uio = &xuio->xu_uio; |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
859 |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
860 uio->uio_iovcnt = nblk; |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
861 uio->uio_iov = kmem_zalloc(nblk * sizeof (iovec_t), KM_SLEEP); |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
862 |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
863 priv = kmem_zalloc(sizeof (dmu_xuio_t), KM_SLEEP); |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
864 priv->cnt = nblk; |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
865 priv->bufs = kmem_zalloc(nblk * sizeof (arc_buf_t *), KM_SLEEP); |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
866 priv->iovp = uio->uio_iov; |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
867 XUIO_XUZC_PRIV(xuio) = priv; |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
868 |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
869 if (XUIO_XUZC_RW(xuio) == UIO_READ) |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
870 XUIOSTAT_INCR(xuiostat_onloan_rbuf, nblk); |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
871 else |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
872 XUIOSTAT_INCR(xuiostat_onloan_wbuf, nblk); |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
873 |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
874 return (0); |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
875 } |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
876 |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
877 void |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
878 dmu_xuio_fini(xuio_t *xuio) |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
879 { |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
880 dmu_xuio_t *priv = XUIO_XUZC_PRIV(xuio); |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
881 int nblk = priv->cnt; |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
882 |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
883 kmem_free(priv->iovp, nblk * sizeof (iovec_t)); |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
884 kmem_free(priv->bufs, nblk * sizeof (arc_buf_t *)); |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
885 kmem_free(priv, sizeof (dmu_xuio_t)); |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
886 |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
887 if (XUIO_XUZC_RW(xuio) == UIO_READ) |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
888 XUIOSTAT_INCR(xuiostat_onloan_rbuf, -nblk); |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
889 else |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
890 XUIOSTAT_INCR(xuiostat_onloan_wbuf, -nblk); |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
891 } |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
892 |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
893 /* |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
894 * Initialize iov[priv->next] and priv->bufs[priv->next] with { off, n, abuf } |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
895 * and increase priv->next by 1. |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
896 */ |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
897 int |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
898 dmu_xuio_add(xuio_t *xuio, arc_buf_t *abuf, offset_t off, size_t n) |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
899 { |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
900 struct iovec *iov; |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
901 uio_t *uio = &xuio->xu_uio; |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
902 dmu_xuio_t *priv = XUIO_XUZC_PRIV(xuio); |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
903 int i = priv->next++; |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
904 |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
905 ASSERT(i < priv->cnt); |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
906 ASSERT(off + n <= arc_buf_size(abuf)); |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
907 iov = uio->uio_iov + i; |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
908 iov->iov_base = (char *)abuf->b_data + off; |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
909 iov->iov_len = n; |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
910 priv->bufs[i] = abuf; |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
911 return (0); |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
912 } |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
913 |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
914 int |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
915 dmu_xuio_cnt(xuio_t *xuio) |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
916 { |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
917 dmu_xuio_t *priv = XUIO_XUZC_PRIV(xuio); |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
918 return (priv->cnt); |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
919 } |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
920 |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
921 arc_buf_t * |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
922 dmu_xuio_arcbuf(xuio_t *xuio, int i) |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
923 { |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
924 dmu_xuio_t *priv = XUIO_XUZC_PRIV(xuio); |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
925 |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
926 ASSERT(i < priv->cnt); |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
927 return (priv->bufs[i]); |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
928 } |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
929 |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
930 void |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
931 dmu_xuio_clear(xuio_t *xuio, int i) |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
932 { |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
933 dmu_xuio_t *priv = XUIO_XUZC_PRIV(xuio); |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
934 |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
935 ASSERT(i < priv->cnt); |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
936 priv->bufs[i] = NULL; |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
937 } |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
938 |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
939 static void |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
940 xuio_stat_init(void) |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
941 { |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
942 xuio_ksp = kstat_create("zfs", 0, "xuio_stats", "misc", |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
943 KSTAT_TYPE_NAMED, sizeof (xuio_stats) / sizeof (kstat_named_t), |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
944 KSTAT_FLAG_VIRTUAL); |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
945 if (xuio_ksp != NULL) { |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
946 xuio_ksp->ks_data = &xuio_stats; |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
947 kstat_install(xuio_ksp); |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
948 } |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
949 } |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
950 |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
951 static void |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
952 xuio_stat_fini(void) |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
953 { |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
954 if (xuio_ksp != NULL) { |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
955 kstat_delete(xuio_ksp); |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
956 xuio_ksp = NULL; |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
957 } |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
958 } |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
959 |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
960 void |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
961 xuio_stat_wbuf_copied() |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
962 { |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
963 XUIOSTAT_BUMP(xuiostat_wbuf_copied); |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
964 } |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
965 |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
966 void |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
967 xuio_stat_wbuf_nocopy() |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
968 { |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
969 XUIOSTAT_BUMP(xuiostat_wbuf_nocopy); |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
970 } |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
971 |
789 | 972 #ifdef _KERNEL |
973 int | |
3638
6b28ebc717aa
6496357 spec_fsync() is useless on devices that do write caching
billm
parents:
3547
diff
changeset
|
974 dmu_read_uio(objset_t *os, uint64_t object, uio_t *uio, uint64_t size) |
6b28ebc717aa
6496357 spec_fsync() is useless on devices that do write caching
billm
parents:
3547
diff
changeset
|
975 { |
6b28ebc717aa
6496357 spec_fsync() is useless on devices that do write caching
billm
parents:
3547
diff
changeset
|
976 dmu_buf_t **dbp; |
6b28ebc717aa
6496357 spec_fsync() is useless on devices that do write caching
billm
parents:
3547
diff
changeset
|
977 int numbufs, i, err; |
11539
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
978 xuio_t *xuio = NULL; |
3638
6b28ebc717aa
6496357 spec_fsync() is useless on devices that do write caching
billm
parents:
3547
diff
changeset
|
979 |
6b28ebc717aa
6496357 spec_fsync() is useless on devices that do write caching
billm
parents:
3547
diff
changeset
|
980 /* |
6b28ebc717aa
6496357 spec_fsync() is useless on devices that do write caching
billm
parents:
3547
diff
changeset
|
981 * NB: we could do this block-at-a-time, but it's nice |
6b28ebc717aa
6496357 spec_fsync() is useless on devices that do write caching
billm
parents:
3547
diff
changeset
|
982 * to be reading in parallel. |
6b28ebc717aa
6496357 spec_fsync() is useless on devices that do write caching
billm
parents:
3547
diff
changeset
|
983 */ |
6b28ebc717aa
6496357 spec_fsync() is useless on devices that do write caching
billm
parents:
3547
diff
changeset
|
984 err = dmu_buf_hold_array(os, object, uio->uio_loffset, size, TRUE, FTAG, |
6b28ebc717aa
6496357 spec_fsync() is useless on devices that do write caching
billm
parents:
3547
diff
changeset
|
985 &numbufs, &dbp); |
6b28ebc717aa
6496357 spec_fsync() is useless on devices that do write caching
billm
parents:
3547
diff
changeset
|
986 if (err) |
6b28ebc717aa
6496357 spec_fsync() is useless on devices that do write caching
billm
parents:
3547
diff
changeset
|
987 return (err); |
6b28ebc717aa
6496357 spec_fsync() is useless on devices that do write caching
billm
parents:
3547
diff
changeset
|
988 |
11539
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
989 if (uio->uio_extflg == UIO_XUIO) |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
990 xuio = (xuio_t *)uio; |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
991 |
3638
6b28ebc717aa
6496357 spec_fsync() is useless on devices that do write caching
billm
parents:
3547
diff
changeset
|
992 for (i = 0; i < numbufs; i++) { |
6b28ebc717aa
6496357 spec_fsync() is useless on devices that do write caching
billm
parents:
3547
diff
changeset
|
993 int tocpy; |
6b28ebc717aa
6496357 spec_fsync() is useless on devices that do write caching
billm
parents:
3547
diff
changeset
|
994 int bufoff; |
6b28ebc717aa
6496357 spec_fsync() is useless on devices that do write caching
billm
parents:
3547
diff
changeset
|
995 dmu_buf_t *db = dbp[i]; |
6b28ebc717aa
6496357 spec_fsync() is useless on devices that do write caching
billm
parents:
3547
diff
changeset
|
996 |
6b28ebc717aa
6496357 spec_fsync() is useless on devices that do write caching
billm
parents:
3547
diff
changeset
|
997 ASSERT(size > 0); |
6b28ebc717aa
6496357 spec_fsync() is useless on devices that do write caching
billm
parents:
3547
diff
changeset
|
998 |
6b28ebc717aa
6496357 spec_fsync() is useless on devices that do write caching
billm
parents:
3547
diff
changeset
|
999 bufoff = uio->uio_loffset - db->db_offset; |
6b28ebc717aa
6496357 spec_fsync() is useless on devices that do write caching
billm
parents:
3547
diff
changeset
|
1000 tocpy = (int)MIN(db->db_size - bufoff, size); |
6b28ebc717aa
6496357 spec_fsync() is useless on devices that do write caching
billm
parents:
3547
diff
changeset
|
1001 |
11539
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
1002 if (xuio) { |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
1003 dmu_buf_impl_t *dbi = (dmu_buf_impl_t *)db; |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
1004 arc_buf_t *dbuf_abuf = dbi->db_buf; |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
1005 arc_buf_t *abuf = dbuf_loan_arcbuf(dbi); |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
1006 err = dmu_xuio_add(xuio, abuf, bufoff, tocpy); |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
1007 if (!err) { |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
1008 uio->uio_resid -= tocpy; |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
1009 uio->uio_loffset += tocpy; |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
1010 } |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
1011 |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
1012 if (abuf == dbuf_abuf) |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
1013 XUIOSTAT_BUMP(xuiostat_rbuf_nocopy); |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
1014 else |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
1015 XUIOSTAT_BUMP(xuiostat_rbuf_copied); |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
1016 } else { |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
1017 err = uiomove((char *)db->db_data + bufoff, tocpy, |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
1018 UIO_READ, uio); |
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
1019 } |
3638
6b28ebc717aa
6496357 spec_fsync() is useless on devices that do write caching
billm
parents:
3547
diff
changeset
|
1020 if (err) |
6b28ebc717aa
6496357 spec_fsync() is useless on devices that do write caching
billm
parents:
3547
diff
changeset
|
1021 break; |
6b28ebc717aa
6496357 spec_fsync() is useless on devices that do write caching
billm
parents:
3547
diff
changeset
|
1022 |
6b28ebc717aa
6496357 spec_fsync() is useless on devices that do write caching
billm
parents:
3547
diff
changeset
|
1023 size -= tocpy; |
6b28ebc717aa
6496357 spec_fsync() is useless on devices that do write caching
billm
parents:
3547
diff
changeset
|
1024 } |
6b28ebc717aa
6496357 spec_fsync() is useless on devices that do write caching
billm
parents:
3547
diff
changeset
|
1025 dmu_buf_rele_array(dbp, numbufs, FTAG); |
6b28ebc717aa
6496357 spec_fsync() is useless on devices that do write caching
billm
parents:
3547
diff
changeset
|
1026 |
6b28ebc717aa
6496357 spec_fsync() is useless on devices that do write caching
billm
parents:
3547
diff
changeset
|
1027 return (err); |
6b28ebc717aa
6496357 spec_fsync() is useless on devices that do write caching
billm
parents:
3547
diff
changeset
|
1028 } |
6b28ebc717aa
6496357 spec_fsync() is useless on devices that do write caching
billm
parents:
3547
diff
changeset
|
1029 |
12123
bb40732a982e
6572591 meta dnode lookup causes bucket lock contention in dbuf hash
Tim Haley <Tim.Haley@Sun.COM>
parents:
11935
diff
changeset
|
1030 static int |
bb40732a982e
6572591 meta dnode lookup causes bucket lock contention in dbuf hash
Tim Haley <Tim.Haley@Sun.COM>
parents:
11935
diff
changeset
|
1031 dmu_write_uio_dnode(dnode_t *dn, uio_t *uio, uint64_t size, dmu_tx_t *tx) |
789 | 1032 { |
1033 dmu_buf_t **dbp; | |
12123
bb40732a982e
6572591 meta dnode lookup causes bucket lock contention in dbuf hash
Tim Haley <Tim.Haley@Sun.COM>
parents:
11935
diff
changeset
|
1034 int numbufs; |
789 | 1035 int err = 0; |
12123
bb40732a982e
6572591 meta dnode lookup causes bucket lock contention in dbuf hash
Tim Haley <Tim.Haley@Sun.COM>
parents:
11935
diff
changeset
|
1036 int i; |
789 | 1037 |
12123
bb40732a982e
6572591 meta dnode lookup causes bucket lock contention in dbuf hash
Tim Haley <Tim.Haley@Sun.COM>
parents:
11935
diff
changeset
|
1038 err = dmu_buf_hold_array_by_dnode(dn, uio->uio_loffset, size, |
bb40732a982e
6572591 meta dnode lookup causes bucket lock contention in dbuf hash
Tim Haley <Tim.Haley@Sun.COM>
parents:
11935
diff
changeset
|
1039 FALSE, FTAG, &numbufs, &dbp, DMU_READ_PREFETCH); |
1544 | 1040 if (err) |
1041 return (err); | |
789 | 1042 |
1043 for (i = 0; i < numbufs; i++) { | |
1044 int tocpy; | |
1045 int bufoff; | |
1046 dmu_buf_t *db = dbp[i]; | |
1047 | |
1048 ASSERT(size > 0); | |
1049 | |
3638
6b28ebc717aa
6496357 spec_fsync() is useless on devices that do write caching
billm
parents:
3547
diff
changeset
|
1050 bufoff = uio->uio_loffset - db->db_offset; |
789 | 1051 tocpy = (int)MIN(db->db_size - bufoff, size); |
1052 | |
1053 ASSERT(i == 0 || i == numbufs-1 || tocpy == db->db_size); | |
1054 | |
1055 if (tocpy == db->db_size) | |
1056 dmu_buf_will_fill(db, tx); | |
1057 else | |
1058 dmu_buf_will_dirty(db, tx); | |
1059 | |
1060 /* | |
1061 * XXX uiomove could block forever (eg. nfs-backed | |
1062 * pages). There needs to be a uiolockdown() function | |
1063 * to lock the pages in memory, so that uiomove won't | |
1064 * block. | |
1065 */ | |
1066 err = uiomove((char *)db->db_data + bufoff, tocpy, | |
1067 UIO_WRITE, uio); | |
1068 | |
1069 if (tocpy == db->db_size) | |
1070 dmu_buf_fill_done(db, tx); | |
1071 | |
1072 if (err) | |
1073 break; | |
1074 | |
1075 size -= tocpy; | |
1076 } | |
12123
bb40732a982e
6572591 meta dnode lookup causes bucket lock contention in dbuf hash
Tim Haley <Tim.Haley@Sun.COM>
parents:
11935
diff
changeset
|
1077 |
1544 | 1078 dmu_buf_rele_array(dbp, numbufs, FTAG); |
789 | 1079 return (err); |
1080 } | |
2688
12e2ad22b970
6447701 ZFS hangs when iSCSI Target attempts to initialize its backing store
maybee
parents:
2676
diff
changeset
|
1081 |
12e2ad22b970
6447701 ZFS hangs when iSCSI Target attempts to initialize its backing store
maybee
parents:
2676
diff
changeset
|
1082 int |
12123
bb40732a982e
6572591 meta dnode lookup causes bucket lock contention in dbuf hash
Tim Haley <Tim.Haley@Sun.COM>
parents:
11935
diff
changeset
|
1083 dmu_write_uio_dbuf(dmu_buf_t *zdb, uio_t *uio, uint64_t size, |
bb40732a982e
6572591 meta dnode lookup causes bucket lock contention in dbuf hash
Tim Haley <Tim.Haley@Sun.COM>
parents:
11935
diff
changeset
|
1084 dmu_tx_t *tx) |
bb40732a982e
6572591 meta dnode lookup causes bucket lock contention in dbuf hash
Tim Haley <Tim.Haley@Sun.COM>
parents:
11935
diff
changeset
|
1085 { |
12684
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
1086 dmu_buf_impl_t *db = (dmu_buf_impl_t *)zdb; |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
1087 dnode_t *dn; |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
1088 int err; |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
1089 |
12123
bb40732a982e
6572591 meta dnode lookup causes bucket lock contention in dbuf hash
Tim Haley <Tim.Haley@Sun.COM>
parents:
11935
diff
changeset
|
1090 if (size == 0) |
bb40732a982e
6572591 meta dnode lookup causes bucket lock contention in dbuf hash
Tim Haley <Tim.Haley@Sun.COM>
parents:
11935
diff
changeset
|
1091 return (0); |
bb40732a982e
6572591 meta dnode lookup causes bucket lock contention in dbuf hash
Tim Haley <Tim.Haley@Sun.COM>
parents:
11935
diff
changeset
|
1092 |
12684
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
1093 DB_DNODE_ENTER(db); |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
1094 dn = DB_DNODE(db); |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
1095 err = dmu_write_uio_dnode(dn, uio, size, tx); |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
1096 DB_DNODE_EXIT(db); |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
1097 |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
1098 return (err); |
12123
bb40732a982e
6572591 meta dnode lookup causes bucket lock contention in dbuf hash
Tim Haley <Tim.Haley@Sun.COM>
parents:
11935
diff
changeset
|
1099 } |
bb40732a982e
6572591 meta dnode lookup causes bucket lock contention in dbuf hash
Tim Haley <Tim.Haley@Sun.COM>
parents:
11935
diff
changeset
|
1100 |
bb40732a982e
6572591 meta dnode lookup causes bucket lock contention in dbuf hash
Tim Haley <Tim.Haley@Sun.COM>
parents:
11935
diff
changeset
|
1101 int |
bb40732a982e
6572591 meta dnode lookup causes bucket lock contention in dbuf hash
Tim Haley <Tim.Haley@Sun.COM>
parents:
11935
diff
changeset
|
1102 dmu_write_uio(objset_t *os, uint64_t object, uio_t *uio, uint64_t size, |
bb40732a982e
6572591 meta dnode lookup causes bucket lock contention in dbuf hash
Tim Haley <Tim.Haley@Sun.COM>
parents:
11935
diff
changeset
|
1103 dmu_tx_t *tx) |
bb40732a982e
6572591 meta dnode lookup causes bucket lock contention in dbuf hash
Tim Haley <Tim.Haley@Sun.COM>
parents:
11935
diff
changeset
|
1104 { |
bb40732a982e
6572591 meta dnode lookup causes bucket lock contention in dbuf hash
Tim Haley <Tim.Haley@Sun.COM>
parents:
11935
diff
changeset
|
1105 dnode_t *dn; |
bb40732a982e
6572591 meta dnode lookup causes bucket lock contention in dbuf hash
Tim Haley <Tim.Haley@Sun.COM>
parents:
11935
diff
changeset
|
1106 int err; |
bb40732a982e
6572591 meta dnode lookup causes bucket lock contention in dbuf hash
Tim Haley <Tim.Haley@Sun.COM>
parents:
11935
diff
changeset
|
1107 |
bb40732a982e
6572591 meta dnode lookup causes bucket lock contention in dbuf hash
Tim Haley <Tim.Haley@Sun.COM>
parents:
11935
diff
changeset
|
1108 if (size == 0) |
bb40732a982e
6572591 meta dnode lookup causes bucket lock contention in dbuf hash
Tim Haley <Tim.Haley@Sun.COM>
parents:
11935
diff
changeset
|
1109 return (0); |
bb40732a982e
6572591 meta dnode lookup causes bucket lock contention in dbuf hash
Tim Haley <Tim.Haley@Sun.COM>
parents:
11935
diff
changeset
|
1110 |
bb40732a982e
6572591 meta dnode lookup causes bucket lock contention in dbuf hash
Tim Haley <Tim.Haley@Sun.COM>
parents:
11935
diff
changeset
|
1111 err = dnode_hold(os, object, FTAG, &dn); |
bb40732a982e
6572591 meta dnode lookup causes bucket lock contention in dbuf hash
Tim Haley <Tim.Haley@Sun.COM>
parents:
11935
diff
changeset
|
1112 if (err) |
bb40732a982e
6572591 meta dnode lookup causes bucket lock contention in dbuf hash
Tim Haley <Tim.Haley@Sun.COM>
parents:
11935
diff
changeset
|
1113 return (err); |
bb40732a982e
6572591 meta dnode lookup causes bucket lock contention in dbuf hash
Tim Haley <Tim.Haley@Sun.COM>
parents:
11935
diff
changeset
|
1114 |
bb40732a982e
6572591 meta dnode lookup causes bucket lock contention in dbuf hash
Tim Haley <Tim.Haley@Sun.COM>
parents:
11935
diff
changeset
|
1115 err = dmu_write_uio_dnode(dn, uio, size, tx); |
bb40732a982e
6572591 meta dnode lookup causes bucket lock contention in dbuf hash
Tim Haley <Tim.Haley@Sun.COM>
parents:
11935
diff
changeset
|
1116 |
bb40732a982e
6572591 meta dnode lookup causes bucket lock contention in dbuf hash
Tim Haley <Tim.Haley@Sun.COM>
parents:
11935
diff
changeset
|
1117 dnode_rele(dn, FTAG); |
bb40732a982e
6572591 meta dnode lookup causes bucket lock contention in dbuf hash
Tim Haley <Tim.Haley@Sun.COM>
parents:
11935
diff
changeset
|
1118 |
bb40732a982e
6572591 meta dnode lookup causes bucket lock contention in dbuf hash
Tim Haley <Tim.Haley@Sun.COM>
parents:
11935
diff
changeset
|
1119 return (err); |
bb40732a982e
6572591 meta dnode lookup causes bucket lock contention in dbuf hash
Tim Haley <Tim.Haley@Sun.COM>
parents:
11935
diff
changeset
|
1120 } |
bb40732a982e
6572591 meta dnode lookup causes bucket lock contention in dbuf hash
Tim Haley <Tim.Haley@Sun.COM>
parents:
11935
diff
changeset
|
1121 |
bb40732a982e
6572591 meta dnode lookup causes bucket lock contention in dbuf hash
Tim Haley <Tim.Haley@Sun.COM>
parents:
11935
diff
changeset
|
1122 int |
2688
12e2ad22b970
6447701 ZFS hangs when iSCSI Target attempts to initialize its backing store
maybee
parents:
2676
diff
changeset
|
1123 dmu_write_pages(objset_t *os, uint64_t object, uint64_t offset, uint64_t size, |
12e2ad22b970
6447701 ZFS hangs when iSCSI Target attempts to initialize its backing store
maybee
parents:
2676
diff
changeset
|
1124 page_t *pp, dmu_tx_t *tx) |
12e2ad22b970
6447701 ZFS hangs when iSCSI Target attempts to initialize its backing store
maybee
parents:
2676
diff
changeset
|
1125 { |
12e2ad22b970
6447701 ZFS hangs when iSCSI Target attempts to initialize its backing store
maybee
parents:
2676
diff
changeset
|
1126 dmu_buf_t **dbp; |
12e2ad22b970
6447701 ZFS hangs when iSCSI Target attempts to initialize its backing store
maybee
parents:
2676
diff
changeset
|
1127 int numbufs, i; |
12e2ad22b970
6447701 ZFS hangs when iSCSI Target attempts to initialize its backing store
maybee
parents:
2676
diff
changeset
|
1128 int err; |
12e2ad22b970
6447701 ZFS hangs when iSCSI Target attempts to initialize its backing store
maybee
parents:
2676
diff
changeset
|
1129 |
12e2ad22b970
6447701 ZFS hangs when iSCSI Target attempts to initialize its backing store
maybee
parents:
2676
diff
changeset
|
1130 if (size == 0) |
12e2ad22b970
6447701 ZFS hangs when iSCSI Target attempts to initialize its backing store
maybee
parents:
2676
diff
changeset
|
1131 return (0); |
12e2ad22b970
6447701 ZFS hangs when iSCSI Target attempts to initialize its backing store
maybee
parents:
2676
diff
changeset
|
1132 |
12e2ad22b970
6447701 ZFS hangs when iSCSI Target attempts to initialize its backing store
maybee
parents:
2676
diff
changeset
|
1133 err = dmu_buf_hold_array(os, object, offset, size, |
12e2ad22b970
6447701 ZFS hangs when iSCSI Target attempts to initialize its backing store
maybee
parents:
2676
diff
changeset
|
1134 FALSE, FTAG, &numbufs, &dbp); |
12e2ad22b970
6447701 ZFS hangs when iSCSI Target attempts to initialize its backing store
maybee
parents:
2676
diff
changeset
|
1135 if (err) |
12e2ad22b970
6447701 ZFS hangs when iSCSI Target attempts to initialize its backing store
maybee
parents:
2676
diff
changeset
|
1136 return (err); |
12e2ad22b970
6447701 ZFS hangs when iSCSI Target attempts to initialize its backing store
maybee
parents:
2676
diff
changeset
|
1137 |
12e2ad22b970
6447701 ZFS hangs when iSCSI Target attempts to initialize its backing store
maybee
parents:
2676
diff
changeset
|
1138 for (i = 0; i < numbufs; i++) { |
12e2ad22b970
6447701 ZFS hangs when iSCSI Target attempts to initialize its backing store
maybee
parents:
2676
diff
changeset
|
1139 int tocpy, copied, thiscpy; |
12e2ad22b970
6447701 ZFS hangs when iSCSI Target attempts to initialize its backing store
maybee
parents:
2676
diff
changeset
|
1140 int bufoff; |
12e2ad22b970
6447701 ZFS hangs when iSCSI Target attempts to initialize its backing store
maybee
parents:
2676
diff
changeset
|
1141 dmu_buf_t *db = dbp[i]; |
12e2ad22b970
6447701 ZFS hangs when iSCSI Target attempts to initialize its backing store
maybee
parents:
2676
diff
changeset
|
1142 caddr_t va; |
12e2ad22b970
6447701 ZFS hangs when iSCSI Target attempts to initialize its backing store
maybee
parents:
2676
diff
changeset
|
1143 |
12e2ad22b970
6447701 ZFS hangs when iSCSI Target attempts to initialize its backing store
maybee
parents:
2676
diff
changeset
|
1144 ASSERT(size > 0); |
12e2ad22b970
6447701 ZFS hangs when iSCSI Target attempts to initialize its backing store
maybee
parents:
2676
diff
changeset
|
1145 ASSERT3U(db->db_size, >=, PAGESIZE); |
12e2ad22b970
6447701 ZFS hangs when iSCSI Target attempts to initialize its backing store
maybee
parents:
2676
diff
changeset
|
1146 |
12e2ad22b970
6447701 ZFS hangs when iSCSI Target attempts to initialize its backing store
maybee
parents:
2676
diff
changeset
|
1147 bufoff = offset - db->db_offset; |
12e2ad22b970
6447701 ZFS hangs when iSCSI Target attempts to initialize its backing store
maybee
parents:
2676
diff
changeset
|
1148 tocpy = (int)MIN(db->db_size - bufoff, size); |
12e2ad22b970
6447701 ZFS hangs when iSCSI Target attempts to initialize its backing store
maybee
parents:
2676
diff
changeset
|
1149 |
12e2ad22b970
6447701 ZFS hangs when iSCSI Target attempts to initialize its backing store
maybee
parents:
2676
diff
changeset
|
1150 ASSERT(i == 0 || i == numbufs-1 || tocpy == db->db_size); |
12e2ad22b970
6447701 ZFS hangs when iSCSI Target attempts to initialize its backing store
maybee
parents:
2676
diff
changeset
|
1151 |
12e2ad22b970
6447701 ZFS hangs when iSCSI Target attempts to initialize its backing store
maybee
parents:
2676
diff
changeset
|
1152 if (tocpy == db->db_size) |
12e2ad22b970
6447701 ZFS hangs when iSCSI Target attempts to initialize its backing store
maybee
parents:
2676
diff
changeset
|
1153 dmu_buf_will_fill(db, tx); |
12e2ad22b970
6447701 ZFS hangs when iSCSI Target attempts to initialize its backing store
maybee
parents:
2676
diff
changeset
|
1154 else |
12e2ad22b970
6447701 ZFS hangs when iSCSI Target attempts to initialize its backing store
maybee
parents:
2676
diff
changeset
|
1155 dmu_buf_will_dirty(db, tx); |
12e2ad22b970
6447701 ZFS hangs when iSCSI Target attempts to initialize its backing store
maybee
parents:
2676
diff
changeset
|
1156 |
12e2ad22b970
6447701 ZFS hangs when iSCSI Target attempts to initialize its backing store
maybee
parents:
2676
diff
changeset
|
1157 for (copied = 0; copied < tocpy; copied += PAGESIZE) { |
12e2ad22b970
6447701 ZFS hangs when iSCSI Target attempts to initialize its backing store
maybee
parents:
2676
diff
changeset
|
1158 ASSERT3U(pp->p_offset, ==, db->db_offset + bufoff); |
12e2ad22b970
6447701 ZFS hangs when iSCSI Target attempts to initialize its backing store
maybee
parents:
2676
diff
changeset
|
1159 thiscpy = MIN(PAGESIZE, tocpy - copied); |
7315
cdba25672122
6735592 "zio" vmem arenas are confusing, not reported separately
Jonathan W Adams <Jonathan.Adams@Sun.COM>
parents:
7237
diff
changeset
|
1160 va = zfs_map_page(pp, S_READ); |
2688
12e2ad22b970
6447701 ZFS hangs when iSCSI Target attempts to initialize its backing store
maybee
parents:
2676
diff
changeset
|
1161 bcopy(va, (char *)db->db_data + bufoff, thiscpy); |
7315
cdba25672122
6735592 "zio" vmem arenas are confusing, not reported separately
Jonathan W Adams <Jonathan.Adams@Sun.COM>
parents:
7237
diff
changeset
|
1162 zfs_unmap_page(pp, va); |
2688
12e2ad22b970
6447701 ZFS hangs when iSCSI Target attempts to initialize its backing store
maybee
parents:
2676
diff
changeset
|
1163 pp = pp->p_next; |
12e2ad22b970
6447701 ZFS hangs when iSCSI Target attempts to initialize its backing store
maybee
parents:
2676
diff
changeset
|
1164 bufoff += PAGESIZE; |
12e2ad22b970
6447701 ZFS hangs when iSCSI Target attempts to initialize its backing store
maybee
parents:
2676
diff
changeset
|
1165 } |
12e2ad22b970
6447701 ZFS hangs when iSCSI Target attempts to initialize its backing store
maybee
parents:
2676
diff
changeset
|
1166 |
12e2ad22b970
6447701 ZFS hangs when iSCSI Target attempts to initialize its backing store
maybee
parents:
2676
diff
changeset
|
1167 if (tocpy == db->db_size) |
12e2ad22b970
6447701 ZFS hangs when iSCSI Target attempts to initialize its backing store
maybee
parents:
2676
diff
changeset
|
1168 dmu_buf_fill_done(db, tx); |
12e2ad22b970
6447701 ZFS hangs when iSCSI Target attempts to initialize its backing store
maybee
parents:
2676
diff
changeset
|
1169 |
12e2ad22b970
6447701 ZFS hangs when iSCSI Target attempts to initialize its backing store
maybee
parents:
2676
diff
changeset
|
1170 offset += tocpy; |
12e2ad22b970
6447701 ZFS hangs when iSCSI Target attempts to initialize its backing store
maybee
parents:
2676
diff
changeset
|
1171 size -= tocpy; |
12e2ad22b970
6447701 ZFS hangs when iSCSI Target attempts to initialize its backing store
maybee
parents:
2676
diff
changeset
|
1172 } |
12e2ad22b970
6447701 ZFS hangs when iSCSI Target attempts to initialize its backing store
maybee
parents:
2676
diff
changeset
|
1173 dmu_buf_rele_array(dbp, numbufs, FTAG); |
12e2ad22b970
6447701 ZFS hangs when iSCSI Target attempts to initialize its backing store
maybee
parents:
2676
diff
changeset
|
1174 return (err); |
12e2ad22b970
6447701 ZFS hangs when iSCSI Target attempts to initialize its backing store
maybee
parents:
2676
diff
changeset
|
1175 } |
789 | 1176 #endif |
1177 | |
9412
4aefd8704ce0
6717022 ZFS DMU needs zero-copy support
Aleksandr Guzovskiy <Aleksandr.Guzovskiy@Sun.COM>
parents:
9396
diff
changeset
|
1178 /* |
4aefd8704ce0
6717022 ZFS DMU needs zero-copy support
Aleksandr Guzovskiy <Aleksandr.Guzovskiy@Sun.COM>
parents:
9396
diff
changeset
|
1179 * Allocate a loaned anonymous arc buffer. |
4aefd8704ce0
6717022 ZFS DMU needs zero-copy support
Aleksandr Guzovskiy <Aleksandr.Guzovskiy@Sun.COM>
parents:
9396
diff
changeset
|
1180 */ |
4aefd8704ce0
6717022 ZFS DMU needs zero-copy support
Aleksandr Guzovskiy <Aleksandr.Guzovskiy@Sun.COM>
parents:
9396
diff
changeset
|
1181 arc_buf_t * |
4aefd8704ce0
6717022 ZFS DMU needs zero-copy support
Aleksandr Guzovskiy <Aleksandr.Guzovskiy@Sun.COM>
parents:
9396
diff
changeset
|
1182 dmu_request_arcbuf(dmu_buf_t *handle, int size) |
4aefd8704ce0
6717022 ZFS DMU needs zero-copy support
Aleksandr Guzovskiy <Aleksandr.Guzovskiy@Sun.COM>
parents:
9396
diff
changeset
|
1183 { |
12684
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
1184 dmu_buf_impl_t *db = (dmu_buf_impl_t *)handle; |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
1185 spa_t *spa; |
9412
4aefd8704ce0
6717022 ZFS DMU needs zero-copy support
Aleksandr Guzovskiy <Aleksandr.Guzovskiy@Sun.COM>
parents:
9396
diff
changeset
|
1186 |
12684
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
1187 DB_GET_SPA(&spa, db); |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
1188 return (arc_loan_buf(spa, size)); |
9412
4aefd8704ce0
6717022 ZFS DMU needs zero-copy support
Aleksandr Guzovskiy <Aleksandr.Guzovskiy@Sun.COM>
parents:
9396
diff
changeset
|
1189 } |
4aefd8704ce0
6717022 ZFS DMU needs zero-copy support
Aleksandr Guzovskiy <Aleksandr.Guzovskiy@Sun.COM>
parents:
9396
diff
changeset
|
1190 |
4aefd8704ce0
6717022 ZFS DMU needs zero-copy support
Aleksandr Guzovskiy <Aleksandr.Guzovskiy@Sun.COM>
parents:
9396
diff
changeset
|
1191 /* |
4aefd8704ce0
6717022 ZFS DMU needs zero-copy support
Aleksandr Guzovskiy <Aleksandr.Guzovskiy@Sun.COM>
parents:
9396
diff
changeset
|
1192 * Free a loaned arc buffer. |
4aefd8704ce0
6717022 ZFS DMU needs zero-copy support
Aleksandr Guzovskiy <Aleksandr.Guzovskiy@Sun.COM>
parents:
9396
diff
changeset
|
1193 */ |
4aefd8704ce0
6717022 ZFS DMU needs zero-copy support
Aleksandr Guzovskiy <Aleksandr.Guzovskiy@Sun.COM>
parents:
9396
diff
changeset
|
1194 void |
4aefd8704ce0
6717022 ZFS DMU needs zero-copy support
Aleksandr Guzovskiy <Aleksandr.Guzovskiy@Sun.COM>
parents:
9396
diff
changeset
|
1195 dmu_return_arcbuf(arc_buf_t *buf) |
4aefd8704ce0
6717022 ZFS DMU needs zero-copy support
Aleksandr Guzovskiy <Aleksandr.Guzovskiy@Sun.COM>
parents:
9396
diff
changeset
|
1196 { |
4aefd8704ce0
6717022 ZFS DMU needs zero-copy support
Aleksandr Guzovskiy <Aleksandr.Guzovskiy@Sun.COM>
parents:
9396
diff
changeset
|
1197 arc_return_buf(buf, FTAG); |
4aefd8704ce0
6717022 ZFS DMU needs zero-copy support
Aleksandr Guzovskiy <Aleksandr.Guzovskiy@Sun.COM>
parents:
9396
diff
changeset
|
1198 VERIFY(arc_buf_remove_ref(buf, FTAG) == 1); |
4aefd8704ce0
6717022 ZFS DMU needs zero-copy support
Aleksandr Guzovskiy <Aleksandr.Guzovskiy@Sun.COM>
parents:
9396
diff
changeset
|
1199 } |
4aefd8704ce0
6717022 ZFS DMU needs zero-copy support
Aleksandr Guzovskiy <Aleksandr.Guzovskiy@Sun.COM>
parents:
9396
diff
changeset
|
1200 |
4aefd8704ce0
6717022 ZFS DMU needs zero-copy support
Aleksandr Guzovskiy <Aleksandr.Guzovskiy@Sun.COM>
parents:
9396
diff
changeset
|
1201 /* |
4aefd8704ce0
6717022 ZFS DMU needs zero-copy support
Aleksandr Guzovskiy <Aleksandr.Guzovskiy@Sun.COM>
parents:
9396
diff
changeset
|
1202 * When possible directly assign passed loaned arc buffer to a dbuf. |
4aefd8704ce0
6717022 ZFS DMU needs zero-copy support
Aleksandr Guzovskiy <Aleksandr.Guzovskiy@Sun.COM>
parents:
9396
diff
changeset
|
1203 * If this is not possible copy the contents of passed arc buf via |
4aefd8704ce0
6717022 ZFS DMU needs zero-copy support
Aleksandr Guzovskiy <Aleksandr.Guzovskiy@Sun.COM>
parents:
9396
diff
changeset
|
1204 * dmu_write(). |
4aefd8704ce0
6717022 ZFS DMU needs zero-copy support
Aleksandr Guzovskiy <Aleksandr.Guzovskiy@Sun.COM>
parents:
9396
diff
changeset
|
1205 */ |
4aefd8704ce0
6717022 ZFS DMU needs zero-copy support
Aleksandr Guzovskiy <Aleksandr.Guzovskiy@Sun.COM>
parents:
9396
diff
changeset
|
1206 void |
4aefd8704ce0
6717022 ZFS DMU needs zero-copy support
Aleksandr Guzovskiy <Aleksandr.Guzovskiy@Sun.COM>
parents:
9396
diff
changeset
|
1207 dmu_assign_arcbuf(dmu_buf_t *handle, uint64_t offset, arc_buf_t *buf, |
4aefd8704ce0
6717022 ZFS DMU needs zero-copy support
Aleksandr Guzovskiy <Aleksandr.Guzovskiy@Sun.COM>
parents:
9396
diff
changeset
|
1208 dmu_tx_t *tx) |
4aefd8704ce0
6717022 ZFS DMU needs zero-copy support
Aleksandr Guzovskiy <Aleksandr.Guzovskiy@Sun.COM>
parents:
9396
diff
changeset
|
1209 { |
12684
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
1210 dmu_buf_impl_t *dbuf = (dmu_buf_impl_t *)handle; |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
1211 dnode_t *dn; |
9412
4aefd8704ce0
6717022 ZFS DMU needs zero-copy support
Aleksandr Guzovskiy <Aleksandr.Guzovskiy@Sun.COM>
parents:
9396
diff
changeset
|
1212 dmu_buf_impl_t *db; |
4aefd8704ce0
6717022 ZFS DMU needs zero-copy support
Aleksandr Guzovskiy <Aleksandr.Guzovskiy@Sun.COM>
parents:
9396
diff
changeset
|
1213 uint32_t blksz = (uint32_t)arc_buf_size(buf); |
4aefd8704ce0
6717022 ZFS DMU needs zero-copy support
Aleksandr Guzovskiy <Aleksandr.Guzovskiy@Sun.COM>
parents:
9396
diff
changeset
|
1214 uint64_t blkid; |
4aefd8704ce0
6717022 ZFS DMU needs zero-copy support
Aleksandr Guzovskiy <Aleksandr.Guzovskiy@Sun.COM>
parents:
9396
diff
changeset
|
1215 |
12684
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
1216 DB_DNODE_ENTER(dbuf); |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
1217 dn = DB_DNODE(dbuf); |
9412
4aefd8704ce0
6717022 ZFS DMU needs zero-copy support
Aleksandr Guzovskiy <Aleksandr.Guzovskiy@Sun.COM>
parents:
9396
diff
changeset
|
1218 rw_enter(&dn->dn_struct_rwlock, RW_READER); |
4aefd8704ce0
6717022 ZFS DMU needs zero-copy support
Aleksandr Guzovskiy <Aleksandr.Guzovskiy@Sun.COM>
parents:
9396
diff
changeset
|
1219 blkid = dbuf_whichblock(dn, offset); |
4aefd8704ce0
6717022 ZFS DMU needs zero-copy support
Aleksandr Guzovskiy <Aleksandr.Guzovskiy@Sun.COM>
parents:
9396
diff
changeset
|
1220 VERIFY((db = dbuf_hold(dn, blkid, FTAG)) != NULL); |
4aefd8704ce0
6717022 ZFS DMU needs zero-copy support
Aleksandr Guzovskiy <Aleksandr.Guzovskiy@Sun.COM>
parents:
9396
diff
changeset
|
1221 rw_exit(&dn->dn_struct_rwlock); |
12684
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
1222 DB_DNODE_EXIT(dbuf); |
9412
4aefd8704ce0
6717022 ZFS DMU needs zero-copy support
Aleksandr Guzovskiy <Aleksandr.Guzovskiy@Sun.COM>
parents:
9396
diff
changeset
|
1223 |
4aefd8704ce0
6717022 ZFS DMU needs zero-copy support
Aleksandr Guzovskiy <Aleksandr.Guzovskiy@Sun.COM>
parents:
9396
diff
changeset
|
1224 if (offset == db->db.db_offset && blksz == db->db.db_size) { |
4aefd8704ce0
6717022 ZFS DMU needs zero-copy support
Aleksandr Guzovskiy <Aleksandr.Guzovskiy@Sun.COM>
parents:
9396
diff
changeset
|
1225 dbuf_assign_arcbuf(db, buf, tx); |
4aefd8704ce0
6717022 ZFS DMU needs zero-copy support
Aleksandr Guzovskiy <Aleksandr.Guzovskiy@Sun.COM>
parents:
9396
diff
changeset
|
1226 dbuf_rele(db, FTAG); |
4aefd8704ce0
6717022 ZFS DMU needs zero-copy support
Aleksandr Guzovskiy <Aleksandr.Guzovskiy@Sun.COM>
parents:
9396
diff
changeset
|
1227 } else { |
12684
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
1228 objset_t *os; |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
1229 uint64_t object; |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
1230 |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
1231 DB_DNODE_ENTER(dbuf); |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
1232 dn = DB_DNODE(dbuf); |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
1233 os = dn->dn_objset; |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
1234 object = dn->dn_object; |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
1235 DB_DNODE_EXIT(dbuf); |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
1236 |
9412
4aefd8704ce0
6717022 ZFS DMU needs zero-copy support
Aleksandr Guzovskiy <Aleksandr.Guzovskiy@Sun.COM>
parents:
9396
diff
changeset
|
1237 dbuf_rele(db, FTAG); |
12684
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
1238 dmu_write(os, object, offset, blksz, buf->b_data, tx); |
9412
4aefd8704ce0
6717022 ZFS DMU needs zero-copy support
Aleksandr Guzovskiy <Aleksandr.Guzovskiy@Sun.COM>
parents:
9396
diff
changeset
|
1239 dmu_return_arcbuf(buf); |
11539
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
1240 XUIOSTAT_BUMP(xuiostat_wbuf_copied); |
9412
4aefd8704ce0
6717022 ZFS DMU needs zero-copy support
Aleksandr Guzovskiy <Aleksandr.Guzovskiy@Sun.COM>
parents:
9396
diff
changeset
|
1241 } |
4aefd8704ce0
6717022 ZFS DMU needs zero-copy support
Aleksandr Guzovskiy <Aleksandr.Guzovskiy@Sun.COM>
parents:
9396
diff
changeset
|
1242 } |
4aefd8704ce0
6717022 ZFS DMU needs zero-copy support
Aleksandr Guzovskiy <Aleksandr.Guzovskiy@Sun.COM>
parents:
9396
diff
changeset
|
1243 |
2237 | 1244 typedef struct { |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1245 dbuf_dirty_record_t *dsa_dr; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1246 dmu_sync_cb_t *dsa_done; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1247 zgd_t *dsa_zgd; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1248 dmu_tx_t *dsa_tx; |
3547
e396e0a440b1
6512391 DMU should leverage ZIO dependencies to achieve greater parallelism
maybee
parents:
3444
diff
changeset
|
1249 } dmu_sync_arg_t; |
2237 | 1250 |
1251 /* ARGSUSED */ | |
1252 static void | |
7754
b80e4842ad54
6754011 SPA 3.0: lock breakup, i/o pipeline refactoring, device failure handling
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
7468
diff
changeset
|
1253 dmu_sync_ready(zio_t *zio, arc_buf_t *buf, void *varg) |
b80e4842ad54
6754011 SPA 3.0: lock breakup, i/o pipeline refactoring, device failure handling
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
7468
diff
changeset
|
1254 { |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1255 dmu_sync_arg_t *dsa = varg; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1256 dmu_buf_t *db = dsa->dsa_zgd->zgd_db; |
7754
b80e4842ad54
6754011 SPA 3.0: lock breakup, i/o pipeline refactoring, device failure handling
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
7468
diff
changeset
|
1257 blkptr_t *bp = zio->io_bp; |
10800
469478b180d9
6880764 fsync on zfs is broken if writes are greater than 32kb on a hard crash and no log attached
Neil Perrin <Neil.Perrin@Sun.COM>
parents:
10474
diff
changeset
|
1258 |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1259 if (zio->io_error == 0) { |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1260 if (BP_IS_HOLE(bp)) { |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1261 /* |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1262 * A block of zeros may compress to a hole, but the |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1263 * block size still needs to be known for replay. |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1264 */ |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1265 BP_SET_LSIZE(bp, db->db_size); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1266 } else { |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1267 ASSERT(BP_GET_LEVEL(bp) == 0); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1268 bp->blk_fill = 1; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1269 } |
7754
b80e4842ad54
6754011 SPA 3.0: lock breakup, i/o pipeline refactoring, device failure handling
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
7468
diff
changeset
|
1270 } |
b80e4842ad54
6754011 SPA 3.0: lock breakup, i/o pipeline refactoring, device failure handling
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
7468
diff
changeset
|
1271 } |
b80e4842ad54
6754011 SPA 3.0: lock breakup, i/o pipeline refactoring, device failure handling
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
7468
diff
changeset
|
1272 |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1273 static void |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1274 dmu_sync_late_arrival_ready(zio_t *zio) |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1275 { |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1276 dmu_sync_ready(zio, NULL, zio->io_private); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1277 } |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1278 |
7754
b80e4842ad54
6754011 SPA 3.0: lock breakup, i/o pipeline refactoring, device failure handling
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
7468
diff
changeset
|
1279 /* ARGSUSED */ |
b80e4842ad54
6754011 SPA 3.0: lock breakup, i/o pipeline refactoring, device failure handling
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
7468
diff
changeset
|
1280 static void |
2237 | 1281 dmu_sync_done(zio_t *zio, arc_buf_t *buf, void *varg) |
1282 { | |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1283 dmu_sync_arg_t *dsa = varg; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1284 dbuf_dirty_record_t *dr = dsa->dsa_dr; |
3547
e396e0a440b1
6512391 DMU should leverage ZIO dependencies to achieve greater parallelism
maybee
parents:
3444
diff
changeset
|
1285 dmu_buf_impl_t *db = dr->dr_dbuf; |
2237 | 1286 |
10810
b6b161a6ae4a
6892298 buf->b_hdr->b_state != arc_anon, file: ../../common/fs/zfs/arc.c, line: 2849
Neil Perrin <Neil.Perrin@Sun.COM>
parents:
10800
diff
changeset
|
1287 mutex_enter(&db->db_mtx); |
b6b161a6ae4a
6892298 buf->b_hdr->b_state != arc_anon, file: ../../common/fs/zfs/arc.c, line: 2849
Neil Perrin <Neil.Perrin@Sun.COM>
parents:
10800
diff
changeset
|
1288 ASSERT(dr->dt.dl.dr_override_state == DR_IN_DMU_SYNC); |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1289 if (zio->io_error == 0) { |
13887
196932ec9e6a
3236 zio nop-write
George Wilson <george.wilson@delphix.com>
parents:
13776
diff
changeset
|
1290 dr->dt.dl.dr_nopwrite = !!(zio->io_flags & ZIO_FLAG_NOPWRITE); |
196932ec9e6a
3236 zio nop-write
George Wilson <george.wilson@delphix.com>
parents:
13776
diff
changeset
|
1291 if (dr->dt.dl.dr_nopwrite) { |
196932ec9e6a
3236 zio nop-write
George Wilson <george.wilson@delphix.com>
parents:
13776
diff
changeset
|
1292 blkptr_t *bp = zio->io_bp; |
196932ec9e6a
3236 zio nop-write
George Wilson <george.wilson@delphix.com>
parents:
13776
diff
changeset
|
1293 blkptr_t *bp_orig = &zio->io_bp_orig; |
196932ec9e6a
3236 zio nop-write
George Wilson <george.wilson@delphix.com>
parents:
13776
diff
changeset
|
1294 uint8_t chksum = BP_GET_CHECKSUM(bp_orig); |
196932ec9e6a
3236 zio nop-write
George Wilson <george.wilson@delphix.com>
parents:
13776
diff
changeset
|
1295 |
196932ec9e6a
3236 zio nop-write
George Wilson <george.wilson@delphix.com>
parents:
13776
diff
changeset
|
1296 ASSERT(BP_EQUAL(bp, bp_orig)); |
196932ec9e6a
3236 zio nop-write
George Wilson <george.wilson@delphix.com>
parents:
13776
diff
changeset
|
1297 ASSERT(zio->io_prop.zp_compress != ZIO_COMPRESS_OFF); |
196932ec9e6a
3236 zio nop-write
George Wilson <george.wilson@delphix.com>
parents:
13776
diff
changeset
|
1298 ASSERT(zio_checksum_table[chksum].ci_dedup); |
196932ec9e6a
3236 zio nop-write
George Wilson <george.wilson@delphix.com>
parents:
13776
diff
changeset
|
1299 } |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1300 dr->dt.dl.dr_overridden_by = *zio->io_bp; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1301 dr->dt.dl.dr_override_state = DR_OVERRIDDEN; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1302 dr->dt.dl.dr_copies = zio->io_prop.zp_copies; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1303 if (BP_IS_HOLE(&dr->dt.dl.dr_overridden_by)) |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1304 BP_ZERO(&dr->dt.dl.dr_overridden_by); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1305 } else { |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1306 dr->dt.dl.dr_override_state = DR_NOT_OVERRIDDEN; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1307 } |
2237 | 1308 cv_broadcast(&db->db_changed); |
10810
b6b161a6ae4a
6892298 buf->b_hdr->b_state != arc_anon, file: ../../common/fs/zfs/arc.c, line: 2849
Neil Perrin <Neil.Perrin@Sun.COM>
parents:
10800
diff
changeset
|
1309 mutex_exit(&db->db_mtx); |
b6b161a6ae4a
6892298 buf->b_hdr->b_state != arc_anon, file: ../../common/fs/zfs/arc.c, line: 2849
Neil Perrin <Neil.Perrin@Sun.COM>
parents:
10800
diff
changeset
|
1310 |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1311 dsa->dsa_done(dsa->dsa_zgd, zio->io_error); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1312 |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1313 kmem_free(dsa, sizeof (*dsa)); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1314 } |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1315 |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1316 static void |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1317 dmu_sync_late_arrival_done(zio_t *zio) |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1318 { |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1319 blkptr_t *bp = zio->io_bp; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1320 dmu_sync_arg_t *dsa = zio->io_private; |
13887
196932ec9e6a
3236 zio nop-write
George Wilson <george.wilson@delphix.com>
parents:
13776
diff
changeset
|
1321 blkptr_t *bp_orig = &zio->io_bp_orig; |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1322 |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1323 if (zio->io_error == 0 && !BP_IS_HOLE(bp)) { |
13887
196932ec9e6a
3236 zio nop-write
George Wilson <george.wilson@delphix.com>
parents:
13776
diff
changeset
|
1324 /* |
196932ec9e6a
3236 zio nop-write
George Wilson <george.wilson@delphix.com>
parents:
13776
diff
changeset
|
1325 * If we didn't allocate a new block (i.e. ZIO_FLAG_NOPWRITE) |
196932ec9e6a
3236 zio nop-write
George Wilson <george.wilson@delphix.com>
parents:
13776
diff
changeset
|
1326 * then there is nothing to do here. Otherwise, free the |
196932ec9e6a
3236 zio nop-write
George Wilson <george.wilson@delphix.com>
parents:
13776
diff
changeset
|
1327 * newly allocated block in this txg. |
196932ec9e6a
3236 zio nop-write
George Wilson <george.wilson@delphix.com>
parents:
13776
diff
changeset
|
1328 */ |
196932ec9e6a
3236 zio nop-write
George Wilson <george.wilson@delphix.com>
parents:
13776
diff
changeset
|
1329 if (zio->io_flags & ZIO_FLAG_NOPWRITE) { |
196932ec9e6a
3236 zio nop-write
George Wilson <george.wilson@delphix.com>
parents:
13776
diff
changeset
|
1330 ASSERT(BP_EQUAL(bp, bp_orig)); |
196932ec9e6a
3236 zio nop-write
George Wilson <george.wilson@delphix.com>
parents:
13776
diff
changeset
|
1331 } else { |
196932ec9e6a
3236 zio nop-write
George Wilson <george.wilson@delphix.com>
parents:
13776
diff
changeset
|
1332 ASSERT(BP_IS_HOLE(bp_orig) || !BP_EQUAL(bp, bp_orig)); |
196932ec9e6a
3236 zio nop-write
George Wilson <george.wilson@delphix.com>
parents:
13776
diff
changeset
|
1333 ASSERT(zio->io_bp->blk_birth == zio->io_txg); |
196932ec9e6a
3236 zio nop-write
George Wilson <george.wilson@delphix.com>
parents:
13776
diff
changeset
|
1334 ASSERT(zio->io_txg > spa_syncing_txg(zio->io_spa)); |
196932ec9e6a
3236 zio nop-write
George Wilson <george.wilson@delphix.com>
parents:
13776
diff
changeset
|
1335 zio_free(zio->io_spa, zio->io_txg, zio->io_bp); |
196932ec9e6a
3236 zio nop-write
George Wilson <george.wilson@delphix.com>
parents:
13776
diff
changeset
|
1336 } |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1337 } |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1338 |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1339 dmu_tx_commit(dsa->dsa_tx); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1340 |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1341 dsa->dsa_done(dsa->dsa_zgd, zio->io_error); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1342 |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1343 kmem_free(dsa, sizeof (*dsa)); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1344 } |
3547
e396e0a440b1
6512391 DMU should leverage ZIO dependencies to achieve greater parallelism
maybee
parents:
3444
diff
changeset
|
1345 |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1346 static int |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1347 dmu_sync_late_arrival(zio_t *pio, objset_t *os, dmu_sync_cb_t *done, zgd_t *zgd, |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1348 zio_prop_t *zp, zbookmark_t *zb) |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1349 { |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1350 dmu_sync_arg_t *dsa; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1351 dmu_tx_t *tx; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1352 |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1353 tx = dmu_tx_create(os); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1354 dmu_tx_hold_space(tx, zgd->zgd_db->db_size); |
11670
1d964fb5d948
6595532 ZIL is too talkative
Neil Perrin <Neil.Perrin@Sun.COM>
parents:
11539
diff
changeset
|
1355 if (dmu_tx_assign(tx, TXG_WAIT) != 0) { |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1356 dmu_tx_abort(tx); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1357 return (EIO); /* Make zl_get_data do txg_waited_synced() */ |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1358 } |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1359 |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1360 dsa = kmem_alloc(sizeof (dmu_sync_arg_t), KM_SLEEP); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1361 dsa->dsa_dr = NULL; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1362 dsa->dsa_done = done; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1363 dsa->dsa_zgd = zgd; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1364 dsa->dsa_tx = tx; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1365 |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1366 zio_nowait(zio_write(pio, os->os_spa, dmu_tx_get_txg(tx), zgd->zgd_bp, |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1367 zgd->zgd_db->db_data, zgd->zgd_db->db_size, zp, |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1368 dmu_sync_late_arrival_ready, dmu_sync_late_arrival_done, dsa, |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1369 ZIO_PRIORITY_SYNC_WRITE, ZIO_FLAG_CANFAIL, zb)); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1370 |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1371 return (0); |
2237 | 1372 } |
1373 | |
789 | 1374 /* |
2237 | 1375 * Intent log support: sync the block associated with db to disk. |
1376 * N.B. and XXX: the caller is responsible for making sure that the | |
1377 * data isn't changing while dmu_sync() is writing it. | |
789 | 1378 * |
1379 * Return values: | |
1380 * | |
13887
196932ec9e6a
3236 zio nop-write
George Wilson <george.wilson@delphix.com>
parents:
13776
diff
changeset
|
1381 * EEXIST: this txg has already been synced, so there's nothing to do. |
789 | 1382 * The caller should not log the write. |
1383 * | |
1384 * ENOENT: the block was dbuf_free_range()'d, so there's nothing to do. | |
1385 * The caller should not log the write. | |
1386 * | |
2237 | 1387 * EALREADY: this block is already in the process of being synced. |
1388 * The caller should track its progress (somehow). | |
789 | 1389 * |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1390 * EIO: could not do the I/O. |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1391 * The caller should do a txg_wait_synced(). |
789 | 1392 * |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1393 * 0: the I/O has been initiated. |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1394 * The caller should log this blkptr in the done callback. |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1395 * It is possible that the I/O will fail, in which case |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1396 * the error will be reported to the done callback and |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1397 * propagated to pio from zio_done(). |
789 | 1398 */ |
1399 int | |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1400 dmu_sync(zio_t *pio, uint64_t txg, dmu_sync_cb_t *done, zgd_t *zgd) |
789 | 1401 { |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1402 blkptr_t *bp = zgd->zgd_bp; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1403 dmu_buf_impl_t *db = (dmu_buf_impl_t *)zgd->zgd_db; |
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
1404 objset_t *os = db->db_objset; |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1405 dsl_dataset_t *ds = os->os_dsl_dataset; |
3547
e396e0a440b1
6512391 DMU should leverage ZIO dependencies to achieve greater parallelism
maybee
parents:
3444
diff
changeset
|
1406 dbuf_dirty_record_t *dr; |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1407 dmu_sync_arg_t *dsa; |
2237 | 1408 zbookmark_t zb; |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1409 zio_prop_t zp; |
12684
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
1410 dnode_t *dn; |
789 | 1411 |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1412 ASSERT(pio != NULL); |
789 | 1413 ASSERT(txg != 0); |
1414 | |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1415 SET_BOOKMARK(&zb, ds->ds_object, |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1416 db->db.db_object, db->db_level, db->db_blkid); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1417 |
12684
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
1418 DB_DNODE_ENTER(db); |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
1419 dn = DB_DNODE(db); |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
1420 dmu_write_policy(os, dn, db->db_level, WP_DMU_SYNC, &zp); |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
1421 DB_DNODE_EXIT(db); |
789 | 1422 |
1423 /* | |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1424 * If we're frozen (running ziltest), we always need to generate a bp. |
1544 | 1425 */ |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1426 if (txg > spa_freeze_txg(os->os_spa)) |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1427 return (dmu_sync_late_arrival(pio, os, done, zgd, &zp, &zb)); |
1544 | 1428 |
1429 /* | |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1430 * Grabbing db_mtx now provides a barrier between dbuf_sync_leaf() |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1431 * and us. If we determine that this txg is not yet syncing, |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1432 * but it begins to sync a moment later, that's OK because the |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1433 * sync thread will block in dbuf_sync_leaf() until we drop db_mtx. |
789 | 1434 */ |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1435 mutex_enter(&db->db_mtx); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1436 |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1437 if (txg <= spa_last_synced_txg(os->os_spa)) { |
789 | 1438 /* |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1439 * This txg has already synced. There's nothing to do. |
789 | 1440 */ |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1441 mutex_exit(&db->db_mtx); |
2237 | 1442 return (EEXIST); |
789 | 1443 } |
1444 | |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1445 if (txg <= spa_syncing_txg(os->os_spa)) { |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1446 /* |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1447 * This txg is currently syncing, so we can't mess with |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1448 * the dirty record anymore; just write a new log block. |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1449 */ |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1450 mutex_exit(&db->db_mtx); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1451 return (dmu_sync_late_arrival(pio, os, done, zgd, &zp, &zb)); |
2237 | 1452 } |
1453 | |
3547
e396e0a440b1
6512391 DMU should leverage ZIO dependencies to achieve greater parallelism
maybee
parents:
3444
diff
changeset
|
1454 dr = db->db_last_dirty; |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1455 while (dr && dr->dr_txg != txg) |
3547
e396e0a440b1
6512391 DMU should leverage ZIO dependencies to achieve greater parallelism
maybee
parents:
3444
diff
changeset
|
1456 dr = dr->dr_next; |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1457 |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1458 if (dr == NULL) { |
2237 | 1459 /* |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1460 * There's no dr for this dbuf, so it must have been freed. |
2237 | 1461 * There's no need to log writes to freed blocks, so we're done. |
1462 */ | |
1463 mutex_exit(&db->db_mtx); | |
789 | 1464 return (ENOENT); |
1465 } | |
1466 | |
13887
196932ec9e6a
3236 zio nop-write
George Wilson <george.wilson@delphix.com>
parents:
13776
diff
changeset
|
1467 ASSERT(dr->dr_next == NULL || dr->dr_next->dr_txg < txg); |
196932ec9e6a
3236 zio nop-write
George Wilson <george.wilson@delphix.com>
parents:
13776
diff
changeset
|
1468 |
196932ec9e6a
3236 zio nop-write
George Wilson <george.wilson@delphix.com>
parents:
13776
diff
changeset
|
1469 /* |
196932ec9e6a
3236 zio nop-write
George Wilson <george.wilson@delphix.com>
parents:
13776
diff
changeset
|
1470 * Assume the on-disk data is X, the current syncing data is Y, |
196932ec9e6a
3236 zio nop-write
George Wilson <george.wilson@delphix.com>
parents:
13776
diff
changeset
|
1471 * and the current in-memory data is Z (currently in dmu_sync). |
196932ec9e6a
3236 zio nop-write
George Wilson <george.wilson@delphix.com>
parents:
13776
diff
changeset
|
1472 * X and Z are identical but Y is has been modified. Normally, |
196932ec9e6a
3236 zio nop-write
George Wilson <george.wilson@delphix.com>
parents:
13776
diff
changeset
|
1473 * when X and Z are the same we will perform a nopwrite but if Y |
196932ec9e6a
3236 zio nop-write
George Wilson <george.wilson@delphix.com>
parents:
13776
diff
changeset
|
1474 * is different we must disable nopwrite since the resulting write |
196932ec9e6a
3236 zio nop-write
George Wilson <george.wilson@delphix.com>
parents:
13776
diff
changeset
|
1475 * of Y to disk can free the block containing X. If we allowed a |
196932ec9e6a
3236 zio nop-write
George Wilson <george.wilson@delphix.com>
parents:
13776
diff
changeset
|
1476 * nopwrite to occur the block pointing to Z would reference a freed |
196932ec9e6a
3236 zio nop-write
George Wilson <george.wilson@delphix.com>
parents:
13776
diff
changeset
|
1477 * block. Since this is a rare case we simplify this by disabling |
196932ec9e6a
3236 zio nop-write
George Wilson <george.wilson@delphix.com>
parents:
13776
diff
changeset
|
1478 * nopwrite if the current dmu_sync-ing dbuf has been modified in |
196932ec9e6a
3236 zio nop-write
George Wilson <george.wilson@delphix.com>
parents:
13776
diff
changeset
|
1479 * a previous transaction. |
196932ec9e6a
3236 zio nop-write
George Wilson <george.wilson@delphix.com>
parents:
13776
diff
changeset
|
1480 */ |
196932ec9e6a
3236 zio nop-write
George Wilson <george.wilson@delphix.com>
parents:
13776
diff
changeset
|
1481 if (dr->dr_next) |
196932ec9e6a
3236 zio nop-write
George Wilson <george.wilson@delphix.com>
parents:
13776
diff
changeset
|
1482 zp.zp_nopwrite = B_FALSE; |
196932ec9e6a
3236 zio nop-write
George Wilson <george.wilson@delphix.com>
parents:
13776
diff
changeset
|
1483 |
3547
e396e0a440b1
6512391 DMU should leverage ZIO dependencies to achieve greater parallelism
maybee
parents:
3444
diff
changeset
|
1484 ASSERT(dr->dr_txg == txg); |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1485 if (dr->dt.dl.dr_override_state == DR_IN_DMU_SYNC || |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1486 dr->dt.dl.dr_override_state == DR_OVERRIDDEN) { |
3547
e396e0a440b1
6512391 DMU should leverage ZIO dependencies to achieve greater parallelism
maybee
parents:
3444
diff
changeset
|
1487 /* |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1488 * We have already issued a sync write for this buffer, |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1489 * or this buffer has already been synced. It could not |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1490 * have been dirtied since, or we would have cleared the state. |
3547
e396e0a440b1
6512391 DMU should leverage ZIO dependencies to achieve greater parallelism
maybee
parents:
3444
diff
changeset
|
1491 */ |
e396e0a440b1
6512391 DMU should leverage ZIO dependencies to achieve greater parallelism
maybee
parents:
3444
diff
changeset
|
1492 mutex_exit(&db->db_mtx); |
e396e0a440b1
6512391 DMU should leverage ZIO dependencies to achieve greater parallelism
maybee
parents:
3444
diff
changeset
|
1493 return (EALREADY); |
e396e0a440b1
6512391 DMU should leverage ZIO dependencies to achieve greater parallelism
maybee
parents:
3444
diff
changeset
|
1494 } |
e396e0a440b1
6512391 DMU should leverage ZIO dependencies to achieve greater parallelism
maybee
parents:
3444
diff
changeset
|
1495 |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1496 ASSERT(dr->dt.dl.dr_override_state == DR_NOT_OVERRIDDEN); |
3547
e396e0a440b1
6512391 DMU should leverage ZIO dependencies to achieve greater parallelism
maybee
parents:
3444
diff
changeset
|
1497 dr->dt.dl.dr_override_state = DR_IN_DMU_SYNC; |
2237 | 1498 mutex_exit(&db->db_mtx); |
7754
b80e4842ad54
6754011 SPA 3.0: lock breakup, i/o pipeline refactoring, device failure handling
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
7468
diff
changeset
|
1499 |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1500 dsa = kmem_alloc(sizeof (dmu_sync_arg_t), KM_SLEEP); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1501 dsa->dsa_dr = dr; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1502 dsa->dsa_done = done; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1503 dsa->dsa_zgd = zgd; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1504 dsa->dsa_tx = NULL; |
7754
b80e4842ad54
6754011 SPA 3.0: lock breakup, i/o pipeline refactoring, device failure handling
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
7468
diff
changeset
|
1505 |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1506 zio_nowait(arc_write(pio, os->os_spa, txg, |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1507 bp, dr->dt.dl.dr_data, DBUF_IS_L2CACHEABLE(db), &zp, |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1508 dmu_sync_ready, dmu_sync_done, dsa, |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1509 ZIO_PRIORITY_SYNC_WRITE, ZIO_FLAG_CANFAIL, &zb)); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1510 |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1511 return (0); |
789 | 1512 } |
1513 | |
1514 int | |
1515 dmu_object_set_blocksize(objset_t *os, uint64_t object, uint64_t size, int ibs, | |
1516 dmu_tx_t *tx) | |
1517 { | |
1544 | 1518 dnode_t *dn; |
1519 int err; | |
1520 | |
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
1521 err = dnode_hold(os, object, FTAG, &dn); |
1544 | 1522 if (err) |
1523 return (err); | |
1524 err = dnode_set_blksz(dn, size, ibs, tx); | |
789 | 1525 dnode_rele(dn, FTAG); |
1526 return (err); | |
1527 } | |
1528 | |
1529 void | |
1530 dmu_object_set_checksum(objset_t *os, uint64_t object, uint8_t checksum, | |
1531 dmu_tx_t *tx) | |
1532 { | |
1544 | 1533 dnode_t *dn; |
1534 | |
1535 /* XXX assumes dnode_hold will not get an i/o error */ | |
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
1536 (void) dnode_hold(os, object, FTAG, &dn); |
789 | 1537 ASSERT(checksum < ZIO_CHECKSUM_FUNCTIONS); |
1538 dn->dn_checksum = checksum; | |
1539 dnode_setdirty(dn, tx); | |
1540 dnode_rele(dn, FTAG); | |
1541 } | |
1542 | |
1543 void | |
1544 dmu_object_set_compress(objset_t *os, uint64_t object, uint8_t compress, | |
1545 dmu_tx_t *tx) | |
1546 { | |
1544 | 1547 dnode_t *dn; |
1548 | |
1549 /* XXX assumes dnode_hold will not get an i/o error */ | |
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
1550 (void) dnode_hold(os, object, FTAG, &dn); |
789 | 1551 ASSERT(compress < ZIO_COMPRESS_FUNCTIONS); |
1552 dn->dn_compress = compress; | |
1553 dnode_setdirty(dn, tx); | |
1554 dnode_rele(dn, FTAG); | |
1555 } | |
1556 | |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1557 int zfs_mdcomp_disable = 0; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1558 |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1559 void |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1560 dmu_write_policy(objset_t *os, dnode_t *dn, int level, int wp, zio_prop_t *zp) |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1561 { |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1562 dmu_object_type_t type = dn ? dn->dn_type : DMU_OT_OBJSET; |
13700
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12684
diff
changeset
|
1563 boolean_t ismd = (level > 0 || DMU_OT_IS_METADATA(type) || |
12493
89ce40422cea
6952177 SA handling of on-disk corruption can be improved
Mark Shellenbaum <Mark.Shellenbaum@Oracle.COM>
parents:
12470
diff
changeset
|
1564 (wp & WP_SPILL)); |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1565 enum zio_checksum checksum = os->os_checksum; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1566 enum zio_compress compress = os->os_compress; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1567 enum zio_checksum dedup_checksum = os->os_dedup_checksum; |
13887
196932ec9e6a
3236 zio nop-write
George Wilson <george.wilson@delphix.com>
parents:
13776
diff
changeset
|
1568 boolean_t dedup, nopwrite; |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1569 boolean_t dedup_verify = os->os_dedup_verify; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1570 int copies = os->os_copies; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1571 |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1572 /* |
13887
196932ec9e6a
3236 zio nop-write
George Wilson <george.wilson@delphix.com>
parents:
13776
diff
changeset
|
1573 * We maintain different write policies for each of the following |
196932ec9e6a
3236 zio nop-write
George Wilson <george.wilson@delphix.com>
parents:
13776
diff
changeset
|
1574 * types of data: |
196932ec9e6a
3236 zio nop-write
George Wilson <george.wilson@delphix.com>
parents:
13776
diff
changeset
|
1575 * 1. metadata |
196932ec9e6a
3236 zio nop-write
George Wilson <george.wilson@delphix.com>
parents:
13776
diff
changeset
|
1576 * 2. preallocated blocks (i.e. level-0 blocks of a dump device) |
196932ec9e6a
3236 zio nop-write
George Wilson <george.wilson@delphix.com>
parents:
13776
diff
changeset
|
1577 * 3. all other level 0 blocks |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1578 */ |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1579 if (ismd) { |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1580 /* |
13887
196932ec9e6a
3236 zio nop-write
George Wilson <george.wilson@delphix.com>
parents:
13776
diff
changeset
|
1581 * XXX -- we should design a compression algorithm |
196932ec9e6a
3236 zio nop-write
George Wilson <george.wilson@delphix.com>
parents:
13776
diff
changeset
|
1582 * that specializes in arrays of bps. |
196932ec9e6a
3236 zio nop-write
George Wilson <george.wilson@delphix.com>
parents:
13776
diff
changeset
|
1583 */ |
196932ec9e6a
3236 zio nop-write
George Wilson <george.wilson@delphix.com>
parents:
13776
diff
changeset
|
1584 compress = zfs_mdcomp_disable ? ZIO_COMPRESS_EMPTY : |
196932ec9e6a
3236 zio nop-write
George Wilson <george.wilson@delphix.com>
parents:
13776
diff
changeset
|
1585 ZIO_COMPRESS_LZJB; |
196932ec9e6a
3236 zio nop-write
George Wilson <george.wilson@delphix.com>
parents:
13776
diff
changeset
|
1586 |
196932ec9e6a
3236 zio nop-write
George Wilson <george.wilson@delphix.com>
parents:
13776
diff
changeset
|
1587 /* |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1588 * Metadata always gets checksummed. If the data |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1589 * checksum is multi-bit correctable, and it's not a |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1590 * ZBT-style checksum, then it's suitable for metadata |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1591 * as well. Otherwise, the metadata checksum defaults |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1592 * to fletcher4. |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1593 */ |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1594 if (zio_checksum_table[checksum].ci_correctable < 1 || |
11670
1d964fb5d948
6595532 ZIL is too talkative
Neil Perrin <Neil.Perrin@Sun.COM>
parents:
11539
diff
changeset
|
1595 zio_checksum_table[checksum].ci_eck) |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1596 checksum = ZIO_CHECKSUM_FLETCHER_4; |
13887
196932ec9e6a
3236 zio nop-write
George Wilson <george.wilson@delphix.com>
parents:
13776
diff
changeset
|
1597 |
196932ec9e6a
3236 zio nop-write
George Wilson <george.wilson@delphix.com>
parents:
13776
diff
changeset
|
1598 dedup = B_FALSE; |
196932ec9e6a
3236 zio nop-write
George Wilson <george.wilson@delphix.com>
parents:
13776
diff
changeset
|
1599 nopwrite = B_FALSE; |
196932ec9e6a
3236 zio nop-write
George Wilson <george.wilson@delphix.com>
parents:
13776
diff
changeset
|
1600 } else if (wp & WP_NOFILL) { |
196932ec9e6a
3236 zio nop-write
George Wilson <george.wilson@delphix.com>
parents:
13776
diff
changeset
|
1601 ASSERT(level == 0); |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1602 |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1603 /* |
13887
196932ec9e6a
3236 zio nop-write
George Wilson <george.wilson@delphix.com>
parents:
13776
diff
changeset
|
1604 * If we're writing preallocated blocks, we aren't actually |
196932ec9e6a
3236 zio nop-write
George Wilson <george.wilson@delphix.com>
parents:
13776
diff
changeset
|
1605 * writing them so don't set any policy properties. These |
196932ec9e6a
3236 zio nop-write
George Wilson <george.wilson@delphix.com>
parents:
13776
diff
changeset
|
1606 * blocks are currently only used by an external subsystem |
196932ec9e6a
3236 zio nop-write
George Wilson <george.wilson@delphix.com>
parents:
13776
diff
changeset
|
1607 * outside of zfs (i.e. dump) and not written by the zio |
196932ec9e6a
3236 zio nop-write
George Wilson <george.wilson@delphix.com>
parents:
13776
diff
changeset
|
1608 * pipeline. |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1609 */ |
13887
196932ec9e6a
3236 zio nop-write
George Wilson <george.wilson@delphix.com>
parents:
13776
diff
changeset
|
1610 compress = ZIO_COMPRESS_OFF; |
196932ec9e6a
3236 zio nop-write
George Wilson <george.wilson@delphix.com>
parents:
13776
diff
changeset
|
1611 checksum = ZIO_CHECKSUM_OFF; |
196932ec9e6a
3236 zio nop-write
George Wilson <george.wilson@delphix.com>
parents:
13776
diff
changeset
|
1612 dedup = B_FALSE; |
196932ec9e6a
3236 zio nop-write
George Wilson <george.wilson@delphix.com>
parents:
13776
diff
changeset
|
1613 nopwrite = B_FALSE; |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1614 } else { |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1615 compress = zio_compress_select(dn->dn_compress, compress); |
13887
196932ec9e6a
3236 zio nop-write
George Wilson <george.wilson@delphix.com>
parents:
13776
diff
changeset
|
1616 |
196932ec9e6a
3236 zio nop-write
George Wilson <george.wilson@delphix.com>
parents:
13776
diff
changeset
|
1617 checksum = (dedup_checksum == ZIO_CHECKSUM_OFF) ? |
196932ec9e6a
3236 zio nop-write
George Wilson <george.wilson@delphix.com>
parents:
13776
diff
changeset
|
1618 zio_checksum_select(dn->dn_checksum, checksum) : |
196932ec9e6a
3236 zio nop-write
George Wilson <george.wilson@delphix.com>
parents:
13776
diff
changeset
|
1619 dedup_checksum; |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1620 |
13887
196932ec9e6a
3236 zio nop-write
George Wilson <george.wilson@delphix.com>
parents:
13776
diff
changeset
|
1621 /* |
196932ec9e6a
3236 zio nop-write
George Wilson <george.wilson@delphix.com>
parents:
13776
diff
changeset
|
1622 * Determine dedup setting. If we are in dmu_sync(), |
196932ec9e6a
3236 zio nop-write
George Wilson <george.wilson@delphix.com>
parents:
13776
diff
changeset
|
1623 * we won't actually dedup now because that's all |
196932ec9e6a
3236 zio nop-write
George Wilson <george.wilson@delphix.com>
parents:
13776
diff
changeset
|
1624 * done in syncing context; but we do want to use the |
196932ec9e6a
3236 zio nop-write
George Wilson <george.wilson@delphix.com>
parents:
13776
diff
changeset
|
1625 * dedup checkum. If the checksum is not strong |
196932ec9e6a
3236 zio nop-write
George Wilson <george.wilson@delphix.com>
parents:
13776
diff
changeset
|
1626 * enough to ensure unique signatures, force |
196932ec9e6a
3236 zio nop-write
George Wilson <george.wilson@delphix.com>
parents:
13776
diff
changeset
|
1627 * dedup_verify. |
196932ec9e6a
3236 zio nop-write
George Wilson <george.wilson@delphix.com>
parents:
13776
diff
changeset
|
1628 */ |
196932ec9e6a
3236 zio nop-write
George Wilson <george.wilson@delphix.com>
parents:
13776
diff
changeset
|
1629 if (dedup_checksum != ZIO_CHECKSUM_OFF) { |
196932ec9e6a
3236 zio nop-write
George Wilson <george.wilson@delphix.com>
parents:
13776
diff
changeset
|
1630 dedup = (wp & WP_DMU_SYNC) ? B_FALSE : B_TRUE; |
196932ec9e6a
3236 zio nop-write
George Wilson <george.wilson@delphix.com>
parents:
13776
diff
changeset
|
1631 if (!zio_checksum_table[checksum].ci_dedup) |
196932ec9e6a
3236 zio nop-write
George Wilson <george.wilson@delphix.com>
parents:
13776
diff
changeset
|
1632 dedup_verify = B_TRUE; |
196932ec9e6a
3236 zio nop-write
George Wilson <george.wilson@delphix.com>
parents:
13776
diff
changeset
|
1633 } |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1634 |
13887
196932ec9e6a
3236 zio nop-write
George Wilson <george.wilson@delphix.com>
parents:
13776
diff
changeset
|
1635 /* |
196932ec9e6a
3236 zio nop-write
George Wilson <george.wilson@delphix.com>
parents:
13776
diff
changeset
|
1636 * Enable nopwrite if we have a cryptographically secure |
196932ec9e6a
3236 zio nop-write
George Wilson <george.wilson@delphix.com>
parents:
13776
diff
changeset
|
1637 * checksum that has no known collisions (i.e. SHA-256) |
196932ec9e6a
3236 zio nop-write
George Wilson <george.wilson@delphix.com>
parents:
13776
diff
changeset
|
1638 * and compression is enabled. We don't enable nopwrite if |
196932ec9e6a
3236 zio nop-write
George Wilson <george.wilson@delphix.com>
parents:
13776
diff
changeset
|
1639 * dedup is enabled as the two features are mutually exclusive. |
196932ec9e6a
3236 zio nop-write
George Wilson <george.wilson@delphix.com>
parents:
13776
diff
changeset
|
1640 */ |
196932ec9e6a
3236 zio nop-write
George Wilson <george.wilson@delphix.com>
parents:
13776
diff
changeset
|
1641 nopwrite = (!dedup && zio_checksum_table[checksum].ci_dedup && |
196932ec9e6a
3236 zio nop-write
George Wilson <george.wilson@delphix.com>
parents:
13776
diff
changeset
|
1642 compress != ZIO_COMPRESS_OFF && zfs_nopwrite_enabled); |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1643 } |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1644 |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1645 zp->zp_checksum = checksum; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1646 zp->zp_compress = compress; |
11935
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11670
diff
changeset
|
1647 zp->zp_type = (wp & WP_SPILL) ? dn->dn_bonustype : type; |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1648 zp->zp_level = level; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1649 zp->zp_copies = MIN(copies + ismd, spa_max_replication(os->os_spa)); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1650 zp->zp_dedup = dedup; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1651 zp->zp_dedup_verify = dedup && dedup_verify; |
13887
196932ec9e6a
3236 zio nop-write
George Wilson <george.wilson@delphix.com>
parents:
13776
diff
changeset
|
1652 zp->zp_nopwrite = nopwrite; |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1653 } |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1654 |
1775
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1731
diff
changeset
|
1655 int |
789 | 1656 dmu_offset_next(objset_t *os, uint64_t object, boolean_t hole, uint64_t *off) |
1657 { | |
1658 dnode_t *dn; | |
1659 int i, err; | |
1660 | |
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
1661 err = dnode_hold(os, object, FTAG, &dn); |
1544 | 1662 if (err) |
1663 return (err); | |
789 | 1664 /* |
1665 * Sync any current changes before | |
1666 * we go trundling through the block pointers. | |
1667 */ | |
1668 for (i = 0; i < TXG_SIZE; i++) { | |
1596
2e2377ccbf85
6395371 ASSERT in dmu_tx_count_free: blkid + i < dn->dn_phys->dn_nblkptr
ahrens
parents:
1544
diff
changeset
|
1669 if (list_link_active(&dn->dn_dirty_link[i])) |
789 | 1670 break; |
1671 } | |
1672 if (i != TXG_SIZE) { | |
1673 dnode_rele(dn, FTAG); | |
1674 txg_wait_synced(dmu_objset_pool(os), 0); | |
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
1675 err = dnode_hold(os, object, FTAG, &dn); |
1544 | 1676 if (err) |
1677 return (err); | |
789 | 1678 } |
1679 | |
6992 | 1680 err = dnode_next_offset(dn, (hole ? DNODE_FIND_HOLE : 0), off, 1, 1, 0); |
789 | 1681 dnode_rele(dn, FTAG); |
1682 | |
1683 return (err); | |
1684 } | |
1685 | |
1686 void | |
1687 dmu_object_info_from_dnode(dnode_t *dn, dmu_object_info_t *doi) | |
1688 { | |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1689 dnode_phys_t *dnp; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1690 |
789 | 1691 rw_enter(&dn->dn_struct_rwlock, RW_READER); |
1692 mutex_enter(&dn->dn_mtx); | |
1693 | |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1694 dnp = dn->dn_phys; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1695 |
789 | 1696 doi->doi_data_block_size = dn->dn_datablksz; |
1697 doi->doi_metadata_block_size = dn->dn_indblkshift ? | |
1698 1ULL << dn->dn_indblkshift : 0; | |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1699 doi->doi_type = dn->dn_type; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1700 doi->doi_bonus_type = dn->dn_bonustype; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1701 doi->doi_bonus_size = dn->dn_bonuslen; |
789 | 1702 doi->doi_indirection = dn->dn_nlevels; |
1703 doi->doi_checksum = dn->dn_checksum; | |
1704 doi->doi_compress = dn->dn_compress; | |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1705 doi->doi_physical_blocks_512 = (DN_USED_BYTES(dnp) + 256) >> 9; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1706 doi->doi_max_offset = (dnp->dn_maxblkid + 1) * dn->dn_datablksz; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1707 doi->doi_fill_count = 0; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1708 for (int i = 0; i < dnp->dn_nblkptr; i++) |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10810
diff
changeset
|
1709 doi->doi_fill_count += dnp->dn_blkptr[i].blk_fill; |
789 | 1710 |
1711 mutex_exit(&dn->dn_mtx); | |
1712 rw_exit(&dn->dn_struct_rwlock); | |
1713 } | |
1714 | |
1715 /* | |
1716 * Get information on a DMU object. | |
1717 * If doi is NULL, just indicates whether the object exists. | |
1718 */ | |
1719 int | |
1720 dmu_object_info(objset_t *os, uint64_t object, dmu_object_info_t *doi) | |
1721 { | |
1544 | 1722 dnode_t *dn; |
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
1723 int err = dnode_hold(os, object, FTAG, &dn); |
789 | 1724 |
1544 | 1725 if (err) |
1726 return (err); | |
789 | 1727 |
1728 if (doi != NULL) | |
1729 dmu_object_info_from_dnode(dn, doi); | |
1730 | |
1731 dnode_rele(dn, FTAG); | |
1732 return (0); | |
1733 } | |
1734 | |
1735 /* | |
1736 * As above, but faster; can be used when you have a held dbuf in hand. | |
1737 */ | |
1738 void | |
12684
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
1739 dmu_object_info_from_db(dmu_buf_t *db_fake, dmu_object_info_t *doi) |
789 | 1740 { |
12684
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
1741 dmu_buf_impl_t *db = (dmu_buf_impl_t *)db_fake; |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
1742 |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
1743 DB_DNODE_ENTER(db); |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
1744 dmu_object_info_from_dnode(DB_DNODE(db), doi); |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
1745 DB_DNODE_EXIT(db); |
789 | 1746 } |
1747 | |
1748 /* | |
1749 * Faster still when you only care about the size. | |
1750 * This is specifically optimized for zfs_getattr(). | |
1751 */ | |
1752 void | |
12684
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
1753 dmu_object_size_from_db(dmu_buf_t *db_fake, uint32_t *blksize, |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
1754 u_longlong_t *nblk512) |
789 | 1755 { |
12684
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
1756 dmu_buf_impl_t *db = (dmu_buf_impl_t *)db_fake; |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
1757 dnode_t *dn; |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
1758 |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
1759 DB_DNODE_ENTER(db); |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
1760 dn = DB_DNODE(db); |
789 | 1761 |
1762 *blksize = dn->dn_datablksz; | |
2082 | 1763 /* add 1 for dnode space */ |
1764 *nblk512 = ((DN_USED_BYTES(dn->dn_phys) + SPA_MINBLOCKSIZE/2) >> | |
1765 SPA_MINBLOCKSHIFT) + 1; | |
12684
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
1766 DB_DNODE_EXIT(db); |
789 | 1767 } |
1768 | |
1769 void | |
1770 byteswap_uint64_array(void *vbuf, size_t size) | |
1771 { | |
1772 uint64_t *buf = vbuf; | |
1773 size_t count = size >> 3; | |
1774 int i; | |
1775 | |
1776 ASSERT((size & 7) == 0); | |
1777 | |
1778 for (i = 0; i < count; i++) | |
1779 buf[i] = BSWAP_64(buf[i]); | |
1780 } | |
1781 | |
1782 void | |
1783 byteswap_uint32_array(void *vbuf, size_t size) | |
1784 { | |
1785 uint32_t *buf = vbuf; | |
1786 size_t count = size >> 2; | |
1787 int i; | |
1788 | |
1789 ASSERT((size & 3) == 0); | |
1790 | |
1791 for (i = 0; i < count; i++) | |
1792 buf[i] = BSWAP_32(buf[i]); | |
1793 } | |
1794 | |
1795 void | |
1796 byteswap_uint16_array(void *vbuf, size_t size) | |
1797 { | |
1798 uint16_t *buf = vbuf; | |
1799 size_t count = size >> 1; | |
1800 int i; | |
1801 | |
1802 ASSERT((size & 1) == 0); | |
1803 | |
1804 for (i = 0; i < count; i++) | |
1805 buf[i] = BSWAP_16(buf[i]); | |
1806 } | |
1807 | |
1808 /* ARGSUSED */ | |
1809 void | |
1810 byteswap_uint8_array(void *vbuf, size_t size) | |
1811 { | |
1812 } | |
1813 | |
1814 void | |
1815 dmu_init(void) | |
1816 { | |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12285
diff
changeset
|
1817 zfs_dbgmsg_init(); |
12684
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
1818 sa_cache_init(); |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
1819 xuio_stat_init(); |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
1820 dmu_objset_init(); |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
1821 dnode_init(); |
789 | 1822 dbuf_init(); |
10474
0e96dd3b905a
6859997 zfs caching performance problem
Rich Morris <Richard.Morris@Sun.COM>
parents:
10298
diff
changeset
|
1823 zfetch_init(); |
13776
cd512c80fd75
3086 unnecessarily setting DS_FLAG_INCONSISTENT on async destroyed datasets
Matthew Ahrens <mahrens@delphix.com>
parents:
13700
diff
changeset
|
1824 l2arc_init(); |
789 | 1825 arc_init(); |
1826 } | |
1827 | |
1828 void | |
1829 dmu_fini(void) | |
1830 { | |
13776
cd512c80fd75
3086 unnecessarily setting DS_FLAG_INCONSISTENT on async destroyed datasets
Matthew Ahrens <mahrens@delphix.com>
parents:
13700
diff
changeset
|
1831 arc_fini(); |
12684
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
1832 l2arc_fini(); |
10474
0e96dd3b905a
6859997 zfs caching performance problem
Rich Morris <Richard.Morris@Sun.COM>
parents:
10298
diff
changeset
|
1833 zfetch_fini(); |
12684
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
1834 dbuf_fini(); |
789 | 1835 dnode_fini(); |
12684
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
1836 dmu_objset_fini(); |
11539
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
1837 xuio_stat_fini(); |
11935
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11670
diff
changeset
|
1838 sa_cache_fini(); |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12285
diff
changeset
|
1839 zfs_dbgmsg_fini(); |
789 | 1840 } |