summaryrefslogtreecommitdiffstats
path: root/src/H5HLcache.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2010-05-20 11:38:15 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2010-05-20 11:38:15 (GMT)
commit6a183ca20ce41b70feae9a52a4e04913d276be34 (patch)
treef38ffd7e1b810802f1786290bfb659bbdcd07ca5 /src/H5HLcache.c
parentb3ebfdd526cbce840a696df2ab544653bab5ca55 (diff)
downloadhdf5-6a183ca20ce41b70feae9a52a4e04913d276be34.zip
hdf5-6a183ca20ce41b70feae9a52a4e04913d276be34.tar.gz
hdf5-6a183ca20ce41b70feae9a52a4e04913d276be34.tar.bz2
[svn-r18862] Description:
Add 'get_load_size' client callback to determine the image size for reading a metadata cache entry from the file. Remove the 'size' parameter from the H5[A]C_protect() calls. General cleanups to align with code on trunk. Tested on: 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 Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
Diffstat (limited to 'src/H5HLcache.c')
-rw-r--r--src/H5HLcache.c72
1 files changed, 72 insertions, 0 deletions
diff --git a/src/H5HLcache.c b/src/H5HLcache.c
index 39d9789..643d3d6 100644
--- a/src/H5HLcache.c
+++ b/src/H5HLcache.c
@@ -49,6 +49,12 @@
/* Value indicating end of free list on disk */
#define H5HL_FREE_NULL 1
+/* Set the local heap size to speculatively read in */
+/* (needs to be more than the local heap prefix size to work at all and
+ * should be larger than the default local heap size to save the
+ * extra I/O operations) */
+#define H5HL_SPEC_READ_SIZE 512
+
/******************/
/* Local Typedefs */
@@ -65,6 +71,7 @@
/********************/
/* Metadata cache callbacks */
+static herr_t H5HL_prfx_get_load_size(const void *_udata, size_t *image_len);
static void *H5HL_prfx_deserialize(const void *image, size_t len,
void *udata, hbool_t *dirty);
static herr_t H5HL_prfx_image_len(const void *thing, size_t *image_len_ptr);
@@ -73,6 +80,7 @@ static herr_t H5HL_prfx_serialize(const H5F_t *f, hid_t dxpl_id, haddr_t addr, s
size_t *new_len, void **new_image);
static herr_t H5HL_prfx_free_icr(void *thing);
+static herr_t H5HL_dblk_get_load_size(const void *_udata, size_t *image_len);
static void *H5HL_dblk_deserialize(const void *image, size_t len,
void *udata, hbool_t *dirty);
static herr_t H5HL_dblk_serialize(const H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t len,
@@ -92,6 +100,7 @@ const H5AC_class_t H5AC_LHEAP_PRFX[1] = {{
H5AC_LHEAP_PRFX_ID,
"local heap prefix",
H5FD_MEM_LHEAP,
+ H5HL_prfx_get_load_size,
H5HL_prfx_deserialize,
H5HL_prfx_image_len,
H5HL_prfx_serialize,
@@ -105,6 +114,7 @@ const H5AC_class_t H5AC_LHEAP_DBLK[1] = {{
H5AC_LHEAP_DBLK_ID,
"local heap data block",
H5FD_MEM_LHEAP,
+ H5HL_dblk_get_load_size,
H5HL_dblk_deserialize,
NULL,
H5HL_dblk_serialize,
@@ -230,6 +240,37 @@ H5HL_fl_serialize(const H5HL_t *heap)
/*-------------------------------------------------------------------------
+ * Function: H5HL_prfx_get_load_size
+ *
+ * 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 18, 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5HL_prfx_get_load_size(const void *_udata, size_t *image_len)
+{
+ const H5HL_cache_prfx_ud_t *udata = (const H5HL_cache_prfx_ud_t *)_udata; /* User data for callback */
+
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HL_prfx_get_load_size)
+
+ /* Check arguments */
+ HDassert(udata);
+ HDassert(image_len);
+
+ /* Set the image length size */
+ *image_len = H5HL_SPEC_READ_SIZE;
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5HL_prfx_get_load_size() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5HL_prfx_deserialize
*
* Purpose: Deserialize the data structure from disk.
@@ -491,6 +532,37 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5HL_dblk_get_load_size
+ *
+ * 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 18, 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5HL_dblk_get_load_size(const void *_udata, size_t *image_len)
+{
+ const H5HL_cache_dblk_ud_t *udata = (const H5HL_cache_dblk_ud_t *)_udata; /* User data for callback */
+
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HL_dblk_get_load_size)
+
+ /* Check arguments */
+ HDassert(udata);
+ HDassert(image_len);
+
+ /* Set the image length size */
+ *image_len = udata->heap->dblk_size;
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5HL_dblk_get_load_size() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5HL_dblk_deserialize
*
* Purpose: Deserialize the data structure from disk.