diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2009-10-15 18:26:50 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2009-10-15 18:26:50 (GMT) |
commit | d38b38db5a78e1d47a7610b00c65f54b5533de0c (patch) | |
tree | e2dd16037e239fa45552f2fa113a4e6caa9287aa /src/H5B2dbg.c | |
parent | f7b06c8505eee62e54e295468b45ebcfd0f2cf65 (diff) | |
download | hdf5-d38b38db5a78e1d47a7610b00c65f54b5533de0c.zip hdf5-d38b38db5a78e1d47a7610b00c65f54b5533de0c.tar.gz hdf5-d38b38db5a78e1d47a7610b00c65f54b5533de0c.tar.bz2 |
[svn-r17649] Description:
Refactor v2 B-trees to pin the B-tree header in the cache instead of
using separate reference counted data structure.
Tested on:
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (jam) w/PGI compilers, w/default API=1.8.x,
w/C++ & FORTRAN, w/threadsafe, in debug mode
Linux/64-amd64 2.6 (smirom) w/Intel compilers, w/default API=1.6.x,
w/C++ & FORTRAN, in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in debug mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
Mac OS X/32 10.6.1 (amazon) in debug mode
Mac OS X/32 10.6.1 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
Diffstat (limited to 'src/H5B2dbg.c')
-rw-r--r-- | src/H5B2dbg.c | 161 |
1 files changed, 79 insertions, 82 deletions
diff --git a/src/H5B2dbg.c b/src/H5B2dbg.c index 836486e..573fee8 100644 --- a/src/H5B2dbg.c +++ b/src/H5B2dbg.c @@ -91,9 +91,8 @@ H5B2_hdr_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, const H5B2_class_t *type) { H5B2_t *bt2 = NULL; /* B-tree header info */ - H5B2_shared_t *shared; /* Shared B-tree information */ unsigned u; /* Local index variable */ - char temp_str[128]; /* Temporary string, for formatting */ + char temp_str[128]; /* Temporary string, for formatting */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5B2_hdr_debug, FAIL) @@ -114,9 +113,8 @@ H5B2_hdr_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, if(NULL == (bt2 = (H5B2_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, type, NULL, H5AC_READ))) HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load B-tree header") - /* Get the pointer to the shared B-tree info */ - shared = (H5B2_shared_t *)H5RC_GET_OBJ(bt2->shared); - HDassert(shared); + /* Set file pointer for this B-tree operation */ + bt2->f = f; /* Print opening message */ HDfprintf(stream, "%*sv2 B-tree Header...\n", indent, ""); @@ -126,29 +124,29 @@ H5B2_hdr_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, */ HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Tree type ID:", - (shared->type->id == H5B2_TEST_ID ? "H5B2_TEST_ID" : - (shared->type->id == H5B2_FHEAP_HUGE_INDIR_ID ? "H5B2_FHEAP_HUGE_INDIR_ID" : - (shared->type->id == H5B2_FHEAP_HUGE_FILT_INDIR_ID ? "H5B2_FHEAP_HUGE_FILT_INDIR_ID" : - (shared->type->id == H5B2_FHEAP_HUGE_DIR_ID ? "H5B2_FHEAP_HUGE_DIR_ID" : - (shared->type->id == H5B2_FHEAP_HUGE_FILT_DIR_ID ? "H5B2_FHEAP_HUGE_FILT_DIR_ID" : - (shared->type->id == H5B2_GRP_DENSE_NAME_ID ? "H5B2_GRP_DENSE_NAME_ID" : - (shared->type->id == H5B2_GRP_DENSE_CORDER_ID ? "H5B2_GRP_DENSE_CORDER_ID" : - (shared->type->id == H5B2_SOHM_INDEX_ID ? "H5B2_SOHM_INDEX_ID" : - (shared->type->id == H5B2_ATTR_DENSE_NAME_ID ? "H5B2_ATTR_DENSE_NAME_ID" : - (shared->type->id == H5B2_ATTR_DENSE_CORDER_ID ? "H5B2_ATTR_DENSE_CORDER_ID" : + (bt2->type->id == H5B2_TEST_ID ? "H5B2_TEST_ID" : + (bt2->type->id == H5B2_FHEAP_HUGE_INDIR_ID ? "H5B2_FHEAP_HUGE_INDIR_ID" : + (bt2->type->id == H5B2_FHEAP_HUGE_FILT_INDIR_ID ? "H5B2_FHEAP_HUGE_FILT_INDIR_ID" : + (bt2->type->id == H5B2_FHEAP_HUGE_DIR_ID ? "H5B2_FHEAP_HUGE_DIR_ID" : + (bt2->type->id == H5B2_FHEAP_HUGE_FILT_DIR_ID ? "H5B2_FHEAP_HUGE_FILT_DIR_ID" : + (bt2->type->id == H5B2_GRP_DENSE_NAME_ID ? "H5B2_GRP_DENSE_NAME_ID" : + (bt2->type->id == H5B2_GRP_DENSE_CORDER_ID ? "H5B2_GRP_DENSE_CORDER_ID" : + (bt2->type->id == H5B2_SOHM_INDEX_ID ? "H5B2_SOHM_INDEX_ID" : + (bt2->type->id == H5B2_ATTR_DENSE_NAME_ID ? "H5B2_ATTR_DENSE_NAME_ID" : + (bt2->type->id == H5B2_ATTR_DENSE_CORDER_ID ? "H5B2_ATTR_DENSE_CORDER_ID" : "Unknown!"))))))))))); HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, "Size of node:", - shared->node_size); + bt2->node_size); HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, "Size of raw (disk) record:", - shared->rrec_size); + bt2->rrec_size); HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Dirty flag:", bt2->cache_info.is_dirty ? "True" : "False"); HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Depth:", - shared->depth); + bt2->depth); HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, "Number of records in tree:", bt2->root.all_nrec); @@ -160,23 +158,26 @@ H5B2_hdr_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, bt2->root.addr); HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Split percent:", - shared->split_percent); + bt2->split_percent); HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Merge percent:", - shared->merge_percent); + bt2->merge_percent); /* Print relevant node info */ HDfprintf(stream, "%*sNode Info: (max_nrec/split_nrec/merge_nrec)\n", indent, ""); - for(u = 0; u < (shared->depth + 1); u++) { + for(u = 0; u < (bt2->depth + 1); u++) { sprintf(temp_str, "Depth %u:", u); HDfprintf(stream, "%*s%-*s (%u/%u/%u)\n", indent + 3, "", MAX(0, fwidth - 3), temp_str, - shared->node_info[u].max_nrec, shared->node_info[u].split_nrec, shared->node_info[u].merge_nrec); + bt2->node_info[u].max_nrec, bt2->node_info[u].split_nrec, bt2->node_info[u].merge_nrec); } /* end for */ done: - if(bt2 && H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, addr, bt2, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release B-tree header") + if(bt2) { + bt2->f = NULL; + if(H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, addr, bt2, H5AC__NO_FLAGS_SET) < 0) + HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release B-tree header") + } /* end if */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5B2_hdr_debug() */ @@ -199,11 +200,10 @@ herr_t H5B2_int_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, int fwidth, const H5B2_class_t *type, haddr_t hdr_addr, unsigned nrec, unsigned depth) { - H5B2_t *bt2 = NULL; - H5B2_internal_t *internal = NULL; - H5B2_shared_t *shared; /* Shared B-tree information */ - unsigned u; /* Local index variable */ - char temp_str[128]; /* Temporary string, for formatting */ + H5B2_t *bt2 = NULL; /* B-tree header */ + H5B2_internal_t *internal = NULL; /* B-tree internal node */ + unsigned u; /* Local index variable */ + char temp_str[128]; /* Temporary string, for formatting */ herr_t ret_value=SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5B2_int_debug, FAIL) @@ -226,21 +226,15 @@ H5B2_int_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, if(NULL == (bt2 = (H5B2_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, hdr_addr, type, NULL, H5AC_READ))) HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load B-tree header") - /* Get the pointer to the shared B-tree info */ - shared = (H5B2_shared_t *)H5RC_GET_OBJ(bt2->shared); - HDassert(shared); + /* Set file pointer for this B-tree operation */ + bt2->f = f; /* * Load the B-tree internal node */ - if(NULL == (internal = H5B2_protect_internal(f, dxpl_id, bt2->shared, addr, nrec, depth, H5AC_READ))) + if(NULL == (internal = H5B2_protect_internal(f, dxpl_id, bt2, addr, nrec, depth, H5AC_READ))) HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load B-tree internal node") - /* Release the B-tree header */ - if(H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, hdr_addr, bt2, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release B-tree header") - bt2 = NULL; - /* Print opening message */ if(internal->depth == 1) HDfprintf(stream, "%*sv2 B-tree Internal 'Leaf' Node...\n", indent, ""); @@ -252,23 +246,23 @@ H5B2_int_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, */ HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Tree type ID:", - (shared->type->id == H5B2_TEST_ID ? "H5B2_TEST_ID" : - (shared->type->id == H5B2_FHEAP_HUGE_INDIR_ID ? "H5B2_FHEAP_HUGE_INDIR_ID" : - (shared->type->id == H5B2_FHEAP_HUGE_FILT_INDIR_ID ? "H5B2_FHEAP_HUGE_FILT_INDIR_ID" : - (shared->type->id == H5B2_FHEAP_HUGE_DIR_ID ? "H5B2_FHEAP_HUGE_DIR_ID" : - (shared->type->id == H5B2_FHEAP_HUGE_FILT_DIR_ID ? "H5B2_FHEAP_HUGE_FILT_DIR_ID" : - (shared->type->id == H5B2_GRP_DENSE_NAME_ID ? "H5B2_GRP_DENSE_NAME_ID" : - (shared->type->id == H5B2_GRP_DENSE_CORDER_ID ? "H5B2_GRP_DENSE_CORDER_ID" : - (shared->type->id == H5B2_SOHM_INDEX_ID ? "H5B2_SOHM_INDEX_ID" : - (shared->type->id == H5B2_ATTR_DENSE_NAME_ID ? "H5B2_ATTR_DENSE_NAME_ID" : - (shared->type->id == H5B2_ATTR_DENSE_CORDER_ID ? "H5B2_ATTR_DENSE_CORDER_ID" : + (bt2->type->id == H5B2_TEST_ID ? "H5B2_TEST_ID" : + (bt2->type->id == H5B2_FHEAP_HUGE_INDIR_ID ? "H5B2_FHEAP_HUGE_INDIR_ID" : + (bt2->type->id == H5B2_FHEAP_HUGE_FILT_INDIR_ID ? "H5B2_FHEAP_HUGE_FILT_INDIR_ID" : + (bt2->type->id == H5B2_FHEAP_HUGE_DIR_ID ? "H5B2_FHEAP_HUGE_DIR_ID" : + (bt2->type->id == H5B2_FHEAP_HUGE_FILT_DIR_ID ? "H5B2_FHEAP_HUGE_FILT_DIR_ID" : + (bt2->type->id == H5B2_GRP_DENSE_NAME_ID ? "H5B2_GRP_DENSE_NAME_ID" : + (bt2->type->id == H5B2_GRP_DENSE_CORDER_ID ? "H5B2_GRP_DENSE_CORDER_ID" : + (bt2->type->id == H5B2_SOHM_INDEX_ID ? "H5B2_SOHM_INDEX_ID" : + (bt2->type->id == H5B2_ATTR_DENSE_NAME_ID ? "H5B2_ATTR_DENSE_NAME_ID" : + (bt2->type->id == H5B2_ATTR_DENSE_CORDER_ID ? "H5B2_ATTR_DENSE_CORDER_ID" : "Unknown!"))))))))))); HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, "Size of node:", - shared->node_size); + bt2->node_size); HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, "Size of raw (disk) record:", - shared->rrec_size); + bt2->rrec_size); HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Dirty flag:", internal->cache_info.is_dirty ? "True" : "False"); @@ -290,9 +284,9 @@ H5B2_int_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, sprintf(temp_str, "Record #%u:", u); HDfprintf(stream, "%*s%-*s\n", indent + 3, "", MAX(0, fwidth - 3), temp_str); - HDassert(H5B2_INT_NREC(internal, shared, u)); + HDassert(H5B2_INT_NREC(internal, bt2, u)); (void)(type->debug)(stream, f, dxpl_id, indent + 6, MAX (0, fwidth-6), - H5B2_INT_NREC(internal,shared,u), NULL); + H5B2_INT_NREC(internal, bt2, u), NULL); } /* end for */ /* Print final node pointer */ @@ -304,6 +298,11 @@ H5B2_int_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, internal->node_ptrs[u].addr); done: + if(bt2) { + bt2->f = NULL; + if(H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, hdr_addr, bt2, H5AC__NO_FLAGS_SET) < 0) + HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release B-tree header") + } /* end if */ if(internal && H5AC_unprotect(f, dxpl_id, H5AC_BT2_INT, addr, internal, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release B-tree internal node") @@ -328,12 +327,11 @@ herr_t H5B2_leaf_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, int fwidth, const H5B2_class_t *type, haddr_t hdr_addr, unsigned nrec) { - H5B2_t *bt2 = NULL; - H5B2_leaf_t *leaf = NULL; - H5B2_shared_t *shared; /* Shared B-tree information */ - unsigned u; /* Local index variable */ - char temp_str[128]; /* Temporary string, for formatting */ - herr_t ret_value=SUCCEED; /* Return value */ + H5B2_t *bt2 = NULL; /* B-tree header */ + H5B2_leaf_t *leaf = NULL; /* B-tree leaf node */ + unsigned u; /* Local index variable */ + char temp_str[128]; /* Temporary string, for formatting */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5B2_leaf_debug, FAIL) @@ -355,21 +353,15 @@ H5B2_leaf_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, if(NULL == (bt2 = (H5B2_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, hdr_addr, type, NULL, H5AC_READ))) HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load B-tree header") - /* Get the pointer to the shared B-tree info */ - shared = (H5B2_shared_t *)H5RC_GET_OBJ(bt2->shared); - HDassert(shared); + /* Set file pointer for this B-tree operation */ + bt2->f = f; /* * Load the B-tree leaf node */ - if(NULL == (leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_LEAF, addr, &nrec, bt2->shared, H5AC_READ))) + if(NULL == (leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_LEAF, addr, &nrec, bt2, H5AC_READ))) HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load B-tree leaf node") - /* Release the B-tree header */ - if(H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, hdr_addr, bt2, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release B-tree header") - bt2 = NULL; - /* Print opening message */ HDfprintf(stream, "%*sv2 B-tree Leaf Node...\n", indent, ""); @@ -378,23 +370,23 @@ H5B2_leaf_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, */ HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Tree type ID:", - (shared->type->id == H5B2_TEST_ID ? "H5B2_TEST_ID" : - (shared->type->id == H5B2_FHEAP_HUGE_INDIR_ID ? "H5B2_FHEAP_HUGE_INDIR_ID" : - (shared->type->id == H5B2_FHEAP_HUGE_FILT_INDIR_ID ? "H5B2_FHEAP_HUGE_FILT_INDIR_ID" : - (shared->type->id == H5B2_FHEAP_HUGE_DIR_ID ? "H5B2_FHEAP_HUGE_DIR_ID" : - (shared->type->id == H5B2_FHEAP_HUGE_FILT_DIR_ID ? "H5B2_FHEAP_HUGE_FILT_DIR_ID" : - (shared->type->id == H5B2_GRP_DENSE_NAME_ID ? "H5B2_GRP_DENSE_NAME_ID" : - (shared->type->id == H5B2_GRP_DENSE_CORDER_ID ? "H5B2_GRP_DENSE_CORDER_ID" : - (shared->type->id == H5B2_SOHM_INDEX_ID ? "H5B2_SOHM_INDEX_ID" : - (shared->type->id == H5B2_ATTR_DENSE_NAME_ID ? "H5B2_ATTR_DENSE_NAME_ID" : - (shared->type->id == H5B2_ATTR_DENSE_CORDER_ID ? "H5B2_ATTR_DENSE_CORDER_ID" : + (bt2->type->id == H5B2_TEST_ID ? "H5B2_TEST_ID" : + (bt2->type->id == H5B2_FHEAP_HUGE_INDIR_ID ? "H5B2_FHEAP_HUGE_INDIR_ID" : + (bt2->type->id == H5B2_FHEAP_HUGE_FILT_INDIR_ID ? "H5B2_FHEAP_HUGE_FILT_INDIR_ID" : + (bt2->type->id == H5B2_FHEAP_HUGE_DIR_ID ? "H5B2_FHEAP_HUGE_DIR_ID" : + (bt2->type->id == H5B2_FHEAP_HUGE_FILT_DIR_ID ? "H5B2_FHEAP_HUGE_FILT_DIR_ID" : + (bt2->type->id == H5B2_GRP_DENSE_NAME_ID ? "H5B2_GRP_DENSE_NAME_ID" : + (bt2->type->id == H5B2_GRP_DENSE_CORDER_ID ? "H5B2_GRP_DENSE_CORDER_ID" : + (bt2->type->id == H5B2_SOHM_INDEX_ID ? "H5B2_SOHM_INDEX_ID" : + (bt2->type->id == H5B2_ATTR_DENSE_NAME_ID ? "H5B2_ATTR_DENSE_NAME_ID" : + (bt2->type->id == H5B2_ATTR_DENSE_CORDER_ID ? "H5B2_ATTR_DENSE_CORDER_ID" : "Unknown!"))))))))))); HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, "Size of node:", - shared->node_size); + bt2->node_size); HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, "Size of raw (disk) record:", - shared->rrec_size); + bt2->rrec_size); HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Dirty flag:", leaf->cache_info.is_dirty ? "True" : "False"); @@ -408,12 +400,17 @@ H5B2_leaf_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, sprintf(temp_str, "Record #%u:", u); HDfprintf(stream, "%*s%-*s\n", indent + 3, "", MAX(0, fwidth - 3), temp_str); - HDassert(H5B2_LEAF_NREC(leaf, shared, u)); - (void)(type->debug)(stream, f, dxpl_id, indent+6, MAX (0, fwidth-6), - H5B2_LEAF_NREC(leaf,shared,u), NULL); + HDassert(H5B2_LEAF_NREC(leaf, bt2, u)); + (void)(type->debug)(stream, f, dxpl_id, indent + 6, MAX (0, fwidth-6), + H5B2_LEAF_NREC(leaf, bt2, u), NULL); } /* end for */ done: + if(bt2) { + bt2->f = NULL; + if(H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, hdr_addr, bt2, H5AC__NO_FLAGS_SET) < 0) + HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release B-tree header") + } /* end if */ if(leaf && H5AC_unprotect(f, dxpl_id, H5AC_BT2_LEAF, addr, leaf, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release B-tree leaf node") |