diff options
author | Vailin Choi <vchoi@hdfgroup.org> | 2014-09-11 19:38:41 (GMT) |
---|---|---|
committer | Vailin Choi <vchoi@hdfgroup.org> | 2014-09-11 19:38:41 (GMT) |
commit | 3f839063e3e00fb428e82950388b91b094e6e2d0 (patch) | |
tree | a5cfcfb2efa080a784315176c11fd9b86b4a65f3 /src | |
parent | 7e5823d7427e87bd2dcd864cc646746c9e2c2e87 (diff) | |
download | hdf5-3f839063e3e00fb428e82950388b91b094e6e2d0.zip hdf5-3f839063e3e00fb428e82950388b91b094e6e2d0.tar.gz hdf5-3f839063e3e00fb428e82950388b91b094e6e2d0.tar.bz2 |
[svn-r25588] Bring revisions #25383, #25388 from revise_chksum_retry to revise_chunks.
h5committested.
Diffstat (limited to 'src')
-rw-r--r-- | src/H5Abtree2.c | 4 | ||||
-rw-r--r-- | src/H5B.c | 528 | ||||
-rw-r--r-- | src/H5B2.c | 290 | ||||
-rw-r--r-- | src/H5B2int.c | 151 | ||||
-rw-r--r-- | src/H5B2private.h | 2 | ||||
-rw-r--r-- | src/H5B2test.c | 2 | ||||
-rw-r--r-- | src/H5Bcache.c | 66 | ||||
-rw-r--r-- | src/H5Bprivate.h | 24 | ||||
-rw-r--r-- | src/H5Dbtree.c | 422 | ||||
-rw-r--r-- | src/H5Dbtree2.c | 466 | ||||
-rw-r--r-- | src/H5Dchunk.c | 420 | ||||
-rw-r--r-- | src/H5Dearray.c | 298 | ||||
-rw-r--r-- | src/H5Dfarray.c | 295 | ||||
-rw-r--r-- | src/H5Dnone.c | 56 | ||||
-rw-r--r-- | src/H5Dpkg.h | 25 | ||||
-rw-r--r-- | src/H5EA.c | 109 | ||||
-rw-r--r-- | src/H5EAprivate.h | 4 | ||||
-rw-r--r-- | src/H5Gbtree2.c | 4 | ||||
-rw-r--r-- | src/H5Gnode.c | 4 | ||||
-rw-r--r-- | src/H5Gstab.c | 30 | ||||
-rw-r--r-- | src/H5Gtest.c | 2 | ||||
-rw-r--r-- | src/H5HFbtree2.c | 8 | ||||
-rw-r--r-- | src/H5Oprivate.h | 1 | ||||
-rw-r--r-- | src/H5Ostab.c | 2 | ||||
-rw-r--r-- | src/H5SMbtree2.c | 2 | ||||
-rw-r--r-- | src/Makefile.am | 2 | ||||
-rw-r--r-- | src/Makefile.in | 97 |
27 files changed, 626 insertions, 2688 deletions
diff --git a/src/H5Abtree2.c b/src/H5Abtree2.c index 6012a48..9b7dba6 100644 --- a/src/H5Abtree2.c +++ b/src/H5Abtree2.c @@ -116,8 +116,6 @@ const H5B2_class_t H5A_BT2_NAME[1]={{ /* B-tree class information */ H5A_dense_btree2_name_compare, /* Record comparison callback */ H5A_dense_btree2_name_encode, /* Record encoding callback */ H5A_dense_btree2_name_decode, /* Record decoding callback */ - NULL, /* Create flush dependency *//*!FIXME write me -NAF */ - NULL, /* Update flush dependency *//*!FIXME write me -NAF */ H5A_dense_btree2_name_debug, /* Record debugging callback */ NULL, /* Create debugging context */ NULL /* Destroy debugging context */ @@ -134,8 +132,6 @@ const H5B2_class_t H5A_BT2_CORDER[1]={{ /* B-tree class information */ H5A_dense_btree2_corder_compare, /* Record comparison callback */ H5A_dense_btree2_corder_encode, /* Record encoding callback */ H5A_dense_btree2_corder_decode, /* Record decoding callback */ - NULL, /* Create flush dependency *//*!FIXME write me -NAF */ - NULL, /* Update flush dependency *//*!FIXME write me -NAF */ H5A_dense_btree2_corder_debug, /* Record debugging callback */ NULL, /* Create debugging context */ NULL /* Destroy debugging context */ @@ -153,15 +153,12 @@ static H5B_ins_t H5B_insert_helper(H5F_t *f, hid_t dxpl_id, H5B_ins_ud_t *bt_ud, hbool_t *rt_key_changed, H5B_ins_ud_t *split_bt_ud/*out*/); static herr_t H5B_insert_child(H5B_t *bt, unsigned *bt_flags, - unsigned *idx, haddr_t child, + unsigned idx, haddr_t child, H5B_ins_t anchor, const void *md_key); static herr_t H5B_split(H5F_t *f, hid_t dxpl_id, H5B_ins_ud_t *bt_ud, unsigned idx, void *udata, H5B_ins_ud_t *split_bt_ud/*out*/); static H5B_t * H5B_copy(const H5B_t *old_bt); -static herr_t H5B_find_node(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, - haddr_t addr, void *udata, void *parent, - H5B_t **node); /*********************/ @@ -218,7 +215,7 @@ H5FL_SEQ_DEFINE_STATIC(size_t); */ herr_t H5B_create(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, void *udata, - void *parent, haddr_t *addr_p/*out*/) + haddr_t *addr_p/*out*/) { H5B_t *bt = NULL; H5B_shared_t *shared=NULL; /* Pointer to shared B-tree info */ @@ -251,7 +248,6 @@ H5B_create(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, void *udata, if(NULL == (bt->native = H5FL_BLK_MALLOC(native_block, shared->sizeof_keys)) || NULL == (bt->child = H5FL_SEQ_MALLOC(haddr_t, (size_t)shared->two_k))) HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "memory allocation failed for B-tree root node") - bt->parent = parent; if(HADDR_UNDEF == (*addr_p = H5MF_alloc(f, H5FD_MEM_BTREE, dxpl_id, (hsize_t)shared->sizeof_rnode))) HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "file allocation failed for B-tree root node") @@ -304,8 +300,7 @@ done: *------------------------------------------------------------------------- */ htri_t -H5B_find(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, - void *udata, void *parent) +H5B_find(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, void *udata) { H5B_t *bt = NULL; H5UC_t *rc_shared; /* Ref-counted shared info */ @@ -339,7 +334,6 @@ H5B_find(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, */ cache_udata.f = f; cache_udata.type = type; - cache_udata.parent = parent; cache_udata.rc_shared = rc_shared; if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, &cache_udata, H5AC_READ))) HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree node") @@ -363,7 +357,7 @@ H5B_find(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, HDassert(idx < bt->nchildren); if(bt->level > 0) { - if((ret_value = H5B_find(f, dxpl_id, type, bt->child[idx], udata, bt)) < 0) + if((ret_value = H5B_find(f, dxpl_id, type, bt->child[idx], udata)) < 0) HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "can't lookup key in subtree") } /* end if */ else { @@ -380,109 +374,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5B_find_node - * - * Purpose: Locate the B-tree node containing the item specified in - * UDATA, if present. If found, the B-tree node will be - * pinned on return and must be unpinned after the caller is - * done using it. If not found, *node will be set to NULL. - * - * Return: Non-negative on success. Negative on failure. - * - * Programmer: Neil Fortner - * Aug 18 2010 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5B_find_node(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, - void *udata, void *parent, H5B_t **node) -{ - H5B_t *bt = NULL; - H5UC_t *rc_shared; /* Ref-counted shared info */ - H5B_shared_t *shared; /* Pointer to shared B-tree info */ - H5B_cache_ud_t cache_udata; /* User-data for metadata cache callback */ - unsigned idx = 0, lt = 0, rt; /* Final, left & right key indices */ - int cmp = 1; /* Key comparison value */ - htri_t found; /* Whether the correct node has been found */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) - - /* - * Check arguments. - */ - HDassert(f); - HDassert(type); - HDassert(type->decode); - HDassert(type->cmp3); - HDassert(H5F_addr_defined(addr)); - - /* Get shared info for B-tree */ - if(NULL == (rc_shared = (type->get_shared)(f, udata))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "can't retrieve B-tree's shared ref. count object") - shared = (H5B_shared_t *)H5UC_GET_OBJ(rc_shared); - HDassert(shared); - - /* - * Perform a binary search to locate the child which contains - * the thing for which we're searching. - */ - cache_udata.f = f; - cache_udata.type = type; - cache_udata.parent = parent; - cache_udata.rc_shared = rc_shared; - if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, &cache_udata, H5AC_READ))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree node") - - rt = bt->nchildren; - while(lt < rt && cmp) { - idx = (lt + rt) / 2; - /* compare */ - if((cmp = (type->cmp3)(H5B_NKEY(bt, shared, idx), udata, H5B_NKEY(bt, shared, (idx + 1)))) < 0) - rt = idx; - else - lt = idx + 1; - } /* end while */ - /* Check if not found */ - if(cmp) - *node = NULL; - else { - /* - * Follow the link to the subtree, or return the leaf node. - */ - HDassert(idx < bt->nchildren); - - if(bt->level > 0) { - if(H5B_find_node(f, dxpl_id, type, bt->child[idx], udata, bt, node) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "can't lookup key in subtree") - } /* end if */ - else { - /* Check if this is really the correct child */ - if((found = (type->found)(f, dxpl_id, bt->child[idx], H5B_NKEY(bt, shared, idx), udata)) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "can't lookup key in leaf node") - - if(found) { - /* Return this leaf node, pinned */ - if(H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, H5AC__PIN_ENTRY_FLAG) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release node") - *node = bt; - bt = NULL; - } /* end if */ - else - *node = NULL; - } /* end else */ - } /* end else */ - -done: - if(bt && H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release node") - - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5B_find_node() */ - - -/*------------------------------------------------------------------------- * Function: H5B_split * * Purpose: Split a single node into two nodes. The old node will @@ -513,7 +404,6 @@ H5B_split(H5F_t *f, hid_t dxpl_id, H5B_ins_ud_t *bt_ud, unsigned idx, H5B_cache_ud_t cache_udata; /* User-data for metadata cache callback */ unsigned nleft, nright; /* Number of keys in left & right halves */ double split_ratios[3]; /* B-tree split ratios */ - hbool_t bt_pinned = FALSE; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -589,7 +479,7 @@ H5B_split(H5F_t *f, hid_t dxpl_id, H5B_ins_ud_t *bt_ud, unsigned idx, /* * Create the new B-tree node. */ - if(H5B_create(f, dxpl_id, shared->type, udata, bt_ud->bt->parent, &split_bt_ud->addr/*out*/) < 0) + if(H5B_create(f, dxpl_id, shared->type, udata, &split_bt_ud->addr/*out*/) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "unable to create B-tree") cache_udata.f = f; cache_udata.type = shared->type; @@ -619,95 +509,6 @@ H5B_split(H5F_t *f, hid_t dxpl_id, H5B_ins_ud_t *bt_ud, unsigned idx, bt_ud->cache_flags |= H5AC__DIRTIED_FLAG; bt_ud->bt->nchildren = nleft; - /* Actions to take if swmr writes are on */ - if(shared->swmr_write) { - haddr_t new_bt_addr = HADDR_UNDEF; - unsigned i; - - /* - * We must clone the old btree so readers with an out-of-date version - * of the parent can still see all its children, via the shadowed - * non-split bt. Remove it from cache but do not mark it free on disk. - */ - /* Allocate space for the cloned child */ - H5_CHECK_OVERFLOW(shared->sizeof_rnode,size_t,hsize_t); - if(HADDR_UNDEF == (new_bt_addr = H5MF_alloc(f, H5FD_MEM_BTREE, dxpl_id, (hsize_t)shared->sizeof_rnode))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "unable to allocate file space to move b-tree") - - /* Pin old entry so it is not flushed when we unprotect */ - if(H5AC_pin_protected_entry(bt_ud->bt) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPIN, FAIL, "unable to pin old b-tree node") - bt_pinned = TRUE; - - /* Unprotect bt so we can move it. Do not mark it dirty yet so it is - * not flushed to the old location (however unlikely). */ - if(H5AC_unprotect(f, dxpl_id, H5AC_BT, bt_ud->addr, bt_ud->bt, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release old b-tree") - - /* Move the location of the old child on the disk */ - if(H5AC_move_entry(f, H5AC_BT, bt_ud->addr, new_bt_addr) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTMOVE, FAIL, "unable to move B-tree node") - bt_ud->addr = new_bt_addr; - - /* Re-protect bt at new address */ - if(bt_ud->bt != H5AC_protect(f, dxpl_id, H5AC_BT, new_bt_addr, &cache_udata, H5AC_WRITE)) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree node") - - /* - * Update flush dependencies for children that moved to the new node - */ - if(bt_ud->bt->level > 0) { - H5B_t *child; - - for(i=0; i<nright; i++) { - /* Protect child b-tree node */ - cache_udata.parent = split_bt_ud->bt; - if(NULL == (child = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, split_bt_ud->bt->child[i], &cache_udata, H5AC_WRITE))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree node") - - /* Update the flush dependency, if necessary */ - HDassert(child->parent); - if(child->parent == bt_ud->bt) { - child->parent = split_bt_ud->bt; - if(H5AC_destroy_flush_dependency(bt_ud->bt, child) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency") - if(H5AC_create_flush_dependency(child->parent, child) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTDEPEND, FAIL, "unable to create flush dependency") - } /* end if */ - else - HDassert(child->parent == split_bt_ud->bt); - - /* Unprotect the child */ - if(H5AC_unprotect(f, dxpl_id, H5AC_BT, split_bt_ud->bt->child[idx], child, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node") - } /* end for */ - } /* end if */ - else { - /* At leaf node, delegate to client */ - HDassert(shared->type->update_flush_dep); - for(i=0; i<nright; i++) { - if((shared->type->update_flush_dep)(H5B_NKEY(split_bt_ud->bt, shared, i), udata, bt_ud->bt, split_bt_ud->bt) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTDEPEND, FAIL, "unable to update flush dependency") - } /* end for */ - } /* end else */ - - /* - * Update left sibling to point to new bt. Only necessary when doing - * swmr writes as otherwise the address of bt doesn't change. - */ - if(H5F_addr_defined(bt_ud->bt->left)) { - H5B_t *tmp_bt; - - if(NULL == (tmp_bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, bt_ud->bt->left, &cache_udata, H5AC_WRITE))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load right sibling") - - tmp_bt->right = bt_ud->addr; - - if(H5AC_unprotect(f, dxpl_id, H5AC_BT, bt_ud->bt->left, tmp_bt, H5AC__DIRTIED_FLAG) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node") - } /* end if */ - } /* end if */ - /* * Update other sibling pointers. */ @@ -738,12 +539,6 @@ done: split_bt_ud->cache_flags = H5AC__NO_FLAGS_SET; } /* end if */ - if(bt_pinned) { - HDassert(shared->swmr_write); - if(H5AC_unpin_entry(bt_ud->bt) < 0) - HDONE_ERROR(H5E_BTREE, H5E_CANTUNPIN, FAIL, "unable to unpin old root") - } /* end if */ - FUNC_LEAVE_NOAPI(ret_value) } /* end H5B_split() */ @@ -762,8 +557,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5B_insert(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, - void *udata, void *parent) +H5B_insert(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, void * udata) { /* * These are defined this way to satisfy alignment constraints. @@ -784,7 +578,6 @@ H5B_insert(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, H5B_cache_ud_t cache_udata; /* User-data for metadata cache callback */ H5B_ins_t my_ins = H5B_INS_ERROR; hbool_t bt_protected = FALSE; - hbool_t nrbt_pinned = FALSE; /* TRUE if new_root_bt is pinned */ herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI(FAIL) @@ -804,7 +597,6 @@ H5B_insert(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, /* Protect the root node */ cache_udata.f = f; cache_udata.type = type; - cache_udata.parent = parent; cache_udata.rc_shared = rc_shared; bt_ud.addr = addr; if(NULL == (bt_ud.bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, &cache_udata, H5AC_WRITE))) @@ -843,28 +635,24 @@ H5B_insert(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, * at the old root's previous address. This prevents the B-tree from * "moving". */ - /* Note that this is not necessary if swmr writes are on, as H5B_split - * already moved the node in this case */ - if(!shared->swmr_write) { - H5_CHECK_OVERFLOW(shared->sizeof_rnode,size_t,hsize_t); - if(HADDR_UNDEF == (old_root_addr = H5MF_alloc(f, H5FD_MEM_BTREE, dxpl_id, (hsize_t)shared->sizeof_rnode))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "unable to allocate file space to move root") - - /* Unprotect the old root so we can move it. Also force it to be marked - * dirty so it is written to the new location. */ - if(H5AC_unprotect(f, dxpl_id, H5AC_BT, bt_ud.addr, bt_ud.bt, H5AC__DIRTIED_FLAG) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release old root") - bt_protected = FALSE; - - /* Move the location of the old root on the disk */ - if(H5AC_move_entry(f, H5AC_BT, bt_ud.addr, old_root_addr) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to move B-tree root node") - bt_ud.addr = old_root_addr; - - /* Update the split b-tree's left pointer to point to the new location */ - split_bt_ud.bt->left = bt_ud.addr; - split_bt_ud.cache_flags |= H5AC__DIRTIED_FLAG; - } /* end else */ + H5_CHECK_OVERFLOW(shared->sizeof_rnode,size_t,hsize_t); + if(HADDR_UNDEF == (old_root_addr = H5MF_alloc(f, H5FD_MEM_BTREE, dxpl_id, (hsize_t)shared->sizeof_rnode))) + HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "unable to allocate file space to move root") + + /* Unprotect the old root so we can move it. Also force it to be marked + * dirty so it is written to the new location. */ + if(H5AC_unprotect(f, dxpl_id, H5AC_BT, bt_ud.addr, bt_ud.bt, H5AC__DIRTIED_FLAG) < 0) + HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release old root") + bt_protected = FALSE; + + /* Move the location of the old root on the disk */ + if(H5AC_move_entry(f, H5AC_BT, bt_ud.addr, old_root_addr) < 0) + HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to move B-tree root node") + bt_ud.addr = old_root_addr; + + /* Update the split b-tree's left pointer to point to the new location */ + split_bt_ud.bt->left = bt_ud.addr; + split_bt_ud.cache_flags |= H5AC__DIRTIED_FLAG; /* Make a copy of the old root information */ if(NULL == (new_root_bt = H5B_copy(bt_ud.bt))) @@ -885,39 +673,12 @@ H5B_insert(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, HDmemcpy(H5B_NKEY(new_root_bt, shared, 1), md_key, shared->type->sizeof_nkey); HDmemcpy(H5B_NKEY(new_root_bt, shared, 2), rt_key, shared->type->sizeof_nkey); - /* Insert the modified copy of the old root into the file again, and pin if - * doing swmr writes */ - if(shared->swmr_write) { - if(H5AC_insert_entry(f, dxpl_id, H5AC_BT, addr, new_root_bt, H5AC__PIN_ENTRY_FLAG) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTFLUSH, FAIL, "unable to add new B-tree root node to cache") - nrbt_pinned = TRUE; - - /* Set up flush dependencies */ - HDassert(parent); - HDassert(bt_ud.bt->parent == parent); - if(H5AC_destroy_flush_dependency(parent, bt_ud.bt) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTDEPEND, FAIL, "unable to destroy flush dependency") - if(H5AC_create_flush_dependency(new_root_bt, bt_ud.bt) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTDEPEND, FAIL, "unable to create flush dependency") - bt_ud.bt->parent = new_root_bt; - - HDassert(split_bt_ud.bt->parent == parent); - if(H5AC_destroy_flush_dependency(parent, split_bt_ud.bt) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTDEPEND, FAIL, "unable to destroy flush dependency") - if(H5AC_create_flush_dependency(new_root_bt, split_bt_ud.bt) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTDEPEND, FAIL, "unable to create flush dependency") - split_bt_ud.bt->parent = new_root_bt; - - HDassert(new_root_bt->parent == parent); - } /* end if */ - else { - if(H5AC_insert_entry(f, dxpl_id, H5AC_BT, addr, new_root_bt, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTFLUSH, FAIL, "unable to add new B-tree root node to cache") + if(H5AC_insert_entry(f, dxpl_id, H5AC_BT, addr, new_root_bt, H5AC__NO_FLAGS_SET) < 0) + HGOTO_ERROR(H5E_BTREE, H5E_CANTFLUSH, FAIL, "unable to add new B-tree root node to cache") - /* Mark new_root_bt as NULL, as it is not pinned or protected and does - * not need to be freed as it is now in the cache. */ - new_root_bt = NULL; - } /* end else */ + /* Mark new_root_bt as NULL, as it is not pinned or protected and does + * not need to be freed as it is now in the cache. */ + new_root_bt = NULL; done: if(bt_protected) @@ -929,12 +690,7 @@ done: if(H5AC_unprotect(f, dxpl_id, H5AC_BT, split_bt_ud.addr, split_bt_ud.bt, split_bt_ud.cache_flags) < 0) HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to unprotect new child") - if(nrbt_pinned) { - HDassert(shared->swmr_write); - if(H5AC_unpin_entry(new_root_bt) < 0) - HDONE_ERROR(H5E_BTREE, H5E_CANTUNPIN, FAIL, "unable to unpin new root") - } /* end if */ - else if(new_root_bt) { + if(new_root_bt) { HDassert(ret_value < 0); if(H5B_node_dest(new_root_bt) < 0) HDONE_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, "unable to free B-tree root node"); @@ -965,7 +721,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5B_insert_child(H5B_t *bt, unsigned *bt_flags, unsigned *idx, +H5B_insert_child(H5B_t *bt, unsigned *bt_flags, unsigned idx, haddr_t child, H5B_ins_t anchor, const void *md_key) { H5B_shared_t *shared; /* Pointer to shared B-tree info */ @@ -983,8 +739,8 @@ H5B_insert_child(H5B_t *bt, unsigned *bt_flags, unsigned *idx, /* Check for inserting right-most key into node (common when just appending * records to an unlimited dimension chunked dataset) */ - base = H5B_NKEY(bt, shared, (*idx + 1)); - if((*idx + 1) == bt->nchildren) { + base = H5B_NKEY(bt, shared, (idx + 1)); + if((idx + 1) == bt->nchildren) { /* Make room for the new key */ HDmemcpy(base + shared->type->sizeof_nkey, base, shared->type->sizeof_nkey); /* No overlap possible - memcpy() OK */ @@ -992,33 +748,34 @@ H5B_insert_child(H5B_t *bt, unsigned *bt_flags, unsigned *idx, /* The MD_KEY is the left key of the new node */ if(H5B_INS_RIGHT == anchor) - (*idx)++; /* Don't have to memmove() child addresses down, just add new child */ + (idx)++; /* Don't have to memmove() child addresses down, just add new child */ else /* Make room for the new child address */ - bt->child[*idx + 1] = bt->child[*idx]; + bt->child[idx + 1] = bt->child[idx]; } /* end if */ else { /* Make room for the new key */ HDmemmove(base + shared->type->sizeof_nkey, base, - (bt->nchildren - *idx) * shared->type->sizeof_nkey); + (bt->nchildren - idx) * shared->type->sizeof_nkey); HDmemcpy(base, md_key, shared->type->sizeof_nkey); /* The MD_KEY is the left key of the new node */ if(H5B_INS_RIGHT == anchor) - (*idx)++; + (idx)++; /* Make room for the new child address */ - HDmemmove(bt->child + *idx + 1, bt->child + *idx, - (bt->nchildren - *idx) * sizeof(haddr_t)); + HDmemmove(bt->child + idx + 1, bt->child + idx, + (bt->nchildren - idx) * sizeof(haddr_t)); } /* end if */ - bt->child[*idx] = child; + bt->child[idx] = child; bt->nchildren += 1; /* Mark node as dirty */ *bt_flags |= H5AC__DIRTIED_FLAG; FUNC_LEAVE_NOAPI(SUCCEED) + } /* end H5B_insert_child() */ @@ -1306,21 +1063,6 @@ H5B_insert_helper(H5F_t *f, hid_t dxpl_id, H5B_ins_ud_t *bt_ud, hbool_t *tmp_bt_flags_ptr = NULL; H5B_t *tmp_bt; - /* Update child pointer to (old) child if swmr writes are on and level > - * 0, as it has been moved by H5B_split (one level down) */ - if(shared->swmr_write && bt->level > 0) { - HDassert(child_bt_ud.bt); - HDassert(bt_ud->bt->child[idx] != child_bt_ud.addr); - - bt_ud->bt->child[idx] = child_bt_ud.addr; - } /* end if */ -#ifndef NDEBUG - if(!(shared->swmr_write) && bt->level > 0) { - HDassert(child_bt_ud.bt); - HDassert(bt_ud->bt->child[idx] == child_bt_ud.addr); - } /* end if */ -#endif /* NDEBUG */ - /* * If this node is full then split it before inserting the new child. */ @@ -1342,16 +1084,8 @@ H5B_insert_helper(H5F_t *f, hid_t dxpl_id, H5B_ins_ud_t *bt_ud, } /* end else */ /* Insert the child */ - if(H5B_insert_child(tmp_bt, tmp_bt_flags_ptr, &idx, new_child_bt_ud.addr, my_ins, md_key) < 0) + if(H5B_insert_child(tmp_bt, tmp_bt_flags_ptr, idx, new_child_bt_ud.addr, my_ins, md_key) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, "can't insert child") - - /* Set up flush dependency on child client object, if appropriate */ - if(shared->swmr_write && bt->level == 0) { - HDassert(!child_bt_ud.bt); - HDassert(shared->type->create_flush_dep); - if((shared->type->create_flush_dep)(H5B_NKEY(tmp_bt, shared, idx), udata, tmp_bt) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTDEPEND, H5B_INS_ERROR, "unable to create flush dependency") - } /* end if */ } else { if(H5B_INS_CHANGE == my_ins) { /* @@ -1362,13 +1096,6 @@ H5B_insert_helper(H5F_t *f, hid_t dxpl_id, H5B_ins_ud_t *bt_ud, bt->child[idx] = new_child_bt_ud.addr; bt_ud->cache_flags |= H5AC__DIRTIED_FLAG; } /* end if */ - /*Set up flush dependency on child client object, if appropriate */ - if(shared->swmr_write && bt->level == 0) { - HDassert(!child_bt_ud.bt); - HDassert(shared->type->create_flush_dep); - if((shared->type->create_flush_dep)(H5B_NKEY(bt, shared, idx), udata, bt) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTDEPEND, H5B_INS_ERROR, "unable to create flush dependency") - } /* end if */ } /* end if */ /* @@ -1417,17 +1144,11 @@ done: * matzke@llnl.gov * Jun 23 1997 * - * Modifications: Neil Fortner - * Jun 23 2011 - * Replaced original function with new algorithm that doesn't - * use sibling pointers (for SWMR consistency) or unprotect - * nodes during recursion (for performance and safety). - * *------------------------------------------------------------------------- */ static herr_t H5B_iterate_helper(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, - H5B_operator_t op, void *udata, void *parent) + H5B_operator_t op, void *udata) { H5B_t *bt = NULL; /* Pointer to current B-tree node */ H5UC_t *rc_shared; /* Ref-counted shared info */ @@ -1456,7 +1177,6 @@ H5B_iterate_helper(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t add /* Protect the initial/current node */ cache_udata.f = f; cache_udata.type = type; - cache_udata.parent = parent; cache_udata.rc_shared = rc_shared; if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, &cache_udata, H5AC_READ))) HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, H5_ITER_ERROR, "unable to load B-tree node") @@ -1465,7 +1185,7 @@ H5B_iterate_helper(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t add for(i=0; i<bt->nchildren && ret_value == H5_ITER_CONT; i++) { if(bt->level > 0) { /* Keep following the left-most child until we reach a leaf node. */ - if((ret_value = H5B_iterate_helper(f, dxpl_id, type, bt->child[i], op, udata, bt)) < 0) + if((ret_value = H5B_iterate_helper(f, dxpl_id, type, bt->child[i], op, udata)) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTLIST, H5_ITER_ERROR, "unable to list B-tree node") } /* end if */ else @@ -1497,7 +1217,7 @@ done: */ herr_t H5B_iterate(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, - H5B_operator_t op, void *udata, void *parent) + H5B_operator_t op, void *udata) { herr_t ret_value; /* Return value */ @@ -1513,7 +1233,7 @@ H5B_iterate(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, HDassert(udata); /* Iterate over the B-tree records */ - if((ret_value = H5B_iterate_helper(f, dxpl_id, type, addr, op, udata, parent)) < 0) + if((ret_value = H5B_iterate_helper(f, dxpl_id, type, addr, op, udata)) < 0) HERROR(H5E_BTREE, H5E_BADITER, "B-tree iteration failed"); FUNC_LEAVE_NOAPI(ret_value) @@ -1548,8 +1268,7 @@ static H5B_ins_t H5B_remove_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type, int level, uint8_t *lt_key/*out*/, hbool_t *lt_key_changed/*out*/, void *udata, - uint8_t *rt_key/*out*/, hbool_t *rt_key_changed/*out*/, - void *parent) + uint8_t *rt_key/*out*/, hbool_t *rt_key_changed/*out*/) { H5B_t *bt = NULL, *sibling = NULL; unsigned bt_flags = H5AC__NO_FLAGS_SET; @@ -1583,7 +1302,6 @@ H5B_remove_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type cache_udata.f = f; cache_udata.type = type; cache_udata.rc_shared = rc_shared; - cache_udata.parent = parent; if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, &cache_udata, H5AC_WRITE))) HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, H5B_INS_ERROR, "unable to load B-tree node") @@ -1608,7 +1326,7 @@ H5B_remove_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type if((int)(ret_value = H5B_remove_helper(f, dxpl_id, bt->child[idx], type, level + 1, H5B_NKEY(bt, shared, idx)/*out*/, lt_key_changed/*out*/, udata, H5B_NKEY(bt, shared, idx + 1)/*out*/, - rt_key_changed/*out*/, bt)) < 0) + rt_key_changed/*out*/)) < 0) HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, H5B_INS_ERROR, "key not found in subtree") } else if(type->remove) { /* @@ -1724,8 +1442,7 @@ H5B_remove_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type bt->nchildren = 0; /* Delete the node from disk (via the metadata cache) */ - if(!shared->swmr_write) - bt_flags |= H5AC__DIRTIED_FLAG | H5AC__FREE_FILE_SPACE_FLAG; + bt_flags |= H5AC__DIRTIED_FLAG | H5AC__FREE_FILE_SPACE_FLAG; H5_CHECK_OVERFLOW(shared->sizeof_rnode, size_t, hsize_t); if(H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, bt_flags | H5AC__DELETED_FLAG) < 0) { bt = NULL; @@ -1873,8 +1590,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5B_remove(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, - void *udata, void *parent) +H5B_remove(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, void *udata) { /* These are defined this way to satisfy alignment constraints */ uint64_t _lt_key[128], _rt_key[128]; @@ -1894,7 +1610,7 @@ H5B_remove(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, /* The actual removal */ if(H5B_remove_helper(f, dxpl_id, addr, type, 0, lt_key, <_key_changed, - udata, rt_key, &rt_key_changed, parent) + udata, rt_key, &rt_key_changed) == H5B_INS_ERROR) HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "unable to remove entry from B-tree") @@ -1920,8 +1636,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5B_delete(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, - void *udata, void *parent) +H5B_delete(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, void *udata) { H5B_t *bt = NULL; /* B-tree node being operated on */ H5UC_t *rc_shared; /* Ref-counted shared info */ @@ -1946,7 +1661,6 @@ H5B_delete(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, /* Lock this B-tree node into memory for now */ cache_udata.f = f; cache_udata.type = type; - cache_udata.parent = parent; cache_udata.rc_shared = rc_shared; if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, &cache_udata, H5AC_WRITE))) HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree node") @@ -1955,7 +1669,7 @@ H5B_delete(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, if(bt->level > 0) { /* Iterate over all children in node, deleting them */ for(u = 0; u < bt->nchildren; u++) - if(H5B_delete(f, dxpl_id, type, bt->child[u], udata, bt) < 0) + if(H5B_delete(f, dxpl_id, type, bt->child[u], udata) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTLIST, FAIL, "unable to delete B-tree node") } /* end if */ @@ -1976,7 +1690,7 @@ H5B_delete(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, } /* end else */ done: - if(bt && H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, (unsigned)(H5AC__DELETED_FLAG | (shared->swmr_write ? 0 : H5AC__FREE_FILE_SPACE_FLAG))) < 0) + if(bt && H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG) < 0) HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node in cache") FUNC_LEAVE_NOAPI(ret_value) @@ -2041,11 +1755,6 @@ HDmemset(shared->page, 0, shared->sizeof_rnode); for(u = 0; u < (shared->two_k + 1); u++) shared->nkey[u] = u * type->sizeof_nkey; - /* Determine if we are doing SWMR writes. Only enable for chunks for now. - */ - shared->swmr_write = (H5F_INTENT(f) & H5F_ACC_SWMR_WRITE) > 0 - && type->id == H5B_CHUNK_ID; - /* Set return value */ ret_value = shared; @@ -2178,7 +1887,7 @@ done: */ static herr_t H5B_get_info_helper(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, - const H5B_info_ud_t *info_udata, void *parent) + const H5B_info_ud_t *info_udata) { H5B_t *bt = NULL; /* Pointer to current B-tree node */ H5UC_t *rc_shared; /* Ref-counted shared info */ @@ -2214,7 +1923,6 @@ H5B_get_info_helper(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t ad /* Protect the initial/current node */ cache_udata.f = f; cache_udata.type = type; - cache_udata.parent = parent; cache_udata.rc_shared = rc_shared; if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, &cache_udata, H5AC_READ))) HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree node") @@ -2259,7 +1967,7 @@ H5B_get_info_helper(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t ad /* Check for another "row" of B-tree nodes to iterate over */ if(level > 0) { /* Keep following the left-most child until we reach a leaf node. */ - if(H5B_get_info_helper(f, dxpl_id, type, left_child, info_udata, bt) < 0) + if(H5B_get_info_helper(f, dxpl_id, type, left_child, info_udata) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTLIST, FAIL, "unable to list B-tree node") } /* end if */ @@ -2285,7 +1993,7 @@ done: */ herr_t H5B_get_info(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, - H5B_info_t *bt_info, H5B_operator_t op, void *udata, void *parent) + H5B_info_t *bt_info, H5B_operator_t op, void *udata) { H5B_info_ud_t info_udata; /* User-data for B-tree size iteration */ herr_t ret_value = SUCCEED; /* Return value */ @@ -2309,13 +2017,13 @@ H5B_get_info(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, info_udata.udata = udata; /* Iterate over the B-tree nodes */ - if(H5B_get_info_helper(f, dxpl_id, type, addr, &info_udata, parent) < 0) + if(H5B_get_info_helper(f, dxpl_id, type, addr, &info_udata) < 0) HGOTO_ERROR(H5E_BTREE, H5E_BADITER, FAIL, "B-tree iteration failed") /* Iterate over the B-tree records, making any "leaf" callbacks */ /* (Only if operator defined) */ if(op) - if((ret_value = H5B_iterate_helper(f, dxpl_id, type, addr, op, udata, parent)) < 0) + if((ret_value = H5B_iterate_helper(f, dxpl_id, type, addr, op, udata)) < 0) HERROR(H5E_BTREE, H5E_BADITER, "B-tree iteration failed"); done: @@ -2412,122 +2120,4 @@ H5B_node_dest(H5B_t *bt) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5B_node_dest() */ - -/*------------------------------------------------------------------------- - * Function: H5B_support - * - * Purpose: Add a flush dependency between the b-tree child object (as - * the flush dependency child) and the b-tree node containing - * the address of that child. If the child has not yet been - * inserted, does nothing. - * - * Return: TRUE if flush dependency created - * FALSE if child is not in b-tree - * Negative on failure - * - * Programmer: Neil Fortner - * Aug 18 2010 - * - *------------------------------------------------------------------------- - */ -htri_t -H5B_support(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, - void *udata, void *parent, void *child) -{ - H5B_t *node = NULL; /* Node containing direct link to child */ - herr_t ret_value; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) - - /* - * Check arguments. - */ - HDassert(f); - HDassert(type); - HDassert(type->decode); - HDassert(type->cmp3); - HDassert(type->found); - HDassert(H5F_addr_defined(addr)); - HDassert(udata); - HDassert(child); - - /* Lookup the node which points to the requested child */ - if(H5B_find_node(f, dxpl_id, type, addr, udata, parent, &node) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "can't lookup key in B-tree") - - /* Set the return value, and add the flush dependency if the ndoe was found - */ - if(node) { - if(H5AC_create_flush_dependency(node, child) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTDEPEND, FAIL, "unable to create flush dependency") - ret_value = TRUE; - } /* end if */ - else - ret_value = FALSE; - -done: - if(node && H5AC_unpin_entry(node) < 0) - HDONE_ERROR(H5E_BTREE, H5E_CANTUNPIN, FAIL, "unable to unpin node") - - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5B_support() */ - - -/*------------------------------------------------------------------------- - * Function: H5B_unsupport - * - * Purpose: Destroy a flush dependency between the b-tree child object - * and the b-tree node containing the address of that child. - * This dependency *must* have been created earlier either by - * a call to H5B_support() or by the client (presumably via - * the create_flush_dep() callback on insertion). - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Neil Fortner - * Aug 18 2010 - * - *------------------------------------------------------------------------- - */ -herr_t -H5B_unsupport(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, - void *udata, void *parent, void *child) -{ - H5B_t *node = NULL; /* Node containing direct link to child */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) - - /* - * Check arguments. - */ - HDassert(f); - HDassert(type); - HDassert(type->decode); - HDassert(type->cmp3); - HDassert(type->found); - HDassert(H5F_addr_defined(addr)); - HDassert(udata); - HDassert(child); - - /* Lookup the node which points to the requested child */ - if(H5B_find_node(f, dxpl_id, type, addr, udata, parent, &node) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "can't lookup key in B-tree") - - /* It is an error if the node does not exist yet - the client should only - * call this function if support() succeeded or if the client's - * create_flush_dep() callback has been called. */ - if(!node) - HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "node not found in B-tree") - - /* Add the flush dependency */ - if(H5AC_destroy_flush_dependency(node, child) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency") - -done: - if(node && H5AC_unpin_entry(node) < 0) - HDONE_ERROR(H5E_BTREE, H5E_CANTUNPIN, FAIL, "unable to unpin node") - - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5B_unsupport() */ @@ -1386,296 +1386,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5B2_support - * - * Purpose: Add a flush dependency between the b-tree child object (as - * the flush dependency child) and the b-tree node containing - * the address of that child. If the child has not yet been - * inserted, does nothing. - * - * Return: TRUE if flush dependency created - * FALSE if child is not in b-tree - * Negative on failure - * - * Programmer: Neil Fortner - * May 11 2012 - * - *------------------------------------------------------------------------- - */ -htri_t -H5B2_support(H5B2_t *bt2, hid_t dxpl_id, void *udata, H5AC_info_t *child) -{ - H5B2_hdr_t *hdr; /* Pointer to the B-tree header */ - H5B2_node_ptr_t curr_node_ptr; /* Node pointer info for current node */ - void *parent = NULL; /* Parent of current node */ - unsigned depth; /* Current depth of the tree */ - int cmp; /* Comparison value of records */ - unsigned idx; /* Location of record which matches key */ - htri_t ret_value = FALSE; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) - - /* Check arguments. */ - HDassert(bt2); - HDassert(child); - - /* Set the shared v2 B-tree header's file context for this operation */ - bt2->hdr->f = bt2->f; - - /* Get the v2 B-tree header */ - hdr = bt2->hdr; - - /* Make copy of the root node pointer to start search with */ - curr_node_ptr = hdr->root; - - /* Check for empty tree */ - if(curr_node_ptr.node_nrec == 0) - HGOTO_DONE(FALSE) - - /* Current depth of the tree */ - depth = hdr->depth; - - /* This should only be called if swmr_write is on */ - HDassert(hdr->swmr_write); - - /* Set initial parent */ - parent = hdr; - - /* Walk down B-tree to find record or leaf node where record is located */ - while(depth > 0) { - H5B2_internal_t *internal; /* Pointer to internal node in B-tree */ - H5B2_node_ptr_t next_node_ptr; /* Node pointer info for next node */ - - /* Lock B-tree current node */ - if(NULL == (internal = H5B2_protect_internal(hdr, dxpl_id, curr_node_ptr.addr, parent, curr_node_ptr.node_nrec, depth, H5AC_READ))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree internal node") - - /* Unpin parent if necessary */ - if(parent != hdr && H5AC_unpin_entry(parent) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPIN, FAIL, "unable to unpin parent entry") - parent = NULL; - - /* Locate node pointer for child */ - cmp = H5B2_locate_record(hdr->cls, internal->nrec, hdr->nat_off, internal->int_native, udata, &idx); - if(cmp > 0) - idx++; - - if(cmp != 0) { - /* Get node pointer for next node to search */ - next_node_ptr=internal->node_ptrs[idx]; - - /* Unlock current node */ - if(H5AC_unprotect(hdr->f, dxpl_id, H5AC_BT2_INT, curr_node_ptr.addr, internal, H5AC__PIN_ENTRY_FLAG) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node") - - /* Keep track of parent */ - parent = internal; - - /* Set pointer to next node to load */ - curr_node_ptr = next_node_ptr; - } /* end if */ - else { - /* Add flush dependency on child */ - if(H5B2__create_flush_depend((H5AC_info_t *)internal, child) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTDEPEND, FAIL, "unable to create flush dependency") - - /* Unlock current node */ - if(H5AC_unprotect(hdr->f, dxpl_id, H5AC_BT2_INT, curr_node_ptr.addr, internal, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node") - - /* Indicate record supported */ - HGOTO_DONE(TRUE) - } /* end else */ - - /* Decrement depth we're at in B-tree */ - depth--; - } /* end while */ - - { - H5B2_leaf_t *leaf; /* Pointer to leaf node in B-tree */ - - /* Lock B-tree leaf node */ - if(NULL == (leaf = H5B2_protect_leaf(hdr, dxpl_id, curr_node_ptr.addr, parent, curr_node_ptr.node_nrec, H5AC_READ))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node") - - /* Unpin parent if necessary */ - if(parent != hdr && H5AC_unpin_entry(parent) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPIN, FAIL, "unable to unpin parent entry") - parent = NULL; - - /* Locate record */ - cmp = H5B2_locate_record(hdr->cls, leaf->nrec, hdr->nat_off, leaf->leaf_native, udata, &idx); - - if(cmp == 0) { - /* Add flush dependency on child */ - if(H5B2__create_flush_depend((H5AC_info_t *)leaf, child) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTDEPEND, FAIL, "unable to create flush dependency") - - /* Indicate child was supported */ - ret_value = TRUE; - } /* end if */ - - /* Unlock current node */ - if(H5AC_unprotect(hdr->f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr.addr, leaf, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node") - } /* end block */ - -done: - if(parent) { - HDassert(ret_value < 0); - if(parent != hdr && H5AC_unpin_entry(parent) < 0) - HDONE_ERROR(H5E_BTREE, H5E_CANTUNPIN, FAIL, "unable to unpin parent entry") - } /* end if */ - - FUNC_LEAVE_NOAPI(ret_value) -} /* H5B2_support() */ - - -/*------------------------------------------------------------------------- - * Function: H5B2_unsupport - * - * Purpose: Destroy a flush dependency between the b-tree child object - * and the b-tree node containing the address of that child. - * This dependency *must* have been created earlier either by - * a call to H5B_support() or by the client (presumably via - * the create_flush_dep() callback on insertion). - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Neil Fortner - * May 14 2012 - * - *------------------------------------------------------------------------- - */ -herr_t -H5B2_unsupport(H5B2_t *bt2, hid_t dxpl_id, void *udata, H5AC_info_t *child) -{ - H5B2_hdr_t *hdr; /* Pointer to the B-tree header */ - H5B2_node_ptr_t curr_node_ptr; /* Node pointer info for current node */ - void *parent = NULL; /* Parent of current node */ - unsigned depth; /* Current depth of the tree */ - int cmp; /* Comparison value of records */ - unsigned idx; /* Location of record which matches key */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) - - /* Check arguments. */ - HDassert(bt2); - HDassert(child); - - /* Set the shared v2 B-tree header's file context for this operation */ - bt2->hdr->f = bt2->f; - - /* Get the v2 B-tree header */ - hdr = bt2->hdr; - - /* Make copy of the root node pointer to start search with */ - curr_node_ptr = hdr->root; - - /* Check for empty tree */ - if(curr_node_ptr.node_nrec == 0) - HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "B-tree is empty") - - /* Current depth of the tree */ - depth = hdr->depth; - - /* This should only be called if swmr_write is on */ - HDassert(hdr->swmr_write); - - /* Set initial parent */ - parent = hdr; - - /* Walk down B-tree to find record or leaf node where record is located */ - while(depth > 0) { - H5B2_internal_t *internal; /* Pointer to internal node in B-tree */ - H5B2_node_ptr_t next_node_ptr; /* Node pointer info for next node */ - - /* Lock B-tree current node */ - if(NULL == (internal = H5B2_protect_internal(hdr, dxpl_id, curr_node_ptr.addr, parent, curr_node_ptr.node_nrec, depth, H5AC_READ))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree internal node") - - /* Unpin parent if necessary */ - if(parent != hdr && H5AC_unpin_entry(parent) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPIN, FAIL, "unable to unpin parent entry") - parent = NULL; - - /* Locate node pointer for child */ - cmp = H5B2_locate_record(hdr->cls, internal->nrec, hdr->nat_off, internal->int_native, udata, &idx); - if(cmp > 0) - idx++; - - if(cmp != 0) { - /* Get node pointer for next node to search */ - next_node_ptr=internal->node_ptrs[idx]; - - /* Unlock current node */ - if(H5AC_unprotect(hdr->f, dxpl_id, H5AC_BT2_INT, curr_node_ptr.addr, internal, H5AC__PIN_ENTRY_FLAG) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node") - - /* Keep track of parent */ - parent = internal; - - /* Set pointer to next node to load */ - curr_node_ptr = next_node_ptr; - } /* end if */ - else { - /* Remove flush dependency on child */ - if(H5B2__destroy_flush_depend((H5AC_info_t *)internal, child) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTDEPEND, FAIL, "unable to destroy flush dependency") - - /* Unlock current node */ - if(H5AC_unprotect(hdr->f, dxpl_id, H5AC_BT2_INT, curr_node_ptr.addr, internal, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node") - - /* No need to continue */ - HGOTO_DONE(SUCCEED) - } /* end else */ - - /* Decrement depth we're at in B-tree */ - depth--; - } /* end while */ - - { - H5B2_leaf_t *leaf; /* Pointer to leaf node in B-tree */ - - /* Lock B-tree leaf node */ - if(NULL == (leaf = H5B2_protect_leaf(hdr, dxpl_id, curr_node_ptr.addr, parent, curr_node_ptr.node_nrec, H5AC_READ))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node") - - /* Unpin parent if necessary */ - if(parent != hdr && H5AC_unpin_entry(parent) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPIN, FAIL, "unable to unpin parent entry") - parent = NULL; - - /* Locate record */ - cmp = H5B2_locate_record(hdr->cls, leaf->nrec, hdr->nat_off, leaf->leaf_native, udata, &idx); - - if(cmp == 0) { - /* Remove flush dependency on child */ - if(H5B2__destroy_flush_depend((H5AC_info_t *)leaf, child) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTDEPEND, FAIL, "unable to destroy flush dependency") - } /* end if */ - else - HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "node not found in B-tree") - - /* Unlock current node */ - if(H5AC_unprotect(hdr->f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr.addr, leaf, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node") - } /* end block */ - -done: - if(parent) { - HDassert(ret_value < 0); - if(parent != hdr && H5AC_unpin_entry(parent) < 0) - HDONE_ERROR(H5E_BTREE, H5E_CANTUNPIN, FAIL, "unable to unpin parent entry") - } /* end if */ - - FUNC_LEAVE_NOAPI(ret_value) -} /* H5B2_unsupport() */ - - -/*------------------------------------------------------------------------- * Function: H5B2_depend * * Purpose: Make a child flush dependency between the v2 B-tree's diff --git a/src/H5B2int.c b/src/H5B2int.c index b1697db..bf5a56b 100644 --- a/src/H5B2int.c +++ b/src/H5B2int.c @@ -349,17 +349,6 @@ H5B2_split1(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth, /* Update flush dependencies */ if(hdr->swmr_write) { - /* Update dependencies on records */ - if(hdr->cls->upd_flush_dep) { - /* Update right child's records */ - for(u = 0; u < *right_nrec; u++) - if(hdr->cls->upd_flush_dep(H5B2_NAT_NREC(right_native, hdr, u), udata, left_child, right_child) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTDEPEND, FAIL, "unable to update flush dependency") - - /* Update the middle record */ - if(hdr->cls->upd_flush_dep(H5B2_INT_NREC(internal, hdr, idx), udata, left_child, internal) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTDEPEND, FAIL, "unable to update flush dependency") - } /* end if */ /* Update node pointers */ if(depth > 1) { @@ -688,21 +677,6 @@ H5B2_redistribute2(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth, /* Update flush dependencies */ if(hdr->swmr_write) { - /* Update dependencies on records */ - if(hdr->cls->upd_flush_dep) { - /* Update the old middle record */ - if(hdr->cls->upd_flush_dep(H5B2_NAT_NREC(left_native, hdr, *left_nrec), udata, internal, left_child) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTDEPEND, FAIL, "unable to update flush dependency") - - /* Update left child's records moved from right child */ - for(u = (*left_nrec + (unsigned)1); u < *left_nrec + move_nrec; u++) - if(hdr->cls->upd_flush_dep(H5B2_NAT_NREC(left_native, hdr, u), udata, right_child, left_child) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTDEPEND, FAIL, "unable to update flush dependency") - - /* Update the new middle record */ - if(hdr->cls->upd_flush_dep(H5B2_INT_NREC(internal, hdr, idx), udata, right_child, internal) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTDEPEND, FAIL, "unable to update flush dependency") - } /* end if */ /* Update node pointers */ if(depth > 1) { @@ -810,21 +784,6 @@ H5B2_redistribute2(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth, /* Update flush dependencies */ if(hdr->swmr_write) { - /* Update dependencies on records */ - if(hdr->cls->upd_flush_dep) { - /* Update the old middle record */ - if(hdr->cls->upd_flush_dep(H5B2_NAT_NREC(right_native, hdr, (move_nrec - 1)), udata, internal, right_child) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTDEPEND, FAIL, "unable to update flush dependency") - - /* Update right child's records moved from left child */ - for(u = 0; u < (unsigned)(move_nrec - 1); u++) - if(hdr->cls->upd_flush_dep(H5B2_NAT_NREC(right_native, hdr, u), udata, left_child, right_child) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTDEPEND, FAIL, "unable to update flush dependency") - - /* Update the new middle record */ - if(hdr->cls->upd_flush_dep(H5B2_INT_NREC(internal, hdr, idx), udata, left_child, internal) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTDEPEND, FAIL, "unable to update flush dependency") - } /* end if */ /* Update node pointers */ if(depth > 1) { @@ -1131,21 +1090,6 @@ H5B2_redistribute3(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth, /* Update flush dependencies */ if(hdr->swmr_write) { - /* Update dependencies on records */ - if(hdr->cls->upd_flush_dep) { - /* Update the old parent record */ - if(hdr->cls->upd_flush_dep(H5B2_NAT_NREC(left_native, hdr, *left_nrec), udata, internal, left_child) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTDEPEND, FAIL, "unable to update flush dependency") - - /* Update left child's records moved from middle child */ - for(u = (*left_nrec + (unsigned)1); u < *left_nrec + (unsigned)moved_middle_nrec; u++) - if(hdr->cls->upd_flush_dep(H5B2_NAT_NREC(left_native, hdr, u), udata, middle_child, left_child) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTDEPEND, FAIL, "unable to update flush dependency") - - /* Update the new parent record */ - if(hdr->cls->upd_flush_dep(H5B2_INT_NREC(internal, hdr, idx - 1), udata, middle_child, internal) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTDEPEND, FAIL, "unable to update flush dependency") - } /* end if */ /* Update node pointers */ if(depth > 1) { @@ -1247,21 +1191,6 @@ H5B2_redistribute3(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth, /* Update flush dependencies */ if(hdr->swmr_write) { - /* Update dependencies on records */ - if(hdr->cls->upd_flush_dep) { - /* Update the old parent record */ - if(hdr->cls->upd_flush_dep(H5B2_NAT_NREC(right_native, hdr, (right_nrec_move - 1)), udata, internal, right_child) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTDEPEND, FAIL, "unable to update flush dependency") - - /* Update right child's records moved from middle child */ - for(u = 0; u < (right_nrec_move - 1); u++) - if(hdr->cls->upd_flush_dep(H5B2_NAT_NREC(right_native, hdr, u), udata, middle_child, right_child) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTDEPEND, FAIL, "unable to update flush dependency") - - /* Update the new parent record */ - if(hdr->cls->upd_flush_dep(H5B2_INT_NREC(internal, hdr, idx), udata, middle_child, internal) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTDEPEND, FAIL, "unable to update flush dependency") - } /* end if */ /* Update node pointers */ if(depth > 1) { @@ -1363,21 +1292,6 @@ H5B2_redistribute3(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth, /* Update flush dependencies */ if(hdr->swmr_write) { - /* Update dependencies on records */ - if(hdr->cls->upd_flush_dep) { - /* Update the old parent record */ - if(hdr->cls->upd_flush_dep(H5B2_NAT_NREC(middle_native, hdr, (left_nrec_move - 1)), udata, internal, middle_child) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTDEPEND, FAIL, "unable to update flush dependency") - - /* Update middle child's records moved from left child */ - for(u = 0; u < (left_nrec_move - 1); u++) - if(hdr->cls->upd_flush_dep(H5B2_NAT_NREC(middle_native, hdr, u), udata, left_child, middle_child) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTDEPEND, FAIL, "unable to update flush dependency") - - /* Update the new parent record */ - if(hdr->cls->upd_flush_dep(H5B2_INT_NREC(internal, hdr, idx - 1), udata, left_child, internal) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTDEPEND, FAIL, "unable to update flush dependency") - } /* end if */ /* Update node pointers */ if(depth > 1) { @@ -1478,21 +1392,6 @@ H5B2_redistribute3(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth, /* Update flush dependencies */ if(hdr->swmr_write) { - /* Update dependencies on records */ - if(hdr->cls->upd_flush_dep) { - /* Update the old parent record */ - if(hdr->cls->upd_flush_dep(H5B2_NAT_NREC(middle_native, hdr, curr_middle_nrec), udata, internal, middle_child) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTDEPEND, FAIL, "unable to update flush dependency") - - /* Update middle child's records moved from right child */ - for(u = (curr_middle_nrec + (unsigned)1); u < curr_middle_nrec + right_nrec_move; u++) - if(hdr->cls->upd_flush_dep(H5B2_NAT_NREC(middle_native, hdr, u), udata, right_child, middle_child) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTDEPEND, FAIL, "unable to update flush dependency") - - /* Update the new parent record */ - if(hdr->cls->upd_flush_dep(H5B2_INT_NREC(internal, hdr, idx), udata, right_child, internal) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTDEPEND, FAIL, "unable to update flush dependency") - } /* end if */ /* Update node pointers */ if(depth > 1) { @@ -1776,17 +1675,6 @@ H5B2_merge2(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth, /* Update flush dependencies */ if(hdr->swmr_write) { - /* Update dependencies on records */ - if(hdr->cls->upd_flush_dep) { - /* Update the old parent record */ - if(hdr->cls->upd_flush_dep(H5B2_NAT_NREC(left_native, hdr, *left_nrec), udata, internal, left_child) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTDEPEND, FAIL, "unable to update flush dependency") - - /* Update records moved from right child */ - for(u = (*left_nrec + (unsigned)1); u < (*left_nrec + (unsigned)*right_nrec + (unsigned)1); u++) - if(hdr->cls->upd_flush_dep(H5B2_NAT_NREC(left_native, hdr, u), udata, right_child, left_child) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTDEPEND, FAIL, "unable to update flush dependency") - } /* end if */ /* Update node pointers */ if(depth > 1) { @@ -2077,21 +1965,6 @@ H5B2_merge3(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth, /* Update flush dependencies */ if(hdr->swmr_write) { - /* Update dependencies on records */ - if(hdr->cls->upd_flush_dep) { - /* Update the old parent record */ - if(hdr->cls->upd_flush_dep(H5B2_NAT_NREC(left_native, hdr, *left_nrec), udata, internal, left_child) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTDEPEND, FAIL, "unable to update flush dependency") - - /* Update records moved from middle child */ - for(u = (*left_nrec + (unsigned)1); u < (*left_nrec + (unsigned)middle_nrec_move); u++) - if(hdr->cls->upd_flush_dep(H5B2_NAT_NREC(left_native, hdr, u), udata, middle_child, left_child) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTDEPEND, FAIL, "unable to update flush dependency") - - /* Update the new parent record */ - if(hdr->cls->upd_flush_dep(H5B2_INT_NREC(internal, hdr, idx), udata, middle_child, internal) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTDEPEND, FAIL, "unable to update flush dependency") - } /* end if */ /* Update node pointers */ if(depth > 1) { @@ -2173,17 +2046,6 @@ H5B2_merge3(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth, /* Update flush dependencies */ if(hdr->swmr_write) { - /* Update dependencies on records */ - if(hdr->cls->upd_flush_dep) { - /* Update the old parent record */ - if(hdr->cls->upd_flush_dep(H5B2_NAT_NREC(middle_native, hdr, *middle_nrec), udata, internal, middle_child) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTDEPEND, FAIL, "unable to update flush dependency") - - /* Update records moved from right child */ - for(u = (*middle_nrec + (unsigned)1); u < (*middle_nrec + (unsigned)*right_nrec + (unsigned)1); u++) - if(hdr->cls->upd_flush_dep(H5B2_NAT_NREC(left_native, hdr, u), udata, right_child, middle_child) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTDEPEND, FAIL, "unable to update flush dependency") - } /* end if */ /* Update node pointers */ if(depth > 1) { @@ -2383,14 +2245,6 @@ H5B2_swap_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth, HDmemcpy(H5B2_NAT_NREC(child_native, hdr, 0), swap_loc, hdr->cls->nrec_size); HDmemcpy(swap_loc, hdr->page, hdr->cls->nrec_size); - /* Update flush dependencies */ - if(hdr->swmr_write && hdr->cls->upd_flush_dep) { - if(hdr->cls->upd_flush_dep(H5B2_NAT_NREC(child_native, hdr, 0), udata, swap_parent, child) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTDEPEND, FAIL, "unable to update flush dependency") - if(hdr->cls->upd_flush_dep(swap_loc, udata, child, swap_parent) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTDEPEND, FAIL, "unable to update flush dependency") - } /* end if */ - /* Mark parent as dirty */ *internal_flags_ptr |= H5AC__DIRTIED_FLAG; @@ -2475,11 +2329,6 @@ H5B2_insert_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, H5B2_node_ptr_t *curr_node_ptr, if((hdr->cls->store)(H5B2_LEAF_NREC(leaf, hdr, idx), udata) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, FAIL, "unable to insert record into leaf node") - /* Set up flush dependency on child client object, if appropriate */ - if(hdr->swmr_write && hdr->cls->crt_flush_dep) - if((hdr->cls->crt_flush_dep)(H5B2_LEAF_NREC(leaf, hdr, idx), udata, leaf) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTDEPEND, FAIL, "unable to create flush dependency") - /* Update record count for node pointer to current node */ curr_node_ptr->all_nrec++; curr_node_ptr->node_nrec++; diff --git a/src/H5B2private.h b/src/H5B2private.h index 1f547bd..472e4a4 100644 --- a/src/H5B2private.h +++ b/src/H5B2private.h @@ -95,8 +95,6 @@ struct H5B2_class_t { herr_t (*compare)(const void *rec1, const void *rec2); /* Compare two native records */ herr_t (*encode)(uint8_t *raw, const void *record, void *ctx); /* Encode record from native form to disk storage form */ herr_t (*decode)(const uint8_t *raw, void *record, void *ctx); /* Decode record from disk storage form to native form */ - herr_t (*crt_flush_dep)(void *record, void *udata, void *parent); /* Create a flush dependency with record as child */ - herr_t (*upd_flush_dep)(void *record, void *udata, void *old_parent, void *new_parent); /* Update a flush dependency with record as child */ herr_t (*debug)(FILE *stream, const H5F_t *f, hid_t dxpl_id, /* Print a record for debugging */ int indent, int fwidth, const void *record, const void *ctx); void *(*crt_dbg_ctx)(H5F_t *f, hid_t dxpl_id, haddr_t obj_addr); /* Create debugging context */ diff --git a/src/H5B2test.c b/src/H5B2test.c index 9694922..43155ab 100644 --- a/src/H5B2test.c +++ b/src/H5B2test.c @@ -86,8 +86,6 @@ const H5B2_class_t H5B2_TEST[1]={{ /* B-tree class information */ H5B2_test_compare, /* Record comparison callback */ H5B2_test_encode, /* Record encoding callback */ H5B2_test_decode, /* Record decoding callback */ - NULL, /* Create flush dependency */ - NULL, /* Update flush dependency */ H5B2_test_debug, /* Record debugging callback */ H5B2_test_crt_dbg_context, /* Create debugging context */ H5B2_test_dst_context /* Destroy debugging context */ diff --git a/src/H5Bcache.c b/src/H5Bcache.c index b85c10c..65de0c3 100644 --- a/src/H5Bcache.c +++ b/src/H5Bcache.c @@ -60,7 +60,6 @@ static herr_t H5B__flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, static herr_t H5B__dest(H5F_t *f, H5B_t *bt); static herr_t H5B__clear(H5F_t *f, H5B_t *b, hbool_t destroy); static herr_t H5B__compute_size(const H5F_t *f, const H5B_t *bt, size_t *size_ptr); -static herr_t H5B__notify(H5AC_notify_action_t action, H5B_t *bt); /*********************/ @@ -74,7 +73,7 @@ const H5AC_class_t H5AC_BT[1] = {{ (H5AC_flush_func_t)H5B__flush, (H5AC_dest_func_t)H5B__dest, (H5AC_clear_func_t)H5B__clear, - (H5AC_notify_func_t)H5B__notify, + (H5AC_notify_func_t)NULL, (H5AC_size_func_t)H5B__compute_size, }}; @@ -181,13 +180,6 @@ H5B__load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata) HGOTO_ERROR(H5E_BTREE, H5E_CANTDECODE, NULL, "unable to decode key") } /* end if */ - /* Set up flush dependency. The dependency will actually be created in the - * "notify" callback. */ - if(shared->swmr_write) { - HDassert(udata->parent); - bt->parent = udata->parent; - } /* end if */ - /* Set return value */ ret_value = bt; @@ -382,62 +374,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5B__notify - * - * Purpose: Handle cache action notifications - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Neil Fortner - * nfortne2@hdfgroup.org - * Aug 17 2010 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5B__notify(H5AC_notify_action_t action, H5B_t *bt) -{ - H5B_shared_t *shared; /* Pointer to shared B-tree info */ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_STATIC - - /* - * Check arguments. - */ - HDassert(bt); - HDassert(bt->rc_shared); - shared = (H5B_shared_t *)H5UC_GET_OBJ(bt->rc_shared); - - /* Check if the file was opened with SWMR-write access */ - if(shared->swmr_write) { - HDassert(bt->parent); - switch(action) { - case H5AC_NOTIFY_ACTION_AFTER_INSERT: - /* Create flush dependency on parent */ - if(H5AC_create_flush_dependency(bt->parent, bt) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTDEPEND, FAIL, "unable to create flush dependency") - break; - - case H5AC_NOTIFY_ACTION_BEFORE_EVICT: - /* Nothing to do */ - break; - - default: -#ifdef NDEBUG - HGOTO_ERROR(H5E_BTREE, H5E_BADVALUE, FAIL, "unknown action from metadata cache") -#else /* NDEBUG */ - HDassert(0 && "Unknown action?!?"); -#endif /* NDEBUG */ - } /* end switch */ - } /* end if */ - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5B__notify() */ - - -/*------------------------------------------------------------------------- * Function: H5B__compute_size * * Purpose: Compute the size in bytes of the specified instance of diff --git a/src/H5Bprivate.h b/src/H5Bprivate.h index 32236f0..1549d57 100644 --- a/src/H5Bprivate.h +++ b/src/H5Bprivate.h @@ -100,7 +100,6 @@ typedef struct H5B_shared_t { size_t sizeof_len; /* Size of file lengths (in bytes) */ uint8_t *page; /* Disk page */ size_t *nkey; /* Offsets of each native key in native key buffer */ - hbool_t swmr_write; /* Whether we are doing SWMR writes */ } H5B_shared_t; /* @@ -139,10 +138,6 @@ typedef struct H5B_class_t { herr_t (*decode)(const H5B_shared_t*, const uint8_t*, void*); herr_t (*encode)(const H5B_shared_t*, uint8_t*, const void*); herr_t (*debug_key)(FILE*, int, int, const void*, const void*); - - /* flush dependency functions */ - herr_t (*create_flush_dep)(void*, void*, void*); - herr_t (*update_flush_dep)(void*, void*, void*, void*); } H5B_class_t; /* Information about B-tree */ @@ -162,27 +157,22 @@ typedef struct H5B_info_t { /* Library-private Function Prototypes */ /***************************************/ H5_DLL herr_t H5B_create(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, - void *udata, void *parent, haddr_t *addr_p/*out*/); + void *udata, haddr_t *addr_p/*out*/); H5_DLL herr_t H5B_find(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, - haddr_t addr, void *udata, void *parent); + haddr_t addr, void *udata); H5_DLL herr_t H5B_insert(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, - haddr_t addr, void *udata, void *parent); + haddr_t addr, void *udata); H5_DLL herr_t H5B_iterate(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, - haddr_t addr, H5B_operator_t op, void *udata, void *parent); + haddr_t addr, H5B_operator_t op, void *udata); H5_DLL herr_t H5B_get_info(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, - haddr_t addr, H5B_info_t *bt_info, H5B_operator_t op, void *udata, - void *parent); + haddr_t addr, H5B_info_t *bt_info, H5B_operator_t op, void *udata); H5_DLL herr_t H5B_remove(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, - haddr_t addr, void *udata, void *parent); + haddr_t addr, void *udata); H5_DLL herr_t H5B_delete(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, - haddr_t addr, void *udata, void *parent); + haddr_t addr, void *udata); H5_DLL H5B_shared_t *H5B_shared_new(const H5F_t *f, const H5B_class_t *type, size_t sizeof_rkey); H5_DLL herr_t H5B_shared_free(void *_shared); -H5_DLL htri_t H5B_support(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, - haddr_t addr, void *udata, void *parent, void *child); -H5_DLL herr_t H5B_unsupport(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, - haddr_t addr, void *udata, void *parent, void *child); H5_DLL herr_t H5B_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, int indent, int fwidth, const H5B_class_t *type, void *udata); H5_DLL htri_t H5B_valid(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, diff --git a/src/H5Dbtree.c b/src/H5Dbtree.c index 6035fe5..d5349a6 100644 --- a/src/H5Dbtree.c +++ b/src/H5Dbtree.c @@ -124,17 +124,13 @@ static herr_t H5D__btree_encode_key(const H5B_shared_t *shared, uint8_t *raw, const void *_key); static herr_t H5D__btree_debug_key(FILE *stream, int indent, int fwidth, const void *key, const void *udata); -static herr_t H5D__btree_create_flush_dep(void *_key, void *_udata, - void *parent); -static herr_t H5D__btree_update_flush_dep(void *_key, void *_udata, - void *old_parent, void *new_parent); /* Chunked layout indexing callbacks */ static herr_t H5D__btree_idx_init(const H5D_chk_idx_info_t *idx_info, const H5S_t *space, haddr_t dset_ohdr_addr); static herr_t H5D__btree_idx_create(const H5D_chk_idx_info_t *idx_info); static hbool_t H5D__btree_idx_is_space_alloc(const H5O_storage_chunk_t *storage); -static herr_t H5D__btree_idx_insert(const H5D_chk_idx_info_t *idx_info, +static herr_t H5D__btree_idx_insert_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata); static herr_t H5D__btree_idx_get_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata); @@ -150,10 +146,6 @@ static herr_t H5D__btree_idx_copy_shutdown(H5O_storage_chunk_t *storage_src, static herr_t H5D__btree_idx_size(const H5D_chk_idx_info_t *idx_info, hsize_t *size); static herr_t H5D__btree_idx_reset(H5O_storage_chunk_t *storage, hbool_t reset_addr); -static herr_t H5D__btree_idx_support(const H5D_chk_idx_info_t *idx_info, - H5D_chunk_ud_t *udata, H5AC_info_t *child_entry); -static herr_t H5D__btree_idx_unsupport(const H5D_chk_idx_info_t *idx_info, - H5D_chunk_ud_t *udata, H5AC_info_t *child_entry); static herr_t H5D__btree_idx_dump(const H5O_storage_chunk_t *storage, FILE *stream); static herr_t H5D__btree_idx_dest(const H5D_chk_idx_info_t *idx_info); @@ -165,11 +157,11 @@ static herr_t H5D__btree_idx_dest(const H5D_chk_idx_info_t *idx_info); /* v1 B-tree indexed chunk I/O ops */ const H5D_chunk_ops_t H5D_COPS_BTREE[1] = {{ - TRUE, /* v1 B-tree indices do support SWMR access */ + FALSE, /* v1 B-tree indices does not support SWMR access */ H5D__btree_idx_init, H5D__btree_idx_create, H5D__btree_idx_is_space_alloc, - H5D__btree_idx_insert, + H5D__btree_idx_insert_addr, H5D__btree_idx_get_addr, NULL, H5D__btree_idx_iterate, @@ -179,8 +171,6 @@ const H5D_chunk_ops_t H5D_COPS_BTREE[1] = {{ H5D__btree_idx_copy_shutdown, H5D__btree_idx_size, H5D__btree_idx_reset, - H5D__btree_idx_support, - H5D__btree_idx_unsupport, H5D__btree_idx_dump, H5D__btree_idx_dest }}; @@ -206,9 +196,7 @@ H5B_class_t H5B_BTREE[1] = {{ H5D__btree_remove, /*remove */ H5D__btree_decode_key, /*decode */ H5D__btree_encode_key, /*encode */ - H5D__btree_debug_key, /*debug */ - H5D__btree_create_flush_dep, /*create_flush_dep */ - H5D__btree_update_flush_dep, /*update_flush_dep */ + H5D__btree_debug_key /*debug */ }}; @@ -268,7 +256,7 @@ H5D__btree_get_shared(const H5F_t UNUSED *f, const void *_udata) *------------------------------------------------------------------------- */ static herr_t -H5D__btree_new_node(H5F_t *f, hid_t dxpl_id, H5B_ins_t op, +H5D__btree_new_node(H5F_t *f, hid_t UNUSED dxpl_id, H5B_ins_t op, void *_lt_key, void *_udata, void *_rt_key, haddr_t *addr_p/*out*/) { @@ -278,7 +266,7 @@ H5D__btree_new_node(H5F_t *f, hid_t dxpl_id, H5B_ins_t op, unsigned u; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_STATIC + FUNC_ENTER_STATIC_NOERR /* check args */ HDassert(f); @@ -288,12 +276,10 @@ H5D__btree_new_node(H5F_t *f, hid_t dxpl_id, H5B_ins_t op, HDassert(udata->common.layout->ndims > 0 && udata->common.layout->ndims < H5O_LAYOUT_NDIMS); HDassert(addr_p); - /* Allocate new storage */ + /* Set address */ HDassert(udata->nbytes > 0); - H5_CHECK_OVERFLOW(udata->nbytes, uint32_t, hsize_t); - if(HADDR_UNDEF == (*addr_p = H5MF_alloc(f, H5FD_MEM_DRAW, dxpl_id, (hsize_t)udata->nbytes))) - HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "couldn't allocate new file storage") - udata->addr = *addr_p; + HDassert(H5F_addr_defined(udata->addr)); + *addr_p = udata->addr; /* * The left key describes the storage of the UDATA chunk being @@ -318,7 +304,6 @@ H5D__btree_new_node(H5F_t *f, hid_t dxpl_id, H5B_ins_t op, } /* end if */ } /* end if */ -done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__btree_new_node() */ @@ -520,7 +505,7 @@ done: */ /* ARGSUSED */ static H5B_ins_t -H5D__btree_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key, +H5D__btree_insert(H5F_t *f, hid_t UNUSED dxpl_id, haddr_t addr, void *_lt_key, hbool_t *lt_key_changed, void *_md_key, void *_udata, void *_rt_key, hbool_t UNUSED *rt_key_changed, @@ -561,41 +546,16 @@ H5D__btree_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key, * then we should reallocate storage. */ if(lt_key->nbytes != udata->nbytes) { -/* Currently, the old chunk data is "thrown away" after the space is reallocated, - * so avoid data copy in H5MF_realloc() call by just free'ing the space and - * allocating new space. - * - * This should keep the file smaller also, by freeing the space and then - * allocating new space, instead of vice versa (in H5MF_realloc). - * - * QAK - 11/19/2002 - */ -#ifdef OLD_WAY - /* Note that this does not take SWMR writes into account! Fix this - * if we ever want to go back to this code. -NAF 8/2/11 */ - if(HADDR_UNDEF == (*new_node_p = H5MF_realloc(f, H5FD_MEM_DRAW, addr, - (hsize_t)lt_key->nbytes, (hsize_t)udata->nbytes))) - HGOTO_ERROR(H5E_STORAGE, H5E_NOSPACE, H5B_INS_ERROR, "unable to reallocate chunk storage") -#else /* OLD_WAY */ - /* Only free the old location if not doing SWMR writes - otherwise - * we must keep the old chunk around in case a reader has an - * outdated version of the b-tree node */ - if(!(H5F_INTENT(f) & H5F_ACC_SWMR_WRITE)) { - H5_CHECK_OVERFLOW(lt_key->nbytes, uint32_t, hsize_t); - if(H5MF_xfree(f, H5FD_MEM_DRAW, dxpl_id, addr, (hsize_t)lt_key->nbytes) < 0) - HGOTO_ERROR(H5E_STORAGE, H5E_CANTFREE, H5B_INS_ERROR, "unable to free chunk") - } /* end if */ - H5_CHECK_OVERFLOW(udata->nbytes, uint32_t, hsize_t); - if(HADDR_UNDEF == (*new_node_p = H5MF_alloc(f, H5FD_MEM_DRAW, dxpl_id, (hsize_t)udata->nbytes))) - HGOTO_ERROR(H5E_STORAGE, H5E_NOSPACE, H5B_INS_ERROR, "unable to reallocate chunk") -#endif /* OLD_WAY */ + /* Set node's address (already re-allocated by main chunk routines) */ + HDassert(H5F_addr_defined(udata->addr)); + *new_node_p = udata->addr; lt_key->nbytes = udata->nbytes; lt_key->filter_mask = udata->filter_mask; *lt_key_changed = TRUE; - udata->addr = *new_node_p; ret_value = H5B_INS_CHANGE; } else { - udata->addr = addr; + /* Already have address in udata, from main chunk routines */ + HDassert(H5F_addr_defined(udata->addr)); ret_value = H5B_INS_NOOP; } @@ -616,13 +576,8 @@ H5D__btree_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key, md_key->offset[u] = udata->common.offset[u]; } /* end for */ - /* - * Allocate storage for the new chunk - */ - H5_CHECK_OVERFLOW(udata->nbytes, uint32_t, hsize_t); - if(HADDR_UNDEF == (*new_node_p = H5MF_alloc(f, H5FD_MEM_DRAW, dxpl_id, (hsize_t)udata->nbytes))) - HGOTO_ERROR(H5E_STORAGE, H5E_NOSPACE, H5B_INS_ERROR, "file allocation failed") - udata->addr = *new_node_p; + HDassert(H5F_addr_defined(udata->addr)); + *new_node_p = udata->addr; ret_value = H5B_INS_RIGHT; } else { @@ -661,11 +616,9 @@ H5D__btree_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key /*in,out FUNC_ENTER_STATIC /* Remove raw data chunk from file */ - if(!(H5F_INTENT(f) & H5F_ACC_SWMR_WRITE)) { - H5_CHECK_OVERFLOW(lt_key->nbytes, uint32_t, hsize_t); - if(H5MF_xfree(f, H5FD_MEM_DRAW, dxpl_id, addr, (hsize_t)lt_key->nbytes) < 0) - HGOTO_ERROR(H5E_STORAGE, H5E_CANTFREE, H5B_INS_ERROR, "unable to free chunk") - } /* end if */ + H5_CHECK_OVERFLOW(lt_key->nbytes, uint32_t, hsize_t); + if(H5MF_xfree(f, H5FD_MEM_DRAW, dxpl_id, addr, (hsize_t)lt_key->nbytes) < 0) + HGOTO_ERROR(H5E_STORAGE, H5E_CANTFREE, H5B_INS_ERROR, "unable to free chunk") /* Mark keys as unchanged */ *lt_key_changed = FALSE; @@ -831,90 +784,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5D__btree_create_flush_dep - * - * Purpose: Creates a flush dependency between the specified chunk - * (child) and parent. - * - * Return: Success: 0 - * Failure: FAIL - * - * Programmer: Neil Fortner - * Tuesday, September 21, 2010 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5D__btree_create_flush_dep(void *_key, void *_udata, void *parent) -{ - H5D_btree_key_t *key = (H5D_btree_key_t *)_key; - H5D_chunk_common_ud_t *udata = (H5D_chunk_common_ud_t *) _udata; - int ret_value = SUCCEED; - - FUNC_ENTER_STATIC - - HDassert(key); - HDassert(udata); - HDassert(udata->layout->ndims > 0 && udata->layout->ndims <= H5O_LAYOUT_NDIMS); - HDassert(parent); - - /* If there is no rdcc, then there are no cached chunks to create - * dependencies on. This should only happen when copying */ - if(udata->rdcc) - /* Delegate to chunk routine */ - if(H5D__chunk_create_flush_dep(udata->rdcc, udata->layout, key->offset, parent) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTDEPEND, FAIL, "unable to create flush dependency") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5D__btree_create_flush_dep() */ - - -/*------------------------------------------------------------------------- - * Function: H5D__btree_update_flush_dep - * - * Purpose: Updates the flush dependency of the specified chunk from - * old_parent to new_parent, but only if the current parent - * is cached. If the chunk is not cached, does nothing. - * - * Return: Success: 0 - * Failure: FAIL - * - * Programmer: Neil Fortner - * Tuesday, August 31, 2010 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5D__btree_update_flush_dep(void *_key, void *_udata, void *old_parent, - void *new_parent) -{ - H5D_btree_key_t *key = (H5D_btree_key_t *)_key; - H5D_chunk_common_ud_t *udata = (H5D_chunk_common_ud_t *) _udata; - int ret_value = SUCCEED; - - FUNC_ENTER_STATIC - - HDassert(key); - HDassert(udata); - HDassert(udata->layout->ndims > 0 && udata->layout->ndims <= H5O_LAYOUT_NDIMS); - HDassert(old_parent); - HDassert(new_parent); - - /* If there is no rdcc, then there are no cached chunks to update - * dependencies. This should only happen when copying */ - if(udata->rdcc) - /* Delegate to chunk routine */ - if(H5D__chunk_update_flush_dep(udata->rdcc, udata->layout, key->offset, - old_parent, new_parent) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTDEPEND, FAIL, "unable to update flush dependency") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5D__btree_update_flush_dep() */ - - -/*------------------------------------------------------------------------- * Function: H5D__btree_idx_init * * Purpose: Initialize the indexing information for a dataset. @@ -976,7 +845,6 @@ H5D__btree_idx_create(const H5D_chk_idx_info_t *idx_info) { H5D_chunk_common_ud_t udata; /* User data for B-tree callback */ H5O_loc_t oloc; /* Temporary object header location for dataset */ - H5O_proxy_t *oh_proxy = NULL; /* Dataset's object header proxy */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -994,26 +862,11 @@ H5D__btree_idx_create(const H5D_chk_idx_info_t *idx_info) udata.storage = idx_info->storage; udata.rdcc = NULL; - /* Check for SWMR writes to the file */ - if(H5F_INTENT(idx_info->f) & H5F_ACC_SWMR_WRITE) { - /* Set up object header location for dataset */ - H5O_loc_reset(&oloc); - oloc.file = idx_info->f; - oloc.addr = idx_info->storage->u.btree.dset_ohdr_addr; - - /* Pin the dataset's object header proxy */ - if(NULL == (oh_proxy = H5O_pin_flush_dep_proxy(&oloc, idx_info->dxpl_id))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTPIN, FAIL, "unable to pin dataset object header proxy") - } /* end if */ - /* Create the v1 B-tree for the chunk index */ - if(H5B_create(idx_info->f, idx_info->dxpl_id, H5B_BTREE, &udata, oh_proxy, &(idx_info->storage->idx_addr)/*out*/) < 0) + if(H5B_create(idx_info->f, idx_info->dxpl_id, H5B_BTREE, &udata, &(idx_info->storage->idx_addr)/*out*/) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't create B-tree") done: - if(oh_proxy && H5O_unpin_flush_dep_proxy(oh_proxy) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTUNPIN, FAIL, "unable to unpin dataset object header proxy") - FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__btree_idx_create() */ @@ -1048,10 +901,9 @@ H5D__btree_idx_is_space_alloc(const H5O_storage_chunk_t *storage) /*------------------------------------------------------------------------- - * Function: H5D__btree_idx_insert + * Function: H5D__btree_idx_insert_addr * - * Purpose: Create the chunk it if it doesn't exist, or reallocate the - * chunk if its size changed. + * Purpose: Insert chunk address into the indexing structure. * * Return: Non-negative on success/Negative on failure * @@ -1061,10 +913,9 @@ H5D__btree_idx_is_space_alloc(const H5O_storage_chunk_t *storage) *------------------------------------------------------------------------- */ static herr_t -H5D__btree_idx_insert(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata) +H5D__btree_idx_insert_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata) { H5O_loc_t oloc; /* Temporary object header location for dataset */ - H5O_proxy_t *oh_proxy = NULL; /* Dataset's object header proxy */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -1077,32 +928,16 @@ H5D__btree_idx_insert(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata) HDassert(H5F_addr_defined(idx_info->storage->idx_addr)); HDassert(udata); - /* Check for SWMR writes to the file. If so we must pin the dataset object - * header so it can be set as a flush dependency parent. */ - if(H5F_INTENT(idx_info->f) & H5F_ACC_SWMR_WRITE) { - /* Set up object header location for dataset */ - H5O_loc_reset(&oloc); - oloc.file = idx_info->f; - oloc.addr = idx_info->storage->u.btree.dset_ohdr_addr; - - /* Pin the dataset's object header proxy */ - if(NULL == (oh_proxy = H5O_pin_flush_dep_proxy(&oloc, idx_info->dxpl_id))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTPIN, FAIL, "unable to pin dataset object header proxy") - } /* end if */ - /* * Create the chunk it if it doesn't exist, or reallocate the chunk if * its size changed. */ - if(H5B_insert(idx_info->f, idx_info->dxpl_id, H5B_BTREE, idx_info->storage->idx_addr, udata, oh_proxy) < 0) + if(H5B_insert(idx_info->f, idx_info->dxpl_id, H5B_BTREE, idx_info->storage->idx_addr, udata) < 0) HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to allocate chunk") done: - if(oh_proxy && H5O_unpin_flush_dep_proxy(oh_proxy) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTUNPIN, FAIL, "unable to unpin dataset object header proxy") - FUNC_LEAVE_NOAPI(ret_value) -} /* H5D__btree_idx_insert() */ +} /* H5D__btree_idx_insert_addr() */ /*------------------------------------------------------------------------- @@ -1123,7 +958,6 @@ static herr_t H5D__btree_idx_get_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata) { H5O_loc_t oloc; /* Temporary object header location for dataset */ - H5O_proxy_t *oh_proxy = NULL; /* Dataset's object header proxy */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -1137,27 +971,11 @@ H5D__btree_idx_get_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udat HDassert(H5F_addr_defined(idx_info->storage->idx_addr)); HDassert(udata); - /* Check for SWMR writes to the file. If so we must pin the dataset object - * header so it can be set as a flush dependency parent. */ - if(H5F_INTENT(idx_info->f) & H5F_ACC_SWMR_WRITE) { - /* Set up object header location for dataset */ - H5O_loc_reset(&oloc); - oloc.file = idx_info->f; - oloc.addr = idx_info->storage->u.btree.dset_ohdr_addr; - - /* Pin the dataset's object header proxy */ - if(NULL == (oh_proxy = H5O_pin_flush_dep_proxy(&oloc, idx_info->dxpl_id))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTPIN, FAIL, "unable to pin dataset object header proxy") - } /* end if */ - /* Go get the chunk information from the B-tree */ - if(H5B_find(idx_info->f, idx_info->dxpl_id, H5B_BTREE, idx_info->storage->idx_addr, udata, oh_proxy) < 0) + if(H5B_find(idx_info->f, idx_info->dxpl_id, H5B_BTREE, idx_info->storage->idx_addr, udata) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk info") done: - if(oh_proxy && H5O_unpin_flush_dep_proxy(oh_proxy) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTUNPIN, FAIL, "unable to unpin dataset object header proxy") - FUNC_LEAVE_NOAPI(ret_value) } /* H5D__btree_idx_get_addr() */ @@ -1229,7 +1047,6 @@ H5D__btree_idx_iterate(const H5D_chk_idx_info_t *idx_info, { H5D_btree_it_ud_t udata; /* User data for B-tree iterator callback */ H5O_loc_t oloc; /* Temporary object header location for dataset */ - H5O_proxy_t *oh_proxy = NULL; /* Dataset's object header proxy */ int ret_value; /* Return value */ FUNC_ENTER_STATIC @@ -1243,19 +1060,6 @@ H5D__btree_idx_iterate(const H5D_chk_idx_info_t *idx_info, HDassert(chunk_cb); HDassert(chunk_udata); - /* Check for SWMR writes to the file. If so we must pin the dataset object - * header so it can be set as a flush dependency parent. */ - if(H5F_INTENT(idx_info->f) & H5F_ACC_SWMR_WRITE) { - /* Set up object header location for dataset */ - H5O_loc_reset(&oloc); - oloc.file = idx_info->f; - oloc.addr = idx_info->storage->u.btree.dset_ohdr_addr; - - /* Pin the dataset's object header proxy */ - if(NULL == (oh_proxy = H5O_pin_flush_dep_proxy(&oloc, idx_info->dxpl_id))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTPIN, FAIL, "unable to pin dataset object header proxy") - } /* end if */ - /* Initialize userdata */ HDmemset(&udata, 0, sizeof udata); udata.common.layout = idx_info->layout; @@ -1264,13 +1068,10 @@ H5D__btree_idx_iterate(const H5D_chk_idx_info_t *idx_info, udata.udata = chunk_udata; /* Iterate over existing chunks */ - if((ret_value = H5B_iterate(idx_info->f, idx_info->dxpl_id, H5B_BTREE, idx_info->storage->idx_addr, H5D__btree_idx_iterate_cb, &udata, oh_proxy)) < 0) + if((ret_value = H5B_iterate(idx_info->f, idx_info->dxpl_id, H5B_BTREE, idx_info->storage->idx_addr, H5D__btree_idx_iterate_cb, &udata)) < 0) HERROR(H5E_DATASET, H5E_BADITER, "unable to iterate over chunk B-tree"); done: - if(oh_proxy && H5O_unpin_flush_dep_proxy(oh_proxy) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTUNPIN, FAIL, "unable to unpin dataset object header proxy") - FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__btree_idx_iterate() */ @@ -1291,7 +1092,6 @@ static herr_t H5D__btree_idx_remove(const H5D_chk_idx_info_t *idx_info, H5D_chunk_common_ud_t *udata) { H5O_loc_t oloc; /* Temporary object header location for dataset */ - H5O_proxy_t *oh_proxy = NULL; /* Dataset's object header proxy */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -1304,29 +1104,14 @@ H5D__btree_idx_remove(const H5D_chk_idx_info_t *idx_info, H5D_chunk_common_ud_t HDassert(H5F_addr_defined(idx_info->storage->idx_addr)); HDassert(udata); - /* Check for SWMR writes to the file. If so we must pin the dataset object - * header so it can be set as a flush dependency parent. */ - if(H5F_INTENT(idx_info->f) & H5F_ACC_SWMR_WRITE) { - /* Set up object header location for dataset */ - H5O_loc_reset(&oloc); - oloc.file = idx_info->f; - oloc.addr = idx_info->storage->u.btree.dset_ohdr_addr; - - /* Pin the dataset's object header proxy */ - if(NULL == (oh_proxy = H5O_pin_flush_dep_proxy(&oloc, idx_info->dxpl_id))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTPIN, FAIL, "unable to pin dataset object header proxy") - } /* end if */ /* Remove the chunk from the v1 B-tree index and release the space for the * chunk (in the B-tree callback). */ - if(H5B_remove(idx_info->f, idx_info->dxpl_id, H5B_BTREE, idx_info->storage->idx_addr, udata, oh_proxy) < 0) + if(H5B_remove(idx_info->f, idx_info->dxpl_id, H5B_BTREE, idx_info->storage->idx_addr, udata) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTDELETE, FAIL, "unable to remove chunk entry") done: - if(oh_proxy && H5O_unpin_flush_dep_proxy(oh_proxy) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTUNPIN, FAIL, "unable to unpin dataset object header proxy") - FUNC_LEAVE_NOAPI(ret_value) } /* H5D__btree_idx_remove() */ @@ -1349,7 +1134,6 @@ static herr_t H5D__btree_idx_delete(const H5D_chk_idx_info_t *idx_info) { H5O_loc_t oloc; /* Temporary object header location for dataset */ - H5O_proxy_t *oh_proxy = NULL; /* Dataset's object header proxy */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -1366,18 +1150,6 @@ H5D__btree_idx_delete(const H5D_chk_idx_info_t *idx_info) H5O_storage_chunk_t tmp_storage; /* Local copy of storage info */ H5D_chunk_common_ud_t udata; /* User data for B-tree operations */ - /* Check for SWMR writes to the file. If so we must pin the dataset object - * header so it can be set as a flush dependency parent. */ - if(H5F_INTENT(idx_info->f) & H5F_ACC_SWMR_WRITE) { - /* Set up object header location for dataset */ - H5O_loc_reset(&oloc); - oloc.file = idx_info->f; - oloc.addr = idx_info->storage->u.btree.dset_ohdr_addr; - - /* Pin the dataset's object header proxy */ - if(NULL == (oh_proxy = H5O_pin_flush_dep_proxy(&oloc, idx_info->dxpl_id))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTPIN, FAIL, "unable to pin dataset object header proxy") - } /* end if */ /* Set up temporary chunked storage info */ tmp_storage = *idx_info->storage; @@ -1392,7 +1164,7 @@ H5D__btree_idx_delete(const H5D_chk_idx_info_t *idx_info) udata.storage = &tmp_storage; /* Delete entire B-tree */ - if(H5B_delete(idx_info->f, idx_info->dxpl_id, H5B_BTREE, tmp_storage.idx_addr, &udata, oh_proxy) < 0) + if(H5B_delete(idx_info->f, idx_info->dxpl_id, H5B_BTREE, tmp_storage.idx_addr, &udata) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTDELETE, FAIL, "unable to delete chunk B-tree") /* Release the shared B-tree page */ @@ -1403,9 +1175,6 @@ H5D__btree_idx_delete(const H5D_chk_idx_info_t *idx_info) } /* end if */ done: - if(oh_proxy && H5O_unpin_flush_dep_proxy(oh_proxy) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTUNPIN, FAIL, "unable to unpin dataset object header proxy") - FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__btree_idx_delete() */ @@ -1513,7 +1282,6 @@ H5D__btree_idx_size(const H5D_chk_idx_info_t *idx_info, hsize_t *index_size) H5B_info_t bt_info; /* B-tree info */ hbool_t shared_init = FALSE; /* Whether shared B-tree info is initialized */ H5O_loc_t oloc; /* Temporary object header location for dataset */ - H5O_proxy_t *oh_proxy = NULL; /* Dataset's object header proxy */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -1526,19 +1294,6 @@ H5D__btree_idx_size(const H5D_chk_idx_info_t *idx_info, hsize_t *index_size) HDassert(idx_info->storage); HDassert(index_size); - /* Check for SWMR writes to the file. If so we must pin the dataset object - * header so it can be set as a flush dependency parent. */ - if(H5F_INTENT(idx_info->f) & H5F_ACC_SWMR_WRITE) { - /* Set up object header location for dataset */ - H5O_loc_reset(&oloc); - oloc.file = idx_info->f; - oloc.addr = idx_info->storage->u.btree.dset_ohdr_addr; - - /* Pin the dataset's object header proxy */ - if(NULL == (oh_proxy = H5O_pin_flush_dep_proxy(&oloc, idx_info->dxpl_id))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTPIN, FAIL, "unable to pin dataset object header proxy") - } /* end if */ - /* Initialize the shared info for the B-tree traversal */ if(H5D__btree_shared_create(idx_info->f, idx_info->storage, idx_info->layout->ndims) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't create wrapper for shared B-tree info") @@ -1550,16 +1305,13 @@ H5D__btree_idx_size(const H5D_chk_idx_info_t *idx_info, hsize_t *index_size) udata.storage = idx_info->storage; /* Get metadata information for B-tree */ - if(H5B_get_info(idx_info->f, idx_info->dxpl_id, H5B_BTREE, idx_info->storage->idx_addr, &bt_info, NULL, &udata, oh_proxy) < 0) + if(H5B_get_info(idx_info->f, idx_info->dxpl_id, H5B_BTREE, idx_info->storage->idx_addr, &bt_info, NULL, &udata) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "unable to iterate over chunk B-tree") /* Set the size of the B-tree */ *index_size = bt_info.size; done: - if(oh_proxy && H5O_unpin_flush_dep_proxy(oh_proxy) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTUNPIN, FAIL, "unable to unpin dataset object header proxy") - if(shared_init) { if(NULL == idx_info->storage->u.btree.shared) HDONE_ERROR(H5E_IO, H5E_CANTFREE, FAIL, "ref-counted page nil") @@ -1600,118 +1352,6 @@ H5D__btree_idx_reset(H5O_storage_chunk_t *storage, hbool_t reset_addr) /*------------------------------------------------------------------------- - * Function: H5D__btree_idx_support - * - * Purpose: Create a dependency between a chunk [proxy] and the index - * metadata that contains the record for the chunk. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Neil Fortner - * Friday, Jun 24, 2011 - * - *------------------------------------------------------------------------- - */ -static htri_t -H5D__btree_idx_support(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata, - H5AC_info_t *child_entry) -{ - H5O_loc_t oloc; /* Temporary object header location for dataset */ - H5O_proxy_t *oh_proxy = NULL; /* Dataset's object header proxy */ - htri_t ret_value; /* Return value */ - - FUNC_ENTER_STATIC - - /* Check args */ - HDassert(idx_info); - HDassert(idx_info->f); - HDassert(idx_info->pline); - HDassert(idx_info->layout); - HDassert(idx_info->storage); - HDassert(H5F_addr_defined(idx_info->storage->idx_addr)); - HDassert(udata); - HDassert(child_entry); - HDassert(H5F_INTENT(idx_info->f) & H5F_ACC_SWMR_WRITE); - - /* Set up object header location for dataset */ - H5O_loc_reset(&oloc); - oloc.file = idx_info->f; - oloc.addr = idx_info->storage->u.btree.dset_ohdr_addr; - - /* Pin the dataset's object header proxy */ - if(NULL == (oh_proxy = H5O_pin_flush_dep_proxy(&oloc, idx_info->dxpl_id))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTPIN, FAIL, "unable to pin dataset object header proxy") - - /* Add the flush dependency on the chunk */ - if((ret_value = H5B_support(idx_info->f, idx_info->dxpl_id, H5B_BTREE, idx_info->storage->idx_addr, - udata, oh_proxy, child_entry)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTDEPEND, FAIL, "unable to create flush dependency on b-tree array metadata") - -done: - if(oh_proxy && H5O_unpin_flush_dep_proxy(oh_proxy) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTUNPIN, FAIL, "unable to unpin dataset object header proxy") - - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5D__btree_idx_support() */ - - -/*------------------------------------------------------------------------- - * Function: H5D__btree_idx_unsupport - * - * Purpose: Destroy a dependency between a chunk [proxy] and the index - * metadata that contains the record for the chunk. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Neil Fortner - * Wednesday, Jul 6, 2011 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5D__btree_idx_unsupport(const H5D_chk_idx_info_t *idx_info, - H5D_chunk_ud_t *udata, H5AC_info_t *child_entry) -{ - H5O_loc_t oloc; /* Temporary object header location for dataset */ - H5O_proxy_t *oh_proxy = NULL; /* Dataset's object header proxy */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_STATIC - - /* Check args */ - HDassert(idx_info); - HDassert(idx_info->f); - HDassert(idx_info->pline); - HDassert(idx_info->layout); - HDassert(idx_info->storage); - HDassert(H5F_addr_defined(idx_info->storage->idx_addr)); - HDassert(udata); - HDassert(child_entry); - HDassert(H5F_INTENT(idx_info->f) & H5F_ACC_SWMR_WRITE); - - /* Set up object header location for dataset */ - H5O_loc_reset(&oloc); - oloc.file = idx_info->f; - oloc.addr = idx_info->storage->u.btree.dset_ohdr_addr; - - /* Pin the dataset's object header proxy */ - if(NULL == (oh_proxy = H5O_pin_flush_dep_proxy(&oloc, idx_info->dxpl_id))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTPIN, FAIL, "unable to pin dataset object header proxy") - - /* Remove the flush dependency on the chunk */ - if((ret_value = H5B_unsupport(idx_info->f, idx_info->dxpl_id, H5B_BTREE, idx_info->storage->idx_addr, - udata, oh_proxy, child_entry)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency on b-tree array metadata") - -done: - if(oh_proxy && H5O_unpin_flush_dep_proxy(oh_proxy) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTUNPIN, FAIL, "unable to unpin dataset object header proxy") - - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5D__btree_idx_unsupport() */ - - -/*------------------------------------------------------------------------- * Function: H5D__btree_idx_dump * * Purpose: Dump indexing information to a stream. diff --git a/src/H5Dbtree2.c b/src/H5Dbtree2.c index 2c67b40..e90aebd 100644 --- a/src/H5Dbtree2.c +++ b/src/H5Dbtree2.c @@ -116,9 +116,6 @@ static herr_t H5D_bt2_store(void *native, const void *udata); static herr_t H5D_bt2_compare(const void *rec1, const void *rec2); static herr_t H5D_bt2_encode(uint8_t *raw, const void *native, void *ctx); static herr_t H5D_bt2_decode(const uint8_t *raw, void *native, void *ctx); -static herr_t H5D_bt2_crt_flush_dep(void *_record, void *_udata, void *parent); -static herr_t H5D_bt2_upd_flush_dep(void *_record, void *_udata, - void *old_parent, void *new_parent); static herr_t H5D_bt2_debug(FILE *stream, const H5F_t *f, hid_t dxpl_id, int indent, int fwidth, const void *record, const void *u_ctx); @@ -127,10 +124,6 @@ static herr_t H5D_bt2_filt_store(void *native, const void *udata); static herr_t H5D_bt2_filt_compare(const void *rec1, const void *rec2); static herr_t H5D_bt2_filt_encode(uint8_t *raw, const void *native, void *ctx); static herr_t H5D_bt2_filt_decode(const uint8_t *raw, void *native, void *ctx); -static herr_t H5D_bt2_filt_crt_flush_dep(void *_record, void *_udata, - void *parent); -static herr_t H5D_bt2_filt_upd_flush_dep(void *_record, void *_udata, - void *old_parent, void *new_parent); static herr_t H5D_bt2_filt_debug(FILE *stream, const H5F_t *f, hid_t dxpl_id, int indent, int fwidth, const void *record, const void *u_ctx); @@ -159,7 +152,7 @@ static herr_t H5D_bt2_idx_init(const H5D_chk_idx_info_t *idx_info, const H5S_t *space, haddr_t dset_ohdr_addr); static herr_t H5D_bt2_idx_create(const H5D_chk_idx_info_t *idx_info); static hbool_t H5D_bt2_idx_is_space_alloc(const H5O_storage_chunk_t *storage); -static herr_t H5D_bt2_idx_insert(const H5D_chk_idx_info_t *idx_info, +static herr_t H5D_bt2_idx_insert_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata); static herr_t H5D_bt2_idx_get_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata); @@ -174,10 +167,6 @@ static herr_t H5D_bt2_idx_copy_shutdown(H5O_storage_chunk_t *storage_src, H5O_storage_chunk_t *storage_dst, hid_t dxpl_id); 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 htri_t H5D_bt2_idx_support(const H5D_chk_idx_info_t *idx_info, - H5D_chunk_ud_t *udata, H5AC_info_t *child_entry); -static herr_t H5D_bt2_idx_unsupport(const H5D_chk_idx_info_t *idx_info, - H5D_chunk_ud_t *udata, H5AC_info_t *child_entry); static herr_t H5D_bt2_idx_dump(const H5O_storage_chunk_t *storage, FILE *stream); static herr_t H5D_bt2_idx_dest(const H5D_chk_idx_info_t *idx_info); @@ -193,7 +182,7 @@ const H5D_chunk_ops_t H5D_COPS_BT2[1] = {{ H5D_bt2_idx_init, H5D_bt2_idx_create, H5D_bt2_idx_is_space_alloc, - H5D_bt2_idx_insert, + H5D_bt2_idx_insert_addr, H5D_bt2_idx_get_addr, NULL, H5D_bt2_idx_iterate, @@ -203,8 +192,6 @@ const H5D_chunk_ops_t H5D_COPS_BT2[1] = {{ H5D_bt2_idx_copy_shutdown, H5D_bt2_idx_size, H5D_bt2_idx_reset, - H5D_bt2_idx_support, - H5D_bt2_idx_unsupport, H5D_bt2_idx_dump, H5D_bt2_idx_dest }}; @@ -225,8 +212,6 @@ const H5B2_class_t H5D_BT2[1] = {{ /* B-tree class information */ H5D_bt2_compare, /* Record comparison callback */ H5D_bt2_encode, /* Record encoding callback */ H5D_bt2_decode, /* Record decoding callback */ - H5D_bt2_crt_flush_dep, /* Create flush dependency */ - H5D_bt2_upd_flush_dep, /* Update flush dependency */ H5D_bt2_debug, /* Record debugging callback */ H5D_bt2_crt_dbg_context, /* Create debugging context */ H5D_bt2_dst_dbg_context /* Destroy debugging context */ @@ -243,8 +228,6 @@ const H5B2_class_t H5D_BT2_FILT[1] = {{ /* B-tree class information */ H5D_bt2_filt_compare, /* Record comparison callback */ H5D_bt2_filt_encode, /* Record encoding callback */ H5D_bt2_filt_decode, /* Record decoding callback */ - H5D_bt2_filt_crt_flush_dep, /* Create flush dependency */ - H5D_bt2_filt_upd_flush_dep, /* Update flush dependency */ H5D_bt2_filt_debug, /* Record debugging callback */ H5D_bt2_crt_dbg_context, /* Create debugging context */ H5D_bt2_dst_dbg_context /* Destroy debugging context */ @@ -471,89 +454,6 @@ H5D_bt2_decode(const uint8_t *raw, void *_record, void *_ctx) /*------------------------------------------------------------------------- - * Function: H5D_bt2_crt_flush_dep - * - * Purpose: Creates a flush dependency between the specified chunk - * (child) and parent. - * - * Return: Success: 0 - * Failure: FAIL - * - * Programmer: Neil Fortner - * Tuesday, May 1, 2012 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5D_bt2_crt_flush_dep(void *_record, void *_udata, void *parent) -{ - H5D_bt2_rec_t *record = (H5D_bt2_rec_t *)_record; /* The native record */ - const H5D_bt2_find_ud_t *udata = (const H5D_bt2_find_ud_t *)_udata; /* User data */ - int ret_value = SUCCEED; - - FUNC_ENTER_NOAPI_NOINIT - - HDassert(record); - HDassert(udata); - HDassert(udata->layout->ndims > 0 && udata->layout->ndims <= H5O_LAYOUT_NDIMS); - HDassert(parent); - - /* If there is no rdcc, then there are no cached chunks to create - * dependencies on. This should only happen when copying */ - if(udata->rdcc) - /* Delegate to chunk routine */ - if(H5D__chunk_create_flush_dep(udata->rdcc, udata->layout, record->offset, parent) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTDEPEND, FAIL, "unable to create flush dependency") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5D_bt2_crt_flush_dep() */ - - -/*------------------------------------------------------------------------- - * Function: H5D_bt2_upd_flush_dep - * - * Purpose: Updates the flush dependency of the specified chunk from - * old_parent to new_parent, but only if the current parent - * is cached. If the chunk is not cached, does nothing. - * - * Return: Success: 0 - * Failure: FAIL - * - * Programmer: Neil Fortner - * Tuesday, May 1, 2012 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5D_bt2_upd_flush_dep(void *_record, void *_udata, void *old_parent, - void *new_parent) -{ - H5D_bt2_rec_t *record = (H5D_bt2_rec_t *)_record; /* The native record */ - const H5D_bt2_find_ud_t *udata = (const H5D_bt2_find_ud_t *)_udata; /* User data */ - int ret_value = SUCCEED; - - FUNC_ENTER_NOAPI_NOINIT - - HDassert(record); - HDassert(udata); - HDassert(udata->layout->ndims > 0 && udata->layout->ndims <= H5O_LAYOUT_NDIMS); - HDassert(old_parent); - HDassert(new_parent); - - /* If there is no rdcc, then there are no cached chunks to update - * dependencies. This should only happen when copying */ - if(udata->rdcc) - /* Delegate to chunk routine */ - if(H5D__chunk_update_flush_dep(udata->rdcc, udata->layout, record->offset, old_parent, new_parent) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTDEPEND, FAIL, "unable to update flush dependency") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5D_bt2_upd_flush_dep() */ - - -/*------------------------------------------------------------------------- * Function: H5D_bt2_debug * * Purpose: Debug native form of record (non-filtered) @@ -721,89 +621,6 @@ H5D_bt2_filt_decode(const uint8_t *raw, void *_record, void *_ctx) /*------------------------------------------------------------------------- - * Function: H5D_bt2_filt_crt_flush_dep - * - * Purpose: Creates a flush dependency between the specified chunk - * (child) and parent. - * - * Return: Success: 0 - * Failure: FAIL - * - * Programmer: Neil Fortner - * Tuesday, May 1, 2012 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5D_bt2_filt_crt_flush_dep(void *_record, void *_udata, void *parent) -{ - H5D_bt2_filt_rec_t *record = (H5D_bt2_filt_rec_t *)_record; /* The native record */ - const H5D_bt2_find_ud_t *udata = (const H5D_bt2_find_ud_t *)_udata; /* User data */ - int ret_value = SUCCEED; - - FUNC_ENTER_NOAPI_NOINIT - - HDassert(record); - HDassert(udata); - HDassert(udata->layout->ndims > 0 && udata->layout->ndims <= H5O_LAYOUT_NDIMS); - HDassert(parent); - - /* If there is no rdcc, then there are no cached chunks to create - * dependencies on. This should only happen when copying */ - if(udata->rdcc) - /* Delegate to chunk routine */ - if(H5D__chunk_create_flush_dep(udata->rdcc, udata->layout, record->offset, parent) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTDEPEND, FAIL, "unable to create flush dependency") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5D_bt2_filt_crt_flush_dep() */ - - -/*------------------------------------------------------------------------- - * Function: H5D_bt2_filt_upd_flush_dep - * - * Purpose: Updates the flush dependency of the specified chunk from - * old_parent to new_parent, but only if the current parent - * is cached. If the chunk is not cached, does nothing. - * - * Return: Success: 0 - * Failure: FAIL - * - * Programmer: Neil Fortner - * Tuesday, May 1, 2012 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5D_bt2_filt_upd_flush_dep(void *_record, void *_udata, void *old_parent, - void *new_parent) -{ - H5D_bt2_filt_rec_t *record = (H5D_bt2_filt_rec_t *)_record; /* The native record */ - const H5D_bt2_find_ud_t *udata = (const H5D_bt2_find_ud_t *)_udata; /* User data */ - int ret_value = SUCCEED; - - FUNC_ENTER_NOAPI_NOINIT - - HDassert(record); - HDassert(udata); - HDassert(udata->layout->ndims > 0 && udata->layout->ndims <= H5O_LAYOUT_NDIMS); - HDassert(old_parent); - HDassert(new_parent); - - /* If there is no rdcc, then there are no cached chunks to update - * dependencies. This should only happen when copying */ - if(udata->rdcc) - /* Delegate to chunk routine */ - if(H5D__chunk_update_flush_dep(udata->rdcc, udata->layout, record->offset, old_parent, new_parent) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTDEPEND, FAIL, "unable to update flush dependency") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5D_btree_filt_upd_flush_dep() */ - - -/*------------------------------------------------------------------------- * Function: H5D_bt2_filt_debug * * Purpose: Debug native form of record (filterd) @@ -1182,9 +999,10 @@ H5D_bt2_mod_filt_cb(void *_record, void *_op_data, hbool_t *changed) /*------------------------------------------------------------------------- - * Function: H5D_bt2_idx_insert + * Function: H5D_bt2_idx_insert_addr * - * Purpose: A non-filtered chunk: + * Purpose: Insert chunk address into the indexing structure. + * A non-filtered chunk: * Should not exist * Allocate the chunk and pass chunk address back up * A filtered chunk: @@ -1199,11 +1017,13 @@ H5D_bt2_mod_filt_cb(void *_record, void *_op_data, hbool_t *changed) *------------------------------------------------------------------------- */ static herr_t -H5D_bt2_idx_insert(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata) +H5D_bt2_idx_insert_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata) { H5B2_t *bt2; /* v2 B-tree handle for indexing chunks */ H5D_bt2_find_ud_t bt2_udata; /* User data for v2 B-tree calls */ unsigned u; /* Local index variable */ + H5D_bt2_rec_t rec; + H5D_bt2_filt_rec_t filt_rec; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -1215,6 +1035,8 @@ H5D_bt2_idx_insert(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata) HDassert(idx_info->storage); HDassert(H5F_addr_defined(idx_info->storage->idx_addr)); HDassert(udata); + HDassert(udata->need_insert || udata->need_modify); + HDassert(H5F_addr_defined(udata->addr)); /* Check if the v2 B-tree is open yet */ if(NULL == idx_info->storage->u.btree2.bt2) { @@ -1226,125 +1048,43 @@ H5D_bt2_idx_insert(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata) /* Set convenience pointer to v2 B-tree structure */ bt2 = idx_info->storage->u.btree2.bt2; - /* Check for filters on chunks */ + bt2_udata.ndims = idx_info->layout->ndims - 1; + bt2_udata.layout = idx_info->layout; + bt2_udata.rdcc = udata->common.rdcc; + if(idx_info->pline->nused > 0) { /* filtered chunk */ - H5D_bt2_filt_rec_t rec; /* Record for searching object */ - H5D_bt2_filt_rec_t found_rec; /* Record found from searching for object */ - unsigned allow_chunk_size_len; /* Allowed size of encoded chunk size */ - unsigned new_chunk_size_len; /* Size of encoded chunk size */ + bt2_udata.rec = &filt_rec; - /* - * Compute the size required for encoding the size of a chunk, - * allowing for an extra byte, in case the filter makes the chunk larger. - */ - allow_chunk_size_len = 1 + ((H5VM_log2_gen((uint64_t)idx_info->layout->size) + 8) / 8); - if(allow_chunk_size_len > 8) - allow_chunk_size_len = 8; - - /* Compute encoded size of chunk */ - new_chunk_size_len = (H5VM_log2_gen((uint64_t)udata->nbytes) + 8) / 8; - if(new_chunk_size_len > 8) - HGOTO_ERROR(H5E_DATASET, H5E_BADRANGE, FAIL, "encoded chunk size is more than 8 bytes?!?") - - /* Check if the chunk became too large to be encoded */ - if(new_chunk_size_len > allow_chunk_size_len) - HGOTO_ERROR(H5E_DATASET, H5E_BADRANGE, FAIL, "chunk size can't be encoded") - - /* Initialize record information */ - rec.nbytes = udata->nbytes; - rec.filter_mask = udata->filter_mask; + filt_rec.addr = udata->addr; + filt_rec.nbytes = udata->nbytes; + filt_rec.filter_mask = udata->filter_mask; for(u = 0; u < (idx_info->layout->ndims - 1); u++) - rec.offset[u] = udata->common.offset[u]; - - found_rec.addr = HADDR_UNDEF; - found_rec.nbytes = 0; - found_rec.filter_mask = 0; - - /* Prepare user data for compare callback */ + filt_rec.offset[u] = udata->common.offset[u]; + } else { /* non-filtered chunk */ bt2_udata.rec = &rec; - bt2_udata.ndims = idx_info->layout->ndims - 1; - bt2_udata.layout = idx_info->layout; - bt2_udata.rdcc = udata->common.rdcc; - - /* Try to find the chunked record */ - if(H5B2_find(bt2, idx_info->dxpl_id, &bt2_udata, H5D_bt2_filt_found_cb, &found_rec) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_NOTFOUND, FAIL, "can't find object in v2 B-tree") - - /* Check for previous chunk */ - if(H5F_addr_defined(found_rec.addr)) { /* Found it */ - /* Sanity check */ - HDassert(!H5F_addr_defined(udata->addr) || H5F_addr_eq(udata->addr, found_rec.addr)); - - /* Check for chunk being same size */ - if(udata->nbytes != found_rec.nbytes) { - /* Free the original chunk if not doing SWMR writes */ - if(!(H5F_INTENT(idx_info->f) & H5F_ACC_SWMR_WRITE)) { - H5_CHECK_OVERFLOW(found_rec.nbytes, uint32_t, hsize_t); - if(H5MF_xfree(idx_info->f, H5FD_MEM_DRAW, idx_info->dxpl_id, found_rec.addr, (hsize_t)found_rec.nbytes) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to free chunk") - } /* end if */ - - /* Allocate a new chunk */ - H5_CHECK_OVERFLOW(udata->nbytes, uint32_t, hsize_t); - udata->addr = H5MF_alloc(idx_info->f, H5FD_MEM_DRAW, idx_info->dxpl_id, (hsize_t)udata->nbytes); - if(!H5F_addr_defined(udata->addr)) - HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "unable to allocate chunk") - rec.addr = udata->addr; - - /* Modify record for object in v2 B-tree */ - if(H5B2_modify(bt2, idx_info->dxpl_id, &bt2_udata, H5D_bt2_mod_filt_cb, &rec) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to modify record in v2 B-tree") - } /* end if */ - else - /* Don't need to reallocate chunk, but send its address back up */ - udata->addr = found_rec.addr; - } /* end if */ - else { /* Not found */ - H5_CHECK_OVERFLOW(udata->nbytes, uint32_t, hsize_t); - - /* Allocate a new chunk */ - udata->addr = H5MF_alloc(idx_info->f, H5FD_MEM_DRAW, idx_info->dxpl_id, (hsize_t)udata->nbytes); - if(!H5F_addr_defined(udata->addr)) - HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "unable to allocate chunk") - rec.addr = udata->addr; - - /* Insert record for object in v2 B-tree */ - if(H5B2_insert(bt2, idx_info->dxpl_id, &bt2_udata) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "couldn't insert record in v2 B-tree") - } /* end else */ - } /* end if */ - else { /* non-filtered chunk */ - H5D_bt2_rec_t rec; - - /* The record should not be there */ - HDassert(!H5F_addr_defined(udata->addr)); - HDassert(udata->nbytes == idx_info->layout->size); - - /* Prepare user data for compare callback */ - bt2_udata.rec = &rec; - bt2_udata.ndims = idx_info->layout->ndims - 1; - bt2_udata.layout = idx_info->layout; - bt2_udata.rdcc = udata->common.rdcc; + rec.addr = udata->addr; for(u = 0; u < (idx_info->layout->ndims - 1); u++) rec.offset[u] = udata->common.offset[u]; + } - /* Allocate storage for the new chunk */ - H5_CHECK_OVERFLOW(udata->nbytes, uint32_t, hsize_t); - udata->addr = H5MF_alloc(idx_info->f, H5FD_MEM_DRAW, idx_info->dxpl_id, (hsize_t)udata->nbytes); - if(!H5F_addr_defined(udata->addr)) - HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "unable to allocate chunk") - rec.addr = udata->addr; + if(udata->need_modify) { + HDassert(idx_info->pline->nused > 0); + + /* Modify record for filtered object in v2 B-tree */ + if(H5B2_modify(bt2, idx_info->dxpl_id, &bt2_udata, H5D_bt2_mod_filt_cb, &filt_rec) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to modify record in v2 B-tree") + } else { + HDassert(udata->need_insert); /* Insert record for object in v2 B-tree */ if(H5B2_insert(bt2, idx_info->dxpl_id, &bt2_udata) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "couldn't insert record in v2 B-tree") - } /* end else */ - HDassert(H5F_addr_defined(udata->addr)); + HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "couldn't insert record in v2 B-tree") + } done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5D_bt2_idx_insert() */ +} /* H5D_bt2_idx_insert_addr() */ /*------------------------------------------------------------------------- @@ -2031,146 +1771,6 @@ H5D_bt2_idx_reset(H5O_storage_chunk_t *storage, hbool_t reset_addr) /*------------------------------------------------------------------------- - * Function: H5D_bt2_idx_support - * - * Purpose: Create a dependency between a chunk [proxy] and the index - * metadata that contains the record for the chunk. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Neil Fortner - * Monday, May 14, 2012 - * - *------------------------------------------------------------------------- - */ -static htri_t -H5D_bt2_idx_support(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata, - H5AC_info_t *child_entry) -{ - H5D_bt2_find_ud_t bt2_udata; /* User data for v2 B-tree calls */ - unsigned u; /* Local index variable */ - htri_t ret_value; /* Return value */ - - FUNC_ENTER_NOAPI_NOINIT - - /* Check args */ - HDassert(idx_info); - HDassert(idx_info->f); - HDassert(idx_info->pline); - HDassert(idx_info->layout); - HDassert(idx_info->storage); - HDassert(H5F_addr_defined(idx_info->storage->idx_addr)); - HDassert(udata); - HDassert(child_entry); - HDassert(H5F_INTENT(idx_info->f) & H5F_ACC_SWMR_WRITE); - - if(idx_info->pline->nused > 0) { /* filtered chunk */ - H5D_bt2_filt_rec_t search_rec; /* Record for searching for object */ - - /* Set the chunk offset to be searched for */ - for(u = 0; u < (idx_info->layout->ndims - 1); u++) - search_rec.offset[u] = udata->common.offset[u]; - - /* Prepare user data for support callback */ - bt2_udata.rec = &search_rec; - bt2_udata.ndims = idx_info->layout->ndims - 1; - bt2_udata.layout = idx_info->layout; - bt2_udata.rdcc = udata->common.rdcc; - } /* end if */ - else { /* non-filtered chunk */ - H5D_bt2_rec_t search_rec; /* Record for searching for object */ - - /* Set the chunk offset to be searched for */ - for(u = 0; u < (idx_info->layout->ndims - 1); u++) - search_rec.offset[u] = udata->common.offset[u]; - - /* Prepare user data for support callback */ - bt2_udata.rec = &search_rec; - bt2_udata.ndims = idx_info->layout->ndims - 1; - bt2_udata.layout = idx_info->layout; - bt2_udata.rdcc = udata->common.rdcc; - } /* end else */ - - /* Add the flush dependency on the chunk */ - if((ret_value = H5B2_support(idx_info->storage->u.btree2.bt2, idx_info->dxpl_id, &bt2_udata, child_entry)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTDEPEND, FAIL, "unable to create flush dependency on b-tree array metadata") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5D_bt2_idx_support() */ - - -/*------------------------------------------------------------------------- - * Function: H5D_bt2_idx_unsupport - * - * Purpose: Destroy a dependency between a chunk [proxy] and the index - * metadata that contains the record for the chunk. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Neil Fortner - * Monday, May 14, 2012 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5D_bt2_idx_unsupport(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata, - H5AC_info_t *child_entry) -{ - H5D_bt2_find_ud_t bt2_udata; /* User data for v2 B-tree calls */ - unsigned u; /* Local index variable */ - herr_t ret_value; /* Return value */ - - FUNC_ENTER_NOAPI_NOINIT - - /* Check args */ - HDassert(idx_info); - HDassert(idx_info->f); - HDassert(idx_info->pline); - HDassert(idx_info->layout); - HDassert(idx_info->storage); - HDassert(H5F_addr_defined(idx_info->storage->idx_addr)); - HDassert(udata); - HDassert(child_entry); - HDassert(H5F_INTENT(idx_info->f) & H5F_ACC_SWMR_WRITE); - - if(idx_info->pline->nused > 0) { /* filtered chunk */ - H5D_bt2_filt_rec_t search_rec; /* Record for searching for object */ - - /* Set the chunk offset to be searched for */ - for(u = 0; u < (idx_info->layout->ndims - 1); u++) - search_rec.offset[u] = udata->common.offset[u]; - - /* Prepare user data for support callback */ - bt2_udata.rec = &search_rec; - bt2_udata.ndims = idx_info->layout->ndims - 1; - bt2_udata.layout = idx_info->layout; - bt2_udata.rdcc = udata->common.rdcc; - } /* end if */ - else { /* non-filtered chunk */ - H5D_bt2_rec_t search_rec; /* Record for searching for object */ - - /* Set the chunk offset to be searched for */ - for(u = 0; u < (idx_info->layout->ndims - 1); u++) - search_rec.offset[u] = udata->common.offset[u]; - - /* Prepare user data for support callback */ - bt2_udata.rec = &search_rec; - bt2_udata.ndims = idx_info->layout->ndims - 1; - bt2_udata.layout = idx_info->layout; - bt2_udata.rdcc = udata->common.rdcc; - } /* end else */ - - /* Add the flush dependency on the chunk */ - if((ret_value = H5B2_unsupport(idx_info->storage->u.btree2.bt2, idx_info->dxpl_id, &bt2_udata, child_entry)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency on b-tree array metadata") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5D_bt2_idx_unsupport() */ - - -/*------------------------------------------------------------------------- * Function: H5D_bt2_idx_dump * * Purpose: Dump indexing information to a stream. diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index dc1df79..ce8ca5a 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -59,7 +59,8 @@ #include "H5FLprivate.h" /* Free Lists */ #include "H5Iprivate.h" /* IDs */ #include "H5MMprivate.h" /* Memory management */ -#include "H5VMprivate.h" /* Vector and array functions */ +#include "H5MFprivate.h" /* File memory management */ +#include "H5VMprivate.h" /* Vector and array functions */ /****************/ @@ -230,12 +231,10 @@ static herr_t H5D__chunk_cache_evict(const H5D_t *dset, hid_t dxpl_id, static htri_t H5D__chunk_is_partial_edge_chunk(const hsize_t offset[], const H5D_t *dset, unsigned dset_ndims, const hsize_t *dset_dims, const uint32_t *chunk_dims); -static herr_t H5D__chunk_find_flush_dep(const H5D_rdcc_t *rdcc, - const H5O_layout_chunk_t *layout, const hsize_t offset[], - H5D_rdcc_ent_t **ent); static herr_t H5D__chunk_cache_prune(const H5D_t *dset, hid_t dxpl_id, const H5D_dxpl_cache_t *dxpl_cache, size_t size); static herr_t H5D__chunk_prune_fill(H5D_chunk_it_ud1_t *udata, hbool_t new_unfilt_chunk); +static herr_t H5D__idx_chunk_alloc(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata); /*********************/ @@ -321,6 +320,7 @@ H5D__chunk_direct_write(const H5D_t *dset, hid_t dxpl_id, uint32_t filters, hsiz const H5D_rdcc_t *rdcc = &(dset->shared->cache.chunk); /*raw data chunk cache */ int space_ndims; /* Dataset's space rank */ hsize_t space_dim[H5O_LAYOUT_NDIMS]; /* Dataset's dataspace dimensions */ + H5D_chk_idx_info_t idx_info; /* Chunked index info */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC_TAG(dxpl_id, dset->oloc.addr, FAIL) @@ -352,7 +352,6 @@ H5D__chunk_direct_write(const H5D_t *dset, hid_t dxpl_id, uint32_t filters, hsiz * the 'insert' operation could resize it) */ { - H5D_chk_idx_info_t idx_info; /* Chunked index info */ /* Compose chunked index info struct */ idx_info.f = dset->oloc.file; @@ -367,8 +366,8 @@ H5D__chunk_direct_write(const H5D_t *dset, hid_t dxpl_id, uint32_t filters, hsiz /* Create the chunk it if it doesn't exist, or reallocate the chunk * if its size changed. */ - if((dset->shared->layout.storage.u.chunk.ops->insert)(&idx_info, &udata) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert/resize chunk") + if(H5D__idx_chunk_alloc(&idx_info, &udata) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert/resize chunk on chunk level") /* Make sure the address of the chunk is returned. */ if(!H5F_addr_defined(udata.addr)) @@ -391,6 +390,11 @@ H5D__chunk_direct_write(const H5D_t *dset, hid_t dxpl_id, uint32_t filters, hsiz if(H5F_block_write(dset->oloc.file, H5FD_MEM_DRAW, udata.addr, data_size, dxpl_id, buf) < 0) HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to write raw data to file") + if((udata.need_insert || udata.need_modify) && dset->shared->layout.storage.u.chunk.ops->insert_addr) { + if((dset->shared->layout.storage.u.chunk.ops->insert_addr)(&idx_info, &udata) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert chunk addr into index") + } + done: FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) } /* end H5D__chunk_direct_write() */ @@ -2007,6 +2011,7 @@ H5D__chunk_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, void *chunk; /* Pointer to locked chunk buffer */ H5D_chunk_ud_t udata; /* Index pass-through */ htri_t cacheable; /* Whether the chunk is cacheable */ + H5D_chk_idx_info_t idx_info; /* Chunked index info */ /* Get the actual chunk information from the skip list node */ chunk_info = H5D_CHUNK_GET_NODE_INFO(fm, chunk_node); @@ -2052,7 +2057,6 @@ H5D__chunk_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, else { /* If the chunk hasn't been allocated on disk, do so now. */ if(!H5F_addr_defined(udata.addr)) { - H5D_chk_idx_info_t idx_info; /* Chunked index info */ /* Compose chunked index info struct */ idx_info.f = io_info->dset->oloc.file; @@ -2065,8 +2069,9 @@ H5D__chunk_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, udata.nbytes = io_info->dset->shared->layout.u.chunk.size; /* Create the chunk */ - if((io_info->dset->shared->layout.storage.u.chunk.ops->insert)(&idx_info, &udata) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert/resize chunk") + if(H5D__idx_chunk_alloc(&idx_info, &udata) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert/resize chunk on chunk level") + /* Make sure the address of the chunk is returned. */ if(!H5F_addr_defined(udata.addr)) @@ -2091,9 +2096,16 @@ H5D__chunk_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, (hsize_t)chunk_info->chunk_points, chunk_info->fspace, chunk_info->mspace) < 0) HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "chunked write failed") - /* Release the cache lock on the chunk. */ - if(chunk && H5D__chunk_unlock(io_info, &udata, TRUE, chunk, dst_accessed_bytes) < 0) - HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "unable to unlock raw data chunk") + /* Release the cache lock on the chunk, or insert chunk into index. */ + if(chunk) { + if(chunk && H5D__chunk_unlock(io_info, &udata, TRUE, chunk, dst_accessed_bytes) < 0) + HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "unable to unlock raw data chunk") + } /* end if */ + else { + if((udata.need_insert || udata.need_modify) && io_info->dset->shared->layout.storage.u.chunk.ops->insert_addr) + if((io_info->dset->shared->layout.storage.u.chunk.ops->insert_addr)(&idx_info, &udata) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert chunk addr into index") + } /* end else */ /* Advance to next chunk in list */ chunk_node = H5D_CHUNK_GET_NEXT_NODE(fm, chunk_node); @@ -2304,6 +2316,7 @@ H5D__chunk_cinfo_cache_update(H5D_chunk_cached_t *last, const H5D_chunk_ud_t *ud for(u = 0; u < udata->common.layout->ndims; u++) last->offset[u] = udata->common.offset[u]; last->nbytes = udata->nbytes; + last->chunk_idx = udata->chunk_idx; last->filter_mask = udata->filter_mask; last->addr = udata->addr; @@ -2351,6 +2364,7 @@ H5D__chunk_cinfo_cache_found(const H5D_chunk_cached_t *last, H5D_chunk_ud_t *uda /* Retrieve the information from the cache */ udata->nbytes = last->nbytes; + udata->chunk_idx = last->chunk_idx; udata->filter_mask = last->filter_mask; udata->addr = last->addr; @@ -2475,6 +2489,8 @@ H5D__chunk_lookup(const H5D_t *dset, hid_t dxpl_id, const hsize_t *chunk_offset, udata->filter_mask = 0; udata->addr = HADDR_UNDEF; udata->new_unfilt_chunk = FALSE; + udata->need_insert = FALSE; + udata->need_modify = FALSE; /* Check for chunk in cache */ if(dset->shared->cache.chunk.nslots > 0) { @@ -2491,9 +2507,10 @@ H5D__chunk_lookup(const H5D_t *dset, hid_t dxpl_id, const hsize_t *chunk_offset, } /* end if */ /* Find chunk addr */ - if(found) + if(found) { udata->addr = ent->chunk_addr; - else { + udata->chunk_idx = chunk_idx; + } else { /* Invalidate idx_hint, to signal that the chunk is not in cache */ udata->idx_hint = UINT_MAX; @@ -2567,6 +2584,7 @@ H5D__chunk_flush_entry(const H5D_t *dset, hid_t dxpl_id, const H5D_dxpl_cache_t if(ent->dirty && !ent->deleted) { H5D_chunk_ud_t udata; /* pass through B-tree */ hbool_t must_insert = FALSE; /* Whether the chunk must go through the "insert" method */ + H5D_chk_idx_info_t idx_info; /* Chunked index info */ /* Set up user data for index callbacks */ udata.common.layout = &dset->shared->layout.u.chunk; @@ -2576,6 +2594,9 @@ H5D__chunk_flush_entry(const H5D_t *dset, hid_t dxpl_id, const H5D_dxpl_cache_t udata.filter_mask = 0; udata.nbytes = dset->shared->layout.u.chunk.size; udata.addr = ent->chunk_addr; + udata.chunk_idx = ent->chunk_idx; + udata.need_insert = FALSE; + udata.need_modify = FALSE; /* Should the chunk be filtered before writing it to disk? */ if(dset->shared->dcpl_cache.pline.nused @@ -2644,7 +2665,6 @@ H5D__chunk_flush_entry(const H5D_t *dset, hid_t dxpl_id, const H5D_dxpl_cache_t * the 'insert' operation could resize it) */ if(must_insert) { - H5D_chk_idx_info_t idx_info; /* Chunked index info */ /* Compose chunked index info struct */ idx_info.f = dset->oloc.file; @@ -2656,8 +2676,8 @@ H5D__chunk_flush_entry(const H5D_t *dset, hid_t dxpl_id, const H5D_dxpl_cache_t /* Create the chunk it if it doesn't exist, or reallocate the chunk * if its size changed. */ - if((dset->shared->layout.storage.u.chunk.ops->insert)(&idx_info, &udata) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert/resize chunk") + if(H5D__idx_chunk_alloc(&idx_info, &udata) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert/resize chunk on chunk level") /* Update the chunk entry's address, in case it was allocated or relocated */ ent->chunk_addr = udata.addr; @@ -2668,19 +2688,19 @@ H5D__chunk_flush_entry(const H5D_t *dset, hid_t dxpl_id, const H5D_dxpl_cache_t if(H5F_block_write(dset->oloc.file, H5FD_MEM_DRAW, udata.addr, udata.nbytes, dxpl_id, buf) < 0) HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to write raw data to file") + if(udata.need_insert || udata.need_modify) { + if(dset->shared->layout.storage.u.chunk.ops->insert_addr) { + if((dset->shared->layout.storage.u.chunk.ops->insert_addr)(&idx_info, &udata) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert chunk addr into index") + } + } + /* Cache the chunk's info, in case it's accessed again shortly */ H5D__chunk_cinfo_cache_update(&dset->shared->cache.chunk.last, &udata); /* Mark cache entry as clean */ ent->dirty = FALSE; - /* Check for SWMR writes to the file */ - if(dset->shared->layout.storage.u.chunk.ops->can_swim && (H5F_INTENT(dset->oloc.file) & H5F_ACC_SWMR_WRITE)) { - /* Mark the proxy entry in the cache as clean */ - if(H5D__chunk_proxy_mark(ent, FALSE) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTMARKDIRTY, FAIL, "can't mark proxy for chunk from metadata cache as clean") - } /* end if */ - /* Increment # of flushed entries */ dset->shared->cache.chunk.stats.nflushes++; } /* end if */ @@ -2759,13 +2779,6 @@ H5D__chunk_cache_evict(const H5D_t *dset, hid_t dxpl_id, const H5D_dxpl_cache_t : &(dset->shared->dcpl_cache.pline))); } /* end else */ - /* Check for SWMR writes to the file */ - if(dset->shared->layout.storage.u.chunk.ops->can_swim && (H5F_INTENT(dset->oloc.file) & H5F_ACC_SWMR_WRITE)) { - /* Remove the proxy entry in the cache */ - if(H5D__chunk_proxy_remove(dset, dxpl_id, ent) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTREMOVE, FAIL, "can't remove proxy for chunk from metadata cache") - } /* end if */ - /* Unlink from list */ if(ent->prev) ent->prev->next = ent->next; @@ -3255,8 +3268,7 @@ H5D__chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata, ent->dirty = FALSE; ent->deleted = FALSE; ent->chunk_addr = chunk_addr; - ent->proxy_addr = HADDR_UNDEF; - ent->proxy = NULL; + ent->chunk_idx = udata->chunk_idx; for(u = 0; u < layout->u.chunk.ndims; u++) ent->offset[u] = io_info->store->chunk.offset[u]; H5_ASSIGN_OVERFLOW(ent->rd_count, chunk_size, size_t, uint32_t); @@ -3284,16 +3296,6 @@ H5D__chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata, ent->tmp_next = NULL; ent->tmp_prev = NULL; - /* Check for SWMR writes to the file */ - if(io_info->dset->shared->layout.storage.u.chunk.ops->can_swim - && (H5F_INTENT(io_info->dset->oloc.file) & H5F_ACC_SWMR_WRITE)) { - /* Insert a proxy entry in the cache, to make certain that the - * flush dependencies are maintained in the proper way for SWMR - * access to work. - */ - if(H5D__chunk_proxy_create(io_info->dset, io_info->dxpl_id, udata, ent) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, NULL, "can't insert proxy for chunk in metadata cache") - } /* end if */ } /* end if */ else /* We did not add the chunk to cache */ @@ -3402,6 +3404,7 @@ H5D__chunk_unlock(const H5D_io_info_t *io_info, const H5D_chunk_ud_t *udata, fake_ent.edge_chunk_state |= H5D_RDCC_NEWLY_DISABLED_FILTERS; HDmemcpy(fake_ent.offset, io_info->store->chunk.offset, layout->u.chunk.ndims * sizeof(fake_ent.offset[0])); HDassert(layout->u.chunk.size > 0); + fake_ent.chunk_idx = udata->chunk_idx; fake_ent.chunk_addr = udata->addr; fake_ent.chunk = (uint8_t *)chunk; @@ -3430,14 +3433,6 @@ H5D__chunk_unlock(const H5D_io_info_t *io_info, const H5D_chunk_ud_t *udata, if(dirty) { ent->dirty = TRUE; ent->wr_count -= MIN(ent->wr_count, naccessed); - - /* Check for SWMR writes to the file */ - if(io_info->dset->shared->layout.storage.u.chunk.ops->can_swim - && (H5F_INTENT(io_info->dset->oloc.file) & H5F_ACC_SWMR_WRITE)) { - /* Mark the proxy entry in the cache as dirty */ - if(H5D__chunk_proxy_mark(ent, TRUE) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTMARKDIRTY, FAIL, "can't mark proxy for chunk from metadata cache as dirty") - } /* end if */ } /* end if */ else ent->rd_count -= MIN(ent->rd_count, naccessed); @@ -3819,23 +3814,19 @@ H5D__chunk_allocate(const H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite, } /* end else */ while(!carry) { -#ifndef NDEBUG /* None of the chunks should be allocated */ - { - hsize_t chunk_idx; - - /* Calculate the index of this chunk */ - if(H5VM_chunk_index((unsigned)space_ndims, chunk_offset, - layout->u.chunk.dim, layout->u.chunk.down_chunks, - &chunk_idx) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't get chunk index") - - if(H5D__chunk_lookup(dset, dxpl_id, chunk_offset, chunk_idx, &udata) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address") + hsize_t chunk_idx; + + /* Calculate the index of this chunk */ + if(H5VM_chunk_index((unsigned)space_ndims, chunk_offset, layout->u.chunk.dim, + layout->u.chunk.down_chunks, &chunk_idx) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't get chunk index") + if(H5D__chunk_lookup(dset, dxpl_id, chunk_offset, chunk_idx, &udata) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address") +#ifndef NDEBUG - if(H5D_CHUNK_IDX_NONE != layout->storage.u.chunk.idx_type) - HDassert(!H5F_addr_defined(udata.addr)); - } /* end block */ + if(H5D_CHUNK_IDX_NONE != layout->storage.u.chunk.idx_type) + HDassert(!H5F_addr_defined(udata.addr)); /* Make sure the chunk is really in the dataset and outside the * original dimensions */ @@ -3901,10 +3892,13 @@ H5D__chunk_allocate(const H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite, H5_ASSIGN_OVERFLOW(udata.nbytes, chunk_size, size_t, uint32_t); udata.filter_mask = filter_mask; udata.addr = HADDR_UNDEF; + udata.need_insert = FALSE; + udata.need_modify = FALSE; /* Allocate the chunk with all processes */ - if((ops->insert)(&idx_info, &udata) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert record into chunk index") + if(H5D__idx_chunk_alloc(&idx_info, &udata) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert/resize chunk on chunk level") + HDassert(H5F_addr_defined(udata.addr)); /* Check if fill values should be written to chunks */ @@ -3934,6 +3928,11 @@ H5D__chunk_allocate(const H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite, #endif /* H5_HAVE_PARALLEL */ } /* end if */ + if((udata.need_insert || udata.need_modify) && ops->insert_addr) { + if((ops->insert_addr)(&idx_info, &udata) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert chunk addr into index") + } + /* Increment indices and adjust the edge chunk state */ carry = TRUE; for(i = (space_ndims - 1); i >= 0; --i) { @@ -5299,21 +5298,29 @@ H5D__chunk_copy_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) udata->buf_size = buf_size; } /* end if */ - /* Set metadata tag in dxpl_id */ - H5_BEGIN_TAG(udata->idx_info_dst->dxpl_id, H5AC__COPIED_TAG, H5_ITER_ERROR); - /* Insert chunk into the destination index */ - if((udata->idx_info_dst->storage->ops->insert)(udata->idx_info_dst, &udata_dst) < 0) - HGOTO_ERROR_TAG(H5E_DATASET, H5E_CANTINSERT, H5_ITER_ERROR, "unable to insert chunk into index") - - /* Reset metadata tag in dxpl_id */ - H5_END_TAG(H5_ITER_ERROR); + if(H5D__idx_chunk_alloc(udata->idx_info_dst, &udata_dst) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert/resize chunk on chunk level") /* Write chunk data to destination file */ HDassert(H5F_addr_defined(udata_dst.addr)); if(H5F_block_write(udata->idx_info_dst->f, H5FD_MEM_DRAW, udata_dst.addr, nbytes, udata->idx_info_dst->dxpl_id, buf) < 0) HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, H5_ITER_ERROR, "unable to write raw data to file") + /* Set metadata tag in dxpl_id */ + H5_BEGIN_TAG(udata->idx_info_dst->dxpl_id, H5AC__COPIED_TAG, H5_ITER_ERROR); + + /* Compute the index for this chunk */ + if(H5VM_chunk_index(udata_dst.common.layout->ndims - 1, chunk_rec->offset, udata_dst.common.layout->dim, udata_dst.common.layout->down_chunks, &udata_dst.chunk_idx) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, H5_ITER_ERROR, "can't get chunk index") + + if((udata_dst.need_insert || udata_dst.need_modify) && udata->idx_info_dst->storage->ops->insert_addr) { + if((udata->idx_info_dst->storage->ops->insert_addr)(udata->idx_info_dst, &udata_dst) < 0) + HGOTO_ERROR_TAG(H5E_DATASET, H5E_CANTINSERT, H5_ITER_ERROR, "unable to insert chunk addr into index") + } + /* Reset metadata tag in dxpl_id */ + H5_END_TAG(H5_ITER_ERROR); + done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__chunk_copy_cb() */ @@ -6069,160 +6076,141 @@ done: /*------------------------------------------------------------------------- - * Function: H5D__chunk_find_flush_dep + * Function: H5D_idx_chunk_alloc() * - * Purpose: Check cache (including temporary list of entries to be - * evicted) for the specified chunk. + * Purpose: Chunk allocation: + * Create the chunk if it doesn't exist, or reallocate the + * chunk if its size changed. + * The coding is moved and modified from each index structure. * * Return: Non-negative on success/Negative on failure * - * Programmer: Neil Fortner - * Monday, March 12, 2012 + * Programmer: Vailin Choi; June 2014 * *------------------------------------------------------------------------- */ static herr_t -H5D__chunk_find_flush_dep(const H5D_rdcc_t *rdcc, - const H5O_layout_chunk_t *layout, const hsize_t offset[], - H5D_rdcc_ent_t **ent) +H5D__idx_chunk_alloc(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata) { - hsize_t chunk_idx; /* Chunk index */ - hbool_t found = FALSE; /* In cache? */ - unsigned u; /* Local index variable */ - herr_t ret_value = SUCCEED; /* Return value */ + hbool_t alloc_chunk = FALSE; /* Whether to allocate chunk */ + hbool_t need_modify = FALSE; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC - /* Check args */ - HDassert(rdcc); - HDassert(layout); - HDassert(offset); - HDassert(ent); - - /* Calculate the index of this chunk */ - if(H5VM_chunk_index(layout->ndims - 1, offset, layout->dim, - layout->down_chunks, &chunk_idx) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "can't get chunk index") - - /* Check for chunk in cache */ - if(rdcc->nslots > 0) { - *ent = rdcc->slot[H5F_addr_hash(chunk_idx, rdcc->nslots)]; - - if(*ent) - for(u = 0; u < layout->ndims - 1; u++) - if(offset[u] != (*ent)->offset[u]) { - *ent = NULL; - break; - } /* end if */ - - /* Search temporary list if present */ - if(!(*ent) && rdcc->tmp_head) { - *ent = rdcc->tmp_head->tmp_next; + /* Sanity check */ + HDassert(idx_info); + HDassert(idx_info->f); + HDassert(idx_info->pline); + HDassert(idx_info->layout); + HDassert(idx_info->storage); + HDassert(H5F_addr_defined(idx_info->storage->idx_addr)); + HDassert(udata); - while(*ent) { - for(u = 0, found = TRUE; u < layout->ndims - 1; u++) - if(offset[u] != (*ent)->offset[u]) { - found = FALSE; - break; - } /* end if */ - if(found) - break; - else - *ent = (*ent)->tmp_next; - } /* end while */ + udata->need_modify = FALSE; /* this is mainly for V2-btree */ + udata->need_insert = FALSE; + + if(idx_info->pline->nused > 0) { + unsigned allow_chunk_size_len; /* Allowed size of encoded chunk size */ + unsigned new_chunk_size_len; /* Size of encoded chunk size */ + hsize_t chunk_offset[H5O_LAYOUT_NDIMS]; + H5D_chunk_ud_t found_udata; + + HDassert(idx_info->storage->idx_type != H5D_CHUNK_IDX_NONE); + + /* Compute the size required for encoding the size of a chunk, allowing + * for an extra byte, in case the filter makes the chunk larger. + */ + allow_chunk_size_len = 1 + ((H5VM_log2_gen((uint64_t)(idx_info->layout->size)) + 8) / 8); + if(allow_chunk_size_len > 8) + allow_chunk_size_len = 8; + + /* Compute encoded size of chunk */ + new_chunk_size_len = (H5VM_log2_gen((uint64_t)(udata->nbytes)) + 8) / 8; + if(new_chunk_size_len > 8) + HGOTO_ERROR(H5E_DATASET, H5E_BADRANGE, FAIL, "encoded chunk size is more than 8 bytes?!?") + + /* Check if the chunk became too large to be encoded */ + if(new_chunk_size_len > allow_chunk_size_len) + HGOTO_ERROR(H5E_DATASET, H5E_BADRANGE, FAIL, "chunk size can't be encoded") + + /* Initialize found_udata for ops->get_addr() */ + HDmemset(&found_udata, 0, sizeof found_udata); + HDmemcpy(chunk_offset, udata->common.offset, idx_info->layout->ndims * sizeof(udata->common.offset[0])); + found_udata.common.offset = chunk_offset; + found_udata.common.storage = udata->common.storage; + found_udata.common.layout = udata->common.layout; + found_udata.addr = HADDR_UNDEF; + + /* Get chunk information */ + if((idx_info->storage->ops->get_addr)(idx_info, &found_udata) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't query chunk address") + + if(H5F_addr_defined(found_udata.addr)) { + /* Sanity check */ + HDassert(!H5F_addr_defined(udata->addr) || H5F_addr_eq(udata->addr, found_udata.addr)); + + /* Check for chunk being same size */ + if(udata->nbytes != found_udata.nbytes) { + /* Release previous chunk */ + /* Only free the old location if not doing SWMR writes - otherwise + * we must keep the old chunk around in case a reader has an + * outdated version of the b-tree node + */ + if(!(H5F_INTENT(idx_info->f) & H5F_ACC_SWMR_WRITE)) { + H5_CHECK_OVERFLOW(found_udata.nbytes, uint32_t, hsize_t); + if(H5MF_xfree(idx_info->f, H5FD_MEM_DRAW, idx_info->dxpl_id, found_udata.addr, (hsize_t)found_udata.nbytes) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to free chunk") + } /* end if */ + alloc_chunk = TRUE; + need_modify = TRUE; - HDassert(!(*ent) == !found); - } /* end if */ + } else { + /* Don't need to reallocate chunk, but send its address back up */ + if(!H5F_addr_defined(udata->addr)) + udata->addr = found_udata.addr; + } + } else + alloc_chunk = TRUE; + + } else { + HDassert(!H5F_addr_defined(udata->addr)); + HDassert(udata->nbytes == idx_info->layout->size); + alloc_chunk = TRUE; + } + + if(alloc_chunk) { + switch(idx_info->storage->idx_type) { + case H5D_CHUNK_IDX_NONE: + if((idx_info->storage->ops->get_addr)(idx_info, udata) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't query chunk address") + break; + + case H5D_CHUNK_IDX_EARRAY: + case H5D_CHUNK_IDX_FARRAY: + case H5D_CHUNK_IDX_BTREE: + case H5D_CHUNK_IDX_BT2: + H5_CHECK_OVERFLOW(udata->nbytes, /*From: */uint32_t, /*To: */hsize_t); + udata->addr = H5MF_alloc(idx_info->f, H5FD_MEM_DRAW, idx_info->dxpl_id, (hsize_t)udata->nbytes); + if(!H5F_addr_defined(udata->addr)) + HGOTO_ERROR (H5E_DATASET, H5E_CANTALLOC, FAIL, "file allocation failed") + if(idx_info->storage->idx_type == H5D_CHUNK_IDX_BT2) { + /* This can be done together with other index types when Quincy checks into H5B2_modify() */ + if(!(udata->need_modify = need_modify)) + udata->need_insert = TRUE; + } else + udata->need_insert = TRUE; + break; + + case H5D_CHUNK_IDX_NTYPES: + default: + HDassert(0 && "This Should never be executed!"); + break; + } /* end switch */ } /* end if */ + HDassert(H5F_addr_defined(udata->addr)); -done: - FUNC_LEAVE_NOAPI(ret_value); -} /* end H5D__chunk_find_flush_dep() */ - - -/*------------------------------------------------------------------------- - * Function: H5D__chunk_create_flush_dep - * - * Purpose: Creates a flush dependency between the specified chunk - * (child) and parent. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Neil Fortner - * Tuesday, September 21, 2010 - * - *------------------------------------------------------------------------- - */ -herr_t -H5D__chunk_create_flush_dep(const H5D_rdcc_t *rdcc, - const H5O_layout_chunk_t *layout, const hsize_t offset[], void *parent) -{ - H5D_rdcc_ent_t *ent = NULL; /* Cache entry */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE - - /* Check args */ - HDassert(rdcc); - HDassert(layout); - HDassert(offset); - HDassert(parent); - - /* Look for this chunk in cache */ - if(H5D__chunk_find_flush_dep(rdcc, layout, offset, &ent) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk entry") - - /* Create the dependency on the chunk proxy */ - if(ent) - if(H5D__chunk_proxy_create_flush_dep(ent, parent) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTDEPEND, FAIL, "unable to create flush dependency") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* H5D__chunk_create_flush_dep() */ - - -/*------------------------------------------------------------------------- - * Function: H5D__chunk_update_flush_dep - * - * Purpose: Updates the flush dependency of the specified chunk from - * old_parent to new_parent, but only if the current parent - * is cached. If the chunk is not cached, does nothing. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Neil Fortner - * 7 Sept 2010 - * - *------------------------------------------------------------------------- - */ -herr_t -H5D__chunk_update_flush_dep(const H5D_rdcc_t *rdcc, - const H5O_layout_chunk_t *layout, const hsize_t offset[], void *old_parent, - void *new_parent) -{ - H5D_rdcc_ent_t *ent = NULL; /* Cache entry */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE - - /* Check args */ - HDassert(rdcc); - HDassert(layout); - HDassert(offset); - HDassert(old_parent); - HDassert(new_parent); - - /* Look for this chunk in cache */ - if(H5D__chunk_find_flush_dep(rdcc, layout, offset, &ent) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk entry") - - /* Update the dependencies on the chunk proxy */ - if(ent) - if(H5D__chunk_proxy_update_flush_dep(ent, old_parent, new_parent) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTDEPEND, FAIL, "unable to update flush dependency") - -done: +done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5D__chunk_update_flush_dep() */ +} /* H5D__idx_chunk_alloc() */ diff --git a/src/H5Dearray.c b/src/H5Dearray.c index b78f58c..fd57390 100644 --- a/src/H5Dearray.c +++ b/src/H5Dearray.c @@ -110,7 +110,7 @@ static herr_t H5D_earray_idx_init(const H5D_chk_idx_info_t *idx_info, const H5S_t *space, haddr_t dset_ohdr_addr); static herr_t H5D_earray_idx_create(const H5D_chk_idx_info_t *idx_info); static hbool_t H5D_earray_idx_is_space_alloc(const H5O_storage_chunk_t *storage); -static herr_t H5D_earray_idx_insert(const H5D_chk_idx_info_t *idx_info, +static herr_t H5D_earray_idx_insert_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata); static herr_t H5D_earray_idx_get_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata); @@ -127,10 +127,6 @@ static herr_t H5D_earray_idx_copy_shutdown(H5O_storage_chunk_t *storage_src, static herr_t H5D_earray_idx_size(const H5D_chk_idx_info_t *idx_info, hsize_t *size); static herr_t H5D_earray_idx_reset(H5O_storage_chunk_t *storage, hbool_t reset_addr); -static herr_t H5D_earray_idx_support(const H5D_chk_idx_info_t *idx_info, - H5D_chunk_ud_t *udata, H5AC_info_t *child_entry); -static herr_t H5D_earray_idx_unsupport(const H5D_chk_idx_info_t *idx_info, - H5D_chunk_ud_t *udata, H5AC_info_t *child_entry); static herr_t H5D_earray_idx_dump(const H5O_storage_chunk_t *storage, FILE *stream); static herr_t H5D_earray_idx_dest(const H5D_chk_idx_info_t *idx_info); @@ -146,7 +142,7 @@ const H5D_chunk_ops_t H5D_COPS_EARRAY[1] = {{ H5D_earray_idx_init, H5D_earray_idx_create, H5D_earray_idx_is_space_alloc, - H5D_earray_idx_insert, + H5D_earray_idx_insert_addr, H5D_earray_idx_get_addr, H5D_earray_idx_resize, H5D_earray_idx_iterate, @@ -156,8 +152,6 @@ const H5D_chunk_ops_t H5D_COPS_EARRAY[1] = {{ H5D_earray_idx_copy_shutdown, H5D_earray_idx_size, H5D_earray_idx_reset, - H5D_earray_idx_support, - H5D_earray_idx_unsupport, H5D_earray_idx_dump, H5D_earray_idx_dest }}; @@ -1058,23 +1052,20 @@ H5D_earray_idx_is_space_alloc(const H5O_storage_chunk_t *storage) /*------------------------------------------------------------------------- - * Function: H5D_earray_idx_insert + * Function: H5D_earray_idx_insert_addr * - * Purpose: Create the chunk it if it doesn't exist, or reallocate the - * chunk if its size changed. + * Purpose: Insert chunk address into the indexing structure. * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Thursday, January 29, 2009 + * Programmer: Vailin Choi; May 2014 * *------------------------------------------------------------------------- */ static herr_t -H5D_earray_idx_insert(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata) +H5D_earray_idx_insert_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata) { H5EA_t *ea; /* Pointer to extensible array structure */ - hsize_t idx; /* Array index of chunk */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -1086,6 +1077,7 @@ H5D_earray_idx_insert(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata) HDassert(idx_info->storage); HDassert(H5F_addr_defined(idx_info->storage->idx_addr)); HDassert(udata); + HDassert(udata->need_insert); /* Check if the extensible array is open yet */ if(NULL == idx_info->storage->u.earray.ea) { @@ -1097,129 +1089,30 @@ H5D_earray_idx_insert(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata) /* Set convenience pointer to extensible array structure */ ea = idx_info->storage->u.earray.ea; - /* Check for unlimited dim. not being the slowest-changing dim. */ - if(idx_info->layout->u.earray.unlim_dim > 0) { - hsize_t swizzled_coords[H5O_LAYOUT_NDIMS]; /* swizzled chunk coordinates */ - unsigned ndims = (idx_info->layout->ndims - 1); /* Number of dimensions */ - - /* Set up the swizzled chunk coordinates */ - HDmemcpy(swizzled_coords, udata->common.offset, ndims * sizeof(udata->common.offset[0])); - H5VM_swizzle_coords(hsize_t, swizzled_coords, idx_info->layout->u.earray.unlim_dim); - - /* Calculate the index of this chunk */ - if(H5VM_chunk_index(ndims, swizzled_coords, idx_info->layout->u.earray.swizzled_dim, idx_info->layout->u.earray.swizzled_down_chunks, &idx) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "can't get chunk index") - } /* end if */ - else { - /* Calculate the index of this chunk */ - if(H5VM_chunk_index((idx_info->layout->ndims - 1), udata->common.offset, idx_info->layout->dim, idx_info->layout->down_chunks, &idx) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "can't get chunk index") - } /* end else */ + if(!H5F_addr_defined(udata->addr)) + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "The chunk should have allocated already") + if(udata->chunk_idx != (udata->chunk_idx & 0xffffffff)) /* negative value */ + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "chunk index must be less than 2^32") - /* Check for filters on chunks */ if(idx_info->pline->nused > 0) { - H5D_earray_filt_elmt_t elmt; /* Extensible array element */ - unsigned allow_chunk_size_len; /* Allowed size of encoded chunk size */ - unsigned new_chunk_size_len; /* Size of encoded chunk size */ - hbool_t alloc_chunk = FALSE; /* Whether to allocate chunk */ - - /* Compute the size required for encoding the size of a chunk, allowing - * for an extra byte, in case the filter makes the chunk larger. - */ - allow_chunk_size_len = 1 + ((H5VM_log2_gen(idx_info->layout->size) + 8) / 8); - if(allow_chunk_size_len > 8) - allow_chunk_size_len = 8; - - /* Compute encoded size of chunk */ - new_chunk_size_len = (H5VM_log2_gen(udata->nbytes) + 8) / 8; - if(new_chunk_size_len > 8) - HGOTO_ERROR(H5E_DATASET, H5E_BADRANGE, FAIL, "encoded chunk size is more than 8 bytes?!?") - - /* Check if the chunk became too large to be encoded */ - if(new_chunk_size_len > allow_chunk_size_len) - HGOTO_ERROR(H5E_DATASET, H5E_BADRANGE, FAIL, "chunk size can't be encoded") - - /* Get the information for the chunk */ - if(H5EA_get(ea, idx_info->dxpl_id, idx, &elmt) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk info") - - /* Check for previous chunk */ - if(H5F_addr_defined(elmt.addr)) { - /* Sanity check */ - HDassert(!H5F_addr_defined(udata->addr) || H5F_addr_eq(udata->addr, elmt.addr)); - - /* Check for chunk being same size */ - if(udata->nbytes != elmt.nbytes) { - /* Release previous chunk */ - /* Only free the old location if not doing SWMR writes - otherwise - * we must keep the old chunk around in case a reader has an - * outdated version of the b-tree node */ - if(!(H5F_INTENT(idx_info->f) & H5F_ACC_SWMR_WRITE)) { - H5_CHECK_OVERFLOW(elmt.nbytes, uint32_t, hsize_t); - if(H5MF_xfree(idx_info->f, H5FD_MEM_DRAW, idx_info->dxpl_id, elmt.addr, (hsize_t)elmt.nbytes) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to free chunk") - } /* end if */ - elmt.addr = HADDR_UNDEF; - alloc_chunk = TRUE; - } /* end if */ - else { - /* Don't need to reallocate chunk, but send its address back up */ - if(!H5F_addr_defined(udata->addr)) - udata->addr = elmt.addr; - } /* end else */ - } /* end if */ - else - alloc_chunk = TRUE; - - /* Check if we need to allocate the chunk */ - if(alloc_chunk) { - H5_CHECK_OVERFLOW(udata->nbytes, uint32_t, hsize_t); - udata->addr = H5MF_alloc(idx_info->f, H5FD_MEM_DRAW, idx_info->dxpl_id, (hsize_t)udata->nbytes); - if(!H5F_addr_defined(udata->addr)) - HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "unable to allocate chunk") - - /* Update the element information */ - elmt.addr = udata->addr; - elmt.nbytes = udata->nbytes; - elmt.filter_mask = udata->filter_mask; - - /* Set the info for the chunk */ - if(H5EA_set(ea, idx_info->dxpl_id, idx, &elmt) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set chunk info") - } /* end if */ - } /* end if */ - else { - HDassert(!H5F_addr_defined(udata->addr)); - HDassert(udata->nbytes == idx_info->layout->size); + H5D_earray_filt_elmt_t elmt; /* Extensible array element */ -#ifndef NDEBUG -{ - haddr_t addr = HADDR_UNDEF; /* Address of chunk in file */ + elmt.addr = udata->addr; + elmt.nbytes = udata->nbytes; + elmt.filter_mask = udata->filter_mask; - /* Get the address for the chunk */ - if(H5EA_get(ea, idx_info->dxpl_id, idx, &addr) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk address") - HDassert(!H5F_addr_defined(addr)); -} -#endif /* NDEBUG */ - - /* - * Allocate storage for the new chunk - */ - H5_CHECK_OVERFLOW(udata->nbytes, /*From: */uint32_t, /*To: */hsize_t); - udata->addr = H5MF_alloc(idx_info->f, H5FD_MEM_DRAW, idx_info->dxpl_id, (hsize_t)udata->nbytes); - if(!H5F_addr_defined(udata->addr)) - HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "file allocation failed") - - /* Set the address for the chunk */ - if(H5EA_set(ea, idx_info->dxpl_id, idx, &udata->addr) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set chunk address") - } /* end else */ - HDassert(H5F_addr_defined(udata->addr)); + /* Set the info for the chunk */ + if(H5EA_set(ea, idx_info->dxpl_id, udata->chunk_idx, &elmt) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set chunk info") + } else { + /* Set the address for the chunk */ + if(H5EA_set(ea, idx_info->dxpl_id, udata->chunk_idx, &udata->addr) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set chunk address") + } done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5D_earray_idx_insert() */ +} /* H5D_earray_idx_insert_addr() */ /*------------------------------------------------------------------------- @@ -1282,6 +1175,8 @@ H5D_earray_idx_get_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udat HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "can't get chunk index") } /* end else */ + udata->chunk_idx = idx; + /* Check for filters on chunks */ if(idx_info->pline->nused > 0) { H5D_earray_filt_elmt_t elmt; /* Extensible array element */ @@ -1872,147 +1767,6 @@ H5D_earray_idx_reset(H5O_storage_chunk_t *storage, hbool_t reset_addr) /*------------------------------------------------------------------------- - * Function: H5D_earray_idx_support - * - * Purpose: Create a dependency between a chunk [proxy] and the index - * metadata that contains the record for the chunk. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * Thursday, May 21, 2009 - * - *------------------------------------------------------------------------- - */ -static htri_t -H5D_earray_idx_support(const H5D_chk_idx_info_t *idx_info, - H5D_chunk_ud_t *udata, H5AC_info_t *child_entry) -{ - H5EA_t *ea; /* Pointer to extensible array structure */ - hsize_t idx; /* Array index of chunk */ - herr_t ret_value = TRUE; /* Return value */ - - FUNC_ENTER_NOAPI_NOINIT - - /* Check args */ - HDassert(idx_info); - HDassert(idx_info->layout); - HDassert(idx_info->storage); - HDassert(udata); - HDassert(child_entry); - - /* Check if the extensible array is open yet */ - if(NULL == idx_info->storage->u.earray.ea) { - /* Open the extensible array in file */ - if(H5D_earray_idx_open(idx_info) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open extensible array") - } /* end if */ - - /* Set convenience pointer to extensible array structure */ - ea = idx_info->storage->u.earray.ea; - - /* Check for unlimited dim. not being the slowest-changing dim. */ - if(idx_info->layout->u.earray.unlim_dim > 0) { - hsize_t swizzled_coords[H5O_LAYOUT_NDIMS]; /* swizzled chunk coordinates */ - unsigned ndims = (idx_info->layout->ndims - 1); /* Number of dimensions */ - - /* Set up the swizzled chunk coordinates */ - HDmemcpy(swizzled_coords, udata->common.offset, ndims * sizeof(udata->common.offset[0])); - H5VM_swizzle_coords(hsize_t, swizzled_coords, idx_info->layout->u.earray.unlim_dim); - - /* Calculate the index of this chunk */ - if(H5VM_chunk_index(ndims, swizzled_coords, idx_info->layout->u.earray.swizzled_dim, idx_info->layout->u.earray.swizzled_down_chunks, &idx) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "can't get chunk index") - } /* end if */ - else { - /* Calculate the index of this chunk */ - if(H5VM_chunk_index((idx_info->layout->ndims - 1), udata->common.offset, idx_info->layout->dim, idx_info->layout->down_chunks, &idx) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "can't get chunk index") - } /* end else */ - - /* Create flush dependency between the child_entry and the piece of metadata - * in the extensible array that contains the entry for this chunk. - */ - if(H5EA_support(ea, idx_info->dxpl_id, idx, child_entry) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTDEPEND, FAIL, "unable to create flush dependency on extensible array metadata") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5D_earray_idx_support() */ - - -/*------------------------------------------------------------------------- - * Function: H5D_earray_idx_unsupport - * - * Purpose: Remove a dependency between a chunk [proxy] and the index - * metadata that contains the record for the chunk. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * Thursday, May 21, 2009 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5D_earray_idx_unsupport(const H5D_chk_idx_info_t *idx_info, - H5D_chunk_ud_t *udata, H5AC_info_t *child_entry) -{ - H5EA_t *ea; /* Pointer to extensible array structure */ - hsize_t idx; /* Array index of chunk */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI_NOINIT - - /* Check args */ - HDassert(idx_info); - HDassert(idx_info->layout); - HDassert(idx_info->storage); - HDassert(udata); - HDassert(child_entry); - - /* Check if the extensible array is open yet */ - if(NULL == idx_info->storage->u.earray.ea) { - /* Open the extensible array in file */ - if(H5D_earray_idx_open(idx_info) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open extensible array") - } /* end if */ - - /* Set convenience pointer to extensible array structure */ - ea = idx_info->storage->u.earray.ea; - - /* Check for unlimited dim. not being the slowest-changing dim. */ - if(idx_info->layout->u.earray.unlim_dim > 0) { - hsize_t swizzled_coords[H5O_LAYOUT_NDIMS]; /* swizzled chunk coordinates */ - unsigned ndims = (idx_info->layout->ndims - 1); /* Number of dimensions */ - - /* Set up the swizzled chunk coordinates */ - HDmemcpy(swizzled_coords, udata->common.offset, ndims * sizeof(udata->common.offset[0])); - H5VM_swizzle_coords(hsize_t, swizzled_coords, idx_info->layout->u.earray.unlim_dim); - - - /* Calculate the index of this chunk */ - if(H5VM_chunk_index(ndims, swizzled_coords, idx_info->layout->u.earray.swizzled_dim, idx_info->layout->u.earray.swizzled_down_chunks, &idx) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "can't get chunk index") - } /* end if */ - else { - /* Calculate the index of this chunk */ - if(H5VM_chunk_index((idx_info->layout->ndims - 1), udata->common.offset, idx_info->layout->dim, idx_info->layout->down_chunks, &idx) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "can't get chunk index") - } /* end else */ - - /* Remove flush dependency between the child_entry and the piece of metadata - * in the extensible array that contains the entry for this chunk. - */ - if(H5EA_unsupport(ea, idx_info->dxpl_id, idx, child_entry) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTUNDEPEND, FAIL, "unable to remove flush dependency on extensible array metadata") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5D_earray_idx_unsupport() */ - - -/*------------------------------------------------------------------------- * Function: H5D_earray_idx_dump * * Purpose: Dump indexing information to a stream. diff --git a/src/H5Dfarray.c b/src/H5Dfarray.c index 351a52f..6423804 100644 --- a/src/H5Dfarray.c +++ b/src/H5Dfarray.c @@ -124,9 +124,11 @@ static herr_t H5D_farray_filt_debug(FILE *stream, int indent, int fwidth, hsize_t idx, const void *elmt); /* Chunked layout indexing callbacks */ +static herr_t H5D_farray_idx_init(const H5D_chk_idx_info_t *idx_info, + const H5S_t UNUSED *space, haddr_t dset_ohdr_addr); static herr_t H5D_farray_idx_create(const H5D_chk_idx_info_t *idx_info); static hbool_t H5D_farray_idx_is_space_alloc(const H5O_storage_chunk_t *storage); -static herr_t H5D_farray_idx_insert(const H5D_chk_idx_info_t *idx_info, +static herr_t H5D_farray_idx_insert_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata); static herr_t H5D_farray_idx_get_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata); @@ -152,11 +154,11 @@ static herr_t H5D_farray_idx_dest(const H5D_chk_idx_info_t *idx_info); /* Fixed array indexed chunk I/O ops */ const H5D_chunk_ops_t H5D_COPS_FARRAY[1] = {{ - FALSE, /* Fixed array indices don't current support SWMR access */ - NULL, + TRUE, /* Fixed array indices support SWMR access */ + H5D_farray_idx_init, H5D_farray_idx_create, H5D_farray_idx_is_space_alloc, - H5D_farray_idx_insert, + H5D_farray_idx_insert_addr, H5D_farray_idx_get_addr, NULL, H5D_farray_idx_iterate, @@ -166,8 +168,6 @@ const H5D_chunk_ops_t H5D_COPS_FARRAY[1] = {{ H5D_farray_idx_copy_shutdown, H5D_farray_idx_size, H5D_farray_idx_reset, - NULL, - NULL, H5D_farray_idx_dump, H5D_farray_idx_dest }}; @@ -715,6 +715,145 @@ H5D_farray_filt_debug(FILE *stream, int indent, int fwidth, hsize_t idx, /*------------------------------------------------------------------------- + * Function: H5D_farray_idx_depend + * + * Purpose: Create flush dependency between fixed array and dataset's + * object header. + * + * Return: Success: non-negative + * Failure: negative + * + * Programmer: Copied and modified from H5Dearrary.c + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D_farray_idx_depend(const H5D_chk_idx_info_t *idx_info) +{ + H5O_loc_t oloc; /* Temporary object header location for dataset */ + H5O_proxy_t *oh_proxy = NULL; /* Dataset's object header proxy */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT + + /* Check args */ + HDassert(idx_info); + HDassert(idx_info->f); + HDassert(H5F_INTENT(idx_info->f) & H5F_ACC_SWMR_WRITE); + HDassert(idx_info->pline); + HDassert(idx_info->layout); + HDassert(H5D_CHUNK_IDX_FARRAY == idx_info->layout->idx_type); + HDassert(idx_info->storage); + HDassert(H5D_CHUNK_IDX_FARRAY == idx_info->storage->idx_type); + HDassert(H5F_addr_defined(idx_info->storage->idx_addr)); + HDassert(idx_info->storage->u.farray.fa); + + /* Set up object header location for dataset */ + H5O_loc_reset(&oloc); + oloc.file = idx_info->f; + oloc.addr = idx_info->storage->u.farray.dset_ohdr_addr; + + /* Pin the dataset's object header proxy */ + if(NULL == (oh_proxy = H5O_pin_flush_dep_proxy(&oloc, idx_info->dxpl_id))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTPIN, FAIL, "unable to pin dataset object header proxy") + + /* Make the extensible array a child flush dependency of the dataset's object header */ + if(H5FA_depend((H5AC_info_t *)oh_proxy, idx_info->storage->u.farray.fa) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTDEPEND, FAIL, "unable to create flush dependency on object header") + +done: + /* Unpin the dataset's object header proxy */ + if(oh_proxy && H5O_unpin_flush_dep_proxy(oh_proxy) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CANTUNPIN, FAIL, "unable to unpin dataset object header proxy") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5D_farray_idx_depend() */ + + +/*------------------------------------------------------------------------- + * Function: H5D_farray_idx_undepend + * + * Purpose: Remove flush dependency between fixed array and dataset's + * object header. + * + * Return: Success: non-negative + * Failure: negative + * + * Programmer: Copied and modified from H5Dearray.c + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D_farray_idx_undepend(const H5D_chk_idx_info_t *idx_info) +{ + H5O_loc_t oloc; /* Temporary object header location for dataset */ + H5O_proxy_t *oh_proxy = NULL; /* Dataset's object header proxy */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT + + /* Check args */ + HDassert(idx_info); + HDassert(idx_info->f); + HDassert(H5F_INTENT(idx_info->f) & H5F_ACC_SWMR_WRITE); + HDassert(idx_info->pline); + HDassert(idx_info->layout); + HDassert(H5D_CHUNK_IDX_FARRAY == idx_info->layout->idx_type); + HDassert(idx_info->storage); + HDassert(H5D_CHUNK_IDX_FARRAY == idx_info->storage->idx_type); + HDassert(H5F_addr_defined(idx_info->storage->idx_addr)); + HDassert(idx_info->storage->u.farray.fa); + + /* Set up object header location for dataset */ + H5O_loc_reset(&oloc); + oloc.file = idx_info->f; + oloc.addr = idx_info->storage->u.farray.dset_ohdr_addr; + + /* Pin the dataset's object header proxy */ + if(NULL == (oh_proxy = H5O_pin_flush_dep_proxy(&oloc, idx_info->dxpl_id))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTPIN, FAIL, "unable to pin dataset object header proxy") + + /* Remove the extensible array as a child flush dependency of the dataset's object header */ + if(H5FA_undepend((H5AC_info_t *)oh_proxy, idx_info->storage->u.farray.fa) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTUNDEPEND, FAIL, "unable to remove flush dependency on object header") + +done: + /* Unpin the dataset's object header proxy */ + if(oh_proxy && H5O_unpin_flush_dep_proxy(oh_proxy) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CANTUNPIN, FAIL, "unable to unpin dataset object header proxy") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5D_farray_idx_undepend() */ + +/*------------------------------------------------------------------------- + * Function: H5D_farray_idx_init + * + * Purpose: Initialize the indexing information for a dataset. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Neil Fortner + * Wednensday, May 23, 2012 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D_farray_idx_init(const H5D_chk_idx_info_t *idx_info, const H5S_t UNUSED *space, haddr_t dset_ohdr_addr) +{ + FUNC_ENTER_NOAPI_NOINIT_NOERR + + /* Check args */ + HDassert(idx_info); + HDassert(idx_info->storage); + HDassert(H5F_addr_defined(dset_ohdr_addr)); + + idx_info->storage->u.farray.dset_ohdr_addr = dset_ohdr_addr; + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5D_farray_idx_init() */ + + +/*------------------------------------------------------------------------- * Function: H5D_farray_idx_open * * Purpose: Opens an existing fixed array and initializes @@ -755,6 +894,12 @@ H5D_farray_idx_open(const H5D_chk_idx_info_t *idx_info) if(NULL == (idx_info->storage->u.farray.fa = H5FA_open(idx_info->f, idx_info->dxpl_id, idx_info->storage->idx_addr, &udata))) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't open fixed array") + /* Check for SWMR writes to the file */ + if(H5F_INTENT(idx_info->f) & H5F_ACC_SWMR_WRITE) { + if(H5D_farray_idx_depend(idx_info) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTDEPEND, FAIL, "unable to create flush dependency on object header") + } /* end if */ + done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5D_farray_idx_open() */ @@ -836,6 +981,12 @@ H5D_farray_idx_create(const H5D_chk_idx_info_t *idx_info) if(H5FA_get_addr(idx_info->storage->u.farray.fa, &(idx_info->storage->idx_addr)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't query fixed array address") + /* Check for SWMR writes to the file */ + if(H5F_INTENT(idx_info->f) & H5F_ACC_SWMR_WRITE) { + if(H5D_farray_idx_depend(idx_info) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTDEPEND, FAIL, "unable to create flush dependency on object header") + } /* end if */ + done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5D_farray_idx_create() */ @@ -871,28 +1022,20 @@ H5D_farray_idx_is_space_alloc(const H5O_storage_chunk_t *storage) /*------------------------------------------------------------------------- - * Function: H5D_farray_idx_insert + * Function: H5D_farray_idx_insert_addr * - * Purpose: Create the chunk if it doesn't exist, or reallocate the - * chunk if its size changed. + * Purpose: Insert chunk address into the indexing structure. * * Return: Non-negative on success/Negative on failure * - * Programmer: Vailin Choi - * Thursday, April 30, 2009 - * - * Modifications: - * Vailin Choi; June 2010 - * Modified to handle extendible datdaset. - * (fixed max. dim. setting but not H5S_UNLIMITED) - * + * Programmer: Vailin Choi; 5 May 2014 + * *------------------------------------------------------------------------- */ static herr_t -H5D_farray_idx_insert(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata) +H5D_farray_idx_insert_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata) { H5FA_t *fa; /* Pointer to fixed array structure */ - hsize_t idx; /* Array index of chunk */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -904,6 +1047,7 @@ H5D_farray_idx_insert(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata) HDassert(idx_info->storage); HDassert(H5F_addr_defined(idx_info->storage->idx_addr)); HDassert(udata); + HDassert(udata->need_insert); /* Check if the fixed array is open yet */ if(NULL == idx_info->storage->u.farray.fa) { @@ -915,109 +1059,32 @@ H5D_farray_idx_insert(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata) /* Set convenience pointer to fixed array structure */ fa = idx_info->storage->u.farray.fa; - /* Calculate the index of this chunk */ - if(H5VM_chunk_index((idx_info->layout->ndims - 1), udata->common.offset, idx_info->layout->dim, idx_info->layout->max_down_chunks, &idx) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "can't get chunk index") + if(!H5F_addr_defined(udata->addr)) + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "The chunk should have allocated already") + if(udata->chunk_idx != (udata->chunk_idx & 0xffffffff)) /* negative value */ + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "chunk index must be less than 2^32") /* Check for filters on chunks */ if(idx_info->pline->nused > 0) { H5D_farray_filt_elmt_t elmt; /* Fixed array element */ - unsigned allow_chunk_size_len; /* Allowed size of encoded chunk size */ - unsigned new_chunk_size_len; /* Size of encoded chunk size */ - hbool_t alloc_chunk = FALSE; /* Whether to allocate chunk */ - - /* Compute the size required for encoding the size of a chunk, allowing - * for an extra byte, in case the filter makes the chunk larger. - */ - allow_chunk_size_len = 1 + ((H5VM_log2_gen(idx_info->layout->size) + 8) / 8); - if(allow_chunk_size_len > 8) - allow_chunk_size_len = 8; - - /* Compute encoded size of chunk */ - new_chunk_size_len = (H5VM_log2_gen(udata->nbytes) + 8) / 8; - if(new_chunk_size_len > 8) - HGOTO_ERROR(H5E_DATASET, H5E_BADRANGE, FAIL, "encoded chunk size is more than 8 bytes?!?") - - /* Check if the chunk became too large to be encoded */ - if(new_chunk_size_len > allow_chunk_size_len) - HGOTO_ERROR(H5E_DATASET, H5E_BADRANGE, FAIL, "chunk size can't be encoded") - /* Get the information for the chunk */ - if(H5FA_get(fa, idx_info->dxpl_id, idx, &elmt) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk info") + elmt.addr = udata->addr; + elmt.nbytes = udata->nbytes; + elmt.filter_mask = udata->filter_mask; - /* Check for previous chunk */ - if(H5F_addr_defined(elmt.addr)) { - /* Sanity check */ - HDassert(!H5F_addr_defined(udata->addr) || H5F_addr_eq(udata->addr, elmt.addr)); - - /* Check for chunk being same size */ - if(udata->nbytes != elmt.nbytes) { - /* Release previous chunk */ - H5_CHECK_OVERFLOW(elmt.nbytes, uint32_t, hsize_t); - if(H5MF_xfree(idx_info->f, H5FD_MEM_DRAW, idx_info->dxpl_id, elmt.addr, (hsize_t)elmt.nbytes) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to free chunk") - elmt.addr = HADDR_UNDEF; - alloc_chunk = TRUE; - } /* end if */ - else { - /* Don't need to reallocate chunk, but send its address back up */ - if(!H5F_addr_defined(udata->addr)) - udata->addr = elmt.addr; - } /* end else */ - } /* end if */ - else - alloc_chunk = TRUE; - - /* Check if we need to allocate the chunk */ - if(alloc_chunk) { - H5_CHECK_OVERFLOW(udata->nbytes, uint32_t, hsize_t); - udata->addr = H5MF_alloc(idx_info->f, H5FD_MEM_DRAW, idx_info->dxpl_id, (hsize_t)udata->nbytes); - if(!H5F_addr_defined(udata->addr)) - HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "unable to allocate chunk") - - /* Update the element information */ - elmt.addr = udata->addr; - elmt.nbytes = udata->nbytes; - elmt.filter_mask = udata->filter_mask; - - /* Set the info for the chunk */ - if(H5FA_set(fa, idx_info->dxpl_id, idx, &elmt) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set chunk info") - } /* end if */ + /* Set the info for the chunk */ + if(H5FA_set(fa, idx_info->dxpl_id, udata->chunk_idx, &elmt) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set chunk info") } /* end if */ else { - HDassert(!H5F_addr_defined(udata->addr)); - HDassert(udata->nbytes == idx_info->layout->size); - -#ifndef NDEBUG -{ - haddr_t addr = HADDR_UNDEF; /* Address of chunk in file */ - - /* Get the address for the chunk */ - if(H5FA_get(fa, idx_info->dxpl_id, idx, &addr) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk address") - HDassert(!H5F_addr_defined(addr)); -} -#endif /* NDEBUG */ - - /* - * Allocate storage for the new chunk - */ - H5_CHECK_OVERFLOW(udata->nbytes, /*From: */uint32_t, /*To: */hsize_t); - udata->addr = H5MF_alloc(idx_info->f, H5FD_MEM_DRAW, idx_info->dxpl_id, (hsize_t)udata->nbytes); - if(!H5F_addr_defined(udata->addr)) - HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "file allocation failed") - /* Set the address for the chunk */ - if(H5FA_set(fa, idx_info->dxpl_id, idx, &udata->addr) < 0) + if(H5FA_set(fa, idx_info->dxpl_id, udata->chunk_idx, &udata->addr) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set chunk address") } /* end else */ - HDassert(H5F_addr_defined(udata->addr)); done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5D_farray_idx_insert() */ +} /* H5D_farray_idx_insert_addr() */ /*------------------------------------------------------------------------- @@ -1070,6 +1137,8 @@ H5D_farray_idx_get_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udat if(H5VM_chunk_index((idx_info->layout->ndims - 1), udata->common.offset, idx_info->layout->dim, idx_info->layout->max_down_chunks, &idx) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "can't get chunk index") + udata->chunk_idx = idx; + /* Check for filters on chunks */ if(idx_info->pline->nused > 0) { H5D_farray_filt_elmt_t elmt; /* Fixed array element */ @@ -1702,6 +1771,16 @@ H5D_farray_idx_dest(const H5D_chk_idx_info_t *idx_info) /* Check if the fixed array is open */ if(idx_info->storage->u.farray.fa) { + /* Check for SWMR writes to the file */ + if(H5F_INTENT(idx_info->f) & H5F_ACC_SWMR_WRITE) { + /* Sanity check */ + HDassert(H5F_addr_defined(idx_info->storage->u.farray.dset_ohdr_addr)); + + /* Remove flush dependency between extensible array and dataset' object header */ + if(H5D_farray_idx_undepend(idx_info) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTUNDEPEND, FAIL, "unable to remove flush dependency on object header") + } /* end if */ + if(H5FA_close(idx_info->storage->u.farray.fa, idx_info->dxpl_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to close fixed array") idx_info->storage->u.farray.fa = NULL; diff --git a/src/H5Dnone.c b/src/H5Dnone.c index ac6f42c..60194c3 100644 --- a/src/H5Dnone.c +++ b/src/H5Dnone.c @@ -59,8 +59,6 @@ /* Non Index chunking I/O ops */ static herr_t H5D_none_create(const H5D_chk_idx_info_t *idx_info); static hbool_t H5D_none_is_space_alloc(const H5O_storage_chunk_t *storage); -static herr_t H5D_none_insert(const H5D_chk_idx_info_t *idx_info, - H5D_chunk_ud_t *udata); static herr_t H5D_none_get_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata); static int H5D_none_iterate(const H5D_chk_idx_info_t *idx_info, @@ -81,11 +79,11 @@ static herr_t H5D_none_dump(const H5O_storage_chunk_t *storage, FILE *stream); /* Non Index chunk I/O ops */ const H5D_chunk_ops_t H5D_COPS_NONE[1] = {{ - FALSE, /* Non-indexed chunking don't current support SWMR access */ + TRUE, /* Non-indexed chunking don't current support SWMR access */ NULL, /* init */ H5D_none_create, /* create */ H5D_none_is_space_alloc, /* is_space_alloc */ - H5D_none_insert, /* insert */ + NULL, /* insert */ H5D_none_get_addr, /* get_addr */ NULL, /* resize */ H5D_none_iterate, /* iterate */ @@ -95,8 +93,6 @@ const H5D_chunk_ops_t H5D_COPS_NONE[1] = {{ NULL, /* copy_shutdown */ H5D_none_size, /* size */ H5D_none_reset, /* reset */ - NULL, /* support */ - NULL, /* unsupport */ H5D_none_dump, /* dump */ NULL /* dest */ }}; @@ -182,52 +178,6 @@ H5D_none_is_space_alloc(const H5O_storage_chunk_t *storage) /*------------------------------------------------------------------------- - * Function: H5D_none_insert - * - * Purpose: Calculate the address of the chunk - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Vailin Choi; Sept 2010 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5D_none_insert(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata) -{ - hsize_t idx; /* Array index of chunk */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI_NOINIT - - HDassert(idx_info); - HDassert(idx_info->f); - HDassert(idx_info->pline); - HDassert(idx_info->pline->nused == 0); - HDassert(idx_info->layout); - HDassert(idx_info->storage); - HDassert(H5F_addr_defined(idx_info->storage->idx_addr)); - HDassert(udata); - - /* Calculate the index of this chunk */ - if(H5VM_chunk_index((idx_info->layout->ndims - 1), udata->common.offset, idx_info->layout->dim, idx_info->layout->max_down_chunks, &idx) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "can't get chunk index") - - HDassert(!H5F_addr_defined(udata->addr)); - HDassert(udata->nbytes == idx_info->layout->size); - - /* Storage is already allocated, just calculate the file address of the chunk */ - H5_CHECK_OVERFLOW(udata->nbytes, /*From: */uint32_t, /*To: */hsize_t); - udata->addr = idx_info->storage->idx_addr + idx * udata->nbytes; - - HDassert(H5F_addr_defined(udata->addr)); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* H5D_none_insert() */ - - -/*------------------------------------------------------------------------- * Function: H5D_none_get_addr * * Purpose: Get the file address of a chunk. @@ -260,6 +210,8 @@ H5D_none_get_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata) if(H5VM_chunk_index((idx_info->layout->ndims - 1), udata->common.offset, idx_info->layout->dim, idx_info->layout->max_down_chunks, &idx) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "can't get chunk index") + udata->chunk_idx = idx; + /* Calculate the address of the chunk */ udata->addr = idx_info->storage->idx_addr + idx * idx_info->layout->size; diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h index 0bb1def..10591d4 100644 --- a/src/H5Dpkg.h +++ b/src/H5Dpkg.h @@ -291,6 +291,9 @@ typedef struct H5D_chunk_ud_t { unsigned filter_mask; /*excluded filters */ haddr_t addr; /*file address of chunk */ hbool_t new_unfilt_chunk; /*whether the chunk just became unfiltered */ + hsize_t chunk_idx; /*chunk index for EA, FA indexing */ + hbool_t need_insert; + hbool_t need_modify; } H5D_chunk_ud_t; /* Typedef for "generic" chunk callbacks */ @@ -319,10 +322,6 @@ typedef herr_t (*H5D_chunk_copy_shutdown_func_t)(H5O_storage_chunk_t *storage_sr typedef herr_t (*H5D_chunk_size_func_t)(const H5D_chk_idx_info_t *idx_info, hsize_t *idx_size); typedef herr_t (*H5D_chunk_reset_func_t)(H5O_storage_chunk_t *storage, hbool_t reset_addr); -typedef htri_t (*H5D_chunk_support_func_t)(const H5D_chk_idx_info_t *idx_info, - H5D_chunk_ud_t *udata, H5AC_info_t *child_entry); -typedef herr_t (*H5D_chunk_unsupport_func_t)(const H5D_chk_idx_info_t *idx_info, - H5D_chunk_ud_t *udata, H5AC_info_t *child_entry); typedef herr_t (*H5D_chunk_dump_func_t)(const H5O_storage_chunk_t *storage, FILE *stream); typedef herr_t (*H5D_chunk_dest_func_t)(const H5D_chk_idx_info_t *idx_info); @@ -333,7 +332,7 @@ typedef struct H5D_chunk_ops_t { H5D_chunk_init_func_t init; /* Routine to initialize indexing information in memory */ H5D_chunk_create_func_t create; /* Routine to create chunk index */ H5D_chunk_is_space_alloc_func_t is_space_alloc; /* Query routine to determine if storage/index is allocated */ - H5D_chunk_insert_func_t insert; /* Routine to insert a chunk into an index */ + H5D_chunk_insert_func_t insert_addr; /* Routine to insert a chunk into an index */ H5D_chunk_get_addr_func_t get_addr; /* Routine to retrieve address of chunk in file */ H5D_chunk_resize_func_t resize; /* Routine to update chunk index info after resizing dataset */ H5D_chunk_iterate_func_t iterate; /* Routine to iterate over chunks */ @@ -343,8 +342,6 @@ typedef struct H5D_chunk_ops_t { H5D_chunk_copy_shutdown_func_t copy_shutdown; /* Routine to perform any necessary shutdown for copying chunks */ H5D_chunk_size_func_t size; /* Routine to get size of indexing information */ H5D_chunk_reset_func_t reset; /* Routine to reset indexing information */ - H5D_chunk_support_func_t support; /* Routine to create dependency between chunk [proxy] and index metadata */ - H5D_chunk_unsupport_func_t unsupport; /* Routine to remove dependency between chunk [proxy] and index metadata */ H5D_chunk_dump_func_t dump; /* Routine to dump indexing information */ H5D_chunk_dest_func_t dest; /* Routine to destroy indexing information in memory */ } H5D_chunk_ops_t; @@ -396,6 +393,7 @@ typedef struct H5D_chunk_cached_t{ hbool_t valid; /*whether cache info is valid*/ hsize_t offset[H5O_LAYOUT_NDIMS]; /*logical offset to start*/ uint32_t nbytes; /*size of stored data */ + hsize_t chunk_idx; /*index of chunk in dataset */ unsigned filter_mask; /*excluded filters */ haddr_t addr; /*file address of chunk */ } H5D_chunk_cached_t; @@ -536,9 +534,8 @@ typedef struct H5D_rdcc_ent_t { uint32_t rd_count; /*bytes remaining to be read */ uint32_t wr_count; /*bytes remaining to be written */ haddr_t chunk_addr; /*address of chunk in file */ + hsize_t chunk_idx; /*index of chunk in dataset */ uint8_t *chunk; /*the unfiltered chunk data */ - haddr_t proxy_addr; /*address of chunk proxy in file */ - struct H5D_chunk_proxy_t *proxy; /*pointer to chunk proxy in memory */ unsigned idx; /*index in hash table */ struct H5D_rdcc_ent_t *next;/*next item in doubly-linked list */ struct H5D_rdcc_ent_t *prev;/*previous item in doubly-linked list */ @@ -547,16 +544,6 @@ typedef struct H5D_rdcc_ent_t { } H5D_rdcc_ent_t; typedef H5D_rdcc_ent_t *H5D_rdcc_ent_ptr_t; /* For free lists */ -/* Metadata cache chunk proxy type */ -typedef struct H5D_chunk_proxy_t { - H5AC_info_t cache_info; /* Information for H5AC cache functions, _must_ be */ - /* first field in structure */ - H5D_t *dset; /* Pointer to dataset that chunk proxies are related to */ - H5D_rdcc_ent_t *ent; /* Pointer to chunk cache entry this proxy is standing in for */ - hbool_t supported; /* Whether the proxy is a flush dependency of the index */ -} H5D_chunk_proxy_t; - - /*****************************/ /* Package Private Variables */ /*****************************/ @@ -871,115 +871,6 @@ CATCH END_FUNC(PRIV) /* end H5EA_undepend() */ - -/*------------------------------------------------------------------------- - * Function: H5EA_support - * - * Purpose: Create a child flush dependency on the array metadata that - * contains the element for an array index. - * - * Return: SUCCEED/FAIL - * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * May 21 2009 - * - *------------------------------------------------------------------------- - */ -BEGIN_FUNC(PRIV, ERR, -herr_t, SUCCEED, FAIL, -H5EA_support(const H5EA_t *ea, hid_t dxpl_id, hsize_t idx, H5AC_info_t *child_entry)) - - /* Local variables */ - void *thing = NULL; /* Pointer to the array metadata containing the array index we are interested in */ - uint8_t *thing_elmt_buf; /* Pointer to the element buffer for the array metadata */ - hsize_t thing_elmt_idx; /* Index of the element in the element buffer for the array metadata */ - H5EA__unprotect_func_t thing_unprot_func; /* Function pointer for unprotecting the array metadata */ - -#ifdef QAK -HDfprintf(stderr, "%s: Called\n", FUNC); -HDfprintf(stderr, "%s: Index %Hu\n", FUNC, idx); -#endif /* QAK */ - - /* - * Check arguments. - */ - HDassert(ea); - - /* Look up the array metadata containing the element we want to set */ - if(H5EA__lookup_elmt(ea, dxpl_id, idx, H5AC_WRITE, &thing, &thing_elmt_buf, &thing_elmt_idx, &thing_unprot_func) < 0) - H5E_THROW(H5E_CANTPROTECT, "unable to protect array metadata") - - /* Sanity check */ - HDassert(thing); - HDassert(thing_elmt_buf); - HDassert(thing_unprot_func); - - /* Set up flush dependency between child_entry and metadata array 'thing' */ - if(H5EA__create_flush_depend((H5AC_info_t *)thing, child_entry) < 0) - H5E_THROW(H5E_CANTDEPEND, "unable to create flush dependency on array metadata") - -CATCH - /* Release resources */ - if(thing && (thing_unprot_func)(thing, dxpl_id, H5AC__NO_FLAGS_SET) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array metadata") - -END_FUNC(PRIV) /* end H5EA_support() */ - - -/*------------------------------------------------------------------------- - * Function: H5EA_unsupport - * - * Purpose: Remove a flush dependency on the array metadata that contains - * the element for an array index. - * - * Return: SUCCEED/FAIL - * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * May 21 2009 - * - *------------------------------------------------------------------------- - */ -BEGIN_FUNC(PRIV, ERR, -herr_t, SUCCEED, FAIL, -H5EA_unsupport(const H5EA_t *ea, hid_t dxpl_id, hsize_t idx, H5AC_info_t *child_entry)) - - /* Local variables */ - void *thing = NULL; /* Pointer to the array metadata containing the array index we are interested in */ - uint8_t *thing_elmt_buf; /* Pointer to the element buffer for the array metadata */ - hsize_t thing_elmt_idx; /* Index of the element in the element buffer for the array metadata */ - H5EA__unprotect_func_t thing_unprot_func; /* Function pointer for unprotecting the array metadata */ - -#ifdef QAK -HDfprintf(stderr, "%s: Called\n", FUNC); -HDfprintf(stderr, "%s: Index %Hu\n", FUNC, idx); -#endif /* QAK */ - - /* - * Check arguments. - */ - HDassert(ea); - - /* Look up the array metadata containing the element we want to set */ - if(H5EA__lookup_elmt(ea, dxpl_id, idx, H5AC_READ, &thing, &thing_elmt_buf, &thing_elmt_idx, &thing_unprot_func) < 0) - H5E_THROW(H5E_CANTPROTECT, "unable to protect array metadata") - - /* Sanity check */ - HDassert(thing); - HDassert(thing_elmt_buf); - HDassert(thing_unprot_func); - - /* Remove flush dependency between child_entry and metadata array 'thing' */ - if(H5EA__destroy_flush_depend((H5AC_info_t *)thing, child_entry) < 0) - H5E_THROW(H5E_CANTUNDEPEND, "unable to destroy flush dependency on array metadata") - -CATCH - /* Release resources */ - if(thing && (thing_unprot_func)(thing, dxpl_id, H5AC__NO_FLAGS_SET) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array metadata") - -END_FUNC(PRIV) /* end H5EA_unsupport() */ /*------------------------------------------------------------------------- diff --git a/src/H5EAprivate.h b/src/H5EAprivate.h index 60dbca1..b770881 100644 --- a/src/H5EAprivate.h +++ b/src/H5EAprivate.h @@ -141,10 +141,6 @@ H5_DLL herr_t H5EA_set(const H5EA_t *ea, hid_t dxpl_id, hsize_t idx, const void H5_DLL herr_t H5EA_get(const H5EA_t *ea, hid_t dxpl_id, hsize_t idx, void *elmt); H5_DLL herr_t H5EA_depend(H5AC_info_t *parent_entry, H5EA_t *ea); H5_DLL herr_t H5EA_undepend(H5AC_info_t *parent_entry, H5EA_t *ea); -H5_DLL herr_t H5EA_support(const H5EA_t *ea, hid_t dxpl_id, hsize_t idx, - H5AC_info_t *child_entry); -H5_DLL herr_t H5EA_unsupport(const H5EA_t *ea, hid_t dxpl_id, hsize_t idx, - H5AC_info_t *child_entry); H5_DLL herr_t H5EA_close(H5EA_t *ea, hid_t dxpl_id); H5_DLL herr_t H5EA_delete(H5F_t *f, hid_t dxpl_id, haddr_t ea_addr, void *ctx_udata); diff --git a/src/H5Gbtree2.c b/src/H5Gbtree2.c index 5a0fd80..a917eb4 100644 --- a/src/H5Gbtree2.c +++ b/src/H5Gbtree2.c @@ -114,8 +114,6 @@ const H5B2_class_t H5G_BT2_NAME[1]={{ /* B-tree class information */ H5G_dense_btree2_name_compare, /* Record comparison callback */ H5G_dense_btree2_name_encode, /* Record encoding callback */ H5G_dense_btree2_name_decode, /* Record decoding callback */ - NULL, /* Create flush dependency */ - NULL, /* Update flush dependency */ H5G_dense_btree2_name_debug, /* Record debugging callback */ NULL, /* Create debugging context */ NULL /* Destroy debugging context */ @@ -132,8 +130,6 @@ const H5B2_class_t H5G_BT2_CORDER[1]={{ /* B-tree class information */ H5G_dense_btree2_corder_compare, /* Record comparison callback */ H5G_dense_btree2_corder_encode, /* Record encoding callback */ H5G_dense_btree2_corder_decode, /* Record decoding callback */ - NULL, /* Create flush dependency */ - NULL, /* Update flush dependency */ H5G_dense_btree2_corder_debug, /* Record debugging callback */ NULL, /* Create debugging context */ NULL /* Destroy debugging context */ diff --git a/src/H5Gnode.c b/src/H5Gnode.c index 3226f5f..25c79c9 100644 --- a/src/H5Gnode.c +++ b/src/H5Gnode.c @@ -119,9 +119,7 @@ H5B_class_t H5B_SNODE[1] = {{ H5G_node_remove, /*remove */ H5G_node_decode_key, /*decode */ H5G_node_encode_key, /*encode */ - H5G_node_debug_key, /*debug */ - NULL, /*create_flush_dep */ - NULL, /*update_flush_dep */ + H5G_node_debug_key /*debug */ }}; /* Declare a free list to manage the H5G_node_t struct */ diff --git a/src/H5Gstab.c b/src/H5Gstab.c index 3312b84..6c7e828 100644 --- a/src/H5Gstab.c +++ b/src/H5Gstab.c @@ -152,7 +152,7 @@ H5G__stab_create_components(H5F_t *f, H5O_stab_t *stab, size_t size_hint, hid_t HDassert(size_hint > 0); /* Create the B-tree */ - if(FAIL == H5B_create(f, dxpl_id, H5B_SNODE, NULL, NULL, &(stab->btree_addr)/*out*/)) + if(FAIL == H5B_create(f, dxpl_id, H5B_SNODE, NULL, &(stab->btree_addr)/*out*/)) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create B-tree") /* Create symbol table private heap */ @@ -287,7 +287,7 @@ H5G__stab_insert_real(H5F_t *f, const H5O_stab_t *stab, const char *name, udata.crt_info = crt_info; /* Insert into symbol table */ - if(H5B_insert(f, dxpl_id, H5B_SNODE, stab->btree_addr, &udata, NULL) < 0) + if(H5B_insert(f, dxpl_id, H5B_SNODE, stab->btree_addr, &udata) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to insert entry") done: @@ -382,7 +382,7 @@ H5G__stab_remove(const H5O_loc_t *loc, hid_t dxpl_id, H5RS_str_t *grp_full_path_ udata.grp_full_path_r = grp_full_path_r; /* Remove from symbol table */ - if(H5B_remove(loc->file, dxpl_id, H5B_SNODE, stab.btree_addr, &udata, NULL) < 0) + if(H5B_remove(loc->file, dxpl_id, H5B_SNODE, stab.btree_addr, &udata) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to remove entry") done: @@ -440,7 +440,7 @@ H5G__stab_remove_by_idx(const H5O_loc_t *grp_oloc, hid_t dxpl_id, H5RS_str_t *gr udata.grp_full_path_r = grp_full_path_r; /* Remove link from symbol table */ - if(H5B_remove(grp_oloc->file, dxpl_id, H5B_SNODE, stab.btree_addr, &udata, NULL) < 0) + if(H5B_remove(grp_oloc->file, dxpl_id, H5B_SNODE, stab.btree_addr, &udata) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to remove entry") done: @@ -493,7 +493,7 @@ H5G__stab_delete(H5F_t *f, hid_t dxpl_id, const H5O_stab_t *stab) udata.common.heap = heap; /* Delete entire B-tree */ - if(H5B_delete(f, dxpl_id, H5B_SNODE, stab->btree_addr, &udata, NULL) < 0) + if(H5B_delete(f, dxpl_id, H5B_SNODE, stab->btree_addr, &udata) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete symbol table B-tree") /* Release resources */ @@ -562,7 +562,7 @@ H5G__stab_iterate(const H5O_loc_t *oloc, hid_t dxpl_id, H5_iter_order_t order, udata.op_data = op_data; /* Iterate over the group members */ - if((ret_value = H5B_iterate(oloc->file, dxpl_id, H5B_SNODE, stab.btree_addr, H5G__node_iterate, &udata, NULL)) < 0) + if((ret_value = H5B_iterate(oloc->file, dxpl_id, H5B_SNODE, stab.btree_addr, H5G__node_iterate, &udata)) < 0) HERROR(H5E_SYM, H5E_CANTNEXT, "iteration operator failed"); /* Check for too high of a starting index (ex post facto :-) */ @@ -579,7 +579,7 @@ H5G__stab_iterate(const H5O_loc_t *oloc, hid_t dxpl_id, H5_iter_order_t order, udata.ltable = <able; /* Iterate over the group members */ - if(H5B_iterate(oloc->file, dxpl_id, H5B_SNODE, stab.btree_addr, H5G__node_build_table, &udata, NULL) < 0) + if(H5B_iterate(oloc->file, dxpl_id, H5B_SNODE, stab.btree_addr, H5G__node_build_table, &udata) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to build link table") /* Check for skipping out of bounds */ @@ -638,7 +638,7 @@ H5G__stab_count(H5O_loc_t *oloc, hsize_t *num_objs, hid_t dxpl_id) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to determine local heap address") /* Iterate over the group members */ - if(H5B_iterate(oloc->file, dxpl_id, H5B_SNODE, stab.btree_addr, H5G__node_sumup, num_objs, NULL) < 0) + if(H5B_iterate(oloc->file, dxpl_id, H5B_SNODE, stab.btree_addr, H5G__node_sumup, num_objs) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "iteration operator failed") done: @@ -677,7 +677,7 @@ H5G__stab_bh_size(H5F_t *f, hid_t dxpl_id, const H5O_stab_t *stab, snode_size = 0; /* Get the B-tree & symbol table node size info */ - if(H5B_get_info(f, dxpl_id, H5B_SNODE, stab->btree_addr, &bt_info, H5G__node_iterate_size, &snode_size, NULL) < 0) + if(H5B_get_info(f, dxpl_id, H5B_SNODE, stab->btree_addr, &bt_info, H5G__node_iterate_size, &snode_size) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "iteration operator failed") /* Add symbol table & B-tree node sizes to index info */ @@ -774,7 +774,7 @@ H5G__stab_get_name_by_idx(const H5O_loc_t *oloc, H5_iter_order_t order, hsize_t hsize_t nlinks = 0; /* Number of links in group */ /* Iterate over the symbol table nodes, to count the links */ - if(H5B_iterate(oloc->file, dxpl_id, H5B_SNODE, stab.btree_addr, H5G__node_sumup, &nlinks, NULL) < 0) + if(H5B_iterate(oloc->file, dxpl_id, H5B_SNODE, stab.btree_addr, H5G__node_sumup, &nlinks) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "iteration operator failed") /* Map decreasing iteration order index to increasing iteration order index */ @@ -790,7 +790,7 @@ H5G__stab_get_name_by_idx(const H5O_loc_t *oloc, H5_iter_order_t order, hsize_t udata_valid = TRUE; /* Iterate over the group members */ - if(H5B_iterate(oloc->file, dxpl_id, H5B_SNODE, stab.btree_addr, H5G__node_by_idx, &udata, NULL) < 0) + if(H5B_iterate(oloc->file, dxpl_id, H5B_SNODE, stab.btree_addr, H5G__node_by_idx, &udata) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "iteration operator failed") /* If we don't know the name now, we almost certainly went out of bounds */ @@ -903,7 +903,7 @@ H5G__stab_lookup(const H5O_loc_t *grp_oloc, const char *name, H5O_link_t *lnk, bt_udata.op_data = &udata; /* Search the B-tree */ - if((ret_value = H5B_find(grp_oloc->file, dxpl_id, H5B_SNODE, stab.btree_addr, &bt_udata, NULL)) < 0) + if((ret_value = H5B_find(grp_oloc->file, dxpl_id, H5B_SNODE, stab.btree_addr, &bt_udata)) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "not found") done: @@ -997,7 +997,7 @@ H5G__stab_lookup_by_idx(const H5O_loc_t *grp_oloc, H5_iter_order_t order, hsize_ hsize_t nlinks = 0; /* Number of links in group */ /* Iterate over the symbol table nodes, to count the links */ - if(H5B_iterate(grp_oloc->file, dxpl_id, H5B_SNODE, stab.btree_addr, H5G__node_sumup, &nlinks, NULL) < 0) + if(H5B_iterate(grp_oloc->file, dxpl_id, H5B_SNODE, stab.btree_addr, H5G__node_sumup, &nlinks) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "iteration operator failed") /* Map decreasing iteration order index to increasing iteration order index */ @@ -1013,7 +1013,7 @@ H5G__stab_lookup_by_idx(const H5O_loc_t *grp_oloc, H5_iter_order_t order, hsize_ udata.found = FALSE; /* Iterate over the group members */ - if(H5B_iterate(grp_oloc->file, dxpl_id, H5B_SNODE, stab.btree_addr, H5G__node_by_idx, &udata, NULL) < 0) + if(H5B_iterate(grp_oloc->file, dxpl_id, H5B_SNODE, stab.btree_addr, H5G__node_by_idx, &udata) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "iteration operator failed") /* If we didn't find the link, we almost certainly went out of bounds */ @@ -1211,7 +1211,7 @@ H5G__stab_get_type_by_idx(H5O_loc_t *oloc, hsize_t idx, hid_t dxpl_id) udata.type = H5G_UNKNOWN; /* Iterate over the group members */ - if(H5B_iterate(oloc->file, dxpl_id, H5B_SNODE, stab.btree_addr, H5G__node_by_idx, &udata, NULL) < 0) + if(H5B_iterate(oloc->file, dxpl_id, H5B_SNODE, stab.btree_addr, H5G__node_by_idx, &udata) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5G_UNKNOWN, "iteration operator failed") /* If we don't know the type now, we almost certainly went out of bounds */ diff --git a/src/H5Gtest.c b/src/H5Gtest.c index ccfca9d..0bd32be 100644 --- a/src/H5Gtest.c +++ b/src/H5Gtest.c @@ -794,7 +794,7 @@ H5G__verify_cached_stabs_test(hid_t gid) /* Iterate over the b-tree, checking validity of cached information */ if((ret_value = H5B_iterate(grp->oloc.file, H5AC_ind_dxpl_id, H5B_SNODE, - stab.btree_addr, H5G_verify_cached_stabs_test_cb, &udata, NULL)) + stab.btree_addr, H5G_verify_cached_stabs_test_cb, &udata)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTNEXT, FAIL, "iteration operator failed"); diff --git a/src/H5HFbtree2.c b/src/H5HFbtree2.c index 345412f..34b74d7 100644 --- a/src/H5HFbtree2.c +++ b/src/H5HFbtree2.c @@ -122,8 +122,6 @@ const H5B2_class_t H5HF_HUGE_BT2_INDIR[1]={{ /* B-tree class information */ H5HF_huge_bt2_indir_compare, /* Record comparison callback */ H5HF_huge_bt2_indir_encode, /* Record encoding callback */ H5HF_huge_bt2_indir_decode, /* Record decoding callback */ - NULL, /* Create flush dependency */ - NULL, /* Update flush dependency */ H5HF_huge_bt2_indir_debug, /* Record debugging callback */ H5HF_huge_bt2_crt_dbg_context, /* Create debugging context */ H5HF_huge_bt2_dst_context /* Destroy debugging context */ @@ -140,8 +138,6 @@ const H5B2_class_t H5HF_HUGE_BT2_FILT_INDIR[1]={{ /* B-tree class information */ H5HF_huge_bt2_filt_indir_compare, /* Record comparison callback */ H5HF_huge_bt2_filt_indir_encode, /* Record encoding callback */ H5HF_huge_bt2_filt_indir_decode, /* Record decoding callback */ - NULL, /* Create flush dependency */ - NULL, /* Update flush dependency */ H5HF_huge_bt2_filt_indir_debug, /* Record debugging callback */ H5HF_huge_bt2_crt_dbg_context, /* Create debugging context */ H5HF_huge_bt2_dst_context /* Destroy debugging context */ @@ -158,8 +154,6 @@ const H5B2_class_t H5HF_HUGE_BT2_DIR[1]={{ /* B-tree class information */ H5HF_huge_bt2_dir_compare, /* Record comparison callback */ H5HF_huge_bt2_dir_encode, /* Record encoding callback */ H5HF_huge_bt2_dir_decode, /* Record decoding callback */ - NULL, /* Create flush dependency */ - NULL, /* Update flush dependency */ H5HF_huge_bt2_dir_debug, /* Record debugging callback */ H5HF_huge_bt2_crt_dbg_context, /* Create debugging context */ H5HF_huge_bt2_dst_context /* Destroy debugging context */ @@ -176,8 +170,6 @@ const H5B2_class_t H5HF_HUGE_BT2_FILT_DIR[1]={{ /* B-tree class information */ H5HF_huge_bt2_filt_dir_compare, /* Record comparison callback */ H5HF_huge_bt2_filt_dir_encode, /* Record encoding callback */ H5HF_huge_bt2_filt_dir_decode, /* Record decoding callback */ - NULL, /* Create flush dependency */ - NULL, /* Update flush dependency */ H5HF_huge_bt2_filt_dir_debug, /* Record debugging callback */ H5HF_huge_bt2_crt_dbg_context, /* Create debugging context */ H5HF_huge_bt2_dst_context /* Destroy debugging context */ diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h index 1a0f76c..29e813b 100644 --- a/src/H5Oprivate.h +++ b/src/H5Oprivate.h @@ -423,6 +423,7 @@ typedef struct H5O_storage_chunk_btree_t { struct H5FA_t; /* Defined in H5FAprivate.h */ typedef struct H5O_storage_chunk_farray_t { + haddr_t dset_ohdr_addr; /* File address dataset's object header */ struct H5FA_t *fa; /* Pointer to fixed index array struct */ } H5O_storage_chunk_farray_t; diff --git a/src/H5Ostab.c b/src/H5Ostab.c index 264e3a1..f7c77bc 100644 --- a/src/H5Ostab.c +++ b/src/H5Ostab.c @@ -401,7 +401,7 @@ H5O_stab_post_copy_file(const H5O_loc_t *src_oloc, const void *mesg_src, udata.cpy_info = cpy_info; /* Iterate over objects in group, copying them */ - if((H5B_iterate(src_oloc->file, dxpl_id, H5B_SNODE, stab_src->btree_addr, H5G__node_copy, &udata, NULL)) < 0) + if((H5B_iterate(src_oloc->file, dxpl_id, H5B_SNODE, stab_src->btree_addr, H5G__node_copy, &udata)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "iteration operator failed") done: diff --git a/src/H5SMbtree2.c b/src/H5SMbtree2.c index 62b45f0..daa1e4f 100644 --- a/src/H5SMbtree2.c +++ b/src/H5SMbtree2.c @@ -67,8 +67,6 @@ const H5B2_class_t H5SM_INDEX[1]={{ /* B-tree class information */ H5SM_message_compare, /* Record comparison callback */ H5SM_message_encode, /* Record encoding callback */ H5SM_message_decode, /* Record decoding callback */ - NULL, /* Create flush dependency */ - NULL, /* Update flush dependency */ H5SM_bt2_debug, /* Record debugging callback */ H5SM_bt2_crt_dbg_context, /* Create debugging context */ H5SM_bt2_dst_context /* Destroy debugging context */ diff --git a/src/Makefile.am b/src/Makefile.am index 2325951..7cfb5b7 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -47,7 +47,7 @@ libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \ H5C.c H5CS.c \ H5D.c H5Dbtree.c H5Dbtree2.c H5Dchunk.c H5Dcompact.c H5Dcontig.c H5Ddbg.c \ H5Ddeprec.c H5Dearray.c H5Defl.c H5Dfarray.c H5Dfill.c H5Dint.c \ - H5Dio.c H5Dlayout.c H5Dmpio.c H5Dnone.c H5Doh.c H5Dproxy.c H5Dscatgath.c \ + H5Dio.c H5Dlayout.c H5Dmpio.c H5Dnone.c H5Doh.c H5Dscatgath.c \ H5Dselect.c H5Dtest.c \ H5E.c H5Edeprec.c H5Eint.c \ H5EA.c H5EAcache.c H5EAdbg.c H5EAdblkpage.c H5EAdblock.c H5EAhdr.c \ diff --git a/src/Makefile.in b/src/Makefile.in index 217d417..f008e2c 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -155,53 +155,53 @@ am_libhdf5_la_OBJECTS = H5.lo H5checksum.lo H5dbg.lo H5system.lo \ H5Dbtree.lo H5Dbtree2.lo H5Dchunk.lo H5Dcompact.lo \ H5Dcontig.lo H5Ddbg.lo H5Ddeprec.lo H5Dearray.lo H5Defl.lo \ H5Dfarray.lo H5Dfill.lo H5Dint.lo H5Dio.lo H5Dlayout.lo \ - H5Dmpio.lo H5Dnone.lo H5Doh.lo H5Dproxy.lo H5Dscatgath.lo \ - H5Dselect.lo H5Dtest.lo H5E.lo H5Edeprec.lo H5Eint.lo H5EA.lo \ - H5EAcache.lo H5EAdbg.lo H5EAdblkpage.lo H5EAdblock.lo \ - H5EAhdr.lo H5EAiblock.lo H5EAint.lo H5EAsblock.lo H5EAstat.lo \ - H5EAtest.lo H5F.lo H5Faccum.lo H5Fcwfs.lo H5Fdbg.lo \ - H5Fdeprec.lo H5Fefc.lo H5Ffake.lo H5Fio.lo H5Fmount.lo \ - H5Fmpi.lo H5Fquery.lo H5Fsfile.lo H5Fsuper.lo \ - H5Fsuper_cache.lo H5Ftest.lo H5FA.lo H5FAcache.lo H5FAdbg.lo \ - H5FAdblock.lo H5FAdblkpage.lo H5FAhdr.lo H5FAint.lo \ - H5FAstat.lo H5FAtest.lo H5FD.lo H5FDcore.lo H5FDdirect.lo \ - H5FDfamily.lo H5FDint.lo H5FDlog.lo H5FDmpi.lo H5FDmpio.lo \ - H5FDmulti.lo H5FDsec2.lo H5FDspace.lo H5FDstdio.lo H5FL.lo \ - H5FO.lo H5FS.lo H5FScache.lo H5FSdbg.lo H5FSint.lo \ - H5FSsection.lo H5FSstat.lo H5FStest.lo H5G.lo H5Gbtree2.lo \ - H5Gcache.lo H5Gcompact.lo H5Gdense.lo H5Gdeprec.lo H5Gent.lo \ - H5Gint.lo H5Glink.lo H5Gloc.lo H5Gname.lo H5Gnode.lo H5Gobj.lo \ - H5Goh.lo H5Groot.lo H5Gstab.lo H5Gtest.lo H5Gtraverse.lo \ - H5HF.lo H5HFbtree2.lo H5HFcache.lo H5HFdbg.lo H5HFdblock.lo \ - H5HFdtable.lo H5HFhdr.lo H5HFhuge.lo H5HFiblock.lo H5HFint.lo \ - H5HFiter.lo H5HFman.lo H5HFsection.lo H5HFspace.lo H5HFstat.lo \ - H5HFtest.lo H5HFtiny.lo H5HG.lo H5HGcache.lo H5HGdbg.lo \ - H5HGquery.lo H5HL.lo H5HLcache.lo H5HLdbg.lo H5HLint.lo \ - H5HLprfx.lo H5HLdblk.lo H5HP.lo H5I.lo H5Itest.lo H5L.lo \ - H5Lexternal.lo H5lib_settings.lo H5MF.lo H5MFaggr.lo \ - H5MFdbg.lo H5MFsection.lo H5MM.lo H5MP.lo H5MPtest.lo H5O.lo \ - H5Oainfo.lo H5Oalloc.lo H5Oattr.lo H5Oattribute.lo H5Obogus.lo \ - H5Obtreek.lo H5Ocache.lo H5Ochunk.lo H5Ocont.lo H5Ocopy.lo \ - H5Odbg.lo H5Odrvinfo.lo H5Odtype.lo H5Oefl.lo H5Ofill.lo \ - H5Oflush.lo H5Ofsinfo.lo H5Oginfo.lo H5Olayout.lo H5Olinfo.lo \ - H5Olink.lo H5Omessage.lo H5Omtime.lo H5Oname.lo H5Onull.lo \ - H5Opline.lo H5Oproxy.lo H5Orefcount.lo H5Osdspace.lo \ - H5Oshared.lo H5Oshmesg.lo H5Ostab.lo H5Ostorage.lo H5Otest.lo \ - H5Ounknown.lo H5P.lo H5Pacpl.lo H5Pdapl.lo H5Pdcpl.lo \ - H5Pdeprec.lo H5Pdxpl.lo H5Pencdec.lo H5Pfapl.lo H5Pfcpl.lo \ - H5Pfmpl.lo H5Pgcpl.lo H5Pint.lo H5Plapl.lo H5Plcpl.lo \ - H5Pocpl.lo H5Pocpypl.lo H5Pstrcpl.lo H5Ptest.lo H5PL.lo H5R.lo \ - H5Rdeprec.lo H5UC.lo H5RS.lo H5S.lo H5Sall.lo H5Sdbg.lo \ - H5Shyper.lo H5Smpio.lo H5Snone.lo H5Spoint.lo H5Sselect.lo \ - H5Stest.lo H5SL.lo H5SM.lo H5SMbtree2.lo H5SMcache.lo \ - H5SMmessage.lo H5SMtest.lo H5ST.lo H5T.lo H5Tarray.lo \ - H5Tbit.lo H5Tcommit.lo H5Tcompound.lo H5Tconv.lo H5Tcset.lo \ - H5Tdbg.lo H5Tdeprec.lo H5Tenum.lo H5Tfields.lo H5Tfixed.lo \ - H5Tfloat.lo H5Tinit.lo H5Tnative.lo H5Toffset.lo H5Toh.lo \ - H5Topaque.lo H5Torder.lo H5Tpad.lo H5Tprecis.lo H5Tstrpad.lo \ - H5Tvisit.lo H5Tvlen.lo H5TS.lo H5VM.lo H5WB.lo H5Z.lo \ - H5Zdeflate.lo H5Zfletcher32.lo H5Znbit.lo H5Zshuffle.lo \ - H5Zszip.lo H5Zscaleoffset.lo H5Ztrans.lo + H5Dmpio.lo H5Dnone.lo H5Doh.lo H5Dscatgath.lo H5Dselect.lo \ + H5Dtest.lo H5E.lo H5Edeprec.lo H5Eint.lo H5EA.lo H5EAcache.lo \ + H5EAdbg.lo H5EAdblkpage.lo H5EAdblock.lo H5EAhdr.lo \ + H5EAiblock.lo H5EAint.lo H5EAsblock.lo H5EAstat.lo H5EAtest.lo \ + H5F.lo H5Faccum.lo H5Fcwfs.lo H5Fdbg.lo H5Fdeprec.lo H5Fefc.lo \ + H5Ffake.lo H5Fio.lo H5Fmount.lo H5Fmpi.lo H5Fquery.lo \ + H5Fsfile.lo H5Fsuper.lo H5Fsuper_cache.lo H5Ftest.lo H5FA.lo \ + H5FAcache.lo H5FAdbg.lo H5FAdblock.lo H5FAdblkpage.lo \ + H5FAhdr.lo H5FAint.lo H5FAstat.lo H5FAtest.lo H5FD.lo \ + H5FDcore.lo H5FDdirect.lo H5FDfamily.lo H5FDint.lo H5FDlog.lo \ + H5FDmpi.lo H5FDmpio.lo H5FDmulti.lo H5FDsec2.lo H5FDspace.lo \ + H5FDstdio.lo H5FL.lo H5FO.lo H5FS.lo H5FScache.lo H5FSdbg.lo \ + H5FSint.lo H5FSsection.lo H5FSstat.lo H5FStest.lo H5G.lo \ + H5Gbtree2.lo H5Gcache.lo H5Gcompact.lo H5Gdense.lo \ + H5Gdeprec.lo H5Gent.lo H5Gint.lo H5Glink.lo H5Gloc.lo \ + H5Gname.lo H5Gnode.lo H5Gobj.lo H5Goh.lo H5Groot.lo H5Gstab.lo \ + H5Gtest.lo H5Gtraverse.lo H5HF.lo H5HFbtree2.lo H5HFcache.lo \ + H5HFdbg.lo H5HFdblock.lo H5HFdtable.lo H5HFhdr.lo H5HFhuge.lo \ + H5HFiblock.lo H5HFint.lo H5HFiter.lo H5HFman.lo H5HFsection.lo \ + H5HFspace.lo H5HFstat.lo H5HFtest.lo H5HFtiny.lo H5HG.lo \ + H5HGcache.lo H5HGdbg.lo H5HGquery.lo H5HL.lo H5HLcache.lo \ + H5HLdbg.lo H5HLint.lo H5HLprfx.lo H5HLdblk.lo H5HP.lo H5I.lo \ + H5Itest.lo H5L.lo H5Lexternal.lo H5lib_settings.lo H5MF.lo \ + H5MFaggr.lo H5MFdbg.lo H5MFsection.lo H5MM.lo H5MP.lo \ + H5MPtest.lo H5O.lo H5Oainfo.lo H5Oalloc.lo H5Oattr.lo \ + H5Oattribute.lo H5Obogus.lo H5Obtreek.lo H5Ocache.lo \ + H5Ochunk.lo H5Ocont.lo H5Ocopy.lo H5Odbg.lo H5Odrvinfo.lo \ + H5Odtype.lo H5Oefl.lo H5Ofill.lo H5Oflush.lo H5Ofsinfo.lo \ + H5Oginfo.lo H5Olayout.lo H5Olinfo.lo H5Olink.lo H5Omessage.lo \ + H5Omtime.lo H5Oname.lo H5Onull.lo H5Opline.lo H5Oproxy.lo \ + H5Orefcount.lo H5Osdspace.lo H5Oshared.lo H5Oshmesg.lo \ + H5Ostab.lo H5Ostorage.lo H5Otest.lo H5Ounknown.lo H5P.lo \ + H5Pacpl.lo H5Pdapl.lo H5Pdcpl.lo H5Pdeprec.lo H5Pdxpl.lo \ + H5Pencdec.lo H5Pfapl.lo H5Pfcpl.lo H5Pfmpl.lo H5Pgcpl.lo \ + H5Pint.lo H5Plapl.lo H5Plcpl.lo H5Pocpl.lo H5Pocpypl.lo \ + H5Pstrcpl.lo H5Ptest.lo H5PL.lo H5R.lo H5Rdeprec.lo H5UC.lo \ + H5RS.lo H5S.lo H5Sall.lo H5Sdbg.lo H5Shyper.lo H5Smpio.lo \ + H5Snone.lo H5Spoint.lo H5Sselect.lo H5Stest.lo H5SL.lo H5SM.lo \ + H5SMbtree2.lo H5SMcache.lo H5SMmessage.lo H5SMtest.lo H5ST.lo \ + H5T.lo H5Tarray.lo H5Tbit.lo H5Tcommit.lo H5Tcompound.lo \ + H5Tconv.lo H5Tcset.lo H5Tdbg.lo H5Tdeprec.lo H5Tenum.lo \ + H5Tfields.lo H5Tfixed.lo H5Tfloat.lo H5Tinit.lo H5Tnative.lo \ + H5Toffset.lo H5Toh.lo H5Topaque.lo H5Torder.lo H5Tpad.lo \ + H5Tprecis.lo H5Tstrpad.lo H5Tvisit.lo H5Tvlen.lo H5TS.lo \ + H5VM.lo H5WB.lo H5Z.lo H5Zdeflate.lo H5Zfletcher32.lo \ + H5Znbit.lo H5Zshuffle.lo H5Zszip.lo H5Zscaleoffset.lo \ + H5Ztrans.lo libhdf5_la_OBJECTS = $(am_libhdf5_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) @@ -757,7 +757,7 @@ libhdf5_la_SOURCES = H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \ H5C.c H5CS.c \ H5D.c H5Dbtree.c H5Dbtree2.c H5Dchunk.c H5Dcompact.c H5Dcontig.c H5Ddbg.c \ H5Ddeprec.c H5Dearray.c H5Defl.c H5Dfarray.c H5Dfill.c H5Dint.c \ - H5Dio.c H5Dlayout.c H5Dmpio.c H5Dnone.c H5Doh.c H5Dproxy.c H5Dscatgath.c \ + H5Dio.c H5Dlayout.c H5Dmpio.c H5Dnone.c H5Doh.c H5Dscatgath.c \ H5Dselect.c H5Dtest.c \ H5E.c H5Edeprec.c H5Eint.c \ H5EA.c H5EAcache.c H5EAdbg.c H5EAdblkpage.c H5EAdblock.c H5EAhdr.c \ @@ -1014,7 +1014,6 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Dmpio.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Dnone.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Doh.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Dproxy.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Dscatgath.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Dselect.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Dtest.Plo@am__quote@ |