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
39 #define FLAG_TOOFARLEFT 0x0001
40 #define FLAG_TOOFARRIGHT 0x0002
41 #define FLAG_BADTYPE 0x0004
42 #define FLAG_BADCHILDPARENT 0x0008
43 #define FLAG_BADMIRRORTID 0x0010
45 typedef struct btree_search {
50 hammer_tid_t create_tid;
51 int limit; /* # of fields to test */
52 int filter; /* filter type (default -1) */
55 static void print_btree_node(hammer_off_t node_offset, btree_search_t search,
56 int depth, hammer_tid_t mirror_tid,
57 hammer_base_elm_t left_bound,
58 hammer_base_elm_t right_bound,
59 struct zone_stat *stats);
60 static const char *check_data_crc(hammer_btree_elm_t elm);
61 static void print_record(hammer_btree_elm_t elm);
62 static void print_btree_elm(hammer_btree_elm_t elm, int i, u_int8_t type,
63 int flags, const char *label, const char *ext,
64 struct zone_stat *stats);
65 static int get_elm_flags(hammer_node_ondisk_t node, hammer_off_t node_offset,
66 hammer_btree_elm_t elm, u_int8_t btype,
67 hammer_base_elm_t left_bound,
68 hammer_base_elm_t right_bound);
69 static void print_bigblock_fill(hammer_off_t offset);
70 static int init_btree_search(const char *arg, int filter,
71 btree_search_t search);
72 static int test_btree_search(hammer_btree_elm_t elm, btree_search_t search);
75 hammer_cmd_show(hammer_off_t node_offset, const char *arg,
76 int filter, int depth,
77 hammer_base_elm_t left_bound, hammer_base_elm_t right_bound)
79 struct volume_info *volume;
80 struct btree_search search;
81 btree_search_t searchp = NULL;
82 struct zone_stat *stats = NULL;
85 AssertOnFailure = (DebugOpt != 0);
88 stats = hammer_init_zone_stat_bits();
90 if (node_offset == (hammer_off_t)-1) {
91 volume = get_volume(RootVolNo);
92 node_offset = volume->ondisk->vol0_btree_root;
94 printf("Volume header\trecords=%jd next_tid=%016jx\n",
95 (intmax_t)volume->ondisk->vol0_stat_records,
96 (uintmax_t)volume->ondisk->vol0_next_tid);
97 printf("\t\tbufoffset=%016jx\n",
98 (uintmax_t)volume->ondisk->vol_buf_beg);
99 for (zone = 0; zone < HAMMER_MAX_ZONES; ++zone) {
100 printf("\t\tzone %d\tnext_offset=%016jx\n",
102 (uintmax_t)volume->ondisk->vol0_blockmap[zone].next_offset
109 printf("show %016jx", (uintmax_t)node_offset);
111 assert(init_btree_search(arg, filter, &search) != -1);
112 if (search.limit >= 1)
113 printf(" lo %08x obj_id %016jx",
114 search.lo, (uintmax_t)search.obj_id);
115 if (search.limit >= 3)
116 printf(" rec_type %02x", search.rec_type);
117 if (search.limit >= 4)
118 printf(" key %016jx", (uintmax_t)search.key);
119 if (search.limit == 5)
120 printf(" create_tid %016jx\n",
121 (uintmax_t)search.create_tid);
124 printf(" depth %d\n", depth);
125 print_btree_node(node_offset, searchp, depth, HAMMER_MAX_TID,
126 left_bound, right_bound, stats);
131 hammer_print_zone_stat(stats);
132 hammer_cleanup_zone_stat(stats);
137 print_btree_node(hammer_off_t node_offset, btree_search_t search,
138 int depth, hammer_tid_t mirror_tid,
139 hammer_base_elm_t left_bound, hammer_base_elm_t right_bound,
140 struct zone_stat *stats)
142 struct buffer_info *buffer = NULL;
143 hammer_node_ondisk_t node;
144 hammer_btree_elm_t elm;
152 node = get_node(node_offset, &buffer);
155 printf("BI NODE %016jx (IO ERROR)\n",
156 (uintmax_t)node_offset);
160 if (crc32(&node->crc + 1, HAMMER_BTREE_CRCSIZE) == node->crc)
165 if (node->mirror_tid <= mirror_tid) {
172 printf("%c%c NODE %016jx cnt=%02d p=%016jx "
176 (uintmax_t)node_offset, node->count,
177 (uintmax_t)node->parent,
178 (node->type ? node->type : '?'), depth);
179 printf(" mirror=%016jx", (uintmax_t)node->mirror_tid);
182 print_bigblock_fill(node_offset);
185 printf(" sign=%04x", node->signature);
189 hammer_add_zone_stat(stats, node_offset, sizeof(*node));
191 maxcount = hammer_node_max_elements(node->type);
192 assert(maxcount != -1);
194 for (i = 0; i < node->count && i < maxcount; ++i) {
195 elm = &node->elms[i];
197 if (node->type != HAMMER_BTREE_TYPE_INTERNAL) {
199 if (search && test_btree_search(elm, search) == 0)
203 if (test_btree_search(elm, search) > 0 ||
204 test_btree_search(elm + 1, search) < 0)
210 flags = get_elm_flags(node, node_offset,
211 elm, elm->base.btype,
212 left_bound, right_bound);
213 print_btree_elm(elm, i, node->type, flags, "ELM", ext, stats);
215 if (node->type == HAMMER_BTREE_TYPE_INTERNAL) {
216 elm = &node->elms[i];
218 flags = get_elm_flags(node, node_offset,
220 left_bound, right_bound);
221 print_btree_elm(elm, i, node->type, flags, "RBN", NULL, stats);
225 for (i = 0; i < node->count; ++i) {
226 elm = &node->elms[i];
229 case HAMMER_BTREE_TYPE_INTERNAL:
230 if (search && search->filter) {
231 if (test_btree_search(elm, search) > 0 ||
232 test_btree_search(elm + 1, search) < 0)
235 if (elm->internal.subtree_offset) {
236 print_btree_node(elm->internal.subtree_offset,
238 elm->internal.mirror_tid,
239 &elm[0].base, &elm[1].base,
242 * Cause show to do normal iteration after
243 * seeking to the lo:objid:rectype:key:tid
246 if (search && search->filter == -1) /* default */
259 is_root_btree_beg(u_int8_t type, int i, hammer_btree_elm_t elm)
262 * elm->base.btype depends on what the original node had
263 * so it could be anything but HAMMER_BTREE_TYPE_NONE.
265 return (type == HAMMER_BTREE_TYPE_INTERNAL &&
267 elm->base.localization == 0 &&
268 elm->base.obj_id == (int64_t)-0x8000000000000000LL &&
269 elm->base.key == (int64_t)-0x8000000000000000LL &&
270 elm->base.create_tid == 1 &&
271 elm->base.delete_tid == 1 &&
272 elm->base.rec_type == 0 &&
273 elm->base.obj_type == 0 &&
274 elm->base.btype != HAMMER_BTREE_TYPE_NONE);
279 is_root_btree_end(u_int8_t type, int i, hammer_btree_elm_t elm)
281 return (type == HAMMER_BTREE_TYPE_INTERNAL &&
283 elm->base.localization == 0xFFFFFFFFU &&
284 elm->base.obj_id == 0x7FFFFFFFFFFFFFFFLL &&
285 elm->base.key == 0x7FFFFFFFFFFFFFFFLL &&
286 elm->base.create_tid == 0xFFFFFFFFFFFFFFFFULL &&
287 elm->base.delete_tid == 0 &&
288 elm->base.rec_type == 0xFFFFU &&
289 elm->base.obj_type == 0 &&
290 elm->base.btype == HAMMER_BTREE_TYPE_NONE);
295 print_btree_elm(hammer_btree_elm_t elm, int i, u_int8_t type,
296 int flags, const char *label, const char *ext,
297 struct zone_stat *stats)
299 char flagstr[8] = { 0, '-', '-', '-', '-', '-', '-', 0 };
304 flagstr[0] = flags ? 'B' : 'G';
305 if (flags & FLAG_TOOFARLEFT)
307 if (flags & FLAG_TOOFARRIGHT)
309 if (flags & FLAG_BADTYPE)
311 if (flags & FLAG_BADCHILDPARENT)
313 if (flags & FLAG_BADMIRRORTID)
317 * Check if elm is derived from root split
319 if (is_root_btree_beg(type, i, elm))
321 else if (is_root_btree_end(type, i, elm))
326 if (elm->base.delete_tid)
331 switch(elm->base.btype) {
332 case HAMMER_BTREE_TYPE_INTERNAL:
333 case HAMMER_BTREE_TYPE_LEAF:
334 case HAMMER_BTREE_TYPE_RECORD:
335 case HAMMER_BTREE_TYPE_DELETED:
336 btype = elm->base.btype; /* ascii */
338 case HAMMER_BTREE_TYPE_NONE:
346 printf("%s\t%s %2d %c ", flagstr, label, i, btype);
347 printf("lo=%08x obj=%016jx rt=%02x key=%016jx ot=%02x\n",
348 elm->base.localization,
349 (uintmax_t)elm->base.obj_id,
351 (uintmax_t)elm->base.key,
353 printf("\t %c tids=%016jx:%016jx ",
354 (rootelm == ' ' ? deleted : rootelm),
355 (uintmax_t)elm->base.create_tid,
356 (uintmax_t)elm->base.delete_tid);
359 case HAMMER_BTREE_TYPE_INTERNAL:
360 printf("suboff=%016jx",
361 (uintmax_t)elm->internal.subtree_offset);
363 printf(" mirror=%016jx",
364 (uintmax_t)elm->internal.mirror_tid);
369 case HAMMER_BTREE_TYPE_LEAF:
372 switch(elm->base.btype) {
373 case HAMMER_BTREE_TYPE_RECORD:
375 printf("\n%s\t ", check_data_crc(elm));
378 printf("dataoff=%016jx/%d",
379 (uintmax_t)elm->leaf.data_offset,
382 printf(" crc=%04x", elm->leaf.data_crc);
383 printf("\n\t fill=");
384 print_bigblock_fill(elm->leaf.data_offset);
389 hammer_add_zone_stat(stats,
390 elm->leaf.data_offset,
395 printf("badtype=%d", elm->base.btype);
407 get_elm_flags(hammer_node_ondisk_t node, hammer_off_t node_offset,
408 hammer_btree_elm_t elm, u_int8_t btype,
409 hammer_base_elm_t left_bound, hammer_base_elm_t right_bound)
414 case HAMMER_BTREE_TYPE_INTERNAL:
415 if (elm->internal.subtree_offset) {
416 struct buffer_info *buffer = NULL;
417 hammer_node_ondisk_t subnode;
419 subnode = get_node(elm->internal.subtree_offset,
422 flags |= FLAG_BADCHILDPARENT;
423 else if (subnode->parent != node_offset)
424 flags |= FLAG_BADCHILDPARENT;
427 if (elm->internal.mirror_tid > node->mirror_tid)
428 flags |= FLAG_BADMIRRORTID;
431 case HAMMER_BTREE_TYPE_INTERNAL:
432 if (left_bound == NULL || right_bound == NULL)
434 if (hammer_btree_cmp(&elm->base, left_bound) < 0)
435 flags |= FLAG_TOOFARLEFT;
436 if (hammer_btree_cmp(&elm->base, right_bound) > 0)
437 flags |= FLAG_TOOFARRIGHT;
439 case HAMMER_BTREE_TYPE_LEAF:
440 if (left_bound == NULL || right_bound == NULL)
442 if (hammer_btree_cmp(&elm->base, left_bound) < 0)
443 flags |= FLAG_TOOFARLEFT;
444 if (hammer_btree_cmp(&elm->base, right_bound) >= 0)
445 flags |= FLAG_TOOFARRIGHT;
448 flags |= FLAG_BADTYPE;
452 case HAMMER_BTREE_TYPE_LEAF:
453 if (node->mirror_tid == 0 &&
454 !(node->parent == 0 && node->count == 2)) {
455 flags |= FLAG_BADMIRRORTID;
457 if (elm->base.create_tid && node->mirror_tid &&
458 elm->base.create_tid > node->mirror_tid) {
459 flags |= FLAG_BADMIRRORTID;
461 if (elm->base.delete_tid && node->mirror_tid &&
462 elm->base.delete_tid > node->mirror_tid) {
463 flags |= FLAG_BADMIRRORTID;
466 case HAMMER_BTREE_TYPE_RECORD:
467 if (left_bound == NULL || right_bound == NULL)
469 if (hammer_btree_cmp(&elm->base, left_bound) < 0)
470 flags |= FLAG_TOOFARLEFT;
471 if (hammer_btree_cmp(&elm->base, right_bound) >= 0)
472 flags |= FLAG_TOOFARRIGHT;
475 flags |= FLAG_BADTYPE;
480 flags |= FLAG_BADTYPE;
488 print_bigblock_fill(hammer_off_t offset)
490 struct hammer_blockmap_layer1 layer1;
491 struct hammer_blockmap_layer2 layer2;
495 blockmap_lookup(offset, &layer1, &layer2, &error);
496 printf("z%d:v%d:%lu:%lu:%lu=",
497 HAMMER_ZONE_DECODE(offset),
498 HAMMER_VOL_DECODE(offset),
499 HAMMER_BLOCKMAP_LAYER1_INDEX(offset),
500 HAMMER_BLOCKMAP_LAYER2_INDEX(offset),
501 offset & HAMMER_BIGBLOCK_MASK64);
504 printf("B%d", error);
506 fill = layer2.bytes_free * 100 / HAMMER_BIGBLOCK_SIZE;
508 printf("%d%%", fill);
513 * Check the generic crc on a data element. Inodes record types are
514 * special in that some of their fields are not CRCed.
516 * Also check that the zone is valid.
520 check_data_crc(hammer_btree_elm_t elm)
522 struct buffer_info *data_buffer;
523 hammer_off_t data_offset;
530 data_offset = elm->leaf.data_offset;
531 data_len = elm->leaf.data_len;
533 if (data_offset == 0 || data_len == 0)
539 blockmap_lookup(data_offset, NULL, NULL, &error);
543 ptr = get_buffer_data(data_offset, &data_buffer, 0);
544 len = HAMMER_BUFSIZE - ((int)data_offset & HAMMER_BUFMASK);
547 if (elm->leaf.base.rec_type == HAMMER_RECTYPE_INODE &&
548 data_len == sizeof(struct hammer_inode_data)) {
549 crc = crc32_ext(ptr, HAMMER_INODE_CRCSIZE, crc);
551 crc = crc32_ext(ptr, len, crc);
556 rel_buffer(data_buffer);
558 switch (error) { /* bad offset */
581 if (crc == elm->leaf.data_crc)
583 return("BX"); /* bad crc */
588 print_config(char *cfgtxt)
592 printf("\n%17stext=\"\n", "");
593 while((token = strsep(&cfgtxt, "\r\n")) != NULL) {
594 printf("%17s %s\n", "", token);
596 printf("%17s\"", "");
601 print_record(hammer_btree_elm_t elm)
603 struct buffer_info *data_buffer;
604 hammer_off_t data_offset;
606 hammer_data_ondisk_t data;
611 data_offset = elm->leaf.data_offset;
612 data_len = elm->leaf.data_len;
616 data = get_buffer_data(data_offset, &data_buffer, 0);
620 switch(elm->leaf.base.rec_type) {
621 case HAMMER_RECTYPE_UNKNOWN:
622 printf("\n%17s", "");
625 case HAMMER_RECTYPE_INODE:
626 printf("\n%17s", "");
627 printf("size=%jd nlinks=%jd",
628 (intmax_t)data->inode.size,
629 (intmax_t)data->inode.nlinks);
631 printf(" mode=%05o uflags=%08x\n",
635 printf("ctime=%016jx pobjid=%016jx obj_type=%d\n",
636 (uintmax_t)data->inode.ctime,
637 (uintmax_t)data->inode.parent_obj_id,
638 data->inode.obj_type);
640 printf("mtime=%016jx", (uintmax_t)data->inode.mtime);
641 printf(" caps=%02x", data->inode.cap_flags);
644 case HAMMER_RECTYPE_DIRENTRY:
645 printf("\n%17s", "");
646 data_len -= HAMMER_ENTRY_NAME_OFF;
647 printf("dir-entry ino=%016jx lo=%08x name=\"%*.*s\"",
648 (uintmax_t)data->entry.obj_id,
649 data->entry.localization,
650 data_len, data_len, data->entry.name);
652 case HAMMER_RECTYPE_FIX:
653 switch(elm->leaf.base.key) {
654 case HAMMER_FIXKEY_SYMLINK:
655 data_len -= HAMMER_SYMLINK_NAME_OFF;
656 printf("\n%17s", "");
657 printf("symlink=\"%*.*s\"", data_len, data_len,
664 case HAMMER_RECTYPE_PFS:
665 printf("\n%17s", "");
666 printf("sync_beg_tid=%016jx sync_end_tid=%016jx\n",
667 (intmax_t)data->pfsd.sync_beg_tid,
668 (intmax_t)data->pfsd.sync_end_tid);
669 uuid_to_string(&data->pfsd.shared_uuid, &str1, &status);
670 uuid_to_string(&data->pfsd.unique_uuid, &str2, &status);
672 printf("shared_uuid=%s\n", str1);
674 printf("unique_uuid=%s\n", str2);
676 printf("mirror_flags=%08x label=\"%s\"",
677 data->pfsd.mirror_flags, data->pfsd.label);
678 if (data->pfsd.snapshots[0])
679 printf(" snapshots=\"%s\"", data->pfsd.snapshots);
683 case HAMMER_RECTYPE_SNAPSHOT:
684 printf("\n%17s", "");
685 printf("tid=%016jx label=\"%s\"",
686 (intmax_t)data->snap.tid, data->snap.label);
688 case HAMMER_RECTYPE_CONFIG:
689 if (VerboseOpt > 2) {
690 print_config(data->config.text);
693 case HAMMER_RECTYPE_DATA:
694 if (VerboseOpt > 3) {
696 hexdump(data, data_len, "\t\t ", 0);
699 case HAMMER_RECTYPE_EXT:
700 case HAMMER_RECTYPE_DB:
701 if (VerboseOpt > 2) {
703 hexdump(data, data_len, "\t\t ", 0);
709 rel_buffer(data_buffer);
714 _strtoul(const char *p, int base)
716 unsigned long retval;
718 errno = 0; /* clear */
719 retval = strtoul(p, NULL, base);
720 if (errno == ERANGE && retval == ULONG_MAX)
727 _strtoull(const char *p, int base)
729 unsigned long long retval;
731 errno = 0; /* clear */
732 retval = strtoull(p, NULL, base);
733 if (errno == ERANGE && retval == ULLONG_MAX)
739 init_btree_search(const char *arg, int filter, btree_search_t search)
745 search->obj_id = (int64_t)HAMMER_MIN_OBJID;
746 search->rec_type = HAMMER_RECTYPE_LOWEST;
748 search->create_tid = 0;
750 search->filter = filter;
756 while ((p = s) != NULL) {
757 if ((s = strchr(s, ':')) != NULL)
760 search->lo = _strtoul(p, 16);
762 search->obj_id = _strtoull(p, 16);
764 search->rec_type = _strtoul(p, 16);
766 search->key = _strtoull(p, 16);
768 search->create_tid = _strtoull(p, 16);
778 test_btree_search(hammer_btree_elm_t elm, btree_search_t search)
780 hammer_base_elm_t base = &elm->base;
783 if (base->localization < search->lo)
785 if (base->localization > search->lo)
789 if (base->obj_id < search->obj_id)
791 if (base->obj_id > search->obj_id)
793 if (search->limit == 2)
794 return(0); /* ignore below */
796 if (base->rec_type < search->rec_type)
798 if (base->rec_type > search->rec_type)
800 if (search->limit == 3)
801 return(0); /* ignore below */
803 if (base->key < search->key)
805 if (base->key > search->key)
807 if (search->limit == 4)
808 return(0); /* ignore below */
810 if (base->create_tid == 0) {
811 if (search->create_tid == 0)
815 if (search->create_tid == 0)
817 if (base->create_tid < search->create_tid)
819 if (base->create_tid > search->create_tid)
828 hammer_cmd_show_undo(void)
830 struct volume_info *volume;
831 hammer_blockmap_t rootmap;
832 hammer_off_t scan_offset;
833 hammer_fifo_any_t head;
834 struct buffer_info *data_buffer = NULL;
837 volume = get_volume(RootVolNo);
838 rootmap = &volume->ondisk->vol0_blockmap[HAMMER_ZONE_UNDO_INDEX];
839 if (rootmap->first_offset <= rootmap->next_offset)
840 bytes = rootmap->next_offset - rootmap->first_offset;
842 bytes = rootmap->alloc_offset - rootmap->first_offset +
843 (rootmap->next_offset & HAMMER_OFF_LONG_MASK);
845 printf("Volume header UNDO %016jx-%016jx/%016jx\n",
846 (intmax_t)rootmap->first_offset,
847 (intmax_t)rootmap->next_offset,
848 (intmax_t)rootmap->alloc_offset);
849 printf("UNDO map is %jdMB\n",
850 (intmax_t)((rootmap->alloc_offset & HAMMER_OFF_LONG_MASK) /
852 printf("UNDO being used is %jdB\n", (intmax_t)bytes);
854 scan_offset = HAMMER_ZONE_ENCODE(HAMMER_ZONE_UNDO_INDEX, 0);
855 while (scan_offset < rootmap->alloc_offset) {
856 head = get_buffer_data(scan_offset, &data_buffer, 0);
857 printf("%016jx ", scan_offset);
859 switch(head->head.hdr_type) {
860 case HAMMER_HEAD_TYPE_PAD:
861 printf("PAD(%04x)", head->head.hdr_size);
863 case HAMMER_HEAD_TYPE_DUMMY:
864 printf("DUMMY(%04x) seq=%08x",
865 head->head.hdr_size, head->head.hdr_seq);
867 case HAMMER_HEAD_TYPE_UNDO:
868 printf("UNDO(%04x) seq=%08x "
869 "dataoff=%016jx bytes=%d",
870 head->head.hdr_size, head->head.hdr_seq,
871 (intmax_t)head->undo.undo_offset,
872 head->undo.undo_data_bytes);
874 case HAMMER_HEAD_TYPE_REDO:
875 printf("REDO(%04x) seq=%08x flags=%08x "
876 "objid=%016jx logoff=%016jx bytes=%d",
877 head->head.hdr_size, head->head.hdr_seq,
878 head->redo.redo_flags,
879 (intmax_t)head->redo.redo_objid,
880 (intmax_t)head->redo.redo_offset,
881 head->redo.redo_data_bytes);
884 printf("UNKNOWN(%04x,%04x) seq=%08x",
891 if (scan_offset == rootmap->first_offset)
893 if (scan_offset == rootmap->next_offset)
897 if ((head->head.hdr_size & HAMMER_HEAD_ALIGN_MASK) ||
898 head->head.hdr_size == 0 ||
899 head->head.hdr_size > HAMMER_UNDO_ALIGN -
900 ((u_int)scan_offset & HAMMER_UNDO_MASK)) {
901 printf("Illegal size field, skipping to "
903 scan_offset = (scan_offset + HAMMER_UNDO_MASK) &
906 scan_offset += head->head.hdr_size;
909 rel_buffer(data_buffer);