summaryrefslogtreecommitdiffstats
path: root/test/mf.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2017-03-14 04:30:37 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2017-03-14 04:30:37 (GMT)
commit0313cbb91d974b153dbe8747d193ac3c619eea3b (patch)
treeaf6c4a631d5753685ee0033a6a8415a25fc97672 /test/mf.c
parent847d675f2743ec420ef6c9efdd6e52ae93b4fe44 (diff)
downloadhdf5-0313cbb91d974b153dbe8747d193ac3c619eea3b.zip
hdf5-0313cbb91d974b153dbe8747d193ac3c619eea3b.tar.gz
hdf5-0313cbb91d974b153dbe8747d193ac3c619eea3b.tar.bz2
Final merge of page buffering branch to develop
Diffstat (limited to 'test/mf.c')
-rw-r--r--test/mf.c5053
1 files changed, 3164 insertions, 1889 deletions
diff --git a/test/mf.c b/test/mf.c
index f56c7ab..160fb92 100644
--- a/test/mf.c
+++ b/test/mf.c
@@ -20,6 +20,7 @@
* test_mf_aggr_*() tests for file memory that interact with the aggregators
* test_mf_align_*() tests for file memory with alignment setting
* test_filespace_*() tests for file space management
+ * test_page_*() tests for file space paging
*/
#include "h5test.h"
@@ -38,41 +39,63 @@
#include "H5Iprivate.h"
#include "H5VMprivate.h"
-#define FILENAME_LEN 1024
-
-#define TEST_BLOCK_SIZE1 1
-#define TEST_BLOCK_SIZE2 2
-#define TEST_BLOCK_SIZE3 3
-#define TEST_BLOCK_SIZE4 4
-#define TEST_BLOCK_SIZE5 5
-#define TEST_BLOCK_SIZE6 6
-#define TEST_BLOCK_SIZE7 7
-#define TEST_BLOCK_SIZE8 8
-#define TEST_BLOCK_SIZE20 20
-#define TEST_BLOCK_SIZE30 30
-#define TEST_BLOCK_SIZE40 40
-#define TEST_BLOCK_SIZE50 50
-#define TEST_BLOCK_SIZE80 80
-#define TEST_BLOCK_SIZE200 200
-#define TEST_BLOCK_SIZE600 600
-#define TEST_BLOCK_SIZE700 700
-#define TEST_BLOCK_SIZE1034 1034
-#define TEST_BLOCK_SIZE1970 1970
-#define TEST_BLOCK_SIZE2058 2058
-#define TEST_BLOCK_SIZE8000 8000
-#define TEST_BLOCK_SIZE2048 2048
-
-#define TEST_BLOCK_ADDR70 70
-#define TEST_BLOCK_ADDR100 100
-
-#define TEST_ALIGN1024 1024
-#define TEST_ALIGN4096 4096
-
-#define TEST_THRESHOLD10 10
-#define TEST_THRESHOLD3 3
-
-#define CORE_INCREMENT 1024
-#define FAMILY_SIZE 1024
+#define FILENAME_LEN 1024
+
+#define TBLOCK_SIZE1 1
+#define TBLOCK_SIZE2 2
+#define TBLOCK_SIZE3 3
+#define TBLOCK_SIZE4 4
+#define TBLOCK_SIZE5 5
+#define TBLOCK_SIZE6 6
+#define TBLOCK_SIZE7 7
+#define TBLOCK_SIZE8 8
+#define TBLOCK_SIZE10 10
+#define TBLOCK_SIZE11 11
+#define TBLOCK_SIZE20 20
+#define TBLOCK_SIZE30 30
+#define TBLOCK_SIZE36 36
+#define TBLOCK_SIZE40 40
+#define TBLOCK_SIZE50 50
+#define TBLOCK_SIZE80 80
+#define TBLOCK_SIZE90 90
+#define TBLOCK_SIZE98 98
+#define TBLOCK_SIZE100 100
+#define TBLOCK_SIZE150 150
+#define TBLOCK_SIZE200 200
+#define TBLOCK_SIZE600 600
+#define TBLOCK_SIZE700 700
+#define TBLOCK_SIZE1034 1034
+#define TBLOCK_SIZE1970 1970
+#define TBLOCK_SIZE2048 2048
+#define TBLOCK_SIZE2058 2058
+#define TBLOCK_SIZE2192 2192
+#define TBLOCK_SIZE3080 3080
+#define TBLOCK_SIZE3088 3088
+#define TBLOCK_SIZE3198 3198
+#define TBLOCK_SIZE3286 3286
+#define TBLOCK_SIZE3248 3248
+#define TBLOCK_SIZE3900 3900
+#define TBLOCK_SIZE4020 4020
+#define TBLOCK_SIZE4086 4086
+#define TBLOCK_SIZE4096 4096
+#define TBLOCK_SIZE4106 4106
+#define TBLOCK_SIZE5000 5000
+#define TBLOCK_SIZE6000 6000
+#define TBLOCK_SIZE8000 8000
+#define TBLOCK_SIZE8100 8100
+#define TBLOCK_SIZE8192 8192
+#define TBLOCK_SIZE8190 8190
+#define TBLOCK_SIZE12000 12000
+
+#define TBLOCK_ADDR70 70
+#define TBLOCK_ADDR100 100
+
+#define TEST_ALIGN16 16
+#define TEST_ALIGN1024 1024
+#define TEST_ALIGN4096 4096
+
+#define TEST_THRESHOLD10 10
+#define TEST_THRESHOLD3 3
const char *FILENAME[] = {
"mf",
@@ -80,24 +103,17 @@ const char *FILENAME[] = {
};
typedef enum {
- TEST_NORMAL, /* size of aggregator is >= alignment size */
- TEST_AGGR_SMALL, /* size of aggregator is smaller than alignment size */
- TEST_NTESTS /* The number of test types, must be last */
+ TEST_NORMAL, /* size of aggregator is >= alignment size */
+ TEST_AGGR_SMALL, /* size of aggregator is smaller than alignment size */
+ TEST_NTESTS /* The number of test types, must be last */
} test_type_t;
-typedef struct frspace_state_t {
- hsize_t tot_space; /* Total amount of space tracked */
- 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 */
-} frspace_state_t;
+static int check_stats(const H5F_t *f, const H5FS_t *frsp, H5FS_stat_t *state);
-
-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_dichotomy(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);
@@ -119,21 +135,27 @@ static unsigned test_mf_align_alloc3(const char *env_h5_drvr, hid_t fapl, hid_t
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);
-static unsigned test_mf_fs_persist(hid_t fapl_new, hid_t fcpl);
-static unsigned test_mf_fs_gone(hid_t fapl_new, hid_t fcpl);
-static unsigned test_mf_fs_split(hid_t fapl_new, hid_t fcpl);
-static unsigned test_mf_fs_multi(hid_t fapl, hid_t fcpl);
-static unsigned test_mf_fs_drivers(hid_t fapl);
+static unsigned test_mf_tmp(const char *env_h5_drvr, hid_t fapl, hbool_t new_format);
+static unsigned test_mf_fs_gone(const char *env_h5_drvr, hid_t fapl, hbool_t new_format);
+static unsigned test_mf_strat_thres_gone(const char *env_h5_drvr, hid_t fapl, hbool_t new_format);
+static unsigned test_mf_fs_persist(const char *env_h5_drvr, hid_t fapl, hbool_t new_format);
+static unsigned test_mf_strat_thres_persist(const char *env_h5_drvr, hid_t fapl, hbool_t new_format);
+static unsigned test_mf_fs_persist_split(void);
+static unsigned test_mf_fs_persist_multi(void);
+static unsigned test_page_alloc_xfree(const char *env_h5_drvr, hid_t fapl);
+static unsigned test_page_small(const char *env_h5_drvr, hid_t fapl);
+static unsigned test_page_large(const char *env_h5_drvr, hid_t fapl);
+static unsigned test_page_large_try_extend(const char *env_h5_drvr, hid_t fapl);
+static unsigned test_page_small_try_extend(const char *env_h5_drvr, hid_t fapl);
+static unsigned test_page_try_shrink(const char *env_h5_drvr, hid_t fapl);
+static unsigned test_page_alignment(const char *env_h5_drvr, hid_t fapl);
/*
* Verify statistics for the free-space manager
*
- * Modifications:
- * Vailin Choi; July 2012
- * To ensure "f" and "frsp" are valid pointers
*/
static int
-check_stats(const H5F_t *f, const H5FS_t *frsp, frspace_state_t *state)
+check_stats(const H5F_t *f, const H5FS_t *frsp, H5FS_stat_t *state)
{
H5FS_stat_t frspace_stats; /* Statistics about the heap */
@@ -146,22 +168,22 @@ check_stats(const H5F_t *f, const H5FS_t *frsp, frspace_state_t *state)
if(frspace_stats.tot_space != state->tot_space) {
HDfprintf(stdout, "frspace_stats.tot_space = %Hu, state->tot_space = %Zu\n",
- frspace_stats.tot_space, state->tot_space);
+ frspace_stats.tot_space, state->tot_space);
TEST_ERROR
} /* end if */
if(frspace_stats.tot_sect_count != state->tot_sect_count) {
HDfprintf(stdout, "frspace_stats.tot_sect_count = %Hu, state->tot_sect_count = %Hu\n",
- frspace_stats.tot_sect_count, state->tot_sect_count);
+ frspace_stats.tot_sect_count, state->tot_sect_count);
TEST_ERROR
} /* end if */
if(frspace_stats.serial_sect_count != state->serial_sect_count) {
HDfprintf(stdout, "frspace_stats.serial_sect_count = %Hu, state->serial_sect_count = %Hu\n",
- frspace_stats.serial_sect_count, state->serial_sect_count);
+ frspace_stats.serial_sect_count, state->serial_sect_count);
TEST_ERROR
} /* end if */
if(frspace_stats.ghost_sect_count != state->ghost_sect_count) {
HDfprintf(stdout, "frspace_stats.ghost_sect_count = %Hu, state->ghost_sect_count = %Hu\n",
- frspace_stats.ghost_sect_count, state->ghost_sect_count);
+ frspace_stats.ghost_sect_count, state->ghost_sect_count);
TEST_ERROR
} /* end if */
@@ -173,13 +195,15 @@ error:
} /* check_stats() */
/*
+ *-------------------------------------------------------------------------
* To verify that blocks are allocated from file allocation
*
* Set up:
- * Turn off using meta/small data aggregator
- * There is nothing in free-space manager
+ * Turn off using meta/small data aggregator
+ * There is nothing in free-space manager
*
* Allocate two blocks which should be from file allocation
+ *-------------------------------------------------------------------------
*/
static unsigned
test_mf_eoa(const char *env_h5_drvr, hid_t fapl)
@@ -234,7 +258,7 @@ test_mf_eoa(const char *env_h5_drvr, hid_t fapl)
H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
type = H5FD_MEM_SUPER;
- addr1 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE30);
+ addr1 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE30);
/* nothing should be changed in meta_aggr */
H5MF_aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &ma_size);
@@ -244,7 +268,7 @@ test_mf_eoa(const char *env_h5_drvr, hid_t fapl)
if (addr1 < (haddr_t)file_size)
TEST_ERROR
- addr2 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE50);
+ addr2 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE50);
/* nothing should be changed in meta_aggr */
H5MF_aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &ma_size);
@@ -262,7 +286,7 @@ test_mf_eoa(const char *env_h5_drvr, hid_t fapl)
TEST_ERROR
/* Verify the file is the correct size */
- if (new_file_size != (file_size+TEST_BLOCK_SIZE30+TEST_BLOCK_SIZE50))
+ if (new_file_size != (file_size+TBLOCK_SIZE30+TBLOCK_SIZE50))
TEST_ERROR
/* Re-open the file */
@@ -273,8 +297,8 @@ test_mf_eoa(const char *env_h5_drvr, hid_t fapl)
if(NULL == (f = (H5F_t *)H5I_object(file)))
FAIL_STACK_ERROR
- H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr1, (hsize_t)TEST_BLOCK_SIZE30);
- H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr2, (hsize_t)TEST_BLOCK_SIZE50);
+ H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr1, (hsize_t)TBLOCK_SIZE30);
+ H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr2, (hsize_t)TBLOCK_SIZE50);
if(H5Fclose(file) < 0)
FAIL_STACK_ERROR
@@ -308,6 +332,7 @@ error:
} /* test_mf_eoa() */
/*
+ *-------------------------------------------------------------------------
* To verify that an allocated block from file allocation is shrunk.
*
* Set up:
@@ -323,6 +348,7 @@ error:
* Test 4: Allocate a block of 30 from file allocation
* H5MF_try_shrink() the block by 20 from the end: succeed
*
+ *-------------------------------------------------------------------------
*/
static unsigned
test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl)
@@ -377,7 +403,7 @@ test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl)
H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
type = H5FD_MEM_SUPER;
- addr = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE30);
+ addr = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE30);
if (addr < (haddr_t)file_size)
TEST_ERROR
@@ -395,7 +421,7 @@ test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl)
TEST_ERROR
/* Verify the file is the correct size */
- if (new_file_size != (file_size+TEST_BLOCK_SIZE30))
+ if (new_file_size != (file_size+TBLOCK_SIZE30))
TEST_ERROR
/* Re-open the file */
@@ -409,7 +435,7 @@ test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl)
H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
/* should succeed */
- if(H5MF_try_shrink(f, type, H5AC_ind_read_dxpl_id, addr, (hsize_t)TEST_BLOCK_SIZE30) <= 0)
+ if(H5MF_try_shrink(f, type, H5AC_ind_read_dxpl_id, addr, (hsize_t)TBLOCK_SIZE30) <= 0)
TEST_ERROR
/* nothing should be changed in meta_aggr */
@@ -453,13 +479,13 @@ test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl)
H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- addr = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE30);
+ addr = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE30);
if (addr < (haddr_t)file_size)
TEST_ERROR
/* should not succeed in shrinking */
- if(H5MF_try_shrink(f, type, H5AC_ind_read_dxpl_id, addr, (hsize_t)TEST_BLOCK_SIZE30 - 10) > 0)
+ if(H5MF_try_shrink(f, type, H5AC_ind_read_dxpl_id, addr, (hsize_t)TBLOCK_SIZE30 - 10) > 0)
TEST_ERROR
/* nothing should be changed in meta_aggr */
@@ -475,7 +501,7 @@ test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl)
TEST_ERROR
/* Verify the file is the correct size */
- if(new_file_size != (file_size + TEST_BLOCK_SIZE30))
+ if(new_file_size != (file_size + TBLOCK_SIZE30))
TEST_ERROR
PASSED()
@@ -503,7 +529,7 @@ test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl)
H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
/* should not succeed in shrinking */
- if(H5MF_try_shrink(f, type, H5AC_ind_read_dxpl_id, addr, (hsize_t)TEST_BLOCK_SIZE30 + 10) > 0)
+ if(H5MF_try_shrink(f, type, H5AC_ind_read_dxpl_id, addr, (hsize_t)TBLOCK_SIZE30 + 10) > 0)
TEST_ERROR
/* nothing should be changed in meta_aggr */
@@ -519,7 +545,7 @@ test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl)
TEST_ERROR
/* Verify the file is the correct size */
- if(new_file_size != (file_size + TEST_BLOCK_SIZE30))
+ if(new_file_size != (file_size + TBLOCK_SIZE30))
TEST_ERROR
PASSED()
@@ -546,7 +572,7 @@ test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl)
H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
/* should succeed in shrinking */
- if(H5MF_try_shrink(f, type, H5AC_ind_read_dxpl_id, addr+10, (hsize_t)(TEST_BLOCK_SIZE30 - 10)) <= 0)
+ if(H5MF_try_shrink(f, type, H5AC_ind_read_dxpl_id, addr+10, (hsize_t)(TBLOCK_SIZE30 - 10)) <= 0)
TEST_ERROR
/* nothing should be changed in meta_aggr */
@@ -588,6 +614,7 @@ error:
} /* test_mf_eoa_shrink() */
/*
+ *-------------------------------------------------------------------------
* To verify that an allocated block from file allocation is extended.
*
* Set up:
@@ -599,6 +626,7 @@ error:
*
* Test 2: Allocate a block of 30
* H5MF_try_extend() the block of size 20 by 50: fail
+ *-------------------------------------------------------------------------
*/
static unsigned
test_mf_eoa_extend(const char *env_h5_drvr, hid_t fapl)
@@ -656,7 +684,7 @@ test_mf_eoa_extend(const char *env_h5_drvr, hid_t fapl)
H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
type = H5FD_MEM_SUPER;
- addr = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE30);
+ addr = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE30);
if (addr < (haddr_t)file_size)
TEST_ERROR
@@ -673,7 +701,7 @@ test_mf_eoa_extend(const char *env_h5_drvr, hid_t fapl)
TEST_ERROR
/* Verify the file is the correct size */
- if(new_file_size != (file_size + TEST_BLOCK_SIZE30))
+ if(new_file_size != (file_size + TBLOCK_SIZE30))
TEST_ERROR
/* Re-open the file */
@@ -685,7 +713,7 @@ test_mf_eoa_extend(const char *env_h5_drvr, hid_t fapl)
FAIL_STACK_ERROR
/* should succeed */
- was_extended = H5MF_try_extend(f, H5AC_ind_read_dxpl_id, type, (haddr_t)addr, (hsize_t)TEST_BLOCK_SIZE30, (hsize_t)TEST_BLOCK_SIZE50);
+ was_extended = H5MF_try_extend(f, H5AC_ind_read_dxpl_id, type, (haddr_t)addr, (hsize_t)TBLOCK_SIZE30, (hsize_t)TBLOCK_SIZE50);
if(was_extended <= 0)
TEST_ERROR
@@ -703,7 +731,7 @@ test_mf_eoa_extend(const char *env_h5_drvr, hid_t fapl)
TEST_ERROR
/* Verify the file is the correct size */
- if(new_file_size != (file_size + TEST_BLOCK_SIZE30 + TEST_BLOCK_SIZE50))
+ if(new_file_size != (file_size + TBLOCK_SIZE30 + TBLOCK_SIZE50))
TEST_ERROR
PASSED()
@@ -734,7 +762,7 @@ test_mf_eoa_extend(const char *env_h5_drvr, hid_t fapl)
H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
type = H5FD_MEM_SUPER;
- addr = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE30);
+ addr = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE30);
if(addr < (haddr_t)file_size)
TEST_ERROR
@@ -744,7 +772,7 @@ test_mf_eoa_extend(const char *env_h5_drvr, hid_t fapl)
if(new_ma_addr != ma_addr)
TEST_ERROR
- was_extended = H5MF_try_extend(f, H5AC_ind_read_dxpl_id, type, (haddr_t)addr, (hsize_t)(TEST_BLOCK_SIZE30-10), (hsize_t)(TEST_BLOCK_SIZE50));
+ was_extended = H5MF_try_extend(f, H5AC_ind_read_dxpl_id, type, (haddr_t)addr, (hsize_t)(TBLOCK_SIZE30-10), (hsize_t)(TBLOCK_SIZE50));
/* should not succeed */
if(was_extended > 0)
@@ -763,7 +791,7 @@ test_mf_eoa_extend(const char *env_h5_drvr, hid_t fapl)
TEST_ERROR
/* Verify the file is the correct size */
- if(new_file_size != file_size + TEST_BLOCK_SIZE30)
+ if(new_file_size != file_size + TBLOCK_SIZE30)
TEST_ERROR
if(H5Pclose(fapl_new) < 0)
@@ -787,6 +815,7 @@ error:
} /* test_mf_eoa_extend() */
/*
+ *-------------------------------------------------------------------------
* To verify that temporary blocks are allocated correctly
*
* Set up:
@@ -806,13 +835,19 @@ error:
* space fails
* - Check that allocating another 1/2 of the file as normal address
* space fails
+ *-------------------------------------------------------------------------
*/
static unsigned
-test_mf_tmp(const char *env_h5_drvr, hid_t fapl)
+test_mf_tmp(const char *env_h5_drvr, hid_t fapl, hbool_t new_format)
{
- hid_t file = -1; /* File ID */
+ hid_t file = -1; /* File ID */
+ hid_t fapl2 = -1; /* File access property list */
+ hid_t fcpl = -1; /* File creation property list */
- TESTING("'temporary' file space allocation");
+ if(new_format)
+ TESTING("'temporary' file space allocation with new library format")
+ else
+ TESTING("'temporary' file space allocation with old library format")
/* Can't run this test with multi-file VFDs */
if(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi") && HDstrcmp(env_h5_drvr, "family")) {
@@ -829,8 +864,22 @@ test_mf_tmp(const char *env_h5_drvr, hid_t fapl)
/* Set the filename to use for this test */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
+ if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ FAIL_STACK_ERROR
+
+ if(new_format) {
+ /* Copy the file access property list */
+ if((fapl2 = H5Pcopy(fapl)) < 0) FAIL_STACK_ERROR
+
+ /* Set the "use the latest version of the format" bounds for creating objects in the file */
+ if(H5Pset_libver_bounds(fapl2, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ FAIL_STACK_ERROR
+
+ H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, FALSE, (hsize_t)1);
+ } /* end if */
+
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, new_format?fapl2:fapl)) < 0)
FAIL_STACK_ERROR
/* Close file */
@@ -855,13 +904,13 @@ test_mf_tmp(const char *env_h5_drvr, hid_t fapl)
FAIL_STACK_ERROR
/* Allocate some temporary address space */
- if(HADDR_UNDEF == (tmp_addr = H5MF_alloc_tmp(f, (hsize_t)TEST_BLOCK_SIZE30)))
+ if(HADDR_UNDEF == (tmp_addr = H5MF_alloc_tmp(f, (hsize_t)TBLOCK_SIZE30)))
FAIL_STACK_ERROR
/* Check if temporary file address is valid */
if(!H5F_IS_TMP_ADDR(f, tmp_addr))
TEST_ERROR
- if(tmp_addr < (haddr_t)(maxaddr - TEST_BLOCK_SIZE30))
+ if(tmp_addr < (haddr_t)(maxaddr - TBLOCK_SIZE30))
TEST_ERROR
/* Reading & writing with a temporary address value should fail */
@@ -878,7 +927,7 @@ test_mf_tmp(const char *env_h5_drvr, hid_t fapl)
/* Freeing a temporary address value should fail */
H5E_BEGIN_TRY {
- status = H5MF_xfree(f, H5FD_MEM_SUPER, H5AC_ind_read_dxpl_id, tmp_addr, (hsize_t)TEST_BLOCK_SIZE30);
+ status = H5MF_xfree(f, H5FD_MEM_SUPER, H5AC_ind_read_dxpl_id, tmp_addr, (hsize_t)TBLOCK_SIZE30);
} H5E_END_TRY;
if(status >= 0)
TEST_ERROR
@@ -963,10 +1012,12 @@ error:
} /* test_mf_tmp() */
/*
+ *-------------------------------------------------------------------------
* To verify that the free-space manager is created or opened
*
* Set up:
* Turn off using meta/small data aggregator
+ *-------------------------------------------------------------------------
*/
static unsigned
test_mf_fs_start(hid_t fapl)
@@ -976,11 +1027,10 @@ test_mf_fs_start(hid_t fapl)
char filename[FILENAME_LEN]; /* Filename to use */
H5F_t *f = NULL; /* Internal file object pointer */
h5_stat_size_t file_size, new_file_size; /* file size */
- H5FD_mem_t type;
- frspace_state_t state;
+ H5FS_stat_t state;
- TESTING("H5MF_alloc_create()/H5MF__alloc_open() of free-space manager");
+ TESTING("H5MF_create_fstype()/H5MF_open_fstype() of free-space manager");
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
@@ -1011,20 +1061,18 @@ test_mf_fs_start(hid_t fapl)
if(NULL == (f = (H5F_t *)H5I_object(file)))
FAIL_STACK_ERROR
- /* Start up free-space manager */
- type = H5FD_MEM_SUPER;
+ /* Start up H5FD_MEM_SUPER free-space manager */
+ if(H5MF_start_fstype(f, H5AC_ind_read_dxpl_id, (H5F_mem_page_t)H5FD_MEM_SUPER) < 0)
+ FAIL_STACK_ERROR
- if(H5MF__alloc_start(f, H5AC_ind_read_dxpl_id, type) < 0)
+ if(f->shared->fs_state[H5FD_MEM_SUPER] != H5F_FS_STATE_OPEN)
+ TEST_ERROR
+ if(f->shared->fs_man[H5FD_MEM_SUPER]->client != H5FS_CLIENT_FILE_ID)
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)
- TEST_ERROR
-
- HDmemset(&state, 0, sizeof(frspace_state_t));
+ HDmemset(&state, 0, sizeof(H5FS_stat_t));
- if(check_stats(f, f->shared->fs_man[type], &state))
+ if(check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
TEST_ERROR
if(H5Fclose(file) < 0)
@@ -1055,6 +1103,7 @@ error:
/*
+ *-------------------------------------------------------------------------
* To verify that a block is allocated/freed from/to the free-space manager
*
* Set up:
@@ -1078,10 +1127,7 @@ error:
* The block is allocated from file allocation
* Deallocate the block which will be returned to free-space manager
* (the space is shrunk and freed since it is at end of file)
- *
- * Modifications:
- * Vailin Choi; July 2012
- * Initialize the new field "allow_eoa_shrink_only" for user data.
+ *-------------------------------------------------------------------------
*/
static unsigned
test_mf_fs_alloc_free(hid_t fapl)
@@ -1091,12 +1137,10 @@ test_mf_fs_alloc_free(hid_t fapl)
char filename[FILENAME_LEN]; /* Filename to use */
H5F_t *f = NULL; /* Internal file object pointer */
h5_stat_size_t file_size, new_file_size; /* file size */
- H5FD_mem_t type;
H5MF_free_section_t *sect_node = NULL;
- haddr_t addr;
- frspace_state_t state;
- H5MF_sect_ud_t udata;
- H5FS_section_info_t *node;
+ haddr_t addr;
+ haddr_t tmp;
+ H5FS_stat_t state;
TESTING("H5MF_alloc()/H5MF_xfree() of free-space manager:test 1");
@@ -1129,69 +1173,59 @@ test_mf_fs_alloc_free(hid_t fapl)
if(NULL == (f = (H5F_t *)H5I_object(file)))
FAIL_STACK_ERROR
- type = H5FD_MEM_SUPER;
+ /* Start up H5FD_MEM_SUPER free-space manager */
+ if(H5MF_start_fstype(f, H5AC_ind_read_dxpl_id, (H5F_mem_page_t)H5FD_MEM_SUPER) < 0)
+ FAIL_STACK_ERROR
- if(H5MF__alloc_start(f, H5AC_ind_read_dxpl_id, type) < 0)
+ if(f->shared->fs_state[H5FD_MEM_SUPER] != H5F_FS_STATE_OPEN)
+ TEST_ERROR
+ if(f->shared->fs_man[H5FD_MEM_SUPER]->client != H5FS_CLIENT_FILE_ID)
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)
- TEST_ERROR
/* Create section A */
- sect_node = H5MF_sect_simple_new((haddr_t)TEST_BLOCK_ADDR70, (hsize_t)TEST_BLOCK_SIZE30);
-
- /* Construct user data for callbacks */
- udata.f = f;
- udata.dxpl_id = H5AC_ind_read_dxpl_id;
- udata.alloc_type = type;
- udata.allow_sect_absorb = TRUE;
- udata.allow_eoa_shrink_only = FALSE;
+ sect_node = H5MF_sect_new(H5MF_FSPACE_SECT_SIMPLE, (haddr_t)TBLOCK_ADDR70, (hsize_t)TBLOCK_SIZE30);
/* Add section A to free-space manager */
- if (H5FS_sect_add(f, H5AC_ind_read_dxpl_id, f->shared->fs_man[type], (H5FS_section_info_t *)sect_node, H5FS_ADD_RETURNED_SPACE, &udata))
- FAIL_STACK_ERROR
+ if(H5MF_add_sect(f, H5FD_MEM_SUPER, H5AC_ind_read_dxpl_id, f->shared->fs_man[H5FD_MEM_SUPER], sect_node))
+ FAIL_STACK_ERROR
- HDmemset(&state, 0, sizeof(frspace_state_t));
- state.tot_space += TEST_BLOCK_SIZE30;
+ HDmemset(&state, 0, sizeof(H5FS_stat_t));
+ state.tot_space += TBLOCK_SIZE30;
state.tot_sect_count += 1;
state.serial_sect_count += 1;
- if(check_stats(f, f->shared->fs_man[type], &state))
+ if(check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
TEST_ERROR
/* Allocate a block of 30 */
- addr = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE30);
+ addr = H5MF_alloc(f, H5FD_MEM_SUPER, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE30);
/* Verify that the allocated block is section A in free-space */
- if (addr != TEST_BLOCK_ADDR70)
+ if(addr != TBLOCK_ADDR70)
TEST_ERROR
- state.tot_space -= TEST_BLOCK_SIZE30;
+ state.tot_space -= TBLOCK_SIZE30;
state.tot_sect_count -= 1;
state.serial_sect_count -= 1;
- if(check_stats(f, f->shared->fs_man[type], &state))
+ if(check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
TEST_ERROR
/* Free the block to free-space */
- H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr, (hsize_t)TEST_BLOCK_SIZE30);
+ H5MF_xfree(f, H5FD_MEM_SUPER, H5AC_ind_read_dxpl_id, addr, (hsize_t)TBLOCK_SIZE30);
- state.tot_space += TEST_BLOCK_SIZE30;
+ state.tot_space += TBLOCK_SIZE30;
state.tot_sect_count += 1;
state.serial_sect_count += 1;
- if(check_stats(f, f->shared->fs_man[type], &state))
+ if(check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
TEST_ERROR
/* Remove section A from free-space */
- if(H5FS_sect_find(f, H5AC_ind_read_dxpl_id, f->shared->fs_man[type],
- (hsize_t)TEST_BLOCK_SIZE30, (H5FS_section_info_t **)&node) < 0)
- TEST_ERROR
+ if(H5MF_find_sect(f, H5FD_MEM_SUPER, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE30, f->shared->fs_man[H5FD_MEM_SUPER], &tmp) != TRUE)
+ TEST_ERROR
- /* Free the free-space section node */
- if(H5MF_sect_simple_free((H5FS_section_info_t *)node) < 0)
- TEST_ERROR
+ if(tmp != TBLOCK_ADDR70)
+ TEST_ERROR
if(H5Fclose(file) < 0)
FAIL_STACK_ERROR
@@ -1216,67 +1250,57 @@ test_mf_fs_alloc_free(hid_t fapl)
if(NULL == (f = (H5F_t *)H5I_object(file)))
FAIL_STACK_ERROR
- type = H5FD_MEM_SUPER;
+ /* Start up H5FD_MEM_SUPER free-space manager */
+ if(H5MF_start_fstype(f, H5AC_ind_read_dxpl_id, (H5F_mem_page_t)H5FD_MEM_SUPER) < 0)
+ FAIL_STACK_ERROR
- if(H5MF__alloc_start(f, H5AC_ind_read_dxpl_id, type) < 0)
+ if(f->shared->fs_state[H5FD_MEM_SUPER] != H5F_FS_STATE_OPEN)
+ TEST_ERROR
+ if(f->shared->fs_man[H5FD_MEM_SUPER]->client != H5FS_CLIENT_FILE_ID)
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)
- TEST_ERROR
/* Create section A */
- sect_node = H5MF_sect_simple_new((haddr_t)TEST_BLOCK_ADDR70, (hsize_t)TEST_BLOCK_SIZE30);
-
- /* Construct user data for callbacks */
- udata.f = f;
- udata.dxpl_id = H5AC_ind_read_dxpl_id;
- udata.alloc_type = type;
- udata.allow_sect_absorb = TRUE;
- udata.allow_eoa_shrink_only = FALSE;
+ sect_node = H5MF_sect_new(H5MF_FSPACE_SECT_SIMPLE, (haddr_t)TBLOCK_ADDR70, (hsize_t)TBLOCK_SIZE30);
- /* Add section A to free-space manager */
- if (H5FS_sect_add(f, H5AC_ind_read_dxpl_id, f->shared->fs_man[type], (H5FS_section_info_t *)sect_node, H5FS_ADD_RETURNED_SPACE, &udata))
- FAIL_STACK_ERROR
+ /* Add section A to free-space manager */
+ if(H5MF_add_sect(f, H5FD_MEM_SUPER, H5AC_ind_read_dxpl_id, f->shared->fs_man[H5FD_MEM_SUPER], sect_node))
+ FAIL_STACK_ERROR
- HDmemset(&state, 0, sizeof(frspace_state_t));
- state.tot_space += TEST_BLOCK_SIZE30;
+ HDmemset(&state, 0, sizeof(H5FS_stat_t));
+ state.tot_space += TBLOCK_SIZE30;
state.tot_sect_count += 1;
state.serial_sect_count += 1;
- if(check_stats(f, f->shared->fs_man[type], &state))
+ if(check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
TEST_ERROR
/* Allocate a block of 20 */
- addr = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)(TEST_BLOCK_SIZE20));
+ addr = H5MF_alloc(f, H5FD_MEM_SUPER, H5AC_ind_read_dxpl_id, (hsize_t)(TBLOCK_SIZE20));
/* Verify that the allocated block is section A in free-space manager */
- if (addr != TEST_BLOCK_ADDR70)
+ if(addr != TBLOCK_ADDR70)
TEST_ERROR
/* should still have 1 section of size 10 left in free-space manager */
- state.tot_space -= (TEST_BLOCK_SIZE20);
+ state.tot_space -= (TBLOCK_SIZE20);
- if(check_stats(f, f->shared->fs_man[type], &state))
+ if(check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
TEST_ERROR
/* Free the block to free-space manager */
- H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr, (hsize_t)(TEST_BLOCK_SIZE20));
+ H5MF_xfree(f, H5FD_MEM_SUPER, H5AC_ind_read_dxpl_id, addr, (hsize_t)(TBLOCK_SIZE20));
/* Still 1 section in free-space because of merging */
- state.tot_space += TEST_BLOCK_SIZE20;
- if(check_stats(f, f->shared->fs_man[type], &state))
+ state.tot_space += TBLOCK_SIZE20;
+ if(check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
TEST_ERROR
- /* Remove section A from free-space manager */
- if(H5FS_sect_find(f, H5AC_ind_read_dxpl_id, f->shared->fs_man[type],
- (hsize_t)TEST_BLOCK_SIZE30, (H5FS_section_info_t **)&node) < 0)
- FAIL_STACK_ERROR
+ /* Remove section A from free-space */
+ if(H5MF_find_sect(f, H5FD_MEM_SUPER, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE30, f->shared->fs_man[H5FD_MEM_SUPER], &tmp) != TRUE)
+ TEST_ERROR
- /* Free the free-space section node */
- if(H5MF_sect_simple_free((H5FS_section_info_t *)node) < 0)
- TEST_ERROR
+ if(tmp != TBLOCK_ADDR70)
+ TEST_ERROR
if(H5Fclose(file) < 0)
FAIL_STACK_ERROR
@@ -1301,36 +1325,28 @@ test_mf_fs_alloc_free(hid_t fapl)
if(NULL == (f = (H5F_t *)H5I_object(file)))
FAIL_STACK_ERROR
- type = H5FD_MEM_SUPER;
+ /* Start up H5FD_MEM_SUPER free-space manager */
+ if(H5MF_start_fstype(f, H5AC_ind_read_dxpl_id, (H5F_mem_page_t)H5FD_MEM_SUPER) < 0)
+ FAIL_STACK_ERROR
- if(H5MF__alloc_start(f, H5AC_ind_read_dxpl_id, type) < 0)
+ if(f->shared->fs_state[H5FD_MEM_SUPER] != H5F_FS_STATE_OPEN)
+ TEST_ERROR
+ if(f->shared->fs_man[H5FD_MEM_SUPER]->client != H5FS_CLIENT_FILE_ID)
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)
- TEST_ERROR
/* Create section A */
- sect_node = H5MF_sect_simple_new((haddr_t)TEST_BLOCK_ADDR70, (hsize_t)TEST_BLOCK_SIZE30);
-
- /* Construct user data for callbacks */
- udata.f = f;
- udata.dxpl_id = H5AC_ind_read_dxpl_id;
- udata.alloc_type = type;
- udata.allow_sect_absorb = TRUE;
- udata.allow_eoa_shrink_only = FALSE;
+ sect_node = H5MF_sect_new(H5MF_FSPACE_SECT_SIMPLE, (haddr_t)TBLOCK_ADDR70, (hsize_t)TBLOCK_SIZE30);
/* Add section A to free-space manager */
- if (H5FS_sect_add(f, H5AC_ind_read_dxpl_id, f->shared->fs_man[type], (H5FS_section_info_t *)sect_node, H5FS_ADD_RETURNED_SPACE, &udata))
- FAIL_STACK_ERROR
+ if(H5MF_add_sect(f, H5FD_MEM_SUPER, H5AC_ind_read_dxpl_id, f->shared->fs_man[H5FD_MEM_SUPER], sect_node))
+ FAIL_STACK_ERROR
- HDmemset(&state, 0, sizeof(frspace_state_t));
- state.tot_space += TEST_BLOCK_SIZE30;
+ HDmemset(&state, 0, sizeof(H5FS_stat_t));
+ state.tot_space += TBLOCK_SIZE30;
state.tot_sect_count += 1;
state.serial_sect_count += 1;
- if(check_stats(f, f->shared->fs_man[type], &state))
+ if(check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
TEST_ERROR
/*
@@ -1338,38 +1354,37 @@ test_mf_fs_alloc_free(hid_t fapl)
* Since free-space manager cannot fulfull the request,
* the block is obtained from file allocation
*/
- addr = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)(TEST_BLOCK_SIZE40));
+ addr = H5MF_alloc(f, H5FD_MEM_SUPER, H5AC_ind_read_dxpl_id, (hsize_t)(TBLOCK_SIZE40));
/* Verify that the allocated block is not section A in free-space */
- if (addr == TEST_BLOCK_ADDR70)
- TEST_ERROR
+ if(addr == TBLOCK_ADDR70)
+ TEST_ERROR
/* free-space info should be the same */
- if(check_stats(f, f->shared->fs_man[type], &state))
+ if(check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
TEST_ERROR
/* Remove section A from free-space */
- if(H5FS_sect_find(f, H5AC_ind_read_dxpl_id, f->shared->fs_man[type],
- (hsize_t)TEST_BLOCK_SIZE30, (H5FS_section_info_t **)&node) < 0)
- FAIL_STACK_ERROR
+ if(H5MF_find_sect(f, H5FD_MEM_SUPER, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE30, f->shared->fs_man[H5FD_MEM_SUPER], &tmp) != TRUE)
+ TEST_ERROR
- /* Free the free-space section node */
- if(H5MF_sect_simple_free((H5FS_section_info_t *)node) < 0)
- TEST_ERROR
+ /* Verify that the block is section A in free-space */
+ if(tmp != TBLOCK_ADDR70)
+ TEST_ERROR
- HDmemset(&state, 0, sizeof(frspace_state_t));
- if(check_stats(f, f->shared->fs_man[type], &state))
+ HDmemset(&state, 0, sizeof(H5FS_stat_t));
+ if(check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
TEST_ERROR
/* Free the block of size 40 to free-space */
- H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr, (hsize_t)(TEST_BLOCK_SIZE40));
+ H5MF_xfree(f, H5FD_MEM_SUPER, H5AC_ind_read_dxpl_id, addr, (hsize_t)(TBLOCK_SIZE40));
/*
* Free-space info is the same.
* The block is returned to free-space.
* It is shrunk and freed because it is at end of file.
*/
- if(check_stats(f, f->shared->fs_man[type], &state))
+ if(check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
TEST_ERROR
if(H5Fclose(file) < 0)
@@ -1400,6 +1415,7 @@ error:
/*
+ *-------------------------------------------------------------------------
* To verify that a block allocated from the free-space manager can be extended
*
* Set up:
@@ -1435,10 +1451,7 @@ error:
* Try to extend the allocated block by 50 from the free-space_manager:
* Fail: section A does not adjoin section B (70+20 != address of section B) even though
* the requested-size (50) equal to size of section B (50)
- *
- * Modifications:
- * Vailin Choi; July 2012
- * Initialize the new field "allow_eoa_shrink_only" for user data.
+ *-------------------------------------------------------------------------
*/
static unsigned
test_mf_fs_extend(hid_t fapl)
@@ -1448,13 +1461,11 @@ test_mf_fs_extend(hid_t fapl)
char filename[FILENAME_LEN]; /* Filename to use */
H5F_t *f = NULL; /* Internal file object pointer */
h5_stat_size_t file_size, new_file_size; /* file size */
- H5FD_mem_t type;
H5MF_free_section_t *sect_node1 = NULL, *sect_node2=NULL;
- haddr_t addr;
- frspace_state_t state; /* State of free space*/
- H5MF_sect_ud_t udata;
- H5FS_section_info_t *node;
- htri_t was_extended;
+ haddr_t addr;
+ haddr_t tmp;
+ H5FS_stat_t state; /* State of free space*/
+ htri_t was_extended;
TESTING("H5MF_try_extend() of free-space manager:test 1");
@@ -1487,101 +1498,91 @@ test_mf_fs_extend(hid_t fapl)
if(NULL == (f = (H5F_t *)H5I_object(file)))
FAIL_STACK_ERROR
- type = H5FD_MEM_SUPER;
+ /* Start up H5FD_MEM_SUPER free-space manager */
+ if(H5MF_start_fstype(f, H5AC_ind_read_dxpl_id, (H5F_mem_page_t)H5FD_MEM_SUPER) < 0)
+ FAIL_STACK_ERROR
- if(H5MF__alloc_start(f, H5AC_ind_read_dxpl_id, type) < 0)
+ if(f->shared->fs_state[H5FD_MEM_SUPER] != H5F_FS_STATE_OPEN)
+ TEST_ERROR
+ if(f->shared->fs_man[H5FD_MEM_SUPER]->client != H5FS_CLIENT_FILE_ID)
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)
- TEST_ERROR
/* Create section A */
- sect_node1 = H5MF_sect_simple_new((haddr_t)TEST_BLOCK_ADDR70, (hsize_t)TEST_BLOCK_SIZE30);
-
- /* Construct user data for callbacks */
- udata.f = f;
- udata.dxpl_id = H5AC_ind_read_dxpl_id;
- udata.alloc_type = type;
- udata.allow_sect_absorb = TRUE;
- udata.allow_eoa_shrink_only = FALSE;
+ sect_node1 = H5MF_sect_new(H5MF_FSPACE_SECT_SIMPLE, (haddr_t)TBLOCK_ADDR70, (hsize_t)TBLOCK_SIZE30);
/* Add section A to free-space manager */
- if (H5FS_sect_add(f, H5AC_ind_read_dxpl_id, f->shared->fs_man[type], (H5FS_section_info_t *)sect_node1, H5FS_ADD_RETURNED_SPACE, &udata))
- FAIL_STACK_ERROR
+ if(H5MF_add_sect(f, H5FD_MEM_SUPER, H5AC_ind_read_dxpl_id, f->shared->fs_man[H5FD_MEM_SUPER], sect_node1))
+ FAIL_STACK_ERROR
- HDmemset(&state, 0, sizeof(frspace_state_t));
- state.tot_space += TEST_BLOCK_SIZE30;
+ HDmemset(&state, 0, sizeof(H5FS_stat_t));
+ state.tot_space += TBLOCK_SIZE30;
state.tot_sect_count += 1;
state.serial_sect_count += 1;
- if(check_stats(f, f->shared->fs_man[type], &state))
+ if(check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
TEST_ERROR
/* Allocate a block of 30 */
- addr = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE30);
+ addr = H5MF_alloc(f, H5FD_MEM_SUPER, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE30);
/* Verify that the allocated block is section A in free-space manager */
- if (addr != TEST_BLOCK_ADDR70)
- TEST_ERROR
+ if(addr != TBLOCK_ADDR70)
+ TEST_ERROR
- state.tot_space -= TEST_BLOCK_SIZE30;
+ state.tot_space -= TBLOCK_SIZE30;
state.tot_sect_count -= 1;
state.serial_sect_count -= 1;
- if(check_stats(f, f->shared->fs_man[type], &state))
+ if(check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
TEST_ERROR
/* Create section B */
- sect_node2 = H5MF_sect_simple_new((haddr_t)TEST_BLOCK_ADDR100, (hsize_t)TEST_BLOCK_SIZE50);
+ sect_node2 = H5MF_sect_new(H5MF_FSPACE_SECT_SIMPLE, (haddr_t)TBLOCK_ADDR100, (hsize_t)TBLOCK_SIZE50);
/* Add section B to free-space manager */
- if (H5FS_sect_add(f, H5AC_ind_read_dxpl_id, f->shared->fs_man[type], (H5FS_section_info_t *)sect_node2, H5FS_ADD_RETURNED_SPACE, &udata))
- FAIL_STACK_ERROR
+ if(H5MF_add_sect(f, H5FD_MEM_SUPER, H5AC_ind_read_dxpl_id, f->shared->fs_man[H5FD_MEM_SUPER], sect_node2))
+ FAIL_STACK_ERROR
- state.tot_space += TEST_BLOCK_SIZE50;
+ state.tot_space += TBLOCK_SIZE50;
state.tot_sect_count += 1;
state.serial_sect_count += 1;
- if(check_stats(f, f->shared->fs_man[type], &state))
+ if(check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
TEST_ERROR
/* Try to extend the allocated block */
- was_extended = H5MF_try_extend(f, H5AC_ind_read_dxpl_id, type, (haddr_t)TEST_BLOCK_ADDR70, (hsize_t)TEST_BLOCK_SIZE30, (hsize_t)TEST_BLOCK_SIZE50);
+ was_extended = H5MF_try_extend(f, H5AC_ind_read_dxpl_id, H5FD_MEM_SUPER, (haddr_t)TBLOCK_ADDR70, (hsize_t)TBLOCK_SIZE30, (hsize_t)TBLOCK_SIZE50);
/* should succeed */
if(was_extended <= 0)
TEST_ERROR
/* Section B is removed from free-space manager */
- state.tot_space -= TEST_BLOCK_SIZE50;
+ state.tot_space -= TBLOCK_SIZE50;
state.tot_sect_count -= 1;
state.serial_sect_count -= 1;
- if(check_stats(f, f->shared->fs_man[type], &state))
+ if(check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
TEST_ERROR
/* Free the extended block to free-space manager */
- H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr, (hsize_t)(TEST_BLOCK_SIZE30+TEST_BLOCK_SIZE50));
+ H5MF_xfree(f, H5FD_MEM_SUPER, H5AC_ind_read_dxpl_id, addr, (hsize_t)(TBLOCK_SIZE30+TBLOCK_SIZE50));
/* Verify that the extended block is back into free-space */
- state.tot_space += TEST_BLOCK_SIZE30+TEST_BLOCK_SIZE50;
+ state.tot_space += (TBLOCK_SIZE30+TBLOCK_SIZE50);
state.tot_sect_count = 1;
state.serial_sect_count = 1;
- if(check_stats(f, f->shared->fs_man[type], &state))
+ if(check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
TEST_ERROR
/* Remove the extended block */
- if(H5FS_sect_find(f, H5AC_ind_read_dxpl_id, f->shared->fs_man[type],
- (hsize_t)(TEST_BLOCK_SIZE30+TEST_BLOCK_SIZE50), (H5FS_section_info_t **)&node) < 0)
- TEST_ERROR
-
- /* Remove the free-space section node */
- if(H5MF_sect_simple_free((H5FS_section_info_t *)node) < 0)
- TEST_ERROR
+ if(H5MF_find_sect(f, H5FD_MEM_SUPER, H5AC_ind_read_dxpl_id, (hsize_t)(TBLOCK_SIZE30+TBLOCK_SIZE50), f->shared->fs_man[H5FD_MEM_SUPER], &tmp) != TRUE)
+ TEST_ERROR
+ if(tmp != TBLOCK_ADDR70)
+ TEST_ERROR
+
if(H5Fclose(file) < 0)
FAIL_STACK_ERROR
@@ -1605,95 +1606,84 @@ test_mf_fs_extend(hid_t fapl)
if(NULL == (f = (H5F_t *)H5I_object(file)))
FAIL_STACK_ERROR
- type = H5FD_MEM_SUPER;
+ /* Start up H5FD_MEM_SUPER free-space manager */
+ if(H5MF_start_fstype(f, H5AC_ind_read_dxpl_id, (H5F_mem_page_t)H5FD_MEM_SUPER) < 0)
+ FAIL_STACK_ERROR
- if(H5MF__alloc_start(f, H5AC_ind_read_dxpl_id, type) < 0)
+ if(f->shared->fs_state[H5FD_MEM_SUPER] != H5F_FS_STATE_OPEN)
+ TEST_ERROR
+ if(f->shared->fs_man[H5FD_MEM_SUPER]->client != H5FS_CLIENT_FILE_ID)
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)
- TEST_ERROR
/* Create section A */
- sect_node1 = H5MF_sect_simple_new((haddr_t)TEST_BLOCK_ADDR70, (hsize_t)TEST_BLOCK_SIZE30);
-
- /* Construct user data for callbacks */
- udata.f = f;
- udata.dxpl_id = H5AC_ind_read_dxpl_id;
- udata.alloc_type = type;
- udata.allow_sect_absorb = TRUE;
- udata.allow_eoa_shrink_only = FALSE;
+ sect_node1 = H5MF_sect_new(H5MF_FSPACE_SECT_SIMPLE, (haddr_t)TBLOCK_ADDR70, (hsize_t)TBLOCK_SIZE30);
- /* Add section A to free-space */
- if (H5FS_sect_add(f, H5AC_ind_read_dxpl_id, f->shared->fs_man[type], (H5FS_section_info_t *)sect_node1, H5FS_ADD_RETURNED_SPACE, &udata))
- FAIL_STACK_ERROR
+ /* Add section A to free-space manager */
+ if(H5MF_add_sect(f, H5FD_MEM_SUPER, H5AC_ind_read_dxpl_id, f->shared->fs_man[H5FD_MEM_SUPER], sect_node1))
+ FAIL_STACK_ERROR
- HDmemset(&state, 0, sizeof(frspace_state_t));
- state.tot_space += TEST_BLOCK_SIZE30;
+ HDmemset(&state, 0, sizeof(H5FS_stat_t));
+ state.tot_space += TBLOCK_SIZE30;
state.tot_sect_count += 1;
state.serial_sect_count += 1;
- if(check_stats(f, f->shared->fs_man[type], &state))
+ if(check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
TEST_ERROR
/* Allocate a block of 30 */
- addr = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE30);
+ addr = H5MF_alloc(f, H5FD_MEM_SUPER, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE30);
/* Verify that the allocated block is section A in free-space manager */
- if (addr != TEST_BLOCK_ADDR70)
- TEST_ERROR
+ if(addr != TBLOCK_ADDR70)
+ TEST_ERROR
- state.tot_space -= TEST_BLOCK_SIZE30;
+ state.tot_space -= TBLOCK_SIZE30;
state.tot_sect_count -= 1;
state.serial_sect_count -= 1;
- if(check_stats(f, f->shared->fs_man[type], &state))
+ if(check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
TEST_ERROR
/* Create section B */
- sect_node2 = H5MF_sect_simple_new((haddr_t)TEST_BLOCK_ADDR100, (hsize_t)TEST_BLOCK_SIZE50);
+ sect_node2 = H5MF_sect_new(H5MF_FSPACE_SECT_SIMPLE, (haddr_t)TBLOCK_ADDR100, (hsize_t)TBLOCK_SIZE50);
/* Add section B to free-space manager */
- if (H5FS_sect_add(f, H5AC_ind_read_dxpl_id, f->shared->fs_man[type], (H5FS_section_info_t *)sect_node2, H5FS_ADD_RETURNED_SPACE, &udata))
- FAIL_STACK_ERROR
+ if(H5MF_add_sect(f, H5FD_MEM_SUPER, H5AC_ind_read_dxpl_id, f->shared->fs_man[H5FD_MEM_SUPER], sect_node2))
+ FAIL_STACK_ERROR
- state.tot_space += TEST_BLOCK_SIZE50;
+ state.tot_space += TBLOCK_SIZE50;
state.tot_sect_count += 1;
state.serial_sect_count += 1;
- if(check_stats(f, f->shared->fs_man[type], &state))
+ if(check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
TEST_ERROR
/* Try to extend the allocated block */
- was_extended = H5MF_try_extend(f, H5AC_ind_read_dxpl_id, type, (haddr_t)TEST_BLOCK_ADDR70, (hsize_t)TEST_BLOCK_SIZE30, (hsize_t)(TEST_BLOCK_SIZE50+10));
+ was_extended = H5MF_try_extend(f, H5AC_ind_read_dxpl_id, H5FD_MEM_SUPER, (haddr_t)TBLOCK_ADDR70, (hsize_t)TBLOCK_SIZE30, (hsize_t)(TBLOCK_SIZE50+10));
/* Should not be able to extend the allocated block */
if(was_extended)
TEST_ERROR
/* free-space info should remain the same */
- if(check_stats(f, f->shared->fs_man[type], &state))
+ if(check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
TEST_ERROR
/* Free the allocated block A to free-space */
- H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr, (hsize_t)TEST_BLOCK_SIZE30);
+ H5MF_xfree(f, H5FD_MEM_SUPER, H5AC_ind_read_dxpl_id, addr, (hsize_t)TBLOCK_SIZE30);
/* the returned section A is merged with section B in free-space */
/* rest of the info remains the same */
- state.tot_space += TEST_BLOCK_SIZE30;
+ state.tot_space += TBLOCK_SIZE30;
- if(check_stats(f, f->shared->fs_man[type], &state))
+ if(check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
TEST_ERROR
/* Remove the merged sections A & B from free-space */
- if(H5FS_sect_find(f, H5AC_ind_read_dxpl_id, f->shared->fs_man[type],
- (hsize_t)(TEST_BLOCK_SIZE30+TEST_BLOCK_SIZE50), (H5FS_section_info_t **)&node) < 0)
- TEST_ERROR
+ if(H5MF_find_sect(f, H5FD_MEM_SUPER, H5AC_ind_read_dxpl_id, (hsize_t)(TBLOCK_SIZE30+TBLOCK_SIZE50), f->shared->fs_man[H5FD_MEM_SUPER], &tmp) != TRUE)
+ TEST_ERROR
- /* Remove the free-space section node */
- if(H5MF_sect_simple_free((H5FS_section_info_t *)node) < 0)
- TEST_ERROR
+ if(tmp != addr) TEST_ERROR
if(H5Fclose(file) < 0)
FAIL_STACK_ERROR
@@ -1718,95 +1708,84 @@ test_mf_fs_extend(hid_t fapl)
if(NULL == (f = (H5F_t *)H5I_object(file)))
FAIL_STACK_ERROR
- type = H5FD_MEM_SUPER;
+ /* Start up H5FD_MEM_SUPER free-space manager */
+ if(H5MF_start_fstype(f, H5AC_ind_read_dxpl_id, (H5F_mem_page_t)H5FD_MEM_SUPER) < 0)
+ FAIL_STACK_ERROR
- if(H5MF__alloc_start(f, H5AC_ind_read_dxpl_id, type) < 0)
+ if(f->shared->fs_state[H5FD_MEM_SUPER] != H5F_FS_STATE_OPEN)
+ TEST_ERROR
+ if(f->shared->fs_man[H5FD_MEM_SUPER]->client != H5FS_CLIENT_FILE_ID)
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)
- TEST_ERROR
/* Create section A */
- sect_node1 = H5MF_sect_simple_new((haddr_t)TEST_BLOCK_ADDR70, (hsize_t)TEST_BLOCK_SIZE30);
+ sect_node1 = H5MF_sect_new(H5MF_FSPACE_SECT_SIMPLE, (haddr_t)TBLOCK_ADDR70, (hsize_t)TBLOCK_SIZE30);
- /* Construct user data for callbacks */
- udata.f = f;
- udata.dxpl_id = H5AC_ind_read_dxpl_id;
- udata.alloc_type = type;
- udata.allow_sect_absorb = TRUE;
- udata.allow_eoa_shrink_only = FALSE;
-
- /* Add section A to free-space */
- if (H5FS_sect_add(f, H5AC_ind_read_dxpl_id, f->shared->fs_man[type], (H5FS_section_info_t *)sect_node1, H5FS_ADD_RETURNED_SPACE, &udata))
- FAIL_STACK_ERROR
+ /* Add section A to free-space manager */
+ if(H5MF_add_sect(f, H5FD_MEM_SUPER, H5AC_ind_read_dxpl_id, f->shared->fs_man[H5FD_MEM_SUPER], sect_node1))
+ FAIL_STACK_ERROR
- HDmemset(&state, 0, sizeof(frspace_state_t));
- state.tot_space += TEST_BLOCK_SIZE30;
+ HDmemset(&state, 0, sizeof(H5FS_stat_t));
+ state.tot_space += TBLOCK_SIZE30;
state.tot_sect_count += 1;
state.serial_sect_count += 1;
- if(check_stats(f, f->shared->fs_man[type], &state))
+ if(check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
TEST_ERROR
/* Allocate a block of 30 */
- addr = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE30);
+ addr = H5MF_alloc(f, H5FD_MEM_SUPER, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE30);
/* Verify that the allocated block is section A in free-space manager */
- if (addr != TEST_BLOCK_ADDR70)
- TEST_ERROR
+ if(addr != TBLOCK_ADDR70)
+ TEST_ERROR
- state.tot_space -= TEST_BLOCK_SIZE30;
+ state.tot_space -= TBLOCK_SIZE30;
state.tot_sect_count -= 1;
state.serial_sect_count -= 1;
- if(check_stats(f, f->shared->fs_man[type], &state))
+ if(check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
TEST_ERROR
/* Create section B */
- sect_node2 = H5MF_sect_simple_new((haddr_t)TEST_BLOCK_ADDR100, (hsize_t)TEST_BLOCK_SIZE50);
+ sect_node2 = H5MF_sect_new(H5MF_FSPACE_SECT_SIMPLE, (haddr_t)TBLOCK_ADDR100, (hsize_t)TBLOCK_SIZE50);
/* Add section B to free-space manager */
- if (H5FS_sect_add(f, H5AC_ind_read_dxpl_id, f->shared->fs_man[type], (H5FS_section_info_t *)sect_node2, H5FS_ADD_RETURNED_SPACE, &udata))
- FAIL_STACK_ERROR
+ if(H5MF_add_sect(f, H5FD_MEM_SUPER, H5AC_ind_read_dxpl_id, f->shared->fs_man[H5FD_MEM_SUPER], sect_node2))
+ FAIL_STACK_ERROR
- state.tot_space += TEST_BLOCK_SIZE50;
+ state.tot_space += TBLOCK_SIZE50;
state.tot_sect_count += 1;
state.serial_sect_count += 1;
- if(check_stats(f, f->shared->fs_man[type], &state))
+ if(check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
TEST_ERROR
/* Try to extend the allocated block */
- was_extended = H5MF_try_extend(f, H5AC_ind_read_dxpl_id, type, (haddr_t)TEST_BLOCK_ADDR70, (hsize_t)TEST_BLOCK_SIZE30, (hsize_t)(TEST_BLOCK_SIZE40));
+ was_extended = H5MF_try_extend(f, H5AC_ind_read_dxpl_id, H5FD_MEM_SUPER, (haddr_t)TBLOCK_ADDR70, (hsize_t)TBLOCK_SIZE30, (hsize_t)(TBLOCK_SIZE40));
/* Should succeed in extending the allocated block */
if(was_extended <=0)
TEST_ERROR
/* Should have 1 section of size=10 left in free-space manager */
- state.tot_space -= (TEST_BLOCK_SIZE40);
- if(check_stats(f, f->shared->fs_man[type], &state))
+ state.tot_space -= (TBLOCK_SIZE40);
+ if(check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
TEST_ERROR
/* Free the extended block */
- H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr, (hsize_t)(TEST_BLOCK_SIZE30+TEST_BLOCK_SIZE40));
+ H5MF_xfree(f, H5FD_MEM_SUPER, H5AC_ind_read_dxpl_id, addr, (hsize_t)(TBLOCK_SIZE30+TBLOCK_SIZE40));
/* 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);
+ state.tot_space += (TBLOCK_SIZE30+TBLOCK_SIZE40);
- if(check_stats(f, f->shared->fs_man[type], &state))
+ if(check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
TEST_ERROR
/* Remove the merged sections A & B from free-space */
- if(H5FS_sect_find(f, H5AC_ind_read_dxpl_id, f->shared->fs_man[type],
- (hsize_t)(TEST_BLOCK_SIZE30+TEST_BLOCK_SIZE50), (H5FS_section_info_t **)&node) < 0)
- TEST_ERROR
-
- /* Remove the free-space section node */
- if(H5MF_sect_simple_free((H5FS_section_info_t *)node) < 0)
- TEST_ERROR
+ if(H5MF_find_sect(f, H5FD_MEM_SUPER, H5AC_ind_read_dxpl_id, (hsize_t)(TBLOCK_SIZE30+TBLOCK_SIZE50), f->shared->fs_man[H5FD_MEM_SUPER], &tmp) != TRUE)
+ TEST_ERROR
+
+ if(tmp != addr) TEST_ERROR
if(H5Fclose(file) < 0)
FAIL_STACK_ERROR
@@ -1831,104 +1810,88 @@ test_mf_fs_extend(hid_t fapl)
if(NULL == (f = (H5F_t *)H5I_object(file)))
FAIL_STACK_ERROR
- type = H5FD_MEM_SUPER;
+ /* Start up H5FD_MEM_SUPER free-space manager */
+ if(H5MF_start_fstype(f, H5AC_ind_read_dxpl_id, (H5F_mem_page_t)H5FD_MEM_SUPER) < 0)
+ FAIL_STACK_ERROR
- if(H5MF__alloc_start(f, H5AC_ind_read_dxpl_id, type) < 0)
+ if(f->shared->fs_state[H5FD_MEM_SUPER] != H5F_FS_STATE_OPEN)
+ TEST_ERROR
+ if(f->shared->fs_man[H5FD_MEM_SUPER]->client != H5FS_CLIENT_FILE_ID)
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)
- TEST_ERROR
/* Create section A */
- sect_node1 = H5MF_sect_simple_new((haddr_t)TEST_BLOCK_ADDR70, (hsize_t)(TEST_BLOCK_SIZE30-10));
-
- /* Construct user data for callbacks */
- udata.f = f;
- udata.dxpl_id = H5AC_ind_read_dxpl_id;
- udata.alloc_type = type;
- udata.allow_sect_absorb = TRUE;
- udata.allow_eoa_shrink_only = FALSE;
+ sect_node1 = H5MF_sect_new(H5MF_FSPACE_SECT_SIMPLE, (haddr_t)TBLOCK_ADDR70, (hsize_t)(TBLOCK_SIZE30-10));
/* Add section A of size=20 to free-space */
- if (H5FS_sect_add(f, H5AC_ind_read_dxpl_id, f->shared->fs_man[type], (H5FS_section_info_t *)sect_node1, H5FS_ADD_RETURNED_SPACE, &udata))
- FAIL_STACK_ERROR
+ if(H5MF_add_sect(f, H5FD_MEM_SUPER, H5AC_ind_read_dxpl_id, f->shared->fs_man[H5FD_MEM_SUPER], sect_node1))
+ FAIL_STACK_ERROR
- HDmemset(&state, 0, sizeof(frspace_state_t));
- state.tot_space += (TEST_BLOCK_SIZE30-10);
+ HDmemset(&state, 0, sizeof(H5FS_stat_t));
+ state.tot_space += (TBLOCK_SIZE30-10);
state.tot_sect_count += 1;
state.serial_sect_count += 1;
- if(check_stats(f, f->shared->fs_man[type], &state))
+ if(check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
TEST_ERROR
/* Allocate a block of size=20 */
- addr = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)(TEST_BLOCK_SIZE30-10));
+ addr = H5MF_alloc(f, H5FD_MEM_SUPER, H5AC_ind_read_dxpl_id, (hsize_t)(TBLOCK_SIZE30-10));
/* Verify that the allocated block is section A in free-space manager */
- if (addr != TEST_BLOCK_ADDR70)
- TEST_ERROR
+ if(addr != TBLOCK_ADDR70)
+ TEST_ERROR
- state.tot_space -= (TEST_BLOCK_SIZE30-10);
+ state.tot_space -= (TBLOCK_SIZE30-10);
state.tot_sect_count -= 1;
state.serial_sect_count -= 1;
- if(check_stats(f, f->shared->fs_man[type], &state))
+ if(check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
TEST_ERROR
/* Create section B */
- sect_node2 = H5MF_sect_simple_new((haddr_t)TEST_BLOCK_ADDR100, (hsize_t)TEST_BLOCK_SIZE50);
+ sect_node2 = H5MF_sect_new(H5MF_FSPACE_SECT_SIMPLE, (haddr_t)TBLOCK_ADDR100, (hsize_t)TBLOCK_SIZE50);
/* Add section B to free-space manager */
- if (H5FS_sect_add(f, H5AC_ind_read_dxpl_id, f->shared->fs_man[type], (H5FS_section_info_t *)sect_node2, H5FS_ADD_RETURNED_SPACE, &udata))
- FAIL_STACK_ERROR
+ if(H5MF_add_sect(f, H5FD_MEM_SUPER, H5AC_ind_read_dxpl_id, f->shared->fs_man[H5FD_MEM_SUPER], sect_node2))
+ FAIL_STACK_ERROR
- state.tot_space += TEST_BLOCK_SIZE50;
+ state.tot_space += TBLOCK_SIZE50;
state.tot_sect_count += 1;
state.serial_sect_count += 1;
- if(check_stats(f, f->shared->fs_man[type], &state))
+ if(check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
TEST_ERROR
/* Try to extend the allocated block */
- was_extended = H5MF_try_extend(f, H5AC_ind_read_dxpl_id, type, (haddr_t)TEST_BLOCK_ADDR70, (hsize_t)(TEST_BLOCK_SIZE30-10), (hsize_t)TEST_BLOCK_SIZE50);
+ was_extended = H5MF_try_extend(f, H5AC_ind_read_dxpl_id, H5FD_MEM_SUPER, (haddr_t)TBLOCK_ADDR70, (hsize_t)(TBLOCK_SIZE30-10), (hsize_t)TBLOCK_SIZE50);
/* Should not succeed in extending the allocated block */
if(was_extended)
TEST_ERROR
/* Free-space info should be the same */
- if(check_stats(f, f->shared->fs_man[type], &state))
+ if(check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
TEST_ERROR
/* Free the allocated block */
- H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr, (hsize_t)(TEST_BLOCK_SIZE30-10));
+ H5MF_xfree(f, H5FD_MEM_SUPER, H5AC_ind_read_dxpl_id, addr, (hsize_t)(TBLOCK_SIZE30-10));
- state.tot_space += (TEST_BLOCK_SIZE30-10);
+ state.tot_space += (TBLOCK_SIZE30-10);
state.tot_sect_count += 1;
state.serial_sect_count += 1;
- if(check_stats(f, f->shared->fs_man[type], &state))
+ if(check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
TEST_ERROR
/* Remove section A from free-space manger */
- if(H5FS_sect_find(f, H5AC_ind_read_dxpl_id, f->shared->fs_man[type],
- (hsize_t)(TEST_BLOCK_SIZE30-10), (H5FS_section_info_t **)&node) < 0)
- TEST_ERROR
+ if(H5MF_find_sect(f, H5FD_MEM_SUPER, H5AC_ind_read_dxpl_id, (hsize_t)(TBLOCK_SIZE30-10), f->shared->fs_man[H5FD_MEM_SUPER], &tmp) != TRUE)
+ TEST_ERROR
- /* Remove the free-space section node */
- if(H5MF_sect_simple_free((H5FS_section_info_t *)node) < 0)
- TEST_ERROR
+ if(tmp != addr) TEST_ERROR
/* Remove section B from free-space manager */
- if(H5FS_sect_find(f, H5AC_ind_read_dxpl_id, f->shared->fs_man[type],
- (hsize_t)TEST_BLOCK_SIZE50, (H5FS_section_info_t **)&node) < 0)
- TEST_ERROR
-
- /* Remove the free-space section node */
- if(H5MF_sect_simple_free((H5FS_section_info_t *)node) < 0)
- TEST_ERROR
+ if(H5MF_find_sect(f, H5FD_MEM_SUPER, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE50, f->shared->fs_man[H5FD_MEM_SUPER], &tmp) != TRUE)
+ TEST_ERROR
if(H5Fclose(file) < 0)
FAIL_STACK_ERROR
@@ -1957,6 +1920,7 @@ error:
} /* test_mf_fs_extend() */
/*
+ *-------------------------------------------------------------------------
* To verify that an aggregator is absorbed into a section.
*
* Test 1: To aborb the aggregator onto the beginning of the section
@@ -1979,25 +1943,20 @@ error:
* which will absorb meta_aggr to the section:
* section size + remaining size of aggregator is > aggr->alloc_size,
* section is allowed to absorb an aggregator (allow_sect_absorb is true)
- *
- * Modifications:
- * Vailin Choi; July 2012
- * Initialize the new field "allow_eoa_shrink_only" for user data.
+ *-------------------------------------------------------------------------
*/
static unsigned
test_mf_fs_absorb(const char *env_h5_drvr, hid_t fapl)
{
- hid_t file = -1; /* File ID */
- char filename[FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5FD_mem_t type, stype;
- haddr_t addr, saddr;
- haddr_t ma_addr=HADDR_UNDEF;
- hsize_t ma_size=0;
+ hid_t file = -1; /* File ID */
+ char filename[FILENAME_LEN]; /* Filename to use */
+ H5F_t *f = NULL; /* Internal file object pointer */
+ haddr_t addr, saddr;
+ haddr_t tmp;
+ haddr_t ma_addr=HADDR_UNDEF;
+ hsize_t ma_size=0;
H5MF_free_section_t *sect_node=NULL;
- H5MF_sect_ud_t udata;
- H5FS_section_info_t *node;
- hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */
+ hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */
TESTING("A free-space section absorbs an aggregator: test 1");
@@ -2023,53 +1982,39 @@ test_mf_fs_absorb(const char *env_h5_drvr, hid_t fapl)
if(NULL == (f = (H5F_t *)H5I_object(file)))
FAIL_STACK_ERROR
- type = H5FD_MEM_SUPER;
-
- if(H5MF__alloc_start(f, H5AC_ind_read_dxpl_id, type) < 0)
- TEST_ERROR
+ /* Start up H5FD_MEM_SUPER free-space manager */
+ if(H5MF_start_fstype(f, H5AC_ind_read_dxpl_id, (H5F_mem_page_t)H5FD_MEM_SUPER) < 0)
+ FAIL_STACK_ERROR
- if (f->shared->fs_state[type] != H5F_FS_STATE_OPEN)
+ if(f->shared->fs_state[H5FD_MEM_SUPER] != H5F_FS_STATE_OPEN)
TEST_ERROR
- if (f->shared->fs_man[type]->client != H5FS_CLIENT_FILE_ID)
+ if(f->shared->fs_man[H5FD_MEM_SUPER]->client != H5FS_CLIENT_FILE_ID)
TEST_ERROR
/* Allocate a section from meta_aggr */
- addr = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE30);
+ addr = H5MF_alloc(f, H5FD_MEM_SUPER, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE30);
H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- /* Add a section to free-space that adjoins end of the aggregator */
- sect_node = H5MF_sect_simple_new((haddr_t)(ma_addr+ma_size), (hsize_t)TEST_BLOCK_SIZE2048);
+ /* Create a section */
+ sect_node = H5MF_sect_new(H5MF_FSPACE_SECT_SIMPLE, (haddr_t)(ma_addr+ma_size), (hsize_t)TBLOCK_SIZE2048);
- /* Construct user data for callbacks */
- udata.f = f;
- udata.dxpl_id = H5AC_ind_read_dxpl_id;
- udata.alloc_type = type;
- udata.allow_sect_absorb = TRUE;
- udata.allow_eoa_shrink_only = FALSE;
-
- /* When adding, meta_aggr is absorbed onto the beginning of the section */
- if (H5FS_sect_add(f, H5AC_ind_read_dxpl_id, f->shared->fs_man[type], (H5FS_section_info_t *)sect_node, H5FS_ADD_RETURNED_SPACE, &udata))
- FAIL_STACK_ERROR
+ /* Add a section to free-space that adjoins end of the aggregator */
+ if(H5MF_add_sect(f, H5FD_MEM_SUPER, H5AC_ind_read_dxpl_id, f->shared->fs_man[H5FD_MEM_SUPER], sect_node))
+ FAIL_STACK_ERROR
/* Verify that the section did absorb the aggregator */
- if(H5FS_sect_find(f, H5AC_ind_read_dxpl_id, f->shared->fs_man[type],
- (hsize_t)TEST_BLOCK_SIZE2048, (H5FS_section_info_t **)&node) < 0)
+ if(H5MF_find_sect(f, H5FD_MEM_SUPER, H5AC_ind_read_dxpl_id, (hsize_t)(ma_addr+ma_size), f->shared->fs_man[H5FD_MEM_SUPER], &tmp) != TRUE)
TEST_ERROR
- if (node->addr != ma_addr) TEST_ERROR
- if (node->size != (ma_size + TEST_BLOCK_SIZE2048)) TEST_ERROR
-
- /* Remove the free-space section node */
- if(H5MF_sect_simple_free((H5FS_section_info_t *)node) < 0)
- TEST_ERROR
+ if(tmp != ma_addr) TEST_ERROR
/* Restore info for aggregator */
f->shared->meta_aggr.addr = ma_addr;
f->shared->meta_aggr.size = ma_size;
/* Remove section from meta_aggr */
- H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr, (hsize_t)TEST_BLOCK_SIZE30);
+ H5MF_xfree(f, H5FD_MEM_SUPER, H5AC_ind_read_dxpl_id, addr, (hsize_t)TBLOCK_SIZE30);
if(H5Fclose(file) < 0)
FAIL_STACK_ERROR
@@ -2093,48 +2038,34 @@ test_mf_fs_absorb(const char *env_h5_drvr, hid_t fapl)
if(NULL == (f = (H5F_t *)H5I_object(file)))
FAIL_STACK_ERROR
- type = H5FD_MEM_SUPER;
-
- if(H5MF__alloc_start(f, H5AC_ind_read_dxpl_id, type) < 0)
- TEST_ERROR
+ /* Start up H5FD_MEM_SUPER free-space manager */
+ if(H5MF_start_fstype(f, H5AC_ind_read_dxpl_id, (H5F_mem_page_t)H5FD_MEM_SUPER) < 0)
+ FAIL_STACK_ERROR
- if (f->shared->fs_state[type] != H5F_FS_STATE_OPEN)
+ if(f->shared->fs_state[H5FD_MEM_SUPER] != H5F_FS_STATE_OPEN)
TEST_ERROR
- if (f->shared->fs_man[type]->client != H5FS_CLIENT_FILE_ID)
+ if(f->shared->fs_man[H5FD_MEM_SUPER]->client != H5FS_CLIENT_FILE_ID)
TEST_ERROR
/* Allocate a section from meta_aggr */
- addr = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE30);
+ addr = H5MF_alloc(f, H5FD_MEM_SUPER, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE30);
H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
/* Allocate a section from sdata_aggr */
- stype = H5FD_MEM_DRAW;
- saddr = H5MF_alloc(f, stype, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE50);
+ saddr = H5MF_alloc(f, H5FD_MEM_DRAW, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE50);
/* Add a section to free-space that adjoins the beginning of meta_aggr */
- sect_node = H5MF_sect_simple_new((haddr_t)addr, (hsize_t)TEST_BLOCK_SIZE30);
-
- /* Construct user data for callbacks */
- udata.f = f;
- udata.dxpl_id = H5AC_ind_read_dxpl_id;
- udata.alloc_type = type;
- udata.allow_sect_absorb = TRUE;
- udata.allow_eoa_shrink_only = FALSE;
+ sect_node = H5MF_sect_new(H5MF_FSPACE_SECT_SIMPLE, (haddr_t)addr, (hsize_t)TBLOCK_SIZE30);
/* When adding, meta_aggr is absorbed onto the end of the section */
- if (H5FS_sect_add(f, H5AC_ind_read_dxpl_id, f->shared->fs_man[type], (H5FS_section_info_t *)sect_node, H5FS_ADD_RETURNED_SPACE, &udata))
- FAIL_STACK_ERROR
+ if(H5MF_add_sect(f, H5FD_MEM_SUPER, H5AC_ind_read_dxpl_id, f->shared->fs_man[H5FD_MEM_SUPER], sect_node))
+ FAIL_STACK_ERROR
/* Verify that the section did absorb the aggregator */
- if(H5FS_sect_find(f, H5AC_ind_read_dxpl_id, f->shared->fs_man[type],
- (hsize_t)(ma_size+TEST_BLOCK_SIZE30), (H5FS_section_info_t **)&node) < 0)
+ if(H5MF_find_sect(f, H5FD_MEM_SUPER, H5AC_ind_read_dxpl_id, (hsize_t)(ma_size+TBLOCK_SIZE30), f->shared->fs_man[H5FD_MEM_SUPER], &tmp) != TRUE)
TEST_ERROR
- if ((node->addr + TEST_BLOCK_SIZE30) != ma_addr) TEST_ERROR
- if (node->size != (ma_size + TEST_BLOCK_SIZE30)) TEST_ERROR
-
- /* free the free-space section node */
- if(H5MF_sect_simple_free((H5FS_section_info_t *)node) < 0)
+ if((tmp + TBLOCK_SIZE30) != ma_addr)
TEST_ERROR
/* restore info to meta_aggr */
@@ -2142,9 +2073,9 @@ test_mf_fs_absorb(const char *env_h5_drvr, hid_t fapl)
f->shared->meta_aggr.size = ma_size;
/* Remove section from meta_aggr */
- H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr, (hsize_t)TEST_BLOCK_SIZE30);
+ H5MF_xfree(f, H5FD_MEM_SUPER, H5AC_ind_read_dxpl_id, addr, (hsize_t)TBLOCK_SIZE30);
/* Remove section from sdata_aggr */
- H5MF_xfree(f, stype, H5AC_ind_read_dxpl_id, saddr, (hsize_t)TEST_BLOCK_SIZE50);
+ H5MF_xfree(f, H5FD_MEM_DRAW, H5AC_ind_read_dxpl_id, saddr, (hsize_t)TBLOCK_SIZE50);
if(H5Fclose(file) < 0)
FAIL_STACK_ERROR
@@ -2166,6 +2097,7 @@ error:
} /* test_mf_fs_absorb() */
/*
+ *-------------------------------------------------------------------------
* To verify that blocks are allocated from the aggregator
*
* Allocate first block (30) from meta_aggr: (nothing in the aggregator)
@@ -2180,6 +2112,7 @@ error:
* Result:
* The second block of 50 is allocated from meta_aggr
* There is space of 1968 left in meta_aggr
+ *-------------------------------------------------------------------------
*/
static unsigned
test_mf_aggr_alloc1(const char *env_h5_drvr, hid_t fapl)
@@ -2187,6 +2120,7 @@ test_mf_aggr_alloc1(const char *env_h5_drvr, hid_t fapl)
hid_t file = -1; /* File ID */
char filename[FILENAME_LEN]; /* Filename to use */
H5F_t *f = NULL; /* Internal file object pointer */
+ hid_t fcpl; /* File creation property list */
h5_stat_size_t file_size, new_file_size; /* file size */
H5FD_mem_t type;
haddr_t addr1, addr2;
@@ -2202,13 +2136,21 @@ test_mf_aggr_alloc1(const char *env_h5_drvr, hid_t fapl)
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
+ /* File creation property list template */
+ if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ TEST_ERROR
+
+ /* Set to H5F_FSPACE_STRATEGY_AGGR strategy */
+ if(H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_AGGR, FALSE, (hsize_t)1) < 0)
+ TEST_ERROR
+
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
FAIL_STACK_ERROR
/* Close file */
if(H5Fclose(file) < 0)
- FAIL_STACK_ERROR
+ TEST_ERROR
/* Get the size of a file */
if((file_size = h5_get_file_size(filename, fapl)) < 0)
@@ -2216,54 +2158,58 @@ test_mf_aggr_alloc1(const char *env_h5_drvr, hid_t fapl)
/* Re-open the file */
if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
- FAIL_STACK_ERROR
+ TEST_ERROR
/* Get a pointer to the internal file object */
if(NULL == (f = (H5F_t *)H5I_object(file)))
- FAIL_STACK_ERROR
+ TEST_ERROR
/* Allocate first block from meta_aggr */
type = H5FD_MEM_SUPER;
- addr1 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE30);
+ if((addr1 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE30)) == HADDR_UNDEF)
+ TEST_ERROR
H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- if ((addr1+TEST_BLOCK_SIZE30) != ma_addr)
+ if((addr1+TBLOCK_SIZE30) != ma_addr)
TEST_ERROR
/* Allocate second block from meta_aggr */
- addr2 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE50);
+ if((addr2 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE50)) == HADDR_UNDEF)
+ TEST_ERROR
H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- if ((addr2+TEST_BLOCK_SIZE50) != ma_addr)
+ if((addr2+TBLOCK_SIZE50) != ma_addr)
TEST_ERROR
- if (ma_size != (TEST_BLOCK_SIZE2048 - (TEST_BLOCK_SIZE30 + TEST_BLOCK_SIZE50)))
+ if(ma_size != (TBLOCK_SIZE2048 - (TBLOCK_SIZE30 + TBLOCK_SIZE50)))
TEST_ERROR
if(H5Fclose(file) < 0)
- FAIL_STACK_ERROR
+ TEST_ERROR
/* Get the size of the file */
if((new_file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Verify the file is the correct size */
- if (new_file_size != (file_size+TEST_BLOCK_SIZE30+TEST_BLOCK_SIZE50))
+ if(new_file_size != (file_size+TBLOCK_SIZE30+TBLOCK_SIZE50))
TEST_ERROR
/* Re-open the file */
if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
- FAIL_STACK_ERROR
+ TEST_ERROR
/* Get a pointer to the internal file object */
if(NULL == (f = (H5F_t *)H5I_object(file)))
- FAIL_STACK_ERROR
+ TEST_ERROR
- /* Free the two blocks */
- H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr1, (hsize_t)TEST_BLOCK_SIZE30);
- H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr2, (hsize_t)TEST_BLOCK_SIZE50);
+ /* Free the two blocks: order matters because of H5F_FSPACE_STRATEGY_AGGR strategy */
+ if(H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr2, (hsize_t)TBLOCK_SIZE50) < 0)
+ TEST_ERROR
+ if(H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr1, (hsize_t)TBLOCK_SIZE30) < 0)
+ TEST_ERROR
if(H5Fclose(file) < 0)
- FAIL_STACK_ERROR
+ TEST_ERROR
/* Get the size of the file */
if((new_file_size = h5_get_file_size(filename, fapl)) < 0)
@@ -2273,6 +2219,9 @@ test_mf_aggr_alloc1(const char *env_h5_drvr, hid_t fapl)
if (new_file_size != file_size)
TEST_ERROR
+ if(H5Pclose(fcpl) < 0)
+ TEST_ERROR
+
PASSED()
} /* end if */
else {
@@ -2285,11 +2234,13 @@ test_mf_aggr_alloc1(const char *env_h5_drvr, hid_t fapl)
error:
H5E_BEGIN_TRY {
H5Fclose(file);
+ H5Pclose(fcpl);
} H5E_END_TRY;
return(1);
} /* test_mf_aggr_alloc1() */
/*
+ *-------------------------------------------------------------------------
* To verify that blocks are allocated from the aggregator
*
* Allocate first block (30) from meta_aggr: (nothing in the aggregator)
@@ -2311,6 +2262,7 @@ error:
* A block of request-size is extended via file allocation and is merged with meta_aggr
* The block of 2058 is allocated out of meta_aggr
* There is space of 1968 left in meta_aggr
+ *-------------------------------------------------------------------------
*/
static unsigned
test_mf_aggr_alloc2(const char *env_h5_drvr, hid_t fapl)
@@ -2354,29 +2306,29 @@ test_mf_aggr_alloc2(const char *env_h5_drvr, hid_t fapl)
FAIL_STACK_ERROR
type = H5FD_MEM_SUPER;
- addr1 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE30);
+ addr1 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE30);
H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- if ((addr1+TEST_BLOCK_SIZE30) != ma_addr)
+ if((addr1+TBLOCK_SIZE30) != ma_addr)
TEST_ERROR
- addr2 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE50);
+ addr2 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE50);
H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- if ((addr2+TEST_BLOCK_SIZE50) != ma_addr)
+ if((addr2+TBLOCK_SIZE50) != ma_addr)
TEST_ERROR
- if (ma_size != (TEST_BLOCK_SIZE2048 - (TEST_BLOCK_SIZE30 + TEST_BLOCK_SIZE50)))
+ if (ma_size != (TBLOCK_SIZE2048 - (TBLOCK_SIZE30 + TBLOCK_SIZE50)))
TEST_ERROR
- addr3 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE2058);
+ addr3 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE2058);
H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- if ((addr3+TEST_BLOCK_SIZE2058) != ma_addr)
+ if((addr3+TBLOCK_SIZE2058) != ma_addr)
TEST_ERROR
- if (ma_size != (TEST_BLOCK_SIZE2048 - (TEST_BLOCK_SIZE30 + TEST_BLOCK_SIZE50)))
+ if(ma_size != (TBLOCK_SIZE2048 - (TBLOCK_SIZE30 + TBLOCK_SIZE50)))
TEST_ERROR
if(H5Fclose(file) < 0)
@@ -2388,7 +2340,7 @@ test_mf_aggr_alloc2(const char *env_h5_drvr, hid_t fapl)
/* Verify the file is the correct size */
/* Unused space is freed from the end of the file */
- if (new_file_size != (file_size+TEST_BLOCK_SIZE30+TEST_BLOCK_SIZE50+TEST_BLOCK_SIZE2058))
+ if(new_file_size != (file_size+TBLOCK_SIZE30+TBLOCK_SIZE50+TBLOCK_SIZE2058))
TEST_ERROR
/* Re-open the file */
@@ -2399,7 +2351,7 @@ test_mf_aggr_alloc2(const char *env_h5_drvr, hid_t fapl)
if(NULL == (f = (H5F_t *)H5I_object(file)))
FAIL_STACK_ERROR
- H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr1, (hsize_t)TEST_BLOCK_SIZE30+TEST_BLOCK_SIZE50+TEST_BLOCK_SIZE2058);
+ H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr1, (hsize_t)TBLOCK_SIZE30+TBLOCK_SIZE50+TBLOCK_SIZE2058);
if(H5Fclose(file) < 0)
FAIL_STACK_ERROR
@@ -2429,6 +2381,7 @@ error:
} /* test_mf_aggr_alloc2() */
/*
+ *-------------------------------------------------------------------------
* To verify that blocks are allocated from the aggregator
*
* Allocate first block (30) from meta_aggr : (nothing in the aggregator)
@@ -2463,6 +2416,7 @@ error:
* Result:
* The fourth block of 50 is allocated from what is left in meta_aggr
* There is space of 1968 left in meta_aggr
+ *-------------------------------------------------------------------------
*/
static unsigned
test_mf_aggr_alloc3(const char *env_h5_drvr, hid_t fapl)
@@ -2509,55 +2463,55 @@ test_mf_aggr_alloc3(const char *env_h5_drvr, hid_t fapl)
/* Allocate first block from meta_aggr */
type = H5FD_MEM_SUPER;
- addr1 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE30);
+ addr1 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE30);
H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- if ((addr1+TEST_BLOCK_SIZE30) != ma_addr)
+ if ((addr1+TBLOCK_SIZE30) != ma_addr)
TEST_ERROR
/* Allocate second block from meta_aggr */
- addr2 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE50);
+ addr2 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE50);
H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- if ((addr2+TEST_BLOCK_SIZE50) != ma_addr)
+ if((addr2+TBLOCK_SIZE50) != ma_addr)
TEST_ERROR
- if (ma_size != (TEST_BLOCK_SIZE2048 - (TEST_BLOCK_SIZE30 + TEST_BLOCK_SIZE50)))
+ if(ma_size != (TBLOCK_SIZE2048 - (TBLOCK_SIZE30 + TBLOCK_SIZE50)))
TEST_ERROR
/* Allocate first block from sdata_aggr */
stype = H5FD_MEM_DRAW;
- saddr1 = H5MF_alloc(f, stype, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE30);
+ saddr1 = H5MF_alloc(f, stype, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE30);
H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size);
- if ((saddr1+TEST_BLOCK_SIZE30) != sdata_addr)
+ if((saddr1+TBLOCK_SIZE30) != sdata_addr)
TEST_ERROR
- if (sdata_size != (TEST_BLOCK_SIZE2048 - TEST_BLOCK_SIZE30)) TEST_ERROR
+ if(sdata_size != (TBLOCK_SIZE2048 - TBLOCK_SIZE30)) TEST_ERROR
/* Allocate third block, which is from file allocation not from meta_aggr */
- addr3 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)(TEST_BLOCK_SIZE2058));
+ addr3 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)(TBLOCK_SIZE2058));
H5MF_aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size);
/* info for meta_aggr shouldn't be changed */
- if (addr3 != (sdata_addr+sdata_size)) TEST_ERROR
- if ((addr3+TEST_BLOCK_SIZE2058) == new_ma_addr) TEST_ERROR
- if ((new_ma_addr != ma_addr) || (new_ma_size != ma_size)) TEST_ERROR
+ if(addr3 != (sdata_addr+sdata_size)) TEST_ERROR
+ if((addr3+TBLOCK_SIZE2058) == new_ma_addr) TEST_ERROR
+ if((new_ma_addr != ma_addr) || (new_ma_size != ma_size)) TEST_ERROR
/* Allocate fourth block, which should be from meta_aggr */
- addr4 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE50);
+ addr4 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE50);
H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- if ((addr4+TEST_BLOCK_SIZE50) != ma_addr)
+ if((addr4+TBLOCK_SIZE50) != ma_addr)
TEST_ERROR
- if (ma_size != (TEST_BLOCK_SIZE2048 - (TEST_BLOCK_SIZE30 + TEST_BLOCK_SIZE50 + TEST_BLOCK_SIZE50)))
+ if(ma_size != (TBLOCK_SIZE2048 - (TBLOCK_SIZE30 + TBLOCK_SIZE50 + TBLOCK_SIZE50)))
TEST_ERROR
/* Free all the allocated blocks */
- H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr1, (hsize_t)TEST_BLOCK_SIZE30);
- H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr2, (hsize_t)TEST_BLOCK_SIZE50);
- H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr3, (hsize_t)TEST_BLOCK_SIZE2058);
- H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr4, (hsize_t)TEST_BLOCK_SIZE50);
- H5MF_xfree(f, stype, H5AC_ind_read_dxpl_id, saddr1, (hsize_t)TEST_BLOCK_SIZE30);
+ H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr1, (hsize_t)TBLOCK_SIZE30);
+ H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr2, (hsize_t)TBLOCK_SIZE50);
+ H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr3, (hsize_t)TBLOCK_SIZE2058);
+ H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr4, (hsize_t)TBLOCK_SIZE50);
+ H5MF_xfree(f, stype, H5AC_ind_read_dxpl_id, saddr1, (hsize_t)TBLOCK_SIZE30);
if(H5Fclose(file) < 0)
FAIL_STACK_ERROR
@@ -2567,7 +2521,7 @@ test_mf_aggr_alloc3(const char *env_h5_drvr, hid_t fapl)
TEST_ERROR
/* Verify the file is the correct size */
- if (new_file_size != file_size)
+ if(new_file_size != file_size)
TEST_ERROR
PASSED()
@@ -2588,6 +2542,7 @@ error:
/*
+ *-------------------------------------------------------------------------
* To verify that blocks are allocated from the aggregator
*
* Allocate first block (30) from meta_aggr: (nothing in the aggregator)
@@ -2626,6 +2581,7 @@ error:
* The new block's address is returned
* The block does not adjoin meta_aggr
* meta_aggr's info is unchanged
+ *-------------------------------------------------------------------------
*/
static unsigned
test_mf_aggr_alloc4(const char *env_h5_drvr, hid_t fapl)
@@ -2670,59 +2626,59 @@ test_mf_aggr_alloc4(const char *env_h5_drvr, hid_t fapl)
/* Allocate first block from meta_aggr */
type = H5FD_MEM_SUPER;
- addr1 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE30);
+ addr1 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE30);
H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- if ((addr1+TEST_BLOCK_SIZE30) != ma_addr)
+ if((addr1+TBLOCK_SIZE30) != ma_addr)
TEST_ERROR
- if (ma_size != (TEST_BLOCK_SIZE2048 - TEST_BLOCK_SIZE30))
+ if(ma_size != (TBLOCK_SIZE2048 - TBLOCK_SIZE30))
TEST_ERROR
/* Allocate first block from sdata_aggr */
stype = H5FD_MEM_DRAW;
- saddr1 = H5MF_alloc(f, stype, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE30);
+ saddr1 = H5MF_alloc(f, stype, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE30);
H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size);
- if ((saddr1+TEST_BLOCK_SIZE30) != sdata_addr)
+ if((saddr1+TBLOCK_SIZE30) != sdata_addr)
TEST_ERROR
/* Allocate second block from sdata_aggr */
- saddr2 = H5MF_alloc(f, stype, H5AC_ind_read_dxpl_id, (hsize_t)(TEST_BLOCK_SIZE2048 - TEST_BLOCK_SIZE30));
+ saddr2 = H5MF_alloc(f, stype, H5AC_ind_read_dxpl_id, (hsize_t)(TBLOCK_SIZE2048 - TBLOCK_SIZE30));
H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size);
- if (saddr2+(TEST_BLOCK_SIZE2048 - TEST_BLOCK_SIZE30) != sdata_addr)
+ if(saddr2+(TBLOCK_SIZE2048 - TBLOCK_SIZE30) != sdata_addr)
TEST_ERROR
/* Allocate third block from sdata_aggr */
- saddr3 = H5MF_alloc(f, stype, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE50);
+ saddr3 = H5MF_alloc(f, stype, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE50);
H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size);
- if ((saddr3+TEST_BLOCK_SIZE50) != sdata_addr)
+ if((saddr3+TBLOCK_SIZE50) != sdata_addr)
TEST_ERROR
- if(sdata_size != (TEST_BLOCK_SIZE2048 - TEST_BLOCK_SIZE50))
+ if(sdata_size != (TBLOCK_SIZE2048 - TBLOCK_SIZE50))
TEST_ERROR
/* Allocate second block of 2058, which is from file allocation, not from meta_aggr */
- addr2 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE2058);
+ addr2 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE2058);
- if (addr2 != sdata_addr)
+ if(addr2 != sdata_addr)
TEST_ERROR
/* sdata_aggr is reset 0 */
H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size);
- if ((sdata_addr != 0) && (sdata_size != 0))
+ if((sdata_addr != 0) && (sdata_size != 0))
TEST_ERROR
/* info is unchanged in meta_aggr */
H5MF_aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size);
- if ((new_ma_addr != ma_addr) && (new_ma_size != ma_size))
+ if((new_ma_addr != ma_addr) && (new_ma_size != ma_size))
TEST_ERROR
/* Free all the allocated blocks */
- H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr1, (hsize_t)TEST_BLOCK_SIZE30);
- H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr2, (hsize_t)TEST_BLOCK_SIZE2058);
- H5MF_xfree(f, stype, H5AC_ind_read_dxpl_id, saddr1, (hsize_t)TEST_BLOCK_SIZE30);
- H5MF_xfree(f, stype, H5AC_ind_read_dxpl_id, saddr2, (hsize_t)TEST_BLOCK_SIZE2048 - TEST_BLOCK_SIZE30);
- H5MF_xfree(f, stype, H5AC_ind_read_dxpl_id, saddr3, (hsize_t)TEST_BLOCK_SIZE50);
+ H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr1, (hsize_t)TBLOCK_SIZE30);
+ H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr2, (hsize_t)TBLOCK_SIZE2058);
+ H5MF_xfree(f, stype, H5AC_ind_read_dxpl_id, saddr1, (hsize_t)TBLOCK_SIZE30);
+ H5MF_xfree(f, stype, H5AC_ind_read_dxpl_id, saddr2, (hsize_t)TBLOCK_SIZE2048 - TBLOCK_SIZE30);
+ H5MF_xfree(f, stype, H5AC_ind_read_dxpl_id, saddr3, (hsize_t)TBLOCK_SIZE50);
if(H5Fclose(file) < 0)
FAIL_STACK_ERROR
@@ -2732,7 +2688,7 @@ test_mf_aggr_alloc4(const char *env_h5_drvr, hid_t fapl)
TEST_ERROR
/* Verify the file is the correct size */
- if (new_file_size != file_size)
+ if(new_file_size != file_size)
TEST_ERROR
PASSED()
@@ -2752,6 +2708,7 @@ error:
} /* test_mf_aggr_alloc4() */
/*
+ *-------------------------------------------------------------------------
* To verify that blocks are allocated from the aggregator
*
* Allocate first block (30) from meta_aggr: (nothing in the aggregator)
@@ -2772,6 +2729,7 @@ error:
* The block of 1970 is allocated from there
* There is space of 2046 left in meta_aggr
*
+ *-------------------------------------------------------------------------
*/
static unsigned
test_mf_aggr_alloc5(const char *env_h5_drvr, hid_t fapl)
@@ -2816,34 +2774,34 @@ test_mf_aggr_alloc5(const char *env_h5_drvr, hid_t fapl)
/* Allocate first block from meta_aggr */
type = H5FD_MEM_SUPER;
- addr1 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE30);
+ addr1 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE30);
H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- if ((addr1+TEST_BLOCK_SIZE30) != ma_addr)
+ if((addr1+TBLOCK_SIZE30) != ma_addr)
TEST_ERROR
/* Allocate second block from meta_aggr */
- addr2 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE50);
+ addr2 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE50);
H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- if (addr2+TEST_BLOCK_SIZE50 != ma_addr)
+ if(addr2+TBLOCK_SIZE50 != ma_addr)
TEST_ERROR
- if (ma_size != (TEST_BLOCK_SIZE2048 - (TEST_BLOCK_SIZE30+TEST_BLOCK_SIZE50)))
+ if(ma_size != (TBLOCK_SIZE2048 - (TBLOCK_SIZE30+TBLOCK_SIZE50)))
TEST_ERROR
/* Allocate third block from meta_aggr */
- addr3 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE1970);
+ addr3 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE1970);
H5MF_aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size);
- if (addr3 != ma_addr) TEST_ERROR
- if ((addr3+TEST_BLOCK_SIZE1970) != new_ma_addr) TEST_ERROR
- if (new_ma_size != (TEST_BLOCK_SIZE2048 - (TEST_BLOCK_SIZE1970 - ma_size)))
+ if(addr3 != ma_addr) TEST_ERROR
+ if((addr3+TBLOCK_SIZE1970) != new_ma_addr) TEST_ERROR
+ if(new_ma_size != (TBLOCK_SIZE2048 - (TBLOCK_SIZE1970 - ma_size)))
TEST_ERROR
/* Free all the allocated blocks */
- H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr1, (hsize_t)TEST_BLOCK_SIZE30);
- H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr2, (hsize_t)TEST_BLOCK_SIZE50);
- H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr3, (hsize_t)TEST_BLOCK_SIZE1970);
+ H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr1, (hsize_t)TBLOCK_SIZE30);
+ H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr2, (hsize_t)TBLOCK_SIZE50);
+ H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr3, (hsize_t)TBLOCK_SIZE1970);
if(H5Fclose(file) < 0)
FAIL_STACK_ERROR
@@ -2853,7 +2811,7 @@ test_mf_aggr_alloc5(const char *env_h5_drvr, hid_t fapl)
TEST_ERROR
/* Verify the file is the correct size */
- if (new_file_size != file_size)
+ if(new_file_size != file_size)
TEST_ERROR
PASSED()
@@ -2873,6 +2831,7 @@ error:
} /* test_mf_aggr_alloc5() */
/*
+ *-------------------------------------------------------------------------
* To verify that blocks are allocated from the aggregator
*
* Allocate first block (30) from meta_aggr: (nothing in the aggregator)
@@ -2903,6 +2862,7 @@ error:
* sdata_aggr is untouched
* meta_aggr's unused space of [880, 1968] is freed to free-space
* meta_aggr is updated to point to the new block
+ *-------------------------------------------------------------------------
*/
static unsigned
test_mf_aggr_alloc6(const char *env_h5_drvr, hid_t fapl)
@@ -2915,7 +2875,7 @@ test_mf_aggr_alloc6(const char *env_h5_drvr, hid_t fapl)
haddr_t addr1, addr2, addr3, saddr1;
haddr_t ma_addr=HADDR_UNDEF, new_ma_addr=HADDR_UNDEF, sdata_addr=HADDR_UNDEF;
hsize_t ma_size=0, new_ma_size=0, sdata_size=0;
- frspace_state_t state;
+ H5FS_stat_t state;
hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */
TESTING("H5MF_alloc() of meta/sdata aggregator:test 6");
@@ -2949,44 +2909,44 @@ test_mf_aggr_alloc6(const char *env_h5_drvr, hid_t fapl)
type = H5FD_MEM_SUPER;
/* Allocate first block from meta_aggr */
- addr1 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE30);
+ addr1 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE30);
H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- if ((addr1+TEST_BLOCK_SIZE30) != ma_addr)
+ if((addr1+TBLOCK_SIZE30) != ma_addr)
TEST_ERROR
/* Allocate second block from meta_aggr */
- addr2 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE50);
+ addr2 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE50);
H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- if (addr2+TEST_BLOCK_SIZE50 != ma_addr)
+ if(addr2+TBLOCK_SIZE50 != ma_addr)
TEST_ERROR
- if (ma_size != (TEST_BLOCK_SIZE2048 - (TEST_BLOCK_SIZE30 + TEST_BLOCK_SIZE50)))
+ if(ma_size != (TBLOCK_SIZE2048 - (TBLOCK_SIZE30 + TBLOCK_SIZE50)))
TEST_ERROR
/* Allocate first block from sdata_aggr */
stype = H5FD_MEM_DRAW;
- saddr1 = H5MF_alloc(f, stype, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE30);
+ saddr1 = H5MF_alloc(f, stype, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE30);
H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size);
- if ((saddr1+TEST_BLOCK_SIZE30) != sdata_addr) TEST_ERROR
- if (sdata_size != (TEST_BLOCK_SIZE2048 - TEST_BLOCK_SIZE30)) TEST_ERROR
+ if((saddr1+TBLOCK_SIZE30) != sdata_addr) TEST_ERROR
+ if(sdata_size != (TBLOCK_SIZE2048 - TBLOCK_SIZE30)) TEST_ERROR
/* Allocate third block from meta_aggr */
- addr3 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE1970);
+ addr3 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE1970);
H5MF_aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size);
- if ((addr3+TEST_BLOCK_SIZE1970) != new_ma_addr) TEST_ERROR
- if (addr3 != (sdata_addr+sdata_size)) TEST_ERROR
+ if((addr3+TBLOCK_SIZE1970) != new_ma_addr) TEST_ERROR
+ if(addr3 != (sdata_addr+sdata_size)) TEST_ERROR
- if ((ma_addr+TEST_BLOCK_SIZE1970) == new_ma_addr) TEST_ERROR
- if (new_ma_size != (TEST_BLOCK_SIZE2048 - TEST_BLOCK_SIZE1970))
+ if((ma_addr+TBLOCK_SIZE1970) == new_ma_addr) TEST_ERROR
+ if(new_ma_size != (TBLOCK_SIZE2048 - TBLOCK_SIZE1970))
TEST_ERROR
/* Verify that meta_aggr's unused space of 1968 is freed to free-space */
- HDmemset(&state, 0, sizeof(frspace_state_t));
- state.tot_space += (TEST_BLOCK_SIZE2048 - (TEST_BLOCK_SIZE30+TEST_BLOCK_SIZE50));
+ HDmemset(&state, 0, sizeof(H5FS_stat_t));
+ state.tot_space += (TBLOCK_SIZE2048 - (TBLOCK_SIZE30+TBLOCK_SIZE50));
state.tot_sect_count += 1;
state.serial_sect_count += 1;
@@ -2994,10 +2954,10 @@ test_mf_aggr_alloc6(const char *env_h5_drvr, hid_t fapl)
TEST_ERROR
/* Free all the allocated blocks */
- H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr1, (hsize_t)TEST_BLOCK_SIZE30);
- H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr2, (hsize_t)TEST_BLOCK_SIZE50);
- H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr3, (hsize_t)TEST_BLOCK_SIZE1970);
- H5MF_xfree(f, stype, H5AC_ind_read_dxpl_id, saddr1, (hsize_t)TEST_BLOCK_SIZE30);
+ H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr1, (hsize_t)TBLOCK_SIZE30);
+ H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr2, (hsize_t)TBLOCK_SIZE50);
+ H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr3, (hsize_t)TBLOCK_SIZE1970);
+ H5MF_xfree(f, stype, H5AC_ind_read_dxpl_id, saddr1, (hsize_t)TBLOCK_SIZE30);
if(H5Fclose(file) < 0)
FAIL_STACK_ERROR
@@ -3007,7 +2967,7 @@ test_mf_aggr_alloc6(const char *env_h5_drvr, hid_t fapl)
TEST_ERROR
/* Verify the file is the correct size */
- if (new_file_size != file_size)
+ if(new_file_size != file_size)
TEST_ERROR
PASSED()
@@ -3027,13 +2987,14 @@ error:
} /* test_mf_aggr_alloc6() */
/*
+ *-------------------------------------------------------------------------
* To verify that blocks are allocated from the aggregator
*
- * Allocate first block (30) from meta_aggr: (nothing in meta_aggr)
- * request-size is > what is left in meta_aggr and < meta_aggr->alloc_size
- * Result:
- * A block of meta_aggr->alloc_size is obtained via file allocation
- * The first block of 30 is allocated from there
+ * Allocate first block (30) from meta_aggr: (nothing in meta_aggr)
+ * request-size is > what is left in meta_aggr and < meta_aggr->alloc_size
+ * Result:
+ * A block of meta_aggr->alloc_size is obtained via file allocation
+ * The first block of 30 is allocated from there
*
* Allocate second block (50) from meta_aggr:
* request-size is <= what is left in meta_aggr
@@ -3068,6 +3029,7 @@ error:
* The block does not adjoin meta_aggr
* meta_aggr's unused space of [880, 1968] is freed to free-space
* meta_aggr is updated to point to the new block
+ *-------------------------------------------------------------------------
*/
static unsigned
test_mf_aggr_alloc7(const char *env_h5_drvr, hid_t fapl)
@@ -3080,7 +3042,7 @@ test_mf_aggr_alloc7(const char *env_h5_drvr, hid_t fapl)
haddr_t addr1, addr2, addr3, saddr1, saddr2, saddr3;
haddr_t ma_addr=HADDR_UNDEF, sdata_addr=HADDR_UNDEF;
hsize_t ma_size=0, sdata_size=0;
- frspace_state_t state;
+ H5FS_stat_t state;
hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */
TESTING("H5MF_alloc() of meta/sdata aggregator:test 7");
@@ -3113,51 +3075,51 @@ test_mf_aggr_alloc7(const char *env_h5_drvr, hid_t fapl)
/* Allocate the first block from meta_aggr */
type = H5FD_MEM_SUPER;
- addr1 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE30);
+ addr1 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE30);
H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- if ((addr1+TEST_BLOCK_SIZE30) != ma_addr)
+ if ((addr1+TBLOCK_SIZE30) != ma_addr)
TEST_ERROR
/* Allocate the second block from meta_aggr */
- addr2 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE50);
+ addr2 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE50);
H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- if (addr2+TEST_BLOCK_SIZE50 != ma_addr)
+ if (addr2+TBLOCK_SIZE50 != ma_addr)
TEST_ERROR
- if (ma_size != (TEST_BLOCK_SIZE2048 - (TEST_BLOCK_SIZE30 + TEST_BLOCK_SIZE50)))
+ if (ma_size != (TBLOCK_SIZE2048 - (TBLOCK_SIZE30 + TBLOCK_SIZE50)))
TEST_ERROR
/* Allocate the first block from sdata_aggr */
stype = H5FD_MEM_DRAW;
- saddr1 = H5MF_alloc(f, stype, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE30);
+ saddr1 = H5MF_alloc(f, stype, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE30);
H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size);
- if ((saddr1+TEST_BLOCK_SIZE30) != sdata_addr)
+ if ((saddr1+TBLOCK_SIZE30) != sdata_addr)
TEST_ERROR
/* Allocate the second block from sdata_aggr */
- saddr2 = H5MF_alloc(f, stype, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE2048 - TEST_BLOCK_SIZE30);
+ saddr2 = H5MF_alloc(f, stype, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE2048 - TBLOCK_SIZE30);
H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size);
- if ((saddr2+(TEST_BLOCK_SIZE2048 - TEST_BLOCK_SIZE30)) != sdata_addr)
+ if ((saddr2+(TBLOCK_SIZE2048 - TBLOCK_SIZE30)) != sdata_addr)
TEST_ERROR
if (sdata_size != 0) TEST_ERROR
/* Allocate the third block from sdata_aggr */
- saddr3 = H5MF_alloc(f, stype, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE50);
+ saddr3 = H5MF_alloc(f, stype, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE50);
H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size);
- if ((saddr3+TEST_BLOCK_SIZE50) != sdata_addr)
+ if ((saddr3+TBLOCK_SIZE50) != sdata_addr)
TEST_ERROR
- if (sdata_size != (TEST_BLOCK_SIZE2048 - TEST_BLOCK_SIZE50))
+ if (sdata_size != (TBLOCK_SIZE2048 - TBLOCK_SIZE50))
TEST_ERROR
/* Allocate the third block from meta_aggr */
- addr3 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE1970);
+ addr3 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE1970);
H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
if (addr3 != sdata_addr) TEST_ERROR
- if ((addr3 + TEST_BLOCK_SIZE1970) != ma_addr) TEST_ERROR
- if (ma_size != (TEST_BLOCK_SIZE2048 - TEST_BLOCK_SIZE1970)) TEST_ERROR
+ if ((addr3 + TBLOCK_SIZE1970) != ma_addr) TEST_ERROR
+ if (ma_size != (TBLOCK_SIZE2048 - TBLOCK_SIZE1970)) TEST_ERROR
/* sdata_aggr info is reset to 0 */
H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size);
@@ -3165,8 +3127,8 @@ test_mf_aggr_alloc7(const char *env_h5_drvr, hid_t fapl)
if (sdata_size != 0) TEST_ERROR
/* Verify that meta_aggr's unused space of 1968 is freed to free-space */
- HDmemset(&state, 0, sizeof(frspace_state_t));
- state.tot_space += (TEST_BLOCK_SIZE2048 - (TEST_BLOCK_SIZE30 + TEST_BLOCK_SIZE50));
+ HDmemset(&state, 0, sizeof(H5FS_stat_t));
+ state.tot_space += (TBLOCK_SIZE2048 - (TBLOCK_SIZE30 + TBLOCK_SIZE50));
state.tot_sect_count += 1;
state.serial_sect_count += 1;
@@ -3174,12 +3136,12 @@ test_mf_aggr_alloc7(const char *env_h5_drvr, hid_t fapl)
TEST_ERROR
/* Free all the allocated blocks */
- H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr1, (hsize_t)TEST_BLOCK_SIZE30);
- H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr2, (hsize_t)TEST_BLOCK_SIZE50);
- H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr3, (hsize_t)TEST_BLOCK_SIZE1970);
- H5MF_xfree(f, stype, H5AC_ind_read_dxpl_id, saddr1, (hsize_t)TEST_BLOCK_SIZE30);
- H5MF_xfree(f, stype, H5AC_ind_read_dxpl_id, saddr2, (hsize_t)(TEST_BLOCK_SIZE2048 - TEST_BLOCK_SIZE30));
- H5MF_xfree(f, stype, H5AC_ind_read_dxpl_id, saddr3, (hsize_t)TEST_BLOCK_SIZE50);
+ H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr1, (hsize_t)TBLOCK_SIZE30);
+ H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr2, (hsize_t)TBLOCK_SIZE50);
+ H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr3, (hsize_t)TBLOCK_SIZE1970);
+ H5MF_xfree(f, stype, H5AC_ind_read_dxpl_id, saddr1, (hsize_t)TBLOCK_SIZE30);
+ H5MF_xfree(f, stype, H5AC_ind_read_dxpl_id, saddr2, (hsize_t)(TBLOCK_SIZE2048 - TBLOCK_SIZE30));
+ H5MF_xfree(f, stype, H5AC_ind_read_dxpl_id, saddr3, (hsize_t)TBLOCK_SIZE50);
if(H5Fclose(file) < 0)
FAIL_STACK_ERROR
@@ -3209,6 +3171,7 @@ error:
} /* test_mf_aggr_alloc7() */
/*
+ *-------------------------------------------------------------------------
* To verify that a block can be extended from the aggregator
*
* Test 1: Allocate block A from meta_aggr which is at end of file
@@ -3229,6 +3192,7 @@ error:
* Allocate block B from sdata_aggr so that meta_aggr is not at end of file
* Try to extend a block which adjoins meta_aggr but meta_aggr cannot fulfill the extended-request
* H5MF_try_extend() fails
+ *-------------------------------------------------------------------------
*/
static unsigned
test_mf_aggr_extend(const char *env_h5_drvr, hid_t fapl)
@@ -3274,9 +3238,9 @@ test_mf_aggr_extend(const char *env_h5_drvr, hid_t fapl)
/* Allocate the first block from meta_aggr */
type = H5FD_MEM_SUPER;
- addr = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE30);
+ addr = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE30);
H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- if ((addr+TEST_BLOCK_SIZE30) != ma_addr)
+ if((addr+TBLOCK_SIZE30) != ma_addr)
TEST_ERROR
/* Adjust meta_aggr's info info for testing */
@@ -3286,7 +3250,7 @@ test_mf_aggr_extend(const char *env_h5_drvr, hid_t fapl)
new_addr = addr - 10;
/* Try to extend the block by an amount < (% * aggr->alloc_size) */
- was_extended = H5MF_try_extend(f, H5AC_ind_read_dxpl_id, type, (haddr_t)new_addr, (hsize_t)10, (hsize_t)(TEST_BLOCK_SIZE50));
+ was_extended = H5MF_try_extend(f, H5AC_ind_read_dxpl_id, type, (haddr_t)new_addr, (hsize_t)10, (hsize_t)(TBLOCK_SIZE50));
/* should succeed */
if(!was_extended)
@@ -3294,15 +3258,15 @@ test_mf_aggr_extend(const char *env_h5_drvr, hid_t fapl)
H5MF_aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size);
- if (new_ma_addr != (addr+TEST_BLOCK_SIZE50))
+ if(new_ma_addr != (addr+TBLOCK_SIZE50))
TEST_ERROR
- if (new_ma_size != (f->shared->meta_aggr.alloc_size - TEST_BLOCK_SIZE50)) TEST_ERROR
+ if(new_ma_size != (f->shared->meta_aggr.alloc_size - TBLOCK_SIZE50)) TEST_ERROR
/* Free the allocated blocks */
- H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr, (hsize_t)TEST_BLOCK_SIZE50);
+ H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr, (hsize_t)TBLOCK_SIZE50);
/* Try to extend the block by an amount > (% * aggr->alloc_size) but amount < aggr->alloc_size */
- was_extended = H5MF_try_extend(f, H5AC_ind_read_dxpl_id, type, (haddr_t)new_addr, (hsize_t)10, (hsize_t)(TEST_BLOCK_SIZE700));
+ was_extended = H5MF_try_extend(f, H5AC_ind_read_dxpl_id, type, (haddr_t)new_addr, (hsize_t)10, (hsize_t)(TBLOCK_SIZE700));
/* should succeed */
if(!was_extended)
@@ -3310,15 +3274,15 @@ test_mf_aggr_extend(const char *env_h5_drvr, hid_t fapl)
H5MF_aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size);
- if (new_ma_addr != (addr + TEST_BLOCK_SIZE700))
+ if(new_ma_addr != (addr + TBLOCK_SIZE700))
TEST_ERROR
- if (new_ma_size != (f->shared->meta_aggr.alloc_size * 2 - TEST_BLOCK_SIZE700)) TEST_ERROR
+ if(new_ma_size != (f->shared->meta_aggr.alloc_size * 2 - TBLOCK_SIZE700)) TEST_ERROR
/* Free the allocated blocks */
- H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr, (hsize_t)TEST_BLOCK_SIZE700);
+ H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr, (hsize_t)TBLOCK_SIZE700);
/* Try to extend the block by an amount > (% * aggr->alloc_size) but amount > aggr->alloc_size */
- was_extended = H5MF_try_extend(f, H5AC_ind_read_dxpl_id, type, (haddr_t)new_addr, (hsize_t)10, (hsize_t)(TEST_BLOCK_SIZE2058));
+ was_extended = H5MF_try_extend(f, H5AC_ind_read_dxpl_id, type, (haddr_t)new_addr, (hsize_t)10, (hsize_t)(TBLOCK_SIZE2058));
/* should succeed */
if(!was_extended)
@@ -3326,12 +3290,12 @@ test_mf_aggr_extend(const char *env_h5_drvr, hid_t fapl)
H5MF_aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size);
- if (new_ma_addr != (addr + TEST_BLOCK_SIZE2058))
+ if (new_ma_addr != (addr + TBLOCK_SIZE2058))
TEST_ERROR
if (new_ma_size != f->shared->meta_aggr.size) TEST_ERROR
/* Free the allocated blocks */
- H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr, (hsize_t)TEST_BLOCK_SIZE2058);
+ H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr, (hsize_t)TBLOCK_SIZE2058);
if(H5Fclose(file) < 0)
FAIL_STACK_ERROR
@@ -3365,16 +3329,16 @@ test_mf_aggr_extend(const char *env_h5_drvr, hid_t fapl)
/* Allocate the first block from meta_aggr */
type = H5FD_MEM_SUPER;
- addr = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE30);
+ addr = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE30);
H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- if ((addr+TEST_BLOCK_SIZE30) != ma_addr)
+ if((addr+TBLOCK_SIZE30) != ma_addr)
TEST_ERROR
/* Allocate the first block from sdata_aggr */
stype = H5FD_MEM_DRAW;
- saddr = H5MF_alloc(f, stype, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE50);
+ saddr = H5MF_alloc(f, stype, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE50);
H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size);
- if ((saddr+TEST_BLOCK_SIZE50) != sdata_addr)
+ if((saddr+TBLOCK_SIZE50) != sdata_addr)
TEST_ERROR
/* Adjust meta_aggr's info info for testing */
@@ -3384,24 +3348,24 @@ test_mf_aggr_extend(const char *env_h5_drvr, hid_t fapl)
new_addr = addr - 10;
/* should be able to fulfill request from the aggreqator itself */
- was_extended = H5MF_try_extend(f, H5AC_ind_read_dxpl_id, type, (haddr_t)new_addr, (hsize_t)10, (hsize_t)(TEST_BLOCK_SIZE50));
+ was_extended = H5MF_try_extend(f, H5AC_ind_read_dxpl_id, type, (haddr_t)new_addr, (hsize_t)10, (hsize_t)(TBLOCK_SIZE50));
if(!was_extended)
TEST_ERROR
H5MF_aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size);
- if (new_ma_addr != (addr+TEST_BLOCK_SIZE50))
+ if(new_ma_addr != (addr+TBLOCK_SIZE50))
TEST_ERROR
- if (new_ma_size != (f->shared->meta_aggr.alloc_size-TEST_BLOCK_SIZE50))
+ if(new_ma_size != (f->shared->meta_aggr.alloc_size-TBLOCK_SIZE50))
TEST_ERROR
/* Restore info for meta_aggr */
f->shared->meta_aggr.addr = ma_addr;
f->shared->meta_aggr.size = ma_size;
- H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr, (hsize_t)TEST_BLOCK_SIZE30);
- H5MF_xfree(f, stype, H5AC_ind_read_dxpl_id, saddr, (hsize_t)TEST_BLOCK_SIZE50);
+ H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr, (hsize_t)TBLOCK_SIZE30);
+ H5MF_xfree(f, stype, H5AC_ind_read_dxpl_id, saddr, (hsize_t)TBLOCK_SIZE50);
if(H5Fclose(file) < 0)
FAIL_STACK_ERROR
@@ -3411,7 +3375,7 @@ test_mf_aggr_extend(const char *env_h5_drvr, hid_t fapl)
TEST_ERROR
/* Verify the file is the correct size */
- if (file_size != empty_size)
+ if(file_size != empty_size)
TEST_ERROR
PASSED()
@@ -3435,16 +3399,16 @@ test_mf_aggr_extend(const char *env_h5_drvr, hid_t fapl)
/* Allocate first block from meta_aggr */
type = H5FD_MEM_SUPER;
- addr = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE30);
+ addr = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE30);
H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- if ((addr+TEST_BLOCK_SIZE30) != ma_addr)
+ if ((addr+TBLOCK_SIZE30) != ma_addr)
TEST_ERROR
/* Allocate first block from sdata_aggr */
stype = H5FD_MEM_DRAW;
- saddr = H5MF_alloc(f, stype, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE50);
+ saddr = H5MF_alloc(f, stype, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE50);
H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size);
- if ((saddr+TEST_BLOCK_SIZE50) != sdata_addr)
+ if((saddr+TBLOCK_SIZE50) != sdata_addr)
TEST_ERROR
/* Adjust meta_aggr's info info for testing */
@@ -3454,7 +3418,7 @@ test_mf_aggr_extend(const char *env_h5_drvr, hid_t fapl)
new_addr = addr - 10;
/* unable to fulfill request from the aggreqator itself */
- was_extended = H5MF_try_extend(f, H5AC_ind_read_dxpl_id, type, (haddr_t)new_addr, (hsize_t)10, (hsize_t)(TEST_BLOCK_SIZE50));
+ was_extended = H5MF_try_extend(f, H5AC_ind_read_dxpl_id, type, (haddr_t)new_addr, (hsize_t)10, (hsize_t)(TBLOCK_SIZE50));
if(was_extended)
TEST_ERROR
@@ -3468,8 +3432,8 @@ test_mf_aggr_extend(const char *env_h5_drvr, hid_t fapl)
f->shared->meta_aggr.addr = ma_addr;
f->shared->meta_aggr.size = ma_size;
- H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr, (hsize_t)TEST_BLOCK_SIZE30);
- H5MF_xfree(f, stype, H5AC_ind_read_dxpl_id, saddr, (hsize_t)TEST_BLOCK_SIZE50);
+ H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr, (hsize_t)TBLOCK_SIZE30);
+ H5MF_xfree(f, stype, H5AC_ind_read_dxpl_id, saddr, (hsize_t)TBLOCK_SIZE50);
if(H5Fclose(file) < 0)
FAIL_STACK_ERROR
@@ -3479,7 +3443,7 @@ test_mf_aggr_extend(const char *env_h5_drvr, hid_t fapl)
TEST_ERROR
/* Verify the file is the correct size */
- if (file_size != empty_size)
+ if(file_size != empty_size)
TEST_ERROR
PASSED()
@@ -3499,6 +3463,7 @@ error:
} /* test_mf_aggr_extend() */
/*
+ *-------------------------------------------------------------------------
* To verify that a block is absorbed into an aggregator
*
* MF_try_shrink() only allows blocks to be absorbed into an aggregator
@@ -3517,10 +3482,7 @@ error:
* H5MF_alloc() block C from meta_aggr
* H5MF_try_shrink() block B should fail since it does not adjoin the
* beginning nor the end of meta_aggr
- *
- * Modifications:
- * Vailin Choi; July 2012
- * Changes due to the switch to H5FD_FLMAP_DICHOTOMY
+ *-------------------------------------------------------------------------
*/
static unsigned
test_mf_aggr_absorb(const char *env_h5_drvr, hid_t fapl)
@@ -3567,20 +3529,20 @@ test_mf_aggr_absorb(const char *env_h5_drvr, hid_t fapl)
/* Allocate block A from meta_aggr */
type = H5FD_MEM_SUPER;
- addr1 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE30);
+ addr1 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE30);
H5MF_aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size);
- ma_addr = new_ma_addr - TEST_BLOCK_SIZE30;
+ ma_addr = new_ma_addr - TBLOCK_SIZE30;
- if((addr1 + TEST_BLOCK_SIZE30) != new_ma_addr)
+ if((addr1 + TBLOCK_SIZE30) != new_ma_addr)
TEST_ERROR
/* should succeed */
- if(H5MF_try_shrink(f, type, H5AC_ind_read_dxpl_id, addr1, (hsize_t)TEST_BLOCK_SIZE30) <= 0)
+ if(H5MF_try_shrink(f, type, H5AC_ind_read_dxpl_id, addr1, (hsize_t)TBLOCK_SIZE30) <= 0)
TEST_ERROR
H5MF_aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size);
- if (new_ma_addr != ma_addr) TEST_ERROR
+ if(new_ma_addr != ma_addr) TEST_ERROR
if(H5Fclose(file) < 0)
FAIL_STACK_ERROR
@@ -3590,7 +3552,7 @@ test_mf_aggr_absorb(const char *env_h5_drvr, hid_t fapl)
TEST_ERROR
/* Verify the file is the correct size */
- if (file_size != empty_size)
+ if(file_size != empty_size)
TEST_ERROR
PASSED()
@@ -3614,32 +3576,32 @@ test_mf_aggr_absorb(const char *env_h5_drvr, hid_t fapl)
/* Allocate block A from meta_aggr */
type = H5FD_MEM_SUPER;
- addr1 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE30);
+ addr1 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE30);
H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- if ((addr1+TEST_BLOCK_SIZE30) != ma_addr) TEST_ERROR
- if (ma_size != (TEST_BLOCK_SIZE2048 - TEST_BLOCK_SIZE30)) TEST_ERROR
+ if((addr1+TBLOCK_SIZE30) != ma_addr) TEST_ERROR
+ if(ma_size != (TBLOCK_SIZE2048 - TBLOCK_SIZE30)) TEST_ERROR
/* Allocate block B from sdata_aggr */
stype = H5FD_MEM_DRAW;
- saddr1 = H5MF_alloc(f, stype, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE50);
+ saddr1 = H5MF_alloc(f, stype, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE50);
H5MF_aggr_query(f, &(f->shared->sdata_aggr), NULL, &sdata_size);
/* should succeed */
- if(H5MF_try_shrink(f, stype, H5AC_ind_read_dxpl_id, saddr1, (hsize_t)TEST_BLOCK_SIZE50) <= 0)
+ if(H5MF_try_shrink(f, stype, H5AC_ind_read_dxpl_id, saddr1, (hsize_t)TBLOCK_SIZE50) <= 0)
TEST_ERROR
H5MF_aggr_query(f, &(f->shared->sdata_aggr), &new_sdata_addr, &new_sdata_size);
- if (new_sdata_addr != saddr1) TEST_ERROR
- if (new_sdata_size != sdata_size + TEST_BLOCK_SIZE50) TEST_ERROR
+ if(new_sdata_addr != saddr1) TEST_ERROR
+ if(new_sdata_size != sdata_size + TBLOCK_SIZE50) TEST_ERROR
/* meta_aggr info should be updated because the block is absorbed into the meta_aggr */
H5MF_aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size);
if (new_ma_addr != ma_addr) TEST_ERROR
if (new_ma_size != (ma_size)) TEST_ERROR
- H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr1, (hsize_t)TEST_BLOCK_SIZE30);
+ H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr1, (hsize_t)TBLOCK_SIZE30);
if(H5Fclose(file) < 0)
FAIL_STACK_ERROR
@@ -3649,7 +3611,7 @@ test_mf_aggr_absorb(const char *env_h5_drvr, hid_t fapl)
TEST_ERROR
/* Verify the file is the correct size */
- if (file_size != empty_size)
+ if(file_size != empty_size)
TEST_ERROR
PASSED()
@@ -3673,35 +3635,35 @@ test_mf_aggr_absorb(const char *env_h5_drvr, hid_t fapl)
/* Allocate block A from meta_aggr */
type = H5FD_MEM_SUPER;
- addr1 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE30);
+ addr1 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE30);
H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- if ((addr1+TEST_BLOCK_SIZE30) != ma_addr)
+ if((addr1+TBLOCK_SIZE30) != ma_addr)
TEST_ERROR
/* Allocate block B from meta_aggr */
- addr2 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE50);
+ addr2 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE50);
H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- if ((addr2+TEST_BLOCK_SIZE50) != ma_addr)
+ if((addr2+TBLOCK_SIZE50) != ma_addr)
TEST_ERROR
/* Allocate block C from meta_aggr */
- addr3 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)(TEST_BLOCK_SIZE30+TEST_BLOCK_SIZE50));
+ addr3 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)(TBLOCK_SIZE30+TBLOCK_SIZE50));
H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- if ((addr3+TEST_BLOCK_SIZE30+TEST_BLOCK_SIZE50) != ma_addr)
+ if((addr3+TBLOCK_SIZE30+TBLOCK_SIZE50) != ma_addr)
TEST_ERROR
/* should not succeed */
- if(H5MF_try_shrink(f, type, H5AC_ind_read_dxpl_id, addr2, (hsize_t)TEST_BLOCK_SIZE50) > 0)
+ if(H5MF_try_shrink(f, type, H5AC_ind_read_dxpl_id, addr2, (hsize_t)TBLOCK_SIZE50) > 0)
TEST_ERROR
/* aggregator info should be the same as before */
H5MF_aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size);
- if (new_ma_addr != ma_addr) TEST_ERROR
+ if(new_ma_addr != ma_addr) TEST_ERROR
- H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr1, (hsize_t)TEST_BLOCK_SIZE30);
- H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr2, (hsize_t)TEST_BLOCK_SIZE50);
- H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr3, (hsize_t)(TEST_BLOCK_SIZE30+TEST_BLOCK_SIZE50));
+ H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr1, (hsize_t)TBLOCK_SIZE30);
+ H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr2, (hsize_t)TBLOCK_SIZE50);
+ H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr3, (hsize_t)(TBLOCK_SIZE30+TBLOCK_SIZE50));
if(H5Fclose(file) < 0)
FAIL_STACK_ERROR
@@ -3711,7 +3673,7 @@ test_mf_aggr_absorb(const char *env_h5_drvr, hid_t fapl)
TEST_ERROR
/* Verify the file is the correct size */
- if (file_size != empty_size)
+ if(file_size != empty_size)
TEST_ERROR
PASSED()
@@ -3731,6 +3693,7 @@ error:
} /* test_mf_aggr_absorb() */
/*
+ *-------------------------------------------------------------------------
* To verify that a block allocated from file allocation is aligned, can be shrunk and extended
*
* Alignment = 1024 or 4096
@@ -3759,6 +3722,7 @@ error:
* Allocate a block which should be from file allocation
* The return address should be aligned
* H5MF_try_extend() the block with aligned address should succeed
+ *-------------------------------------------------------------------------
*/
static unsigned
test_mf_align_eoa(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
@@ -3773,7 +3737,7 @@ test_mf_align_eoa(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
haddr_t ma_addr=HADDR_UNDEF;
hsize_t ma_size=0;
htri_t was_extended;
- frspace_state_t state;
+ H5FS_stat_t state;
hsize_t alignment=0, mis_align=0, tmp=0, accum=0;
hbool_t have_alloc_vfd; /* Whether VFD used has an 'alloc' callback */
@@ -3819,23 +3783,23 @@ test_mf_align_eoa(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
FAIL_STACK_ERROR
/* calculate fragment for alignment of block 30 */
- if ((tmp = (hsize_t)file_size % alignment))
+ if((tmp = (hsize_t)file_size % alignment))
mis_align = alignment - tmp;
- accum = mis_align + TEST_BLOCK_SIZE30;
+ accum = mis_align + TBLOCK_SIZE30;
/* Allocate a block of 30 from file allocation */
type = H5FD_MEM_SUPER;
- addr1 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE30);
+ addr1 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE30);
/* Verify that the allocated block is aligned */
- if (addr1 % alignment) TEST_ERROR
+ if(addr1 % alignment) TEST_ERROR
/* there should be nothing in the aggregator */
H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- if (ma_addr || ma_size) TEST_ERROR
+ if(ma_addr || ma_size) TEST_ERROR
- HDmemset(&state, 0, sizeof(frspace_state_t));
+ HDmemset(&state, 0, sizeof(H5FS_stat_t));
if (mis_align) {
state.tot_space += mis_align;
state.tot_sect_count += 1;
@@ -3848,18 +3812,18 @@ test_mf_align_eoa(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
mis_align = 0;
if ((tmp = ((hsize_t)file_size + accum) % alignment))
mis_align = alignment - tmp;
- accum += (mis_align + TEST_BLOCK_SIZE50);
+ accum += (mis_align + TBLOCK_SIZE50);
- addr2 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE50);
+ addr2 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE50);
/* Verify that the allocated block is aligned */
if (addr2 % alignment) TEST_ERROR
/* there should be nothing in the aggregator */
H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- if (ma_addr || ma_size) TEST_ERROR
+ if(ma_addr || ma_size) TEST_ERROR
- if (mis_align) {
+ if(mis_align) {
state.tot_space += mis_align;
state.tot_sect_count += 1;
state.serial_sect_count += 1;
@@ -3867,8 +3831,8 @@ test_mf_align_eoa(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
TEST_ERROR
}
- H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr1, (hsize_t)TEST_BLOCK_SIZE30);
- H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr2, (hsize_t)TEST_BLOCK_SIZE50);
+ H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr1, (hsize_t)TBLOCK_SIZE30);
+ H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr2, (hsize_t)TBLOCK_SIZE50);
if(H5Fclose(file) < 0)
FAIL_STACK_ERROR
@@ -3902,7 +3866,7 @@ test_mf_align_eoa(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
/* allocate a block of 50 from meta_aggr */
type = H5FD_MEM_SUPER;
- addr1 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE50);
+ addr1 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE50);
/* address should be aligned */
if (addr1 % alignment) TEST_ERROR
@@ -3923,7 +3887,7 @@ test_mf_align_eoa(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
FAIL_STACK_ERROR
/* shrink the block */
- if(H5MF_try_shrink(f, type, H5AC_ind_read_dxpl_id, addr1, (hsize_t)TEST_BLOCK_SIZE50) <= 0)
+ if(H5MF_try_shrink(f, type, H5AC_ind_read_dxpl_id, addr1, (hsize_t)TBLOCK_SIZE50) <= 0)
TEST_ERROR
if(H5Fclose(file) < 0)
@@ -3932,7 +3896,7 @@ test_mf_align_eoa(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
if((new_file_size = h5_get_file_size(filename, fapl1)) < 0)
TEST_ERROR
- if (new_file_size != (file_size-TEST_BLOCK_SIZE50)) TEST_ERROR
+ if (new_file_size != (file_size-TBLOCK_SIZE50)) TEST_ERROR
PASSED()
} /* end if */
@@ -3957,10 +3921,10 @@ test_mf_align_eoa(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
/* allocate a block of 50 */
type = H5FD_MEM_SUPER;
- addr1 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE50);
+ addr1 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE50);
/* address should be aligned */
- if (addr1 % alignment) TEST_ERROR
+ if(addr1 % alignment) TEST_ERROR
/* Close file */
if(H5Fclose(file) < 0)
@@ -3978,9 +3942,9 @@ test_mf_align_eoa(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
FAIL_STACK_ERROR
/* try to extend the block */
- was_extended = H5MF_try_extend(f, H5AC_ind_read_dxpl_id, type, (haddr_t)addr1, (hsize_t)TEST_BLOCK_SIZE50, (hsize_t)TEST_BLOCK_SIZE30);
+ was_extended = H5MF_try_extend(f, H5AC_ind_read_dxpl_id, type, (haddr_t)addr1, (hsize_t)TBLOCK_SIZE50, (hsize_t)TBLOCK_SIZE30);
- if (was_extended <=0) TEST_ERROR
+ if(was_extended <=0) TEST_ERROR
if(H5Fclose(file) < 0)
FAIL_STACK_ERROR
@@ -3988,7 +3952,7 @@ test_mf_align_eoa(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
if((new_file_size = h5_get_file_size(filename, fapl1)) < 0)
TEST_ERROR
- if (new_file_size != (file_size+TEST_BLOCK_SIZE30)) TEST_ERROR
+ if (new_file_size != (file_size+TBLOCK_SIZE30)) TEST_ERROR
PASSED()
} /* end if */
@@ -4007,6 +3971,7 @@ error:
} /* test_mf_align_eoa() */
/*
+ *-------------------------------------------------------------------------
* To verify that a block allocated from the free-space manager is aligned
*
* Alignment = 1024 or 4096
@@ -4035,10 +4000,7 @@ error:
* Allocate a block of size=40
* The free-space manager is unable to fulfill the request
* The block is allocated from file allocation and should be aligned
- *
- * Modifications:
- * Vailin Choi; July 2012
- * Initialize the new field "allow_eoa_shrink_only" for user data.
+ *-------------------------------------------------------------------------
*/
static unsigned
test_mf_align_fs(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
@@ -4047,12 +4009,10 @@ test_mf_align_fs(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
char filename[FILENAME_LEN]; /* Filename to use */
h5_stat_size_t file_size;
H5F_t *f = NULL; /* Internal file object pointer */
- H5FD_mem_t type;
H5MF_free_section_t *sect_node = NULL;
haddr_t addr;
- frspace_state_t state;
- H5MF_sect_ud_t udata;
- htri_t was_extended;
+ H5FS_stat_t state;
+ htri_t was_extended;
hsize_t alignment=0, tmp=0, mis_align=0;
hbool_t have_alloc_vfd; /* Whether VFD used has an 'alloc' callback */
@@ -4081,58 +4041,51 @@ test_mf_align_fs(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
if(NULL == (f = (H5F_t *)H5I_object(file)))
FAIL_STACK_ERROR
- type = H5FD_MEM_SUPER;
-
- if(H5MF__alloc_start(f, H5AC_ind_read_dxpl_id, 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)
- TEST_ERROR
+ /* Start up H5FD_MEM_SUPER free-space manager */
+ if(H5MF_start_fstype(f, H5AC_ind_read_dxpl_id, (H5F_mem_page_t)H5FD_MEM_SUPER) < 0)
+ FAIL_STACK_ERROR
- sect_node = H5MF_sect_simple_new((haddr_t)alignment, (hsize_t)TEST_BLOCK_SIZE50);
+ if(f->shared->fs_state[H5FD_MEM_SUPER] != H5F_FS_STATE_OPEN)
+ TEST_ERROR
+ if(f->shared->fs_man[H5FD_MEM_SUPER]->client != H5FS_CLIENT_FILE_ID)
+ TEST_ERROR
- /* Construct user data for callbacks */
- udata.f = f;
- udata.dxpl_id = H5AC_ind_read_dxpl_id;
- udata.alloc_type = type;
- udata.allow_sect_absorb = TRUE;
- udata.allow_eoa_shrink_only = FALSE;
+ /* Create section A */
+ sect_node = H5MF_sect_new(H5MF_FSPACE_SECT_SIMPLE, (haddr_t)alignment, (hsize_t)TBLOCK_SIZE50);
/* Add section A to free-space manager */
- if (H5FS_sect_add(f, H5AC_ind_read_dxpl_id, f->shared->fs_man[type], (H5FS_section_info_t *)sect_node, H5FS_ADD_RETURNED_SPACE, &udata))
- FAIL_STACK_ERROR
+ if(H5MF_add_sect(f, H5FD_MEM_SUPER, H5AC_ind_read_dxpl_id, f->shared->fs_man[H5FD_MEM_SUPER], sect_node))
+ FAIL_STACK_ERROR
- HDmemset(&state, 0, sizeof(frspace_state_t));
- state.tot_space += TEST_BLOCK_SIZE50;
+ HDmemset(&state, 0, sizeof(H5FS_stat_t));
+ state.tot_space += TBLOCK_SIZE50;
state.tot_sect_count += 1;
state.serial_sect_count += 1;
- if(check_stats(f, f->shared->fs_man[type], &state))
+ if(check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
TEST_ERROR
/* Allocate a block of 50 */
- addr = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE50);
+ addr = H5MF_alloc(f, H5FD_MEM_SUPER, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE50);
/* Verify that the allocated block is section A in free-space */
- if (addr != (haddr_t)alignment) TEST_ERROR
- if (addr % alignment) TEST_ERROR
+ if(addr != (haddr_t)alignment) TEST_ERROR
+ if(addr % alignment) TEST_ERROR
- state.tot_space -= TEST_BLOCK_SIZE50;
+ state.tot_space -= TBLOCK_SIZE50;
state.tot_sect_count -= 1;
state.serial_sect_count -= 1;
- if(check_stats(f, f->shared->fs_man[type], &state))
+ if(check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
TEST_ERROR
/* Free the block to free-space */
- H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr, (hsize_t)TEST_BLOCK_SIZE50);
+ H5MF_xfree(f, H5FD_MEM_SUPER, H5AC_ind_read_dxpl_id, addr, (hsize_t)TBLOCK_SIZE50);
- state.tot_space += TEST_BLOCK_SIZE50;
+ state.tot_space += TBLOCK_SIZE50;
state.tot_sect_count += 1;
state.serial_sect_count += 1;
- if(check_stats(f, f->shared->fs_man[type], &state))
+ if(check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
TEST_ERROR
if(H5Fclose(file) < 0)
@@ -4151,70 +4104,63 @@ test_mf_align_fs(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
if(NULL == (f = (H5F_t *)H5I_object(file)))
FAIL_STACK_ERROR
- type = H5FD_MEM_SUPER;
+ /* Start up H5FD_MEM_SUPER free-space manager */
+ if(H5MF_start_fstype(f, H5AC_ind_read_dxpl_id, (H5F_mem_page_t)H5FD_MEM_SUPER) < 0)
+ FAIL_STACK_ERROR
- if(H5MF__alloc_start(f, H5AC_ind_read_dxpl_id, type) < 0)
+ if(f->shared->fs_state[H5FD_MEM_SUPER] != H5F_FS_STATE_OPEN)
+ TEST_ERROR
+ if(f->shared->fs_man[H5FD_MEM_SUPER]->client != H5FS_CLIENT_FILE_ID)
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)
- TEST_ERROR
-
- sect_node = H5MF_sect_simple_new((haddr_t)TEST_BLOCK_ADDR70, (hsize_t)TEST_BLOCK_SIZE8000);
-
- /* Construct user data for callbacks */
- udata.f = f;
- udata.dxpl_id = H5AC_ind_read_dxpl_id;
- udata.alloc_type = type;
- udata.allow_sect_absorb = TRUE;
- udata.allow_eoa_shrink_only = FALSE;
+ /* Create section A */
+ sect_node = H5MF_sect_new(H5MF_FSPACE_SECT_SIMPLE, (haddr_t)TBLOCK_ADDR70, (hsize_t)TBLOCK_SIZE8000);
/* Add section A to free-space manager */
- if (H5FS_sect_add(f, H5AC_ind_read_dxpl_id, f->shared->fs_man[type], (H5FS_section_info_t *)sect_node, H5FS_ADD_RETURNED_SPACE, &udata))
- FAIL_STACK_ERROR
+ if(H5MF_add_sect(f, H5FD_MEM_SUPER, H5AC_ind_read_dxpl_id, f->shared->fs_man[H5FD_MEM_SUPER], sect_node))
+ FAIL_STACK_ERROR
- HDmemset(&state, 0, sizeof(frspace_state_t));
- state.tot_space += TEST_BLOCK_SIZE8000;
+ HDmemset(&state, 0, sizeof(H5FS_stat_t));
+ state.tot_space += TBLOCK_SIZE8000;
state.tot_sect_count += 1;
state.serial_sect_count += 1;
- if(check_stats(f, f->shared->fs_man[type], &state))
+ if(check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
TEST_ERROR
/* Allocate a block of 600 */
- addr = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE600);
+ addr = H5MF_alloc(f, H5FD_MEM_SUPER, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE600);
/* Verify that the allocated block is aligned */
if (addr % alignment) TEST_ERROR
/* should have 1 more section in free-space */
- state.tot_space -= TEST_BLOCK_SIZE600;
+ state.tot_space -= TBLOCK_SIZE600;
state.tot_sect_count += 1;
state.serial_sect_count += 1;
- if(check_stats(f, f->shared->fs_man[type], &state))
+ if(check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
TEST_ERROR
/* try to extend the block */
- was_extended = H5MF_try_extend(f, H5AC_ind_read_dxpl_id, type, (haddr_t)addr, (hsize_t)TEST_BLOCK_SIZE600, (hsize_t)TEST_BLOCK_SIZE200);
+ was_extended = H5MF_try_extend(f, H5AC_ind_read_dxpl_id, H5FD_MEM_SUPER, (haddr_t)addr, (hsize_t)TBLOCK_SIZE600, (hsize_t)TBLOCK_SIZE200);
- if (was_extended <=0) TEST_ERROR
+ if(was_extended <=0) TEST_ERROR
/* space should be decreased by 200, # of sections remain the same */
- state.tot_space -= TEST_BLOCK_SIZE200;
+ state.tot_space -= TBLOCK_SIZE200;
- if(check_stats(f, f->shared->fs_man[type], &state))
+ if(check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
TEST_ERROR
/* Free the block to free-space manager */
- H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr, (hsize_t)(TEST_BLOCK_SIZE600+TEST_BLOCK_SIZE200));
+ H5MF_xfree(f, H5FD_MEM_SUPER, H5AC_ind_read_dxpl_id, addr, (hsize_t)(TBLOCK_SIZE600+TBLOCK_SIZE200));
/* only 1 section in free-space because of merging */
- state.tot_space += (TEST_BLOCK_SIZE600+TEST_BLOCK_SIZE200);
+ state.tot_space += (TBLOCK_SIZE600+TBLOCK_SIZE200);
state.tot_sect_count = 1;
state.serial_sect_count = 1;
- if(check_stats(f, f->shared->fs_man[type], &state))
+ if(check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
TEST_ERROR
if(H5Fclose(file) < 0)
@@ -4241,45 +4187,38 @@ test_mf_align_fs(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
if(NULL == (f = (H5F_t *)H5I_object(file)))
FAIL_STACK_ERROR
- type = H5FD_MEM_SUPER;
-
- if(H5MF__alloc_start(f, H5AC_ind_read_dxpl_id, type) < 0)
- TEST_ERROR
+ /* Start up H5FD_MEM_SUPER free-space manager */
+ if(H5MF_start_fstype(f, H5AC_ind_read_dxpl_id, (H5F_mem_page_t)H5FD_MEM_SUPER) < 0)
+ FAIL_STACK_ERROR
- if (f->shared->fs_state[type] != H5F_FS_STATE_OPEN)
+ if(f->shared->fs_state[H5FD_MEM_SUPER] != H5F_FS_STATE_OPEN)
TEST_ERROR
- if (f->shared->fs_man[type]->client != H5FS_CLIENT_FILE_ID)
+ if(f->shared->fs_man[H5FD_MEM_SUPER]->client != H5FS_CLIENT_FILE_ID)
TEST_ERROR
- sect_node = H5MF_sect_simple_new((haddr_t)TEST_BLOCK_ADDR70, (hsize_t)TEST_BLOCK_SIZE700);
-
- /* Construct user data for callbacks */
- udata.f = f;
- udata.dxpl_id = H5AC_ind_read_dxpl_id;
- udata.alloc_type = type;
- udata.allow_sect_absorb = TRUE;
- udata.allow_eoa_shrink_only = FALSE;
+ /* Create section A */
+ sect_node = H5MF_sect_new(H5MF_FSPACE_SECT_SIMPLE, (haddr_t)TBLOCK_ADDR70, (hsize_t)TBLOCK_SIZE700);
/* Add section A to free-space manager */
- if (H5FS_sect_add(f, H5AC_ind_read_dxpl_id, f->shared->fs_man[type], (H5FS_section_info_t *)sect_node, H5FS_ADD_RETURNED_SPACE, &udata))
- FAIL_STACK_ERROR
+ if(H5MF_add_sect(f, H5FD_MEM_SUPER, H5AC_ind_read_dxpl_id, f->shared->fs_man[H5FD_MEM_SUPER], sect_node))
+ FAIL_STACK_ERROR
- HDmemset(&state, 0, sizeof(frspace_state_t));
- state.tot_space += TEST_BLOCK_SIZE700;
+ HDmemset(&state, 0, sizeof(H5FS_stat_t));
+ state.tot_space += TBLOCK_SIZE700;
state.tot_sect_count += 1;
state.serial_sect_count += 1;
- if(check_stats(f, f->shared->fs_man[type], &state))
+ if(check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
TEST_ERROR
/*
* Allocate a block of 40
* Since free-space manager cannot fulfull the request because of alignment,
* the block is obtained from file allocation
*/
- addr = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)(TEST_BLOCK_SIZE40));
+ addr = H5MF_alloc(f, H5FD_MEM_SUPER, H5AC_ind_read_dxpl_id, (hsize_t)(TBLOCK_SIZE40));
/* Verify that the allocated block is aligned */
- if (addr % alignment)
+ if(addr % alignment)
TEST_ERROR
/* verify that the allocated block is from file allocation, not section A in free-space */
@@ -4296,7 +4235,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, f->shared->fs_man[type], &state))
+ if(check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
TEST_ERROR
if(H5Fclose(file) < 0)
@@ -4319,6 +4258,7 @@ error:
} /* test_mf_align_fs() */
/*
+ *-------------------------------------------------------------------------
* To verify that blocks allocated from the aggregator are aligned
*
* Alignment = 1024 aggr->alloc_size = 2048
@@ -4413,6 +4353,7 @@ error:
* Fragment from alignment of aggregator allocation is freed to free-space:[12368, 4016]
* There is space of 2018 left in meta_aggr
* EOA is at 20372
+ *-------------------------------------------------------------------------
*/
static unsigned
test_mf_align_alloc1(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
@@ -4424,7 +4365,7 @@ test_mf_align_alloc1(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
H5FD_mem_t type;
haddr_t addr1, addr2, addr3, addr4;
- frspace_state_t state;
+ H5FS_stat_t state;
haddr_t ma_addr=HADDR_UNDEF;
hsize_t ma_size=0, mis_align=0;
hsize_t alignment=0, tmp=0;
@@ -4467,19 +4408,19 @@ test_mf_align_alloc1(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
FAIL_STACK_ERROR
/* calculate fragment for alignment of block 30 */
- if ((tmp = (hsize_t)file_size % alignment))
+ if((tmp = (hsize_t)file_size % alignment))
mis_align = alignment - tmp;
/* Allocate a block of 30 from meta_aggr */
type = H5FD_MEM_SUPER;
- addr1 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE30);
+ addr1 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE30);
/* Verify that the allocated block is aligned */
- if (addr1 % alignment) TEST_ERROR
+ if(addr1 % alignment) TEST_ERROR
/* fragment for alignment of block 30 is freed to free-space */
- HDmemset(&state, 0, sizeof(frspace_state_t));
- if (mis_align) {
+ HDmemset(&state, 0, sizeof(H5FS_stat_t));
+ if(mis_align) {
state.tot_space += mis_align;
state.tot_sect_count += 1;
state.serial_sect_count += 1;
@@ -4487,22 +4428,22 @@ test_mf_align_alloc1(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- if ((addr1 + TEST_BLOCK_SIZE30) != ma_addr)
+ if ((addr1 + TBLOCK_SIZE30) != ma_addr)
TEST_ERROR
/* calculate fragment for alignment of block 50 */
mis_align = 0;
- if ((tmp = ma_addr % alignment))
+ if((tmp = ma_addr % alignment))
mis_align = alignment - tmp;
/* Allocate a block of 50 from meta_aggr */
- addr2 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE50);
+ addr2 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE50);
/* Verify that the allocated block is aligned */
- if (addr2 % alignment) TEST_ERROR
+ if(addr2 % alignment) TEST_ERROR
/* fragment for alignment of block 50 is freed to free-space */
- if (mis_align) {
+ if(mis_align) {
state.tot_space += mis_align;
state.tot_sect_count += 1;
state.serial_sect_count += 1;
@@ -4510,7 +4451,7 @@ test_mf_align_alloc1(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- if ((addr2 + TEST_BLOCK_SIZE50) != ma_addr)
+ if((addr2 + TBLOCK_SIZE50) != ma_addr)
TEST_ERROR
/* calculate fragment for alignment of block 80 */
@@ -4518,13 +4459,13 @@ test_mf_align_alloc1(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
if ((tmp = ma_addr % alignment))
mis_align = alignment - tmp;
- addr3 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE80);
+ addr3 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE80);
/* Verify that the allocated block is aligned */
- if (addr3 % alignment) TEST_ERROR
+ if(addr3 % alignment) TEST_ERROR
/* fragment for alignment of block 80 is freed to free-space */
- if (mis_align) {
+ if(mis_align) {
state.tot_space += mis_align;
state.tot_sect_count += 1;
state.serial_sect_count += 1;
@@ -4532,22 +4473,22 @@ test_mf_align_alloc1(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- if ((addr3 + TEST_BLOCK_SIZE80) != ma_addr)
+ if((addr3 + TBLOCK_SIZE80) != ma_addr)
TEST_ERROR
/* calculate fragment for alignment of block 1970 */
mis_align = 0;
- if ((tmp = ma_addr % alignment))
+ if((tmp = ma_addr % alignment))
mis_align = alignment - tmp;
/* Allocate a block of 1970 from meta_aggr */
- addr4 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE1970);
+ addr4 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE1970);
/* Verify that the allocated block is aligned */
- if (addr4 % alignment) TEST_ERROR
+ if(addr4 % alignment) TEST_ERROR
/* fragment for alignment of block 1970 is freed to free-space */
- if (mis_align) {
+ if(mis_align) {
state.tot_space += mis_align;
state.tot_sect_count += 1;
state.serial_sect_count += 1;
@@ -4555,17 +4496,17 @@ test_mf_align_alloc1(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- if ((addr4 + TEST_BLOCK_SIZE1970) != ma_addr)
+ if((addr4 + TBLOCK_SIZE1970) != ma_addr)
TEST_ERROR
/* Verify total size of free space after all the allocations */
if(check_stats(f, f->shared->fs_man[type], &state))
TEST_ERROR
- H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr1, (hsize_t)TEST_BLOCK_SIZE30);
- H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr2, (hsize_t)TEST_BLOCK_SIZE50);
- H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr3, (hsize_t)TEST_BLOCK_SIZE80);
- H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr3, (hsize_t)TEST_BLOCK_SIZE1970);
+ H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr1, (hsize_t)TBLOCK_SIZE30);
+ H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr2, (hsize_t)TBLOCK_SIZE50);
+ H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr3, (hsize_t)TBLOCK_SIZE80);
+ H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr3, (hsize_t)TBLOCK_SIZE1970);
if(H5Fclose(file) < 0)
FAIL_STACK_ERROR
@@ -4587,6 +4528,7 @@ error:
} /* test_mf_align_alloc1() */
/*
+ *-------------------------------------------------------------------------
* To verify that blocks allocated from the aggregator are aligned
*
* Alignment = 1024 aggr->alloc_size = 2048
@@ -4669,10 +4611,7 @@ error:
* The third block of 80 is allocated from the aggregator and should be aligned
* There is space of 1968 left in meta_aggr
* EOA is at 18432
- *
- * Modifications:
- * Vailin Choi; July 2012
- * Changes due to the switch to H5FD_FLMAP_DICHOTOMY
+ *-------------------------------------------------------------------------
*/
static unsigned
test_mf_align_alloc2(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
@@ -4683,7 +4622,7 @@ test_mf_align_alloc2(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
h5_stat_size_t file_size; /* File size */
H5FD_mem_t type, stype;
haddr_t addr1, addr2, addr3, saddr1;
- frspace_state_t state[H5FD_MEM_NTYPES];
+ H5FS_stat_t state[H5FD_MEM_NTYPES];
haddr_t ma_addr=HADDR_UNDEF, sdata_addr=HADDR_UNDEF;
hsize_t ma_size=0, sdata_size=0, mis_align=0;
hsize_t alignment=0, tmp=0;
@@ -4725,19 +4664,19 @@ test_mf_align_alloc2(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
FAIL_STACK_ERROR
/* calculate fragment for alignment of block 30 */
- if ((tmp = (hsize_t)file_size % alignment))
+ if((tmp = (hsize_t)file_size % alignment))
mis_align = alignment - tmp;
/* Allocate a block of 30 from meta_aggr */
type = H5FD_MEM_SUPER;
- addr1 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE30);
+ addr1 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE30);
/* Verify that the allocated block is aligned */
- if (addr1 % alignment) TEST_ERROR
+ if(addr1 % alignment) TEST_ERROR
/* fragment for alignment of block 30 is freed to free-space */
- HDmemset(&state, 0, sizeof(frspace_state_t) * H5FD_MEM_NTYPES);
- if (mis_align) {
+ HDmemset(&state, 0, sizeof(H5FS_stat_t) * H5FD_MEM_NTYPES);
+ if(mis_align) {
state[type].tot_space += mis_align;
state[type].tot_sect_count += 1;
state[type].serial_sect_count += 1;
@@ -4745,21 +4684,21 @@ test_mf_align_alloc2(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- if ((addr1 + TEST_BLOCK_SIZE30) != ma_addr)
+ if((addr1 + TBLOCK_SIZE30) != ma_addr)
TEST_ERROR
/* fragment for alignment of block 50 is freed to free-space */
mis_align = 0;
- if ((tmp = ma_addr % alignment))
+ if((tmp = ma_addr % alignment))
mis_align = alignment - tmp;
- addr2 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE50);
+ addr2 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE50);
/* Verify that the allocated block is aligned */
- if (addr2 % alignment) TEST_ERROR
+ if(addr2 % alignment) TEST_ERROR
/* fragment for alignment of block 50 is freed to free-space */
- if (mis_align) {
+ if(mis_align) {
state[type].tot_space += mis_align;
state[type].tot_sect_count += 1;
state[type].serial_sect_count += 1;
@@ -4767,7 +4706,7 @@ test_mf_align_alloc2(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- if ((addr2 + TEST_BLOCK_SIZE50) != ma_addr)
+ if((addr2 + TBLOCK_SIZE50) != ma_addr)
TEST_ERROR
/*
@@ -4782,17 +4721,17 @@ test_mf_align_alloc2(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
* block 30 is allocated from ma_addr
*/
mis_align = 0;
- if ((alignment == TEST_ALIGN1024) && (tmp = ((ma_addr + ma_size) % alignment)))
+ if((alignment == TEST_ALIGN1024) && (tmp = ((ma_addr + ma_size) % alignment)))
mis_align = alignment - tmp;
else if ((alignment == TEST_ALIGN4096) && (tmp = (ma_addr % alignment)))
mis_align = alignment - tmp;
/* Allocate a block of 30 from sdata_aggr */
stype = H5FD_MEM_DRAW;
- saddr1 = H5MF_alloc(f, stype, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE30);
+ saddr1 = H5MF_alloc(f, stype, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE30);
/* fragment for alignment of block 30 for sdata_aggr is freed to free-space */
- if (mis_align) {
+ if(mis_align) {
state[stype].tot_space += mis_align;
state[stype].tot_sect_count += 1;
state[stype].serial_sect_count += 1;
@@ -4804,7 +4743,7 @@ test_mf_align_alloc2(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size);
H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- if (sdata_addr != (saddr1 + TEST_BLOCK_SIZE30)) TEST_ERROR
+ if(sdata_addr != (saddr1 + TBLOCK_SIZE30)) TEST_ERROR
/*
* Calculate fragment for the allocation of block 80 from meta_aggr:
@@ -4816,19 +4755,19 @@ test_mf_align_alloc2(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
* block 30 is allocated from ma_addr
*/
mis_align = 0;
- if ((alignment == TEST_ALIGN1024) && (tmp = (ma_addr % alignment)))
+ if((alignment == TEST_ALIGN1024) && (tmp = (ma_addr % alignment)))
mis_align = alignment - tmp;
else if ((alignment == TEST_ALIGN4096) && (tmp = ((sdata_addr + sdata_size) % alignment)))
mis_align = alignment - tmp;
/* Allocate a block of 80 from meta_aggr */
- addr3 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE80);
+ addr3 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE80);
/* Verify that the allocated block is aligned */
if (addr3 % alignment) TEST_ERROR
/* fragment for alignment of block 80 is freed to free-space */
- if (mis_align) {
+ if(mis_align) {
state[type].tot_space += mis_align;
state[type].tot_sect_count += 1;
state[type].serial_sect_count += 1;
@@ -4836,7 +4775,7 @@ test_mf_align_alloc2(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- if ((addr3 + TEST_BLOCK_SIZE80) != ma_addr)
+ if((addr3 + TBLOCK_SIZE80) != ma_addr)
TEST_ERROR
/* Verify total size of free space after all the allocations */
@@ -4850,10 +4789,10 @@ test_mf_align_alloc2(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
TEST_ERROR
}
- H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr1, (hsize_t)TEST_BLOCK_SIZE30);
- H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr2, (hsize_t)TEST_BLOCK_SIZE50);
- H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr3, (hsize_t)TEST_BLOCK_SIZE80);
- H5MF_xfree(f, stype, H5AC_ind_read_dxpl_id, saddr1, (hsize_t)TEST_BLOCK_SIZE30);
+ H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr1, (hsize_t)TBLOCK_SIZE30);
+ H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr2, (hsize_t)TBLOCK_SIZE50);
+ H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr3, (hsize_t)TBLOCK_SIZE80);
+ H5MF_xfree(f, stype, H5AC_ind_read_dxpl_id, saddr1, (hsize_t)TBLOCK_SIZE30);
if(H5Fclose(file) < 0)
FAIL_STACK_ERROR
@@ -4875,6 +4814,7 @@ error:
} /* test_mf_align_alloc2() */
/*
+ *-------------------------------------------------------------------------
* To verify that blocks allocated from the aggregator are aligned
*
* Alignment = 1024 aggr->alloc_size = 2048
@@ -5008,11 +4948,7 @@ error:
* The meta_aggr is updated to point to the new space
* The block of 1034 is allocated from the new block and should be aligned
* There is space of 1014 left in meta_aggr
- *
- * Modifications:
- * Vailin Choi; July 2012
- * Changes due to the switch to H5FD_FLMAP_DICHOTOMY
- *
+ *-------------------------------------------------------------------------
*/
static unsigned
test_mf_align_alloc3(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
@@ -5024,7 +4960,7 @@ test_mf_align_alloc3(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
H5FD_mem_t type, stype;
haddr_t addr1, addr2, addr3;
haddr_t saddr1, saddr2, saddr3;
- frspace_state_t state[H5FD_MEM_NTYPES];
+ H5FS_stat_t state[H5FD_MEM_NTYPES];
haddr_t ma_addr=HADDR_UNDEF, sdata_addr=HADDR_UNDEF;
hsize_t ma_size=0, sdata_size=0, mis_align=0;
hsize_t alignment=0, tmp=0;
@@ -5067,48 +5003,48 @@ test_mf_align_alloc3(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
FAIL_STACK_ERROR
/* calculate fragment for alignment of block 30 */
- if ((tmp = (hsize_t)file_size % alignment))
+ if((tmp = (hsize_t)file_size % alignment))
mis_align = alignment - tmp;
/* Allocate a block of 30 from meta_aggr */
type = H5FD_MEM_SUPER;
- addr1 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE30);
+ addr1 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE30);
/* Verify that the allocated block is aligned */
- if (addr1 % alignment) TEST_ERROR
+ if(addr1 % alignment) TEST_ERROR
/* fragment for alignment of block 30 is freed to free-space */
- HDmemset(&state, 0, sizeof(frspace_state_t) * H5FD_MEM_NTYPES);
- if (mis_align) {
+ HDmemset(&state, 0, sizeof(H5FS_stat_t) * H5FD_MEM_NTYPES);
+ if(mis_align) {
state[type].tot_space += mis_align;
state[type].tot_sect_count += 1;
state[type].serial_sect_count += 1;
}
H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- if ((addr1 + TEST_BLOCK_SIZE30) != ma_addr)
+ if ((addr1 + TBLOCK_SIZE30) != ma_addr)
TEST_ERROR
/* calculate fragment for alignment of block 50 */
mis_align = 0;
- if ((tmp = ma_addr % alignment))
+ if((tmp = ma_addr % alignment))
mis_align = alignment - tmp;
/* Allocate a block of 50 from meta_aggr */
- addr2 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE50);
+ addr2 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE50);
/* Verify that the allocated block is aligned */
- if (addr2 % alignment) TEST_ERROR
+ if(addr2 % alignment) TEST_ERROR
/* fragment for alignment of block 50 is freed to free-space */
- if (mis_align) {
+ if(mis_align) {
state[type].tot_space += mis_align;
state[type].tot_sect_count += 1;
state[type].serial_sect_count += 1;
}
H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- if ((addr2 + TEST_BLOCK_SIZE50) != ma_addr)
+ if((addr2 + TBLOCK_SIZE50) != ma_addr)
TEST_ERROR
/*
@@ -5123,84 +5059,84 @@ test_mf_align_alloc3(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
* block 30 is allocated from ma_addr
*/
mis_align = 0;
- if ((alignment == TEST_ALIGN1024) && (tmp = ((ma_addr + ma_size) % alignment)))
+ if((alignment == TEST_ALIGN1024) && (tmp = ((ma_addr + ma_size) % alignment)))
mis_align = alignment - tmp;
else if ((alignment == TEST_ALIGN4096) && (tmp = ma_addr % alignment))
mis_align = alignment - tmp;
/* Allocate a block of 30 from sdata_aggr */
stype = H5FD_MEM_DRAW;
- saddr1 = H5MF_alloc(f, stype, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE30);
+ saddr1 = H5MF_alloc(f, stype, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE30);
/* Verify that the allocated block is aligned */
- if (saddr1 % alignment) TEST_ERROR
+ if(saddr1 % alignment) TEST_ERROR
/* fragment for alignment of block 30 for sdata_aggr is freed to free-space */
- if (mis_align) {
+ if(mis_align) {
state[stype].tot_space += mis_align;
state[stype].tot_sect_count += 1;
state[stype].serial_sect_count += 1;
}
H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size);
- if (sdata_addr != (saddr1+TEST_BLOCK_SIZE30)) TEST_ERROR
+ if(sdata_addr != (saddr1+TBLOCK_SIZE30)) TEST_ERROR
/* calculate fragment for alignment of block 50 in sdata_aggr */
mis_align = 0;
- if ((tmp = sdata_addr % alignment))
+ if((tmp = sdata_addr % alignment))
mis_align = alignment - tmp;
/* Allocate a block of 50 from sdata_aggr */
- saddr2 = H5MF_alloc(f, stype, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE50);
+ saddr2 = H5MF_alloc(f, stype, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE50);
/* Verify that the allocated block is aligned */
- if (saddr2 % alignment) TEST_ERROR
+ if(saddr2 % alignment) TEST_ERROR
/* fragment for alignment of block 50 for sdata_aggr is freed to free-space */
- if (mis_align) {
+ if(mis_align) {
state[stype].tot_space += mis_align;
state[stype].tot_sect_count += 1;
state[stype].serial_sect_count += 1;
}
H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size);
- if (sdata_addr != (saddr2 + TEST_BLOCK_SIZE50)) TEST_ERROR
+ if(sdata_addr != (saddr2 + TBLOCK_SIZE50)) TEST_ERROR
/* calculate fragment for alignment of block 80 in sdata_aggr */
mis_align = 0;
- if ((tmp = sdata_addr % alignment))
+ if((tmp = sdata_addr % alignment))
mis_align = alignment - tmp;
/* Allocate a block of 80 from sdata_aggr */
- saddr3 = H5MF_alloc(f, stype, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE80);
+ saddr3 = H5MF_alloc(f, stype, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE80);
/* Verify that the allocated block is aligned */
- if (saddr3 % alignment) TEST_ERROR
+ if(saddr3 % alignment) TEST_ERROR
/* fragment for alignment of block 80 for sdata_aggr is freed to free-space */
- if (mis_align) {
+ if(mis_align) {
state[stype].tot_space += mis_align;
state[stype].tot_sect_count += 1;
state[stype].serial_sect_count += 1;
}
H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size);
- if ((saddr3 + TEST_BLOCK_SIZE80) != sdata_addr)
+ if ((saddr3 + TBLOCK_SIZE80) != sdata_addr)
TEST_ERROR
/* calculate fragment for alignment of block 1034 */
mis_align = 0;
- if ((tmp = sdata_addr % alignment))
+ if((tmp = sdata_addr % alignment))
mis_align = alignment - tmp;
/* Allocate a block of 1034 for meta_aggr */
- addr3 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE1034);
+ addr3 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE1034);
/* Verify that the allocated block is aligned */
- if (addr3 % alignment) TEST_ERROR
+ if(addr3 % alignment) TEST_ERROR
/* fragment for alignment of block 1034 for meta_aggr is freed to free-space */
- if (mis_align) {
+ if(mis_align) {
state[type].tot_space += mis_align;
state[type].tot_sect_count += 1;
state[type].serial_sect_count += 1;
@@ -5208,11 +5144,11 @@ test_mf_align_alloc3(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
/* calculate unused space in meta_aggr that is freed to free-space after block 1034 */
mis_align = 0;
- if ((alignment == TEST_ALIGN1024) && (tmp = (ma_addr % alignment)))
+ if((alignment == TEST_ALIGN1024) && (tmp = (ma_addr % alignment)))
mis_align = alignment - tmp;
/* fragment for unused space in meta_aggr after block 1034 is freed to free-space */
- if (mis_align) {
+ if(mis_align) {
state[type].tot_space += mis_align;
state[type].tot_sect_count += 1;
state[type].serial_sect_count += 1;
@@ -5220,7 +5156,7 @@ test_mf_align_alloc3(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- if ((addr3 + TEST_BLOCK_SIZE1034) != ma_addr)
+ if((addr3 + TBLOCK_SIZE1034) != ma_addr)
TEST_ERROR
/* Verify total size of free space after all allocations */
@@ -5255,6 +5191,7 @@ error:
/*
+ *-------------------------------------------------------------------------
* To verify that blocks allocated from the aggregator are aligned
*
* Alignment = 4096 aggr->alloc_size = 2048
@@ -5317,6 +5254,7 @@ error:
* Fragment from alignment of aggregator allocation is freed to free-space:[10250, 2038]
* There is space of 2023 left in meta_aggr
*
+ *-------------------------------------------------------------------------
*/
static unsigned
test_mf_align_alloc4(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
@@ -5327,7 +5265,7 @@ test_mf_align_alloc4(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
h5_stat_size_t file_size;
H5FD_mem_t type;
haddr_t addr1, addr2, addr3;
- frspace_state_t state;
+ H5FS_stat_t state;
haddr_t ma_addr=HADDR_UNDEF;
hsize_t ma_size=0, saved_ma_size=0;
hsize_t alignment=0, mis_align=0, tmp=0;
@@ -5370,19 +5308,19 @@ test_mf_align_alloc4(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
TEST_ERROR
/* calculate fragment for alignment of block 30 */
- if ((tmp = (hsize_t)file_size % alignment))
+ if((tmp = (hsize_t)file_size % alignment))
mis_align = alignment - tmp;
/* Allocate a block of 30 from meta_aggr */
type = H5FD_MEM_SUPER;
- addr1 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE30);
+ addr1 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE30);
/* Verify that the allocated block is aligned */
- if (addr1 % alignment) TEST_ERROR
+ if(addr1 % alignment) TEST_ERROR
/* fragment for alignment of block 30 is freed to free-space */
- HDmemset(&state, 0, sizeof(frspace_state_t));
- if (mis_align) {
+ HDmemset(&state, 0, sizeof(H5FS_stat_t));
+ if(mis_align) {
state.tot_space += mis_align;
state.tot_sect_count += 1;
state.serial_sect_count += 1;
@@ -5390,21 +5328,21 @@ test_mf_align_alloc4(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
saved_ma_size = ma_size;
- if ((addr1+TEST_BLOCK_SIZE30) != ma_addr) TEST_ERROR
+ if((addr1+TBLOCK_SIZE30) != ma_addr) TEST_ERROR
/* calculate fragment for alignment of block 2058 */
mis_align = 0;
- if ((tmp = ma_addr % alignment))
+ if((tmp = ma_addr % alignment))
mis_align = alignment - tmp;
/* Allocate a block of 2058 from meta_aggr */
- addr2 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE2058);
+ addr2 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE2058);
/* Verify that the allocated block is aligned */
- if (addr2 % alignment) TEST_ERROR
+ if(addr2 % alignment) TEST_ERROR
/* fragment for alignment of block 2058 is freed to free-space */
- if (mis_align) {
+ if(mis_align) {
state.tot_space += mis_align;
state.tot_sect_count += 1;
state.serial_sect_count += 1;
@@ -5412,28 +5350,28 @@ test_mf_align_alloc4(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- if ((addr2 + TEST_BLOCK_SIZE2058) != ma_addr) TEST_ERROR
+ if((addr2 + TBLOCK_SIZE2058) != ma_addr) TEST_ERROR
/* meta_aggr->size remains the same */
- if (ma_size != saved_ma_size) TEST_ERROR
+ if(ma_size != saved_ma_size) TEST_ERROR
/* calculate fragment for alignment of block 5 from meta_aggr */
mis_align = 0;
- if ((tmp = ma_addr % alignment))
+ if((tmp = ma_addr % alignment))
mis_align = alignment - tmp;
/* Allocate a block of 5 from meta_aggr */
- addr3 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE5);
+ addr3 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE5);
/* fragment for alignment of block 5 is freed to free-space */
- if (mis_align) {
+ if(mis_align) {
state.tot_space += mis_align;
state.tot_sect_count += 1;
state.serial_sect_count += 1;
}
/* Verify that the allocated block is aligned */
- if (addr3 % alignment) TEST_ERROR
+ if(addr3 % alignment) TEST_ERROR
/* Verify total size of free space after all allocations */
if(f->shared->fs_man[type]) {
@@ -5461,6 +5399,7 @@ error:
} /* test_mf_align_alloc4() */
/*
+ *-------------------------------------------------------------------------
* To verify that blocks allocated from the aggregator are aligned
*
* Alignment = 1024 aggr->alloc_size = 2048
@@ -5525,10 +5464,7 @@ error:
* sdata_aggr is reset to 0
* EOA is 14346
* meta_aggr and sdata_aggr are all 0
- *
- * Modifications:
- * Vailin Choi; July 2012
- * Changes due to the switch to H5FD_FLMAP_DICHOTOMY
+ *-------------------------------------------------------------------------
*/
static unsigned
test_mf_align_alloc5(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
@@ -5539,7 +5475,7 @@ test_mf_align_alloc5(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
h5_stat_size_t file_size;
H5FD_mem_t type, stype;
haddr_t addr1, addr2, saddr1;
- frspace_state_t state[H5FD_MEM_NTYPES];
+ H5FS_stat_t state[H5FD_MEM_NTYPES];
haddr_t ma_addr=HADDR_UNDEF, new_ma_addr=HADDR_UNDEF;
haddr_t sdata_addr=HADDR_UNDEF, new_sdata_addr=HADDR_UNDEF;
hsize_t ma_size=0, new_ma_size=0, sdata_size=0, new_sdata_size=0;
@@ -5583,23 +5519,23 @@ test_mf_align_alloc5(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
TEST_ERROR
/* calculate fragment for alignment of block 30 */
- if ((tmp = (hsize_t)file_size % alignment))
+ if((tmp = (hsize_t)file_size % alignment))
mis_align = alignment - tmp;
/* Allocate a block of 30 from meta_aggr */
type = H5FD_MEM_SUPER;
- addr1 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE30);
+ addr1 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE30);
/* Verify that the allocated block is aligned */
- if (addr1 % alignment) TEST_ERROR
+ if(addr1 % alignment) TEST_ERROR
H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- if ((addr1 + TEST_BLOCK_SIZE30) != ma_addr) TEST_ERROR
+ if((addr1 + TBLOCK_SIZE30) != ma_addr) TEST_ERROR
/* fragment for alignment of block 30 is freed to free-space */
- HDmemset(&state, 0, sizeof(frspace_state_t) * H5FD_MEM_NTYPES);
- if (mis_align) {
+ HDmemset(&state, 0, sizeof(H5FS_stat_t) * H5FD_MEM_NTYPES);
+ if(mis_align) {
state[type].tot_space += mis_align;
state[type].tot_sect_count += 1;
state[type].serial_sect_count += 1;
@@ -5607,39 +5543,39 @@ test_mf_align_alloc5(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
/* calculate fragment for alignment of block 30 from sdata_aggr */
mis_align = 0;
- if ((tmp = (ma_addr + ma_size) % alignment))
+ if((tmp = (ma_addr + ma_size) % alignment))
mis_align = alignment - tmp;
/* Allocate a block of 30 from sdata_aggr */
stype = H5FD_MEM_DRAW;
- saddr1 = H5MF_alloc(f, stype, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE30);
+ saddr1 = H5MF_alloc(f, stype, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE30);
/* Verify that the allocated block is aligned */
- if (saddr1 % alignment) TEST_ERROR
+ if(saddr1 % alignment) TEST_ERROR
/* fragment of alignment for block 30 in sdata_aggr is freed to free-space */
- if (mis_align) {
+ if(mis_align) {
state[stype].tot_space += mis_align;
state[stype].tot_sect_count += 1;
state[stype].serial_sect_count += 1;
}
H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size);
- if ((saddr1+TEST_BLOCK_SIZE30) != sdata_addr) TEST_ERROR
+ if((saddr1+TBLOCK_SIZE30) != sdata_addr) TEST_ERROR
/* calculate fragment for alignment of block 2058 from meta_aggr */
mis_align = 0;
- if ((tmp = (sdata_addr + sdata_size) % alignment))
+ if((tmp = (sdata_addr + sdata_size) % alignment))
mis_align = alignment - tmp;
/* Allocate a block of 2058 from meta_aggr */
- addr2 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE2058);
+ addr2 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE2058);
/* Verify that the allocated block is aligned */
if (addr2 % alignment) TEST_ERROR
/* fragment for alignment of block 2058 is freed to free-space */
- if (mis_align) {
+ if(mis_align) {
state[type].tot_space += mis_align;
state[type].tot_sect_count += 1;
state[type].serial_sect_count += 1;
@@ -5687,6 +5623,7 @@ error:
/*
+ *-------------------------------------------------------------------------
* To verify that blocks allocated from the aggregator are aligned
*
* Alignment = 1024 aggr->alloc_size = 2048
@@ -5792,10 +5729,7 @@ error:
* Fragment from alignment of file allocation is freed to free-space:[16464, 4016]
* EOA is at 22538
* meta_aggr is unchanged
- *
- * Modifications:
- * Vailin Choi; July 2012
- * Changes due to the switch to H5FD_FLMAP_DICHOTOMY
+ *-------------------------------------------------------------------------
*/
static unsigned
test_mf_align_alloc6(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
@@ -5807,7 +5741,7 @@ test_mf_align_alloc6(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
H5FD_mem_t type, stype;
haddr_t addr1, addr2;
haddr_t saddr1, saddr2, saddr3;
- frspace_state_t state[H5FD_MEM_NTYPES];
+ H5FS_stat_t state[H5FD_MEM_NTYPES];
haddr_t ma_addr=HADDR_UNDEF, new_ma_addr=HADDR_UNDEF, sdata_addr=HADDR_UNDEF;
hsize_t ma_size=0, new_ma_size=0, sdata_size=0;
hsize_t alignment=0, mis_align=0, tmp=0;
@@ -5849,26 +5783,26 @@ test_mf_align_alloc6(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
TEST_ERROR
/* calculate fragment for alignment of block 30 */
- if ((tmp = (hsize_t)file_size % alignment))
+ if((tmp = (hsize_t)file_size % alignment))
mis_align = alignment - tmp;
/* Allocate a block of 30 from meta_aggr */
type = H5FD_MEM_SUPER;
- addr1 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE30);
+ addr1 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE30);
/* Verify that the allocated block is aligned */
if (addr1 % alignment) TEST_ERROR
/* fragment for alignment of block 30 in meta_aggr is freed to free-space */
- HDmemset(&state, 0, sizeof(frspace_state_t) * H5FD_MEM_NTYPES);
- if (mis_align) {
+ HDmemset(&state, 0, sizeof(H5FS_stat_t) * H5FD_MEM_NTYPES);
+ if(mis_align) {
state[type].tot_space += mis_align;
state[type].tot_sect_count += 1;
state[type].serial_sect_count += 1;
}
H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- if ((addr1+TEST_BLOCK_SIZE30) != ma_addr)
+ if ((addr1+TBLOCK_SIZE30) != ma_addr)
TEST_ERROR
/* calculate fragment for alignment of block 30 in sdata_aggr */
@@ -5878,7 +5812,7 @@ test_mf_align_alloc6(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
/* Allocate a block of 30 from sdata_aggr */
stype = H5FD_MEM_DRAW;
- saddr1 = H5MF_alloc(f, stype, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE30);
+ saddr1 = H5MF_alloc(f, stype, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE30);
/* Verify that the allocated block is aligned */
if (saddr1 % alignment) TEST_ERROR
@@ -5891,7 +5825,7 @@ test_mf_align_alloc6(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
}
H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size);
- if (sdata_addr != (saddr1+TEST_BLOCK_SIZE30)) TEST_ERROR
+ if (sdata_addr != (saddr1+TBLOCK_SIZE30)) TEST_ERROR
/* calculate fragment for alignment of block 50 in sdata_aggr */
mis_align = 0;
@@ -5899,7 +5833,7 @@ test_mf_align_alloc6(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
mis_align = alignment - tmp;
/* Allocate a block of 50 from sdata_aggr */
- saddr2 = H5MF_alloc(f, stype, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE50);
+ saddr2 = H5MF_alloc(f, stype, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE50);
/* Verify that the allocated block is aligned */
if (saddr2 % alignment) TEST_ERROR
@@ -5912,7 +5846,7 @@ test_mf_align_alloc6(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
}
H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size);
- if (sdata_addr != (saddr2+TEST_BLOCK_SIZE50)) TEST_ERROR
+ if (sdata_addr != (saddr2+TBLOCK_SIZE50)) TEST_ERROR
/* calculate fragment for alignment of block 80 in sdata_aggr */
mis_align = 0;
@@ -5920,7 +5854,7 @@ test_mf_align_alloc6(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
mis_align = alignment - tmp;
/* Allocate a block of 80 from sdata_aggr */
- saddr3 = H5MF_alloc(f, stype, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE80);
+ saddr3 = H5MF_alloc(f, stype, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE80);
/* Verify that the allocated block is aligned */
if (saddr3 % alignment) TEST_ERROR
@@ -5933,7 +5867,7 @@ test_mf_align_alloc6(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
}
H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size);
- if (sdata_addr != (saddr3+TEST_BLOCK_SIZE80)) TEST_ERROR
+ if (sdata_addr != (saddr3+TBLOCK_SIZE80)) TEST_ERROR
/* calculate fragment for alignment of block 2058 */
/* remaining space in sdata_aggr is freed and shrunk */
@@ -5942,7 +5876,7 @@ test_mf_align_alloc6(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
mis_align = alignment - tmp;
/* Allocate a block of 2058 from meta_aggr */
- addr2 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE2058);
+ addr2 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE2058);
/* Verify that the allocated block is aligned */
if (addr2 % alignment) TEST_ERROR
@@ -5993,7 +5927,6 @@ error:
return(1);
} /* test_mf_align_alloc6() */
-
/*
* Test a bug that occurs when an allocator with zero size left and an unaligned
* endpoint is extended to allocate an aligned object
@@ -6156,334 +6089,111 @@ error:
return(1);
} /* test_mf_bug1() */
-
/*
- * Verify that the file's free-space manager persists where there are free sections in the manager
+ * Verify that the file's free-space manager(s) are persistent for a split-file
+ *-------------------------------------------------------------------------
*/
static unsigned
-test_mf_fs_persist(hid_t fapl_new, hid_t fcpl)
+test_mf_fs_persist_split(void)
{
- hid_t file = -1; /* File ID */
- char filename[FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5FD_mem_t type; /* File allocation type */
- H5FS_stat_t fs_stat; /* Information for free-space manager */
- haddr_t addr1, addr2, addr3, addr4, addr5, addr6; /* File address for H5FD_MEM_SUPER */
- haddr_t tmp_addr; /* Temporary variable for address */
-
- TESTING("file's free-space manager is persistent");
-
- /* Set the filename to use for this test (dependent on fapl) */
- h5_fixname(FILENAME[0], fapl_new, filename, sizeof(filename));
-
- /* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl_new)) < 0)
- FAIL_STACK_ERROR
-
- /* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5I_object(file)))
- FAIL_STACK_ERROR
-
- /* Allocate 6 blocks */
- type = H5FD_MEM_SUPER;
- if(HADDR_UNDEF == (addr1 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE1)))
- FAIL_STACK_ERROR
- if(HADDR_UNDEF == (addr2 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE2)))
- FAIL_STACK_ERROR
- if(HADDR_UNDEF == (addr3 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE3)))
- FAIL_STACK_ERROR
- if(HADDR_UNDEF == (addr4 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE4)))
- FAIL_STACK_ERROR
- if(HADDR_UNDEF == (addr5 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE5)))
- FAIL_STACK_ERROR
- if(HADDR_UNDEF == (addr6 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE6)))
- FAIL_STACK_ERROR
-
- /* Put block #1, #3, #5 to H5FD_MEM_SUPER free-space manager */
- if(H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr1, (hsize_t)TEST_BLOCK_SIZE1) < 0)
- FAIL_STACK_ERROR
- if(H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr3, (hsize_t)TEST_BLOCK_SIZE3) < 0)
- FAIL_STACK_ERROR
- if(H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr5, (hsize_t)TEST_BLOCK_SIZE5) < 0)
- FAIL_STACK_ERROR
-
- if(H5Fclose(file) < 0)
- FAIL_STACK_ERROR
-
- /* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0)
- FAIL_STACK_ERROR
-
- /* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5I_object(file)))
- FAIL_STACK_ERROR
-
- /* Verify that H5FD_MEM_SUPER free-space manager is there */
- if(!H5F_addr_defined(f->shared->fs_addr[type]))
- TEST_ERROR
-
- /* Start up H5FD_MEM_SUPER free-space manager */
- if(H5MF__alloc_open(f, H5AC_ind_read_dxpl_id, type) < 0)
- FAIL_STACK_ERROR
-
- /* Get info for free-space manager */
- if(H5FS_stat_info(f, f->shared->fs_man[type], &fs_stat) < 0)
- FAIL_STACK_ERROR
-
- /* Verify free-space info */
- if(fs_stat.tot_space < (TEST_BLOCK_SIZE1+TEST_BLOCK_SIZE3+TEST_BLOCK_SIZE5))
- TEST_ERROR
-
- if(fs_stat.serial_sect_count < 3)
- TEST_ERROR
-
- /* Retrieve block #3 from H5FD_MEM_SUPER free-space manager */
- if(HADDR_UNDEF == (tmp_addr = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE3)))
- FAIL_STACK_ERROR
- if(tmp_addr != addr3)
- TEST_ERROR
-
- /* Retrieve block #1 from H5FD_MEM_SUPER free-space manager */
- if(HADDR_UNDEF == (tmp_addr = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE1)))
- FAIL_STACK_ERROR
- if(tmp_addr != addr1)
- TEST_ERROR
-
- if(H5Fclose(file) < 0)
- FAIL_STACK_ERROR
-
- /* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0)
- FAIL_STACK_ERROR
-
- /* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5I_object(file)))
- FAIL_STACK_ERROR
+ hid_t file = -1; /* File ID */
+ hid_t fcpl = -1; /* File creation property list ID */
+ hid_t fapl = -1; /* File access property list ID */
+ char filename[FILENAME_LEN]; /* Filename to use */
+ H5F_t *f = NULL; /* Internal file object pointer */
+ H5FD_mem_t type, stype, btype; /* File allocation type */
+ H5FS_stat_t fs_stat; /* Information for free-space manager */
+ haddr_t addr1, addr2, addr3, addr4; /* File address for H5FD_MEM_SUPER */
+ haddr_t saddr1, saddr2, saddr3, saddr4; /* File address for H5FD_MEM_DRAW */
+ haddr_t baddr5, baddr6, baddr7, baddr8; /* File address for H5FD_MEM_BTREE */
+ haddr_t tmp_addr; /* temporary variable for address */
+
+ TESTING("File's free-space managers are persistent for split-file");
+
+ /* for now, we don't support persistant free space managers
+ * with the split file driver.
+ */
+ SKIPPED();
+ HDfprintf(stdout, " Persistant FSMs disabled in multi file driver.\n");
+ return 0; /* <========== note return */
- /* Verify that H5FD_MEM_SUPER free-space manager is there */
- if(!H5F_addr_defined(f->shared->fs_addr[type]))
- TEST_ERROR
+ /* File creation property list template */
+ if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
- /* Retrieve block #5 from H5FD_MEM_SUPER free-space manager */
- if(HADDR_UNDEF == (tmp_addr = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE5)))
- FAIL_STACK_ERROR
- if(tmp_addr != addr5)
- TEST_ERROR
+ /* for now, we don't support persistant free space managers
+ * with the split file driver.
+ */
+ SKIPPED();
+ HDfprintf(stdout, " Persistant FSMs disabled in multi file driver.\n");
+ return 0; /* <========== note return */
- if(H5Fclose(file) < 0)
- FAIL_STACK_ERROR
+ /* File creation property list template */
+ if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
- PASSED()
+ if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ FAIL_STACK_ERROR
- return(0);
+ /* Set up split driver */
+ if(H5Pset_fapl_split(fapl, "-m.h5", H5P_DEFAULT, "-r.h5", H5P_DEFAULT)<0)
+ FAIL_STACK_ERROR
-error:
- H5E_BEGIN_TRY {
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
-} /* test_mf_fs_persist() */
-
-/*
- * Verify that the free-space manager goes away
- */
-static unsigned
-test_mf_fs_gone(hid_t fapl_new, hid_t fcpl)
-{
- hid_t file = -1; /* File ID */
- char filename[FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5FD_mem_t type; /* File allocation type */
- H5FS_stat_t fs_stat; /* Information for free-space manager */
- haddr_t addr1, addr2, addr3, addr4; /* File address for H5FD_MEM_SUPER */
+ /* File creation property list template */
+ if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ FAIL_STACK_ERROR
- TESTING("file's free-space manager is going away");
+ if(H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_FSM_AGGR, TRUE, (hsize_t)1) < 0)
+ FAIL_STACK_ERROR
/* Set the filename to use for this test (dependent on fapl) */
- h5_fixname(FILENAME[0], fapl_new, filename, sizeof(filename));
+ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl_new)) < 0)
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
if(NULL == (f = (H5F_t *)H5I_object(file)))
FAIL_STACK_ERROR
- /* Allocate 4 blocks */
+ /* Allocate 4 blocks of type H5FD_MEM_SUPER */
type = H5FD_MEM_SUPER;
- if(HADDR_UNDEF == (addr1 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE1)))
- FAIL_STACK_ERROR
- if(HADDR_UNDEF == (addr2 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE2)))
- FAIL_STACK_ERROR
- if(HADDR_UNDEF == (addr3 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE3)))
- FAIL_STACK_ERROR
- if(HADDR_UNDEF == (addr4 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE4)))
- FAIL_STACK_ERROR
-
- /* Put block #1, #3 to H5FD_MEM_SUPER free-space manager */
- if(H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr1, (hsize_t)TEST_BLOCK_SIZE1) < 0)
- FAIL_STACK_ERROR
- if(H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr3, (hsize_t)TEST_BLOCK_SIZE3) < 0)
- FAIL_STACK_ERROR
-
- /* Retrieve block #1, #3 from H5FD_MEM_SUPER free-space manager */
- if(HADDR_UNDEF == (addr3 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE3)))
- FAIL_STACK_ERROR
- if(HADDR_UNDEF == (addr1 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE1)))
- FAIL_STACK_ERROR
-
- if(H5Fclose(file) < 0)
- FAIL_STACK_ERROR
-
- /* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0)
+ if(HADDR_UNDEF == (addr1 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE1)))
FAIL_STACK_ERROR
-
- /* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5I_object(file)))
- FAIL_STACK_ERROR
-
- /* Verify that the H5FD_MEM_SUPER free-space manager is not there */
- if(H5F_addr_defined(f->shared->fs_addr[type]))
- TEST_ERROR
-
- /* Put block #3 to H5FD_MEM_SUPER free-space manager */
- if(H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr3, (hsize_t)TEST_BLOCK_SIZE3) < 0)
- FAIL_STACK_ERROR
-
- if(H5Fclose(file) < 0)
- FAIL_STACK_ERROR
-
- /* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0)
+ if(HADDR_UNDEF == (addr2 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE2)))
FAIL_STACK_ERROR
-
- /* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5I_object(file)))
+ if(HADDR_UNDEF == (addr3 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE3)))
FAIL_STACK_ERROR
-
- /* Verify that H5FD_MEM_SUPER free-space manager is there */
- if(!H5F_addr_defined(f->shared->fs_addr[type]))
- TEST_ERROR
-
- /* Start up H5FD_MEM_SUPER free-space manager */
- if(H5MF__alloc_open(f, H5AC_ind_read_dxpl_id, type) < 0)
+ if(HADDR_UNDEF == (addr4 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE4)))
FAIL_STACK_ERROR
- /* Get info for H5FD_MEM_SUPER free-space manager */
- if(H5FS_stat_info(f, f->shared->fs_man[type], &fs_stat) < 0)
+ /* Put block #1, #3 into H5FD_MEM_SUPER free-space manager */
+ if(H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr1, (hsize_t)TBLOCK_SIZE1) < 0)
FAIL_STACK_ERROR
-
- /* Verify free-space info */
- if(!H5F_addr_defined(fs_stat.addr) || !H5F_addr_defined(fs_stat.sect_addr))
- TEST_ERROR
- if(fs_stat.tot_space < TEST_BLOCK_SIZE3)
- TEST_ERROR
-
- /* Put block #4 to H5FD_MEM_SUPER free-space manager */
- if(H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr4, (hsize_t)TEST_BLOCK_SIZE4) < 0)
+ if(H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr3, (hsize_t)TBLOCK_SIZE3) < 0)
FAIL_STACK_ERROR
- /* The H5FD_MEM_SUPER free-space manager will go away at H5MF_close() */
- if(H5Fclose(file) < 0)
+ /* Allocate 4 blocks of type H5FD_MEM_DRAW */
+ stype = H5FD_MEM_DRAW;
+ if(HADDR_UNDEF == (saddr1 = H5MF_alloc(f, stype, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE1)))
FAIL_STACK_ERROR
-
- /* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0)
+ if(HADDR_UNDEF == (saddr2 = H5MF_alloc(f, stype, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE2)))
FAIL_STACK_ERROR
-
- /* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5I_object(file)))
+ if(HADDR_UNDEF == (saddr3 = H5MF_alloc(f, stype, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE3)))
FAIL_STACK_ERROR
-
- /* Verify that the H5FD_MEM_SUPER free-space manager is not there */
- if(H5F_addr_defined(f->shared->fs_addr[type]))
- TEST_ERROR
-
- if(H5Fclose(file) < 0)
+ if(HADDR_UNDEF == (saddr4 = H5MF_alloc(f, stype, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE4)))
FAIL_STACK_ERROR
- PASSED()
-
- return(0);
-
-error:
- H5E_BEGIN_TRY {
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
-} /* test_mf_fs_gone() */
-
-
-/*
- * Verify that the file's free-space manager(s) are persistent for a split-file
- */
-static unsigned
-test_mf_fs_split(hid_t fapl_new, hid_t fcpl)
-{
- hid_t file = -1; /* File ID */
- char filename[FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5FD_mem_t type, stype, btype; /* File allocation type */
- H5FS_stat_t fs_stat; /* Information for free-space manager */
- haddr_t addr1, addr2, addr3, addr4; /* File address for H5FD_MEM_SUPER */
- haddr_t saddr1, saddr2, saddr3, saddr4; /* File address for H5FD_MEM_DRAW */
- haddr_t baddr5, baddr6, baddr7, baddr8; /* File address for H5FD_MEM_BTREE */
- haddr_t tmp_addr; /* temporary variable for address */
-
- TESTING("file's free-space managers are persistent for split-file");
-
- /* Set the filename to use for this test (dependent on fapl) */
- h5_fixname(FILENAME[0], fapl_new, filename, sizeof(filename));
-
- /* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl_new)) < 0)
+ /* Put block #1, #3 into H5FD_MEM_DRAW free-space manager */
+ if(H5MF_xfree(f, stype, H5AC_ind_read_dxpl_id, saddr1, (hsize_t)TBLOCK_SIZE1) < 0)
FAIL_STACK_ERROR
-
- /* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5I_object(file)))
+ if(H5MF_xfree(f, stype, H5AC_ind_read_dxpl_id, saddr3, (hsize_t)TBLOCK_SIZE3) < 0)
FAIL_STACK_ERROR
- /* Allocate 4 blocks of type H5FD_MEM_SUPER */
- type = H5FD_MEM_SUPER;
- if(HADDR_UNDEF == (addr1 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE1)))
- FAIL_STACK_ERROR
- if(HADDR_UNDEF == (addr2 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE2)))
- FAIL_STACK_ERROR
- if(HADDR_UNDEF == (addr3 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE3)))
- FAIL_STACK_ERROR
- if(HADDR_UNDEF == (addr4 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE4)))
- FAIL_STACK_ERROR
-
- /* Put block #1, #3 into H5FD_MEM_SUPER free-space manager */
- if(H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr1, (hsize_t)TEST_BLOCK_SIZE1) < 0)
- FAIL_STACK_ERROR
- if(H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr3, (hsize_t)TEST_BLOCK_SIZE3) < 0)
- FAIL_STACK_ERROR
-
- /* Allocate 4 blocks of type H5FD_MEM_DRAW */
- stype = H5FD_MEM_DRAW;
- if(HADDR_UNDEF == (saddr1 = H5MF_alloc(f, stype, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE1)))
- FAIL_STACK_ERROR
- if(HADDR_UNDEF == (saddr2 = H5MF_alloc(f, stype, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE2)))
- FAIL_STACK_ERROR
- if(HADDR_UNDEF == (saddr3 = H5MF_alloc(f, stype, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE3)))
- FAIL_STACK_ERROR
- if(HADDR_UNDEF == (saddr4 = H5MF_alloc(f, stype, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE4)))
- FAIL_STACK_ERROR
-
- /* Put block #1, #3 into H5FD_MEM_DRAW free-space manager */
- if(H5MF_xfree(f, stype, H5AC_ind_read_dxpl_id, saddr1, (hsize_t)TEST_BLOCK_SIZE1) < 0)
- FAIL_STACK_ERROR
- if(H5MF_xfree(f, stype, H5AC_ind_read_dxpl_id, saddr3, (hsize_t)TEST_BLOCK_SIZE3) < 0)
- FAIL_STACK_ERROR
-
if(H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0)
+ if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
@@ -6495,7 +6205,7 @@ test_mf_fs_split(hid_t fapl_new, hid_t fcpl)
TEST_ERROR
/* Start up H5FD_MEM_SUPER free-space manager */
- if(H5MF__alloc_open(f, H5AC_ind_read_dxpl_id, type) < 0)
+ if(H5MF_open_fstype(f, H5AC_ind_read_dxpl_id, (H5F_mem_page_t)type) < 0)
FAIL_STACK_ERROR
/* Get free-space info */
@@ -6503,23 +6213,24 @@ test_mf_fs_split(hid_t fapl_new, hid_t fcpl)
FAIL_STACK_ERROR
/* Verify free-space info */
- if(fs_stat.tot_space < (TEST_BLOCK_SIZE1+TEST_BLOCK_SIZE3))
- TEST_ERROR
+ if(fs_stat.tot_space < (TBLOCK_SIZE1+TBLOCK_SIZE3))
+ TEST_ERROR
if(fs_stat.serial_sect_count < 2)
- TEST_ERROR
+ TEST_ERROR
- /* Retrieve block #1 from H5FD_MEM_SUPER free-space manager; block #2 still in free-space */
- if(HADDR_UNDEF == (tmp_addr = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE1)))
- FAIL_STACK_ERROR
+ /* Retrieve block #1 from H5FD_MEM_SUPER free-space manager; block #3 still in free-space */
+ if(HADDR_UNDEF == (tmp_addr = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE1)))
+ FAIL_STACK_ERROR
if(tmp_addr != addr1)
- TEST_ERROR
+ TEST_ERROR
/* Verify that the free-space manager for H5FD_MEM_DRAW is there */
if(!H5F_addr_defined(f->shared->fs_addr[stype]))
TEST_ERROR
+
/* Start up H5FD_MEM_DRAW free-space manager */
- if(H5MF__alloc_open(f, H5AC_ind_read_dxpl_id, stype) < 0)
+ if(H5MF_open_fstype(f, H5AC_ind_read_dxpl_id, (H5F_mem_page_t)stype) < 0)
FAIL_STACK_ERROR
/* Get free-space info */
@@ -6527,47 +6238,47 @@ test_mf_fs_split(hid_t fapl_new, hid_t fcpl)
FAIL_STACK_ERROR
/* Verify free-space info */
- if(fs_stat.tot_space < (TEST_BLOCK_SIZE1+TEST_BLOCK_SIZE3))
- TEST_ERROR
+ if(fs_stat.tot_space < (TBLOCK_SIZE1+TBLOCK_SIZE3))
+ TEST_ERROR
if(fs_stat.serial_sect_count < 2)
- TEST_ERROR
+ TEST_ERROR
/* Retrieve blocks #1 from H5FD_MEM_DRAW free-space manager */
- if(HADDR_UNDEF == (tmp_addr = H5MF_alloc(f, stype, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE1)))
- FAIL_STACK_ERROR
+ if(HADDR_UNDEF == (tmp_addr = H5MF_alloc(f, stype, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE1)))
+ FAIL_STACK_ERROR
if(tmp_addr != saddr1)
- TEST_ERROR
+ TEST_ERROR
/* Retrieve blocks #3 from H5FD_MEM_DRAW free-space manager */
- if(HADDR_UNDEF == (tmp_addr = H5MF_alloc(f, stype, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE3)))
- FAIL_STACK_ERROR
+ if(HADDR_UNDEF == (tmp_addr = H5MF_alloc(f, stype, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE3)))
+ FAIL_STACK_ERROR
if(tmp_addr != saddr3)
- TEST_ERROR
+ TEST_ERROR
/* H5FD_MEM_DRAW free-space manager is going away at closing */
/* works for this one because the freeing of sect_addr is to H5FD_MEM_SUPER fs, not against itself */
/* Allocate 4 blocks of type H5FD_MEM_BTREE */
btype = H5FD_MEM_BTREE;
- if(HADDR_UNDEF == (baddr5 = H5MF_alloc(f, btype, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE5)))
- FAIL_STACK_ERROR
- if(HADDR_UNDEF == (baddr6 = H5MF_alloc(f, btype, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE6)))
- FAIL_STACK_ERROR
- if(HADDR_UNDEF == (baddr7 = H5MF_alloc(f, btype, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE7)))
- FAIL_STACK_ERROR
- if(HADDR_UNDEF == (baddr8 = H5MF_alloc(f, btype, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE8)))
- FAIL_STACK_ERROR
+ if(HADDR_UNDEF == (baddr5 = H5MF_alloc(f, btype, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE5)))
+ FAIL_STACK_ERROR
+ if(HADDR_UNDEF == (baddr6 = H5MF_alloc(f, btype, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE6)))
+ FAIL_STACK_ERROR
+ if(HADDR_UNDEF == (baddr7 = H5MF_alloc(f, btype, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE7)))
+ FAIL_STACK_ERROR
+ if(HADDR_UNDEF == (baddr8 = H5MF_alloc(f, btype, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE8)))
+ FAIL_STACK_ERROR
/* Put block #5 & #7 into H5FD_MEM_BTREE free-space manager */
- if(H5MF_xfree(f, btype, H5AC_ind_read_dxpl_id, baddr5, (hsize_t)TEST_BLOCK_SIZE5) < 0)
- FAIL_STACK_ERROR
- if(H5MF_xfree(f, btype, H5AC_ind_read_dxpl_id, baddr7, (hsize_t)TEST_BLOCK_SIZE7) < 0)
- FAIL_STACK_ERROR
+ if(H5MF_xfree(f, btype, H5AC_ind_read_dxpl_id, baddr5, (hsize_t)TBLOCK_SIZE5) < 0)
+ FAIL_STACK_ERROR
+ if(H5MF_xfree(f, btype, H5AC_ind_read_dxpl_id, baddr7, (hsize_t)TBLOCK_SIZE7) < 0)
+ FAIL_STACK_ERROR
if(H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0)
+ if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
@@ -6583,7 +6294,7 @@ test_mf_fs_split(hid_t fapl_new, hid_t fcpl)
TEST_ERROR
/* Start up H5FD_MEM_SUPER free-space manager */
- if(H5MF__alloc_open(f, H5AC_ind_read_dxpl_id, type) < 0)
+ if(H5MF_open_fstype(f, H5AC_ind_read_dxpl_id, (H5F_mem_page_t)type) < 0)
FAIL_STACK_ERROR
/* Get free-space info */
@@ -6591,27 +6302,27 @@ test_mf_fs_split(hid_t fapl_new, hid_t fcpl)
FAIL_STACK_ERROR
/* Verify free-space info */
- if(fs_stat.tot_space < (TEST_BLOCK_SIZE3+TEST_BLOCK_SIZE5+TEST_BLOCK_SIZE7))
- TEST_ERROR
+ if(fs_stat.tot_space < (TBLOCK_SIZE3+TBLOCK_SIZE5+TBLOCK_SIZE7))
+ TEST_ERROR
/* Retrieve block #3 from H5FD_MEM_SUPER free-space manager */
- if(HADDR_UNDEF == (tmp_addr = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE3)))
- FAIL_STACK_ERROR
+ if(HADDR_UNDEF == (tmp_addr = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE3)))
+ FAIL_STACK_ERROR
if(tmp_addr != addr3)
- TEST_ERROR
+ TEST_ERROR
/* Retrieve block #7 from H5FD_MEM_BTREE free-space manager */
- if(HADDR_UNDEF == (tmp_addr = H5MF_alloc(f, btype, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE7)))
- FAIL_STACK_ERROR
+ if(HADDR_UNDEF == (tmp_addr = H5MF_alloc(f, btype, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE7)))
+ FAIL_STACK_ERROR
if(tmp_addr != baddr7)
- TEST_ERROR
+ TEST_ERROR
/* There should still be block #5 of H5FD_MEM_BTREE in H5FD_MEM_BTREE free-space manager */
if(H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0)
+ if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
@@ -6620,10 +6331,10 @@ test_mf_fs_split(hid_t fapl_new, hid_t fcpl)
/* Verify that the H5FD_MEM_SUPER free-space manager is there */
if(!H5F_addr_defined(f->shared->fs_addr[type]))
- TEST_ERROR
+ TEST_ERROR
/* Start up H5FD_MEM_SUPER free-space manager */
- if(H5MF__alloc_open(f, H5AC_ind_read_dxpl_id, type) < 0)
+ if(H5MF_open_fstype(f, H5AC_ind_read_dxpl_id, (H5F_mem_page_t)type) < 0)
FAIL_STACK_ERROR
/* Get free-space info */
@@ -6631,11 +6342,16 @@ test_mf_fs_split(hid_t fapl_new, hid_t fcpl)
FAIL_STACK_ERROR
/* Verify free-space info */
- if(fs_stat.tot_space < TEST_BLOCK_SIZE5)
- TEST_ERROR
+ if(fs_stat.tot_space < TBLOCK_SIZE5)
+ TEST_ERROR
+ /* Closing */
if(H5Fclose(file) < 0)
FAIL_STACK_ERROR
+ if(H5Pclose(fapl) < 0)
+ FAIL_STACK_ERROR
+ if(H5Pclose(fcpl) < 0)
+ FAIL_STACK_ERROR
PASSED()
@@ -6643,37 +6359,113 @@ test_mf_fs_split(hid_t fapl_new, hid_t fcpl)
error:
H5E_BEGIN_TRY {
- H5Fclose(file);
+ H5Fclose(file);
+ H5Pclose(fcpl);
+ H5Pclose(fapl);
} H5E_END_TRY;
return(1);
-} /* test_mf_fs_split() */
+} /* test_mf_fs_persist_split() */
+
+#define MULTI_SETUP(memb_map, memb_fapl, memb_name, memb_addr, sv) { \
+ H5FD_mem_t mt; \
+ HDmemset(memb_map, 0, sizeof memb_map); \
+ HDmemset(memb_fapl, 0, sizeof memb_fapl); \
+ HDmemset(memb_name, 0, sizeof memb_name); \
+ HDmemset(memb_addr, 0, sizeof memb_addr); \
+ HDmemset(sv, 0, sizeof sv); \
+ for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, mt)) { \
+ memb_map[mt] = H5FD_MEM_SUPER; \
+ memb_fapl[mt] = H5P_DEFAULT; \
+ } \
+ memb_map[H5FD_MEM_BTREE] = H5FD_MEM_BTREE; \
+ memb_map[H5FD_MEM_DRAW] = H5FD_MEM_DRAW; \
+ memb_map[H5FD_MEM_GHEAP] = H5FD_MEM_GHEAP; \
+ memb_map[H5FD_MEM_LHEAP] = H5FD_MEM_LHEAP; \
+ sprintf(sv[H5FD_MEM_SUPER], "%%s-%c.h5", 's'); \
+ memb_name[H5FD_MEM_SUPER] = sv[H5FD_MEM_SUPER]; \
+ memb_addr[H5FD_MEM_SUPER] = 0; \
+ sprintf(sv[H5FD_MEM_BTREE], "%%s-%c.h5", 'b'); \
+ memb_name[H5FD_MEM_BTREE] = sv[H5FD_MEM_BTREE]; \
+ memb_addr[H5FD_MEM_BTREE] = HADDR_MAX/6; \
+ sprintf(sv[H5FD_MEM_DRAW], "%%s-%c.h5", 'r'); \
+ memb_name[H5FD_MEM_DRAW] = sv[H5FD_MEM_DRAW]; \
+ memb_addr[H5FD_MEM_DRAW] = HADDR_MAX/3; \
+ sprintf(sv[H5FD_MEM_GHEAP], "%%s-%c.h5", 'g'); \
+ memb_name[H5FD_MEM_GHEAP] = sv[H5FD_MEM_GHEAP]; \
+ memb_addr[H5FD_MEM_GHEAP] = HADDR_MAX/2; \
+ sprintf(sv[H5FD_MEM_LHEAP], "%%s-%c.h5", 'l'); \
+ memb_name[H5FD_MEM_LHEAP] = sv[H5FD_MEM_LHEAP]; \
+ memb_addr[H5FD_MEM_LHEAP] = HADDR_MAX*2/3; \
+ sprintf(sv[H5FD_MEM_OHDR], "%%s-%c.h5", 'o'); \
+ memb_name[H5FD_MEM_OHDR] = sv[H5FD_MEM_OHDR]; \
+ memb_addr[H5FD_MEM_OHDR] = HADDR_MAX*5/6; \
+}
/*
+ *-------------------------------------------------------------------------
* Verify that the file's free-space manager(s) are persistent for a multi-file
+ *-------------------------------------------------------------------------
*/
static unsigned
-test_mf_fs_multi(hid_t fapl_new, hid_t fcpl)
+test_mf_fs_persist_multi(void)
{
- hid_t file = -1; /* File ID */
- char filename[FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5FD_mem_t type, stype, btype, gtype; /* File allocation type */
- H5FS_stat_t fs_stat; /* Information for free-space manager */
- haddr_t addr1, addr2, addr3, addr4; /* File allocation type */
- haddr_t saddr1, saddr2, saddr3, saddr4; /* File address for H5FD_MEM_SUPER */
- haddr_t baddr1, baddr2, baddr3, baddr4; /* File address for H5FD_MEM_DRAW */
- haddr_t gaddr1, gaddr2; /* File address for H5FD_MEM_GHEAP */
- haddr_t tmp_addr; /* Temporary variable for address */
- H5FS_section_info_t *node; /* Free space section node */
- htri_t node_found = FALSE; /* Indicate section is in free-space */
-
- TESTING("file's free-space managers are persistent for multi-file");
+ hid_t file = -1; /* File ID */
+ hid_t fcpl = -1; /* File creation property list ID */
+ hid_t fapl = -1; /* File access property list ID */
+ char filename[FILENAME_LEN]; /* Filename to use */
+ H5F_t *f = NULL; /* Internal file object pointer */
+ H5FD_mem_t type, stype, btype, gtype; /* File allocation type */
+ H5FS_stat_t fs_stat; /* Information for free-space manager */
+ haddr_t addr1, addr2, addr3, addr4; /* File allocation type */
+ haddr_t saddr1, saddr2, saddr3, saddr4; /* File address for H5FD_MEM_SUPER */
+ haddr_t baddr1, baddr2, baddr3, baddr4; /* File address for H5FD_MEM_DRAW */
+ haddr_t gaddr1, gaddr2; /* File address for H5FD_MEM_GHEAP */
+ haddr_t tmp_addr; /* Temporary variable for address */
+ H5FS_section_info_t *node; /* Free space section node */
+ htri_t node_found = FALSE; /* Indicate section is in free-space */
+ H5FD_mem_t memb_map[H5FD_MEM_NTYPES]; /* Memory usage map */
+ hid_t memb_fapl[H5FD_MEM_NTYPES]; /* Member access properties */
+ char sv[H5FD_MEM_NTYPES][64]; /* Name generators */
+ const char *memb_name[H5FD_MEM_NTYPES]; /* Name generators */
+ haddr_t memb_addr[H5FD_MEM_NTYPES]; /* Member starting address */
+
+
+ TESTING("File's free-space managers are persistent for multi-file");
+
+ /* for now, we don't support persistant free space managers
+ * with the multi file driver.
+ */
+ SKIPPED();
+ HDfprintf(stdout, " Persistant FSMs disabled in multi file driver.\n");
+ return 0; /* <========== note return */
+
+ /* for now, we don't support persistant free space managers
+ * with the multi file driver.
+ */
+ SKIPPED();
+ HDfprintf(stdout, " Persistant FSMs disabled in multi file driver.\n");
+ return 0; /* <========== note return */
+
+ /* File creation property list template */
+ if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ FAIL_STACK_ERROR
+
+ if(H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_FSM_AGGR, TRUE, (hsize_t)1) < 0)
+ FAIL_STACK_ERROR
+
+ if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ FAIL_STACK_ERROR
+
+ MULTI_SETUP(memb_map, memb_fapl, memb_name, memb_addr, sv)
+
+ if(H5Pset_fapl_multi(fapl, memb_map, memb_fapl, memb_name, memb_addr, TRUE) < 0)
+ TEST_ERROR;
/* Set the filename to use for this test (dependent on fapl) */
- h5_fixname(FILENAME[0], fapl_new, filename, sizeof(filename));
+ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl_new)) < 0)
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
@@ -6682,43 +6474,43 @@ test_mf_fs_multi(hid_t fapl_new, hid_t fcpl)
/* Allocate 4 blocks of type H5FD_MEM_SUPER */
type = H5FD_MEM_SUPER;
- if(HADDR_UNDEF == (addr1 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE1)))
- FAIL_STACK_ERROR
- if(HADDR_UNDEF == (addr2 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE2)))
- FAIL_STACK_ERROR
- if(HADDR_UNDEF == (addr3 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE3)))
- FAIL_STACK_ERROR
- if(HADDR_UNDEF == (addr4 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE4)))
- FAIL_STACK_ERROR
+ if(HADDR_UNDEF == (addr1 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE1)))
+ FAIL_STACK_ERROR
+ if(HADDR_UNDEF == (addr2 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE2)))
+ FAIL_STACK_ERROR
+ if(HADDR_UNDEF == (addr3 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE3)))
+ FAIL_STACK_ERROR
+ if(HADDR_UNDEF == (addr4 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE4)))
+ FAIL_STACK_ERROR
/* Put block #1, #3 into H5FD_MEM_SUPER free-space manager */
- if(H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr1, (hsize_t)TEST_BLOCK_SIZE1) < 0)
- FAIL_STACK_ERROR
- if(H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr3, (hsize_t)TEST_BLOCK_SIZE3) < 0)
- FAIL_STACK_ERROR
+ if(H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr1, (hsize_t)TBLOCK_SIZE1) < 0)
+ FAIL_STACK_ERROR
+ if(H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr3, (hsize_t)TBLOCK_SIZE3) < 0)
+ FAIL_STACK_ERROR
/* Allocate 4 blocks of type H5FD_MEM_DRAW */
stype = H5FD_MEM_DRAW;
- if(HADDR_UNDEF == (saddr1 = H5MF_alloc(f, stype, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE1)))
- FAIL_STACK_ERROR
- if(HADDR_UNDEF == (saddr2 = H5MF_alloc(f, stype, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE2)))
- FAIL_STACK_ERROR
- if(HADDR_UNDEF == (saddr3 = H5MF_alloc(f, stype, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE3)))
- FAIL_STACK_ERROR
- if(HADDR_UNDEF == (saddr4 = H5MF_alloc(f, stype, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE4)))
- FAIL_STACK_ERROR
+ if(HADDR_UNDEF == (saddr1 = H5MF_alloc(f, stype, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE1)))
+ FAIL_STACK_ERROR
+ if(HADDR_UNDEF == (saddr2 = H5MF_alloc(f, stype, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE2)))
+ FAIL_STACK_ERROR
+ if(HADDR_UNDEF == (saddr3 = H5MF_alloc(f, stype, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE3)))
+ FAIL_STACK_ERROR
+ if(HADDR_UNDEF == (saddr4 = H5MF_alloc(f, stype, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE4)))
+ FAIL_STACK_ERROR
/* Put block #1, #3 into H5FD_MEM_DRAW free-space manager */
- if(H5MF_xfree(f, stype, H5AC_ind_read_dxpl_id, saddr1, (hsize_t)TEST_BLOCK_SIZE1) < 0)
- FAIL_STACK_ERROR
- if(H5MF_xfree(f, stype, H5AC_ind_read_dxpl_id, saddr3, (hsize_t)TEST_BLOCK_SIZE3) < 0)
- FAIL_STACK_ERROR
+ if(H5MF_xfree(f, stype, H5AC_ind_read_dxpl_id, saddr1, (hsize_t)TBLOCK_SIZE1) < 0)
+ FAIL_STACK_ERROR
+ if(H5MF_xfree(f, stype, H5AC_ind_read_dxpl_id, saddr3, (hsize_t)TBLOCK_SIZE3) < 0)
+ FAIL_STACK_ERROR
if(H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0)
+ if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
@@ -6730,7 +6522,7 @@ test_mf_fs_multi(hid_t fapl_new, hid_t fcpl)
TEST_ERROR
/* Start up H5FD_MEM_SUPER free-space manager */
- if(H5MF__alloc_open(f, H5AC_ind_read_dxpl_id, type) < 0)
+ if(H5MF_open_fstype(f, H5AC_ind_read_dxpl_id, (H5F_mem_page_t)type) < 0)
FAIL_STACK_ERROR
/* Get free-space info */
@@ -6738,23 +6530,23 @@ test_mf_fs_multi(hid_t fapl_new, hid_t fcpl)
FAIL_STACK_ERROR
/* Verify free-space info */
- if(fs_stat.tot_space < (TEST_BLOCK_SIZE1+TEST_BLOCK_SIZE3))
- TEST_ERROR
+ if(fs_stat.tot_space < (TBLOCK_SIZE1+TBLOCK_SIZE3))
+ TEST_ERROR
if(fs_stat.serial_sect_count < 2)
- TEST_ERROR
+ TEST_ERROR
- /* Retrieve block #1 from H5FD_MEM_SUPER free-space manager; block #2 still in free-space */
- if(HADDR_UNDEF == (tmp_addr = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE1)))
- FAIL_STACK_ERROR
+ /* Retrieve block #1 from H5FD_MEM_SUPER free-space manager; block #3 still in free-space */
+ if(HADDR_UNDEF == (tmp_addr = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE1)))
+ FAIL_STACK_ERROR
if(tmp_addr != addr1)
- TEST_ERROR
+ TEST_ERROR
/* Verify that the free-space manager for H5FD_MEM_DRAW is there */
if(!H5F_addr_defined(f->shared->fs_addr[stype]))
TEST_ERROR
/* Start up H5FD_MEM_DRAW free-space manager */
- if(H5MF__alloc_open(f, H5AC_ind_read_dxpl_id, stype) < 0)
+ if(H5MF_open_fstype(f, H5AC_ind_read_dxpl_id, (H5F_mem_page_t)stype) < 0)
FAIL_STACK_ERROR
/* Get free-space info */
@@ -6762,45 +6554,45 @@ test_mf_fs_multi(hid_t fapl_new, hid_t fcpl)
FAIL_STACK_ERROR
/* Verify free-space info */
- if(fs_stat.tot_space < (TEST_BLOCK_SIZE1+TEST_BLOCK_SIZE3))
- TEST_ERROR
+ if(fs_stat.tot_space < (TBLOCK_SIZE1+TBLOCK_SIZE3))
+ TEST_ERROR
if(fs_stat.serial_sect_count < 2)
- TEST_ERROR
+ TEST_ERROR
/* Retrieve blocks #1 from H5FD_MEM_DRAW free-space manager */
- if(HADDR_UNDEF == (tmp_addr = H5MF_alloc(f, stype, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE1)))
- FAIL_STACK_ERROR
+ if(HADDR_UNDEF == (tmp_addr = H5MF_alloc(f, stype, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE1)))
+ FAIL_STACK_ERROR
if(tmp_addr != saddr1)
- TEST_ERROR
+ TEST_ERROR
/* Retrieve blocks #3 from H5FD_MEM_DRAW free-space manager */
- if(HADDR_UNDEF == (tmp_addr = H5MF_alloc(f, stype, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE3)))
- FAIL_STACK_ERROR
+ if(HADDR_UNDEF == (tmp_addr = H5MF_alloc(f, stype, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE3)))
+ FAIL_STACK_ERROR
if(tmp_addr != saddr3)
- TEST_ERROR
+ TEST_ERROR
/* Allocate 4 blocks of type H5FD_MEM_BTREE */
btype = H5FD_MEM_BTREE;
- if(HADDR_UNDEF == (baddr1 = H5MF_alloc(f, btype, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE1)))
- FAIL_STACK_ERROR
- if(HADDR_UNDEF == (baddr2 = H5MF_alloc(f, btype, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE2)))
- FAIL_STACK_ERROR
- if(HADDR_UNDEF == (baddr3 = H5MF_alloc(f, btype, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE3)))
- FAIL_STACK_ERROR
- if(HADDR_UNDEF == (baddr4 = H5MF_alloc(f, btype, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE4)))
- FAIL_STACK_ERROR
+ if(HADDR_UNDEF == (baddr1 = H5MF_alloc(f, btype, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE1)))
+ FAIL_STACK_ERROR
+ if(HADDR_UNDEF == (baddr2 = H5MF_alloc(f, btype, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE2)))
+ FAIL_STACK_ERROR
+ if(HADDR_UNDEF == (baddr3 = H5MF_alloc(f, btype, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE3)))
+ FAIL_STACK_ERROR
+ if(HADDR_UNDEF == (baddr4 = H5MF_alloc(f, btype, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE4)))
+ FAIL_STACK_ERROR
/* Put block #1 & #3 into H5FD_MEM_BTREE free-space manager */
- if(H5MF_xfree(f, btype, H5AC_ind_read_dxpl_id, baddr1, (hsize_t)TEST_BLOCK_SIZE1) < 0)
- FAIL_STACK_ERROR
- if(H5MF_xfree(f, btype, H5AC_ind_read_dxpl_id, baddr3, (hsize_t)TEST_BLOCK_SIZE3) < 0)
- FAIL_STACK_ERROR
+ if(H5MF_xfree(f, btype, H5AC_ind_read_dxpl_id, baddr1, (hsize_t)TBLOCK_SIZE1) < 0)
+ FAIL_STACK_ERROR
+ if(H5MF_xfree(f, btype, H5AC_ind_read_dxpl_id, baddr3, (hsize_t)TBLOCK_SIZE3) < 0)
+ FAIL_STACK_ERROR
if(H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0)
+ if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
@@ -6812,7 +6604,7 @@ test_mf_fs_multi(hid_t fapl_new, hid_t fcpl)
TEST_ERROR
/* Start up H5FD_MEM_SUPER free-space manager */
- if(H5MF__alloc_open(f, H5AC_ind_read_dxpl_id, type) < 0)
+ if(H5MF_open_fstype(f, H5AC_ind_read_dxpl_id, (H5F_mem_page_t)type) < 0)
FAIL_STACK_ERROR
/* Get free-space info */
@@ -6820,14 +6612,14 @@ test_mf_fs_multi(hid_t fapl_new, hid_t fcpl)
FAIL_STACK_ERROR
/* Verify free-space info */
- if(fs_stat.tot_space < TEST_BLOCK_SIZE3)
- TEST_ERROR
+ if(fs_stat.tot_space < TBLOCK_SIZE3)
+ TEST_ERROR
/* Retrieve block #3 from H5FD_MEM_SUPER free-space manager */
- if(HADDR_UNDEF == (tmp_addr = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE3)))
- FAIL_STACK_ERROR
+ if(HADDR_UNDEF == (tmp_addr = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE3)))
+ FAIL_STACK_ERROR
if(tmp_addr != addr3)
- TEST_ERROR
+ TEST_ERROR
/* Verify that the free-space manager for H5FD_MEM_DRAW is not there */
if(H5F_addr_defined(f->shared->fs_addr[stype]))
@@ -6838,7 +6630,7 @@ test_mf_fs_multi(hid_t fapl_new, hid_t fcpl)
TEST_ERROR
/* Start up H5FD_MEM_BTREE free-space manager */
- if(H5MF__alloc_open(f, H5AC_ind_read_dxpl_id, btype) < 0)
+ if(H5MF_open_fstype(f, H5AC_ind_read_dxpl_id, (H5F_mem_page_t)btype) < 0)
FAIL_STACK_ERROR
/* Get free-space info */
@@ -6846,27 +6638,27 @@ test_mf_fs_multi(hid_t fapl_new, hid_t fcpl)
FAIL_STACK_ERROR
/* Verify free-space info */
- if(fs_stat.tot_space < (TEST_BLOCK_SIZE1+TEST_BLOCK_SIZE3))
- TEST_ERROR
+ if(fs_stat.tot_space < (TBLOCK_SIZE1+TBLOCK_SIZE3))
+ TEST_ERROR
if(fs_stat.serial_sect_count < 2)
- TEST_ERROR
+ TEST_ERROR
/* Allocate 2 blocks of type H5FD_MEM_GHEAP */
gtype = H5FD_MEM_GHEAP;
- if(HADDR_UNDEF == (gaddr2 = H5MF_alloc(f, gtype, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE2)))
- FAIL_STACK_ERROR
- if(HADDR_UNDEF == (gaddr1 = H5MF_alloc(f, gtype, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE1)))
- FAIL_STACK_ERROR
+ if(HADDR_UNDEF == (gaddr2 = H5MF_alloc(f, gtype, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE2)))
+ FAIL_STACK_ERROR
+ if(HADDR_UNDEF == (gaddr1 = H5MF_alloc(f, gtype, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE1)))
+ FAIL_STACK_ERROR
/* Put block #2 into H5FD_MEM_GHEAP free-space manager */
- if(H5MF_xfree(f, gtype, H5AC_ind_read_dxpl_id, gaddr2, (hsize_t)TEST_BLOCK_SIZE2) < 0)
- FAIL_STACK_ERROR
+ if(H5MF_xfree(f, gtype, H5AC_ind_read_dxpl_id, gaddr2, (hsize_t)TBLOCK_SIZE2) < 0)
+ FAIL_STACK_ERROR
if(H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0)
+ if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
@@ -6875,39 +6667,44 @@ test_mf_fs_multi(hid_t fapl_new, hid_t fcpl)
/* If H5FD_MEM_SUPER is there, should not find block #1 & #3 */
if(H5F_addr_defined(f->shared->fs_addr[type])) {
- /* Start up H5FD_MEM_SUPER free-space manager */
- if(H5MF__alloc_open(f, H5AC_ind_read_dxpl_id, type) < 0)
- FAIL_STACK_ERROR
-
- if((node_found = H5FS_sect_find(f, H5AC_ind_read_dxpl_id, f->shared->fs_man[type],
- (hsize_t)TEST_BLOCK_SIZE1, (H5FS_section_info_t **)&node)) < 0)
- FAIL_STACK_ERROR
- if(node_found) TEST_ERROR
-
- if((node_found = H5FS_sect_find(f, H5AC_ind_read_dxpl_id, f->shared->fs_man[type],
- (hsize_t)TEST_BLOCK_SIZE3, (H5FS_section_info_t **)&node)) < 0)
- FAIL_STACK_ERROR
- if(node_found) TEST_ERROR
+ /* Start up H5FD_MEM_SUPER free-space manager */
+ if(H5MF_open_fstype(f, H5AC_ind_read_dxpl_id, (H5F_mem_page_t)type) < 0)
+ FAIL_STACK_ERROR
+
+ if((node_found = H5FS_sect_find(f, H5AC_ind_read_dxpl_id, f->shared->fs_man[type],
+ (hsize_t)TBLOCK_SIZE1, (H5FS_section_info_t **)&node)) < 0)
+ FAIL_STACK_ERROR
+ if(node_found) TEST_ERROR
+
+ if((node_found = H5FS_sect_find(f, H5AC_ind_read_dxpl_id, f->shared->fs_man[type],
+ (hsize_t)TBLOCK_SIZE3, (H5FS_section_info_t **)&node)) < 0)
+ FAIL_STACK_ERROR
+ if(node_found) TEST_ERROR
}
/* Verify that the H5FD_MEM_GHEAP free-space manager is there */
if(!H5F_addr_defined(f->shared->fs_addr[gtype]))
- TEST_ERROR
+ TEST_ERROR
/* Start up H5FD_MEM_GHEAP free-space manager */
- if(H5MF__alloc_open(f, H5AC_ind_read_dxpl_id, gtype) < 0)
- FAIL_STACK_ERROR
+ if(H5MF_open_fstype(f, H5AC_ind_read_dxpl_id, (H5F_mem_page_t)gtype) < 0)
+ FAIL_STACK_ERROR
/* Get free-space info */
if(H5FS_stat_info(f, f->shared->fs_man[gtype], &fs_stat) < 0)
FAIL_STACK_ERROR
/* Verify free-space info */
- if(fs_stat.tot_space < TEST_BLOCK_SIZE2)
- TEST_ERROR
+ if(fs_stat.tot_space < TBLOCK_SIZE2)
+ TEST_ERROR
+ /* Closing */
if(H5Fclose(file) < 0)
FAIL_STACK_ERROR
+ if(H5Pclose(fapl) < 0)
+ FAIL_STACK_ERROR
+ if(H5Pclose(fcpl) < 0)
+ FAIL_STACK_ERROR
PASSED()
@@ -6915,460 +6712,540 @@ test_mf_fs_multi(hid_t fapl_new, hid_t fcpl)
error:
H5E_BEGIN_TRY {
- H5Fclose(file);
+ H5Fclose(file);
+ H5Pclose(fcpl);
+ H5Pclose(fapl);
} H5E_END_TRY;
return(1);
-} /* test_mf_fs_multi() */
-
-#define MULTI_SETUP(memb_map, memb_fapl, memb_name, memb_addr, sv) { \
- H5FD_mem_t mt; \
- HDmemset(memb_map, 0, sizeof memb_map); \
- HDmemset(memb_fapl, 0, sizeof memb_fapl); \
- HDmemset(memb_name, 0, sizeof memb_name); \
- HDmemset(memb_addr, 0, sizeof memb_addr); \
- HDmemset(sv, 0, sizeof sv); \
- for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, mt)) { \
- memb_map[mt] = H5FD_MEM_SUPER; \
- memb_fapl[mt] = H5P_DEFAULT; \
- } \
- memb_map[H5FD_MEM_BTREE] = H5FD_MEM_BTREE; \
- memb_map[H5FD_MEM_DRAW] = H5FD_MEM_DRAW; \
- memb_map[H5FD_MEM_GHEAP] = H5FD_MEM_GHEAP; \
- memb_map[H5FD_MEM_LHEAP] = H5FD_MEM_LHEAP; \
- sprintf(sv[H5FD_MEM_SUPER], "%%s-%c.h5", 's'); \
- memb_name[H5FD_MEM_SUPER] = sv[H5FD_MEM_SUPER]; \
- memb_addr[H5FD_MEM_SUPER] = 0; \
- sprintf(sv[H5FD_MEM_BTREE], "%%s-%c.h5", 'b'); \
- memb_name[H5FD_MEM_BTREE] = sv[H5FD_MEM_BTREE]; \
- memb_addr[H5FD_MEM_BTREE] = HADDR_MAX/6; \
- sprintf(sv[H5FD_MEM_DRAW], "%%s-%c.h5", 'r'); \
- memb_name[H5FD_MEM_DRAW] = sv[H5FD_MEM_DRAW]; \
- memb_addr[H5FD_MEM_DRAW] = HADDR_MAX/3; \
- sprintf(sv[H5FD_MEM_GHEAP], "%%s-%c.h5", 'g'); \
- memb_name[H5FD_MEM_GHEAP] = sv[H5FD_MEM_GHEAP]; \
- memb_addr[H5FD_MEM_GHEAP] = HADDR_MAX/2; \
- sprintf(sv[H5FD_MEM_LHEAP], "%%s-%c.h5", 'l'); \
- memb_name[H5FD_MEM_LHEAP] = sv[H5FD_MEM_LHEAP]; \
- memb_addr[H5FD_MEM_LHEAP] = HADDR_MAX*2/3; \
- sprintf(sv[H5FD_MEM_OHDR], "%%s-%c.h5", 'o'); \
- memb_name[H5FD_MEM_OHDR] = sv[H5FD_MEM_OHDR]; \
- memb_addr[H5FD_MEM_OHDR] = HADDR_MAX*5/6; \
-}
+} /* test_mf_fs_persist_multi() */
/*
- * Tests to verify that file's free-space managers are persistent or going away
- * for different drivers.
+ *-------------------------------------------------------------------------
+ * Verify that the file's free-space persists where there are free sections in the manager
+ *-------------------------------------------------------------------------
*/
static unsigned
-test_mf_fs_drivers(hid_t fapl)
+test_mf_fs_persist(const char *env_h5_drvr, hid_t fapl, hbool_t new_format)
{
- hid_t fcpl = -1; /* file creation property list */
- hid_t fapl_new = -1; /* copy of file access property list */
- hid_t fapl2 = -1; /* copy of file access property list */
- unsigned new_format; /* To use new library format or not */
- unsigned ret = 0; /* return value */
-
- H5FD_mem_t memb_map[H5FD_MEM_NTYPES]; /* Memory usage map */
- hid_t memb_fapl[H5FD_MEM_NTYPES]; /* Member access properties */
- char sv[H5FD_MEM_NTYPES][64]; /* Name generators */
- const char *memb_name[H5FD_MEM_NTYPES]; /* Name generators */
- haddr_t memb_addr[H5FD_MEM_NTYPES]; /* Member starting address */
-
- /* Create a non-standard file-creation template */
- if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
- FAIL_STACK_ERROR
- if(H5Pset_file_space(fcpl, H5F_FILE_SPACE_ALL_PERSIST, (hsize_t)0) < 0)
- TEST_ERROR
-
- /* Copy the file access property list */
- if((fapl2 = H5Pcopy(fapl)) < 0) TEST_ERROR
-
- /* Set the "use the latest version of the format" bounds for creating objects in the file */
- if(H5Pset_libver_bounds(fapl2, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
- TEST_ERROR
-
- /* Test with old and new format */
- for(new_format = FALSE; new_format <= TRUE; new_format++) {
-
- if(new_format)
- HDputs("Testing the following tests for free-space managers with new library format...");
- else
- HDputs("Testing the following tests for free-space managers with old library format...");
-
- /* SEC2 */
- HDputs("Testing free-space manager(s) with sec2 driver");
-
- if((fapl_new = H5Pcopy(new_format ? fapl2 : fapl)) < 0) TEST_ERROR
-
- if(H5Pset_fapl_sec2(fapl_new) < 0)
- FAIL_STACK_ERROR
-
- ret += test_mf_fs_gone(fapl_new, fcpl);
- ret += test_mf_fs_persist(fapl_new, fcpl);
+ hid_t file = -1; /* File ID */
+ hid_t fcpl = -1; /* File creation property list ID */
+ hid_t fapl2 = -1; /* File access property list ID */
+ char filename[FILENAME_LEN]; /* Filename to use */
+ H5F_t *f = NULL; /* Internal file object pointer */
+ H5FD_mem_t type; /* File allocation type */
+ H5FD_mem_t tt; /* File allocation type */
+ H5FS_stat_t fs_stat; /* Information for free-space manager */
+ haddr_t addr1, addr2, addr3, addr4, addr5, addr6; /* File address for H5FD_MEM_SUPER */
+ haddr_t tmp_addr; /* Temporary variable for address */
+
+ if(new_format)
+ TESTING("File's free-space is persistent with new library format")
+ else
+ TESTING("File's free-space is persistent with old library format")
+
+ if(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi")) {
+
+ /* File creation property list template */
+ if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Copy the file access property list */
+ if((fapl2 = H5Pcopy(fapl)) < 0) FAIL_STACK_ERROR
+
+ if(new_format) {
+ /* Latest format */
+ if(H5Pset_libver_bounds(fapl2, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ FAIL_STACK_ERROR
+ /* Set to paged aggregation and persisting free-space */
+ if(H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, TRUE, (hsize_t)1) < 0)
+ TEST_ERROR
+ } else {
+ /* Setting: aggregation with persisting free-space */
+ if(H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_FSM_AGGR, TRUE, (hsize_t)1) < 0)
+ TEST_ERROR
+ }
- h5_clean_files(FILENAME, fapl_new);
+ /* Set the filename to use for this test (dependent on fapl) */
+ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
+ /* Create the file to work on */
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl2)) < 0)
+ FAIL_STACK_ERROR
- /* STDIO */
- HDputs("Testing free-space managers with stdio driver");
+ /* Get a pointer to the internal file object */
+ if(NULL == (f = (H5F_t *)H5I_object(file)))
+ FAIL_STACK_ERROR
- if((fapl_new = H5Pcopy(new_format?fapl2:fapl)) < 0)
- FAIL_STACK_ERROR
- if(H5Pset_fapl_stdio(fapl_new) < 0)
- FAIL_STACK_ERROR
+ /* Allocate 6 blocks */
+ type = H5FD_MEM_SUPER;
+ if(HADDR_UNDEF == (addr1 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE1)))
+ FAIL_STACK_ERROR
+ if(HADDR_UNDEF == (addr2 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE2)))
+ FAIL_STACK_ERROR
+ if(HADDR_UNDEF == (addr3 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE3)))
+ FAIL_STACK_ERROR
+ if(HADDR_UNDEF == (addr4 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE4)))
+ FAIL_STACK_ERROR
+ if(HADDR_UNDEF == (addr5 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE5)))
+ FAIL_STACK_ERROR
+ if(HADDR_UNDEF == (addr6 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE6)))
+ FAIL_STACK_ERROR
- ret += test_mf_fs_gone(fapl_new, fcpl);
- ret += test_mf_fs_persist(fapl_new, fcpl);
+ /* Put block #1, #3, #5 to H5FD_MEM_SUPER free-space manager */
+ if(H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr1, (hsize_t)TBLOCK_SIZE1) < 0)
+ FAIL_STACK_ERROR
+ if(H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr3, (hsize_t)TBLOCK_SIZE3) < 0)
+ FAIL_STACK_ERROR
+ if(H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr5, (hsize_t)TBLOCK_SIZE5) < 0)
+ FAIL_STACK_ERROR
- h5_clean_files(FILENAME, fapl_new);
+ if(H5Fclose(file) < 0)
+ FAIL_STACK_ERROR
- /* CORE */
- HDputs("Testing free-space managers with core driver");
+ /* Re-open the file */
+ if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl2)) < 0)
+ FAIL_STACK_ERROR
- /* create fapl to be a "core" file */
- if((fapl_new = H5Pcopy(new_format?fapl2:fapl)) < 0)
- FAIL_STACK_ERROR
- if(H5Pset_fapl_core(fapl_new, (size_t)CORE_INCREMENT, TRUE) < 0)
- FAIL_STACK_ERROR
+ /* Get a pointer to the internal file object */
+ if(NULL == (f = (H5F_t *)H5I_object(file)))
+ FAIL_STACK_ERROR
- ret += test_mf_fs_gone(fapl_new, fcpl);
- ret += test_mf_fs_persist(fapl_new, fcpl);
+ H5MF_alloc_to_fs_type(f, type, TBLOCK_SIZE6, (H5F_mem_page_t *)&tt);
- h5_clean_files(FILENAME, fapl_new);
+ /* Verify that H5FD_MEM_SUPER free-space manager is there */
+ if(!H5F_addr_defined(f->shared->fs_addr[tt]))
+ TEST_ERROR
- /* FAMILY */
- HDputs("Testing free-space managers with family driver");
+ /* Since we are about to open a self referential free space
+ * manager prior to the first file space allocation / deallocation
+ * call H5MF_tidy_self_referential_fsm_hack() first so as to avoid
+ * assertion failures on the first file space alloc / dealloc.
+ */
+ if((f->shared->first_alloc_dealloc) &&
+ (SUCCEED !=
+ H5MF_tidy_self_referential_fsm_hack(f, H5AC_ind_read_dxpl_id)))
+ FAIL_STACK_ERROR
- if((fapl_new = H5Pcopy(new_format?fapl2:fapl)) < 0)
- FAIL_STACK_ERROR
- if(H5Pset_fapl_family(fapl_new, (hsize_t)FAMILY_SIZE, H5P_DEFAULT) < 0)
- FAIL_STACK_ERROR
+ /* Start up H5FD_MEM_SUPER free-space manager */
+ if(!(f->shared->fs_man[tt]))
+ if(H5MF_open_fstype(f, H5AC_ind_read_dxpl_id, (H5F_mem_page_t)tt) < 0)
+ FAIL_STACK_ERROR
- ret += test_mf_fs_persist(fapl_new, fcpl);
+ /* Get info for free-space manager */
+ if(H5FS_stat_info(f, f->shared->fs_man[tt], &fs_stat) < 0)
+ FAIL_STACK_ERROR
- h5_clean_files(FILENAME, fapl_new);
+ /* Verify free-space info */
+ if(fs_stat.tot_space < (TBLOCK_SIZE1+TBLOCK_SIZE3+TBLOCK_SIZE5))
+ TEST_ERROR
- /* SPLIT */
- HDputs("Testing free-space managers with split driver");
+ if(fs_stat.serial_sect_count < 3)
+ TEST_ERROR
- if((fapl_new = H5Pcopy(new_format?fapl2:fapl)) < 0)
- FAIL_STACK_ERROR
- if(H5Pset_fapl_split(fapl_new, "-m.h5", H5P_DEFAULT, "-r.h5", H5P_DEFAULT)<0)
- FAIL_STACK_ERROR
+ /* Retrieve block #3 from H5FD_MEM_SUPER free-space manager */
+ if(HADDR_UNDEF == (tmp_addr = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE3)))
+ FAIL_STACK_ERROR
+ if(tmp_addr != addr3)
+ TEST_ERROR
- ret += test_mf_fs_persist(fapl_new, fcpl);
- ret += test_mf_fs_split(fapl_new, fcpl);
+ /* Retrieve block #1 from H5FD_MEM_SUPER free-space manager */
+ if(HADDR_UNDEF == (tmp_addr = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE1)))
+ FAIL_STACK_ERROR
+ if(tmp_addr != addr1)
+ TEST_ERROR
- h5_clean_files(FILENAME, fapl_new);
+ if(H5Fclose(file) < 0)
+ FAIL_STACK_ERROR
- /* MULTI */
- HDputs("Testing free-space managers with multi driver");
+ /* Re-open the file */
+ if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ FAIL_STACK_ERROR
- MULTI_SETUP(memb_map, memb_fapl, memb_name, memb_addr, sv)
+ /* Get a pointer to the internal file object */
+ if(NULL == (f = (H5F_t *)H5I_object(file)))
+ FAIL_STACK_ERROR
- if((fapl_new = H5Pcopy(new_format?fapl2:fapl)) < 0)
- FAIL_STACK_ERROR
- if(H5Pset_fapl_multi(fapl_new, memb_map, memb_fapl, memb_name, memb_addr, TRUE) < 0)
- TEST_ERROR;
+ /* Verify that H5FD_MEM_SUPER free-space manager is there */
+ if(!H5F_addr_defined(f->shared->fs_addr[tt]))
+ TEST_ERROR
- ret += test_mf_fs_multi(fapl_new, fcpl);
+ /* Retrieve block #5 from H5FD_MEM_SUPER free-space manager */
+ if(HADDR_UNDEF == (tmp_addr = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE5)))
+ FAIL_STACK_ERROR
+ if(tmp_addr != addr5)
+ TEST_ERROR
- h5_clean_files(FILENAME, fapl_new);
+ if(H5Fclose(file) < 0)
+ FAIL_STACK_ERROR
+ if(H5Pclose(fcpl) < 0)
+ FAIL_STACK_ERROR
+ if(H5Pclose(fapl2) < 0)
+ FAIL_STACK_ERROR
- } /* end for new_format */
+ PASSED()
- if(H5Pclose(fcpl) < 0)
- FAIL_STACK_ERROR
- if(H5Pclose(fapl2) < 0)
- FAIL_STACK_ERROR
+ } else {
+ SKIPPED();
+ puts(" Current VFD doesn't support persisting free-space or paged aggregation strategy");
+ }
- return(ret);
+ return(0);
error:
H5E_BEGIN_TRY {
+ H5Fclose(file);
H5Pclose(fcpl);
H5Pclose(fapl2);
- H5Pclose(fapl_new);
} H5E_END_TRY;
return(1);
-} /* test_mf_fs_drivers() */
-
+} /* test_mf_fs_persist() */
/*
- * Verify that file space management performs according to the
- * file space strategy and free space threshold as specified.
+ *-------------------------------------------------------------------------
+ * Verify free-space are merged/shrunk away
+ *-------------------------------------------------------------------------
*/
static unsigned
-test_filespace_strategy_threshold(hid_t fapl_new)
+test_mf_fs_gone(const char *env_h5_drvr, hid_t fapl, hbool_t new_format)
{
- hid_t file = -1; /* File ID */
- hid_t fcpl = -1; /* File creation property list template */
- char filename[FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5FD_mem_t type; /* File allocation type */
- haddr_t addr1, addr2, addr3, addr4, addr5, addr6; /* File address for H5FD_MEM_SUPER */
- haddr_t tmp_addr; /* Temporary variable for address */
- H5F_file_space_type_t fs_type; /* File space handling strategy */
- hsize_t fs_threshold; /* Free space section threshold */
- hsize_t tot_space, saved_tot_space; /* Total amount of free space */
- hsize_t tot_sect_count, saved_tot_sect_count; /* # of free-space sections */
-
- TESTING("file space strategy and threshold");
+ hid_t file = -1; /* File ID */
+ hid_t fcpl = -1; /* File creation property list */
+ hid_t fapl2 = -1; /* File access property list */
+ char filename[FILENAME_LEN]; /* Filename to use */
+ H5F_t *f = NULL; /* Internal file object pointer */
+ H5FD_mem_t type; /* File allocation type */
+ H5FS_stat_t fs_stat; /* Information for free-space manager */
+ haddr_t addr1, addr2, addr3, addr4; /* File address for H5FD_MEM_SUPER */
+ H5FD_mem_t fs_type;
+ hbool_t contig_addr_vfd;
+ hbool_t ran_H5MF_tidy_self_referential_fsm_hack = FALSE;
+
+ if(new_format)
+ TESTING("File's free-space is going away with new library format")
+ else
+ TESTING("File's free-space is going away with old library format")
+
+ /* Current VFD that does not support contigous address space */
+ contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi"));
- /* Set the filename to use for this test (dependent on fapl) */
- h5_fixname(FILENAME[0], fapl_new, filename, sizeof(filename));
-
- for(fs_threshold = 0; fs_threshold <= TEST_THRESHOLD10; fs_threshold++) {
-
- for(fs_type = H5F_FILE_SPACE_ALL_PERSIST; fs_type < H5F_FILE_SPACE_NTYPES; H5_INC_ENUM(H5F_file_space_type_t, fs_type)) {
-
- /* Create file-creation template */
- if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
- FAIL_STACK_ERROR
-
- /* Set default file space information */
- if(H5Pset_file_space(fcpl, fs_type, fs_threshold) < 0)
- FAIL_STACK_ERROR
-
- /* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl_new)) < 0)
- FAIL_STACK_ERROR
-
- /* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5I_object(file)))
- FAIL_STACK_ERROR
-
- /* Allocate 6 blocks */
- type = H5FD_MEM_SUPER;
- if(HADDR_UNDEF == (addr1 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE1)))
- FAIL_STACK_ERROR
- if(HADDR_UNDEF == (addr2 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE2)))
- FAIL_STACK_ERROR
- if(HADDR_UNDEF == (addr3 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE3)))
- FAIL_STACK_ERROR
- if(HADDR_UNDEF == (addr4 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE4)))
- FAIL_STACK_ERROR
- if(HADDR_UNDEF == (addr5 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE5)))
- FAIL_STACK_ERROR
- if(HADDR_UNDEF == (addr6 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE6)))
- FAIL_STACK_ERROR
-
- /* Put block #1, #3, #5 to H5FD_MEM_SUPER free-space manager */
- if(H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr1, (hsize_t)TEST_BLOCK_SIZE1) < 0)
- FAIL_STACK_ERROR
- if(H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr3, (hsize_t)TEST_BLOCK_SIZE3) < 0)
- FAIL_STACK_ERROR
- if(H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr5, (hsize_t)TEST_BLOCK_SIZE5) < 0)
- FAIL_STACK_ERROR
-
- /* Retrieve the total amount of free space and # of free-space sections */
- if(f->shared->fs_man[type] &&
- H5FS_sect_stats(f->shared->fs_man[type], &saved_tot_space, &saved_tot_sect_count) < 0)
- FAIL_STACK_ERROR
-
- /* H5F_FILE_SPACE_AGGR_VFD and H5F_FILE_SPACE_VFD: should not have free-space manager */
- if(fs_type > H5F_FILE_SPACE_ALL && f->shared->fs_man[type])
- TEST_ERROR
+ if(contig_addr_vfd) {
- /* Close the file */
- if(H5Fclose(file) < 0)
- FAIL_STACK_ERROR
-
- /* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0)
- FAIL_STACK_ERROR
-
- /* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5I_object(file)))
- FAIL_STACK_ERROR
-
- switch(fs_type) {
- case H5F_FILE_SPACE_ALL_PERSIST:
- if(fs_threshold <= TEST_BLOCK_SIZE5) {
- if(!H5F_addr_defined(f->shared->fs_addr[type]))
- TEST_ERROR
-
- /* Open the free-space manager */
- if(H5MF__alloc_open(f, H5AC_ind_read_dxpl_id, type) < 0)
- FAIL_STACK_ERROR
-
- /* Retrieve the total amount of free space and # of free-space sections */
- if(H5FS_sect_stats(f->shared->fs_man[type], &tot_space, &tot_sect_count) < 0)
- FAIL_STACK_ERROR
-
- /* Verify that tot_space should be >= saved_tot_space */
- /* Verify that tot_sect_count should be >= saved_tot_sect_count */
- if(tot_space < saved_tot_space || tot_sect_count < saved_tot_sect_count)
- TEST_ERROR
-
- /* Retrieve block #5 from H5FD_MEM_SUPER free-space manager */
- if(HADDR_UNDEF ==
- (tmp_addr = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE5)))
- FAIL_STACK_ERROR
-
- /* Should be the same as before */
- if(tmp_addr != addr5)
- TEST_ERROR
- } else if(H5F_addr_defined(f->shared->fs_addr[type]))
- TEST_ERROR
- break;
-
- case H5F_FILE_SPACE_ALL:
- case H5F_FILE_SPACE_AGGR_VFD:
- case H5F_FILE_SPACE_VFD:
- if(H5F_addr_defined(f->shared->fs_addr[type]))
- TEST_ERROR
- break;
-
- case H5F_FILE_SPACE_DEFAULT:
- case H5F_FILE_SPACE_NTYPES:
- default:
- TEST_ERROR
- break;
- } /* end switch */
+ /* File creation property list template */
+ if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ FAIL_STACK_ERROR
- /* Closing */
- if(H5Fclose(file) < 0)
- FAIL_STACK_ERROR
- if(H5Pclose(fcpl) < 0)
- FAIL_STACK_ERROR
+ /* Copy the file access property list */
+ if((fapl2 = H5Pcopy(fapl)) < 0) FAIL_STACK_ERROR
- } /* end for fs_type */
- } /* end for fs_threshold */
+ if(new_format)
+ if(H5Pset_libver_bounds(fapl2, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ FAIL_STACK_ERROR
- PASSED()
+ /* Set to aggregation and persisting free-space */
+ if(H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_FSM_AGGR, TRUE, (hsize_t)1) < 0)
+ FAIL_STACK_ERROR
+
+ /* Set the filename to use for this test (dependent on fapl) */
+ h5_fixname(FILENAME[0], fapl2, filename, sizeof(filename));
+
+ /* Create the file to work on */
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl2)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Get a pointer to the internal file object */
+ if(NULL == (f = (H5F_t *)H5I_object(file)))
+ FAIL_STACK_ERROR
+
+ /* Allocate 4 blocks */
+ type = H5FD_MEM_SUPER;
+ if(HADDR_UNDEF == (addr1 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE1)))
+ FAIL_STACK_ERROR
+ if(HADDR_UNDEF == (addr2 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE2)))
+ FAIL_STACK_ERROR
+ if(HADDR_UNDEF == (addr3 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE3)))
+ FAIL_STACK_ERROR
+ if(HADDR_UNDEF == (addr4 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE4)))
+ FAIL_STACK_ERROR
+
+ /* Put block #1, #3 to H5FD_MEM_SUPER free-space manager */
+ if(H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr1, (hsize_t)TBLOCK_SIZE1) < 0)
+ FAIL_STACK_ERROR
+ if(H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr3, (hsize_t)TBLOCK_SIZE3) < 0)
+ FAIL_STACK_ERROR
+
+ /* Retrieve block #1, #3 from H5FD_MEM_SUPER free-space manager */
+ if(HADDR_UNDEF == (addr3 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE3)))
+ FAIL_STACK_ERROR
+ if(HADDR_UNDEF == (addr1 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE1)))
+ FAIL_STACK_ERROR
+
+ if(H5Fclose(file) < 0)
+ FAIL_STACK_ERROR
+
+ /* Re-open the file */
+ if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl2)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Get a pointer to the internal file object */
+ if(NULL == (f = (H5F_t *)H5I_object(file)))
+ FAIL_STACK_ERROR
+
+ H5MF_alloc_to_fs_type(f, 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]))
+ TEST_ERROR
+
+ /* Put block #3 to H5FD_MEM_SUPER free-space manager */
+ if(H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr3, (hsize_t)TBLOCK_SIZE3) < 0)
+ FAIL_STACK_ERROR
+
+ if(H5Fclose(file) < 0)
+ FAIL_STACK_ERROR
+
+ /* Re-open the file */
+ if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl2)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Get a pointer to the internal file object */
+ if(NULL == (f = (H5F_t *)H5I_object(file)))
+ FAIL_STACK_ERROR
+
+ /* Verify that H5FD_MEM_SUPER free-space manager is there */
+ if(!H5F_addr_defined(f->shared->fs_addr[fs_type]))
+ TEST_ERROR
+
+ /* Since we are about to open a self referential free space
+ * manager prior to the first file space allocation / deallocation
+ * call H5MF_tidy_self_referential_fsm_hack() first so as to avoid
+ * assertion failures on the first file space alloc / dealloc.
+ */
+ if(f->shared->first_alloc_dealloc){
+ if(SUCCEED!=H5MF_tidy_self_referential_fsm_hack(f,H5AC_ind_read_dxpl_id))
+ FAIL_STACK_ERROR
+ ran_H5MF_tidy_self_referential_fsm_hack = TRUE;
+ }
+
+ /* Start up H5FD_MEM_SUPER free-space manager */
+ if(!(f->shared->fs_man[fs_type]))
+ if(H5MF_open_fstype(f, H5AC_ind_read_dxpl_id, (H5F_mem_page_t)fs_type) < 0)
+ FAIL_STACK_ERROR
+
+ /* Get info for H5FD_MEM_SUPER free-space manager */
+ if(H5FS_stat_info(f, f->shared->fs_man[fs_type], &fs_stat) < 0)
+ FAIL_STACK_ERROR
+
+ /* if we ran H5MF_tidy_self_referential_fsm_hack(), the
+ * H5FD_MEM_SUPER free space manager must be floating.
+ * Thus fs_stat.addr must be undefined.
+ */
+ if((!ran_H5MF_tidy_self_referential_fsm_hack) &&
+ (!H5F_addr_defined(fs_stat.addr)))
+ TEST_ERROR
+
+ if(fs_stat.tot_space < TBLOCK_SIZE3)
+ TEST_ERROR
+
+ /* Put block #4 to H5FD_MEM_SUPER free-space manager */
+ if(H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr4, (hsize_t)TBLOCK_SIZE4) < 0)
+ FAIL_STACK_ERROR
+
+ /* The H5FD_MEM_SUPER free-space manager will go away at H5MF_close() */
+ if(H5Fclose(file) < 0)
+ FAIL_STACK_ERROR
+
+ /* Re-open the file */
+ if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl2)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Get a pointer to the internal file object */
+ if(NULL == (f = (H5F_t *)H5I_object(file)))
+ FAIL_STACK_ERROR
+
+ /* Verify that the H5FD_MEM_SUPER free-space manager is not there */
+ if(H5F_addr_defined(f->shared->fs_addr[fs_type]))
+ TEST_ERROR
+
+ /* Closing */
+ if(H5Fclose(file) < 0)
+ FAIL_STACK_ERROR
+ if(H5Pclose(fcpl) < 0)
+ FAIL_STACK_ERROR
+ if(H5Pclose(fapl2) < 0)
+ FAIL_STACK_ERROR
+
+ PASSED()
+
+ } else {
+ SKIPPED();
+ puts(" Current VFD doesn't support persistent free-space manager");
+ }
return(0);
error:
H5E_BEGIN_TRY {
- H5Pclose(fcpl);
H5Fclose(file);
+ H5Pclose(fcpl);
+ H5Pclose(fapl2);
} H5E_END_TRY;
return(1);
-} /* test_filespace_strategy_threshold() */
+} /* test_mf_fs_gone() */
/*
- * Verify section is merged/shrunk away for
- * H5F_FILE_SPACE_ALL_PERSIST and H5F_FILE_SPACE_ALL strategy.
+ *-------------------------------------------------------------------------
+ * Verify that free-space persist with combinations of
+ * file space strategy and free space threshold as specified.
+ *-------------------------------------------------------------------------
*/
static unsigned
-test_filespace_gone(hid_t fapl_new)
+test_mf_strat_thres_persist(const char *env_h5_drvr, hid_t fapl, hbool_t new_format)
{
- hid_t file = -1; /* File ID */
- hid_t fcpl = -1; /* File creation propertly list template */
- char filename[FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5FD_mem_t type; /* File allocation type */
- haddr_t addr1, addr2, addr3, addr4, addr5, addr6; /* File address for H5FD_MEM_SUPER */
- H5F_file_space_type_t fs_type; /* File space handling strategy */
- hsize_t fs_threshold; /* Free space section threshold */
- frspace_state_t state; /* State of free space manager */
-
- TESTING("file space merge/shrink for section size < threshold");
+ hid_t file = -1; /* File ID */
+ hid_t fcpl = -1; /* File creation property list template */
+ hid_t fapl2 = -1; /* File access property list template */
+ char filename[FILENAME_LEN]; /* Filename to use */
+ H5F_t *f = NULL; /* Internal file object pointer */
+ H5FD_mem_t type; /* File allocation type */
+ H5FD_mem_t tt; /* File allocation type */
+ haddr_t addr1, addr2, addr3, addr4, addr5, addr6; /* File address for H5FD_MEM_SUPER */
+ H5F_fspace_strategy_t fs_type; /* File space handling strategy */
+ hsize_t fs_threshold; /* Free-space section threshold */
+ unsigned fs_persist; /* To persist free-space or not */
+ hbool_t contig_addr_vfd;
+
+ if(new_format)
+ TESTING("File space strategy/persisting/threshold with new library format")
+ else
+ TESTING("File space strategy/persisting/threshold with old library format")
+
+ /* Current VFD that does not support contigous address space */
+ contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi"));
+
/* Set the filename to use for this test (dependent on fapl) */
- h5_fixname(FILENAME[0], fapl_new, filename, sizeof(filename));
-
- /* Set free-space threshold */
- fs_threshold = TEST_THRESHOLD3;
-
- for(fs_type = H5F_FILE_SPACE_ALL_PERSIST; fs_type <= H5F_FILE_SPACE_ALL; H5_INC_ENUM(H5F_file_space_type_t, fs_type)) {
- /* Create file-creation template */
- if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
- FAIL_STACK_ERROR
-
- /* Set default file space information */
- if(H5Pset_file_space(fcpl, fs_type, fs_threshold) < 0)
- FAIL_STACK_ERROR
-
- /* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl_new)) < 0)
- FAIL_STACK_ERROR
-
- /* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5I_object(file)))
- FAIL_STACK_ERROR
-
- /* Allocate 6 blocks */
- type = H5FD_MEM_SUPER;
- if(HADDR_UNDEF == (addr1 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE1)))
- FAIL_STACK_ERROR
- if(HADDR_UNDEF == (addr2 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE2)))
- FAIL_STACK_ERROR
- if(HADDR_UNDEF == (addr3 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE3)))
- FAIL_STACK_ERROR
- if(HADDR_UNDEF == (addr4 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE4)))
- FAIL_STACK_ERROR
- if(HADDR_UNDEF == (addr5 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE5)))
- FAIL_STACK_ERROR
- if(HADDR_UNDEF == (addr6 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE6)))
- FAIL_STACK_ERROR
-
- /* Put block #3, #5 to H5FD_MEM_SUPER free-space manager */
- if(H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr3, (hsize_t)TEST_BLOCK_SIZE3) < 0)
- FAIL_STACK_ERROR
- if(H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr5, (hsize_t)TEST_BLOCK_SIZE5) < 0)
- FAIL_STACK_ERROR
-
- HDmemset(&state, 0, sizeof(frspace_state_t));
- state.tot_space += TEST_BLOCK_SIZE3 + TEST_BLOCK_SIZE5;
- state.tot_sect_count += 2;
- state.serial_sect_count += 2;
-
- if(check_stats(f, f->shared->fs_man[type], &state))
- TEST_ERROR
-
- /* section #2 is less than threshold but is merged into section #3 */
- if(H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr2, (hsize_t)TEST_BLOCK_SIZE2) < 0)
- FAIL_STACK_ERROR
-
- state.tot_space += TEST_BLOCK_SIZE2;
- if(check_stats(f, f->shared->fs_man[type], &state))
- TEST_ERROR
-
- if(H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr4, (hsize_t)TEST_BLOCK_SIZE4) < 0)
- FAIL_STACK_ERROR
-
- if(H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr6, (hsize_t)TEST_BLOCK_SIZE6) < 0)
- FAIL_STACK_ERROR
-
- /* all sections should be shrunk away except section #1 */
- HDmemset(&state, 0, sizeof(frspace_state_t));
- if(check_stats(f, f->shared->fs_man[type], &state))
- TEST_ERROR
-
- /* section #1 is less than threshold but is shrunk away */
- if(H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr1, (hsize_t)TEST_BLOCK_SIZE1) < 0)
- FAIL_STACK_ERROR
-
- /* free-space manager should be empty */
- HDmemset(&state, 0, sizeof(frspace_state_t));
- if(check_stats(f, f->shared->fs_man[type], &state))
- TEST_ERROR
-
- if(H5Fclose(file) < 0)
- FAIL_STACK_ERROR
-
- /* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0)
- FAIL_STACK_ERROR
-
- /* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5I_object(file)))
- FAIL_STACK_ERROR
-
- /* free-space manager should be empty */
- if(H5F_addr_defined(f->shared->fs_addr[type]))
- TEST_ERROR
-
- if(H5Fclose(file) < 0)
- FAIL_STACK_ERROR
-
- if(H5Pclose(fcpl) < 0)
- FAIL_STACK_ERROR
-
- } /* end for fs_type */
+ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
+
+ /* Copy the file access property list */
+ if((fapl2 = H5Pcopy(fapl)) < 0)
+ FAIL_STACK_ERROR
+
+ if(new_format)
+ if(H5Pset_libver_bounds(fapl2, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ FAIL_STACK_ERROR
+
+ /* Test with TRUE or FALSE for persisting free-space */
+ for(fs_persist = FALSE; fs_persist <= TRUE; fs_persist++) {
+
+ for(fs_threshold = 0; fs_threshold <= TEST_THRESHOLD10; fs_threshold++) {
+
+ /* Testing for H5F_FSPACE_STRATEGY_FSM_AGGR and H5F_FSPACE_STRATEGY_PAGE strategies only */
+ for(fs_type = H5F_FSPACE_STRATEGY_FSM_AGGR; fs_type < H5F_FSPACE_STRATEGY_AGGR; H5_INC_ENUM(H5F_fspace_strategy_t, fs_type)) {
+
+ if(!contig_addr_vfd && (fs_persist || fs_type == H5F_FSPACE_STRATEGY_PAGE))
+ continue;
+
+ /* Create file-creation template */
+ if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Set default file space information */
+ if(H5Pset_file_space_strategy(fcpl, fs_type, (hbool_t)fs_persist, fs_threshold) < 0)
+ FAIL_STACK_ERROR
+
+ /* Create the file to work on */
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl2)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Get a pointer to the internal file object */
+ if(NULL == (f = (H5F_t *)H5I_object(file)))
+ FAIL_STACK_ERROR
+
+ /* Allocate 6 blocks */
+ type = H5FD_MEM_SUPER;
+ if(HADDR_UNDEF == (addr1 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE1)))
+ FAIL_STACK_ERROR
+ if(HADDR_UNDEF == (addr2 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE2)))
+ FAIL_STACK_ERROR
+ if(HADDR_UNDEF == (addr3 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE3)))
+ FAIL_STACK_ERROR
+ if(HADDR_UNDEF == (addr4 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE4)))
+ FAIL_STACK_ERROR
+ if(HADDR_UNDEF == (addr5 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE5)))
+ FAIL_STACK_ERROR
+ if(HADDR_UNDEF == (addr6 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE6)))
+ FAIL_STACK_ERROR
+
+ /* Put block #1, #3, #5 to H5FD_MEM_SUPER free-space manager */
+ if(H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr1, (hsize_t)TBLOCK_SIZE1) < 0)
+ FAIL_STACK_ERROR
+ if(H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr3, (hsize_t)TBLOCK_SIZE3) < 0)
+ FAIL_STACK_ERROR
+ if(H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr5, (hsize_t)TBLOCK_SIZE5) < 0)
+ FAIL_STACK_ERROR
+
+
+ /* Close the file */
+ if(H5Fclose(file) < 0)
+ FAIL_STACK_ERROR
+
+ /* Re-open the file */
+ if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl2)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Get a pointer to the internal file object */
+ if(NULL == (f = (H5F_t *)H5I_object(file)))
+ FAIL_STACK_ERROR
+
+ H5MF_alloc_to_fs_type(f, type, TBLOCK_SIZE6, (H5F_mem_page_t *)&tt);
+
+ /* Get a pointer to the internal file object */
+ if(NULL == (f = (H5F_t *)H5I_object(file)))
+ FAIL_STACK_ERROR
+
+ if(f->shared->fs_persist) {
+ 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
+
+ /* Verify no free-space sections */
+ /* paged aggregation has 1 section for last_small */
+ if(fs_threshold > TBLOCK_SIZE5 && nsects && fs_type != H5F_FSPACE_STRATEGY_PAGE)
+ TEST_ERROR
+
+ if(nsects) {
+ /* Allocate storage for the free space section information */
+ 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)
+ TEST_ERROR
+ if(sect_info)
+ HDfree(sect_info);
+ }
+ } else {
+ if(H5F_addr_defined(f->shared->fs_addr[tt]))
+ TEST_ERROR
+ }
+
+ /* Closing */
+ if(H5Fclose(file) < 0)
+ FAIL_STACK_ERROR
+ if(H5Pclose(fcpl) < 0)
+ FAIL_STACK_ERROR
+ } /* end for fs_type */
+ } /* end for fs_threshold */
+ } /* end for fs_persist */
+
+ if(H5Pclose(fapl2) < 0)
+ FAIL_STACK_ERROR
PASSED()
@@ -7377,141 +7254,200 @@ test_filespace_gone(hid_t fapl_new)
error:
H5E_BEGIN_TRY {
H5Pclose(fcpl);
+ H5Pclose(fapl2);
H5Fclose(file);
} H5E_END_TRY;
return(1);
-} /* test_filespace_gone() */
+} /* test_mf_strat_thres_persist() */
/*
- * Tests to verify file space management for different drivers.
+ *-------------------------------------------------------------------------
+ * Verify free-space are merged/shrunk away with file space settings:
+ * --strategy, persist/not persist file space
+ *-------------------------------------------------------------------------
*/
static unsigned
-test_filespace_drivers(hid_t fapl)
+test_mf_strat_thres_gone(const char *env_h5_drvr, hid_t fapl, hbool_t new_format)
{
- hid_t fapl_new = -1; /* copy of file access property list */
- hid_t fapl2 = -1; /* copy of file access property list */
- unsigned new_format; /* Using library new format or not */
- unsigned ret = 0; /* return value */
+ hid_t file = -1; /* File ID */
+ hid_t fcpl = -1; /* File creation property list template */
+ hid_t fapl2 = -1; /* File access property list template */
+ char filename[FILENAME_LEN]; /* Filename to use */
+ H5F_t *f = NULL; /* Internal file object pointer */
+ H5FD_mem_t type; /* File allocation type */
+ H5FD_mem_t tt; /* File allocation type */
+ haddr_t addr1, addr2, addr3, addr4, addr5, addr6; /* File address for H5FD_MEM_SUPER */
+ H5F_fspace_strategy_t fs_type; /* File space handling strategy */
+ unsigned fs_persist; /* To persist free-space or not */
+ H5FS_stat_t fs_state; /* Information for free-space manager */
+ H5FS_stat_t fs_state_zero; /* Information for free-space manager */
+ hbool_t contig_addr_vfd;
+
+ if(new_format)
+ TESTING("File space merge/shrink for section size < threshold with new library format")
+ else
+ TESTING("File space merge/shrink for section size < threshold with old library format")
+
+ /* Current VFD that does not support contigous address space */
+ contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi"));
- H5FD_mem_t memb_map[H5FD_MEM_NTYPES]; /* Memory usage map */
- hid_t memb_fapl[H5FD_MEM_NTYPES]; /* Member access properties */
- char sv[H5FD_MEM_NTYPES][64]; /* Name generators */
- const char *memb_name[H5FD_MEM_NTYPES]; /* Name generators */
- haddr_t memb_addr[H5FD_MEM_NTYPES]; /* Member starting address */
- /* Copy the file access property list */
- if((fapl2 = H5Pcopy(fapl)) < 0) TEST_ERROR
+ /* Set the filename to use for this test (dependent on fapl) */
+ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
- /* Set the "use the latest version of the format" bounds for creating objects in the file */
- if(H5Pset_libver_bounds(fapl2, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
- TEST_ERROR
+ HDmemset(&fs_state_zero, 0, sizeof(H5FS_stat_t));
- /* Test with old and new format */
- for(new_format = FALSE; new_format <= TRUE; new_format++) {
+ /* Copy the file access property list */
+ if((fapl2 = H5Pcopy(fapl)) < 0)
+ FAIL_STACK_ERROR
- if(new_format)
- HDputs("Testing the following tests for file space management with new library format...");
- else
- HDputs("Testing the following tests for file space management with old library format...");
+ if(new_format)
+ if(H5Pset_libver_bounds(fapl2, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ FAIL_STACK_ERROR
- /* SEC2 */
- HDputs("Testing file space management with sec2 driver");
+ /* Test with TRUE or FALSE for persisting free-space */
+ for(fs_persist = FALSE; fs_persist <= TRUE; fs_persist++) {
+ /* Testing for H5F_FSPACE_STRATEGY_FSM_AGGR and H5F_FSPACE_STRATEGY_PAGE strategies only */
+ for(fs_type = H5F_FSPACE_STRATEGY_FSM_AGGR; fs_type < H5F_FSPACE_STRATEGY_AGGR; H5_INC_ENUM(H5F_fspace_strategy_t, fs_type)) {
- if((fapl_new = H5Pcopy(new_format?fapl2:fapl)) < 0)
- FAIL_STACK_ERROR
- if(H5Pset_fapl_sec2(fapl_new) < 0)
- FAIL_STACK_ERROR
+ /* Skip for multi/split driver: persisting free-space or paged aggregation strategy */
+ if(!contig_addr_vfd && (fs_persist || fs_type == H5F_FSPACE_STRATEGY_PAGE))
+ continue;
- ret += test_filespace_strategy_threshold(fapl_new);
- ret += test_filespace_gone(fapl_new);
+ /* Clear out free-space statistics */
+ HDmemset(&fs_state, 0, sizeof(H5FS_stat_t));
- h5_clean_files(FILENAME, fapl_new);
+ /* Create file-creation template */
+ if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ FAIL_STACK_ERROR
- /* STDIO */
- HDputs("Testing file space management with stdio driver");
+ /* Set default file space information */
+ if(H5Pset_file_space_strategy(fcpl, fs_type, fs_persist, (hsize_t)TEST_THRESHOLD3) < 0)
+ FAIL_STACK_ERROR
- if((fapl_new = H5Pcopy(new_format?fapl2:fapl)) < 0)
- FAIL_STACK_ERROR
- if(H5Pset_fapl_stdio(fapl_new) < 0)
- FAIL_STACK_ERROR
+ /* Create the file to work on */
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl2)) < 0)
+ FAIL_STACK_ERROR
- ret += test_filespace_strategy_threshold(fapl_new);
- ret += test_filespace_gone(fapl_new);
+ /* Get a pointer to the internal file object */
+ if(NULL == (f = (H5F_t *)H5I_object(file)))
+ FAIL_STACK_ERROR
- h5_clean_files(FILENAME, fapl_new);
+ /* Allocate 6 blocks */
+ type = H5FD_MEM_SUPER;
+ if(HADDR_UNDEF == (addr1 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE1)))
+ FAIL_STACK_ERROR
+ if(HADDR_UNDEF == (addr2 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE2)))
+ FAIL_STACK_ERROR
+ if(HADDR_UNDEF == (addr3 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE3)))
+ FAIL_STACK_ERROR
+ if(HADDR_UNDEF == (addr4 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE4)))
+ FAIL_STACK_ERROR
+ if(HADDR_UNDEF == (addr5 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE5)))
+ FAIL_STACK_ERROR
+ if(HADDR_UNDEF == (addr6 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE6)))
+ FAIL_STACK_ERROR
- /* CORE */
- HDputs("Testing file space management with core driver");
+ H5MF_alloc_to_fs_type(f, type, TBLOCK_SIZE6, (H5F_mem_page_t *)&tt);
- /* create fapl to be a "core" file */
- if((fapl_new = H5Pcopy(new_format?fapl2:fapl)) < 0)
- FAIL_STACK_ERROR
- if(H5Pset_fapl_core(fapl_new, (size_t)CORE_INCREMENT, TRUE) < 0)
- FAIL_STACK_ERROR
+ /* 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(H5FS_stat_info(f, f->shared->fs_man[tt], &fs_state) < 0)
+ FAIL_STACK_ERROR
+ }
- ret += test_filespace_strategy_threshold(fapl_new);
- ret += test_filespace_gone(fapl_new);
+ /* Put block #3, #5 to H5FD_MEM_SUPER free-space manager */
+ if(H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr3, (hsize_t)TBLOCK_SIZE3) < 0)
+ FAIL_STACK_ERROR
+ if(H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr5, (hsize_t)TBLOCK_SIZE5) < 0)
+ FAIL_STACK_ERROR
- h5_clean_files(FILENAME, fapl_new);
+ fs_state.tot_space += TBLOCK_SIZE3 + TBLOCK_SIZE5;
+ fs_state.tot_sect_count += 2;
+ fs_state.serial_sect_count += 2;
- /* FAMILY */
- HDputs("Testing file space managers with family driver");
+ if(check_stats(f, f->shared->fs_man[tt], &fs_state))
+ TEST_ERROR
- if((fapl_new = H5Pcopy(new_format?fapl2:fapl)) < 0)
- FAIL_STACK_ERROR
- if(H5Pset_fapl_family(fapl_new, (hsize_t)FAMILY_SIZE, H5P_DEFAULT) < 0)
- FAIL_STACK_ERROR
+ /* section #2 is less than threshold but is merged into section #3 */
+ if(H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr2, (hsize_t)TBLOCK_SIZE2) < 0)
+ FAIL_STACK_ERROR
- ret += test_filespace_strategy_threshold(fapl_new);
- ret += test_filespace_gone(fapl_new);
+ fs_state.tot_space += TBLOCK_SIZE2;
+ if(check_stats(f, f->shared->fs_man[tt], &fs_state))
+ TEST_ERROR
- h5_clean_files(FILENAME, fapl_new);
+ if(H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr4, (hsize_t)TBLOCK_SIZE4) < 0)
+ FAIL_STACK_ERROR
+ if(H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr6, (hsize_t)TBLOCK_SIZE6) < 0)
+ FAIL_STACK_ERROR
- /* SPLIT */
- HDputs("Testing file space managers with split driver");
+ /* For paged aggregation, the sections in the page at EOF for small meta fs are merged but are not shrunk away */
+ if(fs_type == H5F_FSPACE_STRATEGY_PAGE) {
+ fs_state.tot_sect_count = fs_state.serial_sect_count = 1;
+ fs_state.tot_space += (TBLOCK_SIZE4 + TBLOCK_SIZE6);
+ }
- if((fapl_new = H5Pcopy(new_format?fapl2:fapl)) < 0)
- FAIL_STACK_ERROR
- if(H5Pset_fapl_split(fapl_new, "-m.h5", H5P_DEFAULT, "-r.h5", H5P_DEFAULT)<0)
- FAIL_STACK_ERROR
+ /* For old format: the sections at EOF are shrunk away */
+ if(check_stats(f, f->shared->fs_man[tt], (fs_type == H5F_FSPACE_STRATEGY_PAGE) ? &fs_state:&fs_state_zero))
+ TEST_ERROR
- ret += test_filespace_strategy_threshold(fapl_new);
- ret += test_filespace_gone(fapl_new);
+ /* section #1 is less than threshold but is shrunk away */
+ if(H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr1, (hsize_t)TBLOCK_SIZE1) < 0)
+ FAIL_STACK_ERROR
- h5_clean_files(FILENAME, fapl_new);
+ /* 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)
+ fs_state.tot_space += TBLOCK_SIZE1;
- /* MULTI */
- HDputs("Testing file space managers with multi driver");
+ /* For old format: the sections at EOF are shrunk away */
+ if(check_stats(f, f->shared->fs_man[tt], (fs_type == H5F_FSPACE_STRATEGY_PAGE) ? &fs_state : &fs_state_zero))
+ TEST_ERROR
- MULTI_SETUP(memb_map, memb_fapl, memb_name, memb_addr, sv)
+ if(H5Fclose(file) < 0)
+ FAIL_STACK_ERROR
- if((fapl_new = H5Pcopy(new_format?fapl2:fapl)) < 0)
- TEST_ERROR
- if(H5Pset_fapl_multi(fapl_new, memb_map, memb_fapl, memb_name, memb_addr, TRUE) < 0)
- TEST_ERROR;
+ /* Re-open the file */
+ if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl2)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Get a pointer to the internal file object */
+ if(NULL == (f = (H5F_t *)H5I_object(file)))
+ FAIL_STACK_ERROR
- ret += test_filespace_strategy_threshold(fapl_new);
- ret += test_filespace_gone(fapl_new);
+ /* Free-space manager should be empty */
+ if(!(fs_type == H5F_FSPACE_STRATEGY_PAGE && fs_persist))
+ if(H5F_addr_defined(f->shared->fs_addr[tt]))
+ TEST_ERROR
- h5_clean_files(FILENAME, fapl_new);
+ /* Closing */
+ if(H5Fclose(file) < 0)
+ FAIL_STACK_ERROR
- } /* end for new_format */
+ if(H5Pclose(fcpl) < 0)
+ FAIL_STACK_ERROR
+ } /* end for fs_type */
+ } /* end for fs_persist */
- if (H5Pclose(fapl2) < 0)
+ if(H5Pclose(fapl2) < 0)
FAIL_STACK_ERROR
- return(ret);
+ PASSED()
+
+ return(0);
error:
H5E_BEGIN_TRY {
- H5Pclose(fapl_new);
+ H5Pclose(fcpl);
H5Pclose(fapl2);
+ H5Fclose(file);
} H5E_END_TRY;
return(1);
-} /* test_filespace_drivers() */
+} /* test_mf_strat_thres_gone() */
/*
+ *-------------------------------------------------------------------------
* To verify that file space is allocated from the corresponding free-space manager
* because H5FD_FLMAP_DICHOTOMY is used as the default free-list mapping.
*
@@ -7530,80 +7466,1388 @@ error:
*
* (9) Allocate the third block (size 30) of type H5FD_MEM_SUPER
* (10) Verify that this third block is not freed block from (8)
+ *-------------------------------------------------------------------------
*/
static unsigned
-test_dichotomy(const char *env_h5_drvr, hid_t fapl)
+test_dichotomy(hid_t fapl)
{
hid_t file = -1; /* File ID */
char filename[FILENAME_LEN]; /* Filename to use */
H5F_t *f = NULL; /* Internal file object pointer */
H5FD_mem_t type, stype;
haddr_t addr1, addr3, saddr1, saddr2;
- hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */
TESTING("Allocation from raw or metadata free-space manager");
- /* Skip test when using VFDs that don't use the metadata aggregator */
+ /* Set the filename to use for this test (dependent on fapl) */
+ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
+
+ /* Create the file to work on */
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Get a pointer to the internal file object */
+ if(NULL == (f = (H5F_t *)H5I_object(file)))
+ FAIL_STACK_ERROR
+
+ /* Allocate the first block of type H5FD_MEM_SUPER */
+ type = H5FD_MEM_SUPER;
+ addr1 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE30);
+
+ /* Allocate the second block of type H5FD_MEM_SUPER */
+ H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE50);
+
+ /* Allocate the first block of type H5FD_MEM_DRAW */
+ stype = H5FD_MEM_DRAW;
+ saddr1 = H5MF_alloc(f, stype, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE30);
+
+ /* Free the first block of type H5FD_MEM_SUPER */
+ H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr1, (hsize_t)TBLOCK_SIZE30);
+
+ /* Allocate the second block of type H5FD_MEM_DRAW */
+ saddr2 = H5MF_alloc(f, stype, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE30);
+
+ /* Verify that saddr1 is not addr1 */
+ if(saddr2 == addr1) TEST_ERROR
+
+ /* Free the first block of type H5FD_MEM_DRAW */
+ H5MF_xfree(f, stype, H5AC_ind_read_dxpl_id, saddr1, (hsize_t)TBLOCK_SIZE30);
+
+ /* Allocate the third block of type H5FD_MEM_SUPER */
+ addr3 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE30);
+
+ /* Verify that addr3 is not saddr1 */
+ if(addr3 == saddr1) TEST_ERROR
+
+ if(H5Fclose(file) < 0)
+ FAIL_STACK_ERROR
+
+ PASSED()
+
+ return(0);
+
+error:
+ H5E_BEGIN_TRY {
+ H5Fclose(file);
+ } H5E_END_TRY;
+ return(1);
+} /* test_dichotomy() */
+
+/*
+ *-------------------------------------------------------------------------
+ * set_multi_split():
+ * Internal routine to set up page-aligned address space for multi/split driver
+ * when testing paged aggregation.
+ *-------------------------------------------------------------------------
+ */
+static int
+set_multi_split(hid_t fapl, hsize_t pagesize, hbool_t multi, hbool_t split)
+{
+ H5FD_mem_t memb_map[H5FD_MEM_NTYPES];
+ hid_t memb_fapl_arr[H5FD_MEM_NTYPES];
+ char *memb_name[H5FD_MEM_NTYPES];
+ haddr_t memb_addr[H5FD_MEM_NTYPES];
+ hbool_t relax;
+ H5FD_mem_t mt;
+
+ HDassert(multi || split);
+
+ HDmemset(memb_name, 0, sizeof memb_name);
+
+ /* Get current split settings */
+ if(H5Pget_fapl_multi(fapl, memb_map, memb_fapl_arr, memb_name, memb_addr, &relax) < 0)
+ TEST_ERROR
+
+ if(split) {
+ /* Set memb_addr aligned */
+ memb_addr[H5FD_MEM_SUPER] = ((memb_addr[H5FD_MEM_SUPER] + pagesize - 1) / pagesize) * pagesize;
+ memb_addr[H5FD_MEM_DRAW] = ((memb_addr[H5FD_MEM_DRAW] + pagesize - 1) / pagesize) * pagesize;
+ } else {
+ /* Set memb_addr aligned */
+ for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, mt))
+ memb_addr[mt] = ((memb_addr[mt] + pagesize - 1) / pagesize) * pagesize;
+ } /* end else */
+
+ /* Set multi driver with new FAPLs */
+ if(H5Pset_fapl_multi(fapl, memb_map, memb_fapl_arr, (const char * const *)memb_name, memb_addr, relax) < 0)
+ TEST_ERROR
+
+ /* Free memb_name */
+ for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, mt))
+ free(memb_name[mt]);
+
+ return 0;
+
+error:
+ return(-1);
+} /* set_multi_split() */
+
+/*-------------------------------------------------------------------------
+ * Function: test_page_alloc_xfree
+ *
+ * Purpose: To verify allocations and de-allocations for large/small
+ * sections are done properly when paged aggregation is enabled.
+ *
+ * Return: Success: 0
+ * Failure: number of errors
+ *
+ * Programmer: Vailin Choi; Jan 2013
+ *
+ *-------------------------------------------------------------------------
+ */
+static unsigned
+test_page_alloc_xfree(const char *env_h5_drvr, hid_t fapl)
+{
+
+ hid_t fid = -1; /* File ID */
+ hid_t fcpl = -1; /* File creation property list */
+ hid_t fapl_new = -1; /* File access property list ID */
+ H5F_t *f = NULL; /* Internal file object pointer */
+ haddr_t addr2, addr3; /* Addresses for small meta data blocks */
+ haddr_t saddr1; /* Addresses for small raw data blocks */
+ haddr_t gaddr1; /* Addresses for large data blocks */
+ hbool_t split = FALSE, multi = FALSE;
+ char filename[FILENAME_LEN]; /* Filename to use */
+ haddr_t found_addr; /* Address of the found section */
+ unsigned fs_persist; /* To persist free-space or not */
+
+ TESTING("Paged aggregation for file space: H5MF_alloc/H5MF_xfree");
+
+ /* Check for split or multi driver */
+ if(!HDstrcmp(env_h5_drvr, "split"))
+ split = TRUE;
+ else if(!HDstrcmp(env_h5_drvr, "multi"))
+ multi = TRUE;
+
+ if(!multi && !split) {
+
+ /* Set the filename to use for this test (dependent on fapl) */
+ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
+
+ if((fapl_new = H5Pcopy(fapl)) < 0) TEST_ERROR
+
+ if(multi || split)
+ if(set_multi_split(fapl_new, 4096, multi, split) < 0)
+ TEST_ERROR;
+
+ /* Test with TRUE or FALSE for persisting free-space */
+ for(fs_persist = FALSE; fs_persist <= TRUE; fs_persist++) {
+ H5F_mem_page_t fs_type;
+
+ /* File creation property list */
+ if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ TEST_ERROR
+
+ /* Set the strategy to paged aggregation */
+ if(H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, fs_persist, (hsize_t)1) < 0)
+ TEST_ERROR
+
+ /* Create the file to work on */
+ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl_new)) < 0)
+ TEST_ERROR
+
+ /* Get a pointer to the internal file object */
+ if(NULL == (f = (H5F_t *)H5I_object(fid)))
+ TEST_ERROR
+
+ /* Allocate 3 small meta data blocks: addr1, addr2, addr3 */
+ H5MF_alloc(f, H5FD_MEM_OHDR, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE30);
+ addr2 = H5MF_alloc(f, H5FD_MEM_OHDR, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE1034);
+ addr3 = H5MF_alloc(f, H5FD_MEM_OHDR, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE50);
+
+ /* Free the block with addr2 */
+ H5MF_xfree(f, H5FD_MEM_OHDR, H5AC_ind_read_dxpl_id, 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);
+
+ /* Verify that the freed block with addr2 is found from the small meta data manager */
+ if(H5MF_find_sect(f, H5FD_MEM_OHDR, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE1034, f->shared->fs_man[fs_type], &found_addr) < 0)
+ TEST_ERROR
+ if(found_addr != addr2)
+ TEST_ERROR
+ } /* end if */
+
+ /* Allocate 2 small raw data blocks: saddr1, saddr2 */
+ saddr1 = H5MF_alloc(f, H5FD_MEM_DRAW, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE30);
+ H5MF_alloc(f, H5FD_MEM_DRAW, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE1034);
+
+ /* Free the block with saddr1 */
+ H5MF_xfree(f, H5FD_MEM_DRAW, H5AC_ind_read_dxpl_id, saddr1, (hsize_t)TBLOCK_SIZE30);
+
+ if(!fs_persist) {
+ /* Verify that the freed block with saddr1 is found from the small raw data manager */
+ if(H5MF_find_sect(f, H5FD_MEM_DRAW, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE30, f->shared->fs_man[H5F_MEM_PAGE_DRAW], &found_addr) < 0)
+ TEST_ERROR
+ if(found_addr != saddr1)
+ TEST_ERROR
+ } /* end if */
+
+ /* Allocate 2 large data blocks: gaddr1, gaddr2 */
+ gaddr1 = H5MF_alloc(f, H5FD_MEM_DRAW, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE5000);
+ H5MF_alloc(f, H5FD_MEM_DRAW, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE8000);
+
+ /* Free the block with gaddr1 */
+ H5MF_xfree(f, H5FD_MEM_DRAW, H5AC_ind_read_dxpl_id, 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);
+
+ /* Verify that the freed block with gaddr1 is found from the large data manager */
+ if(H5MF_find_sect(f, H5FD_MEM_DRAW, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE8192, f->shared->fs_man[fs_type], &found_addr) < 0)
+ TEST_ERROR
+ if(found_addr != gaddr1)
+ TEST_ERROR
+ } /* end if */
+
+ /* Close file */
+ if(H5Fclose(fid) < 0)
+ TEST_ERROR
+
+ /* Close the property list */
+ if(H5Pclose(fcpl) < 0)
+ TEST_ERROR
+
+ if(fs_persist) {
+ /* 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 *)H5I_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);
+ if(!H5F_addr_defined(f->shared->fs_addr[fs_type]))
+ TEST_ERROR
+
+ /* Verify that the small meta data manager is there */
+ H5MF_alloc_to_fs_type(f, 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
+
+ /* Since we are about to open a self referential free space
+ * manager prior to the first file space allocation / deallocation
+ * call H5MF_tidy_self_referential_fsm_hack() first so as to avoid
+ * assertion failures on the first file space alloc / dealloc.
+ */
+ if(f->shared->first_alloc_dealloc){
+ if(SUCCEED!=H5MF_tidy_self_referential_fsm_hack(f,H5AC_ind_read_dxpl_id))
+ FAIL_STACK_ERROR
+ }
+
+ /* Set up to use the small meta data manager */
+ if(!(f->shared->fs_man[fs_type]))
+ if(H5MF_open_fstype(f, H5AC_ind_read_dxpl_id, fs_type) < 0)
+ TEST_ERROR
+
+ /* Verify that the freed block with addr2 is found from the small meta data manager */
+ if(H5MF_find_sect(f, H5FD_MEM_OHDR, H5AC_ind_read_dxpl_id, (hsize_t)(f->shared->fs_page_size-(addr3+TBLOCK_SIZE50)), f->shared->fs_man[fs_type], &found_addr) < 0)
+ TEST_ERROR
+
+ if(found_addr != (addr3+TBLOCK_SIZE50))
+ TEST_ERROR
+
+ /* 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, H5AC_ind_read_dxpl_id, H5F_MEM_PAGE_DRAW) < 0)
+ TEST_ERROR
+
+ /* Verify that the freed block with saddr1 is found from the small raw data manager */
+ if(H5MF_find_sect(f, H5FD_MEM_DRAW, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE30, f->shared->fs_man[H5F_MEM_PAGE_DRAW], &found_addr) < 0)
+ TEST_ERROR
+ if(found_addr != saddr1)
+ TEST_ERROR
+
+ H5MF_alloc_to_fs_type(f, 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 */
+ if(H5MF_open_fstype(f, H5AC_ind_read_dxpl_id, fs_type) < 0)
+ TEST_ERROR
+
+ /* Verify that the freed block with gaddr1 is found from the large data manager */
+ if(H5MF_find_sect(f, H5FD_MEM_DRAW, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE8192, f->shared->fs_man[fs_type], &found_addr) < 0)
+ TEST_ERROR
+ if(found_addr != gaddr1)
+ TEST_ERROR
+
+ /* Close file */
+ if(H5Fclose(fid) < 0)
+ TEST_ERROR
+ } /* end if fs_persist */
+ } /* end for */
+
+ if(H5Pclose(fapl_new) < 0)
+ TEST_ERROR
+
+ PASSED()
+
+ } else {
+ SKIPPED();
+ puts(" Current VFD doesn't support persisting free-space or paged aggregation strategy");
+ }
+
+ return(0);
+
+error:
+ H5E_BEGIN_TRY {
+ H5Fclose(fid);
+ H5Pclose(fcpl);
+ H5Pclose(fapl_new);
+ } H5E_END_TRY;
+ return(1);
+
+} /* test_page_alloc_xfree() */
+
+/*-------------------------------------------------------------------------
+ * Function: test_page_try_shrink
+ *
+ * Purpose: To verify that shrinking via H5MF_try_shrink() work properly
+ * when paged aggregation is enabled.
+ *
+ * Return: Success: 0
+ * Failure: number of errors
+ *
+ * Programmer: Vailin Choi; Jan 2013
+ *
+ *-------------------------------------------------------------------------
+ */
+static unsigned
+test_page_try_shrink(const char *env_h5_drvr, hid_t fapl)
+{
+
+ hid_t fid = -1; /* File ID */
+ hid_t fcpl = -1; /* File creation property list */
+ H5F_t *f = NULL; /* Internal file object pointer */
+ haddr_t addr1; /* Address for small meta data block */
+ haddr_t saddr1; /* Address for small raw data block */
+ haddr_t gaddr1; /* Address for large data block */
+ hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */
+ htri_t status; /* status from shrinking */
+ h5_stat_size_t file_size; /* File size */
+ char filename[FILENAME_LEN]; /* Filename to use */
+
+ TESTING("Paged aggregation for file space: H5MF_try_shrink()");
+
+ /* Current VFD that does not support continuous address space */
+ contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi") );
+
+ if(contig_addr_vfd) {
+
+ /* Set the filename to use for this test (dependent on fapl) */
+ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
+
+ /* File creation property list */
+ if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Set the strategy to paged aggregation */
+ if(H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, FALSE, (hsize_t)1) < 0)
+ FAIL_STACK_ERROR
+
+ /* Create the file to work on */
+ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Get a pointer to the internal file object */
+ if(NULL == (f = (H5F_t *)H5I_object(fid)))
+ FAIL_STACK_ERROR
+
+ /* Allocate a small meta data block with addr1 */
+ addr1 = H5MF_alloc(f, H5FD_MEM_OHDR, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE50);
+
+ /* Try to shrink the block with addr1 */
+ if((status = H5MF_try_shrink(f, H5FD_MEM_OHDR, H5AC_ind_read_dxpl_id, addr1, (hsize_t)TBLOCK_SIZE50)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Couldn't shrink due to the section (remaining space in the page) is in the small meta data free-space manager */
+ if(status == TRUE) TEST_ERROR
+
+ /* Allocate a small raw data block with saddr1 */
+ saddr1 = H5MF_alloc(f, H5FD_MEM_DRAW, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE50);
+
+ /* Try to shrink the block with saddr1 */
+ if((status = H5MF_try_shrink(f, H5FD_MEM_DRAW, H5AC_ind_read_dxpl_id, saddr1, (hsize_t)TBLOCK_SIZE50)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Couldn't shrink due to the section (remaining space in the page) is in the small raw data free-space manager */
+ if(status == TRUE) TEST_ERROR
+
+ /* Allocate a large data block with gaddr1 */
+ gaddr1 = H5MF_alloc(f, H5FD_MEM_DRAW, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE5000);
+
+ /* Try to shrink the block with gaddr1 */
+ if((status = H5MF_try_shrink(f, H5FD_MEM_DRAW, H5AC_ind_read_dxpl_id, gaddr1, (hsize_t)TBLOCK_SIZE5000)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Couldn't shrink due to the section (remaining space in the page) is in the large-sized free-space manager */
+ if(status == TRUE) TEST_ERROR
+
+ /* Free the block with saddr1--merge to become 1 page, then return to the large manager */
+ H5MF_xfree(f, H5FD_MEM_DRAW, H5AC_ind_read_dxpl_id, saddr1, (hsize_t)TBLOCK_SIZE50);
+
+ /* Merge all 3 sections and shrunk */
+ H5MF_xfree(f, H5FD_MEM_OHDR, H5AC_ind_read_dxpl_id, gaddr1, (hsize_t)TBLOCK_SIZE5000);
+
+ if(H5Fclose(fid) < 0)
+ FAIL_STACK_ERROR
+
+ /* Get the size of the file */
+ if((file_size = h5_get_file_size(filename, fapl)) < 0)
+ TEST_ERROR
+
+ /* Should be on page boundary */
+ if(file_size % TBLOCK_SIZE4096)
+ TEST_ERROR
+
+ /* Close the property list */
+ if(H5Pclose(fcpl) < 0)
+ FAIL_STACK_ERROR
+
+ PASSED()
+
+ } else {
+ SKIPPED();
+ puts(" Current VFD doesn't support paged aggregation");
+ }
+
+ return(0);
+
+error:
+ H5E_BEGIN_TRY {
+ H5Fclose(fid);
+ H5Pclose(fcpl);
+ } H5E_END_TRY;
+ return(1);
+
+} /* test_page_try_shrink() */
+
+/*-------------------------------------------------------------------------
+ * Function: test_page_small_try_extend
+ *
+ * Purpose: To verify that extending a small block via H5MF_try_extend() works
+ * properly when paged aggregation is enabled.
+ *
+ * Return: Success: 0
+ * Failure: number of errors
+ *
+ * Programmer: Vailin Choi; Jan 2013
+ *
+ *-------------------------------------------------------------------------
+ */
+static unsigned
+test_page_small_try_extend(const char *env_h5_drvr, hid_t fapl)
+{
+
+ hid_t fid = -1; /* File ID */
+ hid_t fcpl = -1; /* File creation property list */
+ H5F_t *f = NULL; /* Internal file object pointer */
+ haddr_t addr1, addr2, addr3; /* Addresses for small meta data blocks */
+ haddr_t saddr1; /* Address for small raw data block */
+ hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */
+ htri_t was_extended; /* Whether the block can be extended or not */
+ char filename[FILENAME_LEN]; /* Filename to use */
+
+ TESTING("Paged aggregation for file space: H5MF_try_extend() a small block");
+
+ /* Current VFD that does not support continuous address space */
+ contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi") && HDstrcmp(env_h5_drvr, "family"));
+
+ if(contig_addr_vfd) {
+
+ /* Set the filename to use for this test (dependent on fapl) */
+ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
+
+ /* File creation property list */
+ if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Set the strategy to paged aggregation */
+ if(H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, FALSE, (hsize_t)1) < 0)
+ FAIL_STACK_ERROR
+
+ /* Create the file to work on */
+ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Get a pointer to the internal file object */
+ if(NULL == (f = (H5F_t *)H5I_object(fid)))
+ FAIL_STACK_ERROR
+
+ /* Allocate a small meta data block with addr1 */
+ addr1 = H5MF_alloc(f, H5FD_MEM_OHDR, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE98);
+
+ /* Try extending the block with addr1 at EOF not crossing page boundary */
+ was_extended = H5MF_try_extend(f, H5AC_ind_read_dxpl_id, H5FD_MEM_OHDR, (haddr_t)addr1, (hsize_t)TBLOCK_SIZE98, (hsize_t)3100);
+ /* Should succeed */
+ if(was_extended != TRUE) TEST_ERROR
+
+ /* Allocate 2 small meta data blocks with addr2 and addr3--will be on another meta data page */
+ addr2 = H5MF_alloc(f, H5FD_MEM_OHDR, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE100);
+ addr3 = H5MF_alloc(f, H5FD_MEM_OHDR, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE150);
+
+ /* The block with addr2 should be page aligned */
+ /* The block with addr3 resides right next to the block with addr2 */
+ if(addr2 % TBLOCK_SIZE4096)
+ TEST_ERROR
+ if(addr3 != (addr2 + TBLOCK_SIZE100))
+ TEST_ERROR
+
+ /* Free the block with addr2 */
+ H5MF_xfree(f, H5FD_MEM_OHDR, H5AC_ind_read_dxpl_id, addr2, (hsize_t)TBLOCK_SIZE100);
+
+ /* Try extending the block with addr1 that will cross to the next page where the freed block with addr2 resides */
+ was_extended = H5MF_try_extend(f, H5AC_ind_read_dxpl_id, H5FD_MEM_OHDR, (haddr_t)addr1, (hsize_t)TBLOCK_SIZE3198, (hsize_t)TBLOCK_SIZE100);
+ /* Shouldn't succeed--should not cross page boundary */
+ if(was_extended == TRUE) TEST_ERROR
+
+ /* Try extending the block with addr1 into the free-space section that is big enough to fulfill the request */
+ was_extended = H5MF_try_extend(f, H5AC_ind_read_dxpl_id, H5FD_MEM_OHDR, (haddr_t)addr1, (hsize_t)TBLOCK_SIZE3198, (hsize_t)TBLOCK_SIZE50);
+ /* Should succeed */
+ if(was_extended != TRUE) TEST_ERROR
+
+ /* Free the block with addr1 */
+ H5MF_xfree(f, H5FD_MEM_OHDR, H5AC_ind_read_dxpl_id, addr1, (hsize_t)TBLOCK_SIZE3248);
+
+ /* Allocate a new meta data block with addr1 */
+ /* There is a page end threshold of size H5F_FILE_SPACE_PGEND_META_THRES at the end of the block */
+ /* The block is right next to the threshold */
+ addr1 = H5MF_alloc(f, H5FD_MEM_OHDR, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE3286);
+
+ /* Try extending the block into the threshold with size > H5F_FILE_SPACE_PGEND_META_THRES */
+ was_extended = H5MF_try_extend(f, H5AC_ind_read_dxpl_id, H5FD_MEM_OHDR, (haddr_t)addr1, (hsize_t)TBLOCK_SIZE3286, (hsize_t)TBLOCK_SIZE11);
+ /* Shouldn't succeed */
+ if(was_extended == TRUE) TEST_ERROR
+
+ /* Try extending the block into the threshold with size < H5F_FILE_SPACE_PGEND_META_THRES */
+ was_extended = H5MF_try_extend(f, H5AC_ind_read_dxpl_id, H5FD_MEM_OHDR, (haddr_t)addr1, (hsize_t)TBLOCK_SIZE3286, (hsize_t)TBLOCK_SIZE2);
+ /* Should succeed */
+ if(was_extended != TRUE) TEST_ERROR
+
+ /* Free the block with addr3--will merge with the remaining sections to become a page and then free the page */
+ H5MF_xfree(f, H5FD_MEM_OHDR, H5AC_ind_read_dxpl_id, addr3, (hsize_t)TBLOCK_SIZE150);
+
+ /* Allocate a small raw data block with saddr1 */
+ saddr1 = H5MF_alloc(f, H5FD_MEM_DRAW, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE4086);
+
+ /* Try extending the block crossing the page boundary */
+ was_extended = H5MF_try_extend(f, H5AC_ind_read_dxpl_id, H5FD_MEM_DRAW, (haddr_t)saddr1, (hsize_t)TBLOCK_SIZE4086, (hsize_t)TBLOCK_SIZE11);
+ /* Shouldn't succeed */
+ if(was_extended == TRUE) TEST_ERROR
+
+ /* Try extending the block not crossing page boundary */
+ was_extended = H5MF_try_extend(f, H5AC_ind_read_dxpl_id, H5FD_MEM_DRAW, (haddr_t)saddr1, (hsize_t)TBLOCK_SIZE4086, (hsize_t)TBLOCK_SIZE10);
+ /* Should succeed */
+ if(was_extended != TRUE) TEST_ERROR
+
+ /* The extended block is now "large" in size */
+ /* Try extending the block */
+ was_extended = H5MF_try_extend(f, H5AC_ind_read_dxpl_id, H5FD_MEM_DRAW, (haddr_t)saddr1, (hsize_t)TBLOCK_SIZE4096, (hsize_t)TBLOCK_SIZE10);
+ /* Should succeed */
+ if(was_extended != TRUE) TEST_ERROR
+
+ /* Try extending the large-sized block */
+ was_extended = H5MF_try_extend(f, H5AC_ind_read_dxpl_id, H5FD_MEM_DRAW, (haddr_t)saddr1, (hsize_t)TBLOCK_SIZE4106, (hsize_t)TBLOCK_SIZE5000);
+ /* Should not succeed because the mis-aligned fragment in the page is in the large-sized free-space manager */
+ if(was_extended == TRUE) TEST_ERROR
+
+ /* Close the file */
+ if(H5Fclose(fid) < 0)
+ FAIL_STACK_ERROR
+
+ /* Close the property list */
+ if(H5Pclose(fcpl) < 0)
+ FAIL_STACK_ERROR
+
+ PASSED()
+
+ } else {
+ SKIPPED();
+ puts(" Current VFD doesn't support paged aggregation");
+ }
+
+ return(0);
+
+error:
+ H5E_BEGIN_TRY {
+ H5Fclose(fid);
+ H5Pclose(fcpl);
+ } H5E_END_TRY;
+ return(1);
+
+} /* test_page_small_try_extend() */
+
+/*-------------------------------------------------------------------------
+ * Function: test_page_large_try_extend
+ *
+ * Purpose: To verify that extending a large block via H5MF_try_extend()
+ * is done properly when paged aggregation is enabled.
+ *
+ * Return: Success: 0
+ * Failure: number of errors
+ *
+ * Programmer: Vailin Choi; Jan 2013
+ *
+ *-------------------------------------------------------------------------
+ */
+static unsigned
+test_page_large_try_extend(const char *env_h5_drvr, hid_t fapl)
+{
+
+ hid_t fid = -1; /* File ID */
+ hid_t fcpl = -1; /* File creation property list */
+ H5F_t *f = NULL; /* Internal file object pointer */
+ haddr_t gaddr1, gaddr2, gaddr3, gaddr4; /* Addresses for large data blocks */
+ hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */
+ htri_t was_extended; /* Whether the block can be extended or not */
+ char filename[FILENAME_LEN]; /* Filename to use */
+
+ TESTING("Paged aggregation for file space: H5MF_try_extend() a large block");
+
+ /* Current VFD that does not support continuous address space */
contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi"));
+
if(contig_addr_vfd) {
+
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
+ /* File creation property list */
+ if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Set the strategy to paged aggregation */
+ if(H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, FALSE, (hsize_t)1) < 0)
+ FAIL_STACK_ERROR
+
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5I_object(file)))
+ if(NULL == (f = (H5F_t *)H5I_object(fid)))
FAIL_STACK_ERROR
- /* Allocate the first block of type H5FD_MEM_SUPER */
- type = H5FD_MEM_SUPER;
- addr1 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE30);
+ /* Allocate a large data block with gaddr1 */
+ gaddr1 = H5MF_alloc(f, H5FD_MEM_DRAW, H5AC_ind_read_dxpl_id, (hsize_t)6000);
- /* Allocate the second block of type H5FD_MEM_SUPER */
- H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE50);
+ /* Should be page aligned */
+ if(gaddr1 % TBLOCK_SIZE4096)
+ TEST_ERROR
- /* Allocate the first block of type H5FD_MEM_DRAW */
- stype = H5FD_MEM_DRAW;
- saddr1 = H5MF_alloc(f, stype, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE30);
+ /* Extending the block with gaddr1 at EOF to become 2 pages */
+ was_extended = H5MF_try_extend(f, H5AC_ind_read_dxpl_id, H5FD_MEM_DRAW, (haddr_t)gaddr1, (hsize_t)TBLOCK_SIZE6000, (hsize_t)TBLOCK_SIZE2192);
+ /* Should succeed */
+ if(was_extended != TRUE) TEST_ERROR
+
+ /* Allocate a large data block with gaddr2 */
+ gaddr2 = H5MF_alloc(f, H5FD_MEM_DRAW, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE8000);
+ /* Should be page aligned */
+ if(gaddr2 % TBLOCK_SIZE4096)
+ TEST_ERROR
- /* Free the first block of type H5FD_MEM_SUPER */
- H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr1, (hsize_t)TEST_BLOCK_SIZE30);
+ /* Try extending the block with gaddr1 */
+ was_extended = H5MF_try_extend(f, H5AC_ind_read_dxpl_id, H5FD_MEM_DRAW, (haddr_t)gaddr1, (hsize_t)TBLOCK_SIZE8192, (hsize_t)TBLOCK_SIZE50);
+ /* Should not succeed */
+ if(was_extended == TRUE) TEST_ERROR
- /* Allocate the second block of type H5FD_MEM_DRAW */
- saddr2 = H5MF_alloc(f, stype, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE30);
+ /* Allocate a large data block with gaddr3 */
+ gaddr3 = H5MF_alloc(f, H5FD_MEM_DRAW, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE8000);
+ /* Should be page aligned */
+ if(gaddr3 % TBLOCK_SIZE4096)
+ TEST_ERROR
- /* Verify that saddr1 is not addr1 */
- if(saddr2 == addr1) TEST_ERROR
+ /* Try extending the block with gaddr2--there is a free-space section big enough to fulfill the request */
+ was_extended = H5MF_try_extend(f, H5AC_ind_read_dxpl_id, H5FD_MEM_DRAW, (haddr_t)gaddr2, (hsize_t)TBLOCK_SIZE8000, (hsize_t)TBLOCK_SIZE100);
+ /* Should succeed */
+ if(was_extended == FALSE) TEST_ERROR
- /* Free the first block of type H5FD_MEM_DRAW */
- H5MF_xfree(f, stype, H5AC_ind_read_dxpl_id, saddr1, (hsize_t)TEST_BLOCK_SIZE30);
+ /* Try extending the block with gaddr2--there is no free-space section big enough to fulfill the request */
+ was_extended = H5MF_try_extend(f, H5AC_ind_read_dxpl_id, H5FD_MEM_DRAW, (haddr_t)gaddr2, (hsize_t)TBLOCK_SIZE8100, (hsize_t)TBLOCK_SIZE100);
+ /* Should not succeed */
+ if(was_extended == TRUE) TEST_ERROR
- /* Allocate the third block of type H5FD_MEM_SUPER */
- addr3 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)TEST_BLOCK_SIZE30);
+ /* Try extending the block with gaddr2--there is a free-space section big enough to fulfill the request */
+ was_extended = H5MF_try_extend(f, H5AC_ind_read_dxpl_id, H5FD_MEM_DRAW, (haddr_t)gaddr2, (hsize_t)TBLOCK_SIZE8100, (hsize_t)TBLOCK_SIZE90);
+ /* Should succeed */
+ if(was_extended == FALSE) TEST_ERROR
- /* Verify that addr3 is not saddr1 */
- if(addr3 == saddr1) TEST_ERROR
+ /* Try extending the block with gaddr2 */
+ /* There is no free-space section big enough to fulfill the request (request is < H5F_FILE_SPACE_PGEND_META_THRES) */
+ was_extended = H5MF_try_extend(f, H5AC_ind_read_dxpl_id, H5FD_MEM_DRAW, (haddr_t)gaddr2, (hsize_t)TBLOCK_SIZE8190, (hsize_t)TBLOCK_SIZE5);
+ /* Should not succeed */
+ if(was_extended == TRUE) TEST_ERROR
- if(H5Fclose(file) < 0)
+ /* Allocate a large data block with gaddr4 */
+ gaddr4 = H5MF_alloc(f, H5FD_MEM_DRAW, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE5000);
+ /* Should be page aligned */
+ if(gaddr4 % TBLOCK_SIZE4096)
+ TEST_ERROR
+
+ /* Free the block with gaddr3--will merge with remaining free space to become 2 pages + section (size 2) in previous page */
+ H5MF_xfree(f, H5FD_MEM_DRAW, H5AC_ind_read_dxpl_id, gaddr3, (hsize_t)TBLOCK_SIZE8000);
+
+ /* Try extending the block with gaddr2 crossing page boundary--there is free-space section big enough to fulfill the request */
+ was_extended = H5MF_try_extend(f, H5AC_ind_read_dxpl_id, H5FD_MEM_DRAW, (haddr_t)gaddr2, (hsize_t)TBLOCK_SIZE8190, (hsize_t)TBLOCK_SIZE5);
+ /* Should succeed */
+ if(was_extended == FALSE) TEST_ERROR
+
+ /* Close file */
+ if(H5Fclose(fid) < 0)
+ FAIL_STACK_ERROR
+
+ /* Close the property list */
+ if(H5Pclose(fcpl) < 0)
FAIL_STACK_ERROR
PASSED()
- } /* end if */
- else {
- SKIPPED();
- puts(" Current VFD doesn't support metadata aggregator");
- } /* end else */
+
+ } else {
+ SKIPPED();
+ puts(" Current VFD doesn't support paged aggregation strategy");
+ }
return(0);
error:
H5E_BEGIN_TRY {
- H5Fclose(file);
+ H5Fclose(fid);
+ H5Pclose(fcpl);
} H5E_END_TRY;
return(1);
-} /* test_dichotomy() */
+
+} /* test_page_large_try_extend() */
+
+/*-------------------------------------------------------------------------
+ * Function: test_page_large
+ *
+ * Purpose: To verify that allocations and de-allocations for large data
+ * are done properly when paged aggregation is enabled.
+ *
+ * Return: Success: 0
+ * Failure: number of errors
+ *
+ * Programmer: Vailin Choi; Jan 2013
+ *
+ *-------------------------------------------------------------------------
+ */
+static unsigned
+test_page_large(const char *env_h5_drvr, hid_t fapl)
+{
+
+ hid_t fid = -1; /* File ID */
+ hid_t fcpl = -1; /* File creation property list ID */
+ H5F_t *f = NULL; /* Internal file object pointer */
+ haddr_t gaddr1, gaddr2, gaddr3, gaddr4; /* Addresses for blocks */
+ hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */
+ H5FS_stat_t fs_stat; /* Information for free-space manager */
+ h5_stat_size_t file_size; /* File size */
+ char filename[FILENAME_LEN]; /* Filename to use */
+
+ TESTING("Paged aggregation for file space: large allocations and de-allocations");
+
+ /* Current VFD that does not support continuous address space */
+ contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi"));
+
+ if(contig_addr_vfd) {
+
+ /* Set the filename to use for this test (dependent on fapl) */
+ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
+
+ /* File creation property list */
+ if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Set the strategy to paged aggregation */
+ if(H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, FALSE, (hsize_t)1) < 0)
+ FAIL_STACK_ERROR
+
+ /* Create the file to work on */
+ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Get a pointer to the internal file object */
+ if(NULL == (f = (H5F_t *)H5I_object(fid)))
+ FAIL_STACK_ERROR
+
+ /* Allocate a large data block with gaddr1 */
+ /* 1 page + 1904 bytes; 2192 bytes in free-space manager */
+ gaddr1 = H5MF_alloc(f, H5FD_MEM_DRAW, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE6000);
+
+ /* Should be page aligned */
+ if(gaddr1 % TBLOCK_SIZE4096)
+ TEST_ERROR
+
+ /* Allocate a large data block with gaddr2--should be on another page */
+ /* Allocate 1 page + 3904 bytes; 192 bytes in free-space manager */
+ gaddr2 = H5MF_alloc(f, H5FD_MEM_DRAW, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE8000);
+ /* Should be page aligned */
+ if(gaddr2 % TBLOCK_SIZE4096)
+ TEST_ERROR
+
+ /* Allocate a large data block with gaddr3--should be on another page */
+ /* Allocate 2 pages + 3808 bytes; 288 bytes in free-space manager */
+ gaddr3 = H5MF_alloc(f, H5FD_MEM_DRAW, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE12000);
+ if(!H5F_addr_defined(gaddr3))
+ TEST_ERROR
+
+ /* Free the block with gaddr2 */
+ /* Merged sections: 2192 + 8000 + 192 = 10384 */
+ H5MF_xfree(f, H5FD_MEM_DRAW, H5AC_ind_read_dxpl_id, gaddr2, (hsize_t)TBLOCK_SIZE8000);
+
+ /* Get free-space info */
+ if(H5FS_stat_info(f, f->shared->fs_man[H5F_MEM_PAGE_GENERIC], &fs_stat) < 0)
+ FAIL_STACK_ERROR
+
+ /* Verify that the manager contains 2 free-space sections: 10384 and 288 */
+ if(fs_stat.tot_sect_count != 2)
+ TEST_ERROR
+ if(fs_stat.tot_space != (10384+288))
+ TEST_ERROR
+
+ /* Allocate a large data block with gaddr4--there is a free-space section able to fulfill the request */
+ /* Free-space sections: 2192 + 3192 + 288 = 5672 bytes */
+ gaddr4 = H5MF_alloc(f, H5FD_MEM_DRAW, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE5000);
+
+ /* Should be page aligned */
+ if(gaddr4 % TBLOCK_SIZE4096)
+ TEST_ERROR
+ if(gaddr4 != gaddr2)
+ TEST_ERROR
+
+ /* Get free-space info */
+ if(H5FS_stat_info(f, f->shared->fs_man[H5F_MEM_PAGE_GENERIC], &fs_stat) < 0)
+ FAIL_STACK_ERROR
+ /* Verify that that there are 3 free-space sections */
+ if(fs_stat.tot_sect_count != 3)
+ TEST_ERROR
+ if(fs_stat.tot_space != (2192+3192+288))
+ TEST_ERROR
+
+ /* Free the two blocks with gaddr1 and gaddr4 */
+ H5MF_xfree(f, H5FD_MEM_DRAW, H5AC_ind_read_dxpl_id, gaddr1, (hsize_t)TBLOCK_SIZE6000);
+ H5MF_xfree(f, H5FD_MEM_DRAW, H5AC_ind_read_dxpl_id, gaddr4, (hsize_t)TBLOCK_SIZE5000);
+
+ /* Get free-space info */
+ if(H5FS_stat_info(f, f->shared->fs_man[H5F_MEM_PAGE_GENERIC], &fs_stat) < 0)
+ FAIL_STACK_ERROR
+ /* Verify that that there are 2 free-space sections: 16384 (4 pages) + 288 */
+ if(fs_stat.tot_sect_count != 2)
+ TEST_ERROR
+ if(fs_stat.tot_space != (16384+288))
+ TEST_ERROR
+
+ /* Close file */
+ if(H5Fclose(fid) < 0)
+ FAIL_STACK_ERROR
+
+ /* Close the property list */
+ if(H5Pclose(fcpl) < 0)
+ FAIL_STACK_ERROR
+
+ /* Get the size of the file */
+ if((file_size = h5_get_file_size(filename, fapl)) < 0)
+ TEST_ERROR
+
+ /* Verify that file size end on a page boundary */
+ if(file_size % TBLOCK_SIZE4096)
+ TEST_ERROR
+
+ PASSED()
+
+ } else {
+ SKIPPED();
+ puts(" Current VFD doesn't support paged aggregation strategy");
+ }
+
+ return(0);
+
+error:
+ H5E_BEGIN_TRY {
+ H5Fclose(fid);
+ } H5E_END_TRY;
+ return(1);
+
+} /* test_page_large() */
+
+/*-------------------------------------------------------------------------
+ * Function: test_page_small
+ *
+ * Purpose: To verify allocations and de-allocations for small meta/raw data
+ * are done properly when paged aggregation is enabled.
+ *
+ * Return: Success: 0
+ * Failure: number of errors
+ *
+ * Programmer: Vailin Choi; Jan 2013
+ *
+ *-------------------------------------------------------------------------
+ */
+static unsigned
+test_page_small(const char *env_h5_drvr, hid_t fapl)
+{
+ hid_t fid = -1; /* File ID */
+ hid_t fcpl = -1; /* File creation property list */
+ H5F_t *f = NULL; /* Internal file object pointer */
+ haddr_t addr2, addr3, addr4, addr5; /* Addresses for blocks */
+ haddr_t addr9, addr10, addr11; /* Address for small meta data blocks */
+ haddr_t saddr1, saddr2; /* Addresses for small raw data blocks */
+ H5FS_stat_t fs_stat; /* Information for free-space manager */
+ char filename[FILENAME_LEN]; /* Filename to use */
+ hbool_t multi= FALSE, split = FALSE, family = FALSE;
+
+ TESTING("Paged aggregation for file space: small allocations and de-allocations");
+
+ if(!HDstrcmp(env_h5_drvr, "split"))
+ split = TRUE;
+ else if(!HDstrcmp(env_h5_drvr, "multi"))
+ multi = TRUE;
+ else if(!HDstrcmp(env_h5_drvr, "family"))
+ family = TRUE;
+
+ if(!multi && !split) {
+
+ /* Set the filename to use for this test (dependent on fapl) */
+ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
+
+ /* File creation property list */
+ if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Set the strategy to paged aggregation */
+ if(H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, FALSE, (hsize_t)1) < 0)
+ FAIL_STACK_ERROR
+
+ /* Create the file to work on */
+ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Get a pointer to the internal file object */
+ if(NULL == (f = (H5F_t *)H5I_object(fid)))
+ FAIL_STACK_ERROR
+
+ /* Allocate 2 small meta data blocks: addr1, addr2 */
+ H5MF_alloc(f, H5FD_MEM_OHDR, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE30);
+ addr2 = H5MF_alloc(f, H5FD_MEM_OHDR, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE50);
+
+ /* Allocate a small raw data block with saddr1 */
+ saddr1 = H5MF_alloc(f, H5FD_MEM_DRAW, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE30);
+ /* Should be on the second page and page aligned */
+ if(saddr1 % TBLOCK_SIZE4096)
+ TEST_ERROR
+
+ /* Allocate a small raw data block with saddr2 */
+ saddr2 = H5MF_alloc(f, H5FD_MEM_DRAW, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE50);
+ /* Should not be page aligned */
+ if(!(saddr2 % TBLOCK_SIZE4096))
+ TEST_ERROR
+ /* Should be next to the block with saddr1 */
+ if(saddr2 != (saddr1 + TBLOCK_SIZE30))
+ TEST_ERROR
+
+ /* Allocate a small meta data block with addr3--there is no free-space section big enough to fulfill the request */
+ addr3 = H5MF_alloc(f, H5FD_MEM_OHDR, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE4020);
+ /* Should be on the third page and page aligned */
+ if(addr3 % TBLOCK_SIZE4096)
+ TEST_ERROR
+
+ /* Allocate a small meta data block with addr4--there is a free-space section big enough to fulfill the request */
+ addr4 = H5MF_alloc(f, H5FD_MEM_OHDR, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE80);
+ /* Should not be page aligned */
+ if(!(addr4 % TBLOCK_SIZE4096))
+ TEST_ERROR
+ /* Should be next to the block with addr2 */
+ if(addr4 != (addr2 + TBLOCK_SIZE50))
+ TEST_ERROR
+
+ /* Allocate a small meta data block with addr5--there is a free-space section big enough to fulfill the request */
+ addr5 = H5MF_alloc(f, H5FD_MEM_OHDR, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE40);
+ /* Should not be page aligned */
+ if(!(addr5 % TBLOCK_SIZE4096))
+ TEST_ERROR
+
+ /* Should be next to the block with addr3 */
+ if(addr5 != (addr3 + TBLOCK_SIZE4020))
+ TEST_ERROR
+
+ /* Allocate a small meta data block with addr6--taking up the remaining space in the first page */
+ if(family)
+ H5MF_alloc(f, H5FD_MEM_OHDR, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE3080);
+ else
+ H5MF_alloc(f, H5FD_MEM_OHDR, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE3088);
+
+ /* Allocate a small meta data block with addr7--taking up the remaining space in the third page */
+ H5MF_alloc(f, H5FD_MEM_OHDR, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE36);
+
+ /* Allocate 2 small meta data blocks: addr8, addr9--there is no free-space to fulfill the request */
+ H5MF_alloc(f, H5FD_MEM_OHDR, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE50);
+ addr9 = H5MF_alloc(f, H5FD_MEM_OHDR, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE80);
+
+ /* Free the block with saddr1 and saddr2--merge with remaining section to become a page which will be returned to the large manager */
+ H5MF_xfree(f, H5FD_MEM_DRAW, H5AC_ind_read_dxpl_id, saddr1, (hsize_t)TBLOCK_SIZE30);
+ H5MF_xfree(f, H5FD_MEM_DRAW, H5AC_ind_read_dxpl_id, saddr2, (hsize_t)TBLOCK_SIZE50);
+
+ /* Verify that the large manager does contain a section with file space page size (default is 4096) */
+ if(!f->shared->fs_man[H5F_MEM_PAGE_GENERIC])
+ TEST_ERROR
+ if(H5FS_stat_info(f, f->shared->fs_man[H5F_MEM_PAGE_GENERIC], &fs_stat) < 0)
+ FAIL_STACK_ERROR
+ if(fs_stat.tot_space != TBLOCK_SIZE4096)
+ TEST_ERROR
+
+ /* Allocate a small meta data block with addr10--there is a free-space section big enough to fulfill the request */
+ addr10 = H5MF_alloc(f, H5FD_MEM_OHDR, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE3900);
+ /* The block should be next to the block with addr9 */
+ if(addr10 != (addr9 + TBLOCK_SIZE80))
+ TEST_ERROR
+
+ /* Allocate a small meta data block with addr11 */
+ /* The current free-space section is unable to fulfill the request; obtain a page from the large manager */
+ addr11 = H5MF_alloc(f, H5FD_MEM_OHDR, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE80);
+ /* The address of the block should be the same the freed block with saddr1 */
+ if(addr11 != saddr1)
+ TEST_ERROR
+
+ /* Close file */
+ if(H5Fclose(fid) < 0)
+ FAIL_STACK_ERROR
+
+ /* Close the property list */
+ if(H5Pclose(fcpl) < 0)
+ FAIL_STACK_ERROR
+
+ PASSED()
+
+ } else {
+ SKIPPED();
+ puts(" Current VFD doesn't support paged aggregation strategy");
+ }
+
+ return(0);
+
+error:
+ H5E_BEGIN_TRY {
+ H5Fclose(fid);
+ H5Pclose(fcpl);
+ } H5E_END_TRY;
+ return(1);
+
+} /* test_page_small() */
+
+/*-------------------------------------------------------------------------
+ * Function: test_page_alignment
+ *
+ * Purpose: To verify the proper alignment is used when H5Pset_alignment()
+ * is set and paged aggregation is enabled.
+ *
+ * Return: Success: 0
+ * Failure: number of errors
+ *
+ * Programmer: Vailin Choi; Jan 2013
+ *
+ *-------------------------------------------------------------------------
+ */
+static unsigned
+test_page_alignment(const char *env_h5_drvr, hid_t fapl)
+{
+
+ hid_t fid = -1; /* File ID */
+ hid_t fcpl = -1; /* File creation property list ID */
+ hid_t fcpl2 = -1; /* File creation property list ID */
+ hid_t fapl_new = -1; /* File access property list ID */
+ H5F_t *f = NULL; /* Internal file object pointer */
+ haddr_t addr1, addr2; /* Addresses for small meta data blocks */
+ haddr_t saddr1, saddr2; /* Addresses for small raw data blocks */
+ haddr_t gaddr1, gaddr2; /* Addresses for blocks */
+ char filename[FILENAME_LEN]; /* Filename to use */
+ hbool_t split = FALSE, multi = FALSE;
+
+ TESTING("Paged aggregation and H5Pset_alignment: verify proper alignment is used");
+
+ /* Check for split or multi driver */
+ if(!HDstrcmp(env_h5_drvr, "split"))
+ split = TRUE;
+ else if(!HDstrcmp(env_h5_drvr, "multi"))
+ multi = TRUE;
+
+ if(!multi && !split) {
+
+ /* Set the filename to use for this test (dependent on fapl) */
+ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
+
+ /*
+ * Case 1: Verify that the alignment in use is the default file space
+ * page size when paged aggregation is enabled.
+ */
+
+ if((fapl_new = H5Pcopy(fapl)) < 0) TEST_ERROR
+
+ /* The alignment to use will be the library's default file space page size */
+ if(H5Pset_libver_bounds(fapl_new, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ FAIL_STACK_ERROR
+
+ /* Set alignment value to 16 */
+ if(H5Pset_alignment(fapl_new, (hsize_t)0, (hsize_t)TEST_ALIGN16) < 0)
+ TEST_ERROR
+
+ if(split || multi) {
+ hid_t memb_fapl;
+ H5FD_mem_t memb_map[H5FD_MEM_NTYPES];
+ hid_t memb_fapl_arr[H5FD_MEM_NTYPES];
+ char *memb_name[H5FD_MEM_NTYPES];
+ haddr_t memb_addr[H5FD_MEM_NTYPES];
+ hbool_t relax;
+ H5FD_mem_t mt;
+
+ /* Create fapl */
+ if((memb_fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ TEST_ERROR
+
+ /* Set alignment */
+ if(H5Pset_alignment(memb_fapl, 0, (hsize_t)TEST_ALIGN16) < 0)
+ TEST_ERROR
+
+ HDmemset(memb_name, 0, sizeof memb_name);
+
+ if(split) {
+ /* Set split driver with new FAPLs */
+ if(H5Pset_fapl_split(fapl_new, "-m.h5", memb_fapl, "-r.h5", memb_fapl) < 0)
+ TEST_ERROR
+
+ /* Get current multi settings */
+ if(H5Pget_fapl_multi(fapl_new, memb_map, memb_fapl_arr, memb_name, memb_addr, &relax) < 0)
+ TEST_ERROR
+
+ /* Set memb_addr aligned */
+ memb_addr[H5FD_MEM_SUPER] = ((memb_addr[H5FD_MEM_SUPER] + TBLOCK_SIZE4096 - 1) / TBLOCK_SIZE4096) * TBLOCK_SIZE4096;
+ memb_addr[H5FD_MEM_DRAW] = ((memb_addr[H5FD_MEM_DRAW] + TBLOCK_SIZE4096 - 1) / TBLOCK_SIZE4096) * TBLOCK_SIZE4096;
+
+ /* Set split driver with new FAPLs */
+ if(H5Pset_fapl_multi(fapl_new, memb_map, memb_fapl_arr, (const char * const *)memb_name, memb_addr, relax) < 0)
+ TEST_ERROR
+
+ } else {
+ /* Get current multi settings */
+ if(H5Pget_fapl_multi(fapl_new, memb_map, NULL, memb_name, memb_addr, &relax) < 0)
+ TEST_ERROR
+
+ /* Populate memb_fapl_arr */
+ /* Set memb_addr aligned */
+ for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, mt)) {
+ memb_fapl_arr[mt] = memb_fapl;
+ memb_addr[mt] = ((memb_addr[mt] + TBLOCK_SIZE4096 - 1) / TBLOCK_SIZE4096) * TBLOCK_SIZE4096;
+ }
+
+ /* Set multi driver with new FAPLs */
+ if(H5Pset_fapl_multi(fapl_new, memb_map, memb_fapl_arr, (const char * const *)memb_name, memb_addr, relax) < 0)
+ TEST_ERROR
+
+ } /* end else */
+
+ /* Free memb_name */
+ for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, mt))
+ free(memb_name[mt]);
+
+ /* Close memb_fapl */
+ if(H5Pclose(memb_fapl) < 0)
+ TEST_ERROR
+ } /* end if */
+
+ /* File creation property list */
+ if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ TEST_ERROR
+
+ /* Set the strategy to paged aggregation and persisting free space */
+ /* The alignment to use will be the library's default file space page size */
+ if(H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, TRUE, (hsize_t)1) < 0)
+ TEST_ERROR
+
+ /* Create the file to work on */
+ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl_new)) < 0)
+ TEST_ERROR
+
+ /* Get a pointer to the internal file object */
+ if(NULL == (f = (H5F_t *)H5I_object(fid)))
+ TEST_ERROR
+
+ /* Allocate 2 small raw data blocks */
+ saddr1 = H5MF_alloc(f, H5FD_MEM_DRAW, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE30);
+ saddr2 = H5MF_alloc(f, H5FD_MEM_DRAW, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE50);
+
+ /* Should be on the second page and page aligned on 4096 (default file space page size) */
+ if(saddr1 % TBLOCK_SIZE4096)
+ TEST_ERROR
+
+ /* Should be next to the block with saddr1 */
+ if(saddr2 != (saddr1 + TBLOCK_SIZE30))
+ TEST_ERROR
+
+ /* Allocate 2 large raw data blocks */
+ gaddr1 = H5MF_alloc(f, H5FD_MEM_DRAW, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE5000);
+ gaddr2 = H5MF_alloc(f, H5FD_MEM_DRAW, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE8000);
+
+ /* Should be on the 3rd page and page aligned */
+ if(gaddr1 % TBLOCK_SIZE4096)
+ TEST_ERROR
+
+ /* Should be on the 4th page and page aligned */
+ if(gaddr2 % TBLOCK_SIZE4096)
+ TEST_ERROR
+
+ /* Close the file creation property list */
+ if(H5Pclose(fcpl) < 0)
+ TEST_ERROR
+
+ /* Close file */
+ if(H5Fclose(fid) < 0)
+ TEST_ERROR
+
+ /*
+ * Case 2: Verify that the alignment in use is the alignment set
+ * via H5Pset_alignment when paged aggregation not enabled.
+ */
+ /* fapl_new has latest format and H5Pset_alignment set */
+ /* Disable small data block mechanism */
+ if(H5Pset_small_data_block_size(fapl_new, (hsize_t)0) < 0)
+ TEST_ERROR
+ /* Disable meta data block mechanism */
+ if(H5Pset_meta_block_size(fapl_new, (hsize_t)0) < 0)
+ TEST_ERROR
+
+ /* Create the file to work on */
+ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_new)) < 0)
+ TEST_ERROR
+
+ /* Get a pointer to the internal file object */
+ if(NULL == (f = (H5F_t *)H5I_object(fid)))
+ TEST_ERROR
+
+ /* Allocate 2 small meta data blocks */
+ addr1 = H5MF_alloc(f, H5FD_MEM_SUPER, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE30);
+ addr2 = H5MF_alloc(f, H5FD_MEM_SUPER, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE50);
+
+ /* Should be aligned on 16 */
+ if(addr1 % TEST_ALIGN16 || addr2 % TEST_ALIGN16)
+ TEST_ERROR
+
+ /* addr2 should be right next to the block with addr1 */
+ if((addr1 + TBLOCK_SIZE30) % TEST_ALIGN16)
+ if(addr2 != (((addr1 + TBLOCK_SIZE30) / TEST_ALIGN16) + 1) * TEST_ALIGN16)
+ TEST_ERROR
+
+ /* Allocate 2 small raw data blocks */
+ saddr1 = H5MF_alloc(f, H5FD_MEM_DRAW, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE80);
+ saddr2 = H5MF_alloc(f, H5FD_MEM_DRAW, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE100);
+
+ /* Should be aligned on 16 */
+ if(saddr1 % TEST_ALIGN16 || saddr2 % TEST_ALIGN16)
+ TEST_ERROR
+
+ if(!multi && !split) {
+ /* saddr1 should be right next to the block with addr2 */
+ if((addr2 + TBLOCK_SIZE50) % TEST_ALIGN16)
+ if(saddr1 != (((addr2 + TBLOCK_SIZE50) / TEST_ALIGN16) + 1) * TEST_ALIGN16)
+ TEST_ERROR
+ }
+
+ /* saddr2 should be right next to the block with saddr1 */
+ if((saddr1 + TBLOCK_SIZE80) % TEST_ALIGN16)
+ if(saddr2 != (((saddr1 + TBLOCK_SIZE80) / TEST_ALIGN16) + 1) * TEST_ALIGN16)
+ TEST_ERROR
+
+ /* Close file */
+ if(H5Fclose(fid) < 0)
+ TEST_ERROR
+
+ /*
+ * Case 3: Verify that the alignment in use is the alignment set
+ * via H5Pset_alignment when paged aggregation not enabled.
+ */
+ /* File creation property list */
+ if((fcpl2 = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ TEST_ERROR
+
+ /* Set file space page size */
+ if(H5Pset_file_space_page_size(fcpl2, (hsize_t)TBLOCK_SIZE8192) < 0)
+ TEST_ERROR
+
+ /* Set strategy to H5F_FSPACE_STRATEGY_AGGR but meta/raw data block is 0 as set in fapl_new */
+ if(H5Pset_file_space_strategy(fcpl2, H5F_FSPACE_STRATEGY_AGGR, FALSE, (hsize_t)1) < 0)
+ TEST_ERROR
+
+ /* fapl_new has latest format, H5Pset_alignment set, and disable meta/raw block */
+ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl2, fapl_new)) < 0)
+ TEST_ERROR
+
+ /* Get a pointer to the internal file object */
+ if(NULL == (f = (H5F_t *)H5I_object(fid)))
+ TEST_ERROR
+
+ /* Allocate 2 small raw data blocks */
+ saddr1 = H5MF_alloc(f, H5FD_MEM_DRAW, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE30);
+ saddr2 = H5MF_alloc(f, H5FD_MEM_DRAW, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE50);
+
+ /* Should be aligned on 16 */
+ if(saddr1 % TEST_ALIGN16)
+ TEST_ERROR
+ if(saddr2 % TEST_ALIGN16)
+ TEST_ERROR
+
+ /* saddr2 should be right next to the block with saddr1 */
+ if((saddr1 + TBLOCK_SIZE30) % TEST_ALIGN16)
+ if(saddr2 != (((saddr1 + TBLOCK_SIZE30) / TEST_ALIGN16) + 1) * TEST_ALIGN16)
+ TEST_ERROR
+
+ /* Allocate a large raw data block */
+ gaddr1 = H5MF_alloc(f, H5FD_MEM_DRAW, H5AC_ind_read_dxpl_id, (hsize_t)TBLOCK_SIZE5000);
+
+ /* Should be aligned on 16 */
+ if(gaddr1 % TEST_ALIGN16)
+ TEST_ERROR
+
+ /* gaddr1 is right next to the block with saddr2 */
+ if((saddr2 + TBLOCK_SIZE50) % TEST_ALIGN16)
+ if(gaddr1 != (((saddr2 + TBLOCK_SIZE50) / TEST_ALIGN16) + 1) * TEST_ALIGN16)
+ TEST_ERROR
+
+ /* There is no free-space manager involved for H5F_FSPACE_STRATEGY_AGGR strategy */
+ if(f->shared->fs_man[H5FD_MEM_DRAW] || f->shared->fs_man[H5FD_MEM_SUPER])
+ TEST_ERROR
+
+ /* Closing */
+ if(H5Fclose(fid) < 0)
+ TEST_ERROR
+ if(H5Pclose(fcpl2) < 0)
+ TEST_ERROR
+ if(H5Pclose(fapl_new) < 0)
+ TEST_ERROR
+
+ PASSED()
+
+ } else {
+ SKIPPED();
+ puts(" Current VFD doesn't support persisting free-space or paged aggregation strategy");
+ }
+
+ return(0);
+
+error:
+ H5E_BEGIN_TRY {
+ H5Fclose(fid);
+ H5Pclose(fcpl);
+ H5Pclose(fapl_new);
+ } H5E_END_TRY;
+ return(1);
+
+} /* test_page_alignment() */
int
main(void)
@@ -7625,33 +8869,21 @@ main(void)
/* Make a copy of the FAPL before adjusting the alignment */
if((new_fapl = H5Pcopy(fapl)) < 0) TEST_ERROR
-
- /* alignment is not set for the following tests */
- 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 */
+ /* For old library format--interaction with file allocation */
nerrors += test_mf_eoa(env_h5_drvr, fapl);
nerrors += test_mf_eoa_shrink(env_h5_drvr, fapl);
nerrors += test_mf_eoa_extend(env_h5_drvr, fapl);
- /* interaction with temporary file space allocation */
- nerrors += test_mf_tmp(env_h5_drvr, fapl);
+ /* For old library format */
+ nerrors += test_dichotomy(new_fapl);
- /* interaction with free-space manager */
+ /* For old library format--interaction with free-space manager */
nerrors += test_mf_fs_start(fapl);
nerrors += test_mf_fs_alloc_free(fapl);
nerrors += test_mf_fs_extend(fapl);
nerrors += test_mf_fs_absorb(env_h5_drvr, fapl);
- nerrors += test_dichotomy(env_h5_drvr, new_fapl);
- /* interaction with meta/sdata aggregator */
+ /* For old library format--interaction with meta/sdata aggregator */
nerrors += test_mf_aggr_alloc1(env_h5_drvr, fapl);
nerrors += test_mf_aggr_alloc2(env_h5_drvr, fapl);
nerrors += test_mf_aggr_alloc3(env_h5_drvr, fapl);
@@ -7662,7 +8894,7 @@ main(void)
nerrors += test_mf_aggr_extend(env_h5_drvr, fapl);
nerrors += test_mf_aggr_absorb(env_h5_drvr, fapl);
- /* Tests for alignment */
+ /* For old library format--tests for alignment */
for(curr_test = TEST_NORMAL; curr_test < TEST_NTESTS; H5_INC_ENUM(test_type_t, curr_test)) {
switch(curr_test) {
@@ -7692,11 +8924,54 @@ main(void)
nerrors += test_mf_align_alloc6(env_h5_drvr, fapl, new_fapl);
} /* end for */
- /* tests to verify that file's free-space managers are persistent */
- nerrors += test_mf_fs_drivers(fapl);
+ /* For old and new format--interaction with temporary file space allocation */
+ nerrors += test_mf_tmp(env_h5_drvr, fapl, FALSE);
+ nerrors += test_mf_tmp(env_h5_drvr, fapl, TRUE);
+
+ /* For old and new format--free-space merge/shrunk away */
+
+ /* Temporary: modify to skip testing for multi/split driver:
+ fail file create when persisting free-space or using paged aggregation strategy */
+ nerrors += test_mf_fs_gone(env_h5_drvr, fapl, FALSE);
+ nerrors += test_mf_fs_gone(env_h5_drvr, fapl, TRUE);
+
+ /* Temporary: modify to skip testing multi/split driver:
+ fail file create when persisting free-space or using paged aggregation strategy */
+ nerrors += test_mf_strat_thres_gone(env_h5_drvr, fapl, FALSE);
+ nerrors += test_mf_strat_thres_gone(env_h5_drvr, fapl, TRUE);
- /* tests for file space management */
- nerrors += test_filespace_drivers(fapl);
+ /* For old and new format--persisting free-space */
+
+ /* Temporary: Modify to skip testing for multi/split driver:
+ fail file create when persisting free-space or using paged aggregation strategy */
+ nerrors += test_mf_fs_persist(env_h5_drvr, fapl, FALSE);
+ nerrors += test_mf_fs_persist(env_h5_drvr, fapl, TRUE);
+
+ /* Temporary: modify to skip testing for multi/split driver:
+ fail file create when persisting free-space or using paged aggregation strategy */
+ nerrors += test_mf_strat_thres_persist(env_h5_drvr, fapl, FALSE);
+ nerrors += test_mf_strat_thres_persist(env_h5_drvr, fapl, TRUE);
+
+ /* Temporary skipped for multi/split drivers:
+ fail file create when persisting free-space or using paged aggregation strategy */
+#ifdef PB_OUT
+ /* Tests specific for multi and split files--persisting free-space */
+ nerrors += test_mf_fs_persist_split();
+ nerrors += test_mf_fs_persist_multi();
+#endif
+
+ /*
+ * Tests specific for file space paging
+ */
+ /* Temporary: The following 7 tests are modified to skip testing for multi/split driver:
+ fail file create when persisting free-space or using paged aggregation strategy */
+ nerrors += test_page_small(env_h5_drvr, fapl);
+ nerrors += test_page_large(env_h5_drvr, fapl);
+ nerrors += test_page_large_try_extend(env_h5_drvr, fapl);
+ nerrors += test_page_small_try_extend(env_h5_drvr, fapl);
+ nerrors += test_page_try_shrink(env_h5_drvr, fapl);
+ nerrors += test_page_alloc_xfree(env_h5_drvr, fapl); /* can handle multi/split */
+ nerrors += test_page_alignment(env_h5_drvr, fapl); /* can handle multi/split */
/* tests for specific bugs */
nerrors += test_mf_bug1(env_h5_drvr, fapl);