]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blame - logprint/log_print_trans.c
xfsprogs debian changes
[thirdparty/xfsprogs-dev.git] / logprint / log_print_trans.c
CommitLineData
2bd0ea18 1/*
da23017d
NS
2 * Copyright (c) 2000-2001,2005 Silicon Graphics, Inc.
3 * All Rights Reserved.
dfc130f3 4 *
da23017d
NS
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
2bd0ea18 7 * published by the Free Software Foundation.
dfc130f3 8 *
da23017d
NS
9 * This program is distributed in the hope that it would be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
dfc130f3 13 *
da23017d
NS
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write the Free Software Foundation,
16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
2bd0ea18
NS
17 */
18
19#include "logprint.h"
20
21void
22xlog_recover_print_trans_head(
72c5917e 23 xlog_recover_t *tr)
2bd0ea18 24{
dfc130f3
RC
25 printf("TRANS: tid:0x%x type:%s #items:%d trans:0x%x q:0x%lx\n",
26 tr->r_log_tid, trans_type[tr->r_theader.th_type],
27 tr->r_theader.th_num_items,
28 tr->r_theader.th_tid, (long)tr->r_itemq);
72c5917e 29}
2bd0ea18
NS
30
31int
72c5917e
NS
32xlog_recover_do_trans(
33 xlog_t *log,
34 xlog_recover_t *trans,
35 int pass)
2bd0ea18
NS
36{
37 xlog_recover_print_trans(trans, trans->r_itemq, 3);
38 return 0;
72c5917e 39}
2bd0ea18
NS
40
41void
72c5917e
NS
42xfs_log_print_trans(
43 xlog_t *log,
44 int print_block_start)
2bd0ea18
NS
45{
46 xfs_daddr_t head_blk, tail_blk;
dc0bd4a0 47 int error;
2bd0ea18 48
dc0bd4a0 49 if ((error = xlog_find_tail(log, &head_blk, &tail_blk, 0))) {
da23017d 50 fprintf(stderr, "%s: failed to find head and tail, error: %d\n",
dc0bd4a0 51 progname, error);
72c5917e 52 exit(1);
dc0bd4a0 53 }
dfc130f3 54
2bd0ea18 55 printf(" log tail: %lld head: %lld state: %s\n",
dfc130f3
RC
56 (long long)tail_blk,
57 (long long)head_blk,
58 (tail_blk == head_blk)?"<CLEAN>":"<DIRTY>");
59
60 if (print_block_start != -1) {
72c5917e
NS
61 printf(" override tail: %d\n", print_block_start);
62 tail_blk = print_block_start;
dfc130f3
RC
63 }
64 printf("\n");
65
72c5917e 66 print_record_header = 1;
2bd0ea18 67
72c5917e
NS
68 if (head_blk == tail_blk)
69 return;
dc0bd4a0 70 if ((error = xlog_do_recovery_pass(log, head_blk, tail_blk, XLOG_RECOVER_PASS1))) {
da23017d 71 fprintf(stderr, "%s: failed in xfs_do_recovery_pass, error: %d\n",
dc0bd4a0 72 progname, error);
72c5917e 73 exit(1);
dc0bd4a0 74 }
72c5917e 75}