diff options
Diffstat (limited to 'src/H5Dbtree2.c')
-rw-r--r-- | src/H5Dbtree2.c | 61 |
1 files changed, 22 insertions, 39 deletions
diff --git a/src/H5Dbtree2.c b/src/H5Dbtree2.c index 2e19392..f9074be 100644 --- a/src/H5Dbtree2.c +++ b/src/H5Dbtree2.c @@ -60,12 +60,6 @@ typedef struct H5D_bt2_ctx_t { uint32_t *dim; /* Size of chunk in elements */ } H5D_bt2_ctx_t; -/* User data for the chunk's removal callback routine */ -typedef struct H5D_bt2_remove_ud_t { - H5F_t *f; /* File pointer for operation */ - hid_t dxpl_id; /* DXPL ID for operation */ -} H5D_bt2_remove_ud_t; - /* Callback info for iteration over chunks in v2 B-tree */ typedef struct H5D_bt2_it_ud_t { H5D_chunk_cb_func_t cb; /* Callback routine for the chunk */ @@ -137,7 +131,7 @@ static herr_t H5D__bt2_idx_delete(const H5D_chk_idx_info_t *idx_info); static herr_t H5D__bt2_idx_copy_setup(const H5D_chk_idx_info_t *idx_info_src, const H5D_chk_idx_info_t *idx_info_dst); static herr_t H5D__bt2_idx_copy_shutdown(H5O_storage_chunk_t *storage_src, - H5O_storage_chunk_t *storage_dst, hid_t dxpl_id); + H5O_storage_chunk_t *storage_dst); static herr_t H5D__bt2_idx_size(const H5D_chk_idx_info_t *idx_info, hsize_t *size); static herr_t H5D__bt2_idx_reset(H5O_storage_chunk_t *storage, hbool_t reset_addr); static herr_t H5D__bt2_idx_dump(const H5O_storage_chunk_t *storage, @@ -664,7 +658,7 @@ H5D__btree2_idx_depend(const H5D_chk_idx_info_t *idx_info) oloc.addr = idx_info->storage->u.btree.dset_ohdr_addr; /* Get header */ - if(NULL == (oh = H5O_protect(&oloc, idx_info->dxpl_id, H5AC__READ_ONLY_FLAG, TRUE))) + if(NULL == (oh = H5O_protect(&oloc, H5AC__READ_ONLY_FLAG, TRUE))) HGOTO_ERROR(H5E_DATASET, H5E_CANTPROTECT, FAIL, "unable to protect object header") /* Retrieve the dataset's object header proxy */ @@ -672,12 +666,12 @@ H5D__btree2_idx_depend(const H5D_chk_idx_info_t *idx_info) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get dataset object header proxy") /* Make the v2 B-tree a child flush dependency of the dataset's object header proxy */ - if(H5B2_depend(idx_info->storage->u.btree2.bt2, idx_info->dxpl_id, oh_proxy) < 0) + if(H5B2_depend(idx_info->storage->u.btree2.bt2, oh_proxy) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTDEPEND, FAIL, "unable to create flush dependency on object header proxy") done: /* Release the object header from the cache */ - if(oh && H5O_unprotect(&oloc, idx_info->dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0) + if(oh && H5O_unprotect(&oloc, oh, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTUNPROTECT, FAIL, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) @@ -726,7 +720,7 @@ H5D__bt2_idx_open(const H5D_chk_idx_info_t *idx_info) u_ctx.dim = idx_info->layout->dim; /* Open v2 B-tree for the chunk index */ - if(NULL == (idx_info->storage->u.btree2.bt2 = H5B2_open(idx_info->f, idx_info->dxpl_id, idx_info->storage->idx_addr, &u_ctx))) + if(NULL == (idx_info->storage->u.btree2.bt2 = H5B2_open(idx_info->f, idx_info->storage->idx_addr, &u_ctx))) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't open v2 B-tree for tracking chunked dataset") /* Check for SWMR writes to the file */ @@ -798,7 +792,7 @@ H5D__bt2_idx_create(const H5D_chk_idx_info_t *idx_info) u_ctx.dim = idx_info->layout->dim; /* Create the v2 B-tree for the chunked dataset */ - if(NULL == (idx_info->storage->u.btree2.bt2 = H5B2_create(idx_info->f, idx_info->dxpl_id, &bt2_cparam, &u_ctx))) + if(NULL == (idx_info->storage->u.btree2.bt2 = H5B2_create(idx_info->f, &bt2_cparam, &u_ctx))) HGOTO_ERROR(H5E_DATASET, H5E_CANTCREATE, FAIL, "can't create v2 B-tree for tracking chunked dataset") /* Retrieve the v2 B-tree's address in the file */ @@ -947,7 +941,7 @@ H5D__bt2_idx_insert(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata, bt2_udata.rec.scaled[u] = udata->common.scaled[u]; /* Update record for v2 B-tree (could be insert or modify) */ - if(H5B2_update(bt2, idx_info->dxpl_id, &bt2_udata, H5D__bt2_mod_cb, &bt2_udata) < 0) + if(H5B2_update(bt2, &bt2_udata, H5D__bt2_mod_cb, &bt2_udata) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTUPDATE, FAIL, "unable to update record in v2 B-tree") done: @@ -1041,7 +1035,7 @@ H5D__bt2_idx_get_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata) bt2_udata.rec.scaled[u] = udata->common.scaled[u]; /* Go get chunk information from v2 B-tree */ - if(H5B2_find(bt2, idx_info->dxpl_id, &bt2_udata, H5D__bt2_found_cb, &found_rec) < 0) + if(H5B2_find(bt2, &bt2_udata, H5D__bt2_found_cb, &found_rec) < 0) HGOTO_ERROR(H5E_HEAP, H5E_NOTFOUND, FAIL, "can't find object in v2 B-tree") /* Set common info for the chunk */ @@ -1155,7 +1149,7 @@ H5D__bt2_idx_iterate(const H5D_chk_idx_info_t *idx_info, udata.udata = chunk_udata; /* Iterate over the records in the v2 B-tree */ - if((ret_value = H5B2_iterate(bt2, idx_info->dxpl_id, H5D__bt2_idx_iterate_cb, &udata)) < 0) + if((ret_value = H5B2_iterate(bt2, H5D__bt2_idx_iterate_cb, &udata)) < 0) HERROR(H5E_DATASET, H5E_BADITER, "unable to iterate over chunk v2 B-tree"); done: @@ -1182,18 +1176,17 @@ static herr_t H5D__bt2_remove_cb(const void *_record, void *_udata) { const H5D_chunk_rec_t *record = (const H5D_chunk_rec_t *)_record; /* The native record */ - H5D_bt2_remove_ud_t *udata = (H5D_bt2_remove_ud_t *)_udata; /* User data for removal callback */ + H5F_t *f = (H5F_t *)_udata; /* User data for removal callback */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC /* Sanity checks */ - HDassert(udata); - HDassert(udata->f); + HDassert(f); /* Free the space in the file for the object being removed */ H5_CHECK_OVERFLOW(record->nbytes, uint32_t, hsize_t); - if(H5MF_xfree(udata->f, H5FD_MEM_DRAW, udata->dxpl_id, record->chunk_addr, (hsize_t)record->nbytes) < 0) + if(H5MF_xfree(f, H5FD_MEM_DRAW, record->chunk_addr, (hsize_t)record->nbytes) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to free chunk") done: @@ -1216,7 +1209,6 @@ static herr_t H5D__bt2_idx_remove(const H5D_chk_idx_info_t *idx_info, H5D_chunk_common_ud_t *udata) { H5B2_t *bt2; /* v2 B-tree handle for indexing chunks */ - H5D_bt2_remove_ud_t remove_udata; /* User data for removal callback */ H5D_bt2_ud_t bt2_udata; /* User data for v2 B-tree find call */ unsigned u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ @@ -1245,10 +1237,6 @@ H5D__bt2_idx_remove(const H5D_chk_idx_info_t *idx_info, H5D_chunk_common_ud_t *u /* Set convenience pointer to v2 B-tree structure */ bt2 = idx_info->storage->u.btree2.bt2; - /* Initialize user data for removal callback */ - remove_udata.f = idx_info->f; - remove_udata.dxpl_id = idx_info->dxpl_id; - /* Prepare user data for compare callback */ bt2_udata.ndims = idx_info->layout->ndims - 1; @@ -1258,7 +1246,7 @@ H5D__bt2_idx_remove(const H5D_chk_idx_info_t *idx_info, H5D_chunk_common_ud_t *u /* Remove the record for the "dataset chunk" object from the v2 B-tree */ /* (space in the file for the object is freed in the 'remove' callback) */ - if(H5B2_remove(bt2, idx_info->dxpl_id, &bt2_udata, (H5F_INTENT(idx_info->f) & H5F_ACC_SWMR_WRITE) ? NULL : H5D__bt2_remove_cb, &remove_udata) < 0) + if(H5B2_remove(bt2, &bt2_udata, (H5F_INTENT(idx_info->f) & H5F_ACC_SWMR_WRITE) ? NULL : H5D__bt2_remove_cb, idx_info->f) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTREMOVE, FAIL, "can't remove object from B-tree") done: @@ -1289,7 +1277,6 @@ done: static herr_t H5D__bt2_idx_delete(const H5D_chk_idx_info_t *idx_info) { - H5D_bt2_remove_ud_t remove_udata; /* User data for removal callback */ H5B2_remove_t remove_op; /* The removal callback */ H5D_bt2_ctx_ud_t u_ctx; /* data for context call */ herr_t ret_value = SUCCEED; /* Return value */ @@ -1311,10 +1298,6 @@ H5D__bt2_idx_delete(const H5D_chk_idx_info_t *idx_info) u_ctx.chunk_size = idx_info->layout->size; u_ctx.dim = idx_info->layout->dim; - /* Initialize user data for removal callback */ - remove_udata.f = idx_info->f; - remove_udata.dxpl_id = idx_info->dxpl_id; - /* Set remove operation. Do not remove chunks in SWMR_WRITE mode */ if(H5F_INTENT(idx_info->f) & H5F_ACC_SWMR_WRITE) remove_op = NULL; @@ -1323,7 +1306,7 @@ H5D__bt2_idx_delete(const H5D_chk_idx_info_t *idx_info) /* Delete the v2 B-tree */ /*(space in the file for each object is freed in the 'remove' callback) */ - if(H5B2_delete(idx_info->f, idx_info->dxpl_id, idx_info->storage->idx_addr, &u_ctx, remove_op, &remove_udata) < 0) + if(H5B2_delete(idx_info->f, idx_info->storage->idx_addr, &u_ctx, remove_op, idx_info->f) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTDELETE, FAIL, "can't delete v2 B-tree") idx_info->storage->idx_addr = HADDR_UNDEF; @@ -1374,7 +1357,7 @@ H5D__bt2_idx_copy_setup(const H5D_chk_idx_info_t *idx_info_src, HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open v2 B-tree") /* Set copied metadata tag */ - H5_BEGIN_TAG(idx_info_dst->dxpl_id, H5AC__COPIED_TAG, FAIL); + H5_BEGIN_TAG(H5AC__COPIED_TAG); /* Create v2 B-tree that describes the chunked dataset in the destination file */ if(H5D__bt2_idx_create(idx_info_dst) < 0) @@ -1382,7 +1365,7 @@ H5D__bt2_idx_copy_setup(const H5D_chk_idx_info_t *idx_info_src, HDassert(H5F_addr_defined(idx_info_dst->storage->idx_addr)); /* Reset metadata tag */ - H5_END_TAG(FAIL); + H5_END_TAG done: FUNC_LEAVE_NOAPI(ret_value) @@ -1402,7 +1385,7 @@ done: */ static herr_t H5D__bt2_idx_copy_shutdown(H5O_storage_chunk_t *storage_src, - H5O_storage_chunk_t *storage_dst, hid_t H5_ATTR_UNUSED dxpl_id) + H5O_storage_chunk_t *storage_dst) { herr_t ret_value = SUCCEED; /* Return value */ @@ -1415,12 +1398,12 @@ H5D__bt2_idx_copy_shutdown(H5O_storage_chunk_t *storage_src, HDassert(storage_dst->u.btree2.bt2); /* Close v2 B-tree for source file */ - if(H5B2_close(storage_src->u.btree2.bt2, dxpl_id) < 0) + if(H5B2_close(storage_src->u.btree2.bt2) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to close v2 B-tree") storage_src->u.btree2.bt2 = NULL; /* Close v2 B-tree for destination file */ - if(H5B2_close(storage_dst->u.btree2.bt2, dxpl_id) < 0) + if(H5B2_close(storage_dst->u.btree2.bt2) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to close v2 B-tree") storage_dst->u.btree2.bt2 = NULL; @@ -1466,12 +1449,12 @@ H5D__bt2_idx_size(const H5D_chk_idx_info_t *idx_info, hsize_t *index_size) bt2_cdset = idx_info->storage->u.btree2.bt2; /* Get v2 B-tree size for indexing chunked dataset */ - if(H5B2_size(bt2_cdset, idx_info->dxpl_id, index_size) < 0) + if(H5B2_size(bt2_cdset, index_size) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve v2 B-tree storage info for chunked dataset") done: /* Close v2 B-tree index */ - if(bt2_cdset && H5B2_close(bt2_cdset, idx_info->dxpl_id) < 0) + if(bt2_cdset && H5B2_close(bt2_cdset) < 0) HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for tracking chunked dataset") idx_info->storage->u.btree2.bt2 = NULL; @@ -1564,7 +1547,7 @@ H5D__bt2_idx_dest(const H5D_chk_idx_info_t *idx_info) HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't patch v2 B-tree file pointer") /* Close v2 B-tree */ - if(H5B2_close(idx_info->storage->u.btree2.bt2, idx_info->dxpl_id) < 0) + if(H5B2_close(idx_info->storage->u.btree2.bt2) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree") idx_info->storage->u.btree2.bt2 = NULL; } /* end if */ |