diff options
Diffstat (limited to 'src/H5FS.c')
-rw-r--r-- | src/H5FS.c | 19 |
1 files changed, 11 insertions, 8 deletions
@@ -123,7 +123,7 @@ HDfprintf(stderr, "%s: Creating free space manager, nclasses = %Zu\n", FUNC, ncl /* * Allocate free space structure */ - if(NULL == (fspace = H5FS_new(nclasses, classes, cls_init_udata))) + 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") /* Initialize creation information for free space manager */ @@ -139,7 +139,7 @@ HDfprintf(stderr, "%s: Creating free space manager, nclasses = %Zu\n", FUNC, ncl /* Check if the free space tracker is supposed to be persistant */ if(fs_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)))) + if(HADDR_UNDEF == (fspace->addr = H5MF_alloc(f, H5FD_MEM_FSPACE_HDR, dxpl_id, (hsize_t)fspace->hdr_size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "file allocation failed for free space header") /* Cache the new free space header (pinned) */ @@ -213,6 +213,7 @@ HDfprintf(stderr, "%s: Opening free space manager, fs_addr = %a, nclasses = %Zu\ cache_udata.nclasses = nclasses; cache_udata.classes = classes; cache_udata.cls_init_udata = cls_init_udata; + cache_udata.addr = fs_addr; /* Protect the free space header */ if(NULL == (fspace = (H5FS_t *)H5AC_protect(f, dxpl_id, H5AC_FSPACE_HDR, fs_addr, &cache_udata, H5AC_READ))) @@ -281,6 +282,7 @@ HDfprintf(stderr, "%s: Deleting free space manager, fs_addr = %a\n", FUNC, fs_ad cache_udata.nclasses = 0; cache_udata.classes = NULL; cache_udata.cls_init_udata = NULL; + cache_udata.addr = fs_addr; /* Protect the free space header */ if(NULL == (fspace = (H5FS_t *)H5AC_protect(f, dxpl_id, H5AC_FSPACE_HDR, fs_addr, &cache_udata, H5AC_WRITE))) @@ -390,7 +392,7 @@ HDfprintf(stderr, "%s: Real sections to store in file\n", FUNC); fspace->alloc_sect_size = (size_t)fspace->sect_size; /* Mark free space header as dirty */ - if(H5AC_mark_pinned_or_protected_entry_dirty(fspace) < 0) + if(H5AC_mark_entry_dirty(fspace) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, FAIL, "unable to mark free space header as dirty") } /* end if */ } /* end if */ @@ -447,7 +449,7 @@ HDfprintf(stderr, "%s: Section info went 'go away'\n", FUNC); fspace->alloc_sect_size = 0; /* Mark free space header as dirty */ - if(H5AC_mark_pinned_or_protected_entry_dirty(fspace) < 0) + if(H5AC_mark_entry_dirty(fspace) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, FAIL, "unable to mark free space header as dirty") } /* end else */ } /* end if */ @@ -463,7 +465,7 @@ HDfprintf(stderr, "%s: Section info is NOT for file free space\n", FUNC); fspace->alloc_sect_size = 0; /* Mark free space header as dirty */ - if(H5AC_mark_pinned_or_protected_entry_dirty(fspace) < 0) + if(H5AC_mark_entry_dirty(fspace) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, FAIL, "unable to mark free space header as dirty") /* Free previous serialized sections disk space */ @@ -513,7 +515,7 @@ HDfprintf(stderr, "%s: Leaving, ret_value = %d, fspace->rc = %u\n", FUNC, ret_va *------------------------------------------------------------------------- */ H5FS_t * -H5FS_new(size_t nclasses, const H5FS_section_class_t *classes[], +H5FS_new(const H5F_t *f, size_t nclasses, const H5FS_section_class_t *classes[], void *cls_init_udata) { H5FS_t *fspace = NULL; /* Free space manager */ @@ -558,6 +560,7 @@ H5FS_new(size_t nclasses, const H5FS_section_class_t *classes[], /* Initialize non-zero information for new free space manager */ fspace->addr = HADDR_UNDEF; + fspace->hdr_size = H5FS_HEADER_SIZE(f); fspace->sect_addr = HADDR_UNDEF; /* Set return value */ @@ -604,7 +607,7 @@ H5FS_size(const H5F_t *f, const H5FS_t *fspace, hsize_t *meta_size) HDassert(meta_size); /* Get the free space size info */ - *meta_size += H5FS_HEADER_SIZE(f) + (fspace->sinfo ? fspace->sect_size : fspace->alloc_sect_size); + *meta_size += fspace->hdr_size + (fspace->sinfo ? fspace->sect_size : fspace->alloc_sect_size); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5FS_size() */ @@ -728,7 +731,7 @@ HDfprintf(stderr, "%s: Marking free space header as dirty\n", FUNC); /* Check if the free space manager is persistant */ if(H5F_addr_defined(fspace->addr)) /* Mark header as dirty in cache */ - if(H5AC_mark_pinned_or_protected_entry_dirty(fspace) < 0) + if(H5AC_mark_entry_dirty(fspace) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, FAIL, "unable to mark free space header as dirty") done: |