summaryrefslogtreecommitdiffstats
path: root/src/H5MFaggr.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2009-08-13 17:09:55 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2009-08-13 17:09:55 (GMT)
commit7bcb57d5786db186cb683c2e1ef198dce68b41fa (patch)
treead0dccd3f67d4a2df12884d4f3ed56a33022b8b5 /src/H5MFaggr.c
parentaa13114bb834aaa847302223cc07d582a1ee259a (diff)
downloadhdf5-7bcb57d5786db186cb683c2e1ef198dce68b41fa.zip
hdf5-7bcb57d5786db186cb683c2e1ef198dce68b41fa.tar.gz
hdf5-7bcb57d5786db186cb683c2e1ef198dce68b41fa.tar.bz2
[svn-r17351] Description:
Clean up code (to align w/future sblock_mdc branch changes), tweak tests for [slightly] easier debugging, fix memory leak when copying chunked datasets with I/O filters, fix memory leak of free space section when it was exactly the right size to use for extending an existing block in the file. Tested on: 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/H5MFaggr.c')
-rw-r--r--src/H5MFaggr.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/H5MFaggr.c b/src/H5MFaggr.c
index 0526ef2..616d705 100644
--- a/src/H5MFaggr.c
+++ b/src/H5MFaggr.c
@@ -152,13 +152,13 @@ haddr_t
H5MF_aggr_alloc(H5F_t *f, hid_t dxpl_id, H5F_blk_aggr_t *aggr,
H5F_blk_aggr_t *other_aggr, H5FD_mem_t type, hsize_t size)
{
- haddr_t ret_value;
hsize_t alignment = 0, mis_align = 0;
haddr_t frag_addr = 0, eoa_frag_addr = 0;
hsize_t frag_size = 0, eoa_frag_size = 0;
haddr_t eoa = 0, new_space = 0;
htri_t extended = 0;
H5FD_mem_t alloc_type, other_alloc_type;
+ haddr_t ret_value; /* Return value */
FUNC_ENTER_NOAPI(H5MF_aggr_alloc, HADDR_UNDEF)
#ifdef H5MF_AGGR_DEBUG
@@ -234,6 +234,7 @@ HDfprintf(stderr, "%s: aggr = {%a, %Hu, %Hu}\n", FUNC, aggr->addr, aggr->tot_siz
other_aggr->size = 0;
} /* end if */
+ /* Allocate space from the VFD (i.e. at the end of the file) */
if(HADDR_UNDEF == (new_space = H5FD_alloc(f->shared->lf, dxpl_id, type, size, &eoa_frag_addr, &eoa_frag_size)))
HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, HADDR_UNDEF, "can't allocate aggregation block")
@@ -277,6 +278,7 @@ HDfprintf(stderr, "%s: Allocating block\n", FUNC);
other_aggr->size = 0;
} /* end if */
+ /* Allocate space from the VFD (i.e. at the end of the file) */
if(HADDR_UNDEF == (new_space = H5FD_alloc(f->shared->lf, dxpl_id, alloc_type, aggr->alloc_size, &eoa_frag_addr, &eoa_frag_size)))
HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, HADDR_UNDEF, "can't allocate aggregation block")
@@ -297,12 +299,12 @@ HDfprintf(stderr, "%s: Allocating block\n", FUNC);
aggr->addr += size;
} /* end else */
- /* freeing any possible fragment due to file allocation */
+ /* Freeing any possible fragment due to file allocation */
if(eoa_frag_size)
if(H5MF_xfree(f, type, dxpl_id, eoa_frag_addr, eoa_frag_size) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, HADDR_UNDEF, "can't free eoa fragment")
- /* freeing any possible fragment due to alignment in the block after extension */
+ /* Freeing any possible fragment due to alignment in the block after extension */
if(extended && frag_size)
if(H5MF_xfree(f, type, dxpl_id, frag_addr, frag_size) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, HADDR_UNDEF, "can't free aggregation fragment")
@@ -327,7 +329,9 @@ HDfprintf(stderr, "%s: Allocating block\n", FUNC);
/* Allocate data from the file */
if(HADDR_UNDEF == (ret_value = H5FD_alloc(f->shared->lf, dxpl_id, type, size, &eoa_frag_addr, &eoa_frag_size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, HADDR_UNDEF, "can't allocate file space")
+ /* Check if fragment was generated */
if(eoa_frag_size)
+ /* Put fragment on the free list */
if(H5MF_xfree(f, type, dxpl_id, eoa_frag_addr, eoa_frag_size) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, HADDR_UNDEF, "can't free eoa fragment")
} /* end else */
@@ -339,7 +343,7 @@ done:
#ifdef H5MF_AGGR_DEBUG
HDfprintf(stderr, "%s: ret_value = %a\n", FUNC, ret_value);
#endif /* H5MF_AGGR_DEBUG */
- if (alignment)
+ if(alignment)
HDassert(!(ret_value % alignment));
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5MF_aggr_alloc() */