summaryrefslogtreecommitdiffstats
path: root/src/H5FDspace.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2009-09-11 13:27:04 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2009-09-11 13:27:04 (GMT)
commit258d4b38353286ff4066e40048ff90332e7befbe (patch)
treec865c96e436096a35f47c774ebc6599ae7c4006e /src/H5FDspace.c
parent0b3fbf90899f97a7817779c106e171b89f19a042 (diff)
downloadhdf5-258d4b38353286ff4066e40048ff90332e7befbe.zip
hdf5-258d4b38353286ff4066e40048ff90332e7befbe.tar.gz
hdf5-258d4b38353286ff4066e40048ff90332e7befbe.tar.bz2
[svn-r17464] Description:
Bring r17463 from trunk to 1.8 branch: Add another regression test for userblock+alignment usage, and correct [another] issue with the combination. *sigh* Tested on: FreeBSD/32 6.3 (duty) in debug mode (h5committested on trunk)
Diffstat (limited to 'src/H5FDspace.c')
-rw-r--r--src/H5FDspace.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/H5FDspace.c b/src/H5FDspace.c
index 19f9281..9895938 100644
--- a/src/H5FDspace.c
+++ b/src/H5FDspace.c
@@ -126,6 +126,7 @@ H5FD_space_init_interface(void)
static haddr_t
H5FD_extend(H5FD_t *file, H5FD_mem_t type, hbool_t new_block, hsize_t size, haddr_t *frag_addr, hsize_t *frag_size)
{
+ hsize_t orig_size = size; /* Original allocation size */
haddr_t eoa; /* Address of end-of-allocated space */
hsize_t extra; /* Extra space to allocate, to align request */
haddr_t ret_value; /* Return value */
@@ -143,7 +144,7 @@ H5FD_extend(H5FD_t *file, H5FD_mem_t type, hbool_t new_block, hsize_t size, hadd
/* Compute extra space to allocate, if this is a new block and should be aligned */
extra = 0;
- if(new_block && file->alignment > 1 && size >= file->threshold) {
+ if(new_block && file->alignment > 1 && orig_size >= file->threshold) {
hsize_t mis_align; /* Amount EOA is misaligned */
/* Check for EOA already aligned */
@@ -171,6 +172,10 @@ H5FD_extend(H5FD_t *file, H5FD_mem_t type, hbool_t new_block, hsize_t size, hadd
if(file->cls->set_eoa(file, type, eoa) < 0)
HGOTO_ERROR(H5E_VFL, H5E_NOSPACE, HADDR_UNDEF, "file allocation request failed")
+ /* Post-condition sanity check */
+ if(new_block && file->alignment && orig_size >= file->threshold)
+ HDassert(!(ret_value % file->alignment));
+
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5FD_extend() */