author | Christopher Siden <chris.siden@delphix.com> |
Mon, 21 May 2012 12:11:39 -0700 | |
changeset 13700 | 2889e2596bd6 |
parent 13618 | c6ae14a341e8 |
child 13743 | 95aba6e49b9f |
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 |
*/ |
|
13700
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
13618
diff
changeset
|
21 |
|
789 | 22 |
/* |
12050
5879aa161e65
6938757 SMB and NFS referrals not working correctly
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11935
diff
changeset
|
23 |
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. |
13700
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
13618
diff
changeset
|
24 |
* Copyright (c) 2012 by Delphix. All rights reserved. |
789 | 25 |
*/ |
26 |
||
27 |
#include <stdio.h> |
|
1914
8a8c5f225b1b
4916205 libcmd should not use file operation routines from C library
casper
parents:
1807
diff
changeset
|
28 |
#include <stdio_ext.h> |
789 | 29 |
#include <stdlib.h> |
1775
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
30 |
#include <ctype.h> |
789 | 31 |
#include <sys/zfs_context.h> |
32 |
#include <sys/spa.h> |
|
33 |
#include <sys/spa_impl.h> |
|
34 |
#include <sys/dmu.h> |
|
35 |
#include <sys/zap.h> |
|
36 |
#include <sys/fs/zfs.h> |
|
37 |
#include <sys/zfs_znode.h> |
|
11935
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
38 |
#include <sys/zfs_sa.h> |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
39 |
#include <sys/sa.h> |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
40 |
#include <sys/sa_impl.h> |
789 | 41 |
#include <sys/vdev.h> |
42 |
#include <sys/vdev_impl.h> |
|
43 |
#include <sys/metaslab_impl.h> |
|
44 |
#include <sys/dmu_objset.h> |
|
45 |
#include <sys/dsl_dir.h> |
|
46 |
#include <sys/dsl_dataset.h> |
|
47 |
#include <sys/dsl_pool.h> |
|
48 |
#include <sys/dbuf.h> |
|
49 |
#include <sys/zil.h> |
|
50 |
#include <sys/zil_impl.h> |
|
51 |
#include <sys/stat.h> |
|
52 |
#include <sys/resource.h> |
|
53 |
#include <sys/dmu_traverse.h> |
|
54 |
#include <sys/zio_checksum.h> |
|
55 |
#include <sys/zio_compress.h> |
|
5959
1e1904b8526d
6650192 zfs ACL/fuid code could use some minor cleanup
marks
parents:
5530
diff
changeset
|
56 |
#include <sys/zfs_fuid.h> |
7837
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
57 |
#include <sys/arc.h> |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
58 |
#include <sys/ddt.h> |
13700
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
13618
diff
changeset
|
59 |
#include <sys/zfeature.h> |
4627
c85631613c19
6509812 it would be useful if zdb(1M) could run on exported pools
ck153898
parents:
4577
diff
changeset
|
60 |
#undef ZFS_MAXNAMELEN |
c85631613c19
6509812 it would be useful if zdb(1M) could run on exported pools
ck153898
parents:
4577
diff
changeset
|
61 |
#undef verify |
c85631613c19
6509812 it would be useful if zdb(1M) could run on exported pools
ck153898
parents:
4577
diff
changeset
|
62 |
#include <libzfs.h> |
789 | 63 |
|
10859
ea699e57196e
6761101 zdb/mdb crashes when printing bp with bad checksum, compress or type
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10858
diff
changeset
|
64 |
#define ZDB_COMPRESS_NAME(idx) ((idx) < ZIO_COMPRESS_FUNCTIONS ? \ |
ea699e57196e
6761101 zdb/mdb crashes when printing bp with bad checksum, compress or type
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10858
diff
changeset
|
65 |
zio_compress_table[(idx)].ci_name : "UNKNOWN") |
ea699e57196e
6761101 zdb/mdb crashes when printing bp with bad checksum, compress or type
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10858
diff
changeset
|
66 |
#define ZDB_CHECKSUM_NAME(idx) ((idx) < ZIO_CHECKSUM_FUNCTIONS ? \ |
ea699e57196e
6761101 zdb/mdb crashes when printing bp with bad checksum, compress or type
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10858
diff
changeset
|
67 |
zio_checksum_table[(idx)].ci_name : "UNKNOWN") |
ea699e57196e
6761101 zdb/mdb crashes when printing bp with bad checksum, compress or type
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10858
diff
changeset
|
68 |
#define ZDB_OT_NAME(idx) ((idx) < DMU_OT_NUMTYPES ? \ |
13700
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
13618
diff
changeset
|
69 |
dmu_ot[(idx)].ot_name : DMU_OT_IS_VALID(idx) ? \ |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
13618
diff
changeset
|
70 |
dmu_ot_byteswap[DMU_OT_BYTESWAP(idx)].ob_name : "UNKNOWN") |
10859
ea699e57196e
6761101 zdb/mdb crashes when printing bp with bad checksum, compress or type
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10858
diff
changeset
|
71 |
#define ZDB_OT_TYPE(idx) ((idx) < DMU_OT_NUMTYPES ? (idx) : DMU_OT_NUMTYPES) |
ea699e57196e
6761101 zdb/mdb crashes when printing bp with bad checksum, compress or type
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10858
diff
changeset
|
72 |
|
11726
9686f6127423
6896791 want zdb option to set aok and zfs_recover
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
11725
diff
changeset
|
73 |
#ifndef lint |
9686f6127423
6896791 want zdb option to set aok and zfs_recover
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
11725
diff
changeset
|
74 |
extern int zfs_recover; |
9686f6127423
6896791 want zdb option to set aok and zfs_recover
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
11725
diff
changeset
|
75 |
#else |
9686f6127423
6896791 want zdb option to set aok and zfs_recover
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
11725
diff
changeset
|
76 |
int zfs_recover; |
9686f6127423
6896791 want zdb option to set aok and zfs_recover
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
11725
diff
changeset
|
77 |
#endif |
9686f6127423
6896791 want zdb option to set aok and zfs_recover
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
11725
diff
changeset
|
78 |
|
789 | 79 |
const char cmdname[] = "zdb"; |
80 |
uint8_t dump_opt[256]; |
|
81 |
||
82 |
typedef void object_viewer_t(objset_t *, uint64_t, void *data, size_t size); |
|
83 |
||
84 |
extern void dump_intent_log(zilog_t *); |
|
85 |
uint64_t *zopt_object = NULL; |
|
86 |
int zopt_objects = 0; |
|
4627
c85631613c19
6509812 it would be useful if zdb(1M) could run on exported pools
ck153898
parents:
4577
diff
changeset
|
87 |
libzfs_handle_t *g_zfs; |
789 | 88 |
|
89 |
/* |
|
90 |
* These libumem hooks provide a reasonable set of defaults for the allocator's |
|
91 |
* debugging facilities. |
|
92 |
*/ |
|
93 |
const char * |
|
94 |
_umem_debug_init() |
|
95 |
{ |
|
96 |
return ("default,verbose"); /* $UMEM_DEBUG setting */ |
|
97 |
} |
|
98 |
||
99 |
const char * |
|
100 |
_umem_logging_init(void) |
|
101 |
{ |
|
102 |
return ("fail,contents"); /* $UMEM_LOGGING setting */ |
|
103 |
} |
|
104 |
||
105 |
static void |
|
106 |
usage(void) |
|
107 |
{ |
|
108 |
(void) fprintf(stderr, |
|
13618
c6ae14a341e8
2088 zdb could use a reasonable manual page
Richard Lowe <richlowe@richlowe.net>
parents:
12961
diff
changeset
|
109 |
"Usage: %s [-CumdibcsDvhLXFPA] [-t txg] [-e [-p path...]] " |
c6ae14a341e8
2088 zdb could use a reasonable manual page
Richard Lowe <richlowe@richlowe.net>
parents:
12961
diff
changeset
|
110 |
"poolname [object...]\n" |
c6ae14a341e8
2088 zdb could use a reasonable manual page
Richard Lowe <richlowe@richlowe.net>
parents:
12961
diff
changeset
|
111 |
" %s [-divPA] [-e -p path...] dataset [object...]\n" |
c6ae14a341e8
2088 zdb could use a reasonable manual page
Richard Lowe <richlowe@richlowe.net>
parents:
12961
diff
changeset
|
112 |
" %s -m [-LXFPA] [-t txg] [-e [-p path...]] " |
c6ae14a341e8
2088 zdb could use a reasonable manual page
Richard Lowe <richlowe@richlowe.net>
parents:
12961
diff
changeset
|
113 |
"poolname [vdev [metaslab...]]\n" |
c6ae14a341e8
2088 zdb could use a reasonable manual page
Richard Lowe <richlowe@richlowe.net>
parents:
12961
diff
changeset
|
114 |
" %s -R [-A] [-e [-p path...]] poolname " |
c6ae14a341e8
2088 zdb could use a reasonable manual page
Richard Lowe <richlowe@richlowe.net>
parents:
12961
diff
changeset
|
115 |
"vdev:offset:size[:flags]\n" |
c6ae14a341e8
2088 zdb could use a reasonable manual page
Richard Lowe <richlowe@richlowe.net>
parents:
12961
diff
changeset
|
116 |
" %s -S [-PA] [-e [-p path...]] poolname\n" |
c6ae14a341e8
2088 zdb could use a reasonable manual page
Richard Lowe <richlowe@richlowe.net>
parents:
12961
diff
changeset
|
117 |
" %s -l [-uA] device\n" |
c6ae14a341e8
2088 zdb could use a reasonable manual page
Richard Lowe <richlowe@richlowe.net>
parents:
12961
diff
changeset
|
118 |
" %s -C [-A] [-U config]\n\n", |
11125
fca3e6d28599
6899923 vdev_offline/vdev_add deadlock
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10922
diff
changeset
|
119 |
cmdname, cmdname, cmdname, cmdname, cmdname, cmdname, cmdname); |
789 | 120 |
|
10858
9efff268b959
6709782 issues using zdb with -e option
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10857
diff
changeset
|
121 |
(void) fprintf(stderr, " Dataset name must include at least one " |
9efff268b959
6709782 issues using zdb with -e option
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10857
diff
changeset
|
122 |
"separator character '/' or '@'\n"); |
9efff268b959
6709782 issues using zdb with -e option
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10857
diff
changeset
|
123 |
(void) fprintf(stderr, " If dataset name is specified, only that " |
9efff268b959
6709782 issues using zdb with -e option
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10857
diff
changeset
|
124 |
"dataset is dumped\n"); |
9efff268b959
6709782 issues using zdb with -e option
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10857
diff
changeset
|
125 |
(void) fprintf(stderr, " If object numbers are specified, only " |
9efff268b959
6709782 issues using zdb with -e option
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10857
diff
changeset
|
126 |
"those objects are dumped\n\n"); |
9efff268b959
6709782 issues using zdb with -e option
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10857
diff
changeset
|
127 |
(void) fprintf(stderr, " Options to control amount of output:\n"); |
9efff268b959
6709782 issues using zdb with -e option
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10857
diff
changeset
|
128 |
(void) fprintf(stderr, " -u uberblock\n"); |
9efff268b959
6709782 issues using zdb with -e option
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10857
diff
changeset
|
129 |
(void) fprintf(stderr, " -d dataset(s)\n"); |
9efff268b959
6709782 issues using zdb with -e option
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10857
diff
changeset
|
130 |
(void) fprintf(stderr, " -i intent logs\n"); |
10860
f850bd358163
6736356 zdb -R/-C needs to work with exported pools
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10859
diff
changeset
|
131 |
(void) fprintf(stderr, " -C config (or cachefile if alone)\n"); |
10685
931790026ac6
6846163 ZFS continues to use faulted logzilla, bringing system to a crawl
George Wilson <George.Wilson@Sun.COM>
parents:
10594
diff
changeset
|
132 |
(void) fprintf(stderr, " -h pool history\n"); |
10858
9efff268b959
6709782 issues using zdb with -e option
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10857
diff
changeset
|
133 |
(void) fprintf(stderr, " -b block statistics\n"); |
9efff268b959
6709782 issues using zdb with -e option
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10857
diff
changeset
|
134 |
(void) fprintf(stderr, " -m metaslabs\n"); |
9efff268b959
6709782 issues using zdb with -e option
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10857
diff
changeset
|
135 |
(void) fprintf(stderr, " -c checksum all metadata (twice for " |
9463
d0bd231c7518
6764124 want zdb to be able to checksum metadata blocks only
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
9425
diff
changeset
|
136 |
"all data) blocks\n"); |
10858
9efff268b959
6709782 issues using zdb with -e option
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10857
diff
changeset
|
137 |
(void) fprintf(stderr, " -s report stats on zdb's I/O\n"); |
11811
b25d9f1b5d8e
6914746 sprintf_blkptr() causes NULL pointer dereference
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
11728
diff
changeset
|
138 |
(void) fprintf(stderr, " -D dedup statistics\n"); |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
139 |
(void) fprintf(stderr, " -S simulate dedup to measure effect\n"); |
10858
9efff268b959
6709782 issues using zdb with -e option
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10857
diff
changeset
|
140 |
(void) fprintf(stderr, " -v verbose (applies to all others)\n"); |
789 | 141 |
(void) fprintf(stderr, " -l dump label contents\n"); |
8121
7fd09d4ebd9c
6757430 want an option for zdb to disable space map loading and leak tracking
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
7837
diff
changeset
|
142 |
(void) fprintf(stderr, " -L disable leak tracking (do not " |
7fd09d4ebd9c
6757430 want an option for zdb to disable space map loading and leak tracking
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
7837
diff
changeset
|
143 |
"load spacemaps)\n"); |
10858
9efff268b959
6709782 issues using zdb with -e option
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10857
diff
changeset
|
144 |
(void) fprintf(stderr, " -R read and display block from a " |
9efff268b959
6709782 issues using zdb with -e option
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10857
diff
changeset
|
145 |
"device\n\n"); |
9efff268b959
6709782 issues using zdb with -e option
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10857
diff
changeset
|
146 |
(void) fprintf(stderr, " Below options are intended for use " |
9efff268b959
6709782 issues using zdb with -e option
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10857
diff
changeset
|
147 |
"with other options (except -l):\n"); |
11726
9686f6127423
6896791 want zdb option to set aok and zfs_recover
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
11725
diff
changeset
|
148 |
(void) fprintf(stderr, " -A ignore assertions (-A), enable " |
9686f6127423
6896791 want zdb option to set aok and zfs_recover
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
11725
diff
changeset
|
149 |
"panic recovery (-AA) or both (-AAA)\n"); |
11727
497d03ab2824
6900971 zdb rewind behavior needs to be revisited
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
11726
diff
changeset
|
150 |
(void) fprintf(stderr, " -F attempt automatic rewind within " |
497d03ab2824
6900971 zdb rewind behavior needs to be revisited
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
11726
diff
changeset
|
151 |
"safe range of transaction groups\n"); |
10858
9efff268b959
6709782 issues using zdb with -e option
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10857
diff
changeset
|
152 |
(void) fprintf(stderr, " -U <cachefile_path> -- use alternate " |
5994
bedab011a2e5
6580270 'zdb [-C|-L] <pool'> can't open alternate root pools
ck153898
parents:
5959
diff
changeset
|
153 |
"cachefile\n"); |
11727
497d03ab2824
6900971 zdb rewind behavior needs to be revisited
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
11726
diff
changeset
|
154 |
(void) fprintf(stderr, " -X attempt extreme rewind (does not " |
497d03ab2824
6900971 zdb rewind behavior needs to be revisited
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
11726
diff
changeset
|
155 |
"work with dataset)\n"); |
10858
9efff268b959
6709782 issues using zdb with -e option
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10857
diff
changeset
|
156 |
(void) fprintf(stderr, " -e pool is exported/destroyed/" |
9efff268b959
6709782 issues using zdb with -e option
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10857
diff
changeset
|
157 |
"has altroot/not in a cachefile\n"); |
9efff268b959
6709782 issues using zdb with -e option
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10857
diff
changeset
|
158 |
(void) fprintf(stderr, " -p <path> -- use one or more with " |
9efff268b959
6709782 issues using zdb with -e option
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10857
diff
changeset
|
159 |
"-e to specify path to vdev dir\n"); |
13618
c6ae14a341e8
2088 zdb could use a reasonable manual page
Richard Lowe <richlowe@richlowe.net>
parents:
12961
diff
changeset
|
160 |
(void) fprintf(stderr, " -P print numbers in parseable form\n"); |
10858
9efff268b959
6709782 issues using zdb with -e option
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10857
diff
changeset
|
161 |
(void) fprintf(stderr, " -t <txg> -- highest txg to use when " |
8188
fd00c0a81e80
6761100 want zdb option to select older uberblocks
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
8121
diff
changeset
|
162 |
"searching for uberblocks\n"); |
789 | 163 |
(void) fprintf(stderr, "Specify an option more than once (e.g. -bb) " |
164 |
"to make only that option verbose\n"); |
|
165 |
(void) fprintf(stderr, "Default is to dump everything non-verbosely\n"); |
|
166 |
exit(1); |
|
167 |
} |
|
168 |
||
8924
5af812f84759
6789318 coredump when issue zdb -uuuu poolname/
Rich Morris <Richard.Morris@Sun.COM>
parents:
8241
diff
changeset
|
169 |
/* |
5af812f84759
6789318 coredump when issue zdb -uuuu poolname/
Rich Morris <Richard.Morris@Sun.COM>
parents:
8241
diff
changeset
|
170 |
* Called for usage errors that are discovered after a call to spa_open(), |
5af812f84759
6789318 coredump when issue zdb -uuuu poolname/
Rich Morris <Richard.Morris@Sun.COM>
parents:
8241
diff
changeset
|
171 |
* dmu_bonus_hold(), or pool_match(). abort() is called for other errors. |
5af812f84759
6789318 coredump when issue zdb -uuuu poolname/
Rich Morris <Richard.Morris@Sun.COM>
parents:
8241
diff
changeset
|
172 |
*/ |
5af812f84759
6789318 coredump when issue zdb -uuuu poolname/
Rich Morris <Richard.Morris@Sun.COM>
parents:
8241
diff
changeset
|
173 |
|
789 | 174 |
static void |
175 |
fatal(const char *fmt, ...) |
|
176 |
{ |
|
177 |
va_list ap; |
|
178 |
||
179 |
va_start(ap, fmt); |
|
180 |
(void) fprintf(stderr, "%s: ", cmdname); |
|
181 |
(void) vfprintf(stderr, fmt, ap); |
|
182 |
va_end(ap); |
|
183 |
(void) fprintf(stderr, "\n"); |
|
184 |
||
8924
5af812f84759
6789318 coredump when issue zdb -uuuu poolname/
Rich Morris <Richard.Morris@Sun.COM>
parents:
8241
diff
changeset
|
185 |
exit(1); |
789 | 186 |
} |
187 |
||
188 |
/* ARGSUSED */ |
|
189 |
static void |
|
190 |
dump_packed_nvlist(objset_t *os, uint64_t object, void *data, size_t size) |
|
191 |
{ |
|
192 |
nvlist_t *nv; |
|
193 |
size_t nvsize = *(uint64_t *)data; |
|
194 |
char *packed = umem_alloc(nvsize, UMEM_NOFAIL); |
|
195 |
||
9512
64cafcbcc337
6801810 Commit of aligned streaming rewrites to ZIL device causes unwanted disk reads
Neil Perrin <Neil.Perrin@Sun.COM>
parents:
9480
diff
changeset
|
196 |
VERIFY(0 == dmu_read(os, object, 0, nvsize, packed, DMU_READ_PREFETCH)); |
789 | 197 |
|
198 |
VERIFY(nvlist_unpack(packed, nvsize, &nv, 0) == 0); |
|
199 |
||
200 |
umem_free(packed, nvsize); |
|
201 |
||
202 |
dump_nvlist(nv, 8); |
|
203 |
||
204 |
nvlist_free(nv); |
|
205 |
} |
|
206 |
||
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12050
diff
changeset
|
207 |
static void |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12050
diff
changeset
|
208 |
zdb_nicenum(uint64_t num, char *buf) |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12050
diff
changeset
|
209 |
{ |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12050
diff
changeset
|
210 |
if (dump_opt['P']) |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12050
diff
changeset
|
211 |
(void) sprintf(buf, "%llu", (longlong_t)num); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12050
diff
changeset
|
212 |
else |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12050
diff
changeset
|
213 |
nicenum(num, buf); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12050
diff
changeset
|
214 |
} |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12050
diff
changeset
|
215 |
|
789 | 216 |
const char dump_zap_stars[] = "****************************************"; |
217 |
const int dump_zap_width = sizeof (dump_zap_stars) - 1; |
|
218 |
||
219 |
static void |
|
220 |
dump_zap_histogram(uint64_t histo[ZAP_HISTOGRAM_SIZE]) |
|
221 |
{ |
|
222 |
int i; |
|
223 |
int minidx = ZAP_HISTOGRAM_SIZE - 1; |
|
224 |
int maxidx = 0; |
|
225 |
uint64_t max = 0; |
|
226 |
||
227 |
for (i = 0; i < ZAP_HISTOGRAM_SIZE; i++) { |
|
228 |
if (histo[i] > max) |
|
229 |
max = histo[i]; |
|
230 |
if (histo[i] > 0 && i > maxidx) |
|
231 |
maxidx = i; |
|
232 |
if (histo[i] > 0 && i < minidx) |
|
233 |
minidx = i; |
|
234 |
} |
|
235 |
||
236 |
if (max < dump_zap_width) |
|
237 |
max = dump_zap_width; |
|
238 |
||
239 |
for (i = minidx; i <= maxidx; i++) |
|
240 |
(void) printf("\t\t\t%u: %6llu %s\n", i, (u_longlong_t)histo[i], |
|
241 |
&dump_zap_stars[(max - histo[i]) * dump_zap_width / max]); |
|
242 |
} |
|
243 |
||
244 |
static void |
|
245 |
dump_zap_stats(objset_t *os, uint64_t object) |
|
246 |
{ |
|
247 |
int error; |
|
248 |
zap_stats_t zs; |
|
249 |
||
250 |
error = zap_get_stats(os, object, &zs); |
|
251 |
if (error) |
|
252 |
return; |
|
253 |
||
254 |
if (zs.zs_ptrtbl_len == 0) { |
|
255 |
ASSERT(zs.zs_num_blocks == 1); |
|
256 |
(void) printf("\tmicrozap: %llu bytes, %llu entries\n", |
|
257 |
(u_longlong_t)zs.zs_blocksize, |
|
258 |
(u_longlong_t)zs.zs_num_entries); |
|
259 |
return; |
|
260 |
} |
|
261 |
||
262 |
(void) printf("\tFat ZAP stats:\n"); |
|
1632
7d486ebd46b7
6392291 zdb needs to tell the entire goodness of the fat zap
nd150628
parents:
1578
diff
changeset
|
263 |
|
7d486ebd46b7
6392291 zdb needs to tell the entire goodness of the fat zap
nd150628
parents:
1578
diff
changeset
|
264 |
(void) printf("\t\tPointer table:\n"); |
7d486ebd46b7
6392291 zdb needs to tell the entire goodness of the fat zap
nd150628
parents:
1578
diff
changeset
|
265 |
(void) printf("\t\t\t%llu elements\n", |
789 | 266 |
(u_longlong_t)zs.zs_ptrtbl_len); |
1632
7d486ebd46b7
6392291 zdb needs to tell the entire goodness of the fat zap
nd150628
parents:
1578
diff
changeset
|
267 |
(void) printf("\t\t\tzt_blk: %llu\n", |
7d486ebd46b7
6392291 zdb needs to tell the entire goodness of the fat zap
nd150628
parents:
1578
diff
changeset
|
268 |
(u_longlong_t)zs.zs_ptrtbl_zt_blk); |
7d486ebd46b7
6392291 zdb needs to tell the entire goodness of the fat zap
nd150628
parents:
1578
diff
changeset
|
269 |
(void) printf("\t\t\tzt_numblks: %llu\n", |
7d486ebd46b7
6392291 zdb needs to tell the entire goodness of the fat zap
nd150628
parents:
1578
diff
changeset
|
270 |
(u_longlong_t)zs.zs_ptrtbl_zt_numblks); |
7d486ebd46b7
6392291 zdb needs to tell the entire goodness of the fat zap
nd150628
parents:
1578
diff
changeset
|
271 |
(void) printf("\t\t\tzt_shift: %llu\n", |
7d486ebd46b7
6392291 zdb needs to tell the entire goodness of the fat zap
nd150628
parents:
1578
diff
changeset
|
272 |
(u_longlong_t)zs.zs_ptrtbl_zt_shift); |
7d486ebd46b7
6392291 zdb needs to tell the entire goodness of the fat zap
nd150628
parents:
1578
diff
changeset
|
273 |
(void) printf("\t\t\tzt_blks_copied: %llu\n", |
7d486ebd46b7
6392291 zdb needs to tell the entire goodness of the fat zap
nd150628
parents:
1578
diff
changeset
|
274 |
(u_longlong_t)zs.zs_ptrtbl_blks_copied); |
7d486ebd46b7
6392291 zdb needs to tell the entire goodness of the fat zap
nd150628
parents:
1578
diff
changeset
|
275 |
(void) printf("\t\t\tzt_nextblk: %llu\n", |
7d486ebd46b7
6392291 zdb needs to tell the entire goodness of the fat zap
nd150628
parents:
1578
diff
changeset
|
276 |
(u_longlong_t)zs.zs_ptrtbl_nextblk); |
7d486ebd46b7
6392291 zdb needs to tell the entire goodness of the fat zap
nd150628
parents:
1578
diff
changeset
|
277 |
|
789 | 278 |
(void) printf("\t\tZAP entries: %llu\n", |
279 |
(u_longlong_t)zs.zs_num_entries); |
|
280 |
(void) printf("\t\tLeaf blocks: %llu\n", |
|
281 |
(u_longlong_t)zs.zs_num_leafs); |
|
282 |
(void) printf("\t\tTotal blocks: %llu\n", |
|
283 |
(u_longlong_t)zs.zs_num_blocks); |
|
1632
7d486ebd46b7
6392291 zdb needs to tell the entire goodness of the fat zap
nd150628
parents:
1578
diff
changeset
|
284 |
(void) printf("\t\tzap_block_type: 0x%llx\n", |
7d486ebd46b7
6392291 zdb needs to tell the entire goodness of the fat zap
nd150628
parents:
1578
diff
changeset
|
285 |
(u_longlong_t)zs.zs_block_type); |
7d486ebd46b7
6392291 zdb needs to tell the entire goodness of the fat zap
nd150628
parents:
1578
diff
changeset
|
286 |
(void) printf("\t\tzap_magic: 0x%llx\n", |
7d486ebd46b7
6392291 zdb needs to tell the entire goodness of the fat zap
nd150628
parents:
1578
diff
changeset
|
287 |
(u_longlong_t)zs.zs_magic); |
7d486ebd46b7
6392291 zdb needs to tell the entire goodness of the fat zap
nd150628
parents:
1578
diff
changeset
|
288 |
(void) printf("\t\tzap_salt: 0x%llx\n", |
7d486ebd46b7
6392291 zdb needs to tell the entire goodness of the fat zap
nd150628
parents:
1578
diff
changeset
|
289 |
(u_longlong_t)zs.zs_salt); |
789 | 290 |
|
291 |
(void) printf("\t\tLeafs with 2^n pointers:\n"); |
|
292 |
dump_zap_histogram(zs.zs_leafs_with_2n_pointers); |
|
293 |
||
294 |
(void) printf("\t\tBlocks with n*5 entries:\n"); |
|
295 |
dump_zap_histogram(zs.zs_blocks_with_n5_entries); |
|
296 |
||
297 |
(void) printf("\t\tBlocks n/10 full:\n"); |
|
298 |
dump_zap_histogram(zs.zs_blocks_n_tenths_full); |
|
299 |
||
300 |
(void) printf("\t\tEntries with n chunks:\n"); |
|
301 |
dump_zap_histogram(zs.zs_entries_using_n_chunks); |
|
302 |
||
303 |
(void) printf("\t\tBuckets with n entries:\n"); |
|
304 |
dump_zap_histogram(zs.zs_buckets_with_n_entries); |
|
305 |
} |
|
306 |
||
307 |
/*ARGSUSED*/ |
|
308 |
static void |
|
309 |
dump_none(objset_t *os, uint64_t object, void *data, size_t size) |
|
310 |
{ |
|
311 |
} |
|
312 |
||
313 |
/*ARGSUSED*/ |
|
10859
ea699e57196e
6761101 zdb/mdb crashes when printing bp with bad checksum, compress or type
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10858
diff
changeset
|
314 |
static void |
ea699e57196e
6761101 zdb/mdb crashes when printing bp with bad checksum, compress or type
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10858
diff
changeset
|
315 |
dump_unknown(objset_t *os, uint64_t object, void *data, size_t size) |
ea699e57196e
6761101 zdb/mdb crashes when printing bp with bad checksum, compress or type
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10858
diff
changeset
|
316 |
{ |
ea699e57196e
6761101 zdb/mdb crashes when printing bp with bad checksum, compress or type
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10858
diff
changeset
|
317 |
(void) printf("\tUNKNOWN OBJECT TYPE\n"); |
ea699e57196e
6761101 zdb/mdb crashes when printing bp with bad checksum, compress or type
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10858
diff
changeset
|
318 |
} |
ea699e57196e
6761101 zdb/mdb crashes when printing bp with bad checksum, compress or type
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10858
diff
changeset
|
319 |
|
ea699e57196e
6761101 zdb/mdb crashes when printing bp with bad checksum, compress or type
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10858
diff
changeset
|
320 |
/*ARGSUSED*/ |
789 | 321 |
void |
322 |
dump_uint8(objset_t *os, uint64_t object, void *data, size_t size) |
|
323 |
{ |
|
324 |
} |
|
325 |
||
326 |
/*ARGSUSED*/ |
|
327 |
static void |
|
328 |
dump_uint64(objset_t *os, uint64_t object, void *data, size_t size) |
|
329 |
{ |
|
330 |
} |
|
331 |
||
332 |
/*ARGSUSED*/ |
|
333 |
static void |
|
334 |
dump_zap(objset_t *os, uint64_t object, void *data, size_t size) |
|
335 |
{ |
|
336 |
zap_cursor_t zc; |
|
337 |
zap_attribute_t attr; |
|
338 |
void *prop; |
|
339 |
int i; |
|
340 |
||
341 |
dump_zap_stats(os, object); |
|
342 |
(void) printf("\n"); |
|
343 |
||
344 |
for (zap_cursor_init(&zc, os, object); |
|
345 |
zap_cursor_retrieve(&zc, &attr) == 0; |
|
346 |
zap_cursor_advance(&zc)) { |
|
347 |
(void) printf("\t\t%s = ", attr.za_name); |
|
348 |
if (attr.za_num_integers == 0) { |
|
349 |
(void) printf("\n"); |
|
350 |
continue; |
|
351 |
} |
|
352 |
prop = umem_zalloc(attr.za_num_integers * |
|
353 |
attr.za_integer_length, UMEM_NOFAIL); |
|
354 |
(void) zap_lookup(os, object, attr.za_name, |
|
355 |
attr.za_integer_length, attr.za_num_integers, prop); |
|
356 |
if (attr.za_integer_length == 1) { |
|
357 |
(void) printf("%s", (char *)prop); |
|
358 |
} else { |
|
359 |
for (i = 0; i < attr.za_num_integers; i++) { |
|
360 |
switch (attr.za_integer_length) { |
|
361 |
case 2: |
|
362 |
(void) printf("%u ", |
|
363 |
((uint16_t *)prop)[i]); |
|
364 |
break; |
|
365 |
case 4: |
|
366 |
(void) printf("%u ", |
|
367 |
((uint32_t *)prop)[i]); |
|
368 |
break; |
|
369 |
case 8: |
|
370 |
(void) printf("%lld ", |
|
371 |
(u_longlong_t)((int64_t *)prop)[i]); |
|
372 |
break; |
|
373 |
} |
|
374 |
} |
|
375 |
} |
|
376 |
(void) printf("\n"); |
|
377 |
umem_free(prop, attr.za_num_integers * attr.za_integer_length); |
|
378 |
} |
|
885
d925b21dba78
6347493 tar of 25K empty directory entries in ZFS takes 30+ seconds ...
ahrens
parents:
789
diff
changeset
|
379 |
zap_cursor_fini(&zc); |
789 | 380 |
} |
381 |
||
4577 | 382 |
/*ARGSUSED*/ |
383 |
static void |
|
11165
68184eb5449e
6903705 dedup=fletcher4,verify doesn't byteswap correctly, has lots of hash collisions
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11149
diff
changeset
|
384 |
dump_ddt_zap(objset_t *os, uint64_t object, void *data, size_t size) |
68184eb5449e
6903705 dedup=fletcher4,verify doesn't byteswap correctly, has lots of hash collisions
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11149
diff
changeset
|
385 |
{ |
68184eb5449e
6903705 dedup=fletcher4,verify doesn't byteswap correctly, has lots of hash collisions
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11149
diff
changeset
|
386 |
dump_zap_stats(os, object); |
68184eb5449e
6903705 dedup=fletcher4,verify doesn't byteswap correctly, has lots of hash collisions
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11149
diff
changeset
|
387 |
/* contents are printed elsewhere, properly decoded */ |
68184eb5449e
6903705 dedup=fletcher4,verify doesn't byteswap correctly, has lots of hash collisions
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11149
diff
changeset
|
388 |
} |
68184eb5449e
6903705 dedup=fletcher4,verify doesn't byteswap correctly, has lots of hash collisions
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11149
diff
changeset
|
389 |
|
68184eb5449e
6903705 dedup=fletcher4,verify doesn't byteswap correctly, has lots of hash collisions
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11149
diff
changeset
|
390 |
/*ARGSUSED*/ |
68184eb5449e
6903705 dedup=fletcher4,verify doesn't byteswap correctly, has lots of hash collisions
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11149
diff
changeset
|
391 |
static void |
11935
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
392 |
dump_sa_attrs(objset_t *os, uint64_t object, void *data, size_t size) |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
393 |
{ |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
394 |
zap_cursor_t zc; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
395 |
zap_attribute_t attr; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
396 |
|
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
397 |
dump_zap_stats(os, object); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
398 |
(void) printf("\n"); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
399 |
|
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
400 |
for (zap_cursor_init(&zc, os, object); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
401 |
zap_cursor_retrieve(&zc, &attr) == 0; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
402 |
zap_cursor_advance(&zc)) { |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
403 |
(void) printf("\t\t%s = ", attr.za_name); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
404 |
if (attr.za_num_integers == 0) { |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
405 |
(void) printf("\n"); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
406 |
continue; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
407 |
} |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
408 |
(void) printf(" %llx : [%d:%d:%d]\n", |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
409 |
(u_longlong_t)attr.za_first_integer, |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
410 |
(int)ATTR_LENGTH(attr.za_first_integer), |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
411 |
(int)ATTR_BSWAP(attr.za_first_integer), |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
412 |
(int)ATTR_NUM(attr.za_first_integer)); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
413 |
} |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
414 |
zap_cursor_fini(&zc); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
415 |
} |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
416 |
|
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
417 |
/*ARGSUSED*/ |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
418 |
static void |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
419 |
dump_sa_layouts(objset_t *os, uint64_t object, void *data, size_t size) |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
420 |
{ |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
421 |
zap_cursor_t zc; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
422 |
zap_attribute_t attr; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
423 |
uint16_t *layout_attrs; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
424 |
int i; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
425 |
|
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
426 |
dump_zap_stats(os, object); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
427 |
(void) printf("\n"); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
428 |
|
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
429 |
for (zap_cursor_init(&zc, os, object); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
430 |
zap_cursor_retrieve(&zc, &attr) == 0; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
431 |
zap_cursor_advance(&zc)) { |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
432 |
(void) printf("\t\t%s = [", attr.za_name); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
433 |
if (attr.za_num_integers == 0) { |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
434 |
(void) printf("\n"); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
435 |
continue; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
436 |
} |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
437 |
|
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
438 |
VERIFY(attr.za_integer_length == 2); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
439 |
layout_attrs = umem_zalloc(attr.za_num_integers * |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
440 |
attr.za_integer_length, UMEM_NOFAIL); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
441 |
|
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
442 |
VERIFY(zap_lookup(os, object, attr.za_name, |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
443 |
attr.za_integer_length, |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
444 |
attr.za_num_integers, layout_attrs) == 0); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
445 |
|
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
446 |
for (i = 0; i != attr.za_num_integers; i++) |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
447 |
(void) printf(" %d ", (int)layout_attrs[i]); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
448 |
(void) printf("]\n"); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
449 |
umem_free(layout_attrs, |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
450 |
attr.za_num_integers * attr.za_integer_length); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
451 |
} |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
452 |
zap_cursor_fini(&zc); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
453 |
} |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
454 |
|
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
455 |
/*ARGSUSED*/ |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
456 |
static void |
4577 | 457 |
dump_zpldir(objset_t *os, uint64_t object, void *data, size_t size) |
458 |
{ |
|
459 |
zap_cursor_t zc; |
|
460 |
zap_attribute_t attr; |
|
461 |
const char *typenames[] = { |
|
462 |
/* 0 */ "not specified", |
|
463 |
/* 1 */ "FIFO", |
|
464 |
/* 2 */ "Character Device", |
|
465 |
/* 3 */ "3 (invalid)", |
|
466 |
/* 4 */ "Directory", |
|
467 |
/* 5 */ "5 (invalid)", |
|
468 |
/* 6 */ "Block Device", |
|
469 |
/* 7 */ "7 (invalid)", |
|
470 |
/* 8 */ "Regular File", |
|
471 |
/* 9 */ "9 (invalid)", |
|
472 |
/* 10 */ "Symbolic Link", |
|
473 |
/* 11 */ "11 (invalid)", |
|
474 |
/* 12 */ "Socket", |
|
475 |
/* 13 */ "Door", |
|
476 |
/* 14 */ "Event Port", |
|
477 |
/* 15 */ "15 (invalid)", |
|
478 |
}; |
|
479 |
||
480 |
dump_zap_stats(os, object); |
|
481 |
(void) printf("\n"); |
|
482 |
||
483 |
for (zap_cursor_init(&zc, os, object); |
|
484 |
zap_cursor_retrieve(&zc, &attr) == 0; |
|
485 |
zap_cursor_advance(&zc)) { |
|
486 |
(void) printf("\t\t%s = %lld (type: %s)\n", |
|
487 |
attr.za_name, ZFS_DIRENT_OBJ(attr.za_first_integer), |
|
488 |
typenames[ZFS_DIRENT_TYPE(attr.za_first_integer)]); |
|
489 |
} |
|
490 |
zap_cursor_fini(&zc); |
|
491 |
} |
|
492 |
||
789 | 493 |
static void |
494 |
dump_spacemap(objset_t *os, space_map_obj_t *smo, space_map_t *sm) |
|
495 |
{ |
|
496 |
uint64_t alloc, offset, entry; |
|
1732 | 497 |
uint8_t mapshift = sm->sm_shift; |
789 | 498 |
uint64_t mapstart = sm->sm_start; |
3361
a3d194896a76
6480230 ::walk spa|::walk zms_freelist cause mdb to core dump
ck153898
parents:
3060
diff
changeset
|
499 |
char *ddata[] = { "ALLOC", "FREE", "CONDENSE", "INVALID", |
a3d194896a76
6480230 ::walk spa|::walk zms_freelist cause mdb to core dump
ck153898
parents:
3060
diff
changeset
|
500 |
"INVALID", "INVALID", "INVALID", "INVALID" }; |
789 | 501 |
|
502 |
if (smo->smo_object == 0) |
|
503 |
return; |
|
504 |
||
505 |
/* |
|
506 |
* Print out the freelist entries in both encoded and decoded form. |
|
507 |
*/ |
|
508 |
alloc = 0; |
|
509 |
for (offset = 0; offset < smo->smo_objsize; offset += sizeof (entry)) { |
|
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12050
diff
changeset
|
510 |
VERIFY3U(0, ==, dmu_read(os, smo->smo_object, offset, |
9512
64cafcbcc337
6801810 Commit of aligned streaming rewrites to ZIL device causes unwanted disk reads
Neil Perrin <Neil.Perrin@Sun.COM>
parents:
9480
diff
changeset
|
511 |
sizeof (entry), &entry, DMU_READ_PREFETCH)); |
789 | 512 |
if (SM_DEBUG_DECODE(entry)) { |
10861
ae18f8a4df85
6887242 want to be able to dump specific metaslab(s) for specific vdev
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10860
diff
changeset
|
513 |
(void) printf("\t [%6llu] %s: txg %llu, pass %llu\n", |
789 | 514 |
(u_longlong_t)(offset / sizeof (entry)), |
515 |
ddata[SM_DEBUG_ACTION_DECODE(entry)], |
|
2856 | 516 |
(u_longlong_t)SM_DEBUG_TXG_DECODE(entry), |
517 |
(u_longlong_t)SM_DEBUG_SYNCPASS_DECODE(entry)); |
|
789 | 518 |
} else { |
10861
ae18f8a4df85
6887242 want to be able to dump specific metaslab(s) for specific vdev
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10860
diff
changeset
|
519 |
(void) printf("\t [%6llu] %c range:" |
ae18f8a4df85
6887242 want to be able to dump specific metaslab(s) for specific vdev
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10860
diff
changeset
|
520 |
" %010llx-%010llx size: %06llx\n", |
789 | 521 |
(u_longlong_t)(offset / sizeof (entry)), |
522 |
SM_TYPE_DECODE(entry) == SM_ALLOC ? 'A' : 'F', |
|
2856 | 523 |
(u_longlong_t)((SM_OFFSET_DECODE(entry) << |
524 |
mapshift) + mapstart), |
|
525 |
(u_longlong_t)((SM_OFFSET_DECODE(entry) << |
|
526 |
mapshift) + mapstart + (SM_RUN_DECODE(entry) << |
|
527 |
mapshift)), |
|
528 |
(u_longlong_t)(SM_RUN_DECODE(entry) << mapshift)); |
|
789 | 529 |
if (SM_TYPE_DECODE(entry) == SM_ALLOC) |
530 |
alloc += SM_RUN_DECODE(entry) << mapshift; |
|
531 |
else |
|
532 |
alloc -= SM_RUN_DECODE(entry) << mapshift; |
|
533 |
} |
|
534 |
} |
|
535 |
if (alloc != smo->smo_alloc) { |
|
536 |
(void) printf("space_map_object alloc (%llu) INCONSISTENT " |
|
537 |
"with space map summary (%llu)\n", |
|
538 |
(u_longlong_t)smo->smo_alloc, (u_longlong_t)alloc); |
|
539 |
} |
|
540 |
} |
|
541 |
||
542 |
static void |
|
9480
fcff33da767f
6596237 Stop looking and start ganging
George Wilson <George.Wilson@Sun.COM>
parents:
9463
diff
changeset
|
543 |
dump_metaslab_stats(metaslab_t *msp) |
fcff33da767f
6596237 Stop looking and start ganging
George Wilson <George.Wilson@Sun.COM>
parents:
9463
diff
changeset
|
544 |
{ |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12050
diff
changeset
|
545 |
char maxbuf[32]; |
9480
fcff33da767f
6596237 Stop looking and start ganging
George Wilson <George.Wilson@Sun.COM>
parents:
9463
diff
changeset
|
546 |
space_map_t *sm = &msp->ms_map; |
fcff33da767f
6596237 Stop looking and start ganging
George Wilson <George.Wilson@Sun.COM>
parents:
9463
diff
changeset
|
547 |
avl_tree_t *t = sm->sm_pp_root; |
fcff33da767f
6596237 Stop looking and start ganging
George Wilson <George.Wilson@Sun.COM>
parents:
9463
diff
changeset
|
548 |
int free_pct = sm->sm_space * 100 / sm->sm_size; |
fcff33da767f
6596237 Stop looking and start ganging
George Wilson <George.Wilson@Sun.COM>
parents:
9463
diff
changeset
|
549 |
|
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12050
diff
changeset
|
550 |
zdb_nicenum(space_map_maxsize(sm), maxbuf); |
9480
fcff33da767f
6596237 Stop looking and start ganging
George Wilson <George.Wilson@Sun.COM>
parents:
9463
diff
changeset
|
551 |
|
10861
ae18f8a4df85
6887242 want to be able to dump specific metaslab(s) for specific vdev
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10860
diff
changeset
|
552 |
(void) printf("\t %25s %10lu %7s %6s %4s %4d%%\n", |
9480
fcff33da767f
6596237 Stop looking and start ganging
George Wilson <George.Wilson@Sun.COM>
parents:
9463
diff
changeset
|
553 |
"segments", avl_numnodes(t), "maxsize", maxbuf, |
fcff33da767f
6596237 Stop looking and start ganging
George Wilson <George.Wilson@Sun.COM>
parents:
9463
diff
changeset
|
554 |
"freepct", free_pct); |
fcff33da767f
6596237 Stop looking and start ganging
George Wilson <George.Wilson@Sun.COM>
parents:
9463
diff
changeset
|
555 |
} |
fcff33da767f
6596237 Stop looking and start ganging
George Wilson <George.Wilson@Sun.COM>
parents:
9463
diff
changeset
|
556 |
|
fcff33da767f
6596237 Stop looking and start ganging
George Wilson <George.Wilson@Sun.COM>
parents:
9463
diff
changeset
|
557 |
static void |
789 | 558 |
dump_metaslab(metaslab_t *msp) |
559 |
{ |
|
560 |
vdev_t *vd = msp->ms_group->mg_vd; |
|
561 |
spa_t *spa = vd->vdev_spa; |
|
11146
7e58f40bcb1c
6826241 Sync write IOPS drops dramatically during TXG sync
George Wilson <George.Wilson@Sun.COM>
parents:
11125
diff
changeset
|
562 |
space_map_t *sm = &msp->ms_map; |
7e58f40bcb1c
6826241 Sync write IOPS drops dramatically during TXG sync
George Wilson <George.Wilson@Sun.COM>
parents:
11125
diff
changeset
|
563 |
space_map_obj_t *smo = &msp->ms_smo; |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12050
diff
changeset
|
564 |
char freebuf[32]; |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12050
diff
changeset
|
565 |
|
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12050
diff
changeset
|
566 |
zdb_nicenum(sm->sm_size - smo->smo_alloc, freebuf); |
789 | 567 |
|
568 |
(void) printf( |
|
10861
ae18f8a4df85
6887242 want to be able to dump specific metaslab(s) for specific vdev
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10860
diff
changeset
|
569 |
"\tmetaslab %6llu offset %12llx spacemap %6llu free %5s\n", |
11146
7e58f40bcb1c
6826241 Sync write IOPS drops dramatically during TXG sync
George Wilson <George.Wilson@Sun.COM>
parents:
11125
diff
changeset
|
570 |
(u_longlong_t)(sm->sm_start / sm->sm_size), |
7e58f40bcb1c
6826241 Sync write IOPS drops dramatically during TXG sync
George Wilson <George.Wilson@Sun.COM>
parents:
11125
diff
changeset
|
571 |
(u_longlong_t)sm->sm_start, (u_longlong_t)smo->smo_object, freebuf); |
789 | 572 |
|
10861
ae18f8a4df85
6887242 want to be able to dump specific metaslab(s) for specific vdev
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10860
diff
changeset
|
573 |
if (dump_opt['m'] > 1 && !dump_opt['L']) { |
9480
fcff33da767f
6596237 Stop looking and start ganging
George Wilson <George.Wilson@Sun.COM>
parents:
9463
diff
changeset
|
574 |
mutex_enter(&msp->ms_lock); |
11146
7e58f40bcb1c
6826241 Sync write IOPS drops dramatically during TXG sync
George Wilson <George.Wilson@Sun.COM>
parents:
11125
diff
changeset
|
575 |
space_map_load_wait(sm); |
11728
59fdb3b856f6
6918420 zdb -m has issues printing metaslab statistics
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
11727
diff
changeset
|
576 |
if (!sm->sm_loaded) |
11146
7e58f40bcb1c
6826241 Sync write IOPS drops dramatically during TXG sync
George Wilson <George.Wilson@Sun.COM>
parents:
11125
diff
changeset
|
577 |
VERIFY(space_map_load(sm, zfs_metaslab_ops, |
7e58f40bcb1c
6826241 Sync write IOPS drops dramatically during TXG sync
George Wilson <George.Wilson@Sun.COM>
parents:
11125
diff
changeset
|
578 |
SM_FREE, smo, spa->spa_meta_objset) == 0); |
11728
59fdb3b856f6
6918420 zdb -m has issues printing metaslab statistics
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
11727
diff
changeset
|
579 |
dump_metaslab_stats(msp); |
59fdb3b856f6
6918420 zdb -m has issues printing metaslab statistics
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
11727
diff
changeset
|
580 |
space_map_unload(sm); |
9480
fcff33da767f
6596237 Stop looking and start ganging
George Wilson <George.Wilson@Sun.COM>
parents:
9463
diff
changeset
|
581 |
mutex_exit(&msp->ms_lock); |
fcff33da767f
6596237 Stop looking and start ganging
George Wilson <George.Wilson@Sun.COM>
parents:
9463
diff
changeset
|
582 |
} |
789 | 583 |
|
9480
fcff33da767f
6596237 Stop looking and start ganging
George Wilson <George.Wilson@Sun.COM>
parents:
9463
diff
changeset
|
584 |
if (dump_opt['d'] > 5 || dump_opt['m'] > 2) { |
11146
7e58f40bcb1c
6826241 Sync write IOPS drops dramatically during TXG sync
George Wilson <George.Wilson@Sun.COM>
parents:
11125
diff
changeset
|
585 |
ASSERT(sm->sm_size == (1ULL << vd->vdev_ms_shift)); |
9480
fcff33da767f
6596237 Stop looking and start ganging
George Wilson <George.Wilson@Sun.COM>
parents:
9463
diff
changeset
|
586 |
|
fcff33da767f
6596237 Stop looking and start ganging
George Wilson <George.Wilson@Sun.COM>
parents:
9463
diff
changeset
|
587 |
mutex_enter(&msp->ms_lock); |
11146
7e58f40bcb1c
6826241 Sync write IOPS drops dramatically during TXG sync
George Wilson <George.Wilson@Sun.COM>
parents:
11125
diff
changeset
|
588 |
dump_spacemap(spa->spa_meta_objset, smo, sm); |
9480
fcff33da767f
6596237 Stop looking and start ganging
George Wilson <George.Wilson@Sun.COM>
parents:
9463
diff
changeset
|
589 |
mutex_exit(&msp->ms_lock); |
fcff33da767f
6596237 Stop looking and start ganging
George Wilson <George.Wilson@Sun.COM>
parents:
9463
diff
changeset
|
590 |
} |
10861
ae18f8a4df85
6887242 want to be able to dump specific metaslab(s) for specific vdev
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10860
diff
changeset
|
591 |
} |
9480
fcff33da767f
6596237 Stop looking and start ganging
George Wilson <George.Wilson@Sun.COM>
parents:
9463
diff
changeset
|
592 |
|
10861
ae18f8a4df85
6887242 want to be able to dump specific metaslab(s) for specific vdev
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10860
diff
changeset
|
593 |
static void |
ae18f8a4df85
6887242 want to be able to dump specific metaslab(s) for specific vdev
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10860
diff
changeset
|
594 |
print_vdev_metaslab_header(vdev_t *vd) |
ae18f8a4df85
6887242 want to be able to dump specific metaslab(s) for specific vdev
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10860
diff
changeset
|
595 |
{ |
ae18f8a4df85
6887242 want to be able to dump specific metaslab(s) for specific vdev
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10860
diff
changeset
|
596 |
(void) printf("\tvdev %10llu\n\t%-10s%5llu %-19s %-15s %-10s\n", |
ae18f8a4df85
6887242 want to be able to dump specific metaslab(s) for specific vdev
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10860
diff
changeset
|
597 |
(u_longlong_t)vd->vdev_id, |
ae18f8a4df85
6887242 want to be able to dump specific metaslab(s) for specific vdev
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10860
diff
changeset
|
598 |
"metaslabs", (u_longlong_t)vd->vdev_ms_count, |
ae18f8a4df85
6887242 want to be able to dump specific metaslab(s) for specific vdev
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10860
diff
changeset
|
599 |
"offset", "spacemap", "free"); |
ae18f8a4df85
6887242 want to be able to dump specific metaslab(s) for specific vdev
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10860
diff
changeset
|
600 |
(void) printf("\t%15s %19s %15s %10s\n", |
ae18f8a4df85
6887242 want to be able to dump specific metaslab(s) for specific vdev
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10860
diff
changeset
|
601 |
"---------------", "-------------------", |
ae18f8a4df85
6887242 want to be able to dump specific metaslab(s) for specific vdev
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10860
diff
changeset
|
602 |
"---------------", "-------------"); |
789 | 603 |
} |
604 |
||
605 |
static void |
|
606 |
dump_metaslabs(spa_t *spa) |
|
607 |
{ |
|
10861
ae18f8a4df85
6887242 want to be able to dump specific metaslab(s) for specific vdev
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10860
diff
changeset
|
608 |
vdev_t *vd, *rvd = spa->spa_root_vdev; |
ae18f8a4df85
6887242 want to be able to dump specific metaslab(s) for specific vdev
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10860
diff
changeset
|
609 |
uint64_t m, c = 0, children = rvd->vdev_children; |
789 | 610 |
|
611 |
(void) printf("\nMetaslabs:\n"); |
|
612 |
||
10861
ae18f8a4df85
6887242 want to be able to dump specific metaslab(s) for specific vdev
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10860
diff
changeset
|
613 |
if (!dump_opt['d'] && zopt_objects > 0) { |
ae18f8a4df85
6887242 want to be able to dump specific metaslab(s) for specific vdev
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10860
diff
changeset
|
614 |
c = zopt_object[0]; |
ae18f8a4df85
6887242 want to be able to dump specific metaslab(s) for specific vdev
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10860
diff
changeset
|
615 |
|
ae18f8a4df85
6887242 want to be able to dump specific metaslab(s) for specific vdev
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10860
diff
changeset
|
616 |
if (c >= children) |
ae18f8a4df85
6887242 want to be able to dump specific metaslab(s) for specific vdev
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10860
diff
changeset
|
617 |
(void) fatal("bad vdev id: %llu", (u_longlong_t)c); |
ae18f8a4df85
6887242 want to be able to dump specific metaslab(s) for specific vdev
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10860
diff
changeset
|
618 |
|
ae18f8a4df85
6887242 want to be able to dump specific metaslab(s) for specific vdev
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10860
diff
changeset
|
619 |
if (zopt_objects > 1) { |
ae18f8a4df85
6887242 want to be able to dump specific metaslab(s) for specific vdev
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10860
diff
changeset
|
620 |
vd = rvd->vdev_child[c]; |
ae18f8a4df85
6887242 want to be able to dump specific metaslab(s) for specific vdev
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10860
diff
changeset
|
621 |
print_vdev_metaslab_header(vd); |
789 | 622 |
|
10861
ae18f8a4df85
6887242 want to be able to dump specific metaslab(s) for specific vdev
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10860
diff
changeset
|
623 |
for (m = 1; m < zopt_objects; m++) { |
ae18f8a4df85
6887242 want to be able to dump specific metaslab(s) for specific vdev
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10860
diff
changeset
|
624 |
if (zopt_object[m] < vd->vdev_ms_count) |
ae18f8a4df85
6887242 want to be able to dump specific metaslab(s) for specific vdev
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10860
diff
changeset
|
625 |
dump_metaslab( |
ae18f8a4df85
6887242 want to be able to dump specific metaslab(s) for specific vdev
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10860
diff
changeset
|
626 |
vd->vdev_ms[zopt_object[m]]); |
ae18f8a4df85
6887242 want to be able to dump specific metaslab(s) for specific vdev
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10860
diff
changeset
|
627 |
else |
ae18f8a4df85
6887242 want to be able to dump specific metaslab(s) for specific vdev
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10860
diff
changeset
|
628 |
(void) fprintf(stderr, "bad metaslab " |
ae18f8a4df85
6887242 want to be able to dump specific metaslab(s) for specific vdev
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10860
diff
changeset
|
629 |
"number %llu\n", |
ae18f8a4df85
6887242 want to be able to dump specific metaslab(s) for specific vdev
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10860
diff
changeset
|
630 |
(u_longlong_t)zopt_object[m]); |
ae18f8a4df85
6887242 want to be able to dump specific metaslab(s) for specific vdev
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10860
diff
changeset
|
631 |
} |
ae18f8a4df85
6887242 want to be able to dump specific metaslab(s) for specific vdev
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10860
diff
changeset
|
632 |
(void) printf("\n"); |
ae18f8a4df85
6887242 want to be able to dump specific metaslab(s) for specific vdev
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10860
diff
changeset
|
633 |
return; |
ae18f8a4df85
6887242 want to be able to dump specific metaslab(s) for specific vdev
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10860
diff
changeset
|
634 |
} |
ae18f8a4df85
6887242 want to be able to dump specific metaslab(s) for specific vdev
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10860
diff
changeset
|
635 |
children = c + 1; |
ae18f8a4df85
6887242 want to be able to dump specific metaslab(s) for specific vdev
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10860
diff
changeset
|
636 |
} |
ae18f8a4df85
6887242 want to be able to dump specific metaslab(s) for specific vdev
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10860
diff
changeset
|
637 |
for (; c < children; c++) { |
ae18f8a4df85
6887242 want to be able to dump specific metaslab(s) for specific vdev
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10860
diff
changeset
|
638 |
vd = rvd->vdev_child[c]; |
ae18f8a4df85
6887242 want to be able to dump specific metaslab(s) for specific vdev
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10860
diff
changeset
|
639 |
print_vdev_metaslab_header(vd); |
789 | 640 |
|
641 |
for (m = 0; m < vd->vdev_ms_count; m++) |
|
642 |
dump_metaslab(vd->vdev_ms[m]); |
|
643 |
(void) printf("\n"); |
|
644 |
} |
|
645 |
} |
|
646 |
||
647 |
static void |
|
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
648 |
dump_dde(const ddt_t *ddt, const ddt_entry_t *dde, uint64_t index) |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
649 |
{ |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
650 |
const ddt_phys_t *ddp = dde->dde_phys; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
651 |
const ddt_key_t *ddk = &dde->dde_key; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
652 |
char *types[4] = { "ditto", "single", "double", "triple" }; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
653 |
char blkbuf[BP_SPRINTF_LEN]; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
654 |
blkptr_t blk; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
655 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
656 |
for (int p = 0; p < DDT_PHYS_TYPES; p++, ddp++) { |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
657 |
if (ddp->ddp_phys_birth == 0) |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
658 |
continue; |
11125
fca3e6d28599
6899923 vdev_offline/vdev_add deadlock
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10922
diff
changeset
|
659 |
ddt_bp_create(ddt->ddt_checksum, ddk, ddp, &blk); |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
660 |
sprintf_blkptr(blkbuf, &blk); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
661 |
(void) printf("index %llx refcnt %llu %s %s\n", |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
662 |
(u_longlong_t)index, (u_longlong_t)ddp->ddp_refcnt, |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
663 |
types[p], blkbuf); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
664 |
} |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
665 |
} |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
666 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
667 |
static void |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
668 |
dump_dedup_ratio(const ddt_stat_t *dds) |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
669 |
{ |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
670 |
double rL, rP, rD, D, dedup, compress, copies; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
671 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
672 |
if (dds->dds_blocks == 0) |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
673 |
return; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
674 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
675 |
rL = (double)dds->dds_ref_lsize; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
676 |
rP = (double)dds->dds_ref_psize; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
677 |
rD = (double)dds->dds_ref_dsize; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
678 |
D = (double)dds->dds_dsize; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
679 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
680 |
dedup = rD / D; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
681 |
compress = rL / rP; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
682 |
copies = rD / rP; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
683 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
684 |
(void) printf("dedup = %.2f, compress = %.2f, copies = %.2f, " |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
685 |
"dedup * compress / copies = %.2f\n\n", |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
686 |
dedup, compress, copies, dedup * compress / copies); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
687 |
} |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
688 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
689 |
static void |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
690 |
dump_ddt(ddt_t *ddt, enum ddt_type type, enum ddt_class class) |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
691 |
{ |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
692 |
char name[DDT_NAMELEN]; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
693 |
ddt_entry_t dde; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
694 |
uint64_t walk = 0; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
695 |
dmu_object_info_t doi; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
696 |
uint64_t count, dspace, mspace; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
697 |
int error; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
698 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
699 |
error = ddt_object_info(ddt, type, class, &doi); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
700 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
701 |
if (error == ENOENT) |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
702 |
return; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
703 |
ASSERT(error == 0); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
704 |
|
12671
2fee57289adb
6959651 assertion failed: ddo_total->ddo_dspace == 0, file: ../../common/fs/zfs/ddt.c, line: 460
George Wilson <George.Wilson@Sun.COM>
parents:
12493
diff
changeset
|
705 |
if ((count = ddt_object_count(ddt, type, class)) == 0) |
2fee57289adb
6959651 assertion failed: ddo_total->ddo_dspace == 0, file: ../../common/fs/zfs/ddt.c, line: 460
George Wilson <George.Wilson@Sun.COM>
parents:
12493
diff
changeset
|
706 |
return; |
2fee57289adb
6959651 assertion failed: ddo_total->ddo_dspace == 0, file: ../../common/fs/zfs/ddt.c, line: 460
George Wilson <George.Wilson@Sun.COM>
parents:
12493
diff
changeset
|
707 |
|
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
708 |
dspace = doi.doi_physical_blocks_512 << 9; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
709 |
mspace = doi.doi_fill_count * doi.doi_data_block_size; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
710 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
711 |
ddt_object_name(ddt, type, class, name); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
712 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
713 |
(void) printf("%s: %llu entries, size %llu on disk, %llu in core\n", |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
714 |
name, |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
715 |
(u_longlong_t)count, |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
716 |
(u_longlong_t)(dspace / count), |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
717 |
(u_longlong_t)(mspace / count)); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
718 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
719 |
if (dump_opt['D'] < 3) |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
720 |
return; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
721 |
|
11149
8bad7424e2c2
6903731 need userland dedup stats
George Wilson <George.Wilson@Sun.COM>
parents:
11146
diff
changeset
|
722 |
zpool_dump_ddt(NULL, &ddt->ddt_histogram[type][class]); |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
723 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
724 |
if (dump_opt['D'] < 4) |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
725 |
return; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
726 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
727 |
if (dump_opt['D'] < 5 && class == DDT_CLASS_UNIQUE) |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
728 |
return; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
729 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
730 |
(void) printf("%s contents:\n\n", name); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
731 |
|
11125
fca3e6d28599
6899923 vdev_offline/vdev_add deadlock
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10922
diff
changeset
|
732 |
while ((error = ddt_object_walk(ddt, type, class, &walk, &dde)) == 0) |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
733 |
dump_dde(ddt, &dde, walk); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
734 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
735 |
ASSERT(error == ENOENT); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
736 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
737 |
(void) printf("\n"); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
738 |
} |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
739 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
740 |
static void |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
741 |
dump_all_ddts(spa_t *spa) |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
742 |
{ |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
743 |
ddt_histogram_t ddh_total = { 0 }; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
744 |
ddt_stat_t dds_total = { 0 }; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
745 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
746 |
for (enum zio_checksum c = 0; c < ZIO_CHECKSUM_FUNCTIONS; c++) { |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
747 |
ddt_t *ddt = spa->spa_ddt[c]; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
748 |
for (enum ddt_type type = 0; type < DDT_TYPES; type++) { |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
749 |
for (enum ddt_class class = 0; class < DDT_CLASSES; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
750 |
class++) { |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
751 |
dump_ddt(ddt, type, class); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
752 |
} |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
753 |
} |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
754 |
} |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
755 |
|
11149
8bad7424e2c2
6903731 need userland dedup stats
George Wilson <George.Wilson@Sun.COM>
parents:
11146
diff
changeset
|
756 |
ddt_get_dedup_stats(spa, &dds_total); |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
757 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
758 |
if (dds_total.dds_blocks == 0) { |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
759 |
(void) printf("All DDTs are empty\n"); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
760 |
return; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
761 |
} |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
762 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
763 |
(void) printf("\n"); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
764 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
765 |
if (dump_opt['D'] > 1) { |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
766 |
(void) printf("DDT histogram (aggregated over all DDTs):\n"); |
11149
8bad7424e2c2
6903731 need userland dedup stats
George Wilson <George.Wilson@Sun.COM>
parents:
11146
diff
changeset
|
767 |
ddt_get_dedup_histogram(spa, &ddh_total); |
8bad7424e2c2
6903731 need userland dedup stats
George Wilson <George.Wilson@Sun.COM>
parents:
11146
diff
changeset
|
768 |
zpool_dump_ddt(&dds_total, &ddh_total); |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
769 |
} |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
770 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
771 |
dump_dedup_ratio(&dds_total); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
772 |
} |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
773 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
774 |
static void |
8241
5a60f16123ba
6328632 zpool offline is a bit too conservative
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
8188
diff
changeset
|
775 |
dump_dtl_seg(space_map_t *sm, uint64_t start, uint64_t size) |
5a60f16123ba
6328632 zpool offline is a bit too conservative
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
8188
diff
changeset
|
776 |
{ |
5a60f16123ba
6328632 zpool offline is a bit too conservative
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
8188
diff
changeset
|
777 |
char *prefix = (void *)sm; |
5a60f16123ba
6328632 zpool offline is a bit too conservative
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
8188
diff
changeset
|
778 |
|
5a60f16123ba
6328632 zpool offline is a bit too conservative
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
8188
diff
changeset
|
779 |
(void) printf("%s [%llu,%llu) length %llu\n", |
5a60f16123ba
6328632 zpool offline is a bit too conservative
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
8188
diff
changeset
|
780 |
prefix, |
5a60f16123ba
6328632 zpool offline is a bit too conservative
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
8188
diff
changeset
|
781 |
(u_longlong_t)start, |
5a60f16123ba
6328632 zpool offline is a bit too conservative
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
8188
diff
changeset
|
782 |
(u_longlong_t)(start + size), |
5a60f16123ba
6328632 zpool offline is a bit too conservative
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
8188
diff
changeset
|
783 |
(u_longlong_t)(size)); |
5a60f16123ba
6328632 zpool offline is a bit too conservative
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
8188
diff
changeset
|
784 |
} |
5a60f16123ba
6328632 zpool offline is a bit too conservative
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
8188
diff
changeset
|
785 |
|
5a60f16123ba
6328632 zpool offline is a bit too conservative
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
8188
diff
changeset
|
786 |
static void |
789 | 787 |
dump_dtl(vdev_t *vd, int indent) |
788 |
{ |
|
8241
5a60f16123ba
6328632 zpool offline is a bit too conservative
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
8188
diff
changeset
|
789 |
spa_t *spa = vd->vdev_spa; |
5a60f16123ba
6328632 zpool offline is a bit too conservative
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
8188
diff
changeset
|
790 |
boolean_t required; |
5a60f16123ba
6328632 zpool offline is a bit too conservative
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
8188
diff
changeset
|
791 |
char *name[DTL_TYPES] = { "missing", "partial", "scrub", "outage" }; |
5a60f16123ba
6328632 zpool offline is a bit too conservative
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
8188
diff
changeset
|
792 |
char prefix[256]; |
5a60f16123ba
6328632 zpool offline is a bit too conservative
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
8188
diff
changeset
|
793 |
|
10685
931790026ac6
6846163 ZFS continues to use faulted logzilla, bringing system to a crawl
George Wilson <George.Wilson@Sun.COM>
parents:
10594
diff
changeset
|
794 |
spa_vdev_state_enter(spa, SCL_NONE); |
8241
5a60f16123ba
6328632 zpool offline is a bit too conservative
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
8188
diff
changeset
|
795 |
required = vdev_dtl_required(vd); |
5a60f16123ba
6328632 zpool offline is a bit too conservative
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
8188
diff
changeset
|
796 |
(void) spa_vdev_state_exit(spa, NULL, 0); |
789 | 797 |
|
798 |
if (indent == 0) |
|
799 |
(void) printf("\nDirty time logs:\n\n"); |
|
800 |
||
8241
5a60f16123ba
6328632 zpool offline is a bit too conservative
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
8188
diff
changeset
|
801 |
(void) printf("\t%*s%s [%s]\n", indent, "", |
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
|
802 |
vd->vdev_path ? vd->vdev_path : |
8241
5a60f16123ba
6328632 zpool offline is a bit too conservative
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
8188
diff
changeset
|
803 |
vd->vdev_parent ? vd->vdev_ops->vdev_op_type : spa_name(spa), |
5a60f16123ba
6328632 zpool offline is a bit too conservative
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
8188
diff
changeset
|
804 |
required ? "DTL-required" : "DTL-expendable"); |
789 | 805 |
|
8241
5a60f16123ba
6328632 zpool offline is a bit too conservative
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
8188
diff
changeset
|
806 |
for (int t = 0; t < DTL_TYPES; t++) { |
5a60f16123ba
6328632 zpool offline is a bit too conservative
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
8188
diff
changeset
|
807 |
space_map_t *sm = &vd->vdev_dtl[t]; |
5a60f16123ba
6328632 zpool offline is a bit too conservative
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
8188
diff
changeset
|
808 |
if (sm->sm_space == 0) |
5a60f16123ba
6328632 zpool offline is a bit too conservative
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
8188
diff
changeset
|
809 |
continue; |
5a60f16123ba
6328632 zpool offline is a bit too conservative
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
8188
diff
changeset
|
810 |
(void) snprintf(prefix, sizeof (prefix), "\t%*s%s", |
5a60f16123ba
6328632 zpool offline is a bit too conservative
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
8188
diff
changeset
|
811 |
indent + 2, "", name[t]); |
5a60f16123ba
6328632 zpool offline is a bit too conservative
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
8188
diff
changeset
|
812 |
mutex_enter(sm->sm_lock); |
5a60f16123ba
6328632 zpool offline is a bit too conservative
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
8188
diff
changeset
|
813 |
space_map_walk(sm, dump_dtl_seg, (void *)prefix); |
5a60f16123ba
6328632 zpool offline is a bit too conservative
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
8188
diff
changeset
|
814 |
mutex_exit(sm->sm_lock); |
5a60f16123ba
6328632 zpool offline is a bit too conservative
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
8188
diff
changeset
|
815 |
if (dump_opt['d'] > 5 && vd->vdev_children == 0) |
5a60f16123ba
6328632 zpool offline is a bit too conservative
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
8188
diff
changeset
|
816 |
dump_spacemap(spa->spa_meta_objset, |
5a60f16123ba
6328632 zpool offline is a bit too conservative
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
8188
diff
changeset
|
817 |
&vd->vdev_dtl_smo, sm); |
789 | 818 |
} |
819 |
||
8241
5a60f16123ba
6328632 zpool offline is a bit too conservative
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
8188
diff
changeset
|
820 |
for (int c = 0; c < vd->vdev_children; c++) |
789 | 821 |
dump_dtl(vd->vdev_child[c], indent + 4); |
822 |
} |
|
823 |
||
10685
931790026ac6
6846163 ZFS continues to use faulted logzilla, bringing system to a crawl
George Wilson <George.Wilson@Sun.COM>
parents:
10594
diff
changeset
|
824 |
static void |
931790026ac6
6846163 ZFS continues to use faulted logzilla, bringing system to a crawl
George Wilson <George.Wilson@Sun.COM>
parents:
10594
diff
changeset
|
825 |
dump_history(spa_t *spa) |
931790026ac6
6846163 ZFS continues to use faulted logzilla, bringing system to a crawl
George Wilson <George.Wilson@Sun.COM>
parents:
10594
diff
changeset
|
826 |
{ |
931790026ac6
6846163 ZFS continues to use faulted logzilla, bringing system to a crawl
George Wilson <George.Wilson@Sun.COM>
parents:
10594
diff
changeset
|
827 |
nvlist_t **events = NULL; |
931790026ac6
6846163 ZFS continues to use faulted logzilla, bringing system to a crawl
George Wilson <George.Wilson@Sun.COM>
parents:
10594
diff
changeset
|
828 |
char buf[SPA_MAXBLOCKSIZE]; |
10857
2c20a0bd87cd
6892882 zdb -ddddd prints garbage from stack between dataset summary and rootbp
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10685
diff
changeset
|
829 |
uint64_t resid, len, off = 0; |
10685
931790026ac6
6846163 ZFS continues to use faulted logzilla, bringing system to a crawl
George Wilson <George.Wilson@Sun.COM>
parents:
10594
diff
changeset
|
830 |
uint_t num = 0; |
931790026ac6
6846163 ZFS continues to use faulted logzilla, bringing system to a crawl
George Wilson <George.Wilson@Sun.COM>
parents:
10594
diff
changeset
|
831 |
int error; |
931790026ac6
6846163 ZFS continues to use faulted logzilla, bringing system to a crawl
George Wilson <George.Wilson@Sun.COM>
parents:
10594
diff
changeset
|
832 |
time_t tsec; |
931790026ac6
6846163 ZFS continues to use faulted logzilla, bringing system to a crawl
George Wilson <George.Wilson@Sun.COM>
parents:
10594
diff
changeset
|
833 |
struct tm t; |
931790026ac6
6846163 ZFS continues to use faulted logzilla, bringing system to a crawl
George Wilson <George.Wilson@Sun.COM>
parents:
10594
diff
changeset
|
834 |
char tbuf[30]; |
931790026ac6
6846163 ZFS continues to use faulted logzilla, bringing system to a crawl
George Wilson <George.Wilson@Sun.COM>
parents:
10594
diff
changeset
|
835 |
char internalstr[MAXPATHLEN]; |
931790026ac6
6846163 ZFS continues to use faulted logzilla, bringing system to a crawl
George Wilson <George.Wilson@Sun.COM>
parents:
10594
diff
changeset
|
836 |
|
931790026ac6
6846163 ZFS continues to use faulted logzilla, bringing system to a crawl
George Wilson <George.Wilson@Sun.COM>
parents:
10594
diff
changeset
|
837 |
do { |
10857
2c20a0bd87cd
6892882 zdb -ddddd prints garbage from stack between dataset summary and rootbp
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10685
diff
changeset
|
838 |
len = sizeof (buf); |
2c20a0bd87cd
6892882 zdb -ddddd prints garbage from stack between dataset summary and rootbp
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10685
diff
changeset
|
839 |
|
10685
931790026ac6
6846163 ZFS continues to use faulted logzilla, bringing system to a crawl
George Wilson <George.Wilson@Sun.COM>
parents:
10594
diff
changeset
|
840 |
if ((error = spa_history_get(spa, &off, &len, buf)) != 0) { |
931790026ac6
6846163 ZFS continues to use faulted logzilla, bringing system to a crawl
George Wilson <George.Wilson@Sun.COM>
parents:
10594
diff
changeset
|
841 |
(void) fprintf(stderr, "Unable to read history: " |
931790026ac6
6846163 ZFS continues to use faulted logzilla, bringing system to a crawl
George Wilson <George.Wilson@Sun.COM>
parents:
10594
diff
changeset
|
842 |
"error %d\n", error); |
931790026ac6
6846163 ZFS continues to use faulted logzilla, bringing system to a crawl
George Wilson <George.Wilson@Sun.COM>
parents:
10594
diff
changeset
|
843 |
return; |
931790026ac6
6846163 ZFS continues to use faulted logzilla, bringing system to a crawl
George Wilson <George.Wilson@Sun.COM>
parents:
10594
diff
changeset
|
844 |
} |
931790026ac6
6846163 ZFS continues to use faulted logzilla, bringing system to a crawl
George Wilson <George.Wilson@Sun.COM>
parents:
10594
diff
changeset
|
845 |
|
931790026ac6
6846163 ZFS continues to use faulted logzilla, bringing system to a crawl
George Wilson <George.Wilson@Sun.COM>
parents:
10594
diff
changeset
|
846 |
if (zpool_history_unpack(buf, len, &resid, &events, &num) != 0) |
931790026ac6
6846163 ZFS continues to use faulted logzilla, bringing system to a crawl
George Wilson <George.Wilson@Sun.COM>
parents:
10594
diff
changeset
|
847 |
break; |
931790026ac6
6846163 ZFS continues to use faulted logzilla, bringing system to a crawl
George Wilson <George.Wilson@Sun.COM>
parents:
10594
diff
changeset
|
848 |
|
931790026ac6
6846163 ZFS continues to use faulted logzilla, bringing system to a crawl
George Wilson <George.Wilson@Sun.COM>
parents:
10594
diff
changeset
|
849 |
off -= resid; |
931790026ac6
6846163 ZFS continues to use faulted logzilla, bringing system to a crawl
George Wilson <George.Wilson@Sun.COM>
parents:
10594
diff
changeset
|
850 |
} while (len != 0); |
931790026ac6
6846163 ZFS continues to use faulted logzilla, bringing system to a crawl
George Wilson <George.Wilson@Sun.COM>
parents:
10594
diff
changeset
|
851 |
|
931790026ac6
6846163 ZFS continues to use faulted logzilla, bringing system to a crawl
George Wilson <George.Wilson@Sun.COM>
parents:
10594
diff
changeset
|
852 |
(void) printf("\nHistory:\n"); |
931790026ac6
6846163 ZFS continues to use faulted logzilla, bringing system to a crawl
George Wilson <George.Wilson@Sun.COM>
parents:
10594
diff
changeset
|
853 |
for (int i = 0; i < num; i++) { |
931790026ac6
6846163 ZFS continues to use faulted logzilla, bringing system to a crawl
George Wilson <George.Wilson@Sun.COM>
parents:
10594
diff
changeset
|
854 |
uint64_t time, txg, ievent; |
931790026ac6
6846163 ZFS continues to use faulted logzilla, bringing system to a crawl
George Wilson <George.Wilson@Sun.COM>
parents:
10594
diff
changeset
|
855 |
char *cmd, *intstr; |
931790026ac6
6846163 ZFS continues to use faulted logzilla, bringing system to a crawl
George Wilson <George.Wilson@Sun.COM>
parents:
10594
diff
changeset
|
856 |
|
931790026ac6
6846163 ZFS continues to use faulted logzilla, bringing system to a crawl
George Wilson <George.Wilson@Sun.COM>
parents:
10594
diff
changeset
|
857 |
if (nvlist_lookup_uint64(events[i], ZPOOL_HIST_TIME, |
931790026ac6
6846163 ZFS continues to use faulted logzilla, bringing system to a crawl
George Wilson <George.Wilson@Sun.COM>
parents:
10594
diff
changeset
|
858 |
&time) != 0) |
931790026ac6
6846163 ZFS continues to use faulted logzilla, bringing system to a crawl
George Wilson <George.Wilson@Sun.COM>
parents:
10594
diff
changeset
|
859 |
continue; |
931790026ac6
6846163 ZFS continues to use faulted logzilla, bringing system to a crawl
George Wilson <George.Wilson@Sun.COM>
parents:
10594
diff
changeset
|
860 |
if (nvlist_lookup_string(events[i], ZPOOL_HIST_CMD, |
931790026ac6
6846163 ZFS continues to use faulted logzilla, bringing system to a crawl
George Wilson <George.Wilson@Sun.COM>
parents:
10594
diff
changeset
|
861 |
&cmd) != 0) { |
931790026ac6
6846163 ZFS continues to use faulted logzilla, bringing system to a crawl
George Wilson <George.Wilson@Sun.COM>
parents:
10594
diff
changeset
|
862 |
if (nvlist_lookup_uint64(events[i], |
931790026ac6
6846163 ZFS continues to use faulted logzilla, bringing system to a crawl
George Wilson <George.Wilson@Sun.COM>
parents:
10594
diff
changeset
|
863 |
ZPOOL_HIST_INT_EVENT, &ievent) != 0) |
931790026ac6
6846163 ZFS continues to use faulted logzilla, bringing system to a crawl
George Wilson <George.Wilson@Sun.COM>
parents:
10594
diff
changeset
|
864 |
continue; |
931790026ac6
6846163 ZFS continues to use faulted logzilla, bringing system to a crawl
George Wilson <George.Wilson@Sun.COM>
parents:
10594
diff
changeset
|
865 |
verify(nvlist_lookup_uint64(events[i], |
931790026ac6
6846163 ZFS continues to use faulted logzilla, bringing system to a crawl
George Wilson <George.Wilson@Sun.COM>
parents:
10594
diff
changeset
|
866 |
ZPOOL_HIST_TXG, &txg) == 0); |
931790026ac6
6846163 ZFS continues to use faulted logzilla, bringing system to a crawl
George Wilson <George.Wilson@Sun.COM>
parents:
10594
diff
changeset
|
867 |
verify(nvlist_lookup_string(events[i], |
931790026ac6
6846163 ZFS continues to use faulted logzilla, bringing system to a crawl
George Wilson <George.Wilson@Sun.COM>
parents:
10594
diff
changeset
|
868 |
ZPOOL_HIST_INT_STR, &intstr) == 0); |
931790026ac6
6846163 ZFS continues to use faulted logzilla, bringing system to a crawl
George Wilson <George.Wilson@Sun.COM>
parents:
10594
diff
changeset
|
869 |
if (ievent >= LOG_END) |
931790026ac6
6846163 ZFS continues to use faulted logzilla, bringing system to a crawl
George Wilson <George.Wilson@Sun.COM>
parents:
10594
diff
changeset
|
870 |
continue; |
931790026ac6
6846163 ZFS continues to use faulted logzilla, bringing system to a crawl
George Wilson <George.Wilson@Sun.COM>
parents:
10594
diff
changeset
|
871 |
|
931790026ac6
6846163 ZFS continues to use faulted logzilla, bringing system to a crawl
George Wilson <George.Wilson@Sun.COM>
parents:
10594
diff
changeset
|
872 |
(void) snprintf(internalstr, |
931790026ac6
6846163 ZFS continues to use faulted logzilla, bringing system to a crawl
George Wilson <George.Wilson@Sun.COM>
parents:
10594
diff
changeset
|
873 |
sizeof (internalstr), |
931790026ac6
6846163 ZFS continues to use faulted logzilla, bringing system to a crawl
George Wilson <George.Wilson@Sun.COM>
parents:
10594
diff
changeset
|
874 |
"[internal %s txg:%lld] %s", |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12050
diff
changeset
|
875 |
zfs_history_event_names[ievent], txg, |
10685
931790026ac6
6846163 ZFS continues to use faulted logzilla, bringing system to a crawl
George Wilson <George.Wilson@Sun.COM>
parents:
10594
diff
changeset
|
876 |
intstr); |
931790026ac6
6846163 ZFS continues to use faulted logzilla, bringing system to a crawl
George Wilson <George.Wilson@Sun.COM>
parents:
10594
diff
changeset
|
877 |
cmd = internalstr; |
931790026ac6
6846163 ZFS continues to use faulted logzilla, bringing system to a crawl
George Wilson <George.Wilson@Sun.COM>
parents:
10594
diff
changeset
|
878 |
} |
931790026ac6
6846163 ZFS continues to use faulted logzilla, bringing system to a crawl
George Wilson <George.Wilson@Sun.COM>
parents:
10594
diff
changeset
|
879 |
tsec = time; |
931790026ac6
6846163 ZFS continues to use faulted logzilla, bringing system to a crawl
George Wilson <George.Wilson@Sun.COM>
parents:
10594
diff
changeset
|
880 |
(void) localtime_r(&tsec, &t); |
931790026ac6
6846163 ZFS continues to use faulted logzilla, bringing system to a crawl
George Wilson <George.Wilson@Sun.COM>
parents:
10594
diff
changeset
|
881 |
(void) strftime(tbuf, sizeof (tbuf), "%F.%T", &t); |
931790026ac6
6846163 ZFS continues to use faulted logzilla, bringing system to a crawl
George Wilson <George.Wilson@Sun.COM>
parents:
10594
diff
changeset
|
882 |
(void) printf("%s %s\n", tbuf, cmd); |
931790026ac6
6846163 ZFS continues to use faulted logzilla, bringing system to a crawl
George Wilson <George.Wilson@Sun.COM>
parents:
10594
diff
changeset
|
883 |
} |
931790026ac6
6846163 ZFS continues to use faulted logzilla, bringing system to a crawl
George Wilson <George.Wilson@Sun.COM>
parents:
10594
diff
changeset
|
884 |
} |
931790026ac6
6846163 ZFS continues to use faulted logzilla, bringing system to a crawl
George Wilson <George.Wilson@Sun.COM>
parents:
10594
diff
changeset
|
885 |
|
789 | 886 |
/*ARGSUSED*/ |
887 |
static void |
|
888 |
dump_dnode(objset_t *os, uint64_t object, void *data, size_t size) |
|
889 |
{ |
|
890 |
} |
|
891 |
||
892 |
static uint64_t |
|
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
893 |
blkid2offset(const dnode_phys_t *dnp, const blkptr_t *bp, const zbookmark_t *zb) |
789 | 894 |
{ |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
895 |
if (dnp == NULL) { |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
896 |
ASSERT(zb->zb_level < 0); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
897 |
if (zb->zb_object == 0) |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
898 |
return (zb->zb_blkid); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
899 |
return (zb->zb_blkid * BP_GET_LSIZE(bp)); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
900 |
} |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
901 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
902 |
ASSERT(zb->zb_level >= 0); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
903 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
904 |
return ((zb->zb_blkid << |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
905 |
(zb->zb_level * (dnp->dn_indblkshift - SPA_BLKPTRSHIFT))) * |
789 | 906 |
dnp->dn_datablkszsec << SPA_MINBLOCKSHIFT); |
907 |
} |
|
908 |
||
1775
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
909 |
static void |
12470
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
910 |
sprintf_blkptr_compact(char *blkbuf, const blkptr_t *bp) |
1775
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
911 |
{ |
12470
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
912 |
const dva_t *dva = bp->blk_dva; |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
913 |
int ndvas = dump_opt['d'] > 5 ? BP_GET_NDVAS(bp) : 1; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
914 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
915 |
if (dump_opt['b'] >= 5) { |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
916 |
sprintf_blkptr(blkbuf, bp); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
917 |
return; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
918 |
} |
1775
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
919 |
|
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
920 |
blkbuf[0] = '\0'; |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
921 |
|
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
922 |
for (int i = 0; i < ndvas; i++) |
1775
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
923 |
(void) sprintf(blkbuf + strlen(blkbuf), "%llu:%llx:%llx ", |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
924 |
(u_longlong_t)DVA_GET_VDEV(&dva[i]), |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
925 |
(u_longlong_t)DVA_GET_OFFSET(&dva[i]), |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
926 |
(u_longlong_t)DVA_GET_ASIZE(&dva[i])); |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
927 |
|
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
928 |
(void) sprintf(blkbuf + strlen(blkbuf), |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
929 |
"%llxL/%llxP F=%llu B=%llu/%llu", |
1775
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
930 |
(u_longlong_t)BP_GET_LSIZE(bp), |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
931 |
(u_longlong_t)BP_GET_PSIZE(bp), |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
932 |
(u_longlong_t)bp->blk_fill, |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
933 |
(u_longlong_t)bp->blk_birth, |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
934 |
(u_longlong_t)BP_PHYSICAL_BIRTH(bp)); |
1775
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
935 |
} |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
936 |
|
7837
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
937 |
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
|
938 |
print_indirect(blkptr_t *bp, const zbookmark_t *zb, |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
939 |
const dnode_phys_t *dnp) |
789 | 940 |
{ |
7837
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
941 |
char blkbuf[BP_SPRINTF_LEN]; |
789 | 942 |
int l; |
943 |
||
7837
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
944 |
ASSERT3U(BP_GET_TYPE(bp), ==, dnp->dn_type); |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
945 |
ASSERT3U(BP_GET_LEVEL(bp), ==, zb->zb_level); |
789 | 946 |
|
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
947 |
(void) printf("%16llx ", (u_longlong_t)blkid2offset(dnp, bp, zb)); |
789 | 948 |
|
949 |
ASSERT(zb->zb_level >= 0); |
|
950 |
||
951 |
for (l = dnp->dn_nlevels - 1; l >= -1; l--) { |
|
952 |
if (l == zb->zb_level) { |
|
7837
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
953 |
(void) printf("L%llx", (u_longlong_t)zb->zb_level); |
789 | 954 |
} else { |
7837
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
955 |
(void) printf(" "); |
789 | 956 |
} |
957 |
} |
|
958 |
||
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
959 |
sprintf_blkptr_compact(blkbuf, bp); |
7837
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
960 |
(void) printf("%s\n", blkbuf); |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
961 |
} |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
962 |
|
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
963 |
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
|
964 |
visit_indirect(spa_t *spa, const dnode_phys_t *dnp, |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
965 |
blkptr_t *bp, const zbookmark_t *zb) |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
966 |
{ |
10857
2c20a0bd87cd
6892882 zdb -ddddd prints garbage from stack between dataset summary and rootbp
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10685
diff
changeset
|
967 |
int err = 0; |
7837
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
968 |
|
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
969 |
if (bp->blk_birth == 0) |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
970 |
return (0); |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
971 |
|
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
972 |
print_indirect(bp, zb, dnp); |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
973 |
|
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
974 |
if (BP_GET_LEVEL(bp) > 0) { |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
975 |
uint32_t flags = ARC_WAIT; |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
976 |
int i; |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
977 |
blkptr_t *cbp; |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
978 |
int epb = BP_GET_LSIZE(bp) >> SPA_BLKPTRSHIFT; |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
979 |
arc_buf_t *buf; |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
980 |
uint64_t fill = 0; |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
981 |
|
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
982 |
err = arc_read_nolock(NULL, spa, bp, arc_getbuf_func, &buf, |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
983 |
ZIO_PRIORITY_ASYNC_READ, ZIO_FLAG_CANFAIL, &flags, zb); |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
984 |
if (err) |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
985 |
return (err); |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12050
diff
changeset
|
986 |
ASSERT(buf->b_data); |
7837
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
987 |
|
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
988 |
/* recursively visit blocks below this */ |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
989 |
cbp = buf->b_data; |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
990 |
for (i = 0; i < epb; i++, cbp++) { |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
991 |
zbookmark_t czb; |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
992 |
|
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
993 |
SET_BOOKMARK(&czb, zb->zb_objset, zb->zb_object, |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
994 |
zb->zb_level - 1, |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
995 |
zb->zb_blkid * epb + i); |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
996 |
err = visit_indirect(spa, dnp, cbp, &czb); |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
997 |
if (err) |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
998 |
break; |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
999 |
fill += cbp->blk_fill; |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
1000 |
} |
8241
5a60f16123ba
6328632 zpool offline is a bit too conservative
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
8188
diff
changeset
|
1001 |
if (!err) |
5a60f16123ba
6328632 zpool offline is a bit too conservative
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
8188
diff
changeset
|
1002 |
ASSERT3U(fill, ==, bp->blk_fill); |
7837
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
1003 |
(void) arc_buf_remove_ref(buf, &buf); |
789 | 1004 |
} |
1005 |
||
7837
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
1006 |
return (err); |
789 | 1007 |
} |
1008 |
||
1009 |
/*ARGSUSED*/ |
|
1010 |
static void |
|
7837
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
1011 |
dump_indirect(dnode_t *dn) |
789 | 1012 |
{ |
7837
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
1013 |
dnode_phys_t *dnp = dn->dn_phys; |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
1014 |
int j; |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
1015 |
zbookmark_t czb; |
789 | 1016 |
|
1017 |
(void) printf("Indirect blocks:\n"); |
|
1018 |
||
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
1019 |
SET_BOOKMARK(&czb, dmu_objset_id(dn->dn_objset), |
7837
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
1020 |
dn->dn_object, dnp->dn_nlevels - 1, 0); |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
1021 |
for (j = 0; j < dnp->dn_nblkptr; j++) { |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
1022 |
czb.zb_blkid = j; |
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
1023 |
(void) visit_indirect(dmu_objset_spa(dn->dn_objset), dnp, |
7837
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
1024 |
&dnp->dn_blkptr[j], &czb); |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
1025 |
} |
789 | 1026 |
|
1027 |
(void) printf("\n"); |
|
1028 |
} |
|
1029 |
||
1030 |
/*ARGSUSED*/ |
|
1031 |
static void |
|
1032 |
dump_dsl_dir(objset_t *os, uint64_t object, void *data, size_t size) |
|
1033 |
{ |
|
1034 |
dsl_dir_phys_t *dd = data; |
|
1035 |
time_t crtime; |
|
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12050
diff
changeset
|
1036 |
char nice[32]; |
789 | 1037 |
|
1038 |
if (dd == NULL) |
|
1039 |
return; |
|
1040 |
||
5331 | 1041 |
ASSERT3U(size, >=, sizeof (dsl_dir_phys_t)); |
789 | 1042 |
|
1043 |
crtime = dd->dd_creation_time; |
|
1044 |
(void) printf("\t\tcreation_time = %s", ctime(&crtime)); |
|
1045 |
(void) printf("\t\thead_dataset_obj = %llu\n", |
|
1046 |
(u_longlong_t)dd->dd_head_dataset_obj); |
|
1047 |
(void) printf("\t\tparent_dir_obj = %llu\n", |
|
1048 |
(u_longlong_t)dd->dd_parent_obj); |
|
5367 | 1049 |
(void) printf("\t\torigin_obj = %llu\n", |
1050 |
(u_longlong_t)dd->dd_origin_obj); |
|
789 | 1051 |
(void) printf("\t\tchild_dir_zapobj = %llu\n", |
1052 |
(u_longlong_t)dd->dd_child_dir_zapobj); |
|
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12050
diff
changeset
|
1053 |
zdb_nicenum(dd->dd_used_bytes, nice); |
7390
6d408f0a5fbd
PSARC/2008/518 ZFS space accounting enhancements
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7265
diff
changeset
|
1054 |
(void) printf("\t\tused_bytes = %s\n", nice); |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12050
diff
changeset
|
1055 |
zdb_nicenum(dd->dd_compressed_bytes, nice); |
7390
6d408f0a5fbd
PSARC/2008/518 ZFS space accounting enhancements
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7265
diff
changeset
|
1056 |
(void) printf("\t\tcompressed_bytes = %s\n", nice); |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12050
diff
changeset
|
1057 |
zdb_nicenum(dd->dd_uncompressed_bytes, nice); |
7390
6d408f0a5fbd
PSARC/2008/518 ZFS space accounting enhancements
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7265
diff
changeset
|
1058 |
(void) printf("\t\tuncompressed_bytes = %s\n", nice); |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12050
diff
changeset
|
1059 |
zdb_nicenum(dd->dd_quota, nice); |
7390
6d408f0a5fbd
PSARC/2008/518 ZFS space accounting enhancements
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7265
diff
changeset
|
1060 |
(void) printf("\t\tquota = %s\n", nice); |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12050
diff
changeset
|
1061 |
zdb_nicenum(dd->dd_reserved, nice); |
7390
6d408f0a5fbd
PSARC/2008/518 ZFS space accounting enhancements
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7265
diff
changeset
|
1062 |
(void) printf("\t\treserved = %s\n", nice); |
789 | 1063 |
(void) printf("\t\tprops_zapobj = %llu\n", |
1064 |
(u_longlong_t)dd->dd_props_zapobj); |
|
4543 | 1065 |
(void) printf("\t\tdeleg_zapobj = %llu\n", |
1066 |
(u_longlong_t)dd->dd_deleg_zapobj); |
|
7390
6d408f0a5fbd
PSARC/2008/518 ZFS space accounting enhancements
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7265
diff
changeset
|
1067 |
(void) printf("\t\tflags = %llx\n", |
6d408f0a5fbd
PSARC/2008/518 ZFS space accounting enhancements
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7265
diff
changeset
|
1068 |
(u_longlong_t)dd->dd_flags); |
6d408f0a5fbd
PSARC/2008/518 ZFS space accounting enhancements
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7265
diff
changeset
|
1069 |
|
6d408f0a5fbd
PSARC/2008/518 ZFS space accounting enhancements
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7265
diff
changeset
|
1070 |
#define DO(which) \ |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12050
diff
changeset
|
1071 |
zdb_nicenum(dd->dd_used_breakdown[DD_USED_ ## which], nice); \ |
7390
6d408f0a5fbd
PSARC/2008/518 ZFS space accounting enhancements
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7265
diff
changeset
|
1072 |
(void) printf("\t\tused_breakdown[" #which "] = %s\n", nice) |
6d408f0a5fbd
PSARC/2008/518 ZFS space accounting enhancements
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7265
diff
changeset
|
1073 |
DO(HEAD); |
6d408f0a5fbd
PSARC/2008/518 ZFS space accounting enhancements
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7265
diff
changeset
|
1074 |
DO(SNAP); |
6d408f0a5fbd
PSARC/2008/518 ZFS space accounting enhancements
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7265
diff
changeset
|
1075 |
DO(CHILD); |
6d408f0a5fbd
PSARC/2008/518 ZFS space accounting enhancements
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7265
diff
changeset
|
1076 |
DO(CHILD_RSRV); |
6d408f0a5fbd
PSARC/2008/518 ZFS space accounting enhancements
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7265
diff
changeset
|
1077 |
DO(REFRSRV); |
6d408f0a5fbd
PSARC/2008/518 ZFS space accounting enhancements
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7265
diff
changeset
|
1078 |
#undef DO |
789 | 1079 |
} |
1080 |
||
1081 |
/*ARGSUSED*/ |
|
1082 |
static void |
|
1083 |
dump_dsl_dataset(objset_t *os, uint64_t object, void *data, size_t size) |
|
1084 |
{ |
|
1085 |
dsl_dataset_phys_t *ds = data; |
|
1086 |
time_t crtime; |
|
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12050
diff
changeset
|
1087 |
char used[32], compressed[32], uncompressed[32], unique[32]; |
896 | 1088 |
char blkbuf[BP_SPRINTF_LEN]; |
789 | 1089 |
|
1090 |
if (ds == NULL) |
|
1091 |
return; |
|
1092 |
||
1093 |
ASSERT(size == sizeof (*ds)); |
|
1094 |
crtime = ds->ds_creation_time; |
|
13700
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
13618
diff
changeset
|
1095 |
zdb_nicenum(ds->ds_referenced_bytes, used); |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12050
diff
changeset
|
1096 |
zdb_nicenum(ds->ds_compressed_bytes, compressed); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12050
diff
changeset
|
1097 |
zdb_nicenum(ds->ds_uncompressed_bytes, uncompressed); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12050
diff
changeset
|
1098 |
zdb_nicenum(ds->ds_unique_bytes, unique); |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
1099 |
sprintf_blkptr(blkbuf, &ds->ds_bp); |
789 | 1100 |
|
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
6992
diff
changeset
|
1101 |
(void) printf("\t\tdir_obj = %llu\n", |
789 | 1102 |
(u_longlong_t)ds->ds_dir_obj); |
1103 |
(void) printf("\t\tprev_snap_obj = %llu\n", |
|
1104 |
(u_longlong_t)ds->ds_prev_snap_obj); |
|
1105 |
(void) printf("\t\tprev_snap_txg = %llu\n", |
|
1106 |
(u_longlong_t)ds->ds_prev_snap_txg); |
|
1107 |
(void) printf("\t\tnext_snap_obj = %llu\n", |
|
1108 |
(u_longlong_t)ds->ds_next_snap_obj); |
|
1109 |
(void) printf("\t\tsnapnames_zapobj = %llu\n", |
|
1110 |
(u_longlong_t)ds->ds_snapnames_zapobj); |
|
1111 |
(void) printf("\t\tnum_children = %llu\n", |
|
1112 |
(u_longlong_t)ds->ds_num_children); |
|
10242
c40d075fbca6
PSARC/2009/297 zfs snapshot holds
Chris Kirby <chris.kirby@sun.com>
parents:
9512
diff
changeset
|
1113 |
(void) printf("\t\tuserrefs_obj = %llu\n", |
c40d075fbca6
PSARC/2009/297 zfs snapshot holds
Chris Kirby <chris.kirby@sun.com>
parents:
9512
diff
changeset
|
1114 |
(u_longlong_t)ds->ds_userrefs_obj); |
789 | 1115 |
(void) printf("\t\tcreation_time = %s", ctime(&crtime)); |
1116 |
(void) printf("\t\tcreation_txg = %llu\n", |
|
1117 |
(u_longlong_t)ds->ds_creation_txg); |
|
1118 |
(void) printf("\t\tdeadlist_obj = %llu\n", |
|
1119 |
(u_longlong_t)ds->ds_deadlist_obj); |
|
1120 |
(void) printf("\t\tused_bytes = %s\n", used); |
|
1121 |
(void) printf("\t\tcompressed_bytes = %s\n", compressed); |
|
1122 |
(void) printf("\t\tuncompressed_bytes = %s\n", uncompressed); |
|
1123 |
(void) printf("\t\tunique = %s\n", unique); |
|
1124 |
(void) printf("\t\tfsid_guid = %llu\n", |
|
1125 |
(u_longlong_t)ds->ds_fsid_guid); |
|
1126 |
(void) printf("\t\tguid = %llu\n", |
|
1127 |
(u_longlong_t)ds->ds_guid); |
|
2082 | 1128 |
(void) printf("\t\tflags = %llx\n", |
1129 |
(u_longlong_t)ds->ds_flags); |
|
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
6992
diff
changeset
|
1130 |
(void) printf("\t\tnext_clones_obj = %llu\n", |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
6992
diff
changeset
|
1131 |
(u_longlong_t)ds->ds_next_clones_obj); |
7265 | 1132 |
(void) printf("\t\tprops_obj = %llu\n", |
1133 |
(u_longlong_t)ds->ds_props_obj); |
|
789 | 1134 |
(void) printf("\t\tbp = %s\n", blkbuf); |
1135 |
} |
|
1136 |
||
12470
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1137 |
/* ARGSUSED */ |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1138 |
static int |
13700
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
13618
diff
changeset
|
1139 |
dump_bptree_cb(void *arg, const blkptr_t *bp, dmu_tx_t *tx) |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
13618
diff
changeset
|
1140 |
{ |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
13618
diff
changeset
|
1141 |
char blkbuf[BP_SPRINTF_LEN]; |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
13618
diff
changeset
|
1142 |
|
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
13618
diff
changeset
|
1143 |
if (bp->blk_birth != 0) { |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
13618
diff
changeset
|
1144 |
sprintf_blkptr(blkbuf, bp); |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
13618
diff
changeset
|
1145 |
(void) printf("\t%s\n", blkbuf); |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
13618
diff
changeset
|
1146 |
} |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
13618
diff
changeset
|
1147 |
return (0); |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
13618
diff
changeset
|
1148 |
} |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
13618
diff
changeset
|
1149 |
|
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
13618
diff
changeset
|
1150 |
static void |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
13618
diff
changeset
|
1151 |
dump_bptree(objset_t *os, uint64_t obj, char *name) |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
13618
diff
changeset
|
1152 |
{ |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
13618
diff
changeset
|
1153 |
char bytes[32]; |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
13618
diff
changeset
|
1154 |
bptree_phys_t *bt; |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
13618
diff
changeset
|
1155 |
dmu_buf_t *db; |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
13618
diff
changeset
|
1156 |
|
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
13618
diff
changeset
|
1157 |
if (dump_opt['d'] < 3) |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
13618
diff
changeset
|
1158 |
return; |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
13618
diff
changeset
|
1159 |
|
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
13618
diff
changeset
|
1160 |
VERIFY3U(0, ==, dmu_bonus_hold(os, obj, FTAG, &db)); |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
13618
diff
changeset
|
1161 |
bt = db->db_data; |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
13618
diff
changeset
|
1162 |
zdb_nicenum(bt->bt_bytes, bytes); |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
13618
diff
changeset
|
1163 |
(void) printf("\n %s: %llu datasets, %s\n", |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
13618
diff
changeset
|
1164 |
name, (unsigned long long)(bt->bt_end - bt->bt_begin), bytes); |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
13618
diff
changeset
|
1165 |
dmu_buf_rele(db, FTAG); |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
13618
diff
changeset
|
1166 |
|
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
13618
diff
changeset
|
1167 |
if (dump_opt['d'] < 5) |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
13618
diff
changeset
|
1168 |
return; |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
13618
diff
changeset
|
1169 |
|
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
13618
diff
changeset
|
1170 |
(void) printf("\n"); |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
13618
diff
changeset
|
1171 |
|
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
13618
diff
changeset
|
1172 |
(void) bptree_iterate(os, obj, B_FALSE, dump_bptree_cb, NULL, NULL); |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
13618
diff
changeset
|
1173 |
} |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
13618
diff
changeset
|
1174 |
|
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
13618
diff
changeset
|
1175 |
/* ARGSUSED */ |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
13618
diff
changeset
|
1176 |
static int |
12470
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1177 |
dump_bpobj_cb(void *arg, const blkptr_t *bp, dmu_tx_t *tx) |
789 | 1178 |
{ |
12470
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1179 |
char blkbuf[BP_SPRINTF_LEN]; |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1180 |
|
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1181 |
ASSERT(bp->blk_birth != 0); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1182 |
sprintf_blkptr_compact(blkbuf, bp); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1183 |
(void) printf("\t%s\n", blkbuf); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1184 |
return (0); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1185 |
} |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1186 |
|
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1187 |
static void |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1188 |
dump_bpobj(bpobj_t *bpo, char *name) |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1189 |
{ |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12050
diff
changeset
|
1190 |
char bytes[32]; |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12050
diff
changeset
|
1191 |
char comp[32]; |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12050
diff
changeset
|
1192 |
char uncomp[32]; |
789 | 1193 |
|
1194 |
if (dump_opt['d'] < 3) |
|
1195 |
return; |
|
1196 |
||
12470
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1197 |
zdb_nicenum(bpo->bpo_phys->bpo_bytes, bytes); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1198 |
if (bpo->bpo_havesubobj) { |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1199 |
zdb_nicenum(bpo->bpo_phys->bpo_comp, comp); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1200 |
zdb_nicenum(bpo->bpo_phys->bpo_uncomp, uncomp); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1201 |
(void) printf("\n %s: %llu local blkptrs, %llu subobjs, " |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1202 |
"%s (%s/%s comp)\n", |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1203 |
name, (u_longlong_t)bpo->bpo_phys->bpo_num_blkptrs, |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1204 |
(u_longlong_t)bpo->bpo_phys->bpo_num_subobjs, |
2082 | 1205 |
bytes, comp, uncomp); |
1206 |
} else { |
|
12470
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1207 |
(void) printf("\n %s: %llu blkptrs, %s\n", |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1208 |
name, (u_longlong_t)bpo->bpo_phys->bpo_num_blkptrs, bytes); |
2082 | 1209 |
} |
789 | 1210 |
|
12470
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1211 |
if (dump_opt['d'] < 5) |
789 | 1212 |
return; |
1213 |
||
1214 |
(void) printf("\n"); |
|
1215 |
||
12470
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1216 |
(void) bpobj_iterate_nofree(bpo, dump_bpobj_cb, NULL, NULL); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1217 |
} |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1218 |
|
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1219 |
static void |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1220 |
dump_deadlist(dsl_deadlist_t *dl) |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1221 |
{ |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1222 |
dsl_deadlist_entry_t *dle; |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1223 |
char bytes[32]; |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1224 |
char comp[32]; |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1225 |
char uncomp[32]; |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1226 |
|
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1227 |
if (dump_opt['d'] < 3) |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1228 |
return; |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1229 |
|
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1230 |
zdb_nicenum(dl->dl_phys->dl_used, bytes); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1231 |
zdb_nicenum(dl->dl_phys->dl_comp, comp); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1232 |
zdb_nicenum(dl->dl_phys->dl_uncomp, uncomp); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1233 |
(void) printf("\n Deadlist: %s (%s/%s comp)\n", |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1234 |
bytes, comp, uncomp); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1235 |
|
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1236 |
if (dump_opt['d'] < 4) |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1237 |
return; |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1238 |
|
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1239 |
(void) printf("\n"); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1240 |
|
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1241 |
for (dle = avl_first(&dl->dl_tree); dle; |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1242 |
dle = AVL_NEXT(&dl->dl_tree, dle)) { |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1243 |
(void) printf(" mintxg %llu -> obj %llu\n", |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1244 |
(longlong_t)dle->dle_mintxg, |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1245 |
(longlong_t)dle->dle_bpobj.bpo_object); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1246 |
|
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1247 |
if (dump_opt['d'] >= 5) |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1248 |
dump_bpobj(&dle->dle_bpobj, ""); |
789 | 1249 |
} |
1250 |
} |
|
1251 |
||
5959
1e1904b8526d
6650192 zfs ACL/fuid code could use some minor cleanup
marks
parents:
5530
diff
changeset
|
1252 |
static avl_tree_t idx_tree; |
1e1904b8526d
6650192 zfs ACL/fuid code could use some minor cleanup
marks
parents:
5530
diff
changeset
|
1253 |
static avl_tree_t domain_tree; |
1e1904b8526d
6650192 zfs ACL/fuid code could use some minor cleanup
marks
parents:
5530
diff
changeset
|
1254 |
static boolean_t fuid_table_loaded; |
11935
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
1255 |
static boolean_t sa_loaded; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
1256 |
sa_attr_type_t *sa_attr_table; |
5959
1e1904b8526d
6650192 zfs ACL/fuid code could use some minor cleanup
marks
parents:
5530
diff
changeset
|
1257 |
|
1e1904b8526d
6650192 zfs ACL/fuid code could use some minor cleanup
marks
parents:
5530
diff
changeset
|
1258 |
static void |
1e1904b8526d
6650192 zfs ACL/fuid code could use some minor cleanup
marks
parents:
5530
diff
changeset
|
1259 |
fuid_table_destroy() |
1e1904b8526d
6650192 zfs ACL/fuid code could use some minor cleanup
marks
parents:
5530
diff
changeset
|
1260 |
{ |
1e1904b8526d
6650192 zfs ACL/fuid code could use some minor cleanup
marks
parents:
5530
diff
changeset
|
1261 |
if (fuid_table_loaded) { |
1e1904b8526d
6650192 zfs ACL/fuid code could use some minor cleanup
marks
parents:
5530
diff
changeset
|
1262 |
zfs_fuid_table_destroy(&idx_tree, &domain_tree); |
1e1904b8526d
6650192 zfs ACL/fuid code could use some minor cleanup
marks
parents:
5530
diff
changeset
|
1263 |
fuid_table_loaded = B_FALSE; |
1e1904b8526d
6650192 zfs ACL/fuid code could use some minor cleanup
marks
parents:
5530
diff
changeset
|
1264 |
} |
1e1904b8526d
6650192 zfs ACL/fuid code could use some minor cleanup
marks
parents:
5530
diff
changeset
|
1265 |
} |
1e1904b8526d
6650192 zfs ACL/fuid code could use some minor cleanup
marks
parents:
5530
diff
changeset
|
1266 |
|
1e1904b8526d
6650192 zfs ACL/fuid code could use some minor cleanup
marks
parents:
5530
diff
changeset
|
1267 |
/* |
1e1904b8526d
6650192 zfs ACL/fuid code could use some minor cleanup
marks
parents:
5530
diff
changeset
|
1268 |
* print uid or gid information. |
1e1904b8526d
6650192 zfs ACL/fuid code could use some minor cleanup
marks
parents:
5530
diff
changeset
|
1269 |
* For normal POSIX id just the id is printed in decimal format. |
1e1904b8526d
6650192 zfs ACL/fuid code could use some minor cleanup
marks
parents:
5530
diff
changeset
|
1270 |
* For CIFS files with FUID the fuid is printed in hex followed by |
1e1904b8526d
6650192 zfs ACL/fuid code could use some minor cleanup
marks
parents:
5530
diff
changeset
|
1271 |
* the doman-rid string. |
1e1904b8526d
6650192 zfs ACL/fuid code could use some minor cleanup
marks
parents:
5530
diff
changeset
|
1272 |
*/ |
1e1904b8526d
6650192 zfs ACL/fuid code could use some minor cleanup
marks
parents:
5530
diff
changeset
|
1273 |
static void |
1e1904b8526d
6650192 zfs ACL/fuid code could use some minor cleanup
marks
parents:
5530
diff
changeset
|
1274 |
print_idstr(uint64_t id, const char *id_type) |
1e1904b8526d
6650192 zfs ACL/fuid code could use some minor cleanup
marks
parents:
5530
diff
changeset
|
1275 |
{ |
1e1904b8526d
6650192 zfs ACL/fuid code could use some minor cleanup
marks
parents:
5530
diff
changeset
|
1276 |
if (FUID_INDEX(id)) { |
1e1904b8526d
6650192 zfs ACL/fuid code could use some minor cleanup
marks
parents:
5530
diff
changeset
|
1277 |
char *domain; |
1e1904b8526d
6650192 zfs ACL/fuid code could use some minor cleanup
marks
parents:
5530
diff
changeset
|
1278 |
|
1e1904b8526d
6650192 zfs ACL/fuid code could use some minor cleanup
marks
parents:
5530
diff
changeset
|
1279 |
domain = zfs_fuid_idx_domain(&idx_tree, FUID_INDEX(id)); |
1e1904b8526d
6650192 zfs ACL/fuid code could use some minor cleanup
marks
parents:
5530
diff
changeset
|
1280 |
(void) printf("\t%s %llx [%s-%d]\n", id_type, |
1e1904b8526d
6650192 zfs ACL/fuid code could use some minor cleanup
marks
parents:
5530
diff
changeset
|
1281 |
(u_longlong_t)id, domain, (int)FUID_RID(id)); |
1e1904b8526d
6650192 zfs ACL/fuid code could use some minor cleanup
marks
parents:
5530
diff
changeset
|
1282 |
} else { |
1e1904b8526d
6650192 zfs ACL/fuid code could use some minor cleanup
marks
parents:
5530
diff
changeset
|
1283 |
(void) printf("\t%s %llu\n", id_type, (u_longlong_t)id); |
1e1904b8526d
6650192 zfs ACL/fuid code could use some minor cleanup
marks
parents:
5530
diff
changeset
|
1284 |
} |
1e1904b8526d
6650192 zfs ACL/fuid code could use some minor cleanup
marks
parents:
5530
diff
changeset
|
1285 |
|
1e1904b8526d
6650192 zfs ACL/fuid code could use some minor cleanup
marks
parents:
5530
diff
changeset
|
1286 |
} |
1e1904b8526d
6650192 zfs ACL/fuid code could use some minor cleanup
marks
parents:
5530
diff
changeset
|
1287 |
|
1e1904b8526d
6650192 zfs ACL/fuid code could use some minor cleanup
marks
parents:
5530
diff
changeset
|
1288 |
static void |
11935
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
1289 |
dump_uidgid(objset_t *os, uint64_t uid, uint64_t gid) |
5959
1e1904b8526d
6650192 zfs ACL/fuid code could use some minor cleanup
marks
parents:
5530
diff
changeset
|
1290 |
{ |
1e1904b8526d
6650192 zfs ACL/fuid code could use some minor cleanup
marks
parents:
5530
diff
changeset
|
1291 |
uint32_t uid_idx, gid_idx; |
1e1904b8526d
6650192 zfs ACL/fuid code could use some minor cleanup
marks
parents:
5530
diff
changeset
|
1292 |
|
11935
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
1293 |
uid_idx = FUID_INDEX(uid); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
1294 |
gid_idx = FUID_INDEX(gid); |
5959
1e1904b8526d
6650192 zfs ACL/fuid code could use some minor cleanup
marks
parents:
5530
diff
changeset
|
1295 |
|
1e1904b8526d
6650192 zfs ACL/fuid code could use some minor cleanup
marks
parents:
5530
diff
changeset
|
1296 |
/* Load domain table, if not already loaded */ |
1e1904b8526d
6650192 zfs ACL/fuid code could use some minor cleanup
marks
parents:
5530
diff
changeset
|
1297 |
if (!fuid_table_loaded && (uid_idx || gid_idx)) { |
1e1904b8526d
6650192 zfs ACL/fuid code could use some minor cleanup
marks
parents:
5530
diff
changeset
|
1298 |
uint64_t fuid_obj; |
1e1904b8526d
6650192 zfs ACL/fuid code could use some minor cleanup
marks
parents:
5530
diff
changeset
|
1299 |
|
1e1904b8526d
6650192 zfs ACL/fuid code could use some minor cleanup
marks
parents:
5530
diff
changeset
|
1300 |
/* first find the fuid object. It lives in the master node */ |
1e1904b8526d
6650192 zfs ACL/fuid code could use some minor cleanup
marks
parents:
5530
diff
changeset
|
1301 |
VERIFY(zap_lookup(os, MASTER_NODE_OBJ, ZFS_FUID_TABLES, |
1e1904b8526d
6650192 zfs ACL/fuid code could use some minor cleanup
marks
parents:
5530
diff
changeset
|
1302 |
8, 1, &fuid_obj) == 0); |
9179
d8fbd96b79b3
6790064 zfs needs to determine uid and gid earlier in create process
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
8924
diff
changeset
|
1303 |
zfs_fuid_avl_tree_create(&idx_tree, &domain_tree); |
5959
1e1904b8526d
6650192 zfs ACL/fuid code could use some minor cleanup
marks
parents:
5530
diff
changeset
|
1304 |
(void) zfs_fuid_table_load(os, fuid_obj, |
1e1904b8526d
6650192 zfs ACL/fuid code could use some minor cleanup
marks
parents:
5530
diff
changeset
|
1305 |
&idx_tree, &domain_tree); |
1e1904b8526d
6650192 zfs ACL/fuid code could use some minor cleanup
marks
parents:
5530
diff
changeset
|
1306 |
fuid_table_loaded = B_TRUE; |
1e1904b8526d
6650192 zfs ACL/fuid code could use some minor cleanup
marks
parents:
5530
diff
changeset
|
1307 |
} |
1e1904b8526d
6650192 zfs ACL/fuid code could use some minor cleanup
marks
parents:
5530
diff
changeset
|
1308 |
|
11935
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
1309 |
print_idstr(uid, "uid"); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
1310 |
print_idstr(gid, "gid"); |
5959
1e1904b8526d
6650192 zfs ACL/fuid code could use some minor cleanup
marks
parents:
5530
diff
changeset
|
1311 |
} |
1e1904b8526d
6650192 zfs ACL/fuid code could use some minor cleanup
marks
parents:
5530
diff
changeset
|
1312 |
|
789 | 1313 |
/*ARGSUSED*/ |
1314 |
static void |
|
1315 |
dump_znode(objset_t *os, uint64_t object, void *data, size_t size) |
|
1316 |
{ |
|
11935
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
1317 |
char path[MAXPATHLEN * 2]; /* allow for xattr and failure prefix */ |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
1318 |
sa_handle_t *hdl; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
1319 |
uint64_t xattr, rdev, gen; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
1320 |
uint64_t uid, gid, mode, fsize, parent, links; |
12050
5879aa161e65
6938757 SMB and NFS referrals not working correctly
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11935
diff
changeset
|
1321 |
uint64_t pflags; |
11935
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
1322 |
uint64_t acctm[2], modtm[2], chgtm[2], crtm[2]; |
789 | 1323 |
time_t z_crtime, z_atime, z_mtime, z_ctime; |
12050
5879aa161e65
6938757 SMB and NFS referrals not working correctly
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11935
diff
changeset
|
1324 |
sa_bulk_attr_t bulk[12]; |
11935
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
1325 |
int idx = 0; |
3444
dc160a70a50d
6410433 'zpool status -v' would be more useful with filenames
ek110237
parents:
3361
diff
changeset
|
1326 |
int error; |
789 | 1327 |
|
11935
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
1328 |
if (!sa_loaded) { |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
1329 |
uint64_t sa_attrs = 0; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
1330 |
uint64_t version; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
1331 |
|
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
1332 |
VERIFY(zap_lookup(os, MASTER_NODE_OBJ, ZPL_VERSION_STR, |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
1333 |
8, 1, &version) == 0); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
1334 |
if (version >= ZPL_VERSION_SA) { |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
1335 |
VERIFY(zap_lookup(os, MASTER_NODE_OBJ, ZFS_SA_ATTRS, |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
1336 |
8, 1, &sa_attrs) == 0); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
1337 |
} |
12493
89ce40422cea
6952177 SA handling of on-disk corruption can be improved
Mark Shellenbaum <Mark.Shellenbaum@Oracle.COM>
parents:
12470
diff
changeset
|
1338 |
if ((error = sa_setup(os, sa_attrs, zfs_attr_table, |
89ce40422cea
6952177 SA handling of on-disk corruption can be improved
Mark Shellenbaum <Mark.Shellenbaum@Oracle.COM>
parents:
12470
diff
changeset
|
1339 |
ZPL_END, &sa_attr_table)) != 0) { |
89ce40422cea
6952177 SA handling of on-disk corruption can be improved
Mark Shellenbaum <Mark.Shellenbaum@Oracle.COM>
parents:
12470
diff
changeset
|
1340 |
(void) printf("sa_setup failed errno %d, can't " |
89ce40422cea
6952177 SA handling of on-disk corruption can be improved
Mark Shellenbaum <Mark.Shellenbaum@Oracle.COM>
parents:
12470
diff
changeset
|
1341 |
"display znode contents\n", error); |
89ce40422cea
6952177 SA handling of on-disk corruption can be improved
Mark Shellenbaum <Mark.Shellenbaum@Oracle.COM>
parents:
12470
diff
changeset
|
1342 |
return; |
89ce40422cea
6952177 SA handling of on-disk corruption can be improved
Mark Shellenbaum <Mark.Shellenbaum@Oracle.COM>
parents:
12470
diff
changeset
|
1343 |
} |
11935
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
1344 |
sa_loaded = B_TRUE; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
1345 |
} |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
1346 |
|
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
1347 |
if (sa_handle_get(os, object, NULL, SA_HDL_PRIVATE, &hdl)) { |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
1348 |
(void) printf("Failed to get handle for SA znode\n"); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
1349 |
return; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
1350 |
} |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
1351 |
|
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
1352 |
SA_ADD_BULK_ATTR(bulk, idx, sa_attr_table[ZPL_UID], NULL, &uid, 8); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
1353 |
SA_ADD_BULK_ATTR(bulk, idx, sa_attr_table[ZPL_GID], NULL, &gid, 8); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
1354 |
SA_ADD_BULK_ATTR(bulk, idx, sa_attr_table[ZPL_LINKS], NULL, |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
1355 |
&links, 8); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
1356 |
SA_ADD_BULK_ATTR(bulk, idx, sa_attr_table[ZPL_GEN], NULL, &gen, 8); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
1357 |
SA_ADD_BULK_ATTR(bulk, idx, sa_attr_table[ZPL_MODE], NULL, |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
1358 |
&mode, 8); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
1359 |
SA_ADD_BULK_ATTR(bulk, idx, sa_attr_table[ZPL_PARENT], |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
1360 |
NULL, &parent, 8); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
1361 |
SA_ADD_BULK_ATTR(bulk, idx, sa_attr_table[ZPL_SIZE], NULL, |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
1362 |
&fsize, 8); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
1363 |
SA_ADD_BULK_ATTR(bulk, idx, sa_attr_table[ZPL_ATIME], NULL, |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
1364 |
acctm, 16); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
1365 |
SA_ADD_BULK_ATTR(bulk, idx, sa_attr_table[ZPL_MTIME], NULL, |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
1366 |
modtm, 16); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
1367 |
SA_ADD_BULK_ATTR(bulk, idx, sa_attr_table[ZPL_CRTIME], NULL, |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
1368 |
crtm, 16); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
1369 |
SA_ADD_BULK_ATTR(bulk, idx, sa_attr_table[ZPL_CTIME], NULL, |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
1370 |
chgtm, 16); |
12050
5879aa161e65
6938757 SMB and NFS referrals not working correctly
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11935
diff
changeset
|
1371 |
SA_ADD_BULK_ATTR(bulk, idx, sa_attr_table[ZPL_FLAGS], NULL, |
5879aa161e65
6938757 SMB and NFS referrals not working correctly
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11935
diff
changeset
|
1372 |
&pflags, 8); |
11935
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
1373 |
|
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
1374 |
if (sa_bulk_lookup(hdl, bulk, idx)) { |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
1375 |
(void) sa_handle_destroy(hdl); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
1376 |
return; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
1377 |
} |
789 | 1378 |
|
3444
dc160a70a50d
6410433 'zpool status -v' would be more useful with filenames
ek110237
parents:
3361
diff
changeset
|
1379 |
error = zfs_obj_to_path(os, object, path, sizeof (path)); |
dc160a70a50d
6410433 'zpool status -v' would be more useful with filenames
ek110237
parents:
3361
diff
changeset
|
1380 |
if (error != 0) { |
dc160a70a50d
6410433 'zpool status -v' would be more useful with filenames
ek110237
parents:
3361
diff
changeset
|
1381 |
(void) snprintf(path, sizeof (path), "\?\?\?<object#%llu>", |
dc160a70a50d
6410433 'zpool status -v' would be more useful with filenames
ek110237
parents:
3361
diff
changeset
|
1382 |
(u_longlong_t)object); |
dc160a70a50d
6410433 'zpool status -v' would be more useful with filenames
ek110237
parents:
3361
diff
changeset
|
1383 |
} |
789 | 1384 |
if (dump_opt['d'] < 3) { |
3444
dc160a70a50d
6410433 'zpool status -v' would be more useful with filenames
ek110237
parents:
3361
diff
changeset
|
1385 |
(void) printf("\t%s\n", path); |
11935
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
1386 |
(void) sa_handle_destroy(hdl); |
789 | 1387 |
return; |
1388 |
} |
|
1389 |
||
11935
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
1390 |
z_crtime = (time_t)crtm[0]; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
1391 |
z_atime = (time_t)acctm[0]; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
1392 |
z_mtime = (time_t)modtm[0]; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
1393 |
z_ctime = (time_t)chgtm[0]; |
789 | 1394 |
|
3444
dc160a70a50d
6410433 'zpool status -v' would be more useful with filenames
ek110237
parents:
3361
diff
changeset
|
1395 |
(void) printf("\tpath %s\n", path); |
11935
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
1396 |
dump_uidgid(os, uid, gid); |
789 | 1397 |
(void) printf("\tatime %s", ctime(&z_atime)); |
1398 |
(void) printf("\tmtime %s", ctime(&z_mtime)); |
|
1399 |
(void) printf("\tctime %s", ctime(&z_ctime)); |
|
1400 |
(void) printf("\tcrtime %s", ctime(&z_crtime)); |
|
11935
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
1401 |
(void) printf("\tgen %llu\n", (u_longlong_t)gen); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
1402 |
(void) printf("\tmode %llo\n", (u_longlong_t)mode); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
1403 |
(void) printf("\tsize %llu\n", (u_longlong_t)fsize); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
1404 |
(void) printf("\tparent %llu\n", (u_longlong_t)parent); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
1405 |
(void) printf("\tlinks %llu\n", (u_longlong_t)links); |
12050
5879aa161e65
6938757 SMB and NFS referrals not working correctly
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11935
diff
changeset
|
1406 |
(void) printf("\tpflags %llx\n", (u_longlong_t)pflags); |
11935
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
1407 |
if (sa_lookup(hdl, sa_attr_table[ZPL_XATTR], &xattr, |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
1408 |
sizeof (uint64_t)) == 0) |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
1409 |
(void) printf("\txattr %llu\n", (u_longlong_t)xattr); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
1410 |
if (sa_lookup(hdl, sa_attr_table[ZPL_RDEV], &rdev, |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
1411 |
sizeof (uint64_t)) == 0) |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
1412 |
(void) printf("\trdev 0x%016llx\n", (u_longlong_t)rdev); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
1413 |
sa_handle_destroy(hdl); |
789 | 1414 |
} |
1415 |
||
1416 |
/*ARGSUSED*/ |
|
1417 |
static void |
|
1418 |
dump_acl(objset_t *os, uint64_t object, void *data, size_t size) |
|
1419 |
{ |
|
1420 |
} |
|
1421 |
||
1422 |
/*ARGSUSED*/ |
|
1423 |
static void |
|
1424 |
dump_dmu_objset(objset_t *os, uint64_t object, void *data, size_t size) |
|
1425 |
{ |
|
1426 |
} |
|
1427 |
||
10859
ea699e57196e
6761101 zdb/mdb crashes when printing bp with bad checksum, compress or type
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10858
diff
changeset
|
1428 |
static object_viewer_t *object_viewer[DMU_OT_NUMTYPES + 1] = { |
789 | 1429 |
dump_none, /* unallocated */ |
1430 |
dump_zap, /* object directory */ |
|
1431 |
dump_uint64, /* object array */ |
|
1432 |
dump_none, /* packed nvlist */ |
|
1433 |
dump_packed_nvlist, /* packed nvlist size */ |
|
1434 |
dump_none, /* bplist */ |
|
1435 |
dump_none, /* bplist header */ |
|
1436 |
dump_none, /* SPA space map header */ |
|
1437 |
dump_none, /* SPA space map */ |
|
1438 |
dump_none, /* ZIL intent log */ |
|
1439 |
dump_dnode, /* DMU dnode */ |
|
1440 |
dump_dmu_objset, /* DMU objset */ |
|
1544 | 1441 |
dump_dsl_dir, /* DSL directory */ |
789 | 1442 |
dump_zap, /* DSL directory child map */ |
1443 |
dump_zap, /* DSL dataset snap map */ |
|
1444 |
dump_zap, /* DSL props */ |
|
1445 |
dump_dsl_dataset, /* DSL dataset */ |
|
1446 |
dump_znode, /* ZFS znode */ |
|
5331 | 1447 |
dump_acl, /* ZFS V0 ACL */ |
789 | 1448 |
dump_uint8, /* ZFS plain file */ |
4577 | 1449 |
dump_zpldir, /* ZFS directory */ |
789 | 1450 |
dump_zap, /* ZFS master node */ |
1451 |
dump_zap, /* ZFS delete queue */ |
|
1452 |
dump_uint8, /* zvol object */ |
|
1453 |
dump_zap, /* zvol prop */ |
|
1454 |
dump_uint8, /* other uint8[] */ |
|
1455 |
dump_uint64, /* other uint64[] */ |
|
1456 |
dump_zap, /* other ZAP */ |
|
1544 | 1457 |
dump_zap, /* persistent error log */ |
2926 | 1458 |
dump_uint8, /* SPA history */ |
1459 |
dump_uint64, /* SPA history offsets */ |
|
3912 | 1460 |
dump_zap, /* Pool properties */ |
4543 | 1461 |
dump_zap, /* DSL permissions */ |
5331 | 1462 |
dump_acl, /* ZFS ACL */ |
1463 |
dump_uint8, /* ZFS SYSACL */ |
|
1464 |
dump_none, /* FUID nvlist */ |
|
1465 |
dump_packed_nvlist, /* FUID nvlist size */ |
|
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
6992
diff
changeset
|
1466 |
dump_zap, /* DSL dataset next clones */ |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
6992
diff
changeset
|
1467 |
dump_zap, /* DSL scrub queue */ |
9396
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9179
diff
changeset
|
1468 |
dump_zap, /* ZFS user/group used */ |
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9179
diff
changeset
|
1469 |
dump_zap, /* ZFS user/group quota */ |
10242
c40d075fbca6
PSARC/2009/297 zfs snapshot holds
Chris Kirby <chris.kirby@sun.com>
parents:
9512
diff
changeset
|
1470 |
dump_zap, /* snapshot refcount tags */ |
11165
68184eb5449e
6903705 dedup=fletcher4,verify doesn't byteswap correctly, has lots of hash collisions
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11149
diff
changeset
|
1471 |
dump_ddt_zap, /* DDT ZAP object */ |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
1472 |
dump_zap, /* DDT statistics */ |
11935
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
1473 |
dump_znode, /* SA object */ |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
1474 |
dump_zap, /* SA Master Node */ |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
1475 |
dump_sa_attrs, /* SA attribute registration */ |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
1476 |
dump_sa_layouts, /* SA attribute layouts */ |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12050
diff
changeset
|
1477 |
dump_zap, /* DSL scrub translations */ |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12050
diff
changeset
|
1478 |
dump_none, /* fake dedup BP */ |
12470
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1479 |
dump_zap, /* deadlist */ |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1480 |
dump_none, /* deadlist hdr */ |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1481 |
dump_zap, /* dsl clones */ |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1482 |
dump_none, /* bpobj subobjs */ |
11935
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
1483 |
dump_unknown, /* Unknown type, must be last */ |
789 | 1484 |
}; |
1485 |
||
1486 |
static void |
|
1487 |
dump_object(objset_t *os, uint64_t object, int verbosity, int *print_header) |
|
1488 |
{ |
|
1489 |
dmu_buf_t *db = NULL; |
|
1490 |
dmu_object_info_t doi; |
|
1491 |
dnode_t *dn; |
|
1492 |
void *bonus = NULL; |
|
1493 |
size_t bsize = 0; |
|
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12050
diff
changeset
|
1494 |
char iblk[32], dblk[32], lsize[32], asize[32], fill[32]; |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12050
diff
changeset
|
1495 |
char bonus_size[32]; |
789 | 1496 |
char aux[50]; |
1497 |
int error; |
|
1498 |
||
1499 |
if (*print_header) { |
|
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
1500 |
(void) printf("\n%10s %3s %5s %5s %5s %5s %6s %s\n", |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
1501 |
"Object", "lvl", "iblk", "dblk", "dsize", "lsize", |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
1502 |
"%full", "type"); |
789 | 1503 |
*print_header = 0; |
1504 |
} |
|
1505 |
||
1506 |
if (object == 0) { |
|
12684
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12671
diff
changeset
|
1507 |
dn = DMU_META_DNODE(os); |
789 | 1508 |
} else { |
1544 | 1509 |
error = dmu_bonus_hold(os, object, FTAG, &db); |
1510 |
if (error) |
|
1511 |
fatal("dmu_bonus_hold(%llu) failed, errno %u", |
|
1512 |
object, error); |
|
789 | 1513 |
bonus = db->db_data; |
1514 |
bsize = db->db_size; |
|
12684
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12671
diff
changeset
|
1515 |
dn = DB_DNODE((dmu_buf_impl_t *)db); |
789 | 1516 |
} |
1517 |
dmu_object_info_from_dnode(dn, &doi); |
|
1518 |
||
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12050
diff
changeset
|
1519 |
zdb_nicenum(doi.doi_metadata_block_size, iblk); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12050
diff
changeset
|
1520 |
zdb_nicenum(doi.doi_data_block_size, dblk); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12050
diff
changeset
|
1521 |
zdb_nicenum(doi.doi_max_offset, lsize); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12050
diff
changeset
|
1522 |
zdb_nicenum(doi.doi_physical_blocks_512 << 9, asize); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12050
diff
changeset
|
1523 |
zdb_nicenum(doi.doi_bonus_size, bonus_size); |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
1524 |
(void) sprintf(fill, "%6.2f", 100.0 * doi.doi_fill_count * |
11125
fca3e6d28599
6899923 vdev_offline/vdev_add deadlock
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10922
diff
changeset
|
1525 |
doi.doi_data_block_size / (object == 0 ? DNODES_PER_BLOCK : 1) / |
fca3e6d28599
6899923 vdev_offline/vdev_add deadlock
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10922
diff
changeset
|
1526 |
doi.doi_max_offset); |
789 | 1527 |
|
1528 |
aux[0] = '\0'; |
|
1529 |
||
4577 | 1530 |
if (doi.doi_checksum != ZIO_CHECKSUM_INHERIT || verbosity >= 6) { |
789 | 1531 |
(void) snprintf(aux + strlen(aux), sizeof (aux), " (K=%s)", |
10859
ea699e57196e
6761101 zdb/mdb crashes when printing bp with bad checksum, compress or type
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10858
diff
changeset
|
1532 |
ZDB_CHECKSUM_NAME(doi.doi_checksum)); |
4577 | 1533 |
} |
789 | 1534 |
|
4577 | 1535 |
if (doi.doi_compress != ZIO_COMPRESS_INHERIT || verbosity >= 6) { |
789 | 1536 |
(void) snprintf(aux + strlen(aux), sizeof (aux), " (Z=%s)", |
10859
ea699e57196e
6761101 zdb/mdb crashes when printing bp with bad checksum, compress or type
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10858
diff
changeset
|
1537 |
ZDB_COMPRESS_NAME(doi.doi_compress)); |
4577 | 1538 |
} |
789 | 1539 |
|
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
1540 |
(void) printf("%10lld %3u %5s %5s %5s %5s %6s %s%s\n", |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
1541 |
(u_longlong_t)object, doi.doi_indirection, iblk, dblk, |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
1542 |
asize, lsize, fill, ZDB_OT_NAME(doi.doi_type), aux); |
789 | 1543 |
|
1544 |
if (doi.doi_bonus_type != DMU_OT_NONE && verbosity > 3) { |
|
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
1545 |
(void) printf("%10s %3s %5s %5s %5s %5s %6s %s\n", |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
1546 |
"", "", "", "", "", bonus_size, "bonus", |
10859
ea699e57196e
6761101 zdb/mdb crashes when printing bp with bad checksum, compress or type
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10858
diff
changeset
|
1547 |
ZDB_OT_NAME(doi.doi_bonus_type)); |
789 | 1548 |
} |
1549 |
||
1550 |
if (verbosity >= 4) { |
|
11935
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
1551 |
(void) printf("\tdnode flags: %s%s%s\n", |
9396
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9179
diff
changeset
|
1552 |
(dn->dn_phys->dn_flags & DNODE_FLAG_USED_BYTES) ? |
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9179
diff
changeset
|
1553 |
"USED_BYTES " : "", |
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9179
diff
changeset
|
1554 |
(dn->dn_phys->dn_flags & DNODE_FLAG_USERUSED_ACCOUNTED) ? |
11935
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
1555 |
"USERUSED_ACCOUNTED " : "", |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
1556 |
(dn->dn_phys->dn_flags & DNODE_FLAG_SPILL_BLKPTR) ? |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
1557 |
"SPILL_BLKPTR" : ""); |
9396
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9179
diff
changeset
|
1558 |
(void) printf("\tdnode maxblkid: %llu\n", |
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9179
diff
changeset
|
1559 |
(longlong_t)dn->dn_phys->dn_maxblkid); |
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9179
diff
changeset
|
1560 |
|
10859
ea699e57196e
6761101 zdb/mdb crashes when printing bp with bad checksum, compress or type
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10858
diff
changeset
|
1561 |
object_viewer[ZDB_OT_TYPE(doi.doi_bonus_type)](os, object, |
ea699e57196e
6761101 zdb/mdb crashes when printing bp with bad checksum, compress or type
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10858
diff
changeset
|
1562 |
bonus, bsize); |
ea699e57196e
6761101 zdb/mdb crashes when printing bp with bad checksum, compress or type
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10858
diff
changeset
|
1563 |
object_viewer[ZDB_OT_TYPE(doi.doi_type)](os, object, NULL, 0); |
789 | 1564 |
*print_header = 1; |
1565 |
} |
|
1566 |
||
1567 |
if (verbosity >= 5) |
|
7837
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
1568 |
dump_indirect(dn); |
789 | 1569 |
|
1570 |
if (verbosity >= 5) { |
|
1571 |
/* |
|
1572 |
* Report the list of segments that comprise the object. |
|
1573 |
*/ |
|
1574 |
uint64_t start = 0; |
|
1575 |
uint64_t end; |
|
1576 |
uint64_t blkfill = 1; |
|
1577 |
int minlvl = 1; |
|
1578 |
||
1579 |
if (dn->dn_type == DMU_OT_DNODE) { |
|
1580 |
minlvl = 0; |
|
1581 |
blkfill = DNODES_PER_BLOCK; |
|
1582 |
} |
|
1583 |
||
1584 |
for (;;) { |
|
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12050
diff
changeset
|
1585 |
char segsize[32]; |
6992 | 1586 |
error = dnode_next_offset(dn, |
1587 |
0, &start, minlvl, blkfill, 0); |
|
789 | 1588 |
if (error) |
1589 |
break; |
|
1590 |
end = start; |
|
6992 | 1591 |
error = dnode_next_offset(dn, |
1592 |
DNODE_FIND_HOLE, &end, minlvl, blkfill, 0); |
|
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12050
diff
changeset
|
1593 |
zdb_nicenum(end - start, segsize); |
789 | 1594 |
(void) printf("\t\tsegment [%016llx, %016llx)" |
1595 |
" size %5s\n", (u_longlong_t)start, |
|
1596 |
(u_longlong_t)end, segsize); |
|
1597 |
if (error) |
|
1598 |
break; |
|
1599 |
start = end; |
|
1600 |
} |
|
1601 |
} |
|
1602 |
||
1603 |
if (db != NULL) |
|
1544 | 1604 |
dmu_buf_rele(db, FTAG); |
789 | 1605 |
} |
1606 |
||
1607 |
static char *objset_types[DMU_OST_NUMTYPES] = { |
|
1608 |
"NONE", "META", "ZPL", "ZVOL", "OTHER", "ANY" }; |
|
1609 |
||
1610 |
static void |
|
1611 |
dump_dir(objset_t *os) |
|
1612 |
{ |
|
1613 |
dmu_objset_stats_t dds; |
|
1614 |
uint64_t object, object_count; |
|
2885 | 1615 |
uint64_t refdbytes, usedobjs, scratch; |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12050
diff
changeset
|
1616 |
char numbuf[32]; |
9396
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9179
diff
changeset
|
1617 |
char blkbuf[BP_SPRINTF_LEN + 20]; |
789 | 1618 |
char osname[MAXNAMELEN]; |
1619 |
char *type = "UNKNOWN"; |
|
1620 |
int verbosity = dump_opt['d']; |
|
1621 |
int print_header = 1; |
|
1622 |
int i, error; |
|
1623 |
||
2885 | 1624 |
dmu_objset_fast_stat(os, &dds); |
789 | 1625 |
|
1626 |
if (dds.dds_type < DMU_OST_NUMTYPES) |
|
1627 |
type = objset_types[dds.dds_type]; |
|
1628 |
||
1629 |
if (dds.dds_type == DMU_OST_META) { |
|
1630 |
dds.dds_creation_txg = TXG_INITIAL; |
|
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
1631 |
usedobjs = os->os_rootbp->blk_fill; |
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
1632 |
refdbytes = os->os_spa->spa_dsl_pool-> |
7390
6d408f0a5fbd
PSARC/2008/518 ZFS space accounting enhancements
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7265
diff
changeset
|
1633 |
dp_mos_dir->dd_phys->dd_used_bytes; |
2885 | 1634 |
} else { |
1635 |
dmu_objset_space(os, &refdbytes, &scratch, &usedobjs, &scratch); |
|
789 | 1636 |
} |
1637 |
||
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
1638 |
ASSERT3U(usedobjs, ==, os->os_rootbp->blk_fill); |
789 | 1639 |
|
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12050
diff
changeset
|
1640 |
zdb_nicenum(refdbytes, numbuf); |
789 | 1641 |
|
1642 |
if (verbosity >= 4) { |
|
10857
2c20a0bd87cd
6892882 zdb -ddddd prints garbage from stack between dataset summary and rootbp
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10685
diff
changeset
|
1643 |
(void) sprintf(blkbuf, ", rootbp "); |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
1644 |
(void) sprintf_blkptr(blkbuf + strlen(blkbuf), os->os_rootbp); |
789 | 1645 |
} else { |
1646 |
blkbuf[0] = '\0'; |
|
1647 |
} |
|
1648 |
||
1649 |
dmu_objset_name(os, osname); |
|
1650 |
||
2885 | 1651 |
(void) printf("Dataset %s [%s], ID %llu, cr_txg %llu, " |
789 | 1652 |
"%s, %llu objects%s\n", |
1653 |
osname, type, (u_longlong_t)dmu_objset_id(os), |
|
1654 |
(u_longlong_t)dds.dds_creation_txg, |
|
2885 | 1655 |
numbuf, (u_longlong_t)usedobjs, blkbuf); |
789 | 1656 |
|
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
1657 |
if (zopt_objects != 0) { |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
1658 |
for (i = 0; i < zopt_objects; i++) |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
1659 |
dump_object(os, zopt_object[i], verbosity, |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
1660 |
&print_header); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
1661 |
(void) printf("\n"); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
1662 |
return; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
1663 |
} |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
1664 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
1665 |
if (dump_opt['i'] != 0 || verbosity >= 2) |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
1666 |
dump_intent_log(dmu_objset_zil(os)); |
789 | 1667 |
|
1668 |
if (dmu_objset_ds(os) != NULL) |
|
12470
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1669 |
dump_deadlist(&dmu_objset_ds(os)->ds_deadlist); |
789 | 1670 |
|
1671 |
if (verbosity < 2) |
|
1672 |
return; |
|
1673 |
||
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
1674 |
if (os->os_rootbp->blk_birth == 0) |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
6992
diff
changeset
|
1675 |
return; |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
6992
diff
changeset
|
1676 |
|
789 | 1677 |
dump_object(os, 0, verbosity, &print_header); |
9396
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9179
diff
changeset
|
1678 |
object_count = 0; |
12684
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12671
diff
changeset
|
1679 |
if (DMU_USERUSED_DNODE(os) != NULL && |
397e44ebb8a9
6710343 dnode cache should register a dnode_move() callback to limit fragmentation
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
12671
diff
changeset
|
1680 |
DMU_USERUSED_DNODE(os)->dn_type != 0) { |
9396
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9179
diff
changeset
|
1681 |
dump_object(os, DMU_USERUSED_OBJECT, verbosity, &print_header); |
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9179
diff
changeset
|
1682 |
dump_object(os, DMU_GROUPUSED_OBJECT, verbosity, &print_header); |
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9179
diff
changeset
|
1683 |
} |
789 | 1684 |
|
1685 |
object = 0; |
|
3025
4e5ee8301d84
6424466 "panic: data after EOF" when unmounting abused pool
ahrens
parents:
2926
diff
changeset
|
1686 |
while ((error = dmu_object_next(os, &object, B_FALSE, 0)) == 0) { |
789 | 1687 |
dump_object(os, object, verbosity, &print_header); |
1688 |
object_count++; |
|
1689 |
} |
|
1690 |
||
2885 | 1691 |
ASSERT3U(object_count, ==, usedobjs); |
789 | 1692 |
|
1693 |
(void) printf("\n"); |
|
1694 |
||
8924
5af812f84759
6789318 coredump when issue zdb -uuuu poolname/
Rich Morris <Richard.Morris@Sun.COM>
parents:
8241
diff
changeset
|
1695 |
if (error != ESRCH) { |
5af812f84759
6789318 coredump when issue zdb -uuuu poolname/
Rich Morris <Richard.Morris@Sun.COM>
parents:
8241
diff
changeset
|
1696 |
(void) fprintf(stderr, "dmu_object_next() = %d\n", error); |
5af812f84759
6789318 coredump when issue zdb -uuuu poolname/
Rich Morris <Richard.Morris@Sun.COM>
parents:
8241
diff
changeset
|
1697 |
abort(); |
5af812f84759
6789318 coredump when issue zdb -uuuu poolname/
Rich Morris <Richard.Morris@Sun.COM>
parents:
8241
diff
changeset
|
1698 |
} |
789 | 1699 |
} |
1700 |
||
1701 |
static void |
|
11725
68a79ddc6b27
6720637 want zdb -l option to dump uberblock arrays as well
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
11724
diff
changeset
|
1702 |
dump_uberblock(uberblock_t *ub, const char *header, const char *footer) |
789 | 1703 |
{ |
1704 |
time_t timestamp = ub->ub_timestamp; |
|
1705 |
||
11725
68a79ddc6b27
6720637 want zdb -l option to dump uberblock arrays as well
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
11724
diff
changeset
|
1706 |
(void) printf(header ? header : ""); |
789 | 1707 |
(void) printf("\tmagic = %016llx\n", (u_longlong_t)ub->ub_magic); |
1708 |
(void) printf("\tversion = %llu\n", (u_longlong_t)ub->ub_version); |
|
1709 |
(void) printf("\ttxg = %llu\n", (u_longlong_t)ub->ub_txg); |
|
1710 |
(void) printf("\tguid_sum = %llu\n", (u_longlong_t)ub->ub_guid_sum); |
|
1711 |
(void) printf("\ttimestamp = %llu UTC = %s", |
|
1712 |
(u_longlong_t)ub->ub_timestamp, asctime(localtime(×tamp))); |
|
1713 |
if (dump_opt['u'] >= 3) { |
|
896 | 1714 |
char blkbuf[BP_SPRINTF_LEN]; |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
1715 |
sprintf_blkptr(blkbuf, &ub->ub_rootbp); |
789 | 1716 |
(void) printf("\trootbp = %s\n", blkbuf); |
1717 |
} |
|
11725
68a79ddc6b27
6720637 want zdb -l option to dump uberblock arrays as well
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
11724
diff
changeset
|
1718 |
(void) printf(footer ? footer : ""); |
789 | 1719 |
} |
1720 |
||
1721 |
static void |
|
10860
f850bd358163
6736356 zdb -R/-C needs to work with exported pools
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10859
diff
changeset
|
1722 |
dump_config(spa_t *spa) |
789 | 1723 |
{ |
10860
f850bd358163
6736356 zdb -R/-C needs to work with exported pools
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10859
diff
changeset
|
1724 |
dmu_buf_t *db; |
f850bd358163
6736356 zdb -R/-C needs to work with exported pools
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10859
diff
changeset
|
1725 |
size_t nvsize = 0; |
f850bd358163
6736356 zdb -R/-C needs to work with exported pools
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10859
diff
changeset
|
1726 |
int error = 0; |
f850bd358163
6736356 zdb -R/-C needs to work with exported pools
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10859
diff
changeset
|
1727 |
|
f850bd358163
6736356 zdb -R/-C needs to work with exported pools
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10859
diff
changeset
|
1728 |
|
f850bd358163
6736356 zdb -R/-C needs to work with exported pools
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10859
diff
changeset
|
1729 |
error = dmu_bonus_hold(spa->spa_meta_objset, |
f850bd358163
6736356 zdb -R/-C needs to work with exported pools
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10859
diff
changeset
|
1730 |
spa->spa_config_object, FTAG, &db); |
789 | 1731 |
|
10860
f850bd358163
6736356 zdb -R/-C needs to work with exported pools
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10859
diff
changeset
|
1732 |
if (error == 0) { |
f850bd358163
6736356 zdb -R/-C needs to work with exported pools
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10859
diff
changeset
|
1733 |
nvsize = *(uint64_t *)db->db_data; |
f850bd358163
6736356 zdb -R/-C needs to work with exported pools
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10859
diff
changeset
|
1734 |
dmu_buf_rele(db, FTAG); |
f850bd358163
6736356 zdb -R/-C needs to work with exported pools
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10859
diff
changeset
|
1735 |
|
f850bd358163
6736356 zdb -R/-C needs to work with exported pools
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10859
diff
changeset
|
1736 |
(void) printf("\nMOS Configuration:\n"); |
f850bd358163
6736356 zdb -R/-C needs to work with exported pools
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10859
diff
changeset
|
1737 |
dump_packed_nvlist(spa->spa_meta_objset, |
f850bd358163
6736356 zdb -R/-C needs to work with exported pools
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10859
diff
changeset
|
1738 |
spa->spa_config_object, (void *)&nvsize, 1); |
f850bd358163
6736356 zdb -R/-C needs to work with exported pools
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10859
diff
changeset
|
1739 |
} else { |
f850bd358163
6736356 zdb -R/-C needs to work with exported pools
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10859
diff
changeset
|
1740 |
(void) fprintf(stderr, "dmu_bonus_hold(%llu) failed, errno %d", |
f850bd358163
6736356 zdb -R/-C needs to work with exported pools
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10859
diff
changeset
|
1741 |
(u_longlong_t)spa->spa_config_object, error); |
789 | 1742 |
} |
1743 |
} |
|
1744 |
||
1745 |
static void |
|
6643
3a34b0dbb107
6625086 changing cachefile doesn't remove old cache on last user
eschrock
parents:
6423
diff
changeset
|
1746 |
dump_cachefile(const char *cachefile) |
3a34b0dbb107
6625086 changing cachefile doesn't remove old cache on last user
eschrock
parents:
6423
diff
changeset
|
1747 |
{ |
3a34b0dbb107
6625086 changing cachefile doesn't remove old cache on last user
eschrock
parents:
6423
diff
changeset
|
1748 |
int fd; |
3a34b0dbb107
6625086 changing cachefile doesn't remove old cache on last user
eschrock
parents:
6423
diff
changeset
|
1749 |
struct stat64 statbuf; |
3a34b0dbb107
6625086 changing cachefile doesn't remove old cache on last user
eschrock
parents:
6423
diff
changeset
|
1750 |
char *buf; |
3a34b0dbb107
6625086 changing cachefile doesn't remove old cache on last user
eschrock
parents:
6423
diff
changeset
|
1751 |
nvlist_t *config; |
3a34b0dbb107
6625086 changing cachefile doesn't remove old cache on last user
eschrock
parents:
6423
diff
changeset
|
1752 |
|
3a34b0dbb107
6625086 changing cachefile doesn't remove old cache on last user
eschrock
parents:
6423
diff
changeset
|
1753 |
if ((fd = open64(cachefile, O_RDONLY)) < 0) { |
3a34b0dbb107
6625086 changing cachefile doesn't remove old cache on last user
eschrock
parents:
6423
diff
changeset
|
1754 |
(void) printf("cannot open '%s': %s\n", cachefile, |
3a34b0dbb107
6625086 changing cachefile doesn't remove old cache on last user
eschrock
parents:
6423
diff
changeset
|
1755 |
strerror(errno)); |
3a34b0dbb107
6625086 changing cachefile doesn't remove old cache on last user
eschrock
parents:
6423
diff
changeset
|
1756 |
exit(1); |
3a34b0dbb107
6625086 changing cachefile doesn't remove old cache on last user
eschrock
parents:
6423
diff
changeset
|
1757 |
} |
3a34b0dbb107
6625086 changing cachefile doesn't remove old cache on last user
eschrock
parents:
6423
diff
changeset
|
1758 |
|
3a34b0dbb107
6625086 changing cachefile doesn't remove old cache on last user
eschrock
parents:
6423
diff
changeset
|
1759 |
if (fstat64(fd, &statbuf) != 0) { |
3a34b0dbb107
6625086 changing cachefile doesn't remove old cache on last user
eschrock
parents:
6423
diff
changeset
|
1760 |
(void) printf("failed to stat '%s': %s\n", cachefile, |
3a34b0dbb107
6625086 changing cachefile doesn't remove old cache on last user
eschrock
parents:
6423
diff
changeset
|
1761 |
strerror(errno)); |
3a34b0dbb107
6625086 changing cachefile doesn't remove old cache on last user
eschrock
parents:
6423
diff
changeset
|
1762 |
exit(1); |
3a34b0dbb107
6625086 changing cachefile doesn't remove old cache on last user
eschrock
parents:
6423
diff
changeset
|
1763 |
} |
3a34b0dbb107
6625086 changing cachefile doesn't remove old cache on last user
eschrock
parents:
6423
diff
changeset
|
1764 |
|
3a34b0dbb107
6625086 changing cachefile doesn't remove old cache on last user
eschrock
parents:
6423
diff
changeset
|
1765 |
if ((buf = malloc(statbuf.st_size)) == NULL) { |
3a34b0dbb107
6625086 changing cachefile doesn't remove old cache on last user
eschrock
parents:
6423
diff
changeset
|
1766 |
(void) fprintf(stderr, "failed to allocate %llu bytes\n", |
3a34b0dbb107
6625086 changing cachefile doesn't remove old cache on last user
eschrock
parents:
6423
diff
changeset
|
1767 |
(u_longlong_t)statbuf.st_size); |
3a34b0dbb107
6625086 changing cachefile doesn't remove old cache on last user
eschrock
parents:
6423
diff
changeset
|
1768 |
exit(1); |
3a34b0dbb107
6625086 changing cachefile doesn't remove old cache on last user
eschrock
parents:
6423
diff
changeset
|
1769 |
} |
3a34b0dbb107
6625086 changing cachefile doesn't remove old cache on last user
eschrock
parents:
6423
diff
changeset
|
1770 |
|
3a34b0dbb107
6625086 changing cachefile doesn't remove old cache on last user
eschrock
parents:
6423
diff
changeset
|
1771 |
if (read(fd, buf, statbuf.st_size) != statbuf.st_size) { |
3a34b0dbb107
6625086 changing cachefile doesn't remove old cache on last user
eschrock
parents:
6423
diff
changeset
|
1772 |
(void) fprintf(stderr, "failed to read %llu bytes\n", |
3a34b0dbb107
6625086 changing cachefile doesn't remove old cache on last user
eschrock
parents:
6423
diff
changeset
|
1773 |
(u_longlong_t)statbuf.st_size); |
3a34b0dbb107
6625086 changing cachefile doesn't remove old cache on last user
eschrock
parents:
6423
diff
changeset
|
1774 |
exit(1); |
3a34b0dbb107
6625086 changing cachefile doesn't remove old cache on last user
eschrock
parents:
6423
diff
changeset
|
1775 |
} |
3a34b0dbb107
6625086 changing cachefile doesn't remove old cache on last user
eschrock
parents:
6423
diff
changeset
|
1776 |
|
3a34b0dbb107
6625086 changing cachefile doesn't remove old cache on last user
eschrock
parents:
6423
diff
changeset
|
1777 |
(void) close(fd); |
3a34b0dbb107
6625086 changing cachefile doesn't remove old cache on last user
eschrock
parents:
6423
diff
changeset
|
1778 |
|
3a34b0dbb107
6625086 changing cachefile doesn't remove old cache on last user
eschrock
parents:
6423
diff
changeset
|
1779 |
if (nvlist_unpack(buf, statbuf.st_size, &config, 0) != 0) { |
3a34b0dbb107
6625086 changing cachefile doesn't remove old cache on last user
eschrock
parents:
6423
diff
changeset
|
1780 |
(void) fprintf(stderr, "failed to unpack nvlist\n"); |
3a34b0dbb107
6625086 changing cachefile doesn't remove old cache on last user
eschrock
parents:
6423
diff
changeset
|
1781 |
exit(1); |
3a34b0dbb107
6625086 changing cachefile doesn't remove old cache on last user
eschrock
parents:
6423
diff
changeset
|
1782 |
} |
3a34b0dbb107
6625086 changing cachefile doesn't remove old cache on last user
eschrock
parents:
6423
diff
changeset
|
1783 |
|
3a34b0dbb107
6625086 changing cachefile doesn't remove old cache on last user
eschrock
parents:
6423
diff
changeset
|
1784 |
free(buf); |
3a34b0dbb107
6625086 changing cachefile doesn't remove old cache on last user
eschrock
parents:
6423
diff
changeset
|
1785 |
|
3a34b0dbb107
6625086 changing cachefile doesn't remove old cache on last user
eschrock
parents:
6423
diff
changeset
|
1786 |
dump_nvlist(config, 0); |
3a34b0dbb107
6625086 changing cachefile doesn't remove old cache on last user
eschrock
parents:
6423
diff
changeset
|
1787 |
|
3a34b0dbb107
6625086 changing cachefile doesn't remove old cache on last user
eschrock
parents:
6423
diff
changeset
|
1788 |
nvlist_free(config); |
3a34b0dbb107
6625086 changing cachefile doesn't remove old cache on last user
eschrock
parents:
6423
diff
changeset
|
1789 |
} |
3a34b0dbb107
6625086 changing cachefile doesn't remove old cache on last user
eschrock
parents:
6423
diff
changeset
|
1790 |
|
11725
68a79ddc6b27
6720637 want zdb -l option to dump uberblock arrays as well
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
11724
diff
changeset
|
1791 |
#define ZDB_MAX_UB_HEADER_SIZE 32 |
68a79ddc6b27
6720637 want zdb -l option to dump uberblock arrays as well
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
11724
diff
changeset
|
1792 |
|
68a79ddc6b27
6720637 want zdb -l option to dump uberblock arrays as well
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
11724
diff
changeset
|
1793 |
static void |
68a79ddc6b27
6720637 want zdb -l option to dump uberblock arrays as well
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
11724
diff
changeset
|
1794 |
dump_label_uberblocks(vdev_label_t *lbl, uint64_t ashift) |
68a79ddc6b27
6720637 want zdb -l option to dump uberblock arrays as well
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
11724
diff
changeset
|
1795 |
{ |
68a79ddc6b27
6720637 want zdb -l option to dump uberblock arrays as well
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
11724
diff
changeset
|
1796 |
vdev_t vd; |
68a79ddc6b27
6720637 want zdb -l option to dump uberblock arrays as well
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
11724
diff
changeset
|
1797 |
vdev_t *vdp = &vd; |
68a79ddc6b27
6720637 want zdb -l option to dump uberblock arrays as well
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
11724
diff
changeset
|
1798 |
char header[ZDB_MAX_UB_HEADER_SIZE]; |
68a79ddc6b27
6720637 want zdb -l option to dump uberblock arrays as well
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
11724
diff
changeset
|
1799 |
|
68a79ddc6b27
6720637 want zdb -l option to dump uberblock arrays as well
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
11724
diff
changeset
|
1800 |
vd.vdev_ashift = ashift; |
68a79ddc6b27
6720637 want zdb -l option to dump uberblock arrays as well
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
11724
diff
changeset
|
1801 |
vdp->vdev_top = vdp; |
68a79ddc6b27
6720637 want zdb -l option to dump uberblock arrays as well
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
11724
diff
changeset
|
1802 |
|
68a79ddc6b27
6720637 want zdb -l option to dump uberblock arrays as well
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
11724
diff
changeset
|
1803 |
for (int i = 0; i < VDEV_UBERBLOCK_COUNT(vdp); i++) { |
68a79ddc6b27
6720637 want zdb -l option to dump uberblock arrays as well
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
11724
diff
changeset
|
1804 |
uint64_t uoff = VDEV_UBERBLOCK_OFFSET(vdp, i); |
68a79ddc6b27
6720637 want zdb -l option to dump uberblock arrays as well
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
11724
diff
changeset
|
1805 |
uberblock_t *ub = (void *)((char *)lbl + uoff); |
68a79ddc6b27
6720637 want zdb -l option to dump uberblock arrays as well
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
11724
diff
changeset
|
1806 |
|
68a79ddc6b27
6720637 want zdb -l option to dump uberblock arrays as well
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
11724
diff
changeset
|
1807 |
if (uberblock_verify(ub)) |
68a79ddc6b27
6720637 want zdb -l option to dump uberblock arrays as well
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
11724
diff
changeset
|
1808 |
continue; |
68a79ddc6b27
6720637 want zdb -l option to dump uberblock arrays as well
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
11724
diff
changeset
|
1809 |
(void) snprintf(header, ZDB_MAX_UB_HEADER_SIZE, |
68a79ddc6b27
6720637 want zdb -l option to dump uberblock arrays as well
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
11724
diff
changeset
|
1810 |
"Uberblock[%d]\n", i); |
68a79ddc6b27
6720637 want zdb -l option to dump uberblock arrays as well
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
11724
diff
changeset
|
1811 |
dump_uberblock(ub, header, ""); |
68a79ddc6b27
6720637 want zdb -l option to dump uberblock arrays as well
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
11724
diff
changeset
|
1812 |
} |
68a79ddc6b27
6720637 want zdb -l option to dump uberblock arrays as well
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
11724
diff
changeset
|
1813 |
} |
68a79ddc6b27
6720637 want zdb -l option to dump uberblock arrays as well
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
11724
diff
changeset
|
1814 |
|
6643
3a34b0dbb107
6625086 changing cachefile doesn't remove old cache on last user
eschrock
parents:
6423
diff
changeset
|
1815 |
static void |
789 | 1816 |
dump_label(const char *dev) |
1817 |
{ |
|
1818 |
int fd; |
|
1819 |
vdev_label_t label; |
|
11826
f769bc37a3d0
6808244 changing vdev state doesn't update config file
George Wilson <George.Wilson@Sun.COM>
parents:
11811
diff
changeset
|
1820 |
char *path, *buf = label.vl_vdev_phys.vp_nvlist; |
789 | 1821 |
size_t buflen = sizeof (label.vl_vdev_phys.vp_nvlist); |
1822 |
struct stat64 statbuf; |
|
11725
68a79ddc6b27
6720637 want zdb -l option to dump uberblock arrays as well
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
11724
diff
changeset
|
1823 |
uint64_t psize, ashift; |
11826
f769bc37a3d0
6808244 changing vdev state doesn't update config file
George Wilson <George.Wilson@Sun.COM>
parents:
11811
diff
changeset
|
1824 |
int len = strlen(dev) + 1; |
f769bc37a3d0
6808244 changing vdev state doesn't update config file
George Wilson <George.Wilson@Sun.COM>
parents:
11811
diff
changeset
|
1825 |
|
f769bc37a3d0
6808244 changing vdev state doesn't update config file
George Wilson <George.Wilson@Sun.COM>
parents:
11811
diff
changeset
|
1826 |
if (strncmp(dev, "/dev/dsk/", 9) == 0) { |
f769bc37a3d0
6808244 changing vdev state doesn't update config file
George Wilson <George.Wilson@Sun.COM>
parents:
11811
diff
changeset
|
1827 |
len++; |
f769bc37a3d0
6808244 changing vdev state doesn't update config file
George Wilson <George.Wilson@Sun.COM>
parents:
11811
diff
changeset
|
1828 |
path = malloc(len); |
f769bc37a3d0
6808244 changing vdev state doesn't update config file
George Wilson <George.Wilson@Sun.COM>
parents:
11811
diff
changeset
|
1829 |
(void) snprintf(path, len, "%s%s", "/dev/rdsk/", dev + 9); |
f769bc37a3d0
6808244 changing vdev state doesn't update config file
George Wilson <George.Wilson@Sun.COM>
parents:
11811
diff
changeset
|
1830 |
} else { |
f769bc37a3d0
6808244 changing vdev state doesn't update config file
George Wilson <George.Wilson@Sun.COM>
parents:
11811
diff
changeset
|
1831 |
path = strdup(dev); |
f769bc37a3d0
6808244 changing vdev state doesn't update config file
George Wilson <George.Wilson@Sun.COM>
parents:
11811
diff
changeset
|
1832 |
} |
f769bc37a3d0
6808244 changing vdev state doesn't update config file
George Wilson <George.Wilson@Sun.COM>
parents:
11811
diff
changeset
|
1833 |
|
f769bc37a3d0
6808244 changing vdev state doesn't update config file
George Wilson <George.Wilson@Sun.COM>
parents:
11811
diff
changeset
|
1834 |
if ((fd = open64(path, O_RDONLY)) < 0) { |
f769bc37a3d0
6808244 changing vdev state doesn't update config file
George Wilson <George.Wilson@Sun.COM>
parents:
11811
diff
changeset
|
1835 |
(void) printf("cannot open '%s': %s\n", path, strerror(errno)); |
f769bc37a3d0
6808244 changing vdev state doesn't update config file
George Wilson <George.Wilson@Sun.COM>
parents:
11811
diff
changeset
|
1836 |
free(path); |
789 | 1837 |
exit(1); |
1838 |
} |
|
1839 |
||
1840 |
if (fstat64(fd, &statbuf) != 0) { |
|
11826
f769bc37a3d0
6808244 changing vdev state doesn't update config file
George Wilson <George.Wilson@Sun.COM>
parents:
11811
diff
changeset
|
1841 |
(void) printf("failed to stat '%s': %s\n", path, |
789 | 1842 |
strerror(errno)); |
11826
f769bc37a3d0
6808244 changing vdev state doesn't update config file
George Wilson <George.Wilson@Sun.COM>
parents:
11811
diff
changeset
|
1843 |
free(path); |
f769bc37a3d0
6808244 changing vdev state doesn't update config file
George Wilson <George.Wilson@Sun.COM>
parents:
11811
diff
changeset
|
1844 |
(void) close(fd); |
f769bc37a3d0
6808244 changing vdev state doesn't update config file
George Wilson <George.Wilson@Sun.COM>
parents:
11811
diff
changeset
|
1845 |
exit(1); |
f769bc37a3d0
6808244 changing vdev state doesn't update config file
George Wilson <George.Wilson@Sun.COM>
parents:
11811
diff
changeset
|
1846 |
} |
f769bc37a3d0
6808244 changing vdev state doesn't update config file
George Wilson <George.Wilson@Sun.COM>
parents:
11811
diff
changeset
|
1847 |
|
f769bc37a3d0
6808244 changing vdev state doesn't update config file
George Wilson <George.Wilson@Sun.COM>
parents:
11811
diff
changeset
|
1848 |
if (S_ISBLK(statbuf.st_mode)) { |
f769bc37a3d0
6808244 changing vdev state doesn't update config file
George Wilson <George.Wilson@Sun.COM>
parents:
11811
diff
changeset
|
1849 |
(void) printf("cannot use '%s': character device required\n", |
f769bc37a3d0
6808244 changing vdev state doesn't update config file
George Wilson <George.Wilson@Sun.COM>
parents:
11811
diff
changeset
|
1850 |
path); |
f769bc37a3d0
6808244 changing vdev state doesn't update config file
George Wilson <George.Wilson@Sun.COM>
parents:
11811
diff
changeset
|
1851 |
free(path); |
f769bc37a3d0
6808244 changing vdev state doesn't update config file
George Wilson <George.Wilson@Sun.COM>
parents:
11811
diff
changeset
|
1852 |
(void) close(fd); |
f769bc37a3d0
6808244 changing vdev state doesn't update config file
George Wilson <George.Wilson@Sun.COM>
parents:
11811
diff
changeset
|
1853 |
exit(1); |
789 | 1854 |
} |
1855 |
||
1856 |
psize = statbuf.st_size; |
|
1857 |
psize = P2ALIGN(psize, (uint64_t)sizeof (vdev_label_t)); |
|
1858 |
||
11725
68a79ddc6b27
6720637 want zdb -l option to dump uberblock arrays as well
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
11724
diff
changeset
|
1859 |
for (int l = 0; l < VDEV_LABELS; l++) { |
789 | 1860 |
nvlist_t *config = NULL; |
1861 |
||
1862 |
(void) printf("--------------------------------------------\n"); |
|
1863 |
(void) printf("LABEL %d\n", l); |
|
1864 |
(void) printf("--------------------------------------------\n"); |
|
1865 |
||
1170
cbb023fb2c22
6366222 zdb(1M) needs to use largefile primitives when reading label
eschrock
parents:
896
diff
changeset
|
1866 |
if (pread64(fd, &label, sizeof (label), |
789 | 1867 |
vdev_label_offset(psize, l, 0)) != sizeof (label)) { |
1868 |
(void) printf("failed to read label %d\n", l); |
|
1869 |
continue; |
|
1870 |
} |
|
1871 |
||
1872 |
if (nvlist_unpack(buf, buflen, &config, 0) != 0) { |
|
1873 |
(void) printf("failed to unpack label %d\n", l); |
|
11725
68a79ddc6b27
6720637 want zdb -l option to dump uberblock arrays as well
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
11724
diff
changeset
|
1874 |
ashift = SPA_MINBLOCKSHIFT; |
68a79ddc6b27
6720637 want zdb -l option to dump uberblock arrays as well
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
11724
diff
changeset
|
1875 |
} else { |
68a79ddc6b27
6720637 want zdb -l option to dump uberblock arrays as well
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
11724
diff
changeset
|
1876 |
nvlist_t *vdev_tree = NULL; |
68a79ddc6b27
6720637 want zdb -l option to dump uberblock arrays as well
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
11724
diff
changeset
|
1877 |
|
68a79ddc6b27
6720637 want zdb -l option to dump uberblock arrays as well
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
11724
diff
changeset
|
1878 |
dump_nvlist(config, 4); |
68a79ddc6b27
6720637 want zdb -l option to dump uberblock arrays as well
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
11724
diff
changeset
|
1879 |
if ((nvlist_lookup_nvlist(config, |
68a79ddc6b27
6720637 want zdb -l option to dump uberblock arrays as well
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
11724
diff
changeset
|
1880 |
ZPOOL_CONFIG_VDEV_TREE, &vdev_tree) != 0) || |
68a79ddc6b27
6720637 want zdb -l option to dump uberblock arrays as well
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
11724
diff
changeset
|
1881 |
(nvlist_lookup_uint64(vdev_tree, |
68a79ddc6b27
6720637 want zdb -l option to dump uberblock arrays as well
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
11724
diff
changeset
|
1882 |
ZPOOL_CONFIG_ASHIFT, &ashift) != 0)) |
68a79ddc6b27
6720637 want zdb -l option to dump uberblock arrays as well
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
11724
diff
changeset
|
1883 |
ashift = SPA_MINBLOCKSHIFT; |
68a79ddc6b27
6720637 want zdb -l option to dump uberblock arrays as well
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
11724
diff
changeset
|
1884 |
nvlist_free(config); |
789 | 1885 |
} |
11725
68a79ddc6b27
6720637 want zdb -l option to dump uberblock arrays as well
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
11724
diff
changeset
|
1886 |
if (dump_opt['u']) |
68a79ddc6b27
6720637 want zdb -l option to dump uberblock arrays as well
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
11724
diff
changeset
|
1887 |
dump_label_uberblocks(&label, ashift); |
789 | 1888 |
} |
11826
f769bc37a3d0
6808244 changing vdev state doesn't update config file
George Wilson <George.Wilson@Sun.COM>
parents:
11811
diff
changeset
|
1889 |
|
f769bc37a3d0
6808244 changing vdev state doesn't update config file
George Wilson <George.Wilson@Sun.COM>
parents:
11811
diff
changeset
|
1890 |
free(path); |
f769bc37a3d0
6808244 changing vdev state doesn't update config file
George Wilson <George.Wilson@Sun.COM>
parents:
11811
diff
changeset
|
1891 |
(void) close(fd); |
789 | 1892 |
} |
1893 |
||
1894 |
/*ARGSUSED*/ |
|
2199 | 1895 |
static int |
11209
462283cb4096
6905188 panic: kernel heap corruption when doing "zfs rename -r"
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
11165
diff
changeset
|
1896 |
dump_one_dir(const char *dsname, void *arg) |
789 | 1897 |
{ |
1898 |
int error; |
|
1899 |
objset_t *os; |
|
1900 |
||
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
1901 |
error = dmu_objset_own(dsname, DMU_OST_ANY, B_TRUE, FTAG, &os); |
789 | 1902 |
if (error) { |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
1903 |
(void) printf("Could not open %s, error %d\n", dsname, error); |
2199 | 1904 |
return (0); |
789 | 1905 |
} |
1906 |
dump_dir(os); |
|
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
1907 |
dmu_objset_disown(os, FTAG); |
5959
1e1904b8526d
6650192 zfs ACL/fuid code could use some minor cleanup
marks
parents:
5530
diff
changeset
|
1908 |
fuid_table_destroy(); |
11935
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
1909 |
sa_loaded = B_FALSE; |
2199 | 1910 |
return (0); |
789 | 1911 |
} |
1912 |
||
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
1913 |
/* |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
1914 |
* Block statistics. |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
1915 |
*/ |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
1916 |
typedef struct zdb_blkstats { |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
1917 |
uint64_t zb_asize; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
1918 |
uint64_t zb_lsize; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
1919 |
uint64_t zb_psize; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
1920 |
uint64_t zb_count; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
1921 |
} zdb_blkstats_t; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
1922 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
1923 |
/* |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
1924 |
* Extended object types to report deferred frees and dedup auto-ditto blocks. |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
1925 |
*/ |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
1926 |
#define ZDB_OT_DEFERRED (DMU_OT_NUMTYPES + 0) |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
1927 |
#define ZDB_OT_DITTO (DMU_OT_NUMTYPES + 1) |
13700
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
13618
diff
changeset
|
1928 |
#define ZDB_OT_OTHER (DMU_OT_NUMTYPES + 2) |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
13618
diff
changeset
|
1929 |
#define ZDB_OT_TOTAL (DMU_OT_NUMTYPES + 3) |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
1930 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
1931 |
static char *zdb_ot_extname[] = { |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
1932 |
"deferred free", |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
1933 |
"dedup ditto", |
13700
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
13618
diff
changeset
|
1934 |
"other", |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
1935 |
"Total", |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
1936 |
}; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
1937 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
1938 |
#define ZB_TOTAL DN_MAX_LEVELS |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
1939 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
1940 |
typedef struct zdb_cb { |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
1941 |
zdb_blkstats_t zcb_type[ZB_TOTAL + 1][ZDB_OT_TOTAL + 1]; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
1942 |
uint64_t zcb_dedup_asize; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
1943 |
uint64_t zcb_dedup_blocks; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
1944 |
uint64_t zcb_errors[256]; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
1945 |
int zcb_readfails; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
1946 |
int zcb_haderrors; |
12470
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1947 |
spa_t *zcb_spa; |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
1948 |
} zdb_cb_t; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
1949 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
1950 |
static void |
12470
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1951 |
zdb_count_block(zdb_cb_t *zcb, zilog_t *zilog, const blkptr_t *bp, |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
1952 |
dmu_object_type_t type) |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
1953 |
{ |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
1954 |
uint64_t refcnt = 0; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
1955 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
1956 |
ASSERT(type < ZDB_OT_TOTAL); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
1957 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
1958 |
if (zilog && zil_bp_tree_add(zilog, bp) != 0) |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
1959 |
return; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
1960 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
1961 |
for (int i = 0; i < 4; i++) { |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
1962 |
int l = (i < 2) ? BP_GET_LEVEL(bp) : ZB_TOTAL; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
1963 |
int t = (i & 1) ? type : ZDB_OT_TOTAL; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
1964 |
zdb_blkstats_t *zb = &zcb->zcb_type[l][t]; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
1965 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
1966 |
zb->zb_asize += BP_GET_ASIZE(bp); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
1967 |
zb->zb_lsize += BP_GET_LSIZE(bp); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
1968 |
zb->zb_psize += BP_GET_PSIZE(bp); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
1969 |
zb->zb_count++; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
1970 |
} |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
1971 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
1972 |
if (dump_opt['L']) |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
1973 |
return; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
1974 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
1975 |
if (BP_GET_DEDUP(bp)) { |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
1976 |
ddt_t *ddt; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
1977 |
ddt_entry_t *dde; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
1978 |
|
12470
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1979 |
ddt = ddt_select(zcb->zcb_spa, bp); |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
1980 |
ddt_enter(ddt); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
1981 |
dde = ddt_lookup(ddt, bp, B_FALSE); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
1982 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
1983 |
if (dde == NULL) { |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
1984 |
refcnt = 0; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
1985 |
} else { |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
1986 |
ddt_phys_t *ddp = ddt_phys_select(dde, bp); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
1987 |
ddt_phys_decref(ddp); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
1988 |
refcnt = ddp->ddp_refcnt; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
1989 |
if (ddt_phys_total_refcnt(dde) == 0) |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
1990 |
ddt_remove(ddt, dde); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
1991 |
} |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
1992 |
ddt_exit(ddt); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
1993 |
} |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
1994 |
|
12470
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1995 |
VERIFY3U(zio_wait(zio_claim(NULL, zcb->zcb_spa, |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1996 |
refcnt ? 0 : spa_first_txg(zcb->zcb_spa), |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
1997 |
bp, NULL, NULL, ZIO_FLAG_CANFAIL)), ==, 0); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
1998 |
} |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
1999 |
|
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12050
diff
changeset
|
2000 |
/* ARGSUSED */ |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2001 |
static int |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12050
diff
changeset
|
2002 |
zdb_blkptr_cb(spa_t *spa, zilog_t *zilog, const blkptr_t *bp, arc_buf_t *pbuf, |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2003 |
const zbookmark_t *zb, const dnode_phys_t *dnp, void *arg) |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2004 |
{ |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2005 |
zdb_cb_t *zcb = arg; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2006 |
char blkbuf[BP_SPRINTF_LEN]; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2007 |
dmu_object_type_t type; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2008 |
boolean_t is_metadata; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2009 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2010 |
if (bp == NULL) |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2011 |
return (0); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2012 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2013 |
type = BP_GET_TYPE(bp); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2014 |
|
13700
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
13618
diff
changeset
|
2015 |
zdb_count_block(zcb, zilog, bp, |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
13618
diff
changeset
|
2016 |
(type & DMU_OT_NEWTYPE) ? ZDB_OT_OTHER : type); |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
13618
diff
changeset
|
2017 |
|
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
13618
diff
changeset
|
2018 |
is_metadata = (BP_GET_LEVEL(bp) != 0 || DMU_OT_IS_METADATA(type)); |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2019 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2020 |
if (dump_opt['c'] > 1 || (dump_opt['c'] && is_metadata)) { |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2021 |
int ioerr; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2022 |
size_t size = BP_GET_PSIZE(bp); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2023 |
void *data = malloc(size); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2024 |
int flags = ZIO_FLAG_CANFAIL | ZIO_FLAG_SCRUB | ZIO_FLAG_RAW; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2025 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2026 |
/* If it's an intent log block, failure is expected. */ |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2027 |
if (zb->zb_level == ZB_ZIL_LEVEL) |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2028 |
flags |= ZIO_FLAG_SPECULATIVE; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2029 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2030 |
ioerr = zio_wait(zio_read(NULL, spa, bp, data, size, |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2031 |
NULL, NULL, ZIO_PRIORITY_ASYNC_READ, flags, zb)); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2032 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2033 |
free(data); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2034 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2035 |
if (ioerr && !(flags & ZIO_FLAG_SPECULATIVE)) { |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2036 |
zcb->zcb_haderrors = 1; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2037 |
zcb->zcb_errors[ioerr]++; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2038 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2039 |
if (dump_opt['b'] >= 2) |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2040 |
sprintf_blkptr(blkbuf, bp); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2041 |
else |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2042 |
blkbuf[0] = '\0'; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2043 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2044 |
(void) printf("zdb_blkptr_cb: " |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2045 |
"Got error %d reading " |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2046 |
"<%llu, %llu, %lld, %llx> %s -- skipping\n", |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2047 |
ioerr, |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2048 |
(u_longlong_t)zb->zb_objset, |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2049 |
(u_longlong_t)zb->zb_object, |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2050 |
(u_longlong_t)zb->zb_level, |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2051 |
(u_longlong_t)zb->zb_blkid, |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2052 |
blkbuf); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2053 |
} |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2054 |
} |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2055 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2056 |
zcb->zcb_readfails = 0; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2057 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2058 |
if (dump_opt['b'] >= 4) { |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2059 |
sprintf_blkptr(blkbuf, bp); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2060 |
(void) printf("objset %llu object %llu " |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2061 |
"level %lld offset 0x%llx %s\n", |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2062 |
(u_longlong_t)zb->zb_objset, |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2063 |
(u_longlong_t)zb->zb_object, |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2064 |
(longlong_t)zb->zb_level, |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2065 |
(u_longlong_t)blkid2offset(dnp, bp, zb), |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2066 |
blkbuf); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2067 |
} |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2068 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2069 |
return (0); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2070 |
} |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2071 |
|
789 | 2072 |
static void |
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
|
2073 |
zdb_leak(space_map_t *sm, uint64_t start, uint64_t size) |
789 | 2074 |
{ |
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
|
2075 |
vdev_t *vd = sm->sm_ppd; |
789 | 2076 |
|
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
|
2077 |
(void) printf("leaked space: vdev %llu, offset 0x%llx, size %llu\n", |
b80e4842ad54
6754011 SPA 3.0: lock breakup, i/o pipeline refactoring, device failure handling
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
7390
diff
changeset
|
2078 |
(u_longlong_t)vd->vdev_id, (u_longlong_t)start, (u_longlong_t)size); |
789 | 2079 |
} |
2080 |
||
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
|
2081 |
/* ARGSUSED */ |
b80e4842ad54
6754011 SPA 3.0: lock breakup, i/o pipeline refactoring, device failure handling
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
7390
diff
changeset
|
2082 |
static void |
b80e4842ad54
6754011 SPA 3.0: lock breakup, i/o pipeline refactoring, device failure handling
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
7390
diff
changeset
|
2083 |
zdb_space_map_load(space_map_t *sm) |
789 | 2084 |
{ |
2085 |
} |
|
2086 |
||
2087 |
static void |
|
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
|
2088 |
zdb_space_map_unload(space_map_t *sm) |
789 | 2089 |
{ |
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
|
2090 |
space_map_vacate(sm, zdb_leak, sm); |
b80e4842ad54
6754011 SPA 3.0: lock breakup, i/o pipeline refactoring, device failure handling
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
7390
diff
changeset
|
2091 |
} |
789 | 2092 |
|
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
|
2093 |
/* ARGSUSED */ |
b80e4842ad54
6754011 SPA 3.0: lock breakup, i/o pipeline refactoring, device failure handling
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
7390
diff
changeset
|
2094 |
static void |
b80e4842ad54
6754011 SPA 3.0: lock breakup, i/o pipeline refactoring, device failure handling
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
7390
diff
changeset
|
2095 |
zdb_space_map_claim(space_map_t *sm, uint64_t start, uint64_t size) |
b80e4842ad54
6754011 SPA 3.0: lock breakup, i/o pipeline refactoring, device failure handling
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
7390
diff
changeset
|
2096 |
{ |
b80e4842ad54
6754011 SPA 3.0: lock breakup, i/o pipeline refactoring, device failure handling
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
7390
diff
changeset
|
2097 |
} |
789 | 2098 |
|
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
|
2099 |
static space_map_ops_t zdb_space_map_ops = { |
b80e4842ad54
6754011 SPA 3.0: lock breakup, i/o pipeline refactoring, device failure handling
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
7390
diff
changeset
|
2100 |
zdb_space_map_load, |
b80e4842ad54
6754011 SPA 3.0: lock breakup, i/o pipeline refactoring, device failure handling
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
7390
diff
changeset
|
2101 |
zdb_space_map_unload, |
b80e4842ad54
6754011 SPA 3.0: lock breakup, i/o pipeline refactoring, device failure handling
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
7390
diff
changeset
|
2102 |
NULL, /* alloc */ |
b80e4842ad54
6754011 SPA 3.0: lock breakup, i/o pipeline refactoring, device failure handling
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
7390
diff
changeset
|
2103 |
zdb_space_map_claim, |
9480
fcff33da767f
6596237 Stop looking and start ganging
George Wilson <George.Wilson@Sun.COM>
parents:
9463
diff
changeset
|
2104 |
NULL, /* free */ |
fcff33da767f
6596237 Stop looking and start ganging
George Wilson <George.Wilson@Sun.COM>
parents:
9463
diff
changeset
|
2105 |
NULL /* maxsize */ |
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
|
2106 |
}; |
789 | 2107 |
|
2108 |
static void |
|
11125
fca3e6d28599
6899923 vdev_offline/vdev_add deadlock
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10922
diff
changeset
|
2109 |
zdb_ddt_leak_init(spa_t *spa, zdb_cb_t *zcb) |
789 | 2110 |
{ |
11125
fca3e6d28599
6899923 vdev_offline/vdev_add deadlock
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10922
diff
changeset
|
2111 |
ddt_bookmark_t ddb = { 0 }; |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2112 |
ddt_entry_t dde; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2113 |
int error; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2114 |
|
11125
fca3e6d28599
6899923 vdev_offline/vdev_add deadlock
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10922
diff
changeset
|
2115 |
while ((error = ddt_walk(spa, &ddb, &dde)) == 0) { |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2116 |
blkptr_t blk; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2117 |
ddt_phys_t *ddp = dde.dde_phys; |
11125
fca3e6d28599
6899923 vdev_offline/vdev_add deadlock
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10922
diff
changeset
|
2118 |
|
fca3e6d28599
6899923 vdev_offline/vdev_add deadlock
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10922
diff
changeset
|
2119 |
if (ddb.ddb_class == DDT_CLASS_UNIQUE) |
fca3e6d28599
6899923 vdev_offline/vdev_add deadlock
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10922
diff
changeset
|
2120 |
return; |
fca3e6d28599
6899923 vdev_offline/vdev_add deadlock
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10922
diff
changeset
|
2121 |
|
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2122 |
ASSERT(ddt_phys_total_refcnt(&dde) > 1); |
11125
fca3e6d28599
6899923 vdev_offline/vdev_add deadlock
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10922
diff
changeset
|
2123 |
|
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2124 |
for (int p = 0; p < DDT_PHYS_TYPES; p++, ddp++) { |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2125 |
if (ddp->ddp_phys_birth == 0) |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2126 |
continue; |
11125
fca3e6d28599
6899923 vdev_offline/vdev_add deadlock
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10922
diff
changeset
|
2127 |
ddt_bp_create(ddb.ddb_checksum, |
fca3e6d28599
6899923 vdev_offline/vdev_add deadlock
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10922
diff
changeset
|
2128 |
&dde.dde_key, ddp, &blk); |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2129 |
if (p == DDT_PHYS_DITTO) { |
12470
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
2130 |
zdb_count_block(zcb, NULL, &blk, ZDB_OT_DITTO); |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2131 |
} else { |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2132 |
zcb->zcb_dedup_asize += |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2133 |
BP_GET_ASIZE(&blk) * (ddp->ddp_refcnt - 1); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2134 |
zcb->zcb_dedup_blocks++; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2135 |
} |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2136 |
} |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2137 |
if (!dump_opt['L']) { |
11125
fca3e6d28599
6899923 vdev_offline/vdev_add deadlock
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10922
diff
changeset
|
2138 |
ddt_t *ddt = spa->spa_ddt[ddb.ddb_checksum]; |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2139 |
ddt_enter(ddt); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2140 |
VERIFY(ddt_lookup(ddt, &blk, B_TRUE) != NULL); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2141 |
ddt_exit(ddt); |
789 | 2142 |
} |
2143 |
} |
|
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2144 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2145 |
ASSERT(error == ENOENT); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2146 |
} |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2147 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2148 |
static void |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2149 |
zdb_leak_init(spa_t *spa, zdb_cb_t *zcb) |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2150 |
{ |
12470
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
2151 |
zcb->zcb_spa = spa; |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
2152 |
|
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2153 |
if (!dump_opt['L']) { |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2154 |
vdev_t *rvd = spa->spa_root_vdev; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2155 |
for (int c = 0; c < rvd->vdev_children; c++) { |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2156 |
vdev_t *vd = rvd->vdev_child[c]; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2157 |
for (int m = 0; m < vd->vdev_ms_count; m++) { |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2158 |
metaslab_t *msp = vd->vdev_ms[m]; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2159 |
mutex_enter(&msp->ms_lock); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2160 |
space_map_unload(&msp->ms_map); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2161 |
VERIFY(space_map_load(&msp->ms_map, |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2162 |
&zdb_space_map_ops, SM_ALLOC, &msp->ms_smo, |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2163 |
spa->spa_meta_objset) == 0); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2164 |
msp->ms_map.sm_ppd = vd; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2165 |
mutex_exit(&msp->ms_lock); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2166 |
} |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2167 |
} |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2168 |
} |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2169 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2170 |
spa_config_enter(spa, SCL_CONFIG, FTAG, RW_READER); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2171 |
|
11125
fca3e6d28599
6899923 vdev_offline/vdev_add deadlock
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10922
diff
changeset
|
2172 |
zdb_ddt_leak_init(spa, zcb); |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2173 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2174 |
spa_config_exit(spa, SCL_CONFIG, FTAG); |
789 | 2175 |
} |
2176 |
||
2177 |
static void |
|
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
|
2178 |
zdb_leak_fini(spa_t *spa) |
789 | 2179 |
{ |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2180 |
if (!dump_opt['L']) { |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2181 |
vdev_t *rvd = spa->spa_root_vdev; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2182 |
for (int c = 0; c < rvd->vdev_children; c++) { |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2183 |
vdev_t *vd = rvd->vdev_child[c]; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2184 |
for (int m = 0; m < vd->vdev_ms_count; m++) { |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2185 |
metaslab_t *msp = vd->vdev_ms[m]; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2186 |
mutex_enter(&msp->ms_lock); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2187 |
space_map_unload(&msp->ms_map); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2188 |
mutex_exit(&msp->ms_lock); |
7837
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
2189 |
} |
6217
40ffa8cc1b75
6656655 zdb should be able to display blkptr signatures
ek110237
parents:
5994
diff
changeset
|
2190 |
} |
789 | 2191 |
} |
2192 |
} |
|
2193 |
||
12470
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
2194 |
/* ARGSUSED */ |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
2195 |
static int |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
2196 |
count_block_cb(void *arg, const blkptr_t *bp, dmu_tx_t *tx) |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
2197 |
{ |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
2198 |
zdb_cb_t *zcb = arg; |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
2199 |
|
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
2200 |
if (dump_opt['b'] >= 4) { |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
2201 |
char blkbuf[BP_SPRINTF_LEN]; |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
2202 |
sprintf_blkptr(blkbuf, bp); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
2203 |
(void) printf("[%s] %s\n", |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
2204 |
"deferred free", blkbuf); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
2205 |
} |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
2206 |
zdb_count_block(zcb, NULL, bp, ZDB_OT_DEFERRED); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
2207 |
return (0); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
2208 |
} |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
2209 |
|
789 | 2210 |
static int |
2211 |
dump_block_stats(spa_t *spa) |
|
2212 |
{ |
|
2213 |
zdb_cb_t zcb = { 0 }; |
|
2214 |
zdb_blkstats_t *zb, *tzb; |
|
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2215 |
uint64_t norm_alloc, norm_space, total_alloc, total_found; |
11724
a2728800460e
6848238 zdb -bcsv does not report all corruptions
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
11497
diff
changeset
|
2216 |
int flags = TRAVERSE_PRE | TRAVERSE_PREFETCH_METADATA | TRAVERSE_HARD; |
789 | 2217 |
int leaks = 0; |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2218 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2219 |
(void) printf("\nTraversing all blocks %s%s%s%s%s...\n", |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2220 |
(dump_opt['c'] || !dump_opt['L']) ? "to verify " : "", |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2221 |
(dump_opt['c'] == 1) ? "metadata " : "", |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2222 |
dump_opt['c'] ? "checksums " : "", |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2223 |
(dump_opt['c'] && !dump_opt['L']) ? "and verify " : "", |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2224 |
!dump_opt['L'] ? "nothing leaked " : ""); |
789 | 2225 |
|
2226 |
/* |
|
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
|
2227 |
* Load all space maps as SM_ALLOC maps, then traverse the pool |
b80e4842ad54
6754011 SPA 3.0: lock breakup, i/o pipeline refactoring, device failure handling
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
7390
diff
changeset
|
2228 |
* claiming each block we discover. If the pool is perfectly |
b80e4842ad54
6754011 SPA 3.0: lock breakup, i/o pipeline refactoring, device failure handling
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
7390
diff
changeset
|
2229 |
* consistent, the space maps will be empty when we're done. |
b80e4842ad54
6754011 SPA 3.0: lock breakup, i/o pipeline refactoring, device failure handling
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
7390
diff
changeset
|
2230 |
* Anything left over is a leak; any block we can't claim (because |
b80e4842ad54
6754011 SPA 3.0: lock breakup, i/o pipeline refactoring, device failure handling
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
7390
diff
changeset
|
2231 |
* it's not part of any space map) is a double allocation, |
b80e4842ad54
6754011 SPA 3.0: lock breakup, i/o pipeline refactoring, device failure handling
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
7390
diff
changeset
|
2232 |
* reference to a freed block, or an unclaimed log block. |
789 | 2233 |
*/ |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2234 |
zdb_leak_init(spa, &zcb); |
789 | 2235 |
|
2236 |
/* |
|
2237 |
* If there's a deferred-free bplist, process that first. |
|
2238 |
*/ |
|
12470
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
2239 |
(void) bpobj_iterate_nofree(&spa->spa_deferred_bpobj, |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
2240 |
count_block_cb, &zcb, NULL); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
2241 |
(void) bpobj_iterate_nofree(&spa->spa_dsl_pool->dp_free_bpobj, |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
2242 |
count_block_cb, &zcb, NULL); |
13700
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
13618
diff
changeset
|
2243 |
if (spa_feature_is_active(spa, |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
13618
diff
changeset
|
2244 |
&spa_feature_table[SPA_FEATURE_ASYNC_DESTROY])) { |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
13618
diff
changeset
|
2245 |
VERIFY3U(0, ==, bptree_iterate(spa->spa_meta_objset, |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
13618
diff
changeset
|
2246 |
spa->spa_dsl_pool->dp_bptree_obj, B_FALSE, count_block_cb, |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
13618
diff
changeset
|
2247 |
&zcb, NULL)); |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
13618
diff
changeset
|
2248 |
} |
789 | 2249 |
|
11125
fca3e6d28599
6899923 vdev_offline/vdev_add deadlock
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10922
diff
changeset
|
2250 |
if (dump_opt['c'] > 1) |
fca3e6d28599
6899923 vdev_offline/vdev_add deadlock
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10922
diff
changeset
|
2251 |
flags |= TRAVERSE_PREFETCH_DATA; |
fca3e6d28599
6899923 vdev_offline/vdev_add deadlock
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10922
diff
changeset
|
2252 |
|
fca3e6d28599
6899923 vdev_offline/vdev_add deadlock
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10922
diff
changeset
|
2253 |
zcb.zcb_haderrors |= traverse_pool(spa, 0, flags, zdb_blkptr_cb, &zcb); |
789 | 2254 |
|
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2255 |
if (zcb.zcb_haderrors) { |
789 | 2256 |
(void) printf("\nError counts:\n\n"); |
2257 |
(void) printf("\t%5s %s\n", "errno", "count"); |
|
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2258 |
for (int e = 0; e < 256; e++) { |
789 | 2259 |
if (zcb.zcb_errors[e] != 0) { |
2260 |
(void) printf("\t%5d %llu\n", |
|
2261 |
e, (u_longlong_t)zcb.zcb_errors[e]); |
|
2262 |
} |
|
2263 |
} |
|
2264 |
} |
|
2265 |
||
2266 |
/* |
|
2267 |
* Report any leaked segments. |
|
2268 |
*/ |
|
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2269 |
zdb_leak_fini(spa); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2270 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2271 |
tzb = &zcb.zcb_type[ZB_TOTAL][ZDB_OT_TOTAL]; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2272 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2273 |
norm_alloc = metaslab_class_get_alloc(spa_normal_class(spa)); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2274 |
norm_space = metaslab_class_get_space(spa_normal_class(spa)); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2275 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2276 |
total_alloc = norm_alloc + metaslab_class_get_alloc(spa_log_class(spa)); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2277 |
total_found = tzb->zb_asize - zcb.zcb_dedup_asize; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2278 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2279 |
if (total_found == total_alloc) { |
8121
7fd09d4ebd9c
6757430 want an option for zdb to disable space map loading and leak tracking
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
7837
diff
changeset
|
2280 |
if (!dump_opt['L']) |
7fd09d4ebd9c
6757430 want an option for zdb to disable space map loading and leak tracking
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
7837
diff
changeset
|
2281 |
(void) printf("\n\tNo leaks (block sum matches space" |
7fd09d4ebd9c
6757430 want an option for zdb to disable space map loading and leak tracking
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
7837
diff
changeset
|
2282 |
" maps exactly)\n"); |
789 | 2283 |
} else { |
2284 |
(void) printf("block traversal size %llu != alloc %llu " |
|
8121
7fd09d4ebd9c
6757430 want an option for zdb to disable space map loading and leak tracking
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
7837
diff
changeset
|
2285 |
"(%s %lld)\n", |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2286 |
(u_longlong_t)total_found, |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2287 |
(u_longlong_t)total_alloc, |
8121
7fd09d4ebd9c
6757430 want an option for zdb to disable space map loading and leak tracking
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
7837
diff
changeset
|
2288 |
(dump_opt['L']) ? "unreachable" : "leaked", |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2289 |
(longlong_t)(total_alloc - total_found)); |
789 | 2290 |
leaks = 1; |
2291 |
} |
|
2292 |
||
2293 |
if (tzb->zb_count == 0) |
|
2294 |
return (2); |
|
2295 |
||
2296 |
(void) printf("\n"); |
|
2297 |
(void) printf("\tbp count: %10llu\n", |
|
2298 |
(u_longlong_t)tzb->zb_count); |
|
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2299 |
(void) printf("\tbp logical: %10llu avg: %6llu\n", |
789 | 2300 |
(u_longlong_t)tzb->zb_lsize, |
2301 |
(u_longlong_t)(tzb->zb_lsize / tzb->zb_count)); |
|
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2302 |
(void) printf("\tbp physical: %10llu avg:" |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2303 |
" %6llu compression: %6.2f\n", |
789 | 2304 |
(u_longlong_t)tzb->zb_psize, |
2305 |
(u_longlong_t)(tzb->zb_psize / tzb->zb_count), |
|
2306 |
(double)tzb->zb_lsize / tzb->zb_psize); |
|
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2307 |
(void) printf("\tbp allocated: %10llu avg:" |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2308 |
" %6llu compression: %6.2f\n", |
789 | 2309 |
(u_longlong_t)tzb->zb_asize, |
2310 |
(u_longlong_t)(tzb->zb_asize / tzb->zb_count), |
|
2311 |
(double)tzb->zb_lsize / tzb->zb_asize); |
|
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2312 |
(void) printf("\tbp deduped: %10llu ref>1:" |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2313 |
" %6llu deduplication: %6.2f\n", |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2314 |
(u_longlong_t)zcb.zcb_dedup_asize, |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2315 |
(u_longlong_t)zcb.zcb_dedup_blocks, |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2316 |
(double)zcb.zcb_dedup_asize / tzb->zb_asize + 1.0); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2317 |
(void) printf("\tSPA allocated: %10llu used: %5.2f%%\n", |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2318 |
(u_longlong_t)norm_alloc, 100.0 * norm_alloc / norm_space); |
789 | 2319 |
|
2320 |
if (dump_opt['b'] >= 2) { |
|
2321 |
int l, t, level; |
|
2322 |
(void) printf("\nBlocks\tLSIZE\tPSIZE\tASIZE" |
|
2323 |
"\t avg\t comp\t%%Total\tType\n"); |
|
2324 |
||
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2325 |
for (t = 0; t <= ZDB_OT_TOTAL; t++) { |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12050
diff
changeset
|
2326 |
char csize[32], lsize[32], psize[32], asize[32]; |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12050
diff
changeset
|
2327 |
char avg[32]; |
789 | 2328 |
char *typename; |
2329 |
||
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2330 |
if (t < DMU_OT_NUMTYPES) |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2331 |
typename = dmu_ot[t].ot_name; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2332 |
else |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2333 |
typename = zdb_ot_extname[t - DMU_OT_NUMTYPES]; |
789 | 2334 |
|
2335 |
if (zcb.zcb_type[ZB_TOTAL][t].zb_asize == 0) { |
|
2336 |
(void) printf("%6s\t%5s\t%5s\t%5s" |
|
2337 |
"\t%5s\t%5s\t%6s\t%s\n", |
|
2338 |
"-", |
|
2339 |
"-", |
|
2340 |
"-", |
|
2341 |
"-", |
|
2342 |
"-", |
|
2343 |
"-", |
|
2344 |
"-", |
|
2345 |
typename); |
|
2346 |
continue; |
|
2347 |
} |
|
2348 |
||
2349 |
for (l = ZB_TOTAL - 1; l >= -1; l--) { |
|
2350 |
level = (l == -1 ? ZB_TOTAL : l); |
|
2351 |
zb = &zcb.zcb_type[level][t]; |
|
2352 |
||
2353 |
if (zb->zb_asize == 0) |
|
2354 |
continue; |
|
2355 |
||
2356 |
if (dump_opt['b'] < 3 && level != ZB_TOTAL) |
|
2357 |
continue; |
|
2358 |
||
2359 |
if (level == 0 && zb->zb_asize == |
|
2360 |
zcb.zcb_type[ZB_TOTAL][t].zb_asize) |
|
2361 |
continue; |
|
2362 |
||
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12050
diff
changeset
|
2363 |
zdb_nicenum(zb->zb_count, csize); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12050
diff
changeset
|
2364 |
zdb_nicenum(zb->zb_lsize, lsize); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12050
diff
changeset
|
2365 |
zdb_nicenum(zb->zb_psize, psize); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12050
diff
changeset
|
2366 |
zdb_nicenum(zb->zb_asize, asize); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12050
diff
changeset
|
2367 |
zdb_nicenum(zb->zb_asize / zb->zb_count, avg); |
789 | 2368 |
|
2369 |
(void) printf("%6s\t%5s\t%5s\t%5s\t%5s" |
|
2370 |
"\t%5.2f\t%6.2f\t", |
|
2371 |
csize, lsize, psize, asize, avg, |
|
2372 |
(double)zb->zb_lsize / zb->zb_psize, |
|
2373 |
100.0 * zb->zb_asize / tzb->zb_asize); |
|
2374 |
||
2375 |
if (level == ZB_TOTAL) |
|
2376 |
(void) printf("%s\n", typename); |
|
2377 |
else |
|
2378 |
(void) printf(" L%d %s\n", |
|
2379 |
level, typename); |
|
2380 |
} |
|
2381 |
} |
|
2382 |
} |
|
2383 |
||
2384 |
(void) printf("\n"); |
|
2385 |
||
2386 |
if (leaks) |
|
2387 |
return (2); |
|
2388 |
||
2389 |
if (zcb.zcb_haderrors) |
|
2390 |
return (3); |
|
2391 |
||
2392 |
return (0); |
|
2393 |
} |
|
2394 |
||
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2395 |
typedef struct zdb_ddt_entry { |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2396 |
ddt_key_t zdde_key; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2397 |
uint64_t zdde_ref_blocks; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2398 |
uint64_t zdde_ref_lsize; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2399 |
uint64_t zdde_ref_psize; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2400 |
uint64_t zdde_ref_dsize; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2401 |
avl_node_t zdde_node; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2402 |
} zdb_ddt_entry_t; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2403 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2404 |
/* ARGSUSED */ |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2405 |
static int |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2406 |
zdb_ddt_add_cb(spa_t *spa, zilog_t *zilog, const blkptr_t *bp, |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12050
diff
changeset
|
2407 |
arc_buf_t *pbuf, const zbookmark_t *zb, const dnode_phys_t *dnp, void *arg) |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2408 |
{ |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2409 |
avl_tree_t *t = arg; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2410 |
avl_index_t where; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2411 |
zdb_ddt_entry_t *zdde, zdde_search; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2412 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2413 |
if (bp == NULL) |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2414 |
return (0); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2415 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2416 |
if (dump_opt['S'] > 1 && zb->zb_level == ZB_ROOT_LEVEL) { |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2417 |
(void) printf("traversing objset %llu, %llu objects, " |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2418 |
"%lu blocks so far\n", |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2419 |
(u_longlong_t)zb->zb_objset, |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2420 |
(u_longlong_t)bp->blk_fill, |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2421 |
avl_numnodes(t)); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2422 |
} |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2423 |
|
11125
fca3e6d28599
6899923 vdev_offline/vdev_add deadlock
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10922
diff
changeset
|
2424 |
if (BP_IS_HOLE(bp) || BP_GET_CHECKSUM(bp) == ZIO_CHECKSUM_OFF || |
13700
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
13618
diff
changeset
|
2425 |
BP_GET_LEVEL(bp) > 0 || DMU_OT_IS_METADATA(BP_GET_TYPE(bp))) |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2426 |
return (0); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2427 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2428 |
ddt_key_fill(&zdde_search.zdde_key, bp); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2429 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2430 |
zdde = avl_find(t, &zdde_search, &where); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2431 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2432 |
if (zdde == NULL) { |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2433 |
zdde = umem_zalloc(sizeof (*zdde), UMEM_NOFAIL); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2434 |
zdde->zdde_key = zdde_search.zdde_key; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2435 |
avl_insert(t, zdde, where); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2436 |
} |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2437 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2438 |
zdde->zdde_ref_blocks += 1; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2439 |
zdde->zdde_ref_lsize += BP_GET_LSIZE(bp); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2440 |
zdde->zdde_ref_psize += BP_GET_PSIZE(bp); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2441 |
zdde->zdde_ref_dsize += bp_get_dsize_sync(spa, bp); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2442 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2443 |
return (0); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2444 |
} |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2445 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2446 |
static void |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2447 |
dump_simulated_ddt(spa_t *spa) |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2448 |
{ |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2449 |
avl_tree_t t; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2450 |
void *cookie = NULL; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2451 |
zdb_ddt_entry_t *zdde; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2452 |
ddt_histogram_t ddh_total = { 0 }; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2453 |
ddt_stat_t dds_total = { 0 }; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2454 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2455 |
avl_create(&t, ddt_entry_compare, |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2456 |
sizeof (zdb_ddt_entry_t), offsetof(zdb_ddt_entry_t, zdde_node)); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2457 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2458 |
spa_config_enter(spa, SCL_CONFIG, FTAG, RW_READER); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2459 |
|
11125
fca3e6d28599
6899923 vdev_offline/vdev_add deadlock
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10922
diff
changeset
|
2460 |
(void) traverse_pool(spa, 0, TRAVERSE_PRE | TRAVERSE_PREFETCH_METADATA, |
fca3e6d28599
6899923 vdev_offline/vdev_add deadlock
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10922
diff
changeset
|
2461 |
zdb_ddt_add_cb, &t); |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2462 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2463 |
spa_config_exit(spa, SCL_CONFIG, FTAG); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2464 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2465 |
while ((zdde = avl_destroy_nodes(&t, &cookie)) != NULL) { |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2466 |
ddt_stat_t dds; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2467 |
uint64_t refcnt = zdde->zdde_ref_blocks; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2468 |
ASSERT(refcnt != 0); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2469 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2470 |
dds.dds_blocks = zdde->zdde_ref_blocks / refcnt; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2471 |
dds.dds_lsize = zdde->zdde_ref_lsize / refcnt; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2472 |
dds.dds_psize = zdde->zdde_ref_psize / refcnt; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2473 |
dds.dds_dsize = zdde->zdde_ref_dsize / refcnt; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2474 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2475 |
dds.dds_ref_blocks = zdde->zdde_ref_blocks; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2476 |
dds.dds_ref_lsize = zdde->zdde_ref_lsize; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2477 |
dds.dds_ref_psize = zdde->zdde_ref_psize; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2478 |
dds.dds_ref_dsize = zdde->zdde_ref_dsize; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2479 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2480 |
ddt_stat_add(&ddh_total.ddh_stat[highbit(refcnt) - 1], &dds, 0); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2481 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2482 |
umem_free(zdde, sizeof (*zdde)); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2483 |
} |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2484 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2485 |
avl_destroy(&t); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2486 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2487 |
ddt_histogram_stat(&dds_total, &ddh_total); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2488 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2489 |
(void) printf("Simulated DDT histogram:\n"); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2490 |
|
11149
8bad7424e2c2
6903731 need userland dedup stats
George Wilson <George.Wilson@Sun.COM>
parents:
11146
diff
changeset
|
2491 |
zpool_dump_ddt(&dds_total, &ddh_total); |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2492 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2493 |
dump_dedup_ratio(&dds_total); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2494 |
} |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2495 |
|
789 | 2496 |
static void |
2497 |
dump_zpool(spa_t *spa) |
|
2498 |
{ |
|
2499 |
dsl_pool_t *dp = spa_get_dsl(spa); |
|
2500 |
int rc = 0; |
|
2501 |
||
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2502 |
if (dump_opt['S']) { |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2503 |
dump_simulated_ddt(spa); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2504 |
return; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2505 |
} |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2506 |
|
10860
f850bd358163
6736356 zdb -R/-C needs to work with exported pools
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10859
diff
changeset
|
2507 |
if (!dump_opt['e'] && dump_opt['C'] > 1) { |
f850bd358163
6736356 zdb -R/-C needs to work with exported pools
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10859
diff
changeset
|
2508 |
(void) printf("\nCached configuration:\n"); |
f850bd358163
6736356 zdb -R/-C needs to work with exported pools
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10859
diff
changeset
|
2509 |
dump_nvlist(spa->spa_config, 8); |
f850bd358163
6736356 zdb -R/-C needs to work with exported pools
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10859
diff
changeset
|
2510 |
} |
f850bd358163
6736356 zdb -R/-C needs to work with exported pools
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10859
diff
changeset
|
2511 |
|
f850bd358163
6736356 zdb -R/-C needs to work with exported pools
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10859
diff
changeset
|
2512 |
if (dump_opt['C']) |
f850bd358163
6736356 zdb -R/-C needs to work with exported pools
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10859
diff
changeset
|
2513 |
dump_config(spa); |
f850bd358163
6736356 zdb -R/-C needs to work with exported pools
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10859
diff
changeset
|
2514 |
|
789 | 2515 |
if (dump_opt['u']) |
11725
68a79ddc6b27
6720637 want zdb -l option to dump uberblock arrays as well
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
11724
diff
changeset
|
2516 |
dump_uberblock(&spa->spa_uberblock, "\nUberblock:\n", "\n"); |
789 | 2517 |
|
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2518 |
if (dump_opt['D']) |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2519 |
dump_all_ddts(spa); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2520 |
|
10861
ae18f8a4df85
6887242 want to be able to dump specific metaslab(s) for specific vdev
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10860
diff
changeset
|
2521 |
if (dump_opt['d'] > 2 || dump_opt['m']) |
ae18f8a4df85
6887242 want to be able to dump specific metaslab(s) for specific vdev
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10860
diff
changeset
|
2522 |
dump_metaslabs(spa); |
ae18f8a4df85
6887242 want to be able to dump specific metaslab(s) for specific vdev
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10860
diff
changeset
|
2523 |
|
ae18f8a4df85
6887242 want to be able to dump specific metaslab(s) for specific vdev
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10860
diff
changeset
|
2524 |
if (dump_opt['d'] || dump_opt['i']) { |
789 | 2525 |
dump_dir(dp->dp_meta_objset); |
2526 |
if (dump_opt['d'] >= 3) { |
|
12470
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
2527 |
dump_bpobj(&spa->spa_deferred_bpobj, "Deferred frees"); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
2528 |
if (spa_version(spa) >= SPA_VERSION_DEADLISTS) { |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
2529 |
dump_bpobj(&spa->spa_dsl_pool->dp_free_bpobj, |
13700
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
13618
diff
changeset
|
2530 |
"Pool snapshot frees"); |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
13618
diff
changeset
|
2531 |
} |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
13618
diff
changeset
|
2532 |
|
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
13618
diff
changeset
|
2533 |
if (spa_feature_is_active(spa, |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
13618
diff
changeset
|
2534 |
&spa_feature_table[SPA_FEATURE_ASYNC_DESTROY])) { |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
13618
diff
changeset
|
2535 |
dump_bptree(spa->spa_meta_objset, |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
13618
diff
changeset
|
2536 |
spa->spa_dsl_pool->dp_bptree_obj, |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
13618
diff
changeset
|
2537 |
"Pool dataset frees"); |
12470
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
2538 |
} |
789 | 2539 |
dump_dtl(spa->spa_root_vdev, 0); |
9480
fcff33da767f
6596237 Stop looking and start ganging
George Wilson <George.Wilson@Sun.COM>
parents:
9463
diff
changeset
|
2540 |
} |
10860
f850bd358163
6736356 zdb -R/-C needs to work with exported pools
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10859
diff
changeset
|
2541 |
(void) dmu_objset_find(spa_name(spa), dump_one_dir, |
f850bd358163
6736356 zdb -R/-C needs to work with exported pools
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10859
diff
changeset
|
2542 |
NULL, DS_FIND_SNAPSHOTS | DS_FIND_CHILDREN); |
789 | 2543 |
} |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2544 |
if (dump_opt['b'] || dump_opt['c']) |
789 | 2545 |
rc = dump_block_stats(spa); |
2546 |
||
2547 |
if (dump_opt['s']) |
|
2548 |
show_pool_stats(spa); |
|
2549 |
||
10685
931790026ac6
6846163 ZFS continues to use faulted logzilla, bringing system to a crawl
George Wilson <George.Wilson@Sun.COM>
parents:
10594
diff
changeset
|
2550 |
if (dump_opt['h']) |
931790026ac6
6846163 ZFS continues to use faulted logzilla, bringing system to a crawl
George Wilson <George.Wilson@Sun.COM>
parents:
10594
diff
changeset
|
2551 |
dump_history(spa); |
931790026ac6
6846163 ZFS continues to use faulted logzilla, bringing system to a crawl
George Wilson <George.Wilson@Sun.COM>
parents:
10594
diff
changeset
|
2552 |
|
789 | 2553 |
if (rc != 0) |
2554 |
exit(rc); |
|
2555 |
} |
|
2556 |
||
1775
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2557 |
#define ZDB_FLAG_CHECKSUM 0x0001 |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2558 |
#define ZDB_FLAG_DECOMPRESS 0x0002 |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2559 |
#define ZDB_FLAG_BSWAP 0x0004 |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2560 |
#define ZDB_FLAG_GBH 0x0008 |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2561 |
#define ZDB_FLAG_INDIRECT 0x0010 |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2562 |
#define ZDB_FLAG_PHYS 0x0020 |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2563 |
#define ZDB_FLAG_RAW 0x0040 |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2564 |
#define ZDB_FLAG_PRINT_BLKPTR 0x0080 |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2565 |
|
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2566 |
int flagbits[256]; |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2567 |
|
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2568 |
static void |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2569 |
zdb_print_blkptr(blkptr_t *bp, int flags) |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2570 |
{ |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2571 |
char blkbuf[BP_SPRINTF_LEN]; |
1775
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2572 |
|
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2573 |
if (flags & ZDB_FLAG_BSWAP) |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2574 |
byteswap_uint64_array((void *)bp, sizeof (blkptr_t)); |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2575 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2576 |
sprintf_blkptr(blkbuf, bp); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2577 |
(void) printf("%s\n", blkbuf); |
1775
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2578 |
} |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2579 |
|
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2580 |
static void |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2581 |
zdb_dump_indirect(blkptr_t *bp, int nbps, int flags) |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2582 |
{ |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2583 |
int i; |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2584 |
|
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2585 |
for (i = 0; i < nbps; i++) |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2586 |
zdb_print_blkptr(&bp[i], flags); |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2587 |
} |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2588 |
|
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2589 |
static void |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2590 |
zdb_dump_gbh(void *buf, int flags) |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2591 |
{ |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2592 |
zdb_dump_indirect((blkptr_t *)buf, SPA_GBH_NBLKPTRS, flags); |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2593 |
} |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2594 |
|
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2595 |
static void |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2596 |
zdb_dump_block_raw(void *buf, uint64_t size, int flags) |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2597 |
{ |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2598 |
if (flags & ZDB_FLAG_BSWAP) |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2599 |
byteswap_uint64_array(buf, size); |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2600 |
(void) write(1, buf, size); |
1775
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2601 |
} |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2602 |
|
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2603 |
static void |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2604 |
zdb_dump_block(char *label, void *buf, uint64_t size, int flags) |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2605 |
{ |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2606 |
uint64_t *d = (uint64_t *)buf; |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2607 |
int nwords = size / sizeof (uint64_t); |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2608 |
int do_bswap = !!(flags & ZDB_FLAG_BSWAP); |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2609 |
int i, j; |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2610 |
char *hdr, *c; |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2611 |
|
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2612 |
|
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2613 |
if (do_bswap) |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2614 |
hdr = " 7 6 5 4 3 2 1 0 f e d c b a 9 8"; |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2615 |
else |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2616 |
hdr = " 0 1 2 3 4 5 6 7 8 9 a b c d e f"; |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2617 |
|
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2618 |
(void) printf("\n%s\n%6s %s 0123456789abcdef\n", label, "", hdr); |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2619 |
|
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2620 |
for (i = 0; i < nwords; i += 2) { |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2621 |
(void) printf("%06llx: %016llx %016llx ", |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2622 |
(u_longlong_t)(i * sizeof (uint64_t)), |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2623 |
(u_longlong_t)(do_bswap ? BSWAP_64(d[i]) : d[i]), |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2624 |
(u_longlong_t)(do_bswap ? BSWAP_64(d[i + 1]) : d[i + 1])); |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2625 |
|
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2626 |
c = (char *)&d[i]; |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2627 |
for (j = 0; j < 2 * sizeof (uint64_t); j++) |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2628 |
(void) printf("%c", isprint(c[j]) ? c[j] : '.'); |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2629 |
(void) printf("\n"); |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2630 |
} |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2631 |
} |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2632 |
|
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2633 |
/* |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2634 |
* There are two acceptable formats: |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2635 |
* leaf_name - For example: c1t0d0 or /tmp/ztest.0a |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2636 |
* child[.child]* - For example: 0.1.1 |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2637 |
* |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2638 |
* The second form can be used to specify arbitrary vdevs anywhere |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2639 |
* in the heirarchy. For example, in a pool with a mirror of |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2640 |
* RAID-Zs, you can specify either RAID-Z vdev with 0.0 or 0.1 . |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2641 |
*/ |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2642 |
static vdev_t * |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2643 |
zdb_vdev_lookup(vdev_t *vdev, char *path) |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2644 |
{ |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2645 |
char *s, *p, *q; |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2646 |
int i; |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2647 |
|
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2648 |
if (vdev == NULL) |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2649 |
return (NULL); |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2650 |
|
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2651 |
/* First, assume the x.x.x.x format */ |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2652 |
i = (int)strtoul(path, &s, 10); |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2653 |
if (s == path || (s && *s != '.' && *s != '\0')) |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2654 |
goto name; |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2655 |
if (i < 0 || i >= vdev->vdev_children) |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2656 |
return (NULL); |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2657 |
|
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2658 |
vdev = vdev->vdev_child[i]; |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2659 |
if (*s == '\0') |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2660 |
return (vdev); |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2661 |
return (zdb_vdev_lookup(vdev, s+1)); |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2662 |
|
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2663 |
name: |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2664 |
for (i = 0; i < vdev->vdev_children; i++) { |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2665 |
vdev_t *vc = vdev->vdev_child[i]; |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2666 |
|
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2667 |
if (vc->vdev_path == NULL) { |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2668 |
vc = zdb_vdev_lookup(vc, path); |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2669 |
if (vc == NULL) |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2670 |
continue; |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2671 |
else |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2672 |
return (vc); |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2673 |
} |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2674 |
|
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2675 |
p = strrchr(vc->vdev_path, '/'); |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2676 |
p = p ? p + 1 : vc->vdev_path; |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2677 |
q = &vc->vdev_path[strlen(vc->vdev_path) - 2]; |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2678 |
|
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2679 |
if (strcmp(vc->vdev_path, path) == 0) |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2680 |
return (vc); |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2681 |
if (strcmp(p, path) == 0) |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2682 |
return (vc); |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2683 |
if (strcmp(q, "s0") == 0 && strncmp(p, path, q - p) == 0) |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2684 |
return (vc); |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2685 |
} |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2686 |
|
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2687 |
return (NULL); |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2688 |
} |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2689 |
|
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2690 |
/* |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2691 |
* Read a block from a pool and print it out. The syntax of the |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2692 |
* block descriptor is: |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2693 |
* |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2694 |
* pool:vdev_specifier:offset:size[:flags] |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2695 |
* |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2696 |
* pool - The name of the pool you wish to read from |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2697 |
* vdev_specifier - Which vdev (see comment for zdb_vdev_lookup) |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2698 |
* offset - offset, in hex, in bytes |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2699 |
* size - Amount of data to read, in hex, in bytes |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2700 |
* flags - A string of characters specifying options |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2701 |
* b: Decode a blkptr at given offset within block |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2702 |
* *c: Calculate and display checksums |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2703 |
* d: Decompress data before dumping |
1775
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2704 |
* e: Byteswap data before dumping |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2705 |
* g: Display data as a gang block header |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2706 |
* i: Display as an indirect block |
1775
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2707 |
* p: Do I/O to physical offset |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2708 |
* r: Dump raw data to stdout |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2709 |
* |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2710 |
* * = not yet implemented |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2711 |
*/ |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2712 |
static void |
10860
f850bd358163
6736356 zdb -R/-C needs to work with exported pools
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10859
diff
changeset
|
2713 |
zdb_read_block(char *thing, spa_t *spa) |
1775
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2714 |
{ |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2715 |
blkptr_t blk, *bp = &blk; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2716 |
dva_t *dva = bp->blk_dva; |
1775
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2717 |
int flags = 0; |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2718 |
uint64_t offset = 0, size = 0, psize = 0, lsize = 0, blkptr_offset = 0; |
1775
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2719 |
zio_t *zio; |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2720 |
vdev_t *vd; |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2721 |
void *pbuf, *lbuf, *buf; |
10860
f850bd358163
6736356 zdb -R/-C needs to work with exported pools
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10859
diff
changeset
|
2722 |
char *s, *p, *dup, *vdev, *flagstr; |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2723 |
int i, error; |
1775
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2724 |
|
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2725 |
dup = strdup(thing); |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2726 |
s = strtok(dup, ":"); |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2727 |
vdev = s ? s : ""; |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2728 |
s = strtok(NULL, ":"); |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2729 |
offset = strtoull(s ? s : "", NULL, 16); |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2730 |
s = strtok(NULL, ":"); |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2731 |
size = strtoull(s ? s : "", NULL, 16); |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2732 |
s = strtok(NULL, ":"); |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2733 |
flagstr = s ? s : ""; |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2734 |
|
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2735 |
s = NULL; |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2736 |
if (size == 0) |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2737 |
s = "size must not be zero"; |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2738 |
if (!IS_P2ALIGNED(size, DEV_BSIZE)) |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2739 |
s = "size must be a multiple of sector size"; |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2740 |
if (!IS_P2ALIGNED(offset, DEV_BSIZE)) |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2741 |
s = "offset must be a multiple of sector size"; |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2742 |
if (s) { |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2743 |
(void) printf("Invalid block specifier: %s - %s\n", thing, s); |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2744 |
free(dup); |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2745 |
return; |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2746 |
} |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2747 |
|
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2748 |
for (s = strtok(flagstr, ":"); s; s = strtok(NULL, ":")) { |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2749 |
for (i = 0; flagstr[i]; i++) { |
2856 | 2750 |
int bit = flagbits[(uchar_t)flagstr[i]]; |
1775
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2751 |
|
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2752 |
if (bit == 0) { |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2753 |
(void) printf("***Invalid flag: %c\n", |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2754 |
flagstr[i]); |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2755 |
continue; |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2756 |
} |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2757 |
flags |= bit; |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2758 |
|
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2759 |
/* If it's not something with an argument, keep going */ |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2760 |
if ((bit & (ZDB_FLAG_CHECKSUM | |
1775
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2761 |
ZDB_FLAG_PRINT_BLKPTR)) == 0) |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2762 |
continue; |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2763 |
|
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2764 |
p = &flagstr[i + 1]; |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2765 |
if (bit == ZDB_FLAG_PRINT_BLKPTR) |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2766 |
blkptr_offset = strtoull(p, &p, 16); |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2767 |
if (*p != ':' && *p != '\0') { |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2768 |
(void) printf("***Invalid flag arg: '%s'\n", s); |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2769 |
free(dup); |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2770 |
return; |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2771 |
} |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2772 |
} |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2773 |
} |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2774 |
|
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2775 |
vd = zdb_vdev_lookup(spa->spa_root_vdev, vdev); |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2776 |
if (vd == NULL) { |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2777 |
(void) printf("***Invalid vdev: %s\n", vdev); |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2778 |
free(dup); |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2779 |
return; |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2780 |
} else { |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2781 |
if (vd->vdev_path) |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2782 |
(void) fprintf(stderr, "Found vdev: %s\n", |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2783 |
vd->vdev_path); |
1775
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2784 |
else |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2785 |
(void) fprintf(stderr, "Found vdev type: %s\n", |
1775
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2786 |
vd->vdev_ops->vdev_op_type); |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2787 |
} |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2788 |
|
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2789 |
psize = size; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2790 |
lsize = size; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2791 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2792 |
pbuf = umem_alloc(SPA_MAXBLOCKSIZE, UMEM_NOFAIL); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2793 |
lbuf = umem_alloc(SPA_MAXBLOCKSIZE, UMEM_NOFAIL); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2794 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2795 |
BP_ZERO(bp); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2796 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2797 |
DVA_SET_VDEV(&dva[0], vd->vdev_id); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2798 |
DVA_SET_OFFSET(&dva[0], offset); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2799 |
DVA_SET_GANG(&dva[0], !!(flags & ZDB_FLAG_GBH)); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2800 |
DVA_SET_ASIZE(&dva[0], vdev_psize_to_asize(vd, psize)); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2801 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2802 |
BP_SET_BIRTH(bp, TXG_INITIAL, TXG_INITIAL); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2803 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2804 |
BP_SET_LSIZE(bp, lsize); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2805 |
BP_SET_PSIZE(bp, psize); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2806 |
BP_SET_COMPRESS(bp, ZIO_COMPRESS_OFF); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2807 |
BP_SET_CHECKSUM(bp, ZIO_CHECKSUM_OFF); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2808 |
BP_SET_TYPE(bp, DMU_OT_NONE); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2809 |
BP_SET_LEVEL(bp, 0); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2810 |
BP_SET_DEDUP(bp, 0); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2811 |
BP_SET_BYTEORDER(bp, ZFS_HOST_BYTEORDER); |
1775
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2812 |
|
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
|
2813 |
spa_config_enter(spa, SCL_STATE, FTAG, RW_READER); |
1775
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2814 |
zio = zio_root(spa, NULL, NULL, 0); |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2815 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2816 |
if (vd == vd->vdev_top) { |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2817 |
/* |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2818 |
* Treat this as a normal block read. |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2819 |
*/ |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2820 |
zio_nowait(zio_read(zio, spa, bp, pbuf, psize, NULL, NULL, |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2821 |
ZIO_PRIORITY_SYNC_READ, |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2822 |
ZIO_FLAG_CANFAIL | ZIO_FLAG_RAW, NULL)); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2823 |
} else { |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2824 |
/* |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2825 |
* Treat this as a vdev child I/O. |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2826 |
*/ |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2827 |
zio_nowait(zio_vdev_child_io(zio, bp, vd, offset, pbuf, psize, |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2828 |
ZIO_TYPE_READ, ZIO_PRIORITY_SYNC_READ, |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2829 |
ZIO_FLAG_DONT_CACHE | ZIO_FLAG_DONT_QUEUE | |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2830 |
ZIO_FLAG_DONT_PROPAGATE | ZIO_FLAG_DONT_RETRY | |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2831 |
ZIO_FLAG_CANFAIL | ZIO_FLAG_RAW, NULL, NULL)); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2832 |
} |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2833 |
|
1775
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2834 |
error = zio_wait(zio); |
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
|
2835 |
spa_config_exit(spa, SCL_STATE, FTAG); |
1775
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2836 |
|
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2837 |
if (error) { |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2838 |
(void) printf("Read of %s failed, error: %d\n", thing, error); |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2839 |
goto out; |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2840 |
} |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2841 |
|
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2842 |
if (flags & ZDB_FLAG_DECOMPRESS) { |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2843 |
/* |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2844 |
* We don't know how the data was compressed, so just try |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2845 |
* every decompress function at every inflated blocksize. |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2846 |
*/ |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2847 |
enum zio_compress c; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2848 |
void *pbuf2 = umem_alloc(SPA_MAXBLOCKSIZE, UMEM_NOFAIL); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2849 |
void *lbuf2 = umem_alloc(SPA_MAXBLOCKSIZE, UMEM_NOFAIL); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2850 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2851 |
bcopy(pbuf, pbuf2, psize); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2852 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2853 |
VERIFY(random_get_pseudo_bytes((uint8_t *)pbuf + psize, |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2854 |
SPA_MAXBLOCKSIZE - psize) == 0); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2855 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2856 |
VERIFY(random_get_pseudo_bytes((uint8_t *)pbuf2 + psize, |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2857 |
SPA_MAXBLOCKSIZE - psize) == 0); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2858 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2859 |
for (lsize = SPA_MAXBLOCKSIZE; lsize > psize; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2860 |
lsize -= SPA_MINBLOCKSIZE) { |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2861 |
for (c = 0; c < ZIO_COMPRESS_FUNCTIONS; c++) { |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2862 |
if (zio_decompress_data(c, pbuf, lbuf, |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2863 |
psize, lsize) == 0 && |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2864 |
zio_decompress_data(c, pbuf2, lbuf2, |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2865 |
psize, lsize) == 0 && |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2866 |
bcmp(lbuf, lbuf2, lsize) == 0) |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2867 |
break; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2868 |
} |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2869 |
if (c != ZIO_COMPRESS_FUNCTIONS) |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2870 |
break; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2871 |
lsize -= SPA_MINBLOCKSIZE; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2872 |
} |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2873 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2874 |
umem_free(pbuf2, SPA_MAXBLOCKSIZE); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2875 |
umem_free(lbuf2, SPA_MAXBLOCKSIZE); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2876 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2877 |
if (lsize <= psize) { |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2878 |
(void) printf("Decompress of %s failed\n", thing); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2879 |
goto out; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2880 |
} |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2881 |
buf = lbuf; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2882 |
size = lsize; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2883 |
} else { |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2884 |
buf = pbuf; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2885 |
size = psize; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2886 |
} |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2887 |
|
1775
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2888 |
if (flags & ZDB_FLAG_PRINT_BLKPTR) |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2889 |
zdb_print_blkptr((blkptr_t *)(void *) |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2890 |
((uintptr_t)buf + (uintptr_t)blkptr_offset), flags); |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2891 |
else if (flags & ZDB_FLAG_RAW) |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2892 |
zdb_dump_block_raw(buf, size, flags); |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2893 |
else if (flags & ZDB_FLAG_INDIRECT) |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2894 |
zdb_dump_indirect((blkptr_t *)buf, size / sizeof (blkptr_t), |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2895 |
flags); |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2896 |
else if (flags & ZDB_FLAG_GBH) |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2897 |
zdb_dump_gbh(buf, flags); |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2898 |
else |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2899 |
zdb_dump_block(thing, buf, size, flags); |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2900 |
|
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2901 |
out: |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2902 |
umem_free(pbuf, SPA_MAXBLOCKSIZE); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
2903 |
umem_free(lbuf, SPA_MAXBLOCKSIZE); |
1775
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2904 |
free(dup); |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2905 |
} |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
2906 |
|
4627
c85631613c19
6509812 it would be useful if zdb(1M) could run on exported pools
ck153898
parents:
4577
diff
changeset
|
2907 |
static boolean_t |
10858
9efff268b959
6709782 issues using zdb with -e option
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10857
diff
changeset
|
2908 |
pool_match(nvlist_t *cfg, char *tgt) |
4627
c85631613c19
6509812 it would be useful if zdb(1M) could run on exported pools
ck153898
parents:
4577
diff
changeset
|
2909 |
{ |
10858
9efff268b959
6709782 issues using zdb with -e option
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10857
diff
changeset
|
2910 |
uint64_t v, guid = strtoull(tgt, NULL, 0); |
4627
c85631613c19
6509812 it would be useful if zdb(1M) could run on exported pools
ck153898
parents:
4577
diff
changeset
|
2911 |
char *s; |
c85631613c19
6509812 it would be useful if zdb(1M) could run on exported pools
ck153898
parents:
4577
diff
changeset
|
2912 |
|
10858
9efff268b959
6709782 issues using zdb with -e option
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10857
diff
changeset
|
2913 |
if (guid != 0) { |
9efff268b959
6709782 issues using zdb with -e option
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10857
diff
changeset
|
2914 |
if (nvlist_lookup_uint64(cfg, ZPOOL_CONFIG_POOL_GUID, &v) == 0) |
9efff268b959
6709782 issues using zdb with -e option
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10857
diff
changeset
|
2915 |
return (v == guid); |
9efff268b959
6709782 issues using zdb with -e option
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10857
diff
changeset
|
2916 |
} else { |
9efff268b959
6709782 issues using zdb with -e option
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10857
diff
changeset
|
2917 |
if (nvlist_lookup_string(cfg, ZPOOL_CONFIG_POOL_NAME, &s) == 0) |
9efff268b959
6709782 issues using zdb with -e option
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10857
diff
changeset
|
2918 |
return (strcmp(s, tgt) == 0); |
4627
c85631613c19
6509812 it would be useful if zdb(1M) could run on exported pools
ck153898
parents:
4577
diff
changeset
|
2919 |
} |
c85631613c19
6509812 it would be useful if zdb(1M) could run on exported pools
ck153898
parents:
4577
diff
changeset
|
2920 |
return (B_FALSE); |
c85631613c19
6509812 it would be useful if zdb(1M) could run on exported pools
ck153898
parents:
4577
diff
changeset
|
2921 |
} |
c85631613c19
6509812 it would be useful if zdb(1M) could run on exported pools
ck153898
parents:
4577
diff
changeset
|
2922 |
|
10858
9efff268b959
6709782 issues using zdb with -e option
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10857
diff
changeset
|
2923 |
static char * |
9efff268b959
6709782 issues using zdb with -e option
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10857
diff
changeset
|
2924 |
find_zpool(char **target, nvlist_t **configp, int dirc, char **dirv) |
4627
c85631613c19
6509812 it would be useful if zdb(1M) could run on exported pools
ck153898
parents:
4577
diff
changeset
|
2925 |
{ |
c85631613c19
6509812 it would be useful if zdb(1M) could run on exported pools
ck153898
parents:
4577
diff
changeset
|
2926 |
nvlist_t *pools; |
c85631613c19
6509812 it would be useful if zdb(1M) could run on exported pools
ck153898
parents:
4577
diff
changeset
|
2927 |
nvlist_t *match = NULL; |
10858
9efff268b959
6709782 issues using zdb with -e option
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10857
diff
changeset
|
2928 |
char *name = NULL; |
9efff268b959
6709782 issues using zdb with -e option
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10857
diff
changeset
|
2929 |
char *sepp = NULL; |
9efff268b959
6709782 issues using zdb with -e option
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10857
diff
changeset
|
2930 |
char sep; |
9efff268b959
6709782 issues using zdb with -e option
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10857
diff
changeset
|
2931 |
int count = 0; |
11497
69b45e632792
6698011 zfs incorrectly reports file systems as children when attempting a rename
Mark J Musante <Mark.Musante@Sun.COM>
parents:
11209
diff
changeset
|
2932 |
importargs_t args = { 0 }; |
69b45e632792
6698011 zfs incorrectly reports file systems as children when attempting a rename
Mark J Musante <Mark.Musante@Sun.COM>
parents:
11209
diff
changeset
|
2933 |
|
69b45e632792
6698011 zfs incorrectly reports file systems as children when attempting a rename
Mark J Musante <Mark.Musante@Sun.COM>
parents:
11209
diff
changeset
|
2934 |
args.paths = dirc; |
69b45e632792
6698011 zfs incorrectly reports file systems as children when attempting a rename
Mark J Musante <Mark.Musante@Sun.COM>
parents:
11209
diff
changeset
|
2935 |
args.path = dirv; |
69b45e632792
6698011 zfs incorrectly reports file systems as children when attempting a rename
Mark J Musante <Mark.Musante@Sun.COM>
parents:
11209
diff
changeset
|
2936 |
args.can_be_active = B_TRUE; |
4627
c85631613c19
6509812 it would be useful if zdb(1M) could run on exported pools
ck153898
parents:
4577
diff
changeset
|
2937 |
|
10858
9efff268b959
6709782 issues using zdb with -e option
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10857
diff
changeset
|
2938 |
if ((sepp = strpbrk(*target, "/@")) != NULL) { |
9efff268b959
6709782 issues using zdb with -e option
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10857
diff
changeset
|
2939 |
sep = *sepp; |
9efff268b959
6709782 issues using zdb with -e option
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10857
diff
changeset
|
2940 |
*sepp = '\0'; |
9efff268b959
6709782 issues using zdb with -e option
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10857
diff
changeset
|
2941 |
} |
9efff268b959
6709782 issues using zdb with -e option
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10857
diff
changeset
|
2942 |
|
11497
69b45e632792
6698011 zfs incorrectly reports file systems as children when attempting a rename
Mark J Musante <Mark.Musante@Sun.COM>
parents:
11209
diff
changeset
|
2943 |
pools = zpool_search_import(g_zfs, &args); |
4627
c85631613c19
6509812 it would be useful if zdb(1M) could run on exported pools
ck153898
parents:
4577
diff
changeset
|
2944 |
|
c85631613c19
6509812 it would be useful if zdb(1M) could run on exported pools
ck153898
parents:
4577
diff
changeset
|
2945 |
if (pools != NULL) { |
c85631613c19
6509812 it would be useful if zdb(1M) could run on exported pools
ck153898
parents:
4577
diff
changeset
|
2946 |
nvpair_t *elem = NULL; |
c85631613c19
6509812 it would be useful if zdb(1M) could run on exported pools
ck153898
parents:
4577
diff
changeset
|
2947 |
while ((elem = nvlist_next_nvpair(pools, elem)) != NULL) { |
c85631613c19
6509812 it would be useful if zdb(1M) could run on exported pools
ck153898
parents:
4577
diff
changeset
|
2948 |
verify(nvpair_value_nvlist(elem, configp) == 0); |
10858
9efff268b959
6709782 issues using zdb with -e option
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10857
diff
changeset
|
2949 |
if (pool_match(*configp, *target)) { |
9efff268b959
6709782 issues using zdb with -e option
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10857
diff
changeset
|
2950 |
count++; |
4627
c85631613c19
6509812 it would be useful if zdb(1M) could run on exported pools
ck153898
parents:
4577
diff
changeset
|
2951 |
if (match != NULL) { |
10858
9efff268b959
6709782 issues using zdb with -e option
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10857
diff
changeset
|
2952 |
/* print previously found config */ |
9efff268b959
6709782 issues using zdb with -e option
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10857
diff
changeset
|
2953 |
if (name != NULL) { |
9efff268b959
6709782 issues using zdb with -e option
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10857
diff
changeset
|
2954 |
(void) printf("%s\n", name); |
9efff268b959
6709782 issues using zdb with -e option
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10857
diff
changeset
|
2955 |
dump_nvlist(match, 8); |
9efff268b959
6709782 issues using zdb with -e option
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10857
diff
changeset
|
2956 |
name = NULL; |
9efff268b959
6709782 issues using zdb with -e option
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10857
diff
changeset
|
2957 |
} |
9efff268b959
6709782 issues using zdb with -e option
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10857
diff
changeset
|
2958 |
(void) printf("%s\n", |
9efff268b959
6709782 issues using zdb with -e option
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10857
diff
changeset
|
2959 |
nvpair_name(elem)); |
9efff268b959
6709782 issues using zdb with -e option
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10857
diff
changeset
|
2960 |
dump_nvlist(*configp, 8); |
4627
c85631613c19
6509812 it would be useful if zdb(1M) could run on exported pools
ck153898
parents:
4577
diff
changeset
|
2961 |
} else { |
c85631613c19
6509812 it would be useful if zdb(1M) could run on exported pools
ck153898
parents:
4577
diff
changeset
|
2962 |
match = *configp; |
10858
9efff268b959
6709782 issues using zdb with -e option
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10857
diff
changeset
|
2963 |
name = nvpair_name(elem); |
4627
c85631613c19
6509812 it would be useful if zdb(1M) could run on exported pools
ck153898
parents:
4577
diff
changeset
|
2964 |
} |
c85631613c19
6509812 it would be useful if zdb(1M) could run on exported pools
ck153898
parents:
4577
diff
changeset
|
2965 |
} |
c85631613c19
6509812 it would be useful if zdb(1M) could run on exported pools
ck153898
parents:
4577
diff
changeset
|
2966 |
} |
c85631613c19
6509812 it would be useful if zdb(1M) could run on exported pools
ck153898
parents:
4577
diff
changeset
|
2967 |
} |
10858
9efff268b959
6709782 issues using zdb with -e option
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10857
diff
changeset
|
2968 |
if (count > 1) |
9efff268b959
6709782 issues using zdb with -e option
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10857
diff
changeset
|
2969 |
(void) fatal("\tMatched %d pools - use pool GUID " |
9efff268b959
6709782 issues using zdb with -e option
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10857
diff
changeset
|
2970 |
"instead of pool name or \n" |
9efff268b959
6709782 issues using zdb with -e option
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10857
diff
changeset
|
2971 |
"\tpool name part of a dataset name to select pool", count); |
4627
c85631613c19
6509812 it would be useful if zdb(1M) could run on exported pools
ck153898
parents:
4577
diff
changeset
|
2972 |
|
10858
9efff268b959
6709782 issues using zdb with -e option
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10857
diff
changeset
|
2973 |
if (sepp) |
9efff268b959
6709782 issues using zdb with -e option
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10857
diff
changeset
|
2974 |
*sepp = sep; |
9efff268b959
6709782 issues using zdb with -e option
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10857
diff
changeset
|
2975 |
/* |
9efff268b959
6709782 issues using zdb with -e option
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10857
diff
changeset
|
2976 |
* If pool GUID was specified for pool id, replace it with pool name |
9efff268b959
6709782 issues using zdb with -e option
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10857
diff
changeset
|
2977 |
*/ |
9efff268b959
6709782 issues using zdb with -e option
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10857
diff
changeset
|
2978 |
if (name && (strstr(*target, name) != *target)) { |
9efff268b959
6709782 issues using zdb with -e option
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10857
diff
changeset
|
2979 |
int sz = 1 + strlen(name) + ((sepp) ? strlen(sepp) : 0); |
4627
c85631613c19
6509812 it would be useful if zdb(1M) could run on exported pools
ck153898
parents:
4577
diff
changeset
|
2980 |
|
10858
9efff268b959
6709782 issues using zdb with -e option
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10857
diff
changeset
|
2981 |
*target = umem_alloc(sz, UMEM_NOFAIL); |
9efff268b959
6709782 issues using zdb with -e option
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10857
diff
changeset
|
2982 |
(void) snprintf(*target, sz, "%s%s", name, sepp ? sepp : ""); |
9efff268b959
6709782 issues using zdb with -e option
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10857
diff
changeset
|
2983 |
} |
9efff268b959
6709782 issues using zdb with -e option
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10857
diff
changeset
|
2984 |
|
9efff268b959
6709782 issues using zdb with -e option
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10857
diff
changeset
|
2985 |
*configp = name ? match : NULL; |
9efff268b959
6709782 issues using zdb with -e option
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10857
diff
changeset
|
2986 |
|
9efff268b959
6709782 issues using zdb with -e option
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10857
diff
changeset
|
2987 |
return (name); |
4627
c85631613c19
6509812 it would be useful if zdb(1M) could run on exported pools
ck153898
parents:
4577
diff
changeset
|
2988 |
} |
c85631613c19
6509812 it would be useful if zdb(1M) could run on exported pools
ck153898
parents:
4577
diff
changeset
|
2989 |
|
789 | 2990 |
int |
2991 |
main(int argc, char **argv) |
|
2992 |
{ |
|
2993 |
int i, c; |
|
2994 |
struct rlimit rl = { 1024, 1024 }; |
|
10858
9efff268b959
6709782 issues using zdb with -e option
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10857
diff
changeset
|
2995 |
spa_t *spa = NULL; |
789 | 2996 |
objset_t *os = NULL; |
2997 |
int dump_all = 1; |
|
2998 |
int verbose = 0; |
|
11727
497d03ab2824
6900971 zdb rewind behavior needs to be revisited
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
11726
diff
changeset
|
2999 |
int error = 0; |
10858
9efff268b959
6709782 issues using zdb with -e option
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10857
diff
changeset
|
3000 |
char **searchdirs = NULL; |
9efff268b959
6709782 issues using zdb with -e option
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10857
diff
changeset
|
3001 |
int nsearch = 0; |
9efff268b959
6709782 issues using zdb with -e option
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10857
diff
changeset
|
3002 |
char *target; |
10921
8aac17999e4d
PSARC 2009/479 zpool recovery support
Tim Haley <Tim.Haley@Sun.COM>
parents:
10861
diff
changeset
|
3003 |
nvlist_t *policy = NULL; |
8aac17999e4d
PSARC 2009/479 zpool recovery support
Tim Haley <Tim.Haley@Sun.COM>
parents:
10861
diff
changeset
|
3004 |
uint64_t max_txg = UINT64_MAX; |
11727
497d03ab2824
6900971 zdb rewind behavior needs to be revisited
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
11726
diff
changeset
|
3005 |
int rewind = ZPOOL_NEVER_REWIND; |
789 | 3006 |
|
3007 |
(void) setrlimit(RLIMIT_NOFILE, &rl); |
|
1914
8a8c5f225b1b
4916205 libcmd should not use file operation routines from C library
casper
parents:
1807
diff
changeset
|
3008 |
(void) enable_extended_FILE_stdio(-1, -1); |
789 | 3009 |
|
3010 |
dprintf_setup(&argc, argv); |
|
3011 |
||
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12050
diff
changeset
|
3012 |
while ((c = getopt(argc, argv, "bcdhilmsuCDRSAFLXevp:t:U:P")) != -1) { |
789 | 3013 |
switch (c) { |
3014 |
case 'b': |
|
3015 |
case 'c': |
|
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
3016 |
case 'd': |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
3017 |
case 'h': |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
3018 |
case 'i': |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
3019 |
case 'l': |
9480
fcff33da767f
6596237 Stop looking and start ganging
George Wilson <George.Wilson@Sun.COM>
parents:
9463
diff
changeset
|
3020 |
case 'm': |
789 | 3021 |
case 's': |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
3022 |
case 'u': |
789 | 3023 |
case 'C': |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
3024 |
case 'D': |
1775
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1732
diff
changeset
|
3025 |
case 'R': |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
3026 |
case 'S': |
789 | 3027 |
dump_opt[c]++; |
3028 |
dump_all = 0; |
|
3029 |
break; |
|
11726
9686f6127423
6896791 want zdb option to set aok and zfs_recover
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
11725
diff
changeset
|
3030 |
case 'A': |
11727
497d03ab2824
6900971 zdb rewind behavior needs to be revisited
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
11726
diff
changeset
|
3031 |
case 'F': |
8121
7fd09d4ebd9c
6757430 want an option for zdb to disable space map loading and leak tracking
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
7837
diff
changeset
|
3032 |
case 'L': |
11727
497d03ab2824
6900971 zdb rewind behavior needs to be revisited
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
11726
diff
changeset
|
3033 |
case 'X': |
10858
9efff268b959
6709782 issues using zdb with -e option
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10857
diff
changeset
|
3034 |
case 'e': |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12050
diff
changeset
|
3035 |
case 'P': |
8121
7fd09d4ebd9c
6757430 want an option for zdb to disable space map loading and leak tracking
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
7837
diff
changeset
|
3036 |
dump_opt[c]++; |
7fd09d4ebd9c
6757430 want an option for zdb to disable space map loading and leak tracking
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
7837
diff
changeset
|
3037 |
break; |
789 | 3038 |
case 'v': |
3039 |
verbose++; |
|
3040 |
break; |
|
4627
c85631613c19
6509812 it would be useful if zdb(1M) could run on exported pools
ck153898
parents:
4577
diff
changeset
|
3041 |
case 'p': |
10858
9efff268b959
6709782 issues using zdb with -e option
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10857
diff
changeset
|
3042 |
if (searchdirs == NULL) { |
9efff268b959
6709782 issues using zdb with -e option
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10857
diff
changeset
|
3043 |
searchdirs = umem_alloc(sizeof (char *), |
9efff268b959
6709782 issues using zdb with -e option
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10857
diff
changeset
|
3044 |
UMEM_NOFAIL); |
9efff268b959
6709782 issues using zdb with -e option
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10857
diff
changeset
|
3045 |
} else { |
9efff268b959
6709782 issues using zdb with -e option
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10857
diff
changeset
|
3046 |
char **tmp = umem_alloc((nsearch + 1) * |
9efff268b959
6709782 issues using zdb with -e option
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10857
diff
changeset
|
3047 |
sizeof (char *), UMEM_NOFAIL); |
9efff268b959
6709782 issues using zdb with -e option
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10857
diff
changeset
|
3048 |
bcopy(searchdirs, tmp, nsearch * |
9efff268b959
6709782 issues using zdb with -e option
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10857
diff
changeset
|
3049 |
sizeof (char *)); |
9efff268b959
6709782 issues using zdb with -e option
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10857
diff
changeset
|
3050 |
umem_free(searchdirs, |
9efff268b959
6709782 issues using zdb with -e option
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10857
diff
changeset
|
3051 |
nsearch * sizeof (char *)); |
9efff268b959
6709782 issues using zdb with -e option
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10857
diff
changeset
|
3052 |
searchdirs = tmp; |
9efff268b959
6709782 issues using zdb with -e option
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10857
diff
changeset
|
3053 |
} |
9efff268b959
6709782 issues using zdb with -e option
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10857
diff
changeset
|
3054 |
searchdirs[nsearch++] = optarg; |
4627
c85631613c19
6509812 it would be useful if zdb(1M) could run on exported pools
ck153898
parents:
4577
diff
changeset
|
3055 |
break; |
8188
fd00c0a81e80
6761100 want zdb option to select older uberblocks
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
8121
diff
changeset
|
3056 |
case 't': |
10921
8aac17999e4d
PSARC 2009/479 zpool recovery support
Tim Haley <Tim.Haley@Sun.COM>
parents:
10861
diff
changeset
|
3057 |
max_txg = strtoull(optarg, NULL, 0); |
8aac17999e4d
PSARC 2009/479 zpool recovery support
Tim Haley <Tim.Haley@Sun.COM>
parents:
10861
diff
changeset
|
3058 |
if (max_txg < TXG_INITIAL) { |
8188
fd00c0a81e80
6761100 want zdb option to select older uberblocks
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
8121
diff
changeset
|
3059 |
(void) fprintf(stderr, "incorrect txg " |
fd00c0a81e80
6761100 want zdb option to select older uberblocks
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
8121
diff
changeset
|
3060 |
"specified: %s\n", optarg); |
fd00c0a81e80
6761100 want zdb option to select older uberblocks
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
8121
diff
changeset
|
3061 |
usage(); |
fd00c0a81e80
6761100 want zdb option to select older uberblocks
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
8121
diff
changeset
|
3062 |
} |
fd00c0a81e80
6761100 want zdb option to select older uberblocks
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
8121
diff
changeset
|
3063 |
break; |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
3064 |
case 'U': |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
3065 |
spa_config_path = optarg; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
3066 |
break; |
789 | 3067 |
default: |
3068 |
usage(); |
|
3069 |
break; |
|
3070 |
} |
|
3071 |
} |
|
3072 |
||
10858
9efff268b959
6709782 issues using zdb with -e option
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10857
diff
changeset
|
3073 |
if (!dump_opt['e'] && searchdirs != NULL) { |
7837
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
3074 |
(void) fprintf(stderr, "-p option requires use of -e\n"); |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
3075 |
usage(); |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
3076 |
} |
4627
c85631613c19
6509812 it would be useful if zdb(1M) could run on exported pools
ck153898
parents:
4577
diff
changeset
|
3077 |
|
789 | 3078 |
kernel_init(FREAD); |
4627
c85631613c19
6509812 it would be useful if zdb(1M) could run on exported pools
ck153898
parents:
4577
diff
changeset
|
3079 |
g_zfs = libzfs_init(); |
4787 | 3080 |
ASSERT(g_zfs != NULL); |
789 | 3081 |
|
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
3082 |
if (dump_all) |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
3083 |
verbose = MAX(verbose, 1); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
3084 |
|
789 | 3085 |
for (c = 0; c < 256; c++) { |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12050
diff
changeset
|
3086 |
if (dump_all && !strchr("elAFLRSXP", c)) |
789 | 3087 |
dump_opt[c] = 1; |
3088 |
if (dump_opt[c]) |
|
3089 |
dump_opt[c] += verbose; |
|
3090 |
} |
|
3091 |
||
11726
9686f6127423
6896791 want zdb option to set aok and zfs_recover
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
11725
diff
changeset
|
3092 |
aok = (dump_opt['A'] == 1) || (dump_opt['A'] > 2); |
9686f6127423
6896791 want zdb option to set aok and zfs_recover
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
11725
diff
changeset
|
3093 |
zfs_recover = (dump_opt['A'] > 1); |
9686f6127423
6896791 want zdb option to set aok and zfs_recover
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
11725
diff
changeset
|
3094 |
|
789 | 3095 |
argc -= optind; |
3096 |
argv += optind; |
|
3097 |
||
10860
f850bd358163
6736356 zdb -R/-C needs to work with exported pools
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10859
diff
changeset
|
3098 |
if (argc < 2 && dump_opt['R']) |
f850bd358163
6736356 zdb -R/-C needs to work with exported pools
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10859
diff
changeset
|
3099 |
usage(); |
789 | 3100 |
if (argc < 1) { |
10858
9efff268b959
6709782 issues using zdb with -e option
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10857
diff
changeset
|
3101 |
if (!dump_opt['e'] && dump_opt['C']) { |
6957
ad855bd47277
6689844 ztest fails with "zdb: can't open ztest: No such device or address"
ck153898
parents:
6807
diff
changeset
|
3102 |
dump_cachefile(spa_config_path); |
789 | 3103 |
return (0); |
3104 |
} |
|
3105 |
usage(); |
|
3106 |
} |
|
3107 |
||
3108 |
if (dump_opt['l']) { |
|
3109 |
dump_label(argv[0]); |
|
3110 |
return (0); |
|
3111 |
} |
|
3112 |
||
11727
497d03ab2824
6900971 zdb rewind behavior needs to be revisited
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
11726
diff
changeset
|
3113 |
if (dump_opt['X'] || dump_opt['F']) |
497d03ab2824
6900971 zdb rewind behavior needs to be revisited
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
11726
diff
changeset
|
3114 |
rewind = ZPOOL_DO_REWIND | |
497d03ab2824
6900971 zdb rewind behavior needs to be revisited
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
11726
diff
changeset
|
3115 |
(dump_opt['X'] ? ZPOOL_EXTREME_REWIND : 0); |
497d03ab2824
6900971 zdb rewind behavior needs to be revisited
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
11726
diff
changeset
|
3116 |
|
497d03ab2824
6900971 zdb rewind behavior needs to be revisited
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
11726
diff
changeset
|
3117 |
if (nvlist_alloc(&policy, NV_UNIQUE_NAME_TYPE, 0) != 0 || |
497d03ab2824
6900971 zdb rewind behavior needs to be revisited
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
11726
diff
changeset
|
3118 |
nvlist_add_uint64(policy, ZPOOL_REWIND_REQUEST_TXG, max_txg) != 0 || |
497d03ab2824
6900971 zdb rewind behavior needs to be revisited
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
11726
diff
changeset
|
3119 |
nvlist_add_uint32(policy, ZPOOL_REWIND_REQUEST, rewind) != 0) |
497d03ab2824
6900971 zdb rewind behavior needs to be revisited
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
11726
diff
changeset
|
3120 |
fatal("internal error: %s", strerror(ENOMEM)); |
497d03ab2824
6900971 zdb rewind behavior needs to be revisited
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
11726
diff
changeset
|
3121 |
|
6643
3a34b0dbb107
6625086 changing cachefile doesn't remove old cache on last user
eschrock
parents:
6423
diff
changeset
|
3122 |
error = 0; |
10858
9efff268b959
6709782 issues using zdb with -e option
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10857
diff
changeset
|
3123 |
target = argv[0]; |
4627
c85631613c19
6509812 it would be useful if zdb(1M) could run on exported pools
ck153898
parents:
4577
diff
changeset
|
3124 |
|
10858
9efff268b959
6709782 issues using zdb with -e option
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10857
diff
changeset
|
3125 |
if (dump_opt['e']) { |
9efff268b959
6709782 issues using zdb with -e option
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10857
diff
changeset
|
3126 |
nvlist_t *cfg = NULL; |
9efff268b959
6709782 issues using zdb with -e option
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10857
diff
changeset
|
3127 |
char *name = find_zpool(&target, &cfg, nsearch, searchdirs); |
5094 | 3128 |
|
10858
9efff268b959
6709782 issues using zdb with -e option
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10857
diff
changeset
|
3129 |
error = ENOENT; |
9efff268b959
6709782 issues using zdb with -e option
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10857
diff
changeset
|
3130 |
if (name) { |
10860
f850bd358163
6736356 zdb -R/-C needs to work with exported pools
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10859
diff
changeset
|
3131 |
if (dump_opt['C'] > 1) { |
f850bd358163
6736356 zdb -R/-C needs to work with exported pools
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10859
diff
changeset
|
3132 |
(void) printf("\nConfiguration for import:\n"); |
f850bd358163
6736356 zdb -R/-C needs to work with exported pools
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10859
diff
changeset
|
3133 |
dump_nvlist(cfg, 8); |
f850bd358163
6736356 zdb -R/-C needs to work with exported pools
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10859
diff
changeset
|
3134 |
} |
11727
497d03ab2824
6900971 zdb rewind behavior needs to be revisited
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
11726
diff
changeset
|
3135 |
if (nvlist_add_nvlist(cfg, |
10921
8aac17999e4d
PSARC 2009/479 zpool recovery support
Tim Haley <Tim.Haley@Sun.COM>
parents:
10861
diff
changeset
|
3136 |
ZPOOL_REWIND_POLICY, policy) != 0) { |
8aac17999e4d
PSARC 2009/479 zpool recovery support
Tim Haley <Tim.Haley@Sun.COM>
parents:
10861
diff
changeset
|
3137 |
fatal("can't open '%s': %s", |
8aac17999e4d
PSARC 2009/479 zpool recovery support
Tim Haley <Tim.Haley@Sun.COM>
parents:
10861
diff
changeset
|
3138 |
target, strerror(ENOMEM)); |
8aac17999e4d
PSARC 2009/479 zpool recovery support
Tim Haley <Tim.Haley@Sun.COM>
parents:
10861
diff
changeset
|
3139 |
} |
12961
b521d551715f
6733267 Allow a pool to be imported with a missing slog
George Wilson <George.Wilson@Sun.COM>
parents:
12684
diff
changeset
|
3140 |
if ((error = spa_import(name, cfg, NULL, |
b521d551715f
6733267 Allow a pool to be imported with a missing slog
George Wilson <George.Wilson@Sun.COM>
parents:
12684
diff
changeset
|
3141 |
ZFS_IMPORT_MISSING_LOG)) != 0) { |
b521d551715f
6733267 Allow a pool to be imported with a missing slog
George Wilson <George.Wilson@Sun.COM>
parents:
12684
diff
changeset
|
3142 |
error = spa_import(name, cfg, NULL, |
b521d551715f
6733267 Allow a pool to be imported with a missing slog
George Wilson <George.Wilson@Sun.COM>
parents:
12684
diff
changeset
|
3143 |
ZFS_IMPORT_VERBATIM); |
b521d551715f
6733267 Allow a pool to be imported with a missing slog
George Wilson <George.Wilson@Sun.COM>
parents:
12684
diff
changeset
|
3144 |
} |
4627
c85631613c19
6509812 it would be useful if zdb(1M) could run on exported pools
ck153898
parents:
4577
diff
changeset
|
3145 |
} |
6643
3a34b0dbb107
6625086 changing cachefile doesn't remove old cache on last user
eschrock
parents:
6423
diff
changeset
|
3146 |
} |
3a34b0dbb107
6625086 changing cachefile doesn't remove old cache on last user
eschrock
parents:
6423
diff
changeset
|
3147 |
|
3a34b0dbb107
6625086 changing cachefile doesn't remove old cache on last user
eschrock
parents:
6423
diff
changeset
|
3148 |
if (error == 0) { |
10860
f850bd358163
6736356 zdb -R/-C needs to work with exported pools
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10859
diff
changeset
|
3149 |
if (strpbrk(target, "/@") == NULL || dump_opt['R']) { |
11146
7e58f40bcb1c
6826241 Sync write IOPS drops dramatically during TXG sync
George Wilson <George.Wilson@Sun.COM>
parents:
11125
diff
changeset
|
3150 |
error = spa_open_rewind(target, &spa, FTAG, policy, |
7e58f40bcb1c
6826241 Sync write IOPS drops dramatically during TXG sync
George Wilson <George.Wilson@Sun.COM>
parents:
11125
diff
changeset
|
3151 |
NULL); |
10685
931790026ac6
6846163 ZFS continues to use faulted logzilla, bringing system to a crawl
George Wilson <George.Wilson@Sun.COM>
parents:
10594
diff
changeset
|
3152 |
if (error) { |
931790026ac6
6846163 ZFS continues to use faulted logzilla, bringing system to a crawl
George Wilson <George.Wilson@Sun.COM>
parents:
10594
diff
changeset
|
3153 |
/* |
931790026ac6
6846163 ZFS continues to use faulted logzilla, bringing system to a crawl
George Wilson <George.Wilson@Sun.COM>
parents:
10594
diff
changeset
|
3154 |
* If we're missing the log device then |
931790026ac6
6846163 ZFS continues to use faulted logzilla, bringing system to a crawl
George Wilson <George.Wilson@Sun.COM>
parents:
10594
diff
changeset
|
3155 |
* try opening the pool after clearing the |
931790026ac6
6846163 ZFS continues to use faulted logzilla, bringing system to a crawl
George Wilson <George.Wilson@Sun.COM>
parents:
10594
diff
changeset
|
3156 |
* log state. |
931790026ac6
6846163 ZFS continues to use faulted logzilla, bringing system to a crawl
George Wilson <George.Wilson@Sun.COM>
parents:
10594
diff
changeset
|
3157 |
*/ |
931790026ac6
6846163 ZFS continues to use faulted logzilla, bringing system to a crawl
George Wilson <George.Wilson@Sun.COM>
parents:
10594
diff
changeset
|
3158 |
mutex_enter(&spa_namespace_lock); |
10858
9efff268b959
6709782 issues using zdb with -e option
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10857
diff
changeset
|
3159 |
if ((spa = spa_lookup(target)) != NULL && |
10685
931790026ac6
6846163 ZFS continues to use faulted logzilla, bringing system to a crawl
George Wilson <George.Wilson@Sun.COM>
parents:
10594
diff
changeset
|
3160 |
spa->spa_log_state == SPA_LOG_MISSING) { |
931790026ac6
6846163 ZFS continues to use faulted logzilla, bringing system to a crawl
George Wilson <George.Wilson@Sun.COM>
parents:
10594
diff
changeset
|
3161 |
spa->spa_log_state = SPA_LOG_CLEAR; |
931790026ac6
6846163 ZFS continues to use faulted logzilla, bringing system to a crawl
George Wilson <George.Wilson@Sun.COM>
parents:
10594
diff
changeset
|
3162 |
error = 0; |
931790026ac6
6846163 ZFS continues to use faulted logzilla, bringing system to a crawl
George Wilson <George.Wilson@Sun.COM>
parents:
10594
diff
changeset
|
3163 |
} |
931790026ac6
6846163 ZFS continues to use faulted logzilla, bringing system to a crawl
George Wilson <George.Wilson@Sun.COM>
parents:
10594
diff
changeset
|
3164 |
mutex_exit(&spa_namespace_lock); |
931790026ac6
6846163 ZFS continues to use faulted logzilla, bringing system to a crawl
George Wilson <George.Wilson@Sun.COM>
parents:
10594
diff
changeset
|
3165 |
|
11146
7e58f40bcb1c
6826241 Sync write IOPS drops dramatically during TXG sync
George Wilson <George.Wilson@Sun.COM>
parents:
11125
diff
changeset
|
3166 |
if (!error) { |
7e58f40bcb1c
6826241 Sync write IOPS drops dramatically during TXG sync
George Wilson <George.Wilson@Sun.COM>
parents:
11125
diff
changeset
|
3167 |
error = spa_open_rewind(target, &spa, |
7e58f40bcb1c
6826241 Sync write IOPS drops dramatically during TXG sync
George Wilson <George.Wilson@Sun.COM>
parents:
11125
diff
changeset
|
3168 |
FTAG, policy, NULL); |
7e58f40bcb1c
6826241 Sync write IOPS drops dramatically during TXG sync
George Wilson <George.Wilson@Sun.COM>
parents:
11125
diff
changeset
|
3169 |
} |
10685
931790026ac6
6846163 ZFS continues to use faulted logzilla, bringing system to a crawl
George Wilson <George.Wilson@Sun.COM>
parents:
10594
diff
changeset
|
3170 |
} |
10860
f850bd358163
6736356 zdb -R/-C needs to work with exported pools
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10859
diff
changeset
|
3171 |
} else { |
f850bd358163
6736356 zdb -R/-C needs to work with exported pools
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10859
diff
changeset
|
3172 |
error = dmu_objset_own(target, DMU_OST_ANY, |
f850bd358163
6736356 zdb -R/-C needs to work with exported pools
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10859
diff
changeset
|
3173 |
B_TRUE, FTAG, &os); |
6643
3a34b0dbb107
6625086 changing cachefile doesn't remove old cache on last user
eschrock
parents:
6423
diff
changeset
|
3174 |
} |
789 | 3175 |
} |
11146
7e58f40bcb1c
6826241 Sync write IOPS drops dramatically during TXG sync
George Wilson <George.Wilson@Sun.COM>
parents:
11125
diff
changeset
|
3176 |
nvlist_free(policy); |
7e58f40bcb1c
6826241 Sync write IOPS drops dramatically during TXG sync
George Wilson <George.Wilson@Sun.COM>
parents:
11125
diff
changeset
|
3177 |
|
789 | 3178 |
if (error) |
10858
9efff268b959
6709782 issues using zdb with -e option
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10857
diff
changeset
|
3179 |
fatal("can't open '%s': %s", target, strerror(error)); |
789 | 3180 |
|
3181 |
argv++; |
|
10860
f850bd358163
6736356 zdb -R/-C needs to work with exported pools
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10859
diff
changeset
|
3182 |
argc--; |
f850bd358163
6736356 zdb -R/-C needs to work with exported pools
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10859
diff
changeset
|
3183 |
if (!dump_opt['R']) { |
f850bd358163
6736356 zdb -R/-C needs to work with exported pools
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10859
diff
changeset
|
3184 |
if (argc > 0) { |
f850bd358163
6736356 zdb -R/-C needs to work with exported pools
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10859
diff
changeset
|
3185 |
zopt_objects = argc; |
f850bd358163
6736356 zdb -R/-C needs to work with exported pools
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10859
diff
changeset
|
3186 |
zopt_object = calloc(zopt_objects, sizeof (uint64_t)); |
f850bd358163
6736356 zdb -R/-C needs to work with exported pools
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10859
diff
changeset
|
3187 |
for (i = 0; i < zopt_objects; i++) { |
f850bd358163
6736356 zdb -R/-C needs to work with exported pools
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10859
diff
changeset
|
3188 |
errno = 0; |
f850bd358163
6736356 zdb -R/-C needs to work with exported pools
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10859
diff
changeset
|
3189 |
zopt_object[i] = strtoull(argv[i], NULL, 0); |
f850bd358163
6736356 zdb -R/-C needs to work with exported pools
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10859
diff
changeset
|
3190 |
if (zopt_object[i] == 0 && errno != 0) |
10861
ae18f8a4df85
6887242 want to be able to dump specific metaslab(s) for specific vdev
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10860
diff
changeset
|
3191 |
fatal("bad number %s: %s", |
10860
f850bd358163
6736356 zdb -R/-C needs to work with exported pools
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10859
diff
changeset
|
3192 |
argv[i], strerror(errno)); |
f850bd358163
6736356 zdb -R/-C needs to work with exported pools
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10859
diff
changeset
|
3193 |
} |
789 | 3194 |
} |
10860
f850bd358163
6736356 zdb -R/-C needs to work with exported pools
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10859
diff
changeset
|
3195 |
(os != NULL) ? dump_dir(os) : dump_zpool(spa); |
f850bd358163
6736356 zdb -R/-C needs to work with exported pools
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10859
diff
changeset
|
3196 |
} else { |
f850bd358163
6736356 zdb -R/-C needs to work with exported pools
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10859
diff
changeset
|
3197 |
flagbits['b'] = ZDB_FLAG_PRINT_BLKPTR; |
f850bd358163
6736356 zdb -R/-C needs to work with exported pools
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10859
diff
changeset
|
3198 |
flagbits['c'] = ZDB_FLAG_CHECKSUM; |
f850bd358163
6736356 zdb -R/-C needs to work with exported pools
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10859
diff
changeset
|
3199 |
flagbits['d'] = ZDB_FLAG_DECOMPRESS; |
f850bd358163
6736356 zdb -R/-C needs to work with exported pools
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10859
diff
changeset
|
3200 |
flagbits['e'] = ZDB_FLAG_BSWAP; |
f850bd358163
6736356 zdb -R/-C needs to work with exported pools
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10859
diff
changeset
|
3201 |
flagbits['g'] = ZDB_FLAG_GBH; |
f850bd358163
6736356 zdb -R/-C needs to work with exported pools
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10859
diff
changeset
|
3202 |
flagbits['i'] = ZDB_FLAG_INDIRECT; |
f850bd358163
6736356 zdb -R/-C needs to work with exported pools
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10859
diff
changeset
|
3203 |
flagbits['p'] = ZDB_FLAG_PHYS; |
f850bd358163
6736356 zdb -R/-C needs to work with exported pools
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10859
diff
changeset
|
3204 |
flagbits['r'] = ZDB_FLAG_RAW; |
f850bd358163
6736356 zdb -R/-C needs to work with exported pools
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10859
diff
changeset
|
3205 |
|
f850bd358163
6736356 zdb -R/-C needs to work with exported pools
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10859
diff
changeset
|
3206 |
for (i = 0; i < argc; i++) |
f850bd358163
6736356 zdb -R/-C needs to work with exported pools
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10859
diff
changeset
|
3207 |
zdb_read_block(argv[i], spa); |
789 | 3208 |
} |
3209 |
||
10860
f850bd358163
6736356 zdb -R/-C needs to work with exported pools
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10859
diff
changeset
|
3210 |
(os != NULL) ? dmu_objset_disown(os, FTAG) : spa_close(spa, FTAG); |
789 | 3211 |
|
5959
1e1904b8526d
6650192 zfs ACL/fuid code could use some minor cleanup
marks
parents:
5530
diff
changeset
|
3212 |
fuid_table_destroy(); |
11935
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11826
diff
changeset
|
3213 |
sa_loaded = B_FALSE; |
5959
1e1904b8526d
6650192 zfs ACL/fuid code could use some minor cleanup
marks
parents:
5530
diff
changeset
|
3214 |
|
4627
c85631613c19
6509812 it would be useful if zdb(1M) could run on exported pools
ck153898
parents:
4577
diff
changeset
|
3215 |
libzfs_fini(g_zfs); |
789 | 3216 |
kernel_fini(); |
3217 |
||
3218 |
return (0); |
|
3219 |
} |