]>
Commit | Line | Data |
---|---|---|
959ef981 | 1 | // SPDX-License-Identifier: GPL-2.0 |
2bd0ea18 | 2 | /* |
da23017d NS |
3 | * Copyright (c) 2000-2003,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 | ||
2bd0ea18 NS |
11 | /* |
12 | * Start is defined to be the block pointing to the oldest valid log record. | |
2bd0ea18 NS |
13 | */ |
14 | int | |
15 | xlog_print_find_oldest( | |
999f0b9c | 16 | struct xlog *log, |
15c81278 | 17 | xfs_daddr_t *last_blk) |
2bd0ea18 | 18 | { |
167137fe | 19 | struct xfs_buf *bp; |
2bd0ea18 | 20 | xfs_daddr_t first_blk; |
15c81278 | 21 | uint first_half_cycle, last_half_cycle; |
a134873e | 22 | int error = 0; |
dfc130f3 | 23 | |
2bd0ea18 NS |
24 | if (xlog_find_zeroed(log, &first_blk)) |
25 | return 0; | |
26 | ||
27 | first_blk = 0; /* read first block */ | |
15c81278 | 28 | bp = xlog_get_bp(log, 1); |
c40bdaa2 | 29 | xlog_bread_noalign(log, 0, 1, bp); |
04338619 | 30 | first_half_cycle = xlog_get_cycle(bp->b_addr); |
2bd0ea18 | 31 | *last_blk = log->l_logBBsize-1; /* read last block */ |
c40bdaa2 | 32 | xlog_bread_noalign(log, *last_blk, 1, bp); |
04338619 | 33 | last_half_cycle = xlog_get_cycle(bp->b_addr); |
2bd0ea18 NS |
34 | ASSERT(last_half_cycle != 0); |
35 | ||
a134873e | 36 | if (first_half_cycle == last_half_cycle) /* all cycle nos are same */ |
2bd0ea18 | 37 | *last_blk = 0; |
a134873e | 38 | else /* have 1st and last; look for middle cycle */ |
2bd0ea18 NS |
39 | error = xlog_find_cycle_start(log, bp, first_blk, |
40 | last_blk, last_half_cycle); | |
2bd0ea18 | 41 | |
66ab87d3 | 42 | libxfs_buf_relse(bp); |
a134873e | 43 | return error; |
15c81278 | 44 | } |
2bd0ea18 NS |
45 | |
46 | void | |
47 | xlog_recover_print_data( | |
d60ba955 | 48 | char *p, |
dfc130f3 | 49 | int len) |
2bd0ea18 NS |
50 | { |
51 | if (print_data) { | |
52 | uint *dp = (uint *)p; | |
53 | int nums = len >> 2; | |
54 | int j = 0; | |
55 | ||
56 | while (j < nums) { | |
57 | if ((j % 8) == 0) | |
58 | printf("%2x ", j); | |
59 | printf("%8x ", *dp); | |
60 | dp++; | |
61 | j++; | |
62 | if ((j % 8) == 0) | |
63 | printf("\n"); | |
64 | } | |
65 | printf("\n"); | |
66 | } | |
15c81278 | 67 | } |
2bd0ea18 NS |
68 | |
69 | STATIC void | |
70 | xlog_recover_print_buffer( | |
3d16b59a | 71 | struct xlog_recover_item *item) |
2bd0ea18 NS |
72 | { |
73 | xfs_agi_t *agi; | |
74 | xfs_agf_t *agf; | |
2bd0ea18 | 75 | xfs_buf_log_format_t *f; |
d60ba955 | 76 | char *p; |
2bd0ea18 NS |
77 | int len, num, i; |
78 | xfs_daddr_t blkno; | |
527e257f | 79 | struct xfs_disk_dquot *ddq; |
2bd0ea18 NS |
80 | |
81 | f = (xfs_buf_log_format_t *)item->ri_buf[0].i_addr; | |
2bd0ea18 | 82 | printf(" "); |
5e656dbb | 83 | ASSERT(f->blf_type == XFS_LI_BUF); |
9ee7055c | 84 | printf(_("BUF: #regs:%d start blkno:0x%llx len:%d bmap size:%d flags:0x%x\n"), |
5e656dbb BN |
85 | f->blf_size, (long long)f->blf_blkno, f->blf_len, f->blf_map_size, f->blf_flags); |
86 | blkno = (xfs_daddr_t)f->blf_blkno; | |
2bd0ea18 NS |
87 | num = f->blf_size-1; |
88 | i = 1; | |
89 | while (num-- > 0) { | |
90 | p = item->ri_buf[i].i_addr; | |
91 | len = item->ri_buf[i].i_len; | |
92 | i++; | |
93 | if (blkno == 0) { /* super block */ | |
9ee7055c | 94 | printf(_(" SUPER Block Buffer:\n")); |
f8149110 | 95 | if (!print_buffer) |
5e656dbb | 96 | continue; |
f934f4a5 AE |
97 | printf(_(" icount:%llu ifree:%llu "), |
98 | (unsigned long long) | |
99 | be64_to_cpu(*(__be64 *)(p)), | |
100 | (unsigned long long) | |
101 | be64_to_cpu(*(__be64 *)(p+8))); | |
102 | printf(_("fdblks:%llu frext:%llu\n"), | |
103 | (unsigned long long) | |
104 | be64_to_cpu(*(__be64 *)(p+16)), | |
105 | (unsigned long long) | |
106 | be64_to_cpu(*(__be64 *)(p+24))); | |
9ee7055c | 107 | printf(_(" sunit:%u swidth:%u\n"), |
5e656dbb BN |
108 | be32_to_cpu(*(__be32 *)(p+56)), |
109 | be32_to_cpu(*(__be32 *)(p+60))); | |
110 | } else if (be32_to_cpu(*(__be32 *)p) == XFS_AGI_MAGIC) { | |
a59111c1 | 111 | int bucket, buckets; |
2bd0ea18 | 112 | agi = (xfs_agi_t *)p; |
9ee7055c | 113 | printf(_(" AGI Buffer: (XAGI)\n")); |
f8149110 | 114 | if (!print_buffer) |
5e656dbb | 115 | continue; |
9ee7055c | 116 | printf(_(" ver:%d "), |
5e656dbb | 117 | be32_to_cpu(agi->agi_versionnum)); |
9ee7055c | 118 | printf(_("seq#:%d len:%d cnt:%d root:%d\n"), |
5e656dbb BN |
119 | be32_to_cpu(agi->agi_seqno), |
120 | be32_to_cpu(agi->agi_length), | |
121 | be32_to_cpu(agi->agi_count), | |
122 | be32_to_cpu(agi->agi_root)); | |
9ee7055c | 123 | printf(_(" level:%d free#:0x%x newino:0x%x\n"), |
5e656dbb BN |
124 | be32_to_cpu(agi->agi_level), |
125 | be32_to_cpu(agi->agi_freecount), | |
126 | be32_to_cpu(agi->agi_newino)); | |
a59111c1 DC |
127 | if (len == 128) { |
128 | buckets = 17; | |
129 | } else if (len == 256) { | |
130 | buckets = 32 + 17; | |
131 | } else { | |
132 | buckets = XFS_AGI_UNLINKED_BUCKETS; | |
133 | } | |
134 | for (bucket = 0; bucket < buckets;) { | |
135 | int col; | |
136 | printf(_("bucket[%d - %d]: "), bucket, bucket+3); | |
137 | for (col = 0; col < 4; col++, bucket++) { | |
138 | if (bucket < buckets) { | |
139 | printf("0x%x ", | |
140 | be32_to_cpu(agi->agi_unlinked[bucket])); | |
141 | } | |
142 | } | |
143 | printf("\n"); | |
144 | } | |
5e656dbb | 145 | } else if (be32_to_cpu(*(__be32 *)p) == XFS_AGF_MAGIC) { |
2bd0ea18 | 146 | agf = (xfs_agf_t *)p; |
9ee7055c | 147 | printf(_(" AGF Buffer: (XAGF)\n")); |
f8149110 | 148 | if (!print_buffer) |
5e656dbb | 149 | continue; |
9ee7055c | 150 | printf(_(" ver:%d seq#:%d len:%d \n"), |
5e656dbb BN |
151 | be32_to_cpu(agf->agf_versionnum), |
152 | be32_to_cpu(agf->agf_seqno), | |
153 | be32_to_cpu(agf->agf_length)); | |
9ee7055c | 154 | printf(_(" root BNO:%d CNT:%d\n"), |
5e656dbb BN |
155 | be32_to_cpu(agf->agf_roots[XFS_BTNUM_BNOi]), |
156 | be32_to_cpu(agf->agf_roots[XFS_BTNUM_CNTi])); | |
9ee7055c | 157 | printf(_(" level BNO:%d CNT:%d\n"), |
5e656dbb BN |
158 | be32_to_cpu(agf->agf_levels[XFS_BTNUM_BNOi]), |
159 | be32_to_cpu(agf->agf_levels[XFS_BTNUM_CNTi])); | |
9ee7055c AM |
160 | printf(_(" 1st:%d last:%d cnt:%d " |
161 | "freeblks:%d longest:%d\n"), | |
5e656dbb BN |
162 | be32_to_cpu(agf->agf_flfirst), |
163 | be32_to_cpu(agf->agf_fllast), | |
164 | be32_to_cpu(agf->agf_flcount), | |
165 | be32_to_cpu(agf->agf_freeblks), | |
166 | be32_to_cpu(agf->agf_longest)); | |
2bd0ea18 | 167 | } else if (*(uint *)p == XFS_DQUOT_MAGIC) { |
527e257f | 168 | ddq = (struct xfs_disk_dquot *)p; |
9ee7055c | 169 | printf(_(" DQUOT Buffer:\n")); |
f8149110 | 170 | if (!print_buffer) |
5e656dbb | 171 | continue; |
9ee7055c | 172 | printf(_(" UIDs 0x%lx-0x%lx\n"), |
5e656dbb BN |
173 | (unsigned long)be32_to_cpu(ddq->d_id), |
174 | (unsigned long)be32_to_cpu(ddq->d_id) + | |
bf0f6e17 | 175 | (BBTOB(f->blf_len) / sizeof(struct xfs_dqblk)) - 1); |
2bd0ea18 | 176 | } else { |
9ee7055c | 177 | printf(_(" BUF DATA\n")); |
2bd0ea18 NS |
178 | if (!print_buffer) continue; |
179 | xlog_recover_print_data(p, len); | |
180 | } | |
181 | } | |
15c81278 | 182 | } |
2bd0ea18 NS |
183 | |
184 | STATIC void | |
185 | xlog_recover_print_quotaoff( | |
3d16b59a | 186 | struct xlog_recover_item *item) |
2bd0ea18 | 187 | { |
15c81278 | 188 | xfs_qoff_logformat_t *qoff_f; |
2bd0ea18 NS |
189 | |
190 | qoff_f = (xfs_qoff_logformat_t *)item->ri_buf[0].i_addr; | |
366a2ad5 | 191 | |
2bd0ea18 | 192 | ASSERT(qoff_f); |
366a2ad5 | 193 | printf(_("\tQUOTAOFF: #regs:%d type:"), qoff_f->qf_size); |
dfc130f3 | 194 | if (qoff_f->qf_flags & XFS_UQUOTA_ACCT) |
366a2ad5 | 195 | printf(" USER"); |
b36eef04 | 196 | if (qoff_f->qf_flags & XFS_GQUOTA_ACCT) |
366a2ad5 | 197 | printf(" GROUP"); |
6af9d3ef | 198 | if (qoff_f->qf_flags & XFS_PQUOTA_ACCT) |
366a2ad5 CM |
199 | printf(" PROJECT"); |
200 | printf("\n"); | |
2bd0ea18 NS |
201 | } |
202 | ||
2bd0ea18 NS |
203 | STATIC void |
204 | xlog_recover_print_dquot( | |
3d16b59a | 205 | struct xlog_recover_item *item) |
2bd0ea18 | 206 | { |
dfc130f3 | 207 | xfs_dq_logformat_t *f; |
527e257f | 208 | struct xfs_disk_dquot *d; |
2bd0ea18 NS |
209 | |
210 | f = (xfs_dq_logformat_t *)item->ri_buf[0].i_addr; | |
211 | ASSERT(f); | |
212 | ASSERT(f->qlf_len == 1); | |
527e257f | 213 | d = (struct xfs_disk_dquot *)item->ri_buf[1].i_addr; |
9ee7055c | 214 | printf(_("\tDQUOT: #regs:%d blkno:%lld boffset:%u id: %d\n"), |
5b64e00a | 215 | f->qlf_size, (long long)f->qlf_blkno, f->qlf_boffset, f->qlf_id); |
2bd0ea18 NS |
216 | if (!print_quota) |
217 | return; | |
9ee7055c | 218 | printf(_("\t\tmagic 0x%x\tversion 0x%x\tID 0x%x (%d)\t\n"), |
5e656dbb BN |
219 | be16_to_cpu(d->d_magic), |
220 | d->d_version, | |
221 | be32_to_cpu(d->d_id), | |
222 | be32_to_cpu(d->d_id)); | |
9ee7055c AM |
223 | printf(_("\t\tblk_hard 0x%x\tblk_soft 0x%x\tino_hard 0x%x" |
224 | "\tino_soft 0x%x\n"), | |
5e656dbb BN |
225 | (int)be64_to_cpu(d->d_blk_hardlimit), |
226 | (int)be64_to_cpu(d->d_blk_softlimit), | |
227 | (int)be64_to_cpu(d->d_ino_hardlimit), | |
228 | (int)be64_to_cpu(d->d_ino_softlimit)); | |
9ee7055c | 229 | printf(_("\t\tbcount 0x%x (%d) icount 0x%x (%d)\n"), |
5e656dbb BN |
230 | (int)be64_to_cpu(d->d_bcount), |
231 | (int)be64_to_cpu(d->d_bcount), | |
232 | (int)be64_to_cpu(d->d_icount), | |
233 | (int)be64_to_cpu(d->d_icount)); | |
9ee7055c | 234 | printf(_("\t\tbtimer 0x%x itimer 0x%x \n"), |
5e656dbb BN |
235 | (int)be32_to_cpu(d->d_btimer), |
236 | (int)be32_to_cpu(d->d_itimer)); | |
2bd0ea18 NS |
237 | } |
238 | ||
239 | STATIC void | |
240 | xlog_recover_print_inode_core( | |
138659f1 | 241 | struct xfs_log_dinode *di) |
2bd0ea18 | 242 | { |
8be26c6a CB |
243 | xfs_extnum_t nextents; |
244 | xfs_aextnum_t anextents; | |
245 | ||
9ee7055c | 246 | printf(_(" CORE inode:\n")); |
2bd0ea18 NS |
247 | if (!print_inode) |
248 | return; | |
8be26c6a CB |
249 | |
250 | if (di->di_flags2 & XFS_DIFLAG2_NREXT64) { | |
251 | nextents = di->di_big_nextents; | |
252 | anextents = di->di_big_anextents; | |
253 | } else { | |
254 | nextents = di->di_nextents; | |
255 | anextents = di->di_anextents; | |
256 | } | |
257 | ||
f089fc42 | 258 | printf(_(" magic:%c%c mode:0x%x ver:%d format:%d\n"), |
dfc130f3 | 259 | (di->di_magic>>8) & 0xff, di->di_magic & 0xff, |
f089fc42 | 260 | di->di_mode, di->di_version, di->di_format); |
138659f1 DC |
261 | printf(_(" uid:%d gid:%d nlink:%d projid:0x%04x%04x\n"), |
262 | di->di_uid, di->di_gid, di->di_nlink, | |
263 | di->di_projid_hi, di->di_projid_lo); | |
fc3e21db DW |
264 | printf(_(" atime:%lld mtime:%lld ctime:%lld\n"), |
265 | xlog_extract_dinode_ts(di->di_atime), | |
266 | xlog_extract_dinode_ts(di->di_mtime), | |
267 | xlog_extract_dinode_ts(di->di_ctime)); | |
9ee7055c AM |
268 | printf(_(" flushiter:%d\n"), di->di_flushiter); |
269 | printf(_(" size:0x%llx nblks:0x%llx exsize:%d " | |
053fcbc7 | 270 | "nextents:%" PRIu64 " anextents:%" PRIu32 "\n"), (unsigned long long) |
5b64e00a | 271 | di->di_size, (unsigned long long)di->di_nblocks, |
8be26c6a | 272 | di->di_extsize, nextents, anextents); |
9ee7055c | 273 | printf(_(" forkoff:%d dmevmask:0x%x dmstate:%d flags:0x%x " |
3c84c543 | 274 | "gen:%u\n"), |
2bd0ea18 NS |
275 | (int)di->di_forkoff, di->di_dmevmask, (int)di->di_dmstate, |
276 | (int)di->di_flags, di->di_gen); | |
1fe708d6 | 277 | if (di->di_version == 3) { |
12f365e2 | 278 | printf(_(" flags2 0x%llx cowextsize 0x%x\n"), |
1fe708d6 DW |
279 | (unsigned long long)di->di_flags2, di->di_cowextsize); |
280 | } | |
15c81278 | 281 | } |
2bd0ea18 NS |
282 | |
283 | STATIC void | |
284 | xlog_recover_print_inode( | |
3d16b59a | 285 | struct xlog_recover_item *item) |
2bd0ea18 | 286 | { |
e784bcd5 DW |
287 | struct xfs_inode_log_format f_buf; |
288 | struct xfs_inode_log_format *f; | |
2bd0ea18 NS |
289 | int attr_index; |
290 | int hasdata; | |
291 | int hasattr; | |
292 | ||
87daa553 DC |
293 | ASSERT(item->ri_buf[0].i_len == sizeof(struct xfs_inode_log_format_32) || |
294 | item->ri_buf[0].i_len == sizeof(struct xfs_inode_log_format)); | |
299173ff TS |
295 | f = xfs_inode_item_format_convert(item->ri_buf[0].i_addr, item->ri_buf[0].i_len, &f_buf); |
296 | ||
9ee7055c | 297 | printf(_(" INODE: #regs:%d ino:0x%llx flags:0x%x dsize:%d\n"), |
5b64e00a NS |
298 | f->ilf_size, (unsigned long long)f->ilf_ino, f->ilf_fields, |
299 | f->ilf_dsize); | |
2bd0ea18 NS |
300 | |
301 | /* core inode comes 2nd */ | |
4de63245 CH |
302 | /* ASSERT len vs xfs_log_dinode_size() for V3 or V2 inodes */ |
303 | ASSERT(item->ri_buf[1].i_len == | |
304 | offsetof(struct xfs_log_dinode, di_next_unlinked) || | |
305 | item->ri_buf[1].i_len == sizeof(struct xfs_log_dinode)); | |
138659f1 | 306 | xlog_recover_print_inode_core((struct xfs_log_dinode *) |
2bd0ea18 NS |
307 | item->ri_buf[1].i_addr); |
308 | ||
309 | hasdata = (f->ilf_fields & XFS_ILOG_DFORK) != 0; | |
310 | hasattr = (f->ilf_fields & XFS_ILOG_AFORK) != 0; | |
311 | /* does anything come next */ | |
15c81278 NS |
312 | switch (f->ilf_fields & (XFS_ILOG_DFORK|XFS_ILOG_DEV|XFS_ILOG_UUID)) { |
313 | case XFS_ILOG_DEXT: | |
314 | ASSERT(f->ilf_size == 3 + hasattr); | |
9ee7055c | 315 | printf(_(" DATA FORK EXTENTS inode data:\n")); |
15c81278 NS |
316 | if (print_inode && print_data) |
317 | xlog_recover_print_data(item->ri_buf[2].i_addr, | |
318 | item->ri_buf[2].i_len); | |
319 | break; | |
320 | case XFS_ILOG_DBROOT: | |
321 | ASSERT(f->ilf_size == 3 + hasattr); | |
9ee7055c | 322 | printf(_(" DATA FORK BTREE inode data:\n")); |
15c81278 NS |
323 | if (print_inode && print_data) |
324 | xlog_recover_print_data(item->ri_buf[2].i_addr, | |
325 | item->ri_buf[2].i_len); | |
326 | break; | |
327 | case XFS_ILOG_DDATA: | |
328 | ASSERT(f->ilf_size == 3 + hasattr); | |
9ee7055c | 329 | printf(_(" DATA FORK LOCAL inode data:\n")); |
15c81278 NS |
330 | if (print_inode && print_data) |
331 | xlog_recover_print_data(item->ri_buf[2].i_addr, | |
332 | item->ri_buf[2].i_len); | |
333 | break; | |
334 | case XFS_ILOG_DEV: | |
335 | ASSERT(f->ilf_size == 2 + hasattr); | |
9ee7055c | 336 | printf(_(" DEV inode: no extra region\n")); |
15c81278 NS |
337 | break; |
338 | case XFS_ILOG_UUID: | |
339 | ASSERT(f->ilf_size == 2 + hasattr); | |
9ee7055c | 340 | printf(_(" UUID inode: no extra region\n")); |
15c81278 NS |
341 | break; |
342 | ||
343 | case 0: | |
344 | ASSERT(f->ilf_size == 2 + hasattr); | |
345 | break; | |
346 | default: | |
347 | xlog_panic("xlog_print_trans_inode: illegal inode type"); | |
2bd0ea18 NS |
348 | } |
349 | ||
350 | if (hasattr) { | |
351 | attr_index = 2 + hasdata; | |
352 | switch (f->ilf_fields & XFS_ILOG_AFORK) { | |
15c81278 NS |
353 | case XFS_ILOG_AEXT: |
354 | ASSERT(f->ilf_size == 3 + hasdata); | |
9ee7055c | 355 | printf(_(" ATTR FORK EXTENTS inode data:\n")); |
15c81278 NS |
356 | if (print_inode && print_data) |
357 | xlog_recover_print_data( | |
358 | item->ri_buf[attr_index].i_addr, | |
359 | item->ri_buf[attr_index].i_len); | |
360 | break; | |
361 | case XFS_ILOG_ABROOT: | |
362 | ASSERT(f->ilf_size == 3 + hasdata); | |
9ee7055c | 363 | printf(_(" ATTR FORK BTREE inode data:\n")); |
15c81278 NS |
364 | if (print_inode && print_data) |
365 | xlog_recover_print_data( | |
366 | item->ri_buf[attr_index].i_addr, | |
367 | item->ri_buf[attr_index].i_len); | |
368 | break; | |
369 | case XFS_ILOG_ADATA: | |
370 | ASSERT(f->ilf_size == 3 + hasdata); | |
9ee7055c | 371 | printf(_(" ATTR FORK LOCAL inode data:\n")); |
15c81278 NS |
372 | if (print_inode && print_data) |
373 | xlog_recover_print_data( | |
374 | item->ri_buf[attr_index].i_addr, | |
375 | item->ri_buf[attr_index].i_len); | |
376 | break; | |
377 | default: | |
378 | xlog_panic("%s: illegal inode log flag", __FUNCTION__); | |
2bd0ea18 NS |
379 | } |
380 | } | |
15c81278 | 381 | } |
2bd0ea18 | 382 | |
2bd0ea18 | 383 | |
2e6b5c91 DC |
384 | STATIC void |
385 | xlog_recover_print_icreate( | |
386 | struct xlog_recover_item *item) | |
387 | { | |
388 | struct xfs_icreate_log *icl; | |
389 | ||
390 | icl = (struct xfs_icreate_log *)item->ri_buf[0].i_addr; | |
391 | ||
392 | printf(_(" ICR: #ag: %d agbno: 0x%x len: %d\n" | |
393 | " cnt: %d isize: %d gen: 0x%x\n"), | |
394 | be32_to_cpu(icl->icl_ag), be32_to_cpu(icl->icl_agbno), | |
395 | be32_to_cpu(icl->icl_length), be32_to_cpu(icl->icl_count), | |
396 | be32_to_cpu(icl->icl_isize), be32_to_cpu(icl->icl_gen)); | |
397 | } | |
398 | ||
2bd0ea18 NS |
399 | void |
400 | xlog_recover_print_logitem( | |
3d16b59a | 401 | struct xlog_recover_item *item) |
2bd0ea18 NS |
402 | { |
403 | switch (ITEM_TYPE(item)) { | |
15c81278 | 404 | case XFS_LI_BUF: |
15c81278 NS |
405 | xlog_recover_print_buffer(item); |
406 | break; | |
2e6b5c91 DC |
407 | case XFS_LI_ICREATE: |
408 | xlog_recover_print_icreate(item); | |
409 | break; | |
15c81278 | 410 | case XFS_LI_INODE: |
15c81278 NS |
411 | xlog_recover_print_inode(item); |
412 | break; | |
413 | case XFS_LI_EFD: | |
414 | xlog_recover_print_efd(item); | |
415 | break; | |
416 | case XFS_LI_EFI: | |
417 | xlog_recover_print_efi(item); | |
418 | break; | |
90542cd2 AH |
419 | case XFS_LI_ATTRD: |
420 | xlog_recover_print_attrd(item); | |
421 | break; | |
422 | case XFS_LI_ATTRI: | |
423 | xlog_recover_print_attri(item); | |
424 | break; | |
4428538d DW |
425 | case XFS_LI_RUD: |
426 | xlog_recover_print_rud(item); | |
427 | break; | |
428 | case XFS_LI_RUI: | |
429 | xlog_recover_print_rui(item); | |
430 | break; | |
77e3149e DW |
431 | case XFS_LI_CUD: |
432 | xlog_recover_print_cud(item); | |
433 | break; | |
434 | case XFS_LI_CUI: | |
435 | xlog_recover_print_cui(item); | |
436 | break; | |
dc4957df DW |
437 | case XFS_LI_BUD: |
438 | xlog_recover_print_bud(item); | |
439 | break; | |
440 | case XFS_LI_BUI: | |
441 | xlog_recover_print_bui(item); | |
442 | break; | |
15c81278 NS |
443 | case XFS_LI_DQUOT: |
444 | xlog_recover_print_dquot(item); | |
445 | break; | |
446 | case XFS_LI_QUOTAOFF: | |
447 | xlog_recover_print_quotaoff(item); | |
448 | break; | |
449 | default: | |
9ee7055c | 450 | printf(_("xlog_recover_print_logitem: illegal type\n")); |
15c81278 | 451 | break; |
2bd0ea18 | 452 | } |
15c81278 | 453 | } |
2bd0ea18 | 454 | |
00ff2b10 | 455 | static void |
15c81278 | 456 | xlog_recover_print_item( |
3d16b59a | 457 | struct xlog_recover_item *item) |
2bd0ea18 | 458 | { |
15c81278 | 459 | int i; |
2bd0ea18 NS |
460 | |
461 | switch (ITEM_TYPE(item)) { | |
15c81278 | 462 | case XFS_LI_BUF: |
2bd0ea18 NS |
463 | printf("BUF"); |
464 | break; | |
2e6b5c91 DC |
465 | case XFS_LI_ICREATE: |
466 | printf("ICR"); | |
467 | break; | |
15c81278 | 468 | case XFS_LI_INODE: |
2bd0ea18 NS |
469 | printf("INO"); |
470 | break; | |
15c81278 | 471 | case XFS_LI_EFD: |
2bd0ea18 NS |
472 | printf("EFD"); |
473 | break; | |
15c81278 | 474 | case XFS_LI_EFI: |
2bd0ea18 NS |
475 | printf("EFI"); |
476 | break; | |
90542cd2 AH |
477 | case XFS_LI_ATTRD: |
478 | printf("ATTRD"); | |
479 | break; | |
480 | case XFS_LI_ATTRI: | |
481 | printf("ATTRI"); | |
482 | break; | |
4428538d DW |
483 | case XFS_LI_RUD: |
484 | printf("RUD"); | |
485 | break; | |
486 | case XFS_LI_RUI: | |
487 | printf("RUI"); | |
488 | break; | |
77e3149e DW |
489 | case XFS_LI_CUD: |
490 | printf("CUD"); | |
491 | break; | |
492 | case XFS_LI_CUI: | |
493 | printf("CUI"); | |
494 | break; | |
dc4957df DW |
495 | case XFS_LI_BUD: |
496 | printf("BUD"); | |
497 | break; | |
498 | case XFS_LI_BUI: | |
499 | printf("BUI"); | |
500 | break; | |
15c81278 | 501 | case XFS_LI_DQUOT: |
2bd0ea18 NS |
502 | printf("DQ "); |
503 | break; | |
15c81278 | 504 | case XFS_LI_QUOTAOFF: |
2bd0ea18 NS |
505 | printf("QOFF"); |
506 | break; | |
15c81278 | 507 | default: |
9ee7055c | 508 | cmn_err(CE_PANIC, _("%s: illegal type"), __FUNCTION__); |
2bd0ea18 | 509 | break; |
2bd0ea18 NS |
510 | } |
511 | ||
512 | /* type isn't filled in yet | |
9ee7055c | 513 | printf(_("ITEM: type: %d cnt: %d total: %d "), |
2bd0ea18 NS |
514 | item->ri_type, item->ri_cnt, item->ri_total); |
515 | */ | |
9ee7055c | 516 | printf(_(": cnt:%d total:%d "), item->ri_cnt, item->ri_total); |
2bd0ea18 | 517 | for (i=0; i<item->ri_cnt; i++) { |
9ee7055c | 518 | printf(_("a:0x%lx len:%d "), |
5b64e00a | 519 | (long)item->ri_buf[i].i_addr, item->ri_buf[i].i_len); |
2bd0ea18 NS |
520 | } |
521 | printf("\n"); | |
522 | xlog_recover_print_logitem(item); | |
15c81278 | 523 | } |
2bd0ea18 NS |
524 | |
525 | void | |
15c81278 | 526 | xlog_recover_print_trans( |
19879397 | 527 | struct xlog_recover *trans, |
c40bdaa2 | 528 | struct list_head *itemq, |
15c81278 | 529 | int print) |
2bd0ea18 | 530 | { |
3d16b59a | 531 | struct xlog_recover_item *item; |
2bd0ea18 NS |
532 | |
533 | if (print < 3) | |
534 | return; | |
535 | ||
dfc130f3 | 536 | print_xlog_record_line(); |
2bd0ea18 | 537 | xlog_recover_print_trans_head(trans); |
c40bdaa2 | 538 | list_for_each_entry(item, itemq, ri_list) |
2bd0ea18 | 539 | xlog_recover_print_item(item); |
15c81278 | 540 | } |