summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/CMakeLists.txt1
-rw-r--r--test/CMakeTests.cmake14
-rw-r--r--test/Makefile.am4
-rw-r--r--test/aggr.h5bin0 -> 2448 bytes
-rw-r--r--test/cache.c722
-rw-r--r--test/cache_api.c105
-rw-r--r--test/cache_common.c54
-rw-r--r--test/cache_common.h2
-rw-r--r--test/cache_image.c532
-rw-r--r--test/cache_tagging.c49
-rw-r--r--test/dsets.c218
-rw-r--r--test/fheap.c158
-rw-r--r--test/filespace_1_8.h5bin2448 -> 2544 bytes
-rw-r--r--test/freespace.c24
-rw-r--r--test/fsm_aggr_nopersist.h5bin0 -> 2448 bytes
-rw-r--r--test/fsm_aggr_persist.h5bin0 -> 2565 bytes
-rw-r--r--test/gen_filespace.c136
-rw-r--r--test/gen_idx.c126
-rw-r--r--test/gen_plist.c6
-rw-r--r--test/h5fc_ext1_f.h5bin0 -> 6760 bytes
-rw-r--r--test/h5fc_ext1_i.h5bin0 -> 6526 bytes
-rw-r--r--test/h5fc_ext2_if.h5bin0 -> 6526 bytes
-rw-r--r--test/h5fc_ext2_sf.h5bin0 -> 5076 bytes
-rw-r--r--test/h5fc_ext3_isf.h5bin0 -> 6679 bytes
-rw-r--r--test/h5fc_ext_none.h5bin0 -> 6474 bytes
-rw-r--r--test/links.c2
-rw-r--r--test/mf.c5053
-rw-r--r--test/none.h5bin0 -> 1808 bytes
-rw-r--r--test/page_buffer.c2087
-rw-r--r--test/paged_nopersist.h5bin0 -> 8192 bytes
-rw-r--r--test/paged_persist.h5bin0 -> 16384 bytes
-rw-r--r--test/set_extent.c18
-rw-r--r--test/stab.c81
-rw-r--r--test/testfiles/plist_files/def_fcpl_32bebin412 -> 452 bytes
-rw-r--r--test/testfiles/plist_files/def_fcpl_32lebin412 -> 452 bytes
-rw-r--r--test/testfiles/plist_files/def_fcpl_64bebin412 -> 452 bytes
-rw-r--r--test/testfiles/plist_files/def_fcpl_64lebin412 -> 452 bytes
-rw-r--r--test/testfiles/plist_files/fcpl_32bebin413 -> 453 bytes
-rw-r--r--test/testfiles/plist_files/fcpl_32lebin413 -> 453 bytes
-rw-r--r--test/testfiles/plist_files/fcpl_64bebin413 -> 453 bytes
-rw-r--r--test/testfiles/plist_files/fcpl_64lebin413 -> 453 bytes
-rw-r--r--test/tfile.c2074
-rw-r--r--test/tmisc.c16
43 files changed, 8414 insertions, 3068 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 9657971..d7965cb 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -246,6 +246,7 @@ set (H5_TESTS
cross_read
freespace
mf
+ page_buffer
vds
file_image
unregister
diff --git a/test/CMakeTests.cmake b/test/CMakeTests.cmake
index fc8587b..f372acf 100644
--- a/test/CMakeTests.cmake
+++ b/test/CMakeTests.cmake
@@ -170,6 +170,7 @@ endforeach ()
#-- Copy all the HDF5 files from the test directory into the source directory
# --------------------------------------------------------------------
set (HDF5_REFERENCE_TEST_FILES
+ aggr.h5
bad_compound.h5
be_data.h5
be_extlink1.h5
@@ -187,7 +188,15 @@ set (HDF5_REFERENCE_TEST_FILES
filespace_1_8.h5
fill_old.h5
filter_error.h5
+ fsm_aggr_nopersist.h5
+ fsm_aggr_persist.h5
group_old.h5
+ h5fc_ext1_i.h5
+ h5fc_ext1_f.h5
+ h5fc_ext2_if.h5
+ h5fc_ext2_sf.h5
+ h5fc_ext3_isf.h5
+ h5fc_ext_none.h5
le_data.h5
le_extlink1.h5
le_extlink2.h5
@@ -195,6 +204,9 @@ set (HDF5_REFERENCE_TEST_FILES
multi_file_v16-r.h5
multi_file_v16-s.h5
noencoder.h5
+ none.h5
+ paged_nopersist.h5
+ paged_persist.h5
specmetaread.h5
tarrold.h5
tbad_msg_count.h5
@@ -618,6 +630,7 @@ set (H5TEST_TESTS
cross_read
freespace
mf
+ page_buffer
vds
file_image
unregister
@@ -1288,7 +1301,6 @@ if (HDF5_BUILD_GENERATORS)
gen_cross
gen_deflate
gen_filters
- gen_idx
gen_new_array
gen_new_fill
gen_new_group
diff --git a/test/Makefile.am b/test/Makefile.am
index 98cfc42..a64cd0e 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -54,7 +54,7 @@ check_SCRIPTS = $(TEST_SCRIPT)
TEST_PROG= testhdf5 \
cache cache_api cache_image cache_tagging lheap ohdr stab gheap \
evict_on_close farray earray btree2 fheap \
- pool accum hyperslab istore bittests dt_arith \
+ pool accum hyperslab istore bittests dt_arith page_buffer \
dtypes dsets cmpd_dset filter_fail extend external efc objcopy links unlink \
twriteorder big mtime fillval mount flush1 flush2 app_ref enum \
set_extent ttsafe enc_dec_plist enc_dec_plist_cross_platform\
@@ -91,7 +91,7 @@ endif
# --enable-build-all at configure time.
# The gen_old_* files can only be compiled with older versions of the library
# so do not appear in this list.
-BUILD_ALL_PROGS=gen_bad_ohdr gen_bogus gen_cross gen_deflate gen_filters gen_idx gen_new_array \
+BUILD_ALL_PROGS=gen_bad_ohdr gen_bogus gen_cross gen_deflate gen_filters gen_new_array \
gen_new_fill gen_new_group gen_new_mtime gen_new_super gen_noencoder \
gen_nullspace gen_udlinks space_overflow gen_filespace gen_specmetaread \
gen_sizes_lheap gen_file_image gen_plist
diff --git a/test/aggr.h5 b/test/aggr.h5
new file mode 100644
index 0000000..b24365d
--- /dev/null
+++ b/test/aggr.h5
Binary files differ
diff --git a/test/cache.c b/test/cache.c
index c381776..ba6fb0e 100644
--- a/test/cache.c
+++ b/test/cache.c
@@ -97,19 +97,19 @@ struct move_entry_test_spec
/* private function declarations: */
-static unsigned smoke_check_1(int express_test);
-static unsigned smoke_check_2(int express_test);
-static unsigned smoke_check_3(int express_test);
-static unsigned smoke_check_4(int express_test);
-static unsigned smoke_check_5(int express_test);
-static unsigned smoke_check_6(int express_test);
-static unsigned smoke_check_7(int express_test);
-static unsigned smoke_check_8(int express_test);
-static unsigned smoke_check_9(int express_test);
-static unsigned smoke_check_10(int express_test);
-static unsigned write_permitted_check(int express_test);
-static unsigned check_insert_entry(void);
-static unsigned check_flush_cache(void);
+static unsigned smoke_check_1(int express_test, unsigned paged);
+static unsigned smoke_check_2(int express_test, unsigned paged);
+static unsigned smoke_check_3(int express_test, unsigned paged);
+static unsigned smoke_check_4(int express_test, unsigned paged);
+static unsigned smoke_check_5(int express_test, unsigned paged);
+static unsigned smoke_check_6(int express_test, unsigned paged);
+static unsigned smoke_check_7(int express_test, unsigned paged);
+static unsigned smoke_check_8(int express_test, unsigned paged);
+static unsigned smoke_check_9(int express_test, unsigned paged);
+static unsigned smoke_check_10(int express_test, unsigned paged);
+static unsigned write_permitted_check(int express_test, unsigned paged);
+static unsigned check_insert_entry(unsigned paged);
+static unsigned check_flush_cache(unsigned paged);
static void check_flush_cache__empty_cache(H5F_t * file_ptr);
static void check_flush_cache__multi_entry(H5F_t * file_ptr);
static void check_flush_cache__multi_entry_test(H5F_t * file_ptr,
@@ -159,48 +159,49 @@ static void check_flush_cache__flush_op_test(H5F_t * file_ptr,
int check_size,
struct fo_flush_entry_check check[]);
static void check_flush_cache__flush_op_eviction_test(H5F_t * file_ptr);
-static unsigned check_get_entry_status(void);
-static unsigned check_expunge_entry(void);
-static unsigned check_multiple_read_protect(void);
-static unsigned check_move_entry(void);
+static unsigned check_get_entry_status(unsigned paged);
+static unsigned check_expunge_entry(unsigned paged);
+static unsigned check_multiple_read_protect(unsigned paged);
+static unsigned check_move_entry(unsigned paged);
static void check_move_entry__run_test(H5F_t * file_ptr, unsigned test_num,
struct move_entry_test_spec * spec_ptr);
-static unsigned check_pin_protected_entry(void);
-static unsigned check_resize_entry(void);
-static unsigned check_evictions_enabled(void);
-static unsigned check_flush_protected_err(void);
-static unsigned check_destroy_pinned_err(void);
-static unsigned check_destroy_protected_err(void);
-static unsigned check_duplicate_insert_err(void);
-static unsigned check_double_pin_err(void);
-static unsigned check_double_unpin_err(void);
-static unsigned check_pin_entry_errs(void);
-static unsigned check_double_protect_err(void);
-static unsigned check_double_unprotect_err(void);
-static unsigned check_mark_entry_dirty_errs(void);
-static unsigned check_expunge_entry_errs(void);
-static unsigned check_move_entry_errs(void);
-static unsigned check_resize_entry_errs(void);
-static unsigned check_unprotect_ro_dirty_err(void);
-static unsigned check_protect_ro_rw_err(void);
-static unsigned check_check_evictions_enabled_err(void);
-static unsigned check_auto_cache_resize(hbool_t cork_ageout);
-static unsigned check_auto_cache_resize_disable(void);
-static unsigned check_auto_cache_resize_epoch_markers(void);
-static unsigned check_auto_cache_resize_input_errs(void);
-static unsigned check_auto_cache_resize_aux_fcns(void);
-static unsigned check_metadata_blizzard_absence(hbool_t fill_via_insertion);
-static unsigned check_flush_deps(void);
-static unsigned check_flush_deps_err(void);
-static unsigned check_flush_deps_order(void);
-static unsigned check_notify_cb(void);
-static unsigned check_metadata_cork(hbool_t fill_via_insertion);
-static unsigned check_entry_deletions_during_scans(void);
+static unsigned check_pin_protected_entry(unsigned paged);
+static unsigned check_resize_entry(unsigned paged);
+static unsigned check_evictions_enabled(unsigned paged);
+static unsigned check_flush_protected_err(unsigned paged);
+static unsigned check_destroy_pinned_err(unsigned paged);
+static unsigned check_destroy_protected_err(unsigned paged);
+static unsigned check_duplicate_insert_err(unsigned paged);
+static unsigned check_double_pin_err(unsigned paged);
+static unsigned check_double_unpin_err(unsigned paged);
+static unsigned check_pin_entry_errs(unsigned paged);
+static unsigned check_double_protect_err(unsigned paged);
+static unsigned check_double_unprotect_err(unsigned paged);
+static unsigned check_mark_entry_dirty_errs(unsigned paged);
+static unsigned check_expunge_entry_errs(unsigned paged);
+static unsigned check_move_entry_errs(unsigned paged);
+static unsigned check_resize_entry_errs(unsigned paged);
+static unsigned check_unprotect_ro_dirty_err(unsigned paged);
+static unsigned check_protect_ro_rw_err(unsigned paged);
+static unsigned check_protect_retries(unsigned paged);
+static unsigned check_check_evictions_enabled_err(unsigned paged);
+static unsigned check_auto_cache_resize(hbool_t cork_ageout, unsigned paged);
+static unsigned check_auto_cache_resize_disable(unsigned paged);
+static unsigned check_auto_cache_resize_epoch_markers(unsigned paged);
+static unsigned check_auto_cache_resize_input_errs(unsigned paged);
+static unsigned check_auto_cache_resize_aux_fcns(unsigned paged);
+static unsigned check_metadata_blizzard_absence(hbool_t fill_via_insertion, unsigned paged);
+static unsigned check_flush_deps(unsigned paged);
+static unsigned check_flush_deps_err(unsigned paged);
+static unsigned check_flush_deps_order(unsigned paged);
+static unsigned check_notify_cb(unsigned paged);
+static unsigned check_metadata_cork(hbool_t fill_via_insertion, unsigned paged);
+static unsigned check_entry_deletions_during_scans(unsigned paged);
static void cedds__expunge_dirty_entry_in_flush_test(H5F_t * file_ptr);
static void cedds__H5C_make_space_in_cache(H5F_t * file_ptr);
static void cedds__H5C__autoadjust__ageout__evict_aged_out_entries(H5F_t * file_ptr);
static void cedds__H5C_flush_invalidate_cache__bucket_scan(H5F_t * file_ptr);
-static unsigned check_stats(void);
+static unsigned check_stats(unsigned paged);
#if H5C_COLLECT_CACHE_STATS
static void check_stats__smoke_check_1(H5F_t * file_ptr);
#endif /* H5C_COLLECT_CACHE_STATS */
@@ -228,7 +229,7 @@ static void check_stats__smoke_check_1(H5F_t * file_ptr);
*/
static unsigned
-smoke_check_1(int express_test)
+smoke_check_1(int express_test, unsigned paged)
{
hbool_t show_progress = FALSE;
int dirty_unprotects = FALSE;
@@ -239,7 +240,10 @@ smoke_check_1(int express_test)
int mile_stone = 1;
H5F_t * file_ptr = NULL;
- TESTING("smoke check #1 -- all clean, ins, dest, ren, 4/2 MB cache");
+ if(paged)
+ TESTING("smoke check #1 -- all clean, ins, dest, ren, 4/2 MB cache, paged aggregation")
+ else
+ TESTING("smoke check #1 -- all clean, ins, dest, ren, 4/2 MB cache")
switch (express_test)
{
@@ -274,8 +278,7 @@ smoke_check_1(int express_test)
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
- file_ptr = setup_cache((size_t)(4 * 1024 * 1024),
- (size_t)(2 * 1024 * 1024));
+ file_ptr = setup_cache((size_t)(4 * 1024 * 1024), (size_t)(2 * 1024 * 1024), paged);
if(show_progress) /* 3 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
@@ -427,7 +430,7 @@ smoke_check_1(int express_test)
*/
static unsigned
-smoke_check_2(int express_test)
+smoke_check_2(int express_test, unsigned paged)
{
hbool_t show_progress = FALSE;
int dirty_unprotects = TRUE;
@@ -438,7 +441,10 @@ smoke_check_2(int express_test)
int mile_stone = 1;
H5F_t * file_ptr = NULL;
- TESTING("smoke check #2 -- ~1/2 dirty, ins, dest, ren, 4/2 MB cache");
+ if(paged)
+ TESTING("smoke check #2 -- ~1/2 dirty, ins, dest, ren, 4/2 MB cache, paged aggregation")
+ else
+ TESTING("smoke check #2 -- ~1/2 dirty, ins, dest, ren, 4/2 MB cache")
switch (express_test)
{
@@ -473,8 +479,7 @@ smoke_check_2(int express_test)
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
- file_ptr = setup_cache((size_t)(4 * 1024 * 1024),
- (size_t)(2 * 1024 * 1024));
+ file_ptr = setup_cache((size_t)(4 * 1024 * 1024), (size_t)(2 * 1024 * 1024), paged);
if(show_progress) /* 3 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
@@ -625,7 +630,7 @@ smoke_check_2(int express_test)
*/
static unsigned
-smoke_check_3(int express_test)
+smoke_check_3(int express_test, unsigned paged)
{
hbool_t show_progress = FALSE;
int dirty_unprotects = FALSE;
@@ -636,7 +641,10 @@ smoke_check_3(int express_test)
int mile_stone = 1;
H5F_t * file_ptr = NULL;
- TESTING("smoke check #3 -- all clean, ins, dest, ren, 2/1 KB cache");
+ if(paged)
+ TESTING("smoke check #3 -- all clean, ins, dest, ren, 2/1 KB cache, paged aggregation")
+ else
+ TESTING("smoke check #3 -- all clean, ins, dest, ren, 2/1 KB cache")
switch (express_test)
{
@@ -671,8 +679,7 @@ smoke_check_3(int express_test)
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
- file_ptr = setup_cache((size_t)(2 * 1024),
- (size_t)(1 * 1024));
+ file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024), paged);
if(show_progress) /* 3 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
@@ -824,7 +831,7 @@ smoke_check_3(int express_test)
*/
static unsigned
-smoke_check_4(int express_test)
+smoke_check_4(int express_test, unsigned paged)
{
hbool_t show_progress = FALSE;
int dirty_unprotects = TRUE;
@@ -835,7 +842,10 @@ smoke_check_4(int express_test)
int mile_stone = 1;
H5F_t * file_ptr = NULL;
- TESTING("smoke check #4 -- ~1/2 dirty, ins, dest, ren, 2/1 KB cache");
+ if(paged)
+ TESTING("smoke check #4 -- ~1/2 dirty, ins, dest, ren, 2/1 KB cache, paged aggregation")
+ else
+ TESTING("smoke check #4 -- ~1/2 dirty, ins, dest, ren, 2/1 KB cache")
switch (express_test)
{
@@ -870,8 +880,7 @@ smoke_check_4(int express_test)
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
- file_ptr = setup_cache((size_t)(2 * 1024),
- (size_t)(1 * 1024));
+ file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024), paged);
if(show_progress) /* 3 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
@@ -1023,7 +1032,7 @@ smoke_check_4(int express_test)
*/
static unsigned
-smoke_check_5(int express_test)
+smoke_check_5(int express_test, unsigned paged)
{
herr_t result;
hbool_t show_progress = FALSE;
@@ -1082,7 +1091,10 @@ smoke_check_5(int express_test)
/* double empty_reserve = */ 0.5f
};
- TESTING("smoke check #5 -- all clean, ins, prot, unprot, AR cache 1");
+ if(paged)
+ TESTING("smoke check #5 -- all clean, ins, prot, unprot, AR cache 1, paged aggregation")
+ else
+ TESTING("smoke check #5 -- all clean, ins, prot, unprot, AR cache 1")
switch (express_test)
{
@@ -1117,8 +1129,7 @@ smoke_check_5(int express_test)
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
- file_ptr = setup_cache((size_t)(2 * 1024),
- (size_t)(1 * 1024));
+ file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024), paged);
cache_ptr = file_ptr->shared->cache;
if(pass) {
@@ -1259,7 +1270,7 @@ smoke_check_5(int express_test)
*/
static unsigned
-smoke_check_6(int express_test)
+smoke_check_6(int express_test, unsigned paged)
{
herr_t result;
hbool_t show_progress = FALSE;
@@ -1318,7 +1329,10 @@ smoke_check_6(int express_test)
/* double empty_reserve = */ 0.05f
};
- TESTING("smoke check #6 -- ~1/2 dirty, ins, prot, unprot, AR cache 1");
+ if(paged)
+ TESTING("smoke check #6 -- ~1/2 dirty, ins, prot, unprot, AR cache 1, paged aggregation")
+ else
+ TESTING("smoke check #6 -- ~1/2 dirty, ins, prot, unprot, AR cache 1")
pass = TRUE;
@@ -1353,8 +1367,7 @@ smoke_check_6(int express_test)
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
- file_ptr = setup_cache((size_t)(2 * 1024),
- (size_t)(1 * 1024));
+ file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024), paged);
cache_ptr = file_ptr->shared->cache;
if(pass) {
@@ -1495,7 +1508,7 @@ smoke_check_6(int express_test)
*/
static unsigned
-smoke_check_7(int express_test)
+smoke_check_7(int express_test, unsigned paged)
{
herr_t result;
hbool_t show_progress = FALSE;
@@ -1555,7 +1568,10 @@ smoke_check_7(int express_test)
/* double empty_reserve = */ 0.1f
};
- TESTING("smoke check #7 -- all clean, ins, prot, unprot, AR cache 2");
+ if(paged)
+ TESTING("smoke check #7 -- all clean, ins, prot, unprot, AR cache 2, paged aggregation")
+ else
+ TESTING("smoke check #7 -- all clean, ins, prot, unprot, AR cache 2")
switch (express_test)
{
@@ -1590,8 +1606,7 @@ smoke_check_7(int express_test)
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
- file_ptr = setup_cache((size_t)(2 * 1024),
- (size_t)(1 * 1024));
+ file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024), paged);
cache_ptr = file_ptr->shared->cache;
if(pass) {
@@ -1732,7 +1747,7 @@ smoke_check_7(int express_test)
*/
static unsigned
-smoke_check_8(int express_test)
+smoke_check_8(int express_test, unsigned paged)
{
herr_t result;
hbool_t show_progress = FALSE;
@@ -1792,7 +1807,10 @@ smoke_check_8(int express_test)
/* double empty_reserve = */ 0.1f
};
- TESTING("smoke check #8 -- ~1/2 dirty, ins, prot, unprot, AR cache 2");
+ if(paged)
+ TESTING("smoke check #8 -- ~1/2 dirty, ins, prot, unprot, AR cache 2, paged aggregation")
+ else
+ TESTING("smoke check #8 -- ~1/2 dirty, ins, prot, unprot, AR cache 2")
switch (express_test)
{
@@ -1827,7 +1845,7 @@ smoke_check_8(int express_test)
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
- file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024));
+ file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024), paged);
cache_ptr = file_ptr->shared->cache;
if(pass) {
@@ -1975,7 +1993,7 @@ smoke_check_8(int express_test)
*/
static unsigned
-smoke_check_9(int express_test)
+smoke_check_9(int express_test, unsigned paged)
{
herr_t result;
hbool_t show_progress = FALSE;
@@ -1989,7 +2007,10 @@ smoke_check_9(int express_test)
H5F_t * file_ptr = NULL;
H5C_t * cache_ptr = NULL;
- TESTING("smoke check #9 -- all clean, ins, dest, ren, 4/2 MB, corked");
+ if(paged)
+ TESTING("smoke check #9 -- all clean, ins, dest, ren, 4/2 MB, corked, paged aggregation")
+ else
+ TESTING("smoke check #9 -- all clean, ins, dest, ren, 4/2 MB, corked")
switch (express_test)
{
@@ -2024,8 +2045,7 @@ smoke_check_9(int express_test)
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
- file_ptr = setup_cache((size_t)(4 * 1024 * 1024),
- (size_t)(2 * 1024 * 1024));
+ file_ptr = setup_cache((size_t)(4 * 1024 * 1024), (size_t)(2 * 1024 * 1024), paged);
cache_ptr = file_ptr->shared->cache;
/* disable evictions */
@@ -2295,7 +2315,7 @@ smoke_check_9(int express_test)
*/
static unsigned
-smoke_check_10(int express_test)
+smoke_check_10(int express_test, unsigned paged)
{
herr_t result;
hbool_t show_progress = FALSE;
@@ -2309,7 +2329,10 @@ smoke_check_10(int express_test)
H5F_t * file_ptr = NULL;
H5C_t * cache_ptr = NULL;
- TESTING("smoke check #10 -- ~1/2 dirty, ins, dest, ren, 4/2 MB, corked");
+ if(paged)
+ TESTING("smoke check #10 -- ~1/2 dirty, ins, dest, ren, 4/2 MB, corked, paged aggregation")
+ else
+ TESTING("smoke check #10 -- ~1/2 dirty, ins, dest, ren, 4/2 MB, corked")
switch (express_test)
{
@@ -2344,8 +2367,7 @@ smoke_check_10(int express_test)
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
- file_ptr = setup_cache((size_t)(4 * 1024 * 1024),
- (size_t)(2 * 1024 * 1024));
+ file_ptr = setup_cache((size_t)(4 * 1024 * 1024), (size_t)(2 * 1024 * 1024), paged);
cache_ptr = file_ptr->shared->cache;
if(show_progress) /* 3 */
@@ -2609,7 +2631,7 @@ write_permitted_check(int
#if !H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS
H5_ATTR_UNUSED
#endif /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */
-express_test)
+express_test, unsigned paged)
{
#if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS
@@ -2623,7 +2645,10 @@ express_test)
#endif /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */
- TESTING("write permitted check -- 1/0 MB cache");
+ if(paged)
+ TESTING("write permitted check -- 1/0 MB cache, paged aggregation")
+ else
+ TESTING("write permitted check -- 1/0 MB cache")
#if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS
@@ -2660,8 +2685,7 @@ express_test)
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
- file_ptr = setup_cache((size_t)(1 * 1024 * 1024),
- (size_t)(0));
+ file_ptr = setup_cache((size_t)(1 * 1024 * 1024), (size_t)0, paged);
if(show_progress) /* 3 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
@@ -2823,7 +2847,7 @@ express_test)
*/
static unsigned
-check_insert_entry(void)
+check_insert_entry(unsigned paged)
{
int entry_type = PICO_ENTRY_TYPE;
int i;
@@ -2839,8 +2863,10 @@ check_insert_entry(void)
test_entry_t * entry_ptr;
struct H5C_cache_entry_t * search_ptr;
-
- TESTING("H5C_insert_entry() functionality");
+ if(paged)
+ TESTING("H5C_insert_entry() functionality (paged aggregation)")
+ else
+ TESTING("H5C_insert_entry() functionality")
pass = TRUE;
@@ -2858,8 +2884,7 @@ check_insert_entry(void)
reset_entries();
- file_ptr = setup_cache((size_t)(2 * 1024 * 1024),
- (size_t)(1 * 1024 * 1024));
+ file_ptr = setup_cache((size_t)(2 * 1024 * 1024), (size_t)(1 * 1024 * 1024), paged);
cache_ptr = file_ptr->shared->cache;
}
@@ -3115,11 +3140,14 @@ check_insert_entry(void)
*/
static unsigned
-check_flush_cache(void)
+check_flush_cache(unsigned paged)
{
H5F_t * file_ptr = NULL;
- TESTING("H5C_flush_cache() functionality");
+ if(paged)
+ TESTING("H5C_flush_cache() functionality (paged aggregation)")
+ else
+ TESTING("H5C_flush_cache() functionality")
pass = TRUE;
@@ -3132,8 +3160,7 @@ check_flush_cache(void)
reset_entries();
- file_ptr = setup_cache((size_t)(2 * 1024 * 1024),
- (size_t)(1 * 1024 * 1024));
+ file_ptr = setup_cache((size_t)(2 * 1024 * 1024), (size_t)(1 * 1024 * 1024), paged);
}
/* first test behaviour on an empty cache. Can't do much sanity
@@ -12751,7 +12778,7 @@ check_flush_cache__pinned_single_entry_test(H5F_t * file_ptr,
*/
static unsigned
-check_get_entry_status(void)
+check_get_entry_status(unsigned paged)
{
static char msg[128];
herr_t result;
@@ -12764,7 +12791,10 @@ check_get_entry_status(void)
test_entry_t * base_addr = NULL;
test_entry_t * entry_ptr = NULL;
- TESTING("H5C_get_entry_status() functionality");
+ if(paged)
+ TESTING("H5C_get_entry_status() functionality (paged aggregation)")
+ else
+ TESTING("H5C_get_entry_status() functionality")
pass = TRUE;
@@ -12772,8 +12802,7 @@ check_get_entry_status(void)
reset_entries();
- file_ptr = setup_cache((size_t)(2 * 1024 * 1024),
- (size_t)(1 * 1024 * 1024));
+ file_ptr = setup_cache((size_t)(2 * 1024 * 1024), (size_t)(1 * 1024 * 1024), paged);
if(file_ptr == NULL) {
@@ -12980,7 +13009,7 @@ check_get_entry_status(void)
*/
static unsigned
-check_expunge_entry(void)
+check_expunge_entry(unsigned paged)
{
static char msg[128];
herr_t result;
@@ -12993,7 +13022,10 @@ check_expunge_entry(void)
test_entry_t * base_addr;
test_entry_t * entry_ptr;
- TESTING("H5C_expunge_entry() functionality");
+ if(paged)
+ TESTING("H5C_expunge_entry() functionality (paged aggregation)")
+ else
+ TESTING("H5C_expunge_entry() functionality")
pass = TRUE;
@@ -13001,8 +13033,7 @@ check_expunge_entry(void)
reset_entries();
- file_ptr = setup_cache((size_t)(2 * 1024 * 1024),
- (size_t)(1 * 1024 * 1024));
+ file_ptr = setup_cache((size_t)(2 * 1024 * 1024), (size_t)(1 * 1024 * 1024), paged);
base_addr = entries[0];
entry_ptr = &(base_addr[0]);
@@ -13289,7 +13320,7 @@ check_expunge_entry(void)
*-------------------------------------------------------------------------
*/
static unsigned
-check_multiple_read_protect(void)
+check_multiple_read_protect(unsigned paged)
{
H5F_t * file_ptr = NULL;
#if H5C_COLLECT_CACHE_STATS
@@ -13297,7 +13328,10 @@ check_multiple_read_protect(void)
#endif /* H5C_COLLECT_CACHE_STATS */
test_entry_t * entry_ptr;
- TESTING("multiple read only protects on a single entry");
+ if(paged)
+ TESTING("multiple read only protects on a single entry (paged aggregation)")
+ else
+ TESTING("multiple read only protects on a single entry")
pass = TRUE;
@@ -13326,8 +13360,7 @@ check_multiple_read_protect(void)
reset_entries();
- file_ptr = setup_cache((size_t)(2 * 1024),
- (size_t)(1 * 1024));
+ file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024), paged);
#if H5C_COLLECT_CACHE_STATS
cache_ptr = file_ptr->shared->cache;
#endif /* H5C_COLLECT_CACHE_STATS */
@@ -13711,7 +13744,7 @@ check_multiple_read_protect(void)
*/
static unsigned
-check_move_entry(void)
+check_move_entry(unsigned paged)
{
unsigned u;
H5F_t * file_ptr = NULL;
@@ -13743,7 +13776,10 @@ check_move_entry(void)
},
};
- TESTING("H5C_move_entry() functionality");
+ if(paged)
+ TESTING("H5C_move_entry() functionality (paged aggregation)")
+ else
+ TESTING("H5C_move_entry() functionality")
pass = TRUE;
@@ -13776,8 +13812,7 @@ check_move_entry(void)
reset_entries();
- file_ptr = setup_cache((size_t)(2 * 1024 * 1024),
- (size_t)(1 * 1024 * 1024));
+ file_ptr = setup_cache((size_t)(2 * 1024 * 1024), (size_t)(1 * 1024 * 1024), paged);
}
u = 0;
@@ -14003,7 +14038,7 @@ check_move_entry__run_test(H5F_t * file_ptr,
*/
static unsigned
-check_pin_protected_entry(void)
+check_pin_protected_entry(unsigned paged)
{
static char msg[128];
herr_t result;
@@ -14011,7 +14046,10 @@ check_pin_protected_entry(void)
test_entry_t * base_addr;
test_entry_t * entry_ptr;
- TESTING("H5C_pin_protected_entry() functionality");
+ if(paged)
+ TESTING("H5C_pin_protected_entry() functionality (paged aggregation)")
+ else
+ TESTING("H5C_pin_protected_entry() functionality")
pass = TRUE;
@@ -14024,8 +14062,7 @@ check_pin_protected_entry(void)
reset_entries();
- file_ptr = setup_cache((size_t)(2 * 1024 * 1024),
- (size_t)(1 * 1024 * 1024));
+ file_ptr = setup_cache((size_t)(2 * 1024 * 1024), (size_t)(1 * 1024 * 1024), paged);
if(file_ptr == NULL) {
@@ -14102,7 +14139,7 @@ check_pin_protected_entry(void)
*/
static unsigned
-check_resize_entry(void)
+check_resize_entry(unsigned paged)
{
static char msg[128];
herr_t result;
@@ -14117,7 +14154,10 @@ check_resize_entry(void)
test_entry_t * base_addr;
test_entry_t * entry_ptr = NULL;
- TESTING("entry resize functionality");
+ if(paged)
+ TESTING("entry resize functionality (paged aggregation)")
+ else
+ TESTING("entry resize functionality")
/* Setup a cache and verify that it is empty.
*
@@ -14156,8 +14196,8 @@ check_resize_entry(void)
reset_entries();
- file_ptr = setup_cache((size_t)(2 * 1024 * 1024),
- (size_t)(1 * 1024 * 1024));
+ file_ptr = setup_cache((size_t)(2 * 1024 * 1024), (size_t)(1 * 1024 * 1024), paged);
+
if(file_ptr == NULL) {
pass = FALSE;
@@ -15097,7 +15137,7 @@ check_resize_entry(void)
*/
static unsigned
-check_evictions_enabled(void)
+check_evictions_enabled(unsigned paged)
{
static char msg[128];
herr_t result;
@@ -15111,7 +15151,10 @@ check_evictions_enabled(void)
test_entry_t * base_addr = NULL;
test_entry_t * entry_ptr;
- TESTING("evictions enabled/disabled functionality");
+ if(paged)
+ TESTING("evictions enabled/disabled functionality (paged aggregation)")
+ else
+ TESTING("evictions enabled/disabled functionality")
/* Setup a cache and verify that it is empty.
*
@@ -15159,8 +15202,8 @@ check_evictions_enabled(void)
reset_entries();
- file_ptr = setup_cache((size_t)(1 * 1024 * 1024),
- (size_t)( 512 * 1024));
+ file_ptr = setup_cache((size_t)(1 * 1024 * 1024), (size_t)(512 * 1024), paged);
+
if(file_ptr == NULL) {
pass = FALSE;
@@ -15830,11 +15873,14 @@ check_evictions_enabled(void)
*/
static unsigned
-check_flush_protected_err(void)
+check_flush_protected_err(unsigned paged)
{
H5F_t * file_ptr = NULL;
- TESTING("flush cache with protected entry error");
+ if(paged)
+ TESTING("flush cache with protected entry error (paged aggregation)")
+ else
+ TESTING("flush cache with protected entry error")
pass = TRUE;
@@ -15847,8 +15893,7 @@ check_flush_protected_err(void)
reset_entries();
- file_ptr = setup_cache((size_t)(2 * 1024),
- (size_t)(1 * 1024));
+ file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024), paged);
protect_entry(file_ptr, 0, 0);
@@ -15904,11 +15949,14 @@ check_flush_protected_err(void)
*-------------------------------------------------------------------------
*/
static unsigned
-check_destroy_pinned_err(void)
+check_destroy_pinned_err(unsigned paged)
{
H5F_t * file_ptr = NULL;
- TESTING("destroy cache with permanently pinned entry error");
+ if(paged)
+ TESTING("destroy cache with permanently pinned entry error (paged aggregation)")
+ else
+ TESTING("destroy cache with permanently pinned entry error")
pass = TRUE;
@@ -15920,8 +15968,7 @@ check_destroy_pinned_err(void)
reset_entries();
- file_ptr = setup_cache((size_t)(2 * 1024),
- (size_t)(1 * 1024));
+ file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024), paged);
protect_entry(file_ptr, 0, 0);
unprotect_entry(file_ptr, 0, 0, H5C__PIN_ENTRY_FLAG);
@@ -15985,11 +16032,14 @@ check_destroy_pinned_err(void)
*/
static unsigned
-check_destroy_protected_err(void)
+check_destroy_protected_err(unsigned paged)
{
H5F_t * file_ptr = NULL;
- TESTING("destroy cache with protected entry error");
+ if(paged)
+ TESTING("destroy cache with protected entry error (paged aggregation)")
+ else
+ TESTING("destroy cache with protected entry error")
pass = TRUE;
@@ -16002,8 +16052,7 @@ check_destroy_protected_err(void)
reset_entries();
- file_ptr = setup_cache((size_t)(2 * 1024),
- (size_t)(1 * 1024));
+ file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024), paged);
/* Note: normally this call would go just before the series of
* flushes prior to file close -- in particular, all entries
@@ -16075,14 +16124,17 @@ check_destroy_protected_err(void)
*/
static unsigned
-check_duplicate_insert_err(void)
+check_duplicate_insert_err(unsigned paged)
{
herr_t result = -1;
H5F_t * file_ptr = NULL;
test_entry_t * base_addr;
test_entry_t * entry_ptr;
- TESTING("duplicate entry insertion error");
+ if(paged)
+ TESTING("duplicate entry insertion error (paged aggregation)")
+ else
+ TESTING("duplicate entry insertion error")
pass = TRUE;
@@ -16095,8 +16147,7 @@ check_duplicate_insert_err(void)
reset_entries();
- file_ptr = setup_cache((size_t)(2 * 1024),
- (size_t)(1 * 1024));
+ file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024), paged);
protect_entry(file_ptr, 0, 0);
@@ -16155,13 +16206,16 @@ check_duplicate_insert_err(void)
*/
static unsigned
-check_double_pin_err(void)
+check_double_pin_err(unsigned paged)
{
herr_t result;
H5F_t * file_ptr = NULL;
test_entry_t * entry_ptr;
- TESTING("pin a pinned entry error");
+ if(paged)
+ TESTING("pin a pinned entry error (paged aggregation)")
+ else
+ TESTING("pin a pinned entry error")
pass = TRUE;
@@ -16175,8 +16229,7 @@ check_double_pin_err(void)
reset_entries();
- file_ptr = setup_cache((size_t)(2 * 1024),
- (size_t)(1 * 1024));
+ file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024), paged);
protect_entry(file_ptr, 0, 0);
@@ -16241,13 +16294,16 @@ check_double_pin_err(void)
*/
static unsigned
-check_double_unpin_err(void)
+check_double_unpin_err(unsigned paged)
{
herr_t result;
H5F_t * file_ptr = NULL;
test_entry_t * entry_ptr;
- TESTING("unpin an unpinned entry error");
+ if(paged)
+ TESTING("unpin an unpinned entry error (paged aggregation)")
+ else
+ TESTING("unpin an unpinned entry error")
pass = TRUE;
@@ -16263,8 +16319,7 @@ check_double_unpin_err(void)
reset_entries();
- file_ptr = setup_cache((size_t)(2 * 1024),
- (size_t)(1 * 1024));
+ file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024), paged);
protect_entry(file_ptr, 0, 0);
@@ -16338,13 +16393,16 @@ check_double_unpin_err(void)
*/
static unsigned
-check_pin_entry_errs(void)
+check_pin_entry_errs(unsigned paged)
{
herr_t result;
H5F_t * file_ptr = NULL;
test_entry_t * entry_ptr;
- TESTING("pin entry related errors");
+ if(paged)
+ TESTING("pin entry related errors (paged aggregation)")
+ else
+ TESTING("pin entry related errors")
pass = TRUE;
@@ -16364,8 +16422,7 @@ check_pin_entry_errs(void)
reset_entries();
- file_ptr = setup_cache((size_t)(2 * 1024),
- (size_t)(1 * 1024));
+ file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024), paged);
protect_entry(file_ptr, 0, 0);
@@ -16444,13 +16501,16 @@ check_pin_entry_errs(void)
*/
static unsigned
-check_double_protect_err(void)
+check_double_protect_err(unsigned paged)
{
H5F_t * file_ptr = NULL;
test_entry_t * entry_ptr;
H5C_cache_entry_t * cache_entry_ptr;
- TESTING("protect a protected entry error");
+ if(paged)
+ TESTING("protect a protected entry error (paged aggregation)")
+ else
+ TESTING("protect a protected entry error")
pass = TRUE;
@@ -16463,8 +16523,7 @@ check_double_protect_err(void)
reset_entries();
- file_ptr = setup_cache((size_t)(2 * 1024),
- (size_t)(1 * 1024));
+ file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024), paged);
protect_entry(file_ptr, 0, 0);
@@ -16522,13 +16581,16 @@ check_double_protect_err(void)
*/
static unsigned
-check_double_unprotect_err(void)
+check_double_unprotect_err(unsigned paged)
{
herr_t result;
H5F_t * file_ptr = NULL;
test_entry_t * entry_ptr;
- TESTING("unprotect an unprotected entry error");
+ if(paged)
+ TESTING("unprotect an unprotected entry error (paged aggregation)")
+ else
+ TESTING("unprotect an unprotected entry error")
pass = TRUE;
@@ -16541,8 +16603,7 @@ check_double_unprotect_err(void)
reset_entries();
- file_ptr = setup_cache((size_t)(2 * 1024),
- (size_t)(1 * 1024));
+ file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024), paged);
protect_entry(file_ptr, 0, 0);
@@ -16600,13 +16661,16 @@ check_double_unprotect_err(void)
*/
static unsigned
-check_mark_entry_dirty_errs(void)
+check_mark_entry_dirty_errs(unsigned paged)
{
herr_t result;
H5F_t * file_ptr = NULL;
test_entry_t * entry_ptr;
- TESTING("mark entry dirty related errors");
+ if(paged)
+ TESTING("mark entry dirty related errors (paged aggregation)")
+ else
+ TESTING("mark entry dirty related errors")
pass = TRUE;
@@ -16620,8 +16684,7 @@ check_mark_entry_dirty_errs(void)
reset_entries();
- file_ptr = setup_cache((size_t)(2 * 1024),
- (size_t)(1 * 1024));
+ file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024), paged);
protect_entry(file_ptr, 0, 0);
@@ -16680,13 +16743,16 @@ check_mark_entry_dirty_errs(void)
*/
static unsigned
-check_expunge_entry_errs(void)
+check_expunge_entry_errs(unsigned paged)
{
herr_t result;
H5F_t * file_ptr = NULL;
test_entry_t * entry_ptr;
- TESTING("expunge entry related errors");
+ if(paged)
+ TESTING("expunge entry related errors (paged aggregation)")
+ else
+ TESTING("expunge entry related errors")
pass = TRUE;
@@ -16706,8 +16772,7 @@ check_expunge_entry_errs(void)
reset_entries();
- file_ptr = setup_cache((size_t)(2 * 1024),
- (size_t)(1 * 1024));
+ file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024), paged);
entry_ptr = &((entries[0])[0]);
@@ -16798,7 +16863,7 @@ check_expunge_entry_errs(void)
*-------------------------------------------------------------------------
*/
static unsigned
-check_move_entry_errs(void)
+check_move_entry_errs(unsigned paged)
{
herr_t result;
H5F_t * file_ptr = NULL;
@@ -16808,7 +16873,10 @@ check_move_entry_errs(void)
test_entry_t * entry_0_1_ptr;
test_entry_t * entry_1_0_ptr;
- TESTING("move entry related errors");
+ if(paged)
+ TESTING("move entry related errors (paged aggregation)")
+ else
+ TESTING("move entry related errors")
pass = TRUE;
@@ -16820,7 +16888,7 @@ check_move_entry_errs(void)
if(pass) {
reset_entries();
- file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024));
+ file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024), paged);
cache_ptr = file_ptr->shared->cache;
insert_entry(file_ptr, 0, 0, H5C__NO_FLAGS_SET);
@@ -16863,8 +16931,7 @@ check_move_entry_errs(void)
if(pass) {
reset_entries();
- file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024));
-
+ file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024), paged);
cache_ptr = file_ptr->shared->cache;
insert_entry(file_ptr, 0, 0, H5C__NO_FLAGS_SET);
@@ -16914,13 +16981,16 @@ check_move_entry_errs(void)
*/
static unsigned
-check_resize_entry_errs(void)
+check_resize_entry_errs(unsigned paged)
{
herr_t result;
H5F_t * file_ptr = NULL;
test_entry_t * entry_ptr;
- TESTING("resize entry related errors");
+ if(paged)
+ TESTING("resize entry related errors (paged aggregation)")
+ else
+ TESTING("resize entry related errors")
pass = TRUE;
@@ -16939,8 +17009,7 @@ check_resize_entry_errs(void)
reset_entries();
- file_ptr = setup_cache((size_t)(2 * 1024),
- (size_t)(1 * 1024));
+ file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024), paged);
entry_ptr = &((entries[0])[0]);
@@ -17015,13 +17084,16 @@ check_resize_entry_errs(void)
*/
static unsigned
-check_unprotect_ro_dirty_err(void)
+check_unprotect_ro_dirty_err(unsigned paged)
{
herr_t result;
H5F_t * file_ptr = NULL;
test_entry_t * entry_ptr;
- TESTING("unprotect a read only entry dirty error");
+ if(paged)
+ TESTING("unprotect a read only entry dirty error (paged aggregation)")
+ else
+ TESTING("unprotect a read only entry dirty error")
pass = TRUE;
@@ -17034,8 +17106,7 @@ check_unprotect_ro_dirty_err(void)
reset_entries();
- file_ptr = setup_cache((size_t)(2 * 1024),
- (size_t)(1 * 1024));
+ file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024), paged);
protect_entry_ro(file_ptr, 0, 0);
@@ -17076,8 +17147,7 @@ check_unprotect_ro_dirty_err(void)
reset_entries();
- file_ptr = setup_cache((size_t)(2 * 1024),
- (size_t)(1 * 1024));
+ file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024), paged);
protect_entry_ro(file_ptr, 0, 0);
protect_entry_ro(file_ptr, 0, 0);
@@ -17142,13 +17212,16 @@ check_unprotect_ro_dirty_err(void)
*/
static unsigned
-check_protect_ro_rw_err(void)
+check_protect_ro_rw_err(unsigned paged)
{
H5F_t * file_ptr = NULL;
test_entry_t * entry_ptr;
void * thing_ptr = NULL;
- TESTING("protect a read only entry rw error");
+ if(paged)
+ TESTING("protect a read only entry rw error (paged aggregation)")
+ else
+ TESTING("protect a read only entry rw error")
pass = TRUE;
@@ -17162,8 +17235,7 @@ check_protect_ro_rw_err(void)
reset_entries();
- file_ptr = setup_cache((size_t)(2 * 1024),
- (size_t)(1 * 1024));
+ file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024), paged);
protect_entry_ro(file_ptr, 0, 0);
@@ -17219,7 +17291,7 @@ check_protect_ro_rw_err(void)
*-------------------------------------------------------------------------
*/
static unsigned
-check_protect_retries(void)
+check_protect_retries(unsigned paged)
{
H5F_t * file_ptr = NULL;
H5C_t *cache_ptr = NULL;
@@ -17229,7 +17301,10 @@ check_protect_retries(void)
int32_t type;
int32_t idx;
- TESTING("protect an entry to verify retries");
+ if(paged)
+ TESTING("protect an entry to verify retries (paged aggregation)")
+ else
+ TESTING("protect an entry to verify retries")
pass = TRUE;
@@ -17238,8 +17313,7 @@ check_protect_retries(void)
reset_entries();
- file_ptr = setup_cache((size_t)(2 * 1024),
- (size_t)(1 * 1024));
+ file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024), paged);
/* Set up read attempts for verifying checksum */
file_ptr->shared->read_attempts = 10;
@@ -17354,14 +17428,17 @@ check_protect_retries(void)
*/
static unsigned
-check_check_evictions_enabled_err(void)
+check_check_evictions_enabled_err(unsigned paged)
{
herr_t result;
hbool_t evictions_enabled;
H5F_t * file_ptr = NULL;
H5C_t * cache_ptr = NULL;
- TESTING("get/set evictions enabled errors");
+ if(paged)
+ TESTING("get/set evictions enabled errors (paged aggregation)")
+ else
+ TESTING("get/set evictions enabled errors")
pass = TRUE;
@@ -17382,8 +17459,7 @@ check_check_evictions_enabled_err(void)
reset_entries();
- file_ptr = setup_cache((size_t)(2 * 1024),
- (size_t)(1 * 1024));
+ file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024), paged);
cache_ptr = file_ptr->shared->cache;
}
@@ -17506,7 +17582,7 @@ static void test_rpt_fcn(H5_ATTR_UNUSED H5C_t * cache_ptr,
}
static unsigned
-check_auto_cache_resize(hbool_t cork_ageout)
+check_auto_cache_resize(hbool_t cork_ageout, unsigned paged)
{
hbool_t show_progress = FALSE;
herr_t result;
@@ -17560,7 +17636,10 @@ check_auto_cache_resize(hbool_t cork_ageout)
/* double empty_reserve = */ 0.05f
};
- TESTING("automatic cache resizing");
+ if(paged)
+ TESTING("automatic cache resizing (paged aggregation)")
+ else
+ TESTING("automatic cache resizing")
pass = TRUE;
@@ -17574,7 +17653,7 @@ check_auto_cache_resize(hbool_t cork_ageout)
if(pass) {
reset_entries();
- file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024));
+ file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024), paged);
cache_ptr = file_ptr->shared->cache;
}
@@ -21576,7 +21655,7 @@ check_auto_cache_resize(hbool_t cork_ageout)
*/
static unsigned
-check_auto_cache_resize_disable(void)
+check_auto_cache_resize_disable(unsigned paged)
{
hbool_t show_progress = FALSE;
herr_t result;
@@ -21630,7 +21709,10 @@ check_auto_cache_resize_disable(void)
/* double empty_reserve = */ 0.05f
};
- TESTING("automatic cache resize disable");
+ if(paged)
+ TESTING("automatic cache resize disable (paged aggregation)")
+ else
+ TESTING("automatic cache resize disable")
pass = TRUE;
@@ -21645,8 +21727,7 @@ check_auto_cache_resize_disable(void)
reset_entries();
- file_ptr = setup_cache((size_t)(2 * 1024),
- (size_t)(1 * 1024));
+ file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024), paged);
if(file_ptr == NULL) {
@@ -24301,7 +24382,7 @@ check_auto_cache_resize_disable(void)
*/
static unsigned
-check_auto_cache_resize_epoch_markers(void)
+check_auto_cache_resize_epoch_markers(unsigned paged)
{
hbool_t show_progress = FALSE;
herr_t result;
@@ -24356,7 +24437,10 @@ check_auto_cache_resize_epoch_markers(void)
/* double empty_reserve = */ 0.05f
};
- TESTING("automatic cache resize epoch marker management");
+ if(paged)
+ TESTING("automatic cache resize epoch marker management (paged aggregation)")
+ else
+ TESTING("automatic cache resize epoch marker management")
pass = TRUE;
@@ -24366,8 +24450,7 @@ check_auto_cache_resize_epoch_markers(void)
reset_entries();
- file_ptr = setup_cache((size_t)(2 * 1024),
- (size_t)(1 * 1024));
+ file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024), paged);
cache_ptr = file_ptr->shared->cache;
}
@@ -25010,7 +25093,7 @@ check_auto_cache_resize_epoch_markers(void)
*/
static unsigned
-check_auto_cache_resize_input_errs(void)
+check_auto_cache_resize_input_errs(unsigned paged)
{
herr_t result;
H5F_t * file_ptr = NULL;
@@ -25064,7 +25147,10 @@ check_auto_cache_resize_input_errs(void)
H5C_auto_size_ctl_t invalid_auto_size_ctl;
H5C_auto_size_ctl_t test_auto_size_ctl;
- TESTING("automatic cache resize input errors");
+ if(paged)
+ TESTING("automatic cache resize input errors (paged aggregation)")
+ else
+ TESTING("automatic cache resize input errors")
pass = TRUE;
@@ -25078,8 +25164,7 @@ check_auto_cache_resize_input_errs(void)
reset_entries();
- file_ptr = setup_cache((size_t)(2 * 1024),
- (size_t)(1 * 1024));
+ file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024), paged);
cache_ptr = file_ptr->shared->cache;
}
@@ -27417,7 +27502,7 @@ check_auto_cache_resize_input_errs(void)
*/
static unsigned
-check_auto_cache_resize_aux_fcns(void)
+check_auto_cache_resize_aux_fcns(unsigned paged)
{
herr_t result;
int32_t i;
@@ -27478,7 +27563,10 @@ check_auto_cache_resize_aux_fcns(void)
};
- TESTING("automatic cache resize auxilary functions");
+ if(paged)
+ TESTING("automatic cache resize auxilary functions (paged aggregation)")
+ else
+ TESTING("automatic cache resize auxilary functions")
pass = TRUE;
@@ -27489,8 +27577,7 @@ check_auto_cache_resize_aux_fcns(void)
reset_entries();
- file_ptr = setup_cache((size_t)(2 * 1024),
- (size_t)(1 * 1024));
+ file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024), paged);
cache_ptr = file_ptr->shared->cache;
}
@@ -27962,7 +28049,7 @@ check_auto_cache_resize_aux_fcns(void)
*/
static unsigned
-check_metadata_blizzard_absence(hbool_t fill_via_insertion)
+check_metadata_blizzard_absence(hbool_t fill_via_insertion, unsigned paged)
{
int entry_type = HUGE_ENTRY_TYPE;
size_t entry_size = HUGE_ENTRY_SIZE; /* 16 KB */
@@ -28142,13 +28229,17 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion)
reset_entries();
if(fill_via_insertion) {
-
- TESTING("to ensure metadata blizzard absence when inserting");
-
- } else {
-
- TESTING("to ensure metadata blizzard absence on protect/unprotect");
- }
+ if(paged)
+ TESTING("to ensure metadata blizzard absence when inserting (paged aggregation)")
+ else
+ TESTING("to ensure metadata blizzard absence when inserting")
+ } /* end if */
+ else {
+ if(paged)
+ TESTING("to ensure metadata blizzard absence on protect/unprotect (paged aggregation)")
+ else
+ TESTING("to ensure metadata blizzard absence on protect/unprotect")
+ } /* end else */
if(show_progress) /* 0 */
HDfprintf(stdout, "\n%s: check point %d -- pass %d\n", FUNC, checkpoint++, pass);
@@ -28160,8 +28251,7 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion)
* The max_cache_size should have room for 50 entries.
* The min_clean_size is half of that, or 25 entries.
*/
- file_ptr = setup_cache((size_t)(50 * entry_size), /* max_cache_size */
- (size_t)(25 * entry_size)); /* min_clean_size */
+ file_ptr = setup_cache((size_t)(50 * entry_size), (size_t)(25 * entry_size), paged);
if(file_ptr == NULL) {
@@ -28805,7 +28895,7 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion)
*/
static unsigned
-check_flush_deps(void)
+check_flush_deps(unsigned paged)
{
H5F_t * file_ptr = NULL; /* File for this test */
H5C_t * cache_ptr = NULL; /* Metadata cache for this test */
@@ -28823,7 +28913,10 @@ check_flush_deps(void)
{ PICO_ENTRY_TYPE, 4, PICO_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}
};
- TESTING("flush dependencies");
+ if(paged)
+ TESTING("flush dependencies (paged aggregation)")
+ else
+ TESTING("flush dependencies")
pass = TRUE;
@@ -28832,7 +28925,7 @@ check_flush_deps(void)
*/
reset_entries();
- file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024));
+ file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024), paged);
cache_ptr = file_ptr->shared->cache;
base_addr = entries[entry_type];
@@ -30541,13 +30634,16 @@ done:
*/
static unsigned
-check_flush_deps_err(void)
+check_flush_deps_err(unsigned paged)
{
H5F_t * file_ptr = NULL; /* File for this test */
int entry_type = PICO_ENTRY_TYPE; /* Use very small entry size (size of entries doesn't matter) */
unsigned test_count; /* Test iteration variable */
- TESTING("flush dependency errors");
+ if(paged)
+ TESTING("flush dependency errors (paged aggregation)")
+ else
+ TESTING("flush dependency errors")
pass = TRUE;
@@ -30560,7 +30656,7 @@ check_flush_deps_err(void)
/* Allocate a cache */
reset_entries();
- file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024));
+ file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024), paged);
if(!pass) CACHE_ERROR("setup_cache failed")
/* Insert entries to work with into the cache */
@@ -30762,7 +30858,7 @@ done:
*/
static unsigned
-check_flush_deps_order(void)
+check_flush_deps_order(unsigned paged)
{
H5F_t * file_ptr = NULL; /* File for this test */
H5C_t * cache_ptr = NULL; /* Metadata cache for this test */
@@ -30780,7 +30876,10 @@ check_flush_deps_order(void)
};
unsigned flush_order; /* Index for tracking flush order */
- TESTING("flush dependencies flush order");
+ if(paged)
+ TESTING("flush dependencies flush order (paged aggregation)")
+ else
+ TESTING("flush dependencies flush order")
pass = TRUE;
@@ -30789,7 +30888,7 @@ check_flush_deps_order(void)
*/
reset_entries();
- file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024));
+ file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024), paged);
cache_ptr = file_ptr->shared->cache;
if(!pass) CACHE_ERROR("setup_cache failed")
@@ -33330,7 +33429,7 @@ done:
*/
static unsigned
-check_notify_cb(void)
+check_notify_cb(unsigned paged)
{
H5F_t * file_ptr = NULL; /* File for this test */
H5C_t * cache_ptr = NULL; /* Metadata cache for this test */
@@ -33349,7 +33448,10 @@ check_notify_cb(void)
{ NOTIFY_ENTRY_TYPE, 4, NOTIFY_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}
};
- TESTING("'notify' callback");
+ if(paged)
+ TESTING("'notify' callback (paged)")
+ else
+ TESTING("'notify' callback")
pass = TRUE;
@@ -33358,7 +33460,7 @@ check_notify_cb(void)
*/
reset_entries();
- file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024));
+ file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024), paged);
if(!file_ptr) CACHE_ERROR("setup_cache returned NULL")
cache_ptr = file_ptr->shared->cache;
base_addr = entries[entry_type];
@@ -33531,7 +33633,7 @@ done:
*-------------------------------------------------------------------------
*/
static unsigned
-check_metadata_cork(hbool_t fill_via_insertion)
+check_metadata_cork(hbool_t fill_via_insertion, unsigned paged)
{
const char * fcn_name = "check_metadata_cork";
int entry_type = HUGE_ENTRY_TYPE;
@@ -33727,8 +33829,7 @@ check_metadata_cork(hbool_t fill_via_insertion)
* The max_cache_size should have room for 50 entries.
* The min_clean_size is half of that, or 25 entries.
*/
- file_ptr = setup_cache((size_t)(50 * entry_size), /* max_cache_size */
- (size_t)(25 * entry_size)); /* min_clean_size */
+ file_ptr = setup_cache((size_t)(50 * entry_size), (size_t)(25 * entry_size), paged);
if(file_ptr == NULL) {
@@ -34277,11 +34378,14 @@ check_metadata_cork(hbool_t fill_via_insertion)
*-------------------------------------------------------------------------
*/
static unsigned
-check_entry_deletions_during_scans(void)
+check_entry_deletions_during_scans(unsigned paged)
{
H5F_t * file_ptr = NULL;
- TESTING("entry deletion during list scan detection and adaption");
+ if(paged)
+ TESTING("entry deletion during list scan detection and adaption (paged aggregation)")
+ else
+ TESTING("entry deletion during list scan detection and adaption")
pass = TRUE;
@@ -34294,8 +34398,7 @@ check_entry_deletions_during_scans(void)
reset_entries();
- file_ptr = setup_cache((size_t)(2 * 1024 * 1024),
- (size_t)(1 * 1024 * 1024));
+ file_ptr = setup_cache((size_t)(2 * 1024 * 1024), (size_t)(1 * 1024 * 1024), paged);
}
/* run the tests. This set of tests is somewhat eclectic, as
@@ -35769,7 +35872,7 @@ cedds__H5C_flush_invalidate_cache__bucket_scan(H5F_t * file_ptr)
*/
static unsigned
-check_stats(void)
+check_stats(unsigned paged)
{
#if H5C_COLLECT_CACHE_STATS
@@ -35778,7 +35881,10 @@ check_stats(void)
#endif /* H5C_COLLECT_CACHE_STATS */
- TESTING("metadata cache statistics collection");
+ if(paged)
+ TESTING("metadata cache statistics collection (paged aggregation)")
+ else
+ TESTING("metadata cache statistics collection")
#if H5C_COLLECT_CACHE_STATS
@@ -35786,8 +35892,7 @@ check_stats(void)
reset_entries();
- file_ptr = setup_cache((size_t)(2 * 1024 * 1024),
- (size_t)(1 * 1024 * 1024));
+ file_ptr = setup_cache((size_t)(2 * 1024 * 1024), (size_t)(1 * 1024 * 1024), paged);
if(pass) {
@@ -36268,6 +36373,7 @@ int
main(void)
{
unsigned nerrs = 0;
+ unsigned paged;
int express_test;
H5open();
@@ -36285,61 +36391,63 @@ main(void)
return EXIT_FAILURE;
} /* end if */
- nerrs += smoke_check_1(express_test);
- nerrs += smoke_check_2(express_test);
- nerrs += smoke_check_3(express_test);
- nerrs += smoke_check_4(express_test);
- nerrs += smoke_check_5(express_test);
- nerrs += smoke_check_6(express_test);
- nerrs += smoke_check_7(express_test);
- nerrs += smoke_check_8(express_test);
- nerrs += smoke_check_9(express_test);
- nerrs += smoke_check_10(express_test);
-
- nerrs += write_permitted_check(express_test);
-
- nerrs += check_insert_entry();
- nerrs += check_flush_cache();
- nerrs += check_get_entry_status();
- nerrs += check_expunge_entry();
- nerrs += check_multiple_read_protect();
- nerrs += check_move_entry();
- nerrs += check_pin_protected_entry();
- nerrs += check_resize_entry();
- nerrs += check_evictions_enabled();
- nerrs += check_flush_protected_err();
- nerrs += check_destroy_pinned_err();
- nerrs += check_destroy_protected_err();
- nerrs += check_duplicate_insert_err();
- nerrs += check_double_pin_err();
- nerrs += check_double_unpin_err();
- nerrs += check_pin_entry_errs();
- nerrs += check_double_protect_err();
- nerrs += check_double_unprotect_err();
- nerrs += check_mark_entry_dirty_errs();
- nerrs += check_expunge_entry_errs();
- nerrs += check_move_entry_errs();
- nerrs += check_resize_entry_errs();
- nerrs += check_unprotect_ro_dirty_err();
- nerrs += check_protect_ro_rw_err();
- nerrs += check_protect_retries();
- nerrs += check_check_evictions_enabled_err();
- nerrs += check_auto_cache_resize(FALSE);
- nerrs += check_auto_cache_resize(TRUE);
- nerrs += check_auto_cache_resize_disable();
- nerrs += check_auto_cache_resize_epoch_markers();
- nerrs += check_auto_cache_resize_input_errs();
- nerrs += check_auto_cache_resize_aux_fcns();
- nerrs += check_metadata_blizzard_absence(TRUE);
- nerrs += check_metadata_blizzard_absence(FALSE);
- nerrs += check_flush_deps();
- nerrs += check_flush_deps_err();
- nerrs += check_flush_deps_order();
- nerrs += check_notify_cb();
- nerrs += check_metadata_cork(TRUE);
- nerrs += check_metadata_cork(FALSE);
- nerrs += check_entry_deletions_during_scans();
- nerrs += check_stats();
+ /* Test with paged aggregation enabled or not */
+ /* Each test will call setup_cache() which set up the file space strategy according to "paged" */
+ for(paged = FALSE; paged <= TRUE; paged++) {
+ nerrs += smoke_check_1(express_test, paged);
+ nerrs += smoke_check_2(express_test, paged);
+ nerrs += smoke_check_3(express_test, paged);
+ nerrs += smoke_check_4(express_test, paged);
+ nerrs += smoke_check_5(express_test, paged);
+ nerrs += smoke_check_6(express_test, paged);
+ nerrs += smoke_check_7(express_test, paged);
+ nerrs += smoke_check_8(express_test, paged);
+ nerrs += smoke_check_9(express_test, paged);
+ nerrs += smoke_check_10(express_test, paged);
+ nerrs += write_permitted_check(express_test, paged);
+ nerrs += check_insert_entry(paged);
+ nerrs += check_flush_cache(paged);
+ nerrs += check_get_entry_status(paged);
+ nerrs += check_expunge_entry(paged);
+ nerrs += check_multiple_read_protect(paged);
+ nerrs += check_move_entry(paged);
+ nerrs += check_pin_protected_entry(paged);
+ nerrs += check_resize_entry(paged);
+ nerrs += check_evictions_enabled(paged);
+ nerrs += check_flush_protected_err(paged);
+ nerrs += check_destroy_pinned_err(paged);
+ nerrs += check_destroy_protected_err(paged);
+ nerrs += check_duplicate_insert_err(paged);
+ nerrs += check_double_pin_err(paged);
+ nerrs += check_double_unpin_err(paged);
+ nerrs += check_pin_entry_errs(paged);
+ nerrs += check_double_protect_err(paged);
+ nerrs += check_double_unprotect_err(paged);
+ nerrs += check_mark_entry_dirty_errs(paged);
+ nerrs += check_expunge_entry_errs(paged);
+ nerrs += check_move_entry_errs(paged);
+ nerrs += check_resize_entry_errs(paged);
+ nerrs += check_unprotect_ro_dirty_err(paged);
+ nerrs += check_protect_ro_rw_err(paged);
+ nerrs += check_protect_retries(paged);
+ nerrs += check_check_evictions_enabled_err(paged);
+ nerrs += check_auto_cache_resize(FALSE, paged);
+ nerrs += check_auto_cache_resize(TRUE, paged);
+ nerrs += check_auto_cache_resize_disable(paged);
+ nerrs += check_auto_cache_resize_epoch_markers(paged);
+ nerrs += check_auto_cache_resize_input_errs(paged);
+ nerrs += check_auto_cache_resize_aux_fcns(paged);
+ nerrs += check_metadata_blizzard_absence(TRUE, paged);
+ nerrs += check_metadata_blizzard_absence(FALSE, paged);
+ nerrs += check_flush_deps(paged);
+ nerrs += check_flush_deps_err(paged);
+ nerrs += check_flush_deps_order(paged);
+ nerrs += check_notify_cb(paged);
+ nerrs += check_metadata_cork(TRUE, paged);
+ nerrs += check_metadata_cork(FALSE, paged);
+ nerrs += check_entry_deletions_during_scans(paged);
+ nerrs += check_stats(paged);
+ } /* end for */
/* can't fail, returns void */
free_entry_arrays();
diff --git a/test/cache_api.c b/test/cache_api.c
index 710e38f..867f055 100644
--- a/test/cache_api.c
+++ b/test/cache_api.c
@@ -30,12 +30,12 @@
/* private function declarations: */
-static hbool_t check_fapl_mdc_api_calls(void);
-static hbool_t check_file_mdc_api_calls(void);
-static hbool_t mdc_api_call_smoke_check(int express_test);
+static hbool_t check_fapl_mdc_api_calls(unsigned paged, hid_t fcpl_id);
+static hbool_t check_file_mdc_api_calls(unsigned paged, hid_t fcpl_id);
+static hbool_t mdc_api_call_smoke_check(int express_test, unsigned paged, hid_t fcpl_id);
static H5AC_cache_config_t * init_invalid_configs(void);
static hbool_t check_fapl_mdc_api_errs(void);
-static hbool_t check_file_mdc_api_errs(void);
+static hbool_t check_file_mdc_api_errs(unsigned paged, hid_t fcpl_id);
@@ -64,7 +64,7 @@ static hbool_t check_file_mdc_api_errs(void);
*-------------------------------------------------------------------------
*/
static hbool_t
-check_fapl_mdc_api_calls(void)
+check_fapl_mdc_api_calls(unsigned paged, hid_t fcpl_id)
{
char filename[512];
herr_t result;
@@ -113,7 +113,10 @@ check_fapl_mdc_api_calls(void)
H5C_auto_size_ctl_t default_auto_size_ctl;
H5C_auto_size_ctl_t mod_auto_size_ctl;
- TESTING("MDC/FAPL related API calls");
+ if(paged)
+ TESTING("MDC/FAPL related API calls for paged aggregation strategy")
+ else
+ TESTING("MDC/FAPL related API calls")
pass = TRUE;
@@ -217,7 +220,7 @@ check_fapl_mdc_api_calls(void)
/* create the file using the default FAPL */
if ( pass ) {
- file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ file_id = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl_id, H5P_DEFAULT);
if ( file_id < 0 ) {
@@ -365,7 +368,7 @@ check_fapl_mdc_api_calls(void)
/* create the file using the modified FAPL */
if ( pass ) {
- file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id);
+ file_id = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl_id, fapl_id);
if ( file_id < 0 ) {
@@ -517,7 +520,7 @@ check_fapl_mdc_api_calls(void)
*-------------------------------------------------------------------------
*/
static hbool_t
-check_file_mdc_api_calls(void)
+check_file_mdc_api_calls(unsigned paged, hid_t fcpl_id)
{
char filename[512];
hid_t file_id = -1;
@@ -669,7 +672,10 @@ check_file_mdc_api_calls(void)
H5AC__DEFAULT_METADATA_WRITE_STRATEGY
};
- TESTING("MDC/FILE related API calls");
+ if(paged)
+ TESTING("MDC/FILE related API calls for paged aggregation strategy")
+ else
+ TESTING("MDC/FILE related API calls")
pass = TRUE;
@@ -695,7 +701,7 @@ check_file_mdc_api_calls(void)
/* create the file using the default FAPL */
if ( pass ) {
- file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ file_id = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl_id, H5P_DEFAULT);
if ( file_id < 0 ) {
@@ -874,7 +880,7 @@ check_file_mdc_api_calls(void)
#define NUM_RANDOM_ACCESSES 200000
static hbool_t
-mdc_api_call_smoke_check(int express_test)
+mdc_api_call_smoke_check(int express_test, unsigned paged, hid_t fcpl_id)
{
char filename[512];
hbool_t valid_chunk;
@@ -1003,7 +1009,10 @@ mdc_api_call_smoke_check(int express_test)
H5AC__DEFAULT_METADATA_WRITE_STRATEGY
};
- TESTING("MDC API smoke check");
+ if(paged)
+ TESTING("MDC API smoke check for paged aggregation strategy")
+ else
+ TESTING("MDC API smoke check")
pass = TRUE;
@@ -1038,7 +1047,7 @@ mdc_api_call_smoke_check(int express_test)
/* create the file using the default FAPL */
if ( pass ) {
- file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ file_id = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl_id, H5P_DEFAULT);
if ( file_id < 0 ) {
@@ -1921,7 +1930,7 @@ check_fapl_mdc_api_errs(void)
*-------------------------------------------------------------------------
*/
static hbool_t
-check_file_mdc_api_errs(void)
+check_file_mdc_api_errs(unsigned paged, hid_t fcpl_id)
{
char filename[512];
static char msg[128];
@@ -1937,7 +1946,10 @@ check_file_mdc_api_errs(void)
H5AC_cache_config_t default_config = H5AC__DEFAULT_CACHE_CONFIG;
H5AC_cache_config_t scratch;
- TESTING("MDC/FILE related API input errors");
+ if(paged)
+ TESTING("MDC/FILE related API input errors for paged aggregation strategy")
+ else
+ TESTING("MDC/FILE related API input errors")
pass = TRUE;
@@ -1968,7 +1980,7 @@ check_file_mdc_api_errs(void)
HDfprintf(stdout, "%s: calling H5Fcreate().\n", FUNC);
}
- file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ file_id = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl_id, H5P_DEFAULT);
if ( file_id < 0 ) {
@@ -2267,6 +2279,9 @@ main(void)
{
unsigned nerrs = 0;
int express_test;
+ hid_t fcpl_id = -1;
+ hid_t fcpl2_id = -1;
+ unsigned paged;
H5open();
@@ -2281,42 +2296,64 @@ main(void)
/* Initialize invalid configurations.
*/
invalid_configs = init_invalid_configs();
-
if ( NULL == invalid_configs ) {
-
failure_mssg = "Unable to allocate memory for invalid configs.";
HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", FUNC, failure_mssg);
return EXIT_FAILURE;
- }
+ } /* end if */
- if ( !check_fapl_mdc_api_calls() ) {
+ if((fcpl_id = H5Pcreate(H5P_FILE_CREATE)) < 0) {
+ failure_mssg = "H5Pcreate(H5P_FILE_CREATE) failed.\n";
+ HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", FUNC, failure_mssg);
+ return EXIT_FAILURE;
+ } /* end if */
- nerrs += 1;
- }
+ /* Set file space strategy to default or paged aggregation strategy */
+ if((fcpl2_id = H5Pcopy(fcpl_id)) < 0) {
+ failure_mssg = "H5Pcreate(H5P_FILE_CREATE) failed.\n";
+ HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", FUNC, failure_mssg);
+ return EXIT_FAILURE;
+ } /* end if */
- if ( !check_file_mdc_api_calls() ) {
+ if(H5Pset_file_space_strategy(fcpl2_id, H5F_FSPACE_STRATEGY_PAGE, 1, (hsize_t)1) < 0) {
+ failure_mssg = "H5Pset_file_space_strategy() failed.\n";
+ HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", FUNC, failure_mssg);
+ return EXIT_FAILURE;
+ } /* end if */
- nerrs += 1;
- }
+ /* Test with paged aggregation enabled or not */
+ /* The "my_fcpl" passed to each test has the paged or non-paged strategy set up accordinly */
+ for(paged = FALSE; paged <= TRUE; paged++) {
+ hid_t my_fcpl = fcpl_id;
- if ( !mdc_api_call_smoke_check(express_test) ) {
+ if(paged)
+ my_fcpl = fcpl2_id;
- nerrs += 1;
- }
+ if(!check_fapl_mdc_api_calls(paged, my_fcpl))
+ nerrs += 1;
- if ( !check_fapl_mdc_api_errs() ) {
+ if(!check_file_mdc_api_calls(paged, my_fcpl))
+ nerrs += 1;
- nerrs += 1;
- }
+ if(!mdc_api_call_smoke_check(express_test, paged, my_fcpl))
+ nerrs += 1;
- if ( !check_file_mdc_api_errs() ) {
+ if(!check_file_mdc_api_errs(paged, my_fcpl))
+ nerrs += 1;
+ } /* end for paged */
+ if(!check_fapl_mdc_api_errs())
nerrs += 1;
- }
if(invalid_configs)
HDfree(invalid_configs);
+ if(H5Pclose(fcpl_id) < 0 ) {
+ failure_mssg = "H5Pclose() failed.\n";
+ HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", FUNC, failure_mssg);
+ return EXIT_FAILURE;
+ } /* end if */
+
if(nerrs > 0)
return EXIT_FAILURE;
else
diff --git a/test/cache_common.c b/test/cache_common.c
index d1bbf10..52dbb52 100644
--- a/test/cache_common.c
+++ b/test/cache_common.c
@@ -39,6 +39,12 @@ hid_t saved_fapl_id = H5P_DEFAULT; /* store the fapl id here between
* close.
*/
+hid_t saved_fcpl_id = H5P_DEFAULT; /* store the fcpl id here between
+ * cache setup and takedown. Note
+ * that if saved_fcpl_id == H5P_DEFAULT,
+ * we assume that there is no fcpl to
+ * close.
+ */
hid_t saved_fid = -1; /* store the file id here between cache setup
* and takedown.
*/
@@ -1632,9 +1638,12 @@ free_icr(test_entry_t *entry, int32_t entry_type)
HDassert(entry->cache_ptr->magic == H5C__H5C_T_MAGIC);
HDassert((entry->header.destroy_in_progress) ||
(entry->header.addr == entry->addr));
+ HDassert(entry->header.magic == H5C__H5C_CACHE_ENTRY_T_BAD_MAGIC);
HDassert(entry->header.size == entry->size);
HDassert((entry->type == VARIABLE_ENTRY_TYPE) ||
(entry->size == entry_sizes[entry->type]));
+ HDassert(entry->header.tl_next == NULL);
+ HDassert(entry->header.tl_prev == NULL);
if(entry->num_pins > 0) {
int i;
@@ -3165,7 +3174,8 @@ verify_unprotected(void)
H5F_t *
setup_cache(size_t max_cache_size,
- size_t min_clean_size)
+ size_t min_clean_size,
+ unsigned paged)
{
char filename[512];
hbool_t show_progress = FALSE;
@@ -3177,6 +3187,7 @@ setup_cache(size_t max_cache_size,
H5F_t * ret_val = NULL;
haddr_t actual_base_addr;
hid_t fapl_id = H5P_DEFAULT;
+ hid_t fcpl_id = H5P_DEFAULT;
if(show_progress) /* 1 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
@@ -3184,6 +3195,36 @@ setup_cache(size_t max_cache_size,
saved_fid = -1;
+ if(pass) {
+ if((fcpl_id = H5Pcreate(H5P_FILE_CREATE)) == FAIL) {
+ pass = FALSE;
+ failure_mssg = "H5Pcreate(H5P_FILE_CREATE) failed.\n";
+ }
+ }
+
+ if(pass && paged) {
+ /* Set up paged aggregation strategy */
+ if(H5Pset_file_space_strategy(fcpl_id, H5F_FSPACE_STRATEGY_PAGE, 1, (hsize_t)1) == FAIL) {
+ pass = FALSE;
+ failure_mssg = "H5Pset_file_space_strategy() failed.\n";
+ H5Pclose(fcpl_id);
+ fcpl_id = H5P_DEFAULT;
+ }
+ }
+
+ if(pass && paged) {
+ /* Set up file space page size to BASE_ADDR */
+ if(H5Pset_file_space_page_size(fcpl_id, (hsize_t)BASE_ADDR) == FAIL) {
+ pass = FALSE;
+ failure_mssg = "H5Pset_file_space_page_size() failed.\n";
+ H5Pclose(fcpl_id);
+ fcpl_id = H5P_DEFAULT;
+ }
+ }
+
+ if(pass)
+ saved_fcpl_id = fcpl_id;
+
/* setup the file name */
if(pass) {
if(NULL == h5_fixname(FILENAME[0], H5P_DEFAULT, filename, sizeof(filename))) {
@@ -3207,7 +3248,7 @@ setup_cache(size_t max_cache_size,
pass = FALSE;
failure_mssg = "H5P_set_fapl_core() failed.\n";
}
- else if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0) {
+ else if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl_id, fapl_id)) < 0) {
core_file_driver_failed = TRUE;
if(verbose)
@@ -3226,8 +3267,8 @@ setup_cache(size_t max_cache_size,
* If this fails, we are cooked.
*/
if(pass && fid < 0) {
- fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id);
- saved_fid = fid;
+ fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl_id, fapl_id);
+ saved_fid = fid;
if(fid < 0) {
pass = FALSE;
@@ -3438,6 +3479,11 @@ takedown_cache(H5F_t * file_ptr,
saved_fapl_id = H5P_DEFAULT;
}
+ if ( saved_fcpl_id != H5P_DEFAULT ) {
+ H5Pclose(saved_fcpl_id);
+ saved_fcpl_id = H5P_DEFAULT;
+ }
+
if ( saved_fid != -1 ) {
if ( H5F_addr_defined(saved_actual_base_addr) ) {
diff --git a/test/cache_common.h b/test/cache_common.h
index f003189..f17c16b 100644
--- a/test/cache_common.h
+++ b/test/cache_common.h
@@ -643,7 +643,7 @@ H5TEST_DLL void resize_entry(H5F_t * file_ptr,
size_t new_size,
hbool_t in_cache);
-H5TEST_DLL H5F_t *setup_cache(size_t max_cache_size, size_t min_clean_size);
+H5TEST_DLL H5F_t *setup_cache(size_t max_cache_size, size_t min_clean_size, unsigned paged);
H5TEST_DLL void row_major_scan_forward(H5F_t * file_ptr,
int32_t max_index,
diff --git a/test/cache_image.c b/test/cache_image.c
index 0e7928a..f49f7b3 100644
--- a/test/cache_image.c
+++ b/test/cache_image.c
@@ -59,6 +59,9 @@ static unsigned cache_image_smoke_check_6(void);
static unsigned cache_image_api_error_check_1(void);
static unsigned cache_image_api_error_check_2(void);
static unsigned cache_image_api_error_check_3(void);
+static unsigned cache_image_api_error_check_4(void);
+
+static unsigned get_free_sections_test(void);
/****************************************************************************/
@@ -664,12 +667,10 @@ open_hdf5_file(hbool_t create_file, hbool_t mdci_sbem_expected,
}
if ( ( pass ) && ( config_fsm ) ) {
-
- if ( H5Pset_file_space(fcpl_id, H5F_FILE_SPACE_ALL_PERSIST, 1) < 0 ) {
-
- pass = FALSE;
- failure_mssg = "H5Pset_file_space() failed.";
- }
+ if(H5Pset_file_space_strategy(fcpl_id, H5F_FSPACE_STRATEGY_PAGE, TRUE, (hsize_t)1) < 0) {
+ pass = FALSE;
+ failure_mssg = "H5Pset_file_space_strategy() failed.";
+ }
}
if ( show_progress ) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++);
@@ -5091,11 +5092,14 @@ cache_image_smoke_check_5(void)
* 13) Close the file.
*
* 14) Get the size of the file. Verify that it is less
- * than 1 KB. Without deletions and persistant free
+ * than 20 KB. Without deletions and persistant free
* space managers, size size is about 167 MB, so this
* is sufficient to verify that the persistant free
* space managers are more or less doing their job.
*
+ * Note that in the absence of paged allocation, file
+ * size gets below 1 KB.
+ *
* 15) Delete the file.
*
* Return: void
@@ -5408,20 +5412,24 @@ cache_image_smoke_check_6(void)
/* 14) Get the size of the file. Verify that it is less
- * than 1 KB. Without deletions and persistant free
+ * than 20 KB. Without deletions and persistant free
* space managers, size size is about 167 MB, so this
* is sufficient to verify that the persistant free
* space managers are more or less doing their job.
+ *
+ * Note that in the absence of paged allocation, file
+ * size gets below 1 KB, but since this test is run both
+ * with and without paged allocation, we must leave some
+ * extra space for the paged allocation case.
*/
- if((file_size = h5_get_file_size(filename, H5P_DEFAULT)) < 0) {
-
- pass = FALSE;
- failure_mssg = "h5_get_file_size() failed.\n";
-
- } else if ( file_size > 1024 ) {
-
- pass = FALSE;
- failure_mssg = "unexpectedly large file size.\n";
+ if(pass) {
+ if((file_size = h5_get_file_size(filename, H5P_DEFAULT)) < 0) {
+ pass = FALSE;
+ failure_mssg = "h5_get_file_size() failed.\n";
+ } else if(file_size > 20 * 1024) {
+ pass = FALSE;
+ failure_mssg = "unexpectedly large file size.\n";
+ }
}
if ( show_progress )
@@ -7069,6 +7077,494 @@ cache_image_api_error_check_4(void)
return !pass;
} /* cache_image_api_error_check_4() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: get_free_sections_test()
+ *
+ * Purpose: It is possible that H5Fget_free_sections() to be
+ * called before any activity on the metadata cache.
+ * This is a potential problem, as satisfying the
+ * H5Fget_free_sections() call requires access to all
+ * free space managers. When persistant free space
+ * managers are enabled, this will require calling
+ * H5MF_tidy_self_referential_fsm_hack(). This is a
+ * non issue in the absence of a cache image. However,
+ * this is a problem if a cache image exists, as
+ * the call to H5MF_tidy_self_referential_fsm_hack()
+ * will free the file space allocated to the cache
+ * image.
+ *
+ * The objective of this test is to create a test file
+ * with both non-empty self referential presistant
+ * free space managers, and a cache image, and then
+ * verify that this situation is handled correctly if
+ * H5Fget_free_sections() is called before the metadata
+ * cache image is loaded.
+ *
+ * The test is set up as follows:
+ *
+ * 1) Create a HDF5 file with a cache image requested
+ * and persistant free space managers enabled.
+ *
+ * 2) Create some data sets, and then delete some of
+ * of those near the beginning of the file.
+ *
+ * 3) Close the file.
+ *
+ * 4) Open the file read only.
+ *
+ * 5) Verify that a cache image exists, and has not
+ * been loaded.
+ *
+ * 6) Verify that one or more self referential FSMs
+ * have been stored at the end of the file just
+ * before the cache image.
+ *
+ * 7) Call H5Fget_free_sections().
+ *
+ * 8) Verify that the cache image has been loaded and
+ * that the self referential FSMs have been floated.
+ *
+ * 9) Verify that the remaining data sets contain the
+ * expected data.
+ *
+ * 10) Close the file.
+ *
+ * 11) Open the file R/W.
+ *
+ * 12) Verify that a cache image exists, and has not
+ * been loaded.
+ *
+ * 13) Verify that one or more self referential FSMs
+ * have been stored at the end of the file just
+ * before the cache image.
+ *
+ * 14) Call H5Fget_free_sections().
+ *
+ * 15) Verify that the cache image has been loaded and
+ * that the self referential FSMs have been floated.
+ *
+ * 16) Verify that the remaining data sets contain the
+ * expected data.
+ *
+ * 17) Delete the remaining data sets.
+ *
+ * 18) Close the file.
+ *
+ * 19) Verify that file space has been reclaimed.
+ *
+ * 20) Discard the file.
+ *
+ * Return: void
+ *
+ * Programmer: John Mainzer
+ * 1/10/17
+ *
+ *-------------------------------------------------------------------------
+ */
+static unsigned
+get_free_sections_test(void)
+{
+ const char * fcn_name = "get_free_sections_test()";
+ char filename[512];
+ hbool_t show_progress = FALSE;
+ hid_t file_id = -1;
+ H5F_t *file_ptr = NULL;
+ H5C_t *cache_ptr = NULL;
+ h5_stat_size_t file_size;
+ int cp = 0;
+
+ TESTING("Cache image / H5Fget_free_sections() interaction");
+
+ pass = TRUE;
+
+ if ( show_progress )
+ HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
+
+
+ /* setup the file name */
+ if ( pass ) {
+
+ if ( h5_fixname(FILENAMES[0], H5P_DEFAULT, filename, sizeof(filename))
+ == NULL ) {
+
+ pass = FALSE;
+ failure_mssg = "h5_fixname() failed.\n";
+ }
+ }
+
+ if ( show_progress )
+ HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
+
+
+ /* 1) Create a HDF5 file with a cache image requested
+ * and persistant free space managers enabled.
+ */
+
+ if ( pass ) {
+
+ open_hdf5_file(/* create_file */ TRUE,
+ /* mdci_sbem_expected */ FALSE,
+ /* read_only */ FALSE,
+ /* set_mdci_fapl */ TRUE,
+ /* config_fsm */ TRUE,
+ /* hdf_file_name */ filename,
+ /* cache_image_flags */ H5C_CI__ALL_FLAGS,
+ /* file_id_ptr */ &file_id,
+ /* file_ptr_ptr */ &file_ptr,
+ /* cache_ptr_ptr */ &cache_ptr);
+ }
+
+ if ( show_progress )
+ HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
+
+
+ /* 2) Create some data sets, and then delete some of
+ * of those near the beginning of the file.
+ */
+
+ if ( pass ) {
+
+ create_datasets(file_id, 1, 10);
+ }
+
+ if ( show_progress )
+ HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
+
+ if ( pass ) {
+
+ verify_datasets(file_id, 1, 10);
+ }
+
+ if ( show_progress )
+ HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
+
+ if ( pass ) {
+
+ delete_datasets(file_id, 1, 5);
+ }
+
+ if ( show_progress )
+ HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
+
+
+ /* 3) Close the file. */
+
+ if ( pass ) {
+
+ if ( H5Fclose(file_id) < 0 ) {
+
+ pass = FALSE;
+ failure_mssg = "H5Fclose() failed (1).\n";
+
+ }
+ }
+
+ if ( show_progress )
+ HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
+
+
+ /* 4) Open the file read only. */
+
+ if ( pass ) {
+
+ open_hdf5_file(/* create_file */ FALSE,
+ /* mdci_sbem_expected */ TRUE,
+ /* read_only */ TRUE,
+ /* set_mdci_fapl */ FALSE,
+ /* config_fsm */ FALSE,
+ /* hdf_file_name */ filename,
+ /* cache_image_flags */ H5C_CI__ALL_FLAGS,
+ /* file_id_ptr */ &file_id,
+ /* file_ptr_ptr */ &file_ptr,
+ /* cache_ptr_ptr */ &cache_ptr);
+ }
+
+ if ( show_progress )
+ HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
+
+
+ /* 5) Verify that a cache image exists, and has not been loaded. */
+
+ if ( pass ) {
+
+ if ( ( ! file_ptr->shared->cache->load_image ) ||
+ ( file_ptr->shared->cache->image_loaded ) ) {
+
+ pass = FALSE;
+ failure_mssg = "unexpected cache image status.\n";
+ }
+ }
+
+ if ( show_progress )
+ HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
+
+
+ /* 6) Verify that one or more self referential FSMs
+ * have been stored at the end of the file just
+ * before the cache image.
+ */
+
+ if ( pass ) {
+
+ /* file_ptr->shared->first_alloc_dealloc is set to FALSE if the
+ * file is opened R/O.
+ */
+ if ( ( file_ptr->shared->first_alloc_dealloc ) ||
+ ( ! H5F_addr_defined(file_ptr->shared->eoa_pre_fsm_fsalloc) ) ||
+ ( ! H5F_addr_defined(file_ptr->shared->cache->image_addr) ) ||
+ ( H5F_addr_gt(file_ptr->shared->eoa_pre_fsm_fsalloc,
+ file_ptr->shared->cache->image_addr) ) ) {
+
+ pass = FALSE;
+ failure_mssg = "unexpected cache image status (1).\n";
+ }
+ }
+
+ if ( show_progress )
+ HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
+
+
+ /* 7) Call H5Fget_free_sections(). */
+
+ if ( pass ) {
+
+ if ( H5Fget_free_sections(file_id, H5FD_MEM_DEFAULT, (size_t)0, NULL)
+ < 0 ){
+
+ pass = FALSE;
+ failure_mssg = "H5Fget_free_sections() failed (1).\n";
+ }
+ }
+
+ if ( show_progress )
+ HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
+
+
+ /* 8) Verify that the cache image has been loaded and
+ * that the self referential FSMs have been floated.
+ */
+ if ( pass ) {
+
+ if ( ! file_ptr->shared->cache->image_loaded ) {
+
+ pass = FALSE;
+ failure_mssg = "cache image not loaded (1).\n";
+
+ } else if ( file_ptr->shared->first_alloc_dealloc ) {
+
+ pass = FALSE;
+ failure_mssg = "self referential FSMs not floated (1).\n";
+ }
+ }
+
+ if ( show_progress )
+ HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
+
+
+ /* 9) Verify that the remaining data sets contain the expected data. */
+
+ if ( pass ) {
+
+ verify_datasets(file_id, 6, 10);
+ }
+
+ if ( show_progress )
+ HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
+
+
+ /* 10) Close the file. */
+
+ if ( pass ) {
+
+ if ( H5Fclose(file_id) < 0 ) {
+
+ pass = FALSE;
+ failure_mssg = "H5Fclose() failed (2).\n";
+ }
+ }
+
+ if ( show_progress )
+ HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
+
+
+ /* 11) Open the file R/W. */
+
+ if ( pass ) {
+
+ open_hdf5_file(/* create_file */ FALSE,
+ /* mdci_sbem_expected */ TRUE,
+ /* read_only */ FALSE,
+ /* set_mdci_fapl */ FALSE,
+ /* config_fsm */ FALSE,
+ /* hdf_file_name */ filename,
+ /* cache_image_flags */ H5C_CI__ALL_FLAGS,
+ /* file_id_ptr */ &file_id,
+ /* file_ptr_ptr */ &file_ptr,
+ /* cache_ptr_ptr */ &cache_ptr);
+ }
+
+ if ( show_progress )
+ HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
+
+
+ /* 12) Verify that a cache image exists, and has not been loaded. */
+
+ if ( pass ) {
+
+ if ( ( ! file_ptr->shared->cache->load_image ) ||
+ ( file_ptr->shared->cache->image_loaded ) ) {
+
+ pass = FALSE;
+ failure_mssg = "unexpected cache image status.\n";
+ }
+ }
+
+ if ( show_progress )
+ HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
+
+
+ /* 13) Verify that one or more self referential FSMs
+ * have been stored at the end of the file just
+ * before the cache image.
+ */
+ if ( pass ) {
+
+ if ( ( ! file_ptr->shared->first_alloc_dealloc ) ||
+ ( ! H5F_addr_defined(file_ptr->shared->eoa_pre_fsm_fsalloc) ) ||
+ ( ! H5F_addr_defined(file_ptr->shared->cache->image_addr) ) ||
+ ( H5F_addr_gt(file_ptr->shared->eoa_pre_fsm_fsalloc,
+ file_ptr->shared->cache->image_addr) ) ) {
+
+ pass = FALSE;
+ failure_mssg = "unexpected cache image status (2).\n";
+ }
+ }
+
+ if ( show_progress )
+ HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
+
+
+ /* 14) Call H5Fget_free_sections(). */
+
+ if ( pass ) {
+
+ if ( H5Fget_free_sections(file_id, H5FD_MEM_DEFAULT, (size_t)0, NULL)
+ < 0 ){
+
+ pass = FALSE;
+ failure_mssg = "H5Fget_free_sections() failed (2).\n";
+ }
+ }
+
+ if ( show_progress )
+ HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
+
+
+ /* 15) Verify that the cache image has been loaded and
+ * that the self referential FSMs have been floated.
+ */
+ if ( pass ) {
+
+ if ( ! file_ptr->shared->cache->image_loaded ) {
+
+ pass = FALSE;
+ failure_mssg = "cache image not loaded (2).\n";
+
+ } else if ( file_ptr->shared->first_alloc_dealloc ) {
+
+ pass = FALSE;
+ failure_mssg = "self referential FSMs not floated (2).\n";
+ }
+ }
+
+ if ( show_progress )
+ HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
+
+
+ /* 16) Verify that the remaining data sets contain the expected data. */
+
+ if ( pass ) {
+
+ verify_datasets(file_id, 6, 10);
+ }
+
+ if ( show_progress )
+ HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
+
+
+ /* 17) Delete the remaining data sets. */
+
+ if ( pass ) {
+
+ delete_datasets(file_id, 6, 10);
+ }
+
+ if ( show_progress )
+ HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
+
+
+ /* 18) Close the file. */
+
+ if ( pass ) {
+
+ if ( H5Fclose(file_id) < 0 ) {
+
+ pass = FALSE;
+ failure_mssg = "H5Fclose() failed (3).\n";
+ }
+ }
+
+ if ( show_progress )
+ HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
+
+
+ /* 19) Verify that file space has been reclaimed. */
+
+ if ( pass ) {
+
+ if((file_size = h5_get_file_size(filename, H5P_DEFAULT)) < 0) {
+
+ pass = FALSE;
+ failure_mssg = "h5_get_file_size() failed.\n";
+
+ } else if ( file_size > 20 * 1024 ) {
+
+ pass = FALSE;
+ failure_mssg = "unexpectedly large file size.\n";
+ }
+ }
+
+ if ( show_progress )
+ HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
+
+
+ /* 20) Discard the file. */
+
+ if ( pass ) {
+
+ if ( HDremove(filename) < 0 ) {
+
+ pass = FALSE;
+ failure_mssg = "HDremove() failed.\n";
+ }
+ }
+
+ if ( show_progress )
+ HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
+
+ if ( pass ) { PASSED(); } else { H5_FAILED(); }
+
+ if ( ! pass )
+ HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n",
+ FUNC, failure_mssg);
+
+ return !pass;
+
+} /* get_free_sections_test() */
+
+
/*-------------------------------------------------------------------------
* Function: main
*
@@ -7117,6 +7613,8 @@ main(void)
nerrs += cache_image_api_error_check_3();
nerrs += cache_image_api_error_check_4();
+ nerrs += get_free_sections_test();
+
return(nerrs > 0);
} /* main() */
diff --git a/test/cache_tagging.c b/test/cache_tagging.c
index 8901468..957187b 100644
--- a/test/cache_tagging.c
+++ b/test/cache_tagging.c
@@ -1514,6 +1514,7 @@ check_attribute_rename_tags(hid_t fcpl, int type)
haddr_t g_tag = 0;
hsize_t dims1[2] = {DIMS, DIMS}; /* dimensions */
hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* dimensions */
+ hbool_t persistant_fsms = FALSE;
/* Testing Macro */
TESTING("tag application during attribute renaming");
@@ -1522,6 +1523,10 @@ check_attribute_rename_tags(hid_t fcpl, int type)
/* Setup */
/* ===== */
+ /* check to see if the FCPL specified persistant free space managers */
+ if(H5Pget_file_space_strategy(fcpl, NULL, &persistant_fsms, NULL) < 0)
+ TEST_ERROR;
+
/* Allocate array */
if ( (NULL == (data = (int *)HDcalloc(DIMS * DIMS, sizeof(int)))) ) TEST_ERROR;
@@ -1612,9 +1617,18 @@ check_attribute_rename_tags(hid_t fcpl, int type)
* 3 calls to verify_tag() for verifying free space:
* one freespace header tag for H5FD_MEM_DRAW manager,
* one freespace header tag for H5FD_MEM_SUPER manager
+ * one freespace section info tag for H5FD_MEM_SUPER manager
*/
if ( verify_tag(fid, H5AC_FSPACE_HDR_ID, H5AC__FREESPACE_TAG) < 0 ) TEST_ERROR;
- if ( verify_tag(fid, H5AC_FSPACE_HDR_ID, H5AC__FREESPACE_TAG) < 0 ) TEST_ERROR;
+
+ /* If the free space managers are persistant, the
+ * H5MF_tidy_self_referential_fsm_hack() must have been run.
+ * Since this function floats all self referential free space
+ * managers, the H5FD_MEM_SUPER FSM will not be in the metadata
+ * cache.
+ */
+ if(!persistant_fsms && verify_tag(fid, H5AC_FSPACE_HDR_ID, H5AC__FREESPACE_TAG) < 0) TEST_ERROR;
+ if(!persistant_fsms && verify_tag(fid, H5AC_FSPACE_SINFO_ID, H5AC__FREESPACE_TAG) < 0) TEST_ERROR;
/* verify btree header and leaf node belonging to group */
if ( verify_tag(fid, H5AC_BT2_HDR_ID, g_tag) < 0 ) TEST_ERROR;
@@ -1679,6 +1693,7 @@ check_attribute_delete_tags(hid_t fcpl, int type)
haddr_t g_tag = 0;
hsize_t dims1[2] = {DIMS, DIMS}; /* dimensions */
hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* dimensions */
+ hbool_t persistant_fsms = FALSE;
/* Testing Macro */
TESTING("tag application during attribute delete");
@@ -1687,6 +1702,10 @@ check_attribute_delete_tags(hid_t fcpl, int type)
/* Setup */
/* ===== */
+ /* check to see if the FCPL specified persistant free space managers */
+ if ( H5Pget_file_space_strategy(fcpl, NULL, &persistant_fsms, NULL) < 0 )
+ TEST_ERROR;
+
/* Allocate array */
if ( (NULL == (data = (int *)HDcalloc(DIMS * DIMS, sizeof(int)))) ) TEST_ERROR;
@@ -1752,12 +1771,26 @@ check_attribute_delete_tags(hid_t fcpl, int type)
if ( verify_tag(fid, H5AC_SOHM_TABLE_ID, H5AC__SOHM_TAG) < 0 ) TEST_ERROR;
/*
- * 2 calls to verify_tag() for verifying free space:
- * one freespace header tag for H5FD_MEM_DRAW manager,
- * one freespace header tag for H5FD_MEM_SUPER manager
- */
- if ( verify_tag(fid, H5AC_FSPACE_HDR_ID, H5AC__FREESPACE_TAG) < 0 ) TEST_ERROR;
- if ( verify_tag(fid, H5AC_FSPACE_HDR_ID, H5AC__FREESPACE_TAG) < 0 ) TEST_ERROR;
+ * 2 calls to verify_tag() for verifying free space:
+ * one freespace header tag for free-space header,
+ * one freespace header tag for free-space section info
+ */
+ if ( verify_tag(fid, H5AC_FSPACE_HDR_ID, H5AC__FREESPACE_TAG) < 0 )
+ TEST_ERROR;
+ if ( verify_tag(fid, H5AC_FSPACE_SINFO_ID, H5AC__FREESPACE_TAG) < 0 )
+ TEST_ERROR;
+
+#if 0
+ /* If the free space managers are persistant, the
+ * H5MF_tidy_self_referential_fsm_hack() must have been run.
+ * Since this function floats all self referential free space
+ * managers, the H5FD_MEM_SUPER FSM will not be in the metadata
+ * cache.
+ */
+ if ( ( ! persistant_fsms ) &&
+ ( verify_tag(fid, H5AC_FSPACE_HDR_ID, H5AC__FREESPACE_TAG) < 0 ) )
+ TEST_ERROR;
+#endif
} /* end if */
@@ -3699,7 +3732,7 @@ main(void)
fcpl_shmesg_all = H5Pcreate(H5P_FILE_CREATE);
H5Pset_shared_mesg_nindexes(fcpl_shmesg_all, 1);
H5Pset_shared_mesg_index(fcpl_shmesg_all, 0, H5O_SHMESG_ALL_FLAG, 20);
- H5Pset_file_space(fcpl_shmesg_all, H5F_FILE_SPACE_ALL_PERSIST, (hsize_t)0);
+ H5Pset_file_space_strategy(fcpl_shmesg_all, H5F_FSPACE_STRATEGY_FSM_AGGR, TRUE, (hsize_t)0);
/* ========= */
/* Run Tests */
diff --git a/test/dsets.c b/test/dsets.c
index 39b7c22..c090174 100644
--- a/test/dsets.c
+++ b/test/dsets.c
@@ -633,7 +633,7 @@ error:
*-------------------------------------------------------------------------
*/
static herr_t
-test_userblock_offset(const char *env_h5_drvr, hid_t fapl)
+test_userblock_offset(const char *env_h5_drvr, hid_t fapl, hbool_t new_format)
{
char filename[FILENAME_BUF_SIZE];
hid_t file = -1, fcpl = -1, dataset = -1, space = -1;
@@ -651,6 +651,9 @@ test_userblock_offset(const char *env_h5_drvr, hid_t fapl)
if((fcpl=H5Pcreate(H5P_FILE_CREATE)) < 0) goto error;
if(H5Pset_userblock(fcpl, (hsize_t)USER_BLOCK) < 0) goto error;
+ if(new_format)
+ if(H5Pset_file_space_page_size(fcpl, (hsize_t)USER_BLOCK) < 0)
+ goto error;
if((file=H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
goto error;
@@ -12658,18 +12661,24 @@ main(void)
{
char filename[FILENAME_BUF_SIZE];
hid_t file, grp, fapl, fapl2;
+ hid_t fcpl = -1, fcpl2 = -1;
unsigned new_format;
+ unsigned paged;
int mdc_nelmts;
size_t rdcc_nelmts;
size_t rdcc_nbytes;
double rdcc_w0;
int nerrors = 0;
const char *envval;
+ hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */
/* Don't run this test using certain file drivers */
envval = HDgetenv("HDF5_DRIVER");
if(envval == NULL)
- envval = "sec2";
+ envval = "nomatch";
+
+ /* Current VFD that does not support contigous address space */
+ contig_addr_vfd = (hbool_t)(HDstrcmp(envval, "split") && HDstrcmp(envval, "multi"));
/* Set the random # seed */
HDsrandom((unsigned)HDtime(NULL));
@@ -12691,101 +12700,136 @@ main(void)
/* 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
+ /* create a file creation property list */
+ if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ TEST_ERROR
+ if((fcpl2 = H5Pcopy(fcpl)) < 0) TEST_ERROR
+
+ /* Set file space strategy to paged aggregation and persisting free-space */
+ if(H5Pset_file_space_strategy(fcpl2, H5F_FSPACE_STRATEGY_PAGE, TRUE, (hsize_t)1) < 0)
+ TEST_ERROR
+
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
- /* Test with old & new format groups */
- for(new_format = FALSE; new_format <= TRUE; new_format++) {
- hid_t my_fapl;
+ /* Test with paged aggregation enabled or not */
+ for(paged = FALSE; paged <= TRUE; paged++) {
- /* Set the FAPL for the type of format */
- if(new_format) {
- puts("\nTesting with new file format:");
- my_fapl = fapl2;
- } /* end if */
- else {
- puts("Testing with old file format:");
- my_fapl = fapl;
- } /* end else */
+ /* Temporary: skip testing for multi/split drivers:
+ fail file create when persisting free-space or using paged aggregation strategy */
+ if(!contig_addr_vfd && paged)
+ continue;
- /* Create the file for this test */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0)
- goto error;
+ /* Test with old & new format groups */
+ for(new_format = FALSE; new_format <= TRUE; new_format++) {
+ hid_t my_fapl, my_fcpl;
+
+ /* Set the FAPL for the type of format */
+ if(new_format) {
+ my_fapl = fapl2;
+ if(paged) {
+ my_fcpl = fcpl2;
+ puts("\nTesting with new file format and paged aggregation");
+ } else {
+ my_fcpl = fcpl;
+ puts("\nTesting with new file format and non-paged aggregation");
+ }
+ } /* end if */
+ else {
+ my_fapl = fapl;
+ if(paged) {
+ my_fcpl = fcpl2;
+ puts("Testing with old file format and paged aggregation:");
+ } else {
+ my_fcpl = fcpl;
+ puts("Testing with old file format and non-paged aggregation:");
+ }
+ } /* end else */
- /* Cause the library to emit initial messages */
- if((grp = H5Gcreate2(file, "emit diagnostics", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- goto error;
- if(H5Oset_comment(grp, "Causes diagnostic messages to be emitted") < 0)
- goto error;
- if(H5Gclose(grp) < 0)
- goto error;
+ /* Create the file for this test */
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, my_fcpl, my_fapl)) < 0)
+ goto error;
+
+ /* Cause the library to emit initial messages */
+ if((grp = H5Gcreate2(file, "emit diagnostics", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+ if(H5Oset_comment(grp, "Causes diagnostic messages to be emitted") < 0)
+ goto error;
+ if(H5Gclose(grp) < 0)
+ goto error;
+
+ nerrors += (test_create(file) < 0 ? 1 : 0);
+ nerrors += (test_simple_io(envval, my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_compact_io(my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_max_compact(my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_conv_buffer(file) < 0 ? 1 : 0);
+ nerrors += (test_tconv(file) < 0 ? 1 : 0);
+ nerrors += (test_filters(file, my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_onebyte_shuffle(file) < 0 ? 1 : 0);
+ nerrors += (test_nbit_int(file) < 0 ? 1 : 0);
+ nerrors += (test_nbit_float(file) < 0 ? 1 : 0);
+ nerrors += (test_nbit_double(file) < 0 ? 1 : 0);
+ nerrors += (test_nbit_array(file) < 0 ? 1 : 0);
+ nerrors += (test_nbit_compound(file) < 0 ? 1 : 0);
+ nerrors += (test_nbit_compound_2(file) < 0 ? 1 : 0);
+ nerrors += (test_nbit_compound_3(file) < 0 ? 1 : 0);
+ nerrors += (test_nbit_int_size(file) < 0 ? 1 : 0);
+ nerrors += (test_nbit_flt_size(file) < 0 ? 1 : 0);
+ nerrors += (test_scaleoffset_int(file) < 0 ? 1 : 0);
+ nerrors += (test_scaleoffset_int_2(file) < 0 ? 1 : 0);
+ nerrors += (test_scaleoffset_float(file) < 0 ? 1 : 0);
+ nerrors += (test_scaleoffset_float_2(file) < 0 ? 1 : 0);
+ nerrors += (test_scaleoffset_double(file) < 0 ? 1 : 0);
+ nerrors += (test_scaleoffset_double_2(file) < 0 ? 1 : 0);
+ nerrors += (test_multiopen (file) < 0 ? 1 : 0);
+ nerrors += (test_types(file) < 0 ? 1 : 0);
+ nerrors += (test_userblock_offset(envval, my_fapl, new_format) < 0 ? 1 : 0);
+ nerrors += (test_missing_filter(file) < 0 ? 1 : 0);
+ nerrors += (test_can_apply(file) < 0 ? 1 : 0);
+ nerrors += (test_can_apply2(file) < 0 ? 1 : 0);
+ nerrors += (test_set_local(my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_can_apply_szip(file) < 0 ? 1 : 0);
+ nerrors += (test_compare_dcpl(file) < 0 ? 1 : 0);
+ nerrors += (test_copy_dcpl(file, my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_filter_delete(file) < 0 ? 1 : 0);
+ nerrors += (test_filters_endianess() < 0 ? 1 : 0);
+ nerrors += (test_zero_dims(file) < 0 ? 1 : 0);
+ nerrors += (test_missing_chunk(file) < 0 ? 1 : 0);
+ nerrors += (test_random_chunks(my_fapl) < 0 ? 1 : 0);
- nerrors += (test_create(file) < 0 ? 1 : 0);
- nerrors += (test_simple_io(envval, my_fapl) < 0 ? 1 : 0);
- nerrors += (test_compact_io(my_fapl) < 0 ? 1 : 0);
- nerrors += (test_max_compact(my_fapl) < 0 ? 1 : 0);
- nerrors += (test_conv_buffer(file) < 0 ? 1 : 0);
- nerrors += (test_tconv(file) < 0 ? 1 : 0);
- nerrors += (test_filters(file, my_fapl) < 0 ? 1 : 0);
- nerrors += (test_onebyte_shuffle(file) < 0 ? 1 : 0);
- nerrors += (test_nbit_int(file) < 0 ? 1 : 0);
- nerrors += (test_nbit_float(file) < 0 ? 1 : 0);
- nerrors += (test_nbit_double(file) < 0 ? 1 : 0);
- nerrors += (test_nbit_array(file) < 0 ? 1 : 0);
- nerrors += (test_nbit_compound(file) < 0 ? 1 : 0);
- nerrors += (test_nbit_compound_2(file) < 0 ? 1 : 0);
- nerrors += (test_nbit_compound_3(file) < 0 ? 1 : 0);
- nerrors += (test_nbit_int_size(file) < 0 ? 1 : 0);
- nerrors += (test_nbit_flt_size(file) < 0 ? 1 : 0);
- nerrors += (test_scaleoffset_int(file) < 0 ? 1 : 0);
- nerrors += (test_scaleoffset_int_2(file) < 0 ? 1 : 0);
- nerrors += (test_scaleoffset_float(file) < 0 ? 1 : 0);
- nerrors += (test_scaleoffset_float_2(file) < 0 ? 1 : 0);
- nerrors += (test_scaleoffset_double(file) < 0 ? 1 : 0);
- nerrors += (test_scaleoffset_double_2(file) < 0 ? 1 : 0);
- nerrors += (test_multiopen (file) < 0 ? 1 : 0);
- nerrors += (test_types(file) < 0 ? 1 : 0);
- nerrors += (test_userblock_offset(envval, my_fapl) < 0 ? 1 : 0);
- nerrors += (test_missing_filter(file) < 0 ? 1 : 0);
- nerrors += (test_can_apply(file) < 0 ? 1 : 0);
- nerrors += (test_can_apply2(file) < 0 ? 1 : 0);
- nerrors += (test_set_local(my_fapl) < 0 ? 1 : 0);
- nerrors += (test_can_apply_szip(file) < 0 ? 1 : 0);
- nerrors += (test_compare_dcpl(file) < 0 ? 1 : 0);
- nerrors += (test_copy_dcpl(file, my_fapl) < 0 ? 1 : 0);
- nerrors += (test_filter_delete(file) < 0 ? 1 : 0);
- nerrors += (test_filters_endianess() < 0 ? 1 : 0);
- nerrors += (test_zero_dims(file) < 0 ? 1 : 0);
- nerrors += (test_missing_chunk(file) < 0 ? 1 : 0);
- nerrors += (test_random_chunks(my_fapl) < 0 ? 1 : 0);
#ifndef H5_NO_DEPRECATED_SYMBOLS
- nerrors += (test_deprec(file) < 0 ? 1 : 0);
+ nerrors += (test_deprec(file) < 0 ? 1 : 0);
#endif /* H5_NO_DEPRECATED_SYMBOLS */
- nerrors += (test_huge_chunks(my_fapl) < 0 ? 1 : 0);
- nerrors += (test_chunk_cache(my_fapl) < 0 ? 1 : 0);
- nerrors += (test_big_chunks_bypass_cache(my_fapl) < 0 ? 1 : 0);
- nerrors += (test_chunk_fast(envval, my_fapl) < 0 ? 1 : 0);
- nerrors += (test_reopen_chunk_fast(my_fapl) < 0 ? 1 : 0);
- nerrors += (test_chunk_fast_bug1(my_fapl) < 0 ? 1 : 0);
- nerrors += (test_chunk_expand(my_fapl) < 0 ? 1 : 0);
- nerrors += (test_layout_extend(my_fapl) < 0 ? 1 : 0);
- nerrors += (test_fixed_array(my_fapl) < 0 ? 1 : 0);
- nerrors += (test_idx_compatible() < 0 ? 1 : 0);
- nerrors += (test_unfiltered_edge_chunks(my_fapl) < 0 ? 1 : 0);
- nerrors += (test_single_chunk(my_fapl) < 0 ? 1 : 0);
- nerrors += (test_large_chunk_shrink(my_fapl) < 0 ? 1 : 0);
- nerrors += (test_zero_dim_dset(my_fapl) < 0 ? 1 : 0);
- nerrors += (test_swmr_non_latest(envval, my_fapl) < 0 ? 1 : 0);
- nerrors += (test_earray_hdr_fd(envval, my_fapl) < 0 ? 1 : 0);
- nerrors += (test_farray_hdr_fd(envval, my_fapl) < 0 ? 1 : 0);
- nerrors += (test_bt2_hdr_fd(envval, my_fapl) < 0 ? 1 : 0);
- nerrors += (test_storage_size(my_fapl) < 0 ? 1 : 0);
-
- if(H5Fclose(file) < 0)
- goto error;
- } /* end for */
- /* Close 2nd FAPL */
+ nerrors += (test_huge_chunks(my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_chunk_cache(my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_big_chunks_bypass_cache(my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_chunk_fast(envval, my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_reopen_chunk_fast(my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_chunk_fast_bug1(my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_chunk_expand(my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_layout_extend(my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_fixed_array(my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_idx_compatible() < 0 ? 1 : 0);
+ nerrors += (test_unfiltered_edge_chunks(my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_single_chunk(my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_large_chunk_shrink(my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_zero_dim_dset(my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_storage_size(my_fapl) < 0 ? 1 : 0);
+
+ nerrors += (test_swmr_non_latest(envval, my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_earray_hdr_fd(envval, my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_farray_hdr_fd(envval, my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_bt2_hdr_fd(envval, my_fapl) < 0 ? 1 : 0);
+
+ if(H5Fclose(file) < 0)
+ goto error;
+ } /* end for new_format */
+ } /* end for paged */
+
+ /* Close property lists */
if(H5Pclose(fapl2) < 0) TEST_ERROR
+ if(H5Pclose(fcpl) < 0) TEST_ERROR
+ if(H5Pclose(fcpl2) < 0) TEST_ERROR
/* Tests that do not use files */
nerrors += (test_scatter() < 0 ? 1 : 0);
diff --git a/test/fheap.c b/test/fheap.c
index 82859d2..f08c0f8 100644
--- a/test/fheap.c
+++ b/test/fheap.c
@@ -26,6 +26,10 @@
#define H5HF_TESTING
#include "H5HFpkg.h" /* Fractal heaps */
+#define H5F_FRIEND /*suppress error about including H5Fpkg */
+#define H5F_TESTING
+#include "H5Fpkg.h"
+
/* Other private headers that this test requires */
#include "H5Iprivate.h" /* IDs */
#include "H5MMprivate.h" /* Memory management */
@@ -126,6 +130,7 @@ typedef struct fheap_test_param_t {
fheap_test_fill_t fill; /* How to "bulk" fill heap blocks */
size_t actual_id_len; /* The actual length of heap IDs for a test */
fheap_test_comp_t comp; /* Whether to compress the blocks or not */
+ hid_t my_fcpl; /* File creation property list with file space strategy setting */
} fheap_test_param_t;
/* Heap state information */
@@ -642,7 +647,7 @@ open_heap(char *filename, hid_t fapl, hid_t dxpl, const H5HF_create_t *cparam,
h5_fixname(FILENAME[0], fapl, filename, (size_t)FHEAP_FILENAME_LEN);
/* Create the file to work on */
- if((*file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if((*file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
FAIL_STACK_ERROR
/* Check for deleting the entire heap */
@@ -1827,7 +1832,7 @@ error:
*-------------------------------------------------------------------------
*/
static unsigned
-test_create(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t H5_ATTR_UNUSED *tparam)
+test_create(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
{
hid_t file = -1; /* File ID */
char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
@@ -1844,7 +1849,7 @@ test_create(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t H5_ATTR_UNUSED
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)
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
FAIL_STACK_ERROR
/* Close file */
@@ -1944,7 +1949,7 @@ error:
*-------------------------------------------------------------------------
*/
static unsigned
-test_reopen(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t H5_ATTR_UNUSED *tparam)
+test_reopen(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
{
hid_t file = -1; /* File ID */
char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
@@ -1956,12 +1961,13 @@ test_reopen(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t H5_ATTR_UNUSED
h5_stat_size_t file_size; /* File size, after deleting heap */
size_t id_len; /* Size of fractal heap IDs */
fheap_heap_state_t state; /* State of fractal heap */
+ hbool_t page = FALSE; /* Paged aggregation strategy or not */
/* 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)
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
TEST_ERROR
/* Close file */
@@ -1980,6 +1986,9 @@ test_reopen(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t H5_ATTR_UNUSED
if(NULL == (f = (H5F_t *)H5I_object(file)))
STACK_ERROR
+ if(f->shared->fs_strategy == H5F_FSPACE_STRATEGY_PAGE)
+ page = TRUE;
+
/* Ignore metadata tags in the file's cache */
if (H5AC_ignore_tags(f) < 0)
FAIL_STACK_ERROR
@@ -2058,8 +2067,9 @@ test_reopen(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t H5_ATTR_UNUSED
TEST_ERROR
/* Verify the file is correct size */
- if(file_size != empty_size)
- TEST_ERROR
+ if(!page || (page && !tparam->reopen_heap))
+ if(file_size != empty_size)
+ TEST_ERROR
/* All tests passed */
PASSED()
@@ -2090,7 +2100,7 @@ error:
*-------------------------------------------------------------------------
*/
static unsigned
-test_open_twice(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t H5_ATTR_UNUSED *tparam)
+test_open_twice(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
{
hid_t file = -1; /* File ID */
hid_t file2 = -1; /* File ID */
@@ -2105,12 +2115,13 @@ test_open_twice(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t H5_ATTR_UN
h5_stat_size_t file_size; /* File size, after deleting heap */
size_t id_len; /* Size of fractal heap IDs */
fheap_heap_state_t state; /* State of fractal heap */
+ hbool_t page = FALSE; /* Paged aggregation strategy or not */
/* 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)
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
TEST_ERROR
/* Close file */
@@ -2129,6 +2140,9 @@ test_open_twice(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t H5_ATTR_UN
if(NULL == (f = (H5F_t *)H5I_object(file)))
STACK_ERROR
+ if(f->shared->fs_strategy == H5F_FSPACE_STRATEGY_PAGE)
+ page = TRUE;
+
/* Ignore metadata tags in the file's cache */
if (H5AC_ignore_tags(f) < 0)
FAIL_STACK_ERROR
@@ -2226,8 +2240,9 @@ test_open_twice(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t H5_ATTR_UN
TEST_ERROR
/* Verify the file is correct size */
- if(file_size != empty_size)
- TEST_ERROR
+ if(!page || (page && !tparam->reopen_heap))
+ if(file_size != empty_size)
+ TEST_ERROR
/* All tests passed */
PASSED()
@@ -2262,7 +2277,7 @@ error:
*-------------------------------------------------------------------------
*/
static unsigned
-test_delete_open(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t H5_ATTR_UNUSED *tparam)
+test_delete_open(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
{
hid_t file = -1; /* File ID */
char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
@@ -2280,7 +2295,7 @@ test_delete_open(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t H5_ATTR_U
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)
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
TEST_ERROR
/* Close file */
@@ -2433,7 +2448,7 @@ error:
*-------------------------------------------------------------------------
*/
static unsigned
-test_id_limits(hid_t fapl, H5HF_create_t *cparam)
+test_id_limits(hid_t fapl, H5HF_create_t *cparam, hid_t fcpl)
{
hid_t file = -1; /* File ID */
hid_t dxpl = H5AC_ind_read_dxpl_id; /* DXPL to use */
@@ -2451,7 +2466,7 @@ test_id_limits(hid_t fapl, H5HF_create_t *cparam)
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)
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
@@ -2778,7 +2793,7 @@ error:
*-------------------------------------------------------------------------
*/
static unsigned
-test_filtered_create(hid_t fapl, H5HF_create_t *cparam)
+test_filtered_create(hid_t fapl, H5HF_create_t *cparam, hid_t fcpl)
{
hid_t file = -1; /* File ID */
hid_t dxpl = H5AC_ind_read_dxpl_id; /* DXPL to use */
@@ -2794,7 +2809,7 @@ test_filtered_create(hid_t fapl, H5HF_create_t *cparam)
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)
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
@@ -2901,7 +2916,7 @@ error:
*-------------------------------------------------------------------------
*/
static unsigned
-test_size(hid_t fapl, H5HF_create_t *cparam)
+test_size(hid_t fapl, H5HF_create_t *cparam, hid_t fcpl)
{
hid_t file = -1; /* File ID */
hid_t dxpl = H5AC_ind_read_dxpl_id; /* DXPL to use */
@@ -2917,7 +2932,7 @@ test_size(hid_t fapl, H5HF_create_t *cparam)
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)
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
@@ -3045,7 +3060,7 @@ error:
*-------------------------------------------------------------------------
*/
static unsigned
-test_reopen_hdr(hid_t fapl, H5HF_create_t *cparam)
+test_reopen_hdr(hid_t fapl, H5HF_create_t *cparam, hid_t fcpl)
{
hid_t file1 = -1; /* File ID */
hid_t file2 = -2; /* File ID */
@@ -3060,7 +3075,7 @@ test_reopen_hdr(hid_t fapl, H5HF_create_t *cparam)
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the file to work on */
- if((file1 = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if((file1 = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
@@ -3199,7 +3214,7 @@ test_man_insert_weird(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpa
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)
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
@@ -3309,7 +3324,7 @@ test_man_insert_first(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpa
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)
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
@@ -3410,7 +3425,7 @@ test_man_insert_second(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tp
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)
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
TEST_ERROR
/* Get a pointer to the internal file object */
@@ -3507,7 +3522,7 @@ test_man_insert_root_mult(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t
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)
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
TEST_ERROR
/* Get a pointer to the internal file object */
@@ -3606,7 +3621,7 @@ test_man_insert_force_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_par
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)
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
TEST_ERROR
/* Get a pointer to the internal file object */
@@ -3712,7 +3727,7 @@ test_man_insert_fill_second(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_
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)
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
TEST_ERROR
/* Get a pointer to the internal file object */
@@ -3819,7 +3834,7 @@ test_man_insert_third_direct(hid_t fapl, H5HF_create_t *cparam, fheap_test_param
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)
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
TEST_ERROR
/* Get a pointer to the internal file object */
@@ -3930,7 +3945,7 @@ test_man_fill_first_row(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *t
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)
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
TEST_ERROR
/* Get a pointer to the internal file object */
@@ -4026,7 +4041,7 @@ test_man_start_second_row(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t
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)
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
TEST_ERROR
/* Get a pointer to the internal file object */
@@ -4129,7 +4144,7 @@ test_man_fill_second_row(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *
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)
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
TEST_ERROR
/* Get a pointer to the internal file object */
@@ -4230,7 +4245,7 @@ test_man_start_third_row(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *
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)
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
TEST_ERROR
/* Get a pointer to the internal file object */
@@ -4341,7 +4356,7 @@ test_man_fill_fourth_row(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *
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)
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
TEST_ERROR
/* Get a pointer to the internal file object */
@@ -4438,7 +4453,7 @@ test_man_fill_all_root_direct(hid_t fapl, H5HF_create_t *cparam, fheap_test_para
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)
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
TEST_ERROR
/* Get a pointer to the internal file object */
@@ -4534,7 +4549,7 @@ test_man_first_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_
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)
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
TEST_ERROR
/* Get a pointer to the internal file object */
@@ -4636,7 +4651,7 @@ test_man_second_direct_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fhe
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)
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
TEST_ERROR
/* Get a pointer to the internal file object */
@@ -4746,7 +4761,7 @@ test_man_fill_first_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_
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)
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
TEST_ERROR
/* Get a pointer to the internal file object */
@@ -4849,7 +4864,7 @@ test_man_second_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test
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)
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
TEST_ERROR
/* Get a pointer to the internal file object */
@@ -4960,7 +4975,7 @@ test_man_fill_second_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fheap
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)
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
TEST_ERROR
/* Get a pointer to the internal file object */
@@ -5068,7 +5083,7 @@ test_man_fill_recursive_indirect_row(hid_t fapl, H5HF_create_t *cparam, fheap_te
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)
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
TEST_ERROR
/* Get a pointer to the internal file object */
@@ -5166,7 +5181,7 @@ test_man_start_2nd_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_t
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)
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
TEST_ERROR
/* Get a pointer to the internal file object */
@@ -5275,7 +5290,7 @@ test_man_recursive_indirect_two_deep(hid_t fapl, H5HF_create_t *cparam, fheap_te
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)
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
TEST_ERROR
/* Get a pointer to the internal file object */
@@ -5378,7 +5393,7 @@ test_man_start_3rd_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_t
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)
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
TEST_ERROR
/* Get a pointer to the internal file object */
@@ -5488,7 +5503,7 @@ test_man_fill_first_3rd_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fh
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)
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
TEST_ERROR
/* Get a pointer to the internal file object */
@@ -5599,7 +5614,7 @@ test_man_fill_3rd_recursive_indirect_row(hid_t fapl, H5HF_create_t *cparam, fhea
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)
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
TEST_ERROR
/* Get a pointer to the internal file object */
@@ -5706,7 +5721,7 @@ test_man_fill_all_3rd_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fhea
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)
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
TEST_ERROR
/* Get a pointer to the internal file object */
@@ -5814,7 +5829,7 @@ test_man_start_4th_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_t
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)
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
TEST_ERROR
/* Get a pointer to the internal file object */
@@ -5929,7 +5944,7 @@ test_man_fill_first_4th_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fh
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)
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
TEST_ERROR
/* Get a pointer to the internal file object */
@@ -6049,7 +6064,7 @@ test_man_fill_4th_recursive_indirect_row(hid_t fapl, H5HF_create_t *cparam, fhea
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)
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
TEST_ERROR
/* Get a pointer to the internal file object */
@@ -6161,7 +6176,7 @@ test_man_fill_all_4th_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fhea
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)
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
TEST_ERROR
/* Get a pointer to the internal file object */
@@ -6276,7 +6291,7 @@ test_man_start_5th_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_t
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)
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
TEST_ERROR
/* Get a pointer to the internal file object */
@@ -6410,7 +6425,7 @@ test_man_remove_bogus(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpa
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)
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
TEST_ERROR
/* Get a pointer to the internal file object */
@@ -6563,7 +6578,7 @@ test_man_remove_one(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpara
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)
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
TEST_ERROR
/* Get a pointer to the internal file object */
@@ -6727,7 +6742,7 @@ test_man_remove_two(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpara
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)
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
TEST_ERROR
/* Get a pointer to the internal file object */
@@ -6920,7 +6935,7 @@ test_man_remove_one_larger(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t
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)
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
TEST_ERROR
/* Get a pointer to the internal file object */
@@ -7089,7 +7104,7 @@ test_man_remove_two_larger(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t
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)
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
TEST_ERROR
/* Get a pointer to the internal file object */
@@ -7333,7 +7348,7 @@ test_man_remove_three_larger(hid_t fapl, H5HF_create_t *cparam, fheap_test_param
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)
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
TEST_ERROR
/* Get a pointer to the internal file object */
@@ -7632,7 +7647,7 @@ test_man_incr_insert_remove(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_
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)
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
@@ -16353,6 +16368,8 @@ main(void)
H5HF_create_t small_cparam; /* Creation parameters for "small" heap */
H5HF_create_t large_cparam; /* Creation parameters for "large" heap */
hid_t fapl = -1; /* File access property list for data files */
+ hid_t fcpl = -1; /* File creation property list for data files */
+ hid_t fcpl2 = -1; /* File creation property list for data files */
fheap_test_type_t curr_test; /* Current test being worked on */
unsigned u; /* Local index variable */
unsigned nerrors = 0; /* Cumulative error count */
@@ -16375,6 +16392,16 @@ main(void)
shared_wobj_g = (unsigned char *)H5MM_malloc(shared_obj_size_g);
shared_robj_g = (unsigned char *)H5MM_malloc(shared_obj_size_g);
+ /* create a file creation property list */
+ if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ TEST_ERROR
+ if((fcpl2 = H5Pcopy(fcpl)) < 0) TEST_ERROR
+
+ /* Set file space strategy and persisting free-space */
+ /* This will be modified later on to run the test with different file space strategy setting */
+ if(H5Pset_file_space_strategy(fcpl2, H5F_FSPACE_STRATEGY_FSM_AGGR, FALSE, (hsize_t)1) < 0)
+ TEST_ERROR
+
/* Initialize the shared write buffer for objects */
for(u = 0; u < shared_obj_size_g; u++)
shared_wobj_g[u] = (unsigned char)u;
@@ -16385,6 +16412,9 @@ main(void)
HDmemset(&tparam, 0, sizeof(fheap_test_param_t));
tparam.actual_id_len = HEAP_ID_LEN;
+ /* This will be modified later on to run the test with different file space strategy setting */
+ tparam.my_fcpl = fcpl2;
+
/* Set appropriate testing parameters for each test */
switch(curr_test) {
/* "Normal" testing parameters */
@@ -16409,10 +16439,11 @@ main(void)
nerrors += test_reopen(fapl, &small_cparam, &tparam);
nerrors += test_open_twice(fapl, &small_cparam, &tparam);
nerrors += test_delete_open(fapl, &small_cparam, &tparam);
- nerrors += test_id_limits(fapl, &small_cparam);
- nerrors += test_filtered_create(fapl, &small_cparam);
- nerrors += test_size(fapl, &small_cparam);
- nerrors += test_reopen_hdr(fapl, &small_cparam);
+
+ nerrors += test_id_limits(fapl, &small_cparam, tparam.my_fcpl);
+ nerrors += test_filtered_create(fapl, &small_cparam, tparam.my_fcpl);
+ nerrors += test_size(fapl, &small_cparam, tparam.my_fcpl);
+ nerrors += test_reopen_hdr(fapl, &small_cparam, tparam.my_fcpl);
{
fheap_test_fill_t fill; /* Size of objects to fill heap blocks with */
@@ -16732,6 +16763,9 @@ main(void)
H5MM_xfree(shared_lens_g);
H5MM_xfree(shared_offs_g);
+ if(H5Pclose(fcpl) < 0) TEST_ERROR
+ if(H5Pclose(fcpl2) < 0) TEST_ERROR
+
/* Clean up file used */
#ifndef QAK
h5_cleanup(FILENAME, fapl);
diff --git a/test/filespace_1_8.h5 b/test/filespace_1_8.h5
index 85138b0..3fa2822 100644
--- a/test/filespace_1_8.h5
+++ b/test/filespace_1_8.h5
Binary files differ
diff --git a/test/freespace.c b/test/freespace.c
index 181e6a1..2bf9111 100644
--- a/test/freespace.c
+++ b/test/freespace.c
@@ -86,7 +86,7 @@ typedef struct TEST_free_section_t {
static herr_t TEST_sect_init_cls(H5FS_section_class_t *, void *);
static herr_t TEST_sect_free(H5FS_section_info_t *_sect);
static herr_t TEST_sect_can_merge(const H5FS_section_info_t *, const H5FS_section_info_t *, void H5_ATTR_UNUSED *);
-static herr_t TEST_sect_merging(H5FS_section_info_t *, H5FS_section_info_t *, void H5_ATTR_UNUSED *);
+static herr_t TEST_sect_merging(H5FS_section_info_t **, H5FS_section_info_t *, void H5_ATTR_UNUSED *);
static herr_t TEST_sect_can_shrink(const H5FS_section_info_t *, void *);
static herr_t TEST_sect_shrinking(H5FS_section_info_t **, void *);
@@ -245,26 +245,26 @@ TEST_sect_can_merge(const H5FS_section_info_t *_sect1,
* Merge the two sections (second section is merged into the first section)
*/
static herr_t
-TEST_sect_merging(H5FS_section_info_t *_sect1, H5FS_section_info_t *_sect2,
+TEST_sect_merging(H5FS_section_info_t **_sect1, H5FS_section_info_t *_sect2,
void H5_ATTR_UNUSED *_udata)
{
- TEST_free_section_t *sect1 = (TEST_free_section_t *)_sect1;
+ TEST_free_section_t **sect1 = (TEST_free_section_t **)_sect1;
TEST_free_section_t *sect2 = (TEST_free_section_t *)_sect2;
herr_t ret_value = SUCCEED; /* Return value */
/* Check arguments. */
HDassert(sect1);
- HDassert((sect1->sect_info.type == TEST_FSPACE_SECT_TYPE) ||
- (sect1->sect_info.type == TEST_FSPACE_SECT_TYPE_NEW) ||
- (sect1->sect_info.type == TEST_FSPACE_SECT_TYPE_NONE));
+ HDassert(((*sect1)->sect_info.type == TEST_FSPACE_SECT_TYPE) ||
+ ((*sect1)->sect_info.type == TEST_FSPACE_SECT_TYPE_NEW) ||
+ ((*sect1)->sect_info.type == TEST_FSPACE_SECT_TYPE_NONE));
HDassert(sect2);
HDassert((sect2->sect_info.type == TEST_FSPACE_SECT_TYPE) ||
(sect2->sect_info.type == TEST_FSPACE_SECT_TYPE_NEW) ||
(sect2->sect_info.type == TEST_FSPACE_SECT_TYPE_NONE));
- HDassert(H5F_addr_eq(sect1->sect_info.addr + sect1->sect_info.size, sect2->sect_info.addr));
+ HDassert(H5F_addr_eq((*sect1)->sect_info.addr + (*sect1)->sect_info.size, sect2->sect_info.addr));
/* Add second section's size to first section */
- sect1->sect_info.size += sect2->sect_info.size;
+ (*sect1)->sect_info.size += sect2->sect_info.size;
/* Get rid of second section */
if(TEST_sect_free((H5FS_section_info_t *)sect2) < 0)
@@ -2540,7 +2540,7 @@ test_fs_sect_extend(hid_t fapl)
TEST_ERROR
/* Extend a block by requested-size */
- if((status = H5FS_sect_try_extend(f, dxpl_id, frsp, (haddr_t)TEST_SECT_SIZE80, (hsize_t)TEST_SECT_SIZE20, (hsize_t)TEST_SECT_SIZE40)) < 0)
+ if((status = H5FS_sect_try_extend(f, dxpl_id, frsp, (haddr_t)TEST_SECT_SIZE80, (hsize_t)TEST_SECT_SIZE20, (hsize_t)TEST_SECT_SIZE40, 0, NULL)) < 0)
FAIL_STACK_ERROR
if(FALSE == status)
TEST_ERROR
@@ -2616,7 +2616,7 @@ test_fs_sect_extend(hid_t fapl)
TEST_ERROR
/* Extend the block by requested-size */
- if((status = H5FS_sect_try_extend(f, dxpl_id, frsp, (haddr_t)TEST_SECT_ADDR80, (hsize_t)TEST_SECT_SIZE20, (hsize_t)TEST_SECT_SIZE50)) < 0)
+ if((status = H5FS_sect_try_extend(f, dxpl_id, frsp, (haddr_t)TEST_SECT_ADDR80, (hsize_t)TEST_SECT_SIZE20, (hsize_t)TEST_SECT_SIZE50, 0, NULL)) < 0)
FAIL_STACK_ERROR
if(TRUE == status)
TEST_ERROR
@@ -2689,7 +2689,7 @@ test_fs_sect_extend(hid_t fapl)
TEST_ERROR
/* Extend the block by requested-size */
- if((status = H5FS_sect_try_extend(f, dxpl_id, frsp, (haddr_t)TEST_SECT_ADDR80, (hsize_t)TEST_SECT_SIZE20, (hsize_t)TEST_SECT_SIZE30)) < 0)
+ if((status = H5FS_sect_try_extend(f, dxpl_id, frsp, (haddr_t)TEST_SECT_ADDR80, (hsize_t)TEST_SECT_SIZE20, (hsize_t)TEST_SECT_SIZE30, 0, NULL)) < 0)
TEST_ERROR
if(FALSE == status)
TEST_ERROR
@@ -2763,7 +2763,7 @@ test_fs_sect_extend(hid_t fapl)
TEST_ERROR
/* Extend the block by requested-size */
- if((status = H5FS_sect_try_extend(f, dxpl_id, frsp, (haddr_t)TEST_SECT_ADDR80, (hsize_t)TEST_SECT_SIZE15, (hsize_t)TEST_SECT_SIZE40)) < 0)
+ if((status = H5FS_sect_try_extend(f, dxpl_id, frsp, (haddr_t)TEST_SECT_ADDR80, (hsize_t)TEST_SECT_SIZE15, (hsize_t)TEST_SECT_SIZE40, 0, NULL)) < 0)
TEST_ERROR
if(TRUE == status)
TEST_ERROR
diff --git a/test/fsm_aggr_nopersist.h5 b/test/fsm_aggr_nopersist.h5
new file mode 100644
index 0000000..159e7f7
--- /dev/null
+++ b/test/fsm_aggr_nopersist.h5
Binary files differ
diff --git a/test/fsm_aggr_persist.h5 b/test/fsm_aggr_persist.h5
new file mode 100644
index 0000000..1a837dd
--- /dev/null
+++ b/test/fsm_aggr_persist.h5
Binary files differ
diff --git a/test/gen_filespace.c b/test/gen_filespace.c
index e0c42e8..52715ae 100644
--- a/test/gen_filespace.c
+++ b/test/gen_filespace.c
@@ -14,69 +14,105 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "hdf5.h"
+#include <assert.h>
#define NELMTS(X) (sizeof(X)/sizeof(X[0])) /* # of elements */
-#define TEST_THRESHOLD2 2 /* Free space section threshold */
const char *FILENAMES[] = {
- "filespace_persist.h5", /* H5F_FILE_SPACE_ALL_PERSIST */
- "filespace_default.h5", /* H5F_FILE_SPACE_ALL */
- "filespace_aggr_vfd.h5", /* H5F_FILE_SPACE_AGGR_VFD */
- "filespace_vfd.h5", /* H5F_FILE_SPACE_VFD */
- "filespace_threshold.h5" /* H5F_FILE_SPACE_ALL, non-default threshold */
+ "fsm_aggr_nopersist.h5", /* H5F_FSPACE_STRATEGY_FSM_AGGR + not persisting free-space */
+ "fsm_aggr_persist.h5", /* H5F_FSPACE_STRATEGY_FSM_AGGR + persisting free-space */
+ "paged_nopersist.h5", /* H5F_FSPACE_STRATEGY_PAGE + not persisting free-space */
+ "paged_persist.h5", /* H5F_FSPACE_STRATEGY_PAGE + persisting free-space */
+ "aggr.h5", /* H5F_FSPACE_STRATEGY_AGGR */
+ "none.h5" /* H5F_FSPACE_STRATEGY_NONE */
};
#define DATASET "dset"
#define NUM_ELMTS 100
+#define FALSE 0
+#define TRUE 1
+#define INC_ENUM(TYPE,VAR) (VAR)=((TYPE)((VAR)+1))
/*
- * Compile and run this program in file-space branch to generate
- * HDF5 files with different kinds of file space strategies
- * Move the HDF5 files to the 1.6 and 1.8 branch for compatibility
- * testing:test_filespace_compatible() will use the files
+ * Compile and run this program in the trunk to generate
+ * HDF5 files with combinations of 4 file space strategies
+ * and persist/not persist free-space.
+ * The library creates the file space info message with "mark if unknown"
+ * in these files.
+ *
+ * Move these files to 1.8 branch for compatibility testing:
+ * test_filespace_compatible() in test/tfile.c will use these files.
+ *
+ * Copy these files from the 1.8 branch back to the trunk for
+ * compatibility testing via test_filespace_round_compatible() in test/tfile.c.
+ *
*/
-static void gen_file(void)
-{
- hid_t fid;
- hid_t fcpl;
- hid_t dataset, space;
- hsize_t dim[1];
- int data[NUM_ELMTS];
- size_t j; /* Local index variable */
- int i; /* Local index variable */
- H5F_file_space_type_t fs_type; /* File space handling strategy */
-
- for(j = 0, fs_type = H5F_FILE_SPACE_ALL_PERSIST; j < NELMTS(FILENAMES); j++, fs_type = (H5F_file_space_type_t)(fs_type + 1)) {
- /* Get a copy of the default file creation property */
- fcpl = H5Pcreate(H5P_FILE_CREATE);
-
- if(fs_type == H5F_FILE_SPACE_NTYPES) /* last file */
- /* Set default strategy but non-default threshold */
- H5Pset_file_space(fcpl, H5F_FILE_SPACE_ALL, (hsize_t)TEST_THRESHOLD2);
- else
- /* Set specified file space strategy and free space section threshold */
- H5Pset_file_space(fcpl, fs_type, (hsize_t)0);
-
- /* Create the file with the file space info */
- fid = H5Fcreate(FILENAMES[j], H5F_ACC_TRUNC, fcpl, H5P_DEFAULT);
-
- dim[0] = NUM_ELMTS;
- space = H5Screate_simple(1, dim, NULL);
- dataset = H5Dcreate2(fid, DATASET, H5T_NATIVE_INT, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
-
- for(i = 0; i < NUM_ELMTS; i++)
- data[i] = i;
-
- H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data);
- H5Dclose(dataset);
- H5Sclose(space);
- H5Fclose(fid);
- }
-}
-
int main(void)
{
- gen_file();
+ hid_t fid = -1; /* File ID */
+ hid_t fcpl = -1; /* File creation property list */
+ hid_t did = -1; /* Dataset ID */
+ hid_t sid = -1; /* Dataspace ID */
+ hsize_t dim[1]; /* Dimension sizes */
+ int data[NUM_ELMTS]; /* Buffer for data */
+ int i, j; /* Local index variables */
+ H5F_fspace_strategy_t fs_strategy; /* File space handling strategy */
+ unsigned fs_persist; /* Persisting free-space or not */
+
+ j = 0;
+ for(fs_strategy = H5F_FSPACE_STRATEGY_FSM_AGGR; fs_strategy < H5F_FSPACE_STRATEGY_NTYPES; INC_ENUM(H5F_fspace_strategy_t, fs_strategy)) {
+ for(fs_persist = FALSE; fs_persist <= TRUE; fs_persist++) {
+
+ if(fs_persist && fs_strategy >= H5F_FSPACE_STRATEGY_AGGR)
+ continue;
+
+ /* Get a copy of the default file creation property */
+ if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ goto error;
+
+ if(H5Pset_file_space_strategy(fcpl, fs_strategy, fs_persist, (hsize_t)1) < 0)
+ goto error;
+
+ /* Create the file with the file space info */
+ if((fid = H5Fcreate(FILENAMES[j], H5F_ACC_TRUNC, fcpl, H5P_DEFAULT)) < 0)
+ goto error;
+
+ /* Create the dataset */
+ dim[0] = NUM_ELMTS;
+ if((sid = H5Screate_simple(1, dim, NULL)) < 0)
+ goto error;
+ if((did = H5Dcreate2(fid, DATASET, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+
+ for(i = 0; i < NUM_ELMTS; i++)
+ data[i] = i;
+
+ /* Write the dataset */
+ if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0)
+ goto error;
+
+ /* Closing */
+ if(H5Dclose(did) < 0)
+ goto error;
+ if(H5Sclose(sid) < 0)
+ goto error;
+ if(H5Fclose(fid) < 0)
+ goto error;
+ if(H5Pclose(fcpl) < 0)
+ goto error;
+ ++j;
+ }
+ }
+ assert(j == NELMTS(FILENAMES));
return 0;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Sclose(sid);
+ H5Sclose(did);
+ H5Pclose(fcpl);
+ H5Fclose(fid);
+ } H5E_END_TRY;
+ return -1;
}
diff --git a/test/gen_idx.c b/test/gen_idx.c
deleted file mode 100644
index 8c24198..0000000
--- a/test/gen_idx.c
+++ /dev/null
@@ -1,126 +0,0 @@
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * Copyright by The HDF Group. *
- * Copyright by the Board of Trustees of the University of Illinois. *
- * All rights reserved. *
- * *
- * This file is part of HDF5. The full HDF5 copyright notice, including *
- * terms governing use, modification, and redistribution, is contained in *
- * the files COPYING and Copyright.html. COPYING can be found at the root *
- * of the source code distribution tree; Copyright.html can be found at the *
- * root level of an installed copy of the electronic HDF5 document set and *
- * is linked from the top-level documents page. It can also be found at *
- * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
- * access to either file, you may request a copy from help@hdfgroup.org. *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-/*
- * Purpose: This program is run to generate an HDF5 data file with datasets
- * that use Fixed Array indexing method.
- *
- * To test compatibility, compile and run this program
- * which will generate a file called "fixed_idx.h5".
- * Move it to the test directory in the HDF5 v1.6/1.8 source tree.
- * The test: test_idx_compatible() in dsets.c will read it.
- */
-#include <assert.h>
-#include "hdf5.h"
-
-const char *FILENAME[1] = {
- "fixed_idx.h5" /* file with datasets that use Fixed Array indexing method */
-};
-
-#define DSET "dset"
-#define DSET_FILTER "dset_filter"
-
-/*
- * Function: gen_idx_file
- *
- * Purpose: Create a file with datasets that use Fixed Array indexing:
- * one dataset: fixed dimension, chunked layout, w/o filters
- * one dataset: fixed dimension, chunked layout, w/ filters
- *
- */
-static void gen_idx_file(void)
-{
- hid_t fapl; /* file access property id */
- hid_t fid; /* file id */
- hid_t sid; /* space id */
- hid_t dcpl; /* dataset creation property id */
- hid_t did, did2; /* dataset id */
- hsize_t dims[1] = {10}; /* dataset dimension */
- hsize_t c_dims[1] = {2}; /* chunk dimension */
- herr_t status; /* return status */
- int i; /* local index variable */
- int buf[10]; /* data buffer */
-
-
- /* Get a copy of the file aaccess property */
- fapl = H5Pcreate(H5P_FILE_ACCESS);
- assert(fapl >= 0);
-
- /* Set the "use the latest format" bounds for creating objects in the file */
- status = H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST);
- assert(status >= 0);
-
- /* Create dataset */
- fid = H5Fcreate(FILENAME[0], H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
- assert(fid >= 0);
-
- /* Create data */
- for(i = 0; i < 10; i++)
- buf[i] = i;
-
- /* Set chunk */
- dcpl = H5Pcreate(H5P_DATASET_CREATE);
- assert(dcpl >= 0);
- status = H5Pset_chunk(dcpl, 1, c_dims);
- assert(status >= 0);
-
- sid = H5Screate_simple(1, dims, NULL);
- assert(sid >= 0);
-
- /* Create a 1D dataset */
- did = H5Dcreate2(fid, DSET, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT);
- assert(did >= 0);
-
- /* Write to the dataset */
- status = H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
- assert(status >= 0);
-
-#if defined (H5_HAVE_FILTER_DEFLATE)
- /* set deflate data */
- status = H5Pset_deflate(dcpl, 9);
- assert(status >= 0);
-
- /* Create and write the dataset */
- did2 = H5Dcreate2(fid, DSET_FILTER, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT);
- assert(did2 >= 0);
-
- status = H5Dwrite(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
- assert(status >= 0);
-
- /* Close the dataset */
- status = H5Dclose(did2);
- assert(status >= 0);
-#endif
-
- /* closing */
- status = H5Dclose(did);
- assert(status >= 0);
- status = H5Sclose(sid);
- assert(status >= 0);
- status = H5Pclose(dcpl);
- assert(status >= 0);
- status = H5Pclose(fapl);
- assert(status >= 0);
- status = H5Fclose(fid);
- assert(status >= 0);
-} /* gen_idx_file() */
-
-int main(void)
-{
- gen_idx_file();
-
- return 0;
-}
-
diff --git a/test/gen_plist.c b/test/gen_plist.c
index 8cb6c00..5c54ce8 100644
--- a/test/gen_plist.c
+++ b/test/gen_plist.c
@@ -403,6 +403,12 @@ main(void)
if((ret = H5Pset_sizes(fcpl1, 8, 4) < 0))
assert(ret > 0);
+ if((ret = H5Pset_file_space_strategy(fcpl1, H5F_FSPACE_STRATEGY_PAGE, TRUE, (hsize_t)1)) < 0)
+ assert(ret > 0);
+
+ if((ret = H5Pset_file_space_page_size(fcpl1, (hsize_t)4096)) < 0)
+ assert(ret > 0);
+
if((ret = encode_plist(fcpl1, little_endian, word_length, "testfiles/plist_files/fcpl_")) < 0)
assert(ret > 0);
diff --git a/test/h5fc_ext1_f.h5 b/test/h5fc_ext1_f.h5
new file mode 100644
index 0000000..b5c5867
--- /dev/null
+++ b/test/h5fc_ext1_f.h5
Binary files differ
diff --git a/test/h5fc_ext1_i.h5 b/test/h5fc_ext1_i.h5
new file mode 100644
index 0000000..960a8d5
--- /dev/null
+++ b/test/h5fc_ext1_i.h5
Binary files differ
diff --git a/test/h5fc_ext2_if.h5 b/test/h5fc_ext2_if.h5
new file mode 100644
index 0000000..88e42e7
--- /dev/null
+++ b/test/h5fc_ext2_if.h5
Binary files differ
diff --git a/test/h5fc_ext2_sf.h5 b/test/h5fc_ext2_sf.h5
new file mode 100644
index 0000000..c59a3ca
--- /dev/null
+++ b/test/h5fc_ext2_sf.h5
Binary files differ
diff --git a/test/h5fc_ext3_isf.h5 b/test/h5fc_ext3_isf.h5
new file mode 100644
index 0000000..d00fc55
--- /dev/null
+++ b/test/h5fc_ext3_isf.h5
Binary files differ
diff --git a/test/h5fc_ext_none.h5 b/test/h5fc_ext_none.h5
new file mode 100644
index 0000000..b1b1553
--- /dev/null
+++ b/test/h5fc_ext_none.h5
Binary files differ
diff --git a/test/links.c b/test/links.c
index 3364c7e..e3bbdb2 100644
--- a/test/links.c
+++ b/test/links.c
@@ -11102,6 +11102,8 @@ corder_delete(hid_t fapl)
for(reopen_file = FALSE; reopen_file <= TRUE; reopen_file++) {
/* Create file */
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
+
+ /* Creating file with latest format will enable paged aggregation with persistent fs */
if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR
/* Close file */
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);
diff --git a/test/none.h5 b/test/none.h5
new file mode 100644
index 0000000..bb6ff56
--- /dev/null
+++ b/test/none.h5
Binary files differ
diff --git a/test/page_buffer.c b/test/page_buffer.c
new file mode 100644
index 0000000..b94ad03
--- /dev/null
+++ b/test/page_buffer.c
@@ -0,0 +1,2087 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the files COPYING and Copyright.html. COPYING can be found at the root *
+ * of the source code distribution tree; Copyright.html can be found at the *
+ * root level of an installed copy of the electronic HDF5 document set and *
+ * is linked from the top-level documents page. It can also be found at *
+ * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
+ * access to either file, you may request a copy from help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/***********************************************************
+*
+* Test program: cache_page_buffer
+*
+* Tests the Page Buffer Feature.
+*
+*************************************************************/
+
+#include "h5test.h"
+
+#include "H5PBprivate.h"
+#include "H5Iprivate.h"
+
+/*
+ * This file needs to access private information from the H5F package.
+ */
+#define H5MF_FRIEND /*suppress error about including H5MFpkg */
+#include "H5MFpkg.h"
+
+#define H5F_FRIEND /*suppress error about including H5Fpkg */
+#define H5F_TESTING
+#include "H5Fpkg.h"
+
+
+#define FILENAME_LEN 1024
+#define NUM_DSETS 5
+#define NX 100
+#define NY 50
+
+/* helper routines */
+static unsigned create_file(char *filename, hid_t fcpl, hid_t fapl);
+static unsigned open_file(char *filename, hid_t fapl, hsize_t page_size, size_t page_buffer_size);
+
+/* test routines */
+static unsigned test_args(hid_t fapl, const char *env_h5_drvr);
+static unsigned test_raw_data_handling(hid_t orig_fapl, const char *env_h5_drvr);
+static unsigned test_lru_processing(hid_t orig_fapl, const char *env_h5_drvr);
+static unsigned test_min_threshold(hid_t orig_fapl, const char *env_h5_drvr);
+static unsigned test_stats_collection(hid_t orig_fapl, const char *env_h5_drvr);
+
+const char *FILENAME[] = {
+ "filepaged",
+ NULL
+};
+
+
+/*-------------------------------------------------------------------------
+ * Function: create_file()
+ *
+ * Purpose: The purpose of this function appears to be a smoke check
+ * intended to exercise the page buffer.
+ *
+ * Specifically, the function creates a file, and then goes
+ * through a loop in which it creates four data sets, write
+ * data to one of them, verifies the data written, and then
+ * deletes the three that it didn't write to.
+ *
+ * Any data mis-matches or failures reported by the HDF5
+ * library result in test failure.
+ *
+ * Return: 0 if test is sucessful
+ * 1 if test fails
+ *
+ * Programmer: unknown
+ * ?? / ?? / ??
+ *
+ *-------------------------------------------------------------------------
+ */
+static unsigned
+create_file(char *filename, hid_t fcpl, hid_t fapl)
+{
+ hid_t file_id = -1;
+ hid_t dset_id = -1;
+ hid_t grp_id = -1;
+ hid_t filespace = -1;
+ hsize_t dimsf[2] = {NX, NY}; /* dataset dimensions */
+ int *data = NULL; /* pointer to data buffer to write */
+ hid_t dcpl = -1;
+ int i;
+ int num_elements;
+ int j;
+ char dset_name[10];
+
+ if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
+ FAIL_STACK_ERROR;
+
+ if((grp_id = H5Gcreate2(file_id, "GROUP", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR;
+
+ num_elements = NX * NY;
+ if((data = (int *)HDcalloc((size_t)num_elements, sizeof(int))) == NULL)
+ TEST_ERROR
+ for (i=0; i < (int)num_elements; i++)
+ data[i] = i;
+
+ if((filespace = H5Screate_simple(2, dimsf, NULL)) < 0)
+ FAIL_STACK_ERROR;
+
+ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ FAIL_STACK_ERROR;
+ if(H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_EARLY) < 0)
+ FAIL_STACK_ERROR;
+
+ for(i=0 ; i<NUM_DSETS; i++) {
+
+ HDsprintf(dset_name, "D1dset%d", i);
+ if((dset_id = H5Dcreate2(grp_id, dset_name, H5T_NATIVE_INT, filespace,
+ H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR;
+ if(H5Dclose(dset_id) < 0)
+ FAIL_STACK_ERROR;
+
+ HDsprintf(dset_name, "D2dset%d", i);
+ if((dset_id = H5Dcreate2(grp_id, dset_name, H5T_NATIVE_INT, filespace,
+ H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR;
+ if(H5Dclose(dset_id) < 0)
+ FAIL_STACK_ERROR;
+
+ HDsprintf(dset_name, "D3dset%d", i);
+ if((dset_id = H5Dcreate2(grp_id, dset_name, H5T_NATIVE_INT, filespace,
+ H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR;
+ if(H5Dclose(dset_id) < 0)
+ FAIL_STACK_ERROR;
+
+ HDsprintf(dset_name, "dset%d", i);
+ if((dset_id = H5Dcreate2(grp_id, dset_name, H5T_NATIVE_INT, filespace,
+ H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR;
+
+ if(H5Dwrite(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0)
+ FAIL_STACK_ERROR;
+ if(H5Dclose(dset_id) < 0)
+ FAIL_STACK_ERROR;
+
+ HDmemset(data, 0, (size_t)num_elements * sizeof(int));
+ if((dset_id = H5Dopen2(grp_id, dset_name, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR;
+ if(H5Dread(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0)
+ FAIL_STACK_ERROR;
+ if(H5Dclose(dset_id) < 0)
+ FAIL_STACK_ERROR;
+
+ for (j=0; j < num_elements; j++) {
+ if(data[j] != j) {
+ HDfprintf(stderr, "Read different values than written\n");
+ FAIL_STACK_ERROR;
+ }
+ }
+
+ HDsprintf(dset_name, "D1dset%d", i);
+ if(H5Ldelete(grp_id, dset_name, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR;
+ HDsprintf(dset_name, "D2dset%d", i);
+ if(H5Ldelete(grp_id, dset_name, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR;
+ HDsprintf(dset_name, "D3dset%d", i);
+ if(H5Ldelete(grp_id, dset_name, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR;
+ }
+
+ if(H5Gclose(grp_id) < 0)
+ FAIL_STACK_ERROR;
+ if(H5Fclose(file_id) < 0)
+ FAIL_STACK_ERROR;
+ if(H5Pclose(dcpl) < 0)
+ FAIL_STACK_ERROR;
+ if(H5Sclose(filespace) < 0)
+ FAIL_STACK_ERROR;
+
+ HDfree(data);
+ return 0;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Pclose(dcpl);
+ H5Sclose(filespace);
+ H5Gclose(grp_id);
+ H5Fclose(file_id);
+ if(data)
+ HDfree(data);
+ } H5E_END_TRY;
+ return(1);
+} /* create_file */
+
+
+/*-------------------------------------------------------------------------
+ * Function: open_file()
+ *
+ * Purpose: The purpose of this function appears to be a smoke check
+ * intended to exercise the page buffer.
+ *
+ * Specifically, the function opens a file (created by
+ * create_file()?), and verify the contents of its datasets.
+ *
+ * Any data mis-matches or failures reported by the HDF5
+ * library result in test failure.
+ *
+ * Return: 0 if test is sucessful
+ * 1 if test fails
+ *
+ * Programmer: unknown
+ * ?? / ?? / ??
+ *
+ *-------------------------------------------------------------------------
+ */
+static unsigned
+open_file(char *filename, hid_t fapl, hsize_t page_size,
+ size_t page_buffer_size)
+{
+ hid_t file_id = -1;
+ hid_t dset_id = -1;
+ hid_t grp_id = -1;
+ int *data = NULL; /* pointer to data buffer to write */
+ int i;
+ int j;
+ int num_elements;
+ char dset_name[10];
+ H5F_t *f = NULL;
+
+ if((file_id = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
+ FAIL_STACK_ERROR;
+
+ /* Get a pointer to the internal file object */
+ if(NULL == (f = (H5F_t *)H5I_object(file_id)))
+ FAIL_STACK_ERROR;
+
+ if(f->shared->page_buf == NULL)
+ FAIL_STACK_ERROR;
+ if(f->shared->page_buf->page_size != page_size)
+ FAIL_STACK_ERROR;
+ if(f->shared->page_buf->max_size != page_buffer_size)
+ FAIL_STACK_ERROR;
+
+ if((grp_id = H5Gopen2(file_id, "GROUP", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR;
+
+ num_elements = NX * NY;
+ if((data = (int *)HDcalloc((size_t)num_elements, sizeof(int))) == NULL)
+ TEST_ERROR
+
+ for(i=0 ; i<NUM_DSETS; i++) {
+
+ HDsprintf(dset_name, "dset%d", i);
+ if((dset_id = H5Dopen2(grp_id, dset_name, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR;
+
+ if(H5Dread(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0)
+ FAIL_STACK_ERROR;
+
+ if(H5Dclose(dset_id) < 0)
+ FAIL_STACK_ERROR;
+
+ for (j=0; j < num_elements; j++) {
+ if(data[j] != j) {
+ HDfprintf(stderr, "Read different values than written\n");
+ FAIL_STACK_ERROR;
+ }
+ }
+ }
+
+ if(H5Gclose(grp_id) < 0)
+ FAIL_STACK_ERROR;
+ if(H5Fclose(file_id) < 0)
+ FAIL_STACK_ERROR;
+ HDfree(data);
+
+ return 0;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Gclose(grp_id);
+ H5Fclose(file_id);
+ if(data)
+ HDfree(data);
+ } H5E_END_TRY;
+ return 1;
+}
+
+/*
+ *
+ * set_multi_split():
+ * Internal routine to set up page-aligned address space for multi/split driver
+ * when testing paged aggregation.
+ *
+ */
+static unsigned
+set_multi_split(const char *env_h5_drvr, hid_t fapl, hsize_t pagesize)
+{
+ hbool_t split = FALSE;
+ hbool_t multi = FALSE;
+ 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;
+
+ /* Check for split or multi driver */
+ if(!HDstrcmp(env_h5_drvr, "split"))
+ split = TRUE;
+ else if(!HDstrcmp(env_h5_drvr, "multi"))
+ multi = TRUE;
+
+ if(split || multi) {
+
+ 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]);
+
+ } /* end if */
+
+ return 0;
+
+error:
+ return 1;
+
+} /* set_multi_split() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: test_args()
+ *
+ * Purpose: This test appears to be a quick smoke check directed at:
+ *
+ * 1) verifying that API errors are caught.
+ *
+ * 2) verifying that the page buffer behaves more or less
+ * as advertized.
+ *
+ * Any data mis-matches or unexpected failures or successes
+ * reported by the HDF5 library result in test failure.
+ *
+ * Return: 0 if test is sucessful
+ * 1 if test fails
+ *
+ * Programmer: unknown
+ * ?? / ?? / ??
+ *
+ *-------------------------------------------------------------------------
+ */
+static unsigned
+test_args(hid_t orig_fapl, const char *env_h5_drvr)
+{
+ char filename[FILENAME_LEN]; /* Filename to use */
+ hid_t file_id = -1; /* File ID */
+ hid_t fcpl = -1;
+ hid_t fapl = -1;
+ herr_t ret;
+
+ TESTING("Settings for Page Buffering");
+
+ h5_fixname(FILENAME[0], orig_fapl, filename, sizeof(filename));
+
+ if((fapl = H5Pcopy(orig_fapl)) < 0) TEST_ERROR
+
+ if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ TEST_ERROR;
+
+
+ /* Test setting a page buffer without Paged Aggregation enabled -
+ * should fail
+ */
+ if(H5Pset_page_buffer_size(fapl, 512, 0, 0) < 0)
+ TEST_ERROR;
+
+ H5E_BEGIN_TRY {
+ file_id = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl);
+ } H5E_END_TRY;
+
+ if(file_id >= 0)
+ TEST_ERROR;
+
+
+ /* Test setting a page buffer with a size smaller than a single
+ * page size - should fail
+ */
+ if(H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, 0, (hsize_t)1) < 0)
+ TEST_ERROR;
+
+ if(H5Pset_file_space_page_size(fcpl, 512) < 0)
+ TEST_ERROR;
+
+ if(H5Pset_page_buffer_size(fapl, 511, 0, 0) < 0)
+ TEST_ERROR;
+
+ H5E_BEGIN_TRY {
+ file_id = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl);
+ } H5E_END_TRY;
+
+ if(file_id >= 0)
+ TEST_ERROR;
+
+
+ /* Test setting a page buffer with sum of min meta and raw
+ * data percentage > 100 - should fail
+ */
+ H5E_BEGIN_TRY {
+ ret = H5Pset_page_buffer_size(fapl, 512, 50, 51);
+ } H5E_END_TRY;
+
+ if(ret >= 0)
+ TEST_ERROR;
+
+ if(set_multi_split(env_h5_drvr, fapl, 512) != 0)
+ TEST_ERROR;
+
+ /* Test setting a page buffer with a size equal to a single page size */
+ if(H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, 0, (hsize_t)1) < 0)
+ TEST_ERROR;
+
+ if(H5Pset_file_space_page_size(fcpl, 512) < 0)
+ TEST_ERROR;
+
+ if(H5Pset_page_buffer_size(fapl, 512, 0, 0) < 0)
+ TEST_ERROR;
+
+ if(create_file(filename, fcpl, fapl) != 0)
+ TEST_ERROR;
+
+ if(open_file(filename, fapl, 512, 512) != 0)
+ TEST_ERROR;
+
+
+ /* Test setting a page buffer with a size slightly larger than a
+ * single page size
+ */
+ if(H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, 0, (hsize_t)1) < 0)
+ TEST_ERROR;
+
+ if(H5Pset_file_space_page_size(fcpl, 512) < 0)
+ TEST_ERROR;
+
+ if(H5Pset_page_buffer_size(fapl, 513, 0, 0) < 0)
+ TEST_ERROR;
+
+ if(create_file(filename, fcpl, fapl) != 0)
+ TEST_ERROR;
+
+ if(open_file(filename, fapl, 512, 512) != 0)
+ TEST_ERROR;
+
+ if(set_multi_split(env_h5_drvr, fapl, 4194304) != 0)
+ TEST_ERROR;
+
+
+ /* Test setting a large page buffer size and page size */
+ if(H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, 0, (hsize_t)1) < 0)
+ TEST_ERROR;
+
+ if(H5Pset_file_space_page_size(fcpl, 4194304) < 0)
+ TEST_ERROR;
+
+ if(H5Pset_page_buffer_size(fapl, 16777216, 0, 0) < 0)
+ TEST_ERROR;
+
+ if(create_file(filename, fcpl, fapl) != 0)
+ TEST_ERROR;
+
+ if(open_file(filename, fapl, 4194304, 16777216) != 0)
+ TEST_ERROR;
+
+ if(set_multi_split(env_h5_drvr, fapl, 1) != 0)
+ TEST_ERROR;
+
+
+ /* Test setting a 512 byte page buffer size and page size */
+ if(H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, 0, (hsize_t)1) < 0)
+ TEST_ERROR;
+
+ if(H5Pset_file_space_page_size(fcpl, 512) < 0)
+ TEST_ERROR;
+ if(H5Pset_page_buffer_size(fapl, 512, 0, 0) < 0)
+ TEST_ERROR;
+ if(create_file(filename, fcpl, fapl) != 0)
+ TEST_ERROR;
+ if(open_file(filename, fapl, 512, 512) != 0)
+ TEST_ERROR;
+
+
+ if(H5Pclose(fcpl) < 0)
+ FAIL_STACK_ERROR;
+ if(H5Pclose(fapl) < 0)
+ FAIL_STACK_ERROR;
+
+ PASSED()
+ return 0;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Pclose(fapl);
+ H5Pclose(fcpl);
+ } H5E_END_TRY;
+ return 1;
+} /* test_args */
+
+
+/*-------------------------------------------------------------------------
+ * Function: test_raw_data_handling()
+ *
+ * Purpose: The purpose of this function appears to be a smoke check
+ * of raw data reads and writes via the page buffer.
+ *
+ * Any data mis-matches or failures reported by the HDF5
+ * library result in test failure.
+ *
+ * Return: 0 if test is sucessful
+ * 1 if test fails
+ *
+ * Programmer: unknown
+ * ?? / ?? / ??
+ *
+ * Changes: Added base_page_cnt field as supporting code. This allows
+ * the test to adjust to the number of page buffer pages
+ * accessed during file open / create.
+ *
+ * The test for the value of base_page_cnt just after file
+ * open exists detect changes in library behavior. Assuming
+ * any such change is not indicative of other issues, these
+ * tests can be modified to reflect the change.
+ *
+ * JRM -- 2/23/17
+ *
+ *-------------------------------------------------------------------------
+ */
+
+/* Changes due to file space page size has a minimum size of 512 */
+static unsigned
+test_raw_data_handling(hid_t orig_fapl, const char *env_h5_drvr)
+{
+ char filename[FILENAME_LEN]; /* Filename to use */
+ hid_t file_id = -1; /* File ID */
+ hid_t fcpl = -1;
+ hid_t fapl = -1;
+ H5FD_io_info_t fdio_info;
+ H5P_genplist_t *meta_plist = (H5P_genplist_t *)H5I_object(H5AC_ind_read_dxpl_id);
+ H5P_genplist_t *raw_plist = (H5P_genplist_t *)H5I_object(H5AC_rawdata_dxpl_id);
+ size_t base_page_cnt;
+ size_t page_count = 0;
+ int i, num_elements = 2000;
+ haddr_t addr = HADDR_UNDEF;
+ int *data = NULL;
+ H5F_t *f = NULL;
+
+ TESTING("Raw Data Handling");
+
+ h5_fixname(FILENAME[0], orig_fapl, filename, sizeof(filename));
+
+ if((fapl = H5Pcopy(orig_fapl)) < 0)
+ TEST_ERROR
+
+ if(set_multi_split(env_h5_drvr, fapl, sizeof(int)*200) != 0)
+ TEST_ERROR;
+
+ if((data = (int *)HDcalloc((size_t)num_elements, sizeof(int))) == NULL)
+ TEST_ERROR;
+
+ if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ TEST_ERROR;
+ if(H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, 0, (hsize_t)1) < 0)
+ TEST_ERROR;
+ if(H5Pset_file_space_page_size(fcpl, sizeof(int)*200) < 0)
+ TEST_ERROR;
+ if(H5Pset_page_buffer_size(fapl, sizeof(int)*2000, 0, 0) < 0)
+ TEST_ERROR;
+
+ if((file_id = 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_id)))
+ FAIL_STACK_ERROR;
+
+ /* opening the file inserts one or more pages into the page buffer.
+ * Get the number of pages inserted, and verify that it is the
+ * the expected value.
+ */
+ base_page_cnt = H5SL_count(f->shared->page_buf->slist_ptr);
+ if(base_page_cnt != 1)
+ TEST_ERROR;
+
+ /* allocate space for a 2000 elements */
+ if(HADDR_UNDEF == (addr = H5MF_alloc(f, H5FD_MEM_DRAW, H5AC_ind_read_dxpl_id, sizeof(int)*(size_t)num_elements)))
+ FAIL_STACK_ERROR;
+
+ /* intialize all the elements to have a value of -1 */
+ for(i=0 ; i<num_elements ; i++)
+ data[i] = -1;
+ if(H5F_block_write(f, H5FD_MEM_DRAW, addr, sizeof(int)*(size_t)num_elements, H5AC_rawdata_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+
+ /* update the first 50 elements to have values 0-49 - this will be
+ a page buffer update with 1 page resulting in the page
+ buffer. */
+ /* Changes: 100 */
+ for(i=0 ; i<100 ; i++)
+ data[i] = i;
+
+ if(H5F_block_write(f, H5FD_MEM_DRAW, addr, sizeof(int)*100, H5AC_rawdata_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+
+ page_count ++;
+
+ if(H5SL_count(f->shared->page_buf->slist_ptr) != page_count + base_page_cnt)
+ FAIL_STACK_ERROR;
+
+ /* update elements 300 - 450, with values 300 - - this will
+ bring two more pages into the page buffer. */
+ for(i=0 ; i<150 ; i++)
+ data[i] = i+300;
+ if(H5F_block_write(f, H5FD_MEM_DRAW, addr+(sizeof(int)*300), sizeof(int)*150, H5AC_rawdata_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+ page_count += 2;
+ if(H5SL_count(f->shared->page_buf->slist_ptr) != page_count + base_page_cnt)
+ FAIL_STACK_ERROR;
+
+ /* update elements 100 - 300, this will go to disk but also update
+ existing pages in the page buffer. */
+ for(i=0 ; i<200 ; i++)
+ data[i] = i+100;
+ if(H5F_block_write(f, H5FD_MEM_DRAW, addr+(sizeof(int)*100), sizeof(int)*200, H5AC_rawdata_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+ if(H5SL_count(f->shared->page_buf->slist_ptr) != page_count + base_page_cnt)
+ FAIL_STACK_ERROR;
+
+ /* Update elements 225-300 - this will update an existing page in the PB */
+ /* Changes: 450 - 600; 150 */
+ for(i=0 ; i<150 ; i++)
+ data[i] = i+450;
+ if(H5F_block_write(f, H5FD_MEM_DRAW, addr+(sizeof(int)*450), sizeof(int)*150, H5AC_rawdata_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+ if(H5SL_count(f->shared->page_buf->slist_ptr) != page_count + base_page_cnt)
+ FAIL_STACK_ERROR;
+
+ /* Do a full page write to block 600-800 - should bypass the PB */
+ for(i=0 ; i<200 ; i++)
+ data[i] = i+600;
+ if(H5F_block_write(f, H5FD_MEM_DRAW, addr+(sizeof(int)*600), sizeof(int)*200, H5AC_rawdata_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+ if(H5SL_count(f->shared->page_buf->slist_ptr) != page_count + base_page_cnt)
+ FAIL_STACK_ERROR;
+
+ /* read elements 800 - 1200, this should not affect the PB, and should read -1s */
+ if(H5F_block_read(f, H5FD_MEM_DRAW, addr+(sizeof(int)*800), sizeof(int)*400, H5AC_rawdata_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+ for (i=0; i < 400; i++) {
+ if(data[i] != -1) {
+ HDfprintf(stderr, "Read different values than written\n");
+ FAIL_STACK_ERROR;
+ }
+ }
+ if(H5SL_count(f->shared->page_buf->slist_ptr) != page_count + base_page_cnt)
+ FAIL_STACK_ERROR;
+
+ /* read elements 1200 - 1201, this should read -1 and bring in an
+ * entire page of addr 1200
+ */
+ if(H5F_block_read(f, H5FD_MEM_DRAW, addr+(sizeof(int)*1200), sizeof(int)*1, H5AC_rawdata_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+ for (i=0; i < 1; i++) {
+ if(data[i] != -1) {
+ HDfprintf(stderr, "Read different values than written\n");
+ TEST_ERROR;
+ }
+ }
+ page_count ++;
+ if(H5SL_count(f->shared->page_buf->slist_ptr) != page_count + base_page_cnt)
+ TEST_ERROR;
+
+ /* read elements 175 - 225, this should use the PB existing pages */
+ /* Changes: 350 - 450 */
+ /* read elements 175 - 225, this should use the PB existing pages */
+ if(H5F_block_read(f, H5FD_MEM_DRAW, addr+(sizeof(int)*350), sizeof(int)*100, H5AC_rawdata_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+ for (i=0; i < 100; i++) {
+ if(data[i] != i+350) {
+ HDfprintf(stderr, "Read different values than written\n");
+ TEST_ERROR;
+ }
+ }
+ if(H5SL_count(f->shared->page_buf->slist_ptr) != page_count + base_page_cnt)
+ TEST_ERROR;
+
+ /* read elements 0 - 800 using the VFD.. this should result in -1s
+ except for the writes that went through the PB (100-300 & 600-800) */
+ fdio_info.file = f->shared->lf;
+ fdio_info.meta_dxpl = meta_plist;
+ fdio_info.raw_dxpl = raw_plist;
+ if(H5FD_read(&fdio_info, H5FD_MEM_DRAW, addr, sizeof(int)*800, data) < 0)
+ FAIL_STACK_ERROR;
+ i = 0;
+ while (i < 800) {
+ if((i>=100 && i<300) || (i>=600)) {
+ if(data[i] != i) {
+ HDfprintf(stderr, "Read different values than written\n");
+ TEST_ERROR;
+ }
+ }
+ else {
+ if(data[i] != -1) {
+ HDfprintf(stderr, "Read different values than written\n");
+ TEST_ERROR;
+ }
+ }
+ i++;
+ }
+
+ /* read elements 0 - 800 using the PB.. this should result in all
+ * what we have written so far and should get the updates from the PB
+ */
+ if(H5F_block_read(f, H5FD_MEM_DRAW, addr, sizeof(int)*800, H5AC_rawdata_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+ if(H5SL_count(f->shared->page_buf->slist_ptr) != page_count + base_page_cnt)
+ TEST_ERROR;
+ for (i=0; i < 800; i++) {
+ if(data[i] != i) {
+ HDfprintf(stderr, "Read different values than written\n");
+ TEST_ERROR;
+ }
+ }
+
+ /* update elements 400 - 1400 to value 0, this will go to disk but
+ * also evict existing pages from the PB (page 400 & 1200 that are
+ * existing).
+ */
+ for(i=0 ; i<1000 ; i++)
+ data[i] = 0;
+ if(H5F_block_write(f, H5FD_MEM_DRAW, addr+(sizeof(int)*400), sizeof(int)*1000, H5AC_rawdata_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+ page_count -= 2;
+ if(H5SL_count(f->shared->page_buf->slist_ptr) != page_count + base_page_cnt)
+ TEST_ERROR;
+
+ /* read elements 0 - 1000.. this should go to disk then update the
+ * buffer result 200-400 with existing pages
+ */
+ if(H5F_block_read(f, H5FD_MEM_DRAW, addr, sizeof(int)*1000, H5AC_rawdata_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+ i=0;
+ while (i < 1000) {
+ if(i<400) {
+ if(data[i] != i) {
+ HDfprintf(stderr, "Read different values than written\n");
+ TEST_ERROR;
+ }
+ }
+ else {
+ if(data[i] != 0) {
+ HDfprintf(stderr, "Read different values than written\n");
+ TEST_ERROR;
+ }
+ }
+ i++;
+ }
+ if(H5SL_count(f->shared->page_buf->slist_ptr) != page_count + base_page_cnt)
+ TEST_ERROR;
+
+ if(H5Fclose(file_id) < 0)
+ FAIL_STACK_ERROR;
+ if(H5Pclose(fcpl) < 0)
+ FAIL_STACK_ERROR;
+ if(H5Pclose(fapl) < 0)
+ FAIL_STACK_ERROR;
+ HDfree(data);
+
+ PASSED()
+ return 0;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Pclose(fapl);
+ H5Pclose(fcpl);
+ H5Fclose(file_id);
+ if(data)
+ HDfree(data);
+ } H5E_END_TRY;
+ return 1;
+} /* test_raw_data_handling */
+
+
+/*-------------------------------------------------------------------------
+ * Function: test_lru_processing()
+ *
+ * Purpose: Basic set of tests verifying expected page buffer LRU
+ * management.
+ *
+ * Any data mis-matches or failures reported by the HDF5
+ * library result in test failure.
+ *
+ * Return: 0 if test is sucessful
+ * 1 if test fails
+ *
+ * Programmer: unknown
+ * ?? / ?? / ??
+ *
+ * Changes: Added base_page_cnt field as supporting code. This allows
+ * the test to adjust to the number of page buffer pages
+ * accessed during file open / create.
+ *
+ * The test for the value of base_page_cnt just after file
+ * open exists detect changes in library behavior. Assuming
+ * any such change is not indicative of other issues, these
+ * tests can be modified to reflect the change.
+ *
+ * JRM -- 2/23/17
+ *
+ *
+ *-------------------------------------------------------------------------
+ */
+
+static unsigned
+test_lru_processing(hid_t orig_fapl, const char *env_h5_drvr)
+{
+ char filename[FILENAME_LEN]; /* Filename to use */
+ hid_t file_id = -1; /* File ID */
+ hid_t fcpl = -1;
+ hid_t fapl = -1;
+ size_t base_page_cnt;
+ size_t page_count = 0;
+ int i;
+ int num_elements = 2000;
+ haddr_t addr = HADDR_UNDEF;
+ haddr_t search_addr = HADDR_UNDEF;
+ int *data = NULL;
+ H5F_t *f = NULL;
+
+ TESTING("LRU Processing");
+
+ h5_fixname(FILENAME[0], orig_fapl, filename, sizeof(filename));
+
+ if((fapl = H5Pcopy(orig_fapl)) < 0)
+ FAIL_STACK_ERROR
+
+ if(set_multi_split(env_h5_drvr, fapl, sizeof(int)*200) != 0)
+ TEST_ERROR;
+
+ if((data = (int *)HDcalloc((size_t)num_elements, sizeof(int))) == NULL)
+ TEST_ERROR;
+
+ if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ FAIL_STACK_ERROR;
+
+ if(H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, 0, (hsize_t)1) < 0)
+ FAIL_STACK_ERROR;
+
+ if(H5Pset_file_space_page_size(fcpl, sizeof(int)*200) < 0)
+ FAIL_STACK_ERROR;
+
+ /* keep 2 pages at max in the page buffer */
+ if(H5Pset_page_buffer_size(fapl, sizeof(int)*400, 20, 0) < 0)
+ FAIL_STACK_ERROR;
+
+ if((file_id = 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_id)))
+ FAIL_STACK_ERROR;
+
+ /* opening the file inserts one or more pages into the page buffer.
+ * Get the number of pages inserted, and verify that it is the
+ * the expected value.
+ */
+ base_page_cnt = H5SL_count(f->shared->page_buf->slist_ptr);
+ if(base_page_cnt != 1)
+ TEST_ERROR;
+
+ /* allocate space for a 2000 elements */
+ if(HADDR_UNDEF == (addr = H5MF_alloc(f, H5FD_MEM_DRAW, H5AC_ind_read_dxpl_id, sizeof(int)*(size_t)num_elements)))
+ FAIL_STACK_ERROR;
+
+ /* intialize all the elements to have a value of -1 */
+ for(i=0 ; i<num_elements ; i++)
+ data[i] = -1;
+
+ if(H5F_block_write(f, H5FD_MEM_DRAW, addr, sizeof(int)*(size_t)num_elements, H5AC_rawdata_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+
+ /* update the first 100 elements to have values 0-99 - this will be
+ * a page buffer update with 1 page resulting in the page
+ * buffer.
+ */
+ for(i=0 ; i<100 ; i++)
+ data[i] = i;
+
+ if(H5F_block_write(f, H5FD_MEM_DRAW, addr, sizeof(int)*100, H5AC_rawdata_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+
+ page_count ++;
+
+ if(H5SL_count(f->shared->page_buf->slist_ptr) != page_count + base_page_cnt)
+ TEST_ERROR;
+
+ /* update elements 300 - 450, with values 300 - 449 - this will
+ * bring two pages into the page buffer and evict 0.
+ */
+ for(i=0 ; i<150 ; i++)
+ data[i] = i+300;
+
+ if(H5F_block_write(f, H5FD_MEM_DRAW, addr+(sizeof(int)*300), sizeof(int)*150, H5AC_rawdata_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+
+ page_count = 2;
+
+ /* at this point, the page buffer entry created at file open should
+ * have been evicted -- thus no further need to consider base_page_cnt.
+ */
+ if(H5SL_count(f->shared->page_buf->slist_ptr) != page_count)
+ FAIL_STACK_ERROR;
+
+ /* The two pages should be the ones with address 100 and 200; 0
+ should have been evicted */
+ /* Changes: 200, 400 */
+ search_addr = addr;
+ if(NULL != H5SL_search(f->shared->page_buf->slist_ptr, &(search_addr)))
+ FAIL_STACK_ERROR;
+ search_addr = addr + sizeof(int)*200;
+ if(NULL == H5SL_search(f->shared->page_buf->slist_ptr, &(search_addr)))
+ FAIL_STACK_ERROR;
+ search_addr = addr + sizeof(int)*400;
+ if(NULL == H5SL_search(f->shared->page_buf->slist_ptr, &(search_addr)))
+ FAIL_STACK_ERROR;
+
+ /* update elements 150-151, this will update existing pages in the
+ page buffer and move it to the top of the LRU. */
+ /* Changes: 300 - 301 */
+ for(i=0 ; i<1 ; i++)
+ data[i] = i+300;
+ if(H5F_block_write(f, H5FD_MEM_DRAW, addr+(sizeof(int)*300), sizeof(int)*1, H5AC_rawdata_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+ if(H5SL_count(f->shared->page_buf->slist_ptr) != page_count)
+ FAIL_STACK_ERROR;
+
+ /* read elements 600 - 601, this should read -1 and bring in an
+ entire page of addr 600, and evict page 200 */
+ /* Changes: 1200 - 1201; 1200, 400 */
+ if(H5F_block_read(f, H5FD_MEM_DRAW, addr+(sizeof(int)*1200), sizeof(int)*1, H5AC_rawdata_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+ for (i=0; i < 1; i++) {
+ if(data[i] != -1) {
+ HDfprintf(stderr, "Read different values than written\n");
+ TEST_ERROR;
+ } /* end if */
+ } /* end for */
+ if(H5SL_count(f->shared->page_buf->slist_ptr) != page_count)
+ FAIL_STACK_ERROR;
+
+ /* Changes: 400 */
+ search_addr = addr + sizeof(int)*400;
+ if(NULL != H5SL_search(f->shared->page_buf->slist_ptr, &(search_addr)))
+ FAIL_STACK_ERROR;
+
+ /* Changes: 200 */
+ search_addr = addr + sizeof(int)*200;
+ if(NULL == H5SL_search(f->shared->page_buf->slist_ptr, &(search_addr)))
+ FAIL_STACK_ERROR;
+
+ /* Changes: 1200 */
+ search_addr = addr + sizeof(int)*1200;
+ if(NULL == H5SL_search(f->shared->page_buf->slist_ptr, &(search_addr)))
+ FAIL_STACK_ERROR;
+ /* read elements 175 - 225, this should move 100 to the top, evict 600 and bring in 200 */
+ /* Changes: 350 - 450; 200, 1200, 400 */
+ if(H5F_block_read(f, H5FD_MEM_DRAW, addr+(sizeof(int)*350), sizeof(int)*100, H5AC_rawdata_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+ for (i=0; i < 100; i++) {
+ if(data[i] != i+350) {
+ HDfprintf(stderr, "Read different values than written\n");
+ TEST_ERROR;
+ } /* end if */
+ } /* end for */
+ if(H5SL_count(f->shared->page_buf->slist_ptr) != page_count)
+ FAIL_STACK_ERROR;
+
+ /* Changes: 1200 */
+ search_addr = addr + sizeof(int)*1200;
+ if(NULL != H5SL_search(f->shared->page_buf->slist_ptr, &(search_addr)))
+ FAIL_STACK_ERROR;
+
+ /* Changes: 200 */
+ search_addr = addr + sizeof(int)*200;
+ if(NULL == H5SL_search(f->shared->page_buf->slist_ptr, &(search_addr)))
+ FAIL_STACK_ERROR;
+
+ /* Changes: 400 */
+ search_addr = addr + sizeof(int)*400;
+ if(NULL == H5SL_search(f->shared->page_buf->slist_ptr, &(search_addr)))
+ FAIL_STACK_ERROR;
+
+ /* update elements 200 - 700 to value 0, this will go to disk but
+ also discarding existing pages from the PB (page 200). */
+ /* Changes: 400 - 1400; 400 */
+ for(i=0 ; i<1000 ; i++)
+ data[i] = 0;
+ if(H5F_block_write(f, H5FD_MEM_DRAW, addr+(sizeof(int)*400), sizeof(int)*1000, H5AC_rawdata_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+ page_count -= 1;
+ if(H5SL_count(f->shared->page_buf->slist_ptr) != page_count)
+ FAIL_STACK_ERROR;
+
+ /* Changes: 200 */
+ search_addr = addr + sizeof(int)*200;
+ if(NULL == H5SL_search(f->shared->page_buf->slist_ptr, &(search_addr)))
+ FAIL_STACK_ERROR;
+
+ /* Changes: 400 */
+ search_addr = addr + sizeof(int)*400;
+ if(NULL != H5SL_search(f->shared->page_buf->slist_ptr, &(search_addr)))
+ FAIL_STACK_ERROR;
+
+ if(H5Fclose(file_id) < 0)
+ FAIL_STACK_ERROR;
+ if(H5Pclose(fcpl) < 0)
+ FAIL_STACK_ERROR;
+ if(H5Pclose(fapl) < 0)
+ FAIL_STACK_ERROR;
+ HDfree(data);
+
+ PASSED()
+ return 0;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Pclose(fapl);
+ H5Pclose(fcpl);
+ H5Fclose(file_id);
+ if(data)
+ HDfree(data);
+ } H5E_END_TRY;
+ return 1;
+} /* test_lru_processing */
+
+
+/*-------------------------------------------------------------------------
+ * Function: test_min_threshold()
+ *
+ * Purpose: Tests verifying observation of minimum and maximum
+ * raw and metadata page counts in the page buffer.
+ *
+ * Any data mis-matches or failures reported by the HDF5
+ * library result in test failure.
+ *
+ * Return: 0 if test is sucessful
+ * 1 if test fails
+ *
+ * Programmer: unknown
+ * ?? / ?? / ??
+ *
+ * Changes: Added the base_raw_cnt and base_meta_cnt fields and
+ * supporting code. This allows the test to adjust to the
+ * number of page buffer pages accessed during file open /
+ * create.
+ *
+ * The tests for the values of base_raw_cnt and base_meta_cnt
+ * just after file open exist detect changes in library
+ * behavior. Assuming any such change is not indicative of
+ * other issues, these tests can be modified to reflect the
+ * change.
+ *
+ * JRM -- 2/23/17
+ *
+ *-------------------------------------------------------------------------
+ */
+
+static unsigned
+test_min_threshold(hid_t orig_fapl, const char *env_h5_drvr)
+{
+ char filename[FILENAME_LEN]; /* Filename to use */
+ hid_t file_id = -1; /* File ID */
+ hid_t fcpl = -1;
+ hid_t fapl = -1;
+ size_t base_raw_cnt = 0;
+ size_t base_meta_cnt = 0;
+ size_t page_count = 0;
+ int i;
+ int num_elements = 1000;
+ H5PB_t *page_buf;
+ haddr_t meta_addr = HADDR_UNDEF;
+ haddr_t raw_addr = HADDR_UNDEF;
+ int *data = NULL;
+ H5F_t *f = NULL;
+
+ TESTING("Minimum Metadata threshold Processing");
+ HDprintf("\n");
+ h5_fixname(FILENAME[0], orig_fapl, filename, sizeof(filename));
+
+ if((fapl = H5Pcopy(orig_fapl)) < 0)
+ TEST_ERROR
+
+ if(set_multi_split(env_h5_drvr, fapl, sizeof(int)*200) != 0)
+ TEST_ERROR;
+
+ if((data = (int *)HDcalloc((size_t)num_elements, sizeof(int))) == NULL)
+ TEST_ERROR;
+
+ if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ FAIL_STACK_ERROR;
+
+ if(H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, 0, (hsize_t)1) < 0)
+ FAIL_STACK_ERROR;
+
+ if(H5Pset_file_space_page_size(fcpl, sizeof(int)*200) < 0)
+ FAIL_STACK_ERROR;
+
+ HDprintf("\tMinimum metadata threshold = 100%%\n");
+
+ /* keep 5 pages at max in the page buffer and 5 meta page minimum */
+ if(H5Pset_page_buffer_size(fapl, sizeof(int)*1000, 100, 0) < 0)
+ FAIL_STACK_ERROR;
+
+ /* create the file */
+ if((file_id = 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_id)))
+ FAIL_STACK_ERROR;
+
+ /* opening the file inserts one or more pages into the page buffer.
+ * Get the raw and meta counts now, so we can adjust tests accordingly.
+ */
+ HDassert(f);
+ HDassert(f->shared);
+ HDassert(f->shared->page_buf);
+
+ base_raw_cnt = f->shared->page_buf->raw_count;
+ base_meta_cnt = f->shared->page_buf->meta_count;
+
+ if(base_raw_cnt != 0)
+ TEST_ERROR;
+
+ if(base_meta_cnt != 1)
+ TEST_ERROR;
+
+ page_buf = f->shared->page_buf;
+
+ if(page_buf->min_meta_count != 5)
+ TEST_ERROR;
+
+ if(page_buf->min_raw_count != 0)
+ TEST_ERROR;
+
+ if(HADDR_UNDEF == (meta_addr = H5MF_alloc(f, H5FD_MEM_SUPER, H5AC_ind_read_dxpl_id, sizeof(int)*(size_t)num_elements)))
+ FAIL_STACK_ERROR;
+
+ if(HADDR_UNDEF == (raw_addr = H5MF_alloc(f, H5FD_MEM_DRAW, H5AC_ind_read_dxpl_id, sizeof(int)*(size_t)num_elements)))
+ FAIL_STACK_ERROR;
+
+ /* write all raw data, this would end up in page buffer since there
+ * is no metadata yet
+ *
+ * Not necessarily -- opening the file may may load a metadata page.
+ */
+ for(i=0 ; i<100 ; i++)
+ data[i] = i;
+
+ if(H5F_block_write(f, H5FD_MEM_DRAW, raw_addr, sizeof(int)*100, H5AC_rawdata_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+
+ if(H5F_block_write(f, H5FD_MEM_DRAW, raw_addr+(sizeof(int)*200), sizeof(int)*100, H5AC_rawdata_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+
+ if(H5F_block_write(f, H5FD_MEM_DRAW, raw_addr+(sizeof(int)*400), sizeof(int)*100, H5AC_rawdata_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+
+ if(H5F_block_write(f, H5FD_MEM_DRAW, raw_addr+(sizeof(int)*600), sizeof(int)*100, H5AC_rawdata_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+
+ if(H5F_block_write(f, H5FD_MEM_DRAW, raw_addr+(sizeof(int)*800), sizeof(int)*100, H5AC_rawdata_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+
+ page_count += 5;
+
+ if(H5SL_count(f->shared->page_buf->slist_ptr) != page_count)
+ FAIL_STACK_ERROR;
+
+ if(page_buf->raw_count != 5 - base_meta_cnt)
+ TEST_ERROR;
+
+ /* write all meta data, this would end up in page buffer */
+ if(H5F_block_write(f, H5FD_MEM_SUPER, meta_addr, sizeof(int)*100, H5AC_ind_read_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+
+ if(H5F_block_write(f, H5FD_MEM_SUPER, meta_addr+(sizeof(int)*200), sizeof(int)*50, H5AC_ind_read_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+
+ if(H5F_block_write(f, H5FD_MEM_SUPER, meta_addr+(sizeof(int)*400), sizeof(int)*50, H5AC_ind_read_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+
+ if(H5F_block_read(f, H5FD_MEM_SUPER, meta_addr+(sizeof(int)*600), sizeof(int)*50, H5AC_ind_read_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+
+ if(H5F_block_read(f, H5FD_MEM_SUPER, meta_addr+(sizeof(int)*800), sizeof(int)*50, H5AC_ind_read_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+
+ if(H5SL_count(f->shared->page_buf->slist_ptr) != page_count)
+ FAIL_STACK_ERROR;
+
+ if(page_buf->meta_count != 5)
+ TEST_ERROR;
+
+ if(page_buf->raw_count != 0)
+ TEST_ERROR;
+
+ /* write and read more raw data and make sure that they don't end up in
+ * page buffer since the minimum metadata is actually the entire
+ * page buffer
+ */
+ if(H5F_block_write(f, H5FD_MEM_DRAW, raw_addr+(sizeof(int)*200), sizeof(int)*100, H5AC_rawdata_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+
+ if(H5F_block_write(f, H5FD_MEM_DRAW, raw_addr+(sizeof(int)*350), sizeof(int)*100, H5AC_rawdata_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+
+ if(H5F_block_read(f, H5FD_MEM_DRAW, raw_addr+(sizeof(int)*500), sizeof(int)*100, H5AC_rawdata_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+
+ if(H5F_block_read(f, H5FD_MEM_DRAW, raw_addr+(sizeof(int)*750), sizeof(int)*100, H5AC_rawdata_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+
+ if(H5F_block_read(f, H5FD_MEM_DRAW, raw_addr+(sizeof(int)*900), sizeof(int)*100, H5AC_rawdata_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+
+ if(H5SL_count(f->shared->page_buf->slist_ptr) != page_count)
+ FAIL_STACK_ERROR;
+
+ if(page_buf->meta_count != 5)
+ TEST_ERROR;
+
+ if(page_buf->raw_count != 0)
+ TEST_ERROR;
+
+ if(H5Fclose(file_id) < 0)
+ FAIL_STACK_ERROR;
+
+
+ HDprintf("\tMinimum raw data threshold = 100%%\n");
+
+ page_count = 0;
+
+ /* keep 5 pages at max in the page buffer and 5 raw page minimum */
+ /* Changes: 1000 */
+ if(H5Pset_page_buffer_size(fapl, sizeof(int)*1000, 0, 100) < 0)
+ TEST_ERROR;
+
+ /* create the file */
+ if((file_id = 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_id)))
+ FAIL_STACK_ERROR;
+
+ /* opening the file inserts one or more pages into the page buffer.
+ * Get the raw and meta counts now, so we can adjust tests accordingly.
+ */
+ HDassert(f);
+ HDassert(f->shared);
+ HDassert(f->shared->page_buf);
+
+ base_raw_cnt = f->shared->page_buf->raw_count;
+ base_meta_cnt = f->shared->page_buf->meta_count;
+
+ if(base_raw_cnt != 0)
+ TEST_ERROR;
+
+ if(base_meta_cnt != 1)
+ TEST_ERROR;
+
+ page_buf = f->shared->page_buf;
+
+ if(page_buf->min_meta_count != 0)
+ TEST_ERROR;
+ if(page_buf->min_raw_count != 5)
+ FAIL_STACK_ERROR;
+
+ if(HADDR_UNDEF == (meta_addr = H5MF_alloc(f, H5FD_MEM_SUPER, H5AC_ind_read_dxpl_id, sizeof(int)*(size_t)num_elements)))
+ FAIL_STACK_ERROR;
+
+ if(HADDR_UNDEF == (raw_addr = H5MF_alloc(f, H5FD_MEM_DRAW, H5AC_ind_read_dxpl_id, sizeof(int)*(size_t)num_elements)))
+ TEST_ERROR;
+
+ /* write all meta data, this would end up in page buffer since there
+ * is no raw data yet
+ */
+ for(i=0 ; i<100 ; i++)
+ data[i] = i;
+
+ if(H5F_block_write(f, H5FD_MEM_SUPER, meta_addr, sizeof(int)*100, H5AC_ind_read_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+
+ if(H5F_block_write(f, H5FD_MEM_SUPER, meta_addr+(sizeof(int)*200), sizeof(int)*100, H5AC_ind_read_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+
+ if(H5F_block_write(f, H5FD_MEM_SUPER, meta_addr+(sizeof(int)*400), sizeof(int)*100, H5AC_ind_read_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+
+ if(H5F_block_write(f, H5FD_MEM_SUPER, meta_addr+(sizeof(int)*600), sizeof(int)*100, H5AC_ind_read_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+
+ if(H5F_block_write(f, H5FD_MEM_SUPER, meta_addr+(sizeof(int)*800), sizeof(int)*100, H5AC_ind_read_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+
+ page_count += 5;
+
+ if(H5SL_count(f->shared->page_buf->slist_ptr) != page_count)
+ FAIL_STACK_ERROR;
+ if(page_buf->meta_count != 5 - base_raw_cnt)
+ TEST_ERROR;
+
+ /* write/read all raw data, this would end up in page buffer */
+ if(H5F_block_write(f, H5FD_MEM_DRAW, raw_addr, sizeof(int)*100, H5AC_rawdata_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+
+ if(H5F_block_write(f, H5FD_MEM_DRAW, raw_addr+(sizeof(int)*200), sizeof(int)*100, H5AC_rawdata_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+
+ if(H5F_block_write(f, H5FD_MEM_DRAW, raw_addr+(sizeof(int)*400), sizeof(int)*100, H5AC_rawdata_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+
+ if(H5F_block_read(f, H5FD_MEM_DRAW, raw_addr+(sizeof(int)*600), sizeof(int)*100, H5AC_rawdata_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+
+ if(H5F_block_read(f, H5FD_MEM_DRAW, raw_addr+(sizeof(int)*800), sizeof(int)*100, H5AC_rawdata_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+
+ if(H5SL_count(f->shared->page_buf->slist_ptr) != page_count)
+ FAIL_STACK_ERROR;
+
+ if(page_buf->raw_count != 5)
+ TEST_ERROR;
+
+ if(page_buf->meta_count != 0)
+ TEST_ERROR;
+
+ /* write and read more meta data and make sure that they don't end up in
+ * page buffer since the minimum metadata is actually the entire
+ * page buffer
+ */
+ if(H5F_block_write(f, H5FD_MEM_SUPER, meta_addr+(sizeof(int)*100), sizeof(int)*50, H5AC_ind_read_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+
+ if(H5F_block_write(f, H5FD_MEM_SUPER, meta_addr+(sizeof(int)*350), sizeof(int)*50, H5AC_ind_read_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+
+ if(H5F_block_read(f, H5FD_MEM_SUPER, meta_addr+(sizeof(int)*500), sizeof(int)*50, H5AC_ind_read_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+
+ if(H5F_block_read(f, H5FD_MEM_SUPER, meta_addr+(sizeof(int)*750), sizeof(int)*50, H5AC_ind_read_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+
+ if(H5F_block_read(f, H5FD_MEM_SUPER, meta_addr+(sizeof(int)*900), sizeof(int)*50, H5AC_ind_read_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+
+ if(H5SL_count(f->shared->page_buf->slist_ptr) != page_count)
+ FAIL_STACK_ERROR;
+
+ if(page_buf->raw_count != 5)
+ TEST_ERROR;
+
+ if(page_buf->meta_count != 0)
+ TEST_ERROR;
+
+ if(H5Fclose(file_id) < 0)
+ FAIL_STACK_ERROR;
+
+
+ HDprintf("\tMinimum metadata threshold = 40%%, Minimum rawdata threshold = 40%%\n");
+ page_count = 0;
+ /* keep 5 pages at max in the page buffer 2 meta pages, 2 raw pages
+ * minimum
+ */
+ if(H5Pset_page_buffer_size(fapl, sizeof(int)*1000, 40, 40) < 0)
+ TEST_ERROR;
+
+ /* create the file */
+ if((file_id = 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_id)))
+ FAIL_STACK_ERROR;
+
+ /* opening the file inserts one or more pages into the page buffer.
+ *
+ * However, with the current 1 metadata page inserted into the
+ * the page buffer, it is not necessary to track the base raw and
+ * metadata entry counts.
+ */
+
+ if(base_raw_cnt != 0)
+ TEST_ERROR;
+
+ if(base_meta_cnt != 1)
+ TEST_ERROR;
+ page_buf = f->shared->page_buf;
+
+ if(page_buf->min_meta_count != 2)
+ TEST_ERROR;
+
+ if(page_buf->min_raw_count != 2)
+ TEST_ERROR;
+
+ if(HADDR_UNDEF == (meta_addr = H5MF_alloc(f, H5FD_MEM_SUPER, H5AC_ind_read_dxpl_id, sizeof(int)*(size_t)num_elements)))
+ FAIL_STACK_ERROR;
+
+ if(HADDR_UNDEF == (raw_addr = H5MF_alloc(f, H5FD_MEM_DRAW, H5AC_ind_read_dxpl_id, sizeof(int)*(size_t)num_elements)))
+ FAIL_STACK_ERROR;
+
+ /* intialize all the elements to have a value of -1 */
+ for(i=0 ; i<num_elements ; i++)
+ data[i] = -1;
+
+ if(H5F_block_write(f, H5FD_MEM_DRAW, raw_addr, sizeof(int)*(size_t)num_elements, H5AC_rawdata_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+
+ if(H5F_block_write(f, H5FD_MEM_SUPER, meta_addr, sizeof(int)*(size_t)num_elements, H5AC_ind_read_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+
+ /* fill the page buffer with raw data */
+ for(i=0 ; i<100 ; i++)
+ data[i] = i;
+
+ if(H5F_block_write(f, H5FD_MEM_DRAW, raw_addr, sizeof(int)*100, H5AC_rawdata_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+
+ if(H5F_block_write(f, H5FD_MEM_DRAW, raw_addr+(sizeof(int)*200), sizeof(int)*100, H5AC_rawdata_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+
+ if(H5F_block_write(f, H5FD_MEM_DRAW, raw_addr+(sizeof(int)*400), sizeof(int)*100, H5AC_rawdata_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+
+ if(H5F_block_write(f, H5FD_MEM_DRAW, raw_addr+(sizeof(int)*600), sizeof(int)*100, H5AC_rawdata_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+
+ if(H5F_block_write(f, H5FD_MEM_DRAW, raw_addr+(sizeof(int)*800), sizeof(int)*100, H5AC_rawdata_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+
+ page_count += 5;
+
+ if(H5SL_count(f->shared->page_buf->slist_ptr) != page_count)
+ TEST_ERROR;
+
+ if(f->shared->page_buf->raw_count != 5 - base_meta_cnt)
+ TEST_ERROR;
+
+ /* add 3 meta entries evicting 3 raw entries */
+ if(H5F_block_write(f, H5FD_MEM_SUPER, meta_addr, sizeof(int)*100, H5AC_ind_read_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+
+ if(H5F_block_write(f, H5FD_MEM_SUPER, meta_addr+(sizeof(int)*200), sizeof(int)*100, H5AC_ind_read_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+
+ if(H5F_block_write(f, H5FD_MEM_SUPER, meta_addr+(sizeof(int)*400), sizeof(int)*100, H5AC_ind_read_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+
+ if(H5SL_count(f->shared->page_buf->slist_ptr) != page_count)
+ FAIL_STACK_ERROR;
+
+ if(f->shared->page_buf->meta_count != 3)
+ TEST_ERROR;
+
+ if(f->shared->page_buf->raw_count != 2)
+ TEST_ERROR;
+
+ /* adding more meta entires should replace meta entries since raw data
+ * is at its minimum
+ */
+ if(H5F_block_write(f, H5FD_MEM_SUPER, meta_addr+(sizeof(int)*600), sizeof(int)*100, H5AC_ind_read_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+
+ if(H5F_block_write(f, H5FD_MEM_SUPER, meta_addr+(sizeof(int)*800), sizeof(int)*100, H5AC_ind_read_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+
+ if(f->shared->page_buf->meta_count != 3)
+ TEST_ERROR;
+
+ if(f->shared->page_buf->raw_count != 2)
+ TEST_ERROR;
+
+ /* bring existing raw entires up the LRU */
+ if(H5F_block_read(f, H5FD_MEM_DRAW, raw_addr+(sizeof(int)*750), sizeof(int)*100, H5AC_rawdata_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+
+ /* adding 2 raw entries (even with 1 call) should only evict 1 meta
+ * entry and another raw entry
+ */
+ if(H5F_block_read(f, H5FD_MEM_DRAW, raw_addr+(sizeof(int)*350), sizeof(int)*100, H5AC_rawdata_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+
+ if(f->shared->page_buf->meta_count != 2)
+ TEST_ERROR;
+
+ if(f->shared->page_buf->raw_count != 3)
+ TEST_ERROR;
+
+ /* adding 2 meta entries should replace 2 entires at the bottom of the LRU */
+ if(H5F_block_read(f, H5FD_MEM_SUPER, meta_addr+(sizeof(int)*98), sizeof(int)*100, H5AC_ind_read_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+
+ if(H5F_block_read(f, H5FD_MEM_SUPER, meta_addr+(sizeof(int)*242), sizeof(int)*100, H5AC_ind_read_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+
+ if(f->shared->page_buf->meta_count != 2)
+ TEST_ERROR;
+
+ if(f->shared->page_buf->raw_count != 3)
+ TEST_ERROR;
+
+ if(H5Fclose(file_id) < 0)
+ FAIL_STACK_ERROR;
+
+ HDprintf("\tMinimum metadata threshold = 20%%\n");
+ page_count = 0;
+ /* keep 5 pages at max in the page buffer and 1 meta page minimum */
+ if(H5Pset_page_buffer_size(fapl, sizeof(int)*1000, 39, 0) < 0)
+ TEST_ERROR;
+ /* create the file */
+ if((file_id = 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_id)))
+ FAIL_STACK_ERROR;
+ page_buf = f->shared->page_buf;
+
+ if(page_buf->min_meta_count != 1)
+ TEST_ERROR;
+ if(page_buf->min_raw_count != 0)
+ TEST_ERROR;
+
+ if(HADDR_UNDEF == (meta_addr = H5MF_alloc(f, H5FD_MEM_SUPER, H5AC_ind_read_dxpl_id, sizeof(int)*(size_t)num_elements)))
+ FAIL_STACK_ERROR;
+
+ if(HADDR_UNDEF == (raw_addr = H5MF_alloc(f, H5FD_MEM_DRAW, H5AC_ind_read_dxpl_id, sizeof(int)*(size_t)num_elements)))
+ FAIL_STACK_ERROR;
+
+ /* intialize all the elements to have a value of -1 */
+ for(i=0 ; i<num_elements ; i++)
+ data[i] = -1;
+
+ if(H5F_block_write(f, H5FD_MEM_DRAW, raw_addr, sizeof(int)*(size_t)num_elements, H5AC_rawdata_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+
+ if(H5F_block_write(f, H5FD_MEM_SUPER, meta_addr, sizeof(int)*(size_t)num_elements, H5AC_ind_read_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+
+ /* fill the page buffer with raw data */
+ for(i=0 ; i<100 ; i++)
+ data[i] = i;
+
+ if(H5F_block_write(f, H5FD_MEM_DRAW, raw_addr, sizeof(int)*100, H5AC_rawdata_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+
+ if(H5F_block_write(f, H5FD_MEM_DRAW, raw_addr+(sizeof(int)*200), sizeof(int)*100, H5AC_rawdata_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+
+ if(H5F_block_write(f, H5FD_MEM_DRAW, raw_addr+(sizeof(int)*400), sizeof(int)*100, H5AC_rawdata_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+
+ if(H5F_block_write(f, H5FD_MEM_DRAW, raw_addr+(sizeof(int)*600), sizeof(int)*100, H5AC_rawdata_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+
+ if(H5F_block_write(f, H5FD_MEM_DRAW, raw_addr+(sizeof(int)*800), sizeof(int)*100, H5AC_rawdata_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+
+ page_count += 5;
+
+ if(H5SL_count(f->shared->page_buf->slist_ptr) != page_count)
+ FAIL_STACK_ERROR;
+
+ /* add 2 meta entries evicting 2 raw entries */
+ if(H5F_block_write(f, H5FD_MEM_SUPER, meta_addr, sizeof(int)*100, H5AC_ind_read_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+
+ if(H5F_block_write(f, H5FD_MEM_SUPER, meta_addr+(sizeof(int)*200), sizeof(int)*100, H5AC_ind_read_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+
+ if(H5SL_count(f->shared->page_buf->slist_ptr) != page_count)
+ FAIL_STACK_ERROR;
+
+ if(f->shared->page_buf->meta_count != 2)
+ TEST_ERROR;
+
+ if(f->shared->page_buf->raw_count != 3)
+ TEST_ERROR;
+
+ /* bring the rest of the raw entries up the LRU */
+ if(H5F_block_write(f, H5FD_MEM_DRAW, raw_addr+(sizeof(int)*500), sizeof(int)*100, H5AC_rawdata_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+
+ if(H5F_block_write(f, H5FD_MEM_DRAW, raw_addr+(sizeof(int)*700), sizeof(int)*100, H5AC_rawdata_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+
+ if(H5F_block_write(f, H5FD_MEM_DRAW, raw_addr+(sizeof(int)*900), sizeof(int)*100, H5AC_rawdata_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+
+ /* write one more raw entry which replace one meta entry */
+ if(H5F_block_write(f, H5FD_MEM_DRAW, raw_addr+(sizeof(int)*100), sizeof(int)*100, H5AC_rawdata_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+
+ if(H5SL_count(f->shared->page_buf->slist_ptr) != page_count)
+ FAIL_STACK_ERROR;
+
+ if(f->shared->page_buf->meta_count != 1)
+ TEST_ERROR;
+
+ if(f->shared->page_buf->raw_count != 4)
+ TEST_ERROR;
+
+ /* write one more raw entry which should replace another raw entry
+ * keeping min threshold of meta entries
+ */
+ if(H5F_block_write(f, H5FD_MEM_DRAW, raw_addr+(sizeof(int)*300), sizeof(int)*100, H5AC_rawdata_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+
+ if(H5SL_count(f->shared->page_buf->slist_ptr) != page_count)
+ FAIL_STACK_ERROR;
+
+ if(f->shared->page_buf->meta_count != 1)
+ TEST_ERROR;
+
+ if(f->shared->page_buf->raw_count != 4)
+ TEST_ERROR;
+
+ /* write a metadata entry that should replace the metadata entry
+ * at the bottom of the LRU
+ */
+ if(H5F_block_write(f, H5FD_MEM_SUPER, meta_addr+(sizeof(int)*500), sizeof(int)*100, H5AC_ind_read_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+
+ if(H5SL_count(f->shared->page_buf->slist_ptr) != page_count)
+ FAIL_STACK_ERROR;
+
+ if(f->shared->page_buf->meta_count != 1)
+ TEST_ERROR;
+
+ if(f->shared->page_buf->raw_count != 4)
+ TEST_ERROR;
+
+ if(H5Fclose(file_id) < 0)
+ FAIL_STACK_ERROR;
+
+ if(H5Pclose(fcpl) < 0)
+ FAIL_STACK_ERROR;
+
+ if(H5Pclose(fapl) < 0)
+ FAIL_STACK_ERROR;
+
+ HDfree(data);
+
+ PASSED()
+
+ return 0;
+
+error:
+
+ H5E_BEGIN_TRY {
+ H5Pclose(fapl);
+ H5Pclose(fcpl);
+ H5Fclose(file_id);
+ if(data)
+ HDfree(data);
+ } H5E_END_TRY;
+
+ return 1;
+
+} /* test_min_threshold */
+
+
+/*-------------------------------------------------------------------------
+ * Function: test_stats_collection()
+ *
+ * Purpose: Tests verifying correct collection of statistics
+ * by the page buffer.
+ *
+ * Any data mis-matches or failures reported by the HDF5
+ * library result in test failure.
+ *
+ * Return: 0 if test is sucessful
+ * 1 if test fails
+ *
+ * Programmer: unknown
+ * ?? / ?? / ??
+ *
+ * Changes: Added the base_raw_cnt and base_meta_cnt fields and
+ * supporting code. This allows the test to adjust to the
+ * number of page buffer pages accessed during file open /
+ * create.
+ *
+ * The tests for the values of base_raw_cnt and base_meta_cnt
+ * just after file open exist detect changes in library
+ * behavior. Assuming any such change is not indicative of
+ * other issues, these tests can be modified to reflect the
+ * change.
+ *
+ * JRM -- 2/23/17
+ *
+ *-------------------------------------------------------------------------
+ */
+static unsigned
+test_stats_collection(hid_t orig_fapl, const char *env_h5_drvr)
+{
+ char filename[FILENAME_LEN]; /* Filename to use */
+ hid_t file_id = -1; /* File ID */
+ hid_t fcpl = -1;
+ hid_t fapl = -1;
+ int i;
+ int num_elements = 1000;
+ size_t base_raw_cnt = 0;
+ size_t base_meta_cnt = 0;
+ haddr_t meta_addr = HADDR_UNDEF;
+ haddr_t raw_addr = HADDR_UNDEF;
+ int *data = NULL;
+ H5F_t *f = NULL;
+
+ TESTING("Statistics Collection");
+
+ h5_fixname(FILENAME[0], orig_fapl, filename, sizeof(filename));
+
+ if((fapl = H5Pcopy(orig_fapl)) < 0)
+ TEST_ERROR
+
+ if(set_multi_split(env_h5_drvr, fapl, sizeof(int)*200) != 0)
+ TEST_ERROR;
+
+ if((data = (int *)HDcalloc((size_t)num_elements, sizeof(int))) == NULL)
+ TEST_ERROR
+
+ if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ TEST_ERROR;
+
+ if(H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, 0, (hsize_t)1) < 0)
+ TEST_ERROR;
+
+ if(H5Pset_file_space_page_size(fcpl, sizeof(int)*200) < 0)
+ TEST_ERROR;
+
+ /* keep 5 pages at max in the page buffer */
+ if(H5Pset_page_buffer_size(fapl, sizeof(int)*1000, 20, 0) < 0)
+ TEST_ERROR;
+
+ if((file_id = 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_id)))
+ FAIL_STACK_ERROR;
+
+ /* opening the file inserts one or more pages into the page buffer.
+ * Get the raw and meta counts now, so we can adjust the expected
+ * statistics accordingly.
+ */
+ HDassert(f);
+ HDassert(f->shared);
+ HDassert(f->shared->page_buf);
+
+ base_raw_cnt = f->shared->page_buf->raw_count;
+ base_meta_cnt = f->shared->page_buf->meta_count;
+
+ if(base_raw_cnt != 0)
+ TEST_ERROR;
+
+ if(base_meta_cnt != 1)
+ TEST_ERROR;
+
+ /* reset statistics before we begin the tests */
+ if(H5Freset_page_buffering_stats(file_id) < 0)
+ FAIL_STACK_ERROR;
+
+ if(HADDR_UNDEF == (meta_addr = H5MF_alloc(f, H5FD_MEM_SUPER, H5AC_ind_read_dxpl_id, sizeof(int)*(size_t)num_elements)))
+ FAIL_STACK_ERROR;
+
+ if(HADDR_UNDEF == (raw_addr = H5MF_alloc(f, H5FD_MEM_DRAW, H5AC_ind_read_dxpl_id, sizeof(int)*(size_t)num_elements)))
+ FAIL_STACK_ERROR;
+
+
+ /* intialize all the elements to have a value of -1 */
+ for(i=0 ; i<num_elements ; i++)
+ data[i] = -1;
+
+ if(H5F_block_write(f, H5FD_MEM_DRAW, raw_addr, sizeof(int)*(size_t)num_elements, H5AC_rawdata_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+
+ if(H5F_block_write(f, H5FD_MEM_SUPER, meta_addr, sizeof(int)*(size_t)num_elements, H5AC_ind_read_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+
+ for(i=0 ; i<200 ; i++)
+ data[i] = i;
+
+ if(H5F_block_write(f, H5FD_MEM_DRAW, raw_addr, sizeof(int)*100, H5AC_rawdata_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+
+ if(H5F_block_write(f, H5FD_MEM_DRAW, raw_addr+(sizeof(int)*200), sizeof(int)*100, H5AC_rawdata_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+
+ if(H5F_block_write(f, H5FD_MEM_DRAW, raw_addr+(sizeof(int)*400), sizeof(int)*100, H5AC_rawdata_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+
+ if(H5F_block_write(f, H5FD_MEM_SUPER, meta_addr, sizeof(int)*100, H5AC_ind_read_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+
+ if(H5F_block_write(f, H5FD_MEM_SUPER, meta_addr+(sizeof(int)*200), sizeof(int)*100, H5AC_ind_read_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+
+ if(H5F_block_write(f, H5FD_MEM_DRAW, raw_addr+(sizeof(int)*600), sizeof(int)*100, H5AC_rawdata_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+
+ if(H5F_block_write(f, H5FD_MEM_DRAW, raw_addr+(sizeof(int)*800), sizeof(int)*100, H5AC_rawdata_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+
+ if(H5F_block_write(f, H5FD_MEM_SUPER, meta_addr+(sizeof(int)*600), sizeof(int)*100, H5AC_ind_read_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+
+ if(H5F_block_write(f, H5FD_MEM_DRAW, raw_addr+(sizeof(int)*500), sizeof(int)*100, H5AC_rawdata_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+
+ if(H5F_block_write(f, H5FD_MEM_DRAW, raw_addr+(sizeof(int)*700), sizeof(int)*100, H5AC_rawdata_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+
+ if(H5F_block_write(f, H5FD_MEM_DRAW, raw_addr+(sizeof(int)*900), sizeof(int)*100, H5AC_rawdata_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+
+ if(H5F_block_write(f, H5FD_MEM_SUPER, meta_addr+(sizeof(int)*400), sizeof(int)*200, H5AC_ind_read_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+
+ if(H5F_block_write(f, H5FD_MEM_DRAW, raw_addr+(sizeof(int)*100), sizeof(int)*100, H5AC_rawdata_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+
+ if(H5F_block_write(f, H5FD_MEM_DRAW, raw_addr+(sizeof(int)*300), sizeof(int)*100, H5AC_rawdata_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+
+ if(H5F_block_write(f, H5FD_MEM_SUPER, meta_addr+(sizeof(int)*800), sizeof(int)*182, H5AC_ind_read_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+
+ if(H5F_block_read(f, H5FD_MEM_DRAW, raw_addr, sizeof(int)*100, H5AC_rawdata_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+
+ if(H5F_block_read(f, H5FD_MEM_DRAW, raw_addr+(sizeof(int)*200), sizeof(int)*100, H5AC_rawdata_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+
+ if(H5F_block_read(f, H5FD_MEM_DRAW, raw_addr+(sizeof(int)*400), sizeof(int)*100, H5AC_rawdata_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+
+ if(H5F_block_read(f, H5FD_MEM_SUPER, meta_addr, sizeof(int)*100, H5AC_ind_read_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+
+ if(H5F_block_read(f, H5FD_MEM_SUPER, meta_addr+(sizeof(int)*200), sizeof(int)*100, H5AC_ind_read_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+
+ if(H5F_block_read(f, H5FD_MEM_DRAW, raw_addr+(sizeof(int)*600), sizeof(int)*100, H5AC_rawdata_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+
+ if(H5F_block_read(f, H5FD_MEM_DRAW, raw_addr+(sizeof(int)*800), sizeof(int)*100, H5AC_rawdata_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+
+ if(H5F_block_read(f, H5FD_MEM_SUPER, meta_addr+(sizeof(int)*400), sizeof(int)*100, H5AC_ind_read_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+
+ if(H5F_block_read(f, H5FD_MEM_SUPER, meta_addr+(sizeof(int)*600), sizeof(int)*200, H5AC_ind_read_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+
+ if(H5F_block_read(f, H5FD_MEM_SUPER, meta_addr+(sizeof(int)*800), sizeof(int)*100, H5AC_ind_read_dxpl_id, data) < 0)
+ FAIL_STACK_ERROR;
+
+ if(f->shared->page_buf->accesses[0] != 8)
+ TEST_ERROR;
+ if(f->shared->page_buf->accesses[1] != 16)
+ TEST_ERROR;
+
+ if(f->shared->page_buf->bypasses[0] != 3)
+ TEST_ERROR;
+ if(f->shared->page_buf->bypasses[1] != 1)
+ TEST_ERROR;
+
+ if(f->shared->page_buf->hits[0] != 0)
+ TEST_ERROR;
+ if(f->shared->page_buf->hits[1] != 4)
+ TEST_ERROR;
+
+ if(f->shared->page_buf->misses[0] != 8)
+ TEST_ERROR;
+ if(f->shared->page_buf->misses[1] != 11)
+ TEST_ERROR;
+
+ if(f->shared->page_buf->evictions[0] != 5 + base_meta_cnt)
+ TEST_ERROR;
+ if(f->shared->page_buf->evictions[1] != 9 + base_raw_cnt)
+ TEST_ERROR;
+
+ {
+ unsigned accesses[2];
+ unsigned hits[2];
+ unsigned misses[2];
+ unsigned evictions[2];
+ unsigned bypasses[2];
+
+ if(H5Fget_page_buffering_stats(file_id, accesses, hits, misses, evictions, bypasses) < 0)
+ FAIL_STACK_ERROR;
+
+ if(accesses[0] != 8)
+ TEST_ERROR;
+ if(accesses[1] != 16)
+ TEST_ERROR;
+ if(bypasses[0] != 3)
+ TEST_ERROR;
+ if(bypasses[1] != 1)
+ TEST_ERROR;
+ if(hits[0] != 0)
+ TEST_ERROR;
+ if(hits[1] != 4)
+ TEST_ERROR;
+ if(misses[0] != 8)
+ TEST_ERROR;
+ if(misses[1] != 11)
+ TEST_ERROR;
+ if(evictions[0] != 5 + base_meta_cnt)
+ TEST_ERROR;
+ if(evictions[1] != 9 + base_raw_cnt)
+ TEST_ERROR;
+
+ if(H5Freset_page_buffering_stats(file_id) < 0)
+ FAIL_STACK_ERROR;
+ if(H5Fget_page_buffering_stats(file_id, accesses, hits, misses, evictions, bypasses) < 0)
+ FAIL_STACK_ERROR;
+
+ if(accesses[0] != 0)
+ TEST_ERROR;
+ if(accesses[1] != 0)
+ TEST_ERROR;
+ if(bypasses[0] != 0)
+ TEST_ERROR;
+ if(bypasses[1] != 0)
+ TEST_ERROR;
+ if(hits[0] != 0)
+ TEST_ERROR;
+ if(hits[1] != 0)
+ TEST_ERROR;
+ if(misses[0] != 0)
+ TEST_ERROR;
+ if(misses[1] != 0)
+ TEST_ERROR;
+ if(evictions[0] != 0)
+ TEST_ERROR;
+ if(evictions[1] != 0)
+ TEST_ERROR;
+ } /* end block */
+
+ if(H5Fclose(file_id) < 0)
+ FAIL_STACK_ERROR;
+ if(H5Pclose(fcpl) < 0)
+ FAIL_STACK_ERROR;
+ if(H5Pclose(fapl) < 0)
+ FAIL_STACK_ERROR;
+ HDfree(data);
+
+
+ PASSED()
+ return 0;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Pclose(fapl);
+ H5Pclose(fcpl);
+ H5Fclose(file_id);
+ if(data)
+ HDfree(data);
+ } H5E_END_TRY;
+
+ return 1;
+} /* test_stats_collection */
+
+
+/*-------------------------------------------------------------------------
+ * Function: main()
+ *
+ * Purpose: Main function for the page buffer tests.
+ *
+ * Return: 0 if test is sucessful
+ * 1 if test fails
+ *
+ * Programmer: unknown
+ * ?? / ?? / ??
+ *
+ *-------------------------------------------------------------------------
+ */
+int
+main(void)
+{
+ hid_t fapl = -1; /* File access property list for data files */
+ unsigned nerrors = 0; /* Cumulative error count */
+ const char *env_h5_drvr = NULL; /* File Driver value from environment */
+
+#ifndef H5_HAVE_PARALLEL
+
+ h5_reset();
+
+ /* Get the VFD to use */
+ env_h5_drvr = HDgetenv("HDF5_DRIVER");
+ if(env_h5_drvr == NULL)
+ env_h5_drvr = "nomatch";
+
+ /* Temporary skip testing with multi/split drivers:
+ * Page buffering depends on paged aggregation which is
+ * currently disabled for multi/split drivers.
+ */
+ if((0 == HDstrcmp(env_h5_drvr, "multi")) ||
+ (0 == HDstrcmp(env_h5_drvr, "split"))) {
+
+ SKIPPED()
+ HDputs("Skip page buffering test because paged aggregation is disabled for multi/split drivers");
+ HDexit(EXIT_SUCCESS);
+ } /* end if */
+
+ if((fapl = h5_fileaccess()) < 0) {
+ nerrors++;
+ PUTS_ERROR("Can't get VFD-dependent fapl")
+ } /* end if */
+
+ nerrors += test_args(fapl, env_h5_drvr);
+ nerrors += test_raw_data_handling(fapl, env_h5_drvr);
+ nerrors += test_lru_processing(fapl, env_h5_drvr);
+ nerrors += test_min_threshold(fapl, env_h5_drvr);
+ nerrors += test_stats_collection(fapl, env_h5_drvr);
+
+ h5_clean_files(FILENAME, fapl);
+
+ if(nerrors)
+ goto error;
+
+ HDputs("All Page Buffering tests passed.");
+
+#else
+ SKIPPED()
+ HDputs("Page Buffering is disabled for parallel.");
+#endif
+
+ HDexit(EXIT_SUCCESS);
+
+error:
+
+ HDprintf("***** %d Page Buffering TEST%s FAILED! *****\n",
+ nerrors, nerrors > 1 ? "S" : "");
+
+ H5E_BEGIN_TRY {
+ H5Pclose(fapl);
+ } H5E_END_TRY;
+
+ HDexit(EXIT_FAILURE);
+
+} /* main() */
+
diff --git a/test/paged_nopersist.h5 b/test/paged_nopersist.h5
new file mode 100644
index 0000000..b6c945a
--- /dev/null
+++ b/test/paged_nopersist.h5
Binary files differ
diff --git a/test/paged_persist.h5 b/test/paged_persist.h5
new file mode 100644
index 0000000..f0ae836
--- /dev/null
+++ b/test/paged_persist.h5
Binary files differ
diff --git a/test/set_extent.c b/test/set_extent.c
index a992419..17dc6a0 100644
--- a/test/set_extent.c
+++ b/test/set_extent.c
@@ -139,6 +139,15 @@ int main( void )
unsigned new_format; /* Whether to use the latest file format */
unsigned chunk_cache; /* Whether to enable chunk caching */
int nerrors = 0;
+ const char *env_h5_drvr; /* File Driver value from environment */
+ hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */
+
+
+ env_h5_drvr = HDgetenv("HDF5_DRIVER");
+ if(env_h5_drvr == NULL)
+ env_h5_drvr = "nomatch";
+ /* Current VFD that does not support contigous address space */
+ contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi"));
/* Initialize random number seed */
HDsrandom((unsigned)HDtime(NULL));
@@ -194,12 +203,15 @@ int main( void )
H5F_LIBVER_LATEST) < 0) TEST_ERROR
/* Tests which use chunked datasets */
- nerrors += do_ranks( my_fapl, new_format ) < 0 ? 1 : 0;
+ if(!new_format || (new_format && contig_addr_vfd))
+ nerrors += do_ranks( my_fapl, new_format ) < 0 ? 1 : 0;
} /* end for */
/* Tests which do not use chunked datasets */
- nerrors += test_external( fapl ) < 0 ? 1 : 0;
- nerrors += do_layouts( fapl ) < 0 ? 1 : 0;
+ if(!new_format || (new_format && contig_addr_vfd)) {
+ nerrors += test_external( fapl ) < 0 ? 1 : 0;
+ nerrors += do_layouts( fapl ) < 0 ? 1 : 0;
+ }
} /* end for */
/* Close 2nd FAPL */
diff --git a/test/stab.c b/test/stab.c
index f81bb5f..00aee21 100644
--- a/test/stab.c
+++ b/test/stab.c
@@ -96,7 +96,7 @@ const char *FILENAME[] = {
*-------------------------------------------------------------------------
*/
static int
-test_misc(hid_t fapl, hbool_t new_format)
+test_misc(hid_t fcpl, hid_t fapl, hbool_t new_format)
{
hid_t fid = (-1); /* File ID */
hid_t g1 = (-1), g2 = (-1), g3 = (-1);
@@ -110,7 +110,7 @@ test_misc(hid_t fapl, hbool_t new_format)
/* Create file */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0) TEST_ERROR
/* Create initial groups for testing, then close */
if((g1 = H5Gcreate2(fid, "test_1a", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
@@ -177,7 +177,7 @@ test_misc(hid_t fapl, hbool_t new_format)
*-------------------------------------------------------------------------
*/
static int
-test_long(hid_t fapl, hbool_t new_format)
+test_long(hid_t fcpl, hid_t fapl, hbool_t new_format)
{
hid_t fid = (-1); /* File ID */
hid_t g1 = (-1), g2 = (-1);
@@ -192,7 +192,7 @@ test_long(hid_t fapl, hbool_t new_format)
/* Create file */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0) TEST_ERROR
/* Group names */
name1 = (char *)HDmalloc((size_t)LONG_NAME_LEN);
@@ -252,7 +252,7 @@ error:
*-------------------------------------------------------------------------
*/
static int
-test_large(hid_t fapl, hbool_t new_format)
+test_large(hid_t fcpl, hid_t fapl, hbool_t new_format)
{
hid_t fid = (-1); /* File ID */
hid_t cwg = (-1), dir = (-1); /* Group IDs */
@@ -267,7 +267,7 @@ test_large(hid_t fapl, hbool_t new_format)
/* Create file */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0) TEST_ERROR
/*
* Create a directory that has so many entries that the root
@@ -318,7 +318,7 @@ test_large(hid_t fapl, hbool_t new_format)
*-------------------------------------------------------------------------
*/
static int
-lifecycle(hid_t fapl2)
+lifecycle(hid_t fcpl, hid_t fapl2)
{
hid_t fid = (-1); /* File ID */
hid_t gid = (-1); /* Group ID */
@@ -341,7 +341,7 @@ lifecycle(hid_t fapl2)
/* Create file */
h5_fixname(FILENAME[0], fapl2, filename, sizeof(filename));
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl2)) < 0) TEST_ERROR
+ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl2)) < 0) TEST_ERROR
/* Close file */
if(H5Fclose(fid) < 0) TEST_ERROR
@@ -532,7 +532,7 @@ error:
*-------------------------------------------------------------------------
*/
static int
-long_compact(hid_t fapl2)
+long_compact(hid_t fcpl, hid_t fapl2)
{
hid_t fid = (-1); /* File ID */
hid_t gid = (-1); /* Group ID */
@@ -546,7 +546,7 @@ long_compact(hid_t fapl2)
/* Create file */
h5_fixname(FILENAME[0], fapl2, filename, sizeof(filename));
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl2)) < 0) TEST_ERROR
+ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl2)) < 0) TEST_ERROR
/* Close file */
if(H5Fclose(fid) < 0) TEST_ERROR
@@ -755,7 +755,7 @@ error:
*-------------------------------------------------------------------------
*/
static int
-no_compact(hid_t fapl2)
+no_compact(hid_t fcpl, hid_t fapl2)
{
hid_t fid = (-1); /* File ID */
hid_t gid = (-1); /* Group ID */
@@ -772,7 +772,7 @@ no_compact(hid_t fapl2)
/* Create file */
h5_fixname(FILENAME[0], fapl2, filename, sizeof(filename));
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl2)) < 0) TEST_ERROR
+ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl2)) < 0) TEST_ERROR
/* Close file */
if(H5Fclose(fid) < 0) TEST_ERROR
@@ -1165,9 +1165,20 @@ error:
int
main(void)
{
- hid_t fapl, fapl2; /* File access property list IDs */
- unsigned new_format; /* Whether to use the new format or not */
- int nerrors = 0;
+ hid_t fapl, fapl2; /* File access property list IDs */
+ hid_t fcpl, fcpl2; /* File creation property list ID */
+ unsigned new_format; /* Whether to use the new format or not */
+ const char *env_h5_drvr; /* File Driver value from environment */
+ hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */
+ int nerrors = 0;
+
+ /* Get the VFD to use */
+ env_h5_drvr = HDgetenv("HDF5_DRIVER");
+ if(env_h5_drvr == NULL)
+ env_h5_drvr = "nomatch";
+
+ /* VFD that does not support contigous address space */
+ contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi"));
/* Reset library */
h5_reset();
@@ -1179,20 +1190,42 @@ main(void)
/* 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
+ /* Set up file creation property list */
+ if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) TEST_ERROR
+ if((fcpl2 = H5Pcopy(fcpl)) < 0) TEST_ERROR
+
+ /* Set to use paged aggregation strategy and persisting free-space */
+ /* Skip testing for multi/split drivers */
+ if(H5Pset_file_space_strategy(fcpl2, H5F_FSPACE_STRATEGY_PAGE, 1, (hsize_t)1) < 0)
+ TEST_ERROR
+
/* Loop over using new group format */
for(new_format = FALSE; new_format <= TRUE; new_format++) {
+ hid_t my_fapl = fapl;
+ hid_t my_fcpl = fcpl;
+
+ if(!contig_addr_vfd)
+ continue;
+
+ if(new_format) {
+ my_fapl = fapl2;
+ my_fcpl = fcpl2; /* Set to use paged aggregation and persisting free-space */
+ }
+
/* Perform basic tests, with old & new style groups */
- nerrors += test_misc((new_format ? fapl2 : fapl), new_format);
- nerrors += test_long((new_format ? fapl2 : fapl), new_format);
- nerrors += test_large((new_format ? fapl2 : fapl), new_format);
+ nerrors += test_misc(my_fcpl, my_fapl, new_format);
+ nerrors += test_long(my_fcpl, my_fapl, new_format);
+ nerrors += test_large(my_fcpl, my_fapl, new_format);
} /* end for */
/* New format group specific tests (require new format features) */
- nerrors += lifecycle(fapl2);
- nerrors += long_compact(fapl2);
- nerrors += read_old();
- nerrors += no_compact(fapl2);
- nerrors += gcpl_on_root(fapl2);
+ if(contig_addr_vfd) {
+ nerrors += lifecycle(fcpl2, fapl2);
+ nerrors += long_compact(fcpl2, fapl2);
+ nerrors += read_old();
+ nerrors += no_compact(fcpl2, fapl2);
+ nerrors += gcpl_on_root(fapl2);
+ }
/* Old group API specific tests */
nerrors += old_api(fapl);
@@ -1200,6 +1233,8 @@ main(void)
/* Close 2nd FAPL */
H5Pclose(fapl2);
+ H5Pclose(fcpl);
+ H5Pclose(fcpl2);
/* Verify symbol table messages are cached */
nerrors += (h5_verify_cached_stabs(FILENAME, fapl) < 0 ? 1 : 0);
diff --git a/test/testfiles/plist_files/def_fcpl_32be b/test/testfiles/plist_files/def_fcpl_32be
index 38dec23..9a67dd5 100644
--- a/test/testfiles/plist_files/def_fcpl_32be
+++ b/test/testfiles/plist_files/def_fcpl_32be
Binary files differ
diff --git a/test/testfiles/plist_files/def_fcpl_32le b/test/testfiles/plist_files/def_fcpl_32le
index 38dec23..9a67dd5 100644
--- a/test/testfiles/plist_files/def_fcpl_32le
+++ b/test/testfiles/plist_files/def_fcpl_32le
Binary files differ
diff --git a/test/testfiles/plist_files/def_fcpl_64be b/test/testfiles/plist_files/def_fcpl_64be
index 38dec23..9a67dd5 100644
--- a/test/testfiles/plist_files/def_fcpl_64be
+++ b/test/testfiles/plist_files/def_fcpl_64be
Binary files differ
diff --git a/test/testfiles/plist_files/def_fcpl_64le b/test/testfiles/plist_files/def_fcpl_64le
index 38dec23..9a67dd5 100644
--- a/test/testfiles/plist_files/def_fcpl_64le
+++ b/test/testfiles/plist_files/def_fcpl_64le
Binary files differ
diff --git a/test/testfiles/plist_files/fcpl_32be b/test/testfiles/plist_files/fcpl_32be
index 3ce8bf4..4a8ac8a 100644
--- a/test/testfiles/plist_files/fcpl_32be
+++ b/test/testfiles/plist_files/fcpl_32be
Binary files differ
diff --git a/test/testfiles/plist_files/fcpl_32le b/test/testfiles/plist_files/fcpl_32le
index 3ce8bf4..4a8ac8a 100644
--- a/test/testfiles/plist_files/fcpl_32le
+++ b/test/testfiles/plist_files/fcpl_32le
Binary files differ
diff --git a/test/testfiles/plist_files/fcpl_64be b/test/testfiles/plist_files/fcpl_64be
index 3ce8bf4..4a8ac8a 100644
--- a/test/testfiles/plist_files/fcpl_64be
+++ b/test/testfiles/plist_files/fcpl_64be
Binary files differ
diff --git a/test/testfiles/plist_files/fcpl_64le b/test/testfiles/plist_files/fcpl_64le
index 3ce8bf4..4a8ac8a 100644
--- a/test/testfiles/plist_files/fcpl_64le
+++ b/test/testfiles/plist_files/fcpl_64le
Binary files differ
diff --git a/test/tfile.c b/test/tfile.c
index 6987493..295a29c 100644
--- a/test/tfile.c
+++ b/test/tfile.c
@@ -104,13 +104,13 @@
/* Declarations for test_filespace_*() */
#define FILENAME_LEN 1024 /* length of file name */
-#define CORE_INCREMENT 1024 /* core file */
-#define FAMILY_SIZE 1024 /* family file */
#define DSETNAME "dset" /* Name of dataset */
#define NELMTS(X) (sizeof(X)/sizeof(X[0])) /* # of elements */
#define READ_OLD_BUFSIZE 1024 /* Buffer for holding file data */
#define FILE5 "tfile5.h5" /* Test file */
#define TEST_THRESHOLD10 10 /* Free space section threshold */
+#define FSP_SIZE_DEF 4096 /* File space page size default */
+#define FSP_SIZE512 512 /* File space page size */
/* Declaration for test_libver_macros2() */
#define FILE6 "tfile6.h5" /* Test file */
@@ -125,17 +125,30 @@ const char *OLD_FILENAME[] = {
"filespace_1_6.h5", /* 1.6 HDF5 file */
"filespace_1_8.h5" /* 1.8 HDF5 file */
};
-const char *FILESPACE_NAME[] = {
- "tfilespace",
- NULL
+
+/* Files created in 1.10.0 release --used in test_filespace_1.10.0_compatible() */
+/* These files are copied from release 1.10.0 tools/h5format_convert/testfiles */
+const char *OLD_1_10_0_FILENAME[] = {
+ "h5fc_ext1_i.h5", /* 0 */
+ "h5fc_ext1_f.h5", /* 1 */
+ "h5fc_ext2_if.h5", /* 2 */
+ "h5fc_ext2_sf.h5", /* 3 */
+ "h5fc_ext3_isf.h5", /* 4 */
+ "h5fc_ext_none.h5" /* 5 */
+};
+
+/* Files used in test_filespace_round_compatible() */
+const char *FSPACE_FILENAMES[] = {
+ "fsm_aggr_nopersist.h5", /* H5F_FILE_SPACE_AGGR, not persisting free-space */
+ "fsm_aggr_persist.h5", /* H5F_FILE_SPACE_AGGR, persisting free-space */
+ "paged_nopersist.h5", /* H5F_FILE_SPACE_PAGE, not persisting free-space */
+ "paged_persist.h5", /* H5F_FILE_SPACE_PAGE, persisting free-space */
+ "aggr.h5", /* H5F_FILE_SPACE_AGGR */
+ "none.h5" /* H5F_FILE_SPACE_NONE */
};
-const char *FILENAME[] = {
- "sec2_tfile",
- "split_tfile",
- "stdio_tfile",
- "core_tfile",
- "family_tfile",
+const char *FILESPACE_NAME[] = {
+ "tfilespace",
NULL
};
@@ -1538,112 +1551,7 @@ test_file_perm2(void)
CHECK(ret, FAIL, "H5Sclose");
} /* end test_file_perm2() */
-/****************************************************************
-**
-** test_file_freespace(): low-level file test routine.
-** This test checks the free space available in a file in various
-** situations.
-**
-** Modifications:
-** Vailin Choi; July 2012
-** Remove datasets in reverse order so that all file spaces are shrunk.
-** (A change due to H5FD_FLMAP_DICHOTOMY.)
-**
-*****************************************************************/
-static void
-test_file_freespace(void)
-{
- hid_t file; /* File opened with read-write permission */
- h5_stat_size_t empty_filesize; /* Size of file when empty */
- h5_stat_size_t mod_filesize; /* Size of file after being modified */
- hssize_t free_space; /* Amount of free space in file */
- hid_t dspace; /* Dataspace ID */
- hid_t dset; /* Dataset ID */
- hid_t dcpl; /* Dataset creation property list */
- int k; /* Local index variable */
- unsigned u; /* Local index variable */
- char name[32]; /* Dataset name */
- herr_t ret;
-
- /* Output message about test being performed */
- MESSAGE(5, ("Testing Low-Level File Free Space\n"));
-
- /* Create an "empty" file */
- file = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- CHECK(file, FAIL, "H5Fcreate");
-
- ret = H5Fclose(file);
- CHECK_I(ret, "H5Fclose");
-
- /* Get the "empty" file size */
- empty_filesize = h5_get_file_size(FILE1, H5P_DEFAULT);
-
- /* Re-open the file (with read-write permission) */
- file = H5Fopen(FILE1, H5F_ACC_RDWR, H5P_DEFAULT);
- CHECK_I(file, "H5Fopen");
-
- /* Check that the free space is 0 */
- free_space = H5Fget_freespace(file);
- CHECK(free_space, FAIL, "H5Fget_freespace");
- VERIFY(free_space, 0, "H5Fget_freespace");
-
- /* Create dataspace for datasets */
- dspace = H5Screate(H5S_SCALAR);
- CHECK(dspace, FAIL, "H5Screate");
-
- /* Create a dataset creation property list */
- dcpl = H5Pcreate(H5P_DATASET_CREATE);
- CHECK(dcpl, FAIL, "H5Pcreate");
-
- /* Set the space allocation time to early */
- ret = H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_EARLY);
- CHECK(ret, FAIL, "H5Pset_alloc_time");
-
- /* Create datasets in file */
- for(u = 0; u < 10; u++) {
- sprintf(name, "Dataset %u", u);
- dset = H5Dcreate2(file, name, H5T_STD_U32LE, dspace, H5P_DEFAULT, dcpl, H5P_DEFAULT);
- CHECK(dset, FAIL, "H5Dcreate2");
-
- ret = H5Dclose(dset);
- CHECK(ret, FAIL, "H5Dclose");
- } /* end for */
-
- /* Close dataspace */
- ret = H5Sclose(dspace);
- CHECK(ret, FAIL, "H5Sclose");
-
- /* Close dataset creation property list */
- ret = H5Pclose(dcpl);
- CHECK(ret, FAIL, "H5Pclose");
-
- /* Check that there is the right amount of free space in the file */
- free_space = H5Fget_freespace(file);
- CHECK(free_space, FAIL, "H5Fget_freespace");
- VERIFY(free_space, 2360, "H5Fget_freespace");
- /* Delete datasets in file */
- for(k = 9; k >= 0; k--) {
- sprintf(name, "Dataset %u", (unsigned)k);
- ret = H5Ldelete(file, name, H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Ldelete");
- } /* end for */
-
- /* Check that there is the right amount of free space in the file */
- free_space = H5Fget_freespace(file);
- CHECK(free_space, FAIL, "H5Fget_freespace");
- VERIFY(free_space, 0, "H5Fget_freespace");
-
- /* Close file */
- ret = H5Fclose(file);
- CHECK(ret, FAIL, "H5Fclose");
-
- /* Get the file size after modifications*/
- mod_filesize = h5_get_file_size(FILE1, H5P_DEFAULT);
-
- /* Check that the file reverted to empty size */
- VERIFY(mod_filesize, empty_filesize, "H5Fget_freespace");
-} /* end test_file_freespace() */
/****************************************************************
**
@@ -3185,419 +3093,1227 @@ test_userblock_alignment(void)
/****************************************************************
**
-** test_free_sections():
-** This routine does the actual work of checking information for
-** free space sections available in a file in various situations.
+** test_userblock_alignment_paged(): low-level file test routine.
+** This test checks to ensure that files with both a userblock and
+** alignment interact properly:
+** -- alignment via H5Pset_alignment
+** -- alignment via paged aggregation
+**
+** Programmer: Vailin Choi; March 2013
**
*****************************************************************/
static void
-test_free_sections(hid_t fapl, char *fname)
+test_userblock_alignment_paged(void)
{
- hid_t file; /* File ID */
- hid_t fcpl; /* File creation property list template */
- hssize_t free_space; /* Amount of free space in file */
- hid_t dspace; /* Dataspace ID */
- hid_t dset; /* Dataset ID */
- hid_t dcpl; /* Dataset creation property list */
- unsigned u; /* Local index variable */
- char name[32]; /* Dataset name */
- hssize_t nsects; /* # of free-space sections */
- hssize_t saved_nsects; /* saved copy for the # of free-space sections */
- int i; /* local index variable */
- hsize_t total; /* sum of the free-space section sizes */
- hsize_t last_size; /* size of last free-space section */
- H5F_sect_info_t *sect_info; /* array to hold the free-space information */
- H5F_sect_info_t *saved_sect_info; /* array to hold the free-space information */
- herr_t ret; /* return value */
-
- /* Create file-creation template */
+ hid_t fid; /* File ID */
+ hid_t fcpl; /* File creation property list ID */
+ hid_t fapl; /* File access property list ID */
+ herr_t ret; /* Generic return value */
+
+ /* Output message about test being performed */
+ MESSAGE(5, ("Testing interaction between userblock and alignment (via paged aggregation and H5Pset_alignment)\n"));
+
+ /*
+ * Case 1:
+ * Userblock size = 0
+ * Alignment in use = 4096
+ * Strategy = H5F_FILE_SPACE_PAGE; fsp_size = alignment = 4096
+ * Outcome:
+ * Should succeed:
+ * userblock is 0 and alignment != 0
+ */
+ /* Create file creation property list with user block */
fcpl = H5Pcreate(H5P_FILE_CREATE);
CHECK(fcpl, FAIL, "H5Pcreate");
+ ret = H5Pset_userblock(fcpl, (hsize_t)0);
+ CHECK(ret, FAIL, "H5Pset_userblock");
- /* Set file space strategy and free space section threshold */
- ret = H5Pset_file_space(fcpl, H5F_FILE_SPACE_ALL_PERSIST, (hsize_t)0);
- CHECK(ret, FAIL, "H5Pget_file_space");
+ /* Create file access property list */
+ fapl = H5Pcreate(H5P_FILE_ACCESS);
+ CHECK(fapl, FAIL, "H5Pcreate");
- /* Create the file */
- file = H5Fcreate(fname, H5F_ACC_TRUNC, fcpl, fapl);
- CHECK(file, FAIL, "H5Fcreate");
+ /* Set the "use the latest version of the format" bounds */
+ ret = H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST);
+ CHECK(ret, FAIL, "H5Pset_libver_bounds");
- /* Close the FCPL */
+ ret = H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, FALSE, (hsize_t)1);
+ CHECK(ret, FAIL, "H5Pset_file_space_strategy");
+
+ /* Call helper routines to perform file manipulations */
+ ret = test_userblock_alignment_helper1(fcpl, fapl);
+ CHECK(ret, FAIL, "test_userblock_alignment_helper1");
+ ret = test_userblock_alignment_helper2(fapl, TRUE);
+ CHECK(ret, FAIL, "test_userblock_alignment_helper2");
+
+ /* Release property lists */
ret = H5Pclose(fcpl);
CHECK(ret, FAIL, "H5Pclose");
+ ret = H5Pclose(fapl);
+ CHECK(ret, FAIL, "H5Pclose");
- /* Create dataspace for datasets */
- dspace = H5Screate(H5S_SCALAR);
- CHECK(dspace, FAIL, "H5Screate");
+ /*
+ * Case 2a:
+ * Userblock size = 1024
+ * Alignment in use = 512
+ * Strategy = H5F_FILE_SPACE_PAGE; fsp_size = alignment = 512
+ * H5Pset_alignment() is 3
+ * Outcome:
+ * Should succeed:
+ * userblock (1024) is integral mult. of alignment (512)
+ */
+ /* Create file creation property list with user block */
+ fcpl = H5Pcreate(H5P_FILE_CREATE);
+ CHECK(fcpl, FAIL, "H5Pcreate");
+ ret = H5Pset_userblock(fcpl, (hsize_t)1024);
+ CHECK(ret, FAIL, "H5Pset_userblock");
+ ret = H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, FALSE, (hsize_t)1);
+ ret = H5Pset_file_space_page_size(fcpl, (hsize_t)512);
- /* Create a dataset creation property list */
- dcpl = H5Pcreate(H5P_DATASET_CREATE);
- CHECK(dcpl, FAIL, "H5Pcreate");
+ /* Create file access property list */
+ fapl = H5Pcreate(H5P_FILE_ACCESS);
+ CHECK(fapl, FAIL, "H5Pcreate");
+ ret = H5Pset_alignment(fapl, (hsize_t)1, (hsize_t)3);
+ CHECK(ret, FAIL, "H5Pset_alignment");
+
+ /* Call helper routines to perform file manipulations */
+ ret = test_userblock_alignment_helper1(fcpl, fapl);
+ CHECK(ret, FAIL, "test_userblock_alignment_helper1");
+ ret = test_userblock_alignment_helper2(fapl, TRUE);
+ CHECK(ret, FAIL, "test_userblock_alignment_helper2");
- /* Set the space allocation time to early */
- ret = H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_EARLY);
- CHECK(ret, FAIL, "H5Pset_alloc_time");
+ /* Release property lists */
+ ret = H5Pclose(fcpl);
+ CHECK(ret, FAIL, "H5Pclose");
+ ret = H5Pclose(fapl);
+ CHECK(ret, FAIL, "H5Pclose");
- /* Create datasets in file */
- for(u = 0; u < 10; u++) {
- sprintf(name, "Dataset %u", u);
- dset = H5Dcreate2(file, name, H5T_STD_U32LE, dspace, H5P_DEFAULT, dcpl, H5P_DEFAULT);
- CHECK(dset, FAIL, "H5Dcreate2");
+ /*
+ * Case 2b:
+ * Userblock size = 1024
+ * Alignment in use = 3
+ * Strategy = H5F_FILE_SPACE_AGGR; fsp_size = 512
+ * (via default file creation property)
+ * H5Pset_alignment() is 3
+ * Outcome:
+ * Should fail at file creation:
+ * userblock (1024) is non-integral mult. of alignment (3)
+ */
+ /* Create file creation property list with user block */
+ fcpl = H5Pcreate(H5P_FILE_CREATE);
+ CHECK(fcpl, FAIL, "H5Pcreate");
+ ret = H5Pset_userblock(fcpl, (hsize_t)1024);
+ CHECK(ret, FAIL, "H5Pset_userblock");
+ ret = H5Pset_file_space_page_size(fcpl, (hsize_t)512);
- ret = H5Dclose(dset);
- CHECK(ret, FAIL, "H5Dclose");
- } /* end for */
+ /* Create file access property list */
+ fapl = H5Pcreate(H5P_FILE_ACCESS);
+ CHECK(fapl, FAIL, "H5Pcreate");
+ ret = H5Pset_alignment(fapl, (hsize_t)1, (hsize_t)3);
+ CHECK(ret, FAIL, "H5Pset_alignment");
- /* Close dataspace */
- ret = H5Sclose(dspace);
- CHECK(ret, FAIL, "H5Sclose");
+ /* Create a file with FAPL & FCPL */
+ H5E_BEGIN_TRY {
+ fid = H5Fcreate(FILE1, H5F_ACC_TRUNC, fcpl, fapl);
+ } H5E_END_TRY;
+ VERIFY(fid, FAIL, "H5Fcreate");
- /* Close dataset creation property list */
- ret = H5Pclose(dcpl);
+ /* Release property lists */
+ ret = H5Pclose(fcpl);
+ CHECK(ret, FAIL, "H5Pclose");
+ ret = H5Pclose(fapl);
CHECK(ret, FAIL, "H5Pclose");
- /* Delete odd-numbered datasets in file */
- for(u = 0; u < 10; u++) {
- sprintf(name, "Dataset %u", u);
- if(u % 2) {
- ret = H5Ldelete(file, name, H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Ldelete");
- } /* end if */
- } /* end for */
+ /*
+ * Case 3a:
+ * Userblock size = 512
+ * Alignment in use = 512
+ * Strategy is H5F_FILE_SPACE_PAGE; fsp_size = alignment = 512
+ * H5Pset_alignment() is 3
+ * Outcome:
+ * Should succeed:
+ * userblock (512) is equal to alignment (512)
+ */
+ /* Create file creation property list with user block */
+ fcpl = H5Pcreate(H5P_FILE_CREATE);
+ CHECK(fcpl, FAIL, "H5Pcreate");
+ ret = H5Pset_userblock(fcpl, (hsize_t)512);
+ CHECK(ret, FAIL, "H5Pset_userblock");
+ ret = H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, TRUE, (hsize_t)1);
+ CHECK(ret, FAIL, "H5Pset_file_space_strategy");
+ ret = H5Pset_file_space_page_size(fcpl, (hsize_t)512);
+ CHECK(ret, FAIL, "H5Pset_file_space_page_size");
- /* Close file */
- ret = H5Fclose(file);
- CHECK(ret, FAIL, "H5Fclose");
+ /* Create file access property list with alignment */
+ fapl = H5Pcreate(H5P_FILE_ACCESS);
+ CHECK(fapl, FAIL, "H5Pcreate");
+ ret = H5Pset_alignment(fapl, (hsize_t)1, (hsize_t)3);
+ CHECK(ret, FAIL, "H5Pset_alignment");
- /* Re-open the file with read-only permission */
- file = H5Fopen(fname, H5F_ACC_RDONLY, fapl);
- CHECK_I(file, "H5Fopen");
-
- /* Get the amount of free space in the file */
- free_space = H5Fget_freespace(file);
- CHECK(free_space, FAIL, "H5Fget_freespace");
-
- /* Get the # of free-space sections in the file */
- saved_nsects = H5Fget_free_sections(file, H5FD_MEM_DEFAULT, (size_t)0, NULL);
- CHECK(saved_nsects, FAIL, "H5Fget_free_sections");
-
- /* Allocate storage for the free space section information */
- saved_sect_info = (H5F_sect_info_t *)HDcalloc((size_t)saved_nsects, sizeof(H5F_sect_info_t));
- CHECK(saved_sect_info, NULL, "HDcalloc");
-
- /* Should return failure when nsects is 0 with a nonnull sect_info */
- nsects = H5Fget_free_sections(file, H5FD_MEM_DEFAULT, (size_t)0, saved_sect_info);
- VERIFY(nsects, FAIL, "H5Fget_free_sections");
-
- /* Verify the correct # of free-space sections */
- nsects = H5Fget_free_sections(file, H5FD_MEM_DEFAULT, (size_t)saved_nsects, saved_sect_info);
- VERIFY(nsects, saved_nsects, "H5Fget_free_sections");
-
- /* Verify the amount of free-space is correct */
- total = 0;
- for(i = 0; i < nsects; i++)
- total += saved_sect_info[i].size;
- VERIFY(free_space, total, "H5Fget_free_sections");
-
- /* save the last section's size */
- last_size = saved_sect_info[nsects-1].size;
-
- /* Allocate storage for -1 free space section information */
- sect_info = (H5F_sect_info_t *)HDcalloc((size_t)(saved_nsects - 1), sizeof(H5F_sect_info_t));
- CHECK(sect_info, NULL, "HDcalloc");
-
- /* Retrieve free space info for -1 sections */
- nsects = H5Fget_free_sections(file, H5FD_MEM_DEFAULT, (size_t)(saved_nsects - 1), sect_info);
- VERIFY(nsects, saved_nsects, "H5Fget_free_sections");
-
- /* Verify the amount of free-space is correct */
- total = 0;
- for(i = 0; i < (saved_nsects - 1); i++) {
- VERIFY(sect_info[i].addr, saved_sect_info[i].addr, "H5Fget_free_sections");
- VERIFY(sect_info[i].size, saved_sect_info[i].size, "H5Fget_free_sections");
- total += sect_info[i].size;
- }
+ /* Call helper routines to perform file manipulations */
+ ret = test_userblock_alignment_helper1(fcpl, fapl);
+ CHECK(ret, FAIL, "test_userblock_alignment_helper1");
+ ret = test_userblock_alignment_helper2(fapl, TRUE);
+ CHECK(ret, FAIL, "test_userblock_alignment_helper2");
- VERIFY(((hsize_t)free_space - last_size), total, "H5Fget_free_sections");
- HDfree(sect_info);
+ /* Release property lists */
+ ret = H5Pclose(fcpl);
+ CHECK(ret, FAIL, "H5Pclose");
+ ret = H5Pclose(fapl);
+ CHECK(ret, FAIL, "H5Pclose");
- /* Allocate storage for +1 free space section information */
- sect_info = (H5F_sect_info_t *)HDcalloc((size_t)(saved_nsects + 1), sizeof(H5F_sect_info_t));
- CHECK(sect_info, NULL, "HDcalloc");
+ /*
+ * Case 3b:
+ * Userblock size = 512
+ * Alignment in use = 3
+ * Strategy is H5F_FILE_SPACE_NONE; fsp_size = 512
+ * H5Pset_alignment() is 3
+ * Outcome:
+ * Should fail at file creation:
+ * userblock (512) is non-integral mult. of alignment (3)
+ */
+ /* Create file creation property list with user block */
+ fcpl = H5Pcreate(H5P_FILE_CREATE);
+ CHECK(fcpl, FAIL, "H5Pcreate");
+ ret = H5Pset_userblock(fcpl, (hsize_t)512);
+ CHECK(ret, FAIL, "H5Pset_userblock");
+ ret = H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_NONE, FALSE, (hsize_t)1);
+ CHECK(ret, FAIL, "H5Pset_file_space_strategy");
+ ret = H5Pset_file_space_page_size(fcpl, (hsize_t)512);
+ CHECK(ret, FAIL, "H5Pset_file_space_page_size");
- /* Retrieve free-space info for +1 sections */
- nsects = H5Fget_free_sections(file, H5FD_MEM_DEFAULT, (size_t)(saved_nsects + 1), sect_info);
- VERIFY(nsects, saved_nsects, "H5Fget_free_sections");
+ /* Create file access property list with alignment */
+ fapl = H5Pcreate(H5P_FILE_ACCESS);
+ CHECK(fapl, FAIL, "H5Pcreate");
+ ret = H5Pset_alignment(fapl, (hsize_t)1, (hsize_t)3);
+ CHECK(ret, FAIL, "H5Pset_alignment");
- /* Verify free-space info is correct */
- total = 0;
- for(i = 0; i < nsects; i++) {
- VERIFY(sect_info[i].addr, saved_sect_info[i].addr, "H5Fget_free_sections");
- VERIFY(sect_info[i].size, saved_sect_info[i].size, "H5Fget_free_sections");
- total += sect_info[i].size;
- }
+ /* Create a file with FAPL & FCPL */
+ H5E_BEGIN_TRY {
+ fid = H5Fcreate(FILE1, H5F_ACC_TRUNC, fcpl, fapl);
+ } H5E_END_TRY;
+ VERIFY(fid, FAIL, "H5Fcreate");
- VERIFY(sect_info[nsects].addr, 0, "H5Fget_free_sections");
- VERIFY(sect_info[nsects].size, 0, "H5Fget_free_sections");
- VERIFY(free_space, total, "H5Fget_free_sections");
- HDfree(sect_info);
+ /* Release property lists */
+ ret = H5Pclose(fcpl);
+ CHECK(ret, FAIL, "H5Pclose");
+ ret = H5Pclose(fapl);
+ CHECK(ret, FAIL, "H5Pclose");
- /* Verify that there is no free-space section for this type */
- nsects = H5Fget_free_sections(file, H5FD_MEM_BTREE, (size_t)0, NULL);
- VERIFY(nsects, 0, "H5Fget_free_sections");
+ /*
+ * Case 4a:
+ * Userblock size = 1024
+ * Alignment in use = 1023
+ * Strategy is H5F_FILE_SPACE_PAGE; fsp_size = alignment = 1023
+ * H5Pset_alignment() is 16
+ * Outcome:
+ * Should fail at file creation:
+ * userblock (1024) is non-integral multiple of alignment (1023)
+ */
+ /* Create file creation property list with user block */
+ fcpl = H5Pcreate(H5P_FILE_CREATE);
+ CHECK(fcpl, FAIL, "H5Pcreate");
+ ret = H5Pset_userblock(fcpl, (hsize_t)1024);
+ CHECK(ret, FAIL, "H5Pset_userblock");
+ ret = H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, TRUE, (hsize_t)1);
+ CHECK(ret, FAIL, "H5Pset_file_space_strategy");
+ ret = H5Pset_file_space_page_size(fcpl, (hsize_t)1023);
+ CHECK(ret, FAIL, "H5Pset_file_space_page_size");
- /* Close file */
- ret = H5Fclose(file);
- CHECK(ret, FAIL, "H5Fclose");
+ /* Create file access property list with alignment */
+ fapl = H5Pcreate(H5P_FILE_ACCESS);
+ CHECK(fapl, FAIL, "H5Pcreate");
+ ret = H5Pset_alignment(fapl, (hsize_t)1, (hsize_t)16);
+ CHECK(ret, FAIL, "H5Pset_alignment");
- HDfree(saved_sect_info);
+ /* Create a file with FAPL & FCPL */
+ H5E_BEGIN_TRY {
+ fid = H5Fcreate(FILE1, H5F_ACC_TRUNC, fcpl, fapl);
+ } H5E_END_TRY;
+ VERIFY(fid, FAIL, "H5Fcreate");
-} /* end test_free_sections() */
+ /* Release property lists */
+ ret = H5Pclose(fcpl);
+ CHECK(ret, FAIL, "H5Pclose");
+ ret = H5Pclose(fapl);
+ CHECK(ret, FAIL, "H5Pclose");
+
+ /*
+ * Case 4b:
+ * Userblock size = 1024
+ * Alignment in use = 16
+ * Strategy is H5F_FILE_SPACE_FSM_AGGR; fsp_size = 1023
+ * H5Pset_alignment() is 16
+ * Outcome:
+ * Should succeed:
+ * userblock (512) is integral multiple of alignment (16)
+ */
+ /* Create file creation property list with user block */
+ fcpl = H5Pcreate(H5P_FILE_CREATE);
+ CHECK(fcpl, FAIL, "H5Pcreate");
+ ret = H5Pset_userblock(fcpl, (hsize_t)1024);
+ CHECK(ret, FAIL, "H5Pset_userblock");
+ ret = H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_FSM_AGGR, FALSE, (hsize_t)1);
+ CHECK(ret, FAIL, "H5Pset_file_space_strategy");
+ ret = H5Pset_file_space_page_size(fcpl, (hsize_t)1023);
+ CHECK(ret, FAIL, "H5Pset_file_space_page_size");
+
+ /* Create file access property list with alignment */
+ fapl = H5Pcreate(H5P_FILE_ACCESS);
+ CHECK(fapl, FAIL, "H5Pcreate");
+ ret = H5Pset_alignment(fapl, (hsize_t)1, (hsize_t)16);
+ CHECK(ret, FAIL, "H5Pset_alignment");
+
+ /* Call helper routines to perform file manipulations */
+ ret = test_userblock_alignment_helper1(fcpl, fapl);
+ CHECK(ret, FAIL, "test_userblock_alignment_helper1");
+ ret = test_userblock_alignment_helper2(fapl, TRUE);
+ CHECK(ret, FAIL, "test_userblock_alignment_helper2");
+
+ /* Release property lists */
+ ret = H5Pclose(fcpl);
+ CHECK(ret, FAIL, "H5Pclose");
+ ret = H5Pclose(fapl);
+ CHECK(ret, FAIL, "H5Pclose");
+
+ /*
+ * Case 5a:
+ * Userblock size = 512
+ * Alignment in use = 1024
+ * Strategy is H5F_FILE_SPACE_PAGE; fsp_size = alignment = 1024
+ * H5Pset_alignment() is 16
+ * Outcome:
+ * Should fail at file creation:
+ * userblock (512) is less than alignment (1024)
+ */
+ /* Create file creation property list with user block */
+ fcpl = H5Pcreate(H5P_FILE_CREATE);
+ CHECK(fcpl, FAIL, "H5Pcreate");
+ ret = H5Pset_userblock(fcpl, (hsize_t)512);
+ CHECK(ret, FAIL, "H5Pset_userblock");
+ ret = H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, FALSE, (hsize_t)1);
+ CHECK(ret, FAIL, "H5Pset_file_space_strategy");
+ ret = H5Pset_file_space_page_size(fcpl, (hsize_t)1024);
+ CHECK(ret, FAIL, "H5Pset_file_space_page_size");
+
+ /* Create file access property list with alignment */
+ fapl = H5Pcreate(H5P_FILE_ACCESS);
+ CHECK(fapl, FAIL, "H5Pcreate");
+ ret = H5Pset_alignment(fapl, (hsize_t)1, (hsize_t)16);
+ CHECK(ret, FAIL, "H5Pset_alignment");
+
+ /* Create a file with FAPL & FCPL */
+ H5E_BEGIN_TRY {
+ fid = H5Fcreate(FILE1, H5F_ACC_TRUNC, fcpl, fapl);
+ } H5E_END_TRY;
+ VERIFY(fid, FAIL, "H5Fcreate");
+
+ /* Release property lists */
+ ret = H5Pclose(fcpl);
+ CHECK(ret, FAIL, "H5Pclose");
+ ret = H5Pclose(fapl);
+ CHECK(ret, FAIL, "H5Pclose");
+
+ /*
+ * Case 5b:
+ * Userblock size = 512
+ * Alignment in use = 16
+ * Strategy is H5F_FILE_SPACE_NONE; fsp_size = 1024
+ * H5Pset_alignment() is 16
+ * Outcome:
+ * Should succed:
+ * userblock (512) is integral multiple of alignment (16)
+ */
+ /* Create file creation property list with user block */
+ fcpl = H5Pcreate(H5P_FILE_CREATE);
+ CHECK(fcpl, FAIL, "H5Pcreate");
+ ret = H5Pset_userblock(fcpl, (hsize_t)512);
+ CHECK(ret, FAIL, "H5Pset_userblock");
+ ret = H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_NONE, FALSE, (hsize_t)1);
+ CHECK(ret, FAIL, "H5Pset_file_space_strategy");
+ ret = H5Pset_file_space_page_size(fcpl, (hsize_t)1024);
+ CHECK(ret, FAIL, "H5Pset_file_space_page_size");
+
+ /* Create file access property list with alignment */
+ fapl = H5Pcreate(H5P_FILE_ACCESS);
+ CHECK(fapl, FAIL, "H5Pcreate");
+ ret = H5Pset_alignment(fapl, (hsize_t)1, (hsize_t)16);
+ CHECK(ret, FAIL, "H5Pset_alignment");
+
+ /* Call helper routines to perform file manipulations */
+ ret = test_userblock_alignment_helper1(fcpl, fapl);
+ CHECK(ret, FAIL, "test_userblock_alignment_helper1");
+ ret = test_userblock_alignment_helper2(fapl, TRUE);
+ CHECK(ret, FAIL, "test_userblock_alignment_helper2");
+
+ /* Release property lists */
+ ret = H5Pclose(fcpl);
+ CHECK(ret, FAIL, "H5Pclose");
+ ret = H5Pclose(fapl);
+ CHECK(ret, FAIL, "H5Pclose");
+
+ /*
+ * Case 6:
+ * Userblock size = 512
+ * Alignment in use = 512
+ * Strategy is H5F_FILE_SPACE_PAGE; fsp_size = alignment = 512
+ * H5Pset_alignment() is 3
+ * Reopen the file; H5Pset_alignment() is 1024
+ * Outcome:
+ * Should succed:
+ * Userblock (512) is the same as alignment (512);
+ * The H5Pset_alignment() calls have no effect
+ */
+ /* Create file creation property list with user block */
+ fcpl = H5Pcreate(H5P_FILE_CREATE);
+ CHECK(fcpl, FAIL, "H5Pcreate");
+ ret = H5Pset_userblock(fcpl, (hsize_t)512);
+ CHECK(ret, FAIL, "H5Pset_userblock");
+ ret = H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, FALSE, (hsize_t)1);
+ CHECK(ret, FAIL, "H5Pset_file_space_strategy");
+ ret = H5Pset_file_space_page_size(fcpl, (hsize_t)512);
+ CHECK(ret, FAIL, "H5Pset_file_space_page_size");
+
+ /* Create file access property list with alignment */
+ fapl = H5Pcreate(H5P_FILE_ACCESS);
+ CHECK(fapl, FAIL, "H5Pcreate");
+ ret = H5Pset_alignment(fapl, (hsize_t)1, (hsize_t)3);
+ CHECK(ret, FAIL, "H5Pset_alignment");
+
+ /* Call helper routines to perform file manipulations */
+ ret = test_userblock_alignment_helper1(fcpl, fapl);
+ CHECK(ret, FAIL, "test_userblock_alignment_helper1");
+
+ /* Change alignment in FAPL */
+ ret = H5Pset_alignment(fapl, (hsize_t)1, (hsize_t)1024);
+ CHECK(ret, FAIL, "H5Pset_alignment");
+
+ /* Call helper routines to perform file manipulations */
+ ret = test_userblock_alignment_helper2(fapl, FALSE);
+ CHECK(ret, FAIL, "test_userblock_alignment_helper2");
+ ret = test_userblock_alignment_helper2(fapl, TRUE);
+ CHECK(ret, FAIL, "test_userblock_alignment_helper2");
+
+ /* Release property lists */
+ ret = H5Pclose(fcpl);
+ CHECK(ret, FAIL, "H5Pclose");
+ ret = H5Pclose(fapl);
+ CHECK(ret, FAIL, "H5Pclose");
+
+} /* end test_userblock_alignment_paged() */
/****************************************************************
**
-** test_filespace_sects():
-** This test checks free space section info for
-** files created with sec2 and split drivers.
+** test_filespace_info():
+** Verify the following public routines retrieve and set file space
+** information correctly:
+** (1) H5Pget/set_file_space_strategy():
+** Retrieve and set file space strategy, persisting free-space,
+** and free-space section threshold as specified
+** (2) H5Pget/set_file_space_page_size():
+** Retrieve and set the page size for paged aggregation
**
-*****************************************************************/
+****************************************************************/
static void
-test_filespace_sects(void)
+test_filespace_info(const char *env_h5_drvr)
{
- hid_t fapl_sec2; /* File access property id with sec2 driver */
- hid_t fapl_split; /* File access property id with split driver */
- hid_t fapl_core; /* File access property id with core driver */
- hid_t fapl_stdio; /* File access property id with stdio driver */
- hid_t fapl_family; /* File access property id with family driver */
- char filename[FILENAME_LEN]; /* Filename to use */
- herr_t ret; /* Return value */
+ hid_t fid; /* File IDs */
+ hid_t fapl, new_fapl; /* File access property lists */
+ hid_t fcpl, fcpl1, fcpl2; /* File creation property lists */
+ H5F_fspace_strategy_t strategy; /* File space strategy */
+ hbool_t persist; /* Persist free-space or not */
+ hsize_t threshold; /* Free-space section threshold */
+ unsigned new_format; /* New or old format */
+ H5F_fspace_strategy_t fs_strategy; /* File space strategy--iteration variable */
+ unsigned fs_persist; /* Persist free-space or not--iteration variable */
+ hsize_t fs_threshold; /* Free-space section threshold--iteration variable */
+ hsize_t fsp_size; /* File space page size */
+ char filename[FILENAME_LEN]; /* Filename to use */
+ hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */
+ herr_t ret; /* Return value */
- /* SEC2 */
- MESSAGE(5, ("Testing File free space information for a sec2 file\n"));
+ /* Output message about test being performed */
+ MESSAGE(5, ("Testing file creation public routines: H5Pget/set_file_space_strategy & H5Pget/set_file_space_page_size\n"));
- fapl_sec2 = H5Pcreate(H5P_FILE_ACCESS);
+ contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi"));
- ret = H5Pset_fapl_sec2(fapl_sec2);
- CHECK(ret, FAIL, "H5Pset_fapl_sec2");
+ fapl = h5_fileaccess();
+ h5_fixname(FILESPACE_NAME[0], fapl, filename, sizeof filename);
- /* Set the filename to use for this test (dependent on fapl) */
- h5_fixname(FILENAME[0], fapl_sec2, filename, sizeof(filename));
+ /* Get a copy of the file access property list */
+ new_fapl = H5Pcopy(fapl);
+ CHECK(new_fapl, FAIL, "H5Pcopy");
- /* perform free space information test for file with sec2 driver */
- test_free_sections(fapl_sec2, filename);
+ /* Set the "use the latest version of the format" bounds */
+ ret = H5Pset_libver_bounds(new_fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST);
+ CHECK(ret, FAIL, "H5Pset_libver_bounds");
- /* close fapl_sec2 and remove the file */
- h5_clean_files(FILENAME, fapl_sec2);
+ /*
+ * Case (1)
+ * Check file space information from a default file creation property list.
+ * Values expected:
+ * strategy--H5F_FILE_SPACE_AGGR
+ * persist--FALSE
+ * threshold--1
+ * file space page size--4096
+ */
+ /* Create file creation property list template */
+ fcpl = H5Pcreate(H5P_FILE_CREATE);
+ CHECK(fcpl, FAIL, "H5Pcreate");
+ /* Retrieve file space information */
+ ret = H5Pget_file_space_strategy(fcpl, &strategy, &persist, &threshold);
+ CHECK(ret, FAIL, "H5Pget_file_space_strategy");
- /* SPLIT */
- MESSAGE(5, ("Testing File free space information for a split file\n"));
+ /* Verify file space information */
+ VERIFY(strategy, H5F_FSPACE_STRATEGY_FSM_AGGR, "H5Pget_file_space_strategy");
+ VERIFY(persist, FALSE, "H5Pget_file_space_strategy");
+ VERIFY(threshold, 1, "H5Pget_file_space_strategy");
- fapl_split = H5Pcreate(H5P_FILE_ACCESS);
- CHECK(fapl_split, FAIL, "h5_fileaccess");
+ /* Retrieve file space page size */
+ ret = H5Pget_file_space_page_size(fcpl, &fsp_size);
+ CHECK(ret, FAIL, "H5Pget_file_space_page_size");
+ VERIFY(fsp_size, FSP_SIZE_DEF, "H5Pget_file_space_page_size");
- ret = H5Pset_fapl_split(fapl_split, "-m.h5", H5P_DEFAULT, "-r.h5", H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Pset_fapl_split");
+ /* Close property list */
+ H5Pclose(fcpl);
- /* Set the filename to use for this test (dependent on fapl) */
- h5_fixname(FILENAME[1], fapl_split, filename, sizeof(filename));
+ /*
+ * Case (2)
+ * File space page size has a minimum size of 512.
+ * Setting value less than 512 will return an error;
+ * --setting file space page size to 0
+ * --setting file space page size to 511
+ */
+ /* Create file creation property list template */
+ fcpl = H5Pcreate(H5P_FILE_CREATE);
+ CHECK(fcpl, FAIL, "H5Pcreate");
- /* perform free space information test for file with split driver */
- test_free_sections(fapl_split, filename);
+ /* Setting to 0: should fail */
+ H5E_BEGIN_TRY {
+ ret = H5Pset_file_space_page_size(fcpl, 0);
+ } H5E_END_TRY;
+ VERIFY(ret, FAIL, "H5Pset_file_space_page_size");
- /* close fapl and remove the file */
- h5_clean_files(FILENAME, fapl_split);
+ /* Setting to 511: should fail */
+ H5E_BEGIN_TRY {
+ ret = H5Pset_file_space_page_size(fcpl, 511);
+ } H5E_END_TRY;
+ VERIFY(ret, FAIL, "H5Pset_file_space_page_size");
+ /* Setting to 512: should succeed */
+ ret = H5Pset_file_space_page_size(fcpl, FSP_SIZE512);
+ CHECK(ret, FAIL, "H5Pset_file_space_page_size");
+ ret = H5Pget_file_space_page_size(fcpl, &fsp_size);
+ CHECK(ret, FAIL, "H5Pget_file_space_page_size");
+ VERIFY(fsp_size, FSP_SIZE512, "H5Pget_file_space_page_size");
- /* STDIO */
- MESSAGE(5, ("Testing File free space information for a stdio file\n"));
+ /* Close property list */
+ H5Pclose(fcpl);
- fapl_stdio = H5Pcreate(H5P_FILE_ACCESS);
- CHECK(fapl_stdio, FAIL, "h5_fileaccess");
+ /*
+ * Case (3)
+ * Check file space information when creating a file with default properties.
+ * Values expected:
+ * strategy--H5F_FILE_SPACE_AGGR
+ * persist--FALSE
+ * threshold--1
+ * file space page size--4096
+ */
+ /* Create a file with default file creation and access property lists */
+ fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(fid, FAIL, "H5Fcreate");
- ret = H5Pset_fapl_stdio(fapl_stdio);
- CHECK(ret, FAIL, "H5Pset_fapl_split");
+ /* Get the file's creation property list */
+ fcpl1 = H5Fget_create_plist(fid);
+ CHECK(fcpl1, FAIL, "H5Fget_create_plist");
- /* Set the filename to use for this test (dependent on fapl) */
- h5_fixname(FILENAME[2], fapl_stdio, filename, sizeof(filename));
+ /* Retrieve file space information */
+ ret = H5Pget_file_space_strategy(fcpl1, &strategy, &persist, &threshold);
+ CHECK(ret, FAIL, "H5Pget_file_space_strategy");
- /* perform free space information test for file with stdio driver */
- test_free_sections(fapl_stdio, filename);
+ /* Verify file space information */
+ VERIFY(strategy, H5F_FSPACE_STRATEGY_FSM_AGGR, "H5Pget_file_space_strategy");
+ VERIFY(persist, FALSE, "H5Pget_file_space_strategy");
+ VERIFY(threshold, 1, "H5Pget_file_space_strategy");
- /* close fapl and remove the file */
- h5_clean_files(FILENAME, fapl_stdio);
+ /* Retrieve file space page size */
+ ret = H5Pget_file_space_page_size(fcpl1, &fsp_size);
+ CHECK(ret, FAIL, "H5Pget_file_space_page_size");
+ VERIFY(fsp_size, FSP_SIZE_DEF, "H5Pget_file_space_page_size");
+ /* Close property lists */
+ ret = H5Fclose(fid);
+ CHECK(ret, FAIL, "H5Fclose");
+ ret = H5Pclose(fcpl1);
+ CHECK(ret, FAIL, "H5Pclose");
- /* CORE */
- MESSAGE(5, ("Testing File free space information for a core file\n"));
+ /*
+ * Case (4)
+ * Check file space information when creating a file with the
+ * latest library format and default properties.
+ * Values expected:
+ * strategy--H5F_FILE_SPACE_AGGR
+ * persist--FALSE
+ * threshold--1
+ * file space page size--4096
+ */
+ /* Create a file with the latest library format */
+ fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, new_fapl);
+ CHECK(fid, FAIL, "H5Fcreate");
- fapl_core = H5Pcreate(H5P_FILE_ACCESS);
- CHECK(fapl_core, FAIL, "h5_fileaccess");
+ /* Get the file's creation property */
+ fcpl1 = H5Fget_create_plist(fid);
+ CHECK(fcpl1, FAIL, "H5Fget_create_plist");
- ret = H5Pset_fapl_core(fapl_core, (size_t)CORE_INCREMENT, TRUE);
- CHECK(ret, FAIL, "H5Pset_fapl_core");
+ /* Retrieve file space information */
+ ret = H5Pget_file_space_strategy(fcpl1, &strategy, &persist, &threshold);
+ CHECK(ret, FAIL, "H5Pget_file_space_strategy");
- /* Set the filename to use for this test (dependent on fapl) */
- h5_fixname(FILENAME[3], fapl_core, filename, sizeof(filename));
+ /* Verify file space information */
+ VERIFY(strategy, H5F_FSPACE_STRATEGY_FSM_AGGR, "H5Pget_file_space_strategy");
+ VERIFY(persist, FALSE, "H5Pget_file_space_strategy");
+ VERIFY(threshold, 1, "H5Pget_file_space_strategy");
- /* perform free space information test for file with core driver */
- test_free_sections(fapl_core, filename);
+ /* Retrieve file space page size */
+ ret = H5Pget_file_space_page_size(fcpl1, &fsp_size);
+ CHECK(ret, FAIL, "H5Pget_file_space_page_size");
+ VERIFY(fsp_size, FSP_SIZE_DEF, "H5Pget_file_space_page_size");
- /* close fapl_ and remove the file */
- h5_clean_files(FILENAME, fapl_core);
+ /* Close property lists */
+ ret = H5Fclose(fid);
+ CHECK(ret, FAIL, "H5Fclose");
+ ret = H5Pclose(fcpl1);
+ CHECK(ret, FAIL, "H5Pclose");
+
+ /*
+ * Case (5)
+ * Check file space information with the following combinations:
+ * Create file with --
+ * New or old format
+ * Persist or not persist free-space
+ * Different sizes for free-space section threshold (0 to 10)
+ * The four file space strategies:
+ * H5F_FSPACE_STRATEGY_FSM_AGGR, H5F_FSPACE_STRATEGY_PAGE,
+ * H5F_FSPACE_STRATEGY_AGGR, H5F_FSPACE_STRATEGY_NONE
+ * File space page size: set to 512
+ *
+ */
+ for(new_format = FALSE; new_format <= TRUE; new_format++) {
+ hid_t my_fapl;
+
+ /* Set the FAPL for the type of format */
+ if(new_format) {
+ MESSAGE(5, ("Testing with new group format\n"));
+ my_fapl = new_fapl;
+ } /* end if */
+ else {
+ MESSAGE(5, ("Testing with old group format\n"));
+ my_fapl = fapl;
+ } /* end else */
+
+ /* Test with TRUE or FALSE for persisting free-space */
+ for(fs_persist = FALSE; fs_persist <= TRUE; fs_persist++) {
+
+ /* Test with free-space section threshold size: 0 to 10 */
+ for(fs_threshold = 0; fs_threshold <= TEST_THRESHOLD10; fs_threshold++) {
+
+ /* Test with 4 file space strategies */
+ for(fs_strategy = H5F_FSPACE_STRATEGY_FSM_AGGR; fs_strategy < H5F_FSPACE_STRATEGY_NTYPES; H5_INC_ENUM(H5F_fspace_strategy_t, fs_strategy)) {
+
+ if(!contig_addr_vfd && (fs_strategy == H5F_FSPACE_STRATEGY_PAGE || fs_persist))
+ continue;
+
+ /* Create file creation property list template */
+ fcpl = H5Pcreate(H5P_FILE_CREATE);
+ CHECK(fcpl, FAIL, "H5Pcreate");
+
+ /* Set file space information */
+ ret = H5Pset_file_space_strategy(fcpl, fs_strategy, (hbool_t)fs_persist, fs_threshold);
+ CHECK(ret, FAIL, "H5Pset_file_space_strategy");
+
+ ret = H5Pset_file_space_page_size(fcpl, FSP_SIZE512);
+ CHECK(ret, FAIL, "H5Pset_file_space_strategy");
+
+ /* Retrieve file space information */
+ ret = H5Pget_file_space_strategy(fcpl, &strategy, &persist, &threshold);
+ CHECK(ret, FAIL, "H5Pget_file_space_strategy");
+
+ /* Verify file space information */
+ VERIFY(strategy, fs_strategy, "H5Pget_file_space_strategy");
+
+ if(fs_strategy < H5F_FSPACE_STRATEGY_AGGR) {
+ VERIFY(persist, (hbool_t)fs_persist, "H5Pget_file_space_strategy");
+ VERIFY(threshold, fs_threshold, "H5Pget_file_space_strategy");
+ } else {
+ VERIFY(persist, FALSE, "H5Pget_file_space_strategy");
+ VERIFY(threshold, 1, "H5Pget_file_space_strategy");
+ }
+
+ /* Retrieve and verify file space page size */
+ ret = H5Pget_file_space_page_size(fcpl, &fsp_size);
+ CHECK(ret, FAIL, "H5Pget_file_space_page_size");
+ VERIFY(fsp_size, FSP_SIZE512, "H5Pget_file_space_page_size");
+
+ /* Create the file with the specified file space info */
+ fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, my_fapl);
+ CHECK(fid, FAIL, "H5Fcreate");
+
+ /* Get the file's creation property */
+ fcpl1 = H5Fget_create_plist(fid);
+ CHECK(fcpl1, FAIL, "H5Fget_create_plist");
+
+ /* Retrieve file space information */
+ ret = H5Pget_file_space_strategy(fcpl1, &strategy, &persist, &threshold);
+ CHECK(ret, FAIL, "H5Pget_file_space_strategy");
+
+ /* Verify file space information */
+ VERIFY(strategy, fs_strategy, "H5Pget_file_space_strategy");
+
+ if(fs_strategy < H5F_FSPACE_STRATEGY_AGGR) {
+ VERIFY(persist, fs_persist, "H5Pget_file_space_strategy");
+ VERIFY(threshold, fs_threshold, "H5Pget_file_space_strategy");
+ } else {
+ VERIFY(persist, FALSE, "H5Pget_file_space_strategy");
+ VERIFY(threshold, 1, "H5Pget_file_space_strategy");
+ }
+
+ /* Retrieve and verify file space page size */
+ ret = H5Pget_file_space_page_size(fcpl1, &fsp_size);
+ CHECK(ret, FAIL, "H5Pget_file_space_page_size");
+ VERIFY(fsp_size, FSP_SIZE512, "H5Pget_file_space_page_size");
+
+ /* Close the file */
+ ret = H5Fclose(fid);
+ CHECK(ret, FAIL, "H5Fclose");
+
+ /* Re-open the file */
+ fid = H5Fopen(filename, H5F_ACC_RDWR, my_fapl);
+ CHECK(ret, FAIL, "H5Fopen");
+
+ /* Get the file's creation property */
+ fcpl2 = H5Fget_create_plist(fid);
+ CHECK(fcpl2, FAIL, "H5Fget_create_plist");
+
+ /* Retrieve file space information */
+ ret = H5Pget_file_space_strategy(fcpl2, &strategy, &persist, &threshold);
+ CHECK(ret, FAIL, "H5Pget_file_space_strategy");
+
+ /* Verify file space information */
+ VERIFY(strategy, fs_strategy, "H5Pget_file_space_strategy");
+ if(fs_strategy < H5F_FSPACE_STRATEGY_AGGR) {
+ VERIFY(persist, fs_persist, "H5Pget_file_space_strategy");
+ VERIFY(threshold, fs_threshold, "H5Pget_file_space_strategy");
+ } else {
+ VERIFY(persist, FALSE, "H5Pget_file_space_strategy");
+ VERIFY(threshold, 1, "H5Pget_file_space_strategy");
+ }
+
+ /* Retrieve and verify file space page size */
+ ret = H5Pget_file_space_page_size(fcpl2, &fsp_size);
+ CHECK(ret, FAIL, "H5Pget_file_space_page_size");
+ VERIFY(fsp_size, FSP_SIZE512, "H5Pget_file_space_page_size");
+
+ /* Close the file */
+ ret = H5Fclose(fid);
+ CHECK(ret, FAIL, "H5Fclose");
+
+ /* Release file creation property lists */
+ ret = H5Pclose(fcpl);
+ CHECK(ret, FAIL, "H5Pclose");
+ ret = H5Pclose(fcpl1);
+ CHECK(ret, FAIL, "H5Pclose");
+ ret = H5Pclose(fcpl2);
+ CHECK(ret, FAIL, "H5Pclose");
+ } /* end for file space strategy type */
+ } /* end for free-space section threshold */
+ } /* end for fs_persist */
+
+ /* close fapl_ and remove the file */
+ h5_clean_files(FILESPACE_NAME, my_fapl);
+ } /* end for new_format */
+
+} /* test_filespace_info() */
+
+/****************************************************************
+**
+** set_multi_split():
+** Internal routine to set up page-aligned address space for multi/split driver
+** when testing paged aggregation.
+** This is used by test_file_freespace() and test_sects_freespace().
+**
+*****************************************************************/
+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(split || multi);
+ HDmemset(memb_name, 0, sizeof memb_name);
- /* FAMILY */
- MESSAGE(5, ("Testing File free space information for a family file\n"));
+ /* Get current split settings */
+ if(H5Pget_fapl_multi(fapl, memb_map, memb_fapl_arr, memb_name, memb_addr, &relax) < 0)
+ TEST_ERROR
- fapl_family = H5Pcreate(H5P_FILE_ACCESS);
- CHECK(fapl_family, FAIL, "h5_fileaccess");
+ 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 */
- ret = H5Pset_fapl_family(fapl_family, (hsize_t)FAMILY_SIZE, H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Pset_fapl_family");
+ /* 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
- /* Set the filename to use for this test (dependent on fapl) */
- h5_fixname(FILENAME[4], fapl_family, filename, sizeof(filename));
+ /* Free memb_name */
+ for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, mt))
+ free(memb_name[mt]);
- /* perform free space information test for file with family driver */
- test_free_sections(fapl_family, filename);
+ return 0;
- /* close fapl and remove the file */
- h5_clean_files(FILENAME, fapl_family);
+error:
+ return(-1);
-} /* end test_filespace_sects() */
+} /* set_multi_split() */
/****************************************************************
**
-** test_filespace_info():
-** Verify that the public routines H5Pget/set_file_space()
-** retrieve and set the file space strategy and free space
-** section threshold as specified.
+** test_file_freespace():
+** This routine checks the free space available in a file as
+** returned by the public routine H5Fget_freespace().
**
-****************************************************************/
+** Modifications:
+** Vailin Choi; July 2012
+** Remove datasets in reverse order so that all file spaces are shrunk.
+** (A change due to H5FD_FLMAP_DICHOTOMY.)
+**
+** Vailin Choi; Dec 2012
+** Add changes due to paged aggregation via new format:
+** the amount of freespace is different.
+**
+*****************************************************************/
static void
-test_filespace_info(void)
+test_file_freespace(const char *env_h5_drvr)
{
- hid_t fid1, fid2; /* HDF5 File IDs */
- hid_t fapl, new_fapl; /* File access property */
- hid_t fcpl, fcpl1, fcpl2; /* File creation property */
- char filename[FILENAME_LEN]; /* Filename to use */
- H5F_file_space_type_t strategy, fs_type, def_type; /* File space handling strategy */
- hsize_t threshold, fs_size, def_size; /* Free space section threshold */
- unsigned new_format; /* new format or old format */
- herr_t ret; /* return value */
+ hid_t file; /* File opened with read-write permission */
+ h5_stat_size_t empty_filesize; /* Size of file when empty */
+ h5_stat_size_t mod_filesize; /* Size of file after being modified */
+ hssize_t free_space; /* Amount of free space in file */
+ hid_t fcpl; /* File creation property list */
+ hid_t fapl, new_fapl; /* File access property list IDs */
+ hid_t dspace; /* Dataspace ID */
+ hid_t dset; /* Dataset ID */
+ hid_t dcpl; /* Dataset creation property list */
+ int k; /* Local index variable */
+ unsigned u; /* Local index variable */
+ char filename[FILENAME_LEN]; /* Filename to use */
+ char name[32]; /* Dataset name */
+ unsigned new_format; /* To use old or new format */
+ hbool_t split_vfd, multi_vfd; /* Indicate multi/split driver */
+ hsize_t expected_freespace; /* Freespace expected */
+ hsize_t expected_fs_del; /* Freespace expected after delete */
+ herr_t ret; /* Return value */
+
+ split_vfd = !HDstrcmp(env_h5_drvr, "split");
+ multi_vfd = !HDstrcmp(env_h5_drvr, "multi");
+
+ if(!split_vfd && !multi_vfd) {
+ fapl = h5_fileaccess();
+ h5_fixname(FILESPACE_NAME[0], fapl, filename, sizeof filename);
+
+ new_fapl = H5Pcopy(fapl);
+ CHECK(new_fapl, FAIL, "H5Pcopy");
+
+ /* Set the "use the latest version of the format" bounds */
+ ret = H5Pset_libver_bounds(new_fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST);
+ CHECK(ret, FAIL, "H5Pset_libver_bounds");
- /* Output message about test being performed */
- MESSAGE(5, ("Testing File Space Management public routines: H5Pget/set_file_space()\n"));
+ fcpl = H5Pcreate(H5P_FILE_CREATE);
+ CHECK(fcpl, FAIL, "H5Pcreate");
+
+ /* Test with old & new format */
+ for(new_format = FALSE; new_format <= TRUE; new_format++) {
+ hid_t my_fapl;
+
+ /* Set the FAPL for the type of format */
+ if(new_format) {
+ MESSAGE(5, ("Testing with new group format\n"));
+
+ my_fapl = new_fapl;
+
+ if(multi_vfd || split_vfd) {
+ ret = set_multi_split(new_fapl, FSP_SIZE_DEF, multi_vfd, split_vfd);
+ CHECK(ret, FAIL, "set_multi_split");
+ }
+
+ ret = H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, FALSE, (hsize_t)1);
+ CHECK(ret, FAIL, "H5P_set_file_space_strategy");
+
+ expected_freespace = 4534;
+ if(split_vfd) expected_freespace = 427;
+ if(multi_vfd) expected_freespace = 248;
+ expected_fs_del = 0;
+ } /* end if */
+ else {
+ MESSAGE(5, ("Testing with old group format\n"));
+ /* Default: non-paged aggregation, non-persistent free-space */
+ my_fapl = fapl;
+ expected_freespace = 2464;
+ if(split_vfd) expected_freespace = 264;
+ if(multi_vfd) expected_freespace = 0;
+ expected_fs_del = 4096;
+
+ } /* end else */
+
+ /* Create an "empty" file */
+ file = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, my_fapl);
+ CHECK(file, FAIL, "H5Fcreate");
+
+ ret = H5Fclose(file);
+ CHECK_I(ret, "H5Fclose");
+
+ /* Get the "empty" file size */
+ empty_filesize = h5_get_file_size(filename, H5P_DEFAULT);
+
+ /* Re-open the file (with read-write permission) */
+ file = H5Fopen(filename, H5F_ACC_RDWR, my_fapl);
+ CHECK_I(file, "H5Fopen");
+
+ /* Check that the free space is 0 */
+ free_space = H5Fget_freespace(file);
+ CHECK(free_space, FAIL, "H5Fget_freespace");
+ VERIFY(free_space, 0, "H5Fget_freespace");
+
+ /* Create dataspace for datasets */
+ dspace = H5Screate(H5S_SCALAR);
+ CHECK(dspace, FAIL, "H5Screate");
+
+ /* Create a dataset creation property list */
+ dcpl = H5Pcreate(H5P_DATASET_CREATE);
+ CHECK(dcpl, FAIL, "H5Pcreate");
+
+ /* Set the space allocation time to early */
+ ret = H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_EARLY);
+ CHECK(ret, FAIL, "H5Pset_alloc_time");
+
+ /* Create datasets in file */
+ for(u = 0; u < 10; u++) {
+ sprintf(name, "Dataset %u", u);
+ dset = H5Dcreate2(file, name, H5T_STD_U32LE, dspace, H5P_DEFAULT, dcpl, H5P_DEFAULT);
+ CHECK(dset, FAIL, "H5Dcreate2");
+
+ ret = H5Dclose(dset);
+ CHECK(ret, FAIL, "H5Dclose");
+ } /* end for */
- fapl = h5_fileaccess();
- h5_fixname(FILESPACE_NAME[0], fapl, filename, sizeof filename);
+ /* Close dataspace */
+ ret = H5Sclose(dspace);
+ CHECK(ret, FAIL, "H5Sclose");
- new_fapl = H5Pcopy(fapl);
- CHECK(new_fapl, FAIL, "H5Pcopy");
+ /* Close dataset creation property list */
+ ret = H5Pclose(dcpl);
+ CHECK(ret, FAIL, "H5Pclose");
- /* Set the "use the latest version of the format" bounds */
- ret = H5Pset_libver_bounds(new_fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST);
- CHECK(ret, FAIL, "H5Pset_libver_bounds");
+ /* Check that there is the right amount of free space in the file */
+ free_space = H5Fget_freespace(file);
+ CHECK(free_space, FAIL, "H5Fget_freespace");
+ VERIFY(free_space, expected_freespace, "H5Fget_freespace");
- /* Create file-creation template */
- fcpl = H5Pcreate(H5P_FILE_CREATE);
- CHECK(fcpl, FAIL, "H5Pcreate");
+ /* Delete datasets in file */
+ for(k = 9; k >= 0; k--) {
+ sprintf(name, "Dataset %u", (unsigned)k);
+ ret = H5Ldelete(file, name, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Ldelete");
+ } /* end for */
- /* Get default file space information */
- ret = H5Pget_file_space(fcpl, &def_type, &def_size);
- CHECK(ret, FAIL, "H5Pget_file_space");
+ /* Check that there is the right amount of free space in the file */
+ free_space = H5Fget_freespace(file);
+ CHECK(free_space, FAIL, "H5Fget_freespace");
+ if(new_format)
+ VERIFY(free_space, expected_fs_del, "H5Fget_freespace");
+ else
+ VERIFY(free_space, expected_fs_del, "H5Fget_freespace");
- /* Test with old & new format groups */
- for(new_format = FALSE; new_format <= TRUE; new_format++) {
- hid_t my_fapl;
+ /* Close file */
+ ret = H5Fclose(file);
+ CHECK(ret, FAIL, "H5Fclose");
+
+ /* Get the file size after modifications*/
+ mod_filesize = h5_get_file_size(filename, H5P_DEFAULT);
+
+ /* Check that the file reverted to empty size */
+ VERIFY(mod_filesize, empty_filesize, "H5Fget_freespace");
+
+ h5_clean_files(FILESPACE_NAME, my_fapl);
+
+ } /* end for */
+ }
+
+} /* end test_file_freespace() */
+
+/****************************************************************
+**
+** test_sects_freespace():
+** This routine checks free-space section information for the
+** file as returned by the public routine H5Fget_free_sections().
+**
+*****************************************************************/
+static void
+test_sects_freespace(const char *env_h5_drvr, hbool_t new_format)
+{
+ char filename[FILENAME_LEN]; /* Filename to use */
+ hid_t file; /* File ID */
+ hid_t fcpl; /* File creation property list template */
+ hid_t fapl; /* File access property list template */
+ hssize_t free_space; /* Amount of free-space in the file */
+ hid_t dspace; /* Dataspace ID */
+ hid_t dset; /* Dataset ID */
+ hid_t dcpl; /* Dataset creation property list */
+ char name[32]; /* Dataset name */
+ hssize_t nsects = 0; /* # of free-space sections */
+ hssize_t nall; /* # of free-space sections for all types of data */
+ hssize_t nmeta = 0, nraw = 0; /* # of free-space sections for meta/raw/generic data */
+ H5F_sect_info_t sect_info[15]; /* Array to hold free-space information */
+ H5F_sect_info_t all_sect_info[15]; /* Array to hold free-space information for all types of data */
+ H5F_sect_info_t meta_sect_info[15]; /* Array to hold free-space information for metadata */
+ H5F_sect_info_t raw_sect_info[15]; /* Array to hold free-space information for raw data */
+ hsize_t total = 0; /* sum of the free-space section sizes */
+ hsize_t tmp_tot = 0; /* Sum of the free-space section sizes */
+ hsize_t last_size; /* Size of last free-space section */
+ hsize_t dims[1]; /* Dimension sizes */
+ unsigned u; /* Local index variable */
+ H5FD_mem_t type;
+ hbool_t split_vfd = FALSE, multi_vfd = FALSE;
+ herr_t ret; /* Return value */
+
+ /* Output message about test being performed */
+ MESSAGE(5, ("Testing H5Fget_free_sections()--free-space section info in the file\n"));
+
+ split_vfd = !HDstrcmp(env_h5_drvr, "split");
+ multi_vfd = !HDstrcmp(env_h5_drvr, "multi");
+
+ if(!split_vfd && !multi_vfd) {
+
+ fapl = h5_fileaccess();
+ h5_fixname(FILESPACE_NAME[0], fapl, filename, sizeof filename);
+
+ /* Create file-creation template */
+ fcpl = H5Pcreate(H5P_FILE_CREATE);
+ CHECK(fcpl, FAIL, "H5Pcreate");
- /* Set the FAPL for the type of format */
if(new_format) {
- MESSAGE(5, ("Testing with new group format\n"));
- my_fapl = new_fapl;
- } /* end if */
- else {
- MESSAGE(5, ("Testing with old group format\n"));
- my_fapl = fapl;
- } /* end else */
+ ret = H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST);
+ CHECK(ret, FAIL, "H5Pset_libver_bounds");
+
+ /* Set to paged aggregation and persistent free-space */
+ ret = H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, TRUE, (hsize_t)1);
+ CHECK(ret, FAIL, "H5Pget_file_space_strategy");
+
+ /* Set up paged aligned address space for multi/split driver */
+ if(multi_vfd || split_vfd) {
+ ret = set_multi_split(fapl, FSP_SIZE_DEF, multi_vfd, split_vfd);
+ CHECK(ret, FAIL, "set_multi_split");
+ }
+
+ } else {
+ ret = H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_FSM_AGGR, TRUE, (hsize_t)1);
+ CHECK(ret, FAIL, "H5Pget_file_space_strategy");
+ }
+
+ /* Create the file */
+ file = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl);
+ CHECK(file, FAIL, "H5Fcreate");
+
+ /* Create a dataset creation property list */
+ dcpl = H5Pcreate(H5P_DATASET_CREATE);
+ CHECK(dcpl, FAIL, "H5Pcreate");
+
+ /* Set the space allocation time to early */
+ ret = H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_EARLY);
+ CHECK(ret, FAIL, "H5Pset_alloc_time");
+
+ /* Create 1 large dataset */
+ dims[0] = 1200;
+ dspace = H5Screate_simple(1, dims, NULL);
+ dset = H5Dcreate2(file, "Dataset_large", H5T_STD_U32LE, dspace, H5P_DEFAULT, dcpl, H5P_DEFAULT);
+ CHECK(dset, FAIL, "H5Dcreate2");
- /* Test with different sized free space section threshold */
- for(fs_size = 0; fs_size <= TEST_THRESHOLD10; fs_size++) {
+ /* Close dataset */
+ ret = H5Dclose(dset);
+ CHECK(ret, FAIL, "H5Dclose");
- /* Test with different file space handling strategies */
- for(fs_type = H5F_FILE_SPACE_DEFAULT; fs_type < H5F_FILE_SPACE_NTYPES; H5_INC_ENUM(H5F_file_space_type_t, fs_type)) {
+ /* Close dataspace */
+ ret = H5Sclose(dspace);
+ CHECK(ret, FAIL, "H5Sclose");
- /* Get a copy of the default file creation property */
- fcpl1 = H5Pcopy(fcpl);
- CHECK(fcpl1, FAIL, "H5Pcopy");
+ /* Create dataspace for datasets */
+ dspace = H5Screate(H5S_SCALAR);
+ CHECK(dspace, FAIL, "H5Screate");
- /* Set file space strategy and free space section threshold */
- ret = H5Pset_file_space(fcpl1, fs_type, fs_size);
- CHECK(ret, FAIL, "H5Pget_file_space");
+ /* Create datasets in file */
+ for(u = 0; u < 10; u++) {
+ sprintf(name, "Dataset %u", u);
+ dset = H5Dcreate2(file, name, H5T_STD_U32LE, dspace, H5P_DEFAULT, dcpl, H5P_DEFAULT);
+ CHECK(dset, FAIL, "H5Dcreate2");
- /* Get the file space info from the creation property */
- ret = H5Pget_file_space(fcpl1, &strategy, &threshold);
- CHECK(ret, FAIL, "H5Pget_file_space");
+ ret = H5Dclose(dset);
+ CHECK(ret, FAIL, "H5Dclose");
+ } /* end for */
- /* A 0 value for strategy retains existing strategy in use */
- VERIFY(strategy, (H5F_file_space_type_t)(fs_type ? fs_type : def_type), "H5Pget_file_space");
- /* A 0 value for threshold retains existing threshold in use */
- VERIFY(threshold, (hsize_t)(fs_size ? fs_size : def_size), "H5Pget_file_space");
+ /* Close dataspace */
+ ret = H5Sclose(dspace);
+ CHECK(ret, FAIL, "H5Sclose");
- /* Create the file with the specified file space info */
- fid1 = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl1, my_fapl);
- CHECK(fid1, FAIL, "H5Fcreate");
+ /* Close dataset creation property list */
+ ret = H5Pclose(dcpl);
+ CHECK(ret, FAIL, "H5Pclose");
- /* Close the file */
- ret = H5Fclose(fid1);
- CHECK(ret, FAIL, "H5Fclose");
+ /* Delete odd-numbered datasets in file */
+ for(u = 0; u < 10; u++) {
+ sprintf(name, "Dataset %u", u);
+ if(u % 2) {
+ ret = H5Ldelete(file, name, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Ldelete");
+ } /* end if */
+ } /* end for */
- /* Re-open the file */
- fid2 = H5Fopen(filename, H5F_ACC_RDWR, my_fapl);
- CHECK(fid2, FAIL, "H5Fopen");
+ /* Close file */
+ ret = H5Fclose(file);
+ CHECK(ret, FAIL, "H5Fclose");
- /* Get the file's creation property */
- fcpl2 = H5Fget_create_plist(fid2);
- CHECK(fcpl2, FAIL, "H5Fget_create_plist");
+ /* Re-open the file with read-only permission */
+ file = H5Fopen(filename, H5F_ACC_RDONLY, fapl);
+ CHECK_I(file, "H5Fopen");
+
+ /* Get the amount of free space in the file */
+ free_space = H5Fget_freespace(file);
+ CHECK(free_space, FAIL, "H5Fget_freespace");
+
+ /* Get the total # of free-space sections in the file */
+ nall = H5Fget_free_sections(file, H5FD_MEM_DEFAULT, (size_t)0, NULL);
+ CHECK(nall, FAIL, "H5Fget_free_sections");
+
+ /* Should return failure when nsects is 0 with a nonnull sect_info */
+ nsects = H5Fget_free_sections(file, H5FD_MEM_DEFAULT, (size_t)0, all_sect_info);
+ VERIFY(nsects, FAIL, "H5Fget_free_sections");
+
+ /* Retrieve and verify free space info for all the sections */
+ HDmemset(all_sect_info, 0, sizeof(all_sect_info));
+ nsects = H5Fget_free_sections(file, H5FD_MEM_DEFAULT, (size_t)nall, all_sect_info);
+ VERIFY(nsects, nall, "H5Fget_free_sections");
+
+ /* Verify the amount of free-space is correct */
+ for(u = 0; u < nall; u++)
+ total += all_sect_info[u].size;
+ VERIFY(free_space, total, "H5Fget_free_sections");
+
+ /* Save the last section's size */
+ last_size = all_sect_info[nall-1].size;
+
+ /* Retrieve and verify free space info for -1 sections */
+ HDmemset(sect_info, 0, sizeof(sect_info));
+ nsects = H5Fget_free_sections(file, H5FD_MEM_DEFAULT, (size_t)(nall - 1), sect_info);
+ VERIFY(nsects, nall, "H5Fget_free_sections");
+
+ /* Verify the amount of free-space is correct */
+ total = 0;
+ for(u = 0; u < (nall - 1); u++) {
+ VERIFY(sect_info[u].addr, all_sect_info[u].addr, "H5Fget_free_sections");
+ VERIFY(sect_info[u].size, all_sect_info[u].size, "H5Fget_free_sections");
+ total += sect_info[u].size;
+ }
+ VERIFY(((hsize_t)free_space - last_size), total, "H5Fget_free_sections");
+
+ /* Retrieve and verify free-space info for +1 sections */
+ HDmemset(sect_info, 0, sizeof(sect_info));
+ nsects = H5Fget_free_sections(file, H5FD_MEM_DEFAULT, (size_t)(nall + 1), sect_info);
+ VERIFY(nsects, nall, "H5Fget_free_sections");
+
+ /* Verify amount of free-space is correct */
+ total = 0;
+ for(u = 0; u < nall; u++) {
+ VERIFY(sect_info[u].addr, all_sect_info[u].addr, "H5Fget_free_sections");
+ VERIFY(sect_info[u].size, all_sect_info[u].size, "H5Fget_free_sections");
+ total += sect_info[u].size;
+ }
+ VERIFY(sect_info[nall].addr, 0, "H5Fget_free_sections");
+ VERIFY(sect_info[nall].size, 0, "H5Fget_free_sections");
+ VERIFY(free_space, total, "H5Fget_free_sections");
+
+ HDmemset(meta_sect_info, 0, sizeof(meta_sect_info));
+ if(multi_vfd) {
+ hssize_t ntmp;
+
+ for(type = H5FD_MEM_SUPER; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, type)) {
+ if(type == H5FD_MEM_DRAW || type == H5FD_MEM_GHEAP)
+ continue;
+ /* Get the # of free-space sections in the file for metadata */
+ ntmp = H5Fget_free_sections(file, type, (size_t)0, NULL);
+ CHECK(ntmp, FAIL, "H5Fget_free_sections");
+
+ if(ntmp > 0) {
+ nsects = H5Fget_free_sections(file, type, (size_t)ntmp, &meta_sect_info[nmeta]);
+ VERIFY(nsects, ntmp, "H5Fget_free_sections");
+ nmeta += ntmp;
+ }
+ }
+ } else {
+ /* Get the # of free-space sections in the file for metadata */
+ nmeta = H5Fget_free_sections(file, H5FD_MEM_SUPER, (size_t)0, NULL);
+ CHECK(nmeta, FAIL, "H5Fget_free_sections");
+
+ /* Retrieve and verify free-space sections for metadata */
+ nsects = H5Fget_free_sections(file, H5FD_MEM_SUPER, (size_t)nmeta, meta_sect_info);
+ VERIFY(nsects, nmeta, "H5Fget_free_sections");
+ }
- strategy = H5F_FILE_SPACE_DEFAULT;
- threshold = 0;
+ /* Get the # of free-space sections in the file for raw data */
+ nraw = H5Fget_free_sections(file, H5FD_MEM_DRAW, (size_t)0, NULL);
+ CHECK(nraw, FAIL, "H5Fget_free_sections");
- /* Get the file space info from the creation property list */
- ret = H5Pget_file_space(fcpl2, &strategy, &threshold);
- CHECK(ret, FAIL, "H5Pget_file_space");
+ /* Retrieve and verify free-space sections for raw data */
+ HDmemset(raw_sect_info, 0, sizeof(raw_sect_info));
+ nsects = H5Fget_free_sections(file, H5FD_MEM_DRAW, (size_t)nraw, raw_sect_info);
+ VERIFY(nsects, nraw, "H5Fget_free_sections");
- VERIFY(strategy, (H5F_file_space_type_t)(fs_type ? fs_type : def_type), "H5Pget_file_space");
- VERIFY(threshold, (hsize_t)(fs_size ? fs_size : def_size), "H5Pget_file_space");
+ /* Sum all the free-space sections */
+ for(u = 0; u < nmeta; u++)
+ tmp_tot += meta_sect_info[u].size;
- /* Close the file */
- ret = H5Fclose(fid2);
- CHECK(ret, FAIL, "H5Fclose");
+ for(u = 0; u < nraw; u++)
+ tmp_tot += raw_sect_info[u].size;
- /* Release file-creation template */
- ret = H5Pclose(fcpl1);
- CHECK(ret, FAIL, "H5Pclose");
- ret = H5Pclose(fcpl2);
- CHECK(ret, FAIL, "H5Pclose");
- } /* end for file space strategy type */
- } /* end for free space threshold */
+ /* Verify free-space info */
+ VERIFY(nmeta+nraw, nall, "H5Fget_free_sections");
+ VERIFY(tmp_tot, total, "H5Fget_free_sections");
- h5_clean_files(FILESPACE_NAME, my_fapl);
+ /* Closing */
+ ret = H5Fclose(file);
+ CHECK(ret, FAIL, "H5Fclose");
+ ret = H5Pclose(fcpl);
+ CHECK(fcpl, FAIL, "H5Pclose");
- } /* end for new/old format */
+ h5_clean_files(FILESPACE_NAME, fapl);
+ }
+
+} /* end test_sects_freespace() */
- /* Close the file creation property list */
- ret = H5Pclose(fcpl);
- CHECK(ret, FAIL, "H5Pclose");
-} /* test_filespace_info() */
/****************************************************************
**
** test_filespace_compatible():
-** Verify that the branch with file space management enhancement
+** Verify that the trunk with the latest file space management
** can open, read and modify 1.6 HDF5 file and 1.8 HDF5 file.
-** Also verify the correct file space strategy/threshold in use
+** Also verify the correct file space handling information
** and the amount of free space.
**
****************************************************************/
@@ -3614,8 +4330,9 @@ test_filespace_compatible(void)
ssize_t nread; /* Number of bytes read in */
unsigned i, j; /* Local index variable */
hssize_t free_space; /* Amount of free-space in the file */
+ hbool_t persist; /* Persist free-space or not */
hsize_t threshold; /* Free-space section threshold */
- H5F_file_space_type_t strategy; /* File space handling strategy */
+ H5F_fspace_strategy_t strategy; /* File space handling strategy */
herr_t ret; /* Return value */
/* Output message about test being performed */
@@ -3655,14 +4372,16 @@ test_filespace_compatible(void)
fcpl = H5Fget_create_plist(fid);
CHECK(fcpl, FAIL, "H5Fget_create_plist");
- /* Retrieve the file space handling strategy and threshold */
- ret = H5Pget_file_space(fcpl, &strategy, &threshold);
- CHECK(ret, FAIL, "H5Pget_file_space");
+ /* Retrieve the file space info */
+ ret = H5Pget_file_space_strategy(fcpl, &strategy, &persist, &threshold);
+ CHECK(ret, FAIL, "H5Pget_file_space_strategy");
- /* File space handling strategy should be H5F_FILE_SPACE_ALL = 2 */
- /* Free space section threshold should be 1 */
- VERIFY(strategy, 2, "H5Pget_file_space");
- VERIFY(threshold, 1, "H5Pget_file_space");
+ /* File space handling strategy should be H5F_FSPACE_STRATEGY_FSM_AGGR */
+ /* Persisting free-space should be FALSE */
+ /* Free-space section threshold should be 1 */
+ VERIFY(strategy, H5F_FSPACE_STRATEGY_FSM_AGGR, "H5Pget_file_space_strategy");
+ VERIFY(persist, FALSE, "H5Pget_file_space_strategy");
+ VERIFY(threshold, 1, "H5Pget_file_space_strategy");
/* Generate raw data */
for(i = 0; i < 100; i++)
@@ -3715,6 +4434,387 @@ test_filespace_compatible(void)
/****************************************************************
**
+** test_filespace_1.10.0_compatible():
+** Verify that the latest file space management can open, read and
+** modify 1.10.0 HDF5 files :
+** h5fc_ext1_i.h5: H5F_FILE_SPACE_ALL, default threshold; has superblock extension but no fsinfo message
+** h5fc_ext1_f.h5: H5F_FILE_SPACE_ALL_PERSIST, default threshold; has superblock extension with fsinfo message
+** h5fc_ext2_if.h5: H5F_FILE_SPACE_ALL, non-default threshold; has superblock extension with fsinfo message
+** h5fc_ext2_sf.h5: H5F_FILE_SPACE_VFD, default threshold; has superblock extension with fsinfo message
+** h5fc_ext3_isf.h5: H5F_FILE_SPACE_AGGR_VFD, default threshold; has superblock extension with fsinfo message
+** h5fc_ext_none.h5: H5F_FILE_SPACE_ALL, default threshold; without superblock extension
+** The above files are copied from release 1.10.0 tools/h5format_convert/testfiles.
+**
+****************************************************************/
+static void
+test_filespace_1_10_0_compatible(void)
+{
+ hid_t fid = -1; /* File id */
+ hid_t did = -1; /* Dataset id */
+ hid_t fcpl; /* File creation property list */
+ hbool_t persist; /* Persist free-space or not */
+ hsize_t threshold; /* Free-space section threshold */
+ H5F_fspace_strategy_t strategy; /* File space handling strategy */
+ int wbuf[24]; /* Buffer for dataset data */
+ int rdbuf[24]; /* Buffer for dataset data */
+ int status; /* Status from copying the existing file */
+ unsigned i, j; /* Local index variable */
+ herr_t ret; /* Return value */
+
+ /* Output message about test being performed */
+ MESSAGE(5, ("File space compatibility testing for 1.10.0 files\n"));
+
+ for(j = 0; j < NELMTS(OLD_1_10_0_FILENAME); j++) {
+ const char *filename = H5_get_srcdir_filename(OLD_1_10_0_FILENAME[j]); /* Corrected test file name */
+
+ /* Make a copy of the test file */
+ status = h5_make_local_copy(filename, FILE5);
+ CHECK(status, FAIL, "h5_make_local_copy");
+
+ /* Open the temporary test file */
+ fid = H5Fopen(FILE5, H5F_ACC_RDWR, H5P_DEFAULT);
+ CHECK(fid, FAIL, "H5Fopen");
+
+ /* Get the file's file creation property list */
+ fcpl = H5Fget_create_plist(fid);
+ CHECK(fcpl, FAIL, "H5Fget_create_plist");
+
+ /* Retrieve the file space info */
+ ret = H5Pget_file_space_strategy(fcpl, &strategy, &persist, &threshold);
+ CHECK(ret, FAIL, "H5Pget_file_space_strategy");
+
+ switch(j) {
+ case 0:
+ VERIFY(strategy, H5F_FILE_SPACE_STRATEGY_DEF, "H5Pget_file_space_strategy");
+ VERIFY(persist, H5F_FREE_SPACE_PERSIST_DEF, "H5Pget_file_space_strategy");
+ VERIFY(threshold, H5F_FREE_SPACE_THRESHOLD_DEF, "H5Pget_file_space_strategy");
+
+ /* Open the dataset */
+ did = H5Dopen2(fid, "/DSET_EA", H5P_DEFAULT);
+ CHECK(did, FAIL, "H5Dopen");
+
+ for(i = 0; i < 24; i++)
+ wbuf[i] = (int)j+1;
+
+ /* Write to the dataset */
+ ret = H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf);
+ CHECK(ret, FAIL, "H5Dwrite");
+
+ /* Close the dataset */
+ ret = H5Dclose(did);
+ CHECK(ret, FAIL, "H5Dclose");
+ break;
+
+ case 1:
+ VERIFY(strategy, H5F_FSPACE_STRATEGY_FSM_AGGR, "H5Pget_file_space_strategy");
+ VERIFY(persist, TRUE, "H5Pget_file_space_strategy");
+ VERIFY(threshold, H5F_FREE_SPACE_THRESHOLD_DEF, "H5Pget_file_space_strategy");
+
+ /* Open the dataset */
+ did = H5Dopen2(fid, "/DSET_NDATA_BT2", H5P_DEFAULT);
+ CHECK(did, FAIL, "H5Dopen");
+
+ for(i = 0; i < 24; i++)
+ wbuf[i] = (int)j+1;
+
+ /* Write to the dataset */
+ ret = H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf);
+ CHECK(ret, FAIL, "H5Dwrite");
+
+ /* Close the dataset */
+ ret = H5Dclose(did);
+ CHECK(ret, FAIL, "H5Dclose");
+ break;
+
+ case 2:
+ VERIFY(strategy, H5F_FSPACE_STRATEGY_FSM_AGGR, "H5Pget_file_space_strategy");
+ VERIFY(persist, H5F_FREE_SPACE_PERSIST_DEF, "H5Pget_file_space_strategy");
+ VERIFY(threshold, 2, "H5Pget_file_space_strategy");
+
+ /* Open the dataset */
+ did = H5Dopen2(fid, "/DSET_NONE", H5P_DEFAULT);
+ CHECK(did, FAIL, "H5Dopen");
+
+ for(i = 0; i < 24; i++)
+ wbuf[i] = (int)j+1;
+
+ /* Write to the dataset */
+ ret = H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf);
+ CHECK(ret, FAIL, "H5Dwrite");
+
+ /* Close the dataset */
+ ret = H5Dclose(did);
+ CHECK(ret, FAIL, "H5Dclose");
+ break;
+
+ case 3:
+ VERIFY(strategy, H5F_FSPACE_STRATEGY_NONE, "H5Pget_file_space_strategy");
+ VERIFY(persist, H5F_FREE_SPACE_PERSIST_DEF, "H5Pget_file_space_strategy");
+ VERIFY(threshold, H5F_FREE_SPACE_THRESHOLD_DEF, "H5Pget_file_space_strategy");
+
+ /* Open the dataset */
+ did = H5Dopen2(fid, "/GROUP/DSET_NDATA_EA", H5P_DEFAULT);
+ CHECK(did, FAIL, "H5Dopen");
+
+ for(i = 0; i < 24; i++)
+ wbuf[i] = (int)j+1;
+
+ /* Write to the dataset */
+ ret = H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf);
+ CHECK(ret, FAIL, "H5Dwrite");
+
+ /* Close the dataset */
+ ret = H5Dclose(did);
+ CHECK(ret, FAIL, "H5Dclose");
+ break;
+
+ case 4:
+ VERIFY(strategy, H5F_FSPACE_STRATEGY_AGGR, "H5Pget_file_space_strategy");
+ VERIFY(persist, H5F_FREE_SPACE_PERSIST_DEF, "H5Pget_file_space_strategy");
+ VERIFY(threshold, H5F_FREE_SPACE_THRESHOLD_DEF, "H5Pget_file_space_strategy");
+
+ /* Open the dataset */
+ did = H5Dopen2(fid, "/GROUP/DSET_NDATA_FA", H5P_DEFAULT);
+ CHECK(did, FAIL, "H5Dopen");
+
+ for(i = 0; i < 24; i++)
+ wbuf[i] = (int)j+1;
+
+ /* Write to the dataset */
+ ret = H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf);
+ CHECK(ret, FAIL, "H5Dwrite");
+
+ /* Close the dataset */
+ ret = H5Dclose(did);
+ CHECK(ret, FAIL, "H5Dclose");
+ break;
+ case 5:
+ VERIFY(strategy, H5F_FSPACE_STRATEGY_FSM_AGGR, "H5Pget_file_space_strategy");
+ VERIFY(persist, H5F_FREE_SPACE_PERSIST_DEF, "H5Pget_file_space_strategy");
+ VERIFY(threshold, H5F_FREE_SPACE_THRESHOLD_DEF, "H5Pget_file_space_strategy");
+
+ /* Open the dataset */
+ did = H5Dopen2(fid, "/GROUP/DSET_NDATA_NONE", H5P_DEFAULT);
+ CHECK(did, FAIL, "H5Dopen");
+
+ for(i = 0; i < 24; i++)
+ wbuf[i] = (int)j+1;
+
+ /* Write to the dataset */
+ ret = H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf);
+ CHECK(ret, FAIL, "H5Dwrite");
+
+ /* Close the dataset */
+ ret = H5Dclose(did);
+ CHECK(ret, FAIL, "H5Dclose");
+ break;
+
+ default:
+ break;
+ }
+
+ /* Close the plist */
+ ret = H5Pclose(fcpl);
+ CHECK(ret, FAIL, "H5Pclose");
+
+ /* Close the file */
+ ret = H5Fclose(fid);
+ CHECK(ret, FAIL, "H5Fclose");
+
+ /* Re-Open the file */
+ fid = H5Fopen(FILE5, H5F_ACC_RDONLY, H5P_DEFAULT);
+ CHECK(fid, FAIL, "H5Fopen");
+
+ switch(j) {
+ case 0:
+ /* Open and read the dataset */
+ did = H5Dopen2(fid, "/DSET_EA", H5P_DEFAULT);
+ CHECK(did, FAIL, "H5Dopen");
+
+ ret = H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdbuf);
+ CHECK(ret, FAIL, "H5Dread");
+
+ /* Verify the data read is correct */
+ for(i = 0; i < 24; i++)
+ VERIFY(rdbuf[i], j+1, "test_compatible");
+
+ /* Close the dataset */
+ ret = H5Dclose(did);
+ CHECK(ret, FAIL, "H5Dclose");
+ break;
+
+ case 1:
+ /* Open and read the dataset */
+ did = H5Dopen2(fid, "/DSET_NDATA_BT2", H5P_DEFAULT);
+ CHECK(did, FAIL, "H5Dopen");
+
+ ret = H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdbuf);
+ CHECK(ret, FAIL, "H5Dread");
+
+ /* Verify the data read is correct */
+ for(i = 0; i < 24; i++)
+ VERIFY(rdbuf[i], j+1, "test_compatible");
+
+ /* Close the dataset */
+ ret = H5Dclose(did);
+ CHECK(ret, FAIL, "H5Dclose");
+ break;
+
+ case 2:
+ /* Open and read the dataset */
+ did = H5Dopen2(fid, "/DSET_NONE", H5P_DEFAULT);
+ CHECK(did, FAIL, "H5Dopen");
+
+ ret = H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdbuf);
+ CHECK(ret, FAIL, "H5Dread");
+
+ /* Verify the data read is correct */
+ for(i = 0; i < 24; i++)
+ VERIFY(rdbuf[i], j+1, "test_compatible");
+
+ /* Close the dataset */
+ ret = H5Dclose(did);
+ CHECK(ret, FAIL, "H5Dclose");
+ break;
+
+ case 3:
+ /* Open and read the dataset */
+ did = H5Dopen2(fid, "/GROUP/DSET_NDATA_EA", H5P_DEFAULT);
+ CHECK(did, FAIL, "H5Dopen");
+
+ ret = H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdbuf);
+ CHECK(ret, FAIL, "H5Dread");
+
+ /* Verify the data read is correct */
+ for(i = 0; i < 24; i++)
+ VERIFY(rdbuf[i], j+1, "test_compatible");
+
+ /* Close the dataset */
+ ret = H5Dclose(did);
+ CHECK(ret, FAIL, "H5Dclose");
+ break;
+
+ case 4:
+
+ /* Open and read the dataset */
+ did = H5Dopen2(fid, "/GROUP/DSET_NDATA_FA", H5P_DEFAULT);
+ CHECK(did, FAIL, "H5Dopen");
+
+ ret = H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdbuf);
+ CHECK(ret, FAIL, "H5Dread");
+
+ /* Verify the data read is correct */
+ for(i = 0; i < 24; i++)
+ VERIFY(rdbuf[i], j+1, "test_compatible");
+
+ /* Close the dataset */
+ ret = H5Dclose(did);
+ CHECK(ret, FAIL, "H5Dclose");
+ break;
+
+ case 5:
+
+ /* Open and read the dataset */
+ did = H5Dopen2(fid, "/GROUP/DSET_NDATA_NONE", H5P_DEFAULT);
+ CHECK(did, FAIL, "H5Dopen");
+
+ ret = H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdbuf);
+ CHECK(ret, FAIL, "H5Dread");
+
+ /* Verify the data read is correct */
+ for(i = 0; i < 24; i++)
+ VERIFY(rdbuf[i], j+1, "test_compatible");
+
+ /* Close the dataset */
+ ret = H5Dclose(did);
+ CHECK(ret, FAIL, "H5Dclose");
+ break;
+
+ default:
+ break;
+ }
+
+ /* Close the file */
+ ret = H5Fclose(fid);
+ CHECK(ret, FAIL, "H5Fclose");
+ } /* end for */
+
+} /* test_filespace_1_10_0_compatible */
+
+/****************************************************************
+**
+** test_filespace_round_compatible():
+** Verify that the trunk can open, read and modify these files--
+** 1) They are initially created (via gen_filespace.c) in the trunk
+** with combinations of file space strategies, default/non-default
+** threshold, and file spacing paging enabled/disbled.
+** The library creates the file space info message with
+** "mark if unknown" in these files.
+** 2) They are copied to the 1.8 branch, and are opened/read/modified
+** there via test_filespace_compatible() in test/tfile.c.
+** The 1.8 library marks the file space info message as "unknown"
+** in these files.
+** 3) They are then copied back from the 1.8 branch to the trunk for
+** compatibility testing via this routine.
+** 4) Upon encountering the file space info message which is marked
+** as "unknown", the library will use the default file space management
+** from then on: non-persistent free-space managers, default threshold,
+** and non-paging file space.
+**
+****************************************************************/
+static void
+test_filespace_round_compatible(void)
+{
+ hid_t fid = -1; /* File id */
+ hid_t fcpl = -1; /* File creation property list ID */
+ unsigned j; /* Local index variable */
+ H5F_fspace_strategy_t strategy; /* File space strategy */
+ hbool_t persist; /* Persist free-space or not */
+ hsize_t threshold; /* Free-space section threshold */
+ hssize_t free_space; /* Amount of free space in the file */
+ int status; /* Status from copying the existing file */
+ herr_t ret; /* Return value */
+
+ /* Output message about test being performed */
+ MESSAGE(5, ("File space compatibility testing for files from trunk to 1_8 to trunk\n"));
+
+ for(j = 0; j < NELMTS(FSPACE_FILENAMES); j++) {
+ const char *filename = H5_get_srcdir_filename(FSPACE_FILENAMES[j]);
+
+ /* Make a copy of the test file */
+ status = h5_make_local_copy(filename, FILE5);
+ CHECK(status, FAIL, "h5_make_local_copy");
+
+ /* Open the temporary test file */
+ fid = H5Fopen(FILE5, H5F_ACC_RDWR, H5P_DEFAULT);
+ CHECK(fid, FAIL, "H5Fopen");
+
+ /* Get the file's creation property list */
+ fcpl = H5Fget_create_plist(fid);
+ CHECK(fcpl, FAIL, "H5Fget_create_plist");
+
+ ret = H5Pget_file_space_strategy(fcpl, &strategy, &persist, &threshold);
+ CHECK(ret, FAIL, "H5Pget_file_space_strategy");
+ VERIFY(strategy, H5F_FSPACE_STRATEGY_FSM_AGGR, "H5Pget_file_space_strategy");
+ VERIFY(persist, FALSE, "H5Pget_file_space_strategy");
+ VERIFY(threshold, 1, "H5Pget_file_space_strategy");
+
+ /* There should not be any free space in the file */
+ free_space = H5Fget_freespace(fid);
+ CHECK(free_space, FAIL, "H5Fget_freespace");
+ VERIFY(free_space, (hssize_t)0, "H5Fget_freespace");
+
+ /* Closing */
+ ret = H5Fclose(fid);
+ ret = H5Pclose(fcpl);
+ CHECK(ret, FAIL, "H5Fclose");
+ } /* end for */
+
+} /* test_filespace_round_compatible */
+
+
+/****************************************************************
+**
** test_libver_bounds_real():
** Verify that a file created and modified with the
** specified libver bounds has the specified object header
@@ -3951,6 +5051,9 @@ test_deprec(void)
{
hid_t file; /* File IDs for old & new files */
hid_t fcpl; /* File creation property list */
+ hid_t fapl; /* File creation property list */
+ hid_t new_fapl;
+ hsize_t align;
unsigned super; /* Superblock version # */
unsigned freelist; /* Free list version # */
unsigned stab; /* Symbol table entry version # */
@@ -4003,17 +5106,25 @@ test_deprec(void)
CHECK(fcpl, FAIL, "H5Pcreate");
/* Set a property in the FCPL that will push the superblock version up */
- ret = H5Pset_file_space(fcpl, H5F_FILE_SPACE_VFD, (hsize_t)0);
- CHECK(ret, FAIL, "H5Pset_file_space");
+ ret = H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, 1, (hsize_t)0);
+ ret = H5Pset_file_space_page_size(fcpl, (hsize_t)512);
+ CHECK(ret, FAIL, "H5Pset_file_space_strategy");
+
+ fapl = H5Pcreate(H5P_FILE_ACCESS);
+ ret = H5Pset_alignment(fapl, (hsize_t)1, (hsize_t)1024);
+ CHECK(ret, FAIL, "H5Pset_alignment");
/* Creating a file with the non-default file creation property list should
* create a version 2 superblock
*/
/* Create file with custom file creation property list */
- file= H5Fcreate(FILE1, H5F_ACC_TRUNC , fcpl, H5P_DEFAULT);
+ file= H5Fcreate(FILE1, H5F_ACC_TRUNC , fcpl, fapl);
CHECK(file, FAIL, "H5Fcreate");
+ new_fapl = H5Fget_access_plist(file);
+ H5Pget_alignment(new_fapl, NULL, &align);
+
/* Close FCPL */
ret=H5Pclose(fcpl);
CHECK(ret, FAIL, "H5Pclose");
@@ -4021,7 +5132,7 @@ test_deprec(void)
/* Get the file's version information */
ret = H5Fget_info1(file, &finfo);
CHECK(ret, FAIL, "H5Fget_info1");
- VERIFY(finfo.super_ext_size, 40,"H5Fget_info1");
+ VERIFY(finfo.super_ext_size, 152,"H5Fget_info1");
VERIFY(finfo.sohm.hdr_size, 0,"H5Fget_info1");
VERIFY(finfo.sohm.msgs_info.index_size, 0,"H5Fget_info1");
VERIFY(finfo.sohm.msgs_info.heap_size, 0,"H5Fget_info1");
@@ -4053,7 +5164,7 @@ test_deprec(void)
/* Get the file's version information */
ret = H5Fget_info1(file, &finfo);
CHECK(ret, FAIL, "H5Fget_info1");
- VERIFY(finfo.super_ext_size, 40,"H5Fget_info1");
+ VERIFY(finfo.super_ext_size, 152,"H5Fget_info1");
VERIFY(finfo.sohm.hdr_size, 0,"H5Fget_info1");
VERIFY(finfo.sohm.msgs_info.index_size, 0,"H5Fget_info1");
VERIFY(finfo.sohm.msgs_info.heap_size, 0,"H5Fget_info1");
@@ -4077,6 +5188,81 @@ test_deprec(void)
/* Close file */
ret=H5Fclose(file);
CHECK(ret, FAIL, "H5Fclose");
+
+ { /* Test deprecated H5Pget/set_file_space() */
+
+ H5F_file_space_type_t old_strategy;
+ hsize_t old_threshold;
+ hid_t fid;
+ hid_t ffcpl;
+
+ fcpl = H5Pcreate(H5P_FILE_CREATE);
+ CHECK(fcpl, FAIL, "H5Pcreate");
+
+ ret = H5Pget_file_space(fcpl, &old_strategy, &old_threshold);
+ CHECK(ret, FAIL, "H5Pget_file_space");
+ VERIFY(old_strategy, H5F_FILE_SPACE_ALL, "H5Pget_file_space");
+ VERIFY(old_threshold, H5F_FREE_SPACE_THRESHOLD_DEF, "H5Pget_file_space");
+
+ /* Set file space strategy and free space section threshold */
+ ret = H5Pset_file_space(fcpl, H5F_FILE_SPACE_ALL_PERSIST, (hsize_t)0);
+ CHECK(ret, FAIL, "H5Pget_file_space");
+
+ /* Get the file space info from the creation property */
+ ret = H5Pget_file_space(fcpl, &old_strategy, &old_threshold);
+ CHECK(ret, FAIL, "H5Pget_file_space");
+ VERIFY(old_strategy, H5F_FILE_SPACE_ALL_PERSIST, "H5Pget_file_space");
+ VERIFY(old_threshold, H5F_FREE_SPACE_THRESHOLD_DEF, "H5Pget_file_space");
+
+ ret = H5Pset_file_space(fcpl, H5F_FILE_SPACE_DEFAULT, (hsize_t)3);
+ CHECK(ret, FAIL, "H5Pget_file_space");
+
+ ret = H5Pget_file_space(fcpl, &old_strategy, &old_threshold);
+ CHECK(ret, FAIL, "H5Pget_file_space");
+ VERIFY(old_strategy, H5F_FILE_SPACE_ALL_PERSIST, "H5Pget_file_space");
+ VERIFY(old_threshold, 3, "H5Pget_file_space");
+
+ /* Create a file */
+ fid = H5Fcreate(FILE1, H5F_ACC_TRUNC , fcpl, H5P_DEFAULT);
+ CHECK(file, FAIL, "H5Fcreate");
+
+ old_strategy = H5F_FILE_SPACE_DEFAULT;
+ old_threshold = 0;
+ ffcpl = H5Fget_create_plist(fid);
+ ret = H5Pget_file_space(ffcpl, &old_strategy, &old_threshold);
+ CHECK(ret, FAIL, "H5Pget_file_space");
+ VERIFY(old_strategy, H5F_FILE_SPACE_ALL_PERSIST, "H5Pget_file_space");
+ VERIFY(old_threshold, 3, "H5Pget_file_space");
+
+ /* Close file */
+ ret=H5Fclose(fid);
+ CHECK(ret, FAIL, "H5Fclose");
+
+ ret = H5Pclose(ffcpl);
+ CHECK(ret, FAIL, "H5Pclose");
+
+ ret = H5Pclose(fcpl);
+ CHECK(ret, FAIL, "H5Pclose");
+
+ /* Reopen the file */
+ fid = H5Fopen(FILE1, H5F_ACC_RDONLY, H5P_DEFAULT);
+ CHECK(fid, FAIL, "H5Fcreate");
+
+ old_strategy = H5F_FILE_SPACE_DEFAULT;
+ old_threshold = 0;
+ ffcpl = H5Fget_create_plist(fid);
+ ret = H5Pget_file_space(ffcpl, &old_strategy, &old_threshold);
+ CHECK(ret, FAIL, "H5Pget_file_space");
+ VERIFY(old_strategy, H5F_FILE_SPACE_ALL_PERSIST, "H5Pget_file_space");
+ VERIFY(old_threshold, 3, "H5Pget_file_space");
+
+ ret = H5Pclose(ffcpl);
+ CHECK(ret, FAIL, "H5Pclose");
+
+ ret=H5Fclose(fid);
+ CHECK(ret, FAIL, "H5Fclose");
+ }
+
} /* test_deprec */
#endif /* H5_NO_DEPRECATED_SYMBOLS */
@@ -4088,9 +5274,16 @@ test_deprec(void)
void
test_file(void)
{
+ const char *env_h5_drvr; /* File Driver value from environment */
+
/* Output message about test being performed */
MESSAGE(5, ("Testing Low-Level File I/O\n"));
+ /* Get the VFD to use */
+ env_h5_drvr = HDgetenv("HDF5_DRIVER");
+ if(env_h5_drvr == NULL)
+ env_h5_drvr = "nomatch";
+
test_file_create(); /* Test file creation(also creation templates)*/
test_file_open(); /* Test file opening */
test_file_reopen(); /* Test file reopening */
@@ -4099,7 +5292,6 @@ test_file(void)
test_get_obj_ids(); /* Test H5Fget_obj_ids for Jira Issue 8528 */
test_file_perm(); /* Test file access permissions */
test_file_perm2(); /* Test file access permission again */
- test_file_freespace(); /* Test file free space information */
test_file_ishdf5(); /* Test detecting HDF5 files correctly */
test_file_open_dot(); /* Test opening objects with "." for a name */
test_file_open_overlap(); /* Test opening files in an overlapping manner */
@@ -4114,9 +5306,21 @@ test_file(void)
test_cached_stab_info(); /* Tests that files are created with cached stab info in the superblock */
test_rw_noupdate(); /* Test to ensure that RW permissions don't write the file unless dirtied */
test_userblock_alignment(); /* Tests that files created with a userblock and alignment interact properly */
- test_filespace_sects(); /* Test file free space section information */
- test_filespace_info(); /* Test file creation public routines:H5Pget/set_file_space */
+ test_userblock_alignment_paged(); /* Tests files created with a userblock and alignment (via paged aggregation) interact properly */
+ test_filespace_info(env_h5_drvr); /* Test file creation public routines: */
+ /* H5Pget/set_file_space_strategy() & H5Pget/set_file_space_page_size() */
+ /* Skipped testing for multi/split drivers */
+ test_file_freespace(env_h5_drvr); /* Test file public routine H5Fget_freespace() */
+ /* Skipped testing for multi/split drivers */
+ /* Setup for multi/split drivers are there already */
+ test_sects_freespace(env_h5_drvr, TRUE); /* Test file public routine H5Fget_free_sections() for new format */
+ /* Skipped testing for multi/split drivers */
+ /* Setup for multi/split drivers are there already */
+ test_sects_freespace(env_h5_drvr, FALSE); /* Test file public routine H5Fget_free_sections() */
+ /* Skipped testing for multi/split drivers */
test_filespace_compatible(); /* Test compatibility for file space management */
+ test_filespace_round_compatible(); /* Testing file space compatibility for files from trunk to 1_8 to trunk */
+ test_filespace_1_10_0_compatible(); /* Testing file space compatibility for files from release 1.10.0 */
test_libver_bounds(); /* Test compatibility for file space management */
test_libver_macros(); /* Test the macros for library version comparison */
test_libver_macros2(); /* Test the macros for library version comparison */
diff --git a/test/tmisc.c b/test/tmisc.c
index f93500d..6012588 100644
--- a/test/tmisc.c
+++ b/test/tmisc.c
@@ -1819,8 +1819,9 @@ test_misc11(void)
unsigned sym_lk; /* Symbol table B-tree leaf 'K' value */
unsigned nindexes; /* Shared message number of indexes */
H5F_info2_t finfo; /* global information about file */
- H5F_file_space_type_t strategy; /* File/free space strategy */
+ H5F_fspace_strategy_t strategy; /* File space strategy */
hsize_t threshold; /* Free-space section threshold */
+ hbool_t persist; /* To persist free-space or not */
herr_t ret; /* Generic return value */
/* Output message about test being performed */
@@ -1878,11 +1879,11 @@ test_misc11(void)
ret=H5Pset_shared_mesg_nindexes(fcpl,MISC11_NINDEXES);
CHECK(ret, FAIL, "H5Pset_shared_mesg");
- ret = H5Pset_file_space(fcpl, H5F_FILE_SPACE_VFD, (hsize_t)0);
+ ret = H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_NONE, FALSE, (hsize_t)1);
CHECK(ret, FAIL, "H5Pset_file_space");
/* Creating a file with the non-default file creation property list should
- * create a version 1 superblock
+ * create a version 2 superblock
*/
/* Create file with custom file creation property list */
@@ -1942,10 +1943,11 @@ test_misc11(void)
CHECK(ret, FAIL, "H5Pget_shared_mesg_nindexes");
VERIFY(nindexes, MISC11_NINDEXES, "H5Pget_shared_mesg_nindexes");
- ret = H5Pget_file_space(fcpl, &strategy, &threshold);
- CHECK(ret, FAIL, "H5Pget_file_space");
- VERIFY(strategy, 4, "H5Pget_file_space");
- VERIFY(threshold, 1, "H5Pget_file_space");
+ ret = H5Pget_file_space_strategy(fcpl, &strategy, &persist, &threshold);
+ CHECK(ret, FAIL, "H5Pget_file_space_strategy");
+ VERIFY(strategy, 3, "H5Pget_file_space_strategy");
+ VERIFY(persist, FALSE, "H5Pget_file_space_strategy");
+ VERIFY(threshold, 1, "H5Pget_file_space_strategy");
/* Close file */
ret=H5Fclose(file);