]>
Commit | Line | Data |
---|---|---|
959ef981 | 1 | // SPDX-License-Identifier: GPL-2.0 |
2bd0ea18 | 2 | /* |
da23017d NS |
3 | * Copyright (c) 2000-2001,2005 Silicon Graphics, Inc. |
4 | * All Rights Reserved. | |
2bd0ea18 | 5 | */ |
6b803e5a CH |
6 | #include "libxfs.h" |
7 | #include "libxlog.h" | |
2bd0ea18 NS |
8 | |
9 | #include "logprint.h" | |
10 | ||
11 | void | |
12 | xlog_recover_print_trans_head( | |
72c5917e | 13 | xlog_recover_t *tr) |
2bd0ea18 | 14 | { |
4fd2b075 HT |
15 | printf(_("TRANS: tid:0x%x #items:%d trans:0x%x q:0x%lx\n"), |
16 | tr->r_log_tid, | |
dfc130f3 | 17 | tr->r_theader.th_num_items, |
c40bdaa2 | 18 | tr->r_theader.th_tid, (long)&tr->r_itemq); |
72c5917e | 19 | } |
2bd0ea18 NS |
20 | |
21 | int | |
72c5917e | 22 | xlog_recover_do_trans( |
999f0b9c | 23 | struct xlog *log, |
72c5917e NS |
24 | xlog_recover_t *trans, |
25 | int pass) | |
2bd0ea18 | 26 | { |
c40bdaa2 | 27 | xlog_recover_print_trans(trans, &trans->r_itemq, 3); |
2bd0ea18 | 28 | return 0; |
72c5917e | 29 | } |
2bd0ea18 NS |
30 | |
31 | void | |
72c5917e | 32 | xfs_log_print_trans( |
999f0b9c | 33 | struct xlog *log, |
72c5917e | 34 | int print_block_start) |
2bd0ea18 NS |
35 | { |
36 | xfs_daddr_t head_blk, tail_blk; | |
dc0bd4a0 | 37 | int error; |
2bd0ea18 | 38 | |
5e656dbb BN |
39 | error = xlog_find_tail(log, &head_blk, &tail_blk); |
40 | if (error) { | |
9ee7055c | 41 | fprintf(stderr, _("%s: failed to find head and tail, error: %d\n"), |
dc0bd4a0 | 42 | progname, error); |
72c5917e | 43 | exit(1); |
dc0bd4a0 | 44 | } |
dfc130f3 | 45 | |
9ee7055c | 46 | printf(_(" log tail: %lld head: %lld state: %s\n"), |
dfc130f3 RC |
47 | (long long)tail_blk, |
48 | (long long)head_blk, | |
49 | (tail_blk == head_blk)?"<CLEAN>":"<DIRTY>"); | |
50 | ||
51 | if (print_block_start != -1) { | |
9ee7055c | 52 | printf(_(" override tail: %d\n"), print_block_start); |
72c5917e | 53 | tail_blk = print_block_start; |
dfc130f3 RC |
54 | } |
55 | printf("\n"); | |
56 | ||
72c5917e | 57 | print_record_header = 1; |
2bd0ea18 | 58 | |
72c5917e NS |
59 | if (head_blk == tail_blk) |
60 | return; | |
6567f1f9 DC |
61 | |
62 | /* | |
63 | * Version 5 superblock log feature mask validation. We know the | |
64 | * log is dirty so check if there are any unknown log features | |
65 | * in what we need to recover. If there are unknown features | |
66 | * (e.g. unsupported transactions) then warn about it. | |
67 | */ | |
68 | if (XFS_SB_VERSION_NUM(&log->l_mp->m_sb) == XFS_SB_VERSION_5 && | |
69 | xfs_sb_has_incompat_log_feature(&log->l_mp->m_sb, | |
70 | XFS_SB_FEAT_INCOMPAT_LOG_UNKNOWN)) { | |
71 | printf(_( | |
72 | "Superblock has unknown incompatible log features (0x%x) enabled.\n" | |
73 | "Output may be incomplete or inaccurate. It is recommended that you\n" | |
74 | "upgrade your xfsprogs installation to match the filesystem features.\n"), | |
75 | (log->l_mp->m_sb.sb_features_log_incompat & | |
76 | XFS_SB_FEAT_INCOMPAT_LOG_UNKNOWN)); | |
77 | } | |
78 | ||
dc0bd4a0 | 79 | if ((error = xlog_do_recovery_pass(log, head_blk, tail_blk, XLOG_RECOVER_PASS1))) { |
9ee7055c | 80 | fprintf(stderr, _("%s: failed in xfs_do_recovery_pass, error: %d\n"), |
dc0bd4a0 | 81 | progname, error); |
72c5917e | 82 | exit(1); |
dc0bd4a0 | 83 | } |
72c5917e | 84 | } |