diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/H5FS.c | 290 | ||||
-rw-r--r-- | src/H5FScache.c | 26 | ||||
-rw-r--r-- | src/H5FSdbg.c | 121 | ||||
-rw-r--r-- | src/H5FSpkg.h | 16 | ||||
-rw-r--r-- | src/H5FSprivate.h | 18 | ||||
-rw-r--r-- | src/H5FSpublic.h | 2 | ||||
-rw-r--r-- | src/H5FSsection.c | 360 | ||||
-rw-r--r-- | src/H5FSstat.c | 12 | ||||
-rw-r--r-- | src/H5FStest.c | 27 |
9 files changed, 395 insertions, 477 deletions
@@ -14,12 +14,12 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu> + * Programmer: Quincey Koziol <koziol@hdfgroup.org> * Tuesday, May 2, 2006 * - * Purpose: Free space tracking functions. + * Purpose: Free space tracking functions. * - * Note: (Used to be in the H5HFflist.c file, prior to the date above) + * Note: (Used to be in the H5HFflist.c file, prior to the date above) * */ @@ -33,11 +33,11 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5ACprivate.h" /* Metadata cache */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5FSpkg.h" /* File free space */ -#include "H5MFprivate.h" /* File memory management */ +#include "H5private.h" /* Generic Functions */ +#include "H5ACprivate.h" /* Metadata cache */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FSpkg.h" /* File free space */ +#include "H5MFprivate.h" /* File memory management */ /****************/ @@ -90,21 +90,16 @@ H5FL_DEFINE(H5FS_t); /*------------------------------------------------------------------------- - * Function: H5FS_create + * Function: H5FS_create * - * Purpose: Allocate & initialize file free space info + * Purpose: Allocate & initialize file free space info * - * Return: Success: Pointer to free space structure + * Return: Success: Pointer to free space structure + * Failure: NULL * - * Failure: NULL - * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, March 7, 2006 * - * Modifications: - * Vailin Choi, July 29th, 2008 - * Add two more parameters for handling alignment: alignment & threshhold - * *------------------------------------------------------------------------- */ H5FS_t * @@ -129,7 +124,7 @@ HDfprintf(stderr, "%s: Creating free space manager, nclasses = %Zu\n", FUNC, ncl * Allocate free space structure */ if(NULL == (fspace = H5FS__new(f, nclasses, classes, cls_init_udata))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for free space free list") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for free space free list") /* Initialize creation information for free space manager */ fspace->client = fs_create->client; @@ -177,31 +172,25 @@ HDfprintf(stderr, "%s: Leaving, ret_value = %d\n", FUNC, ret_value); /*------------------------------------------------------------------------- - * Function: H5FS_open + * Function: H5FS_open * - * Purpose: Open an existing file free space info structure on disk + * Purpose: Open an existing file free space info structure on disk * - * Return: Success: Pointer to free space structure + * Return: Success: Pointer to free space structure + * Failure: NULL * - * Failure: NULL - * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, May 2, 2006 * - * Modfications: - * - * Vailin Choi, July 29th, 2008 - * Add two more parameters for handling alignment: alignment & threshhold - * *------------------------------------------------------------------------- */ H5FS_t * H5FS_open(H5F_t *f, hid_t dxpl_id, haddr_t fs_addr, uint16_t nclasses, const H5FS_section_class_t *classes[], void *cls_init_udata, hsize_t alignment, hsize_t threshold) { - H5FS_t *fspace = NULL; /* New free space structure */ - H5FS_hdr_cache_ud_t cache_udata; /* User-data for metadata cache callback */ - H5FS_t *ret_value = NULL; /* Return value */ + H5FS_t *fspace = NULL; /* New free space structure */ + H5FS_hdr_cache_ud_t cache_udata; /* User-data for metadata cache callback */ + H5FS_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_TAG(dxpl_id, H5AC__FREESPACE_TAG, NULL) #ifdef H5FS_DEBUG @@ -252,15 +241,13 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_delete + * Function: H5FS_delete * - * Purpose: Delete a free space manager on disk + * Purpose: Delete a free space manager on disk * - * Return: Success: non-negative + * Return: SUCCEED/FAIL * - * Failure: negative - * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, May 30, 2006 * *------------------------------------------------------------------------- @@ -404,16 +391,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_close + * Function: H5FS_close * - * Purpose: Destroy & deallocate free list structure, serializing sections + * Purpose: Destroy & deallocate free list structure, serializing sections * in the bins * - * Return: Success: non-negative - * - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, March 7, 2006 * *------------------------------------------------------------------------- @@ -467,9 +452,9 @@ HDfprintf(stderr, "%s: Real sections to store in file\n", FUNC); HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, FAIL, "unable to mark free space header as dirty") } /* end if */ } /* end if */ - else - /* Sanity check that section info has address */ - HDassert(H5F_addr_defined(fspace->sect_addr)); + else + /* Sanity check that section info has address */ + HDassert(H5F_addr_defined(fspace->sect_addr)); /* Cache the free space section info */ if(H5AC_insert_entry(f, dxpl_id, H5AC_FSPACE_SINFO, fspace->sect_addr, fspace->sinfo, H5AC__NO_FLAGS_SET) < 0) @@ -591,12 +576,12 @@ HDfprintf(stderr, "%s: Leaving, ret_value = %d, fspace->rc = %u\n", FUNC, ret_va /*------------------------------------------------------------------------- * Function: H5FS__new * - * Purpose: Create new free space manager structure + * Purpose: Create new free space manager structure * - * Return: Success: non-NULL, pointer to new free space manager struct - * Failure: NULL + * Return: Success: non-NULL, pointer to new free space manager struct + * Failure: NULL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Monday, July 31, 2006 * *------------------------------------------------------------------------- @@ -618,7 +603,7 @@ H5FS__new(const H5F_t *f, uint16_t nclasses, const H5FS_section_class_t *classes * Allocate free space structure */ if(NULL == (fspace = H5FL_CALLOC(H5FS_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for free space free list") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for free space free list") /* Set immutable free list parameters */ H5_CHECKED_ASSIGN(fspace->nclasses, unsigned, nclasses, size_t); @@ -673,8 +658,7 @@ done: * * Purpose: Collect meta storage info used by the free space manager * - * Return: Success: non-negative - * Failure: negative + * Return: SUCCEED (Can't fail) * * Programmer: Vailin Choi * June 19, 2007 @@ -705,8 +689,7 @@ H5FS_size(const H5F_t *f, const H5FS_t *fspace, hsize_t *meta_size) * * Purpose: Increment reference count on free space header * - * Return: Success: non-negative - * Failure: negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * February 7, 2008 @@ -746,8 +729,7 @@ done: * * Purpose: Decrement reference count on free space header * - * Return: Success: non-negative - * Failure: negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * February 7, 2008 @@ -790,15 +772,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_dirty + * Function: H5FS_dirty * - * Purpose: Mark free space header as dirty + * Purpose: Mark free space header as dirty * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Feb 14 2008 + * Programmer: Quincey Koziol + * Feb 14 2008 * *------------------------------------------------------------------------- */ @@ -827,20 +808,21 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_alloc_hdr() + * Function: H5FS_alloc_hdr() * - * Purpose: Allocate space for the free-space manager header + * Purpose: Allocate space for the free-space manager header * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi; Feb 2009 + * Programmer: Vailin Choi + * Feb 2009 * *------------------------------------------------------------------------- */ herr_t H5FS_alloc_hdr(H5F_t *f, H5FS_t *fspace, haddr_t *fs_addr, hid_t dxpl_id) { - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_TAG(dxpl_id, H5AC__FREESPACE_TAG, FAIL) @@ -849,17 +831,17 @@ H5FS_alloc_hdr(H5F_t *f, H5FS_t *fspace, haddr_t *fs_addr, hid_t dxpl_id) HDassert(fspace); if(!H5F_addr_defined(fspace->addr)) { - /* Allocate space for the free space header */ - if(HADDR_UNDEF == (fspace->addr = H5MF_alloc(f, H5FD_MEM_FSPACE_HDR, dxpl_id, (hsize_t)H5FS_HEADER_SIZE(f)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "file allocation failed for free space header") + /* Allocate space for the free space header */ + if(HADDR_UNDEF == (fspace->addr = H5MF_alloc(f, H5FD_MEM_FSPACE_HDR, dxpl_id, (hsize_t)H5FS_HEADER_SIZE(f)))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "file allocation failed for free space header") - /* Cache the new free space header (pinned) */ - if(H5AC_insert_entry(f, dxpl_id, H5AC_FSPACE_HDR, fspace->addr, fspace, H5AC__PIN_ENTRY_FLAG) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTINIT, FAIL, "can't add free space header to cache") + /* Cache the new free space header (pinned) */ + if(H5AC_insert_entry(f, dxpl_id, H5AC_FSPACE_HDR, fspace->addr, fspace, H5AC__PIN_ENTRY_FLAG) < 0) + HGOTO_ERROR(H5E_FSPACE, H5E_CANTINIT, FAIL, "can't add free space header to cache") } /* end if */ if(fs_addr) - *fs_addr = fspace->addr; + *fs_addr = fspace->addr; done: FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) @@ -867,20 +849,21 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_alloc_sect() + * Function: H5FS_alloc_sect() * - * Purpose: Allocate space for the free-space manager section info header + * Purpose: Allocate space for the free-space manager section info header * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi; Feb 2009 + * Programmer: Vailin Choi + * Feb 2009 * *------------------------------------------------------------------------- */ herr_t H5FS_alloc_sect(H5F_t *f, H5FS_t *fspace, hid_t dxpl_id) { - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_TAG(dxpl_id, H5AC__FREESPACE_TAG, FAIL) @@ -889,22 +872,22 @@ H5FS_alloc_sect(H5F_t *f, H5FS_t *fspace, hid_t dxpl_id) HDassert(fspace); if(!H5F_addr_defined(fspace->sect_addr) && fspace->sinfo && fspace->serial_sect_count > 0) { - /* Allocate space for section info from aggregator/vfd (or temp. address space) */ + /* Allocate space for section info from aggregator/vfd (or temp. address space) */ /* (The original version called H5MF_alloc(), but that may cause sect_size to change again) */ /* (This routine is only called during file close operations, so don't allocate from temp. address space) */ if(HADDR_UNDEF == (fspace->sect_addr = H5MF_aggr_vfd_alloc(f, H5FD_MEM_FSPACE_SINFO, dxpl_id, fspace->sect_size))) HGOTO_ERROR(H5E_FSPACE, H5E_NOSPACE, FAIL, "file allocation failed for section info") - fspace->alloc_sect_size = fspace->sect_size; + fspace->alloc_sect_size = fspace->sect_size; - /* Mark free-space header as dirty */ - if(H5FS_dirty(fspace) < 0) + /* Mark free-space header as dirty */ + if(H5FS_dirty(fspace) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, FAIL, "unable to mark free space header as dirty") - /* Cache the free-space section info */ - if(H5AC_insert_entry(f, dxpl_id, H5AC_FSPACE_SINFO, fspace->sect_addr, fspace->sinfo, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTINIT, FAIL, "can't add free space sections to cache") + /* Cache the free-space section info */ + if(H5AC_insert_entry(f, dxpl_id, H5AC_FSPACE_SINFO, fspace->sect_addr, fspace->sinfo, H5AC__NO_FLAGS_SET) < 0) + HGOTO_ERROR(H5E_FSPACE, H5E_CANTINIT, FAIL, "can't add free space sections to cache") - fspace->sinfo = NULL; + fspace->sinfo = NULL; } /* end if */ done: @@ -913,13 +896,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_free() + * Function: H5FS_free() * - * Purpose: Free space for free-space manager header and section info header + * Purpose: Free space for free-space manager header and section info header * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi; Feb 2009 + * Programmer: Vailin Choi + * Feb 2009 * *------------------------------------------------------------------------- */ @@ -927,7 +911,7 @@ herr_t H5FS_free(H5F_t *f, H5FS_t *fspace, hid_t dxpl_id) { haddr_t saved_addr; /* Previous address of item */ - unsigned cache_flags; /* Flags for unprotecting cache entries */ + unsigned cache_flags; /* Flags for unprotecting cache entries */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_TAG(dxpl_id, H5AC__FREESPACE_TAG, FAIL) @@ -942,11 +926,11 @@ H5FS_free(H5F_t *f, H5FS_t *fspace, hid_t dxpl_id) hsize_t saved_size; /* Size of previous section info */ unsigned sinfo_status = 0; /* Section info cache status */ - /* Check whether free-space manager section info is in cache or not */ - if(H5AC_get_entry_status(f, fspace->sect_addr, &sinfo_status) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTGET, FAIL, "unable to check metadata cache status for free-space section info") + /* Check whether free-space manager section info is in cache or not */ + if(H5AC_get_entry_status(f, fspace->sect_addr, &sinfo_status) < 0) + HGOTO_ERROR(H5E_FSPACE, H5E_CANTGET, FAIL, "unable to check metadata cache status for free-space section info") - /* Load free-space manager section info */ + /* Load free-space manager section info */ if(sinfo_status & H5AC_ES__IN_CACHE || !fspace->sinfo) { H5FS_sinfo_cache_ud_t cache_udata; /* User-data for cache callback */ @@ -957,39 +941,39 @@ H5FS_free(H5F_t *f, H5FS_t *fspace, hid_t dxpl_id) if(NULL == (fspace->sinfo = (H5FS_sinfo_t *)H5AC_protect(f, dxpl_id, H5AC_FSPACE_SINFO, fspace->sect_addr, &cache_udata, H5AC__READ_ONLY_FLAG))) HGOTO_ERROR(H5E_FSPACE, H5E_CANTPROTECT, FAIL, "unable to protect free space section info") - /* Unload and release ownership of the free-space manager section info */ - if(H5AC_unprotect(f, dxpl_id, H5AC_FSPACE_SINFO, fspace->sect_addr, fspace->sinfo, cache_flags) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTUNPROTECT, FAIL, "unable to release free space section info") - } /* end if */ + /* Unload and release ownership of the free-space manager section info */ + if(H5AC_unprotect(f, dxpl_id, H5AC_FSPACE_SINFO, fspace->sect_addr, fspace->sinfo, cache_flags) < 0) + HGOTO_ERROR(H5E_FSPACE, H5E_CANTUNPROTECT, FAIL, "unable to release free space section info") + } /* end if */ - saved_addr = fspace->sect_addr; - saved_size = fspace->alloc_sect_size; + saved_addr = fspace->sect_addr; + saved_size = fspace->alloc_sect_size; - fspace->sect_addr = HADDR_UNDEF; - fspace->alloc_sect_size = 0; + fspace->sect_addr = HADDR_UNDEF; + fspace->alloc_sect_size = 0; - /* Free space for the free-space manager section info */ + /* Free space for the free-space manager section info */ if(!H5F_IS_TMP_ADDR(f, saved_addr)) { if(H5MF_xfree(f, H5FD_MEM_FSPACE_SINFO, dxpl_id, saved_addr, saved_size) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "unable to release free space sections") } /* end if */ - /* Mark free-space manager header as dirty */ - if(H5FS_dirty(fspace) < 0) + /* Mark free-space manager header as dirty */ + if(H5FS_dirty(fspace) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, FAIL, "unable to mark free space header as dirty") } /* end if */ if(H5F_addr_defined(fspace->addr)) { unsigned hdr_status = 0; /* Header entry status */ - /* Check whether free-space manager header is in cache or not */ - if(H5AC_get_entry_status(f, fspace->addr, &hdr_status) < 0) + /* Check whether free-space manager header is in cache or not */ + if(H5AC_get_entry_status(f, fspace->addr, &hdr_status) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTGET, FAIL, "unable to check metadata cache status for free-space section info") if(hdr_status & H5AC_ES__IN_CACHE) { H5FS_hdr_cache_ud_t cache_udata; /* User-data for metadata cache callback */ - /* Protect the free-space manager header */ + /* Protect the free-space manager header */ /* (no class information necessary since it's in the cache) */ cache_udata.f = f; cache_udata.nclasses = 0; @@ -998,21 +982,21 @@ H5FS_free(H5F_t *f, H5FS_t *fspace, hid_t dxpl_id) if(NULL == (fspace = (H5FS_t *)H5AC_protect(f, dxpl_id, H5AC_FSPACE_HDR, fspace->addr, &cache_udata, H5AC__READ_ONLY_FLAG))) HGOTO_ERROR(H5E_FSPACE, H5E_CANTPROTECT, FAIL, "unable to protect free space section info") - /* Unpin the free-space manager header */ - if(H5AC_unpin_entry(fspace) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPIN, FAIL, "unable to unpin fractal heap header") + /* Unpin the free-space manager header */ + if(H5AC_unpin_entry(fspace) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPIN, FAIL, "unable to unpin fractal heap header") - /* Unload and release ownership of the free-space header */ - if(H5AC_unprotect(f, dxpl_id, H5AC_FSPACE_HDR, fspace->addr, fspace, cache_flags) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTUNPROTECT, FAIL, "unable to release free space section info") - } /* end if */ + /* Unload and release ownership of the free-space header */ + if(H5AC_unprotect(f, dxpl_id, H5AC_FSPACE_HDR, fspace->addr, fspace, cache_flags) < 0) + HGOTO_ERROR(H5E_FSPACE, H5E_CANTUNPROTECT, FAIL, "unable to release free space section info") + } /* end if */ - saved_addr = fspace->addr; - fspace->addr = HADDR_UNDEF; + saved_addr = fspace->addr; + fspace->addr = HADDR_UNDEF; - /* Free space for the free-space manager header */ - if(H5MF_xfree(f, H5FD_MEM_FSPACE_HDR, dxpl_id, saved_addr, (hsize_t)H5FS_HEADER_SIZE(f)) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "unable to free free space header") + /* Free space for the free-space manager header */ + if(H5MF_xfree(f, H5FD_MEM_FSPACE_HDR, dxpl_id, saved_addr, (hsize_t)H5FS_HEADER_SIZE(f)) < 0) + HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "unable to free free space header") } /* end if */ done: @@ -1021,15 +1005,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS__hdr_dest + * Function: H5FS__hdr_dest * - * Purpose: Destroys a free space header in memory. + * Purpose: Destroys a free space header in memory. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu - * May 2 2006 + * Programmer: Quincey Koziol + * May 2 2006 * *------------------------------------------------------------------------- */ @@ -1067,14 +1050,13 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_sinfo_free_sect_cb + * Function: H5FS_sinfo_free_sect_cb * - * Purpose: Free a size-tracking node for a bin + * Purpose: Free a size-tracking node for a bin * - * Return: Success: non-negative - * Failure: negative + * Return: SUCCEED (Can't fail) * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, March 11, 2006 * *------------------------------------------------------------------------- @@ -1093,20 +1075,18 @@ H5FS_sinfo_free_sect_cb(void *_sect, void H5_ATTR_UNUSED *key, void *op_data) /* Call the section's class 'free' method on the section */ (*sinfo->fspace->sect_cls[sect->type].free)(sect); - FUNC_LEAVE_NOAPI(0) + FUNC_LEAVE_NOAPI(SUCCEED) } /* H5FS_sinfo_free_sect_cb() */ /*------------------------------------------------------------------------- - * Function: H5FS_sinfo_free_node_cb - * - * Purpose: Free a size-tracking node for a bin + * Function: H5FS_sinfo_free_node_cb * - * Return: Success: non-negative + * Purpose: Free a size-tracking node for a bin * - * Failure: negative + * Return: SUCCEED (Can't fail) * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, March 11, 2006 * *------------------------------------------------------------------------- @@ -1127,20 +1107,19 @@ H5FS_sinfo_free_node_cb(void *item, void H5_ATTR_UNUSED *key, void *op_data) /* Release free space list node */ fspace_node = H5FL_FREE(H5FS_node_t, fspace_node); - FUNC_LEAVE_NOAPI(0) + FUNC_LEAVE_NOAPI(SUCCEED) } /* H5FS_sinfo_free_node_cb() */ /*------------------------------------------------------------------------- - * Function: H5FS_sinfo_dest + * Function: H5FS_sinfo_dest * - * Purpose: Destroys a free space section info in memory. + * Purpose: Destroys a free space section info in memory. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu - * July 31 2006 + * Programmer: Quincey Koziol + * July 31 2006 * *------------------------------------------------------------------------- */ @@ -1193,15 +1172,14 @@ done: #ifdef H5FS_DEBUG_ASSERT /*------------------------------------------------------------------------- - * Function: H5FS_assert + * Function: H5FS_assert * - * Purpose: Verify that the free space manager is mostly sane + * Purpose: Verify that the free space manager is mostly sane * - * Return: Non-negative on success, negative on failure + * Return: SUCCEED (Can't fail) * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Jul 17 2006 + * Programmer: Quincey Koziol + * Jul 17 2006 * *------------------------------------------------------------------------- */ diff --git a/src/H5FScache.c b/src/H5FScache.c index 25a16e0..2f7dda8 100644 --- a/src/H5FScache.c +++ b/src/H5FScache.c @@ -15,11 +15,11 @@ /*------------------------------------------------------------------------- * - * Created: H5FScache.c - * May 2 2006 - * Quincey Koziol <koziol@ncsa.uiuc.edu> + * Created: H5FScache.c + * May 2 2006 + * Quincey Koziol <koziol@hdfgroup.org> * - * Purpose: Implement file free space metadata cache methods. + * Purpose: Implement file free space metadata cache methods. * *------------------------------------------------------------------------- */ @@ -176,6 +176,8 @@ H5FS__cache_hdr_get_load_size(const void *_udata, size_t *image_len) FUNC_ENTER_STATIC_NOERR /* Check arguments */ + HDassert(udata); + HDassert(udata->f); HDassert(image_len); /* Set the image length size */ @@ -223,24 +225,24 @@ H5FS__cache_hdr_deserialize(const void *_image, size_t len, void *_udata, /* Allocate a new free space manager */ if(NULL == (fspace = H5FS__new(udata->f, udata->nclasses, udata->classes, udata->cls_init_udata))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") /* Set free space manager's internal information */ fspace->addr = udata->addr; /* Magic number */ if(HDmemcmp(image, H5FS_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC)) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTLOAD, NULL, "wrong free space header signature") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTLOAD, NULL, "wrong free space header signature") image += H5_SIZEOF_MAGIC; /* Version */ if(*image++ != H5FS_HDR_VERSION) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTLOAD, NULL, "wrong free space header version") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTLOAD, NULL, "wrong free space header version") /* Client ID */ fspace->client = (H5FS_client_t)*image++; if(fspace->client >= H5FS_NUM_CLIENT_ID) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTLOAD, NULL, "unknown client ID in free space header") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTLOAD, NULL, "unknown client ID in free space header") /* Total space tracked */ H5F_DECODE_LENGTH(udata->f, image, fspace->tot_space); @@ -258,7 +260,7 @@ H5FS__cache_hdr_deserialize(const void *_image, size_t len, void *_udata, /* (only check if we actually have some classes) */ UINT16DECODE(image, nclasses); if(fspace->nclasses > 0 && fspace->nclasses != nclasses) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTLOAD, NULL, "section class count mismatch") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTLOAD, NULL, "section class count mismatch") /* Shrink percent */ UINT16DECODE(image, fspace->shrink_percent); @@ -822,7 +824,6 @@ H5FS__cache_sinfo_get_load_size(const void *_udata, size_t *image_len) * it with the data contained in the image, and return a pointer to * the new instance. * - * * Return: Success: Pointer to in core representation * Failure: NULL * @@ -1235,7 +1236,7 @@ done: * Purpose: Skip list iterator callback to serialize free space sections * of a particular size * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Monday, May 8, 2006 @@ -1291,7 +1292,7 @@ done: * Purpose: Skip list iterator callback to serialize free space sections * in a bin * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Monday, May 8, 2006 @@ -1329,4 +1330,3 @@ H5FS__sinfo_serialize_node_cb(void *_item, void H5_ATTR_UNUSED *key, void *_udat done: FUNC_LEAVE_NOAPI(ret_value) } /* H5FS__sinfo_serialize_node_cb() */ - diff --git a/src/H5FSdbg.c b/src/H5FSdbg.c index 7303b73..fbdeb70 100644 --- a/src/H5FSdbg.c +++ b/src/H5FSdbg.c @@ -15,11 +15,11 @@ /*------------------------------------------------------------------------- * - * Created: H5FSdbg.c - * May 9 2006 - * Quincey Koziol <koziol@ncsa.uiuc.edu> + * Created: H5FSdbg.c + * May 9 2006 + * Quincey Koziol <koziol@hdfgroup.org> * - * Purpose: Dump debugging information about a free space manager + * Purpose: Dump debugging information about a free space manager * *------------------------------------------------------------------------- */ @@ -36,11 +36,11 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5FSpkg.h" /* File free space */ -#include "H5HFprivate.h" /* Fractal heaps */ -#include "H5MFprivate.h" /* File memory management */ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FSpkg.h" /* File free space */ +#include "H5HFprivate.h" /* Fractal heaps */ +#include "H5MFprivate.h" /* File memory management */ /****************/ @@ -79,26 +79,21 @@ /*------------------------------------------------------------------------- - * Function: H5FS_debug + * Function: H5FS_debug * - * Purpose: Prints debugging info about a free space manager. + * Purpose: Prints debugging info about a free space manager. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu - * May 9 2006 - * - * Modifications: - * Vailin Choi, July 29th, 2008 - * Add H5FS_CLIENT_FILE_ID for File Memory Management + * Programmer: Quincey Koziol + * May 9 2006 * *------------------------------------------------------------------------- */ herr_t H5FS_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, int fwidth) { - H5FS_t *fspace = NULL; /* Free space header info */ + H5FS_t *fspace = NULL; /* Free space header info */ H5FS_hdr_cache_ud_t cache_udata; /* User-data for cache callback */ herr_t ret_value = SUCCEED; /* Return value */ @@ -124,7 +119,7 @@ H5FS_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, int * Load the free space header. */ if(NULL == (fspace = (H5FS_t *)H5AC_protect(f, dxpl_id, H5AC_FSPACE_HDR, addr, &cache_udata, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTLOAD, FAIL, "unable to load free space header") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTLOAD, FAIL, "unable to load free space header") /* Print opening message */ HDfprintf(stream, "%*sFree Space Header...\n", indent, ""); @@ -133,45 +128,45 @@ H5FS_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, int * Print the values. */ HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, - "Free space client:", - (fspace->client == H5FS_CLIENT_FHEAP_ID ? "Fractal heap" : - (fspace->client == H5FS_CLIENT_FILE_ID ? "File" : "Unknown"))); + "Free space client:", + (fspace->client == H5FS_CLIENT_FHEAP_ID ? "Fractal heap" : + (fspace->client == H5FS_CLIENT_FILE_ID ? "File" : "Unknown"))); HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, - "Total free space tracked:", - fspace->tot_space); + "Total free space tracked:", + fspace->tot_space); HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, - "Total number of free space sections tracked:", - fspace->tot_sect_count); + "Total number of free space sections tracked:", + fspace->tot_sect_count); HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, - "Number of serializable free space sections tracked:", - fspace->serial_sect_count); + "Number of serializable free space sections tracked:", + fspace->serial_sect_count); HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, - "Number of ghost free space sections tracked:", - fspace->ghost_sect_count); + "Number of ghost free space sections tracked:", + fspace->ghost_sect_count); HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, - "Number of free space section classes:", - (unsigned)fspace->nclasses); + "Number of free space section classes:", + (unsigned)fspace->nclasses); HDfprintf(stream, "%*s%-*s %u%%\n", indent, "", fwidth, - "Shrink percent:", - fspace->shrink_percent); + "Shrink percent:", + fspace->shrink_percent); HDfprintf(stream, "%*s%-*s %u%%\n", indent, "", fwidth, - "Expand percent:", - fspace->expand_percent); + "Expand percent:", + fspace->expand_percent); HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, - "# of bits for section address space:", - fspace->max_sect_addr); + "# of bits for section address space:", + fspace->max_sect_addr); HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, - "Maximum section size:", - fspace->max_sect_size); + "Maximum section size:", + fspace->max_sect_size); HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, - "Serialized sections address:", - fspace->sect_addr); + "Serialized sections address:", + fspace->sect_addr); HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, - "Serialized sections size used:", - fspace->sect_size); + "Serialized sections size used:", + fspace->sect_size); HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, - "Serialized sections size allocated:", - fspace->alloc_sect_size); + "Serialized sections size allocated:", + fspace->alloc_sect_size); done: if(fspace && H5AC_unprotect(f, dxpl_id, H5AC_FSPACE_HDR, addr, fspace, H5AC__NO_FLAGS_SET) < 0) @@ -182,15 +177,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_sect_debug + * Function: H5FS_sect_debug * - * Purpose: Prints debugging info about a free space section. + * Purpose: Prints debugging info about a free space section. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu - * May 30 2006 + * Programmer: Quincey Koziol + * May 30 2006 * *------------------------------------------------------------------------- */ @@ -221,15 +215,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_sects_debug + * Function: H5FS_sects_debug * - * Purpose: Prints debugging info about the free space sections. + * Purpose: Prints debugging info about the free space sections. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu - * May 9 2006 + * Programmer: Quincey Koziol + * May 9 2006 * *------------------------------------------------------------------------- */ @@ -237,7 +230,7 @@ herr_t H5FS_sects_debug(H5F_t *f, hid_t dxpl_id, haddr_t H5_ATTR_UNUSED addr, FILE *stream, int indent, int fwidth, haddr_t fs_addr, haddr_t client_addr) { - H5FS_t *fspace = NULL; /* Free space header info */ + H5FS_t *fspace = NULL; /* Free space header info */ H5FS_client_t client; /* The client of the free space */ H5FS_hdr_cache_ud_t cache_udata; /* User-data for cache callback */ herr_t ret_value = SUCCEED; /* Return value */ @@ -266,7 +259,7 @@ H5FS_sects_debug(H5F_t *f, hid_t dxpl_id, haddr_t H5_ATTR_UNUSED addr, FILE *str * Load the free space header. */ if(NULL == (fspace = (H5FS_t *)H5AC_protect(f, dxpl_id, H5AC_FSPACE_HDR, fs_addr, &cache_udata, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTLOAD, FAIL, "unable to load free space header") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTLOAD, FAIL, "unable to load free space header") /* Retrieve the client id */ client = fspace->client; @@ -292,8 +285,8 @@ H5FS_sects_debug(H5F_t *f, hid_t dxpl_id, haddr_t H5_ATTR_UNUSED addr, FILE *str break; case H5FS_CLIENT_FILE_ID: - if(H5MF_sects_debug(f, dxpl_id, fs_addr, stream, indent + 3, MAX(0, fwidth - 3)) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_SYSTEM, FAIL, "unable to dump file free space sections") + if(H5MF_sects_debug(f, dxpl_id, fs_addr, stream, indent + 3, MAX(0, fwidth - 3)) < 0) + HGOTO_ERROR(H5E_FSPACE, H5E_SYSTEM, FAIL, "unable to dump file free space sections") break; case H5FS_NUM_CLIENT_ID: diff --git a/src/H5FSpkg.h b/src/H5FSpkg.h index b0df9e6..08c2529 100644 --- a/src/H5FSpkg.h +++ b/src/H5FSpkg.h @@ -14,12 +14,12 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu> - * Tuesday, May 2, 2006 + * Programmer: Quincey Koziol <koziol@hdfgroup.org> + * Tuesday, May 2, 2006 * - * Purpose: This file contains declarations which are visible only within - * the H5FS package. Source files outside the H5FS package should - * include H5FSprivate.h instead. + * Purpose: This file contains declarations which are visible only within + * the H5FS package. Source files outside the H5FS package should + * include H5FSprivate.h instead. */ #if !(defined H5FS_FRIEND || defined H5FS_MODULE) #error "Do not include this file outside the H5FS package!" @@ -38,11 +38,11 @@ /* #define H5FS_DEBUG_ASSERT */ /* Get package's private header */ -#include "H5FSprivate.h" /* File free space */ +#include "H5FSprivate.h" /* File free space */ /* Other private headers needed by this file */ -#include "H5ACprivate.h" /* Metadata cache */ -#include "H5SLprivate.h" /* Skip lists */ +#include "H5ACprivate.h" /* Metadata cache */ +#include "H5SLprivate.h" /* Skip lists */ /**************************/ /* Package Private Macros */ diff --git a/src/H5FSprivate.h b/src/H5FSprivate.h index 37bc0ea..c5ad38f 100644 --- a/src/H5FSprivate.h +++ b/src/H5FSprivate.h @@ -15,11 +15,11 @@ /*------------------------------------------------------------------------- * - * Created: H5FSprivate.h - * May 2 2006 - * Quincey Koziol <koziol@ncsa.uiuc.edu> + * Created: H5FSprivate.h + * May 2 2006 + * Quincey Koziol <koziol@hdfgroup.org> * - * Purpose: Private header for library accessible file free space routines. + * Purpose: Private header for library accessible file free space routines. * *------------------------------------------------------------------------- */ @@ -127,8 +127,8 @@ struct H5FS_section_info_t { /* Free space client IDs for identifying user of free space */ typedef enum H5FS_client_t { - H5FS_CLIENT_FHEAP_ID = 0, /* Free space is used by fractal heap */ - H5FS_CLIENT_FILE_ID, /* Free space is used by file */ + H5FS_CLIENT_FHEAP_ID = 0, /* Free space is used by fractal heap */ + H5FS_CLIENT_FILE_ID, /* Free space is used by file */ H5FS_NUM_CLIENT_ID /* Number of free space client IDs (must be last) */ } H5FS_client_t; @@ -147,11 +147,11 @@ typedef struct H5FS_stat_t { hsize_t tot_sect_count; /* Total # of sections tracked */ hsize_t serial_sect_count; /* # of serializable sections tracked */ hsize_t ghost_sect_count; /* # of un-serializable sections tracked */ - haddr_t addr; /* Address of free space header on disk */ - hsize_t hdr_size; /* Size of the free-space header on disk */ + haddr_t addr; /* Address of free space header on disk */ + hsize_t hdr_size; /* Size of the free-space header on disk */ haddr_t sect_addr; /* Address of the section info in the file */ hsize_t alloc_sect_size; /* Allocated size of the section info in the file */ - hsize_t sect_size; /* Size of the section info in the file */ + hsize_t sect_size; /* Size of the section info in the file */ } H5FS_stat_t; /* Typedef for iteration operations */ diff --git a/src/H5FSpublic.h b/src/H5FSpublic.h index d1bae94..87debe8 100644 --- a/src/H5FSpublic.h +++ b/src/H5FSpublic.h @@ -17,7 +17,7 @@ * * Created: H5FSpublic.h * May 2 2006 - * Quincey Koziol <koziol@ncsa.uiuc.edu> + * Quincey Koziol <koziol@hdfgroup.org> * * Purpose: Public declarations for the file free space package. * diff --git a/src/H5FSsection.c b/src/H5FSsection.c index d447160..62500e7 100644 --- a/src/H5FSsection.c +++ b/src/H5FSsection.c @@ -14,10 +14,10 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol <koziol@hdfgroup.org> + * Programmer: Quincey Koziol <koziol@hdfgroup.org> * Monday, July 31, 2006 * - * Purpose: Free space tracking functions. + * Purpose: Free space tracking functions. * */ @@ -111,14 +111,14 @@ H5FL_DEFINE(H5FS_sinfo_t); /*------------------------------------------------------------------------- - * Function: H5FS_sinfo_new + * Function: H5FS_sinfo_new * - * Purpose: Create new section info structure + * Purpose: Create new section info structure * - * Return: Success: non-NULL, pointer to new section info struct - * Failure: NULL + * Return: Success: non-NULL, pointer to new section info struct + * Failure: NULL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Monday, July 31, 2006 * *------------------------------------------------------------------------- @@ -140,7 +140,7 @@ HDfprintf(stderr, "%s: fspace->addr = %a\n", FUNC, fspace->addr); /* Allocate the free space header */ if(NULL == (sinfo = H5FL_CALLOC(H5FS_sinfo_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") /* Set non-zero values */ sinfo->nbins = H5VM_log2_gen(fspace->max_sect_size); @@ -186,19 +186,18 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_sinfo_lock + * Function: H5FS_sinfo_lock * - * Purpose: Make certain the section info for the free space manager is + * Purpose: Make certain the section info for the free space manager is * in memory. * * Either uses existing section info owned by the free space * header, loads section info from disk, or creates new section * info * - * Return: Success: non-negative - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, February 7, 2008 * *------------------------------------------------------------------------- @@ -304,15 +303,14 @@ HDfprintf(stderr, "%s: fspace->alloc_sect_size = %Hu, fspace->sect_size = %Hu\n" /*------------------------------------------------------------------------- - * Function: H5FS_sinfo_unlock + * Function: H5FS_sinfo_unlock * - * Purpose: Release the section info, either giving ownership back to + * Purpose: Release the section info, either giving ownership back to * the cache or letting the free space header keep it. * - * Return: Success: non-negative - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, February 7, 2008 * *------------------------------------------------------------------------- @@ -468,14 +466,13 @@ HDfprintf(stderr, "%s: Leaving, ret_value = %d\n", FUNC, ret_value); /*------------------------------------------------------------------------- - * Function: H5FS_sect_serialize_size + * Function: H5FS_sect_serialize_size * - * Purpose: Determine serialized size of all sections in free space manager + * Purpose: Determine serialized size of all sections in free space manager * - * Return: Success: non-negative - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Monday, May 8, 2006 * *------------------------------------------------------------------------- @@ -532,15 +529,14 @@ HDfprintf(stderr, "%s: fspace->serial_sect_count = %Hu\n", "H5FS_sect_serialize_ /*------------------------------------------------------------------------- - * Function: H5FS_sect_increase + * Function: H5FS_sect_increase * - * Purpose: Increase the size of the serialized free space section info + * Purpose: Increase the size of the serialized free space section info * on disk * - * Return: Success: non-negative - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Monday, May 8, 2006 * *------------------------------------------------------------------------- @@ -594,16 +590,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_sect_decrease + * Function: H5FS_sect_decrease * - * Purpose: Decrease the size of the serialized free space section info + * Purpose: Decrease the size of the serialized free space section info * on disk * - * Return: Success: non-negative - * - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Monday, May 8, 2006 * *------------------------------------------------------------------------- @@ -653,14 +647,13 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_size_node_decr + * Function: H5FS_size_node_decr * - * Purpose: Decrement the number of sections of a particular size + * Purpose: Decrement the number of sections of a particular size * - * Return: Success: non-negative - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Wednesday, May 17, 2006 * *------------------------------------------------------------------------- @@ -741,15 +734,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_sect_unlink_size + * Function: H5FS_sect_unlink_size * - * Purpose: Remove a section node from size tracking data structures for + * Purpose: Remove a section node from size tracking data structures for * a free space manager * - * Return: Success: non-negative - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Wednesday, May 17, 2006 * *------------------------------------------------------------------------- @@ -796,17 +788,15 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_sect_unlink_rest + * Function: H5FS_sect_unlink_rest * - * Purpose: Finish unlinking a section from the rest of the free space + * Purpose: Finish unlinking a section from the rest of the free space * manager's data structures, after the section has been removed * from the size tracking data structures * - * Return: Success: non-negative - * - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Wednesday, May 17, 2006 * *------------------------------------------------------------------------- @@ -853,14 +843,13 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_sect_remove_real + * Function: H5FS_sect_remove_real * - * Purpose: Remove a section from the free space manager + * Purpose: Remove a section from the free space manager * - * Return: Success: non-negative - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Wednesday, May 17, 2006 * *------------------------------------------------------------------------- @@ -895,14 +884,13 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_sect_remove + * Function: H5FS_sect_remove * - * Purpose: Remove a section from the free space manager + * Purpose: Remove a section from the free space manager * - * Return: Success: non-negative - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Wednesday, May 17, 2006 * *------------------------------------------------------------------------- @@ -940,14 +928,13 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_sect_link_size + * Function: H5FS_sect_link_size * - * Purpose: Add a section of free space to the free list bins + * Purpose: Add a section of free space to the free list bins * - * Return: Success: non-negative - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Monday, March 20, 2006 * *------------------------------------------------------------------------- @@ -1048,16 +1035,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_sect_link_rest + * Function: H5FS_sect_link_rest * - * Purpose: Link a section into the rest of the non-size tracking + * Purpose: Link a section into the rest of the non-size tracking * free space manager data structures * - * Return: Success: non-negative - * - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Wednesday, May 17, 2006 * *------------------------------------------------------------------------- @@ -1100,15 +1085,13 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_sect_link + * Function: H5FS_sect_link * - * Purpose: Link a section into the internal data structures + * Purpose: Link a section into the internal data structures * - * Return: Success: non-negative - * - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Wednesday, May 17, 2006 * *------------------------------------------------------------------------- @@ -1152,24 +1135,16 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_sect_merge + * Function: H5FS_sect_merge * - * Purpose: Attempt to merge a returned free space section with existing + * Purpose: Attempt to merge a returned free space section with existing * free space. * - * Return: Success: non-negative - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Wednesday, May 17, 2006 * - * Modifications: Vailin Choi; Sept 25th 2008 - * Changes to the "shrinking" part-- - * 1. Get last section node in merge-list instead of "less-than" - * node for further iteration - * 2. Remove "can-be-shrunk" section from free-space instead of - * "less-than" section - * *------------------------------------------------------------------------- */ static herr_t @@ -1177,7 +1152,7 @@ H5FS_sect_merge(H5FS_t *fspace, H5FS_section_info_t **sect, void *op_data) { H5FS_section_class_t *sect_cls; /* Section's class */ hbool_t modified; /* Flag to indicate merge or shrink occurred */ - hbool_t remove_sect = FALSE; /* Whether a section should be removed before shrinking */ + hbool_t remove_sect = FALSE; /* Whether a section should be removed before shrinking */ htri_t status; /* Status value */ herr_t ret_value = SUCCEED; /* Return value */ @@ -1309,13 +1284,13 @@ HDfprintf(stderr, "%s: Done merging, (*sect) = {%a, %Hu, %u, %s}\n", FUNC, (*sec HDfprintf(stderr, "%s: Can shrink!\n", FUNC); #endif /* QAK */ - /* Remove SECT from free-space manager */ + /* Remove SECT from free-space manager */ /* (only possible to happen on second+ pass through loop) */ - if(remove_sect) { - if(H5FS_sect_remove_real(fspace, *sect) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't remove section from internal data structures") - remove_sect = FALSE; - } /* end if */ + if(remove_sect) { + if(H5FS_sect_remove_real(fspace, *sect) < 0) + HGOTO_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't remove section from internal data structures") + remove_sect = FALSE; + } /* end if */ /* Shrink the container */ /* (callback can indicate that it has discarded the section by setting *sect to NULL) */ @@ -1339,7 +1314,7 @@ HDfprintf(stderr, "%s: Can shrink!\n", FUNC); remove_sect = TRUE; } /* end if */ } /* end if */ - } /* end if */ + } /* end if */ /* Indicate successful merge occurred */ modified = TRUE; @@ -1349,7 +1324,7 @@ HDfprintf(stderr, "%s: Can shrink!\n", FUNC); /* Check for section that was shrunk away and next section not shrinking */ if(remove_sect && (*sect != NULL)) - *sect = NULL; + *sect = NULL; #ifdef QAK HDfprintf(stderr, "%s: Done shrinking\n", FUNC); @@ -1368,15 +1343,13 @@ HDfprintf(stderr, "%s: Leaving, ret_value = %d\n", FUNC, ret_value); /*------------------------------------------------------------------------- - * Function: H5FS_sect_add + * Function: H5FS_sect_add * - * Purpose: Add a section of free space to the free list + * Purpose: Add a section of free space to the free list * - * Return: Success: non-negative - * - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, March 7, 2006 * *------------------------------------------------------------------------- @@ -1458,14 +1431,13 @@ HDfprintf(stderr, "%s: Leaving, ret_value = %d\n", FUNC, ret_value); /*------------------------------------------------------------------------- - * Function: H5FS_sect_try_extend + * Function: H5FS_sect_try_extend * - * Purpose: Try to extend a block using space from a section on the free list + * Purpose: Try to extend a block using space from a section on the free list * - * Return: Success: non-negative - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, January 8, 2008 * *------------------------------------------------------------------------- @@ -1589,15 +1561,16 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_sect_try_merge + * Function: H5FS_sect_try_merge * - * Purpose: Try to merge/shrink a block + * Purpose: Try to merge/shrink a block * - * Return: TRUE: merged/shrunk - * FALSE: not merged/not shrunk - * Failure: negative + * Return: TRUE: merged/shrunk + * FALSE: not merged/not shrunk + * Failure: negative * - * Programmer: Vailin Choi; June 10, 2009 + * Programmer: Vailin Choi + * June 10, 2009 * *------------------------------------------------------------------------- */ @@ -1607,7 +1580,7 @@ H5FS_sect_try_merge(H5F_t *f, hid_t dxpl_id, H5FS_t *fspace, H5FS_section_info_t { hbool_t sinfo_valid = FALSE; /* Whether the section info is valid */ hbool_t sinfo_modified = FALSE; /* Whether the section info was modified */ - hsize_t saved_fs_size; /* copy the free-space section size */ + hsize_t saved_fs_size; /* Copy of the free-space section size */ htri_t ret_value = FALSE; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -1621,18 +1594,18 @@ H5FS_sect_try_merge(H5F_t *f, hid_t dxpl_id, H5FS_t *fspace, H5FS_section_info_t /* Get a pointer to the section info */ if(H5FS_sinfo_lock(f, dxpl_id, fspace, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTGET, FAIL, "can't get section info") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTGET, FAIL, "can't get section info") sinfo_valid = TRUE; saved_fs_size = sect->size; /* Attempt to merge/shrink section with existing sections */ if(H5FS_sect_merge(fspace, §, op_data) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTMERGE, FAIL, "can't merge sections") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTMERGE, FAIL, "can't merge sections") /* Check if section is shrunk and/or merged away completely */ if(!sect) { - sinfo_modified = TRUE; - HGOTO_DONE(TRUE) + sinfo_modified = TRUE; + HGOTO_DONE(TRUE) } /* end if */ else { /* Check if section is merged */ @@ -1654,23 +1627,16 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_sect_find_node + * Function: H5FS_sect_find_node * - * Purpose: Locate a section of free space (in existing free space list + * Purpose: Locate a section of free space (in existing free space list * bins) that is large enough to fulfill request. * - * Return: Success: non-negative + * Return: SUCCEED/FAIL * - * Failure: negative - * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Monday, March 20, 2006 * - * Modifications: - * Vailin Choi, July 29th, 2008 - * Modified to handle alignment by going through each bin to find - * a section that is big enough to fulfill "request+fragment for alignment" - * *------------------------------------------------------------------------- */ static htri_t @@ -1702,34 +1668,34 @@ HDfprintf(stderr, "%s: bin = %u\n", FUNC, bin); #endif /* QAK */ alignment = fspace->alignment; if(!((alignment > 1) && (request >= fspace->threshold))) - alignment = 0; /* no alignment */ + alignment = 0; /* no alignment */ do { /* Check if there's any sections in this bin */ - if(fspace->sinfo->bins[bin].bin_list) { - - if (!alignment) { /* no alignment */ - /* Find the first free space section that is large enough to fulfill request */ - /* (Since the bins use skip lists to track the sizes of the address-ordered - * lists, this is actually a "best fit" algorithm) - */ - /* Look for large enough free space section in this bin */ - if((fspace_node = (H5FS_node_t *)H5SL_greater(fspace->sinfo->bins[bin].bin_list, &request))) { - /* Take first node off of the list (ie. node w/lowest address) */ - if(NULL == (*node = (H5FS_section_info_t *)H5SL_remove_first(fspace_node->sect_list))) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTREMOVE, FAIL, "can't remove free space node from skip list") - - /* Get section's class */ - cls = &fspace->sect_cls[(*node)->type]; - /* Decrement # of sections in section size node */ - if(H5FS_size_node_decr(fspace->sinfo, bin, fspace_node, cls) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTREMOVE, FAIL, "can't remove free space size node from skip list") - if(H5FS_sect_unlink_rest(fspace, cls, *node) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "can't remove section from non-size tracking data structures") - /* Indicate that we found a node for the request */ - HGOTO_DONE(TRUE) - } /* end if */ - } /* end if */ + if(fspace->sinfo->bins[bin].bin_list) { + + if (!alignment) { /* no alignment */ + /* Find the first free space section that is large enough to fulfill request */ + /* (Since the bins use skip lists to track the sizes of the address-ordered + * lists, this is actually a "best fit" algorithm) + */ + /* Look for large enough free space section in this bin */ + if((fspace_node = (H5FS_node_t *)H5SL_greater(fspace->sinfo->bins[bin].bin_list, &request))) { + /* Take first node off of the list (ie. node w/lowest address) */ + if(NULL == (*node = (H5FS_section_info_t *)H5SL_remove_first(fspace_node->sect_list))) + HGOTO_ERROR(H5E_FSPACE, H5E_CANTREMOVE, FAIL, "can't remove free space node from skip list") + + /* Get section's class */ + cls = &fspace->sect_cls[(*node)->type]; + /* Decrement # of sections in section size node */ + if(H5FS_size_node_decr(fspace->sinfo, bin, fspace_node, cls) < 0) + HGOTO_ERROR(H5E_FSPACE, H5E_CANTREMOVE, FAIL, "can't remove free space size node from skip list") + if(H5FS_sect_unlink_rest(fspace, cls, *node) < 0) + HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "can't remove section from non-size tracking data structures") + /* Indicate that we found a node for the request */ + HGOTO_DONE(TRUE) + } /* end if */ + } /* end if */ else { /* alignment is set */ /* get the first node of a certain size in this bin */ curr_size_node = H5SL_first(fspace->sinfo->bins[bin].bin_list); @@ -1798,9 +1764,9 @@ HDfprintf(stderr, "%s: bin = %u\n", FUNC, bin); /* Get the next size node in the bin */ curr_size_node = H5SL_next(curr_size_node); } /* end while of curr_size_node */ - } /* else of alignment */ - } /* if bin_list */ - /* Advance to next larger bin */ + } /* else of alignment */ + } /* if bin_list */ + /* Advance to next larger bin */ bin++; } while(bin < fspace->sinfo->nbins); @@ -1810,22 +1776,16 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_sect_find + * Function: H5FS_sect_find * - * Purpose: Locate a section of free space (in existing free space list) that + * Purpose: Locate a section of free space (in existing free space list) that * is large enough to fulfill request. * - * Return: Success: non-negative - * - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, March 7, 2006 * - * Modifications: - * Vailin Choi, July 29th 2008 - * Move H5FS_sect_unlink_rest() to H5FS_sect_find_node() - * *------------------------------------------------------------------------- */ htri_t @@ -1871,7 +1831,7 @@ HDfprintf(stderr, "%s: fspace->ghost_sect_count = %Hu\n", FUNC, fspace->ghost_se #ifdef QAK HDfprintf(stderr, "%s: (*node)->size = %Hu, (*node)->addr = %a, (*node)->type = %u\n", FUNC, (*node)->size, (*node)->addr, (*node)->type); #endif /* QAK */ - } + } } /* end if */ done: @@ -1887,16 +1847,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_iterate_sect_cb + * Function: H5FS_iterate_sect_cb * - * Purpose: Skip list iterator callback to iterate over free space sections + * Purpose: Skip list iterator callback to iterate over free space sections * of a particular size * - * Return: Success: non-negative + * Return: SUCCEED/FAIL * - * Failure: negative - * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, May 13, 2006 * *------------------------------------------------------------------------- @@ -1925,16 +1883,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_iterate_node_cb + * Function: H5FS_iterate_node_cb * - * Purpose: Skip list iterator callback to iterate over free space sections + * Purpose: Skip list iterator callback to iterate over free space sections * in a bin * - * Return: Success: non-negative - * - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, May 13, 2006 * *------------------------------------------------------------------------- @@ -1964,15 +1920,13 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_sect_iterate + * Function: H5FS_sect_iterate * - * Purpose: Iterate over all the sections managed + * Purpose: Iterate over all the sections managed * - * Return: Success: non-negative + * Return: SUCCEED/FAIL * - * Failure: negative - * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, May 13, 2006 * *------------------------------------------------------------------------- @@ -2032,14 +1986,13 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_sect_stats + * Function: H5FS_sect_stats * - * Purpose: Retrieve info about the sections managed + * Purpose: Retrieve info about the sections managed * - * Return: Success: non-negative - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, May 30, 2006 * *------------------------------------------------------------------------- @@ -2063,16 +2016,14 @@ H5FS_sect_stats(const H5FS_t *fspace, hsize_t *tot_space, hsize_t *nsects) /*------------------------------------------------------------------------- - * Function: H5FS_sect_change_class + * Function: H5FS_sect_change_class * - * Purpose: Make appropriate adjustments to internal data structures when + * Purpose: Make appropriate adjustments to internal data structures when * a section changes class * - * Return: Success: non-negative - * - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Monday, July 10, 2006 * *------------------------------------------------------------------------- @@ -2235,15 +2186,14 @@ done: #ifdef H5FS_DEBUG_ASSERT /*------------------------------------------------------------------------- - * Function: H5FS_sect_assert + * Function: H5FS_sect_assert * - * Purpose: Verify that the sections managed are mostly sane + * Purpose: Verify that the sections managed are mostly sane * - * Return: Non-negative on success, negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Jul 17 2006 + * Programmer: Quincey Koziol + * Jul 17 2006 * *------------------------------------------------------------------------- */ diff --git a/src/H5FSstat.c b/src/H5FSstat.c index 390eb9f..d2c0177 100644 --- a/src/H5FSstat.c +++ b/src/H5FSstat.c @@ -28,9 +28,9 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5FSpkg.h" /* Free-space manager */ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FSpkg.h" /* Free-space manager */ /****************/ @@ -74,12 +74,10 @@ * * Purpose: Retrieve metadata statistics for the free-space manager * - * Return: Success: non-negative - * - * Failure: does not fail + * Return: SUCCEED (Can't fail) * * Programmer: Vailin Choi - * August 25th, 2008 + * August 25th, 2008 * *------------------------------------------------------------------------- */ diff --git a/src/H5FStest.c b/src/H5FStest.c index f96ee75..06f5166 100644 --- a/src/H5FStest.c +++ b/src/H5FStest.c @@ -23,15 +23,15 @@ /****************/ #include "H5FSmodule.h" /* This source code file is part of the H5FS module */ -#define H5FS_TESTING /*suppress warning about H5FS testing funcs */ +#define H5FS_TESTING /* Suppress warning about H5FS testing funcs */ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5FSpkg.h" /* Free-space manager */ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FSpkg.h" /* Free-space manager */ /****************/ @@ -74,13 +74,12 @@ * Function: H5FS_get_cparam_test * * Purpose: Retrieve the parameters used to create the free-space manager + * similar to H5HF_get_cparam_test() * - * Return: Success: non-negative + * Return: SUCCEED/FAIL * - * Failure: negative - * - * Programmer: similar to H5HF_get_cparam_test() - * Vailin Choi; August 25th, 2008 + * Programmer: Vailin Choi + * August 25th, 2008 * *------------------------------------------------------------------------- */ @@ -106,13 +105,13 @@ H5FS_get_cparam_test(const H5FS_t *frsp, H5FS_create_t *cparam) /*------------------------------------------------------------------------- * Function: H5FS_cmp_cparam_test * - * Purpose: Compare the parameters used to create the fractal heap + * Purpose: Compare the parameters used to create the free space manager + * similar to H5HF_cmp_cparam_test() * - * Return: Success: non-negative - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: similar to H5HF_cmp_cparam_test() - * Vailin Choi; August 25th, 2008 + * Programmer: Vailin Choi + * August 25th, 2008 * *------------------------------------------------------------------------- */ |