summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/H5Abtree2.c51
-rw-r--r--src/H5B2private.h3
-rw-r--r--src/H5B2test.c27
-rw-r--r--src/H5C.c8
-rw-r--r--src/H5F.c1
-rw-r--r--src/H5FD.c30
-rw-r--r--src/H5FDprivate.h1
-rw-r--r--src/H5FDspace.c15
-rw-r--r--src/H5Fdbg.c1
-rw-r--r--src/H5Fpkg.h1
-rw-r--r--src/H5Fsuper.c32
-rw-r--r--src/H5Fsuper_cache.c70
-rw-r--r--src/H5Gbtree2.c52
-rw-r--r--src/H5HFbtree2.c104
-rw-r--r--src/H5MFaggr.c58
-rw-r--r--src/H5Pfcpl.c37
-rwxr-xr-xsrc/H5SMbtree2.c30
-rw-r--r--src/H5Z.c22
-rw-r--r--src/H5public.h4
-rw-r--r--src/Makefile.in2
20 files changed, 168 insertions, 381 deletions
diff --git a/src/H5Abtree2.c b/src/H5Abtree2.c
index da4ad86..a0035b3 100644
--- a/src/H5Abtree2.c
+++ b/src/H5Abtree2.c
@@ -80,7 +80,6 @@ typedef struct H5A_fh_ud_cmp_t {
/* v2 B-tree driver callbacks for 'creation order' index */
static herr_t H5A_dense_btree2_corder_store(void *native, const void *udata);
-static herr_t H5A_dense_btree2_corder_retrieve(void *udata, const void *native);
static herr_t H5A_dense_btree2_corder_compare(const void *rec1, const void *rec2);
static herr_t H5A_dense_btree2_corder_encode(const H5F_t *f, uint8_t *raw,
const void *native);
@@ -112,7 +111,6 @@ const H5B2_class_t H5A_BT2_NAME[1]={{ /* B-tree class information */
H5B2_ATTR_DENSE_NAME_ID, /* Type of B-tree */
sizeof(H5A_dense_bt2_name_rec_t), /* Size of native record */
H5A_dense_btree2_name_store, /* Record storage callback */
- H5A_dense_btree2_name_retrieve, /* Record retrieval callback */
H5A_dense_btree2_name_compare, /* Record comparison callback */
H5A_dense_btree2_name_encode, /* Record encoding callback */
H5A_dense_btree2_name_decode, /* Record decoding callback */
@@ -124,7 +122,6 @@ const H5B2_class_t H5A_BT2_CORDER[1]={{ /* B-tree class information */
H5B2_ATTR_DENSE_CORDER_ID, /* Type of B-tree */
sizeof(H5A_dense_bt2_corder_rec_t),/* Size of native record */
H5A_dense_btree2_corder_store, /* Record storage callback */
- H5A_dense_btree2_corder_retrieve, /* Record retrieval callback */
H5A_dense_btree2_corder_compare, /* Record comparison callback */
H5A_dense_btree2_corder_encode, /* Record encoding callback */
H5A_dense_btree2_corder_decode, /* Record decoding callback */
@@ -229,30 +226,6 @@ H5A_dense_btree2_name_store(void *_nrecord, const void *_udata)
/*-------------------------------------------------------------------------
- * Function: H5A_dense_btree2_name_retrieve
- *
- * Purpose: Retrieve native information from record for v2 B-tree
- *
- * Return: Success: non-negative
- * Failure: negative
- *
- * Programmer: Quincey Koziol
- * Monday, December 4, 2006
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5A_dense_btree2_name_retrieve(void *udata, const void *nrecord)
-{
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5A_dense_btree2_name_retrieve)
-
- *(H5A_dense_bt2_name_rec_t *)udata = *(const H5A_dense_bt2_name_rec_t *)nrecord;
-
- FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5A_dense_btree2_name_retrieve() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5A_dense_btree2_name_compare
*
* Purpose: Compare two native information records, according to some key
@@ -443,30 +416,6 @@ H5A_dense_btree2_corder_store(void *_nrecord, const void *_udata)
/*-------------------------------------------------------------------------
- * Function: H5A_dense_btree2_corder_retrieve
- *
- * Purpose: Retrieve native information from record for v2 B-tree
- *
- * Return: Success: non-negative
- * Failure: negative
- *
- * Programmer: Quincey Koziol
- * Tuesday, February 6, 2007
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5A_dense_btree2_corder_retrieve(void *udata, const void *nrecord)
-{
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5A_dense_btree2_corder_retrieve)
-
- *(H5A_dense_bt2_corder_rec_t *)udata = *(const H5A_dense_bt2_corder_rec_t *)nrecord;
-
- FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5A_dense_btree2_corder_retrieve() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5A_dense_btree2_corder_compare
*
* Purpose: Compare two native information records, according to some key
diff --git a/src/H5B2private.h b/src/H5B2private.h
index 0a18604..0a516d2 100644
--- a/src/H5B2private.h
+++ b/src/H5B2private.h
@@ -84,9 +84,8 @@ struct H5B2_class_t {
H5B2_subid_t id; /* ID of B-tree class, as found in file */
size_t nrec_size; /* Size of native (memory) record */
- /* Store & retrieve record from application to B-tree 'native' form */
+ /* Store record from application to B-tree 'native' form */
herr_t (*store)(void *nrecord, const void *udata); /* Store record in native record table */
- herr_t (*retrieve)(void *udata, const void *nrecord); /* Retrieve record in native record table */
/* Compare records, according to a key */
herr_t (*compare)(const void *rec1, const void *rec2); /* Compare two native records */
diff --git a/src/H5B2test.c b/src/H5B2test.c
index 46cd510..3fa5d27 100644
--- a/src/H5B2test.c
+++ b/src/H5B2test.c
@@ -53,7 +53,6 @@
/* Local Prototypes */
/********************/
static herr_t H5B2_test_store(void *nrecord, const void *udata);
-static herr_t H5B2_test_retrieve(void *udata, const void *nrecord);
static herr_t H5B2_test_compare(const void *rec1, const void *rec2);
static herr_t H5B2_test_encode(const H5F_t *f, uint8_t *raw,
const void *nrecord);
@@ -69,7 +68,6 @@ const H5B2_class_t H5B2_TEST[1]={{ /* B-tree class information */
H5B2_TEST_ID, /* Type of B-tree */
sizeof(hsize_t), /* Size of native record */
H5B2_test_store, /* Record storage callback */
- H5B2_test_retrieve, /* Record retrieval callback */
H5B2_test_compare, /* Record comparison callback */
H5B2_test_encode, /* Record encoding callback */
H5B2_test_decode, /* Record decoding callback */
@@ -112,31 +110,6 @@ H5B2_test_store(void *nrecord, const void *udata)
/*-------------------------------------------------------------------------
- * Function: H5B2_test_retrieve
- *
- * Purpose: Retrieve native information from record for B-tree
- *
- * Return: Success: non-negative
- *
- * Failure: negative
- *
- * Programmer: Quincey Koziol
- * Friday, February 25, 2005
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5B2_test_retrieve(void *udata, const void *nrecord)
-{
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5B2_test_retrieve)
-
- *(hsize_t *)udata = *(const hsize_t *)nrecord;
-
- FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5B2_test_retrieve() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5B2_test_compare
*
* Purpose: Compare two native information records, according to some key
diff --git a/src/H5C.c b/src/H5C.c
index b90f963..7fc651b 100644
--- a/src/H5C.c
+++ b/src/H5C.c
@@ -6211,7 +6211,7 @@ H5C_protect(H5F_t * f,
/* Check for trying to load the wrong type of entry from an address */
if(entry_ptr->type != type)
- HGOTO_ERROR(H5E_CACHE, H5E_BADTYPE, NULL, "not a dataset creation property list")
+ HGOTO_ERROR(H5E_CACHE, H5E_BADTYPE, NULL, "incorrect cache entry type")
hit = TRUE;
thing = (void *)entry_ptr;
@@ -10716,7 +10716,7 @@ end_of_inner_loop:
*/
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, \
- "Can't unpin all pinned entries 1.")
+ "Pinned entry count not decreasing.")
} else if ( ( cur_pel_len == 0 ) && ( old_pel_len == 0 ) ) {
@@ -10759,7 +10759,7 @@ end_of_inner_loop:
} else if ( cur_pel_len > 0 ) {
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, \
- "Can't unpin all pinned entries 2.")
+ "Can't unpin all pinned entries.")
}
@@ -10994,7 +10994,7 @@ H5C_flush_single_entry(H5F_t * f,
if ( NULL == (dxpl = H5I_object(primary_dxpl_id)) ) {
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, \
- "not a dataset creation property list")
+ "not a dataset transfer property list")
}
/* Get the transfer mode property */
diff --git a/src/H5F.c b/src/H5F.c
index 3978154..6d16e73 100644
--- a/src/H5F.c
+++ b/src/H5F.c
@@ -867,7 +867,6 @@ H5F_new(H5F_file_t *shared, hid_t fcpl_id, hid_t fapl_id, H5FD_t *lf)
if(NULL == (f->shared = H5FL_CALLOC(H5F_file_t)))
HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, NULL, "can't allocate shared file structure")
- f->shared->super_addr = HADDR_UNDEF;
f->shared->sohm_addr = HADDR_UNDEF;
f->shared->sohm_vers = HDF5_SHAREDHEADER_VERSION;
for(u = 0; u < NELMTS(f->shared->fs_addr); u++)
diff --git a/src/H5FD.c b/src/H5FD.c
index 8de2a1a..8a0e230 100644
--- a/src/H5FD.c
+++ b/src/H5FD.c
@@ -2088,3 +2088,33 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5FD_set_base_addr() */
+
+/*--------------------------------------------------------------------------
+ * Function: H5FD_get_base_addr
+ *
+ * Purpose: Get the base address for the file
+ *
+ * Return: Success: The absolute base address of the file
+ * Failure: The undefined address (HADDR_UNDEF)
+ *
+ * Programmer: Quincey Koziol
+ * Sept. 10, 2009
+ *
+ *--------------------------------------------------------------------------
+ */
+haddr_t
+H5FD_get_base_addr(const H5FD_t *file)
+{
+ haddr_t ret_value; /* Return value */
+
+ FUNC_ENTER_NOAPI(H5FD_get_base_addr, HADDR_UNDEF)
+
+ HDassert(file);
+
+ /* Return the file's base address */
+ ret_value = file->base_addr;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FD_get_base_addr() */
+
diff --git a/src/H5FDprivate.h b/src/H5FDprivate.h
index fc38566..cb40e5c 100644
--- a/src/H5FDprivate.h
+++ b/src/H5FDprivate.h
@@ -77,6 +77,7 @@ H5_DLL herr_t H5FD_truncate(H5FD_t *file, hid_t dxpl_id, hbool_t closing);
H5_DLL herr_t H5FD_get_fileno(const H5FD_t *file, unsigned long *filenum);
H5_DLL herr_t H5FD_get_vfd_handle(H5FD_t *file, hid_t fapl, void** file_handle);
H5_DLL herr_t H5FD_set_base_addr(H5FD_t *file, haddr_t base_addr);
+H5_DLL haddr_t H5FD_get_base_addr(const H5FD_t *file);
#endif /* !_H5FDprivate_H */
diff --git a/src/H5FDspace.c b/src/H5FDspace.c
index 5526b03..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,15 +144,17 @@ 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 */
if((mis_align = (eoa % file->alignment)) > 0) {
extra = file->alignment - mis_align;
- if (frag_addr) *frag_addr = eoa;
- if (frag_size) *frag_size = extra;
- }
+ if(frag_addr)
+ *frag_addr = eoa - file->base_addr; /* adjust for file's base address */
+ if(frag_size)
+ *frag_size = extra;
+ } /* end if */
} /* end if */
/* Add in extra allocation amount */
@@ -169,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() */
diff --git a/src/H5Fdbg.c b/src/H5Fdbg.c
index 5f14357..2b13f11 100644
--- a/src/H5Fdbg.c
+++ b/src/H5Fdbg.c
@@ -60,7 +60,6 @@ H5F_debug(H5F_t *f, FILE *stream, int indent, int fwidth)
HDassert(stream);
HDassert(indent >= 0);
HDassert(fwidth >= 0);
- HDassert(f->shared->super_addr != HADDR_UNDEF);
/* Get property list */
if(NULL == (plist = (H5P_genplist_t *)H5I_object(f->shared->fcpl_id)))
diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h
index 5fdde37..15946d4 100644
--- a/src/H5Fpkg.h
+++ b/src/H5Fpkg.h
@@ -192,7 +192,6 @@ typedef struct H5F_super_t {
typedef struct H5F_file_t {
H5FD_t *lf; /* Lower level file handle for I/O */
H5F_super_t *sblock; /* Pointer to (pinned) superblock for file */
- haddr_t super_addr; /* Address of superblock signature */
unsigned nrefs; /* Ref count for times file is opened */
unsigned flags; /* Access Permissions for file */
H5F_mtab_t mtab; /* File mount table */
diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c
index 3be8069..e85c980 100644
--- a/src/H5Fsuper.c
+++ b/src/H5Fsuper.c
@@ -293,6 +293,7 @@ H5F_super_read(H5F_t *f, hid_t dxpl_id)
{
H5F_super_t * sblock = NULL; /* superblock structure */
unsigned sblock_flags = H5AC__NO_FLAGS_SET; /* flags used in superblock unprotect call */
+ haddr_t super_addr; /* Absolute address of superblock */
H5AC_protect_t rw; /* read/write permissions for file */
hbool_t dirtied = FALSE; /* Bool for sblock protect call */
herr_t ret_value = SUCCEED; /* return value */
@@ -300,9 +301,16 @@ H5F_super_read(H5F_t *f, hid_t dxpl_id)
FUNC_ENTER_NOAPI(H5F_super_read, FAIL)
/* Find the superblock */
- if(HADDR_UNDEF == (f->shared->super_addr = H5F_locate_signature(f->shared->lf, dxpl_id)))
+ if(HADDR_UNDEF == (super_addr = H5F_locate_signature(f->shared->lf, dxpl_id)))
HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, FAIL, "unable to find file signature")
+ /* Check for userblock present */
+ if(H5F_addr_gt(super_addr, 0)) {
+ /* Set the base address for the file in the VFD now */
+ if(H5FD_set_base_addr(f->shared->lf, super_addr) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "failed to set base address for file driver")
+ } /* end if */
+
/* Determine file intent for superblock protect */
if(H5F_INTENT(f) & H5F_ACC_RDWR)
rw = H5AC_WRITE;
@@ -310,7 +318,7 @@ H5F_super_read(H5F_t *f, hid_t dxpl_id)
rw = H5AC_READ;
/* Look up the superblock */
- if(NULL == (sblock = (H5F_super_t *)H5AC_protect(f, dxpl_id, H5AC_SUPERBLOCK, f->shared->super_addr, NULL, &dirtied, rw)))
+ if(NULL == (sblock = (H5F_super_t *)H5AC_protect(f, dxpl_id, H5AC_SUPERBLOCK, (haddr_t)0, NULL, &dirtied, rw)))
HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, FAIL, "unable to load superblock")
/* Mark the superblock dirty if it was modified during loading or VFD indicated to do so */
@@ -326,7 +334,7 @@ H5F_super_read(H5F_t *f, hid_t dxpl_id)
done:
/* Release the superblock */
- if(sblock && H5AC_unprotect(f, dxpl_id, H5AC_SUPERBLOCK, f->shared->super_addr, sblock, sblock_flags) < 0)
+ if(sblock && H5AC_unprotect(f, dxpl_id, H5AC_SUPERBLOCK, (haddr_t)0, sblock, sblock_flags) < 0)
HDONE_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "unable to close superblock")
FUNC_LEAVE_NOAPI(ret_value)
@@ -359,7 +367,6 @@ H5F_super_init(H5F_t *f, hid_t dxpl_id)
hsize_t superblock_size; /* Size of superblock, in bytes */
size_t driver_size; /* Size of driver info block (bytes) */
unsigned super_vers = HDF5_SUPERBLOCK_VERSION_DEF; /* Superblock version for file */
- haddr_t super_addr; /* Address of superblock */
hbool_t need_ext; /* Whether the superblock extension is needed */
herr_t ret_value = SUCCEED; /* Return Value */
@@ -419,6 +426,14 @@ H5F_super_init(H5F_t *f, hid_t dxpl_id)
if(H5P_get(plist, H5F_CRT_USER_BLOCK_NAME, &userblock_size) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get userblock size")
+ /* Sanity check the userblock size vs. the file's allocation alignment */
+ if(userblock_size > 0) {
+ if(userblock_size < f->shared->alignment)
+ HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "userblock size must be > file object alignment")
+ if(0 != (userblock_size % f->shared->alignment))
+ HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "userblock size must be an integral multiple of file object alignment")
+ } /* end if */
+
sblock->base_addr = userblock_size;
sblock->status_flags = 0;
@@ -463,17 +478,13 @@ H5F_super_init(H5F_t *f, hid_t dxpl_id)
if(H5FD_set_eoa(f->shared->lf, H5FD_MEM_SUPER, superblock_size) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to set EOA value for superblock")
- /* Set the superblock's address, it must be immediately after any userblock */
- super_addr = (haddr_t)0;
-
/* Insert superblock into cache, pinned */
- if(H5AC_set(f, dxpl_id, H5AC_SUPERBLOCK, super_addr, sblock, H5AC__PIN_ENTRY_FLAG) < 0)
+ if(H5AC_set(f, dxpl_id, H5AC_SUPERBLOCK, (haddr_t)0, sblock, H5AC__PIN_ENTRY_FLAG) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTINS, FAIL, "can't add superblock to cache")
sblock_in_cache = TRUE;
/* Keep a copy of the superblock info */
f->shared->sblock = sblock;
- f->shared->super_addr = super_addr;
/*
* Determine if we will need a superblock extension
@@ -577,7 +588,7 @@ done:
HDONE_ERROR(H5E_FILE, H5E_CANTUNPIN, FAIL, "unable to unpin superblock")
/* Evict the superblock from the cache */
- if(H5AC_expunge_entry(f, dxpl_id, H5AC_SUPERBLOCK, super_addr, H5AC__NO_FLAGS_SET) < 0)
+ if(H5AC_expunge_entry(f, dxpl_id, H5AC_SUPERBLOCK, (haddr_t)0, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_FILE, H5E_CANTEXPUNGE, FAIL, "unable to expunge superblock")
} /* end if */
else
@@ -586,7 +597,6 @@ done:
/* Reset variables in file structure */
f->shared->sblock = NULL;
- f->shared->super_addr = HADDR_UNDEF;
} /* end if */
} /* end if */
diff --git a/src/H5Fsuper_cache.c b/src/H5Fsuper_cache.c
index 240ac9f..14454ef 100644
--- a/src/H5Fsuper_cache.c
+++ b/src/H5Fsuper_cache.c
@@ -111,9 +111,10 @@ H5FL_EXTERN(H5F_super_t);
*-------------------------------------------------------------------------
*/
static H5F_super_t *
-H5F_sblock_load(H5F_t *f, hid_t dxpl_id, haddr_t UNUSED addr, const void UNUSED *udata1, void *udata2/*out*/)
+H5F_sblock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *udata1, void *udata2/*out*/)
{
H5F_super_t *sblock = NULL; /* File's superblock */
+ haddr_t base_addr = HADDR_UNDEF; /* Base address of file */
uint8_t sbuf[H5F_MAX_SUPERBLOCK_SIZE]; /* Buffer for superblock */
H5P_genplist_t *c_plist; /* File creation property list */
H5F_file_t *shared; /* shared part of `file' */
@@ -131,6 +132,10 @@ H5F_sblock_load(H5F_t *f, hid_t dxpl_id, haddr_t UNUSED addr, const void UNUSED
FUNC_ENTER_NOAPI_NOINIT(H5F_sblock_load)
+ /* check arguments */
+ HDassert(f);
+ HDassert(H5F_addr_eq(addr, 0));
+
/* Short cuts */
shared = f->shared;
lf = shared->lf;
@@ -139,15 +144,19 @@ H5F_sblock_load(H5F_t *f, hid_t dxpl_id, haddr_t UNUSED addr, const void UNUSED
if(NULL == (c_plist = (H5P_genplist_t *)H5I_object(shared->fcpl_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "can't get property list")
+ /* Get the base address for the file in the VFD */
+ if(HADDR_UNDEF == (base_addr = H5FD_get_base_addr(lf)))
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "failed to get base address for file driver")
+
/* Allocate space for the superblock */
if(NULL == (sblock = H5FL_CALLOC(H5F_super_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Read fixed-size portion of the superblock */
p = sbuf;
- if(H5FD_set_eoa(lf, H5FD_MEM_SUPER, f->shared->super_addr + fixed_size) < 0)
+ if(H5FD_set_eoa(lf, H5FD_MEM_SUPER, fixed_size) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "set end of space allocation request failed")
- if(H5FD_read(lf, dxpl_id, H5FD_MEM_SUPER, f->shared->super_addr, fixed_size, p) < 0)
+ if(H5FD_read(lf, dxpl_id, H5FD_MEM_SUPER, (haddr_t)0, fixed_size, p) < 0)
HGOTO_ERROR(H5E_FILE, H5E_READERROR, NULL, "unable to read superblock")
/* Skip over signature (already checked when locating the superblock) */
@@ -172,10 +181,11 @@ H5F_sblock_load(H5F_t *f, hid_t dxpl_id, haddr_t UNUSED addr, const void UNUSED
HDassert(fixed_size + variable_size <= sizeof(sbuf));
/* Read in variable-sized portion of superblock */
- if(H5FD_set_eoa(lf, H5FD_MEM_SUPER, f->shared->super_addr + fixed_size + variable_size) < 0)
+ if(H5FD_set_eoa(lf, H5FD_MEM_SUPER, fixed_size + variable_size) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "set end of space allocation request failed")
- if(H5FD_read(lf, dxpl_id, H5FD_MEM_SUPER, f->shared->super_addr + fixed_size, variable_size, p) < 0)
+ if(H5FD_read(lf, dxpl_id, H5FD_MEM_SUPER, (haddr_t)fixed_size, variable_size, p) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to read superblock")
+
/* Check for older version of superblock format */
if(super_vers < HDF5_SUPERBLOCK_VERSION_2) {
uint32_t status_flags; /* File status flags */
@@ -284,22 +294,24 @@ H5F_sblock_load(H5F_t *f, hid_t dxpl_id, haddr_t UNUSED addr, const void UNUSED
* Check if superblock address is different from base address and
* adjust base address and "end of address" address if so.
*/
- if(!H5F_addr_eq(f->shared->super_addr, sblock->base_addr)) {
+ if(!H5F_addr_eq(base_addr, sblock->base_addr)) {
/* Check if the superblock moved earlier in the file */
- if(H5F_addr_lt(f->shared->super_addr, sblock->base_addr))
- stored_eoa -= (sblock->base_addr - f->shared->super_addr);
+ if(H5F_addr_lt(base_addr, sblock->base_addr))
+ stored_eoa -= (sblock->base_addr - base_addr);
else
/* The superblock moved later in the file */
- stored_eoa += (f->shared->super_addr - sblock->base_addr);
+ stored_eoa += (base_addr - sblock->base_addr);
- sblock->base_addr = f->shared->super_addr;
- } /* end if */
+ /* Adjust base address for offsets of the HDF5 data in the file */
+ sblock->base_addr = base_addr;
- /* Set the base address for the file in the VFD now, after adjusting
- * space for possible offsets of the HDF5 data in the file.
- */
- if(H5FD_set_base_addr(lf, sblock->base_addr) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "failed to set base address for file driver")
+ /* Set the base address for the file in the VFD now */
+ if(H5FD_set_base_addr(lf, sblock->base_addr) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, NULL, "failed to set base address for file driver")
+
+ /* Indicate that the superblock should be marked dirty */
+ *dirtied = TRUE;
+ } /* end if */
/* This step is for h5repart tool only. If user wants to change file driver
* from family to sec2 while using h5repart, set the driver address to
@@ -412,22 +424,24 @@ H5F_sblock_load(H5F_t *f, hid_t dxpl_id, haddr_t UNUSED addr, const void UNUSED
* Check if superblock address is different from base address and
* adjust base address and "end of address" address if so.
*/
- if(!H5F_addr_eq(f->shared->super_addr, sblock->base_addr)) {
+ if(!H5F_addr_eq(base_addr, sblock->base_addr)) {
/* Check if the superblock moved earlier in the file */
- if(H5F_addr_lt(f->shared->super_addr, sblock->base_addr))
- stored_eoa -= (sblock->base_addr - f->shared->super_addr);
+ if(H5F_addr_lt(base_addr, sblock->base_addr))
+ stored_eoa -= (sblock->base_addr - base_addr);
else
/* The superblock moved later in the file */
- stored_eoa += (f->shared->super_addr - sblock->base_addr);
+ stored_eoa += (base_addr - sblock->base_addr);
- sblock->base_addr = f->shared->super_addr;
- } /* end if */
+ /* Adjust base address for offsets of the HDF5 data in the file */
+ sblock->base_addr = base_addr;
- /* Set the base address for the file in the VFD now, after adjusting
- * space for possible offsets of the HDF5 data in the file.
- */
- if(H5FD_set_base_addr(lf, sblock->base_addr) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "failed to set base address for file driver")
+ /* Set the base address for the file in the VFD now */
+ if(H5FD_set_base_addr(lf, sblock->base_addr) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, NULL, "failed to set base address for file driver")
+
+ /* Indicate that the superblock should be marked dirty */
+ *dirtied = TRUE;
+ } /* end if */
/* Get the B-tree internal node values, etc */
if(H5P_get(c_plist, H5F_CRT_BTREE_RANK_NAME, sblock->btree_k) < 0)
@@ -587,6 +601,7 @@ H5F_sblock_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5F_sup
/* check arguments */
HDassert(f);
+ HDassert(H5F_addr_eq(addr, 0));
HDassert(sblock);
if(sblock->cache_info.is_dirty) {
@@ -729,7 +744,6 @@ H5F_sblock_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5F_sup
H5O_drvinfo_t drvinfo; /* Driver info */
H5O_loc_t ext_loc; /* "Object location" for superblock extension */
uint8_t dbuf[H5F_MAX_DRVINFOBLOCK_SIZE]; /* Driver info block encoding buffer */
- htri_t status; /* Indicate whether the message exists or not */
/* Sanity check */
HDassert(driver_size <= H5F_MAX_DRVINFOBLOCK_SIZE);
diff --git a/src/H5Gbtree2.c b/src/H5Gbtree2.c
index 9afd882..5f7ad23 100644
--- a/src/H5Gbtree2.c
+++ b/src/H5Gbtree2.c
@@ -78,7 +78,6 @@ typedef struct H5G_fh_ud_cmp_t {
/* v2 B-tree driver callbacks for 'creation order' index */
static herr_t H5G_dense_btree2_corder_store(void *native, const void *udata);
-static herr_t H5G_dense_btree2_corder_retrieve(void *udata, const void *native);
static herr_t H5G_dense_btree2_corder_compare(const void *rec1, const void *rec2);
static herr_t H5G_dense_btree2_corder_encode(const H5F_t *f, uint8_t *raw,
const void *native);
@@ -89,7 +88,6 @@ static herr_t H5G_dense_btree2_corder_debug(FILE *stream, const H5F_t *f, hid_t
/* v2 B-tree driver callbacks for 'name' index */
static herr_t H5G_dense_btree2_name_store(void *native, const void *udata);
-static herr_t H5G_dense_btree2_name_retrieve(void *udata, const void *native);
static herr_t H5G_dense_btree2_name_compare(const void *rec1, const void *rec2);
static herr_t H5G_dense_btree2_name_encode(const H5F_t *f, uint8_t *raw,
const void *native);
@@ -110,7 +108,6 @@ const H5B2_class_t H5G_BT2_NAME[1]={{ /* B-tree class information */
H5B2_GRP_DENSE_NAME_ID, /* Type of B-tree */
sizeof(H5G_dense_bt2_name_rec_t), /* Size of native record */
H5G_dense_btree2_name_store, /* Record storage callback */
- H5G_dense_btree2_name_retrieve, /* Record retrieval callback */
H5G_dense_btree2_name_compare, /* Record comparison callback */
H5G_dense_btree2_name_encode, /* Record encoding callback */
H5G_dense_btree2_name_decode, /* Record decoding callback */
@@ -122,7 +119,6 @@ const H5B2_class_t H5G_BT2_CORDER[1]={{ /* B-tree class information */
H5B2_GRP_DENSE_CORDER_ID, /* Type of B-tree */
sizeof(H5G_dense_bt2_corder_rec_t), /* Size of native record */
H5G_dense_btree2_corder_store, /* Record storage callback */
- H5G_dense_btree2_corder_retrieve, /* Record retrieval callback */
H5G_dense_btree2_corder_compare, /* Record comparison callback */
H5G_dense_btree2_corder_encode, /* Record encoding callback */
H5G_dense_btree2_corder_decode, /* Record decoding callback */
@@ -214,30 +210,6 @@ H5G_dense_btree2_name_store(void *_nrecord, const void *_udata)
/*-------------------------------------------------------------------------
- * Function: H5G_dense_btree2_name_retrieve
- *
- * Purpose: Retrieve native information from record for v2 B-tree
- *
- * Return: Success: non-negative
- * Failure: negative
- *
- * Programmer: Quincey Koziol
- * Monday, September 11, 2006
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5G_dense_btree2_name_retrieve(void *udata, const void *nrecord)
-{
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5G_dense_btree2_name_retrieve)
-
- *(H5G_dense_bt2_name_rec_t *)udata = *(const H5G_dense_bt2_name_rec_t *)nrecord;
-
- FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5G_dense_btree2_name_retrieve() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5G_dense_btree2_name_compare
*
* Purpose: Compare two native information records, according to some key
@@ -428,30 +400,6 @@ H5G_dense_btree2_corder_store(void *_nrecord, const void *_udata)
/*-------------------------------------------------------------------------
- * Function: H5G_dense_btree2_corder_retrieve
- *
- * Purpose: Retrieve native information from record for v2 B-tree
- *
- * Return: Success: non-negative
- * Failure: negative
- *
- * Programmer: Quincey Koziol
- * Monday, October 30, 2006
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5G_dense_btree2_corder_retrieve(void *udata, const void *nrecord)
-{
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5G_dense_btree2_corder_retrieve)
-
- *(H5G_dense_bt2_corder_rec_t *)udata = *(const H5G_dense_bt2_corder_rec_t *)nrecord;
-
- FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5G_dense_btree2_corder_retrieve() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5G_dense_btree2_corder_compare
*
* Purpose: Compare two native information records, according to some key
diff --git a/src/H5HFbtree2.c b/src/H5HFbtree2.c
index b750822..5958c03 100644
--- a/src/H5HFbtree2.c
+++ b/src/H5HFbtree2.c
@@ -61,7 +61,6 @@
/* v2 B-tree driver callbacks */
static herr_t H5HF_huge_btree2_indir_store(void *native, const void *udata);
-static herr_t H5HF_huge_btree2_indir_retrieve(void *udata, const void *native);
static herr_t H5HF_huge_btree2_indir_compare(const void *rec1, const void *rec2);
static herr_t H5HF_huge_btree2_indir_encode(const H5F_t *f, uint8_t *raw,
const void *native);
@@ -71,7 +70,6 @@ static herr_t H5HF_huge_btree2_indir_debug(FILE *stream, const H5F_t *f, hid_t d
int indent, int fwidth, const void *record, const void *_udata);
static herr_t H5HF_huge_btree2_filt_indir_store(void *native, const void *udata);
-static herr_t H5HF_huge_btree2_filt_indir_retrieve(void *udata, const void *native);
static herr_t H5HF_huge_btree2_filt_indir_compare(const void *rec1, const void *rec2);
static herr_t H5HF_huge_btree2_filt_indir_encode(const H5F_t *f, uint8_t *raw,
const void *native);
@@ -81,7 +79,6 @@ static herr_t H5HF_huge_btree2_filt_indir_debug(FILE *stream, const H5F_t *f, hi
int indent, int fwidth, const void *record, const void *_udata);
static herr_t H5HF_huge_btree2_dir_store(void *native, const void *udata);
-static herr_t H5HF_huge_btree2_dir_retrieve(void *udata, const void *native);
static herr_t H5HF_huge_btree2_dir_compare(const void *rec1, const void *rec2);
static herr_t H5HF_huge_btree2_dir_encode(const H5F_t *f, uint8_t *raw,
const void *native);
@@ -91,7 +88,6 @@ static herr_t H5HF_huge_btree2_dir_debug(FILE *stream, const H5F_t *f, hid_t dxp
int indent, int fwidth, const void *record, const void *_udata);
static herr_t H5HF_huge_btree2_filt_dir_store(void *native, const void *udata);
-static herr_t H5HF_huge_btree2_filt_dir_retrieve(void *udata, const void *native);
static herr_t H5HF_huge_btree2_filt_dir_compare(const void *rec1, const void *rec2);
static herr_t H5HF_huge_btree2_filt_dir_encode(const H5F_t *f, uint8_t *raw,
const void *native);
@@ -108,7 +104,6 @@ const H5B2_class_t H5HF_BT2_INDIR[1]={{ /* B-tree class information */
H5B2_FHEAP_HUGE_INDIR_ID, /* Type of B-tree */
sizeof(H5HF_huge_bt2_indir_rec_t), /* Size of native record */
H5HF_huge_btree2_indir_store, /* Record storage callback */
- H5HF_huge_btree2_indir_retrieve, /* Record retrieval callback */
H5HF_huge_btree2_indir_compare, /* Record comparison callback */
H5HF_huge_btree2_indir_encode, /* Record encoding callback */
H5HF_huge_btree2_indir_decode, /* Record decoding callback */
@@ -120,7 +115,6 @@ const H5B2_class_t H5HF_BT2_FILT_INDIR[1]={{ /* B-tree class information */
H5B2_FHEAP_HUGE_FILT_INDIR_ID, /* Type of B-tree */
sizeof(H5HF_huge_bt2_filt_indir_rec_t), /* Size of native record */
H5HF_huge_btree2_filt_indir_store, /* Record storage callback */
- H5HF_huge_btree2_filt_indir_retrieve, /* Record retrieval callback */
H5HF_huge_btree2_filt_indir_compare, /* Record comparison callback */
H5HF_huge_btree2_filt_indir_encode, /* Record encoding callback */
H5HF_huge_btree2_filt_indir_decode, /* Record decoding callback */
@@ -132,7 +126,6 @@ const H5B2_class_t H5HF_BT2_DIR[1]={{ /* B-tree class information */
H5B2_FHEAP_HUGE_DIR_ID, /* Type of B-tree */
sizeof(H5HF_huge_bt2_dir_rec_t), /* Size of native record */
H5HF_huge_btree2_dir_store, /* Record storage callback */
- H5HF_huge_btree2_dir_retrieve, /* Record retrieval callback */
H5HF_huge_btree2_dir_compare, /* Record comparison callback */
H5HF_huge_btree2_dir_encode, /* Record encoding callback */
H5HF_huge_btree2_dir_decode, /* Record decoding callback */
@@ -144,7 +137,6 @@ const H5B2_class_t H5HF_BT2_FILT_DIR[1]={{ /* B-tree class information */
H5B2_FHEAP_HUGE_FILT_DIR_ID, /* Type of B-tree */
sizeof(H5HF_huge_bt2_filt_dir_rec_t),/* Size of native record */
H5HF_huge_btree2_filt_dir_store, /* Record storage callback */
- H5HF_huge_btree2_filt_dir_retrieve, /* Record retrieval callback */
H5HF_huge_btree2_filt_dir_compare, /* Record comparison callback */
H5HF_huge_btree2_filt_dir_encode, /* Record encoding callback */
H5HF_huge_btree2_filt_dir_decode, /* Record decoding callback */
@@ -251,30 +243,6 @@ H5HF_huge_btree2_indir_store(void *nrecord, const void *udata)
/*-------------------------------------------------------------------------
- * Function: H5HF_huge_btree2_indir_retrieve
- *
- * Purpose: Retrieve native information from record for v2 B-tree
- *
- * Return: Success: non-negative
- * Failure: negative
- *
- * Programmer: Quincey Koziol
- * Monday, August 7, 2006
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5HF_huge_btree2_indir_retrieve(void *udata, const void *nrecord)
-{
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HF_huge_btree2_indir_retrieve)
-
- *(H5HF_huge_bt2_indir_rec_t *)udata = *(const H5HF_huge_bt2_indir_rec_t *)nrecord;
-
- FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5HF_huge_btree2_indir_retrieve() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5HF_huge_btree2_indir_compare
*
* Purpose: Compare two native information records, according to some key
@@ -485,30 +453,6 @@ H5HF_huge_btree2_filt_indir_store(void *nrecord, const void *udata)
/*-------------------------------------------------------------------------
- * Function: H5HF_huge_btree2_filt_indir_retrieve
- *
- * Purpose: Retrieve native information from record for v2 B-tree
- *
- * Return: Success: non-negative
- * Failure: negative
- *
- * Programmer: Quincey Koziol
- * Monday, August 7, 2006
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5HF_huge_btree2_filt_indir_retrieve(void *udata, const void *nrecord)
-{
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HF_huge_btree2_filt_indir_retrieve)
-
- *(H5HF_huge_bt2_filt_indir_rec_t *)udata = *(const H5HF_huge_bt2_filt_indir_rec_t *)nrecord;
-
- FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5HF_huge_btree2_filt_indir_retrieve() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5HF_huge_btree2_filt_indir_compare
*
* Purpose: Compare two native information records, according to some key
@@ -690,30 +634,6 @@ H5HF_huge_btree2_dir_store(void *nrecord, const void *udata)
/*-------------------------------------------------------------------------
- * Function: H5HF_huge_btree2_dir_retrieve
- *
- * Purpose: Retrieve native information from record for v2 B-tree
- *
- * Return: Success: non-negative
- * Failure: negative
- *
- * Programmer: Quincey Koziol
- * Monday, August 7, 2006
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5HF_huge_btree2_dir_retrieve(void *udata, const void *nrecord)
-{
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HF_huge_btree2_dir_retrieve)
-
- *(H5HF_huge_bt2_dir_rec_t *)udata = *(const H5HF_huge_bt2_dir_rec_t *)nrecord;
-
- FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5HF_huge_btree2_dir_retrieve() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5HF_huge_btree2_dir_compare
*
* Purpose: Compare two native information records, according to some key
@@ -931,30 +851,6 @@ H5HF_huge_btree2_filt_dir_store(void *nrecord, const void *udata)
/*-------------------------------------------------------------------------
- * Function: H5HF_huge_btree2_filt_dir_retrieve
- *
- * Purpose: Retrieve native information from record for v2 B-tree
- *
- * Return: Success: non-negative
- * Failure: negative
- *
- * Programmer: Quincey Koziol
- * Tuesday, August 15, 2006
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5HF_huge_btree2_filt_dir_retrieve(void *udata, const void *nrecord)
-{
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HF_huge_btree2_filt_dir_retrieve)
-
- *(H5HF_huge_bt2_filt_dir_rec_t *)udata = *(const H5HF_huge_bt2_filt_dir_rec_t *)nrecord;
-
- FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5HF_huge_btree2_filt_dir_retrieve() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5HF_huge_btree2_filt_dir_compare
*
* Purpose: Compare two native information records, according to some key
diff --git a/src/H5MFaggr.c b/src/H5MFaggr.c
index 1435d18..aa982da 100644
--- a/src/H5MFaggr.c
+++ b/src/H5MFaggr.c
@@ -152,11 +152,9 @@ 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)
{
- 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; /* Initial EOA for the file */
- H5FD_mem_t alloc_type, other_alloc_type;
+ haddr_t eoa_frag_addr = HADDR_UNDEF; /* Address of fragment at EOA */
+ hsize_t eoa_frag_size = 0; /* Size of fragment at EOA */
+ haddr_t eoa = HADDR_UNDEF; /* Initial EOA for the file */
haddr_t ret_value; /* Return value */
FUNC_ENTER_NOAPI(H5MF_aggr_alloc, HADDR_UNDEF)
@@ -174,6 +172,7 @@ HDfprintf(stderr, "%s: type = %u, size = %Hu\n", FUNC, (unsigned)type, size);
HDassert(type >= H5FD_MEM_DEFAULT && type < H5FD_MEM_NTYPES);
HDassert(size > 0);
+ /* Get the EOA for the file */
if(HADDR_UNDEF == (eoa = H5F_get_eoa(f, type)))
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, HADDR_UNDEF, "Unable to get eoa")
@@ -183,29 +182,37 @@ HDfprintf(stderr, "%s: type = %u, size = %Hu\n", FUNC, (unsigned)type, size);
* through H5FD_alloc()
*/
if(f->shared->feature_flags & aggr->feature_flag) {
+ haddr_t aggr_frag_addr = HADDR_UNDEF; /* Address of aggregrator fragment */
+ hsize_t aggr_frag_size = 0; /* Size of aggregator fragment */
+ hsize_t alignment; /* Alignment of this section */
+ hsize_t aggr_mis_align = 0; /* Mis-alignment of aggregator */
+ H5FD_mem_t alloc_type, other_alloc_type;/* Current aggregator & 'other' aggregator types */
+
#ifdef H5MF_AGGR_DEBUG
HDfprintf(stderr, "%s: aggr = {%a, %Hu, %Hu}\n", FUNC, aggr->addr, aggr->tot_size, aggr->size);
#endif /* H5MF_AGGR_DEBUG */
+ /* Turn off alignment if allocation < threshold */
alignment = f->shared->alignment;
if(!((alignment > 1) && (size >= f->shared->threshold)))
alignment = 0; /* no alignment */
- if(alignment && aggr->addr > 0 && aggr->size > 0 && (mis_align = aggr->addr % alignment)) {
- frag_addr = aggr->addr;
- frag_size = alignment - mis_align;
+ /* Generate fragment if aggregator is mis-aligned */
+ if(alignment && aggr->addr > 0 && aggr->size > 0 && (aggr_mis_align = (aggr->addr + H5FD_get_base_addr(f->shared->lf)) % alignment)) {
+ aggr_frag_addr = aggr->addr;
+ aggr_frag_size = alignment - aggr_mis_align;
} /* end if */
alloc_type = aggr->feature_flag == H5FD_FEAT_AGGREGATE_METADATA ? H5FD_MEM_DEFAULT : H5FD_MEM_DRAW;
other_alloc_type = other_aggr->feature_flag == H5FD_FEAT_AGGREGATE_METADATA ? H5FD_MEM_DEFAULT : H5FD_MEM_DRAW;
/* Check if the space requested is larger than the space left in the block */
- if((size + frag_size) > aggr->size) {
+ if((size + aggr_frag_size) > aggr->size) {
htri_t extended = FALSE; /* Whether the file was extended */
/* Check if the block asked for is too large for 'normal' aggregator block */
if(size >= aggr->alloc_size) {
- hsize_t ext_size = size + frag_size;
+ hsize_t ext_size = size + aggr_frag_size;
/* Check for overlapping into file's temporary allocation space */
if(H5F_addr_gt((aggr->addr + aggr->size + ext_size), f->shared->tmp_addr))
@@ -215,7 +222,7 @@ HDfprintf(stderr, "%s: aggr = {%a, %Hu, %Hu}\n", FUNC, aggr->addr, aggr->tot_siz
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, HADDR_UNDEF, "can't extending space")
else if (extended) {
/* aggr->size is unchanged */
- ret_value = aggr->addr + frag_size;
+ ret_value = aggr->addr + aggr_frag_size;
aggr->addr += ext_size;
aggr->tot_size += ext_size;
} else {
@@ -247,8 +254,8 @@ HDfprintf(stderr, "%s: aggr = {%a, %Hu, %Hu}\n", FUNC, aggr->addr, aggr->tot_siz
HDfprintf(stderr, "%s: Allocating block\n", FUNC);
#endif /* H5MF_AGGR_DEBUG */
- if(frag_size > (ext_size - size))
- ext_size += (frag_size - (ext_size - size));
+ if(aggr_frag_size > (ext_size - size))
+ ext_size += (aggr_frag_size - (ext_size - size));
/* Check for overlapping into file's temporary allocation space */
if(H5F_addr_gt((aggr->addr + aggr->size + ext_size), f->shared->tmp_addr))
@@ -257,8 +264,8 @@ HDfprintf(stderr, "%s: Allocating block\n", FUNC);
if((aggr->addr > 0) && (extended = H5FD_try_extend(f->shared->lf, alloc_type, f, aggr->addr + aggr->size, ext_size)) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, HADDR_UNDEF, "can't extending space")
else if (extended) {
- aggr->addr += frag_size;
- aggr->size += (ext_size - frag_size);
+ aggr->addr += aggr_frag_size;
+ aggr->size += (ext_size - aggr_frag_size);
aggr->tot_size += ext_size;
} else {
haddr_t new_space; /* Address of new space allocated */
@@ -304,19 +311,19 @@ HDfprintf(stderr, "%s: Allocating block\n", FUNC);
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, HADDR_UNDEF, "can't free eoa fragment")
/* 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)
+ if(extended && aggr_frag_size)
+ if(H5MF_xfree(f, type, dxpl_id, aggr_frag_addr, aggr_frag_size) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, HADDR_UNDEF, "can't free aggregation fragment")
} /* end if */
else {
/* Allocate space out of the block */
- ret_value = aggr->addr + frag_size;
- aggr->size -= (size + frag_size);
- aggr->addr += (size + frag_size);
+ ret_value = aggr->addr + aggr_frag_size;
+ aggr->size -= (size + aggr_frag_size);
+ aggr->addr += (size + aggr_frag_size);
/* free any possible fragment */
- if (frag_size)
- if(H5MF_xfree(f, type, dxpl_id, frag_addr, frag_size) < 0)
+ if(aggr_frag_size)
+ if(H5MF_xfree(f, type, dxpl_id, aggr_frag_addr, aggr_frag_size) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, HADDR_UNDEF, "can't free aggregation fragment")
} /* end else */
} /* end if */
@@ -339,13 +346,14 @@ HDfprintf(stderr, "%s: Allocating block\n", FUNC);
/* Sanity check for overlapping into file's temporary allocation space */
HDassert(H5F_addr_le((ret_value + size), f->shared->tmp_addr));
+ /* Post-condition sanity check */
+ if(f->shared->alignment && size >= f->shared->threshold)
+ HDassert(!((ret_value + H5FD_get_base_addr(f->shared->lf)) % f->shared->alignment));
+
done:
#ifdef H5MF_AGGR_DEBUG
HDfprintf(stderr, "%s: ret_value = %a\n", FUNC, ret_value);
#endif /* H5MF_AGGR_DEBUG */
-
- if(alignment)
- HDassert(!(ret_value % alignment));
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5MF_aggr_alloc() */
diff --git a/src/H5Pfcpl.c b/src/H5Pfcpl.c
index 4d576c6..406dbe1 100644
--- a/src/H5Pfcpl.c
+++ b/src/H5Pfcpl.c
@@ -261,44 +261,39 @@ done:
* Programmer: Robb Matzke
* Tuesday, January 6, 1998
*
- * Modifications:
- *
- * Raymond Lu, Oct 14, 2001
- * Changed to the new generic property list.
- *
*-------------------------------------------------------------------------
*/
herr_t
H5Pset_userblock(hid_t plist_id, hsize_t size)
{
- unsigned i;
H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value=SUCCEED; /* return value */
+ herr_t ret_value = SUCCEED; /* return value */
- FUNC_ENTER_API(H5Pset_userblock, FAIL);
+ FUNC_ENTER_API(H5Pset_userblock, FAIL)
H5TRACE2("e", "ih", plist_id, size);
- /* Check that the userblock size is a power of two */
- for (i=8; i<8*sizeof(hsize_t); i++) {
- hsize_t p2 = 8==i ? 0 : ((hsize_t)1<<i);
+ /* Sanity check non-zero userblock sizes */
+ if(size > 0) {
+ /* Check that the userblock size is >=512 */
+ if(size < 512)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "userblock size is non-zero and less than 512")
- if (size == p2)
- break;
- }
- if (i>=8*sizeof(hsize_t))
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "userblock size is not valid");
+ /* Check that the userblock size is a power of two */
+ if(!POWER_OF_TWO(size))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "userblock size is non-zero and not a power of two")
+ } /* end if */
/* Get the plist structure */
- if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+ if(NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_CREATE)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
/* Set value */
if(H5P_set(plist, H5F_CRT_USER_BLOCK_NAME, &size) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set user block");
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set user block")
done:
- FUNC_LEAVE_API(ret_value);
-}
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Pset_userblock() */
/*-------------------------------------------------------------------------
diff --git a/src/H5SMbtree2.c b/src/H5SMbtree2.c
index 8863287..3ddd3f2 100755
--- a/src/H5SMbtree2.c
+++ b/src/H5SMbtree2.c
@@ -53,7 +53,6 @@ typedef struct H5SM_compare_udata_t {
/* v2 B-tree callbacks */
static herr_t H5SM_btree_compare_cb(const void *obj, size_t obj_len, void *_udata);
static herr_t H5SM_btree_store(void *native, const void *udata);
-static herr_t H5SM_btree_retrieve(void *udata, const void *native);
static herr_t H5SM_btree_debug(FILE *stream, const H5F_t *f, hid_t dxpl_id,
int indent, int fwidth, const void *record, const void *_udata);
@@ -66,7 +65,6 @@ const H5B2_class_t H5SM_INDEX[1]={{ /* B-tree class information */
H5B2_SOHM_INDEX_ID, /* Type of B-tree */
sizeof(H5SM_sohm_t), /* Size of native record */
H5SM_btree_store, /* Record storage callback */
- H5SM_btree_retrieve, /* Record retrieval callback */
H5SM_message_compare, /* Record comparison callback */
H5SM_message_encode, /* Record encoding callback */
H5SM_message_decode, /* Record decoding callback */
@@ -309,34 +307,6 @@ H5SM_btree_store(void *native, const void *udata)
/*-------------------------------------------------------------------------
- * Function: H5SM_btree_retrieve
- *
- * Purpose: Retrieve a H5SM_sohm_t SOHM message from the B-tree by
- * copying it from NATIVE to UDATA.
- *
- * Quincey said this function may no longer be used.
- *
- * Return: Non-negative on success
- * Negative on failure
- *
- * Programmer: James Laird
- * Monday, November 6, 2006
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5SM_btree_retrieve(void *udata, const void *native)
-{
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5SM_btree_retrieve)
-
- /* Copy the B-tree's native message to the udata buffer */
- *(H5SM_sohm_t *)udata = *(const H5SM_sohm_t *)native;
-
- FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5SM_btree_retrieve */
-
-
-/*-------------------------------------------------------------------------
* Function: H5SM_btree_debug
*
* Purpose: Print debugging information for a H5SM_sohm_t.
diff --git a/src/H5Z.c b/src/H5Z.c
index 1c58ab0..dc1ad80 100644
--- a/src/H5Z.c
+++ b/src/H5Z.c
@@ -497,7 +497,8 @@ done:
static herr_t
H5Z_prelude_callback(hid_t dcpl_id, hid_t type_id, H5Z_prelude_type_t prelude_type)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ hid_t space_id = -1; /* ID for dataspace describing chunk */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5Z_prelude_callback)
@@ -529,7 +530,6 @@ H5Z_prelude_callback(hid_t dcpl_id, hid_t type_id, H5Z_prelude_type_t prelude_ty
if(dcpl_pline.nused > 0) {
hsize_t chunk_dims[H5O_LAYOUT_NDIMS]; /* Size of chunk dimensions */
H5S_t *space; /* Dataspace describing chunk */
- hid_t space_id; /* ID for dataspace describing chunk */
size_t u; /* Local index variable */
/* Create a data space for a chunk & set the extent */
@@ -572,10 +572,6 @@ H5Z_prelude_callback(hid_t dcpl_id, hid_t type_id, H5Z_prelude_type_t prelude_ty
/* Check return value */
if(status <= 0) {
- /* We're leaving, so close dataspace */
- if(H5I_dec_ref(space_id, FALSE) < 0)
- HGOTO_ERROR(H5E_PLINE, H5E_CANTRELEASE, FAIL, "unable to close dataspace")
-
/* Indicate filter can't apply to this combination of parameters */
if(status == 0)
HGOTO_ERROR(H5E_PLINE, H5E_CANAPPLY, FAIL, "filter parameters not appropriate")
@@ -590,14 +586,9 @@ H5Z_prelude_callback(hid_t dcpl_id, hid_t type_id, H5Z_prelude_type_t prelude_ty
/* Check if there is a "set local" callback */
if(fclass->set_local) {
/* Make callback to filter's "set local" function */
- if((fclass->set_local)(dcpl_id, type_id, space_id)<0) {
- /* We're leaving, so close dataspace */
- if(H5I_dec_ref(space_id, FALSE)<0)
- HGOTO_ERROR (H5E_PLINE, H5E_CANTRELEASE, FAIL, "unable to close dataspace")
-
+ if((fclass->set_local)(dcpl_id, type_id, space_id) < 0)
/* Indicate error during filter callback */
HGOTO_ERROR(H5E_PLINE, H5E_SETLOCAL, FAIL, "error during user callback")
- } /* end if */
} /* end if */
break;
@@ -606,15 +597,14 @@ H5Z_prelude_callback(hid_t dcpl_id, hid_t type_id, H5Z_prelude_type_t prelude_ty
} /* end switch */
} /* end else */
} /* end for */
-
- /* Close dataspace */
- if(H5I_dec_ref(space_id, FALSE) < 0)
- HGOTO_ERROR (H5E_PLINE, H5E_CANTRELEASE, FAIL, "unable to close dataspace")
} /* end if */
} /* end if */
} /* end if */
done:
+ if(space_id > 0 && H5I_dec_ref(space_id, FALSE) < 0)
+ HDONE_ERROR(H5E_PLINE, H5E_CANTRELEASE, FAIL, "unable to close dataspace")
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5Z_prelude_callback() */
diff --git a/src/H5public.h b/src/H5public.h
index fddb903..61698d7 100644
--- a/src/H5public.h
+++ b/src/H5public.h
@@ -71,10 +71,10 @@ extern "C" {
/* Version numbers */
#define H5_VERS_MAJOR 1 /* For major interface/format changes */
#define H5_VERS_MINOR 9 /* For minor interface/format changes */
-#define H5_VERS_RELEASE 45 /* For tweaks, bug-fixes, or development */
+#define H5_VERS_RELEASE 46 /* For tweaks, bug-fixes, or development */
#define H5_VERS_SUBRELEASE "FA_a3" /* For pre-releases like snap0 */
/* Empty string for real releases. */
-#define H5_VERS_INFO "HDF5 library version: 1.9.45-FA_a3" /* Full version string */
+#define H5_VERS_INFO "HDF5 library version: 1.9.46-FA_a3" /* Full version string */
#define H5check() H5check_version(H5_VERS_MAJOR,H5_VERS_MINOR, \
H5_VERS_RELEASE)
diff --git a/src/Makefile.in b/src/Makefile.in
index 96bd804..9c3cc5f 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -433,7 +433,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog
# Add libtool shared library version numbers to the HDF5 library
# See libtool versioning documentation online.
LT_VERS_INTERFACE = 6
-LT_VERS_REVISION = 35
+LT_VERS_REVISION = 36
LT_VERS_AGE = 0
H5detect_CFLAGS = -g