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