From cb772e9939a8dd4e447ad7f8e4cf2fdefb8f37db Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Wed, 5 May 2010 16:55:22 -0500 Subject: [svn-r18714] Description: Simplify parameters to 'deserialize' cache client callback. Tested on: Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode Mac OS X/32 10.6.3 (amazon) in debug mode Mac OS X/32 10.6.3 (amazon) w/C++ & FORTRAN, w/threadsafe, in production mode --- src/H5B2cache.c | 24 ++--- src/H5Bcache.c | 8 +- src/H5C.c | 11 +-- src/H5Cprivate.h | 25 ++---- src/H5FS.c | 2 + src/H5FScache.c | 22 ++--- src/H5FSdbg.c | 2 + src/H5FSpkg.h | 1 + src/H5Gnode.c | 6 +- src/H5HF.c | 36 ++------ src/H5HFcache.c | 29 +++---- src/H5HFdbg.c | 52 +++-------- src/H5HFhdr.c | 45 ++++++++++ src/H5HFiblock.c | 6 ++ src/H5HFpkg.h | 2 + src/H5HG.c | 55 ++++++++++-- src/H5HGcache.c | 9 +- src/H5HGdbg.c | 4 +- src/H5HGpkg.h | 1 + src/H5HL.c | 4 + src/H5HLcache.c | 13 ++- src/H5HLpkg.h | 1 + src/H5O.c | 2 + src/H5Ocache.c | 19 ++-- src/H5Opkg.h | 1 + src/H5SMcache.c | 14 ++- test/cache.c | 4 +- test/cache_common.c | 245 ++++++++-------------------------------------------- test/cache_common.h | 40 ++++----- testpar/t_cache.c | 13 ++- 30 files changed, 277 insertions(+), 419 deletions(-) diff --git a/src/H5B2cache.c b/src/H5B2cache.c index 21523f3..a593bce 100644 --- a/src/H5B2cache.c +++ b/src/H5B2cache.c @@ -64,22 +64,22 @@ /********************/ /* Metadata cache callbacks */ -static void *H5B2_cache_hdr_deserialize(haddr_t addr, size_t len, - const void *image, void *udata, hbool_t *dirty); +static void *H5B2_cache_hdr_deserialize(const void *image, size_t len, + void *udata, hbool_t *dirty); static herr_t H5B2_cache_hdr_serialize(const H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t len, void *image, void *thing, unsigned *flags, haddr_t *new_addr, size_t *new_len, void **new_image); static herr_t H5B2_cache_hdr_free_icr(void *thing); -static void *H5B2_cache_internal_deserialize(haddr_t addr, size_t len, - const void *image, void *udata, hbool_t *dirty); +static void *H5B2_cache_internal_deserialize(const void *image, size_t len, + void *udata, hbool_t *dirty); static herr_t H5B2_cache_internal_serialize(const H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t len, void *image, void *thing, unsigned *flags, haddr_t *new_addr, size_t *new_len, void **new_image); static herr_t H5B2_cache_internal_free_icr(void *thing); -static void *H5B2_cache_leaf_deserialize(haddr_t addr, size_t len, - const void *image, void *udata, hbool_t *dirty); +static void *H5B2_cache_leaf_deserialize(const void *image, size_t len, + void *udata, hbool_t *dirty); static herr_t H5B2_cache_leaf_serialize(const H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t len, void *image, void *thing, unsigned *flags, haddr_t *new_addr, size_t *new_len, void **new_image); @@ -149,8 +149,8 @@ const H5AC_class_t H5AC_BT2_LEAF[1] = {{ *------------------------------------------------------------------------- */ static void * -H5B2_cache_hdr_deserialize(haddr_t UNUSED addr, size_t UNUSED len, - const void *image, void *_udata, hbool_t UNUSED *dirty) +H5B2_cache_hdr_deserialize(const void *image, size_t UNUSED len, + void *_udata, hbool_t UNUSED *dirty) { H5B2_hdr_cache_ud_t *udata = (H5B2_hdr_cache_ud_t *)_udata; unsigned depth; /* Depth of B-tree */ @@ -377,8 +377,8 @@ done: *------------------------------------------------------------------------- */ static void * -H5B2_cache_internal_deserialize(haddr_t UNUSED addr, size_t UNUSED len, - const void *image, void *_udata, hbool_t UNUSED *dirty) +H5B2_cache_internal_deserialize(const void *image, size_t UNUSED len, + void *_udata, hbool_t UNUSED *dirty) { H5B2_internal_cache_ud_t *udata = (H5B2_internal_cache_ud_t *)_udata; /* Pointer to user data */ H5B2_shared_t *shared; /* Shared B-tree information */ @@ -632,8 +632,8 @@ done: *------------------------------------------------------------------------- */ static void * -H5B2_cache_leaf_deserialize(haddr_t UNUSED addr, size_t UNUSED len, - const void *image, void *_udata, hbool_t UNUSED *dirty) +H5B2_cache_leaf_deserialize(const void *image, size_t UNUSED len, + void *_udata, hbool_t UNUSED *dirty) { H5B2_leaf_cache_ud_t *udata = (H5B2_leaf_cache_ud_t *)_udata; H5B2_shared_t *shared; /* Shared B-tree information */ diff --git a/src/H5Bcache.c b/src/H5Bcache.c index cca5886..0911a7b 100644 --- a/src/H5Bcache.c +++ b/src/H5Bcache.c @@ -54,8 +54,8 @@ /********************/ /* Metadata cache callbacks */ -static void *H5B_deserialize(haddr_t addr, size_t len, const void *image, - void *udata, hbool_t *dirty); +static void *H5B_deserialize( const void *image, size_t len, void *udata, + hbool_t *dirty); static herr_t H5B_serialize(const H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t len, void *image, void *thing, unsigned *flags, haddr_t *new_addr, size_t *new_len, void **new_image); @@ -97,8 +97,8 @@ const H5AC_class_t H5AC_BT[1] = {{ *------------------------------------------------------------------------- */ static void * -H5B_deserialize(haddr_t UNUSED addr, size_t UNUSED len, const void *image, - void *_udata, hbool_t UNUSED *dirty) +H5B_deserialize(const void *image, size_t UNUSED len, void *_udata, + hbool_t UNUSED *dirty) { H5B_t *bt = NULL; /* Pointer to the deserialized B-tree node */ H5B_cache_ud_t *udata = (H5B_cache_ud_t *)_udata; /* User data for callback */ diff --git a/src/H5C.c b/src/H5C.c index 3d566ef..a9d9892 100644 --- a/src/H5C.c +++ b/src/H5C.c @@ -200,9 +200,8 @@ static herr_t H5C_verify_not_in_index(H5C_t * cache_ptr, #define H5C__EPOCH_MARKER_TYPE H5C__MAX_NUM_TYPE_IDS -static void * H5C_epoch_marker_deserialize(haddr_t addr, +static void * H5C_epoch_marker_deserialize(const void * image_ptr, size_t len, - const void * image_ptr, void * udata, hbool_t * dirty_ptr); static herr_t H5C_epoch_marker_image_len(const void * thing, @@ -241,9 +240,8 @@ const H5C_class_t epoch_marker_class = ***************************************************************************/ static void * -H5C_epoch_marker_deserialize(haddr_t UNUSED addr, +H5C_epoch_marker_deserialize(const void UNUSED * image_ptr, size_t UNUSED len, - const void UNUSED * image_ptr, void UNUSED * udata, hbool_t UNUSED * dirty_ptr) { @@ -8605,7 +8603,7 @@ H5C_load_entry(H5F_t * f, HGOTO_ERROR(H5E_CACHE, H5E_CANTLOAD, NULL, "Can't read image*") } - thing = type->deserialize(addr, len, image_ptr, udata, &dirty); + thing = type->deserialize(image_ptr, len, udata, &dirty); if ( thing == NULL ) { @@ -8645,8 +8643,7 @@ H5C_load_entry(H5F_t * f, if(H5F_block_read(f, type->mem_type, addr, new_len, dxpl_id, image_ptr) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTLOAD, NULL, "Can't read image") - thing = type->deserialize(addr, new_len, image_ptr, - udata, &dirty); + thing = type->deserialize(image_ptr, new_len, udata, &dirty); if ( thing == NULL ) { diff --git a/src/H5Cprivate.h b/src/H5Cprivate.h index 0b18814..7c7f0ac 100644 --- a/src/H5Cprivate.h +++ b/src/H5Cprivate.h @@ -118,20 +118,16 @@ typedef struct H5C_t H5C_t; * * The typedef for the deserialize callback is as follows: * - * typedef void *(*H5C_deserialize_func_t)(haddr_t addr, + * typedef void *(*H5C_deserialize_func_t)(const void * image_ptr, * size_t len, - * const void * image_ptr, * void * udata_ptr, * boolean * dirty_ptr); * * The parameters of the deserialize callback are as follows: * - * addr: Base address in file of the image to be deserialized. - * - * This parameter is supplied mainly for sanity checking. - * Sanity checks should be performed when compiled in debug - * mode, but the parameter may be unused when compiled in - * production mode. + * image_ptr: Pointer to a buffer of length len containing the + * contents of the file starting at addr and continuing + * for len bytes. * * len: Length in bytes of the in file image to be deserialized. * @@ -140,10 +136,6 @@ typedef struct H5C_t H5C_t; * mode, but the parameter may be unused when compiled in * production mode. * - * image_ptr: Pointer to a buffer of length len containing the - * contents of the file starting at addr and continuing - * for len bytes. - * * udata_ptr: Pointer to user data provided in the protect call, which * must be passed through to the deserialize callback. * @@ -379,11 +371,10 @@ typedef struct H5C_t H5C_t; * modified since the last serialize of clear callback. * ***************************************************************************/ -typedef void *(*H5C_deserialize_func_t)(haddr_t addr, - size_t len, - const void * image_ptr, - void * udata_ptr, - hbool_t * dirty_ptr); +typedef void *(*H5C_deserialize_func_t)(const void *image_ptr, + size_t len, + void * udata_ptr, + hbool_t * dirty_ptr); typedef herr_t (*H5C_image_len_func_t)(const void *thing, size_t *image_len_ptr); diff --git a/src/H5FS.c b/src/H5FS.c index 3e6796a..4ae6255 100644 --- a/src/H5FS.c +++ b/src/H5FS.c @@ -191,6 +191,7 @@ HDfprintf(stderr, "%s: Opening free space manager, nclasses = %Zu\n", FUNC, ncla fs_prot.cls_init_udata = cls_init_udata; cache_udata.fs_prot = &fs_prot; cache_udata.f = f; + cache_udata.addr = fs_addr; /* Protect the free space header */ if(NULL == (fspace = H5AC_protect(f, dxpl_id, H5AC_FSPACE_HDR, fs_addr, H5FS_HEADER_SIZE(f), &cache_udata, H5AC_READ))) @@ -264,6 +265,7 @@ HDfprintf(stderr, "%s: Deleting free space manager\n", FUNC); fs_prot.cls_init_udata = NULL; cache_udata.fs_prot = &fs_prot; cache_udata.f = f; + cache_udata.addr = fs_addr; /* Protect the free space header */ if(NULL == (fspace = H5AC_protect(f, dxpl_id, H5AC_FSPACE_HDR, fs_addr, H5FS_HEADER_SIZE(f), &cache_udata, H5AC_WRITE))) diff --git a/src/H5FScache.c b/src/H5FScache.c index 07df24b..6b790fd 100644 --- a/src/H5FScache.c +++ b/src/H5FScache.c @@ -75,15 +75,15 @@ static herr_t H5FS_sinfo_serialize_sect_cb(void *_item, void UNUSED *key, void * static herr_t H5FS_sinfo_serialize_node_cb(void *_item, void UNUSED *key, void *_udata); /* Metadata cache callbacks */ -static void *H5FS_cache_hdr_deserialize(haddr_t addr, size_t len, - const void *image, void *udata, hbool_t *dirty); +static void *H5FS_cache_hdr_deserialize(const void *image, size_t len, + void *udata, hbool_t *dirty); static herr_t H5FS_cache_hdr_serialize(const H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t len, void *image, void *thing, unsigned *flags, haddr_t *new_addr, size_t *new_len, void **new_image); static herr_t H5FS_cache_hdr_free_icr(void *thing); -static void *H5FS_cache_sinfo_deserialize(haddr_t addr, size_t len, - const void *image, void *udata, hbool_t *dirty); +static void *H5FS_cache_sinfo_deserialize(const void *image, size_t len, + void *udata, hbool_t *dirty); static herr_t H5FS_cache_sinfo_serialize(const H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t len, void *image, void *thing, unsigned *flags, haddr_t *new_addr, size_t *new_len, void **new_image); @@ -143,8 +143,8 @@ const H5AC_class_t H5AC_FSPACE_SINFO[1] = {{ *------------------------------------------------------------------------- */ static void * -H5FS_cache_hdr_deserialize(haddr_t UNUSED addr, size_t UNUSED len, - const void *image, void *_udata, hbool_t UNUSED *dirty) +H5FS_cache_hdr_deserialize(const void *image, size_t UNUSED len, + void *_udata, hbool_t UNUSED *dirty) { H5FS_t *fspace = NULL; /* Free space header info */ H5FS_hdr_cache_ud_t *udata = (H5FS_hdr_cache_ud_t *)_udata; /* user data for callback */ @@ -166,7 +166,7 @@ H5FS_cache_hdr_deserialize(haddr_t UNUSED addr, size_t UNUSED len, HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") /* Set free space manager's internal information */ - fspace->addr = addr; + fspace->addr = udata->addr; /* Compute the size of the free space header on disk */ size = H5FS_HEADER_SIZE(udata->f); @@ -399,8 +399,8 @@ done: *------------------------------------------------------------------------- */ static void * -H5FS_cache_sinfo_deserialize(haddr_t UNUSED addr, size_t UNUSED len, - const void *image, void *_udata, hbool_t UNUSED *dirty) +H5FS_cache_sinfo_deserialize(const void *image, size_t UNUSED len, + void *_udata, hbool_t UNUSED *dirty) { H5FS_sinfo_t *sinfo = NULL; /* Free space section info */ H5FS_sinfo_cache_ud_t *udata = (H5FS_sinfo_cache_ud_t *)_udata; /* user data for callback */ @@ -426,10 +426,6 @@ H5FS_cache_sinfo_deserialize(haddr_t UNUSED addr, size_t UNUSED len, HDassert(udata->fspace->sinfo == NULL); udata->fspace->sinfo = sinfo; - /* Sanity check address */ - if(H5F_addr_ne(addr, udata->fspace->sect_addr)) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTLOAD, NULL, "incorrect address for free space sections") - /* Allocate space for the buffer to serialize the sections into */ H5_ASSIGN_OVERFLOW(/* To: */ old_sect_size, /* From: */ udata->fspace->sect_size, /* From: */ hsize_t, /* To: */ size_t); diff --git a/src/H5FSdbg.c b/src/H5FSdbg.c index b9b6c14..ec5b562 100644 --- a/src/H5FSdbg.c +++ b/src/H5FSdbg.c @@ -112,6 +112,7 @@ H5FS_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, int fs_prot.cls_init_udata = NULL; cache_udata.fs_prot = &fs_prot; cache_udata.f = f; + cache_udata.addr = addr; /* * Load the free space header. @@ -254,6 +255,7 @@ H5FS_sects_debug(H5F_t *f, hid_t dxpl_id, haddr_t UNUSED addr, FILE *stream, int fs_prot.cls_init_udata = NULL; cache_udata.fs_prot = &fs_prot; cache_udata.f = f; + cache_udata.addr = fs_addr; /* * Load the free space header. diff --git a/src/H5FSpkg.h b/src/H5FSpkg.h index 4cf20de..a88958f 100644 --- a/src/H5FSpkg.h +++ b/src/H5FSpkg.h @@ -105,6 +105,7 @@ typedef struct H5FS_prot_t { typedef struct H5FS_hdr_cache_ud_t { H5F_t *f; /* File that free space header is within */ H5FS_prot_t * fs_prot; /* user data for protecting */ + haddr_t addr; /* Address of header */ } H5FS_hdr_cache_ud_t; /* Callback info for loading free space section info into the cache */ diff --git a/src/H5Gnode.c b/src/H5Gnode.c index 82a5608..84459c1 100644 --- a/src/H5Gnode.c +++ b/src/H5Gnode.c @@ -75,7 +75,7 @@ typedef struct H5G_node_t { static size_t H5G_node_size_real(const H5F_t *f); /* Metadata cache callbacks */ -static void *H5G_node_deserialize(haddr_t addr, size_t len, const void *image, +static void *H5G_node_deserialize(const void *image, size_t len, void *udata, hbool_t *dirty); static herr_t H5G_node_serialize(const H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t len, void *image, void *thing, unsigned *flags, haddr_t *new_addr, @@ -344,8 +344,8 @@ H5G_node_free(H5G_node_t *sym) *------------------------------------------------------------------------- */ static void * -H5G_node_deserialize(haddr_t UNUSED addr, size_t UNUSED len, const void *image, - void *udata, hbool_t UNUSED *dirty) +H5G_node_deserialize(const void *image, size_t UNUSED len, void *udata, + hbool_t UNUSED *dirty) { H5G_node_t *sym = NULL; /* Pointer to the deserialized symbol table node */ H5F_t *f = (H5F_t *)udata; /* Get file pointer from user data */ diff --git a/src/H5HF.c b/src/H5HF.c index b72ddd3..01d68a7 100644 --- a/src/H5HF.c +++ b/src/H5HF.c @@ -152,7 +152,6 @@ H5HF_create(H5F_t *f, hid_t dxpl_id, const H5HF_create_t *cparam) { H5HF_t *fh = NULL; /* Pointer to new fractal heap */ H5HF_hdr_t *hdr = NULL; /* The fractal heap header information */ - H5HF_hdr_cache_ud_t cache_udata; /* User-data for callback */ haddr_t fh_addr; /* Heap header address */ H5HF_t *ret_value; /* Return value */ @@ -175,13 +174,9 @@ HDfprintf(stderr, "%s: Called\n", FUNC); if(NULL == (fh = H5FL_MALLOC(H5HF_t))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fractal heap info") - /* Set up userdata for protect call */ - cache_udata.f = f; - cache_udata.dxpl_id = dxpl_id; - /* Lock the heap header into memory */ - if(NULL == (hdr = H5AC_protect(f, dxpl_id, H5AC_FHEAP_HDR, fh_addr, (size_t)H5HF_SPEC_READ_SIZE(f), &cache_udata, H5AC_WRITE))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, NULL, "unable to load fractal heap header") + if(NULL == (hdr = H5HF_hdr_protect(f, dxpl_id, fh_addr, H5AC_WRITE))) + HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, NULL, "unable to protect fractal heap header") /* Point fractal heap wrapper at header and bump it's ref count */ fh->hdr = hdr; @@ -229,7 +224,6 @@ H5HF_open(H5F_t *f, hid_t dxpl_id, haddr_t fh_addr) { H5HF_t *fh = NULL; /* Pointer to new fractal heap */ H5HF_hdr_t *hdr = NULL; /* The fractal heap header information */ - H5HF_hdr_cache_ud_t cache_udata; /* User-data for callback */ H5HF_t *ret_value; /* Return value */ FUNC_ENTER_NOAPI(H5HF_open, NULL) @@ -240,16 +234,12 @@ H5HF_open(H5F_t *f, hid_t dxpl_id, haddr_t fh_addr) HDassert(f); HDassert(H5F_addr_defined(fh_addr)); - /* Set up userdata for protect call */ - cache_udata.f = f; - cache_udata.dxpl_id = dxpl_id; - /* Load the heap header into memory */ #ifdef QAK HDfprintf(stderr, "%s: fh_addr = %a\n", FUNC, fh_addr); #endif /* QAK */ - if(NULL == (hdr = H5AC_protect(f, dxpl_id, H5AC_FHEAP_HDR, fh_addr, (size_t)H5HF_SPEC_READ_SIZE(f), &cache_udata, H5AC_READ))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, NULL, "unable to load fractal heap header") + if(NULL == (hdr = H5HF_hdr_protect(f, dxpl_id, fh_addr, H5AC_READ))) + HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, NULL, "unable to protect fractal heap header") #ifdef QAK HDfprintf(stderr, "%s: hdr->rc = %u, hdr->fspace = %p\n", FUNC, hdr->rc, hdr->fspace); #endif /* QAK */ @@ -795,7 +785,6 @@ done: herr_t H5HF_close(H5HF_t *fh, hid_t dxpl_id) { - H5HF_hdr_cache_ud_t cache_udata; /* User-data for callback */ hbool_t pending_delete = FALSE; /* Whether the heap is pending deletion */ haddr_t heap_addr = HADDR_UNDEF; /* Address of heap (for deletion) */ herr_t ret_value = SUCCEED; /* Return value */ @@ -865,13 +854,9 @@ HDfprintf(stderr, "%s; After iterator reset fh->hdr->rc = %Zu\n", FUNC, fh->hdr- if(pending_delete) { H5HF_hdr_t *hdr; /* Another pointer to fractal heap header */ - /* Set up userdata for protect call */ - cache_udata.f = fh->f; - cache_udata.dxpl_id = dxpl_id; - /* Lock the heap header into memory */ - if(NULL == (hdr = H5AC_protect(fh->f, dxpl_id, H5AC_FHEAP_HDR, heap_addr, (size_t)H5HF_SPEC_READ_SIZE(fh->f), &cache_udata, H5AC_WRITE))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load fractal heap header") + if(NULL == (hdr = H5HF_hdr_protect(fh->f, dxpl_id, heap_addr, H5AC_WRITE))) + HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect fractal heap header") /* Set the shared heap header's file context for this operation */ hdr->f = fh->f; @@ -906,7 +891,6 @@ herr_t H5HF_delete(H5F_t *f, hid_t dxpl_id, haddr_t fh_addr) { H5HF_hdr_t *hdr = NULL; /* The fractal heap header information */ - H5HF_hdr_cache_ud_t cache_udata; /* User-data for callback */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5HF_delete, FAIL) @@ -917,16 +901,12 @@ H5HF_delete(H5F_t *f, hid_t dxpl_id, haddr_t fh_addr) HDassert(f); HDassert(H5F_addr_defined(fh_addr)); - /* Set up userdata for protect call */ - cache_udata.f = f; - cache_udata.dxpl_id = dxpl_id; - /* Lock the heap header into memory */ #ifdef QAK HDfprintf(stderr, "%s: fh_addr = %a\n", FUNC, fh_addr); #endif /* QAK */ - if(NULL == (hdr = H5AC_protect(f, dxpl_id, H5AC_FHEAP_HDR, fh_addr, (size_t)H5HF_SPEC_READ_SIZE(f), &cache_udata, H5AC_WRITE))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load fractal heap header") + if(NULL == (hdr = H5HF_hdr_protect(f, dxpl_id, fh_addr, H5AC_WRITE))) + HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect fractal heap header") /* Check for files using shared heap header */ if(hdr->file_rc) diff --git a/src/H5HFcache.c b/src/H5HFcache.c index 148b717..ece70bb 100644 --- a/src/H5HFcache.c +++ b/src/H5HFcache.c @@ -77,23 +77,23 @@ static herr_t H5HF_dtable_encode(H5F_t *f, uint8_t **pp, const H5HF_dtable_t *dt static herr_t H5HF_dtable_decode(H5F_t *f, const uint8_t **pp, H5HF_dtable_t *dtable); /* Metadata cache (H5AC) callbacks */ -static void *H5HF_cache_hdr_deserialize(haddr_t addr, size_t len, - const void *image, void *udata, hbool_t *dirty); +static void *H5HF_cache_hdr_deserialize(const void *image, size_t len, + void *udata, hbool_t *dirty); static herr_t H5HF_cache_hdr_image_len(const void *thing, size_t *image_len_ptr); static herr_t H5HF_cache_hdr_serialize(const H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t len, void *image, void *thing, unsigned *flags, haddr_t *new_addr, size_t *new_len, void **new_image); static herr_t H5HF_cache_hdr_free_icr(void *thing); -static void *H5HF_cache_iblock_deserialize(haddr_t addr, size_t len, - const void *image, void *udata, hbool_t *dirty); +static void *H5HF_cache_iblock_deserialize(const void *image, size_t len, + void *udata, hbool_t *dirty); static herr_t H5HF_cache_iblock_serialize(const H5F_t * f, hid_t dxpl_id, haddr_t addr, size_t len, void *image, void *_thing, unsigned *flags, haddr_t *new_addr, size_t *new_len, void **new_image); static herr_t H5HF_cache_iblock_free_icr(void *thing); -static void *H5HF_cache_dblock_deserialize(haddr_t addr, size_t len, - const void *image, void *udata, hbool_t *dirty); +static void *H5HF_cache_dblock_deserialize(const void *image, size_t len, + void *udata, hbool_t *dirty); static herr_t H5HF_cache_dblock_serialize(const H5F_t * f, hid_t dxpl_id, haddr_t addr, size_t len, void *image, void *_thing, unsigned *flags, haddr_t *new_addr, size_t *new_len, void **new_image); @@ -267,8 +267,8 @@ H5HF_dtable_encode(H5F_t *f, uint8_t **pp, const H5HF_dtable_t *dtable) *------------------------------------------------------------------------- */ static void * -H5HF_cache_hdr_deserialize(haddr_t addr, size_t UNUSED len, - const void *image, void *_udata, hbool_t UNUSED *dirty) +H5HF_cache_hdr_deserialize(const void *image, size_t UNUSED len, + void *_udata, hbool_t UNUSED *dirty) { H5HF_hdr_t *hdr = NULL; /* Fractal heap info */ H5HF_hdr_cache_ud_t *udata = (H5HF_hdr_cache_ud_t *)_udata; @@ -288,9 +288,6 @@ H5HF_cache_hdr_deserialize(haddr_t addr, size_t UNUSED len, if(NULL == (hdr = H5HF_hdr_alloc(udata->f))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") - /* Set the heap header's address */ - hdr->heap_addr = addr; - /* Compute the 'base' size of the fractal heap header on disk */ size = H5HF_HEADER_SIZE(hdr); @@ -622,8 +619,8 @@ done: *------------------------------------------------------------------------- */ static void * -H5HF_cache_iblock_deserialize(haddr_t UNUSED addr, size_t UNUSED len, - const void *image, void *_udata, hbool_t UNUSED *dirty) +H5HF_cache_iblock_deserialize(const void *image, size_t UNUSED len, + void *_udata, hbool_t UNUSED *dirty) { H5HF_hdr_t *hdr; /* Shared fractal heap information */ H5HF_iblock_cache_ud_t *udata = (H5HF_iblock_cache_ud_t *)_udata; /* user data for callback */ @@ -659,7 +656,6 @@ H5HF_cache_iblock_deserialize(haddr_t UNUSED addr, size_t UNUSED len, /* Set block's internal information */ iblock->rc = 0; iblock->nrows = *udata->nrows; - iblock->addr = addr; iblock->nchildren = 0; /* Compute size of indirect block */ @@ -971,8 +967,8 @@ done: *------------------------------------------------------------------------- */ static void * -H5HF_cache_dblock_deserialize(haddr_t addr, size_t len, const void *image, - void *_udata, hbool_t *dirty) +H5HF_cache_dblock_deserialize(const void *image, size_t len, void *_udata, + hbool_t UNUSED *dirty) { H5HF_dblock_cache_ud_t *udata = (H5HF_dblock_cache_ud_t *)_udata; /* pointer to user data */ H5HF_hdr_t *hdr; /* Shared fractal heap information */ @@ -985,7 +981,6 @@ H5HF_cache_dblock_deserialize(haddr_t addr, size_t len, const void *image, FUNC_ENTER_NOAPI_NOINIT(H5HF_cache_dblock_deserialize) /* Check arguments */ - HDassert(H5F_addr_defined(addr)); HDassert(len > 0); HDassert(image != NULL); HDassert(udata != NULL); diff --git a/src/H5HFdbg.c b/src/H5HFdbg.c index 0893e28..e9c263d 100644 --- a/src/H5HFdbg.c +++ b/src/H5HFdbg.c @@ -188,7 +188,6 @@ herr_t H5HF_hdr_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, int fwidth) { H5HF_hdr_t *hdr = NULL; /* Fractal heap header info */ - H5HF_hdr_cache_ud_t cache_udata; /* User-data for callback */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5HF_hdr_debug, FAIL) @@ -202,15 +201,9 @@ H5HF_hdr_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, HDassert(indent >= 0); HDassert(fwidth >= 0); - /* Set up user data for protect call */ - cache_udata.f = f; - cache_udata.dxpl_id = dxpl_id; - - /* - * Load the fractal heap header. - */ - if(NULL == (hdr = H5AC_protect(f, dxpl_id, H5AC_FHEAP_HDR, addr, (size_t)H5HF_SPEC_READ_SIZE(f), &cache_udata, H5AC_READ))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load fractal heap header") + /* Load the fractal heap header */ + if(NULL == (hdr = H5HF_hdr_protect(f, dxpl_id, addr, H5AC_READ))) + HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect fractal heap header") /* Print opening message */ HDfprintf(stream, "%*sFractal Heap Header...\n", indent, ""); @@ -399,7 +392,6 @@ H5HF_dblock_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, { H5HF_hdr_t *hdr = NULL; /* Fractal heap header info */ H5HF_direct_t *dblock = NULL; /* Fractal heap direct block info */ - H5HF_hdr_cache_ud_t cache_udata; /* User-data for callback */ size_t blk_prefix_size; /* Size of prefix for block */ size_t amount_free; /* Amount of free space in block */ uint8_t *marker = NULL; /* Track free space for block */ @@ -418,15 +410,9 @@ H5HF_dblock_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, HDassert(H5F_addr_defined(hdr_addr)); HDassert(block_size > 0); - /* Set up user data for protect call */ - cache_udata.f = f; - cache_udata.dxpl_id = dxpl_id; - - /* - * Load the fractal heap header. - */ - if(NULL == (hdr = H5AC_protect(f, dxpl_id, H5AC_FHEAP_HDR, hdr_addr, (size_t)H5HF_SPEC_READ_SIZE(f), &cache_udata, H5AC_READ))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load fractal heap header") + /* Load the fractal heap header */ + if(NULL == (hdr = H5HF_hdr_protect(f, dxpl_id, hdr_addr, H5AC_READ))) + HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect fractal heap header") /* * Load the heap direct block @@ -536,7 +522,6 @@ H5HF_iblock_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, { H5HF_hdr_t *hdr = NULL; /* Fractal heap header info */ H5HF_indirect_t *iblock = NULL; /* Fractal heap direct block info */ - H5HF_hdr_cache_ud_t cache_udata; /* User-data for callback */ hbool_t did_protect; /* Whether we protected the indirect block or not */ char temp_str[64]; /* Temporary string, for formatting */ size_t u, v; /* Local index variable */ @@ -555,15 +540,9 @@ H5HF_iblock_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, HDassert(H5F_addr_defined(hdr_addr)); HDassert(nrows > 0); - /* Set up user data for protect call */ - cache_udata.f = f; - cache_udata.dxpl_id = dxpl_id; - - /* - * Load the fractal heap header. - */ - if(NULL == (hdr = H5AC_protect(f, dxpl_id, H5AC_FHEAP_HDR, hdr_addr, (size_t)H5HF_SPEC_READ_SIZE(f), &cache_udata, H5AC_READ))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load fractal heap header") + /* Load the fractal heap header */ + if(NULL == (hdr = H5HF_hdr_protect(f, dxpl_id, hdr_addr, H5AC_READ))) + HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect fractal heap header") /* * Load the heap indirect block @@ -730,7 +709,6 @@ H5HF_sects_debug(H5F_t *f, hid_t dxpl_id, haddr_t fh_addr, FILE *stream, int indent, int fwidth) { H5HF_hdr_t *hdr = NULL; /* Fractal heap header info */ - H5HF_hdr_cache_ud_t cache_udata; /* User-data for callback */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5HF_sects_debug, FAIL) @@ -744,15 +722,9 @@ H5HF_sects_debug(H5F_t *f, hid_t dxpl_id, haddr_t fh_addr, HDassert(indent >= 0); HDassert(fwidth >= 0); - /* Set up user data for protect call */ - cache_udata.f = f; - cache_udata.dxpl_id = dxpl_id; - - /* - * Load the fractal heap header. - */ - if(NULL == (hdr = H5AC_protect(f, dxpl_id, H5AC_FHEAP_HDR, fh_addr, (size_t)H5HF_SPEC_READ_SIZE(f), &cache_udata, H5AC_READ))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load fractal heap header") + /* Load the fractal heap header */ + if(NULL == (hdr = H5HF_hdr_protect(f, dxpl_id, fh_addr, H5AC_READ))) + HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect fractal heap header") /* Initialize the free space information for the heap */ if(H5HF_space_start(hdr, dxpl_id, FALSE) < 0) diff --git a/src/H5HFhdr.c b/src/H5HFhdr.c index 0929235..9c08eed 100644 --- a/src/H5HFhdr.c +++ b/src/H5HFhdr.c @@ -507,6 +507,51 @@ done: /*------------------------------------------------------------------------- + * Function: H5HF_hdr_protect + * + * Purpose: Convenience wrapper around H5AC_protect on an indirect block + * + * Return: Pointer to indirect block on success, NULL on failure + * + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * May 5 2010 + * + *------------------------------------------------------------------------- + */ +H5HF_hdr_t * +H5HF_hdr_protect(H5F_t *f, hid_t dxpl_id, haddr_t addr, H5AC_protect_t rw) +{ + H5HF_hdr_cache_ud_t cache_udata; /* User-data for callback */ + H5HF_hdr_t *hdr; /* Fractal heap header */ + H5HF_hdr_t *ret_value; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT(H5HF_hdr_protect) + + /* Check arguments */ + HDassert(f); + HDassert(H5F_addr_defined(addr)); + + /* Set up userdata for protect call */ + cache_udata.f = f; + cache_udata.dxpl_id = dxpl_id; + + /* Lock the heap header into memory */ + if(NULL == (hdr = (H5HF_hdr_t *)H5AC_protect(f, dxpl_id, H5AC_FHEAP_HDR, addr, (size_t)H5HF_SPEC_READ_SIZE(f), &cache_udata, rw))) + HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, NULL, "unable to protect fractal heap header") + + /* Set the header's address */ + hdr->heap_addr = addr; + + /* Set the return value */ + ret_value = hdr; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5HF_hdr_protect() */ + + +/*------------------------------------------------------------------------- * Function: H5HF_hdr_incr * * Purpose: Increment component reference count on shared heap header diff --git a/src/H5HFiblock.c b/src/H5HFiblock.c index a78e6de..4fe109a 100644 --- a/src/H5HFiblock.c +++ b/src/H5HFiblock.c @@ -1131,9 +1131,15 @@ H5HF_man_iblock_protect(H5HF_hdr_t *hdr, hid_t dxpl_id, haddr_t iblock_addr, /* Protect the indirect block */ if(NULL == (iblock = H5AC_protect(hdr->f, dxpl_id, H5AC_FHEAP_IBLOCK, iblock_addr, H5HF_IBLOCK_SIZE(hdr, iblock_nrows), &cache_udata, rw))) HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, NULL, "unable to protect fractal heap indirect block") + + /* Set the indirect block's address */ + iblock->addr = iblock_addr; + + /* Indicate that the indirect block was protected */ *did_protect = TRUE; } /* end if */ else + /* Indicate that the indirect block was _not_ protected */ *did_protect = FALSE; /* Set the return value */ diff --git a/src/H5HFpkg.h b/src/H5HFpkg.h index 41a8ffc..8e87e88 100644 --- a/src/H5HFpkg.h +++ b/src/H5HFpkg.h @@ -640,6 +640,8 @@ H5_DLL hsize_t H5HF_dtable_span_size(const H5HF_dtable_t *dtable, unsigned start /* Heap header routines */ H5_DLL H5HF_hdr_t * H5HF_hdr_alloc(H5F_t *f); H5_DLL haddr_t H5HF_hdr_create(H5F_t *f, hid_t dxpl_id, const H5HF_create_t *cparam); +H5_DLL H5HF_hdr_t *H5HF_hdr_protect(H5F_t *f, hid_t dxpl_id, haddr_t addr, + H5AC_protect_t rw); H5_DLL herr_t H5HF_hdr_finish_init_phase1(H5HF_hdr_t *hdr); H5_DLL herr_t H5HF_hdr_finish_init_phase2(H5HF_hdr_t *hdr); H5_DLL herr_t H5HF_hdr_finish_init(H5HF_hdr_t *hdr); diff --git a/src/H5HG.c b/src/H5HG.c index 8bf2dc5..395212d 100644 --- a/src/H5HG.c +++ b/src/H5HG.c @@ -245,6 +245,45 @@ done: /*------------------------------------------------------------------------- + * Function: H5HG_protect + * + * Purpose: Convenience wrapper around H5AC_protect on an indirect block + * + * Return: Pointer to indirect block on success, NULL on failure + * + * Programmer: Quincey Koziol + * Wednesday, May 5, 2010 + * + *------------------------------------------------------------------------- + */ +H5HG_t * +H5HG_protect(H5F_t *f, hid_t dxpl_id, haddr_t addr, H5AC_protect_t rw) +{ + H5HG_heap_t *heap; /* Global heap */ + H5HG_heap_t *ret_value; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT(H5HG_protect) + + /* Check arguments */ + HDassert(f); + HDassert(H5F_addr_defined(addr)); + + /* Lock the heap into memory */ + if(NULL == (heap = (H5HG_heap_t *)H5AC_protect(f, dxpl_id, H5AC_GHEAP, addr, (size_t)H5HG_SPEC_READ_SIZE, f, rw))) + HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, NULL, "unable to protect global heap") + + /* Set the heap's address */ + heap->addr = addr; + + /* Set the return value */ + ret_value = heap; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5HG_protect() */ + + +/*------------------------------------------------------------------------- * Function: H5HG_alloc * * Purpose: Given a heap with enough free space, this function will split @@ -590,8 +629,8 @@ H5HG_insert(H5F_t *f, hid_t dxpl_id, size_t size, void *obj, H5HG_t *hobj/*out*/ } /* end if */ } /* end else */ HDassert(H5F_addr_defined(addr)); - if(NULL == (heap = (H5HG_heap_t *)H5AC_protect(f, dxpl_id, H5AC_GHEAP, addr, (size_t)H5HG_SPEC_READ_SIZE, f, H5AC_WRITE))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load heap") + if(NULL == (heap = H5HG_protect(f, dxpl_id, addr, H5AC_WRITE))) + HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect global heap") /* Split the free space to make room for the new object */ idx = H5HG_alloc(f, heap, size, &heap_flags); @@ -652,8 +691,8 @@ H5HG_read(H5F_t *f, hid_t dxpl_id, H5HG_t *hobj, void *object/*out*/, HDassert(hobj); /* Load the heap */ - if(NULL == (heap = (H5HG_heap_t *)H5AC_protect(f, dxpl_id, H5AC_GHEAP, hobj->addr, (size_t)H5HG_SPEC_READ_SIZE, f, H5AC_READ))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, NULL, "unable to load heap") + if(NULL == (heap = H5HG_protect(f, dxpl_id, hobj->addr, H5AC_READ))) + HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, NULL, "unable to protect global heap") HDassert(hobj->idx < heap->nused); HDassert(heap->obj[hobj->idx].begin); @@ -738,8 +777,8 @@ H5HG_link (H5F_t *f, hid_t dxpl_id, const H5HG_t *hobj, int adjust) if(adjust!=0) { /* Load the heap */ - if (NULL == (heap = (H5HG_heap_t *)H5AC_protect(f, dxpl_id, H5AC_GHEAP, hobj->addr, (size_t)H5HG_SPEC_READ_SIZE, f, H5AC_WRITE))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load heap") + if(NULL == (heap = H5HG_protect(f, dxpl_id, hobj->addr, H5AC_WRITE))) + HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect global heap") assert (hobj->idxnused); assert (heap->obj[hobj->idx].begin); @@ -800,8 +839,8 @@ 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 = (H5HG_heap_t *)H5AC_protect(f, dxpl_id, H5AC_GHEAP, hobj->addr, (size_t)H5HG_SPEC_READ_SIZE, f, H5AC_WRITE))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load heap") + if(NULL == (heap = H5HG_protect(f, dxpl_id, hobj->addr, H5AC_WRITE))) + HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect global heap") HDassert(hobj->idx < heap->nused); HDassert(heap->obj[hobj->idx].begin); diff --git a/src/H5HGcache.c b/src/H5HGcache.c index 4afb108..397000b 100755 --- a/src/H5HGcache.c +++ b/src/H5HGcache.c @@ -62,8 +62,8 @@ /********************/ /* Metadata cache callbacks */ -static void *H5HG_deserialize(haddr_t addr, size_t len, const void *image, - void *udata, hbool_t *dirty); +static void *H5HG_deserialize(const void *image, size_t len, void *udata, + hbool_t *dirty); static herr_t H5HG_image_len(const void *thing, size_t *image_len_ptr); static herr_t H5HG_serialize(const H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t len, void *image, void *thing, unsigned *flags, haddr_t *new_addr, @@ -114,8 +114,8 @@ const H5AC_class_t H5AC_GHEAP[1] = {{ *------------------------------------------------------------------------- */ static void * -H5HG_deserialize(haddr_t addr, size_t UNUSED len, const void *image, - void *_udata, hbool_t UNUSED *dirty) +H5HG_deserialize(const void *image, size_t UNUSED len, void *_udata, + hbool_t UNUSED *dirty) { H5HG_heap_t *heap = NULL; H5F_t *f = (H5F_t *)_udata; @@ -132,7 +132,6 @@ H5HG_deserialize(haddr_t addr, size_t UNUSED len, const void *image, /* Allocate space for heap */ if(NULL == (heap = H5FL_CALLOC(H5HG_heap_t))) HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "memory allocation failed") - heap->addr = addr; heap->shared = f->shared; p = image; diff --git a/src/H5HGdbg.c b/src/H5HGdbg.c index 21d7647..d9767c6 100644 --- a/src/H5HGdbg.c +++ b/src/H5HGdbg.c @@ -73,8 +73,8 @@ H5HG_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, HDassert(indent >= 0); HDassert(fwidth >= 0); - if(NULL == (h = (H5HG_heap_t *)H5AC_protect(f, dxpl_id, H5AC_GHEAP, addr, (size_t)H5HG_SPEC_READ_SIZE, f, H5AC_READ))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load global heap collection"); + if(NULL == (h = H5HG_protect(f, dxpl_id, addr, H5AC_READ))) + HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect global heap collection"); fprintf(stream, "%*sGlobal Heap Collection...\n", indent, ""); fprintf(stream, "%*s%-*s %d\n", indent, "", fwidth, diff --git a/src/H5HGpkg.h b/src/H5HGpkg.h index a7fac72..5229fa9 100644 --- a/src/H5HGpkg.h +++ b/src/H5HGpkg.h @@ -151,6 +151,7 @@ struct H5HG_heap_t { /* Package Private Prototypes */ /******************************/ H5_DLL herr_t H5HG_free(H5HG_heap_t *heap); +H5_DLL H5HG_t *H5HG_protect(H5F_t *f, hid_t dxpl_id, haddr_t addr, H5AC_protect_t rw); #endif /* _H5HGpkg_H */ diff --git a/src/H5HL.c b/src/H5HL.c index 13b3b0e..951023d 100644 --- a/src/H5HL.c +++ b/src/H5HL.c @@ -457,6 +457,7 @@ H5HL_protect(H5F_t *f, hid_t dxpl_id, haddr_t addr, H5AC_protect_t rw) prfx_udata.made_attempt = FALSE; prfx_udata.sizeof_size = H5F_SIZEOF_SIZE(f); prfx_udata.sizeof_addr = H5F_SIZEOF_ADDR(f); + prfx_udata.prfx_addr = addr; prfx_udata.sizeof_prfx = H5HL_SIZEOF_HDR(f); prfx_udata.loaded = FALSE; prfx_udata.free_block = H5HL_FREE_NULL; @@ -1078,6 +1079,7 @@ H5HL_delete(H5F_t *f, hid_t dxpl_id, haddr_t addr) prfx_udata.made_attempt = FALSE; prfx_udata.sizeof_size = H5F_SIZEOF_SIZE(f); prfx_udata.sizeof_addr = H5F_SIZEOF_ADDR(f); + prfx_udata.prfx_addr = addr; prfx_udata.sizeof_prfx = H5HL_SIZEOF_HDR(f); prfx_udata.loaded = FALSE; prfx_udata.free_block = H5HL_FREE_NULL; @@ -1177,6 +1179,7 @@ H5HL_get_size(H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t *size) prfx_udata.made_attempt = FALSE; prfx_udata.sizeof_size = H5F_SIZEOF_SIZE(f); prfx_udata.sizeof_addr = H5F_SIZEOF_ADDR(f); + prfx_udata.prfx_addr = addr; prfx_udata.sizeof_prfx = H5HL_SIZEOF_HDR(f); prfx_udata.loaded = FALSE; prfx_udata.free_block = H5HL_FREE_NULL; @@ -1231,6 +1234,7 @@ H5HL_heapsize(H5F_t *f, hid_t dxpl_id, haddr_t addr, hsize_t *heap_size) prfx_udata.made_attempt = FALSE; prfx_udata.sizeof_size = H5F_SIZEOF_SIZE(f); prfx_udata.sizeof_addr = H5F_SIZEOF_ADDR(f); + prfx_udata.prfx_addr = addr; prfx_udata.sizeof_prfx = H5HL_SIZEOF_HDR(f); prfx_udata.loaded = FALSE; prfx_udata.free_block = H5HL_FREE_NULL; diff --git a/src/H5HLcache.c b/src/H5HLcache.c index 77e9bc3..39d9789 100644 --- a/src/H5HLcache.c +++ b/src/H5HLcache.c @@ -65,7 +65,7 @@ /********************/ /* Metadata cache callbacks */ -static void *H5HL_prfx_deserialize(haddr_t addr, size_t len, const void *image, +static void *H5HL_prfx_deserialize(const void *image, size_t len, void *udata, hbool_t *dirty); static herr_t H5HL_prfx_image_len(const void *thing, size_t *image_len_ptr); static herr_t H5HL_prfx_serialize(const H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t len, @@ -73,7 +73,7 @@ static herr_t H5HL_prfx_serialize(const H5F_t *f, hid_t dxpl_id, haddr_t addr, s size_t *new_len, void **new_image); static herr_t H5HL_prfx_free_icr(void *thing); -static void *H5HL_dblk_deserialize(haddr_t addr, size_t len, const void *image, +static void *H5HL_dblk_deserialize(const void *image, size_t len, void *udata, hbool_t *dirty); static herr_t H5HL_dblk_serialize(const H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t len, void *image, void *thing, unsigned *flags, haddr_t *new_addr, @@ -244,8 +244,8 @@ H5HL_fl_serialize(const H5HL_t *heap) *------------------------------------------------------------------------- */ static void * -H5HL_prfx_deserialize(haddr_t addr, size_t len, const void *image, - void *_udata, hbool_t UNUSED *dirty) +H5HL_prfx_deserialize(const void *image, size_t len, void *_udata, + hbool_t UNUSED *dirty) { H5HL_t *heap = NULL; /* Local heap */ H5HL_prfx_t *prfx = NULL; /* Heap prefix deserialized */ @@ -256,7 +256,6 @@ H5HL_prfx_deserialize(haddr_t addr, size_t len, const void *image, FUNC_ENTER_NOAPI_NOINIT(H5HL_prfx_deserialize) /* check arguments */ - HDassert(H5F_addr_defined(addr)); HDassert(len > 0); HDassert(image); HDassert(udata); @@ -288,7 +287,7 @@ H5HL_prfx_deserialize(haddr_t addr, size_t len, const void *image, HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "memory allocation failed") /* Store the prefix's address & length */ - heap->prfx_addr = addr; + heap->prfx_addr = udata->prfx_addr; heap->prfx_size = udata->sizeof_prfx; /* Heap data size */ @@ -506,7 +505,7 @@ done: *------------------------------------------------------------------------- */ static void * -H5HL_dblk_deserialize(haddr_t UNUSED addr, size_t UNUSED len, const void *image, +H5HL_dblk_deserialize(const void *image, size_t UNUSED len, void *_udata, hbool_t UNUSED *dirty) { H5HL_dblk_t *dblk = NULL; /* Local heap data block deserialized */ diff --git a/src/H5HLpkg.h b/src/H5HLpkg.h index 5faa022..26b9621 100644 --- a/src/H5HLpkg.h +++ b/src/H5HLpkg.h @@ -124,6 +124,7 @@ typedef struct H5HL_cache_prfx_ud_t { hbool_t made_attempt; /* Whether the deserialize routine was already attempted */ size_t sizeof_size; /* Size of file sizes */ size_t sizeof_addr; /* Size of file addresses */ + haddr_t prfx_addr; /* Address of prefix */ size_t sizeof_prfx; /* Size of heap prefix */ /* Upwards */ diff --git a/src/H5O.c b/src/H5O.c index 060ed43..8925866 100644 --- a/src/H5O.c +++ b/src/H5O.c @@ -1583,6 +1583,7 @@ H5O_protect(const H5O_loc_t *loc, hid_t dxpl_id, H5AC_protect_t prot) udata.common.mesgs_modified = FALSE; HDmemset(&cont_msg_info, 0, sizeof(cont_msg_info)); udata.common.cont_msg_info = &cont_msg_info; + udata.common.addr = loc->addr; /* Lock the object header into the cache */ if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, (size_t)H5O_SPEC_READ_SIZE, &udata, prot))) @@ -1619,6 +1620,7 @@ H5O_protect(const H5O_loc_t *loc, hid_t dxpl_id, H5AC_protect_t prot) /* Bring the chunk into the cache */ /* (which adds to the object header */ + chk_udata.common.addr = cont_msg_info.msgs[curr_msg].addr; if(NULL == (chk_proxy = (H5O_chunk_proxy_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR_CHK, cont_msg_info.msgs[curr_msg].addr, cont_msg_info.msgs[curr_msg].size, &chk_udata, prot))) HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, NULL, "unable to load object header chunk") diff --git a/src/H5Ocache.c b/src/H5Ocache.c index 6dad585..7622898 100644 --- a/src/H5Ocache.c +++ b/src/H5Ocache.c @@ -60,7 +60,7 @@ /********************/ /* Metadata cache callbacks */ -static void *H5O_cache_deserialize(haddr_t addr, size_t len, const void *image, +static void *H5O_cache_deserialize(const void *image, size_t len, void *udata, hbool_t *dirty); static herr_t H5O_cache_image_len(const void *thing, size_t *image_len_ptr); static herr_t H5O_cache_serialize(const H5F_t *f, hid_t dxpl_id, haddr_t addr, @@ -68,7 +68,7 @@ static herr_t H5O_cache_serialize(const H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t *new_len, void **new_image); static herr_t H5O_cache_free_icr(void *thing); -static void *H5O_cache_chk_deserialize(haddr_t addr, size_t len, const void *image, +static void *H5O_cache_chk_deserialize(const void *image, size_t len, void *udata, hbool_t *dirty); static herr_t H5O_cache_chk_serialize(const H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t len, void *image, void *thing, unsigned *flags, @@ -151,8 +151,8 @@ H5FL_SEQ_DEFINE(H5O_cont_t); *------------------------------------------------------------------------- */ static void * -H5O_cache_deserialize(haddr_t addr, size_t len, const void *image, - void *_udata, hbool_t *dirty) +H5O_cache_deserialize(const void *image, size_t len, void *_udata, + hbool_t *dirty) { H5O_t *oh = NULL; /* Object header info */ H5O_cache_ud_t *udata = (H5O_cache_ud_t *)_udata; /* User data for callback */ @@ -163,7 +163,6 @@ H5O_cache_deserialize(haddr_t addr, size_t len, const void *image, FUNC_ENTER_NOAPI_NOINIT(H5O_cache_deserialize) /* Check arguments */ - HDassert(H5F_addr_defined(addr)); HDassert(len > 0); HDassert(image); HDassert(udata); @@ -298,7 +297,7 @@ H5O_cache_deserialize(haddr_t addr, size_t len, const void *image, */ if(len >= (oh->chunk0_size + H5O_SIZEOF_HDR(oh))) { /* Parse the first chunk */ - if(H5O_chunk_deserialize(oh, addr, oh->chunk0_size, image, &(udata->common), dirty) < 0) + if(H5O_chunk_deserialize(oh, udata->common.addr, oh->chunk0_size, image, &(udata->common), dirty) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "can't deserialize first object header chunk") } /* end if */ else @@ -536,8 +535,8 @@ done: *------------------------------------------------------------------------- */ static void * -H5O_cache_chk_deserialize(haddr_t addr, size_t len, const void *image, - void *_udata, hbool_t *dirty) +H5O_cache_chk_deserialize(const void *image, size_t len, void *_udata, + hbool_t *dirty) { H5O_chunk_proxy_t *chk_proxy = NULL; /* Chunk proxy object */ H5O_chk_cache_ud_t *udata = (H5O_chk_cache_ud_t *)_udata; /* User data for callback */ @@ -546,7 +545,6 @@ H5O_cache_chk_deserialize(haddr_t addr, size_t len, const void *image, FUNC_ENTER_NOAPI_NOINIT(H5O_cache_chk_deserialize) /* Check arguments */ - HDassert(H5F_addr_defined(addr)); HDassert(len > 0); HDassert(image); HDassert(udata); @@ -564,7 +562,7 @@ H5O_cache_chk_deserialize(haddr_t addr, size_t len, const void *image, HDassert(udata->common.cont_msg_info); /* Parse the chunk */ - if(H5O_chunk_deserialize(udata->oh, addr, len, image, &(udata->common), dirty) < 0) + if(H5O_chunk_deserialize(udata->oh, udata->common.addr, len, image, &(udata->common), dirty) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "can't deserialize object header chunk") /* Set the fields for the chunk proxy */ @@ -760,6 +758,7 @@ H5O_chunk_deserialize(H5O_t *oh, haddr_t addr, size_t len, const uint8_t *image, /* Check arguments */ HDassert(oh); + HDassert(H5F_addr_defined(addr)); HDassert(image); HDassert(udata->f); HDassert(udata->cont_msg_info); diff --git a/src/H5Opkg.h b/src/H5Opkg.h index 13e46e8..70eeec8 100644 --- a/src/H5Opkg.h +++ b/src/H5Opkg.h @@ -337,6 +337,7 @@ typedef struct H5O_common_cache_ud_t { unsigned merged_null_msgs; /* Number of null messages merged together */ hbool_t mesgs_modified; /* Whether any messages were modified when the object header was deserialized */ H5O_cont_msgs_t *cont_msg_info; /* Pointer to continuation messages to work on */ + haddr_t addr; /* Address of the prefix or chunk */ } H5O_common_cache_ud_t; /* Callback information for loading object header prefix from disk */ diff --git a/src/H5SMcache.c b/src/H5SMcache.c index e82e353..6d45969 100644 --- a/src/H5SMcache.c +++ b/src/H5SMcache.c @@ -54,14 +54,14 @@ /* Metadata cache (H5AC) callbacks */ -static void *H5SM_table_deserialize(haddr_t addr, size_t len, const void *image, +static void *H5SM_table_deserialize(const void *image, size_t len, void *udata, hbool_t *dirty); static herr_t H5SM_table_serialize(const H5F_t * f, hid_t dxpl_id, haddr_t addr, size_t len, void *image, void *thing, unsigned *flags, haddr_t *new_addr, size_t *new_len, void **new_image); static herr_t H5SM_table_free_icr(void *thing); -static void *H5SM_list_deserialize(haddr_t addr, size_t len, const void *image, +static void *H5SM_list_deserialize(const void *image, size_t len, void *udata, hbool_t *dirty); static herr_t H5SM_list_serialize(const H5F_t * f, hid_t dxpl_id, haddr_t addr, size_t len, void *image, void *thing, unsigned *flags, haddr_t *new_addr, @@ -119,8 +119,8 @@ const H5AC_class_t H5AC_SOHM_LIST[1] = {{ *------------------------------------------------------------------------- */ static void * -H5SM_table_deserialize(haddr_t UNUSED addr, size_t UNUSED len, - const void *image, void *_udata, hbool_t UNUSED *dirty) +H5SM_table_deserialize(const void *image, size_t UNUSED len, void *_udata, + hbool_t UNUSED *dirty) { H5SM_master_table_t *table = NULL; H5F_t *f = (H5F_t *)_udata; /* File pointer */ @@ -145,8 +145,6 @@ H5SM_table_deserialize(haddr_t UNUSED addr, size_t UNUSED len, /* Read number of indexes and version from file superblock */ table->num_indexes = f->shared->sohm_nindexes; - HDassert(addr == f->shared->sohm_addr); - HDassert(addr != HADDR_UNDEF); HDassert(table->num_indexes > 0); /* Get temporary pointer to serialized table */ @@ -360,8 +358,8 @@ done: *------------------------------------------------------------------------- */ static void * -H5SM_list_deserialize(haddr_t UNUSED addr, size_t UNUSED len, const void *image, - void *_udata, hbool_t UNUSED *dirty) +H5SM_list_deserialize(const void *image, size_t UNUSED len, void *_udata, + hbool_t UNUSED *dirty) { H5SM_list_t *list; /* The SOHM list being read in */ H5SM_list_cache_ud_t *udata = (H5SM_list_cache_ud_t *)_udata; /* User data for callback */ diff --git a/test/cache.c b/test/cache.c index 1743021..298a56d 100644 --- a/test/cache.c +++ b/test/cache.c @@ -17376,7 +17376,7 @@ check_double_protect_err(void) cache_entry_ptr = H5C_protect(file_ptr, H5P_DATASET_XFER_DEFAULT, &(types[0]), entry_ptr->addr, - entry_ptr->size, NULL, + entry_ptr->size, &entry_ptr->addr, H5C__NO_FLAGS_SET); if ( cache_entry_ptr != NULL ) { @@ -18094,7 +18094,7 @@ check_protect_ro_rw_err(void) thing_ptr = H5C_protect(file_ptr, H5P_DATASET_XFER_DEFAULT, &(types[0]), entry_ptr->addr, - entry_ptr->size, NULL, H5C__NO_FLAGS_SET); + entry_ptr->size, &entry_ptr->addr, H5C__NO_FLAGS_SET); if ( thing_ptr != NULL ) { diff --git a/test/cache_common.c b/test/cache_common.c index 39fce27..240bbb92 100644 --- a/test/cache_common.c +++ b/test/cache_common.c @@ -179,7 +179,6 @@ const H5C_class_t types[NUMBER_OF_ENTRY_TYPES] = (H5C_image_len_func_t)pico_image_len, (H5C_serialize_func_t)pico_serialize, (H5C_free_icr_func_t)pico_free_icr, - (H5C_clear_dirty_bits_func_t)pico_clear_dirty_bits }, { NANO_ENTRY_TYPE, @@ -189,7 +188,6 @@ const H5C_class_t types[NUMBER_OF_ENTRY_TYPES] = (H5C_image_len_func_t)nano_image_len, (H5C_serialize_func_t)nano_serialize, (H5C_free_icr_func_t)nano_free_icr, - (H5C_clear_dirty_bits_func_t)nano_clear_dirty_bits }, { MICRO_ENTRY_TYPE, @@ -199,7 +197,6 @@ const H5C_class_t types[NUMBER_OF_ENTRY_TYPES] = (H5C_image_len_func_t)micro_image_len, (H5C_serialize_func_t)micro_serialize, (H5C_free_icr_func_t)micro_free_icr, - (H5C_clear_dirty_bits_func_t)micro_clear_dirty_bits }, { TINY_ENTRY_TYPE, @@ -209,7 +206,6 @@ const H5C_class_t types[NUMBER_OF_ENTRY_TYPES] = (H5C_image_len_func_t)tiny_image_len, (H5C_serialize_func_t)tiny_serialize, (H5C_free_icr_func_t)tiny_free_icr, - (H5C_clear_dirty_bits_func_t)tiny_clear_dirty_bits }, { SMALL_ENTRY_TYPE, @@ -219,7 +215,6 @@ const H5C_class_t types[NUMBER_OF_ENTRY_TYPES] = (H5C_image_len_func_t)small_image_len, (H5C_serialize_func_t)small_serialize, (H5C_free_icr_func_t)small_free_icr, - (H5C_clear_dirty_bits_func_t)small_clear_dirty_bits }, { MEDIUM_ENTRY_TYPE, @@ -229,7 +224,6 @@ const H5C_class_t types[NUMBER_OF_ENTRY_TYPES] = (H5C_image_len_func_t)medium_image_len, (H5C_serialize_func_t)medium_serialize, (H5C_free_icr_func_t)medium_free_icr, - (H5C_clear_dirty_bits_func_t)medium_clear_dirty_bits }, { LARGE_ENTRY_TYPE, @@ -239,7 +233,6 @@ const H5C_class_t types[NUMBER_OF_ENTRY_TYPES] = (H5C_image_len_func_t)large_image_len, (H5C_serialize_func_t)large_serialize, (H5C_free_icr_func_t)large_free_icr, - (H5C_clear_dirty_bits_func_t)large_clear_dirty_bits }, { HUGE_ENTRY_TYPE, @@ -249,7 +242,6 @@ const H5C_class_t types[NUMBER_OF_ENTRY_TYPES] = (H5C_image_len_func_t)huge_image_len, (H5C_serialize_func_t)huge_serialize, (H5C_free_icr_func_t)huge_free_icr, - (H5C_clear_dirty_bits_func_t)huge_clear_dirty_bits }, { MONSTER_ENTRY_TYPE, @@ -259,7 +251,6 @@ const H5C_class_t types[NUMBER_OF_ENTRY_TYPES] = (H5C_image_len_func_t)monster_image_len, (H5C_serialize_func_t)monster_serialize, (H5C_free_icr_func_t)monster_free_icr, - (H5C_clear_dirty_bits_func_t)monster_clear_dirty_bits }, { VARIABLE_ENTRY_TYPE, @@ -269,13 +260,12 @@ const H5C_class_t types[NUMBER_OF_ENTRY_TYPES] = (H5C_image_len_func_t)variable_image_len, (H5C_serialize_func_t)variable_serialize, (H5C_free_icr_func_t)variable_free_icr, - (H5C_clear_dirty_bits_func_t)variable_clear_dirty_bits } }; -static void * deserialize(haddr_t addr, +static void * deserialize(const void * image_ptr, size_t len, - const void * image_ptr, + void * udata_ptr, hbool_t * dirty_ptr); static herr_t image_len(void *thing, @@ -292,8 +282,6 @@ static herr_t serialize(haddr_t addr, static herr_t free_icr(test_entry_t *entry_ptr); -static herr_t clear_dirty_bits(test_entry_t *entry_ptr); - /* address translation funtions: */ @@ -425,8 +413,9 @@ check_write_permitted(const H5F_t UNUSED * f, */ static void * -deserialize(haddr_t addr, size_t len, const void * image_ptr, hbool_t * dirty_ptr) +deserialize(const void * image_ptr, size_t len, void *udata, hbool_t * dirty_ptr) { + haddr_t addr = *(haddr_t *)udata; int32_t type; int32_t idx; test_entry_t * entry_ptr; @@ -514,73 +503,73 @@ deserialize(haddr_t addr, size_t len, const void * image_ptr, hbool_t * dirty_pt } /* deserialize() */ void * -pico_deserialize(haddr_t addr, size_t len, const void * image_ptr, - const UNUSED void * udata_ptr, hbool_t * dirty_ptr) +pico_deserialize(const void * image_ptr, size_t len, void * udata_ptr, + hbool_t * dirty_ptr) { - return deserialize(addr, len, image_ptr, dirty_ptr); + return deserialize(image_ptr, len, udata_ptr, dirty_ptr); } void * -nano_deserialize(haddr_t addr, size_t len, const void * image_ptr, - const UNUSED void * udata_ptr, hbool_t * dirty_ptr) +nano_deserialize(const void * image_ptr, size_t len, void * udata_ptr, + hbool_t * dirty_ptr) { - return deserialize(addr, len, image_ptr, dirty_ptr); + return deserialize(image_ptr, len, udata_ptr, dirty_ptr); } void * -micro_deserialize(haddr_t addr, size_t len, const void * image_ptr, - const UNUSED void * udata_ptr, hbool_t * dirty_ptr) +micro_deserialize(const void * image_ptr, size_t len, void * udata_ptr, + hbool_t * dirty_ptr) { - return deserialize(addr, len, image_ptr, dirty_ptr); + return deserialize(image_ptr, len, udata_ptr, dirty_ptr); } void * -tiny_deserialize(haddr_t addr, size_t len, const void * image_ptr, - const UNUSED void * udata_ptr, hbool_t * dirty_ptr) +tiny_deserialize(const void * image_ptr, size_t len, void * udata_ptr, + hbool_t * dirty_ptr) { - return deserialize(addr, len, image_ptr, dirty_ptr); + return deserialize(image_ptr, len, udata_ptr, dirty_ptr); } void * -small_deserialize(haddr_t addr, size_t len, const void * image_ptr, - const UNUSED void * udata_ptr, hbool_t * dirty_ptr) +small_deserialize(const void * image_ptr, size_t len, void * udata_ptr, + hbool_t * dirty_ptr) { - return deserialize(addr, len, image_ptr, dirty_ptr); + return deserialize(image_ptr, len, udata_ptr, dirty_ptr); } void * -medium_deserialize(haddr_t addr, size_t len, const void * image_ptr, - const UNUSED void * udata_ptr, hbool_t * dirty_ptr) +medium_deserialize(const void * image_ptr, size_t len, void * udata_ptr, + hbool_t * dirty_ptr) { - return deserialize(addr, len, image_ptr, dirty_ptr); + return deserialize(image_ptr, len, udata_ptr, dirty_ptr); } void * -large_deserialize(haddr_t addr, size_t len, const void * image_ptr, - const UNUSED void * udata_ptr, hbool_t * dirty_ptr) +large_deserialize(const void * image_ptr, size_t len, void * udata_ptr, + hbool_t * dirty_ptr) { - return deserialize(addr, len, image_ptr, dirty_ptr); + return deserialize(image_ptr, len, udata_ptr, dirty_ptr); } void * -huge_deserialize(haddr_t addr, size_t len, const void * image_ptr, - const UNUSED void * udata_ptr, hbool_t * dirty_ptr) +huge_deserialize(const void * image_ptr, size_t len, void * udata_ptr, + hbool_t * dirty_ptr) { - return deserialize(addr, len, image_ptr, dirty_ptr); + return deserialize(image_ptr, len, udata_ptr, dirty_ptr); } void * -monster_deserialize(haddr_t addr, size_t len, const void * image_ptr, - const UNUSED void * udata_ptr, hbool_t * dirty_ptr) +monster_deserialize(const void * image_ptr, size_t len, void * udata_ptr, + hbool_t * dirty_ptr) { - return deserialize(addr, len, image_ptr, dirty_ptr); + return deserialize(image_ptr, len, udata_ptr, dirty_ptr); } void * -variable_deserialize(haddr_t addr, size_t len, const void * image_ptr, - const UNUSED void * udata_ptr, hbool_t * dirty_ptr) +variable_deserialize(const void * image_ptr, size_t len, void * udata_ptr, + hbool_t * dirty_ptr) { - return deserialize(addr, len, image_ptr, dirty_ptr); + return deserialize(image_ptr, len, udata_ptr, dirty_ptr); } @@ -1192,168 +1181,6 @@ variable_free_icr(void * thing) } -/*------------------------------------------------------------------------- - * Function: clear_dirty_bits & friends - * - * Purpose: Clear the dirty bits. The helper functions verify that the - * correct version of clear_dirty_gits is being called, and - * then call clear_dirty_bits() proper. - * - * Return: SUCCEED - * - * Programmer: John Mainzer - * 9/20/07 - * - *------------------------------------------------------------------------- - */ - -herr_t -clear_dirty_bits(test_entry_t * entry_ptr) -{ - test_entry_t * base_addr; - - HDassert( entry_ptr ); - - base_addr = entries[entry_ptr->type]; - - HDassert( entry_ptr->index >= 0 ); - HDassert( entry_ptr->index <= max_indices[entry_ptr->type] ); - HDassert( entry_ptr == &(base_addr[entry_ptr->index]) ); - HDassert( entry_ptr == entry_ptr->self ); - HDassert( entry_ptr->header.addr == entry_ptr->addr ); - HDassert( entry_ptr->header.size == entry_ptr->size ); - HDassert( ( entry_ptr->type == VARIABLE_ENTRY_TYPE ) || - ( entry_ptr->size == entry_sizes[entry_ptr->type] ) ); - - entry_ptr->is_dirty = FALSE; - - entry_ptr->cleared = TRUE; - - return(SUCCEED); - -} /* clear_dirty_bits() */ - -herr_t -pico_clear_dirty_bits(haddr_t addr, size_t len, void * thing) -{ - test_entry_t * entry_ptr = (test_entry_t *)thing; - - HDassert( entry_ptr->addr == addr ); - HDassert( entry_ptr->size == len ); - HDassert( entry_ptr->type == PICO_ENTRY_TYPE ); - - return(clear_dirty_bits(entry_ptr)); -} - -herr_t -nano_clear_dirty_bits(haddr_t addr, size_t len, void * thing) -{ - test_entry_t * entry_ptr = (test_entry_t *)thing; - - HDassert( entry_ptr->addr == addr ); - HDassert( entry_ptr->size == len ); - HDassert( entry_ptr->type == NANO_ENTRY_TYPE ); - - return(clear_dirty_bits(entry_ptr)); -} - -herr_t -micro_clear_dirty_bits(haddr_t addr, size_t len, void * thing) -{ - test_entry_t * entry_ptr = (test_entry_t *)thing; - - HDassert( entry_ptr->addr == addr ); - HDassert( entry_ptr->size == len ); - HDassert( entry_ptr->type == MICRO_ENTRY_TYPE ); - - return(clear_dirty_bits(entry_ptr)); -} - -herr_t -tiny_clear_dirty_bits(haddr_t addr, size_t len, void * thing) -{ - test_entry_t * entry_ptr = (test_entry_t *)thing; - - HDassert( entry_ptr->addr == addr ); - HDassert( entry_ptr->size == len ); - HDassert( entry_ptr->type == TINY_ENTRY_TYPE ); - - return(clear_dirty_bits(entry_ptr)); -} - -herr_t -small_clear_dirty_bits(haddr_t addr, size_t len, void * thing) -{ - test_entry_t * entry_ptr = (test_entry_t *)thing; - - HDassert( entry_ptr->addr == addr ); - HDassert( entry_ptr->size == len ); - HDassert( entry_ptr->type == SMALL_ENTRY_TYPE ); - - return(clear_dirty_bits(entry_ptr)); -} - -herr_t -medium_clear_dirty_bits(haddr_t addr, size_t len, void * thing) -{ - test_entry_t * entry_ptr = (test_entry_t *)thing; - - HDassert( entry_ptr->addr == addr ); - HDassert( entry_ptr->size == len ); - HDassert( entry_ptr->type == MEDIUM_ENTRY_TYPE ); - - return(clear_dirty_bits(entry_ptr)); -} - -herr_t -large_clear_dirty_bits(haddr_t addr, size_t len, void * thing) -{ - test_entry_t * entry_ptr = (test_entry_t *)thing; - - HDassert( entry_ptr->addr == addr ); - HDassert( entry_ptr->size == len ); - HDassert( entry_ptr->type == LARGE_ENTRY_TYPE ); - - return(clear_dirty_bits(entry_ptr)); -} - -herr_t -huge_clear_dirty_bits(haddr_t addr, size_t len, void * thing) -{ - test_entry_t * entry_ptr = (test_entry_t *)thing; - - HDassert( entry_ptr->addr == addr ); - HDassert( entry_ptr->size == len ); - HDassert( entry_ptr->type == HUGE_ENTRY_TYPE ); - - return(clear_dirty_bits(entry_ptr)); -} - -herr_t -monster_clear_dirty_bits(haddr_t addr, size_t len, void * thing) -{ - test_entry_t * entry_ptr = (test_entry_t *)thing; - - HDassert( entry_ptr->addr == addr ); - HDassert( entry_ptr->size == len ); - HDassert( entry_ptr->type == MONSTER_ENTRY_TYPE ); - - return(clear_dirty_bits(entry_ptr)); -} - -herr_t -variable_clear_dirty_bits(haddr_t addr, size_t len, void * thing) -{ - test_entry_t * entry_ptr = (test_entry_t *)thing; - - HDassert( entry_ptr->addr == addr ); - HDassert( entry_ptr->size == len ); - HDassert( entry_ptr->type == VARIABLE_ENTRY_TYPE ); - - return(clear_dirty_bits(entry_ptr)); -} - - /**************************************************************************/ /**************************************************************************/ /************************** test utility functions: ***********************/ @@ -3560,7 +3387,7 @@ protect_entry(H5F_t * file_ptr, cache_entry_ptr = H5C_protect(file_ptr, H5P_DATASET_XFER_DEFAULT, &(types[type]), entry_ptr->addr, - entry_ptr->size, NULL, + entry_ptr->size, &entry_ptr->addr, H5C__NO_FLAGS_SET); if ( verbose ) { @@ -3670,7 +3497,7 @@ protect_entry_ro(H5F_t * file_ptr, cache_entry_ptr = H5C_protect(file_ptr, H5P_DATASET_XFER_DEFAULT, &(types[type]), entry_ptr->addr, - entry_ptr->size, NULL, + entry_ptr->size, &entry_ptr->addr, H5C__READ_ONLY_FLAG); if ( ( cache_entry_ptr != (void *)entry_ptr ) || diff --git a/test/cache_common.h b/test/cache_common.h index 6fe8ae4..f98323a 100644 --- a/test/cache_common.h +++ b/test/cache_common.h @@ -635,26 +635,26 @@ herr_t monster_clear_dirty_bits(haddr_t addr, size_t len, void * thing); herr_t variable_clear_dirty_bits(haddr_t addr, size_t len, void * thing); -void * pico_deserialize(haddr_t addr, size_t len, const void * image_ptr, - const void * udata_ptr, hbool_t * dirty_ptr); -void * nano_deserialize(haddr_t addr, size_t len, const void * image_ptr, - const void * udata_ptr, hbool_t * dirty_ptr); -void * micro_deserialize(haddr_t addr, size_t len, const void * image_ptr, - const void * udata_ptr, hbool_t * dirty_ptr); -void * tiny_deserialize(haddr_t addr, size_t len, const void * image_ptr, - const void * udata_ptr, hbool_t * dirty_ptr); -void * small_deserialize(haddr_t addr, size_t len, const void * image_ptr, - const void * udata_ptr, hbool_t * dirty_ptr); -void * medium_deserialize(haddr_t addr, size_t len, const void * image_ptr, - const void * udata_ptr, hbool_t * dirty_ptr); -void * large_deserialize(haddr_t addr, size_t len, const void * image_ptr, - const void * udata_ptr, hbool_t * dirty_ptr); -void * huge_deserialize(haddr_t addr, size_t len, const void * image_ptr, - const void * udata_ptr, hbool_t * dirty_ptr); -void * monster_deserialize(haddr_t addr, size_t len, const void * image_ptr, - const void * udata_ptr, hbool_t * dirty_ptr); -void * variable_deserialize(haddr_t addr, size_t len, const void * image_ptr, - const void * udata_ptr, hbool_t * dirty_ptr); +void * pico_deserialize(const void * image_ptr, size_t len, void * udata_ptr, + hbool_t * dirty_ptr); +void * nano_deserialize(const void * image_ptr, size_t len, void * udata_ptr, + hbool_t * dirty_ptr); +void * micro_deserialize(const void * image_ptr, size_t len, void * udata_ptr, + hbool_t * dirty_ptr); +void * tiny_deserialize(const void * image_ptr, size_t len, void * udata_ptr, + hbool_t * dirty_ptr); +void * small_deserialize(const void * image_ptr, size_t len, void * udata_ptr, + hbool_t * dirty_ptr); +void * medium_deserialize(const void * image_ptr, size_t len, void * udata_ptr, + hbool_t * dirty_ptr); +void * large_deserialize(const void * image_ptr, size_t len, void * udata_ptr, + hbool_t * dirty_ptr); +void * huge_deserialize(const void * image_ptr, size_t len, void * udata_ptr, + hbool_t * dirty_ptr); +void * monster_deserialize(const void * image_ptr, size_t len, void * udata_ptr, + hbool_t * dirty_ptr); +void * variable_deserialize(const void * image_ptr, size_t len, void * udata_ptr, + hbool_t * dirty_ptr); herr_t pico_image_len(void *thing, size_t *image_len_ptr); herr_t nano_image_len(void *thing, size_t *image_len_ptr); diff --git a/testpar/t_cache.c b/testpar/t_cache.c index 95b7cdb3..989e857 100644 --- a/testpar/t_cache.c +++ b/testpar/t_cache.c @@ -315,10 +315,9 @@ hbool_t serve_write_request(struct mssg_t * mssg_ptr); /* call back functions & related data structures */ -static void * datum_deserialize(haddr_t addr, +static void * datum_deserialize(const void * image_ptr, size_t len, - const void * image_ptr, - const void * udata_ptr, + void * udata_ptr, hbool_t * dirty_ptr); static herr_t datum_image_len(void *thing, @@ -1685,13 +1684,13 @@ serve_write_request(struct mssg_t * mssg_ptr) */ void * -datum_deserialize(haddr_t addr, +datum_deserialize(const void * image_ptr, UNUSED size_t len, - const void * image_ptr, - const UNUSED void * udata_ptr, + void * udata_ptr, hbool_t * dirty_ptr) { const char * fcn_name = "load_datum()"; + haddr_t addr = *(haddr_t *)udata_ptr; hbool_t success = TRUE; int idx; struct datum * entry_ptr = NULL; @@ -2697,7 +2696,7 @@ lock_entry(H5C_t * cache_ptr, cache_entry_ptr = H5AC_protect(file_ptr, H5P_DATASET_XFER_DEFAULT, &(types[0]), entry_ptr->base_addr, - entry_ptr->local_len, NULL, H5AC_WRITE); + entry_ptr->local_len, &entry_ptr->base_addr, H5AC_WRITE); if ( ( cache_entry_ptr != (void *)(&(entry_ptr->header)) ) || ( entry_ptr->header.type != &(types[0]) ) || -- cgit v0.12