summaryrefslogtreecommitdiffstats
path: root/src/H5Ochunk.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/H5Ochunk.c')
-rw-r--r--src/H5Ochunk.c56
1 files changed, 45 insertions, 11 deletions
diff --git a/src/H5Ochunk.c b/src/H5Ochunk.c
index 5fba81b..a137d54 100644
--- a/src/H5Ochunk.c
+++ b/src/H5Ochunk.c
@@ -216,7 +216,7 @@ done:
*/
herr_t
H5O_chunk_unprotect(H5F_t *f, hid_t dxpl_id, H5O_chunk_proxy_t *chk_proxy,
- unsigned chk_flags)
+ hbool_t dirtied)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -225,19 +225,11 @@ H5O_chunk_unprotect(H5F_t *f, hid_t dxpl_id, H5O_chunk_proxy_t *chk_proxy,
/* check args */
HDassert(f);
HDassert(chk_proxy);
- HDassert(!(chk_flags & (unsigned)~(H5AC__DIRTIED_FLAG | H5AC__SIZE_CHANGED_FLAG)));
/* Check for releasing first chunk */
if(0 == chk_proxy->chunkno) {
- /* Check for resizing the first chunk */
- if(chk_flags & H5AC__SIZE_CHANGED_FLAG) {
- /* Resize object header in cache */
- if(H5AC_resize_entry(chk_proxy->oh, chk_proxy->oh->chunk[0].size) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTRESIZE, FAIL, "unable to resize chunk in cache")
- } /* end if */
-
/* Check for dirtying the first chunk */
- if(chk_flags & H5AC__DIRTIED_FLAG) {
+ if(dirtied) {
/* Mark object header as dirty in cache */
if(H5AC_mark_entry_dirty(chk_proxy->oh) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTMARKDIRTY, FAIL, "unable to mark object header as dirty")
@@ -252,7 +244,7 @@ H5O_chunk_unprotect(H5F_t *f, hid_t dxpl_id, H5O_chunk_proxy_t *chk_proxy,
} /* end if */
else {
/* Release the chunk proxy from the cache, marking it dirty */
- if(H5AC_unprotect(f, dxpl_id, H5AC_OHDR_CHK, chk_proxy->oh->chunk[chk_proxy->chunkno].addr, chk_proxy, chk_flags) < 0)
+ if(H5AC_unprotect(f, dxpl_id, H5AC_OHDR_CHK, chk_proxy->oh->chunk[chk_proxy->chunkno].addr, chk_proxy, (dirtied ? H5AC__DIRTIED_FLAG : H5AC__NO_FLAGS_SET)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header chunk")
} /* end else */
@@ -262,6 +254,48 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5O_chunk_resize
+ *
+ * Purpose: Resize an object header chunk
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * May 6 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5O_chunk_resize(H5O_t *oh, H5O_chunk_proxy_t *chk_proxy)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(H5O_chunk_resize, FAIL)
+
+ /* check args */
+ HDassert(oh);
+ HDassert(chk_proxy);
+
+ /* Check for resizing first chunk */
+ if(0 == chk_proxy->chunkno) {
+ /* Resize object header in cache */
+ if(H5AC_resize_entry(oh, oh->chunk[0].size) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTRESIZE, FAIL, "unable to resize chunk in cache")
+ } /* end if */
+ else {
+ /* Resize chunk in cache */
+ if(H5AC_resize_entry(chk_proxy, oh->chunk[chk_proxy->chunkno].size) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTRESIZE, FAIL, "unable to resize chunk in cache")
+ } /* end else */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O_chunk_resize() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5O_chunk_update_idx
*
* Purpose: Update the chunk index for a chunk proxy