diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2006-08-07 21:24:29 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2006-08-07 21:24:29 (GMT) |
commit | d17d42acd0fbba4b3433937f448c99930553b038 (patch) | |
tree | a6535d4c7f313315ad6e326ded953cdaf6df1ce9 /src | |
parent | 4f289e5b9240807d9fa5561fd793981334a9f086 (diff) | |
download | hdf5-d17d42acd0fbba4b3433937f448c99930553b038.zip hdf5-d17d42acd0fbba4b3433937f448c99930553b038.tar.gz hdf5-d17d42acd0fbba4b3433937f448c99930553b038.tar.bz2 |
[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)
Diffstat (limited to 'src')
-rw-r--r-- | src/H5HFcache.c | 36 | ||||
-rw-r--r-- | src/H5HFdbg.c | 50 | ||||
-rw-r--r-- | src/H5HFdtable.c | 6 | ||||
-rw-r--r-- | src/H5HFhdr.c | 8 | ||||
-rw-r--r-- | src/H5HFiblock.c | 12 | ||||
-rw-r--r-- | src/H5HFint.c | 9 | ||||
-rw-r--r-- | src/H5HFpkg.h | 51 | ||||
-rw-r--r-- | src/H5HFprivate.h | 15 | ||||
-rw-r--r-- | src/H5HFsection.c | 8 | ||||
-rw-r--r-- | src/H5HFstat.c | 6 | ||||
-rw-r--r-- | src/H5MMprivate.h | 2 |
11 files changed, 112 insertions, 91 deletions
diff --git a/src/H5HFcache.c b/src/H5HFcache.c index 8c64a51..53bf5ea 100644 --- a/src/H5HFcache.c +++ b/src/H5HFcache.c @@ -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 */ diff --git a/src/H5HFdbg.c b/src/H5HFdbg.c index 452401a..b603f0a 100644 --- a/src/H5HFdbg.c +++ b/src/H5HFdbg.c @@ -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; diff --git a/src/H5HFdtable.c b/src/H5HFdtable.c index e0e2ff9..700ae9e 100644 --- a/src/H5HFdtable.c +++ b/src/H5HFdtable.c @@ -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() */ diff --git a/src/H5HFhdr.c b/src/H5HFhdr.c index 1f3c79f..b93b8bf 100644 --- a/src/H5HFhdr.c +++ b/src/H5HFhdr.c @@ -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; diff --git a/src/H5HFiblock.c b/src/H5HFiblock.c index 1b66cd6..c6f54cb 100644 --- a/src/H5HFiblock.c +++ b/src/H5HFiblock.c @@ -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 */ diff --git a/src/H5HFint.c b/src/H5HFint.c index ce6d64a..a8441ea 100644 --- a/src/H5HFint.c +++ b/src/H5HFint.c @@ -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) diff --git a/src/H5HFpkg.h b/src/H5HFpkg.h index 25616f8..cddf981 100644 --- a/src/H5HFpkg.h +++ b/src/H5HFpkg.h @@ -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 */ diff --git a/src/H5HFprivate.h b/src/H5HFprivate.h index 32b6f41..85e0cf6 100644 --- a/src/H5HFprivate.h +++ b/src/H5HFprivate.h @@ -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) */ diff --git a/src/H5HFsection.c b/src/H5HFsection.c index ae91be3..8550a47 100644 --- a/src/H5HFsection.c +++ b/src/H5HFsection.c @@ -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 diff --git a/src/H5HFstat.c b/src/H5HFstat.c index e0e762f..0924dae 100644 --- a/src/H5HFstat.c +++ b/src/H5HFstat.c @@ -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) diff --git a/src/H5MMprivate.h b/src/H5MMprivate.h index 9aadd36..4c7de39 100644 --- a/src/H5MMprivate.h +++ b/src/H5MMprivate.h @@ -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) |