From 35fc6fe082905ddb1b6bad3083d70926e75092bf Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Tue, 11 Aug 2009 12:28:42 -0500 Subject: [svn-r17325] Description: Bring r17324 from trunk to 1.8 branch: Bring more improvements/changes back from file_free_space branch Tested on: FreeBSD/32 6.3 (duty) in debug mode (h5committest performed on trunk) --- src/H5FSprivate.h | 8 +- src/H5FSstat.c | 8 +- src/H5MF.c | 221 ++++++++++++++++++++++++++++++++++++++++------------- src/H5MFpkg.h | 4 +- test/freespace.c | 108 ++++++++++++++------------ test/mf.c | 225 +++++++++++++++++++++++++++++++++--------------------- 6 files changed, 381 insertions(+), 193 deletions(-) diff --git a/src/H5FSprivate.h b/src/H5FSprivate.h index 353f85f..e5763a5 100644 --- a/src/H5FSprivate.h +++ b/src/H5FSprivate.h @@ -147,6 +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 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 */ } H5FS_stat_t; /* Typedef for iteration operations */ @@ -192,8 +197,7 @@ H5_DLL herr_t H5FS_sect_change_class(H5F_t *f, hid_t dxpl_id, H5FS_t *fspace, H5FS_section_info_t *sect, unsigned new_class); /* Statistics routine */ -H5_DLL herr_t H5FS_stat_info(const H5FS_t *fh, H5FS_stat_t *stats); - +H5_DLL herr_t H5FS_stat_info(const H5F_t *f, const H5FS_t *frsp, H5FS_stat_t *stats); /* Debugging routines for dumping file structures */ H5_DLL herr_t H5FS_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, diff --git a/src/H5FSstat.c b/src/H5FSstat.c index 7b2cb0d..18635c1 100644 --- a/src/H5FSstat.c +++ b/src/H5FSstat.c @@ -82,7 +82,7 @@ *------------------------------------------------------------------------- */ herr_t -H5FS_stat_info(const H5FS_t *frsp, H5FS_stat_t *stats) +H5FS_stat_info(const H5F_t *f, const H5FS_t *frsp, H5FS_stat_t *stats) { FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5FS_stat_info) @@ -95,7 +95,11 @@ H5FS_stat_info(const H5FS_t *frsp, H5FS_stat_t *stats) stats->tot_sect_count = frsp->tot_sect_count; stats->serial_sect_count = frsp->serial_sect_count; stats->ghost_sect_count = frsp->ghost_sect_count; - /* can add more metadata statistics for the free-space manager */ + stats->addr = frsp->addr; + stats->hdr_size = H5FS_HEADER_SIZE(f); + stats->sect_addr = frsp->sect_addr; + stats->alloc_sect_size = frsp->alloc_sect_size; + stats->sect_size = frsp->sect_size; FUNC_LEAVE_NOAPI(SUCCEED) } /* H5FS_stat_info() */ diff --git a/src/H5MF.c b/src/H5MF.c index 7e4b6f9..dcbaa04 100644 --- a/src/H5MF.c +++ b/src/H5MF.c @@ -75,6 +75,10 @@ typedef enum { /* Local Prototypes */ /********************/ +/* Allocator routines */ +static herr_t H5MF_alloc_create(H5F_t *f, hid_t dxpl_id, H5FD_mem_t type); +static herr_t H5MF_alloc_close(H5F_t *f, hid_t dxpl_id, H5FD_mem_t type); + /*********************/ /* Package Variables */ @@ -195,11 +199,10 @@ H5MF_init_merge_flags(H5F_t *f) /*------------------------------------------------------------------------- - * Function: H5MF_alloc_start + * Function: H5MF_alloc_open * - * Purpose: "Start up" free space for file - open existing free space - * structure if one exists, otherwise create a new free space - * structure + * Purpose: Open an existing free space manager of TYPE for file by + * creating a free-space structure * * Return: Success: non-negative * Failure: negative @@ -208,18 +211,111 @@ H5MF_init_merge_flags(H5F_t *f) * koziol@hdfgroup.org * Jan 8 2008 * - * Modifications: - * Vailin Choi, July 29th, 2008 - * Pass values of alignment and threshold to FS_create() for handling alignment - * *------------------------------------------------------------------------- */ herr_t -H5MF_alloc_start(H5F_t *f, hid_t dxpl_id, H5FD_mem_t type, hbool_t may_create) +H5MF_alloc_open(H5F_t *f, hid_t dxpl_id, H5FD_mem_t type) +{ + const H5FS_section_class_t *classes[] = { /* Free space section classes implemented for file */ + H5MF_FSPACE_SECT_CLS_SIMPLE}; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT(H5MF_alloc_open) + + /* + * Check arguments. + */ + HDassert(f); + HDassert(f->shared); + HDassert(H5F_addr_defined(f->shared->fs_addr[type])); + HDassert(f->shared->fs_state[type] == H5F_FS_STATE_CLOSED); + + /* Open an existing free space structure for the file */ + if(NULL == (f->shared->fs_man[type] = H5FS_open(f, dxpl_id, f->shared->fs_addr[type], + NELMTS(classes), classes, f, f->shared->alignment, f->shared->threshold))) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't initialize free space info") + + /* Set the state for the free space manager to "open", if it is now */ + if(f->shared->fs_man[type]) + f->shared->fs_state[type] = H5F_FS_STATE_OPEN; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5MF_alloc_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5MF_alloc_create + * + * Purpose: Create free space manager of TYPE for the file by creating + * a free-space structure + * + * Return: Success: non-negative + * Failure: negative + * + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * Jan 8 2008 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5MF_alloc_create(H5F_t *f, hid_t dxpl_id, H5FD_mem_t type) { const H5FS_section_class_t *classes[] = { /* Free space section classes implemented for file */ H5MF_FSPACE_SECT_CLS_SIMPLE}; herr_t ret_value = SUCCEED; /* Return value */ + H5FS_create_t fs_create; /* Free space creation parameters */ + + FUNC_ENTER_NOAPI_NOINIT(H5MF_alloc_create) + + /* + * Check arguments. + */ + HDassert(f); + HDassert(f->shared); + HDassert(!H5F_addr_defined(f->shared->fs_addr[type])); + HDassert(f->shared->fs_state[type] == H5F_FS_STATE_CLOSED); + + /* Set the free space creation parameters */ + fs_create.client = H5FS_CLIENT_FILE_ID; + fs_create.shrink_percent = H5MF_FSPACE_SHRINK; + fs_create.expand_percent = H5MF_FSPACE_EXPAND; + fs_create.max_sect_addr = 1 + H5V_log2_gen((uint64_t)f->shared->maxaddr); + fs_create.max_sect_size = f->shared->maxaddr; + + if(NULL == (f->shared->fs_man[type] = H5FS_create(f, dxpl_id, NULL, + &fs_create, NELMTS(classes), classes, f, f->shared->alignment, f->shared->threshold))) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't initialize free space info") + + + /* Set the state for the free space manager to "open", if it is now */ + if(f->shared->fs_man[type]) + f->shared->fs_state[type] = H5F_FS_STATE_OPEN; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5MF_alloc_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5MF_alloc_start + * + * Purpose: Open or create a free space manager of a given type + * + * Return: Success: non-negative + * Failure: negative + * + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * Jan 8 2008 + * + *------------------------------------------------------------------------- + */ +herr_t +H5MF_alloc_start(H5F_t *f, hid_t dxpl_id, H5FD_mem_t type) +{ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5MF_alloc_start) @@ -229,50 +325,62 @@ H5MF_alloc_start(H5F_t *f, hid_t dxpl_id, H5FD_mem_t type, hbool_t may_create) HDassert(f); HDassert(f->shared); - /* Check for creating free space info for the file */ + /* Check if the free space manager exists already */ if(H5F_addr_defined(f->shared->fs_addr[type])) { - /* Open an existing free space structure for the file */ - HDassert(f->shared->fs_state[type] == H5F_FS_STATE_CLOSED); - if(NULL == (f->shared->fs_man[type] = H5FS_open(f, dxpl_id, f->shared->fs_addr[type], - NELMTS(classes), classes, f, f->shared->alignment, f->shared->threshold))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't initialize free space info") + /* Open existing free space manager */ + if(H5MF_alloc_open(f, dxpl_id, type) < 0) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTOPENOBJ, FAIL, "can't initialize file free space") } /* end if */ else { - /* Check if we are allowed to create the free space manager */ - if(may_create) { - H5FS_create_t fs_create; /* Free space creation parameters */ - - /* Set the free space creation parameters */ - fs_create.client = H5FS_CLIENT_FILE_ID; - fs_create.shrink_percent = H5MF_FSPACE_SHRINK; - fs_create.expand_percent = H5MF_FSPACE_EXPAND; - fs_create.max_sect_addr = 1 + H5V_log2_gen((uint64_t)f->shared->maxaddr); - fs_create.max_sect_size = f->shared->maxaddr; - - /* Create the free space structure for the heap */ - HDassert(f->shared->fs_state[type] == H5F_FS_STATE_CLOSED); -#ifdef LATER - if(NULL == (f->shared->fs_man[type] = H5FS_create(f, dxpl_id, &f->shared->fs_addr[type], - &fs_create, NELMTS(classes), classes, f, f->shared->alignment, f->shared->threshold))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't initialize free space info") -#else /* LATER */ - if(NULL == (f->shared->fs_man[type] = H5FS_create(f, dxpl_id, NULL, - &fs_create, NELMTS(classes), classes, f, f->shared->alignment, f->shared->threshold))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't initialize free space info") -#endif /* LATER */ - } /* end if */ + /* Create new free space manager */ + if(H5MF_alloc_create(f, dxpl_id, type) < 0) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTCREATE, FAIL, "can't initialize file free space") } /* end else */ - /* Set the state for the free space manager to "open", if it is now */ - if(f->shared->fs_man[type]) - f->shared->fs_state[type] = H5F_FS_STATE_OPEN; - done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5MF_alloc_start() */ /*------------------------------------------------------------------------- + * Function: H5MF_alloc_close + * + * Purpose: Close an existing free space manager of TYPE for file + * + * Return: Success: non-negative + * Failure: negative + * + * Programmer: Vailin Choi; July 1st, 2009 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5MF_alloc_close(H5F_t *f, hid_t dxpl_id, H5FD_mem_t type) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT(H5MF_alloc_close) + + /* + * Check arguments. + */ + HDassert(f); + HDassert(f->shared); + HDassert(f->shared->fs_man[type]); + HDassert(f->shared->fs_state[type] != H5F_FS_STATE_CLOSED); + + /* Close an existing free space structure for the file */ + if(H5FS_close(f, dxpl_id, f->shared->fs_man[type]) < 0) + HGOTO_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't release free space info") + f->shared->fs_man[type] = NULL; + f->shared->fs_state[type] = H5F_FS_STATE_CLOSED; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5MF_alloc_close() */ + + +/*------------------------------------------------------------------------- * Function: H5MF_alloc * * Purpose: Allocate SIZE bytes of file memory and return the relative @@ -310,8 +418,8 @@ HDfprintf(stderr, "%s: alloc_type = %u, size = %Hu\n", FUNC, (unsigned)alloc_typ fs_type = H5MF_ALLOC_TO_FS_TYPE(f, alloc_type); /* Check if the free space manager for the file has been initialized */ - if(!f->shared->fs_man[fs_type]) - if(H5MF_alloc_start(f, dxpl_id, fs_type, FALSE) < 0) + if(!f->shared->fs_man[fs_type] && H5F_addr_defined(f->shared->fs_addr[fs_type])) + if(H5MF_alloc_open(f, dxpl_id, fs_type) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, HADDR_UNDEF, "can't initialize file free space") /* Search for large enough space in the free space manager */ @@ -537,7 +645,7 @@ HDfprintf(stderr, "%s: dropping addr = %a, size = %Hu, on the floor!\n", FUNC, a * space isn't at the end of the file, so start up (or create) * the file space manager */ - if(H5MF_alloc_start(f, dxpl_id, fs_type, TRUE) < 0) + if(H5MF_alloc_start(f, dxpl_id, fs_type) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't initialize file free space") } /* end if */ HDassert(f->shared->fs_man[fs_type]); @@ -625,8 +733,8 @@ HDfprintf(stderr, "%s: Entering: alloc_type = %u, addr = %a, size = %Hu, extra_r fs_type = H5MF_ALLOC_TO_FS_TYPE(f, alloc_type); /* Check if the free space for the file has been initialized */ - if(!f->shared->fs_man[fs_type]) - if(H5MF_alloc_start(f, dxpl_id, fs_type, FALSE) < 0) + if(!f->shared->fs_man[fs_type] && H5F_addr_defined(f->shared->fs_addr[fs_type])) + if(H5MF_alloc_open(f, dxpl_id, fs_type) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't initialize file free space") /* Check for test block able to block in free space manager */ @@ -689,16 +797,20 @@ H5MF_get_freespace(H5F_t *f, hid_t dxpl_id) /* Retrieve 'small data' aggregator info, if available */ if(H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sda_addr, &sda_size) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "can't query metadata aggregator stats") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "can't query small data aggregator stats") /* Iterate over all the free space types that have managers and get each free list's space */ for(type = H5FD_MEM_DEFAULT; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, type)) { hsize_t type_fs_size = 0; /* Amount of free space managed for each type */ + hbool_t fs_started = FALSE; - /* Check if the free space for the file has been initialized */ - if(!f->shared->fs_man[type]) - if(H5MF_alloc_start(f, dxpl_id, type, FALSE) < 0) + /* Check if the free space for the file has been initialized */ + if(!f->shared->fs_man[type] && H5F_addr_defined(f->shared->fs_addr[type])) { + if(H5MF_alloc_open(f, dxpl_id, type) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't initialize file free space") + HDassert(f->shared->fs_man[type]); + fs_started = TRUE; + } /* end if */ /* Retrieve free space size from free space manager */ if(f->shared->fs_man[type]) @@ -707,6 +819,11 @@ H5MF_get_freespace(H5F_t *f, hid_t dxpl_id) /* Increment total free space for types */ tot_fs_size += type_fs_size; + + /* Close the free space manager, if we opened it here */ + if(fs_started) + if(H5MF_alloc_close(f, dxpl_id, type) < 0) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't close file free space") } /* end for */ /* Start computing value to return */ @@ -905,7 +1022,7 @@ HDfprintf(stderr, "%s: Check 1.0 - f->shared->fs_man[%u] = %p, f->shared->fs_add HDfprintf(stderr, "%s: Before closing free space manager\n", FUNC); #endif /* H5MF_ALLOC_DEBUG_MORE */ if(H5FS_close(f, dxpl_id, f->shared->fs_man[type]) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't release free space info") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't release free space info") f->shared->fs_man[type] = NULL; f->shared->fs_state[type] = H5F_FS_STATE_CLOSED; } /* end if */ diff --git a/src/H5MFpkg.h b/src/H5MFpkg.h index 0e69fd0..de63f56 100644 --- a/src/H5MFpkg.h +++ b/src/H5MFpkg.h @@ -142,8 +142,8 @@ H5_DLLVAR H5FS_section_class_t H5MF_FSPACE_SECT_CLS_SIMPLE[1]; /******************************/ /* Allocator routines */ -H5_DLL herr_t H5MF_alloc_start(H5F_t *f, hid_t dxpl_id, H5FD_mem_t type, - hbool_t may_create); +H5_DLL herr_t H5MF_alloc_open(H5F_t *f, hid_t dxpl_id, H5FD_mem_t type); +H5_DLL herr_t H5MF_alloc_start(H5F_t *f, hid_t dxpl_id, H5FD_mem_t type); H5_DLL herr_t H5MF_sects_dump(H5F_t *f, hid_t dxpl_id, FILE *stream); /* 'simple' section routines */ diff --git a/test/freespace.c b/test/freespace.c index 29a1dc2..82395d0 100644 --- a/test/freespace.c +++ b/test/freespace.c @@ -90,6 +90,16 @@ static herr_t TEST_sect_merging(H5FS_section_info_t *, H5FS_section_info_t *, vo static herr_t TEST_sect_can_shrink(const H5FS_section_info_t *, void *); static herr_t TEST_sect_shrinking(H5FS_section_info_t **, void *); +static unsigned test_fs_create(hid_t fapl); +static unsigned test_fs_sect_add(hid_t fapl); +static unsigned test_fs_sect_merge(hid_t fapl); +static unsigned test_fs_sect_shrink(hid_t fapl); +static unsigned test_fs_sect_find(hid_t fapl); +static unsigned test_fs_sect_change_class(hid_t fapl); +static unsigned test_fs_sect_extend(hid_t fapl); +static unsigned test_fs_sect_iterate(hid_t fapl); + + H5FS_section_class_t TEST_FSPACE_SECT_CLS[1] = {{ TEST_FSPACE_SECT_TYPE, /* Section type */ 0, /* Extra serialized size */ @@ -171,7 +181,7 @@ const H5FS_section_class_t *test_classes[] = { static void init_cparam(H5FS_create_t *); static void init_sect_node(TEST_free_section_t *, haddr_t, hsize_t, unsigned, H5FS_section_state_t); -static int check_stats(const H5FS_t *, const frspace_state_t *); +static int check_stats(const H5F_t *, const H5FS_t *, frspace_state_t *); #define NUM_SECTIONS 1000 @@ -391,12 +401,12 @@ init_sect_node(TEST_free_section_t *sect_node, haddr_t addr, hsize_t size, unsig * Verify statistics for the free-space manager */ static int -check_stats(const H5FS_t *frsp, const frspace_state_t *state) +check_stats(const H5F_t *f, const H5FS_t *frsp, frspace_state_t *state) { H5FS_stat_t frspace_stats; /* Statistics about the heap */ /* Get statistics for heap and verify they are correct */ - if(H5FS_stat_info(frsp, &frspace_stats) < 0) + if(H5FS_stat_info(f, frsp, &frspace_stats) < 0) FAIL_STACK_ERROR if(frspace_stats.tot_space != state->tot_space) { @@ -487,7 +497,7 @@ test_fs_create(hid_t fapl) TEST_ERROR HDmemset(&state, 0, sizeof(frspace_state_t)); - if(check_stats(frsp, &state)) + if(check_stats(f, frsp, &state)) TEST_ERROR HDmemset(&test_cparam, 0, sizeof(H5FS_create_t)); @@ -636,7 +646,7 @@ test_fs_sect_add(hid_t fapl) state.tot_sect_count += 1; state.serial_sect_count += 1; - if(check_stats(frsp, &state)) + if(check_stats(f, frsp, &state)) TEST_ERROR fr_meta_size = H5FS_HEADER_SIZE(f) + H5FS_SINFO_PREFIX_SIZE(f); @@ -699,7 +709,7 @@ test_fs_sect_add(hid_t fapl) state.tot_sect_count += 1; state.ghost_sect_count += 1; - if(check_stats(frsp, &state)) + if(check_stats(f, frsp, &state)) TEST_ERROR fr_meta_size = H5FS_HEADER_SIZE(f); @@ -771,7 +781,7 @@ test_fs_sect_add(hid_t fapl) /* nothing in free-space */ HDmemset(&state, 0, sizeof(frspace_state_t)); - if(check_stats(frsp, &state)) + if(check_stats(f, frsp, &state)) TEST_ERROR /* Close the free space manager */ @@ -842,7 +852,7 @@ test_fs_sect_add(hid_t fapl) state.tot_sect_count += 1; state.serial_sect_count += 1; - if(check_stats(frsp, &state)) + if(check_stats(f, frsp, &state)) TEST_ERROR if(H5FS_sect_remove(f, H5P_DATASET_XFER_DEFAULT, frsp, (H5FS_section_info_t *)sect_node) < 0) @@ -938,7 +948,7 @@ test_fs_sect_find(hid_t fapl) HDmemset(&state, 0, sizeof(frspace_state_t)); - if(check_stats(frsp, &state)) + if(check_stats(f, frsp, &state)) TEST_ERROR if((node_found = H5FS_sect_find(f, H5P_DATASET_XFER_DEFAULT, frsp, @@ -947,7 +957,7 @@ test_fs_sect_find(hid_t fapl) if (node_found) TEST_ERROR - if(check_stats(frsp, &state)) + if(check_stats(f, frsp, &state)) TEST_ERROR /* Close the free space manager */ @@ -986,7 +996,7 @@ test_fs_sect_find(hid_t fapl) state.tot_sect_count += 1; state.serial_sect_count += 1; - if(check_stats(frsp, &state)) + if(check_stats(f, frsp, &state)) TEST_ERROR @@ -1006,7 +1016,7 @@ test_fs_sect_find(hid_t fapl) state.tot_sect_count += 1; state.serial_sect_count += 1; - if(check_stats(frsp, &state)) + if(check_stats(f, frsp, &state)) TEST_ERROR /* @@ -1025,7 +1035,7 @@ test_fs_sect_find(hid_t fapl) state.tot_sect_count += 1; state.serial_sect_count += 1; - if(check_stats(frsp, &state)) + if(check_stats(f, frsp, &state)) TEST_ERROR /* @@ -1044,7 +1054,7 @@ test_fs_sect_find(hid_t fapl) state.tot_sect_count += 1; state.serial_sect_count += 1; - if(check_stats(frsp, &state)) + if(check_stats(f, frsp, &state)) TEST_ERROR if((node_found = H5FS_sect_find(f, H5P_DATASET_XFER_DEFAULT, frsp, @@ -1103,7 +1113,7 @@ test_fs_sect_find(hid_t fapl) state.tot_sect_count += 1; state.serial_sect_count += 1; - if(check_stats(frsp, &state)) + if(check_stats(f, frsp, &state)) TEST_ERROR /* @@ -1122,7 +1132,7 @@ test_fs_sect_find(hid_t fapl) state.tot_sect_count += 1; state.serial_sect_count += 1; - if(check_stats(frsp, &state)) + if(check_stats(f, frsp, &state)) TEST_ERROR if((node_found = H5FS_sect_find(f, H5P_DATASET_XFER_DEFAULT, frsp, @@ -1176,7 +1186,7 @@ test_fs_sect_find(hid_t fapl) state.tot_sect_count += 1; state.serial_sect_count += 1; - if(check_stats(frsp, &state)) + if(check_stats(f, frsp, &state)) TEST_ERROR if((node_found = H5FS_sect_find(f, H5P_DATASET_XFER_DEFAULT, frsp, @@ -1309,7 +1319,7 @@ test_fs_sect_merge(hid_t fapl) state.tot_sect_count += 1; state.serial_sect_count += 1; - if(check_stats(frsp, &state)) + if(check_stats(f, frsp, &state)) TEST_ERROR /* @@ -1327,7 +1337,7 @@ test_fs_sect_merge(hid_t fapl) /* section B & C are merged */ state.tot_space += TEST_SECT_SIZE30; - if(check_stats(frsp, &state)) + if(check_stats(f, frsp, &state)) TEST_ERROR /* @@ -1345,7 +1355,7 @@ test_fs_sect_merge(hid_t fapl) /* section A is merged with the merged section of B & C */ state.tot_space += TEST_SECT_SIZE10; - if(check_stats(frsp, &state)) + if(check_stats(f, frsp, &state)) TEST_ERROR /* @@ -1363,7 +1373,7 @@ test_fs_sect_merge(hid_t fapl) /* section D is merged with the merged section of A & B & C */ state.tot_space += TEST_SECT_SIZE80; - if(check_stats(frsp, &state)) + if(check_stats(f, frsp, &state)) TEST_ERROR @@ -1437,7 +1447,7 @@ test_fs_sect_merge(hid_t fapl) state.tot_sect_count += 1; state.serial_sect_count += 1; - if(check_stats(frsp, &state)) + if(check_stats(f, frsp, &state)) TEST_ERROR /* @@ -1457,7 +1467,7 @@ test_fs_sect_merge(hid_t fapl) state.tot_sect_count += 1; state.serial_sect_count += 1; - if(check_stats(frsp, &state)) + if(check_stats(f, frsp, &state)) TEST_ERROR /* should not be able to find the merged section of A & B */ @@ -1531,7 +1541,7 @@ test_fs_sect_merge(hid_t fapl) state.tot_sect_count += 1; state.serial_sect_count += 1; - if(check_stats(frsp, &state)) + if(check_stats(f, frsp, &state)) TEST_ERROR /* @@ -1551,7 +1561,7 @@ test_fs_sect_merge(hid_t fapl) state.tot_sect_count += 1; state.serial_sect_count += 1; - if(check_stats(frsp, &state)) + if(check_stats(f, frsp, &state)) TEST_ERROR /* @@ -1569,7 +1579,7 @@ test_fs_sect_merge(hid_t fapl) /* sections B & C are merged because H5FS_CLS_MERGE_SYM is set & section class type is the same */ state.tot_space += TEST_SECT_SIZE50; - if(check_stats(frsp, &state)) + if(check_stats(f, frsp, &state)) TEST_ERROR /* @@ -1592,7 +1602,7 @@ test_fs_sect_merge(hid_t fapl) state.tot_sect_count += 1; state.serial_sect_count += 1; - if(check_stats(frsp, &state)) + if(check_stats(f, frsp, &state)) TEST_ERROR /* should not be able to find a merged section of A, B, C & D */ @@ -1764,7 +1774,7 @@ test_fs_sect_shrink(hid_t fapl) state.tot_sect_count += 1; state.serial_sect_count += 1; - if(check_stats(frsp, &state)) + if(check_stats(f, frsp, &state)) TEST_ERROR /* section A should still be there in free-space */ @@ -1796,7 +1806,7 @@ test_fs_sect_shrink(hid_t fapl) /* should have nothing in free-space */ HDmemset(&state, 0, sizeof(frspace_state_t)); - if(check_stats(frsp, &state)) + if(check_stats(f, frsp, &state)) TEST_ERROR /* section A should not be there in free-space */ @@ -1864,7 +1874,7 @@ test_fs_sect_shrink(hid_t fapl) state.tot_sect_count += 1; state.serial_sect_count += 1; - if(check_stats(frsp, &state)) + if(check_stats(f, frsp, &state)) TEST_ERROR /* @@ -1880,7 +1890,7 @@ test_fs_sect_shrink(hid_t fapl) FAIL_STACK_ERROR /* free-space should be the same since section B is shrunk */ - if(check_stats(frsp, &state)) + if(check_stats(f, frsp, &state)) TEST_ERROR /* section B should not be there in free-space */ @@ -1890,7 +1900,7 @@ test_fs_sect_shrink(hid_t fapl) if (node_found) TEST_ERROR - if(check_stats(frsp, &state)) + if(check_stats(f, frsp, &state)) TEST_ERROR @@ -1963,7 +1973,7 @@ test_fs_sect_shrink(hid_t fapl) state.tot_sect_count += 1; state.serial_sect_count += 1; - if(check_stats(frsp, &state)) + if(check_stats(f, frsp, &state)) TEST_ERROR /* @@ -1980,7 +1990,7 @@ test_fs_sect_shrink(hid_t fapl) /* section A & B are merged and then strunk, so there is nothing in free-space */ HDmemset(&state, 0, sizeof(frspace_state_t)); - if(check_stats(frsp, &state)) + if(check_stats(f, frsp, &state)) TEST_ERROR /* section B should not be there in free-space */ @@ -2098,7 +2108,7 @@ test_fs_sect_change_class(hid_t fapl) state.tot_sect_count += 1; state.ghost_sect_count += 1; - if(check_stats(frsp, &state)) + if(check_stats(f, frsp, &state)) TEST_ERROR /* @@ -2117,7 +2127,7 @@ test_fs_sect_change_class(hid_t fapl) state.tot_sect_count += 1; state.serial_sect_count += 1; - if(check_stats(frsp, &state)) + if(check_stats(f, frsp, &state)) TEST_ERROR if (H5FS_sect_change_class(f, H5P_DATASET_XFER_DEFAULT, frsp, (H5FS_section_info_t *)sect_node1, @@ -2126,7 +2136,7 @@ test_fs_sect_change_class(hid_t fapl) state.serial_sect_count += 1; state.ghost_sect_count -=1; - if(check_stats(frsp, &state)) + if(check_stats(f, frsp, &state)) TEST_ERROR if(H5FS_sect_find(f, H5P_DATASET_XFER_DEFAULT, frsp, @@ -2374,7 +2384,7 @@ test_fs_sect_extend(hid_t fapl) state.tot_sect_count += 1; state.serial_sect_count += 1; - if(check_stats(frsp, &state)) + if(check_stats(f, frsp, &state)) TEST_ERROR /* @@ -2393,7 +2403,7 @@ test_fs_sect_extend(hid_t fapl) state.tot_sect_count += 1; state.serial_sect_count += 1; - if(check_stats(frsp, &state)) + if(check_stats(f, frsp, &state)) TEST_ERROR /* Extend a block by requested-size */ @@ -2404,7 +2414,7 @@ test_fs_sect_extend(hid_t fapl) state.tot_space -= sect_node2->sect_info.size; state.tot_sect_count -= 1; state.serial_sect_count -= 1; - if(check_stats(frsp, &state)) + if(check_stats(f, frsp, &state)) TEST_ERROR /* Close the free space manager */ @@ -2448,7 +2458,7 @@ test_fs_sect_extend(hid_t fapl) state.tot_sect_count += 1; state.serial_sect_count += 1; - if(check_stats(frsp, &state)) + if(check_stats(f, frsp, &state)) TEST_ERROR /* @@ -2467,7 +2477,7 @@ test_fs_sect_extend(hid_t fapl) state.tot_sect_count += 1; state.serial_sect_count += 1; - if(check_stats(frsp, &state)) + if(check_stats(f, frsp, &state)) TEST_ERROR /* Extend the block by requested-size */ @@ -2475,7 +2485,7 @@ test_fs_sect_extend(hid_t fapl) TEST_ERROR /* Not able to extend the block: free space info remains the same */ - if(check_stats(frsp, &state)) + if(check_stats(f, frsp, &state)) TEST_ERROR /* Close the free space manager */ @@ -2519,7 +2529,7 @@ test_fs_sect_extend(hid_t fapl) state.tot_sect_count += 1; state.serial_sect_count += 1; - if(check_stats(frsp, &state)) + if(check_stats(f, frsp, &state)) TEST_ERROR /* @@ -2538,7 +2548,7 @@ test_fs_sect_extend(hid_t fapl) state.tot_sect_count += 1; state.serial_sect_count += 1; - if(check_stats(frsp, &state)) + if(check_stats(f, frsp, &state)) TEST_ERROR /* Extend the block by requested-size */ @@ -2547,7 +2557,7 @@ test_fs_sect_extend(hid_t fapl) /* Succeed in extending the block: total free space is decreased but other info remains the same */ state.tot_space -= 30; - if(check_stats(frsp, &state)) + if(check_stats(f, frsp, &state)) TEST_ERROR /* Close the free space manager */ @@ -2591,7 +2601,7 @@ test_fs_sect_extend(hid_t fapl) state.tot_sect_count += 1; state.serial_sect_count += 1; - if(check_stats(frsp, &state)) + if(check_stats(f, frsp, &state)) TEST_ERROR /* @@ -2610,7 +2620,7 @@ test_fs_sect_extend(hid_t fapl) state.tot_sect_count += 1; state.serial_sect_count += 1; - if(check_stats(frsp, &state)) + if(check_stats(f, frsp, &state)) TEST_ERROR /* Extend the block by requested-size */ @@ -2618,7 +2628,7 @@ test_fs_sect_extend(hid_t fapl) TEST_ERROR /* Not able to extend the block: free space manager info remains the same */ - if(check_stats(frsp, &state)) + if(check_stats(f, frsp, &state)) TEST_ERROR /* Close the free space manager */ diff --git a/test/mf.c b/test/mf.c index 05b37ea..c405694 100644 --- a/test/mf.c +++ b/test/mf.c @@ -79,18 +79,43 @@ typedef struct frspace_state_t { } frspace_state_t; -static int check_stats(const H5FS_t *, const frspace_state_t *); +static int check_stats(const H5F_t *, const H5FS_t *, frspace_state_t *); +static unsigned test_mf_eoa(const char *env_h5_drvr, hid_t fapl); +static unsigned test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl); +static unsigned test_mf_eoa_extend(const char *env_h5_drvr, hid_t fapl); +static unsigned test_mf_tmp(const char *env_h5_drvr, hid_t fapl); +static unsigned test_mf_fs_start(hid_t fapl); +static unsigned test_mf_fs_alloc_free(hid_t fapl); +static unsigned test_mf_fs_extend(hid_t fapl); +static unsigned test_mf_fs_absorb(const char *env_h5_drvr, hid_t fapl); +static unsigned test_mf_aggr_alloc1(const char *env_h5_drvr, hid_t fapl); +static unsigned test_mf_aggr_alloc2(const char *env_h5_drvr, hid_t fapl); +static unsigned test_mf_aggr_alloc3(const char *env_h5_drvr, hid_t fapl); +static unsigned test_mf_aggr_alloc4(const char *env_h5_drvr, hid_t fapl); +static unsigned test_mf_aggr_alloc5(const char *env_h5_drvr, hid_t fapl); +static unsigned test_mf_aggr_alloc6(const char *env_h5_drvr, hid_t fapl); +static unsigned test_mf_aggr_alloc7(const char *env_h5_drvr, hid_t fapl); +static unsigned test_mf_aggr_extend(const char *env_h5_drvr, hid_t fapl); +static unsigned test_mf_aggr_absorb(const char *env_h5_drvr, hid_t fapl); +static unsigned test_mf_align_eoa(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl); +static unsigned test_mf_align_fs(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl); +static unsigned test_mf_align_alloc1(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl); +static unsigned test_mf_align_alloc2(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl); +static unsigned test_mf_align_alloc3(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl); +static unsigned test_mf_align_alloc4(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl); +static unsigned test_mf_align_alloc5(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl); +static unsigned test_mf_align_alloc6(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl); /* * Verify statistics for the free-space manager */ static int -check_stats(const H5FS_t *frsp, const frspace_state_t *state) +check_stats(const H5F_t *f, const H5FS_t *frsp, frspace_state_t *state) { H5FS_stat_t frspace_stats; /* Statistics about the heap */ /* Get statistics for free-space and verify they are correct */ - if(H5FS_stat_info(frsp, &frspace_stats) < 0) + if(H5FS_stat_info(f, frsp, &frspace_stats) < 0) FAIL_STACK_ERROR if(frspace_stats.tot_space != state->tot_space) { @@ -895,7 +920,7 @@ error: } /* test_mf_tmp() */ /* - * To verify that the free-space manager is started up via H5MF_alloc_start() + * To verify that the free-space manager is created or opened * * Set up: * Turn off using meta/small data aggregator @@ -912,7 +937,7 @@ test_mf_fs_start(hid_t fapl) frspace_state_t state; - TESTING("H5MF_alloc_start() of free-space manager"); + TESTING("H5MF_alloc_create()/H5MF_alloc_open() of free-space manager"); /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -945,8 +970,10 @@ test_mf_fs_start(hid_t fapl) /* Start up free-space manager */ type = H5FD_MEM_SUPER; - if(H5MF_alloc_start(f, H5P_DATASET_XFER_DEFAULT, type, TRUE) < 0) - TEST_ERROR + + if(H5MF_alloc_start(f, H5P_DATASET_XFER_DEFAULT, type) < 0) + TEST_ERROR + if (f->shared->fs_state[type] != H5F_FS_STATE_OPEN) TEST_ERROR if (f->shared->fs_man[type]->client != H5FS_CLIENT_FILE_ID) @@ -954,7 +981,7 @@ test_mf_fs_start(hid_t fapl) HDmemset(&state, 0, sizeof(frspace_state_t)); - if(check_stats(f->shared->fs_man[type], &state)) + if(check_stats(f, f->shared->fs_man[type], &state)) TEST_ERROR if(H5Fclose(file) < 0) @@ -1052,8 +1079,10 @@ test_mf_fs_alloc_free(hid_t fapl) FAIL_STACK_ERROR type = H5FD_MEM_SUPER; - if(H5MF_alloc_start(f, H5P_DATASET_XFER_DEFAULT, type, TRUE) < 0) - TEST_ERROR + + if(H5MF_alloc_start(f, H5P_DATASET_XFER_DEFAULT, type) < 0) + TEST_ERROR + if (f->shared->fs_state[type] != H5F_FS_STATE_OPEN) TEST_ERROR if (f->shared->fs_man[type]->client != H5FS_CLIENT_FILE_ID) @@ -1077,7 +1106,7 @@ test_mf_fs_alloc_free(hid_t fapl) state.tot_sect_count += 1; state.serial_sect_count += 1; - if(check_stats(f->shared->fs_man[type], &state)) + if(check_stats(f, f->shared->fs_man[type], &state)) TEST_ERROR /* Allocate a block of 30 */ @@ -1091,7 +1120,7 @@ test_mf_fs_alloc_free(hid_t fapl) state.tot_sect_count -= 1; state.serial_sect_count -= 1; - if(check_stats(f->shared->fs_man[type], &state)) + if(check_stats(f, f->shared->fs_man[type], &state)) TEST_ERROR /* Free the block to free-space */ @@ -1100,7 +1129,7 @@ test_mf_fs_alloc_free(hid_t fapl) state.tot_space += TEST_BLOCK_SIZE30; state.tot_sect_count += 1; state.serial_sect_count += 1; - if(check_stats(f->shared->fs_man[type], &state)) + if(check_stats(f, f->shared->fs_man[type], &state)) TEST_ERROR /* Remove section A from free-space */ @@ -1135,8 +1164,10 @@ test_mf_fs_alloc_free(hid_t fapl) FAIL_STACK_ERROR type = H5FD_MEM_SUPER; - if(H5MF_alloc_start(f, H5P_DATASET_XFER_DEFAULT, type, TRUE) < 0) - TEST_ERROR + + if(H5MF_alloc_start(f, H5P_DATASET_XFER_DEFAULT, type) < 0) + TEST_ERROR + if (f->shared->fs_state[type] != H5F_FS_STATE_OPEN) TEST_ERROR if (f->shared->fs_man[type]->client != H5FS_CLIENT_FILE_ID) @@ -1160,7 +1191,7 @@ test_mf_fs_alloc_free(hid_t fapl) state.tot_sect_count += 1; state.serial_sect_count += 1; - if(check_stats(f->shared->fs_man[type], &state)) + if(check_stats(f, f->shared->fs_man[type], &state)) TEST_ERROR /* Allocate a block of 20 */ @@ -1173,7 +1204,7 @@ test_mf_fs_alloc_free(hid_t fapl) /* should still have 1 section of size 10 left in free-space manager */ state.tot_space -= (TEST_BLOCK_SIZE20); - if(check_stats(f->shared->fs_man[type], &state)) + if(check_stats(f, f->shared->fs_man[type], &state)) TEST_ERROR /* Free the block to free-space manager */ @@ -1181,7 +1212,7 @@ test_mf_fs_alloc_free(hid_t fapl) /* Still 1 section in free-space because of merging */ state.tot_space += TEST_BLOCK_SIZE20; - if(check_stats(f->shared->fs_man[type], &state)) + if(check_stats(f, f->shared->fs_man[type], &state)) TEST_ERROR /* Remove section A from free-space manager */ @@ -1217,8 +1248,10 @@ test_mf_fs_alloc_free(hid_t fapl) FAIL_STACK_ERROR type = H5FD_MEM_SUPER; - if(H5MF_alloc_start(f, H5P_DATASET_XFER_DEFAULT, type, TRUE) < 0) - TEST_ERROR + + if(H5MF_alloc_start(f, H5P_DATASET_XFER_DEFAULT, type) < 0) + TEST_ERROR + if (f->shared->fs_state[type] != H5F_FS_STATE_OPEN) TEST_ERROR if (f->shared->fs_man[type]->client != H5FS_CLIENT_FILE_ID) @@ -1242,7 +1275,7 @@ test_mf_fs_alloc_free(hid_t fapl) state.tot_sect_count += 1; state.serial_sect_count += 1; - if(check_stats(f->shared->fs_man[type], &state)) + if(check_stats(f, f->shared->fs_man[type], &state)) TEST_ERROR /* @@ -1257,7 +1290,7 @@ test_mf_fs_alloc_free(hid_t fapl) TEST_ERROR /* free-space info should be the same */ - if(check_stats(f->shared->fs_man[type], &state)) + if(check_stats(f, f->shared->fs_man[type], &state)) TEST_ERROR /* Remove section A from free-space */ @@ -1270,7 +1303,7 @@ test_mf_fs_alloc_free(hid_t fapl) TEST_ERROR HDmemset(&state, 0, sizeof(frspace_state_t)); - if(check_stats(f->shared->fs_man[type], &state)) + if(check_stats(f, f->shared->fs_man[type], &state)) TEST_ERROR /* Free the block of size 40 to free-space */ @@ -1281,7 +1314,7 @@ test_mf_fs_alloc_free(hid_t fapl) * The block is returned to free-space. * It is shrunk and freed because it is at end of file. */ - if(check_stats(f->shared->fs_man[type], &state)) + if(check_stats(f, f->shared->fs_man[type], &state)) TEST_ERROR if(H5Fclose(file) < 0) @@ -1392,8 +1425,10 @@ test_mf_fs_extend(hid_t fapl) FAIL_STACK_ERROR type = H5FD_MEM_SUPER; - if(H5MF_alloc_start(f, H5P_DATASET_XFER_DEFAULT, type, TRUE) < 0) - TEST_ERROR + + if(H5MF_alloc_start(f, H5P_DATASET_XFER_DEFAULT, type) < 0) + TEST_ERROR + if (f->shared->fs_state[type] != H5F_FS_STATE_OPEN) TEST_ERROR if (f->shared->fs_man[type]->client != H5FS_CLIENT_FILE_ID) @@ -1417,7 +1452,7 @@ test_mf_fs_extend(hid_t fapl) state.tot_sect_count += 1; state.serial_sect_count += 1; - if(check_stats(f->shared->fs_man[type], &state)) + if(check_stats(f, f->shared->fs_man[type], &state)) TEST_ERROR /* Allocate a block of 30 */ @@ -1431,7 +1466,7 @@ test_mf_fs_extend(hid_t fapl) state.tot_sect_count -= 1; state.serial_sect_count -= 1; - if(check_stats(f->shared->fs_man[type], &state)) + if(check_stats(f, f->shared->fs_man[type], &state)) TEST_ERROR /* Create section B */ @@ -1445,7 +1480,7 @@ test_mf_fs_extend(hid_t fapl) state.tot_sect_count += 1; state.serial_sect_count += 1; - if(check_stats(f->shared->fs_man[type], &state)) + if(check_stats(f, f->shared->fs_man[type], &state)) TEST_ERROR /* Try to extend the allocated block */ @@ -1460,7 +1495,7 @@ test_mf_fs_extend(hid_t fapl) state.tot_sect_count -= 1; state.serial_sect_count -= 1; - if(check_stats(f->shared->fs_man[type], &state)) + if(check_stats(f, f->shared->fs_man[type], &state)) TEST_ERROR /* Free the extended block to free-space manager */ @@ -1471,7 +1506,7 @@ test_mf_fs_extend(hid_t fapl) state.tot_sect_count = 1; state.serial_sect_count = 1; - if(check_stats(f->shared->fs_man[type], &state)) + if(check_stats(f, f->shared->fs_man[type], &state)) TEST_ERROR /* Remove the extended block */ @@ -1507,8 +1542,10 @@ test_mf_fs_extend(hid_t fapl) FAIL_STACK_ERROR type = H5FD_MEM_SUPER; - if(H5MF_alloc_start(f, H5P_DATASET_XFER_DEFAULT, type, TRUE) < 0) - TEST_ERROR + + if(H5MF_alloc_start(f, H5P_DATASET_XFER_DEFAULT, type) < 0) + TEST_ERROR + if (f->shared->fs_state[type] != H5F_FS_STATE_OPEN) TEST_ERROR if (f->shared->fs_man[type]->client != H5FS_CLIENT_FILE_ID) @@ -1532,7 +1569,7 @@ test_mf_fs_extend(hid_t fapl) state.tot_sect_count += 1; state.serial_sect_count += 1; - if(check_stats(f->shared->fs_man[type], &state)) + if(check_stats(f, f->shared->fs_man[type], &state)) TEST_ERROR /* Allocate a block of 30 */ @@ -1546,7 +1583,7 @@ test_mf_fs_extend(hid_t fapl) state.tot_sect_count -= 1; state.serial_sect_count -= 1; - if(check_stats(f->shared->fs_man[type], &state)) + if(check_stats(f, f->shared->fs_man[type], &state)) TEST_ERROR /* Create section B */ @@ -1560,7 +1597,7 @@ test_mf_fs_extend(hid_t fapl) state.tot_sect_count += 1; state.serial_sect_count += 1; - if(check_stats(f->shared->fs_man[type], &state)) + if(check_stats(f, f->shared->fs_man[type], &state)) TEST_ERROR /* Try to extend the allocated block */ @@ -1571,7 +1608,7 @@ test_mf_fs_extend(hid_t fapl) TEST_ERROR /* free-space info should remain the same */ - if(check_stats(f->shared->fs_man[type], &state)) + if(check_stats(f, f->shared->fs_man[type], &state)) TEST_ERROR /* Free the allocated block A to free-space */ @@ -1581,7 +1618,7 @@ test_mf_fs_extend(hid_t fapl) /* rest of the info remains the same */ state.tot_space += TEST_BLOCK_SIZE30; - if(check_stats(f->shared->fs_man[type], &state)) + if(check_stats(f, f->shared->fs_man[type], &state)) TEST_ERROR /* Remove the merged sections A & B from free-space */ @@ -1617,8 +1654,10 @@ test_mf_fs_extend(hid_t fapl) FAIL_STACK_ERROR type = H5FD_MEM_SUPER; - if(H5MF_alloc_start(f, H5P_DATASET_XFER_DEFAULT, type, TRUE) < 0) - TEST_ERROR + + if(H5MF_alloc_start(f, H5P_DATASET_XFER_DEFAULT, type) < 0) + TEST_ERROR + if (f->shared->fs_state[type] != H5F_FS_STATE_OPEN) TEST_ERROR if (f->shared->fs_man[type]->client != H5FS_CLIENT_FILE_ID) @@ -1642,7 +1681,7 @@ test_mf_fs_extend(hid_t fapl) state.tot_sect_count += 1; state.serial_sect_count += 1; - if(check_stats(f->shared->fs_man[type], &state)) + if(check_stats(f, f->shared->fs_man[type], &state)) TEST_ERROR /* Allocate a block of 30 */ @@ -1656,7 +1695,7 @@ test_mf_fs_extend(hid_t fapl) state.tot_sect_count -= 1; state.serial_sect_count -= 1; - if(check_stats(f->shared->fs_man[type], &state)) + if(check_stats(f, f->shared->fs_man[type], &state)) TEST_ERROR /* Create section B */ @@ -1670,7 +1709,7 @@ test_mf_fs_extend(hid_t fapl) state.tot_sect_count += 1; state.serial_sect_count += 1; - if(check_stats(f->shared->fs_man[type], &state)) + if(check_stats(f, f->shared->fs_man[type], &state)) TEST_ERROR /* Try to extend the allocated block */ @@ -1682,7 +1721,7 @@ test_mf_fs_extend(hid_t fapl) /* Should have 1 section of size=10 left in free-space manager */ state.tot_space -= (TEST_BLOCK_SIZE40); - if(check_stats(f->shared->fs_man[type], &state)) + if(check_stats(f, f->shared->fs_man[type], &state)) TEST_ERROR /* Free the extended block */ @@ -1691,7 +1730,7 @@ test_mf_fs_extend(hid_t fapl) /* rest info is same, the extended section returned is merged with the section in free-space */ state.tot_space += (TEST_BLOCK_SIZE30+TEST_BLOCK_SIZE40); - if(check_stats(f->shared->fs_man[type], &state)) + if(check_stats(f, f->shared->fs_man[type], &state)) TEST_ERROR /* Remove the merged sections A & B from free-space */ @@ -1727,8 +1766,10 @@ test_mf_fs_extend(hid_t fapl) FAIL_STACK_ERROR type = H5FD_MEM_SUPER; - if(H5MF_alloc_start(f, H5P_DATASET_XFER_DEFAULT, type, TRUE) < 0) - TEST_ERROR + + if(H5MF_alloc_start(f, H5P_DATASET_XFER_DEFAULT, type) < 0) + TEST_ERROR + if (f->shared->fs_state[type] != H5F_FS_STATE_OPEN) TEST_ERROR if (f->shared->fs_man[type]->client != H5FS_CLIENT_FILE_ID) @@ -1752,7 +1793,7 @@ test_mf_fs_extend(hid_t fapl) state.tot_sect_count += 1; state.serial_sect_count += 1; - if(check_stats(f->shared->fs_man[type], &state)) + if(check_stats(f, f->shared->fs_man[type], &state)) TEST_ERROR /* Allocate a block of size=20 */ @@ -1766,7 +1807,7 @@ test_mf_fs_extend(hid_t fapl) state.tot_sect_count -= 1; state.serial_sect_count -= 1; - if(check_stats(f->shared->fs_man[type], &state)) + if(check_stats(f, f->shared->fs_man[type], &state)) TEST_ERROR /* Create section B */ @@ -1780,7 +1821,7 @@ test_mf_fs_extend(hid_t fapl) state.tot_sect_count += 1; state.serial_sect_count += 1; - if(check_stats(f->shared->fs_man[type], &state)) + if(check_stats(f, f->shared->fs_man[type], &state)) TEST_ERROR /* Try to extend the allocated block */ @@ -1791,7 +1832,7 @@ test_mf_fs_extend(hid_t fapl) TEST_ERROR /* Free-space info should be the same */ - if(check_stats(f->shared->fs_man[type], &state)) + if(check_stats(f, f->shared->fs_man[type], &state)) TEST_ERROR /* Free the allocated block */ @@ -1801,7 +1842,7 @@ test_mf_fs_extend(hid_t fapl) state.tot_sect_count += 1; state.serial_sect_count += 1; - if(check_stats(f->shared->fs_man[type], &state)) + if(check_stats(f, f->shared->fs_man[type], &state)) TEST_ERROR /* Remove section A from free-space manger */ @@ -1908,8 +1949,10 @@ test_mf_fs_absorb(const char *env_h5_drvr, hid_t fapl) FAIL_STACK_ERROR type = H5FD_MEM_SUPER; - if(H5MF_alloc_start(f, H5P_DATASET_XFER_DEFAULT, type, TRUE) < 0) + + if(H5MF_alloc_start(f, H5P_DATASET_XFER_DEFAULT, type) < 0) TEST_ERROR + if (f->shared->fs_state[type] != H5F_FS_STATE_OPEN) TEST_ERROR if (f->shared->fs_man[type]->client != H5FS_CLIENT_FILE_ID) @@ -1975,8 +2018,10 @@ test_mf_fs_absorb(const char *env_h5_drvr, hid_t fapl) FAIL_STACK_ERROR type = H5FD_MEM_SUPER; - if(H5MF_alloc_start(f, H5P_DATASET_XFER_DEFAULT, type, TRUE) < 0) + + if(H5MF_alloc_start(f, H5P_DATASET_XFER_DEFAULT, type) < 0) TEST_ERROR + if (f->shared->fs_state[type] != H5F_FS_STATE_OPEN) TEST_ERROR if (f->shared->fs_man[type]->client != H5FS_CLIENT_FILE_ID) @@ -2868,7 +2913,7 @@ test_mf_aggr_alloc6(const char *env_h5_drvr, hid_t fapl) state.tot_sect_count += 1; state.serial_sect_count += 1; - if(check_stats(f->shared->fs_man[type], &state)) + if(check_stats(f, f->shared->fs_man[type], &state)) TEST_ERROR /* Free all the allocated blocks */ @@ -3048,7 +3093,7 @@ test_mf_aggr_alloc7(const char *env_h5_drvr, hid_t fapl) state.tot_sect_count += 1; state.serial_sect_count += 1; - if(check_stats(f->shared->fs_man[type], &state)) + if(check_stats(f, f->shared->fs_man[type], &state)) TEST_ERROR /* Free all the allocated blocks */ @@ -3683,7 +3728,7 @@ test_mf_align_eoa(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) state.tot_space += mis_align; state.tot_sect_count += 1; state.serial_sect_count += 1; - if(check_stats(f->shared->fs_man[type], &state)) + if(check_stats(f, f->shared->fs_man[type], &state)) TEST_ERROR } @@ -3706,7 +3751,7 @@ test_mf_align_eoa(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) state.tot_space += mis_align; state.tot_sect_count += 1; state.serial_sect_count += 1; - if(check_stats(f->shared->fs_man[type], &state)) + if(check_stats(f, f->shared->fs_man[type], &state)) TEST_ERROR } @@ -3921,8 +3966,10 @@ test_mf_align_fs(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) FAIL_STACK_ERROR type = H5FD_MEM_SUPER; - if(H5MF_alloc_start(f, H5P_DATASET_XFER_DEFAULT, type, TRUE) < 0) - TEST_ERROR + + if(H5MF_alloc_start(f, H5P_DATASET_XFER_DEFAULT, type) < 0) + TEST_ERROR + if (f->shared->fs_state[type] != H5F_FS_STATE_OPEN) TEST_ERROR if (f->shared->fs_man[type]->client != H5FS_CLIENT_FILE_ID) @@ -3945,7 +3992,7 @@ test_mf_align_fs(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) state.tot_sect_count += 1; state.serial_sect_count += 1; - if(check_stats(f->shared->fs_man[type], &state)) + if(check_stats(f, f->shared->fs_man[type], &state)) TEST_ERROR /* Allocate a block of 50 */ @@ -3959,7 +4006,7 @@ test_mf_align_fs(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) state.tot_sect_count -= 1; state.serial_sect_count -= 1; - if(check_stats(f->shared->fs_man[type], &state)) + if(check_stats(f, f->shared->fs_man[type], &state)) TEST_ERROR /* Free the block to free-space */ @@ -3968,7 +4015,7 @@ test_mf_align_fs(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) state.tot_space += TEST_BLOCK_SIZE50; state.tot_sect_count += 1; state.serial_sect_count += 1; - if(check_stats(f->shared->fs_man[type], &state)) + if(check_stats(f, f->shared->fs_man[type], &state)) TEST_ERROR if(H5Fclose(file) < 0) @@ -3988,8 +4035,10 @@ test_mf_align_fs(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) FAIL_STACK_ERROR type = H5FD_MEM_SUPER; - if(H5MF_alloc_start(f, H5P_DATASET_XFER_DEFAULT, type, TRUE) < 0) - TEST_ERROR + + if(H5MF_alloc_start(f, H5P_DATASET_XFER_DEFAULT, type) < 0) + TEST_ERROR + if (f->shared->fs_state[type] != H5F_FS_STATE_OPEN) TEST_ERROR if (f->shared->fs_man[type]->client != H5FS_CLIENT_FILE_ID) @@ -4012,7 +4061,7 @@ test_mf_align_fs(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) state.tot_sect_count += 1; state.serial_sect_count += 1; - if(check_stats(f->shared->fs_man[type], &state)) + if(check_stats(f, f->shared->fs_man[type], &state)) TEST_ERROR /* Allocate a block of 600 */ @@ -4026,7 +4075,7 @@ test_mf_align_fs(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) state.tot_sect_count += 1; state.serial_sect_count += 1; - if(check_stats(f->shared->fs_man[type], &state)) + if(check_stats(f, f->shared->fs_man[type], &state)) TEST_ERROR /* try to extend the block */ @@ -4037,7 +4086,7 @@ test_mf_align_fs(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) /* space should be decreased by 200, # of sections remain the same */ state.tot_space -= TEST_BLOCK_SIZE200; - if(check_stats(f->shared->fs_man[type], &state)) + if(check_stats(f, f->shared->fs_man[type], &state)) TEST_ERROR /* Free the block to free-space manager */ @@ -4047,7 +4096,7 @@ test_mf_align_fs(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) state.tot_space += (TEST_BLOCK_SIZE600+TEST_BLOCK_SIZE200); state.tot_sect_count = 1; state.serial_sect_count = 1; - if(check_stats(f->shared->fs_man[type], &state)) + if(check_stats(f, f->shared->fs_man[type], &state)) TEST_ERROR if(H5Fclose(file) < 0) @@ -4075,8 +4124,10 @@ test_mf_align_fs(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) FAIL_STACK_ERROR type = H5FD_MEM_SUPER; - if(H5MF_alloc_start(f, H5P_DATASET_XFER_DEFAULT, type, TRUE) < 0) + + if(H5MF_alloc_start(f, H5P_DATASET_XFER_DEFAULT, type) < 0) TEST_ERROR + if (f->shared->fs_state[type] != H5F_FS_STATE_OPEN) TEST_ERROR if (f->shared->fs_man[type]->client != H5FS_CLIENT_FILE_ID) @@ -4099,7 +4150,7 @@ test_mf_align_fs(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) state.tot_sect_count += 1; state.serial_sect_count += 1; - if(check_stats(f->shared->fs_man[type], &state)) + if(check_stats(f, f->shared->fs_man[type], &state)) TEST_ERROR /* * Allocate a block of 40 @@ -4126,7 +4177,7 @@ test_mf_align_fs(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) } /* free-space info should be the same */ - if(check_stats(f->shared->fs_man[type], &state)) + if(check_stats(f, f->shared->fs_man[type], &state)) TEST_ERROR if(H5Fclose(file) < 0) @@ -4389,7 +4440,7 @@ test_mf_align_alloc1(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) TEST_ERROR /* Verify total size of free space after all the allocations */ - if(check_stats(f->shared->fs_man[type], &state)) + if(check_stats(f, f->shared->fs_man[type], &state)) TEST_ERROR H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr1, (hsize_t)TEST_BLOCK_SIZE30); @@ -4668,7 +4719,7 @@ test_mf_align_alloc2(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) TEST_ERROR /* Verify total size of free space after all the allocations */ - if(check_stats(f->shared->fs_man[type], &state)) + if(check_stats(f, f->shared->fs_man[type], &state)) TEST_ERROR H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr1, (hsize_t)TEST_BLOCK_SIZE30); @@ -5040,7 +5091,7 @@ test_mf_align_alloc3(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) TEST_ERROR /* Verify total size of free space after all allocations */ - if(check_stats(f->shared->fs_man[type], &state)) + if(check_stats(f, f->shared->fs_man[type], &state)) TEST_ERROR if(H5Fclose(file) < 0) @@ -5245,7 +5296,7 @@ test_mf_align_alloc4(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) if (addr3 % alignment) TEST_ERROR /* Verify total size of free space after all allocations */ - if(check_stats(f->shared->fs_man[type], &state)) + if(check_stats(f, f->shared->fs_man[type], &state)) TEST_ERROR if(H5Fclose(file) < 0) @@ -5453,7 +5504,7 @@ test_mf_align_alloc5(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) } /* Verify total size of free space after all allocations */ - if(check_stats(f->shared->fs_man[type], &state)) + if(check_stats(f, f->shared->fs_man[type], &state)) TEST_ERROR /* nothing is changed in meta_aggr */ @@ -5773,7 +5824,7 @@ test_mf_align_alloc6(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) if (sdata_addr != 0 || sdata_size != 0) TEST_ERROR - if(check_stats(f->shared->fs_man[type], &state)) + if(check_stats(f, f->shared->fs_man[type], &state)) TEST_ERROR if(H5Fclose(file) < 0) @@ -5812,12 +5863,6 @@ main(void) fapl = h5_fileaccess(); - /* meta/small data is set to 2048 for the following tests */ - if(H5Pset_meta_block_size(fapl, (hsize_t)TEST_BLOCK_SIZE2048) < 0) - TEST_ERROR - if(H5Pset_small_data_block_size(fapl, (hsize_t)TEST_BLOCK_SIZE2048) < 0) - TEST_ERROR - /* Make a copy of the FAPL before adjusting the alignment */ if((new_fapl = H5Pcopy(fapl)) < 0) TEST_ERROR @@ -5825,6 +5870,12 @@ main(void) if(H5Pset_alignment(fapl, (hsize_t)1, (hsize_t)1) < 0) TEST_ERROR + /* meta/small data is set to 2048 for the following tests */ + if(H5Pset_meta_block_size(fapl, (hsize_t)TEST_BLOCK_SIZE2048) < 0) + TEST_ERROR + if(H5Pset_small_data_block_size(fapl, (hsize_t)TEST_BLOCK_SIZE2048) < 0) + TEST_ERROR + /* interaction with file allocation */ nerrors += test_mf_eoa(env_h5_drvr, fapl); nerrors += test_mf_eoa_shrink(env_h5_drvr, fapl); @@ -5880,12 +5931,14 @@ main(void) nerrors += test_mf_align_alloc6(env_h5_drvr, fapl, new_fapl); } /* end if */ + if (H5Pclose(new_fapl) < 0) + FAIL_STACK_ERROR + h5_cleanup(FILENAME, fapl); + if(nerrors) goto error; puts("All free-space manager tests for file memory passed."); - h5_cleanup(FILENAME, fapl); - return (0); error: -- cgit v0.12