]>
git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blob - logprint/log_dump.c
2 * Copyright (c) 2004-2005 Silicon Graphics, Inc.
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.
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.
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
24 * Dump log blocks, not data
31 int print_block_start
)
35 xfs_daddr_t blkno
, dupblkno
;
36 xlog_rec_header_t
*hdr
;
37 char buf
[XLOG_HEADER_SIZE
];
40 hdr
= (xlog_rec_header_t
*)buf
;
41 xlog_print_lseek(log
, fd
, 0, SEEK_SET
);
42 for (blkno
= 0; blkno
< log
->l_logBBsize
; blkno
++) {
43 r
= read(fd
, buf
, sizeof(buf
));
45 fprintf(stderr
, _("%s: read error (%lld): %s\n"),
46 __FUNCTION__
, (long long)blkno
,
50 printf(_("%s: physical end of log at %lld\n"),
51 __FUNCTION__
, (long long)blkno
);
55 if (CYCLE_LSN(be64_to_cpu(*(__be64
*)buf
)) ==
56 XLOG_HEADER_MAGIC_NUM
&& !print_no_data
) {
58 "%6lld HEADER Cycle %d tail %d:%06d len %6d ops %d\n"),
60 be32_to_cpu(hdr
->h_cycle
),
61 CYCLE_LSN(be64_to_cpu(hdr
->h_tail_lsn
)),
62 BLOCK_LSN(be64_to_cpu(hdr
->h_tail_lsn
)),
63 be32_to_cpu(hdr
->h_len
),
64 be32_to_cpu(hdr
->h_num_logops
));
67 if (xlog_get_cycle(buf
) != last_cycle
) {
69 "[%05lld - %05lld] Cycle 0x%08x New Cycle 0x%08x\n"),
70 (long long)dupblkno
, (long long)blkno
,
71 last_cycle
, xlog_get_cycle(buf
));
72 last_cycle
= xlog_get_cycle(buf
);