summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--perform/benchpar.c18
-rw-r--r--src/H5AC.c105
-rw-r--r--src/H5B.c7
-rw-r--r--src/H5B2cache.c32
-rw-r--r--src/H5B2hdr.c11
-rw-r--r--src/H5B2pkg.h5
-rw-r--r--src/H5B2stat.c2
-rw-r--r--src/H5C.c104
-rw-r--r--src/H5Cpkg.h37
-rw-r--r--src/H5Dchunk.c3
-rw-r--r--src/H5FS.c9
-rw-r--r--src/H5FScache.c28
-rw-r--r--src/H5FSpkg.h5
-rw-r--r--src/H5Fpublic.h1
-rw-r--r--src/H5Gcache.c37
-rw-r--r--src/H5Gnode.c41
-rw-r--r--src/H5Gpkg.h19
-rw-r--r--src/H5HFcache.c2
-rw-r--r--src/H5HFiblock.c6
-rw-r--r--src/H5HFpkg.h7
-rw-r--r--src/H5HL.c24
-rw-r--r--src/H5O.c3
-rw-r--r--src/H5Ocache.c5
-rwxr-xr-xsrc/H5SM.c68
-rw-r--r--src/H5SMcache.c66
-rwxr-xr-xsrc/H5SMpkg.h34
-rw-r--r--src/H5SMtest.c1
-rw-r--r--test/cache.c246
-rw-r--r--test/cache_api.c520
-rw-r--r--test/cache_common.c576
-rw-r--r--test/cache_common.h148
-rw-r--r--testpar/t_cache.c360
32 files changed, 1126 insertions, 1404 deletions
diff --git a/perform/benchpar.c b/perform/benchpar.c
index 3ebbe6b..035e9d6 100644
--- a/perform/benchpar.c
+++ b/perform/benchpar.c
@@ -167,9 +167,9 @@ int main(int argc, char *argv[])
int curr_arg; /* Current command line argument being processed */
int rank; /* Number of dimensions of the dataset */
hsize_t dim_size; /* Dimension size of each dimension */
- hsize_t *dims; /* Pointer to array of dimensions */
- hssize_t *start; /* Pointer to array of starting locations for hyperslab selection */
- hsize_t *count; /* Pointer to array of counts for hyperslab selection */
+ hsize_t dims[H5S_MAX_RANK]; /* Pointer to array of dimensions */
+ hsize_t start[H5S_MAX_RANK]; /* Pointer to array of starting locations for hyperslab selection */
+ hsize_t count[H5S_MAX_RANK]; /* Pointer to array of counts for hyperslab selection */
unsigned slice_dim; /* Dimension to slice up */
char *file_name=NULL; /* Name of file to put data into */
hid_t fcpl; /* HDF5 File creation property list ID */
@@ -365,8 +365,6 @@ int main(int argc, char *argv[])
assert(ret>=0);
/* Create dataspace for dataset on disk */
- dims=malloc(sizeof(hsize_t)*rank);
- assert(dims);
for(i=0; i<rank; i++)
dims[i]=dim_size;
@@ -394,10 +392,6 @@ int main(int argc, char *argv[])
assert(ret>=0);
/* Select hyperslab for file dataspace */
- start=malloc(sizeof(hssize_t)*rank);
- assert(start);
- count=malloc(sizeof(hsize_t)*rank);
- assert(count);
for(i=0; i<rank; i++) {
start[i]=0;
count[i]=dim_size;
@@ -494,12 +488,6 @@ done:
free(file_name);
if(buf)
free(buf);
- if(dims)
- free(dims);
- if(start)
- free(start);
- if(count)
- free(count);
/* MPI termination */
MPI_Finalize();
diff --git a/src/H5AC.c b/src/H5AC.c
index 4add188..e3994e5 100644
--- a/src/H5AC.c
+++ b/src/H5AC.c
@@ -157,9 +157,7 @@ static herr_t H5AC_log_flushed_entry_dummy(H5C_t * cache_ptr,
static herr_t H5AC_log_inserted_entry(H5F_t * f,
H5AC_t * cache_ptr,
- H5AC_info_t * entry_ptr,
- const H5AC_class_t * type,
- haddr_t addr);
+ H5AC_info_t * entry_ptr);
static herr_t H5AC_propagate_flushed_and_still_clean_entries_list(H5F_t * f,
hid_t dxpl_id,
@@ -985,7 +983,6 @@ H5AC_set(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr,
void *thing, unsigned int flags)
{
herr_t result;
- H5AC_info_t *info;
#ifdef H5_HAVE_PARALLEL
H5AC_aux_t * aux_ptr = NULL;
#endif /* H5_HAVE_PARALLEL */
@@ -1032,74 +1029,43 @@ H5AC_set(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr,
}
#endif /* H5AC__TRACE_FILE_ENABLED */
- /* Get local copy of this information */
- info = (H5AC_info_t *)thing;
-
- info->addr = addr;
- info->type = type;
- info->is_protected = FALSE;
-
-#ifdef H5_HAVE_PARALLEL
- if ( NULL != (aux_ptr = f->shared->cache->aux_ptr) ) {
-
- result = H5AC_log_inserted_entry(f,
- f->shared->cache,
- (H5AC_info_t *)thing,
- type,
- addr);
-
- if ( result < 0 ) {
-
- HGOTO_ERROR(H5E_CACHE, H5E_CANTINS, FAIL, \
- "H5AC_log_inserted_entry() failed.")
- }
- }
-#endif /* H5_HAVE_PARALLEL */
-
- result = H5C_insert_entry(f,
- dxpl_id,
- H5AC_noblock_dxpl_id,
- type,
- addr,
- thing,
- flags);
-
- if ( result < 0 ) {
-
+ /* Insert entry into metadata cache */
+ if(H5C_insert_entry(f, dxpl_id, H5AC_noblock_dxpl_id, type, addr, thing, flags) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTINS, FAIL, "H5C_insert_entry() failed")
- }
#if H5AC__TRACE_FILE_ENABLED
- if ( trace_file_ptr != NULL ) {
-
+ if(trace_file_ptr != NULL) {
/* make note of the entry size */
trace_entry_size = ((H5C_cache_entry_t *)thing)->size;
}
#endif /* H5AC__TRACE_FILE_ENABLED */
#ifdef H5_HAVE_PARALLEL
- /* Check if we should try to flush */
- if(aux_ptr && (aux_ptr->dirty_bytes >= aux_ptr->dirty_bytes_threshold)) {
- hbool_t evictions_enabled;
-
- /* Query if evictions are allowed */
- if(H5C_get_evictions_enabled((const H5C_t *)f->shared->cache, &evictions_enabled) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "H5C_get_evictions_enabled() failed.")
-
- /* Flush if evictions are allowed */
- if(evictions_enabled) {
- if(H5AC_propagate_flushed_and_still_clean_entries_list(f,
- H5AC_noblock_dxpl_id, f->shared->cache, TRUE) < 0 )
- HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't propagate clean entries list.")
+ if(NULL != (aux_ptr = f->shared->cache->aux_ptr)) {
+ if(H5AC_log_inserted_entry(f, f->shared->cache, (H5AC_info_t *)thing) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTINS, FAIL, "H5AC_log_inserted_entry() failed")
+
+ /* Check if we should try to flush */
+ if(aux_ptr->dirty_bytes >= aux_ptr->dirty_bytes_threshold) {
+ hbool_t evictions_enabled;
+
+ /* Query if evictions are allowed */
+ if(H5C_get_evictions_enabled((const H5C_t *)f->shared->cache, &evictions_enabled) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "H5C_get_evictions_enabled() failed.")
+
+ /* Flush if evictions are allowed */
+ if(evictions_enabled) {
+ if(H5AC_propagate_flushed_and_still_clean_entries_list(f,
+ H5AC_noblock_dxpl_id, f->shared->cache, TRUE) < 0 )
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't propagate clean entries list.")
+ } /* end if */
} /* end if */
} /* end if */
#endif /* H5_HAVE_PARALLEL */
done:
-
#if H5AC__TRACE_FILE_ENABLED
- if ( trace_file_ptr != NULL ) {
-
+ if(trace_file_ptr != NULL) {
HDfprintf(trace_file_ptr, "%s %d %d\n", trace,
(int)trace_entry_size,
(int)ret_value);
@@ -1107,7 +1073,6 @@ done:
#endif /* H5AC__TRACE_FILE_ENABLED */
FUNC_LEAVE_NOAPI(ret_value)
-
} /* H5AC_set() */
@@ -3397,12 +3362,9 @@ done:
static herr_t
H5AC_log_inserted_entry(H5F_t * f,
H5AC_t * cache_ptr,
- H5AC_info_t * entry_ptr,
- const H5AC_class_t * type,
- haddr_t addr)
+ H5AC_info_t * entry_ptr)
{
herr_t ret_value = SUCCEED; /* Return value */
- size_t size;
H5AC_aux_t * aux_ptr = NULL;
H5AC_slist_entry_t * slist_entry_ptr = NULL;
@@ -3417,24 +3379,13 @@ H5AC_log_inserted_entry(H5F_t * f,
HDassert( aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC );
HDassert( entry_ptr != NULL );
- HDassert( entry_ptr->addr == addr );
- HDassert( entry_ptr->type == type );
-
- /* the size field of the entry will not have been set yet, so we
- * have to obtain it directly.
- */
- if ( (type->size)(f, (void *)entry_ptr, &size) < 0 ) {
-
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGETSIZE, FAIL, \
- "Can't get size of entry to be inserted.")
- }
if ( aux_ptr->mpi_rank == 0 ) {
HDassert( aux_ptr->d_slist_ptr != NULL );
HDassert( aux_ptr->c_slist_ptr != NULL );
- if ( H5SL_search(aux_ptr->d_slist_ptr, (void *)(&addr)) == NULL ) {
+ if ( H5SL_search(aux_ptr->d_slist_ptr, (void *)(&entry_ptr->addr)) == NULL ) {
/* insert the address of the entry in the dirty entry list, and
* add its size to the dirty_bytes count.
@@ -3446,7 +3397,7 @@ H5AC_log_inserted_entry(H5F_t * f,
}
slist_entry_ptr->magic = H5AC__H5AC_SLIST_ENTRY_T_MAGIC;
- slist_entry_ptr->addr = addr;
+ slist_entry_ptr->addr = entry_ptr->addr;
if ( H5SL_insert(aux_ptr->d_slist_ptr, slist_entry_ptr,
&(slist_entry_ptr->addr)) < 0 ) {
@@ -3463,14 +3414,14 @@ H5AC_log_inserted_entry(H5F_t * f,
"Inserted entry already in dirty slist.")
}
- if ( H5SL_search(aux_ptr->c_slist_ptr, (void *)(&addr)) != NULL ) {
+ if ( H5SL_search(aux_ptr->c_slist_ptr, (void *)(&entry_ptr->addr)) != NULL ) {
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \
"Inserted entry in clean slist.")
}
}
- aux_ptr->dirty_bytes += size;
+ aux_ptr->dirty_bytes += entry_ptr->size;
#if H5AC_DEBUG_DIRTY_BYTES_CREATION
aux_ptr->insert_dirty_bytes += size;
diff --git a/src/H5B.c b/src/H5B.c
index 48a8c67..37d40bf 100644
--- a/src/H5B.c
+++ b/src/H5B.c
@@ -680,12 +680,11 @@ H5B_insert(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr,
new_bt->nchildren = 2;
new_bt->child[0] = old_root;
- HDmemcpy(H5B_NKEY(new_bt,shared,0), lt_key, shared->type->sizeof_nkey);
+ HDmemcpy(H5B_NKEY(new_bt, shared, 0), lt_key, shared->type->sizeof_nkey);
new_bt->child[1] = child;
- HDmemcpy(H5B_NKEY(new_bt,shared,1), md_key, shared->type->sizeof_nkey);
-
- HDmemcpy(H5B_NKEY(new_bt,shared,2), rt_key, shared->type->sizeof_nkey);
+ HDmemcpy(H5B_NKEY(new_bt, shared, 1), md_key, shared->type->sizeof_nkey);
+ HDmemcpy(H5B_NKEY(new_bt, shared, 2), rt_key, shared->type->sizeof_nkey);
/* Insert the modified copy of the old root into the file again */
if(H5AC_set(f, dxpl_id, H5AC_BT, addr, new_bt, H5AC__NO_FLAGS_SET) < 0)
diff --git a/src/H5B2cache.c b/src/H5B2cache.c
index a28811a..6a3b5da 100644
--- a/src/H5B2cache.c
+++ b/src/H5B2cache.c
@@ -157,7 +157,6 @@ H5B2_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata)
H5B2_create_t cparam; /* B-tree creation parameters */
H5B2_subid_t id; /* ID of B-tree class, as found in file */
uint16_t depth; /* Depth of B-tree */
- size_t size; /* Header size */
uint32_t stored_chksum; /* Stored metadata checksum value */
uint32_t computed_chksum; /* Computed metadata checksum value */
H5WB_t *wb = NULL; /* Wrapped buffer for header data */
@@ -174,22 +173,19 @@ H5B2_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata)
HDassert(udata);
/* Allocate new B-tree header and reset cache info */
- if(NULL == (hdr = H5B2_hdr_alloc(f)))
+ if(NULL == (hdr = H5B2_hdr_alloc(udata->f)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "allocation failed for B-tree header")
/* Wrap the local buffer for serialized header info */
if(NULL == (wb = H5WB_wrap(hdr_buf, sizeof(hdr_buf))))
HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, NULL, "can't wrap buffer")
- /* Compute the size of the serialized B-tree header on disk */
- size = H5B2_HEADER_SIZE(hdr);
-
/* Get a pointer to a buffer that's large enough for header */
- if(NULL == (buf = (uint8_t *)H5WB_actual(wb, size)))
+ if(NULL == (buf = (uint8_t *)H5WB_actual(wb, hdr->hdr_size)))
HGOTO_ERROR(H5E_BTREE, H5E_NOSPACE, NULL, "can't get actual buffer")
/* Read header from disk */
- if(H5F_block_read(f, H5FD_MEM_BTREE, addr, size, dxpl_id, buf) < 0)
+ if(H5F_block_read(f, H5FD_MEM_BTREE, addr, hdr->hdr_size, dxpl_id, buf) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_READERROR, NULL, "can't read B-tree header")
/* Get temporary pointer to serialized header */
@@ -231,10 +227,10 @@ H5B2_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata)
UINT32DECODE(p, stored_chksum);
/* Sanity check */
- HDassert((size_t)(p - (const uint8_t *)buf) == size);
+ HDassert((size_t)(p - (const uint8_t *)buf) == hdr->hdr_size);
/* Compute checksum on entire header */
- computed_chksum = H5_checksum_metadata(buf, (size - H5B2_SIZEOF_CHKSUM), 0);
+ computed_chksum = H5_checksum_metadata(buf, (hdr->hdr_size - H5B2_SIZEOF_CHKSUM), 0);
/* Verify checksum */
if(stored_chksum != computed_chksum)
@@ -242,7 +238,7 @@ H5B2_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata)
/* Initialize B-tree header info */
cparam.cls = H5B2_client_class_g[id];
- if(H5B2_hdr_init(udata->f, hdr, &cparam, udata->ctx_udata, depth) < 0)
+ if(H5B2_hdr_init(hdr, &cparam, udata->ctx_udata, depth) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, NULL, "can't initialize B-tree header info")
/* Set the B-tree header's address */
@@ -294,7 +290,6 @@ H5B2_cache_hdr_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr,
if(hdr->cache_info.is_dirty) {
uint8_t *buf; /* Pointer to header buffer */
uint8_t *p; /* Pointer into raw data buffer */
- size_t size; /* Header size on disk */
uint32_t metadata_chksum; /* Computed metadata checksum value */
/* Set the B-tree header's file context for this operation */
@@ -304,11 +299,8 @@ H5B2_cache_hdr_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr,
if(NULL == (wb = H5WB_wrap(hdr_buf, sizeof(hdr_buf))))
HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "can't wrap buffer")
- /* Compute the size of the serialized B-tree header on disk */
- size = H5B2_HEADER_SIZE(hdr);
-
/* Get a pointer to a buffer that's large enough for header */
- if(NULL == (buf = (uint8_t *)H5WB_actual(wb, size)))
+ if(NULL == (buf = (uint8_t *)H5WB_actual(wb, hdr->hdr_size)))
HGOTO_ERROR(H5E_BTREE, H5E_NOSPACE, FAIL, "can't get actual buffer")
/* Get temporary pointer to serialized header */
@@ -345,14 +337,14 @@ H5B2_cache_hdr_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr,
H5F_ENCODE_LENGTH(f, p, hdr->root.all_nrec);
/* Compute metadata checksum */
- metadata_chksum = H5_checksum_metadata(buf, (size - H5B2_SIZEOF_CHKSUM), 0);
+ metadata_chksum = H5_checksum_metadata(buf, (hdr->hdr_size - H5B2_SIZEOF_CHKSUM), 0);
/* Metadata checksum */
UINT32ENCODE(p, metadata_chksum);
/* Write the B-tree header. */
- HDassert((size_t)(p - buf) == size);
- if(H5F_block_write(f, H5FD_MEM_BTREE, addr, size, dxpl_id, buf) < 0)
+ HDassert((size_t)(p - buf) == hdr->hdr_size);
+ if(H5F_block_write(f, H5FD_MEM_BTREE, addr, hdr->hdr_size, dxpl_id, buf) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTFLUSH, FAIL, "unable to save B-tree header to disk")
hdr->cache_info.is_dirty = FALSE;
@@ -402,7 +394,7 @@ H5B2_cache_hdr_dest(H5F_t *f, H5B2_hdr_t *hdr)
if(hdr->cache_info.free_file_space_on_destroy) {
/* Release the space on disk */
/* (XXX: Nasty usage of internal DXPL value! -QAK) */
- if(H5MF_xfree(f, H5FD_MEM_BTREE, H5AC_dxpl_id, hdr->cache_info.addr, (hsize_t)H5B2_HEADER_SIZE(hdr)) < 0)
+ if(H5MF_xfree(f, H5FD_MEM_BTREE, H5AC_dxpl_id, hdr->cache_info.addr, (hsize_t)hdr->hdr_size) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, "unable to free v2 B-tree header")
} /* end if */
@@ -477,7 +469,7 @@ H5B2_cache_hdr_size(const H5F_t UNUSED *f, const H5B2_hdr_t *hdr, size_t *size_p
HDassert(size_ptr);
/* Set size value */
- *size_ptr = H5B2_HEADER_SIZE(hdr);
+ *size_ptr = hdr->hdr_size;
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5B2_cache_hdr_size() */
diff --git a/src/H5B2hdr.c b/src/H5B2hdr.c
index cbbfed6..94e2c54 100644
--- a/src/H5B2hdr.c
+++ b/src/H5B2hdr.c
@@ -107,8 +107,8 @@ H5FL_SEQ_DEFINE(H5B2_node_info_t);
*-------------------------------------------------------------------------
*/
herr_t
-H5B2_hdr_init(H5F_t *f, H5B2_hdr_t *hdr, const H5B2_create_t *cparam,
- void *ctx_udata, uint16_t depth)
+H5B2_hdr_init(H5B2_hdr_t *hdr, const H5B2_create_t *cparam, void *ctx_udata,
+ uint16_t depth)
{
size_t sz_max_nrec; /* Temporary variable for range checking */
unsigned u_max_nrec_size; /* Temporary variable for range checking */
@@ -120,7 +120,6 @@ H5B2_hdr_init(H5F_t *f, H5B2_hdr_t *hdr, const H5B2_create_t *cparam,
/*
* Check arguments.
*/
- HDassert(f);
HDassert(hdr);
HDassert(cparam);
HDassert(cparam->cls);
@@ -133,7 +132,6 @@ H5B2_hdr_init(H5F_t *f, H5B2_hdr_t *hdr, const H5B2_create_t *cparam,
HDassert(cparam->merge_percent < (cparam->split_percent / 2));
/* Initialize basic information */
- hdr->f = f;
hdr->rc = 0;
hdr->pending_delete = FALSE;
@@ -258,6 +256,7 @@ H5B2_hdr_alloc(H5F_t *f)
hdr->f = f;
hdr->sizeof_addr = H5F_SIZEOF_ADDR(f);
hdr->sizeof_size = H5F_SIZEOF_SIZE(f);
+ hdr->hdr_size = H5B2_HEADER_SIZE(hdr);
hdr->root.addr = HADDR_UNDEF;
/* Set return value */
@@ -302,11 +301,11 @@ H5B2_hdr_create(H5F_t *f, hid_t dxpl_id, const H5B2_create_t *cparam,
HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, HADDR_UNDEF, "allocation failed for B-tree header")
/* Initialize shared B-tree info */
- if(H5B2_hdr_init(f, hdr, cparam, ctx_udata, (uint16_t)0) < 0)
+ if(H5B2_hdr_init(hdr, cparam, ctx_udata, (uint16_t)0) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, HADDR_UNDEF, "can't create shared B-tree info")
/* Allocate space for the header on disk */
- if(HADDR_UNDEF == (hdr->addr = H5MF_alloc(f, H5FD_MEM_BTREE, dxpl_id, (hsize_t)H5B2_HEADER_SIZE(hdr))))
+ if(HADDR_UNDEF == (hdr->addr = H5MF_alloc(f, H5FD_MEM_BTREE, dxpl_id, (hsize_t)hdr->hdr_size)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, HADDR_UNDEF, "file allocation failed for B-tree header")
/* Cache the new B-tree node */
diff --git a/src/H5B2pkg.h b/src/H5B2pkg.h
index 35c2eb1..543fa3f 100644
--- a/src/H5B2pkg.h
+++ b/src/H5B2pkg.h
@@ -161,6 +161,7 @@ typedef struct H5B2_hdr_t {
/* Shared internal data structures (not stored) */
H5F_t *f; /* Pointer to the file that the B-tree is in */
haddr_t addr; /* Address of B-tree header in the file */
+ size_t hdr_size; /* Size of the B-tree header on disk */
size_t rc; /* Reference count of nodes using this header */
size_t file_rc; /* Reference count of files using this header */
hbool_t pending_delete; /* B-tree is pending deletion */
@@ -273,8 +274,8 @@ extern const H5B2_class_t *const H5B2_client_class_g[H5B2_NUM_BTREE_ID];
H5_DLL H5B2_hdr_t *H5B2_hdr_alloc(H5F_t *f);
H5_DLL haddr_t H5B2_hdr_create(H5F_t *f, hid_t dxpl_id,
const H5B2_create_t *cparam, void *ctx_udata);
-H5_DLL herr_t H5B2_hdr_init(H5F_t *f, H5B2_hdr_t *hdr,
- const H5B2_create_t *cparam, void *ctx_udata, uint16_t depth);
+H5_DLL herr_t H5B2_hdr_init(H5B2_hdr_t *hdr, const H5B2_create_t *cparam,
+ void *ctx_udata, uint16_t depth);
H5_DLL herr_t H5B2_hdr_incr(H5B2_hdr_t *hdr);
H5_DLL herr_t H5B2_hdr_decr(H5B2_hdr_t *hdr);
H5_DLL herr_t H5B2_hdr_fuse_incr(H5B2_hdr_t *hdr);
diff --git a/src/H5B2stat.c b/src/H5B2stat.c
index a15ff11..afd1e33 100644
--- a/src/H5B2stat.c
+++ b/src/H5B2stat.c
@@ -131,7 +131,7 @@ H5B2_size(H5B2_t *bt2, hid_t dxpl_id, hsize_t *btree_size)
hdr = bt2->hdr;
/* Add size of header to B-tree metadata total */
- *btree_size += H5B2_HEADER_SIZE(hdr);
+ *btree_size += hdr->hdr_size;
/* Iterate through records */
if(hdr->root.node_nrec > 0) {
diff --git a/src/H5C.c b/src/H5C.c
index 66653e9..98b0e4c 100644
--- a/src/H5C.c
+++ b/src/H5C.c
@@ -2003,13 +2003,10 @@ H5C_insert_entry(H5F_t * f,
/* not protected, so can't be dirtied */
entry_ptr->dirtied = FALSE;
- if ( (type->size)(f, thing, &(entry_ptr->size)) < 0 ) {
-
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGETSIZE, FAIL, \
- "Can't get size of thing")
- }
-
- HDassert( entry_ptr->size < H5C_MAX_ENTRY_SIZE );
+ /* Retrieve the size of the thing */
+ if((type->size)(f, thing, &(entry_ptr->size)) < 0)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGETSIZE, FAIL, "Can't get size of thing")
+ HDassert(entry_ptr->size > 0 && entry_ptr->size < H5C_MAX_ENTRY_SIZE);
entry_ptr->in_slist = FALSE;
@@ -4583,8 +4580,6 @@ H5C_unprotect(H5F_t * f,
#ifdef H5_HAVE_PARALLEL
hbool_t clear_entry = FALSE;
#endif /* H5_HAVE_PARALLEL */
- herr_t result;
- size_t size_increase = 0;
H5C_cache_entry_t * entry_ptr;
H5C_cache_entry_t * test_entry_ptr;
herr_t ret_value = SUCCEED; /* Return value */
@@ -7907,29 +7902,28 @@ H5C_load_entry(H5F_t * f,
hbool_t UNUSED skip_file_checks)
#endif /* NDEBUG */
{
- void * thing = NULL;
- H5C_cache_entry_t * entry_ptr = NULL;
- unsigned u; /* Local index variable */
- void * ret_value = NULL; /* Return value */
+ void * thing = NULL; /* Pointer to thing loaded */
+ H5C_cache_entry_t * entry; /* Alias for thing loaded, as cache entry */
+ unsigned u; /* Local index variable */
+ void * ret_value; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5C_load_entry)
- HDassert( f );
- HDassert( f->shared );
- HDassert( f->shared->cache );
- HDassert( skip_file_checks || f );
- HDassert( type );
- HDassert( type->load );
- HDassert( type->size );
- HDassert( H5F_addr_defined(addr) );
+ HDassert(f);
+ HDassert(f->shared);
+ HDassert(f->shared->cache);
+ HDassert(skip_file_checks || f);
+ HDassert(type);
+ HDassert(type->load);
+ HDassert(type->size);
+ HDassert(H5F_addr_defined(addr));
- if ( NULL == (thing = (type->load)(f, dxpl_id, addr, udata)) ) {
+ if(NULL == (thing = (type->load)(f, dxpl_id, addr, udata)))
HGOTO_ERROR(H5E_CACHE, H5E_CANTLOAD, NULL, "unable to load entry")
- }
- entry_ptr = (H5C_cache_entry_t *)thing;
+ entry = (H5C_cache_entry_t *)thing;
/* In general, an entry should be clean just after it is loaded.
*
@@ -7940,11 +7934,11 @@ H5C_load_entry(H5F_t * f,
*
* To support this bug fix, I have replace the old assert:
*
- * HDassert( entry_ptr->is_dirty == FALSE );
+ * HDassert( entry->is_dirty == FALSE );
*
* with:
*
- * HDassert( ( entry_ptr->is_dirty == FALSE ) || ( type->id == 5 ) );
+ * HDassert( ( entry->is_dirty == FALSE ) || ( type->id == 5 ) );
*
* Note that type id 5 is associated with object headers in the metadata
* cache.
@@ -7954,56 +7948,52 @@ H5C_load_entry(H5F_t * f,
* metadata cache.
*/
- HDassert( ( entry_ptr->is_dirty == FALSE ) || ( type->id == 5 ) );
+ HDassert( ( entry->is_dirty == FALSE ) || ( type->id == 5 ) );
#ifndef NDEBUG
- entry_ptr->magic = H5C__H5C_CACHE_ENTRY_T_MAGIC;
+ entry->magic = H5C__H5C_CACHE_ENTRY_T_MAGIC;
#endif /* NDEBUG */
- entry_ptr->cache_ptr = f->shared->cache;
- entry_ptr->addr = addr;
- entry_ptr->type = type;
- entry_ptr->is_protected = FALSE;
- entry_ptr->is_read_only = FALSE;
- entry_ptr->ro_ref_count = 0;
- entry_ptr->in_slist = FALSE;
- entry_ptr->flush_marker = FALSE;
+ entry->cache_ptr = f->shared->cache;
+ entry->addr = addr;
+ entry->type = type;
+ entry->is_protected = FALSE;
+ entry->is_read_only = FALSE;
+ entry->ro_ref_count = 0;
+ entry->in_slist = FALSE;
+ entry->flush_marker = FALSE;
#ifdef H5_HAVE_PARALLEL
- entry_ptr->clear_on_unprotect = FALSE;
+ entry->clear_on_unprotect = FALSE;
#endif /* H5_HAVE_PARALLEL */
- entry_ptr->flush_in_progress = FALSE;
- entry_ptr->destroy_in_progress = FALSE;
- entry_ptr->free_file_space_on_destroy = FALSE;
+ entry->flush_in_progress = FALSE;
+ entry->destroy_in_progress = FALSE;
+ entry->free_file_space_on_destroy = FALSE;
- if ( (type->size)(f, thing, &(entry_ptr->size)) < 0 ) {
+ if((type->size)(f, thing, &(entry->size)) < 0)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGETSIZE, NULL, \
- "Can't get size of thing")
- }
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGETSIZE, NULL, "Can't get size of thing")
- HDassert( entry_ptr->size < H5C_MAX_ENTRY_SIZE );
+ HDassert( entry->size < H5C_MAX_ENTRY_SIZE );
/* Initialize flush dependency height fields */
- entry_ptr->flush_dep_parent = NULL;
+ entry->flush_dep_parent = NULL;
for(u = 0; u < H5C__NUM_FLUSH_DEP_HEIGHTS; u++)
- entry_ptr->child_flush_dep_height_rc[u] = 0;
- entry_ptr->flush_dep_height = 0;
-
- entry_ptr->ht_next = NULL;
- entry_ptr->ht_prev = NULL;
+ entry->child_flush_dep_height_rc[u] = 0;
+ entry->flush_dep_height = 0;
+ entry->ht_next = NULL;
+ entry->ht_prev = NULL;
- entry_ptr->next = NULL;
- entry_ptr->prev = NULL;
+ entry->next = NULL;
+ entry->prev = NULL;
- entry_ptr->aux_next = NULL;
- entry_ptr->aux_prev = NULL;
+ entry->aux_next = NULL;
+ entry->aux_prev = NULL;
- H5C__RESET_CACHE_ENTRY_STATS(entry_ptr);
+ H5C__RESET_CACHE_ENTRY_STATS(entry);
ret_value = thing;
done:
FUNC_LEAVE_NOAPI(ret_value)
-
} /* H5C_load_entry() */
diff --git a/src/H5Cpkg.h b/src/H5Cpkg.h
index 9e99d29..678e0d0 100644
--- a/src/H5Cpkg.h
+++ b/src/H5Cpkg.h
@@ -3070,43 +3070,6 @@ if ( (cache_ptr)->index_size != \
*
* Programmer: John Mainzer, 5/17/04
*
- * Modifications:
- *
- * JRM - 7/27/04
- * Converted the function H5C_update_rp_for_move() to the
- * macro H5C__UPDATE_RP_FOR_MOVE in an effort to squeeze
- * a bit more performance out of the cache.
- *
- * At least for the first cut, I am leaving the comments and
- * white space in the macro. If they cause dificulties with
- * pre-processor, I'll have to remove them.
- *
- * JRM - 7/28/04
- * Split macro into two version, one supporting the clean and
- * dirty LRU lists, and the other not. Yet another attempt
- * at optimization.
- *
- * JRM - 6/23/05
- * Added the was_dirty parameter. It is possible that
- * the entry was clean when it was moved -- if so it
- * it is in the clean LRU regardless of the current
- * value of the is_dirty field.
- *
- * At present, all moved entries are forced to be
- * dirty. This macro is a bit more general that that,
- * to allow it to function correctly should that policy
- * be relaxed in the future.
- *
- * JRM - 3/17/06
- * Modified macro to do nothing if the entry is pinned.
- * In this case, the entry is on the pinned entry list, not
- * in the replacement policy data structures, so there is
- * nothing to be done.
- *
- * JRM - 3/28/07
- * Added sanity checks using the new is_read_only and
- * ro_ref_count fields of struct H5C_cache_entry_t.
- *
*-------------------------------------------------------------------------
*/
diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c
index f932a6c..da00d0a 100644
--- a/src/H5Dchunk.c
+++ b/src/H5Dchunk.c
@@ -51,6 +51,9 @@
/* Headers */
/***********/
#include "H5private.h" /* Generic Functions */
+#ifdef H5_HAVE_PARALLEL
+#include "H5ACprivate.h" /* Metadata cache */
+#endif /* H5_HAVE_PARALLEL */
#include "H5Dpkg.h" /* Dataset functions */
#include "H5Eprivate.h" /* Error handling */
#include "H5FLprivate.h" /* Free Lists */
diff --git a/src/H5FS.c b/src/H5FS.c
index 459b16f..84ecce8 100644
--- a/src/H5FS.c
+++ b/src/H5FS.c
@@ -123,7 +123,7 @@ HDfprintf(stderr, "%s: Creating free space manager, nclasses = %Zu\n", FUNC, ncl
/*
* Allocate free space structure
*/
- if(NULL == (fspace = H5FS_new(nclasses, classes, cls_init_udata)))
+ if(NULL == (fspace = H5FS_new(f, nclasses, classes, cls_init_udata)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for free space free list")
/* Initialize creation information for free space manager */
@@ -139,7 +139,7 @@ HDfprintf(stderr, "%s: Creating free space manager, nclasses = %Zu\n", FUNC, ncl
/* Check if the free space tracker is supposed to be persistant */
if(fs_addr) {
/* Allocate space for the free space header */
- if(HADDR_UNDEF == (fspace->addr = H5MF_alloc(f, H5FD_MEM_FSPACE_HDR, dxpl_id, (hsize_t)H5FS_HEADER_SIZE(f))))
+ if(HADDR_UNDEF == (fspace->addr = H5MF_alloc(f, H5FD_MEM_FSPACE_HDR, dxpl_id, (hsize_t)fspace->hdr_size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "file allocation failed for free space header")
/* Cache the new free space header (pinned) */
@@ -515,7 +515,7 @@ HDfprintf(stderr, "%s: Leaving, ret_value = %d, fspace->rc = %u\n", FUNC, ret_va
*-------------------------------------------------------------------------
*/
H5FS_t *
-H5FS_new(size_t nclasses, const H5FS_section_class_t *classes[],
+H5FS_new(const H5F_t *f, size_t nclasses, const H5FS_section_class_t *classes[],
void *cls_init_udata)
{
H5FS_t *fspace = NULL; /* Free space manager */
@@ -560,6 +560,7 @@ H5FS_new(size_t nclasses, const H5FS_section_class_t *classes[],
/* Initialize non-zero information for new free space manager */
fspace->addr = HADDR_UNDEF;
+ fspace->hdr_size = H5FS_HEADER_SIZE(f);
fspace->sect_addr = HADDR_UNDEF;
/* Set return value */
@@ -606,7 +607,7 @@ H5FS_size(const H5F_t *f, const H5FS_t *fspace, hsize_t *meta_size)
HDassert(meta_size);
/* Get the free space size info */
- *meta_size += H5FS_HEADER_SIZE(f) + (fspace->sinfo ? fspace->sect_size : fspace->alloc_sect_size);
+ *meta_size += fspace->hdr_size + (fspace->sinfo ? fspace->sect_size : fspace->alloc_sect_size);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5FS_size() */
diff --git a/src/H5FScache.c b/src/H5FScache.c
index 3d75881..17f8f6a 100644
--- a/src/H5FScache.c
+++ b/src/H5FScache.c
@@ -151,7 +151,6 @@ H5FS_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata)
{
H5FS_t *fspace = NULL; /* Free space header info */
H5FS_hdr_cache_ud_t *udata = (H5FS_hdr_cache_ud_t *)_udata; /* user data for callback */
- size_t size; /* Header size */
H5WB_t *wb = NULL; /* Wrapped buffer for header data */
uint8_t hdr_buf[H5FS_HDR_BUF_SIZE]; /* Buffer for header */
uint8_t *hdr; /* Pointer to header buffer */
@@ -168,7 +167,7 @@ H5FS_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata)
HDassert(udata);
/* Allocate a new free space manager */
- if(NULL == (fspace = H5FS_new(udata->nclasses, udata->classes, udata->cls_init_udata)))
+ if(NULL == (fspace = H5FS_new(udata->f, udata->nclasses, udata->classes, udata->cls_init_udata)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Set free space manager's internal information */
@@ -178,15 +177,12 @@ H5FS_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata)
if(NULL == (wb = H5WB_wrap(hdr_buf, sizeof(hdr_buf))))
HGOTO_ERROR(H5E_FSPACE, H5E_CANTINIT, NULL, "can't wrap buffer")
- /* Compute the size of the free space header on disk */
- size = (size_t)H5FS_HEADER_SIZE(udata->f);
-
/* Get a pointer to a buffer that's large enough for header */
- if(NULL == (hdr = (uint8_t *)H5WB_actual(wb, size)))
+ if(NULL == (hdr = (uint8_t *)H5WB_actual(wb, fspace->hdr_size)))
HGOTO_ERROR(H5E_FSPACE, H5E_NOSPACE, NULL, "can't get actual buffer")
/* Read header from disk */
- if(H5F_block_read(f, H5FD_MEM_FSPACE_HDR, addr, size, dxpl_id, hdr) < 0)
+ if(H5F_block_read(f, H5FD_MEM_FSPACE_HDR, addr, fspace->hdr_size, dxpl_id, hdr) < 0)
HGOTO_ERROR(H5E_FSPACE, H5E_READERROR, NULL, "can't read free space header")
p = hdr;
@@ -250,7 +246,7 @@ H5FS_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata)
/* Metadata checksum */
UINT32DECODE(p, stored_chksum);
- HDassert((size_t)(p - (const uint8_t *)hdr) == size);
+ HDassert((size_t)(p - (const uint8_t *)hdr) == fspace->hdr_size);
/* Verify checksum */
if(stored_chksum != computed_chksum)
@@ -341,17 +337,13 @@ H5FS_cache_hdr_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5F
uint8_t *hdr; /* Pointer to header buffer */
uint8_t *p; /* Pointer into raw data buffer */
uint32_t metadata_chksum; /* Computed metadata checksum value */
- size_t size; /* Header size on disk */
/* Wrap the local buffer for serialized header info */
if(NULL == (wb = H5WB_wrap(hdr_buf, sizeof(hdr_buf))))
HGOTO_ERROR(H5E_FSPACE, H5E_CANTINIT, FAIL, "can't wrap buffer")
- /* Compute the size of the free space header on disk */
- size = (size_t)H5FS_HEADER_SIZE(f);
-
/* Get a pointer to a buffer that's large enough for header */
- if(NULL == (hdr = (uint8_t *)H5WB_actual(wb, size)))
+ if(NULL == (hdr = (uint8_t *)H5WB_actual(wb, fspace->hdr_size)))
HGOTO_ERROR(H5E_FSPACE, H5E_NOSPACE, FAIL, "can't get actual buffer")
/* Get temporary pointer to header */
@@ -410,8 +402,8 @@ H5FS_cache_hdr_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5F
UINT32ENCODE(p, metadata_chksum);
/* Write the free space header. */
- HDassert((size_t)(p - hdr) == size);
- if(H5F_block_write(f, H5FD_MEM_FSPACE_HDR, addr, size, dxpl_id, hdr) < 0)
+ HDassert((size_t)(p - hdr) == fspace->hdr_size);
+ if(H5F_block_write(f, H5FD_MEM_FSPACE_HDR, addr, fspace->hdr_size, dxpl_id, hdr) < 0)
HGOTO_ERROR(H5E_FSPACE, H5E_CANTFLUSH, FAIL, "unable to save free space header to disk")
fspace->cache_info.is_dirty = FALSE;
@@ -466,7 +458,7 @@ H5FS_cache_hdr_dest(H5F_t *f, H5FS_t *fspace)
/* Release the space on disk */
/* (XXX: Nasty usage of internal DXPL value! -QAK) */
- if(H5MF_xfree(f, H5FD_MEM_FSPACE_HDR, H5AC_dxpl_id, fspace->cache_info.addr, (hsize_t)H5FS_HEADER_SIZE(f)) < 0)
+ if(H5MF_xfree(f, H5FD_MEM_FSPACE_HDR, H5AC_dxpl_id, fspace->cache_info.addr, (hsize_t)fspace->hdr_size) < 0)
HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "unable to free free space header")
} /* end if */
@@ -532,7 +524,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5FS_cache_hdr_size(const H5F_t *f, const H5FS_t UNUSED *fspace, size_t *size_ptr)
+H5FS_cache_hdr_size(const H5F_t UNUSED *f, const H5FS_t *fspace, size_t *size_ptr)
{
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5FS_cache_hdr_size)
@@ -542,7 +534,7 @@ H5FS_cache_hdr_size(const H5F_t *f, const H5FS_t UNUSED *fspace, size_t *size_pt
HDassert(size_ptr);
/* Set size value */
- *size_ptr = (size_t)H5FS_HEADER_SIZE(f);
+ *size_ptr = fspace->hdr_size;
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5FS_cache_hdr_size() */
diff --git a/src/H5FSpkg.h b/src/H5FSpkg.h
index af07067..e22e411 100644
--- a/src/H5FSpkg.h
+++ b/src/H5FSpkg.h
@@ -177,6 +177,7 @@ struct H5FS_t {
/* Computed/cached values */
unsigned rc; /* Count of outstanding references to struct */
haddr_t addr; /* Address of free space header on disk */
+ size_t hdr_size; /* Size of free space header on disk */
H5FS_sinfo_t *sinfo; /* Section information */
unsigned sinfo_lock_count; /* # of times the section info has been locked */
hbool_t sinfo_protected; /* Whether the section info was protected when locked */
@@ -220,8 +221,8 @@ H5FL_EXTERN(H5FS_t);
/******************************/
/* Free space manager header routines */
-H5_DLL H5FS_t *H5FS_new(size_t nclasses, const H5FS_section_class_t *classes[],
- void *cls_init_udata);
+H5_DLL H5FS_t *H5FS_new(const H5F_t *f, size_t nclasses,
+ const H5FS_section_class_t *classes[], void *cls_init_udata);
H5_DLL herr_t H5FS_incr(H5FS_t *fspace);
H5_DLL herr_t H5FS_decr(H5FS_t *fspace);
H5_DLL herr_t H5FS_dirty(H5FS_t *fspace);
diff --git a/src/H5Fpublic.h b/src/H5Fpublic.h
index df66985..5ca64dc 100644
--- a/src/H5Fpublic.h
+++ b/src/H5Fpublic.h
@@ -22,7 +22,6 @@
/* Public header files needed by this file */
#include "H5public.h"
#include "H5ACpublic.h"
-#include "H5Cpublic.h"
#include "H5Ipublic.h"
/* When this header is included from a private header, don't make calls to H5check() */
diff --git a/src/H5Gcache.c b/src/H5Gcache.c
index 98052e1..ff758c4 100644
--- a/src/H5Gcache.c
+++ b/src/H5Gcache.c
@@ -124,7 +124,6 @@ static H5G_node_t *
H5G_node_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata)
{
H5G_node_t *sym = NULL;
- size_t size;
H5WB_t *wb = NULL; /* Wrapped buffer for node data */
uint8_t node_buf[H5G_NODE_BUF_SIZE]; /* Buffer for node */
uint8_t *node; /* Pointer to node buffer */
@@ -144,19 +143,23 @@ H5G_node_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata)
* Initialize variables.
*/
+ /* Allocate symbol table data structures */
+ if(NULL == (sym = H5FL_CALLOC(H5G_node_t)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
+ sym->node_size = H5G_NODE_SIZE(f);
+ if(NULL == (sym->entry = H5FL_SEQ_CALLOC(H5G_entry_t, (size_t)(2 * H5F_SYM_LEAF_K(f)))))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
+
/* Wrap the local buffer for serialized node info */
if(NULL == (wb = H5WB_wrap(node_buf, sizeof(node_buf))))
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "can't wrap buffer")
- /* Compute the size of the serialized symbol table node on disk */
- size = H5G_node_size_real(f);
-
/* Get a pointer to a buffer that's large enough for node */
- if(NULL == (node = (uint8_t *)H5WB_actual(wb, size)))
+ if(NULL == (node = (uint8_t *)H5WB_actual(wb, sym->node_size)))
HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, NULL, "can't get actual buffer")
/* Read the serialized symbol table node. */
- if(H5F_block_read(f, H5FD_MEM_BTREE, addr, size, dxpl_id, node) < 0)
+ if(H5F_block_read(f, H5FD_MEM_BTREE, addr, sym->node_size, dxpl_id, node) < 0)
HGOTO_ERROR(H5E_SYM, H5E_READERROR, NULL, "unable to read symbol table node")
/* Get temporary pointer to serialized node */
@@ -174,12 +177,6 @@ H5G_node_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata)
/* reserved */
p++;
- /* Allocate symbol table data structures */
- if(NULL == (sym = H5FL_CALLOC(H5G_node_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
- if(NULL == (sym->entry = H5FL_SEQ_CALLOC(H5G_entry_t, (size_t)(2 * H5F_SYM_LEAF_K(f)))))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
-
/* number of symbols */
UINT16DECODE(p, sym->nsyms);
@@ -237,17 +234,13 @@ H5G_node_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5G_node_
if(sym->cache_info.is_dirty) {
uint8_t *node; /* Pointer to node buffer */
uint8_t *p; /* Pointer into raw data buffer */
- size_t size;
/* Wrap the local buffer for serialized node info */
if(NULL == (wb = H5WB_wrap(node_buf, sizeof(node_buf))))
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't wrap buffer")
- /* Compute the size of the serialized symbol table node on disk */
- size = H5G_node_size_real(f);
-
/* Get a pointer to a buffer that's large enough for node */
- if(NULL == (node = (uint8_t *)H5WB_actual(wb, size)))
+ if(NULL == (node = (uint8_t *)H5WB_actual(wb, sym->node_size)))
HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't get actual buffer")
/* Get temporary pointer to serialized symbol table node */
@@ -269,10 +262,10 @@ H5G_node_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5G_node_
/* entries */
if(H5G_ent_encode_vec(f, &p, sym->entry, sym->nsyms) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTENCODE, FAIL, "can't serialize")
- HDmemset(p, 0, size - (size_t)(p - node));
+ HDmemset(p, 0, sym->node_size - (size_t)(p - node));
/* Write the serialized symbol table node. */
- if(H5F_block_write(f, H5FD_MEM_BTREE, addr, size, dxpl_id, node) < 0)
+ if(H5F_block_write(f, H5FD_MEM_BTREE, addr, sym->node_size, dxpl_id, node) < 0)
HGOTO_ERROR(H5E_SYM, H5E_WRITEERROR, FAIL, "unable to write symbol table node to the file")
/* Reset the node's dirty flag */
@@ -332,7 +325,7 @@ H5G_node_dest(H5F_t *f, H5G_node_t *sym)
if(sym->cache_info.free_file_space_on_destroy) {
/* Release the space on disk */
/* (XXX: Nasty usage of internal DXPL value! -QAK) */
- if(H5MF_xfree(f, H5FD_MEM_BTREE, H5AC_dxpl_id, sym->cache_info.addr, (hsize_t)H5G_node_size_real(f)) < 0)
+ if(H5MF_xfree(f, H5FD_MEM_BTREE, H5AC_dxpl_id, sym->cache_info.addr, (hsize_t)sym->node_size) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTFREE, FAIL, "unable to free symbol table node")
} /* end if */
@@ -401,7 +394,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5G_node_size(const H5F_t *f, const H5G_node_t UNUSED *sym, size_t *size_ptr)
+H5G_node_size(const H5F_t UNUSED *f, const H5G_node_t *sym, size_t *size_ptr)
{
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5G_node_size)
@@ -411,7 +404,7 @@ H5G_node_size(const H5F_t *f, const H5G_node_t UNUSED *sym, size_t *size_ptr)
HDassert(f);
HDassert(size_ptr);
- *size_ptr = H5G_node_size_real(f);
+ *size_ptr = sym->node_size;
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5G_node_size() */
diff --git a/src/H5Gnode.c b/src/H5Gnode.c
index 17378d3..793034a 100644
--- a/src/H5Gnode.c
+++ b/src/H5Gnode.c
@@ -55,8 +55,6 @@ typedef struct H5G_node_key_t {
/* Private macros */
-#define H5G_NODE_SIZEOF_HDR(F) (H5_SIZEOF_MAGIC + 4)
-
/* PRIVATE PROTOTYPES */
/* B-tree callbacks */
@@ -238,31 +236,6 @@ H5G_node_debug_key(FILE *stream, int indent, int fwidth, const void *_key,
/*-------------------------------------------------------------------------
- * Function: H5G_node_size_real
- *
- * Purpose: Returns the total size of a symbol table node.
- *
- * Return: Success: Total size of the node in bytes.
- *
- * Failure: Never fails.
- *
- * Programmer: Robb Matzke
- * matzke@llnl.gov
- * Jun 23 1997
- *
- *-------------------------------------------------------------------------
- */
-size_t
-H5G_node_size_real(const H5F_t *f)
-{
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5G_node_size_real);
-
- FUNC_LEAVE_NOAPI(H5G_NODE_SIZEOF_HDR(f) +
- (2 * H5F_SYM_LEAF_K(f)) * H5G_SIZEOF_ENTRY(f));
-} /* end H5G_node_size_real() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5G_node_free
*
* Purpose: Destroy a symbol table node in memory.
@@ -322,7 +295,6 @@ H5G_node_create(H5F_t *f, hid_t dxpl_id, H5B_ins_t UNUSED op, void *_lt_key,
H5G_node_key_t *lt_key = (H5G_node_key_t *)_lt_key;
H5G_node_key_t *rt_key = (H5G_node_key_t *)_rt_key;
H5G_node_t *sym = NULL;
- hsize_t size = 0;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5G_node_create)
@@ -335,9 +307,8 @@ H5G_node_create(H5F_t *f, hid_t dxpl_id, H5B_ins_t UNUSED op, void *_lt_key,
if(NULL == (sym = H5FL_CALLOC(H5G_node_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
- size = H5G_node_size_real(f);
- HDassert(size);
- if(HADDR_UNDEF == (*addr_p = H5MF_alloc(f, H5FD_MEM_BTREE, dxpl_id, size)))
+ sym->node_size = H5G_NODE_SIZE(f);
+ if(HADDR_UNDEF == (*addr_p = H5MF_alloc(f, H5FD_MEM_BTREE, dxpl_id, (hsize_t)sym->node_size)))
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to allocate file space")
if(NULL == (sym->entry = H5FL_SEQ_CALLOC(H5G_entry_t, (size_t)(2 * H5F_SYM_LEAF_K(f)))))
HGOTO_ERROR(H5E_SYM, H5E_CANTALLOC, FAIL, "memory allocation failed")
@@ -1430,7 +1401,7 @@ done:
/*-------------------------------------------------------------------------
* Function: H5G_node_iterate_size
*
- * Purpose: This function gets called by H5B_iterate_btree_size()
+ * Purpose: This function gets called by H5B_iterate_helper()
* to gather storage info for SNODs.
*
* Return: Non-negative on success/Negative on failure
@@ -1452,10 +1423,10 @@ H5G_node_iterate_size(H5F_t *f, hid_t UNUSED dxpl_id, const void UNUSED *_lt_key
HDassert(f);
HDassert(stab_size);
- *stab_size += H5G_node_size_real(f);
+ *stab_size += H5G_NODE_SIZE(f);
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5G_btree_node_iterate() */
+} /* end H5G_node_iterate_size() */
/*-------------------------------------------------------------------------
@@ -1515,7 +1486,7 @@ H5G_node_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, int indent,
"Dirty:",
sn->cache_info.is_dirty ? "Yes" : "No");
fprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
- "Size of Node (in bytes):", (unsigned)H5G_node_size_real(f));
+ "Size of Node (in bytes):", (unsigned)sn->node_size);
fprintf(stream, "%*s%-*s %u of %u\n", indent, "", fwidth,
"Number of Symbols:",
sn->nsyms, (unsigned)(2 * H5F_SYM_LEAF_K(f)));
diff --git a/src/H5Gpkg.h b/src/H5Gpkg.h
index 15e9254..82aa2e0 100644
--- a/src/H5Gpkg.h
+++ b/src/H5Gpkg.h
@@ -58,6 +58,19 @@
#define H5G_TARGET_EXISTS 0x0008
#define H5G_CRT_INTMD_GROUP 0x0010
+/* Size of a symbol table node on disk */
+#define H5G_NODE_SIZE(f) ( \
+ /* General metadata fields */ \
+ H5_SIZEOF_MAGIC \
+ + 1 /* Version */ \
+ + 1 /* Reserved */ \
+ + 2 /* Number of symbols */ \
+ \
+ /* Entries */ \
+ + ((2 * H5F_SYM_LEAF_K(f)) * H5G_SIZEOF_ENTRY(f)) \
+ )
+
+
/****************************/
/* Package Private Typedefs */
/****************************/
@@ -117,8 +130,9 @@ struct H5G_entry_t {
typedef struct H5G_node_t {
H5AC_info_t cache_info; /* Information for H5AC cache functions, _must_ be */
/* first field in structure */
- unsigned nsyms; /*number of symbols */
- H5G_entry_t *entry; /*array of symbol table entries */
+ size_t node_size; /* Size of node on disk */
+ unsigned nsyms; /* Number of symbols */
+ H5G_entry_t *entry; /* Array of symbol table entries */
} H5G_node_t;
/*
@@ -435,7 +449,6 @@ H5_DLL herr_t H5G_ent_debug(const H5G_entry_t *ent, FILE * stream, int indent,
/* Functions that understand symbol table nodes */
H5_DLL herr_t H5G_node_init(H5F_t *f);
-H5_DLL size_t H5G_node_size_real(const H5F_t *f);
H5_DLL int H5G_node_iterate(H5F_t *f, hid_t dxpl_id, const void *_lt_key, haddr_t addr,
const void *_rt_key, void *_udata);
H5_DLL int H5G_node_sumup(H5F_t *f, hid_t dxpl_id, const void *_lt_key, haddr_t addr,
diff --git a/src/H5HFcache.c b/src/H5HFcache.c
index 2faedb3..f8829f2 100644
--- a/src/H5HFcache.c
+++ b/src/H5HFcache.c
@@ -749,7 +749,7 @@ H5HF_cache_iblock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata)
HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, NULL, "can't wrap buffer")
/* Compute size of indirect block */
- iblock->size = H5HF_MAN_INDIRECT_SIZE(hdr, iblock);
+ iblock->size = H5HF_MAN_INDIRECT_SIZE(hdr, iblock->nrows);
/* Get a pointer to a buffer that's large enough for serialized indirect block */
if(NULL == (buf = (uint8_t *)H5WB_actual(wb, iblock->size)))
diff --git a/src/H5HFiblock.c b/src/H5HFiblock.c
index 629ac29..7958075 100644
--- a/src/H5HFiblock.c
+++ b/src/H5HFiblock.c
@@ -552,7 +552,7 @@ H5HF_man_iblock_root_double(H5HF_hdr_t *hdr, hid_t dxpl_id, size_t min_dblock_si
/* Compute size of buffer needed for new indirect block */
iblock->nrows = new_nrows;
old_iblock_size = iblock->size;
- iblock->size = H5HF_MAN_INDIRECT_SIZE(hdr, iblock);
+ iblock->size = H5HF_MAN_INDIRECT_SIZE(hdr, iblock->nrows);
/* Allocate [temporary] space for the new indirect block on disk */
if(H5F_USE_TMP_SPACE(hdr->f)) {
@@ -721,7 +721,7 @@ H5HF_man_iblock_root_halve(H5HF_indirect_t *iblock, hid_t dxpl_id)
old_nrows = iblock->nrows;
iblock->nrows = new_nrows;
old_size = iblock->size;
- iblock->size = H5HF_MAN_INDIRECT_SIZE(hdr, iblock);
+ iblock->size = H5HF_MAN_INDIRECT_SIZE(hdr, iblock->nrows);
/* Allocate [temporary] space for the new indirect block on disk */
if(H5F_USE_TMP_SPACE(hdr->f)) {
@@ -985,7 +985,7 @@ H5HF_man_iblock_create(H5HF_hdr_t *hdr, hid_t dxpl_id, H5HF_indirect_t *par_iblo
iblock->max_rows = max_rows;
/* Compute size of buffer needed for indirect block */
- iblock->size = H5HF_MAN_INDIRECT_SIZE(hdr, iblock);
+ iblock->size = H5HF_MAN_INDIRECT_SIZE(hdr, iblock->nrows);
/* Allocate child block entry array */
if(NULL == (iblock->ents = H5FL_SEQ_MALLOC(H5HF_indirect_ent_t, (size_t)(iblock->nrows * hdr->man_dtable.cparam.width))))
diff --git a/src/H5HFpkg.h b/src/H5HFpkg.h
index 6892f0d..2746302 100644
--- a/src/H5HFpkg.h
+++ b/src/H5HFpkg.h
@@ -123,18 +123,17 @@
)
/* Size of managed indirect block */
-#define H5HF_MAN_INDIRECT_SIZE(h, i) ( \
+#define H5HF_MAN_INDIRECT_SIZE(h, r) ( \
/* General metadata fields */ \
H5HF_METADATA_PREFIX_SIZE(TRUE) \
\
/* Fractal heap managed, absolutely mapped indirect block specific fields */ \
+ (h)->sizeof_addr /* File address of heap owning the block */ \
+ (h)->heap_off_size /* Offset of the block in the heap */ \
- + (MIN((i)->nrows, (h)->man_dtable.max_direct_rows) * (h)->man_dtable.cparam.width * H5HF_MAN_INDIRECT_CHILD_DIR_ENTRY_SIZE(h)) /* Size of entries for direct blocks */ \
- + ((((i)->nrows > (h)->man_dtable.max_direct_rows) ? ((i)->nrows - (h)->man_dtable.max_direct_rows) : 0) * (h)->man_dtable.cparam.width * (h)->sizeof_addr) /* Size of entries for indirect blocks */ \
+ + (MIN(r, (h)->man_dtable.max_direct_rows) * (h)->man_dtable.cparam.width * H5HF_MAN_INDIRECT_CHILD_DIR_ENTRY_SIZE(h)) /* Size of entries for direct blocks */ \
+ + (((r > (h)->man_dtable.max_direct_rows) ? (r - (h)->man_dtable.max_direct_rows) : 0) * (h)->man_dtable.cparam.width * (h)->sizeof_addr) /* Size of entries for indirect blocks */ \
)
-
/* Compute the # of bytes required to store an offset into a given buffer size */
#define H5HF_SIZEOF_OFFSET_BITS(b) (((b) + 7) / 8)
#define H5HF_SIZEOF_OFFSET_LEN(l) H5HF_SIZEOF_OFFSET_BITS(H5V_log2_of2((unsigned)(l)))
diff --git a/src/H5HL.c b/src/H5HL.c
index 21ca813..61c97e1 100644
--- a/src/H5HL.c
+++ b/src/H5HL.c
@@ -210,6 +210,7 @@ H5HL_dblk_realloc(H5F_t *f, hid_t dxpl_id, H5HL_t *heap, size_t new_heap_size)
H5HL_dblk_t *dblk; /* Local heap data block */
haddr_t old_addr; /* Old location of heap data block */
haddr_t new_addr; /* New location of heap data block */
+ size_t old_heap_size; /* Old size of heap data block */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5HL_dblk_realloc)
@@ -220,8 +221,9 @@ H5HL_dblk_realloc(H5F_t *f, hid_t dxpl_id, H5HL_t *heap, size_t new_heap_size)
/* Release old space on disk */
old_addr = heap->dblk_addr;
- H5_CHECK_OVERFLOW(heap->dblk_size, size_t, hsize_t);
- if(H5MF_xfree(f, H5FD_MEM_LHEAP, dxpl_id, old_addr, (hsize_t)heap->dblk_size) < 0)
+ old_heap_size = heap->dblk_size;
+ H5_CHECK_OVERFLOW(old_heap_size, size_t, hsize_t);
+ if(H5MF_xfree(f, H5FD_MEM_LHEAP, dxpl_id, old_addr, (hsize_t)old_heap_size) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "can't release old heap data?")
/* Allocate new space on disk */
@@ -229,12 +231,16 @@ H5HL_dblk_realloc(H5F_t *f, hid_t dxpl_id, H5HL_t *heap, size_t new_heap_size)
if(HADDR_UNDEF == (new_addr = H5MF_alloc(f, H5FD_MEM_LHEAP, dxpl_id, (hsize_t)new_heap_size)))
HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "unable to allocate file space for heap")
+ /* Update heap info*/
+ heap->dblk_addr = new_addr;
+ heap->dblk_size = new_heap_size;
+
/* Check if heap data block actually moved in the file */
if(H5F_addr_eq(old_addr, new_addr)) {
/* Check if heap data block is contiguous w/prefix */
if(heap->single_cache_obj) {
/* Sanity check */
- HDassert(H5F_addr_eq(heap->prfx_addr + heap->prfx_size, heap->dblk_addr));
+ HDassert(H5F_addr_eq(heap->prfx_addr + heap->prfx_size, old_addr));
HDassert(heap->prfx);
/* Resize the heap prefix in the cache */
@@ -243,7 +249,7 @@ H5HL_dblk_realloc(H5F_t *f, hid_t dxpl_id, H5HL_t *heap, size_t new_heap_size)
} /* end if */
else {
/* Sanity check */
- HDassert(H5F_addr_ne(heap->prfx_addr + heap->prfx_size, heap->dblk_addr));
+ HDassert(H5F_addr_ne(heap->prfx_addr + heap->prfx_size, old_addr));
HDassert(heap->dblk);
/* Resize the heap data block in the cache */
@@ -285,11 +291,13 @@ H5HL_dblk_realloc(H5F_t *f, hid_t dxpl_id, H5HL_t *heap, size_t new_heap_size)
} /* end else */
} /* end else */
- /* Update heap info*/
- heap->dblk_addr = new_addr;
- heap->dblk_size = new_heap_size;
-
done:
+ if(ret_value < 0) {
+ /* Restore old heap address & size */
+ heap->dblk_addr = old_addr;
+ heap->dblk_size = old_heap_size;
+ } /* end if */
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5HL_dblk_realloc() */
diff --git a/src/H5O.c b/src/H5O.c
index e7b3965..ae5c429 100644
--- a/src/H5O.c
+++ b/src/H5O.c
@@ -1757,6 +1757,9 @@ H5O_protect(const H5O_loc_t *loc, hid_t dxpl_id, H5AC_protect_t prot)
/* Check for any messages that were modified while being read in */
if(udata.common.mesgs_modified && prot != H5AC_WRITE)
oh->mesgs_modified = TRUE;
+
+ /* Reset the field that contained chunk 0's size during speculative load */
+ oh->chunk0_size = 0;
} /* end if */
/* Take care of loose ends for modifications made while bringing in the
diff --git a/src/H5Ocache.c b/src/H5Ocache.c
index 46b5f2f..9e909a6 100644
--- a/src/H5Ocache.c
+++ b/src/H5Ocache.c
@@ -618,7 +618,10 @@ H5O_size(const H5F_t UNUSED *f, const H5O_t *oh, size_t *size_ptr)
HDassert(size_ptr);
/* Report the object header's prefix+first chunk length */
- *size_ptr = (size_t)H5O_SIZEOF_HDR(oh) + oh->chunk0_size;
+ if(oh->chunk0_size)
+ *size_ptr = H5O_SIZEOF_HDR(oh) + oh->chunk0_size;
+ else
+ *size_ptr = oh->chunk[0].size;
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5O_size() */
diff --git a/src/H5SM.c b/src/H5SM.c
index 8045183..0525037 100755
--- a/src/H5SM.c
+++ b/src/H5SM.c
@@ -124,14 +124,12 @@ H5SM_init(H5F_t *f, H5P_genplist_t * fc_plist, const H5O_loc_t *ext_loc, hid_t d
H5O_shmesg_table_t sohm_table; /* SOHM message for superblock extension */
H5SM_master_table_t *table = NULL; /* SOHM master table for file */
haddr_t table_addr = HADDR_UNDEF; /* Address of SOHM master table in file */
- unsigned num_indexes; /* Number of SOHM indices */
unsigned list_max, btree_min; /* Phase change limits for SOHM indices */
unsigned index_type_flags[H5O_SHMESG_MAX_NINDEXES]; /* Messages types stored in each index */
unsigned minsizes[H5O_SHMESG_MAX_NINDEXES]; /* Message size sharing threshhold for each index */
unsigned type_flags_used; /* Message type flags used, for sanity checking */
- hsize_t table_size; /* Size of SOHM master table in file */
unsigned x; /* Local index variable */
- herr_t ret_value = SUCCEED;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5SM_init, NULL)
@@ -139,39 +137,38 @@ H5SM_init(H5F_t *f, H5P_genplist_t * fc_plist, const H5O_loc_t *ext_loc, hid_t d
/* File should not already have a SOHM table */
HDassert(f->shared->sohm_addr == HADDR_UNDEF);
+ /* Initialize master table */
+ if(NULL == (table = H5FL_MALLOC(H5SM_master_table_t)))
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTALLOC, FAIL, "memory allocation failed for SOHM table")
+ table->num_indexes = f->shared->sohm_nindexes;
+ table->table_size = H5SM_TABLE_SIZE(f);
+
/* Get information from fcpl */
- if(H5P_get(fc_plist, H5F_CRT_SHMSG_NINDEXES_NAME, &num_indexes)<0)
- HGOTO_ERROR(H5E_SOHM, H5E_CANTGET, FAIL, "can't get number of indexes")
- if(H5P_get(fc_plist, H5F_CRT_SHMSG_INDEX_TYPES_NAME, &index_type_flags)<0)
+ if(H5P_get(fc_plist, H5F_CRT_SHMSG_INDEX_TYPES_NAME, &index_type_flags) < 0)
HGOTO_ERROR(H5E_SOHM, H5E_CANTGET, FAIL, "can't get SOHM type flags")
- if(H5P_get(fc_plist, H5F_CRT_SHMSG_LIST_MAX_NAME, &list_max)<0)
+ if(H5P_get(fc_plist, H5F_CRT_SHMSG_LIST_MAX_NAME, &list_max) < 0)
HGOTO_ERROR(H5E_SOHM, H5E_CANTGET, FAIL, "can't get SOHM list maximum")
- if(H5P_get(fc_plist, H5F_CRT_SHMSG_BTREE_MIN_NAME, &btree_min)<0)
+ if(H5P_get(fc_plist, H5F_CRT_SHMSG_BTREE_MIN_NAME, &btree_min) < 0)
HGOTO_ERROR(H5E_SOHM, H5E_CANTGET, FAIL, "can't get SOHM btree minimum")
if(H5P_get(fc_plist, H5F_CRT_SHMSG_INDEX_MINSIZE_NAME, &minsizes) < 0)
HGOTO_ERROR(H5E_SOHM, H5E_CANTGET, FAIL, "can't get SOHM message min sizes")
/* Verify that values are valid */
- if(num_indexes > H5O_SHMESG_MAX_NINDEXES)
+ if(table->num_indexes > H5O_SHMESG_MAX_NINDEXES)
HGOTO_ERROR(H5E_SOHM, H5E_BADRANGE, FAIL, "number of indexes in property list is too large")
/* Check that type flags weren't duplicated anywhere */
type_flags_used = 0;
- for(x = 0; x < num_indexes; ++x) {
+ for(x = 0; x < table->num_indexes; ++x) {
if(index_type_flags[x] & type_flags_used)
HGOTO_ERROR(H5E_SOHM, H5E_BADVALUE, FAIL, "the same shared message type flag is assigned to more than one index")
type_flags_used |= index_type_flags[x];
} /* end for */
- /* Initialize master table */
- if(NULL == (table = H5FL_MALLOC(H5SM_master_table_t)))
- HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, FAIL, "memory allocation failed for SOHM table")
-
- /* Set version and number of indexes in table and in superblock.
+ /* Check that number of indexes in table and in superblock make sense.
* Right now we just use one byte to hold the number of indexes.
*/
- HDassert(num_indexes < 256);
- table->num_indexes = num_indexes;
+ HDassert(table->num_indexes < 256);
/* Check that list and btree cutoffs make sense. There can't be any
* values greater than the list max but less than the btree min; the
@@ -188,8 +185,7 @@ H5SM_init(H5F_t *f, H5P_genplist_t * fc_plist, const H5O_loc_t *ext_loc, hid_t d
/* Initialize all of the indexes, but don't allocate space for them to
* hold messages until we actually need to write to them.
*/
- for(x = 0; x < table->num_indexes; x++)
- {
+ for(x = 0; x < table->num_indexes; x++) {
table->indexes[x].btree_min = btree_min;
table->indexes[x].list_max = list_max;
table->indexes[x].mesg_types = index_type_flags[x];
@@ -203,11 +199,13 @@ H5SM_init(H5F_t *f, H5P_genplist_t * fc_plist, const H5O_loc_t *ext_loc, hid_t d
table->indexes[x].index_type = H5SM_LIST;
else
table->indexes[x].index_type = H5SM_BTREE;
+
+ /* Compute the size of a list index for this SOHM index */
+ table->indexes[x].list_size = H5SM_LIST_SIZE(f, list_max);
} /* end for */
/* Allocate space for the table on disk */
- table_size = H5SM_TABLE_SIZE(f) + (table->num_indexes * H5SM_INDEX_HEADER_SIZE(f));
- if(HADDR_UNDEF == (table_addr = H5MF_alloc(f, H5FD_MEM_SOHM_TABLE, dxpl_id, table_size)))
+ if(HADDR_UNDEF == (table_addr = H5MF_alloc(f, H5FD_MEM_SOHM_TABLE, dxpl_id, (hsize_t)table->table_size)))
HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, FAIL, "file allocation failed for SOHM table")
/* Cache the new table */
@@ -233,7 +231,7 @@ H5SM_init(H5F_t *f, H5P_genplist_t * fc_plist, const H5O_loc_t *ext_loc, hid_t d
done:
if(ret_value < 0) {
if(table_addr != HADDR_UNDEF)
- H5MF_xfree(f, H5FD_MEM_SOHM_TABLE, dxpl_id, table_addr, (hsize_t)H5SM_TABLE_SIZE(f));
+ H5MF_xfree(f, H5FD_MEM_SOHM_TABLE, dxpl_id, table_addr, (hsize_t)table->table_size);
if(table != NULL)
table = H5FL_FREE(H5SM_master_table_t, table);
} /* end if */
@@ -360,7 +358,6 @@ H5SM_type_shared(H5F_t *f, unsigned type_id, hid_t dxpl_id)
/* Set up user data for callback */
cache_udata.f = f;
- cache_udata.table_size = H5SM_TABLE_SIZE(f) + (f->shared->sohm_nindexes * H5SM_INDEX_HEADER_SIZE(f));
if(NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_TABLE, f->shared->sohm_addr, &cache_udata, H5AC_READ)))
HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table")
@@ -414,7 +411,6 @@ H5SM_get_fheap_addr(H5F_t *f, hid_t dxpl_id, unsigned type_id, haddr_t *fheap_ad
/* Set up user data for callback */
cache_udata.f = f;
- cache_udata.table_size = H5SM_TABLE_SIZE(f) + (f->shared->sohm_nindexes * H5SM_INDEX_HEADER_SIZE(f));
/* Look up the master SOHM table */
if(NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_TABLE, f->shared->sohm_addr, &cache_udata, H5AC_READ)))
@@ -630,7 +626,6 @@ H5SM_create_list(H5F_t *f, H5SM_index_header_t *header, hid_t dxpl_id)
{
H5SM_list_t *list = NULL; /* List of messages */
hsize_t x; /* Counter variable */
- hsize_t size = 0; /* Size of list on disk */
size_t num_entries; /* Number of messages to create in list */
haddr_t addr = HADDR_UNDEF; /* Address of the list on disk */
haddr_t ret_value;
@@ -643,22 +638,20 @@ H5SM_create_list(H5F_t *f, H5SM_index_header_t *header, hid_t dxpl_id)
num_entries = header->list_max;
/* Allocate list in memory */
- if((list = H5FL_MALLOC(H5SM_list_t)) == NULL)
+ if(NULL == (list = H5FL_MALLOC(H5SM_list_t)))
HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, HADDR_UNDEF, "file allocation failed for SOHM list")
- if((list->messages = (H5SM_sohm_t *)H5FL_ARR_MALLOC(H5SM_sohm_t, num_entries)) == NULL)
+ if(NULL == (list->messages = (H5SM_sohm_t *)H5FL_ARR_CALLOC(H5SM_sohm_t, num_entries)))
HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, HADDR_UNDEF, "file allocation failed for SOHM list")
/* Initialize messages in list */
- HDmemset(list->messages, 0, sizeof(H5SM_sohm_t) * num_entries);
- for(x=0; x<num_entries; x++)
+ for(x = 0; x < num_entries; x++)
list->messages[x].location = H5SM_NO_LOC;
/* Point list at header passed in */
list->header = header;
/* Allocate space for the list on disk */
- size = H5SM_LIST_SIZE(f, num_entries);
- if(HADDR_UNDEF == (addr = H5MF_alloc(f, H5FD_MEM_SOHM_INDEX, dxpl_id, size)))
+ if(HADDR_UNDEF == (addr = H5MF_alloc(f, H5FD_MEM_SOHM_INDEX, dxpl_id, (hsize_t)header->list_size)))
HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, HADDR_UNDEF, "file allocation failed for SOHM list")
/* Put the list into the cache */
@@ -676,7 +669,7 @@ done:
list = H5FL_FREE(H5SM_list_t, list);
} /* end if */
if(addr != HADDR_UNDEF)
- H5MF_xfree(f, H5FD_MEM_SOHM_INDEX, dxpl_id, addr, size);
+ H5MF_xfree(f, H5FD_MEM_SOHM_INDEX, dxpl_id, addr, (hsize_t)header->list_size);
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
@@ -946,7 +939,6 @@ H5SM_can_share(H5F_t *f, hid_t dxpl_id, H5SM_master_table_t *table,
/* Set up user data for callback */
cache_udata.f = f;
- cache_udata.table_size = H5SM_TABLE_SIZE(f) + (f->shared->sohm_nindexes * H5SM_INDEX_HEADER_SIZE(f));
if(NULL == (my_table = (H5SM_master_table_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_TABLE, f->shared->sohm_addr, &cache_udata, H5AC_READ)))
HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table")
@@ -1056,7 +1048,6 @@ H5SM_try_share(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, unsigned type_id,
/* Set up user data for callback */
cache_udata.f = f;
- cache_udata.table_size = H5SM_TABLE_SIZE(f) + (f->shared->sohm_nindexes * H5SM_INDEX_HEADER_SIZE(f));
/* Look up the master SOHM table */
if(NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_TABLE, f->shared->sohm_addr, &cache_udata, H5AC_WRITE)))
@@ -1456,7 +1447,6 @@ H5SM_delete(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, H5O_shared_t *sh_mesg)
/* Set up user data for callback */
cache_udata.f = f;
- cache_udata.table_size = H5SM_TABLE_SIZE(f) + (f->shared->sohm_nindexes * H5SM_INDEX_HEADER_SIZE(f));
/* Look up the master SOHM table */
if(NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_TABLE, f->shared->sohm_addr, &cache_udata, H5AC_WRITE)))
@@ -1897,7 +1887,6 @@ H5SM_get_info(const H5O_loc_t *ext_loc, H5P_genplist_t *fc_plist, hid_t dxpl_id)
/* Set up user data for callback */
cache_udata.f = f;
- cache_udata.table_size = H5SM_TABLE_SIZE(f) + (shared->sohm_nindexes * H5SM_INDEX_HEADER_SIZE(f));
/* Read the rest of the SOHM table information from the cache */
if(NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_TABLE, shared->sohm_addr, &cache_udata, H5AC_READ)))
@@ -2059,7 +2048,6 @@ H5SM_get_refcount(H5F_t *f, hid_t dxpl_id, unsigned type_id,
/* Set up user data for callback */
tbl_cache_udata.f = f;
- tbl_cache_udata.table_size = H5SM_TABLE_SIZE(f) + (f->shared->sohm_nindexes * H5SM_INDEX_HEADER_SIZE(f));
/* Look up the master SOHM table */
if(NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_TABLE, f->shared->sohm_addr, &tbl_cache_udata, H5AC_READ)))
@@ -2457,7 +2445,6 @@ H5SM_table_debug(H5F_t *f, hid_t dxpl_id, haddr_t table_addr,
/* Set up user data for callback */
cache_udata.f = f;
- cache_udata.table_size = H5SM_TABLE_SIZE(f) + (f->shared->sohm_nindexes * H5SM_INDEX_HEADER_SIZE(f));
/* Look up the master SOHM table */
if(NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_TABLE, table_addr, &cache_udata, H5AC_READ)))
@@ -2621,14 +2608,13 @@ H5SM_ih_size(H5F_t *f, hid_t dxpl_id, hsize_t *hdr_size, H5_ih_info_t *ih_info)
/* Set up user data for callback */
cache_udata.f = f;
- cache_udata.table_size = H5SM_TABLE_SIZE(f) + (f->shared->sohm_nindexes * H5SM_INDEX_HEADER_SIZE(f));
/* Look up the master SOHM table */
if(NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_TABLE, f->shared->sohm_addr, &cache_udata, H5AC_READ)))
HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table")
/* Get SOHM header size */
- *hdr_size = H5SM_TABLE_SIZE(f) + (table->num_indexes * H5SM_INDEX_HEADER_SIZE(f));
+ *hdr_size = table->table_size;
/* Loop over all the indices for shared messages */
for(u = 0; u < table->num_indexes; u++) {
@@ -2650,7 +2636,7 @@ H5SM_ih_size(H5F_t *f, hid_t dxpl_id, hsize_t *hdr_size, H5_ih_info_t *ih_info)
} /* end if */
else {
HDassert(table->indexes[u].index_type == H5SM_LIST);
- ih_info->index_size += H5SM_LIST_SIZE(f, table->indexes[u].list_max);
+ ih_info->index_size += table->indexes[u].list_size;
} /* end else */
/* Check for heap for this index */
diff --git a/src/H5SMcache.c b/src/H5SMcache.c
index cc22dcd..4a9338b 100644
--- a/src/H5SMcache.c
+++ b/src/H5SMcache.c
@@ -119,7 +119,6 @@ static H5SM_master_table_t *
H5SM_table_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void UNUSED *udata)
{
H5SM_master_table_t *table = NULL;
- size_t size; /* Size of SOHM master table on disk */
H5WB_t *wb = NULL; /* Wrapped buffer for table data */
uint8_t tbl_buf[H5SM_TBL_BUF_SIZE]; /* Buffer for table */
uint8_t *buf; /* Reading buffer */
@@ -151,17 +150,17 @@ H5SM_table_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void UNUSED *udata)
if(NULL == (wb = H5WB_wrap(tbl_buf, sizeof(tbl_buf))))
HGOTO_ERROR(H5E_SOHM, H5E_CANTINIT, NULL, "can't wrap buffer")
- /* Compute the size of the SOHM table header on disk. This is the "table" itself
- * plus each index within the table
+ /* Compute the size of the SOHM table header on disk. This is the "table"
+ * itself plus each index within the table
*/
- size = H5SM_TABLE_SIZE(f) + (table->num_indexes * H5SM_INDEX_HEADER_SIZE(f));
+ table->table_size = H5SM_TABLE_SIZE(f);
/* Get a pointer to a buffer that's large enough for serialized table */
- if(NULL == (buf = (uint8_t *)H5WB_actual(wb, size)))
+ if(NULL == (buf = (uint8_t *)H5WB_actual(wb, table->table_size)))
HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, NULL, "can't get actual buffer")
/* Read header from disk */
- if(H5F_block_read(f, H5FD_MEM_SOHM_TABLE, addr, size, dxpl_id, buf) < 0)
+ if(H5F_block_read(f, H5FD_MEM_SOHM_TABLE, addr, table->table_size, dxpl_id, buf) < 0)
HGOTO_ERROR(H5E_SOHM, H5E_READERROR, NULL, "can't read SOHM table")
/* Get temporary pointer to serialized table */
@@ -172,11 +171,6 @@ H5SM_table_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void UNUSED *udata)
HGOTO_ERROR(H5E_SOHM, H5E_CANTLOAD, NULL, "bad SOHM table signature")
p += H5_SIZEOF_MAGIC;
- /* Don't count the checksum in the table size yet, since it comes after
- * all of the index headers
- */
- HDassert((size_t)(p - (const uint8_t *)buf) == H5SM_TABLE_SIZE(f) - H5SM_SIZEOF_CHECKSUM);
-
/* Allocate space for the index headers in memory*/
if(NULL == (table->indexes = (H5SM_index_header_t *)H5FL_ARR_MALLOC(H5SM_index_header_t, (size_t)table->num_indexes)))
HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, NULL, "memory allocation failed for SOHM indexes")
@@ -210,16 +204,19 @@ H5SM_table_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void UNUSED *udata)
/* Address of the index's heap */
H5F_addr_decode(f, &p, &(table->indexes[x].heap_addr));
+
+ /* Compute the size of a list index for this SOHM index */
+ table->indexes[x].list_size = H5SM_LIST_SIZE(f, table->indexes[x].list_max);
} /* end for */
/* Read in checksum */
UINT32DECODE(p, stored_chksum);
/* Sanity check */
- HDassert((size_t)(p - (const uint8_t *)buf) == size);
+ HDassert((size_t)(p - (const uint8_t *)buf) == table->table_size);
/* Compute checksum on entire header */
- computed_chksum = H5_checksum_metadata(buf, (size - H5SM_SIZEOF_CHECKSUM), 0);
+ computed_chksum = H5_checksum_metadata(buf, (table->table_size - H5SM_SIZEOF_CHECKSUM), 0);
/* Verify checksum */
if(stored_chksum != computed_chksum)
@@ -270,7 +267,6 @@ H5SM_table_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5SM_ma
if(table->cache_info.is_dirty) {
uint8_t *buf; /* Temporary buffer */
uint8_t *p; /* Pointer into raw data buffer */
- size_t size; /* Header size on disk */
uint32_t computed_chksum; /* Computed metadata checksum value */
size_t x; /* Counter variable */
@@ -283,11 +279,8 @@ H5SM_table_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5SM_ma
if(NULL == (wb = H5WB_wrap(tbl_buf, sizeof(tbl_buf))))
HGOTO_ERROR(H5E_SOHM, H5E_CANTINIT, FAIL, "can't wrap buffer")
- /* Encode the master table and all of the index headers as one big blob */
- size = H5SM_TABLE_SIZE(f) + (H5SM_INDEX_HEADER_SIZE(f) * table->num_indexes);
-
/* Get a pointer to a buffer that's large enough for serialized table */
- if(NULL == (buf = (uint8_t *)H5WB_actual(wb, size)))
+ if(NULL == (buf = (uint8_t *)H5WB_actual(wb, table->table_size)))
HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, FAIL, "can't get actual buffer")
/* Get temporary pointer to buffer for serialized table */
@@ -328,12 +321,12 @@ H5SM_table_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5SM_ma
} /* end for */
/* Compute checksum on buffer */
- computed_chksum = H5_checksum_metadata(buf, (size - H5SM_SIZEOF_CHECKSUM), 0);
+ computed_chksum = H5_checksum_metadata(buf, (table->table_size - H5SM_SIZEOF_CHECKSUM), 0);
UINT32ENCODE(p, computed_chksum);
/* Write the table to disk */
- HDassert((size_t)(p - buf) == size);
- if(H5F_block_write(f, H5FD_MEM_SOHM_TABLE, addr, size, dxpl_id, buf) < 0)
+ HDassert((size_t)(p - buf) == table->table_size);
+ if(H5F_block_write(f, H5FD_MEM_SOHM_TABLE, addr, table->table_size, dxpl_id, buf) < 0)
HGOTO_ERROR(H5E_SOHM, H5E_CANTFLUSH, FAIL, "unable to save sohm table to disk")
table->cache_info.is_dirty = FALSE;
@@ -433,7 +426,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5SM_table_size(const H5F_t *f, const H5SM_master_table_t *table, size_t *size_ptr)
+H5SM_table_size(const H5F_t UNUSED *f, const H5SM_master_table_t *table, size_t *size_ptr)
{
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5SM_table_size)
@@ -443,7 +436,7 @@ H5SM_table_size(const H5F_t *f, const H5SM_master_table_t *table, size_t *size_p
HDassert(size_ptr);
/* Set size value */
- *size_ptr = H5SM_TABLE_SIZE(f) + (table->num_indexes * H5SM_INDEX_HEADER_SIZE(f));
+ *size_ptr = table->table_size;
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5SM_table_size() */
@@ -467,7 +460,6 @@ H5SM_list_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata)
H5SM_list_t *list; /* The SOHM list being read in */
H5SM_list_cache_ud_t *udata = (H5SM_list_cache_ud_t *)_udata; /* User data for callback */
H5SM_bt2_ctx_t ctx; /* Message encoding context */
- size_t size; /* Size of SOHM list on disk */
H5WB_t *wb = NULL; /* Wrapped buffer for list index data */
uint8_t lst_buf[H5SM_LST_BUF_SIZE]; /* Buffer for list index */
uint8_t *buf; /* Reading buffer */
@@ -497,15 +489,12 @@ H5SM_list_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata)
if(NULL == (wb = H5WB_wrap(lst_buf, sizeof(lst_buf))))
HGOTO_ERROR(H5E_SOHM, H5E_CANTINIT, NULL, "can't wrap buffer")
- /* Compute the size of the SOHM list on disk */
- size = H5SM_LIST_SIZE(udata->f, udata->header->num_messages);
-
/* Get a pointer to a buffer that's large enough for serialized list index */
- if(NULL == (buf = (uint8_t *)H5WB_actual(wb, size)))
+ if(NULL == (buf = (uint8_t *)H5WB_actual(wb, udata->header->list_size)))
HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, NULL, "can't get actual buffer")
/* Read list from disk */
- if(H5F_block_read(f, H5FD_MEM_SOHM_INDEX, addr, size, dxpl_id, buf) < 0)
+ if(H5F_block_read(f, H5FD_MEM_SOHM_INDEX, addr, udata->header->list_size, dxpl_id, buf) < 0)
HGOTO_ERROR(H5E_SOHM, H5E_READERROR, NULL, "can't read SOHM list")
/* Get temporary pointer to serialized list index */
@@ -528,10 +517,10 @@ H5SM_list_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata)
UINT32DECODE(p, stored_chksum);
/* Sanity check */
- HDassert((size_t)(p - buf) == size);
+ HDassert((size_t)(p - buf) <= udata->header->list_size);
/* Compute checksum on entire header */
- computed_chksum = H5_checksum_metadata(buf, (size - H5SM_SIZEOF_CHECKSUM), 0);
+ computed_chksum = H5_checksum_metadata(buf, ((size_t)(p - buf) - H5SM_SIZEOF_CHECKSUM), 0);
/* Verify checksum */
if(stored_chksum != computed_chksum)
@@ -589,7 +578,6 @@ H5SM_list_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5SM_lis
H5SM_bt2_ctx_t ctx; /* Message encoding context */
uint8_t *buf; /* Temporary buffer */
uint8_t *p; /* Pointer into raw data buffer */
- size_t size; /* Header size on disk */
uint32_t computed_chksum; /* Computed metadata checksum value */
size_t mesgs_written; /* Number of messages written to list */
size_t x; /* Local index variable */
@@ -598,10 +586,8 @@ H5SM_list_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5SM_lis
if(NULL == (wb = H5WB_wrap(lst_buf, sizeof(lst_buf))))
HGOTO_ERROR(H5E_SOHM, H5E_CANTINIT, FAIL, "can't wrap buffer")
- size = H5SM_LIST_SIZE(f, list->header->num_messages);
-
/* Get a pointer to a buffer that's large enough for serialized list index */
- if(NULL == (buf = (uint8_t *)H5WB_actual(wb, size)))
+ if(NULL == (buf = (uint8_t *)H5WB_actual(wb, list->header->list_size)))
HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, FAIL, "can't get actual buffer")
/* Get temporary pointer to buffer for serialized list index */
@@ -626,12 +612,12 @@ H5SM_list_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5SM_lis
HDassert(mesgs_written == list->header->num_messages);
/* Compute checksum on buffer */
- computed_chksum = H5_checksum_metadata(buf, (size - H5SM_SIZEOF_CHECKSUM), 0);
+ computed_chksum = H5_checksum_metadata(buf, (size_t)(p - buf), 0);
UINT32ENCODE(p, computed_chksum);
/* Write the list to disk */
- HDassert((size_t)(p - buf) == size);
- if(H5F_block_write(f, H5FD_MEM_SOHM_INDEX, addr, size, dxpl_id, buf) < 0)
+ HDassert((size_t)(p - buf) <= list->header->list_size);
+ if(H5F_block_write(f, H5FD_MEM_SOHM_INDEX, addr, list->header->list_size, dxpl_id, buf) < 0)
HGOTO_ERROR(H5E_SOHM, H5E_CANTFLUSH, FAIL, "unable to save sohm table to disk")
list->cache_info.is_dirty = FALSE;
@@ -681,7 +667,7 @@ H5SM_list_dest(H5F_t *f, H5SM_list_t* list)
if(list->cache_info.free_file_space_on_destroy) {
/* Release the space on disk */
/* (XXX: Nasty usage of internal DXPL value! -QAK) */
- if(H5MF_xfree(f, H5FD_MEM_SOHM_INDEX, H5AC_dxpl_id, list->cache_info.addr, (hsize_t)H5SM_LIST_SIZE(f, list->header->list_max)) < 0)
+ if(H5MF_xfree(f, H5FD_MEM_SOHM_INDEX, H5AC_dxpl_id, list->cache_info.addr, (hsize_t)list->header->list_size) < 0)
HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, FAIL, "unable to free shared message list")
} /* end if */
@@ -754,7 +740,7 @@ H5SM_list_size(const H5F_t UNUSED *f, const H5SM_list_t *list, size_t *size_ptr)
HDassert(size_ptr);
/* Set size value */
- *size_ptr = H5SM_LIST_SIZE(f, list->header->list_max);
+ *size_ptr = list->header->list_size;
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5SM_list_size() */
diff --git a/src/H5SMpkg.h b/src/H5SMpkg.h
index 6594912..84c2bf4 100755
--- a/src/H5SMpkg.h
+++ b/src/H5SMpkg.h
@@ -62,11 +62,6 @@
+ MAX(H5SM_HEAP_LOC_SIZE, H5SM_OH_LOC_SIZE(f)) /* Entry */ \
)
-#define H5SM_TABLE_SIZE(f) ( \
- (unsigned)H5_SIZEOF_MAGIC /* Signature */ \
- + (unsigned)H5SM_SIZEOF_CHECKSUM /* Checksum */ \
- )
-
#define H5SM_INDEX_HEADER_SIZE(f) ( \
(unsigned)1 /* Whether index is a list or B-tree */ \
+ (unsigned)1 /* Version of index format */ \
@@ -77,10 +72,26 @@
+ H5F_SIZEOF_ADDR(f) /* Address of heap */ \
)
+/* Format overhead for all SOHM tree metadata in the file */
+#define H5SM_METADATA_PREFIX_SIZE ( \
+ H5_SIZEOF_MAGIC /* Signature */ \
+ + H5SM_SIZEOF_CHECKSUM /* Checksum */ \
+ )
+
+#define H5SM_TABLE_SIZE(f) ( \
+ /* General metadata fields */ \
+ H5SM_METADATA_PREFIX_SIZE \
+ \
+ /* Indices */ \
+ + ((f)->shared->sohm_nindexes * H5SM_INDEX_HEADER_SIZE(f)) \
+ )
+
#define H5SM_LIST_SIZE(f, num_mesg) ( \
- (unsigned) H5_SIZEOF_MAGIC /* Signature */ \
- + (H5SM_SOHM_ENTRY_SIZE(f) * num_mesg) /* Message entries */ \
- + (unsigned)H5SM_SIZEOF_CHECKSUM /* Checksum */ \
+ /* General metadata fields */ \
+ H5SM_METADATA_PREFIX_SIZE \
+ \
+ /* Message entries */ \
+ + (H5SM_SOHM_ENTRY_SIZE(f) * num_mesg) \
)
#define H5SM_B2_NODE_SIZE 512
@@ -154,6 +165,7 @@ typedef enum {
/* Typedef for a SOHM index header */
typedef struct {
+/* Stored */
unsigned mesg_types; /* Bit flag vector of message types */
size_t min_mesg_size; /* number of messages being tracked */
size_t list_max; /* >= this many messages, index with a B-tree */
@@ -162,6 +174,9 @@ typedef struct {
H5SM_index_type_t index_type; /* Is the index a list or a B-tree? */
haddr_t index_addr; /* Address of the actual index (list or B-tree) */
haddr_t heap_addr; /* Address of the fheap used to store shared messages */
+
+/* Not stored */
+ size_t list_size; /* Size of list index on disk */
} H5SM_index_header_t;
/* Typedef for a SOHM list */
@@ -173,12 +188,12 @@ typedef struct {
H5SM_sohm_t *messages; /* Actual list, stored as an array */
} H5SM_list_t;
-
/* Typedef for shared object header message master table */
struct H5SM_master_table_t {
/* Information for H5AC cache functions, _must_ be first field in structure */
H5AC_info_t cache_info;
+ size_t table_size; /* Size of table on disk */
unsigned num_indexes; /* Number of indexes */
H5SM_index_header_t *indexes; /* Array of num_indexes indexes */
};
@@ -222,7 +237,6 @@ typedef struct H5SM_bt2_ctx_t {
/* Callback info for loading a shared message table index into the cache */
typedef struct H5SM_table_cache_ud_t {
H5F_t *f; /* File that shared message index stored as a table is in */
- size_t table_size; /* Size of SOHM master table in file */
} H5SM_table_cache_ud_t;
/* Callback info for loading a shared message list index into the cache */
diff --git a/src/H5SMtest.c b/src/H5SMtest.c
index 78fb161..a22e9cc 100644
--- a/src/H5SMtest.c
+++ b/src/H5SMtest.c
@@ -96,7 +96,6 @@ H5SM_get_mesg_count_test(H5F_t *f, hid_t dxpl_id, unsigned type_id,
/* Set up user data for callback */
cache_udata.f = f;
- cache_udata.table_size = H5SM_TABLE_SIZE(f) + (f->shared->sohm_nindexes * H5SM_INDEX_HEADER_SIZE(f));
/* Look up the master SOHM table */
if(NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_TABLE, f->shared->sohm_addr, &cache_udata, H5AC_READ)))
diff --git a/test/cache.c b/test/cache.c
index 4b0c3e4..94e44a1 100644
--- a/test/cache.c
+++ b/test/cache.c
@@ -25,6 +25,7 @@
#include "H5ACprivate.h"
#include "cache_common.h"
+
/* private typedef declarations: */
struct flush_cache_test_spec
@@ -101,7 +102,7 @@ struct move_entry_test_spec
hbool_t is_pinned;
};
-
+
/* private function declarations: */
static unsigned smoke_check_1(void);
@@ -275,7 +276,7 @@ smoke_check_1(void)
/* verbose */ FALSE,
/* reset_stats */ TRUE,
/* display_stats */ display_stats,
- /* display_detailed_stats */ TRUE,
+ /* display_detailed_stats */ FALSE,
/* do_inserts */ TRUE,
/* do_moves */ TRUE,
/* move_to_main_addr */ FALSE,
@@ -293,7 +294,7 @@ smoke_check_1(void)
/* verbose */ FALSE,
/* reset_stats */ TRUE,
/* display_stats */ display_stats,
- /* display_detailed_stats */ TRUE,
+ /* display_detailed_stats */ FALSE,
/* do_inserts */ FALSE,
/* do_moves */ TRUE,
/* move_to_main_addr */ TRUE,
@@ -311,7 +312,7 @@ smoke_check_1(void)
/* verbose */ FALSE,
/* reset_stats */ TRUE,
/* display_stats */ display_stats,
- /* display_detailed_stats */ TRUE,
+ /* display_detailed_stats */ FALSE,
/* do_inserts */ TRUE,
/* do_moves */ TRUE,
/* move_to_main_addr */ FALSE,
@@ -2736,7 +2737,6 @@ check_insert_entry(void)
insert_entry(file_ptr, entry_type, 3, (H5C__SET_FLUSH_MARKER_FLAG | H5C__PIN_ENTRY_FLAG));
}
-
/* Verify that the entries are inserted as desired. */
i = 0;
@@ -2883,7 +2883,6 @@ check_insert_entry(void)
} /* while */
-
/* So much for looking at the individual entries. Now verify
* that the various counts and sized in the cache header are
* as expected.
@@ -2913,7 +2912,6 @@ check_insert_entry(void)
}
}
-
/* Finally, if stats collection is enabled, verify that the expected
* stats are collected.
*/
@@ -2940,7 +2938,6 @@ check_insert_entry(void)
}
#endif /* H5C_COLLECT_CACHE_STATS */
-
/* Unpin the pinned entries so we can take down the cache cleanly. */
if ( pass ) {
@@ -3225,92 +3222,92 @@ check_flush_cache__multi_entry(H5F_t * file_ptr)
struct flush_cache_test_spec spec[8] =
{
{
- /* entry_num = */ 0,
- /* entry_type = */ PICO_ENTRY_TYPE,
- /* entry_index = */ 100,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__NO_FLAGS_SET,
+ /* entry_num = */ 0,
+ /* entry_type = */ PICO_ENTRY_TYPE,
+ /* entry_index = */ 100,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__NO_FLAGS_SET,
/* expected_loaded = */ TRUE,
/* expected_cleared = */ FALSE,
/* expected_flushed = */ FALSE,
- /* expected_destroyed = */ FALSE
+ /* expected_destroyed = */ FALSE
},
{
- /* entry_num = */ 1,
- /* entry_type = */ PICO_ENTRY_TYPE,
- /* entry_index = */ 75,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__DIRTIED_FLAG,
+ /* entry_num = */ 1,
+ /* entry_type = */ PICO_ENTRY_TYPE,
+ /* entry_index = */ 75,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__DIRTIED_FLAG,
/* expected_loaded = */ TRUE,
/* expected_cleared = */ FALSE,
/* expected_flushed = */ TRUE,
- /* expected_destroyed = */ FALSE
+ /* expected_destroyed = */ FALSE
},
{
- /* entry_num = */ 2,
- /* entry_type = */ PICO_ENTRY_TYPE,
- /* entry_index = */ 25,
- /* insert_flag = */ TRUE,
- /* flags = */ H5C__NO_FLAGS_SET,
+ /* entry_num = */ 2,
+ /* entry_type = */ PICO_ENTRY_TYPE,
+ /* entry_index = */ 25,
+ /* insert_flag = */ TRUE,
+ /* flags = */ H5C__NO_FLAGS_SET,
/* expected_loaded = */ FALSE,
/* expected_cleared = */ FALSE,
/* expected_flushed = */ TRUE,
- /* expected_destroyed = */ FALSE
+ /* expected_destroyed = */ FALSE
},
{
- /* entry_num = */ 3,
- /* entry_type = */ PICO_ENTRY_TYPE,
- /* entry_index = */ 50,
- /* insert_flag = */ TRUE,
+ /* entry_num = */ 3,
+ /* entry_type = */ PICO_ENTRY_TYPE,
+ /* entry_index = */ 50,
+ /* insert_flag = */ TRUE,
/* flags = */ H5C__DIRTIED_FLAG,
/* expected_loaded = */ FALSE,
/* expected_cleared = */ FALSE,
/* expected_flushed = */ TRUE,
- /* expected_destroyed = */ FALSE
+ /* expected_destroyed = */ FALSE
},
{
- /* entry_num = */ 4,
- /* entry_type = */ MONSTER_ENTRY_TYPE,
- /* entry_index = */ 10,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
+ /* entry_num = */ 4,
+ /* entry_type = */ MONSTER_ENTRY_TYPE,
+ /* entry_index = */ 10,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
/* expected_loaded = */ TRUE,
/* expected_cleared = */ FALSE,
/* expected_flushed = */ FALSE,
- /* expected_destroyed = */ FALSE
+ /* expected_destroyed = */ FALSE
},
{
- /* entry_num = */ 5,
- /* entry_type = */ MONSTER_ENTRY_TYPE,
- /* entry_index = */ 20,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__DIRTIED_FLAG | H5C__SET_FLUSH_MARKER_FLAG,
+ /* entry_num = */ 5,
+ /* entry_type = */ MONSTER_ENTRY_TYPE,
+ /* entry_index = */ 20,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__DIRTIED_FLAG | H5C__SET_FLUSH_MARKER_FLAG,
/* expected_loaded = */ TRUE,
/* expected_cleared = */ FALSE,
/* expected_flushed = */ TRUE,
- /* expected_destroyed = */ FALSE
+ /* expected_destroyed = */ FALSE
},
{
- /* entry_num = */ 6,
- /* entry_type = */ MONSTER_ENTRY_TYPE,
- /* entry_index = */ 30,
- /* insert_flag = */ TRUE,
- /* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
+ /* entry_num = */ 6,
+ /* entry_type = */ MONSTER_ENTRY_TYPE,
+ /* entry_index = */ 30,
+ /* insert_flag = */ TRUE,
+ /* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
/* expected_loaded = */ FALSE,
/* expected_cleared = */ FALSE,
/* expected_flushed = */ TRUE,
- /* expected_destroyed = */ FALSE
+ /* expected_destroyed = */ FALSE
},
{
- /* entry_num = */ 7,
- /* entry_type = */ MONSTER_ENTRY_TYPE,
- /* entry_index = */ 40,
- /* insert_flag = */ TRUE,
+ /* entry_num = */ 7,
+ /* entry_type = */ MONSTER_ENTRY_TYPE,
+ /* entry_index = */ 40,
+ /* insert_flag = */ TRUE,
/* flags = */ H5C__DIRTIED_FLAG | H5C__SET_FLUSH_MARKER_FLAG,
/* expected_loaded = */ FALSE,
/* expected_cleared = */ FALSE,
/* expected_flushed = */ TRUE,
- /* expected_destroyed = */ FALSE
+ /* expected_destroyed = */ FALSE
}
};
@@ -4936,14 +4933,14 @@ check_flush_cache__multi_entry_test(H5F_t * file_ptr,
if ( spec[i].insert_flag ) {
insert_entry(file_ptr, spec[i].entry_type, spec[i].entry_index,
- spec[i].flags);
+ spec[i].flags);
} else {
protect_entry(file_ptr, spec[i].entry_type, spec[i].entry_index);
unprotect_entry(file_ptr, spec[i].entry_type, spec[i].entry_index,
- spec[i].flags);
+ spec[i].flags);
}
total_entry_size += entry_sizes[spec[i].entry_type];
@@ -5164,14 +5161,14 @@ check_flush_cache__pe_multi_entry_test(H5F_t * file_ptr,
if ( spec[i].insert_flag ) {
insert_entry(file_ptr, spec[i].entry_type, spec[i].entry_index,
- spec[i].flags);
+ spec[i].flags);
} else {
protect_entry(file_ptr, spec[i].entry_type, spec[i].entry_index);
unprotect_entry(file_ptr, spec[i].entry_type, spec[i].entry_index,
- spec[i].flags);
+ spec[i].flags);
}
total_entry_size += entry_sizes[spec[i].entry_type];
@@ -9765,12 +9762,12 @@ static void
check_flush_cache__flush_op_eviction_test(H5F_t * file_ptr)
{
/* const char * fcn_name = "check_flush_cache__flush_op_eviction_test"; */
+ H5C_t * cache_ptr = file_ptr->shared->cache;
int i;
int num_variable_entries = 8;
int num_monster_entries = 31;
int num_large_entries = 0;
herr_t result;
- H5C_t * cache_ptr = file_ptr->shared->cache;
test_entry_t * entry_ptr;
test_entry_t * base_addr;
struct expected_entry_status expected[8 + 31 + 14] =
@@ -10021,13 +10018,13 @@ check_flush_cache__flush_op_eviction_test(H5F_t * file_ptr)
for ( i = 0; i < 31; i++ )
{
protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i);
- unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, H5C__DIRTIED_FLAG);
+ unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, H5C__DIRTIED_FLAG);
}
for ( i = 0; i < 1; i++ )
{
protect_entry(file_ptr, LARGE_ENTRY_TYPE, i);
- unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, i, H5C__DIRTIED_FLAG);
+ unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, i, H5C__DIRTIED_FLAG);
}
/* The cache should now be exactly full */
@@ -10106,7 +10103,6 @@ check_flush_cache__flush_op_eviction_test(H5F_t * file_ptr)
(3 * VARIABLE_ENTRY_SIZE) +
(31 * MONSTER_ENTRY_SIZE) +
(2 * LARGE_ENTRY_SIZE)) ) ) {
-
pass = FALSE;
failure_mssg = "unexpected size/len in flush op eviction test 3.";
}
@@ -10270,13 +10266,13 @@ check_flush_cache__flush_op_eviction_test(H5F_t * file_ptr)
for ( i = 0; i < 31; i++ )
{
protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i);
- unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, H5C__DIRTIED_FLAG);
+ unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, H5C__DIRTIED_FLAG);
}
for ( i = 0; i < 5; i++ )
{
protect_entry(file_ptr, LARGE_ENTRY_TYPE, i);
- unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, i, H5C__DIRTIED_FLAG);
+ unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, i, H5C__DIRTIED_FLAG);
}
/* verify cache size */
@@ -10335,7 +10331,7 @@ check_flush_cache__flush_op_eviction_test(H5F_t * file_ptr)
for ( i = 5; i < 8; i++ )
{
protect_entry(file_ptr, LARGE_ENTRY_TYPE, i);
- unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, i, H5C__DIRTIED_FLAG);
+ unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, i, H5C__DIRTIED_FLAG);
}
/* verify cache size */
@@ -10396,7 +10392,7 @@ check_flush_cache__flush_op_eviction_test(H5F_t * file_ptr)
for ( i = 8; i < 9; i++ )
{
protect_entry(file_ptr, LARGE_ENTRY_TYPE, i);
- unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, i, H5C__DIRTIED_FLAG);
+ unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, i, H5C__DIRTIED_FLAG);
}
/* verify cache size */
@@ -10461,7 +10457,7 @@ check_flush_cache__flush_op_eviction_test(H5F_t * file_ptr)
for ( i = 9; i < 10; i++ )
{
protect_entry(file_ptr, LARGE_ENTRY_TYPE, i);
- unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, i, H5C__DIRTIED_FLAG);
+ unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, i, H5C__DIRTIED_FLAG);
}
/* verify cache size */
@@ -10496,13 +10492,13 @@ check_flush_cache__flush_op_eviction_test(H5F_t * file_ptr)
for ( i = 0; i < 31; i++ )
{
protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i);
- unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, H5C__DIRTIED_FLAG);
+ unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, H5C__DIRTIED_FLAG);
}
for ( i = 0; i < 10; i++ )
{
protect_entry(file_ptr, LARGE_ENTRY_TYPE, i);
- unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, i, H5C__DIRTIED_FLAG);
+ unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, i, H5C__DIRTIED_FLAG);
}
/* verify cache size */
@@ -10591,8 +10587,8 @@ check_flush_cache__flush_op_eviction_test(H5F_t * file_ptr)
num_large_entries = 12;
- /* a newly loaded entry is not inserted in the cache until after space has been
- * made for it. Thus (LET, 11) will not be flushed.
+ /* a newly loaded entry is not inserted in the cache until after
+ * space has been made for it. Thus (LET, 11) will not be flushed.
*/
for ( i = num_variable_entries;
i < num_variable_entries + num_monster_entries + num_large_entries - 1;
@@ -10605,7 +10601,7 @@ check_flush_cache__flush_op_eviction_test(H5F_t * file_ptr)
for ( i = 10; i < 12; i++ )
{
protect_entry(file_ptr, LARGE_ENTRY_TYPE, i);
- unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, i, H5C__DIRTIED_FLAG);
+ unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, i, H5C__DIRTIED_FLAG);
}
/* verify cache size */
@@ -10637,13 +10633,13 @@ check_flush_cache__flush_op_eviction_test(H5F_t * file_ptr)
for ( i = 0; i < num_monster_entries; i++ )
{
protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i);
- unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, H5C__DIRTIED_FLAG);
+ unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, H5C__DIRTIED_FLAG);
}
for ( i = 0; i < num_large_entries; i++ )
{
protect_entry(file_ptr, LARGE_ENTRY_TYPE, i);
- unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, i, H5C__DIRTIED_FLAG);
+ unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, i, H5C__DIRTIED_FLAG);
}
/* update the expected array to mark all these entries dirty again. */
@@ -10715,8 +10711,8 @@ check_flush_cache__flush_op_eviction_test(H5F_t * file_ptr)
num_large_entries = 14;
- /* a newly loaded entry is not inserted in the cache until after space has been
- * made for it. Thus (LET, 13) will not be flushed.
+ /* a newly loaded entry is not inserted in the cache until after
+ * space has been made for it. Thus (LET, 13) will not be flushed.
*/
for ( i = num_variable_entries;
i < num_variable_entries + num_monster_entries + num_large_entries - 1;
@@ -10729,7 +10725,7 @@ check_flush_cache__flush_op_eviction_test(H5F_t * file_ptr)
for ( i = 12; i < 14; i++ )
{
protect_entry(file_ptr, LARGE_ENTRY_TYPE, i);
- unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, i, H5C__DIRTIED_FLAG);
+ unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, i, H5C__DIRTIED_FLAG);
}
/* verify cache size */
@@ -10751,7 +10747,8 @@ check_flush_cache__flush_op_eviction_test(H5F_t * file_ptr)
expected);
}
- /* at this point we have cycled all the variable size entries through the cache.
+ /* at this point we have cycled all the variable size entries through
+ * the cache.
*
* flush the cache and end the test.
*/
@@ -13283,7 +13280,7 @@ check_flush_cache__pinned_single_entry_test(H5F_t * file_ptr,
( entry_ptr->cleared != expected_cleared ) ||
( entry_ptr->flushed != expected_flushed ) ||
( entry_ptr->destroyed != expected_destroyed ) ) {
-
+#if 0 /* this is useful debugging code -- keep it around */
HDfprintf(stdout,
"loaded = %d(%d), clrd = %d(%d), flshd = %d(%d), dest = %d(%d)\n",
(int)(entry_ptr->loaded),
@@ -13294,7 +13291,7 @@ check_flush_cache__pinned_single_entry_test(H5F_t * file_ptr,
(int)expected_flushed,
(int)(entry_ptr->destroyed),
(int)expected_destroyed);
-
+#endif
pass = FALSE;
HDsnprintf(msg, (size_t)128,
"Unexpected entry status after flush in pinned single entry test #%d.",
@@ -14713,10 +14710,6 @@ check_pin_protected_entry(void)
* Programmer: John Mainzer
* 7/7/06
*
- * Modifications:
- *
- * None.
- *
*-------------------------------------------------------------------------
*/
@@ -17190,13 +17183,6 @@ check_pin_entry_errs(void)
* Programmer: John Mainzer
* 6/24/04
*
- * Modifications:
- *
- * - Modified call to H5C_protect() to pass H5C__NO_FLAGS_SET in the
- * the new flags parameter.
- *
- * JRM -- 3/28/07
- *
*-------------------------------------------------------------------------
*/
@@ -17275,16 +17261,6 @@ check_double_protect_err(void)
* Programmer: John Mainzer
* 6/24/04
*
- * Modifications:
- *
- * JRM -- 6/17/05
- * Modified function to use the new dirtied parameter in
- * H5C_unprotect().
- *
- * JRM -- 9/8/05
- * Updated function for the new size change parameter in
- * H5C_unprotect(). We don't use them for now.
- *
*-------------------------------------------------------------------------
*/
@@ -17668,10 +17644,6 @@ check_resize_entry_errs(void)
* Programmer: John Mainzer
* 4/3/07
*
- * Modifications:
- *
- * None.
- *
*-------------------------------------------------------------------------
*/
@@ -18024,9 +17996,9 @@ check_check_evictions_enabled_err(void)
*
* Modifications:
*
- * John Mainzer 1/8/08
- * Added a basic set of tests for the flash cache size
- * increment code.
+ * John Mainzer 1/8/08
+ * Added a basic set of tests for the flash cache size
+ * increment code.
*
*-------------------------------------------------------------------------
*/
@@ -21487,19 +21459,19 @@ check_auto_cache_resize(void)
protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10);
resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, 1024, TRUE);
- unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, H5C__DIRTIED_FLAG);
+ unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, H5C__DIRTIED_FLAG);
protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11);
resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11, 1024, TRUE);
- unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11, H5C__DIRTIED_FLAG);
+ unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11, H5C__DIRTIED_FLAG);
protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12);
resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12, 1024, TRUE);
- unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12, H5C__DIRTIED_FLAG);
+ unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12, H5C__DIRTIED_FLAG);
protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 13);
resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 13, 1024, TRUE);
- unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 13, H5C__DIRTIED_FLAG);
+ unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 13, H5C__DIRTIED_FLAG);
flush_cache(file_ptr, TRUE, FALSE, FALSE);
@@ -21565,8 +21537,8 @@ check_auto_cache_resize(void)
if ( pass ) {
protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10);
- resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, 3 * 1024, TRUE);
- unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, H5C__DIRTIED_FLAG);
+ resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, (3 * 1024), TRUE);
+ unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, H5C__DIRTIED_FLAG);
if ( ( pass ) &&
@@ -21590,8 +21562,8 @@ check_auto_cache_resize(void)
if ( pass ) {
protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10);
- resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, 10 * 1024, TRUE);
- unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, H5C__DIRTIED_FLAG);
+ resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, (10 * 1024), TRUE);
+ unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, H5C__DIRTIED_FLAG);
if ( ( pass ) &&
@@ -21614,8 +21586,8 @@ check_auto_cache_resize(void)
if ( pass ) {
protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11);
- resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11, 10 * 1024, TRUE);
- unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11, H5C__DIRTIED_FLAG);
+ resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11, (10 * 1024), TRUE);
+ unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11, H5C__DIRTIED_FLAG);
if ( ( pass ) &&
@@ -21638,8 +21610,8 @@ check_auto_cache_resize(void)
if ( pass ) {
protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12);
- resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12, 10 * 1024, TRUE);
- unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12, H5C__DIRTIED_FLAG);
+ resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12, (10 * 1024), TRUE);
+ unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12, H5C__DIRTIED_FLAG);
if ( ( pass ) &&
@@ -21663,16 +21635,16 @@ check_auto_cache_resize(void)
if ( pass ) {
protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10);
- resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, 1 * 1024, TRUE);
- unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, H5C__DIRTIED_FLAG);
+ resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, (1 * 1024), TRUE);
+ unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, H5C__DIRTIED_FLAG);
protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11);
- resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11, 1 * 1024, TRUE);
- unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11, H5C__DIRTIED_FLAG);
+ resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11, (1 * 1024), TRUE);
+ unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11, H5C__DIRTIED_FLAG);
protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12);
- resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12, 1 * 1024, TRUE);
- unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12, H5C__DIRTIED_FLAG);
+ resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12, (1 * 1024), TRUE);
+ unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12, H5C__DIRTIED_FLAG);
if ( pass ) {
@@ -21815,16 +21787,16 @@ check_auto_cache_resize(void)
if ( pass ) {
protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10);
- resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, 1 * 1024, TRUE);
- unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, H5C__DIRTIED_FLAG);
+ resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, (1 * 1024), TRUE);
+ unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, H5C__DIRTIED_FLAG);
protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11);
- resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11, 1 * 1024, TRUE);
- unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11, H5C__DIRTIED_FLAG);
+ resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11, (1 * 1024), TRUE);
+ unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11, H5C__DIRTIED_FLAG);
protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12);
- resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12, 1 * 1024, TRUE);
- unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12, H5C__DIRTIED_FLAG);
+ resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12, (1 * 1024), TRUE);
+ unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12, H5C__DIRTIED_FLAG);
if ( pass ) {
@@ -22245,9 +22217,9 @@ check_auto_cache_resize(void)
*
* Modifications:
*
- * Added code to include the flash cache size increment
- * code in this test.
- * JRM -- 1/10/08
+ * Added code to include the flash cache size increment
+ * code in this test.
+ * JRM -- 1/10/08
*
*-------------------------------------------------------------------------
*/
@@ -28353,7 +28325,7 @@ check_auto_cache_resize_aux_fcns(void)
pass = FALSE;
failure_mssg = "H5C_get_cache_hit_rate failed.\n";
- } else if ( HDfabs(hit_rate - 0.5) > FP_EPSILON ) { /* i.e. hit_rate != 0.5 */
+ } else if ( ! DBL_REL_EQUAL(hit_rate, 0.5, FP_EPSILON) ) { /* i.e. hit_rate != 0.5 */
pass = FALSE;
failure_mssg =
@@ -28436,7 +28408,7 @@ check_auto_cache_resize_aux_fcns(void)
pass = FALSE;
failure_mssg = "H5C_get_cache_hit_rate failed.\n";
- } else if ( HDfabs(hit_rate - 0.5) > FP_EPSILON ) { /* i.e. hit_rate != 0.5 */
+ } else if ( ! DBL_REL_EQUAL(hit_rate, 0.5, FP_EPSILON) ) { /* i.e. hit_rate != 0.5 */
pass = FALSE;
failure_mssg =
diff --git a/test/cache_api.c b/test/cache_api.c
index e7ba7bd..8ad3635 100644
--- a/test/cache_api.c
+++ b/test/cache_api.c
@@ -30,59 +30,12 @@
/* macro definitions */
-#define RESIZE_CONFIGS_ARE_EQUAL(a, b, compare_init) \
-( ( (a).version == (b).version ) && \
- ( (a).rpt_fcn == (b).rpt_fcn ) && \
- ( ( ! compare_init ) || \
- ( (a).set_initial_size == (b).set_initial_size ) ) && \
- ( ( ! compare_init ) || \
- ( (a).initial_size == (b).initial_size ) ) && \
- ( (a).min_clean_fraction == (b).min_clean_fraction ) && \
- ( (a).max_size == (b).max_size ) && \
- ( (a).min_size == (b).min_size ) && \
- ( (a).epoch_length == (b).epoch_length ) && \
- ( (a).incr_mode == (b).incr_mode ) && \
- ( (a).lower_hr_threshold == (b).lower_hr_threshold ) && \
- ( (a).increment == (b).increment ) && \
- ( (a).apply_max_increment == (b).apply_max_increment ) && \
- ( (a).max_increment == (b).max_increment ) && \
- ( (a).flash_incr_mode == (b).flash_incr_mode ) && \
- ( (a).flash_multiple == (b).flash_multiple ) && \
- ( (a).flash_threshold == (b).flash_threshold ) && \
- ( (a).decr_mode == (b).decr_mode ) && \
- ( (a).upper_hr_threshold == (b).upper_hr_threshold ) && \
- ( (a).decrement == (b).decrement ) && \
- ( (a).apply_max_decrement == (b).apply_max_decrement ) && \
- ( (a).max_decrement == (b).max_decrement ) && \
- ( (a).epochs_before_eviction == (b).epochs_before_eviction ) && \
- ( (a).apply_empty_reserve == (b).apply_empty_reserve ) && \
- ( (a).empty_reserve == (b).empty_reserve ) )
-
-
/* private function declarations: */
static void check_fapl_mdc_api_calls(void);
-static void validate_mdc_config(hid_t file_id,
- H5AC_cache_config_t * ext_config_ptr,
- hbool_t compare_init,
- int test_num);
-
static void check_file_mdc_api_calls(void);
-static void check_and_validate_cache_hit_rate(hid_t file_id,
- double * hit_rate_ptr,
- hbool_t dump_data,
- int64_t min_accesses,
- double min_hit_rate);
-
-static void check_and_validate_cache_size(hid_t file_id,
- size_t * max_size_ptr,
- size_t * min_clean_size_ptr,
- size_t * cur_size_ptr,
- int32_t * cur_num_entries_ptr,
- hbool_t dump_data);
-
static void mdc_api_call_smoke_check(int express_test);
static void check_fapl_mdc_api_errs(void);
@@ -117,73 +70,6 @@ static void check_file_mdc_api_errs(void);
*-------------------------------------------------------------------------
*/
-#define CACHE_CONFIGS_EQUAL(a, b, cmp_set_init, cmp_init_size) \
- ( ( (a).version == (b).version ) && \
- ( (a).rpt_fcn_enabled == (b).rpt_fcn_enabled ) && \
- ( (a).open_trace_file == (b).open_trace_file ) && \
- ( (a).close_trace_file == (b).close_trace_file ) && \
- ( ( (a).open_trace_file == FALSE ) || \
- ( strcmp((a).trace_file_name, (b).trace_file_name) == 0 ) ) && \
- ( (a).evictions_enabled == (b).evictions_enabled ) && \
- ( ( ! cmp_set_init ) || \
- ( (a).set_initial_size == (b).set_initial_size ) ) && \
- ( ( ! cmp_init_size ) || \
- ( (a).initial_size == (b).initial_size ) ) && \
- ( (a).min_clean_fraction == (b).min_clean_fraction ) && \
- ( (a).max_size == (b).max_size ) && \
- ( (a).min_size == (b).min_size ) && \
- ( (a).epoch_length == (b).epoch_length ) && \
- ( (a).incr_mode == (b).incr_mode ) && \
- ( (a).lower_hr_threshold == (b).lower_hr_threshold ) && \
- ( (a).increment == (b).increment ) && \
- ( (a).apply_max_increment == (b).apply_max_increment ) && \
- ( (a).max_increment == (b).max_increment ) && \
- ( (a).flash_incr_mode == (b).flash_incr_mode ) && \
- ( (a).flash_multiple == (b).flash_multiple ) && \
- ( (a).flash_threshold == (b).flash_threshold ) && \
- ( (a).decr_mode == (b).decr_mode ) && \
- ( (a).upper_hr_threshold == (b).upper_hr_threshold ) && \
- ( (a).decrement == (b).decrement ) && \
- ( (a).apply_max_decrement == (b).apply_max_decrement ) && \
- ( (a).max_decrement == (b).max_decrement ) && \
- ( (a).epochs_before_eviction == (b).epochs_before_eviction ) && \
- ( (a).apply_empty_reserve == (b).apply_empty_reserve ) && \
- ( (a).empty_reserve == (b).empty_reserve ) )
-
-#define XLATE_EXT_TO_INT_MDC_CONFIG(i, e) \
-{ \
- (i).version = H5C__CURR_AUTO_SIZE_CTL_VER; \
- if ( (e).rpt_fcn_enabled ) \
- (i).rpt_fcn = H5C_def_auto_resize_rpt_fcn; \
- else \
- (i).rpt_fcn = NULL; \
- (i).set_initial_size = (e).set_initial_size; \
- (i).initial_size = (e).initial_size; \
- (i).min_clean_fraction = (e).min_clean_fraction; \
- (i).max_size = (e).max_size; \
- (i).min_size = (e).min_size; \
- (i).epoch_length = (long int)((e).epoch_length); \
- (i).incr_mode = (e).incr_mode; \
- (i).lower_hr_threshold = (e).lower_hr_threshold; \
- (i).increment = (e).increment; \
- (i).apply_max_increment = (e).apply_max_increment; \
- (i).max_increment = (e).max_increment; \
- (i).flash_incr_mode = (e).flash_incr_mode; \
- (i).flash_multiple = (e).flash_multiple; \
- (i).flash_threshold = (e).flash_threshold; \
- (i).decr_mode = (e).decr_mode; \
- (i).upper_hr_threshold = (e).upper_hr_threshold; \
- (i).flash_incr_mode = (e).flash_incr_mode; \
- (i).flash_multiple = (e).flash_multiple; \
- (i).flash_threshold = (e).flash_threshold; \
- (i).decrement = (e).decrement; \
- (i).apply_max_decrement = (e).apply_max_decrement; \
- (i).max_decrement = (e).max_decrement; \
- (i).epochs_before_eviction = (int)((e).epochs_before_eviction); \
- (i).apply_empty_reserve = (e).apply_empty_reserve; \
- (i).empty_reserve = (e).empty_reserve; \
-}
-
static void
check_fapl_mdc_api_calls(void)
{
@@ -382,7 +268,7 @@ check_fapl_mdc_api_calls(void)
pass = FALSE;
- failure_mssg = "Unexpected value(s) in cache resize_ctl.\n";
+ failure_mssg = "Unexpected value(s) in cache resize_ctl 1.\n";
}
}
@@ -531,7 +417,7 @@ check_fapl_mdc_api_calls(void)
pass = FALSE;
- failure_mssg = "Unexpected value(s) in cache resize_ctl.\n";
+ failure_mssg = "Unexpected value(s) in cache resize_ctl 2.\n";
}
}
@@ -608,128 +494,6 @@ check_fapl_mdc_api_calls(void)
/*-------------------------------------------------------------------------
- * Function: validate_mdc_config()
- *
- * Purpose: Verify that the file indicated by the file_id parameter
- * has both internal and external configuration matching
- * *config_ptr.
- *
- * Do nothin on success. On failure, set pass to FALSE, and
- * load an error message into failue_mssg. Note that
- * failure_msg is assumed to be at least 128 bytes in length.
- *
- * Return: void
- *
- * Programmer: John Mainzer
- * 4/14/04
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-
-static void
-validate_mdc_config(hid_t file_id,
- H5AC_cache_config_t * ext_config_ptr,
- hbool_t compare_init,
- int test_num)
-{
- /* const char * fcn_name = "validate_mdc_config()"; */
- static char msg[256];
- H5F_t * file_ptr = NULL;
- H5C_t * cache_ptr = NULL;
- H5AC_cache_config_t scratch;
- H5C_auto_size_ctl_t int_config;
-
- XLATE_EXT_TO_INT_MDC_CONFIG(int_config, (*ext_config_ptr))
-
- /* get a pointer to the files internal data structure */
- if ( pass ) {
-
- file_ptr = (H5F_t *)H5I_object_verify(file_id, H5I_FILE);
-
- if ( file_ptr == NULL ) {
-
- pass = FALSE;
- HDsnprintf(msg, (size_t)128, "Can't get file_ptr #%d.", test_num);
- failure_mssg = msg;
-
- } else {
-
- cache_ptr = file_ptr->shared->cache;
- }
- }
-
- /* verify that we can access the internal version of the cache config */
- if ( pass ) {
-
- if ( ( cache_ptr == NULL ) ||
- ( cache_ptr->magic != H5C__H5C_T_MAGIC ) ||
- ( cache_ptr->resize_ctl.version != H5C__CURR_AUTO_SIZE_CTL_VER ) ){
-
- pass = FALSE;
- HDsnprintf(msg, (size_t)128,
- "Can't access cache resize_ctl #%d.", test_num);
- failure_mssg = msg;
- }
- }
-
- /* compare the cache's internal configuration with the expected value */
- if ( pass ) {
-
- if ( ! RESIZE_CONFIGS_ARE_EQUAL(int_config, cache_ptr->resize_ctl,
- compare_init) ) {
-
- pass = FALSE;
- HDsnprintf(msg, (size_t)128,
- "Unexpected internal config #%d.", test_num);
- failure_mssg = msg;
- }
- }
-
- /* obtain external cache config */
- if ( pass ) {
-
- scratch.version = H5AC__CURR_CACHE_CONFIG_VERSION;
-
- if ( H5Fget_mdc_config(file_id, &scratch) < 0 ) {
-
- pass = FALSE;
- HDsnprintf(msg, (size_t)128,
- "H5Fget_mdc_config() failed #%d.", test_num);
- failure_mssg = msg;
- }
- }
-
- if ( pass ) {
-
- /* Recall that in any configuration supplied by the cache
- * at run time, the set_initial_size field will always
- * be FALSE, regardless of the value passed in. Thus we
- * always presume that this field need not match that of
- * the supplied external configuration.
- *
- * The cache also sets the initial_size field to the current
- * cache max size instead of the value initialy supplied.
- * Depending on circumstances, this may or may not match
- * the original. Hence the compare_init parameter.
- */
- if ( ! CACHE_CONFIGS_EQUAL((*ext_config_ptr), scratch, \
- FALSE, compare_init) ) {
-
- pass = FALSE;
- HDsnprintf(msg, (size_t)128,
- "Unexpected external config #%d.", test_num);
- failure_mssg = msg;
- }
- }
-
- return;
-
-} /* validate_mdc_config() */
-
-
-/*-------------------------------------------------------------------------
* Function: check_file_mdc_api_calls()
*
* Purpose: Verify that the file related metadata cache API calls are
@@ -1072,282 +836,6 @@ check_file_mdc_api_calls(void)
/*-------------------------------------------------------------------------
- * Function: check_and_validate_cache_hit_rate()
- *
- * Purpose: Use the API functions to get and reset the cache hit rate.
- * Verify that the value returned by the API call agrees with
- * the cache internal data structures.
- *
- * If the number of cache accesses exceeds the value provided
- * in the min_accesses parameter, and the hit rate is less than
- * min_hit_rate, set pass to FALSE, and set failure_mssg to
- * a string indicating that hit rate was unexpectedly low.
- *
- * Return hit rate in *hit_rate_ptr, and print the data to
- * stdout if requested.
- *
- * If an error is detected, set pass to FALSE, and set
- * failure_mssg to an appropriate value.
- *
- * Return: void
- *
- * Programmer: John Mainzer
- * 4/18/04
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-
-static void
-check_and_validate_cache_hit_rate(hid_t file_id,
- double * hit_rate_ptr,
- hbool_t dump_data,
- int64_t min_accesses,
- double min_hit_rate)
-{
- /* const char * fcn_name = "check_and_validate_cache_hit_rate()"; */
- herr_t result;
- int64_t cache_hits = 0;
- int64_t cache_accesses = 0;
- double expected_hit_rate;
- double hit_rate;
- H5F_t * file_ptr = NULL;
- H5C_t * cache_ptr = NULL;
-
- /* get a pointer to the files internal data structure */
- if ( pass ) {
-
- file_ptr = (H5F_t *)H5I_object_verify(file_id, H5I_FILE);
-
- if ( file_ptr == NULL ) {
-
- pass = FALSE;
- failure_mssg = "Can't get file_ptr.";
-
- } else {
-
- cache_ptr = file_ptr->shared->cache;
- }
- }
-
- /* verify that we can access the cache data structure */
- if ( pass ) {
-
- if ( ( cache_ptr == NULL ) ||
- ( cache_ptr->magic != H5C__H5C_T_MAGIC ) ) {
-
- pass = FALSE;
- failure_mssg = "Can't access cache resize_ctl.";
- }
- }
-
- /* compare the cache's internal configuration with the expected value */
- if ( pass ) {
-
- cache_hits = cache_ptr->cache_hits;
- cache_accesses = cache_ptr->cache_accesses;
-
- if ( cache_accesses > 0 ) {
-
- expected_hit_rate = ((double)cache_hits) / ((double)cache_accesses);
-
- } else {
-
- expected_hit_rate = 0.0;
- }
-
- result = H5Fget_mdc_hit_rate(file_id, &hit_rate);
-
- if ( result < 0 ) {
-
- pass = FALSE;
- failure_mssg = "H5Fget_mdc_hit_rate() failed.";
-
- } else if ( hit_rate != expected_hit_rate ) {
-
- pass = FALSE;
- failure_mssg = "unexpected hit rate.";
- }
- }
-
- if ( pass ) { /* reset the hit rate */
-
- result = H5Freset_mdc_hit_rate_stats(file_id);
-
- if ( result < 0 ) {
-
- pass = FALSE;
- failure_mssg = "H5Freset_mdc_hit_rate_stats() failed.";
- }
- }
-
- /* set *hit_rate_ptr if appropriate */
- if ( ( pass ) && ( hit_rate_ptr != NULL ) ) {
-
- *hit_rate_ptr = hit_rate;
- }
-
- /* dump data to stdout if requested */
- if ( ( pass ) && ( dump_data ) ) {
-
- HDfprintf(stdout,
- "cache_hits: %ld, cache_accesses: %ld, hit_rate: %lf\n",
- (long)cache_hits, (long)cache_accesses, hit_rate);
- }
-
- if ( ( pass ) &&
- ( cache_accesses > min_accesses ) &&
- ( hit_rate < min_hit_rate ) ) {
-
- pass = FALSE;
- failure_mssg = "Unexpectedly low hit rate.";
- }
-
- return;
-
-} /* check_and_validate_cache_hit_rate() */
-
-
-/*-------------------------------------------------------------------------
- * Function: check_and_validate_cache_size()
- *
- * Purpose: Use the API function to get the cache size data. Verify
- * that the values returned by the API call agree with
- * the cache internal data structures.
- *
- * Return size data in the locations specified by the pointer
- * parameters if these parameters are not NULL. Print the
- * data to stdout if requested.
- *
- * If an error is detected, set pass to FALSE, and set
- * failure_mssg to an appropriate value.
- *
- * Return: void
- *
- * Programmer: John Mainzer
- * 4/18/04
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-
-static void
-check_and_validate_cache_size(hid_t file_id,
- size_t * max_size_ptr,
- size_t * min_clean_size_ptr,
- size_t * cur_size_ptr,
- int32_t * cur_num_entries_ptr,
- hbool_t dump_data)
-{
- /* const char * fcn_name = "check_and_validate_cache_size()"; */
- herr_t result;
- size_t expected_max_size;
- size_t max_size;
- size_t expected_min_clean_size;
- size_t min_clean_size;
- size_t expected_cur_size;
- size_t cur_size;
- int32_t expected_cur_num_entries;
- int cur_num_entries;
- H5F_t * file_ptr = NULL;
- H5C_t * cache_ptr = NULL;
-
- /* get a pointer to the files internal data structure */
- if ( pass ) {
-
- file_ptr = (H5F_t *)H5I_object_verify(file_id, H5I_FILE);
-
- if ( file_ptr == NULL ) {
-
- pass = FALSE;
- failure_mssg = "Can't get file_ptr.";
-
- } else {
-
- cache_ptr = file_ptr->shared->cache;
- }
- }
-
- /* verify that we can access the cache data structure */
- if ( pass ) {
-
- if ( ( cache_ptr == NULL ) ||
- ( cache_ptr->magic != H5C__H5C_T_MAGIC ) ) {
-
- pass = FALSE;
- failure_mssg = "Can't access cache data structure.";
- }
- }
-
- /* compare the cache's internal configuration with the expected value */
- if ( pass ) {
-
- expected_max_size = cache_ptr->max_cache_size;
- expected_min_clean_size = cache_ptr->min_clean_size;
- expected_cur_size = cache_ptr->index_size;
- expected_cur_num_entries = cache_ptr->index_len;
-
- result = H5Fget_mdc_size(file_id,
- &max_size,
- &min_clean_size,
- &cur_size,
- &cur_num_entries);
-
- if ( result < 0 ) {
-
- pass = FALSE;
- failure_mssg = "H5Fget_mdc_size() failed.";
-
- } else if ( ( max_size != expected_max_size ) ||
- ( min_clean_size != expected_min_clean_size ) ||
- ( cur_size != expected_cur_size ) ||
- ( cur_num_entries != (int)expected_cur_num_entries ) ) {
-
- pass = FALSE;
- failure_mssg = "H5Fget_mdc_size() returned unexpected value(s).";
-
- }
- }
-
- /* return size values if requested */
- if ( ( pass ) && ( max_size_ptr != NULL ) ) {
-
- *max_size_ptr = max_size;
- }
-
- if ( ( pass ) && ( min_clean_size_ptr != NULL ) ) {
-
- *min_clean_size_ptr = min_clean_size;
- }
-
- if ( ( pass ) && ( cur_size_ptr != NULL ) ) {
-
- *cur_size_ptr = cur_size;
- }
-
- if ( ( pass ) && ( cur_num_entries_ptr != NULL ) ) {
-
- *cur_num_entries_ptr = cur_num_entries;
- }
-
-
- /* dump data to stdout if requested */
- if ( ( pass ) && ( dump_data ) ) {
-
- HDfprintf(stdout,
- "max_sz: %ld, min_clean_sz: %ld, cur_sz: %ld, cur_ent: %ld\n",
- (long)max_size, (long)min_clean_size, (long)cur_size,
- (long)cur_num_entries);
- }
-
- return;
-
-} /* check_and_validate_cache_size() */
-
-
-/*-------------------------------------------------------------------------
* Function: mdc_api_call_smoke_check()
*
* Purpose:
@@ -3424,7 +2912,9 @@ check_fapl_mdc_api_errs(void)
scratch.version = H5C__CURR_AUTO_SIZE_CTL_VER;
if ( pass ) {
- H5E_BEGIN_TRY { result = H5Pget_mdc_config(-1, &scratch); } H5E_END_TRY;
+ H5E_BEGIN_TRY {
+ result = H5Pget_mdc_config(-1, &scratch);
+ } H5E_END_TRY;
if ( result >= 0 ) {
diff --git a/test/cache_common.c b/test/cache_common.c
index 868b4d9..4024816 100644
--- a/test/cache_common.c
+++ b/test/cache_common.c
@@ -547,10 +547,6 @@ check_write_permitted(const H5F_t UNUSED * f,
* Programmer: John Mainzer
* 6/10/04
*
- * Modifications:
- *
- * Added variable_clear. -- JRM 8/30/06
- *
*-------------------------------------------------------------------------
*/
@@ -682,16 +678,6 @@ notify_clear(H5F_t * f, void * thing, hbool_t dest)
* Programmer: John Mainzer
* 6/10/04
*
- * Modifications:
- *
- * JRM -- 4/4/06
- * Added code to decrement the pinning_ref_count s of entries
- * pinned by the target entry, and to unpin those entries
- * if the reference count drops to zero.
- *
- * JRM -- 8/30/06
- * Added variable_destroy().
- *
*-------------------------------------------------------------------------
*/
@@ -855,14 +841,6 @@ notify_dest(H5F_t * f, void * thing)
* Programmer: John Mainzer
* 6/10/04
*
- * Modifications:
- *
- * JRM -- 8/30/06
- * Added variable_flush() and flags_ptr parameter.
- *
- * JRM -- 9/1/06
- * Added support for flush operations.
- *
*-------------------------------------------------------------------------
*/
@@ -1042,11 +1020,6 @@ notify_flush(H5F_t *f, hid_t dxpl_id, hbool_t dest, haddr_t addr,
* Programmer: John Mainzer
* 6/10/04
*
- * Modifications:
- *
- * JRM -- 8/30/06
- * Added variable_load().
- *
*-------------------------------------------------------------------------
*/
@@ -1177,11 +1150,6 @@ notify_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata)
* Programmer: John Mainzer
* 6/10/04
*
- * Modifications:
- *
- * JRM -- 8/30/06
- * Added variable_size().
- *
*-------------------------------------------------------------------------
*/
@@ -1605,7 +1573,7 @@ execute_flush_op(H5F_t * file_ptr,
{
H5C_t * cache_ptr;
- HDassert( file_ptr ) ;
+ HDassert( file_ptr );
cache_ptr = file_ptr->shared->cache;
HDassert( cache_ptr != NULL );
HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC );
@@ -1616,7 +1584,7 @@ execute_flush_op(H5F_t * file_ptr,
( entry_ptr->header.size == entry_ptr->size ) );
HDassert( op_ptr != NULL );
HDassert( ( 0 <= entry_ptr->type ) &&
- ( entry_ptr->type < NUMBER_OF_ENTRY_TYPES ) );
+ ( entry_ptr->type < NUMBER_OF_ENTRY_TYPES ) );
HDassert( ( 0 <= entry_ptr->index ) &&
( entry_ptr->index <= max_indices[entry_ptr->type] ) );
HDassert( ( 0 <= op_ptr->type ) &&
@@ -1926,26 +1894,27 @@ resize_entry(H5F_t * file_ptr,
if ( pass ) {
- base_addr = entries[type];
- entry_ptr = &(base_addr[idx]);
-
- HDassert( entry_ptr->index == idx );
- HDassert( entry_ptr->type == type );
- HDassert( entry_ptr == entry_ptr->self );
-
if ( in_cache ) {
H5C_t *cache_ptr = file_ptr->shared->cache;
HDassert( cache_ptr );
- if ( ! entry_in_cache(cache_ptr, type, idx) ) {
+ if ( ! entry_in_cache(cache_ptr, type, idx) ) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "entry to be resized pinned is not in cache.";
- } else {
+ } else {
- if ( ! ( entry_ptr->header.is_pinned || entry_ptr->header.is_protected ) ) {
+ base_addr = entries[type];
+ entry_ptr = &(base_addr[idx]);
+
+ HDassert( entry_ptr->index == idx );
+ HDassert( entry_ptr->type == type );
+ HDassert( entry_ptr->cache_ptr == cache_ptr );
+ HDassert( entry_ptr == entry_ptr->self );
+
+ if ( ! ( entry_ptr->header.is_pinned || entry_ptr->header.is_protected ) ) {
pass = FALSE;
failure_mssg = "entry to be resized is not pinned or protected.";
@@ -3088,9 +3057,8 @@ insert_entry(H5F_t * file_ptr,
void
mark_entry_dirty(int32_t type,
- int32_t idx)
+ int32_t idx)
{
- /* const char * fcn_name = "mark_pinned_entry_dirty()"; */
herr_t result;
test_entry_t * base_addr;
test_entry_t * entry_ptr;
@@ -3138,7 +3106,7 @@ mark_entry_dirty(int32_t type,
/*-------------------------------------------------------------------------
* Function: move_entry()
*
- * Purpose: move the entry indicated by the type and index to its
+ * Purpose: Move the entry indicated by the type and index to its
* main or alternate address as indicated. If the entry is
* already at the desired entry, do nothing.
*
@@ -3163,70 +3131,73 @@ move_entry(H5C_t * cache_ptr,
test_entry_t * base_addr;
test_entry_t * entry_ptr;
- HDassert( cache_ptr );
- HDassert( ( 0 <= type ) && ( type < NUMBER_OF_ENTRY_TYPES ) );
- HDassert( ( 0 <= idx ) && ( idx <= max_indices[type] ) );
+ if ( pass ) {
- base_addr = entries[type];
- entry_ptr = &(base_addr[idx]);
+ HDassert( cache_ptr );
+ HDassert( ( 0 <= type ) && ( type < NUMBER_OF_ENTRY_TYPES ) );
+ HDassert( ( 0 <= idx ) && ( idx <= max_indices[type] ) );
- HDassert( entry_ptr->index == idx );
- HDassert( entry_ptr->type == type );
- HDassert( entry_ptr == entry_ptr->self );
- HDassert( entry_ptr->cache_ptr == cache_ptr );
- HDassert( !(entry_ptr->is_protected) );
- HDassert( !(entry_ptr->header.is_protected) );
+ base_addr = entries[type];
+ entry_ptr = &(base_addr[idx]);
+ HDassert( entry_ptr->index == idx );
+ HDassert( entry_ptr->type == type );
+ HDassert( entry_ptr == entry_ptr->self );
+ HDassert( entry_ptr->cache_ptr == cache_ptr );
+ HDassert( !(entry_ptr->is_protected) );
+ HDassert( !(entry_ptr->header.is_protected) );
- if ( entry_ptr->at_main_addr && !main_addr ) {
- /* move to alt addr */
+ if ( entry_ptr->at_main_addr && !main_addr ) {
- HDassert( entry_ptr->addr == entry_ptr->main_addr );
+ /* move to alt addr */
- done = FALSE;
- old_addr = entry_ptr->addr;
- new_addr = entry_ptr->alt_addr;
+ HDassert( entry_ptr->addr == entry_ptr->main_addr );
- } else if ( !(entry_ptr->at_main_addr) && main_addr ) {
+ done = FALSE;
+ old_addr = entry_ptr->addr;
+ new_addr = entry_ptr->alt_addr;
- /* move to main addr */
+ } else if ( !(entry_ptr->at_main_addr) && main_addr ) {
- HDassert( entry_ptr->addr == entry_ptr->alt_addr );
+ /* move to main addr */
- done = FALSE;
- old_addr = entry_ptr->addr;
- new_addr = entry_ptr->main_addr;
- }
+ HDassert( entry_ptr->addr == entry_ptr->alt_addr );
- if ( ! done ) {
+ done = FALSE;
+ old_addr = entry_ptr->addr;
+ new_addr = entry_ptr->main_addr;
+ }
- entry_ptr->is_dirty = TRUE;
+ if ( ! done ) {
- result = H5C_move_entry(cache_ptr, &(types[type]),
- old_addr, new_addr);
- }
+ entry_ptr->is_dirty = TRUE;
- if ( ! done ) {
+ result = H5C_move_entry(cache_ptr, &(types[type]),
+ old_addr, new_addr);
+ }
- if ( ( result < 0 ) ||
- ( ( ! ( entry_ptr->header.destroy_in_progress ) ) &&
- ( entry_ptr->header.addr != new_addr ) ) ) {
+ if ( ! done ) {
- pass = FALSE;
- failure_mssg = "error in H5C_move_entry().";
+ if ( ( result < 0 ) ||
+ ( ( ! ( entry_ptr->header.destroy_in_progress ) ) &&
+ ( entry_ptr->header.addr != new_addr ) ) ) {
- } else {
+ pass = FALSE;
+ failure_mssg = "error in H5C_move_entry().";
+
+ } else {
- entry_ptr->addr = new_addr;
- entry_ptr->at_main_addr = main_addr;
+ entry_ptr->addr = new_addr;
+ entry_ptr->at_main_addr = main_addr;
+ }
}
- }
- HDassert( ((entry_ptr->header).type)->id == type );
+ HDassert( ((entry_ptr->header).type)->id == type );
- HDassert( entry_ptr->header.is_dirty );
- HDassert( entry_ptr->is_dirty );
+ HDassert( entry_ptr->header.is_dirty );
+ HDassert( entry_ptr->is_dirty );
+ }
return;
@@ -3253,7 +3224,6 @@ protect_entry(H5F_t * file_ptr,
int32_t type,
int32_t idx)
{
- /* const char * fcn_name = "protect_entry()"; */
H5C_t * cache_ptr;
test_entry_t * base_addr;
test_entry_t * entry_ptr;
@@ -3489,7 +3459,6 @@ unpin_entry(int32_t type,
test_entry_t * entry_ptr;
if ( pass ) {
-
HDassert( ( 0 <= type ) && ( type < NUMBER_OF_ENTRY_TYPES ) );
HDassert( ( 0 <= idx ) && ( idx <= max_indices[type] ) );
@@ -3552,8 +3521,6 @@ unprotect_entry(H5F_t * file_ptr,
int32_t idx,
unsigned int flags)
{
- /* const char * fcn_name = "unprotect_entry()"; */
- H5C_t *cache_ptr;
herr_t result;
hbool_t pin_flag_set;
hbool_t unpin_flag_set;
@@ -3561,10 +3528,6 @@ unprotect_entry(H5F_t * file_ptr,
test_entry_t * entry_ptr;
if ( pass ) {
-
- cache_ptr = file_ptr->shared->cache;
-
- HDassert( cache_ptr );
HDassert( ( 0 <= type ) && ( type < NUMBER_OF_ENTRY_TYPES ) );
HDassert( ( 0 <= idx ) && ( idx <= max_indices[type] ) );
@@ -3574,7 +3537,6 @@ unprotect_entry(H5F_t * file_ptr,
HDassert( entry_ptr->index == idx );
HDassert( entry_ptr->type == type );
HDassert( entry_ptr == entry_ptr->self );
- HDassert( entry_ptr->cache_ptr == cache_ptr );
HDassert( entry_ptr->header.is_protected );
HDassert( entry_ptr->is_protected );
@@ -3599,26 +3561,6 @@ unprotect_entry(H5F_t * file_ptr,
( entry_ptr->size != entry_ptr->header.size ) ||
( entry_ptr->addr != entry_ptr->header.addr ) ) {
-#if 1 /* JRM */
- if ( result < 0 ) {
- HDfprintf(stdout, "result is negative.\n");
- }
- if ( ( entry_ptr->header.is_protected ) &&
- ( ( ! ( entry_ptr->is_read_only ) ) ||
- ( entry_ptr->ro_ref_count <= 0 ) ) ) {
- HDfprintf(stdout, "protected and not RO or refcnt <= 0.\n");
- }
- if ( entry_ptr->header.type != &(types[type]) ) {
- HDfprintf(stdout, "type disagreement.\n");
- }
- if ( entry_ptr->size != entry_ptr->header.size ) {
- HDfprintf(stdout, "size disagreement.\n");
- }
- if ( entry_ptr->addr != entry_ptr->header.addr ) {
- HDfprintf(stdout, "addr disagreement.\n");
- }
-#endif /* JRM */
-
pass = FALSE;
failure_mssg = "error in H5C_unprotect().";
@@ -5133,3 +5075,399 @@ destroy_flush_dependency(int32_t par_type,
} /* destroy_flush_dependency() */
+
+/*** H5AC level utility functions ***/
+
+
+/*-------------------------------------------------------------------------
+ * Function: check_and_validate_cache_hit_rate()
+ *
+ * Purpose: Use the API functions to get and reset the cache hit rate.
+ * Verify that the value returned by the API call agrees with
+ * the cache internal data structures.
+ *
+ * If the number of cache accesses exceeds the value provided
+ * in the min_accesses parameter, and the hit rate is less than
+ * min_hit_rate, set pass to FALSE, and set failure_mssg to
+ * a string indicating that hit rate was unexpectedly low.
+ *
+ * Return hit rate in *hit_rate_ptr, and print the data to
+ * stdout if requested.
+ *
+ * If an error is detected, set pass to FALSE, and set
+ * failure_mssg to an appropriate value.
+ *
+ * Return: void
+ *
+ * Programmer: John Mainzer
+ * 4/18/04
+ *
+ *-------------------------------------------------------------------------
+ */
+
+void
+check_and_validate_cache_hit_rate(hid_t file_id,
+ double * hit_rate_ptr,
+ hbool_t dump_data,
+ int64_t min_accesses,
+ double min_hit_rate)
+{
+ /* const char * fcn_name = "check_and_validate_cache_hit_rate()"; */
+ herr_t result;
+ int64_t cache_hits = 0;
+ int64_t cache_accesses = 0;
+ double expected_hit_rate;
+ double hit_rate;
+ H5F_t * file_ptr = NULL;
+ H5C_t * cache_ptr = NULL;
+
+ /* get a pointer to the files internal data structure */
+ if ( pass ) {
+
+ file_ptr = (H5F_t *)H5I_object_verify(file_id, H5I_FILE);
+
+ if ( file_ptr == NULL ) {
+
+ pass = FALSE;
+ failure_mssg = "Can't get file_ptr.";
+
+ } else {
+
+ cache_ptr = file_ptr->shared->cache;
+ }
+ }
+
+ /* verify that we can access the cache data structure */
+ if ( pass ) {
+
+ if ( ( cache_ptr == NULL ) ||
+ ( cache_ptr->magic != H5C__H5C_T_MAGIC ) ) {
+
+ pass = FALSE;
+ failure_mssg = "Can't access cache resize_ctl.";
+ }
+ }
+
+ /* compare the cache's internal configuration with the expected value */
+ if ( pass ) {
+
+ cache_hits = cache_ptr->cache_hits;
+ cache_accesses = cache_ptr->cache_accesses;
+
+ if ( cache_accesses > 0 ) {
+
+ expected_hit_rate = ((double)cache_hits) / ((double)cache_accesses);
+
+ } else {
+
+ expected_hit_rate = 0.0;
+ }
+
+ result = H5Fget_mdc_hit_rate(file_id, &hit_rate);
+
+ if ( result < 0 ) {
+
+ pass = FALSE;
+ failure_mssg = "H5Fget_mdc_hit_rate() failed.";
+
+ } else if ( ! DBL_REL_EQUAL(hit_rate, expected_hit_rate, 0.00001) ) {
+
+ pass = FALSE;
+ failure_mssg = "unexpected hit rate.";
+
+ }
+ }
+
+ if ( pass ) { /* reset the hit rate */
+
+ result = H5Freset_mdc_hit_rate_stats(file_id);
+
+ if ( result < 0 ) {
+
+ pass = FALSE;
+ failure_mssg = "H5Freset_mdc_hit_rate_stats() failed.";
+ }
+ }
+
+ /* set *hit_rate_ptr if appropriate */
+ if ( ( pass ) && ( hit_rate_ptr != NULL ) ) {
+
+ *hit_rate_ptr = hit_rate;
+ }
+
+ /* dump data to stdout if requested */
+ if ( ( pass ) && ( dump_data ) ) {
+
+ HDfprintf(stdout,
+ "cache_hits: %ld, cache_accesses: %ld, hit_rate: %lf\n",
+ (long)cache_hits, (long)cache_accesses, hit_rate);
+ }
+
+ if ( ( pass ) &&
+ ( cache_accesses > min_accesses ) &&
+ ( hit_rate < min_hit_rate ) ) {
+
+ pass = FALSE;
+ failure_mssg = "Unexpectedly low hit rate.";
+ }
+
+ return;
+
+} /* check_and_validate_cache_hit_rate() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: check_and_validate_cache_size()
+ *
+ * Purpose: Use the API function to get the cache size data. Verify
+ * that the values returned by the API call agree with
+ * the cache internal data structures.
+ *
+ * Return size data in the locations specified by the pointer
+ * parameters if these parameters are not NULL. Print the
+ * data to stdout if requested.
+ *
+ * If an error is detected, set pass to FALSE, and set
+ * failure_mssg to an appropriate value.
+ *
+ * Return: void
+ *
+ * Programmer: John Mainzer
+ * 4/18/04
+ *
+ *-------------------------------------------------------------------------
+ */
+
+void
+check_and_validate_cache_size(hid_t file_id,
+ size_t * max_size_ptr,
+ size_t * min_clean_size_ptr,
+ size_t * cur_size_ptr,
+ int32_t * cur_num_entries_ptr,
+ hbool_t dump_data)
+{
+ /* const char * fcn_name = "check_and_validate_cache_size()"; */
+ herr_t result;
+ size_t expected_max_size;
+ size_t max_size;
+ size_t expected_min_clean_size;
+ size_t min_clean_size;
+ size_t expected_cur_size;
+ size_t cur_size;
+ int32_t expected_cur_num_entries;
+ int cur_num_entries;
+ H5F_t * file_ptr = NULL;
+ H5C_t * cache_ptr = NULL;
+
+ /* get a pointer to the files internal data structure */
+ if ( pass ) {
+
+ file_ptr = (H5F_t *)H5I_object_verify(file_id, H5I_FILE);
+
+ if ( file_ptr == NULL ) {
+
+ pass = FALSE;
+ failure_mssg = "Can't get file_ptr.";
+
+ } else {
+
+ cache_ptr = file_ptr->shared->cache;
+ }
+ }
+
+ /* verify that we can access the cache data structure */
+ if ( pass ) {
+
+ if ( ( cache_ptr == NULL ) ||
+ ( cache_ptr->magic != H5C__H5C_T_MAGIC ) ) {
+
+ pass = FALSE;
+ failure_mssg = "Can't access cache data structure.";
+ }
+ }
+
+ /* compare the cache's internal configuration with the expected value */
+ if ( pass ) {
+
+ expected_max_size = cache_ptr->max_cache_size;
+ expected_min_clean_size = cache_ptr->min_clean_size;
+ expected_cur_size = cache_ptr->index_size;
+ expected_cur_num_entries = cache_ptr->index_len;
+
+ result = H5Fget_mdc_size(file_id,
+ &max_size,
+ &min_clean_size,
+ &cur_size,
+ &cur_num_entries);
+
+ if ( result < 0 ) {
+
+ pass = FALSE;
+ failure_mssg = "H5Fget_mdc_size() failed.";
+
+ } else if ( ( max_size != expected_max_size ) ||
+ ( min_clean_size != expected_min_clean_size ) ||
+ ( cur_size != expected_cur_size ) ||
+ ( cur_num_entries != (int)expected_cur_num_entries ) ) {
+
+ pass = FALSE;
+ failure_mssg = "H5Fget_mdc_size() returned unexpected value(s).";
+
+ }
+ }
+
+ /* return size values if requested */
+ if ( ( pass ) && ( max_size_ptr != NULL ) ) {
+
+ *max_size_ptr = max_size;
+ }
+
+ if ( ( pass ) && ( min_clean_size_ptr != NULL ) ) {
+
+ *min_clean_size_ptr = min_clean_size;
+ }
+
+ if ( ( pass ) && ( cur_size_ptr != NULL ) ) {
+
+ *cur_size_ptr = cur_size;
+ }
+
+ if ( ( pass ) && ( cur_num_entries_ptr != NULL ) ) {
+
+ *cur_num_entries_ptr = cur_num_entries;
+ }
+
+
+ /* dump data to stdout if requested */
+ if ( ( pass ) && ( dump_data ) ) {
+
+ HDfprintf(stdout,
+ "max_sz: %ld, min_clean_sz: %ld, cur_sz: %ld, cur_ent: %ld\n",
+ (long)max_size, (long)min_clean_size, (long)cur_size,
+ (long)cur_num_entries);
+ }
+
+ return;
+
+} /* check_and_validate_cache_size() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: validate_mdc_config()
+ *
+ * Purpose: Verify that the file indicated by the file_id parameter
+ * has both internal and external configuration matching
+ * *config_ptr.
+ *
+ * Do nothin on success. On failure, set pass to FALSE, and
+ * load an error message into failue_mssg. Note that
+ * failure_msg is assumed to be at least 128 bytes in length.
+ *
+ * Return: void
+ *
+ * Programmer: John Mainzer
+ * 4/14/04
+ *
+ *-------------------------------------------------------------------------
+ */
+
+void
+validate_mdc_config(hid_t file_id,
+ H5AC_cache_config_t * ext_config_ptr,
+ hbool_t compare_init,
+ int test_num)
+{
+ /* const char * fcn_name = "validate_mdc_config()"; */
+ static char msg[256];
+ H5F_t * file_ptr = NULL;
+ H5C_t * cache_ptr = NULL;
+ H5AC_cache_config_t scratch;
+ H5C_auto_size_ctl_t int_config;
+
+ XLATE_EXT_TO_INT_MDC_CONFIG(int_config, (*ext_config_ptr))
+
+ /* get a pointer to the files internal data structure */
+ if ( pass ) {
+
+ file_ptr = (H5F_t *)H5I_object_verify(file_id, H5I_FILE);
+
+ if ( file_ptr == NULL ) {
+
+ pass = FALSE;
+ HDsnprintf(msg, (size_t)128, "Can't get file_ptr #%d.", test_num);
+ failure_mssg = msg;
+
+ } else {
+
+ cache_ptr = file_ptr->shared->cache;
+ }
+ }
+
+ /* verify that we can access the internal version of the cache config */
+ if ( pass ) {
+
+ if ( ( cache_ptr == NULL ) ||
+ ( cache_ptr->magic != H5C__H5C_T_MAGIC ) ||
+ ( cache_ptr->resize_ctl.version != H5C__CURR_AUTO_SIZE_CTL_VER ) ){
+
+ pass = FALSE;
+ HDsnprintf(msg, (size_t)128,
+ "Can't access cache resize_ctl #%d.", test_num);
+ failure_mssg = msg;
+ }
+ }
+
+ /* compare the cache's internal configuration with the expected value */
+ if ( pass ) {
+
+ if ( ! RESIZE_CONFIGS_ARE_EQUAL(int_config, cache_ptr->resize_ctl,
+ compare_init) ) {
+
+ pass = FALSE;
+ HDsnprintf(msg, (size_t)128,
+ "Unexpected internal config #%d.", test_num);
+ failure_mssg = msg;
+ }
+ }
+
+ /* obtain external cache config */
+ if ( pass ) {
+
+ scratch.version = H5AC__CURR_CACHE_CONFIG_VERSION;
+
+ if ( H5Fget_mdc_config(file_id, &scratch) < 0 ) {
+
+ pass = FALSE;
+ HDsnprintf(msg, (size_t)128,
+ "H5Fget_mdc_config() failed #%d.", test_num);
+ failure_mssg = msg;
+ }
+ }
+
+ if ( pass ) {
+
+ /* Recall that in any configuration supplied by the cache
+ * at run time, the set_initial_size field will always
+ * be FALSE, regardless of the value passed in. Thus we
+ * always presume that this field need not match that of
+ * the supplied external configuration.
+ *
+ * The cache also sets the initial_size field to the current
+ * cache max size instead of the value initialy supplied.
+ * Depending on circumstances, this may or may not match
+ * the original. Hence the compare_init parameter.
+ */
+ if ( ! CACHE_CONFIGS_EQUAL((*ext_config_ptr), scratch, \
+ FALSE, compare_init) ) {
+
+ pass = FALSE;
+ HDsnprintf(msg, (size_t)128,
+ "Unexpected external config #%d.", test_num);
+ failure_mssg = msg;
+ }
+ }
+
+ return;
+
+} /* validate_mdc_config() */
+
diff --git a/test/cache_common.h b/test/cache_common.h
index d828304..91fdd6c 100644
--- a/test/cache_common.h
+++ b/test/cache_common.h
@@ -329,8 +329,8 @@ typedef struct test_entry_t
unsigned notify_before_evict_count; /* Count of times that entry was removed in cache */
} test_entry_t;
-/* The following is a cut down copy of the hash table manipulation
- * macros from H5C.c, which have been further modified to avoid references
+/* The following are cut down test versions of the hash table manipulation
+ * macros from H5Cpkg.h, which have been further modified to avoid references
* to the error reporting macros. Needless to say, these macros must be
* updated as necessary.
*/
@@ -339,14 +339,14 @@ typedef struct test_entry_t
#define H5C__HASH_FCN(x) (int)(((x) & H5C__HASH_MASK) >> 3)
#define H5C_TEST__PRE_HT_SEARCH_SC(cache_ptr, Addr) \
-if ( ( (cache_ptr) == NULL ) || \
- ( (cache_ptr)->magic != H5C__H5C_T_MAGIC ) || \
- ( (cache_ptr)->index_size != \
+if ( ( (cache_ptr) == NULL ) || \
+ ( (cache_ptr)->magic != H5C__H5C_T_MAGIC ) || \
+ ( (cache_ptr)->index_size != \
((cache_ptr)->clean_index_size + (cache_ptr)->dirty_index_size) ) || \
- ( ! H5F_addr_defined(Addr) ) || \
- ( H5C__HASH_FCN(Addr) < 0 ) || \
- ( H5C__HASH_FCN(Addr) >= H5C__HASH_TABLE_LEN ) ) { \
- HDfprintf(stdout, "Pre HT search SC failed.\n"); \
+ ( ! H5F_addr_defined(Addr) ) || \
+ ( H5C__HASH_FCN(Addr) < 0 ) || \
+ ( H5C__HASH_FCN(Addr) >= H5C__HASH_TABLE_LEN ) ) { \
+ HDfprintf(stdout, "Pre HT search SC failed.\n"); \
}
#define H5C_TEST__POST_SUC_HT_SEARCH_SC(cache_ptr, entry_ptr, Addr, k) \
@@ -371,18 +371,18 @@ if ( ( (cache_ptr) == NULL ) || \
HDfprintf(stdout, "Post successful HT search SC failed.\n"); \
}
-#define H5C_TEST__POST_HT_SHIFT_TO_FRONT(cache_ptr, entry_ptr, k) \
+#define H5C_TEST__POST_HT_SHIFT_TO_FRONT(cache_ptr, entry_ptr, k) \
if ( ( (cache_ptr) == NULL ) || \
( ((cache_ptr)->index)[k] != (entry_ptr) ) || \
( (entry_ptr)->ht_prev != NULL ) ) { \
HDfprintf(stdout, "Post HT shift to front failed.\n"); \
}
-#define H5C_TEST__SEARCH_INDEX(cache_ptr, Addr, entry_ptr) \
+#define H5C_TEST__SEARCH_INDEX(cache_ptr, Addr, entry_ptr) \
{ \
int k; \
int depth = 0; \
- H5C_TEST__PRE_HT_SEARCH_SC(cache_ptr, Addr) \
+ H5C_TEST__PRE_HT_SEARCH_SC(cache_ptr, Addr) \
k = H5C__HASH_FCN(Addr); \
entry_ptr = ((cache_ptr)->index)[k]; \
while ( ( entry_ptr ) && ( H5F_addr_ne(Addr, (entry_ptr)->addr) ) ) \
@@ -392,7 +392,7 @@ if ( ( (cache_ptr) == NULL ) || \
} \
if ( entry_ptr ) \
{ \
- H5C_TEST__POST_SUC_HT_SEARCH_SC(cache_ptr, entry_ptr, Addr, k) \
+ H5C_TEST__POST_SUC_HT_SEARCH_SC(cache_ptr, entry_ptr, Addr, k) \
if ( entry_ptr != ((cache_ptr)->index)[k] ) \
{ \
if ( (entry_ptr)->ht_next ) \
@@ -405,11 +405,109 @@ if ( ( (cache_ptr) == NULL ) || \
(entry_ptr)->ht_next = ((cache_ptr)->index)[k]; \
(entry_ptr)->ht_prev = NULL; \
((cache_ptr)->index)[k] = (entry_ptr); \
- H5C_TEST__POST_HT_SHIFT_TO_FRONT(cache_ptr, entry_ptr, k) \
+ H5C_TEST__POST_HT_SHIFT_TO_FRONT(cache_ptr, entry_ptr, k) \
} \
} \
}
+/* Macros used in H5AC level tests */
+
+#define CACHE_CONFIGS_EQUAL(a, b, cmp_set_init, cmp_init_size) \
+ ( ( (a).version == (b).version ) && \
+ ( (a).rpt_fcn_enabled == (b).rpt_fcn_enabled ) && \
+ ( (a).open_trace_file == (b).open_trace_file ) && \
+ ( (a).close_trace_file == (b).close_trace_file ) && \
+ ( ( (a).open_trace_file == FALSE ) || \
+ ( strcmp((a).trace_file_name, (b).trace_file_name) == 0 ) ) && \
+ ( (a).evictions_enabled == (b).evictions_enabled ) && \
+ ( ( ! cmp_set_init ) || \
+ ( (a).set_initial_size == (b).set_initial_size ) ) && \
+ ( ( ! cmp_init_size ) || \
+ ( (a).initial_size == (b).initial_size ) ) && \
+ ( (a).min_clean_fraction == (b).min_clean_fraction ) && \
+ ( (a).max_size == (b).max_size ) && \
+ ( (a).min_size == (b).min_size ) && \
+ ( (a).epoch_length == (b).epoch_length ) && \
+ ( (a).incr_mode == (b).incr_mode ) && \
+ ( (a).lower_hr_threshold == (b).lower_hr_threshold ) && \
+ ( (a).increment == (b).increment ) && \
+ ( (a).apply_max_increment == (b).apply_max_increment ) && \
+ ( (a).max_increment == (b).max_increment ) && \
+ ( (a).flash_incr_mode == (b).flash_incr_mode ) && \
+ ( (a).flash_multiple == (b).flash_multiple ) && \
+ ( (a).flash_threshold == (b).flash_threshold ) && \
+ ( (a).decr_mode == (b).decr_mode ) && \
+ ( (a).upper_hr_threshold == (b).upper_hr_threshold ) && \
+ ( (a).decrement == (b).decrement ) && \
+ ( (a).apply_max_decrement == (b).apply_max_decrement ) && \
+ ( (a).max_decrement == (b).max_decrement ) && \
+ ( (a).epochs_before_eviction == (b).epochs_before_eviction ) && \
+ ( (a).apply_empty_reserve == (b).apply_empty_reserve ) && \
+ ( (a).empty_reserve == (b).empty_reserve ) )
+
+#define RESIZE_CONFIGS_ARE_EQUAL(a, b, compare_init) \
+( ( (a).version == (b).version ) && \
+ ( (a).rpt_fcn == (b).rpt_fcn ) && \
+ ( ( ! compare_init ) || \
+ ( (a).set_initial_size == (b).set_initial_size ) ) && \
+ ( ( ! compare_init ) || \
+ ( (a).initial_size == (b).initial_size ) ) && \
+ ( DBL_REL_EQUAL((a).min_clean_fraction, (b).min_clean_fraction, 0.00001 ) ) && \
+ ( (a).max_size == (b).max_size ) && \
+ ( (a).min_size == (b).min_size ) && \
+ ( (a).epoch_length == (b).epoch_length ) && \
+ ( (a).incr_mode == (b).incr_mode ) && \
+ ( DBL_REL_EQUAL((a).lower_hr_threshold, (b).lower_hr_threshold, 0.00001 ) ) && \
+ ( DBL_REL_EQUAL((a).increment, (b).increment, 0.00001 ) ) && \
+ ( (a).apply_max_increment == (b).apply_max_increment ) && \
+ ( (a).max_increment == (b).max_increment ) && \
+ ( (a).flash_incr_mode == (b).flash_incr_mode ) && \
+ ( DBL_REL_EQUAL((a).flash_multiple, (b).flash_multiple, 0.00001 ) ) && \
+ ( DBL_REL_EQUAL((a).flash_threshold, (b).flash_threshold, 0.00001 ) ) && \
+ ( (a).decr_mode == (b).decr_mode ) && \
+ ( DBL_REL_EQUAL((a).upper_hr_threshold, (b).upper_hr_threshold, 0.00001 ) ) && \
+ ( DBL_REL_EQUAL((a).decrement, (b).decrement, 0.00001 ) ) && \
+ ( (a).apply_max_decrement == (b).apply_max_decrement ) && \
+ ( (a).max_decrement == (b).max_decrement ) && \
+ ( (a).epochs_before_eviction == (b).epochs_before_eviction ) && \
+ ( (a).apply_empty_reserve == (b).apply_empty_reserve ) && \
+ ( DBL_REL_EQUAL((a).empty_reserve, (b).empty_reserve, 0.00001 ) ) )
+
+
+#define XLATE_EXT_TO_INT_MDC_CONFIG(i, e) \
+{ \
+ (i).version = H5C__CURR_AUTO_SIZE_CTL_VER; \
+ if ( (e).rpt_fcn_enabled ) \
+ (i).rpt_fcn = H5C_def_auto_resize_rpt_fcn; \
+ else \
+ (i).rpt_fcn = NULL; \
+ (i).set_initial_size = (e).set_initial_size; \
+ (i).initial_size = (e).initial_size; \
+ (i).min_clean_fraction = (e).min_clean_fraction; \
+ (i).max_size = (e).max_size; \
+ (i).min_size = (e).min_size; \
+ (i).epoch_length = (long int)((e).epoch_length); \
+ (i).incr_mode = (e).incr_mode; \
+ (i).lower_hr_threshold = (e).lower_hr_threshold; \
+ (i).increment = (e).increment; \
+ (i).apply_max_increment = (e).apply_max_increment; \
+ (i).max_increment = (e).max_increment; \
+ (i).flash_incr_mode = (e).flash_incr_mode; \
+ (i).flash_multiple = (e).flash_multiple; \
+ (i).flash_threshold = (e).flash_threshold; \
+ (i).decr_mode = (e).decr_mode; \
+ (i).upper_hr_threshold = (e).upper_hr_threshold; \
+ (i).flash_incr_mode = (e).flash_incr_mode; \
+ (i).flash_multiple = (e).flash_multiple; \
+ (i).flash_threshold = (e).flash_threshold; \
+ (i).decrement = (e).decrement; \
+ (i).apply_max_decrement = (e).apply_max_decrement; \
+ (i).max_decrement = (e).max_decrement; \
+ (i).epochs_before_eviction = (int)((e).epochs_before_eviction); \
+ (i).apply_empty_reserve = (e).apply_empty_reserve; \
+ (i).empty_reserve = (e).empty_reserve; \
+}
+
/* misc type definitions */
@@ -506,7 +604,7 @@ void insert_entry(H5F_t * file_ptr,
unsigned int flags);
void mark_entry_dirty(int32_t type,
- int32_t idx);
+ int32_t idx);
void move_entry(H5C_t * cache_ptr,
int32_t type,
@@ -660,5 +758,25 @@ void destroy_flush_dependency(int32_t parent_type,
int32_t child_type,
int32_t child_idx);
+/*** H5AC level utility functions ***/
+
+void check_and_validate_cache_hit_rate(hid_t file_id,
+ double * hit_rate_ptr,
+ hbool_t dump_data,
+ int64_t min_accesses,
+ double min_hit_rate);
+
+void check_and_validate_cache_size(hid_t file_id,
+ size_t * max_size_ptr,
+ size_t * min_clean_size_ptr,
+ size_t * cur_size_ptr,
+ int32_t * cur_num_entries_ptr,
+ hbool_t dump_data);
+
+void validate_mdc_config(hid_t file_id,
+ H5AC_cache_config_t * ext_config_ptr,
+ hbool_t compare_init,
+ int test_num);
+
#endif /* _CACHE_COMMON_H */
diff --git a/testpar/t_cache.c b/testpar/t_cache.c
index b80730b..2590295 100644
--- a/testpar/t_cache.c
+++ b/testpar/t_cache.c
@@ -342,40 +342,33 @@ const H5C_class_t types[NUMBER_OF_ENTRY_TYPES] =
/* test utility functions */
-void expunge_entry(H5C_t * cache_ptr, H5F_t * file_ptr, int32_t idx);
+void expunge_entry(H5F_t * file_ptr, int32_t idx);
void insert_entry(H5C_t * cache_ptr, H5F_t * file_ptr,
int32_t idx, unsigned int flags);
-void local_pin_and_unpin_random_entries(H5C_t * cache_ptr, H5F_t * file_ptr,
- int min_idx, int max_idx,
- int min_count, int max_count);
-void local_pin_random_entry(H5C_t * cache_ptr, H5F_t * file_ptr,
- int min_idx, int max_idx);
-void local_unpin_all_entries(H5C_t * cache_ptr, H5F_t * file_ptr,
- hbool_t via_unprotect);
-int local_unpin_next_pinned_entry(H5C_t * cache_ptr, H5F_t * file_ptr,
- int start_idx, hbool_t via_unprotect);
-void lock_and_unlock_random_entries(H5C_t * cache_ptr, H5F_t * file_ptr,
- int min_idx, int max_idx,
+void local_pin_and_unpin_random_entries(H5F_t * file_ptr, int min_idx,
+ int max_idx, int min_count,
+ int max_count);
+void local_pin_random_entry(H5F_t * file_ptr, int min_idx, int max_idx);
+void local_unpin_all_entries(H5F_t * file_ptr, hbool_t via_unprotect);
+int local_unpin_next_pinned_entry(H5F_t * file_ptr, int start_idx,
+ hbool_t via_unprotect);
+void lock_and_unlock_random_entries(H5F_t * file_ptr, int min_idx, int max_idx,
int min_count, int max_count);
-void lock_and_unlock_random_entry(H5C_t * cache_ptr, H5F_t * file_ptr,
+void lock_and_unlock_random_entry(H5F_t * file_ptr,
int min_idx, int max_idx);
-void lock_entry(H5C_t * cache_ptr, H5F_t * file_ptr, int32_t idx);
-void mark_entry_dirty(H5C_t * cache_ptr, H5F_t * file_ptr,
- int32_t idx);
-void pin_entry(H5C_t * cache_ptr, H5F_t * file_ptr, int32_t idx,
- hbool_t global, hbool_t dirty);
+void lock_entry(H5F_t * file_ptr, int32_t idx);
+void mark_entry_dirty(int32_t idx);
+void pin_entry(H5F_t * file_ptr, int32_t idx, hbool_t global, hbool_t dirty);
void pin_protected_entry(int32_t idx, hbool_t global);
-void move_entry(H5C_t * cache_ptr, H5F_t * file_ptr,
- int32_t old_idx, int32_t new_idx);
+void move_entry(H5F_t * file_ptr, int32_t old_idx, int32_t new_idx);
void resize_entry(int32_t idx, size_t new_size);
hbool_t setup_cache_for_test(hid_t * fid_ptr, H5F_t ** file_ptr_ptr,
H5C_t ** cache_ptr_ptr);
void setup_rand(void);
hbool_t take_down_cache(hid_t fid);
-void unlock_entry(H5C_t * cache_ptr, H5F_t * file_ptr,
- int32_t type, unsigned int flags);
-void unpin_entry(H5C_t * cache_ptr, H5F_t * file_ptr, int32_t idx,
- hbool_t global, hbool_t dirty, hbool_t via_unprotect);
+void unlock_entry(H5F_t * file_ptr, int32_t type, unsigned int flags);
+void unpin_entry(H5F_t * file_ptr, int32_t idx, hbool_t global,
+ hbool_t dirty, hbool_t via_unprotect);
/* test functions */
@@ -1657,6 +1650,7 @@ serve_write_request(struct mssg_t * mssg_ptr)
/**************************** Call back functions ****************************/
/*****************************************************************************/
+
/*-------------------------------------------------------------------------
* Function: clear_datum
*
@@ -2184,8 +2178,7 @@ size_datum(H5F_t UNUSED * f,
*****************************************************************************/
void
-expunge_entry(H5C_t * cache_ptr,
- H5F_t * file_ptr,
+expunge_entry(H5F_t * file_ptr,
int32_t idx)
{
const char * fcn_name = "expunge_entry()";
@@ -2193,7 +2186,6 @@ expunge_entry(H5C_t * cache_ptr,
herr_t result;
struct datum * entry_ptr;
- HDassert( cache_ptr );
HDassert( file_ptr );
HDassert( ( 0 <= idx ) && ( idx < NUM_DATA_ENTRIES ) );
HDassert( idx < virt_num_data_entries );
@@ -2295,8 +2287,8 @@ insert_entry(H5C_t * cache_ptr,
(entry_ptr->ver)++;
entry_ptr->dirty = TRUE;
- result = H5AC_set(file_ptr, -1, &(types[0]), entry_ptr->base_addr,
- (void *)(&(entry_ptr->header)), flags);
+ result = H5AC_set(file_ptr, H5P_DATASET_XFER_DEFAULT, &(types[0]),
+ entry_ptr->base_addr, (void *)(&(entry_ptr->header)), flags);
if ( ( result < 0 ) ||
( entry_ptr->header.type != &(types[0]) ) ||
@@ -2375,8 +2367,7 @@ insert_entry(H5C_t * cache_ptr,
*****************************************************************************/
void
-local_pin_and_unpin_random_entries(H5C_t * cache_ptr,
- H5F_t * file_ptr,
+local_pin_and_unpin_random_entries(H5F_t * file_ptr,
int min_idx,
int max_idx,
int min_count,
@@ -2391,7 +2382,6 @@ local_pin_and_unpin_random_entries(H5C_t * cache_ptr,
int i;
int idx;
- HDassert( cache_ptr );
HDassert( file_ptr );
HDassert( 0 <= min_idx );
HDassert( min_idx < max_idx );
@@ -2407,7 +2397,7 @@ local_pin_and_unpin_random_entries(H5C_t * cache_ptr,
for ( i = 0; i < count; i++ )
{
- local_pin_random_entry(cache_ptr, file_ptr, min_idx, max_idx);
+ local_pin_random_entry(file_ptr, min_idx, max_idx);
}
count = (HDrand() % (max_count - min_count)) + min_count;
@@ -2421,8 +2411,7 @@ local_pin_and_unpin_random_entries(H5C_t * cache_ptr,
while ( ( i < count ) && ( idx >= 0 ) )
{
via_unprotect = ( (((unsigned)i) & 0x0001) == 0 );
- idx = local_unpin_next_pinned_entry(cache_ptr, file_ptr,
- idx, via_unprotect);
+ idx = local_unpin_next_pinned_entry(file_ptr, idx, via_unprotect);
i++;
}
}
@@ -2452,8 +2441,7 @@ local_pin_and_unpin_random_entries(H5C_t * cache_ptr,
*****************************************************************************/
void
-local_pin_random_entry(H5C_t * cache_ptr,
- H5F_t * file_ptr,
+local_pin_random_entry(H5F_t * file_ptr,
int min_idx,
int max_idx)
{
@@ -2462,7 +2450,6 @@ local_pin_random_entry(H5C_t * cache_ptr,
if ( nerrors == 0 ) {
- HDassert( cache_ptr );
HDassert( file_ptr );
HDassert( 0 <= min_idx );
HDassert( min_idx < max_idx );
@@ -2477,7 +2464,7 @@ local_pin_random_entry(H5C_t * cache_ptr,
}
while ( data[idx].global_pinned || data[idx].local_pinned );
- pin_entry(cache_ptr, file_ptr, idx, FALSE, FALSE);
+ pin_entry(file_ptr, idx, FALSE, FALSE);
}
return;
@@ -2502,8 +2489,7 @@ local_pin_random_entry(H5C_t * cache_ptr,
*****************************************************************************/
void
-local_unpin_all_entries(H5C_t * cache_ptr,
- H5F_t * file_ptr,
+local_unpin_all_entries(H5F_t * file_ptr,
hbool_t via_unprotect)
{
/* const char * fcn_name = "local_unpin_all_entries()"; */
@@ -2512,14 +2498,13 @@ local_unpin_all_entries(H5C_t * cache_ptr,
int idx;
- HDassert( cache_ptr );
HDassert( file_ptr );
idx = 0;
while ( idx >= 0 )
{
- idx = local_unpin_next_pinned_entry(cache_ptr, file_ptr,
+ idx = local_unpin_next_pinned_entry(file_ptr,
idx, via_unprotect);
}
}
@@ -2549,8 +2534,7 @@ local_unpin_all_entries(H5C_t * cache_ptr,
*****************************************************************************/
int
-local_unpin_next_pinned_entry(H5C_t * cache_ptr,
- H5F_t * file_ptr,
+local_unpin_next_pinned_entry(H5F_t * file_ptr,
int start_idx,
hbool_t via_unprotect)
{
@@ -2560,7 +2544,6 @@ local_unpin_next_pinned_entry(H5C_t * cache_ptr,
if ( nerrors == 0 ) {
- HDassert( cache_ptr );
HDassert( file_ptr );
HDassert( 0 <= start_idx );
HDassert( start_idx < NUM_DATA_ENTRIES );
@@ -2580,7 +2563,7 @@ local_unpin_next_pinned_entry(H5C_t * cache_ptr,
if ( data[idx].local_pinned ) {
- unpin_entry(cache_ptr, file_ptr, idx, FALSE, FALSE, via_unprotect);
+ unpin_entry(file_ptr, idx, FALSE, FALSE, via_unprotect);
} else {
@@ -2612,8 +2595,7 @@ local_unpin_next_pinned_entry(H5C_t * cache_ptr,
*****************************************************************************/
void
-lock_and_unlock_random_entries(H5C_t * cache_ptr,
- H5F_t * file_ptr,
+lock_and_unlock_random_entries(H5F_t * file_ptr,
int min_idx,
int max_idx,
int min_count,
@@ -2625,7 +2607,6 @@ lock_and_unlock_random_entries(H5C_t * cache_ptr,
if ( nerrors == 0 ) {
- HDassert( cache_ptr );
HDassert( file_ptr );
HDassert( 0 <= min_count );
HDassert( min_count < max_count );
@@ -2637,7 +2618,7 @@ lock_and_unlock_random_entries(H5C_t * cache_ptr,
for ( i = 0; i < count; i++ )
{
- lock_and_unlock_random_entry(cache_ptr, file_ptr, min_idx, max_idx);
+ lock_and_unlock_random_entry(file_ptr, min_idx, max_idx);
}
}
@@ -2664,8 +2645,7 @@ lock_and_unlock_random_entries(H5C_t * cache_ptr,
*****************************************************************************/
void
-lock_and_unlock_random_entry(H5C_t * cache_ptr,
- H5F_t * file_ptr,
+lock_and_unlock_random_entry(H5F_t * file_ptr,
int min_idx,
int max_idx)
{
@@ -2674,7 +2654,6 @@ lock_and_unlock_random_entry(H5C_t * cache_ptr,
if ( nerrors == 0 ) {
- HDassert( cache_ptr );
HDassert( file_ptr );
HDassert( 0 <= min_idx );
HDassert( min_idx < max_idx );
@@ -2686,8 +2665,8 @@ lock_and_unlock_random_entry(H5C_t * cache_ptr,
HDassert( min_idx <= idx );
HDassert( idx <= max_idx );
- lock_entry(cache_ptr, file_ptr, idx);
- unlock_entry(cache_ptr, file_ptr, idx, H5AC__NO_FLAGS_SET);
+ lock_entry(file_ptr, idx);
+ unlock_entry(file_ptr, idx, H5AC__NO_FLAGS_SET);
}
return;
@@ -2716,8 +2695,7 @@ lock_and_unlock_random_entry(H5C_t * cache_ptr,
*****************************************************************************/
void
-lock_entry(H5C_t * cache_ptr,
- H5F_t * file_ptr,
+lock_entry(H5F_t * file_ptr,
int32_t idx)
{
const char * fcn_name = "lock_entry()";
@@ -2726,7 +2704,6 @@ lock_entry(H5C_t * cache_ptr,
if ( nerrors == 0 ) {
- HDassert( cache_ptr );
HDassert( ( 0 <= idx ) && ( idx < NUM_DATA_ENTRIES ) );
HDassert( idx < virt_num_data_entries );
@@ -2777,9 +2754,7 @@ lock_entry(H5C_t * cache_ptr,
*****************************************************************************/
void
-mark_entry_dirty(H5C_t * cache_ptr,
- H5F_t * file_ptr,
- int32_t idx)
+mark_entry_dirty(int32_t idx)
{
const char * fcn_name = "mark_entry_dirty()";
herr_t result;
@@ -2787,8 +2762,6 @@ mark_entry_dirty(H5C_t * cache_ptr,
if ( nerrors == 0 ) {
- HDassert( file_ptr );
- HDassert( cache_ptr );
HDassert( ( 0 <= idx ) && ( idx < NUM_DATA_ENTRIES ) );
HDassert( idx < virt_num_data_entries );
@@ -2839,8 +2812,7 @@ mark_entry_dirty(H5C_t * cache_ptr,
*****************************************************************************/
void
-pin_entry(H5C_t * cache_ptr,
- H5F_t * file_ptr,
+pin_entry(H5F_t * file_ptr,
int32_t idx,
hbool_t global,
hbool_t dirty)
@@ -2851,7 +2823,6 @@ pin_entry(H5C_t * cache_ptr,
if ( nerrors == 0 ) {
- HDassert( cache_ptr );
HDassert( file_ptr );
HDassert( ( 0 <= idx ) && ( idx < NUM_DATA_ENTRIES ) );
HDassert( idx < virt_num_data_entries );
@@ -2862,14 +2833,14 @@ pin_entry(H5C_t * cache_ptr,
HDassert ( ! (entry_ptr->local_pinned) );
HDassert ( ! ( dirty && ( ! global ) ) );
- lock_entry(cache_ptr, file_ptr, idx);
+ lock_entry(file_ptr, idx);
if ( dirty ) {
flags |= H5AC__DIRTIED_FLAG;
}
- unlock_entry(cache_ptr, file_ptr, idx, flags);
+ unlock_entry(file_ptr, idx, flags);
HDassert( (entry_ptr->header).is_pinned );
HDassert( ( ! dirty ) || ( (entry_ptr->header).is_dirty ) );
@@ -2992,10 +2963,9 @@ pin_protected_entry(int32_t idx,
*****************************************************************************/
void
-move_entry(H5C_t * cache_ptr,
- H5F_t * file_ptr,
- int32_t old_idx,
- int32_t new_idx)
+move_entry(H5F_t * file_ptr,
+ int32_t old_idx,
+ int32_t new_idx)
{
const char * fcn_name = "move_entry()";
herr_t result;
@@ -3008,7 +2978,6 @@ move_entry(H5C_t * cache_ptr,
if ( ( nerrors == 0 ) && ( old_idx != new_idx ) ) {
- HDassert( cache_ptr );
HDassert( file_ptr );
HDassert( ( 0 <= old_idx ) && ( old_idx < NUM_DATA_ENTRIES ) );
HDassert( old_idx < virt_num_data_entries );
@@ -3258,7 +3227,7 @@ setup_cache_for_test(hid_t * fid_ptr,
config.rpt_fcn_enabled = TRUE;
if ( H5AC_set_cache_auto_resize_config(cache_ptr, &config)
- != SUCCEED ) {
+ != SUCCEED ) {
HDfprintf(stdout,
"%d:%s: H5AC_set_cache_auto_resize_config() failed.\n",
@@ -3559,8 +3528,7 @@ take_down_cache(hid_t fid)
*****************************************************************************/
void
-unlock_entry(H5C_t * cache_ptr,
- H5F_t * file_ptr,
+unlock_entry(H5F_t * file_ptr,
int32_t idx,
unsigned int flags)
{
@@ -3571,7 +3539,6 @@ unlock_entry(H5C_t * cache_ptr,
if ( nerrors == 0 ) {
- HDassert( cache_ptr );
HDassert( file_ptr );
HDassert( ( 0 <= idx ) && ( idx < NUM_DATA_ENTRIES ) );
HDassert( idx < virt_num_data_entries );
@@ -3648,8 +3615,7 @@ unlock_entry(H5C_t * cache_ptr,
*****************************************************************************/
void
-unpin_entry(H5C_t * cache_ptr,
- H5F_t * file_ptr,
+unpin_entry(H5F_t * file_ptr,
int32_t idx,
hbool_t global,
hbool_t dirty,
@@ -3662,7 +3628,6 @@ unpin_entry(H5C_t * cache_ptr,
if ( nerrors == 0 ) {
- HDassert( cache_ptr );
HDassert( file_ptr );
HDassert( ( 0 <= idx ) && ( idx < NUM_DATA_ENTRIES ) );
HDassert( idx < virt_num_data_entries );
@@ -3677,20 +3642,20 @@ unpin_entry(H5C_t * cache_ptr,
if ( via_unprotect ) {
- lock_entry(cache_ptr, file_ptr, idx);
+ lock_entry(file_ptr, idx);
if ( dirty ) {
flags |= H5AC__DIRTIED_FLAG;
}
- unlock_entry(cache_ptr, file_ptr, idx, flags);
+ unlock_entry(file_ptr, idx, flags);
} else {
if ( dirty ) {
- mark_entry_dirty(cache_ptr, file_ptr, idx);
+ mark_entry_dirty(idx);
}
@@ -4022,26 +3987,24 @@ smoke_check_1(void)
for ( i = (virt_num_data_entries / 2) - 1; i >= 0; i-- )
{
- lock_entry(cache_ptr, file_ptr, i);
- unlock_entry(cache_ptr, file_ptr, i, H5AC__NO_FLAGS_SET);
+ lock_entry(file_ptr, i);
+ unlock_entry(file_ptr, i, H5AC__NO_FLAGS_SET);
}
- /* move the first half of the entries... */
+ /* Move the first half of the entries... */
for ( i = 0; i < (virt_num_data_entries / 2); i++ )
{
- lock_entry(cache_ptr, file_ptr, i);
- unlock_entry(cache_ptr, file_ptr, i, H5AC__NO_FLAGS_SET);
- move_entry(cache_ptr, file_ptr, i,
- (i + (virt_num_data_entries / 2)));
+ lock_entry(file_ptr, i);
+ unlock_entry(file_ptr, i, H5AC__NO_FLAGS_SET);
+ move_entry(file_ptr, i, (i + (virt_num_data_entries / 2)));
}
/* ...and then move them back. */
for ( i = (virt_num_data_entries / 2) - 1; i >= 0; i-- )
{
- lock_entry(cache_ptr, file_ptr, i);
- unlock_entry(cache_ptr, file_ptr, i, H5AC__NO_FLAGS_SET);
- move_entry(cache_ptr, file_ptr, i,
- (i + (virt_num_data_entries / 2)));
+ lock_entry(file_ptr, i);
+ unlock_entry(file_ptr, i, H5AC__NO_FLAGS_SET);
+ move_entry(file_ptr, i, (i + (virt_num_data_entries / 2)));
}
if ( fid >= 0 ) {
@@ -4190,8 +4153,7 @@ smoke_check_2(void)
if ( i > 100 ) {
- lock_and_unlock_random_entries(cache_ptr, file_ptr,
- (i - 100), i, 0, 10);
+ lock_and_unlock_random_entries(file_ptr, (i - 100), i, 0, 10);
}
}
@@ -4199,44 +4161,43 @@ smoke_check_2(void)
{
/* Make sure we don't step on any locally pinned entries */
if ( data[i].local_pinned ) {
- unpin_entry(cache_ptr, file_ptr, i, FALSE, FALSE, FALSE);
+ unpin_entry(file_ptr, i, FALSE, FALSE, FALSE);
}
- pin_entry(cache_ptr, file_ptr, i, TRUE, FALSE);
+ pin_entry(file_ptr, i, TRUE, FALSE);
}
for ( i = (virt_num_data_entries / 2) - 1; i >= 0; i-=2 )
{
- lock_entry(cache_ptr, file_ptr, i);
- unlock_entry(cache_ptr, file_ptr, i, H5AC__NO_FLAGS_SET);
- lock_and_unlock_random_entries(cache_ptr, file_ptr, 0,
+ lock_entry(file_ptr, i);
+ unlock_entry(file_ptr, i, H5AC__NO_FLAGS_SET);
+ lock_and_unlock_random_entries(file_ptr, 0,
(virt_num_data_entries / 20),
0, 100);
- local_pin_and_unpin_random_entries(cache_ptr, file_ptr, 0,
+ local_pin_and_unpin_random_entries(file_ptr, 0,
(virt_num_data_entries / 4),
0, 3);
}
for ( i = 0; i < (virt_num_data_entries / 2); i+=2 )
{
- lock_entry(cache_ptr, file_ptr, i);
- unlock_entry(cache_ptr, file_ptr, i, H5AC__DIRTIED_FLAG);
- lock_and_unlock_random_entries(cache_ptr, file_ptr, 0,
+ lock_entry(file_ptr, i);
+ unlock_entry(file_ptr, i, H5AC__DIRTIED_FLAG);
+ lock_and_unlock_random_entries(file_ptr, 0,
(virt_num_data_entries / 10),
0, 100);
}
/* we can't move pinned entries, so release any local pins now. */
- local_unpin_all_entries(cache_ptr, file_ptr, FALSE);
+ local_unpin_all_entries(file_ptr, FALSE);
/* Move the first half of the entries... */
for ( i = 0; i < (virt_num_data_entries / 2); i++ )
{
- lock_entry(cache_ptr, file_ptr, i);
- unlock_entry(cache_ptr, file_ptr, i, H5AC__NO_FLAGS_SET);
- move_entry(cache_ptr, file_ptr, i,
- (i + (virt_num_data_entries / 2)));
- lock_and_unlock_random_entries(cache_ptr, file_ptr, 0,
+ lock_entry(file_ptr, i);
+ unlock_entry(file_ptr, i, H5AC__NO_FLAGS_SET);
+ move_entry(file_ptr, i, (i + (virt_num_data_entries / 2)));
+ lock_and_unlock_random_entries(file_ptr, 0,
((virt_num_data_entries / 50) - 1),
0, 100);
}
@@ -4244,11 +4205,10 @@ smoke_check_2(void)
/* ...and then move them back. */
for ( i = (virt_num_data_entries / 2) - 1; i >= 0; i-- )
{
- lock_entry(cache_ptr, file_ptr, i);
- unlock_entry(cache_ptr, file_ptr, i, H5AC__DIRTIED_FLAG);
- move_entry(cache_ptr, file_ptr, i,
- (i + (virt_num_data_entries / 2)));
- lock_and_unlock_random_entries(cache_ptr, file_ptr, 0,
+ lock_entry(file_ptr, i);
+ unlock_entry(file_ptr, i, H5AC__DIRTIED_FLAG);
+ move_entry(file_ptr, i, (i + (virt_num_data_entries / 2)));
+ lock_and_unlock_random_entries(file_ptr, 0,
(virt_num_data_entries / 100),
0, 100);
}
@@ -4258,7 +4218,7 @@ smoke_check_2(void)
hbool_t via_unprotect = ( (((unsigned)i) & 0x01) == 0 );
hbool_t dirty = ( (((unsigned)i) & 0x02) == 0 );
- unpin_entry(cache_ptr, file_ptr, i, TRUE, dirty, via_unprotect);
+ unpin_entry(file_ptr, i, TRUE, dirty, via_unprotect);
}
if ( fid >= 0 ) {
@@ -4434,8 +4394,7 @@ smoke_check_3(void)
if ( i > 100 ) {
- lock_and_unlock_random_entries(cache_ptr, file_ptr,
- (i - 100), i,
+ lock_and_unlock_random_entries(file_ptr, (i - 100), i,
min_count, max_count);
}
}
@@ -4459,10 +4418,10 @@ smoke_check_3(void)
hbool_t dirty = ( (i % 2) == 0);
if ( data[i].local_pinned ) {
- unpin_entry(cache_ptr, file_ptr, i, FALSE, FALSE, FALSE);
+ unpin_entry(file_ptr, i, FALSE, FALSE, FALSE);
}
- pin_entry(cache_ptr, file_ptr, i, TRUE, dirty);
+ pin_entry(file_ptr, i, TRUE, dirty);
HDassert( !dirty || data[i].header.is_dirty );
HDassert( data[i].header.is_pinned );
@@ -4472,13 +4431,12 @@ smoke_check_3(void)
if ( i > 100 ) {
- lock_and_unlock_random_entries(cache_ptr, file_ptr,
- (i - 100), i,
+ lock_and_unlock_random_entries(file_ptr, (i - 100), i,
min_count, max_count);
}
- local_pin_and_unpin_random_entries(cache_ptr, file_ptr,
- 0, virt_num_data_entries / 4,
+ local_pin_and_unpin_random_entries(file_ptr, 0,
+ virt_num_data_entries / 4,
0, (file_mpi_rank + 2));
}
@@ -4520,17 +4478,17 @@ smoke_check_3(void)
HDassert( data[i].global_pinned );
HDassert( ! data[i].local_pinned );
- unpin_entry(cache_ptr, file_ptr, i, TRUE, dirty,
+ unpin_entry(file_ptr, i, TRUE, dirty,
via_unprotect);
}
if ( i % 2 == 0 ) {
- lock_entry(cache_ptr, file_ptr, i);
- unlock_entry(cache_ptr, file_ptr, i, H5AC__NO_FLAGS_SET);
- local_pin_and_unpin_random_entries(cache_ptr, file_ptr, 0,
+ lock_entry(file_ptr, i);
+ unlock_entry(file_ptr, i, H5AC__NO_FLAGS_SET);
+ local_pin_and_unpin_random_entries(file_ptr, 0,
virt_num_data_entries / 2,
0, 2);
- lock_and_unlock_random_entries(cache_ptr, file_ptr,
+ lock_and_unlock_random_entries(file_ptr,
min_idx, max_idx, 0, 100);
}
}
@@ -4548,9 +4506,9 @@ smoke_check_3(void)
for ( i = 0; i < (virt_num_data_entries / 2); i+=2 )
{
- lock_entry(cache_ptr, file_ptr, i);
- unlock_entry(cache_ptr, file_ptr, i, H5AC__DIRTIED_FLAG);
- lock_and_unlock_random_entries(cache_ptr, file_ptr,
+ lock_entry(file_ptr, i);
+ unlock_entry(file_ptr, i, H5AC__DIRTIED_FLAG);
+ lock_and_unlock_random_entries(file_ptr,
min_idx, max_idx, 0, 100);
}
@@ -4558,7 +4516,7 @@ smoke_check_3(void)
if ( verbose ) {HDfprintf(stderr, "%d: cp = %d\n", world_mpi_rank, cp++);}
/* we can't move pinned entries, so release any local pins now. */
- local_unpin_all_entries(cache_ptr, file_ptr, FALSE);
+ local_unpin_all_entries(file_ptr, FALSE);
min_count = 10 / (file_mpi_rank + 1);
max_count = min_count + 100;
@@ -4566,11 +4524,10 @@ smoke_check_3(void)
/* move the first half of the entries... */
for ( i = 0; i < (virt_num_data_entries / 2); i++ )
{
- lock_entry(cache_ptr, file_ptr, i);
- unlock_entry(cache_ptr, file_ptr, i, H5AC__NO_FLAGS_SET);
- move_entry(cache_ptr, file_ptr, i,
- (i + (virt_num_data_entries / 2)));
- lock_and_unlock_random_entries(cache_ptr, file_ptr, 0,
+ lock_entry(file_ptr, i);
+ unlock_entry(file_ptr, i, H5AC__NO_FLAGS_SET);
+ move_entry(file_ptr, i, (i + (virt_num_data_entries / 2)));
+ lock_and_unlock_random_entries(file_ptr, 0,
(virt_num_data_entries / 20),
min_count, max_count);
}
@@ -4581,11 +4538,10 @@ smoke_check_3(void)
/* ...and then move them back. */
for ( i = (virt_num_data_entries / 2) - 1; i >= 0; i-- )
{
- lock_entry(cache_ptr, file_ptr, i);
- unlock_entry(cache_ptr, file_ptr, i, H5AC__DIRTIED_FLAG);
- move_entry(cache_ptr, file_ptr, i,
- (i + (virt_num_data_entries / 2)));
- lock_and_unlock_random_entries(cache_ptr, file_ptr, 0,
+ lock_entry(file_ptr, i);
+ unlock_entry(file_ptr, i, H5AC__DIRTIED_FLAG);
+ move_entry(file_ptr, i, (i + (virt_num_data_entries / 2)));
+ lock_and_unlock_random_entries(file_ptr, 0,
(virt_num_data_entries / 40),
min_count, max_count);
}
@@ -4601,17 +4557,16 @@ smoke_check_3(void)
for ( i = 0; i < (virt_num_data_entries / 2); i+=2 )
{
- local_pin_and_unpin_random_entries(cache_ptr, file_ptr, 0,
+ local_pin_and_unpin_random_entries(file_ptr, 0,
(virt_num_data_entries / 2),
0, 5);
- lock_entry(cache_ptr, file_ptr, i);
- unlock_entry(cache_ptr, file_ptr, i, H5AC__DIRTIED_FLAG);
+ lock_entry(file_ptr, i);
+ unlock_entry(file_ptr, i, H5AC__DIRTIED_FLAG);
if ( i > 100 ) {
- lock_and_unlock_random_entries(cache_ptr, file_ptr,
- (i - 100), i,
+ lock_and_unlock_random_entries(file_ptr, (i - 100), i,
min_count, max_count);
}
}
@@ -4620,7 +4575,7 @@ smoke_check_3(void)
if ( verbose ) {HDfprintf(stderr, "%d: cp = %d\n", world_mpi_rank, cp++);}
/* release any local pins before we take down the cache. */
- local_unpin_all_entries(cache_ptr, file_ptr, FALSE);
+ local_unpin_all_entries(file_ptr, FALSE);
if ( fid >= 0 ) {
@@ -4788,8 +4743,7 @@ smoke_check_4(void)
if ( i > 100 ) {
- lock_and_unlock_random_entries(cache_ptr, file_ptr,
- (i - 100), i,
+ lock_and_unlock_random_entries(file_ptr, (i - 100), i,
min_count, max_count);
}
}
@@ -4813,7 +4767,7 @@ smoke_check_4(void)
* entries are in fact pinned (which unpin_entry() should do).
*/
insert_entry(cache_ptr, file_ptr, i, H5C__PIN_ENTRY_FLAG);
- unpin_entry(cache_ptr, file_ptr, i, TRUE, FALSE, FALSE);
+ unpin_entry(file_ptr, i, TRUE, FALSE, FALSE);
}
if ( i % 59 == 0 ) {
@@ -4821,10 +4775,10 @@ smoke_check_4(void)
hbool_t dirty = ( (i % 2) == 0);
if ( data[i].local_pinned ) {
- unpin_entry(cache_ptr, file_ptr, i, FALSE, FALSE, FALSE);
+ unpin_entry(file_ptr, i, FALSE, FALSE, FALSE);
}
- pin_entry(cache_ptr, file_ptr, i, TRUE, dirty);
+ pin_entry(file_ptr, i, TRUE, dirty);
HDassert( !dirty || data[i].header.is_dirty );
HDassert( data[i].header.is_pinned );
@@ -4834,12 +4788,11 @@ smoke_check_4(void)
if ( i > 100 ) {
- lock_and_unlock_random_entries(cache_ptr, file_ptr,
- (i - 100), i,
+ lock_and_unlock_random_entries(file_ptr, (i - 100), i,
min_count, max_count);
}
- local_pin_and_unpin_random_entries(cache_ptr, file_ptr, 0,
+ local_pin_and_unpin_random_entries(file_ptr, 0,
(virt_num_data_entries / 4),
0, (file_mpi_rank + 2));
}
@@ -4871,14 +4824,14 @@ smoke_check_4(void)
HDassert( data[i].global_pinned );
HDassert( ! data[i].local_pinned );
- unpin_entry(cache_ptr, file_ptr, i, TRUE, dirty, via_unprotect);
+ unpin_entry(file_ptr, i, TRUE, dirty, via_unprotect);
}
if ( i % 2 == 0 ) {
- lock_entry(cache_ptr, file_ptr, i);
- unlock_entry(cache_ptr, file_ptr, i, H5AC__NO_FLAGS_SET);
- lock_and_unlock_random_entries(cache_ptr, file_ptr,
+ lock_entry(file_ptr, i);
+ unlock_entry(file_ptr, i, H5AC__NO_FLAGS_SET);
+ lock_and_unlock_random_entries(file_ptr,
min_idx, max_idx, 0, 100);
}
}
@@ -4889,14 +4842,14 @@ smoke_check_4(void)
for ( i = 0; i < (virt_num_data_entries / 2); i+=2 )
{
- lock_entry(cache_ptr, file_ptr, i);
- unlock_entry(cache_ptr, file_ptr, i, H5AC__DIRTIED_FLAG);
- lock_and_unlock_random_entries(cache_ptr, file_ptr,
+ lock_entry(file_ptr, i);
+ unlock_entry(file_ptr, i, H5AC__DIRTIED_FLAG);
+ lock_and_unlock_random_entries(file_ptr,
min_idx, max_idx, 0, 100);
}
/* we can't move pinned entries, so release any local pins now. */
- local_unpin_all_entries(cache_ptr, file_ptr, FALSE);
+ local_unpin_all_entries(file_ptr, FALSE);
min_count = 10 * (file_mpi_rank % 4);
max_count = min_count + 100;
@@ -4904,11 +4857,10 @@ smoke_check_4(void)
/* move the first half of the entries... */
for ( i = 0; i < (virt_num_data_entries / 2); i++ )
{
- lock_entry(cache_ptr, file_ptr, i);
- unlock_entry(cache_ptr, file_ptr, i, H5AC__NO_FLAGS_SET);
- move_entry(cache_ptr, file_ptr, i,
- (i + (virt_num_data_entries / 2)));
- lock_and_unlock_random_entries(cache_ptr, file_ptr, 0,
+ lock_entry(file_ptr, i);
+ unlock_entry(file_ptr, i, H5AC__NO_FLAGS_SET);
+ move_entry(file_ptr, i, (i + (virt_num_data_entries / 2)));
+ lock_and_unlock_random_entries(file_ptr, 0,
(virt_num_data_entries / 20),
min_count, max_count);
}
@@ -4916,11 +4868,10 @@ smoke_check_4(void)
/* ...and then move them back. */
for ( i = (virt_num_data_entries / 2) - 1; i >= 0; i-- )
{
- lock_entry(cache_ptr, file_ptr, i);
- unlock_entry(cache_ptr, file_ptr, i, H5AC__DIRTIED_FLAG);
- move_entry(cache_ptr, file_ptr, i,
- (i + (virt_num_data_entries / 2)));
- lock_and_unlock_random_entries(cache_ptr, file_ptr, 0,
+ lock_entry(file_ptr, i);
+ unlock_entry(file_ptr, i, H5AC__DIRTIED_FLAG);
+ move_entry(file_ptr, i, (i + (virt_num_data_entries / 2)));
+ lock_and_unlock_random_entries(file_ptr, 0,
(virt_num_data_entries / 40),
min_count, max_count);
}
@@ -4933,13 +4884,12 @@ smoke_check_4(void)
for ( i = 0; i < (virt_num_data_entries / 2); i+=2 )
{
- lock_entry(cache_ptr, file_ptr, i);
- unlock_entry(cache_ptr, file_ptr, i, H5AC__DIRTIED_FLAG);
+ lock_entry(file_ptr, i);
+ unlock_entry(file_ptr, i, H5AC__DIRTIED_FLAG);
if ( i > 100 ) {
- lock_and_unlock_random_entries(cache_ptr, file_ptr,
- (i - 100), i,
+ lock_and_unlock_random_entries(file_ptr, (i - 100), i,
min_count, max_count);
}
}
@@ -5133,24 +5083,24 @@ smoke_check_5(void)
for ( i = 0; i < (virt_num_data_entries / 4); i++ )
{
- lock_entry(cache_ptr, file_ptr, i);
+ lock_entry(file_ptr, i);
if ( i % 2 == 0 )
{
- mark_entry_dirty(cache_ptr, file_ptr, i);
+ mark_entry_dirty(i);
}
- unlock_entry(cache_ptr, file_ptr, i, H5AC__NO_FLAGS_SET);
+ unlock_entry(file_ptr, i, H5AC__NO_FLAGS_SET);
if ( i % 2 == 1 )
{
if ( i % 4 == 1 ) {
- lock_entry(cache_ptr, file_ptr, i);
- unlock_entry(cache_ptr, file_ptr, i, H5AC__DIRTIED_FLAG);
+ lock_entry(file_ptr, i);
+ unlock_entry(file_ptr, i, H5AC__DIRTIED_FLAG);
}
- expunge_entry(cache_ptr, file_ptr, i);
+ expunge_entry(file_ptr, i);
}
}
@@ -5163,7 +5113,7 @@ smoke_check_5(void)
i >= (virt_num_data_entries / 4);
i-- )
{
- pin_entry(cache_ptr, file_ptr, i, TRUE, FALSE);
+ pin_entry(file_ptr, i, TRUE, FALSE);
if ( i % 2 == 0 )
{
@@ -5172,7 +5122,7 @@ smoke_check_5(void)
resize_entry(i, data[i].len / 2);
}
- mark_entry_dirty(cache_ptr, file_ptr, i);
+ mark_entry_dirty(i);
if ( i % 8 <= 4 ) {
@@ -5180,7 +5130,7 @@ smoke_check_5(void)
}
}
- unpin_entry(cache_ptr, file_ptr, i, TRUE, FALSE, FALSE);
+ unpin_entry(file_ptr, i, TRUE, FALSE, FALSE);
}
/* 6 */
@@ -5425,7 +5375,7 @@ trace_file_check(void)
strcpy(config.trace_file_name, "t_cache_trace.txt");
if ( H5AC_set_cache_auto_resize_config(cache_ptr, &config)
- != SUCCEED ) {
+ != SUCCEED ) {
nerrors++;
HDfprintf(stdout,
@@ -5440,27 +5390,27 @@ trace_file_check(void)
insert_entry(cache_ptr, file_ptr, 2, H5AC__NO_FLAGS_SET);
insert_entry(cache_ptr, file_ptr, 3, H5AC__NO_FLAGS_SET);
- lock_entry(cache_ptr, file_ptr, 0);
- mark_entry_dirty(cache_ptr, file_ptr, 0);
- unlock_entry(cache_ptr, file_ptr, 0, H5AC__NO_FLAGS_SET);
+ lock_entry(file_ptr, 0);
+ mark_entry_dirty(0);
+ unlock_entry(file_ptr, 0, H5AC__NO_FLAGS_SET);
- lock_entry(cache_ptr, file_ptr, 1);
+ lock_entry(file_ptr, 1);
pin_protected_entry(1, TRUE);
- unlock_entry(cache_ptr, file_ptr, 1, H5AC__NO_FLAGS_SET);
- unpin_entry(cache_ptr, file_ptr, 1, TRUE, FALSE, FALSE);
+ unlock_entry(file_ptr, 1, H5AC__NO_FLAGS_SET);
+ unpin_entry(file_ptr, 1, TRUE, FALSE, FALSE);
- expunge_entry(cache_ptr,file_ptr, 1);
+ expunge_entry(file_ptr, 1);
- lock_entry(cache_ptr, file_ptr, 2);
+ lock_entry(file_ptr, 2);
pin_protected_entry(2, TRUE);
- unlock_entry(cache_ptr, file_ptr, 2, H5AC__NO_FLAGS_SET);
- mark_entry_dirty(cache_ptr, file_ptr, 2);
+ unlock_entry(file_ptr, 2, H5AC__NO_FLAGS_SET);
+ mark_entry_dirty(2);
resize_entry(2, data[2].len / 2);
resize_entry(2, data[2].len);
- unpin_entry(cache_ptr, file_ptr, 2, TRUE, FALSE, FALSE);
+ unpin_entry(file_ptr, 2, TRUE, FALSE, FALSE);
- move_entry(cache_ptr, file_ptr, 0, 20);
- move_entry(cache_ptr, file_ptr, 0, 20);
+ move_entry(file_ptr, 0, 20);
+ move_entry(file_ptr, 0, 20);
if ( H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0 ) {
nerrors++;
@@ -5489,7 +5439,7 @@ trace_file_check(void)
config.trace_file_name[0] = '\0';
if ( H5AC_set_cache_auto_resize_config(cache_ptr, &config)
- != SUCCEED ) {
+ != SUCCEED ) {
nerrors++;
HDfprintf(stdout,