summaryrefslogtreecommitdiffstats
path: root/src/H5Gnode.c
diff options
context:
space:
mode:
authorBill Wendling <wendling@ncsa.uiuc.edu>2003-09-10 20:06:10 (GMT)
committerBill Wendling <wendling@ncsa.uiuc.edu>2003-09-10 20:06:10 (GMT)
commit1f5e8c2e63a4f3cf34d8f187adc24133caa2d25d (patch)
treef9a33f8b46169840102c80b62a53361ee5ce71d0 /src/H5Gnode.c
parent6a9188f0cb0ab63e858fee73c5261bbab4376c47 (diff)
downloadhdf5-1f5e8c2e63a4f3cf34d8f187adc24133caa2d25d.zip
hdf5-1f5e8c2e63a4f3cf34d8f187adc24133caa2d25d.tar.gz
hdf5-1f5e8c2e63a4f3cf34d8f187adc24133caa2d25d.tar.bz2
[svn-r7460] Purpose:
Update Description: Added extra parameter to the H5AC_protect() function that indicates if the cache being asked for is going to be written to or just read from. Those AC_protect calls that were H5AC_find calls are now read-only. The rest are writes. Platforms tested: Linux (h5committest not needed due to size and small impact) Misc. update:
Diffstat (limited to 'src/H5Gnode.c')
-rw-r--r--src/H5Gnode.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/H5Gnode.c b/src/H5Gnode.c
index 875c4c4..36e876b 100644
--- a/src/H5Gnode.c
+++ b/src/H5Gnode.c
@@ -820,7 +820,7 @@ H5G_node_found(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *_lt_key
/*
* Load the symbol table node for exclusive access.
*/
- if (NULL == (sn = H5AC_protect(f, dxpl_id, H5AC_SNODE, addr, NULL, NULL)))
+ if (NULL == (sn = H5AC_protect(f, dxpl_id, H5AC_SNODE, addr, NULL, NULL, H5AC_WRITE)))
HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, FAIL, "unable to protect symbol table node");
/* Get base address of heap */
@@ -933,7 +933,7 @@ H5G_node_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, void UNUSED *_lt_key,
/*
* Load the symbol node.
*/
- if (NULL == (sn = H5AC_protect(f, dxpl_id, H5AC_SNODE, addr, NULL, NULL)))
+ if (NULL == (sn = H5AC_protect(f, dxpl_id, H5AC_SNODE, addr, NULL, NULL, H5AC_WRITE)))
HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, H5B_INS_ERROR, "unable to protect symbol table node");
/* Get base address of heap */
@@ -978,7 +978,7 @@ H5G_node_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, void UNUSED *_lt_key,
new_node_p/*out*/)<0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5B_INS_ERROR, "unable to split symbol table node");
- if (NULL == (snrt = H5AC_protect(f, dxpl_id, H5AC_SNODE, *new_node_p, NULL, NULL)))
+ if (NULL == (snrt = H5AC_protect(f, dxpl_id, H5AC_SNODE, *new_node_p, NULL, NULL, H5AC_WRITE)))
HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, H5B_INS_ERROR, "unable to split symbol table node");
HDmemcpy(snrt->entry, sn->entry + H5F_SYM_LEAF_K(f),
@@ -1105,7 +1105,7 @@ H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key/*in,out*/,
assert(bt_udata);
/* Load the symbol table */
- if (NULL==(sn=H5AC_protect(f, dxpl_id, H5AC_SNODE, addr, NULL, NULL)))
+ if (NULL==(sn=H5AC_protect(f, dxpl_id, H5AC_SNODE, addr, NULL, NULL, H5AC_WRITE)))
HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, H5B_INS_ERROR, "unable to protect symbol table node");
/* Get base address of heap */
@@ -1286,7 +1286,7 @@ H5G_node_iterate (H5F_t *f, hid_t dxpl_id, void UNUSED *_lt_key, haddr_t addr,
* Save information about the symbol table node since we can't lock it
* because we're about to call an application function.
*/
- if (NULL == (sn = H5AC_protect(f, dxpl_id, H5AC_SNODE, addr, NULL, NULL)))
+ if (NULL == (sn = H5AC_protect(f, dxpl_id, H5AC_SNODE, addr, NULL, NULL, H5AC_READ)))
HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, H5B_ITER_ERROR, "unable to load symbol table node");
nsyms = sn->nsyms;
if (NULL==(name_off = H5MM_malloc (nsyms*sizeof(name_off[0]))))
@@ -1372,7 +1372,7 @@ H5G_node_sumup(H5F_t *f, hid_t dxpl_id, void UNUSED *_lt_key, haddr_t addr,
assert(num_objs);
/* Find the object node and add the number of symbol entries. */
- if (NULL == (sn = H5AC_protect(f, dxpl_id, H5AC_SNODE, addr, NULL, NULL)))
+ if (NULL == (sn = H5AC_protect(f, dxpl_id, H5AC_SNODE, addr, NULL, NULL, H5AC_READ)))
HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, H5B_ITER_ERROR, "unable to load symbol table node");
*num_objs += sn->nsyms;
@@ -1423,7 +1423,7 @@ H5G_node_name(H5F_t *f, hid_t dxpl_id, void UNUSED *_lt_key, haddr_t addr,
assert(H5F_addr_defined(addr));
assert(bt_udata);
- if (NULL == (sn = H5AC_protect(f, dxpl_id, H5AC_SNODE, addr, NULL, NULL)))
+ if (NULL == (sn = H5AC_protect(f, dxpl_id, H5AC_SNODE, addr, NULL, NULL, H5AC_READ)))
HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, H5B_ITER_ERROR, "unable to load symbol table node");
/* Find the node, locate the object symbol table entry and retrieve the name */
@@ -1480,7 +1480,7 @@ H5G_node_type(H5F_t *f, hid_t dxpl_id, void UNUSED *_lt_key, haddr_t addr,
assert(bt_udata);
/* Find the node, locate the object symbol table entry and retrieve the type */
- if (NULL == (sn = H5AC_protect(f, dxpl_id, H5AC_SNODE, addr, NULL, NULL)))
+ if (NULL == (sn = H5AC_protect(f, dxpl_id, H5AC_SNODE, addr, NULL, NULL, H5AC_READ)))
HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, H5B_ITER_ERROR, "unable to load symbol table node");
if(bt_udata->idx >= bt_udata->num_objs && bt_udata->idx < (bt_udata->num_objs+sn->nsyms)) {
@@ -1542,7 +1542,7 @@ H5G_node_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, int indent,
* If we couldn't load the symbol table node, then try loading the
* B-tree node.
*/
- if (NULL == (sn = H5AC_protect(f, dxpl_id, H5AC_SNODE, addr, NULL, NULL))) {
+ if (NULL == (sn = H5AC_protect(f, dxpl_id, H5AC_SNODE, addr, NULL, NULL, H5AC_READ))) {
H5G_bt_ud1_t udata; /*data to pass through B-tree */
H5E_clear(NULL); /* discard that error */
@@ -1578,6 +1578,9 @@ H5G_node_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, int indent,
sn = NULL;
done:
+ if (sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, FALSE) < 0)
+ HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to release symbol table node");
+
FUNC_LEAVE_NOAPI(ret_value);
}