diff options
Diffstat (limited to 'src/H5FS.c')
-rw-r--r-- | src/H5FS.c | 96 |
1 files changed, 50 insertions, 46 deletions
@@ -452,50 +452,9 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5FS_new() */ -#ifdef H5FS_DEBUG /*------------------------------------------------------------------------- - * Function: H5FS_assert - * - * Purpose: Verify that the free space manager is mostly sane - * - * Return: Non-negative on success, negative on failure - * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Jul 17 2006 - * - *------------------------------------------------------------------------- - */ -herr_t -H5FS_assert(const H5FS_t *fspace) -{ - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5FS_assert) -#ifdef QAK -HDfprintf(stderr, "%s: fspace->hdr->tot_sect_count = %Hu\n", "H5FS_assert", fspace->hdr->tot_sect_count); -#endif /* QAK */ - - /* Sanity check sections */ - H5FS_sect_assert(fspace); - - /* General assumptions about the section size counts */ - HDassert(fspace->sinfo->tot_size_count >= fspace->sinfo->serial_size_count); - HDassert(fspace->sinfo->tot_size_count >= fspace->sinfo->ghost_size_count); - - /* General assumptions about the section counts */ - HDassert(fspace->tot_sect_count >= fspace->serial_sect_count); - HDassert(fspace->tot_sect_count >= fspace->ghost_sect_count); - HDassert(fspace->tot_sect_count == (fspace->serial_sect_count + fspace->ghost_sect_count)); -#ifdef QAK - HDassert(fspace->serial_sect_count > 0 || fspace->ghost_sect_count == 0); -#endif /* QAK */ - - FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5FS_assert() */ -#endif /* H5FS_DEBUG */ - -/*------------------------------------------------------------------------- - * Function: H5FS_meta_info + * Function: H5FS_size * * Purpose: Collect meta storage info used by the free space manager * @@ -508,13 +467,14 @@ HDfprintf(stderr, "%s: fspace->hdr->tot_sect_count = %Hu\n", "H5FS_assert", fspa *------------------------------------------------------------------------- */ herr_t -H5FS_meta_info(H5F_t *f, hid_t dxpl_id, haddr_t fs_addr, hsize_t *meta_size) +H5FS_size(H5F_t *f, hid_t dxpl_id, haddr_t fs_addr, hsize_t *meta_size) { 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 */ - FUNC_ENTER_NOAPI(H5FS_meta_info, FAIL) + FUNC_ENTER_NOAPI(H5FS_size, FAIL) + /* * Check arguments. */ @@ -533,11 +493,55 @@ H5FS_meta_info(H5F_t *f, hid_t dxpl_id, haddr_t fs_addr, hsize_t *meta_size) if(NULL == (fspace = H5AC_protect(f, dxpl_id, H5AC_FSPACE_HDR, fs_addr, &fs_prot, NULL, H5AC_READ))) HGOTO_ERROR(H5E_FSPACE, H5E_CANTLOAD, FAIL, "unable to load free space header") - *meta_size = H5FS_HEADER_SIZE(f) + fspace->alloc_sect_size; + /* Get the free space size info */ + *meta_size += H5FS_HEADER_SIZE(f) + fspace->alloc_sect_size; done: if(fspace && H5AC_unprotect(f, dxpl_id, H5AC_FSPACE_HDR, fs_addr, fspace, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_FSPACE, H5E_PROTECT, FAIL, "unable to release free space header") FUNC_LEAVE_NOAPI(ret_value) -} +} /* end H5FS_size() */ + +#ifdef H5FS_DEBUG + +/*------------------------------------------------------------------------- + * Function: H5FS_assert + * + * Purpose: Verify that the free space manager is mostly sane + * + * Return: Non-negative on success, negative on failure + * + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * Jul 17 2006 + * + *------------------------------------------------------------------------- + */ +herr_t +H5FS_assert(const H5FS_t *fspace) +{ + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5FS_assert) +#ifdef QAK +HDfprintf(stderr, "%s: fspace->hdr->tot_sect_count = %Hu\n", "H5FS_assert", fspace->hdr->tot_sect_count); +#endif /* QAK */ + + /* Sanity check sections */ + H5FS_sect_assert(fspace); + + /* General assumptions about the section size counts */ + HDassert(fspace->sinfo->tot_size_count >= fspace->sinfo->serial_size_count); + HDassert(fspace->sinfo->tot_size_count >= fspace->sinfo->ghost_size_count); + + /* General assumptions about the section counts */ + HDassert(fspace->tot_sect_count >= fspace->serial_sect_count); + HDassert(fspace->tot_sect_count >= fspace->ghost_sect_count); + HDassert(fspace->tot_sect_count == (fspace->serial_sect_count + fspace->ghost_sect_count)); +#ifdef QAK + HDassert(fspace->serial_sect_count > 0 || fspace->ghost_sect_count == 0); +#endif /* QAK */ + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5FS_assert() */ +#endif /* H5FS_DEBUG */ + |