author | Matthew Ahrens <Matthew.Ahrens@Sun.COM> |
Mon, 01 Feb 2010 10:24:18 -0800 | |
changeset 11609 | 3b5da7ebb54d |
parent 11422 | 42768837421d |
child 11726 | 9686f6127423 |
permissions | -rw-r--r-- |
789 | 1 |
/* |
2 |
* CDDL HEADER START |
|
3 |
* |
|
4 |
* The contents of this file are subject to the terms of the |
|
1544 | 5 |
* Common Development and Distribution License (the "License"). |
6 |
* You may not use this file except in compliance with the License. |
|
789 | 7 |
* |
8 |
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE |
|
9 |
* or http://www.opensolaris.org/os/licensing. |
|
10 |
* See the License for the specific language governing permissions |
|
11 |
* and limitations under the License. |
|
12 |
* |
|
13 |
* When distributing Covered Code, include this CDDL HEADER in each |
|
14 |
* file and include the License file at usr/src/OPENSOLARIS.LICENSE. |
|
15 |
* If applicable, add the following below this CDDL HEADER, with the |
|
16 |
* fields enclosed by brackets "[]" replaced with your own identifying |
|
17 |
* information: Portions Copyright [yyyy] [name of copyright owner] |
|
18 |
* |
|
19 |
* CDDL HEADER END |
|
20 |
*/ |
|
21 |
/* |
|
11422
42768837421d
PSARC/2009/511 zpool split
Mark J Musante <Mark.Musante@Sun.COM>
parents:
11147
diff
changeset
|
22 |
* Copyright 2010 Sun Microsystems, Inc. All rights reserved. |
789 | 23 |
* Use is subject to license terms. |
24 |
*/ |
|
25 |
||
26 |
#include <mdb/mdb_ctf.h> |
|
27 |
#include <sys/zfs_context.h> |
|
28 |
#include <sys/mdb_modapi.h> |
|
29 |
#include <sys/dbuf.h> |
|
30 |
#include <sys/dmu_objset.h> |
|
31 |
#include <sys/dsl_dir.h> |
|
32 |
#include <sys/dsl_pool.h> |
|
33 |
#include <sys/metaslab_impl.h> |
|
34 |
#include <sys/space_map.h> |
|
35 |
#include <sys/list.h> |
|
36 |
#include <sys/spa_impl.h> |
|
37 |
#include <sys/vdev_impl.h> |
|
11609
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
38 |
#include <sys/zap_leaf.h> |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
39 |
#include <sys/zap_impl.h> |
10407
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
40 |
#include <ctype.h> |
789 | 41 |
|
42 |
#ifndef _KERNEL |
|
43 |
#include "../genunix/list.h" |
|
44 |
#endif |
|
45 |
||
46 |
#ifdef _KERNEL |
|
47 |
#define ZFS_OBJ_NAME "zfs" |
|
48 |
#else |
|
49 |
#define ZFS_OBJ_NAME "libzpool.so.1" |
|
50 |
#endif |
|
51 |
||
52 |
static int |
|
53 |
getmember(uintptr_t addr, const char *type, mdb_ctf_id_t *idp, |
|
54 |
const char *member, int len, void *buf) |
|
55 |
{ |
|
56 |
mdb_ctf_id_t id; |
|
57 |
ulong_t off; |
|
58 |
char name[64]; |
|
59 |
||
60 |
if (idp == NULL) { |
|
61 |
if (mdb_ctf_lookup_by_name(type, &id) == -1) { |
|
62 |
mdb_warn("couldn't find type %s", type); |
|
63 |
return (DCMD_ERR); |
|
64 |
} |
|
65 |
idp = &id; |
|
66 |
} else { |
|
67 |
type = name; |
|
68 |
mdb_ctf_type_name(*idp, name, sizeof (name)); |
|
69 |
} |
|
70 |
||
71 |
if (mdb_ctf_offsetof(*idp, member, &off) == -1) { |
|
72 |
mdb_warn("couldn't find member %s of type %s\n", member, type); |
|
73 |
return (DCMD_ERR); |
|
74 |
} |
|
75 |
if (off % 8 != 0) { |
|
76 |
mdb_warn("member %s of type %s is unsupported bitfield", |
|
77 |
member, type); |
|
78 |
return (DCMD_ERR); |
|
79 |
} |
|
80 |
off /= 8; |
|
81 |
||
82 |
if (mdb_vread(buf, len, addr + off) == -1) { |
|
83 |
mdb_warn("failed to read %s from %s at %p", |
|
84 |
member, type, addr + off); |
|
85 |
return (DCMD_ERR); |
|
86 |
} |
|
87 |
/* mdb_warn("read %s from %s at %p+%llx\n", member, type, addr, off); */ |
|
88 |
||
89 |
return (0); |
|
90 |
} |
|
91 |
||
92 |
#define GETMEMB(addr, type, member, dest) \ |
|
93 |
getmember(addr, #type, NULL, #member, sizeof (dest), &(dest)) |
|
94 |
||
95 |
#define GETMEMBID(addr, ctfid, member, dest) \ |
|
96 |
getmember(addr, NULL, ctfid, #member, sizeof (dest), &(dest)) |
|
97 |
||
98 |
static int |
|
99 |
getrefcount(uintptr_t addr, mdb_ctf_id_t *id, |
|
100 |
const char *member, uint64_t *rc) |
|
101 |
{ |
|
102 |
static int gotid; |
|
103 |
static mdb_ctf_id_t rc_id; |
|
104 |
ulong_t off; |
|
105 |
||
106 |
if (!gotid) { |
|
107 |
if (mdb_ctf_lookup_by_name("struct refcount", &rc_id) == -1) { |
|
108 |
mdb_warn("couldn't find struct refcount"); |
|
109 |
return (DCMD_ERR); |
|
110 |
} |
|
111 |
gotid = TRUE; |
|
112 |
} |
|
113 |
||
114 |
if (mdb_ctf_offsetof(*id, member, &off) == -1) { |
|
115 |
char name[64]; |
|
116 |
mdb_ctf_type_name(*id, name, sizeof (name)); |
|
117 |
mdb_warn("couldn't find member %s of type %s\n", member, name); |
|
118 |
return (DCMD_ERR); |
|
119 |
} |
|
120 |
off /= 8; |
|
121 |
||
122 |
return (GETMEMBID(addr + off, &rc_id, rc_count, *rc)); |
|
123 |
} |
|
124 |
||
125 |
static int verbose; |
|
126 |
||
127 |
static int |
|
128 |
freelist_walk_init(mdb_walk_state_t *wsp) |
|
129 |
{ |
|
130 |
if (wsp->walk_addr == NULL) { |
|
131 |
mdb_warn("must supply starting address\n"); |
|
132 |
return (WALK_ERR); |
|
133 |
} |
|
134 |
||
135 |
wsp->walk_data = 0; /* Index into the freelist */ |
|
136 |
return (WALK_NEXT); |
|
137 |
} |
|
138 |
||
139 |
static int |
|
140 |
freelist_walk_step(mdb_walk_state_t *wsp) |
|
141 |
{ |
|
142 |
uint64_t entry; |
|
143 |
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
|
144 |
char *ddata[] = { "ALLOC", "FREE", "CONDENSE", "INVALID", |
a3d194896a76
6480230 ::walk spa|::walk zms_freelist cause mdb to core dump
ck153898
parents:
3158
diff
changeset
|
145 |
"INVALID", "INVALID", "INVALID", "INVALID" }; |
789 | 146 |
int mapshift = SPA_MINBLOCKSHIFT; |
147 |
||
148 |
if (mdb_vread(&entry, sizeof (entry), wsp->walk_addr) == -1) { |
|
149 |
mdb_warn("failed to read freelist entry %p", wsp->walk_addr); |
|
150 |
return (WALK_DONE); |
|
151 |
} |
|
152 |
wsp->walk_addr += sizeof (entry); |
|
153 |
wsp->walk_data = (void *)(number + 1); |
|
154 |
||
155 |
if (SM_DEBUG_DECODE(entry)) { |
|
156 |
mdb_printf("DEBUG: %3u %10s: txg=%llu pass=%llu\n", |
|
157 |
number, |
|
158 |
ddata[SM_DEBUG_ACTION_DECODE(entry)], |
|
159 |
SM_DEBUG_TXG_DECODE(entry), |
|
160 |
SM_DEBUG_SYNCPASS_DECODE(entry)); |
|
161 |
} else { |
|
162 |
mdb_printf("Entry: %3u offsets=%08llx-%08llx type=%c " |
|
163 |
"size=%06llx", number, |
|
164 |
SM_OFFSET_DECODE(entry) << mapshift, |
|
165 |
(SM_OFFSET_DECODE(entry) + SM_RUN_DECODE(entry)) << |
|
166 |
mapshift, |
|
167 |
SM_TYPE_DECODE(entry) == SM_ALLOC ? 'A' : 'F', |
|
168 |
SM_RUN_DECODE(entry) << mapshift); |
|
169 |
if (verbose) |
|
170 |
mdb_printf(" (raw=%012llx)\n", entry); |
|
171 |
mdb_printf("\n"); |
|
172 |
} |
|
173 |
return (WALK_NEXT); |
|
174 |
} |
|
175 |
||
176 |
||
177 |
static int |
|
178 |
dataset_name(uintptr_t addr, char *buf) |
|
179 |
{ |
|
180 |
static int gotid; |
|
181 |
static mdb_ctf_id_t dd_id; |
|
182 |
uintptr_t dd_parent; |
|
183 |
char dd_myname[MAXNAMELEN]; |
|
184 |
||
185 |
if (!gotid) { |
|
186 |
if (mdb_ctf_lookup_by_name("struct dsl_dir", |
|
187 |
&dd_id) == -1) { |
|
188 |
mdb_warn("couldn't find struct dsl_dir"); |
|
189 |
return (DCMD_ERR); |
|
190 |
} |
|
191 |
gotid = TRUE; |
|
192 |
} |
|
193 |
if (GETMEMBID(addr, &dd_id, dd_parent, dd_parent) || |
|
194 |
GETMEMBID(addr, &dd_id, dd_myname, dd_myname)) { |
|
195 |
return (DCMD_ERR); |
|
196 |
} |
|
197 |
||
198 |
if (dd_parent) { |
|
199 |
if (dataset_name(dd_parent, buf)) |
|
200 |
return (DCMD_ERR); |
|
201 |
strcat(buf, "/"); |
|
202 |
} |
|
203 |
||
204 |
if (dd_myname[0]) |
|
205 |
strcat(buf, dd_myname); |
|
206 |
else |
|
207 |
strcat(buf, "???"); |
|
208 |
||
209 |
return (0); |
|
210 |
} |
|
211 |
||
212 |
static int |
|
213 |
objset_name(uintptr_t addr, char *buf) |
|
214 |
{ |
|
215 |
static int gotid; |
|
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9480
diff
changeset
|
216 |
static mdb_ctf_id_t os_id, ds_id; |
789 | 217 |
uintptr_t os_dsl_dataset; |
218 |
char ds_snapname[MAXNAMELEN]; |
|
219 |
uintptr_t ds_dir; |
|
220 |
||
221 |
buf[0] = '\0'; |
|
222 |
||
223 |
if (!gotid) { |
|
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9480
diff
changeset
|
224 |
if (mdb_ctf_lookup_by_name("struct objset", |
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9480
diff
changeset
|
225 |
&os_id) == -1) { |
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9480
diff
changeset
|
226 |
mdb_warn("couldn't find struct objset"); |
789 | 227 |
return (DCMD_ERR); |
228 |
} |
|
229 |
if (mdb_ctf_lookup_by_name("struct dsl_dataset", |
|
230 |
&ds_id) == -1) { |
|
231 |
mdb_warn("couldn't find struct dsl_dataset"); |
|
232 |
return (DCMD_ERR); |
|
233 |
} |
|
234 |
||
235 |
gotid = TRUE; |
|
236 |
} |
|
237 |
||
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9480
diff
changeset
|
238 |
if (GETMEMBID(addr, &os_id, os_dsl_dataset, os_dsl_dataset)) |
789 | 239 |
return (DCMD_ERR); |
240 |
||
241 |
if (os_dsl_dataset == 0) { |
|
242 |
strcat(buf, "mos"); |
|
243 |
return (0); |
|
244 |
} |
|
245 |
||
246 |
if (GETMEMBID(os_dsl_dataset, &ds_id, ds_snapname, ds_snapname) || |
|
247 |
GETMEMBID(os_dsl_dataset, &ds_id, ds_dir, ds_dir)) { |
|
248 |
return (DCMD_ERR); |
|
249 |
} |
|
250 |
||
251 |
if (ds_dir && dataset_name(ds_dir, buf)) |
|
252 |
return (DCMD_ERR); |
|
253 |
||
254 |
if (ds_snapname[0]) { |
|
255 |
strcat(buf, "@"); |
|
256 |
strcat(buf, ds_snapname); |
|
257 |
} |
|
258 |
return (0); |
|
259 |
} |
|
260 |
||
261 |
static void |
|
262 |
enum_lookup(char *out, size_t size, mdb_ctf_id_t id, int val, |
|
263 |
const char *prefix) |
|
264 |
{ |
|
265 |
const char *cp; |
|
266 |
size_t len = strlen(prefix); |
|
267 |
||
268 |
if ((cp = mdb_ctf_enum_name(id, val)) != NULL) { |
|
269 |
if (strncmp(cp, prefix, len) == 0) |
|
270 |
cp += len; |
|
271 |
(void) strncpy(out, cp, size); |
|
272 |
} else { |
|
273 |
mdb_snprintf(out, size, "? (%d)", val); |
|
274 |
} |
|
275 |
} |
|
276 |
||
277 |
/* ARGSUSED */ |
|
278 |
static int |
|
3059 | 279 |
zfs_params(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) |
280 |
{ |
|
281 |
/* |
|
282 |
* This table can be approximately generated by running: |
|
283 |
* egrep "^[a-z0-9_]+ [a-z0-9_]+( =.*)?;" *.c | cut -d ' ' -f 2 |
|
284 |
*/ |
|
285 |
static const char *params[] = { |
|
286 |
"arc_reduce_dnlc_percent", |
|
287 |
"zfs_arc_max", |
|
288 |
"zfs_arc_min", |
|
3158
f30a3849aa23
6493923 nfsfind on ZFS filesystem quickly depletes memory in a 1GB system
maybee
parents:
3059
diff
changeset
|
289 |
"arc_shrink_shift", |
3059 | 290 |
"zfs_mdcomp_disable", |
291 |
"zfs_prefetch_disable", |
|
292 |
"zfetch_max_streams", |
|
293 |
"zfetch_min_sec_reap", |
|
294 |
"zfetch_block_cap", |
|
295 |
"zfetch_array_rd_sz", |
|
296 |
"zfs_default_bs", |
|
297 |
"zfs_default_ibs", |
|
298 |
"metaslab_aliquot", |
|
299 |
"reference_tracking_enable", |
|
300 |
"reference_history", |
|
301 |
"spa_max_replication_override", |
|
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10860
diff
changeset
|
302 |
"spa_mode_global", |
3059 | 303 |
"zfs_flags", |
6245
1a2a7cfb9f26
6429205 each zpool needs to monitor its throughput and throttle heavy writers
maybee
parents:
5367
diff
changeset
|
304 |
"zfs_txg_synctime", |
1a2a7cfb9f26
6429205 each zpool needs to monitor its throughput and throttle heavy writers
maybee
parents:
5367
diff
changeset
|
305 |
"zfs_txg_timeout", |
1a2a7cfb9f26
6429205 each zpool needs to monitor its throughput and throttle heavy writers
maybee
parents:
5367
diff
changeset
|
306 |
"zfs_write_limit_min", |
1a2a7cfb9f26
6429205 each zpool needs to monitor its throughput and throttle heavy writers
maybee
parents:
5367
diff
changeset
|
307 |
"zfs_write_limit_max", |
1a2a7cfb9f26
6429205 each zpool needs to monitor its throughput and throttle heavy writers
maybee
parents:
5367
diff
changeset
|
308 |
"zfs_write_limit_shift", |
1a2a7cfb9f26
6429205 each zpool needs to monitor its throughput and throttle heavy writers
maybee
parents:
5367
diff
changeset
|
309 |
"zfs_write_limit_override", |
1a2a7cfb9f26
6429205 each zpool needs to monitor its throughput and throttle heavy writers
maybee
parents:
5367
diff
changeset
|
310 |
"zfs_no_write_throttle", |
3059 | 311 |
"zfs_vdev_cache_max", |
312 |
"zfs_vdev_cache_size", |
|
313 |
"zfs_vdev_cache_bshift", |
|
314 |
"vdev_mirror_shift", |
|
315 |
"zfs_vdev_max_pending", |
|
316 |
"zfs_vdev_min_pending", |
|
317 |
"zfs_scrub_limit", |
|
11147
74e8c05021f1
6678033 resilver code should prefetch
George Wilson <George.Wilson@Sun.COM>
parents:
10922
diff
changeset
|
318 |
"zfs_no_scrub_io", |
74e8c05021f1
6678033 resilver code should prefetch
George Wilson <George.Wilson@Sun.COM>
parents:
10922
diff
changeset
|
319 |
"zfs_no_scrub_prefetch", |
3059 | 320 |
"zfs_vdev_time_shift", |
321 |
"zfs_vdev_ramp_rate", |
|
322 |
"zfs_vdev_aggregation_limit", |
|
323 |
"fzap_default_block_shift", |
|
324 |
"zfs_immediate_write_sz", |
|
325 |
"zfs_read_chunk_size", |
|
326 |
"zil_disable", |
|
327 |
"zfs_nocacheflush", |
|
6245
1a2a7cfb9f26
6429205 each zpool needs to monitor its throughput and throttle heavy writers
maybee
parents:
5367
diff
changeset
|
328 |
"metaslab_gang_bang", |
9480
fcff33da767f
6596237 Stop looking and start ganging
George Wilson <George.Wilson@Sun.COM>
parents:
8632
diff
changeset
|
329 |
"metaslab_df_alloc_threshold", |
fcff33da767f
6596237 Stop looking and start ganging
George Wilson <George.Wilson@Sun.COM>
parents:
8632
diff
changeset
|
330 |
"metaslab_df_free_pct", |
3059 | 331 |
"zio_injection_enabled", |
332 |
"zvol_immediate_write_sz", |
|
333 |
}; |
|
334 |
||
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10860
diff
changeset
|
335 |
for (int i = 0; i < sizeof (params) / sizeof (params[0]); i++) { |
3059 | 336 |
int sz; |
337 |
uint64_t val64; |
|
338 |
uint32_t *val32p = (uint32_t *)&val64; |
|
339 |
||
340 |
sz = mdb_readvar(&val64, params[i]); |
|
341 |
if (sz == 4) { |
|
342 |
mdb_printf("%s = 0x%x\n", params[i], *val32p); |
|
343 |
} else if (sz == 8) { |
|
344 |
mdb_printf("%s = 0x%llx\n", params[i], val64); |
|
345 |
} else { |
|
346 |
mdb_warn("variable %s not found", params[i]); |
|
347 |
} |
|
348 |
} |
|
349 |
||
350 |
return (DCMD_OK); |
|
351 |
} |
|
352 |
||
353 |
/* ARGSUSED */ |
|
354 |
static int |
|
789 | 355 |
blkptr(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) |
356 |
{ |
|
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10860
diff
changeset
|
357 |
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
|
358 |
char type[80], checksum[80], compress[80]; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10860
diff
changeset
|
359 |
blkptr_t blk, *bp = &blk; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10860
diff
changeset
|
360 |
char buf[BP_SPRINTF_LEN]; |
789 | 361 |
|
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10860
diff
changeset
|
362 |
if (mdb_vread(&blk, sizeof (blkptr_t), addr) == -1) { |
789 | 363 |
mdb_warn("failed to read blkptr_t"); |
364 |
return (DCMD_ERR); |
|
365 |
} |
|
366 |
||
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10860
diff
changeset
|
367 |
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
|
368 |
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
|
369 |
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
|
370 |
mdb_warn("Could not find blkptr enumerated types"); |
789 | 371 |
return (DCMD_ERR); |
372 |
} |
|
373 |
||
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10860
diff
changeset
|
374 |
enum_lookup(type, sizeof (type), type_enum, |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10860
diff
changeset
|
375 |
BP_GET_TYPE(bp), "DMU_OT_"); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10860
diff
changeset
|
376 |
enum_lookup(checksum, sizeof (checksum), checksum_enum, |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10860
diff
changeset
|
377 |
BP_GET_CHECKSUM(bp), "ZIO_CHECKSUM_"); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10860
diff
changeset
|
378 |
enum_lookup(compress, sizeof (compress), compress_enum, |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10860
diff
changeset
|
379 |
BP_GET_COMPRESS(bp), "ZIO_COMPRESS_"); |
1775
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
380 |
|
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10860
diff
changeset
|
381 |
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
|
382 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10860
diff
changeset
|
383 |
mdb_printf("%s\n", buf); |
789 | 384 |
|
385 |
return (DCMD_OK); |
|
386 |
} |
|
387 |
||
388 |
/* ARGSUSED */ |
|
389 |
static int |
|
390 |
dbuf(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) |
|
391 |
{ |
|
392 |
mdb_ctf_id_t id; |
|
393 |
dmu_buf_t db; |
|
394 |
uintptr_t objset; |
|
395 |
uint8_t level; |
|
396 |
uint64_t blkid; |
|
397 |
uint64_t holds; |
|
398 |
char objectname[32]; |
|
399 |
char blkidname[32]; |
|
400 |
char path[MAXNAMELEN]; |
|
401 |
||
402 |
if (DCMD_HDRSPEC(flags)) { |
|
403 |
mdb_printf(" addr object lvl blkid holds os\n"); |
|
404 |
} |
|
405 |
||
406 |
if (mdb_ctf_lookup_by_name("struct dmu_buf_impl", &id) == -1) { |
|
407 |
mdb_warn("couldn't find struct dmu_buf_impl_t"); |
|
408 |
return (DCMD_ERR); |
|
409 |
} |
|
410 |
||
411 |
if (GETMEMBID(addr, &id, db_objset, objset) || |
|
412 |
GETMEMBID(addr, &id, db, db) || |
|
413 |
GETMEMBID(addr, &id, db_level, level) || |
|
414 |
GETMEMBID(addr, &id, db_blkid, blkid)) { |
|
415 |
return (WALK_ERR); |
|
416 |
} |
|
417 |
||
418 |
if (getrefcount(addr, &id, "db_holds", &holds)) { |
|
419 |
return (WALK_ERR); |
|
420 |
} |
|
421 |
||
422 |
if (db.db_object == DMU_META_DNODE_OBJECT) |
|
423 |
(void) strcpy(objectname, "mdn"); |
|
424 |
else |
|
425 |
(void) mdb_snprintf(objectname, sizeof (objectname), "%llx", |
|
426 |
(u_longlong_t)db.db_object); |
|
427 |
||
428 |
if (blkid == DB_BONUS_BLKID) |
|
429 |
(void) strcpy(blkidname, "bonus"); |
|
430 |
else |
|
431 |
(void) mdb_snprintf(blkidname, sizeof (blkidname), "%llx", |
|
432 |
(u_longlong_t)blkid); |
|
433 |
||
434 |
if (objset_name(objset, path)) { |
|
435 |
return (WALK_ERR); |
|
436 |
} |
|
437 |
||
438 |
mdb_printf("%p %8s %1u %9s %2llu %s\n", |
|
439 |
addr, objectname, level, blkidname, holds, path); |
|
440 |
||
441 |
return (DCMD_OK); |
|
442 |
} |
|
443 |
||
444 |
/* ARGSUSED */ |
|
445 |
static int |
|
446 |
dbuf_stats(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) |
|
447 |
{ |
|
448 |
#define HISTOSZ 32 |
|
449 |
uintptr_t dbp; |
|
450 |
dmu_buf_impl_t db; |
|
451 |
dbuf_hash_table_t ht; |
|
452 |
uint64_t bucket, ndbufs; |
|
453 |
uint64_t histo[HISTOSZ]; |
|
454 |
uint64_t histo2[HISTOSZ]; |
|
455 |
int i, maxidx; |
|
456 |
||
457 |
if (mdb_readvar(&ht, "dbuf_hash_table") == -1) { |
|
458 |
mdb_warn("failed to read 'dbuf_hash_table'"); |
|
459 |
return (DCMD_ERR); |
|
460 |
} |
|
461 |
||
462 |
for (i = 0; i < HISTOSZ; i++) { |
|
463 |
histo[i] = 0; |
|
464 |
histo2[i] = 0; |
|
465 |
} |
|
466 |
||
467 |
ndbufs = 0; |
|
468 |
for (bucket = 0; bucket < ht.hash_table_mask+1; bucket++) { |
|
469 |
int len; |
|
470 |
||
471 |
if (mdb_vread(&dbp, sizeof (void *), |
|
472 |
(uintptr_t)(ht.hash_table+bucket)) == -1) { |
|
473 |
mdb_warn("failed to read hash bucket %u at %p", |
|
474 |
bucket, ht.hash_table+bucket); |
|
475 |
return (DCMD_ERR); |
|
476 |
} |
|
477 |
||
478 |
len = 0; |
|
479 |
while (dbp != 0) { |
|
480 |
if (mdb_vread(&db, sizeof (dmu_buf_impl_t), |
|
481 |
dbp) == -1) { |
|
482 |
mdb_warn("failed to read dbuf at %p", dbp); |
|
483 |
return (DCMD_ERR); |
|
484 |
} |
|
485 |
dbp = (uintptr_t)db.db_hash_next; |
|
486 |
for (i = MIN(len, HISTOSZ - 1); i >= 0; i--) |
|
487 |
histo2[i]++; |
|
488 |
len++; |
|
489 |
ndbufs++; |
|
490 |
} |
|
491 |
||
492 |
if (len >= HISTOSZ) |
|
493 |
len = HISTOSZ-1; |
|
494 |
histo[len]++; |
|
495 |
} |
|
496 |
||
497 |
mdb_printf("hash table has %llu buckets, %llu dbufs " |
|
498 |
"(avg %llu buckets/dbuf)\n", |
|
499 |
ht.hash_table_mask+1, ndbufs, |
|
500 |
(ht.hash_table_mask+1)/ndbufs); |
|
501 |
||
502 |
mdb_printf("\n"); |
|
503 |
maxidx = 0; |
|
504 |
for (i = 0; i < HISTOSZ; i++) |
|
505 |
if (histo[i] > 0) |
|
506 |
maxidx = i; |
|
507 |
mdb_printf("hash chain length number of buckets\n"); |
|
508 |
for (i = 0; i <= maxidx; i++) |
|
509 |
mdb_printf("%u %llu\n", i, histo[i]); |
|
510 |
||
511 |
mdb_printf("\n"); |
|
512 |
maxidx = 0; |
|
513 |
for (i = 0; i < HISTOSZ; i++) |
|
514 |
if (histo2[i] > 0) |
|
515 |
maxidx = i; |
|
516 |
mdb_printf("hash chain depth number of dbufs\n"); |
|
517 |
for (i = 0; i <= maxidx; i++) |
|
518 |
mdb_printf("%u or more %llu %llu%%\n", |
|
519 |
i, histo2[i], histo2[i]*100/ndbufs); |
|
520 |
||
521 |
||
522 |
return (DCMD_OK); |
|
523 |
} |
|
524 |
||
11609
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
525 |
#define CHAIN_END 0xffff |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
526 |
/* |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
527 |
* ::zap_leaf [-v] |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
528 |
* |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
529 |
* 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
|
530 |
*/ |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
531 |
/* ARGSUSED */ |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
532 |
static int |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
533 |
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
|
534 |
{ |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
535 |
char buf[16*1024]; |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
536 |
int verbose = B_FALSE; |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
537 |
int four = B_FALSE; |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
538 |
zap_leaf_t l; |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
539 |
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
|
540 |
int i; |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
541 |
|
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
542 |
if (mdb_getopts(argc, argv, |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
543 |
'v', MDB_OPT_SETBITS, TRUE, &verbose, |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
544 |
'4', MDB_OPT_SETBITS, TRUE, &four, |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
545 |
NULL) != argc) |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
546 |
return (DCMD_USAGE); |
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 |
l.l_phys = zlp; |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
549 |
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
|
550 |
if (four) |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
551 |
l.l_bs = 12; |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
552 |
|
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
553 |
if (!(flags & DCMD_ADDRSPEC)) { |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
554 |
return (DCMD_USAGE); |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
555 |
} |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
556 |
|
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
557 |
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
|
558 |
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
|
559 |
return (DCMD_ERR); |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
560 |
} |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
561 |
|
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
562 |
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
|
563 |
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
|
564 |
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
|
565 |
return (DCMD_ERR); |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
566 |
} |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
567 |
|
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
568 |
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
|
569 |
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
|
570 |
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
|
571 |
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
|
572 |
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
|
573 |
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
|
574 |
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
|
575 |
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
|
576 |
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
|
577 |
"ENTRIES_CDSORTED" : ""); |
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 (verbose) { |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
580 |
mdb_printf(" hash table:\n"); |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
581 |
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
|
582 |
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
|
583 |
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
|
584 |
} |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
585 |
} |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
586 |
|
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
587 |
mdb_printf(" chunks:\n"); |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
588 |
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
|
589 |
/* LINTED: alignment */ |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
590 |
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
|
591 |
switch (zlc->l_entry.le_type) { |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
592 |
case ZAP_CHUNK_FREE: |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
593 |
if (verbose) { |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
594 |
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
|
595 |
i, zlc->l_free.lf_next); |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
596 |
} |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
597 |
break; |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
598 |
case ZAP_CHUNK_ENTRY: |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
599 |
mdb_printf(" %u: entry\n", i); |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
600 |
if (verbose) { |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
601 |
mdb_printf(" le_next = %u\n", |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
602 |
zlc->l_entry.le_next); |
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(" le_name_chunk = %u\n", |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
605 |
zlc->l_entry.le_name_chunk); |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
606 |
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
|
607 |
zlc->l_entry.le_name_numints); |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
608 |
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
|
609 |
zlc->l_entry.le_value_chunk); |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
610 |
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
|
611 |
zlc->l_entry.le_value_intlen); |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
612 |
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
|
613 |
zlc->l_entry.le_value_numints); |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
614 |
mdb_printf(" le_cd = %u\n", |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
615 |
zlc->l_entry.le_cd); |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
616 |
mdb_printf(" le_hash = %llx\n", |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
617 |
zlc->l_entry.le_hash); |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
618 |
break; |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
619 |
case ZAP_CHUNK_ARRAY: |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
620 |
mdb_printf(" %u: array \"%s\"\n", |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
621 |
i, zlc->l_array.la_array); |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
622 |
if (verbose) { |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
623 |
int j; |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
624 |
mdb_printf(" "); |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
625 |
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
|
626 |
mdb_printf("%02x ", |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
627 |
zlc->l_array.la_array[j]); |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
628 |
} |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
629 |
mdb_printf("\n"); |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
630 |
} |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
631 |
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
|
632 |
mdb_printf(" lf_next = %u\n", |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
633 |
zlc->l_array.la_next); |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
634 |
} |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
635 |
break; |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
636 |
default: |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
637 |
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
|
638 |
zlc->l_entry.le_type); |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
639 |
} |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
640 |
} |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
641 |
|
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
642 |
return (DCMD_OK); |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
643 |
} |
3b5da7ebb54d
6920880 assertion failure in dbuf_write_ready()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11422
diff
changeset
|
644 |
|
789 | 645 |
typedef struct dbufs_data { |
646 |
mdb_ctf_id_t id; |
|
647 |
uint64_t objset; |
|
648 |
uint64_t object; |
|
649 |
uint64_t level; |
|
650 |
uint64_t blkid; |
|
651 |
char *osname; |
|
652 |
} dbufs_data_t; |
|
653 |
||
654 |
#define DBUFS_UNSET (0xbaddcafedeadbeefULL) |
|
655 |
||
656 |
/* ARGSUSED */ |
|
657 |
static int |
|
658 |
dbufs_cb(uintptr_t addr, const void *unknown, void *arg) |
|
659 |
{ |
|
660 |
dbufs_data_t *data = arg; |
|
661 |
uintptr_t objset; |
|
662 |
dmu_buf_t db; |
|
663 |
uint8_t level; |
|
664 |
uint64_t blkid; |
|
665 |
char osname[MAXNAMELEN]; |
|
666 |
||
667 |
if (GETMEMBID(addr, &data->id, db_objset, objset) || |
|
668 |
GETMEMBID(addr, &data->id, db, db) || |
|
669 |
GETMEMBID(addr, &data->id, db_level, level) || |
|
670 |
GETMEMBID(addr, &data->id, db_blkid, blkid)) { |
|
671 |
return (WALK_ERR); |
|
672 |
} |
|
673 |
||
674 |
if ((data->objset == DBUFS_UNSET || data->objset == objset) && |
|
675 |
(data->osname == NULL || (objset_name(objset, osname) == 0 && |
|
4055 | 676 |
strcmp(data->osname, osname) == 0)) && |
789 | 677 |
(data->object == DBUFS_UNSET || data->object == db.db_object) && |
678 |
(data->level == DBUFS_UNSET || data->level == level) && |
|
679 |
(data->blkid == DBUFS_UNSET || data->blkid == blkid)) { |
|
680 |
mdb_printf("%#lr\n", addr); |
|
681 |
} |
|
682 |
return (WALK_NEXT); |
|
683 |
} |
|
684 |
||
685 |
/* ARGSUSED */ |
|
686 |
static int |
|
687 |
dbufs(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) |
|
688 |
{ |
|
689 |
dbufs_data_t data; |
|
690 |
char *object = NULL; |
|
691 |
char *blkid = NULL; |
|
692 |
||
693 |
data.objset = data.object = data.level = data.blkid = DBUFS_UNSET; |
|
694 |
data.osname = NULL; |
|
695 |
||
696 |
if (mdb_getopts(argc, argv, |
|
697 |
'O', MDB_OPT_UINT64, &data.objset, |
|
698 |
'n', MDB_OPT_STR, &data.osname, |
|
699 |
'o', MDB_OPT_STR, &object, |
|
700 |
'l', MDB_OPT_UINT64, &data.level, |
|
701 |
'b', MDB_OPT_STR, &blkid) != argc) { |
|
702 |
return (DCMD_USAGE); |
|
703 |
} |
|
704 |
||
705 |
if (object) { |
|
706 |
if (strcmp(object, "mdn") == 0) { |
|
707 |
data.object = DMU_META_DNODE_OBJECT; |
|
708 |
} else { |
|
709 |
data.object = mdb_strtoull(object); |
|
710 |
} |
|
711 |
} |
|
712 |
||
713 |
if (blkid) { |
|
714 |
if (strcmp(blkid, "bonus") == 0) { |
|
715 |
data.blkid = DB_BONUS_BLKID; |
|
716 |
} else { |
|
717 |
data.blkid = mdb_strtoull(blkid); |
|
718 |
} |
|
719 |
} |
|
720 |
||
721 |
if (mdb_ctf_lookup_by_name("struct dmu_buf_impl", &data.id) == -1) { |
|
722 |
mdb_warn("couldn't find struct dmu_buf_impl_t"); |
|
723 |
return (DCMD_ERR); |
|
724 |
} |
|
725 |
||
2459
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
726 |
if (mdb_walk("dmu_buf_impl_t", dbufs_cb, &data) != 0) { |
789 | 727 |
mdb_warn("can't walk dbufs"); |
728 |
return (DCMD_ERR); |
|
729 |
} |
|
730 |
||
731 |
return (DCMD_OK); |
|
732 |
} |
|
733 |
||
734 |
typedef struct abuf_find_data { |
|
735 |
dva_t dva; |
|
736 |
mdb_ctf_id_t id; |
|
737 |
} abuf_find_data_t; |
|
738 |
||
739 |
/* ARGSUSED */ |
|
740 |
static int |
|
741 |
abuf_find_cb(uintptr_t addr, const void *unknown, void *arg) |
|
742 |
{ |
|
743 |
abuf_find_data_t *data = arg; |
|
744 |
dva_t dva; |
|
745 |
||
746 |
if (GETMEMBID(addr, &data->id, b_dva, dva)) { |
|
747 |
return (WALK_ERR); |
|
748 |
} |
|
749 |
||
750 |
if (dva.dva_word[0] == data->dva.dva_word[0] && |
|
751 |
dva.dva_word[1] == data->dva.dva_word[1]) { |
|
752 |
mdb_printf("%#lr\n", addr); |
|
753 |
} |
|
754 |
return (WALK_NEXT); |
|
755 |
} |
|
756 |
||
757 |
/* ARGSUSED */ |
|
758 |
static int |
|
759 |
abuf_find(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) |
|
760 |
{ |
|
761 |
abuf_find_data_t data; |
|
762 |
GElf_Sym sym; |
|
763 |
int i; |
|
764 |
const char *syms[] = { |
|
2885 | 765 |
"ARC_mru", |
766 |
"ARC_mru_ghost", |
|
767 |
"ARC_mfu", |
|
768 |
"ARC_mfu_ghost", |
|
789 | 769 |
}; |
770 |
||
771 |
if (argc != 2) |
|
772 |
return (DCMD_USAGE); |
|
773 |
||
774 |
for (i = 0; i < 2; i ++) { |
|
775 |
switch (argv[i].a_type) { |
|
776 |
case MDB_TYPE_STRING: |
|
777 |
data.dva.dva_word[i] = mdb_strtoull(argv[i].a_un.a_str); |
|
778 |
break; |
|
779 |
case MDB_TYPE_IMMEDIATE: |
|
780 |
data.dva.dva_word[i] = argv[i].a_un.a_val; |
|
781 |
break; |
|
782 |
default: |
|
783 |
return (DCMD_USAGE); |
|
784 |
} |
|
785 |
} |
|
786 |
||
787 |
if (mdb_ctf_lookup_by_name("struct arc_buf_hdr", &data.id) == -1) { |
|
788 |
mdb_warn("couldn't find struct arc_buf_hdr"); |
|
789 |
return (DCMD_ERR); |
|
790 |
} |
|
791 |
||
792 |
for (i = 0; i < sizeof (syms) / sizeof (syms[0]); i++) { |
|
793 |
if (mdb_lookup_by_name(syms[i], &sym)) { |
|
794 |
mdb_warn("can't find symbol %s", syms[i]); |
|
795 |
return (DCMD_ERR); |
|
796 |
} |
|
797 |
||
798 |
if (mdb_pwalk("list", abuf_find_cb, &data, sym.st_value) != 0) { |
|
799 |
mdb_warn("can't walk %s", syms[i]); |
|
800 |
return (DCMD_ERR); |
|
801 |
} |
|
802 |
} |
|
803 |
||
804 |
return (DCMD_OK); |
|
805 |
} |
|
806 |
||
3403 | 807 |
/*ARGSUSED*/ |
808 |
static int |
|
809 |
arc_print(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) |
|
810 |
{ |
|
811 |
kstat_named_t *stats; |
|
812 |
GElf_Sym sym; |
|
4787 | 813 |
int nstats, i; |
3403 | 814 |
uint_t opt_a = FALSE; |
4787 | 815 |
uint_t opt_b = FALSE; |
816 |
uint_t shift = 0; |
|
817 |
const char *suffix; |
|
3403 | 818 |
|
4787 | 819 |
static const char *bytestats[] = { |
820 |
"p", "c", "c_min", "c_max", "size", NULL |
|
821 |
}; |
|
822 |
||
823 |
static const char *extras[] = { |
|
824 |
"arc_no_grow", "arc_tempreserve", |
|
825 |
"arc_meta_used", "arc_meta_limit", "arc_meta_max", |
|
826 |
NULL |
|
3403 | 827 |
}; |
828 |
||
829 |
if (mdb_lookup_by_name("arc_stats", &sym) == -1) { |
|
830 |
mdb_warn("failed to find 'arc_stats'"); |
|
831 |
return (DCMD_ERR); |
|
832 |
} |
|
833 |
||
834 |
stats = mdb_zalloc(sym.st_size, UM_SLEEP | UM_GC); |
|
835 |
||
836 |
if (mdb_vread(stats, sym.st_size, sym.st_value) == -1) { |
|
837 |
mdb_warn("couldn't read 'arc_stats' at %p", sym.st_value); |
|
838 |
return (DCMD_ERR); |
|
839 |
} |
|
840 |
||
841 |
nstats = sym.st_size / sizeof (kstat_named_t); |
|
842 |
||
4787 | 843 |
/* NB: -a / opt_a are ignored for backwards compatability */ |
844 |
if (mdb_getopts(argc, argv, |
|
845 |
'a', MDB_OPT_SETBITS, TRUE, &opt_a, |
|
846 |
'b', MDB_OPT_SETBITS, TRUE, &opt_b, |
|
847 |
'k', MDB_OPT_SETBITS, 10, &shift, |
|
848 |
'm', MDB_OPT_SETBITS, 20, &shift, |
|
849 |
'g', MDB_OPT_SETBITS, 30, &shift, |
|
850 |
NULL) != argc) |
|
3403 | 851 |
return (DCMD_USAGE); |
852 |
||
4787 | 853 |
if (!opt_b && !shift) |
854 |
shift = 20; |
|
3403 | 855 |
|
4787 | 856 |
switch (shift) { |
857 |
case 0: |
|
858 |
suffix = "B"; |
|
859 |
break; |
|
860 |
case 10: |
|
861 |
suffix = "KB"; |
|
862 |
break; |
|
863 |
case 20: |
|
864 |
suffix = "MB"; |
|
865 |
break; |
|
866 |
case 30: |
|
867 |
suffix = "GB"; |
|
868 |
break; |
|
869 |
default: |
|
870 |
suffix = "XX"; |
|
3403 | 871 |
} |
872 |
||
4787 | 873 |
for (i = 0; i < nstats; i++) { |
874 |
int j; |
|
875 |
boolean_t bytes = B_FALSE; |
|
3403 | 876 |
|
4787 | 877 |
for (j = 0; bytestats[j]; j++) { |
878 |
if (strcmp(stats[i].name, bytestats[j]) == 0) { |
|
879 |
bytes = B_TRUE; |
|
880 |
break; |
|
3403 | 881 |
} |
882 |
} |
|
883 |
||
4787 | 884 |
if (bytes) { |
885 |
mdb_printf("%-25s = %9llu %s\n", stats[i].name, |
|
886 |
stats[i].value.ui64 >> shift, suffix); |
|
887 |
} else { |
|
888 |
mdb_printf("%-25s = %9llu\n", stats[i].name, |
|
889 |
stats[i].value.ui64); |
|
3403 | 890 |
} |
891 |
} |
|
892 |
||
4787 | 893 |
for (i = 0; extras[i]; i++) { |
894 |
uint64_t buf; |
|
895 |
||
896 |
if (mdb_lookup_by_name(extras[i], &sym) == -1) { |
|
897 |
mdb_warn("failed to find '%s'", extras[i]); |
|
898 |
return (DCMD_ERR); |
|
899 |
} |
|
900 |
||
901 |
if (sym.st_size != sizeof (uint64_t) && |
|
902 |
sym.st_size != sizeof (uint32_t)) { |
|
903 |
mdb_warn("expected scalar for variable '%s'\n", |
|
904 |
extras[i]); |
|
905 |
return (DCMD_ERR); |
|
906 |
} |
|
3403 | 907 |
|
4787 | 908 |
if (mdb_vread(&buf, sym.st_size, sym.st_value) == -1) { |
909 |
mdb_warn("couldn't read '%s'", extras[i]); |
|
910 |
return (DCMD_ERR); |
|
911 |
} |
|
912 |
||
913 |
mdb_printf("%-25s = ", extras[i]); |
|
914 |
||
915 |
/* NB: all the 64-bit extras happen to be byte counts */ |
|
916 |
if (sym.st_size == sizeof (uint64_t)) |
|
917 |
mdb_printf("%9llu %s\n", buf >> shift, suffix); |
|
918 |
||
919 |
if (sym.st_size == sizeof (uint32_t)) |
|
920 |
mdb_printf("%9d\n", *((uint32_t *)&buf)); |
|
921 |
} |
|
3403 | 922 |
return (DCMD_OK); |
923 |
} |
|
924 |
||
789 | 925 |
/* |
926 |
* ::spa |
|
927 |
* |
|
928 |
* -c Print configuration information as well |
|
929 |
* -v Print vdev state |
|
930 |
* -e Print vdev error stats |
|
931 |
* |
|
932 |
* Print a summarized spa_t. When given no arguments, prints out a table of all |
|
933 |
* active pools on the system. |
|
934 |
*/ |
|
935 |
/* ARGSUSED */ |
|
936 |
static int |
|
937 |
spa_print(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) |
|
938 |
{ |
|
939 |
spa_t spa; |
|
940 |
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
|
941 |
"SPARE", "L2CACHE", "UNINIT", "UNAVAIL", "POTENTIAL" }; |
789 | 942 |
const char *state; |
943 |
int config = FALSE; |
|
944 |
int vdevs = FALSE; |
|
945 |
int errors = FALSE; |
|
946 |
||
947 |
if (mdb_getopts(argc, argv, |
|
948 |
'c', MDB_OPT_SETBITS, TRUE, &config, |
|
949 |
'v', MDB_OPT_SETBITS, TRUE, &vdevs, |
|
950 |
'e', MDB_OPT_SETBITS, TRUE, &errors, |
|
951 |
NULL) != argc) |
|
952 |
return (DCMD_USAGE); |
|
953 |
||
954 |
if (!(flags & DCMD_ADDRSPEC)) { |
|
955 |
if (mdb_walk_dcmd("spa", "spa", argc, argv) == -1) { |
|
956 |
mdb_warn("can't walk spa"); |
|
957 |
return (DCMD_ERR); |
|
958 |
} |
|
959 |
||
960 |
return (DCMD_OK); |
|
961 |
} |
|
962 |
||
963 |
if (flags & DCMD_PIPE_OUT) { |
|
964 |
mdb_printf("%#lr\n", addr); |
|
965 |
return (DCMD_OK); |
|
966 |
} |
|
967 |
||
968 |
if (DCMD_HDRSPEC(flags)) |
|
969 |
mdb_printf("%<u>%-?s %9s %-*s%</u>\n", "ADDR", "STATE", |
|
970 |
sizeof (uintptr_t) == 4 ? 60 : 52, "NAME"); |
|
971 |
||
972 |
if (mdb_vread(&spa, sizeof (spa), addr) == -1) { |
|
973 |
mdb_warn("failed to read spa_t at %p", addr); |
|
974 |
return (DCMD_ERR); |
|
975 |
} |
|
976 |
||
977 |
if (spa.spa_state < 0 || spa.spa_state > POOL_STATE_UNAVAIL) |
|
1544 | 978 |
state = "UNKNOWN"; |
789 | 979 |
else |
980 |
state = statetab[spa.spa_state]; |
|
981 |
||
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
|
982 |
mdb_printf("%0?p %9s %s\n", addr, state, spa.spa_name); |
789 | 983 |
|
984 |
if (config) { |
|
985 |
mdb_printf("\n"); |
|
986 |
mdb_inc_indent(4); |
|
987 |
if (mdb_call_dcmd("spa_config", addr, flags, 0, |
|
988 |
NULL) != DCMD_OK) |
|
989 |
return (DCMD_ERR); |
|
990 |
mdb_dec_indent(4); |
|
991 |
} |
|
992 |
||
993 |
if (vdevs || errors) { |
|
994 |
mdb_arg_t v; |
|
995 |
||
996 |
v.a_type = MDB_TYPE_STRING; |
|
997 |
v.a_un.a_str = "-e"; |
|
998 |
||
999 |
mdb_printf("\n"); |
|
1000 |
mdb_inc_indent(4); |
|
1001 |
if (mdb_call_dcmd("spa_vdevs", addr, flags, errors ? 1 : 0, |
|
1002 |
&v) != DCMD_OK) |
|
1003 |
return (DCMD_ERR); |
|
1004 |
mdb_dec_indent(4); |
|
1005 |
} |
|
1006 |
||
1007 |
return (DCMD_OK); |
|
1008 |
} |
|
1009 |
||
1010 |
/* |
|
1011 |
* ::spa_config |
|
1012 |
* |
|
1013 |
* Given a spa_t, print the configuration information stored in spa_config. |
|
1014 |
* Since it's just an nvlist, format it as an indented list of name=value pairs. |
|
1015 |
* We simply read the value of spa_config and pass off to ::nvlist. |
|
1016 |
*/ |
|
1017 |
/* ARGSUSED */ |
|
1018 |
static int |
|
1019 |
spa_print_config(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) |
|
1020 |
{ |
|
1021 |
spa_t spa; |
|
1022 |
||
1023 |
if (argc != 0 || !(flags & DCMD_ADDRSPEC)) |
|
1024 |
return (DCMD_USAGE); |
|
1025 |
||
1026 |
if (mdb_vread(&spa, sizeof (spa), addr) == -1) { |
|
1027 |
mdb_warn("failed to read spa_t at %p", addr); |
|
1028 |
return (DCMD_ERR); |
|
1029 |
} |
|
1030 |
||
1031 |
if (spa.spa_config == NULL) { |
|
1032 |
mdb_printf("(none)\n"); |
|
1033 |
return (DCMD_OK); |
|
1034 |
} |
|
1035 |
||
1036 |
return (mdb_call_dcmd("nvlist", (uintptr_t)spa.spa_config, flags, |
|
1037 |
0, NULL)); |
|
1038 |
} |
|
1039 |
||
1040 |
/* |
|
1041 |
* ::vdev |
|
1042 |
* |
|
1043 |
* Print out a summarized vdev_t, in the following form: |
|
1044 |
* |
|
1045 |
* ADDR STATE AUX DESC |
|
1046 |
* fffffffbcde23df0 HEALTHY - /dev/dsk/c0t0d0 |
|
1047 |
* |
|
1048 |
* If '-r' is specified, recursively visit all children. |
|
1049 |
* |
|
1050 |
* With '-e', the statistics associated with the vdev are printed as well. |
|
1051 |
*/ |
|
1052 |
static int |
|
3059 | 1053 |
do_print_vdev(uintptr_t addr, int flags, int depth, int stats, |
789 | 1054 |
int recursive) |
1055 |
{ |
|
1056 |
vdev_t vdev; |
|
1057 |
char desc[MAXNAMELEN]; |
|
1058 |
int c, children; |
|
1059 |
uintptr_t *child; |
|
1060 |
const char *state, *aux; |
|
1061 |
||
1062 |
if (mdb_vread(&vdev, sizeof (vdev), (uintptr_t)addr) == -1) { |
|
1063 |
mdb_warn("failed to read vdev_t at %p\n", (uintptr_t)addr); |
|
1064 |
return (DCMD_ERR); |
|
1065 |
} |
|
1066 |
||
1067 |
if (flags & DCMD_PIPE_OUT) { |
|
1068 |
mdb_printf("%#lr", addr); |
|
1069 |
} else { |
|
1070 |
if (vdev.vdev_path != NULL) { |
|
1071 |
if (mdb_readstr(desc, sizeof (desc), |
|
1072 |
(uintptr_t)vdev.vdev_path) == -1) { |
|
1073 |
mdb_warn("failed to read vdev_path at %p\n", |
|
1074 |
vdev.vdev_path); |
|
1075 |
return (DCMD_ERR); |
|
1076 |
} |
|
1077 |
} else if (vdev.vdev_ops != NULL) { |
|
1078 |
vdev_ops_t ops; |
|
1079 |
if (mdb_vread(&ops, sizeof (ops), |
|
1080 |
(uintptr_t)vdev.vdev_ops) == -1) { |
|
1081 |
mdb_warn("failed to read vdev_ops at %p\n", |
|
1082 |
vdev.vdev_ops); |
|
1083 |
return (DCMD_ERR); |
|
1084 |
} |
|
1085 |
(void) strcpy(desc, ops.vdev_op_type); |
|
1086 |
} else { |
|
1087 |
(void) strcpy(desc, "<unknown>"); |
|
1088 |
} |
|
1089 |
||
1090 |
if (depth == 0 && DCMD_HDRSPEC(flags)) |
|
1091 |
mdb_printf("%<u>%-?s %-9s %-12s %-*s%</u>\n", |
|
1092 |
"ADDR", "STATE", "AUX", |
|
1093 |
sizeof (uintptr_t) == 4 ? 43 : 35, |
|
1094 |
"DESCRIPTION"); |
|
1095 |
||
1096 |
mdb_printf("%0?p ", addr); |
|
1097 |
||
1098 |
switch (vdev.vdev_state) { |
|
1099 |
case VDEV_STATE_CLOSED: |
|
4055 | 1100 |
state = "CLOSED"; |
1101 |
break; |
|
789 | 1102 |
case VDEV_STATE_OFFLINE: |
4055 | 1103 |
state = "OFFLINE"; |
1104 |
break; |
|
789 | 1105 |
case VDEV_STATE_CANT_OPEN: |
4055 | 1106 |
state = "CANT_OPEN"; |
1107 |
break; |
|
789 | 1108 |
case VDEV_STATE_DEGRADED: |
4055 | 1109 |
state = "DEGRADED"; |
1110 |
break; |
|
789 | 1111 |
case VDEV_STATE_HEALTHY: |
4055 | 1112 |
state = "HEALTHY"; |
1113 |
break; |
|
4451 | 1114 |
case VDEV_STATE_REMOVED: |
1115 |
state = "REMOVED"; |
|
1116 |
break; |
|
1117 |
case VDEV_STATE_FAULTED: |
|
1118 |
state = "FAULTED"; |
|
1119 |
break; |
|
789 | 1120 |
default: |
4055 | 1121 |
state = "UNKNOWN"; |
1122 |
break; |
|
789 | 1123 |
} |
1124 |
||
1125 |
switch (vdev.vdev_stat.vs_aux) { |
|
1126 |
case VDEV_AUX_NONE: |
|
1127 |
aux = "-"; |
|
1128 |
break; |
|
1129 |
case VDEV_AUX_OPEN_FAILED: |
|
1130 |
aux = "OPEN_FAILED"; |
|
1131 |
break; |
|
1132 |
case VDEV_AUX_CORRUPT_DATA: |
|
1133 |
aux = "CORRUPT_DATA"; |
|
1134 |
break; |
|
1135 |
case VDEV_AUX_NO_REPLICAS: |
|
1136 |
aux = "NO_REPLICAS"; |
|
1137 |
break; |
|
1138 |
case VDEV_AUX_BAD_GUID_SUM: |
|
1139 |
aux = "BAD_GUID_SUM"; |
|
1140 |
break; |
|
1141 |
case VDEV_AUX_TOO_SMALL: |
|
1142 |
aux = "TOO_SMALL"; |
|
1143 |
break; |
|
1144 |
case VDEV_AUX_BAD_LABEL: |
|
1145 |
aux = "BAD_LABEL"; |
|
1146 |
break; |
|
7294 | 1147 |
case VDEV_AUX_VERSION_NEWER: |
1148 |
aux = "VERS_NEWER"; |
|
1149 |
break; |
|
1150 |
case VDEV_AUX_VERSION_OLDER: |
|
1151 |
aux = "VERS_OLDER"; |
|
1152 |
break; |
|
1153 |
case VDEV_AUX_SPARED: |
|
1154 |
aux = "SPARED"; |
|
1155 |
break; |
|
1156 |
case VDEV_AUX_ERR_EXCEEDED: |
|
1157 |
aux = "ERR_EXCEEDED"; |
|
1158 |
break; |
|
1159 |
case VDEV_AUX_IO_FAILURE: |
|
1160 |
aux = "IO_FAILURE"; |
|
1161 |
break; |
|
1162 |
case VDEV_AUX_BAD_LOG: |
|
1163 |
aux = "BAD_LOG"; |
|
1164 |
break; |
|
11422
42768837421d
PSARC/2009/511 zpool split
Mark J Musante <Mark.Musante@Sun.COM>
parents:
11147
diff
changeset
|
1165 |
case VDEV_AUX_EXTERNAL: |
42768837421d
PSARC/2009/511 zpool split
Mark J Musante <Mark.Musante@Sun.COM>
parents:
11147
diff
changeset
|
1166 |
aux = "EXTERNAL"; |
42768837421d
PSARC/2009/511 zpool split
Mark J Musante <Mark.Musante@Sun.COM>
parents:
11147
diff
changeset
|
1167 |
break; |
42768837421d
PSARC/2009/511 zpool split
Mark J Musante <Mark.Musante@Sun.COM>
parents:
11147
diff
changeset
|
1168 |
case VDEV_AUX_SPLIT_POOL: |
42768837421d
PSARC/2009/511 zpool split
Mark J Musante <Mark.Musante@Sun.COM>
parents:
11147
diff
changeset
|
1169 |
aux = "SPLIT_POOL"; |
42768837421d
PSARC/2009/511 zpool split
Mark J Musante <Mark.Musante@Sun.COM>
parents:
11147
diff
changeset
|
1170 |
break; |
789 | 1171 |
default: |
1172 |
aux = "UNKNOWN"; |
|
1173 |
break; |
|
1174 |
} |
|
1175 |
||
1176 |
mdb_printf("%-9s %-12s %*s%s\n", state, aux, depth, "", desc); |
|
1177 |
||
1178 |
if (stats) { |
|
1179 |
vdev_stat_t *vs = &vdev.vdev_stat; |
|
1180 |
int i; |
|
1181 |
||
1182 |
mdb_inc_indent(4); |
|
1183 |
mdb_printf("\n"); |
|
1184 |
mdb_printf("%<u> %12s %12s %12s %12s " |
|
1185 |
"%12s%</u>\n", "READ", "WRITE", "FREE", "CLAIM", |
|
1186 |
"IOCTL"); |
|
1187 |
mdb_printf("OPS "); |
|
1188 |
for (i = 1; i < ZIO_TYPES; i++) |
|
1189 |
mdb_printf("%11#llx%s", vs->vs_ops[i], |
|
1190 |
i == ZIO_TYPES - 1 ? "" : " "); |
|
1191 |
mdb_printf("\n"); |
|
1192 |
mdb_printf("BYTES "); |
|
1193 |
for (i = 1; i < ZIO_TYPES; i++) |
|
1194 |
mdb_printf("%11#llx%s", vs->vs_bytes[i], |
|
1195 |
i == ZIO_TYPES - 1 ? "" : " "); |
|
1196 |
||
1197 |
||
1198 |
mdb_printf("\n"); |
|
1199 |
mdb_printf("EREAD %10#llx\n", vs->vs_read_errors); |
|
1200 |
mdb_printf("EWRITE %10#llx\n", vs->vs_write_errors); |
|
1201 |
mdb_printf("ECKSUM %10#llx\n", |
|
1202 |
vs->vs_checksum_errors); |
|
1203 |
mdb_dec_indent(4); |
|
1204 |
} |
|
1205 |
||
3059 | 1206 |
if (stats) |
789 | 1207 |
mdb_printf("\n"); |
1208 |
} |
|
1209 |
||
1210 |
children = vdev.vdev_children; |
|
1211 |
||
1212 |
if (children == 0 || !recursive) |
|
1213 |
return (DCMD_OK); |
|
1214 |
||
1215 |
child = mdb_alloc(children * sizeof (void *), UM_SLEEP | UM_GC); |
|
1216 |
if (mdb_vread(child, children * sizeof (void *), |
|
1217 |
(uintptr_t)vdev.vdev_child) == -1) { |
|
1218 |
mdb_warn("failed to read vdev children at %p", vdev.vdev_child); |
|
1219 |
return (DCMD_ERR); |
|
1220 |
} |
|
1221 |
||
1222 |
for (c = 0; c < children; c++) { |
|
3059 | 1223 |
if (do_print_vdev(child[c], flags, depth + 2, stats, |
789 | 1224 |
recursive)) |
1225 |
return (DCMD_ERR); |
|
1226 |
} |
|
1227 |
||
1228 |
return (DCMD_OK); |
|
1229 |
} |
|
1230 |
||
1231 |
static int |
|
1232 |
vdev_print(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) |
|
1233 |
{ |
|
1234 |
int recursive = FALSE; |
|
1235 |
int stats = FALSE; |
|
6643
3a34b0dbb107
6625086 changing cachefile doesn't remove old cache on last user
eschrock
parents:
6245
diff
changeset
|
1236 |
uint64_t depth = 0; |
789 | 1237 |
|
1238 |
if (mdb_getopts(argc, argv, |
|
1239 |
'r', MDB_OPT_SETBITS, TRUE, &recursive, |
|
1240 |
'e', MDB_OPT_SETBITS, TRUE, &stats, |
|
6643
3a34b0dbb107
6625086 changing cachefile doesn't remove old cache on last user
eschrock
parents:
6245
diff
changeset
|
1241 |
'd', MDB_OPT_UINT64, &depth, |
789 | 1242 |
NULL) != argc) |
1243 |
return (DCMD_USAGE); |
|
1244 |
||
1245 |
if (!(flags & DCMD_ADDRSPEC)) { |
|
1246 |
mdb_warn("no vdev_t address given\n"); |
|
1247 |
return (DCMD_ERR); |
|
1248 |
} |
|
1249 |
||
6643
3a34b0dbb107
6625086 changing cachefile doesn't remove old cache on last user
eschrock
parents:
6245
diff
changeset
|
1250 |
return (do_print_vdev(addr, flags, (int)depth, stats, recursive)); |
789 | 1251 |
} |
1252 |
||
2459
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1253 |
typedef struct metaslab_walk_data { |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1254 |
uint64_t mw_numvdevs; |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1255 |
uintptr_t *mw_vdevs; |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1256 |
int mw_curvdev; |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1257 |
uint64_t mw_nummss; |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1258 |
uintptr_t *mw_mss; |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1259 |
int mw_curms; |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1260 |
} metaslab_walk_data_t; |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1261 |
|
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1262 |
static int |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1263 |
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
|
1264 |
{ |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1265 |
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
|
1266 |
metaslab_t ms; |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1267 |
uintptr_t msp; |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1268 |
|
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1269 |
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
|
1270 |
return (WALK_DONE); |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1271 |
|
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1272 |
if (mw->mw_mss == NULL) { |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1273 |
uintptr_t mssp; |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1274 |
uintptr_t vdevp; |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1275 |
|
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1276 |
ASSERT(mw->mw_curms == 0); |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1277 |
ASSERT(mw->mw_nummss == 0); |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1278 |
|
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1279 |
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
|
1280 |
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
|
1281 |
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
|
1282 |
return (WALK_ERR); |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1283 |
} |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1284 |
|
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1285 |
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
|
1286 |
UM_SLEEP | UM_GC); |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1287 |
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
|
1288 |
mssp) == -1) { |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1289 |
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
|
1290 |
return (WALK_ERR); |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1291 |
} |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1292 |
} |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1293 |
|
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1294 |
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
|
1295 |
mw->mw_mss = NULL; |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1296 |
mw->mw_curms = 0; |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1297 |
mw->mw_nummss = 0; |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1298 |
mw->mw_curvdev++; |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1299 |
return (WALK_NEXT); |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1300 |
} |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1301 |
|
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1302 |
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
|
1303 |
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
|
1304 |
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
|
1305 |
return (WALK_ERR); |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1306 |
} |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1307 |
|
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1308 |
mw->mw_curms++; |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1309 |
|
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1310 |
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
|
1311 |
} |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1312 |
|
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1313 |
/* ARGSUSED */ |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1314 |
static int |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1315 |
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
|
1316 |
{ |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1317 |
metaslab_walk_data_t *mw; |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1318 |
uintptr_t root_vdevp; |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1319 |
uintptr_t childp; |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1320 |
|
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1321 |
if (wsp->walk_addr == NULL) { |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1322 |
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
|
1323 |
return (WALK_ERR); |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1324 |
} |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1325 |
|
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1326 |
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
|
1327 |
|
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1328 |
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
|
1329 |
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
|
1330 |
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
|
1331 |
return (DCMD_ERR); |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1332 |
} |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1333 |
|
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1334 |
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
|
1335 |
UM_SLEEP | UM_GC); |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1336 |
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
|
1337 |
childp) == -1) { |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1338 |
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
|
1339 |
return (DCMD_ERR); |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1340 |
} |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1341 |
|
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1342 |
wsp->walk_data = mw; |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1343 |
|
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1344 |
return (WALK_NEXT); |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1345 |
} |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1346 |
|
789 | 1347 |
typedef struct mdb_spa { |
1348 |
uintptr_t spa_dsl_pool; |
|
1349 |
uintptr_t spa_root_vdev; |
|
1350 |
} mdb_spa_t; |
|
1351 |
||
1352 |
typedef struct mdb_dsl_dir { |
|
1353 |
uintptr_t dd_phys; |
|
1354 |
int64_t dd_space_towrite[TXG_SIZE]; |
|
1355 |
} mdb_dsl_dir_t; |
|
1356 |
||
1357 |
typedef struct mdb_dsl_dir_phys { |
|
1358 |
uint64_t dd_used_bytes; |
|
1359 |
uint64_t dd_compressed_bytes; |
|
1360 |
uint64_t dd_uncompressed_bytes; |
|
1361 |
} mdb_dsl_dir_phys_t; |
|
1362 |
||
1363 |
typedef struct mdb_vdev { |
|
1364 |
uintptr_t vdev_parent; |
|
1365 |
uintptr_t vdev_ms; |
|
1366 |
uint64_t vdev_ms_count; |
|
1367 |
vdev_stat_t vdev_stat; |
|
1368 |
} mdb_vdev_t; |
|
1369 |
||
1370 |
typedef struct mdb_metaslab { |
|
1371 |
space_map_t ms_allocmap[TXG_SIZE]; |
|
1372 |
space_map_t ms_freemap[TXG_SIZE]; |
|
1373 |
space_map_t ms_map; |
|
1732 | 1374 |
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
|
1375 |
space_map_obj_t ms_smo_syncing; |
789 | 1376 |
} mdb_metaslab_t; |
1377 |
||
2459
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1378 |
typedef struct space_data { |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1379 |
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
|
1380 |
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
|
1381 |
uint64_t ms_map; |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1382 |
uint64_t avail; |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1383 |
uint64_t nowavail; |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1384 |
} space_data_t; |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1385 |
|
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1386 |
/* ARGSUSED */ |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1387 |
static int |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1388 |
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
|
1389 |
{ |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1390 |
space_data_t *sd = arg; |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1391 |
mdb_metaslab_t ms; |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1392 |
|
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1393 |
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
|
1394 |
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
|
1395 |
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
|
1396 |
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
|
1397 |
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
|
1398 |
return (WALK_ERR); |
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 |
|
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1401 |
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
|
1402 |
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
|
1403 |
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
|
1404 |
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
|
1405 |
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
|
1406 |
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
|
1407 |
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
|
1408 |
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
|
1409 |
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
|
1410 |
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
|
1411 |
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
|
1412 |
|
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1413 |
return (WALK_NEXT); |
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 |
|
789 | 1416 |
/* |
1417 |
* ::spa_space [-b] |
|
1418 |
* |
|
1419 |
* Given a spa_t, print out it's on-disk space usage and in-core |
|
1420 |
* estimates of future usage. If -b is given, print space in bytes. |
|
1421 |
* Otherwise print in megabytes. |
|
1422 |
*/ |
|
1423 |
/* ARGSUSED */ |
|
1424 |
static int |
|
1425 |
spa_space(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) |
|
1426 |
{ |
|
1427 |
mdb_spa_t spa; |
|
1428 |
uintptr_t dp_root_dir; |
|
1429 |
mdb_dsl_dir_t dd; |
|
1430 |
mdb_dsl_dir_phys_t dsp; |
|
1431 |
uint64_t children; |
|
1432 |
uintptr_t childaddr; |
|
2459
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1433 |
space_data_t sd; |
789 | 1434 |
int shift = 20; |
1435 |
char *suffix = "M"; |
|
1436 |
int bits = FALSE; |
|
1437 |
||
1438 |
if (mdb_getopts(argc, argv, 'b', MDB_OPT_SETBITS, TRUE, &bits, NULL) != |
|
1439 |
argc) |
|
1440 |
return (DCMD_USAGE); |
|
1441 |
if (!(flags & DCMD_ADDRSPEC)) |
|
1442 |
return (DCMD_USAGE); |
|
1443 |
||
1444 |
if (bits) { |
|
1445 |
shift = 0; |
|
1446 |
suffix = ""; |
|
1447 |
} |
|
1448 |
||
1449 |
if (GETMEMB(addr, struct spa, spa_dsl_pool, spa.spa_dsl_pool) || |
|
1450 |
GETMEMB(addr, struct spa, spa_root_vdev, spa.spa_root_vdev) || |
|
1451 |
GETMEMB(spa.spa_root_vdev, struct vdev, vdev_children, children) || |
|
1452 |
GETMEMB(spa.spa_root_vdev, struct vdev, vdev_child, childaddr) || |
|
1453 |
GETMEMB(spa.spa_dsl_pool, struct dsl_pool, |
|
1454 |
dp_root_dir, dp_root_dir) || |
|
1455 |
GETMEMB(dp_root_dir, struct dsl_dir, dd_phys, dd.dd_phys) || |
|
1456 |
GETMEMB(dp_root_dir, struct dsl_dir, |
|
1457 |
dd_space_towrite, dd.dd_space_towrite) || |
|
1458 |
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
|
1459 |
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
|
1460 |
GETMEMB(dd.dd_phys, struct dsl_dir_phys, |
789 | 1461 |
dd_compressed_bytes, dsp.dd_compressed_bytes) || |
1462 |
GETMEMB(dd.dd_phys, struct dsl_dir_phys, |
|
1463 |
dd_uncompressed_bytes, dsp.dd_uncompressed_bytes)) { |
|
1464 |
return (DCMD_ERR); |
|
1465 |
} |
|
1466 |
||
1467 |
mdb_printf("dd_space_towrite = %llu%s %llu%s %llu%s %llu%s\n", |
|
1468 |
dd.dd_space_towrite[0] >> shift, suffix, |
|
1469 |
dd.dd_space_towrite[1] >> shift, suffix, |
|
1470 |
dd.dd_space_towrite[2] >> shift, suffix, |
|
1471 |
dd.dd_space_towrite[3] >> shift, suffix); |
|
1472 |
||
1473 |
mdb_printf("dd_phys.dd_used_bytes = %llu%s\n", |
|
1474 |
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
|
1475 |
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
|
1476 |
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
|
1477 |
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
|
1478 |
dsp.dd_uncompressed_bytes >> shift, suffix); |
789 | 1479 |
|
2459
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1480 |
bzero(&sd, sizeof (sd)); |
7511d9859fcd
6452923 really out of space panic even though ms_map.sm_space > 0
ahrens
parents:
2082
diff
changeset
|
1481 |
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
|
1482 |
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
|
1483 |
return (DCMD_ERR); |
789 | 1484 |
} |
1485 |
||
1486 |
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
|
1487 |
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
|
1488 |
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
|
1489 |
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
|
1490 |
sd.ms_allocmap[3] >> shift, suffix); |
789 | 1491 |
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
|
1492 |
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
|
1493 |
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
|
1494 |
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
|
1495 |
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
|
1496 |
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
|
1497 |
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
|
1498 |
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
|
1499 |
sd.nowavail >> shift, suffix); |
789 | 1500 |
|
1501 |
return (DCMD_OK); |
|
1502 |
} |
|
1503 |
||
1504 |
/* |
|
1505 |
* ::spa_verify |
|
1506 |
* |
|
1507 |
* Given a spa_t, verify that that the pool is self-consistent. |
|
1508 |
* Currently, it only checks to make sure that the vdev tree exists. |
|
1509 |
*/ |
|
1510 |
/* ARGSUSED */ |
|
1511 |
static int |
|
1512 |
spa_verify(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) |
|
1513 |
{ |
|
1514 |
spa_t spa; |
|
1515 |
||
1516 |
if (argc != 0 || !(flags & DCMD_ADDRSPEC)) |
|
1517 |
return (DCMD_USAGE); |
|
1518 |
||
1519 |
if (mdb_vread(&spa, sizeof (spa), addr) == -1) { |
|
1520 |
mdb_warn("failed to read spa_t at %p", addr); |
|
1521 |
return (DCMD_ERR); |
|
1522 |
} |
|
1523 |
||
1524 |
if (spa.spa_root_vdev == NULL) { |
|
1525 |
mdb_printf("no vdev tree present\n"); |
|
1526 |
return (DCMD_OK); |
|
1527 |
} |
|
1528 |
||
1529 |
return (DCMD_OK); |
|
1530 |
} |
|
1531 |
||
8341
53c5e7987263
6783576 ::spa -v should include spares
Eric Schrock <Eric.Schrock@Sun.COM>
parents:
7846
diff
changeset
|
1532 |
static int |
53c5e7987263
6783576 ::spa -v should include spares
Eric Schrock <Eric.Schrock@Sun.COM>
parents:
7846
diff
changeset
|
1533 |
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
|
1534 |
const char *name) |
53c5e7987263
6783576 ::spa -v should include spares
Eric Schrock <Eric.Schrock@Sun.COM>
parents:
7846
diff
changeset
|
1535 |
{ |
53c5e7987263
6783576 ::spa -v should include spares
Eric Schrock <Eric.Schrock@Sun.COM>
parents:
7846
diff
changeset
|
1536 |
uintptr_t *aux; |
53c5e7987263
6783576 ::spa -v should include spares
Eric Schrock <Eric.Schrock@Sun.COM>
parents:
7846
diff
changeset
|
1537 |
size_t len; |
53c5e7987263
6783576 ::spa -v should include spares
Eric Schrock <Eric.Schrock@Sun.COM>
parents:
7846
diff
changeset
|
1538 |
int ret, i; |
53c5e7987263
6783576 ::spa -v should include spares
Eric Schrock <Eric.Schrock@Sun.COM>
parents:
7846
diff
changeset
|
1539 |
|
53c5e7987263
6783576 ::spa -v should include spares
Eric Schrock <Eric.Schrock@Sun.COM>
parents:
7846
diff
changeset
|
1540 |
/* |
53c5e7987263
6783576 ::spa -v should include spares
Eric Schrock <Eric.Schrock@Sun.COM>
parents:
7846
diff
changeset
|
1541 |
* 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
|
1542 |
* 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
|
1543 |
* 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
|
1544 |
* vdev. |
53c5e7987263
6783576 ::spa -v should include spares
Eric Schrock <Eric.Schrock@Sun.COM>
parents:
7846
diff
changeset
|
1545 |
*/ |
53c5e7987263
6783576 ::spa -v should include spares
Eric Schrock <Eric.Schrock@Sun.COM>
parents:
7846
diff
changeset
|
1546 |
if (sav->sav_count != 0) { |
53c5e7987263
6783576 ::spa -v should include spares
Eric Schrock <Eric.Schrock@Sun.COM>
parents:
7846
diff
changeset
|
1547 |
v[1].a_type = MDB_TYPE_STRING; |
53c5e7987263
6783576 ::spa -v should include spares
Eric Schrock <Eric.Schrock@Sun.COM>
parents:
7846
diff
changeset
|
1548 |
v[1].a_un.a_str = "-d"; |
53c5e7987263
6783576 ::spa -v should include spares
Eric Schrock <Eric.Schrock@Sun.COM>
parents:
7846
diff
changeset
|
1549 |
v[2].a_type = MDB_TYPE_IMMEDIATE; |
53c5e7987263
6783576 ::spa -v should include spares
Eric Schrock <Eric.Schrock@Sun.COM>
parents:
7846
diff
changeset
|
1550 |
v[2].a_un.a_val = 2; |
53c5e7987263
6783576 ::spa -v should include spares
Eric Schrock <Eric.Schrock@Sun.COM>
parents:
7846
diff
changeset
|
1551 |
|
53c5e7987263
6783576 ::spa -v should include spares
Eric Schrock <Eric.Schrock@Sun.COM>
parents:
7846
diff
changeset
|
1552 |
len = sav->sav_count * sizeof (uintptr_t); |
53c5e7987263
6783576 ::spa -v should include spares
Eric Schrock <Eric.Schrock@Sun.COM>
parents:
7846
diff
changeset
|
1553 |
aux = mdb_alloc(len, UM_SLEEP); |
53c5e7987263
6783576 ::spa -v should include spares
Eric Schrock <Eric.Schrock@Sun.COM>
parents:
7846
diff
changeset
|
1554 |
if (mdb_vread(aux, len, |
53c5e7987263
6783576 ::spa -v should include spares
Eric Schrock <Eric.Schrock@Sun.COM>
parents:
7846
diff
changeset
|
1555 |
(uintptr_t)sav->sav_vdevs) == -1) { |
53c5e7987263
6783576 ::spa -v should include spares
Eric Schrock <Eric.Schrock@Sun.COM>
parents:
7846
diff
changeset
|
1556 |
mdb_free(aux, len); |
53c5e7987263
6783576 ::spa -v should include spares
Eric Schrock <Eric.Schrock@Sun.COM>
parents:
7846
diff
changeset
|
1557 |
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
|
1558 |
sav->sav_vdevs); |
53c5e7987263
6783576 ::spa -v should include spares
Eric Schrock <Eric.Schrock@Sun.COM>
parents:
7846
diff
changeset
|
1559 |
return (DCMD_ERR); |
53c5e7987263
6783576 ::spa -v should include spares
Eric Schrock <Eric.Schrock@Sun.COM>
parents:
7846
diff
changeset
|
1560 |
} |
53c5e7987263
6783576 ::spa -v should include spares
Eric Schrock <Eric.Schrock@Sun.COM>
parents:
7846
diff
changeset
|
1561 |
|
53c5e7987263
6783576 ::spa -v should include spares
Eric Schrock <Eric.Schrock@Sun.COM>
parents:
7846
diff
changeset
|
1562 |
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
|
1563 |
|
53c5e7987263
6783576 ::spa -v should include spares
Eric Schrock <Eric.Schrock@Sun.COM>
parents:
7846
diff
changeset
|
1564 |
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
|
1565 |
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
|
1566 |
if (ret != DCMD_OK) { |
53c5e7987263
6783576 ::spa -v should include spares
Eric Schrock <Eric.Schrock@Sun.COM>
parents:
7846
diff
changeset
|
1567 |
mdb_free(aux, len); |
53c5e7987263
6783576 ::spa -v should include spares
Eric Schrock <Eric.Schrock@Sun.COM>
parents:
7846
diff
changeset
|
1568 |
return (ret); |
53c5e7987263
6783576 ::spa -v should include spares
Eric Schrock <Eric.Schrock@Sun.COM>
parents:
7846
diff
changeset
|
1569 |
} |
53c5e7987263
6783576 ::spa -v should include spares
Eric Schrock <Eric.Schrock@Sun.COM>
parents:
7846
diff
changeset
|
1570 |
} |
53c5e7987263
6783576 ::spa -v should include spares
Eric Schrock <Eric.Schrock@Sun.COM>
parents:
7846
diff
changeset
|
1571 |
|
53c5e7987263
6783576 ::spa -v should include spares
Eric Schrock <Eric.Schrock@Sun.COM>
parents:
7846
diff
changeset
|
1572 |
mdb_free(aux, len); |
53c5e7987263
6783576 ::spa -v should include spares
Eric Schrock <Eric.Schrock@Sun.COM>
parents:
7846
diff
changeset
|
1573 |
} |
53c5e7987263
6783576 ::spa -v should include spares
Eric Schrock <Eric.Schrock@Sun.COM>
parents:
7846
diff
changeset
|
1574 |
|
53c5e7987263
6783576 ::spa -v should include spares
Eric Schrock <Eric.Schrock@Sun.COM>
parents:
7846
diff
changeset
|
1575 |
return (0); |
53c5e7987263
6783576 ::spa -v should include spares
Eric Schrock <Eric.Schrock@Sun.COM>
parents:
7846
diff
changeset
|
1576 |
} |
53c5e7987263
6783576 ::spa -v should include spares
Eric Schrock <Eric.Schrock@Sun.COM>
parents:
7846
diff
changeset
|
1577 |
|
789 | 1578 |
/* |
1579 |
* ::spa_vdevs |
|
1580 |
* |
|
1581 |
* -e Include error stats |
|
1582 |
* |
|
1583 |
* 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
|
1584 |
* 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
|
1585 |
* iterating over the cache devices. |
789 | 1586 |
*/ |
1587 |
/* ARGSUSED */ |
|
1588 |
static int |
|
1589 |
spa_vdevs(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) |
|
1590 |
{ |
|
1591 |
spa_t spa; |
|
6643
3a34b0dbb107
6625086 changing cachefile doesn't remove old cache on last user
eschrock
parents:
6245
diff
changeset
|
1592 |
mdb_arg_t v[3]; |
789 | 1593 |
int errors = FALSE; |
8341
53c5e7987263
6783576 ::spa -v should include spares
Eric Schrock <Eric.Schrock@Sun.COM>
parents:
7846
diff
changeset
|
1594 |
int ret; |
789 | 1595 |
|
1596 |
if (mdb_getopts(argc, argv, |
|
1597 |
'e', MDB_OPT_SETBITS, TRUE, &errors, |
|
1598 |
NULL) != argc) |
|
1599 |
return (DCMD_USAGE); |
|
1600 |
||
1601 |
if (!(flags & DCMD_ADDRSPEC)) |
|
1602 |
return (DCMD_USAGE); |
|
1603 |
||
1604 |
if (mdb_vread(&spa, sizeof (spa), addr) == -1) { |
|
1605 |
mdb_warn("failed to read spa_t at %p", addr); |
|
1606 |
return (DCMD_ERR); |
|
1607 |
} |
|
1608 |
||
952
12ec54aa046e
6344502 placeholder bug for the remaining Makefile cleanup work for ZFS
eschrock
parents:
789
diff
changeset
|
1609 |
/* |
12ec54aa046e
6344502 placeholder bug for the remaining Makefile cleanup work for ZFS
eschrock
parents:
789
diff
changeset
|
1610 |
* 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
|
1611 |
*/ |
12ec54aa046e
6344502 placeholder bug for the remaining Makefile cleanup work for ZFS
eschrock
parents:
789
diff
changeset
|
1612 |
if (spa.spa_root_vdev == NULL) { |
12ec54aa046e
6344502 placeholder bug for the remaining Makefile cleanup work for ZFS
eschrock
parents:
789
diff
changeset
|
1613 |
mdb_printf("no associated vdevs\n"); |
12ec54aa046e
6344502 placeholder bug for the remaining Makefile cleanup work for ZFS
eschrock
parents:
789
diff
changeset
|
1614 |
return (DCMD_OK); |
12ec54aa046e
6344502 placeholder bug for the remaining Makefile cleanup work for ZFS
eschrock
parents:
789
diff
changeset
|
1615 |
} |
12ec54aa046e
6344502 placeholder bug for the remaining Makefile cleanup work for ZFS
eschrock
parents:
789
diff
changeset
|
1616 |
|
6643
3a34b0dbb107
6625086 changing cachefile doesn't remove old cache on last user
eschrock
parents:
6245
diff
changeset
|
1617 |
v[0].a_type = MDB_TYPE_STRING; |
3a34b0dbb107
6625086 changing cachefile doesn't remove old cache on last user
eschrock
parents:
6245
diff
changeset
|
1618 |
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
|
1619 |
|
3a34b0dbb107
6625086 changing cachefile doesn't remove old cache on last user
eschrock
parents:
6245
diff
changeset
|
1620 |
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
|
1621 |
flags, 1, v); |
3a34b0dbb107
6625086 changing cachefile doesn't remove old cache on last user
eschrock
parents:
6245
diff
changeset
|
1622 |
if (ret != DCMD_OK) |
3a34b0dbb107
6625086 changing cachefile doesn't remove old cache on last user
eschrock
parents:
6245
diff
changeset
|
1623 |
return (ret); |
3a34b0dbb107
6625086 changing cachefile doesn't remove old cache on last user
eschrock
parents:
6245
diff
changeset
|
1624 |
|
8341
53c5e7987263
6783576 ::spa -v should include spares
Eric Schrock <Eric.Schrock@Sun.COM>
parents:
7846
diff
changeset
|
1625 |
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
|
1626 |
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
|
1627 |
return (DCMD_ERR); |
6643
3a34b0dbb107
6625086 changing cachefile doesn't remove old cache on last user
eschrock
parents:
6245
diff
changeset
|
1628 |
|
3a34b0dbb107
6625086 changing cachefile doesn't remove old cache on last user
eschrock
parents:
6245
diff
changeset
|
1629 |
return (DCMD_OK); |
789 | 1630 |
} |
1631 |
||
4055 | 1632 |
/* |
1633 |
* ::zio |
|
1634 |
* |
|
1635 |
* Print a summary of zio_t and all its children. This is intended to display a |
|
1636 |
* zio tree, and hence we only pick the most important pieces of information for |
|
1637 |
* the main summary. More detailed information can always be found by doing a |
|
1638 |
* '::print zio' on the underlying zio_t. The columns we display are: |
|
1639 |
* |
|
1640 |
* ADDRESS TYPE STAGE WAITER |
|
1641 |
* |
|
1642 |
* The 'address' column is indented by one space for each depth level as we |
|
1643 |
* descend down the tree. |
|
1644 |
*/ |
|
4217
3411a82f178f
6552521 truss dumps core with multibyte characters in syscall args
eschrock
parents:
4055
diff
changeset
|
1645 |
|
8632
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1646 |
#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
|
1647 |
#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
|
1648 |
#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
|
1649 |
#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
|
1650 |
#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
|
1651 |
|
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1652 |
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
|
1653 |
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
|
1654 |
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
|
1655 |
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
|
1656 |
int zpa_type; |
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1657 |
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
|
1658 |
} 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
|
1659 |
|
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1660 |
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
|
1661 |
|
4055 | 1662 |
static int |
1663 |
zio_print_cb(uintptr_t addr, const void *data, void *priv) |
|
1664 |
{ |
|
1665 |
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
|
1666 |
zio_print_args_t *zpa = priv; |
4055 | 1667 |
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
|
1668 |
int indent = zpa->zpa_current_depth; |
4055 | 1669 |
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
|
1670 |
uintptr_t laddr; |
4055 | 1671 |
|
8632
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1672 |
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
|
1673 |
indent = ZIO_MAXINDENT; |
4055 | 1674 |
|
1675 |
if (mdb_ctf_lookup_by_name("enum zio_type", &type_enum) == -1 || |
|
1676 |
mdb_ctf_lookup_by_name("enum zio_stage", &stage_enum) == -1) { |
|
1677 |
mdb_warn("failed to lookup zio enums"); |
|
1678 |
return (WALK_ERR); |
|
1679 |
} |
|
1680 |
||
1681 |
if ((type = mdb_ctf_enum_name(type_enum, zio->io_type)) != NULL) |
|
1682 |
type += sizeof ("ZIO_TYPE_") - 1; |
|
1683 |
else |
|
1684 |
type = "?"; |
|
1685 |
||
1686 |
if ((stage = mdb_ctf_enum_name(stage_enum, zio->io_stage)) != NULL) |
|
1687 |
stage += sizeof ("ZIO_STAGE_") - 1; |
|
1688 |
else |
|
1689 |
stage = "?"; |
|
1690 |
||
8632
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1691 |
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
|
1692 |
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
|
1693 |
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
|
1694 |
} else { |
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1695 |
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
|
1696 |
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
|
1697 |
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
|
1698 |
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
|
1699 |
else |
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1700 |
mdb_printf("-\n"); |
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1701 |
} |
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1702 |
} |
4055 | 1703 |
|
8632
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1704 |
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
|
1705 |
return (WALK_NEXT); |
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1706 |
|
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1707 |
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
|
1708 |
laddr = addr + OFFSETOF(zio_t, io_parent_list); |
4055 | 1709 |
else |
8632
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1710 |
laddr = addr + OFFSETOF(zio_t, io_child_list); |
4055 | 1711 |
|
8632
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1712 |
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
|
1713 |
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
|
1714 |
mdb_warn("failed to walk zio_t children at %p\n", laddr); |
4055 | 1715 |
return (WALK_ERR); |
1716 |
} |
|
8632
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1717 |
zpa->zpa_current_depth--; |
4055 | 1718 |
|
1719 |
return (WALK_NEXT); |
|
1720 |
} |
|
1721 |
||
8632
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1722 |
/* ARGSUSED */ |
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1723 |
static int |
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1724 |
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
|
1725 |
{ |
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1726 |
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
|
1727 |
zio_t zio; |
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1728 |
uintptr_t ziop; |
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1729 |
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
|
1730 |
|
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1731 |
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
|
1732 |
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
|
1733 |
return (WALK_ERR); |
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1734 |
} |
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1735 |
|
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1736 |
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
|
1737 |
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
|
1738 |
else |
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1739 |
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
|
1740 |
|
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1741 |
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
|
1742 |
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
|
1743 |
return (WALK_ERR); |
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1744 |
} |
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1745 |
|
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1746 |
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
|
1747 |
} |
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1748 |
|
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1749 |
/* ARGSUSED */ |
4055 | 1750 |
static int |
1751 |
zio_print(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) |
|
1752 |
{ |
|
1753 |
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
|
1754 |
zio_print_args_t zpa = { 0 }; |
4055 | 1755 |
|
1756 |
if (!(flags & DCMD_ADDRSPEC)) |
|
1757 |
return (DCMD_USAGE); |
|
1758 |
||
8632
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1759 |
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
|
1760 |
'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
|
1761 |
'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
|
1762 |
'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
|
1763 |
NULL) != argc) |
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1764 |
return (DCMD_USAGE); |
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1765 |
|
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1766 |
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
|
1767 |
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
|
1768 |
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
|
1769 |
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
|
1770 |
} 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
|
1771 |
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
|
1772 |
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
|
1773 |
} |
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1774 |
|
4055 | 1775 |
if (mdb_vread(&zio, sizeof (zio_t), addr) == -1) { |
1776 |
mdb_warn("failed to read zio_t at %p", addr); |
|
1777 |
return (DCMD_ERR); |
|
1778 |
} |
|
1779 |
||
8632
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1780 |
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
|
1781 |
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
|
1782 |
"ADDRESS", "TYPE", "STAGE", "WAITER"); |
3411a82f178f
6552521 truss dumps core with multibyte characters in syscall args
eschrock
parents:
4055
diff
changeset
|
1783 |
|
8632
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
1784 |
if (zio_print_cb(addr, &zio, &zpa) != WALK_NEXT) |
4055 | 1785 |
return (DCMD_ERR); |
1786 |
||
1787 |
return (DCMD_OK); |
|
1788 |
} |
|
1789 |
||
1790 |
/* |
|
1791 |
* [addr]::zio_state |
|
1792 |
* |
|
1793 |
* Print a summary of all zio_t structures on the system, or for a particular |
|
1794 |
* pool. This is equivalent to '::walk zio_root | ::zio'. |
|
1795 |
*/ |
|
1796 |
/*ARGSUSED*/ |
|
1797 |
static int |
|
1798 |
zio_state(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) |
|
1799 |
{ |
|
1800 |
/* |
|
1801 |
* MDB will remember the last address of the pipeline, so if we don't |
|
1802 |
* zero this we'll end up trying to walk zio structures for a |
|
1803 |
* non-existent spa_t. |
|
1804 |
*/ |
|
1805 |
if (!(flags & DCMD_ADDRSPEC)) |
|
1806 |
addr = 0; |
|
1807 |
||
1808 |
return (mdb_pwalk_dcmd("zio_root", "zio", argc, argv, addr)); |
|
1809 |
} |
|
1810 |
||
789 | 1811 |
typedef struct txg_list_walk_data { |
1812 |
uintptr_t lw_head[TXG_SIZE]; |
|
1813 |
int lw_txgoff; |
|
1814 |
int lw_maxoff; |
|
1815 |
size_t lw_offset; |
|
1816 |
void *lw_obj; |
|
1817 |
} txg_list_walk_data_t; |
|
1818 |
||
1819 |
static int |
|
1820 |
txg_list_walk_init_common(mdb_walk_state_t *wsp, int txg, int maxoff) |
|
1821 |
{ |
|
1822 |
txg_list_walk_data_t *lwd; |
|
1823 |
txg_list_t list; |
|
1824 |
int i; |
|
1825 |
||
1826 |
lwd = mdb_alloc(sizeof (txg_list_walk_data_t), UM_SLEEP | UM_GC); |
|
1827 |
if (mdb_vread(&list, sizeof (txg_list_t), wsp->walk_addr) == -1) { |
|
1828 |
mdb_warn("failed to read txg_list_t at %#lx", wsp->walk_addr); |
|
1829 |
return (WALK_ERR); |
|
1830 |
} |
|
1831 |
||
1832 |
for (i = 0; i < TXG_SIZE; i++) |
|
1833 |
lwd->lw_head[i] = (uintptr_t)list.tl_head[i]; |
|
1834 |
lwd->lw_offset = list.tl_offset; |
|
1835 |
lwd->lw_obj = mdb_alloc(lwd->lw_offset + sizeof (txg_node_t), |
|
1836 |
UM_SLEEP | UM_GC); |
|
1837 |
lwd->lw_txgoff = txg; |
|
1838 |
lwd->lw_maxoff = maxoff; |
|
1839 |
||
1840 |
wsp->walk_addr = lwd->lw_head[lwd->lw_txgoff]; |
|
1841 |
wsp->walk_data = lwd; |
|
1842 |
||
1843 |
return (WALK_NEXT); |
|
1844 |
} |
|
1845 |
||
1846 |
static int |
|
1847 |
txg_list_walk_init(mdb_walk_state_t *wsp) |
|
1848 |
{ |
|
1849 |
return (txg_list_walk_init_common(wsp, 0, TXG_SIZE-1)); |
|
1850 |
} |
|
1851 |
||
1852 |
static int |
|
1853 |
txg_list0_walk_init(mdb_walk_state_t *wsp) |
|
1854 |
{ |
|
1855 |
return (txg_list_walk_init_common(wsp, 0, 0)); |
|
1856 |
} |
|
1857 |
||
1858 |
static int |
|
1859 |
txg_list1_walk_init(mdb_walk_state_t *wsp) |
|
1860 |
{ |
|
1861 |
return (txg_list_walk_init_common(wsp, 1, 1)); |
|
1862 |
} |
|
1863 |
||
1864 |
static int |
|
1865 |
txg_list2_walk_init(mdb_walk_state_t *wsp) |
|
1866 |
{ |
|
1867 |
return (txg_list_walk_init_common(wsp, 2, 2)); |
|
1868 |
} |
|
1869 |
||
1870 |
static int |
|
1871 |
txg_list3_walk_init(mdb_walk_state_t *wsp) |
|
1872 |
{ |
|
1873 |
return (txg_list_walk_init_common(wsp, 3, 3)); |
|
1874 |
} |
|
1875 |
||
1876 |
static int |
|
1877 |
txg_list_walk_step(mdb_walk_state_t *wsp) |
|
1878 |
{ |
|
1879 |
txg_list_walk_data_t *lwd = wsp->walk_data; |
|
1880 |
uintptr_t addr; |
|
1881 |
txg_node_t *node; |
|
1882 |
int status; |
|
1883 |
||
1884 |
while (wsp->walk_addr == NULL && lwd->lw_txgoff < lwd->lw_maxoff) { |
|
1885 |
lwd->lw_txgoff++; |
|
1886 |
wsp->walk_addr = lwd->lw_head[lwd->lw_txgoff]; |
|
1887 |
} |
|
1888 |
||
1889 |
if (wsp->walk_addr == NULL) |
|
1890 |
return (WALK_DONE); |
|
1891 |
||
1892 |
addr = wsp->walk_addr - lwd->lw_offset; |
|
1893 |
||
1894 |
if (mdb_vread(lwd->lw_obj, |
|
1895 |
lwd->lw_offset + sizeof (txg_node_t), addr) == -1) { |
|
1896 |
mdb_warn("failed to read list element at %#lx", addr); |
|
1897 |
return (WALK_ERR); |
|
1898 |
} |
|
1899 |
||
1900 |
status = wsp->walk_callback(addr, lwd->lw_obj, wsp->walk_cbdata); |
|
1901 |
node = (txg_node_t *)((uintptr_t)lwd->lw_obj + lwd->lw_offset); |
|
1902 |
wsp->walk_addr = (uintptr_t)node->tn_next[lwd->lw_txgoff]; |
|
1903 |
||
1904 |
return (status); |
|
1905 |
} |
|
1906 |
||
1907 |
/* |
|
1908 |
* ::walk spa |
|
1909 |
* |
|
1910 |
* Walk all named spa_t structures in the namespace. This is nothing more than |
|
1911 |
* a layered avl walk. |
|
1912 |
*/ |
|
1913 |
static int |
|
1914 |
spa_walk_init(mdb_walk_state_t *wsp) |
|
1915 |
{ |
|
1916 |
GElf_Sym sym; |
|
1917 |
||
1918 |
if (wsp->walk_addr != NULL) { |
|
1919 |
mdb_warn("spa walk only supports global walks\n"); |
|
1920 |
return (WALK_ERR); |
|
1921 |
} |
|
1922 |
||
1923 |
if (mdb_lookup_by_obj(ZFS_OBJ_NAME, "spa_namespace_avl", &sym) == -1) { |
|
1924 |
mdb_warn("failed to find symbol 'spa_namespace_avl'"); |
|
1925 |
return (WALK_ERR); |
|
1926 |
} |
|
1927 |
||
1928 |
wsp->walk_addr = (uintptr_t)sym.st_value; |
|
1929 |
||
1930 |
if (mdb_layered_walk("avl", wsp) == -1) { |
|
1931 |
mdb_warn("failed to walk 'avl'\n"); |
|
1932 |
return (WALK_ERR); |
|
1933 |
} |
|
1934 |
||
1935 |
return (WALK_NEXT); |
|
1936 |
} |
|
1937 |
||
1938 |
static int |
|
1939 |
spa_walk_step(mdb_walk_state_t *wsp) |
|
1940 |
{ |
|
1941 |
spa_t spa; |
|
1942 |
||
1943 |
if (mdb_vread(&spa, sizeof (spa), wsp->walk_addr) == -1) { |
|
1944 |
mdb_warn("failed to read spa_t at %p", wsp->walk_addr); |
|
1945 |
return (WALK_ERR); |
|
1946 |
} |
|
1947 |
||
1948 |
return (wsp->walk_callback(wsp->walk_addr, &spa, wsp->walk_cbdata)); |
|
1949 |
} |
|
1950 |
||
1951 |
/* |
|
4055 | 1952 |
* [addr]::walk zio |
1953 |
* |
|
1954 |
* Walk all active zio_t structures on the system. This is simply a layered |
|
1955 |
* walk on top of ::walk zio_cache, with the optional ability to limit the |
|
1956 |
* structures to a particular pool. |
|
1957 |
*/ |
|
1958 |
static int |
|
1959 |
zio_walk_init(mdb_walk_state_t *wsp) |
|
1960 |
{ |
|
1961 |
wsp->walk_data = (void *)wsp->walk_addr; |
|
1962 |
||
1963 |
if (mdb_layered_walk("zio_cache", wsp) == -1) { |
|
1964 |
mdb_warn("failed to walk 'zio_cache'\n"); |
|
1965 |
return (WALK_ERR); |
|
1966 |
} |
|
1967 |
||
1968 |
return (WALK_NEXT); |
|
1969 |
} |
|
1970 |
||
1971 |
static int |
|
1972 |
zio_walk_step(mdb_walk_state_t *wsp) |
|
1973 |
{ |
|
1974 |
zio_t zio; |
|
1975 |
||
1976 |
if (mdb_vread(&zio, sizeof (zio), wsp->walk_addr) == -1) { |
|
1977 |
mdb_warn("failed to read zio_t at %p", wsp->walk_addr); |
|
1978 |
return (WALK_ERR); |
|
1979 |
} |
|
1980 |
||
1981 |
if (wsp->walk_data != NULL && wsp->walk_data != zio.io_spa) |
|
1982 |
return (WALK_NEXT); |
|
1983 |
||
1984 |
return (wsp->walk_callback(wsp->walk_addr, &zio, wsp->walk_cbdata)); |
|
1985 |
} |
|
1986 |
||
1987 |
/* |
|
1988 |
* [addr]::walk zio_root |
|
1989 |
* |
|
1990 |
* Walk only root zio_t structures, optionally for a particular spa_t. |
|
1991 |
*/ |
|
1992 |
static int |
|
1993 |
zio_walk_root_step(mdb_walk_state_t *wsp) |
|
1994 |
{ |
|
1995 |
zio_t zio; |
|
1996 |
||
1997 |
if (mdb_vread(&zio, sizeof (zio), wsp->walk_addr) == -1) { |
|
1998 |
mdb_warn("failed to read zio_t at %p", wsp->walk_addr); |
|
1999 |
return (WALK_ERR); |
|
2000 |
} |
|
2001 |
||
2002 |
if (wsp->walk_data != NULL && wsp->walk_data != zio.io_spa) |
|
2003 |
return (WALK_NEXT); |
|
2004 |
||
8632
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
2005 |
/* 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
|
2006 |
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
|
2007 |
&((zio_t *)wsp->walk_addr)->io_parent_list.list_head) |
4055 | 2008 |
return (WALK_NEXT); |
2009 |
||
2010 |
return (wsp->walk_callback(wsp->walk_addr, &zio, wsp->walk_cbdata)); |
|
2011 |
} |
|
2012 |
||
7837
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2013 |
#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
|
2014 |
|
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2015 |
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
|
2016 |
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
|
2017 |
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
|
2018 |
{ |
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
|
2019 |
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
|
2020 |
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
|
2021 |
|
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2022 |
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
|
2023 |
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
|
2024 |
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
|
2025 |
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
|
2026 |
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
|
2027 |
} |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2028 |
|
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2029 |
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
|
2030 |
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
|
2031 |
{ |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2032 |
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
|
2033 |
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
|
2034 |
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
|
2035 |
|
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2036 |
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
|
2037 |
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
|
2038 |
index++; |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2039 |
} |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2040 |
|
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2041 |
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
|
2042 |
|
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2043 |
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
|
2044 |
(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
|
2045 |
(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
|
2046 |
} 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
|
2047 |
(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
|
2048 |
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
|
2049 |
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
|
2050 |
} 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
|
2051 |
(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
|
2052 |
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
|
2053 |
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
|
2054 |
} else { |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2055 |
(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
|
2056 |
(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
|
2057 |
} |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2058 |
} |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2059 |
|
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2060 |
/* |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2061 |
* ::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
|
2062 |
* |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2063 |
* -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
|
2064 |
* |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2065 |
*/ |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2066 |
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
|
2067 |
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
|
2068 |
{ |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2069 |
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
|
2070 |
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
|
2071 |
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
|
2072 |
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
|
2073 |
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
|
2074 |
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
|
2075 |
/* +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
|
2076 |
|
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2077 |
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
|
2078 |
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
|
2079 |
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
|
2080 |
} |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2081 |
|
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2082 |
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
|
2083 |
'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
|
2084 |
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
|
2085 |
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
|
2086 |
|
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2087 |
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
|
2088 |
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
|
2089 |
|
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2090 |
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
|
2091 |
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
|
2092 |
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
|
2093 |
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
|
2094 |
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
|
2095 |
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
|
2096 |
} |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2097 |
|
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2098 |
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
|
2099 |
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
|
2100 |
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
|
2101 |
(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
|
2102 |
} |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2103 |
|
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2104 |
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
|
2105 |
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
|
2106 |
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
|
2107 |
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
|
2108 |
(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
|
2109 |
} |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2110 |
|
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2111 |
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
|
2112 |
"\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
|
2113 |
|
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2114 |
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
|
2115 |
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
|
2116 |
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
|
2117 |
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
|
2118 |
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
|
2119 |
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
|
2120 |
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
|
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 |
|
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2123 |
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
|
2124 |
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
|
2125 |
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
|
2126 |
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
|
2127 |
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
|
2128 |
(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
|
2129 |
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
|
2130 |
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
|
2131 |
} |
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 (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
|
2134 |
continue; |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2135 |
|
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2136 |
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
|
2137 |
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
|
2138 |
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
|
2139 |
|
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2140 |
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
|
2141 |
continue; |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2142 |
|
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2143 |
/* |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2144 |
* 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
|
2145 |
*/ |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2146 |
if (!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
|
2147 |
continue; |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2148 |
|
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2149 |
/* |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2150 |
* 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
|
2151 |
* 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
|
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 |
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
|
2154 |
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
|
2155 |
continue; |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2156 |
|
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2157 |
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
|
2158 |
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
|
2159 |
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
|
2160 |
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
|
2161 |
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
|
2162 |
(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
|
2163 |
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
|
2164 |
(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
|
2165 |
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
|
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 |
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
|
2168 |
"\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
|
2169 |
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
|
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 |
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
|
2172 |
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
|
2173 |
else |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2174 |
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
|
2175 |
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
|
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 |
} |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2178 |
|
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2179 |
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
|
2180 |
} |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2181 |
|
10407
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2182 |
/* ARGSUSED */ |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2183 |
static int |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2184 |
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
|
2185 |
{ |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2186 |
static int gotid; |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2187 |
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
|
2188 |
uintptr_t ref_holder; |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2189 |
uintptr_t ref_removed; |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2190 |
uint64_t ref_number; |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2191 |
boolean_t holder_is_str; |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2192 |
char holder_str[128]; |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2193 |
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
|
2194 |
|
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2195 |
if (!gotid) { |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2196 |
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
|
2197 |
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
|
2198 |
return (WALK_ERR); |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2199 |
} |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2200 |
gotid = TRUE; |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2201 |
} |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2202 |
|
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2203 |
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
|
2204 |
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
|
2205 |
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
|
2206 |
return (WALK_ERR); |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2207 |
|
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2208 |
if (mdb_readstr(holder_str, sizeof (holder_str), ref_holder) != -1) { |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2209 |
char *cp; |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2210 |
holder_is_str = B_TRUE; |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2211 |
for (cp = holder_str; *cp; cp++) { |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2212 |
if (!isprint(*cp)) { |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2213 |
holder_is_str = B_FALSE; |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2214 |
break; |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2215 |
} |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2216 |
} |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2217 |
} else { |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2218 |
holder_is_str = B_FALSE; |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2219 |
} |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2220 |
|
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2221 |
if (removed) |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2222 |
mdb_printf("removed "); |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2223 |
mdb_printf("reference "); |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2224 |
if (ref_number != 1) |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2225 |
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
|
2226 |
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
|
2227 |
if (holder_is_str) |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2228 |
mdb_printf(" \"%s\"", holder_str); |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2229 |
mdb_printf(", held at:\n"); |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2230 |
|
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2231 |
(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
|
2232 |
|
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2233 |
if (removed) { |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2234 |
mdb_printf("removed at:\n"); |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2235 |
(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
|
2236 |
DCMD_ADDRSPEC, 0, NULL); |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2237 |
} |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2238 |
|
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2239 |
mdb_printf("\n"); |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2240 |
|
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2241 |
return (WALK_NEXT); |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2242 |
} |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2243 |
|
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2244 |
/* ARGSUSED */ |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2245 |
static int |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2246 |
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
|
2247 |
{ |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2248 |
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
|
2249 |
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
|
2250 |
static int gotid; |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2251 |
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
|
2252 |
ulong_t off; |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2253 |
|
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2254 |
if (!(flags & DCMD_ADDRSPEC)) |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2255 |
return (DCMD_USAGE); |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2256 |
|
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2257 |
if (!gotid) { |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2258 |
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
|
2259 |
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
|
2260 |
return (DCMD_ERR); |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2261 |
} |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2262 |
gotid = TRUE; |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2263 |
} |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2264 |
|
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2265 |
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
|
2266 |
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
|
2267 |
return (DCMD_ERR); |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2268 |
|
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2269 |
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
|
2270 |
"%llu recently released holds\n", |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2271 |
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
|
2272 |
|
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2273 |
if (rc_count > 0) |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2274 |
mdb_printf("current holds:\n"); |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2275 |
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
|
2276 |
return (DCMD_ERR); |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2277 |
rc_list = addr + off/NBBY; |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2278 |
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
|
2279 |
|
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2280 |
if (rc_removed_count > 0) |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2281 |
mdb_printf("released holds:\n"); |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2282 |
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
|
2283 |
return (DCMD_ERR); |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2284 |
rc_removed = addr + off/NBBY; |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2285 |
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
|
2286 |
|
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2287 |
return (DCMD_OK); |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2288 |
} |
34e10c4af053
6875779 zfs user accounting callbacks can be simplified
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10298
diff
changeset
|
2289 |
|
4055 | 2290 |
/* |
789 | 2291 |
* MDB module linkage information: |
2292 |
* |
|
2293 |
* We declare a list of structures describing our dcmds, and a function |
|
2294 |
* named _mdb_init to return a pointer to our module information. |
|
2295 |
*/ |
|
2296 |
||
2297 |
static const mdb_dcmd_t dcmds[] = { |
|
4787 | 2298 |
{ "arc", "[-bkmg]", "print ARC variables", arc_print }, |
789 | 2299 |
{ "blkptr", ":", "print blkptr_t", blkptr }, |
2300 |
{ "dbuf", ":", "print dmu_buf_impl_t", dbuf }, |
|
2301 |
{ "dbuf_stats", ":", "dbuf stats", dbuf_stats }, |
|
2302 |
{ "dbufs", |
|
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9480
diff
changeset
|
2303 |
"\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
|
2304 |
"[-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
|
2305 |
"\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
|
2306 |
"find dmu_buf_impl_t's that match specified criteria", dbufs }, |
789 | 2307 |
{ "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
|
2308 |
"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
|
2309 |
abuf_find }, |
789 | 2310 |
{ "spa", "?[-cv]", "spa_t summary", spa_print }, |
2311 |
{ "spa_config", ":", "print spa_t configuration", spa_print_config }, |
|
2312 |
{ "spa_verify", ":", "verify spa_t consistency", spa_verify }, |
|
2313 |
{ "spa_space", ":[-b]", "print spa_t on-disk space usage", spa_space }, |
|
2314 |
{ "spa_vdevs", ":", "given a spa_t, print vdev summary", spa_vdevs }, |
|
4787 | 2315 |
{ "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
|
2316 |
"\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
|
2317 |
"\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
|
2318 |
"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
|
2319 |
{ "zio", ":[cpr]\n" |
36ef517870a3
6798384 It can take a village to raise a zio
Bill Moore <Bill.Moore@Sun.COM>
parents:
8341
diff
changeset
|
2320 |
"\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
|
2321 |
"\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
|
2322 |
"\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
|
2323 |
"zio_t summary", zio_print }, |
4055 | 2324 |
{ "zio_state", "?", "print out all zio_t structures on system or " |
2325 |
"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
|
2326 |
{ "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
|
2327 |
"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
|
2328 |
zfs_blkstats }, |
3059 | 2329 |
{ "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
|
2330 |
{ "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
|
2331 |
{ "zap_leaf", "", "print zap_leaf_phys_t", zap_leaf }, |
789 | 2332 |
{ NULL } |
2333 |
}; |
|
2334 |
||
2335 |
static const mdb_walker_t walkers[] = { |
|
2336 |
/* |
|
2337 |
* In userland, there is no generic provider of list_t walkers, so we |
|
2338 |
* need to add it. |
|
2339 |
*/ |
|
2340 |
#ifndef _KERNEL |
|
2341 |
{ LIST_WALK_NAME, LIST_WALK_DESC, |
|
2342 |
list_walk_init, list_walk_step, list_walk_fini }, |
|
2343 |
#endif |
|
2344 |
{ "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
|
2345 |
freelist_walk_init, freelist_walk_step, NULL }, |
789 | 2346 |
{ "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
|
2347 |
txg_list_walk_init, txg_list_walk_step, NULL }, |
789 | 2348 |
{ "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
|
2349 |
txg_list0_walk_init, txg_list_walk_step, NULL }, |
789 | 2350 |
{ "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
|
2351 |
txg_list1_walk_init, txg_list_walk_step, NULL }, |
789 | 2352 |
{ "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
|
2353 |
txg_list2_walk_init, txg_list_walk_step, NULL }, |
789 | 2354 |
{ "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
|
2355 |
txg_list3_walk_init, txg_list_walk_step, NULL }, |
4055 | 2356 |
{ "zio", "walk all zio structures, optionally for a particular spa_t", |
2357 |
zio_walk_init, zio_walk_step, NULL }, |
|
2358 |
{ "zio_root", "walk all root zio_t structures, optionally for a " |
|
2359 |
"particular spa_t", |
|
2360 |
zio_walk_init, zio_walk_root_step, NULL }, |
|
789 | 2361 |
{ "spa", "walk all spa_t entries in the namespace", |
2362 |
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
|
2363 |
{ "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
|
2364 |
metaslab_walk_init, metaslab_walk_step, NULL }, |
789 | 2365 |
{ NULL } |
2366 |
}; |
|
2367 |
||
2368 |
static const mdb_modinfo_t modinfo = { |
|
2369 |
MDB_API_VERSION, dcmds, walkers |
|
2370 |
}; |
|
2371 |
||
2372 |
const mdb_modinfo_t * |
|
2373 |
_mdb_init(void) |
|
2374 |
{ |
|
2375 |
return (&modinfo); |
|
2376 |
} |