summaryrefslogtreecommitdiffstats
path: root/src/H5Ochunk.c
diff options
context:
space:
mode:
authorFrank Willmore <Frank.Willmore@hdfgroup.org>2016-12-19 18:09:38 (GMT)
committerFrank Willmore <Frank.Willmore@hdfgroup.org>2016-12-19 18:09:38 (GMT)
commitd0a7400a344394f2a17157d2c8250adfbd57e93a (patch)
tree29d1e3be8400846f432656b09d360556d789ed8e /src/H5Ochunk.c
parenta2e93075f2ec86dad367a8aafadc20f6386f9b0e (diff)
parentab3963b28e59419f8e857ec224dd4efa3ea6dd8e (diff)
downloadhdf5-d0a7400a344394f2a17157d2c8250adfbd57e93a.zip
hdf5-d0a7400a344394f2a17157d2c8250adfbd57e93a.tar.gz
hdf5-d0a7400a344394f2a17157d2c8250adfbd57e93a.tar.bz2
Merging in latest from upstream (HDFFV/hdf5:refs/heads/develop)
* commit 'ab3963b28e59419f8e857ec224dd4efa3ea6dd8e': (214 commits) Merge SWMR-related testing to existing tests. Bring over tweak for missing environment variable. Update CMake configuration files with SWMR accumulator changes. Add missing accumulator test. Merge SWMR-oriented accumulator tests from revise_chunks to develop. Bring Java SWMR changes from revise_chunks to develop branch Snapshot version 1.9 release 235 Change dlopen from RTLD_NOW to RTLD_LAZY Fix bad implementation of Windows nanosleep equivalent. Removed NDEBUG guards from H5AC test functions. Bring SWMR-related tools changes from revise_chunks to develop. Bring over changes from revise_chunks that cleanup recent SWMR changes from code review feedback. Updated the H5FS cache code to grab the correct tag and modified the freespace test to use dxpls that have been tagged with the H5AC__FREESPACE_TAG global tag instead of H5AC_ind_read_dxpl_id. The library code now expects the owner of the free space manager to tag it so the owner-less free space managers in the freespace tag had to be tagged with *something* to avoid cache errors. Updated the comment for the valgrind fix. Fixed a valgrind problem in file shutdown exposed by the swmr.c test. Reduce timeout as normal run time on windows is less then 10 min Updated the icc flags (C flags only). Another Java oversight (sorry, don't have Java configured on my Mac) Correct oversight in Java test and remove direct VFD from SWMR supported drivers. Bring SWMR support in to the main development branch. (Finally!) More tests and the tool and API wrappers will be coming in over the weekend. ...
Diffstat (limited to 'src/H5Ochunk.c')
-rw-r--r--src/H5Ochunk.c62
1 files changed, 52 insertions, 10 deletions
diff --git a/src/H5Ochunk.c b/src/H5Ochunk.c
index 18561b3..50be171 100644
--- a/src/H5Ochunk.c
+++ b/src/H5Ochunk.c
@@ -93,7 +93,8 @@ H5FL_DEFINE(H5O_chunk_proxy_t);
*-------------------------------------------------------------------------
*/
herr_t
-H5O_chunk_add(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned idx)
+H5O_chunk_add(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned idx,
+ unsigned cont_chunkno)
{
H5O_chunk_proxy_t *chk_proxy = NULL; /* Proxy for chunk, to mark it dirty in the cache */
herr_t ret_value = SUCCEED; /* Return value */
@@ -110,14 +111,16 @@ H5O_chunk_add(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned idx)
if(NULL == (chk_proxy = H5FL_CALLOC(H5O_chunk_proxy_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
- /* Set the values in the chunk proxy */
- chk_proxy->oh = oh;
- chk_proxy->chunkno = idx;
-
/* Increment reference count on object header */
if(H5O_inc_rc(oh) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINC, FAIL, "can't increment reference count on object header")
+ /* Set the values in the chunk proxy */
+ chk_proxy->f = f;
+ chk_proxy->oh = oh;
+ chk_proxy->chunkno = idx;
+ chk_proxy->cont_chunkno = cont_chunkno;
+
/* Insert the chunk proxy into the cache */
if(H5AC_insert_entry(f, dxpl_id, H5AC_OHDR_CHK, oh->chunk[idx].addr, chk_proxy, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "unable to cache object header chunk")
@@ -126,8 +129,8 @@ H5O_chunk_add(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned idx)
done:
if(ret_value < 0)
- if(chk_proxy)
- chk_proxy = H5FL_FREE(H5O_chunk_proxy_t, chk_proxy);
+ if(chk_proxy && H5O__chunk_dest(chk_proxy) < 0)
+ HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "unable to destroy object header chunk")
FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL)
} /* end H5O_chunk_add() */
@@ -172,6 +175,7 @@ H5O_chunk_protect(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned idx)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINC, NULL, "can't increment reference count on object header")
/* Set chunk proxy fields */
+ chk_proxy->f = f;
chk_proxy->oh = oh;
chk_proxy->chunkno = idx;
} /* end if */
@@ -200,8 +204,8 @@ H5O_chunk_protect(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned idx)
done:
/* Cleanup on error */
if(!ret_value)
- if(0 == idx && chk_proxy)
- chk_proxy = H5FL_FREE(H5O_chunk_proxy_t, chk_proxy);
+ if(0 == idx && chk_proxy && H5O__chunk_dest(chk_proxy) < 0)
+ HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, NULL, "unable to destroy object header chunk")
FUNC_LEAVE_NOAPI_TAG(ret_value, NULL)
} /* end H5O_chunk_protect() */
@@ -399,7 +403,9 @@ H5O_chunk_delete(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned idx)
HDassert(chk_proxy->oh == oh);
HDassert(chk_proxy->chunkno == idx);
- cache_flags |= H5AC__DIRTIED_FLAG | H5AC__FREE_FILE_SPACE_FLAG;
+ /* Only free file space if not doing SWMR writes */
+ if(!oh->swmr_write)
+ cache_flags |= H5AC__DIRTIED_FLAG | H5AC__FREE_FILE_SPACE_FLAG;
/* Release the chunk proxy from the cache, marking it deleted */
if(H5AC_unprotect(f, dxpl_id, H5AC_OHDR_CHK, oh->chunk[idx].addr, chk_proxy, cache_flags) < 0)
@@ -409,3 +415,39 @@ done:
FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL)
} /* end H5O_chunk_delete() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5O__chunk_dest
+ *
+ * Purpose: Destroy a chunk proxy object
+ *
+ * Return: Success: SUCCEED
+ * Failure: FAIL
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * July 13, 2008
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5O__chunk_dest(H5O_chunk_proxy_t *chk_proxy)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ /* Check arguments */
+ HDassert(chk_proxy);
+
+ /* Decrement reference count of object header */
+ if(chk_proxy->oh && H5O_dec_rc(chk_proxy->oh) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTDEC, FAIL, "can't decrement reference count on object header")
+
+ /* Release the chunk proxy object */
+ chk_proxy = H5FL_FREE(H5O_chunk_proxy_t, chk_proxy);
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5O__chunk_dest() */
+