diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2009-11-13 23:37:10 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2009-11-13 23:37:10 (GMT) |
commit | b56de1ddcc91e567b0f330f18441b6908956e6e7 (patch) | |
tree | ec7181e5137e3c4e10c768614047a852ade340d6 /src/H5HFhuge.c | |
parent | d4a3b75302529f04ca6181b46bdcbb0586edddb2 (diff) | |
download | hdf5-b56de1ddcc91e567b0f330f18441b6908956e6e7.zip hdf5-b56de1ddcc91e567b0f330f18441b6908956e6e7.tar.gz hdf5-b56de1ddcc91e567b0f330f18441b6908956e6e7.tar.bz2 |
[svn-r17885] Decription:
Convert 'huge' fractal heap object management code to use refactored
v2 B-tree routines.
Also, switch internal representation of 'sizeof_addr' and 'sizeof_size'
in files to be uint8_t's instead of size_t's, since they are stored in single
bytes in the file format.
Various other minor compiler warning cleanups and error call tweaks.
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.2 (amazon) in debug mode
Mac OS X/32 10.6.2 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
Diffstat (limited to 'src/H5HFhuge.c')
-rw-r--r-- | src/H5HFhuge.c | 157 |
1 files changed, 102 insertions, 55 deletions
diff --git a/src/H5HFhuge.c b/src/H5HFhuge.c index 161542b..b8d0057 100644 --- a/src/H5HFhuge.c +++ b/src/H5HFhuge.c @@ -124,31 +124,31 @@ H5HF_huge_bt2_create(H5HF_hdr_t *hdr, hid_t dxpl_id) */ if(hdr->huge_ids_direct) { if(hdr->filter_len > 0) { - bt2_cparam.rrec_size = hdr->sizeof_addr /* Address of object */ + bt2_cparam.rrec_size = (size_t)(hdr->sizeof_addr /* Address of object */ + hdr->sizeof_size /* Length of object */ + 4 /* Filter mask for filtered object */ - + hdr->sizeof_size; /* Size of de-filtered object in memory */ + + hdr->sizeof_size); /* Size of de-filtered object in memory */ bt2_cparam.cls = H5HF_BT2_FILT_DIR; } /* end if */ else { - bt2_cparam.rrec_size = hdr->sizeof_addr /* Address of object */ - + hdr->sizeof_size; /* Length of object */ + bt2_cparam.rrec_size = (size_t)(hdr->sizeof_addr /* Address of object */ + + hdr->sizeof_size); /* Length of object */ bt2_cparam.cls = H5HF_BT2_DIR; } /* end else */ } /* end if */ else { if(hdr->filter_len > 0) { - bt2_cparam.rrec_size = hdr->sizeof_addr /* Address of filtered object */ + bt2_cparam.rrec_size = (size_t)(hdr->sizeof_addr /* Address of filtered object */ + hdr->sizeof_size /* Length of filtered object */ + 4 /* Filter mask for filtered object */ + hdr->sizeof_size /* Size of de-filtered object in memory */ - + hdr->sizeof_size; /* Unique ID for object */ + + hdr->sizeof_size); /* Unique ID for object */ bt2_cparam.cls = H5HF_BT2_FILT_INDIR; } /* end if */ else { - bt2_cparam.rrec_size = hdr->sizeof_addr /* Address of object */ + bt2_cparam.rrec_size = (size_t)(hdr->sizeof_addr /* Address of object */ + hdr->sizeof_size /* Length of object */ - + hdr->sizeof_size; /* Unique ID for object */ + + hdr->sizeof_size); /* Unique ID for object */ bt2_cparam.cls = H5HF_BT2_INDIR; } /* end else */ } /* end else */ @@ -157,9 +157,13 @@ H5HF_huge_bt2_create(H5HF_hdr_t *hdr, hid_t dxpl_id) bt2_cparam.merge_percent = H5HF_HUGE_BT2_MERGE_PERC; /* Create v2 B-tree for tracking 'huge' objects */ - if(H5B2_create(hdr->f, dxpl_id, &bt2_cparam, &hdr->huge_bt2_addr/*out*/) < 0) + if(NULL == (hdr->huge_bt2 = H5B2_create_2(hdr->f, dxpl_id, &bt2_cparam))) HGOTO_ERROR(H5E_HEAP, H5E_CANTCREATE, FAIL, "can't create v2 B-tree for tracking 'huge' heap objects") + /* Retrieve the v2 B-tree's address in the file */ + if(H5B2_get_addr(hdr->huge_bt2, &hdr->huge_bt2_addr) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't get v2 B-tree address for tracking 'huge' heap objects") + done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5HF_huge_bt2_create() */ @@ -199,12 +203,12 @@ HDfprintf(stderr, "%s: hdr->id_len = %u\n", "H5HF_huge_init", (unsigned)hdr->id_ HDfprintf(stderr, "%s: hdr->filter_len = %u\n", "H5HF_huge_init", (unsigned)hdr->filter_len); #endif /* QAK */ if(hdr->filter_len > 0) { - if((hdr->id_len - 1) >= (hdr->sizeof_addr + hdr->sizeof_size + 4 + hdr->sizeof_size)) { + if((hdr->id_len - 1) >= (unsigned)(hdr->sizeof_addr + hdr->sizeof_size + 4 + hdr->sizeof_size)) { /* Indicate that v2 B-tree doesn't have to be used to locate object */ hdr->huge_ids_direct = TRUE; /* Set the size of 'huge' object IDs */ - hdr->huge_id_size = hdr->sizeof_addr + hdr->sizeof_size + hdr->sizeof_size; + hdr->huge_id_size = (uint8_t)(hdr->sizeof_addr + hdr->sizeof_size + hdr->sizeof_size); } /* end if */ else /* Indicate that v2 B-tree must be used to access object */ @@ -216,7 +220,7 @@ HDfprintf(stderr, "%s: hdr->filter_len = %u\n", "H5HF_huge_init", (unsigned)hdr- hdr->huge_ids_direct = TRUE; /* Set the size of 'huge' object IDs */ - hdr->huge_id_size = hdr->sizeof_addr + hdr->sizeof_size; + hdr->huge_id_size = (uint8_t)(hdr->sizeof_addr + hdr->sizeof_size); } /* end if */ else /* Indicate that v2 B-tree must be used to locate object */ @@ -225,7 +229,7 @@ HDfprintf(stderr, "%s: hdr->filter_len = %u\n", "H5HF_huge_init", (unsigned)hdr- if(!hdr->huge_ids_direct) { /* Set the size and maximum value of 'huge' object ID */ if((hdr->id_len - 1) < sizeof(hsize_t)) { - hdr->huge_id_size = hdr->id_len - 1; + hdr->huge_id_size = (uint8_t)(hdr->id_len - 1); hdr->huge_max_id = ((hsize_t)1 << (hdr->huge_id_size * 8)) - 1; } /*end if */ else { @@ -233,6 +237,7 @@ HDfprintf(stderr, "%s: hdr->filter_len = %u\n", "H5HF_huge_init", (unsigned)hdr- hdr->huge_max_id = HSIZET_MAX; } /* end else */ } /* end if */ + hdr->huge_bt2 = NULL; FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5HF_huge_init() */ @@ -325,9 +330,20 @@ HDfprintf(stderr, "%s: obj_size = %Zu\n", FUNC, obj_size); HDassert(id); /* Check if the v2 B-tree for tracking 'huge' heap objects has been created yet */ - if(!H5F_addr_defined(hdr->huge_bt2_addr)) + if(!H5F_addr_defined(hdr->huge_bt2_addr)) { + /* Go create (& open) v2 B-tree */ if(H5HF_huge_bt2_create(hdr, dxpl_id) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTCREATE, FAIL, "can't create v2 B-tree for tracking 'huge' heap objects") + } /* end if */ + else { + /* Check if v2 B-tree is open yet */ + if(NULL == hdr->huge_bt2) { + /* Open existing v2 B-tree */ + if(NULL == (hdr->huge_bt2 = H5B2_open(hdr->f, dxpl_id, hdr->huge_bt2_addr))) + HGOTO_ERROR(H5E_HEAP, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for tracking 'huge' heap objects") + } /* end if */ + } /* end else */ + HDassert(hdr->huge_bt2); /* Check for I/O pipeline filter on heap */ if(hdr->filter_len > 0) { @@ -387,7 +403,7 @@ HDfprintf(stderr, "%s: obj_rec = {%a, %Hu, %x, %Hu}\n", FUNC, obj_rec.addr, obj_ #endif /* QAK */ /* Insert record for object in v2 B-tree */ - if(H5B2_insert(hdr->f, dxpl_id, H5HF_BT2_FILT_DIR, hdr->huge_bt2_addr, &obj_rec) < 0) + if(H5B2_insert_2(hdr->huge_bt2, dxpl_id, &obj_rec) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINSERT, FAIL, "couldn't insert object tracking record in v2 B-tree") /* Encode ID for user */ @@ -408,7 +424,7 @@ HDfprintf(stderr, "%s: obj_rec = {%a, %Hu}\n", FUNC, obj_rec.addr, obj_rec.len); #endif /* QAK */ /* Insert record for object in v2 B-tree */ - if(H5B2_insert(hdr->f, dxpl_id, H5HF_BT2_DIR, hdr->huge_bt2_addr, &obj_rec) < 0) + if(H5B2_insert_2(hdr->huge_bt2, dxpl_id, &obj_rec) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINSERT, FAIL, "couldn't insert object tracking record in v2 B-tree") /* Encode ID for user */ @@ -420,7 +436,6 @@ HDfprintf(stderr, "%s: obj_rec = {%a, %Hu}\n", FUNC, obj_rec.addr, obj_rec.len); else { H5HF_huge_bt2_filt_indir_rec_t filt_indir_rec; /* Record for tracking filtered object */ H5HF_huge_bt2_indir_rec_t indir_rec; /* Record for tracking non-filtered object */ - const H5B2_class_t *bt2_class; /* v2 B-tree class to use */ void *ins_rec; /* Pointer to record to insert */ hsize_t new_id; /* New ID for object */ @@ -441,7 +456,6 @@ HDfprintf(stderr, "%s: filt_indir_rec = {%a, %Hu, %x, %Hu, %Hu}\n", FUNC, filt_i /* Set pointer to record to insert */ ins_rec = &filt_indir_rec; - bt2_class = H5HF_BT2_FILT_INDIR; } /* end if */ else { /* Initialize record for object in v2 B-tree */ @@ -454,11 +468,10 @@ HDfprintf(stderr, "%s: indir_rec = {%a, %Hu, %Hu}\n", FUNC, indir_rec.addr, indi /* Set pointer to record to insert */ ins_rec = &indir_rec; - bt2_class = H5HF_BT2_INDIR; } /* end else */ /* Insert record for tracking object in v2 B-tree */ - if(H5B2_insert(hdr->f, dxpl_id, bt2_class, hdr->huge_bt2_addr, ins_rec) < 0) + if(H5B2_insert_2(hdr->huge_bt2, dxpl_id, ins_rec) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINSERT, FAIL, "couldn't insert object tracking record in v2 B-tree") /* Encode ID for user */ @@ -529,6 +542,13 @@ H5HF_huge_get_obj_len(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id, } /* end else */ } /* end if */ else { + /* Check if v2 B-tree is open yet */ + if(NULL == hdr->huge_bt2) { + /* Open existing v2 B-tree */ + if(NULL == (hdr->huge_bt2 = H5B2_open(hdr->f, dxpl_id, hdr->huge_bt2_addr))) + HGOTO_ERROR(H5E_HEAP, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for tracking 'huge' heap objects") + } /* end if */ + if(hdr->filter_len > 0) { H5HF_huge_bt2_filt_indir_rec_t found_rec; /* Record found from tracking object */ H5HF_huge_bt2_filt_indir_rec_t search_rec; /* Record for searching for object */ @@ -537,8 +557,7 @@ H5HF_huge_get_obj_len(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id, UINT64DECODE_VAR(id, search_rec.id, hdr->huge_id_size) /* Look up object in v2 B-tree */ - if(H5B2_find(hdr->f, dxpl_id, H5HF_BT2_FILT_INDIR, hdr->huge_bt2_addr, - &search_rec, H5HF_huge_bt2_filt_indir_found, &found_rec) != TRUE) + if(H5B2_find_2(hdr->huge_bt2, dxpl_id, &search_rec, H5HF_huge_bt2_filt_indir_found, &found_rec) != TRUE) HGOTO_ERROR(H5E_HEAP, H5E_NOTFOUND, FAIL, "can't find object in B-tree") /* Retrieve the object's length */ @@ -552,8 +571,7 @@ H5HF_huge_get_obj_len(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id, UINT64DECODE_VAR(id, search_rec.id, hdr->huge_id_size) /* Look up object in v2 B-tree */ - if(H5B2_find(hdr->f, dxpl_id, H5HF_BT2_INDIR, hdr->huge_bt2_addr, - &search_rec, H5HF_huge_bt2_indir_found, &found_rec) != TRUE) + if(H5B2_find_2(hdr->huge_bt2, dxpl_id, &search_rec, H5HF_huge_bt2_indir_found, &found_rec) != TRUE) HGOTO_ERROR(H5E_HEAP, H5E_NOTFOUND, FAIL, "can't find object in B-tree") /* Retrieve the object's length */ @@ -612,6 +630,16 @@ H5HF_huge_op_real(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id, UINT32DECODE(id, filter_mask); } /* end if */ else { + /* Sanity check */ + HDassert(H5F_addr_defined(hdr->huge_bt2_addr)); + + /* Check if v2 B-tree is open yet */ + if(NULL == hdr->huge_bt2) { + /* Open existing v2 B-tree */ + if(NULL == (hdr->huge_bt2 = H5B2_open(hdr->f, dxpl_id, hdr->huge_bt2_addr))) + HGOTO_ERROR(H5E_HEAP, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for tracking 'huge' heap objects") + } /* end if */ + if(hdr->filter_len > 0) { H5HF_huge_bt2_filt_indir_rec_t found_rec; /* Record found from tracking object */ H5HF_huge_bt2_filt_indir_rec_t search_rec; /* Record for searching for object */ @@ -620,8 +648,7 @@ H5HF_huge_op_real(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id, UINT64DECODE_VAR(id, search_rec.id, hdr->huge_id_size) /* Look up object in v2 B-tree */ - if(H5B2_find(hdr->f, dxpl_id, H5HF_BT2_FILT_INDIR, hdr->huge_bt2_addr, - &search_rec, H5HF_huge_bt2_filt_indir_found, &found_rec) != TRUE) + if(H5B2_find_2(hdr->huge_bt2, dxpl_id, &search_rec, H5HF_huge_bt2_filt_indir_found, &found_rec) != TRUE) HGOTO_ERROR(H5E_HEAP, H5E_NOTFOUND, FAIL, "can't find object in B-tree") /* Retrieve the object's address & length */ @@ -637,8 +664,7 @@ H5HF_huge_op_real(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id, UINT64DECODE_VAR(id, search_rec.id, hdr->huge_id_size) /* Look up object in v2 B-tree */ - if(H5B2_find(hdr->f, dxpl_id, H5HF_BT2_INDIR, hdr->huge_bt2_addr, - &search_rec, H5HF_huge_bt2_indir_found, &found_rec) != TRUE) + if(H5B2_find_2(hdr->huge_bt2, dxpl_id, &search_rec, H5HF_huge_bt2_indir_found, &found_rec) != TRUE) HGOTO_ERROR(H5E_HEAP, H5E_NOTFOUND, FAIL, "can't find object in B-tree") /* Retrieve the object's address & length */ @@ -752,12 +778,21 @@ H5HF_huge_write(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id, H5HF_huge_bt2_indir_rec_t found_rec; /* Record found from tracking object */ H5HF_huge_bt2_indir_rec_t search_rec; /* Record for searching for object */ + /* Sanity check */ + HDassert(H5F_addr_defined(hdr->huge_bt2_addr)); + + /* Check if v2 B-tree is open yet */ + if(NULL == hdr->huge_bt2) { + /* Open existing v2 B-tree */ + if(NULL == (hdr->huge_bt2 = H5B2_open(hdr->f, dxpl_id, hdr->huge_bt2_addr))) + HGOTO_ERROR(H5E_HEAP, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for tracking 'huge' heap objects") + } /* end if */ + /* Get ID for looking up 'huge' object in v2 B-tree */ UINT64DECODE_VAR(id, search_rec.id, hdr->huge_id_size) /* Look up object in v2 B-tree */ - if(H5B2_find(hdr->f, dxpl_id, H5HF_BT2_INDIR, hdr->huge_bt2_addr, - &search_rec, H5HF_huge_bt2_indir_found, &found_rec) != TRUE) + if(H5B2_find_2(hdr->huge_bt2, dxpl_id, &search_rec, H5HF_huge_bt2_indir_found, &found_rec) != TRUE) HGOTO_ERROR(H5E_HEAP, H5E_NOTFOUND, FAIL, "can't find object in B-tree") /* Retrieve the object's address & length */ @@ -873,8 +908,16 @@ H5HF_huge_remove(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id) * Check arguments. */ HDassert(hdr); + HDassert(H5F_addr_defined(hdr->huge_bt2_addr)); HDassert(id); + /* Check if v2 B-tree is open yet */ + if(NULL == hdr->huge_bt2) { + /* Open existing v2 B-tree */ + if(NULL == (hdr->huge_bt2 = H5B2_open(hdr->f, dxpl_id, hdr->huge_bt2_addr))) + HGOTO_ERROR(H5E_HEAP, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for tracking 'huge' heap objects") + } /* end if */ + /* Skip over the flag byte */ id++; @@ -894,8 +937,7 @@ H5HF_huge_remove(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id) /* Remove the record for tracking the 'huge' object from the v2 B-tree */ /* (space in the file for the object is freed in the 'remove' callback) */ - if(H5B2_remove(hdr->f, dxpl_id, H5HF_BT2_FILT_DIR, hdr->huge_bt2_addr, - &search_rec, H5HF_huge_bt2_filt_dir_remove, &udata) < 0) + if(H5B2_remove_2(hdr->huge_bt2, dxpl_id, &search_rec, H5HF_huge_bt2_filt_dir_remove, &udata) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTREMOVE, FAIL, "can't remove object from B-tree") } /* end if */ else { @@ -908,8 +950,7 @@ H5HF_huge_remove(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id) /* Remove the record for tracking the 'huge' object from the v2 B-tree */ /* (space in the file for the object is freed in the 'remove' callback) */ - if(H5B2_remove(hdr->f, dxpl_id, H5HF_BT2_DIR, hdr->huge_bt2_addr, - &search_rec, H5HF_huge_bt2_dir_remove, &udata) < 0) + if(H5B2_remove_2(hdr->huge_bt2, dxpl_id, &search_rec, H5HF_huge_bt2_dir_remove, &udata) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTREMOVE, FAIL, "can't remove object from B-tree") } /* end else */ } /* end if */ @@ -922,8 +963,7 @@ H5HF_huge_remove(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id) /* Remove the record for tracking the 'huge' object from the v2 B-tree */ /* (space in the file for the object is freed in the 'remove' callback) */ - if(H5B2_remove(hdr->f, dxpl_id, H5HF_BT2_FILT_INDIR, hdr->huge_bt2_addr, - &search_rec, H5HF_huge_bt2_filt_indir_remove, &udata) < 0) + if(H5B2_remove_2(hdr->huge_bt2, dxpl_id, &search_rec, H5HF_huge_bt2_filt_indir_remove, &udata) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTREMOVE, FAIL, "can't remove object from B-tree") } /* end if */ else { @@ -934,8 +974,7 @@ H5HF_huge_remove(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id) /* Remove the record for tracking the 'huge' object from the v2 B-tree */ /* (space in the file for the object is freed in the 'remove' callback) */ - if(H5B2_remove(hdr->f, dxpl_id, H5HF_BT2_INDIR, hdr->huge_bt2_addr, - &search_rec, H5HF_huge_bt2_indir_remove, &udata) < 0) + if(H5B2_remove_2(hdr->huge_bt2, dxpl_id, &search_rec, H5HF_huge_bt2_indir_remove, &udata) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTREMOVE, FAIL, "can't remove object from B-tree") } /* end else */ } /* end else */ @@ -978,6 +1017,17 @@ H5HF_huge_term(H5HF_hdr_t *hdr, hid_t dxpl_id) */ HDassert(hdr); + /* Check if v2 B-tree index is open */ + if(hdr->huge_bt2) { + /* Sanity check */ + HDassert(H5F_addr_defined(hdr->huge_bt2_addr)); + + /* Close v2 B-tree index */ + if(H5B2_close(hdr->huge_bt2, dxpl_id) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree") + hdr->huge_bt2 = NULL; + } /* end if */ + /* Check if there are no more 'huge' objects in the heap and delete the * v2 B-tree that tracks them, if so */ @@ -1023,6 +1073,7 @@ herr_t H5HF_huge_delete(H5HF_hdr_t *hdr, hid_t dxpl_id) { H5HF_huge_remove_ud1_t udata; /* User callback data for v2 B-tree remove call */ + H5B2_remove_t op; /* Callback for v2 B-tree removal */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5HF_huge_delete) @@ -1039,28 +1090,24 @@ H5HF_huge_delete(H5HF_hdr_t *hdr, hid_t dxpl_id) udata.hdr = hdr; udata.dxpl_id = dxpl_id; - /* Delete the v2 B-tree */ + /* Set the v2 B-tree callback operator */ if(hdr->huge_ids_direct) { - if(hdr->filter_len > 0) { - if(H5B2_delete(hdr->f, dxpl_id, hdr->huge_bt2_addr, H5HF_huge_bt2_filt_dir_remove, &udata) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTDELETE, FAIL, "can't delete v2 B-tree") - } /* end if */ - else { - if(H5B2_delete(hdr->f, dxpl_id, hdr->huge_bt2_addr, H5HF_huge_bt2_dir_remove, &udata) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTDELETE, FAIL, "can't delete v2 B-tree") - } /* end else */ + if(hdr->filter_len > 0) + op = H5HF_huge_bt2_filt_dir_remove; + else + op = H5HF_huge_bt2_dir_remove; } /* end if */ else { - if(hdr->filter_len > 0) { - if(H5B2_delete(hdr->f, dxpl_id, hdr->huge_bt2_addr, H5HF_huge_bt2_filt_indir_remove, &udata) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTDELETE, FAIL, "can't delete v2 B-tree") - } /* end if */ - else { - if(H5B2_delete(hdr->f, dxpl_id, hdr->huge_bt2_addr, H5HF_huge_bt2_indir_remove, &udata) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTDELETE, FAIL, "can't delete v2 B-tree") - } /* end else */ + if(hdr->filter_len > 0) + op = H5HF_huge_bt2_filt_indir_remove; + else + op = H5HF_huge_bt2_indir_remove; } /* end else */ + /* Delete the v2 B-tree */ + if(H5B2_delete(hdr->f, dxpl_id, hdr->huge_bt2_addr, op, &udata) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTDELETE, FAIL, "can't delete v2 B-tree") + done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5HF_huge_delete() */ |