mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-02-23 16:20:57 +08:00
[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:
This commit is contained in:
parent
6a9188f0cb
commit
1f5e8c2e63
@ -1408,11 +1408,15 @@ done:
|
||||
* Modifications:
|
||||
* Robb Matzke, 1999-07-27
|
||||
* The ADDR argument is passed by value.
|
||||
*
|
||||
* Bill Wendling, 2003-09-10
|
||||
* Added parameter to indicate whether this is a READ or
|
||||
* WRITE type of protect.
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
void *
|
||||
H5AC_protect(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr,
|
||||
const void *udata1, void *udata2)
|
||||
const void *udata1, void *udata2, H5AC_protect_t rw)
|
||||
{
|
||||
unsigned idx; /* Index in cache */
|
||||
void *thing=NULL;
|
||||
@ -1586,6 +1590,8 @@ H5AC_protect(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr,
|
||||
|
||||
cache->nprots += 1;
|
||||
|
||||
rw = rw; /* Remove compiler warning if no FPHDF5 used */
|
||||
|
||||
/* Set return value */
|
||||
ret_value=thing;
|
||||
|
||||
|
@ -87,6 +87,19 @@ typedef struct H5AC_class_t {
|
||||
H5AC_clear_func_t clear;
|
||||
} H5AC_class_t;
|
||||
|
||||
/*===----------------------------------------------------------------------===
|
||||
* Protect Types
|
||||
*===----------------------------------------------------------------------===
|
||||
*
|
||||
* These are for the wrapper functions to H5AC_protect. They specify what
|
||||
* type of operation you're planning on doing to the metadata. The
|
||||
* Flexible Parallel HDF5 locking can then act accordingly.
|
||||
*/
|
||||
typedef enum H5AC_protect_t {
|
||||
H5AC_WRITE, /* Protect object for writing */
|
||||
H5AC_READ /* Protect object for reading */
|
||||
} H5AC_protect_t;
|
||||
|
||||
/*
|
||||
* A cache has a certain number of entries. Objects are mapped into a
|
||||
* cache entry by hashing the object's file address. Each file has its
|
||||
@ -135,10 +148,11 @@ H5_DLL herr_t H5AC_init(void);
|
||||
H5_DLL herr_t H5AC_create(const H5F_t *f, int size_hint);
|
||||
H5_DLL herr_t H5AC_set(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr,
|
||||
void *thing);
|
||||
H5_DLL void *H5AC_protect(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr,
|
||||
const void *udata1, void *udata2);
|
||||
H5_DLL void *H5AC_protect(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type,
|
||||
haddr_t addr, const void *udata1, void *udata2,
|
||||
H5AC_protect_t rw);
|
||||
H5_DLL herr_t H5AC_unprotect(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr,
|
||||
void *thing, hbool_t deleted);
|
||||
void *thing, hbool_t deleted);
|
||||
H5_DLL herr_t H5AC_flush(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr,
|
||||
unsigned flags);
|
||||
H5_DLL herr_t H5AC_rename(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type,
|
||||
|
41
src/H5B.c
41
src/H5B.c
@ -637,7 +637,7 @@ H5B_find(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, void *u
|
||||
* Perform a binary search to locate the child which contains
|
||||
* the thing for which we're searching.
|
||||
*/
|
||||
if (NULL == (bt = H5AC_protect(f, dxpl_id, H5AC_BT, addr, type, udata)))
|
||||
if (NULL == (bt = H5AC_protect(f, dxpl_id, H5AC_BT, addr, type, udata, H5AC_WRITE)))
|
||||
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load B-tree node")
|
||||
rt = bt->nchildren;
|
||||
|
||||
@ -781,7 +781,7 @@ H5B_split(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, H5B_t *old_bt, haddr
|
||||
*/
|
||||
if (H5B_create(f, dxpl_id, type, udata, new_addr_p/*out*/) < 0)
|
||||
HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "unable to create B-tree")
|
||||
if (NULL==(new_bt=H5AC_protect(f, dxpl_id, H5AC_BT, *new_addr_p, type, udata)))
|
||||
if (NULL==(new_bt=H5AC_protect(f, dxpl_id, H5AC_BT, *new_addr_p, type, udata, H5AC_WRITE)))
|
||||
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to protect B-tree")
|
||||
new_bt->level = old_bt->level;
|
||||
|
||||
@ -821,7 +821,7 @@ H5B_split(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, H5B_t *old_bt, haddr
|
||||
new_bt->right = old_bt->right;
|
||||
|
||||
if (H5F_addr_defined(old_bt->right)) {
|
||||
if (NULL == (tmp_bt = H5AC_protect(f, dxpl_id, H5AC_BT, old_bt->right, type, udata)))
|
||||
if (NULL == (tmp_bt = H5AC_protect(f, dxpl_id, H5AC_BT, old_bt->right, type, udata, H5AC_WRITE)))
|
||||
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load right sibling")
|
||||
|
||||
tmp_bt->cache_info.dirty = TRUE;
|
||||
@ -979,7 +979,7 @@ H5B_insert(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr,
|
||||
assert(H5B_INS_RIGHT == my_ins);
|
||||
|
||||
/* the current root */
|
||||
if (NULL == (bt = H5AC_protect(f, dxpl_id, H5AC_BT, addr, type, udata)))
|
||||
if (NULL == (bt = H5AC_protect(f, dxpl_id, H5AC_BT, addr, type, udata, H5AC_READ)))
|
||||
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to locate root of B-tree")
|
||||
|
||||
level = bt->level;
|
||||
@ -1006,7 +1006,7 @@ H5B_insert(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr,
|
||||
bt = NULL;
|
||||
|
||||
/* the new node */
|
||||
if (NULL == (bt = H5AC_protect(f, dxpl_id, H5AC_BT, child, type, udata)))
|
||||
if (NULL == (bt = H5AC_protect(f, dxpl_id, H5AC_BT, child, type, udata, H5AC_READ)))
|
||||
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load new node")
|
||||
|
||||
if (!rt_key_changed) {
|
||||
@ -1039,7 +1039,7 @@ H5B_insert(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr,
|
||||
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate file space to move root")
|
||||
|
||||
/* update the new child's left pointer */
|
||||
if (NULL == (bt = H5AC_protect(f, dxpl_id, H5AC_BT, child, type, udata)))
|
||||
if (NULL == (bt = H5AC_protect(f, dxpl_id, H5AC_BT, child, type, udata, H5AC_WRITE)))
|
||||
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load new child")
|
||||
|
||||
bt->cache_info.dirty = TRUE;
|
||||
@ -1055,7 +1055,7 @@ H5B_insert(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr,
|
||||
* at the new location -QAK
|
||||
*/
|
||||
/* Bring the old root into the cache if it's not already */
|
||||
if (NULL == (bt = H5AC_protect(f, dxpl_id, H5AC_BT, addr, type, udata)))
|
||||
if (NULL == (bt = H5AC_protect(f, dxpl_id, H5AC_BT, addr, type, udata, H5AC_WRITE)))
|
||||
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load new child")
|
||||
|
||||
/* Make certain the old root info is marked as dirty before moving it, */
|
||||
@ -1301,7 +1301,7 @@ H5B_insert_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type
|
||||
* data. When the search completes IDX points to the child that
|
||||
* should get the new data.
|
||||
*/
|
||||
if (NULL == (bt = H5AC_protect(f, dxpl_id, H5AC_BT, addr, type, udata)))
|
||||
if (NULL == (bt = H5AC_protect(f, dxpl_id, H5AC_BT, addr, type, udata, H5AC_WRITE)))
|
||||
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, H5B_INS_ERROR, "unable to load node")
|
||||
rt = bt->nchildren;
|
||||
|
||||
@ -1493,7 +1493,7 @@ H5B_insert_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type
|
||||
if (bt->nchildren == 2 * H5F_KVALUE(f, type)) {
|
||||
if (H5B_split(f, dxpl_id, type, bt, addr, idx, split_ratios, udata, new_node_p/*out*/)<0)
|
||||
HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, H5B_INS_ERROR, "unable to split node")
|
||||
if (NULL == (twin = H5AC_protect(f, dxpl_id, H5AC_BT, *new_node_p, type, udata)))
|
||||
if (NULL == (twin = H5AC_protect(f, dxpl_id, H5AC_BT, *new_node_p, type, udata, H5AC_WRITE)))
|
||||
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, H5B_INS_ERROR, "unable to load node")
|
||||
if (idx<bt->nchildren) {
|
||||
tmp_bt = bt;
|
||||
@ -1596,7 +1596,7 @@ H5B_iterate (H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, H5B_operator_t op
|
||||
assert(H5F_addr_defined(addr));
|
||||
assert(udata);
|
||||
|
||||
if (NULL == (bt = H5AC_protect(f, dxpl_id, H5AC_BT, addr, type, udata)))
|
||||
if (NULL == (bt = H5AC_protect(f, dxpl_id, H5AC_BT, addr, type, udata, H5AC_READ)))
|
||||
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load B-tree node")
|
||||
|
||||
level = bt->level;
|
||||
@ -1626,7 +1626,7 @@ H5B_iterate (H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, H5B_operator_t op
|
||||
* leave the B-tree node protected during an application
|
||||
* callback.
|
||||
*/
|
||||
if (NULL == (bt = H5AC_protect(f, dxpl_id, H5AC_BT, cur_addr, type, udata)))
|
||||
if (NULL == (bt = H5AC_protect(f, dxpl_id, H5AC_BT, cur_addr, type, udata, H5AC_READ)))
|
||||
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "B-tree node")
|
||||
|
||||
for (u=0; u<bt->nchildren; u++)
|
||||
@ -1733,7 +1733,7 @@ H5B_remove_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type
|
||||
* Perform a binary search to locate the child which contains the thing
|
||||
* for which we're searching.
|
||||
*/
|
||||
if (NULL==(bt=H5AC_protect(f, dxpl_id, H5AC_BT, addr, type, udata)))
|
||||
if (NULL==(bt=H5AC_protect(f, dxpl_id, H5AC_BT, addr, type, udata, H5AC_WRITE)))
|
||||
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, H5B_INS_ERROR, "unable to load B-tree node")
|
||||
rt = bt->nchildren;
|
||||
while (lt<rt && cmp) {
|
||||
@ -1828,7 +1828,7 @@ H5B_remove_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type
|
||||
bt->ndirty = 0;
|
||||
if (level>0) {
|
||||
if (H5F_addr_defined(bt->left)) {
|
||||
if (NULL == (sibling = H5AC_protect(f, dxpl_id, H5AC_BT, bt->left, type, udata)))
|
||||
if (NULL == (sibling = H5AC_protect(f, dxpl_id, H5AC_BT, bt->left, type, udata, H5AC_WRITE)))
|
||||
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, H5B_INS_ERROR, "unable to load node from tree")
|
||||
|
||||
sibling->right = bt->right;
|
||||
@ -1840,7 +1840,7 @@ H5B_remove_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type
|
||||
sibling=NULL; /* Make certain future references will be caught */
|
||||
}
|
||||
if (H5F_addr_defined(bt->right)) {
|
||||
if (NULL == (sibling = H5AC_protect(f, dxpl_id, H5AC_BT, bt->right, type, udata)))
|
||||
if (NULL == (sibling = H5AC_protect(f, dxpl_id, H5AC_BT, bt->right, type, udata, H5AC_WRITE)))
|
||||
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, H5B_INS_ERROR, "unable to unlink node from tree")
|
||||
|
||||
sibling->left = bt->left;
|
||||
@ -2002,7 +2002,7 @@ H5B_remove(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, void
|
||||
* If the B-tree is now empty then make sure we mark the root node as
|
||||
* being at level zero
|
||||
*/
|
||||
if (NULL == (bt = H5AC_protect(f, dxpl_id, H5AC_BT, addr, type, udata)))
|
||||
if (NULL == (bt = H5AC_protect(f, dxpl_id, H5AC_BT, addr, type, udata, H5AC_WRITE)))
|
||||
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load B-tree root node")
|
||||
|
||||
if (0==bt->nchildren && 0!=bt->level) {
|
||||
@ -2055,7 +2055,7 @@ H5B_delete(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, void
|
||||
assert(H5F_addr_defined(addr));
|
||||
|
||||
/* Lock this B-tree node into memory for now */
|
||||
if (NULL == (bt = H5AC_protect(f, dxpl_id, H5AC_BT, addr, type, udata)))
|
||||
if (NULL == (bt = H5AC_protect(f, dxpl_id, H5AC_BT, addr, type, udata, H5AC_WRITE)))
|
||||
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load B-tree node")
|
||||
|
||||
/* Iterate over all children in tree, deleting them */
|
||||
@ -2097,6 +2097,9 @@ H5B_delete(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, void
|
||||
bt=NULL; /* Make certain future references will be caught */
|
||||
|
||||
done:
|
||||
if (bt && H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, FALSE)<0)
|
||||
HGOTO_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release B-tree node in cache")
|
||||
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5B_delete() */
|
||||
|
||||
@ -2288,7 +2291,7 @@ H5B_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, int f
|
||||
/*
|
||||
* Load the tree node.
|
||||
*/
|
||||
if (NULL == (bt = H5AC_protect(f, dxpl_id, H5AC_BT, addr, type, udata)))
|
||||
if (NULL == (bt = H5AC_protect(f, dxpl_id, H5AC_BT, addr, type, udata, H5AC_READ)))
|
||||
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load B-tree node")
|
||||
|
||||
/*
|
||||
@ -2408,7 +2411,7 @@ H5B_assert(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type, void
|
||||
}
|
||||
}
|
||||
/* Initialize the queue */
|
||||
bt = H5AC_protect(f, dxpl_id, H5AC_BT, addr, type, udata);
|
||||
bt = H5AC_protect(f, dxpl_id, H5AC_BT, addr, type, udata, H5AC_READ);
|
||||
assert(bt);
|
||||
cur = H5MM_calloc(sizeof(struct child_t));
|
||||
assert (cur);
|
||||
@ -2427,7 +2430,7 @@ H5B_assert(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type, void
|
||||
* test.
|
||||
*/
|
||||
for (ncell = 0; cur; ncell++) {
|
||||
bt = H5AC_protect(f, dxpl_id, H5AC_BT, cur->addr, type, udata);
|
||||
bt = H5AC_protect(f, dxpl_id, H5AC_BT, cur->addr, type, udata, H5AC_READ);
|
||||
assert(bt);
|
||||
|
||||
/* Check node header */
|
||||
|
@ -285,7 +285,7 @@ done:
|
||||
*/
|
||||
herr_t
|
||||
H5FP_request_read_metadata(H5FD_t *file, unsigned file_id, hid_t dxpl_id,
|
||||
H5FD_mem_t UNUSED mem_type, MPI_Offset addr,
|
||||
H5FD_mem_t UNUSED mem_type, haddr_t addr,
|
||||
size_t size, uint8_t **buf, int *bytes_read,
|
||||
unsigned *req_id, H5FP_status_t *status)
|
||||
{
|
||||
@ -385,7 +385,7 @@ done:
|
||||
*/
|
||||
herr_t
|
||||
H5FP_request_write_metadata(H5FD_t *file, unsigned file_id, hid_t dxpl_id,
|
||||
H5FD_mem_t mem_type, MPI_Offset addr,
|
||||
H5FD_mem_t mem_type, haddr_t addr,
|
||||
int mdata_size, const char *mdata,
|
||||
unsigned *req_id, H5FP_status_t *status)
|
||||
{
|
||||
|
@ -219,7 +219,7 @@ typedef struct {
|
||||
H5FP_status_t status; /* Status of the request */
|
||||
H5FD_mem_t mem_type; /* Type of memory updated, if req'd */
|
||||
unsigned md_size; /* Size of the metadata sent in next msg */
|
||||
MPI_Offset addr; /* Address of the metadata */
|
||||
haddr_t addr; /* Address of the metadata */
|
||||
} H5FP_read_t;
|
||||
|
||||
extern MPI_Datatype H5FP_read; /* MPI datatype for the H5FP_read obj */
|
||||
@ -273,11 +273,11 @@ extern herr_t H5FP_request_release_lock(unsigned sap_file_id, hobj_ref_t oid,
|
||||
int last, unsigned *req_id,
|
||||
H5FP_status_t *status);
|
||||
extern herr_t H5FP_request_read_metadata(H5FD_t *file, unsigned sap_file_id, hid_t dxpl_id,
|
||||
H5FD_mem_t mem_type, MPI_Offset addr,
|
||||
H5FD_mem_t mem_type, haddr_t addr,
|
||||
size_t size, uint8_t **buf, int *bytes_read,
|
||||
unsigned *req_id, H5FP_status_t *status);
|
||||
extern herr_t H5FP_request_write_metadata(H5FD_t *file, unsigned file_id, hid_t dxpl_id,
|
||||
H5FD_mem_t mem_type, MPI_Offset addr,
|
||||
H5FD_mem_t mem_type, haddr_t addr,
|
||||
int mdata_size, const char *mdata,
|
||||
unsigned *req_id, H5FP_status_t *status);
|
||||
extern herr_t H5FP_request_flush_metadata(H5FD_t *file, unsigned file_id,
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -765,7 +765,7 @@ 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_protect(f, dxpl_id, H5AC_GHEAP, hobj->addr, NULL, NULL)))
|
||||
if (NULL == (heap = H5AC_protect(f, dxpl_id, H5AC_GHEAP, hobj->addr, NULL, NULL, H5AC_READ)))
|
||||
HGOTO_ERROR (H5E_HEAP, H5E_CANTLOAD, NULL, "unable to load heap");
|
||||
|
||||
assert (hobj->idx>0 && hobj->idx<heap->nalloc);
|
||||
@ -834,7 +834,7 @@ H5HG_read (H5F_t *f, hid_t dxpl_id, H5HG_t *hobj, void *object/*out*/)
|
||||
assert (hobj);
|
||||
|
||||
/* Load the heap */
|
||||
if (NULL == (heap = H5AC_protect(f, dxpl_id, H5AC_GHEAP, hobj->addr, NULL, NULL)))
|
||||
if (NULL == (heap = H5AC_protect(f, dxpl_id, H5AC_GHEAP, hobj->addr, NULL, NULL, H5AC_READ)))
|
||||
HGOTO_ERROR (H5E_HEAP, H5E_CANTLOAD, NULL, "unable to load heap");
|
||||
|
||||
assert (hobj->idx>0 && hobj->idx<heap->nalloc);
|
||||
@ -914,7 +914,7 @@ H5HG_link (H5F_t *f, hid_t dxpl_id, H5HG_t *hobj, int adjust)
|
||||
HGOTO_ERROR (H5E_HEAP, H5E_WRITEERROR, FAIL, "no write intent on file");
|
||||
|
||||
/* Load the heap */
|
||||
if (NULL == (heap = H5AC_protect(f, dxpl_id, H5AC_GHEAP, hobj->addr, NULL, NULL)))
|
||||
if (NULL == (heap = H5AC_protect(f, dxpl_id, H5AC_GHEAP, hobj->addr, NULL, NULL, H5AC_WRITE)))
|
||||
HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load heap");
|
||||
|
||||
assert (hobj->idx>0 && hobj->idx<heap->nalloc);
|
||||
@ -972,7 +972,7 @@ H5HG_remove (H5F_t *f, hid_t dxpl_id, H5HG_t *hobj)
|
||||
HGOTO_ERROR (H5E_HEAP, H5E_WRITEERROR, FAIL, "no write intent on file");
|
||||
|
||||
/* Load the heap */
|
||||
if (NULL == (heap = H5AC_protect(f, dxpl_id, H5AC_GHEAP, hobj->addr, NULL, NULL)))
|
||||
if (NULL == (heap = H5AC_protect(f, dxpl_id, H5AC_GHEAP, hobj->addr, NULL, NULL, H5AC_WRITE)))
|
||||
HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load heap");
|
||||
|
||||
assert (hobj->idx>0 && hobj->idx<heap->nalloc);
|
||||
|
@ -73,7 +73,7 @@ H5HG_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent,
|
||||
assert(indent >= 0);
|
||||
assert(fwidth >= 0);
|
||||
|
||||
if (NULL == (h = H5AC_protect(f, dxpl_id, H5AC_GHEAP, addr, NULL, NULL)))
|
||||
if (NULL == (h = H5AC_protect(f, dxpl_id, H5AC_GHEAP, addr, NULL, NULL, H5AC_READ)))
|
||||
HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load global heap collection");
|
||||
|
||||
fprintf(stream, "%*sGlobal Heap Collection...\n", indent, "");
|
||||
|
12
src/H5HL.c
12
src/H5HL.c
@ -629,7 +629,7 @@ H5HL_read(H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t offset, size_t size, voi
|
||||
assert(f);
|
||||
assert (H5F_addr_defined(addr));
|
||||
|
||||
if (NULL == (heap = H5AC_protect(f, dxpl_id, H5AC_LHEAP, addr, NULL, NULL)))
|
||||
if (NULL == (heap = H5AC_protect(f, dxpl_id, H5AC_LHEAP, addr, NULL, NULL, H5AC_READ)))
|
||||
HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, NULL, "unable to load heap");
|
||||
|
||||
assert(offset < heap->mem_alloc);
|
||||
@ -696,7 +696,7 @@ H5HL_peek(H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t offset)
|
||||
assert(f);
|
||||
assert(H5F_addr_defined(addr));
|
||||
|
||||
if (NULL == (heap = H5AC_protect(f, dxpl_id, H5AC_LHEAP, addr, NULL, NULL)))
|
||||
if (NULL == (heap = H5AC_protect(f, dxpl_id, H5AC_LHEAP, addr, NULL, NULL, H5AC_READ)))
|
||||
HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, NULL, "unable to load heap");
|
||||
|
||||
assert(offset < heap->mem_alloc);
|
||||
@ -784,7 +784,7 @@ H5HL_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t buf_size, const void *
|
||||
if (0==(f->intent & H5F_ACC_RDWR))
|
||||
HGOTO_ERROR (H5E_HEAP, H5E_WRITEERROR, (size_t)(-1), "no write intent on file");
|
||||
|
||||
if (NULL == (heap = H5AC_protect(f, dxpl_id, H5AC_LHEAP, addr, NULL, NULL)))
|
||||
if (NULL == (heap = H5AC_protect(f, dxpl_id, H5AC_LHEAP, addr, NULL, NULL, H5AC_WRITE)))
|
||||
HGOTO_ERROR(H5E_HEAP, H5E_PROTECT, (size_t)(-1), "unable to load heap");
|
||||
|
||||
++heap->cache_info.dirty;
|
||||
@ -954,7 +954,7 @@ H5HL_write(H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t offset, size_t size, co
|
||||
if (0==(f->intent & H5F_ACC_RDWR))
|
||||
HGOTO_ERROR (H5E_HEAP, H5E_WRITEERROR, FAIL, "no write intent on file");
|
||||
|
||||
if (NULL == (heap = H5AC_protect(f, dxpl_id, H5AC_LHEAP, addr, NULL, NULL)))
|
||||
if (NULL == (heap = H5AC_protect(f, dxpl_id, H5AC_LHEAP, addr, NULL, NULL, H5AC_WRITE)))
|
||||
HGOTO_ERROR(H5E_HEAP, H5E_PROTECT, FAIL, "unable to load heap");
|
||||
|
||||
assert(offset < heap->mem_alloc);
|
||||
@ -1019,7 +1019,7 @@ H5HL_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t offset, size_t size)
|
||||
|
||||
size = H5HL_ALIGN (size);
|
||||
|
||||
if (NULL == (heap = H5AC_protect(f, dxpl_id, H5AC_LHEAP, addr, NULL, NULL)))
|
||||
if (NULL == (heap = H5AC_protect(f, dxpl_id, H5AC_LHEAP, addr, NULL, NULL, H5AC_WRITE)))
|
||||
HGOTO_ERROR(H5E_HEAP, H5E_PROTECT, FAIL, "unable to load heap");
|
||||
|
||||
assert(offset < heap->mem_alloc);
|
||||
@ -1144,7 +1144,7 @@ H5HL_delete(H5F_t *f, hid_t dxpl_id, haddr_t addr)
|
||||
sizeof_hdr= H5HL_SIZEOF_HDR(f);
|
||||
|
||||
/* Get heap pointer */
|
||||
if (NULL == (heap = H5AC_protect(f, dxpl_id, H5AC_LHEAP, addr, NULL, NULL)))
|
||||
if (NULL == (heap = H5AC_protect(f, dxpl_id, H5AC_LHEAP, addr, NULL, NULL, H5AC_WRITE)))
|
||||
HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load heap");
|
||||
|
||||
/* Check if the heap is contiguous on disk */
|
||||
|
@ -71,7 +71,7 @@ H5HL_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, int indent, int
|
||||
assert(indent >= 0);
|
||||
assert(fwidth >= 0);
|
||||
|
||||
if (NULL == (h = H5AC_protect(f, dxpl_id, H5AC_LHEAP, addr, NULL, NULL)))
|
||||
if (NULL == (h = H5AC_protect(f, dxpl_id, H5AC_LHEAP, addr, NULL, NULL, H5AC_READ)))
|
||||
HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load heap");
|
||||
|
||||
fprintf(stream, "%*sLocal Heap...\n", indent, "");
|
||||
|
24
src/H5O.c
24
src/H5O.c
@ -1209,7 +1209,7 @@ H5O_link(H5G_entry_t *ent, int adjust, hid_t dxpl_id)
|
||||
|
||||
/* get header */
|
||||
if (NULL == (oh = H5AC_protect(ent->file, dxpl_id, H5AC_OHDR, ent->header,
|
||||
NULL, NULL)))
|
||||
NULL, NULL, H5AC_WRITE)))
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header");
|
||||
|
||||
/* adjust link count */
|
||||
@ -1332,7 +1332,7 @@ H5O_count_real (H5G_entry_t *ent, const H5O_class_t *type, hid_t dxpl_id)
|
||||
assert (type);
|
||||
|
||||
/* Load the object header */
|
||||
if (NULL == (oh = H5AC_protect(ent->file, dxpl_id, H5AC_OHDR, ent->header, NULL, NULL)))
|
||||
if (NULL == (oh = H5AC_protect(ent->file, dxpl_id, H5AC_OHDR, ent->header, NULL, NULL, H5AC_READ)))
|
||||
HGOTO_ERROR (H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header");
|
||||
|
||||
for (u=acc=0; u<oh->nmesgs; u++) {
|
||||
@ -1436,7 +1436,7 @@ H5O_exists_real(H5G_entry_t *ent, const H5O_class_t *type, int sequence, hid_t d
|
||||
assert(sequence>=0);
|
||||
|
||||
/* Load the object header */
|
||||
if (NULL == (oh = H5AC_protect(ent->file, dxpl_id, H5AC_OHDR, ent->header, NULL, NULL)))
|
||||
if (NULL == (oh = H5AC_protect(ent->file, dxpl_id, H5AC_OHDR, ent->header, NULL, NULL, H5AC_READ)))
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header");
|
||||
|
||||
/* Scan through the messages looking for the right one */
|
||||
@ -1572,7 +1572,7 @@ H5O_read_real(H5G_entry_t *ent, const H5O_class_t *type, int sequence, void *mes
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, NULL, "unable to find message in object header");
|
||||
|
||||
/* copy the message to the user-supplied buffer */
|
||||
if (NULL == (oh = H5AC_protect(ent->file, dxpl_id, H5AC_OHDR, ent->header, NULL, NULL)))
|
||||
if (NULL == (oh = H5AC_protect(ent->file, dxpl_id, H5AC_OHDR, ent->header, NULL, NULL, H5AC_WRITE)))
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "unable to load object header");
|
||||
if (oh->mesg[idx].flags & H5O_FLAG_SHARED) {
|
||||
/*
|
||||
@ -1658,7 +1658,7 @@ H5O_find_in_ohdr(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5O_class_t **type
|
||||
assert(type_p);
|
||||
|
||||
/* Load the object header */
|
||||
if (NULL == (oh = H5AC_protect(f, dxpl_id, H5AC_OHDR, addr, NULL, NULL)))
|
||||
if (NULL == (oh = H5AC_protect(f, dxpl_id, H5AC_OHDR, addr, NULL, NULL, H5AC_WRITE)))
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, UFAIL, "unable to load object header");
|
||||
|
||||
/* Scan through the messages looking for the right one */
|
||||
@ -1844,7 +1844,7 @@ H5O_modify_real(H5G_entry_t *ent, const H5O_class_t *type, int overwrite,
|
||||
if (0==(ent->file->intent & H5F_ACC_RDWR))
|
||||
HGOTO_ERROR (H5E_OHDR, H5E_WRITEERROR, FAIL, "no write intent on file");
|
||||
|
||||
if (NULL == (oh = H5AC_protect(ent->file, dxpl_id, H5AC_OHDR, ent->header, NULL, NULL)))
|
||||
if (NULL == (oh = H5AC_protect(ent->file, dxpl_id, H5AC_OHDR, ent->header, NULL, NULL, H5AC_WRITE)))
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header");
|
||||
|
||||
/* Count similar messages */
|
||||
@ -1989,7 +1989,7 @@ H5O_protect(H5G_entry_t *ent, hid_t dxpl_id)
|
||||
if (0==(ent->file->intent & H5F_ACC_RDWR))
|
||||
HGOTO_ERROR (H5E_OHDR, H5E_WRITEERROR, NULL, "no write intent on file");
|
||||
|
||||
if (NULL == (ret_value = H5AC_protect(ent->file, dxpl_id, H5AC_OHDR, ent->header, NULL, NULL)))
|
||||
if (NULL == (ret_value = H5AC_protect(ent->file, dxpl_id, H5AC_OHDR, ent->header, NULL, NULL, H5AC_WRITE)))
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "unable to load object header");
|
||||
|
||||
done:
|
||||
@ -2313,7 +2313,7 @@ H5O_touch(H5G_entry_t *ent, hbool_t force, hid_t dxpl_id)
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "no write intent on file");
|
||||
|
||||
/* Get the object header */
|
||||
if (NULL==(oh=H5AC_protect(ent->file, dxpl_id, H5AC_OHDR, ent->header, NULL, NULL)))
|
||||
if (NULL==(oh=H5AC_protect(ent->file, dxpl_id, H5AC_OHDR, ent->header, NULL, NULL, H5AC_WRITE)))
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header");
|
||||
|
||||
/* Create/Update the modification time message */
|
||||
@ -2417,7 +2417,7 @@ H5O_bogus(H5G_entry_t *ent, hid_t dxpl_id)
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "no write intent on file");
|
||||
|
||||
/* Get the object header */
|
||||
if (NULL==(oh=H5AC_protect(ent->file, dxpl_id, H5AC_OHDR, ent->header, NULL, NULL)))
|
||||
if (NULL==(oh=H5AC_protect(ent->file, dxpl_id, H5AC_OHDR, ent->header, NULL, NULL, H5AC_WRITE)))
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header");
|
||||
|
||||
/* Create the "bogus" message */
|
||||
@ -2534,7 +2534,7 @@ H5O_remove_real(H5G_entry_t *ent, const H5O_class_t *type, int sequence, hid_t d
|
||||
HGOTO_ERROR (H5E_HEAP, H5E_WRITEERROR, FAIL, "no write intent on file");
|
||||
|
||||
/* load the object header */
|
||||
if (NULL == (oh = H5AC_protect(ent->file, dxpl_id, H5AC_OHDR, ent->header, NULL, NULL)))
|
||||
if (NULL == (oh = H5AC_protect(ent->file, dxpl_id, H5AC_OHDR, ent->header, NULL, NULL, H5AC_WRITE)))
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header");
|
||||
|
||||
for (u = seq = 0; u < oh->nmesgs; u++) {
|
||||
@ -3163,7 +3163,7 @@ H5O_delete(H5F_t *f, hid_t dxpl_id, haddr_t addr)
|
||||
assert(H5F_addr_defined(addr));
|
||||
|
||||
/* Get the object header information */
|
||||
if (NULL == (oh = H5AC_protect(f, dxpl_id, H5AC_OHDR, addr, NULL, NULL)))
|
||||
if (NULL == (oh = H5AC_protect(f, dxpl_id, H5AC_OHDR, addr, NULL, NULL, H5AC_WRITE)))
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header");
|
||||
|
||||
/* Delete object */
|
||||
@ -3345,7 +3345,7 @@ H5O_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, int f
|
||||
assert(indent >= 0);
|
||||
assert(fwidth >= 0);
|
||||
|
||||
if (NULL == (oh = H5AC_protect(f, dxpl_id, H5AC_OHDR, addr, NULL, NULL)))
|
||||
if (NULL == (oh = H5AC_protect(f, dxpl_id, H5AC_OHDR, addr, NULL, NULL, H5AC_WRITE)))
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header");
|
||||
|
||||
/* debug */
|
||||
|
Loading…
Reference in New Issue
Block a user