Print this page




   2  * CDDL HEADER START
   3  *
   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   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  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
  23  * Use is subject to license terms.
  24  */
  25 
  26 #pragma ident   "%Z%%M% %I%     %E% SMI"
  27 
  28 /*
  29  * Print intent log header and statistics.
  30  */
  31 
  32 #include <stdio.h>
  33 #include <stdlib.h>
  34 #include <ctype.h>
  35 #include <sys/zfs_context.h>
  36 #include <sys/spa.h>
  37 #include <sys/dmu.h>
  38 #include <sys/stat.h>
  39 #include <sys/resource.h>
  40 #include <sys/zil.h>
  41 #include <sys/zil_impl.h>
  42 
  43 extern uint8_t dump_opt[256];
  44 
  45 static void
  46 print_log_bp(const blkptr_t *bp, const char *prefix)
  47 {


 340 {
 341         const zil_header_t *zh = zilog->zl_header;
 342         int verbose = MAX(dump_opt['d'], dump_opt['i']);
 343         int i;
 344 
 345         if (zh->zh_log.blk_birth == 0 || verbose < 2)
 346                 return;
 347 
 348         (void) printf("\n    ZIL header: claim_txg %llu, seq %llu\n",
 349             (u_longlong_t)zh->zh_claim_txg, (u_longlong_t)zh->zh_replay_seq);
 350 
 351         if (verbose >= 4)
 352                 print_log_bp(&zh->zh_log, "\n\tfirst block: ");
 353 
 354         for (i = 0; i < TX_MAX_TYPE; i++)
 355                 zil_rec_info[i].zri_count = 0;
 356 
 357         if (verbose >= 2) {
 358                 (void) printf("\n");
 359                 (void) zil_parse(zilog, print_log_block, print_log_record, NULL,
 360                     zh->zh_claim_txg);
 361                 print_log_stats(verbose);
 362         }
 363 }


   2  * CDDL HEADER START
   3  *
   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   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  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  23  * Use is subject to license terms.
  24  */
  25 


  26 /*
  27  * Print intent log header and statistics.
  28  */
  29 
  30 #include <stdio.h>
  31 #include <stdlib.h>
  32 #include <ctype.h>
  33 #include <sys/zfs_context.h>
  34 #include <sys/spa.h>
  35 #include <sys/dmu.h>
  36 #include <sys/stat.h>
  37 #include <sys/resource.h>
  38 #include <sys/zil.h>
  39 #include <sys/zil_impl.h>
  40 
  41 extern uint8_t dump_opt[256];
  42 
  43 static void
  44 print_log_bp(const blkptr_t *bp, const char *prefix)
  45 {


 338 {
 339         const zil_header_t *zh = zilog->zl_header;
 340         int verbose = MAX(dump_opt['d'], dump_opt['i']);
 341         int i;
 342 
 343         if (zh->zh_log.blk_birth == 0 || verbose < 2)
 344                 return;
 345 
 346         (void) printf("\n    ZIL header: claim_txg %llu, seq %llu\n",
 347             (u_longlong_t)zh->zh_claim_txg, (u_longlong_t)zh->zh_replay_seq);
 348 
 349         if (verbose >= 4)
 350                 print_log_bp(&zh->zh_log, "\n\tfirst block: ");
 351 
 352         for (i = 0; i < TX_MAX_TYPE; i++)
 353                 zil_rec_info[i].zri_count = 0;
 354 
 355         if (verbose >= 2) {
 356                 (void) printf("\n");
 357                 (void) zil_parse(zilog, print_log_block, print_log_record, NULL,
 358                     zh->zh_claim_txg, 0);
 359                 print_log_stats(verbose);
 360         }
 361 }