summaryrefslogtreecommitdiffstats
path: root/src/H5HL.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2003-09-11 16:45:54 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2003-09-11 16:45:54 (GMT)
commit987e281c8afa3ebd4113d9efba251be4074fd55f (patch)
treeee6b63635f8071e33e6159b5b114ae6303d17b71 /src/H5HL.c
parent1a8d15116a28c07aa7c4e903615712a0da0bb1fe (diff)
downloadhdf5-987e281c8afa3ebd4113d9efba251be4074fd55f.zip
hdf5-987e281c8afa3ebd4113d9efba251be4074fd55f.tar.gz
hdf5-987e281c8afa3ebd4113d9efba251be4074fd55f.tar.bz2
[svn-r7467] Purpose:
Code cleanup Description: Patch up a few places where the metadata cache could ask for a read lock instead of a write lock and other minor code cleanups. Platforms tested: FreeBSD 4.9 (sleipnir) too minor to need h5committest Misc. update:
Diffstat (limited to 'src/H5HL.c')
-rw-r--r--src/H5HL.c29
1 files changed, 9 insertions, 20 deletions
diff --git a/src/H5HL.c b/src/H5HL.c
index ea08e47..3272d2d 100644
--- a/src/H5HL.c
+++ b/src/H5HL.c
@@ -639,15 +639,13 @@ H5HL_read(H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t offset, size_t size, voi
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed");
HDmemcpy(buf, heap->chunk + H5HL_SIZEOF_HDR(f) + offset, size);
- if (H5AC_unprotect(f, dxpl_id, H5AC_LHEAP, addr, heap, FALSE) != SUCCEED)
- HGOTO_ERROR(H5E_HEAP, H5E_PROTECT, NULL, "unable to release object header");
-
- heap=NULL;
-
/* Set return value */
ret_value=buf;
done:
+ if (heap && H5AC_unprotect(f, dxpl_id, H5AC_LHEAP, addr, heap, FALSE) != SUCCEED)
+ HDONE_ERROR(H5E_HEAP, H5E_PROTECT, NULL, "unable to release object header");
+
FUNC_LEAVE_NOAPI(ret_value);
}
#endif /* NOT_YET */
@@ -704,12 +702,10 @@ H5HL_peek(H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t offset)
/* Set return value */
ret_value = heap->chunk + H5HL_SIZEOF_HDR(f) + offset;
- if (H5AC_unprotect(f, dxpl_id, H5AC_LHEAP, addr, heap, FALSE) != SUCCEED)
- HGOTO_ERROR(H5E_HEAP, H5E_PROTECT, NULL, "unable to release object header");
-
- heap=NULL;
-
done:
+ if (heap && H5AC_unprotect(f, dxpl_id, H5AC_LHEAP, addr, heap, FALSE) != SUCCEED)
+ HDONE_ERROR(H5E_HEAP, H5E_PROTECT, NULL, "unable to release object header");
+
FUNC_LEAVE_NOAPI(ret_value);
}
@@ -907,7 +903,7 @@ H5HL_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t buf_size, const void *
ret_value=offset;
done:
- if (heap && H5AC_unprotect(f, dxpl_id, H5AC_LHEAP, addr, heap, FALSE) != SUCCEED && ret_value != (size_t)(-1))
+ if (heap && H5AC_unprotect(f, dxpl_id, H5AC_LHEAP, addr, heap, FALSE) != SUCCEED)
HDONE_ERROR(H5E_HEAP, H5E_PROTECT, (size_t)(-1), "unable to release object header");
FUNC_LEAVE_NOAPI(ret_value);
@@ -1101,7 +1097,7 @@ H5HL_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t offset, size_t size)
heap->freelist = fl;
done:
- if (heap && H5AC_unprotect(f, dxpl_id, H5AC_LHEAP, addr, heap, FALSE) != SUCCEED && ret_value != FAIL)
+ if (heap && H5AC_unprotect(f, dxpl_id, H5AC_LHEAP, addr, heap, FALSE) != SUCCEED)
HDONE_ERROR(H5E_HEAP, H5E_PROTECT, FAIL, "unable to release object header");
FUNC_LEAVE_NOAPI(ret_value);
@@ -1167,15 +1163,8 @@ H5HL_delete(H5F_t *f, hid_t dxpl_id, haddr_t addr)
HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to free local heap data");
} /* end else */
- /* Release the local heap metadata from the cache */
- if (H5AC_unprotect(f, dxpl_id, H5AC_LHEAP, addr, heap, TRUE)<0) {
- heap = NULL;
- HGOTO_ERROR(H5E_HEAP, H5E_PROTECT, FAIL, "unable to release local heap");
- }
- heap = NULL;
-
done:
- if (heap && H5AC_unprotect(f, dxpl_id, H5AC_LHEAP, addr, heap, FALSE)<0 && ret_value<0)
+ if (heap && H5AC_unprotect(f, dxpl_id, H5AC_LHEAP, addr, heap, TRUE)<0)
HDONE_ERROR(H5E_HEAP, H5E_PROTECT, FAIL, "unable to release local heap");
FUNC_LEAVE_NOAPI(ret_value);