diff options
author | Bill Wendling <wendling@ncsa.uiuc.edu> | 2003-09-10 17:05:19 (GMT) |
---|---|---|
committer | Bill Wendling <wendling@ncsa.uiuc.edu> | 2003-09-10 17:05:19 (GMT) |
commit | 6d928cf05ef860086825665cbfff18c6d1c15b3c (patch) | |
tree | 1236f11f1935fefcd8d6ec04631e5313dba3baaa /src/H5HL.c | |
parent | 14f7f3e53d97c3f31a129145e7ea7e9cd55008dc (diff) | |
download | hdf5-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/H5HL.c')
-rw-r--r-- | src/H5HL.c | 16 |
1 files changed, 13 insertions, 3 deletions
@@ -629,14 +629,19 @@ 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_find(f, dxpl_id, H5AC_LHEAP, addr, NULL, NULL))) + if (NULL == (heap = H5AC_protect(f, dxpl_id, H5AC_LHEAP, addr, NULL, NULL))) HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, NULL, "unable to load heap"); + assert(offset < heap->mem_alloc); assert(offset + size <= heap->mem_alloc); if (!buf && NULL==(buf = H5MM_malloc(size))) 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 */ @@ -691,12 +696,17 @@ 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_find(f, dxpl_id, H5AC_LHEAP, addr, NULL, NULL))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, NULL, "unable to load heap"); + if (NULL == (heap = H5AC_protect(f, dxpl_id, H5AC_LHEAP, addr, NULL, NULL))) + HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, NULL, "unable to load heap"); + assert(offset < heap->mem_alloc); /* 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: |