author | Joshua M. Clulow <jmc@joyent.com> |
Mon, 04 Mar 2013 23:52:56 +0000 | |
changeset 14188 | afe390b9f1e0 |
parent 14167 | dceb17481b99 |
permissions | -rw-r--r-- |
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 |
/* |
|
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:
11935
diff
changeset
|
22 |
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. |
13980
d7059eb1884c
3598 want to dtrace when errors are generated in zfs
Matthew Ahrens <mahrens@delphix.com>
parents:
13973
diff
changeset
|
23 |
* Copyright (c) 2013 by Delphix. All rights reserved. |
14039
6cfd5a5778b9
3137 L2ARC compression
Saso Kiselkov <skiselkov@gmail.com>
parents:
13980
diff
changeset
|
24 |
* Copyright (c) 2013 by Saso Kiselkov. All rights reserved. |
789 | 25 |
*/ |
26 |
||
12294
2a74b443e6b1
PSARC/2010/108 zil synchronicity
Mark J Musante <Mark.Musante@Sun.COM>
parents:
12178
diff
changeset
|
27 |
/* Portions Copyright 2010 Robert Milkowski */ |
2a74b443e6b1
PSARC/2010/108 zil synchronicity
Mark J Musante <Mark.Musante@Sun.COM>
parents:
12178
diff
changeset
|
28 |
|
4543 | 29 |
#include <sys/cred.h> |
789 | 30 |
#include <sys/zfs_context.h> |
31 |
#include <sys/dmu_objset.h> |
|
32 |
#include <sys/dsl_dir.h> |
|
33 |
#include <sys/dsl_dataset.h> |
|
34 |
#include <sys/dsl_prop.h> |
|
35 |
#include <sys/dsl_pool.h> |
|
2199 | 36 |
#include <sys/dsl_synctask.h> |
4543 | 37 |
#include <sys/dsl_deleg.h> |
789 | 38 |
#include <sys/dnode.h> |
39 |
#include <sys/dbuf.h> |
|
2885 | 40 |
#include <sys/zvol.h> |
789 | 41 |
#include <sys/dmu_tx.h> |
42 |
#include <sys/zap.h> |
|
43 |
#include <sys/zil.h> |
|
44 |
#include <sys/dmu_impl.h> |
|
4543 | 45 |
#include <sys/zfs_ioctl.h> |
11935
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11620
diff
changeset
|
46 |
#include <sys/sa.h> |
13055 | 47 |
#include <sys/zfs_onexit.h> |
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
48 |
#include <sys/dsl_destroy.h> |
789 | 49 |
|
12684
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
50 |
/* |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
51 |
* Needed to close a window in dnode_move() that allows the objset to be freed |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
52 |
* before it can be safely accessed. |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
53 |
*/ |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
54 |
krwlock_t os_lock; |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
55 |
|
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
56 |
void |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
57 |
dmu_objset_init(void) |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
58 |
{ |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
59 |
rw_init(&os_lock, NULL, RW_DEFAULT, NULL); |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
60 |
} |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
61 |
|
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
62 |
void |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
63 |
dmu_objset_fini(void) |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
64 |
{ |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
65 |
rw_destroy(&os_lock); |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
66 |
} |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
67 |
|
789 | 68 |
spa_t * |
69 |
dmu_objset_spa(objset_t *os) |
|
70 |
{ |
|
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
71 |
return (os->os_spa); |
789 | 72 |
} |
73 |
||
74 |
zilog_t * |
|
75 |
dmu_objset_zil(objset_t *os) |
|
76 |
{ |
|
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
77 |
return (os->os_zil); |
789 | 78 |
} |
79 |
||
80 |
dsl_pool_t * |
|
81 |
dmu_objset_pool(objset_t *os) |
|
82 |
{ |
|
83 |
dsl_dataset_t *ds; |
|
84 |
||
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
85 |
if ((ds = os->os_dsl_dataset) != NULL && ds->ds_dir) |
789 | 86 |
return (ds->ds_dir->dd_pool); |
87 |
else |
|
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
88 |
return (spa_get_dsl(os->os_spa)); |
789 | 89 |
} |
90 |
||
91 |
dsl_dataset_t * |
|
92 |
dmu_objset_ds(objset_t *os) |
|
93 |
{ |
|
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
94 |
return (os->os_dsl_dataset); |
789 | 95 |
} |
96 |
||
97 |
dmu_objset_type_t |
|
98 |
dmu_objset_type(objset_t *os) |
|
99 |
{ |
|
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
100 |
return (os->os_phys->os_type); |
789 | 101 |
} |
102 |
||
103 |
void |
|
104 |
dmu_objset_name(objset_t *os, char *buf) |
|
105 |
{ |
|
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
106 |
dsl_dataset_name(os->os_dsl_dataset, buf); |
789 | 107 |
} |
108 |
||
109 |
uint64_t |
|
110 |
dmu_objset_id(objset_t *os) |
|
111 |
{ |
|
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
112 |
dsl_dataset_t *ds = os->os_dsl_dataset; |
789 | 113 |
|
114 |
return (ds ? ds->ds_object : 0); |
|
115 |
} |
|
116 |
||
10310
ba87b3315737
PSARC 2009/423 ZFS logbias property
Neil Perrin <Neil.Perrin@Sun.COM>
parents:
10298
diff
changeset
|
117 |
uint64_t |
12294
2a74b443e6b1
PSARC/2010/108 zil synchronicity
Mark J Musante <Mark.Musante@Sun.COM>
parents:
12178
diff
changeset
|
118 |
dmu_objset_syncprop(objset_t *os) |
2a74b443e6b1
PSARC/2010/108 zil synchronicity
Mark J Musante <Mark.Musante@Sun.COM>
parents:
12178
diff
changeset
|
119 |
{ |
2a74b443e6b1
PSARC/2010/108 zil synchronicity
Mark J Musante <Mark.Musante@Sun.COM>
parents:
12178
diff
changeset
|
120 |
return (os->os_sync); |
2a74b443e6b1
PSARC/2010/108 zil synchronicity
Mark J Musante <Mark.Musante@Sun.COM>
parents:
12178
diff
changeset
|
121 |
} |
2a74b443e6b1
PSARC/2010/108 zil synchronicity
Mark J Musante <Mark.Musante@Sun.COM>
parents:
12178
diff
changeset
|
122 |
|
2a74b443e6b1
PSARC/2010/108 zil synchronicity
Mark J Musante <Mark.Musante@Sun.COM>
parents:
12178
diff
changeset
|
123 |
uint64_t |
10310
ba87b3315737
PSARC 2009/423 ZFS logbias property
Neil Perrin <Neil.Perrin@Sun.COM>
parents:
10298
diff
changeset
|
124 |
dmu_objset_logbias(objset_t *os) |
ba87b3315737
PSARC 2009/423 ZFS logbias property
Neil Perrin <Neil.Perrin@Sun.COM>
parents:
10298
diff
changeset
|
125 |
{ |
ba87b3315737
PSARC 2009/423 ZFS logbias property
Neil Perrin <Neil.Perrin@Sun.COM>
parents:
10298
diff
changeset
|
126 |
return (os->os_logbias); |
ba87b3315737
PSARC 2009/423 ZFS logbias property
Neil Perrin <Neil.Perrin@Sun.COM>
parents:
10298
diff
changeset
|
127 |
} |
ba87b3315737
PSARC 2009/423 ZFS logbias property
Neil Perrin <Neil.Perrin@Sun.COM>
parents:
10298
diff
changeset
|
128 |
|
789 | 129 |
static void |
130 |
checksum_changed_cb(void *arg, uint64_t newval) |
|
131 |
{ |
|
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
132 |
objset_t *os = arg; |
789 | 133 |
|
134 |
/* |
|
135 |
* Inheritance should have been done by now. |
|
136 |
*/ |
|
137 |
ASSERT(newval != ZIO_CHECKSUM_INHERIT); |
|
138 |
||
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
139 |
os->os_checksum = zio_checksum_select(newval, ZIO_CHECKSUM_ON_VALUE); |
789 | 140 |
} |
141 |
||
142 |
static void |
|
143 |
compression_changed_cb(void *arg, uint64_t newval) |
|
144 |
{ |
|
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
145 |
objset_t *os = arg; |
789 | 146 |
|
147 |
/* |
|
148 |
* Inheritance and range checking should have been done by now. |
|
149 |
*/ |
|
150 |
ASSERT(newval != ZIO_COMPRESS_INHERIT); |
|
151 |
||
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
152 |
os->os_compress = zio_compress_select(newval, ZIO_COMPRESS_ON_VALUE); |
789 | 153 |
} |
154 |
||
3835 | 155 |
static void |
156 |
copies_changed_cb(void *arg, uint64_t newval) |
|
157 |
{ |
|
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
158 |
objset_t *os = arg; |
3835 | 159 |
|
160 |
/* |
|
161 |
* Inheritance and range checking should have been done by now. |
|
162 |
*/ |
|
163 |
ASSERT(newval > 0); |
|
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
164 |
ASSERT(newval <= spa_max_replication(os->os_spa)); |
3835 | 165 |
|
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
166 |
os->os_copies = newval; |
3835 | 167 |
} |
168 |
||
7237
f47d41541b14
PSARC 2008/393 zfs primarycache and secondarycache properties
ek110237
parents:
7046
diff
changeset
|
169 |
static void |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10801
diff
changeset
|
170 |
dedup_changed_cb(void *arg, uint64_t newval) |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10801
diff
changeset
|
171 |
{ |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10801
diff
changeset
|
172 |
objset_t *os = arg; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10801
diff
changeset
|
173 |
spa_t *spa = os->os_spa; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10801
diff
changeset
|
174 |
enum zio_checksum checksum; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10801
diff
changeset
|
175 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10801
diff
changeset
|
176 |
/* |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10801
diff
changeset
|
177 |
* Inheritance should have been done by now. |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10801
diff
changeset
|
178 |
*/ |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10801
diff
changeset
|
179 |
ASSERT(newval != ZIO_CHECKSUM_INHERIT); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10801
diff
changeset
|
180 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10801
diff
changeset
|
181 |
checksum = zio_checksum_dedup_select(spa, newval, ZIO_CHECKSUM_OFF); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10801
diff
changeset
|
182 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10801
diff
changeset
|
183 |
os->os_dedup_checksum = checksum & ZIO_CHECKSUM_MASK; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10801
diff
changeset
|
184 |
os->os_dedup_verify = !!(checksum & ZIO_CHECKSUM_VERIFY); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10801
diff
changeset
|
185 |
} |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10801
diff
changeset
|
186 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10801
diff
changeset
|
187 |
static void |
7237
f47d41541b14
PSARC 2008/393 zfs primarycache and secondarycache properties
ek110237
parents:
7046
diff
changeset
|
188 |
primary_cache_changed_cb(void *arg, uint64_t newval) |
f47d41541b14
PSARC 2008/393 zfs primarycache and secondarycache properties
ek110237
parents:
7046
diff
changeset
|
189 |
{ |
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
190 |
objset_t *os = arg; |
7237
f47d41541b14
PSARC 2008/393 zfs primarycache and secondarycache properties
ek110237
parents:
7046
diff
changeset
|
191 |
|
f47d41541b14
PSARC 2008/393 zfs primarycache and secondarycache properties
ek110237
parents:
7046
diff
changeset
|
192 |
/* |
f47d41541b14
PSARC 2008/393 zfs primarycache and secondarycache properties
ek110237
parents:
7046
diff
changeset
|
193 |
* Inheritance and range checking should have been done by now. |
f47d41541b14
PSARC 2008/393 zfs primarycache and secondarycache properties
ek110237
parents:
7046
diff
changeset
|
194 |
*/ |
f47d41541b14
PSARC 2008/393 zfs primarycache and secondarycache properties
ek110237
parents:
7046
diff
changeset
|
195 |
ASSERT(newval == ZFS_CACHE_ALL || newval == ZFS_CACHE_NONE || |
f47d41541b14
PSARC 2008/393 zfs primarycache and secondarycache properties
ek110237
parents:
7046
diff
changeset
|
196 |
newval == ZFS_CACHE_METADATA); |
f47d41541b14
PSARC 2008/393 zfs primarycache and secondarycache properties
ek110237
parents:
7046
diff
changeset
|
197 |
|
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
198 |
os->os_primary_cache = newval; |
7237
f47d41541b14
PSARC 2008/393 zfs primarycache and secondarycache properties
ek110237
parents:
7046
diff
changeset
|
199 |
} |
f47d41541b14
PSARC 2008/393 zfs primarycache and secondarycache properties
ek110237
parents:
7046
diff
changeset
|
200 |
|
f47d41541b14
PSARC 2008/393 zfs primarycache and secondarycache properties
ek110237
parents:
7046
diff
changeset
|
201 |
static void |
f47d41541b14
PSARC 2008/393 zfs primarycache and secondarycache properties
ek110237
parents:
7046
diff
changeset
|
202 |
secondary_cache_changed_cb(void *arg, uint64_t newval) |
f47d41541b14
PSARC 2008/393 zfs primarycache and secondarycache properties
ek110237
parents:
7046
diff
changeset
|
203 |
{ |
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
204 |
objset_t *os = arg; |
7237
f47d41541b14
PSARC 2008/393 zfs primarycache and secondarycache properties
ek110237
parents:
7046
diff
changeset
|
205 |
|
f47d41541b14
PSARC 2008/393 zfs primarycache and secondarycache properties
ek110237
parents:
7046
diff
changeset
|
206 |
/* |
f47d41541b14
PSARC 2008/393 zfs primarycache and secondarycache properties
ek110237
parents:
7046
diff
changeset
|
207 |
* Inheritance and range checking should have been done by now. |
f47d41541b14
PSARC 2008/393 zfs primarycache and secondarycache properties
ek110237
parents:
7046
diff
changeset
|
208 |
*/ |
f47d41541b14
PSARC 2008/393 zfs primarycache and secondarycache properties
ek110237
parents:
7046
diff
changeset
|
209 |
ASSERT(newval == ZFS_CACHE_ALL || newval == ZFS_CACHE_NONE || |
f47d41541b14
PSARC 2008/393 zfs primarycache and secondarycache properties
ek110237
parents:
7046
diff
changeset
|
210 |
newval == ZFS_CACHE_METADATA); |
f47d41541b14
PSARC 2008/393 zfs primarycache and secondarycache properties
ek110237
parents:
7046
diff
changeset
|
211 |
|
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
212 |
os->os_secondary_cache = newval; |
7237
f47d41541b14
PSARC 2008/393 zfs primarycache and secondarycache properties
ek110237
parents:
7046
diff
changeset
|
213 |
} |
f47d41541b14
PSARC 2008/393 zfs primarycache and secondarycache properties
ek110237
parents:
7046
diff
changeset
|
214 |
|
10310
ba87b3315737
PSARC 2009/423 ZFS logbias property
Neil Perrin <Neil.Perrin@Sun.COM>
parents:
10298
diff
changeset
|
215 |
static void |
12294
2a74b443e6b1
PSARC/2010/108 zil synchronicity
Mark J Musante <Mark.Musante@Sun.COM>
parents:
12178
diff
changeset
|
216 |
sync_changed_cb(void *arg, uint64_t newval) |
2a74b443e6b1
PSARC/2010/108 zil synchronicity
Mark J Musante <Mark.Musante@Sun.COM>
parents:
12178
diff
changeset
|
217 |
{ |
2a74b443e6b1
PSARC/2010/108 zil synchronicity
Mark J Musante <Mark.Musante@Sun.COM>
parents:
12178
diff
changeset
|
218 |
objset_t *os = arg; |
2a74b443e6b1
PSARC/2010/108 zil synchronicity
Mark J Musante <Mark.Musante@Sun.COM>
parents:
12178
diff
changeset
|
219 |
|
2a74b443e6b1
PSARC/2010/108 zil synchronicity
Mark J Musante <Mark.Musante@Sun.COM>
parents:
12178
diff
changeset
|
220 |
/* |
2a74b443e6b1
PSARC/2010/108 zil synchronicity
Mark J Musante <Mark.Musante@Sun.COM>
parents:
12178
diff
changeset
|
221 |
* Inheritance and range checking should have been done by now. |
2a74b443e6b1
PSARC/2010/108 zil synchronicity
Mark J Musante <Mark.Musante@Sun.COM>
parents:
12178
diff
changeset
|
222 |
*/ |
2a74b443e6b1
PSARC/2010/108 zil synchronicity
Mark J Musante <Mark.Musante@Sun.COM>
parents:
12178
diff
changeset
|
223 |
ASSERT(newval == ZFS_SYNC_STANDARD || newval == ZFS_SYNC_ALWAYS || |
2a74b443e6b1
PSARC/2010/108 zil synchronicity
Mark J Musante <Mark.Musante@Sun.COM>
parents:
12178
diff
changeset
|
224 |
newval == ZFS_SYNC_DISABLED); |
2a74b443e6b1
PSARC/2010/108 zil synchronicity
Mark J Musante <Mark.Musante@Sun.COM>
parents:
12178
diff
changeset
|
225 |
|
2a74b443e6b1
PSARC/2010/108 zil synchronicity
Mark J Musante <Mark.Musante@Sun.COM>
parents:
12178
diff
changeset
|
226 |
os->os_sync = newval; |
2a74b443e6b1
PSARC/2010/108 zil synchronicity
Mark J Musante <Mark.Musante@Sun.COM>
parents:
12178
diff
changeset
|
227 |
if (os->os_zil) |
2a74b443e6b1
PSARC/2010/108 zil synchronicity
Mark J Musante <Mark.Musante@Sun.COM>
parents:
12178
diff
changeset
|
228 |
zil_set_sync(os->os_zil, newval); |
2a74b443e6b1
PSARC/2010/108 zil synchronicity
Mark J Musante <Mark.Musante@Sun.COM>
parents:
12178
diff
changeset
|
229 |
} |
2a74b443e6b1
PSARC/2010/108 zil synchronicity
Mark J Musante <Mark.Musante@Sun.COM>
parents:
12178
diff
changeset
|
230 |
|
2a74b443e6b1
PSARC/2010/108 zil synchronicity
Mark J Musante <Mark.Musante@Sun.COM>
parents:
12178
diff
changeset
|
231 |
static void |
10310
ba87b3315737
PSARC 2009/423 ZFS logbias property
Neil Perrin <Neil.Perrin@Sun.COM>
parents:
10298
diff
changeset
|
232 |
logbias_changed_cb(void *arg, uint64_t newval) |
ba87b3315737
PSARC 2009/423 ZFS logbias property
Neil Perrin <Neil.Perrin@Sun.COM>
parents:
10298
diff
changeset
|
233 |
{ |
ba87b3315737
PSARC 2009/423 ZFS logbias property
Neil Perrin <Neil.Perrin@Sun.COM>
parents:
10298
diff
changeset
|
234 |
objset_t *os = arg; |
ba87b3315737
PSARC 2009/423 ZFS logbias property
Neil Perrin <Neil.Perrin@Sun.COM>
parents:
10298
diff
changeset
|
235 |
|
ba87b3315737
PSARC 2009/423 ZFS logbias property
Neil Perrin <Neil.Perrin@Sun.COM>
parents:
10298
diff
changeset
|
236 |
ASSERT(newval == ZFS_LOGBIAS_LATENCY || |
ba87b3315737
PSARC 2009/423 ZFS logbias property
Neil Perrin <Neil.Perrin@Sun.COM>
parents:
10298
diff
changeset
|
237 |
newval == ZFS_LOGBIAS_THROUGHPUT); |
ba87b3315737
PSARC 2009/423 ZFS logbias property
Neil Perrin <Neil.Perrin@Sun.COM>
parents:
10298
diff
changeset
|
238 |
os->os_logbias = newval; |
ba87b3315737
PSARC 2009/423 ZFS logbias property
Neil Perrin <Neil.Perrin@Sun.COM>
parents:
10298
diff
changeset
|
239 |
if (os->os_zil) |
ba87b3315737
PSARC 2009/423 ZFS logbias property
Neil Perrin <Neil.Perrin@Sun.COM>
parents:
10298
diff
changeset
|
240 |
zil_set_logbias(os->os_zil, newval); |
ba87b3315737
PSARC 2009/423 ZFS logbias property
Neil Perrin <Neil.Perrin@Sun.COM>
parents:
10298
diff
changeset
|
241 |
} |
ba87b3315737
PSARC 2009/423 ZFS logbias property
Neil Perrin <Neil.Perrin@Sun.COM>
parents:
10298
diff
changeset
|
242 |
|
789 | 243 |
void |
244 |
dmu_objset_byteswap(void *buf, size_t size) |
|
245 |
{ |
|
246 |
objset_phys_t *osp = buf; |
|
247 |
||
9396
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
248 |
ASSERT(size == OBJSET_OLD_PHYS_SIZE || size == sizeof (objset_phys_t)); |
789 | 249 |
dnode_byteswap(&osp->os_meta_dnode); |
250 |
byteswap_uint64_array(&osp->os_zil_header, sizeof (zil_header_t)); |
|
251 |
osp->os_type = BSWAP_64(osp->os_type); |
|
9396
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
252 |
osp->os_flags = BSWAP_64(osp->os_flags); |
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
253 |
if (size == sizeof (objset_phys_t)) { |
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
254 |
dnode_byteswap(&osp->os_userused_dnode); |
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
255 |
dnode_byteswap(&osp->os_groupused_dnode); |
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
256 |
} |
789 | 257 |
} |
258 |
||
1544 | 259 |
int |
260 |
dmu_objset_open_impl(spa_t *spa, dsl_dataset_t *ds, blkptr_t *bp, |
|
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
261 |
objset_t **osp) |
789 | 262 |
{ |
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
263 |
objset_t *os; |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
6992
diff
changeset
|
264 |
int i, err; |
789 | 265 |
|
4787 | 266 |
ASSERT(ds == NULL || MUTEX_HELD(&ds->ds_opening_lock)); |
267 |
||
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
268 |
os = kmem_zalloc(sizeof (objset_t), KM_SLEEP); |
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
269 |
os->os_dsl_dataset = ds; |
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
270 |
os->os_spa = spa; |
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
271 |
os->os_rootbp = bp; |
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
272 |
if (!BP_IS_HOLE(os->os_rootbp)) { |
2391 | 273 |
uint32_t aflags = ARC_WAIT; |
1544 | 274 |
zbookmark_t zb; |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10801
diff
changeset
|
275 |
SET_BOOKMARK(&zb, ds ? ds->ds_object : DMU_META_OBJSET, |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10801
diff
changeset
|
276 |
ZB_ROOT_OBJECT, ZB_ROOT_LEVEL, ZB_ROOT_BLKID); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10801
diff
changeset
|
277 |
|
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
278 |
if (DMU_OS_IS_L2CACHEABLE(os)) |
7237
f47d41541b14
PSARC 2008/393 zfs primarycache and secondarycache properties
ek110237
parents:
7046
diff
changeset
|
279 |
aflags |= ARC_L2CACHE; |
14039
6cfd5a5778b9
3137 L2ARC compression
Saso Kiselkov <skiselkov@gmail.com>
parents:
13980
diff
changeset
|
280 |
if (DMU_OS_IS_L2COMPRESSIBLE(os)) |
6cfd5a5778b9
3137 L2ARC compression
Saso Kiselkov <skiselkov@gmail.com>
parents:
13980
diff
changeset
|
281 |
aflags |= ARC_L2COMPRESS; |
1544 | 282 |
|
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
283 |
dprintf_bp(os->os_rootbp, "reading %s", ""); |
13941
d48547176ab4
3498 panic in arc_read(): !refcount_is_zero(&pbuf->b_hdr->b_refcnt)
George Wilson <george.wilson@delphix.com>
parents:
13780
diff
changeset
|
284 |
err = arc_read(NULL, spa, os->os_rootbp, |
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
285 |
arc_getbuf_func, &os->os_phys_buf, |
2391 | 286 |
ZIO_PRIORITY_SYNC_READ, ZIO_FLAG_CANFAIL, &aflags, &zb); |
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
287 |
if (err != 0) { |
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
288 |
kmem_free(os, sizeof (objset_t)); |
7294 | 289 |
/* convert checksum errors into IO errors */ |
290 |
if (err == ECKSUM) |
|
13980
d7059eb1884c
3598 want to dtrace when errors are generated in zfs
Matthew Ahrens <mahrens@delphix.com>
parents:
13973
diff
changeset
|
291 |
err = SET_ERROR(EIO); |
1544 | 292 |
return (err); |
293 |
} |
|
9396
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
294 |
|
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
295 |
/* Increase the blocksize if we are permitted. */ |
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
296 |
if (spa_version(spa) >= SPA_VERSION_USERSPACE && |
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
297 |
arc_buf_size(os->os_phys_buf) < sizeof (objset_phys_t)) { |
9396
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
298 |
arc_buf_t *buf = arc_buf_alloc(spa, |
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
299 |
sizeof (objset_phys_t), &os->os_phys_buf, |
9396
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
300 |
ARC_BUFC_METADATA); |
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
301 |
bzero(buf->b_data, sizeof (objset_phys_t)); |
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
302 |
bcopy(os->os_phys_buf->b_data, buf->b_data, |
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
303 |
arc_buf_size(os->os_phys_buf)); |
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
304 |
(void) arc_buf_remove_ref(os->os_phys_buf, |
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
305 |
&os->os_phys_buf); |
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
306 |
os->os_phys_buf = buf; |
9396
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
307 |
} |
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
308 |
|
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
309 |
os->os_phys = os->os_phys_buf->b_data; |
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
310 |
os->os_flags = os->os_phys->os_flags; |
789 | 311 |
} else { |
9396
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
312 |
int size = spa_version(spa) >= SPA_VERSION_USERSPACE ? |
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
313 |
sizeof (objset_phys_t) : OBJSET_OLD_PHYS_SIZE; |
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
314 |
os->os_phys_buf = arc_buf_alloc(spa, size, |
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
315 |
&os->os_phys_buf, ARC_BUFC_METADATA); |
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
316 |
os->os_phys = os->os_phys_buf->b_data; |
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
317 |
bzero(os->os_phys, size); |
789 | 318 |
} |
319 |
||
320 |
/* |
|
321 |
* Note: the changed_cb will be called once before the register |
|
322 |
* func returns, thus changing the checksum/compression from the |
|
7237
f47d41541b14
PSARC 2008/393 zfs primarycache and secondarycache properties
ek110237
parents:
7046
diff
changeset
|
323 |
* default (fletcher2/off). Snapshots don't need to know about |
f47d41541b14
PSARC 2008/393 zfs primarycache and secondarycache properties
ek110237
parents:
7046
diff
changeset
|
324 |
* checksum/compression/copies. |
789 | 325 |
*/ |
7237
f47d41541b14
PSARC 2008/393 zfs primarycache and secondarycache properties
ek110237
parents:
7046
diff
changeset
|
326 |
if (ds) { |
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
327 |
err = dsl_prop_register(ds, |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
328 |
zfs_prop_to_name(ZFS_PROP_PRIMARYCACHE), |
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
329 |
primary_cache_changed_cb, os); |
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
330 |
if (err == 0) { |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
331 |
err = dsl_prop_register(ds, |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
332 |
zfs_prop_to_name(ZFS_PROP_SECONDARYCACHE), |
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
333 |
secondary_cache_changed_cb, os); |
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
334 |
} |
7237
f47d41541b14
PSARC 2008/393 zfs primarycache and secondarycache properties
ek110237
parents:
7046
diff
changeset
|
335 |
if (!dsl_dataset_is_snapshot(ds)) { |
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
336 |
if (err == 0) { |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
337 |
err = dsl_prop_register(ds, |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
338 |
zfs_prop_to_name(ZFS_PROP_CHECKSUM), |
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
339 |
checksum_changed_cb, os); |
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
340 |
} |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
341 |
if (err == 0) { |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
342 |
err = dsl_prop_register(ds, |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
343 |
zfs_prop_to_name(ZFS_PROP_COMPRESSION), |
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
344 |
compression_changed_cb, os); |
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
345 |
} |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
346 |
if (err == 0) { |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
347 |
err = dsl_prop_register(ds, |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
348 |
zfs_prop_to_name(ZFS_PROP_COPIES), |
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
349 |
copies_changed_cb, os); |
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
350 |
} |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
351 |
if (err == 0) { |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
352 |
err = dsl_prop_register(ds, |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
353 |
zfs_prop_to_name(ZFS_PROP_DEDUP), |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10801
diff
changeset
|
354 |
dedup_changed_cb, os); |
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
355 |
} |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
356 |
if (err == 0) { |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
357 |
err = dsl_prop_register(ds, |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
358 |
zfs_prop_to_name(ZFS_PROP_LOGBIAS), |
10310
ba87b3315737
PSARC 2009/423 ZFS logbias property
Neil Perrin <Neil.Perrin@Sun.COM>
parents:
10298
diff
changeset
|
359 |
logbias_changed_cb, os); |
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
360 |
} |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
361 |
if (err == 0) { |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
362 |
err = dsl_prop_register(ds, |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
363 |
zfs_prop_to_name(ZFS_PROP_SYNC), |
12294
2a74b443e6b1
PSARC/2010/108 zil synchronicity
Mark J Musante <Mark.Musante@Sun.COM>
parents:
12178
diff
changeset
|
364 |
sync_changed_cb, os); |
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
365 |
} |
7237
f47d41541b14
PSARC 2008/393 zfs primarycache and secondarycache properties
ek110237
parents:
7046
diff
changeset
|
366 |
} |
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
367 |
if (err != 0) { |
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
368 |
VERIFY(arc_buf_remove_ref(os->os_phys_buf, |
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
369 |
&os->os_phys_buf)); |
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
370 |
kmem_free(os, sizeof (objset_t)); |
1544 | 371 |
return (err); |
372 |
} |
|
2082 | 373 |
} else if (ds == NULL) { |
789 | 374 |
/* It's the meta-objset. */ |
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
375 |
os->os_checksum = ZIO_CHECKSUM_FLETCHER_4; |
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
376 |
os->os_compress = ZIO_COMPRESS_LZJB; |
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
377 |
os->os_copies = spa_max_replication(spa); |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10801
diff
changeset
|
378 |
os->os_dedup_checksum = ZIO_CHECKSUM_OFF; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10801
diff
changeset
|
379 |
os->os_dedup_verify = 0; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10801
diff
changeset
|
380 |
os->os_logbias = 0; |
12294
2a74b443e6b1
PSARC/2010/108 zil synchronicity
Mark J Musante <Mark.Musante@Sun.COM>
parents:
12178
diff
changeset
|
381 |
os->os_sync = 0; |
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
382 |
os->os_primary_cache = ZFS_CACHE_ALL; |
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
383 |
os->os_secondary_cache = ZFS_CACHE_ALL; |
789 | 384 |
} |
385 |
||
12839
1eab9192da8b
6844896 recursive snapshots take a long time
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12722
diff
changeset
|
386 |
if (ds == NULL || !dsl_dataset_is_snapshot(ds)) |
1eab9192da8b
6844896 recursive snapshots take a long time
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12722
diff
changeset
|
387 |
os->os_zil_header = os->os_phys->os_zil_header; |
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
388 |
os->os_zil = zil_alloc(os, &os->os_zil_header); |
789 | 389 |
|
390 |
for (i = 0; i < TXG_SIZE; i++) { |
|
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
391 |
list_create(&os->os_dirty_dnodes[i], sizeof (dnode_t), |
789 | 392 |
offsetof(dnode_t, dn_dirty_link[i])); |
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
393 |
list_create(&os->os_free_dnodes[i], sizeof (dnode_t), |
789 | 394 |
offsetof(dnode_t, dn_dirty_link[i])); |
395 |
} |
|
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
396 |
list_create(&os->os_dnodes, sizeof (dnode_t), |
789 | 397 |
offsetof(dnode_t, dn_link)); |
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
398 |
list_create(&os->os_downgraded_dbufs, sizeof (dmu_buf_impl_t), |
789 | 399 |
offsetof(dmu_buf_impl_t, db_link)); |
400 |
||
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
401 |
mutex_init(&os->os_lock, NULL, MUTEX_DEFAULT, NULL); |
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
402 |
mutex_init(&os->os_obj_lock, NULL, MUTEX_DEFAULT, NULL); |
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
403 |
mutex_init(&os->os_user_ptr_lock, NULL, MUTEX_DEFAULT, NULL); |
2856 | 404 |
|
12684
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
405 |
DMU_META_DNODE(os) = dnode_special_open(os, |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
406 |
&os->os_phys->os_meta_dnode, DMU_META_DNODE_OBJECT, |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
407 |
&os->os_meta_dnode); |
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
408 |
if (arc_buf_size(os->os_phys_buf) >= sizeof (objset_phys_t)) { |
12684
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
409 |
DMU_USERUSED_DNODE(os) = dnode_special_open(os, |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
410 |
&os->os_phys->os_userused_dnode, DMU_USERUSED_OBJECT, |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
411 |
&os->os_userused_dnode); |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
412 |
DMU_GROUPUSED_DNODE(os) = dnode_special_open(os, |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
413 |
&os->os_phys->os_groupused_dnode, DMU_GROUPUSED_OBJECT, |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
414 |
&os->os_groupused_dnode); |
9396
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
415 |
} |
789 | 416 |
|
4787 | 417 |
/* |
418 |
* We should be the only thread trying to do this because we |
|
419 |
* have ds_opening_lock |
|
420 |
*/ |
|
421 |
if (ds) { |
|
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
422 |
mutex_enter(&ds->ds_lock); |
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
423 |
ASSERT(ds->ds_objset == NULL); |
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
424 |
ds->ds_objset = os; |
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
425 |
mutex_exit(&ds->ds_lock); |
789 | 426 |
} |
427 |
||
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
428 |
*osp = os; |
5367 | 429 |
return (0); |
430 |
} |
|
431 |
||
432 |
int |
|
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
433 |
dmu_objset_from_ds(dsl_dataset_t *ds, objset_t **osp) |
5367 | 434 |
{ |
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
435 |
int err = 0; |
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
436 |
|
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
437 |
mutex_enter(&ds->ds_opening_lock); |
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
438 |
*osp = ds->ds_objset; |
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
439 |
if (*osp == NULL) { |
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
440 |
err = dmu_objset_open_impl(dsl_dataset_get_spa(ds), |
12982
5d7f2db1e620
6972862 rollback can leak log blocks
Mark Maybee <Mark.Maybee@Sun.COM>
parents:
12839
diff
changeset
|
441 |
ds, dsl_dataset_get_blkptr(ds), osp); |
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
442 |
} |
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
443 |
mutex_exit(&ds->ds_opening_lock); |
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
444 |
return (err); |
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
445 |
} |
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
446 |
|
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
447 |
/* |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
448 |
* Holds the pool while the objset is held. Therefore only one objset |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
449 |
* can be held at a time. |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
450 |
*/ |
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
451 |
int |
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
452 |
dmu_objset_hold(const char *name, void *tag, objset_t **osp) |
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
453 |
{ |
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
454 |
dsl_pool_t *dp; |
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
455 |
dsl_dataset_t *ds; |
5367 | 456 |
int err; |
457 |
||
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
458 |
err = dsl_pool_hold(name, tag, &dp); |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
459 |
if (err != 0) |
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
460 |
return (err); |
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
461 |
err = dsl_dataset_hold(dp, name, tag, &ds); |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
462 |
if (err != 0) { |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
463 |
dsl_pool_rele(dp, tag); |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
464 |
return (err); |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
465 |
} |
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
466 |
|
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
467 |
err = dmu_objset_from_ds(ds, osp); |
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
468 |
if (err != 0) { |
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
469 |
dsl_dataset_rele(ds, tag); |
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
470 |
dsl_pool_rele(dp, tag); |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
471 |
} |
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
472 |
|
5367 | 473 |
return (err); |
474 |
} |
|
475 |
||
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
476 |
/* |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
477 |
* dsl_pool must not be held when this is called. |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
478 |
* Upon successful return, there will be a longhold on the dataset, |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
479 |
* and the dsl_pool will not be held. |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
480 |
*/ |
789 | 481 |
int |
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
482 |
dmu_objset_own(const char *name, dmu_objset_type_t type, |
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
483 |
boolean_t readonly, void *tag, objset_t **osp) |
789 | 484 |
{ |
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
485 |
dsl_pool_t *dp; |
789 | 486 |
dsl_dataset_t *ds; |
487 |
int err; |
|
488 |
||
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
489 |
err = dsl_pool_hold(name, FTAG, &dp); |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
490 |
if (err != 0) |
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
491 |
return (err); |
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
492 |
err = dsl_dataset_own(dp, name, tag, &ds); |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
493 |
if (err != 0) { |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
494 |
dsl_pool_rele(dp, FTAG); |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
495 |
return (err); |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
496 |
} |
5367 | 497 |
|
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
498 |
err = dmu_objset_from_ds(ds, osp); |
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
499 |
dsl_pool_rele(dp, FTAG); |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
500 |
if (err != 0) { |
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
501 |
dsl_dataset_disown(ds, tag); |
10588
dc03f981ea18
6438937 if 'zfs destroy' fails, it can leave a zvol device link missing
Eric Taylor <Eric.Taylor@Sun.COM>
parents:
10407
diff
changeset
|
502 |
} else if (type != DMU_OST_ANY && type != (*osp)->os_phys->os_type) { |
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
503 |
dsl_dataset_disown(ds, tag); |
13980
d7059eb1884c
3598 want to dtrace when errors are generated in zfs
Matthew Ahrens <mahrens@delphix.com>
parents:
13973
diff
changeset
|
504 |
return (SET_ERROR(EINVAL)); |
10588
dc03f981ea18
6438937 if 'zfs destroy' fails, it can leave a zvol device link missing
Eric Taylor <Eric.Taylor@Sun.COM>
parents:
10407
diff
changeset
|
505 |
} else if (!readonly && dsl_dataset_is_snapshot(ds)) { |
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
506 |
dsl_dataset_disown(ds, tag); |
13980
d7059eb1884c
3598 want to dtrace when errors are generated in zfs
Matthew Ahrens <mahrens@delphix.com>
parents:
13973
diff
changeset
|
507 |
return (SET_ERROR(EROFS)); |
789 | 508 |
} |
5367 | 509 |
return (err); |
789 | 510 |
} |
511 |
||
512 |
void |
|
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
513 |
dmu_objset_rele(objset_t *os, void *tag) |
789 | 514 |
{ |
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
515 |
dsl_pool_t *dp = dmu_objset_pool(os); |
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
516 |
dsl_dataset_rele(os->os_dsl_dataset, tag); |
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
517 |
dsl_pool_rele(dp, tag); |
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
518 |
} |
6689
47572a2f5e73
6610506 Eliminate or improve retry logic from callers of dmu_objset_open()
maybee
parents:
6492
diff
changeset
|
519 |
|
14091
3ca4e9e72fe7
3875 panic in zfs_root() after failed rollback
Keith M Wesolowski <wesolows@foobazco.org>
parents:
14039
diff
changeset
|
520 |
/* |
3ca4e9e72fe7
3875 panic in zfs_root() after failed rollback
Keith M Wesolowski <wesolows@foobazco.org>
parents:
14039
diff
changeset
|
521 |
* When we are called, os MUST refer to an objset associated with a dataset |
3ca4e9e72fe7
3875 panic in zfs_root() after failed rollback
Keith M Wesolowski <wesolows@foobazco.org>
parents:
14039
diff
changeset
|
522 |
* that is owned by 'tag'; that is, is held and long held by 'tag' and ds_owner |
3ca4e9e72fe7
3875 panic in zfs_root() after failed rollback
Keith M Wesolowski <wesolows@foobazco.org>
parents:
14039
diff
changeset
|
523 |
* == tag. We will then release and reacquire ownership of the dataset while |
3ca4e9e72fe7
3875 panic in zfs_root() after failed rollback
Keith M Wesolowski <wesolows@foobazco.org>
parents:
14039
diff
changeset
|
524 |
* holding the pool config_rwlock to avoid intervening namespace or ownership |
3ca4e9e72fe7
3875 panic in zfs_root() after failed rollback
Keith M Wesolowski <wesolows@foobazco.org>
parents:
14039
diff
changeset
|
525 |
* changes may occur. |
3ca4e9e72fe7
3875 panic in zfs_root() after failed rollback
Keith M Wesolowski <wesolows@foobazco.org>
parents:
14039
diff
changeset
|
526 |
* |
3ca4e9e72fe7
3875 panic in zfs_root() after failed rollback
Keith M Wesolowski <wesolows@foobazco.org>
parents:
14039
diff
changeset
|
527 |
* This exists solely to accommodate zfs_ioc_userspace_upgrade()'s desire to |
3ca4e9e72fe7
3875 panic in zfs_root() after failed rollback
Keith M Wesolowski <wesolows@foobazco.org>
parents:
14039
diff
changeset
|
528 |
* release the hold on its dataset and acquire a new one on the dataset of the |
3ca4e9e72fe7
3875 panic in zfs_root() after failed rollback
Keith M Wesolowski <wesolows@foobazco.org>
parents:
14039
diff
changeset
|
529 |
* same name so that it can be partially torn down and reconstructed. |
3ca4e9e72fe7
3875 panic in zfs_root() after failed rollback
Keith M Wesolowski <wesolows@foobazco.org>
parents:
14039
diff
changeset
|
530 |
*/ |
3ca4e9e72fe7
3875 panic in zfs_root() after failed rollback
Keith M Wesolowski <wesolows@foobazco.org>
parents:
14039
diff
changeset
|
531 |
void |
3ca4e9e72fe7
3875 panic in zfs_root() after failed rollback
Keith M Wesolowski <wesolows@foobazco.org>
parents:
14039
diff
changeset
|
532 |
dmu_objset_refresh_ownership(objset_t *os, void *tag) |
3ca4e9e72fe7
3875 panic in zfs_root() after failed rollback
Keith M Wesolowski <wesolows@foobazco.org>
parents:
14039
diff
changeset
|
533 |
{ |
3ca4e9e72fe7
3875 panic in zfs_root() after failed rollback
Keith M Wesolowski <wesolows@foobazco.org>
parents:
14039
diff
changeset
|
534 |
dsl_pool_t *dp; |
3ca4e9e72fe7
3875 panic in zfs_root() after failed rollback
Keith M Wesolowski <wesolows@foobazco.org>
parents:
14039
diff
changeset
|
535 |
dsl_dataset_t *ds, *newds; |
3ca4e9e72fe7
3875 panic in zfs_root() after failed rollback
Keith M Wesolowski <wesolows@foobazco.org>
parents:
14039
diff
changeset
|
536 |
char name[MAXNAMELEN]; |
3ca4e9e72fe7
3875 panic in zfs_root() after failed rollback
Keith M Wesolowski <wesolows@foobazco.org>
parents:
14039
diff
changeset
|
537 |
|
3ca4e9e72fe7
3875 panic in zfs_root() after failed rollback
Keith M Wesolowski <wesolows@foobazco.org>
parents:
14039
diff
changeset
|
538 |
ds = os->os_dsl_dataset; |
3ca4e9e72fe7
3875 panic in zfs_root() after failed rollback
Keith M Wesolowski <wesolows@foobazco.org>
parents:
14039
diff
changeset
|
539 |
VERIFY3P(ds, !=, NULL); |
3ca4e9e72fe7
3875 panic in zfs_root() after failed rollback
Keith M Wesolowski <wesolows@foobazco.org>
parents:
14039
diff
changeset
|
540 |
VERIFY3P(ds->ds_owner, ==, tag); |
3ca4e9e72fe7
3875 panic in zfs_root() after failed rollback
Keith M Wesolowski <wesolows@foobazco.org>
parents:
14039
diff
changeset
|
541 |
VERIFY(dsl_dataset_long_held(ds)); |
3ca4e9e72fe7
3875 panic in zfs_root() after failed rollback
Keith M Wesolowski <wesolows@foobazco.org>
parents:
14039
diff
changeset
|
542 |
|
3ca4e9e72fe7
3875 panic in zfs_root() after failed rollback
Keith M Wesolowski <wesolows@foobazco.org>
parents:
14039
diff
changeset
|
543 |
dsl_dataset_name(ds, name); |
3ca4e9e72fe7
3875 panic in zfs_root() after failed rollback
Keith M Wesolowski <wesolows@foobazco.org>
parents:
14039
diff
changeset
|
544 |
dp = dmu_objset_pool(os); |
3ca4e9e72fe7
3875 panic in zfs_root() after failed rollback
Keith M Wesolowski <wesolows@foobazco.org>
parents:
14039
diff
changeset
|
545 |
dsl_pool_config_enter(dp, FTAG); |
3ca4e9e72fe7
3875 panic in zfs_root() after failed rollback
Keith M Wesolowski <wesolows@foobazco.org>
parents:
14039
diff
changeset
|
546 |
dmu_objset_disown(os, tag); |
3ca4e9e72fe7
3875 panic in zfs_root() after failed rollback
Keith M Wesolowski <wesolows@foobazco.org>
parents:
14039
diff
changeset
|
547 |
VERIFY0(dsl_dataset_own(dp, name, tag, &newds)); |
3ca4e9e72fe7
3875 panic in zfs_root() after failed rollback
Keith M Wesolowski <wesolows@foobazco.org>
parents:
14039
diff
changeset
|
548 |
VERIFY3P(newds, ==, os->os_dsl_dataset); |
3ca4e9e72fe7
3875 panic in zfs_root() after failed rollback
Keith M Wesolowski <wesolows@foobazco.org>
parents:
14039
diff
changeset
|
549 |
dsl_pool_config_exit(dp, FTAG); |
3ca4e9e72fe7
3875 panic in zfs_root() after failed rollback
Keith M Wesolowski <wesolows@foobazco.org>
parents:
14039
diff
changeset
|
550 |
} |
3ca4e9e72fe7
3875 panic in zfs_root() after failed rollback
Keith M Wesolowski <wesolows@foobazco.org>
parents:
14039
diff
changeset
|
551 |
|
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
552 |
void |
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
553 |
dmu_objset_disown(objset_t *os, void *tag) |
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
554 |
{ |
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
555 |
dsl_dataset_disown(os->os_dsl_dataset, tag); |
789 | 556 |
} |
557 |
||
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
558 |
void |
4944
96d96f8de974
6569719 panic dangling dbufs (dn=ffffffff28814d30, dbuf=ffffffff20756008)
maybee
parents:
4935
diff
changeset
|
559 |
dmu_objset_evict_dbufs(objset_t *os) |
1544 | 560 |
{ |
561 |
dnode_t *dn; |
|
1596
2e2377ccbf85
6395371 ASSERT in dmu_tx_count_free: blkid + i < dn->dn_phys->dn_nblkptr
ahrens
parents:
1544
diff
changeset
|
562 |
|
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
563 |
mutex_enter(&os->os_lock); |
1596
2e2377ccbf85
6395371 ASSERT in dmu_tx_count_free: blkid + i < dn->dn_phys->dn_nblkptr
ahrens
parents:
1544
diff
changeset
|
564 |
|
2e2377ccbf85
6395371 ASSERT in dmu_tx_count_free: blkid + i < dn->dn_phys->dn_nblkptr
ahrens
parents:
1544
diff
changeset
|
565 |
/* process the mdn last, since the other dnodes have holds on it */ |
12684
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
566 |
list_remove(&os->os_dnodes, DMU_META_DNODE(os)); |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
567 |
list_insert_tail(&os->os_dnodes, DMU_META_DNODE(os)); |
1544 | 568 |
|
569 |
/* |
|
1596
2e2377ccbf85
6395371 ASSERT in dmu_tx_count_free: blkid + i < dn->dn_phys->dn_nblkptr
ahrens
parents:
1544
diff
changeset
|
570 |
* Find the first dnode with holds. We have to do this dance |
2e2377ccbf85
6395371 ASSERT in dmu_tx_count_free: blkid + i < dn->dn_phys->dn_nblkptr
ahrens
parents:
1544
diff
changeset
|
571 |
* because dnode_add_ref() only works if you already have a |
2e2377ccbf85
6395371 ASSERT in dmu_tx_count_free: blkid + i < dn->dn_phys->dn_nblkptr
ahrens
parents:
1544
diff
changeset
|
572 |
* hold. If there are no holds then it has no dbufs so OK to |
2e2377ccbf85
6395371 ASSERT in dmu_tx_count_free: blkid + i < dn->dn_phys->dn_nblkptr
ahrens
parents:
1544
diff
changeset
|
573 |
* skip. |
1544 | 574 |
*/ |
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
575 |
for (dn = list_head(&os->os_dnodes); |
4944
96d96f8de974
6569719 panic dangling dbufs (dn=ffffffff28814d30, dbuf=ffffffff20756008)
maybee
parents:
4935
diff
changeset
|
576 |
dn && !dnode_add_ref(dn, FTAG); |
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
577 |
dn = list_next(&os->os_dnodes, dn)) |
1596
2e2377ccbf85
6395371 ASSERT in dmu_tx_count_free: blkid + i < dn->dn_phys->dn_nblkptr
ahrens
parents:
1544
diff
changeset
|
578 |
continue; |
2e2377ccbf85
6395371 ASSERT in dmu_tx_count_free: blkid + i < dn->dn_phys->dn_nblkptr
ahrens
parents:
1544
diff
changeset
|
579 |
|
2e2377ccbf85
6395371 ASSERT in dmu_tx_count_free: blkid + i < dn->dn_phys->dn_nblkptr
ahrens
parents:
1544
diff
changeset
|
580 |
while (dn) { |
2e2377ccbf85
6395371 ASSERT in dmu_tx_count_free: blkid + i < dn->dn_phys->dn_nblkptr
ahrens
parents:
1544
diff
changeset
|
581 |
dnode_t *next_dn = dn; |
2e2377ccbf85
6395371 ASSERT in dmu_tx_count_free: blkid + i < dn->dn_phys->dn_nblkptr
ahrens
parents:
1544
diff
changeset
|
582 |
|
2e2377ccbf85
6395371 ASSERT in dmu_tx_count_free: blkid + i < dn->dn_phys->dn_nblkptr
ahrens
parents:
1544
diff
changeset
|
583 |
do { |
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
584 |
next_dn = list_next(&os->os_dnodes, next_dn); |
4944
96d96f8de974
6569719 panic dangling dbufs (dn=ffffffff28814d30, dbuf=ffffffff20756008)
maybee
parents:
4935
diff
changeset
|
585 |
} while (next_dn && !dnode_add_ref(next_dn, FTAG)); |
1596
2e2377ccbf85
6395371 ASSERT in dmu_tx_count_free: blkid + i < dn->dn_phys->dn_nblkptr
ahrens
parents:
1544
diff
changeset
|
586 |
|
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
587 |
mutex_exit(&os->os_lock); |
4944
96d96f8de974
6569719 panic dangling dbufs (dn=ffffffff28814d30, dbuf=ffffffff20756008)
maybee
parents:
4935
diff
changeset
|
588 |
dnode_evict_dbufs(dn); |
1596
2e2377ccbf85
6395371 ASSERT in dmu_tx_count_free: blkid + i < dn->dn_phys->dn_nblkptr
ahrens
parents:
1544
diff
changeset
|
589 |
dnode_rele(dn, FTAG); |
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
590 |
mutex_enter(&os->os_lock); |
1596
2e2377ccbf85
6395371 ASSERT in dmu_tx_count_free: blkid + i < dn->dn_phys->dn_nblkptr
ahrens
parents:
1544
diff
changeset
|
591 |
dn = next_dn; |
1544 | 592 |
} |
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
593 |
mutex_exit(&os->os_lock); |
1544 | 594 |
} |
595 |
||
596 |
void |
|
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
597 |
dmu_objset_evict(objset_t *os) |
789 | 598 |
{ |
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
599 |
dsl_dataset_t *ds = os->os_dsl_dataset; |
789 | 600 |
|
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10801
diff
changeset
|
601 |
for (int t = 0; t < TXG_SIZE; t++) |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10801
diff
changeset
|
602 |
ASSERT(!dmu_objset_is_dirty(os, t)); |
789 | 603 |
|
7237
f47d41541b14
PSARC 2008/393 zfs primarycache and secondarycache properties
ek110237
parents:
7046
diff
changeset
|
604 |
if (ds) { |
f47d41541b14
PSARC 2008/393 zfs primarycache and secondarycache properties
ek110237
parents:
7046
diff
changeset
|
605 |
if (!dsl_dataset_is_snapshot(ds)) { |
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
606 |
VERIFY0(dsl_prop_unregister(ds, |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
607 |
zfs_prop_to_name(ZFS_PROP_CHECKSUM), |
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
608 |
checksum_changed_cb, os)); |
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
609 |
VERIFY0(dsl_prop_unregister(ds, |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
610 |
zfs_prop_to_name(ZFS_PROP_COMPRESSION), |
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
611 |
compression_changed_cb, os)); |
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
612 |
VERIFY0(dsl_prop_unregister(ds, |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
613 |
zfs_prop_to_name(ZFS_PROP_COPIES), |
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
614 |
copies_changed_cb, os)); |
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
615 |
VERIFY0(dsl_prop_unregister(ds, |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
616 |
zfs_prop_to_name(ZFS_PROP_DEDUP), |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10801
diff
changeset
|
617 |
dedup_changed_cb, os)); |
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
618 |
VERIFY0(dsl_prop_unregister(ds, |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
619 |
zfs_prop_to_name(ZFS_PROP_LOGBIAS), |
10310
ba87b3315737
PSARC 2009/423 ZFS logbias property
Neil Perrin <Neil.Perrin@Sun.COM>
parents:
10298
diff
changeset
|
620 |
logbias_changed_cb, os)); |
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
621 |
VERIFY0(dsl_prop_unregister(ds, |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
622 |
zfs_prop_to_name(ZFS_PROP_SYNC), |
12294
2a74b443e6b1
PSARC/2010/108 zil synchronicity
Mark J Musante <Mark.Musante@Sun.COM>
parents:
12178
diff
changeset
|
623 |
sync_changed_cb, os)); |
7237
f47d41541b14
PSARC 2008/393 zfs primarycache and secondarycache properties
ek110237
parents:
7046
diff
changeset
|
624 |
} |
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
625 |
VERIFY0(dsl_prop_unregister(ds, |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
626 |
zfs_prop_to_name(ZFS_PROP_PRIMARYCACHE), |
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
627 |
primary_cache_changed_cb, os)); |
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
628 |
VERIFY0(dsl_prop_unregister(ds, |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
629 |
zfs_prop_to_name(ZFS_PROP_SECONDARYCACHE), |
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
630 |
secondary_cache_changed_cb, os)); |
789 | 631 |
} |
632 |
||
11935
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11620
diff
changeset
|
633 |
if (os->os_sa) |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11620
diff
changeset
|
634 |
sa_tear_down(os); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11620
diff
changeset
|
635 |
|
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
636 |
dmu_objset_evict_dbufs(os); |
1544 | 637 |
|
12684
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
638 |
dnode_special_close(&os->os_meta_dnode); |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
639 |
if (DMU_USERUSED_DNODE(os)) { |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
640 |
dnode_special_close(&os->os_userused_dnode); |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
641 |
dnode_special_close(&os->os_groupused_dnode); |
9396
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
642 |
} |
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
643 |
zil_free(os->os_zil); |
789 | 644 |
|
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
645 |
ASSERT3P(list_head(&os->os_dnodes), ==, NULL); |
789 | 646 |
|
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
647 |
VERIFY(arc_buf_remove_ref(os->os_phys_buf, &os->os_phys_buf)); |
12684
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
648 |
|
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
649 |
/* |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
650 |
* This is a barrier to prevent the objset from going away in |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
651 |
* dnode_move() until we can safely ensure that the objset is still in |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
652 |
* use. We consider the objset valid before the barrier and invalid |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
653 |
* after the barrier. |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
654 |
*/ |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
655 |
rw_enter(&os_lock, RW_READER); |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
656 |
rw_exit(&os_lock); |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
657 |
|
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
658 |
mutex_destroy(&os->os_lock); |
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
659 |
mutex_destroy(&os->os_obj_lock); |
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
660 |
mutex_destroy(&os->os_user_ptr_lock); |
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
661 |
kmem_free(os, sizeof (objset_t)); |
789 | 662 |
} |
663 |
||
10373
bcf97ee54990
6395956 snapshot dir needs real c/mtime
Chris Kirby <chris.kirby@sun.com>
parents:
10310
diff
changeset
|
664 |
timestruc_t |
bcf97ee54990
6395956 snapshot dir needs real c/mtime
Chris Kirby <chris.kirby@sun.com>
parents:
10310
diff
changeset
|
665 |
dmu_objset_snap_cmtime(objset_t *os) |
bcf97ee54990
6395956 snapshot dir needs real c/mtime
Chris Kirby <chris.kirby@sun.com>
parents:
10310
diff
changeset
|
666 |
{ |
bcf97ee54990
6395956 snapshot dir needs real c/mtime
Chris Kirby <chris.kirby@sun.com>
parents:
10310
diff
changeset
|
667 |
return (dsl_dir_snap_cmtime(os->os_dsl_dataset->ds_dir)); |
bcf97ee54990
6395956 snapshot dir needs real c/mtime
Chris Kirby <chris.kirby@sun.com>
parents:
10310
diff
changeset
|
668 |
} |
bcf97ee54990
6395956 snapshot dir needs real c/mtime
Chris Kirby <chris.kirby@sun.com>
parents:
10310
diff
changeset
|
669 |
|
789 | 670 |
/* called from dsl for meta-objset */ |
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
671 |
objset_t * |
3547
e396e0a440b1
6512391 DMU should leverage ZIO dependencies to achieve greater parallelism
maybee
parents:
3290
diff
changeset
|
672 |
dmu_objset_create_impl(spa_t *spa, dsl_dataset_t *ds, blkptr_t *bp, |
e396e0a440b1
6512391 DMU should leverage ZIO dependencies to achieve greater parallelism
maybee
parents:
3290
diff
changeset
|
673 |
dmu_objset_type_t type, dmu_tx_t *tx) |
789 | 674 |
{ |
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
675 |
objset_t *os; |
789 | 676 |
dnode_t *mdn; |
677 |
||
678 |
ASSERT(dmu_tx_is_syncing(tx)); |
|
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
679 |
|
12982
5d7f2db1e620
6972862 rollback can leak log blocks
Mark Maybee <Mark.Maybee@Sun.COM>
parents:
12839
diff
changeset
|
680 |
if (ds != NULL) |
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
681 |
VERIFY0(dmu_objset_from_ds(ds, &os)); |
12982
5d7f2db1e620
6972862 rollback can leak log blocks
Mark Maybee <Mark.Maybee@Sun.COM>
parents:
12839
diff
changeset
|
682 |
else |
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
683 |
VERIFY0(dmu_objset_open_impl(spa, NULL, bp, &os)); |
12982
5d7f2db1e620
6972862 rollback can leak log blocks
Mark Maybee <Mark.Maybee@Sun.COM>
parents:
12839
diff
changeset
|
684 |
|
12684
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
685 |
mdn = DMU_META_DNODE(os); |
789 | 686 |
|
687 |
dnode_allocate(mdn, DMU_OT_DNODE, 1 << DNODE_BLOCK_SHIFT, |
|
688 |
DN_MAX_INDBLKSHIFT, DMU_OT_NONE, 0, tx); |
|
689 |
||
690 |
/* |
|
691 |
* We don't want to have to increase the meta-dnode's nlevels |
|
692 |
* later, because then we could do it in quescing context while |
|
693 |
* we are also accessing it in open context. |
|
694 |
* |
|
695 |
* This precaution is not necessary for the MOS (ds == NULL), |
|
696 |
* because the MOS is only updated in syncing context. |
|
697 |
* This is most fortunate: the MOS is the only objset that |
|
698 |
* needs to be synced multiple times as spa_sync() iterates |
|
699 |
* to convergence, so minimizing its dn_nlevels matters. |
|
700 |
*/ |
|
1544 | 701 |
if (ds != NULL) { |
702 |
int levels = 1; |
|
703 |
||
704 |
/* |
|
705 |
* Determine the number of levels necessary for the meta-dnode |
|
706 |
* to contain DN_MAX_OBJECT dnodes. |
|
707 |
*/ |
|
708 |
while ((uint64_t)mdn->dn_nblkptr << (mdn->dn_datablkshift + |
|
709 |
(levels - 1) * (mdn->dn_indblkshift - SPA_BLKPTRSHIFT)) < |
|
710 |
DN_MAX_OBJECT * sizeof (dnode_phys_t)) |
|
711 |
levels++; |
|
712 |
||
789 | 713 |
mdn->dn_next_nlevels[tx->tx_txg & TXG_MASK] = |
1544 | 714 |
mdn->dn_nlevels = levels; |
715 |
} |
|
789 | 716 |
|
717 |
ASSERT(type != DMU_OST_NONE); |
|
718 |
ASSERT(type != DMU_OST_ANY); |
|
719 |
ASSERT(type < DMU_OST_NUMTYPES); |
|
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
720 |
os->os_phys->os_type = type; |
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
721 |
if (dmu_objset_userused_enabled(os)) { |
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
722 |
os->os_phys->os_flags |= OBJSET_FLAG_USERACCOUNTING_COMPLETE; |
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
723 |
os->os_flags = os->os_phys->os_flags; |
9396
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
724 |
} |
789 | 725 |
|
726 |
dsl_dataset_dirty(ds, tx); |
|
727 |
||
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
728 |
return (os); |
789 | 729 |
} |
730 |
||
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
731 |
typedef struct dmu_objset_create_arg { |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
732 |
const char *doca_name; |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
733 |
cred_t *doca_cred; |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
734 |
void (*doca_userfunc)(objset_t *os, void *arg, |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
735 |
cred_t *cr, dmu_tx_t *tx); |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
736 |
void *doca_userarg; |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
737 |
dmu_objset_type_t doca_type; |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
738 |
uint64_t doca_flags; |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
739 |
} dmu_objset_create_arg_t; |
789 | 740 |
|
4543 | 741 |
/*ARGSUSED*/ |
789 | 742 |
static int |
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
743 |
dmu_objset_create_check(void *arg, dmu_tx_t *tx) |
789 | 744 |
{ |
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
745 |
dmu_objset_create_arg_t *doca = arg; |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
746 |
dsl_pool_t *dp = dmu_tx_pool(tx); |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
747 |
dsl_dir_t *pdd; |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
748 |
const char *tail; |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
749 |
int error; |
2199 | 750 |
|
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
751 |
if (strchr(doca->doca_name, '@') != NULL) |
13980
d7059eb1884c
3598 want to dtrace when errors are generated in zfs
Matthew Ahrens <mahrens@delphix.com>
parents:
13973
diff
changeset
|
752 |
return (SET_ERROR(EINVAL)); |
2199 | 753 |
|
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
754 |
error = dsl_dir_hold(dp, doca->doca_name, FTAG, &pdd, &tail); |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
755 |
if (error != 0) |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
756 |
return (error); |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
757 |
if (tail == NULL) { |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
758 |
dsl_dir_rele(pdd, FTAG); |
13980
d7059eb1884c
3598 want to dtrace when errors are generated in zfs
Matthew Ahrens <mahrens@delphix.com>
parents:
13973
diff
changeset
|
759 |
return (SET_ERROR(EEXIST)); |
2199 | 760 |
} |
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
761 |
dsl_dir_rele(pdd, FTAG); |
4543 | 762 |
|
2199 | 763 |
return (0); |
764 |
} |
|
765 |
||
766 |
static void |
|
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
767 |
dmu_objset_create_sync(void *arg, dmu_tx_t *tx) |
2199 | 768 |
{ |
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
769 |
dmu_objset_create_arg_t *doca = arg; |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
770 |
dsl_pool_t *dp = dmu_tx_pool(tx); |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
771 |
dsl_dir_t *pdd; |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
772 |
const char *tail; |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
773 |
dsl_dataset_t *ds; |
12982
5d7f2db1e620
6972862 rollback can leak log blocks
Mark Maybee <Mark.Maybee@Sun.COM>
parents:
12839
diff
changeset
|
774 |
uint64_t obj; |
13743
95aba6e49b9f
2882 implement libzfs_core
Matthew Ahrens <mahrens@delphix.com>
parents:
13055
diff
changeset
|
775 |
blkptr_t *bp; |
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
776 |
objset_t *os; |
789 | 777 |
|
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
778 |
VERIFY0(dsl_dir_hold(dp, doca->doca_name, FTAG, &pdd, &tail)); |
789 | 779 |
|
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
780 |
obj = dsl_dataset_create_sync(pdd, tail, NULL, doca->doca_flags, |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
781 |
doca->doca_cred, tx); |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
782 |
|
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
783 |
VERIFY0(dsl_dataset_hold_obj(pdd->dd_pool, obj, FTAG, &ds)); |
13743
95aba6e49b9f
2882 implement libzfs_core
Matthew Ahrens <mahrens@delphix.com>
parents:
13055
diff
changeset
|
784 |
bp = dsl_dataset_get_blkptr(ds); |
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
785 |
os = dmu_objset_create_impl(pdd->dd_pool->dp_spa, |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
786 |
ds, bp, doca->doca_type, tx); |
789 | 787 |
|
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
788 |
if (doca->doca_userfunc != NULL) { |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
789 |
doca->doca_userfunc(os, doca->doca_userarg, |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
790 |
doca->doca_cred, tx); |
789 | 791 |
} |
4543 | 792 |
|
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
793 |
spa_history_log_internal_ds(ds, "create", tx, ""); |
13743
95aba6e49b9f
2882 implement libzfs_core
Matthew Ahrens <mahrens@delphix.com>
parents:
13055
diff
changeset
|
794 |
dsl_dataset_rele(ds, FTAG); |
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
795 |
dsl_dir_rele(pdd, FTAG); |
789 | 796 |
} |
797 |
||
798 |
int |
|
10272
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
799 |
dmu_objset_create(const char *name, dmu_objset_type_t type, uint64_t flags, |
4543 | 800 |
void (*func)(objset_t *os, void *arg, cred_t *cr, dmu_tx_t *tx), void *arg) |
789 | 801 |
{ |
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
802 |
dmu_objset_create_arg_t doca; |
10272
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
803 |
|
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
804 |
doca.doca_name = name; |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
805 |
doca.doca_cred = CRED(); |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
806 |
doca.doca_flags = flags; |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
807 |
doca.doca_userfunc = func; |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
808 |
doca.doca_userarg = arg; |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
809 |
doca.doca_type = type; |
10272
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
810 |
|
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
811 |
return (dsl_sync_task(name, |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
812 |
dmu_objset_create_check, dmu_objset_create_sync, &doca, 5)); |
789 | 813 |
} |
814 |
||
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
815 |
typedef struct dmu_objset_clone_arg { |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
816 |
const char *doca_clone; |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
817 |
const char *doca_origin; |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
818 |
cred_t *doca_cred; |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
819 |
} dmu_objset_clone_arg_t; |
13743
95aba6e49b9f
2882 implement libzfs_core
Matthew Ahrens <mahrens@delphix.com>
parents:
13055
diff
changeset
|
820 |
|
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
821 |
/*ARGSUSED*/ |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
822 |
static int |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
823 |
dmu_objset_clone_check(void *arg, dmu_tx_t *tx) |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
824 |
{ |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
825 |
dmu_objset_clone_arg_t *doca = arg; |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
826 |
dsl_dir_t *pdd; |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
827 |
const char *tail; |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
828 |
int error; |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
829 |
dsl_dataset_t *origin; |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
830 |
dsl_pool_t *dp = dmu_tx_pool(tx); |
13743
95aba6e49b9f
2882 implement libzfs_core
Matthew Ahrens <mahrens@delphix.com>
parents:
13055
diff
changeset
|
831 |
|
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
832 |
if (strchr(doca->doca_clone, '@') != NULL) |
13980
d7059eb1884c
3598 want to dtrace when errors are generated in zfs
Matthew Ahrens <mahrens@delphix.com>
parents:
13973
diff
changeset
|
833 |
return (SET_ERROR(EINVAL)); |
5367 | 834 |
|
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
835 |
error = dsl_dir_hold(dp, doca->doca_clone, FTAG, &pdd, &tail); |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
836 |
if (error != 0) |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
837 |
return (error); |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
838 |
if (tail == NULL) { |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
839 |
dsl_dir_rele(pdd, FTAG); |
13980
d7059eb1884c
3598 want to dtrace when errors are generated in zfs
Matthew Ahrens <mahrens@delphix.com>
parents:
13973
diff
changeset
|
840 |
return (SET_ERROR(EEXIST)); |
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
841 |
} |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
842 |
/* You can't clone across pools. */ |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
843 |
if (pdd->dd_pool != dp) { |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
844 |
dsl_dir_rele(pdd, FTAG); |
13980
d7059eb1884c
3598 want to dtrace when errors are generated in zfs
Matthew Ahrens <mahrens@delphix.com>
parents:
13973
diff
changeset
|
845 |
return (SET_ERROR(EXDEV)); |
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
846 |
} |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
847 |
dsl_dir_rele(pdd, FTAG); |
9355
09928982c591
6818183 zfs snapshot -r is slow due to set_snap_props() doing txg_wait_synced() for each new snapshot
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
8415
diff
changeset
|
848 |
|
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
849 |
error = dsl_dataset_hold(dp, doca->doca_origin, FTAG, &origin); |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
850 |
if (error != 0) |
13055 | 851 |
return (error); |
852 |
||
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
853 |
/* You can't clone across pools. */ |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
854 |
if (origin->ds_dir->dd_pool != dp) { |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
855 |
dsl_dataset_rele(origin, FTAG); |
13980
d7059eb1884c
3598 want to dtrace when errors are generated in zfs
Matthew Ahrens <mahrens@delphix.com>
parents:
13973
diff
changeset
|
856 |
return (SET_ERROR(EXDEV)); |
11022
63ab26072e41
PSARC 2009/510 ZFS received properties
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
10922
diff
changeset
|
857 |
} |
13055 | 858 |
|
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
859 |
/* You can only clone snapshots, not the head datasets. */ |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
860 |
if (!dsl_dataset_is_snapshot(origin)) { |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
861 |
dsl_dataset_rele(origin, FTAG); |
13980
d7059eb1884c
3598 want to dtrace when errors are generated in zfs
Matthew Ahrens <mahrens@delphix.com>
parents:
13973
diff
changeset
|
862 |
return (SET_ERROR(EINVAL)); |
13055 | 863 |
} |
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
864 |
dsl_dataset_rele(origin, FTAG); |
3637
526d8412c163
6402600 administrative actions while doing 'zfs recv' or 'zfs destroy' can cause confusing situation
rm160521
parents:
3547
diff
changeset
|
865 |
|
12839
1eab9192da8b
6844896 recursive snapshots take a long time
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12722
diff
changeset
|
866 |
return (0); |
2199 | 867 |
} |
868 |
||
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
869 |
static void |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
870 |
dmu_objset_clone_sync(void *arg, dmu_tx_t *tx) |
2199 | 871 |
{ |
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
872 |
dmu_objset_clone_arg_t *doca = arg; |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
873 |
dsl_pool_t *dp = dmu_tx_pool(tx); |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
874 |
dsl_dir_t *pdd; |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
875 |
const char *tail; |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
876 |
dsl_dataset_t *origin, *ds; |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
877 |
uint64_t obj; |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
878 |
char namebuf[MAXNAMELEN]; |
13743
95aba6e49b9f
2882 implement libzfs_core
Matthew Ahrens <mahrens@delphix.com>
parents:
13055
diff
changeset
|
879 |
|
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
880 |
VERIFY0(dsl_dir_hold(dp, doca->doca_clone, FTAG, &pdd, &tail)); |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
881 |
VERIFY0(dsl_dataset_hold(dp, doca->doca_origin, FTAG, &origin)); |
13743
95aba6e49b9f
2882 implement libzfs_core
Matthew Ahrens <mahrens@delphix.com>
parents:
13055
diff
changeset
|
882 |
|
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
883 |
obj = dsl_dataset_create_sync(pdd, tail, origin, 0, |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
884 |
doca->doca_cred, tx); |
13743
95aba6e49b9f
2882 implement libzfs_core
Matthew Ahrens <mahrens@delphix.com>
parents:
13055
diff
changeset
|
885 |
|
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
886 |
VERIFY0(dsl_dataset_hold_obj(pdd->dd_pool, obj, FTAG, &ds)); |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
887 |
dsl_dataset_name(origin, namebuf); |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
888 |
spa_history_log_internal_ds(ds, "clone", tx, |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
889 |
"origin=%s (%llu)", namebuf, origin->ds_object); |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
890 |
dsl_dataset_rele(ds, FTAG); |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
891 |
dsl_dataset_rele(origin, FTAG); |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
892 |
dsl_dir_rele(pdd, FTAG); |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
893 |
} |
13743
95aba6e49b9f
2882 implement libzfs_core
Matthew Ahrens <mahrens@delphix.com>
parents:
13055
diff
changeset
|
894 |
|
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
895 |
int |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
896 |
dmu_objset_clone(const char *clone, const char *origin) |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
897 |
{ |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
898 |
dmu_objset_clone_arg_t doca; |
13743
95aba6e49b9f
2882 implement libzfs_core
Matthew Ahrens <mahrens@delphix.com>
parents:
13055
diff
changeset
|
899 |
|
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
900 |
doca.doca_clone = clone; |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
901 |
doca.doca_origin = origin; |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
902 |
doca.doca_cred = CRED(); |
13743
95aba6e49b9f
2882 implement libzfs_core
Matthew Ahrens <mahrens@delphix.com>
parents:
13055
diff
changeset
|
903 |
|
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
904 |
return (dsl_sync_task(clone, |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
905 |
dmu_objset_clone_check, dmu_objset_clone_sync, &doca, 5)); |
13743
95aba6e49b9f
2882 implement libzfs_core
Matthew Ahrens <mahrens@delphix.com>
parents:
13055
diff
changeset
|
906 |
} |
95aba6e49b9f
2882 implement libzfs_core
Matthew Ahrens <mahrens@delphix.com>
parents:
13055
diff
changeset
|
907 |
|
95aba6e49b9f
2882 implement libzfs_core
Matthew Ahrens <mahrens@delphix.com>
parents:
13055
diff
changeset
|
908 |
int |
95aba6e49b9f
2882 implement libzfs_core
Matthew Ahrens <mahrens@delphix.com>
parents:
13055
diff
changeset
|
909 |
dmu_objset_snapshot_one(const char *fsname, const char *snapname) |
95aba6e49b9f
2882 implement libzfs_core
Matthew Ahrens <mahrens@delphix.com>
parents:
13055
diff
changeset
|
910 |
{ |
95aba6e49b9f
2882 implement libzfs_core
Matthew Ahrens <mahrens@delphix.com>
parents:
13055
diff
changeset
|
911 |
int err; |
95aba6e49b9f
2882 implement libzfs_core
Matthew Ahrens <mahrens@delphix.com>
parents:
13055
diff
changeset
|
912 |
char *longsnap = kmem_asprintf("%s@%s", fsname, snapname); |
95aba6e49b9f
2882 implement libzfs_core
Matthew Ahrens <mahrens@delphix.com>
parents:
13055
diff
changeset
|
913 |
nvlist_t *snaps = fnvlist_alloc(); |
95aba6e49b9f
2882 implement libzfs_core
Matthew Ahrens <mahrens@delphix.com>
parents:
13055
diff
changeset
|
914 |
|
95aba6e49b9f
2882 implement libzfs_core
Matthew Ahrens <mahrens@delphix.com>
parents:
13055
diff
changeset
|
915 |
fnvlist_add_boolean(snaps, longsnap); |
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
916 |
strfree(longsnap); |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
917 |
err = dsl_dataset_snapshot(snaps, NULL, NULL); |
13743
95aba6e49b9f
2882 implement libzfs_core
Matthew Ahrens <mahrens@delphix.com>
parents:
13055
diff
changeset
|
918 |
fnvlist_free(snaps); |
95aba6e49b9f
2882 implement libzfs_core
Matthew Ahrens <mahrens@delphix.com>
parents:
13055
diff
changeset
|
919 |
return (err); |
95aba6e49b9f
2882 implement libzfs_core
Matthew Ahrens <mahrens@delphix.com>
parents:
13055
diff
changeset
|
920 |
} |
95aba6e49b9f
2882 implement libzfs_core
Matthew Ahrens <mahrens@delphix.com>
parents:
13055
diff
changeset
|
921 |
|
789 | 922 |
static void |
9396
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
923 |
dmu_objset_sync_dnodes(list_t *list, list_t *newlist, dmu_tx_t *tx) |
789 | 924 |
{ |
3547
e396e0a440b1
6512391 DMU should leverage ZIO dependencies to achieve greater parallelism
maybee
parents:
3290
diff
changeset
|
925 |
dnode_t *dn; |
789 | 926 |
|
3547
e396e0a440b1
6512391 DMU should leverage ZIO dependencies to achieve greater parallelism
maybee
parents:
3290
diff
changeset
|
927 |
while (dn = list_head(list)) { |
e396e0a440b1
6512391 DMU should leverage ZIO dependencies to achieve greater parallelism
maybee
parents:
3290
diff
changeset
|
928 |
ASSERT(dn->dn_object != DMU_META_DNODE_OBJECT); |
e396e0a440b1
6512391 DMU should leverage ZIO dependencies to achieve greater parallelism
maybee
parents:
3290
diff
changeset
|
929 |
ASSERT(dn->dn_dbuf->db_data_pending); |
e396e0a440b1
6512391 DMU should leverage ZIO dependencies to achieve greater parallelism
maybee
parents:
3290
diff
changeset
|
930 |
/* |
9396
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
931 |
* Initialize dn_zio outside dnode_sync() because the |
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
932 |
* meta-dnode needs to set it ouside dnode_sync(). |
3547
e396e0a440b1
6512391 DMU should leverage ZIO dependencies to achieve greater parallelism
maybee
parents:
3290
diff
changeset
|
933 |
*/ |
e396e0a440b1
6512391 DMU should leverage ZIO dependencies to achieve greater parallelism
maybee
parents:
3290
diff
changeset
|
934 |
dn->dn_zio = dn->dn_dbuf->db_data_pending->dr_zio; |
e396e0a440b1
6512391 DMU should leverage ZIO dependencies to achieve greater parallelism
maybee
parents:
3290
diff
changeset
|
935 |
ASSERT(dn->dn_zio); |
789 | 936 |
|
3547
e396e0a440b1
6512391 DMU should leverage ZIO dependencies to achieve greater parallelism
maybee
parents:
3290
diff
changeset
|
937 |
ASSERT3U(dn->dn_nlevels, <=, DN_MAX_LEVELS); |
e396e0a440b1
6512391 DMU should leverage ZIO dependencies to achieve greater parallelism
maybee
parents:
3290
diff
changeset
|
938 |
list_remove(list, dn); |
9396
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
939 |
|
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
940 |
if (newlist) { |
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
941 |
(void) dnode_add_ref(dn, newlist); |
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
942 |
list_insert_tail(newlist, dn); |
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
943 |
} |
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
944 |
|
3547
e396e0a440b1
6512391 DMU should leverage ZIO dependencies to achieve greater parallelism
maybee
parents:
3290
diff
changeset
|
945 |
dnode_sync(dn, tx); |
e396e0a440b1
6512391 DMU should leverage ZIO dependencies to achieve greater parallelism
maybee
parents:
3290
diff
changeset
|
946 |
} |
e396e0a440b1
6512391 DMU should leverage ZIO dependencies to achieve greater parallelism
maybee
parents:
3290
diff
changeset
|
947 |
} |
2981 | 948 |
|
3547
e396e0a440b1
6512391 DMU should leverage ZIO dependencies to achieve greater parallelism
maybee
parents:
3290
diff
changeset
|
949 |
/* ARGSUSED */ |
e396e0a440b1
6512391 DMU should leverage ZIO dependencies to achieve greater parallelism
maybee
parents:
3290
diff
changeset
|
950 |
static void |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10801
diff
changeset
|
951 |
dmu_objset_write_ready(zio_t *zio, arc_buf_t *abuf, void *arg) |
3547
e396e0a440b1
6512391 DMU should leverage ZIO dependencies to achieve greater parallelism
maybee
parents:
3290
diff
changeset
|
952 |
{ |
7754
b80e4842ad54
6754011 SPA 3.0: lock breakup, i/o pipeline refactoring, device failure handling
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
7294
diff
changeset
|
953 |
blkptr_t *bp = zio->io_bp; |
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
954 |
objset_t *os = arg; |
3547
e396e0a440b1
6512391 DMU should leverage ZIO dependencies to achieve greater parallelism
maybee
parents:
3290
diff
changeset
|
955 |
dnode_phys_t *dnp = &os->os_phys->os_meta_dnode; |
2981 | 956 |
|
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
957 |
ASSERT3P(bp, ==, os->os_rootbp); |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
958 |
ASSERT3U(BP_GET_TYPE(bp), ==, DMU_OT_OBJSET); |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
959 |
ASSERT0(BP_GET_LEVEL(bp)); |
5329 | 960 |
|
3547
e396e0a440b1
6512391 DMU should leverage ZIO dependencies to achieve greater parallelism
maybee
parents:
3290
diff
changeset
|
961 |
/* |
9396
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
962 |
* Update rootbp fill count: it should be the number of objects |
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
963 |
* allocated in the object set (not counting the "special" |
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
964 |
* objects that are stored in the objset_phys_t -- the meta |
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
965 |
* dnode and user/group accounting objects). |
3547
e396e0a440b1
6512391 DMU should leverage ZIO dependencies to achieve greater parallelism
maybee
parents:
3290
diff
changeset
|
966 |
*/ |
9396
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
967 |
bp->blk_fill = 0; |
7754
b80e4842ad54
6754011 SPA 3.0: lock breakup, i/o pipeline refactoring, device failure handling
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
7294
diff
changeset
|
968 |
for (int i = 0; i < dnp->dn_nblkptr; i++) |
3547
e396e0a440b1
6512391 DMU should leverage ZIO dependencies to achieve greater parallelism
maybee
parents:
3290
diff
changeset
|
969 |
bp->blk_fill += dnp->dn_blkptr[i].blk_fill; |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10801
diff
changeset
|
970 |
} |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10801
diff
changeset
|
971 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10801
diff
changeset
|
972 |
/* ARGSUSED */ |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10801
diff
changeset
|
973 |
static void |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10801
diff
changeset
|
974 |
dmu_objset_write_done(zio_t *zio, arc_buf_t *abuf, void *arg) |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10801
diff
changeset
|
975 |
{ |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10801
diff
changeset
|
976 |
blkptr_t *bp = zio->io_bp; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10801
diff
changeset
|
977 |
blkptr_t *bp_orig = &zio->io_bp_orig; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10801
diff
changeset
|
978 |
objset_t *os = arg; |
5329 | 979 |
|
7754
b80e4842ad54
6754011 SPA 3.0: lock breakup, i/o pipeline refactoring, device failure handling
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
7294
diff
changeset
|
980 |
if (zio->io_flags & ZIO_FLAG_IO_REWRITE) { |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10801
diff
changeset
|
981 |
ASSERT(BP_EQUAL(bp, bp_orig)); |
7754
b80e4842ad54
6754011 SPA 3.0: lock breakup, i/o pipeline refactoring, device failure handling
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
7294
diff
changeset
|
982 |
} else { |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10801
diff
changeset
|
983 |
dsl_dataset_t *ds = os->os_dsl_dataset; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10801
diff
changeset
|
984 |
dmu_tx_t *tx = os->os_synctx; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10801
diff
changeset
|
985 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10801
diff
changeset
|
986 |
(void) dsl_dataset_block_kill(ds, bp_orig, tx, B_TRUE); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10801
diff
changeset
|
987 |
dsl_dataset_block_born(ds, bp, tx); |
5329 | 988 |
} |
789 | 989 |
} |
990 |
||
991 |
/* called from dsl */ |
|
992 |
void |
|
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
993 |
dmu_objset_sync(objset_t *os, zio_t *pio, dmu_tx_t *tx) |
789 | 994 |
{ |
995 |
int txgoff; |
|
1544 | 996 |
zbookmark_t zb; |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10801
diff
changeset
|
997 |
zio_prop_t zp; |
3547
e396e0a440b1
6512391 DMU should leverage ZIO dependencies to achieve greater parallelism
maybee
parents:
3290
diff
changeset
|
998 |
zio_t *zio; |
e396e0a440b1
6512391 DMU should leverage ZIO dependencies to achieve greater parallelism
maybee
parents:
3290
diff
changeset
|
999 |
list_t *list; |
9396
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1000 |
list_t *newlist = NULL; |
3547
e396e0a440b1
6512391 DMU should leverage ZIO dependencies to achieve greater parallelism
maybee
parents:
3290
diff
changeset
|
1001 |
dbuf_dirty_record_t *dr; |
e396e0a440b1
6512391 DMU should leverage ZIO dependencies to achieve greater parallelism
maybee
parents:
3290
diff
changeset
|
1002 |
|
e396e0a440b1
6512391 DMU should leverage ZIO dependencies to achieve greater parallelism
maybee
parents:
3290
diff
changeset
|
1003 |
dprintf_ds(os->os_dsl_dataset, "txg=%llu\n", tx->tx_txg); |
789 | 1004 |
|
1005 |
ASSERT(dmu_tx_is_syncing(tx)); |
|
1006 |
/* XXX the write_done callback should really give us the tx... */ |
|
1007 |
os->os_synctx = tx; |
|
1008 |
||
3882 | 1009 |
if (os->os_dsl_dataset == NULL) { |
1010 |
/* |
|
1011 |
* This is the MOS. If we have upgraded, |
|
1012 |
* spa_max_replication() could change, so reset |
|
1013 |
* os_copies here. |
|
1014 |
*/ |
|
1015 |
os->os_copies = spa_max_replication(os->os_spa); |
|
1016 |
} |
|
1017 |
||
3547
e396e0a440b1
6512391 DMU should leverage ZIO dependencies to achieve greater parallelism
maybee
parents:
3290
diff
changeset
|
1018 |
/* |
e396e0a440b1
6512391 DMU should leverage ZIO dependencies to achieve greater parallelism
maybee
parents:
3290
diff
changeset
|
1019 |
* Create the root block IO |
e396e0a440b1
6512391 DMU should leverage ZIO dependencies to achieve greater parallelism
maybee
parents:
3290
diff
changeset
|
1020 |
*/ |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10801
diff
changeset
|
1021 |
SET_BOOKMARK(&zb, os->os_dsl_dataset ? |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10801
diff
changeset
|
1022 |
os->os_dsl_dataset->ds_object : DMU_META_OBJSET, |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10801
diff
changeset
|
1023 |
ZB_ROOT_OBJECT, ZB_ROOT_LEVEL, ZB_ROOT_BLKID); |
13941
d48547176ab4
3498 panic in arc_read(): !refcount_is_zero(&pbuf->b_hdr->b_refcnt)
George Wilson <george.wilson@delphix.com>
parents:
13780
diff
changeset
|
1024 |
arc_release(os->os_phys_buf, &os->os_phys_buf); |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10801
diff
changeset
|
1025 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10801
diff
changeset
|
1026 |
dmu_write_policy(os, NULL, 0, 0, &zp); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10801
diff
changeset
|
1027 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10801
diff
changeset
|
1028 |
zio = arc_write(pio, os->os_spa, tx->tx_txg, |
14039
6cfd5a5778b9
3137 L2ARC compression
Saso Kiselkov <skiselkov@gmail.com>
parents:
13980
diff
changeset
|
1029 |
os->os_rootbp, os->os_phys_buf, DMU_OS_IS_L2CACHEABLE(os), |
6cfd5a5778b9
3137 L2ARC compression
Saso Kiselkov <skiselkov@gmail.com>
parents:
13980
diff
changeset
|
1030 |
DMU_OS_IS_L2COMPRESSIBLE(os), &zp, dmu_objset_write_ready, |
14167
dceb17481b99
4045 zfs write throttle & i/o scheduler performance work
Matthew Ahrens <mahrens@delphix.com>
parents:
14091
diff
changeset
|
1031 |
NULL, dmu_objset_write_done, os, ZIO_PRIORITY_ASYNC_WRITE, |
14039
6cfd5a5778b9
3137 L2ARC compression
Saso Kiselkov <skiselkov@gmail.com>
parents:
13980
diff
changeset
|
1032 |
ZIO_FLAG_MUSTSUCCEED, &zb); |
3547
e396e0a440b1
6512391 DMU should leverage ZIO dependencies to achieve greater parallelism
maybee
parents:
3290
diff
changeset
|
1033 |
|
e396e0a440b1
6512391 DMU should leverage ZIO dependencies to achieve greater parallelism
maybee
parents:
3290
diff
changeset
|
1034 |
/* |
9396
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1035 |
* Sync special dnodes - the parent IO for the sync is the root block |
3547
e396e0a440b1
6512391 DMU should leverage ZIO dependencies to achieve greater parallelism
maybee
parents:
3290
diff
changeset
|
1036 |
*/ |
12684
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
1037 |
DMU_META_DNODE(os)->dn_zio = zio; |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
1038 |
dnode_sync(DMU_META_DNODE(os), tx); |
789 | 1039 |
|
9396
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1040 |
os->os_phys->os_flags = os->os_flags; |
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1041 |
|
12684
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
1042 |
if (DMU_USERUSED_DNODE(os) && |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
1043 |
DMU_USERUSED_DNODE(os)->dn_type != DMU_OT_NONE) { |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
1044 |
DMU_USERUSED_DNODE(os)->dn_zio = zio; |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
1045 |
dnode_sync(DMU_USERUSED_DNODE(os), tx); |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
1046 |
DMU_GROUPUSED_DNODE(os)->dn_zio = zio; |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
1047 |
dnode_sync(DMU_GROUPUSED_DNODE(os), tx); |
9396
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1048 |
} |
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1049 |
|
789 | 1050 |
txgoff = tx->tx_txg & TXG_MASK; |
1051 |
||
9396
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1052 |
if (dmu_objset_userused_enabled(os)) { |
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1053 |
newlist = &os->os_synced_dnodes; |
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1054 |
/* |
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1055 |
* We must create the list here because it uses the |
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1056 |
* dn_dirty_link[] of this txg. |
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1057 |
*/ |
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1058 |
list_create(newlist, sizeof (dnode_t), |
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1059 |
offsetof(dnode_t, dn_dirty_link[txgoff])); |
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1060 |
} |
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1061 |
|
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1062 |
dmu_objset_sync_dnodes(&os->os_free_dnodes[txgoff], newlist, tx); |
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1063 |
dmu_objset_sync_dnodes(&os->os_dirty_dnodes[txgoff], newlist, tx); |
789 | 1064 |
|
12684
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
1065 |
list = &DMU_META_DNODE(os)->dn_dirty_records[txgoff]; |
3547
e396e0a440b1
6512391 DMU should leverage ZIO dependencies to achieve greater parallelism
maybee
parents:
3290
diff
changeset
|
1066 |
while (dr = list_head(list)) { |
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1067 |
ASSERT0(dr->dr_dbuf->db_level); |
3547
e396e0a440b1
6512391 DMU should leverage ZIO dependencies to achieve greater parallelism
maybee
parents:
3290
diff
changeset
|
1068 |
list_remove(list, dr); |
e396e0a440b1
6512391 DMU should leverage ZIO dependencies to achieve greater parallelism
maybee
parents:
3290
diff
changeset
|
1069 |
if (dr->dr_zio) |
e396e0a440b1
6512391 DMU should leverage ZIO dependencies to achieve greater parallelism
maybee
parents:
3290
diff
changeset
|
1070 |
zio_nowait(dr->dr_zio); |
e396e0a440b1
6512391 DMU should leverage ZIO dependencies to achieve greater parallelism
maybee
parents:
3290
diff
changeset
|
1071 |
} |
789 | 1072 |
/* |
1073 |
* Free intent log blocks up to this tx. |
|
1074 |
*/ |
|
1075 |
zil_sync(os->os_zil, tx); |
|
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
6992
diff
changeset
|
1076 |
os->os_phys->os_zil_header = os->os_zil_header; |
3547
e396e0a440b1
6512391 DMU should leverage ZIO dependencies to achieve greater parallelism
maybee
parents:
3290
diff
changeset
|
1077 |
zio_nowait(zio); |
789 | 1078 |
} |
1079 |
||
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10801
diff
changeset
|
1080 |
boolean_t |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10801
diff
changeset
|
1081 |
dmu_objset_is_dirty(objset_t *os, uint64_t txg) |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10801
diff
changeset
|
1082 |
{ |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10801
diff
changeset
|
1083 |
return (!list_is_empty(&os->os_dirty_dnodes[txg & TXG_MASK]) || |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10801
diff
changeset
|
1084 |
!list_is_empty(&os->os_free_dnodes[txg & TXG_MASK])); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10801
diff
changeset
|
1085 |
} |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10801
diff
changeset
|
1086 |
|
12684
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
1087 |
static objset_used_cb_t *used_cbs[DMU_OST_NUMTYPES]; |
9396
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1088 |
|
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1089 |
void |
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1090 |
dmu_objset_register_type(dmu_objset_type_t ost, objset_used_cb_t *cb) |
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1091 |
{ |
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1092 |
used_cbs[ost] = cb; |
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1093 |
} |
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1094 |
|
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1095 |
boolean_t |
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
1096 |
dmu_objset_userused_enabled(objset_t *os) |
9396
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1097 |
{ |
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1098 |
return (spa_version(os->os_spa) >= SPA_VERSION_USERSPACE && |
12684
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
1099 |
used_cbs[os->os_phys->os_type] != NULL && |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
1100 |
DMU_USERUSED_DNODE(os) != NULL); |
9396
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1101 |
} |
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1102 |
|
10407
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10373
diff
changeset
|
1103 |
static void |
11935
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11620
diff
changeset
|
1104 |
do_userquota_update(objset_t *os, uint64_t used, uint64_t flags, |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11620
diff
changeset
|
1105 |
uint64_t user, uint64_t group, boolean_t subtract, dmu_tx_t *tx) |
10407
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10373
diff
changeset
|
1106 |
{ |
11935
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11620
diff
changeset
|
1107 |
if ((flags & DNODE_FLAG_USERUSED_ACCOUNTED)) { |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11620
diff
changeset
|
1108 |
int64_t delta = DNODE_SIZE + used; |
10407
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10373
diff
changeset
|
1109 |
if (subtract) |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10373
diff
changeset
|
1110 |
delta = -delta; |
13765
9410cf539b11
backout 3006: causes 3046 (panics after mounting root)
Richard Lowe <richlowe@richlowe.net>
parents:
13764
diff
changeset
|
1111 |
VERIFY3U(0, ==, zap_increment_int(os, DMU_USERUSED_OBJECT, |
10407
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10373
diff
changeset
|
1112 |
user, delta, tx)); |
13765
9410cf539b11
backout 3006: causes 3046 (panics after mounting root)
Richard Lowe <richlowe@richlowe.net>
parents:
13764
diff
changeset
|
1113 |
VERIFY3U(0, ==, zap_increment_int(os, DMU_GROUPUSED_OBJECT, |
10407
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10373
diff
changeset
|
1114 |
group, delta, tx)); |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10373
diff
changeset
|
1115 |
} |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10373
diff
changeset
|
1116 |
} |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10373
diff
changeset
|
1117 |
|
9396
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1118 |
void |
11935
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11620
diff
changeset
|
1119 |
dmu_objset_do_userquota_updates(objset_t *os, dmu_tx_t *tx) |
9396
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1120 |
{ |
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1121 |
dnode_t *dn; |
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1122 |
list_t *list = &os->os_synced_dnodes; |
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1123 |
|
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1124 |
ASSERT(list_head(list) == NULL || dmu_objset_userused_enabled(os)); |
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1125 |
|
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1126 |
while (dn = list_head(list)) { |
12493
89ce40422cea
6952177 SA handling of on-disk corruption can be improved
Mark Shellenbaum <Mark.Shellenbaum@Oracle.COM>
parents:
12432
diff
changeset
|
1127 |
int flags; |
9396
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1128 |
ASSERT(!DMU_OBJECT_IS_SPECIAL(dn->dn_object)); |
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1129 |
ASSERT(dn->dn_phys->dn_type == DMU_OT_NONE || |
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1130 |
dn->dn_phys->dn_flags & |
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1131 |
DNODE_FLAG_USERUSED_ACCOUNTED); |
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1132 |
|
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1133 |
/* Allocate the user/groupused objects if necessary. */ |
12684
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
1134 |
if (DMU_USERUSED_DNODE(os)->dn_type == DMU_OT_NONE) { |
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
1135 |
VERIFY(0 == zap_create_claim(os, |
9396
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1136 |
DMU_USERUSED_OBJECT, |
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1137 |
DMU_OT_USERGROUP_USED, DMU_OT_NONE, 0, tx)); |
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
1138 |
VERIFY(0 == zap_create_claim(os, |
9396
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1139 |
DMU_GROUPUSED_OBJECT, |
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1140 |
DMU_OT_USERGROUP_USED, DMU_OT_NONE, 0, tx)); |
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1141 |
} |
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1142 |
|
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1143 |
/* |
10407
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10373
diff
changeset
|
1144 |
* We intentionally modify the zap object even if the |
11935
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11620
diff
changeset
|
1145 |
* net delta is zero. Otherwise |
10407
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10373
diff
changeset
|
1146 |
* the block of the zap obj could be shared between |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10373
diff
changeset
|
1147 |
* datasets but need to be different between them after |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10373
diff
changeset
|
1148 |
* a bprewrite. |
9396
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1149 |
*/ |
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1150 |
|
12493
89ce40422cea
6952177 SA handling of on-disk corruption can be improved
Mark Shellenbaum <Mark.Shellenbaum@Oracle.COM>
parents:
12432
diff
changeset
|
1151 |
flags = dn->dn_id_flags; |
89ce40422cea
6952177 SA handling of on-disk corruption can be improved
Mark Shellenbaum <Mark.Shellenbaum@Oracle.COM>
parents:
12432
diff
changeset
|
1152 |
ASSERT(flags); |
89ce40422cea
6952177 SA handling of on-disk corruption can be improved
Mark Shellenbaum <Mark.Shellenbaum@Oracle.COM>
parents:
12432
diff
changeset
|
1153 |
if (flags & DN_ID_OLD_EXIST) { |
11935
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11620
diff
changeset
|
1154 |
do_userquota_update(os, dn->dn_oldused, dn->dn_oldflags, |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11620
diff
changeset
|
1155 |
dn->dn_olduid, dn->dn_oldgid, B_TRUE, tx); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11620
diff
changeset
|
1156 |
} |
12493
89ce40422cea
6952177 SA handling of on-disk corruption can be improved
Mark Shellenbaum <Mark.Shellenbaum@Oracle.COM>
parents:
12432
diff
changeset
|
1157 |
if (flags & DN_ID_NEW_EXIST) { |
11935
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11620
diff
changeset
|
1158 |
do_userquota_update(os, DN_USED_BYTES(dn->dn_phys), |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11620
diff
changeset
|
1159 |
dn->dn_phys->dn_flags, dn->dn_newuid, |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11620
diff
changeset
|
1160 |
dn->dn_newgid, B_FALSE, tx); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11620
diff
changeset
|
1161 |
} |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11620
diff
changeset
|
1162 |
|
12493
89ce40422cea
6952177 SA handling of on-disk corruption can be improved
Mark Shellenbaum <Mark.Shellenbaum@Oracle.COM>
parents:
12432
diff
changeset
|
1163 |
mutex_enter(&dn->dn_mtx); |
11935
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11620
diff
changeset
|
1164 |
dn->dn_oldused = 0; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11620
diff
changeset
|
1165 |
dn->dn_oldflags = 0; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11620
diff
changeset
|
1166 |
if (dn->dn_id_flags & DN_ID_NEW_EXIST) { |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11620
diff
changeset
|
1167 |
dn->dn_olduid = dn->dn_newuid; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11620
diff
changeset
|
1168 |
dn->dn_oldgid = dn->dn_newgid; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11620
diff
changeset
|
1169 |
dn->dn_id_flags |= DN_ID_OLD_EXIST; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11620
diff
changeset
|
1170 |
if (dn->dn_bonuslen == 0) |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11620
diff
changeset
|
1171 |
dn->dn_id_flags |= DN_ID_CHKED_SPILL; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11620
diff
changeset
|
1172 |
else |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11620
diff
changeset
|
1173 |
dn->dn_id_flags |= DN_ID_CHKED_BONUS; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11620
diff
changeset
|
1174 |
} |
12432
222dd376dd6c
6952522 elpaso panics: assertion failed: refcount_is_zero(&dn->dn_holds), file: ../../common/fs/zfs/dnode.c
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
12296
diff
changeset
|
1175 |
dn->dn_id_flags &= ~(DN_ID_NEW_EXIST); |
9396
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1176 |
mutex_exit(&dn->dn_mtx); |
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1177 |
|
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1178 |
list_remove(list, dn); |
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1179 |
dnode_rele(dn, list); |
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1180 |
} |
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1181 |
} |
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1182 |
|
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:
11935
diff
changeset
|
1183 |
/* |
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:
11935
diff
changeset
|
1184 |
* Returns a pointer to data to find uid/gid from |
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:
11935
diff
changeset
|
1185 |
* |
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:
11935
diff
changeset
|
1186 |
* If a dirty record for transaction group that is syncing can't |
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:
11935
diff
changeset
|
1187 |
* be found then NULL is returned. In the NULL case it is assumed |
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:
11935
diff
changeset
|
1188 |
* the uid/gid aren't changing. |
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:
11935
diff
changeset
|
1189 |
*/ |
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:
11935
diff
changeset
|
1190 |
static void * |
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:
11935
diff
changeset
|
1191 |
dmu_objset_userquota_find_data(dmu_buf_impl_t *db, dmu_tx_t *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:
11935
diff
changeset
|
1192 |
{ |
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:
11935
diff
changeset
|
1193 |
dbuf_dirty_record_t *dr, **drp; |
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:
11935
diff
changeset
|
1194 |
void *data; |
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:
11935
diff
changeset
|
1195 |
|
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:
11935
diff
changeset
|
1196 |
if (db->db_dirtycnt == 0) |
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:
11935
diff
changeset
|
1197 |
return (db->db.db_data); /* Nothing is changing */ |
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:
11935
diff
changeset
|
1198 |
|
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:
11935
diff
changeset
|
1199 |
for (drp = &db->db_last_dirty; (dr = *drp) != NULL; drp = &dr->dr_next) |
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:
11935
diff
changeset
|
1200 |
if (dr->dr_txg == tx->tx_txg) |
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:
11935
diff
changeset
|
1201 |
break; |
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:
11935
diff
changeset
|
1202 |
|
12684
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
1203 |
if (dr == NULL) { |
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:
11935
diff
changeset
|
1204 |
data = NULL; |
12684
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
1205 |
} else { |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
1206 |
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
|
1207 |
|
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
1208 |
DB_DNODE_ENTER(dr->dr_dbuf); |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
1209 |
dn = DB_DNODE(dr->dr_dbuf); |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
1210 |
|
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
1211 |
if (dn->dn_bonuslen == 0 && |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
1212 |
dr->dr_dbuf->db_blkid == DMU_SPILL_BLKID) |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
1213 |
data = dr->dt.dl.dr_data->b_data; |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
1214 |
else |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
1215 |
data = dr->dt.dl.dr_data; |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
1216 |
|
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
1217 |
DB_DNODE_EXIT(dr->dr_dbuf); |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
1218 |
} |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12493
diff
changeset
|
1219 |
|
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:
11935
diff
changeset
|
1220 |
return (data); |
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:
11935
diff
changeset
|
1221 |
} |
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:
11935
diff
changeset
|
1222 |
|
11935
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11620
diff
changeset
|
1223 |
void |
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:
11935
diff
changeset
|
1224 |
dmu_objset_userquota_get_ids(dnode_t *dn, boolean_t before, dmu_tx_t *tx) |
11935
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11620
diff
changeset
|
1225 |
{ |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11620
diff
changeset
|
1226 |
objset_t *os = dn->dn_objset; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11620
diff
changeset
|
1227 |
void *data = NULL; |
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:
11935
diff
changeset
|
1228 |
dmu_buf_impl_t *db = NULL; |
13952
7a22d0770fc8
3522 zfs module should not allow uninitialized variables
George Wilson <george.wilson@delphix.com>
parents:
13941
diff
changeset
|
1229 |
uint64_t *user = NULL; |
7a22d0770fc8
3522 zfs module should not allow uninitialized variables
George Wilson <george.wilson@delphix.com>
parents:
13941
diff
changeset
|
1230 |
uint64_t *group = NULL; |
11935
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11620
diff
changeset
|
1231 |
int flags = dn->dn_id_flags; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11620
diff
changeset
|
1232 |
int error; |
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:
11935
diff
changeset
|
1233 |
boolean_t have_spill = B_FALSE; |
11935
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11620
diff
changeset
|
1234 |
|
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11620
diff
changeset
|
1235 |
if (!dmu_objset_userused_enabled(dn->dn_objset)) |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11620
diff
changeset
|
1236 |
return; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11620
diff
changeset
|
1237 |
|
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11620
diff
changeset
|
1238 |
if (before && (flags & (DN_ID_CHKED_BONUS|DN_ID_OLD_EXIST| |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11620
diff
changeset
|
1239 |
DN_ID_CHKED_SPILL))) |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11620
diff
changeset
|
1240 |
return; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11620
diff
changeset
|
1241 |
|
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11620
diff
changeset
|
1242 |
if (before && dn->dn_bonuslen != 0) |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11620
diff
changeset
|
1243 |
data = DN_BONUS(dn->dn_phys); |
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:
11935
diff
changeset
|
1244 |
else if (!before && dn->dn_bonuslen != 0) { |
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:
11935
diff
changeset
|
1245 |
if (dn->dn_bonus) { |
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:
11935
diff
changeset
|
1246 |
db = dn->dn_bonus; |
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:
11935
diff
changeset
|
1247 |
mutex_enter(&db->db_mtx); |
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:
11935
diff
changeset
|
1248 |
data = dmu_objset_userquota_find_data(db, 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:
11935
diff
changeset
|
1249 |
} else { |
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:
11935
diff
changeset
|
1250 |
data = DN_BONUS(dn->dn_phys); |
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:
11935
diff
changeset
|
1251 |
} |
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:
11935
diff
changeset
|
1252 |
} else if (dn->dn_bonuslen == 0 && dn->dn_bonustype == DMU_OT_SA) { |
11935
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11620
diff
changeset
|
1253 |
int rf = 0; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11620
diff
changeset
|
1254 |
|
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11620
diff
changeset
|
1255 |
if (RW_WRITE_HELD(&dn->dn_struct_rwlock)) |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11620
diff
changeset
|
1256 |
rf |= DB_RF_HAVESTRUCT; |
12493
89ce40422cea
6952177 SA handling of on-disk corruption can be improved
Mark Shellenbaum <Mark.Shellenbaum@Oracle.COM>
parents:
12432
diff
changeset
|
1257 |
error = dmu_spill_hold_by_dnode(dn, |
89ce40422cea
6952177 SA handling of on-disk corruption can be improved
Mark Shellenbaum <Mark.Shellenbaum@Oracle.COM>
parents:
12432
diff
changeset
|
1258 |
rf | DB_RF_MUST_SUCCEED, |
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:
11935
diff
changeset
|
1259 |
FTAG, (dmu_buf_t **)&db); |
11935
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11620
diff
changeset
|
1260 |
ASSERT(error == 0); |
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:
11935
diff
changeset
|
1261 |
mutex_enter(&db->db_mtx); |
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:
11935
diff
changeset
|
1262 |
data = (before) ? db->db.db_data : |
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:
11935
diff
changeset
|
1263 |
dmu_objset_userquota_find_data(db, 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:
11935
diff
changeset
|
1264 |
have_spill = B_TRUE; |
11935
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11620
diff
changeset
|
1265 |
} else { |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11620
diff
changeset
|
1266 |
mutex_enter(&dn->dn_mtx); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11620
diff
changeset
|
1267 |
dn->dn_id_flags |= DN_ID_CHKED_BONUS; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11620
diff
changeset
|
1268 |
mutex_exit(&dn->dn_mtx); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11620
diff
changeset
|
1269 |
return; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11620
diff
changeset
|
1270 |
} |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11620
diff
changeset
|
1271 |
|
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11620
diff
changeset
|
1272 |
if (before) { |
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:
11935
diff
changeset
|
1273 |
ASSERT(data); |
11935
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11620
diff
changeset
|
1274 |
user = &dn->dn_olduid; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11620
diff
changeset
|
1275 |
group = &dn->dn_oldgid; |
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:
11935
diff
changeset
|
1276 |
} else if (data) { |
11935
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11620
diff
changeset
|
1277 |
user = &dn->dn_newuid; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11620
diff
changeset
|
1278 |
group = &dn->dn_newgid; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11620
diff
changeset
|
1279 |
} |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11620
diff
changeset
|
1280 |
|
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:
11935
diff
changeset
|
1281 |
/* |
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:
11935
diff
changeset
|
1282 |
* Must always call the callback in case the object |
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:
11935
diff
changeset
|
1283 |
* type has changed and that type isn't an object type to track |
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:
11935
diff
changeset
|
1284 |
*/ |
11935
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11620
diff
changeset
|
1285 |
error = used_cbs[os->os_phys->os_type](dn->dn_bonustype, data, |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11620
diff
changeset
|
1286 |
user, group); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11620
diff
changeset
|
1287 |
|
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:
11935
diff
changeset
|
1288 |
/* |
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:
11935
diff
changeset
|
1289 |
* Preserve existing uid/gid when the callback can't determine |
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:
11935
diff
changeset
|
1290 |
* what the new uid/gid are and the callback returned EEXIST. |
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:
11935
diff
changeset
|
1291 |
* The EEXIST error tells us to just use the existing uid/gid. |
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:
11935
diff
changeset
|
1292 |
* If we don't know what the old values are then just assign |
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:
11935
diff
changeset
|
1293 |
* them to 0, since that is a new file being created. |
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:
11935
diff
changeset
|
1294 |
*/ |
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:
11935
diff
changeset
|
1295 |
if (!before && data == NULL && error == EEXIST) { |
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:
11935
diff
changeset
|
1296 |
if (flags & DN_ID_OLD_EXIST) { |
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:
11935
diff
changeset
|
1297 |
dn->dn_newuid = dn->dn_olduid; |
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:
11935
diff
changeset
|
1298 |
dn->dn_newgid = dn->dn_oldgid; |
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:
11935
diff
changeset
|
1299 |
} else { |
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:
11935
diff
changeset
|
1300 |
dn->dn_newuid = 0; |
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:
11935
diff
changeset
|
1301 |
dn->dn_newgid = 0; |
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:
11935
diff
changeset
|
1302 |
} |
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:
11935
diff
changeset
|
1303 |
error = 0; |
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:
11935
diff
changeset
|
1304 |
} |
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:
11935
diff
changeset
|
1305 |
|
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:
11935
diff
changeset
|
1306 |
if (db) |
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:
11935
diff
changeset
|
1307 |
mutex_exit(&db->db_mtx); |
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:
11935
diff
changeset
|
1308 |
|
11935
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11620
diff
changeset
|
1309 |
mutex_enter(&dn->dn_mtx); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11620
diff
changeset
|
1310 |
if (error == 0 && before) |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11620
diff
changeset
|
1311 |
dn->dn_id_flags |= DN_ID_OLD_EXIST; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11620
diff
changeset
|
1312 |
if (error == 0 && !before) |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11620
diff
changeset
|
1313 |
dn->dn_id_flags |= DN_ID_NEW_EXIST; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11620
diff
changeset
|
1314 |
|
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:
11935
diff
changeset
|
1315 |
if (have_spill) { |
11935
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11620
diff
changeset
|
1316 |
dn->dn_id_flags |= DN_ID_CHKED_SPILL; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11620
diff
changeset
|
1317 |
} else { |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11620
diff
changeset
|
1318 |
dn->dn_id_flags |= DN_ID_CHKED_BONUS; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11620
diff
changeset
|
1319 |
} |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11620
diff
changeset
|
1320 |
mutex_exit(&dn->dn_mtx); |
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:
11935
diff
changeset
|
1321 |
if (have_spill) |
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:
11935
diff
changeset
|
1322 |
dmu_buf_rele((dmu_buf_t *)db, FTAG); |
11935
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11620
diff
changeset
|
1323 |
} |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11620
diff
changeset
|
1324 |
|
9396
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1325 |
boolean_t |
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1326 |
dmu_objset_userspace_present(objset_t *os) |
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1327 |
{ |
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
1328 |
return (os->os_phys->os_flags & |
9396
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1329 |
OBJSET_FLAG_USERACCOUNTING_COMPLETE); |
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1330 |
} |
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1331 |
|
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1332 |
int |
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1333 |
dmu_objset_userspace_upgrade(objset_t *os) |
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1334 |
{ |
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1335 |
uint64_t obj; |
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1336 |
int err = 0; |
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1337 |
|
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1338 |
if (dmu_objset_userspace_present(os)) |
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1339 |
return (0); |
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
1340 |
if (!dmu_objset_userused_enabled(os)) |
13980
d7059eb1884c
3598 want to dtrace when errors are generated in zfs
Matthew Ahrens <mahrens@delphix.com>
parents:
13973
diff
changeset
|
1341 |
return (SET_ERROR(ENOTSUP)); |
9396
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1342 |
if (dmu_objset_is_snapshot(os)) |
13980
d7059eb1884c
3598 want to dtrace when errors are generated in zfs
Matthew Ahrens <mahrens@delphix.com>
parents:
13973
diff
changeset
|
1343 |
return (SET_ERROR(EINVAL)); |
9396
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1344 |
|
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1345 |
/* |
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1346 |
* We simply need to mark every object dirty, so that it will be |
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1347 |
* synced out and now accounted. If this is called |
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1348 |
* concurrently, or if we already did some work before crashing, |
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1349 |
* that's fine, since we track each object's accounted state |
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1350 |
* independently. |
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1351 |
*/ |
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1352 |
|
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1353 |
for (obj = 0; err == 0; err = dmu_object_next(os, &obj, FALSE, 0)) { |
9951
a4895b3dd543
6842815 SUNWzfsu package dependency on SUNWPython is not captured
Lin Ling <Lin.Ling@Sun.COM>
parents:
9554
diff
changeset
|
1354 |
dmu_tx_t *tx; |
9396
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1355 |
dmu_buf_t *db; |
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1356 |
int objerr; |
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1357 |
|
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1358 |
if (issig(JUSTLOOKING) && issig(FORREAL)) |
13980
d7059eb1884c
3598 want to dtrace when errors are generated in zfs
Matthew Ahrens <mahrens@delphix.com>
parents:
13973
diff
changeset
|
1359 |
return (SET_ERROR(EINTR)); |
9396
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1360 |
|
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1361 |
objerr = dmu_bonus_hold(os, obj, FTAG, &db); |
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1362 |
if (objerr != 0) |
9396
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1363 |
continue; |
9951
a4895b3dd543
6842815 SUNWzfsu package dependency on SUNWPython is not captured
Lin Ling <Lin.Ling@Sun.COM>
parents:
9554
diff
changeset
|
1364 |
tx = dmu_tx_create(os); |
9396
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1365 |
dmu_tx_hold_bonus(tx, obj); |
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1366 |
objerr = dmu_tx_assign(tx, TXG_WAIT); |
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1367 |
if (objerr != 0) { |
9396
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1368 |
dmu_tx_abort(tx); |
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1369 |
continue; |
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1370 |
} |
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1371 |
dmu_buf_will_dirty(db, tx); |
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1372 |
dmu_buf_rele(db, FTAG); |
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1373 |
dmu_tx_commit(tx); |
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1374 |
} |
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1375 |
|
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
1376 |
os->os_flags |= OBJSET_FLAG_USERACCOUNTING_COMPLETE; |
9396
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1377 |
txg_wait_synced(dmu_objset_pool(os), 0); |
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1378 |
return (0); |
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1379 |
} |
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1380 |
|
789 | 1381 |
void |
2885 | 1382 |
dmu_objset_space(objset_t *os, uint64_t *refdbytesp, uint64_t *availbytesp, |
1383 |
uint64_t *usedobjsp, uint64_t *availobjsp) |
|
1384 |
{ |
|
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
1385 |
dsl_dataset_space(os->os_dsl_dataset, refdbytesp, availbytesp, |
2885 | 1386 |
usedobjsp, availobjsp); |
1387 |
} |
|
1388 |
||
1389 |
uint64_t |
|
1390 |
dmu_objset_fsid_guid(objset_t *os) |
|
1391 |
{ |
|
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
1392 |
return (dsl_dataset_fsid_guid(os->os_dsl_dataset)); |
2885 | 1393 |
} |
1394 |
||
1395 |
void |
|
1396 |
dmu_objset_fast_stat(objset_t *os, dmu_objset_stats_t *stat) |
|
789 | 1397 |
{ |
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
1398 |
stat->dds_type = os->os_phys->os_type; |
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
1399 |
if (os->os_dsl_dataset) |
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
1400 |
dsl_dataset_fast_stat(os->os_dsl_dataset, stat); |
2885 | 1401 |
} |
1402 |
||
1403 |
void |
|
1404 |
dmu_objset_stats(objset_t *os, nvlist_t *nv) |
|
1405 |
{ |
|
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
1406 |
ASSERT(os->os_dsl_dataset || |
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
1407 |
os->os_phys->os_type == DMU_OST_META); |
2885 | 1408 |
|
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
1409 |
if (os->os_dsl_dataset != NULL) |
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
1410 |
dsl_dataset_stats(os->os_dsl_dataset, nv); |
2885 | 1411 |
|
1412 |
dsl_prop_nvlist_add_uint64(nv, ZFS_PROP_TYPE, |
|
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
1413 |
os->os_phys->os_type); |
9396
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1414 |
dsl_prop_nvlist_add_uint64(nv, ZFS_PROP_USERACCOUNTING, |
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9355
diff
changeset
|
1415 |
dmu_objset_userspace_present(os)); |
789 | 1416 |
} |
1417 |
||
1418 |
int |
|
1419 |
dmu_objset_is_snapshot(objset_t *os) |
|
1420 |
{ |
|
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
1421 |
if (os->os_dsl_dataset != NULL) |
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
1422 |
return (dsl_dataset_is_snapshot(os->os_dsl_dataset)); |
789 | 1423 |
else |
1424 |
return (B_FALSE); |
|
1425 |
} |
|
1426 |
||
1427 |
int |
|
6492
903545192033
6654808 FIGNORECASE lookups in a zfs xattr dir don't provide 'realname' data
timh
parents:
6174
diff
changeset
|
1428 |
dmu_snapshot_realname(objset_t *os, char *name, char *real, int maxlen, |
903545192033
6654808 FIGNORECASE lookups in a zfs xattr dir don't provide 'realname' data
timh
parents:
6174
diff
changeset
|
1429 |
boolean_t *conflict) |
903545192033
6654808 FIGNORECASE lookups in a zfs xattr dir don't provide 'realname' data
timh
parents:
6174
diff
changeset
|
1430 |
{ |
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
1431 |
dsl_dataset_t *ds = os->os_dsl_dataset; |
6492
903545192033
6654808 FIGNORECASE lookups in a zfs xattr dir don't provide 'realname' data
timh
parents:
6174
diff
changeset
|
1432 |
uint64_t ignored; |
903545192033
6654808 FIGNORECASE lookups in a zfs xattr dir don't provide 'realname' data
timh
parents:
6174
diff
changeset
|
1433 |
|
903545192033
6654808 FIGNORECASE lookups in a zfs xattr dir don't provide 'realname' data
timh
parents:
6174
diff
changeset
|
1434 |
if (ds->ds_phys->ds_snapnames_zapobj == 0) |
13980
d7059eb1884c
3598 want to dtrace when errors are generated in zfs
Matthew Ahrens <mahrens@delphix.com>
parents:
13973
diff
changeset
|
1435 |
return (SET_ERROR(ENOENT)); |
6492
903545192033
6654808 FIGNORECASE lookups in a zfs xattr dir don't provide 'realname' data
timh
parents:
6174
diff
changeset
|
1436 |
|
903545192033
6654808 FIGNORECASE lookups in a zfs xattr dir don't provide 'realname' data
timh
parents:
6174
diff
changeset
|
1437 |
return (zap_lookup_norm(ds->ds_dir->dd_pool->dp_meta_objset, |
903545192033
6654808 FIGNORECASE lookups in a zfs xattr dir don't provide 'realname' data
timh
parents:
6174
diff
changeset
|
1438 |
ds->ds_phys->ds_snapnames_zapobj, name, 8, 1, &ignored, MT_FIRST, |
903545192033
6654808 FIGNORECASE lookups in a zfs xattr dir don't provide 'realname' data
timh
parents:
6174
diff
changeset
|
1439 |
real, maxlen, conflict)); |
903545192033
6654808 FIGNORECASE lookups in a zfs xattr dir don't provide 'realname' data
timh
parents:
6174
diff
changeset
|
1440 |
} |
903545192033
6654808 FIGNORECASE lookups in a zfs xattr dir don't provide 'realname' data
timh
parents:
6174
diff
changeset
|
1441 |
|
903545192033
6654808 FIGNORECASE lookups in a zfs xattr dir don't provide 'realname' data
timh
parents:
6174
diff
changeset
|
1442 |
int |
789 | 1443 |
dmu_snapshot_list_next(objset_t *os, int namelen, char *name, |
5663
029cc4273b57
6627223 gfs needs to support extended dirent flags
ck153898
parents:
5446
diff
changeset
|
1444 |
uint64_t *idp, uint64_t *offp, boolean_t *case_conflict) |
789 | 1445 |
{ |
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
1446 |
dsl_dataset_t *ds = os->os_dsl_dataset; |
789 | 1447 |
zap_cursor_t cursor; |
1448 |
zap_attribute_t attr; |
|
1449 |
||
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1450 |
ASSERT(dsl_pool_config_held(dmu_objset_pool(os))); |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1451 |
|
789 | 1452 |
if (ds->ds_phys->ds_snapnames_zapobj == 0) |
13980
d7059eb1884c
3598 want to dtrace when errors are generated in zfs
Matthew Ahrens <mahrens@delphix.com>
parents:
13973
diff
changeset
|
1453 |
return (SET_ERROR(ENOENT)); |
789 | 1454 |
|
1455 |
zap_cursor_init_serialized(&cursor, |
|
1456 |
ds->ds_dir->dd_pool->dp_meta_objset, |
|
1457 |
ds->ds_phys->ds_snapnames_zapobj, *offp); |
|
1458 |
||
885
d925b21dba78
6347493 tar of 25K empty directory entries in ZFS takes 30+ seconds ...
ahrens
parents:
789
diff
changeset
|
1459 |
if (zap_cursor_retrieve(&cursor, &attr) != 0) { |
d925b21dba78
6347493 tar of 25K empty directory entries in ZFS takes 30+ seconds ...
ahrens
parents:
789
diff
changeset
|
1460 |
zap_cursor_fini(&cursor); |
13980
d7059eb1884c
3598 want to dtrace when errors are generated in zfs
Matthew Ahrens <mahrens@delphix.com>
parents:
13973
diff
changeset
|
1461 |
return (SET_ERROR(ENOENT)); |
885
d925b21dba78
6347493 tar of 25K empty directory entries in ZFS takes 30+ seconds ...
ahrens
parents:
789
diff
changeset
|
1462 |
} |
d925b21dba78
6347493 tar of 25K empty directory entries in ZFS takes 30+ seconds ...
ahrens
parents:
789
diff
changeset
|
1463 |
|
d925b21dba78
6347493 tar of 25K empty directory entries in ZFS takes 30+ seconds ...
ahrens
parents:
789
diff
changeset
|
1464 |
if (strlen(attr.za_name) + 1 > namelen) { |
d925b21dba78
6347493 tar of 25K empty directory entries in ZFS takes 30+ seconds ...
ahrens
parents:
789
diff
changeset
|
1465 |
zap_cursor_fini(&cursor); |
13980
d7059eb1884c
3598 want to dtrace when errors are generated in zfs
Matthew Ahrens <mahrens@delphix.com>
parents:
13973
diff
changeset
|
1466 |
return (SET_ERROR(ENAMETOOLONG)); |
885
d925b21dba78
6347493 tar of 25K empty directory entries in ZFS takes 30+ seconds ...
ahrens
parents:
789
diff
changeset
|
1467 |
} |
d925b21dba78
6347493 tar of 25K empty directory entries in ZFS takes 30+ seconds ...
ahrens
parents:
789
diff
changeset
|
1468 |
|
d925b21dba78
6347493 tar of 25K empty directory entries in ZFS takes 30+ seconds ...
ahrens
parents:
789
diff
changeset
|
1469 |
(void) strcpy(name, attr.za_name); |
d925b21dba78
6347493 tar of 25K empty directory entries in ZFS takes 30+ seconds ...
ahrens
parents:
789
diff
changeset
|
1470 |
if (idp) |
d925b21dba78
6347493 tar of 25K empty directory entries in ZFS takes 30+ seconds ...
ahrens
parents:
789
diff
changeset
|
1471 |
*idp = attr.za_first_integer; |
5663
029cc4273b57
6627223 gfs needs to support extended dirent flags
ck153898
parents:
5446
diff
changeset
|
1472 |
if (case_conflict) |
029cc4273b57
6627223 gfs needs to support extended dirent flags
ck153898
parents:
5446
diff
changeset
|
1473 |
*case_conflict = attr.za_normalization_conflict; |
885
d925b21dba78
6347493 tar of 25K empty directory entries in ZFS takes 30+ seconds ...
ahrens
parents:
789
diff
changeset
|
1474 |
zap_cursor_advance(&cursor); |
d925b21dba78
6347493 tar of 25K empty directory entries in ZFS takes 30+ seconds ...
ahrens
parents:
789
diff
changeset
|
1475 |
*offp = zap_cursor_serialize(&cursor); |
d925b21dba78
6347493 tar of 25K empty directory entries in ZFS takes 30+ seconds ...
ahrens
parents:
789
diff
changeset
|
1476 |
zap_cursor_fini(&cursor); |
d925b21dba78
6347493 tar of 25K empty directory entries in ZFS takes 30+ seconds ...
ahrens
parents:
789
diff
changeset
|
1477 |
|
d925b21dba78
6347493 tar of 25K empty directory entries in ZFS takes 30+ seconds ...
ahrens
parents:
789
diff
changeset
|
1478 |
return (0); |
d925b21dba78
6347493 tar of 25K empty directory entries in ZFS takes 30+ seconds ...
ahrens
parents:
789
diff
changeset
|
1479 |
} |
d925b21dba78
6347493 tar of 25K empty directory entries in ZFS takes 30+ seconds ...
ahrens
parents:
789
diff
changeset
|
1480 |
|
d925b21dba78
6347493 tar of 25K empty directory entries in ZFS takes 30+ seconds ...
ahrens
parents:
789
diff
changeset
|
1481 |
int |
d925b21dba78
6347493 tar of 25K empty directory entries in ZFS takes 30+ seconds ...
ahrens
parents:
789
diff
changeset
|
1482 |
dmu_dir_list_next(objset_t *os, int namelen, char *name, |
d925b21dba78
6347493 tar of 25K empty directory entries in ZFS takes 30+ seconds ...
ahrens
parents:
789
diff
changeset
|
1483 |
uint64_t *idp, uint64_t *offp) |
d925b21dba78
6347493 tar of 25K empty directory entries in ZFS takes 30+ seconds ...
ahrens
parents:
789
diff
changeset
|
1484 |
{ |
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
1485 |
dsl_dir_t *dd = os->os_dsl_dataset->ds_dir; |
885
d925b21dba78
6347493 tar of 25K empty directory entries in ZFS takes 30+ seconds ...
ahrens
parents:
789
diff
changeset
|
1486 |
zap_cursor_t cursor; |
d925b21dba78
6347493 tar of 25K empty directory entries in ZFS takes 30+ seconds ...
ahrens
parents:
789
diff
changeset
|
1487 |
zap_attribute_t attr; |
d925b21dba78
6347493 tar of 25K empty directory entries in ZFS takes 30+ seconds ...
ahrens
parents:
789
diff
changeset
|
1488 |
|
d925b21dba78
6347493 tar of 25K empty directory entries in ZFS takes 30+ seconds ...
ahrens
parents:
789
diff
changeset
|
1489 |
/* there is no next dir on a snapshot! */ |
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
1490 |
if (os->os_dsl_dataset->ds_object != |
885
d925b21dba78
6347493 tar of 25K empty directory entries in ZFS takes 30+ seconds ...
ahrens
parents:
789
diff
changeset
|
1491 |
dd->dd_phys->dd_head_dataset_obj) |
13980
d7059eb1884c
3598 want to dtrace when errors are generated in zfs
Matthew Ahrens <mahrens@delphix.com>
parents:
13973
diff
changeset
|
1492 |
return (SET_ERROR(ENOENT)); |
885
d925b21dba78
6347493 tar of 25K empty directory entries in ZFS takes 30+ seconds ...
ahrens
parents:
789
diff
changeset
|
1493 |
|
d925b21dba78
6347493 tar of 25K empty directory entries in ZFS takes 30+ seconds ...
ahrens
parents:
789
diff
changeset
|
1494 |
zap_cursor_init_serialized(&cursor, |
d925b21dba78
6347493 tar of 25K empty directory entries in ZFS takes 30+ seconds ...
ahrens
parents:
789
diff
changeset
|
1495 |
dd->dd_pool->dp_meta_objset, |
d925b21dba78
6347493 tar of 25K empty directory entries in ZFS takes 30+ seconds ...
ahrens
parents:
789
diff
changeset
|
1496 |
dd->dd_phys->dd_child_dir_zapobj, *offp); |
d925b21dba78
6347493 tar of 25K empty directory entries in ZFS takes 30+ seconds ...
ahrens
parents:
789
diff
changeset
|
1497 |
|
d925b21dba78
6347493 tar of 25K empty directory entries in ZFS takes 30+ seconds ...
ahrens
parents:
789
diff
changeset
|
1498 |
if (zap_cursor_retrieve(&cursor, &attr) != 0) { |
d925b21dba78
6347493 tar of 25K empty directory entries in ZFS takes 30+ seconds ...
ahrens
parents:
789
diff
changeset
|
1499 |
zap_cursor_fini(&cursor); |
13980
d7059eb1884c
3598 want to dtrace when errors are generated in zfs
Matthew Ahrens <mahrens@delphix.com>
parents:
13973
diff
changeset
|
1500 |
return (SET_ERROR(ENOENT)); |
885
d925b21dba78
6347493 tar of 25K empty directory entries in ZFS takes 30+ seconds ...
ahrens
parents:
789
diff
changeset
|
1501 |
} |
d925b21dba78
6347493 tar of 25K empty directory entries in ZFS takes 30+ seconds ...
ahrens
parents:
789
diff
changeset
|
1502 |
|
d925b21dba78
6347493 tar of 25K empty directory entries in ZFS takes 30+ seconds ...
ahrens
parents:
789
diff
changeset
|
1503 |
if (strlen(attr.za_name) + 1 > namelen) { |
d925b21dba78
6347493 tar of 25K empty directory entries in ZFS takes 30+ seconds ...
ahrens
parents:
789
diff
changeset
|
1504 |
zap_cursor_fini(&cursor); |
13980
d7059eb1884c
3598 want to dtrace when errors are generated in zfs
Matthew Ahrens <mahrens@delphix.com>
parents:
13973
diff
changeset
|
1505 |
return (SET_ERROR(ENAMETOOLONG)); |
885
d925b21dba78
6347493 tar of 25K empty directory entries in ZFS takes 30+ seconds ...
ahrens
parents:
789
diff
changeset
|
1506 |
} |
789 | 1507 |
|
1508 |
(void) strcpy(name, attr.za_name); |
|
885
d925b21dba78
6347493 tar of 25K empty directory entries in ZFS takes 30+ seconds ...
ahrens
parents:
789
diff
changeset
|
1509 |
if (idp) |
d925b21dba78
6347493 tar of 25K empty directory entries in ZFS takes 30+ seconds ...
ahrens
parents:
789
diff
changeset
|
1510 |
*idp = attr.za_first_integer; |
789 | 1511 |
zap_cursor_advance(&cursor); |
1512 |
*offp = zap_cursor_serialize(&cursor); |
|
885
d925b21dba78
6347493 tar of 25K empty directory entries in ZFS takes 30+ seconds ...
ahrens
parents:
789
diff
changeset
|
1513 |
zap_cursor_fini(&cursor); |
789 | 1514 |
|
1515 |
return (0); |
|
1516 |
} |
|
1517 |
||
1518 |
/* |
|
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1519 |
* Find objsets under and including ddobj, call func(ds) on each. |
789 | 1520 |
*/ |
2199 | 1521 |
int |
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1522 |
dmu_objset_find_dp(dsl_pool_t *dp, uint64_t ddobj, |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1523 |
int func(dsl_pool_t *, dsl_dataset_t *, void *), void *arg, int flags) |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
6992
diff
changeset
|
1524 |
{ |
789 | 1525 |
dsl_dir_t *dd; |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
6992
diff
changeset
|
1526 |
dsl_dataset_t *ds; |
789 | 1527 |
zap_cursor_t zc; |
3978
2dd668007b7a
6533813 recursive snapshotting resulted in a bad stack overflow
mmusante
parents:
3897
diff
changeset
|
1528 |
zap_attribute_t *attr; |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
6992
diff
changeset
|
1529 |
uint64_t thisobj; |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
6992
diff
changeset
|
1530 |
int err; |
789 | 1531 |
|
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1532 |
ASSERT(dsl_pool_config_held(dp)); |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1533 |
|
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1534 |
err = dsl_dir_hold_obj(dp, ddobj, NULL, FTAG, &dd); |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1535 |
if (err != 0) |
2199 | 1536 |
return (err); |
789 | 1537 |
|
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
6992
diff
changeset
|
1538 |
/* Don't visit hidden ($MOS & $ORIGIN) objsets. */ |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
6992
diff
changeset
|
1539 |
if (dd->dd_myname[0] == '$') { |
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1540 |
dsl_dir_rele(dd, FTAG); |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
6992
diff
changeset
|
1541 |
return (0); |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
6992
diff
changeset
|
1542 |
} |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
6992
diff
changeset
|
1543 |
|
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
6992
diff
changeset
|
1544 |
thisobj = dd->dd_phys->dd_head_dataset_obj; |
3978
2dd668007b7a
6533813 recursive snapshotting resulted in a bad stack overflow
mmusante
parents:
3897
diff
changeset
|
1545 |
attr = kmem_alloc(sizeof (zap_attribute_t), KM_SLEEP); |
789 | 1546 |
|
1547 |
/* |
|
1548 |
* Iterate over all children. |
|
1549 |
*/ |
|
2417 | 1550 |
if (flags & DS_FIND_CHILDREN) { |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
6992
diff
changeset
|
1551 |
for (zap_cursor_init(&zc, dp->dp_meta_objset, |
2417 | 1552 |
dd->dd_phys->dd_child_dir_zapobj); |
3978
2dd668007b7a
6533813 recursive snapshotting resulted in a bad stack overflow
mmusante
parents:
3897
diff
changeset
|
1553 |
zap_cursor_retrieve(&zc, attr) == 0; |
2417 | 1554 |
(void) zap_cursor_advance(&zc)) { |
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1555 |
ASSERT3U(attr->za_integer_length, ==, |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1556 |
sizeof (uint64_t)); |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1557 |
ASSERT3U(attr->za_num_integers, ==, 1); |
789 | 1558 |
|
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1559 |
err = dmu_objset_find_dp(dp, attr->za_first_integer, |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1560 |
func, arg, flags); |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1561 |
if (err != 0) |
2417 | 1562 |
break; |
1563 |
} |
|
1564 |
zap_cursor_fini(&zc); |
|
2199 | 1565 |
|
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1566 |
if (err != 0) { |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1567 |
dsl_dir_rele(dd, FTAG); |
3978
2dd668007b7a
6533813 recursive snapshotting resulted in a bad stack overflow
mmusante
parents:
3897
diff
changeset
|
1568 |
kmem_free(attr, sizeof (zap_attribute_t)); |
2417 | 1569 |
return (err); |
1570 |
} |
|
789 | 1571 |
} |
1572 |
||
1573 |
/* |
|
1574 |
* Iterate over all snapshots. |
|
1575 |
*/ |
|
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
6992
diff
changeset
|
1576 |
if (flags & DS_FIND_SNAPSHOTS) { |
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1577 |
dsl_dataset_t *ds; |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
6992
diff
changeset
|
1578 |
err = dsl_dataset_hold_obj(dp, thisobj, FTAG, &ds); |
789 | 1579 |
|
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
6992
diff
changeset
|
1580 |
if (err == 0) { |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
6992
diff
changeset
|
1581 |
uint64_t snapobj = ds->ds_phys->ds_snapnames_zapobj; |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
6992
diff
changeset
|
1582 |
dsl_dataset_rele(ds, FTAG); |
789 | 1583 |
|
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
6992
diff
changeset
|
1584 |
for (zap_cursor_init(&zc, dp->dp_meta_objset, snapobj); |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
6992
diff
changeset
|
1585 |
zap_cursor_retrieve(&zc, attr) == 0; |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
6992
diff
changeset
|
1586 |
(void) zap_cursor_advance(&zc)) { |
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1587 |
ASSERT3U(attr->za_integer_length, ==, |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
6992
diff
changeset
|
1588 |
sizeof (uint64_t)); |
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1589 |
ASSERT3U(attr->za_num_integers, ==, 1); |
789 | 1590 |
|
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1591 |
err = dsl_dataset_hold_obj(dp, |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1592 |
attr->za_first_integer, FTAG, &ds); |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1593 |
if (err != 0) |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1594 |
break; |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1595 |
err = func(dp, ds, arg); |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1596 |
dsl_dataset_rele(ds, FTAG); |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1597 |
if (err != 0) |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
6992
diff
changeset
|
1598 |
break; |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
6992
diff
changeset
|
1599 |
} |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
6992
diff
changeset
|
1600 |
zap_cursor_fini(&zc); |
789 | 1601 |
} |
1602 |
} |
|
1603 |
||
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1604 |
dsl_dir_rele(dd, FTAG); |
3978
2dd668007b7a
6533813 recursive snapshotting resulted in a bad stack overflow
mmusante
parents:
3897
diff
changeset
|
1605 |
kmem_free(attr, sizeof (zap_attribute_t)); |
789 | 1606 |
|
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1607 |
if (err != 0) |
2199 | 1608 |
return (err); |
1609 |
||
789 | 1610 |
/* |
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1611 |
* Apply to self. |
789 | 1612 |
*/ |
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1613 |
err = dsl_dataset_hold_obj(dp, thisobj, FTAG, &ds); |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1614 |
if (err != 0) |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1615 |
return (err); |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1616 |
err = func(dp, ds, arg); |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1617 |
dsl_dataset_rele(ds, FTAG); |
2199 | 1618 |
return (err); |
789 | 1619 |
} |
5326
6752aa2bd5bc
6425096 want online 'zfs recv' (read only and read/write)
ek110237
parents:
5147
diff
changeset
|
1620 |
|
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1621 |
/* |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1622 |
* Find all objsets under name, and for each, call 'func(child_name, arg)'. |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1623 |
* The dp_config_rwlock must not be held when this is called, and it |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1624 |
* will not be held when the callback is called. |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1625 |
* Therefore this function should only be used when the pool is not changing |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1626 |
* (e.g. in syncing context), or the callback can deal with the possible races. |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1627 |
*/ |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1628 |
static int |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1629 |
dmu_objset_find_impl(spa_t *spa, const char *name, |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1630 |
int func(const char *, void *), void *arg, int flags) |
8415
d5525cd1cbc2
6386929 initial "zfs list" is slow
Rich Morris <Richard.Morris@Sun.COM>
parents:
8213
diff
changeset
|
1631 |
{ |
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1632 |
dsl_dir_t *dd; |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1633 |
dsl_pool_t *dp = spa_get_dsl(spa); |
8415
d5525cd1cbc2
6386929 initial "zfs list" is slow
Rich Morris <Richard.Morris@Sun.COM>
parents:
8213
diff
changeset
|
1634 |
dsl_dataset_t *ds; |
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1635 |
zap_cursor_t zc; |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1636 |
zap_attribute_t *attr; |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1637 |
char *child; |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1638 |
uint64_t thisobj; |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1639 |
int err; |
8415
d5525cd1cbc2
6386929 initial "zfs list" is slow
Rich Morris <Richard.Morris@Sun.COM>
parents:
8213
diff
changeset
|
1640 |
|
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1641 |
dsl_pool_config_enter(dp, FTAG); |
8415
d5525cd1cbc2
6386929 initial "zfs list" is slow
Rich Morris <Richard.Morris@Sun.COM>
parents:
8213
diff
changeset
|
1642 |
|
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1643 |
err = dsl_dir_hold(dp, name, FTAG, &dd, NULL); |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1644 |
if (err != 0) { |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1645 |
dsl_pool_config_exit(dp, FTAG); |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1646 |
return (err); |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1647 |
} |
8415
d5525cd1cbc2
6386929 initial "zfs list" is slow
Rich Morris <Richard.Morris@Sun.COM>
parents:
8213
diff
changeset
|
1648 |
|
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1649 |
/* Don't visit hidden ($MOS & $ORIGIN) objsets. */ |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1650 |
if (dd->dd_myname[0] == '$') { |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1651 |
dsl_dir_rele(dd, FTAG); |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1652 |
dsl_pool_config_exit(dp, FTAG); |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1653 |
return (0); |
8415
d5525cd1cbc2
6386929 initial "zfs list" is slow
Rich Morris <Richard.Morris@Sun.COM>
parents:
8213
diff
changeset
|
1654 |
} |
d5525cd1cbc2
6386929 initial "zfs list" is slow
Rich Morris <Richard.Morris@Sun.COM>
parents:
8213
diff
changeset
|
1655 |
|
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1656 |
thisobj = dd->dd_phys->dd_head_dataset_obj; |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1657 |
attr = kmem_alloc(sizeof (zap_attribute_t), KM_SLEEP); |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1658 |
|
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1659 |
/* |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1660 |
* Iterate over all children. |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1661 |
*/ |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1662 |
if (flags & DS_FIND_CHILDREN) { |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1663 |
for (zap_cursor_init(&zc, dp->dp_meta_objset, |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1664 |
dd->dd_phys->dd_child_dir_zapobj); |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1665 |
zap_cursor_retrieve(&zc, attr) == 0; |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1666 |
(void) zap_cursor_advance(&zc)) { |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1667 |
ASSERT3U(attr->za_integer_length, ==, |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1668 |
sizeof (uint64_t)); |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1669 |
ASSERT3U(attr->za_num_integers, ==, 1); |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1670 |
|
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1671 |
child = kmem_asprintf("%s/%s", name, attr->za_name); |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1672 |
dsl_pool_config_exit(dp, FTAG); |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1673 |
err = dmu_objset_find_impl(spa, child, |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1674 |
func, arg, flags); |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1675 |
dsl_pool_config_enter(dp, FTAG); |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1676 |
strfree(child); |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1677 |
if (err != 0) |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1678 |
break; |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1679 |
} |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1680 |
zap_cursor_fini(&zc); |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1681 |
|
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1682 |
if (err != 0) { |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1683 |
dsl_dir_rele(dd, FTAG); |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1684 |
dsl_pool_config_exit(dp, FTAG); |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1685 |
kmem_free(attr, sizeof (zap_attribute_t)); |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1686 |
return (err); |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1687 |
} |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1688 |
} |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1689 |
|
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1690 |
/* |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1691 |
* Iterate over all snapshots. |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1692 |
*/ |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1693 |
if (flags & DS_FIND_SNAPSHOTS) { |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1694 |
err = dsl_dataset_hold_obj(dp, thisobj, FTAG, &ds); |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1695 |
|
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1696 |
if (err == 0) { |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1697 |
uint64_t snapobj = ds->ds_phys->ds_snapnames_zapobj; |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1698 |
dsl_dataset_rele(ds, FTAG); |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1699 |
|
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1700 |
for (zap_cursor_init(&zc, dp->dp_meta_objset, snapobj); |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1701 |
zap_cursor_retrieve(&zc, attr) == 0; |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1702 |
(void) zap_cursor_advance(&zc)) { |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1703 |
ASSERT3U(attr->za_integer_length, ==, |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1704 |
sizeof (uint64_t)); |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1705 |
ASSERT3U(attr->za_num_integers, ==, 1); |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1706 |
|
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1707 |
child = kmem_asprintf("%s@%s", |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1708 |
name, attr->za_name); |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1709 |
dsl_pool_config_exit(dp, FTAG); |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1710 |
err = func(child, arg); |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1711 |
dsl_pool_config_enter(dp, FTAG); |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1712 |
strfree(child); |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1713 |
if (err != 0) |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1714 |
break; |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1715 |
} |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1716 |
zap_cursor_fini(&zc); |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1717 |
} |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1718 |
} |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1719 |
|
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1720 |
dsl_dir_rele(dd, FTAG); |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1721 |
kmem_free(attr, sizeof (zap_attribute_t)); |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1722 |
dsl_pool_config_exit(dp, FTAG); |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1723 |
|
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1724 |
if (err != 0) |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1725 |
return (err); |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1726 |
|
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1727 |
/* Apply to self. */ |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1728 |
return (func(name, arg)); |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1729 |
} |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1730 |
|
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1731 |
/* |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1732 |
* See comment above dmu_objset_find_impl(). |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1733 |
*/ |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1734 |
int |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1735 |
dmu_objset_find(char *name, int func(const char *, void *), void *arg, |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1736 |
int flags) |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1737 |
{ |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1738 |
spa_t *spa; |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1739 |
int error; |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1740 |
|
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1741 |
error = spa_open(name, &spa, FTAG); |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1742 |
if (error != 0) |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1743 |
return (error); |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1744 |
error = dmu_objset_find_impl(spa, name, func, arg, flags); |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1745 |
spa_close(spa, FTAG); |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1746 |
return (error); |
8415
d5525cd1cbc2
6386929 initial "zfs list" is slow
Rich Morris <Richard.Morris@Sun.COM>
parents:
8213
diff
changeset
|
1747 |
} |
d5525cd1cbc2
6386929 initial "zfs list" is slow
Rich Morris <Richard.Morris@Sun.COM>
parents:
8213
diff
changeset
|
1748 |
|
5326
6752aa2bd5bc
6425096 want online 'zfs recv' (read only and read/write)
ek110237
parents:
5147
diff
changeset
|
1749 |
void |
6752aa2bd5bc
6425096 want online 'zfs recv' (read only and read/write)
ek110237
parents:
5147
diff
changeset
|
1750 |
dmu_objset_set_user(objset_t *os, void *user_ptr) |
6752aa2bd5bc
6425096 want online 'zfs recv' (read only and read/write)
ek110237
parents:
5147
diff
changeset
|
1751 |
{ |
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
1752 |
ASSERT(MUTEX_HELD(&os->os_user_ptr_lock)); |
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
1753 |
os->os_user_ptr = user_ptr; |
5326
6752aa2bd5bc
6425096 want online 'zfs recv' (read only and read/write)
ek110237
parents:
5147
diff
changeset
|
1754 |
} |
6752aa2bd5bc
6425096 want online 'zfs recv' (read only and read/write)
ek110237
parents:
5147
diff
changeset
|
1755 |
|
6752aa2bd5bc
6425096 want online 'zfs recv' (read only and read/write)
ek110237
parents:
5147
diff
changeset
|
1756 |
void * |
6752aa2bd5bc
6425096 want online 'zfs recv' (read only and read/write)
ek110237
parents:
5147
diff
changeset
|
1757 |
dmu_objset_get_user(objset_t *os) |
6752aa2bd5bc
6425096 want online 'zfs recv' (read only and read/write)
ek110237
parents:
5147
diff
changeset
|
1758 |
{ |
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
1759 |
ASSERT(MUTEX_HELD(&os->os_user_ptr_lock)); |
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
1760 |
return (os->os_user_ptr); |
5326
6752aa2bd5bc
6425096 want online 'zfs recv' (read only and read/write)
ek110237
parents:
5147
diff
changeset
|
1761 |
} |
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1762 |
|
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1763 |
/* |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1764 |
* Determine name of filesystem, given name of snapshot. |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1765 |
* buf must be at least MAXNAMELEN bytes |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1766 |
*/ |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1767 |
int |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1768 |
dmu_fsname(const char *snapname, char *buf) |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1769 |
{ |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1770 |
char *atp = strchr(snapname, '@'); |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1771 |
if (atp == NULL) |
13980
d7059eb1884c
3598 want to dtrace when errors are generated in zfs
Matthew Ahrens <mahrens@delphix.com>
parents:
13973
diff
changeset
|
1772 |
return (SET_ERROR(EINVAL)); |
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1773 |
if (atp - snapname >= MAXNAMELEN) |
13980
d7059eb1884c
3598 want to dtrace when errors are generated in zfs
Matthew Ahrens <mahrens@delphix.com>
parents:
13973
diff
changeset
|
1774 |
return (SET_ERROR(ENAMETOOLONG)); |
13973
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1775 |
(void) strlcpy(buf, snapname, atp - snapname + 1); |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1776 |
return (0); |
4972ab336f54
3464 zfs synctask code needs restructuring
Matthew Ahrens <mahrens@delphix.com>
parents:
13952
diff
changeset
|
1777 |
} |