summaryrefslogtreecommitdiffstats
path: root/src/H5HG.c
diff options
context:
space:
mode:
authorBill Wendling <wendling@ncsa.uiuc.edu>2003-09-10 17:05:19 (GMT)
committerBill Wendling <wendling@ncsa.uiuc.edu>2003-09-10 17:05:19 (GMT)
commit6d928cf05ef860086825665cbfff18c6d1c15b3c (patch)
tree1236f11f1935fefcd8d6ec04631e5313dba3baaa /src/H5HG.c
parent14f7f3e53d97c3f31a129145e7ea7e9cd55008dc (diff)
downloadhdf5-6d928cf05ef860086825665cbfff18c6d1c15b3c.zip
hdf5-6d928cf05ef860086825665cbfff18c6d1c15b3c.tar.gz
hdf5-6d928cf05ef860086825665cbfff18c6d1c15b3c.tar.bz2
[svn-r7456] Purpose:
Removal of H5AC_find() Description: The H5AC_find() function is mostly redundant and with the new Flexible Parallel HDF5 stuff, we need to do locking on metadata returned from the H5AC_find() anyway. So, all of the locking stuff will be placed in the H5AC_{un}protect() functions. The H5AC_find() is no longer needed. Solution: Replaced all H5AC_finds with H5AC_protects and H5AC_unprotects. Platforms tested: Linux (Fortran & C++) Solaris (Fortran) Irix (Parallel & Fortran) Misc. update:
Diffstat (limited to 'src/H5HG.c')
-rw-r--r--src/H5HG.c27
1 files changed, 21 insertions, 6 deletions
diff --git a/src/H5HG.c b/src/H5HG.c
index 4c81a93..922c2ca 100644
--- a/src/H5HG.c
+++ b/src/H5HG.c
@@ -765,15 +765,16 @@ H5HG_peek (H5F_t *f, hid_t dxpl_id, H5HG_t *hobj)
assert (hobj);
/* Load the heap and return a pointer to the object */
- if (NULL==(heap=H5AC_find(f, dxpl_id, H5AC_GHEAP, hobj->addr, NULL, NULL)))
+ if (NULL == (heap = H5AC_protect(f, dxpl_id, H5AC_GHEAP, hobj->addr, NULL, NULL)))
HGOTO_ERROR (H5E_HEAP, H5E_CANTLOAD, NULL, "unable to load heap");
+
assert (hobj->idx>0 && hobj->idx<heap->nalloc);
ret_value = heap->obj[hobj->idx].begin + H5HG_SIZEOF_OBJHDR (f);
assert (ret_value);
/*
- * Advance the heap in the CWFS list. We might have done this already
- * with the H5AC_find(), but it won't hurt to do it twice.
+ * Advance the heap in the CWFS list. We might have done this already
+ * with the H5AC_protect(), but it won't hurt to do it twice.
*/
if (heap->obj[0].begin) {
for (i=0; i<f->shared->ncwfs; i++) {
@@ -786,6 +787,10 @@ H5HG_peek (H5F_t *f, hid_t dxpl_id, H5HG_t *hobj)
}
}
}
+
+ if (H5AC_unprotect(f, dxpl_id, H5AC_GHEAP, hobj->addr, heap, FALSE) != SUCCEED)
+ HGOTO_ERROR(H5E_HEAP, H5E_PROTECT, FAIL, "unable to release object header");
+
heap=NULL;
done:
@@ -829,8 +834,9 @@ H5HG_read (H5F_t *f, hid_t dxpl_id, H5HG_t *hobj, void *object/*out*/)
assert (hobj);
/* Load the heap */
- if (NULL==(heap=H5AC_find(f, dxpl_id, H5AC_GHEAP, hobj->addr, NULL, NULL)))
+ if (NULL == (heap = H5AC_protect(f, dxpl_id, H5AC_GHEAP, hobj->addr, NULL, NULL)))
HGOTO_ERROR (H5E_HEAP, H5E_CANTLOAD, NULL, "unable to load heap");
+
assert (hobj->idx>0 && hobj->idx<heap->nalloc);
assert (heap->obj[hobj->idx].begin);
size = heap->obj[hobj->idx].size;
@@ -840,8 +846,8 @@ H5HG_read (H5F_t *f, hid_t dxpl_id, H5HG_t *hobj, void *object/*out*/)
HDmemcpy (object, p, size);
/*
- * Advance the heap in the CWFS list. We might have done this already
- * with the H5AC_find(), but it won't hurt to do it twice.
+ * Advance the heap in the CWFS list. We might have done this already
+ * with the H5AC_protect(), but it won't hurt to do it twice.
*/
if (heap->obj[0].begin) {
for (i=0; i<f->shared->ncwfs; i++) {
@@ -854,12 +860,21 @@ H5HG_read (H5F_t *f, hid_t dxpl_id, H5HG_t *hobj, void *object/*out*/)
}
}
}
+
+ if (H5AC_unprotect(f, dxpl_id, H5AC_GHEAP, hobj->addr, heap, FALSE) != SUCCEED) {
+ heap = NULL;
+ HGOTO_ERROR(H5E_HEAP, H5E_PROTECT, NULL, "unable to release object header");
+ }
+
heap = NULL;
/* Set return value */
ret_value=object;
done:
+ if (heap && H5AC_unprotect(f, dxpl_id, H5AC_GHEAP, hobj->addr, heap, FALSE) != SUCCEED)
+ HDONE_ERROR(H5E_HEAP, H5E_PROTECT, NULL, "unable to release object header");
+
FUNC_LEAVE_NOAPI(ret_value);
}