zdb_il.c revision d80c45e0f58fa434ba37259ea2e2b12e0380c19a
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* Print intent log header and statistics.
*/
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <sys/zfs_context.h>
#include <sys/resource.h>
#include <sys/zil_impl.h>
static void
{
char blkbuf[BP_SPRINTF_LEN];
}
/* ARGSUSED */
static void
{
if (txtype == TX_SYMLINK)
else
(void) printf("\t\t\tdoid %llu, foid %llu, mode %llo\n",
(void) printf("\t\t\tuid %llu, gid %llu, gen %llu, rdev 0x%llx\n",
}
/* ARGSUSED */
static void
{
(void) printf("\t\t\tdoid %llu, name %s\n",
}
/* ARGSUSED */
static void
{
(void) printf("\t\t\tdoid %llu, link_obj %llu, name %s\n",
(char *)(lr + 1));
}
/* ARGSUSED */
static void
{
(void) printf("\t\t\tsdoid %llu, tdoid %llu\n",
}
/* ARGSUSED */
static void
{
char buf[SPA_MAXBLOCKSIZE];
int error;
(void) printf("\t\t\tfoid %llu, offset 0x%llx,"
" length 0x%llx, blkoff 0x%llx\n",
if (verbose < 5)
return;
(void) printf("\t\t\thas blkptr, %s\n",
"will claim" : "won't claim");
} else {
if (error)
return;
}
} else {
}
(void) printf("\t\t\t");
else
data++;
}
(void) printf("\n");
}
/* ARGSUSED */
static void
{
(void) printf("\t\t\tfoid %llu, offset 0x%llx, length 0x%llx\n",
}
/* ARGSUSED */
static void
{
(void) printf("\t\t\tfoid %llu, mask 0x%llx\n",
(void) printf("\t\t\tAT_MODE %llo\n",
}
(void) printf("\t\t\tAT_UID %llu\n",
}
(void) printf("\t\t\tAT_GID %llu\n",
}
(void) printf("\t\t\tAT_SIZE %llu\n",
}
(void) printf("\t\t\tAT_ATIME %llu.%09llu %s",
}
(void) printf("\t\t\tAT_MTIME %llu.%09llu %s",
}
}
/* ARGSUSED */
static void
{
(void) printf("\t\t\tfoid %llu, aclcnt %llu\n",
}
typedef void (*zil_prt_rec_func_t)();
typedef struct zil_rec_info {
char *zri_name;
{ NULL, "Total " },
{ zil_prt_rec_create, "TX_CREATE " },
{ zil_prt_rec_create, "TX_MKDIR " },
{ zil_prt_rec_create, "TX_MKXATTR " },
{ zil_prt_rec_create, "TX_SYMLINK " },
{ zil_prt_rec_remove, "TX_REMOVE " },
{ zil_prt_rec_remove, "TX_RMDIR " },
{ zil_prt_rec_link, "TX_LINK " },
{ zil_prt_rec_rename, "TX_RENAME " },
{ zil_prt_rec_write, "TX_WRITE " },
{ zil_prt_rec_truncate, "TX_TRUNCATE" },
{ zil_prt_rec_setattr, "TX_SETATTR " },
{ zil_prt_rec_acl, "TX_ACL " },
};
/* ARGSUSED */
static void
{
int txtype;
(void) printf("\t\t%s len %6llu, txg %llu, seq %llu\n",
zil_rec_info[0].zri_count++;
}
/* ARGSUSED */
static void
{
char blkbuf[BP_SPRINTF_LEN];
char *claim;
if (verbose <= 3)
return;
if (verbose >= 5) {
} else {
blkbuf[0] = '\0';
}
if (claim_txg != 0)
claim = "already claimed";
claim = "will claim";
else
claim = "won't claim";
(void) printf("\tBlock seqno %llu, %s%s\n",
}
static void
print_log_stats(int verbose)
{
int i, w, p10;
if (verbose > 3)
(void) printf("\n");
if (zil_rec_info[0].zri_count == 0)
return;
w++;
for (i = 0; i < TX_MAX_TYPE; i++)
(void) printf("\t\t%s %*llu\n",
zil_rec_info[i].zri_name, w,
(void) printf("\n");
}
/* ARGSUSED */
void
{
int i;
return;
(void) printf("\n ZIL header: claim_txg %llu, seq %llu\n",
if (verbose >= 4)
for (i = 0; i < TX_MAX_TYPE; i++)
zil_rec_info[i].zri_count = 0;
if (verbose >= 2) {
(void) printf("\n");
zh->zh_claim_txg);
}
}