Print this page
3956 ::vdev -r should work with pipelines
3957 ztest should update the cachefile before killing itself
3958 multiple scans can lead to partial resilvering
3959 ddt entries are not always resilvered
3960 dsl_scan can skip over dedup-ed blocks if physical birth != logical birth
3961 freed gang blocks are not resilvered and can cause pool to suspend
3962 ztest should print out zfs debug buffer before exiting
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Adam Leventhal <ahl@delphix.com>
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/uts/common/fs/zfs/zfs_debug.c
+++ new/usr/src/uts/common/fs/zfs/zfs_debug.c
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
↓ open down ↓ |
12 lines elided |
↑ open up ↑ |
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21 /*
22 22 * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
23 - * Copyright (c) 2012 by Delphix. All rights reserved.
23 + * Copyright (c) 2013 by Delphix. All rights reserved.
24 24 */
25 25
26 26 #include <sys/zfs_context.h>
27 27
28 28 list_t zfs_dbgmsgs;
29 29 int zfs_dbgmsg_size;
30 30 kmutex_t zfs_dbgmsgs_lock;
31 31 int zfs_dbgmsg_maxsize = 1<<20; /* 1MB */
32 32
33 33 void
34 34 zfs_dbgmsg_init(void)
35 35 {
36 36 list_create(&zfs_dbgmsgs, sizeof (zfs_dbgmsg_t),
37 37 offsetof(zfs_dbgmsg_t, zdm_node));
38 38 mutex_init(&zfs_dbgmsgs_lock, NULL, MUTEX_DEFAULT, NULL);
39 39 }
40 40
41 41 void
42 42 zfs_dbgmsg_fini(void)
43 43 {
44 44 zfs_dbgmsg_t *zdm;
45 45
46 46 while ((zdm = list_remove_head(&zfs_dbgmsgs)) != NULL) {
47 47 int size = sizeof (zfs_dbgmsg_t) + strlen(zdm->zdm_msg);
48 48 kmem_free(zdm, size);
49 49 zfs_dbgmsg_size -= size;
50 50 }
51 51 mutex_destroy(&zfs_dbgmsgs_lock);
52 52 ASSERT0(zfs_dbgmsg_size);
53 53 }
54 54
55 55 /*
56 56 * Print these messages by running:
57 57 * echo ::zfs_dbgmsg | mdb -k
58 58 *
59 59 * Monitor these messages by running:
60 60 * dtrace -q -n 'zfs-dbgmsg{printf("%s\n", stringof(arg0))}'
61 61 */
62 62 void
63 63 zfs_dbgmsg(const char *fmt, ...)
64 64 {
65 65 int size;
66 66 va_list adx;
67 67 zfs_dbgmsg_t *zdm;
68 68
69 69 va_start(adx, fmt);
70 70 size = vsnprintf(NULL, 0, fmt, adx);
71 71 va_end(adx);
72 72
73 73 /*
74 74 * There is one byte of string in sizeof (zfs_dbgmsg_t), used
75 75 * for the terminating null.
76 76 */
77 77 zdm = kmem_alloc(sizeof (zfs_dbgmsg_t) + size, KM_SLEEP);
78 78 zdm->zdm_timestamp = gethrestime_sec();
79 79
80 80 va_start(adx, fmt);
81 81 (void) vsnprintf(zdm->zdm_msg, size + 1, fmt, adx);
82 82 va_end(adx);
83 83
84 84 DTRACE_PROBE1(zfs__dbgmsg, char *, zdm->zdm_msg);
85 85
86 86 mutex_enter(&zfs_dbgmsgs_lock);
↓ open down ↓ |
53 lines elided |
↑ open up ↑ |
87 87 list_insert_tail(&zfs_dbgmsgs, zdm);
88 88 zfs_dbgmsg_size += sizeof (zfs_dbgmsg_t) + size;
89 89 while (zfs_dbgmsg_size > zfs_dbgmsg_maxsize) {
90 90 zdm = list_remove_head(&zfs_dbgmsgs);
91 91 size = sizeof (zfs_dbgmsg_t) + strlen(zdm->zdm_msg);
92 92 kmem_free(zdm, size);
93 93 zfs_dbgmsg_size -= size;
94 94 }
95 95 mutex_exit(&zfs_dbgmsgs_lock);
96 96 }
97 +
98 +void
99 +zfs_dbgmsg_print(const char *tag)
100 +{
101 + zfs_dbgmsg_t *zdm;
102 +
103 + (void) printf("ZFS_DBGMSG(%s):\n", tag);
104 + mutex_enter(&zfs_dbgmsgs_lock);
105 + for (zdm = list_head(&zfs_dbgmsgs); zdm;
106 + zdm = list_next(&zfs_dbgmsgs, zdm))
107 + (void) printf("%s\n", zdm->zdm_msg);
108 + mutex_exit(&zfs_dbgmsgs_lock);
109 +}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX