summaryrefslogtreecommitdiffstats
path: root/src/H5Ocache.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2010-05-27 13:10:28 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2010-05-27 13:10:28 (GMT)
commit037c318770490c07f23e30af26353b68dbf712c0 (patch)
treee1fb9a5233047824bc1405e099e8f85f2e8faf4b /src/H5Ocache.c
parent6a183ca20ce41b70feae9a52a4e04913d276be34 (diff)
downloadhdf5-037c318770490c07f23e30af26353b68dbf712c0.zip
hdf5-037c318770490c07f23e30af26353b68dbf712c0.tar.gz
hdf5-037c318770490c07f23e30af26353b68dbf712c0.tar.bz2
[svn-r18910] Description:
Remove 'size' parameter from H5AC2_set()/H5C2_insert_entry(), to align better with trunk. Use the 'image_len' cache client callback to retrieve the size of an inserted entry. Also, add flags to the cache client class structure, to indicate several client behaviors: speculative loads & compressed storage on disk (which were previously dependent on the 'image_len' callback only being used to detect size changes during load (deserialize) operations). Tested on: Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in debug mode Mac OS X/32 10.6.3 (amazon) in debug mode Mac OS X/32 10.6.3 (amazon) w/C++ & FORTRAN, w/threadsafe, in production mode
Diffstat (limited to 'src/H5Ocache.c')
-rw-r--r--src/H5Ocache.c49
1 files changed, 43 insertions, 6 deletions
diff --git a/src/H5Ocache.c b/src/H5Ocache.c
index 0955151..e1dc382 100644
--- a/src/H5Ocache.c
+++ b/src/H5Ocache.c
@@ -69,7 +69,7 @@
static herr_t H5O_cache_get_load_size(const void *_udata, size_t *image_len);
static void *H5O_cache_deserialize(const void *image, size_t len,
void *udata, hbool_t *dirty);
-static herr_t H5O_cache_image_len(const void *thing, size_t *image_len_ptr);
+static herr_t H5O_cache_image_len(const void *thing, size_t *image_len);
static herr_t H5O_cache_serialize(const H5F_t *f, hid_t dxpl_id, haddr_t addr,
size_t len, void *image, void *thing, unsigned *flags, haddr_t *new_addr,
size_t *new_len, void **new_image);
@@ -78,6 +78,7 @@ static herr_t H5O_cache_free_icr(void *thing);
static herr_t H5O_cache_chk_get_load_size(const void *_udata, size_t *image_len);
static void *H5O_cache_chk_deserialize(const void *image, size_t len,
void *udata, hbool_t *dirty);
+static herr_t H5O_cache_chk_image_len(const void *thing, size_t *image_len);
static herr_t H5O_cache_chk_serialize(const H5F_t *f, hid_t dxpl_id,
haddr_t addr, size_t len, void *image, void *thing, unsigned *flags,
haddr_t *new_addr, size_t *new_len, void **new_image);
@@ -106,6 +107,7 @@ const H5AC_class_t H5AC_OHDR[1] = {{
H5AC_OHDR_ID,
"object header",
H5FD_MEM_OHDR,
+ H5AC__CLASS_SPECULATIVE_LOAD_FLAG,
H5O_cache_get_load_size,
H5O_cache_deserialize,
H5O_cache_image_len,
@@ -118,9 +120,10 @@ const H5AC_class_t H5AC_OHDR_CHK[1] = {{
H5AC_OHDR_CHK_ID,
"object header chunk",
H5FD_MEM_OHDR,
+ H5AC__CLASS_NO_FLAGS_SET,
H5O_cache_chk_get_load_size,
H5O_cache_chk_deserialize,
- NULL,
+ H5O_cache_chk_image_len,
H5O_cache_chk_serialize,
H5O_cache_chk_free_icr,
}};
@@ -365,7 +368,7 @@ done:
/*-------------------------------------------------------------------------
* Function: H5O_cache_image_len
*
- * Purpose: Tell the metadata cache about the actual size of the object
+ * Purpose: Compute the size of the data structure on disk.
*
* Return: Non-negative on success/Negative on failure
*
@@ -376,7 +379,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5O_cache_image_len(const void *thing, size_t *image_len_ptr)
+H5O_cache_image_len(const void *thing, size_t *image_len)
{
const H5O_t *oh = (const H5O_t *)thing; /* The object header */
@@ -384,10 +387,13 @@ H5O_cache_image_len(const void *thing, size_t *image_len_ptr)
/* Check arguments */
HDassert(oh);
- HDassert(image_len_ptr);
+ HDassert(image_len);
/* Report the object header's prefix+first chunk length */
- *image_len_ptr = H5O_SIZEOF_HDR(oh) + oh->chunk0_size;
+ if(oh->chunk0_size)
+ *image_len = H5O_SIZEOF_HDR(oh) + oh->chunk0_size;
+ else
+ *image_len = oh->chunk[0].size;
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5O_cache_image_len() */
@@ -673,6 +679,37 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5O_cache_chk_image_len
+ *
+ * Purpose: Compute the size of the data structure on disk.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * May 20 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5O_cache_chk_image_len(const void *_thing, size_t *image_len)
+{
+ const H5O_chunk_proxy_t *chk_proxy = (const H5O_chunk_proxy_t *)_thing; /* Pointer to the object header chunk proxy */
+
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_cache_chk_image_len)
+
+ /* Check arguments */
+ HDassert(chk_proxy);
+ HDassert(image_len);
+
+ /* Set the image length size */
+ *image_len = chk_proxy->oh->chunk[chk_proxy->chunkno].size;
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5O_cache_chk_image_len() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5O_cache_chk_serialize
*
* Purpose: Serializes an object header chunk