]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blob - logprint/log_print_trans.c
xfs: define the on-disk refcount btree format
[thirdparty/xfsprogs-dev.git] / logprint / log_print_trans.c
1 /*
2 * Copyright (c) 2000-2001,2005 Silicon Graphics, Inc.
3 * All Rights Reserved.
4 *
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
7 * published by the Free Software Foundation.
8 *
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.
13 *
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
17 */
18 #include "libxfs.h"
19 #include "libxlog.h"
20
21 #include "logprint.h"
22
23 void
24 xlog_recover_print_trans_head(
25 xlog_recover_t *tr)
26 {
27 printf(_("TRANS: tid:0x%x #items:%d trans:0x%x q:0x%lx\n"),
28 tr->r_log_tid,
29 tr->r_theader.th_num_items,
30 tr->r_theader.th_tid, (long)&tr->r_itemq);
31 }
32
33 int
34 xlog_recover_do_trans(
35 struct xlog *log,
36 xlog_recover_t *trans,
37 int pass)
38 {
39 xlog_recover_print_trans(trans, &trans->r_itemq, 3);
40 return 0;
41 }
42
43 void
44 xfs_log_print_trans(
45 struct xlog *log,
46 int print_block_start)
47 {
48 xfs_daddr_t head_blk, tail_blk;
49 int error;
50
51 error = xlog_find_tail(log, &head_blk, &tail_blk);
52 if (error) {
53 fprintf(stderr, _("%s: failed to find head and tail, error: %d\n"),
54 progname, error);
55 exit(1);
56 }
57
58 printf(_(" log tail: %lld head: %lld state: %s\n"),
59 (long long)tail_blk,
60 (long long)head_blk,
61 (tail_blk == head_blk)?"<CLEAN>":"<DIRTY>");
62
63 if (print_block_start != -1) {
64 printf(_(" override tail: %d\n"), print_block_start);
65 tail_blk = print_block_start;
66 }
67 printf("\n");
68
69 print_record_header = 1;
70
71 if (head_blk == tail_blk)
72 return;
73
74 /*
75 * Version 5 superblock log feature mask validation. We know the
76 * log is dirty so check if there are any unknown log features
77 * in what we need to recover. If there are unknown features
78 * (e.g. unsupported transactions) then warn about it.
79 */
80 if (XFS_SB_VERSION_NUM(&log->l_mp->m_sb) == XFS_SB_VERSION_5 &&
81 xfs_sb_has_incompat_log_feature(&log->l_mp->m_sb,
82 XFS_SB_FEAT_INCOMPAT_LOG_UNKNOWN)) {
83 printf(_(
84 "Superblock has unknown incompatible log features (0x%x) enabled.\n"
85 "Output may be incomplete or inaccurate. It is recommended that you\n"
86 "upgrade your xfsprogs installation to match the filesystem features.\n"),
87 (log->l_mp->m_sb.sb_features_log_incompat &
88 XFS_SB_FEAT_INCOMPAT_LOG_UNKNOWN));
89 }
90
91 if ((error = xlog_do_recovery_pass(log, head_blk, tail_blk, XLOG_RECOVER_PASS1))) {
92 fprintf(stderr, _("%s: failed in xfs_do_recovery_pass, error: %d\n"),
93 progname, error);
94 exit(1);
95 }
96 }