summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2011-08-18 22:56:54 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2011-08-18 22:56:54 (GMT)
commitb4c2be19afc2095b73a3c3f1fc37932cc08335db (patch)
tree8af860cfb1ed2b58d65be4a63644390cfee703b7 /src
parent3e48f9be0067b9df317d000aa83e6ad8ed6f583a (diff)
downloadhdf5-b4c2be19afc2095b73a3c3f1fc37932cc08335db.zip
hdf5-b4c2be19afc2095b73a3c3f1fc37932cc08335db.tar.gz
hdf5-b4c2be19afc2095b73a3c3f1fc37932cc08335db.tar.bz2
[svn-r21261] Description:
Synchronize metadata journaling branch with changes from trunk. Tested on: Mac OS X/32 10.6.8 (amazon) (h5committest not required on this branch)
Diffstat (limited to 'src')
-rw-r--r--src/H5AC.c293
-rw-r--r--src/H5B2cache.c6
-rw-r--r--src/H5B2int.c8
-rw-r--r--src/H5Bcache.c5
-rw-r--r--src/H5C.c388
-rw-r--r--src/H5Cprivate.h22
-rw-r--r--src/H5F.c8
-rw-r--r--src/H5FScache.c6
-rw-r--r--src/H5Gnode.c6
-rw-r--r--src/H5HFcache.c74
-rw-r--r--src/H5HFdbg.c2
-rw-r--r--src/H5HFdblock.c1
-rw-r--r--src/H5HFhdr.c7
-rw-r--r--src/H5HFman.c5
-rw-r--r--src/H5HFpkg.h84
-rwxr-xr-xsrc/H5HGcache.c4
-rw-r--r--src/H5HLcache.c41
-rw-r--r--src/H5L.c2
-rw-r--r--src/H5Ocache.c74
-rw-r--r--src/H5Pfapl.c8
-rw-r--r--src/H5SMcache.c8
21 files changed, 371 insertions, 681 deletions
diff --git a/src/H5AC.c b/src/H5AC.c
index a173d8d..7980749 100644
--- a/src/H5AC.c
+++ b/src/H5AC.c
@@ -166,9 +166,9 @@ static herr_t H5AC_propagate_flushed_and_still_clean_entries_list(H5F_t * f,
H5AC_t * cache_ptr,
hbool_t do_barrier);
-static herr_t H5AC_receive_and_apply_clean_list(H5F_t * f,
- hid_t dxpl_id,
- H5AC_t * cache_ptr);
+static herr_t H5AC_receive_and_apply_clean_list(H5F_t * f,
+ hid_t dxpl_id,
+ H5AC_t * cache_ptr);
static herr_t H5AC_log_moved_entry(const H5F_t * f,
haddr_t old_addr,
@@ -425,8 +425,6 @@ herr_t
H5AC_create(const H5F_t *f,
H5AC_cache_config_t *config_ptr)
{
- herr_t ret_value = SUCCEED; /* Return value */
- herr_t result;
#ifdef H5_HAVE_PARALLEL
char prefix[H5C__PREFIX_LEN] = "";
MPI_Comm mpi_comm = MPI_COMM_NULL;
@@ -434,6 +432,7 @@ H5AC_create(const H5F_t *f,
int mpi_size = -1;
H5AC_aux_t * aux_ptr = NULL;
#endif /* H5_HAVE_PARALLEL */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5AC_create, FAIL)
@@ -443,13 +442,6 @@ H5AC_create(const H5F_t *f,
HDcompile_assert(NELMTS(H5AC_entry_type_names) == H5AC_NTYPES);
HDcompile_assert(H5C__MAX_NUM_TYPE_IDS == H5AC_NTYPES);
- result = H5AC_validate_config(config_ptr);
-
- if ( result != SUCCEED ) {
-
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Bad cache configuration");
- }
-
#ifdef H5_HAVE_PARALLEL
if ( IS_H5FD_MPI(f) ) {
@@ -595,24 +587,13 @@ H5AC_create(const H5F_t *f,
}
#ifdef H5_HAVE_PARALLEL
else if ( aux_ptr != NULL ) {
-
- result = H5C_set_prefix(f->shared->cache, prefix);
-
- if ( result != SUCCEED ) {
-
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, \
- "H5C_set_prefix() failed")
- }
+ if(H5C_set_prefix(f->shared->cache, prefix) < 0)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "H5C_set_prefix() failed")
}
#endif /* H5_HAVE_PARALLEL */
- result = H5AC_set_cache_config(f->shared->cache, config_ptr);
-
- if ( result != SUCCEED ) {
-
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, \
- "auto resize configuration failed")
- }
+ if(H5AC_set_cache_config(f->shared->cache, config_ptr) < 0)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "auto resize configuration failed")
done:
@@ -1564,7 +1545,6 @@ herr_t
H5AC_insert_entry(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr,
void *thing, unsigned int flags)
{
- herr_t result;
#ifdef H5_HAVE_PARALLEL
H5AC_aux_t * aux_ptr = NULL;
#endif /* H5_HAVE_PARALLEL */
@@ -2678,75 +2658,48 @@ herr_t
H5AC_set_cache_auto_resize_config(H5AC_t *cache_ptr,
H5AC_cache_config_t *config_ptr)
{
- herr_t result;
- herr_t ret_value = SUCCEED; /* Return value */
#if H5AC__TRACE_FILE_ENABLED
H5AC_cache_config_t trace_config = H5AC__DEFAULT_CACHE_CONFIG;
FILE * trace_file_ptr = NULL;
#endif /* H5AC__TRACE_FILE_ENABLED */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5AC_set_cache_auto_resize_config, FAIL)
- HDassert( cache_ptr );
+ HDassert(cache_ptr);
#if H5AC__TRACE_FILE_ENABLED
/* Make note of the new configuration. Don't look up the trace file
* pointer, as that may change before we use it.
*/
- if ( config_ptr != NULL ) {
-
+ if(config_ptr != NULL)
trace_config = *config_ptr;
-
- }
#endif /* H5AC__TRACE_FILE_ENABLED */
- if ( ( cache_ptr == NULL )
+ if((cache_ptr == NULL)
#ifdef H5_HAVE_PARALLEL
||
- ( ( cache_ptr->aux_ptr != NULL )
- &&
- (
- ((H5AC_aux_t *)(cache_ptr->aux_ptr))->magic
- !=
- H5AC__H5AC_AUX_T_MAGIC
- )
- )
+ ((cache_ptr->aux_ptr != NULL) &&
+ (((H5AC_aux_t *)(cache_ptr->aux_ptr))->magic != H5AC__H5AC_AUX_T_MAGIC))
#endif /* H5_HAVE_PARALLEL */
- ) {
-
+ )
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "bad cache_ptr on entry.")
- }
-
- result = H5AC_validate_config(config_ptr);
-
- if ( result != SUCCEED ) {
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Bad cache configuration");
- }
-
-
- result = H5AC_set_cache_config(cache_ptr, config_ptr);
-
- if ( result < 0 ) {
-
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \
- "H5AC_set_cache_config() failed.")
- }
+ if(H5AC_set_cache_config(cache_ptr, config_ptr) < 0 )
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "can't set cache configuration")
done:
-
#if H5AC__TRACE_FILE_ENABLED
/* For the set cache auto resize config call, only the contents
* of the config is necessary in the trace file. Write the return
* value to catch occult errors.
*/
- if ( ( cache_ptr != NULL ) &&
- ( H5C_get_trace_file_ptr(cache_ptr, &trace_file_ptr) >= 0 ) &&
- ( trace_file_ptr != NULL ) ) {
-
+ if((cache_ptr != NULL) &&
+ (H5C_get_trace_file_ptr(cache_ptr, &trace_file_ptr) >= 0) &&
+ (trace_file_ptr != NULL))
HDfprintf(trace_file_ptr,
"%s %d %d %d %d \"%s\" %d %d %d %f %d %d %ld %d %f %f %d %d %d %f %f %d %f %f %d %d %d %d %f %d %d\n",
- "H5AC_set_cache_auto_resize_config",
+ FUNC,
trace_config.version,
(int)(trace_config.rpt_fcn_enabled),
(int)(trace_config.open_trace_file),
@@ -2777,11 +2730,9 @@ done:
trace_config.empty_reserve,
trace_config.dirty_bytes_threshold,
(int)ret_value);
- }
#endif /* H5AC__TRACE_FILE_ENABLED */
FUNC_LEAVE_NOAPI(ret_value)
-
} /* H5AC_set_cache_auto_resize_config() */
@@ -2961,94 +2912,47 @@ done:
*
*-------------------------------------------------------------------------
*/
-herr_t
+static herr_t
H5AC_set_cache_config(H5AC_t * cache_ptr,
H5AC_cache_config_t *config_ptr)
{
- herr_t result;
- herr_t ret_value = SUCCEED; /* Return value */
H5C_auto_size_ctl_t internal_config;
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5AC_set_cache_config, FAIL)
+ FUNC_ENTER_NOAPI_NOINIT(H5AC_set_cache_config)
- if ( ( cache_ptr == NULL )
+ if((cache_ptr == NULL)
#ifdef H5_HAVE_PARALLEL
||
- ( ( cache_ptr->aux_ptr != NULL )
+ ((cache_ptr->aux_ptr != NULL)
&&
- (
- ((H5AC_aux_t *)(cache_ptr->aux_ptr))->magic
- !=
- H5AC__H5AC_AUX_T_MAGIC
- )
- )
+ (((H5AC_aux_t *)(cache_ptr->aux_ptr))->magic != H5AC__H5AC_AUX_T_MAGIC))
#endif /* H5_HAVE_PARALLEL */
- ) {
-
+ )
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "bad cache_ptr on entry.")
- }
- result = H5AC_validate_config(config_ptr);
-
- if ( result != SUCCEED ) {
-
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Bad cache configuration");
- }
-
- if ( config_ptr->open_trace_file ) {
+ if(H5AC_validate_config(config_ptr) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Bad cache configuration")
+ if(config_ptr->open_trace_file) {
FILE * file_ptr = NULL;
- if ( H5C_get_trace_file_ptr(cache_ptr, &file_ptr) < 0 ) {
-
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \
- "H5C_get_trace_file_ptr() failed.")
- }
-
- if ( ( ! ( config_ptr->close_trace_file ) ) &&
- ( file_ptr != NULL ) ) {
-
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \
- "Trace file already open.")
- }
- }
-
- if (
- (
- config_ptr->dirty_bytes_threshold
- <
- H5AC__MIN_DIRTY_BYTES_THRESHOLD
- )
- ||
- (
- config_ptr->dirty_bytes_threshold
- >
- H5AC__MAX_DIRTY_BYTES_THRESHOLD
- )
- ) {
-
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
- "config_ptr->dirty_bytes_threshold out of range.")
- }
-
- if ( config_ptr->close_trace_file ) {
-
- if ( H5AC_close_trace_file(cache_ptr) < 0 ) {
+ if(H5C_get_trace_file_ptr(cache_ptr, &file_ptr) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "can't get trace file pointer")
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \
- "H5AC_close_trace_file() failed.")
- }
- }
+ if((!(config_ptr->close_trace_file)) && (file_ptr != NULL))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Trace file already open.")
+ } /* end if */
- if ( config_ptr->open_trace_file ) {
+ if((config_ptr->dirty_bytes_threshold < H5AC__MIN_DIRTY_BYTES_THRESHOLD)
+ || ( config_ptr->dirty_bytes_threshold > H5AC__MAX_DIRTY_BYTES_THRESHOLD))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "config_ptr->dirty_bytes_threshold out of range.")
- if ( H5AC_open_trace_file(cache_ptr, config_ptr->trace_file_name) < 0 )
- {
+ if(config_ptr->close_trace_file && H5AC_close_trace_file(cache_ptr) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "can't close trace file")
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \
- "H5AC_open_trace_file() failed.")
- }
- }
+ if(config_ptr->open_trace_file && H5AC_open_trace_file(cache_ptr, config_ptr->trace_file_name) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "can't open trace file")
if(H5AC_ext_config_2_int_config(config_ptr, &internal_config) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC_ext_config_2_int_config() failed.")
@@ -3060,17 +2964,13 @@ H5AC_set_cache_config(H5AC_t * cache_ptr,
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_set_evictions_enabled() failed.")
#ifdef H5_HAVE_PARALLEL
- if ( cache_ptr->aux_ptr != NULL ) {
-
+ if(cache_ptr->aux_ptr != NULL)
((H5AC_aux_t *)(cache_ptr->aux_ptr))->dirty_bytes_threshold =
config_ptr->dirty_bytes_threshold;
- }
#endif /* H5_HAVE_PARALLEL */
done:
-
FUNC_LEAVE_NOAPI(ret_value)
-
} /* H5AC_set_cache_config() */
@@ -3099,45 +2999,28 @@ done:
herr_t
H5AC_validate_config(H5AC_cache_config_t * config_ptr)
{
- herr_t result;
H5C_auto_size_ctl_t internal_config;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5AC_validate_config, FAIL)
- if ( config_ptr == NULL ) {
-
+ if(config_ptr == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL config_ptr on entry.")
- }
-
- if ( config_ptr->version != H5AC__CURR_CACHE_CONFIG_VERSION ) {
+ if(config_ptr->version != H5AC__CURR_CACHE_CONFIG_VERSION)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Unknown config version.")
- }
- if ( ( config_ptr->rpt_fcn_enabled != TRUE ) &&
- ( config_ptr->rpt_fcn_enabled != FALSE ) ) {
+ if((config_ptr->rpt_fcn_enabled != TRUE) && (config_ptr->rpt_fcn_enabled != FALSE))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "config_ptr->rpt_fcn_enabled must be either TRUE or FALSE.")
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \
- "config_ptr->rpt_fcn_enabled must be either TRUE or FALSE.")
- }
+ if((config_ptr->open_trace_file != TRUE) && (config_ptr->open_trace_file != FALSE))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "config_ptr->open_trace_file must be either TRUE or FALSE.")
- if ( ( config_ptr->open_trace_file != TRUE ) &&
- ( config_ptr->open_trace_file != FALSE ) ) {
-
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \
- "config_ptr->open_trace_file must be either TRUE or FALSE.")
- }
-
- if ( ( config_ptr->close_trace_file != TRUE ) &&
- ( config_ptr->close_trace_file != FALSE ) ) {
-
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \
- "config_ptr->close_trace_file must be either TRUE or FALSE.")
- }
+ if((config_ptr->close_trace_file != TRUE) && (config_ptr->close_trace_file != FALSE))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "config_ptr->close_trace_file must be either TRUE or FALSE.")
/* don't bother to test trace_file_name unless open_trace_file is TRUE */
- if ( config_ptr->open_trace_file ) {
+ if(config_ptr->open_trace_file) {
size_t name_len;
/* Can't really test the trace_file_name field without trying to
@@ -3145,65 +3028,35 @@ H5AC_validate_config(H5AC_cache_config_t * config_ptr)
* sanity checks on the length of the file name.
*/
name_len = HDstrlen(config_ptr->trace_file_name);
+ if(name_len == 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "config_ptr->trace_file_name is empty.")
+ else if(name_len > H5AC__MAX_TRACE_FILE_NAME_LEN)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "config_ptr->trace_file_name too long.")
+ } /* end if */
- if ( name_len == 0 ) {
-
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \
- "config_ptr->trace_file_name is empty.")
-
- } else if ( name_len > H5AC__MAX_TRACE_FILE_NAME_LEN ) {
-
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \
- "config_ptr->trace_file_name too long.")
- }
- }
-
- if ( ( config_ptr->evictions_enabled != TRUE ) &&
- ( config_ptr->evictions_enabled != FALSE ) ) {
-
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \
- "config_ptr->evictions_enabled must be either TRUE or FALSE.")
- }
-
- if ( ( config_ptr->evictions_enabled == FALSE ) &&
- ( ( config_ptr->incr_mode != H5C_incr__off ) ||
- ( config_ptr->flash_incr_mode != H5C_flash_incr__off ) ||
- ( config_ptr->decr_mode != H5C_decr__off ) ) ) {
-
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \
- "Can't disable evictions while auto-resize is enabled.")
- }
-
- if ( config_ptr->dirty_bytes_threshold < H5AC__MIN_DIRTY_BYTES_THRESHOLD ) {
-
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
- "dirty_bytes_threshold too small.")
- } else
- if ( config_ptr->dirty_bytes_threshold > H5AC__MAX_DIRTY_BYTES_THRESHOLD ) {
-
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
- "dirty_bytes_threshold too big.")
- }
-
- if ( H5AC_ext_config_2_int_config(config_ptr, &internal_config) !=
- SUCCEED ) {
+ if((config_ptr->evictions_enabled != TRUE) && (config_ptr->evictions_enabled != FALSE))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "config_ptr->evictions_enabled must be either TRUE or FALSE.")
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \
- "H5AC_ext_config_2_int_config() failed.")
- }
+ if((config_ptr->evictions_enabled == FALSE) &&
+ ((config_ptr->incr_mode != H5C_incr__off) ||
+ (config_ptr->flash_incr_mode != H5C_flash_incr__off) ||
+ (config_ptr->decr_mode != H5C_decr__off)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Can't disable evictions while auto-resize is enabled.")
- result = H5C_validate_resize_config(&internal_config,
- H5C_RESIZE_CFG__VALIDATE_ALL);
+ if(config_ptr->dirty_bytes_threshold < H5AC__MIN_DIRTY_BYTES_THRESHOLD)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dirty_bytes_threshold too small.")
+ else
+ if(config_ptr->dirty_bytes_threshold > H5AC__MAX_DIRTY_BYTES_THRESHOLD)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dirty_bytes_threshold too big.")
- if ( result != SUCCEED ) {
+ if(H5AC_ext_config_2_int_config(config_ptr, &internal_config) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC_ext_config_2_int_config() failed.")
+ if(H5C_validate_resize_config(&internal_config, H5C_RESIZE_CFG__VALIDATE_ALL) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "error(s) in new config.")
- }
done:
-
FUNC_LEAVE_NOAPI(ret_value)
-
} /* H5AC_validate_config() */
diff --git a/src/H5B2cache.c b/src/H5B2cache.c
index f8247aa..4cbb817 100644
--- a/src/H5B2cache.c
+++ b/src/H5B2cache.c
@@ -298,7 +298,7 @@ done:
static herr_t
H5B2_cache_hdr_image_len(const void *_thing, size_t *image_len)
{
- H5B2_t *bt2 = (H5B2_t *)_thing; /* Pointer to the B-tree header */
+ const H5B2_t *bt2 = (const H5B2_t *)_thing; /* Pointer to the B-tree header */
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5B2_cache_hdr_image_len)
@@ -610,7 +610,7 @@ done:
static herr_t
H5B2_cache_int_image_len(const void *_thing, size_t *image_len)
{
- H5B2_internal_t *internal = (H5B2_internal_t *)_thing; /* Pointer to the B-tree internal node */
+ const H5B2_internal_t *internal = (const H5B2_internal_t *)_thing; /* Pointer to the B-tree internal node */
H5B2_shared_t *shared; /* Shared B-tree information */
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5B2_cache_int_image_len)
@@ -918,7 +918,7 @@ done:
static herr_t
H5B2_cache_leaf_image_len(const void *_thing, size_t *image_len)
{
- H5B2_leaf_t *leaf = (H5B2_leaf_t *)_thing; /* Pointer to the B-tree leaf node */
+ const H5B2_leaf_t *leaf = (const H5B2_leaf_t *)_thing; /* Pointer to the B-tree leaf node */
H5B2_shared_t *shared; /* Shared B-tree information */
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5B2_cache_leaf_image_len)
diff --git a/src/H5B2int.c b/src/H5B2int.c
index 9384056..fbf8b55 100644
--- a/src/H5B2int.c
+++ b/src/H5B2int.c
@@ -3429,7 +3429,7 @@ H5B2_assert_leaf(H5B2_shared_t *shared, H5B2_leaf_t *leaf)
unsigned u,v; /* Local index variables */
/* General sanity checking on node */
- HDassert(leaf->nrec<=shared->split_leaf_nrec);
+ HDassert(leaf->nrec <= hdr->node_info->split_nrec);
/* Sanity checking on records */
for(u=0; u<leaf->nrec; u++)
@@ -3459,7 +3459,7 @@ H5B2_assert_leaf2(H5B2_shared_t *shared, H5B2_leaf_t *leaf, H5B2_leaf_t *leaf2)
unsigned u,v; /* Local index variables */
/* General sanity checking on node */
- HDassert(leaf->nrec<=shared->split_leaf_nrec);
+ HDassert(leaf->nrec <= hdr->node_info->split_nrec);
/* Sanity checking on records */
for(u=0; u<leaf->nrec; u++) {
@@ -3492,7 +3492,7 @@ H5B2_assert_internal(hsize_t parent_all_nrec, H5B2_shared_t *shared, H5B2_intern
unsigned u,v; /* Local index variables */
/* General sanity checking on node */
- HDassert(internal->nrec<=shared->split_int_nrec);
+ HDassert(internal->nrec <= hdr->node_info->split_nrec);
/* Sanity checking on records */
for(u=0; u<internal->nrec; u++)
@@ -3538,7 +3538,7 @@ H5B2_assert_internal2(hsize_t parent_all_nrec, H5B2_shared_t *shared, H5B2_inter
unsigned u,v; /* Local index variables */
/* General sanity checking on node */
- HDassert(internal->nrec<=shared->split_int_nrec);
+ HDassert(internal->nrec <= hdr->node_info->split_nrec);
/* Sanity checking on records */
for(u=0; u<internal->nrec; u++)
diff --git a/src/H5Bcache.c b/src/H5Bcache.c
index f95fb69..a3ee75e 100644
--- a/src/H5Bcache.c
+++ b/src/H5Bcache.c
@@ -128,7 +128,8 @@ H5B_get_load_size(const void *_udata, size_t *image_len)
*
* Purpose: Deserialize the data structure from disk.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Success: Pointer to a new B-tree node.
+ * Failure: NULL
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
@@ -244,7 +245,7 @@ done:
static herr_t
H5B_image_len(const void *_thing, size_t *image_len)
{
- H5B_t *bt = (H5B_t *)_thing; /* Pointer to the B-tree node */
+ const H5B_t *bt = (const H5B_t *)_thing; /* Pointer to the B-tree node */
H5B_shared_t *shared; /* Pointer to shared B-tree info */
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5B_image_len)
diff --git a/src/H5C.c b/src/H5C.c
index d9a6f08..dd27ec2 100644
--- a/src/H5C.c
+++ b/src/H5C.c
@@ -210,14 +210,15 @@ const H5C_class_t epoch_marker_class =
/* name = */ "epoch marker",
/* mem_type = */ H5FD_MEM_DEFAULT, /* value doesn't matter */
/* flags = */ H5AC__CLASS_NO_FLAGS_SET,
- /* get_load_size = */ &H5C_epoch_marker_get_load_size,
- /* deserialize = */ &H5C_epoch_marker_deserialize,
- /* image_len = */ &H5C_epoch_marker_image_len,
- /* serialize = */ &H5C_epoch_marker_serialize,
- /* free_icr = */ &H5C_epoch_marker_free_icr,
+ /* get_load_size = */ H5C_epoch_marker_get_load_size,
+ /* deserialize = */ H5C_epoch_marker_deserialize,
+ /* image_len = */ H5C_epoch_marker_image_len,
+ /* serialize = */ H5C_epoch_marker_serialize,
+ /* free_icr = */ H5C_epoch_marker_free_icr,
};
+
/***************************************************************************
* Class functions for H5C__EPOCH_MAKER_TYPE:
*
@@ -226,85 +227,66 @@ const H5C_class_t epoch_marker_class =
* JRM - 11/16/04
*
***************************************************************************/
-
static herr_t
H5C_epoch_marker_get_load_size(const void UNUSED *udata_ptr,
- size_t UNUSED *image_len_ptr)
+ size_t UNUSED *image_len_ptr)
{
- herr_t ret_value = FAIL; /* Return value */
-
- FUNC_ENTER_NOAPI(H5C_epoch_marker_get_load_size, FAIL)
+ FUNC_ENTER_NOAPI_NOINIT(H5C_epoch_marker_get_load_size)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "called unreachable fcn.")
+ HERROR(H5E_CACHE, H5E_SYSTEM, "called unreachable fcn.")
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-}
+ FUNC_LEAVE_NOAPI(FAIL)
+} /* end H5C_epoch_marker_get_load_size() */
+
static void *
-H5C_epoch_marker_deserialize(const void UNUSED * image_ptr,
- size_t UNUSED len,
- void UNUSED * udata,
- hbool_t UNUSED * dirty_ptr)
+H5C_epoch_marker_deserialize(const void UNUSED * image_ptr, size_t UNUSED len,
+ void UNUSED * udata, hbool_t UNUSED * dirty_ptr)
{
- void * ret_value = NULL; /* Return value */
-
- FUNC_ENTER_NOAPI(H5C_epoch_marker_deserialize, NULL)
+ FUNC_ENTER_NOAPI_NOINIT(H5C_epoch_marker_deserialize)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, NULL, "called unreachable fcn.")
+ HERROR(H5E_CACHE, H5E_SYSTEM, "called unreachable fcn.")
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-}
+ FUNC_LEAVE_NOAPI(NULL)
+} /* end H5C_epoch_marker_deserialize() */
+
static herr_t
H5C_epoch_marker_image_len(const void UNUSED *thing,
- size_t UNUSED *image_len_ptr)
+ size_t UNUSED *image_len_ptr)
{
- herr_t ret_value = FAIL; /* Return value */
+ FUNC_ENTER_NOAPI_NOINIT(H5C_epoch_marker_image_len)
- FUNC_ENTER_NOAPI(H5C_epoch_marker_image_len, FAIL)
+ HERROR(H5E_CACHE, H5E_SYSTEM, "called unreachable fcn.")
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "called unreachable fcn.")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-}
+ FUNC_LEAVE_NOAPI(FAIL)
+} /* end H5C_epoch_marker_image_len() */
+
static herr_t
-H5C_epoch_marker_serialize(const H5F_t UNUSED *f,
- hid_t UNUSED dxpl_id,
- haddr_t UNUSED addr,
- size_t UNUSED len,
- void UNUSED * image_ptr,
- void UNUSED * thing,
- unsigned UNUSED * flags_ptr,
- haddr_t UNUSED * new_addr_ptr,
- size_t UNUSED * new_len_ptr,
- void UNUSED ** new_image_ptr_ptr)
+H5C_epoch_marker_serialize(const H5F_t UNUSED *f, hid_t UNUSED dxpl_id,
+ haddr_t UNUSED addr, size_t UNUSED len, void UNUSED * image_ptr,
+ void UNUSED * thing, unsigned UNUSED * flags_ptr,
+ haddr_t UNUSED * new_addr_ptr, size_t UNUSED * new_len_ptr,
+ void UNUSED ** new_image_ptr_ptr)
{
- herr_t ret_value = FAIL; /* Return value */
+ FUNC_ENTER_NOAPI_NOINIT(H5C_epoch_marker_serialize)
- FUNC_ENTER_NOAPI(H5C_epoch_marker_serialize, FAIL)
+ HERROR(H5E_CACHE, H5E_SYSTEM, "called unreachable fcn.")
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "called unreachable fcn.")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-}
+ FUNC_LEAVE_NOAPI(FAIL)
+} /* end H5C_epoch_marker_serialize() */
+
static herr_t
H5C_epoch_marker_free_icr(void UNUSED * thing)
{
- herr_t ret_value = FAIL; /* Return value */
+ FUNC_ENTER_NOAPI_NOINIT(H5C_epoch_marker_free_icr)
- FUNC_ENTER_NOAPI(H5C_epoch_marker_free_icr, FAIL)
+ HERROR(H5E_CACHE, H5E_SYSTEM, "called unreachable fcn.")
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "called unreachable fcn.")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-}
+ FUNC_LEAVE_NOAPI(FAIL)
+} /* end H5C_epoch_marker_free_icr() */
/*-------------------------------------------------------------------------
@@ -815,61 +797,40 @@ H5C_def_auto_resize_rpt_fcn(H5C_t * cache_ptr,
*-------------------------------------------------------------------------
*/
herr_t
-H5C_dest(H5F_t * f,
- hid_t dxpl_id)
+H5C_dest(H5F_t * f, hid_t dxpl_id)
{
H5C_t * cache_ptr = f->shared->cache;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5C_dest, FAIL)
- HDassert( cache_ptr );
- HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC );
+ HDassert(cache_ptr);
+ HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
/* All metadata journaling status change callbacks should have
* de-registered at this point.
*/
- HDassert( cache_ptr->num_mdjsc_cbs == 0 );
+ HDassert(cache_ptr->num_mdjsc_cbs == 0);
- if ( cache_ptr->mdj_enabled ) {
-
- if ( H5C_end_journaling(f, dxpl_id, cache_ptr) != SUCCEED ) {
-
- HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, \
- "H5C_end_journaling() failed.")
- }
- }
-
- if ( H5C_flush_cache(f, dxpl_id,
- H5C__FLUSH_INVALIDATE_FLAG) < 0 ) {
+ if(cache_ptr->mdj_enabled && H5C_end_journaling(f, dxpl_id, cache_ptr) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "can't shut down journaling")
+ if(H5C_flush_cache(f, dxpl_id, H5C__FLUSH_INVALIDATE_FLAG) < 0 )
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush cache")
- }
-
- if ( cache_ptr->slist_ptr != NULL ) {
+ if(cache_ptr->slist_ptr != NULL) {
H5SL_close(cache_ptr->slist_ptr);
cache_ptr->slist_ptr = NULL;
- }
-
- if ( cache_ptr->mdjsc_cb_tbl != NULL ) {
+ } /* end if */
+ if(cache_ptr->mdjsc_cb_tbl != NULL)
cache_ptr->mdjsc_cb_tbl = (H5C_mdjsc_record_t *)H5MM_xfree(cache_ptr->mdjsc_cb_tbl);
- if ( cache_ptr->mdjsc_cb_tbl != NULL ) {
-
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, \
- "free of mdjsc_cb_tbl failed.");
- }
- }
-
cache_ptr->magic = 0;
-
cache_ptr = H5FL_FREE(H5C_t, cache_ptr);
done:
FUNC_LEAVE_NOAPI(ret_value)
-
} /* H5C_dest() */
@@ -940,111 +901,78 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5C_expunge_entry(H5F_t * f,
- hid_t dxpl_id,
- const H5C_class_t * type,
- haddr_t addr)
+H5C_expunge_entry(H5F_t *f, hid_t dxpl_id, const H5C_class_t *type,
+ haddr_t addr)
{
H5C_t * cache_ptr;
- herr_t result;
H5C_cache_entry_t * entry_ptr = NULL;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5C_expunge_entry, FAIL)
- HDassert( f );
- HDassert( f->shared );
+ HDassert(f);
+ HDassert(f->shared);
cache_ptr = f->shared->cache;
- HDassert( cache_ptr );
- HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC );
- HDassert( type );
- HDassert( H5F_addr_defined(addr) );
+ HDassert(cache_ptr);
+ HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
+ HDassert(type);
+ HDassert(H5F_addr_defined(addr));
#if H5C_DO_EXTREME_SANITY_CHECKS
- if ( H5C_validate_lru_list(cache_ptr) < 0 ) {
-
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \
- "LRU sanity check failed.\n");
- }
+ if(H5C_validate_lru_list(cache_ptr) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "LRU sanity check failed.\n")
#endif /* H5C_DO_EXTREME_SANITY_CHECKS */
+ /* Look for entry in cache */
H5C__SEARCH_INDEX(cache_ptr, addr, entry_ptr, FAIL)
-
- if ( ( entry_ptr == NULL ) || ( entry_ptr->type != type ) ) {
-
+ if((entry_ptr == NULL) || (entry_ptr->type != type))
/* the target doesn't exist in the cache, so we are done. */
HGOTO_DONE(SUCCEED)
- }
-
- HDassert( entry_ptr->addr == addr );
- HDassert( entry_ptr->type == type );
- if ( entry_ptr->is_protected ) {
+ HDassert(entry_ptr->addr == addr);
+ HDassert(entry_ptr->type == type);
- HGOTO_ERROR(H5E_CACHE, H5E_CANTEXPUNGE, FAIL, \
- "Target entry is protected.")
- }
-
- if ( entry_ptr->is_pinned ) {
-
- HGOTO_ERROR(H5E_CACHE, H5E_CANTEXPUNGE, FAIL, \
- "Target entry is pinned.")
- }
+ /* Check for entry being pinned or protected */
+ if(entry_ptr->is_protected)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTEXPUNGE, FAIL, "Target entry is protected.")
+ if(entry_ptr->is_pinned)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTEXPUNGE, FAIL, "Target entry is pinned.")
/* H5C_flush_single_entry() will choke if the last_trans field
* of the entry isn't zero, or if the entry is on the transaction
* list, or on the transaction write in progress list. Must tend
* to this before we we make the call.
*/
- if ( cache_ptr->mdj_enabled ) {
-
- if ( cache_ptr->trans_num > 0 ) {
+ if(cache_ptr->mdj_enabled) {
+ if(cache_ptr->trans_num > 0) {
/* remove the entry from the transaction list if it is there */
H5C__TRANS_DLL_REMOVE(entry_ptr, cache_ptr->tl_head_ptr, \
- cache_ptr->tl_tail_ptr, cache_ptr->tl_len, \
- cache_ptr->tl_size, FAIL);
+ cache_ptr->tl_tail_ptr, cache_ptr->tl_len, \
+ cache_ptr->tl_size, FAIL);
entry_ptr->last_trans = (uint64_t)0;
-
- H5C__UPDATE_RP_FOR_JOURNAL_WRITE_COMPLETE(cache_ptr, \
- entry_ptr, \
- FAIL)
- }
- }
+ H5C__UPDATE_RP_FOR_JOURNAL_WRITE_COMPLETE(cache_ptr, entry_ptr, FAIL)
+ } /* end if */
+ } /* end if */
/* If we get this far, call H5C_flush_single_entry() with the
* H5C__FLUSH_INVALIDATE_FLAG and the H5C__FLUSH_CLEAR_ONLY_FLAG.
* This will clear the entry, and then delete it from the cache.
*/
-
- result = H5C_flush_single_entry(f,
- dxpl_id,
- entry_ptr->type,
- entry_ptr->addr,
- H5C__FLUSH_INVALIDATE_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG,
- TRUE);
-
- if ( result < 0 ) {
-
- HGOTO_ERROR(H5E_CACHE, H5E_CANTEXPUNGE, FAIL, \
- "H5C_flush_single_entry() failed.")
- }
+ if(H5C_flush_single_entry(f, dxpl_id, entry_ptr->type, entry_ptr->addr,
+ H5C__FLUSH_INVALIDATE_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, TRUE) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTEXPUNGE, FAIL, "H5C_flush_single_entry() failed.")
done:
-
#if H5C_DO_EXTREME_SANITY_CHECKS
- if ( H5C_validate_lru_list(cache_ptr) < 0 ) {
-
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \
- "LRU sanity check failed.\n");
- }
+ if(H5C_validate_lru_list(cache_ptr) < 0)
+ HDONE_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "LRU sanity check failed.\n")
#endif /* H5C_DO_EXTREME_SANITY_CHECKS */
FUNC_LEAVE_NOAPI(ret_value)
-
} /* H5C_expunge_entry() */
@@ -1117,16 +1045,8 @@ H5C_flush_cache(H5F_t *f, hid_t dxpl_id, unsigned flags)
HDassert( ! ( cache_ptr->flush_in_progress ) );
- if ( cache_ptr->mdj_enabled ) {
-
- status = H5C_journal_pre_flush(cache_ptr);
-
- if ( status != SUCCEED ) {
-
- HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, \
- "H5C_journal_pre_flush() failed.")
- }
- }
+ if(cache_ptr->mdj_enabled && H5C_journal_pre_flush(cache_ptr) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "H5C_journal_pre_flush() failed.")
cache_ptr->flush_in_progress = TRUE;
@@ -1412,17 +1332,9 @@ H5C_flush_cache(H5F_t *f, hid_t dxpl_id, unsigned flags)
}
- if ( cache_ptr->mdj_enabled ) {
-
- status = H5C_journal_post_flush(f, dxpl_id, cache_ptr,
- (hbool_t)(flush_marked_entries == FALSE));
-
- if ( status != SUCCEED ) {
-
- HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, \
- "H5C_journal_post_flush() failed.")
- }
- }
+ if(cache_ptr->mdj_enabled && H5C_journal_post_flush(f, dxpl_id, cache_ptr,
+ (hbool_t)(flush_marked_entries == FALSE)) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "H5C_journal_post_flush() failed.")
done:
@@ -2036,8 +1948,7 @@ H5C_insert_entry(H5F_t * f,
HDassert( cache_ptr );
HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC );
- HDassert( ( ! ( cache_ptr->mdj_enabled ) ) ||
- ( cache_ptr->trans_in_progress ) );
+ HDassert( !(cache_ptr->mdj_enabled) || cache_ptr->trans_in_progress );
HDassert( type );
HDassert( H5F_addr_defined(addr) );
HDassert( thing );
@@ -2204,7 +2115,7 @@ H5C_insert_entry(H5F_t * f,
} else {
HGOTO_ERROR(H5E_CACHE, H5E_CANTINS, FAIL, \
- "duplicate entry in cache.")
+ "duplicate entry in cache, addr = %llu", (unsigned long long)addr)
}
}
@@ -2690,19 +2601,10 @@ H5C_move_entry(H5C_t * cache_ptr,
"Target entry is protected.")
}
- if ( ( entry_ptr->destroy_in_progress ) &&
- ( cache_ptr->mdj_enabled ) )
- {
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \
- "move on destroy when journaling is enabled.\n");
- }
-
- if ( ( entry_ptr->flush_in_progress ) &&
- ( cache_ptr->mdj_enabled ) )
- {
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \
- "move on flush when journaling is enabled.\n");
- }
+ if(entry_ptr->destroy_in_progress && cache_ptr->mdj_enabled)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "move on destroy when journaling is enabled.\n")
+ if(entry_ptr->flush_in_progress && cache_ptr->mdj_enabled)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "move on flush when journaling is enabled.\n")
H5C__SEARCH_INDEX(cache_ptr, new_addr, test_entry_ptr, FAIL)
@@ -2803,8 +2705,7 @@ H5C_move_entry(H5C_t * cache_ptr,
*/
H5C__UPDATE_TL_FOR_ENTRY_DIRTY(cache_ptr, entry_ptr, FAIL);
- H5C__UPDATE_RP_FOR_MOVE(cache_ptr, entry_ptr, was_dirty, \
- had_jwip, FAIL);
+ H5C__UPDATE_RP_FOR_MOVE(cache_ptr, entry_ptr, was_dirty, had_jwip, FAIL);
}
}
@@ -3023,7 +2924,6 @@ H5C_protect(H5F_t * f,
{
H5C_t * cache_ptr;
hbool_t hit;
- hbool_t first_flush;
hbool_t have_write_permitted = FALSE;
hbool_t read_only = FALSE;
hbool_t write_permitted;
@@ -3124,7 +3024,6 @@ H5C_protect(H5F_t * f,
have_write_permitted = TRUE;
- first_flush = TRUE;
}
} else {
@@ -3132,7 +3031,6 @@ H5C_protect(H5F_t * f,
have_write_permitted = TRUE;
- first_flush = TRUE;
}
HDassert( entry_ptr->size <= H5C_MAX_ENTRY_SIZE );
@@ -3203,10 +3101,8 @@ H5C_protect(H5F_t * f,
* a previous version of the library. If this happens, we must
* place the entry on the transaction list.
*/
- if ( entry_ptr->is_dirty ) {
-
+ if(entry_ptr->is_dirty)
H5C__INSERT_ENTRY_IN_TL(cache_ptr, entry_ptr, NULL);
- }
/* load the entry into the data structures used by the replacement
* policy. We are just going to take it out again when we update
@@ -3218,7 +3114,6 @@ H5C_protect(H5F_t * f,
* just a simplified version of update for insertion that
* avoids the problem.
*/
-
H5C__UPDATE_RP_FOR_LOAD(cache_ptr, entry_ptr, NULL)
}
@@ -3282,7 +3177,6 @@ H5C_protect(H5F_t * f,
have_write_permitted = TRUE;
- first_flush = TRUE;
}
} else {
@@ -3290,7 +3184,6 @@ H5C_protect(H5F_t * f,
have_write_permitted = TRUE;
- first_flush = TRUE;
}
}
@@ -4539,13 +4432,12 @@ H5C_unprotect(H5F_t * f,
}
/* mark the entry as dirty if appropriate */
- if ( dirtied ) {
-
+ if(dirtied) {
entry_ptr->is_dirty = ( (entry_ptr->is_dirty) || dirtied );
entry_ptr->image_up_to_date = FALSE;
H5C__UPDATE_TL_FOR_ENTRY_DIRTY(cache_ptr, entry_ptr, FAIL)
- }
+ } /* end if */
/* Pin or unpin the entry as requested. */
if ( pin_entry ) {
@@ -4620,37 +4512,28 @@ H5C_unprotect(H5F_t * f,
"hash table contains multiple entries for addr?!?.")
}
- if ( cache_ptr->mdj_enabled ) {
-
- /* if journaling is enabled, we have a bit of house keeping
- * to do before we delete the entry.
- *
- * First, if a transaction is in progress, it is possible
- * that the target entry is on the transaction list. If it is
- * it must be removed before the flush destroy.
- *
- * Second, if the target entry is on the journal write in
- * in progress list, it must be removed from that list as
- * well.
- */
-
+ /* if journaling is enabled, we have a bit of house keeping
+ * to do before we delete the entry.
+ *
+ * First, if a transaction is in progress, it is possible
+ * that the target entry is on the transaction list. If it is
+ * it must be removed before the flush destroy.
+ *
+ * Second, if the target entry is on the journal write in
+ * in progress list, it must be removed from that list as
+ * well.
+ */
+ if(cache_ptr->mdj_enabled) {
hbool_t entry_on_jwip_list = ( entry_ptr->last_trans != 0 );
- if ( cache_ptr->trans_in_progress ) {
-
- H5C__UPDATE_TL_FOR_ENTRY_CLEAR((cache_ptr), \
- (entry_ptr), \
- FAIL)
- }
-
- if ( entry_on_jwip_list ) {
+ if(cache_ptr->trans_in_progress)
+ H5C__UPDATE_TL_FOR_ENTRY_CLEAR(cache_ptr, entry_ptr, FAIL)
+ if(entry_on_jwip_list) {
entry_ptr->last_trans = 0;
- H5C__UPDATE_RP_FOR_JOURNAL_WRITE_COMPLETE((cache_ptr), \
- (entry_ptr), \
- FAIL)
- }
- }
+ H5C__UPDATE_RP_FOR_JOURNAL_WRITE_COMPLETE(cache_ptr, entry_ptr, FAIL)
+ } /* end if */
+ } /* end if */
if ( H5C_flush_single_entry(f,
dxpl_id,
@@ -5765,7 +5648,7 @@ H5C__autoadjust__ageout__evict_aged_out_entries(H5F_t * f,
/* just skip the entry if it is dirty, as we can't do
* anything with it now since we can't write.
*
- * Since all entries are clean, serialize() will no be called,
+ * Since all entries are clean, serialize() will not be called,
* and thus we needn't test to see if the LRU has been changed
* out from under us.
*/
@@ -6732,27 +6615,14 @@ done:
* Attempts to flush a protected entry will result in an
* error.
*
- * *first_flush_ptr should be true if only one
- * flush is contemplated before the next load, or if this
- * is the first of a sequence of flushes that will be
- * completed before the next load. *first_flush_ptr is set
- * to false if a flush actually takes place, and should be
- * left false until the end of the sequence.
- *
- * The primary_dxpl_id is used if *first_flush_ptr is TRUE
- * on entry, and a flush actually takes place. The
- * secondary_dxpl_id is used in any subsequent flush where
- * *first_flush_ptr is FALSE on entry.
- *
* If the H5C__FLUSH_INVALIDATE_FLAG flag is set, the entry will
- * be cleared and not flushed -- in the case *first_flush_ptr,
- * primary_dxpl_id, and secondary_dxpl_id are all irrelevent,
- * and the call can't be part of a sequence of flushes.
+ * be cleared and not flushed, and the call can't be part of a
+ * sequence of flushes.
*
- * If the caller knows the address of the TBBT node at
+ * If the caller knows the address of the skip list node at
* which the target entry resides, it can avoid a lookup
* by supplying that address in the tgt_node_ptr parameter.
- * If this parameter is NULL, the function will do a TBBT
+ * If this parameter is NULL, the function will do a skip list
* search for the entry instead.
*
* The function does nothing silently if there is no entry
@@ -7080,9 +6950,8 @@ H5C_flush_single_entry(const H5F_t * f,
* scream incorrectly about flushing an entry with a pending
* journal write.
*/
- if ( clear_only ) {
+ if(clear_only)
H5C__UPDATE_TL_FOR_ENTRY_CLEAR(cache_ptr, entry_ptr, FAIL);
- }
/* We are either doing a flush or a clear.
*
@@ -7094,10 +6963,8 @@ H5C_flush_single_entry(const H5F_t * f,
H5C__UPDATE_RP_FOR_FLUSH(cache_ptr, entry_ptr, FAIL)
- if ( entry_ptr->in_slist )
- {
+ if(entry_ptr->in_slist)
H5C__REMOVE_ENTRY_FROM_SLIST(cache_ptr, entry_ptr)
- }
}
/* Clear the dirty flag only, if requested */
@@ -7154,8 +7021,7 @@ H5C_flush_single_entry(const H5F_t * f,
* deallocate the old image, and allocate a new.
*/
if(serialize_flags & H5C__SERIALIZE_RESIZED_FLAG) {
- H5C__UPDATE_STATS_FOR_ENTRY_SIZE_CHANGE(cache_ptr, \
- entry_ptr, new_len)
+ H5C__UPDATE_STATS_FOR_ENTRY_SIZE_CHANGE(cache_ptr, entry_ptr, new_len)
entry_ptr->size = new_len;
entry_ptr->image_ptr = new_image_ptr;
} /* end if */
@@ -7175,8 +7041,7 @@ H5C_flush_single_entry(const H5F_t * f,
* cache data structures.
*/
if(serialize_flags & H5C__SERIALIZE_RESIZED_FLAG) {
- H5C__UPDATE_STATS_FOR_ENTRY_SIZE_CHANGE(cache_ptr, \
- entry_ptr, new_len)
+ H5C__UPDATE_STATS_FOR_ENTRY_SIZE_CHANGE(cache_ptr, entry_ptr, new_len)
/* The replacement policy code thinks the
* entry is already clean, so modify is_dirty
@@ -7185,10 +7050,7 @@ H5C_flush_single_entry(const H5F_t * f,
entry_ptr->is_dirty = FALSE;
/* update the hash table for the size change*/
- H5C__UPDATE_INDEX_FOR_SIZE_CHANGE( \
- (cache_ptr), \
- (entry_ptr->size),\
- (new_len));
+ H5C__UPDATE_INDEX_FOR_SIZE_CHANGE(cache_ptr, entry_ptr->size, new_len);
/* The entry can't be protected since we are
* in the process of flushing it. Thus we must
@@ -7196,9 +7058,7 @@ H5C_flush_single_entry(const H5F_t * f,
* structures for the size change. The macro
* deals with the pinned case.
*/
- H5C__UPDATE_RP_FOR_SIZE_CHANGE(cache_ptr, \
- entry_ptr, \
- new_len);
+ H5C__UPDATE_RP_FOR_SIZE_CHANGE(cache_ptr, entry_ptr, new_len);
/* The entry can't be in the slist, so no need
* to update the slist for the size change.
diff --git a/src/H5Cprivate.h b/src/H5Cprivate.h
index 9b744da..a6f2ae1 100644
--- a/src/H5Cprivate.h
+++ b/src/H5Cprivate.h
@@ -121,7 +121,7 @@ typedef struct H5C_t H5C_t;
*
* flags: Flags indicating class-specific behavior.
*
- * get_load_size: Pointer to the 'get load size' function.
+ * GET_LOAD_SIZE: Pointer to the 'get load size' function.
*
* This function must be able to determing the size of a disk image for
* a metadata cache entry, given the 'udata' that will be passed to the
@@ -154,7 +154,7 @@ typedef struct H5C_t H5C_t;
* the value pointed to by the image_len_ptr.
*
*
- * deserialize: Pointer to the deserialize function.
+ * DESERIALIZE: Pointer to the deserialize function.
*
* This function must be able to read an on disk image of a metadata
* cache entry, allocate and load the equivalent in core representation,
@@ -219,7 +219,7 @@ typedef struct H5C_t H5C_t;
* update its on disk image length accordingly.
*
*
- * image_len: Pointer to the image length callback.
+ * IMAGE_LEN: Pointer to the image length callback.
*
* In the best of all possible worlds, we would not have this callback.
* It exists to allow clients to reduce the size of the on disk image of
@@ -248,7 +248,7 @@ typedef struct H5C_t H5C_t;
* the value pointed to by the image_len_ptr.
*
*
- * serialize: Pointer to the serialize callback.
+ * SERIALIZE: Pointer to the serialize callback.
*
* The serialize callback is invoked by the metadata cache whenever
* it needs a current on disk image of the metadata entry for purposes
@@ -383,7 +383,7 @@ typedef struct H5C_t H5C_t;
* routines.
*
*
- * free_icr: Pointer to the free ICR Callback.
+ * FREE_ICR: Pointer to the free ICR Callback.
*
* The free ICR callback is invoked by the metadata cache when it
* wishes to evict an entry, and needs the client to free the memory
@@ -427,8 +427,8 @@ typedef void *(*H5C_deserialize_func_t)(const void *image_ptr,
typedef herr_t (*H5C_image_len_func_t)(const void *thing,
size_t *image_len_ptr);
-#define H5C__SERIALIZE_RESIZED_FLAG 0x1
-#define H5C__SERIALIZE_MOVED_FLAG 0x2
+#define H5C__SERIALIZE_RESIZED_FLAG ((unsigned)0x1)
+#define H5C__SERIALIZE_MOVED_FLAG ((unsigned)0x2)
typedef herr_t (*H5C_serialize_func_t)(const H5F_t *f,
hid_t dxpl_id,
@@ -443,9 +443,9 @@ typedef herr_t (*H5C_serialize_func_t)(const H5F_t *f,
typedef herr_t (*H5C_free_icr_func_t)(void *thing);
-#define H5C__CLASS_NO_FLAGS_SET 0x0
-#define H5C__CLASS_SPECULATIVE_LOAD_FLAG 0x1
-#define H5C__CLASS_COMPRESSED_FLAG 0x2
+#define H5C__CLASS_NO_FLAGS_SET ((unsigned)0x0)
+#define H5C__CLASS_SPECULATIVE_LOAD_FLAG ((unsigned)0x1)
+#define H5C__CLASS_COMPRESSED_FLAG ((unsigned)0x2)
typedef struct H5C_class_t {
int id;
@@ -1404,7 +1404,7 @@ H5_DLL herr_t H5C_flush_cache(H5F_t *f, hid_t dxpl_id, unsigned flags);
H5_DLL herr_t H5C_flush_to_min_clean(H5F_t * f,
- hid_t dxpl_id);
+ hid_t dxpl_id);
H5_DLL herr_t H5C_get_cache_auto_resize_config(const H5C_t * cache_ptr,
H5C_auto_size_ctl_t *config_ptr);
diff --git a/src/H5F.c b/src/H5F.c
index e563212..e12d6ed 100644
--- a/src/H5F.c
+++ b/src/H5F.c
@@ -936,7 +936,7 @@ H5F_new(H5F_file_t *shared, hid_t fcpl_id, hid_t fapl_id, H5FD_t *lf)
* The cache might be created with a different number of elements and
* the access property list should be updated to reflect that.
*/
- if(H5AC_create(f, (H5AC_cache_config_t *)&(f->shared->mdc_initCacheCfg)) < 0)
+ if(H5AC_create(f, &(f->shared->mdc_initCacheCfg)) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to create metadata cache")
/* Create the file's "open object" information */
@@ -3510,7 +3510,7 @@ H5Fget_mdc_config(hid_t file_id, H5AC_cache_config_t *config_ptr)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Bad config_ptr")
/* Go get the resize configuration */
- if(H5AC_get_cache_auto_resize_config(file->shared->cache, (H5AC_cache_config_t *)config_ptr) < 0)
+ if(H5AC_get_cache_auto_resize_config(file->shared->cache, config_ptr) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC_get_cache_auto_resize_config() failed.")
done:
@@ -3546,8 +3546,8 @@ H5Fset_mdc_config(hid_t file_id, H5AC_cache_config_t *config_ptr)
if(NULL == (file = H5I_object_verify(file_id, H5I_FILE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID")
- /* pass the resize configuration to the modified cache as well. */
- if(H5AC_set_cache_auto_resize_config(file->shared->cache, (H5AC_cache_config_t *)config_ptr) < 0)
+ /* set the resize configuration */
+ if(H5AC_set_cache_auto_resize_config(file->shared->cache, config_ptr) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "H5AC_set_cache_auto_resize_config() failed.")
done:
diff --git a/src/H5FScache.c b/src/H5FScache.c
index 68addce..3ca73c7 100644
--- a/src/H5FScache.c
+++ b/src/H5FScache.c
@@ -303,7 +303,7 @@ done:
static herr_t
H5FS_cache_hdr_image_len(const void *_thing, size_t *image_len)
{
- H5FS_t *fspace = (H5FS_t *)_thing; /* Pointer to free space header */
+ const H5FS_t *fspace = (const H5FS_t *)_thing; /* Pointer to free space header */
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5FS_cache_hdr_image_len)
@@ -755,7 +755,7 @@ done:
static herr_t
H5FS_cache_sinfo_image_len(const void *_thing, size_t *image_len)
{
- H5FS_sinfo_t *sinfo = (H5FS_sinfo_t *)_thing;
+ const H5FS_sinfo_t *sinfo = (const H5FS_sinfo_t *)_thing;
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5FS_cache_sinfo_image_len)
@@ -764,7 +764,7 @@ H5FS_cache_sinfo_image_len(const void *_thing, size_t *image_len)
HDassert(image_len);
/* Set the image length size */
- *image_len = sinfo->fspace->alloc_sect_size;
+ H5_ASSIGN_OVERFLOW(*image_len, sinfo->fspace->alloc_sect_size, hsize_t, size_t)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5FS_cache_sinfo_image_len() */
diff --git a/src/H5Gnode.c b/src/H5Gnode.c
index 032ef48..53b173b 100644
--- a/src/H5Gnode.c
+++ b/src/H5Gnode.c
@@ -353,8 +353,8 @@ H5G_node_get_load_size(const void *_udata, size_t *image_len)
*
* Purpose: Deserialize the data structure from disk.
*
- * Return: Success: SUCCEED
- * Failure: FAIL
+ * Return: Success: Ptr to the new node.
+ * Failure: NULL
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
@@ -437,7 +437,7 @@ done:
static herr_t
H5G_node_image_len(const void *_thing, size_t *image_len)
{
- H5G_node_t *sym = (H5G_node_t *)_thing; /* Pointer to the Symbol Table node */
+ const H5G_node_t *sym = (const H5G_node_t *)_thing; /* Pointer to the Symbol Table node */
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5G_node_image_len)
diff --git a/src/H5HFcache.c b/src/H5HFcache.c
index ab44abe..679960d 100644
--- a/src/H5HFcache.c
+++ b/src/H5HFcache.c
@@ -51,6 +51,12 @@
#define H5HF_DBLOCK_VERSION 0 /* Direct block */
#define H5HF_IBLOCK_VERSION 0 /* Indirect block */
+/* Set speculative read size for header message */
+#define H5HF_SPEC_READ_SIZE(f) ( \
+ H5HF_HDR_SIZE(H5F_SIZEOF_ADDR(f), H5F_SIZEOF_SIZE(f)) \
+ + 50 \
+)
+
/******************/
/* Local Typedefs */
@@ -293,8 +299,8 @@ H5HF_cache_hdr_get_load_size(const void *_udata, size_t *image_len)
*
* Purpose: Deserialize the data structure from disk.
*
- * Return: Success: SUCCESS
- * Failure: FAIL
+ * Return: Success: Pointer to a new fractal heap header
+ * Failure: NULL
*
* Programmer: Quincey Koziol
* koziol@ncsa.uiuc.edu
@@ -379,7 +385,7 @@ H5HF_cache_hdr_deserialize(const void *image, size_t UNUSED len,
/* Check for I/O filter information to decode */
if(hdr->filter_len > 0) {
- ptrdiff_t filter_info_off; /* Offset in header of filter information */
+ ptrdiff_t filter_info_off; /* Offset in header of filter information */
size_t filter_info_size; /* Size of filter information */
H5O_pline_t *pline; /* Pipeline information from the header on disk */
@@ -545,8 +551,8 @@ H5HF_cache_hdr_serialize(const H5F_t *f, hid_t UNUSED dxpl_id,
/* (bit 0: "huge" object IDs have wrapped) */
/* (bit 1: checksum direct blocks) */
heap_flags = 0;
- heap_flags |= (hdr->huge_ids_wrapped ? H5HF_HDR_FLAGS_HUGE_ID_WRAPPED : 0);
- heap_flags |= (hdr->checksum_dblocks ? H5HF_HDR_FLAGS_CHECKSUM_DBLOCKS : 0);
+ heap_flags = (uint8_t)(heap_flags | (hdr->huge_ids_wrapped ? H5HF_HDR_FLAGS_HUGE_ID_WRAPPED : 0));
+ heap_flags = (uint8_t)(heap_flags | (hdr->checksum_dblocks ? H5HF_HDR_FLAGS_CHECKSUM_DBLOCKS : 0));
*p++ = heap_flags;
/* "Huge" object information */
@@ -676,7 +682,6 @@ H5HF_cache_iblock_get_load_size(const void *_udata, size_t *image_len)
* Purpose: Loads a fractal heap indirect block from the disk.
*
* Return: Success: Pointer to a new fractal heap indirect block
- *
* Failure: NULL
*
* Programmer: Quincey Koziol
@@ -838,7 +843,7 @@ H5HF_cache_iblock_deserialize(const void *image, size_t UNUSED len,
/* Allocate & initialize child indirect block pointer array */
if(NULL == (iblock->child_iblocks = H5FL_SEQ_CALLOC(H5HF_indirect_ptr_t, (size_t)(indir_rows * hdr->man_dtable.cparam.width))))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for block entries")
+ HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, NULL, "memory allocation failed for block entries")
} /* end if */
else
iblock->child_iblocks = NULL;
@@ -875,7 +880,7 @@ done:
static herr_t
H5HF_cache_iblock_image_len(const void *_thing, size_t *image_len)
{
- H5HF_indirect_t *iblock = (H5HF_indirect_t *)_thing;
+ const H5HF_indirect_t *iblock = (const H5HF_indirect_t *)_thing;
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HF_cache_iblock_image_len)
@@ -1079,13 +1084,7 @@ H5HF_cache_dblock_get_load_size(const void *_udata, size_t *image_len)
* associated in core representation of the fractal heap
* direct block.
*
- * Note that this function is a heavily re-worked version
- * of the old H5HF_cache_dblock_load() routine, which had
- * to be replaced convert the fractal heap to use the new
- * journaling version of the cache.
- *
* Return: Success: Pointer to a new fractal heap direct block
- *
* Failure: NULL
*
* Programmer: Quincey Koziol
@@ -1248,6 +1247,10 @@ H5HF_cache_dblock_deserialize(const void *image, size_t len, void *_udata,
ret_value = dblock;
done:
+ if(!ret_value && dblock)
+ if(H5HF_man_dblock_dest(dblock) < 0)
+ HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, NULL, "unable to destroy fractal heap direct block")
+
FUNC_LEAVE_NOAPI(ret_value)
} /* H5HF_cache_dblock_deserialize() */
@@ -1268,7 +1271,7 @@ done:
static herr_t
H5HF_cache_dblock_image_len(const void *_thing, size_t *image_len)
{
- H5HF_direct_t *dblock = (H5HF_direct_t *)_thing;
+ const H5HF_direct_t *dblock = (const H5HF_direct_t *)_thing;
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HF_cache_dblock_image_len)
@@ -1371,6 +1374,7 @@ H5HF_cache_dblock_serialize(const H5F_t *f, hid_t dxpl_id, haddr_t addr,
/* Check for I/O filters on this heap */
if(hdr->filter_len > 0) {
+ haddr_t new_dblock_addr = HADDR_UNDEF; /* New address for direct block */
H5Z_cb_t filter_cb = {NULL, NULL}; /* Filter callback structure */
size_t nbytes; /* Number of bytes used */
unsigned filter_mask; /* Filter mask for block */
@@ -1415,22 +1419,17 @@ H5HF_cache_dblock_serialize(const H5F_t *f, hid_t dxpl_id, haddr_t addr,
HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to free fractal heap direct block")
/* Allocate space for the compressed direct block */
- if(HADDR_UNDEF == (addr = H5MF_alloc(f, H5FD_MEM_FHEAP_DBLOCK, dxpl_id, (hsize_t)write_size)))
+ if(HADDR_UNDEF == (new_dblock_addr = H5MF_alloc(f, H5FD_MEM_FHEAP_DBLOCK, dxpl_id, (hsize_t)write_size)))
HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, "file allocation failed for fractal heap direct block")
- *flags |= H5AC__SERIALIZE_RESIZED_FLAG;
- *new_len = write_size;
-
/* Let the metadata cache know, if the block moved */
- if(!H5F_addr_eq(hdr->man_dtable.table_addr, addr)) {
- *flags |= H5AC__SERIALIZE_MOVED_FLAG;
- *new_addr = addr;
- } /* end if */
+ if(!H5F_addr_eq(addr, new_dblock_addr)) {
+ *new_addr = new_dblock_addr;
+ *flags |= H5AC__SERIALIZE_MOVED_FLAG;
+ } /* end if */
- /* Update information about compressed direct block's
- * location & size
- */
- hdr->man_dtable.table_addr = addr;
+ /* Update information about compressed direct block's location & size */
+ hdr->man_dtable.table_addr = new_dblock_addr;
hdr->pline_root_direct_size = write_size;
/* Note that heap header was modified */
@@ -1468,22 +1467,17 @@ H5HF_cache_dblock_serialize(const H5F_t *f, hid_t dxpl_id, haddr_t addr,
HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to free fractal heap direct block")
/* Allocate space for the compressed direct block */
- if(HADDR_UNDEF == (addr = H5MF_alloc(f, H5FD_MEM_FHEAP_DBLOCK, dxpl_id, (hsize_t)write_size)))
+ if(HADDR_UNDEF == (new_dblock_addr = H5MF_alloc(f, H5FD_MEM_FHEAP_DBLOCK, dxpl_id, (hsize_t)write_size)))
HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, "file allocation failed for fractal heap direct block")
- *flags |= H5AC__SERIALIZE_RESIZED_FLAG;
- *new_len = write_size;
-
/* Let the metadata cache know, if the block moved */
- if(!H5F_addr_eq(par_iblock->ents[par_entry].addr, addr)) {
+ if(!H5F_addr_eq(addr, new_dblock_addr)) {
+ *new_addr = new_dblock_addr;
*flags |= H5AC__SERIALIZE_MOVED_FLAG;
- *new_addr = addr;
} /* end if */
- /* Update information about compressed direct
- * block's location & size
- */
- par_iblock->ents[par_entry].addr = addr;
+ /* Update information about compressed direct block's location & size */
+ par_iblock->ents[par_entry].addr = new_dblock_addr;
par_iblock->filt_ents[par_entry].size = write_size;
/* Note that parent was modified */
@@ -1495,6 +1489,12 @@ H5HF_cache_dblock_serialize(const H5F_t *f, hid_t dxpl_id, haddr_t addr,
if(H5HF_iblock_dirty(par_iblock) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark heap header as dirty")
} /* end else */
+
+ /* Let the metadata cache know, if the block changed size */
+ if(len != write_size) {
+ *new_len = write_size;
+ *flags |= H5AC__SERIALIZE_RESIZED_FLAG;
+ } /* end if */
} /* end if */
else {
write_buf = dblock->blk;
diff --git a/src/H5HFdbg.c b/src/H5HFdbg.c
index e8ecdb4..151ab7b 100644
--- a/src/H5HFdbg.c
+++ b/src/H5HFdbg.c
@@ -441,7 +441,7 @@ H5HF_dblock_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream,
dblock->blk_off_size);
/* Allocate space for the free space markers */
- if(NULL == (marker = H5MM_calloc(dblock->size)))
+ if(NULL == (marker = (uint8_t *)H5MM_calloc(dblock->size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
/* Initialize the free space information for the heap */
diff --git a/src/H5HFdblock.c b/src/H5HFdblock.c
index 536df20..4adf07d 100644
--- a/src/H5HFdblock.c
+++ b/src/H5HFdblock.c
@@ -575,6 +575,7 @@ H5HF_man_dblock_locate(H5HF_hdr_t *hdr, hid_t dxpl_id, hsize_t obj_off,
HGOTO_ERROR(H5E_HEAP, H5E_CANTCOMPUTE, FAIL, "can't compute row & column of object")
HDassert(row < iblock->nrows); /* child must be smaller than parent */
} /* end while */
+ HDassert(obj_off >= iblock->block_off);
/* Set return parameters */
if(ret_entry)
diff --git a/src/H5HFhdr.c b/src/H5HFhdr.c
index 073d2a9..1d18eba 100644
--- a/src/H5HFhdr.c
+++ b/src/H5HFhdr.c
@@ -446,7 +446,7 @@ H5HF_hdr_create(H5F_t *f, hid_t dxpl_id, const H5HF_create_t *cparam)
*/
switch(cparam->id_len) {
case 0: /* Set the length of heap IDs to just enough to hold the offset & length of 'normal' objects in the heap */
- hdr->id_len = 1 + hdr->heap_off_size + hdr->heap_len_size;
+ hdr->id_len = (unsigned)1 + hdr->heap_off_size + hdr->heap_len_size;
break;
case 1: /* Set the length of heap IDs to just enough to hold the information needed to directly access 'huge' objects in the heap */
@@ -1233,7 +1233,7 @@ H5HF_hdr_reverse_iter(H5HF_hdr_t *hdr, hid_t dxpl_id, haddr_t dblock_addr)
/* Walk backwards through entries, until we find one that has a child */
/* (Skip direct block that will be deleted, if we find it) */
- tmp_entry = curr_entry;
+ tmp_entry = (int)curr_entry;
while(tmp_entry >= 0 &&
(H5F_addr_eq(iblock->ents[tmp_entry].addr, dblock_addr) ||
!H5F_addr_defined(iblock->ents[tmp_entry].addr)))
@@ -1268,7 +1268,8 @@ H5HF_hdr_reverse_iter(H5HF_hdr_t *hdr, hid_t dxpl_id, haddr_t dblock_addr)
else {
unsigned row; /* Row for entry */
- curr_entry = tmp_entry;
+ HDassert(tmp_entry >= 0);
+ curr_entry = (unsigned)tmp_entry;
/* Check if entry is for a direct block */
row = curr_entry / hdr->man_dtable.cparam.width;
diff --git a/src/H5HFman.c b/src/H5HFman.c
index 6d7dcde..8700fa4 100644
--- a/src/H5HFman.c
+++ b/src/H5HFman.c
@@ -147,11 +147,12 @@ H5HF_man_insert(H5HF_hdr_t *hdr, hid_t dxpl_id, size_t obj_size, const void *obj
/* Lock direct block */
if(NULL == (dblock = H5HF_man_dblock_protect(hdr, dxpl_id, dblock_addr, dblock_size, sec_node->u.single.parent, sec_node->u.single.par_entry, H5AC_WRITE)))
HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to load fractal heap direct block")
+ HDassert(dblock->parent == sec_node->u.single.parent);
/* Insert object into block */
/* Get the offset of the object within the block */
- blk_off = sec_node->sect_info.addr - dblock->block_off;
+ blk_off = (size_t)(sec_node->sect_info.addr - dblock->block_off);
/* Sanity checks */
HDassert(sec_node->sect_info.size >= obj_size);
@@ -299,6 +300,7 @@ H5HF_man_op_real(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id,
HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect fractal heap direct block")
} /* end if */
+ HDassert(dblock->parent == iblock);
/* Unlock indirect block */
if(H5HF_man_iblock_unprotect(iblock, dxpl_id, H5AC__NO_FLAGS_SET, did_protect) < 0)
@@ -307,6 +309,7 @@ H5HF_man_op_real(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id,
} /* end else */
/* Compute offset of object within block */
+ HDassert(obj_off >= dblock->block_off);
HDassert((obj_off - dblock->block_off) < (hsize_t)dblock_size);
blk_off = (size_t)(obj_off - dblock->block_off);
diff --git a/src/H5HFpkg.h b/src/H5HFpkg.h
index c741ed0..5662544 100644
--- a/src/H5HFpkg.h
+++ b/src/H5HFpkg.h
@@ -42,12 +42,6 @@
/* Package Private Macros */
/**************************/
-/* Set speculative read size for header message */
-#define H5HF_SPEC_READ_SIZE(f) ( \
- H5HF_HDR_SIZE(f) \
- + 50 \
-)
-
/* Size of signature information (on disk) */
#define H5HF_SIZEOF_MAGIC 4
@@ -67,13 +61,13 @@
)
/* Size of doubling-table information */
-#define H5HF_DTABLE_INFO_SIZE(h) ( \
+#define H5HF_DTABLE_INFO_SIZE(sizeof_addr, sizeof_size) ( \
2 /* Width of table (i.e. # of columns) */ \
- + (h)->sizeof_size /* Starting block size */ \
- + (h)->sizeof_size /* Maximum direct block size */ \
+ + sizeof_size /* Starting block size */ \
+ + sizeof_size /* Maximum direct block size */ \
+ 2 /* Max. size of heap (log2 of actual value - i.e. the # of bits) */ \
+ 2 /* Starting # of rows in root indirect block */ \
- + (h)->sizeof_addr /* File address of table managed */ \
+ + sizeof_addr /* File address of table managed */ \
+ 2 /* Current # of rows in root indirect block */ \
)
@@ -82,7 +76,7 @@
#define H5HF_HDR_FLAGS_CHECKSUM_DBLOCKS 0x02 /* checksum direct blocks */
/* Size of fractal heap header */
-#define H5HF_HDR_SIZE(f) ( \
+#define H5HF_HDR_SIZE(sizeof_addr, sizeof_size) ( \
/* General metadata fields */ \
H5HF_METADATA_PREFIX_SIZE(TRUE) \
\
@@ -95,75 +89,37 @@
\
/* "Huge" object fields */ \
+ 4 /* Max. size of "managed" object */ \
- + H5F_SIZEOF_SIZE(f) /* Next ID for "huge" object */ \
- + H5F_SIZEOF_ADDR(f) /* File address of "huge" object tracker B-tree */ \
+ + sizeof_size /* Next ID for "huge" object */ \
+ + sizeof_addr /* File address of "huge" object tracker B-tree */ \
\
/* "Managed" object free space fields */ \
- + H5F_SIZEOF_SIZE(f) /* Total man. free space */ \
- + H5F_SIZEOF_ADDR(f) /* File address of free section header */ \
+ + sizeof_size /* Total man. free space */ \
+ + sizeof_addr /* File address of free section header */ \
\
/* Statistics fields */ \
- + H5F_SIZEOF_SIZE(f) /* Size of man. space in heap */ \
- + H5F_SIZEOF_SIZE(f) /* Size of man. space iterator offset in heap */ \
- + H5F_SIZEOF_SIZE(f) /* Size of alloacted man. space in heap */ \
- + H5F_SIZEOF_SIZE(f) /* Number of man. objects in heap */ \
- + H5F_SIZEOF_SIZE(f) /* Size of huge space in heap */ \
- + H5F_SIZEOF_SIZE(f) /* Number of huge objects in heap */ \
- + H5F_SIZEOF_SIZE(f) /* Size of tiny space in heap */ \
- + H5F_SIZEOF_SIZE(f) /* Number of tiny objects in heap */ \
+ + sizeof_size /* Size of man. space in heap */ \
+ + sizeof_size /* Size of man. space iterator offset in heap */ \
+ + sizeof_size /* Size of alloacted man. space in heap */ \
+ + sizeof_size /* Number of man. objects in heap */ \
+ + sizeof_size /* Size of huge space in heap */ \
+ + sizeof_size /* Number of huge objects in heap */ \
+ + sizeof_size /* Size of tiny space in heap */ \
+ + sizeof_size /* Number of tiny objects in heap */ \
\
/* "Managed" object doubling table info */ \
- + 2 /* Width of table (i.e. # of columns) */ \
- + H5F_SIZEOF_SIZE(f) /* Starting block size */ \
- + H5F_SIZEOF_SIZE(f) /* Maximum direct block size */ \
- + 2 /* Max. size of heap (log2 of actual value - i.e. the # of bits) */ \
- + 2 /* Starting # of rows in root indirect block */ \
- + H5F_SIZEOF_ADDR(f) /* File address of table managed */ \
- + 2 /* Current # of rows in root indirect block */ \
+ + H5HF_DTABLE_INFO_SIZE(sizeof_addr, sizeof_size) /* Size of managed obj. doubling-table info */ \
)
/* Size of the fractal heap header on disk */
/* (this is the fixed-len portion, the variable-len I/O filter information
* follows this information, if there are I/O filters for the heap)
*/
-#define H5HF_HEADER_SIZE(h) ( \
- /* General metadata fields */ \
- H5HF_METADATA_PREFIX_SIZE(TRUE) \
- \
- /* Fractal Heap Header specific fields */ \
- \
- /* General heap information */ \
- + 2 /* Heap ID len */ \
- + 2 /* I/O filters' encoded len */ \
- + 1 /* Status flags */ \
- \
- /* "Huge" object fields */ \
- + 4 /* Max. size of "managed" object */ \
- + (h)->sizeof_size /* Next ID for "huge" object */ \
- + (h)->sizeof_addr /* File address of "huge" object tracker B-tree */ \
- \
- /* "Managed" object free space fields */ \
- + (h)->sizeof_size /* Total man. free space */ \
- + (h)->sizeof_addr /* File address of free section header */ \
- \
- /* Statistics fields */ \
- + (h)->sizeof_size /* Size of man. space in heap */ \
- + (h)->sizeof_size /* Size of man. space iterator offset in heap */ \
- + (h)->sizeof_size /* Size of alloacted man. space in heap */ \
- + (h)->sizeof_size /* Number of man. objects in heap */ \
- + (h)->sizeof_size /* Size of huge space in heap */ \
- + (h)->sizeof_size /* Number of huge objects in heap */ \
- + (h)->sizeof_size /* Size of tiny space in heap */ \
- + (h)->sizeof_size /* Number of tiny objects in heap */ \
- \
- /* "Managed" object doubling table info */ \
- + H5HF_DTABLE_INFO_SIZE(h) /* Size of managed obj. doubling-table info */ \
- )
+#define H5HF_HEADER_SIZE(h) H5HF_HDR_SIZE((h)->sizeof_addr, (h)->sizeof_size)
/* Size of overhead for a direct block */
#define H5HF_MAN_ABS_DIRECT_OVERHEAD(h) ( \
/* General metadata fields */ \
- H5HF_METADATA_PREFIX_SIZE(h->checksum_dblocks) \
+ (size_t)H5HF_METADATA_PREFIX_SIZE(h->checksum_dblocks) \
\
/* Fractal heap managed, absolutely mapped direct block specific fields */ \
+ (h)->sizeof_addr /* File address of heap owning the block */ \
diff --git a/src/H5HGcache.c b/src/H5HGcache.c
index 0b146eb..8ea4e96 100755
--- a/src/H5HGcache.c
+++ b/src/H5HGcache.c
@@ -141,8 +141,8 @@ H5HG_get_load_size(const void *_udata, size_t *image_len)
*
* Purpose: Deserialize the data structure from disk.
*
- * Return: Success: SUCCESS
- * Failure: FAIL
+ * Return: Success: Ptr to a global heap collection.
+ * Failure: NULL
*
* Programmer: Robb Matzke
* Friday, March 27, 1998
diff --git a/src/H5HLcache.c b/src/H5HLcache.c
index 4f7a304..03f4c0d 100644
--- a/src/H5HLcache.c
+++ b/src/H5HLcache.c
@@ -152,13 +152,14 @@ const H5AC_class_t H5AC_LHEAP_DBLK[1] = {{
static herr_t
H5HL_fl_deserialize(H5HL_t *heap, hsize_t free_block)
{
- H5HL_free_t *fl, *tail = NULL; /* Heap free block nodes */
+ H5HL_free_t *fl = NULL, *tail = NULL; /* Heap free block nodes */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5HL_fl_deserialize)
/* check arguments */
HDassert(heap);
+ HDassert(!heap->freelist);
/* Build free list */
while(H5HL_FREE_NULL != free_block) {
@@ -175,13 +176,6 @@ H5HL_fl_deserialize(H5HL_t *heap, hsize_t free_block)
fl->prev = tail;
fl->next = NULL;
- /* Insert node into list */
- if(tail)
- tail->next = fl;
- tail = fl;
- if(!heap->freelist)
- heap->freelist = fl;
-
/* Decode offset of next free block */
p = heap->dblk_image + free_block;
H5F_DECODE_LENGTH_LEN(p, free_block, heap->sizeof_size);
@@ -192,9 +186,21 @@ H5HL_fl_deserialize(H5HL_t *heap, hsize_t free_block)
H5F_DECODE_LENGTH_LEN(p, fl->size, heap->sizeof_size);
if((fl->offset + fl->size) > heap->dblk_size)
HGOTO_ERROR(H5E_HEAP, H5E_BADRANGE, FAIL, "bad heap free list")
+
+ /* Append node onto list */
+ if(tail)
+ tail->next = fl;
+ else
+ heap->freelist = fl;
+ tail = fl;
+ fl = NULL;
} /* end while */
done:
+ if(ret_value < 0)
+ if(fl)
+ fl = H5FL_FREE(H5HL_free_t, fl);
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5HL_fl_deserialize() */
@@ -278,8 +284,8 @@ H5HL_prfx_get_load_size(const void *_udata, size_t *image_len)
*
* Purpose: Deserialize the data structure from disk.
*
- * Return: Success: SUCCESS
- * Failure: FAIL
+ * Return: Success: Ptr to a local heap prefix.
+ * Failure: NULL
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
@@ -324,11 +330,11 @@ H5HL_prfx_deserialize(const void *image, size_t len, void *_udata,
/* Allocate space in memory for the heap */
if(NULL == (heap = H5HL_new(udata->sizeof_size, udata->sizeof_addr, udata->sizeof_prfx)))
- HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "memory allocation failed")
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "can't allocate local heap structure")
/* Allocate the heap prefix */
if(NULL == (prfx = H5HL_prfx_new(heap)))
- HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "memory allocation failed")
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "can't allocate local heap prefix")
/* Store the prefix's address & length */
heap->prfx_addr = udata->prfx_addr;
@@ -488,6 +494,11 @@ H5HL_prfx_serialize(const H5F_t UNUSED *f, hid_t UNUSED dxpl_id, haddr_t UNUSED
/* Serialize the free list into the heap data's image */
H5HL_fl_serialize(heap);
+ /* Set p to the start of the data block. This is necessary because
+ * there may be a gap between the used portion of the prefix and the
+ * data block due to alignment constraints. */
+ p = (uint8_t *)image + heap->prfx_size;
+
/* Copy the heap data block into the cache image */
HDmemcpy(p, heap->dblk_image, heap->dblk_size);
} /* end if */
@@ -570,8 +581,8 @@ H5HL_dblk_get_load_size(const void *_udata, size_t *image_len)
*
* Purpose: Deserialize the data structure from disk.
*
- * Return: Success: SUCCESS
- * Failure: FAIL
+ * Return: Success: Ptr to a local heap data block.
+ * Failure: NULL
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
@@ -585,7 +596,7 @@ H5HL_dblk_deserialize(const void *image, size_t UNUSED len,
{
H5HL_dblk_t *dblk = NULL; /* Local heap data block deserialized */
H5HL_cache_dblk_ud_t *udata = (H5HL_cache_dblk_ud_t *)_udata; /* User data for callback */
- H5HL_dblk_t *ret_value = NULL; /* Return value */
+ H5HL_dblk_t *ret_value; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5HL_dblk_deserialize)
diff --git a/src/H5L.c b/src/H5L.c
index 2302da6..c5d8d13 100644
--- a/src/H5L.c
+++ b/src/H5L.c
@@ -564,7 +564,7 @@ H5Lcreate_ud(hid_t link_loc_id, const char *link_name, H5L_type_t link_type,
HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link")
done:
- FUNC_LEAVE_API_META(ret_value);
+ FUNC_LEAVE_API_META(ret_value)
} /* end H5Lcreate_ud() */
diff --git a/src/H5Ocache.c b/src/H5Ocache.c
index e1dc382..7943684 100644
--- a/src/H5Ocache.c
+++ b/src/H5Ocache.c
@@ -66,14 +66,14 @@
/********************/
/* Metadata cache callbacks */
-static herr_t H5O_cache_get_load_size(const void *_udata, size_t *image_len);
-static void *H5O_cache_deserialize(const void *image, size_t len,
+static herr_t H5O_cache_prfx_get_load_size(const void *_udata, size_t *image_len);
+static void *H5O_cache_prfx_deserialize(const void *image, size_t len,
void *udata, hbool_t *dirty);
-static herr_t H5O_cache_image_len(const void *thing, size_t *image_len);
-static herr_t H5O_cache_serialize(const H5F_t *f, hid_t dxpl_id, haddr_t addr,
+static herr_t H5O_cache_prfx_image_len(const void *thing, size_t *image_len);
+static herr_t H5O_cache_prfx_serialize(const H5F_t *f, hid_t dxpl_id, haddr_t addr,
size_t len, void *image, void *thing, unsigned *flags, haddr_t *new_addr,
size_t *new_len, void **new_image);
-static herr_t H5O_cache_free_icr(void *thing);
+static herr_t H5O_cache_prfx_free_icr(void *thing);
static herr_t H5O_cache_chk_get_load_size(const void *_udata, size_t *image_len);
static void *H5O_cache_chk_deserialize(const void *image, size_t len,
@@ -105,14 +105,14 @@ static herr_t H5O_add_cont_msg(H5O_cont_msgs_t *cont_msg_info,
/* H5O object header prefix inherits cache-like properties from H5AC */
const H5AC_class_t H5AC_OHDR[1] = {{
H5AC_OHDR_ID,
- "object header",
+ "object header prefix",
H5FD_MEM_OHDR,
H5AC__CLASS_SPECULATIVE_LOAD_FLAG,
- H5O_cache_get_load_size,
- H5O_cache_deserialize,
- H5O_cache_image_len,
- H5O_cache_serialize,
- H5O_cache_free_icr,
+ H5O_cache_prfx_get_load_size,
+ H5O_cache_prfx_deserialize,
+ H5O_cache_prfx_image_len,
+ H5O_cache_prfx_serialize,
+ H5O_cache_prfx_free_icr,
}};
/* H5O object header chunk inherits cache-like properties from H5AC */
@@ -150,7 +150,7 @@ H5FL_SEQ_DEFINE(H5O_cont_t);
/*-------------------------------------------------------------------------
- * Function: H5O_cache_get_load_size
+ * Function: H5O_cache_prfx_get_load_size
*
* Purpose: Compute the size of the data structure on disk.
*
@@ -163,11 +163,11 @@ H5FL_SEQ_DEFINE(H5O_cont_t);
*-------------------------------------------------------------------------
*/
static herr_t
-H5O_cache_get_load_size(const void *_udata, size_t *image_len)
+H5O_cache_prfx_get_load_size(const void *_udata, size_t *image_len)
{
const H5O_cache_ud_t *udata = (const H5O_cache_ud_t *)_udata; /* User data for callback */
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_cache_get_load_size)
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_cache_prfx_get_load_size)
/* Check arguments */
HDassert(udata);
@@ -177,11 +177,11 @@ H5O_cache_get_load_size(const void *_udata, size_t *image_len)
*image_len = H5O_SPEC_READ_SIZE;
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5O_cache_get_load_size() */
+} /* end H5O_cache_prfx_get_load_size() */
/*-------------------------------------------------------------------------
- * Function: H5O_cache_deserialize
+ * Function: H5O_cache_prfx_deserialize
*
* Purpose: Deserializes an object header prefix + first chunk
*
@@ -195,7 +195,7 @@ H5O_cache_get_load_size(const void *_udata, size_t *image_len)
*-------------------------------------------------------------------------
*/
static void *
-H5O_cache_deserialize(const void *image, size_t len, void *_udata,
+H5O_cache_prfx_deserialize(const void *image, size_t len, void *_udata,
hbool_t *dirty)
{
H5O_t *oh = NULL; /* Object header info */
@@ -204,7 +204,7 @@ H5O_cache_deserialize(const void *image, size_t len, void *_udata,
size_t prefix_size; /* Size of object header prefix */
H5O_t *ret_value; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT(H5O_cache_deserialize)
+ FUNC_ENTER_NOAPI_NOINIT(H5O_cache_prfx_deserialize)
/* Check arguments */
HDassert(len > 0);
@@ -362,11 +362,11 @@ done:
HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, NULL, "unable to destroy object header data")
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_cache_deserialize() */
+} /* end H5O_cache_prfx_deserialize() */
/*-------------------------------------------------------------------------
- * Function: H5O_cache_image_len
+ * Function: H5O_cache_prfx_image_len
*
* Purpose: Compute the size of the data structure on disk.
*
@@ -379,11 +379,11 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5O_cache_image_len(const void *thing, size_t *image_len)
+H5O_cache_prfx_image_len(const void *thing, size_t *image_len)
{
const H5O_t *oh = (const H5O_t *)thing; /* The object header */
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_cache_image_len)
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_cache_prfx_image_len)
/* Check arguments */
HDassert(oh);
@@ -396,11 +396,11 @@ H5O_cache_image_len(const void *thing, size_t *image_len)
*image_len = oh->chunk[0].size;
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5O_cache_image_len() */
+} /* end H5O_cache_prfx_image_len() */
/*-------------------------------------------------------------------------
- * Function: H5O_cache_serialize
+ * Function: H5O_cache_prfx_serialize
*
* Purpose: Serializes an object header prefix+first chunk
*
@@ -413,7 +413,7 @@ H5O_cache_image_len(const void *thing, size_t *image_len)
*-------------------------------------------------------------------------
*/
static herr_t
-H5O_cache_serialize(const H5F_t *f, hid_t UNUSED dxpl_id, haddr_t UNUSED addr,
+H5O_cache_prfx_serialize(const H5F_t *f, hid_t UNUSED dxpl_id, haddr_t UNUSED addr,
size_t UNUSED len, void *image, void *_thing, unsigned *flags,
haddr_t UNUSED *new_addr, size_t UNUSED *new_len, void UNUSED **new_image)
{
@@ -421,7 +421,7 @@ H5O_cache_serialize(const H5F_t *f, hid_t UNUSED dxpl_id, haddr_t UNUSED addr,
uint8_t *p; /* Pointer into raw data buffer */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5O_cache_serialize, FAIL)
+ FUNC_ENTER_NOAPI_NOINIT(H5O_cache_prfx_serialize)
/* check arguments */
HDassert(f);
@@ -429,6 +429,10 @@ H5O_cache_serialize(const H5F_t *f, hid_t UNUSED dxpl_id, haddr_t UNUSED addr,
HDassert(oh);
HDassert(flags);
+#ifdef H5O_DEBUG
+H5O_assert(oh);
+#endif /* H5O_DEBUG */
+
/* Get temporary pointer to chunk zero's buffer */
p = oh->chunk[0].image;
@@ -442,8 +446,8 @@ H5O_cache_serialize(const H5F_t *f, hid_t UNUSED dxpl_id, haddr_t UNUSED addr,
HDassert(oh->chunk[0].size >= (size_t)H5O_SIZEOF_HDR(oh));
chunk0_size = oh->chunk[0].size - (size_t)H5O_SIZEOF_HDR(oh);
- /* Magic number */
- HDmemcpy(p, H5O_HDR_MAGIC, (size_t)H5O_SIZEOF_MAGIC);
+ /* Verify magic number */
+ HDassert(!HDmemcmp(p, H5O_HDR_MAGIC, H5O_SIZEOF_MAGIC));
p += H5O_SIZEOF_MAGIC;
/* Version */
@@ -528,11 +532,11 @@ H5O_cache_serialize(const H5F_t *f, hid_t UNUSED dxpl_id, haddr_t UNUSED addr,
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5O_cache_serialize() */
+} /* H5O_cache_prfx_serialize() */
/*-------------------------------------------------------------------------
- * Function: H5O_cache_free_icr
+ * Function: H5O_cache_prfx_free_icr
*
* Purpose: Destroy/release an "in core representation" of a data
* structure
@@ -547,12 +551,12 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5O_cache_free_icr(void *thing)
+H5O_cache_prfx_free_icr(void *thing)
{
H5O_t *oh = (H5O_t *)thing; /* Object header to destroy */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT(H5O_cache_free_icr)
+ FUNC_ENTER_NOAPI_NOINIT(H5O_cache_prfx_free_icr)
/* Check arguments */
HDassert(oh);
@@ -564,7 +568,7 @@ H5O_cache_free_icr(void *thing)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5O_cache_free_icr() */
+} /* H5O_cache_prfx_free_icr() */
/*-------------------------------------------------------------------------
@@ -632,7 +636,7 @@ H5O_cache_chk_deserialize(const void *image, size_t len, void *_udata,
if(NULL == (chk_proxy = H5FL_CALLOC(H5O_chunk_proxy_t)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTALLOC, NULL, "memory allocation failed")
- /* Check if we are still decoding the object header */
+ /* Check if we are still decoding the object header */
/* (as opposed to bringing a piece of it back from the file) */
if(udata->decoding) {
/* Sanity check */
@@ -731,7 +735,7 @@ H5O_cache_chk_serialize(const H5F_t *f, hid_t UNUSED dxpl_id,
H5O_chunk_proxy_t *chk_proxy = (H5O_chunk_proxy_t *)_thing; /* Pointer to the object header chunk proxy */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5O_cache_chk_serialize, FAIL)
+ FUNC_ENTER_NOAPI_NOINIT(H5O_cache_chk_serialize)
/* check arguments */
HDassert(f);
diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c
index be8a17d..a7f936e 100644
--- a/src/H5Pfapl.c
+++ b/src/H5Pfapl.c
@@ -216,10 +216,6 @@ H5P_facc_reg_prop(H5P_genclass_t *pclass)
if(H5P_register(pclass, H5F_ACS_META_CACHE_INIT_CONFIG_NAME, H5F_ACS_META_CACHE_INIT_CONFIG_SIZE, &mdc_initCacheCfg, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
- /* Register the initial journaling configuration */
- if(H5P_register(pclass, H5F_ACS_JNL_INIT_CONFIG_NAME, H5F_ACS_JNL_INIT_CONFIG_SIZE, &initJnlCfg, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
-
/* Register the size of raw data chunk cache (elements) */
if(H5P_register(pclass, H5F_ACS_DATA_CACHE_ELMT_SIZE_NAME, H5F_ACS_DATA_CACHE_ELMT_SIZE_SIZE, &rdcc_nelmts, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
@@ -288,6 +284,10 @@ H5P_facc_reg_prop(H5P_genclass_t *pclass)
if(H5P_register(pclass, H5F_ACS_LATEST_FORMAT_NAME, H5F_ACS_LATEST_FORMAT_SIZE, &latest_format, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
+ /* Register the initial journaling configuration */
+ if(H5P_register(pclass, H5F_ACS_JNL_INIT_CONFIG_NAME, H5F_ACS_JNL_INIT_CONFIG_SIZE, &initJnlCfg, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
+
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P_facc_reg_prop() */
diff --git a/src/H5SMcache.c b/src/H5SMcache.c
index f518399..9e41646 100644
--- a/src/H5SMcache.c
+++ b/src/H5SMcache.c
@@ -143,8 +143,8 @@ H5SM_table_get_load_size(const void *_udata, size_t *image_len)
*
* Purpose: Deserialize the data structure from disk.
*
- * Return: Success: SUCCEED
- * Failure: FAIL
+ * Return: Success: Pointer to a new shared message master table
+ * Failure: NULL
*
* Programmer: James Laird
* November 6, 2006
@@ -444,8 +444,8 @@ H5SM_list_get_load_size(const void *_udata, size_t *image_len)
*
* Purpose: Deserialize the data structure from disk.
*
- * Return: Success: SUCCEED
- * Failure: FAIL
+ * Return: Success: Pointer to a new shared message list
+ * Failure: NULL
*
* Programmer: James Laird
* November 6, 2006