From 7174207dc7a6c735b34121c0182f5f0810072ab9 Mon Sep 17 00:00:00 2001 From: Mike McGreevy Date: Thu, 19 Jun 2008 15:27:16 -0500 Subject: [svn-r15244] Description: Convert the free space header and free space section info metadata cache clients to use the new journaling cache callbacks. Tested on: kagiso, smirom --- src/H5C2.c | 12 + src/H5F.c | 11 +- src/H5FS.c | 221 ++++++++++++-- src/H5FScache.c | 863 +++++++++++++++++++----------------------------------- src/H5FSdbg.c | 16 +- src/H5FSpkg.h | 27 +- src/H5FSsection.c | 66 +++-- 7 files changed, 588 insertions(+), 628 deletions(-) diff --git a/src/H5C2.c b/src/H5C2.c index 6945084..bf571e8 100644 --- a/src/H5C2.c +++ b/src/H5C2.c @@ -3078,6 +3078,10 @@ H5C2_mark_pinned_entry_dirty(H5F_t * f, /* update for change in entry size if necessary */ if ( ( size_changed ) && ( entry_ptr->size != new_size ) ) { + /* Release the current image */ + if( entry_ptr->image_ptr ) + entry_ptr->image_ptr = H5MM_xfree(entry_ptr->image_ptr); + /* do a flash cache size increase if appropriate */ if ( cache_ptr->flash_size_increase_possible ) { @@ -3568,6 +3572,10 @@ H5C2_resize_pinned_entry(H5F_t * f, /* update for change in entry size if necessary */ if ( entry_ptr->size != new_size ) { + /* Release the current image */ + if( entry_ptr->image_ptr ) + entry_ptr->image_ptr = H5MM_xfree(entry_ptr->image_ptr); + /* do a flash cache size increase if appropriate */ if ( cache_ptr->flash_size_increase_possible ) { @@ -5631,6 +5639,10 @@ H5C2_unprotect(H5F_t * f, /* update for change in entry size if necessary */ if ( ( size_changed ) && ( entry_ptr->size != new_size ) ) { + /* Release the current image */ + if( entry_ptr->image_ptr ) + entry_ptr->image_ptr = H5MM_xfree(entry_ptr->image_ptr); + /* do a flash cache size increase if appropriate */ if ( cache_ptr->flash_size_increase_possible ) { diff --git a/src/H5F.c b/src/H5F.c index 0b3ebfd..894d3a6 100644 --- a/src/H5F.c +++ b/src/H5F.c @@ -1053,11 +1053,12 @@ H5F_dest(H5F_t *f, hid_t dxpl_id) HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "problems closing file") f->shared->root_grp = NULL; } /* end if */ - if(H5AC_dest(f, dxpl_id)) + + if(H5AC2_dest(f, dxpl_id)) /* Push error, but keep going*/ HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "problems closing file") - /* also destroy the modified cache */ - if(H5AC2_dest(f, dxpl_id)) + /* also destroy the old cache */ + if(H5AC_dest(f, dxpl_id)) /* Push error, but keep going*/ HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "problems closing file") if(H5FO_dest(f) < 0) @@ -1750,10 +1751,10 @@ H5F_flush(H5F_t *f, hid_t dxpl_id, H5F_scope_t scope, unsigned flags) H5AC_flags = 0; if((flags & H5F_FLUSH_INVALIDATE) != 0 ) H5AC_flags |= H5AC__FLUSH_INVALIDATE_FLAG; - if(H5AC_flush(f, dxpl_id, H5AC_flags) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush metadata cache") if(H5AC2_flush(f, dxpl_id, H5AC_flags) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush metadata cache2") + if(H5AC_flush(f, dxpl_id, H5AC_flags) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush metadata cache") /* * If we are invalidating everything (which only happens just before diff --git a/src/H5FS.c b/src/H5FS.c index 2dd2833..45f968c 100644 --- a/src/H5FS.c +++ b/src/H5FS.c @@ -36,6 +36,7 @@ #include "H5Eprivate.h" /* Error handling */ #include "H5FSpkg.h" /* File free space */ #include "H5MFprivate.h" /* File memory management */ +#include "H5AC2private.h" /* Metadata cache */ /****************/ /* Local Macros */ @@ -56,6 +57,10 @@ /* Local Prototypes */ /********************/ +/* Section info routines */ +static herr_t H5FS_sinfo_free_sect_cb(void *item, void *key, void *op_data); +static herr_t H5FS_sinfo_free_node_cb(void *item, void *key, void *op_data); + /*********************/ /* Package Variables */ @@ -131,7 +136,7 @@ HDfprintf(stderr, "%s: Creating free space manager, nclasses = %Zu\n", FUNC, ncl fspace->max_sect_size = fs_create->max_sect_size; /* Cache the new free space header (pinned) */ - if(H5AC_set(f, dxpl_id, H5AC_FSPACE_HDR, fspace->addr, fspace, H5AC__PIN_ENTRY_FLAG) < 0) + if(H5AC2_set(f, dxpl_id, H5AC2_FSPACE_HDR, fspace->addr, H5FS_HEADER_SIZE(f), fspace, H5AC2__PIN_ENTRY_FLAG) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTINIT, NULL, "can't add free space header to cache") /* Set the return value */ @@ -139,7 +144,7 @@ HDfprintf(stderr, "%s: Creating free space manager, nclasses = %Zu\n", FUNC, ncl done: if(!ret_value && fspace) - (void)H5FS_cache_hdr_dest(f, fspace); + (void)H5FS_cache_hdr_dest(fspace); FUNC_LEAVE_NOAPI(ret_value) } /* H5FS_create() */ @@ -167,6 +172,7 @@ H5FS_open(H5F_t *f, hid_t dxpl_id, haddr_t fs_addr, size_t nclasses, H5FS_prot_t fs_prot; /* Information for protecting free space manager */ unsigned fspace_status = 0; /* Free space header's status in the metadata cache */ H5FS_t *ret_value; /* Return value */ + H5FS_hdr_cache_ud_t cache_udata; /* User-data for metadata cache callback */ FUNC_ENTER_NOAPI(H5FS_open, NULL) #ifdef QAK @@ -182,9 +188,11 @@ HDfprintf(stderr, "%s: Opening free space manager, nclasses = %Zu\n", FUNC, ncla fs_prot.nclasses = nclasses; fs_prot.classes = classes; fs_prot.cls_init_udata = cls_init_udata; + cache_udata.fs_prot = &fs_prot; + cache_udata.f = f; /* Protect the free space header */ - if(NULL == (fspace = H5AC_protect(f, dxpl_id, H5AC_FSPACE_HDR, fs_addr, &fs_prot, NULL, H5AC_READ))) + if(NULL == (fspace = H5AC2_protect(f, dxpl_id, H5AC2_FSPACE_HDR, fs_addr, H5FS_HEADER_SIZE(f), &cache_udata, H5AC2_READ))) HGOTO_ERROR(H5E_FSPACE, H5E_CANTPROTECT, NULL, "unable to load free space header") #ifdef QAK HDfprintf(stderr, "%s: fspace->sect_addr = %a\n", FUNC, fspace->sect_addr); @@ -194,19 +202,19 @@ HDfprintf(stderr, "%s: fspace->sinfo = %p\n", FUNC, fspace->sinfo); #endif /* QAK */ /* Check the free space header's status in the metadata cache */ - if(H5AC_get_entry_status(f, fs_addr, &fspace_status) < 0) + if(H5AC2_get_entry_status(f, fs_addr, &fspace_status) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTGET, NULL, "unable to check metadata cache status for free space header") /* If the free space header isn't already pinned, pin it now */ /* (could still be pinned from it's section info still hanging around in the cache) */ - if(!(fspace_status & H5AC_ES__IS_PINNED)) { + if(!(fspace_status & H5AC2_ES__IS_PINNED)) { /* Pin free space header in the cache */ - if(H5AC_pin_protected_entry(f, fspace) < 0) + if(H5AC2_pin_protected_entry(f, fspace) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTPIN, NULL, "unable to pin free space header") } /* end if */ /* Unlock free space header, now pinned */ - if(H5AC_unprotect(f, dxpl_id, H5AC_FSPACE_HDR, fs_addr, fspace, H5AC__NO_FLAGS_SET) < 0) + if(H5AC2_unprotect(f, dxpl_id, H5AC2_FSPACE_HDR, fs_addr, (size_t)0, fspace, H5AC2__NO_FLAGS_SET) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTUNPROTECT, NULL, "unable to release free space header") /* Set return value */ @@ -237,6 +245,7 @@ H5FS_delete(H5F_t *f, hid_t dxpl_id, haddr_t fs_addr) H5FS_t *fspace = NULL; /* Free space header loaded from file */ H5FS_prot_t fs_prot; /* Temporary information for protecting free space header */ herr_t ret_value = SUCCEED; /* Return value */ + H5FS_hdr_cache_ud_t cache_udata; /* User-data for metadata cache callback */ FUNC_ENTER_NOAPI(H5FS_delete, FAIL) #ifdef QAK @@ -252,9 +261,11 @@ HDfprintf(stderr, "%s: Deleting free space manager\n", FUNC); fs_prot.nclasses = 0; fs_prot.classes = NULL; fs_prot.cls_init_udata = NULL; + cache_udata.fs_prot = &fs_prot; + cache_udata.f = f; /* Protect the free space header */ - if(NULL == (fspace = H5AC_protect(f, dxpl_id, H5AC_FSPACE_HDR, fs_addr, &fs_prot, NULL, H5AC_WRITE))) + if(NULL == (fspace = H5AC2_protect(f, dxpl_id, H5AC2_FSPACE_HDR, fs_addr, H5FS_HEADER_SIZE(f), &cache_udata, H5AC2_WRITE))) HGOTO_ERROR(H5E_FSPACE, H5E_CANTPROTECT, FAIL, "unable to protect free space header") /* Delete serialized section storage, if there are any */ @@ -269,20 +280,20 @@ HDfprintf(stderr, "%s: fspace->sect_addr = %a\n", FUNC, fspace->sect_addr); HDassert(fspace->sect_size > 0); /* Check the free space section info's status in the metadata cache */ - if(H5AC_get_entry_status(f, fspace->sect_addr, &sinfo_status) < 0) + if(H5AC2_get_entry_status(f, fspace->sect_addr, &sinfo_status) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "unable to check metadata cache status for free space section info") /* If the free space section info is in the cache, expunge it now */ - if(sinfo_status & H5AC_ES__IN_CACHE) { + if(sinfo_status & H5AC2_ES__IN_CACHE) { /* Sanity checks on direct block */ - HDassert(!(sinfo_status & H5AC_ES__IS_PINNED)); - HDassert(!(sinfo_status & H5AC_ES__IS_PROTECTED)); + HDassert(!(sinfo_status & H5AC2_ES__IS_PINNED)); + HDassert(!(sinfo_status & H5AC2_ES__IS_PROTECTED)); #ifdef QAK HDfprintf(stderr, "%s: Expunging free space section info from cache\n", FUNC); #endif /* QAK */ /* Evict the free space section info from the metadata cache */ - if(H5AC_expunge_entry(f, dxpl_id, H5AC_FSPACE_SINFO, fspace->sect_addr) < 0) + if(H5AC2_expunge_entry(f, dxpl_id, H5AC2_FSPACE_SINFO, fspace->sect_addr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTREMOVE, FAIL, "unable to remove free space section info from cache") #ifdef QAK HDfprintf(stderr, "%s: Done expunging free space section info from cache\n", FUNC); @@ -299,7 +310,7 @@ HDfprintf(stderr, "%s: Done expunging free space section info from cache\n", FUN HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "unable to release free space header") /* Release the free space header */ - if(H5AC_unprotect(f, dxpl_id, H5AC_FSPACE_HDR, fs_addr, fspace, H5AC__DELETED_FLAG) < 0) + if(H5AC2_unprotect(f, dxpl_id, H5AC2_FSPACE_HDR, fs_addr, (size_t)0, fspace, H5AC2__DELETED_FLAG) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTUNPROTECT, FAIL, "unable to release free space header") fspace = NULL; @@ -342,7 +353,7 @@ HDfprintf(stderr, "%s: Entering, fspace = %p, fspace->sinfo = %p\n", FUNC, fspac HDassert(H5F_addr_defined(fspace->sect_addr)); /* Unpin the free space section info in the cache */ - if(H5AC_unpin_entry(f, fspace->sinfo) < 0) + if(H5AC2_unpin_entry(fspace->sinfo) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTUNPIN, FAIL, "unable to unpin free space section info") /* If there aren't any sections being managed, free the space for the sections */ @@ -365,11 +376,11 @@ HDfprintf(stderr, "%s: fspace->tot_sect_count = %Hu\n", FUNC, fspace->tot_sect_c fspace->alloc_sect_size = fspace->sect_size = 0; /* Mark free space header as dirty */ - if(H5AC_mark_pinned_or_protected_entry_dirty(f, fspace) < 0) + if(H5AC2_mark_pinned_or_protected_entry_dirty(f, fspace) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, FAIL, "unable to mark free space header as dirty") /* Evict the section info from the metadata cache */ - if(H5AC_expunge_entry(f, dxpl_id, H5AC_FSPACE_SINFO, old_addr) < 0) + if(H5AC2_expunge_entry(f, dxpl_id, H5AC2_FSPACE_SINFO, old_addr) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTREMOVE, FAIL, "unable to remove free space section info from cache") } /* end if */ } /* end if */ @@ -377,17 +388,17 @@ HDfprintf(stderr, "%s: fspace->tot_sect_count = %Hu\n", FUNC, fspace->tot_sect_c unsigned sect_status = 0; /* Free space section's status in the metadata cache */ /* Check if we've allocated any section info in the file & if it's still in the cache */ - if(H5F_addr_defined(fspace->sect_addr) && H5AC_get_entry_status(f, fspace->sect_addr, §_status) < 0) + if(H5F_addr_defined(fspace->sect_addr) && H5AC2_get_entry_status(f, fspace->sect_addr, §_status) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTGET, FAIL, "unable to check metadata cache status for free space header") /* If this free list header's section info exists and is still in the * cache, don't unpin the header - let the section info do it, * when the section info is evicted from the cache. -QAK */ - if(!(sect_status & H5AC_ES__IN_CACHE)) { + if(!(sect_status & H5AC2_ES__IN_CACHE)) { /* Unpin the free space header in the cache */ /* (the section info destructor would unpin it if the section info existed) */ - if(H5AC_unpin_entry(f, fspace) < 0) + if(H5AC2_unpin_entry(fspace) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTUNPIN, FAIL, "unable to unpin free space header") } /* end if */ } /* end else */ @@ -499,6 +510,176 @@ H5FS_size(const H5F_t *f, const H5FS_t *fspace, hsize_t *meta_size) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5FS_size() */ + +/*------------------------------------------------------------------------- + * Function: H5FS_cache_hdr_dest + * + * Purpose: Destroys a free space header in memory. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * koziol@ncsa.uiuc.edu + * May 2 2006 + * + *------------------------------------------------------------------------- + */ +/* ARGSUSED */ +herr_t +H5FS_cache_hdr_dest(H5FS_t *fspace) +{ + unsigned u; /* Local index variable */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT(H5FS_cache_hdr_dest) + + /* + * Check arguments. + */ + HDassert(fspace); + + /* Terminate the section classes for this free space list */ + for(u = 0; u < fspace->nclasses ; u++) { + /* Call the class termination routine, if there is one */ + if(fspace->sect_cls[u].term_cls) + if((fspace->sect_cls[u].term_cls)(&fspace->sect_cls[u]) < 0) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "unable to finalize section class") + } /* end for */ + /* Release the memory for the free space section classes */ + if(fspace->sect_cls) + fspace->sect_cls = H5FL_SEQ_FREE(H5FS_section_class_t, fspace->sect_cls); + + /* Free free space info */ + H5FL_FREE(H5FS_t, fspace); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FS_cache_hdr_dest() */ + + +/*------------------------------------------------------------------------- + * Function: H5FS_sinfo_free_sect_cb + * + * Purpose: Free a size-tracking node for a bin + * + * Return: Success: non-negative + * Failure: negative + * + * Programmer: Quincey Koziol + * Saturday, March 11, 2006 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5FS_sinfo_free_sect_cb(void *_sect, void UNUSED *key, void *op_data) +{ + H5FS_section_info_t *sect = (H5FS_section_info_t *)_sect; /* Section to free */ + const H5FS_sinfo_t *sinfo = (const H5FS_sinfo_t *)op_data; /* Free space manager for section */ + + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5FS_sinfo_free_sect_cb) + + HDassert(sect); + HDassert(sinfo); + + /* Call the section's class 'free' method on the section */ + (*sinfo->fspace->sect_cls[sect->type].free)(sect); + + FUNC_LEAVE_NOAPI(0) +} /* H5FS_sinfo_free_sect_cb() */ + + +/*------------------------------------------------------------------------- + * Function: H5FS_sinfo_free_node_cb + * + * Purpose: Free a size-tracking node for a bin + * + * Return: Success: non-negative + * + * Failure: negative + * + * Programmer: Quincey Koziol + * Saturday, March 11, 2006 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5FS_sinfo_free_node_cb(void *item, void UNUSED *key, void *op_data) +{ + H5FS_node_t *fspace_node = (H5FS_node_t *)item; /* Temporary pointer to free space list node */ + + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5FS_sinfo_free_node_cb) + + HDassert(fspace_node); + HDassert(op_data); + + /* Release the skip list for sections of this size */ + H5SL_destroy(fspace_node->sect_list, H5FS_sinfo_free_sect_cb, op_data); + + /* Release free space list node */ + H5FL_FREE(H5FS_node_t, fspace_node); + + FUNC_LEAVE_NOAPI(0) +} /* H5FS_sinfo_free_node_cb() */ + + +/*------------------------------------------------------------------------- + * Function: H5FS_cache_sinfo_dest + * + * Purpose: Destroys a free space section info in memory. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * koziol@ncsa.uiuc.edu + * July 31 2006 + * + *------------------------------------------------------------------------- + */ +/* ARGSUSED */ +herr_t +H5FS_cache_sinfo_dest(H5FS_sinfo_t *sinfo) +{ + unsigned u; /* Local index variable */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT(H5FS_cache_sinfo_dest) + + /* + * Check arguments. + */ + HDassert(sinfo); + HDassert(sinfo->fspace); + HDassert(sinfo->bins); + + /* Clear out lists of nodes */ + for(u = 0; u < sinfo->nbins; u++) + if(sinfo->bins[u].bin_list) { + H5SL_destroy(sinfo->bins[u].bin_list, H5FS_sinfo_free_node_cb, sinfo); + sinfo->bins[u].bin_list = NULL; + } /* end if */ + + /* Release bins for skip lists */ + sinfo->bins = H5FL_SEQ_FREE(H5FS_bin_t, sinfo->bins); + + /* Release skip list for merging sections */ + if(sinfo->merge_list) + if(H5SL_close(sinfo->merge_list) < 0) + HGOTO_ERROR(H5E_FSPACE, H5E_CANTCLOSEOBJ, FAIL, "can't destroy section merging skip list") + + /* Unpin the free space header in the cache */ + /* (make certain this is last action with section info, to allow for header + * disappearing immediately) + */ + if(H5AC2_unpin_entry(sinfo->fspace) < 0) + HGOTO_ERROR(H5E_FSPACE, H5E_CANTUNPIN, FAIL, "unable to unpin free space header") + + /* Release free space section info */ + H5FL_FREE(H5FS_sinfo_t, sinfo); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FS_cache_sinfo_dest() */ + #ifdef H5FS_DEBUG /*------------------------------------------------------------------------- diff --git a/src/H5FScache.c b/src/H5FScache.c index 8ad9631..903f893 100644 --- a/src/H5FScache.c +++ b/src/H5FScache.c @@ -38,6 +38,7 @@ #include "H5FSpkg.h" /* File free space */ #include "H5Vprivate.h" /* Vectors and arrays */ #include "H5WBprivate.h" /* Wrapped Buffers */ +#include "H5AC2private.h" /* Metadata cache */ /****************/ /* Local Macros */ @@ -73,46 +74,52 @@ typedef struct { /********************/ /* Section info routines */ -static herr_t H5FS_sinfo_free_sect_cb(void *item, void *key, void *op_data); -static herr_t H5FS_sinfo_free_node_cb(void *item, void *key, void *op_data); static herr_t H5FS_sinfo_serialize_sect_cb(void *_item, void UNUSED *key, void *_udata); static herr_t H5FS_sinfo_serialize_node_cb(void *_item, void UNUSED *key, void *_udata); /* Metadata cache callbacks */ -static H5FS_t *H5FS_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *udata, void *udata2); -static herr_t H5FS_cache_hdr_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5FS_t *fspace, unsigned UNUSED * flags_ptr); -static herr_t H5FS_cache_hdr_clear(H5F_t *f, H5FS_t *fspace, hbool_t destroy); -static herr_t H5FS_cache_hdr_size(const H5F_t *f, const H5FS_t *fspace, size_t *size_ptr); -static H5FS_sinfo_t *H5FS_cache_sinfo_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *udata, void *udata2); -static herr_t H5FS_cache_sinfo_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5FS_sinfo_t *sinfo, unsigned UNUSED * flags_ptr); -static herr_t H5FS_cache_sinfo_clear(H5F_t *f, H5FS_sinfo_t *sinfo, hbool_t destroy); -static herr_t H5FS_cache_sinfo_size(const H5F_t *f, const H5FS_sinfo_t *sinfo, size_t *size_ptr); +static void *H5FS_cache_hdr_deserialize(haddr_t addr, size_t len, + const void *image, const void *udata, hbool_t *dirty); +static herr_t H5FS_cache_hdr_serialize(const H5F_t *f, 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(haddr_t addr, size_t len, void *thing); + +static void *H5FS_cache_sinfo_deserialize(haddr_t addr, size_t len, + const void *image, const void *udata, hbool_t *dirty); +static herr_t H5FS_cache_sinfo_serialize(const H5F_t *f, 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_sinfo_free_icr(haddr_t addr, size_t len, void *thing); /*********************/ /* Package Variables */ /*********************/ -/* H5FS header inherits cache-like properties from H5AC */ -const H5AC_class_t H5AC_FSPACE_HDR[1] = {{ - H5AC_FSPACE_HDR_ID, - (H5AC_load_func_t)H5FS_cache_hdr_load, - (H5AC_flush_func_t)H5FS_cache_hdr_flush, - (H5AC_dest_func_t)H5FS_cache_hdr_dest, - (H5AC_clear_func_t)H5FS_cache_hdr_clear, - (H5AC_size_func_t)H5FS_cache_hdr_size, +/* H5FS header inherits cache-like properties from H5AC2 */ +const H5AC2_class_t H5AC2_FSPACE_HDR[1] = {{ + H5AC2_FSPACE_HDR_ID, + "Free space header", + H5FD_MEM_FSPACE_HDR, + H5FS_cache_hdr_deserialize, + NULL, /* H5FS_cache_hdr_image_len, */ + H5FS_cache_hdr_serialize, + H5FS_cache_hdr_free_icr, + NULL, /* H5FS_cache_hdr_clear_dirty_bits, */ }}; -/* H5FS serialized sections inherit cache-like properties from H5AC */ -const H5AC_class_t H5AC_FSPACE_SINFO[1] = {{ - H5AC_FSPACE_SINFO_ID, - (H5AC_load_func_t)H5FS_cache_sinfo_load, - (H5AC_flush_func_t)H5FS_cache_sinfo_flush, - (H5AC_dest_func_t)H5FS_cache_sinfo_dest, - (H5AC_clear_func_t)H5FS_cache_sinfo_clear, - (H5AC_size_func_t)H5FS_cache_sinfo_size, +/* H5FS serialized sections inherit cache-like properties from H5AC2 */ +const H5AC2_class_t H5AC2_FSPACE_SINFO[1] = {{ + H5AC2_FSPACE_SINFO_ID, + "Free space section info", + H5FD_MEM_FSPACE_SINFO, + H5FS_cache_sinfo_deserialize, + NULL, + H5FS_cache_sinfo_serialize, + H5FS_cache_sinfo_free_icr, + NULL, }}; - /*****************************/ /* Library Private Variables */ /*****************************/ @@ -128,67 +135,57 @@ H5FL_BLK_DEFINE_STATIC(sect_block); /*------------------------------------------------------------------------- - * Function: H5FS_cache_hdr_load + * Function: H5FS_cache_hdr_deserialize * - * Purpose: Loads a free space manager header from the disk. + * Purpose: Deserialize the data structure from disk. * - * Return: Success: Pointer to a new free space header - * Failure: NULL + * Return: Success: Pointer to a new free space header + * Failure: NULL * - * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu - * May 2 2006 + * Programmer: Quincey Koziol + * koziol@ncsa.uiuc.edu + * May 2 2006 + * + * Changes: Mike McGreevy + * mcgreevy@hdfgroup.org + * May 28 2008 + * Converted from H5FS_cache_hdr_load * *------------------------------------------------------------------------- */ -static H5FS_t * -H5FS_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_fs_prot, void UNUSED *udata2) + +static void * +H5FS_cache_hdr_deserialize(haddr_t UNUSED addr, size_t UNUSED len, + const void *image, const void *_udata, hbool_t UNUSED *dirty) { H5FS_t *fspace = NULL; /* Free space header info */ - const H5FS_prot_t *fs_prot = (const H5FS_prot_t *)_fs_prot; /* User data for protecting */ + const H5FS_hdr_cache_ud_t *udata = (const H5FS_hdr_cache_ud_t *)_udata; /* user data for callback */ size_t size; /* Header size */ - H5WB_t *wb = NULL; /* Wrapped buffer for header data */ - uint8_t hdr_buf[H5FS_HDR_BUF_SIZE]; /* Buffer for header */ - uint8_t *hdr; /* Pointer to header buffer */ const uint8_t *p; /* Pointer into raw data buffer */ uint32_t stored_chksum; /* Stored metadata checksum value */ uint32_t computed_chksum; /* Computed metadata checksum value */ unsigned nclasses; /* Number of section classes */ H5FS_t *ret_value; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT(H5FS_cache_hdr_load) + FUNC_ENTER_NOAPI_NOINIT(H5FS_cache_hdr_deserialize) #ifdef QAK -HDfprintf(stderr, "%s: Load free space header, addr = %a\n", FUNC, addr); -#endif /* QAK */ +HDfprintf(stderr, "%s: Deserialize free space hedaer, addr = %a\n", FUNC, addr); +#endif /* Check arguments */ - HDassert(f); - HDassert(H5F_addr_defined(addr)); - HDassert(fs_prot); + HDassert(image); /* Allocate a new free space manager */ - if(NULL == (fspace = H5FS_new(fs_prot->nclasses, fs_prot->classes, fs_prot->cls_init_udata))) + if(NULL == (fspace = H5FS_new(udata->fs_prot->nclasses, udata->fs_prot->classes, udata->fs_prot->cls_init_udata))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") /* Set free space manager's internal information */ fspace->addr = addr; - /* Wrap the local buffer for serialized header info */ - if(NULL == (wb = H5WB_wrap(hdr_buf, sizeof(hdr_buf)))) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTINIT, NULL, "can't wrap buffer") - /* Compute the size of the free space header on disk */ - size = H5FS_HEADER_SIZE(f); - - /* Get a pointer to a buffer that's large enough for header */ - if(NULL == (hdr = H5WB_actual(wb, size))) - HGOTO_ERROR(H5E_FSPACE, H5E_NOSPACE, NULL, "can't get actual buffer") + size = H5FS_HEADER_SIZE(udata->f); - /* Read header from disk */ - if(H5F_block_read(f, H5FD_MEM_FSPACE_HDR, addr, size, dxpl_id, hdr) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_READERROR, NULL, "can't read free space header") - - p = hdr; + p = image; /* Magic number */ if(HDmemcmp(p, H5FS_HDR_MAGIC, (size_t)H5FS_SIZEOF_MAGIC)) @@ -205,16 +202,16 @@ HDfprintf(stderr, "%s: Load free space header, addr = %a\n", FUNC, addr); HGOTO_ERROR(H5E_FSPACE, H5E_CANTLOAD, NULL, "unknown client ID in free space header") /* Total space tracked */ - H5F_DECODE_LENGTH(f, p, fspace->tot_space); + H5F_DECODE_LENGTH(udata->f, p, fspace->tot_space); /* Total # of free space sections tracked */ - H5F_DECODE_LENGTH(f, p, fspace->tot_sect_count); + H5F_DECODE_LENGTH(udata->f, p, fspace->tot_sect_count); /* # of serializable free space sections tracked */ - H5F_DECODE_LENGTH(f, p, fspace->serial_sect_count); + H5F_DECODE_LENGTH(udata->f, p, fspace->serial_sect_count); /* # of ghost free space sections tracked */ - H5F_DECODE_LENGTH(f, p, fspace->ghost_sect_count); + H5F_DECODE_LENGTH(udata->f, p, fspace->ghost_sect_count); /* # of section classes */ /* (only check if we actually have some classes) */ @@ -232,53 +229,53 @@ HDfprintf(stderr, "%s: Load free space header, addr = %a\n", FUNC, addr); UINT16DECODE(p, fspace->max_sect_addr); /* Max. size of section to track */ - H5F_DECODE_LENGTH(f, p, fspace->max_sect_size); + H5F_DECODE_LENGTH(udata->f, p, fspace->max_sect_size); /* Address of serialized free space sections */ - H5F_addr_decode(f, &p, &fspace->sect_addr); + H5F_addr_decode(udata->f, &p, &fspace->sect_addr); /* Size of serialized free space sections */ - H5F_DECODE_LENGTH(f, p, fspace->sect_size); + H5F_DECODE_LENGTH(udata->f, p, fspace->sect_size); /* Allocated size of serialized free space sections */ - H5F_DECODE_LENGTH(f, p, fspace->alloc_sect_size); + H5F_DECODE_LENGTH(udata->f, p, fspace->alloc_sect_size); /* Compute checksum on indirect block */ - computed_chksum = H5_checksum_metadata(hdr, (size_t)(p - hdr), 0); + computed_chksum = H5_checksum_metadata(image, (size_t)((const uint8_t *)p - (const uint8_t *)image), 0); /* Metadata checksum */ UINT32DECODE(p, stored_chksum); - HDassert((size_t)(p - hdr) == size); - /* Verify checksum */ if(stored_chksum != computed_chksum) HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, NULL, "incorrect metadata checksum for fractal heap indirect block") + /* Sanity check */ + HDassert((size_t)((const uint8_t *)p - (const uint8_t *)image) <= len); + /* Set return value */ ret_value = fspace; done: /* Release resources */ - if(wb && H5WB_unwrap(wb) < 0) - HDONE_ERROR(H5E_FSPACE, H5E_CLOSEERROR, NULL, "can't close wrapped buffer") if(!ret_value && fspace) - (void)H5FS_cache_hdr_dest(f, fspace); + (void)H5FS_cache_hdr_dest(fspace); FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FS_cache_hdr_load() */ /*lint !e818 Can't make udata a pointer to const */ +} /* end H5FS_cache_hdr_deserialize() */ /*lint !e818 Can't make udata a pointer to const */ /*------------------------------------------------------------------------- - * Function: H5FS_cache_hdr_flush + * Function: H5FS_cache_hdr_serialize * - * Purpose: Flushes a dirty free space header to disk. + * Purpose: Serializes the data structure for writing to disk. * - * Return: Non-negative on success/Negative on failure + * Return: Success: SUCCEED + * Failure: FAIL * - * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu - * May 2 2006 + * Programmer: Quincey Koziol + * koziol@ncsa.uiuc.edu + * May 2 2006 * * Changes: JRM -- 8/21/06 * Added the flags_ptr parameter. This parameter exists to @@ -286,299 +283,194 @@ done: * entry is resized or renamed as a result of the flush. * *flags_ptr is set to H5C_CALLBACK__NO_FLAGS_SET on entry. * + * Mike McGreevy + * mcgreevy@hdfgroup.org + * May 28, 2008 + * Converted from H5FS_cache_hdr_flush * *------------------------------------------------------------------------- */ static herr_t -H5FS_cache_hdr_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5FS_t *fspace, unsigned UNUSED * flags_ptr) +H5FS_cache_hdr_serialize(const H5F_t *f, haddr_t UNUSED addr, size_t UNUSED len, + void *image, void *_thing, unsigned *flags, haddr_t UNUSED *new_addr, + size_t UNUSED *new_len, void UNUSED **new_image) { - H5WB_t *wb = NULL; /* Wrapped buffer for header data */ - uint8_t hdr_buf[H5FS_HDR_BUF_SIZE]; /* Buffer for header */ - herr_t ret_value = SUCCEED; /* Return value */ + H5FS_t *fspace = (H5FS_t *)_thing; /* Pointer to free space header */ + herr_t ret_value = SUCCEED; /* Return value */ + uint8_t *p; /* Pointer into raw data buffer */ + uint32_t metadata_chksum; /* Computed metadata checksum value */ + size_t size; /* Header size on disk */ - FUNC_ENTER_NOAPI_NOINIT(H5FS_cache_hdr_flush) + FUNC_ENTER_NOAPI_NOINIT(H5FS_cache_hdr_serialize) #ifdef QAK -HDfprintf(stderr, "%s: Flushing free space header, addr = %a, destroy = %u\n", FUNC, addr, (unsigned)destroy); -#endif /* QAK */ +HDfprintf(stderr, "%s: Serialize free space header, addr = %a\n", FUNC, addr); +#endif /* check arguments */ HDassert(f); - HDassert(H5F_addr_defined(addr)); + HDassert(image); HDassert(fspace); + HDassert(flags); - if(fspace->cache_info.is_dirty) { - uint8_t *hdr; /* Pointer to header buffer */ - uint8_t *p; /* Pointer into raw data buffer */ - uint32_t metadata_chksum; /* Computed metadata checksum value */ - size_t size; /* Header size on disk */ - - /* Wrap the local buffer for serialized header info */ - if(NULL == (wb = H5WB_wrap(hdr_buf, sizeof(hdr_buf)))) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTINIT, FAIL, "can't wrap buffer") - - /* Compute the size of the free space header on disk */ - size = H5FS_HEADER_SIZE(f); - - /* Get a pointer to a buffer that's large enough for header */ - if(NULL == (hdr = H5WB_actual(wb, size))) - HGOTO_ERROR(H5E_FSPACE, H5E_NOSPACE, FAIL, "can't get actual buffer") - - /* Get temporary pointer to header */ - p = hdr; - - /* Magic number */ - HDmemcpy(p, H5FS_HDR_MAGIC, (size_t)H5FS_SIZEOF_MAGIC); - p += H5FS_SIZEOF_MAGIC; - - /* Version # */ - *p++ = H5FS_HDR_VERSION; - - /* Client ID */ - *p++ = fspace->client; - - /* Total space tracked */ - H5F_ENCODE_LENGTH(f, p, fspace->tot_space); - - /* Total # of free space sections tracked */ - H5F_ENCODE_LENGTH(f, p, fspace->tot_sect_count); - - /* # of serializable free space sections tracked */ - H5F_ENCODE_LENGTH(f, p, fspace->serial_sect_count); - - /* # of ghost free space sections tracked */ - H5F_ENCODE_LENGTH(f, p, fspace->ghost_sect_count); - - /* # of section classes */ - UINT16ENCODE(p, fspace->nclasses); - - /* Shrink percent */ - UINT16ENCODE(p, fspace->shrink_percent); - - /* Expand percent */ - UINT16ENCODE(p, fspace->expand_percent); - - /* Size of address space free space sections are within (log2 of actual value) */ - UINT16ENCODE(p, fspace->max_sect_addr); - - /* Max. size of section to track */ - H5F_ENCODE_LENGTH(f, p, fspace->max_sect_size); - - /* Address of serialized free space sections */ - H5F_addr_encode(f, &p, fspace->sect_addr); - - /* Size of serialized free space sections */ - H5F_ENCODE_LENGTH(f, p, fspace->sect_size); + /* Compute the size of the free space header on disk */ + size = H5FS_HEADER_SIZE(f); - /* Allocated size of serialized free space sections */ - H5F_ENCODE_LENGTH(f, p, fspace->alloc_sect_size); + /* Get temporary pointer to header */ + p = image; - /* Compute checksum */ - metadata_chksum = H5_checksum_metadata(hdr, (size_t)(p - hdr), 0); + /* Magic number */ + HDmemcpy(p, H5FS_HDR_MAGIC, (size_t)H5FS_SIZEOF_MAGIC); + p += H5FS_SIZEOF_MAGIC; - /* Metadata checksum */ - UINT32ENCODE(p, metadata_chksum); + /* Version # */ + *p++ = H5FS_HDR_VERSION; - /* Write the free space header. */ - HDassert((size_t)(p - hdr) == size); - if(H5F_block_write(f, H5FD_MEM_FSPACE_HDR, addr, size, dxpl_id, hdr) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTFLUSH, FAIL, "unable to save free space header to disk") + /* Client ID */ + *p++ = fspace->client; - fspace->cache_info.is_dirty = FALSE; - } /* end if */ + /* Total space tracked */ + H5F_ENCODE_LENGTH(f, p, fspace->tot_space); - if(destroy) - if(H5FS_cache_hdr_dest(f, fspace) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "unable to destroy free space header") + /* Total # of free space sections tracked */ + H5F_ENCODE_LENGTH(f, p, fspace->tot_sect_count); -done: - /* Release resources */ - if(wb && H5WB_unwrap(wb) < 0) - HDONE_ERROR(H5E_FSPACE, H5E_CLOSEERROR, FAIL, "can't close wrapped buffer") + /* # of serializable free space sections tracked */ + H5F_ENCODE_LENGTH(f, p, fspace->serial_sect_count); - FUNC_LEAVE_NOAPI(ret_value) -} /* H5FS_cache_hdr_flush() */ + /* # of ghost free space sections tracked */ + H5F_ENCODE_LENGTH(f, p, fspace->ghost_sect_count); - -/*------------------------------------------------------------------------- - * Function: H5FS_cache_hdr_dest - * - * Purpose: Destroys a free space header in memory. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu - * May 2 2006 - * - *------------------------------------------------------------------------- - */ -/* ARGSUSED */ -herr_t -H5FS_cache_hdr_dest(H5F_t UNUSED *f, H5FS_t *fspace) -{ - unsigned u; /* Local index variable */ - herr_t ret_value = SUCCEED; /* Return value */ + /* # of section classes */ + UINT16ENCODE(p, fspace->nclasses); - FUNC_ENTER_NOAPI_NOINIT(H5FS_cache_hdr_dest) + /* Shrink percent */ + UINT16ENCODE(p, fspace->shrink_percent); - /* - * Check arguments. - */ - HDassert(fspace); + /* Expand percent */ + UINT16ENCODE(p, fspace->expand_percent); - /* Terminate the section classes for this free space list */ - for(u = 0; u < fspace->nclasses ; u++) { - /* Call the class termination routine, if there is one */ - if(fspace->sect_cls[u].term_cls) - if((fspace->sect_cls[u].term_cls)(&fspace->sect_cls[u]) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "unable to finalize section class") - } /* end for */ + /* Size of address space free space sections are within (log2 of actual value) */ + UINT16ENCODE(p, fspace->max_sect_addr); - /* Release the memory for the free space section classes */ - if(fspace->sect_cls) - fspace->sect_cls = H5FL_SEQ_FREE(H5FS_section_class_t, fspace->sect_cls); + /* Max. size of section to track */ + H5F_ENCODE_LENGTH(f, p, fspace->max_sect_size); - /* Free free space info */ - H5FL_FREE(H5FS_t, fspace); + /* Address of serialized free space sections */ + H5F_addr_encode(f, &p, fspace->sect_addr); -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FS_cache_hdr_dest() */ + /* Size of serialized free space sections */ + H5F_ENCODE_LENGTH(f, p, fspace->sect_size); - -/*------------------------------------------------------------------------- - * Function: H5FS_cache_hdr_clear - * - * Purpose: Mark a free space header in memory as non-dirty. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu - * May 2 2006 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5FS_cache_hdr_clear(H5F_t *f, H5FS_t *fspace, hbool_t destroy) -{ - herr_t ret_value = SUCCEED; /* Return value */ + /* Allocated size of serialized free space sections */ + H5F_ENCODE_LENGTH(f, p, fspace->alloc_sect_size); - FUNC_ENTER_NOAPI_NOINIT(H5FS_cache_hdr_clear) + /* Compute checksum */ + metadata_chksum = H5_checksum_metadata(image, (size_t)((const uint8_t *)p - (const uint8_t *)image), 0); - /* - * Check arguments. - */ - HDassert(fspace); + /* Metadata checksum */ + UINT32ENCODE(p, metadata_chksum); - /* Reset the dirty flag. */ - fspace->cache_info.is_dirty = FALSE; + /* Reset the cache flags for this operation */ + *flags = 0; - if(destroy) - if(H5FS_cache_hdr_dest(f, fspace) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "unable to destroy free space header") + /* Sanity check */ + HDassert((size_t)((const uint8_t *)p - (const uint8_t *)image) <= len); done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FS_cache_hdr_clear() */ +} /* H5FS_cache_hdr_serialize() */ /*------------------------------------------------------------------------- - * Function: H5FS_cache_hdr_size + * Function: H5FS_cache_hdr_free_icr * - * Purpose: Compute the size in bytes of a free space header - * on disk, and return it in *size_ptr. On failure, - * the value of *size_ptr is undefined. + * Purpose: Destroy/release an "in core representation" of a data structure * - * Return: Non-negative on success/Negative on failure + * Return: Success: SUCCEED + * Failure: FAIL * - * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu - * May 2 2006 + * Programmer: Mike McGreevy + * mcgreevy@hdfgroup.org + * May 29, 2008 * *------------------------------------------------------------------------- */ static herr_t -H5FS_cache_hdr_size(const H5F_t *f, const H5FS_t UNUSED *fspace, size_t *size_ptr) +H5FS_cache_hdr_free_icr(haddr_t UNUSED addr, size_t UNUSED len, void *thing) { - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5FS_cache_hdr_size) + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5FS_cache_hdr_free_icr) - /* check arguments */ - HDassert(f); - HDassert(fspace); - HDassert(size_ptr); + /* Check arguments */ + HDassert(thing); - /* Set size value */ - *size_ptr = H5FS_HEADER_SIZE(f); + /* Destroy free space header */ + H5FS_cache_hdr_dest(thing); FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5FS_cache_hdr_size() */ +} /* H5FS_cache_hdr_free_icr() */ /*------------------------------------------------------------------------- - * Function: H5FS_cache_sinfo_load + * Function: H5FS_cache_sinfo_deserialize * - * Purpose: Loads free space sections from the disk. + * Purpose: Deserialize the data structure from disk. * - * Return: Success: Pointer to a new free space section info - * Failure: NULL + * Return: Success: SUCCEED + * Failure: FAIL * - * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu - * July 31 2006 + * Programmer: Quincey Koziol + * koziol@ncsa.uiuc.edu + * July 31 2006 + * + * Modified: Mike McGreevy + * mcgreevy@hdfgroup.org + * May 29, 2008 + * Converted from H5FS_cache_sinfo_load * *------------------------------------------------------------------------- */ -static H5FS_sinfo_t * -H5FS_cache_sinfo_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *udata1, void *_fspace) +static void * +H5FS_cache_sinfo_deserialize(haddr_t UNUSED addr, size_t UNUSED len, + const void *image, const void *_udata, hbool_t UNUSED *dirty) { H5FS_sinfo_t *sinfo = NULL; /* Free space section info */ - H5FS_t *fspace = (H5FS_t *)_fspace; /* User data for protecting */ + const H5FS_sinfo_cache_ud_t *udata = (const H5FS_sinfo_cache_ud_t *)_udata; /* user data for callback */ haddr_t fs_addr; /* Free space header address */ size_t old_sect_size; /* Old section size */ - uint8_t *buf = NULL; /* Temporary buffer */ const uint8_t *p; /* Pointer into raw data buffer */ uint32_t stored_chksum; /* Stored metadata checksum value */ uint32_t computed_chksum; /* Computed metadata checksum value */ H5FS_sinfo_t *ret_value; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT(H5FS_cache_sinfo_load) + FUNC_ENTER_NOAPI_NOINIT(H5FS_cache_sinfo_deserialize) #ifdef QAK -HDfprintf(stderr, "%s: Load free space sections, addr = %a\n", FUNC, addr); -#endif /* QAK */ +HDfprintf(stderr, "%s: Deserialize free space sections, addr = %a\n", FUNC, addr); +#endif /* Check arguments */ - HDassert(f); - HDassert(H5F_addr_defined(addr)); - HDassert(fspace); + HDassert(image); /* Allocate a new free space section info */ - if(NULL == (sinfo = H5FS_sinfo_new(f, fspace))) + if(NULL == (sinfo = H5FS_sinfo_new(udata->f, udata->fspace))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") /* Link free space manager to section info */ /* (for deserializing sections) */ - HDassert(fspace->sinfo == NULL); - fspace->sinfo = sinfo; + HDassert(udata->fspace->sinfo == NULL); + udata->fspace->sinfo = sinfo; /* Sanity check address */ - if(H5F_addr_ne(addr, fspace->sect_addr)) + 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: */ fspace->sect_size, /* From: */ hsize_t, /* To: */ size_t); + H5_ASSIGN_OVERFLOW(/* To: */ old_sect_size, /* From: */ udata->fspace->sect_size, /* From: */ hsize_t, /* To: */ size_t); #ifdef QAK -HDfprintf(stderr, "%s: fspace->sect_size = %Hu\n", FUNC, fspace->sect_size); +HDfprintf(stderr, "%s: udata->fspace->sect_size = %Hu\n", FUNC, udata->fspace->sect_size); #endif /* QAK */ - if(NULL == (buf = H5FL_BLK_MALLOC(sect_block, (size_t)fspace->sect_size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") - - /* Read buffer from disk */ - if(H5F_block_read(f, H5FD_MEM_FSPACE_SINFO, fspace->sect_addr, (size_t)fspace->sect_size, dxpl_id, buf) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_READERROR, NULL, "can't read free space sections") /* Deserialize free sections from buffer available */ - p = buf; + p = image; /* Magic number */ if(HDmemcmp(p, H5FS_SINFO_MAGIC, (size_t)H5FS_SIZEOF_MAGIC)) @@ -590,15 +482,15 @@ HDfprintf(stderr, "%s: fspace->sect_size = %Hu\n", FUNC, fspace->sect_size); HGOTO_ERROR(H5E_FSPACE, H5E_CANTLOAD, NULL, "wrong free space sections version") /* Address of free space header for these sections */ - H5F_addr_decode(f, &p, &fs_addr); + H5F_addr_decode(udata->f, &p, &fs_addr); #ifdef QAK -HDfprintf(stderr, "%s: fspace->addr = %a, fs_addr = %a\n", FUNC, fspace->addr, fs_addr); +HDfprintf(stderr, "%s: udata->fspace->addr = %a, fs_addr = %a\n", FUNC, udata->fspace->addr, fs_addr); #endif /* QAK */ - if(H5F_addr_ne(fs_addr, fspace->addr)) + if(H5F_addr_ne(fs_addr, udata->fspace->addr)) HGOTO_ERROR(H5E_FSPACE, H5E_CANTLOAD, NULL, "incorrect header address for free space sections") /* Check for any serialized sections */ - if(fspace->serial_sect_count > 0) { + if(udata->fspace->serial_sect_count > 0) { hsize_t old_tot_sect_count; /* Total section count from header */ hsize_t old_serial_sect_count; /* Total serializable section count from header */ hsize_t old_ghost_sect_count; /* Total ghost section count from header */ @@ -606,27 +498,27 @@ HDfprintf(stderr, "%s: fspace->addr = %a, fs_addr = %a\n", FUNC, fspace->addr, f unsigned sect_cnt_size; /* The size of the section size counts */ /* Compute the size of the section counts */ - sect_cnt_size = H5V_limit_enc_size((uint64_t)fspace->serial_sect_count); + sect_cnt_size = H5V_limit_enc_size((uint64_t)udata->fspace->serial_sect_count); #ifdef QAK HDfprintf(stderr, "%s: sect_cnt_size = %u\n", FUNC, sect_cnt_size); -HDfprintf(stderr, "%s: fspace->sect_len_size = %u\n", FUNC, fspace->sect_len_size); +HDfprintf(stderr, "%s: udata->fspace->sect_len_size = %u\n", FUNC, udata->fspace->sect_len_size); #endif /* QAK */ /* Reset the section count, the "add" routine will update it */ - old_tot_sect_count = fspace->tot_sect_count; - old_serial_sect_count = fspace->serial_sect_count; - old_ghost_sect_count = fspace->ghost_sect_count; - old_tot_space = fspace->tot_space; + old_tot_sect_count = udata->fspace->tot_sect_count; + old_serial_sect_count = udata->fspace->serial_sect_count; + old_ghost_sect_count = udata->fspace->ghost_sect_count; + old_tot_space = udata->fspace->tot_space; #ifdef QAK -HDfprintf(stderr, "%s: fspace->tot_sect_count = %Hu\n", FUNC, fspace->tot_sect_count); -HDfprintf(stderr, "%s: fspace->serial_sect_count = %Hu\n", FUNC, fspace->serial_sect_count); -HDfprintf(stderr, "%s: fspace->ghost_sect_count = %Hu\n", FUNC, fspace->ghost_sect_count); -HDfprintf(stderr, "%s: fspace->tot_space = %Hu\n", FUNC, fspace->tot_space); +HDfprintf(stderr, "%s: udata->fspace->tot_sect_count = %Hu\n", FUNC, udata->fspace->tot_sect_count); +HDfprintf(stderr, "%s: udata->fspace->serial_sect_count = %Hu\n", FUNC, udata->fspace->serial_sect_count); +HDfprintf(stderr, "%s: udata->fspace->ghost_sect_count = %Hu\n", FUNC, udata->fspace->ghost_sect_count); +HDfprintf(stderr, "%s: udata->fspace->tot_space = %Hu\n", FUNC, udata->fspace->tot_space); #endif /* QAK */ - fspace->tot_sect_count = 0; - fspace->serial_sect_count = 0; - fspace->ghost_sect_count = 0; - fspace->tot_space = 0; + udata->fspace->tot_sect_count = 0; + udata->fspace->serial_sect_count = 0; + udata->fspace->ghost_sect_count = 0; + udata->fspace->tot_space = 0; /* Walk through the buffer, deserializing sections */ do { @@ -669,56 +561,54 @@ HDfprintf(stderr, "%s: sect_type = %u\n", FUNC, sect_type); /* Call 'deserialize' callback for this section */ des_flags = 0; - HDassert(fspace->sect_cls[sect_type].deserialize); - if(NULL == (new_sect = (*fspace->sect_cls[sect_type].deserialize)(&fspace->sect_cls[sect_type], dxpl_id, p, sect_addr, sect_size, &des_flags))) + HDassert(udata->fspace->sect_cls[sect_type].deserialize); + if(NULL == (new_sect = (*udata->fspace->sect_cls[sect_type].deserialize)(&udata->fspace->sect_cls[sect_type], udata->dxpl_id, p, sect_addr, sect_size, &des_flags))) HGOTO_ERROR(H5E_FSPACE, H5E_CANTDECODE, NULL, "can't deserialize section") /* Update offset in serialization buffer */ - p += fspace->sect_cls[sect_type].serial_size; + p += udata->fspace->sect_cls[sect_type].serial_size; #ifdef QAK -HDfprintf(stderr, "%s: fspace->sect_cls[%u].serial_size = %Zu\n", FUNC, sect_type, fspace->sect_cls[sect_type].serial_size); +HDfprintf(stderr, "%s: udata->fspace->sect_cls[%u].serial_size = %Zu\n", FUNC, sect_type, udata->fspace->sect_cls[sect_type].serial_size); #endif /* QAK */ /* Insert section in free space manager, unless requested not to */ if(!(des_flags & H5FS_DESERIALIZE_NO_ADD)) - if(H5FS_sect_add(f, dxpl_id, fspace, new_sect, H5FS_ADD_DESERIALIZING, NULL) < 0) + if(H5FS_sect_add(udata->f, udata->dxpl_id, udata->fspace, new_sect, H5FS_ADD_DESERIALIZING, NULL) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, NULL, "can't add section to free space manager") } /* end for */ - } while(p < ((buf + old_sect_size) - H5FS_SIZEOF_CHKSUM)); + } while(p < (((const uint8_t *)image + old_sect_size) - H5FS_SIZEOF_CHKSUM)); /* Sanity check */ - HDassert((size_t)(p - buf) == (old_sect_size - H5FS_SIZEOF_CHKSUM)); - HDassert(old_sect_size == fspace->sect_size); - HDassert(old_tot_sect_count == fspace->tot_sect_count); - HDassert(old_serial_sect_count == fspace->serial_sect_count); - HDassert(old_ghost_sect_count == fspace->ghost_sect_count); - HDassert(old_tot_space == fspace->tot_space); + HDassert((size_t)(p - (const uint8_t *)image) == (old_sect_size - H5FS_SIZEOF_CHKSUM)); + HDassert(old_sect_size == udata->fspace->sect_size); + HDassert(old_tot_sect_count == udata->fspace->tot_sect_count); + HDassert(old_serial_sect_count == udata->fspace->serial_sect_count); + HDassert(old_ghost_sect_count == udata->fspace->ghost_sect_count); + HDassert(old_tot_space == udata->fspace->tot_space); } /* end if */ /* Compute checksum on indirect block */ - computed_chksum = H5_checksum_metadata(buf, (size_t)(p - buf), 0); + computed_chksum = H5_checksum_metadata(image, (size_t)((const uint8_t *)p - (const uint8_t *)image), 0); /* Metadata checksum */ UINT32DECODE(p, stored_chksum); - /* Sanity check */ - HDassert((size_t)(p - buf) == old_sect_size); - /* Verify checksum */ if(stored_chksum != computed_chksum) HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, NULL, "incorrect metadata checksum for fractal heap indirect block") + /* Sanity check */ + HDassert((size_t)((const uint8_t *)p - (const uint8_t *)image) <= len); + /* Set return value */ ret_value = sinfo; done: - if(buf) - H5FL_BLK_FREE(sect_block, buf); if(!ret_value && sinfo) - (void)H5FS_cache_sinfo_dest(f, sinfo); + (void)H5FS_cache_sinfo_dest(sinfo); FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FS_cache_sinfo_load() */ /*lint !e818 Can't make udata a pointer to const */ +} /* end H5FS_cache_sinfo_deserialize() */ /*lint !e818 Can't make udata a pointer to const */ /*------------------------------------------------------------------------- @@ -838,311 +728,146 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_cache_sinfo_flush + * Function: H5FS_cache_sinfo_serialize * - * Purpose: Flushes a dirty free space section info to disk. + * Purpose: Serialize the data structure for writing to disk. * - * Return: Non-negative on success/Negative on failure + * Return: Success: SUCCEED + * Failure: FAIL * - * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu - * July 31 2006 + * Programmer: Quincey Koziol + * koziol@ncsa.uiuc.edu + * July 31 2006 * * Changes: JRM -- 8/21/06 * Added the flags_ptr parameter. This parameter exists to * allow the flush routine to report to the cache if the * entry is resized or renamed as a result of the flush. * *flags_ptr is set to H5C_CALLBACK__NO_FLAGS_SET on entry. + * + * Mike McGreevy + * mcgreevy@hdfgroup.org + * May 29, 2008 + * Converted from H5FS_cache_sinfo_flush + * *------------------------------------------------------------------------- */ static herr_t -H5FS_cache_sinfo_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5FS_sinfo_t *sinfo, unsigned UNUSED * flags_ptr) +H5FS_cache_sinfo_serialize(const H5F_t * f, haddr_t UNUSED addr, size_t UNUSED len, + void *image, void *_thing, unsigned *flags, haddr_t UNUSED *new_addr, + size_t UNUSED *new_len, void UNUSED **new_image) { herr_t ret_value = SUCCEED; /* Return value */ + H5FS_sinfo_t * sinfo = (H5FS_sinfo_t *)_thing; + H5FS_iter_ud_t udata; /* User data for callbacks */ + uint8_t *p; /* Pointer into raw data buffer */ + uint32_t metadata_chksum; /* Computed metadata checksum value */ + unsigned bin; /* Current bin we are on */ - FUNC_ENTER_NOAPI_NOINIT(H5FS_cache_sinfo_flush) + FUNC_ENTER_NOAPI_NOINIT(H5FS_cache_sinfo_serialize) #ifdef QAK -HDfprintf(stderr, "%s: Flushing free space header, addr = %a, destroy = %u\n", FUNC, addr, (unsigned)destroy); -#endif /* QAK */ +HDFprintf(stderr, "%s: Serialize free space header, addr = %a\n", FUNC, addr); +#endif /* check arguments */ HDassert(f); - HDassert(H5F_addr_defined(addr)); + HDassert(image); HDassert(sinfo); HDassert(sinfo->fspace); HDassert(sinfo->fspace->sect_cls); + HDassert(flags); - if(sinfo->cache_info.is_dirty) { - H5FS_iter_ud_t udata; /* User data for callbacks */ - uint8_t *buf = NULL; /* Temporary raw data buffer */ - uint8_t *p; /* Pointer into raw data buffer */ - uint32_t metadata_chksum; /* Computed metadata checksum value */ - unsigned bin; /* Current bin we are on */ - - /* Sanity check address */ - if(H5F_addr_ne(addr, sinfo->fspace->sect_addr)) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTLOAD, FAIL, "incorrect address for free space sections") + /* Sanity check address */ + if(H5F_addr_ne(addr, sinfo->fspace->sect_addr)) + HGOTO_ERROR(H5E_FSPACE, H5E_CANTLOAD, FAIL, "incorrect address for free space sections") - /* Allocate temporary buffer */ - if((buf = H5FL_BLK_MALLOC(sect_block, (size_t)sinfo->fspace->sect_size)) == NULL) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + /* Allocate temporary buffer */ - p = buf; + p = image; - /* Magic number */ - HDmemcpy(p, H5FS_SINFO_MAGIC, (size_t)H5FS_SIZEOF_MAGIC); - p += H5FS_SIZEOF_MAGIC; + /* Magic number */ + HDmemcpy(p, H5FS_SINFO_MAGIC, (size_t)H5FS_SIZEOF_MAGIC); + p += H5FS_SIZEOF_MAGIC; - /* Version # */ - *p++ = H5FS_SINFO_VERSION; + /* Version # */ + *p++ = H5FS_SINFO_VERSION; - /* Address of free space header for these sections */ + /* Address of free space header for these sections */ #ifdef QAK HDfprintf(stderr, "%s: sinfo->fspace->addr = %a\n", FUNC, sinfo->fspace->addr); #endif /* QAK */ - H5F_addr_encode(f, &p, sinfo->fspace->addr); + H5F_addr_encode(f, &p, sinfo->fspace->addr); - /* Set up user data for iterator */ - udata.sinfo = sinfo; - udata.p = &p; - udata.sect_cnt_size = H5V_limit_enc_size((uint64_t)sinfo->fspace->serial_sect_count); + /* Set up user data for iterator */ + udata.sinfo = sinfo; + udata.p = &p; + udata.sect_cnt_size = H5V_limit_enc_size((uint64_t)sinfo->fspace->serial_sect_count); #ifdef QAK HDfprintf(stderr, "%s: udata.sect_cnt_size = %u\n", FUNC, udata.sect_cnt_size); #endif /* QAK */ - /* Iterate over all the bins */ + /* Iterate over all the bins */ #ifdef QAK HDfprintf(stderr, "%s: Serializing section bins\n", FUNC); #endif /* QAK */ - for(bin = 0; bin < sinfo->nbins; bin++) { - /* Check if there are any sections in this bin */ - if(sinfo->bins[bin].bin_list) { - /* Iterate over list of section size nodes for bin */ - if(H5SL_iterate(sinfo->bins[bin].bin_list, H5FS_sinfo_serialize_node_cb, &udata) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_BADITER, FAIL, "can't iterate over section size nodes") - } /* end if */ - } /* end for */ + for(bin = 0; bin < sinfo->nbins; bin++) { + /* Check if there are any sections in this bin */ + if(sinfo->bins[bin].bin_list) { + /* Iterate over list of section size nodes for bin */ + if(H5SL_iterate(sinfo->bins[bin].bin_list, H5FS_sinfo_serialize_node_cb, &udata) < 0) + HGOTO_ERROR(H5E_FSPACE, H5E_BADITER, FAIL, "can't iterate over section size nodes") + } /* end if */ + } /* end for */ - /* Compute checksum */ - metadata_chksum = H5_checksum_metadata(buf, (size_t)(p - buf), 0); + /* Compute checksum */ + metadata_chksum = H5_checksum_metadata(image, (size_t)((const uint8_t *)p - (const uint8_t *)image), 0); - /* Metadata checksum */ - UINT32ENCODE(p, metadata_chksum); + /* Metadata checksum */ + UINT32ENCODE(p, metadata_chksum); - /* Sanity check */ - HDassert((size_t)(p - buf) == sinfo->fspace->sect_size); - HDassert(sinfo->fspace->sect_size <= sinfo->fspace->alloc_sect_size); + /* Sanity check */ + HDassert((size_t)(p - (const uint8_t *)image) == sinfo->fspace->sect_size); + HDassert(sinfo->fspace->sect_size <= sinfo->fspace->alloc_sect_size); #ifdef QAK HDfprintf(stderr, "%s: sinfo->fspace->sect_size = %Hu\n", FUNC, sinfo->fspace->sect_size); HDfprintf(stderr, "%s: sinfo->fspace->alloc_sect_size = %Hu\n", FUNC, sinfo->fspace->alloc_sect_size); #endif /* QAK */ - /* Write buffer to disk */ - if(H5F_block_write(f, H5FD_MEM_FSPACE_SINFO, sinfo->fspace->sect_addr, (size_t)sinfo->fspace->sect_size, dxpl_id, buf) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTFLUSH, FAIL, "unable to save free space sections to disk") - - H5FL_BLK_FREE(sect_block, buf); - - sinfo->cache_info.is_dirty = FALSE; - } /* end if */ - - if(destroy) - if(H5FS_cache_sinfo_dest(f, sinfo) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "unable to destroy free space section info") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* H5FS_cache_sinfo_flush() */ - - -/*------------------------------------------------------------------------- - * Function: H5FS_sinfo_free_sect_cb - * - * Purpose: Free a size-tracking node for a bin - * - * Return: Success: non-negative - * Failure: negative - * - * Programmer: Quincey Koziol - * Saturday, March 11, 2006 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5FS_sinfo_free_sect_cb(void *_sect, void UNUSED *key, void *op_data) -{ - H5FS_section_info_t *sect = (H5FS_section_info_t *)_sect; /* Section to free */ - const H5FS_sinfo_t *sinfo = (const H5FS_sinfo_t *)op_data; /* Free space manager for section */ - - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5FS_sinfo_free_sect_cb) - - HDassert(sect); - HDassert(sinfo); - - /* Call the section's class 'free' method on the section */ - (*sinfo->fspace->sect_cls[sect->type].free)(sect); - - FUNC_LEAVE_NOAPI(0) -} /* H5FS_sinfo_free_sect_cb() */ - - -/*------------------------------------------------------------------------- - * Function: H5FS_sinfo_free_node_cb - * - * Purpose: Free a size-tracking node for a bin - * - * Return: Success: non-negative - * - * Failure: negative - * - * Programmer: Quincey Koziol - * Saturday, March 11, 2006 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5FS_sinfo_free_node_cb(void *item, void UNUSED *key, void *op_data) -{ - H5FS_node_t *fspace_node = (H5FS_node_t *)item; /* Temporary pointer to free space list node */ - - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5FS_sinfo_free_node_cb) - - HDassert(fspace_node); - HDassert(op_data); - - /* Release the skip list for sections of this size */ - H5SL_destroy(fspace_node->sect_list, H5FS_sinfo_free_sect_cb, op_data); - - /* Release free space list node */ - H5FL_FREE(H5FS_node_t, fspace_node); - - FUNC_LEAVE_NOAPI(0) -} /* H5FS_sinfo_free_node_cb() */ - - -/*------------------------------------------------------------------------- - * Function: H5FS_cache_sinfo_dest - * - * Purpose: Destroys a free space section info in memory. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu - * July 31 2006 - * - *------------------------------------------------------------------------- - */ -/* ARGSUSED */ -herr_t -H5FS_cache_sinfo_dest(H5F_t *f, H5FS_sinfo_t *sinfo) -{ - unsigned u; /* Local index variable */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI_NOINIT(H5FS_cache_sinfo_dest) - - /* - * Check arguments. - */ - HDassert(sinfo); - HDassert(sinfo->fspace); - HDassert(sinfo->bins); - - /* Clear out lists of nodes */ - for(u = 0; u < sinfo->nbins; u++) - if(sinfo->bins[u].bin_list) { - H5SL_destroy(sinfo->bins[u].bin_list, H5FS_sinfo_free_node_cb, sinfo); - sinfo->bins[u].bin_list = NULL; - } /* end if */ - - /* Release bins for skip lists */ - sinfo->bins = H5FL_SEQ_FREE(H5FS_bin_t, sinfo->bins); - - /* Release skip list for merging sections */ - if(sinfo->merge_list) - if(H5SL_close(sinfo->merge_list) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTCLOSEOBJ, FAIL, "can't destroy section merging skip list") - - /* Unpin the free space header in the cache */ - /* (make certain this is last action with section info, to allow for header - * disappearing immediately) - */ - if(H5AC_unpin_entry(f, sinfo->fspace) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTUNPIN, FAIL, "unable to unpin free space header") - - /* Release free space section info */ - H5FL_FREE(H5FS_sinfo_t, sinfo); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FS_cache_sinfo_dest() */ - - -/*------------------------------------------------------------------------- - * Function: H5FS_cache_sinfo_clear - * - * Purpose: Mark a free space section info in memory as non-dirty. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu - * July 31 2006 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5FS_cache_sinfo_clear(H5F_t *f, H5FS_sinfo_t *sinfo, hbool_t destroy) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI_NOINIT(H5FS_cache_sinfo_clear) - - /* - * Check arguments. - */ - HDassert(sinfo); - - /* Reset the dirty flag. */ - sinfo->cache_info.is_dirty = FALSE; + /* Sanity check */ + HDassert((size_t)((const uint8_t *)p - (const uint8_t *)image) <= len); - if(destroy) - if(H5FS_cache_sinfo_dest(f, sinfo) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "unable to destroy free space section info") + /* Reset the cache flags for this operation */ + *flags = 0; done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FS_cache_sinfo_clear() */ +} /* H5FS_cache_sinfo_serialize() */ /*------------------------------------------------------------------------- - * Function: H5FS_cache_sinfo_size + * Function: H5FS_cache_sinfo_free_icr * - * Purpose: Compute the size in bytes of a free space section info - * on disk, and return it in *size_ptr. On failure, - * the value of *size_ptr is undefined. + * Purpose: Destroy/release an "in core representation" of a data structure * - * Return: Non-negative on success/Negative on failure + * Return: Success: SUCCEED + * Failure: FAIL * - * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu - * July 31 2006 + * Programmer: Mike McGreevy + * mcgreevy@hdfgroup.org + * May 29, 2008 * *------------------------------------------------------------------------- */ static herr_t -H5FS_cache_sinfo_size(const H5F_t UNUSED *f, const H5FS_sinfo_t *sinfo, size_t *size_ptr) +H5FS_cache_sinfo_free_icr(haddr_t UNUSED addr, size_t UNUSED len, void *thing) { - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5FS_cache_sinfo_size) + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5FS_cache_sinfo_free_icr) - /* check arguments */ - HDassert(sinfo); - HDassert(size_ptr); + /* Check arguments */ + HDassert(thing); - /* Set size value */ - H5_ASSIGN_OVERFLOW(/* To: */ *size_ptr, /* From: */ sinfo->fspace->sect_size, /* From: */ hsize_t, /* To: */ size_t); + /* Destroy B-tree node */ + H5FS_cache_sinfo_dest(thing); FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5FS_cache_sinfo_size() */ - +} diff --git a/src/H5FSdbg.c b/src/H5FSdbg.c index 0ac7b3b..83da767 100644 --- a/src/H5FSdbg.c +++ b/src/H5FSdbg.c @@ -93,6 +93,7 @@ H5FS_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, int H5FS_t *fspace = NULL; /* Free space header info */ H5FS_prot_t fs_prot; /* Information for protecting free space manager */ herr_t ret_value = SUCCEED; /* Return value */ + H5FS_hdr_cache_ud_t cache_udata; /* User-data for cache callback */ FUNC_ENTER_NOAPI(H5FS_debug, FAIL) @@ -109,11 +110,13 @@ H5FS_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, int fs_prot.nclasses = 0; fs_prot.classes = NULL; fs_prot.cls_init_udata = NULL; + cache_udata.fs_prot = &fs_prot; + cache_udata.f = f; /* * Load the free space header. */ - if(NULL == (fspace = H5AC_protect(f, dxpl_id, H5AC_FSPACE_HDR, addr, &fs_prot, NULL, H5AC_READ))) + if(NULL == (fspace = H5AC2_protect(f, dxpl_id, H5AC2_FSPACE_HDR, addr, H5FS_HEADER_SIZE(f), &cache_udata, H5AC2_READ))) HGOTO_ERROR(H5E_FSPACE, H5E_CANTLOAD, FAIL, "unable to load free space header") /* Print opening message */ @@ -163,7 +166,7 @@ H5FS_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, int fspace->alloc_sect_size); done: - if(fspace && H5AC_unprotect(f, dxpl_id, H5AC_FSPACE_HDR, addr, fspace, H5AC__NO_FLAGS_SET) < 0) + if(fspace && H5AC2_unprotect(f, dxpl_id, H5AC2_FSPACE_HDR, addr, (size_t)0, fspace, H5AC2__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_FSPACE, H5E_PROTECT, FAIL, "unable to release free space header") FUNC_LEAVE_NOAPI(ret_value) @@ -230,6 +233,7 @@ H5FS_sects_debug(H5F_t *f, hid_t dxpl_id, haddr_t UNUSED addr, FILE *stream, int H5FS_prot_t fs_prot; /* Information for protecting free space manager */ H5FS_client_t client; /* The client of the free space */ herr_t ret_value = SUCCEED; /* Return value */ + H5FS_hdr_cache_ud_t cache_udata; /* User-data for cache callback */ FUNC_ENTER_NOAPI(H5FS_sects_debug, FAIL) @@ -248,18 +252,20 @@ H5FS_sects_debug(H5F_t *f, hid_t dxpl_id, haddr_t UNUSED addr, FILE *stream, int fs_prot.nclasses = 0; fs_prot.classes = NULL; fs_prot.cls_init_udata = NULL; + cache_udata.fs_prot = &fs_prot; + cache_udata.f = f; /* * Load the free space header. */ - if(NULL == (fspace = H5AC_protect(f, dxpl_id, H5AC_FSPACE_HDR, fs_addr, &fs_prot, NULL, H5AC_READ))) + if(NULL == (fspace = H5AC2_protect(f, dxpl_id, H5AC2_FSPACE_HDR, fs_addr, H5FS_HEADER_SIZE(f), &cache_udata, H5AC2_READ))) HGOTO_ERROR(H5E_FSPACE, H5E_CANTLOAD, FAIL, "unable to load free space header") /* Retrieve the client id */ client = fspace->client; /* Release the free space header */ - if(H5AC_unprotect(f, dxpl_id, H5AC_FSPACE_HDR, fs_addr, fspace, H5AC__NO_FLAGS_SET) < 0) + if(H5AC2_unprotect(f, dxpl_id, H5AC2_FSPACE_HDR, fs_addr, (size_t)0, fspace, H5AC2__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_FSPACE, H5E_PROTECT, FAIL, "unable to release free space header") fspace = NULL; @@ -281,7 +287,7 @@ H5FS_sects_debug(H5F_t *f, hid_t dxpl_id, haddr_t UNUSED addr, FILE *stream, int } /* end switch */ done: - if(fspace && H5AC_unprotect(f, dxpl_id, H5AC_FSPACE_HDR, fs_addr, fspace, H5AC__NO_FLAGS_SET) < 0) + if(fspace && H5AC2_unprotect(f, dxpl_id, H5AC2_FSPACE_HDR, fs_addr, (size_t)0, fspace, H5AC2__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_FSPACE, H5E_PROTECT, FAIL, "unable to release free space header") FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5FSpkg.h b/src/H5FSpkg.h index 9119902..2ed1996 100644 --- a/src/H5FSpkg.h +++ b/src/H5FSpkg.h @@ -35,7 +35,7 @@ #include "H5FSprivate.h" /* File free space */ /* Other private headers needed by this file */ -#include "H5ACprivate.h" /* Metadata cache */ +#include "H5AC2private.h" /* Metadata cache */ #include "H5SLprivate.h" /* Skip lists */ /**************************/ @@ -101,6 +101,19 @@ typedef struct H5FS_prot_t { void *cls_init_udata; /* Pointer to class init user data */ } H5FS_prot_t; +/* Callback info for loading a free space header into the cache */ +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 */ +} H5FS_hdr_cache_ud_t; + +/* Callback info for loading free space section info into the cache */ +typedef struct H5FS_sinfo_cache_ud_t { + H5F_t *f; /* File that free space section info is within */ + H5FS_t *fspace; /* free space manager */ + hid_t dxpl_id; +} H5FS_sinfo_cache_ud_t; + /* Free space section bin info */ typedef struct H5FS_bin_t { size_t tot_sect_count; /* Total # of sections in this bin */ @@ -120,7 +133,7 @@ typedef struct H5FS_node_t { /* Information about sections managed */ typedef struct H5FS_sinfo_t { /* Information for H5AC cache functions, _must_ be first field in structure */ - H5AC_info_t cache_info; + H5AC2_info_t cache_info; /* Stored information */ H5FS_bin_t *bins; /* Array of lists of lists of free sections */ @@ -143,7 +156,7 @@ typedef struct H5FS_sinfo_t { /* Main free space info */ struct H5FS_t { /* Information for H5AC cache functions, _must_ be first field in structure */ - H5AC_info_t cache_info; + H5AC2_info_t cache_info; /* Stored information */ /* Statistics about sections managed */ @@ -179,10 +192,10 @@ struct H5FS_t { /*****************************/ /* H5FS header inherits cache-like properties from H5AC */ -H5_DLLVAR const H5AC_class_t H5AC_FSPACE_HDR[1]; +H5_DLLVAR const H5AC2_class_t H5AC2_FSPACE_HDR[1]; /* H5FS section info inherits cache-like properties from H5AC */ -H5_DLLVAR const H5AC_class_t H5AC_FSPACE_SINFO[1]; +H5_DLLVAR const H5AC2_class_t H5AC2_FSPACE_SINFO[1]; /* Declare a free list to manage the H5FS_node_t struct */ H5FL_EXTERN(H5FS_node_t); @@ -215,8 +228,8 @@ H5_DLL herr_t H5FS_sects_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, int fwidth, haddr_t fs_addr, haddr_t client_addr); /* Metadata cache callbacks */ -H5_DLL herr_t H5FS_cache_hdr_dest(H5F_t *f, H5FS_t *hdr); -H5_DLL herr_t H5FS_cache_sinfo_dest(H5F_t *f, H5FS_sinfo_t *sinfo); +H5_DLL herr_t H5FS_cache_hdr_dest(H5FS_t *hdr); +H5_DLL herr_t H5FS_cache_sinfo_dest(H5FS_sinfo_t *sinfo); /* Sanity check routines */ #ifdef H5FS_DEBUG diff --git a/src/H5FSsection.c b/src/H5FSsection.c index 34da067..05a2dfd 100644 --- a/src/H5FSsection.c +++ b/src/H5FSsection.c @@ -26,7 +26,6 @@ /****************/ #define H5FS_PACKAGE /*suppress error about including H5FSpkg */ - /***********/ /* Headers */ /***********/ @@ -185,6 +184,7 @@ H5FS_sinfo_pin(H5F_t *f, hid_t dxpl_id, H5FS_t *fspace) { H5FS_sinfo_t *sinfo; /* Section information struct created */ H5FS_sinfo_t *ret_value; /* Return value */ + H5FS_sinfo_cache_ud_t cache_udata; /* User-data for cache callback */ FUNC_ENTER_NOAPI_NOINIT(H5FS_sinfo_pin) #ifdef QAK @@ -219,27 +219,32 @@ HDfprintf(stderr, "%s: New section info, addr = %a, size = %Hu\n", FUNC, fspace- #endif /* QAK */ /* Cache the new free space section info (pinned) */ - if(H5AC_set(f, dxpl_id, H5AC_FSPACE_SINFO, fspace->sect_addr, sinfo, H5AC__PIN_ENTRY_FLAG) < 0) + if(H5AC2_set(f, dxpl_id, H5AC2_FSPACE_SINFO, fspace->sect_addr, (size_t)fspace->alloc_sect_size, sinfo, H5AC2__PIN_ENTRY_FLAG) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTINIT, NULL, "can't add free space sections to cache") /* Mark free space header as dirty */ - if(H5AC_mark_pinned_or_protected_entry_dirty(f, fspace) < 0) + if(H5AC2_mark_pinned_or_protected_entry_dirty(f, fspace) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, NULL, "unable to mark free space header as dirty") } /* end if */ else { #ifdef QAK HDfprintf(stderr, "%s: Reading in existing sections, fspace->sect_addr = %a\n", FUNC, fspace->sect_addr); #endif /* QAK */ + + cache_udata.fspace = fspace; + cache_udata.f = f; + cache_udata.dxpl_id = dxpl_id; + /* Protect the free space sections */ - if(NULL == (sinfo = H5AC_protect(f, dxpl_id, H5AC_FSPACE_SINFO, fspace->sect_addr, NULL, fspace, H5AC_WRITE))) + if(NULL == (sinfo = H5AC2_protect(f, dxpl_id, H5AC2_FSPACE_SINFO, fspace->sect_addr, (size_t)fspace->alloc_sect_size, &cache_udata, H5AC2_WRITE))) HGOTO_ERROR(H5E_FSPACE, H5E_CANTPROTECT, NULL, "unable to load free space sections") /* Pin them in the cache */ - if(H5AC_pin_protected_entry(f, sinfo) < 0) + if(H5AC2_pin_protected_entry(f, sinfo) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTPIN, NULL, "unable to pin free space sections") /* Unlock free space sections, now pinned */ - if(H5AC_unprotect(f, dxpl_id, H5AC_FSPACE_SINFO, fspace->sect_addr, sinfo, H5AC__NO_FLAGS_SET) < 0) + if(H5AC2_unprotect(f, dxpl_id, H5AC2_FSPACE_SINFO, fspace->sect_addr, (size_t)0, sinfo, H5AC2__NO_FLAGS_SET) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTUNPROTECT, NULL, "unable to release free space sections") } /* end else */ #ifdef QAK @@ -302,7 +307,7 @@ H5FS_sect_increase(H5F_t *f, hid_t dxpl_id, H5FS_t *fspace, /* Increment amount of space required to serialize all sections */ #ifdef QAK -HDfprintf(stderr, "%s: sinfo->serial_size = %Zu\n", FUNC, sinfo->serial_size); +HDfprintf(stderr, "%s: sinfo->serial_size = %Zu\n", FUNC, fspace->sinfo->serial_size); HDfprintf(stderr, "%s: cls->serial_size = %Zu\n", FUNC, cls->serial_size); #endif /* QAK */ fspace->sinfo->serial_size += cls->serial_size; @@ -316,7 +321,7 @@ HDfprintf(stderr, "%s: cls->serial_size = %Zu\n", FUNC, cls->serial_size); } /* end else */ /* Mark free space header as dirty */ - if(H5AC_mark_pinned_or_protected_entry_dirty(f, fspace) < 0) + if(H5AC2_mark_pinned_or_protected_entry_dirty(f, fspace) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, FAIL, "unable to mark free space header as dirty") done: @@ -368,7 +373,7 @@ H5FS_sect_decrease(H5F_t *f, hid_t dxpl_id, H5FS_t *fspace, const H5FS_section_c /* Decrement amount of space required to serialize all sections */ #ifdef QAK -HDfprintf(stderr, "%s: fspace->serial_size = %Zu\n", FUNC, fspace->serial_size); +HDfprintf(stderr, "%s: fspace->serial_size = %Zu\n", FUNC, fspace->sinfo->serial_size); HDfprintf(stderr, "%s: cls->serial_size = %Zu\n", FUNC, cls->serial_size); #endif /* QAK */ fspace->sinfo->serial_size -= cls->serial_size; @@ -379,7 +384,7 @@ HDfprintf(stderr, "%s: cls->serial_size = %Zu\n", FUNC, cls->serial_size); } /* end else */ /* Mark free space header as dirty */ - if(H5AC_mark_pinned_or_protected_entry_dirty(f, fspace) < 0) + if(H5AC2_mark_pinned_or_protected_entry_dirty(f, fspace) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, FAIL, "unable to mark free space header as dirty") done: @@ -420,7 +425,7 @@ H5FS_size_node_decr(H5FS_sinfo_t *sinfo, unsigned bin, H5FS_node_t *fspace_node, sinfo->bins[bin].tot_sect_count--; #ifdef QAK HDfprintf(stderr, "%s: sinfo->bins[%u].sect_count = %Zu\n", FUNC, bin, sinfo->bins[bin].sect_count); -#endif /* QAK */ +#endif /* Check for 'ghost' or 'serializable' section */ if(cls->flags & H5FS_CLS_GHOST_OBJ) { @@ -584,7 +589,7 @@ HDfprintf(stderr, "%s: fspace->tot_space = %Hu\n", FUNC, fspace->tot_space); fspace->tot_space -= sect->size; /* Mark free space sections as changed */ - if(H5AC_mark_pinned_or_protected_entry_dirty(f, fspace->sinfo) < 0) + if(H5AC2_mark_pinned_or_protected_entry_dirty(f, fspace->sinfo) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, FAIL, "unable to mark free space sections as dirty") done: @@ -706,7 +711,8 @@ HDfprintf(stderr, "%s: sect->size = %Hu, sect->addr = %a\n", FUNC, sect->size, s */ #ifdef QAK HDfprintf(stderr, "%s: sinfo->bins[%u].sect_count = %Zu\n", FUNC, bin, sinfo->bins[bin].sect_count); -#endif /* QAK */ +#endif + sinfo->bins[bin].tot_sect_count++; if(cls->flags & H5FS_CLS_GHOST_OBJ) { sinfo->bins[bin].ghost_sect_count++; @@ -1090,12 +1096,12 @@ HDfprintf(stderr, "%s: Returning space\n", FUNC); HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, "can't insert free space section into skip list") #ifdef QAK -HDfprintf(stderr, "%s: fspace->hdr->tot_space = %Hu\n", FUNC, fspace->hdr->tot_space); +HDfprintf(stderr, "%s: fspace->hdr->tot_space = %Hu\n", FUNC, fspace->tot_space); #endif /* QAK */ /* Mark free space sections as changed */ /* (if adding sections while deserializing sections, don't set the flag) */ if(!(flags & H5FS_ADD_DESERIALIZING)) { - if(H5AC_mark_pinned_or_protected_entry_dirty(f, fspace->sinfo) < 0) + if(H5AC2_mark_pinned_or_protected_entry_dirty(f, fspace->sinfo) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, FAIL, "unable to mark free space sections as dirty") } /* end if */ @@ -1328,6 +1334,7 @@ HDfprintf(stderr, "%s: fspace->alloc_sect_size = %Hu\n", FUNC, fspace->alloc_sec if(fspace->sect_size > fspace->alloc_sect_size) { size_t new_size; /* New size of space for serialized sections */ haddr_t old_addr; /* Old address of serialized sections */ + hsize_t old_alloc_sect_size; /* Old size of section info */ /* Currently, the old block data is "thrown away" after the space is reallocated, * so avoid data copy in H5MF_realloc() call by just free'ing the space and @@ -1340,6 +1347,7 @@ HDfprintf(stderr, "%s: fspace->alloc_sect_size = %Hu\n", FUNC, fspace->alloc_sec */ /* Free previous serialized sections disk space */ old_addr = fspace->sect_addr; + old_alloc_sect_size = fspace->alloc_sect_size; if(H5MF_xfree(f, H5FD_MEM_FSPACE_SINFO, dxpl_id, old_addr, fspace->alloc_sect_size) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "unable to free free space sections") @@ -1360,24 +1368,31 @@ HDfprintf(stderr, "%s: fspace->sect_size = %Hu\n", FUNC, fspace->sect_size); HDfprintf(stderr, "%s: old_addr = %a, fspace->sect_addr = %a\n", FUNC, old_addr, fspace->sect_addr); #endif /* QAK */ + /* Resize pinned section info in the cache, if its changed size */ + if(old_alloc_sect_size != fspace->alloc_sect_size) { + if(H5AC2_resize_pinned_entry(f, fspace->sinfo, (size_t)fspace->alloc_sect_size) < 0) + HGOTO_ERROR(H5E_FSPACE, H5E_CANTRESIZE, FAIL, "unable to resize free space section info") + } /* end if */ + /* Move object in cache, if it actually was relocated */ if(H5F_addr_ne(fspace->sect_addr, old_addr)) { - if(H5AC_rename(f, H5AC_FSPACE_SINFO, old_addr, fspace->sect_addr) < 0) + if(H5AC2_rename(f, H5AC2_FSPACE_SINFO, old_addr, fspace->sect_addr) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTRENAME, FAIL, "unable to move free space section info") } /* end if */ else { /* Mark free space section as dirty */ - if(H5AC_mark_pinned_or_protected_entry_dirty(f, fspace->sinfo) < 0) + if(H5AC2_mark_pinned_or_protected_entry_dirty(f, fspace->sinfo) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, FAIL, "unable to mark free space section info as dirty") } /* end else */ /* Mark free space header as dirty */ - if(H5AC_mark_pinned_or_protected_entry_dirty(f, fspace) < 0) + if(H5AC2_mark_pinned_or_protected_entry_dirty(f, fspace) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, FAIL, "unable to mark free space header as dirty") } /* end if */ else { size_t decrease_threshold; /* Size threshold for decreasing serialized section size */ haddr_t old_addr; /* Old address of serialized sections */ + hsize_t old_alloc_sect_size; /* Old size of section info */ /* Compute the threshold for decreasing the sections' serialized size */ decrease_threshold = (size_t)(((size_t)fspace->alloc_sect_size * (double)fspace->shrink_percent) / 100.0); @@ -1397,6 +1412,7 @@ HDfprintf(stderr, "%s: old_addr = %a, fspace->sect_addr = %a\n", FUNC, old_addr, */ /* Free previous serialized sections disk space */ old_addr = fspace->sect_addr; + old_alloc_sect_size = fspace->alloc_sect_size; if(H5MF_xfree(f, H5FD_MEM_FSPACE_SINFO, dxpl_id, old_addr, fspace->alloc_sect_size) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "unable to free free space sections") @@ -1417,19 +1433,25 @@ HDfprintf(stderr, "%s: Allocating space for smaller serialized sections, new_siz if(HADDR_UNDEF == (fspace->sect_addr = H5MF_alloc(f, H5FD_MEM_FSPACE_SINFO, dxpl_id, (hsize_t)fspace->alloc_sect_size))) HGOTO_ERROR(H5E_FSPACE, H5E_NOSPACE, FAIL, "file allocation failed for free space sections") + /* Resize pinned section info in the cache, if its changed size */ + if(old_alloc_sect_size != fspace->alloc_sect_size) { + if(H5AC2_resize_pinned_entry(f, fspace->sinfo, (size_t)fspace->alloc_sect_size) < 0) + HGOTO_ERROR(H5E_FSPACE, H5E_CANTRESIZE, FAIL, "unable to resize free space section info") + } /* end if */ + /* Move object in cache, if it actually was relocated */ if(H5F_addr_ne(fspace->sect_addr, old_addr)) { - if(H5AC_rename(f, H5AC_FSPACE_SINFO, old_addr, fspace->sect_addr) < 0) + if(H5AC2_rename(f, H5AC2_FSPACE_SINFO, old_addr, fspace->sect_addr) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTRENAME, FAIL, "unable to move free space section info") } /* end if */ else { /* Mark free space section as dirty */ - if(H5AC_mark_pinned_or_protected_entry_dirty(f, fspace->sinfo) < 0) + if(H5AC2_mark_pinned_or_protected_entry_dirty(f, fspace->sinfo) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, FAIL, "unable to mark free space section info as dirty") } /* end else */ /* Mark free space header as dirty */ - if(H5AC_mark_pinned_or_protected_entry_dirty(f, fspace) < 0) + if(H5AC2_mark_pinned_or_protected_entry_dirty(f, fspace) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, FAIL, "unable to mark free space header as dirty") } /* end if */ } /* end else */ @@ -1768,7 +1790,7 @@ HDfprintf(stderr, "%s: removing object from merge list, sect->type = %u\n", FUNC HGOTO_ERROR(H5E_FSPACE, H5E_CANTCOMPUTE, FAIL, "can't adjust free space section size on disk") /* Mark free space sections as dirty */ - if(H5AC_mark_pinned_or_protected_entry_dirty(f, fspace->sinfo) < 0) + if(H5AC2_mark_pinned_or_protected_entry_dirty(f, fspace->sinfo) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, FAIL, "unable to mark free space sections as dirty") done: -- cgit v0.12