summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/H5HFflist.c30
-rw-r--r--src/H5HFint.c379
-rw-r--r--test/fheap.c523
3 files changed, 806 insertions, 126 deletions
diff --git a/src/H5HFflist.c b/src/H5HFflist.c
index d879a23..c12bb51 100644
--- a/src/H5HFflist.c
+++ b/src/H5HFflist.c
@@ -70,6 +70,7 @@ struct H5HF_freelist_t {
unsigned nbins; /* Number of bins */
H5SL_operator_t node_free_op; /* Callback for freeing nodes when free list is destroyed */
H5SL_t **bins; /* Pointer to array of lists of free nodes */
+ hbool_t using_bins; /* Flag to indicate that all nodes are in the bins */
};
@@ -144,6 +145,7 @@ H5HF_flist_create(size_t max_block_size, H5SL_operator_t node_free_op)
flist->nbins = H5V_log2_of2(max_block_size);
flist->node_free_op = node_free_op;
flist->bins = NULL;
+ flist->using_bins = FALSE;
/* Set return value */
ret_value = flist;
@@ -263,8 +265,8 @@ HDfprintf(stderr, "%s: *size_key = %Zu, *addr_key = %a\n", FUNC, *size_key, *add
} /* end if */
else {
/* Have a single section, put it into the bins */
-/* XXX: Take out the "&& flist->bins == NULL" when bins converted back into single section */
- if(flist->sec_count == 1 && flist->bins == NULL) {
+/* XXX: Take out the "&& !flist->using_bins" when bins converted back into single section */
+ if(flist->sec_count == 1 && !flist->using_bins) {
HDassert(flist->single.node);
/* Check if we should allocate the bins */
@@ -277,6 +279,9 @@ HDfprintf(stderr, "%s: *size_key = %Zu, *addr_key = %a\n", FUNC, *size_key, *add
if(H5HF_flist_add_bin_node(flist, flist->single.node, flist->single.size_key, flist->single.addr_key) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTINSERT, FAIL, "can't insert free list node into skip list")
flist->single.node = NULL;
+
+ /* Using bins for storing nodes now */
+ flist->using_bins = TRUE;
} /* end if */
HDassert(flist->single.node == NULL);
@@ -395,6 +400,9 @@ H5HF_flist_find(H5HF_freelist_t *flist, size_t request, void **node)
htri_t ret_value = FALSE; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5HF_flist_find)
+#ifdef QAK
+HDfprintf(stderr, "%s: request = %Zu\n", FUNC, request);
+#endif /* QAK */
/* Check arguments. */
HDassert(flist);
@@ -404,7 +412,8 @@ H5HF_flist_find(H5HF_freelist_t *flist, size_t request, void **node)
/* Check for any sections on free list */
if(flist->sec_count > 0) {
/* Check for single section */
- if(flist->sec_count == 1) {
+/* XXX: Take out the "&& !flist->using_bins" when bins converted back into single section */
+ if(flist->sec_count == 1 && !flist->using_bins) {
HDassert(flist->single.node);
/* See if single section is large enough */
@@ -413,6 +422,8 @@ H5HF_flist_find(H5HF_freelist_t *flist, size_t request, void **node)
flist->single.node = NULL;
ret_value = TRUE;
} /* end if */
+ else
+ HGOTO_DONE(FALSE)
} /* end if */
else {
HDassert(flist->single.node == NULL);
@@ -424,7 +435,15 @@ H5HF_flist_find(H5HF_freelist_t *flist, size_t request, void **node)
/* Decrement # of sections on free list */
flist->sec_count--;
-/* XXX: Should check for only one section in bins & convert to single section */
+/* XXX: Should check for only one section in bins & convert to single section
+ * This is somewhat hard because we "lose" the the size & address keys
+ * (The address key is actually available, but the size key is gone, unless
+ * we start tracking it.
+ *
+ * Drop back to using a "single" node when the bins are empty.
+ */
+ if(flist->sec_count == 0)
+ flist->using_bins = FALSE;
} /* end if */
done:
@@ -490,7 +509,8 @@ H5HF_flist_free(H5HF_freelist_t *flist)
HDassert(flist);
/* Check for single section to free */
- if(flist->sec_count == 1) {
+/* XXX: Take out the "&& !flist->using_bins" when bins converted back into single section */
+ if(flist->sec_count == 1 && !flist->using_bins) {
HDassert(flist->single.node != NULL);
flist->node_free_op(flist->single.node, flist->single.addr_key, NULL);
flist->single.node = NULL;
diff --git a/src/H5HFint.c b/src/H5HFint.c
index b73f908..72eace9 100644
--- a/src/H5HFint.c
+++ b/src/H5HFint.c
@@ -102,7 +102,7 @@ static herr_t H5HF_dblock_section_node_free_cb(void *item, void UNUSED *key,
void UNUSED *op_data);
static herr_t H5HF_man_dblock_create(hid_t dxpl_id, H5HF_t *hdr,
H5HF_indirect_t *par_iblock, unsigned par_entry, size_t block_size,
- hsize_t block_off, haddr_t *addr_p);
+ hsize_t block_off, haddr_t *addr_p, H5HF_section_free_node_t **ret_sec_node);
static herr_t H5HF_man_dblock_new(H5HF_t *fh, hid_t dxpl_id,
size_t request);
static herr_t H5HF_man_dblock_adj_free(hid_t dxpl_id, H5HF_direct_t *dblock, ssize_t amt);
@@ -110,9 +110,12 @@ static herr_t H5HF_man_dblock_adj_free(hid_t dxpl_id, H5HF_direct_t *dblock, ssi
/* Indirect block routines */
static herr_t H5HF_man_iblock_inc_loc(H5HF_indirect_t *iblock);
static herr_t H5HF_iblock_dirty(hid_t dxpl_id, H5HF_indirect_t *iblock);
+static herr_t H5HF_man_iblock_adj_free(hid_t dxpl_id, H5HF_indirect_t *iblock, ssize_t amt);
static H5HF_indirect_t * H5HF_man_iblock_place_dblock(H5HF_t *fh, hid_t dxpl_id,
size_t min_dblock_size, haddr_t *addr_p, size_t *entry_p,
size_t *dblock_size);
+static herr_t H5HF_man_iblock_alloc_range(H5HF_t *hdr, hid_t dxpl_id,
+ H5HF_section_free_node_t **sec_node, size_t obj_size);
static herr_t H5HF_man_iblock_create(H5HF_t *fh, hid_t dxpl_id,
hsize_t block_off, unsigned nrows, unsigned max_rows, haddr_t *addr_p);
@@ -519,8 +522,8 @@ done:
*/
static herr_t
H5HF_man_dblock_create(hid_t dxpl_id, H5HF_t *hdr, H5HF_indirect_t *par_iblock,
- unsigned par_entry,
- size_t block_size, hsize_t block_off, haddr_t *addr_p)
+ unsigned par_entry, size_t block_size, hsize_t block_off, haddr_t *addr_p,
+ H5HF_section_free_node_t **ret_sec_node)
{
H5HF_direct_free_node_t *node; /* Pointer to free list node for block */
H5HF_section_free_node_t *sec_node; /* Pointer to free list section for block */
@@ -617,12 +620,18 @@ HDmemset(dblock->blk, 0, dblock->size);
sec_node->u.single.dblock_addr = *addr_p;
sec_node->u.single.dblock_size = block_size;
- /* Add new free space to the global list of space */
- if(H5HF_flist_add(hdr->flist, sec_node, &sec_node->sect_size, &sec_node->sect_addr) < 0)
- HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't add direct block free space to global list")
+ /* Check what to do with section node */
+ if(ret_sec_node)
+ /* Pass back the pointer to the section instead of adding it to the free list */
+ *ret_sec_node = sec_node;
+ else {
+ /* Add new free space to the global list of space */
+ if(H5HF_flist_add(hdr->flist, sec_node, &sec_node->sect_size, &sec_node->sect_addr) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't add direct block free space to global list")
+ } /* end else */
/* Adjust free space to include new block's space */
- if(H5HF_man_dblock_adj_free(dxpl_id, dblock, (ssize_t)free_space) < 0)
+ if(H5HF_man_dblock_adj_free(dxpl_id, dblock, (ssize_t)sec_node->sect_size) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't adjust free space for direct block & parents")
/* Update shared heap header */
@@ -843,7 +852,7 @@ H5HF_man_dblock_adj_free(hid_t dxpl_id, H5HF_direct_t *dblock, ssize_t amt)
FUNC_ENTER_NOAPI_NOINIT(H5HF_man_dblock_adj_free)
#ifdef QAK
-HDfprintf(stderr, "%s: amt = %Zd\n", "H5HF_man_dblock_adj_free", amt);
+HDfprintf(stderr, "%s: amt = %Zd\n", FUNC, amt);
#endif /* QAK */
/*
@@ -855,6 +864,7 @@ HDfprintf(stderr, "%s: amt = %Zd\n", "H5HF_man_dblock_adj_free", amt);
hdr = dblock->shared;
/* Adjust space available in block */
+ HDassert(amt > 0 || dblock->blk_free_space >= (size_t)-amt);
dblock->blk_free_space += amt;
/* Check if the parent info is set */
@@ -866,9 +876,11 @@ HDfprintf(stderr, "%s: amt = %Zd\n", "H5HF_man_dblock_adj_free", amt);
/* Adjust this indirect block's child free space */
#ifdef QAK
-HDfprintf(stderr, "%s: iblock->child_free_space = %Hu\n", "H5HF_man_dblock_adj_free", iblock->child_free_space);
+HDfprintf(stderr, "%s: iblock->child_free_space = %Hu\n", FUNC, iblock->child_free_space);
#endif /* QAK */
+ HDassert(amt > 0 || iblock->ents[dblock->par_entry].free_space >= (hsize_t)-amt);
iblock->ents[dblock->par_entry].free_space += amt;
+ HDassert(amt > 0 || iblock->child_free_space >= (hsize_t)-amt);
iblock->child_free_space += amt;
/* Mark indirect block as dirty */
@@ -885,7 +897,9 @@ HDfprintf(stderr, "%s: iblock->child_free_space = %Hu\n", "H5HF_man_dblock_adj_f
HDassert(iblock);
/* Adjust this indirect block's child free space */
+ HDassert(amt > 0 || iblock->ents[par_entry].free_space >= (hsize_t)-amt);
iblock->ents[par_entry].free_space += amt;
+ HDassert(amt > 0 || iblock->child_free_space >= (hsize_t)-amt);
iblock->child_free_space += amt;
/* Mark indirect block as dirty */
@@ -895,7 +909,11 @@ HDfprintf(stderr, "%s: iblock->child_free_space = %Hu\n", "H5HF_man_dblock_adj_f
} /* end if */
/* Update shared heap free space header */
+ HDassert(amt > 0 || hdr->total_man_free >= (hsize_t)-amt);
hdr->total_man_free += amt;
+#ifdef QAK
+HDfprintf(stderr, "%s: hdr->total_man_free = %Hu\n", FUNC, hdr->total_man_free);
+#endif /* QAK */
/* Mark heap header as modified */
if(H5HF_hdr_dirty(dxpl_id, hdr) < 0)
@@ -965,7 +983,7 @@ HDfprintf(stderr, "%s: Check 2 - min_dblock_size = %Zu\n", FUNC, min_dblock_size
min_dblock_size == hdr->man_dtable.cparam.start_block_size) {
/* Create new direct block at starting offset */
dblock_size = hdr->man_dtable.cparam.start_block_size;
- if(H5HF_man_dblock_create(dxpl_id, hdr, NULL, 0, dblock_size, (hsize_t)0, &dblock_addr) < 0)
+ if(H5HF_man_dblock_create(dxpl_id, hdr, NULL, 0, dblock_size, (hsize_t)0, &dblock_addr, NULL) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "can't allocate fractal heap direct block")
#ifdef QAK
@@ -998,7 +1016,7 @@ HDfprintf(stderr, "%s: dblock_size = %Zu\n", FUNC, dblock_size);
dblock_off += hdr->man_dtable.row_block_size[dblock_entry / hdr->man_dtable.cparam.width] * (dblock_entry % hdr->man_dtable.cparam.width);
/* Create new direct block at current location*/
- if(H5HF_man_dblock_create(dxpl_id, hdr, iblock, dblock_entry, dblock_size, dblock_off, &dblock_addr) < 0)
+ if(H5HF_man_dblock_create(dxpl_id, hdr, iblock, dblock_entry, dblock_size, dblock_off, &dblock_addr, NULL) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "can't allocate fractal heap direct block")
#ifdef QAK
@@ -1118,11 +1136,27 @@ H5HF_man_insert(H5HF_t *hdr, hid_t dxpl_id, H5HF_section_free_node_t *sec_node,
/* Check for range section */
if(sec_node->type == H5HF_SECT_RANGE) {
-HDfprintf(stderr, "%s: Can't handle range sections yet\n", FUNC);
-HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "'range' free space sections not supported yet")
+#ifdef QAK
+HDfprintf(stderr, "%s: sec_node->sect_addr = %a\n", FUNC, sec_node->sect_addr);
+HDfprintf(stderr, "%s: sec_node->sect_size = %Zu\n", FUNC, sec_node->sect_size);
+HDfprintf(stderr, "%s: sec_node->u.range.iblock_addr = %a\n", FUNC, sec_node->u.range.iblock_addr);
+HDfprintf(stderr, "%s: sec_node->u.range.iblock_nrows = %u\n", FUNC, sec_node->u.range.iblock_nrows);
+HDfprintf(stderr, "%s: sec_node->u.range.entry = %u\n", FUNC, sec_node->u.range.entry);
+HDfprintf(stderr, "%s: sec_node->u.range.num_entries = %u\n", FUNC, sec_node->u.range.num_entries);
+HDfprintf(stderr, "%s: sec_node->u.range.range = %Hu\n", FUNC, sec_node->u.range.range);
+#endif /* QAK */
+ /* Allocate 'single' selection out of range selection */
+ if(H5HF_man_iblock_alloc_range(hdr, dxpl_id, &sec_node, obj_size) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "can't break up range free section")
} /* end if */
/* Lock direct block */
+#ifdef QAK
+HDfprintf(stderr, "%s: sec_node->sect_addr = %a\n", FUNC, sec_node->sect_addr);
+HDfprintf(stderr, "%s: sec_node->sect_size = %Zu\n", FUNC, sec_node->sect_size);
+HDfprintf(stderr, "%s: sec_node->u.single.dblock_addr = %a\n", FUNC, sec_node->u.single.dblock_addr);
+HDfprintf(stderr, "%s: sec_node->u.single.dblock_size = %Zu\n", FUNC, sec_node->u.single.dblock_size);
+#endif /* QAK */
dblock_addr = sec_node->u.single.dblock_addr;
if(NULL == (dblock = H5AC_protect(hdr->f, dxpl_id, H5AC_FHEAP_DBLOCK, dblock_addr, &sec_node->u.single.dblock_size, hdr, H5AC_WRITE)))
HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to load fractal heap direct block")
@@ -1136,6 +1170,8 @@ HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "'range' free space sections not su
size_t obj_off; /* Offset of object within block */
size_t full_obj_size; /* Size of object including metadata */
size_t alloc_obj_size; /* Size of object including metadata & any free space fragment */
+ size_t free_obj_size; /* Size of space to free for object */
+ hbool_t whole_node = FALSE; /* Whether we've used the whole node or not */
unsigned char free_frag_size; /* Size of free space fragment */
/* Locate "local" free list node for section */
@@ -1149,12 +1185,15 @@ HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "'range' free space sections not su
full_obj_size = obj_size + H5HF_MAN_ABS_DIRECT_OBJ_PREFIX_LEN(hdr);
/* Sanity checks */
- HDassert(dblock->blk_free_space >= full_obj_size);
+ HDassert(dblock->blk_free_space >= obj_size);
HDassert(dblock->free_list);
HDassert(node->size >= full_obj_size);
/* Check for using entire node */
free_frag_size = 0;
+#ifdef QAK
+HDfprintf(stderr, "%s: node->size = %Zu\n", FUNC, node->size);
+#endif /* QAK */
if(node->size <= (full_obj_size + H5HF_MAN_ABS_DIRECT_FREE_NODE_SIZE(dblock))) {
/* Set the offset of the object within the block */
obj_off = node->my_offset;
@@ -1184,6 +1223,7 @@ HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "'range' free space sections not su
/* Set the free fragment size */
free_frag_size = (unsigned char )(node->size - full_obj_size);
+ whole_node = TRUE;
/* Release the memory for the free list node & section */
H5FL_FREE(H5HF_direct_free_node_t, node);
@@ -1210,6 +1250,10 @@ HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "'range' free space sections not su
/* (includes the metadata for the object & the free space fragment) */
alloc_obj_size = full_obj_size + free_frag_size;
+ /* Compute the size of the free space to reduce */
+ /* (does not include the object prefix if this object uses a whole node) */
+ free_obj_size = obj_size + (whole_node ? free_frag_size : H5HF_MAN_ABS_DIRECT_OBJ_PREFIX_LEN(hdr));
+
#ifdef QAK
HDfprintf(stderr, "%s: obj_off = %Zu\n", FUNC, obj_off);
HDfprintf(stderr, "%s: free_frag_size = %Zu\n", FUNC, free_frag_size);
@@ -1217,7 +1261,7 @@ HDfprintf(stderr, "%s: full_obj_size = %Zu\n", FUNC, full_obj_size);
HDfprintf(stderr, "%s: alloc_obj_size = %Zu\n", FUNC, alloc_obj_size);
#endif /* QAK */
/* Reduce space available in parent block(s) */
- if(H5HF_man_dblock_adj_free(dxpl_id, dblock, -(ssize_t)alloc_obj_size) < 0)
+ if(H5HF_man_dblock_adj_free(dxpl_id, dblock, -(ssize_t)free_obj_size) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't adjust free space for direct block & parents")
/* Encode the object in the block */
@@ -1657,6 +1701,81 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5HF_man_iblock_adj_free
+ *
+ * Purpose: Adjust the free space for an indirect block, and it's parents
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Quincey Koziol
+ * koziol@ncsa.uiuc.edu
+ * Mar 28 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5HF_man_iblock_adj_free(hid_t dxpl_id, H5HF_indirect_t *iblock, ssize_t amt)
+{
+ H5HF_t *hdr; /* Shared heap information */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT(H5HF_man_iblock_adj_free)
+#ifdef QAK
+HDfprintf(stderr, "%s: amt = %Zd\n", FUNC, amt);
+#endif /* QAK */
+
+ /*
+ * Check arguments.
+ */
+ HDassert(iblock);
+
+ /* Get the pointer to the shared heap header */
+ hdr = iblock->shared;
+
+ /* Adjust space available in block */
+ HDassert(amt > 0 || iblock->child_free_space >= (hsize_t)-amt);
+ iblock->child_free_space += amt;
+
+ /* Check if the parent info is set */
+ while(iblock->parent) {
+ size_t par_entry; /* Entry in parent */
+
+ /* Get the pointer to the shared parent indirect block */
+ par_entry = iblock->par_entry;
+ iblock = iblock->parent;
+ HDassert(iblock);
+
+ /* Adjust this indirect block's child free space */
+#ifdef QAK
+HDfprintf(stderr, "%s: iblock->child_free_space = %Hu\n", FUNC, iblock->child_free_space);
+#endif /* QAK */
+ HDassert(amt > 0 || iblock->ents[par_entry].free_space >= (hsize_t)-amt);
+ iblock->ents[par_entry].free_space += amt;
+ HDassert(amt > 0 || iblock->child_free_space >= (hsize_t)-amt);
+ iblock->child_free_space += amt;
+
+ /* Mark indirect block as dirty */
+ if(H5HF_iblock_dirty(dxpl_id, iblock) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark indirect block as dirty")
+ } /* end if */
+
+ /* Update shared heap free space header */
+ HDassert(amt > 0 || hdr->total_man_free >= (hsize_t)-amt);
+ hdr->total_man_free += amt;
+#ifdef QAK
+HDfprintf(stderr, "%s: hdr->total_man_free = %Hu\n", FUNC, hdr->total_man_free);
+#endif /* QAK */
+
+ /* Mark heap header as modified */
+ if(H5HF_hdr_dirty(dxpl_id, hdr) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark heap header as dirty")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5HF_man_iblock_adj_free() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5HF_man_iblock_place_dblock
*
* Purpose: Find indirect block with location for placing a direct block
@@ -1776,8 +1895,8 @@ HDfprintf(stderr, "%s: iblock_addr = %a\n", FUNC, iblock_addr);
iblock->ents[cur_entry].free_space = dblock_free_space;
/* Increment block and heap's free space */
- iblock->child_free_space += dblock_free_space;
- hdr->total_man_free += dblock_free_space;
+ if(H5HF_man_iblock_adj_free(dxpl_id, iblock, (ssize_t)dblock_free_space) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, NULL, "can't adjust free space for indirect block & parents")
/* Increment range skipped */
range += hdr->man_dtable.row_block_size[u];
@@ -2030,6 +2149,223 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5HF_man_iblock_alloc_range
+ *
+ * Purpose: Allocate a "single" section for an object, out of a "range"
+ * section
+ *
+ * Note: Creates necessary direct & indirect blocks
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * koziol@ncsa.uiuc.edu
+ * Mar 28 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5HF_man_iblock_alloc_range(H5HF_t *hdr, hid_t dxpl_id,
+ H5HF_section_free_node_t **sec_node, size_t obj_size)
+{
+ H5HF_indirect_t *iblock; /* Pointer to indirect block */
+ haddr_t iblock_addr; /* Indirect block's address */
+ haddr_t dblock_addr; /* Direct block's address */
+ unsigned iblock_nrows; /* Indirect block's number of rows */
+ H5HF_section_free_node_t *dblock_sec_node = NULL; /* Pointer to direct block's section node */
+ H5HF_section_free_node_t *old_sec_node = *sec_node; /* Pointer to old section node */
+ size_t full_obj_size; /* Size of object including metadata */
+ unsigned cur_entry; /* Current entry in indirect block */
+ unsigned cur_row; /* Current row in indirect block */
+ size_t row_size; /* Size of objects in current row */
+ hsize_t range_covered; /* Range covered while searching for block to use */
+ unsigned u; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT(H5HF_man_iblock_alloc_range)
+
+ /*
+ * Check arguments.
+ */
+ HDassert(hdr);
+ HDassert(sec_node && *sec_node);
+ HDassert(obj_size > 0);
+
+ /* Compute info about range */
+ cur_entry = old_sec_node->u.range.entry;
+
+ /* Check for range covering indirect blocks */
+ if((cur_entry / hdr->man_dtable.cparam.width) >= hdr->man_dtable.max_direct_rows ||
+ ((cur_entry + old_sec_node->u.range.num_entries) / hdr->man_dtable.cparam.width)
+ >= hdr->man_dtable.max_direct_rows) {
+HDfprintf(stderr, "%s: Can't handle range sections over indirect blocks yet\n", FUNC);
+HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "'range' free space sections over indirect blocks not supported yet")
+ } /* end if */
+
+ /* Get information about indirect block covering section */
+ /* (Allow for root indirect block being resized) */
+ iblock_addr = old_sec_node->u.range.iblock_addr;
+ if(H5F_addr_eq(iblock_addr, hdr->man_dtable.table_addr))
+ iblock_nrows = hdr->man_dtable.curr_root_rows;
+ else
+ iblock_nrows = old_sec_node->u.range.iblock_nrows;
+
+ /* Get a pointer to the indirect block covering the range */
+ if(NULL == (iblock = H5AC_protect(hdr->f, dxpl_id, H5AC_FHEAP_IBLOCK, iblock_addr, &iblock_nrows, hdr, H5AC_WRITE)))
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect fractal heap indirect block")
+
+ /* Compute size of object, with metadata overhead */
+ full_obj_size = obj_size + H5HF_MAN_ABS_DIRECT_OBJ_PREFIX_LEN(hdr);
+
+ /* Look for first direct block that will fulfill request */
+ range_covered = 0;
+ for(u = 0; u < old_sec_node->u.range.num_entries; ) {
+ unsigned skip_blocks; /* # of blocks to skip over to next row */
+
+ /* Compute informatio about current row */
+ cur_row = cur_entry / hdr->man_dtable.cparam.width;
+ row_size = hdr->man_dtable.row_block_size[cur_row];
+
+ /* Check if first available block in this row will hold block */
+ if((H5HF_MAN_ABS_DIRECT_OVERHEAD_SIZE(hdr, row_size) + full_obj_size) <= row_size)
+ break;
+
+ /* Compute number of blocks to skip in row */
+ skip_blocks = ((cur_row + 1) * hdr->man_dtable.cparam.width) - cur_entry;
+
+ /* Advance values to beginning of next row */
+ range_covered += row_size * skip_blocks;
+ u += skip_blocks;
+ cur_entry += skip_blocks;
+ } /* end for */
+#ifdef QAK
+HDfprintf(stderr, "%s: cur_entry = %u, cur_row = %u, row_size = %Zu\n", FUNC, cur_entry, cur_row, row_size);
+HDfprintf(stderr, "%s: range_covered = %Hu, u = %u\n", FUNC, range_covered, u);
+HDfprintf(stderr, "%s: old_sec_node->u.range.num_entries = %u\n", FUNC, old_sec_node->u.range.num_entries);
+#endif /* QAK */
+ /* Must find direct block of useful size */
+ HDassert(u < old_sec_node->u.range.num_entries);
+
+ /* Create direct block of appropriate size */
+ if(H5HF_man_dblock_create(dxpl_id, hdr, iblock, cur_entry, row_size, (hsize_t)(old_sec_node->sect_addr + range_covered), &dblock_addr, &dblock_sec_node) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "can't allocate fractal heap direct block")
+
+ /* Hook direct block up to indirect block */
+ iblock->ents[cur_entry].addr = dblock_addr;
+ iblock->ents[cur_entry].free_space = dblock_sec_node->sect_size;
+
+ /* Adjust free space in block & heap */
+ if(H5HF_man_iblock_adj_free(dxpl_id, iblock, -(ssize_t)dblock_sec_node->sect_size) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't adjust free space for indirect block & parents")
+
+ /* Break range section up into zero, one or two range sections and add them
+ * back to the free sections for the file
+ */
+
+ /* Check for only single block covered in range section */
+ if(old_sec_node->u.range.num_entries == 1)
+ H5FL_FREE(H5HF_section_free_node_t, old_sec_node);
+ else {
+ size_t next_block_size; /* Next entry after block used */
+
+ /* Check for using first block in range section */
+ if(u == 0) {
+#ifdef QAK
+HDfprintf(stderr, "%s: range type 1\n", FUNC);
+#endif /* QAK */
+ /* Adjust section information */
+ old_sec_node->sect_addr += row_size;
+ /* Section size stays the same, since we just grabbed the smallest block in the range */
+
+ /* Adjust range information */
+ old_sec_node->u.range.entry++;
+ old_sec_node->u.range.num_entries--;
+ old_sec_node->u.range.range -= row_size;
+
+ /* Add section back to free space list */
+ if(H5HF_flist_add(hdr->flist, old_sec_node, &old_sec_node->sect_size, &old_sec_node->sect_addr) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't add indirect block free space to global list")
+ } /* end if */
+ /* Check for using middle block from range section */
+ else if(u < (old_sec_node->u.range.num_entries -1)) {
+ H5HF_section_free_node_t *new_sec_node; /* Pointer to new free list section for block */
+#ifdef QAK
+HDfprintf(stderr, "%s: range type 2\n", FUNC);
+#endif /* QAK */
+
+ /* Create new section node for space after block used */
+ if(NULL == (new_sec_node = H5FL_MALLOC(H5HF_section_free_node_t)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for indirect block free list section")
+
+ /* Set section information for new node */
+ new_sec_node->sect_addr = old_sec_node->sect_addr + range_covered + row_size;
+ new_sec_node->sect_size = old_sec_node->sect_size;
+
+ /* Set range information */
+ new_sec_node->type = H5HF_SECT_RANGE;
+ new_sec_node->u.range.iblock_addr = old_sec_node->u.range.iblock_addr;
+ new_sec_node->u.range.iblock_nrows = old_sec_node->u.range.iblock_nrows;
+ new_sec_node->u.range.entry = cur_entry + 1;
+ new_sec_node->u.range.num_entries = old_sec_node->u.range.num_entries - (u + 1);
+ new_sec_node->u.range.range = old_sec_node->u.range.range - (range_covered + row_size);
+
+ /* Add new section to free space list */
+ if(H5HF_flist_add(hdr->flist, new_sec_node, &new_sec_node->sect_size, &new_sec_node->sect_addr) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't add indirect block free space to global list")
+
+
+ /* Compute size of block before the one used */
+ next_block_size = hdr->man_dtable.row_block_size[(cur_entry - 1) /
+ hdr->man_dtable.cparam.width];
+
+ /* Adjust current section information */
+ old_sec_node->sect_size = next_block_size -
+ (H5HF_MAN_ABS_DIRECT_OVERHEAD_SIZE(hdr, row_size) + H5HF_MAN_ABS_DIRECT_OBJ_PREFIX_LEN(hdr));
+
+ /* Adjust range information */
+ old_sec_node->u.range.num_entries = u;
+ old_sec_node->u.range.range = range_covered;
+
+ /* Add section back to free space list */
+ if(H5HF_flist_add(hdr->flist, old_sec_node, &old_sec_node->sect_size, &old_sec_node->sect_addr) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't add indirect block free space to global list")
+ } /* end if */
+ /* Must be using last block in range section */
+ else {
+#ifdef QAK
+HDfprintf(stderr, "%s: range type 3\n", FUNC);
+#endif /* QAK */
+ /* Compute size of next block after the one used */
+ next_block_size = hdr->man_dtable.row_block_size[(cur_entry - 1) /
+ hdr->man_dtable.cparam.width];
+
+ /* Adjust section information */
+ old_sec_node->sect_size = next_block_size -
+ (H5HF_MAN_ABS_DIRECT_OVERHEAD_SIZE(hdr, row_size) + H5HF_MAN_ABS_DIRECT_OBJ_PREFIX_LEN(hdr));
+
+ /* Adjust range information */
+ old_sec_node->u.range.num_entries--;
+ old_sec_node->u.range.range -= row_size;
+
+ /* Add section back to free space list */
+ if(H5HF_flist_add(hdr->flist, old_sec_node, &old_sec_node->sect_size, &old_sec_node->sect_addr) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't add indirect block free space to global list")
+ } /* end else */
+ } /* end if */
+
+ /* Release the indirect block (marked as dirty) */
+ if(H5AC_unprotect(hdr->f, dxpl_id, H5AC_FHEAP_IBLOCK, iblock_addr, iblock, H5AC__DIRTIED_FLAG) < 0)
+ HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release fractal heap indirect block")
+
+ /* Point 'sec_node' at new direct block section node */
+ *sec_node = dblock_sec_node;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5HF_man_iblock_alloc_range() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5HF_man_iblock_create
*
* Purpose: Allocate & initialize a managed indirect block
@@ -2112,15 +2448,6 @@ HDfprintf(stderr, "%s: nrows = %u, max_nrows = %u\n", FUNC, nrows, max_nrows);
iblock->addr = *addr_p;
/* XXX: Update indirect statistics when they are added */
-#ifdef LATER
- /* Update shared heap info */
- hdr->total_man_free += dblock->blk_free_space;
- hdr->total_size += dblock->size;
- hdr->man_size += dblock->size;
-
- /* Mark heap header as modified */
- hdr->dirty = TRUE;
-#endif /* LATER */
/* Cache the new fractal heap header */
if(H5AC_set(hdr->f, dxpl_id, H5AC_FHEAP_IBLOCK, *addr_p, iblock, H5AC__NO_FLAGS_SET) < 0)
diff --git a/test/fheap.c b/test/fheap.c
index aff2441..af28b12 100644
--- a/test/fheap.c
+++ b/test/fheap.c
@@ -205,10 +205,12 @@ error:
static int
fill_heap(H5F_t *f, hid_t dxpl, haddr_t fh_addr, const H5HF_create_t *cparam,
hsize_t heap_size, size_t block_size,
+ hsize_t extra_free,
unsigned start_nobjs, unsigned *nobjs_ptr)
{
H5HF_stat_t heap_stats; /* Statistics about the heap */
unsigned char heap_id[HEAP_ID_LEN]; /* Heap ID for object inserted */
+ hsize_t free_space; /* Size of free space in heap */
unsigned char obj[10]; /* Buffer for object to insert */
unsigned char robj[10]; /* Buffer for reading object */
unsigned nobjs = 0; /* Number of objects inserted */
@@ -222,11 +224,11 @@ fill_heap(H5F_t *f, hid_t dxpl, haddr_t fh_addr, const H5HF_create_t *cparam,
/* Initialize variables */
if(block_size <= (64 * 1024)) {
- data_size = block_size - (DBLOCK_OVERHEAD + cparam->managed.max_index / 8); /* '28' is the size of the direct block's overhead */
+ data_size = block_size - (OBJ_PREFIX_LEN + DBLOCK_OVERHEAD + cparam->managed.max_index / 8); /* '28' is the size of the direct block's overhead */
free_overhead = 4;
} /* end if */
else {
- data_size = block_size - (DBLOCK_OVERHEAD + 1 + cparam->managed.max_index / 8); /* '29' is the size of the direct block's overhead */
+ data_size = block_size - (OBJ_PREFIX_LEN + DBLOCK_OVERHEAD + 1 + cparam->managed.max_index / 8); /* '29' is the size of the direct block's overhead */
free_overhead = 6;
} /* end else */
@@ -250,7 +252,12 @@ fill_heap(H5F_t *f, hid_t dxpl, haddr_t fh_addr, const H5HF_create_t *cparam,
} /* end if */
HDmemcpy(&ids[(nobjs - 1) * HEAP_ID_LEN], heap_id, HEAP_ID_LEN);
- if(check_stats(f, dxpl, fh_addr, heap_size, heap_size, (hsize_t)0, (hsize_t)(data_size - (nobjs * (sizeof(obj) + OBJ_PREFIX_LEN))), (hsize_t)(start_nobjs + nobjs)))
+ free_space = extra_free + (data_size - (nobjs * (sizeof(obj) + OBJ_PREFIX_LEN)));
+#ifdef QAK
+HDfprintf(stderr, "extra_free = %Hu\n", extra_free);
+HDfprintf(stderr, "free_space = %Hu\n", free_space);
+#endif /* QAK */
+ if(check_stats(f, dxpl, fh_addr, heap_size, heap_size, (hsize_t)0, free_space, (hsize_t)(start_nobjs + nobjs)))
FAIL_STACK_ERROR
/* Get statistics for heap */
@@ -259,7 +266,7 @@ fill_heap(H5F_t *f, hid_t dxpl, haddr_t fh_addr, const H5HF_create_t *cparam,
/* Loop over inserting objects into the root direct block, until there's no more space */
free_frag_size = 0;
- while(heap_stats.man_free_space > (sizeof(obj) + OBJ_PREFIX_LEN)) {
+ while((heap_stats.man_free_space - extra_free) > (sizeof(obj) + OBJ_PREFIX_LEN)) {
/* Initialize object buffer */
for(u = 0; u < sizeof(obj); u++)
obj[u] = u + nobjs;
@@ -280,9 +287,16 @@ fill_heap(H5F_t *f, hid_t dxpl, haddr_t fh_addr, const H5HF_create_t *cparam,
HDmemcpy(&ids[(nobjs - 1) * HEAP_ID_LEN], heap_id, HEAP_ID_LEN);
/* Check stats for heap */
- if((heap_stats.man_free_space - (sizeof(obj) + OBJ_PREFIX_LEN)) <= free_overhead)
- free_frag_size = heap_stats.man_free_space - (sizeof(obj) + OBJ_PREFIX_LEN);
- if(check_stats(f, dxpl, fh_addr, heap_size, heap_size, (hsize_t)0, (hsize_t)(data_size - ((nobjs * (sizeof(obj) + OBJ_PREFIX_LEN)) + free_frag_size)), (hsize_t)(start_nobjs + nobjs)))
+ if(((heap_stats.man_free_space - extra_free) - sizeof(obj)) <= free_overhead)
+ free_frag_size = (heap_stats.man_free_space - extra_free) - (sizeof(obj) + OBJ_PREFIX_LEN);
+#ifdef QAK
+HDfprintf(stderr, "free_frag_size = %u\n", free_frag_size);
+#endif /* QAK */
+ free_space = extra_free + (data_size - ((nobjs * (sizeof(obj) + OBJ_PREFIX_LEN)) + free_frag_size));
+#ifdef QAK
+HDfprintf(stderr, "free_space = %Hu\n", free_space);
+#endif /* QAK */
+ if(check_stats(f, dxpl, fh_addr, heap_size, heap_size, (hsize_t)0, free_space, (hsize_t)(start_nobjs + nobjs)))
FAIL_STACK_ERROR
/* Get statistics for heap */
@@ -291,8 +305,8 @@ fill_heap(H5F_t *f, hid_t dxpl, haddr_t fh_addr, const H5HF_create_t *cparam,
} /* end while */
/* Check for adding smaller last object to heap block */
- if(heap_stats.man_free_space > 0) {
- last_obj_len = (size_t)(heap_stats.man_free_space - OBJ_PREFIX_LEN);
+ if((heap_stats.man_free_space - extra_free) > 0) {
+ last_obj_len = (size_t)((heap_stats.man_free_space - extra_free) - OBJ_PREFIX_LEN);
/* Initialize object buffer */
for(u = 0; u < sizeof(obj); u++)
@@ -315,7 +329,7 @@ fill_heap(H5F_t *f, hid_t dxpl, haddr_t fh_addr, const H5HF_create_t *cparam,
HDmemcpy(&ids[(nobjs - 1) * HEAP_ID_LEN], heap_id, HEAP_ID_LEN);
/* Verify that the heap is full */
- if(check_stats(f, dxpl, fh_addr, heap_size, heap_size, (hsize_t)0, (hsize_t)0, (hsize_t)(start_nobjs + nobjs)))
+ if(check_stats(f, dxpl, fh_addr, heap_size, heap_size, (hsize_t)0, extra_free, (hsize_t)(start_nobjs + nobjs)))
FAIL_STACK_ERROR
} /* end if */
else
@@ -582,6 +596,7 @@ test_abs_insert_second(hid_t fapl, H5HF_create_t *cparam)
if(HDmemcmp(obj, robj, sizeof(obj)))
FAIL_STACK_ERROR
+ /* Insert second object */
HDmemset(heap_id, 0, sizeof(heap_id));
if(H5HF_insert(f, dxpl, fh_addr, sizeof(obj2), obj2, heap_id) < 0)
FAIL_STACK_ERROR
@@ -662,7 +677,7 @@ test_abs_insert_root_mult(hid_t fapl, H5HF_create_t *cparam)
TESTING("inserting objects to fill absolute heap's root direct block");
/* Fill the heap up */
- if(fill_heap(f, dxpl, fh_addr, cparam, (hsize_t)cparam->managed.start_block_size, cparam->managed.start_block_size, 0, NULL))
+ if(fill_heap(f, dxpl, fh_addr, cparam, (hsize_t)cparam->managed.start_block_size, cparam->managed.start_block_size, (hsize_t)0, 0, NULL))
FAIL_STACK_ERROR
PASSED()
@@ -738,7 +753,7 @@ test_abs_insert_force_indirect(hid_t fapl, H5HF_create_t *cparam)
TESTING("inserting objects to create root indirect block");
/* Fill the heap up */
- if(fill_heap(f, dxpl, fh_addr, cparam, (hsize_t)cparam->managed.start_block_size, cparam->managed.start_block_size, 0, &nobjs))
+ if(fill_heap(f, dxpl, fh_addr, cparam, (hsize_t)cparam->managed.start_block_size, cparam->managed.start_block_size, (hsize_t)0, 0, &nobjs))
FAIL_STACK_ERROR
/* Insert one more object, to force root indirect block creation */
@@ -829,12 +844,12 @@ test_abs_insert_fill_second(hid_t fapl, H5HF_create_t *cparam)
TESTING("inserting objects to fill second direct block");
/* Fill the first direct block heap up */
- if(fill_heap(f, dxpl, fh_addr, cparam, (hsize_t)cparam->managed.start_block_size, cparam->managed.start_block_size, tot_nobjs, &nobjs))
+ if(fill_heap(f, dxpl, fh_addr, cparam, (hsize_t)cparam->managed.start_block_size, cparam->managed.start_block_size, (hsize_t)0, tot_nobjs, &nobjs))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
/* Fill the second direct block heap up (also creates initial root indirect block) */
- if(fill_heap(f, dxpl, fh_addr, cparam, (hsize_t)(2 * cparam->managed.start_block_size), cparam->managed.start_block_size, tot_nobjs, &nobjs))
+ if(fill_heap(f, dxpl, fh_addr, cparam, (hsize_t)(2 * cparam->managed.start_block_size), cparam->managed.start_block_size, (hsize_t)0, tot_nobjs, &nobjs))
FAIL_STACK_ERROR
PASSED()
@@ -913,12 +928,12 @@ test_abs_insert_third_direct(hid_t fapl, H5HF_create_t *cparam)
TESTING("inserting objects to create third direct block");
/* Fill the first direct block up */
- if(fill_heap(f, dxpl, fh_addr, cparam, (hsize_t)cparam->managed.start_block_size, cparam->managed.start_block_size, tot_nobjs, &nobjs))
+ if(fill_heap(f, dxpl, fh_addr, cparam, (hsize_t)cparam->managed.start_block_size, cparam->managed.start_block_size, (hsize_t)0, tot_nobjs, &nobjs))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
/* Fill the second direct block heap up (also creates initial root indirect block) */
- if(fill_heap(f, dxpl, fh_addr, cparam, (hsize_t)(2 * cparam->managed.start_block_size), cparam->managed.start_block_size, tot_nobjs, &nobjs))
+ if(fill_heap(f, dxpl, fh_addr, cparam, (hsize_t)(2 * cparam->managed.start_block_size), cparam->managed.start_block_size, (hsize_t)0, tot_nobjs, &nobjs))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
@@ -1019,7 +1034,7 @@ test_abs_fill_first_row(hid_t fapl, H5HF_create_t *cparam)
/* Loop over filling direct blocks, until first root indirect row is full */
for(u = 0; u < cparam->managed.width; u++) {
/* Fill a direct heap block up */
- if(fill_heap(f, dxpl, fh_addr, cparam, (hsize_t)(u + 1) * cparam->managed.start_block_size, cparam->managed.start_block_size, tot_nobjs, &nobjs))
+ if(fill_heap(f, dxpl, fh_addr, cparam, (hsize_t)(u + 1) * cparam->managed.start_block_size, cparam->managed.start_block_size, (hsize_t)0, tot_nobjs, &nobjs))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
} /* end for */
@@ -1101,7 +1116,7 @@ test_abs_start_second_row(hid_t fapl, H5HF_create_t *cparam)
/* Loop over filling direct blocks, until first root indirect row is full */
for(u = 0; u < cparam->managed.width; u++) {
/* Fill a direct heap block up */
- if(fill_heap(f, dxpl, fh_addr, cparam, (hsize_t)(u + 1) * cparam->managed.start_block_size, cparam->managed.start_block_size, tot_nobjs, &nobjs))
+ if(fill_heap(f, dxpl, fh_addr, cparam, (hsize_t)(u + 1) * cparam->managed.start_block_size, cparam->managed.start_block_size, (hsize_t)0, tot_nobjs, &nobjs))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
} /* end for */
@@ -1203,7 +1218,7 @@ test_abs_fill_second_row(hid_t fapl, H5HF_create_t *cparam)
/* Loop over filling direct blocks, until first root indirect row is full */
for(u = 0; u < cparam->managed.width; u++) {
/* Fill a direct heap block up */
- if(fill_heap(f, dxpl, fh_addr, cparam, (hsize_t)(u + 1) * cparam->managed.start_block_size, cparam->managed.start_block_size, tot_nobjs, &nobjs))
+ if(fill_heap(f, dxpl, fh_addr, cparam, (hsize_t)(u + 1) * cparam->managed.start_block_size, cparam->managed.start_block_size, (hsize_t)0, tot_nobjs, &nobjs))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
} /* end for */
@@ -1211,7 +1226,7 @@ test_abs_fill_second_row(hid_t fapl, H5HF_create_t *cparam)
/* Loop over filling direct blocks, until second root indirect row is full */
for(u = 0; u < cparam->managed.width; u++) {
/* Fill a direct heap block up */
- if(fill_heap(f, dxpl, fh_addr, cparam, (hsize_t)((cparam->managed.width * cparam->managed.start_block_size) + (u + 1) * cparam->managed.start_block_size), cparam->managed.start_block_size, tot_nobjs, &nobjs))
+ if(fill_heap(f, dxpl, fh_addr, cparam, (hsize_t)((cparam->managed.width * cparam->managed.start_block_size) + (u + 1) * cparam->managed.start_block_size), cparam->managed.start_block_size, (hsize_t)0, tot_nobjs, &nobjs))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
} /* end for */
@@ -1295,7 +1310,7 @@ test_abs_start_third_row(hid_t fapl, H5HF_create_t *cparam)
/* Loop over filling direct blocks, until first root indirect row is full */
for(u = 0; u < cparam->managed.width; u++) {
/* Fill a direct heap block up */
- if(fill_heap(f, dxpl, fh_addr, cparam, (hsize_t)(u + 1) * cparam->managed.start_block_size, cparam->managed.start_block_size, tot_nobjs, &nobjs))
+ if(fill_heap(f, dxpl, fh_addr, cparam, (hsize_t)(u + 1) * cparam->managed.start_block_size, cparam->managed.start_block_size, (hsize_t)0, tot_nobjs, &nobjs))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
} /* end for */
@@ -1303,7 +1318,7 @@ test_abs_start_third_row(hid_t fapl, H5HF_create_t *cparam)
/* Loop over filling direct blocks, until second root indirect row is full */
for(u = 0; u < cparam->managed.width; u++) {
/* Fill a direct heap block up */
- if(fill_heap(f, dxpl, fh_addr, cparam, (hsize_t)((cparam->managed.width * cparam->managed.start_block_size) + (u + 1) * cparam->managed.start_block_size), cparam->managed.start_block_size, tot_nobjs, &nobjs))
+ if(fill_heap(f, dxpl, fh_addr, cparam, (hsize_t)((cparam->managed.width * cparam->managed.start_block_size) + (u + 1) * cparam->managed.start_block_size), cparam->managed.start_block_size, (hsize_t)0, tot_nobjs, &nobjs))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
} /* end for */
@@ -1414,7 +1429,7 @@ test_abs_fill_fourth_row(hid_t fapl, H5HF_create_t *cparam)
for(u = 0; u < cparam->managed.width; u++) {
/* Fill a direct heap block up */
heap_size += block_size;
- if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, tot_nobjs, &nobjs))
+ if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, (hsize_t)0, tot_nobjs, &nobjs))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
} /* end for */
@@ -1506,7 +1521,7 @@ test_abs_fill_all_root_direct(hid_t fapl, H5HF_create_t *cparam)
for(u = 0; u < cparam->managed.width; u++) {
/* Fill a direct heap block up */
heap_size += block_size;
- if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, tot_nobjs, &nobjs))
+ if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, (hsize_t)0, tot_nobjs, &nobjs))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
} /* end for */
@@ -1605,7 +1620,7 @@ test_abs_first_recursive_indirect(hid_t fapl, H5HF_create_t *cparam)
for(u = 0; u < cparam->managed.width; u++) {
/* Fill a direct heap block up */
heap_size += block_size;
- if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, tot_nobjs, &nobjs))
+ if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, (hsize_t)0, tot_nobjs, &nobjs))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
} /* end for */
@@ -1731,7 +1746,7 @@ test_abs_second_direct_recursive_indirect(hid_t fapl, H5HF_create_t *cparam)
for(u = 0; u < cparam->managed.width; u++) {
/* Fill a direct heap block up */
heap_size += block_size;
- if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, tot_nobjs, &nobjs))
+ if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, (hsize_t)0, tot_nobjs, &nobjs))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
} /* end for */
@@ -1746,7 +1761,7 @@ test_abs_second_direct_recursive_indirect(hid_t fapl, H5HF_create_t *cparam)
/* Fill the first direct block in the recursive indirect block up */
heap_size += cparam->managed.start_block_size;
- if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, cparam->managed.start_block_size, tot_nobjs, &nobjs))
+ if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, cparam->managed.start_block_size, (hsize_t)0, tot_nobjs, &nobjs))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
@@ -1862,7 +1877,7 @@ test_abs_fill_first_recursive_indirect(hid_t fapl, H5HF_create_t *cparam)
for(u = 0; u < cparam->managed.width; u++) {
/* Fill a direct heap block up */
heap_size += block_size;
- if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, tot_nobjs, &nobjs))
+ if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, (hsize_t)0, tot_nobjs, &nobjs))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
} /* end for */
@@ -1886,7 +1901,7 @@ test_abs_fill_first_recursive_indirect(hid_t fapl, H5HF_create_t *cparam)
for(u = 0; u < cparam->managed.width; u++) {
/* Fill a direct heap block up */
heap_size += block_size;
- if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, tot_nobjs, &nobjs))
+ if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, (hsize_t)0, tot_nobjs, &nobjs))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
} /* end for */
@@ -1989,7 +2004,7 @@ test_abs_second_recursive_indirect(hid_t fapl, H5HF_create_t *cparam)
for(u = 0; u < cparam->managed.width; u++) {
/* Fill a direct heap block up */
heap_size += block_size;
- if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, tot_nobjs, &nobjs))
+ if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, (hsize_t)0, tot_nobjs, &nobjs))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
} /* end for */
@@ -2013,7 +2028,7 @@ test_abs_second_recursive_indirect(hid_t fapl, H5HF_create_t *cparam)
for(u = 0; u < cparam->managed.width; u++) {
/* Fill a direct heap block up */
heap_size += block_size;
- if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, tot_nobjs, &nobjs))
+ if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, (hsize_t)0, tot_nobjs, &nobjs))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
} /* end for */
@@ -2140,7 +2155,7 @@ test_abs_fill_second_recursive_indirect(hid_t fapl, H5HF_create_t *cparam)
for(u = 0; u < cparam->managed.width; u++) {
/* Fill a direct heap block up */
heap_size += block_size;
- if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, tot_nobjs, &nobjs))
+ if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, (hsize_t)0, tot_nobjs, &nobjs))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
} /* end for */
@@ -2164,7 +2179,7 @@ test_abs_fill_second_recursive_indirect(hid_t fapl, H5HF_create_t *cparam)
for(u = 0; u < cparam->managed.width; u++) {
/* Fill a direct heap block up */
heap_size += block_size;
- if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, tot_nobjs, &nobjs))
+ if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, (hsize_t)0, tot_nobjs, &nobjs))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
} /* end for */
@@ -2188,7 +2203,7 @@ test_abs_fill_second_recursive_indirect(hid_t fapl, H5HF_create_t *cparam)
for(u = 0; u < cparam->managed.width; u++) {
/* Fill a direct heap block up */
heap_size += block_size;
- if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, tot_nobjs, &nobjs))
+ if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, (hsize_t)0, tot_nobjs, &nobjs))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
} /* end for */
@@ -2288,7 +2303,7 @@ test_abs_fill_recursive_indirect_row(hid_t fapl, H5HF_create_t *cparam)
for(u = 0; u < cparam->managed.width; u++) {
/* Fill a direct heap block up */
heap_size += block_size;
- if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, tot_nobjs, &nobjs))
+ if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, (hsize_t)0, tot_nobjs, &nobjs))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
} /* end for */
@@ -2314,7 +2329,7 @@ test_abs_fill_recursive_indirect_row(hid_t fapl, H5HF_create_t *cparam)
for(u = 0; u < cparam->managed.width; u++) {
/* Fill a direct heap block up */
heap_size += block_size;
- if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, tot_nobjs, &nobjs))
+ if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, (hsize_t)0, tot_nobjs, &nobjs))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
} /* end for */
@@ -2417,7 +2432,7 @@ test_abs_start_2nd_recursive_indirect(hid_t fapl, H5HF_create_t *cparam)
for(u = 0; u < cparam->managed.width; u++) {
/* Fill a direct heap block up */
heap_size += block_size;
- if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, tot_nobjs, &nobjs))
+ if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, (hsize_t)0, tot_nobjs, &nobjs))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
} /* end for */
@@ -2443,7 +2458,7 @@ test_abs_start_2nd_recursive_indirect(hid_t fapl, H5HF_create_t *cparam)
for(u = 0; u < cparam->managed.width; u++) {
/* Fill a direct heap block up */
heap_size += block_size;
- if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, tot_nobjs, &nobjs))
+ if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, (hsize_t)0, tot_nobjs, &nobjs))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
} /* end for */
@@ -2569,7 +2584,7 @@ test_abs_recursive_indirect_two_deep(hid_t fapl, H5HF_create_t *cparam)
for(u = 0; u < cparam->managed.width; u++) {
/* Fill a direct heap block up */
heap_size += block_size;
- if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, tot_nobjs, &nobjs))
+ if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, (hsize_t)0, tot_nobjs, &nobjs))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
} /* end for */
@@ -2596,7 +2611,7 @@ test_abs_recursive_indirect_two_deep(hid_t fapl, H5HF_create_t *cparam)
for(u = 0; u < cparam->managed.width; u++) {
/* Fill a direct heap block up */
heap_size += block_size;
- if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, tot_nobjs, &nobjs))
+ if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, (hsize_t)0, tot_nobjs, &nobjs))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
} /* end for */
@@ -2701,7 +2716,7 @@ test_abs_start_3rd_recursive_indirect(hid_t fapl, H5HF_create_t *cparam)
for(u = 0; u < cparam->managed.width; u++) {
/* Fill a direct heap block up */
heap_size += block_size;
- if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, tot_nobjs, &nobjs))
+ if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, (hsize_t)0, tot_nobjs, &nobjs))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
} /* end for */
@@ -2728,7 +2743,7 @@ test_abs_start_3rd_recursive_indirect(hid_t fapl, H5HF_create_t *cparam)
for(u = 0; u < cparam->managed.width; u++) {
/* Fill a direct heap block up */
heap_size += block_size;
- if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, tot_nobjs, &nobjs))
+ if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, (hsize_t)0, tot_nobjs, &nobjs))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
} /* end for */
@@ -2856,7 +2871,7 @@ test_abs_fill_first_3rd_recursive_indirect(hid_t fapl, H5HF_create_t *cparam)
for(u = 0; u < cparam->managed.width; u++) {
/* Fill a direct heap block up */
heap_size += block_size;
- if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, tot_nobjs, &nobjs))
+ if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, (hsize_t)0, tot_nobjs, &nobjs))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
} /* end for */
@@ -2883,7 +2898,7 @@ test_abs_fill_first_3rd_recursive_indirect(hid_t fapl, H5HF_create_t *cparam)
for(u = 0; u < cparam->managed.width; u++) {
/* Fill a direct heap block up */
heap_size += block_size;
- if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, tot_nobjs, &nobjs))
+ if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, (hsize_t)0, tot_nobjs, &nobjs))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
} /* end for */
@@ -2906,7 +2921,7 @@ test_abs_fill_first_3rd_recursive_indirect(hid_t fapl, H5HF_create_t *cparam)
for(u = 0; u < cparam->managed.width; u++) {
/* Fill a direct heap block up */
heap_size += block_size;
- if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, tot_nobjs, &nobjs))
+ if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, (hsize_t)0, tot_nobjs, &nobjs))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
} /* end for */
@@ -2932,7 +2947,7 @@ test_abs_fill_first_3rd_recursive_indirect(hid_t fapl, H5HF_create_t *cparam)
for(u = 0; u < cparam->managed.width; u++) {
/* Fill a direct heap block up */
heap_size += block_size;
- if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, tot_nobjs, &nobjs))
+ if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, (hsize_t)0, tot_nobjs, &nobjs))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
} /* end for */
@@ -3032,7 +3047,7 @@ test_abs_fill_3rd_recursive_indirect_row(hid_t fapl, H5HF_create_t *cparam)
for(u = 0; u < cparam->managed.width; u++) {
/* Fill a direct heap block up */
heap_size += block_size;
- if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, tot_nobjs, &nobjs))
+ if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, (hsize_t)0, tot_nobjs, &nobjs))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
} /* end for */
@@ -3059,7 +3074,7 @@ test_abs_fill_3rd_recursive_indirect_row(hid_t fapl, H5HF_create_t *cparam)
for(u = 0; u < cparam->managed.width; u++) {
/* Fill a direct heap block up */
heap_size += block_size;
- if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, tot_nobjs, &nobjs))
+ if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, (hsize_t)0, tot_nobjs, &nobjs))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
} /* end for */
@@ -3084,7 +3099,7 @@ test_abs_fill_3rd_recursive_indirect_row(hid_t fapl, H5HF_create_t *cparam)
for(u = 0; u < cparam->managed.width; u++) {
/* Fill a direct heap block up */
heap_size += block_size;
- if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, tot_nobjs, &nobjs))
+ if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, (hsize_t)0, tot_nobjs, &nobjs))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
} /* end for */
@@ -3110,7 +3125,7 @@ test_abs_fill_3rd_recursive_indirect_row(hid_t fapl, H5HF_create_t *cparam)
for(u = 0; u < cparam->managed.width; u++) {
/* Fill a direct heap block up */
heap_size += block_size;
- if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, tot_nobjs, &nobjs))
+ if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, (hsize_t)0, tot_nobjs, &nobjs))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
} /* end for */
@@ -3211,7 +3226,7 @@ test_abs_fill_all_3rd_recursive_indirect(hid_t fapl, H5HF_create_t *cparam)
for(u = 0; u < cparam->managed.width; u++) {
/* Fill a direct heap block up */
heap_size += block_size;
- if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, tot_nobjs, &nobjs))
+ if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, (hsize_t)0, tot_nobjs, &nobjs))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
} /* end for */
@@ -3238,7 +3253,7 @@ test_abs_fill_all_3rd_recursive_indirect(hid_t fapl, H5HF_create_t *cparam)
for(u = 0; u < cparam->managed.width; u++) {
/* Fill a direct heap block up */
heap_size += block_size;
- if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, tot_nobjs, &nobjs))
+ if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, (hsize_t)0, tot_nobjs, &nobjs))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
} /* end for */
@@ -3267,7 +3282,7 @@ test_abs_fill_all_3rd_recursive_indirect(hid_t fapl, H5HF_create_t *cparam)
for(u = 0; u < cparam->managed.width; u++) {
/* Fill a direct heap block up */
heap_size += block_size;
- if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, tot_nobjs, &nobjs))
+ if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, (hsize_t)0, tot_nobjs, &nobjs))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
} /* end for */
@@ -3296,7 +3311,7 @@ test_abs_fill_all_3rd_recursive_indirect(hid_t fapl, H5HF_create_t *cparam)
for(u = 0; u < cparam->managed.width; u++) {
/* Fill a direct heap block up */
heap_size += block_size;
- if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, tot_nobjs, &nobjs))
+ if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, (hsize_t)0, tot_nobjs, &nobjs))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
} /* end for */
@@ -3404,7 +3419,7 @@ test_abs_start_4th_recursive_indirect(hid_t fapl, H5HF_create_t *cparam)
for(u = 0; u < cparam->managed.width; u++) {
/* Fill a direct heap block up */
heap_size += block_size;
- if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, tot_nobjs, &nobjs))
+ if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, (hsize_t)0, tot_nobjs, &nobjs))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
} /* end for */
@@ -3431,7 +3446,7 @@ test_abs_start_4th_recursive_indirect(hid_t fapl, H5HF_create_t *cparam)
for(u = 0; u < cparam->managed.width; u++) {
/* Fill a direct heap block up */
heap_size += block_size;
- if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, tot_nobjs, &nobjs))
+ if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, (hsize_t)0, tot_nobjs, &nobjs))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
} /* end for */
@@ -3460,7 +3475,7 @@ test_abs_start_4th_recursive_indirect(hid_t fapl, H5HF_create_t *cparam)
for(u = 0; u < cparam->managed.width; u++) {
/* Fill a direct heap block up */
heap_size += block_size;
- if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, tot_nobjs, &nobjs))
+ if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, (hsize_t)0, tot_nobjs, &nobjs))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
} /* end for */
@@ -3489,7 +3504,7 @@ test_abs_start_4th_recursive_indirect(hid_t fapl, H5HF_create_t *cparam)
for(u = 0; u < cparam->managed.width; u++) {
/* Fill a direct heap block up */
heap_size += block_size;
- if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, tot_nobjs, &nobjs))
+ if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, (hsize_t)0, tot_nobjs, &nobjs))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
} /* end for */
@@ -3620,7 +3635,7 @@ test_abs_fill_first_4th_recursive_indirect(hid_t fapl, H5HF_create_t *cparam)
for(u = 0; u < cparam->managed.width; u++) {
/* Fill a direct heap block up */
heap_size += block_size;
- if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, tot_nobjs, &nobjs))
+ if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, (hsize_t)0, tot_nobjs, &nobjs))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
} /* end for */
@@ -3647,7 +3662,7 @@ test_abs_fill_first_4th_recursive_indirect(hid_t fapl, H5HF_create_t *cparam)
for(u = 0; u < cparam->managed.width; u++) {
/* Fill a direct heap block up */
heap_size += block_size;
- if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, tot_nobjs, &nobjs))
+ if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, (hsize_t)0, tot_nobjs, &nobjs))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
} /* end for */
@@ -3676,7 +3691,7 @@ test_abs_fill_first_4th_recursive_indirect(hid_t fapl, H5HF_create_t *cparam)
for(u = 0; u < cparam->managed.width; u++) {
/* Fill a direct heap block up */
heap_size += block_size;
- if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, tot_nobjs, &nobjs))
+ if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, (hsize_t)0, tot_nobjs, &nobjs))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
} /* end for */
@@ -3705,7 +3720,7 @@ test_abs_fill_first_4th_recursive_indirect(hid_t fapl, H5HF_create_t *cparam)
for(u = 0; u < cparam->managed.width; u++) {
/* Fill a direct heap block up */
heap_size += block_size;
- if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, tot_nobjs, &nobjs))
+ if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, (hsize_t)0, tot_nobjs, &nobjs))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
} /* end for */
@@ -3730,7 +3745,7 @@ test_abs_fill_first_4th_recursive_indirect(hid_t fapl, H5HF_create_t *cparam)
for(u = 0; u < cparam->managed.width; u++) {
/* Fill a direct heap block up */
heap_size += block_size;
- if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, tot_nobjs, &nobjs))
+ if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, (hsize_t)0, tot_nobjs, &nobjs))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
} /* end for */
@@ -3759,7 +3774,7 @@ test_abs_fill_first_4th_recursive_indirect(hid_t fapl, H5HF_create_t *cparam)
for(u = 0; u < cparam->managed.width; u++) {
/* Fill a direct heap block up */
heap_size += block_size;
- if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, tot_nobjs, &nobjs))
+ if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, (hsize_t)0, tot_nobjs, &nobjs))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
} /* end for */
@@ -3785,7 +3800,7 @@ test_abs_fill_first_4th_recursive_indirect(hid_t fapl, H5HF_create_t *cparam)
for(u = 0; u < cparam->managed.width; u++) {
/* Fill a direct heap block up */
heap_size += block_size;
- if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, tot_nobjs, &nobjs))
+ if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, (hsize_t)0, tot_nobjs, &nobjs))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
} /* end for */
@@ -3814,7 +3829,7 @@ test_abs_fill_first_4th_recursive_indirect(hid_t fapl, H5HF_create_t *cparam)
for(u = 0; u < cparam->managed.width; u++) {
/* Fill a direct heap block up */
heap_size += block_size;
- if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, tot_nobjs, &nobjs))
+ if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, (hsize_t)0, tot_nobjs, &nobjs))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
} /* end for */
@@ -3917,7 +3932,7 @@ test_abs_fill_4th_recursive_indirect_row(hid_t fapl, H5HF_create_t *cparam)
for(u = 0; u < cparam->managed.width; u++) {
/* Fill a direct heap block up */
heap_size += block_size;
- if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, tot_nobjs, &nobjs))
+ if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, (hsize_t)0, tot_nobjs, &nobjs))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
} /* end for */
@@ -3944,7 +3959,7 @@ test_abs_fill_4th_recursive_indirect_row(hid_t fapl, H5HF_create_t *cparam)
for(u = 0; u < cparam->managed.width; u++) {
/* Fill a direct heap block up */
heap_size += block_size;
- if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, tot_nobjs, &nobjs))
+ if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, (hsize_t)0, tot_nobjs, &nobjs))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
} /* end for */
@@ -3973,7 +3988,7 @@ test_abs_fill_4th_recursive_indirect_row(hid_t fapl, H5HF_create_t *cparam)
for(u = 0; u < cparam->managed.width; u++) {
/* Fill a direct heap block up */
heap_size += block_size;
- if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, tot_nobjs, &nobjs))
+ if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, (hsize_t)0, tot_nobjs, &nobjs))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
} /* end for */
@@ -4002,7 +4017,7 @@ test_abs_fill_4th_recursive_indirect_row(hid_t fapl, H5HF_create_t *cparam)
for(u = 0; u < cparam->managed.width; u++) {
/* Fill a direct heap block up */
heap_size += block_size;
- if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, tot_nobjs, &nobjs))
+ if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, (hsize_t)0, tot_nobjs, &nobjs))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
} /* end for */
@@ -4030,7 +4045,7 @@ test_abs_fill_4th_recursive_indirect_row(hid_t fapl, H5HF_create_t *cparam)
for(u = 0; u < cparam->managed.width; u++) {
/* Fill a direct heap block up */
heap_size += block_size;
- if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, tot_nobjs, &nobjs))
+ if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, (hsize_t)0, tot_nobjs, &nobjs))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
} /* end for */
@@ -4059,7 +4074,7 @@ test_abs_fill_4th_recursive_indirect_row(hid_t fapl, H5HF_create_t *cparam)
for(u = 0; u < cparam->managed.width; u++) {
/* Fill a direct heap block up */
heap_size += block_size;
- if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, tot_nobjs, &nobjs))
+ if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, (hsize_t)0, tot_nobjs, &nobjs))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
} /* end for */
@@ -4088,7 +4103,7 @@ test_abs_fill_4th_recursive_indirect_row(hid_t fapl, H5HF_create_t *cparam)
for(u = 0; u < cparam->managed.width; u++) {
/* Fill a direct heap block up */
heap_size += block_size;
- if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, tot_nobjs, &nobjs))
+ if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, (hsize_t)0, tot_nobjs, &nobjs))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
} /* end for */
@@ -4117,7 +4132,7 @@ test_abs_fill_4th_recursive_indirect_row(hid_t fapl, H5HF_create_t *cparam)
for(u = 0; u < cparam->managed.width; u++) {
/* Fill a direct heap block up */
heap_size += block_size;
- if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, tot_nobjs, &nobjs))
+ if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, (hsize_t)0, tot_nobjs, &nobjs))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
} /* end for */
@@ -4222,7 +4237,7 @@ test_abs_fill_all_4th_recursive_indirect(hid_t fapl, H5HF_create_t *cparam)
for(u = 0; u < cparam->managed.width; u++) {
/* Fill a direct heap block up */
heap_size += block_size;
- if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, tot_nobjs, &nobjs))
+ if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, (hsize_t)0, tot_nobjs, &nobjs))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
} /* end for */
@@ -4249,7 +4264,7 @@ test_abs_fill_all_4th_recursive_indirect(hid_t fapl, H5HF_create_t *cparam)
for(u = 0; u < cparam->managed.width; u++) {
/* Fill a direct heap block up */
heap_size += block_size;
- if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, tot_nobjs, &nobjs))
+ if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, (hsize_t)0, tot_nobjs, &nobjs))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
} /* end for */
@@ -4278,7 +4293,7 @@ test_abs_fill_all_4th_recursive_indirect(hid_t fapl, H5HF_create_t *cparam)
for(u = 0; u < cparam->managed.width; u++) {
/* Fill a direct heap block up */
heap_size += block_size;
- if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, tot_nobjs, &nobjs))
+ if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, (hsize_t)0, tot_nobjs, &nobjs))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
} /* end for */
@@ -4307,7 +4322,7 @@ test_abs_fill_all_4th_recursive_indirect(hid_t fapl, H5HF_create_t *cparam)
for(u = 0; u < cparam->managed.width; u++) {
/* Fill a direct heap block up */
heap_size += block_size;
- if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, tot_nobjs, &nobjs))
+ if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, (hsize_t)0, tot_nobjs, &nobjs))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
} /* end for */
@@ -4338,7 +4353,7 @@ test_abs_fill_all_4th_recursive_indirect(hid_t fapl, H5HF_create_t *cparam)
for(u = 0; u < cparam->managed.width; u++) {
/* Fill a direct heap block up */
heap_size += block_size;
- if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, tot_nobjs, &nobjs))
+ if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, (hsize_t)0, tot_nobjs, &nobjs))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
} /* end for */
@@ -4367,7 +4382,7 @@ test_abs_fill_all_4th_recursive_indirect(hid_t fapl, H5HF_create_t *cparam)
for(u = 0; u < cparam->managed.width; u++) {
/* Fill a direct heap block up */
heap_size += block_size;
- if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, tot_nobjs, &nobjs))
+ if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, (hsize_t)0, tot_nobjs, &nobjs))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
} /* end for */
@@ -4396,7 +4411,7 @@ test_abs_fill_all_4th_recursive_indirect(hid_t fapl, H5HF_create_t *cparam)
for(u = 0; u < cparam->managed.width; u++) {
/* Fill a direct heap block up */
heap_size += block_size;
- if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, tot_nobjs, &nobjs))
+ if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, (hsize_t)0, tot_nobjs, &nobjs))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
} /* end for */
@@ -4425,7 +4440,7 @@ test_abs_fill_all_4th_recursive_indirect(hid_t fapl, H5HF_create_t *cparam)
for(u = 0; u < cparam->managed.width; u++) {
/* Fill a direct heap block up */
heap_size += block_size;
- if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, tot_nobjs, &nobjs))
+ if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, (hsize_t)0, tot_nobjs, &nobjs))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
} /* end for */
@@ -4548,7 +4563,7 @@ HDfprintf(stderr, "%u ", u);
#endif /* QAK */
/* Fill a direct heap block up */
heap_size += block_size;
- if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, tot_nobjs, &nobjs))
+ if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, (hsize_t)0, tot_nobjs, &nobjs))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
} /* end for */
@@ -4596,7 +4611,7 @@ HDfprintf(stderr, "%u ", u);
#endif /* QAK */
/* Fill a direct heap block up */
heap_size += block_size;
- if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, tot_nobjs, &nobjs))
+ if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, (hsize_t)0, tot_nobjs, &nobjs))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
} /* end for */
@@ -4634,7 +4649,7 @@ HDfprintf(stderr, "3rd indirect block # = %u\n", x);
for(u = 0; u < cparam->managed.width; u++) {
/* Fill a direct heap block up */
heap_size += block_size;
- if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, tot_nobjs, &nobjs))
+ if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, (hsize_t)0, tot_nobjs, &nobjs))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
} /* end for */
@@ -4681,7 +4696,7 @@ HDfprintf(stderr, "%u ", u);
#endif /* QAK */
/* Fill a direct heap block up */
heap_size += block_size;
- if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, tot_nobjs, &nobjs))
+ if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, (hsize_t)0, tot_nobjs, &nobjs))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
} /* end for */
@@ -4721,7 +4736,7 @@ HDfprintf(stderr, "4th indirect block # = %u\n", z);
for(u = 0; u < cparam->managed.width; u++) {
/* Fill a direct heap block up */
heap_size += block_size;
- if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, tot_nobjs, &nobjs))
+ if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, (hsize_t)0, tot_nobjs, &nobjs))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
} /* end for */
@@ -4768,7 +4783,7 @@ HDfprintf(stderr, "%u ", u);
#endif /* QAK */
/* Fill a direct heap block up */
heap_size += block_size;
- if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, tot_nobjs, &nobjs))
+ if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, (hsize_t)0, tot_nobjs, &nobjs))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
} /* end for */
@@ -4806,7 +4821,7 @@ HDfprintf(stderr, "3rd indirect block # = %u\n", x);
for(u = 0; u < cparam->managed.width; u++) {
/* Fill a direct heap block up */
heap_size += block_size;
- if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, tot_nobjs, &nobjs))
+ if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, (hsize_t)0, tot_nobjs, &nobjs))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
} /* end for */
@@ -4853,7 +4868,7 @@ HDfprintf(stderr, "%u ", u);
#endif /* QAK */
/* Fill a direct heap block up */
heap_size += block_size;
- if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, tot_nobjs, &nobjs))
+ if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, (hsize_t)0, tot_nobjs, &nobjs))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
} /* end for */
@@ -4892,7 +4907,7 @@ HDfprintf(stderr, "\n");
tot_nobjs++;
heap_size += cparam->managed.start_block_size;
- free_space = cparam->managed.start_block_size - ((sizeof(obj) + OBJ_PREFIX_LEN) + DBLOCK_OVERHEAD + (cparam->managed.max_index / 8));
+ free_space = cparam->managed.start_block_size - ((sizeof(obj) + OBJ_PREFIX_LEN) + OBJ_PREFIX_LEN + DBLOCK_OVERHEAD + (cparam->managed.max_index / 8));
if(check_stats(f, H5P_DATASET_XFER_DEFAULT, fh_addr, heap_size, heap_size, (hsize_t)0, free_space, (hsize_t)tot_nobjs))
FAIL_STACK_ERROR
@@ -4923,7 +4938,8 @@ error:
* Function: test_abs_skip_start_block
*
* Purpose: Test inserting object into absolute heap which is too large
- * for starting block size
+ * for starting block size, which forces root indirect block
+ * creation
*
* Return: Success: 0
*
@@ -4983,7 +4999,7 @@ test_abs_skip_start_block(hid_t fapl, H5HF_create_t *cparam)
HDmemset(heap_id, 0, sizeof(heap_id));
if(H5HF_insert(f, dxpl, fh_addr, (cparam->managed.start_block_size + 1), obj, heap_id) < 0)
FAIL_STACK_ERROR
- free_space = (2 * cparam->managed.width * (cparam->managed.start_block_size - (OBJ_PREFIX_LEN + DBLOCK_OVERHEAD + (cparam->managed.max_index / 8)))) + (2 * cparam->managed.start_block_size) - (((cparam->managed.start_block_size + 1) + OBJ_PREFIX_LEN) + DBLOCK_OVERHEAD + (cparam->managed.max_index / 8));
+ free_space = (2 * cparam->managed.width * (cparam->managed.start_block_size - (OBJ_PREFIX_LEN + DBLOCK_OVERHEAD + (cparam->managed.max_index / 8)))) + (2 * cparam->managed.start_block_size) - (((cparam->managed.start_block_size + 1) + OBJ_PREFIX_LEN) + OBJ_PREFIX_LEN + DBLOCK_OVERHEAD + (cparam->managed.max_index / 8));
if(check_stats(f, H5P_DATASET_XFER_DEFAULT, fh_addr, (hsize_t)(2 * cparam->managed.start_block_size), (hsize_t)(2 * cparam->managed.start_block_size), (hsize_t)0, free_space, (hsize_t)1))
FAIL_STACK_ERROR
@@ -4991,7 +5007,7 @@ test_abs_skip_start_block(hid_t fapl, H5HF_create_t *cparam)
robj = H5MM_malloc(cparam->managed.start_block_size + 1);
if(H5HF_read(f, dxpl, fh_addr, heap_id, robj) < 0)
FAIL_STACK_ERROR
- if(HDmemcmp(obj, robj, sizeof(obj)))
+ if(HDmemcmp(obj, robj, (cparam->managed.start_block_size + 1)))
FAIL_STACK_ERROR
PASSED()
@@ -5016,6 +5032,321 @@ error:
/*-------------------------------------------------------------------------
+ * Function: test_abs_skip_start_block_add_back
+ *
+ * Purpose: Test inserting object into absolute heap which is too large
+ * for starting block size, which forces root indirect block
+ * creation, then add object which fits in skipped direct block
+ *
+ * Return: Success: 0
+ *
+ * Failure: 1
+ *
+ * Programmer: Quincey Koziol
+ * Tuesday, March 28, 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+test_abs_skip_start_block_add_back(hid_t fapl, H5HF_create_t *cparam)
+{
+ hid_t file = -1; /* File ID */
+ hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */
+ char filename[1024]; /* Filename to use */
+ H5F_t *f = NULL; /* Internal file object pointer */
+ haddr_t fh_addr; /* Address of fractal heap created */
+ size_t id_len; /* Size of fractal heap IDs */
+ unsigned char *obj = NULL; /* Buffer for object to insert */
+ unsigned char *robj = NULL; /* Buffer for object to read */
+ unsigned char obj2[20]; /* Buffer for second object to insert */
+ unsigned char robj2[20]; /* Buffer for reading second object */
+ unsigned char heap_id[HEAP_ID_LEN]; /* Heap ID for object inserted */
+ hsize_t free_space; /* Size of free space in heap */
+ size_t obj_size; /* Size of object to add */
+ unsigned u; /* Local index variable */
+
+ /* Set the filename to use for this test (dependent on fapl) */
+ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
+
+ /* Create the file to work on */
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
+
+ /* Get a pointer to the internal file object */
+ if(NULL == (f = H5I_object(file)))
+ STACK_ERROR
+
+ /* Create absolute heap */
+ if(H5HF_create(f, dxpl, cparam, &fh_addr/*out*/, &id_len/*out*/) < 0)
+ FAIL_STACK_ERROR
+ if(!H5F_addr_defined(fh_addr))
+ FAIL_STACK_ERROR
+ if(id_len > HEAP_ID_LEN)
+ FAIL_STACK_ERROR
+ if(check_stats(f, H5P_DATASET_XFER_DEFAULT, fh_addr, (hsize_t)0, (hsize_t)0, (hsize_t)0, (hsize_t)0, (hsize_t)0))
+ FAIL_STACK_ERROR
+
+ /* Initialize object buffer */
+ obj_size = cparam->managed.start_block_size + 1;
+ obj = H5MM_malloc(obj_size);
+ for(u = 0; u < obj_size; u++)
+ obj[u] = u;
+
+ /*
+ * Test inserting object into absolute heap which doesn't fit into starting
+ * block size
+ */
+ TESTING("skipping starting block, then adding object back to first block");
+ HDmemset(heap_id, 0, sizeof(heap_id));
+ if(H5HF_insert(f, dxpl, fh_addr, obj_size, obj, heap_id) < 0)
+ FAIL_STACK_ERROR
+ free_space = (2 * cparam->managed.width * (cparam->managed.start_block_size - (OBJ_PREFIX_LEN + DBLOCK_OVERHEAD + (cparam->managed.max_index / 8)))) + (2 * cparam->managed.start_block_size) - ((obj_size + OBJ_PREFIX_LEN) + OBJ_PREFIX_LEN + DBLOCK_OVERHEAD + (cparam->managed.max_index / 8));
+ if(check_stats(f, H5P_DATASET_XFER_DEFAULT, fh_addr, (hsize_t)(2 * cparam->managed.start_block_size), (hsize_t)(2 * cparam->managed.start_block_size), (hsize_t)0, free_space, (hsize_t)1))
+ FAIL_STACK_ERROR
+
+ /* Check reading back in the object */
+ robj = H5MM_malloc(obj_size);
+ if(H5HF_read(f, dxpl, fh_addr, heap_id, robj) < 0)
+ FAIL_STACK_ERROR
+ if(HDmemcmp(obj, robj, obj_size))
+ FAIL_STACK_ERROR
+
+ /* Insert an object to fill up the heap block just created */
+
+ /* Initialize object buffer */
+ H5MM_xfree(obj);
+ obj_size = (2 * cparam->managed.start_block_size) - (OBJ_PREFIX_LEN + (cparam->managed.start_block_size + 1 + OBJ_PREFIX_LEN) + DBLOCK_OVERHEAD + (cparam->managed.max_index / 8));
+ obj = H5MM_malloc(obj_size);
+ for(u = 0; u < obj_size; u++)
+ obj[u] = u;
+
+ HDmemset(heap_id, 0, sizeof(heap_id));
+ if(H5HF_insert(f, dxpl, fh_addr, obj_size, obj, heap_id) < 0)
+ FAIL_STACK_ERROR
+ free_space -= obj_size; /* no object prefix, there's no more space in the node */
+ if(check_stats(f, H5P_DATASET_XFER_DEFAULT, fh_addr, (hsize_t)(2 * cparam->managed.start_block_size), (hsize_t)(2 * cparam->managed.start_block_size), (hsize_t)0, free_space, (hsize_t)2))
+ FAIL_STACK_ERROR
+
+ /* Check reading back in the object */
+ H5MM_xfree(robj);
+ robj = H5MM_malloc(obj_size);
+ if(H5HF_read(f, dxpl, fh_addr, heap_id, robj) < 0)
+ FAIL_STACK_ERROR
+ if(HDmemcmp(obj, robj, obj_size))
+ FAIL_STACK_ERROR
+
+ /* Insert second "real" object, which should go in earlier direct block */
+ HDmemset(heap_id, 0, sizeof(heap_id));
+ if(H5HF_insert(f, dxpl, fh_addr, sizeof(obj2), obj2, heap_id) < 0)
+ FAIL_STACK_ERROR
+ free_space -= (OBJ_PREFIX_LEN + sizeof(obj2));
+ if(check_stats(f, H5P_DATASET_XFER_DEFAULT, fh_addr, (hsize_t)(3 * cparam->managed.start_block_size), (hsize_t)(3 * cparam->managed.start_block_size), (hsize_t)0, free_space, (hsize_t)3))
+ FAIL_STACK_ERROR
+
+ /* Check reading back in the second object */
+ if(H5HF_read(f, dxpl, fh_addr, heap_id, robj2) < 0)
+ FAIL_STACK_ERROR
+ if(HDmemcmp(obj2, robj2, sizeof(obj2)))
+ FAIL_STACK_ERROR
+
+ PASSED()
+
+ /* Close the file */
+ if(H5Fclose(file) < 0)
+ TEST_ERROR
+
+ /* All tests passed */
+ H5MM_xfree(obj);
+ H5MM_xfree(robj);
+ return(0);
+
+error:
+ H5E_BEGIN_TRY {
+ H5Fclose(file);
+ H5MM_xfree(obj);
+ H5MM_xfree(robj);
+ } H5E_END_TRY;
+ return(1);
+} /* test_abs_skip_start_block_add_back() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: test_abs_skip_start_block_add_skipped
+ *
+ * Purpose: Test inserting object into absolute heap which is too large
+ * for starting block size, which forces root indirect block
+ * creation, then add objects to fill skipped direct blocks
+ * and add another object to start on next "normal" block
+ *
+ * Return: Success: 0
+ *
+ * Failure: 1
+ *
+ * Programmer: Quincey Koziol
+ * Tuesday, March 28, 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+test_abs_skip_start_block_add_skipped(hid_t fapl, H5HF_create_t *cparam)
+{
+ hid_t file = -1; /* File ID */
+ hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */
+ char filename[1024]; /* Filename to use */
+ H5F_t *f = NULL; /* Internal file object pointer */
+ haddr_t fh_addr; /* Address of fractal heap created */
+ size_t id_len; /* Size of fractal heap IDs */
+ unsigned char *obj = NULL; /* Buffer for object to insert */
+ unsigned char *robj = NULL; /* Buffer for object to read */
+ unsigned char obj2[20]; /* Buffer for second object to insert */
+ unsigned char robj2[20]; /* Buffer for reading second object */
+ unsigned char heap_id[HEAP_ID_LEN]; /* Heap ID for object inserted */
+ hsize_t free_space; /* Size of free space in heap */
+ unsigned nobjs = 0; /* Number of objects inserted */
+ unsigned tot_nobjs = 0; /* Total number of objects inserted */
+ size_t obj_size; /* Size of object to add */
+ size_t block_size; /* Size of block added */
+ hsize_t heap_size; /* Total size of heap */
+ unsigned u, v; /* Local index variable */
+
+ /* Set the filename to use for this test (dependent on fapl) */
+ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
+
+ /* Create the file to work on */
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
+
+ /* Get a pointer to the internal file object */
+ if(NULL == (f = H5I_object(file)))
+ STACK_ERROR
+
+ /* Create absolute heap */
+ if(H5HF_create(f, dxpl, cparam, &fh_addr/*out*/, &id_len/*out*/) < 0)
+ FAIL_STACK_ERROR
+ if(!H5F_addr_defined(fh_addr))
+ FAIL_STACK_ERROR
+ if(id_len > HEAP_ID_LEN)
+ FAIL_STACK_ERROR
+ if(check_stats(f, H5P_DATASET_XFER_DEFAULT, fh_addr, (hsize_t)0, (hsize_t)0, (hsize_t)0, (hsize_t)0, (hsize_t)0))
+ FAIL_STACK_ERROR
+
+ /* Initialize object buffer */
+ obj_size = cparam->managed.start_block_size + 1;
+ obj = H5MM_malloc(obj_size);
+ for(u = 0; u < obj_size; u++)
+ obj[u] = u;
+
+ /*
+ * Test inserting object into absolute heap which doesn't fit into starting
+ * block size
+ */
+ TESTING("skipping starting block, then adding objects to backfill and extend");
+ HDmemset(heap_id, 0, sizeof(heap_id));
+ if(H5HF_insert(f, dxpl, fh_addr, obj_size, obj, heap_id) < 0)
+ FAIL_STACK_ERROR
+ free_space = (2 * cparam->managed.width * (cparam->managed.start_block_size - (OBJ_PREFIX_LEN + DBLOCK_OVERHEAD + (cparam->managed.max_index / 8)))) + (2 * cparam->managed.start_block_size) - ((obj_size + OBJ_PREFIX_LEN) + OBJ_PREFIX_LEN + DBLOCK_OVERHEAD + (cparam->managed.max_index / 8));
+ if(check_stats(f, H5P_DATASET_XFER_DEFAULT, fh_addr, (hsize_t)(2 * cparam->managed.start_block_size), (hsize_t)(2 * cparam->managed.start_block_size), (hsize_t)0, free_space, (hsize_t)1))
+ FAIL_STACK_ERROR
+
+ /* Check reading back in the object */
+ robj = H5MM_malloc(obj_size);
+ if(H5HF_read(f, dxpl, fh_addr, heap_id, robj) < 0)
+ FAIL_STACK_ERROR
+ if(HDmemcmp(obj, robj, obj_size))
+ FAIL_STACK_ERROR
+
+ /* Insert an object to fill up the heap block just created */
+
+ /* Initialize object buffer */
+ H5MM_xfree(obj);
+ obj_size = (2 * cparam->managed.start_block_size) - (OBJ_PREFIX_LEN + (cparam->managed.start_block_size + 1 + OBJ_PREFIX_LEN) + DBLOCK_OVERHEAD + (cparam->managed.max_index / 8));
+ obj = H5MM_malloc(obj_size);
+ for(u = 0; u < obj_size; u++)
+ obj[u] = u;
+
+ HDmemset(heap_id, 0, sizeof(heap_id));
+ if(H5HF_insert(f, dxpl, fh_addr, obj_size, obj, heap_id) < 0)
+ FAIL_STACK_ERROR
+ free_space -= obj_size; /* no object prefix, there's no more space in the node */
+#ifdef QAK
+HDfprintf(stderr, "free_space = %Hu\n", free_space);
+#endif /* QAK */
+ if(check_stats(f, H5P_DATASET_XFER_DEFAULT, fh_addr, (hsize_t)(2 * cparam->managed.start_block_size), (hsize_t)(2 * cparam->managed.start_block_size), (hsize_t)0, free_space, (hsize_t)2))
+ FAIL_STACK_ERROR
+
+ /* Check reading back in the object */
+ H5MM_xfree(robj);
+ robj = H5MM_malloc(obj_size);
+ if(H5HF_read(f, dxpl, fh_addr, heap_id, robj) < 0)
+ FAIL_STACK_ERROR
+ if(HDmemcmp(obj, robj, obj_size))
+ FAIL_STACK_ERROR
+
+ /* Add row of blocks to "backfill" direct blocks that were skipped */
+ heap_size = (2 * cparam->managed.start_block_size) + cparam->managed.start_block_size;
+ block_size = cparam->managed.start_block_size;
+ tot_nobjs = nobjs = 2;
+ free_space -= cparam->managed.start_block_size - (OBJ_PREFIX_LEN + DBLOCK_OVERHEAD + (cparam->managed.max_index / 8));
+#ifdef QAK
+HDfprintf(stderr, "free_space = %Hu\n", free_space);
+#endif /* QAK */
+ for(v = 0; v < 2; v++) {
+ for(u = 0; u < cparam->managed.width; u++) {
+ /* Fill a direct heap block up */
+#ifdef QAK
+HDfprintf(stderr, "heap_size = %Hu\n", heap_size);
+#endif /* QAK */
+ if(fill_heap(f, dxpl, fh_addr, cparam, heap_size, block_size, free_space, tot_nobjs, &nobjs))
+ FAIL_STACK_ERROR
+ free_space -= cparam->managed.start_block_size - (OBJ_PREFIX_LEN + DBLOCK_OVERHEAD + (cparam->managed.max_index / 8));
+ heap_size += block_size;
+ tot_nobjs += nobjs;
+ } /* end for */
+ } /* end for */
+
+ /* Insert another object, which should go extend direct blocks, instead of backfill */
+ HDmemset(heap_id, 0, sizeof(heap_id));
+ if(H5HF_insert(f, dxpl, fh_addr, sizeof(obj2), obj2, heap_id) < 0)
+ FAIL_STACK_ERROR
+ heap_size += cparam->managed.start_block_size;
+ free_space = (2 * cparam->managed.start_block_size) - (OBJ_PREFIX_LEN + DBLOCK_OVERHEAD + (cparam->managed.max_index / 8));
+ free_space -= (OBJ_PREFIX_LEN + sizeof(obj2));
+#ifdef QAK
+HDfprintf(stderr, "free_space = %Hu\n", free_space);
+HDfprintf(stderr, "heap_size = %Hu\n", heap_size);
+#endif /* QAK */
+ tot_nobjs++;
+ if(check_stats(f, H5P_DATASET_XFER_DEFAULT, fh_addr, heap_size, heap_size, (hsize_t)0, free_space, (hsize_t)tot_nobjs))
+ FAIL_STACK_ERROR
+
+ /* Check reading back in the second object */
+ if(H5HF_read(f, dxpl, fh_addr, heap_id, robj2) < 0)
+ FAIL_STACK_ERROR
+ if(HDmemcmp(obj2, robj2, sizeof(obj2)))
+ FAIL_STACK_ERROR
+
+ PASSED()
+
+ /* Close the file */
+ if(H5Fclose(file) < 0)
+ TEST_ERROR
+
+ /* All tests passed */
+ H5MM_xfree(obj);
+ H5MM_xfree(robj);
+ return(0);
+
+error:
+ H5E_BEGIN_TRY {
+ H5Fclose(file);
+ H5MM_xfree(obj);
+ H5MM_xfree(robj);
+ } H5E_END_TRY;
+ return(1);
+} /* test_abs_skip_start_block_add_skipped() */
+
+
+/*-------------------------------------------------------------------------
* Function: run_tests
*
* Purpose: Test the fractal heap code, with different file access property
@@ -5078,8 +5409,10 @@ run_tests(hid_t fapl, H5HF_create_t *cparam)
HDfprintf(stderr, "Uncomment tests!\n");
#endif /* QAK */
- nerrors += test_abs_skip_start_block(fapl, cparam);
#ifndef QAK
+ nerrors += test_abs_skip_start_block(fapl, cparam);
+ nerrors += test_abs_skip_start_block_add_back(fapl, cparam);
+ nerrors += test_abs_skip_start_block_add_skipped(fapl, cparam);
#else /* QAK */
HDfprintf(stderr, "Uncomment tests!\n");
#endif /* QAK */