summaryrefslogtreecommitdiffstats
path: root/src/H5EAiblock.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2008-11-28 19:16:24 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2008-11-28 19:16:24 (GMT)
commite8e2f47703cfc9427ceea7bfe9e9c0da815053d8 (patch)
treebc941c3f47976ff45e593d044ad591d0cb541eb1 /src/H5EAiblock.c
parentbd3e89868ad3b4f3c3a45a089675fa4b8250d21f (diff)
downloadhdf5-e8e2f47703cfc9427ceea7bfe9e9c0da815053d8.zip
hdf5-e8e2f47703cfc9427ceea7bfe9e9c0da815053d8.tar.gz
hdf5-e8e2f47703cfc9427ceea7bfe9e9c0da815053d8.tar.bz2
[svn-r16137] Description:
Add support for paging large data blocks to extensible arrays Clean up allocation/destroy code for extensible array index, super and data blocks Add a couple of routines to set/get bit values in memory buffers Tested on: Mac OS X/32 10.5.5 (amazon) in debug mode Mac OS X/32 10.5.5 (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 (jam) 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/H5EAiblock.c')
-rw-r--r--src/H5EAiblock.c62
1 files changed, 34 insertions, 28 deletions
diff --git a/src/H5EAiblock.c b/src/H5EAiblock.c
index 823e8b0..dcb75d1 100644
--- a/src/H5EAiblock.c
+++ b/src/H5EAiblock.c
@@ -119,6 +119,11 @@ H5EA__iblock_alloc(H5EA_hdr_t *hdr))
if(NULL == (iblock = H5FL_CALLOC(H5EA_iblock_t)))
H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array index block")
+ /* Share common array information */
+ if(H5EA__hdr_incr(hdr) < 0)
+ H5E_THROW(H5E_CANTINC, "can't increment reference count on shared array header")
+ iblock->hdr = hdr;
+
/* Set non-zero internal fields */
iblock->addr = HADDR_UNDEF;
@@ -147,11 +152,6 @@ HDfprintf(stderr, "%s: iblock->nsblk_addrs = %Zu\n", FUNC, iblock->nsblk_addrs);
if(NULL == (iblock->sblk_addrs = H5FL_SEQ_MALLOC(haddr_t, iblock->nsblk_addrs)))
H5E_THROW(H5E_CANTALLOC, "memory allocation failed for index block super block addresses")
- /* Share common array information */
- iblock->hdr = hdr;
- if(H5EA__hdr_incr(hdr) < 0)
- H5E_THROW(H5E_CANTINC, "can't increment reference count on shared array header")
-
/* Set the return value */
ret_value = iblock;
@@ -425,33 +425,39 @@ H5EA__iblock_dest(H5F_t *f, H5EA_iblock_t *iblock))
HDassert(iblock);
HDassert(iblock->rc == 0);
- /* Set the shared array header's file context for this operation */
- iblock->hdr->f = f;
+ /* Check if shared header field has been initialized */
+ if(iblock->hdr) {
+ /* Set the shared array header's file context for this operation */
+ iblock->hdr->f = f;
- /* Check if we've got elements in the index block */
- 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);
- } /* end if */
+ /* Check if we've got elements in the index block */
+ if(iblock->elmts) {
+ /* Free buffer for index block elements */
+ HDassert(iblock->hdr->cparam.idx_blk_elmts > 0);
+ iblock->elmts = H5FL_BLK_FREE(idx_blk_elmt_buf, iblock->elmts);
+ } /* end if */
- /* Check if we've got data block addresses in the index block */
- if(iblock->ndblk_addrs > 0) {
- /* Free buffer for index block data block addresses */
- HDassert(iblock->dblk_addrs);
- (void)H5FL_SEQ_FREE(haddr_t, iblock->dblk_addrs);
- } /* end if */
+ /* Check if we've got data block addresses in the index block */
+ if(iblock->dblk_addrs) {
+ /* Free buffer for index block data block addresses */
+ HDassert(iblock->ndblk_addrs > 0);
+ iblock->dblk_addrs = H5FL_SEQ_FREE(haddr_t, iblock->dblk_addrs);
+ iblock->ndblk_addrs = 0;
+ } /* end if */
- /* Check if we've got super block addresses in the index block */
- if(iblock->nsblk_addrs > 0) {
- /* Free buffer for index block super block addresses */
- HDassert(iblock->sblk_addrs);
- (void)H5FL_SEQ_FREE(haddr_t, iblock->sblk_addrs);
- } /* end if */
+ /* Check if we've got super block addresses in the index block */
+ if(iblock->sblk_addrs) {
+ /* Free buffer for index block super block addresses */
+ HDassert(iblock->nsblk_addrs > 0);
+ iblock->sblk_addrs = H5FL_SEQ_FREE(haddr_t, iblock->sblk_addrs);
+ iblock->nsblk_addrs = 0;
+ } /* end if */
- /* Decrement reference count on shared info */
- if(H5EA__hdr_decr(iblock->hdr) < 0)
- H5E_THROW(H5E_CANTDEC, "can't decrement reference count on shared array header")
+ /* Decrement reference count on shared info */
+ if(H5EA__hdr_decr(iblock->hdr) < 0)
+ H5E_THROW(H5E_CANTDEC, "can't decrement reference count on shared array header")
+ iblock->hdr = NULL;
+ } /* end if */
/* Free the index block itself */
(void)H5FL_FREE(H5EA_iblock_t, iblock);