summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2010-05-27 13:11:55 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2010-05-27 13:11:55 (GMT)
commit71d4644df239df3ea2f9013d54b93dd68cf9392b (patch)
tree3dd68f12ebbeb7f68a773c50420f9868f0009454
parent817f42c3bb8c0090a12dc78a9c537cbaefb2dd93 (diff)
downloadhdf5-71d4644df239df3ea2f9013d54b93dd68cf9392b.zip
hdf5-71d4644df239df3ea2f9013d54b93dd68cf9392b.tar.gz
hdf5-71d4644df239df3ea2f9013d54b93dd68cf9392b.tar.bz2
[svn-r18911] Description:
More general changes to align trunk with eventual changes from metadata journaling branch. Tested on: Mac OS X/32 10.6.3 (amazon) w/debug, production & parallel (h5committest not required on this branch)
-rw-r--r--src/H5AC.c102
-rw-r--r--src/H5B.c7
-rw-r--r--src/H5B2.c7
-rw-r--r--src/H5B2cache.c27
-rw-r--r--src/H5B2pkg.h1
-rw-r--r--src/H5C.c96
-rw-r--r--src/H5Cpkg.h37
-rw-r--r--src/H5Dchunk.c2
-rw-r--r--src/H5FD.c10
-rw-r--r--src/H5FS.c11
-rw-r--r--src/H5FScache.c26
-rw-r--r--src/H5FSpkg.h5
-rw-r--r--src/H5Fpublic.h1
-rw-r--r--src/H5Gnode.c100
-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.c65
-rw-r--r--src/H5SMcache.c64
-rwxr-xr-xsrc/H5SMpkg.h34
-rw-r--r--src/H5SMtest.c1
-rw-r--r--test/cache.c266
-rw-r--r--test/cache_api.c520
-rw-r--r--test/cache_common.c578
-rw-r--r--test/cache_common.h179
-rw-r--r--testpar/t_cache.c360
29 files changed, 1138 insertions, 1408 deletions
diff --git a/src/H5AC.c b/src/H5AC.c
index 8f04841..789fe94 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,
@@ -1079,11 +1077,10 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5AC_set(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, void *thing, unsigned int flags)
+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;
- herr_t ret_value=SUCCEED; /* Return value */
#ifdef H5_HAVE_PARALLEL
H5AC_aux_t * aux_ptr = NULL;
#endif /* H5_HAVE_PARALLEL */
@@ -1092,6 +1089,7 @@ H5AC_set(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, void *
size_t trace_entry_size = 0;
FILE * trace_file_ptr = NULL;
#endif /* H5AC__TRACE_FILE_ENABLED */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5AC_set, FAIL)
@@ -1125,72 +1123,33 @@ H5AC_set(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, void *
}
#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
- if ( ( aux_ptr != NULL ) &&
- ( aux_ptr->dirty_bytes >= aux_ptr->dirty_bytes_threshold ) ) {
-
- result = H5AC_propagate_flushed_and_still_clean_entries_list(f,
- H5AC_noblock_dxpl_id,
- f->shared->cache,
- TRUE);
- if ( result < 0 ) {
-
- HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, 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")
+
+ if(aux_ptr->dirty_bytes >= aux_ptr->dirty_bytes_threshold) {
+ if(H5AC_propagate_flushed_and_still_clean_entries_list(f, H5AC_noblock_dxpl_id,
+ f->shared->cache, TRUE) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "Can't propagate clean entries list")
+ } /* 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);
@@ -1198,7 +1157,6 @@ done:
#endif /* H5AC__TRACE_FILE_ENABLED */
FUNC_LEAVE_NOAPI(ret_value)
-
} /* H5AC_set() */
@@ -3382,12 +3340,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;
@@ -3402,24 +3357,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.
@@ -3431,7 +3375,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 ) {
@@ -3448,14 +3392,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 f7ede07..f94bb0a 100644
--- a/src/H5B.c
+++ b/src/H5B.c
@@ -705,12 +705,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/H5B2.c b/src/H5B2.c
index 9c329fe..dd182fb 100644
--- a/src/H5B2.c
+++ b/src/H5B2.c
@@ -124,6 +124,7 @@ H5B2_create(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type,
/* Assign internal information */
HDmemset(&bt2->cache_info, 0, sizeof(H5AC_info_t));
+ bt2->hdr_size = H5B2_HEADER_SIZE(f);
bt2->root.addr = HADDR_UNDEF;
bt2->root.node_nrec = 0;
bt2->root.all_nrec = 0;
@@ -133,7 +134,7 @@ H5B2_create(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type,
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't create shared B-tree info")
/* Allocate space for the header on disk */
- if(HADDR_UNDEF == (*addr_p = H5MF_alloc(f, H5FD_MEM_BTREE, dxpl_id, (hsize_t)H5B2_HEADER_SIZE(f))))
+ if(HADDR_UNDEF == (*addr_p = H5MF_alloc(f, H5FD_MEM_BTREE, dxpl_id, (hsize_t)bt2->hdr_size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "file allocation failed for B-tree header")
/* Cache the new B-tree node */
@@ -1029,7 +1030,7 @@ H5B2_delete(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
HGOTO_ERROR(H5E_BTREE, H5E_CANTDELETE, FAIL, "unable to delete B-tree nodes")
/* Release space for B-tree node on disk */
- if(H5MF_xfree(f, H5FD_MEM_BTREE, dxpl_id, addr, (hsize_t)H5B2_HEADER_SIZE(f))<0)
+ if(H5MF_xfree(f, H5FD_MEM_BTREE, dxpl_id, addr, (hsize_t)bt2->hdr_size) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, "unable to free B-tree header info")
done:
@@ -1282,7 +1283,7 @@ H5B2_iterate_size(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t add
HDassert(shared);
/* Add size of header to B-tree metadata total */
- *btree_size += H5B2_HEADER_SIZE(f);
+ *btree_size += bt2->hdr_size;
/* Make copy of the root node pointer */
root_ptr = bt2->root;
diff --git a/src/H5B2cache.c b/src/H5B2cache.c
index 387c153..8424103 100644
--- a/src/H5B2cache.c
+++ b/src/H5B2cache.c
@@ -151,7 +151,6 @@ H5B2_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata)
size_t node_size, rrec_size; /* Size info for B-tree */
uint8_t split_percent, merge_percent; /* Split & merge %s for B-tree */
H5B2_t *bt2 = NULL; /* B-tree info */
- 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 */
@@ -177,14 +176,14 @@ H5B2_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata)
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(udata->f);
+ bt2->hdr_size = H5B2_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, bt2->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, hdr) < 0)
+ if(H5F_block_read(f, H5FD_MEM_BTREE, addr, bt2->hdr_size, dxpl_id, hdr) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_READERROR, NULL, "can't read B-tree header")
/* Get temporary pointer to serialized header */
@@ -225,10 +224,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 *)hdr) == size);
+ HDassert((size_t)(p - (const uint8_t *)hdr) == bt2->hdr_size);
/* Compute checksum on entire header */
- computed_chksum = H5_checksum_metadata(hdr, (size - H5B2_SIZEOF_CHKSUM), 0);
+ computed_chksum = H5_checksum_metadata(hdr, (bt2->hdr_size - H5B2_SIZEOF_CHKSUM), 0);
/* Verify checksum */
if(stored_chksum != computed_chksum)
@@ -284,7 +283,6 @@ H5B2_cache_hdr_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5B
H5B2_shared_t *shared; /* Shared B-tree information */
uint8_t *hdr; /* 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 */
/* Get the pointer to the shared B-tree info */
@@ -295,11 +293,8 @@ H5B2_cache_hdr_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5B
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(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, bt2->hdr_size)))
HGOTO_ERROR(H5E_BTREE, H5E_NOSPACE, FAIL, "can't get actual buffer")
/* Get temporary pointer to serialized header */
@@ -336,14 +331,14 @@ H5B2_cache_hdr_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5B
H5F_ENCODE_LENGTH(f, p, bt2->root.all_nrec);
/* Compute metadata checksum */
- metadata_chksum = H5_checksum_metadata(hdr, (size - H5B2_SIZEOF_CHKSUM), 0);
+ metadata_chksum = H5_checksum_metadata(hdr, (bt2->hdr_size - H5B2_SIZEOF_CHKSUM), 0);
/* Metadata checksum */
UINT32ENCODE(p, metadata_chksum);
/* Write the B-tree header. */
- HDassert((size_t)(p - hdr) == size);
- if(H5F_block_write(f, H5FD_MEM_BTREE, addr, size, dxpl_id, hdr) < 0)
+ HDassert((size_t)(p - hdr) == bt2->hdr_size);
+ if(H5F_block_write(f, H5FD_MEM_BTREE, addr, bt2->hdr_size, dxpl_id, hdr) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTFLUSH, FAIL, "unable to save B-tree header to disk")
bt2->cache_info.is_dirty = FALSE;
@@ -449,7 +444,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5B2_cache_hdr_size(const H5F_t *f, const H5B2_t UNUSED *bt2, size_t *size_ptr)
+H5B2_cache_hdr_size(const H5F_t UNUSED *f, const H5B2_t *bt2, size_t *size_ptr)
{
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5B2_cache_hdr_size)
@@ -458,7 +453,7 @@ H5B2_cache_hdr_size(const H5F_t *f, const H5B2_t UNUSED *bt2, size_t *size_ptr)
HDassert(size_ptr);
/* Set size value */
- *size_ptr = H5B2_HEADER_SIZE(f);
+ *size_ptr = bt2->hdr_size;
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5B2_cache_hdr_size() */
diff --git a/src/H5B2pkg.h b/src/H5B2pkg.h
index 21b6eee..f0bb2b5 100644
--- a/src/H5B2pkg.h
+++ b/src/H5B2pkg.h
@@ -188,6 +188,7 @@ typedef struct H5B2_t {
/* Internal B-tree information */
H5B2_node_ptr_t root; /* Node pointer to root node in B-tree */
+ size_t hdr_size; /* Size of the B-tree header on disk */
H5RC_t *shared; /* Ref-counted shared info */
} H5B2_t;
diff --git a/src/H5C.c b/src/H5C.c
index adfcc23..4c8896b 100644
--- a/src/H5C.c
+++ b/src/H5C.c
@@ -1958,13 +1958,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;
@@ -2476,9 +2473,8 @@ H5C_mark_entry_dirty(void *thing)
HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
if ( entry_ptr->is_protected ) {
-#if 0 /* JRM - uncomment this when possible */
HDassert( ! ((entry_ptr)->is_read_only) );
-#endif
+
/* set the dirtied flag */
entry_ptr->dirtied = TRUE;
@@ -4280,8 +4276,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 */
@@ -7204,28 +7198,27 @@ H5C_load_entry(H5F_t * f,
hbool_t UNUSED skip_file_checks)
#endif /* NDEBUG */
{
- void * thing = NULL;
- H5C_cache_entry_t * entry_ptr = NULL;
- void * ret_value = NULL;
+ void * thing = NULL; /* Pointer to thing loaded */
+ H5C_cache_entry_t * entry; /* Alias for thing loaded, as cache entry */
+ 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.
*
@@ -7236,11 +7229,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.
@@ -7250,49 +7243,46 @@ 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->flush_in_progress = FALSE;
+ entry->destroy_in_progress = 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 );
- entry_ptr->ht_next = NULL;
- entry_ptr->ht_prev = NULL;
+ 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 765dc5b..8961b13 100644
--- a/src/H5Cpkg.h
+++ b/src/H5Cpkg.h
@@ -2863,43 +2863,6 @@ if ( ( (cache_ptr) == NULL ) || \
*
* 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 0df7f0f..3e85317 100644
--- a/src/H5Dchunk.c
+++ b/src/H5Dchunk.c
@@ -24,7 +24,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/H5FD.c b/src/H5FD.c
index 383d064..e2d567f 100644
--- a/src/H5FD.c
+++ b/src/H5FD.c
@@ -2136,14 +2136,14 @@ H5FD_write(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t si
{
size_t new_size; /* New size of the accumulator buffer */
size_t old_offset; /* Offset of old data within the accumulator buffer */
- herr_t ret_value=SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5FD_write, FAIL)
- assert(file && file->cls);
- assert(H5I_GENPROP_LST==H5I_get_type(dxpl_id));
- assert(TRUE==H5P_isa_class(dxpl_id,H5P_DATASET_XFER));
- assert(buf);
+ HDassert(file && file->cls);
+ HDassert(H5I_GENPROP_LST == H5I_get_type(dxpl_id));
+ HDassert(TRUE == H5P_isa_class(dxpl_id, H5P_DATASET_XFER));
+ HDassert(buf);
#ifndef H5_HAVE_PARALLEL
/* Do not return early for Parallel mode since the I/O could be a */
diff --git a/src/H5FS.c b/src/H5FS.c
index c829aad..8a41ee7 100644
--- a/src/H5FS.c
+++ b/src/H5FS.c
@@ -120,11 +120,11 @@ 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")
/* 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")
*fs_addr = fspace->addr;
@@ -309,7 +309,7 @@ HDfprintf(stderr, "%s: Done expunging free space section info from cache\n", FUN
} /* end if */
/* Release header's disk space */
- if(H5MF_xfree(f, H5FD_MEM_FSPACE_HDR, dxpl_id, fs_addr, (hsize_t)H5FS_HEADER_SIZE(f))<0)
+ if(H5MF_xfree(f, H5FD_MEM_FSPACE_HDR, dxpl_id, fs_addr, (hsize_t)fspace->hdr_size) < 0)
HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "unable to release free space header")
/* Release the free space header */
@@ -431,7 +431,7 @@ done:
*-------------------------------------------------------------------------
*/
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; /* Free space manager */
@@ -472,6 +472,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 */
@@ -508,7 +509,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->alloc_sect_size;
+ *meta_size += fspace->hdr_size + fspace->alloc_sect_size;
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5FS_size() */
diff --git a/src/H5FScache.c b/src/H5FScache.c
index 0f83803..3948c13 100644
--- a/src/H5FScache.c
+++ b/src/H5FScache.c
@@ -148,7 +148,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 */
@@ -165,7 +164,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->fs_prot->nclasses, udata->fs_prot->classes, udata->fs_prot->cls_init_udata)))
+ if(NULL == (fspace = H5FS_new(udata->f, udata->fs_prot->nclasses, udata->fs_prot->classes, udata->fs_prot->cls_init_udata)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Set free space manager's internal information */
@@ -175,15 +174,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 = H5FS_HEADER_SIZE(udata->f);
-
/* Get a pointer to a buffer that's large enough for header */
- if(NULL == (hdr = H5WB_actual(wb, size)))
+ if(NULL == (hdr = 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;
@@ -247,7 +243,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)
@@ -299,17 +295,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 = H5FS_HEADER_SIZE(f);
-
/* Get a pointer to a buffer that's large enough for header */
- if(NULL == (hdr = H5WB_actual(wb, size)))
+ if(NULL == (hdr = H5WB_actual(wb, fspace->hdr_size)))
HGOTO_ERROR(H5E_FSPACE, H5E_NOSPACE, FAIL, "can't get actual buffer")
/* Get temporary pointer to header */
@@ -368,8 +360,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;
@@ -475,7 +467,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)
@@ -485,7 +477,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 = 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 a88958f..c87a9b8 100644
--- a/src/H5FSpkg.h
+++ b/src/H5FSpkg.h
@@ -181,6 +181,7 @@ struct H5FS_t {
/* Computed/cached values */
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 */
/* Memory data structures (not stored directly) */
@@ -216,8 +217,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);
/* Free space section routines */
H5_DLL H5FS_sinfo_t *H5FS_sinfo_new(H5F_t *f, H5FS_t *fspace);
diff --git a/src/H5Fpublic.h b/src/H5Fpublic.h
index c5c07f8..84b54b3 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/H5Gnode.c b/src/H5Gnode.c
index a040490..54cb625 100644
--- a/src/H5Gnode.c
+++ b/src/H5Gnode.c
@@ -59,22 +59,34 @@ typedef struct H5G_node_key_t {
* table or group.
*/
typedef struct H5G_node_t {
- H5AC_info_t cache_info; /* Information for H5AC cache functions, _must_ be */
+ 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;
/* Private macros */
#define H5G_NODE_VERS 1 /*symbol table node version number */
-#define H5G_NODE_SIZEOF_HDR(F) (H5G_NODE_SIZEOF_MAGIC + 4)
+
+/* Size of a symbol table node on disk */
+#define H5G_NODE_SIZE(f) ( \
+ /* General metadata fields */ \
+ H5G_NODE_SIZEOF_MAGIC \
+ + 1 /* Version */ \
+ + 1 /* Reserved */ \
+ + 2 /* Number of symbols */ \
+ \
+ /* Entries */ \
+ + ((2 * H5F_SYM_LEAF_K(f)) * H5G_SIZEOF_ENTRY(f)) \
+ )
+
/* Size of stack buffer for serialized nodes */
#define H5G_NODE_BUF_SIZE 512
/* PRIVATE PROTOTYPES */
-static size_t H5G_node_size_real(const H5F_t *f);
static herr_t H5G_node_free(H5G_node_t *sym);
/* Metadata cache callbacks */
@@ -273,31 +285,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
- *
- *-------------------------------------------------------------------------
- */
-static 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.
@@ -349,7 +336,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 */
@@ -369,19 +355,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 = H5WB_actual(wb, size)))
+ if(NULL == (node = 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 */
@@ -399,12 +389,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);
@@ -463,17 +447,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; /* Node buffer */
uint8_t *p; /* Pointer into node 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 = H5WB_actual(wb, size)))
+ if(NULL == (node = H5WB_actual(wb, sym->node_size)))
HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't get actual buffer")
/* Serialize symbol table node into buffer */
@@ -495,10 +475,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 */
@@ -615,7 +595,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)
@@ -625,7 +605,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() */
@@ -657,7 +637,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)
@@ -670,9 +649,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, 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)))))
@@ -1222,7 +1200,7 @@ H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key/*in,out*/,
*rt_key = *lt_key;
*rt_key_changed = TRUE;
sn->nsyms = 0;
- if(H5MF_xfree(f, H5FD_MEM_BTREE, dxpl_id, addr, (hsize_t)H5G_node_size_real(f)) < 0
+ if(H5MF_xfree(f, H5FD_MEM_BTREE, dxpl_id, addr, (hsize_t)sn->node_size) < 0
|| H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, H5AC__DIRTIED_FLAG | H5AC__DELETED_FLAG) < 0) {
sn = NULL;
HGOTO_ERROR(H5E_SYM, H5E_PROTECT, H5B_INS_ERROR, "unable to free symbol table node")
@@ -1294,7 +1272,7 @@ H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key/*in,out*/,
*rt_key = *lt_key;
*rt_key_changed = TRUE;
sn->nsyms = 0;
- if(H5MF_xfree(f, H5FD_MEM_BTREE, dxpl_id, addr, (hsize_t)H5G_node_size_real(f)) < 0
+ if(H5MF_xfree(f, H5FD_MEM_BTREE, dxpl_id, addr, (hsize_t)sn->node_size) < 0
|| H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, H5AC__DIRTIED_FLAG | H5AC__DELETED_FLAG) < 0) {
sn = NULL;
HGOTO_ERROR(H5E_SYM, H5E_PROTECT, H5B_INS_ERROR, "unable to free symbol table node")
@@ -1782,7 +1760,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
@@ -1804,10 +1782,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() */
/*-------------------------------------------------------------------------
@@ -1867,7 +1845,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/H5HFcache.c b/src/H5HFcache.c
index 31b3d55..5c6f54d 100644
--- a/src/H5HFcache.c
+++ b/src/H5HFcache.c
@@ -738,7 +738,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 = H5WB_actual(wb, iblock->size)))
diff --git a/src/H5HFiblock.c b/src/H5HFiblock.c
index 9a2926c..71c2573 100644
--- a/src/H5HFiblock.c
+++ b/src/H5HFiblock.c
@@ -551,7 +551,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;
- iblock->size = H5HF_MAN_INDIRECT_SIZE(hdr, iblock);
+ iblock->size = H5HF_MAN_INDIRECT_SIZE(hdr, iblock->nrows);
/* Allocate space for the new indirect block on disk */
if(HADDR_UNDEF == (new_addr = H5MF_alloc(hdr->f, H5FD_MEM_FHEAP_IBLOCK, dxpl_id, (hsize_t)iblock->size)))
@@ -710,7 +710,7 @@ H5HF_man_iblock_root_halve(H5HF_indirect_t *iblock, hid_t dxpl_id)
/* Compute size of buffer needed for new indirect block */
old_nrows = iblock->nrows;
iblock->nrows = new_nrows;
- iblock->size = H5HF_MAN_INDIRECT_SIZE(hdr, iblock);
+ iblock->size = H5HF_MAN_INDIRECT_SIZE(hdr, iblock->nrows);
/* Allocate space for the new indirect block on disk */
if(HADDR_UNDEF == (new_addr = H5MF_alloc(hdr->f, H5FD_MEM_FHEAP_IBLOCK, dxpl_id, (hsize_t)iblock->size)))
@@ -968,7 +968,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 74d6c1a..ef14598 100644
--- a/src/H5HFpkg.h
+++ b/src/H5HFpkg.h
@@ -131,18 +131,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 d3cd9d5..117f695 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 80cd835..0d8209d 100644
--- a/src/H5O.c
+++ b/src/H5O.c
@@ -1677,6 +1677,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 752d4a4..720e4aa 100644
--- a/src/H5Ocache.c
+++ b/src/H5Ocache.c
@@ -603,7 +603,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 f52d177..e3b4b40 100755
--- a/src/H5SM.c
+++ b/src/H5SM.c
@@ -123,14 +123,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)
@@ -141,36 +139,35 @@ H5SM_init(H5F_t *f, H5P_genplist_t * fc_plist, const H5O_loc_t *ext_loc, hid_t d
/* Initialize master table */
if(NULL == (table = H5FL_MALLOC(H5SM_master_table_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 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_PLIST, 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_PLIST, 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_PLIST, 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_PLIST, 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_PLIST, 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_PLIST, 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_PLIST, 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 */
- /* 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
@@ -187,8 +184,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];
@@ -202,11 +198,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 = (hsize_t) H5SM_TABLE_SIZE(f) + (hsize_t) (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, table->table_size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "file allocation failed for SOHM table")
/* Cache the new table */
@@ -232,7 +230,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 */
@@ -359,7 +357,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_OHDR, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table")
@@ -413,7 +410,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)))
@@ -541,7 +537,6 @@ done:
static herr_t
H5SM_delete_index(H5F_t *f, H5SM_index_header_t *header, hid_t dxpl_id, hbool_t delete_heap)
{
- hsize_t list_size; /* Size of list on disk */
herr_t ret_value = SUCCEED;
FUNC_ENTER_NOAPI_NOINIT(H5SM_delete_index)
@@ -553,8 +548,7 @@ H5SM_delete_index(H5F_t *f, H5SM_index_header_t *header, hid_t dxpl_id, hbool_t
HGOTO_ERROR(H5E_HEAP, H5E_CANTREMOVE, FAIL, "unable to remove list index from cache")
/* Free the file space used */
- list_size = H5SM_LIST_SIZE(f, header->list_max);
- if(H5MF_xfree(f, H5FD_MEM_SOHM_INDEX, dxpl_id, header->index_addr, list_size) < 0)
+ if(H5MF_xfree(f, H5FD_MEM_SOHM_INDEX, dxpl_id, header->index_addr, header->list_size) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to free shared message list")
} /* end if */
else {
@@ -605,7 +599,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;
@@ -618,22 +611,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_RESOURCE, 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_RESOURCE, 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, header->list_size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, HADDR_UNDEF, "file allocation failed for SOHM list")
/* Put the list into the cache */
@@ -651,7 +642,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, header->list_size);
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
@@ -910,7 +901,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")
@@ -1020,7 +1010,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)))
@@ -1404,7 +1393,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)))
@@ -1837,7 +1825,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)))
@@ -2068,7 +2055,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 +2443,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)))
@@ -2619,15 +2604,13 @@ H5SM_ih_size(H5F_t *f, hid_t dxpl_id, H5F_info_t *finfo)
/* 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_CACHE, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table")
/* Get SOHM header size */
- finfo->sohm.hdr_size = (hsize_t) H5SM_TABLE_SIZE(f) +
- (hsize_t)(table->num_indexes * H5SM_INDEX_HEADER_SIZE(f));
+ finfo->sohm.hdr_size = (hsize_t)table->table_size;
/* Loop over all the indices for shared messages */
for(u = 0; u < table->num_indexes; u++) {
@@ -2638,7 +2621,7 @@ H5SM_ih_size(H5F_t *f, hid_t dxpl_id, H5F_info_t *finfo)
HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "can't retrieve B-tree storage info")
} /* end if */
else if(table->indexes[u].index_type == H5SM_LIST)
- finfo->sohm.msgs_info.index_size += H5SM_LIST_SIZE(f, table->indexes[u].list_max);
+ finfo->sohm.msgs_info.index_size += table->indexes[u].list_size;
/* Check for heap for this index */
if(H5F_addr_defined(table->indexes[u].heap_addr)) {
diff --git a/src/H5SMcache.c b/src/H5SMcache.c
index a575e0e..37c2515 100644
--- a/src/H5SMcache.c
+++ b/src/H5SMcache.c
@@ -116,7 +116,6 @@ static H5SM_master_table_t *
H5SM_table_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *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 */
@@ -148,17 +147,17 @@ H5SM_table_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *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 = H5WB_actual(wb, size)))
+ if(NULL == (buf = 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 */
@@ -169,11 +168,6 @@ H5SM_table_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata)
HGOTO_ERROR(H5E_SOHM, H5E_CANTLOAD, NULL, "bad SOHM table signature")
p += H5SM_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_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for SOHM indexes")
@@ -207,16 +201,19 @@ H5SM_table_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *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)
@@ -266,7 +263,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 */
@@ -279,11 +275,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 = H5WB_actual(wb, size)))
+ if(NULL == (buf = 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 */
@@ -324,12 +317,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;
@@ -429,7 +422,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)
@@ -439,7 +432,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() */
@@ -462,7 +455,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 */
- 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 */
@@ -492,15 +484,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 = H5WB_actual(wb, size)))
+ if(NULL == (buf = 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 */
@@ -522,10 +511,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)
@@ -582,7 +571,6 @@ H5SM_list_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5SM_lis
if(list->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 mesgs_written; /* Number of messages written to list */
size_t x; /* Local index variable */
@@ -591,10 +579,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 = H5WB_actual(wb, size)))
+ if(NULL == (buf = 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 */
@@ -618,12 +604,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;
@@ -733,7 +719,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 d3566dc..3a16847 100755
--- a/src/H5SMpkg.h
+++ b/src/H5SMpkg.h
@@ -69,11 +69,6 @@
+ MAX(H5SM_HEAP_LOC_SIZE, H5SM_OH_LOC_SIZE(f)) /* Entry */ \
)
-#define H5SM_TABLE_SIZE(f) ( \
- H5SM_SIZEOF_MAGIC /* Signature */ \
- + H5SM_SIZEOF_CHECKSUM /* Checksum */ \
- )
-
#define H5SM_INDEX_HEADER_SIZE(f) ( \
1 /* Whether index is a list or B-tree */ \
+ 1 /* Version of index format */ \
@@ -84,10 +79,26 @@
+ H5F_SIZEOF_ADDR(f) /* Address of heap */ \
)
+/* Format overhead for all SOHM tree metadata in the file */
+#define H5SM_METADATA_PREFIX_SIZE ( \
+ H5SM_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) ( \
- H5SM_SIZEOF_MAGIC /* Signature */ \
- + (H5SM_SOHM_ENTRY_SIZE(f) * num_mesg) /* Message entries */ \
- + 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
@@ -161,6 +172,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 */
@@ -169,6 +181,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 */
@@ -180,12 +195,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 */
};
@@ -224,7 +239,6 @@ typedef struct {
/* 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 67140dd..1c9ec62 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 17636cc..68ff400 100644
--- a/test/cache.c
+++ b/test/cache.c
@@ -24,6 +24,7 @@
#include "H5ACprivate.h"
#include "cache_common.h"
+
/* private typedef declarations: */
struct flush_cache_test_spec
@@ -100,7 +101,7 @@ struct move_entry_test_spec
hbool_t is_pinned;
};
-
+
/* private function declarations: */
static void smoke_check_1(void);
@@ -272,7 +273,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,
@@ -290,7 +291,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,
@@ -308,7 +309,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,
@@ -2758,7 +2759,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;
@@ -2776,7 +2776,7 @@ check_insert_entry(void)
if ( result < 0 ) {
pass = FALSE;
- failure_mssg = "H5AC_get_entry_status() reports failure.";
+ failure_mssg = "H5C_get_entry_status() reports failure.";
}
if ( pass ) {
@@ -2812,7 +2812,7 @@ check_insert_entry(void)
}
}
- /* Thats all we can get from H5AC_get_entry_status().
+ /* Thats all we can get from H5C_get_entry_status().
* Now start looking at the cache data structures directly.
*/
@@ -2905,7 +2905,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.
@@ -2935,7 +2934,6 @@ check_insert_entry(void)
}
}
-
/* Finally, if stats collection is enabled, verify that the expected
* stats are collected.
*/
@@ -2962,7 +2960,6 @@ check_insert_entry(void)
}
#endif /* H5C_COLLECT_CACHE_STATS */
-
/* Unpin the pinned entries so we can take down the cache cleanly. */
if ( pass ) {
@@ -3211,92 +3208,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
}
};
@@ -4922,14 +4919,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];
@@ -5150,14 +5147,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];
@@ -9635,12 +9632,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] =
@@ -9887,13 +9884,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 */
@@ -9972,7 +9969,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.";
}
@@ -10136,13 +10132,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 */
@@ -10201,7 +10197,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 */
@@ -10262,7 +10258,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 */
@@ -10327,7 +10323,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 */
@@ -10362,13 +10358,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 */
@@ -10457,8 +10453,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;
@@ -10471,7 +10467,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 */
@@ -10503,13 +10499,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. */
@@ -10581,8 +10577,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;
@@ -10595,7 +10591,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 */
@@ -10617,7 +10613,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.
*/
@@ -12631,7 +12628,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),
@@ -12642,7 +12639,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.",
@@ -14015,10 +14012,6 @@ check_pin_protected_entry(void)
* Programmer: John Mainzer
* 7/7/06
*
- * Modifications:
- *
- * None.
- *
*-------------------------------------------------------------------------
*/
@@ -16392,13 +16385,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
- *
*-------------------------------------------------------------------------
*/
@@ -16477,16 +16463,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.
- *
*-------------------------------------------------------------------------
*/
@@ -16870,10 +16846,6 @@ check_resize_entry_errs(void)
* Programmer: John Mainzer
* 4/3/07
*
- * Modifications:
- *
- * None.
- *
*-------------------------------------------------------------------------
*/
@@ -17226,9 +17198,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.
*
*-------------------------------------------------------------------------
*/
@@ -20688,19 +20660,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);
@@ -20766,8 +20738,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 ) &&
@@ -20791,8 +20763,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 ) &&
@@ -20815,8 +20787,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 ) &&
@@ -20839,8 +20811,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 ) &&
@@ -20864,16 +20836,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 ) {
@@ -21016,16 +20988,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 ) {
@@ -21446,9 +21418,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
*
*-------------------------------------------------------------------------
*/
@@ -24874,26 +24846,26 @@ check_auto_cache_resize_epoch_markers(void)
( (a).set_initial_size == (b).set_initial_size ) ) && \
( ( ! compare_init ) || \
( (a).initial_size == (b).initial_size ) ) && \
- ( (a).min_clean_fraction == (b).min_clean_fraction ) && \
+ ( 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 ) && \
- ( (a).lower_hr_threshold == (b).lower_hr_threshold ) && \
- ( (a).increment == (b).increment ) && \
+ ( 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 ) && \
- ( (a).flash_multiple == (b).flash_multiple ) && \
- ( (a).flash_threshold == (b).flash_threshold ) && \
+ ( 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 ) && \
- ( (a).upper_hr_threshold == (b).upper_hr_threshold ) && \
- ( (a).decrement == (b).decrement ) && \
+ ( 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 ) && \
- ( (a).empty_reserve == (b).empty_reserve ) )
+ ( DBL_REL_EQUAL((a).empty_reserve, (b).empty_reserve, 0.00001 ) ) )
static void
check_auto_cache_resize_input_errs(void)
@@ -27504,7 +27476,7 @@ check_auto_cache_resize_aux_fcns(void)
pass = FALSE;
failure_mssg = "H5C_get_cache_hit_rate failed.\n";
- } else if ( hit_rate != 0.5 ) {
+ } else if ( ! DBL_REL_EQUAL(hit_rate, 0.5, 0.00001) ) {
pass = FALSE;
failure_mssg =
@@ -27587,7 +27559,7 @@ check_auto_cache_resize_aux_fcns(void)
pass = FALSE;
failure_mssg = "H5C_get_cache_hit_rate failed.\n";
- } else if ( hit_rate != 0.5 ) {
+ } else if ( ! DBL_REL_EQUAL(hit_rate, 0.5, 0.00001) ) {
pass = FALSE;
failure_mssg =
diff --git a/test/cache_api.c b/test/cache_api.c
index 5c3a3d9..cc66fae 100644
--- a/test/cache_api.c
+++ b/test/cache_api.c
@@ -32,59 +32,12 @@ extern const char *FILENAME[];
/* 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);
@@ -119,73 +72,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)
{
@@ -384,7 +270,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";
}
}
@@ -533,7 +419,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";
}
}
@@ -610,128 +496,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 = 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
@@ -1074,282 +838,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 = 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 = 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:
@@ -3541,7 +3029,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 98ff0dd..7cb22dc 100644
--- a/test/cache_common.c
+++ b/test/cache_common.c
@@ -498,10 +498,6 @@ check_write_permitted(const H5F_t UNUSED * f,
* Programmer: John Mainzer
* 6/10/04
*
- * Modifications:
- *
- * Added variable_clear. -- JRM 8/30/06
- *
*-------------------------------------------------------------------------
*/
@@ -626,16 +622,6 @@ variable_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().
- *
*-------------------------------------------------------------------------
*/
@@ -792,14 +778,6 @@ variable_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.
- *
*-------------------------------------------------------------------------
*/
@@ -971,11 +949,6 @@ variable_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().
- *
*-------------------------------------------------------------------------
*/
@@ -1100,11 +1073,6 @@ variable_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().
- *
*-------------------------------------------------------------------------
*/
@@ -1459,7 +1427,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 );
@@ -1470,7 +1438,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 ) &&
@@ -1579,7 +1547,7 @@ entry_in_cache(H5C_t * cache_ptr,
HDassert( entry_ptr->type == type );
HDassert( entry_ptr == entry_ptr->self );
- H5C__SEARCH_INDEX(cache_ptr, entry_ptr->addr, test_ptr)
+ H5C_TEST__SEARCH_INDEX(cache_ptr, entry_ptr->addr, test_ptr)
if ( test_ptr != NULL ) {
@@ -1735,26 +1703,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.";
@@ -2750,9 +2719,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;
@@ -2800,7 +2768,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.
*
@@ -2825,70 +2793,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;
@@ -2915,7 +2886,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;
@@ -3090,7 +3060,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] ) );
@@ -3149,8 +3118,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;
@@ -3158,10 +3125,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] ) );
@@ -3171,7 +3134,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 );
@@ -3196,26 +3158,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().";
@@ -4519,3 +4461,399 @@ hl_col_major_scan_backward(H5F_t * file_ptr,
} /* hl_col_major_scan_backward() */
+
+/*** 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 2e0f872..d1c07e2 100644
--- a/test/cache_common.h
+++ b/test/cache_common.h
@@ -297,8 +297,8 @@ typedef struct test_entry_t
*/
} 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.
*/
@@ -306,42 +306,42 @@ typedef struct test_entry_t
#define H5C__HASH_MASK ((size_t)(H5C__HASH_TABLE_LEN - 1) << 3)
#define H5C__HASH_FCN(x) (int)(((x) & H5C__HASH_MASK) >> 3)
-#define H5C__PRE_HT_SEARCH_SC(cache_ptr, Addr) \
-if ( ( (cache_ptr) == NULL ) || \
+#define H5C_TEST__PRE_HT_SEARCH_SC(cache_ptr, Addr) \
+if ( ( (cache_ptr) == NULL ) || \
( (cache_ptr)->magic != H5C__H5C_T_MAGIC ) || \
- ( ! H5F_addr_defined(Addr) ) || \
- ( H5C__HASH_FCN(Addr) < 0 ) || \
+ ( ! 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"); \
+ HDfprintf(stdout, "Pre HT search SC failed.\n"); \
}
-#define H5C__POST_SUC_HT_SEARCH_SC(cache_ptr, entry_ptr, Addr, k) \
-if ( ( (cache_ptr) == NULL ) || \
- ( (cache_ptr)->magic != H5C__H5C_T_MAGIC ) || \
- ( (cache_ptr)->index_len < 1 ) || \
- ( (entry_ptr) == NULL ) || \
- ( (cache_ptr)->index_size < (entry_ptr)->size ) || \
- ( H5F_addr_ne((entry_ptr)->addr, (Addr)) ) || \
- ( (entry_ptr)->size <= 0 ) || \
- ( ((cache_ptr)->index)[k] == NULL ) || \
- ( ( ((cache_ptr)->index)[k] != (entry_ptr) ) && \
- ( (entry_ptr)->ht_prev == NULL ) ) || \
- ( ( ((cache_ptr)->index)[k] == (entry_ptr) ) && \
- ( (entry_ptr)->ht_prev != NULL ) ) || \
- ( ( (entry_ptr)->ht_prev != NULL ) && \
- ( (entry_ptr)->ht_prev->ht_next != (entry_ptr) ) ) || \
- ( ( (entry_ptr)->ht_next != NULL ) && \
- ( (entry_ptr)->ht_next->ht_prev != (entry_ptr) ) ) ) { \
- HDfprintf(stdout, "Post successful HT search SC failed.\n"); \
+#define H5C_TEST__POST_SUC_HT_SEARCH_SC(cache_ptr, entry_ptr, Addr, k) \
+if ( ( (cache_ptr) == NULL ) || \
+ ( (cache_ptr)->magic != H5C__H5C_T_MAGIC ) || \
+ ( (cache_ptr)->index_len < 1 ) || \
+ ( (entry_ptr) == NULL ) || \
+ ( (cache_ptr)->index_size < (entry_ptr)->size ) || \
+ ( H5F_addr_ne((entry_ptr)->addr, (Addr)) ) || \
+ ( (entry_ptr)->size <= 0 ) || \
+ ( ((cache_ptr)->index)[k] == NULL ) || \
+ ( ( ((cache_ptr)->index)[k] != (entry_ptr) ) && \
+ ( (entry_ptr)->ht_prev == NULL ) ) || \
+ ( ( ((cache_ptr)->index)[k] == (entry_ptr) ) && \
+ ( (entry_ptr)->ht_prev != NULL ) ) || \
+ ( ( (entry_ptr)->ht_prev != NULL ) && \
+ ( (entry_ptr)->ht_prev->ht_next != (entry_ptr) ) ) || \
+ ( ( (entry_ptr)->ht_next != NULL ) && \
+ ( (entry_ptr)->ht_next->ht_prev != (entry_ptr) ) ) ) { \
+ HDfprintf(stdout, "Post successful HT search SC failed.\n"); \
}
-#define H5C__SEARCH_INDEX(cache_ptr, Addr, entry_ptr) \
+#define H5C_TEST__SEARCH_INDEX(cache_ptr, Addr, entry_ptr) \
{ \
int k; \
int depth = 0; \
- H5C__PRE_HT_SEARCH_SC(cache_ptr, Addr) \
- k = H5C__HASH_FCN(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) ) ) \
{ \
@@ -350,7 +350,7 @@ if ( ( (cache_ptr) == NULL ) || \
} \
if ( entry_ptr ) \
{ \
- H5C__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 ) \
@@ -367,6 +367,104 @@ if ( ( (cache_ptr) == NULL ) || \
} \
}
+/* 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 ) ) && \
+ ( (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; \
+}
+
/* misc type definitions */
@@ -463,7 +561,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,
@@ -604,3 +702,24 @@ void verify_entry_status(H5C_t * cache_ptr,
void verify_unprotected(void);
+
+/*** 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);
+
diff --git a/testpar/t_cache.c b/testpar/t_cache.c
index d99cec0..84dd091 100644
--- a/testpar/t_cache.c
+++ b/testpar/t_cache.c
@@ -334,40 +334,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 */
@@ -1638,6 +1631,7 @@ serve_write_request(struct mssg_t * mssg_ptr)
/**************************** Call back functions ****************************/
/*****************************************************************************/
+
/*-------------------------------------------------------------------------
* Function: clear_datum
*
@@ -2149,8 +2143,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()";
@@ -2158,7 +2151,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 );
@@ -2262,8 +2254,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]) ) ||
@@ -2342,8 +2334,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,
@@ -2358,7 +2349,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 );
@@ -2374,7 +2364,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;
@@ -2388,8 +2378,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++;
}
}
@@ -2419,8 +2408,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)
{
@@ -2429,7 +2417,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 );
@@ -2444,7 +2431,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;
@@ -2469,8 +2456,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()"; */
@@ -2479,14 +2465,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);
}
}
@@ -2516,8 +2501,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)
{
@@ -2527,7 +2511,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 );
@@ -2547,7 +2530,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 {
@@ -2579,8 +2562,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,
@@ -2592,7 +2574,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 );
@@ -2604,7 +2585,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);
}
}
@@ -2631,8 +2612,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)
{
@@ -2641,7 +2621,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 );
@@ -2653,8 +2632,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;
@@ -2683,8 +2662,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()";
@@ -2693,7 +2671,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 );
@@ -2745,9 +2722,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;
@@ -2755,8 +2730,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 );
@@ -2807,8 +2780,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)
@@ -2819,7 +2791,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 );
@@ -2830,14 +2801,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 ) );
@@ -2960,10 +2931,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;
@@ -2976,7 +2946,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 );
@@ -3226,7 +3195,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",
@@ -3527,8 +3496,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)
{
@@ -3539,7 +3507,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 );
@@ -3611,8 +3578,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,
@@ -3625,7 +3591,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 );
@@ -3640,20 +3605,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);
}
@@ -3985,26 +3950,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 ) {
@@ -4153,8 +4116,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);
}
}
@@ -4162,44 +4124,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);
}
@@ -4207,11 +4168,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);
}
@@ -4221,7 +4181,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 ) {
@@ -4380,8 +4340,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);
}
}
@@ -4402,10 +4361,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 );
@@ -4415,13 +4374,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));
}
@@ -4457,17 +4415,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);
}
}
@@ -4482,14 +4440,14 @@ 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);
}
/* 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;
@@ -4497,11 +4455,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);
}
@@ -4509,11 +4466,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);
}
@@ -4526,23 +4482,22 @@ 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);
}
}
/* 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 ) {
@@ -4704,8 +4659,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);
}
}
@@ -4729,7 +4683,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 ) {
@@ -4737,10 +4691,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 );
@@ -4750,12 +4704,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));
}
@@ -4787,14 +4740,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);
}
}
@@ -4805,14 +4758,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;
@@ -4820,11 +4773,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);
}
@@ -4832,11 +4784,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);
}
@@ -4849,13 +4800,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);
}
}
@@ -5013,24 +4963,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);
}
}
@@ -5038,7 +4988,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 )
{
@@ -5047,7 +4997,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 ) {
@@ -5055,7 +5005,7 @@ smoke_check_5(void)
}
}
- unpin_entry(cache_ptr, file_ptr, i, TRUE, FALSE, FALSE);
+ unpin_entry(file_ptr, i, TRUE, FALSE, FALSE);
}
if ( fid >= 0 ) {
@@ -5280,7 +5230,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,
@@ -5295,27 +5245,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++;
@@ -5344,7 +5294,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,