author | Mark Shellenbaum <Mark.Shellenbaum@Sun.COM> |
Thu, 18 Mar 2010 18:06:26 -0600 | |
changeset 11954 | d6630fa76b91 |
parent 11935 | 538c866aaac6 |
child 12294 | 2a74b443e6b1 |
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 |
/* |
|
11422
42768837421d
PSARC/2009/511 zpool split
Mark J Musante <Mark.Musante@Sun.COM>
parents:
11147
diff
changeset
|
22 |
* Copyright 2010 Sun Microsystems, Inc. All rights reserved. |
789 | 23 |
* Use is subject to license terms. |
24 |
*/ |
|
25 |
||
26 |
#include <mdb/mdb_ctf.h> |
|
27 |
#include <sys/zfs_context.h> |
|
28 |
#include <sys/mdb_modapi.h> |
|
29 |
#include <sys/dbuf.h> |
|
30 |
#include <sys/dmu_objset.h> |
|
31 |
#include <sys/dsl_dir.h> |
|
32 |
#include <sys/dsl_pool.h> |
|
33 |
#include <sys/metaslab_impl.h> |
|
34 |
#include <sys/space_map.h> |
|
35 |
#include <sys/list.h> |
|
36 |
#include <sys/spa_impl.h> |
|
37 |
#include <sys/vdev_impl.h> |
|
11609
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
38 |
#include <sys/zap_leaf.h> |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
39 |
#include <sys/zap_impl.h> |
10407
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
40 |
#include <ctype.h> |
11935
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
41 |
#include <sys/zfs_acl.h> |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
42 |
#include <sys/sa_impl.h> |
789 | 43 |
|
44 |
#ifndef _KERNEL |
|
45 |
#include "../genunix/list.h" |
|
46 |
#endif |
|
47 |
||
48 |
#ifdef _KERNEL |
|
49 |
#define ZFS_OBJ_NAME "zfs" |
|
50 |
#else |
|
51 |
#define ZFS_OBJ_NAME "libzpool.so.1" |
|
52 |
#endif |
|
53 |
||
11726
9686f6127423
6896791 want zdb option to set aok and zfs_recover
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
11609
diff
changeset
|
54 |
#ifndef _KERNEL |
9686f6127423
6896791 want zdb option to set aok and zfs_recover
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
11609
diff
changeset
|
55 |
int aok; |
9686f6127423
6896791 want zdb option to set aok and zfs_recover
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
11609
diff
changeset
|
56 |
#endif |
9686f6127423
6896791 want zdb option to set aok and zfs_recover
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
11609
diff
changeset
|
57 |
|
789 | 58 |
static int |
59 |
getmember(uintptr_t addr, const char *type, mdb_ctf_id_t *idp, |
|
60 |
const char *member, int len, void *buf) |
|
61 |
{ |
|
62 |
mdb_ctf_id_t id; |
|
63 |
ulong_t off; |
|
64 |
char name[64]; |
|
65 |
||
66 |
if (idp == NULL) { |
|
67 |
if (mdb_ctf_lookup_by_name(type, &id) == -1) { |
|
68 |
mdb_warn("couldn't find type %s", type); |
|
69 |
return (DCMD_ERR); |
|
70 |
} |
|
71 |
idp = &id; |
|
72 |
} else { |
|
73 |
type = name; |
|
74 |
mdb_ctf_type_name(*idp, name, sizeof (name)); |
|
75 |
} |
|
76 |
||
77 |
if (mdb_ctf_offsetof(*idp, member, &off) == -1) { |
|
78 |
mdb_warn("couldn't find member %s of type %s\n", member, type); |
|
79 |
return (DCMD_ERR); |
|
80 |
} |
|
81 |
if (off % 8 != 0) { |
|
82 |
mdb_warn("member %s of type %s is unsupported bitfield", |
|
83 |
member, type); |
|
84 |
return (DCMD_ERR); |
|
85 |
} |
|
86 |
off /= 8; |
|
87 |
||
88 |
if (mdb_vread(buf, len, addr + off) == -1) { |
|
89 |
mdb_warn("failed to read %s from %s at %p", |
|
90 |
member, type, addr + off); |
|
91 |
return (DCMD_ERR); |
|
92 |
} |
|
93 |
/* mdb_warn("read %s from %s at %p+%llx\n", member, type, addr, off); */ |
|
94 |
||
95 |
return (0); |
|
96 |
} |
|
97 |
||
98 |
#define GETMEMB(addr, type, member, dest) \ |
|
99 |
getmember(addr, #type, NULL, #member, sizeof (dest), &(dest)) |
|
100 |
||
101 |
#define GETMEMBID(addr, ctfid, member, dest) \ |
|
102 |
getmember(addr, NULL, ctfid, #member, sizeof (dest), &(dest)) |
|
103 |
||
104 |
static int |
|
105 |
getrefcount(uintptr_t addr, mdb_ctf_id_t *id, |
|
106 |
const char *member, uint64_t *rc) |
|
107 |
{ |
|
108 |
static int gotid; |
|
109 |
static mdb_ctf_id_t rc_id; |
|
110 |
ulong_t off; |
|
111 |
||
112 |
if (!gotid) { |
|
113 |
if (mdb_ctf_lookup_by_name("struct refcount", &rc_id) == -1) { |
|
114 |
mdb_warn("couldn't find struct refcount"); |
|
115 |
return (DCMD_ERR); |
|
116 |
} |
|
117 |
gotid = TRUE; |
|
118 |
} |
|
119 |
||
120 |
if (mdb_ctf_offsetof(*id, member, &off) == -1) { |
|
121 |
char name[64]; |
|
122 |
mdb_ctf_type_name(*id, name, sizeof (name)); |
|
123 |
mdb_warn("couldn't find member %s of type %s\n", member, name); |
|
124 |
return (DCMD_ERR); |
|
125 |
} |
|
126 |
off /= 8; |
|
127 |
||
128 |
return (GETMEMBID(addr + off, &rc_id, rc_count, *rc)); |
|
129 |
} |
|
130 |
||
131 |
static int verbose; |
|
132 |
||
133 |
static int |
|
134 |
freelist_walk_init(mdb_walk_state_t *wsp) |
|
135 |
{ |
|
136 |
if (wsp->walk_addr == NULL) { |
|
137 |
mdb_warn("must supply starting address\n"); |
|
138 |
return (WALK_ERR); |
|
139 |
} |
|
140 |
||
141 |
wsp->walk_data = 0; /* Index into the freelist */ |
|
142 |
return (WALK_NEXT); |
|
143 |
} |
|
144 |
||
145 |
static int |
|
146 |
freelist_walk_step(mdb_walk_state_t *wsp) |
|
147 |
{ |
|
148 |
uint64_t entry; |
|
149 |
uintptr_t number = (uintptr_t)wsp->walk_data; |
|
3361
a3d194896a76
6480230 ::walk spa|::walk zms_freelist cause mdb to core dump
ck153898
parents:
3158
diff
changeset
|
150 |
char *ddata[] = { "ALLOC", "FREE", "CONDENSE", "INVALID", |
a3d194896a76
6480230 ::walk spa|::walk zms_freelist cause mdb to core dump
ck153898
parents:
3158
diff
changeset
|
151 |
"INVALID", "INVALID", "INVALID", "INVALID" }; |
789 | 152 |
int mapshift = SPA_MINBLOCKSHIFT; |
153 |
||
154 |
if (mdb_vread(&entry, sizeof (entry), wsp->walk_addr) == -1) { |
|
155 |
mdb_warn("failed to read freelist entry %p", wsp->walk_addr); |
|
156 |
return (WALK_DONE); |
|
157 |
} |
|
158 |
wsp->walk_addr += sizeof (entry); |
|
159 |
wsp->walk_data = (void *)(number + 1); |
|
160 |
||
161 |
if (SM_DEBUG_DECODE(entry)) { |
|
162 |
mdb_printf("DEBUG: %3u %10s: txg=%llu pass=%llu\n", |
|
163 |
number, |
|
164 |
ddata[SM_DEBUG_ACTION_DECODE(entry)], |
|
165 |
SM_DEBUG_TXG_DECODE(entry), |
|
166 |
SM_DEBUG_SYNCPASS_DECODE(entry)); |
|
167 |
} else { |
|
168 |
mdb_printf("Entry: %3u offsets=%08llx-%08llx type=%c " |
|
169 |
"size=%06llx", number, |
|
170 |
SM_OFFSET_DECODE(entry) << mapshift, |
|
171 |
(SM_OFFSET_DECODE(entry) + SM_RUN_DECODE(entry)) << |
|
172 |
mapshift, |
|
173 |
SM_TYPE_DECODE(entry) == SM_ALLOC ? 'A' : 'F', |
|
174 |
SM_RUN_DECODE(entry) << mapshift); |
|
175 |
if (verbose) |
|
176 |
mdb_printf(" (raw=%012llx)\n", entry); |
|
177 |
mdb_printf("\n"); |
|
178 |
} |
|
179 |
return (WALK_NEXT); |
|
180 |
} |
|
181 |
||
182 |
||
183 |
static int |
|
184 |
dataset_name(uintptr_t addr, char *buf) |
|
185 |
{ |
|
186 |
static int gotid; |
|
187 |
static mdb_ctf_id_t dd_id; |
|
188 |
uintptr_t dd_parent; |
|
189 |
char dd_myname[MAXNAMELEN]; |
|
190 |
||
191 |
if (!gotid) { |
|
192 |
if (mdb_ctf_lookup_by_name("struct dsl_dir", |
|
193 |
&dd_id) == -1) { |
|
194 |
mdb_warn("couldn't find struct dsl_dir"); |
|
195 |
return (DCMD_ERR); |
|
196 |
} |
|
197 |
gotid = TRUE; |
|
198 |
} |
|
199 |
if (GETMEMBID(addr, &dd_id, dd_parent, dd_parent) || |
|
200 |
GETMEMBID(addr, &dd_id, dd_myname, dd_myname)) { |
|
201 |
return (DCMD_ERR); |
|
202 |
} |
|
203 |
||
204 |
if (dd_parent) { |
|
205 |
if (dataset_name(dd_parent, buf)) |
|
206 |
return (DCMD_ERR); |
|
207 |
strcat(buf, "/"); |
|
208 |
} |
|
209 |
||
210 |
if (dd_myname[0]) |
|
211 |
strcat(buf, dd_myname); |
|
212 |
else |
|
213 |
strcat(buf, "???"); |
|
214 |
||
215 |
return (0); |
|
216 |
} |
|
217 |
||
218 |
static int |
|
219 |
objset_name(uintptr_t addr, char *buf) |
|
220 |
{ |
|
221 |
static int gotid; |
|
11954
d6630fa76b91
6936265 mismerge in zfs mdb module
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11935
diff
changeset
|
222 |
static mdb_ctf_id_t os_id, ds_id; |
789 | 223 |
uintptr_t os_dsl_dataset; |
224 |
char ds_snapname[MAXNAMELEN]; |
|
225 |
uintptr_t ds_dir; |
|
226 |
||
227 |
buf[0] = '\0'; |
|
228 |
||
229 |
if (!gotid) { |
|
11954
d6630fa76b91
6936265 mismerge in zfs mdb module
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11935
diff
changeset
|
230 |
if (mdb_ctf_lookup_by_name("struct objset", |
d6630fa76b91
6936265 mismerge in zfs mdb module
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11935
diff
changeset
|
231 |
&os_id) == -1) { |
d6630fa76b91
6936265 mismerge in zfs mdb module
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11935
diff
changeset
|
232 |
mdb_warn("couldn't find struct objset"); |
789 | 233 |
return (DCMD_ERR); |
234 |
} |
|
235 |
if (mdb_ctf_lookup_by_name("struct dsl_dataset", |
|
236 |
&ds_id) == -1) { |
|
237 |
mdb_warn("couldn't find struct dsl_dataset"); |
|
238 |
return (DCMD_ERR); |
|
239 |
} |
|
240 |
||
241 |
gotid = TRUE; |
|
242 |
} |
|
243 |
||
11954
d6630fa76b91
6936265 mismerge in zfs mdb module
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11935
diff
changeset
|
244 |
if (GETMEMBID(addr, &os_id, os_dsl_dataset, os_dsl_dataset)) |
789 | 245 |
return (DCMD_ERR); |
246 |
||
247 |
if (os_dsl_dataset == 0) { |
|
248 |
strcat(buf, "mos"); |
|
249 |
return (0); |
|
250 |
} |
|
251 |
||
252 |
if (GETMEMBID(os_dsl_dataset, &ds_id, ds_snapname, ds_snapname) || |
|
253 |
GETMEMBID(os_dsl_dataset, &ds_id, ds_dir, ds_dir)) { |
|
254 |
return (DCMD_ERR); |
|
255 |
} |
|
256 |
||
257 |
if (ds_dir && dataset_name(ds_dir, buf)) |
|
258 |
return (DCMD_ERR); |
|
259 |
||
260 |
if (ds_snapname[0]) { |
|
261 |
strcat(buf, "@"); |
|
262 |
strcat(buf, ds_snapname); |
|
263 |
} |
|
264 |
return (0); |
|
265 |
} |
|
266 |
||
267 |
static void |
|
268 |
enum_lookup(char *out, size_t size, mdb_ctf_id_t id, int val, |
|
269 |
const char *prefix) |
|
270 |
{ |
|
271 |
const char *cp; |
|
272 |
size_t len = strlen(prefix); |
|
273 |
||
274 |
if ((cp = mdb_ctf_enum_name(id, val)) != NULL) { |
|
275 |
if (strncmp(cp, prefix, len) == 0) |
|
276 |
cp += len; |
|
277 |
(void) strncpy(out, cp, size); |
|
278 |
} else { |
|
279 |
mdb_snprintf(out, size, "? (%d)", val); |
|
280 |
} |
|
281 |
} |
|
282 |
||
283 |
/* ARGSUSED */ |
|
284 |
static int |
|
3059 | 285 |
zfs_params(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) |
286 |
{ |
|
287 |
/* |
|
288 |
* This table can be approximately generated by running: |
|
289 |
* egrep "^[a-z0-9_]+ [a-z0-9_]+( =.*)?;" *.c | cut -d ' ' -f 2 |
|
290 |
*/ |
|
291 |
static const char *params[] = { |
|
292 |
"arc_reduce_dnlc_percent", |
|
293 |
"zfs_arc_max", |
|
294 |
"zfs_arc_min", |
|
3158
f30a3849aa23
6493923 nfsfind on ZFS filesystem quickly depletes memory in a 1GB system
maybee
parents:
3059
diff
changeset
|
295 |
"arc_shrink_shift", |
3059 | 296 |
"zfs_mdcomp_disable", |
297 |
"zfs_prefetch_disable", |
|
298 |
"zfetch_max_streams", |
|
299 |
"zfetch_min_sec_reap", |
|
300 |
"zfetch_block_cap", |
|
301 |
"zfetch_array_rd_sz", |
|
302 |
"zfs_default_bs", |
|
303 |
"zfs_default_ibs", |
|
304 |
"metaslab_aliquot", |
|
305 |
"reference_tracking_enable", |
|
306 |
"reference_history", |
|
307 |
"spa_max_replication_override", |
|
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10860
diff
changeset
|
308 |
"spa_mode_global", |
3059 | 309 |
"zfs_flags", |
6245
1a2a7cfb9f26
6429205 each zpool needs to monitor its throughput and throttle heavy writers
maybee
parents:
5367
diff
changeset
|
310 |
"zfs_txg_synctime", |
1a2a7cfb9f26
6429205 each zpool needs to monitor its throughput and throttle heavy writers
maybee
parents:
5367
diff
changeset
|
311 |
"zfs_txg_timeout", |
1a2a7cfb9f26
6429205 each zpool needs to monitor its throughput and throttle heavy writers
maybee
parents:
5367
diff
changeset
|
312 |
"zfs_write_limit_min", |
1a2a7cfb9f26
6429205 each zpool needs to monitor its throughput and throttle heavy writers
maybee
parents:
5367
diff
changeset
|
313 |
"zfs_write_limit_max", |
1a2a7cfb9f26
6429205 each zpool needs to monitor its throughput and throttle heavy writers
maybee
parents:
5367
diff
changeset
|
314 |
"zfs_write_limit_shift", |
1a2a7cfb9f26
6429205 each zpool needs to monitor its throughput and throttle heavy writers
maybee
parents:
5367
diff
changeset
|
315 |
"zfs_write_limit_override", |
1a2a7cfb9f26
6429205 each zpool needs to monitor its throughput and throttle heavy writers
maybee
parents:
5367
diff
changeset
|
316 |
"zfs_no_write_throttle", |
3059 | 317 |
"zfs_vdev_cache_max", |
318 |
"zfs_vdev_cache_size", |
|
319 |
"zfs_vdev_cache_bshift", |
|
320 |
"vdev_mirror_shift", |
|
321 |
"zfs_vdev_max_pending", |
|
322 |
"zfs_vdev_min_pending", |
|
323 |
"zfs_scrub_limit", |
|
11147
74e8c05021f1
6678033 resilver code should prefetch
George Wilson <George.Wilson@Sun.COM>
parents:
10922
diff
changeset
|
324 |
"zfs_no_scrub_io", |
74e8c05021f1
6678033 resilver code should prefetch
George Wilson <George.Wilson@Sun.COM>
parents:
10922
diff
changeset
|
325 |
"zfs_no_scrub_prefetch", |
3059 | 326 |
"zfs_vdev_time_shift", |
327 |
"zfs_vdev_ramp_rate", |
|
328 |
"zfs_vdev_aggregation_limit", |
|
329 |
"fzap_default_block_shift", |
|
330 |
"zfs_immediate_write_sz", |
|
331 |
"zfs_read_chunk_size", |
|
332 |
"zil_disable", |
|
333 |
"zfs_nocacheflush", |
|
6245
1a2a7cfb9f26
6429205 each zpool needs to monitor its throughput and throttle heavy writers
maybee
parents:
5367
diff
changeset
|
334 |
"metaslab_gang_bang", |
9480
fcff33da767f
6596237 Stop looking and start ganging
George Wilson <George.Wilson@Sun.COM>
parents:
8632
diff
changeset
|
335 |
"metaslab_df_alloc_threshold", |
fcff33da767f
6596237 Stop looking and start ganging
George Wilson <George.Wilson@Sun.COM>
parents:
8632
diff
changeset
|
336 |
"metaslab_df_free_pct", |
3059 | 337 |
"zio_injection_enabled", |
338 |
"zvol_immediate_write_sz", |
|
339 |
}; |
|
340 |
||
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10860
diff
changeset
|
341 |
for (int i = 0; i < sizeof (params) / sizeof (params[0]); i++) { |
3059 | 342 |
int sz; |
343 |
uint64_t val64; |
|
344 |
uint32_t *val32p = (uint32_t *)&val64; |
|
345 |
||
346 |
sz = mdb_readvar(&val64, params[i]); |
|
347 |
if (sz == 4) { |
|
348 |
mdb_printf("%s = 0x%x\n", params[i], *val32p); |
|
349 |
} else if (sz == 8) { |
|
350 |
mdb_printf("%s = 0x%llx\n", params[i], val64); |
|
351 |
} else { |
|
352 |
mdb_warn("variable %s not found", params[i]); |
|
353 |
} |
|
354 |
} |
|
355 |
||
356 |
return (DCMD_OK); |
|
357 |
} |
|
358 |
||
359 |
/* ARGSUSED */ |
|
360 |
static int |
|
789 | 361 |
blkptr(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) |
362 |
{ |
|
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10860
diff
changeset
|
363 |
mdb_ctf_id_t type_enum, checksum_enum, compress_enum; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10860
diff
changeset
|
364 |
char type[80], checksum[80], compress[80]; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10860
diff
changeset
|
365 |
blkptr_t blk, *bp = &blk; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10860
diff
changeset
|
366 |
char buf[BP_SPRINTF_LEN]; |
789 | 367 |
|
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10860
diff
changeset
|
368 |
if (mdb_vread(&blk, sizeof (blkptr_t), addr) == -1) { |
789 | 369 |
mdb_warn("failed to read blkptr_t"); |
370 |
return (DCMD_ERR); |
|
371 |
} |
|
372 |
||
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10860
diff
changeset
|
373 |
if (mdb_ctf_lookup_by_name("enum dmu_object_type", &type_enum) == -1 || |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10860
diff
changeset
|
374 |
mdb_ctf_lookup_by_name("enum zio_checksum", &checksum_enum) == -1 || |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10860
diff
changeset
|
375 |
mdb_ctf_lookup_by_name("enum zio_compress", &compress_enum) == -1) { |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10860
diff
changeset
|
376 |
mdb_warn("Could not find blkptr enumerated types"); |
789 | 377 |
return (DCMD_ERR); |
378 |
} |
|
379 |
||
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10860
diff
changeset
|
380 |
enum_lookup(type, sizeof (type), type_enum, |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10860
diff
changeset
|
381 |
BP_GET_TYPE(bp), "DMU_OT_"); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10860
diff
changeset
|
382 |
enum_lookup(checksum, sizeof (checksum), checksum_enum, |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10860
diff
changeset
|
383 |
BP_GET_CHECKSUM(bp), "ZIO_CHECKSUM_"); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10860
diff
changeset
|
384 |
enum_lookup(compress, sizeof (compress), compress_enum, |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10860
diff
changeset
|
385 |
BP_GET_COMPRESS(bp), "ZIO_COMPRESS_"); |
1775
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
386 |
|
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10860
diff
changeset
|
387 |
SPRINTF_BLKPTR(mdb_snprintf, '\n', buf, bp, type, checksum, compress); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10860
diff
changeset
|
388 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10860
diff
changeset
|
389 |
mdb_printf("%s\n", buf); |
789 | 390 |
|
391 |
return (DCMD_OK); |
|
392 |
} |
|
393 |
||
394 |
/* ARGSUSED */ |
|
395 |
static int |
|
396 |
dbuf(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) |
|
397 |
{ |
|
398 |
mdb_ctf_id_t id; |
|
399 |
dmu_buf_t db; |
|
400 |
uintptr_t objset; |
|
401 |
uint8_t level; |
|
402 |
uint64_t blkid; |
|
403 |
uint64_t holds; |
|
404 |
char objectname[32]; |
|
405 |
char blkidname[32]; |
|
406 |
char path[MAXNAMELEN]; |
|
407 |
||
408 |
if (DCMD_HDRSPEC(flags)) { |
|
409 |
mdb_printf(" addr object lvl blkid holds os\n"); |
|
410 |
} |
|
411 |
||
412 |
if (mdb_ctf_lookup_by_name("struct dmu_buf_impl", &id) == -1) { |
|
413 |
mdb_warn("couldn't find struct dmu_buf_impl_t"); |
|
414 |
return (DCMD_ERR); |
|
415 |
} |
|
416 |
||
417 |
if (GETMEMBID(addr, &id, db_objset, objset) || |
|
418 |
GETMEMBID(addr, &id, db, db) || |
|
419 |
GETMEMBID(addr, &id, db_level, level) || |
|
420 |
GETMEMBID(addr, &id, db_blkid, blkid)) { |
|
421 |
return (WALK_ERR); |
|
422 |
} |
|
423 |
||
424 |
if (getrefcount(addr, &id, "db_holds", &holds)) { |
|
425 |
return (WALK_ERR); |
|
426 |
} |
|
427 |
||
428 |
if (db.db_object == DMU_META_DNODE_OBJECT) |
|
429 |
(void) strcpy(objectname, "mdn"); |
|
430 |
else |
|
431 |
(void) mdb_snprintf(objectname, sizeof (objectname), "%llx", |
|
432 |
(u_longlong_t)db.db_object); |
|
433 |
||
11935
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
434 |
if (blkid == DMU_BONUS_BLKID) |
789 | 435 |
(void) strcpy(blkidname, "bonus"); |
436 |
else |
|
437 |
(void) mdb_snprintf(blkidname, sizeof (blkidname), "%llx", |
|
438 |
(u_longlong_t)blkid); |
|
439 |
||
440 |
if (objset_name(objset, path)) { |
|
441 |
return (WALK_ERR); |
|
442 |
} |
|
443 |
||
444 |
mdb_printf("%p %8s %1u %9s %2llu %s\n", |
|
445 |
addr, objectname, level, blkidname, holds, path); |
|
446 |
||
447 |
return (DCMD_OK); |
|
448 |
} |
|
449 |
||
450 |
/* ARGSUSED */ |
|
451 |
static int |
|
452 |
dbuf_stats(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) |
|
453 |
{ |
|
454 |
#define HISTOSZ 32 |
|
455 |
uintptr_t dbp; |
|
456 |
dmu_buf_impl_t db; |
|
457 |
dbuf_hash_table_t ht; |
|
458 |
uint64_t bucket, ndbufs; |
|
459 |
uint64_t histo[HISTOSZ]; |
|
460 |
uint64_t histo2[HISTOSZ]; |
|
461 |
int i, maxidx; |
|
462 |
||
463 |
if (mdb_readvar(&ht, "dbuf_hash_table") == -1) { |
|
464 |
mdb_warn("failed to read 'dbuf_hash_table'"); |
|
465 |
return (DCMD_ERR); |
|
466 |
} |
|
467 |
||
468 |
for (i = 0; i < HISTOSZ; i++) { |
|
469 |
histo[i] = 0; |
|
470 |
histo2[i] = 0; |
|
471 |
} |
|
472 |
||
473 |
ndbufs = 0; |
|
474 |
for (bucket = 0; bucket < ht.hash_table_mask+1; bucket++) { |
|
475 |
int len; |
|
476 |
||
477 |
if (mdb_vread(&dbp, sizeof (void *), |
|
478 |
(uintptr_t)(ht.hash_table+bucket)) == -1) { |
|
479 |
mdb_warn("failed to read hash bucket %u at %p", |
|
480 |
bucket, ht.hash_table+bucket); |
|
481 |
return (DCMD_ERR); |
|
482 |
} |
|
483 |
||
484 |
len = 0; |
|
485 |
while (dbp != 0) { |
|
486 |
if (mdb_vread(&db, sizeof (dmu_buf_impl_t), |
|
487 |
dbp) == -1) { |
|
488 |
mdb_warn("failed to read dbuf at %p", dbp); |
|
489 |
return (DCMD_ERR); |
|
490 |
} |
|
491 |
dbp = (uintptr_t)db.db_hash_next; |
|
492 |
for (i = MIN(len, HISTOSZ - 1); i >= 0; i--) |
|
493 |
histo2[i]++; |
|
494 |
len++; |
|
495 |
ndbufs++; |
|
496 |
} |
|
497 |
||
498 |
if (len >= HISTOSZ) |
|
499 |
len = HISTOSZ-1; |
|
500 |
histo[len]++; |
|
501 |
} |
|
502 |
||
503 |
mdb_printf("hash table has %llu buckets, %llu dbufs " |
|
504 |
"(avg %llu buckets/dbuf)\n", |
|
505 |
ht.hash_table_mask+1, ndbufs, |
|
506 |
(ht.hash_table_mask+1)/ndbufs); |
|
507 |
||
508 |
mdb_printf("\n"); |
|
509 |
maxidx = 0; |
|
510 |
for (i = 0; i < HISTOSZ; i++) |
|
511 |
if (histo[i] > 0) |
|
512 |
maxidx = i; |
|
513 |
mdb_printf("hash chain length number of buckets\n"); |
|
514 |
for (i = 0; i <= maxidx; i++) |
|
515 |
mdb_printf("%u %llu\n", i, histo[i]); |
|
516 |
||
517 |
mdb_printf("\n"); |
|
518 |
maxidx = 0; |
|
519 |
for (i = 0; i < HISTOSZ; i++) |
|
520 |
if (histo2[i] > 0) |
|
521 |
maxidx = i; |
|
522 |
mdb_printf("hash chain depth number of dbufs\n"); |
|
523 |
for (i = 0; i <= maxidx; i++) |
|
524 |
mdb_printf("%u or more %llu %llu%%\n", |
|
525 |
i, histo2[i], histo2[i]*100/ndbufs); |
|
526 |
||
527 |
||
528 |
return (DCMD_OK); |
|
529 |
} |
|
530 |
||
11609
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
531 |
#define CHAIN_END 0xffff |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
532 |
/* |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
533 |
* ::zap_leaf [-v] |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
534 |
* |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
535 |
* Print a zap_leaf_phys_t, assumed to be 16k |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
536 |
*/ |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
537 |
/* ARGSUSED */ |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
538 |
static int |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
539 |
zap_leaf(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
540 |
{ |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
541 |
char buf[16*1024]; |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
542 |
int verbose = B_FALSE; |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
543 |
int four = B_FALSE; |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
544 |
zap_leaf_t l; |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
545 |
zap_leaf_phys_t *zlp = (void *)buf; |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
546 |
int i; |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
547 |
|
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
548 |
if (mdb_getopts(argc, argv, |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
549 |
'v', MDB_OPT_SETBITS, TRUE, &verbose, |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
550 |
'4', MDB_OPT_SETBITS, TRUE, &four, |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
551 |
NULL) != argc) |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
552 |
return (DCMD_USAGE); |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
553 |
|
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
554 |
l.l_phys = zlp; |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
555 |
l.l_bs = 14; /* assume 16k blocks */ |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
556 |
if (four) |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
557 |
l.l_bs = 12; |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
558 |
|
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
559 |
if (!(flags & DCMD_ADDRSPEC)) { |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
560 |
return (DCMD_USAGE); |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
561 |
} |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
562 |
|
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
563 |
if (mdb_vread(buf, sizeof (buf), addr) == -1) { |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
564 |
mdb_warn("failed to read zap_leaf_phys_t at %p", addr); |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
565 |
return (DCMD_ERR); |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
566 |
} |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
567 |
|
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
568 |
if (zlp->l_hdr.lh_block_type != ZBT_LEAF || |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
569 |
zlp->l_hdr.lh_magic != ZAP_LEAF_MAGIC) { |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
570 |
mdb_warn("This does not appear to be a zap_leaf_phys_t"); |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
571 |
return (DCMD_ERR); |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
572 |
} |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
573 |
|
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
574 |
mdb_printf("zap_leaf_phys_t at %p:\n", addr); |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
575 |
mdb_printf(" lh_prefix_len = %u\n", zlp->l_hdr.lh_prefix_len); |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
576 |
mdb_printf(" lh_prefix = %llx\n", zlp->l_hdr.lh_prefix); |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
577 |
mdb_printf(" lh_nentries = %u\n", zlp->l_hdr.lh_nentries); |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
578 |
mdb_printf(" lh_nfree = %u\n", zlp->l_hdr.lh_nfree, |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
579 |
zlp->l_hdr.lh_nfree * 100 / (ZAP_LEAF_NUMCHUNKS(&l))); |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
580 |
mdb_printf(" lh_freelist = %u\n", zlp->l_hdr.lh_freelist); |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
581 |
mdb_printf(" lh_flags = %x (%s)\n", zlp->l_hdr.lh_flags, |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
582 |
zlp->l_hdr.lh_flags & ZLF_ENTRIES_CDSORTED ? |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
583 |
"ENTRIES_CDSORTED" : ""); |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
584 |
|
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
585 |
if (verbose) { |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
586 |
mdb_printf(" hash table:\n"); |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
587 |
for (i = 0; i < ZAP_LEAF_HASH_NUMENTRIES(&l); i++) { |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
588 |
if (zlp->l_hash[i] != CHAIN_END) |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
589 |
mdb_printf(" %u: %u\n", i, zlp->l_hash[i]); |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
590 |
} |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
591 |
} |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
592 |
|
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
593 |
mdb_printf(" chunks:\n"); |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
594 |
for (i = 0; i < ZAP_LEAF_NUMCHUNKS(&l); i++) { |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
595 |
/* LINTED: alignment */ |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
596 |
zap_leaf_chunk_t *zlc = &ZAP_LEAF_CHUNK(&l, i); |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
597 |
switch (zlc->l_entry.le_type) { |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
598 |
case ZAP_CHUNK_FREE: |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
599 |
if (verbose) { |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
600 |
mdb_printf(" %u: free; lf_next = %u\n", |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
601 |
i, zlc->l_free.lf_next); |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
602 |
} |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
603 |
break; |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
604 |
case ZAP_CHUNK_ENTRY: |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
605 |
mdb_printf(" %u: entry\n", i); |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
606 |
if (verbose) { |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
607 |
mdb_printf(" le_next = %u\n", |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
608 |
zlc->l_entry.le_next); |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
609 |
} |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
610 |
mdb_printf(" le_name_chunk = %u\n", |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
611 |
zlc->l_entry.le_name_chunk); |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
612 |
mdb_printf(" le_name_numints = %u\n", |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
613 |
zlc->l_entry.le_name_numints); |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
614 |
mdb_printf(" le_value_chunk = %u\n", |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
615 |
zlc->l_entry.le_value_chunk); |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
616 |
mdb_printf(" le_value_intlen = %u\n", |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
617 |
zlc->l_entry.le_value_intlen); |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
618 |
mdb_printf(" le_value_numints = %u\n", |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
619 |
zlc->l_entry.le_value_numints); |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
620 |
mdb_printf(" le_cd = %u\n", |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
621 |
zlc->l_entry.le_cd); |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
622 |
mdb_printf(" le_hash = %llx\n", |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
623 |
zlc->l_entry.le_hash); |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
624 |
break; |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
625 |
case ZAP_CHUNK_ARRAY: |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
626 |
mdb_printf(" %u: array \"%s\"\n", |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
627 |
i, zlc->l_array.la_array); |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
628 |
if (verbose) { |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
629 |
int j; |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
630 |
mdb_printf(" "); |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
631 |
for (j = 0; j < ZAP_LEAF_ARRAY_BYTES; j++) { |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
632 |
mdb_printf("%02x ", |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
633 |
zlc->l_array.la_array[j]); |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
634 |
} |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
635 |
mdb_printf("\n"); |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
636 |
} |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
637 |
if (zlc->l_array.la_next != CHAIN_END) { |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
638 |
mdb_printf(" lf_next = %u\n", |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
639 |
zlc->l_array.la_next); |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
640 |
} |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
641 |
break; |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
642 |
default: |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
643 |
mdb_printf(" %u: undefined type %u\n", |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
644 |
zlc->l_entry.le_type); |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
645 |
} |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
646 |
} |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
647 |
|
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
648 |
return (DCMD_OK); |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
649 |
} |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
650 |
|
789 | 651 |
typedef struct dbufs_data { |
652 |
mdb_ctf_id_t id; |
|
653 |
uint64_t objset; |
|
654 |
uint64_t object; |
|
655 |
uint64_t level; |
|
656 |
uint64_t blkid; |
|
657 |
char *osname; |
|
658 |
} dbufs_data_t; |
|
659 |
||
660 |
#define DBUFS_UNSET (0xbaddcafedeadbeefULL) |
|
661 |
||
662 |
/* ARGSUSED */ |
|
663 |
static int |
|
664 |
dbufs_cb(uintptr_t addr, const void *unknown, void *arg) |
|
665 |
{ |
|
666 |
dbufs_data_t *data = arg; |
|
667 |
uintptr_t objset; |
|
668 |
dmu_buf_t db; |
|
669 |
uint8_t level; |
|
670 |
uint64_t blkid; |
|
671 |
char osname[MAXNAMELEN]; |
|
672 |
||
673 |
if (GETMEMBID(addr, &data->id, db_objset, objset) || |
|
674 |
GETMEMBID(addr, &data->id, db, db) || |
|
675 |
GETMEMBID(addr, &data->id, db_level, level) || |
|
676 |
GETMEMBID(addr, &data->id, db_blkid, blkid)) { |
|
677 |
return (WALK_ERR); |
|
678 |
} |
|
679 |
||
680 |
if ((data->objset == DBUFS_UNSET || data->objset == objset) && |
|
681 |
(data->osname == NULL || (objset_name(objset, osname) == 0 && |
|
4055 | 682 |
strcmp(data->osname, osname) == 0)) && |
789 | 683 |
(data->object == DBUFS_UNSET || data->object == db.db_object) && |
684 |
(data->level == DBUFS_UNSET || data->level == level) && |
|
685 |
(data->blkid == DBUFS_UNSET || data->blkid == blkid)) { |
|
686 |
mdb_printf("%#lr\n", addr); |
|
687 |
} |
|
688 |
return (WALK_NEXT); |
|
689 |
} |
|
690 |
||
691 |
/* ARGSUSED */ |
|
692 |
static int |
|
693 |
dbufs(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) |
|
694 |
{ |
|
695 |
dbufs_data_t data; |
|
696 |
char *object = NULL; |
|
697 |
char *blkid = NULL; |
|
698 |
||
699 |
data.objset = data.object = data.level = data.blkid = DBUFS_UNSET; |
|
700 |
data.osname = NULL; |
|
701 |
||
702 |
if (mdb_getopts(argc, argv, |
|
703 |
'O', MDB_OPT_UINT64, &data.objset, |
|
704 |
'n', MDB_OPT_STR, &data.osname, |
|
705 |
'o', MDB_OPT_STR, &object, |
|
706 |
'l', MDB_OPT_UINT64, &data.level, |
|
707 |
'b', MDB_OPT_STR, &blkid) != argc) { |
|
708 |
return (DCMD_USAGE); |
|
709 |
} |
|
710 |
||
711 |
if (object) { |
|
712 |
if (strcmp(object, "mdn") == 0) { |
|
713 |
data.object = DMU_META_DNODE_OBJECT; |
|
714 |
} else { |
|
715 |
data.object = mdb_strtoull(object); |
|
716 |
} |
|
717 |
} |
|
718 |
||
719 |
if (blkid) { |
|
720 |
if (strcmp(blkid, "bonus") == 0) { |
|
11935
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
721 |
data.blkid = DMU_BONUS_BLKID; |
789 | 722 |
} else { |
723 |
data.blkid = mdb_strtoull(blkid); |
|
724 |
} |
|
725 |
} |
|
726 |
||
727 |
if (mdb_ctf_lookup_by_name("struct dmu_buf_impl", &data.id) == -1) { |
|
728 |
mdb_warn("couldn't find struct dmu_buf_impl_t"); |
|
729 |
return (DCMD_ERR); |
|
730 |
} |
|
731 |
||
2459
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
732 |
if (mdb_walk("dmu_buf_impl_t", dbufs_cb, &data) != 0) { |
789 | 733 |
mdb_warn("can't walk dbufs"); |
734 |
return (DCMD_ERR); |
|
735 |
} |
|
736 |
||
737 |
return (DCMD_OK); |
|
738 |
} |
|
739 |
||
740 |
typedef struct abuf_find_data { |
|
741 |
dva_t dva; |
|
742 |
mdb_ctf_id_t id; |
|
743 |
} abuf_find_data_t; |
|
744 |
||
745 |
/* ARGSUSED */ |
|
746 |
static int |
|
747 |
abuf_find_cb(uintptr_t addr, const void *unknown, void *arg) |
|
748 |
{ |
|
749 |
abuf_find_data_t *data = arg; |
|
750 |
dva_t dva; |
|
751 |
||
752 |
if (GETMEMBID(addr, &data->id, b_dva, dva)) { |
|
753 |
return (WALK_ERR); |
|
754 |
} |
|
755 |
||
756 |
if (dva.dva_word[0] == data->dva.dva_word[0] && |
|
757 |
dva.dva_word[1] == data->dva.dva_word[1]) { |
|
758 |
mdb_printf("%#lr\n", addr); |
|
759 |
} |
|
760 |
return (WALK_NEXT); |
|
761 |
} |
|
762 |
||
763 |
/* ARGSUSED */ |
|
764 |
static int |
|
765 |
abuf_find(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) |
|
766 |
{ |
|
767 |
abuf_find_data_t data; |
|
768 |
GElf_Sym sym; |
|
769 |
int i; |
|
770 |
const char *syms[] = { |
|
2885 | 771 |
"ARC_mru", |
772 |
"ARC_mru_ghost", |
|
773 |
"ARC_mfu", |
|
774 |
"ARC_mfu_ghost", |
|
789 | 775 |
}; |
776 |
||
777 |
if (argc != 2) |
|
778 |
return (DCMD_USAGE); |
|
779 |
||
780 |
for (i = 0; i < 2; i ++) { |
|
781 |
switch (argv[i].a_type) { |
|
782 |
case MDB_TYPE_STRING: |
|
783 |
data.dva.dva_word[i] = mdb_strtoull(argv[i].a_un.a_str); |
|
784 |
break; |
|
785 |
case MDB_TYPE_IMMEDIATE: |
|
786 |
data.dva.dva_word[i] = argv[i].a_un.a_val; |
|
787 |
break; |
|
788 |
default: |
|
789 |
return (DCMD_USAGE); |
|
790 |
} |
|
791 |
} |
|
792 |
||
793 |
if (mdb_ctf_lookup_by_name("struct arc_buf_hdr", &data.id) == -1) { |
|
794 |
mdb_warn("couldn't find struct arc_buf_hdr"); |
|
795 |
return (DCMD_ERR); |
|
796 |
} |
|
797 |
||
798 |
for (i = 0; i < sizeof (syms) / sizeof (syms[0]); i++) { |
|
799 |
if (mdb_lookup_by_name(syms[i], &sym)) { |
|
800 |
mdb_warn("can't find symbol %s", syms[i]); |
|
801 |
return (DCMD_ERR); |
|
802 |
} |
|
803 |
||
804 |
if (mdb_pwalk("list", abuf_find_cb, &data, sym.st_value) != 0) { |
|
805 |
mdb_warn("can't walk %s", syms[i]); |
|
806 |
return (DCMD_ERR); |
|
807 |
} |
|
808 |
} |
|
809 |
||
810 |
return (DCMD_OK); |
|
811 |
} |
|
812 |
||
3403 | 813 |
/*ARGSUSED*/ |
814 |
static int |
|
815 |
arc_print(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) |
|
816 |
{ |
|
817 |
kstat_named_t *stats; |
|
818 |
GElf_Sym sym; |
|
4787 | 819 |
int nstats, i; |
3403 | 820 |
uint_t opt_a = FALSE; |
4787 | 821 |
uint_t opt_b = FALSE; |
822 |
uint_t shift = 0; |
|
823 |
const char *suffix; |
|
3403 | 824 |
|
4787 | 825 |
static const char *bytestats[] = { |
826 |
"p", "c", "c_min", "c_max", "size", NULL |
|
827 |
}; |
|
828 |
||
829 |
static const char *extras[] = { |
|
830 |
"arc_no_grow", "arc_tempreserve", |
|
831 |
"arc_meta_used", "arc_meta_limit", "arc_meta_max", |
|
832 |
NULL |
|
3403 | 833 |
}; |
834 |
||
835 |
if (mdb_lookup_by_name("arc_stats", &sym) == -1) { |
|
836 |
mdb_warn("failed to find 'arc_stats'"); |
|
837 |
return (DCMD_ERR); |
|
838 |
} |
|
839 |
||
840 |
stats = mdb_zalloc(sym.st_size, UM_SLEEP | UM_GC); |
|
841 |
||
842 |
if (mdb_vread(stats, sym.st_size, sym.st_value) == -1) { |
|
843 |
mdb_warn("couldn't read 'arc_stats' at %p", sym.st_value); |
|
844 |
return (DCMD_ERR); |
|
845 |
} |
|
846 |
||
847 |
nstats = sym.st_size / sizeof (kstat_named_t); |
|
848 |
||
4787 | 849 |
/* NB: -a / opt_a are ignored for backwards compatability */ |
850 |
if (mdb_getopts(argc, argv, |
|
851 |
'a', MDB_OPT_SETBITS, TRUE, &opt_a, |
|
852 |
'b', MDB_OPT_SETBITS, TRUE, &opt_b, |
|
853 |
'k', MDB_OPT_SETBITS, 10, &shift, |
|
854 |
'm', MDB_OPT_SETBITS, 20, &shift, |
|
855 |
'g', MDB_OPT_SETBITS, 30, &shift, |
|
856 |
NULL) != argc) |
|
3403 | 857 |
return (DCMD_USAGE); |
858 |
||
4787 | 859 |
if (!opt_b && !shift) |
860 |
shift = 20; |
|
3403 | 861 |
|
4787 | 862 |
switch (shift) { |
863 |
case 0: |
|
864 |
suffix = "B"; |
|
865 |
break; |
|
866 |
case 10: |
|
867 |
suffix = "KB"; |
|
868 |
break; |
|
869 |
case 20: |
|
870 |
suffix = "MB"; |
|
871 |
break; |
|
872 |
case 30: |
|
873 |
suffix = "GB"; |
|
874 |
break; |
|
875 |
default: |
|
876 |
suffix = "XX"; |
|
3403 | 877 |
} |
878 |
||
4787 | 879 |
for (i = 0; i < nstats; i++) { |
880 |
int j; |
|
881 |
boolean_t bytes = B_FALSE; |
|
3403 | 882 |
|
4787 | 883 |
for (j = 0; bytestats[j]; j++) { |
884 |
if (strcmp(stats[i].name, bytestats[j]) == 0) { |
|
885 |
bytes = B_TRUE; |
|
886 |
break; |
|
3403 | 887 |
} |
888 |
} |
|
889 |
||
4787 | 890 |
if (bytes) { |
891 |
mdb_printf("%-25s = %9llu %s\n", stats[i].name, |
|
892 |
stats[i].value.ui64 >> shift, suffix); |
|
893 |
} else { |
|
894 |
mdb_printf("%-25s = %9llu\n", stats[i].name, |
|
895 |
stats[i].value.ui64); |
|
3403 | 896 |
} |
897 |
} |
|
898 |
||
4787 | 899 |
for (i = 0; extras[i]; i++) { |
900 |
uint64_t buf; |
|
901 |
||
902 |
if (mdb_lookup_by_name(extras[i], &sym) == -1) { |
|
903 |
mdb_warn("failed to find '%s'", extras[i]); |
|
904 |
return (DCMD_ERR); |
|
905 |
} |
|
906 |
||
907 |
if (sym.st_size != sizeof (uint64_t) && |
|
908 |
sym.st_size != sizeof (uint32_t)) { |
|
909 |
mdb_warn("expected scalar for variable '%s'\n", |
|
910 |
extras[i]); |
|
911 |
return (DCMD_ERR); |
|
912 |
} |
|
3403 | 913 |
|
4787 | 914 |
if (mdb_vread(&buf, sym.st_size, sym.st_value) == -1) { |
915 |
mdb_warn("couldn't read '%s'", extras[i]); |
|
916 |
return (DCMD_ERR); |
|
917 |
} |
|
918 |
||
919 |
mdb_printf("%-25s = ", extras[i]); |
|
920 |
||
921 |
/* NB: all the 64-bit extras happen to be byte counts */ |
|
922 |
if (sym.st_size == sizeof (uint64_t)) |
|
923 |
mdb_printf("%9llu %s\n", buf >> shift, suffix); |
|
924 |
||
925 |
if (sym.st_size == sizeof (uint32_t)) |
|
926 |
mdb_printf("%9d\n", *((uint32_t *)&buf)); |
|
927 |
} |
|
3403 | 928 |
return (DCMD_OK); |
929 |
} |
|
930 |
||
789 | 931 |
/* |
932 |
* ::spa |
|
933 |
* |
|
934 |
* -c Print configuration information as well |
|
935 |
* -v Print vdev state |
|
936 |
* -e Print vdev error stats |
|
937 |
* |
|
938 |
* Print a summarized spa_t. When given no arguments, prints out a table of all |
|
939 |
* active pools on the system. |
|
940 |
*/ |
|
941 |
/* ARGSUSED */ |
|
942 |
static int |
|
943 |
spa_print(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) |
|
944 |
{ |
|
945 |
spa_t spa; |
|
946 |
const char *statetab[] = { "ACTIVE", "EXPORTED", "DESTROYED", |
|
7754
b80e4842ad54
6754011 SPA 3.0: lock breakup, i/o pipeline refactoring, device failure handling
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
7390
diff
changeset
|
947 |
"SPARE", "L2CACHE", "UNINIT", "UNAVAIL", "POTENTIAL" }; |
789 | 948 |
const char *state; |
949 |
int config = FALSE; |
|
950 |
int vdevs = FALSE; |
|
951 |
int errors = FALSE; |
|
952 |
||
953 |
if (mdb_getopts(argc, argv, |
|
954 |
'c', MDB_OPT_SETBITS, TRUE, &config, |
|
955 |
'v', MDB_OPT_SETBITS, TRUE, &vdevs, |
|
956 |
'e', MDB_OPT_SETBITS, TRUE, &errors, |
|
957 |
NULL) != argc) |
|
958 |
return (DCMD_USAGE); |
|
959 |
||
960 |
if (!(flags & DCMD_ADDRSPEC)) { |
|
961 |
if (mdb_walk_dcmd("spa", "spa", argc, argv) == -1) { |
|
962 |
mdb_warn("can't walk spa"); |
|
963 |
return (DCMD_ERR); |
|
964 |
} |
|
965 |
||
966 |
return (DCMD_OK); |
|
967 |
} |
|
968 |
||
969 |
if (flags & DCMD_PIPE_OUT) { |
|
970 |
mdb_printf("%#lr\n", addr); |
|
971 |
return (DCMD_OK); |
|
972 |
} |
|
973 |
||
974 |
if (DCMD_HDRSPEC(flags)) |
|
975 |
mdb_printf("%<u>%-?s %9s %-*s%</u>\n", "ADDR", "STATE", |
|
976 |
sizeof (uintptr_t) == 4 ? 60 : 52, "NAME"); |
|
977 |
||
978 |
if (mdb_vread(&spa, sizeof (spa), addr) == -1) { |
|
979 |
mdb_warn("failed to read spa_t at %p", addr); |
|
980 |
return (DCMD_ERR); |
|
981 |
} |
|
982 |
||
983 |
if (spa.spa_state < 0 || spa.spa_state > POOL_STATE_UNAVAIL) |
|
1544 | 984 |
state = "UNKNOWN"; |
789 | 985 |
else |
986 |
state = statetab[spa.spa_state]; |
|
987 |
||
7754
b80e4842ad54
6754011 SPA 3.0: lock breakup, i/o pipeline refactoring, device failure handling
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
7390
diff
changeset
|
988 |
mdb_printf("%0?p %9s %s\n", addr, state, spa.spa_name); |
789 | 989 |
|
990 |
if (config) { |
|
991 |
mdb_printf("\n"); |
|
992 |
mdb_inc_indent(4); |
|
993 |
if (mdb_call_dcmd("spa_config", addr, flags, 0, |
|
994 |
NULL) != DCMD_OK) |
|
995 |
return (DCMD_ERR); |
|
996 |
mdb_dec_indent(4); |
|
997 |
} |
|
998 |
||
999 |
if (vdevs || errors) { |
|
1000 |
mdb_arg_t v; |
|
1001 |
||
1002 |
v.a_type = MDB_TYPE_STRING; |
|
1003 |
v.a_un.a_str = "-e"; |
|
1004 |
||
1005 |
mdb_printf("\n"); |
|
1006 |
mdb_inc_indent(4); |
|
1007 |
if (mdb_call_dcmd("spa_vdevs", addr, flags, errors ? 1 : 0, |
|
1008 |
&v) != DCMD_OK) |
|
1009 |
return (DCMD_ERR); |
|
1010 |
mdb_dec_indent(4); |
|
1011 |
} |
|
1012 |
||
1013 |
return (DCMD_OK); |
|
1014 |
} |
|
1015 |
||
1016 |
/* |
|
1017 |
* ::spa_config |
|
1018 |
* |
|
1019 |
* Given a spa_t, print the configuration information stored in spa_config. |
|
1020 |
* Since it's just an nvlist, format it as an indented list of name=value pairs. |
|
1021 |
* We simply read the value of spa_config and pass off to ::nvlist. |
|
1022 |
*/ |
|
1023 |
/* ARGSUSED */ |
|
1024 |
static int |
|
1025 |
spa_print_config(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) |
|
1026 |
{ |
|
1027 |
spa_t spa; |
|
1028 |
||
1029 |
if (argc != 0 || !(flags & DCMD_ADDRSPEC)) |
|
1030 |
return (DCMD_USAGE); |
|
1031 |
||
1032 |
if (mdb_vread(&spa, sizeof (spa), addr) == -1) { |
|
1033 |
mdb_warn("failed to read spa_t at %p", addr); |
|
1034 |
return (DCMD_ERR); |
|
1035 |
} |
|
1036 |
||
1037 |
if (spa.spa_config == NULL) { |
|
1038 |
mdb_printf("(none)\n"); |
|
1039 |
return (DCMD_OK); |
|
1040 |
} |
|
1041 |
||
1042 |
return (mdb_call_dcmd("nvlist", (uintptr_t)spa.spa_config, flags, |
|
1043 |
0, NULL)); |
|
1044 |
} |
|
1045 |
||
1046 |
/* |
|
1047 |
* ::vdev |
|
1048 |
* |
|
1049 |
* Print out a summarized vdev_t, in the following form: |
|
1050 |
* |
|
1051 |
* ADDR STATE AUX DESC |
|
1052 |
* fffffffbcde23df0 HEALTHY - /dev/dsk/c0t0d0 |
|
1053 |
* |
|
1054 |
* If '-r' is specified, recursively visit all children. |
|
1055 |
* |
|
1056 |
* With '-e', the statistics associated with the vdev are printed as well. |
|
1057 |
*/ |
|
1058 |
static int |
|
3059 | 1059 |
do_print_vdev(uintptr_t addr, int flags, int depth, int stats, |
789 | 1060 |
int recursive) |
1061 |
{ |
|
1062 |
vdev_t vdev; |
|
1063 |
char desc[MAXNAMELEN]; |
|
1064 |
int c, children; |
|
1065 |
uintptr_t *child; |
|
1066 |
const char *state, *aux; |
|
1067 |
||
1068 |
if (mdb_vread(&vdev, sizeof (vdev), (uintptr_t)addr) == -1) { |
|
1069 |
mdb_warn("failed to read vdev_t at %p\n", (uintptr_t)addr); |
|
1070 |
return (DCMD_ERR); |
|
1071 |
} |
|
1072 |
||
1073 |
if (flags & DCMD_PIPE_OUT) { |
|
1074 |
mdb_printf("%#lr", addr); |
|
1075 |
} else { |
|
1076 |
if (vdev.vdev_path != NULL) { |
|
1077 |
if (mdb_readstr(desc, sizeof (desc), |
|
1078 |
(uintptr_t)vdev.vdev_path) == -1) { |
|
1079 |
mdb_warn("failed to read vdev_path at %p\n", |
|
1080 |
vdev.vdev_path); |
|
1081 |
return (DCMD_ERR); |
|
1082 |
} |
|
1083 |
} else if (vdev.vdev_ops != NULL) { |
|
1084 |
vdev_ops_t ops; |
|
1085 |
if (mdb_vread(&ops, sizeof (ops), |
|
1086 |
(uintptr_t)vdev.vdev_ops) == -1) { |
|
1087 |
mdb_warn("failed to read vdev_ops at %p\n", |
|
1088 |
vdev.vdev_ops); |
|
1089 |
return (DCMD_ERR); |
|
1090 |
} |
|
1091 |
(void) strcpy(desc, ops.vdev_op_type); |
|
1092 |
} else { |
|
1093 |
(void) strcpy(desc, "<unknown>"); |
|
1094 |
} |
|
1095 |
||
1096 |
if (depth == 0 && DCMD_HDRSPEC(flags)) |
|
1097 |
mdb_printf("%<u>%-?s %-9s %-12s %-*s%</u>\n", |
|
1098 |
"ADDR", "STATE", "AUX", |
|
1099 |
sizeof (uintptr_t) == 4 ? 43 : 35, |
|
1100 |
"DESCRIPTION"); |
|
1101 |
||
1102 |
mdb_printf("%0?p ", addr); |
|
1103 |
||
1104 |
switch (vdev.vdev_state) { |
|
1105 |
case VDEV_STATE_CLOSED: |
|
4055 | 1106 |
state = "CLOSED"; |
1107 |
break; |
|
789 | 1108 |
case VDEV_STATE_OFFLINE: |
4055 | 1109 |
state = "OFFLINE"; |
1110 |
break; |
|
789 | 1111 |
case VDEV_STATE_CANT_OPEN: |
4055 | 1112 |
state = "CANT_OPEN"; |
1113 |
break; |
|
789 | 1114 |
case VDEV_STATE_DEGRADED: |
4055 | 1115 |
state = "DEGRADED"; |
1116 |
break; |
|
789 | 1117 |
case VDEV_STATE_HEALTHY: |
4055 | 1118 |
state = "HEALTHY"; |
1119 |
break; |
|
4451 | 1120 |
case VDEV_STATE_REMOVED: |
1121 |
state = "REMOVED"; |
|
1122 |
break; |
|
1123 |
case VDEV_STATE_FAULTED: |
|
1124 |
state = "FAULTED"; |
|
1125 |
break; |
|
789 | 1126 |
default: |
4055 | 1127 |
state = "UNKNOWN"; |
1128 |
break; |
|
789 | 1129 |
} |
1130 |
||
1131 |
switch (vdev.vdev_stat.vs_aux) { |
|
1132 |
case VDEV_AUX_NONE: |
|
1133 |
aux = "-"; |
|
1134 |
break; |
|
1135 |
case VDEV_AUX_OPEN_FAILED: |
|
1136 |
aux = "OPEN_FAILED"; |
|
1137 |
break; |
|
1138 |
case VDEV_AUX_CORRUPT_DATA: |
|
1139 |
aux = "CORRUPT_DATA"; |
|
1140 |
break; |
|
1141 |
case VDEV_AUX_NO_REPLICAS: |
|
1142 |
aux = "NO_REPLICAS"; |
|
1143 |
break; |
|
1144 |
case VDEV_AUX_BAD_GUID_SUM: |
|
1145 |
aux = "BAD_GUID_SUM"; |
|
1146 |
break; |
|
1147 |
case VDEV_AUX_TOO_SMALL: |
|
1148 |
aux = "TOO_SMALL"; |
|
1149 |
break; |
|
1150 |
case VDEV_AUX_BAD_LABEL: |
|
1151 |
aux = "BAD_LABEL"; |
|
1152 |
break; |
|
7294 | 1153 |
case VDEV_AUX_VERSION_NEWER: |
1154 |
aux = "VERS_NEWER"; |
|
1155 |
break; |
|
1156 |
case VDEV_AUX_VERSION_OLDER: |
|
1157 |
aux = "VERS_OLDER"; |
|
1158 |
break; |
|
1159 |
case VDEV_AUX_SPARED: |
|
1160 |
aux = "SPARED"; |
|
1161 |
break; |
|
1162 |
case VDEV_AUX_ERR_EXCEEDED: |
|
1163 |
aux = "ERR_EXCEEDED"; |
|
1164 |
break; |
|
1165 |
case VDEV_AUX_IO_FAILURE: |
|
1166 |
aux = "IO_FAILURE"; |
|
1167 |
break; |
|
1168 |
case VDEV_AUX_BAD_LOG: |
|
1169 |
aux = "BAD_LOG"; |
|
1170 |
break; |
|
11422
42768837421d
PSARC/2009/511 zpool split
Mark J Musante <Mark.Musante@Sun.COM>
parents:
11147
diff
changeset
|
1171 |
case VDEV_AUX_EXTERNAL: |
42768837421d
PSARC/2009/511 zpool split
Mark J Musante <Mark.Musante@Sun.COM>
parents:
11147
diff
changeset
|
1172 |
aux = "EXTERNAL"; |
42768837421d
PSARC/2009/511 zpool split
Mark J Musante <Mark.Musante@Sun.COM>
parents:
11147
diff
changeset
|
1173 |
break; |
42768837421d
PSARC/2009/511 zpool split
Mark J Musante <Mark.Musante@Sun.COM>
parents:
11147
diff
changeset
|
1174 |
case VDEV_AUX_SPLIT_POOL: |
42768837421d
PSARC/2009/511 zpool split
Mark J Musante <Mark.Musante@Sun.COM>
parents:
11147
diff
changeset
|
1175 |
aux = "SPLIT_POOL"; |
42768837421d
PSARC/2009/511 zpool split
Mark J Musante <Mark.Musante@Sun.COM>
parents:
11147
diff
changeset
|
1176 |
break; |
789 | 1177 |
default: |
1178 |
aux = "UNKNOWN"; |
|
1179 |
break; |
|
1180 |
} |
|
1181 |
||
1182 |
mdb_printf("%-9s %-12s %*s%s\n", state, aux, depth, "", desc); |
|
1183 |
||
1184 |
if (stats) { |
|
1185 |
vdev_stat_t *vs = &vdev.vdev_stat; |
|
1186 |
int i; |
|
1187 |
||
1188 |
mdb_inc_indent(4); |
|
1189 |
mdb_printf("\n"); |
|
1190 |
mdb_printf("%<u> %12s %12s %12s %12s " |
|
1191 |
"%12s%</u>\n", "READ", "WRITE", "FREE", "CLAIM", |
|
1192 |
"IOCTL"); |
|
1193 |
mdb_printf("OPS "); |
|
1194 |
for (i = 1; i < ZIO_TYPES; i++) |
|
1195 |
mdb_printf("%11#llx%s", vs->vs_ops[i], |
|
1196 |
i == ZIO_TYPES - 1 ? "" : " "); |
|
1197 |
mdb_printf("\n"); |
|
1198 |
mdb_printf("BYTES "); |
|
1199 |
for (i = 1; i < ZIO_TYPES; i++) |
|
1200 |
mdb_printf("%11#llx%s", vs->vs_bytes[i], |
|
1201 |
i == ZIO_TYPES - 1 ? "" : " "); |
|
1202 |
||
1203 |
||
1204 |
mdb_printf("\n"); |
|
1205 |
mdb_printf("EREAD %10#llx\n", vs->vs_read_errors); |
|
1206 |
mdb_printf("EWRITE %10#llx\n", vs->vs_write_errors); |
|
1207 |
mdb_printf("ECKSUM %10#llx\n", |
|
1208 |
vs->vs_checksum_errors); |
|
1209 |
mdb_dec_indent(4); |
|
1210 |
} |
|
1211 |
||
3059 | 1212 |
if (stats) |
789 | 1213 |
mdb_printf("\n"); |
1214 |
} |
|
1215 |
||
1216 |
children = vdev.vdev_children; |
|
1217 |
||
1218 |
if (children == 0 || !recursive) |
|
1219 |
return (DCMD_OK); |
|
1220 |
||
1221 |
child = mdb_alloc(children * sizeof (void *), UM_SLEEP | UM_GC); |
|
1222 |
if (mdb_vread(child, children * sizeof (void *), |
|
1223 |
(uintptr_t)vdev.vdev_child) == -1) { |
|
1224 |
mdb_warn("failed to read vdev children at %p", vdev.vdev_child); |
|
1225 |
return (DCMD_ERR); |
|
1226 |
} |
|
1227 |
||
1228 |
for (c = 0; c < children; c++) { |
|
3059 | 1229 |
if (do_print_vdev(child[c], flags, depth + 2, stats, |
789 | 1230 |
recursive)) |
1231 |
return (DCMD_ERR); |
|
1232 |
} |
|
1233 |
||
1234 |
return (DCMD_OK); |
|
1235 |
} |
|
1236 |
||
1237 |
static int |
|
1238 |
vdev_print(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) |
|
1239 |
{ |
|
1240 |
int recursive = FALSE; |
|
1241 |
int stats = FALSE; |
|
6643
3a34b0dbb107
6625086 changing cachefile doesn't remove old cache on last user
eschrock
parents:
6245
diff
changeset
|
1242 |
uint64_t depth = 0; |
789 | 1243 |
|
1244 |
if (mdb_getopts(argc, argv, |
|
1245 |
'r', MDB_OPT_SETBITS, TRUE, &recursive, |
|
1246 |
'e', MDB_OPT_SETBITS, TRUE, &stats, |
|
6643
3a34b0dbb107
6625086 changing cachefile doesn't remove old cache on last user
eschrock
parents:
6245
diff
changeset
|
1247 |
'd', MDB_OPT_UINT64, &depth, |
789 | 1248 |
NULL) != argc) |
1249 |
return (DCMD_USAGE); |
|
1250 |
||
1251 |
if (!(flags & DCMD_ADDRSPEC)) { |
|
1252 |
mdb_warn("no vdev_t address given\n"); |
|
1253 |
return (DCMD_ERR); |
|
1254 |
} |
|
1255 |
||
6643
3a34b0dbb107
6625086 changing cachefile doesn't remove old cache on last user
eschrock
parents:
6245
diff
changeset
|
1256 |
return (do_print_vdev(addr, flags, (int)depth, stats, recursive)); |
789 | 1257 |
} |
1258 |
||
2459
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1259 |
typedef struct metaslab_walk_data { |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1260 |
uint64_t mw_numvdevs; |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1261 |
uintptr_t *mw_vdevs; |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1262 |
int mw_curvdev; |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1263 |
uint64_t mw_nummss; |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1264 |
uintptr_t *mw_mss; |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1265 |
int mw_curms; |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1266 |
} metaslab_walk_data_t; |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1267 |
|
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1268 |
static int |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1269 |
metaslab_walk_step(mdb_walk_state_t *wsp) |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1270 |
{ |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1271 |
metaslab_walk_data_t *mw = wsp->walk_data; |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1272 |
metaslab_t ms; |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1273 |
uintptr_t msp; |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1274 |
|
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1275 |
if (mw->mw_curvdev >= mw->mw_numvdevs) |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1276 |
return (WALK_DONE); |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1277 |
|
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1278 |
if (mw->mw_mss == NULL) { |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1279 |
uintptr_t mssp; |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1280 |
uintptr_t vdevp; |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1281 |
|
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1282 |
ASSERT(mw->mw_curms == 0); |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1283 |
ASSERT(mw->mw_nummss == 0); |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1284 |
|
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1285 |
vdevp = mw->mw_vdevs[mw->mw_curvdev]; |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1286 |
if (GETMEMB(vdevp, struct vdev, vdev_ms, mssp) || |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1287 |
GETMEMB(vdevp, struct vdev, vdev_ms_count, mw->mw_nummss)) { |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1288 |
return (WALK_ERR); |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1289 |
} |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1290 |
|
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1291 |
mw->mw_mss = mdb_alloc(mw->mw_nummss * sizeof (void*), |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1292 |
UM_SLEEP | UM_GC); |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1293 |
if (mdb_vread(mw->mw_mss, mw->mw_nummss * sizeof (void*), |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1294 |
mssp) == -1) { |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1295 |
mdb_warn("failed to read vdev_ms at %p", mssp); |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1296 |
return (WALK_ERR); |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1297 |
} |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1298 |
} |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1299 |
|
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1300 |
if (mw->mw_curms >= mw->mw_nummss) { |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1301 |
mw->mw_mss = NULL; |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1302 |
mw->mw_curms = 0; |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1303 |
mw->mw_nummss = 0; |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1304 |
mw->mw_curvdev++; |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1305 |
return (WALK_NEXT); |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1306 |
} |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1307 |
|
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1308 |
msp = mw->mw_mss[mw->mw_curms]; |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1309 |
if (mdb_vread(&ms, sizeof (metaslab_t), msp) == -1) { |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1310 |
mdb_warn("failed to read metaslab_t at %p", msp); |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1311 |
return (WALK_ERR); |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1312 |
} |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1313 |
|
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1314 |
mw->mw_curms++; |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1315 |
|
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1316 |
return (wsp->walk_callback(msp, &ms, wsp->walk_cbdata)); |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1317 |
} |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1318 |
|
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1319 |
/* ARGSUSED */ |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1320 |
static int |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1321 |
metaslab_walk_init(mdb_walk_state_t *wsp) |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1322 |
{ |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1323 |
metaslab_walk_data_t *mw; |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1324 |
uintptr_t root_vdevp; |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1325 |
uintptr_t childp; |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1326 |
|
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1327 |
if (wsp->walk_addr == NULL) { |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1328 |
mdb_warn("must supply address of spa_t\n"); |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1329 |
return (WALK_ERR); |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1330 |
} |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1331 |
|
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1332 |
mw = mdb_zalloc(sizeof (metaslab_walk_data_t), UM_SLEEP | UM_GC); |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1333 |
|
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1334 |
if (GETMEMB(wsp->walk_addr, struct spa, spa_root_vdev, root_vdevp) || |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1335 |
GETMEMB(root_vdevp, struct vdev, vdev_children, mw->mw_numvdevs) || |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1336 |
GETMEMB(root_vdevp, struct vdev, vdev_child, childp)) { |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1337 |
return (DCMD_ERR); |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1338 |
} |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1339 |
|
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1340 |
mw->mw_vdevs = mdb_alloc(mw->mw_numvdevs * sizeof (void *), |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1341 |
UM_SLEEP | UM_GC); |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1342 |
if (mdb_vread(mw->mw_vdevs, mw->mw_numvdevs * sizeof (void *), |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1343 |
childp) == -1) { |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1344 |
mdb_warn("failed to read root vdev children at %p", childp); |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1345 |
return (DCMD_ERR); |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1346 |
} |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1347 |
|
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1348 |
wsp->walk_data = mw; |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1349 |
|
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1350 |
return (WALK_NEXT); |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1351 |
} |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1352 |
|
789 | 1353 |
typedef struct mdb_spa { |
1354 |
uintptr_t spa_dsl_pool; |
|
1355 |
uintptr_t spa_root_vdev; |
|
1356 |
} mdb_spa_t; |
|
1357 |
||
1358 |
typedef struct mdb_dsl_dir { |
|
1359 |
uintptr_t dd_phys; |
|
1360 |
int64_t dd_space_towrite[TXG_SIZE]; |
|
1361 |
} mdb_dsl_dir_t; |
|
1362 |
||
1363 |
typedef struct mdb_dsl_dir_phys { |
|
1364 |
uint64_t dd_used_bytes; |
|
1365 |
uint64_t dd_compressed_bytes; |
|
1366 |
uint64_t dd_uncompressed_bytes; |
|
1367 |
} mdb_dsl_dir_phys_t; |
|
1368 |
||
1369 |
typedef struct mdb_vdev { |
|
1370 |
uintptr_t vdev_parent; |
|
1371 |
uintptr_t vdev_ms; |
|
1372 |
uint64_t vdev_ms_count; |
|
1373 |
vdev_stat_t vdev_stat; |
|
1374 |
} mdb_vdev_t; |
|
1375 |
||
1376 |
typedef struct mdb_metaslab { |
|
1377 |
space_map_t ms_allocmap[TXG_SIZE]; |
|
1378 |
space_map_t ms_freemap[TXG_SIZE]; |
|
1379 |
space_map_t ms_map; |
|
1732 | 1380 |
space_map_obj_t ms_smo; |
2459
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1381 |
space_map_obj_t ms_smo_syncing; |
789 | 1382 |
} mdb_metaslab_t; |
1383 |
||
2459
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1384 |
typedef struct space_data { |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1385 |
uint64_t ms_allocmap[TXG_SIZE]; |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1386 |
uint64_t ms_freemap[TXG_SIZE]; |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1387 |
uint64_t ms_map; |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1388 |
uint64_t avail; |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1389 |
uint64_t nowavail; |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1390 |
} space_data_t; |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1391 |
|
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1392 |
/* ARGSUSED */ |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1393 |
static int |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1394 |
space_cb(uintptr_t addr, const void *unknown, void *arg) |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1395 |
{ |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1396 |
space_data_t *sd = arg; |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1397 |
mdb_metaslab_t ms; |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1398 |
|
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1399 |
if (GETMEMB(addr, struct metaslab, ms_allocmap, ms.ms_allocmap) || |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1400 |
GETMEMB(addr, struct metaslab, ms_freemap, ms.ms_freemap) || |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1401 |
GETMEMB(addr, struct metaslab, ms_map, ms.ms_map) || |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1402 |
GETMEMB(addr, struct metaslab, ms_smo, ms.ms_smo) || |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1403 |
GETMEMB(addr, struct metaslab, ms_smo_syncing, ms.ms_smo_syncing)) { |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1404 |
return (WALK_ERR); |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1405 |
} |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1406 |
|
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1407 |
sd->ms_allocmap[0] += ms.ms_allocmap[0].sm_space; |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1408 |
sd->ms_allocmap[1] += ms.ms_allocmap[1].sm_space; |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1409 |
sd->ms_allocmap[2] += ms.ms_allocmap[2].sm_space; |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1410 |
sd->ms_allocmap[3] += ms.ms_allocmap[3].sm_space; |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1411 |
sd->ms_freemap[0] += ms.ms_freemap[0].sm_space; |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1412 |
sd->ms_freemap[1] += ms.ms_freemap[1].sm_space; |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1413 |
sd->ms_freemap[2] += ms.ms_freemap[2].sm_space; |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1414 |
sd->ms_freemap[3] += ms.ms_freemap[3].sm_space; |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1415 |
sd->ms_map += ms.ms_map.sm_space; |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1416 |
sd->avail += ms.ms_map.sm_size - ms.ms_smo.smo_alloc; |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1417 |
sd->nowavail += ms.ms_map.sm_size - ms.ms_smo_syncing.smo_alloc; |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1418 |
|
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1419 |
return (WALK_NEXT); |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1420 |
} |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1421 |
|
789 | 1422 |
/* |
1423 |
* ::spa_space [-b] |
|
1424 |
* |
|
1425 |
* Given a spa_t, print out it's on-disk space usage and in-core |
|
1426 |
* estimates of future usage. If -b is given, print space in bytes. |
|
1427 |
* Otherwise print in megabytes. |
|
1428 |
*/ |
|
1429 |
/* ARGSUSED */ |
|
1430 |
static int |
|
1431 |
spa_space(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) |
|
1432 |
{ |
|
1433 |
mdb_spa_t spa; |
|
1434 |
uintptr_t dp_root_dir; |
|
1435 |
mdb_dsl_dir_t dd; |
|
1436 |
mdb_dsl_dir_phys_t dsp; |
|
1437 |
uint64_t children; |
|
1438 |
uintptr_t childaddr; |
|
2459
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1439 |
space_data_t sd; |
789 | 1440 |
int shift = 20; |
1441 |
char *suffix = "M"; |
|
1442 |
int bits = FALSE; |
|
1443 |
||
1444 |
if (mdb_getopts(argc, argv, 'b', MDB_OPT_SETBITS, TRUE, &bits, NULL) != |
|
1445 |
argc) |
|
1446 |
return (DCMD_USAGE); |
|
1447 |
if (!(flags & DCMD_ADDRSPEC)) |
|
1448 |
return (DCMD_USAGE); |
|
1449 |
||
1450 |
if (bits) { |
|
1451 |
shift = 0; |
|
1452 |
suffix = ""; |
|
1453 |
} |
|
1454 |
||
1455 |
if (GETMEMB(addr, struct spa, spa_dsl_pool, spa.spa_dsl_pool) || |
|
1456 |
GETMEMB(addr, struct spa, spa_root_vdev, spa.spa_root_vdev) || |
|
1457 |
GETMEMB(spa.spa_root_vdev, struct vdev, vdev_children, children) || |
|
1458 |
GETMEMB(spa.spa_root_vdev, struct vdev, vdev_child, childaddr) || |
|
1459 |
GETMEMB(spa.spa_dsl_pool, struct dsl_pool, |
|
1460 |
dp_root_dir, dp_root_dir) || |
|
1461 |
GETMEMB(dp_root_dir, struct dsl_dir, dd_phys, dd.dd_phys) || |
|
1462 |
GETMEMB(dp_root_dir, struct dsl_dir, |
|
1463 |
dd_space_towrite, dd.dd_space_towrite) || |
|
1464 |
GETMEMB(dd.dd_phys, struct dsl_dir_phys, |
|
2459
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1465 |
dd_used_bytes, dsp.dd_used_bytes) || |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1466 |
GETMEMB(dd.dd_phys, struct dsl_dir_phys, |
789 | 1467 |
dd_compressed_bytes, dsp.dd_compressed_bytes) || |
1468 |
GETMEMB(dd.dd_phys, struct dsl_dir_phys, |
|
1469 |
dd_uncompressed_bytes, dsp.dd_uncompressed_bytes)) { |
|
1470 |
return (DCMD_ERR); |
|
1471 |
} |
|
1472 |
||
1473 |
mdb_printf("dd_space_towrite = %llu%s %llu%s %llu%s %llu%s\n", |
|
1474 |
dd.dd_space_towrite[0] >> shift, suffix, |
|
1475 |
dd.dd_space_towrite[1] >> shift, suffix, |
|
1476 |
dd.dd_space_towrite[2] >> shift, suffix, |
|
1477 |
dd.dd_space_towrite[3] >> shift, suffix); |
|
1478 |
||
1479 |
mdb_printf("dd_phys.dd_used_bytes = %llu%s\n", |
|
1480 |
dsp.dd_used_bytes >> shift, suffix); |
|
2459
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1481 |
mdb_printf("dd_phys.dd_compressed_bytes = %llu%s\n", |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1482 |
dsp.dd_compressed_bytes >> shift, suffix); |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1483 |
mdb_printf("dd_phys.dd_uncompressed_bytes = %llu%s\n", |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1484 |
dsp.dd_uncompressed_bytes >> shift, suffix); |
789 | 1485 |
|
2459
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1486 |
bzero(&sd, sizeof (sd)); |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1487 |
if (mdb_pwalk("metaslab", space_cb, &sd, addr) != 0) { |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1488 |
mdb_warn("can't walk metaslabs"); |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1489 |
return (DCMD_ERR); |
789 | 1490 |
} |
1491 |
||
1492 |
mdb_printf("ms_allocmap = %llu%s %llu%s %llu%s %llu%s\n", |
|
2459
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1493 |
sd.ms_allocmap[0] >> shift, suffix, |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1494 |
sd.ms_allocmap[1] >> shift, suffix, |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1495 |
sd.ms_allocmap[2] >> shift, suffix, |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1496 |
sd.ms_allocmap[3] >> shift, suffix); |
789 | 1497 |
mdb_printf("ms_freemap = %llu%s %llu%s %llu%s %llu%s\n", |
2459
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1498 |
sd.ms_freemap[0] >> shift, suffix, |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1499 |
sd.ms_freemap[1] >> shift, suffix, |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1500 |
sd.ms_freemap[2] >> shift, suffix, |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1501 |
sd.ms_freemap[3] >> shift, suffix); |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1502 |
mdb_printf("ms_map = %llu%s\n", sd.ms_map >> shift, suffix); |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1503 |
mdb_printf("last synced avail = %llu%s\n", sd.avail >> shift, suffix); |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1504 |
mdb_printf("current syncing avail = %llu%s\n", |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1505 |
sd.nowavail >> shift, suffix); |
789 | 1506 |
|
1507 |
return (DCMD_OK); |
|
1508 |
} |
|
1509 |
||
1510 |
/* |
|
1511 |
* ::spa_verify |
|
1512 |
* |
|
1513 |
* Given a spa_t, verify that that the pool is self-consistent. |
|
1514 |
* Currently, it only checks to make sure that the vdev tree exists. |
|
1515 |
*/ |
|
1516 |
/* ARGSUSED */ |
|
1517 |
static int |
|
1518 |
spa_verify(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) |
|
1519 |
{ |
|
1520 |
spa_t spa; |
|
1521 |
||
1522 |
if (argc != 0 || !(flags & DCMD_ADDRSPEC)) |
|
1523 |
return (DCMD_USAGE); |
|
1524 |
||
1525 |
if (mdb_vread(&spa, sizeof (spa), addr) == -1) { |
|
1526 |
mdb_warn("failed to read spa_t at %p", addr); |
|
1527 |
return (DCMD_ERR); |
|
1528 |
} |
|
1529 |
||
1530 |
if (spa.spa_root_vdev == NULL) { |
|
1531 |
mdb_printf("no vdev tree present\n"); |
|
1532 |
return (DCMD_OK); |
|
1533 |
} |
|
1534 |
||
1535 |
return (DCMD_OK); |
|
1536 |
} |
|
1537 |
||
8341
53c5e7987263
6783576 ::spa -v should include spares
Eric Schrock <Eric.Schrock@Sun.COM>
parents:
7846
diff
changeset
|
1538 |
static int |
53c5e7987263
6783576 ::spa -v should include spares
Eric Schrock <Eric.Schrock@Sun.COM>
parents:
7846
diff
changeset
|
1539 |
spa_print_aux(spa_aux_vdev_t *sav, uint_t flags, mdb_arg_t *v, |
53c5e7987263
6783576 ::spa -v should include spares
Eric Schrock <Eric.Schrock@Sun.COM>
parents:
7846
diff
changeset
|
1540 |
const char *name) |
53c5e7987263
6783576 ::spa -v should include spares
Eric Schrock <Eric.Schrock@Sun.COM>
parents:
7846
diff
changeset
|
1541 |
{ |
53c5e7987263
6783576 ::spa -v should include spares
Eric Schrock <Eric.Schrock@Sun.COM>
parents:
7846
diff
changeset
|
1542 |
uintptr_t *aux; |
53c5e7987263
6783576 ::spa -v should include spares
Eric Schrock <Eric.Schrock@Sun.COM>
parents:
7846
diff
changeset
|
1543 |
size_t len; |
53c5e7987263
6783576 ::spa -v should include spares
Eric Schrock <Eric.Schrock@Sun.COM>
parents:
7846
diff
changeset
|
1544 |
int ret, i; |
53c5e7987263
6783576 ::spa -v should include spares
Eric Schrock <Eric.Schrock@Sun.COM>
parents:
7846
diff
changeset
|
1545 |
|
53c5e7987263
6783576 ::spa -v should include spares
Eric Schrock <Eric.Schrock@Sun.COM>
parents:
7846
diff
changeset
|
1546 |
/* |
53c5e7987263
6783576 ::spa -v should include spares
Eric Schrock <Eric.Schrock@Sun.COM>
parents:
7846
diff
changeset
|
1547 |
* Iterate over aux vdevs and print those out as well. This is a |
53c5e7987263
6783576 ::spa -v should include spares
Eric Schrock <Eric.Schrock@Sun.COM>
parents:
7846
diff
changeset
|
1548 |
* little annoying because we don't have a root vdev to pass to ::vdev. |
53c5e7987263
6783576 ::spa -v should include spares
Eric Schrock <Eric.Schrock@Sun.COM>
parents:
7846
diff
changeset
|
1549 |
* Instead, we print a single line and then call it for each child |
53c5e7987263
6783576 ::spa -v should include spares
Eric Schrock <Eric.Schrock@Sun.COM>
parents:
7846
diff
changeset
|
1550 |
* vdev. |
53c5e7987263
6783576 ::spa -v should include spares
Eric Schrock <Eric.Schrock@Sun.COM>
parents:
7846
diff
changeset
|
1551 |
*/ |
53c5e7987263
6783576 ::spa -v should include spares
Eric Schrock <Eric.Schrock@Sun.COM>
parents:
7846
diff
changeset
|
1552 |
if (sav->sav_count != 0) { |
53c5e7987263
6783576 ::spa -v should include spares
Eric Schrock <Eric.Schrock@Sun.COM>
parents:
7846
diff
changeset
|
1553 |
v[1].a_type = MDB_TYPE_STRING; |
53c5e7987263
6783576 ::spa -v should include spares
Eric Schrock <Eric.Schrock@Sun.COM>
parents:
7846
diff
changeset
|
1554 |
v[1].a_un.a_str = "-d"; |
53c5e7987263
6783576 ::spa -v should include spares
Eric Schrock <Eric.Schrock@Sun.COM>
parents:
7846
diff
changeset
|
1555 |
v[2].a_type = MDB_TYPE_IMMEDIATE; |
53c5e7987263
6783576 ::spa -v should include spares
Eric Schrock <Eric.Schrock@Sun.COM>
parents:
7846
diff
changeset
|
1556 |
v[2].a_un.a_val = 2; |
53c5e7987263
6783576 ::spa -v should include spares
Eric Schrock <Eric.Schrock@Sun.COM>
parents:
7846
diff
changeset
|
1557 |
|
53c5e7987263
6783576 ::spa -v should include spares
Eric Schrock <Eric.Schrock@Sun.COM>
parents:
7846
diff
changeset
|
1558 |
len = sav->sav_count * sizeof (uintptr_t); |
53c5e7987263
6783576 ::spa -v should include spares
Eric Schrock <Eric.Schrock@Sun.COM>
parents:
7846
diff
changeset
|
1559 |
aux = mdb_alloc(len, UM_SLEEP); |
53c5e7987263
6783576 ::spa -v should include spares
Eric Schrock <Eric.Schrock@Sun.COM>
parents:
7846
diff
changeset
|
1560 |
if (mdb_vread(aux, len, |
53c5e7987263
6783576 ::spa -v should include spares
Eric Schrock <Eric.Schrock@Sun.COM>
parents:
7846
diff
changeset
|
1561 |
(uintptr_t)sav->sav_vdevs) == -1) { |
53c5e7987263
6783576 ::spa -v should include spares
Eric Schrock <Eric.Schrock@Sun.COM>
parents:
7846
diff
changeset
|
1562 |
mdb_free(aux, len); |
53c5e7987263
6783576 ::spa -v should include spares
Eric Schrock <Eric.Schrock@Sun.COM>
parents:
7846
diff
changeset
|
1563 |
mdb_warn("failed to read l2cache vdevs at %p", |
53c5e7987263
6783576 ::spa -v should include spares
Eric Schrock <Eric.Schrock@Sun.COM>
parents:
7846
diff
changeset
|
1564 |
sav->sav_vdevs); |
53c5e7987263
6783576 ::spa -v should include spares
Eric Schrock <Eric.Schrock@Sun.COM>
parents:
7846
diff
changeset
|
1565 |
return (DCMD_ERR); |
53c5e7987263
6783576 ::spa -v should include spares
Eric Schrock <Eric.Schrock@Sun.COM>
parents:
7846
diff
changeset
|
1566 |
} |
53c5e7987263
6783576 ::spa -v should include spares
Eric Schrock <Eric.Schrock@Sun.COM>
parents:
7846
diff
changeset
|
1567 |
|
53c5e7987263
6783576 ::spa -v should include spares
Eric Schrock <Eric.Schrock@Sun.COM>
parents:
7846
diff
changeset
|
1568 |
mdb_printf("%-?s %-9s %-12s %s\n", "-", "-", "-", name); |
53c5e7987263
6783576 ::spa -v should include spares
Eric Schrock <Eric.Schrock@Sun.COM>
parents:
7846
diff
changeset
|
1569 |
|
53c5e7987263
6783576 ::spa -v should include spares
Eric Schrock <Eric.Schrock@Sun.COM>
parents:
7846
diff
changeset
|
1570 |
for (i = 0; i < sav->sav_count; i++) { |
53c5e7987263
6783576 ::spa -v should include spares
Eric Schrock <Eric.Schrock@Sun.COM>
parents:
7846
diff
changeset
|
1571 |
ret = mdb_call_dcmd("vdev", aux[i], flags, 3, v); |
53c5e7987263
6783576 ::spa -v should include spares
Eric Schrock <Eric.Schrock@Sun.COM>
parents:
7846
diff
changeset
|
1572 |
if (ret != DCMD_OK) { |
53c5e7987263
6783576 ::spa -v should include spares
Eric Schrock <Eric.Schrock@Sun.COM>
parents:
7846
diff
changeset
|
1573 |
mdb_free(aux, len); |
53c5e7987263
6783576 ::spa -v should include spares
Eric Schrock <Eric.Schrock@Sun.COM>
parents:
7846
diff
changeset
|
1574 |
return (ret); |
53c5e7987263
6783576 ::spa -v should include spares
Eric Schrock <Eric.Schrock@Sun.COM>
parents:
7846
diff
changeset
|
1575 |
} |
53c5e7987263
6783576 ::spa -v should include spares
Eric Schrock <Eric.Schrock@Sun.COM>
parents:
7846
diff
changeset
|
1576 |
} |
53c5e7987263
6783576 ::spa -v should include spares
Eric Schrock <Eric.Schrock@Sun.COM>
parents:
7846
diff
changeset
|
1577 |
|
53c5e7987263
6783576 ::spa -v should include spares
Eric Schrock <Eric.Schrock@Sun.COM>
parents:
7846
diff
changeset
|
1578 |
mdb_free(aux, len); |
53c5e7987263
6783576 ::spa -v should include spares
Eric Schrock <Eric.Schrock@Sun.COM>
parents:
7846
diff
changeset
|
1579 |
} |
53c5e7987263
6783576 ::spa -v should include spares
Eric Schrock <Eric.Schrock@Sun.COM>
parents:
7846
diff
changeset
|
1580 |
|
53c5e7987263
6783576 ::spa -v should include spares
Eric Schrock <Eric.Schrock@Sun.COM>
parents:
7846
diff
changeset
|
1581 |
return (0); |
53c5e7987263
6783576 ::spa -v should include spares
Eric Schrock <Eric.Schrock@Sun.COM>
parents:
7846
diff
changeset
|
1582 |
} |
53c5e7987263
6783576 ::spa -v should include spares
Eric Schrock <Eric.Schrock@Sun.COM>
parents:
7846
diff
changeset
|
1583 |
|
789 | 1584 |
/* |
1585 |
* ::spa_vdevs |
|
1586 |
* |
|
1587 |
* -e Include error stats |
|
1588 |
* |
|
1589 |
* Print out a summarized list of vdevs for the given spa_t. |
|
6643
3a34b0dbb107
6625086 changing cachefile doesn't remove old cache on last user
eschrock
parents:
6245
diff
changeset
|
1590 |
* This is accomplished by invoking "::vdev -re" on the root vdev, as well as |
3a34b0dbb107
6625086 changing cachefile doesn't remove old cache on last user
eschrock
parents:
6245
diff
changeset
|
1591 |
* iterating over the cache devices. |
789 | 1592 |
*/ |
1593 |
/* ARGSUSED */ |
|
1594 |
static int |
|
1595 |
spa_vdevs(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) |
|
1596 |
{ |
|
1597 |
spa_t spa; |
|
6643
3a34b0dbb107
6625086 changing cachefile doesn't remove old cache on last user
eschrock
parents:
6245
diff
changeset
|
1598 |
mdb_arg_t v[3]; |
789 | 1599 |
int errors = FALSE; |
8341
53c5e7987263
6783576 ::spa -v should include spares
Eric Schrock <Eric.Schrock@Sun.COM>
parents:
7846
diff
changeset
|
1600 |
int ret; |
789 | 1601 |
|
1602 |
if (mdb_getopts(argc, argv, |
|
1603 |
'e', MDB_OPT_SETBITS, TRUE, &errors, |
|
1604 |
NULL) != argc) |
|
1605 |
return (DCMD_USAGE); |
|
1606 |
||
1607 |
if (!(flags & DCMD_ADDRSPEC)) |
|
1608 |
return (DCMD_USAGE); |
|
1609 |
||
1610 |
if (mdb_vread(&spa, sizeof (spa), addr) == -1) { |
|
1611 |
mdb_warn("failed to read spa_t at %p", addr); |
|
1612 |
return (DCMD_ERR); |
|
1613 |
} |
|
1614 |
||
952
12ec54aa046e
6344502 placeholder bug for the remaining Makefile cleanup work for ZFS
eschrock
parents:
789
diff
changeset
|
1615 |
/* |
12ec54aa046e
6344502 placeholder bug for the remaining Makefile cleanup work for ZFS
eschrock
parents:
789
diff
changeset
|
1616 |
* Unitialized spa_t structures can have a NULL root vdev. |
12ec54aa046e
6344502 placeholder bug for the remaining Makefile cleanup work for ZFS
eschrock
parents:
789
diff
changeset
|
1617 |
*/ |
12ec54aa046e
6344502 placeholder bug for the remaining Makefile cleanup work for ZFS
eschrock
parents:
789
diff
changeset
|
1618 |
if (spa.spa_root_vdev == NULL) { |
12ec54aa046e
6344502 placeholder bug for the remaining Makefile cleanup work for ZFS
eschrock
parents:
789
diff
changeset
|
1619 |
mdb_printf("no associated vdevs\n"); |
12ec54aa046e
6344502 placeholder bug for the remaining Makefile cleanup work for ZFS
eschrock
parents:
789
diff
changeset
|
1620 |
return (DCMD_OK); |
12ec54aa046e
6344502 placeholder bug for the remaining Makefile cleanup work for ZFS
eschrock
parents:
789
diff
changeset
|
1621 |
} |
12ec54aa046e
6344502 placeholder bug for the remaining Makefile cleanup work for ZFS
eschrock
parents:
789
diff
changeset
|
1622 |
|
6643
3a34b0dbb107
6625086 changing cachefile doesn't remove old cache on last user
eschrock
parents:
6245
diff
changeset
|
1623 |
v[0].a_type = MDB_TYPE_STRING; |
3a34b0dbb107
6625086 changing cachefile doesn't remove old cache on last user
eschrock
parents:
6245
diff
changeset
|
1624 |
v[0].a_un.a_str = errors ? "-re" : "-r"; |
3a34b0dbb107
6625086 changing cachefile doesn't remove old cache on last user
eschrock
parents:
6245
diff
changeset
|
1625 |
|
3a34b0dbb107
6625086 changing cachefile doesn't remove old cache on last user
eschrock
parents:
6245
diff
changeset
|
1626 |
ret = mdb_call_dcmd("vdev", (uintptr_t)spa.spa_root_vdev, |
3a34b0dbb107
6625086 changing cachefile doesn't remove old cache on last user
eschrock
parents:
6245
diff
changeset
|
1627 |
flags, 1, v); |
3a34b0dbb107
6625086 changing cachefile doesn't remove old cache on last user
eschrock
parents:
6245
diff
changeset
|
1628 |
if (ret != DCMD_OK) |
3a34b0dbb107
6625086 changing cachefile doesn't remove old cache on last user
eschrock
parents:
6245
diff
changeset
|
1629 |
return (ret); |
3a34b0dbb107
6625086 changing cachefile doesn't remove old cache on last user
eschrock
parents:
6245
diff
changeset
|
1630 |
|
8341
53c5e7987263
6783576 ::spa -v should include spares
Eric Schrock <Eric.Schrock@Sun.COM>
parents:
7846
diff
changeset
|
1631 |
if (spa_print_aux(&spa.spa_l2cache, flags, v, "cache") != 0 || |
53c5e7987263
6783576 ::spa -v should include spares
Eric Schrock <Eric.Schrock@Sun.COM>
parents:
7846
diff
changeset
|
1632 |
spa_print_aux(&spa.spa_spares, flags, v, "spares") != 0) |
53c5e7987263
6783576 ::spa -v should include spares
Eric Schrock <Eric.Schrock@Sun.COM>
parents:
7846
diff
changeset
|
1633 |
return (DCMD_ERR); |
6643
3a34b0dbb107
6625086 changing cachefile doesn't remove old cache on last user
eschrock
parents:
6245
diff
changeset
|
1634 |
|
3a34b0dbb107
6625086 changing cachefile doesn't remove old cache on last user
eschrock
parents:
6245
diff
changeset
|
1635 |
return (DCMD_OK); |
789 | 1636 |
} |
1637 |
||
4055 | 1638 |
/* |
1639 |
* ::zio |
|
1640 |
* |
|
1641 |
* Print a summary of zio_t and all its children. This is intended to display a |
|
1642 |
* zio tree, and hence we only pick the most important pieces of information for |
|
1643 |
* the main summary. More detailed information can always be found by doing a |
|
1644 |
* '::print zio' on the underlying zio_t. The columns we display are: |
|
1645 |
* |
|
1646 |
* ADDRESS TYPE STAGE WAITER |
|
1647 |
* |
|
1648 |
* The 'address' column is indented by one space for each depth level as we |
|
1649 |
* descend down the tree. |
|
1650 |
*/ |
|
4217
3411a82f178f
6552521 truss dumps core with multibyte characters in syscall args
eschrock
parents:
4055
diff
changeset
|
1651 |
|
8632
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1652 |
#define ZIO_MAXINDENT 24 |
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1653 |
#define ZIO_MAXWIDTH (sizeof (uintptr_t) * 2 + ZIO_MAXINDENT) |
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1654 |
#define ZIO_WALK_SELF 0 |
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1655 |
#define ZIO_WALK_CHILD 1 |
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1656 |
#define ZIO_WALK_PARENT 2 |
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1657 |
|
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1658 |
typedef struct zio_print_args { |
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1659 |
int zpa_current_depth; |
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1660 |
int zpa_min_depth; |
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1661 |
int zpa_max_depth; |
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1662 |
int zpa_type; |
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1663 |
uint_t zpa_flags; |
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1664 |
} zio_print_args_t; |
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1665 |
|
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1666 |
static int zio_child_cb(uintptr_t addr, const void *unknown, void *arg); |
4217
3411a82f178f
6552521 truss dumps core with multibyte characters in syscall args
eschrock
parents:
4055
diff
changeset
|
1667 |
|
4055 | 1668 |
static int |
1669 |
zio_print_cb(uintptr_t addr, const void *data, void *priv) |
|
1670 |
{ |
|
1671 |
const zio_t *zio = data; |
|
8632
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1672 |
zio_print_args_t *zpa = priv; |
4055 | 1673 |
mdb_ctf_id_t type_enum, stage_enum; |
8632
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1674 |
int indent = zpa->zpa_current_depth; |
4055 | 1675 |
const char *type, *stage; |
8632
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1676 |
uintptr_t laddr; |
4055 | 1677 |
|
8632
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1678 |
if (indent > ZIO_MAXINDENT) |
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1679 |
indent = ZIO_MAXINDENT; |
4055 | 1680 |
|
1681 |
if (mdb_ctf_lookup_by_name("enum zio_type", &type_enum) == -1 || |
|
1682 |
mdb_ctf_lookup_by_name("enum zio_stage", &stage_enum) == -1) { |
|
1683 |
mdb_warn("failed to lookup zio enums"); |
|
1684 |
return (WALK_ERR); |
|
1685 |
} |
|
1686 |
||
1687 |
if ((type = mdb_ctf_enum_name(type_enum, zio->io_type)) != NULL) |
|
1688 |
type += sizeof ("ZIO_TYPE_") - 1; |
|
1689 |
else |
|
1690 |
type = "?"; |
|
1691 |
||
1692 |
if ((stage = mdb_ctf_enum_name(stage_enum, zio->io_stage)) != NULL) |
|
1693 |
stage += sizeof ("ZIO_STAGE_") - 1; |
|
1694 |
else |
|
1695 |
stage = "?"; |
|
1696 |
||
8632
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1697 |
if (zpa->zpa_current_depth >= zpa->zpa_min_depth) { |
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1698 |
if (zpa->zpa_flags & DCMD_PIPE_OUT) { |
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1699 |
mdb_printf("%?p\n", addr); |
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1700 |
} else { |
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1701 |
mdb_printf("%*s%-*p %-5s %-16s ", indent, "", |
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1702 |
ZIO_MAXWIDTH - indent, addr, type, stage); |
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1703 |
if (zio->io_waiter) |
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1704 |
mdb_printf("%?p\n", zio->io_waiter); |
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1705 |
else |
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1706 |
mdb_printf("-\n"); |
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1707 |
} |
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1708 |
} |
4055 | 1709 |
|
8632
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1710 |
if (zpa->zpa_current_depth >= zpa->zpa_max_depth) |
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1711 |
return (WALK_NEXT); |
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1712 |
|
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1713 |
if (zpa->zpa_type == ZIO_WALK_PARENT) |
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1714 |
laddr = addr + OFFSETOF(zio_t, io_parent_list); |
4055 | 1715 |
else |
8632
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1716 |
laddr = addr + OFFSETOF(zio_t, io_child_list); |
4055 | 1717 |
|
8632
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1718 |
zpa->zpa_current_depth++; |
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1719 |
if (mdb_pwalk("list", zio_child_cb, zpa, laddr) != 0) { |
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1720 |
mdb_warn("failed to walk zio_t children at %p\n", laddr); |
4055 | 1721 |
return (WALK_ERR); |
1722 |
} |
|
8632
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1723 |
zpa->zpa_current_depth--; |
4055 | 1724 |
|
1725 |
return (WALK_NEXT); |
|
1726 |
} |
|
1727 |
||
8632
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1728 |
/* ARGSUSED */ |
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1729 |
static int |
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1730 |
zio_child_cb(uintptr_t addr, const void *unknown, void *arg) |
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1731 |
{ |
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1732 |
zio_link_t zl; |
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1733 |
zio_t zio; |
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1734 |
uintptr_t ziop; |
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1735 |
zio_print_args_t *zpa = arg; |
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1736 |
|
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1737 |
if (mdb_vread(&zl, sizeof (zl), addr) == -1) { |
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1738 |
mdb_warn("failed to read zio_link_t at %p", addr); |
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1739 |
return (WALK_ERR); |
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1740 |
} |
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1741 |
|
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1742 |
if (zpa->zpa_type == ZIO_WALK_PARENT) |
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1743 |
ziop = (uintptr_t)zl.zl_parent; |
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1744 |
else |
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1745 |
ziop = (uintptr_t)zl.zl_child; |
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1746 |
|
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1747 |
if (mdb_vread(&zio, sizeof (zio_t), ziop) == -1) { |
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1748 |
mdb_warn("failed to read zio_t at %p", ziop); |
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1749 |
return (WALK_ERR); |
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1750 |
} |
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1751 |
|
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1752 |
return (zio_print_cb(ziop, &zio, arg)); |
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1753 |
} |
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1754 |
|
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1755 |
/* ARGSUSED */ |
4055 | 1756 |
static int |
1757 |
zio_print(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) |
|
1758 |
{ |
|
1759 |
zio_t zio; |
|
8632
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1760 |
zio_print_args_t zpa = { 0 }; |
4055 | 1761 |
|
1762 |
if (!(flags & DCMD_ADDRSPEC)) |
|
1763 |
return (DCMD_USAGE); |
|
1764 |
||
8632
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1765 |
if (mdb_getopts(argc, argv, |
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1766 |
'r', MDB_OPT_SETBITS, INT_MAX, &zpa.zpa_max_depth, |
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1767 |
'c', MDB_OPT_SETBITS, ZIO_WALK_CHILD, &zpa.zpa_type, |
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1768 |
'p', MDB_OPT_SETBITS, ZIO_WALK_PARENT, &zpa.zpa_type, |
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1769 |
NULL) != argc) |
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1770 |
return (DCMD_USAGE); |
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1771 |
|
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1772 |
zpa.zpa_flags = flags; |
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1773 |
if (zpa.zpa_max_depth != 0) { |
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1774 |
if (zpa.zpa_type == ZIO_WALK_SELF) |
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1775 |
zpa.zpa_type = ZIO_WALK_CHILD; |
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1776 |
} else if (zpa.zpa_type != ZIO_WALK_SELF) { |
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1777 |
zpa.zpa_min_depth = 1; |
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1778 |
zpa.zpa_max_depth = 1; |
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1779 |
} |
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1780 |
|
4055 | 1781 |
if (mdb_vread(&zio, sizeof (zio_t), addr) == -1) { |
1782 |
mdb_warn("failed to read zio_t at %p", addr); |
|
1783 |
return (DCMD_ERR); |
|
1784 |
} |
|
1785 |
||
8632
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1786 |
if (!(flags & DCMD_PIPE_OUT) && DCMD_HDRSPEC(flags)) |
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1787 |
mdb_printf("%<u>%-*s %-5s %-16s %-?s%</u>\n", ZIO_MAXWIDTH, |
4217
3411a82f178f
6552521 truss dumps core with multibyte characters in syscall args
eschrock
parents:
4055
diff
changeset
|
1788 |
"ADDRESS", "TYPE", "STAGE", "WAITER"); |
3411a82f178f
6552521 truss dumps core with multibyte characters in syscall args
eschrock
parents:
4055
diff
changeset
|
1789 |
|
8632
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1790 |
if (zio_print_cb(addr, &zio, &zpa) != WALK_NEXT) |
4055 | 1791 |
return (DCMD_ERR); |
1792 |
||
1793 |
return (DCMD_OK); |
|
1794 |
} |
|
1795 |
||
1796 |
/* |
|
1797 |
* [addr]::zio_state |
|
1798 |
* |
|
1799 |
* Print a summary of all zio_t structures on the system, or for a particular |
|
1800 |
* pool. This is equivalent to '::walk zio_root | ::zio'. |
|
1801 |
*/ |
|
1802 |
/*ARGSUSED*/ |
|
1803 |
static int |
|
1804 |
zio_state(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) |
|
1805 |
{ |
|
1806 |
/* |
|
1807 |
* MDB will remember the last address of the pipeline, so if we don't |
|
1808 |
* zero this we'll end up trying to walk zio structures for a |
|
1809 |
* non-existent spa_t. |
|
1810 |
*/ |
|
1811 |
if (!(flags & DCMD_ADDRSPEC)) |
|
1812 |
addr = 0; |
|
1813 |
||
1814 |
return (mdb_pwalk_dcmd("zio_root", "zio", argc, argv, addr)); |
|
1815 |
} |
|
1816 |
||
789 | 1817 |
typedef struct txg_list_walk_data { |
1818 |
uintptr_t lw_head[TXG_SIZE]; |
|
1819 |
int lw_txgoff; |
|
1820 |
int lw_maxoff; |
|
1821 |
size_t lw_offset; |
|
1822 |
void *lw_obj; |
|
1823 |
} txg_list_walk_data_t; |
|
1824 |
||
1825 |
static int |
|
1826 |
txg_list_walk_init_common(mdb_walk_state_t *wsp, int txg, int maxoff) |
|
1827 |
{ |
|
1828 |
txg_list_walk_data_t *lwd; |
|
1829 |
txg_list_t list; |
|
1830 |
int i; |
|
1831 |
||
1832 |
lwd = mdb_alloc(sizeof (txg_list_walk_data_t), UM_SLEEP | UM_GC); |
|
1833 |
if (mdb_vread(&list, sizeof (txg_list_t), wsp->walk_addr) == -1) { |
|
1834 |
mdb_warn("failed to read txg_list_t at %#lx", wsp->walk_addr); |
|
1835 |
return (WALK_ERR); |
|
1836 |
} |
|
1837 |
||
1838 |
for (i = 0; i < TXG_SIZE; i++) |
|
1839 |
lwd->lw_head[i] = (uintptr_t)list.tl_head[i]; |
|
1840 |
lwd->lw_offset = list.tl_offset; |
|
1841 |
lwd->lw_obj = mdb_alloc(lwd->lw_offset + sizeof (txg_node_t), |
|
1842 |
UM_SLEEP | UM_GC); |
|
1843 |
lwd->lw_txgoff = txg; |
|
1844 |
lwd->lw_maxoff = maxoff; |
|
1845 |
||
1846 |
wsp->walk_addr = lwd->lw_head[lwd->lw_txgoff]; |
|
1847 |
wsp->walk_data = lwd; |
|
1848 |
||
1849 |
return (WALK_NEXT); |
|
1850 |
} |
|
1851 |
||
1852 |
static int |
|
1853 |
txg_list_walk_init(mdb_walk_state_t *wsp) |
|
1854 |
{ |
|
1855 |
return (txg_list_walk_init_common(wsp, 0, TXG_SIZE-1)); |
|
1856 |
} |
|
1857 |
||
1858 |
static int |
|
1859 |
txg_list0_walk_init(mdb_walk_state_t *wsp) |
|
1860 |
{ |
|
1861 |
return (txg_list_walk_init_common(wsp, 0, 0)); |
|
1862 |
} |
|
1863 |
||
1864 |
static int |
|
1865 |
txg_list1_walk_init(mdb_walk_state_t *wsp) |
|
1866 |
{ |
|
1867 |
return (txg_list_walk_init_common(wsp, 1, 1)); |
|
1868 |
} |
|
1869 |
||
1870 |
static int |
|
1871 |
txg_list2_walk_init(mdb_walk_state_t *wsp) |
|
1872 |
{ |
|
1873 |
return (txg_list_walk_init_common(wsp, 2, 2)); |
|
1874 |
} |
|
1875 |
||
1876 |
static int |
|
1877 |
txg_list3_walk_init(mdb_walk_state_t *wsp) |
|
1878 |
{ |
|
1879 |
return (txg_list_walk_init_common(wsp, 3, 3)); |
|
1880 |
} |
|
1881 |
||
1882 |
static int |
|
1883 |
txg_list_walk_step(mdb_walk_state_t *wsp) |
|
1884 |
{ |
|
1885 |
txg_list_walk_data_t *lwd = wsp->walk_data; |
|
1886 |
uintptr_t addr; |
|
1887 |
txg_node_t *node; |
|
1888 |
int status; |
|
1889 |
||
1890 |
while (wsp->walk_addr == NULL && lwd->lw_txgoff < lwd->lw_maxoff) { |
|
1891 |
lwd->lw_txgoff++; |
|
1892 |
wsp->walk_addr = lwd->lw_head[lwd->lw_txgoff]; |
|
1893 |
} |
|
1894 |
||
1895 |
if (wsp->walk_addr == NULL) |
|
1896 |
return (WALK_DONE); |
|
1897 |
||
1898 |
addr = wsp->walk_addr - lwd->lw_offset; |
|
1899 |
||
1900 |
if (mdb_vread(lwd->lw_obj, |
|
1901 |
lwd->lw_offset + sizeof (txg_node_t), addr) == -1) { |
|
1902 |
mdb_warn("failed to read list element at %#lx", addr); |
|
1903 |
return (WALK_ERR); |
|
1904 |
} |
|
1905 |
||
1906 |
status = wsp->walk_callback(addr, lwd->lw_obj, wsp->walk_cbdata); |
|
1907 |
node = (txg_node_t *)((uintptr_t)lwd->lw_obj + lwd->lw_offset); |
|
1908 |
wsp->walk_addr = (uintptr_t)node->tn_next[lwd->lw_txgoff]; |
|
1909 |
||
1910 |
return (status); |
|
1911 |
} |
|
1912 |
||
1913 |
/* |
|
1914 |
* ::walk spa |
|
1915 |
* |
|
1916 |
* Walk all named spa_t structures in the namespace. This is nothing more than |
|
1917 |
* a layered avl walk. |
|
1918 |
*/ |
|
1919 |
static int |
|
1920 |
spa_walk_init(mdb_walk_state_t *wsp) |
|
1921 |
{ |
|
1922 |
GElf_Sym sym; |
|
1923 |
||
1924 |
if (wsp->walk_addr != NULL) { |
|
1925 |
mdb_warn("spa walk only supports global walks\n"); |
|
1926 |
return (WALK_ERR); |
|
1927 |
} |
|
1928 |
||
1929 |
if (mdb_lookup_by_obj(ZFS_OBJ_NAME, "spa_namespace_avl", &sym) == -1) { |
|
1930 |
mdb_warn("failed to find symbol 'spa_namespace_avl'"); |
|
1931 |
return (WALK_ERR); |
|
1932 |
} |
|
1933 |
||
1934 |
wsp->walk_addr = (uintptr_t)sym.st_value; |
|
1935 |
||
1936 |
if (mdb_layered_walk("avl", wsp) == -1) { |
|
1937 |
mdb_warn("failed to walk 'avl'\n"); |
|
1938 |
return (WALK_ERR); |
|
1939 |
} |
|
1940 |
||
1941 |
return (WALK_NEXT); |
|
1942 |
} |
|
1943 |
||
1944 |
static int |
|
1945 |
spa_walk_step(mdb_walk_state_t *wsp) |
|
1946 |
{ |
|
1947 |
spa_t spa; |
|
1948 |
||
1949 |
if (mdb_vread(&spa, sizeof (spa), wsp->walk_addr) == -1) { |
|
1950 |
mdb_warn("failed to read spa_t at %p", wsp->walk_addr); |
|
1951 |
return (WALK_ERR); |
|
1952 |
} |
|
1953 |
||
1954 |
return (wsp->walk_callback(wsp->walk_addr, &spa, wsp->walk_cbdata)); |
|
1955 |
} |
|
1956 |
||
1957 |
/* |
|
4055 | 1958 |
* [addr]::walk zio |
1959 |
* |
|
1960 |
* Walk all active zio_t structures on the system. This is simply a layered |
|
1961 |
* walk on top of ::walk zio_cache, with the optional ability to limit the |
|
1962 |
* structures to a particular pool. |
|
1963 |
*/ |
|
1964 |
static int |
|
1965 |
zio_walk_init(mdb_walk_state_t *wsp) |
|
1966 |
{ |
|
1967 |
wsp->walk_data = (void *)wsp->walk_addr; |
|
1968 |
||
1969 |
if (mdb_layered_walk("zio_cache", wsp) == -1) { |
|
1970 |
mdb_warn("failed to walk 'zio_cache'\n"); |
|
1971 |
return (WALK_ERR); |
|
1972 |
} |
|
1973 |
||
1974 |
return (WALK_NEXT); |
|
1975 |
} |
|
1976 |
||
1977 |
static int |
|
1978 |
zio_walk_step(mdb_walk_state_t *wsp) |
|
1979 |
{ |
|
1980 |
zio_t zio; |
|
1981 |
||
1982 |
if (mdb_vread(&zio, sizeof (zio), wsp->walk_addr) == -1) { |
|
1983 |
mdb_warn("failed to read zio_t at %p", wsp->walk_addr); |
|
1984 |
return (WALK_ERR); |
|
1985 |
} |
|
1986 |
||
1987 |
if (wsp->walk_data != NULL && wsp->walk_data != zio.io_spa) |
|
1988 |
return (WALK_NEXT); |
|
1989 |
||
1990 |
return (wsp->walk_callback(wsp->walk_addr, &zio, wsp->walk_cbdata)); |
|
1991 |
} |
|
1992 |
||
1993 |
/* |
|
1994 |
* [addr]::walk zio_root |
|
1995 |
* |
|
1996 |
* Walk only root zio_t structures, optionally for a particular spa_t. |
|
1997 |
*/ |
|
1998 |
static int |
|
1999 |
zio_walk_root_step(mdb_walk_state_t *wsp) |
|
2000 |
{ |
|
2001 |
zio_t zio; |
|
2002 |
||
2003 |
if (mdb_vread(&zio, sizeof (zio), wsp->walk_addr) == -1) { |
|
2004 |
mdb_warn("failed to read zio_t at %p", wsp->walk_addr); |
|
2005 |
return (WALK_ERR); |
|
2006 |
} |
|
2007 |
||
2008 |
if (wsp->walk_data != NULL && wsp->walk_data != zio.io_spa) |
|
2009 |
return (WALK_NEXT); |
|
2010 |
||
8632
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
2011 |
/* If the parent list is not empty, ignore */ |
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
2012 |
if (zio.io_parent_list.list_head.list_next != |
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
2013 |
&((zio_t *)wsp->walk_addr)->io_parent_list.list_head) |
4055 | 2014 |
return (WALK_NEXT); |
2015 |
||
2016 |
return (wsp->walk_callback(wsp->walk_addr, &zio, wsp->walk_cbdata)); |
|
2017 |
} |
|
2018 |
||
7837
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2019 |
#define NICENUM_BUFLEN 6 |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2020 |
|
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2021 |
static int |
7846
a07ebe2d4dfa
6725668 want ::zfs_blkstats to show block type stats after scrub (fix kmdb)
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7837
diff
changeset
|
2022 |
snprintfrac(char *buf, int len, |
a07ebe2d4dfa
6725668 want ::zfs_blkstats to show block type stats after scrub (fix kmdb)
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7837
diff
changeset
|
2023 |
uint64_t numerator, uint64_t denom, int frac_digits) |
7837
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2024 |
{ |
7846
a07ebe2d4dfa
6725668 want ::zfs_blkstats to show block type stats after scrub (fix kmdb)
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7837
diff
changeset
|
2025 |
int mul = 1; |
7837
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2026 |
int whole, frac, i; |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2027 |
|
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2028 |
for (i = frac_digits; i; i--) |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2029 |
mul *= 10; |
7846
a07ebe2d4dfa
6725668 want ::zfs_blkstats to show block type stats after scrub (fix kmdb)
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7837
diff
changeset
|
2030 |
whole = numerator / denom; |
a07ebe2d4dfa
6725668 want ::zfs_blkstats to show block type stats after scrub (fix kmdb)
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7837
diff
changeset
|
2031 |
frac = mul * numerator / denom - mul * whole; |
7837
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2032 |
return (mdb_snprintf(buf, len, "%u.%0*u", whole, frac_digits, frac)); |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2033 |
} |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2034 |
|
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2035 |
static void |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2036 |
mdb_nicenum(uint64_t num, char *buf) |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2037 |
{ |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2038 |
uint64_t n = num; |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2039 |
int index = 0; |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2040 |
char *u; |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2041 |
|
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2042 |
while (n >= 1024) { |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2043 |
n = (n + (1024 / 2)) / 1024; /* Round up or down */ |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2044 |
index++; |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2045 |
} |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2046 |
|
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2047 |
u = &" \0K\0M\0G\0T\0P\0E\0"[index*2]; |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2048 |
|
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2049 |
if (index == 0) { |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2050 |
(void) mdb_snprintf(buf, NICENUM_BUFLEN, "%llu", |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2051 |
(u_longlong_t)n); |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2052 |
} else if (n < 10 && (num & (num - 1)) != 0) { |
7846
a07ebe2d4dfa
6725668 want ::zfs_blkstats to show block type stats after scrub (fix kmdb)
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7837
diff
changeset
|
2053 |
(void) snprintfrac(buf, NICENUM_BUFLEN, |
a07ebe2d4dfa
6725668 want ::zfs_blkstats to show block type stats after scrub (fix kmdb)
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7837
diff
changeset
|
2054 |
num, 1ULL << 10 * index, 2); |
7837
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2055 |
strcat(buf, u); |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2056 |
} else if (n < 100 && (num & (num - 1)) != 0) { |
7846
a07ebe2d4dfa
6725668 want ::zfs_blkstats to show block type stats after scrub (fix kmdb)
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7837
diff
changeset
|
2057 |
(void) snprintfrac(buf, NICENUM_BUFLEN, |
a07ebe2d4dfa
6725668 want ::zfs_blkstats to show block type stats after scrub (fix kmdb)
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7837
diff
changeset
|
2058 |
num, 1ULL << 10 * index, 1); |
7837
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2059 |
strcat(buf, u); |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2060 |
} else { |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2061 |
(void) mdb_snprintf(buf, NICENUM_BUFLEN, "%llu%s", |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2062 |
(u_longlong_t)n, u); |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2063 |
} |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2064 |
} |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2065 |
|
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2066 |
/* |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2067 |
* ::zfs_blkstats |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2068 |
* |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2069 |
* -v print verbose per-level information |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2070 |
* |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2071 |
*/ |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2072 |
static int |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2073 |
zfs_blkstats(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2074 |
{ |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2075 |
boolean_t verbose = B_FALSE; |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2076 |
zfs_all_blkstats_t stats; |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2077 |
dmu_object_type_t t; |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2078 |
zfs_blkstat_t *tzb; |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2079 |
uint64_t ditto; |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2080 |
dmu_object_type_info_t dmu_ot[DMU_OT_NUMTYPES + 10]; |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2081 |
/* +10 in case it grew */ |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2082 |
|
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2083 |
if (mdb_readvar(&dmu_ot, "dmu_ot") == -1) { |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2084 |
mdb_warn("failed to read 'dmu_ot'"); |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2085 |
return (DCMD_ERR); |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2086 |
} |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2087 |
|
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2088 |
if (mdb_getopts(argc, argv, |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2089 |
'v', MDB_OPT_SETBITS, TRUE, &verbose, |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2090 |
NULL) != argc) |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2091 |
return (DCMD_USAGE); |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2092 |
|
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2093 |
if (!(flags & DCMD_ADDRSPEC)) |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2094 |
return (DCMD_USAGE); |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2095 |
|
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2096 |
if (GETMEMB(addr, struct spa, spa_dsl_pool, addr) || |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2097 |
GETMEMB(addr, struct dsl_pool, dp_blkstats, addr) || |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2098 |
mdb_vread(&stats, sizeof (zfs_all_blkstats_t), addr) == -1) { |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2099 |
mdb_warn("failed to read data at %p;", addr); |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2100 |
mdb_printf("maybe no stats? run \"zpool scrub\" first."); |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2101 |
return (DCMD_ERR); |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2102 |
} |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2103 |
|
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2104 |
tzb = &stats.zab_type[DN_MAX_LEVELS][DMU_OT_NUMTYPES]; |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2105 |
if (tzb->zb_gangs != 0) { |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2106 |
mdb_printf("Ganged blocks: %llu\n", |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2107 |
(longlong_t)tzb->zb_gangs); |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2108 |
} |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2109 |
|
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2110 |
ditto = tzb->zb_ditto_2_of_2_samevdev + tzb->zb_ditto_2_of_3_samevdev + |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2111 |
tzb->zb_ditto_3_of_3_samevdev; |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2112 |
if (ditto != 0) { |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2113 |
mdb_printf("Dittoed blocks on same vdev: %llu\n", |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2114 |
(longlong_t)ditto); |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2115 |
} |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2116 |
|
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2117 |
mdb_printf("\nBlocks\tLSIZE\tPSIZE\tASIZE" |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2118 |
"\t avg\t comp\t%%Total\tType\n"); |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2119 |
|
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2120 |
for (t = 0; t <= DMU_OT_NUMTYPES; t++) { |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2121 |
char csize[NICENUM_BUFLEN], lsize[NICENUM_BUFLEN]; |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2122 |
char psize[NICENUM_BUFLEN], asize[NICENUM_BUFLEN]; |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2123 |
char avg[NICENUM_BUFLEN]; |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2124 |
char comp[NICENUM_BUFLEN], pct[NICENUM_BUFLEN]; |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2125 |
char typename[64]; |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2126 |
int l; |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2127 |
|
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2128 |
|
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2129 |
if (t == DMU_OT_DEFERRED) |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2130 |
strcpy(typename, "deferred free"); |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2131 |
else if (t == DMU_OT_TOTAL) |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2132 |
strcpy(typename, "Total"); |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2133 |
else if (mdb_readstr(typename, sizeof (typename), |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2134 |
(uintptr_t)dmu_ot[t].ot_name) == -1) { |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2135 |
mdb_warn("failed to read type name"); |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2136 |
return (DCMD_ERR); |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2137 |
} |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2138 |
|
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2139 |
if (stats.zab_type[DN_MAX_LEVELS][t].zb_asize == 0) |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2140 |
continue; |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2141 |
|
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2142 |
for (l = -1; l < DN_MAX_LEVELS; l++) { |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2143 |
int level = (l == -1 ? DN_MAX_LEVELS : l); |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2144 |
zfs_blkstat_t *zb = &stats.zab_type[level][t]; |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2145 |
|
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2146 |
if (zb->zb_asize == 0) |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2147 |
continue; |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2148 |
|
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2149 |
/* |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2150 |
* Don't print each level unless requested. |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2151 |
*/ |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2152 |
if (!verbose && level != DN_MAX_LEVELS) |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2153 |
continue; |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2154 |
|
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2155 |
/* |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2156 |
* If all the space is level 0, don't print the |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2157 |
* level 0 separately. |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2158 |
*/ |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2159 |
if (level == 0 && zb->zb_asize == |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2160 |
stats.zab_type[DN_MAX_LEVELS][t].zb_asize) |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2161 |
continue; |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2162 |
|
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2163 |
mdb_nicenum(zb->zb_count, csize); |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2164 |
mdb_nicenum(zb->zb_lsize, lsize); |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2165 |
mdb_nicenum(zb->zb_psize, psize); |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2166 |
mdb_nicenum(zb->zb_asize, asize); |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2167 |
mdb_nicenum(zb->zb_asize / zb->zb_count, avg); |
7846
a07ebe2d4dfa
6725668 want ::zfs_blkstats to show block type stats after scrub (fix kmdb)
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7837
diff
changeset
|
2168 |
(void) snprintfrac(comp, NICENUM_BUFLEN, |
a07ebe2d4dfa
6725668 want ::zfs_blkstats to show block type stats after scrub (fix kmdb)
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7837
diff
changeset
|
2169 |
zb->zb_lsize, zb->zb_psize, 2); |
a07ebe2d4dfa
6725668 want ::zfs_blkstats to show block type stats after scrub (fix kmdb)
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7837
diff
changeset
|
2170 |
(void) snprintfrac(pct, NICENUM_BUFLEN, |
a07ebe2d4dfa
6725668 want ::zfs_blkstats to show block type stats after scrub (fix kmdb)
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7837
diff
changeset
|
2171 |
100 * zb->zb_asize, tzb->zb_asize, 2); |
7837
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2172 |
|
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2173 |
mdb_printf("%6s\t%5s\t%5s\t%5s\t%5s" |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2174 |
"\t%5s\t%6s\t", |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2175 |
csize, lsize, psize, asize, avg, comp, pct); |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2176 |
|
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2177 |
if (level == DN_MAX_LEVELS) |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2178 |
mdb_printf("%s\n", typename); |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2179 |
else |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2180 |
mdb_printf(" L%d %s\n", |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2181 |
level, typename); |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2182 |
} |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2183 |
} |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2184 |
|
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2185 |
return (DCMD_OK); |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2186 |
} |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2187 |
|
10407
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2188 |
/* ARGSUSED */ |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2189 |
static int |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2190 |
reference_cb(uintptr_t addr, const void *ignored, void *arg) |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2191 |
{ |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2192 |
static int gotid; |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2193 |
static mdb_ctf_id_t ref_id; |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2194 |
uintptr_t ref_holder; |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2195 |
uintptr_t ref_removed; |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2196 |
uint64_t ref_number; |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2197 |
boolean_t holder_is_str; |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2198 |
char holder_str[128]; |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2199 |
boolean_t removed = (boolean_t)arg; |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2200 |
|
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2201 |
if (!gotid) { |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2202 |
if (mdb_ctf_lookup_by_name("struct reference", &ref_id) == -1) { |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2203 |
mdb_warn("couldn't find struct reference"); |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2204 |
return (WALK_ERR); |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2205 |
} |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2206 |
gotid = TRUE; |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2207 |
} |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2208 |
|
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2209 |
if (GETMEMBID(addr, &ref_id, ref_holder, ref_holder) || |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2210 |
GETMEMBID(addr, &ref_id, ref_removed, ref_removed) || |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2211 |
GETMEMBID(addr, &ref_id, ref_number, ref_number)) |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2212 |
return (WALK_ERR); |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2213 |
|
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2214 |
if (mdb_readstr(holder_str, sizeof (holder_str), ref_holder) != -1) { |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2215 |
char *cp; |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2216 |
holder_is_str = B_TRUE; |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2217 |
for (cp = holder_str; *cp; cp++) { |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2218 |
if (!isprint(*cp)) { |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2219 |
holder_is_str = B_FALSE; |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2220 |
break; |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2221 |
} |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2222 |
} |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2223 |
} else { |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2224 |
holder_is_str = B_FALSE; |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2225 |
} |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2226 |
|
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2227 |
if (removed) |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2228 |
mdb_printf("removed "); |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2229 |
mdb_printf("reference "); |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2230 |
if (ref_number != 1) |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2231 |
mdb_printf("with count=%llu ", ref_number); |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2232 |
mdb_printf("with tag %p", (void*)ref_holder); |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2233 |
if (holder_is_str) |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2234 |
mdb_printf(" \"%s\"", holder_str); |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2235 |
mdb_printf(", held at:\n"); |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2236 |
|
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2237 |
(void) mdb_call_dcmd("whatis", addr, DCMD_ADDRSPEC, 0, NULL); |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2238 |
|
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2239 |
if (removed) { |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2240 |
mdb_printf("removed at:\n"); |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2241 |
(void) mdb_call_dcmd("whatis", ref_removed, |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2242 |
DCMD_ADDRSPEC, 0, NULL); |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2243 |
} |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2244 |
|
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2245 |
mdb_printf("\n"); |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2246 |
|
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2247 |
return (WALK_NEXT); |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2248 |
} |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2249 |
|
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2250 |
/* ARGSUSED */ |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2251 |
static int |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2252 |
refcount(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2253 |
{ |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2254 |
uint64_t rc_count, rc_removed_count; |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2255 |
uintptr_t rc_list, rc_removed; |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2256 |
static int gotid; |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2257 |
static mdb_ctf_id_t rc_id; |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2258 |
ulong_t off; |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2259 |
|
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2260 |
if (!(flags & DCMD_ADDRSPEC)) |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2261 |
return (DCMD_USAGE); |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2262 |
|
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2263 |
if (!gotid) { |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2264 |
if (mdb_ctf_lookup_by_name("struct refcount", &rc_id) == -1) { |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2265 |
mdb_warn("couldn't find struct refcount"); |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2266 |
return (DCMD_ERR); |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2267 |
} |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2268 |
gotid = TRUE; |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2269 |
} |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2270 |
|
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2271 |
if (GETMEMBID(addr, &rc_id, rc_count, rc_count) || |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2272 |
GETMEMBID(addr, &rc_id, rc_removed_count, rc_removed_count)) |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2273 |
return (DCMD_ERR); |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2274 |
|
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2275 |
mdb_printf("refcount_t at %p has %llu current holds, " |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2276 |
"%llu recently released holds\n", |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2277 |
addr, (longlong_t)rc_count, (longlong_t)rc_removed_count); |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2278 |
|
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2279 |
if (rc_count > 0) |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2280 |
mdb_printf("current holds:\n"); |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2281 |
if (mdb_ctf_offsetof(rc_id, "rc_list", &off) == -1) |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2282 |
return (DCMD_ERR); |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2283 |
rc_list = addr + off/NBBY; |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2284 |
mdb_pwalk("list", reference_cb, (void*)B_FALSE, rc_list); |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2285 |
|
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2286 |
if (rc_removed_count > 0) |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2287 |
mdb_printf("released holds:\n"); |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2288 |
if (mdb_ctf_offsetof(rc_id, "rc_removed", &off) == -1) |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2289 |
return (DCMD_ERR); |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2290 |
rc_removed = addr + off/NBBY; |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2291 |
mdb_pwalk("list", reference_cb, (void*)B_TRUE, rc_removed); |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2292 |
|
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2293 |
return (DCMD_OK); |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2294 |
} |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2295 |
|
11935
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2296 |
/* ARGSUSED */ |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2297 |
static int |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2298 |
sa_attr_table(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2299 |
{ |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2300 |
sa_attr_table_t *table; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2301 |
sa_os_t sa_os; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2302 |
char *name; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2303 |
int i; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2304 |
|
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2305 |
if (mdb_vread(&sa_os, sizeof (sa_os_t), addr) == -1) { |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2306 |
mdb_warn("failed to read sa_os at %p", addr); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2307 |
return (DCMD_ERR); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2308 |
} |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2309 |
|
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2310 |
table = mdb_alloc(sizeof (sa_attr_table_t) * sa_os.sa_num_attrs, |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2311 |
UM_SLEEP | UM_GC); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2312 |
name = mdb_alloc(MAXPATHLEN, UM_SLEEP | UM_GC); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2313 |
|
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2314 |
if (mdb_vread(table, sizeof (sa_attr_table_t) * sa_os.sa_num_attrs, |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2315 |
(uintptr_t)sa_os.sa_attr_table) == -1) { |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2316 |
mdb_warn("failed to read sa_os at %p", addr); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2317 |
return (DCMD_ERR); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2318 |
} |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2319 |
|
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2320 |
mdb_printf("%<u>%-10s %-10s %-10s %-10s %s%</u>\n", |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2321 |
"ATTR ID", "REGISTERED", "LENGTH", "BSWAP", "NAME"); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2322 |
for (i = 0; i != sa_os.sa_num_attrs; i++) { |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2323 |
mdb_readstr(name, MAXPATHLEN, (uintptr_t)table[i].sa_name); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2324 |
mdb_printf("%5x %8x %8x %8x %-s\n", |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2325 |
(int)table[i].sa_attr, (int)table[i].sa_registered, |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2326 |
(int)table[i].sa_length, table[i].sa_byteswap, name); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2327 |
} |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2328 |
|
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2329 |
return (DCMD_OK); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2330 |
} |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2331 |
|
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2332 |
static int |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2333 |
sa_get_off_table(uintptr_t addr, uint32_t **off_tab, int attr_count) |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2334 |
{ |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2335 |
uintptr_t idx_table; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2336 |
|
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2337 |
if (GETMEMB(addr, struct sa_idx_tab, sa_idx_tab, idx_table)) { |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2338 |
mdb_printf("can't find offset table in sa_idx_tab\n"); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2339 |
return (-1); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2340 |
} |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2341 |
|
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2342 |
*off_tab = mdb_alloc(attr_count * sizeof (uint32_t), |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2343 |
UM_SLEEP | UM_GC); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2344 |
|
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2345 |
if (mdb_vread(*off_tab, |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2346 |
attr_count * sizeof (uint32_t), idx_table) == -1) { |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2347 |
mdb_warn("failed to attribute offset table %p", idx_table); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2348 |
return (-1); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2349 |
} |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2350 |
|
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2351 |
return (DCMD_OK); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2352 |
} |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2353 |
|
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2354 |
/*ARGSUSED*/ |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2355 |
static int |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2356 |
sa_attr_print(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2357 |
{ |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2358 |
uint32_t *offset_tab; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2359 |
int attr_count; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2360 |
uint64_t attr_id; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2361 |
uintptr_t attr_addr; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2362 |
uintptr_t bonus_tab, spill_tab; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2363 |
uintptr_t db_bonus, db_spill; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2364 |
uintptr_t os, os_sa; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2365 |
uintptr_t db_data; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2366 |
|
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2367 |
if (argc != 1) |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2368 |
return (DCMD_USAGE); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2369 |
|
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2370 |
if (argv[0].a_type == MDB_TYPE_STRING) |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2371 |
attr_id = mdb_strtoull(argv[0].a_un.a_str); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2372 |
else |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2373 |
return (DCMD_USAGE); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2374 |
|
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2375 |
if (GETMEMB(addr, struct sa_handle, sa_bonus_tab, bonus_tab) || |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2376 |
GETMEMB(addr, struct sa_handle, sa_spill_tab, spill_tab) || |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2377 |
GETMEMB(addr, struct sa_handle, sa_os, os) || |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2378 |
GETMEMB(addr, struct sa_handle, sa_bonus, db_bonus) || |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2379 |
GETMEMB(addr, struct sa_handle, sa_spill, db_spill)) { |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2380 |
mdb_printf("Can't find necessary information in sa_handle " |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2381 |
"in sa_handle\n"); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2382 |
return (DCMD_ERR); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2383 |
} |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2384 |
|
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2385 |
if (GETMEMB(os, struct objset, os_sa, os_sa)) { |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2386 |
mdb_printf("Can't find os_sa in objset\n"); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2387 |
return (DCMD_ERR); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2388 |
} |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2389 |
|
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2390 |
if (GETMEMB(os_sa, struct sa_os, sa_num_attrs, attr_count)) { |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2391 |
mdb_printf("Can't find sa_num_attrs\n"); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2392 |
return (DCMD_ERR); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2393 |
} |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2394 |
|
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2395 |
if (attr_id > attr_count) { |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2396 |
mdb_printf("attribute id number is out of range\n"); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2397 |
return (DCMD_ERR); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2398 |
} |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2399 |
|
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2400 |
if (bonus_tab) { |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2401 |
if (sa_get_off_table(bonus_tab, &offset_tab, |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2402 |
attr_count) == -1) { |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2403 |
return (DCMD_ERR); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2404 |
} |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2405 |
|
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2406 |
if (GETMEMB(db_bonus, struct dmu_buf, db_data, db_data)) { |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2407 |
mdb_printf("can't find db_data in bonus dbuf\n"); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2408 |
return (DCMD_ERR); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2409 |
} |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2410 |
} |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2411 |
|
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2412 |
if (bonus_tab && !TOC_ATTR_PRESENT(offset_tab[attr_id]) && |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2413 |
spill_tab == NULL) { |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2414 |
mdb_printf("Attribute does not exist\n"); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2415 |
return (DCMD_ERR); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2416 |
} else if (!TOC_ATTR_PRESENT(offset_tab[attr_id]) && spill_tab) { |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2417 |
if (sa_get_off_table(spill_tab, &offset_tab, |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2418 |
attr_count) == -1) { |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2419 |
return (DCMD_ERR); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2420 |
} |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2421 |
if (GETMEMB(db_spill, struct dmu_buf, db_data, db_data)) { |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2422 |
mdb_printf("can't find db_data in spill dbuf\n"); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2423 |
return (DCMD_ERR); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2424 |
} |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2425 |
if (!TOC_ATTR_PRESENT(offset_tab[attr_id])) { |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2426 |
mdb_printf("Attribute does not exist\n"); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2427 |
return (DCMD_ERR); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2428 |
} |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2429 |
} |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2430 |
attr_addr = db_data + TOC_OFF(offset_tab[attr_id]); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2431 |
mdb_printf("%p\n", attr_addr); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2432 |
return (DCMD_OK); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2433 |
} |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2434 |
|
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2435 |
/* ARGSUSED */ |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2436 |
static int |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2437 |
zfs_ace_print_common(uintptr_t addr, uint_t flags, |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2438 |
uint64_t id, uint32_t access_mask, uint16_t ace_flags, |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2439 |
uint16_t ace_type, int verbose) |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2440 |
{ |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2441 |
if (DCMD_HDRSPEC(flags) && !verbose) |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2442 |
mdb_printf("%<u>%-?s %-8s %-8s %-8s %s%</u>\n", |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2443 |
"ADDR", "FLAGS", "MASK", "TYPE", "ID"); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2444 |
|
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2445 |
if (!verbose) { |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2446 |
mdb_printf("%0?p %-8x %-8x %-8x %-llx\n", addr, |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2447 |
ace_flags, access_mask, ace_type, id); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2448 |
return (DCMD_OK); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2449 |
} |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2450 |
|
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2451 |
switch (ace_flags & ACE_TYPE_FLAGS) { |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2452 |
case ACE_OWNER: |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2453 |
mdb_printf("owner@:"); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2454 |
break; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2455 |
case (ACE_IDENTIFIER_GROUP | ACE_GROUP): |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2456 |
mdb_printf("group@:"); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2457 |
break; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2458 |
case ACE_EVERYONE: |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2459 |
mdb_printf("everyone@:"); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2460 |
break; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2461 |
case ACE_IDENTIFIER_GROUP: |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2462 |
mdb_printf("group:%llx:", (u_longlong_t)id); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2463 |
break; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2464 |
case 0: /* User entry */ |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2465 |
mdb_printf("user:%llx:", (u_longlong_t)id); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2466 |
break; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2467 |
} |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2468 |
|
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2469 |
/* print out permission mask */ |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2470 |
if (access_mask & ACE_READ_DATA) |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2471 |
mdb_printf("r"); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2472 |
else |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2473 |
mdb_printf("-"); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2474 |
if (access_mask & ACE_WRITE_DATA) |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2475 |
mdb_printf("w"); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2476 |
else |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2477 |
mdb_printf("-"); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2478 |
if (access_mask & ACE_EXECUTE) |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2479 |
mdb_printf("x"); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2480 |
else |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2481 |
mdb_printf("-"); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2482 |
if (access_mask & ACE_APPEND_DATA) |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2483 |
mdb_printf("p"); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2484 |
else |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2485 |
mdb_printf("-"); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2486 |
if (access_mask & ACE_DELETE) |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2487 |
mdb_printf("d"); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2488 |
else |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2489 |
mdb_printf("-"); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2490 |
if (access_mask & ACE_DELETE_CHILD) |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2491 |
mdb_printf("D"); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2492 |
else |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2493 |
mdb_printf("-"); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2494 |
if (access_mask & ACE_READ_ATTRIBUTES) |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2495 |
mdb_printf("a"); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2496 |
else |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2497 |
mdb_printf("-"); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2498 |
if (access_mask & ACE_WRITE_ATTRIBUTES) |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2499 |
mdb_printf("A"); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2500 |
else |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2501 |
mdb_printf("-"); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2502 |
if (access_mask & ACE_READ_NAMED_ATTRS) |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2503 |
mdb_printf("R"); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2504 |
else |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2505 |
mdb_printf("-"); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2506 |
if (access_mask & ACE_WRITE_NAMED_ATTRS) |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2507 |
mdb_printf("W"); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2508 |
else |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2509 |
mdb_printf("-"); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2510 |
if (access_mask & ACE_READ_ACL) |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2511 |
mdb_printf("c"); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2512 |
else |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2513 |
mdb_printf("-"); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2514 |
if (access_mask & ACE_WRITE_ACL) |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2515 |
mdb_printf("C"); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2516 |
else |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2517 |
mdb_printf("-"); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2518 |
if (access_mask & ACE_WRITE_OWNER) |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2519 |
mdb_printf("o"); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2520 |
else |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2521 |
mdb_printf("-"); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2522 |
if (access_mask & ACE_SYNCHRONIZE) |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2523 |
mdb_printf("s"); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2524 |
else |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2525 |
mdb_printf("-"); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2526 |
|
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2527 |
mdb_printf(":"); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2528 |
|
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2529 |
/* Print out inheritance flags */ |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2530 |
if (ace_flags & ACE_FILE_INHERIT_ACE) |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2531 |
mdb_printf("f"); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2532 |
else |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2533 |
mdb_printf("-"); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2534 |
if (ace_flags & ACE_DIRECTORY_INHERIT_ACE) |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2535 |
mdb_printf("d"); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2536 |
else |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2537 |
mdb_printf("-"); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2538 |
if (ace_flags & ACE_INHERIT_ONLY_ACE) |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2539 |
mdb_printf("i"); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2540 |
else |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2541 |
mdb_printf("-"); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2542 |
if (ace_flags & ACE_NO_PROPAGATE_INHERIT_ACE) |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2543 |
mdb_printf("n"); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2544 |
else |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2545 |
mdb_printf("-"); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2546 |
if (ace_flags & ACE_SUCCESSFUL_ACCESS_ACE_FLAG) |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2547 |
mdb_printf("S"); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2548 |
else |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2549 |
mdb_printf("-"); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2550 |
if (ace_flags & ACE_FAILED_ACCESS_ACE_FLAG) |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2551 |
mdb_printf("F"); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2552 |
else |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2553 |
mdb_printf("-"); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2554 |
if (ace_flags & ACE_INHERITED_ACE) |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2555 |
mdb_printf("I"); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2556 |
else |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2557 |
mdb_printf("-"); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2558 |
|
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2559 |
switch (ace_type) { |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2560 |
case ACE_ACCESS_ALLOWED_ACE_TYPE: |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2561 |
mdb_printf(":allow\n"); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2562 |
break; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2563 |
case ACE_ACCESS_DENIED_ACE_TYPE: |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2564 |
mdb_printf(":deny\n"); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2565 |
break; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2566 |
case ACE_SYSTEM_AUDIT_ACE_TYPE: |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2567 |
mdb_printf(":audit\n"); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2568 |
break; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2569 |
case ACE_SYSTEM_ALARM_ACE_TYPE: |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2570 |
mdb_printf(":alarm\n"); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2571 |
break; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2572 |
default: |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2573 |
mdb_printf(":?\n"); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2574 |
} |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2575 |
return (DCMD_OK); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2576 |
} |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2577 |
|
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2578 |
/* ARGSUSED */ |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2579 |
static int |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2580 |
zfs_ace_print(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2581 |
{ |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2582 |
zfs_ace_t zace; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2583 |
int verbose = FALSE; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2584 |
uint64_t id; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2585 |
|
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2586 |
if (!(flags & DCMD_ADDRSPEC)) |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2587 |
return (DCMD_USAGE); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2588 |
|
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2589 |
if (mdb_getopts(argc, argv, |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2590 |
'v', MDB_OPT_SETBITS, TRUE, &verbose, TRUE, NULL) != argc) |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2591 |
return (DCMD_USAGE); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2592 |
|
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2593 |
if (mdb_vread(&zace, sizeof (zfs_ace_t), addr) == -1) { |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2594 |
mdb_warn("failed to read zfs_ace_t"); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2595 |
return (DCMD_ERR); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2596 |
} |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2597 |
|
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2598 |
if ((zace.z_hdr.z_flags & ACE_TYPE_FLAGS) == 0 || |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2599 |
(zace.z_hdr.z_flags & ACE_TYPE_FLAGS) == ACE_IDENTIFIER_GROUP) |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2600 |
id = zace.z_fuid; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2601 |
else |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2602 |
id = -1; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2603 |
|
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2604 |
return (zfs_ace_print_common(addr, flags, id, zace.z_hdr.z_access_mask, |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2605 |
zace.z_hdr.z_flags, zace.z_hdr.z_type, verbose)); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2606 |
} |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2607 |
|
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2608 |
/* ARGSUSED */ |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2609 |
static int |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2610 |
zfs_ace0_print(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2611 |
{ |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2612 |
ace_t ace; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2613 |
uint64_t id; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2614 |
int verbose = FALSE; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2615 |
|
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2616 |
if (!(flags & DCMD_ADDRSPEC)) |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2617 |
return (DCMD_USAGE); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2618 |
|
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2619 |
if (mdb_getopts(argc, argv, |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2620 |
'v', MDB_OPT_SETBITS, TRUE, &verbose, TRUE, NULL) != argc) |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2621 |
return (DCMD_USAGE); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2622 |
|
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2623 |
if (mdb_vread(&ace, sizeof (ace_t), addr) == -1) { |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2624 |
mdb_warn("failed to read ace_t"); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2625 |
return (DCMD_ERR); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2626 |
} |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2627 |
|
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2628 |
if ((ace.a_flags & ACE_TYPE_FLAGS) == 0 || |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2629 |
(ace.a_flags & ACE_TYPE_FLAGS) == ACE_IDENTIFIER_GROUP) |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2630 |
id = ace.a_who; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2631 |
else |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2632 |
id = -1; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2633 |
|
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2634 |
return (zfs_ace_print_common(addr, flags, id, ace.a_access_mask, |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2635 |
ace.a_flags, ace.a_type, verbose)); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2636 |
} |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2637 |
|
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2638 |
typedef struct acl_dump_args { |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2639 |
int a_argc; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2640 |
const mdb_arg_t *a_argv; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2641 |
uint16_t a_version; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2642 |
int a_flags; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2643 |
} acl_dump_args_t; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2644 |
|
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2645 |
/* ARGSUSED */ |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2646 |
static int |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2647 |
acl_aces_cb(uintptr_t addr, const void *unknown, void *arg) |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2648 |
{ |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2649 |
acl_dump_args_t *acl_args = (acl_dump_args_t *)arg; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2650 |
|
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2651 |
if (acl_args->a_version == 1) { |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2652 |
if (mdb_call_dcmd("zfs_ace", addr, |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2653 |
DCMD_ADDRSPEC|acl_args->a_flags, acl_args->a_argc, |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2654 |
acl_args->a_argv) != DCMD_OK) { |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2655 |
return (WALK_ERR); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2656 |
} |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2657 |
} else { |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2658 |
if (mdb_call_dcmd("zfs_ace0", addr, |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2659 |
DCMD_ADDRSPEC|acl_args->a_flags, acl_args->a_argc, |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2660 |
acl_args->a_argv) != DCMD_OK) { |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2661 |
return (WALK_ERR); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2662 |
} |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2663 |
} |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2664 |
acl_args->a_flags = DCMD_LOOP; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2665 |
return (WALK_NEXT); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2666 |
} |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2667 |
|
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2668 |
/* ARGSUSED */ |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2669 |
static int |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2670 |
acl_cb(uintptr_t addr, const void *unknown, void *arg) |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2671 |
{ |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2672 |
acl_dump_args_t *acl_args = (acl_dump_args_t *)arg; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2673 |
|
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2674 |
if (acl_args->a_version == 1) { |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2675 |
if (mdb_pwalk("zfs_acl_node_aces", acl_aces_cb, |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2676 |
arg, addr) != 0) { |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2677 |
mdb_warn("can't walk ACEs"); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2678 |
return (DCMD_ERR); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2679 |
} |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2680 |
} else { |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2681 |
if (mdb_pwalk("zfs_acl_node_aces0", acl_aces_cb, |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2682 |
arg, addr) != 0) { |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2683 |
mdb_warn("can't walk ACEs"); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2684 |
return (DCMD_ERR); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2685 |
} |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2686 |
} |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2687 |
return (WALK_NEXT); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2688 |
} |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2689 |
|
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2690 |
/* ARGSUSED */ |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2691 |
static int |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2692 |
zfs_acl_dump(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2693 |
{ |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2694 |
zfs_acl_t zacl; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2695 |
int verbose = FALSE; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2696 |
acl_dump_args_t acl_args; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2697 |
|
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2698 |
if (!(flags & DCMD_ADDRSPEC)) |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2699 |
return (DCMD_USAGE); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2700 |
|
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2701 |
if (mdb_getopts(argc, argv, |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2702 |
'v', MDB_OPT_SETBITS, TRUE, &verbose, TRUE, NULL) != argc) |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2703 |
return (DCMD_USAGE); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2704 |
|
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2705 |
if (mdb_vread(&zacl, sizeof (zfs_acl_t), addr) == -1) { |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2706 |
mdb_warn("failed to read zfs_acl_t"); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2707 |
return (DCMD_ERR); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2708 |
} |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2709 |
|
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2710 |
acl_args.a_argc = argc; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2711 |
acl_args.a_argv = argv; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2712 |
acl_args.a_version = zacl.z_version; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2713 |
acl_args.a_flags = DCMD_LOOPFIRST; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2714 |
|
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2715 |
if (mdb_pwalk("zfs_acl_node", acl_cb, &acl_args, addr) != 0) { |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2716 |
mdb_warn("can't walk ACL"); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2717 |
return (DCMD_ERR); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2718 |
} |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2719 |
|
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2720 |
return (DCMD_OK); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2721 |
} |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2722 |
|
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2723 |
/* ARGSUSED */ |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2724 |
static int |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2725 |
zfs_acl_node_walk_init(mdb_walk_state_t *wsp) |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2726 |
{ |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2727 |
if (wsp->walk_addr == NULL) { |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2728 |
mdb_warn("must supply address of zfs_acl_node_t\n"); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2729 |
return (WALK_ERR); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2730 |
} |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2731 |
|
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2732 |
wsp->walk_addr += OFFSETOF(zfs_acl_t, z_acl); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2733 |
|
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2734 |
if (mdb_layered_walk("list", wsp) == -1) { |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2735 |
mdb_warn("failed to walk 'list'\n"); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2736 |
return (WALK_ERR); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2737 |
} |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2738 |
|
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2739 |
return (WALK_NEXT); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2740 |
} |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2741 |
|
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2742 |
static int |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2743 |
zfs_acl_node_walk_step(mdb_walk_state_t *wsp) |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2744 |
{ |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2745 |
zfs_acl_node_t aclnode; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2746 |
|
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2747 |
if (mdb_vread(&aclnode, sizeof (zfs_acl_node_t), |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2748 |
wsp->walk_addr) == -1) { |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2749 |
mdb_warn("failed to read zfs_acl_node at %p", wsp->walk_addr); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2750 |
return (WALK_ERR); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2751 |
} |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2752 |
|
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2753 |
return (wsp->walk_callback(wsp->walk_addr, &aclnode, wsp->walk_cbdata)); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2754 |
} |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2755 |
|
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2756 |
typedef struct ace_walk_data { |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2757 |
int ace_count; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2758 |
int ace_version; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2759 |
} ace_walk_data_t; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2760 |
|
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2761 |
static int |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2762 |
zfs_aces_walk_init_common(mdb_walk_state_t *wsp, int version, |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2763 |
int ace_count, uintptr_t ace_data) |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2764 |
{ |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2765 |
ace_walk_data_t *ace_walk_data; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2766 |
|
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2767 |
if (wsp->walk_addr == NULL) { |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2768 |
mdb_warn("must supply address of zfs_acl_node_t\n"); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2769 |
return (WALK_ERR); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2770 |
} |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2771 |
|
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2772 |
ace_walk_data = mdb_alloc(sizeof (ace_walk_data_t), UM_SLEEP | UM_GC); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2773 |
|
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2774 |
ace_walk_data->ace_count = ace_count; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2775 |
ace_walk_data->ace_version = version; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2776 |
|
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2777 |
wsp->walk_addr = ace_data; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2778 |
wsp->walk_data = ace_walk_data; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2779 |
|
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2780 |
return (WALK_NEXT); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2781 |
} |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2782 |
|
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2783 |
static int |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2784 |
zfs_acl_node_aces_walk_init_common(mdb_walk_state_t *wsp, int version) |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2785 |
{ |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2786 |
static int gotid; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2787 |
static mdb_ctf_id_t acl_id; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2788 |
int z_ace_count; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2789 |
uintptr_t z_acldata; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2790 |
|
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2791 |
if (!gotid) { |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2792 |
if (mdb_ctf_lookup_by_name("struct zfs_acl_node", |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2793 |
&acl_id) == -1) { |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2794 |
mdb_warn("couldn't find struct zfs_acl_node"); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2795 |
return (DCMD_ERR); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2796 |
} |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2797 |
gotid = TRUE; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2798 |
} |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2799 |
|
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2800 |
if (GETMEMBID(wsp->walk_addr, &acl_id, z_ace_count, z_ace_count)) { |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2801 |
return (DCMD_ERR); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2802 |
} |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2803 |
if (GETMEMBID(wsp->walk_addr, &acl_id, z_acldata, z_acldata)) { |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2804 |
return (DCMD_ERR); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2805 |
} |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2806 |
|
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2807 |
return (zfs_aces_walk_init_common(wsp, version, |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2808 |
z_ace_count, z_acldata)); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2809 |
} |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2810 |
|
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2811 |
/* ARGSUSED */ |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2812 |
static int |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2813 |
zfs_acl_node_aces_walk_init(mdb_walk_state_t *wsp) |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2814 |
{ |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2815 |
return (zfs_acl_node_aces_walk_init_common(wsp, 1)); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2816 |
} |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2817 |
|
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2818 |
/* ARGSUSED */ |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2819 |
static int |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2820 |
zfs_acl_node_aces0_walk_init(mdb_walk_state_t *wsp) |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2821 |
{ |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2822 |
return (zfs_acl_node_aces_walk_init_common(wsp, 0)); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2823 |
} |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2824 |
|
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2825 |
static int |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2826 |
zfs_aces_walk_step(mdb_walk_state_t *wsp) |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2827 |
{ |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2828 |
ace_walk_data_t *ace_data = wsp->walk_data; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2829 |
zfs_ace_t zace; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2830 |
ace_t *acep; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2831 |
int status; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2832 |
int entry_type; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2833 |
int allow_type; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2834 |
uintptr_t ptr; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2835 |
|
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2836 |
if (ace_data->ace_count == 0) |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2837 |
return (WALK_DONE); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2838 |
|
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2839 |
if (mdb_vread(&zace, sizeof (zfs_ace_t), wsp->walk_addr) == -1) { |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2840 |
mdb_warn("failed to read zfs_ace_t at %#lx", |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2841 |
wsp->walk_addr); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2842 |
return (WALK_ERR); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2843 |
} |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2844 |
|
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2845 |
switch (ace_data->ace_version) { |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2846 |
case 0: |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2847 |
acep = (ace_t *)&zace; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2848 |
entry_type = acep->a_flags & ACE_TYPE_FLAGS; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2849 |
allow_type = acep->a_type; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2850 |
break; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2851 |
case 1: |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2852 |
entry_type = zace.z_hdr.z_flags & ACE_TYPE_FLAGS; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2853 |
allow_type = zace.z_hdr.z_type; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2854 |
break; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2855 |
default: |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2856 |
return (WALK_ERR); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2857 |
} |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2858 |
|
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2859 |
ptr = (uintptr_t)wsp->walk_addr; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2860 |
switch (entry_type) { |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2861 |
case ACE_OWNER: |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2862 |
case ACE_EVERYONE: |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2863 |
case (ACE_IDENTIFIER_GROUP | ACE_GROUP): |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2864 |
ptr += ace_data->ace_version == 0 ? |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2865 |
sizeof (ace_t) : sizeof (zfs_ace_hdr_t); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2866 |
break; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2867 |
case ACE_IDENTIFIER_GROUP: |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2868 |
default: |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2869 |
switch (allow_type) { |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2870 |
case ACE_ACCESS_ALLOWED_OBJECT_ACE_TYPE: |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2871 |
case ACE_ACCESS_DENIED_OBJECT_ACE_TYPE: |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2872 |
case ACE_SYSTEM_AUDIT_OBJECT_ACE_TYPE: |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2873 |
case ACE_SYSTEM_ALARM_OBJECT_ACE_TYPE: |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2874 |
ptr += ace_data->ace_version == 0 ? |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2875 |
sizeof (ace_t) : sizeof (zfs_object_ace_t); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2876 |
break; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2877 |
default: |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2878 |
ptr += ace_data->ace_version == 0 ? |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2879 |
sizeof (ace_t) : sizeof (zfs_ace_t); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2880 |
break; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2881 |
} |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2882 |
} |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2883 |
|
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2884 |
ace_data->ace_count--; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2885 |
status = wsp->walk_callback(wsp->walk_addr, |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2886 |
(void *)(uintptr_t)&zace, wsp->walk_cbdata); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2887 |
|
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2888 |
wsp->walk_addr = ptr; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2889 |
return (status); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2890 |
} |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2891 |
|
4055 | 2892 |
/* |
789 | 2893 |
* MDB module linkage information: |
2894 |
* |
|
2895 |
* We declare a list of structures describing our dcmds, and a function |
|
2896 |
* named _mdb_init to return a pointer to our module information. |
|
2897 |
*/ |
|
2898 |
||
2899 |
static const mdb_dcmd_t dcmds[] = { |
|
4787 | 2900 |
{ "arc", "[-bkmg]", "print ARC variables", arc_print }, |
789 | 2901 |
{ "blkptr", ":", "print blkptr_t", blkptr }, |
2902 |
{ "dbuf", ":", "print dmu_buf_impl_t", dbuf }, |
|
2903 |
{ "dbuf_stats", ":", "dbuf stats", dbuf_stats }, |
|
2904 |
{ "dbufs", |
|
11954
d6630fa76b91
6936265 mismerge in zfs mdb module
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11935
diff
changeset
|
2905 |
"\t[-O objset_t*] [-n objset_name | \"mos\"] " |
8632
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
2906 |
"[-o object | \"mdn\"] \n" |
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
2907 |
"\t[-l level] [-b blkid | \"bonus\"]", |
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
2908 |
"find dmu_buf_impl_t's that match specified criteria", dbufs }, |
789 | 2909 |
{ "abuf_find", "dva_word[0] dva_word[1]", |
8632
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
2910 |
"find arc_buf_hdr_t of a specified DVA", |
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
2911 |
abuf_find }, |
789 | 2912 |
{ "spa", "?[-cv]", "spa_t summary", spa_print }, |
2913 |
{ "spa_config", ":", "print spa_t configuration", spa_print_config }, |
|
2914 |
{ "spa_verify", ":", "verify spa_t consistency", spa_verify }, |
|
2915 |
{ "spa_space", ":[-b]", "print spa_t on-disk space usage", spa_space }, |
|
2916 |
{ "spa_vdevs", ":", "given a spa_t, print vdev summary", spa_vdevs }, |
|
4787 | 2917 |
{ "vdev", ":[-re]\n" |
8632
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
2918 |
"\t-r display recursively\n" |
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
2919 |
"\t-e print statistics", |
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
2920 |
"vdev_t summary", vdev_print }, |
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
2921 |
{ "zio", ":[cpr]\n" |
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
2922 |
"\t-c display children\n" |
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
2923 |
"\t-p display parents\n" |
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
2924 |
"\t-r display recursively", |
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
2925 |
"zio_t summary", zio_print }, |
4055 | 2926 |
{ "zio_state", "?", "print out all zio_t structures on system or " |
2927 |
"for a particular pool", zio_state }, |
|
7837
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2928 |
{ "zfs_blkstats", ":[-v]", |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2929 |
"given a spa_t, print block type stats from last scrub", |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2930 |
zfs_blkstats }, |
3059 | 2931 |
{ "zfs_params", "", "print zfs tunable parameters", zfs_params }, |
10407
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2932 |
{ "refcount", "", "print refcount_t holders", refcount }, |
11609
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
2933 |
{ "zap_leaf", "", "print zap_leaf_phys_t", zap_leaf }, |
11935
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2934 |
{ "zfs_aces", ":[-v]", "print all ACEs from a zfs_acl_t", |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2935 |
zfs_acl_dump }, |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2936 |
{ "zfs_ace", ":[-v]", "print zfs_ace", zfs_ace_print }, |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2937 |
{ "zfs_ace0", ":[-v]", "print zfs_ace0", zfs_ace0_print }, |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2938 |
{ "sa_attr_table", ":", "print SA attribute table from sa_os_t", |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2939 |
sa_attr_table}, |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2940 |
{ "sa_attr", ": attr_id", |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2941 |
"print SA attribute address when given sa_handle_t", sa_attr_print}, |
789 | 2942 |
{ NULL } |
2943 |
}; |
|
2944 |
||
2945 |
static const mdb_walker_t walkers[] = { |
|
2946 |
/* |
|
2947 |
* In userland, there is no generic provider of list_t walkers, so we |
|
2948 |
* need to add it. |
|
2949 |
*/ |
|
2950 |
#ifndef _KERNEL |
|
2951 |
{ LIST_WALK_NAME, LIST_WALK_DESC, |
|
2952 |
list_walk_init, list_walk_step, list_walk_fini }, |
|
2953 |
#endif |
|
2954 |
{ "zms_freelist", "walk ZFS metaslab freelist", |
|
2459
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
2955 |
freelist_walk_init, freelist_walk_step, NULL }, |
789 | 2956 |
{ "txg_list", "given any txg_list_t *, walk all entries in all txgs", |
2459
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
2957 |
txg_list_walk_init, txg_list_walk_step, NULL }, |
789 | 2958 |
{ "txg_list0", "given any txg_list_t *, walk all entries in txg 0", |
2459
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
2959 |
txg_list0_walk_init, txg_list_walk_step, NULL }, |
789 | 2960 |
{ "txg_list1", "given any txg_list_t *, walk all entries in txg 1", |
2459
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
2961 |
txg_list1_walk_init, txg_list_walk_step, NULL }, |
789 | 2962 |
{ "txg_list2", "given any txg_list_t *, walk all entries in txg 2", |
2459
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
2963 |
txg_list2_walk_init, txg_list_walk_step, NULL }, |
789 | 2964 |
{ "txg_list3", "given any txg_list_t *, walk all entries in txg 3", |
2459
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
2965 |
txg_list3_walk_init, txg_list_walk_step, NULL }, |
4055 | 2966 |
{ "zio", "walk all zio structures, optionally for a particular spa_t", |
2967 |
zio_walk_init, zio_walk_step, NULL }, |
|
2968 |
{ "zio_root", "walk all root zio_t structures, optionally for a " |
|
2969 |
"particular spa_t", |
|
2970 |
zio_walk_init, zio_walk_root_step, NULL }, |
|
789 | 2971 |
{ "spa", "walk all spa_t entries in the namespace", |
2972 |
spa_walk_init, spa_walk_step, NULL }, |
|
2459
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
2973 |
{ "metaslab", "given a spa_t *, walk all metaslab_t structures", |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
2974 |
metaslab_walk_init, metaslab_walk_step, NULL }, |
11935
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2975 |
{ "zfs_acl_node", "given a zfs_acl_t, walk all zfs_acl_nodes", |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2976 |
zfs_acl_node_walk_init, zfs_acl_node_walk_step, NULL }, |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2977 |
{ "zfs_acl_node_aces", "given a zfs_acl_node_t, walk all ACEs", |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2978 |
zfs_acl_node_aces_walk_init, zfs_aces_walk_step, NULL }, |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2979 |
{ "zfs_acl_node_aces0", |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2980 |
"given a zfs_acl_node_t, walk all ACEs as ace_t", |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11726
diff
changeset
|
2981 |
zfs_acl_node_aces0_walk_init, zfs_aces_walk_step, NULL }, |
789 | 2982 |
{ NULL } |
2983 |
}; |
|
2984 |
||
2985 |
static const mdb_modinfo_t modinfo = { |
|
2986 |
MDB_API_VERSION, dcmds, walkers |
|
2987 |
}; |
|
2988 |
||
2989 |
const mdb_modinfo_t * |
|
2990 |
_mdb_init(void) |
|
2991 |
{ |
|
2992 |
return (&modinfo); |
|
2993 |
} |