7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22 /*
23 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
24 * Copyright (c) 2011, 2016 by Delphix. All rights reserved.
25 * Copyright (c) 2014 Integros [integros.com]
26 * Copyright 2017 Nexenta Systems, Inc.
27 */
28
29 #include <stdio.h>
30 #include <unistd.h>
31 #include <stdio_ext.h>
32 #include <stdlib.h>
33 #include <ctype.h>
34 #include <sys/zfs_context.h>
35 #include <sys/spa.h>
36 #include <sys/spa_impl.h>
37 #include <sys/dmu.h>
38 #include <sys/zap.h>
39 #include <sys/fs/zfs.h>
40 #include <sys/zfs_znode.h>
41 #include <sys/zfs_sa.h>
42 #include <sys/sa.h>
43 #include <sys/sa_impl.h>
44 #include <sys/vdev.h>
45 #include <sys/vdev_impl.h>
46 #include <sys/metaslab_impl.h>
77 dmu_ot[(idx)].ot_name : DMU_OT_IS_VALID(idx) ? \
78 dmu_ot_byteswap[DMU_OT_BYTESWAP(idx)].ob_name : "UNKNOWN")
79 #define ZDB_OT_TYPE(idx) ((idx) < DMU_OT_NUMTYPES ? (idx) : \
80 (((idx) == DMU_OTN_ZAP_DATA || (idx) == DMU_OTN_ZAP_METADATA) ? \
81 DMU_OT_ZAP_OTHER : DMU_OT_NUMTYPES))
82
83 #ifndef lint
84 extern int reference_tracking_enable;
85 extern boolean_t zfs_recover;
86 extern uint64_t zfs_arc_max, zfs_arc_meta_limit;
87 extern int zfs_vdev_async_read_max_active;
88 #else
89 int reference_tracking_enable;
90 boolean_t zfs_recover;
91 uint64_t zfs_arc_max, zfs_arc_meta_limit;
92 int zfs_vdev_async_read_max_active;
93 #endif
94
95 static const char cmdname[] = "zdb";
96 uint8_t dump_opt[256];
97
98 typedef void object_viewer_t(objset_t *, uint64_t, void *data, size_t size);
99
100 uint64_t *zopt_object = NULL;
101 static unsigned zopt_objects = 0;
102 libzfs_handle_t *g_zfs;
103 uint64_t max_inflight = 1000;
104
105 static void snprintf_blkptr_compact(char *, size_t, const blkptr_t *);
106
107 /*
108 * These libumem hooks provide a reasonable set of defaults for the allocator's
109 * debugging facilities.
110 */
111 const char *
112 _umem_debug_init()
113 {
114 return ("default,verbose"); /* $UMEM_DEBUG setting */
115 }
116
|
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22 /*
23 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
24 * Copyright (c) 2011, 2016 by Delphix. All rights reserved.
25 * Copyright (c) 2014 Integros [integros.com]
26 * Copyright 2017 Nexenta Systems, Inc.
27 * Copyright 2017 RackTop Systems.
28 */
29
30 #include <stdio.h>
31 #include <unistd.h>
32 #include <stdio_ext.h>
33 #include <stdlib.h>
34 #include <ctype.h>
35 #include <sys/zfs_context.h>
36 #include <sys/spa.h>
37 #include <sys/spa_impl.h>
38 #include <sys/dmu.h>
39 #include <sys/zap.h>
40 #include <sys/fs/zfs.h>
41 #include <sys/zfs_znode.h>
42 #include <sys/zfs_sa.h>
43 #include <sys/sa.h>
44 #include <sys/sa_impl.h>
45 #include <sys/vdev.h>
46 #include <sys/vdev_impl.h>
47 #include <sys/metaslab_impl.h>
78 dmu_ot[(idx)].ot_name : DMU_OT_IS_VALID(idx) ? \
79 dmu_ot_byteswap[DMU_OT_BYTESWAP(idx)].ob_name : "UNKNOWN")
80 #define ZDB_OT_TYPE(idx) ((idx) < DMU_OT_NUMTYPES ? (idx) : \
81 (((idx) == DMU_OTN_ZAP_DATA || (idx) == DMU_OTN_ZAP_METADATA) ? \
82 DMU_OT_ZAP_OTHER : DMU_OT_NUMTYPES))
83
84 #ifndef lint
85 extern int reference_tracking_enable;
86 extern boolean_t zfs_recover;
87 extern uint64_t zfs_arc_max, zfs_arc_meta_limit;
88 extern int zfs_vdev_async_read_max_active;
89 #else
90 int reference_tracking_enable;
91 boolean_t zfs_recover;
92 uint64_t zfs_arc_max, zfs_arc_meta_limit;
93 int zfs_vdev_async_read_max_active;
94 #endif
95
96 static const char cmdname[] = "zdb";
97 uint8_t dump_opt[256];
98 extern int aok;
99
100 typedef void object_viewer_t(objset_t *, uint64_t, void *data, size_t size);
101
102 uint64_t *zopt_object = NULL;
103 static unsigned zopt_objects = 0;
104 libzfs_handle_t *g_zfs;
105 uint64_t max_inflight = 1000;
106
107 static void snprintf_blkptr_compact(char *, size_t, const blkptr_t *);
108
109 /*
110 * These libumem hooks provide a reasonable set of defaults for the allocator's
111 * debugging facilities.
112 */
113 const char *
114 _umem_debug_init()
115 {
116 return ("default,verbose"); /* $UMEM_DEBUG setting */
117 }
118
|