[svn-r12552] Description:

More tweaks on fractal heap statistics, to better separate information
about managed objects from information about "huge" objects.

    Also, clean up some compiler warnings, etc. on 64-bit platforms & Windows.

Platforms tested:
    Linux/32 2.6 (chicago)
    Linux/64 2.6 (chicago)
This commit is contained in:
Quincey Koziol 2006-08-07 16:24:29 -05:00
parent 4f289e5b92
commit d17d42acd0
12 changed files with 158 additions and 206 deletions

View File

@ -290,7 +290,7 @@ HDfprintf(stderr, "%s: Load heap header, addr = %a\n", FUNC, addr);
p = buf;
/* Magic number */
if(HDmemcmp(p, H5HF_HDR_MAGIC, H5HF_SIZEOF_MAGIC))
if(HDmemcmp(p, H5HF_HDR_MAGIC, (size_t)H5HF_SIZEOF_MAGIC))
HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, NULL, "wrong fractal heap header signature")
p += H5HF_SIZEOF_MAGIC;
@ -323,13 +323,13 @@ HDfprintf(stderr, "%s: Load heap header, addr = %a\n", FUNC, addr);
H5F_DECODE_LENGTH(f, p, hdr->total_man_free); /* Internal free space in managed direct blocks */
H5F_addr_decode(f, &p, &hdr->fs_addr); /* Address of free section header */
/* Statistics information */
H5F_DECODE_LENGTH(f, p, hdr->total_size);
/* Heap statistics */
H5F_DECODE_LENGTH(f, p, hdr->man_size);
H5F_DECODE_LENGTH(f, p, hdr->man_alloc_size);
H5F_DECODE_LENGTH(f, p, hdr->man_iter_off);
H5F_DECODE_LENGTH(f, p, hdr->std_size);
H5F_DECODE_LENGTH(f, p, hdr->nobjs);
H5F_DECODE_LENGTH(f, p, hdr->man_nobjs);
H5F_DECODE_LENGTH(f, p, hdr->huge_size);
H5F_DECODE_LENGTH(f, p, hdr->huge_nobjs);
/* Managed objects' doubling-table info */
if(H5HF_dtable_decode(hdr->f, &p, &(hdr->man_dtable)) < 0)
@ -404,7 +404,7 @@ HDfprintf(stderr, "%s: Flushing heap header, addr = %a, destroy = %u\n", FUNC, a
p = buf;
/* Magic number */
HDmemcpy(p, H5HF_HDR_MAGIC, H5HF_SIZEOF_MAGIC);
HDmemcpy(p, H5HF_HDR_MAGIC, (size_t)H5HF_SIZEOF_MAGIC);
p += H5HF_SIZEOF_MAGIC;
/* Version # */
@ -416,7 +416,7 @@ HDfprintf(stderr, "%s: Flushing heap header, addr = %a, destroy = %u\n", FUNC, a
/* Metadata checksum */
/* XXX: Set this! (After all the metadata is in the buffer) */
HDmemset(p, 0, 4);
HDmemset(p, 0, (size_t)4);
p += 4;
/* Heap status flags */
@ -434,13 +434,13 @@ HDfprintf(stderr, "%s: Flushing heap header, addr = %a, destroy = %u\n", FUNC, a
H5F_ENCODE_LENGTH(f, p, hdr->total_man_free); /* Internal free space in managed direct blocks */
H5F_addr_encode(f, &p, hdr->fs_addr); /* Address of free section header */
/* Statistics information */
H5F_ENCODE_LENGTH(f, p, hdr->total_size);
/* Heap statistics */
H5F_ENCODE_LENGTH(f, p, hdr->man_size);
H5F_ENCODE_LENGTH(f, p, hdr->man_alloc_size);
H5F_ENCODE_LENGTH(f, p, hdr->man_iter_off);
H5F_ENCODE_LENGTH(f, p, hdr->std_size);
H5F_ENCODE_LENGTH(f, p, hdr->nobjs);
H5F_ENCODE_LENGTH(f, p, hdr->man_nobjs);
H5F_ENCODE_LENGTH(f, p, hdr->huge_size);
H5F_ENCODE_LENGTH(f, p, hdr->huge_nobjs);
/* Managed objects' doubling-table info */
if(H5HF_dtable_encode(hdr->f, &p, &(hdr->man_dtable)) < 0)
@ -629,7 +629,7 @@ H5HF_cache_dblock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_size,
p = dblock->blk;
/* Magic number */
if(HDmemcmp(p, H5HF_DBLOCK_MAGIC, H5HF_SIZEOF_MAGIC))
if(HDmemcmp(p, H5HF_DBLOCK_MAGIC, (size_t)H5HF_SIZEOF_MAGIC))
HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, NULL, "wrong fractal heap direct block signature")
p += H5HF_SIZEOF_MAGIC;
@ -712,7 +712,7 @@ H5HF_cache_dblock_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr,
p = dblock->blk;
/* Magic number */
HDmemcpy(p, H5HF_DBLOCK_MAGIC, H5HF_SIZEOF_MAGIC);
HDmemcpy(p, H5HF_DBLOCK_MAGIC, (size_t)H5HF_SIZEOF_MAGIC);
p += H5HF_SIZEOF_MAGIC;
/* Version # */
@ -724,7 +724,7 @@ H5HF_cache_dblock_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr,
/* Metadata checksum */
/* XXX: Set this! (After all the metadata is in the buffer) */
HDmemset(p, 0, 4);
HDmemset(p, 0, (size_t)4);
p += 4;
/* Address of heap header for heap which owns this block */
@ -937,7 +937,7 @@ HDfprintf(stderr, "%s: Load indirect block, addr = %a\n", FUNC, addr);
p = buf;
/* Magic number */
if(HDmemcmp(p, H5HF_IBLOCK_MAGIC, H5HF_SIZEOF_MAGIC))
if(HDmemcmp(p, H5HF_IBLOCK_MAGIC, (size_t)H5HF_SIZEOF_MAGIC))
HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, NULL, "wrong fractal heap indirect block signature")
p += H5HF_SIZEOF_MAGIC;
@ -982,7 +982,7 @@ HDfprintf(stderr, "%s: Load indirect block, addr = %a\n", FUNC, addr);
/* Allocate & decode indirect block entry tables */
HDassert(iblock->nrows > 0);
if(NULL == (iblock->ents = H5FL_SEQ_MALLOC(H5HF_indirect_ent_t, (iblock->nrows * iblock->hdr->man_dtable.cparam.width))))
if(NULL == (iblock->ents = H5FL_SEQ_MALLOC(H5HF_indirect_ent_t, (size_t)(iblock->nrows * iblock->hdr->man_dtable.cparam.width))))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for direct entries")
for(u = 0; u < (iblock->nrows * iblock->hdr->man_dtable.cparam.width); u++) {
/* Decode child block address */
@ -1078,7 +1078,7 @@ HDfprintf(stderr, "%s: hdr->man_dtable.cparam.width = %u\n", FUNC, hdr->man_dtab
p = buf;
/* Magic number */
HDmemcpy(p, H5HF_IBLOCK_MAGIC, H5HF_SIZEOF_MAGIC);
HDmemcpy(p, H5HF_IBLOCK_MAGIC, (size_t)H5HF_SIZEOF_MAGIC);
p += H5HF_SIZEOF_MAGIC;
/* Version # */
@ -1090,7 +1090,7 @@ HDfprintf(stderr, "%s: hdr->man_dtable.cparam.width = %u\n", FUNC, hdr->man_dtab
/* Metadata checksum */
/* XXX: Set this! (After all the metadata is in the buffer) */
HDmemset(p, 0, 4);
HDmemset(p, 0, (size_t)4);
p += 4;
/* Address of heap header for heap which owns this block */

View File

@ -212,17 +212,23 @@ H5HF_hdr_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent,
/*
* Print the values.
*/
HDfprintf(stream, "%*s%-*s %lu\n", indent, "", fwidth,
"Max. size of managed object:",
(unsigned long)hdr->max_man_size);
HDfprintf(stream, "%*s%-*s %t\n", indent, "", fwidth,
"Objects stored in 'debugging' format:",
hdr->debug_objs);
HDfprintf(stream, "%*s%-*s %t\n", indent, "", fwidth,
"I/O filters present:",
hdr->have_io_filter);
HDfprintf(stream, "%*s%-*s %t\n", indent, "", fwidth,
"'Write once' flag:",
hdr->write_once);
HDfprintf(stream, "%*s%-*s %t\n", indent, "", fwidth,
"'Huge' object IDs have wrapped:",
hdr->huge_ids_wrapped);
HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth,
"Total free space in managed blocks:",
"Free space in managed blocks:",
hdr->total_man_free);
HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth,
"Total data block size:",
hdr->total_size);
HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth,
"Total managed space data block size:",
"Managed space data block size:",
hdr->man_size);
HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth,
"Total managed space allocated:",
@ -231,14 +237,26 @@ H5HF_hdr_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent,
"Offset of managed space iterator:",
hdr->man_iter_off);
HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth,
"Total standalone space data block size:",
hdr->std_size);
HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth,
"Number of objects in heap:",
hdr->nobjs);
"Number of managed objects in heap:",
hdr->man_nobjs);
HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth,
"Address of free space manager for heap:",
"Address of free space manager for managed blocks:",
hdr->fs_addr);
HDfprintf(stream, "%*s%-*s %lu\n", indent, "", fwidth,
"Max. size of managed object:",
(unsigned long)hdr->max_man_size);
HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth,
"'Huge' object space used:",
hdr->huge_size);
HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth,
"Number of 'huge' objects in heap:",
hdr->huge_nobjs);
HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth,
"ID of next 'huge' object:",
hdr->huge_next_id);
HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth,
"Address of v2 B-tree for 'huge' objects:",
hdr->huge_bt_addr);
HDfprintf(stream, "%*sManaged Objects Doubling-Table Info...\n", indent, "");
H5HF_dtable_debug(&hdr->man_dtable, stream, indent + 3, MAX(0, fwidth -3));
@ -448,7 +466,7 @@ H5HF_dblock_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream,
/*
* Print the data in a VMS-style octal dump.
*/
H5_buffer_dump(stream, indent, dblock->blk, marker, 0, dblock->size);
H5_buffer_dump(stream, indent, dblock->blk, marker, (size_t)0, dblock->size);
done:
if(dblock && H5AC_unprotect(f, dxpl_id, H5AC_FHEAP_DBLOCK, addr, dblock, H5AC__NO_FLAGS_SET) < 0)
@ -554,7 +572,7 @@ H5HF_iblock_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream,
unsigned first_row_bits; /* Number of bits used bit addresses in first row */
unsigned num_indirect_rows; /* Number of rows of blocks in each indirect block */
first_row_bits = H5V_log2_of2(hdr->man_dtable.cparam.start_block_size) +
first_row_bits = H5V_log2_of2((uint32_t)hdr->man_dtable.cparam.start_block_size) +
H5V_log2_of2(hdr->man_dtable.cparam.width);
for(u = hdr->man_dtable.max_direct_rows; u < iblock->nrows; u++) {
num_indirect_rows = (H5V_log2_gen(hdr->man_dtable.row_block_size[u]) - first_row_bits) + 1;

View File

@ -103,10 +103,10 @@ H5HF_dtable_init(H5HF_dtable_t *dtable)
HDassert(dtable);
/* Compute/cache some values */
dtable->start_bits = H5V_log2_of2(dtable->cparam.start_block_size);
dtable->start_bits = H5V_log2_of2((uint32_t)dtable->cparam.start_block_size);
dtable->first_row_bits = dtable->start_bits + H5V_log2_of2(dtable->cparam.width);
dtable->max_root_rows = (dtable->cparam.max_index - dtable->first_row_bits) + 1;
dtable->max_direct_bits = H5V_log2_of2(dtable->cparam.max_direct_size);
dtable->max_direct_bits = H5V_log2_of2((uint32_t)dtable->cparam.max_direct_size);
dtable->max_direct_rows = (dtable->max_direct_bits - dtable->start_bits) + 2;
dtable->num_id_first_row = dtable->cparam.start_block_size * dtable->cparam.width;
dtable->max_dir_blk_off_size = H5HF_SIZEOF_OFFSET_LEN(dtable->cparam.max_direct_size);
@ -245,7 +245,7 @@ H5HF_dtable_size_to_row(const H5HF_dtable_t *dtable, size_t block_size)
if(block_size == dtable->cparam.start_block_size)
row = 0;
else
row = (H5V_log2_of2((uint32_t)block_size) - H5V_log2_of2(dtable->cparam.start_block_size)) + 1;
row = (H5V_log2_of2((uint32_t)block_size) - H5V_log2_of2((uint32_t)dtable->cparam.start_block_size)) + 1;
FUNC_LEAVE_NOAPI(row)
} /* end H5HF_dtable_size_to_row() */

View File

@ -529,8 +529,7 @@ HDfprintf(stderr, "%s; hdr->man_size = %Hu\n", FUNC, hdr->man_size);
HDfprintf(stderr, "%s; hdr->total_man_free = %Hu\n", FUNC, hdr->total_man_free);
#endif /* QAK */
/* Set the total space in heap */
hdr->total_size = new_size;
/* Set the total managed space in heap */
hdr->man_size = new_size;
/* Adjust the free space in direct blocks */
@ -906,7 +905,7 @@ HDfprintf(stderr, "%s: child_nrows = %u\n", FUNC, child_nrows);
HDfprintf(stderr, "%s: Skipping indirect block row that is too small\n", FUNC);
#endif /* QAK */
/* Compute # of rows needed in child indirect block */
child_rows_needed = (H5V_log2_of2(min_dblock_size) - H5V_log2_of2(hdr->man_dtable.cparam.start_block_size)) + 2;
child_rows_needed = (H5V_log2_of2((uint32_t)min_dblock_size) - H5V_log2_of2((uint32_t)hdr->man_dtable.cparam.start_block_size)) + 2;
HDassert(child_rows_needed > child_nrows);
child_entry = (next_row + (child_rows_needed - child_nrows)) * hdr->man_dtable.cparam.width;
if(child_entry > (iblock->nrows * hdr->man_dtable.cparam.width))
@ -1237,8 +1236,7 @@ HDfprintf(stderr, "%s: 'next block' iterator is ready\n", FUNC);
HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't reset block iterator")
} /* end if */
/* Shrink heap size */
hdr->total_size = hdr->std_size;
/* Shrink managed heap size */
hdr->man_size = 0;
hdr->man_alloc_size = 0;

View File

@ -154,7 +154,7 @@ HDfprintf(stderr, "%s: iblock->block_off = %Hu\n", FUNC, iblock->block_off);
/* Mark block as evictable again when no child blocks depend on it */
if(iblock->rc == 0) {
H5HF_indirect_t *tmp_iblock; /* Temporary pointer to indirect block */
H5HF_indirect_t *tmp_iblock = NULL; /* Temporary pointer to indirect block */
#ifdef QAK
HDfprintf(stderr, "%s: indirect block ref. count at zero, iblock->addr = %a\n", FUNC, iblock->addr);
@ -286,7 +286,7 @@ HDfprintf(stderr, "%s: Creating root indirect block\n", FUNC);
nrows = hdr->man_dtable.cparam.start_root_rows;
block_row_off = H5V_log2_of2(min_dblock_size) - H5V_log2_of2(hdr->man_dtable.cparam.start_block_size);
block_row_off = H5V_log2_of2((uint32_t)min_dblock_size) - H5V_log2_of2((uint32_t)hdr->man_dtable.cparam.start_block_size);
if(block_row_off > 0)
block_row_off++; /* Account for the pair of initial rows of the initial block size */
rows_needed = 1 + block_row_off;
@ -399,7 +399,7 @@ H5HF_man_iblock_root_double(H5HF_hdr_t *hdr, hid_t dxpl_id, size_t min_dblock_si
hsize_t next_size; /* The previous value of the "next size" for the new block iterator */
unsigned next_row; /* The next row to allocate block in */
unsigned next_entry; /* The previous value of the "next entry" for the new block iterator */
unsigned new_next_entry; /* The new value of the "next entry" for the new block iterator */
unsigned new_next_entry = 0;/* The new value of the "next entry" for the new block iterator */
unsigned min_nrows = 0; /* Min. # of direct rows */
unsigned old_nrows; /* Old # of rows */
unsigned new_nrows; /* New # of rows */
@ -482,7 +482,7 @@ HDfprintf(stderr, "%s: new_addr = %a\n", FUNC, new_addr);
#endif /* QAK */
/* Re-allocate direct block entry table */
if(NULL == (iblock->ents = H5FL_SEQ_REALLOC(H5HF_indirect_ent_t, iblock->ents, (iblock->nrows * hdr->man_dtable.cparam.width))))
if(NULL == (iblock->ents = H5FL_SEQ_REALLOC(H5HF_indirect_ent_t, iblock->ents, (size_t)(iblock->nrows * hdr->man_dtable.cparam.width))))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for direct entries")
/* Check for skipping over rows and add free section for skipped rows */
@ -728,7 +728,7 @@ done:
herr_t
H5HF_man_iblock_alloc_row(H5HF_hdr_t *hdr, hid_t dxpl_id, H5HF_free_section_t **sec_node)
{
H5HF_indirect_t *iblock; /* Pointer to indirect block */
H5HF_indirect_t *iblock = NULL; /* Pointer to indirect block */
H5HF_free_section_t *old_sec_node = *sec_node; /* Pointer to old indirect section node */
unsigned dblock_entry; /* Entry for direct block */
hbool_t iblock_held = FALSE; /* Flag to indicate that indirect block is held */
@ -843,7 +843,7 @@ HDfprintf(stderr, "%s: nrows = %u, max_rows = %u\n", FUNC, nrows, max_rows);
iblock->size = H5HF_MAN_INDIRECT_SIZE(hdr, iblock);
/* Allocate indirect block entry tables */
if(NULL == (iblock->ents = H5FL_SEQ_MALLOC(H5HF_indirect_ent_t, (iblock->nrows * hdr->man_dtable.cparam.width))))
if(NULL == (iblock->ents = H5FL_SEQ_MALLOC(H5HF_indirect_ent_t, (size_t)(iblock->nrows * hdr->man_dtable.cparam.width))))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for block entries")
/* Initialize indirect block entry tables */

View File

@ -98,7 +98,7 @@ H5HF_man_locate_block(H5HF_hdr_t *hdr, hid_t dxpl_id, hsize_t obj_off,
H5HF_indirect_t *iblock; /* Pointer to indirect block */
unsigned bot_row, top_row; /* Bottom & top acceptable rows */
unsigned row, col; /* Row & column for object's block */
size_t entry; /* Entry of block */
unsigned entry; /* Entry of block */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5HF_man_locate_block)
@ -278,10 +278,11 @@ done:
*/
herr_t
H5HF_man_insert(H5HF_hdr_t *hdr, hid_t dxpl_id, H5HF_free_section_t *sec_node,
size_t obj_size, const void *obj, void *id)
size_t obj_size, const void *obj, void *_id)
{
H5HF_direct_t *dblock = NULL; /* Pointer to direct block to modify */
haddr_t dblock_addr = HADDR_UNDEF; /* Direct block address */
uint8_t *id = (uint8_t *)_id; /* Pointer to ID buffer */
size_t blk_off; /* Offset of object within block */
herr_t ret_value = SUCCEED; /* Return value */
@ -387,7 +388,7 @@ HDfprintf(stderr, "%s: obj_off = %Hu, obj_len = %Zu\n", FUNC, (dblock->block_off
#endif /* QAK */
/* Update statistics about heap */
hdr->nobjs++;
hdr->man_nobjs++;
/* Mark heap header as modified */
if(H5HF_hdr_dirty(hdr) < 0)
@ -601,7 +602,7 @@ HDfprintf(stderr, "%s: blk_off = %Zu\n", FUNC, blk_off);
dblock = NULL;
/* Update statistics about heap */
hdr->nobjs--;
hdr->man_nobjs--;
/* Reduce space available in heap */
if(H5HF_hdr_adj_free(hdr, (ssize_t)obj_len) < 0)

View File

@ -90,12 +90,12 @@
+ (h)->sizeof_addr /* File address of free section header */ \
\
/* Statistics fields */ \
+ (h)->sizeof_size /* Total size of heap */ \
+ (h)->sizeof_size /* Size of man. space in heap */ \
+ (h)->sizeof_size /* Size of man. space iterator offset in heap */ \
+ (h)->sizeof_size /* Size of alloacted man. space in heap */ \
+ (h)->sizeof_size /* Size of std. space in heap */ \
+ (h)->sizeof_size /* Number of objects in heap */ \
+ (h)->sizeof_size /* Number of man. objects in heap */ \
+ (h)->sizeof_size /* Size of huge space in heap */ \
+ (h)->sizeof_size /* Number of huge objects in heap */ \
\
/* "Managed" object doubling table info */ \
+ H5HF_DTABLE_INFO_SIZE(h) /* Size of managed obj. doubling-table info */ \
@ -142,7 +142,8 @@
/* Encode a "managed" heap ID */
#define H5HF_MAN_ID_ENCODE(i, h, o, l) \
*(uint8_t *)i++ = H5HF_ID_VERS_CURR | H5HF_ID_TYPE_MAN; \
*(i) = H5HF_ID_VERS_CURR | H5HF_ID_TYPE_MAN; \
(i)++; \
UINT64ENCODE_VAR((i), (o), (h)->heap_off_size); \
UINT64ENCODE_VAR((i), (l), (h)->heap_len_size)
@ -291,20 +292,35 @@ typedef struct H5HF_hdr_t {
/* Information for H5AC cache functions, _must_ be first field in structure */
H5AC_info_t cache_info;
/* Shared internal information (varies during lifetime of heap) */
/* Flags for heap settings (stored in status byte in header) */
hbool_t debug_objs; /* Is the heap storing objects in 'debug' format */
hbool_t have_io_filter; /* Does the heap have I/O filters for the direct blocks? */
hbool_t write_once; /* Is heap being written in "write once" mode? */
hbool_t huge_ids_wrapped; /* Have "huge" object IDs wrapped around? */
/* Doubling table information (partially stored in header) */
/* (Partially set by user, partially derived/updated internally) */
H5HF_dtable_t man_dtable; /* Doubling-table info for managed objects */
/* Free space information for managed objects (stored in header) */
hsize_t total_man_free; /* Total amount of free space in managed blocks */
haddr_t fs_addr; /* Address of free space header on disk */
/* Statistics for heap */
hsize_t total_size; /* Total amount of space used by heap (managed & standalone) */
/* "Huge" object support (stored in header) */
uint32_t max_man_size; /* Max. size of object to manage in doubling table */
hsize_t huge_next_id; /* Next ID to use for "huge" object */
haddr_t huge_bt_addr; /* Address of B-tree for storing "huge" object info */
/* Statistics for heap (stored in header) */
hsize_t man_size; /* Total amount of managed space in heap */
hsize_t man_alloc_size; /* Total amount of allocated managed space in heap */
hsize_t man_iter_off; /* Offset of iterator in managed heap space */
hsize_t std_size; /* Total amount of standalone space in heap */
hsize_t nobjs; /* Number of objects in heap */
hsize_t man_nobjs; /* Number of "managed" objects in heap */
hsize_t huge_size; /* Total size of "huge" objects in heap */
hsize_t huge_nobjs; /* Number of "huge" objects in heap */
/* Cached/computed values (not stored in header) */
size_t rc; /* Reference count of child blocks */
size_t rc; /* Reference count of objects using heap header */
hbool_t dirty; /* Shared info is modified */
haddr_t heap_addr; /* Address of heap header in the file */
H5AC_protect_t mode; /* Access mode for heap */
@ -314,23 +330,8 @@ typedef struct H5HF_hdr_t {
size_t id_len; /* Size of heap IDs (in bytes) */
H5FS_t *fspace; /* Free space list for objects in heap */
H5HF_block_iter_t next_block; /* Block iterator for searching for next block with space */
/* Doubling table information */
/* (Partially set by user, partially derived/updated internally) */
H5HF_dtable_t man_dtable; /* Doubling-table info for managed objects */
/* "Huge" object support (stored in header) */
uint32_t max_man_size; /* Max. size of object to manage in doubling table */
hsize_t huge_next_id; /* Next ID to use for "huge" object */
haddr_t huge_bt_addr; /* Address of B-tree for storing "huge" object info */
/* Information derived from user parameters (not stored in header) */
unsigned char heap_off_size; /* Size of heap offsets (in bytes) */
unsigned char heap_len_size; /* Size of heap ID lengths (in bytes) */
hbool_t debug_objs; /* Is the heap storing objects in 'debug' format */
hbool_t have_io_filter; /* Does the heap have I/O filters for the direct blocks? */
hbool_t write_once; /* Is heap being written in "write once" mode? */
hbool_t huge_ids_wrapped; /* Have "huge" object IDs wrapped around? */
} H5HF_hdr_t;
/* Indirect block entry */

View File

@ -62,13 +62,16 @@ typedef struct H5HF_create_t {
/* Fractal heap metadata statistics info */
typedef struct H5HF_stat_t {
hsize_t total_size; /* Total size of heap allocated (man & std) */
hsize_t nobjs; /* Number of objects in heap */
hsize_t man_size; /* Total size of managed space in heap */
hsize_t man_alloc_size; /* Total size of managed space allocated in heap */
/* "Managed" object info */
hsize_t man_size; /* Size of managed space in heap */
hsize_t man_alloc_size; /* Size of managed space allocated in heap */
hsize_t man_iter_off; /* Offset of "new block" iterator in managed heap space */
hsize_t man_free_space; /* Free space within managed heap */
hsize_t std_size; /* Total size of standalone space in heap */
hsize_t man_free_space; /* Free space within managed heap blocks */
hsize_t man_nobjs; /* Number of "managed" objects in heap */
/* "Huge" object info */
hsize_t huge_size; /* Size of "huge" objects in heap */
hsize_t huge_nobjs; /* Number of "huge" objects in heap */
} H5HF_stat_t;
/* Fractal heap info (forward decl - defined in H5HFpkg.h) */

View File

@ -803,7 +803,7 @@ done:
*/
static H5FS_section_info_t *
H5HF_sect_single_deserialize(const H5FS_section_class_t UNUSED *cls,
hid_t UNUSED dxpl_id, const uint8_t *buf, haddr_t sect_addr,
hid_t UNUSED dxpl_id, const uint8_t UNUSED *buf, haddr_t sect_addr,
hsize_t sect_size, unsigned UNUSED *des_flags)
{
H5HF_free_section_t *new_sect; /* New section */
@ -812,7 +812,6 @@ H5HF_sect_single_deserialize(const H5FS_section_class_t UNUSED *cls,
FUNC_ENTER_NOAPI_NOINIT(H5HF_sect_single_deserialize)
/* Check arguments. */
HDassert(buf);
HDassert(H5F_addr_defined(sect_addr));
HDassert(sect_size);
@ -1102,6 +1101,7 @@ H5HF_sect_single_free(H5FS_section_info_t *_sect)
FUNC_ENTER_NOAPI_NOINIT(H5HF_sect_single_free)
/* Check arguments. */
HDassert(sect);
/* Check for live reference to an indirect block */
@ -1134,13 +1134,13 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
H5HF_sect_single_valid(const H5FS_section_class_t *cls, const H5FS_section_info_t *_sect)
H5HF_sect_single_valid(const H5FS_section_class_t UNUSED *cls, const H5FS_section_info_t *_sect)
{
const H5HF_free_section_t *sect = (const H5HF_free_section_t *)_sect; /* Pointer to section to check */
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HF_sect_single_valid)
HDassert(cls);
/* Check arguments. */
HDassert(sect);
#ifdef QAK

View File

@ -92,13 +92,13 @@ H5HF_stat_info(const H5HF_t *fh, H5HF_stat_t *stats)
HDassert(stats);
/* Report statistics for fractal heap */
stats->total_size = fh->hdr->total_size;
stats->man_size = fh->hdr->man_size;
stats->man_alloc_size = fh->hdr->man_alloc_size;
stats->man_iter_off = fh->hdr->man_iter_off;
stats->std_size = fh->hdr->std_size;
stats->man_nobjs = fh->hdr->man_nobjs;
stats->man_free_space = fh->hdr->total_man_free;
stats->nobjs = fh->hdr->nobjs;
stats->huge_size = fh->hdr->huge_size;
stats->huge_nobjs = fh->hdr->huge_nobjs;
/* XXX: Add more metadata statistics for the heap */
FUNC_LEAVE_NOAPI(SUCCEED)

View File

@ -34,7 +34,7 @@
#ifdef NDEBUG
#define H5MM_malloc(Z) HDmalloc(Z)
#define H5MM_calloc(Z) HDcalloc(1,Z)
#define H5MM_calloc(Z) HDcalloc((size_t)1,Z)
#endif /* NDEBUG */
#define H5MM_free(Z) HDfree(Z)

View File

@ -103,11 +103,12 @@ typedef struct fheap_test_param_t {
/* Heap state information */
typedef struct fheap_heap_state_t {
hsize_t heap_size; /* Total size of heap (managed & standalone objects) */
size_t nobjs; /* # of objects within heap */
size_t man_nobjs; /* # of managed objects within heap */
hsize_t man_size; /* Size of managed object heap */
hsize_t man_alloc_size; /* Size of managed object heap allocated */
hsize_t man_free_space; /* Managed object free space within heap */
size_t huge_nobjs; /* # of 'huge' objects within heap */
hsize_t huge_size; /* Size of 'huge' object heap */
} fheap_heap_state_t;
/* Heap IDs to retain */
@ -192,12 +193,8 @@ check_stats(const H5HF_t *fh, const fheap_heap_state_t *state)
/* Get statistics for heap and verify they are correct */
if(H5HF_stat_info(fh, &heap_stats) < 0)
FAIL_STACK_ERROR
if(heap_stats.total_size != state->heap_size) {
HDfprintf(stdout, "heap_stats.total_size = %Hu, state->heap_size = %Hu\n", heap_stats.total_size, state->heap_size);
FAIL_STACK_ERROR
} /* end if */
if(heap_stats.nobjs != state->nobjs) {
HDfprintf(stdout, "heap_stats.nobjs = %Hu, state->nobjs = %Hu\n", heap_stats.nobjs, state->nobjs);
if(heap_stats.man_nobjs != state->man_nobjs) {
HDfprintf(stdout, "heap_stats.man_nobjs = %Hu, state->man_nobjs = %Hu\n", heap_stats.man_nobjs, state->man_nobjs);
FAIL_STACK_ERROR
} /* end if */
if(heap_stats.man_size != state->man_size) {
@ -212,6 +209,14 @@ check_stats(const H5HF_t *fh, const fheap_heap_state_t *state)
HDfprintf(stdout, "heap_stats.man_free_space = %Hu, state->man_free_space = %Hu\n", heap_stats.man_free_space, state->man_free_space);
FAIL_STACK_ERROR
} /* end if */
if(heap_stats.huge_nobjs != state->huge_nobjs) {
HDfprintf(stdout, "heap_stats.huge_nobjs = %Hu, state->huge_nobjs = %Hu\n", heap_stats.huge_nobjs, state->huge_nobjs);
FAIL_STACK_ERROR
} /* end if */
if(heap_stats.huge_size != state->huge_size) {
HDfprintf(stdout, "heap_stats.huge_size = %Hu, state->huge_size = %Hu\n", heap_stats.huge_size, state->huge_size);
FAIL_STACK_ERROR
} /* end if */
/* All tests passed */
return(0);
@ -228,7 +233,6 @@ error:
*
* Note: The following fields in the 'state' structure are set to
* the values expected _after_ any block created for the object:
* heap_size
* man_size
* man_alloc_size
* man_free_space
@ -267,7 +271,7 @@ add_obj(H5HF_t *fh, hid_t dxpl, unsigned obj_off,
/* Check for tracking the heap's state */
if(state) {
/* Adjust state of heap */
state->nobjs++;
state->man_nobjs++;
state->man_free_space -= obj_size;
/* Check free space left in heap */
@ -295,7 +299,7 @@ add_obj(H5HF_t *fh, hid_t dxpl, unsigned obj_off,
} /* end if */
/* Append the object info onto the array */
HDmemcpy(&keep_ids->ids[keep_ids->num_ids * HEAP_ID_LEN], heap_id, HEAP_ID_LEN);
HDmemcpy(&keep_ids->ids[keep_ids->num_ids * HEAP_ID_LEN], heap_id, (size_t)HEAP_ID_LEN);
keep_ids->lens[keep_ids->num_ids] = obj_size;
keep_ids->offs[keep_ids->num_ids] = obj_off;
@ -805,7 +809,6 @@ error:
*
* Note: The following fields in the 'state' structure are set to
* the values expected _after_ the block has been created:
* heap_size
* man_size
* man_alloc_size
* man_free_space
@ -882,7 +885,7 @@ fill_heap(H5HF_t *fh, hid_t dxpl, unsigned block_row, size_t obj_size,
*curr_off_ptr = obj_off;
/* Adjust state of heap */
state->nobjs++;
state->man_nobjs++;
state->man_free_space -= obj_size;
/* Check stats for heap */
@ -933,7 +936,7 @@ fill_heap(H5HF_t *fh, hid_t dxpl, unsigned block_row, size_t obj_size,
*curr_off_ptr = obj_off;
/* Adjust state of heap */
state->nobjs++;
state->man_nobjs++;
state->man_free_space -= last_obj_len;
/* Verify that the heap is full */
@ -1042,21 +1045,21 @@ fill_root_row(H5HF_t *fh, hid_t dxpl, unsigned row, size_t obj_size,
expand_rows = 0;
/* Compute first block & all blocks heap size & free space */
if(state->heap_size == 0) {
if(state->man_size == 0) {
first_heap_size = block_size;
first_free_space = block_free;
all_heap_size = width * block_size;
all_free_space = (width - 1) * block_free;
} /* end if */
else if(expand_rows == 0) {
all_heap_size = state->heap_size;
all_heap_size = state->man_size;
all_free_space = state->man_free_space;
first_heap_size = all_heap_size;
first_free_space = all_free_space;
all_free_space -= block_free; /* Account for shift from first free space */
} /* end if */
else {
all_heap_size = state->heap_size;
all_heap_size = state->man_size;
all_free_space = 0;
for(u = 0; u < expand_rows; u++) {
all_heap_size += width * DBLOCK_SIZE(fh, row + u);
@ -1068,13 +1071,11 @@ fill_root_row(H5HF_t *fh, hid_t dxpl, unsigned row, size_t obj_size,
} /* end else */
/* Loop over filling direct blocks, until root indirect row is full */
state->heap_size = first_heap_size;
state->man_size = first_heap_size;
state->man_free_space = first_free_space;
for(u = 0; u < width; u++) {
/* Set heap's size & free space correctly */
if(u == 1) {
state->heap_size = all_heap_size;
state->man_size = all_heap_size;
state->man_free_space = all_free_space;
} /* end if */
@ -1586,7 +1587,6 @@ fill_all_4th_indirect_rows(H5HF_t *fh, hid_t dxpl, size_t obj_size,
/* Increase heap size & free space */
for(row = 16; row < max_root_rows; row++) {
state->heap_size += width * DBLOCK_SIZE(fh, row);
state->man_size += width * DBLOCK_SIZE(fh, row);
state->man_free_space += width * DBLOCK_FREE(fh, row);
} /* end for */
@ -1871,7 +1871,6 @@ test_abs_insert_first(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpa
* Test inserting first (small) object into absolute heap
*/
TESTING("inserting first (small) object into absolute heap");
state.heap_size = DBLOCK_SIZE(fh, 0);
state.man_size = DBLOCK_SIZE(fh, 0);
state.man_alloc_size = DBLOCK_SIZE(fh, 0);
state.man_free_space = DBLOCK_FREE(fh, 0);
@ -1963,7 +1962,6 @@ test_abs_insert_second(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tp
* Test inserting first (small) object into absolute heap
*/
TESTING("inserting two (small) objects into absolute heap");
state.heap_size = DBLOCK_SIZE(fh, 0);
state.man_size = DBLOCK_SIZE(fh, 0);
state.man_alloc_size = DBLOCK_SIZE(fh, 0);
state.man_free_space = DBLOCK_FREE(fh, 0);
@ -2062,7 +2060,6 @@ test_abs_insert_root_mult(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t
fill_size = get_fill_size(tparam);
/* Fill the heap up */
state.heap_size = DBLOCK_SIZE(fh, 0);
state.man_size = DBLOCK_SIZE(fh, 0);
state.man_alloc_size = DBLOCK_SIZE(fh, 0);
state.man_free_space = DBLOCK_FREE(fh, 0);
@ -2158,7 +2155,6 @@ test_abs_insert_force_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_par
fill_size = get_fill_size(tparam);
/* Fill the heap up */
state.heap_size = DBLOCK_SIZE(fh, 0);
state.man_size = DBLOCK_SIZE(fh, 0);
state.man_alloc_size = DBLOCK_SIZE(fh, 0);
state.man_free_space = DBLOCK_FREE(fh, 0);
@ -2170,7 +2166,6 @@ test_abs_insert_force_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_par
TEST_ERROR
/* Insert one more object, to force root indirect block creation */
state.heap_size = cparam->managed.width * DBLOCK_SIZE(fh, 0);
state.man_size = cparam->managed.width * DBLOCK_SIZE(fh, 0);
state.man_alloc_size += DBLOCK_SIZE(fh, 0);
state.man_free_space = (cparam->managed.width - 1) * DBLOCK_FREE(fh, 0);
@ -2262,7 +2257,6 @@ test_abs_insert_fill_second(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_
fill_size = get_fill_size(tparam);
/* Fill the first direct block heap up */
state.heap_size = DBLOCK_SIZE(fh, 0);
state.man_size = DBLOCK_SIZE(fh, 0);
state.man_alloc_size = DBLOCK_SIZE(fh, 0);
state.man_free_space = DBLOCK_FREE(fh, 0);
@ -2274,7 +2268,6 @@ test_abs_insert_fill_second(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_
TEST_ERROR
/* Fill the second direct block heap up (also creates initial root indirect block) */
state.heap_size = cparam->managed.width * DBLOCK_SIZE(fh, 0);
state.man_size = cparam->managed.width * DBLOCK_SIZE(fh, 0);
state.man_alloc_size += DBLOCK_SIZE(fh, 0);
state.man_free_space = (cparam->managed.width - 1) * DBLOCK_FREE(fh, 0);
@ -2367,7 +2360,6 @@ test_abs_insert_third_direct(hid_t fapl, H5HF_create_t *cparam, fheap_test_param
fill_size = get_fill_size(tparam);
/* Fill the first direct block up */
state.heap_size = DBLOCK_SIZE(fh, 0);
state.man_size = DBLOCK_SIZE(fh, 0);
state.man_alloc_size = DBLOCK_SIZE(fh, 0);
state.man_free_space = DBLOCK_FREE(fh, 0);
@ -2375,7 +2367,6 @@ test_abs_insert_third_direct(hid_t fapl, H5HF_create_t *cparam, fheap_test_param
FAIL_STACK_ERROR
/* Fill the second direct block heap up (also creates initial root indirect block) */
state.heap_size = cparam->managed.width * DBLOCK_SIZE(fh, 0);
state.man_size = cparam->managed.width * DBLOCK_SIZE(fh, 0);
state.man_alloc_size += DBLOCK_SIZE(fh, 0);
state.man_free_space = (cparam->managed.width - 1) * DBLOCK_FREE(fh, 0);
@ -2576,7 +2567,6 @@ test_abs_start_second_row(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t
TEST_ERROR
/* Insert one more object, to force expanding root indirect block to two rows */
state.heap_size += cparam->managed.width * DBLOCK_SIZE(fh, 1);
state.man_size += cparam->managed.width * DBLOCK_SIZE(fh, 1);
state.man_alloc_size += DBLOCK_SIZE(fh, 1);
state.man_free_space = cparam->managed.width * DBLOCK_FREE(fh, 1);
@ -2778,8 +2768,6 @@ test_abs_start_third_row(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *
/* Insert one more object, to force expanding root indirect block to four rows */
/* (Goes to four rows because it's doubling) */
state.heap_size += cparam->managed.width * DBLOCK_SIZE(fh, 2);
state.heap_size += cparam->managed.width * DBLOCK_SIZE(fh, 3);
state.man_size += cparam->managed.width * DBLOCK_SIZE(fh, 2);
state.man_size += cparam->managed.width * DBLOCK_SIZE(fh, 3);
state.man_alloc_size += DBLOCK_SIZE(fh, 2);
@ -4876,7 +4864,8 @@ test_abs_remove_bogus(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpa
fill_size = get_fill_size(tparam);
/* Set heap ID to random (non-null) value */
for(u = 0; u < HEAP_ID_LEN; u++)
heap_id[0] = H5HF_ID_VERS_CURR | H5HF_ID_TYPE_MAN;
for(u = 1; u < HEAP_ID_LEN; u++)
heap_id[u] = HDrandom() + 1;
/* Try removing bogus heap ID from empty heap */
@ -4895,9 +4884,10 @@ test_abs_remove_bogus(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpa
FAIL_STACK_ERROR
/* Make certain we can't accidentally use a valid heap ID */
while(obj_off < state.heap_size) {
while(obj_off < state.man_size) {
/* Set heap ID to random (non-null) value */
for(u = 0; u < HEAP_ID_LEN; u++)
heap_id[0] = H5HF_ID_VERS_CURR | H5HF_ID_TYPE_MAN;
for(u = 1; u < HEAP_ID_LEN; u++)
heap_id[u] = HDrandom() + 1;
/* Get offset of random heap ID */
@ -5035,11 +5025,10 @@ test_abs_remove_one(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpara
TEST_ERROR
/* Check up on heap... */
state.heap_size = DBLOCK_SIZE(fh, 0);
state.man_size = DBLOCK_SIZE(fh, 0);
state.man_alloc_size = DBLOCK_SIZE(fh, 0);
state.man_free_space = DBLOCK_FREE(fh, 0) - sizeof(obj);
state.nobjs = 1;
state.man_nobjs = 1;
if(check_stats(fh, &state))
FAIL_STACK_ERROR
@ -5052,11 +5041,10 @@ test_abs_remove_one(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpara
TEST_ERROR
/* Check up on heap... */
state.heap_size = 0;
state.man_size = 0;
state.man_alloc_size = 0;
state.man_free_space = 0;
state.nobjs = 0;
state.man_nobjs = 0;
if(check_stats(fh, &state))
FAIL_STACK_ERROR
@ -5192,11 +5180,10 @@ test_abs_remove_two(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpara
TEST_ERROR
/* Check up on heap... */
state.heap_size = DBLOCK_SIZE(fh, 0);
state.man_size = DBLOCK_SIZE(fh, 0);
state.man_alloc_size = DBLOCK_SIZE(fh, 0);
state.man_free_space = DBLOCK_FREE(fh, 0) - sizeof(obj);
state.nobjs = 1;
state.man_nobjs = 1;
if(check_stats(fh, &state))
FAIL_STACK_ERROR
@ -5210,7 +5197,7 @@ test_abs_remove_two(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpara
/* Check up on heap... */
state.man_free_space -= sizeof(obj);
state.nobjs++;
state.man_nobjs++;
if(check_stats(fh, &state))
FAIL_STACK_ERROR
@ -5224,7 +5211,7 @@ test_abs_remove_two(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpara
/* Check up on heap... */
state.man_free_space += sizeof(obj);
state.nobjs--;
state.man_nobjs--;
if(check_stats(fh, &state))
FAIL_STACK_ERROR
@ -5237,11 +5224,10 @@ test_abs_remove_two(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpara
TEST_ERROR
/* Check up on heap... */
state.heap_size = 0;
state.man_size = 0;
state.man_alloc_size = 0;
state.man_free_space = 0;
state.nobjs = 0;
state.man_nobjs = 0;
if(check_stats(fh, &state))
FAIL_STACK_ERROR
@ -5379,13 +5365,12 @@ test_abs_remove_one_larger(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t
/* Check up on heap... */
for(u = 0; u < 4; u++) {
state.heap_size += DBLOCK_SIZE(fh, u) * cparam->managed.width;
state.man_size += DBLOCK_SIZE(fh, u) * cparam->managed.width;
state.man_free_space += DBLOCK_FREE(fh, u) * cparam->managed.width;
} /* end for */
state.man_alloc_size = DBLOCK_SIZE(fh, 3);
state.man_free_space -= obj_len;
state.nobjs = 1;
state.man_nobjs = 1;
if(check_stats(fh, &state))
FAIL_STACK_ERROR
@ -5398,11 +5383,10 @@ test_abs_remove_one_larger(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t
TEST_ERROR
/* Check up on heap... */
state.heap_size = 0;
state.man_size = 0;
state.man_alloc_size = 0;
state.man_free_space = 0;
state.nobjs = 0;
state.man_nobjs = 0;
if(check_stats(fh, &state))
FAIL_STACK_ERROR
@ -5544,13 +5528,12 @@ test_abs_remove_two_larger(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t
/* Check up on heap... */
for(u = 0; u < 4; u++) {
state.heap_size += DBLOCK_SIZE(fh, u) * cparam->managed.width;
state.man_size += DBLOCK_SIZE(fh, u) * cparam->managed.width;
state.man_free_space += DBLOCK_FREE(fh, u) * cparam->managed.width;
} /* end for */
state.man_alloc_size = DBLOCK_SIZE(fh, 3);
state.man_free_space -= obj_len;
state.nobjs = 1;
state.man_nobjs = 1;
if(check_stats(fh, &state))
FAIL_STACK_ERROR
@ -5569,13 +5552,12 @@ test_abs_remove_two_larger(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t
/* Check up on heap... */
/* (Goes to 8 rows because of doubling) */
for(u = 4; u < 8; u++) {
state.heap_size += DBLOCK_SIZE(fh, u) * cparam->managed.width;
state.man_size += DBLOCK_SIZE(fh, u) * cparam->managed.width;
state.man_free_space += DBLOCK_FREE(fh, u) * cparam->managed.width;
} /* end for */
state.man_alloc_size += DBLOCK_SIZE(fh, 5);
state.man_free_space -= obj_len;
state.nobjs = 2;
state.man_nobjs = 2;
if(check_stats(fh, &state))
FAIL_STACK_ERROR
@ -5592,7 +5574,7 @@ test_abs_remove_two_larger(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t
/* Check up on heap... */
state.man_alloc_size -= DBLOCK_SIZE(fh, 3);
state.man_free_space += DBLOCK_SIZE(fh, 2) + 1;
state.nobjs = 1;
state.man_nobjs = 1;
if(check_stats(fh, &state))
FAIL_STACK_ERROR
@ -5612,13 +5594,12 @@ test_abs_remove_two_larger(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t
/* Check up on heap... */
/* (Goes to 4 rows because of halving) */
for(u = 4; u < 8; u++) {
state.heap_size -= DBLOCK_SIZE(fh, u) * cparam->managed.width;
state.man_size -= DBLOCK_SIZE(fh, u) * cparam->managed.width;
state.man_free_space -= DBLOCK_FREE(fh, u) * cparam->managed.width;
} /* end for */
state.man_alloc_size -= DBLOCK_SIZE(fh, 5);
state.man_free_space += DBLOCK_SIZE(fh, 4) + 1;
state.nobjs = 1;
state.man_nobjs = 1;
if(check_stats(fh, &state))
FAIL_STACK_ERROR
@ -5632,11 +5613,10 @@ test_abs_remove_two_larger(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t
TEST_ERROR
/* Check up on heap... */
state.heap_size = 0;
state.man_size = 0;
state.man_alloc_size = 0;
state.man_free_space = 0;
state.nobjs = 0;
state.man_nobjs = 0;
if(check_stats(fh, &state))
FAIL_STACK_ERROR
@ -5783,13 +5763,12 @@ test_abs_remove_three_larger(hid_t fapl, H5HF_create_t *cparam, fheap_test_param
/* Check up on heap... */
for(u = 0; u < 4; u++) {
state.heap_size += DBLOCK_SIZE(fh, u) * cparam->managed.width;
state.man_size += DBLOCK_SIZE(fh, u) * cparam->managed.width;
state.man_free_space += DBLOCK_FREE(fh, u) * cparam->managed.width;
} /* end for */
state.man_alloc_size = DBLOCK_SIZE(fh, 3);
state.man_free_space -= obj_len;
state.nobjs = 1;
state.man_nobjs = 1;
if(check_stats(fh, &state))
FAIL_STACK_ERROR
@ -5808,13 +5787,12 @@ test_abs_remove_three_larger(hid_t fapl, H5HF_create_t *cparam, fheap_test_param
/* Check up on heap... */
/* (Goes to 8 rows because of doubling) */
for(u = 4; u < 8; u++) {
state.heap_size += DBLOCK_SIZE(fh, u) * cparam->managed.width;
state.man_size += DBLOCK_SIZE(fh, u) * cparam->managed.width;
state.man_free_space += DBLOCK_FREE(fh, u) * cparam->managed.width;
} /* end for */
state.man_alloc_size += DBLOCK_SIZE(fh, 5);
state.man_free_space -= obj_len;
state.nobjs = 2;
state.man_nobjs = 2;
if(check_stats(fh, &state))
FAIL_STACK_ERROR
@ -5833,13 +5811,12 @@ test_abs_remove_three_larger(hid_t fapl, H5HF_create_t *cparam, fheap_test_param
/* Check up on heap... */
/* (Goes to 16 rows because of doubling) */
for(u = 8; u < 16; u++) {
state.heap_size += DBLOCK_SIZE(fh, u) * cparam->managed.width;
state.man_size += DBLOCK_SIZE(fh, u) * cparam->managed.width;
state.man_free_space += DBLOCK_FREE(fh, u) * cparam->managed.width;
} /* end for */
state.man_alloc_size += DBLOCK_SIZE(fh, 8);
state.man_free_space -= obj_len;
state.nobjs = 3;
state.man_nobjs = 3;
if(check_stats(fh, &state))
FAIL_STACK_ERROR
@ -5856,7 +5833,7 @@ test_abs_remove_three_larger(hid_t fapl, H5HF_create_t *cparam, fheap_test_param
/* Check up on heap... */
state.man_alloc_size -= DBLOCK_SIZE(fh, 3);
state.man_free_space += DBLOCK_SIZE(fh, 2) + 1;
state.nobjs = 2;
state.man_nobjs = 2;
if(check_stats(fh, &state))
FAIL_STACK_ERROR
@ -5871,7 +5848,7 @@ test_abs_remove_three_larger(hid_t fapl, H5HF_create_t *cparam, fheap_test_param
/* Check up on heap... */
state.man_alloc_size -= DBLOCK_SIZE(fh, 5);
state.man_free_space += DBLOCK_SIZE(fh, 4) + 1;
state.nobjs = 1;
state.man_nobjs = 1;
if(check_stats(fh, &state))
FAIL_STACK_ERROR
@ -5891,13 +5868,12 @@ test_abs_remove_three_larger(hid_t fapl, H5HF_create_t *cparam, fheap_test_param
/* Check up on heap... */
/* (Goes to 8 rows because of halving) */
for(u = 8; u < 16; u++) {
state.heap_size -= DBLOCK_SIZE(fh, u) * cparam->managed.width;
state.man_size -= DBLOCK_SIZE(fh, u) * cparam->managed.width;
state.man_free_space -= DBLOCK_FREE(fh, u) * cparam->managed.width;
} /* end for */
state.man_alloc_size -= DBLOCK_SIZE(fh, 8);
state.man_free_space += DBLOCK_SIZE(fh, 7) + 1;
state.nobjs = 2;
state.man_nobjs = 2;
if(check_stats(fh, &state))
FAIL_STACK_ERROR
@ -5912,13 +5888,12 @@ test_abs_remove_three_larger(hid_t fapl, H5HF_create_t *cparam, fheap_test_param
/* Check up on heap... */
/* (Goes to 4 rows because of halving) */
for(u = 4; u < 8; u++) {
state.heap_size -= DBLOCK_SIZE(fh, u) * cparam->managed.width;
state.man_size -= DBLOCK_SIZE(fh, u) * cparam->managed.width;
state.man_free_space -= DBLOCK_FREE(fh, u) * cparam->managed.width;
} /* end for */
state.man_alloc_size -= DBLOCK_SIZE(fh, 5);
state.man_free_space += DBLOCK_SIZE(fh, 4) + 1;
state.nobjs = 1;
state.man_nobjs = 1;
if(check_stats(fh, &state))
FAIL_STACK_ERROR
@ -5932,11 +5907,10 @@ test_abs_remove_three_larger(hid_t fapl, H5HF_create_t *cparam, fheap_test_param
TEST_ERROR
/* Check up on heap... */
state.heap_size = 0;
state.man_size = 0;
state.man_alloc_size = 0;
state.man_free_space = 0;
state.nobjs = 0;
state.man_nobjs = 0;
if(check_stats(fh, &state))
FAIL_STACK_ERROR
@ -6017,7 +5991,6 @@ test_abs_remove_root_direct(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_
/* Fill the heap up */
state.heap_size = DBLOCK_SIZE(fh, 0);
state.man_size = DBLOCK_SIZE(fh, 0);
state.man_alloc_size = DBLOCK_SIZE(fh, 0);
state.man_free_space = DBLOCK_FREE(fh, 0);
@ -6092,7 +6065,6 @@ test_abs_remove_two_direct(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t
/* Fill the first block in heap */
state.heap_size = DBLOCK_SIZE(fh, 0);
state.man_size = DBLOCK_SIZE(fh, 0);
state.man_alloc_size = DBLOCK_SIZE(fh, 0);
state.man_free_space = DBLOCK_FREE(fh, 0);
@ -6108,7 +6080,6 @@ test_abs_remove_two_direct(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t
TEST_ERROR
/* Fill the second block in heap */
state.heap_size = cparam->managed.width * DBLOCK_SIZE(fh, 0);
state.man_size = cparam->managed.width * DBLOCK_SIZE(fh, 0);
state.man_alloc_size += DBLOCK_SIZE(fh, 0);
state.man_free_space = (cparam->managed.width - 1) * DBLOCK_FREE(fh, 0);
@ -6633,9 +6604,6 @@ test_abs_skip_start_block(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t
TEST_ERROR
obj_size = DBLOCK_SIZE(fh, 0) + 1;
state.heap_size = cparam->managed.width * DBLOCK_SIZE(fh, 0);
state.heap_size += cparam->managed.width * DBLOCK_SIZE(fh, 1);
state.heap_size += cparam->managed.width * DBLOCK_SIZE(fh, 2);
state.man_size = cparam->managed.width * DBLOCK_SIZE(fh, 0);
state.man_size += cparam->managed.width * DBLOCK_SIZE(fh, 1);
state.man_size += cparam->managed.width * DBLOCK_SIZE(fh, 2);
@ -6716,9 +6684,6 @@ test_abs_skip_start_block_add_back(hid_t fapl, H5HF_create_t *cparam, fheap_test
/* Insert object too large for starting block size */
obj_size = DBLOCK_SIZE(fh, 0) + 1;
state.heap_size = cparam->managed.width * DBLOCK_SIZE(fh, 0);
state.heap_size += cparam->managed.width * DBLOCK_SIZE(fh, 1);
state.heap_size += cparam->managed.width * DBLOCK_SIZE(fh, 2);
state.man_size = cparam->managed.width * DBLOCK_SIZE(fh, 0);
state.man_size += cparam->managed.width * DBLOCK_SIZE(fh, 1);
state.man_size += cparam->managed.width * DBLOCK_SIZE(fh, 2);
@ -6819,9 +6784,6 @@ test_abs_skip_start_block_add_skipped(hid_t fapl, H5HF_create_t *cparam, fheap_t
/* Insert object too large for starting block size */
obj_size = DBLOCK_SIZE(fh, 0) + 1;
state.heap_size = cparam->managed.width * DBLOCK_SIZE(fh, 0);
state.heap_size += cparam->managed.width * DBLOCK_SIZE(fh, 1);
state.heap_size += cparam->managed.width * DBLOCK_SIZE(fh, 2);
state.man_size = cparam->managed.width * DBLOCK_SIZE(fh, 0);
state.man_size += cparam->managed.width * DBLOCK_SIZE(fh, 1);
state.man_size += cparam->managed.width * DBLOCK_SIZE(fh, 2);
@ -6930,7 +6892,6 @@ test_abs_skip_2nd_block(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *t
/* Insert small object, to create root direct block */
state.heap_size = DBLOCK_SIZE(fh, 0);
state.man_size = DBLOCK_SIZE(fh, 0);
state.man_alloc_size = DBLOCK_SIZE(fh, 0);
state.man_free_space = DBLOCK_FREE(fh, 0);
@ -6945,9 +6906,6 @@ test_abs_skip_2nd_block(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *t
* range of skipped blocks that are too small to hold the second object
*/
obj_size = DBLOCK_SIZE(fh, 0) + 1;
state.heap_size += (cparam->managed.width - 1) * DBLOCK_SIZE(fh, 0);
state.heap_size += cparam->managed.width * DBLOCK_SIZE(fh, 1);
state.heap_size += cparam->managed.width * DBLOCK_SIZE(fh, 2);
state.man_size += (cparam->managed.width - 1) * DBLOCK_SIZE(fh, 0);
state.man_size += cparam->managed.width * DBLOCK_SIZE(fh, 1);
state.man_size += cparam->managed.width * DBLOCK_SIZE(fh, 2);
@ -7033,7 +6991,6 @@ test_abs_skip_2nd_block_add_skipped(hid_t fapl, H5HF_create_t *cparam, fheap_tes
/* Insert small object, to create root direct block */
state.heap_size = DBLOCK_SIZE(fh, 0);
state.man_size = DBLOCK_SIZE(fh, 0);
state.man_alloc_size = DBLOCK_SIZE(fh, 0);
state.man_free_space = DBLOCK_FREE(fh, 0);
@ -7048,9 +7005,6 @@ test_abs_skip_2nd_block_add_skipped(hid_t fapl, H5HF_create_t *cparam, fheap_tes
* range of skipped blocks that are too small to hold the second object
*/
obj_size = DBLOCK_SIZE(fh, 0) + 1;
state.heap_size += (cparam->managed.width - 1) * DBLOCK_SIZE(fh, 0);
state.heap_size += cparam->managed.width * DBLOCK_SIZE(fh, 1);
state.heap_size += cparam->managed.width * DBLOCK_SIZE(fh, 2);
state.man_size += (cparam->managed.width - 1) * DBLOCK_SIZE(fh, 0);
state.man_size += cparam->managed.width * DBLOCK_SIZE(fh, 1);
state.man_size += cparam->managed.width * DBLOCK_SIZE(fh, 2);
@ -7182,7 +7136,6 @@ test_abs_fill_one_partial_skip_2nd_block_add_skipped(hid_t fapl, H5HF_create_t *
/* Fill initial direct block */
state.heap_size = DBLOCK_SIZE(fh, 0);
state.man_size = DBLOCK_SIZE(fh, 0);
state.man_alloc_size = DBLOCK_SIZE(fh, 0);
state.man_free_space = DBLOCK_FREE(fh, 0);
@ -7194,7 +7147,6 @@ test_abs_fill_one_partial_skip_2nd_block_add_skipped(hid_t fapl, H5HF_create_t *
TEST_ERROR
/* Insert small object, to create root indirect block */
state.heap_size += (cparam->managed.width - 1) * DBLOCK_SIZE(fh, 0);
state.man_size += (cparam->managed.width - 1) * DBLOCK_SIZE(fh, 0);
state.man_alloc_size += DBLOCK_SIZE(fh, 0);
state.man_free_space += (cparam->managed.width - 1) * DBLOCK_FREE(fh, 0);
@ -7209,9 +7161,6 @@ test_abs_fill_one_partial_skip_2nd_block_add_skipped(hid_t fapl, H5HF_create_t *
* range of skipped blocks that are too small to hold the large object
*/
obj_size = DBLOCK_SIZE(fh, 2) + 1;
state.heap_size += cparam->managed.width * DBLOCK_SIZE(fh, 1);
state.heap_size += cparam->managed.width * DBLOCK_SIZE(fh, 2);
state.heap_size += cparam->managed.width * DBLOCK_SIZE(fh, 3);
state.man_size += cparam->managed.width * DBLOCK_SIZE(fh, 1);
state.man_size += cparam->managed.width * DBLOCK_SIZE(fh, 2);
state.man_size += cparam->managed.width * DBLOCK_SIZE(fh, 3);
@ -7363,9 +7312,6 @@ test_abs_fill_row_skip_add_skipped(hid_t fapl, H5HF_create_t *cparam, fheap_test
* range of skipped blocks that are too small to hold the large object
*/
obj_size = DBLOCK_SIZE(fh, 2) + 1;
state.heap_size += cparam->managed.width * DBLOCK_SIZE(fh, 1);
state.heap_size += cparam->managed.width * DBLOCK_SIZE(fh, 2);
state.heap_size += cparam->managed.width * DBLOCK_SIZE(fh, 3);
state.man_size += cparam->managed.width * DBLOCK_SIZE(fh, 1);
state.man_size += cparam->managed.width * DBLOCK_SIZE(fh, 2);
state.man_size += cparam->managed.width * DBLOCK_SIZE(fh, 3);
@ -7489,7 +7435,6 @@ test_abs_skip_direct_skip_indirect_two_rows_add_skipped(hid_t fapl, H5HF_create_
/* Compute heap size & free space when half direct blocks allocated */
row = 0;
do {
state.heap_size += cparam->managed.width * DBLOCK_SIZE(fh, row);
state.man_size += cparam->managed.width * DBLOCK_SIZE(fh, row);
state.man_free_space += cparam->managed.width * DBLOCK_FREE(fh, row);
row++;
@ -7504,7 +7449,6 @@ test_abs_skip_direct_skip_indirect_two_rows_add_skipped(hid_t fapl, H5HF_create_
/* Compute heap size & free space when all direct blocks allocated */
do {
state.heap_size += cparam->managed.width * DBLOCK_SIZE(fh, row);
state.man_size += cparam->managed.width * DBLOCK_SIZE(fh, row);
state.man_free_space += cparam->managed.width * DBLOCK_FREE(fh, row);
row++;
@ -7527,7 +7471,6 @@ test_abs_skip_direct_skip_indirect_two_rows_add_skipped(hid_t fapl, H5HF_create_
/* Compute heap size & free space when root indirect block doubles again */
do {
state.heap_size += cparam->managed.width * DBLOCK_SIZE(fh, row);
state.man_size += cparam->managed.width * DBLOCK_SIZE(fh, row);
state.man_free_space += cparam->managed.width * DBLOCK_FREE(fh, row);
row++;
@ -9813,7 +9756,6 @@ test_abs_fill_3rd_direct_fill_2nd_direct_fill_direct_skip_3rd_indirect_two_rows_
/* Increase heap size & free space */
for(row = 16; row < max_root_rows; row++) {
state.heap_size += cparam->managed.width * DBLOCK_SIZE(fh, row);
state.man_size += cparam->managed.width * DBLOCK_SIZE(fh, row);
state.man_free_space += cparam->managed.width * DBLOCK_FREE(fh, row);
} /* end for */
@ -10276,7 +10218,6 @@ test_abs_fill_4th_direct_less_one_fill_2nd_direct_fill_direct_skip_3rd_indirect_
/* Increase heap size & free space */
for(row = 16; row < max_root_rows; row++) {
state.heap_size += cparam->managed.width * DBLOCK_SIZE(fh, row);
state.man_size += cparam->managed.width * DBLOCK_SIZE(fh, row);
state.man_free_space += cparam->managed.width * DBLOCK_FREE(fh, row);
} /* end for */
@ -10415,7 +10356,6 @@ test_abs_frag_simple(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpar
* block size is reached.
*/
obj_size = DBLOCK_SIZE(fh, 0) / 2;
state.heap_size = DBLOCK_SIZE(fh, 0);
state.man_size = DBLOCK_SIZE(fh, 0);
state.man_free_space = DBLOCK_FREE(fh, 0);
for(u = 0; u < cparam->managed.width; u++) {
@ -10423,12 +10363,10 @@ test_abs_frag_simple(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpar
if(add_obj(fh, dxpl, 10, obj_size, &state, &keep_ids))
TEST_ERROR
if(u == 0) {
state.heap_size = cparam->managed.width * DBLOCK_SIZE(fh, 0);
state.man_size = cparam->managed.width * DBLOCK_SIZE(fh, 0);
state.man_free_space += (cparam->managed.width - 1) * DBLOCK_FREE(fh, 0);
} /* end if */
} /* end for */
state.heap_size += DBLOCK_SIZE(fh, 1) * cparam->managed.width;
state.man_size += DBLOCK_SIZE(fh, 1) * cparam->managed.width;
state.man_free_space += DBLOCK_FREE(fh, 1) * cparam->managed.width;
for(u = 0; u < cparam->managed.width; u++) {
@ -10443,7 +10381,6 @@ test_abs_frag_simple(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpar
/* (Account for doubling root indirect block for rows 3-4 */
for(u = 0; u < 2; u++) {
state.heap_size += DBLOCK_SIZE(fh, u + 2) * cparam->managed.width;
state.man_size += DBLOCK_SIZE(fh, u + 2) * cparam->managed.width;
state.man_free_space += DBLOCK_FREE(fh, u + 2) * cparam->managed.width;
} /* end for */
@ -10554,7 +10491,6 @@ test_abs_frag_direct(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpar
* share them with other objects of the same size.
*/
obj_size = DBLOCK_SIZE(fh, 0) / 2;
state.heap_size = DBLOCK_SIZE(fh, 0);
state.man_size = DBLOCK_SIZE(fh, 0);
state.man_free_space = DBLOCK_FREE(fh, 0);
/* First row */
@ -10563,12 +10499,10 @@ test_abs_frag_direct(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpar
if(add_obj(fh, dxpl, 10, obj_size, &state, &keep_ids))
TEST_ERROR
if(u == 0) {
state.heap_size = cparam->managed.width * DBLOCK_SIZE(fh, 0);
state.man_size = cparam->managed.width * DBLOCK_SIZE(fh, 0);
state.man_free_space += (cparam->managed.width - 1) * DBLOCK_FREE(fh, 0);
} /* end if */
} /* end for */
state.heap_size += DBLOCK_SIZE(fh, 1) * cparam->managed.width;
state.man_size += DBLOCK_SIZE(fh, 1) * cparam->managed.width;
state.man_free_space += DBLOCK_FREE(fh, 1) * cparam->managed.width;
/* Second row */
@ -10584,7 +10518,6 @@ test_abs_frag_direct(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpar
/* (Account for doubling root indirect block for rows 3-4 */
for(u = 0; u < 2; u++) {
state.heap_size += DBLOCK_SIZE(fh, u + 2) * cparam->managed.width;
state.man_size += DBLOCK_SIZE(fh, u + 2) * cparam->managed.width;
state.man_free_space += DBLOCK_FREE(fh, u + 2) * cparam->managed.width;
} /* end for */
@ -10605,7 +10538,6 @@ test_abs_frag_direct(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpar
/* (Account for doubling root indirect block for rows 5-8 */
for(u = 0; u < 4; u++) {
state.heap_size += DBLOCK_SIZE(fh, u + 4) * cparam->managed.width;
state.man_size += DBLOCK_SIZE(fh, u + 4) * cparam->managed.width;
state.man_free_space += DBLOCK_FREE(fh, u + 4) * cparam->managed.width;
} /* end for */
@ -10626,7 +10558,6 @@ test_abs_frag_direct(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpar
/* (Account for doubling root indirect block for rows 9-16 */
for(u = 0; u < 8; u++) {
state.heap_size += DBLOCK_SIZE(fh, u + 8) * cparam->managed.width;
state.man_size += DBLOCK_SIZE(fh, u + 8) * cparam->managed.width;
state.man_free_space += DBLOCK_FREE(fh, u + 8) * cparam->managed.width;
} /* end for */