2 * Copyright (c) 2008 The DragonFly Project. All rights reserved.
4 * This code is derived from software contributed to The DragonFly Project
5 * by Matthew Dillon <dillon@backplane.com>
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in
15 * the documentation and/or other materials provided with the
17 * 3. Neither the name of The DragonFly Project nor the names of its
18 * contributors may be used to endorse or promote products derived
19 * from this software without specific, prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25 * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26 * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
27 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
29 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
30 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
31 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
38 #define FLAG_TOOFARLEFT 0x0001
39 #define FLAG_TOOFARRIGHT 0x0002
40 #define FLAG_BADTYPE 0x0004
41 #define FLAG_BADCHILDPARENT 0x0008
42 #define FLAG_BADMIRRORTID 0x0010
44 typedef struct btree_search {
49 hammer_tid_t create_tid;
50 int limit; /* # of fields to test */
51 int filter; /* filter type (default -1) */
54 static void print_btree_node(hammer_off_t node_offset, btree_search_t search,
55 int depth, hammer_tid_t mirror_tid,
56 hammer_base_elm_t left_bound,
57 hammer_base_elm_t right_bound,
58 struct zone_stat *stats);
59 static const char *check_data_crc(hammer_btree_elm_t elm);
60 static void print_record(hammer_btree_elm_t elm);
61 static void print_btree_elm(hammer_btree_elm_t elm, int i, u_int8_t type,
62 int flags, const char *label, const char *ext,
63 struct zone_stat *stats);
64 static int get_elm_flags(hammer_node_ondisk_t node, hammer_off_t node_offset,
65 hammer_btree_elm_t elm, u_int8_t btype,
66 hammer_base_elm_t left_bound,
67 hammer_base_elm_t right_bound);
68 static void print_bigblock_fill(hammer_off_t offset);
69 static int init_btree_search(const char *arg, int filter,
70 btree_search_t search);
71 static int test_btree_search(hammer_btree_elm_t elm, btree_search_t search);
74 hammer_cmd_show(hammer_off_t node_offset, const char *arg,
75 int filter, int depth,
76 hammer_base_elm_t left_bound, hammer_base_elm_t right_bound)
78 struct volume_info *volume;
79 struct btree_search search;
80 btree_search_t searchp = NULL;
81 struct zone_stat *stats = NULL;
84 AssertOnFailure = (DebugOpt != 0);
87 stats = hammer_init_zone_stat_bits();
89 if (node_offset == (hammer_off_t)-1) {
90 volume = get_volume(RootVolNo);
91 node_offset = volume->ondisk->vol0_btree_root;
93 printf("Volume header\trecords=%jd next_tid=%016jx\n",
94 (intmax_t)volume->ondisk->vol0_stat_records,
95 (uintmax_t)volume->ondisk->vol0_next_tid);
96 printf("\t\tbufoffset=%016jx\n",
97 (uintmax_t)volume->ondisk->vol_buf_beg);
98 for (zone = 0; zone < HAMMER_MAX_ZONES; ++zone) {
99 printf("\t\tzone %d\tnext_offset=%016jx\n",
101 (uintmax_t)volume->ondisk->vol0_blockmap[zone].next_offset
108 printf("show %016jx", (uintmax_t)node_offset);
110 assert(init_btree_search(arg, filter, &search) != -1);
111 if (search.limit >= 1)
112 printf(" lo %08x obj_id %016jx",
113 search.lo, (uintmax_t)search.obj_id);
114 if (search.limit >= 3)
115 printf(" rec_type %02x", search.rec_type);
116 if (search.limit >= 4)
117 printf(" key %016jx", (uintmax_t)search.key);
118 if (search.limit == 5)
119 printf(" create_tid %016jx\n",
120 (uintmax_t)search.create_tid);
123 printf(" depth %d\n", depth);
124 print_btree_node(node_offset, searchp, depth, HAMMER_MAX_TID,
125 left_bound, right_bound, stats);
130 hammer_print_zone_stat(stats);
131 hammer_cleanup_zone_stat(stats);
136 print_btree_node(hammer_off_t node_offset, btree_search_t search,
137 int depth, hammer_tid_t mirror_tid,
138 hammer_base_elm_t left_bound, hammer_base_elm_t right_bound,
139 struct zone_stat *stats)
141 struct buffer_info *buffer = NULL;
142 hammer_node_ondisk_t node;
143 hammer_btree_elm_t elm;
151 node = get_node(node_offset, &buffer);
154 printf("BI NODE %016jx (IO ERROR)\n",
155 (uintmax_t)node_offset);
159 if (crc32(&node->crc + 1, HAMMER_BTREE_CRCSIZE) == node->crc)
164 if (node->mirror_tid <= mirror_tid) {
171 printf("%c%c NODE %016jx cnt=%02d p=%016jx "
175 (uintmax_t)node_offset, node->count,
176 (uintmax_t)node->parent,
177 (node->type ? node->type : '?'), depth);
178 printf(" mirror=%016jx", (uintmax_t)node->mirror_tid);
181 print_bigblock_fill(node_offset);
184 printf(" sign=%04x", node->signature);
188 hammer_add_zone_stat(stats, node_offset, sizeof(*node));
190 maxcount = hammer_node_max_elements(node->type);
191 assert(maxcount != -1);
193 for (i = 0; i < node->count && i < maxcount; ++i) {
194 elm = &node->elms[i];
196 if (node->type != HAMMER_BTREE_TYPE_INTERNAL) {
198 if (search && test_btree_search(elm, search) == 0)
202 if (test_btree_search(elm, search) > 0 ||
203 test_btree_search(elm + 1, search) < 0)
209 flags = get_elm_flags(node, node_offset,
210 elm, elm->base.btype,
211 left_bound, right_bound);
212 print_btree_elm(elm, i, node->type, flags, "ELM", ext, stats);
214 if (node->type == HAMMER_BTREE_TYPE_INTERNAL) {
215 elm = &node->elms[i];
217 flags = get_elm_flags(node, node_offset,
219 left_bound, right_bound);
220 print_btree_elm(elm, i, node->type, flags, "RBN", NULL, stats);
224 for (i = 0; i < node->count; ++i) {
225 elm = &node->elms[i];
228 case HAMMER_BTREE_TYPE_INTERNAL:
229 if (search && search->filter) {
230 if (test_btree_search(elm, search) > 0 ||
231 test_btree_search(elm + 1, search) < 0)
234 if (elm->internal.subtree_offset) {
235 print_btree_node(elm->internal.subtree_offset,
237 elm->internal.mirror_tid,
238 &elm[0].base, &elm[1].base,
241 * Cause show to do normal iteration after
242 * seeking to the lo:objid:rectype:key:tid
245 if (search && search->filter == -1) /* default */
258 is_root_btree_beg(u_int8_t type, int i, hammer_btree_elm_t elm)
261 * elm->base.btype depends on what the original node had
262 * so it could be anything but HAMMER_BTREE_TYPE_NONE.
264 return (type == HAMMER_BTREE_TYPE_INTERNAL &&
266 elm->base.localization == 0 &&
267 elm->base.obj_id == (int64_t)-0x8000000000000000LL &&
268 elm->base.key == (int64_t)-0x8000000000000000LL &&
269 elm->base.create_tid == 1 &&
270 elm->base.delete_tid == 1 &&
271 elm->base.rec_type == 0 &&
272 elm->base.obj_type == 0 &&
273 elm->base.btype != HAMMER_BTREE_TYPE_NONE);
278 is_root_btree_end(u_int8_t type, int i, hammer_btree_elm_t elm)
280 return (type == HAMMER_BTREE_TYPE_INTERNAL &&
282 elm->base.localization == 0xFFFFFFFFU &&
283 elm->base.obj_id == 0x7FFFFFFFFFFFFFFFLL &&
284 elm->base.key == 0x7FFFFFFFFFFFFFFFLL &&
285 elm->base.create_tid == 0xFFFFFFFFFFFFFFFFULL &&
286 elm->base.delete_tid == 0 &&
287 elm->base.rec_type == 0xFFFFU &&
288 elm->base.obj_type == 0 &&
289 elm->base.btype == HAMMER_BTREE_TYPE_NONE);
294 print_btree_elm(hammer_btree_elm_t elm, int i, u_int8_t type,
295 int flags, const char *label, const char *ext,
296 struct zone_stat *stats)
298 char flagstr[8] = { 0, '-', '-', '-', '-', '-', '-', 0 };
303 flagstr[0] = flags ? 'B' : 'G';
304 if (flags & FLAG_TOOFARLEFT)
306 if (flags & FLAG_TOOFARRIGHT)
308 if (flags & FLAG_BADTYPE)
310 if (flags & FLAG_BADCHILDPARENT)
312 if (flags & FLAG_BADMIRRORTID)
316 * Check if elm is derived from root split
318 if (is_root_btree_beg(type, i, elm))
320 else if (is_root_btree_end(type, i, elm))
325 if (elm->base.delete_tid)
330 switch(elm->base.btype) {
331 case HAMMER_BTREE_TYPE_INTERNAL:
332 case HAMMER_BTREE_TYPE_LEAF:
333 case HAMMER_BTREE_TYPE_RECORD:
334 case HAMMER_BTREE_TYPE_DELETED:
335 btype = elm->base.btype; /* ascii */
337 case HAMMER_BTREE_TYPE_NONE:
345 printf("%s\t%s %2d %c ", flagstr, label, i, btype);
346 printf("lo=%08x obj=%016jx rt=%02x key=%016jx ot=%02x\n",
347 elm->base.localization,
348 (uintmax_t)elm->base.obj_id,
350 (uintmax_t)elm->base.key,
352 printf("\t %c tids %016jx:%016jx ",
353 (rootelm == ' ' ? deleted : rootelm),
354 (uintmax_t)elm->base.create_tid,
355 (uintmax_t)elm->base.delete_tid);
358 case HAMMER_BTREE_TYPE_INTERNAL:
359 printf("suboff=%016jx",
360 (uintmax_t)elm->internal.subtree_offset);
362 printf(" mirror %016jx",
363 (uintmax_t)elm->internal.mirror_tid);
368 case HAMMER_BTREE_TYPE_LEAF:
371 switch(elm->base.btype) {
372 case HAMMER_BTREE_TYPE_RECORD:
374 printf("\n%s\t ", check_data_crc(elm));
377 printf("dataoff=%016jx/%d",
378 (uintmax_t)elm->leaf.data_offset,
381 printf(" crc=%04x", elm->leaf.data_crc);
382 printf("\n\t fill=");
383 print_bigblock_fill(elm->leaf.data_offset);
388 hammer_add_zone_stat(stats,
389 elm->leaf.data_offset,
402 get_elm_flags(hammer_node_ondisk_t node, hammer_off_t node_offset,
403 hammer_btree_elm_t elm, u_int8_t btype,
404 hammer_base_elm_t left_bound, hammer_base_elm_t right_bound)
409 case HAMMER_BTREE_TYPE_INTERNAL:
410 if (elm->internal.subtree_offset) {
411 struct buffer_info *buffer = NULL;
412 hammer_node_ondisk_t subnode;
414 subnode = get_node(elm->internal.subtree_offset,
417 flags |= FLAG_BADCHILDPARENT;
418 else if (subnode->parent != node_offset)
419 flags |= FLAG_BADCHILDPARENT;
422 if (elm->internal.mirror_tid > node->mirror_tid)
423 flags |= FLAG_BADMIRRORTID;
426 case HAMMER_BTREE_TYPE_INTERNAL:
427 if (left_bound == NULL || right_bound == NULL)
429 if (hammer_btree_cmp(&elm->base, left_bound) < 0)
430 flags |= FLAG_TOOFARLEFT;
431 if (hammer_btree_cmp(&elm->base, right_bound) > 0)
432 flags |= FLAG_TOOFARRIGHT;
434 case HAMMER_BTREE_TYPE_LEAF:
435 if (left_bound == NULL || right_bound == NULL)
437 if (hammer_btree_cmp(&elm->base, left_bound) < 0)
438 flags |= FLAG_TOOFARLEFT;
439 if (hammer_btree_cmp(&elm->base, right_bound) >= 0)
440 flags |= FLAG_TOOFARRIGHT;
443 flags |= FLAG_BADTYPE;
447 case HAMMER_BTREE_TYPE_LEAF:
448 if (node->mirror_tid == 0 &&
449 !(node->parent == 0 && node->count == 2)) {
450 flags |= FLAG_BADMIRRORTID;
452 if (elm->base.create_tid && node->mirror_tid &&
453 elm->base.create_tid > node->mirror_tid) {
454 flags |= FLAG_BADMIRRORTID;
456 if (elm->base.delete_tid && node->mirror_tid &&
457 elm->base.delete_tid > node->mirror_tid) {
458 flags |= FLAG_BADMIRRORTID;
461 case HAMMER_BTREE_TYPE_RECORD:
462 if (left_bound == NULL || right_bound == NULL)
464 if (hammer_btree_cmp(&elm->base, left_bound) < 0)
465 flags |= FLAG_TOOFARLEFT;
466 if (hammer_btree_cmp(&elm->base, right_bound) >= 0)
467 flags |= FLAG_TOOFARRIGHT;
470 flags |= FLAG_BADTYPE;
475 flags |= FLAG_BADTYPE;
483 print_bigblock_fill(hammer_off_t offset)
485 struct hammer_blockmap_layer1 layer1;
486 struct hammer_blockmap_layer2 layer2;
490 blockmap_lookup(offset, &layer1, &layer2, &error);
492 printf("z%d:v%d:%lu:%lu:%lu=%d",
493 HAMMER_ZONE_DECODE(offset),
494 HAMMER_VOL_DECODE(offset),
495 HAMMER_BLOCKMAP_LAYER1_INDEX(offset),
496 HAMMER_BLOCKMAP_LAYER2_INDEX(offset),
497 offset & HAMMER_BIGBLOCK_MASK64,
500 fill = layer2.bytes_free * 100 / HAMMER_BIGBLOCK_SIZE;
503 printf("z%d:v%d:%lu:%lu:%lu=%d%%",
504 HAMMER_ZONE_DECODE(offset),
505 HAMMER_VOL_DECODE(offset),
506 HAMMER_BLOCKMAP_LAYER1_INDEX(offset),
507 HAMMER_BLOCKMAP_LAYER2_INDEX(offset),
508 offset & HAMMER_BIGBLOCK_MASK64,
514 * Check the generic crc on a data element. Inodes record types are
515 * special in that some of their fields are not CRCed.
517 * Also check that the zone is valid.
521 check_data_crc(hammer_btree_elm_t elm)
523 struct buffer_info *data_buffer;
524 hammer_off_t data_offset;
531 data_offset = elm->leaf.data_offset;
532 data_len = elm->leaf.data_len;
534 if (data_offset == 0 || data_len == 0)
540 blockmap_lookup(data_offset, NULL, NULL, &error);
544 ptr = get_buffer_data(data_offset, &data_buffer, 0);
545 len = HAMMER_BUFSIZE - ((int)data_offset & HAMMER_BUFMASK);
548 if (elm->leaf.base.rec_type == HAMMER_RECTYPE_INODE &&
549 data_len == sizeof(struct hammer_inode_data)) {
550 crc = crc32_ext(ptr, HAMMER_INODE_CRCSIZE, crc);
552 crc = crc32_ext(ptr, len, crc);
557 rel_buffer(data_buffer);
559 switch (error) { /* bad offset */
582 if (crc == elm->leaf.data_crc)
584 return("BX"); /* bad crc */
589 print_config(char *cfgtxt)
593 printf("\n%17stext=\"\n", "");
594 while((token = strsep(&cfgtxt, "\r\n")) != NULL) {
595 printf("%17s %s\n", "", token);
597 printf("%17s\"", "");
602 print_record(hammer_btree_elm_t elm)
604 struct buffer_info *data_buffer;
605 hammer_off_t data_offset;
607 hammer_data_ondisk_t data;
612 data_offset = elm->leaf.data_offset;
613 data_len = elm->leaf.data_len;
617 data = get_buffer_data(data_offset, &data_buffer, 0);
621 switch(elm->leaf.base.rec_type) {
622 case HAMMER_RECTYPE_UNKNOWN:
623 printf("\n%17s", "");
626 case HAMMER_RECTYPE_INODE:
627 printf("\n%17s", "");
628 printf("size=%jd nlinks=%jd",
629 (intmax_t)data->inode.size,
630 (intmax_t)data->inode.nlinks);
632 printf(" mode=%05o uflags=%08x\n",
636 printf("ctime=%016jx pobjid=%016jx obj_type=%d\n",
637 (uintmax_t)data->inode.ctime,
638 (uintmax_t)data->inode.parent_obj_id,
639 data->inode.obj_type);
641 printf("mtime=%016jx", (uintmax_t)data->inode.mtime);
642 printf(" caps=%02x", data->inode.cap_flags);
645 case HAMMER_RECTYPE_DIRENTRY:
646 printf("\n%17s", "");
647 data_len -= HAMMER_ENTRY_NAME_OFF;
648 printf("dir-entry ino=%016jx lo=%08x name=\"%*.*s\"",
649 (uintmax_t)data->entry.obj_id,
650 data->entry.localization,
651 data_len, data_len, data->entry.name);
653 case HAMMER_RECTYPE_FIX:
654 switch(elm->leaf.base.key) {
655 case HAMMER_FIXKEY_SYMLINK:
656 data_len -= HAMMER_SYMLINK_NAME_OFF;
657 printf("\n%17s", "");
658 printf("symlink=\"%*.*s\"", data_len, data_len,
665 case HAMMER_RECTYPE_PFS:
666 printf("\n%17s", "");
667 printf("sync_beg_tid=%016jx sync_end_tid=%016jx\n",
668 (intmax_t)data->pfsd.sync_beg_tid,
669 (intmax_t)data->pfsd.sync_end_tid);
670 uuid_to_string(&data->pfsd.shared_uuid, &str1, &status);
671 uuid_to_string(&data->pfsd.unique_uuid, &str2, &status);
673 printf("shared_uuid=%s\n", str1);
675 printf("unique_uuid=%s\n", str2);
677 printf("mirror_flags=%08x label=\"%s\"",
678 data->pfsd.mirror_flags, data->pfsd.label);
679 if (data->pfsd.snapshots[0])
680 printf(" snapshots=\"%s\"", data->pfsd.snapshots);
684 case HAMMER_RECTYPE_SNAPSHOT:
685 printf("\n%17s", "");
686 printf("tid=%016jx label=\"%s\"",
687 (intmax_t)data->snap.tid, data->snap.label);
689 case HAMMER_RECTYPE_CONFIG:
690 if (VerboseOpt > 2) {
691 print_config(data->config.text);
694 case HAMMER_RECTYPE_DATA:
695 if (VerboseOpt > 3) {
697 hexdump(data, data_len, "\t\t ", 0);
700 case HAMMER_RECTYPE_EXT:
701 case HAMMER_RECTYPE_DB:
702 if (VerboseOpt > 2) {
704 hexdump(data, data_len, "\t\t ", 0);
710 rel_buffer(data_buffer);
715 _strtoul(const char *p, int base)
717 unsigned long retval;
719 errno = 0; /* clear */
720 retval = strtoul(p, NULL, base);
721 if (errno == ERANGE && retval == ULONG_MAX)
728 _strtoull(const char *p, int base)
730 unsigned long long retval;
732 errno = 0; /* clear */
733 retval = strtoull(p, NULL, base);
734 if (errno == ERANGE && retval == ULLONG_MAX)
740 init_btree_search(const char *arg, int filter, btree_search_t search)
746 search->obj_id = (int64_t)HAMMER_MIN_OBJID;
747 search->rec_type = HAMMER_RECTYPE_LOWEST;
749 search->create_tid = 0;
751 search->filter = filter;
757 while ((p = s) != NULL) {
758 if ((s = strchr(s, ':')) != NULL)
761 search->lo = _strtoul(p, 16);
763 search->obj_id = _strtoull(p, 16);
765 search->rec_type = _strtoul(p, 16);
767 search->key = _strtoull(p, 16);
769 search->create_tid = _strtoull(p, 16);
779 test_btree_search(hammer_btree_elm_t elm, btree_search_t search)
781 hammer_base_elm_t base = &elm->base;
784 if (base->localization < search->lo)
786 if (base->localization > search->lo)
790 if (base->obj_id < search->obj_id)
792 if (base->obj_id > search->obj_id)
794 if (search->limit == 2)
795 return(0); /* ignore below */
797 if (base->rec_type < search->rec_type)
799 if (base->rec_type > search->rec_type)
801 if (search->limit == 3)
802 return(0); /* ignore below */
804 if (base->key < search->key)
806 if (base->key > search->key)
808 if (search->limit == 4)
809 return(0); /* ignore below */
811 if (base->create_tid == 0) {
812 if (search->create_tid == 0)
816 if (search->create_tid == 0)
818 if (base->create_tid < search->create_tid)
820 if (base->create_tid > search->create_tid)
829 hammer_cmd_show_undo(void)
831 struct volume_info *volume;
832 hammer_blockmap_t rootmap;
833 hammer_off_t scan_offset;
834 hammer_fifo_any_t head;
835 struct buffer_info *data_buffer = NULL;
838 volume = get_volume(RootVolNo);
839 rootmap = &volume->ondisk->vol0_blockmap[HAMMER_ZONE_UNDO_INDEX];
840 if (rootmap->first_offset <= rootmap->next_offset)
841 bytes = rootmap->next_offset - rootmap->first_offset;
843 bytes = rootmap->alloc_offset - rootmap->first_offset +
844 (rootmap->next_offset & HAMMER_OFF_LONG_MASK);
846 printf("Volume header UNDO %016jx-%016jx/%016jx\n",
847 (intmax_t)rootmap->first_offset,
848 (intmax_t)rootmap->next_offset,
849 (intmax_t)rootmap->alloc_offset);
850 printf("UNDO map is %jdMB\n",
851 (intmax_t)((rootmap->alloc_offset & HAMMER_OFF_LONG_MASK) /
853 printf("UNDO being used is %jdB\n", (intmax_t)bytes);
855 scan_offset = HAMMER_ZONE_ENCODE(HAMMER_ZONE_UNDO_INDEX, 0);
856 while (scan_offset < rootmap->alloc_offset) {
857 head = get_buffer_data(scan_offset, &data_buffer, 0);
858 printf("%016jx ", scan_offset);
860 switch(head->head.hdr_type) {
861 case HAMMER_HEAD_TYPE_PAD:
862 printf("PAD(%04x)", head->head.hdr_size);
864 case HAMMER_HEAD_TYPE_DUMMY:
865 printf("DUMMY(%04x) seq=%08x",
866 head->head.hdr_size, head->head.hdr_seq);
868 case HAMMER_HEAD_TYPE_UNDO:
869 printf("UNDO(%04x) seq=%08x "
870 "dataoff=%016jx bytes=%d",
871 head->head.hdr_size, head->head.hdr_seq,
872 (intmax_t)head->undo.undo_offset,
873 head->undo.undo_data_bytes);
875 case HAMMER_HEAD_TYPE_REDO:
876 printf("REDO(%04x) seq=%08x flags=%08x "
877 "objid=%016jx logoff=%016jx bytes=%d",
878 head->head.hdr_size, head->head.hdr_seq,
879 head->redo.redo_flags,
880 (intmax_t)head->redo.redo_objid,
881 (intmax_t)head->redo.redo_offset,
882 head->redo.redo_data_bytes);
885 printf("UNKNOWN(%04x,%04x) seq=%08x",
892 if (scan_offset == rootmap->first_offset)
894 if (scan_offset == rootmap->next_offset)
898 if ((head->head.hdr_size & HAMMER_HEAD_ALIGN_MASK) ||
899 head->head.hdr_size == 0 ||
900 head->head.hdr_size > HAMMER_UNDO_ALIGN -
901 ((u_int)scan_offset & HAMMER_UNDO_MASK)) {
902 printf("Illegal size field, skipping to "
904 scan_offset = (scan_offset + HAMMER_UNDO_MASK) &
907 scan_offset += head->head.hdr_size;
910 rel_buffer(data_buffer);