diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2008-09-25 23:14:43 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2008-09-25 23:14:43 (GMT) |
commit | f9f71a001ba65fbc515b440bf5cbace452947800 (patch) | |
tree | 22affd8e35a5bedb34827439b029214f58d8a851 /src | |
parent | 6a1614de3ea33c98e8fe6d11b8ac0a590f4d445a (diff) | |
download | hdf5-f9f71a001ba65fbc515b440bf5cbace452947800.zip hdf5-f9f71a001ba65fbc515b440bf5cbace452947800.tar.gz hdf5-f9f71a001ba65fbc515b440bf5cbace452947800.tar.bz2 |
[svn-r15703] Description:
Further progress on extensible array implementation - add support for
more data blocks from index block.
Tested on:
Mac OS X/32 10.5.4 (amazon) in debug mode
Mac OS X/32 10.5.4 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/Intel compilers w/default API=1.6.x,
w/C++ & FORTRAN, in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
Diffstat (limited to 'src')
-rw-r--r-- | src/H5EA.c | 22 | ||||
-rw-r--r-- | src/H5EAcache.c | 50 | ||||
-rw-r--r-- | src/H5EAdbg.c | 28 | ||||
-rw-r--r-- | src/H5EAdblock.c | 12 | ||||
-rw-r--r-- | src/H5EAhdr.c | 26 | ||||
-rw-r--r-- | src/H5EAiblock.c | 16 | ||||
-rw-r--r-- | src/H5EApkg.h | 13 | ||||
-rw-r--r-- | src/H5EAtest.c | 10 |
8 files changed, 83 insertions, 94 deletions
@@ -355,7 +355,7 @@ HDfprintf(stderr, "%s: Index block address not defined!\n", FUNC, idx); H5E_THROW(H5E_CANTCREATE, "unable to create index block") /* Increment count of elements "realized" */ - hdr->stats.nelmts += hdr->idx_blk_elmts; + hdr->stats.nelmts += hdr->cparam.idx_blk_elmts; /* Mark the header dirty */ hdr_dirty = TRUE; @@ -369,9 +369,9 @@ HDfprintf(stderr, "%s: Index block address is: %a\n", FUNC, hdr->idx_blk_addr); H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array index block, address = %llu", (unsigned long_long)hdr->idx_blk_addr) /* Check if element is in index block */ - if(idx < hdr->idx_blk_elmts) { + if(idx < hdr->cparam.idx_blk_elmts) { /* Set element in index block */ - HDmemcpy(((uint8_t *)iblock->elmts) + (hdr->cls->nat_elmt_size * idx), elmt, hdr->cls->nat_elmt_size); + HDmemcpy(((uint8_t *)iblock->elmts) + (hdr->cparam.cls->nat_elmt_size * idx), elmt, hdr->cparam.cls->nat_elmt_size); iblock_cache_flags |= H5AC__DIRTIED_FLAG; } /* end if */ else { @@ -382,7 +382,7 @@ HDfprintf(stderr, "%s: Index block address is: %a\n", FUNC, hdr->idx_blk_addr); sblk_idx = H5EA__dblock_sblk_idx(hdr, idx); /* Adjust index to offset in super block */ - elmt_idx = idx - hdr->idx_blk_elmts + hdr->sblk_info[sblk_idx].start_idx; + elmt_idx = idx - hdr->cparam.idx_blk_elmts + hdr->sblk_info[sblk_idx].start_idx; #ifdef QAK HDfprintf(stderr, "%s: after adjusting for super block elements, elmt_idx = %Hu\n", FUNC, elmt_idx); #endif /* QAK */ @@ -428,7 +428,7 @@ HDfprintf(stderr, "%s: dblk_idx = %u\n", FUNC, dblk_idx); elmt_idx %= hdr->sblk_info[sblk_idx].dblk_nelmts; /* Set element in data block */ - HDmemcpy(((uint8_t *)dblock->elmts) + (hdr->cls->nat_elmt_size * elmt_idx), elmt, hdr->cls->nat_elmt_size); + HDmemcpy(((uint8_t *)dblock->elmts) + (hdr->cparam.cls->nat_elmt_size * elmt_idx), elmt, hdr->cparam.cls->nat_elmt_size); dblock_cache_flags |= H5AC__DIRTIED_FLAG; } /* end if */ else { @@ -503,7 +503,7 @@ HDfprintf(stderr, "%s: Index %Hu\n", FUNC, idx); HDfprintf(stderr, "%s: Element beyond max. index set, hdr->stats.max_idx_set = %Hu, idx = %Hu\n", FUNC, hdr->stats.max_idx_set, idx); #endif /* QAK */ /* Call the class's 'fill' callback */ - if((hdr->cls->fill)(elmt, (size_t)1) < 0) + if((hdr->cparam.cls->fill)(elmt, (size_t)1) < 0) H5E_THROW(H5E_CANTSET, "can't set element to class's fill value") } /* end if */ else { @@ -516,9 +516,9 @@ HDfprintf(stderr, "%s: Index block address is: %a\n", FUNC, hdr->idx_blk_addr); H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array index block, address = %llu", (unsigned long_long)hdr->idx_blk_addr) /* Check if element is in index block */ - if(idx < hdr->idx_blk_elmts) { + if(idx < hdr->cparam.idx_blk_elmts) { /* Get element from index block */ - HDmemcpy(elmt, ((uint8_t *)iblock->elmts) + (hdr->cls->nat_elmt_size * idx), hdr->cls->nat_elmt_size); + HDmemcpy(elmt, ((uint8_t *)iblock->elmts) + (hdr->cparam.cls->nat_elmt_size * idx), hdr->cparam.cls->nat_elmt_size); } /* end if */ else { unsigned sblk_idx; /* Which superblock does this index fall in? */ @@ -528,7 +528,7 @@ HDfprintf(stderr, "%s: Index block address is: %a\n", FUNC, hdr->idx_blk_addr); sblk_idx = H5EA__dblock_sblk_idx(hdr, idx); /* Adjust index to offset in super block */ - elmt_idx = idx - hdr->idx_blk_elmts + hdr->sblk_info[sblk_idx].start_idx; + elmt_idx = idx - hdr->cparam.idx_blk_elmts + hdr->sblk_info[sblk_idx].start_idx; #ifdef QAK HDfprintf(stderr, "%s: after adjusting for super block elements, elmt_idx = %Hu\n", FUNC, elmt_idx); #endif /* QAK */ @@ -550,7 +550,7 @@ HDfprintf(stderr, "%s: dblk_idx = %u\n", FUNC, dblk_idx); /* Check if the data block has been allocated on disk yet */ if(!H5F_addr_defined(iblock->dblk_addrs[dblk_idx])) { /* Call the class's 'fill' callback */ - if((hdr->cls->fill)(elmt, (size_t)1) < 0) + if((hdr->cparam.cls->fill)(elmt, (size_t)1) < 0) H5E_THROW(H5E_CANTSET, "can't set element to class's fill value") } /* end if */ else { @@ -562,7 +562,7 @@ HDfprintf(stderr, "%s: dblk_idx = %u\n", FUNC, dblk_idx); elmt_idx %= hdr->sblk_info[sblk_idx].dblk_nelmts; /* Retrieve element from data block */ - HDmemcpy(elmt, ((uint8_t *)dblock->elmts) + (hdr->cls->nat_elmt_size * elmt_idx), hdr->cls->nat_elmt_size); + HDmemcpy(elmt, ((uint8_t *)dblock->elmts) + (hdr->cparam.cls->nat_elmt_size * elmt_idx), hdr->cparam.cls->nat_elmt_size); } /* end else */ } /* end if */ else { diff --git a/src/H5EAcache.c b/src/H5EAcache.c index 35f6275..d484653 100644 --- a/src/H5EAcache.c +++ b/src/H5EAcache.c @@ -213,11 +213,11 @@ H5EA__cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_cls, H5E_THROW(H5E_BADTYPE, "incorrect extensible array class") /* General array creation/configuration information */ - hdr->raw_elmt_size = *p++; /* Element size in file (in bytes) */ - hdr->max_nelmts_bits = *p++; /* Log2(Max. # of elements in array) - i.e. # of bits needed to store max. # of elements */ - hdr->idx_blk_elmts = *p++; /* # of elements to store in index block */ - hdr->data_blk_min_elmts = *p++; /* Min. # of elements per data block */ - hdr->sup_blk_min_data_ptrs = *p++; /* Min. # of data block pointers for a super block */ + hdr->cparam.raw_elmt_size = *p++; /* Element size in file (in bytes) */ + hdr->cparam.max_nelmts_bits = *p++; /* Log2(Max. # of elements in array) - i.e. # of bits needed to store max. # of elements */ + hdr->cparam.idx_blk_elmts = *p++; /* # of elements to store in index block */ + hdr->cparam.data_blk_min_elmts = *p++; /* Min. # of elements per data block */ + hdr->cparam.sup_blk_min_data_ptrs = *p++; /* Min. # of data block pointers for a super block */ /* Internal information */ H5F_addr_decode(f, &p, &hdr->idx_blk_addr); /* Address of index block */ @@ -318,14 +318,14 @@ H5EA__cache_hdr_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, *p++ = H5EA_HDR_VERSION; /* Extensible array type */ - *p++ = hdr->cls->id; + *p++ = hdr->cparam.cls->id; /* General array creation/configuration information */ - *p++ = hdr->raw_elmt_size; /* Element size in file (in bytes) */ - *p++ = hdr->max_nelmts_bits; /* Log2(Max. # of elements in array) - i.e. # of bits needed to store max. # of elements */ - *p++ = hdr->idx_blk_elmts; /* # of elements to store in index block */ - *p++ = hdr->data_blk_min_elmts; /* Min. # of elements per data block */ - *p++ = hdr->sup_blk_min_data_ptrs; /* Min. # of data block pointers for a super block */ + *p++ = hdr->cparam.raw_elmt_size; /* Element size in file (in bytes) */ + *p++ = hdr->cparam.max_nelmts_bits; /* Log2(Max. # of elements in array) - i.e. # of bits needed to store max. # of elements */ + *p++ = hdr->cparam.idx_blk_elmts; /* # of elements to store in index block */ + *p++ = hdr->cparam.data_blk_min_elmts; /* Min. # of elements per data block */ + *p++ = hdr->cparam.sup_blk_min_data_ptrs; /* Min. # of data block pointers for a super block */ /* Internal information */ H5F_addr_encode(f, &p, hdr->idx_blk_addr); /* Address of index block */ @@ -525,17 +525,17 @@ H5EA__cache_iblock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, H5E_THROW(H5E_VERSION, "wrong extensible array index block version") /* Extensible array type */ - if(*p++ != (uint8_t)hdr->cls->id) + if(*p++ != (uint8_t)hdr->cparam.cls->id) H5E_THROW(H5E_BADTYPE, "incorrect extensible array class") /* Internal information */ /* Decode elements in index block */ - if(hdr->idx_blk_elmts > 0) { + if(hdr->cparam.idx_blk_elmts > 0) { /* Convert from raw elements on disk into native elements in memory */ - if((hdr->cls->decode)(p, iblock->elmts, (size_t)hdr->idx_blk_elmts) < 0) + if((hdr->cparam.cls->decode)(p, iblock->elmts, (size_t)hdr->cparam.idx_blk_elmts) < 0) H5E_THROW(H5E_CANTDECODE, "can't decode extensible array index elements") - p += (hdr->idx_blk_elmts * hdr->raw_elmt_size); + p += (hdr->cparam.idx_blk_elmts * hdr->cparam.raw_elmt_size); } /* end if */ /* Decode data block addresses in index block */ @@ -647,16 +647,16 @@ H5EA__cache_iblock_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, *p++ = H5EA_IBLOCK_VERSION; /* Extensible array type */ - *p++ = iblock->hdr->cls->id; + *p++ = iblock->hdr->cparam.cls->id; /* Internal information */ /* Encode elements in index block */ - if(iblock->hdr->idx_blk_elmts > 0) { + if(iblock->hdr->cparam.idx_blk_elmts > 0) { /* Convert from native elements in memory into raw elements on disk */ - if((iblock->hdr->cls->encode)(p, iblock->elmts, (size_t)iblock->hdr->idx_blk_elmts) < 0) + if((iblock->hdr->cparam.cls->encode)(p, iblock->elmts, (size_t)iblock->hdr->cparam.idx_blk_elmts) < 0) H5E_THROW(H5E_CANTENCODE, "can't encode extensible array index elements") - p += (iblock->hdr->idx_blk_elmts * iblock->hdr->raw_elmt_size); + p += (iblock->hdr->cparam.idx_blk_elmts * iblock->hdr->cparam.raw_elmt_size); } /* end if */ /* Encode data block addresses in index block */ @@ -869,16 +869,16 @@ H5EA__cache_dblock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, H5E_THROW(H5E_VERSION, "wrong extensible array data block version") /* Extensible array type */ - if(*p++ != (uint8_t)hdr->cls->id) + if(*p++ != (uint8_t)hdr->cparam.cls->id) H5E_THROW(H5E_BADTYPE, "incorrect extensible array class") /* Internal information */ /* Decode elements in data block */ /* Convert from raw elements on disk into native elements in memory */ - if((hdr->cls->decode)(p, dblock->elmts, *nelmts) < 0) + if((hdr->cparam.cls->decode)(p, dblock->elmts, *nelmts) < 0) H5E_THROW(H5E_CANTDECODE, "can't decode extensible array data elements") - p += (*nelmts * hdr->raw_elmt_size); + p += (*nelmts * hdr->cparam.raw_elmt_size); /* Sanity check */ /* (allow for checksum not decoded yet) */ @@ -971,16 +971,16 @@ H5EA__cache_dblock_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, *p++ = H5EA_DBLOCK_VERSION; /* Extensible array type */ - *p++ = dblock->hdr->cls->id; + *p++ = dblock->hdr->cparam.cls->id; /* Internal information */ /* Encode elements in data block */ /* Convert from native elements in memory into raw elements on disk */ - if((dblock->hdr->cls->encode)(p, dblock->elmts, dblock->nelmts) < 0) + if((dblock->hdr->cparam.cls->encode)(p, dblock->elmts, dblock->nelmts) < 0) H5E_THROW(H5E_CANTENCODE, "can't encode extensible array data elements") - p += (dblock->nelmts * dblock->hdr->raw_elmt_size); + p += (dblock->nelmts * dblock->hdr->cparam.raw_elmt_size); /* Compute metadata checksum */ metadata_chksum = H5_checksum_metadata(buf, (size_t)(p - buf), 0); diff --git a/src/H5EAdbg.c b/src/H5EAdbg.c index 26c1070..9fb30c7 100644 --- a/src/H5EAdbg.c +++ b/src/H5EAdbg.c @@ -119,26 +119,26 @@ H5EA__hdr_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, /* Print the values */ HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Array class ID:", - (hdr->cls->id == H5EA_CLS_TEST_ID ? "H5EA_CLS_TEST_ID" : + (hdr->cparam.cls->id == H5EA_CLS_TEST_ID ? "H5EA_CLS_TEST_ID" : "Unknown!")); HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, "Header size:", hdr->size); HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Raw Element Size:", - (unsigned)hdr->raw_elmt_size); + (unsigned)hdr->cparam.raw_elmt_size); HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, "Native Element Size (on this platform):", - hdr->cls->nat_elmt_size); + hdr->cparam.cls->nat_elmt_size); HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "# of elements in index block:", - (unsigned)hdr->idx_blk_elmts); + (unsigned)hdr->cparam.idx_blk_elmts); HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Min. # of elements per data block:", - (unsigned)hdr->data_blk_min_elmts); + (unsigned)hdr->cparam.data_blk_min_elmts); HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Min. # of data block pointers for a super block:", - (unsigned)hdr->sup_blk_min_data_ptrs); + (unsigned)hdr->cparam.sup_blk_min_data_ptrs); HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, "Highest element index stored (+1):", hdr->stats.max_idx_set); @@ -210,7 +210,7 @@ H5EA__iblock_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int inde /* Print the values */ HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Array class ID:", - (hdr->cls->id == H5EA_CLS_TEST_ID ? "H5EA_CLS_TEST_ID" : + (hdr->cparam.cls->id == H5EA_CLS_TEST_ID ? "H5EA_CLS_TEST_ID" : "Unknown!")); HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, "Index Block size:", @@ -223,16 +223,16 @@ H5EA__iblock_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int inde iblock->nsblk_addrs); /* Check if there are any elements in index block */ - if(hdr->idx_blk_elmts > 0) { + if(hdr->cparam.idx_blk_elmts > 0) { unsigned u; /* Local index variable */ /* Print the elements in the index block */ HDfprintf(stream, "%*sElements in Index Block:\n", indent, ""); - for(u = 0; u < hdr->idx_blk_elmts; u++) { + for(u = 0; u < hdr->cparam.idx_blk_elmts; u++) { /* Call the class's 'debug' callback */ - if((hdr->cls->debug)(stream, (indent + 3), MAX(0, (fwidth - 3)), + if((hdr->cparam.cls->debug)(stream, (indent + 3), MAX(0, (fwidth - 3)), (hsize_t)u, - ((uint8_t *)iblock->elmts) + (hdr->cls->nat_elmt_size * u)) < 0) + ((uint8_t *)iblock->elmts) + (hdr->cparam.cls->nat_elmt_size * u)) < 0) H5E_THROW(H5E_CANTGET, "can't get element for debugging") } /* end for */ } /* end if */ @@ -325,7 +325,7 @@ H5EA__dblock_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int inde /* Print the values */ HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Array class ID:", - (hdr->cls->id == H5EA_CLS_TEST_ID ? "H5EA_CLS_TEST_ID" : + (hdr->cparam.cls->id == H5EA_CLS_TEST_ID ? "H5EA_CLS_TEST_ID" : "Unknown!")); HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, "Data Block size:", @@ -336,9 +336,9 @@ H5EA__dblock_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int inde HDfprintf(stream, "%*sElements:\n", indent, ""); for(u = 0; u < dblk_nelmts; u++) { /* Call the class's 'debug' callback */ - if((hdr->cls->debug)(stream, (indent + 3), MAX(0, (fwidth - 3)), + if((hdr->cparam.cls->debug)(stream, (indent + 3), MAX(0, (fwidth - 3)), (hsize_t)u, - ((uint8_t *)dblock->elmts) + (hdr->cls->nat_elmt_size * u)) < 0) + ((uint8_t *)dblock->elmts) + (hdr->cparam.cls->nat_elmt_size * u)) < 0) H5E_THROW(H5E_CANTGET, "can't get element for debugging") } /* end for */ diff --git a/src/H5EAdblock.c b/src/H5EAdblock.c index e99fb3d..15a38c5 100644 --- a/src/H5EAdblock.c +++ b/src/H5EAdblock.c @@ -176,11 +176,11 @@ HDfprintf(stderr, "%s: dblock->size = %Zu\n", FUNC, dblock->size); #endif /* QAK */ /* Allocate space for the data block on disk */ - if(HADDR_UNDEF == (dblock->addr = H5MF_alloc(iblock->hdr->f, H5FD_MEM_EARRAY_DBLOCK, dxpl_id, dblock->size))) + if(HADDR_UNDEF == (dblock->addr = H5MF_alloc(iblock->hdr->f, H5FD_MEM_EARRAY_DBLOCK, dxpl_id, (hsize_t)dblock->size))) H5E_THROW(H5E_CANTALLOC, "file allocation failed for extensible array data block") /* Clear any elements in index block to fill value */ - if((iblock->hdr->cls->fill)(dblock->elmts, (size_t)dblock->nelmts) < 0) + if((iblock->hdr->cparam.cls->fill)(dblock->elmts, (size_t)dblock->nelmts) < 0) H5E_THROW(H5E_CANTSET, "can't set extensible array data block elements to class's fill value") /* Cache the new extensible array data block */ @@ -228,13 +228,13 @@ H5EA__dblock_sblk_idx(const H5EA_hdr_t *hdr, hsize_t idx)) /* Sanity check */ HDassert(hdr); - HDassert(idx >= hdr->idx_blk_elmts); + HDassert(idx >= hdr->cparam.idx_blk_elmts); #ifdef QAK HDfprintf(stderr, "%s: Entering - idx = %Hu\n", FUNC, idx); #endif /* QAK */ /* Adjust index for elements in index block */ - idx -= hdr->idx_blk_elmts; + idx -= hdr->cparam.idx_blk_elmts; #ifdef QAK HDfprintf(stderr, "%s: after adjusting for index block elements, idx = %Hu\n", FUNC, idx); #endif /* QAK */ @@ -242,9 +242,9 @@ HDfprintf(stderr, "%s: after adjusting for index block elements, idx = %Hu\n", F /* Determine the superblock information for the index */ H5_CHECK_OVERFLOW(idx, /*From:*/hsize_t, /*To:*/uint64_t); #ifdef QAK -HDfprintf(stderr, "%s: hdr->data_blk_min_elmts = %u\n", FUNC, (unsigned)hdr->data_blk_min_elmts); +HDfprintf(stderr, "%s: hdr->cparam.data_blk_min_elmts = %u\n", FUNC, (unsigned)hdr->cparam.data_blk_min_elmts); #endif /* QAK */ - sblk_idx = H5V_log2_gen((uint64_t)((idx / hdr->data_blk_min_elmts) + 1)); + sblk_idx = H5V_log2_gen((uint64_t)((idx / hdr->cparam.data_blk_min_elmts) + 1)); #ifdef QAK HDfprintf(stderr, "%s: sblk_idx = %u\n", FUNC, sblk_idx); HDfprintf(stderr, "%s: hdr->sblk_info[%u] = {%Hu, %Zu, %Hu, %Hu}\n", FUNC, sblk_idx, hdr->sblk_info[sblk_idx].ndblks, hdr->sblk_info[sblk_idx].dblk_nelmts, hdr->sblk_info[sblk_idx].start_idx, hdr->sblk_info[sblk_idx].start_dblk); diff --git a/src/H5EAhdr.c b/src/H5EAhdr.c index 5fcf2be..3dc5d50 100644 --- a/src/H5EAhdr.c +++ b/src/H5EAhdr.c @@ -131,7 +131,7 @@ H5EA__hdr_alloc(H5F_t *f, const H5EA_class_t *cls)) hdr->sizeof_size = H5F_SIZEOF_SIZE(f); /* Set the class of the array */ - hdr->cls = cls; + hdr->cparam.cls = cls; /* Set the return value */ ret_value = hdr; @@ -191,12 +191,12 @@ H5EA__hdr_init(H5EA_hdr_t *hdr)) /* Sanity check */ HDassert(hdr); - HDassert(hdr->max_nelmts_bits); - HDassert(hdr->data_blk_min_elmts); - HDassert(hdr->sup_blk_min_data_ptrs); + HDassert(hdr->cparam.max_nelmts_bits); + HDassert(hdr->cparam.data_blk_min_elmts); + HDassert(hdr->cparam.sup_blk_min_data_ptrs); /* Compute general information */ - hdr->nsblks = 1 + (hdr->max_nelmts_bits - H5V_log2_of2(hdr->data_blk_min_elmts)); + hdr->nsblks = 1 + (hdr->cparam.max_nelmts_bits - H5V_log2_of2(hdr->cparam.data_blk_min_elmts)); #ifdef QAK HDfprintf(stderr, "%s: hdr->nsblks = %Zu\n", FUNC, hdr->nsblks); #endif /* QAK */ @@ -210,7 +210,7 @@ HDfprintf(stderr, "%s: hdr->nsblks = %Zu\n", FUNC, hdr->nsblks); start_dblk = 0; for(u = 0; u < hdr->nsblks; u++) { hdr->sblk_info[u].ndblks = (hsize_t)H5_EXP2(u / 2); - hdr->sblk_info[u].dblk_nelmts = (size_t)H5_EXP2((u + 1) / 2) * hdr->data_blk_min_elmts; + hdr->sblk_info[u].dblk_nelmts = (size_t)H5_EXP2((u + 1) / 2) * hdr->cparam.data_blk_min_elmts; hdr->sblk_info[u].start_idx = start_idx; hdr->sblk_info[u].start_dblk = start_dblk; #ifdef QAK @@ -257,7 +257,7 @@ H5EA__hdr_alloc_elmts(H5EA_hdr_t *hdr, size_t nelmts)) /* Compute the index of the element buffer factory */ H5_CHECK_OVERFLOW(nelmts, /*From:*/size_t, /*To:*/uint32_t); - idx = H5V_log2_of2((uint32_t)nelmts) - H5V_log2_of2((uint32_t)hdr->data_blk_min_elmts); + idx = H5V_log2_of2((uint32_t)nelmts) - H5V_log2_of2((uint32_t)hdr->cparam.data_blk_min_elmts); #ifdef QAK HDfprintf(stderr, "%s: nelmts = %Zu, hdr->data_blk_min_elmts = %u, idx = %u\n", FUNC, nelmts, (unsigned)hdr->data_blk_min_elmts, idx); #endif /* QAK */ @@ -281,7 +281,7 @@ HDfprintf(stderr, "%s: nelmts = %Zu, hdr->data_blk_min_elmts = %u, idx = %u\n", /* Check for un-initialized factory at index */ if(NULL == hdr->elmt_fac.fac[idx]) { - if(NULL == (hdr->elmt_fac.fac[idx] = H5FL_fac_init(nelmts * (size_t)hdr->cls->nat_elmt_size))) + if(NULL == (hdr->elmt_fac.fac[idx] = H5FL_fac_init(nelmts * (size_t)hdr->cparam.cls->nat_elmt_size))) H5E_THROW(H5E_CANTINIT, "can't create data block data element buffer factory") } /* end if */ @@ -327,7 +327,7 @@ H5EA__hdr_free_elmts(H5EA_hdr_t *hdr, size_t nelmts, void *elmts)) /* Compute the index of the element buffer factory */ H5_CHECK_OVERFLOW(nelmts, /*From:*/size_t, /*To:*/uint32_t); - idx = H5V_log2_of2((uint32_t)nelmts) - H5V_log2_of2((uint32_t)hdr->data_blk_min_elmts); + idx = H5V_log2_of2((uint32_t)nelmts) - H5V_log2_of2((uint32_t)hdr->cparam.data_blk_min_elmts); #ifdef QAK HDfprintf(stderr, "%s: nelmts = %Zu, hdr->data_blk_min_elmts = %u, idx = %u\n", FUNC, nelmts, (unsigned)hdr->data_blk_min_elmts, idx); #endif /* QAK */ @@ -392,18 +392,14 @@ HDfprintf(stderr, "%s: Called\n", FUNC); hdr->idx_blk_addr = HADDR_UNDEF; /* Set the creation parameters for the array */ - hdr->raw_elmt_size = cparam->raw_elmt_size; - hdr->max_nelmts_bits = cparam->max_nelmts_bits; - hdr->idx_blk_elmts = cparam->idx_blk_elmts; - hdr->sup_blk_min_data_ptrs = cparam->sup_blk_min_data_ptrs; - hdr->data_blk_min_elmts = cparam->data_blk_min_elmts; + HDmemcpy(&hdr->cparam, cparam, sizeof(hdr->cparam)); /* Finish initializing extensible array header */ if(H5EA__hdr_init(hdr) < 0) H5E_THROW(H5E_CANTINIT, "initialization failed for extensible array header") /* Allocate space for the header on disk */ - if(HADDR_UNDEF == (hdr->addr = H5MF_alloc(f, H5FD_MEM_EARRAY_HDR, dxpl_id, hdr->size))) + if(HADDR_UNDEF == (hdr->addr = H5MF_alloc(f, H5FD_MEM_EARRAY_HDR, dxpl_id, (hsize_t)hdr->size))) H5E_THROW(H5E_CANTALLOC, "file allocation failed for extensible array header") /* Cache the new extensible array header */ diff --git a/src/H5EAiblock.c b/src/H5EAiblock.c index bf3fac4..75c2c85 100644 --- a/src/H5EAiblock.c +++ b/src/H5EAiblock.c @@ -123,8 +123,8 @@ H5EA__iblock_alloc(H5EA_hdr_t *hdr)) iblock->addr = HADDR_UNDEF; /* Compute information */ - iblock->nsblks = 2 * H5V_log2_of2((uint32_t)hdr->sup_blk_min_data_ptrs); - iblock->ndblk_addrs = 2 * ((size_t)hdr->sup_blk_min_data_ptrs - 1); + iblock->nsblks = 2 * H5V_log2_of2((uint32_t)hdr->cparam.sup_blk_min_data_ptrs); + iblock->ndblk_addrs = 2 * ((size_t)hdr->cparam.sup_blk_min_data_ptrs - 1); iblock->nsblk_addrs = hdr->nsblks - iblock->nsblks; #ifdef QAK HDfprintf(stderr, "%s: iblock->nsblks = %u\n", FUNC, iblock->nsblks); @@ -133,8 +133,8 @@ HDfprintf(stderr, "%s: iblock->nsblk_addrs = %Zu\n", FUNC, iblock->nsblk_addrs); #endif /* QAK */ /* Allocate buffer for elements in index block */ - if(hdr->idx_blk_elmts > 0) - if(NULL == (iblock->elmts = H5FL_BLK_MALLOC(idx_blk_elmt_buf, (size_t)(hdr->idx_blk_elmts * hdr->cls->nat_elmt_size)))) + if(hdr->cparam.idx_blk_elmts > 0) + if(NULL == (iblock->elmts = H5FL_BLK_MALLOC(idx_blk_elmt_buf, (size_t)(hdr->cparam.idx_blk_elmts * hdr->cparam.cls->nat_elmt_size)))) H5E_THROW(H5E_CANTALLOC, "memory allocation failed for index block data element buffer") /* Allocate buffer for data block addresses in index block */ @@ -201,13 +201,13 @@ HDfprintf(stderr, "%s: iblock->size = %Zu\n", FUNC, iblock->size); #endif /* QAK */ /* Allocate space for the index block on disk */ - if(HADDR_UNDEF == (iblock->addr = H5MF_alloc(hdr->f, H5FD_MEM_EARRAY_IBLOCK, dxpl_id, iblock->size))) + if(HADDR_UNDEF == (iblock->addr = H5MF_alloc(hdr->f, H5FD_MEM_EARRAY_IBLOCK, dxpl_id, (hsize_t)iblock->size))) H5E_THROW(H5E_CANTALLOC, "file allocation failed for extensible array index block") /* Clear any elements in index block to fill value */ - if(hdr->idx_blk_elmts > 0) { + if(hdr->cparam.idx_blk_elmts > 0) { /* Call the class's 'fill' callback */ - if((hdr->cls->fill)(iblock->elmts, (size_t)hdr->idx_blk_elmts) < 0) + if((hdr->cparam.cls->fill)(iblock->elmts, (size_t)hdr->cparam.idx_blk_elmts) < 0) H5E_THROW(H5E_CANTSET, "can't set extensible array index block elements to class's fill value") } /* end if */ @@ -431,7 +431,7 @@ H5EA__iblock_dest(H5F_t *f, H5EA_iblock_t *iblock)) iblock->hdr->f = f; /* Check if we've got elements in the index block */ - if(iblock->hdr->idx_blk_elmts > 0) { + if(iblock->hdr->cparam.idx_blk_elmts > 0) { /* Free buffer for index block elements */ HDassert(iblock->elmts); (void)H5FL_BLK_FREE(idx_blk_elmt_buf, iblock->elmts); diff --git a/src/H5EApkg.h b/src/H5EApkg.h index 72264cd..ca920ec 100644 --- a/src/H5EApkg.h +++ b/src/H5EApkg.h @@ -386,7 +386,7 @@ func_init_failed: \ H5EA_METADATA_PREFIX_SIZE(TRUE) \ \ /* Extensible Array Index Block specific fields */ \ - + ((size_t)(i)->hdr->idx_blk_elmts * (size_t)(i)->hdr->raw_elmt_size) /* Elements in index block */ \ + + ((size_t)(i)->hdr->cparam.idx_blk_elmts * (size_t)(i)->hdr->cparam.raw_elmt_size) /* Elements in index block */ \ + ((i)->ndblk_addrs * (i)->hdr->sizeof_addr) /* Data block addresses in index block */ \ + ((i)->nsblk_addrs * (i)->hdr->sizeof_addr) /* Super block addresses in index block */ \ ) @@ -397,7 +397,7 @@ func_init_failed: \ H5EA_METADATA_PREFIX_SIZE(TRUE) \ \ /* Extensible Array Data Block specific fields */ \ - + ((d)->nelmts * (size_t)(d)->hdr->raw_elmt_size) /* Elements in index block */ \ + + ((d)->nelmts * (size_t)(d)->hdr->cparam.raw_elmt_size) /* Elements in index block */ \ ) @@ -422,11 +422,7 @@ typedef struct H5EA_hdr_t { H5AC_info_t cache_info; /* Extensible array configuration/creation parameters (stored) */ - uint8_t raw_elmt_size; /* Element size in file (in bytes) */ - uint8_t max_nelmts_bits; /* Log2(Max. # of elements in array) - i.e. # of bits needed to store max. # of elements */ - uint8_t idx_blk_elmts; /* # of elements to store in index block */ - uint8_t data_blk_min_elmts; /* Min. # of elements per data block */ - uint8_t sup_blk_min_data_ptrs; /* Min. # of data block pointers for a super block */ + H5EA_create_t cparam; /* Creation parameters for extensible array */ /* Index block information (stored in header) */ haddr_t idx_blk_addr; /* Address of index block in header */ @@ -453,9 +449,6 @@ typedef struct H5EA_hdr_t { /* Super block information (not stored) */ size_t nsblks; /* Number of superblocks needed for array */ H5EA_sblk_info_t *sblk_info; /* Array of information for each super block */ - - /* Memory data structures (not stored directly) */ - const H5EA_class_t *cls; /* Pointer to class for array */ } H5EA_hdr_t; /* The extensible array index block information */ diff --git a/src/H5EAtest.c b/src/H5EAtest.c index 00e6e64..25b33dd 100644 --- a/src/H5EAtest.c +++ b/src/H5EAtest.c @@ -262,11 +262,11 @@ H5EA_get_cparam_test(const H5EA_t *ea, H5EA_create_t *cparam)) HDassert(cparam); /* Get extensible array creation parameters */ - cparam->raw_elmt_size = ea->hdr->raw_elmt_size; - cparam->max_nelmts_bits = ea->hdr->max_nelmts_bits; - cparam->idx_blk_elmts = ea->hdr->idx_blk_elmts; - cparam->sup_blk_min_data_ptrs = ea->hdr->sup_blk_min_data_ptrs; - cparam->data_blk_min_elmts = ea->hdr->data_blk_min_elmts; + cparam->raw_elmt_size = ea->hdr->cparam.raw_elmt_size; + cparam->max_nelmts_bits = ea->hdr->cparam.max_nelmts_bits; + cparam->idx_blk_elmts = ea->hdr->cparam.idx_blk_elmts; + cparam->sup_blk_min_data_ptrs = ea->hdr->cparam.sup_blk_min_data_ptrs; + cparam->data_blk_min_elmts = ea->hdr->cparam.data_blk_min_elmts; END_FUNC(PRIV) /* end H5EA_get_cparam_test() */ |