xref: /titanic_51/usr/src/cmd/zdb/zdb_il.c (revision 7802d7bf98dec568dadf72286893b1fe5abd8602)
1fa9e4066Sahrens /*
2fa9e4066Sahrens  * CDDL HEADER START
3fa9e4066Sahrens  *
4fa9e4066Sahrens  * The contents of this file are subject to the terms of the
5ea8dc4b6Seschrock  * Common Development and Distribution License (the "License").
6ea8dc4b6Seschrock  * You may not use this file except in compliance with the License.
7fa9e4066Sahrens  *
8fa9e4066Sahrens  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9fa9e4066Sahrens  * or http://www.opensolaris.org/os/licensing.
10fa9e4066Sahrens  * See the License for the specific language governing permissions
11fa9e4066Sahrens  * and limitations under the License.
12fa9e4066Sahrens  *
13fa9e4066Sahrens  * When distributing Covered Code, include this CDDL HEADER in each
14fa9e4066Sahrens  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15fa9e4066Sahrens  * If applicable, add the following below this CDDL HEADER, with the
16fa9e4066Sahrens  * fields enclosed by brackets "[]" replaced with your own identifying
17fa9e4066Sahrens  * information: Portions Copyright [yyyy] [name of copyright owner]
18fa9e4066Sahrens  *
19fa9e4066Sahrens  * CDDL HEADER END
20fa9e4066Sahrens  */
21fa9e4066Sahrens /*
223589c4f0SNeil Perrin  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
23fa9e4066Sahrens  * Use is subject to license terms.
24fa9e4066Sahrens  */
25fa9e4066Sahrens 
26fa9e4066Sahrens /*
27*7802d7bfSMatthew Ahrens  * Copyright (c) 2013, 2014 by Delphix. All rights reserved.
2843466aaeSMax Grossman  */
2943466aaeSMax Grossman 
3043466aaeSMax Grossman /*
31fa9e4066Sahrens  * Print intent log header and statistics.
32fa9e4066Sahrens  */
33fa9e4066Sahrens 
34fa9e4066Sahrens #include <stdio.h>
35fa9e4066Sahrens #include <stdlib.h>
36fa9e4066Sahrens #include <ctype.h>
37fa9e4066Sahrens #include <sys/zfs_context.h>
38fa9e4066Sahrens #include <sys/spa.h>
39fa9e4066Sahrens #include <sys/dmu.h>
40fa9e4066Sahrens #include <sys/stat.h>
41fa9e4066Sahrens #include <sys/resource.h>
42fa9e4066Sahrens #include <sys/zil.h>
43fa9e4066Sahrens #include <sys/zil_impl.h>
44fa9e4066Sahrens 
45fa9e4066Sahrens extern uint8_t dump_opt[256];
46fa9e4066Sahrens 
47b24ab676SJeff Bonwick static char prefix[4] = "\t\t\t";
48b24ab676SJeff Bonwick 
49fa9e4066Sahrens static void
50d80c45e0Sbonwick print_log_bp(const blkptr_t *bp, const char *prefix)
51fa9e4066Sahrens {
52fbabab8fSmaybee 	char blkbuf[BP_SPRINTF_LEN];
53fa9e4066Sahrens 
5443466aaeSMax Grossman 	snprintf_blkptr(blkbuf, sizeof (blkbuf), bp);
55fa9e4066Sahrens 	(void) printf("%s%s\n", prefix, blkbuf);
56fa9e4066Sahrens }
57fa9e4066Sahrens 
58fa9e4066Sahrens /* ARGSUSED */
59fa9e4066Sahrens static void
60fa9e4066Sahrens zil_prt_rec_create(zilog_t *zilog, int txtype, lr_create_t *lr)
61fa9e4066Sahrens {
62fa9e4066Sahrens 	time_t crtime = lr->lr_crtime[0];
63faaa6415SEric Schrock 	char *name, *link;
64faaa6415SEric Schrock 	lr_attr_t *lrattr;
65fa9e4066Sahrens 
66faaa6415SEric Schrock 	name = (char *)(lr + 1);
67faaa6415SEric Schrock 
68faaa6415SEric Schrock 	if (lr->lr_common.lrc_txtype == TX_CREATE_ATTR ||
69faaa6415SEric Schrock 	    lr->lr_common.lrc_txtype == TX_MKDIR_ATTR) {
70faaa6415SEric Schrock 		lrattr = (lr_attr_t *)(lr + 1);
71faaa6415SEric Schrock 		name += ZIL_XVAT_SIZE(lrattr->lr_attr_masksize);
72faaa6415SEric Schrock 	}
73faaa6415SEric Schrock 
74faaa6415SEric Schrock 	if (txtype == TX_SYMLINK) {
75faaa6415SEric Schrock 		link = name + strlen(name) + 1;
76b24ab676SJeff Bonwick 		(void) printf("%s%s -> %s\n", prefix, name, link);
77faaa6415SEric Schrock 	} else if (txtype != TX_MKXATTR) {
78b24ab676SJeff Bonwick 		(void) printf("%s%s\n", prefix, name);
79faaa6415SEric Schrock 	}
80fa9e4066Sahrens 
81b24ab676SJeff Bonwick 	(void) printf("%s%s", prefix, ctime(&crtime));
82b24ab676SJeff Bonwick 	(void) printf("%sdoid %llu, foid %llu, mode %llo\n", prefix,
83fa9e4066Sahrens 	    (u_longlong_t)lr->lr_doid, (u_longlong_t)lr->lr_foid,
84fa9e4066Sahrens 	    (longlong_t)lr->lr_mode);
85b24ab676SJeff Bonwick 	(void) printf("%suid %llu, gid %llu, gen %llu, rdev 0x%llx\n", prefix,
86fa9e4066Sahrens 	    (u_longlong_t)lr->lr_uid, (u_longlong_t)lr->lr_gid,
87fa9e4066Sahrens 	    (u_longlong_t)lr->lr_gen, (u_longlong_t)lr->lr_rdev);
88fa9e4066Sahrens }
89fa9e4066Sahrens 
90fa9e4066Sahrens /* ARGSUSED */
91fa9e4066Sahrens static void
92fa9e4066Sahrens zil_prt_rec_remove(zilog_t *zilog, int txtype, lr_remove_t *lr)
93fa9e4066Sahrens {
94b24ab676SJeff Bonwick 	(void) printf("%sdoid %llu, name %s\n", prefix,
95fa9e4066Sahrens 	    (u_longlong_t)lr->lr_doid, (char *)(lr + 1));
96fa9e4066Sahrens }
97fa9e4066Sahrens 
98fa9e4066Sahrens /* ARGSUSED */
99fa9e4066Sahrens static void
100fa9e4066Sahrens zil_prt_rec_link(zilog_t *zilog, int txtype, lr_link_t *lr)
101fa9e4066Sahrens {
102b24ab676SJeff Bonwick 	(void) printf("%sdoid %llu, link_obj %llu, name %s\n", prefix,
103fa9e4066Sahrens 	    (u_longlong_t)lr->lr_doid, (u_longlong_t)lr->lr_link_obj,
104fa9e4066Sahrens 	    (char *)(lr + 1));
105fa9e4066Sahrens }
106fa9e4066Sahrens 
107fa9e4066Sahrens /* ARGSUSED */
108fa9e4066Sahrens static void
109fa9e4066Sahrens zil_prt_rec_rename(zilog_t *zilog, int txtype, lr_rename_t *lr)
110fa9e4066Sahrens {
111fa9e4066Sahrens 	char *snm = (char *)(lr + 1);
112fa9e4066Sahrens 	char *tnm = snm + strlen(snm) + 1;
113fa9e4066Sahrens 
114b24ab676SJeff Bonwick 	(void) printf("%ssdoid %llu, tdoid %llu\n", prefix,
115fa9e4066Sahrens 	    (u_longlong_t)lr->lr_sdoid, (u_longlong_t)lr->lr_tdoid);
116b24ab676SJeff Bonwick 	(void) printf("%ssrc %s tgt %s\n", prefix, snm, tnm);
117fa9e4066Sahrens }
118fa9e4066Sahrens 
119fa9e4066Sahrens /* ARGSUSED */
120fa9e4066Sahrens static void
121fa9e4066Sahrens zil_prt_rec_write(zilog_t *zilog, int txtype, lr_write_t *lr)
122fa9e4066Sahrens {
123fa9e4066Sahrens 	char *data, *dlimit;
124fa9e4066Sahrens 	blkptr_t *bp = &lr->lr_blkptr;
125*7802d7bfSMatthew Ahrens 	zbookmark_phys_t zb;
126fa9e4066Sahrens 	char buf[SPA_MAXBLOCKSIZE];
127fa9e4066Sahrens 	int verbose = MAX(dump_opt['d'], dump_opt['i']);
128fa9e4066Sahrens 	int error;
129fa9e4066Sahrens 
130b24ab676SJeff Bonwick 	(void) printf("%sfoid %llu, offset %llx, length %llx\n", prefix,
131b24ab676SJeff Bonwick 	    (u_longlong_t)lr->lr_foid, (u_longlong_t)lr->lr_offset,
132b24ab676SJeff Bonwick 	    (u_longlong_t)lr->lr_length);
133fa9e4066Sahrens 
134975c32a0SNeil Perrin 	if (txtype == TX_WRITE2 || verbose < 5)
135fa9e4066Sahrens 		return;
136fa9e4066Sahrens 
137fa9e4066Sahrens 	if (lr->lr_common.lrc_reclen == sizeof (lr_write_t)) {
138b24ab676SJeff Bonwick 		(void) printf("%shas blkptr, %s\n", prefix,
13943466aaeSMax Grossman 		    !BP_IS_HOLE(bp) &&
140fa9e4066Sahrens 		    bp->blk_birth >= spa_first_txg(zilog->zl_spa) ?
141fa9e4066Sahrens 		    "will claim" : "won't claim");
142b24ab676SJeff Bonwick 		print_log_bp(bp, prefix);
143b24ab676SJeff Bonwick 
144975c32a0SNeil Perrin 		if (BP_IS_HOLE(bp)) {
145975c32a0SNeil Perrin 			(void) printf("\t\t\tLSIZE 0x%llx\n",
146975c32a0SNeil Perrin 			    (u_longlong_t)BP_GET_LSIZE(bp));
147fa9e4066Sahrens 			bzero(buf, sizeof (buf));
148b24ab676SJeff Bonwick 			(void) printf("%s<hole>\n", prefix);
149b24ab676SJeff Bonwick 			return;
150b24ab676SJeff Bonwick 		}
151b24ab676SJeff Bonwick 		if (bp->blk_birth < zilog->zl_header->zh_claim_txg) {
152b24ab676SJeff Bonwick 			(void) printf("%s<block already committed>\n", prefix);
153b24ab676SJeff Bonwick 			return;
154b24ab676SJeff Bonwick 		}
155ea8dc4b6Seschrock 
156b24ab676SJeff Bonwick 		SET_BOOKMARK(&zb, dmu_objset_id(zilog->zl_os),
157b24ab676SJeff Bonwick 		    lr->lr_foid, ZB_ZIL_LEVEL,
158b24ab676SJeff Bonwick 		    lr->lr_offset / BP_GET_LSIZE(bp));
159ea8dc4b6Seschrock 
160fa9e4066Sahrens 		error = zio_wait(zio_read(NULL, zilog->zl_spa,
161fa9e4066Sahrens 		    bp, buf, BP_GET_LSIZE(bp), NULL, NULL,
162ea8dc4b6Seschrock 		    ZIO_PRIORITY_SYNC_READ, ZIO_FLAG_CANFAIL, &zb));
163fa9e4066Sahrens 		if (error)
164fa9e4066Sahrens 			return;
165b24ab676SJeff Bonwick 		data = buf;
166fa9e4066Sahrens 	} else {
167fa9e4066Sahrens 		data = (char *)(lr + 1);
168fa9e4066Sahrens 	}
169fa9e4066Sahrens 
170fa9e4066Sahrens 	dlimit = data + MIN(lr->lr_length,
171fa9e4066Sahrens 	    (verbose < 6 ? 20 : SPA_MAXBLOCKSIZE));
172fa9e4066Sahrens 
173b24ab676SJeff Bonwick 	(void) printf("%s", prefix);
174fa9e4066Sahrens 	while (data < dlimit) {
175fa9e4066Sahrens 		if (isprint(*data))
176fa9e4066Sahrens 			(void) printf("%c ", *data);
177fa9e4066Sahrens 		else
178fa9e4066Sahrens 			(void) printf("%2X", *data);
179fa9e4066Sahrens 		data++;
180fa9e4066Sahrens 	}
181fa9e4066Sahrens 	(void) printf("\n");
182fa9e4066Sahrens }
183fa9e4066Sahrens 
184fa9e4066Sahrens /* ARGSUSED */
185fa9e4066Sahrens static void
186fa9e4066Sahrens zil_prt_rec_truncate(zilog_t *zilog, int txtype, lr_truncate_t *lr)
187fa9e4066Sahrens {
188b24ab676SJeff Bonwick 	(void) printf("%sfoid %llu, offset 0x%llx, length 0x%llx\n", prefix,
189fa9e4066Sahrens 	    (u_longlong_t)lr->lr_foid, (longlong_t)lr->lr_offset,
190fa9e4066Sahrens 	    (u_longlong_t)lr->lr_length);
191fa9e4066Sahrens }
192fa9e4066Sahrens 
193fa9e4066Sahrens /* ARGSUSED */
194fa9e4066Sahrens static void
195fa9e4066Sahrens zil_prt_rec_setattr(zilog_t *zilog, int txtype, lr_setattr_t *lr)
196fa9e4066Sahrens {
197fa9e4066Sahrens 	time_t atime = (time_t)lr->lr_atime[0];
198fa9e4066Sahrens 	time_t mtime = (time_t)lr->lr_mtime[0];
199fa9e4066Sahrens 
200b24ab676SJeff Bonwick 	(void) printf("%sfoid %llu, mask 0x%llx\n", prefix,
201fa9e4066Sahrens 	    (u_longlong_t)lr->lr_foid, (u_longlong_t)lr->lr_mask);
202fa9e4066Sahrens 
203fa9e4066Sahrens 	if (lr->lr_mask & AT_MODE) {
204b24ab676SJeff Bonwick 		(void) printf("%sAT_MODE  %llo\n", prefix,
205fa9e4066Sahrens 		    (longlong_t)lr->lr_mode);
206fa9e4066Sahrens 	}
207fa9e4066Sahrens 
208fa9e4066Sahrens 	if (lr->lr_mask & AT_UID) {
209b24ab676SJeff Bonwick 		(void) printf("%sAT_UID   %llu\n", prefix,
210fa9e4066Sahrens 		    (u_longlong_t)lr->lr_uid);
211fa9e4066Sahrens 	}
212fa9e4066Sahrens 
213fa9e4066Sahrens 	if (lr->lr_mask & AT_GID) {
214b24ab676SJeff Bonwick 		(void) printf("%sAT_GID   %llu\n", prefix,
215fa9e4066Sahrens 		    (u_longlong_t)lr->lr_gid);
216fa9e4066Sahrens 	}
217fa9e4066Sahrens 
218fa9e4066Sahrens 	if (lr->lr_mask & AT_SIZE) {
219b24ab676SJeff Bonwick 		(void) printf("%sAT_SIZE  %llu\n", prefix,
220fa9e4066Sahrens 		    (u_longlong_t)lr->lr_size);
221fa9e4066Sahrens 	}
222fa9e4066Sahrens 
223fa9e4066Sahrens 	if (lr->lr_mask & AT_ATIME) {
224b24ab676SJeff Bonwick 		(void) printf("%sAT_ATIME %llu.%09llu %s", prefix,
225fa9e4066Sahrens 		    (u_longlong_t)lr->lr_atime[0],
226fa9e4066Sahrens 		    (u_longlong_t)lr->lr_atime[1],
227fa9e4066Sahrens 		    ctime(&atime));
228fa9e4066Sahrens 	}
229fa9e4066Sahrens 
230fa9e4066Sahrens 	if (lr->lr_mask & AT_MTIME) {
231b24ab676SJeff Bonwick 		(void) printf("%sAT_MTIME %llu.%09llu %s", prefix,
232fa9e4066Sahrens 		    (u_longlong_t)lr->lr_mtime[0],
233fa9e4066Sahrens 		    (u_longlong_t)lr->lr_mtime[1],
234fa9e4066Sahrens 		    ctime(&mtime));
235fa9e4066Sahrens 	}
236fa9e4066Sahrens }
237fa9e4066Sahrens 
238fa9e4066Sahrens /* ARGSUSED */
239fa9e4066Sahrens static void
240fa9e4066Sahrens zil_prt_rec_acl(zilog_t *zilog, int txtype, lr_acl_t *lr)
241fa9e4066Sahrens {
242b24ab676SJeff Bonwick 	(void) printf("%sfoid %llu, aclcnt %llu\n", prefix,
243fa9e4066Sahrens 	    (u_longlong_t)lr->lr_foid, (u_longlong_t)lr->lr_aclcnt);
244fa9e4066Sahrens }
245fa9e4066Sahrens 
246fa9e4066Sahrens typedef void (*zil_prt_rec_func_t)();
247fa9e4066Sahrens typedef struct zil_rec_info {
248fa9e4066Sahrens 	zil_prt_rec_func_t	zri_print;
249fa9e4066Sahrens 	char			*zri_name;
250fa9e4066Sahrens 	uint64_t		zri_count;
251fa9e4066Sahrens } zil_rec_info_t;
252fa9e4066Sahrens 
253fa9e4066Sahrens static zil_rec_info_t zil_rec_info[TX_MAX_TYPE] = {
254fa9e4066Sahrens 	{	NULL,			"Total              " },
255fa9e4066Sahrens 	{	zil_prt_rec_create,	"TX_CREATE          " },
256fa9e4066Sahrens 	{	zil_prt_rec_create,	"TX_MKDIR           " },
257fa9e4066Sahrens 	{	zil_prt_rec_create,	"TX_MKXATTR         " },
258fa9e4066Sahrens 	{	zil_prt_rec_create,	"TX_SYMLINK         " },
259fa9e4066Sahrens 	{	zil_prt_rec_remove,	"TX_REMOVE          " },
260fa9e4066Sahrens 	{	zil_prt_rec_remove,	"TX_RMDIR           " },
261fa9e4066Sahrens 	{	zil_prt_rec_link,	"TX_LINK            " },
262fa9e4066Sahrens 	{	zil_prt_rec_rename,	"TX_RENAME          " },
263fa9e4066Sahrens 	{	zil_prt_rec_write,	"TX_WRITE           " },
264fa9e4066Sahrens 	{	zil_prt_rec_truncate,	"TX_TRUNCATE        " },
265fa9e4066Sahrens 	{	zil_prt_rec_setattr,	"TX_SETATTR         " },
266da6c28aaSamw 	{	zil_prt_rec_acl,	"TX_ACL_V0          " },
267da6c28aaSamw 	{	zil_prt_rec_acl,	"TX_ACL_ACL         " },
268da6c28aaSamw 	{	zil_prt_rec_create,	"TX_CREATE_ACL      " },
269da6c28aaSamw 	{	zil_prt_rec_create,	"TX_CREATE_ATTR     " },
270da6c28aaSamw 	{	zil_prt_rec_create,	"TX_CREATE_ACL_ATTR " },
271da6c28aaSamw 	{	zil_prt_rec_create,	"TX_MKDIR_ACL       " },
272da6c28aaSamw 	{	zil_prt_rec_create,	"TX_MKDIR_ATTR      " },
273da6c28aaSamw 	{	zil_prt_rec_create,	"TX_MKDIR_ACL_ATTR  " },
274975c32a0SNeil Perrin 	{	zil_prt_rec_write,	"TX_WRITE2          " },
275fa9e4066Sahrens };
276fa9e4066Sahrens 
277fa9e4066Sahrens /* ARGSUSED */
278b24ab676SJeff Bonwick static int
2795dabedeeSbonwick print_log_record(zilog_t *zilog, lr_t *lr, void *arg, uint64_t claim_txg)
280fa9e4066Sahrens {
281fa9e4066Sahrens 	int txtype;
282fa9e4066Sahrens 	int verbose = MAX(dump_opt['d'], dump_opt['i']);
283fa9e4066Sahrens 
284da6c28aaSamw 	/* reduce size of txtype to strip off TX_CI bit */
285fa9e4066Sahrens 	txtype = lr->lrc_txtype;
286fa9e4066Sahrens 
287fa9e4066Sahrens 	ASSERT(txtype != 0 && (uint_t)txtype < TX_MAX_TYPE);
288fa9e4066Sahrens 	ASSERT(lr->lrc_txg);
289fa9e4066Sahrens 
290da6c28aaSamw 	(void) printf("\t\t%s%s len %6llu, txg %llu, seq %llu\n",
291da6c28aaSamw 	    (lr->lrc_txtype & TX_CI) ? "CI-" : "",
292fa9e4066Sahrens 	    zil_rec_info[txtype].zri_name,
293fa9e4066Sahrens 	    (u_longlong_t)lr->lrc_reclen,
294fa9e4066Sahrens 	    (u_longlong_t)lr->lrc_txg,
295fa9e4066Sahrens 	    (u_longlong_t)lr->lrc_seq);
296fa9e4066Sahrens 
297fa9e4066Sahrens 	if (txtype && verbose >= 3)
298fa9e4066Sahrens 		zil_rec_info[txtype].zri_print(zilog, txtype, lr);
299fa9e4066Sahrens 
300fa9e4066Sahrens 	zil_rec_info[txtype].zri_count++;
301fa9e4066Sahrens 	zil_rec_info[0].zri_count++;
302b24ab676SJeff Bonwick 
303b24ab676SJeff Bonwick 	return (0);
304fa9e4066Sahrens }
305fa9e4066Sahrens 
306fa9e4066Sahrens /* ARGSUSED */
307b24ab676SJeff Bonwick static int
3085dabedeeSbonwick print_log_block(zilog_t *zilog, blkptr_t *bp, void *arg, uint64_t claim_txg)
309fa9e4066Sahrens {
310b24ab676SJeff Bonwick 	char blkbuf[BP_SPRINTF_LEN + 10];
311fa9e4066Sahrens 	int verbose = MAX(dump_opt['d'], dump_opt['i']);
3125dabedeeSbonwick 	char *claim;
313fa9e4066Sahrens 
314fa9e4066Sahrens 	if (verbose <= 3)
315b24ab676SJeff Bonwick 		return (0);
316fa9e4066Sahrens 
317fa9e4066Sahrens 	if (verbose >= 5) {
318fa9e4066Sahrens 		(void) strcpy(blkbuf, ", ");
31943466aaeSMax Grossman 		snprintf_blkptr(blkbuf + strlen(blkbuf),
32043466aaeSMax Grossman 		    sizeof (blkbuf) - strlen(blkbuf), bp);
321fa9e4066Sahrens 	} else {
322fa9e4066Sahrens 		blkbuf[0] = '\0';
323fa9e4066Sahrens 	}
324fa9e4066Sahrens 
3255dabedeeSbonwick 	if (claim_txg != 0)
3265dabedeeSbonwick 		claim = "already claimed";
3275dabedeeSbonwick 	else if (bp->blk_birth >= spa_first_txg(zilog->zl_spa))
3285dabedeeSbonwick 		claim = "will claim";
3295dabedeeSbonwick 	else
3305dabedeeSbonwick 		claim = "won't claim";
3315dabedeeSbonwick 
332fa9e4066Sahrens 	(void) printf("\tBlock seqno %llu, %s%s\n",
333d80c45e0Sbonwick 	    (u_longlong_t)bp->blk_cksum.zc_word[ZIL_ZC_SEQ], claim, blkbuf);
334b24ab676SJeff Bonwick 
335b24ab676SJeff Bonwick 	return (0);
336fa9e4066Sahrens }
337fa9e4066Sahrens 
338fa9e4066Sahrens static void
339fa9e4066Sahrens print_log_stats(int verbose)
340fa9e4066Sahrens {
341fa9e4066Sahrens 	int i, w, p10;
342fa9e4066Sahrens 
343fa9e4066Sahrens 	if (verbose > 3)
344fa9e4066Sahrens 		(void) printf("\n");
345fa9e4066Sahrens 
346fa9e4066Sahrens 	if (zil_rec_info[0].zri_count == 0)
347fa9e4066Sahrens 		return;
348fa9e4066Sahrens 
349fa9e4066Sahrens 	for (w = 1, p10 = 10; zil_rec_info[0].zri_count >= p10; p10 *= 10)
350fa9e4066Sahrens 		w++;
351fa9e4066Sahrens 
352fa9e4066Sahrens 	for (i = 0; i < TX_MAX_TYPE; i++)
353fa9e4066Sahrens 		if (zil_rec_info[i].zri_count || verbose >= 3)
354fa9e4066Sahrens 			(void) printf("\t\t%s %*llu\n",
355fa9e4066Sahrens 			    zil_rec_info[i].zri_name, w,
356fa9e4066Sahrens 			    (u_longlong_t)zil_rec_info[i].zri_count);
357fa9e4066Sahrens 	(void) printf("\n");
358fa9e4066Sahrens }
359fa9e4066Sahrens 
360fa9e4066Sahrens /* ARGSUSED */
361fa9e4066Sahrens void
362fa9e4066Sahrens dump_intent_log(zilog_t *zilog)
363fa9e4066Sahrens {
364d80c45e0Sbonwick 	const zil_header_t *zh = zilog->zl_header;
365fa9e4066Sahrens 	int verbose = MAX(dump_opt['d'], dump_opt['i']);
366fa9e4066Sahrens 	int i;
367fa9e4066Sahrens 
36843466aaeSMax Grossman 	if (BP_IS_HOLE(&zh->zh_log) || verbose < 1)
369fa9e4066Sahrens 		return;
370fa9e4066Sahrens 
371b24ab676SJeff Bonwick 	(void) printf("\n    ZIL header: claim_txg %llu, "
372b24ab676SJeff Bonwick 	    "claim_blk_seq %llu, claim_lr_seq %llu",
373b24ab676SJeff Bonwick 	    (u_longlong_t)zh->zh_claim_txg,
374b24ab676SJeff Bonwick 	    (u_longlong_t)zh->zh_claim_blk_seq,
375b24ab676SJeff Bonwick 	    (u_longlong_t)zh->zh_claim_lr_seq);
3763589c4f0SNeil Perrin 	(void) printf(" replay_seq %llu, flags 0x%llx\n",
3773589c4f0SNeil Perrin 	    (u_longlong_t)zh->zh_replay_seq, (u_longlong_t)zh->zh_flags);
378fa9e4066Sahrens 
379fa9e4066Sahrens 	for (i = 0; i < TX_MAX_TYPE; i++)
380fa9e4066Sahrens 		zil_rec_info[i].zri_count = 0;
381fa9e4066Sahrens 
382fa9e4066Sahrens 	if (verbose >= 2) {
383fa9e4066Sahrens 		(void) printf("\n");
384d80c45e0Sbonwick 		(void) zil_parse(zilog, print_log_block, print_log_record, NULL,
3855dabedeeSbonwick 		    zh->zh_claim_txg);
386fa9e4066Sahrens 		print_log_stats(verbose);
387fa9e4066Sahrens 	}
388fa9e4066Sahrens }
389