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;
87 stats = hammer_init_zone_stat();
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);
186 hammer_add_zone_stat(stats, node_offset, sizeof(*node));
188 maxcount = hammer_node_max_elements(node->type);
189 assert(maxcount != -1);
191 for (i = 0; i < node->count && i < maxcount; ++i) {
192 elm = &node->elms[i];
194 if (node->type != HAMMER_BTREE_TYPE_INTERNAL) {
196 if (search && test_btree_search(elm, search) == 0)
200 if (test_btree_search(elm, search) > 0 ||
201 test_btree_search(elm + 1, search) < 0)
207 flags = get_elm_flags(node, node_offset,
208 elm, elm->base.btype,
209 left_bound, right_bound);
210 print_btree_elm(elm, i, node->type, flags, "ELM", ext, stats);
212 if (node->type == HAMMER_BTREE_TYPE_INTERNAL) {
213 elm = &node->elms[i];
215 flags = get_elm_flags(node, node_offset,
217 left_bound, right_bound);
218 print_btree_elm(elm, i, node->type, flags, "RBN", NULL, stats);
222 for (i = 0; i < node->count; ++i) {
223 elm = &node->elms[i];
226 case HAMMER_BTREE_TYPE_INTERNAL:
227 if (search && search->filter) {
228 if (test_btree_search(elm, search) > 0 ||
229 test_btree_search(elm + 1, search) < 0)
232 if (elm->internal.subtree_offset) {
233 print_btree_node(elm->internal.subtree_offset,
235 elm->internal.mirror_tid,
236 &elm[0].base, &elm[1].base,
239 * Cause show to do normal iteration after
240 * seeking to the lo:objid:rectype:key:tid
243 if (search && search->filter == -1) /* default */
256 is_root_btree_beg(u_int8_t type, int i, hammer_btree_elm_t elm)
258 return (type == HAMMER_BTREE_TYPE_INTERNAL &&
260 elm->base.localization == 0 &&
261 elm->base.obj_id == (int64_t)-0x8000000000000000LL &&
262 elm->base.key == (int64_t)-0x8000000000000000LL &&
263 elm->base.create_tid == 1 &&
264 elm->base.delete_tid == 1 &&
265 elm->base.rec_type == 0 &&
266 elm->base.obj_type == 0 &&
267 elm->base.btype != 0); /* depends on the original node */
272 is_root_btree_end(u_int8_t type, int i, hammer_btree_elm_t elm)
274 return (type == HAMMER_BTREE_TYPE_INTERNAL &&
276 elm->base.localization == 0xFFFFFFFFU &&
277 elm->base.obj_id == 0x7FFFFFFFFFFFFFFFLL &&
278 elm->base.key == 0x7FFFFFFFFFFFFFFFLL &&
279 elm->base.create_tid == 0xFFFFFFFFFFFFFFFFULL &&
280 elm->base.delete_tid == 0 &&
281 elm->base.rec_type == 0xFFFFU &&
282 elm->base.obj_type == 0 &&
283 elm->base.btype == 0); /* not initialized */
288 print_btree_elm(hammer_btree_elm_t elm, int i, u_int8_t type,
289 int flags, const char *label, const char *ext,
290 struct zone_stat *stats)
292 char flagstr[8] = { 0, '-', '-', '-', '-', '-', '-', 0 };
296 flagstr[0] = flags ? 'B' : 'G';
297 if (flags & FLAG_TOOFARLEFT)
299 if (flags & FLAG_TOOFARRIGHT)
301 if (flags & FLAG_BADTYPE)
303 if (flags & FLAG_BADCHILDPARENT)
305 if (flags & FLAG_BADMIRRORTID)
309 * Check if elm is derived from root split
311 if (is_root_btree_beg(type, i, elm))
313 else if (is_root_btree_end(type, i, elm))
318 if (elm->base.delete_tid)
323 printf("%s\t%s %2d %c ",
325 (elm->base.btype ? elm->base.btype : '?'));
326 printf("lo=%08x obj=%016jx rt=%02x key=%016jx ot=%02x\n",
327 elm->base.localization,
328 (uintmax_t)elm->base.obj_id,
330 (uintmax_t)elm->base.key,
332 printf("\t %c tids %016jx:%016jx ",
333 (rootelm == ' ' ? deleted : rootelm),
334 (uintmax_t)elm->base.create_tid,
335 (uintmax_t)elm->base.delete_tid);
338 case HAMMER_BTREE_TYPE_INTERNAL:
339 printf("suboff=%016jx",
340 (uintmax_t)elm->internal.subtree_offset);
342 printf(" mirror %016jx",
343 (uintmax_t)elm->internal.mirror_tid);
348 case HAMMER_BTREE_TYPE_LEAF:
351 switch(elm->base.btype) {
352 case HAMMER_BTREE_TYPE_RECORD:
354 printf("\n%s\t ", check_data_crc(elm));
357 printf("dataoff=%016jx/%d",
358 (uintmax_t)elm->leaf.data_offset,
361 printf(" crc=%04x", elm->leaf.data_crc);
362 printf("\n\t fill=");
363 print_bigblock_fill(elm->leaf.data_offset);
368 hammer_add_zone_stat(stats,
369 elm->leaf.data_offset,
382 get_elm_flags(hammer_node_ondisk_t node, hammer_off_t node_offset,
383 hammer_btree_elm_t elm, u_int8_t btype,
384 hammer_base_elm_t left_bound, hammer_base_elm_t right_bound)
389 case HAMMER_BTREE_TYPE_INTERNAL:
390 if (elm->internal.subtree_offset) {
391 struct buffer_info *buffer = NULL;
392 hammer_node_ondisk_t subnode;
394 subnode = get_node(elm->internal.subtree_offset,
397 flags |= FLAG_BADCHILDPARENT;
398 else if (subnode->parent != node_offset)
399 flags |= FLAG_BADCHILDPARENT;
402 if (elm->internal.mirror_tid > node->mirror_tid)
403 flags |= FLAG_BADMIRRORTID;
406 case HAMMER_BTREE_TYPE_INTERNAL:
407 if (left_bound == NULL || right_bound == NULL)
409 if (hammer_btree_cmp(&elm->base, left_bound) < 0)
410 flags |= FLAG_TOOFARLEFT;
411 if (hammer_btree_cmp(&elm->base, right_bound) > 0)
412 flags |= FLAG_TOOFARRIGHT;
414 case HAMMER_BTREE_TYPE_LEAF:
415 if (left_bound == NULL || right_bound == NULL)
417 if (hammer_btree_cmp(&elm->base, left_bound) < 0)
418 flags |= FLAG_TOOFARLEFT;
419 if (hammer_btree_cmp(&elm->base, right_bound) >= 0)
420 flags |= FLAG_TOOFARRIGHT;
423 flags |= FLAG_BADTYPE;
427 case HAMMER_BTREE_TYPE_LEAF:
428 if (node->mirror_tid == 0 &&
429 !(node->parent == 0 && node->count == 2)) {
430 flags |= FLAG_BADMIRRORTID;
432 if (elm->base.create_tid && node->mirror_tid &&
433 elm->base.create_tid > node->mirror_tid) {
434 flags |= FLAG_BADMIRRORTID;
436 if (elm->base.delete_tid && node->mirror_tid &&
437 elm->base.delete_tid > node->mirror_tid) {
438 flags |= FLAG_BADMIRRORTID;
441 case HAMMER_BTREE_TYPE_RECORD:
442 if (left_bound == NULL || right_bound == NULL)
444 if (hammer_btree_cmp(&elm->base, left_bound) < 0)
445 flags |= FLAG_TOOFARLEFT;
446 if (hammer_btree_cmp(&elm->base, right_bound) >= 0)
447 flags |= FLAG_TOOFARRIGHT;
450 flags |= FLAG_BADTYPE;
455 flags |= FLAG_BADTYPE;
463 print_bigblock_fill(hammer_off_t offset)
465 struct hammer_blockmap_layer1 layer1;
466 struct hammer_blockmap_layer2 layer2;
470 blockmap_lookup(offset, &layer1, &layer2, &error);
472 printf("z%d:v%d:%lu:%lu:%lu=%d",
473 HAMMER_ZONE_DECODE(offset),
474 HAMMER_VOL_DECODE(offset),
475 HAMMER_BLOCKMAP_LAYER1_INDEX(offset),
476 HAMMER_BLOCKMAP_LAYER2_INDEX(offset),
477 offset & HAMMER_BIGBLOCK_MASK64,
480 fill = layer2.bytes_free * 100 / HAMMER_BIGBLOCK_SIZE;
483 printf("z%d:v%d:%lu:%lu:%lu=%d%%",
484 HAMMER_ZONE_DECODE(offset),
485 HAMMER_VOL_DECODE(offset),
486 HAMMER_BLOCKMAP_LAYER1_INDEX(offset),
487 HAMMER_BLOCKMAP_LAYER2_INDEX(offset),
488 offset & HAMMER_BIGBLOCK_MASK64,
494 * Check the generic crc on a data element. Inodes record types are
495 * special in that some of their fields are not CRCed.
497 * Also check that the zone is valid.
501 check_data_crc(hammer_btree_elm_t elm)
503 struct buffer_info *data_buffer;
504 hammer_off_t data_offset;
511 data_offset = elm->leaf.data_offset;
512 data_len = elm->leaf.data_len;
514 if (data_offset == 0 || data_len == 0)
520 blockmap_lookup(data_offset, NULL, NULL, &error);
524 ptr = get_buffer_data(data_offset, &data_buffer, 0);
525 len = HAMMER_BUFSIZE - ((int)data_offset & HAMMER_BUFMASK);
528 if (elm->leaf.base.rec_type == HAMMER_RECTYPE_INODE &&
529 data_len == sizeof(struct hammer_inode_data)) {
530 crc = crc32_ext(ptr, HAMMER_INODE_CRCSIZE, crc);
532 crc = crc32_ext(ptr, len, crc);
537 rel_buffer(data_buffer);
539 switch (error) { /* bad offset */
562 if (crc == elm->leaf.data_crc)
564 return("BX"); /* bad crc */
569 print_config(char *cfgtxt)
573 printf("\n%17stext=\"\n", "");
574 while((token = strsep(&cfgtxt, "\r\n")) != NULL) {
575 printf("%17s %s\n", "", token);
577 printf("%17s\"", "");
582 print_record(hammer_btree_elm_t elm)
584 struct buffer_info *data_buffer;
585 hammer_off_t data_offset;
587 hammer_data_ondisk_t data;
592 data_offset = elm->leaf.data_offset;
593 data_len = elm->leaf.data_len;
597 data = get_buffer_data(data_offset, &data_buffer, 0);
601 switch(elm->leaf.base.rec_type) {
602 case HAMMER_RECTYPE_UNKNOWN:
603 printf("\n%17s", "");
606 case HAMMER_RECTYPE_INODE:
607 printf("\n%17s", "");
608 printf("size=%jd nlinks=%jd",
609 (intmax_t)data->inode.size,
610 (intmax_t)data->inode.nlinks);
612 printf(" mode=%05o uflags=%08x\n",
616 printf("ctime=%016jx pobjid=%016jx obj_type=%d\n",
617 (uintmax_t)data->inode.ctime,
618 (uintmax_t)data->inode.parent_obj_id,
619 data->inode.obj_type);
621 printf("mtime=%016jx", (uintmax_t)data->inode.mtime);
622 printf(" caps=%02x", data->inode.cap_flags);
625 case HAMMER_RECTYPE_DIRENTRY:
626 printf("\n%17s", "");
627 data_len -= HAMMER_ENTRY_NAME_OFF;
628 printf("dir-entry ino=%016jx lo=%08x name=\"%*.*s\"",
629 (uintmax_t)data->entry.obj_id,
630 data->entry.localization,
631 data_len, data_len, data->entry.name);
633 case HAMMER_RECTYPE_FIX:
634 switch(elm->leaf.base.key) {
635 case HAMMER_FIXKEY_SYMLINK:
636 data_len -= HAMMER_SYMLINK_NAME_OFF;
637 printf("\n%17s", "");
638 printf("symlink=\"%*.*s\"", data_len, data_len,
645 case HAMMER_RECTYPE_PFS:
646 printf("\n%17s", "");
647 printf("sync_beg_tid=%016jx sync_end_tid=%016jx\n",
648 (intmax_t)data->pfsd.sync_beg_tid,
649 (intmax_t)data->pfsd.sync_end_tid);
650 uuid_to_string(&data->pfsd.shared_uuid, &str1, &status);
651 uuid_to_string(&data->pfsd.unique_uuid, &str2, &status);
653 printf("shared_uuid=%s\n", str1);
655 printf("unique_uuid=%s\n", str2);
657 printf("mirror_flags=%08x label=\"%s\"",
658 data->pfsd.mirror_flags, data->pfsd.label);
659 if (data->pfsd.snapshots[0])
660 printf(" snapshots=\"%s\"", data->pfsd.snapshots);
664 case HAMMER_RECTYPE_SNAPSHOT:
665 printf("\n%17s", "");
666 printf("tid=%016jx label=\"%s\"",
667 (intmax_t)data->snap.tid, data->snap.label);
669 case HAMMER_RECTYPE_CONFIG:
670 if (VerboseOpt > 2) {
671 print_config(data->config.text);
674 case HAMMER_RECTYPE_DATA:
675 if (VerboseOpt > 3) {
677 hexdump(data, data_len, "\t\t ", 0);
680 case HAMMER_RECTYPE_EXT:
681 case HAMMER_RECTYPE_DB:
682 if (VerboseOpt > 2) {
684 hexdump(data, data_len, "\t\t ", 0);
690 rel_buffer(data_buffer);
695 _strtoul(const char *p, int base)
697 unsigned long retval;
699 errno = 0; /* clear */
700 retval = strtoul(p, NULL, base);
701 if (errno == ERANGE && retval == ULONG_MAX)
708 _strtoull(const char *p, int base)
710 unsigned long long retval;
712 errno = 0; /* clear */
713 retval = strtoull(p, NULL, base);
714 if (errno == ERANGE && retval == ULLONG_MAX)
720 init_btree_search(const char *arg, int filter, btree_search_t search)
726 search->obj_id = (int64_t)HAMMER_MIN_OBJID;
727 search->rec_type = HAMMER_RECTYPE_LOWEST;
729 search->create_tid = 0;
731 search->filter = filter;
737 while ((p = s) != NULL) {
738 if ((s = strchr(s, ':')) != NULL)
741 search->lo = _strtoul(p, 16);
743 search->obj_id = _strtoull(p, 16);
745 search->rec_type = _strtoul(p, 16);
747 search->key = _strtoull(p, 16);
749 search->create_tid = _strtoull(p, 16);
759 test_btree_search(hammer_btree_elm_t elm, btree_search_t search)
761 hammer_base_elm_t base = &elm->base;
764 if (base->localization < search->lo)
766 if (base->localization > search->lo)
770 if (base->obj_id < search->obj_id)
772 if (base->obj_id > search->obj_id)
774 if (search->limit == 2)
775 return(0); /* ignore below */
777 if (base->rec_type < search->rec_type)
779 if (base->rec_type > search->rec_type)
781 if (search->limit == 3)
782 return(0); /* ignore below */
784 if (base->key < search->key)
786 if (base->key > search->key)
788 if (search->limit == 4)
789 return(0); /* ignore below */
791 if (base->create_tid == 0) {
792 if (search->create_tid == 0)
796 if (search->create_tid == 0)
798 if (base->create_tid < search->create_tid)
800 if (base->create_tid > search->create_tid)
809 hammer_cmd_show_undo(void)
811 struct volume_info *volume;
812 hammer_blockmap_t rootmap;
813 hammer_off_t scan_offset;
814 hammer_fifo_any_t head;
815 struct buffer_info *data_buffer = NULL;
818 volume = get_volume(RootVolNo);
819 rootmap = &volume->ondisk->vol0_blockmap[HAMMER_ZONE_UNDO_INDEX];
820 if (rootmap->first_offset <= rootmap->next_offset)
821 bytes = rootmap->next_offset - rootmap->first_offset;
823 bytes = rootmap->alloc_offset - rootmap->first_offset +
824 (rootmap->next_offset & HAMMER_OFF_LONG_MASK);
826 printf("Volume header UNDO %016jx-%016jx/%016jx\n",
827 (intmax_t)rootmap->first_offset,
828 (intmax_t)rootmap->next_offset,
829 (intmax_t)rootmap->alloc_offset);
830 printf("UNDO map is %jdMB\n",
831 (intmax_t)((rootmap->alloc_offset & HAMMER_OFF_LONG_MASK) /
833 printf("UNDO being used is %jdB\n", (intmax_t)bytes);
835 scan_offset = HAMMER_ZONE_ENCODE(HAMMER_ZONE_UNDO_INDEX, 0);
836 while (scan_offset < rootmap->alloc_offset) {
837 head = get_buffer_data(scan_offset, &data_buffer, 0);
838 printf("%016jx ", scan_offset);
840 switch(head->head.hdr_type) {
841 case HAMMER_HEAD_TYPE_PAD:
842 printf("PAD(%04x)", head->head.hdr_size);
844 case HAMMER_HEAD_TYPE_DUMMY:
845 printf("DUMMY(%04x) seq=%08x",
846 head->head.hdr_size, head->head.hdr_seq);
848 case HAMMER_HEAD_TYPE_UNDO:
849 printf("UNDO(%04x) seq=%08x "
850 "dataoff=%016jx bytes=%d",
851 head->head.hdr_size, head->head.hdr_seq,
852 (intmax_t)head->undo.undo_offset,
853 head->undo.undo_data_bytes);
855 case HAMMER_HEAD_TYPE_REDO:
856 printf("REDO(%04x) seq=%08x flags=%08x "
857 "objid=%016jx logoff=%016jx bytes=%d",
858 head->head.hdr_size, head->head.hdr_seq,
859 head->redo.redo_flags,
860 (intmax_t)head->redo.redo_objid,
861 (intmax_t)head->redo.redo_offset,
862 head->redo.redo_data_bytes);
865 printf("UNKNOWN(%04x,%04x) seq=%08x",
872 if (scan_offset == rootmap->first_offset)
874 if (scan_offset == rootmap->next_offset)
878 if ((head->head.hdr_size & HAMMER_HEAD_ALIGN_MASK) ||
879 head->head.hdr_size == 0 ||
880 head->head.hdr_size > HAMMER_UNDO_ALIGN -
881 ((u_int)scan_offset & HAMMER_UNDO_MASK)) {
882 printf("Illegal size field, skipping to "
884 scan_offset = (scan_offset + HAMMER_UNDO_MASK) &
887 scan_offset += head->head.hdr_size;
890 rel_buffer(data_buffer);