summaryrefslogtreecommitdiffstats
path: root/src/H5EAdblkpage.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/H5EAdblkpage.c')
-rw-r--r--src/H5EAdblkpage.c37
1 files changed, 36 insertions, 1 deletions
diff --git a/src/H5EAdblkpage.c b/src/H5EAdblkpage.c
index b903a8a..927dcb6 100644
--- a/src/H5EAdblkpage.c
+++ b/src/H5EAdblkpage.c
@@ -155,6 +155,7 @@ H5EA__dblk_page_create(H5EA_hdr_t *hdr, hid_t dxpl_id, H5EA_sblock_t *parent,
/* Local variables */
H5EA_dblk_page_t *dblk_page = NULL; /* Extensible array data block page */
+ hbool_t inserted = FALSE; /* Whether the header was inserted into cache */
/* Sanity check */
HDassert(hdr);
@@ -174,10 +175,23 @@ H5EA__dblk_page_create(H5EA_hdr_t *hdr, hid_t dxpl_id, H5EA_sblock_t *parent,
/* Cache the new extensible array data block page */
if(H5AC_insert_entry(hdr->f, dxpl_id, H5AC_EARRAY_DBLK_PAGE, dblk_page->addr, dblk_page, H5AC__NO_FLAGS_SET) < 0)
H5E_THROW(H5E_CANTINSERT, "can't add extensible array data block page to cache")
+ inserted = TRUE;
+
+ /* Add data block page as child of 'top' proxy */
+ if(hdr->top_proxy) {
+ if(H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, dxpl_id, dblk_page) < 0)
+ H5E_THROW(H5E_CANTSET, "unable to add extensible array entry as child of array proxy")
+ dblk_page->top_proxy = hdr->top_proxy;
+ } /* end if */
CATCH
if(ret_value < 0)
if(dblk_page) {
+ /* Remove from cache, if inserted */
+ if(inserted)
+ if(H5AC_remove_entry(dblk_page) < 0)
+ H5E_THROW(H5E_CANTREMOVE, "unable to remove extensible array data block page from cache")
+
/* Destroy data block page */
if(H5EA__dblk_page_dest(dblk_page) < 0)
H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array data block page")
@@ -206,6 +220,7 @@ H5EA__dblk_page_protect(H5EA_hdr_t *hdr, hid_t dxpl_id, H5EA_sblock_t *parent,
haddr_t dblk_page_addr, unsigned flags))
/* Local variables */
+ H5EA_dblk_page_t *dblk_page = NULL; /* Extensible array data block page */
H5EA_dblk_page_cache_ud_t udata; /* Information needed for loading data block page */
/* Sanity check */
@@ -221,10 +236,27 @@ H5EA__dblk_page_protect(H5EA_hdr_t *hdr, hid_t dxpl_id, H5EA_sblock_t *parent,
udata.dblk_page_addr = dblk_page_addr;
/* Protect the data block page */
- if(NULL == (ret_value = (H5EA_dblk_page_t *)H5AC_protect(hdr->f, dxpl_id, H5AC_EARRAY_DBLK_PAGE, dblk_page_addr, &udata, flags)))
+ if(NULL == (dblk_page = (H5EA_dblk_page_t *)H5AC_protect(hdr->f, dxpl_id, H5AC_EARRAY_DBLK_PAGE, dblk_page_addr, &udata, flags)))
H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array data block page, address = %llu", (unsigned long long)dblk_page_addr)
+ /* Create top proxy, if it doesn't exist */
+ if(hdr->top_proxy && NULL == dblk_page->top_proxy) {
+ /* Add data block page as child of 'top' proxy */
+ if(H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, dxpl_id, dblk_page) < 0)
+ H5E_THROW(H5E_CANTSET, "unable to add extensible array entry as child of array proxy")
+ dblk_page->top_proxy = hdr->top_proxy;
+ } /* end if */
+
+ /* Set return value */
+ ret_value = dblk_page;
+
CATCH
+ /* Clean up on error */
+ if(!ret_value) {
+ /* Release the data block page, if it was protected */
+ if(dblk_page && H5AC_unprotect(hdr->f, dxpl_id, H5AC_EARRAY_DBLK_PAGE, dblk_page->addr, dblk_page, H5AC__NO_FLAGS_SET) < 0)
+ H5E_THROW(H5E_CANTUNPROTECT, "unable to unprotect extensible array data block page, address = %llu", (unsigned long long)dblk_page->addr)
+ } /* end if */
END_FUNC(PKG) /* end H5EA__dblk_page_protect() */
@@ -299,6 +331,9 @@ H5EA__dblk_page_dest(H5EA_dblk_page_t *dblk_page))
dblk_page->hdr = NULL;
} /* end if */
+ /* Sanity check */
+ HDassert(NULL == dblk_page->top_proxy);
+
/* Free the data block page itself */
dblk_page = H5FL_FREE(H5EA_dblk_page_t, dblk_page);