summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2006-03-28 14:03:46 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2006-03-28 14:03:46 (GMT)
commit935d75c50d35816e08af71be79ef8ace04f97d04 (patch)
tree2aff56744b8fe1211f0b3a43b9fb11a0f7923eaa
parent87050be33e3a5931ef88b4faee557c3bfdb809b4 (diff)
downloadhdf5-935d75c50d35816e08af71be79ef8ace04f97d04.zip
hdf5-935d75c50d35816e08af71be79ef8ace04f97d04.tar.gz
hdf5-935d75c50d35816e08af71be79ef8ace04f97d04.tar.bz2
[svn-r12162] Purpose:
Code checkpoint Description: Check in fractal heap code to add basic support for skipping direct blocks when an object is too large to fit in one. Platforms tested: FreeBSD 4.11 (sleipnir) Linux 2.4 (chicago)
-rw-r--r--src/H5HF.c18
-rw-r--r--src/H5HFcache.c7
-rw-r--r--src/H5HFflist.c3
-rw-r--r--src/H5HFint.c253
-rw-r--r--src/H5HFpkg.h16
-rw-r--r--src/H5HFprivate.h2
-rw-r--r--test/fheap.c1084
7 files changed, 521 insertions, 862 deletions
diff --git a/src/H5HF.c b/src/H5HF.c
index 33a1959..7eab53b 100644
--- a/src/H5HF.c
+++ b/src/H5HF.c
@@ -96,7 +96,8 @@ H5FL_DEFINE(H5HF_t);
*-------------------------------------------------------------------------
*/
herr_t
-H5HF_create(H5F_t *f, hid_t dxpl_id, H5HF_create_t *cparam, haddr_t *addr_p)
+H5HF_create(H5F_t *f, hid_t dxpl_id, H5HF_create_t *cparam, haddr_t *addr_p,
+ size_t *id_len_p)
{
H5HF_t *fh = NULL; /* The new fractal heap header information */
herr_t ret_value = SUCCEED; /* Return value */
@@ -109,6 +110,7 @@ H5HF_create(H5F_t *f, hid_t dxpl_id, H5HF_create_t *cparam, haddr_t *addr_p)
HDassert(f);
HDassert(cparam);
HDassert(addr_p);
+ HDassert(id_len_p);
/* Allocate & basic initialization for the shared header */
if(NULL == (fh = H5HF_alloc(f)))
@@ -122,6 +124,12 @@ H5HF_create(H5F_t *f, hid_t dxpl_id, H5HF_create_t *cparam, haddr_t *addr_p)
if(H5HF_init(fh, *addr_p, cparam) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't initialize shared fractal heap header")
+ /* Set the length of heap IDs */
+ *id_len_p = fh->id_len;
+#ifdef QAK
+HDfprintf(stderr, "%s: fh->id_len = %Zu\n", FUNC, fh->id_len);
+#endif /* QAK */
+
/* Cache the new fractal heap header */
if(H5AC_set(f, dxpl_id, H5AC_FHEAP_HDR, *addr_p, fh, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't add fractal heap header to cache")
@@ -232,6 +240,7 @@ H5HF_read(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_id,
H5HF_t *fh = NULL; /* The fractal heap header information */
const uint8_t *id = (const uint8_t *)_id; /* Object ID */
hsize_t obj_off; /* Object's offset in heap */
+ size_t obj_len; /* Object's length in heap */
herr_t ret_value = SUCCEED;
FUNC_ENTER_NOAPI(H5HF_read, FAIL)
@@ -250,10 +259,11 @@ H5HF_read(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_id,
if(NULL == (fh = H5AC_protect(f, dxpl_id, H5AC_FHEAP_HDR, addr, NULL, NULL, H5AC_READ)))
HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load fractal heap header")
- /* Decode the offset within the heap */
+ /* Decode the object offset within the heap & it's length */
UINT64DECODE_VAR(id, obj_off, fh->heap_off_size);
+ UINT64DECODE_VAR(id, obj_len, fh->id_len);
#ifdef QAK
-HDfprintf(stderr, "%s: obj_off = %Hu\n", FUNC, obj_off);
+HDfprintf(stderr, "%s: obj_off = %Hu, obj_len = %Zu\n", FUNC, obj_off, obj_len);
#endif /* QAK */
/* Check for standalone object */
@@ -262,7 +272,7 @@ HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "standalone blocks not supported ye
} /* end if */
else {
/* Read object from managed heap blocks */
- if(H5HF_man_read(fh, dxpl_id, obj_off, obj) < 0)
+ if(H5HF_man_read(fh, dxpl_id, obj_off, obj_len, obj) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "can't read object from fractal heap")
} /* end else */
diff --git a/src/H5HFcache.c b/src/H5HFcache.c
index ab6ea76..d59d164 100644
--- a/src/H5HFcache.c
+++ b/src/H5HFcache.c
@@ -180,9 +180,6 @@ H5HF_dtable_decode(H5F_t *f, const uint8_t **pp, H5HF_dtable_t *dtable)
/* Current # of rows in root indirect block */
UINT16DECODE(*pp, dtable->curr_root_rows);
- /* Next direct block's heap offset */
- H5F_DECODE_LENGTH(f, *pp, dtable->next_dir_block);
-
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5HF_dtable_decode() */
@@ -233,9 +230,6 @@ H5HF_dtable_encode(H5F_t *f, uint8_t **pp, const H5HF_dtable_t *dtable)
/* Current # of rows in root indirect block */
UINT16ENCODE(*pp, dtable->curr_root_rows);
- /* Next direct block's heap offset */
- H5F_ENCODE_LENGTH(f, *pp, dtable->next_dir_block);
-
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5HF_dtable_encode() */
@@ -1166,6 +1160,7 @@ HDfprintf(stderr, "%s: Load indirect block, addr = %a\n", FUNC, addr);
UINT32DECODE_VAR(p, iblock->ents[u].free_space, hdr->man_dtable.max_dir_blk_off_size)
else
UINT64DECODE_VAR(p, iblock->ents[u].free_space, hdr->heap_off_size)
+/* XXX: Add code to indirect block cache load routine to create range sections for skipped blocks */
} /* end for */
/* Sanity check */
diff --git a/src/H5HFflist.c b/src/H5HFflist.c
index 97e30e9..d879a23 100644
--- a/src/H5HFflist.c
+++ b/src/H5HFflist.c
@@ -263,7 +263,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 */
- if(flist->sec_count == 1) {
+/* XXX: Take out the "&& flist->bins == NULL" when bins converted back into single section */
+ if(flist->sec_count == 1 && flist->bins == NULL) {
HDassert(flist->single.node);
/* Check if we should allocate the bins */
diff --git a/src/H5HFint.c b/src/H5HFint.c
index 3fee747..b73f908 100644
--- a/src/H5HFint.c
+++ b/src/H5HFint.c
@@ -63,11 +63,25 @@
struct H5HF_section_free_node_t {
haddr_t sect_addr; /* Address of free list section in the file */
/* (Not actually used as address, used as unique ID for free list node) */
- haddr_t block_addr; /* Address of direct block for free section */
size_t sect_size; /* Size of free space section */
/* (section size is "object size", without the metadata overhead, since metadata overhead varies from block to block) */
- size_t block_size; /* Size of direct block */
+ /* (for range sections, this is the largest single section within the range) */
+ enum {H5HF_SECT_SINGLE, H5HF_SECT_RANGE} type; /* Type of free space section */
+ union {
+ struct {
+ haddr_t dblock_addr; /* Address of direct block for free section */
+ size_t dblock_size; /* Size of direct block */
/* (Needed to retrieve direct block) */
+ } single;
+ struct {
+ haddr_t iblock_addr; /* Address of indirect block for free section */
+ unsigned iblock_nrows; /* Number of rows in indirect block */
+ /* (Needed to retrieve indirect block) */
+ unsigned entry; /* Starting entry in indirect block */
+ unsigned num_entries; /* Number of entries covered */
+ hsize_t range; /* Size of actual free section */
+ } range;
+ } u;
};
@@ -153,6 +167,7 @@ static herr_t
H5HF_dtable_init(H5HF_dtable_t *dtable)
{
hsize_t tmp_block_size; /* Temporary block size */
+ hsize_t acc_block_off; /* Accumulated block offset */
size_t u; /* Local index variable */
herr_t ret_value = SUCCEED; /* Return value */
@@ -175,11 +190,17 @@ H5HF_dtable_init(H5HF_dtable_t *dtable)
/* Build table of block sizes for each row */
if(NULL == (dtable->row_block_size = H5MM_malloc(dtable->max_root_rows * sizeof(hsize_t))))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't create doubling table block size table")
+ if(NULL == (dtable->row_block_off = H5MM_malloc(dtable->max_root_rows * sizeof(hsize_t))))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't create doubling table block offset table")
tmp_block_size = dtable->cparam.start_block_size;
+ acc_block_off = dtable->cparam.start_block_size * dtable->cparam.width;
dtable->row_block_size[0] = dtable->cparam.start_block_size;
+ dtable->row_block_off[0] = 0;
for(u = 1; u < dtable->max_root_rows; u++) {
dtable->row_block_size[u] = tmp_block_size;
+ dtable->row_block_off[u] = acc_block_off;
tmp_block_size *= 2;
+ acc_block_off *= 2;
} /* end for */
done:
@@ -255,6 +276,9 @@ H5HF_dtable_dest(H5HF_dtable_t *dtable)
/* Free the block size lookup table for the doubling table */
H5MM_xfree(dtable->row_block_size);
+ /* Free the block offset lookup table for the doubling table */
+ H5MM_xfree(dtable->row_block_off);
+
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5HF_dtable_dest() */
@@ -340,6 +364,10 @@ H5HF_finish_init(H5HF_t *fh)
if(NULL == (fh->flist = H5HF_flist_create(fh->man_dtable.cparam.max_direct_size, H5HF_dblock_section_node_free_cb)))
HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't initialize free list info")
+ /* Set the size of heap IDs */
+ fh->id_len = fh->heap_off_size + MIN(fh->man_dtable.max_dir_blk_off_size,
+ ((H5V_log2_gen((hsize_t)fh->standalone_size) + 7) / 8));
+
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5HF_finish_init() */
@@ -582,11 +610,12 @@ HDmemset(dblock->blk, 0, dblock->size);
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for direct block free list section")
/* Set section's information */
- sec_node->block_addr = *addr_p;
- sec_node->block_size = block_size;
- sec_node->sect_addr = *addr_p + node->my_offset;
+ sec_node->sect_addr = block_off + node->my_offset;
/* (section size is "object size", without the metadata overhead) */
- sec_node->sect_size = node->size - H5HF_MAN_ABS_DIRECT_OBJ_PREFIX_LEN_DBLOCK(hdr, dblock);
+ sec_node->sect_size = node->size - H5HF_MAN_ABS_DIRECT_OBJ_PREFIX_LEN(hdr);
+ sec_node->type = H5HF_SECT_SINGLE;
+ 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)
@@ -721,11 +750,12 @@ H5HF_man_dblock_build_freelist(H5HF_direct_t *dblock, haddr_t dblock_addr)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for direct block free list section")
/* Set section's information */
- sec_node->block_addr = dblock_addr;
- sec_node->block_size = dblock->size;
- sec_node->sect_addr = dblock_addr + node->my_offset;
+ sec_node->sect_addr = dblock->block_off + node->my_offset;
/* (section size is "object size", without the metadata overhead) */
- sec_node->sect_size = node->size - H5HF_MAN_ABS_DIRECT_OBJ_PREFIX_LEN_DBLOCK(hdr, dblock);
+ sec_node->sect_size = node->size - H5HF_MAN_ABS_DIRECT_OBJ_PREFIX_LEN(hdr);
+ sec_node->type = H5HF_SECT_SINGLE;
+ sec_node->u.single.dblock_addr = dblock_addr;
+ sec_node->u.single.dblock_size = dblock->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)
@@ -763,11 +793,12 @@ H5HF_man_dblock_build_freelist(H5HF_direct_t *dblock, haddr_t dblock_addr)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for direct block free list section")
/* Set section's information */
- sec_node->block_addr = dblock_addr;
- sec_node->block_size = dblock->size;
- sec_node->sect_addr = dblock_addr + node->my_offset;
+ sec_node->sect_addr = dblock->block_off + node->my_offset;
/* (section size is "object size", without the metadata overhead) */
- sec_node->sect_size = node->size - H5HF_MAN_ABS_DIRECT_OBJ_PREFIX_LEN_DBLOCK(hdr, dblock);
+ sec_node->sect_size = node->size - H5HF_MAN_ABS_DIRECT_OBJ_PREFIX_LEN(hdr);
+ sec_node->type = H5HF_SECT_SINGLE;
+ sec_node->u.single.dblock_addr = dblock_addr;
+ sec_node->u.single.dblock_size = dblock->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)
@@ -912,32 +943,33 @@ HDfprintf(stderr, "%s: request = %Zu\n", FUNC, request);
if(request < hdr->man_dtable.cparam.start_block_size)
min_dblock_size = hdr->man_dtable.cparam.start_block_size;
else {
- min_dblock_size = 2 * H5V_log2_gen((hsize_t)request);
+ min_dblock_size = 1 << (1 + H5V_log2_gen((hsize_t)request));
HDassert(min_dblock_size <= hdr->man_dtable.cparam.max_direct_size);
} /* end else */
/* Adjust the size of block needed to fulfill request, with overhead */
#ifdef QAK
+HDfprintf(stderr, "%s: Check 1 - min_dblock_size = %Zu\n", FUNC, min_dblock_size);
HDfprintf(stderr, "%s: H5HF_MAN_ABS_DIRECT_OVERHEAD_SIZE = %u\n", FUNC, H5HF_MAN_ABS_DIRECT_OVERHEAD_SIZE(hdr, hdr->man_dtable.cparam.start_block_size));
-HDfprintf(stderr, "%s: H5HF_MAN_ABS_DIRECT_OBJ_PREFIX_LEN_SIZE = %u\n", FUNC, H5HF_MAN_ABS_DIRECT_OBJ_PREFIX_LEN_SIZE(hdr, hdr->man_dtable.cparam.start_block_size));
+HDfprintf(stderr, "%s: H5HF_MAN_ABS_DIRECT_OBJ_PREFIX_LEN = %u\n", FUNC, H5HF_MAN_ABS_DIRECT_OBJ_PREFIX_LEN(hdr));
#endif /* QAK */
if((min_dblock_size - request) < (H5HF_MAN_ABS_DIRECT_OVERHEAD_SIZE(hdr, min_dblock_size)
- + H5HF_MAN_ABS_DIRECT_OBJ_PREFIX_LEN_SIZE(hdr, min_dblock_size)))
+ + H5HF_MAN_ABS_DIRECT_OBJ_PREFIX_LEN(hdr)))
min_dblock_size *= 2;
#ifdef QAK
-HDfprintf(stderr, "%s: min_dblock_size = %Zu\n", FUNC, min_dblock_size);
+HDfprintf(stderr, "%s: Check 2 - min_dblock_size = %Zu\n", FUNC, min_dblock_size);
#endif /* QAK */
/* Check if this is the first block in the heap */
- if(!H5F_addr_defined(hdr->man_dtable.table_addr)) {
- /* Create new direct block at corrent location*/
+ if(!H5F_addr_defined(hdr->man_dtable.table_addr) &&
+ 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, hdr->man_dtable.next_dir_block, &dblock_addr) < 0)
+ if(H5HF_man_dblock_create(dxpl_id, hdr, NULL, 0, dblock_size, (hsize_t)0, &dblock_addr) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "can't allocate fractal heap direct block")
#ifdef QAK
HDfprintf(stderr, "%s: dblock_addr = %a\n", FUNC, dblock_addr);
-HDfprintf(stderr, "%s: hdr->man_dtable.next_dir_block = %Hu\n", FUNC, hdr->man_dtable.next_dir_block);
#endif /* QAK */
/* Point root at new direct block */
@@ -949,6 +981,7 @@ HDfprintf(stderr, "%s: hdr->man_dtable.next_dir_block = %Hu\n", FUNC, hdr->man_d
H5HF_indirect_t *iblock; /* Pointer to indirect block to create */
haddr_t iblock_addr; /* Indirect block's address */
size_t dblock_entry; /* Direct entry for new direct block */
+ hsize_t dblock_off; /* Direct block offset in heap address space */
/* Find indirect block with room for block of correct size */
if(NULL == (iblock = H5HF_man_iblock_place_dblock(hdr, dxpl_id, min_dblock_size, &iblock_addr, &dblock_entry, &dblock_size)))
@@ -959,8 +992,13 @@ HDfprintf(stderr, "%s: dblock_entry = %Zu\n", FUNC, dblock_entry);
HDfprintf(stderr, "%s: dblock_size = %Zu\n", FUNC, dblock_size);
#endif /* QAK */
- /* Create new direct block at corrent location*/
- if(H5HF_man_dblock_create(dxpl_id, hdr, iblock, dblock_entry, dblock_size, hdr->man_dtable.next_dir_block, &dblock_addr) < 0)
+ /* Compute the direct block's offset in the heap's address space */
+ dblock_off = iblock->block_off;
+ dblock_off += hdr->man_dtable.row_block_off[dblock_entry / hdr->man_dtable.cparam.width];
+ 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)
HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "can't allocate fractal heap direct block")
#ifdef QAK
@@ -979,10 +1017,6 @@ HDfprintf(stderr, "%s: dblock_addr = %a\n", FUNC, dblock_addr);
HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release fractal heap indirect block")
} /* end else */
- /* Update shared header */
-/* XXX: This is going to cause problems when we support skipping blocks */
- hdr->man_dtable.next_dir_block += dblock_size;
-
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5HF_man_dblock_new() */
@@ -1082,9 +1116,15 @@ H5HF_man_insert(H5HF_t *hdr, hid_t dxpl_id, H5HF_section_free_node_t *sec_node,
HDassert(obj);
HDassert(id);
+ /* 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")
+ } /* end if */
+
/* Lock direct block */
- dblock_addr = sec_node->block_addr;
- if(NULL == (dblock = H5AC_protect(hdr->f, dxpl_id, H5AC_FHEAP_DBLOCK, dblock_addr, &sec_node->block_size, hdr, H5AC_WRITE)))
+ 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")
/* Insert object into block */
@@ -1100,13 +1140,13 @@ H5HF_man_insert(H5HF_t *hdr, hid_t dxpl_id, H5HF_section_free_node_t *sec_node,
/* Locate "local" free list node for section */
/* XXX: Change to using skip list */
- obj_off = sec_node->sect_addr - sec_node->block_addr;
+ obj_off = sec_node->sect_addr - dblock->block_off;
node = dblock->free_list->first;
while(node->my_offset != obj_off)
node = node->next;
/* Compute full object size, with metadata for object */
- full_obj_size = obj_size + H5HF_MAN_ABS_DIRECT_OBJ_PREFIX_LEN_DBLOCK(hdr, dblock);
+ full_obj_size = obj_size + H5HF_MAN_ABS_DIRECT_OBJ_PREFIX_LEN(hdr);
/* Sanity checks */
HDassert(dblock->blk_free_space >= full_obj_size);
@@ -1185,9 +1225,6 @@ HDfprintf(stderr, "%s: alloc_obj_size = %Zu\n", FUNC, alloc_obj_size);
/* Point to location for object */
p = dblock->blk + obj_off;
- /* Encode the length */
- UINT64ENCODE_VAR(p, obj_size, dblock->blk_off_size);
-
/* Encode the free fragment size */
*p++ = free_frag_size;
@@ -1206,11 +1243,12 @@ HDfprintf(stderr, "%s: alloc_obj_size = %Zu\n", FUNC, alloc_obj_size);
/* Sanity check */
HDassert((size_t)(p - (dblock->blk + obj_off)) == alloc_obj_size);
- /* Set the heap ID for the new object */
+ /* Set the heap ID for the new object (heap offset & obj length) */
#ifdef QAK
HDfprintf(stderr, "%s: dblock->block_off = %Hu\n", FUNC, dblock->block_off);
#endif /* QAK */
UINT64ENCODE_VAR(id, (dblock->block_off + obj_off), hdr->heap_off_size);
+ UINT64ENCODE_VAR(id, obj_size, hdr->id_len);
} /* end if */
else {
HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "inserting within mapped managed blocks not supported yet")
@@ -1246,12 +1284,11 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5HF_man_read(H5HF_t *hdr, hid_t dxpl_id, hsize_t obj_off, void *obj)
+H5HF_man_read(H5HF_t *hdr, hid_t dxpl_id, hsize_t obj_off, size_t obj_len, void *obj)
{
H5HF_direct_t *dblock; /* Pointer to direct block to query */
size_t blk_off; /* Offset of object in block */
uint8_t *p; /* Temporary pointer to obj info in block */
- size_t obj_size; /* Size of object */
haddr_t dblock_addr; /* Direct block address */
size_t dblock_size; /* Direct block size */
herr_t ret_value = SUCCEED; /* Return value */
@@ -1358,14 +1395,11 @@ HDfprintf(stderr, "%s: entry address = %a\n", FUNC, iblock->ents[entry].addr);
/* Point to location for object */
p = dblock->blk + blk_off;
- /* Decode the length */
- UINT64DECODE_VAR(p, obj_size, dblock->blk_off_size);
-
/* Skip over the free fragment size */
p++;
/* Copy the object's data into the heap */
- HDmemcpy(obj, p, obj_size);
+ HDmemcpy(obj, p, obj_len);
/* Unlock direct block */
if(H5AC_unprotect(hdr->f, dxpl_id, H5AC_FHEAP_DBLOCK, dblock_addr, dblock, H5AC__NO_FLAGS_SET) < 0)
@@ -1665,8 +1699,17 @@ HDfprintf(stderr, "%s: creating first indirect block\n", FUNC);
/* Check for allocating entire root indirect block initially */
if(hdr->man_dtable.cparam.start_root_rows == 0)
nrows = hdr->man_dtable.max_root_rows;
- else
+ else {
+ unsigned rows_needed; /* Number of rows needed to get to direct block size */
+
nrows = hdr->man_dtable.cparam.start_root_rows;
+ rows_needed = 2 + (H5V_log2_of2(min_dblock_size) - H5V_log2_of2(hdr->man_dtable.cparam.start_block_size));
+ if(nrows < rows_needed)
+ nrows = rows_needed;
+ } /* end else */
+#ifdef QAK
+HDfprintf(stderr, "%s: nrows = %u\n", FUNC, nrows);
+#endif /* QAK */
/* Allocate root indirect block */
if(H5HF_man_iblock_create(hdr, dxpl_id, (hsize_t)0, nrows, hdr->man_dtable.max_root_rows, &iblock_addr) < 0)
@@ -1681,32 +1724,96 @@ HDfprintf(stderr, "%s: iblock_addr = %a\n", FUNC, iblock_addr);
if(NULL == (iblock = H5AC_protect(hdr->f, dxpl_id, H5AC_FHEAP_IBLOCK, iblock_addr, &nrows, hdr, H5AC_WRITE)))
HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, NULL, "unable to protect fractal heap indirect block")
- /* Lock first (root) direct block */
- if(NULL == (dblock = H5AC_protect(hdr->f, dxpl_id, H5AC_FHEAP_DBLOCK, hdr->man_dtable.table_addr, &hdr->man_dtable.cparam.start_block_size, hdr, H5AC_READ)))
- HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, NULL, "unable to protect fractal heap direct block")
-
- /* Point indirect block at direct block to add */
- iblock->ents[0].addr = hdr->man_dtable.table_addr;
- iblock->ents[0].free_space = dblock->blk_free_space;
- iblock->child_free_space += dblock->blk_free_space;
-
- /* Make direct block share parent indirect block */
- dblock->parent = iblock;
- dblock->par_entry = 0;
- dblock->par_addr = iblock->addr;
- dblock->par_nrows = iblock->nrows;
- if(H5HF_iblock_incr(iblock) < 0)
- HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, NULL, "can't increment reference count on shared indirect block")
-
- /* Unlock first (root) direct block */
- if(H5AC_unprotect(hdr->f, dxpl_id, H5AC_FHEAP_DBLOCK, hdr->man_dtable.table_addr, dblock, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, NULL, "unable to release fractal heap direct block")
- dblock = NULL;
-
- /* Increment size of next block from this indirect block */
- /* (account for the already existing direct block */
- if(H5HF_man_iblock_inc_loc(iblock) < 0)
- HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, NULL, "can't advance fractal heap block location")
+ /* Check if there's already a direct block as root) */
+ if(H5F_addr_defined(hdr->man_dtable.table_addr)) {
+ /* Lock first (root) direct block */
+ if(NULL == (dblock = H5AC_protect(hdr->f, dxpl_id, H5AC_FHEAP_DBLOCK, hdr->man_dtable.table_addr, &hdr->man_dtable.cparam.start_block_size, hdr, H5AC_READ)))
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, NULL, "unable to protect fractal heap direct block")
+
+ /* Point indirect block at direct block to add */
+ iblock->ents[0].addr = hdr->man_dtable.table_addr;
+ iblock->ents[0].free_space = dblock->blk_free_space;
+ iblock->child_free_space += dblock->blk_free_space;
+
+ /* Make direct block share parent indirect block */
+ dblock->parent = iblock;
+ dblock->par_entry = 0;
+ dblock->par_addr = iblock->addr;
+ dblock->par_nrows = iblock->nrows;
+ if(H5HF_iblock_incr(iblock) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, NULL, "can't increment reference count on shared indirect block")
+
+ /* Unlock first (root) direct block */
+ if(H5AC_unprotect(hdr->f, dxpl_id, H5AC_FHEAP_DBLOCK, hdr->man_dtable.table_addr, dblock, H5AC__NO_FLAGS_SET) < 0)
+ HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, NULL, "unable to release fractal heap direct block")
+ dblock = NULL;
+
+ /* Increment size of next block from this indirect block */
+ /* (account for the already existing direct block */
+ if(H5HF_man_iblock_inc_loc(iblock) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, NULL, "can't advance fractal heap block location")
+ } /* end if */
+ else {
+ H5HF_section_free_node_t *sec_node; /* Pointer to free list section for range */
+ size_t dblock_free_space; /* Size of free space for direct block */
+ hsize_t range; /* Size range skipped over */
+ unsigned cur_entry; /* Current entry */
+ unsigned u, v; /* Local index variables */
+
+ /* Initialize information for rows skipped over */
+ cur_entry = 0;
+ range = 0;
+ for(u = 0; u < (nrows - 1); u++) {
+ /* Compute free space in direct blocks for this row */
+ dblock_free_space = hdr->man_dtable.row_block_size[u] -
+ (H5HF_MAN_ABS_DIRECT_OVERHEAD_SIZE(hdr, hdr->man_dtable.row_block_size[u])
+ + H5HF_MAN_ABS_DIRECT_OBJ_PREFIX_LEN(hdr));
+
+ /* Initialize information for this row */
+ for(v = 0; v < hdr->man_dtable.cparam.width; v++) {
+ /* Initialize entry for this row */
+ iblock->ents[cur_entry].addr = HADDR_UNDEF;
+ 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;
+
+ /* Increment range skipped */
+ range += hdr->man_dtable.row_block_size[u];
+
+ /* Move to next entry */
+ cur_entry++;
+ } /* end for */
+ } /* end for */
+
+ /* Set indirect block's "next entry" information */
+ iblock->next_col = 0;
+ iblock->next_row = u;
+ iblock->next_size = hdr->man_dtable.row_block_size[u];
+ iblock->next_entry = cur_entry;
+ HDassert(iblock->next_size == min_dblock_size);
+
+ /* Create free space section for blocks skipped over */
+
+ /* Create free list section node */
+ if(NULL == (sec_node = H5FL_MALLOC(H5HF_section_free_node_t)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for direct block free list section")
+
+ /* Set section's information */
+ sec_node->sect_addr = 0; /* Range starts at offset 0 in the heap */
+ sec_node->sect_size = dblock_free_space;
+ sec_node->type = H5HF_SECT_RANGE;
+ sec_node->u.range.iblock_addr = iblock->addr;
+ sec_node->u.range.iblock_nrows = iblock->nrows;
+ sec_node->u.range.entry = 0;
+ sec_node->u.range.num_entries = cur_entry;
+ sec_node->u.range.range = range;
+
+ /* 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, NULL, "can't add indirect block free space to global list")
+ } /* end else */
/* Mark indirect block as modified */
if(H5HF_iblock_dirty(dxpl_id, iblock) < 0)
@@ -1828,11 +1935,17 @@ HDfprintf(stderr, "%s: iblock->next_size = %Hu, nrows = %u\n", FUNC, iblock->nex
/* Check for allocating new indirect block */
if(!H5F_addr_defined(iblock->ents[iblock->next_entry].addr)) {
+ hsize_t new_iblock_off; /* Direct block offset in heap address space */
#ifdef QAK
HDfprintf(stderr, "%s: Allocating new indirect block\n", FUNC);
#endif /* QAK */
+ /* Compute the direct block's offset in the heap's address space */
+ new_iblock_off = iblock->block_off;
+ new_iblock_off += hdr->man_dtable.row_block_off[iblock->next_entry / hdr->man_dtable.cparam.width];
+ new_iblock_off += hdr->man_dtable.row_block_size[iblock->next_entry / hdr->man_dtable.cparam.width] * (iblock->next_entry % hdr->man_dtable.cparam.width);
+
/* Allocate new indirect block */
- if(H5HF_man_iblock_create(hdr, dxpl_id, hdr->man_dtable.next_dir_block, nrows, nrows, &new_iblock_addr) < 0)
+ if(H5HF_man_iblock_create(hdr, dxpl_id, new_iblock_off, nrows, nrows, &new_iblock_addr) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "can't allocate fractal heap indirect block")
/* Lock new indirect block */
diff --git a/src/H5HFpkg.h b/src/H5HFpkg.h
index cede8c9..ab69207 100644
--- a/src/H5HFpkg.h
+++ b/src/H5HFpkg.h
@@ -65,7 +65,6 @@
+ 2 /* Starting # of rows in root indirect block */ \
+ (h)->sizeof_addr /* File address of table managed */ \
+ 2 /* Current # of rows in root indirect block */ \
- + (h)->sizeof_size /* Next direct block's heap offset */ \
)
/* Size of the fractal heap header on disk */
@@ -89,12 +88,7 @@
#define H5HF_MAN_ABS_DIRECT_FREE_NODE_SIZE(d) (2 * (d)->blk_off_size)
/* Size of header for each object in an absolute managed direct block */
-#define H5HF_MAN_ABS_DIRECT_OBJ_PREFIX_LEN_SIZE(h, o) ( \
- H5HF_SIZEOF_OFFSET_LEN(o) /* Length of object in block */ \
- + 1 /* Free space fragment length */ \
- )
-#define H5HF_MAN_ABS_DIRECT_OBJ_PREFIX_LEN_DBLOCK(h, d) ( \
- (d)->blk_off_size /* Length of object in block */ \
+#define H5HF_MAN_ABS_DIRECT_OBJ_PREFIX_LEN(h) ( \
+ 1 /* Free space fragment length */ \
)
@@ -162,16 +156,15 @@ typedef struct H5HF_dtable_t {
* to direct block (of START_BLOCK_SIZE) instead
* of indirect root block.
*/
-/* XXX: get rid of this global setting */
- hsize_t next_dir_block; /* Offset of next direct managed block */
/* Computed information (not stored) */
unsigned max_root_rows; /* Maximum # of rows in root indirect block */
unsigned max_direct_rows; /* Maximum # of direct rows in any indirect block */
unsigned max_dir_blk_off_size; /* Max. size of offsets in direct blocks */
- unsigned first_row_bits; /* # of bits in address of first row */
+ unsigned first_row_bits; /* # of bits in address of first row */
hsize_t num_id_first_row; /* Number of IDs in first row of table */
hsize_t *row_block_size; /* Block size per row of indirect block */
+ hsize_t *row_block_off; /* Cumulative offset per row of indirect block */
} H5HF_dtable_t;
/* Fractal heap free list info (forward decl - defined in H5HFflist.c) */
@@ -208,6 +201,7 @@ typedef struct H5HF_t {
size_t sizeof_size; /* Size of file sizes */
size_t sizeof_addr; /* Size of file addresses */
H5HF_freelist_t *flist; /* Free list for objects in heap */
+ size_t id_len; /* Size of heap IDs */
/* Doubling table information */
/* (Partially set by user, partially derived/updated internally) */
@@ -374,7 +368,7 @@ H5_DLL herr_t H5HF_man_insert(H5HF_t *fh, hid_t dxpl_id,
H5HF_section_free_node_t *sec_node, size_t obj_size, const void *obj,
void *id);
H5_DLL herr_t H5HF_man_read(H5HF_t *fh, hid_t dxpl_id, hsize_t obj_off,
- void *obj);
+ size_t obj_len, void *obj);
/* Metadata cache callbacks */
H5_DLL herr_t H5HF_cache_hdr_dest(H5F_t *f, H5HF_t *fh);
diff --git a/src/H5HFprivate.h b/src/H5HFprivate.h
index 6296e8c..f97008c 100644
--- a/src/H5HFprivate.h
+++ b/src/H5HFprivate.h
@@ -76,7 +76,7 @@ typedef struct H5HF_create_t {
/* Library-private Function Prototypes */
/***************************************/
H5_DLL herr_t H5HF_create(H5F_t *f, hid_t dxpl_id, H5HF_create_t *cparam,
- haddr_t *addr_p);
+ haddr_t *addr_p, size_t *id_len_p);
H5_DLL herr_t H5HF_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t size,
const void *obj, void *id/*out*/);
H5_DLL herr_t H5HF_read(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *id,
diff --git a/test/fheap.c b/test/fheap.c
index 24ba033..aff2441 100644
--- a/test/fheap.c
+++ b/test/fheap.c
@@ -50,6 +50,8 @@
/* Heap metadata */
#define DBLOCK_OVERHEAD 32 /* # of bytes in direct block overhead */
+#define OBJ_PREFIX_LEN 1 /* # of bytes in object prefix overhead */
+#define HEAP_ID_LEN 12 /* # of bytes to use for heap ID */
const char *FILENAME[] = {
"fheap",
@@ -206,14 +208,13 @@ fill_heap(H5F_t *f, hid_t dxpl, haddr_t fh_addr, const H5HF_create_t *cparam,
unsigned start_nobjs, unsigned *nobjs_ptr)
{
H5HF_stat_t heap_stats; /* Statistics about the heap */
- hsize_t heap_id; /* Heap ID for object inserted */
+ unsigned char heap_id[HEAP_ID_LEN]; /* Heap ID for object inserted */
unsigned char obj[10]; /* Buffer for object to insert */
unsigned char robj[10]; /* Buffer for reading object */
unsigned nobjs = 0; /* Number of objects inserted */
- unsigned alloc_ids = 0; /* # of heap IDs allocated in array */
- hsize_t *ids = NULL; /* Array of heap IDs */
+ size_t alloc_ids = 0; /* # of heap IDs allocated in array */
+ unsigned char *ids = NULL; /* Array of heap IDs */
size_t data_size; /* Size of data portion of heap block */
- size_t obj_overhead; /* Size of overhead for each object */
size_t free_overhead; /* Size of free space overhead for each object */
unsigned free_frag_size; /* Size of free space fragment */
size_t last_obj_len; /* Size of last object inserted into heap */
@@ -222,12 +223,10 @@ 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 */
- obj_overhead = 3;
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 */
- obj_overhead = 4; /* Will handle blocks up to 2^24 */
free_overhead = 6;
} /* end else */
@@ -236,8 +235,8 @@ fill_heap(H5F_t *f, hid_t dxpl, haddr_t fh_addr, const H5HF_create_t *cparam,
obj[u] = u;
/* Insert first object */
- heap_id = 0;
- if(H5HF_insert(f, dxpl, fh_addr, sizeof(obj), obj, &heap_id) < 0)
+ HDmemset(heap_id, 0, sizeof(heap_id));
+ if(H5HF_insert(f, dxpl, fh_addr, sizeof(obj), obj, heap_id) < 0)
FAIL_STACK_ERROR
/* Increment object count */
@@ -246,12 +245,12 @@ fill_heap(H5F_t *f, hid_t dxpl, haddr_t fh_addr, const H5HF_create_t *cparam,
/* Check for needing to increase size of heap ID array */
if(nobjs > alloc_ids) {
alloc_ids = MAX(1024, (alloc_ids * 2));
- if(NULL == (ids = H5MM_realloc(ids, sizeof(hsize_t) * alloc_ids)))
+ if(NULL == (ids = H5MM_realloc(ids, HEAP_ID_LEN * alloc_ids)))
FAIL_STACK_ERROR
} /* end if */
- ids[nobjs - 1] = heap_id;
+ 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_overhead))), (hsize_t)(start_nobjs + nobjs)))
+ 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)))
FAIL_STACK_ERROR
/* Get statistics for heap */
@@ -260,13 +259,13 @@ 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_overhead)) {
+ while(heap_stats.man_free_space > (sizeof(obj) + OBJ_PREFIX_LEN)) {
/* Initialize object buffer */
for(u = 0; u < sizeof(obj); u++)
obj[u] = u + nobjs;
- heap_id = 0;
- if(H5HF_insert(f, dxpl, fh_addr, sizeof(obj), obj, &heap_id) < 0)
+ HDmemset(heap_id, 0, sizeof(heap_id));
+ if(H5HF_insert(f, dxpl, fh_addr, sizeof(obj), obj, heap_id) < 0)
FAIL_STACK_ERROR
/* Increment object count */
@@ -275,15 +274,15 @@ fill_heap(H5F_t *f, hid_t dxpl, haddr_t fh_addr, const H5HF_create_t *cparam,
/* Check for needing to increase size of heap ID array */
if(nobjs > alloc_ids) {
alloc_ids = MAX(1024, (alloc_ids * 2));
- if(NULL == (ids = H5MM_realloc(ids, sizeof(hsize_t) * alloc_ids)))
+ if(NULL == (ids = H5MM_realloc(ids, HEAP_ID_LEN * alloc_ids)))
FAIL_STACK_ERROR
} /* end if */
- ids[nobjs - 1] = heap_id;
+ 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_overhead)) <= free_overhead)
- free_frag_size = heap_stats.man_free_space - (sizeof(obj) + obj_overhead);
- if(check_stats(f, dxpl, fh_addr, heap_size, heap_size, (hsize_t)0, (hsize_t)(data_size - ((nobjs * (sizeof(obj) + obj_overhead)) + free_frag_size)), (hsize_t)(start_nobjs + nobjs)))
+ 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)))
FAIL_STACK_ERROR
/* Get statistics for heap */
@@ -293,15 +292,15 @@ fill_heap(H5F_t *f, hid_t dxpl, haddr_t fh_addr, const H5HF_create_t *cparam,
/* 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_overhead);
+ last_obj_len = (size_t)(heap_stats.man_free_space - OBJ_PREFIX_LEN);
/* Initialize object buffer */
for(u = 0; u < sizeof(obj); u++)
obj[u] = u + nobjs;
/* Insert last object into the heap, using the remaining free space */
- heap_id = 0;
- if(H5HF_insert(f, dxpl, fh_addr, last_obj_len, obj, &heap_id) < 0)
+ HDmemset(heap_id, 0, sizeof(heap_id));
+ if(H5HF_insert(f, dxpl, fh_addr, last_obj_len, obj, heap_id) < 0)
FAIL_STACK_ERROR
/* Increment object count */
@@ -310,10 +309,10 @@ fill_heap(H5F_t *f, hid_t dxpl, haddr_t fh_addr, const H5HF_create_t *cparam,
/* Check for needing to increase size of heap ID array */
if(nobjs > alloc_ids) {
alloc_ids = MAX(1024, (alloc_ids * 2));
- if(NULL == (ids = H5MM_realloc(ids, sizeof(hsize_t) * alloc_ids)))
+ if(NULL == (ids = H5MM_realloc(ids, HEAP_ID_LEN * alloc_ids)))
FAIL_STACK_ERROR
} /* end if */
- ids[nobjs - 1] = heap_id;
+ 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)))
@@ -329,7 +328,7 @@ fill_heap(H5F_t *f, hid_t dxpl, haddr_t fh_addr, const H5HF_create_t *cparam,
obj[u] = u + v;
/* Read in object */
- if(H5HF_read(f, dxpl, fh_addr, &ids[v], robj) < 0)
+ if(H5HF_read(f, dxpl, fh_addr, &ids[v * HEAP_ID_LEN], robj) < 0)
FAIL_STACK_ERROR
if(HDmemcmp(obj, robj, (v == (nobjs - 1) ? last_obj_len : sizeof(obj))))
FAIL_STACK_ERROR
@@ -371,6 +370,7 @@ test_create(hid_t fapl, H5HF_create_t *cparam)
H5F_t *f = NULL; /* Internal file object pointer */
H5HF_create_t test_cparam; /* Creation parameters for heap */
haddr_t fh_addr; /* Address of fractal heap created */
+ size_t id_len; /* Size of fractal heap IDs */
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
@@ -387,10 +387,12 @@ test_create(hid_t fapl, H5HF_create_t *cparam)
* Test fractal heap creation (w/absolute address mapping)
*/
TESTING("fractal heap creation (w/absolute address mapping)");
- if(H5HF_create(f, H5P_DATASET_XFER_DEFAULT, cparam, &fh_addr/*out*/) < 0)
+ if(H5HF_create(f, H5P_DATASET_XFER_DEFAULT, 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
PASSED()
@@ -441,9 +443,10 @@ test_abs_insert_first(hid_t fapl, H5HF_create_t *cparam)
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[10]; /* Buffer for object to insert */
unsigned char robj[10]; /* Buffer for object to read */
- hsize_t heap_id; /* Heap ID for object inserted */
+ unsigned char heap_id[HEAP_ID_LEN]; /* Heap ID for object inserted */
hsize_t free_space; /* Size of free space in heap */
unsigned u; /* Local index variable */
@@ -459,10 +462,12 @@ test_abs_insert_first(hid_t fapl, H5HF_create_t *cparam)
STACK_ERROR
/* Create absolute heap */
- if(H5HF_create(f, dxpl, cparam, &fh_addr/*out*/) < 0)
+ 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
@@ -474,15 +479,15 @@ test_abs_insert_first(hid_t fapl, H5HF_create_t *cparam)
* Test inserting first (small) object into absolute heap
*/
TESTING("inserting first (small) object into absolute heap");
- heap_id = 0;
- if(H5HF_insert(f, dxpl, fh_addr, sizeof(obj), obj, &heap_id) < 0)
+ HDmemset(heap_id, 0, sizeof(heap_id));
+ if(H5HF_insert(f, dxpl, fh_addr, sizeof(obj), obj, heap_id) < 0)
FAIL_STACK_ERROR
- free_space = cparam->managed.start_block_size - ((sizeof(obj) + 3) + DBLOCK_OVERHEAD + (cparam->managed.max_index / 8));
+ free_space = cparam->managed.start_block_size - ((sizeof(obj) + OBJ_PREFIX_LEN) + DBLOCK_OVERHEAD + (cparam->managed.max_index / 8));
if(check_stats(f, H5P_DATASET_XFER_DEFAULT, fh_addr, (hsize_t)cparam->managed.start_block_size, (hsize_t)cparam->managed.start_block_size, (hsize_t)0, free_space, (hsize_t)1))
FAIL_STACK_ERROR
/* Check reading back in the object */
- if(H5HF_read(f, dxpl, fh_addr, &heap_id, robj) < 0)
+ if(H5HF_read(f, dxpl, fh_addr, heap_id, robj) < 0)
FAIL_STACK_ERROR
if(HDmemcmp(obj, robj, sizeof(obj)))
FAIL_STACK_ERROR
@@ -526,11 +531,12 @@ test_abs_insert_second(hid_t fapl, H5HF_create_t *cparam)
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[10]; /* Buffer for first object to insert */
unsigned char robj[10]; /* Buffer for reading first object */
unsigned char obj2[20]; /* Buffer for second object to insert */
unsigned char robj2[20]; /* Buffer for reading second object */
- hsize_t heap_id; /* Heap ID for object inserted */
+ unsigned char heap_id[HEAP_ID_LEN]; /* Heap ID for object inserted */
hsize_t free_space; /* Size of free space in heap */
unsigned u; /* Local index variable */
@@ -546,10 +552,12 @@ test_abs_insert_second(hid_t fapl, H5HF_create_t *cparam)
STACK_ERROR
/* Create absolute heap */
- if(H5HF_create(f, dxpl, cparam, &fh_addr/*out*/) < 0)
+ 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
/* Initialize object buffers */
for(u = 0; u < sizeof(obj); u++)
@@ -561,28 +569,28 @@ test_abs_insert_second(hid_t fapl, H5HF_create_t *cparam)
* Test inserting first (small) object into absolute heap
*/
TESTING("inserting two (small) objects into absolute heap");
- heap_id = 0;
- if(H5HF_insert(f, dxpl, fh_addr, sizeof(obj), obj, &heap_id) < 0)
+ HDmemset(heap_id, 0, sizeof(heap_id));
+ if(H5HF_insert(f, dxpl, fh_addr, sizeof(obj), obj, heap_id) < 0)
FAIL_STACK_ERROR
- free_space = cparam->managed.start_block_size - ((sizeof(obj) + 3) + DBLOCK_OVERHEAD + (cparam->managed.max_index / 8));
+ free_space = cparam->managed.start_block_size - ((sizeof(obj) + OBJ_PREFIX_LEN) + DBLOCK_OVERHEAD + (cparam->managed.max_index / 8));
if(check_stats(f, H5P_DATASET_XFER_DEFAULT, fh_addr, (hsize_t)cparam->managed.start_block_size, (hsize_t)cparam->managed.start_block_size, (hsize_t)0, free_space, (hsize_t)1))
FAIL_STACK_ERROR
/* Check reading back in the first object */
- if(H5HF_read(f, dxpl, fh_addr, &heap_id, robj) < 0)
+ if(H5HF_read(f, dxpl, fh_addr, heap_id, robj) < 0)
FAIL_STACK_ERROR
if(HDmemcmp(obj, robj, sizeof(obj)))
FAIL_STACK_ERROR
- heap_id = 0;
- if(H5HF_insert(f, dxpl, fh_addr, sizeof(obj2), obj2, &heap_id) < 0)
+ 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 = cparam->managed.start_block_size - ((sizeof(obj) + 3) + (sizeof(obj2) + 3) + DBLOCK_OVERHEAD + (cparam->managed.max_index / 8));
+ free_space = cparam->managed.start_block_size - ((sizeof(obj) + OBJ_PREFIX_LEN) + (sizeof(obj2) + OBJ_PREFIX_LEN) + DBLOCK_OVERHEAD + (cparam->managed.max_index / 8));
if(check_stats(f, H5P_DATASET_XFER_DEFAULT, fh_addr, (hsize_t)cparam->managed.start_block_size, (hsize_t)cparam->managed.start_block_size, (hsize_t)0, free_space, (hsize_t)2))
FAIL_STACK_ERROR
/* Check reading back in the second object */
- if(H5HF_read(f, dxpl, fh_addr, &heap_id, robj2) < 0)
+ if(H5HF_read(f, dxpl, fh_addr, heap_id, robj2) < 0)
FAIL_STACK_ERROR
if(HDmemcmp(obj2, robj2, sizeof(obj2)))
FAIL_STACK_ERROR
@@ -627,6 +635,7 @@ test_abs_insert_root_mult(hid_t fapl, H5HF_create_t *cparam)
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 */
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
@@ -640,10 +649,12 @@ test_abs_insert_root_mult(hid_t fapl, H5HF_create_t *cparam)
STACK_ERROR
/* Create absolute heap */
- if(H5HF_create(f, dxpl, cparam, &fh_addr/*out*/) < 0)
+ 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
/*
* Test inserting mult. (small) object into absolute heap
@@ -695,8 +706,9 @@ test_abs_insert_force_indirect(hid_t fapl, H5HF_create_t *cparam)
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[10]; /* Buffer for first object to insert */
- hsize_t heap_id; /* Heap ID for object inserted */
+ 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 u; /* Local index variable */
@@ -713,10 +725,12 @@ test_abs_insert_force_indirect(hid_t fapl, H5HF_create_t *cparam)
STACK_ERROR
/* Create absolute heap */
- if(H5HF_create(f, dxpl, cparam, &fh_addr/*out*/) < 0)
+ 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
/*
* Test forcing creation of indirect root block & second direct block
@@ -734,14 +748,14 @@ test_abs_insert_force_indirect(hid_t fapl, H5HF_create_t *cparam)
obj[u] = u + nobjs;
/* Insert another object, forcing the creation of an indirect block for the root block */
- heap_id = 0;
- if(H5HF_insert(f, dxpl, fh_addr, sizeof(obj), obj, &heap_id) < 0)
+ HDmemset(heap_id, 0, sizeof(heap_id));
+ if(H5HF_insert(f, dxpl, fh_addr, sizeof(obj), obj, heap_id) < 0)
FAIL_STACK_ERROR
/* Increment object count */
nobjs++;
- free_space = cparam->managed.start_block_size - ((sizeof(obj) + 3) + DBLOCK_OVERHEAD + (cparam->managed.max_index / 8));
+ free_space = cparam->managed.start_block_size - ((sizeof(obj) + 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)nobjs))
FAIL_STACK_ERROR
@@ -786,6 +800,7 @@ test_abs_insert_fill_second(hid_t fapl, H5HF_create_t *cparam)
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 nobjs = 0; /* Number of objects inserted */
unsigned tot_nobjs = 0; /* Total number of objects inserted */
@@ -801,10 +816,12 @@ test_abs_insert_fill_second(hid_t fapl, H5HF_create_t *cparam)
STACK_ERROR
/* Create absolute heap */
- if(H5HF_create(f, dxpl, cparam, &fh_addr/*out*/) < 0)
+ 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
/*
* Test inserting mult. (small) objects to fill second direct block
@@ -862,9 +879,10 @@ test_abs_insert_third_direct(hid_t fapl, H5HF_create_t *cparam)
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[10]; /* Buffer for first object to insert */
unsigned char robj[10]; /* Buffer for reading object */
- hsize_t heap_id; /* Heap ID for object inserted */
+ 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 */
@@ -882,10 +900,12 @@ test_abs_insert_third_direct(hid_t fapl, H5HF_create_t *cparam)
STACK_ERROR
/* Create absolute heap */
- if(H5HF_create(f, dxpl, cparam, &fh_addr/*out*/) < 0)
+ 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
/*
* Test inserting mult. (small) objects to create third direct block
@@ -909,19 +929,19 @@ test_abs_insert_third_direct(hid_t fapl, H5HF_create_t *cparam)
obj[u] = u + nobjs;
/* Insert another object, forcing the creation of the third direct block */
- heap_id = 0;
- if(H5HF_insert(f, dxpl, fh_addr, sizeof(obj), obj, &heap_id) < 0)
+ HDmemset(heap_id, 0, sizeof(heap_id));
+ if(H5HF_insert(f, dxpl, fh_addr, sizeof(obj), obj, heap_id) < 0)
FAIL_STACK_ERROR
/* Increment object count */
tot_nobjs++;
- free_space = cparam->managed.start_block_size - ((sizeof(obj) + 3) + DBLOCK_OVERHEAD + (cparam->managed.max_index / 8));
+ free_space = cparam->managed.start_block_size - ((sizeof(obj) + OBJ_PREFIX_LEN) + DBLOCK_OVERHEAD + (cparam->managed.max_index / 8));
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)tot_nobjs))
FAIL_STACK_ERROR
/* Read in object */
- if(H5HF_read(f, dxpl, fh_addr, &heap_id, robj) < 0)
+ if(H5HF_read(f, dxpl, fh_addr, heap_id, robj) < 0)
FAIL_STACK_ERROR
if(HDmemcmp(obj, robj, sizeof(obj)))
FAIL_STACK_ERROR
@@ -967,6 +987,7 @@ test_abs_fill_first_row(hid_t fapl, H5HF_create_t *cparam)
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 nobjs = 0; /* Number of objects inserted */
unsigned tot_nobjs = 0; /* Total number of objects inserted */
unsigned u; /* Local index variable */
@@ -983,10 +1004,12 @@ test_abs_fill_first_row(hid_t fapl, H5HF_create_t *cparam)
STACK_ERROR
/* Create absolute heap */
- if(H5HF_create(f, dxpl, cparam, &fh_addr/*out*/) < 0)
+ 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
/*
* Test inserting mult. (small) objects to fill first row in root indirect block
@@ -1042,9 +1065,10 @@ test_abs_start_second_row(hid_t fapl, H5HF_create_t *cparam)
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[10]; /* Buffer for object to insert */
unsigned char robj[10]; /* Buffer for reading object */
- hsize_t heap_id; /* Heap ID for object inserted */
+ 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 */
@@ -1062,10 +1086,12 @@ test_abs_start_second_row(hid_t fapl, H5HF_create_t *cparam)
STACK_ERROR
/* Create absolute heap */
- if(H5HF_create(f, dxpl, cparam, &fh_addr/*out*/) < 0)
+ 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
/*
* Test inserting mult. (small) objects to start second row in root indirect block
@@ -1087,19 +1113,19 @@ test_abs_start_second_row(hid_t fapl, H5HF_create_t *cparam)
obj[u] = u + tot_nobjs;
/* Insert another object, forcing the creation of an indirect block for the root block */
- heap_id = 0;
- if(H5HF_insert(f, dxpl, fh_addr, sizeof(obj), obj, &heap_id) < 0)
+ HDmemset(heap_id, 0, sizeof(heap_id));
+ if(H5HF_insert(f, dxpl, fh_addr, sizeof(obj), obj, heap_id) < 0)
FAIL_STACK_ERROR
/* Increment object count */
tot_nobjs++;
- free_space = cparam->managed.start_block_size - ((sizeof(obj) + 3) + DBLOCK_OVERHEAD + (cparam->managed.max_index / 8));
+ free_space = cparam->managed.start_block_size - ((sizeof(obj) + OBJ_PREFIX_LEN) + DBLOCK_OVERHEAD + (cparam->managed.max_index / 8));
if(check_stats(f, H5P_DATASET_XFER_DEFAULT, fh_addr, (hsize_t)((cparam->managed.width + 1) * cparam->managed.start_block_size), (hsize_t)((cparam->managed.width + 1) * cparam->managed.start_block_size), (hsize_t)0, free_space, (hsize_t)tot_nobjs))
FAIL_STACK_ERROR
/* Read in object */
- if(H5HF_read(f, dxpl, fh_addr, &heap_id, robj) < 0)
+ if(H5HF_read(f, dxpl, fh_addr, heap_id, robj) < 0)
FAIL_STACK_ERROR
if(HDmemcmp(obj, robj, sizeof(obj)))
FAIL_STACK_ERROR
@@ -1145,6 +1171,7 @@ test_abs_fill_second_row(hid_t fapl, H5HF_create_t *cparam)
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 nobjs = 0; /* Number of objects inserted */
unsigned tot_nobjs = 0; /* Total number of objects inserted */
unsigned u; /* Local index variable */
@@ -1161,10 +1188,12 @@ test_abs_fill_second_row(hid_t fapl, H5HF_create_t *cparam)
STACK_ERROR
/* Create absolute heap */
- if(H5HF_create(f, dxpl, cparam, &fh_addr/*out*/) < 0)
+ 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
/*
* Test inserting mult. (small) objects to start second row in root indirect block
@@ -1229,9 +1258,10 @@ test_abs_start_third_row(hid_t fapl, H5HF_create_t *cparam)
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[10]; /* Buffer for object to insert */
unsigned char robj[10]; /* Buffer for reading object */
- hsize_t heap_id; /* Heap ID for object inserted */
+ 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 */
@@ -1250,10 +1280,12 @@ test_abs_start_third_row(hid_t fapl, H5HF_create_t *cparam)
STACK_ERROR
/* Create absolute heap */
- if(H5HF_create(f, dxpl, cparam, &fh_addr/*out*/) < 0)
+ 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
/*
* Test inserting mult. (small) objects to start third row in root indirect block
@@ -1283,8 +1315,8 @@ test_abs_start_third_row(hid_t fapl, H5HF_create_t *cparam)
obj[u] = u + tot_nobjs;
/* Insert object */
- heap_id = 0;
- if(H5HF_insert(f, dxpl, fh_addr, sizeof(obj), obj, &heap_id) < 0)
+ HDmemset(heap_id, 0, sizeof(heap_id));
+ if(H5HF_insert(f, dxpl, fh_addr, sizeof(obj), obj, heap_id) < 0)
FAIL_STACK_ERROR
/* Increment object count */
@@ -1292,12 +1324,12 @@ test_abs_start_third_row(hid_t fapl, H5HF_create_t *cparam)
heap_size = (2 * cparam->managed.width) * cparam->managed.start_block_size +
(2 * cparam->managed.start_block_size);
- free_space = (2 * cparam->managed.start_block_size) - ((sizeof(obj) + 3) + DBLOCK_OVERHEAD + (cparam->managed.max_index / 8));
+ free_space = (2 * cparam->managed.start_block_size) - ((sizeof(obj) + 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
/* Read in object */
- if(H5HF_read(f, dxpl, fh_addr, &heap_id, robj) < 0)
+ if(H5HF_read(f, dxpl, fh_addr, heap_id, robj) < 0)
FAIL_STACK_ERROR
if(HDmemcmp(obj, robj, sizeof(obj)))
FAIL_STACK_ERROR
@@ -1343,6 +1375,7 @@ test_abs_fill_fourth_row(hid_t fapl, H5HF_create_t *cparam)
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 nobjs = 0; /* Number of objects inserted */
unsigned tot_nobjs = 0; /* Total number of objects inserted */
size_t block_size; /* Size of block added */
@@ -1361,10 +1394,12 @@ test_abs_fill_fourth_row(hid_t fapl, H5HF_create_t *cparam)
STACK_ERROR
/* Create absolute heap */
- if(H5HF_create(f, dxpl, cparam, &fh_addr/*out*/) < 0)
+ 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
/*
* Test inserting mult. (small) objects to fill four rows in root indirect block
@@ -1430,6 +1465,7 @@ test_abs_fill_all_root_direct(hid_t fapl, H5HF_create_t *cparam)
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 nobjs = 0; /* Number of objects inserted */
unsigned tot_nobjs = 0; /* Total number of objects inserted */
size_t block_size; /* Size of block added */
@@ -1449,10 +1485,12 @@ test_abs_fill_all_root_direct(hid_t fapl, H5HF_create_t *cparam)
STACK_ERROR
/* Create absolute heap */
- if(H5HF_create(f, dxpl, cparam, &fh_addr/*out*/) < 0)
+ 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
/*
* Test inserting mult. (small) objects to fill all direct rows in root indirect block
@@ -1522,9 +1560,10 @@ test_abs_first_recursive_indirect(hid_t fapl, H5HF_create_t *cparam)
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[10]; /* Buffer for object to insert */
unsigned char robj[10]; /* Buffer for reading object */
- hsize_t heap_id; /* Heap ID for object inserted */
+ 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 */
@@ -1545,10 +1584,12 @@ test_abs_first_recursive_indirect(hid_t fapl, H5HF_create_t *cparam)
STACK_ERROR
/* Create absolute heap */
- if(H5HF_create(f, dxpl, cparam, &fh_addr/*out*/) < 0)
+ 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
/*
* Test inserting mult. (small) objects to force creation of first recursive indirect block
@@ -1584,20 +1625,20 @@ test_abs_first_recursive_indirect(hid_t fapl, H5HF_create_t *cparam)
obj[u] = u + tot_nobjs;
/* Insert object */
- heap_id = 0;
- if(H5HF_insert(f, dxpl, fh_addr, sizeof(obj), obj, &heap_id) < 0)
+ HDmemset(heap_id, 0, sizeof(heap_id));
+ if(H5HF_insert(f, dxpl, fh_addr, sizeof(obj), obj, heap_id) < 0)
FAIL_STACK_ERROR
/* Increment object count */
tot_nobjs++;
heap_size += cparam->managed.start_block_size;
- free_space = cparam->managed.start_block_size - ((sizeof(obj) + 3) + DBLOCK_OVERHEAD + (cparam->managed.max_index / 8));
+ free_space = cparam->managed.start_block_size - ((sizeof(obj) + 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
/* Read in object */
- if(H5HF_read(f, dxpl, fh_addr, &heap_id, robj) < 0)
+ if(H5HF_read(f, dxpl, fh_addr, heap_id, robj) < 0)
FAIL_STACK_ERROR
if(HDmemcmp(obj, robj, sizeof(obj)))
FAIL_STACK_ERROR
@@ -1644,9 +1685,10 @@ test_abs_second_direct_recursive_indirect(hid_t fapl, H5HF_create_t *cparam)
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[10]; /* Buffer for object to insert */
unsigned char robj[10]; /* Buffer for reading object */
- hsize_t heap_id; /* Heap ID for object inserted */
+ 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 */
@@ -1667,10 +1709,12 @@ test_abs_second_direct_recursive_indirect(hid_t fapl, H5HF_create_t *cparam)
STACK_ERROR
/* Create absolute heap */
- if(H5HF_create(f, dxpl, cparam, &fh_addr/*out*/) < 0)
+ 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
/*
* Test inserting mult. (small) objects to force creation of second direct
@@ -1715,20 +1759,20 @@ test_abs_second_direct_recursive_indirect(hid_t fapl, H5HF_create_t *cparam)
obj[u] = u + tot_nobjs;
/* Insert object */
- heap_id = 0;
- if(H5HF_insert(f, dxpl, fh_addr, sizeof(obj), obj, &heap_id) < 0)
+ HDmemset(heap_id, 0, sizeof(heap_id));
+ if(H5HF_insert(f, dxpl, fh_addr, sizeof(obj), obj, heap_id) < 0)
FAIL_STACK_ERROR
/* Increment object count */
tot_nobjs++;
heap_size += cparam->managed.start_block_size;
- free_space = cparam->managed.start_block_size - ((sizeof(obj) + 3) + DBLOCK_OVERHEAD + (cparam->managed.max_index / 8));
+ free_space = cparam->managed.start_block_size - ((sizeof(obj) + 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
/* Read in object */
- if(H5HF_read(f, dxpl, fh_addr, &heap_id, robj) < 0)
+ if(H5HF_read(f, dxpl, fh_addr, heap_id, robj) < 0)
FAIL_STACK_ERROR
if(HDmemcmp(obj, robj, sizeof(obj)))
FAIL_STACK_ERROR
@@ -1775,6 +1819,7 @@ test_abs_fill_first_recursive_indirect(hid_t fapl, H5HF_create_t *cparam)
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 nobjs = 0; /* Number of objects inserted */
unsigned tot_nobjs = 0; /* Total number of objects inserted */
size_t block_size; /* Size of block added */
@@ -1795,10 +1840,12 @@ test_abs_fill_first_recursive_indirect(hid_t fapl, H5HF_create_t *cparam)
STACK_ERROR
/* Create absolute heap */
- if(H5HF_create(f, dxpl, cparam, &fh_addr/*out*/) < 0)
+ 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
/*
* Test inserting mult. (small) objects to fill all direct
@@ -1895,9 +1942,10 @@ test_abs_second_recursive_indirect(hid_t fapl, H5HF_create_t *cparam)
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[10]; /* Buffer for object to insert */
unsigned char robj[10]; /* Buffer for reading object */
- hsize_t heap_id; /* Heap ID for object inserted */
+ 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 */
@@ -1919,10 +1967,12 @@ test_abs_second_recursive_indirect(hid_t fapl, H5HF_create_t *cparam)
STACK_ERROR
/* Create absolute heap */
- if(H5HF_create(f, dxpl, cparam, &fh_addr/*out*/) < 0)
+ 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
/*
* Test inserting mult. (small) objects to fill all direct
@@ -1985,20 +2035,20 @@ test_abs_second_recursive_indirect(hid_t fapl, H5HF_create_t *cparam)
obj[u] = u + tot_nobjs;
/* Insert object */
- heap_id = 0;
- if(H5HF_insert(f, dxpl, fh_addr, sizeof(obj), obj, &heap_id) < 0)
+ HDmemset(heap_id, 0, sizeof(heap_id));
+ if(H5HF_insert(f, dxpl, fh_addr, sizeof(obj), obj, heap_id) < 0)
FAIL_STACK_ERROR
/* Increment object count */
tot_nobjs++;
heap_size += cparam->managed.start_block_size;
- free_space = cparam->managed.start_block_size - ((sizeof(obj) + 3) + DBLOCK_OVERHEAD + (cparam->managed.max_index / 8));
+ free_space = cparam->managed.start_block_size - ((sizeof(obj) + 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
/* Read in object */
- if(H5HF_read(f, dxpl, fh_addr, &heap_id, robj) < 0)
+ if(H5HF_read(f, dxpl, fh_addr, heap_id, robj) < 0)
FAIL_STACK_ERROR
if(HDmemcmp(obj, robj, sizeof(obj)))
FAIL_STACK_ERROR
@@ -2047,6 +2097,7 @@ test_abs_fill_second_recursive_indirect(hid_t fapl, H5HF_create_t *cparam)
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 nobjs = 0; /* Number of objects inserted */
unsigned tot_nobjs = 0; /* Total number of objects inserted */
size_t block_size; /* Size of block added */
@@ -2067,10 +2118,12 @@ test_abs_fill_second_recursive_indirect(hid_t fapl, H5HF_create_t *cparam)
STACK_ERROR
/* Create absolute heap */
- if(H5HF_create(f, dxpl, cparam, &fh_addr/*out*/) < 0)
+ 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
/*
* Test inserting mult. (small) objects to fill all direct
@@ -2192,6 +2245,7 @@ test_abs_fill_recursive_indirect_row(hid_t fapl, H5HF_create_t *cparam)
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 nobjs = 0; /* Number of objects inserted */
unsigned tot_nobjs = 0; /* Total number of objects inserted */
size_t block_size; /* Size of block added */
@@ -2212,10 +2266,12 @@ test_abs_fill_recursive_indirect_row(hid_t fapl, H5HF_create_t *cparam)
STACK_ERROR
/* Create absolute heap */
- if(H5HF_create(f, dxpl, cparam, &fh_addr/*out*/) < 0)
+ 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
/*
* Test inserting mult. (small) objects to fill all direct
@@ -2314,9 +2370,10 @@ test_abs_start_2nd_recursive_indirect(hid_t fapl, H5HF_create_t *cparam)
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[10]; /* Buffer for object to insert */
unsigned char robj[10]; /* Buffer for reading object */
- hsize_t heap_id; /* Heap ID for object inserted */
+ 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 */
@@ -2338,10 +2395,12 @@ test_abs_start_2nd_recursive_indirect(hid_t fapl, H5HF_create_t *cparam)
STACK_ERROR
/* Create absolute heap */
- if(H5HF_create(f, dxpl, cparam, &fh_addr/*out*/) < 0)
+ 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
/*
* Test inserting mult. (small) objects to fill all direct
@@ -2407,20 +2466,20 @@ test_abs_start_2nd_recursive_indirect(hid_t fapl, H5HF_create_t *cparam)
obj[u] = u + tot_nobjs;
/* Insert object */
- heap_id = 0;
- if(H5HF_insert(f, dxpl, fh_addr, sizeof(obj), obj, &heap_id) < 0)
+ HDmemset(heap_id, 0, sizeof(heap_id));
+ if(H5HF_insert(f, dxpl, fh_addr, sizeof(obj), obj, heap_id) < 0)
FAIL_STACK_ERROR
/* Increment object count */
tot_nobjs++;
heap_size += cparam->managed.start_block_size;
- free_space = cparam->managed.start_block_size - ((sizeof(obj) + 3) + DBLOCK_OVERHEAD + (cparam->managed.max_index / 8));
+ free_space = cparam->managed.start_block_size - ((sizeof(obj) + 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
/* Read in object */
- if(H5HF_read(f, dxpl, fh_addr, &heap_id, robj) < 0)
+ if(H5HF_read(f, dxpl, fh_addr, heap_id, robj) < 0)
FAIL_STACK_ERROR
if(HDmemcmp(obj, robj, sizeof(obj)))
FAIL_STACK_ERROR
@@ -2467,6 +2526,7 @@ test_abs_recursive_indirect_two_deep(hid_t fapl, H5HF_create_t *cparam)
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 nobjs = 0; /* Number of objects inserted */
unsigned tot_nobjs = 0; /* Total number of objects inserted */
size_t block_size; /* Size of block added */
@@ -2487,13 +2547,12 @@ test_abs_recursive_indirect_two_deep(hid_t fapl, H5HF_create_t *cparam)
STACK_ERROR
/* Create absolute heap */
- if(H5HF_create(f, dxpl, cparam, &fh_addr/*out*/) < 0)
+ 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
-#ifdef QAK
-HDfprintf(stderr, "Fractal heap header address = %a\n", fh_addr);
-#endif /* QAK */
+ if(id_len > HEAP_ID_LEN)
+ FAIL_STACK_ERROR
/*
* Test inserting mult. (small) objects to fill all direct
@@ -2506,26 +2565,14 @@ HDfprintf(stderr, "Fractal heap header address = %a\n", fh_addr);
heap_size = 0;
nrows = 0;
while(block_size <= cparam->managed.max_direct_size) {
-#ifdef QAK
-HDfprintf(stderr, "block_size = %Zu\n", block_size);
-#endif /* QAK */
/* Loop over filling direct blocks for a row */
-#ifdef QAK
-HDfprintf(stderr, "block number: ");
-#endif /* QAK */
for(u = 0; u < cparam->managed.width; u++) {
-#ifdef QAK
-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))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
} /* end for */
-#ifdef QAK
-HDfprintf(stderr, "\n");
-#endif /* QAK */
/* Adjust block size for row */
if(nrows > 0)
@@ -2537,43 +2584,22 @@ HDfprintf(stderr, "\n");
/* Loop over rows of 2nd level deep indirect blocks */
for(w = 0; w < (H5V_log2_of2(cparam->managed.width) + 1); w++) {
-#ifdef QAK
-HDfprintf(stderr, "indirect row # = %u\n", w);
-#endif /* QAK */
for(v = 0; v < cparam->managed.width; v++) {
-#ifdef QAK
-HDfprintf(stderr, "indirect block # = %u\n", v);
-#endif /* QAK */
/* Loop over direct block rows in first recursive indirect block */
block_size = cparam->managed.start_block_size;
nrows = 0;
max_block_size = block_size * (1 << ((H5V_log2_of2(cparam->managed.max_direct_size / cparam->managed.width) -
(H5V_log2_of2(cparam->managed.start_block_size) +
H5V_log2_of2(cparam->managed.width))) + (w + 1) + 1));
-#ifdef QAK
-HDfprintf(stderr, "max_block_size = %Zu\n", max_block_size);
-#endif /* QAK */
while(block_size <= max_block_size) {
-#ifdef QAK
-HDfprintf(stderr, "block_size = %Zu\n", block_size);
-#endif /* QAK */
/* Loop over filling direct blocks for a row */
-#ifdef QAK
-HDfprintf(stderr, "block number: ");
-#endif /* QAK */
for(u = 0; u < cparam->managed.width; u++) {
-#ifdef QAK
-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))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
} /* end for */
-#ifdef QAK
-HDfprintf(stderr, "\n");
-#endif /* QAK */
/* Adjust block size for row */
if(nrows > 0)
@@ -2628,9 +2654,10 @@ test_abs_start_3rd_recursive_indirect(hid_t fapl, H5HF_create_t *cparam)
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[10]; /* Buffer for object to insert */
unsigned char robj[10]; /* Buffer for reading object */
- hsize_t heap_id; /* Heap ID for object inserted */
+ 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 */
@@ -2652,13 +2679,12 @@ test_abs_start_3rd_recursive_indirect(hid_t fapl, H5HF_create_t *cparam)
STACK_ERROR
/* Create absolute heap */
- if(H5HF_create(f, dxpl, cparam, &fh_addr/*out*/) < 0)
+ 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
-#ifdef QAK
-HDfprintf(stderr, "Fractal heap header address = %a\n", fh_addr);
-#endif /* QAK */
+ if(id_len > HEAP_ID_LEN)
+ FAIL_STACK_ERROR
/*
* Test inserting mult. (small) objects to fill all direct
@@ -2671,26 +2697,14 @@ HDfprintf(stderr, "Fractal heap header address = %a\n", fh_addr);
heap_size = 0;
nrows = 0;
while(block_size <= cparam->managed.max_direct_size) {
-#ifdef QAK
-HDfprintf(stderr, "block_size = %Zu\n", block_size);
-#endif /* QAK */
/* Loop over filling direct blocks for a row */
-#ifdef QAK
-HDfprintf(stderr, "block number: ");
-#endif /* QAK */
for(u = 0; u < cparam->managed.width; u++) {
-#ifdef QAK
-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))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
} /* end for */
-#ifdef QAK
-HDfprintf(stderr, "\n");
-#endif /* QAK */
/* Adjust block size for row */
if(nrows > 0)
@@ -2702,43 +2716,22 @@ HDfprintf(stderr, "\n");
/* Loop over rows of 2nd level deep indirect blocks */
for(w = 0; w < (H5V_log2_of2(cparam->managed.width) + 1); w++) {
-#ifdef QAK
-HDfprintf(stderr, "indirect row # = %u\n", w);
-#endif /* QAK */
for(v = 0; v < cparam->managed.width; v++) {
-#ifdef QAK
-HDfprintf(stderr, "indirect block # = %u\n", v);
-#endif /* QAK */
/* Loop over direct block rows in first recursive indirect block */
block_size = cparam->managed.start_block_size;
nrows = 0;
max_block_size = block_size * (1 << ((H5V_log2_of2(cparam->managed.max_direct_size / cparam->managed.width) -
(H5V_log2_of2(cparam->managed.start_block_size) +
H5V_log2_of2(cparam->managed.width))) + (w + 1) + 1));
-#ifdef QAK
-HDfprintf(stderr, "max_block_size = %Zu\n", max_block_size);
-#endif /* QAK */
while(block_size <= max_block_size) {
-#ifdef QAK
-HDfprintf(stderr, "block_size = %Zu\n", block_size);
-#endif /* QAK */
/* Loop over filling direct blocks for a row */
-#ifdef QAK
-HDfprintf(stderr, "block number: ");
-#endif /* QAK */
for(u = 0; u < cparam->managed.width; u++) {
-#ifdef QAK
-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))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
} /* end for */
-#ifdef QAK
-HDfprintf(stderr, "\n");
-#endif /* QAK */
/* Adjust block size for row */
if(nrows > 0)
@@ -2759,20 +2752,20 @@ HDfprintf(stderr, "\n");
obj[u] = u + tot_nobjs;
/* Insert object */
- heap_id = 0;
- if(H5HF_insert(f, dxpl, fh_addr, sizeof(obj), obj, &heap_id) < 0)
+ HDmemset(heap_id, 0, sizeof(heap_id));
+ if(H5HF_insert(f, dxpl, fh_addr, sizeof(obj), obj, heap_id) < 0)
FAIL_STACK_ERROR
/* Increment object count */
tot_nobjs++;
heap_size += cparam->managed.start_block_size;
- free_space = cparam->managed.start_block_size - ((sizeof(obj) + 3) + DBLOCK_OVERHEAD + (cparam->managed.max_index / 8));
+ free_space = cparam->managed.start_block_size - ((sizeof(obj) + 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
/* Read in object */
- if(H5HF_read(f, dxpl, fh_addr, &heap_id, robj) < 0)
+ if(H5HF_read(f, dxpl, fh_addr, heap_id, robj) < 0)
FAIL_STACK_ERROR
if(HDmemcmp(obj, robj, sizeof(obj)))
FAIL_STACK_ERROR
@@ -2820,6 +2813,7 @@ test_abs_fill_first_3rd_recursive_indirect(hid_t fapl, H5HF_create_t *cparam)
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 nobjs = 0; /* Number of objects inserted */
unsigned tot_nobjs = 0; /* Total number of objects inserted */
size_t block_size; /* Size of block added */
@@ -2840,13 +2834,12 @@ test_abs_fill_first_3rd_recursive_indirect(hid_t fapl, H5HF_create_t *cparam)
STACK_ERROR
/* Create absolute heap */
- if(H5HF_create(f, dxpl, cparam, &fh_addr/*out*/) < 0)
+ 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
-#ifdef QAK
-HDfprintf(stderr, "Fractal heap header address = %a\n", fh_addr);
-#endif /* QAK */
+ if(id_len > HEAP_ID_LEN)
+ FAIL_STACK_ERROR
/*
* Test inserting mult. (small) objects to fill all direct
@@ -2859,26 +2852,14 @@ HDfprintf(stderr, "Fractal heap header address = %a\n", fh_addr);
heap_size = 0;
nrows = 0;
while(block_size <= cparam->managed.max_direct_size) {
-#ifdef QAK
-HDfprintf(stderr, "block_size = %Zu\n", block_size);
-#endif /* QAK */
/* Loop over filling direct blocks for a row */
-#ifdef QAK
-HDfprintf(stderr, "block number: ");
-#endif /* QAK */
for(u = 0; u < cparam->managed.width; u++) {
-#ifdef QAK
-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))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
} /* end for */
-#ifdef QAK
-HDfprintf(stderr, "\n");
-#endif /* QAK */
/* Adjust block size for row */
if(nrows > 0)
@@ -2890,43 +2871,22 @@ HDfprintf(stderr, "\n");
/* Loop over rows of 2nd level deep indirect blocks */
for(w = 0; w < (H5V_log2_of2(cparam->managed.width) + 1); w++) {
-#ifdef QAK
-HDfprintf(stderr, "indirect row # = %u\n", w);
-#endif /* QAK */
for(v = 0; v < cparam->managed.width; v++) {
-#ifdef QAK
-HDfprintf(stderr, "indirect block # = %u\n", v);
-#endif /* QAK */
/* Loop over direct block rows in first recursive indirect block */
block_size = cparam->managed.start_block_size;
nrows = 0;
max_block_size = block_size * (1 << ((H5V_log2_of2(cparam->managed.max_direct_size / cparam->managed.width) -
(H5V_log2_of2(cparam->managed.start_block_size) +
H5V_log2_of2(cparam->managed.width))) + (w + 1) + 1));
-#ifdef QAK
-HDfprintf(stderr, "max_block_size = %Zu\n", max_block_size);
-#endif /* QAK */
while(block_size <= max_block_size) {
-#ifdef QAK
-HDfprintf(stderr, "block_size = %Zu\n", block_size);
-#endif /* QAK */
/* Loop over filling direct blocks for a row */
-#ifdef QAK
-HDfprintf(stderr, "block number: ");
-#endif /* QAK */
for(u = 0; u < cparam->managed.width; u++) {
-#ifdef QAK
-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))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
} /* end for */
-#ifdef QAK
-HDfprintf(stderr, "\n");
-#endif /* QAK */
/* Adjust block size for row */
if(nrows > 0)
@@ -2961,39 +2921,21 @@ HDfprintf(stderr, "\n");
/* Loop over row of indirect blocks */
for(v = 0; v < cparam->managed.width; v++) {
-#ifdef QAK
-HDfprintf(stderr, "indirect block # = %u\n", v);
-#endif /* QAK */
/* Loop over direct block rows in first recursive indirect block */
block_size = cparam->managed.start_block_size;
nrows = 0;
max_block_size = block_size * (1 << ((H5V_log2_of2((2 * cparam->managed.max_direct_size) / cparam->managed.width) -
(H5V_log2_of2(cparam->managed.start_block_size) +
H5V_log2_of2(cparam->managed.width))) + 1));
-#ifdef QAK
-HDfprintf(stderr, "max_block_size = %Zu\n", max_block_size);
-#endif /* QAK */
while(block_size <= max_block_size) {
-#ifdef QAK
-HDfprintf(stderr, "block_size = %Zu\n", block_size);
-#endif /* QAK */
/* Loop over filling direct blocks for a row */
-#ifdef QAK
-HDfprintf(stderr, "block number: ");
-#endif /* QAK */
for(u = 0; u < cparam->managed.width; u++) {
-#ifdef QAK
-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))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
} /* end for */
-#ifdef QAK
-HDfprintf(stderr, "\n");
-#endif /* QAK */
/* Adjust block size for row */
if(nrows > 0)
@@ -3047,6 +2989,7 @@ test_abs_fill_3rd_recursive_indirect_row(hid_t fapl, H5HF_create_t *cparam)
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 nobjs = 0; /* Number of objects inserted */
unsigned tot_nobjs = 0; /* Total number of objects inserted */
size_t block_size; /* Size of block added */
@@ -3067,13 +3010,12 @@ test_abs_fill_3rd_recursive_indirect_row(hid_t fapl, H5HF_create_t *cparam)
STACK_ERROR
/* Create absolute heap */
- if(H5HF_create(f, dxpl, cparam, &fh_addr/*out*/) < 0)
+ 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
-#ifdef QAK
-HDfprintf(stderr, "Fractal heap header address = %a\n", fh_addr);
-#endif /* QAK */
+ if(id_len > HEAP_ID_LEN)
+ FAIL_STACK_ERROR
/*
* Test inserting mult. (small) objects to fill all direct
@@ -3086,26 +3028,14 @@ HDfprintf(stderr, "Fractal heap header address = %a\n", fh_addr);
heap_size = 0;
nrows = 0;
while(block_size <= cparam->managed.max_direct_size) {
-#ifdef QAK
-HDfprintf(stderr, "block_size = %Zu\n", block_size);
-#endif /* QAK */
/* Loop over filling direct blocks for a row */
-#ifdef QAK
-HDfprintf(stderr, "block number: ");
-#endif /* QAK */
for(u = 0; u < cparam->managed.width; u++) {
-#ifdef QAK
-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))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
} /* end for */
-#ifdef QAK
-HDfprintf(stderr, "\n");
-#endif /* QAK */
/* Adjust block size for row */
if(nrows > 0)
@@ -3117,43 +3047,22 @@ HDfprintf(stderr, "\n");
/* Loop over rows of 2nd level deep indirect blocks */
for(w = 0; w < (H5V_log2_of2(cparam->managed.width) + 1); w++) {
-#ifdef QAK
-HDfprintf(stderr, "indirect row # = %u\n", w);
-#endif /* QAK */
for(v = 0; v < cparam->managed.width; v++) {
-#ifdef QAK
-HDfprintf(stderr, "indirect block # = %u\n", v);
-#endif /* QAK */
/* Loop over direct block rows in first recursive indirect block */
block_size = cparam->managed.start_block_size;
nrows = 0;
max_block_size = block_size * (1 << ((H5V_log2_of2(cparam->managed.max_direct_size / cparam->managed.width) -
(H5V_log2_of2(cparam->managed.start_block_size) +
H5V_log2_of2(cparam->managed.width))) + (w + 1) + 1));
-#ifdef QAK
-HDfprintf(stderr, "max_block_size = %Zu\n", max_block_size);
-#endif /* QAK */
while(block_size <= max_block_size) {
-#ifdef QAK
-HDfprintf(stderr, "block_size = %Zu\n", block_size);
-#endif /* QAK */
/* Loop over filling direct blocks for a row */
-#ifdef QAK
-HDfprintf(stderr, "block number: ");
-#endif /* QAK */
for(u = 0; u < cparam->managed.width; u++) {
-#ifdef QAK
-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))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
} /* end for */
-#ifdef QAK
-HDfprintf(stderr, "\n");
-#endif /* QAK */
/* Adjust block size for row */
if(nrows > 0)
@@ -3190,39 +3099,21 @@ HDfprintf(stderr, "\n");
/* Loop over row of indirect blocks */
for(v = 0; v < cparam->managed.width; v++) {
-#ifdef QAK
-HDfprintf(stderr, "indirect block # = %u\n", v);
-#endif /* QAK */
/* Loop over direct block rows in first recursive indirect block */
block_size = cparam->managed.start_block_size;
nrows = 0;
max_block_size = block_size * (1 << ((H5V_log2_of2((2 * cparam->managed.max_direct_size) / cparam->managed.width) -
(H5V_log2_of2(cparam->managed.start_block_size) +
H5V_log2_of2(cparam->managed.width))) + 1));
-#ifdef QAK
-HDfprintf(stderr, "max_block_size = %Zu\n", max_block_size);
-#endif /* QAK */
while(block_size <= max_block_size) {
-#ifdef QAK
-HDfprintf(stderr, "block_size = %Zu\n", block_size);
-#endif /* QAK */
/* Loop over filling direct blocks for a row */
-#ifdef QAK
-HDfprintf(stderr, "block number: ");
-#endif /* QAK */
for(u = 0; u < cparam->managed.width; u++) {
-#ifdef QAK
-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))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
} /* end for */
-#ifdef QAK
-HDfprintf(stderr, "\n");
-#endif /* QAK */
/* Adjust block size for row */
if(nrows > 0)
@@ -3277,6 +3168,7 @@ test_abs_fill_all_3rd_recursive_indirect(hid_t fapl, H5HF_create_t *cparam)
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 nobjs = 0; /* Number of objects inserted */
unsigned tot_nobjs = 0; /* Total number of objects inserted */
size_t block_size; /* Size of block added */
@@ -3297,13 +3189,12 @@ test_abs_fill_all_3rd_recursive_indirect(hid_t fapl, H5HF_create_t *cparam)
STACK_ERROR
/* Create absolute heap */
- if(H5HF_create(f, dxpl, cparam, &fh_addr/*out*/) < 0)
+ 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
-#ifdef QAK
-HDfprintf(stderr, "Fractal heap header address = %a\n", fh_addr);
-#endif /* QAK */
+ if(id_len > HEAP_ID_LEN)
+ FAIL_STACK_ERROR
/*
* Test inserting mult. (small) objects to fill all direct
@@ -3316,26 +3207,14 @@ HDfprintf(stderr, "Fractal heap header address = %a\n", fh_addr);
heap_size = 0;
nrows = 0;
while(block_size <= cparam->managed.max_direct_size) {
-#ifdef QAK
-HDfprintf(stderr, "block_size = %Zu\n", block_size);
-#endif /* QAK */
/* Loop over filling direct blocks for a row */
-#ifdef QAK
-HDfprintf(stderr, "block number: ");
-#endif /* QAK */
for(u = 0; u < cparam->managed.width; u++) {
-#ifdef QAK
-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))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
} /* end for */
-#ifdef QAK
-HDfprintf(stderr, "\n");
-#endif /* QAK */
/* Adjust block size for row */
if(nrows > 0)
@@ -3347,43 +3226,22 @@ HDfprintf(stderr, "\n");
/* Loop over rows of 2nd level deep indirect blocks */
for(w = 0; w < (H5V_log2_of2(cparam->managed.width) + 1); w++) {
-#ifdef QAK
-HDfprintf(stderr, "indirect row # = %u\n", w);
-#endif /* QAK */
for(v = 0; v < cparam->managed.width; v++) {
-#ifdef QAK
-HDfprintf(stderr, "indirect block # = %u\n", v);
-#endif /* QAK */
/* Loop over direct block rows in first recursive indirect block */
block_size = cparam->managed.start_block_size;
nrows = 0;
max_block_size = block_size * (1 << ((H5V_log2_of2(cparam->managed.max_direct_size / cparam->managed.width) -
(H5V_log2_of2(cparam->managed.start_block_size) +
H5V_log2_of2(cparam->managed.width))) + (w + 1) + 1));
-#ifdef QAK
-HDfprintf(stderr, "max_block_size = %Zu\n", max_block_size);
-#endif /* QAK */
while(block_size <= max_block_size) {
-#ifdef QAK
-HDfprintf(stderr, "block_size = %Zu\n", block_size);
-#endif /* QAK */
/* Loop over filling direct blocks for a row */
-#ifdef QAK
-HDfprintf(stderr, "block number: ");
-#endif /* QAK */
for(u = 0; u < cparam->managed.width; u++) {
-#ifdef QAK
-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))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
} /* end for */
-#ifdef QAK
-HDfprintf(stderr, "\n");
-#endif /* QAK */
/* Adjust block size for row */
if(nrows > 0)
@@ -3397,15 +3255,9 @@ HDfprintf(stderr, "\n");
/* Loop over rows of 3rd level deep indirect blocks */
for(y = 0; y < (H5V_log2_of2(cparam->managed.width) + 1); y++) {
-#ifdef QAK
-HDfprintf(stderr, "3rd indirect row # = %u\n", y);
-#endif /* QAK */
/* Loop over row of 3rd level deep indirect blocks */
for(x = 0; x < cparam->managed.width; x++) {
-#ifdef QAK
-HDfprintf(stderr, "3rd indirect block # = %u\n", x);
-#endif /* QAK */
/* Loop over direct block rows in third level indirect block */
block_size = cparam->managed.start_block_size;
@@ -3430,45 +3282,24 @@ HDfprintf(stderr, "3rd indirect block # = %u\n", x);
/* Loop over rows of 2nd level deep indirect blocks */
for(w = 0; w < (y + 1); w++) {
-#ifdef QAK
-HDfprintf(stderr, "indirect row # = %u\n", w);
-#endif /* QAK */
/* Loop over row of indirect blocks */
for(v = 0; v < cparam->managed.width; v++) {
-#ifdef QAK
-HDfprintf(stderr, "indirect block # = %u\n", v);
-#endif /* QAK */
/* Loop over direct block rows in first recursive indirect block */
block_size = cparam->managed.start_block_size;
nrows = 0;
max_block_size = block_size * (1 << ((H5V_log2_of2(cparam->managed.max_direct_size / cparam->managed.width) -
(H5V_log2_of2(cparam->managed.start_block_size) +
H5V_log2_of2(cparam->managed.width))) + (w + 1) + 1));
-#ifdef QAK
-HDfprintf(stderr, "max_block_size = %Zu\n", max_block_size);
-#endif /* QAK */
while(block_size <= max_block_size) {
-#ifdef QAK
-HDfprintf(stderr, "block_size = %Zu\n", block_size);
-#endif /* QAK */
/* Loop over filling direct blocks for a row */
-#ifdef QAK
-HDfprintf(stderr, "block number: ");
-#endif /* QAK */
for(u = 0; u < cparam->managed.width; u++) {
-#ifdef QAK
-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))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
} /* end for */
-#ifdef QAK
-HDfprintf(stderr, "\n");
-#endif /* QAK */
/* Adjust block size for row */
if(nrows > 0)
@@ -3526,9 +3357,10 @@ test_abs_start_4th_recursive_indirect(hid_t fapl, H5HF_create_t *cparam)
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[10]; /* Buffer for object to insert */
unsigned char robj[10]; /* Buffer for reading object */
- hsize_t heap_id; /* Heap ID for object inserted */
+ 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 */
@@ -3550,13 +3382,12 @@ test_abs_start_4th_recursive_indirect(hid_t fapl, H5HF_create_t *cparam)
STACK_ERROR
/* Create absolute heap */
- if(H5HF_create(f, dxpl, cparam, &fh_addr/*out*/) < 0)
+ 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
-#ifdef QAK
-HDfprintf(stderr, "Fractal heap header address = %a\n", fh_addr);
-#endif /* QAK */
+ if(id_len > HEAP_ID_LEN)
+ FAIL_STACK_ERROR
/*
* Test inserting mult. (small) objects to fill all direct
@@ -3569,26 +3400,14 @@ HDfprintf(stderr, "Fractal heap header address = %a\n", fh_addr);
heap_size = 0;
nrows = 0;
while(block_size <= cparam->managed.max_direct_size) {
-#ifdef QAK
-HDfprintf(stderr, "block_size = %Zu\n", block_size);
-#endif /* QAK */
/* Loop over filling direct blocks for a row */
-#ifdef QAK
-HDfprintf(stderr, "block number: ");
-#endif /* QAK */
for(u = 0; u < cparam->managed.width; u++) {
-#ifdef QAK
-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))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
} /* end for */
-#ifdef QAK
-HDfprintf(stderr, "\n");
-#endif /* QAK */
/* Adjust block size for row */
if(nrows > 0)
@@ -3600,43 +3419,22 @@ HDfprintf(stderr, "\n");
/* Loop over rows of 2nd level deep indirect blocks */
for(w = 0; w < (H5V_log2_of2(cparam->managed.width) + 1); w++) {
-#ifdef QAK
-HDfprintf(stderr, "indirect row # = %u\n", w);
-#endif /* QAK */
for(v = 0; v < cparam->managed.width; v++) {
-#ifdef QAK
-HDfprintf(stderr, "indirect block # = %u\n", v);
-#endif /* QAK */
/* Loop over direct block rows in first recursive indirect block */
block_size = cparam->managed.start_block_size;
nrows = 0;
max_block_size = block_size * (1 << ((H5V_log2_of2(cparam->managed.max_direct_size / cparam->managed.width) -
(H5V_log2_of2(cparam->managed.start_block_size) +
H5V_log2_of2(cparam->managed.width))) + (w + 1) + 1));
-#ifdef QAK
-HDfprintf(stderr, "max_block_size = %Zu\n", max_block_size);
-#endif /* QAK */
while(block_size <= max_block_size) {
-#ifdef QAK
-HDfprintf(stderr, "block_size = %Zu\n", block_size);
-#endif /* QAK */
/* Loop over filling direct blocks for a row */
-#ifdef QAK
-HDfprintf(stderr, "block number: ");
-#endif /* QAK */
for(u = 0; u < cparam->managed.width; u++) {
-#ifdef QAK
-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))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
} /* end for */
-#ifdef QAK
-HDfprintf(stderr, "\n");
-#endif /* QAK */
/* Adjust block size for row */
if(nrows > 0)
@@ -3650,15 +3448,9 @@ HDfprintf(stderr, "\n");
/* Loop over rows of 3rd level deep indirect blocks */
for(y = 0; y < (H5V_log2_of2(cparam->managed.width) + 1); y++) {
-#ifdef QAK
-HDfprintf(stderr, "3rd indirect row # = %u\n", y);
-#endif /* QAK */
/* Loop over row of 3rd level deep indirect blocks */
for(x = 0; x < cparam->managed.width; x++) {
-#ifdef QAK
-HDfprintf(stderr, "3rd indirect block # = %u\n", x);
-#endif /* QAK */
/* Loop over direct block rows in third level indirect block */
block_size = cparam->managed.start_block_size;
@@ -3683,45 +3475,24 @@ HDfprintf(stderr, "3rd indirect block # = %u\n", x);
/* Loop over rows of 2nd level deep indirect blocks */
for(w = 0; w < (y + 1); w++) {
-#ifdef QAK
-HDfprintf(stderr, "indirect row # = %u\n", w);
-#endif /* QAK */
/* Loop over row of indirect blocks */
for(v = 0; v < cparam->managed.width; v++) {
-#ifdef QAK
-HDfprintf(stderr, "indirect block # = %u\n", v);
-#endif /* QAK */
/* Loop over direct block rows in first recursive indirect block */
block_size = cparam->managed.start_block_size;
nrows = 0;
max_block_size = block_size * (1 << ((H5V_log2_of2(cparam->managed.max_direct_size / cparam->managed.width) -
(H5V_log2_of2(cparam->managed.start_block_size) +
H5V_log2_of2(cparam->managed.width))) + (w + 1) + 1));
-#ifdef QAK
-HDfprintf(stderr, "max_block_size = %Zu\n", max_block_size);
-#endif /* QAK */
while(block_size <= max_block_size) {
-#ifdef QAK
-HDfprintf(stderr, "block_size = %Zu\n", block_size);
-#endif /* QAK */
/* Loop over filling direct blocks for a row */
-#ifdef QAK
-HDfprintf(stderr, "block number: ");
-#endif /* QAK */
for(u = 0; u < cparam->managed.width; u++) {
-#ifdef QAK
-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))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
} /* end for */
-#ifdef QAK
-HDfprintf(stderr, "\n");
-#endif /* QAK */
/* Adjust block size for row */
if(nrows > 0)
@@ -3744,20 +3515,20 @@ HDfprintf(stderr, "\n");
obj[u] = u + tot_nobjs;
/* Insert object */
- heap_id = 0;
- if(H5HF_insert(f, dxpl, fh_addr, sizeof(obj), obj, &heap_id) < 0)
+ HDmemset(heap_id, 0, sizeof(heap_id));
+ if(H5HF_insert(f, dxpl, fh_addr, sizeof(obj), obj, heap_id) < 0)
FAIL_STACK_ERROR
/* Increment object count */
tot_nobjs++;
heap_size += cparam->managed.start_block_size;
- free_space = cparam->managed.start_block_size - ((sizeof(obj) + 3) + DBLOCK_OVERHEAD + (cparam->managed.max_index / 8));
+ free_space = cparam->managed.start_block_size - ((sizeof(obj) + 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
/* Read in object */
- if(H5HF_read(f, dxpl, fh_addr, &heap_id, robj) < 0)
+ if(H5HF_read(f, dxpl, fh_addr, heap_id, robj) < 0)
FAIL_STACK_ERROR
if(HDmemcmp(obj, robj, sizeof(obj)))
FAIL_STACK_ERROR
@@ -3806,6 +3577,7 @@ test_abs_fill_first_4th_recursive_indirect(hid_t fapl, H5HF_create_t *cparam)
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 nobjs = 0; /* Number of objects inserted */
unsigned tot_nobjs = 0; /* Total number of objects inserted */
size_t block_size; /* Size of block added */
@@ -3826,13 +3598,12 @@ test_abs_fill_first_4th_recursive_indirect(hid_t fapl, H5HF_create_t *cparam)
STACK_ERROR
/* Create absolute heap */
- if(H5HF_create(f, dxpl, cparam, &fh_addr/*out*/) < 0)
+ 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
-#ifdef QAK
-HDfprintf(stderr, "Fractal heap header address = %a\n", fh_addr);
-#endif /* QAK */
+ if(id_len > HEAP_ID_LEN)
+ FAIL_STACK_ERROR
/*
* Test inserting mult. (small) objects to fill all direct
@@ -3845,26 +3616,14 @@ HDfprintf(stderr, "Fractal heap header address = %a\n", fh_addr);
heap_size = 0;
nrows = 0;
while(block_size <= cparam->managed.max_direct_size) {
-#ifdef QAK
-HDfprintf(stderr, "block_size = %Zu\n", block_size);
-#endif /* QAK */
/* Loop over filling direct blocks for a row */
-#ifdef QAK
-HDfprintf(stderr, "block number: ");
-#endif /* QAK */
for(u = 0; u < cparam->managed.width; u++) {
-#ifdef QAK
-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))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
} /* end for */
-#ifdef QAK
-HDfprintf(stderr, "\n");
-#endif /* QAK */
/* Adjust block size for row */
if(nrows > 0)
@@ -3876,43 +3635,22 @@ HDfprintf(stderr, "\n");
/* Loop over rows of 2nd level deep indirect blocks */
for(w = 0; w < (H5V_log2_of2(cparam->managed.width) + 1); w++) {
-#ifdef QAK
-HDfprintf(stderr, "indirect row # = %u\n", w);
-#endif /* QAK */
for(v = 0; v < cparam->managed.width; v++) {
-#ifdef QAK
-HDfprintf(stderr, "indirect block # = %u\n", v);
-#endif /* QAK */
/* Loop over direct block rows in first recursive indirect block */
block_size = cparam->managed.start_block_size;
nrows = 0;
max_block_size = block_size * (1 << ((H5V_log2_of2(cparam->managed.max_direct_size / cparam->managed.width) -
(H5V_log2_of2(cparam->managed.start_block_size) +
H5V_log2_of2(cparam->managed.width))) + (w + 1) + 1));
-#ifdef QAK
-HDfprintf(stderr, "max_block_size = %Zu\n", max_block_size);
-#endif /* QAK */
while(block_size <= max_block_size) {
-#ifdef QAK
-HDfprintf(stderr, "block_size = %Zu\n", block_size);
-#endif /* QAK */
/* Loop over filling direct blocks for a row */
-#ifdef QAK
-HDfprintf(stderr, "block number: ");
-#endif /* QAK */
for(u = 0; u < cparam->managed.width; u++) {
-#ifdef QAK
-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))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
} /* end for */
-#ifdef QAK
-HDfprintf(stderr, "\n");
-#endif /* QAK */
/* Adjust block size for row */
if(nrows > 0)
@@ -3926,15 +3664,9 @@ HDfprintf(stderr, "\n");
/* Loop over rows of 3rd level deep indirect blocks */
for(y = 0; y < (H5V_log2_of2(cparam->managed.width) + 1); y++) {
-#ifdef QAK
-HDfprintf(stderr, "3rd indirect row # = %u\n", y);
-#endif /* QAK */
/* Loop over row of 3rd level deep indirect blocks */
for(x = 0; x < cparam->managed.width; x++) {
-#ifdef QAK
-HDfprintf(stderr, "3rd indirect block # = %u\n", x);
-#endif /* QAK */
/* Loop over direct block rows in third level indirect block */
block_size = cparam->managed.start_block_size;
@@ -3959,45 +3691,24 @@ HDfprintf(stderr, "3rd indirect block # = %u\n", x);
/* Loop over rows of 2nd level deep indirect blocks */
for(w = 0; w < (y + 1); w++) {
-#ifdef QAK
-HDfprintf(stderr, "indirect row # = %u\n", w);
-#endif /* QAK */
/* Loop over row of indirect blocks */
for(v = 0; v < cparam->managed.width; v++) {
-#ifdef QAK
-HDfprintf(stderr, "indirect block # = %u\n", v);
-#endif /* QAK */
/* Loop over direct block rows in first recursive indirect block */
block_size = cparam->managed.start_block_size;
nrows = 0;
max_block_size = block_size * (1 << ((H5V_log2_of2(cparam->managed.max_direct_size / cparam->managed.width) -
(H5V_log2_of2(cparam->managed.start_block_size) +
H5V_log2_of2(cparam->managed.width))) + (w + 1) + 1));
-#ifdef QAK
-HDfprintf(stderr, "max_block_size = %Zu\n", max_block_size);
-#endif /* QAK */
while(block_size <= max_block_size) {
-#ifdef QAK
-HDfprintf(stderr, "block_size = %Zu\n", block_size);
-#endif /* QAK */
/* Loop over filling direct blocks for a row */
-#ifdef QAK
-HDfprintf(stderr, "block number: ");
-#endif /* QAK */
for(u = 0; u < cparam->managed.width; u++) {
-#ifdef QAK
-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))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
} /* end for */
-#ifdef QAK
-HDfprintf(stderr, "\n");
-#endif /* QAK */
/* Adjust block size for row */
if(nrows > 0)
@@ -4034,45 +3745,24 @@ HDfprintf(stderr, "\n");
/* Loop over rows of 2nd level deep indirect blocks */
for(w = 0; w < (H5V_log2_of2(cparam->managed.width) + 1); w++) {
-#ifdef QAK
-HDfprintf(stderr, "indirect row # = %u\n", w);
-#endif /* QAK */
/* Loop over row of indirect blocks */
for(v = 0; v < cparam->managed.width; v++) {
-#ifdef QAK
-HDfprintf(stderr, "indirect block # = %u\n", v);
-#endif /* QAK */
/* Loop over direct block rows in first recursive indirect block */
block_size = cparam->managed.start_block_size;
nrows = 0;
max_block_size = block_size * (1 << ((H5V_log2_of2(cparam->managed.max_direct_size / cparam->managed.width) -
(H5V_log2_of2(cparam->managed.start_block_size) +
H5V_log2_of2(cparam->managed.width))) + (w + 1) + 1));
-#ifdef QAK
-HDfprintf(stderr, "max_block_size = %Zu\n", max_block_size);
-#endif /* QAK */
while(block_size <= max_block_size) {
-#ifdef QAK
-HDfprintf(stderr, "block_size = %Zu\n", block_size);
-#endif /* QAK */
/* Loop over filling direct blocks for a row */
-#ifdef QAK
-HDfprintf(stderr, "block number: ");
-#endif /* QAK */
for(u = 0; u < cparam->managed.width; u++) {
-#ifdef QAK
-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))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
} /* end for */
-#ifdef QAK
-HDfprintf(stderr, "\n");
-#endif /* QAK */
/* Adjust block size for row */
if(nrows > 0)
@@ -4086,9 +3776,6 @@ HDfprintf(stderr, "\n");
/* Loop over row of 3rd level deep indirect blocks */
for(x = 0; x < cparam->managed.width; x++) {
-#ifdef QAK
-HDfprintf(stderr, "3rd indirect block # = %u\n", x);
-#endif /* QAK */
/* Loop over direct block rows in third level indirect block */
block_size = cparam->managed.start_block_size;
@@ -4113,45 +3800,24 @@ HDfprintf(stderr, "3rd indirect block # = %u\n", x);
/* Loop over rows of 2nd level deep indirect blocks */
for(w = 0; w < 1; w++) {
-#ifdef QAK
-HDfprintf(stderr, "indirect row # = %u\n", w);
-#endif /* QAK */
/* Loop over row of indirect blocks */
for(v = 0; v < cparam->managed.width; v++) {
-#ifdef QAK
-HDfprintf(stderr, "indirect block # = %u\n", v);
-#endif /* QAK */
/* Loop over direct block rows in first recursive indirect block */
block_size = cparam->managed.start_block_size;
nrows = 0;
max_block_size = block_size * (1 << ((H5V_log2_of2(cparam->managed.max_direct_size / cparam->managed.width) -
(H5V_log2_of2(cparam->managed.start_block_size) +
H5V_log2_of2(cparam->managed.width))) + (w + 1) + 1));
-#ifdef QAK
-HDfprintf(stderr, "max_block_size = %Zu\n", max_block_size);
-#endif /* QAK */
while(block_size <= max_block_size) {
-#ifdef QAK
-HDfprintf(stderr, "block_size = %Zu\n", block_size);
-#endif /* QAK */
/* Loop over filling direct blocks for a row */
-#ifdef QAK
-HDfprintf(stderr, "block number: ");
-#endif /* QAK */
for(u = 0; u < cparam->managed.width; u++) {
-#ifdef QAK
-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))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
} /* end for */
-#ifdef QAK
-HDfprintf(stderr, "\n");
-#endif /* QAK */
/* Adjust block size for row */
if(nrows > 0)
@@ -4208,6 +3874,7 @@ test_abs_fill_4th_recursive_indirect_row(hid_t fapl, H5HF_create_t *cparam)
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 nobjs = 0; /* Number of objects inserted */
unsigned tot_nobjs = 0; /* Total number of objects inserted */
size_t block_size; /* Size of block added */
@@ -4228,13 +3895,12 @@ test_abs_fill_4th_recursive_indirect_row(hid_t fapl, H5HF_create_t *cparam)
STACK_ERROR
/* Create absolute heap */
- if(H5HF_create(f, dxpl, cparam, &fh_addr/*out*/) < 0)
+ 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
-#ifdef QAK
-HDfprintf(stderr, "Fractal heap header address = %a\n", fh_addr);
-#endif /* QAK */
+ if(id_len > HEAP_ID_LEN)
+ FAIL_STACK_ERROR
/*
* Test inserting mult. (small) objects to fill all direct
@@ -4247,26 +3913,14 @@ HDfprintf(stderr, "Fractal heap header address = %a\n", fh_addr);
heap_size = 0;
nrows = 0;
while(block_size <= cparam->managed.max_direct_size) {
-#ifdef QAK
-HDfprintf(stderr, "block_size = %Zu\n", block_size);
-#endif /* QAK */
/* Loop over filling direct blocks for a row */
-#ifdef QAK
-HDfprintf(stderr, "block number: ");
-#endif /* QAK */
for(u = 0; u < cparam->managed.width; u++) {
-#ifdef QAK
-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))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
} /* end for */
-#ifdef QAK
-HDfprintf(stderr, "\n");
-#endif /* QAK */
/* Adjust block size for row */
if(nrows > 0)
@@ -4278,43 +3932,22 @@ HDfprintf(stderr, "\n");
/* Loop over rows of 2nd level deep indirect blocks */
for(w = 0; w < (H5V_log2_of2(cparam->managed.width) + 1); w++) {
-#ifdef QAK
-HDfprintf(stderr, "indirect row # = %u\n", w);
-#endif /* QAK */
for(v = 0; v < cparam->managed.width; v++) {
-#ifdef QAK
-HDfprintf(stderr, "indirect block # = %u\n", v);
-#endif /* QAK */
/* Loop over direct block rows in first recursive indirect block */
block_size = cparam->managed.start_block_size;
nrows = 0;
max_block_size = block_size * (1 << ((H5V_log2_of2(cparam->managed.max_direct_size / cparam->managed.width) -
(H5V_log2_of2(cparam->managed.start_block_size) +
H5V_log2_of2(cparam->managed.width))) + (w + 1) + 1));
-#ifdef QAK
-HDfprintf(stderr, "max_block_size = %Zu\n", max_block_size);
-#endif /* QAK */
while(block_size <= max_block_size) {
-#ifdef QAK
-HDfprintf(stderr, "block_size = %Zu\n", block_size);
-#endif /* QAK */
/* Loop over filling direct blocks for a row */
-#ifdef QAK
-HDfprintf(stderr, "block number: ");
-#endif /* QAK */
for(u = 0; u < cparam->managed.width; u++) {
-#ifdef QAK
-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))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
} /* end for */
-#ifdef QAK
-HDfprintf(stderr, "\n");
-#endif /* QAK */
/* Adjust block size for row */
if(nrows > 0)
@@ -4328,15 +3961,9 @@ HDfprintf(stderr, "\n");
/* Loop over rows of 3rd level deep indirect blocks */
for(y = 0; y < (H5V_log2_of2(cparam->managed.width) + 1); y++) {
-#ifdef QAK
-HDfprintf(stderr, "3rd indirect row # = %u\n", y);
-#endif /* QAK */
/* Loop over row of 3rd level deep indirect blocks */
for(x = 0; x < cparam->managed.width; x++) {
-#ifdef QAK
-HDfprintf(stderr, "3rd indirect block # = %u\n", x);
-#endif /* QAK */
/* Loop over direct block rows in third level indirect block */
block_size = cparam->managed.start_block_size;
@@ -4361,45 +3988,24 @@ HDfprintf(stderr, "3rd indirect block # = %u\n", x);
/* Loop over rows of 2nd level deep indirect blocks */
for(w = 0; w < (y + 1); w++) {
-#ifdef QAK
-HDfprintf(stderr, "indirect row # = %u\n", w);
-#endif /* QAK */
/* Loop over row of indirect blocks */
for(v = 0; v < cparam->managed.width; v++) {
-#ifdef QAK
-HDfprintf(stderr, "indirect block # = %u\n", v);
-#endif /* QAK */
/* Loop over direct block rows in first recursive indirect block */
block_size = cparam->managed.start_block_size;
nrows = 0;
max_block_size = block_size * (1 << ((H5V_log2_of2(cparam->managed.max_direct_size / cparam->managed.width) -
(H5V_log2_of2(cparam->managed.start_block_size) +
H5V_log2_of2(cparam->managed.width))) + (w + 1) + 1));
-#ifdef QAK
-HDfprintf(stderr, "max_block_size = %Zu\n", max_block_size);
-#endif /* QAK */
while(block_size <= max_block_size) {
-#ifdef QAK
-HDfprintf(stderr, "block_size = %Zu\n", block_size);
-#endif /* QAK */
/* Loop over filling direct blocks for a row */
-#ifdef QAK
-HDfprintf(stderr, "block number: ");
-#endif /* QAK */
for(u = 0; u < cparam->managed.width; u++) {
-#ifdef QAK
-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))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
} /* end for */
-#ifdef QAK
-HDfprintf(stderr, "\n");
-#endif /* QAK */
/* Adjust block size for row */
if(nrows > 0)
@@ -4415,9 +4021,6 @@ HDfprintf(stderr, "\n");
/* Loop over row of 4th level indirect blocks */
for(z = 0; z < cparam->managed.width; z++) {
-#ifdef QAK
-HDfprintf(stderr, "4th indirect block # = %u\n", z);
-#endif /* QAK */
/* Loop over direct block rows in fourth level indirect block */
block_size = cparam->managed.start_block_size;
@@ -4442,45 +4045,24 @@ HDfprintf(stderr, "4th indirect block # = %u\n", z);
/* Loop over rows of 2nd level deep indirect blocks */
for(w = 0; w < (H5V_log2_of2(cparam->managed.width) + 1); w++) {
-#ifdef QAK
-HDfprintf(stderr, "indirect row # = %u\n", w);
-#endif /* QAK */
/* Loop over row of indirect blocks */
for(v = 0; v < cparam->managed.width; v++) {
-#ifdef QAK
-HDfprintf(stderr, "indirect block # = %u\n", v);
-#endif /* QAK */
/* Loop over direct block rows in first recursive indirect block */
block_size = cparam->managed.start_block_size;
nrows = 0;
max_block_size = block_size * (1 << ((H5V_log2_of2(cparam->managed.max_direct_size / cparam->managed.width) -
(H5V_log2_of2(cparam->managed.start_block_size) +
H5V_log2_of2(cparam->managed.width))) + (w + 1) + 1));
-#ifdef QAK
-HDfprintf(stderr, "max_block_size = %Zu\n", max_block_size);
-#endif /* QAK */
while(block_size <= max_block_size) {
-#ifdef QAK
-HDfprintf(stderr, "block_size = %Zu\n", block_size);
-#endif /* QAK */
/* Loop over filling direct blocks for a row */
-#ifdef QAK
-HDfprintf(stderr, "block number: ");
-#endif /* QAK */
for(u = 0; u < cparam->managed.width; u++) {
-#ifdef QAK
-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))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
} /* end for */
-#ifdef QAK
-HDfprintf(stderr, "\n");
-#endif /* QAK */
/* Adjust block size for row */
if(nrows > 0)
@@ -4494,15 +4076,9 @@ HDfprintf(stderr, "\n");
/* Loop over rows of 3rd level deep indirect blocks */
for(y = 0; y < 1; y++) {
-#ifdef QAK
-HDfprintf(stderr, "3rd indirect row # = %u\n", y);
-#endif /* QAK */
/* Loop over row of 3rd level deep indirect blocks */
for(x = 0; x < cparam->managed.width; x++) {
-#ifdef QAK
-HDfprintf(stderr, "3rd indirect block # = %u\n", x);
-#endif /* QAK */
/* Loop over direct block rows in third level indirect block */
block_size = cparam->managed.start_block_size;
@@ -4527,45 +4103,24 @@ HDfprintf(stderr, "3rd indirect block # = %u\n", x);
/* Loop over rows of 2nd level deep indirect blocks */
for(w = 0; w < (y + 1); w++) {
-#ifdef QAK
-HDfprintf(stderr, "indirect row # = %u\n", w);
-#endif /* QAK */
/* Loop over row of indirect blocks */
for(v = 0; v < cparam->managed.width; v++) {
-#ifdef QAK
-HDfprintf(stderr, "indirect block # = %u\n", v);
-#endif /* QAK */
/* Loop over direct block rows in first recursive indirect block */
block_size = cparam->managed.start_block_size;
nrows = 0;
max_block_size = block_size * (1 << ((H5V_log2_of2(cparam->managed.max_direct_size / cparam->managed.width) -
(H5V_log2_of2(cparam->managed.start_block_size) +
H5V_log2_of2(cparam->managed.width))) + (w + 1) + 1));
-#ifdef QAK
-HDfprintf(stderr, "max_block_size = %Zu\n", max_block_size);
-#endif /* QAK */
while(block_size <= max_block_size) {
-#ifdef QAK
-HDfprintf(stderr, "block_size = %Zu\n", block_size);
-#endif /* QAK */
/* Loop over filling direct blocks for a row */
-#ifdef QAK
-HDfprintf(stderr, "block number: ");
-#endif /* QAK */
for(u = 0; u < cparam->managed.width; u++) {
-#ifdef QAK
-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))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
} /* end for */
-#ifdef QAK
-HDfprintf(stderr, "\n");
-#endif /* QAK */
/* Adjust block size for row */
if(nrows > 0)
@@ -4624,6 +4179,7 @@ test_abs_fill_all_4th_recursive_indirect(hid_t fapl, H5HF_create_t *cparam)
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 nobjs = 0; /* Number of objects inserted */
unsigned tot_nobjs = 0; /* Total number of objects inserted */
size_t block_size; /* Size of block added */
@@ -4644,13 +4200,12 @@ test_abs_fill_all_4th_recursive_indirect(hid_t fapl, H5HF_create_t *cparam)
STACK_ERROR
/* Create absolute heap */
- if(H5HF_create(f, dxpl, cparam, &fh_addr/*out*/) < 0)
+ 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
-#ifdef QAK
-HDfprintf(stderr, "Fractal heap header address = %a\n", fh_addr);
-#endif /* QAK */
+ if(id_len > HEAP_ID_LEN)
+ FAIL_STACK_ERROR
/*
* Test inserting mult. (small) objects to fill all direct
@@ -4663,26 +4218,14 @@ HDfprintf(stderr, "Fractal heap header address = %a\n", fh_addr);
heap_size = 0;
nrows = 0;
while(block_size <= cparam->managed.max_direct_size) {
-#ifdef QAK
-HDfprintf(stderr, "block_size = %Zu\n", block_size);
-#endif /* QAK */
/* Loop over filling direct blocks for a row */
-#ifdef QAK
-HDfprintf(stderr, "block number: ");
-#endif /* QAK */
for(u = 0; u < cparam->managed.width; u++) {
-#ifdef QAK
-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))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
} /* end for */
-#ifdef QAK
-HDfprintf(stderr, "\n");
-#endif /* QAK */
/* Adjust block size for row */
if(nrows > 0)
@@ -4694,43 +4237,22 @@ HDfprintf(stderr, "\n");
/* Loop over rows of 2nd level deep indirect blocks */
for(w = 0; w < (H5V_log2_of2(cparam->managed.width) + 1); w++) {
-#ifdef QAK
-HDfprintf(stderr, "indirect row # = %u\n", w);
-#endif /* QAK */
for(v = 0; v < cparam->managed.width; v++) {
-#ifdef QAK
-HDfprintf(stderr, "indirect block # = %u\n", v);
-#endif /* QAK */
/* Loop over direct block rows in first recursive indirect block */
block_size = cparam->managed.start_block_size;
nrows = 0;
max_block_size = block_size * (1 << ((H5V_log2_of2(cparam->managed.max_direct_size / cparam->managed.width) -
(H5V_log2_of2(cparam->managed.start_block_size) +
H5V_log2_of2(cparam->managed.width))) + (w + 1) + 1));
-#ifdef QAK
-HDfprintf(stderr, "max_block_size = %Zu\n", max_block_size);
-#endif /* QAK */
while(block_size <= max_block_size) {
-#ifdef QAK
-HDfprintf(stderr, "block_size = %Zu\n", block_size);
-#endif /* QAK */
/* Loop over filling direct blocks for a row */
-#ifdef QAK
-HDfprintf(stderr, "block number: ");
-#endif /* QAK */
for(u = 0; u < cparam->managed.width; u++) {
-#ifdef QAK
-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))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
} /* end for */
-#ifdef QAK
-HDfprintf(stderr, "\n");
-#endif /* QAK */
/* Adjust block size for row */
if(nrows > 0)
@@ -4744,15 +4266,9 @@ HDfprintf(stderr, "\n");
/* Loop over rows of 3rd level deep indirect blocks */
for(y = 0; y < (H5V_log2_of2(cparam->managed.width) + 1); y++) {
-#ifdef QAK
-HDfprintf(stderr, "3rd indirect row # = %u\n", y);
-#endif /* QAK */
/* Loop over row of 3rd level deep indirect blocks */
for(x = 0; x < cparam->managed.width; x++) {
-#ifdef QAK
-HDfprintf(stderr, "3rd indirect block # = %u\n", x);
-#endif /* QAK */
/* Loop over direct block rows in third level indirect block */
block_size = cparam->managed.start_block_size;
@@ -4777,45 +4293,24 @@ HDfprintf(stderr, "3rd indirect block # = %u\n", x);
/* Loop over rows of 2nd level deep indirect blocks */
for(w = 0; w < (y + 1); w++) {
-#ifdef QAK
-HDfprintf(stderr, "indirect row # = %u\n", w);
-#endif /* QAK */
/* Loop over row of indirect blocks */
for(v = 0; v < cparam->managed.width; v++) {
-#ifdef QAK
-HDfprintf(stderr, "indirect block # = %u\n", v);
-#endif /* QAK */
/* Loop over direct block rows in first recursive indirect block */
block_size = cparam->managed.start_block_size;
nrows = 0;
max_block_size = block_size * (1 << ((H5V_log2_of2(cparam->managed.max_direct_size / cparam->managed.width) -
(H5V_log2_of2(cparam->managed.start_block_size) +
H5V_log2_of2(cparam->managed.width))) + (w + 1) + 1));
-#ifdef QAK
-HDfprintf(stderr, "max_block_size = %Zu\n", max_block_size);
-#endif /* QAK */
while(block_size <= max_block_size) {
-#ifdef QAK
-HDfprintf(stderr, "block_size = %Zu\n", block_size);
-#endif /* QAK */
/* Loop over filling direct blocks for a row */
-#ifdef QAK
-HDfprintf(stderr, "block number: ");
-#endif /* QAK */
for(u = 0; u < cparam->managed.width; u++) {
-#ifdef QAK
-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))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
} /* end for */
-#ifdef QAK
-HDfprintf(stderr, "\n");
-#endif /* QAK */
/* Adjust block size for row */
if(nrows > 0)
@@ -4831,15 +4326,9 @@ HDfprintf(stderr, "\n");
/* Loop over rows of 2nd level deep indirect blocks */
for(uu = 0; uu < (H5V_log2_of2(cparam->managed.width) + 1); uu++) {
-#ifdef QAK
-HDfprintf(stderr, "4th indirect row # = %u\n", uu);
-#endif /* QAK */
/* Loop over row of 4th level indirect blocks */
for(z = 0; z < cparam->managed.width; z++) {
-#ifdef QAK
-HDfprintf(stderr, "4th indirect block # = %u\n", z);
-#endif /* QAK */
/* Loop over direct block rows in fourth level indirect block */
block_size = cparam->managed.start_block_size;
@@ -4864,45 +4353,24 @@ HDfprintf(stderr, "4th indirect block # = %u\n", z);
/* Loop over rows of 2nd level deep indirect blocks */
for(w = 0; w < (H5V_log2_of2(cparam->managed.width) + 1); w++) {
-#ifdef QAK
-HDfprintf(stderr, "indirect row # = %u\n", w);
-#endif /* QAK */
/* Loop over row of indirect blocks */
for(v = 0; v < cparam->managed.width; v++) {
-#ifdef QAK
-HDfprintf(stderr, "indirect block # = %u\n", v);
-#endif /* QAK */
/* Loop over direct block rows in first recursive indirect block */
block_size = cparam->managed.start_block_size;
nrows = 0;
max_block_size = block_size * (1 << ((H5V_log2_of2(cparam->managed.max_direct_size / cparam->managed.width) -
(H5V_log2_of2(cparam->managed.start_block_size) +
H5V_log2_of2(cparam->managed.width))) + (w + 1) + 1));
-#ifdef QAK
-HDfprintf(stderr, "max_block_size = %Zu\n", max_block_size);
-#endif /* QAK */
while(block_size <= max_block_size) {
-#ifdef QAK
-HDfprintf(stderr, "block_size = %Zu\n", block_size);
-#endif /* QAK */
/* Loop over filling direct blocks for a row */
-#ifdef QAK
-HDfprintf(stderr, "block number: ");
-#endif /* QAK */
for(u = 0; u < cparam->managed.width; u++) {
-#ifdef QAK
-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))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
} /* end for */
-#ifdef QAK
-HDfprintf(stderr, "\n");
-#endif /* QAK */
/* Adjust block size for row */
if(nrows > 0)
@@ -4916,15 +4384,9 @@ HDfprintf(stderr, "\n");
/* Loop over rows of 3rd level deep indirect blocks */
for(y = 0; y < (uu + 1); y++) {
-#ifdef QAK
-HDfprintf(stderr, "3rd indirect row # = %u\n", y);
-#endif /* QAK */
/* Loop over row of 3rd level deep indirect blocks */
for(x = 0; x < cparam->managed.width; x++) {
-#ifdef QAK
-HDfprintf(stderr, "3rd indirect block # = %u\n", x);
-#endif /* QAK */
/* Loop over direct block rows in third level indirect block */
block_size = cparam->managed.start_block_size;
@@ -4949,45 +4411,24 @@ HDfprintf(stderr, "3rd indirect block # = %u\n", x);
/* Loop over rows of 2nd level deep indirect blocks */
for(w = 0; w < (y + 1); w++) {
-#ifdef QAK
-HDfprintf(stderr, "indirect row # = %u\n", w);
-#endif /* QAK */
/* Loop over row of indirect blocks */
for(v = 0; v < cparam->managed.width; v++) {
-#ifdef QAK
-HDfprintf(stderr, "indirect block # = %u\n", v);
-#endif /* QAK */
/* Loop over direct block rows in first recursive indirect block */
block_size = cparam->managed.start_block_size;
nrows = 0;
max_block_size = block_size * (1 << ((H5V_log2_of2(cparam->managed.max_direct_size / cparam->managed.width) -
(H5V_log2_of2(cparam->managed.start_block_size) +
H5V_log2_of2(cparam->managed.width))) + (w + 1) + 1));
-#ifdef QAK
-HDfprintf(stderr, "max_block_size = %Zu\n", max_block_size);
-#endif /* QAK */
while(block_size <= max_block_size) {
-#ifdef QAK
-HDfprintf(stderr, "block_size = %Zu\n", block_size);
-#endif /* QAK */
/* Loop over filling direct blocks for a row */
-#ifdef QAK
-HDfprintf(stderr, "block number: ");
-#endif /* QAK */
for(u = 0; u < cparam->managed.width; u++) {
-#ifdef QAK
-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))
FAIL_STACK_ERROR
tot_nobjs += nobjs;
} /* end for */
-#ifdef QAK
-HDfprintf(stderr, "\n");
-#endif /* QAK */
/* Adjust block size for row */
if(nrows > 0)
@@ -5048,9 +4489,10 @@ test_abs_start_5th_recursive_indirect(hid_t fapl, H5HF_create_t *cparam)
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[10]; /* Buffer for object to insert */
unsigned char robj[10]; /* Buffer for reading object */
- hsize_t heap_id; /* Heap ID for object inserted */
+ 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 */
@@ -5072,10 +4514,12 @@ test_abs_start_5th_recursive_indirect(hid_t fapl, H5HF_create_t *cparam)
STACK_ERROR
/* Create absolute heap */
- if(H5HF_create(f, dxpl, cparam, &fh_addr/*out*/) < 0)
+ 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
#ifdef QAK
HDfprintf(stderr, "Fractal heap header address = %a\n", fh_addr);
#endif /* QAK */
@@ -5440,20 +4884,20 @@ HDfprintf(stderr, "\n");
obj[u] = u + tot_nobjs;
/* Insert object */
- heap_id = 0;
- if(H5HF_insert(f, dxpl, fh_addr, sizeof(obj), obj, &heap_id) < 0)
+ HDmemset(heap_id, 0, sizeof(heap_id));
+ if(H5HF_insert(f, dxpl, fh_addr, sizeof(obj), obj, heap_id) < 0)
FAIL_STACK_ERROR
/* Increment object count */
tot_nobjs++;
heap_size += cparam->managed.start_block_size;
- free_space = cparam->managed.start_block_size - ((sizeof(obj) + 3) + DBLOCK_OVERHEAD + (cparam->managed.max_index / 8));
+ free_space = cparam->managed.start_block_size - ((sizeof(obj) + 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
/* Read in object */
- if(H5HF_read(f, dxpl, fh_addr, &heap_id, robj) < 0)
+ if(H5HF_read(f, dxpl, fh_addr, heap_id, robj) < 0)
FAIL_STACK_ERROR
if(HDmemcmp(obj, robj, sizeof(obj)))
FAIL_STACK_ERROR
@@ -5476,6 +4920,102 @@ error:
/*-------------------------------------------------------------------------
+ * Function: test_abs_skip_start_block
+ *
+ * Purpose: Test inserting object into absolute heap which is too large
+ * for starting block size
+ *
+ * Return: Success: 0
+ *
+ * Failure: 1
+ *
+ * Programmer: Quincey Koziol
+ * Monday, March 27, 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+test_abs_skip_start_block(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 heap_id[HEAP_ID_LEN]; /* Heap ID for object inserted */
+ hsize_t free_space; /* Size of free space in heap */
+ 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 = H5MM_malloc(cparam->managed.start_block_size + 1);
+ for(u = 0; u < (cparam->managed.start_block_size + 1); u++)
+ obj[u] = u;
+
+ /*
+ * Test inserting object into absolute heap which doesn't fit into starting
+ * block size
+ */
+ TESTING("inserting object that is too large for starting block");
+ 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));
+ 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(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)))
+ 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() */
+
+
+/*-------------------------------------------------------------------------
* Function: run_tests
*
* Purpose: Test the fractal heap code, with different file access property
@@ -5532,7 +5072,13 @@ run_tests(hid_t fapl, H5HF_create_t *cparam)
/* If this test fails, uncomment the tests above, which build up to this
* level of complexity gradually. -QAK
*/
+#ifndef QAK
nerrors += test_abs_start_5th_recursive_indirect(fapl, cparam);
+#else /* QAK */
+HDfprintf(stderr, "Uncomment tests!\n");
+#endif /* QAK */
+
+ nerrors += test_abs_skip_start_block(fapl, cparam);
#ifndef QAK
#else /* QAK */
HDfprintf(stderr, "Uncomment tests!\n");
@@ -5588,7 +5134,7 @@ HDfprintf(stderr, "Uncomment tests!\n");
if(nerrors)
goto error;
puts("All fractal heap tests passed.");
-#ifndef QAK
+#ifdef QAK
h5_cleanup(FILENAME, fapl);
#else /* QAK */
HDfprintf(stderr, "Uncomment cleanup!\n");