]>
git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blob - logprint/log_dump.c
1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright (c) 2004-2005 Silicon Graphics, Inc.
12 * Dump log blocks, not data
19 int print_block_start
)
23 xfs_daddr_t blkno
, dupblkno
;
24 xlog_rec_header_t
*hdr
;
25 char buf
[XLOG_HEADER_SIZE
];
28 hdr
= (xlog_rec_header_t
*)buf
;
29 xlog_print_lseek(log
, fd
, 0, SEEK_SET
);
30 for (blkno
= 0; blkno
< log
->l_logBBsize
; blkno
++) {
31 r
= read(fd
, buf
, sizeof(buf
));
33 fprintf(stderr
, _("%s: read error (%lld): %s\n"),
34 __FUNCTION__
, (long long)blkno
,
38 printf(_("%s: physical end of log at %lld\n"),
39 __FUNCTION__
, (long long)blkno
);
43 if (CYCLE_LSN(be64_to_cpu(*(__be64
*)buf
)) ==
44 XLOG_HEADER_MAGIC_NUM
&& !print_no_data
) {
46 "%6lld HEADER Cycle %d tail %d:%06d len %6d ops %d\n"),
48 be32_to_cpu(hdr
->h_cycle
),
49 CYCLE_LSN(be64_to_cpu(hdr
->h_tail_lsn
)),
50 BLOCK_LSN(be64_to_cpu(hdr
->h_tail_lsn
)),
51 be32_to_cpu(hdr
->h_len
),
52 be32_to_cpu(hdr
->h_num_logops
));
55 if (xlog_get_cycle(buf
) != last_cycle
) {
57 "[%05lld - %05lld] Cycle 0x%08x New Cycle 0x%08x\n"),
58 (long long)dupblkno
, (long long)blkno
,
59 last_cycle
, xlog_get_cycle(buf
));
60 last_cycle
= xlog_get_cycle(buf
);