diff options
author | Quincey Koziol <koziol@koziol.gov> | 2019-08-21 02:07:13 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@koziol.gov> | 2019-08-21 02:07:13 (GMT) |
commit | 53eaeff26af649a1947f1b2889c3bf185b285112 (patch) | |
tree | 14295a9471b38940a3f9e49b0f089faa5044cadb | |
parent | 2ef7eb51b99a3e015efdecedd64c0be1ad77615c (diff) | |
download | hdf5-53eaeff26af649a1947f1b2889c3bf185b285112.zip hdf5-53eaeff26af649a1947f1b2889c3bf185b285112.tar.gz hdf5-53eaeff26af649a1947f1b2889c3bf185b285112.tar.bz2 |
Begin converting the H5MF interface to use shared file pointers instead
of top file pointers.
-rw-r--r-- | src/H5Fint.c | 2 | ||||
-rw-r--r-- | src/H5Fprivate.h | 1 | ||||
-rw-r--r-- | src/H5MF.c | 104 | ||||
-rw-r--r-- | src/H5MFpkg.h | 17 | ||||
-rw-r--r-- | src/H5MFprivate.h | 2 | ||||
-rw-r--r-- | test/mf.c | 39 |
6 files changed, 82 insertions, 83 deletions
diff --git a/src/H5Fint.c b/src/H5Fint.c index 4a0c397..f27a263 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -1041,7 +1041,7 @@ H5F__new(H5F_file_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_ if(H5FD_get_fs_type_map(lf, f->shared->fs_type_map) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't get free space type mapping from VFD") - if(H5MF_init_merge_flags(f) < 0) + if(H5MF_init_merge_flags(f->shared) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "problem initializing free space merge flags") f->shared->tmp_addr = f->shared->maxaddr; /* Disable temp. space allocation for parallel I/O (for now) */ diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index 1b8d07c..f196ec0 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -579,6 +579,7 @@ typedef struct H5F_t H5F_t; #define H5F_SDATA_BLOCK_SIZE_DEF 2048 /* Check for file using paged aggregation */ +#define H5F_SHARED_PAGED_AGGR(F_SH) ((F_SH)->fs_strategy == H5F_FSPACE_STRATEGY_PAGE && (F_SH)->fs_page_size) #define H5F_PAGED_AGGR(F) (F->shared->fs_strategy == H5F_FSPACE_STRATEGY_PAGE && F->shared->fs_page_size) /* Metadata read attempt values */ @@ -55,6 +55,11 @@ if(!H5F_addr_defined(FSM->addr) || !H5F_addr_defined(FSM->sect_addr)) \ *CF = TRUE; +/* For non-paged aggregation: map allocation request type to tracked free-space type */ +/* F_SH -- pointer to H5F_file_t; T -- H5FD_mem_t */ +#define H5MF_ALLOC_TO_FS_AGGR_TYPE(F_SH, T) \ + ((H5FD_MEM_DEFAULT == (F_SH)->fs_type_map[T]) ? (T) : (F_SH)->fs_type_map[T]) + /******************/ /* Local Typedefs */ /******************/ @@ -141,7 +146,7 @@ hbool_t H5_PKG_INIT_VAR = FALSE; *------------------------------------------------------------------------- */ herr_t -H5MF_init_merge_flags(H5F_t *f) +H5MF_init_merge_flags(H5F_file_t *f_sh) { H5MF_aggr_merge_t mapping_type; /* Type of free list mapping */ H5FD_mem_t type; /* Memory type for iteration */ @@ -151,9 +156,8 @@ H5MF_init_merge_flags(H5F_t *f) FUNC_ENTER_NOAPI(FAIL) /* check args */ - HDassert(f); - HDassert(f->shared); - HDassert(f->shared->lf); + HDassert(f_sh); + HDassert(f_sh->lf); /* Iterate over all the free space types to determine if sections of that type * can merge with the metadata or small 'raw' data aggregator @@ -161,21 +165,21 @@ H5MF_init_merge_flags(H5F_t *f) all_same = TRUE; for(type = H5FD_MEM_DEFAULT; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, type)) /* Check for any different type mappings */ - if(f->shared->fs_type_map[type] != f->shared->fs_type_map[H5FD_MEM_DEFAULT]) { + if(f_sh->fs_type_map[type] != f_sh->fs_type_map[H5FD_MEM_DEFAULT]) { all_same = FALSE; break; } /* end if */ /* Check for all allocation types mapping to the same free list type */ if(all_same) { - if(f->shared->fs_type_map[H5FD_MEM_DEFAULT] == H5FD_MEM_DEFAULT) + if(f_sh->fs_type_map[H5FD_MEM_DEFAULT] == H5FD_MEM_DEFAULT) mapping_type = H5MF_AGGR_MERGE_SEPARATE; else mapping_type = H5MF_AGGR_MERGE_TOGETHER; } /* end if */ else { /* Check for raw data mapping into same list as metadata */ - if(f->shared->fs_type_map[H5FD_MEM_DRAW] == f->shared->fs_type_map[H5FD_MEM_SUPER]) + if(f_sh->fs_type_map[H5FD_MEM_DRAW] == f_sh->fs_type_map[H5FD_MEM_SUPER]) mapping_type = H5MF_AGGR_MERGE_SEPARATE; else { hbool_t all_metadata_same; /* Whether all metadata go in same free list */ @@ -188,7 +192,7 @@ H5MF_init_merge_flags(H5F_t *f) /* (global heap is treated as raw data) */ if(type != H5FD_MEM_DRAW && type != H5FD_MEM_GHEAP) { /* Check for any different type mappings */ - if(f->shared->fs_type_map[type] != f->shared->fs_type_map[H5FD_MEM_SUPER]) { + if(f_sh->fs_type_map[type] != f_sh->fs_type_map[H5FD_MEM_SUPER]) { all_metadata_same = FALSE; break; } /* end if */ @@ -206,30 +210,30 @@ H5MF_init_merge_flags(H5F_t *f) switch(mapping_type) { case H5MF_AGGR_MERGE_SEPARATE: /* Don't merge any metadata together */ - HDmemset(f->shared->fs_aggr_merge, 0, sizeof(f->shared->fs_aggr_merge)); + HDmemset(f_sh->fs_aggr_merge, 0, sizeof(f_sh->fs_aggr_merge)); /* Check if merging raw data should be allowed */ /* (treat global heaps as raw data) */ - if(H5FD_MEM_DRAW == f->shared->fs_type_map[H5FD_MEM_DRAW] || - H5FD_MEM_DEFAULT == f->shared->fs_type_map[H5FD_MEM_DRAW]) { - f->shared->fs_aggr_merge[H5FD_MEM_DRAW] = H5F_FS_MERGE_RAWDATA; - f->shared->fs_aggr_merge[H5FD_MEM_GHEAP] = H5F_FS_MERGE_RAWDATA; + if(H5FD_MEM_DRAW == f_sh->fs_type_map[H5FD_MEM_DRAW] || + H5FD_MEM_DEFAULT == f_sh->fs_type_map[H5FD_MEM_DRAW]) { + f_sh->fs_aggr_merge[H5FD_MEM_DRAW] = H5F_FS_MERGE_RAWDATA; + f_sh->fs_aggr_merge[H5FD_MEM_GHEAP] = H5F_FS_MERGE_RAWDATA; } /* end if */ break; case H5MF_AGGR_MERGE_DICHOTOMY: /* Merge all metadata together (but not raw data) */ - HDmemset(f->shared->fs_aggr_merge, H5F_FS_MERGE_METADATA, sizeof(f->shared->fs_aggr_merge)); + HDmemset(f_sh->fs_aggr_merge, H5F_FS_MERGE_METADATA, sizeof(f_sh->fs_aggr_merge)); /* Allow merging raw data allocations together */ /* (treat global heaps as raw data) */ - f->shared->fs_aggr_merge[H5FD_MEM_DRAW] = H5F_FS_MERGE_RAWDATA; - f->shared->fs_aggr_merge[H5FD_MEM_GHEAP] = H5F_FS_MERGE_RAWDATA; + f_sh->fs_aggr_merge[H5FD_MEM_DRAW] = H5F_FS_MERGE_RAWDATA; + f_sh->fs_aggr_merge[H5FD_MEM_GHEAP] = H5F_FS_MERGE_RAWDATA; break; case H5MF_AGGR_MERGE_TOGETHER: /* Merge all allocation types together */ - HDmemset(f->shared->fs_aggr_merge, (H5F_FS_MERGE_METADATA | H5F_FS_MERGE_RAWDATA), sizeof(f->shared->fs_aggr_merge)); + HDmemset(f_sh->fs_aggr_merge, (H5F_FS_MERGE_METADATA | H5F_FS_MERGE_RAWDATA), sizeof(f_sh->fs_aggr_merge)); break; default: @@ -254,31 +258,32 @@ done: *------------------------------------------------------------------------- */ void -H5MF__alloc_to_fs_type(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size, H5F_mem_page_t *fs_type) +H5MF__alloc_to_fs_type(H5F_file_t *f_sh, H5FD_mem_t alloc_type, hsize_t size, H5F_mem_page_t *fs_type) { FUNC_ENTER_PACKAGE_NOERR - HDassert(f); + /* Check arguments */ + HDassert(f_sh); HDassert(fs_type); - if(H5F_PAGED_AGGR(f)) { /* paged aggregation */ - if(size >= f->shared->fs_page_size) { - if(H5F_HAS_FEATURE(f, H5FD_FEAT_PAGED_AGGR)) { /* multi or split driver */ + if(H5F_SHARED_PAGED_AGGR(f_sh)) { /* paged aggregation */ + if(size >= f_sh->fs_page_size) { + if(H5F_SHARED_HAS_FEATURE(f_sh, H5FD_FEAT_PAGED_AGGR)) { /* multi or split driver */ /* For non-contiguous address space, map to large size free-space manager for each alloc_type */ - if(H5FD_MEM_DEFAULT == f->shared->fs_type_map[alloc_type]) - *fs_type = (H5F_mem_page_t) (alloc_type + (H5FD_MEM_NTYPES - 1)); + if(H5FD_MEM_DEFAULT == f_sh->fs_type_map[alloc_type]) + *fs_type = (H5F_mem_page_t)(alloc_type + (H5FD_MEM_NTYPES - 1)); else - *fs_type = (H5F_mem_page_t) (f->shared->fs_type_map[alloc_type] + (H5FD_MEM_NTYPES - 1)); + *fs_type = (H5F_mem_page_t)(f_sh->fs_type_map[alloc_type] + (H5FD_MEM_NTYPES - 1)); } /* end if */ else /* For contiguous address space, map to generic large size free-space manager */ *fs_type = H5F_MEM_PAGE_GENERIC; /* H5F_MEM_PAGE_SUPER */ } /* end if */ else - *fs_type = (H5F_mem_page_t)H5MF_ALLOC_TO_FS_AGGR_TYPE(f, alloc_type); + *fs_type = (H5F_mem_page_t)H5MF_ALLOC_TO_FS_AGGR_TYPE(f_sh, alloc_type); } /* end if */ else /* non-paged aggregation */ - *fs_type = (H5F_mem_page_t)H5MF_ALLOC_TO_FS_AGGR_TYPE(f, alloc_type); + *fs_type = (H5F_mem_page_t)H5MF_ALLOC_TO_FS_AGGR_TYPE(f_sh, alloc_type); FUNC_LEAVE_NOAPI_VOID } /* end H5MF__alloc_to_fs_type() */ @@ -620,7 +625,6 @@ done: FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5MF__close_fstype() */ - /*------------------------------------------------------------------------- * Function: H5MF__add_sect @@ -649,7 +653,7 @@ H5MF__add_sect(H5F_t *f, H5FD_mem_t alloc_type, H5FS_t *fspace, H5MF_free_sectio HDassert(fspace); HDassert(node); - H5MF__alloc_to_fs_type(f, alloc_type, node->sect_info.size, &fs_type); + H5MF__alloc_to_fs_type(f->shared, alloc_type, node->sect_info.size, &fs_type); /* Construct user data for callbacks */ udata.f = f; @@ -801,7 +805,7 @@ HDfprintf(stderr, "%s: alloc_type = %u, size = %Hu\n", FUNC, (unsigned)alloc_typ HDassert(f->shared->lf); HDassert(size > 0); - H5MF__alloc_to_fs_type(f, alloc_type, size, &fs_type); + H5MF__alloc_to_fs_type(f->shared, alloc_type, size, &fs_type); #ifdef H5MF_ALLOC_DEBUG_MORE HDfprintf(stderr, "%s: Check 1.0\n", FUNC); @@ -907,10 +911,10 @@ H5MF__alloc_pagefs(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size) HDfprintf(stderr, "%s: alloc_type = %u, size = %Hu\n", FUNC, (unsigned)alloc_type, size); #endif /* H5MF_ALLOC_DEBUG */ - H5MF__alloc_to_fs_type(f, alloc_type, size, &ptype); + H5MF__alloc_to_fs_type(f->shared, alloc_type, size, &ptype); switch(ptype) { - case H5F_MEM_PAGE_GENERIC: + case H5F_MEM_PAGE_GENERIC: case H5F_MEM_PAGE_LARGE_BTREE: case H5F_MEM_PAGE_LARGE_DRAW: case H5F_MEM_PAGE_LARGE_GHEAP: @@ -1108,7 +1112,7 @@ HDfprintf(stderr, "%s: Entering - alloc_type = %u, addr = %a, size = %Hu\n", FUN HGOTO_DONE(SUCCEED) HDassert(addr != 0); /* Can't deallocate the superblock :-) */ - H5MF__alloc_to_fs_type(f, alloc_type, size, &fs_type); + H5MF__alloc_to_fs_type(f->shared, alloc_type, size, &fs_type); /* Set the ring type in the API context */ if(H5MF__fsm_type_is_self_referential(f, fs_type)) @@ -1325,7 +1329,7 @@ HDfprintf(stderr, "%s: Entering: alloc_type = %u, addr = %a, size = %Hu, extra_r } /* end if */ /* Get free space type from allocation type */ - H5MF__alloc_to_fs_type(f, alloc_type, size, &fs_type); + H5MF__alloc_to_fs_type(f->shared, alloc_type, size, &fs_type); /* Set the ring type in the API context */ if(H5MF__fsm_type_is_self_referential(f, fs_type)) @@ -1476,7 +1480,7 @@ HDfprintf(stderr, "%s: Entering - alloc_type = %u, addr = %a, size = %Hu\n", FUN HDassert(sect_cls); /* Get free space type from allocation type */ - H5MF__alloc_to_fs_type(f, alloc_type, size, &fs_type); + H5MF__alloc_to_fs_type(f->shared, alloc_type, size, &fs_type); /* Set the ring type in the API context */ if(H5MF__fsm_type_is_self_referential(f, fs_type)) @@ -2730,7 +2734,7 @@ H5MF_settle_raw_data_fsm(H5F_t *f, hbool_t *fsm_settled) break; for(mem_type = H5FD_MEM_SUPER; mem_type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5F_mem_t, mem_type)) { - H5MF__alloc_to_fs_type(f, mem_type, alloc_size, &fsm_type); + H5MF__alloc_to_fs_type(f->shared, mem_type, alloc_size, &fsm_type); if(pass_count == 0) { /* this is the first pass */ HDassert(fsm_type > H5F_MEM_PAGE_DEFAULT); @@ -2875,7 +2879,7 @@ H5MF_settle_raw_data_fsm(H5F_t *f, hbool_t *fsm_settled) break; for(mem_type = H5FD_MEM_SUPER; mem_type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5F_mem_t, mem_type)) { - H5MF__alloc_to_fs_type(f, mem_type, alloc_size, &fsm_type); + H5MF__alloc_to_fs_type(f->shared, mem_type, alloc_size, &fsm_type); if(pass_count == 0) { /* this is the first pass */ HDassert(fsm_type > H5F_MEM_PAGE_DEFAULT); @@ -3119,8 +3123,8 @@ H5MF_settle_meta_data_fsm(H5F_t *f, hbool_t *fsm_settled) /* should only be called if file is opened R/W */ HDassert(H5F_INTENT(f) & H5F_ACC_RDWR); - H5MF__alloc_to_fs_type(f, H5FD_MEM_FSPACE_HDR, (size_t)1, &sm_fshdr_fs_type); - H5MF__alloc_to_fs_type(f, H5FD_MEM_FSPACE_SINFO, (size_t)1, &sm_fssinfo_fs_type); + H5MF__alloc_to_fs_type(f->shared, H5FD_MEM_FSPACE_HDR, (size_t)1, &sm_fshdr_fs_type); + H5MF__alloc_to_fs_type(f->shared, H5FD_MEM_FSPACE_SINFO, (size_t)1, &sm_fssinfo_fs_type); HDassert(sm_fshdr_fs_type > H5F_MEM_PAGE_DEFAULT); HDassert(sm_fshdr_fs_type < H5F_MEM_PAGE_LARGE_SUPER); @@ -3136,8 +3140,8 @@ H5MF_settle_meta_data_fsm(H5F_t *f, hbool_t *fsm_settled) sm_sinfo_fspace = f->shared->fs_man[sm_fssinfo_fs_type]; if(H5F_PAGED_AGGR(f)) { - H5MF__alloc_to_fs_type(f, H5FD_MEM_FSPACE_HDR, f->shared->fs_page_size + 1, &lg_fshdr_fs_type); - H5MF__alloc_to_fs_type(f, H5FD_MEM_FSPACE_SINFO, f->shared->fs_page_size + 1, &lg_fssinfo_fs_type); + H5MF__alloc_to_fs_type(f->shared, H5FD_MEM_FSPACE_HDR, f->shared->fs_page_size + 1, &lg_fshdr_fs_type); + H5MF__alloc_to_fs_type(f->shared, H5FD_MEM_FSPACE_SINFO, f->shared->fs_page_size + 1, &lg_fssinfo_fs_type); HDassert(lg_fshdr_fs_type >= H5F_MEM_PAGE_LARGE_SUPER); HDassert(lg_fshdr_fs_type < H5F_MEM_PAGE_NTYPES); @@ -3398,18 +3402,18 @@ H5MF__fsm_type_is_self_referential(H5F_t *f, H5F_mem_page_t fsm_type) HDassert(fsm_type >= H5F_MEM_PAGE_DEFAULT); HDassert(fsm_type < H5F_MEM_PAGE_NTYPES); - H5MF__alloc_to_fs_type(f, H5FD_MEM_FSPACE_HDR, (size_t)1, &sm_fshdr_fsm); - H5MF__alloc_to_fs_type(f, H5FD_MEM_FSPACE_SINFO, (size_t)1, &sm_fssinfo_fsm); + H5MF__alloc_to_fs_type(f->shared, H5FD_MEM_FSPACE_HDR, (size_t)1, &sm_fshdr_fsm); + H5MF__alloc_to_fs_type(f->shared, H5FD_MEM_FSPACE_SINFO, (size_t)1, &sm_fssinfo_fsm); if(H5F_PAGED_AGGR(f)) { - H5MF__alloc_to_fs_type(f, H5FD_MEM_FSPACE_HDR, f->shared->fs_page_size + 1, &lg_fshdr_fsm); - H5MF__alloc_to_fs_type(f, H5FD_MEM_FSPACE_SINFO, f->shared->fs_page_size + 1, &lg_fssinfo_fsm); + H5MF__alloc_to_fs_type(f->shared, H5FD_MEM_FSPACE_HDR, f->shared->fs_page_size + 1, &lg_fshdr_fsm); + H5MF__alloc_to_fs_type(f->shared, H5FD_MEM_FSPACE_SINFO, f->shared->fs_page_size + 1, &lg_fssinfo_fsm); result = (fsm_type == sm_fshdr_fsm) || (fsm_type == sm_fssinfo_fsm) || (fsm_type == lg_fshdr_fsm) || (fsm_type == lg_fssinfo_fsm); } /* end if */ else { - /* In principle, fsm_type should always be less than + /* In principle, fsm_type should always be less than * H5F_MEM_PAGE_LARGE_SUPER whenever paged aggregation * is not enabled. However, since there is code that does * not observe this principle, force the result to FALSE if @@ -3452,15 +3456,15 @@ H5MF__fsm_is_self_referential(H5F_t *f, H5FS_t *fspace) HDassert(f->shared); HDassert(fspace); - H5MF__alloc_to_fs_type(f, H5FD_MEM_FSPACE_HDR, (size_t)1, &sm_fshdr_fsm); - H5MF__alloc_to_fs_type(f, H5FD_MEM_FSPACE_SINFO, (size_t)1, &sm_fssinfo_fsm); + H5MF__alloc_to_fs_type(f->shared, H5FD_MEM_FSPACE_HDR, (size_t)1, &sm_fshdr_fsm); + H5MF__alloc_to_fs_type(f->shared, H5FD_MEM_FSPACE_SINFO, (size_t)1, &sm_fssinfo_fsm); if(H5F_PAGED_AGGR(f)) { H5F_mem_page_t lg_fshdr_fsm; H5F_mem_page_t lg_fssinfo_fsm; - H5MF__alloc_to_fs_type(f, H5FD_MEM_FSPACE_HDR, f->shared->fs_page_size + 1, &lg_fshdr_fsm); - H5MF__alloc_to_fs_type(f, H5FD_MEM_FSPACE_SINFO, f->shared->fs_page_size + 1, &lg_fssinfo_fsm); + H5MF__alloc_to_fs_type(f->shared, H5FD_MEM_FSPACE_HDR, f->shared->fs_page_size + 1, &lg_fshdr_fsm); + H5MF__alloc_to_fs_type(f->shared, H5FD_MEM_FSPACE_SINFO, f->shared->fs_page_size + 1, &lg_fssinfo_fsm); result = (fspace == f->shared->fs_man[sm_fshdr_fsm]) || (fspace == f->shared->fs_man[sm_fssinfo_fsm]) || diff --git a/src/H5MFpkg.h b/src/H5MFpkg.h index ec4aab4..47ebc5c 100644 --- a/src/H5MFpkg.h +++ b/src/H5MFpkg.h @@ -55,11 +55,6 @@ #define H5MF_FSPACE_SECT_SMALL 1 /* For paged aggregation: "small" meta/raw data section which is < fsp_size) */ #define H5MF_FSPACE_SECT_LARGE 2 /* For paged aggregation: "large" Section which is >= fsp_size) */ -/* For non-paged aggregation: map allocation request type to tracked free-space type */ -/* F -- pointer to H5F_t; T -- H5FD_mem_t */ -#define H5MF_ALLOC_TO_FS_AGGR_TYPE(F, T) \ - ((H5FD_MEM_DEFAULT == (F)->shared->fs_type_map[T]) ? (T) : (F)->shared->fs_type_map[T]) - /* Get section class type based on size */ #define H5MF_SECT_CLASS_TYPE(F, S) \ ((H5F_PAGED_AGGR(F)) ? \ @@ -182,13 +177,10 @@ H5_DLLVAR H5FS_section_class_t H5MF_FSPACE_SECT_CLS_LARGE[1]; /* Allocator routines */ H5_DLL herr_t H5MF__open_fstype(H5F_t *f, H5F_mem_page_t type); H5_DLL herr_t H5MF__start_fstype(H5F_t *f, H5F_mem_page_t type); - H5_DLL htri_t H5MF__find_sect(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size, H5FS_t *fspace, haddr_t *addr); H5_DLL herr_t H5MF__add_sect(H5F_t *f, H5FD_mem_t alloc_type, H5FS_t *fspace, H5MF_free_section_t *node); - -H5_DLL herr_t H5MF__sects_dump(H5F_t *f, FILE *stream); - -H5_DLL void H5MF__alloc_to_fs_type(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size, H5F_mem_page_t *fs_type); +H5_DLL void H5MF__alloc_to_fs_type(H5F_file_t *f_sh, H5FD_mem_t alloc_type, + hsize_t size, H5F_mem_page_t *fs_type); /* 'simple/small/large' section routines */ H5_DLL H5MF_free_section_t *H5MF__sect_new(unsigned ctype, haddr_t sect_off, @@ -206,6 +198,11 @@ H5_DLL herr_t H5MF__aggr_absorb(const H5F_t *f, H5F_blk_aggr_t *aggr, H5_DLL herr_t H5MF__aggr_query(const H5F_t *f, const H5F_blk_aggr_t *aggr, haddr_t *addr, hsize_t *size); +/* Debugging routines */ +#ifdef H5MF_ALLOC_DEBUG_DUMP +H5_DLL herr_t H5MF__sects_dump(H5F_t *f, FILE *stream); +#endif /* H5MF_ALLOC_DEBUG_DUMP */ + /* Testing routines */ #ifdef H5MF_TESTING #endif /* H5MF_TESTING */ diff --git a/src/H5MFprivate.h b/src/H5MFprivate.h index bd57f05..3569615 100644 --- a/src/H5MFprivate.h +++ b/src/H5MFprivate.h @@ -48,7 +48,7 @@ /***************************************/ /* File space manager routines */ -H5_DLL herr_t H5MF_init_merge_flags(H5F_t *f); +H5_DLL herr_t H5MF_init_merge_flags(H5F_file_t *f_sh); H5_DLL herr_t H5MF_get_freespace(H5F_t *f, hsize_t *tot_space, hsize_t *meta_size); H5_DLL herr_t H5MF_close(H5F_t *f); H5_DLL herr_t H5MF_try_close(H5F_t *f); @@ -6816,7 +6816,7 @@ test_mf_fs_persist(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR - H5MF__alloc_to_fs_type(f, type, TBLOCK_SIZE6, (H5F_mem_page_t *)&tt); + H5MF__alloc_to_fs_type(f->shared, type, TBLOCK_SIZE6, (H5F_mem_page_t *)&tt); /* Verify that H5FD_MEM_SUPER free-space manager is there */ if(!H5F_addr_defined(f->shared->fs_addr[tt])) @@ -6966,7 +6966,7 @@ test_mf_fs_gone(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) FAIL_STACK_ERROR if(HADDR_UNDEF == (addr4 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE4))) FAIL_STACK_ERROR - + /* Put block #1, #3 to H5FD_MEM_SUPER free-space manager */ if(H5MF_xfree(f, type, addr1, (hsize_t)TBLOCK_SIZE1) < 0) FAIL_STACK_ERROR @@ -6990,7 +6990,7 @@ test_mf_fs_gone(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR - H5MF__alloc_to_fs_type(f, type, TBLOCK_SIZE4, (H5F_mem_page_t *)&fs_type); + H5MF__alloc_to_fs_type(f->shared, type, TBLOCK_SIZE4, (H5F_mem_page_t *)&fs_type); /* Verify that the H5FD_MEM_SUPER free-space manager is not there */ if(H5F_addr_defined(f->shared->fs_addr[fs_type])) @@ -7163,7 +7163,7 @@ test_mf_strat_thres_persist(const char *env_h5_drvr, hid_t fapl, hbool_t new_for FAIL_STACK_ERROR if(HADDR_UNDEF == (addr6 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE6))) FAIL_STACK_ERROR - + /* Put block #1, #3, #5 to H5FD_MEM_SUPER free-space manager */ if(H5MF_xfree(f, type, addr1, (hsize_t)TBLOCK_SIZE1) < 0) FAIL_STACK_ERROR @@ -7185,7 +7185,7 @@ test_mf_strat_thres_persist(const char *env_h5_drvr, hid_t fapl, hbool_t new_for if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR - H5MF__alloc_to_fs_type(f, type, TBLOCK_SIZE6, (H5F_mem_page_t *)&tt); + H5MF__alloc_to_fs_type(f->shared, type, TBLOCK_SIZE6, (H5F_mem_page_t *)&tt); /* Get a pointer to the internal file object */ if(NULL == (f = (H5F_t *)H5VL_object(file))) @@ -7195,7 +7195,7 @@ test_mf_strat_thres_persist(const char *env_h5_drvr, hid_t fapl, hbool_t new_for hssize_t nsects; /* # of free-space sections */ int i; /* local index variable */ H5F_sect_info_t *sect_info; /* array to hold the free-space information */ - + /* Get the # of free-space sections in the file */ if((nsects = H5Fget_free_sections(file, H5FD_MEM_DEFAULT, (size_t)0, NULL)) < 0) FAIL_STACK_ERROR @@ -7210,7 +7210,7 @@ test_mf_strat_thres_persist(const char *env_h5_drvr, hid_t fapl, hbool_t new_for sect_info = (H5F_sect_info_t *)HDcalloc((size_t)nsects, sizeof(H5F_sect_info_t)); H5Fget_free_sections(file, H5FD_MEM_DEFAULT, (size_t)nsects, sect_info); - + /* Verify the size of free-space sections */ for(i = 0; i < nsects; i++) if(sect_info[i].size < fs_threshold) @@ -7336,13 +7336,12 @@ test_mf_strat_thres_gone(const char *env_h5_drvr, hid_t fapl, hbool_t new_format if(HADDR_UNDEF == (addr6 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE6))) FAIL_STACK_ERROR - H5MF__alloc_to_fs_type(f, type, TBLOCK_SIZE6, (H5F_mem_page_t *)&tt); + H5MF__alloc_to_fs_type(f->shared, type, TBLOCK_SIZE6, (H5F_mem_page_t *)&tt); /* For paged aggregation, the section in the page at EOF for small meta fs is not shrunk away */ - if(fs_type == H5F_FSPACE_STRATEGY_PAGE) { + if(fs_type == H5F_FSPACE_STRATEGY_PAGE) if(H5FS_stat_info(f, f->shared->fs_man[tt], &fs_state) < 0) FAIL_STACK_ERROR - } /* Put block #3, #5 to H5FD_MEM_SUPER free-space manager */ if(H5MF_xfree(f, type, addr3, (hsize_t)TBLOCK_SIZE3) < 0) @@ -7637,7 +7636,7 @@ test_page_alloc_xfree(const char *env_h5_drvr, hid_t fapl) /* Get a pointer to the internal file object */ if(NULL == (f = (H5F_t *)H5VL_object(fid))) TEST_ERROR - + /* Allocate 3 small metadata blocks: addr1, addr2, addr3 */ H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE30); addr2 = H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE1034); @@ -7647,8 +7646,7 @@ test_page_alloc_xfree(const char *env_h5_drvr, hid_t fapl) H5MF_xfree(f, H5FD_MEM_OHDR, addr2, (hsize_t)TBLOCK_SIZE1034); if(!fs_persist) { - - H5MF__alloc_to_fs_type(f, H5FD_MEM_OHDR, TBLOCK_SIZE1034, (H5F_mem_page_t *)&fs_type); + H5MF__alloc_to_fs_type(f->shared, H5FD_MEM_OHDR, TBLOCK_SIZE1034, (H5F_mem_page_t *)&fs_type); /* Verify that the freed block with addr2 is found from the small metadata manager */ if(H5MF__find_sect(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE1034, f->shared->fs_man[fs_type], &found_addr) < 0) @@ -7680,8 +7678,7 @@ test_page_alloc_xfree(const char *env_h5_drvr, hid_t fapl) H5MF_xfree(f, H5FD_MEM_DRAW, gaddr1, (hsize_t)TBLOCK_SIZE5000); if(!fs_persist) { - - H5MF__alloc_to_fs_type(f, H5FD_MEM_DRAW, TBLOCK_SIZE5000, (H5F_mem_page_t *)&fs_type); + H5MF__alloc_to_fs_type(f->shared, H5FD_MEM_DRAW, TBLOCK_SIZE5000, (H5F_mem_page_t *)&fs_type); /* Verify that the freed block with gaddr1 is found from the large data manager */ if(H5MF__find_sect(f, H5FD_MEM_DRAW, (hsize_t)TBLOCK_SIZE8192, f->shared->fs_man[fs_type], &found_addr) < 0) @@ -7702,18 +7699,18 @@ test_page_alloc_xfree(const char *env_h5_drvr, hid_t fapl) /* Re-open the file */ if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0) TEST_ERROR - + /* Get a pointer to the internal file object */ if(NULL == (f = (H5F_t *)H5VL_object(fid))) TEST_ERROR /* Verify that the large generic manager is there */ - H5MF__alloc_to_fs_type(f, H5FD_MEM_DRAW, TBLOCK_SIZE5000, (H5F_mem_page_t *)&fs_type); + H5MF__alloc_to_fs_type(f->shared, H5FD_MEM_DRAW, TBLOCK_SIZE5000, (H5F_mem_page_t *)&fs_type); if(!H5F_addr_defined(f->shared->fs_addr[fs_type])) TEST_ERROR /* Verify that the small metadata manager is there */ - H5MF__alloc_to_fs_type(f, H5FD_MEM_OHDR, f->shared->fs_page_size - 1, (H5F_mem_page_t *)&fs_type); + H5MF__alloc_to_fs_type(f->shared, H5FD_MEM_OHDR, f->shared->fs_page_size - 1, (H5F_mem_page_t *)&fs_type); if(!H5F_addr_defined(f->shared->fs_addr[fs_type])) TEST_ERROR @@ -7732,7 +7729,7 @@ test_page_alloc_xfree(const char *env_h5_drvr, hid_t fapl) /* Verify that the small raw data manager is there */ if(!H5F_addr_defined(f->shared->fs_addr[H5F_MEM_PAGE_DRAW])) TEST_ERROR - + /* Set up to use the small raw data manager */ if(!(f->shared->fs_man[H5F_MEM_PAGE_DRAW])) if(H5MF__open_fstype(f, H5F_MEM_PAGE_DRAW) < 0) @@ -7744,7 +7741,7 @@ test_page_alloc_xfree(const char *env_h5_drvr, hid_t fapl) if(found_addr != saddr1) TEST_ERROR - H5MF__alloc_to_fs_type(f, H5FD_MEM_DRAW, TBLOCK_SIZE5000, (H5F_mem_page_t *)&fs_type); + H5MF__alloc_to_fs_type(f->shared, H5FD_MEM_DRAW, TBLOCK_SIZE5000, (H5F_mem_page_t *)&fs_type); if(!(f->shared->fs_man[fs_type])) /* Set up to use the large data manager */ @@ -7756,7 +7753,7 @@ test_page_alloc_xfree(const char *env_h5_drvr, hid_t fapl) TEST_ERROR if(found_addr != gaddr1) TEST_ERROR - + /* Close file */ if(H5Fclose(fid) < 0) TEST_ERROR |