summaryrefslogtreecommitdiffstats
path: root/src/H5B2internal.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/H5B2internal.c')
-rw-r--r--src/H5B2internal.c172
1 files changed, 79 insertions, 93 deletions
diff --git a/src/H5B2internal.c b/src/H5B2internal.c
index 1716c44..95ed769 100644
--- a/src/H5B2internal.c
+++ b/src/H5B2internal.c
@@ -56,8 +56,7 @@
/********************/
/* Local Prototypes */
/********************/
-static herr_t H5B2__shadow_internal(H5B2_internal_t *internal, hid_t dxpl_id,
- H5B2_node_ptr_t *curr_node_ptr);
+static herr_t H5B2__shadow_internal(H5B2_internal_t *internal, H5B2_node_ptr_t *curr_node_ptr);
/*********************/
@@ -94,8 +93,8 @@ H5FL_DEFINE(H5B2_internal_t);
*-------------------------------------------------------------------------
*/
herr_t
-H5B2__create_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, void *parent,
- H5B2_node_ptr_t *node_ptr, uint16_t depth)
+H5B2__create_internal(H5B2_hdr_t *hdr, void *parent, H5B2_node_ptr_t *node_ptr,
+ uint16_t depth)
{
H5B2_internal_t *internal = NULL; /* Pointer to new internal node created */
hbool_t inserted = FALSE; /* Whether the internal node was inserted into cache */
@@ -139,17 +138,17 @@ H5B2__create_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, void *parent,
internal->shadow_epoch = hdr->shadow_epoch;
/* Allocate space on disk for the internal node */
- if(HADDR_UNDEF == (node_ptr->addr = H5MF_alloc(hdr->f, H5FD_MEM_BTREE, dxpl_id, (hsize_t)hdr->node_size)))
+ if(HADDR_UNDEF == (node_ptr->addr = H5MF_alloc(hdr->f, H5FD_MEM_BTREE, (hsize_t)hdr->node_size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "file allocation failed for B-tree internal node")
/* Cache the new B-tree node */
- if(H5AC_insert_entry(hdr->f, dxpl_id, H5AC_BT2_INT, node_ptr->addr, internal, H5AC__NO_FLAGS_SET) < 0)
+ if(H5AC_insert_entry(hdr->f, H5AC_BT2_INT, node_ptr->addr, internal, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "can't add B-tree internal node to cache")
inserted = TRUE;
/* Add internal node as child of 'top' proxy */
if(hdr->top_proxy) {
- if(H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, dxpl_id, internal) < 0)
+ if(H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, internal) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTSET, FAIL, "unable to add v2 B-tree node as child of proxy")
internal->top_proxy = hdr->top_proxy;
} /* end if */
@@ -163,7 +162,7 @@ done:
HDONE_ERROR(H5E_BTREE, H5E_CANTREMOVE, FAIL, "unable to remove v2 B-tree internal node from cache")
/* Release internal node's disk space */
- if(H5F_addr_defined(node_ptr->addr) && H5MF_xfree(hdr->f, H5FD_MEM_BTREE, dxpl_id, node_ptr->addr, (hsize_t)hdr->node_size) < 0)
+ if(H5F_addr_defined(node_ptr->addr) && H5MF_xfree(hdr->f, H5FD_MEM_BTREE, node_ptr->addr, (hsize_t)hdr->node_size) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, "unable to release file space for v2 B-tree internal node")
/* Destroy internal node */
@@ -190,8 +189,8 @@ done:
*-------------------------------------------------------------------------
*/
H5B2_internal_t *
-H5B2__protect_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, void *parent,
- H5B2_node_ptr_t *node_ptr, uint16_t depth, hbool_t shadow, unsigned flags)
+H5B2__protect_internal(H5B2_hdr_t *hdr, void *parent, H5B2_node_ptr_t *node_ptr,
+ uint16_t depth, hbool_t shadow, unsigned flags)
{
H5B2_internal_cache_ud_t udata; /* User data to pass through to cache 'deserialize' callback */
H5B2_internal_t *internal = NULL; /* v2 B-tree internal node */
@@ -216,20 +215,20 @@ H5B2__protect_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, void *parent,
udata.depth = depth;
/* Protect the internal node */
- if(NULL == (internal = (H5B2_internal_t *)H5AC_protect(hdr->f, dxpl_id, H5AC_BT2_INT, node_ptr->addr, &udata, flags)))
+ if(NULL == (internal = (H5B2_internal_t *)H5AC_protect(hdr->f, H5AC_BT2_INT, node_ptr->addr, &udata, flags)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, NULL, "unable to protect B-tree internal node")
/* Create top proxy, if it doesn't exist */
if(hdr->top_proxy && NULL == internal->top_proxy) {
/* Add internal node as child of 'top' proxy */
- if(H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, dxpl_id, internal) < 0)
+ if(H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, internal) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTSET, NULL, "unable to add v2 B-tree internal node as child of proxy")
internal->top_proxy = hdr->top_proxy;
} /* end if */
/* Shadow the node, if requested */
if(shadow)
- if(H5B2__shadow_internal(internal, dxpl_id, node_ptr) < 0)
+ if(H5B2__shadow_internal(internal, node_ptr) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTCOPY, NULL, "unable to shadow internal node")
/* Set return value */
@@ -248,7 +247,7 @@ done:
} /* end if */
/* Unprotect internal node */
- if(H5AC_unprotect(hdr->f, dxpl_id, H5AC_BT2_INT, node_ptr->addr, internal, H5AC__NO_FLAGS_SET) < 0)
+ if(H5AC_unprotect(hdr->f, H5AC_BT2_INT, node_ptr->addr, internal, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, NULL, "unable to unprotect v2 B-tree internal node, address = %llu", (unsigned long long)node_ptr->addr)
} /* end if */
} /* end if */
@@ -284,9 +283,9 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5B2__neighbor_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, uint16_t depth,
- H5B2_node_ptr_t *curr_node_ptr, void *neighbor_loc, H5B2_compare_t comp,
- void *parent, void *udata, H5B2_found_t op, void *op_data)
+H5B2__neighbor_internal(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node_ptr,
+ void *neighbor_loc, H5B2_compare_t comp, void *parent, void *udata,
+ H5B2_found_t op, void *op_data)
{
H5B2_internal_t *internal; /* Pointer to internal node */
unsigned idx = 0; /* Location of record which matches key */
@@ -303,7 +302,7 @@ H5B2__neighbor_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, uint16_t depth,
HDassert(op);
/* Lock current B-tree node */
- if(NULL == (internal = H5B2__protect_internal(hdr, dxpl_id, parent, curr_node_ptr, depth, FALSE, H5AC__READ_ONLY_FLAG)))
+ if(NULL == (internal = H5B2__protect_internal(hdr, parent, curr_node_ptr, depth, FALSE, H5AC__READ_ONLY_FLAG)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node")
/* Locate node pointer for child */
@@ -326,17 +325,17 @@ H5B2__neighbor_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, uint16_t depth,
/* Attempt to find neighboring record */
if(depth > 1) {
- if(H5B2__neighbor_internal(hdr, dxpl_id, (uint16_t)(depth - 1), &internal->node_ptrs[idx], neighbor_loc, comp, internal, udata, op, op_data) < 0)
+ if(H5B2__neighbor_internal(hdr, (uint16_t)(depth - 1), &internal->node_ptrs[idx], neighbor_loc, comp, internal, udata, op, op_data) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "unable to find neighbor record in B-tree internal node")
} /* end if */
else {
- if(H5B2__neighbor_leaf(hdr, dxpl_id, &internal->node_ptrs[idx], neighbor_loc, comp, internal, udata, op, op_data) < 0)
+ if(H5B2__neighbor_leaf(hdr, &internal->node_ptrs[idx], neighbor_loc, comp, internal, udata, op, op_data) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "unable to find neighbor record in B-tree leaf node")
} /* end else */
done:
/* Release the B-tree internal node */
- if(internal && H5AC_unprotect(hdr->f, dxpl_id, H5AC_BT2_INT, curr_node_ptr->addr, internal, H5AC__NO_FLAGS_SET) < 0)
+ if(internal && H5AC_unprotect(hdr->f, H5AC_BT2_INT, curr_node_ptr->addr, internal, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release internal B-tree node")
FUNC_LEAVE_NOAPI(ret_value)
@@ -357,9 +356,9 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5B2__insert_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, uint16_t depth,
- unsigned *parent_cache_info_flags_ptr, H5B2_node_ptr_t *curr_node_ptr,
- H5B2_nodepos_t curr_pos, void *parent, void *udata)
+H5B2__insert_internal(H5B2_hdr_t *hdr, uint16_t depth, unsigned *parent_cache_info_flags_ptr,
+ H5B2_node_ptr_t *curr_node_ptr, H5B2_nodepos_t curr_pos, void *parent,
+ void *udata)
{
H5B2_internal_t *internal = NULL; /* Pointer to internal node */
unsigned internal_flags = H5AC__NO_FLAGS_SET;
@@ -376,7 +375,7 @@ H5B2__insert_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, uint16_t depth,
HDassert(H5F_addr_defined(curr_node_ptr->addr));
/* Lock current B-tree node */
- if(NULL == (internal = H5B2__protect_internal(hdr, dxpl_id, parent, curr_node_ptr, depth, FALSE, H5AC__NO_FLAGS_SET)))
+ if(NULL == (internal = H5B2__protect_internal(hdr, parent, curr_node_ptr, depth, FALSE, H5AC__NO_FLAGS_SET)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node")
/* Sanity check number of records */
@@ -413,35 +412,32 @@ H5B2__insert_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, uint16_t depth,
/* Attempt to redistribute records among children */
if(idx == 0) { /* Left-most child */
if(retries > 0 && (internal->node_ptrs[idx + 1].node_nrec < split_nrec)) {
- if(H5B2__redistribute2(hdr, dxpl_id, depth, internal, idx) < 0)
+ if(H5B2__redistribute2(hdr, depth, internal, idx) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTREDISTRIBUTE, FAIL, "unable to redistribute child node records")
} /* end if */
else {
- if(H5B2__split1(hdr, dxpl_id, depth, curr_node_ptr,
- parent_cache_info_flags_ptr, internal, &internal_flags, idx) < 0)
+ if(H5B2__split1(hdr, depth, curr_node_ptr, parent_cache_info_flags_ptr, internal, &internal_flags, idx) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to split child node")
} /* end else */
} /* end if */
else if(idx == internal->nrec) { /* Right-most child */
if(retries > 0 && (internal->node_ptrs[idx - 1].node_nrec < split_nrec)) {
- if(H5B2__redistribute2(hdr, dxpl_id, depth, internal, (idx - 1)) < 0)
+ if(H5B2__redistribute2(hdr, depth, internal, (idx - 1)) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTREDISTRIBUTE, FAIL, "unable to redistribute child node records")
} /* end if */
else {
- if(H5B2__split1(hdr, dxpl_id, depth, curr_node_ptr,
- parent_cache_info_flags_ptr, internal, &internal_flags, idx) < 0)
+ if(H5B2__split1(hdr, depth, curr_node_ptr, parent_cache_info_flags_ptr, internal, &internal_flags, idx) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to split child node")
} /* end else */
} /* end if */
else { /* Middle child */
if(retries > 0 && ((internal->node_ptrs[idx + 1].node_nrec < split_nrec) ||
(internal->node_ptrs[idx - 1].node_nrec < split_nrec))) {
- if(H5B2__redistribute3(hdr, dxpl_id, depth, internal, &internal_flags, idx) < 0)
+ if(H5B2__redistribute3(hdr, depth, internal, &internal_flags, idx) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTREDISTRIBUTE, FAIL, "unable to redistribute child node records")
} /* end if */
else {
- if(H5B2__split1(hdr, dxpl_id, depth, curr_node_ptr,
- parent_cache_info_flags_ptr, internal, &internal_flags, idx) < 0)
+ if(H5B2__split1(hdr, depth, curr_node_ptr, parent_cache_info_flags_ptr, internal, &internal_flags, idx) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to split child node")
} /* end else */
} /* end else */
@@ -475,11 +471,11 @@ H5B2__insert_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, uint16_t depth,
/* Attempt to insert node */
if(depth > 1) {
- if(H5B2__insert_internal(hdr, dxpl_id, (uint16_t)(depth - 1), &internal_flags, &internal->node_ptrs[idx], next_pos, internal, udata) < 0)
+ if(H5B2__insert_internal(hdr, (uint16_t)(depth - 1), &internal_flags, &internal->node_ptrs[idx], next_pos, internal, udata) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, FAIL, "unable to insert record into B-tree internal node")
} /* end if */
else {
- if(H5B2__insert_leaf(hdr, dxpl_id, &internal->node_ptrs[idx], next_pos, internal, udata) < 0)
+ if(H5B2__insert_leaf(hdr, &internal->node_ptrs[idx], next_pos, internal, udata) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, FAIL, "unable to insert record into B-tree leaf node")
} /* end else */
@@ -494,11 +490,11 @@ done:
if(internal) {
/* Shadow the node if doing SWMR writes */
if(hdr->swmr_write && (internal_flags & H5AC__DIRTIED_FLAG))
- if(H5B2__shadow_internal(internal, dxpl_id, curr_node_ptr) < 0)
+ if(H5B2__shadow_internal(internal, curr_node_ptr) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTCOPY, FAIL, "unable to shadow internal B-tree node")
/* Unprotect node */
- if(H5AC_unprotect(hdr->f, dxpl_id, H5AC_BT2_INT, curr_node_ptr->addr, internal, internal_flags) < 0)
+ if(H5AC_unprotect(hdr->f, H5AC_BT2_INT, curr_node_ptr->addr, internal, internal_flags) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release internal B-tree node")
} /* end if */
@@ -523,7 +519,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5B2__update_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, uint16_t depth,
+H5B2__update_internal(H5B2_hdr_t *hdr, uint16_t depth,
unsigned *parent_cache_info_flags_ptr, H5B2_node_ptr_t *curr_node_ptr,
H5B2_update_status_t *status, H5B2_nodepos_t curr_pos, void *parent,
void *udata, H5B2_modify_t op, void *op_data)
@@ -544,7 +540,7 @@ H5B2__update_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, uint16_t depth,
HDassert(H5F_addr_defined(curr_node_ptr->addr));
/* Lock current B-tree node */
- if(NULL == (internal = H5B2__protect_internal(hdr, dxpl_id, parent, curr_node_ptr, depth, FALSE, H5AC__NO_FLAGS_SET)))
+ if(NULL == (internal = H5B2__protect_internal(hdr, parent, curr_node_ptr, depth, FALSE, H5AC__NO_FLAGS_SET)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node")
/* Sanity check number of records */
@@ -591,11 +587,11 @@ H5B2__update_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, uint16_t depth,
/* Attempt to update record in child */
if(depth > 1) {
- if(H5B2__update_internal(hdr, dxpl_id, (uint16_t)(depth - 1), &internal_flags, &internal->node_ptrs[idx], status, next_pos, internal, udata, op, op_data) < 0)
+ if(H5B2__update_internal(hdr, (uint16_t)(depth - 1), &internal_flags, &internal->node_ptrs[idx], status, next_pos, internal, udata, op, op_data) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUPDATE, FAIL, "unable to update record in internal B-tree node")
} /* end if */
else {
- if(H5B2__update_leaf(hdr, dxpl_id, &internal->node_ptrs[idx], status, next_pos, internal, udata, op, op_data) < 0)
+ if(H5B2__update_leaf(hdr, &internal->node_ptrs[idx], status, next_pos, internal, udata, op, op_data) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUPDATE, FAIL, "unable to update record in leaf B-tree node")
} /* end else */
@@ -656,7 +652,7 @@ H5B2__update_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, uint16_t depth,
*/
if(could_split) {
/* Release the internal B-tree node */
- if(H5AC_unprotect(hdr->f, dxpl_id, H5AC_BT2_INT, curr_node_ptr->addr, internal, internal_flags) < 0)
+ if(H5AC_unprotect(hdr->f, H5AC_BT2_INT, curr_node_ptr->addr, internal, internal_flags) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release internal B-tree node")
internal = NULL;
@@ -666,7 +662,7 @@ H5B2__update_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, uint16_t depth,
} /* end if */
/* Release the internal B-tree node */
- if(H5AC_unprotect(hdr->f, dxpl_id, H5AC_BT2_INT, curr_node_ptr->addr, internal, internal_flags) < 0)
+ if(H5AC_unprotect(hdr->f, H5AC_BT2_INT, curr_node_ptr->addr, internal, internal_flags) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release internal B-tree node")
internal = NULL;
@@ -674,7 +670,7 @@ H5B2__update_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, uint16_t depth,
*status = H5B2_UPDATE_INSERT_DONE;
/* Dodge sideways into inserting a record into this node */
- if(H5B2__insert_internal(hdr, dxpl_id, depth, parent_cache_info_flags_ptr, curr_node_ptr, curr_pos, parent, udata) < 0)
+ if(H5B2__insert_internal(hdr, depth, parent_cache_info_flags_ptr, curr_node_ptr, curr_pos, parent, udata) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, FAIL, "unable to insert record into internal B-tree node")
break;
@@ -691,7 +687,7 @@ done:
/* Check if we should shadow this node */
if(hdr->swmr_write && (internal_flags & H5AC__DIRTIED_FLAG)) {
/* Attempt to shadow the node if doing SWMR writes */
- if(H5B2__shadow_internal(internal, dxpl_id, curr_node_ptr) < 0)
+ if(H5B2__shadow_internal(internal, curr_node_ptr) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTCOPY, FAIL, "unable to shadow internal B-tree node")
/* Change the state to "shadowed" if only modified currently */
@@ -701,7 +697,7 @@ done:
} /* end if */
/* Unprotect node */
- if(H5AC_unprotect(hdr->f, dxpl_id, H5AC_BT2_INT, curr_node_ptr->addr, internal, internal_flags) < 0)
+ if(H5AC_unprotect(hdr->f, H5AC_BT2_INT, curr_node_ptr->addr, internal, internal_flags) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release internal B-tree node")
} /* end if */
@@ -726,8 +722,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5B2__shadow_internal(H5B2_internal_t *internal, hid_t dxpl_id,
- H5B2_node_ptr_t *curr_node_ptr)
+H5B2__shadow_internal(H5B2_internal_t *internal, H5B2_node_ptr_t *curr_node_ptr)
{
H5B2_hdr_t *hdr; /* B-tree header */
herr_t ret_value = SUCCEED; /* Return value */
@@ -758,11 +753,11 @@ H5B2__shadow_internal(H5B2_internal_t *internal, hid_t dxpl_id,
* shadowed node. Remove it from cache but do not mark it free on disk.
*/
/* Allocate space for the cloned node */
- if(HADDR_UNDEF == (new_node_addr = H5MF_alloc(hdr->f, H5FD_MEM_BTREE, dxpl_id, (hsize_t)hdr->node_size)))
+ if(HADDR_UNDEF == (new_node_addr = H5MF_alloc(hdr->f, H5FD_MEM_BTREE, (hsize_t)hdr->node_size)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "unable to allocate file space to move B-tree node")
/* Move the location of the node on the disk */
- if(H5AC_move_entry(hdr->f, H5AC_BT2_INT, curr_node_ptr->addr, new_node_addr, dxpl_id) < 0)
+ if(H5AC_move_entry(hdr->f, H5AC_BT2_INT, curr_node_ptr->addr, new_node_addr) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTMOVE, FAIL, "unable to move B-tree node")
curr_node_ptr->addr = new_node_addr;
@@ -793,7 +788,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5B2__remove_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, hbool_t *depth_decreased,
+H5B2__remove_internal(H5B2_hdr_t *hdr, hbool_t *depth_decreased,
void *swap_loc, void *swap_parent, uint16_t depth, H5AC_info_t *parent_cache_info,
unsigned *parent_cache_info_flags_ptr, H5B2_nodepos_t curr_pos,
H5B2_node_ptr_t *curr_node_ptr, void *udata, H5B2_remove_t op, void *op_data)
@@ -819,7 +814,7 @@ H5B2__remove_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, hbool_t *depth_decreased,
HDassert(H5F_addr_defined(curr_node_ptr->addr));
/* Lock current B-tree node */
- if(NULL == (internal = H5B2__protect_internal(hdr, dxpl_id, parent_cache_info, curr_node_ptr, depth, FALSE, H5AC__NO_FLAGS_SET)))
+ if(NULL == (internal = H5B2__protect_internal(hdr, parent_cache_info, curr_node_ptr, depth, FALSE, H5AC__NO_FLAGS_SET)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node")
internal_addr = curr_node_ptr->addr;
@@ -832,8 +827,7 @@ H5B2__remove_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, hbool_t *depth_decreased,
((internal->node_ptrs[0].node_nrec + internal->node_ptrs[1].node_nrec) <= ((merge_nrec * 2) + 1))) {
/* Merge children of root node */
- if(H5B2__merge2(hdr, dxpl_id, depth, curr_node_ptr,
- parent_cache_info_flags_ptr, internal, &internal_flags, 0) < 0)
+ if(H5B2__merge2(hdr, depth, curr_node_ptr, parent_cache_info_flags_ptr, internal, &internal_flags, 0) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to merge child node")
/* Let the cache know that the object is deleted */
@@ -847,7 +841,7 @@ H5B2__remove_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, hbool_t *depth_decreased,
/* Update flush dependency for child, if using SWMR */
if(hdr->swmr_write)
- if(H5B2__update_flush_depend(hdr, dxpl_id, depth, curr_node_ptr, internal, hdr) < 0)
+ if(H5B2__update_flush_depend(hdr, depth, curr_node_ptr, internal, hdr) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUPDATE, FAIL, "unable to update child node to new parent")
/* Indicate that the level of the B-tree decreased */
@@ -872,7 +866,7 @@ H5B2__remove_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, hbool_t *depth_decreased,
/* Shadow the node if doing SWMR writes */
if(hdr->swmr_write) {
- if(H5B2__shadow_internal(internal, dxpl_id, curr_node_ptr) < 0)
+ if(H5B2__shadow_internal(internal, curr_node_ptr) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTCOPY, FAIL, "unable to shadow internal node")
internal_addr = curr_node_ptr->addr;
} /* end if */
@@ -906,35 +900,32 @@ H5B2__remove_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, hbool_t *depth_decreased,
*/
if(idx == 0) { /* Left-most child */
if(retries > 0 && (internal->node_ptrs[idx + 1].node_nrec > merge_nrec)) {
- if(H5B2__redistribute2(hdr, dxpl_id, depth, internal, idx) < 0)
+ if(H5B2__redistribute2(hdr, depth, internal, idx) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTREDISTRIBUTE, FAIL, "unable to redistribute child node records")
} /* end if */
else {
- if(H5B2__merge2(hdr, dxpl_id, depth, curr_node_ptr,
- parent_cache_info_flags_ptr, internal, &internal_flags, idx) < 0)
+ if(H5B2__merge2(hdr, depth, curr_node_ptr, parent_cache_info_flags_ptr, internal, &internal_flags, idx) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to merge child node")
} /* end else */
} /* end if */
else if(idx == internal->nrec) { /* Right-most child */
if(retries > 0 && (internal->node_ptrs[idx - 1].node_nrec > merge_nrec)) {
- if(H5B2__redistribute2(hdr, dxpl_id, depth, internal, (idx - 1)) < 0)
+ if(H5B2__redistribute2(hdr, depth, internal, (idx - 1)) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTREDISTRIBUTE, FAIL, "unable to redistribute child node records")
} /* end if */
else {
- if(H5B2__merge2(hdr, dxpl_id, depth, curr_node_ptr,
- parent_cache_info_flags_ptr, internal, &internal_flags, (idx - 1)) < 0)
+ if(H5B2__merge2(hdr, depth, curr_node_ptr, parent_cache_info_flags_ptr, internal, &internal_flags, (idx - 1)) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to merge child node")
} /* end else */
} /* end if */
else { /* Middle child */
if(retries > 0 && ((internal->node_ptrs[idx + 1].node_nrec > merge_nrec) ||
(internal->node_ptrs[idx - 1].node_nrec > merge_nrec))) {
- if(H5B2__redistribute3(hdr, dxpl_id, depth, internal, &internal_flags, idx) < 0)
+ if(H5B2__redistribute3(hdr, depth, internal, &internal_flags, idx) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTREDISTRIBUTE, FAIL, "unable to redistribute child node records")
} /* end if */
else {
- if(H5B2__merge3(hdr, dxpl_id, depth, curr_node_ptr,
- parent_cache_info_flags_ptr, internal, &internal_flags, idx) < 0)
+ if(H5B2__merge3(hdr, depth, curr_node_ptr, parent_cache_info_flags_ptr, internal, &internal_flags, idx) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to merge child node")
} /* end else */
} /* end else */
@@ -962,7 +953,7 @@ H5B2__remove_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, hbool_t *depth_decreased,
/* Swap record to delete with record from leaf, if we are the last internal node */
if(swap_loc && depth == 1)
- if(H5B2__swap_leaf(hdr, dxpl_id, depth, internal, &internal_flags, idx, swap_loc) < 0)
+ if(H5B2__swap_leaf(hdr, depth, internal, &internal_flags, idx, swap_loc) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTSWAP, FAIL, "Can't swap records in B-tree")
/* Set pointers for advancing to child node */
@@ -985,12 +976,12 @@ H5B2__remove_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, hbool_t *depth_decreased,
/* Attempt to remove record from child node */
if(depth > 1) {
- if(H5B2__remove_internal(hdr, dxpl_id, depth_decreased, swap_loc, swap_parent, (uint16_t)(depth - 1),
+ if(H5B2__remove_internal(hdr, depth_decreased, swap_loc, swap_parent, (uint16_t)(depth - 1),
new_cache_info, new_cache_info_flags_ptr, next_pos, new_node_ptr, udata, op, op_data) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTDELETE, FAIL, "unable to remove record from B-tree internal node")
} /* end if */
else {
- if(H5B2__remove_leaf(hdr, dxpl_id, new_node_ptr, next_pos, new_cache_info, udata, op, op_data) < 0)
+ if(H5B2__remove_leaf(hdr, new_node_ptr, next_pos, new_cache_info, udata, op, op_data) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTDELETE, FAIL, "unable to remove record from B-tree leaf node")
} /* end else */
@@ -1008,7 +999,7 @@ H5B2__remove_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, hbool_t *depth_decreased,
done:
/* Release the B-tree internal node */
- if(internal && H5AC_unprotect(hdr->f, dxpl_id, H5AC_BT2_INT, internal_addr, internal, internal_flags) < 0)
+ if(internal && H5AC_unprotect(hdr->f, H5AC_BT2_INT, internal_addr, internal, internal_flags) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release internal B-tree node")
FUNC_LEAVE_NOAPI(ret_value)
@@ -1030,11 +1021,10 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5B2__remove_internal_by_idx(H5B2_hdr_t *hdr, hid_t dxpl_id,
- hbool_t *depth_decreased, void *swap_loc, void *swap_parent, uint16_t depth,
- H5AC_info_t *parent_cache_info, unsigned *parent_cache_info_flags_ptr,
- H5B2_node_ptr_t *curr_node_ptr, H5B2_nodepos_t curr_pos, hsize_t n,
- H5B2_remove_t op, void *op_data)
+H5B2__remove_internal_by_idx(H5B2_hdr_t *hdr, hbool_t *depth_decreased,
+ void *swap_loc, void *swap_parent, uint16_t depth, H5AC_info_t *parent_cache_info,
+ unsigned *parent_cache_info_flags_ptr, H5B2_node_ptr_t *curr_node_ptr,
+ H5B2_nodepos_t curr_pos, hsize_t n, H5B2_remove_t op, void *op_data)
{
H5AC_info_t *new_cache_info; /* Pointer to new cache info */
unsigned *new_cache_info_flags_ptr = NULL;
@@ -1057,7 +1047,7 @@ H5B2__remove_internal_by_idx(H5B2_hdr_t *hdr, hid_t dxpl_id,
HDassert(H5F_addr_defined(curr_node_ptr->addr));
/* Lock current B-tree node */
- if(NULL == (internal = H5B2__protect_internal(hdr, dxpl_id, parent_cache_info, curr_node_ptr, depth, FALSE, H5AC__NO_FLAGS_SET)))
+ if(NULL == (internal = H5B2__protect_internal(hdr, parent_cache_info, curr_node_ptr, depth, FALSE, H5AC__NO_FLAGS_SET)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node")
internal_addr = curr_node_ptr->addr;
HDassert(internal->nrec == curr_node_ptr->node_nrec);
@@ -1073,8 +1063,7 @@ H5B2__remove_internal_by_idx(H5B2_hdr_t *hdr, hid_t dxpl_id,
HDassert(depth == hdr->depth);
/* Merge children of root node */
- if(H5B2__merge2(hdr, dxpl_id, depth, curr_node_ptr,
- parent_cache_info_flags_ptr, internal, &internal_flags, 0) < 0)
+ if(H5B2__merge2(hdr, depth, curr_node_ptr, parent_cache_info_flags_ptr, internal, &internal_flags, 0) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to merge child node")
/* Let the cache know that the object is deleted */
@@ -1088,7 +1077,7 @@ H5B2__remove_internal_by_idx(H5B2_hdr_t *hdr, hid_t dxpl_id,
/* Update flush dependency for child, if using SWMR */
if(hdr->swmr_write)
- if(H5B2__update_flush_depend(hdr, dxpl_id, depth, curr_node_ptr, internal, hdr) < 0)
+ if(H5B2__update_flush_depend(hdr, depth, curr_node_ptr, internal, hdr) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUPDATE, FAIL, "unable to update child node to new parent")
/* Indicate that the level of the B-tree decreased */
@@ -1114,7 +1103,7 @@ H5B2__remove_internal_by_idx(H5B2_hdr_t *hdr, hid_t dxpl_id,
/* Shadow the node if doing SWMR writes */
if(hdr->swmr_write) {
- if(H5B2__shadow_internal(internal, dxpl_id, curr_node_ptr) < 0)
+ if(H5B2__shadow_internal(internal, curr_node_ptr) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTCOPY, FAIL, "unable to shadow internal node")
internal_addr = curr_node_ptr->addr;
} /* end if */
@@ -1169,35 +1158,32 @@ H5B2__remove_internal_by_idx(H5B2_hdr_t *hdr, hid_t dxpl_id,
*/
if(idx == 0) { /* Left-most child */
if(retries > 0 && (internal->node_ptrs[idx + 1].node_nrec > merge_nrec)) {
- if(H5B2__redistribute2(hdr, dxpl_id, depth, internal, idx) < 0)
+ if(H5B2__redistribute2(hdr, depth, internal, idx) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTREDISTRIBUTE, FAIL, "unable to redistribute child node records")
} /* end if */
else {
- if(H5B2__merge2(hdr, dxpl_id, depth, curr_node_ptr,
- parent_cache_info_flags_ptr, internal, &internal_flags, idx) < 0)
+ if(H5B2__merge2(hdr, depth, curr_node_ptr, parent_cache_info_flags_ptr, internal, &internal_flags, idx) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to merge child node")
} /* end else */
} /* end if */
else if(idx == internal->nrec) { /* Right-most child */
if(retries > 0 && (internal->node_ptrs[idx - 1].node_nrec > merge_nrec)) {
- if(H5B2__redistribute2(hdr, dxpl_id, depth, internal, (idx - 1)) < 0)
+ if(H5B2__redistribute2(hdr, depth, internal, (idx - 1)) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTREDISTRIBUTE, FAIL, "unable to redistribute child node records")
} /* end if */
else {
- if(H5B2__merge2(hdr, dxpl_id, depth, curr_node_ptr,
- parent_cache_info_flags_ptr, internal, &internal_flags, (idx - 1)) < 0)
+ if(H5B2__merge2(hdr, depth, curr_node_ptr, parent_cache_info_flags_ptr, internal, &internal_flags, (idx - 1)) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to merge child node")
} /* end else */
} /* end if */
else { /* Middle child */
if(retries > 0 && ((internal->node_ptrs[idx + 1].node_nrec > merge_nrec) ||
(internal->node_ptrs[idx - 1].node_nrec > merge_nrec))) {
- if(H5B2__redistribute3(hdr, dxpl_id, depth, internal, &internal_flags, idx) < 0)
+ if(H5B2__redistribute3(hdr, depth, internal, &internal_flags, idx) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTREDISTRIBUTE, FAIL, "unable to redistribute child node records")
} /* end if */
else {
- if(H5B2__merge3(hdr, dxpl_id, depth, curr_node_ptr,
- parent_cache_info_flags_ptr, internal, &internal_flags, idx) < 0)
+ if(H5B2__merge3(hdr, depth, curr_node_ptr, parent_cache_info_flags_ptr, internal, &internal_flags, idx) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to merge child node")
} /* end else */
} /* end else */
@@ -1253,7 +1239,7 @@ H5B2__remove_internal_by_idx(H5B2_hdr_t *hdr, hid_t dxpl_id,
/* Swap record to delete with record from leaf, if we are the last internal node */
if(swap_loc && depth == 1)
- if(H5B2__swap_leaf(hdr, dxpl_id, depth, internal, &internal_flags, idx, swap_loc) < 0)
+ if(H5B2__swap_leaf(hdr, depth, internal, &internal_flags, idx, swap_loc) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTSWAP, FAIL, "can't swap records in B-tree")
/* Set pointers for advancing to child node */
@@ -1276,12 +1262,12 @@ H5B2__remove_internal_by_idx(H5B2_hdr_t *hdr, hid_t dxpl_id,
/* Attempt to remove record from child node */
if(depth > 1) {
- if(H5B2__remove_internal_by_idx(hdr, dxpl_id, depth_decreased, swap_loc, swap_parent, (uint16_t)(depth - 1),
+ if(H5B2__remove_internal_by_idx(hdr, depth_decreased, swap_loc, swap_parent, (uint16_t)(depth - 1),
new_cache_info, new_cache_info_flags_ptr, new_node_ptr, next_pos, n, op, op_data) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTDELETE, FAIL, "unable to remove record from B-tree internal node")
} /* end if */
else {
- if(H5B2__remove_leaf_by_idx(hdr, dxpl_id, new_node_ptr, next_pos, new_cache_info, (unsigned)n, op, op_data) < 0)
+ if(H5B2__remove_leaf_by_idx(hdr, new_node_ptr, next_pos, new_cache_info, (unsigned)n, op, op_data) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTDELETE, FAIL, "unable to remove record from B-tree leaf node")
} /* end else */
@@ -1299,7 +1285,7 @@ H5B2__remove_internal_by_idx(H5B2_hdr_t *hdr, hid_t dxpl_id,
done:
/* Release the B-tree internal node */
- if(internal && H5AC_unprotect(hdr->f, dxpl_id, H5AC_BT2_INT, internal_addr, internal, internal_flags) < 0)
+ if(internal && H5AC_unprotect(hdr->f, H5AC_BT2_INT, internal_addr, internal, internal_flags) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release internal B-tree node")
FUNC_LEAVE_NOAPI(ret_value)