Merge pull request #335 in HDFFV/hdf5 from merge_page_buffering_08 to develop

* commit '0313cbb91d974b153dbe8747d193ac3c619eea3b':
  Final merge of page buffering branch to develop
This commit is contained in:
Quincey Koziol 2017-03-14 12:23:34 -05:00
commit d0aeefd645
202 changed files with 21122 additions and 5897 deletions

View File

@ -579,6 +579,7 @@
./src/H5Fmpi.c
./src/H5Fquery.c
./src/H5Fsfile.c
./src/H5Fspace.c
./src/H5Fsuper.c
./src/H5Fsuper_cache.c
./src/H5Fpkg.h
@ -793,6 +794,10 @@
./src/H5Ppublic.h
./src/H5Pstrcpl.c
./src/H5Ptest.c
./src/H5PB.c
./src/H5PBmodule.h
./src/H5PBpkg.h
./src/H5PBprivate.h
./src/H5PL.c
./src/H5PLmodule.h
./src/H5PLprivate.h
@ -895,6 +900,7 @@
./test/SWMR_UseCase_UG.txt
./test/accum.c
./test/accum_swmr_reader.c
./test/aggr.h5
./test/app_ref.c
./test/atomic_reader.c
./test/atomic_writer.c
@ -957,6 +963,8 @@
./test/flush1.c
./test/flush2.c
./test/flushrefresh.c
./test/fsm_aggr_nopersist.h5
./test/fsm_aggr_persist.h5
./test/genall5.c
./test/genall5.h
./test/gen_bad_ohdr.c
@ -966,7 +974,6 @@
./test/gen_deflate.c
./test/gen_file_image.c
./test/gen_filespace.c
./test/gen_idx.c
./test/gen_mergemsg.c
./test/gen_new_array.c
./test/gen_new_fill.c
@ -986,6 +993,12 @@
./test/getname.c
./test/gheap.c
./test/group_old.h5
./test/h5fc_ext1_f.h5
./test/h5fc_ext1_i.h5
./test/h5fc_ext2_if.h5
./test/h5fc_ext2_sf.h5
./test/h5fc_ext3_isf.h5
./test/h5fc_ext_none.h5
./test/h5test.c
./test/h5test.h
./test/hyperslab.c
@ -1002,9 +1015,13 @@
./test/multi_file_v16-r.h5
./test/multi_file_v16-s.h5
./test/noencoder.h5
./test/none.h5
./test/ntypes.c
./test/ohdr.c
./test/objcopy.c
./test/page_buffer.c
./test/paged_nopersist.h5
./test/paged_persist.h5
./test/plugin.c
./test/reserved.c
./test/pool.c
@ -1203,6 +1220,7 @@
./testpar/COPYING
./testpar/Makefile.am
./testpar/t_cache.c
./testpar/t_cache_image.c
./testpar/t_chunk_alloc.c
./testpar/t_coll_chunk.c
./testpar/t_dset.c
@ -1448,6 +1466,14 @@
./tools/test/misc/testh5mkgrp.sh.in
./tools/test/misc/testh5repart.sh.in
./tools/test/misc/talign.c
./tools/test/misc/testfiles/h5clear_missing_file.ddl
./tools/test/misc/testfiles/h5clear_no_mdc_image.ddl
./tools/test/misc/testfiles/h5clear_open_fail.ddl
./tools/test/misc/testfiles/h5clear_usage.ddl
./tools/test/misc/testfiles/mod_h5clear_mdc_image.h5
./tools/test/misc/testfiles/orig_h5clear_sec2_v0.h5
./tools/test/misc/testfiles/orig_h5clear_sec2_v2.h5
./tools/test/misc/testfiles/orig_h5clear_sec2_v3.h5
./tools/test/misc/testfiles/h5mkgrp_help.txt
./tools/test/misc/testfiles/h5mkgrp_version.txt.in
./tools/test/misc/h5perf_gentest.c
@ -1637,7 +1663,6 @@
./tools/testfiles/tdset.h5
./tools/testfiles/tdset2.h5
./tools/testfiles/tdset_idx.ls
./tools/testfiles/tdset_idx.ddl
./tools/testfiles/tdset_idx.h5
./tools/testfiles/tempty.ddl
./tools/testfiles/tempty.h5
@ -2270,7 +2295,6 @@
./tools/test/h5diff/testfiles/h5diff_457.txt
./tools/test/h5diff/testfiles/h5diff_458.txt
./tools/test/h5diff/testfiles/h5diff_459.txt
./tools/test/h5diff/testfiles/h5diff_idx.txt
./tools/test/h5diff/testfiles/h5diff_465.txt
./tools/test/h5diff/testfiles/h5diff_466.txt
./tools/test/h5diff/testfiles/h5diff_467.txt
@ -2319,8 +2343,6 @@
./tools/test/h5diff/testfiles/h5diff_basic2.h5
./tools/test/h5diff/testfiles/h5diff_dset1.h5
./tools/test/h5diff/testfiles/h5diff_dset2.h5
./tools/test/h5diff/testfiles/h5diff_dset_idx1.h5
./tools/test/h5diff/testfiles/h5diff_dset_idx2.h5
./tools/test/h5diff/testfiles/h5diff_dtypes.h5
./tools/test/h5diff/testfiles/h5diff_empty.h5
./tools/test/h5diff/testfiles/h5diff_hyper1.h5
@ -3123,7 +3145,9 @@
./tools/test/h5stat/CMakeTests.cmake
./tools/src/misc/CMakeLists.txt
./tools/test/misc/CMakeLists.txt
./tools/test/misc/CMakeTests.cmake
./tools/test/misc/CMakeTestsClear.cmake
./tools/test/misc/CMakeTestsMkgrp.cmake
./tools/test/misc/CMakeTestsRepart.cmake
./tools/test/misc/vds/CMakeLists.txt
./tools/test/perform/CMakeLists.txt
./tools/test/perform/CMakeTests.cmake

View File

@ -49,9 +49,11 @@ $Source = "";
"H5E_error_t" => "Ee",
"H5E_type_t" => "Et",
"H5F_close_degree_t" => "Fd",
"H5F_fspace_strategy_t" => "Ff",
"H5F_file_space_type_t" => "Ff",
"H5F_mem_t" => "Fm",
"H5F_scope_t" => "Fs",
"H5F_fspace_type_t" => "Ft",
"H5F_libver_t" => "Fv",
"H5G_obj_t" => "Go",
"H5G_stat_t" => "Gs",

View File

@ -1,7 +1,7 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
* Copyright by the Board of Trustees of the University of Illinois. *
/* All rights reserved. *
* All rights reserved. *
* *
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *

View File

@ -294,6 +294,7 @@ unsigned FileCreatPropList::getIstorek() const
return(ik);
}
#ifndef H5_NO_DEPRECATED_SYMBOLS
//--------------------------------------------------------------------------
// Function: FileCreatPropList::setFileSpace
///\brief Sets the strategy and the threshold value that the library
@ -364,6 +365,7 @@ hsize_t FileCreatPropList::getFileSpaceThreshold() const
}
return(threshold);
}
#endif /* H5_NO_DEPRECATED_SYMBOLS */
//--------------------------------------------------------------------------
// Function: FileCreatPropList destructor

View File

@ -65,6 +65,7 @@ class H5_DLLCPP FileCreatPropList : public PropList {
// indexing chunked datasets.
void setIstorek(unsigned ik) const;
#ifndef H5_NO_DEPRECATED_SYMBOLS
// Sets the strategy and the threshold value that the library will
// will employ in managing file space.
void setFileSpace(H5F_file_space_type_t strategy, hsize_t threshold) const;
@ -75,6 +76,7 @@ class H5_DLLCPP FileCreatPropList : public PropList {
// Returns the threshold value that the library uses in tracking free
// space sections.
hsize_t getFileSpaceThreshold() const;
#endif /* H5_NO_DEPRECATED_SYMBOLS */
///\brief Returns this class name.
virtual H5std_string fromClass() const { return("FileCreatPropList"); }

View File

@ -817,12 +817,14 @@ static void test_file_info()
// Output message about test being performed
SUBTEST("File general information");
#ifndef H5_NO_DEPRECATED_SYMBOLS
hsize_t in_threshold = 2; // Free space section threshold to set */
hsize_t out_threshold = 0; // Free space section threshold to get */
// File space handling strategy
H5F_file_space_type_t in_strategy = H5F_FILE_SPACE_ALL;
// File space handling strategy
H5F_file_space_type_t out_strategy = H5F_FILE_SPACE_DEFAULT;
#endif /* H5_NO_DEPRECATED_SYMBOLS */
try {
// Create a file using default properties.
@ -846,7 +848,9 @@ static void test_file_info()
fcpl.setSizes(F2_OFFSET_SIZE, F2_LENGTH_SIZE);
fcpl.setSymk(F2_SYM_INTERN_K, F2_SYM_LEAF_K);
fcpl.setIstorek(F2_ISTORE);
#ifndef H5_NO_DEPRECATED_SYMBOLS
fcpl.setFileSpace(in_strategy, in_threshold);
#endif /* H5_NO_DEPRECATED_SYMBOLS */
// Creating a file with the non-default file creation property list
// should create a version 1 superblock
@ -859,7 +863,11 @@ static void test_file_info()
// Get the file's version information.
file7.getFileInfo(finfo);
#ifndef H5_NO_DEPRECATED_SYMBOLS
verify_val(finfo.super.version, 2, "H5File::getFileInfo", __LINE__, __FILE__);
#else /* H5_NO_DEPRECATED_SYMBOLS */
verify_val(finfo.super.version, 1, "H5File::getFileInfo", __LINE__, __FILE__);
#endif /* H5_NO_DEPRECATED_SYMBOLS */
verify_val(finfo.free.version, 0, "H5File::getFileInfo", __LINE__, __FILE__);
verify_val(finfo.sohm.version, 0, "H5File::getFileInfo", __LINE__, __FILE__);
@ -874,7 +882,11 @@ static void test_file_info()
// Get the file's version information.
file7.getFileInfo(finfo);
#ifndef H5_NO_DEPRECATED_SYMBOLS
verify_val(finfo.super.version, 2, "H5File::getFileInfo", __LINE__, __FILE__);
#else /* H5_NO_DEPRECATED_SYMBOLS */
verify_val(finfo.super.version, 1, "H5File::getFileInfo", __LINE__, __FILE__);
#endif /* H5_NO_DEPRECATED_SYMBOLS */
verify_val(finfo.free.version, 0, "H5File::getFileInfo", __LINE__, __FILE__);
verify_val(finfo.sohm.version, 0, "H5File::getFileInfo", __LINE__, __FILE__);
@ -900,12 +912,14 @@ static void test_file_info()
VERIFY(nindexes, MISC11_NINDEXES, "H5Pget_shared_mesg_nindexes");
*/
#ifndef H5_NO_DEPRECATED_SYMBOLS
// Get and verify the file space info from the creation property list */
out_strategy = fcpl2.getFileSpaceStrategy();
verify_val(static_cast<unsigned>(out_strategy), static_cast<unsigned>(in_strategy), "FileCreatPropList::getFileSpaceStrategy", __LINE__, __FILE__);
out_threshold = fcpl2.getFileSpaceThreshold();
verify_val(static_cast<unsigned>(out_threshold), static_cast<unsigned>(in_threshold), "FileCreatPropList::getFileSpaceThreshold", __LINE__, __FILE__);
#endif /* H5_NO_DEPRECATED_SYMBOLS */
PASSED();
} // end of try block

View File

@ -729,7 +729,7 @@ CONTAINS
CALL h5fget_freespace_f(fid, free_space, error)
CALL check("h5fget_freespace_f",error,total_error)
if(error .eq.0 .and. free_space .ne. 0) then
if(error .eq.0 .and. free_space .ne. 1248) then
total_error = total_error + 1
write(*,*) "1: Wrong amount of free space reported, ", free_space
endif
@ -745,7 +745,7 @@ CONTAINS
! Check the free space now
CALL h5fget_freespace_f(fid, free_space, error)
CALL check("h5fget_freespace_f",error,total_error)
if(error .eq.0 .and. free_space .ne. 0) then
if(error .eq.0 .and. free_space .ne. 216) then
total_error = total_error + 1
write(*,*) "2: Wrong amount of free space reported, ", free_space
endif
@ -757,7 +757,7 @@ CONTAINS
! Check the free space now
CALL h5fget_freespace_f(fid, free_space, error)
CALL check("h5fget_freespace_f",error,total_error)
if(error .eq.0 .and. free_space .ne. 0) then
if(error .eq.0 .and. free_space .ne. 1248) then
total_error = total_error + 1
write(*,*) "3: Wrong amount of free space reported, ", free_space
endif

View File

@ -5356,39 +5356,24 @@ public class H5 implements java.io.Serializable {
throws HDF5LibraryException, IllegalArgumentException;
/**
* H5Pset_file_space sets the file space management strategy for the file associated with fcpl_id to strategy.
* H5Pset_file_space_strategy sets the file space management strategy for the file associated with fcpl_id to strategy.
* There are four strategies that applications can select and they are described in the Parameters section.
*
* @param fcpl_id
* IN: File creation property list identifier
* @param strategy
* IN: The strategy for file space management.
* Passing a value of zero (0) indicates that the value of strategy is not to be modified.
* H5F_FILE_SPACE_ALL_PERSIST
* With this strategy, the free-space managers track the free space that results from the
* manipulation of HDF5 objects in the HDF5 file. The free space information is saved when the
* file is closed, and reloaded when the file is reopened. When space is needed for file metadata
* or raw data, the HDF5 library first requests space from the library's free-space managers.
* If the request is not satisfied, the library requests space from the aggregators. If the request
* is still not satisfied, the library requests space from the virtual file driver. That is, the
* library will use all of the mechanisms for allocating space.
* H5F_FILE_SPACE_ALL (Default file space management strategy)
* With this strategy, the free-space managers track the free space that results from the manipulation
* of HDF5 objects in the HDF5 file. The free space information is NOT saved when the file is closed
* and the free space that exists upon file closing becomes unaccounted space in the file.
* Like the previous strategy, the library will try all of the mechanisms for allocating space. When
* space is needed for file metadata or raw data, the library first requests space from the free-space
* managers. If the request is not satisfied, the library requests space from the aggregators. If the
* request is still not satisfied, the library requests space from the virtual file driver.
* H5F_FILE_SPACE_AGGR_VFD
* With this strategy, the library does not track free space that results from the manipulation of HDF5
* obejcts in the HDF5 file and the free space becomes unaccounted space in the file.
* When space is needed for file metadata or raw data, the library first requests space from the
* aggregators. If the request is not satisfied, the library requests space from the virtual file driver.
* H5F_FILE_SPACE_VFD
* With this strategy, the library does not track free space that results from the manipulation of HDF5
* obejcts in the HDF5 file and the free space becomes unaccounted space in the file.
* When space is needed for file metadata or raw data, the library requests space from the virtual file driver.
* H5F_FSPACE_STRATEGY_FSM_AGGR
* Mechanisms: free-space managers, aggregators, and virtual file drivers
* This is the library default when not set.
* H5F_FSPACE_STRATEGY_PAGE
* Mechanisms: free-space managers with embedded paged aggregation and virtual file drivers
* H5F_FSPACE_STRATEGY_AGGR
* Mechanisms: aggregators and virtual file drivers
* H5F_FSPACE_STRATEGY_NONE
* Mechanisms: virtual file drivers
* @param persist
* IN: True to persist free-space.
* @param threshold
* IN: The free-space section threshold. The library default is 1, which is to track all free-space sections.
* Passing a value of zero (0) indicates that the value of threshold is not to be modified.
@ -5399,28 +5384,100 @@ public class H5 implements java.io.Serializable {
* - Invalid values of max_list and min_btree.
*
**/
public synchronized static native void H5Pset_file_space(long fcpl_id, int strategy, long threshold)
public synchronized static native void H5Pset_file_space_strategy(long fcpl_id, int strategy, boolean persist, long threshold)
throws HDF5LibraryException, IllegalArgumentException;
/**
* H5Pget_file_space provides the means for applications to manage the HDF5 file's file space for their specific needs.
* H5Pget_file_space_strategy provides the means for applications to manage the HDF5 file's file space strategy for their specific needs.
*
* @param fcpl_id
* IN: File creation property list identifier
* @param strategy
* IN/OUT: The current file space management strategy in use for the file. NULL, strategy not queried.
* @param persist
* IN/OUT: The current free-space persistence. NULL, persist not queried.
* @param threshold
* IN/OUT: The current free-space section threshold. NULL, threshold not queried.
*
* @return the current free-space strategy.
*
* @exception HDF5LibraryException
* - Error from the HDF-5 Library.
* @exception IllegalArgumentException
* - Invalid values of max_list and min_btree.
*
**/
public synchronized static native void H5Pget_file_space(long fcpl_id, int[] strategy, long[] threshold)
public synchronized static native int H5Pget_file_space_strategy(long fcpl_id, boolean[] persist, long[] threshold)
throws HDF5LibraryException, IllegalArgumentException;
/**
* H5Pget_file_space_strategy_persist provides the means for applications to manage the HDF5 file's file space strategy for their specific needs.
*
* @param fcpl_id
* IN: File creation property list identifier
*
* @return the current free-space persistence.
*
* @exception HDF5LibraryException
* - Error from the HDF-5 Library.
* @exception IllegalArgumentException
* - Invalid values of max_list and min_btree.
*
**/
public synchronized static native boolean H5Pget_file_space_strategy_persist(long fcpl_id)
throws HDF5LibraryException, IllegalArgumentException;
/**
* H5Pget_file_space_strategy_threshold provides the means for applications to manage the HDF5 file's file space strategy for their specific needs.
*
* @param fcpl_id
* IN: File creation property list identifier
*
* @return the current free-space section threshold.
*
* @exception HDF5LibraryException
* - Error from the HDF-5 Library.
* @exception IllegalArgumentException
* - Invalid values of max_list and min_btree.
*
**/
public synchronized static native long H5Pget_file_space_strategy_threshold(long fcpl_id)
throws HDF5LibraryException, IllegalArgumentException;
/**
* H5Pset_file_space_page_size retrieves the file space page size for aggregating small metadata or raw data.
*
* @param fcpl_id
* IN: File creation property list identifier
* @param page_size
* IN: the file space page size.
*
*
* @exception HDF5LibraryException
* - Error from the HDF-5 Library.
* @exception IllegalArgumentException
* - Invalid values of max_list and min_btree.
*
**/
public synchronized static native void H5Pset_file_space_page_size(long fcpl_id, long page_size)
throws HDF5LibraryException, IllegalArgumentException;
/**
* H5Pget_file_space_page_size Sets the file space page size for paged aggregation.
*
* @param fcpl_id
* IN: File creation property list identifier
*
* @return the current file space page size.
*
* @exception HDF5LibraryException
* - Error from the HDF-5 Library.
* @exception IllegalArgumentException
* - Invalid values of max_list and min_btree.
*
**/
public synchronized static native long H5Pget_file_space_page_size(long fcpl_id)
throws HDF5LibraryException, IllegalArgumentException;
// File access property list (FAPL) routines
/**

View File

@ -219,12 +219,12 @@ public class HDF5Constants {
public static final int H5F_SCOPE_GLOBAL = H5F_SCOPE_GLOBAL();
public static final int H5F_SCOPE_LOCAL = H5F_SCOPE_LOCAL();
public static final int H5F_UNLIMITED = H5F_UNLIMITED();
public static final int H5F_FILE_SPACE_DEFAULT = H5F_FILE_SPACE_DEFAULT();
public static final int H5F_FILE_SPACE_ALL_PERSIST = H5F_FILE_SPACE_ALL_PERSIST();
public static final int H5F_FILE_SPACE_ALL = H5F_FILE_SPACE_ALL();
public static final int H5F_FILE_SPACE_AGGR_VFD = H5F_FILE_SPACE_AGGR_VFD();
public static final int H5F_FILE_SPACE_VFD = H5F_FILE_SPACE_VFD();
public static final int H5F_FILE_SPACE_NTYPES = H5F_FILE_SPACE_NTYPES();
public static final int H5F_FSPACE_STRATEGY_FSM_AGGR = H5F_FSPACE_STRATEGY_FSM_AGGR();
public static final int H5F_FSPACE_STRATEGY_AGGR = H5F_FSPACE_STRATEGY_AGGR();
public static final int H5F_FSPACE_STRATEGY_PAGE = H5F_FSPACE_STRATEGY_PAGE();
public static final int H5F_FSPACE_STRATEGY_NONE = H5F_FSPACE_STRATEGY_NONE();
public static final int H5F_FSPACE_STRATEGY_NTYPES = H5F_FSPACE_STRATEGY_NTYPES();
public static final long H5FD_CORE = H5FD_CORE();
public static final long H5FD_DIRECT = H5FD_DIRECT();
@ -1024,17 +1024,15 @@ public class HDF5Constants {
private static native final int H5F_UNLIMITED();
private static native final int H5F_FILE_SPACE_DEFAULT();
private static native final int H5F_FSPACE_STRATEGY_FSM_AGGR();
private static native final int H5F_FILE_SPACE_ALL_PERSIST();
private static native final int H5F_FSPACE_STRATEGY_AGGR();
private static native final int H5F_FILE_SPACE_ALL();
private static native final int H5F_FSPACE_STRATEGY_PAGE();
private static native final int H5F_FILE_SPACE_AGGR_VFD();
private static native final int H5F_FSPACE_STRATEGY_NONE();
private static native final int H5F_FILE_SPACE_VFD();
private static native final int H5F_FILE_SPACE_NTYPES();
private static native final int H5F_FSPACE_STRATEGY_NTYPES();
private static native final long H5FD_CORE();

View File

@ -403,17 +403,15 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5F_1UNLIMITED(JNIEnv *env, jclass cls) { return (jint)H5F_UNLIMITED; }
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5F_1FILE_1SPACE_1DEFAULT(JNIEnv *env, jclass cls) { return H5F_FILE_SPACE_DEFAULT; }
Java_hdf_hdf5lib_HDF5Constants_H5F_1FSPACE_1STRATEGY_1FSM_1AGGR(JNIEnv *env, jclass cls) { return H5F_FSPACE_STRATEGY_FSM_AGGR; }
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5F_1FILE_1SPACE_1ALL_1PERSIST(JNIEnv *env, jclass cls) { return H5F_FILE_SPACE_ALL_PERSIST; }
Java_hdf_hdf5lib_HDF5Constants_H5F_1FSPACE_1STRATEGY_1AGGR(JNIEnv *env, jclass cls) { return H5F_FSPACE_STRATEGY_AGGR; }
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5F_1FILE_1SPACE_1ALL(JNIEnv *env, jclass cls) { return H5F_FILE_SPACE_ALL; }
Java_hdf_hdf5lib_HDF5Constants_H5F_1FSPACE_1STRATEGY_1PAGE(JNIEnv *env, jclass cls) { return H5F_FSPACE_STRATEGY_PAGE; }
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5F_1FILE_1SPACE_1AGGR_1VFD(JNIEnv *env, jclass cls) { return H5F_FILE_SPACE_AGGR_VFD; }
Java_hdf_hdf5lib_HDF5Constants_H5F_1FSPACE_1STRATEGY_1NONE(JNIEnv *env, jclass cls) { return H5F_FSPACE_STRATEGY_NONE; }
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5F_1FILE_1SPACE_1VFD(JNIEnv *env, jclass cls) { return H5F_FILE_SPACE_VFD; }
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5F_1FILE_1SPACE_1NTYPES(JNIEnv *env, jclass cls) { return H5F_FILE_SPACE_NTYPES; }
Java_hdf_hdf5lib_HDF5Constants_H5F_1FSPACE_1STRATEGY_1NTYPES(JNIEnv *env, jclass cls) { return H5F_FSPACE_STRATEGY_NTYPES; }
JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5FD_1CORE(JNIEnv *env, jclass cls) { return H5FD_CORE; }

View File

@ -4883,61 +4883,130 @@ Java_hdf_hdf5lib_H5_H5Pset_1virtual_1printf_1gap
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pget_file_space
* Signature: (J[I[J)V
* Method: H5Pget_file_space_strategy
* Signature: (J[Z[J)I
*/
JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Pget_1file_1space
(JNIEnv *env, jclass clss, jlong fcpl_id, jintArray strategy, jlongArray threshold)
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Pget_1file_1space_1strategy
(JNIEnv *env, jclass clss, jlong fcpl_id, jbooleanArray persist, jlongArray threshold)
{
herr_t status = -1;
jint *thestrategyArray = NULL;
H5F_fspace_strategy_t thestrategy = H5F_FSPACE_STRATEGY_FSM_AGGR; /* Library default */
jlong *thethresholdArray = NULL;
jboolean *thepersistArray = NULL;
jboolean isCopy;
if (strategy) {
thestrategyArray = (jint*)ENVPTR->GetIntArrayElements(ENVPAR strategy, &isCopy);
if (thestrategyArray == NULL) {
h5JNIFatalError(env, "H5Pget_file_space: strategy not pinned");
return;
if (persist) {
thepersistArray = (jboolean*)ENVPTR->GetBooleanArrayElements(ENVPAR persist, &isCopy);
if (thepersistArray == NULL) {
h5JNIFatalError(env, "H5Pget_file_space: persist not pinned");
return -1;
}
}
if (threshold) {
thethresholdArray = (jlong*)ENVPTR->GetLongArrayElements(ENVPAR threshold, &isCopy);
if (thethresholdArray == NULL) {
if (strategy) ENVPTR->ReleaseIntArrayElements(ENVPAR strategy, thestrategyArray, JNI_ABORT);
if (persist) ENVPTR->ReleaseBooleanArrayElements(ENVPAR persist, thepersistArray, JNI_ABORT);
h5JNIFatalError(env, "H5Pget_file_space: threshold not pinned");
return;
return -1;
} /* end if */
} /* end if */
status = H5Pget_file_space((hid_t)fcpl_id, (H5F_file_space_type_t*)thestrategyArray, (hsize_t*)thethresholdArray);
status = H5Pget_file_space_strategy((hid_t)fcpl_id, &thestrategy, (hbool_t*)thepersistArray, (hsize_t*)thethresholdArray);
if (status < 0) {
if (strategy) ENVPTR->ReleaseIntArrayElements(ENVPAR strategy, thestrategyArray, JNI_ABORT);
if (persist) ENVPTR->ReleaseBooleanArrayElements(ENVPAR persist, thepersistArray, JNI_ABORT);
if (threshold) ENVPTR->ReleaseLongArrayElements(ENVPAR threshold, thethresholdArray, JNI_ABORT);
h5libraryError(env);
} /* end if */
else {
if (strategy) ENVPTR->ReleaseIntArrayElements(ENVPAR strategy, thestrategyArray, 0);
if (persist) ENVPTR->ReleaseBooleanArrayElements(ENVPAR persist, thepersistArray, 0);
if (threshold) ENVPTR->ReleaseLongArrayElements(ENVPAR threshold, thethresholdArray, 0);
} /* end else */
} /* end Java_hdf_hdf5lib_H5_H5Pget_1file_1space */
return (jint)thestrategy;
} /* end Java_hdf_hdf5lib_H5_H5Pget_1file_1space_1strategy */
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pset_file_space
* Signature: (JIJ)V
* Method: H5Pget_file_space_strategy_persist
* Signature: (J)Z
*/
JNIEXPORT jboolean JNICALL
Java_hdf_hdf5lib_H5_H5Pget_1file_1space_1strategy_1persist
(JNIEnv *env, jclass clss, jlong fcpl_id)
{
herr_t status = -1;
hbool_t thepersist = FALSE;
status = H5Pget_file_space_strategy((hid_t)fcpl_id, NULL, &thepersist, NULL);
if (status < 0)
h5libraryError(env);
return (jboolean)thepersist;
} /* end Java_hdf_hdf5lib_H5_H5Pget_1file_1space_1strategy_1persist */
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pget_file_space_strategy_threshold
* Signature: (J)J
*/
JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5_H5Pget_1file_1space_1strategy_1threshold
(JNIEnv *env, jclass clss, jlong fcpl_id)
{
herr_t status = -1;
hsize_t thethreshold;
status = H5Pget_file_space_strategy((hid_t)fcpl_id, NULL, NULL, &thethreshold);
if (status < 0)
h5libraryError(env);
return (jlong)thethreshold;
} /* end Java_hdf_hdf5lib_H5_H5Pget_1file_1space_1threshold */
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pset_file_space_strategy
* Signature: (JIZJ)V
*/
JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Pset_1file_1space
(JNIEnv *env, jclass clss, jlong fcpl_id, jint strategy, jlong threshold)
Java_hdf_hdf5lib_H5_H5Pset_1file_1space_1strategy
(JNIEnv *env, jclass clss, jlong fcpl_id, jint strategy, jboolean persist, jlong threshold)
{
if (H5Pset_file_space((hid_t)fcpl_id, (H5F_file_space_type_t)strategy, (hsize_t)threshold) < 0)
if (H5Pset_file_space_strategy((hid_t)fcpl_id, (H5F_fspace_strategy_t)strategy, (hbool_t)persist, (hsize_t)threshold) < 0)
h5libraryError(env);
} /* end Java_hdf_hdf5lib_H5_H5Pset_1file_1space */
} /* end Java_hdf_hdf5lib_H5_H5Pset_file_space_strategy */
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pset_file_space_page_size
* Signature: (JJ)V
*/
JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Pset_1file_1space_1page_1size
(JNIEnv *env, jclass clss, jlong fcpl_id, jlong fsp_size)
{
if (H5Pset_file_space_page_size((hid_t)fcpl_id, (hsize_t)fsp_size) < 0)
h5libraryError(env);
}
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pget_file_space_page_size
* Signature: (J)J
*/
JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5_H5Pget_1file_1space_1page_1size
(JNIEnv *env, jclass clss, jlong fcpl_id)
{
hsize_t fsp_size = 0;
if (H5Pget_file_space_page_size((hid_t)fcpl_id, &fsp_size) < 0)
h5libraryError(env);
return (jlong)fsp_size;
}
static herr_t
H5P_cls_create_cb

View File

@ -1385,22 +1385,57 @@ Java_hdf_hdf5lib_H5_H5Pset_1virtual_1printf_1gap
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pget_file_space
* Signature: (J[I[J)V
* Method: H5Pget_file_space_strategy
* Signature: (J[Z[J)I
*/
JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Pget_1file_1space
(JNIEnv *, jclass, jlong, jintArray, jlongArray);
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Pget_1file_1space_1strategy
(JNIEnv *, jclass, jlong, jbooleanArray, jlongArray);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pset_file_space
* Signature: (JIJ)V
* Method: H5Pget_file_space_strategy_persist
* Signature: (J)Z
*/
JNIEXPORT jboolean JNICALL
Java_hdf_hdf5lib_H5_H5Pget_1file_1space_1strategy_1persist
(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pget_file_space_strategy_threshold
* Signature: (J)J
*/
JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5_H5Pget_1file_1space_1strategy_1threshold
(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pset_file_space_strategy
* Signature: (JIZJ)V
*/
JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Pset_1file_1space
(JNIEnv *, jclass, jlong, jint, jlong);
Java_hdf_hdf5lib_H5_H5Pset_1file_1space_1strategy
(JNIEnv *, jclass, jlong, jint, jboolean, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pget_file_space_page_size
* Signature: (J)J
*/
JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5_H5Pget_1file_1space_1page_1size
(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pset_file_space_page_size
* Signature: (JJ)V
*/
JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Pset_1file_1space_1page_1size
(JNIEnv *, jclass, jlong, jlong);
/*
* Class: hdf_hdf5lib_H5

View File

@ -416,6 +416,7 @@ JUnit version 4.11
.testH5P_layout
.testH5Pget_link_creation_order
.testH5Pset_shared_mesg_nindexes_InvalidHIGHnindexes
.testH5P_file_space_page_size
.testH5Pget_shared_mesg_index_Invalid_indexnum
.testH5Pset_data_transform_NullExpression
.testH5Pset_elink_prefix_null
@ -438,9 +439,9 @@ JUnit version 4.11
.testH5Pset_shared_mesg_index
.testH5Pset_copy_object
.testH5Pset_link_creation_order_trackedPLUSindexed
.testH5P_file_space_strategy
.testH5Pset_copy_object_invalidobject
.testH5Pset_est_link_info_InvalidValues
.testH5P_file_space
.testH5Pset_local_heap_size_hint
.testH5Pget_est_link_info
.testH5Pset_scaleoffset
@ -638,7 +639,7 @@ JUnit version 4.11
Time: XXXX
OK (636 tests)
OK (637 tests)
HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs):
#000: (file name) line (number) in H5Fopen(): can't set access and transfer property lists

View File

@ -1198,25 +1198,40 @@ public class TestH5P {
}
@Test
public void testH5P_file_space() {
public void testH5P_file_space_strategy() {
long[] threshold = {0};
int[] strategy = {0};
boolean[] persist = {false};
int strategy = 0;
try {
H5.H5Pget_file_space(fcpl_id, strategy, threshold);
assertTrue("strategy: "+strategy[0], strategy[0] == HDF5Constants.H5F_FILE_SPACE_ALL);
strategy = H5.H5Pget_file_space_strategy(fcpl_id, persist, threshold);
assertTrue("strategy(default): "+strategy, strategy == HDF5Constants.H5F_FSPACE_STRATEGY_FSM_AGGR);
assertTrue("persist(default): "+persist[0], persist[0] == false);
assertTrue("theshold(default): "+threshold[0], threshold[0] == 1);
H5.H5Pset_file_space_strategy(fcpl_id, HDF5Constants.H5F_FSPACE_STRATEGY_PAGE, true, 1);
strategy = H5.H5Pget_file_space_strategy(fcpl_id, persist, threshold);
assertTrue("strategy: "+strategy, strategy == HDF5Constants.H5F_FSPACE_STRATEGY_PAGE);
assertTrue("persist: "+persist[0], persist[0] == true);
assertTrue("theshold: "+threshold[0], threshold[0] == 1);
H5.H5Pset_file_space(fcpl_id, HDF5Constants.H5F_FILE_SPACE_ALL_PERSIST, 10);
H5.H5Pget_file_space(fcpl_id, strategy, threshold);
assertTrue("strategy: "+strategy[0], strategy[0] == HDF5Constants.H5F_FILE_SPACE_ALL_PERSIST);
assertTrue("theshold: "+threshold[0], threshold[0] == 10);
H5.H5Pset_file_space(fcpl_id, HDF5Constants.H5F_FILE_SPACE_VFD, 0);
H5.H5Pget_file_space(fcpl_id, strategy, threshold);
assertTrue("strategy: "+strategy[0], strategy[0] == HDF5Constants.H5F_FILE_SPACE_VFD);
assertTrue("theshold: "+threshold[0], threshold[0] == 10);
}
catch (Throwable err) {
err.printStackTrace();
fail("testH5P_file_space: " + err);
fail("testH5P_file_space_strategy: " + err);
}
}
@Test
public void testH5P_file_space_page_size() {
long page_size = 0;
try {
page_size = H5.H5Pget_file_space_page_size(fcpl_id);
assertTrue("page_size(default): "+page_size, page_size == 4096);
H5.H5Pset_file_space_page_size(fcpl_id, 512);
page_size = H5.H5Pget_file_space_page_size(fcpl_id);
assertTrue("page_size: "+page_size, page_size == 512);
}
catch (Throwable err) {
err.printStackTrace();
fail("testH5P_file_space_page_size: " + err);
}
}
}

View File

@ -195,6 +195,7 @@ set (H5F_SOURCES
${HDF5_SRC_DIR}/H5Fmpi.c
${HDF5_SRC_DIR}/H5Fquery.c
${HDF5_SRC_DIR}/H5Fsfile.c
${HDF5_SRC_DIR}/H5Fspace.c
${HDF5_SRC_DIR}/H5Fsuper.c
${HDF5_SRC_DIR}/H5Fsuper_cache.c
${HDF5_SRC_DIR}/H5Ftest.c
@ -504,6 +505,15 @@ set (H5P_HDRS
)
IDE_GENERATED_PROPERTIES ("H5P" "${H5P_HDRS}" "${H5P_SOURCES}" )
set (H5PB_SOURCES
${HDF5_SRC_DIR}/H5PB.c
)
set (H5PB_HDRS
${HDF5_SRC_DIR}/H5PBpkg.h
)
IDE_GENERATED_PROPERTIES ("H5PB" "${H5PB_HDRS}" "${H5PB_SOURCES}" )
set (H5PL_SOURCES
${HDF5_SRC_DIR}/H5PL.c
)
@ -699,6 +709,7 @@ set (common_SRCS
${H5MP_SOURCES}
${H5O_SOURCES}
${H5P_SOURCES}
${H5PB_SOURCES}
${H5PL_SOURCES}
${H5R_SOURCES}
${H5UC_SOURCES}
@ -739,6 +750,7 @@ set (H5_PUBLIC_HEADERS
${H5MP_HDRS}
${H5O_HDRS}
${H5P_HDRS}
${H5PB_HDRS}
${H5PL_HDRS}
${H5R_HDRS}
${H5S_HDRS}
@ -777,6 +789,7 @@ set (H5_PRIVATE_HEADERS
${HDF5_SRC_DIR}/H5MPprivate.h
${HDF5_SRC_DIR}/H5Oprivate.h
${HDF5_SRC_DIR}/H5Pprivate.h
${HDF5_SRC_DIR}/H5PBprivate.h
${HDF5_SRC_DIR}/H5PLprivate.h
${HDF5_SRC_DIR}/H5UCprivate.h
${HDF5_SRC_DIR}/H5Rprivate.h

View File

@ -351,6 +351,44 @@ H5AC_term_package(void)
FUNC_LEAVE_NOAPI(n)
} /* end H5AC_term_package() */
/*-------------------------------------------------------------------------
*
* Function: H5AC_cache_image_pending()
*
* Purpose: Debugging function that tests to see if the load of a
* metadata cache image load is pending (i.e. will be executed
* on the next protect or insert)
*
* Returns TRUE if a cache image load is pending, and FALSE
* if not. Throws an assertion failure on error.
*
* Return: TRUE if a cache image load is pending, and FALSE otherwise.
*
* Programmer: John Mainzer, 1/10/17
*
* Changes: None.
*
*-------------------------------------------------------------------------
*/
hbool_t
H5AC_cache_image_pending(const H5F_t *f)
{
H5C_t *cache_ptr;
hbool_t ret_value = FALSE; /* Return value */
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Sanity checks */
HDassert(f);
HDassert(f->shared);
cache_ptr = f->shared->cache;
ret_value = H5C_cache_image_pending(cache_ptr);
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_cache_image_pending() */
/*-------------------------------------------------------------------------
* Function: H5AC_create
@ -833,6 +871,46 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_flush() */
/*-------------------------------------------------------------------------
* Function: H5AC_force_cache_image_load()
*
* Purpose: On rare occasions, it is necessary to run
* H5MF_tidy_self_referential_fsm_hack() prior to the first
* metadata cache access. This is a problem as if there is a
* cache image at the end of the file, that routine will
* discard it.
*
* We solve this issue by calling this function, which will
* load the cache image and then call
* H5MF_tidy_self_referential_fsm_hack() to discard it.
*
* Return: SUCCEED on success, and FAIL on failure.
*
* Programmer: John Mainzer
* 1/11/17
*
*-------------------------------------------------------------------------
*/
herr_t
H5AC_force_cache_image_load(H5F_t *f, hid_t dxpl_id)
{
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity checks */
HDassert(f);
HDassert(f->shared);
HDassert(f->shared->cache);
if(H5C_force_cache_image_load(f, dxpl_id) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTLOAD, FAIL, "Can't load cache image")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_force_cache_image_load() */
/*-------------------------------------------------------------------------
* Function: H5AC_get_entry_status
@ -3117,6 +3195,48 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_unsettle_entry_ring() */
/*-------------------------------------------------------------------------
* Function: H5AC_unsettle_ring()
*
* Purpose: Advise the metadata cache that the specified free space
* manager ring is no longer settled (if it was on entry).
*
* If the target free space manager ring is already
* unsettled, do nothing, and return SUCCEED.
*
* If the target free space manager ring is settled, and
* we are not in the process of a file shutdown, mark
* the ring as unsettled, and return SUCCEED.
*
* If the target free space manager is settled, and we
* are in the process of a file shutdown, post an error
* message, and return FAIL.
*
* Note that this function simply passes the call on to
* the metadata cache proper, and returns the result.
*
* Return: Non-negative on success/Negative on failure
*
* Programmer: John Mainzer
* 10/15/16
*
*-------------------------------------------------------------------------
*/
herr_t
H5AC_unsettle_ring(H5F_t * f, H5C_ring_t ring)
{
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
if(FAIL == (ret_value = H5C_unsettle_ring(f, ring)))
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_unsettle_ring() failed")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_unsettle_ring() */
/*-------------------------------------------------------------------------
* Function: H5AC_remove_entry()

View File

@ -451,6 +451,8 @@ H5_DLL herr_t H5AC_validate_config(H5AC_cache_config_t *config_ptr);
H5_DLL herr_t H5AC_load_cache_image_on_next_protect(H5F_t *f, haddr_t addr,
hsize_t len, hbool_t rw);
H5_DLL herr_t H5AC_validate_cache_image_config(H5AC_cache_image_config_t *config_ptr);
H5_DLL hbool_t H5AC_cache_image_pending(const H5F_t *f);
H5_DLL herr_t H5AC_force_cache_image_load(H5F_t * f, hid_t dxpl_id);
/* Tag & Ring routines */
H5_DLL herr_t H5AC_tag(hid_t dxpl_id, haddr_t metadata_tag, haddr_t *prev_tag);
@ -464,6 +466,7 @@ H5_DLL herr_t H5AC_set_ring(hid_t dxpl_id, H5AC_ring_t ring, H5P_genplist_t **dx
H5AC_ring_t *orig_ring);
H5_DLL herr_t H5AC_reset_ring(H5P_genplist_t *dxpl, H5AC_ring_t orig_ring);
H5_DLL herr_t H5AC_unsettle_entry_ring(void *entry);
H5_DLL herr_t H5AC_unsettle_ring(H5F_t * f, H5AC_ring_t ring);
H5_DLL herr_t H5AC_expunge_tag_type_metadata(H5F_t *f, hid_t dxpl_id, haddr_t tag, int type_id, unsigned flags);
H5_DLL herr_t H5AC_get_tag(const void *thing, /*OUT*/ haddr_t *tag);

126
src/H5C.c
View File

@ -732,7 +732,8 @@ herr_t
H5C_prep_for_file_close(H5F_t *f, hid_t dxpl_id)
{
H5C_t * cache_ptr;
herr_t ret_value = SUCCEED; /* Return value */
hbool_t image_generated = FALSE; /* Whether a cache image was generated */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@ -756,9 +757,48 @@ H5C_prep_for_file_close(H5F_t *f, hid_t dxpl_id)
HDassert(cache_ptr->pl_len == 0);
/* Prepare cache image */
if(H5C__prep_image_for_file_close(f, dxpl_id) < 0)
if(H5C__prep_image_for_file_close(f, dxpl_id, &image_generated) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTCREATE, FAIL, "can't create cache image")
#ifdef H5_HAVE_PARALLEL
if(!image_generated && cache_ptr->aux_ptr != NULL && f->shared->fs_persist) {
/* If persistent free space managers are enabled, flushing the
* metadata cache may result in the deletion, insertion, and/or
* dirtying of entries.
*
* This is a problem in PHDF5, as it breaks two invariants of
* our management of the metadata cache across all processes:
*
* 1) Entries will not be dirtied, deleted, inserted, or moved
* during flush in the parallel case.
*
* 2) All processes contain the same set of dirty metadata
* entries on entry to a sync point.
*
* To solve this problem for the persistent free space managers,
* serialize the metadata cache on all processes prior to the
* first sync point on file shutdown. The shutdown warning is
* a convenient location for this call.
*
* This is sufficient since:
*
* 1) FSM settle routines are only invoked on file close. Since
* serialization make the same settle calls as flush on file
* close, and since the close warning is issued after all
* non FSM related space allocations and just before the
* first sync point on close, this call will leave the caches
* in a consistant state across the processes if they were
* consistant before.
*
* 2) Since the FSM settle routines are only invoked once during
* file close, invoking them now will prevent their invocation
* during a flush, and thus avoid any resulting entrie dirties,
* deletions, insertion, or moves during the flush.
*/
if(H5C__serialize_cache(f, dxpl_id) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTSERIALIZE, FAIL, "serialization of the cache failed")
} /* end if */
#endif /* H5_HAVE_PARALLEL */
done:
FUNC_LEAVE_NOAPI(ret_value)
@ -3535,6 +3575,73 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C_unsettle_entry_ring() */
/*-------------------------------------------------------------------------
* Function: H5C_unsettle_ring()
*
* Purpose: Advise the metadata cache that the specified free space
* manager ring is no longer settled (if it was on entry).
*
* If the target free space manager ring is already
* unsettled, do nothing, and return SUCCEED.
*
* If the target free space manager ring is settled, and
* we are not in the process of a file shutdown, mark
* the ring as unsettled, and return SUCCEED.
*
* If the target free space manager is settled, and we
* are in the process of a file shutdown, post an error
* message, and return FAIL.
*
* Return: Non-negative on success/Negative on failure
*
* Programmer: John Mainzer
* 10/15/16
*
*-------------------------------------------------------------------------
*/
herr_t
H5C_unsettle_ring(H5F_t * f, H5C_ring_t ring)
{
H5C_t * cache_ptr;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity checks */
HDassert(f);
HDassert(f->shared);
HDassert(f->shared->cache);
HDassert((H5C_RING_RDFSM == ring) || (H5C_RING_MDFSM == ring));
cache_ptr = f->shared->cache;
HDassert(H5C__H5C_T_MAGIC == cache_ptr->magic);
switch(ring) {
case H5C_RING_RDFSM:
if(cache_ptr->rdfsm_settled) {
if(cache_ptr->close_warning_received)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unexpected rdfsm ring unsettle")
cache_ptr->rdfsm_settled = FALSE;
} /* end if */
break;
case H5C_RING_MDFSM:
if(cache_ptr->mdfsm_settled) {
if(cache_ptr->close_warning_received)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unexpected mdfsm ring unsettle")
cache_ptr->mdfsm_settled = FALSE;
} /* end if */
break;
default:
HDassert(FALSE); /* this should be un-reachable */
break;
} /* end switch */
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C_unsettle_ring() */
/*-------------------------------------------------------------------------
* Function: H5C_validate_resize_config()
@ -6007,6 +6114,7 @@ H5C__flush_single_entry(H5F_t *f, hid_t dxpl_id, H5C_cache_entry_t *entry_ptr,
hbool_t write_entry; /* internal flag */
hbool_t destroy_entry; /* internal flag */
hbool_t generate_image; /* internal flag */
hbool_t update_page_buffer; /* internal flag */
hbool_t was_dirty;
hbool_t suppress_image_entry_writes = FALSE;
hbool_t suppress_image_entry_frees = FALSE;
@ -6032,6 +6140,7 @@ H5C__flush_single_entry(H5F_t *f, hid_t dxpl_id, H5C_cache_entry_t *entry_ptr,
del_from_slist_on_destroy = ((flags & H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG) != 0);
during_flush = ((flags & H5C__DURING_FLUSH_FLAG) != 0);
generate_image = ((flags & H5C__GENERATE_IMAGE_FLAG) != 0);
update_page_buffer = ((flags & H5C__UPDATE_PAGE_BUFFER_FLAG) != 0);
/* Set the flag for destroying the entry, based on the 'take ownership'
* and 'destroy' flags
@ -6447,6 +6556,19 @@ H5C__flush_single_entry(H5F_t *f, hid_t dxpl_id, H5C_cache_entry_t *entry_ptr,
} /* end else */
} /* if (destroy) */
/* Check if we have to update the page buffer with cleared entries
* so it doesn't go out of date
*/
if(update_page_buffer) {
/* Sanity check */
HDassert(!destroy);
HDassert(entry_ptr->image_ptr);
if(f->shared->page_buf && f->shared->page_buf->page_size >= entry_ptr->size)
if(H5PB_update_entry(f->shared->page_buf, entry_ptr->addr, entry_ptr->size, entry_ptr->image_ptr) > 0)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Failed to update PB with metadata cache")
} /* end if */
if(cache_ptr->log_flush)
if((cache_ptr->log_flush)(cache_ptr, entry_addr, was_dirty, flags) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "log_flush callback failed")

View File

@ -145,6 +145,40 @@ H5FL_DEFINE(H5C_cache_entry_t);
/* Local Variables */
/*******************/
/*-------------------------------------------------------------------------
*
* Function: H5C_cache_image_pending()
*
* Purpose: Tests to see if the load of a metadata cache image
* load is pending (i.e. will be executed on the next
* protect or insert)
*
* Returns TRUE if a cache image load is pending, and FALSE
* if not. Throws an assertion failure on error.
*
* Return: TRUE if a cache image load is pending, and FALSE otherwise.
*
* Programmer: John Mainzer, 6/18/16
*
*-------------------------------------------------------------------------
*/
hbool_t
H5C_cache_image_pending(const H5C_t *cache_ptr)
{
hbool_t ret_value = TRUE; /* Return value */
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Sanity checks */
HDassert(cache_ptr);
HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
ret_value = (cache_ptr->load_image && !cache_ptr->image_loaded);
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C_cache_image_pending() */
/*-------------------------------------------------------------------------
* Function: H5C_cache_image_status()
@ -830,6 +864,54 @@ H5C__free_image_entries_array(H5C_t * cache_ptr)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5C__free_image_entries_array() */
/*-------------------------------------------------------------------------
* Function: H5C_force_cache_image_load()
*
* Purpose: On rare occasions, it is necessary to run
* H5MF_tidy_self_referential_fsm_hack() prior to the first
* metadata cache access. This is a problem as if there is a
* cache image at the end of the file, that routine will
* discard it.
*
* We solve this issue by calling this function, which will
* load the cache image and then call
* H5MF_tidy_self_referential_fsm_hack() to discard it.
*
* Return: SUCCEED on success, and FAIL on failure.
*
* Programmer: John Mainzer
* 1/11/17
*
*-------------------------------------------------------------------------
*/
herr_t
H5C_force_cache_image_load(H5F_t *f, hid_t dxpl_id)
{
H5C_t *cache_ptr;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity checks */
HDassert(f);
HDassert(f->shared);
cache_ptr = f->shared->cache;
HDassert(cache_ptr);
HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
HDassert(cache_ptr->load_image);
/* Load the cache image, if requested */
if(cache_ptr->load_image) {
cache_ptr->load_image = FALSE;
if(H5C__load_cache_image(f, dxpl_id) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTLOAD, FAIL, "can't load cache image")
} /* end if */
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C_force_cache_image_load() */
/*-------------------------------------------------------------------------
* Function: H5C_get_cache_image_config
@ -1239,7 +1321,7 @@ H5C__image_entry_cmp(const void *_entry1, const void *_entry2)
*-------------------------------------------------------------------------
*/
herr_t
H5C__prep_image_for_file_close(H5F_t *f, hid_t dxpl_id)
H5C__prep_image_for_file_close(H5F_t *f, hid_t dxpl_id, hbool_t *image_generated)
{
H5C_t * cache_ptr = NULL;
haddr_t eoa_frag_addr = HADDR_UNDEF;
@ -1255,6 +1337,7 @@ H5C__prep_image_for_file_close(H5F_t *f, hid_t dxpl_id)
cache_ptr = f->shared->cache;
HDassert(cache_ptr);
HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
HDassert(image_generated);
/* If the file is opened and closed without any access to
* any group or data set, it is possible that the cache image (if
@ -1379,6 +1462,15 @@ H5C__prep_image_for_file_close(H5F_t *f, hid_t dxpl_id)
(hsize_t)(cache_ptr->image_data_len), &eoa_frag_addr, &eoa_frag_size)))
HGOTO_ERROR(H5E_CACHE, H5E_NOSPACE, FAIL, "can't allocate file space for metadata cache image")
/* Make note of the eoa after allocation of the cache image
* block. This value is used for sanity checking when we
* shutdown the self referential free space managers after
* we destroy the metadata cache.
*/
HDassert(HADDR_UNDEF == f->shared->eoa_post_mdci_fsalloc);
if(HADDR_UNDEF == (f->shared->eoa_post_mdci_fsalloc = H5FD_get_eoa(f->shared->lf, H5FD_MEM_DEFAULT)) )
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get file size")
/* For now, drop any fragment left over from the allocation of the
* image block on the ground. A fragment should only be returned
* if the underlying file alignment is greater than 1.
@ -1468,6 +1560,9 @@ H5C__prep_image_for_file_close(H5F_t *f, hid_t dxpl_id)
cache_ptr->image_ctl.generate_image = FALSE;
} /* end else */
/* Indicate that a cache image was generated */
*image_generated = TRUE;
} /* end if */
done:

View File

@ -791,7 +791,7 @@ H5C_mark_entries_as_clean(H5F_t * f,
entries_cleared++;
if(H5C__flush_single_entry(f, dxpl_id, clear_ptr,
(H5C__FLUSH_CLEAR_ONLY_FLAG | H5C__GENERATE_IMAGE_FLAG)) < 0)
(H5C__FLUSH_CLEAR_ONLY_FLAG | H5C__GENERATE_IMAGE_FLAG | H5C__UPDATE_PAGE_BUFFER_FLAG)) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "can't clear entry")
} /* end if */
else
@ -821,7 +821,7 @@ H5C_mark_entries_as_clean(H5F_t * f,
progress = TRUE;
if(H5C__flush_single_entry(f, dxpl_id, clear_ptr,
(H5C__FLUSH_CLEAR_ONLY_FLAG | H5C__GENERATE_IMAGE_FLAG)) < 0)
(H5C__FLUSH_CLEAR_ONLY_FLAG | H5C__GENERATE_IMAGE_FLAG | H5C__UPDATE_PAGE_BUFFER_FLAG)) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "can't clear entry")
} /* end if */
else
@ -1242,7 +1242,8 @@ H5C__flush_candidates_in_ring(H5F_t *f, hid_t dxpl_id, H5C_ring_t ring,
unsigned init_index_len;
#endif /* H5C_DO_SANITY_CHECKS */
unsigned clear_flags = H5C__FLUSH_CLEAR_ONLY_FLAG |
H5C__GENERATE_IMAGE_FLAG;
H5C__GENERATE_IMAGE_FLAG |
H5C__UPDATE_PAGE_BUFFER_FLAG;
unsigned flush_flags = H5C__NO_FLAGS_SET;
unsigned op_flags;
H5C_cache_entry_t *op_ptr;

View File

@ -4901,7 +4901,8 @@ typedef int (*H5C_tag_iter_cb_t)(H5C_cache_entry_t *entry, void *ctx);
/******************************/
/* Package Private Prototypes */
/******************************/
H5_DLL herr_t H5C__prep_image_for_file_close(H5F_t *f, hid_t dxpl_id);
H5_DLL herr_t H5C__prep_image_for_file_close(H5F_t *f, hid_t dxpl_id,
hbool_t *image_generated);
H5_DLL herr_t H5C__deserialize_prefetched_entry(H5F_t *f, hid_t dxpl_id,
H5C_t * cache_ptr, H5C_cache_entry_t** entry_ptr_ptr,
const H5C_class_t * type, haddr_t addr, void * udata);

View File

@ -185,6 +185,7 @@
* H5C__TAKE_OWNERSHIP_FLAG
* H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG
* H5C__GENERATE_IMAGE_FLAG
* H5C__UPDATE_PAGE_BUFFER_FLAG
*/
#define H5C__NO_FLAGS_SET 0x00000
#define H5C__SET_FLUSH_MARKER_FLAG 0x00001
@ -205,6 +206,7 @@
#define H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG 0x08000
#define H5C__DURING_FLUSH_FLAG 0x10000 /* Set when the entire cache is being flushed */
#define H5C__GENERATE_IMAGE_FLAG 0x20000 /* Set during parallel I/O */
#define H5C__UPDATE_PAGE_BUFFER_FLAG 0x40000 /* Set during parallel I/O */
/* Debugging/sanity checking/statistics settings */
#ifndef NDEBUG
@ -2249,6 +2251,7 @@ H5_DLL herr_t H5C_expunge_entry(H5F_t *f, hid_t dxpl_id,
const H5C_class_t *type, haddr_t addr, unsigned flags);
H5_DLL herr_t H5C_flush_cache(H5F_t *f, hid_t dxpl_id, unsigned flags);
H5_DLL herr_t H5C_flush_tagged_entries(H5F_t * f, hid_t dxpl_id, haddr_t tag);
H5_DLL herr_t H5C_force_cache_image_load(H5F_t * f, hid_t dxpl_id);
H5_DLL herr_t H5C_evict_tagged_entries(H5F_t * f, hid_t dxpl_id, haddr_t tag, hbool_t match_global);
H5_DLL herr_t H5C_expunge_tag_type_metadata(H5F_t *f, hid_t dxpl_id, haddr_t tag, int type_id, unsigned flags);
H5_DLL herr_t H5C_get_tag(const void *thing, /*OUT*/ haddr_t *tag);
@ -2313,9 +2316,11 @@ H5_DLL herr_t H5C_retag_entries(H5C_t * cache_ptr, haddr_t src_tag, haddr_t dest
H5_DLL herr_t H5C_cork(H5C_t *cache_ptr, haddr_t obj_addr, unsigned action, hbool_t *corked);
H5_DLL herr_t H5C_get_entry_ring(const H5F_t *f, haddr_t addr, H5C_ring_t *ring);
H5_DLL herr_t H5C_unsettle_entry_ring(void *thing);
H5_DLL herr_t H5C_unsettle_ring(H5F_t * f, H5C_ring_t ring);
H5_DLL herr_t H5C_remove_entry(void *thing);
H5_DLL herr_t H5C_cache_image_status(H5F_t * f, hbool_t *load_ci_ptr,
hbool_t *write_ci_ptr);
H5_DLL hbool_t H5C_cache_image_pending(const H5C_t *cache_ptr);
#ifdef H5_HAVE_PARALLEL
H5_DLL herr_t H5C_apply_candidate_list(H5F_t *f, hid_t dxpl_id,

View File

@ -1975,7 +1975,9 @@ H5Fformat_convert(hid_t fid)
/* Check for persistent freespace manager, which needs to be downgraded */
if(!(f->shared->fs_strategy == H5F_FILE_SPACE_STRATEGY_DEF &&
f->shared->fs_threshold == H5F_FREE_SPACE_THRESHOLD_DEF)) {
f->shared->fs_persist == H5F_FREE_SPACE_PERSIST_DEF &&
f->shared->fs_threshold == H5F_FREE_SPACE_THRESHOLD_DEF &&
f->shared->fs_page_size == H5F_FILE_SPACE_PAGE_SIZE_DEF)) {
/* Check to remove free-space manager info message from superblock extension */
if(H5F_addr_defined(f->shared->sblock->ext_addr))
if(H5F_super_ext_remove_msg(f, H5AC_ind_read_dxpl_id, H5O_FSINFO_ID) < 0)
@ -1987,7 +1989,9 @@ H5Fformat_convert(hid_t fid)
/* Set non-persistent freespace manager */
f->shared->fs_strategy = H5F_FILE_SPACE_STRATEGY_DEF;
f->shared->fs_persist = H5F_FREE_SPACE_PERSIST_DEF;
f->shared->fs_threshold = H5F_FREE_SPACE_THRESHOLD_DEF;
f->shared->fs_page_size = H5F_FILE_SPACE_PAGE_SIZE_DEF;
/* Indicate that the superblock should be marked dirty */
mark_dirty = TRUE;
@ -2006,3 +2010,79 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Fformat_convert() */
/*-------------------------------------------------------------------------
* Function: H5Freset_page_buffering_stats
*
* Purpose: Resets statistics for the page buffer layer.
*
* Return: Success: SUCCEED
* Failure: FAIL
*
* Programmer: Mohamad Chaarawi
*
*-------------------------------------------------------------------------
*/
herr_t
H5Freset_page_buffering_stats(hid_t file_id)
{
H5F_t *file; /* File to reset stats on */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE1("e", "i", file_id);
/* Check args */
if(NULL == (file = (H5F_t *)H5I_object(file_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier")
if(NULL == file->shared->page_buf)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "page buffering not enabled on file")
/* Reset the statistics */
if(H5PB_reset_stats(file->shared->page_buf) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't reset stats for page buffering")
done:
FUNC_LEAVE_API(ret_value)
} /* H5Freset_page_buffering_stats() */
/*-------------------------------------------------------------------------
* Function: H5Fget_page_buffering_stats
*
* Purpose: Retrieves statistics for the page buffer layer.
*
* Return: Success: SUCCEED
* Failure: FAIL
*
* Programmer: Mohamad Chaarawi
*
*-------------------------------------------------------------------------
*/
herr_t
H5Fget_page_buffering_stats(hid_t file_id, unsigned accesses[2], unsigned hits[2],
unsigned misses[2], unsigned evictions[2], unsigned bypasses[2])
{
H5F_t *file; /* File object for file ID */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE6("e", "i*Iu*Iu*Iu*Iu*Iu", file_id, accesses, hits, misses, evictions,
bypasses);
/* Check args */
if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID")
if(NULL == file->shared->page_buf)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "page buffering not enabled on file")
if(NULL == accesses || NULL == hits || NULL == misses || NULL == evictions || NULL == bypasses)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL input parameters for stats")
/* Get the statistics */
if(H5PB_get_stats(file->shared->page_buf, accesses, hits, misses, evictions, bypasses) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve stats for page buffering")
done:
FUNC_LEAVE_API(ret_value)
} /* H5Fget_page_buffering_stats() */

View File

@ -2054,3 +2054,27 @@ H5FD_get_base_addr(const H5FD_t *file)
FUNC_LEAVE_NOAPI(file->base_addr)
} /* end H5FD_get_base_addr() */
/*--------------------------------------------------------------------------
* Function: H5FD_set_paged_aggr
*
* Purpose: Set "paged_aggr" for the file.
*
* Return: Non-negative if succeed; negative if fails.
*
* Programmer: Vailin Choi; April 2013
*
*--------------------------------------------------------------------------
*/
herr_t
H5FD_set_paged_aggr(H5FD_t *file, hbool_t paged)
{
FUNC_ENTER_NOAPI_NOINIT_NOERR
HDassert(file);
/* Indicate whether paged aggregation for handling file space is enabled or not */
file->paged_aggr = paged;
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5FD_set_paged_aggr() */

View File

@ -934,13 +934,7 @@ H5FD_log_alloc(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, hsi
/* Compute the address for the block to allocate */
addr = file->eoa;
/* Check if we need to align this block */
if(size >= file->pub.threshold) {
/* Check for an already aligned block */
if(addr % file->pub.alignment != 0)
addr = ((addr / file->pub.alignment) + 1) * file->pub.alignment;
} /* end if */
/* Extend the end-of-allocated space address */
file->eoa = addr + size;
/* Retain the (first) flavor of the information written to the file */

View File

@ -1194,6 +1194,8 @@ H5FD_multi_query(const H5FD_t *_f, unsigned long *flags /* out */)
*flags = 0;
*flags |= H5FD_FEAT_DATA_SIEVE; /* OK to perform data sieving for faster raw data reads & writes */
*flags |= H5FD_FEAT_AGGREGATE_SMALLDATA; /* OK to aggregate "small" raw data allocations */
*flags |= H5FD_FEAT_USE_ALLOC_SIZE; /* OK just pass the allocation size to the alloc callback */
*flags |= H5FD_FEAT_PAGED_AGGR; /* OK special file space mapping for paged aggregation */
} /* end if */
return(0);
@ -1538,6 +1540,14 @@ H5FD_multi_alloc(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size)
mmt = file->fa.memb_map[type];
if (H5FD_MEM_DEFAULT==mmt) mmt = type;
/* XXX: NEED to work on this again */
if(file->pub.paged_aggr) {
ALL_MEMBERS(mt) {
if(file->memb[mt])
file->memb[mt]->paged_aggr = file->pub.paged_aggr;
} END_MEMBERS;
}
if (HADDR_UNDEF==(addr=H5FDalloc(file->memb[mmt], mmt, dxpl_id, size)))
H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "member file can't alloc", HADDR_UNDEF)
addr += file->fa.memb_addr[mmt];

View File

@ -154,8 +154,8 @@ H5_DLL H5FD_t *H5FD_open(const char *name, unsigned flags, hid_t fapl_id,
haddr_t maxaddr);
H5_DLL herr_t H5FD_close(H5FD_t *file);
H5_DLL int H5FD_cmp(const H5FD_t *f1, const H5FD_t *f2);
H5_DLL haddr_t H5FD_alloc(H5FD_t *file, hid_t dxpl_id, H5FD_mem_t type, struct H5F_t *f,
hsize_t size, haddr_t *align_addr, hsize_t *align_size);
H5_DLL haddr_t H5FD_alloc(H5FD_t *file, hid_t dxpl_id, H5FD_mem_t type,
struct H5F_t *f, hsize_t size, haddr_t *frag_addr, hsize_t *frag_size);
H5_DLL herr_t H5FD_free(H5FD_t *file, hid_t dxpl_id, H5FD_mem_t type, struct H5F_t *f,
haddr_t addr, hsize_t size);
H5_DLL htri_t H5FD_try_extend(H5FD_t *file, H5FD_mem_t type, struct H5F_t *f,
@ -179,6 +179,7 @@ H5_DLL herr_t H5FD_get_fileno(const H5FD_t *file, unsigned long *filenum);
H5_DLL herr_t H5FD_get_vfd_handle(H5FD_t *file, hid_t fapl, void** file_handle);
H5_DLL herr_t H5FD_set_base_addr(H5FD_t *file, haddr_t base_addr);
H5_DLL haddr_t H5FD_get_base_addr(const H5FD_t *file);
H5_DLL herr_t H5FD_set_paged_aggr(H5FD_t *file, hbool_t paged);
/* Function prototypes for MPI based VFDs*/
#ifdef H5_HAVE_PARALLEL

View File

@ -239,6 +239,19 @@ typedef enum H5F_mem_t H5FD_mem_t;
* driver supports the single-writer/multiple-readers I/O pattern.
*/
#define H5FD_FEAT_SUPPORTS_SWMR_IO 0x00001000
/*
* Defining H5FD_FEAT_USE_ALLOC_SIZE for a VFL driver
* means that the library will just pass the allocation size to the
* the driver's allocation callback which will eventually handle alignment.
* This is specifically used for the multi/split driver.
*/
#define H5FD_FEAT_USE_ALLOC_SIZE 0x00002000
/*
* Defining H5FD_FEAT_PAGED_AGGR for a VFL driver
* means that the driver needs special file space mapping for paged aggregation.
* This is specifically used for the multi/split driver.
*/
#define H5FD_FEAT_PAGED_AGGR 0x00004000
/* Forward declaration */
typedef struct H5FD_t H5FD_t;
@ -307,6 +320,7 @@ struct H5FD_t {
/* Space allocation management fields */
hsize_t threshold; /* Threshold for alignment */
hsize_t alignment; /* Allocation alignment */
hbool_t paged_aggr; /* Paged aggregation for file space is enabled or not */
};
/* Define enum for the source of file image callbacks */

View File

@ -99,7 +99,7 @@ H5FL_DEFINE(H5FD_free_t);
*-------------------------------------------------------------------------
*/
static haddr_t
H5FD_extend(H5FD_t *file, H5FD_mem_t type, hbool_t new_block, hsize_t size, haddr_t *frag_addr, hsize_t *frag_size)
H5FD_extend(H5FD_t *file, H5FD_mem_t type, hsize_t size)
{
hsize_t orig_size = size; /* Original allocation size */
haddr_t eoa; /* Address of end-of-allocated space */
@ -117,40 +117,18 @@ H5FD_extend(H5FD_t *file, H5FD_mem_t type, hbool_t new_block, hsize_t size, hadd
/* Get current end-of-allocated space address */
eoa = file->cls->get_eoa(file, type);
/* Compute extra space to allocate, if this is a new block and should be aligned */
extra = 0;
if(new_block && file->alignment > 1 && orig_size >= file->threshold) {
hsize_t mis_align; /* Amount EOA is misaligned */
/* Check for EOA already aligned */
if((mis_align = (eoa % file->alignment)) > 0) {
extra = file->alignment - mis_align;
if(frag_addr)
*frag_addr = eoa - file->base_addr; /* adjust for file's base address */
if(frag_size)
*frag_size = extra;
} /* end if */
} /* end if */
/* Add in extra allocation amount */
size += extra;
/* Check for overflow when extending */
if(H5F_addr_overflow(eoa, size) || (eoa + size) > file->maxaddr)
HGOTO_ERROR(H5E_VFL, H5E_NOSPACE, HADDR_UNDEF, "file allocation request failed")
/* Set the [possibly aligned] address to return */
ret_value = eoa + extra;
/* Set the [NOT aligned] address to return */
ret_value = eoa;
/* Extend the end-of-allocated space address */
eoa += size;
if(file->cls->set_eoa(file, type, eoa) < 0)
HGOTO_ERROR(H5E_VFL, H5E_NOSPACE, HADDR_UNDEF, "file allocation request failed")
/* Post-condition sanity check */
if(new_block && file->alignment && orig_size >= file->threshold)
HDassert(!(ret_value % file->alignment));
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5FD_extend() */
@ -160,6 +138,8 @@ done:
* Function: H5FD_alloc_real
*
* Purpose: Allocate space in the file with the VFD
* Note: the handling of alignment is moved up from each driver to
* this routine.
*
* Return: Success: The format address of the new file memory.
* Failure: The undefined address HADDR_UNDEF
@ -170,8 +150,14 @@ done:
*-------------------------------------------------------------------------
*/
haddr_t
H5FD_alloc_real(H5FD_t *file, hid_t dxpl_id, H5FD_mem_t type, hsize_t size, haddr_t *frag_addr, hsize_t *frag_size)
H5FD_alloc_real(H5FD_t *file, hid_t dxpl_id, H5FD_mem_t type, hsize_t size,
haddr_t *frag_addr, hsize_t *frag_size)
{
hsize_t orig_size = size; /* Original allocation size */
haddr_t eoa; /* Address of end-of-allocated space */
hsize_t extra; /* Extra space to allocate, to align request */
unsigned long flags = 0; /* Driver feature flags */
hbool_t use_alloc_size; /* Just pass alloc size to the driver */
haddr_t ret_value = HADDR_UNDEF; /* Return value */
FUNC_ENTER_NOAPI(HADDR_UNDEF)
@ -185,16 +171,53 @@ HDfprintf(stderr, "%s: type = %u, size = %Hu\n", FUNC, (unsigned)type, size);
HDassert(type >= H5FD_MEM_DEFAULT && type < H5FD_MEM_NTYPES);
HDassert(size > 0);
/* Check for query driver and call it */
if(file->cls->query)
(file->cls->query)(file, &flags);
/* Check for the driver feature flag */
use_alloc_size = flags & H5FD_FEAT_USE_ALLOC_SIZE;
/* Get current end-of-allocated space address */
eoa = file->cls->get_eoa(file, type);
/* Compute extra space to allocate, if this should be aligned */
extra = 0;
if(!file->paged_aggr && file->alignment > 1 && orig_size >= file->threshold) {
hsize_t mis_align; /* Amount EOA is misaligned */
/* Check for EOA already aligned */
if((mis_align = (eoa % file->alignment)) > 0) {
extra = file->alignment - mis_align;
if(frag_addr)
*frag_addr = eoa - file->base_addr; /* adjust for file's base address */
if(frag_size)
*frag_size = extra;
} /* end if */
} /* end if */
/* Dispatch to driver `alloc' callback or extend the end-of-address marker */
/* For the multi/split driver: the size passed down to the alloc callback is the original size from H5FD_alloc() */
/* For all other drivers: the size passed down to the alloc callback is the size + [possibly] alignment size */
if(file->cls->alloc) {
if((ret_value = (file->cls->alloc)(file, type, dxpl_id, size)) == HADDR_UNDEF)
ret_value = (file->cls->alloc)(file, type, dxpl_id, use_alloc_size ? size : size + extra);
if(!H5F_addr_defined(ret_value))
HGOTO_ERROR(H5E_VFL, H5E_NOSPACE, HADDR_UNDEF, "driver allocation request failed")
} /* end if */
else {
if((ret_value = H5FD_extend(file, type, TRUE, size, frag_addr, frag_size)) == HADDR_UNDEF)
ret_value = H5FD_extend(file, type, size + extra);
if(!H5F_addr_defined(ret_value))
HGOTO_ERROR(H5E_VFL, H5E_NOSPACE, HADDR_UNDEF, "driver eoa update request failed")
} /* end else */
/* Set the [possibly aligned] address to return */
if(!use_alloc_size)
ret_value += extra;
/* Post-condition sanity check */
if(!file->paged_aggr && file->alignment > 1 && orig_size >= file->threshold)
HDassert(!(ret_value % file->alignment));
/* Convert absolute file offset to relative address */
ret_value -= file->base_addr;
@ -420,7 +443,7 @@ H5FD_try_extend(H5FD_t *file, H5FD_mem_t type, H5F_t *f, hid_t dxpl_id,
/* Check if the block is exactly at the end of the file */
if(H5F_addr_eq(blk_end, eoa)) {
/* Extend the object by extending the underlying file */
if(HADDR_UNDEF == H5FD_extend(file, type, FALSE, extra_requested, NULL, NULL))
if(HADDR_UNDEF == H5FD_extend(file, type, extra_requested))
HGOTO_ERROR(H5E_VFL, H5E_CANTEXTEND, FAIL, "driver extend request failed")
/* Mark EOA info dirty in cache, so change will get encoded */

View File

@ -601,13 +601,6 @@ H5FD_stdio_alloc(H5FD_t *_file, H5FD_mem_t /*UNUSED*/ type, hid_t /*UNUSED*/ dxp
/* Compute the address for the block to allocate */
addr = file->eoa;
/* Check if we need to align this block */
if(size >= file->pub.threshold) {
/* Check for an already aligned block */
if((addr % file->pub.alignment) != 0)
addr = ((addr / file->pub.alignment) + 1) * file->pub.alignment;
} /* end if */
file->eoa = addr + size;
return addr;

View File

@ -135,7 +135,7 @@ HDfprintf(stderr, "%s: Creating free space manager, nclasses = %Zu\n", FUNC, ncl
fspace->swmr_write = (H5F_INTENT(f) & H5F_ACC_SWMR_WRITE) > 0;
fspace->alignment = alignment;
fspace->threshold = threshold;
fspace->align_thres = threshold;
/* Check if the free space tracker is supposed to be persistant */
if(fs_addr) {
@ -227,7 +227,7 @@ HDfprintf(stderr, "%s: fspace->rc = %u\n", FUNC, fspace->rc);
HGOTO_ERROR(H5E_FSPACE, H5E_CANTINC, NULL, "unable to increment ref. count on free space header")
fspace->alignment = alignment;
fspace->threshold = threshold;
fspace->align_thres = threshold;
/* Unlock free space header */
if(H5AC_unprotect(f, dxpl_id, H5AC_FSPACE_HDR, fs_addr, fspace, H5AC__NO_FLAGS_SET) < 0)
@ -873,10 +873,7 @@ H5FS_alloc_sect(H5F_t *f, H5FS_t *fspace, hid_t dxpl_id)
HDassert(fspace);
if(!H5F_addr_defined(fspace->sect_addr) && fspace->sinfo && fspace->serial_sect_count > 0) {
/* Allocate space for section info from aggregator/vfd (or temp. address space) */
/* (The original version called H5MF_alloc(), but that may cause sect_size to change again) */
/* (This routine is only called during file close operations, so don't allocate from temp. address space) */
if(HADDR_UNDEF == (fspace->sect_addr = H5MF_aggr_vfd_alloc(f, H5FD_MEM_FSPACE_SINFO, dxpl_id, fspace->sect_size)))
if(HADDR_UNDEF == (fspace->sect_addr = H5MF_alloc(f, H5FD_MEM_FSPACE_SINFO, dxpl_id, fspace->sect_size)))
HGOTO_ERROR(H5E_FSPACE, H5E_NOSPACE, FAIL, "file allocation failed for section info")
fspace->alloc_sect_size = fspace->sect_size;
@ -899,169 +896,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5FS_alloc_sect() */
/*-------------------------------------------------------------------------
* Function: H5FS_alloc_vfd_alloc_hdr_and_section_info
*
* Purpose: This function is part of a hack to patch over a design
* flaw in the free space managers for file space allocation.
* Specifically, if a free space manager allocates space for
* its own section info, it is possible for it to
* go into an infinite loop as it:
*
* 1) computes the size of the section info
*
* 2) allocates file space for the section info
*
* 3) notices that the size of the section info
* has changed
*
* 4) deallocates the section info file space and
* returns to 1) above.
*
* Similarly, if it allocates space for its own header, it
* can go into an infinte loop as it:
*
* 1) allocates space for the header
*
* 2) notices that the free space manager is empty
* and thus should not have file space allocated
* to its header
*
* 3) frees the space allocated to the header
*
* 4) notices that the free space manager is not
* empty and thus must have file space allocated
* to it, and thus returns to 1) above.
*
* In a nutshell, the solution applied in this hack is to
* deallocate file space for the free space manager(s) that
* handle FSM header and/or section info file space allocations,
* wait until all other allocation/deallocation requests have
* been handled, and then test to see if the free space manager(s)
* in question are empty. If they are, do nothing. If they
* are not, allocate space for them at end of file bypassing the
* usual file space allocation calls, and thus avoiding the
* potential infinite loops.
*
* The purpose of this function is to allocate file space for
* the header and section info of the target free space manager
* directly from the VFD if needed. In this case the function
* also re-inserts the header and section info in the metadata
* cache with this allocation.
*
* Note that if f->shared->alignment > 1, and EOA is not a
* multiple of the alignment, it is possible that performing
* this allocation may generate a fragment of file space in
* addition to the space allocated for the section info.
*
* At present we deal with this by screaming and dying.
* Obviously, this is not acceptatable, but it should do
* for now.
*
*
* Return: Success: non-negative
* Failure: negative
*
* Programmer: John Mainzer
* 6/6/16
*
*-------------------------------------------------------------------------
*/
herr_t
H5FS_alloc_vfd_alloc_hdr_and_section_info(H5F_t *f, hid_t dxpl_id,
H5FS_t *fspace, haddr_t *fs_addr_ptr)
{
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_TAG(dxpl_id, H5AC__FREESPACE_TAG, FAIL)
/* Check arguments */
HDassert(f);
HDassert(fspace);
HDassert(fs_addr_ptr);
/* The section info should be unlocked */
HDassert(fspace->sinfo_lock_count == 0);
/* No space should be allocated */
HDassert(*fs_addr_ptr == HADDR_UNDEF);
HDassert(fspace->addr == HADDR_UNDEF);
HDassert(fspace->sect_addr == HADDR_UNDEF);
HDassert(fspace->alloc_sect_size == 0);
/* Check if any space will be needed */
if(fspace->serial_sect_count > 0) {
haddr_t sect_addr; /* Address of sinfo */
/* The section info is floating, so fspace->sinfo should be defined */
HDassert(fspace->sinfo);
/* Start by allocating file space for the header */
if(HADDR_UNDEF == (fspace->addr = H5MF_vfd_alloc(f, dxpl_id, H5FD_MEM_FSPACE_HDR,
(hsize_t)H5FS_HEADER_SIZE(f), FALSE)))
HGOTO_ERROR(H5E_FSPACE, H5E_CANTALLOC, FAIL, "can't allocate file space for hdr")
/* Cache the new free space header (pinned) */
if(H5AC_insert_entry(f, dxpl_id, H5AC_FSPACE_HDR, fspace->addr, fspace, H5AC__PIN_ENTRY_FLAG) < 0)
HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, "can't add free space header to cache")
/* Now allocate file space for the section info */
if(HADDR_UNDEF == (sect_addr = H5MF_vfd_alloc(f, dxpl_id, H5FD_MEM_FSPACE_SINFO,
fspace->sect_size, FALSE)))
HGOTO_ERROR(H5E_FSPACE, H5E_CANTALLOC, FAIL, "can't allocate file space")
/* Update fspace->alloc_sect_size and fspace->sect_addr to reflect
* the allocation
*/
fspace->alloc_sect_size = fspace->sect_size;
fspace->sect_addr = sect_addr;
/* We have changed the sinfo address -- Mark free space header dirty */
if(H5AC_mark_entry_dirty(fspace) < 0)
HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, FAIL, "unable to mark free space header as dirty")
/* Insert the new section info into the metadata cache. */
/* Question: Do we need to worry about this insertion causing an
* eviction from the metadata cache? Think on this. If so, add a
* flag to H5AC_insert() to force it to skip the call to make space in
* cache.
*
* On reflection, no.
*
* On a regular file close, any eviction will not change the
* the contents of the free space manger(s), as all entries
* should have correct file space allocated by the time this
* function is called.
*
* In the cache image case, the selection of entries for inclusion
* in the cache image will not take place until after this call.
* (Recall that this call is made during the metadata fsm settle
* routine, which is called during the serialization routine in
* the cache image case. Entries are not selected for inclusion
* in the image until after the cache is serialized.)
*
* JRM -- 11/4/16
*/
if(H5AC_insert_entry(f, dxpl_id, H5AC_FSPACE_SINFO, sect_addr, fspace->sinfo, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, "can't add free space sinfo to cache")
/* Since space has been allocated for the section info and the sinfo
* has been inserted into the cache, relinquish owership (i.e. float)
* the section info.
*/
fspace->sinfo = NULL;
/* Set the address of the free space header, on success */
*fs_addr_ptr = fspace->addr;
} /* end if */
done:
FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL)
} /* H5FS_alloc_vfd_alloc_hdr_and_section_info() */
/*-------------------------------------------------------------------------
* Function: H5FS_free()
@ -1076,7 +910,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
H5FS_free(H5F_t *f, H5FS_t *fspace, hid_t dxpl_id)
H5FS_free(H5F_t *f, H5FS_t *fspace, hid_t dxpl_id, hbool_t free_file_space)
{
haddr_t saved_addr; /* Previous address of item */
unsigned cache_flags; /* Flags for unprotecting cache entries */
@ -1123,7 +957,8 @@ H5FS_free(H5F_t *f, H5FS_t *fspace, hid_t dxpl_id)
/* Free space for the free-space manager section info */
if(!H5F_IS_TMP_ADDR(f, saved_addr)) {
if(H5MF_xfree(f, H5FD_MEM_FSPACE_SINFO, dxpl_id, saved_addr, saved_size) < 0)
if(free_file_space &&
H5MF_xfree(f, H5FD_MEM_FSPACE_SINFO, dxpl_id, saved_addr, saved_size) < 0)
HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "unable to release free space sections")
} /* end if */
@ -1165,7 +1000,8 @@ H5FS_free(H5F_t *f, H5FS_t *fspace, hid_t dxpl_id)
fspace->addr = HADDR_UNDEF;
/* Free space for the free-space manager header */
if(H5MF_xfree(f, H5FD_MEM_FSPACE_HDR, dxpl_id, saved_addr, (hsize_t)H5FS_HEADER_SIZE(f)) < 0)
if(free_file_space &&
H5MF_xfree(f, H5FD_MEM_FSPACE_HDR, dxpl_id, saved_addr, (hsize_t)H5FS_HEADER_SIZE(f)) < 0)
HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "unable to free free space header")
} /* end if */
@ -1339,6 +1175,23 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5FS_sinfo_dest() */
herr_t
H5FS_get_sect_count(const H5FS_t *frsp, hsize_t *tot_sect_count)
{
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Check arguments. */
HDassert(frsp);
HDassert(tot_sect_count);
/* Report statistics for free space */
*tot_sect_count = frsp->serial_sect_count;
FUNC_LEAVE_NOAPI(ret_value)
}
#ifdef H5FS_DEBUG_ASSERT
/*-------------------------------------------------------------------------

View File

@ -37,6 +37,7 @@
#include "H5private.h" /* Generic Functions */
#include "H5ACprivate.h" /* Metadata cache */
#include "H5Eprivate.h" /* Error handling */
#include "H5Fprivate.h" /* File */
#include "H5FSpkg.h" /* File free space */
#include "H5MFprivate.h" /* File memory management */
#include "H5VMprivate.h" /* Vectors and arrays */
@ -296,7 +297,7 @@ H5FS__cache_hdr_deserialize(const void *_image, size_t len, void *_udata,
/* # of section classes */
/* (only check if we actually have some classes) */
UINT16DECODE(image, nclasses);
if(fspace->nclasses > 0 && fspace->nclasses != nclasses)
if(fspace->nclasses > 0 && nclasses > fspace->nclasses)
HGOTO_ERROR(H5E_FSPACE, H5E_CANTLOAD, NULL, "section class count mismatch")
/* Shrink percent */
@ -596,9 +597,11 @@ H5FS__cache_hdr_pre_serialize(H5F_t *f, hid_t dxpl_id, void *_thing,
* real file space lest the header be written to file with
* a nonsense section info address.
*/
HDassert(fspace->serial_sect_count > 0);
HDassert(fspace->sect_size > 0);
HDassert(fspace->alloc_sect_size == (size_t)fspace->sect_size);
if(!H5F_POINT_OF_NO_RETURN(f)) {
HDassert(fspace->serial_sect_count > 0);
HDassert(fspace->sect_size > 0);
HDassert(fspace->alloc_sect_size == (size_t)fspace->sect_size);
} /* end if */
if(H5F_IS_TMP_ADDR(f, fspace->sect_addr)) {
unsigned sect_status = 0;
@ -702,10 +705,12 @@ H5FS__cache_hdr_serialize(const H5F_t *f, void *_image, size_t len,
* The following asserts are a cursory check on this.
*/
HDassert((! H5F_addr_defined(fspace->sect_addr)) || (! H5F_IS_TMP_ADDR(f, fspace->sect_addr)));
HDassert((! H5F_addr_defined(fspace->sect_addr)) ||
((fspace->serial_sect_count > 0) &&
(fspace->sect_size > 0) &&
(fspace->alloc_sect_size == (size_t)fspace->sect_size)));
if(!H5F_POINT_OF_NO_RETURN(f))
HDassert((! H5F_addr_defined(fspace->sect_addr)) ||
((fspace->serial_sect_count > 0) &&
(fspace->sect_size > 0) &&
(fspace->alloc_sect_size == (size_t)fspace->sect_size)));
/* Magic number */
HDmemcpy(image, H5FS_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC);
@ -1061,7 +1066,7 @@ H5FS__cache_sinfo_deserialize(const void *_image, size_t len, void *_udata,
/* Insert section in free space manager, unless requested not to */
if(!(des_flags & H5FS_DESERIALIZE_NO_ADD))
if(H5FS_sect_add(udata->f, udata->dxpl_id, udata->fspace, new_sect, H5FS_ADD_DESERIALIZING, NULL) < 0)
if(H5FS_sect_add(udata->f, udata->dxpl_id, udata->fspace, new_sect, H5FS_ADD_DESERIALIZING, udata) < 0)
HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, NULL, "can't add section to free space manager")
} /* end for */
} while(image < (((const uint8_t *)_image + old_sect_size) - H5FS_SIZEOF_CHKSUM));
@ -1177,8 +1182,9 @@ H5FS__cache_sinfo_pre_serialize(H5F_t *f, hid_t dxpl_id, void *_thing,
HDassert(new_len);
HDassert(flags);
/* we shouldn't be called if the section info is empty */
HDassert(fspace->serial_sect_count > 0);
/* we shouldn't be called if the section info is empty, unless we hit the point of no return. */
if(!H5F_POINT_OF_NO_RETURN(f))
HDassert(fspace->serial_sect_count > 0);
sinfo_addr = addr; /* this will change if we relocate the section data */

View File

@ -187,8 +187,9 @@ struct H5FS_t {
/* must be either H5C__NO_FLAGS_SET (i.e r/w) */
/* or H5AC__READ_ONLY_FLAG (i.e. r/o). */
size_t max_cls_serial_size; /* Max. additional size of serialized form of section */
hsize_t threshold; /* Threshold for alignment */
hsize_t alignment; /* Alignment */
hsize_t align_thres; /* Threshold for alignment */
/* Memory data structures (not stored directly) */
H5FS_section_class_t *sect_cls; /* Array of section classes for this free list */

View File

@ -67,6 +67,12 @@
* managed sections is in flux)
*/
#define H5FS_PAGE_END_NO_ADD 0x08 /* For "small" page fs:
* Don't add section to free space:
* when the section is at page end and
* when the section size is <= "small"
*/
/* Flags for deserialize callback */
#define H5FS_DESERIALIZE_NO_ADD 0x01 /* Don't add section to free space
* manager after it's deserialized
@ -98,11 +104,11 @@ typedef struct H5FS_section_class_t {
herr_t (*term_cls)(struct H5FS_section_class_t *); /* Routine to terminate class-specific settings */
/* Object methods */
herr_t (*add)(H5FS_section_info_t *, unsigned *, void *); /* Routine called when section is about to be added to manager */
herr_t (*add)(H5FS_section_info_t **, unsigned *, void *); /* Routine called when section is about to be added to manager */
herr_t (*serialize)(const struct H5FS_section_class_t *, const H5FS_section_info_t *, uint8_t *); /* Routine to serialize a "live" section into a buffer */
H5FS_section_info_t *(*deserialize)(const struct H5FS_section_class_t *, hid_t dxpl_id, const uint8_t *, haddr_t, hsize_t, unsigned *); /* Routine to deserialize a buffer into a "live" section */
htri_t (*can_merge)(const H5FS_section_info_t *, const H5FS_section_info_t *, void *); /* Routine to determine if two nodes are mergable */
herr_t (*merge)(H5FS_section_info_t *, H5FS_section_info_t *, void *); /* Routine to merge two nodes */
herr_t (*merge)(H5FS_section_info_t **, H5FS_section_info_t *, void *); /* Routine to merge two nodes */
htri_t (*can_shrink)(const H5FS_section_info_t *, void *); /* Routine to determine if node can shrink container */
herr_t (*shrink)(H5FS_section_info_t **, void *); /* Routine to shrink container */
herr_t (*free)(H5FS_section_info_t *); /* Routine to free node */
@ -182,9 +188,8 @@ H5_DLL herr_t H5FS_delete(H5F_t *f, hid_t dxpl_id, haddr_t fs_addr);
H5_DLL herr_t H5FS_close(H5F_t *f, hid_t dxpl_id, H5FS_t *fspace);
H5_DLL herr_t H5FS_alloc_hdr(H5F_t *f, H5FS_t *fspace, haddr_t *fs_addr, hid_t dxpl_id);
H5_DLL herr_t H5FS_alloc_sect(H5F_t *f, H5FS_t *fspace, hid_t dxpl_id);
H5_DLL herr_t H5FS_alloc_vfd_alloc_hdr_and_section_info(H5F_t *f, hid_t dxpl_id,
H5FS_t *fspace, haddr_t *fs_addr_ptr);
H5_DLL herr_t H5FS_free(H5F_t *f, H5FS_t *fspace, hid_t dxpl_id);
H5_DLL herr_t H5FS_free(H5F_t *f, H5FS_t *fspace, hid_t dxpl_id,
hbool_t free_file_space);
/* Free space section routines */
H5_DLL herr_t H5FS_sect_add(H5F_t *f, hid_t dxpl_id, H5FS_t *fspace,
@ -192,7 +197,7 @@ H5_DLL herr_t H5FS_sect_add(H5F_t *f, hid_t dxpl_id, H5FS_t *fspace,
H5_DLL htri_t H5FS_sect_try_merge(H5F_t *f, hid_t dxpl_id, H5FS_t *fspace,
H5FS_section_info_t *sect, unsigned flags, void *op_data);
H5_DLL htri_t H5FS_sect_try_extend(H5F_t *f, hid_t dxpl_id, H5FS_t *fspace,
haddr_t addr, hsize_t size, hsize_t extra_requested);
haddr_t addr, hsize_t size, hsize_t extra_requested, unsigned flags, void *op_data);
H5_DLL herr_t H5FS_sect_remove(H5F_t *f, hid_t dxpl_id, H5FS_t *fspace,
H5FS_section_info_t *node);
H5_DLL htri_t H5FS_sect_find(H5F_t *f, hid_t dxpl_id, H5FS_t *fspace,
@ -202,11 +207,18 @@ H5_DLL herr_t H5FS_sect_stats(const H5FS_t *fspace, hsize_t *tot_space,
hsize_t *nsects);
H5_DLL herr_t H5FS_sect_change_class(H5F_t *f, hid_t dxpl_id, H5FS_t *fspace,
H5FS_section_info_t *sect, uint16_t new_class);
H5_DLL htri_t H5FS_sect_try_shrink_eoa(const H5F_t *f, hid_t dxpl_id, const H5FS_t *fspace, void *op_data);
H5_DLL herr_t H5FS_sect_query_last_sect(const H5FS_t *fspace, haddr_t *sect_addr, hsize_t *sect_size);
H5_DLL htri_t H5FS_sect_try_shrink_eoa(H5F_t *f, hid_t dxpl_id, H5FS_t *fspace,
void *op_data);
/* Statistics routine */
H5_DLL herr_t H5FS_stat_info(const H5F_t *f, const H5FS_t *frsp, H5FS_stat_t *stats);
H5_DLL herr_t H5FS_get_sect_count(const H5FS_t *frsp, hsize_t *tot_sect_count);
/* free space manager settling routines */
H5_DLL herr_t H5FS_vfd_alloc_hdr_and_section_info_if_needed(H5F_t *f,
hid_t dxpl_id,
H5FS_t *fspace,
haddr_t *fs_addr_ptr);
/* Debugging routines for dumping file structures */
H5_DLL herr_t H5FS_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr,

View File

@ -25,6 +25,8 @@
/* Module Setup */
/****************/
#define H5F_FRIEND /*suppress error about including H5Fpkg */
#include "H5FSmodule.h" /* This source code file is part of the H5FS module */
@ -33,6 +35,7 @@
/***********/
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
#include "H5Fpkg.h" /* File access */
#include "H5FSpkg.h" /* File free space */
#include "H5MFprivate.h" /* File memory management */
#include "H5VMprivate.h" /* Vectors and arrays */
@ -1210,11 +1213,13 @@ H5FS_sect_merge(H5FS_t *fspace, H5FS_section_info_t **sect, void *op_data)
HGOTO_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't remove section from internal data structures")
/* Merge the two sections together */
if((*tmp_sect_cls->merge)(tmp_sect, *sect, op_data) < 0)
if((*tmp_sect_cls->merge)(&tmp_sect, *sect, op_data) < 0)
HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, "can't merge two sections")
/* Retarget section pointer to 'less than' node that was merged into */
*sect = tmp_sect;
if(*sect == NULL)
HGOTO_DONE(ret_value);
/* Indicate successful merge occurred */
modified = TRUE;
@ -1254,9 +1259,13 @@ H5FS_sect_merge(H5FS_t *fspace, H5FS_section_info_t **sect, void *op_data)
HGOTO_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't remove section from internal data structures")
/* Merge the two sections together */
if((*sect_cls->merge)(*sect, tmp_sect, op_data) < 0)
if((*sect_cls->merge)(sect, tmp_sect, op_data) < 0)
HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, "can't merge two sections")
/* It's possible that the merge caused the section to be deleted (particularly in the paged allocation case) */
if(*sect == NULL)
HGOTO_DONE(ret_value);
/* Indicate successful merge occurred */
modified = TRUE;
} /* end if */
@ -1383,7 +1392,7 @@ HDfprintf(stderr, "%s: *sect = {%a, %Hu, %u, %s}\n", FUNC, sect->addr, sect->siz
/* Call "add" section class callback, if there is one */
cls = &fspace->sect_cls[sect->type];
if(cls->add) {
if((*cls->add)(sect, &flags, op_data) < 0)
if((*cls->add)(&sect, &flags, op_data) < 0)
HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, "'add' section class callback failed")
} /* end if */
@ -1411,7 +1420,7 @@ HDfprintf(stderr, "%s: fspace->tot_space = %Hu\n", FUNC, fspace->tot_space);
#endif /* H5FS_SINFO_DEBUG */
/* Mark free space sections as changed */
/* (if adding sections while deserializing sections, don't set the flag) */
if(!(flags & H5FS_ADD_DESERIALIZING))
if(!(flags & (H5FS_ADD_DESERIALIZING | H5FS_PAGE_END_NO_ADD)))
sinfo_modified = TRUE;
done:
@ -1444,7 +1453,7 @@ HDfprintf(stderr, "%s: Leaving, ret_value = %d\n", FUNC, ret_value);
*/
htri_t
H5FS_sect_try_extend(H5F_t *f, hid_t dxpl_id, H5FS_t *fspace, haddr_t addr,
hsize_t size, hsize_t extra_requested)
hsize_t size, hsize_t extra_requested, unsigned flags, void *op_data)
{
hbool_t sinfo_valid = FALSE; /* Whether the section info is valid */
hbool_t sinfo_modified = FALSE; /* Whether the section info was modified */
@ -1528,10 +1537,16 @@ if(_section_)
/* Adjust section by amount requested */
sect->addr += extra_requested;
sect->size -= extra_requested;
if(cls->add)
if((*cls->add)(&sect, &flags, op_data) < 0)
HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, "'add' section class callback failed")
/* Re-add adjusted section to free sections data structures */
if(H5FS_sect_link(fspace, sect, 0) < 0)
HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, "can't insert free space section into skip list")
/* Re-adding the section could cause it to disappear (particularly when paging) */
if(sect) {
/* Re-add adjusted section to free sections data structures */
if(H5FS_sect_link(fspace, sect, 0) < 0)
HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, "can't insert free space section into skip list")
} /* end if */
} /* end if */
else {
/* Sanity check */
@ -1667,7 +1682,7 @@ HDfprintf(stderr, "%s: fspace->sinfo->nbins = %u\n", FUNC, fspace->sinfo->nbins)
HDfprintf(stderr, "%s: bin = %u\n", FUNC, bin);
#endif /* QAK */
alignment = fspace->alignment;
if(!((alignment > 1) && (request >= fspace->threshold)))
if(!((alignment > 1) && (request >= fspace->align_thres)))
alignment = 0; /* no alignment */
do {
@ -2349,7 +2364,7 @@ HDfprintf(stderr, "%s: sect->size = %Hu, sect->addr = %a, sect->type = %u\n", "H
*-------------------------------------------------------------------------
*/
htri_t
H5FS_sect_try_shrink_eoa(const H5F_t *f, hid_t dxpl_id, const H5FS_t *fspace, void *op_data)
H5FS_sect_try_shrink_eoa(H5F_t *f, hid_t dxpl_id, H5FS_t *fspace, void *op_data)
{
hbool_t sinfo_valid = FALSE; /* Whether the section info is valid */
hbool_t section_removed = FALSE; /* Whether a section was removed */
@ -2406,42 +2421,264 @@ done:
/*-------------------------------------------------------------------------
* Function: H5FS_sect_query_last_sect
* Function: H5FS_vfd_alloc_hdr_and_section_info_if_needed
*
* Purpose: Retrieve info about the last section on the merge list
* Purpose: This function is part of a hack to patch over a design
* flaw in the free space managers for file space allocation.
* Specifically, if a free space manager allocates space for
* its own section info, it is possible for it to
* go into an infinite loop as it:
*
* Return: Success: non-negative
* Failure: negative
* 1) computes the size of the section info
*
* Programmer: Vailin Choi
* 2) allocates file space for the section info
*
* 3) notices that the size of the section info
* has changed
*
* 4) deallocates the section info file space and
* returns to 1) above.
*
* Similarly, if it allocates space for its own header, it
* can go into an infinte loop as it:
*
* 1) allocates space for the header
*
* 2) notices that the free space manager is empty
* and thus should not have file space allocated
* to its header
*
* 3) frees the space allocated to the header
*
* 4) notices that the free space manager is not
* empty and thus must have file space allocated
* to it, and thus returns to 1) above.
*
* In a nutshell, the solution applied in this hack is to
* deallocate file space for the free space manager(s) that
* handle FSM header and/or section info file space allocations,
* wait until all other allocation/deallocation requests have
* been handled, and then test to see if the free space manager(s)
* in question are empty. If they are, do nothing. If they
* are not, allocate space for them at end of file bypassing the
* usual file space allocation calls, and thus avoiding the
* potential infinite loops.
*
* The purpose of this function is to allocate file space for
* the header and section info of the target free space manager
* directly from the VFD if needed. In this case the function
* also re-inserts the header and section info in the metadata
* cache with this allocation.
*
* When paged allocation is not enabled, allocation of space
* for the free space manager header and section info is
* straight forward -- we simply allocate the space directly
* from file driver.
*
* Note that if f->shared->alignment > 1, and EOA is not a
* multiple of the alignment, it is possible that performing
* these allocations may generate a fragment of file space in
* addition to the space allocated for the section info. This
* excess space is dropped on the floor. As shall be seen,
* it will usually be reclaimed later.
*
* When page allocation is enabled, things are more difficult,
* as there is the possibility that page buffering will be
* enabled when the free space managers are read. To allow
* for this, we must ensure that space allocated for the
* free space manager header and section info is either larger
* than a page, or resides completely withing a page.
*
* Do this by allocating space for the free space header and
* section info starting at page boundaries, and extending
* allocation to the next page boundary. This of course wastes
* space, but see below.
*
* On the first free space allocation / deallocation after the
* next file open, we will read the self referential free space
* managers, float them and reduce the EOA to its value prior
* to allocation of file space for the self referential free
* space managers on the preceeding file close. This EOA value
* is stored in the free space manager superblock extension
* message.
*
* Return: Success: non-negative
* Failure: negative
*
* Programmer: John Mainzer
* 6/6/16
*
*-------------------------------------------------------------------------
*/
herr_t
H5FS_sect_query_last_sect(const H5FS_t *fspace, haddr_t *sect_addr, hsize_t *sect_size)
H5FS_vfd_alloc_hdr_and_section_info_if_needed(H5F_t *f, hid_t dxpl_id,
H5FS_t *fspace, haddr_t *fs_addr_ptr)
{
FUNC_ENTER_NOAPI_NOINIT_NOERR
hsize_t hdr_alloc_size;
hsize_t sinfo_alloc_size;
haddr_t sect_addr = HADDR_UNDEF; /* address of sinfo */
haddr_t eoa_frag_addr = HADDR_UNDEF; /* Address of fragment at EOA */
hsize_t eoa_frag_size = 0; /* Size of fragment at EOA */
haddr_t eoa = HADDR_UNDEF; /* Initial EOA for the file */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
/* Check arguments. */
HDassert(f);
HDassert(f->shared);
HDassert(f->shared->lf);
HDassert(fspace);
HDassert(fs_addr_ptr);
if(fspace->sinfo && fspace->sinfo->merge_list) {
H5SL_node_t *last_node; /* Last node in merge list */
/* the section info should be unlocked */
HDassert(fspace->sinfo_lock_count == 0);
/* Check for last node in the merge list */
if(NULL != (last_node = H5SL_last(fspace->sinfo->merge_list))) {
H5FS_section_info_t *tmp_sect; /* Temporary free space section */
/* no space should be allocated */
HDassert(*fs_addr_ptr == HADDR_UNDEF);
HDassert(fspace->addr == HADDR_UNDEF);
HDassert(fspace->sect_addr == HADDR_UNDEF);
HDassert(fspace->alloc_sect_size == 0);
/* Get the pointer to the last section, from the last node */
tmp_sect = (H5FS_section_info_t *)H5SL_item(last_node);
HDassert(tmp_sect);
if(sect_addr)
*sect_addr = tmp_sect->addr;
if(sect_size)
*sect_size = tmp_sect->size;
} /* end if */
/* persistant free space managers must be enabled */
HDassert(f->shared->fs_persist);
/* At present, all free space strategies enable the free space managers.
* This will probably change -- at which point this assertion should
* be revisited.
*/
/* Updated: Only the following two strategies enable the free-space managers */
HDassert((f->shared->fs_strategy == H5F_FSPACE_STRATEGY_FSM_AGGR) ||
(f->shared->fs_strategy == H5F_FSPACE_STRATEGY_PAGE));
if(fspace->serial_sect_count > 0) {
/* the section info is floating, so space->sinfo should be defined */
HDassert(fspace->sinfo);
/* start by allocating file space for the header */
/* Get the EOA for the file -- need for sanity check below */
if(HADDR_UNDEF == (eoa = H5F_get_eoa(f, H5FD_MEM_FSPACE_HDR)))
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "Unable to get eoa")
/* check for overlap into temporary allocation space */
if(H5F_IS_TMP_ADDR(f, (eoa + fspace->sect_size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_BADRANGE, FAIL, "hdr file space alloc will overlap into 'temporary' file space")
hdr_alloc_size = H5FS_HEADER_SIZE(f);
/* if page allocation is enabled, extend the hdr_alloc_size to the
* next page boundary.
*/
if(H5F_PAGED_AGGR(f)) {
HDassert(0 == (eoa % f->shared->fs_page_size));
hdr_alloc_size = ((hdr_alloc_size / f->shared->fs_page_size) + 1) * f->shared->fs_page_size;
HDassert(hdr_alloc_size >= H5FS_HEADER_SIZE(f));
HDassert((hdr_alloc_size % f->shared->fs_page_size) == 0);
} /* end if */
/* allocate space for the hdr */
if(HADDR_UNDEF == (fspace->addr = H5FD_alloc(f->shared->lf, dxpl_id,
H5FD_MEM_FSPACE_HDR, f,
hdr_alloc_size,
&eoa_frag_addr,
&eoa_frag_size)))
HGOTO_ERROR(H5E_FSPACE, H5E_CANTALLOC, FAIL, "can't allocate file space for hdr")
/* if the file alignement is 1, there should be no
* eoa fragment. Otherwise, drop any fragment on the floor.
*/
HDassert((eoa_frag_size == 0) || (f->shared->alignment != 1));
/* Cache the new free space header (pinned) */
if(H5AC_insert_entry(f, dxpl_id, H5AC_FSPACE_HDR, fspace->addr, fspace, H5AC__PIN_ENTRY_FLAG) < 0)
HGOTO_ERROR(H5E_FSPACE, H5E_CANTINIT, FAIL, "can't add free space header to cache")
*fs_addr_ptr = fspace->addr;
/* now allocate file space for the section info */
/* Get the EOA for the file -- need for sanity check below */
if(HADDR_UNDEF == (eoa = H5F_get_eoa(f, H5FD_MEM_FSPACE_SINFO)))
HGOTO_ERROR(H5E_FSPACE, H5E_CANTGET, FAIL, "Unable to get eoa")
/* check for overlap into temporary allocation space */
if(H5F_IS_TMP_ADDR(f, (eoa + fspace->sect_size)))
HGOTO_ERROR(H5E_FSPACE, H5E_BADRANGE, FAIL, "sinfo file space alloc will overlap into 'temporary' file space")
sinfo_alloc_size = fspace->sect_size;
/* if paged allocation is enabled, extend the sinfo_alloc_size to the
* next page boundary.
*/
if(H5F_PAGED_AGGR(f)) {
HDassert(0 == (eoa % f->shared->fs_page_size));
sinfo_alloc_size = ((sinfo_alloc_size / f->shared->fs_page_size) + 1) * f->shared->fs_page_size;
HDassert(sinfo_alloc_size >= fspace->sect_size);
HDassert((sinfo_alloc_size % f->shared->fs_page_size) == 0);
} /* end if */
/* allocate space for the section info */
if(HADDR_UNDEF == (sect_addr = H5FD_alloc(f->shared->lf, dxpl_id,
H5FD_MEM_FSPACE_SINFO, f,
sinfo_alloc_size,
&eoa_frag_addr,
&eoa_frag_size)))
HGOTO_ERROR(H5E_FSPACE, H5E_CANTALLOC, FAIL, "can't allocate file space")
/* if the file alignement is 1, there should be no
* eoa fragment. Otherwise, drop the fragment on the floor.
*/
HDassert((eoa_frag_size == 0) || (f->shared->alignment != 1));
/* update fspace->alloc_sect_size and fspace->sect_addr to reflect
* the allocation
*/
fspace->alloc_sect_size = fspace->sect_size;
fspace->sect_addr = sect_addr;
/* insert the new section info into the metadata cache. */
/* Question: Do we need to worry about this insertion causing an
* eviction from the metadata cache? Think on this. If so, add a
* flag to H5AC_insert() to force it to skip the call to make space in
* cache.
*
* On reflection, no.
*
* On a regular file close, any eviction will not change the
* the contents of the free space manger(s), as all entries
* should have correct file space allocated by the time this
* function is called.
*
* In the cache image case, the selection of entries for inclusion
* in the cache image will not take place until after this call.
* (Recall that this call is made during the metadata fsm settle
* routine, which is called during the serialization routine in
* the cache image case. Entries are not selected for inclusion
* in the image until after the cache is serialized.)
*
* JRM -- 11/4/16
*/
if(H5AC_insert_entry(f, dxpl_id, H5AC_FSPACE_SINFO, sect_addr, fspace->sinfo, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_FSPACE, H5E_CANTINIT, FAIL, "can't add free space sinfo to cache")
/* We have changed the sinfo address -- Mark free space header dirty */
if(H5AC_mark_entry_dirty(fspace) < 0)
HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, FAIL, "unable to mark free space header as dirty")
/* since space has been allocated for the section info and the sinfo
* has been inserted into the cache, relinquish owership (i.e. float)
* the section info.
*/
fspace->sinfo = NULL;
} /* end if */
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5FS_sect_query_last_sect() */
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5FS_vfd_alloc_hdr_and_section_info_if_needed() */

View File

@ -182,6 +182,14 @@ H5F_get_access_plist(H5F_t *f, hbool_t app_ref)
efc_size = H5F_efc_max_nfiles(f->shared->efc);
if(H5P_set(new_plist, H5F_ACS_EFC_SIZE_NAME, &efc_size) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set elink file cache size")
if(f->shared->page_buf != NULL) {
if(H5P_set(new_plist, H5F_ACS_PAGE_BUFFER_SIZE_NAME, &(f->shared->page_buf->max_size)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set page buffer size")
if(H5P_set(new_plist, H5F_ACS_PAGE_BUFFER_MIN_META_PERC_NAME, &(f->shared->page_buf->min_meta_perc)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set minimum metadata fraction of page buffer")
if(H5P_set(new_plist, H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_NAME, &(f->shared->page_buf->min_raw_perc)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set minimum raw data fraction of page buffer")
} /* end if */
#ifdef H5_HAVE_PARALLEL
if(H5P_set(new_plist, H5_COLL_MD_READ_FLAG_NAME, &(f->coll_md_read)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set collective metadata read flag")
@ -597,11 +605,26 @@ H5F_new(H5F_file_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_t
f->shared->flags = flags;
f->shared->sohm_addr = HADDR_UNDEF;
f->shared->sohm_vers = HDF5_SHAREDHEADER_VERSION;
for(u = 0; u < NELMTS(f->shared->fs_addr); u++)
f->shared->fs_addr[u] = HADDR_UNDEF;
f->shared->accum.loc = HADDR_UNDEF;
f->shared->lf = lf;
/* Initialization for handling file space */
for(u = 0; u < NELMTS(f->shared->fs_addr); u++) {
f->shared->fs_state[u] = H5F_FS_STATE_CLOSED;
f->shared->fs_addr[u] = HADDR_UNDEF;
f->shared->fs_man[u] = NULL;
} /* end for */
f->shared->first_alloc_dealloc = FALSE;
f->shared->eoa_pre_fsm_fsalloc = HADDR_UNDEF;
f->shared->eoa_post_fsm_fsalloc = HADDR_UNDEF;
f->shared->eoa_post_mdci_fsalloc = HADDR_UNDEF;
/* Initialization for handling file space (for paged aggregation) */
f->shared->pgend_meta_thres = H5F_FILE_SPACE_PGEND_META_THRES;
/* intialize point of no return */
f->shared->point_of_no_return = FALSE;
/*
* Copy the file creation and file access property lists into the
* new file handle. We do this early because some values might need
@ -621,8 +644,19 @@ H5F_new(H5F_file_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_t
HDassert(f->shared->sohm_nindexes < 255);
if(H5P_get(plist, H5F_CRT_FILE_SPACE_STRATEGY_NAME, &f->shared->fs_strategy) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get file space strategy")
if(H5P_get(plist, H5F_CRT_FREE_SPACE_PERSIST_NAME, &f->shared->fs_persist) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get file space persisting status")
if(H5P_get(plist, H5F_CRT_FREE_SPACE_THRESHOLD_NAME, &f->shared->fs_threshold) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get free-space section threshold")
if(H5P_get(plist, H5F_CRT_FILE_SPACE_PAGE_SIZE_NAME, &f->shared->fs_page_size) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get file space page size")
HDassert(f->shared->fs_page_size >= H5F_FILE_SPACE_PAGE_SIZE_MIN);
/* Temporary for multi/split drivers: fail file creation
when persisting free-space or using paged aggregation strategy */
if(H5F_HAS_FEATURE(f, H5FD_FEAT_PAGED_AGGR))
if(f->shared->fs_strategy == H5F_FSPACE_STRATEGY_PAGE || f->shared->fs_persist)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't open with this strategy or persistent fs")
/* Get the FAPL values to cache */
if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id)))
@ -972,6 +1006,11 @@ H5F__dest(H5F_t *f, hid_t meta_dxpl_id, hid_t raw_dxpl_id, hbool_t flush)
/* Push error, but keep going*/
HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "problems closing file")
/* Shutdown the page buffer cache */
if(H5PB_dest(f) < 0)
/* Push error, but keep going*/
HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "problems closing page buffer cache")
/* Clean up the metadata cache log location string */
if(f->shared->mdc_log_location)
f->shared->mdc_log_location = (char *)H5MM_xfree(f->shared->mdc_log_location);
@ -1142,6 +1181,9 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id,
H5P_genplist_t *a_plist; /*file access property list */
H5F_close_degree_t fc_degree; /*file close degree */
hid_t raw_dxpl_id = H5AC_rawdata_dxpl_id; /* Raw data dxpl used by library */
size_t page_buf_size;
unsigned page_buf_min_meta_perc;
unsigned page_buf_min_raw_perc;
hbool_t set_flag = FALSE; /*set the status_flags in the superblock */
hbool_t clear = FALSE; /*clear the status_flags */
hbool_t evict_on_close; /* evict on close value from plist */
@ -1292,6 +1334,25 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id,
if(NULL == (a_plist = (H5P_genplist_t *)H5I_object(fapl_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not file access property list")
/* Check if page buffering is enabled */
if(H5P_get(a_plist, H5F_ACS_PAGE_BUFFER_SIZE_NAME, &page_buf_size) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't get page buffer size")
if(page_buf_size) {
#ifdef H5_HAVE_PARALLEL
/* Collective metadata writes are not supported with page buffering */
if(file->coll_md_write)
HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "collective metadata writes are not supported with page buffering")
/* Temporary: fail file create when page buffering feature is enabled for parallel */
HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "page buffering is disabled for parallel")
#endif /* H5_HAVE_PARALLEL */
/* Query for other page buffer cache properties */
if(H5P_get(a_plist, H5F_ACS_PAGE_BUFFER_MIN_META_PERC_NAME, &page_buf_min_meta_perc) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't get minimum metadata fraction of page buffer")
if(H5P_get(a_plist, H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_NAME, &page_buf_min_raw_perc) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't get minimum raw data fraction of page buffer")
} /* end if */
/*
* Read or write the file superblock, depending on whether the file is
* empty or not.
@ -1302,6 +1363,11 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id,
* to create & write the superblock.
*/
/* Create the page buffer before initializing the superblock */
if(page_buf_size)
if(H5PB_create(file, page_buf_size, page_buf_min_meta_perc, page_buf_min_raw_perc) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to create page buffer")
/* Initialize information about the superblock and allocate space for it */
/* (Writes superblock extension messages, if there are any) */
if(H5F__super_init(file, meta_dxpl_id) < 0)
@ -1319,6 +1385,11 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id,
if(H5F__super_read(file, meta_dxpl_id, raw_dxpl_id, TRUE) < 0)
HGOTO_ERROR(H5E_FILE, H5E_READERROR, NULL, "unable to read superblock")
/* Create the page buffer before initializing the superblock */
if(page_buf_size)
if(H5PB_create(file, page_buf_size, page_buf_min_meta_perc, page_buf_min_raw_perc) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to create page buffer")
/* Open the root group */
if(H5G_mkroot(file, meta_dxpl_id, FALSE) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to read root group")
@ -1527,6 +1598,11 @@ H5F__flush_phase2(H5F_t *f, hid_t meta_dxpl_id, hid_t raw_dxpl_id, hbool_t closi
/* Push error, but keep going*/
HDONE_ERROR(H5E_IO, H5E_CANTFLUSH, FAIL, "unable to flush metadata accumulator")
/* Flush the page buffer */
if(H5PB_flush(&fio_info) < 0)
/* Push error, but keep going*/
HDONE_ERROR(H5E_IO, H5E_CANTFLUSH, FAIL, "page buffer flush failed")
/* Flush file buffers to disk. */
if(H5FD_flush(f->shared->lf, meta_dxpl_id, closing) < 0)
/* Push error, but keep going*/
@ -2652,6 +2728,38 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5F__set_eoa() */
/*-------------------------------------------------------------------------
* Function: H5F__set_paged_aggr
*
* Purpose: Quick and dirty routine to set the file's paged_aggr mode
*
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol <koziol@hdfgroup.org>
* June 19, 2015
*
*-------------------------------------------------------------------------
*/
herr_t
H5F__set_paged_aggr(const H5F_t *f, hbool_t paged)
{
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(f);
HDassert(f->shared);
/* Dispatch to driver */
if(H5FD_set_paged_aggr(f->shared->lf, paged) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "driver set paged aggr mode failed")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5F__set_paged_aggr() */
#ifdef H5_HAVE_PARALLEL
/*-------------------------------------------------------------------------

View File

@ -39,6 +39,7 @@
#include "H5Fpkg.h" /* File access */
#include "H5FDprivate.h" /* File drivers */
#include "H5Iprivate.h" /* IDs */
#include "H5PBprivate.h" /* Page Buffer */
/****************/
@ -129,9 +130,9 @@ H5F_block_read(const H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get property list")
} /* end else */
/* Pass through metadata accumulator layer */
if(H5F__accum_read(&fio_info, map_type, addr, size, buf) < 0)
HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "read through metadata accumulator failed")
/* Pass through page buffer layer */
if(H5PB_read(&fio_info, map_type, addr, size, buf) < 0)
HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "read through page buffer failed")
done:
FUNC_LEAVE_NOAPI(ret_value)
@ -191,9 +192,9 @@ H5F_block_write(const H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get property list")
} /* end else */
/* Pass through metadata accumulator layer */
if(H5F__accum_write(&fio_info, map_type, addr, size, buf) < 0)
HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "write through metadata accumulator failed")
/* Pass through page buffer layer */
if(H5PB_write(&fio_info, map_type, addr, size, buf) < 0)
HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "write through page buffer failed")
done:
FUNC_LEAVE_NOAPI(ret_value)

View File

@ -42,6 +42,7 @@
#include "H5FSprivate.h" /* File free space */
#include "H5Gprivate.h" /* Groups */
#include "H5Oprivate.h" /* Object header messages */
#include "H5PBprivate.h" /* Page buffer */
#include "H5UCprivate.h" /* Reference counted object functions */
@ -68,8 +69,8 @@
/* Macro to abstract checking whether file is using a free space manager */
#define H5F_HAVE_FREE_SPACE_MANAGER(F) \
((F)->shared->fs_strategy == H5F_FILE_SPACE_ALL || \
(F)->shared->fs_strategy == H5F_FILE_SPACE_ALL_PERSIST)
((F)->shared->fs_strategy == H5F_FSPACE_STRATEGY_FSM_AGGR || \
(F)->shared->fs_strategy == H5F_FSPACE_STRATEGY_PAGE)
/* Macros for encoding/decoding superblock */
#define H5F_MAX_DRVINFOBLOCK_SIZE 1024 /* Maximum size of superblock driver info buffer */
@ -200,13 +201,6 @@ typedef struct H5F_meta_accum_t {
hbool_t dirty; /* Flag to indicate that the accumulated metadata is dirty */
} H5F_meta_accum_t;
/* Enum for free space manager state */
typedef enum H5F_fs_state_t {
H5F_FS_STATE_CLOSED, /* Free space manager is closed */
H5F_FS_STATE_OPEN, /* Free space manager has been opened */
H5F_FS_STATE_DELETING /* Free space manager is being deleted */
} H5F_fs_state_t;
/* A record of the mount table */
typedef struct H5F_mount_t {
struct H5G_t *group; /* Mount point group held open */
@ -281,6 +275,7 @@ struct H5F_file_t {
unsigned long feature_flags; /* VFL Driver feature Flags */
haddr_t maxaddr; /* Maximum address for file */
H5PB_t *page_buf; /* The page buffer cache */
H5AC_t *cache; /* The object cache */
H5AC_cache_config_t
mdc_initCacheCfg; /* initial configuration for the */
@ -316,19 +311,38 @@ struct H5F_file_t {
H5UC_t *grp_btree_shared; /* Ref-counted group B-tree node info */
/* File space allocation information */
H5F_file_space_type_t fs_strategy; /* File space handling strategy */
H5F_fspace_strategy_t fs_strategy; /* File space handling strategy */
hsize_t fs_threshold; /* Free space section threshold */
hbool_t fs_persist; /* Free-space persist or not */
hbool_t use_tmp_space; /* Whether temp. file space allocation is allowed */
haddr_t tmp_addr; /* Next address to use for temp. space in the file */
hbool_t point_of_no_return; /* flag to indicate that we can't go back and delete a freespace header when it's used up */
H5F_fs_state_t fs_state[H5F_MEM_PAGE_NTYPES]; /* State of free space manager for each type */
haddr_t fs_addr[H5F_MEM_PAGE_NTYPES]; /* Address of free space manager info for each type */
H5FS_t *fs_man[H5F_MEM_PAGE_NTYPES]; /* Free space manager for each file space type */
hbool_t first_alloc_dealloc; /* TRUE iff free space managers */
/* are persistant and have not */
/* been used accessed for either */
/* allocation or deallocation */
/* since file open. */
haddr_t eoa_pre_fsm_fsalloc; /* eoa pre file space allocation */
/* for self referential FSMs */
haddr_t eoa_post_fsm_fsalloc; /* eoa post file space allocation */
/* for self referential FSMs */
haddr_t eoa_post_mdci_fsalloc; /* eoa past file space allocation */
/* for metadata cache image, or */
/* HADDR_UNDEF if no cache image. */
/* Free-space aggregation info */
unsigned fs_aggr_merge[H5FD_MEM_NTYPES]; /* Flags for whether free space can merge with aggregator(s) */
H5F_fs_state_t fs_state[H5FD_MEM_NTYPES]; /* State of free space manager for each type */
haddr_t fs_addr[H5FD_MEM_NTYPES]; /* Address of free space manager info for each type */
H5FS_t *fs_man[H5FD_MEM_NTYPES]; /* Free space manager for each file space type */
H5FD_mem_t fs_type_map[H5FD_MEM_NTYPES]; /* Mapping of "real" file space type into tracked type */
H5F_blk_aggr_t meta_aggr; /* Metadata aggregation info */
/* (if aggregating metadata allocations) */
H5F_blk_aggr_t sdata_aggr; /* "Small data" aggregation info */
/* (if aggregating "small data" allocations) */
H5FD_mem_t fs_type_map[H5FD_MEM_NTYPES]; /* Mapping of "real" file space type into tracked type */
H5F_blk_aggr_t meta_aggr; /* Metadata aggregation info (if aggregating metadata allocations) */
H5F_blk_aggr_t sdata_aggr; /* "Small data" aggregation info (if aggregating "small data" allocations) */
/* Paged aggregation info */
hsize_t fs_page_size; /* File space page size */
size_t pgend_meta_thres; /* Do not track page end meta section <= this threshold */
/* Metadata accumulator information */
H5F_meta_accum_t accum; /* Metadata accumulator info */
@ -383,7 +397,7 @@ H5FL_EXTERN(H5F_file_t);
/* General routines */
H5F_t *H5F_new(H5F_file_t *shared, unsigned flags, hid_t fcpl_id,
hid_t fapl_id, H5FD_t *lf);
herr_t H5F__dest(H5F_t *f, hid_t meta_dxpl_id, hid_t raw_dxpl_id, hbool_t flush);
H5_DLL herr_t H5F__dest(H5F_t *f, hid_t meta_dxpl_id, hid_t raw_dxpl_id, hbool_t flush);
H5_DLL herr_t H5F__flush(H5F_t *f, hid_t meta_dxpl_id, hid_t raw_dxpl_id, hbool_t closing);
H5_DLL htri_t H5F__is_hdf5(const char *name, hid_t meta_dxpl_id, hid_t raw_dxpl_id);
H5_DLL herr_t H5F_get_objects(const H5F_t *f, unsigned types, size_t max_index, hid_t *obj_id_list, hbool_t app_ref, size_t *obj_id_count_ptr);
@ -433,9 +447,16 @@ H5_DLL herr_t H5F_efc_release(H5F_efc_t *efc);
H5_DLL herr_t H5F_efc_destroy(H5F_efc_t *efc);
H5_DLL herr_t H5F_efc_try_close(H5F_t *f);
/* Space allocation routines */
H5_DLL haddr_t H5F_alloc(H5F_t *f, hid_t dxpl_id, H5F_mem_t type, hsize_t size, haddr_t *frag_addr, hsize_t *frag_size);
H5_DLL herr_t H5F_free(H5F_t *f, hid_t dxpl_id, H5F_mem_t type, haddr_t addr, hsize_t size);
H5_DLL htri_t H5F_try_extend(H5F_t *f, hid_t dxpl_id, H5FD_mem_t type,
haddr_t blk_end, hsize_t extra_requested);
/* Functions that get/retrieve values from VFD layer */
H5_DLL herr_t H5F__set_eoa(const H5F_t *f, H5F_mem_t type, haddr_t addr);
H5_DLL herr_t H5F__set_base_addr(const H5F_t *f, haddr_t addr);
H5_DLL herr_t H5F__set_paged_aggr(const H5F_t *f, hbool_t paged);
/* Functions that flush or evict */
H5_DLL herr_t H5F__evict_cache_entries(H5F_t *f, hid_t dxpl_id);

View File

@ -315,8 +315,8 @@
#define H5F_SET_STORE_MSG_CRT_IDX(F, FL) ((F)->shared->store_msg_crt_idx = (FL))
#define H5F_GRP_BTREE_SHARED(F) ((F)->shared->grp_btree_shared)
#define H5F_SET_GRP_BTREE_SHARED(F, RC) (((F)->shared->grp_btree_shared = (RC)) ? SUCCEED : FAIL)
#define H5F_USE_TMP_SPACE(F) ((F)->shared->use_tmp_space)
#define H5F_IS_TMP_ADDR(F, ADDR) (H5F_addr_le((F)->shared->tmp_addr, (ADDR)))
#define H5F_USE_TMP_SPACE(F) ((F)->shared->fs.use_tmp_space)
#define H5F_IS_TMP_ADDR(F, ADDR) (H5F_addr_le((F)->shared->fs.tmp_addr, (ADDR)))
#define H5F_SET_LATEST_FLAGS(F, FL) ((F)->shared->latest_flags = (FL))
#ifdef H5_HAVE_PARALLEL
#define H5F_COLL_MD_READ(F) ((F)->coll_md_read)
@ -324,6 +324,12 @@
#define H5F_USE_MDC_LOGGING(F) ((F)->shared->use_mdc_logging)
#define H5F_START_MDC_LOG_ON_ACCESS(F) ((F)->shared->start_mdc_log_on_access)
#define H5F_MDC_LOG_LOCATION(F) ((F)->shared->mdc_log_location)
#define H5F_ALIGNMENT(F) ((F)->shared->alignment)
#define H5F_THRESHOLD(F) ((F)->shared->threshold)
#define H5F_PGEND_META_THRES(F) ((F)->shared->fs.pgend_meta_thres)
#define H5F_POINT_OF_NO_RETURN(F) ((F)->shared->fs.point_of_no_return)
#define H5F_FIRST_ALLOC_DEALLOC(F) ((F)->shared->first_alloc_dealloc)
#define H5F_EOA_PRE_FSM_FSALLOC(F) ((F)->shared->eoa_pre_fsm_fsalloc)
#else /* H5F_MODULE */
#define H5F_INTENT(F) (H5F_get_intent(F))
#define H5F_OPEN_NAME(F) (H5F_get_open_name(F))
@ -375,6 +381,12 @@
#define H5F_USE_MDC_LOGGING(F) (H5F_use_mdc_logging(F))
#define H5F_START_MDC_LOG_ON_ACCESS(F) (H5F_start_mdc_log_on_access(F))
#define H5F_MDC_LOG_LOCATION(F) (H5F_mdc_log_location(F))
#define H5F_ALIGNMENT(F) (H5F_get_alignment(F))
#define H5F_THRESHOLD(F) (H5F_get_threshold(F))
#define H5F_PGEND_META_THRES(F) (H5F_get_pgend_meta_thres(F))
#define H5F_POINT_OF_NO_RETURN(F) (H5F_get_point_of_no_return(F))
#define H5F_FIRST_ALLOC_DEALLOC(F) (H5F_get_first_alloc_dealloc(F))
#define H5F_EOA_PRE_FSM_FSALLOC(F) (H5F_get_eoa_pre_fsm_fsalloc(F))
#endif /* H5F_MODULE */
@ -448,7 +460,9 @@
#define H5F_CRT_SHMSG_LIST_MAX_NAME "shmsg_list_max" /* Shared message list maximum size */
#define H5F_CRT_SHMSG_BTREE_MIN_NAME "shmsg_btree_min" /* Shared message B-tree minimum size */
#define H5F_CRT_FILE_SPACE_STRATEGY_NAME "file_space_strategy" /* File space handling strategy */
#define H5F_CRT_FREE_SPACE_PERSIST_NAME "free_space_persist" /* Free-space persisting status */
#define H5F_CRT_FREE_SPACE_THRESHOLD_NAME "free_space_threshold" /* Free space section threshold */
#define H5F_CRT_FILE_SPACE_PAGE_SIZE_NAME "file_space_page_size" /* File space page size */
@ -484,6 +498,9 @@
#define H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_NAME "core_write_tracking_page_size" /* The page size in kiB when core VFD write tracking is enabled */
#define H5F_ACS_COLL_MD_WRITE_FLAG_NAME "collective_metadata_write" /* property indicating whether metadata writes are done collectively or not */
#define H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_NAME "mdc_initCacheImageCfg" /* Initial metadata cache image creation configuration */
#define H5F_ACS_PAGE_BUFFER_SIZE_NAME "page_buffer_size" /* the maximum size for the page buffer cache */
#define H5F_ACS_PAGE_BUFFER_MIN_META_PERC_NAME "page_buffer_min_meta_perc" /* the min metadata percentage for the page buffer cache */
#define H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_NAME "page_buffer_min_raw_perc" /* the min raw data percentage for the page buffer cache */
/* ======================== File Mount properties ====================*/
#define H5F_MNT_SYM_LOCAL_NAME "local" /* Whether absolute symlinks local to file. */
@ -522,10 +539,34 @@
/* See format specification on version 1 B-trees */
/* Default file space handling strategy */
#define H5F_FILE_SPACE_STRATEGY_DEF H5F_FILE_SPACE_ALL
#define H5F_FILE_SPACE_STRATEGY_DEF H5F_FSPACE_STRATEGY_FSM_AGGR
/* Default free space section threshold used by free-space managers */
#define H5F_FREE_SPACE_PERSIST_DEF FALSE
/* Default free space section threshold used by free-space managers */
#define H5F_FREE_SPACE_THRESHOLD_DEF 1
/* For paged aggregation: default file space page size when not set */
#define H5F_FILE_SPACE_PAGE_SIZE_DEF 4096
/* For paged aggregation: minimum value for file space page size */
#define H5F_FILE_SPACE_PAGE_SIZE_MIN 512
/* For paged aggregation: drop free-space with size <= this threshold for small meta section */
#define H5F_FILE_SPACE_PGEND_META_THRES 10
/* Default for threshold for alignment (can be set via H5Pset_alignment()) */
#define H5F_ALIGN_DEF 1
/* Default for alignment (can be set via H5Pset_alignment()) */
#define H5F_ALIGN_THRHD_DEF 1
/* Default size for meta data aggregation block (can be set via H5Pset_meta_block_size()) */
#define H5F_META_BLOCK_SIZE_DEF 2048
/* Default size for small data aggregation block (can be set via H5Pset_small_data_block_size()) */
#define H5F_SDATA_BLOCK_SIZE_DEF 2048
/* Check for file using paged aggregation */
#define H5F_PAGED_AGGR(F) (F->shared->fs_strategy == H5F_FSPACE_STRATEGY_PAGE && F->shared->fs_page_size)
/* Metadata read attempt values */
#define H5F_METADATA_READ_ATTEMPTS 1 /* Default # of read attempts for non-SWMR access */
#define H5F_SWMR_METADATA_READ_ATTEMPTS 100 /* Default # of read attempts for SWMR access */
@ -648,6 +689,34 @@ typedef struct H5F_block_t {
hsize_t length; /* Length of the block in the file */
} H5F_block_t;
/* Enum for free space manager state */
typedef enum H5F_fs_state_t {
H5F_FS_STATE_CLOSED = 0, /* Free space manager is closed */
H5F_FS_STATE_OPEN = 1, /* Free space manager has been opened */
H5F_FS_STATE_DELETING = 2 /* Free space manager is being deleted */
} H5F_fs_state_t;
/* For paged aggregation */
/* The values 0 to 6 is the same as H5F_mem_t */
typedef enum H5F_mem_page_t {
H5F_MEM_PAGE_DEFAULT = 0, /* Not used */
H5F_MEM_PAGE_SUPER = 1,
H5F_MEM_PAGE_BTREE = 2,
H5F_MEM_PAGE_DRAW = 3,
H5F_MEM_PAGE_GHEAP = 4,
H5F_MEM_PAGE_LHEAP = 5,
H5F_MEM_PAGE_OHDR = 6,
H5F_MEM_PAGE_LARGE_SUPER = 7,
H5F_MEM_PAGE_LARGE_BTREE = 8,
H5F_MEM_PAGE_LARGE_DRAW = 9,
H5F_MEM_PAGE_LARGE_GHEAP = 10,
H5F_MEM_PAGE_LARGE_LHEAP = 11,
H5F_MEM_PAGE_LARGE_OHDR = 12,
H5F_MEM_PAGE_NTYPES = 13 /* Sentinel value - must be last */
} H5F_mem_page_t;
#define H5F_MEM_PAGE_META H5F_MEM_PAGE_SUPER /* Small-sized meta data */
#define H5F_MEM_PAGE_GENERIC H5F_MEM_PAGE_LARGE_SUPER /* Large-sized generic: meta and raw */
/*****************************/
/* Library-private Variables */
@ -682,6 +751,10 @@ H5_DLL hid_t H5F_get_access_plist(H5F_t *f, hbool_t app_ref);
H5_DLL hid_t H5F_get_id(H5F_t *file, hbool_t app_ref);
H5_DLL herr_t H5F_get_obj_count(const H5F_t *f, unsigned types, hbool_t app_ref, size_t *obj_id_count_ptr);
H5_DLL herr_t H5F_get_obj_ids(const H5F_t *f, unsigned types, size_t max_objs, hid_t *oid_list, hbool_t app_ref, size_t *obj_id_count_ptr);
H5_DLL hsize_t H5F_get_pgend_meta_thres(const H5F_t *f);
H5_DLL hbool_t H5F_get_point_of_no_return(const H5F_t *f);
H5_DLL hbool_t H5F_get_first_alloc_dealloc(const H5F_t *f);
H5_DLL hbool_t H5F_get_eoa_pre_fsm_fsalloc(const H5F_t *f);
/* Functions than retrieve values set/cached from the superblock/FCPL */
H5_DLL haddr_t H5F_get_base_addr(const H5F_t *f);
@ -712,6 +785,8 @@ H5_DLL herr_t H5F_set_grp_btree_shared(H5F_t *f, struct H5UC_t *rc);
H5_DLL hbool_t H5F_use_tmp_space(const H5F_t *f);
H5_DLL hbool_t H5F_is_tmp_addr(const H5F_t *f, haddr_t addr);
H5_DLL herr_t H5F_set_latest_flags(H5F_t *f, unsigned flags);
H5_DLL hsize_t H5F_get_alignment(const H5F_t *f);
H5_DLL hsize_t H5F_get_threshold(const H5F_t *f);
#ifdef H5_HAVE_PARALLEL
H5_DLL H5P_coll_md_read_flag_t H5F_coll_md_read(const H5F_t *f);
H5_DLL void H5F_set_coll_md_read(H5F_t *f, H5P_coll_md_read_flag_t flag);

View File

@ -182,6 +182,17 @@ typedef enum H5F_libver_t {
} H5F_libver_t;
/* File space handling strategy */
typedef enum H5F_fspace_strategy_t {
H5F_FSPACE_STRATEGY_FSM_AGGR = 0, /* Mechanisms: free-space managers, aggregators, and virtual file drivers */
/* This is the library default when not set */
H5F_FSPACE_STRATEGY_PAGE = 1, /* Mechanisms: free-space managers with embedded paged aggregation and virtual file drivers */
H5F_FSPACE_STRATEGY_AGGR = 2, /* Mechanisms: aggregators and virtual file drivers */
H5F_FSPACE_STRATEGY_NONE = 3, /* Mechanisms: virtual file drivers */
H5F_FSPACE_STRATEGY_NTYPES /* must be last */
} H5F_fspace_strategy_t;
/* Deprecated: File space handling strategy for release 1.10.0 */
/* They are mapped to H5F_fspace_strategy_t as defined above from release 1.10.1 onwards */
typedef enum H5F_file_space_type_t {
H5F_FILE_SPACE_DEFAULT = 0, /* Default (or current) free space strategy setting */
H5F_FILE_SPACE_ALL_PERSIST = 1, /* Persistent free space managers, aggregators, virtual file driver */
@ -253,6 +264,10 @@ H5_DLL herr_t H5Fget_mdc_logging_status(hid_t file_id,
/*OUT*/ hbool_t *is_enabled,
/*OUT*/ hbool_t *is_currently_logging);
H5_DLL herr_t H5Fformat_convert(hid_t fid);
H5_DLL herr_t H5Freset_page_buffering_stats(hid_t file_id);
H5_DLL herr_t H5Fget_page_buffering_stats(hid_t file_id, unsigned accesses[2],
unsigned hits[2], unsigned misses[2], unsigned evictions[2], unsigned bypasses[2]);
#ifdef H5_HAVE_PARALLEL
H5_DLL herr_t H5Fset_mpi_atomicity(hid_t file_id, hbool_t flag);
H5_DLL herr_t H5Fget_mpi_atomicity(hid_t file_id, hbool_t *flag);

View File

@ -1235,3 +1235,150 @@ H5F_mdc_log_location(const H5F_t *f)
FUNC_LEAVE_NOAPI(f->shared->mdc_log_location)
} /* end H5F_mdc_log_location() */
/*-------------------------------------------------------------------------
* Function: H5F_get_alignment
*
* Purpose: Retrieve the 'alignment' for the file.
*
* Return: Success: Non-negative, the 'alignment'
*
* Failure: (can't happen)
*
* Programmer: Vailin Choi; Dec 2012
*
*-------------------------------------------------------------------------
*/
hsize_t
H5F_get_alignment(const H5F_t *f)
{
/* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
FUNC_ENTER_NOAPI_NOINIT_NOERR
HDassert(f);
HDassert(f->shared);
FUNC_LEAVE_NOAPI(f->shared->alignment)
} /* end H5F_get_alignment() */
/*-------------------------------------------------------------------------
* Function: H5F_get_threshold
*
* Purpose: Retrieve the 'threshold' for alignment in the file.
*
* Return: Success: Non-negative, the 'threshold'
*
* Failure: (can't happen)
*
* Programmer: Vailin Choi; Dec 2012
*
*-------------------------------------------------------------------------
*/
hsize_t
H5F_get_threshold(const H5F_t *f)
{
/* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
FUNC_ENTER_NOAPI_NOINIT_NOERR
HDassert(f);
HDassert(f->shared);
FUNC_LEAVE_NOAPI(f->shared->threshold)
} /* end H5F_get_threshold() */
/*-------------------------------------------------------------------------
* Function: H5F_get_pgend_meta_thres
*
* Purpose: Retrieve the 'page end meta threshold size' for the file.
*
* Return: Success: Non-negative, the 'pgend_meta_thres'
*
* Failure: (can't happen)
*
* Programmer: Vailin Choi; Dec 2012
*
*-------------------------------------------------------------------------
*/
hsize_t
H5F_get_pgend_meta_thres(const H5F_t *f)
{
/* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
FUNC_ENTER_NOAPI_NOINIT_NOERR
HDassert(f);
HDassert(f->shared);
FUNC_LEAVE_NOAPI(f->shared->pgend_meta_thres)
} /* end H5F_get_pgend_meta_thres() */
/*-------------------------------------------------------------------------
* Function: H5F_get_point_of_no_return
*
* Purpose: Retrieve the 'point of no return' value for the file.
*
* Return: Success: Non-negative, the 'point_of_no_return'
* Failure: (can't happen)
*
*-------------------------------------------------------------------------
*/
hbool_t
H5F_get_point_of_no_return(const H5F_t *f)
{
/* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
FUNC_ENTER_NOAPI_NOINIT_NOERR
HDassert(f);
HDassert(f->shared);
FUNC_LEAVE_NOAPI(f->shared->point_of_no_return)
} /* end H5F_get_point_of_no_return() */
/*-------------------------------------------------------------------------
* Function: H5F_get_first_alloc_dealloc
*
* Purpose: Retrieve the 'first alloc / dealloc' value for the file.
*
* Return: Success: Non-negative, the 'first_alloc_dealloc'
* Failure: (can't happen)
*
*-------------------------------------------------------------------------
*/
hbool_t
H5F_get_first_alloc_dealloc(const H5F_t *f)
{
/* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
FUNC_ENTER_NOAPI_NOINIT_NOERR
HDassert(f);
HDassert(f->shared);
FUNC_LEAVE_NOAPI(f->shared->first_alloc_dealloc)
} /* end H5F_get_first_alloc_dealloc() */
/*-------------------------------------------------------------------------
* Function: H5F_get_eoa_pre_fsm_fsalloc
*
* Purpose: Retrieve the 'EOA pre-FSM fsalloc' value for the file.
*
* Return: Success: Non-negative, the 'EOA pre-FSM fsalloc'
* Failure: (can't happen)
*
*-------------------------------------------------------------------------
*/
hbool_t
H5F_get_eoa_pre_fsm_fsalloc(const H5F_t *f)
{
/* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
FUNC_ENTER_NOAPI_NOINIT_NOERR
HDassert(f);
HDassert(f->shared);
FUNC_LEAVE_NOAPI(f->shared->eoa_pre_fsm_fsalloc)
} /* end H5F_get_eoa_pre_fsm_fsalloc() */

226
src/H5Fspace.c Normal file
View File

@ -0,0 +1,226 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* 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. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*-------------------------------------------------------------------------
*
* Created: H5Fspace.c
* Dec 30 2013
* Quincey Koziol <koziol@hdfgroup.org>
*
* Purpose: Space allocation routines for the file.
*
*-------------------------------------------------------------------------
*/
/****************/
/* Module Setup */
/****************/
#include "H5Fmodule.h" /* This source code file is part of the H5F module */
/***********/
/* Headers */
/***********/
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
#include "H5Fpkg.h" /* File access */
#include "H5FDprivate.h" /* File drivers */
/****************/
/* Local Macros */
/****************/
/******************/
/* Local Typedefs */
/******************/
/********************/
/* Package Typedefs */
/********************/
/********************/
/* Local Prototypes */
/********************/
/*********************/
/* Package Variables */
/*********************/
/*****************************/
/* Library Private Variables */
/*****************************/
/*******************/
/* Local Variables */
/*******************/
/*-------------------------------------------------------------------------
* Function: H5F_alloc
*
* Purpose: Wrapper for H5FD_alloc, to make certain EOA changes are
* reflected in superblock.
*
* Note: When the metadata cache routines are updated to allow
* marking an entry dirty without a H5F_t*, this routine should
* be changed to take a H5F_super_t* directly.
*
* Return: Success: The format address of the new file memory.
* Failure: The undefined address HADDR_UNDEF
*
* Programmer: Quincey Koziol
* Monday, December 30, 2013
*
*-------------------------------------------------------------------------
*/
haddr_t
H5F_alloc(H5F_t *f, hid_t dxpl_id, H5F_mem_t type, hsize_t size, haddr_t *frag_addr, hsize_t *frag_size)
{
haddr_t ret_value = 0; /* Return value */
FUNC_ENTER_NOAPI(HADDR_UNDEF)
/* check args */
HDassert(f);
HDassert(f->shared);
HDassert(f->shared->lf);
HDassert(type >= H5FD_MEM_DEFAULT && type < H5FD_MEM_NTYPES);
HDassert(size > 0);
/* Check whether the file can use temporary addresses */
if(f->shared->use_tmp_space) {
haddr_t eoa; /* Current EOA for the file */
/* Get the EOA for the file */
if(HADDR_UNDEF == (eoa = H5F_get_eoa(f, type)))
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, HADDR_UNDEF, "Unable to get eoa")
/* Check for overlapping into file's temporary allocation space */
if(H5F_addr_gt((eoa + size), f->shared->tmp_addr))
HGOTO_ERROR(H5E_FILE, H5E_BADRANGE, HADDR_UNDEF, "'normal' file space allocation request will overlap into 'temporary' file space")
} /* end if */
/* Call the file driver 'alloc' routine */
ret_value = H5FD_alloc(f->shared->lf, dxpl_id, type, f, size, frag_addr, frag_size);
if(!H5F_addr_defined(ret_value))
HGOTO_ERROR(H5E_FILE, H5E_CANTALLOC, HADDR_UNDEF, "file driver 'alloc' request failed")
/* Mark EOA dirty */
if(H5F_eoa_dirty(f, dxpl_id) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTMARKDIRTY, HADDR_UNDEF, "unable to mark EOA as dirty")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5F_alloc() */
/*-------------------------------------------------------------------------
* Function: H5F_free
*
* Purpose: Wrapper for H5FD_free, to make certain EOA changes are
* reflected in superblock.
*
* Note: When the metadata cache routines are updated to allow
* marking an entry dirty without a H5F_t*, this routine should
* be changed to take a H5F_super_t* directly.
*
* Return: Success: Non-negative
* Failure: Negative
*
* Programmer: Quincey Koziol
* Monday, December 30, 2013
*
*-------------------------------------------------------------------------
*/
herr_t
H5F_free(H5F_t *f, hid_t dxpl_id, H5FD_mem_t type, haddr_t addr, hsize_t size)
{
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Check args */
HDassert(f);
HDassert(f->shared);
HDassert(f->shared->lf);
HDassert(type >= H5FD_MEM_DEFAULT && type < H5FD_MEM_NTYPES);
HDassert(size > 0);
/* Call the file driver 'free' routine */
if(H5FD_free(f->shared->lf, dxpl_id, type, f, addr, size) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTFREE, FAIL, "file driver 'free' request failed")
/* Mark EOA dirty */
if(H5F_eoa_dirty(f, dxpl_id) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTMARKDIRTY, FAIL, "unable to mark EOA as dirty")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5F_free() */
/*-------------------------------------------------------------------------
* Function: H5F_try_extend
*
* Purpose: Extend a block at the end of the file, if possible.
*
* Note: When the metadata cache routines are updated to allow
* marking an entry dirty without a H5F_t*, this routine should
* be changed to take a H5F_super_t* directly.
*
* Return: Success: TRUE(1) - Block was extended
* FALSE(0) - Block could not be extended
* Failure: FAIL
*
* Programmer: Quincey Koziol
* Monday, 30 December, 2013
*
*-------------------------------------------------------------------------
*/
htri_t
H5F_try_extend(H5F_t *f, hid_t dxpl_id, H5FD_mem_t type, haddr_t blk_end, hsize_t extra_requested)
{
htri_t ret_value = FALSE; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* check args */
HDassert(f);
HDassert(f->shared);
HDassert(f->shared->lf);
HDassert(type >= H5FD_MEM_DEFAULT && type < H5FD_MEM_NTYPES);
HDassert(extra_requested > 0);
/* Extend the object by extending the underlying file */
if((ret_value = H5FD_try_extend(f->shared->lf, type, f, dxpl_id, blk_end, extra_requested)) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTEXTEND, FAIL, "driver try extend request failed")
/* H5FD_try_extend() updates driver message and marks the superblock
* dirty, so no need to do it again here.
*/
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5F_try_extend() */

View File

@ -29,6 +29,7 @@
#include "H5Fpkg.h" /* File access */
#include "H5FDprivate.h" /* File drivers */
#include "H5Iprivate.h" /* IDs */
#include "H5MFprivate.h" /* File memory management */
#include "H5MMprivate.h" /* Memory management */
#include "H5Pprivate.h" /* Property lists */
#include "H5SMprivate.h" /* Shared Object Header Messages */
@ -671,32 +672,98 @@ H5F__super_read(H5F_t *f, hid_t meta_dxpl_id, hid_t raw_dxpl_id, hbool_t initial
if((status = H5O_msg_exists(&ext_loc, H5O_FSINFO_ID, meta_dxpl_id)) < 0)
HGOTO_ERROR(H5E_FILE, H5E_EXISTS, FAIL, "unable to read object header")
if(status) {
H5O_fsinfo_t fsinfo; /* Free-space manager info message from superblock extension */
H5O_fsinfo_t fsinfo; /* File space info message from superblock extension */
uint8_t flags; /* Message flags */
/* Retrieve the 'free-space manager info' structure */
if(NULL == H5O_msg_read(&ext_loc, H5O_FSINFO_ID, &fsinfo, meta_dxpl_id))
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get free-space manager info message")
/* Get message flags */
if(H5O_msg_get_flags(&ext_loc, H5O_FSINFO_ID, meta_dxpl_id, &flags) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to message flags for free-space manager info message")
/* Check for non-default info */
if(f->shared->fs_strategy != fsinfo.strategy) {
f->shared->fs_strategy = fsinfo.strategy;
/* If message is NOT marked "unknown"--set up file space info */
if(!(flags & H5O_MSG_FLAG_WAS_UNKNOWN)) {
/* Set non-default strategy in the property list */
if(H5P_set(c_plist, H5F_CRT_FILE_SPACE_STRATEGY_NAME, &fsinfo.strategy) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set file space strategy")
} /* end if */
if(f->shared->fs_threshold != fsinfo.threshold) {
f->shared->fs_threshold = fsinfo.threshold;
/* Retrieve the 'file space info' structure */
if(NULL == H5O_msg_read(&ext_loc, H5O_FSINFO_ID, &fsinfo, meta_dxpl_id))
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get free-space manager info message")
/* Set non-default threshold in the property list */
if(H5P_set(c_plist, H5F_CRT_FREE_SPACE_THRESHOLD_NAME, &fsinfo.threshold) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set file space strategy")
} /* end if */
/* Update changed values */
if(f->shared->fs_strategy != fsinfo.strategy) {
f->shared->fs_strategy = fsinfo.strategy;
/* Set free-space manager addresses */
f->shared->fs_addr[0] = HADDR_UNDEF;
for(u = 1; u < NELMTS(f->shared->fs_addr); u++)
f->shared->fs_addr[u] = fsinfo.fs_addr[u-1];
/* Set non-default strategy in the property list */
if(H5P_set(c_plist, H5F_CRT_FILE_SPACE_STRATEGY_NAME, &fsinfo.strategy) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set file space strategy")
} /* end if */
if(f->shared->fs_persist != fsinfo.persist) {
f->shared->fs_persist = fsinfo.persist;
/* Set non-default strategy in the property list */
if(H5P_set(c_plist, H5F_CRT_FREE_SPACE_PERSIST_NAME, &fsinfo.persist) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set file space strategy")
} /* end if */
if(f->shared->fs_threshold != fsinfo.threshold) {
f->shared->fs_threshold = fsinfo.threshold;
/* Set non-default threshold in the property list */
if(H5P_set(c_plist, H5F_CRT_FREE_SPACE_THRESHOLD_NAME, &fsinfo.threshold) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set file space strategy")
} /* end if */
HDassert(f->shared->fs_page_size >= H5F_FILE_SPACE_PAGE_SIZE_MIN);
HDassert(fsinfo.page_size >= H5F_FILE_SPACE_PAGE_SIZE_MIN);
if(f->shared->fs_page_size != fsinfo.page_size) {
f->shared->fs_page_size = fsinfo.page_size;
/* Set file space page size in the property list */
if(H5P_set(c_plist, H5F_CRT_FILE_SPACE_PAGE_SIZE_NAME, &fsinfo.page_size) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set file space page size")
} /* end if */
if(f->shared->pgend_meta_thres != fsinfo.pgend_meta_thres)
/* Initialize page end meta threshold */
f->shared->pgend_meta_thres = fsinfo.pgend_meta_thres;
if(f->shared->eoa_pre_fsm_fsalloc != fsinfo.eoa_pre_fsm_fsalloc)
f->shared->eoa_pre_fsm_fsalloc = fsinfo.eoa_pre_fsm_fsalloc;
/* f->shared->eoa_pre_fsm_fsalloc must always be HADDR_UNDEF
* in the absence of persistant free space managers.
*/
HDassert((!f->shared->fs_persist) || (f->shared->eoa_pre_fsm_fsalloc != HADDR_UNDEF));
HDassert(!f->shared->first_alloc_dealloc);
if((f->shared->eoa_pre_fsm_fsalloc != HADDR_UNDEF) &&
(H5F_INTENT(f) & H5F_ACC_RDWR))
f->shared->first_alloc_dealloc = TRUE;
f->shared->fs_addr[0] = HADDR_UNDEF;
for(u = 1; u < NELMTS(f->shared->fs_addr); u++)
f->shared->fs_addr[u] = fsinfo.fs_addr[u - 1];
if(fsinfo.mapped && (rw_flags & H5AC__READ_ONLY_FLAG) == 0) {
/* Do the same kluge until we know for sure. VC */
#if 1 /* bug fix test code -- tidy this up if all goes well */ /* JRM */
/* KLUGE ALERT!!
*
* H5F_super_ext_write_msg() expects f->shared->sblock to
* be set -- verify that it is NULL, and then set it.
* Set it back to NULL when we are done.
*/
HDassert(f->shared->sblock == NULL);
f->shared->sblock = sblock;
#endif /* JRM */
if(H5F_super_ext_remove_msg(f, meta_dxpl_id, H5O_FSINFO_ID) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTDELETE, FAIL, "error in removing message from superblock extension")
if(H5F_super_ext_write_msg(f, meta_dxpl_id, H5O_FSINFO_ID, &fsinfo, TRUE, H5O_MSG_FLAG_MARK_IF_UNKNOWN) < 0)
HGOTO_ERROR(H5E_FILE, H5E_WRITEERROR, FAIL, "error in writing fsinfo message to superblock extension")
#if 1 /* bug fix test code -- tidy this up if all goes well */ /* JRM */
f->shared->sblock = NULL;
#endif /* JRM */
}
} /* end if not marked "unknown" */
} /* end if */
/* Check for the extension having a 'metadata cache image' message */
@ -796,6 +863,10 @@ H5F__super_read(H5F_t *f, hid_t meta_dxpl_id, hid_t raw_dxpl_id, hbool_t initial
/* Set the pointer to the pinned superblock */
f->shared->sblock = sblock;
/* Set the page aggregation mode */
if(H5F__set_paged_aggr(f, (hbool_t)H5F_PAGED_AGGR(f)) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "failed to set paged_aggr status for file driver")
done:
/* Reset the ring in the DXPL */
if(H5AC_reset_ring(dxpl, orig_ring) < 0)
@ -897,7 +968,9 @@ H5F__super_init(H5F_t *f, hid_t dxpl_id)
/* Check for non-default free-space settings */
if(!(f->shared->fs_strategy == H5F_FILE_SPACE_STRATEGY_DEF &&
f->shared->fs_threshold == H5F_FREE_SPACE_THRESHOLD_DEF))
f->shared->fs_persist == H5F_FREE_SPACE_PERSIST_DEF &&
f->shared->fs_threshold == H5F_FREE_SPACE_THRESHOLD_DEF &&
f->shared->fs_page_size == H5F_FILE_SPACE_PAGE_SIZE_DEF))
non_default_fs_settings = TRUE;
/* Bump superblock version if latest superblock version support is enabled */
@ -906,8 +979,12 @@ H5F__super_init(H5F_t *f, hid_t dxpl_id)
/* Bump superblock version to create superblock extension for SOHM info */
else if(f->shared->sohm_nindexes > 0)
super_vers = HDF5_SUPERBLOCK_VERSION_2;
/* Bump superblock version to create superblock extension for
* non-default file space strategy or non-default free-space threshold
/*
* Bump superblock version to create superblock extension for:
* -- non-default file space strategy or
* -- non-default persisting free-space or
* -- non-default free-space threshold or
* -- non-default page_size
*/
else if(non_default_fs_settings)
super_vers = HDF5_SUPERBLOCK_VERSION_2;
@ -928,6 +1005,9 @@ H5F__super_init(H5F_t *f, hid_t dxpl_id)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set superblock version")
} /* end if */
if(H5FD_set_paged_aggr(f->shared->lf, (hbool_t)H5F_PAGED_AGGR(f)) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "failed to set paged_aggr status for file driver")
/*
* The superblock starts immediately after the user-defined
* header, which we have already insured is a proper size. The
@ -939,9 +1019,12 @@ H5F__super_init(H5F_t *f, hid_t dxpl_id)
/* Sanity check the userblock size vs. the file's allocation alignment */
if(userblock_size > 0) {
if(userblock_size < f->shared->alignment)
/* Set up the alignment to use for page or aggr fs */
hsize_t alignment = H5F_PAGED_AGGR(f) ? f->shared->fs_page_size : f->shared->alignment;
if(userblock_size < alignment)
HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "userblock size must be > file object alignment")
if(0 != (userblock_size % f->shared->alignment))
if(0 != (userblock_size % alignment))
HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "userblock size must be an integral multiple of file object alignment")
} /* end if */
@ -997,10 +1080,6 @@ H5F__super_init(H5F_t *f, hid_t dxpl_id)
if(super_vers < HDF5_SUPERBLOCK_VERSION_2)
superblock_size += driver_size;
/* Reserve space in the file for the superblock, instead of allocating it */
if(H5F__set_eoa(f, H5FD_MEM_SUPER, superblock_size) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to set EOA value for superblock")
/* Set the ring type in the DXPL */
if(H5AC_set_ring(dxpl_id, H5AC_RING_SB, &dxpl, &orig_ring) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set ring value")
@ -1013,6 +1092,10 @@ H5F__super_init(H5F_t *f, hid_t dxpl_id)
/* Keep a copy of the superblock info */
f->shared->sblock = sblock;
/* Allocate space for the superblock */
if(HADDR_UNDEF == H5MF_alloc(f, H5FD_MEM_SUPER, dxpl_id, superblock_size))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "file allocation failed for superblock")
/* set the drvinfo filed to NULL -- will overwrite this later if needed */
f->shared->drvinfo = NULL;
@ -1115,17 +1198,23 @@ H5F__super_init(H5F_t *f, hid_t dxpl_id)
} /* end if */
/* Check for non-default free-space info settings */
if(non_default_fs_settings) {
H5FD_mem_t type; /* Memory type for iteration */
H5O_fsinfo_t fsinfo; /* Free space manager info message */
if(non_default_fs_settings) {
H5F_mem_page_t ptype;
H5O_fsinfo_t fsinfo; /* Free space manager info message */
/* Write free-space manager info message to superblock extension object header if needed */
fsinfo.strategy = f->shared->fs_strategy;
fsinfo.threshold = f->shared->fs_threshold;
for(type = H5FD_MEM_SUPER; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, type))
fsinfo.fs_addr[type-1] = HADDR_UNDEF;
/* Write free-space manager info message to superblock extension object header if needed */
fsinfo.strategy = f->shared->fs_strategy;
fsinfo.persist = f->shared->fs_persist;
fsinfo.threshold = f->shared->fs_threshold;
fsinfo.page_size = f->shared->fs_page_size;
fsinfo.pgend_meta_thres = f->shared->pgend_meta_thres;
fsinfo.eoa_pre_fsm_fsalloc = HADDR_UNDEF;
fsinfo.mapped = FALSE;
if(H5O_msg_create(&ext_loc, H5O_FSINFO_ID, H5O_MSG_FLAG_DONTSHARE, H5O_UPDATE_TIME, &fsinfo, dxpl_id) < 0)
for(ptype = H5F_MEM_PAGE_SUPER; ptype < H5F_MEM_PAGE_NTYPES; H5_INC_ENUM(H5F_mem_page_t, ptype))
fsinfo.fs_addr[ptype - 1] = HADDR_UNDEF;
if(H5O_msg_create(&ext_loc, H5O_FSINFO_ID, H5O_MSG_FLAG_DONTSHARE | H5O_MSG_FLAG_MARK_IF_UNKNOWN, H5O_UPDATE_TIME, &fsinfo, dxpl_id) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to update free-space info header message")
} /* end if */
} /* end if */

View File

@ -85,14 +85,14 @@ static herr_t H5HF_sect_single_full_dblock(H5HF_hdr_t *hdr, hid_t dxpl_id,
H5HF_free_section_t *sect);
/* 'single' section callbacks */
static herr_t H5HF_sect_single_add(H5FS_section_info_t *sect, unsigned *flags,
static herr_t H5HF_sect_single_add(H5FS_section_info_t **sect, unsigned *flags,
void *udata);
static H5FS_section_info_t *H5HF_sect_single_deserialize(const H5FS_section_class_t *cls,
hid_t dxpl_id, const uint8_t *buf, haddr_t sect_addr, hsize_t sect_size,
unsigned *des_flags);
static htri_t H5HF_sect_single_can_merge(const H5FS_section_info_t *sect1,
const H5FS_section_info_t *sect2, void *udata);
static herr_t H5HF_sect_single_merge(H5FS_section_info_t *sect1,
static herr_t H5HF_sect_single_merge(H5FS_section_info_t **sect1,
H5FS_section_info_t *sect2, void *udata);
static htri_t H5HF_sect_single_can_shrink(const H5FS_section_info_t *sect,
void *udata);
@ -121,7 +121,7 @@ static H5FS_section_info_t *H5HF_sect_row_deserialize(const H5FS_section_class_t
unsigned *des_flags);
static htri_t H5HF_sect_row_can_merge(const H5FS_section_info_t *sect1,
const H5FS_section_info_t *sect2, void *udata);
static herr_t H5HF_sect_row_merge(H5FS_section_info_t *sect1,
static herr_t H5HF_sect_row_merge(H5FS_section_info_t **sect1,
H5FS_section_info_t *sect2, void *udata);
static htri_t H5HF_sect_row_can_shrink(const H5FS_section_info_t *sect,
void *udata);
@ -811,7 +811,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
H5HF_sect_single_add(H5FS_section_info_t *_sect, unsigned *flags, void *_udata)
H5HF_sect_single_add(H5FS_section_info_t **_sect, unsigned *flags, void *_udata)
{
herr_t ret_value = SUCCEED; /* Return value */
@ -821,7 +821,7 @@ H5HF_sect_single_add(H5FS_section_info_t *_sect, unsigned *flags, void *_udata)
* have already been checked when it was first added
*/
if(!(*flags & H5FS_ADD_DESERIALIZING)) {
H5HF_free_section_t *sect = (H5HF_free_section_t *)_sect; /* Fractal heap free section */
H5HF_free_section_t **sect = (H5HF_free_section_t **)_sect; /* Fractal heap free section */
H5HF_sect_add_ud_t *udata = (H5HF_sect_add_ud_t *)_udata; /* User callback data */
H5HF_hdr_t *hdr = udata->hdr; /* Fractal heap header */
hid_t dxpl_id = udata->dxpl_id; /* DXPL ID for operation */
@ -832,14 +832,14 @@ H5HF_sect_single_add(H5FS_section_info_t *_sect, unsigned *flags, void *_udata)
/* Check if single section covers entire direct block it's in */
/* (converts to row section possibly) */
if(H5HF_sect_single_full_dblock(hdr, dxpl_id, sect) < 0)
if(H5HF_sect_single_full_dblock(hdr, dxpl_id, (*sect)) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTCONVERT, FAIL, "can't check/convert single section")
/* Set the "returned space" flag if the single section was changed
* into a row section, so the "merging & shrinking" algorithm
* gets executed in the free space manager
*/
if(sect->sect_info.type != H5HF_FSPACE_SECT_SINGLE)
if((*sect)->sect_info.type != H5HF_FSPACE_SECT_SINGLE)
*flags |= H5FS_ADD_RETURNED_SPACE;
} /* end if */
@ -949,10 +949,10 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
H5HF_sect_single_merge(H5FS_section_info_t *_sect1, H5FS_section_info_t *_sect2,
H5HF_sect_single_merge(H5FS_section_info_t **_sect1, H5FS_section_info_t *_sect2,
void *_udata)
{
H5HF_free_section_t *sect1 = (H5HF_free_section_t *)_sect1; /* Fractal heap free section */
H5HF_free_section_t **sect1 = (H5HF_free_section_t **)_sect1; /* Fractal heap free section */
H5HF_free_section_t *sect2 = (H5HF_free_section_t *)_sect2; /* Fractal heap free section */
H5HF_sect_add_ud_t *udata = (H5HF_sect_add_ud_t *)_udata; /* User callback data */
H5HF_hdr_t *hdr = udata->hdr; /* Fractal heap header */
@ -963,26 +963,26 @@ H5HF_sect_single_merge(H5FS_section_info_t *_sect1, H5FS_section_info_t *_sect2,
/* Check arguments. */
HDassert(sect1);
HDassert(sect1->sect_info.type == H5HF_FSPACE_SECT_SINGLE);
HDassert((*sect1)->sect_info.type == H5HF_FSPACE_SECT_SINGLE);
HDassert(sect2);
HDassert(sect2->sect_info.type == H5HF_FSPACE_SECT_SINGLE);
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(H5HF_sect_single_free((H5FS_section_info_t *)sect2) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't free section node")
/* Check to see if we should revive first section */
if(sect1->sect_info.state != H5FS_SECT_LIVE)
if(H5HF_sect_single_revive(hdr, dxpl_id, sect1) < 0)
if((*sect1)->sect_info.state != H5FS_SECT_LIVE)
if(H5HF_sect_single_revive(hdr, dxpl_id, (*sect1)) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't revive single free section")
/* Check if single section covers entire direct block it's in */
/* (converts to row section possibly) */
if(H5HF_sect_single_full_dblock(hdr, dxpl_id, sect1) < 0)
if(H5HF_sect_single_full_dblock(hdr, dxpl_id, (*sect1)) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTCONVERT, FAIL, "can't check/convert single section")
done:
@ -1771,10 +1771,10 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
H5HF_sect_row_merge(H5FS_section_info_t *_sect1, H5FS_section_info_t *_sect2,
H5HF_sect_row_merge(H5FS_section_info_t **_sect1, H5FS_section_info_t *_sect2,
void *_udata)
{
H5HF_free_section_t *sect1 = (H5HF_free_section_t *)_sect1; /* Fractal heap free section */
H5HF_free_section_t **sect1 = (H5HF_free_section_t **)_sect1; /* Fractal heap free section */
H5HF_free_section_t *sect2 = (H5HF_free_section_t *)_sect2; /* Fractal heap free section */
H5HF_sect_add_ud_t *udata = (H5HF_sect_add_ud_t *)_udata; /* User callback data */
H5HF_hdr_t *hdr = udata->hdr; /* Fractal heap header */
@ -1785,7 +1785,7 @@ H5HF_sect_row_merge(H5FS_section_info_t *_sect1, H5FS_section_info_t *_sect2,
/* Check arguments. */
HDassert(sect1);
HDassert(sect1->sect_info.type == H5HF_FSPACE_SECT_FIRST_ROW);
HDassert((*sect1)->sect_info.type == H5HF_FSPACE_SECT_FIRST_ROW);
HDassert(sect2);
HDassert(sect2->sect_info.type == H5HF_FSPACE_SECT_FIRST_ROW);
@ -1802,8 +1802,8 @@ H5HF_sect_row_merge(H5FS_section_info_t *_sect1, H5FS_section_info_t *_sect2,
} /* end if */
else {
/* Check to see if we should revive first section */
if(sect1->sect_info.state != H5FS_SECT_LIVE)
if(H5HF_sect_row_revive(hdr, dxpl_id, sect1) < 0)
if((*sect1)->sect_info.state != H5FS_SECT_LIVE)
if(H5HF_sect_row_revive(hdr, dxpl_id, (*sect1)) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't revive single free section")
/* Check to see if we should revive second section */
@ -1812,7 +1812,7 @@ H5HF_sect_row_merge(H5FS_section_info_t *_sect1, H5FS_section_info_t *_sect2,
HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't revive single free section")
/* Merge rows' underlying indirect sections together */
if(H5HF_sect_indirect_merge_row(hdr, dxpl_id, sect1, sect2) < 0)
if(H5HF_sect_indirect_merge_row(hdr, dxpl_id, (*sect1), sect2) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTMERGE, FAIL, "can't merge underlying indirect sections")
} /* end else */

3542
src/H5MF.c

File diff suppressed because it is too large Load Diff

View File

@ -57,8 +57,10 @@
/********************/
/* Local Prototypes */
/********************/
static herr_t H5MF_aggr_free(H5F_t *f, hid_t dxpl_id, H5FD_mem_t type,
static herr_t H5MF__aggr_free(H5F_t *f, hid_t dxpl_id, H5FD_mem_t type,
H5F_blk_aggr_t *aggr);
static haddr_t H5MF__aggr_alloc(H5F_t *f, hid_t dxpl_id, H5F_blk_aggr_t *aggr,
H5F_blk_aggr_t *other_aggr, H5FD_mem_t type, hsize_t size);
/*********************/
@ -76,88 +78,11 @@ static herr_t H5MF_aggr_free(H5F_t *f, hid_t dxpl_id, H5FD_mem_t type,
/*******************/
/*-------------------------------------------------------------------------
* Function: H5MF_vfd_alloc
*
* Purpose: Allocate SIZE bytes of file memory via H5FD_alloc() and return
* the relative address where that contiguous chunk of file memory
* exists.
* The TYPE argument describes the purpose for which the storage
* is being requested.
*
* Return: Success: The file address of new chunk.
* Failure: HADDR_UNDEF
*
* Programmer: Quincey Koziol
* January 2, 2017
*
*-------------------------------------------------------------------------
*/
haddr_t
H5MF_vfd_alloc(H5F_t *f, hid_t dxpl_id, H5FD_mem_t alloc_type, hsize_t size,
hbool_t keep_fragment)
{
haddr_t eoa; /* Initial EOA for the file */
haddr_t eoa_frag_addr = HADDR_UNDEF; /* Address of fragment at EOA */
hsize_t eoa_frag_size = 0; /* Size of fragment at EOA */
haddr_t ret_value = HADDR_UNDEF; /* Return value */
FUNC_ENTER_NOAPI(HADDR_UNDEF)
#ifdef H5MF_ALLOC_DEBUG
HDfprintf(stderr, "%s: alloc_type = %u, size = %Hu\n", FUNC, (unsigned)alloc_type, size);
#endif /* H5MF_ALLOC_DEBUG */
/* check arguments */
HDassert(f);
HDassert(f->shared);
HDassert(f->shared->lf);
HDassert(size > 0);
/* Get the EOA for the file -- need for sanity check below */
if(HADDR_UNDEF == (eoa = H5F_get_eoa(f, alloc_type)))
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, HADDR_UNDEF, "Unable to get eoa")
/* Check for overlap into temporary allocation space */
if(H5F_addr_gt((eoa + size), f->shared->tmp_addr))
HGOTO_ERROR(H5E_RESOURCE, H5E_BADRANGE, HADDR_UNDEF, "hdr file space alloc will overlap into 'temporary' file space")
/* Allocate space for the header */
if(HADDR_UNDEF == (ret_value = H5FD_alloc(f->shared->lf, dxpl_id, alloc_type, f, size, &eoa_frag_addr, &eoa_frag_size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, HADDR_UNDEF, "can't allocate file space for hdr")
/* Sanity check for overlapping into file's temporary allocation space */
HDassert(H5F_addr_le((ret_value + size), f->shared->tmp_addr));
/* If the file alignment is 1, there should be no eoa fragment */
HDassert((eoa_frag_size == 0) || (f->shared->alignment != 1));
/* Check if fragment was generated and we want to keep it */
if(keep_fragment && eoa_frag_size > 0) {
/* Sanity check */
HDassert(H5F_addr_defined(eoa_frag_addr));
/* Put fragment on the free list */
if(H5MF_xfree(f, alloc_type, dxpl_id, eoa_frag_addr, eoa_frag_size) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, HADDR_UNDEF, "can't free eoa fragment")
} /* end if */
done:
#ifdef H5MF_ALLOC_DEBUG
HDfprintf(stderr, "%s: Leaving: ret_value = %a, size = %Hu\n", FUNC, ret_value, size);
#endif /* H5MF_ALLOC_DEBUG */
#ifdef H5MF_ALLOC_DEBUG_DUMP
H5MF_sects_dump(f, dxpl_id, stderr);
#endif /* H5MF_ALLOC_DEBUG_DUMP */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5MF_vfd_alloc() */
/*-------------------------------------------------------------------------
* Function: H5MF_aggr_vfd_alloc
*
* Purpose: Allocate SIZE bytes of file memory via H5MF_aggr_alloc()
* Purpose: Allocate SIZE bytes of file memory via H5MF__aggr_alloc()
* and return the relative address where that contiguous chunk
* of file memory exists.
* The TYPE argument describes the purpose for which the storage
@ -177,9 +102,9 @@ H5MF_aggr_vfd_alloc(H5F_t *f, H5FD_mem_t alloc_type, hid_t dxpl_id, hsize_t size
haddr_t ret_value = HADDR_UNDEF; /* Return value */
FUNC_ENTER_NOAPI(HADDR_UNDEF)
#ifdef H5MF_ALLOC_DEBUG
#ifdef H5MF_AGGR_DEBUG
HDfprintf(stderr, "%s: alloc_type = %u, size = %Hu\n", FUNC, (unsigned)alloc_type, size);
#endif /* H5MF_ALLOC_DEBUG */
#endif /* H5MF_AGGR_DEBUG */
/* check arguments */
HDassert(f);
@ -190,12 +115,12 @@ HDfprintf(stderr, "%s: alloc_type = %u, size = %Hu\n", FUNC, (unsigned)alloc_typ
/* Couldn't find anything from the free space manager, go allocate some */
if(alloc_type != H5FD_MEM_DRAW && alloc_type != H5FD_MEM_GHEAP) {
/* Handle metadata differently from "raw" data */
if(HADDR_UNDEF == (ret_value = H5MF_aggr_alloc(f, dxpl_id, &(f->shared->meta_aggr), &(f->shared->sdata_aggr), alloc_type, size)))
if(HADDR_UNDEF == (ret_value = H5MF__aggr_alloc(f, dxpl_id, &(f->shared->meta_aggr), &(f->shared->sdata_aggr), alloc_type, size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, HADDR_UNDEF, "can't allocate metadata")
} /* end if */
else {
/* Allocate "raw" data: H5FD_MEM_DRAW and H5FD_MEM_GHEAP */
if(HADDR_UNDEF == (ret_value = H5MF_aggr_alloc(f, dxpl_id, &(f->shared->sdata_aggr), &(f->shared->meta_aggr), H5FD_MEM_DRAW, size)))
if(HADDR_UNDEF == (ret_value = H5MF__aggr_alloc(f, dxpl_id, &(f->shared->sdata_aggr), &(f->shared->meta_aggr), H5FD_MEM_DRAW, size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, HADDR_UNDEF, "can't allocate raw data")
} /* end else */
@ -203,19 +128,16 @@ HDfprintf(stderr, "%s: alloc_type = %u, size = %Hu\n", FUNC, (unsigned)alloc_typ
HDassert(H5F_addr_le((ret_value + size), f->shared->tmp_addr));
done:
#ifdef H5MF_ALLOC_DEBUG
#ifdef H5MF_AGGR_DEBUG
HDfprintf(stderr, "%s: Leaving: ret_value = %a, size = %Hu\n", FUNC, ret_value, size);
#endif /* H5MF_ALLOC_DEBUG */
#ifdef H5MF_ALLOC_DEBUG_DUMP
H5MF_sects_dump(f, dxpl_id, stderr);
#endif /* H5MF_ALLOC_DEBUG_DUMP */
#endif /* H5MF_AGGR_DEBUG */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5MF_aggr_vfd_alloc() */
/*-------------------------------------------------------------------------
* Function: H5MF_aggr_alloc
* Function: H5MF__aggr_alloc
*
* Purpose: Try to allocate SIZE bytes of memory from an aggregator
* block if possible.
@ -228,8 +150,8 @@ H5MF_sects_dump(f, dxpl_id, stderr);
*
*-------------------------------------------------------------------------
*/
haddr_t
H5MF_aggr_alloc(H5F_t *f, hid_t dxpl_id, H5F_blk_aggr_t *aggr,
static haddr_t
H5MF__aggr_alloc(H5F_t *f, hid_t dxpl_id, H5F_blk_aggr_t *aggr,
H5F_blk_aggr_t *other_aggr, H5FD_mem_t type, hsize_t size)
{
haddr_t eoa_frag_addr = HADDR_UNDEF; /* Address of fragment at EOA */
@ -237,7 +159,7 @@ H5MF_aggr_alloc(H5F_t *f, hid_t dxpl_id, H5F_blk_aggr_t *aggr,
haddr_t eoa = HADDR_UNDEF; /* Initial EOA for the file */
haddr_t ret_value = HADDR_UNDEF; /* Return value */
FUNC_ENTER_NOAPI(HADDR_UNDEF)
FUNC_ENTER_STATIC
#ifdef H5MF_AGGR_DEBUG
HDfprintf(stderr, "%s: type = %u, size = %Hu\n", FUNC, (unsigned)type, size);
#endif /* H5MF_AGGR_DEBUG */
@ -257,11 +179,11 @@ HDfprintf(stderr, "%s: type = %u, size = %Hu\n", FUNC, (unsigned)type, size);
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, HADDR_UNDEF, "Unable to get eoa")
/*
* If the aggregation feature is enabled for this file and strategy is not H5F_FILE_SPACE_VFD,
* If the aggregation feature is enabled for this file and strategy is not H5F_FILE_SPACE_NONE,
* allocate "generic" space and sub-allocate out of that, if possible.
* Otherwise just allocate through H5FD_alloc().
* Otherwise just allocate through H5F_alloc().
*/
if((f->shared->feature_flags & aggr->feature_flag) && f->shared->fs_strategy != H5F_FILE_SPACE_VFD) {
if((f->shared->feature_flags & aggr->feature_flag) && f->shared->fs_strategy != H5F_FSPACE_STRATEGY_NONE) {
haddr_t aggr_frag_addr = HADDR_UNDEF; /* Address of aggregrator fragment */
hsize_t aggr_frag_size = 0; /* Size of aggregator fragment */
hsize_t alignment; /* Alignment of this section */
@ -273,12 +195,12 @@ HDfprintf(stderr, "%s: aggr = {%a, %Hu, %Hu}\n", FUNC, aggr->addr, aggr->tot_siz
#endif /* H5MF_AGGR_DEBUG */
/* Turn off alignment if allocation < threshold */
alignment = f->shared->alignment;
if(!((alignment > 1) && (size >= f->shared->threshold)))
alignment = H5F_ALIGNMENT(f);
if(!((alignment > 1) && (size >= H5F_THRESHOLD(f))))
alignment = 0; /* no alignment */
/* Generate fragment if aggregator is mis-aligned */
if(alignment && aggr->addr > 0 && (aggr_mis_align = (aggr->addr + H5FD_get_base_addr(f->shared->lf)) % alignment)) {
if(alignment && H5F_addr_gt(aggr->addr, 0) && (aggr_mis_align = (aggr->addr + H5F_BASE_ADDR(f)) % alignment)) {
aggr_frag_addr = aggr->addr;
aggr_frag_size = alignment - aggr_mis_align;
} /* end if */
@ -288,7 +210,7 @@ HDfprintf(stderr, "%s: aggr = {%a, %Hu, %Hu}\n", FUNC, aggr->addr, aggr->tot_siz
/* Check if the space requested is larger than the space left in the block */
if((size + aggr_frag_size) > aggr->size) {
htri_t was_extended = FALSE; /* Whether the file was extended */
htri_t extended = FALSE; /* Whether the file was extended */
/* Check if the block asked for is too large for 'normal' aggregator block */
if(size >= aggr->alloc_size) {
@ -298,32 +220,27 @@ HDfprintf(stderr, "%s: aggr = {%a, %Hu, %Hu}\n", FUNC, aggr->addr, aggr->tot_siz
if(H5F_addr_gt((aggr->addr + aggr->size + ext_size), f->shared->tmp_addr))
HGOTO_ERROR(H5E_RESOURCE, H5E_BADRANGE, HADDR_UNDEF, "'normal' file space allocation request will overlap into 'temporary' file space")
if((aggr->addr > 0) && (was_extended = H5FD_try_extend(f->shared->lf, alloc_type, f, dxpl_id, aggr->addr + aggr->size, ext_size)) < 0)
if((aggr->addr > 0) && (extended = H5F_try_extend(f, dxpl_id, alloc_type, (aggr->addr + aggr->size), ext_size)) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, HADDR_UNDEF, "can't extending space")
else if(was_extended) {
else if (extended) {
/* aggr->size is unchanged */
ret_value = aggr->addr + aggr_frag_size;
aggr->addr += ext_size;
aggr->tot_size += ext_size;
} /* end else-if */
else {
/* Check for overlapping into file's temporary allocation space */
if(H5F_addr_gt((eoa + size), f->shared->tmp_addr))
HGOTO_ERROR(H5E_RESOURCE, H5E_BADRANGE, HADDR_UNDEF, "'normal' file space allocation request will overlap into 'temporary' file space")
} else {
/* Release "other" aggregator, if it exists, is at the end of the allocated space,
* has allocated more than one block and the unallocated space is greater than its
* allocation block size.
*/
if((other_aggr->size > 0) && (H5F_addr_eq((other_aggr->addr + other_aggr->size), eoa)) &&
(other_aggr->tot_size > other_aggr->size) && ((other_aggr->tot_size - other_aggr->size) >= other_aggr->alloc_size)) {
if(H5MF_aggr_free(f, dxpl_id, other_alloc_type, other_aggr) < 0)
if(H5MF__aggr_free(f, dxpl_id, other_alloc_type, other_aggr) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, HADDR_UNDEF, "can't free aggregation block")
} /* end if */
/* Allocate space from the VFD (i.e. at the end of the file) */
if(HADDR_UNDEF == (ret_value = H5FD_alloc(f->shared->lf, dxpl_id, alloc_type, f, size, &eoa_frag_addr, &eoa_frag_size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, HADDR_UNDEF, "can't allocate aggregation block")
if(HADDR_UNDEF == (ret_value = H5F_alloc(f, dxpl_id, alloc_type, size, &eoa_frag_addr, &eoa_frag_size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, HADDR_UNDEF, "can't allocate file space")
} /* end else */
} /* end if */
else {
@ -341,9 +258,9 @@ HDfprintf(stderr, "%s: Allocating block\n", FUNC);
if(H5F_addr_gt((aggr->addr + aggr->size + ext_size), f->shared->tmp_addr))
HGOTO_ERROR(H5E_RESOURCE, H5E_BADRANGE, HADDR_UNDEF, "'normal' file space allocation request will overlap into 'temporary' file space")
if((aggr->addr > 0) && (was_extended = H5FD_try_extend(f->shared->lf, alloc_type, f, dxpl_id, aggr->addr + aggr->size, ext_size)) < 0)
if((aggr->addr > 0) && (extended = H5F_try_extend(f, dxpl_id, alloc_type, (aggr->addr + aggr->size), ext_size)) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, HADDR_UNDEF, "can't extending space")
else if(was_extended) {
else if(extended) {
aggr->addr += aggr_frag_size;
aggr->size += (ext_size - aggr_frag_size);
aggr->tot_size += ext_size;
@ -351,23 +268,19 @@ HDfprintf(stderr, "%s: Allocating block\n", FUNC);
else {
haddr_t new_space; /* Address of new space allocated */
/* Check for overlapping into file's temporary allocation space */
if(H5F_addr_gt((eoa + aggr->alloc_size), f->shared->tmp_addr))
HGOTO_ERROR(H5E_RESOURCE, H5E_BADRANGE, HADDR_UNDEF, "'normal' file space allocation request will overlap into 'temporary' file space")
/* Release "other" aggregator, if it exists, is at the end of the allocated space,
* has allocated more than one block and the unallocated space is greater than its
* allocation block size.
*/
if((other_aggr->size > 0) && (H5F_addr_eq((other_aggr->addr + other_aggr->size), eoa)) &&
(other_aggr->tot_size > other_aggr->size) && ((other_aggr->tot_size - other_aggr->size) >= other_aggr->alloc_size)) {
if(H5MF_aggr_free(f, dxpl_id, other_alloc_type, other_aggr) < 0)
if(H5MF__aggr_free(f, dxpl_id, other_alloc_type, other_aggr) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, HADDR_UNDEF, "can't free aggregation block")
} /* end if */
/* Allocate space from the VFD (i.e. at the end of the file) */
if(HADDR_UNDEF == (new_space = H5FD_alloc(f->shared->lf, dxpl_id, alloc_type, f, aggr->alloc_size, &eoa_frag_addr, &eoa_frag_size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, HADDR_UNDEF, "can't allocate aggregation block")
if(HADDR_UNDEF == (new_space = H5F_alloc(f, dxpl_id, alloc_type, aggr->alloc_size, &eoa_frag_addr, &eoa_frag_size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, HADDR_UNDEF, "can't allocate file space")
/* Return the unused portion of the block to a free list */
if(aggr->size > 0)
@ -408,7 +321,7 @@ HDfprintf(stderr, "%s: Allocating block\n", FUNC);
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, HADDR_UNDEF, "can't free eoa fragment")
/* Freeing any possible fragment due to alignment in the block after extension */
if(was_extended && aggr_frag_size)
if(extended && aggr_frag_size)
if(H5MF_xfree(f, alloc_type, dxpl_id, aggr_frag_addr, aggr_frag_size) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, HADDR_UNDEF, "can't free aggregation fragment")
} /* end if */
@ -425,12 +338,8 @@ HDfprintf(stderr, "%s: Allocating block\n", FUNC);
} /* end else */
} /* end if */
else {
/* Check for overlapping into file's temporary allocation space */
if(H5F_addr_gt((eoa + size), f->shared->tmp_addr))
HGOTO_ERROR(H5E_RESOURCE, H5E_BADRANGE, HADDR_UNDEF, "'normal' file space allocation request will overlap into 'temporary' file space")
/* Allocate data from the file */
if(HADDR_UNDEF == (ret_value = H5FD_alloc(f->shared->lf, dxpl_id, type, f, size, &eoa_frag_addr, &eoa_frag_size)))
if(HADDR_UNDEF == (ret_value = H5F_alloc(f, dxpl_id, type, size, &eoa_frag_addr, &eoa_frag_size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, HADDR_UNDEF, "can't allocate file space")
/* Check if fragment was generated */
@ -444,15 +353,15 @@ HDfprintf(stderr, "%s: Allocating block\n", FUNC);
HDassert(H5F_addr_le((ret_value + size), f->shared->tmp_addr));
/* Post-condition sanity check */
if(f->shared->alignment && size >= f->shared->threshold)
HDassert(!((ret_value + H5FD_get_base_addr(f->shared->lf)) % f->shared->alignment));
if(H5F_ALIGNMENT(f) && size >= H5F_THRESHOLD(f))
HDassert(!((ret_value + H5FD_get_base_addr(f->shared->lf)) % H5F_ALIGNMENT(f)));
done:
#ifdef H5MF_AGGR_DEBUG
HDfprintf(stderr, "%s: ret_value = %a\n", FUNC, ret_value);
#endif /* H5MF_AGGR_DEBUG */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5MF_aggr_alloc() */
} /* end H5MF__aggr_alloc() */
/*-------------------------------------------------------------------------
@ -524,7 +433,7 @@ H5MF_aggr_try_extend(H5F_t *f, hid_t dxpl_id, H5F_blk_aggr_t *aggr,
else {
hsize_t extra = (extra_requested < aggr->alloc_size) ? aggr->alloc_size : extra_requested;
if((ret_value = H5FD_try_extend(f->shared->lf, type, f, dxpl_id, (aggr->addr + aggr->size), extra)) < 0)
if((ret_value = H5F_try_extend(f, dxpl_id, type, (aggr->addr + aggr->size), extra)) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTEXTEND, FAIL, "error extending file")
else if(ret_value == TRUE) {
/* Shift the aggregator block by the extra requested */
@ -905,7 +814,7 @@ done:
/*-------------------------------------------------------------------------
* Function: H5MF_aggr_free
* Function: H5MF__aggr_free
*
* Purpose: Free the aggregator's space in the file.
*
@ -919,11 +828,11 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
H5MF_aggr_free(H5F_t *f, hid_t dxpl_id, H5FD_mem_t type, H5F_blk_aggr_t *aggr)
H5MF__aggr_free(H5F_t *f, hid_t dxpl_id, H5FD_mem_t type, H5F_blk_aggr_t *aggr)
{
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
FUNC_ENTER_STATIC
/* Sanity check */
HDassert(f);
@ -936,7 +845,7 @@ H5MF_aggr_free(H5F_t *f, hid_t dxpl_id, H5FD_mem_t type, H5F_blk_aggr_t *aggr)
HDassert(f->shared->feature_flags & aggr->feature_flag);
/* Free the remaining space at EOA in the aggregator */
if(H5FD_free(f->shared->lf, dxpl_id, type, f, aggr->addr, aggr->size) < 0)
if(H5F_free(f, dxpl_id, type, aggr->addr, aggr->size) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "can't free aggregation block")
/* Reset the aggregator */
@ -946,7 +855,7 @@ H5MF_aggr_free(H5F_t *f, hid_t dxpl_id, H5FD_mem_t type, H5F_blk_aggr_t *aggr)
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5MF_aggr_free() */
} /* H5MF__aggr_free() */
/*-------------------------------------------------------------------------
@ -978,13 +887,13 @@ H5MF_aggrs_try_shrink_eoa(H5F_t *f, hid_t dxpl_id)
if((ma_status = H5MF_aggr_can_shrink_eoa(f, H5FD_MEM_DEFAULT, &(f->shared->meta_aggr))) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "can't query metadata aggregator stats")
if(ma_status > 0)
if(H5MF_aggr_free(f, dxpl_id, H5FD_MEM_DEFAULT, &(f->shared->meta_aggr)) < 0)
if(H5MF__aggr_free(f, dxpl_id, H5FD_MEM_DEFAULT, &(f->shared->meta_aggr)) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTSHRINK, FAIL, "can't check for shrinking eoa")
if((sda_status = H5MF_aggr_can_shrink_eoa(f, H5FD_MEM_DRAW, &(f->shared->sdata_aggr))) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "can't query small data aggregator stats")
if(sda_status > 0)
if(H5MF_aggr_free(f, dxpl_id, H5FD_MEM_DRAW, &(f->shared->sdata_aggr)) < 0)
if(H5MF__aggr_free(f, dxpl_id, H5FD_MEM_DRAW, &(f->shared->sdata_aggr)) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTSHRINK, FAIL, "can't check for shrinking eoa")
ret_value = (ma_status || sda_status);

View File

@ -116,7 +116,9 @@ H5MF_sects_debug_cb(H5FS_section_info_t *_sect, void *_udata)
/* Print generic section information */
HDfprintf(udata->stream, "%*s%-*s %s\n", udata->indent, "", udata->fwidth,
"Section type:",
(sect->sect_info.type == H5MF_FSPACE_SECT_SIMPLE ? "simple" : "unknown"));
(sect->sect_info.type == H5MF_FSPACE_SECT_SIMPLE ? "simple" :
(sect->sect_info.type == H5MF_FSPACE_SECT_SMALL ? "small" :
(sect->sect_info.type == H5MF_FSPACE_SECT_LARGE ? "large" : "unknown"))));
HDfprintf(udata->stream, "%*s%-*s %a\n", udata->indent, "", udata->fwidth,
"Section address:",
sect->sect_info.addr);
@ -171,7 +173,7 @@ H5MF_sects_debug(H5F_t *f, hid_t dxpl_id, haddr_t fs_addr, FILE *stream, int ind
for(type = H5FD_MEM_DEFAULT; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, type))
if(H5F_addr_eq(f->shared->fs_addr[type], fs_addr)) {
if(!f->shared->fs_man[type])
if(H5MF__alloc_open(f, dxpl_id, type) < 0)
if(H5MF_open_fstype(f, dxpl_id, type) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't initialize file free space")
if(f->shared->fs_man[type]) {
@ -217,11 +219,6 @@ herr_t
H5MF_sects_dump(H5F_t *f, hid_t dxpl_id, FILE *stream)
{
haddr_t eoa; /* End of allocated space in the file */
haddr_t ma_addr = HADDR_UNDEF; /* Base "metadata aggregator" address */
hsize_t ma_size = 0; /* Size of "metadata aggregator" */
haddr_t sda_addr = HADDR_UNDEF; /* Base "small data aggregator" address */
hsize_t sda_size = 0; /* Size of "small data aggregator" */
H5FD_mem_t type; /* Memory type for iteration */
int indent = 0; /* Amount to indent */
int fwidth = 50; /* Field width */
herr_t ret_value = SUCCEED; /* Return value */
@ -244,56 +241,90 @@ HDfprintf(stderr, "%s: Dumping file free space sections\n", FUNC);
HDfprintf(stderr, "%s: for type = H5FD_MEM_DEFAULT, eoa = %a\n", FUNC, eoa);
#endif /* H5MF_ALLOC_DEBUG */
/* Retrieve metadata aggregator info, if available */
H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
#ifdef H5MF_ALLOC_DEBUG
HDfprintf(stderr, "%s: ma_addr = %a, ma_size = %Hu, end of ma = %a\n", FUNC, ma_addr, ma_size, (haddr_t)((ma_addr + ma_size) - 1));
#endif /* H5MF_ALLOC_DEBUG */
if(H5F_PAGED_AGGR(f)) { /* File space paging */
H5F_mem_page_t ptype; /* Memory type for iteration -- page fs */
/* Retrieve 'small data' aggregator info, if available */
H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sda_addr, &sda_size);
#ifdef H5MF_ALLOC_DEBUG
HDfprintf(stderr, "%s: sda_addr = %a, sda_size = %Hu, end of sda = %a\n", FUNC, sda_addr, sda_size, (haddr_t)((sda_addr + sda_size) - 1));
#endif /* H5MF_ALLOC_DEBUG */
/* Iterate over all the free space types that have managers and dump each free list's space */
for(type = H5FD_MEM_DEFAULT; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, type)) {
/* Print header for type */
HDfprintf(stream, "%*sFile Free Space Info for type = %u:\n", indent, "", (unsigned)type);
/* Check for this type being mapped to another type */
if(H5FD_MEM_DEFAULT == f->shared->fs_type_map[type] ||
type == f->shared->fs_type_map[type]) {
/* Retrieve the 'eoa' for this file memory type */
if(HADDR_UNDEF == (eoa = H5F_get_eoa(f, type)))
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "driver get_eoa request failed")
HDfprintf(stream, "%*s%-*s %a\n", indent + 3, "", MAX(0, fwidth - 3), "eoa:", eoa);
for(ptype = H5F_MEM_PAGE_META; ptype < H5F_MEM_PAGE_NTYPES; H5_INC_ENUM(H5F_mem_page_t, ptype)) {
/* Print header for type */
HDfprintf(stream, "%*sFile Free Space Info for type = %u:\n", indent, "", (unsigned)ptype);
/* Print header for sections */
HDfprintf(stream, "%*sSections:\n", indent + 3, "");
/* If there is a free space manager for this type, iterate over them */
if(f->shared->fs_man[type]) {
if(f->shared->fs_man[ptype]) {
H5MF_debug_iter_ud_t udata; /* User data for callbacks */
/* Prepare user data for section iteration callback */
udata.fspace = f->shared->fs_man[type];
udata.fspace = f->shared->fs_man[ptype];
udata.stream = stream;
udata.indent = indent + 6;
udata.fwidth = MAX(0, fwidth - 6);
/* Iterate over all the free space sections */
if(H5FS_sect_iterate(f, dxpl_id, f->shared->fs_man[type], H5MF_sects_debug_cb, &udata) < 0)
if(H5FS_sect_iterate(f, dxpl_id, f->shared->fs_man[ptype], H5MF_sects_debug_cb, &udata) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_BADITER, FAIL, "can't iterate over heap's free space")
} /* end if */
else
/* No sections of this type */
HDfprintf(stream, "%*s<none>\n", indent + 6, "");
} /* end if */
else
HDfprintf(stream, "%*sMapped to type = %u\n", indent, "", (unsigned)f->shared->fs_type_map[type]);
} /* end for */
} /* end if */
else { /* not file space paging */
H5FD_mem_t atype; /* Memory type for iteration -- aggr fs */
haddr_t ma_addr = HADDR_UNDEF; /* Base "metadata aggregator" address */
hsize_t ma_size = 0; /* Size of "metadata aggregator" */
haddr_t sda_addr = HADDR_UNDEF; /* Base "small data aggregator" address */
hsize_t sda_size = 0; /* Size of "small data aggregator" */
} /* end for */
/* Retrieve metadata aggregator info, if available */
H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
#ifdef H5MF_ALLOC_DEBUG
HDfprintf(stderr, "%s: ma_addr = %a, ma_size = %Hu, end of ma = %a\n", FUNC, ma_addr, ma_size, (haddr_t)((ma_addr + ma_size) - 1));
#endif /* H5MF_ALLOC_DEBUG */
/* Retrieve 'small data' aggregator info, if available */
H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sda_addr, &sda_size);
#ifdef H5MF_ALLOC_DEBUG
HDfprintf(stderr, "%s: sda_addr = %a, sda_size = %Hu, end of sda = %a\n", FUNC, sda_addr, sda_size, (haddr_t)((sda_addr + sda_size) - 1));
#endif /* H5MF_ALLOC_DEBUG */
/* Iterate over all the free space types that have managers and dump each free list's space */
for(atype = H5FD_MEM_DEFAULT; atype < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, atype)) {
/* Print header for type */
HDfprintf(stream, "%*sFile Free Space Info for type = %u:\n", indent, "", (unsigned)atype);
/* Check for this type being mapped to another type */
if(H5FD_MEM_DEFAULT == f->shared->fs_type_map[atype] || atype == f->shared->fs_type_map[atype]) {
/* Retrieve the 'eoa' for this file memory type */
if(HADDR_UNDEF == (eoa = H5F_get_eoa(f, atype)))
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "driver get_eoa request failed")
HDfprintf(stream, "%*s%-*s %a\n", indent + 3, "", MAX(0, fwidth - 3), "eoa:", eoa);
/* Print header for sections */
HDfprintf(stream, "%*sSections:\n", indent + 3, "");
/* If there is a free space manager for this type, iterate over them */
if(f->shared->fs.aggr.fs_man[atype]) {
H5MF_debug_iter_ud_t udata; /* User data for callbacks */
/* Prepare user data for section iteration callback */
udata.fspace = f->shared->fs_man[atype];
udata.stream = stream;
udata.indent = indent + 6;
udata.fwidth = MAX(0, fwidth - 6);
/* Iterate over all the free space sections */
if(H5FS_sect_iterate(f, dxpl_id, f->shared->fs_man[atype], H5MF_sects_debug_cb, &udata) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_BADITER, FAIL, "can't iterate over heap's free space")
} /* end if */
else /* No sections of this type */
HDfprintf(stream, "%*s<none>\n", indent + 6, "");
} /* end if */
else
HDfprintf(stream, "%*sMapped to type = %u\n", indent, "", (unsigned)f->shared->fs_type_map[atype]);
} /* end for */
} /* end else */
done:
HDfprintf(stderr, "%s: Done dumping file free space sections\n", FUNC);

View File

@ -51,9 +51,38 @@
/* Define this to dump free space tracker contents after they've been modified */
/* #define H5MF_ALLOC_DEBUG_DUMP */
/* Free space section types for file */
/* Free-space section types for file */
/* (values stored in free space data structures in file) */
#define H5MF_FSPACE_SECT_SIMPLE 0 /* Section is a range of actual bytes in file */
#define H5MF_FSPACE_SECT_SIMPLE 0 /* For non-paged aggregation: section is a range of actual bytes in file */
#define H5MF_FSPACE_SECT_SMALL 1 /* For paged aggregation: "small" meta/raw data section which is < fsp_size) */
#define H5MF_FSPACE_SECT_LARGE 2 /* For paged aggregation: "large" Section which is >= fsp_size) */
/* For non-paged aggregation: map allocation request type to tracked free-space type */
/* F -- pointer to H5F_t; T -- H5FD_mem_t */
#define H5MF_ALLOC_TO_FS_AGGR_TYPE(F, T) \
((H5FD_MEM_DEFAULT == (F)->shared->fs_type_map[T]) ? (T) : (F)->shared->fs_type_map[T])
/* Get section class type based on size */
#define H5MF_SECT_CLASS_TYPE(F, S) \
((H5F_PAGED_AGGR(F)) ? \
((S >= (F)->shared->fs_page_size) ? H5MF_FSPACE_SECT_LARGE : H5MF_FSPACE_SECT_SMALL) : H5MF_FSPACE_SECT_SIMPLE)
/* Get section class cls */
#define H5MF_SECT_CLS_TYPE(F, S) \
((H5F_PAGED_AGGR(F)) ? \
((S >= (F)->shared->fs_page_size) ? \
H5MF_FSPACE_SECT_CLS_LARGE : H5MF_FSPACE_SECT_CLS_SMALL) : H5MF_FSPACE_SECT_CLS_SIMPLE)
/* Calculate the mis-aligned fragment */
#define H5MF_EOA_MISALIGN(F, E, A, FR) \
{ \
hsize_t m; \
\
if(H5F_addr_gt((E), 0) && ((m) = ((E) + H5F_BASE_ADDR(F)) % (A))) \
(FR) = (A) - m; \
else \
(FR) = 0; \
}
/****************************/
@ -129,6 +158,15 @@ typedef struct H5MF_sect_ud_t {
H5F_blk_aggr_t *aggr; /* Aggregator block to operate on */
} H5MF_sect_ud_t;
/* Information about the current free-space manager to use */
typedef struct H5MF_fs_t {
H5F_fs_state_t *fs_state;
haddr_t *fs_addr;
H5FS_t **fs_man;
hsize_t align_thres; /* Threshold for alignment */
hsize_t alignment; /* Alignment */
} H5MF_fs_t;
/*****************************/
/* Package Private Variables */
@ -136,6 +174,8 @@ typedef struct H5MF_sect_ud_t {
/* H5MF single section inherits serializable properties from H5FS_section_class_t */
H5_DLLVAR H5FS_section_class_t H5MF_FSPACE_SECT_CLS_SIMPLE[1];
H5_DLLVAR H5FS_section_class_t H5MF_FSPACE_SECT_CLS_SMALL[1];
H5_DLLVAR H5FS_section_class_t H5MF_FSPACE_SECT_CLS_LARGE[1];
/******************************/
@ -143,22 +183,23 @@ H5_DLLVAR H5FS_section_class_t H5MF_FSPACE_SECT_CLS_SIMPLE[1];
/******************************/
/* Allocator routines */
H5_DLL herr_t H5MF__alloc_start(H5F_t *f, hid_t dxpl_id, H5FD_mem_t type);
H5_DLL herr_t H5MF__alloc_open(H5F_t *f, hid_t dxpl_id, H5FD_mem_t type);
H5_DLL herr_t H5MF_open_fstype(H5F_t *f, hid_t dxpl_id, H5F_mem_page_t type);
H5_DLL herr_t H5MF_start_fstype(H5F_t *f, hid_t dxpl_id, H5F_mem_page_t type);
H5_DLL htri_t H5MF_find_sect(H5F_t *f, H5FD_mem_t alloc_type, hid_t dxpl_id, hsize_t size, H5FS_t *fspace, haddr_t *addr);
H5_DLL herr_t H5MF_add_sect(H5F_t *f, H5FD_mem_t alloc_type, hid_t dxpl_id, H5FS_t *fspace, H5MF_free_section_t *node);
H5_DLL herr_t H5MF_sects_dump(H5F_t *f, hid_t dxpl_id, FILE *stream);
/* 'simple' section routines */
H5_DLL H5MF_free_section_t *H5MF_sect_simple_new(haddr_t sect_off,
H5_DLL void H5MF_alloc_to_fs_type(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size, H5F_mem_page_t *fs_type);
/* 'simple/small/large' section routines */
H5_DLL H5MF_free_section_t *H5MF_sect_new(unsigned ctype, haddr_t sect_off,
hsize_t sect_size);
H5_DLL htri_t H5MF_sect_simple_can_shrink(const H5FS_section_info_t *_sect,
void *udata);
H5_DLL herr_t H5MF_sect_simple_shrink(H5FS_section_info_t **_sect,
void *udata);
H5_DLL herr_t H5MF_sect_simple_free(H5FS_section_info_t *sect);
H5_DLL herr_t H5MF_sect_free(H5FS_section_info_t *sect);
/* Block aggregator routines */
H5_DLL haddr_t H5MF_aggr_alloc(H5F_t *f, hid_t dxpl_id, H5F_blk_aggr_t *aggr,
H5F_blk_aggr_t *other_aggr, H5FD_mem_t type, hsize_t size);
H5_DLL htri_t H5MF_aggr_try_extend(H5F_t *f, hid_t dxpl_id, H5F_blk_aggr_t *aggr,
H5FD_mem_t type, haddr_t abs_blk_end, hsize_t extra_requested);
H5_DLL htri_t H5MF_aggr_can_absorb(const H5F_t *f, const H5F_blk_aggr_t *aggr,

View File

@ -58,8 +58,6 @@ H5_DLL herr_t H5MF_try_close(H5F_t *f, hid_t dxpl_id);
/* File space allocation routines */
H5_DLL haddr_t H5MF_alloc(H5F_t *f, H5FD_mem_t type, hid_t dxpl_id, hsize_t size);
H5_DLL haddr_t H5MF_aggr_vfd_alloc(H5F_t *f, H5FD_mem_t type, hid_t dxpl_id, hsize_t size);
H5_DLL haddr_t H5MF_vfd_alloc(H5F_t *f, hid_t dxpl_id, H5FD_mem_t alloc_type,
hsize_t size, hbool_t keep_fragment);
H5_DLL herr_t H5MF_xfree(H5F_t *f, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr,
hsize_t size);
H5_DLL herr_t H5MF_try_extend(H5F_t *f, hid_t dxpl_id, H5FD_mem_t type,
@ -80,6 +78,14 @@ H5_DLL htri_t H5MF_aggrs_try_shrink_eoa(H5F_t *f, hid_t dxpl_id);
H5_DLL herr_t H5MF_settle_raw_data_fsm(H5F_t *f, hid_t dxpl_id, hbool_t *fsm_settled);
H5_DLL herr_t H5MF_settle_meta_data_fsm(H5F_t *f, hid_t dxpl_id, hbool_t *fsm_settled);
/* This function has to be declared in H5MFprivate.h as it is needed
* in our test code to allow us to manually start a self referential
* free space manager prior to the first file space allocations /
* deallocation without causing assertion failures on the first
* file space allocation / deallocation.
*/
H5_DLL herr_t H5MF_tidy_self_referential_fsm_hack(H5F_t *f, hid_t dxpl_id);
/* Debugging routines */
#ifdef H5MF_DEBUGGING
H5_DLL herr_t H5MF_sects_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr,

View File

@ -57,18 +57,47 @@
/* Local Prototypes */
/********************/
/* 'simple' section callbacks */
static H5FS_section_info_t *H5MF_sect_simple_deserialize(const H5FS_section_class_t *cls,
/* 'simple/small/large' section callbacks */
static H5FS_section_info_t *H5MF_sect_deserialize(const H5FS_section_class_t *cls,
hid_t dxpl_id, const uint8_t *buf, haddr_t sect_addr, hsize_t sect_size,
unsigned *des_flags);
static herr_t H5MF_sect_valid(const H5FS_section_class_t *cls,
const H5FS_section_info_t *sect, hid_t dxpl_id);
static H5FS_section_info_t *H5MF_sect_split(H5FS_section_info_t *sect,
hsize_t frag_size);
/* 'simple' section callbacks */
static htri_t H5MF_sect_simple_can_merge(const H5FS_section_info_t *sect1,
const H5FS_section_info_t *sect2, void *udata);
static herr_t H5MF_sect_simple_merge(H5FS_section_info_t *sect1,
static herr_t H5MF_sect_simple_merge(H5FS_section_info_t **sect1,
H5FS_section_info_t *sect2, void *udata);
static herr_t H5MF_sect_simple_valid(const H5FS_section_class_t *cls,
const H5FS_section_info_t *sect, hid_t dxpl_id);
static H5FS_section_info_t *H5MF_sect_simple_split(H5FS_section_info_t *sect,
hsize_t frag_size);
static htri_t H5MF_sect_simple_can_shrink(const H5FS_section_info_t *_sect,
void *udata);
static herr_t H5MF_sect_simple_shrink(H5FS_section_info_t **_sect,
void *udata);
/* 'small' section callbacks */
static herr_t H5MF_sect_small_add(H5FS_section_info_t **_sect, unsigned *flags, void *_udata);
static htri_t H5MF_sect_small_can_merge(const H5FS_section_info_t *sect1,
const H5FS_section_info_t *sect2, void *udata);
static herr_t H5MF_sect_small_merge(H5FS_section_info_t **sect1,
H5FS_section_info_t *sect2, void *udata);
static htri_t H5MF_sect_small_can_shrink(const H5FS_section_info_t *_sect,
void *udata);
static herr_t H5MF_sect_small_shrink(H5FS_section_info_t **_sect,
void *udata);
/* 'large' section callbacks */
static htri_t H5MF_sect_large_can_merge(const H5FS_section_info_t *sect1,
const H5FS_section_info_t *sect2, void *udata);
static herr_t H5MF_sect_large_merge(H5FS_section_info_t **sect1,
H5FS_section_info_t *sect2, void *udata);
static htri_t H5MF_sect_large_can_shrink(const H5FS_section_info_t *_sect,
void *udata);
static herr_t H5MF_sect_large_shrink(H5FS_section_info_t **_sect,
void *udata);
/*********************/
/* Package Variables */
@ -89,17 +118,68 @@ H5FS_section_class_t H5MF_FSPACE_SECT_CLS_SIMPLE[1] = {{
/* Object methods */
NULL, /* Add section */
NULL, /* Serialize section */
H5MF_sect_simple_deserialize, /* Deserialize section */
H5MF_sect_deserialize, /* Deserialize section */
H5MF_sect_simple_can_merge, /* Can sections merge? */
H5MF_sect_simple_merge, /* Merge sections */
H5MF_sect_simple_can_shrink, /* Can section shrink container?*/
H5MF_sect_simple_shrink, /* Shrink container w/section */
H5MF_sect_simple_free, /* Free section */
H5MF_sect_simple_valid, /* Check validity of section */
H5MF_sect_simple_split, /* Split section node for alignment */
H5MF_sect_free, /* Free section */
H5MF_sect_valid, /* Check validity of section */
H5MF_sect_split, /* Split section node for alignment */
NULL, /* Dump debugging for section */
}};
/* Class info for "small" free space sections */
H5FS_section_class_t H5MF_FSPACE_SECT_CLS_SMALL[1] = {{
/* Class variables */
H5MF_FSPACE_SECT_SMALL, /* Section type */
0, /* Extra serialized size */
H5FS_CLS_MERGE_SYM | H5FS_CLS_ADJUST_OK, /* Class flags */
NULL, /* Class private info */
/* Class methods */
NULL, /* Initialize section class */
NULL, /* Terminate section class */
/* Object methods */
H5MF_sect_small_add, /* Add section */
NULL, /* Serialize section */
H5MF_sect_deserialize, /* Deserialize section */
H5MF_sect_small_can_merge, /* Can sections merge? */
H5MF_sect_small_merge, /* Merge sections */
H5MF_sect_small_can_shrink, /* Can section shrink container?*/
H5MF_sect_small_shrink, /* Shrink container w/section */
H5MF_sect_free, /* Free section */
H5MF_sect_valid, /* Check validity of section */
H5MF_sect_split, /* Split section node for alignment */
NULL, /* Dump debugging for section */
}};
/* Class info for "large" free space sections */
H5FS_section_class_t H5MF_FSPACE_SECT_CLS_LARGE[1] = {{
/* Class variables */
H5MF_FSPACE_SECT_LARGE, /* Section type */
0, /* Extra serialized size */
H5FS_CLS_MERGE_SYM | H5FS_CLS_ADJUST_OK, /* Class flags */
NULL, /* Class private info */
/* Class methods */
NULL, /* Initialize section class */
NULL, /* Terminate section class */
/* Object methods */
NULL, /* Add section */
NULL, /* Serialize section */
H5MF_sect_deserialize, /* Deserialize section */
H5MF_sect_large_can_merge, /* Can sections merge? */
H5MF_sect_large_merge, /* Merge sections */
H5MF_sect_large_can_shrink, /* Can section shrink container?*/
H5MF_sect_large_shrink, /* Shrink container w/section */
H5MF_sect_free, /* Free section */
H5MF_sect_valid, /* Check validity of section */
H5MF_sect_split, /* Split section node for alignment */
NULL, /* Dump debugging for section */
}};
/*****************************/
/* Library Private Variables */
@ -113,12 +193,15 @@ H5FS_section_class_t H5MF_FSPACE_SECT_CLS_SIMPLE[1] = {{
/* Declare a free list to manage the H5MF_free_section_t struct */
H5FL_DEFINE(H5MF_free_section_t);
/*
* "simple/small/large" section callbacks
*/
/*-------------------------------------------------------------------------
* Function: H5MF_sect_simple_new
* Function: H5MF_sect_new
*
* Purpose: Create a new 'simple' section and return it to the caller
* Purpose: Create a new section of "ctype" and return it to the caller
*
* Return: Pointer to new section on success/NULL on failure
*
@ -129,9 +212,9 @@ H5FL_DEFINE(H5MF_free_section_t);
*-------------------------------------------------------------------------
*/
H5MF_free_section_t *
H5MF_sect_simple_new(haddr_t sect_off, hsize_t sect_size)
H5MF_sect_new(unsigned ctype, haddr_t sect_off, hsize_t sect_size)
{
H5MF_free_section_t *sect = NULL; /* 'Simple' free space section to add */
H5MF_free_section_t *sect; /* 'Simple' free space section to add */
H5MF_free_section_t *ret_value = NULL; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
@ -148,7 +231,7 @@ H5MF_sect_simple_new(haddr_t sect_off, hsize_t sect_size)
sect->sect_info.size = sect_size;
/* Set the section's class & state */
sect->sect_info.type = H5MF_FSPACE_SECT_SIMPLE;
sect->sect_info.type = ctype;
sect->sect_info.state = H5FS_SECT_LIVE;
/* Set return value */
@ -156,13 +239,43 @@ H5MF_sect_simple_new(haddr_t sect_off, hsize_t sect_size)
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5MF_sect_simple_new() */
} /* end H5MF_sect_new() */
/*-------------------------------------------------------------------------
* Function: H5MF_sect_simple_deserialize
* Function: H5MF_sect_free
*
* Purpose: Deserialize a buffer into a "live" single section
* Purpose: Free a 'simple/small/large' section node
*
* Return: Success: non-negative
* Failure: negative
*
* Programmer: Quincey Koziol
* Tuesday, January 8, 2008
*
*-------------------------------------------------------------------------
*/
herr_t
H5MF_sect_free(H5FS_section_info_t *_sect)
{
H5MF_free_section_t *sect = (H5MF_free_section_t *)_sect; /* File free section */
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Check arguments. */
HDassert(sect);
/* Release the section */
sect = H5FL_FREE(H5MF_free_section_t, sect);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5MF_sect_free() */
/*-------------------------------------------------------------------------
* Function: H5MF_sect_deserialize
*
* Purpose: Deserialize a buffer into a "live" section
*
* Return: Success: non-negative
* Failure: negative
@ -173,7 +286,7 @@ done:
*-------------------------------------------------------------------------
*/
static H5FS_section_info_t *
H5MF_sect_simple_deserialize(const H5FS_section_class_t H5_ATTR_UNUSED *cls,
H5MF_sect_deserialize(const H5FS_section_class_t *cls,
hid_t H5_ATTR_UNUSED dxpl_id, const uint8_t H5_ATTR_UNUSED *buf, haddr_t sect_addr,
hsize_t sect_size, unsigned H5_ATTR_UNUSED *des_flags)
{
@ -183,11 +296,12 @@ H5MF_sect_simple_deserialize(const H5FS_section_class_t H5_ATTR_UNUSED *cls,
FUNC_ENTER_NOAPI_NOINIT
/* Check arguments. */
HDassert(cls);
HDassert(H5F_addr_defined(sect_addr));
HDassert(sect_size);
/* Create free space section for block */
if(NULL == (sect = H5MF_sect_simple_new(sect_addr, sect_size)))
if(NULL == (sect = H5MF_sect_new(cls->type, sect_addr, sect_size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "can't initialize free space section")
/* Set return value */
@ -195,8 +309,78 @@ H5MF_sect_simple_deserialize(const H5FS_section_class_t H5_ATTR_UNUSED *cls,
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5MF_sect_simple_deserialize() */
} /* H5MF_sect_deserialize() */
/*-------------------------------------------------------------------------
* Function: H5MF_sect_valid
*
* Purpose: Check the validity of a section
*
* Return: Success: non-negative
* Failure: negative
*
* Programmer: Quincey Koziol
* Tuesday, January 8, 2008
*
*-------------------------------------------------------------------------
*/
static herr_t
H5MF_sect_valid(const H5FS_section_class_t H5_ATTR_UNUSED *cls,
const H5FS_section_info_t
#ifdef NDEBUG
H5_ATTR_UNUSED
#endif /* NDEBUG */
*_sect, hid_t H5_ATTR_UNUSED dxpl_id)
{
#ifndef NDEBUG
const H5MF_free_section_t *sect = (const H5MF_free_section_t *)_sect; /* File free section */
#endif /* NDEBUG */
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Check arguments. */
HDassert(sect);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5MF_sect_valid() */
/*-------------------------------------------------------------------------
* Function: H5MF_sect_split
*
* Purpose: Split SECT into 2 sections: fragment for alignment & the aligned section
* SECT's addr and size are updated to point to the aligned section
*
* Return: Success: the fragment for aligning sect
* Failure: null
*
* Programmer: Vailin Choi, July 29, 2008
*
*-------------------------------------------------------------------------
*/
static H5FS_section_info_t *
H5MF_sect_split(H5FS_section_info_t *sect, hsize_t frag_size)
{
H5MF_free_section_t *ret_value; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
/* Allocate space for new section */
if(NULL == (ret_value = H5MF_sect_new(sect->type, sect->addr, frag_size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "can't initialize free space section")
/* Set new section's info */
sect->addr += frag_size;
sect->size -= frag_size;
done:
FUNC_LEAVE_NOAPI((H5FS_section_info_t *)ret_value)
} /* end H5MF_sect_split() */
/*
* "simple" section callbacks
*/
/*-------------------------------------------------------------------------
* Function: H5MF_sect_simple_can_merge
@ -252,10 +436,10 @@ H5MF_sect_simple_can_merge(const H5FS_section_info_t *_sect1,
*-------------------------------------------------------------------------
*/
static herr_t
H5MF_sect_simple_merge(H5FS_section_info_t *_sect1, H5FS_section_info_t *_sect2,
H5MF_sect_simple_merge(H5FS_section_info_t **_sect1, H5FS_section_info_t *_sect2,
void H5_ATTR_UNUSED *_udata)
{
H5MF_free_section_t *sect1 = (H5MF_free_section_t *)_sect1; /* File free section */
H5MF_free_section_t **sect1 = (H5MF_free_section_t **)_sect1; /* File free section */
H5MF_free_section_t *sect2 = (H5MF_free_section_t *)_sect2; /* File free section */
herr_t ret_value = SUCCEED; /* Return value */
@ -263,16 +447,16 @@ H5MF_sect_simple_merge(H5FS_section_info_t *_sect1, H5FS_section_info_t *_sect2,
/* Check arguments. */
HDassert(sect1);
HDassert(sect1->sect_info.type == H5MF_FSPACE_SECT_SIMPLE);
HDassert((*sect1)->sect_info.type == H5MF_FSPACE_SECT_SIMPLE);
HDassert(sect2);
HDassert(sect2->sect_info.type == H5MF_FSPACE_SECT_SIMPLE);
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(H5MF_sect_simple_free((H5FS_section_info_t *)sect2) < 0)
if(H5MF_sect_free((H5FS_section_info_t *)sect2) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't free section node")
done:
@ -293,7 +477,7 @@ done:
*
*-------------------------------------------------------------------------
*/
htri_t
static htri_t
H5MF_sect_simple_can_shrink(const H5FS_section_info_t *_sect, void *_udata)
{
const H5MF_free_section_t *sect = (const H5MF_free_section_t *)_sect; /* File free section */
@ -392,7 +576,7 @@ done:
*
*-------------------------------------------------------------------------
*/
herr_t
static herr_t
H5MF_sect_simple_shrink(H5FS_section_info_t **_sect, void *_udata)
{
H5MF_free_section_t **sect = (H5MF_free_section_t **)_sect; /* File free section */
@ -411,8 +595,8 @@ H5MF_sect_simple_shrink(H5FS_section_info_t **_sect, void *_udata)
/* Sanity check */
HDassert(H5F_INTENT(udata->f) & H5F_ACC_RDWR);
/* Release section's space at EOA with file driver */
if(H5FD_free(udata->f->shared->lf, udata->dxpl_id, udata->alloc_type, udata->f, (*sect)->sect_info.addr, (*sect)->sect_info.size) < 0)
/* Release section's space at EOA */
if(H5F_free(udata->f, udata->dxpl_id, udata->alloc_type, (*sect)->sect_info.addr, (*sect)->sect_info.size) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "driver free request failed")
} /* end if */
else {
@ -427,7 +611,7 @@ H5MF_sect_simple_shrink(H5FS_section_info_t **_sect, void *_udata)
/* Check for freeing section */
if(udata->shrink != H5MF_SHRINK_SECT_ABSORB_AGGR) {
/* Free section */
if(H5MF_sect_simple_free((H5FS_section_info_t *)*sect) < 0)
if(H5MF_sect_free((H5FS_section_info_t *)*sect) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't free simple section node")
/* Mark section as freed, for free space manager */
@ -438,100 +622,474 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5MF_sect_simple_shrink() */
/*-------------------------------------------------------------------------
* Function: H5MF_sect_simple_free
*
* Purpose: Free a 'single' section node
*
* Return: Success: non-negative
* Failure: negative
*
* Programmer: Quincey Koziol
* Tuesday, January 8, 2008
*
*-------------------------------------------------------------------------
/*
* "small" section callbacks
*/
herr_t
H5MF_sect_simple_free(H5FS_section_info_t *_sect)
{
H5MF_free_section_t *sect = (H5MF_free_section_t *)_sect; /* File free section */
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Check arguments. */
HDassert(sect);
/* Release the section */
sect = H5FL_FREE(H5MF_free_section_t, sect);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5MF_sect_simple_free() */
/*-------------------------------------------------------------------------
* Function: H5MF_sect_simple_valid
* Function: H5MF_sect_small_add
*
* Purpose: Check the validity of a section
* Purpose: Perform actions on a small "meta" action before adding it to the free space manager:
* 1) Drop the section if it is at page end and its size <= page end threshold
* 2) Adjust section size to include page end threshold if
* (section size + threshold) is at page end
*
* Return: Success: non-negative
* Failure: negative
* Return: Success: non-negative
* Failure: negative
*
* Programmer: Quincey Koziol
* Tuesday, January 8, 2008
* Programmer: Vailin Choi; Dec 2012
*
*-------------------------------------------------------------------------
*/
static herr_t
H5MF_sect_simple_valid(const H5FS_section_class_t H5_ATTR_UNUSED *cls,
const H5FS_section_info_t
#ifdef NDEBUG
H5_ATTR_UNUSED
#endif /* NDEBUG */
*_sect, hid_t H5_ATTR_UNUSED dxpl_id)
H5MF_sect_small_add(H5FS_section_info_t **_sect, unsigned *flags, void *_udata)
{
H5MF_free_section_t **sect = (H5MF_free_section_t **)_sect; /* Fractal heap free section */
H5MF_sect_ud_t *udata = (H5MF_sect_ud_t *)_udata; /* User data for callback */
haddr_t sect_end;
hsize_t rem, prem;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
#ifdef H5MF_ALLOC_DEBUG_MORE
HDfprintf(stderr, "%s: Entering, section {%a, %Hu}\n", FUNC, (*sect)->sect_info.addr, (*sect)->sect_info.size);
#endif /* H5MF_ALLOC_DEBUG_MORE */
/* Do not adjust the section raw data or global heap data */
if(udata->alloc_type == H5FD_MEM_DRAW || udata->alloc_type == H5FD_MEM_GHEAP)
HGOTO_DONE(ret_value);
sect_end = (*sect)->sect_info.addr + (*sect)->sect_info.size;
rem = sect_end % udata->f->shared->fs_page_size;
prem = udata->f->shared->fs_page_size - rem;
/* Drop the section if it is at page end and its size is <= pgend threshold */
if(!rem && (*sect)->sect_info.size <= H5F_PGEND_META_THRES(udata->f) && (*flags & H5FS_ADD_RETURNED_SPACE)) {
if(H5MF_sect_free((H5FS_section_info_t *)(*sect)) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't free section node")
*sect = NULL;
*flags &= (unsigned)~H5FS_ADD_RETURNED_SPACE;
*flags |= H5FS_PAGE_END_NO_ADD;
#ifdef H5MF_ALLOC_DEBUG_MORE
HDfprintf(stderr, "%s: section is dropped\n", FUNC);
#endif /* H5MF_ALLOC_DEBUG_MORE */
} /* end if */
/* Adjust the section if it is not at page end but its size + pgend threshold is at page end */
else
if(prem <= H5F_PGEND_META_THRES(udata->f)) {
(*sect)->sect_info.size += prem;
#ifdef H5MF_ALLOC_DEBUG_MORE
HDfprintf(stderr, "%s: section is adjusted {%a, %Hu}\n", FUNC, (*sect)->sect_info.addr, (*sect)->sect_info.size);
#endif /* H5MF_ALLOC_DEBUG_MORE */
} /* end if */
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5MF_sect_small_add() */
/*-------------------------------------------------------------------------
* Function: H5MF_sect_small_can_shrink
*
* Purpose: Can this section shrink the container?
*
* Note: A small section is allowed to shrink only at closing.
*
* Return: Success: non-negative (TRUE/FALSE)
* Failure: negative
*
* Programmer: Vailin Choi; Dec 2012
*
*-------------------------------------------------------------------------
*/
static htri_t
H5MF_sect_small_can_shrink(const H5FS_section_info_t *_sect, void *_udata)
{
#ifndef NDEBUG
const H5MF_free_section_t *sect = (const H5MF_free_section_t *)_sect; /* File free section */
#endif /* NDEBUG */
H5MF_sect_ud_t *udata = (H5MF_sect_ud_t *)_udata; /* User data for callback */
haddr_t eoa; /* End of address space in the file */
haddr_t end; /* End of section to extend */
htri_t ret_value = FALSE; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
/* Check arguments. */
HDassert(sect);
HDassert(udata);
HDassert(udata->f);
/* Retrieve the end of the file's address space */
if(HADDR_UNDEF == (eoa = H5FD_get_eoa(udata->f->shared->lf, udata->alloc_type)))
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "driver get_eoa request failed")
/* Compute address of end of section to check */
end = sect->sect_info.addr + sect->sect_info.size;
/* Check if the section is exactly at the end of the allocated space in the file */
if(H5F_addr_eq(end, eoa) && sect->sect_info.size == udata->f->shared->fs_page_size) {
udata->shrink = H5MF_SHRINK_EOA;
#ifdef H5MF_ALLOC_DEBUG_MORE
HDfprintf(stderr, "%s: section {%a, %Hu}, shrinks file, eoa = %a\n", FUNC, sect->sect_info.addr, sect->sect_info.size, eoa);
#endif /* H5MF_ALLOC_DEBUG_MORE */
/* Indicate shrinking can occur */
HGOTO_DONE(TRUE)
} /* end if */
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5MF_sect_small_can_shrink() */
/*-------------------------------------------------------------------------
* Function: H5MF_sect_small_shrink
*
* Purpose: Shrink container with section
*
* Return: Success: non-negative
* Failure: negative
*
* Programmer: Vailin Choi; Dec 2012
*
*-------------------------------------------------------------------------
*/
static herr_t
H5MF_sect_small_shrink(H5FS_section_info_t **_sect, void *_udata)
{
H5MF_free_section_t **sect = (H5MF_free_section_t **)_sect; /* File free section */
H5MF_sect_ud_t *udata = (H5MF_sect_ud_t *)_udata; /* User data for callback */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
/* Check arguments. */
HDassert(sect);
HDassert((*sect)->sect_info.type == H5MF_FSPACE_SECT_SMALL);
HDassert(udata);
HDassert(udata->f);
HDassert(udata->shrink == H5MF_SHRINK_EOA);
HDassert(H5F_INTENT(udata->f) & H5F_ACC_RDWR);
/* Release section's space at EOA */
if(H5F_free(udata->f, udata->dxpl_id, udata->alloc_type, (*sect)->sect_info.addr, (*sect)->sect_info.size) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "driver free request failed")
/* Free section */
if(H5MF_sect_free((H5FS_section_info_t *)*sect) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't free simple section node")
/* Mark section as freed, for free space manager */
*sect = NULL;
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5MF_sect_small_shrink() */
/*-------------------------------------------------------------------------
* Function: H5MF_sect_small_can_merge
*
* Purpose: Can two sections of this type merge?
*
* Note: Second section must be "after" first section
* The "merged" section cannot cross page boundary.
*
* Return: Success: non-negative (TRUE/FALSE)
* Failure: negative
*
* Programmer: Vailin Choi; Dec 2012
*
*-------------------------------------------------------------------------
*/
static htri_t
H5MF_sect_small_can_merge(const H5FS_section_info_t *_sect1,
const H5FS_section_info_t *_sect2, void *_udata)
{
const H5MF_free_section_t *sect1 = (const H5MF_free_section_t *)_sect1; /* File free section */
const H5MF_free_section_t *sect2 = (const H5MF_free_section_t *)_sect2; /* File free section */
H5MF_sect_ud_t *udata = (H5MF_sect_ud_t *)_udata; /* User data for callback */
htri_t ret_value = FALSE; /* Return value */
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Check arguments. */
HDassert(sect);
HDassert(sect1);
HDassert(sect2);
HDassert(sect1->sect_info.type == sect2->sect_info.type); /* Checks "MERGE_SYM" flag */
HDassert(H5F_addr_lt(sect1->sect_info.addr, sect2->sect_info.addr));
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5MF_sect_simple_valid() */
/* Check if second section adjoins first section */
ret_value = H5F_addr_eq(sect1->sect_info.addr + sect1->sect_info.size, sect2->sect_info.addr);
if(ret_value > 0)
/* If they are on different pages, couldn't merge */
if((sect1->sect_info.addr / udata->f->shared->fs_page_size) != (((sect2->sect_info.addr + sect2->sect_info.size - 1) / udata->f->shared->fs_page_size)))
ret_value = FALSE;
#ifdef H5MF_ALLOC_DEBUG_MORE
HDfprintf(stderr, "%s: Leaving: ret_value = %t\n", FUNC, ret_value);
#endif /* H5MF_ALLOC_DEBUG_MORE */
FUNC_LEAVE_NOAPI(ret_value)
} /* H5MF_sect_small_can_merge() */
/*-------------------------------------------------------------------------
* Function: H5MF_sect_simple_split
* Function: H5MF_sect_small_merge
*
* Purpose: Split SECT into 2 sections: fragment for alignment & the aligned section
* SECT's addr and size are updated to point to the aligned section
* Purpose: Merge two sections of this type
*
* Return: Success: the fragment for aligning sect
* Failure: null
* Note: Second section always merges into first node.
* If the size of the "merged" section is equal to file space page size,
* free the section.
*
* Programmer: Vailin Choi, July 29, 2008
* Return: Success: non-negative
* Failure: negative
*
* Programmer: Vailin Choi; Dec 2012
*
*-------------------------------------------------------------------------
*/
static H5FS_section_info_t *
H5MF_sect_simple_split(H5FS_section_info_t *sect, hsize_t frag_size)
static herr_t
H5MF_sect_small_merge(H5FS_section_info_t **_sect1, H5FS_section_info_t *_sect2,
void *_udata)
{
H5MF_free_section_t *ret_value = NULL; /* Return value */
H5MF_free_section_t **sect1 = (H5MF_free_section_t **)_sect1; /* File free section */
H5MF_free_section_t *sect2 = (H5MF_free_section_t *)_sect2; /* File free section */
H5MF_sect_ud_t *udata = (H5MF_sect_ud_t *)_udata; /* User data for callback */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
/* Allocate space for new section */
if(NULL == (ret_value = H5MF_sect_simple_new(sect->addr, frag_size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "can't initialize free space section")
/* Check arguments. */
HDassert(sect1);
HDassert((*sect1)->sect_info.type == H5MF_FSPACE_SECT_SMALL);
HDassert(sect2);
HDassert(sect2->sect_info.type == H5MF_FSPACE_SECT_SMALL);
HDassert(H5F_addr_eq((*sect1)->sect_info.addr + (*sect1)->sect_info.size, sect2->sect_info.addr));
/* Set new section's info */
sect->addr += frag_size;
sect->size -= frag_size;
/* Add second section's size to first section */
(*sect1)->sect_info.size += sect2->sect_info.size;
if((*sect1)->sect_info.size == udata->f->shared->fs_page_size) {
if(H5MF_xfree(udata->f, udata->alloc_type, udata->dxpl_id, (*sect1)->sect_info.addr, (*sect1)->sect_info.size) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "can't free merged section")
/* Need to free possible metadata page in the PB cache */
/* This is in response to the data corruption bug from fheap.c with page buffering + page strategy */
/* Note: Large metadata page bypasses the PB cache */
/* Note: Update of raw data page (large or small sized) is handled by the PB cache */
if(udata->f->shared->page_buf != NULL && udata->alloc_type != H5FD_MEM_DRAW)
if(H5PB_remove_entry(udata->f, (*sect1)->sect_info.addr) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "can't free merged section")
if(H5MF_sect_free((H5FS_section_info_t *)(*sect1)) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't free section node")
*sect1 = NULL;
} /* end if */
/* Get rid of second section */
if(H5MF_sect_free((H5FS_section_info_t *)sect2) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't free section node")
done:
FUNC_LEAVE_NOAPI((H5FS_section_info_t *)ret_value)
} /* end H5MF_sect_simple_split() */
FUNC_LEAVE_NOAPI(ret_value)
} /* H5MF_sect_small_merge() */
/*
* "Large" section callbacks
*/
/*-------------------------------------------------------------------------
* Function: H5MF_sect_large_can_merge (same as H5MF_sect_simple_can_merge)
*
* Purpose: Can two sections of this type merge?
*
* Note: Second section must be "after" first section
*
* Return: Success: non-negative (TRUE/FALSE)
* Failure: negative
*
* Programmer: Vailin Choi; Dec 2012
*
*-------------------------------------------------------------------------
*/
static htri_t
H5MF_sect_large_can_merge(const H5FS_section_info_t *_sect1,
const H5FS_section_info_t *_sect2, void H5_ATTR_UNUSED *_udata)
{
const H5MF_free_section_t *sect1 = (const H5MF_free_section_t *)_sect1; /* File free section */
const H5MF_free_section_t *sect2 = (const H5MF_free_section_t *)_sect2; /* File free section */
htri_t ret_value = FALSE; /* Return value */
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Check arguments. */
HDassert(sect1);
HDassert(sect2);
HDassert(sect1->sect_info.type == sect2->sect_info.type); /* Checks "MERGE_SYM" flag */
HDassert(H5F_addr_lt(sect1->sect_info.addr, sect2->sect_info.addr));
ret_value = H5F_addr_eq(sect1->sect_info.addr + sect1->sect_info.size, sect2->sect_info.addr);
#ifdef H5MF_ALLOC_DEBUG_MORE
HDfprintf(stderr, "%s: Leaving: ret_value = %t\n", FUNC, ret_value);
#endif /* H5MF_ALLOC_DEBUG_MORE */
FUNC_LEAVE_NOAPI(ret_value)
} /* H5MF_sect_large_can_merge() */
/*-------------------------------------------------------------------------
* Function: H5MF_sect_large_merge (same as H5MF_sect_simple_merge)
*
* Purpose: Merge two sections of this type
*
* Note: Second section always merges into first node
*
* Return: Success: non-negative
* Failure: negative
*
* Programmer: Vailin Choi; Dec 2012
*
*-------------------------------------------------------------------------
*/
static herr_t
H5MF_sect_large_merge(H5FS_section_info_t **_sect1, H5FS_section_info_t *_sect2,
void H5_ATTR_UNUSED *_udata)
{
H5MF_free_section_t **sect1 = (H5MF_free_section_t **)_sect1; /* File free section */
H5MF_free_section_t *sect2 = (H5MF_free_section_t *)_sect2; /* File free section */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
/* Check arguments. */
HDassert(sect1);
HDassert((*sect1)->sect_info.type == H5MF_FSPACE_SECT_LARGE);
HDassert(sect2);
HDassert(sect2->sect_info.type == H5MF_FSPACE_SECT_LARGE);
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;
/* Get rid of second section */
if(H5MF_sect_free((H5FS_section_info_t *)sect2) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't free section node")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5MF_sect_large_merge() */
/*-------------------------------------------------------------------------
* Function: H5MF_sect_large_can_shrink
*
* Purpose: Can this section shrink the container?
*
* Return: Success: non-negative (TRUE/FALSE)
* Failure: negative
*
* Programmer: Vailin Choi; Dec 2012
*
*-------------------------------------------------------------------------
*/
static htri_t
H5MF_sect_large_can_shrink(const H5FS_section_info_t *_sect, void *_udata)
{
const H5MF_free_section_t *sect = (const H5MF_free_section_t *)_sect; /* File free section */
H5MF_sect_ud_t *udata = (H5MF_sect_ud_t *)_udata; /* User data for callback */
haddr_t eoa; /* End of address space in the file */
haddr_t end; /* End of section to extend */
htri_t ret_value = FALSE; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
/* Check arguments. */
HDassert(sect);
HDassert(sect->sect_info.type == H5MF_FSPACE_SECT_LARGE);
HDassert(udata);
HDassert(udata->f);
/* Retrieve the end of the file's address space */
if(HADDR_UNDEF == (eoa = H5FD_get_eoa(udata->f->shared->lf, udata->alloc_type)))
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "driver get_eoa request failed")
/* Compute address of end of section to check */
end = sect->sect_info.addr + sect->sect_info.size;
/* Check if the section is exactly at the end of the allocated space in the file */
if(H5F_addr_eq(end, eoa) && sect->sect_info.size >= udata->f->shared->fs_page_size) {
/* Set the shrinking type */
udata->shrink = H5MF_SHRINK_EOA;
#ifdef H5MF_ALLOC_DEBUG_MORE
HDfprintf(stderr, "%s: section {%a, %Hu}, shrinks file, eoa = %a\n", FUNC, sect->sect_info.addr, sect->sect_info.size, eoa);
#endif /* H5MF_ALLOC_DEBUG_MORE */
/* Indicate shrinking can occur */
HGOTO_DONE(TRUE)
} /* end if */
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5MF_sect_large_can_shrink() */
/*-------------------------------------------------------------------------
* Function: H5MF_sect_large_shrink
*
* Purpose: Shrink a large-sized section
*
* Return: Success: non-negative
* Failure: negative
*
* Programmer: Vailin Choi; Dec 2012
*
*-------------------------------------------------------------------------
*/
static herr_t
H5MF_sect_large_shrink(H5FS_section_info_t **_sect, void *_udata)
{
H5MF_free_section_t **sect = (H5MF_free_section_t **)_sect; /* File free section */
H5MF_sect_ud_t *udata = (H5MF_sect_ud_t *)_udata; /* User data for callback */
hsize_t frag_size = 0; /* Fragment size */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
/* Check arguments. */
HDassert(sect);
HDassert((*sect)->sect_info.type == H5MF_FSPACE_SECT_LARGE);
HDassert(udata);
HDassert(udata->f);
HDassert(udata->shrink == H5MF_SHRINK_EOA);
HDassert(H5F_INTENT(udata->f) & H5F_ACC_RDWR);
HDassert(H5F_PAGED_AGGR(udata->f));
/* Calculate possible mis-aligned fragment */
H5MF_EOA_MISALIGN(udata->f, (*sect)->sect_info.addr, udata->f->shared->fs_page_size, frag_size);
/* Free full pages from EOA */
/* Retain partial page in the free-space manager so as to keep EOA at page boundary */
if(H5F_free(udata->f, udata->dxpl_id, udata->alloc_type, (*sect)->sect_info.addr+frag_size, (*sect)->sect_info.size-frag_size) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "driver free request failed")
if(frag_size) /* Adjust section size for the partial page */
(*sect)->sect_info.size = frag_size;
else {
/* Free section */
if(H5MF_sect_free((H5FS_section_info_t *)*sect) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't free simple section node")
/* Mark section as freed, for free space manager */
*sect = NULL;
} /* end else */
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5MF_sect_large_shrink() */

View File

@ -2023,6 +2023,7 @@ H5O_merge_null(H5F_t *f, hid_t dxpl_id, H5O_t *oh)
/* Second message has been merged, delete it */
if(merged_msg) {
H5O_chunk_proxy_t *curr_chk_proxy; /* Chunk that message is in */
htri_t result;
/* Release any information/memory for second message */
H5O_msg_free_mesg(curr_msg2);
@ -2050,6 +2051,13 @@ H5O_merge_null(H5F_t *f, hid_t dxpl_id, H5O_t *oh)
/* (Don't bother reducing size of message array for now -QAK) */
oh->nmesgs--;
/* The merge null message might span the entire chunk: scan for empty chunk to remove */
if((result = H5O_remove_empty_chunks(f, dxpl_id, oh)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTPACK, FAIL, "can't remove empty chunk")
else if(result > 0)
/* Get out of loop */
break;
/* If the merged message is too large, shrink the chunk */
if(curr_msg->raw_size >= H5O_MESG_MAX_SIZE)
if(H5O_alloc_shrink_chunk(f, dxpl_id, oh, curr_msg->chunkno) < 0)

View File

@ -33,6 +33,7 @@
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
#include "H5Fprivate.h" /* Files */
#include "H5FLprivate.h" /* Free Lists */
#include "H5Opkg.h" /* Object headers */
#include "H5MFprivate.h" /* File space management */
@ -290,9 +291,50 @@ H5O__mdci_delete(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, void *_mesg)
HDassert(mesg);
/* Free file space for cache image */
if(H5F_addr_defined(mesg->addr))
if(H5MF_xfree(f, H5FD_MEM_SUPER, dxpl_id, mesg->addr, mesg->size) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to free file space for cache image block")
if(H5F_addr_defined(mesg->addr)) {
/* The space for the cache image block was allocated directly
* from the VFD layer at the end of file. As this was the
* last file space allocation before shutdown, the cache image
* should still be the last item in the file.
*
* If the hack to work around the self referential free space
* manager issue is in use, file space for the non-empty self
* referential free space managers was also allocated from VFD
* layer at the end of file. Since these allocations directly
* preceeded the cache image allocation they should be directly
* adjacent to the cache image block at the end of file.
*
* In this case, just call H5MF_tidy_self_referential_fsm_hack().
*
* That routine will float the self referential free space
* managers, and reduce the eoa to its value just prior to
* allocation of space for same. Since the cache image appears
* just after the self referential free space managers, this
* will release the file space for the cache image as well.
*
* Note that in this case, there must not have been any file
* space allocations / deallocations prior to the free of the
* cache image. Verify this to the extent possible.
*
* If the hack to work around the persistant self referential
* free space manager issue is NOT in use, just call H5MF_xfree()
* to release the cache iamge. In principle, we should be able
* to just reduce the EOA to the base address of the cache
* image block, as there shouldn't be any file space allocation
* before the first metadata cache access. However, given
* time constraints, I don't want to go there now.
*/
if(H5F_FIRST_ALLOC_DEALLOC(f)) {
HDassert(HADDR_UNDEF !=H5F_EOA_PRE_FSM_FSALLOC(f));
HDassert(H5F_addr_ge(mesg->addr, H5F_EOA_PRE_FSM_FSALLOC(f)));
if(H5MF_tidy_self_referential_fsm_hack(f, dxpl_id) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "tidy of self referential fsm hack failed")
} /* end if */
else {
if(H5MF_xfree(f, H5FD_MEM_SUPER, dxpl_id, mesg->addr, mesg->size) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to free file space for cache image block")
} /* end else */
} /* end if */
done:
FUNC_LEAVE_NOAPI(ret_value)

View File

@ -23,12 +23,13 @@
*
*-------------------------------------------------------------------------
*/
#define H5F_FRIEND /*suppress error about including H5Fpkg */
#include "H5Omodule.h" /* This source code file is part of the H5O module */
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
#include "H5Fpkg.h" /* File access */
#include "H5FLprivate.h" /* Free lists */
#include "H5Opkg.h" /* Object headers */
@ -66,7 +67,8 @@ const H5O_msg_class_t H5O_MSG_FSINFO[1] = {{
}};
/* Current version of free-space manager info information */
#define H5O_FSINFO_VERSION 0
#define H5O_FSINFO_VERSION_0 0
#define H5O_FSINFO_VERSION_1 1
/* Declare a free list to manage the H5O_fsinfo_t struct */
H5FL_DEFINE_STATIC(H5O_fsinfo_t);
@ -85,12 +87,13 @@ H5FL_DEFINE_STATIC(H5O_fsinfo_t);
*-------------------------------------------------------------------------
*/
static void *
H5O_fsinfo_decode(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED *open_oh,
H5O_fsinfo_decode(H5F_t *f, hid_t dxpl_id, H5O_t H5_ATTR_UNUSED *open_oh,
unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, const uint8_t *p)
{
H5O_fsinfo_t *fsinfo = NULL; /* free-space manager info */
H5FD_mem_t type; /* Memory type for iteration */
void *ret_value = NULL; /* Return value */
H5O_fsinfo_t *fsinfo = NULL; /* File space info message */
H5F_mem_page_t ptype; /* Memory type for iteration */
unsigned vers; /* message version */
void *ret_value = NULL; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
@ -98,26 +101,83 @@ H5O_fsinfo_decode(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED *
HDassert(f);
HDassert(p);
/* Version of message */
if(*p++ != H5O_FSINFO_VERSION)
HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "bad version number for message")
/* Allocate space for message */
if(NULL == (fsinfo = H5FL_CALLOC(H5O_fsinfo_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
fsinfo->strategy = (H5F_file_space_type_t)*p++; /* file space strategy */
H5F_DECODE_LENGTH(f, p, fsinfo->threshold); /* free space section size threshold */
for(ptype = H5F_MEM_PAGE_SUPER; ptype < H5F_MEM_PAGE_NTYPES; H5_INC_ENUM(H5F_mem_page_t, ptype))
fsinfo->fs_addr[ptype - 1] = HADDR_UNDEF;
/* Addresses of free space managers: only exist for H5F_FILE_SPACE_ALL_PERSIST */
if(fsinfo->strategy == H5F_FILE_SPACE_ALL_PERSIST) {
for(type = H5FD_MEM_SUPER; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, type))
H5F_addr_decode(f, &p, &(fsinfo->fs_addr[type-1]));
} /* end if */
else {
for(type = H5FD_MEM_SUPER; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, type))
fsinfo->fs_addr[type-1] = HADDR_UNDEF;
} /* end else */
/* Version of message */
vers = *p++;
if(vers == H5O_FSINFO_VERSION_0) {
H5F_file_space_type_t strategy; /* Strategy */
hsize_t threshold; /* Threshold */
H5FD_mem_t type; /* Memory type for iteration */
fsinfo->persist = H5F_FREE_SPACE_PERSIST_DEF;
fsinfo->threshold = H5F_FREE_SPACE_THRESHOLD_DEF;
fsinfo->page_size = H5F_FILE_SPACE_PAGE_SIZE_DEF;
fsinfo->pgend_meta_thres = H5F_FILE_SPACE_PGEND_META_THRES;
fsinfo->eoa_pre_fsm_fsalloc = HADDR_UNDEF;
strategy = (H5F_file_space_type_t)*p++; /* File space strategy */
H5F_DECODE_LENGTH(f, p, threshold); /* Free-space section threshold */
/* Map version 0 (deprecated) to version 1 message */
switch(strategy) {
case H5F_FILE_SPACE_ALL_PERSIST:
fsinfo->strategy = H5F_FSPACE_STRATEGY_FSM_AGGR;
fsinfo->persist = TRUE;
fsinfo->threshold = threshold;
if(HADDR_UNDEF == (fsinfo->eoa_pre_fsm_fsalloc = H5F_get_eoa(f, H5FD_MEM_DEFAULT)) )
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "unable to get file size")
for(type = H5FD_MEM_SUPER; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, type))
H5F_addr_decode(f, &p, &(fsinfo->fs_addr[type-1]));
break;
case H5F_FILE_SPACE_ALL:
fsinfo->strategy = H5F_FSPACE_STRATEGY_FSM_AGGR;
fsinfo->threshold = threshold;
break;
case H5F_FILE_SPACE_AGGR_VFD:
fsinfo->strategy = H5F_FSPACE_STRATEGY_AGGR;
break;
case H5F_FILE_SPACE_VFD:
fsinfo->strategy = H5F_FSPACE_STRATEGY_NONE;
break;
case H5F_FILE_SPACE_NTYPES:
case H5F_FILE_SPACE_DEFAULT:
default:
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid file space strategy")
} /* end switch */
fsinfo->mapped = TRUE;
} else {
HDassert(vers == H5O_FSINFO_VERSION_1);
fsinfo->strategy = (H5F_fspace_strategy_t)*p++; /* File space strategy */
fsinfo->persist = *p++; /* Free-space persist or not */
H5F_DECODE_LENGTH(f, p, fsinfo->threshold); /* Free-space section threshold */
H5F_DECODE_LENGTH(f, p, fsinfo->page_size); /* File space page size */
UINT16DECODE(p, fsinfo->pgend_meta_thres); /* Page end metdata threshold */
H5F_addr_decode(f, &p, &(fsinfo->eoa_pre_fsm_fsalloc)); /* EOA before free-space header and section info */
/* Decode addresses of free space managers, if persisting */
if(fsinfo->persist) {
for(ptype = H5F_MEM_PAGE_SUPER; ptype < H5F_MEM_PAGE_NTYPES; H5_INC_ENUM(H5F_mem_page_t, ptype))
H5F_addr_decode(f, &p, &(fsinfo->fs_addr[ptype - 1]));
} /* end if */
fsinfo->mapped = FALSE;
}
/* Set return value */
ret_value = fsinfo;
@ -145,7 +205,7 @@ static herr_t
H5O_fsinfo_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg)
{
const H5O_fsinfo_t *fsinfo = (const H5O_fsinfo_t *)_mesg;
H5FD_mem_t type; /* Memory type for iteration */
H5F_mem_page_t ptype; /* Memory type for iteration */
FUNC_ENTER_NOAPI_NOINIT_NOERR
@ -154,14 +214,20 @@ H5O_fsinfo_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, c
HDassert(p);
HDassert(fsinfo);
*p++ = H5O_FSINFO_VERSION; /* message version */
*p++ = fsinfo->strategy; /* file space strategy */
H5F_ENCODE_LENGTH(f, p, fsinfo->threshold); /* free-space section size threshold */
*p++ = H5O_FSINFO_VERSION_1; /* message version */
*p++ = fsinfo->strategy; /* File space strategy */
*p++ = (unsigned char)fsinfo->persist; /* Free-space persist or not */
H5F_ENCODE_LENGTH(f, p, fsinfo->threshold); /* Free-space section size threshold */
/* Addresses of free space managers: only exist for H5F_FILE_SPACE_ALL_PERSIST */
if(fsinfo->strategy == H5F_FILE_SPACE_ALL_PERSIST) {
for(type = H5FD_MEM_SUPER; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, type))
H5F_addr_encode(f, &p, fsinfo->fs_addr[type-1]);
H5F_ENCODE_LENGTH(f, p, fsinfo->page_size); /* File space page size */
UINT16ENCODE(p, fsinfo->pgend_meta_thres); /* Page end metadata threshold */
H5F_addr_encode(f, &p, fsinfo->eoa_pre_fsm_fsalloc); /* EOA before free-space header and section info */
/* Store addresses of free-space managers, if persisting */
if(fsinfo->persist) {
/* Addresses of free-space managers */
for(ptype = H5F_MEM_PAGE_SUPER; ptype < H5F_MEM_PAGE_NTYPES; H5_INC_ENUM(H5F_mem_page_t, ptype))
H5F_addr_encode(f, &p, fsinfo->fs_addr[ptype - 1]);
} /* end if */
FUNC_LEAVE_NOAPI(SUCCEED)
@ -224,19 +290,19 @@ static size_t
H5O_fsinfo_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const void *_mesg)
{
const H5O_fsinfo_t *fsinfo = (const H5O_fsinfo_t *)_mesg;
size_t fs_addr_size = 0;
size_t ret_value = 0; /* Return value */
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Addresses of free-space managers exist only for H5F_FILE_SPACE_ALL_PERSIST type */
if(H5F_FILE_SPACE_ALL_PERSIST == fsinfo->strategy)
fs_addr_size = (H5FD_MEM_NTYPES - 1) * (size_t)H5F_SIZEOF_ADDR(f);
ret_value = 2 /* Version & strategy */
+ (size_t)H5F_SIZEOF_SIZE(f) /* Threshold */
+ fs_addr_size; /* Addresses of free-space managers */
ret_value = 3 /* Version, strategy & persist */
+ (size_t)H5F_SIZEOF_SIZE(f) /* Free-space section threshold */
+ (size_t)H5F_SIZEOF_SIZE(f) /* File space page size */
+ 2 /* Page end meta threshold */
+ (size_t)H5F_SIZEOF_ADDR(f);
/* Free-space manager addresses */
if(fsinfo->persist)
ret_value += (H5F_MEM_PAGE_NTYPES - 1) * (size_t)H5F_SIZEOF_ADDR(f);
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_fsinfo_size() */
@ -282,7 +348,7 @@ H5O_fsinfo_debug(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, const vo
int indent, int fwidth)
{
const H5O_fsinfo_t *fsinfo = (const H5O_fsinfo_t *) _mesg;
H5FD_mem_t type; /* Memory type for iteration */
H5F_mem_page_t ptype; /* Free-space types for iteration */
FUNC_ENTER_NOAPI_NOINIT_NOERR
@ -293,16 +359,48 @@ H5O_fsinfo_debug(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, const vo
HDassert(indent >= 0);
HDassert(fwidth >= 0);
HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
"File space strategy:", fsinfo->strategy);
HDfprintf(stream, "%*s%-*s ", indent, "", fwidth, "File space strategy:");
switch(fsinfo->strategy) {
case H5F_FSPACE_STRATEGY_FSM_AGGR:
HDfprintf(stream, "%s\n", "H5F_FSPACE_STRATEGY_FSM_AGGR");
break;
case H5F_FSPACE_STRATEGY_PAGE:
HDfprintf(stream, "%s\n", "H5F_FSPACE_STRATEGY_PAGE");
break;
case H5F_FSPACE_STRATEGY_AGGR:
HDfprintf(stream, "%s\n", "H5F_FSPACE_STRATEGY_AGGR");
break;
case H5F_FSPACE_STRATEGY_NONE:
HDfprintf(stream, "%s\n", "H5F_FSPACE_STRATEGY_NONE");
break;
case H5F_FSPACE_STRATEGY_NTYPES:
default:
HDfprintf(stream, "%s\n", "unknown");
} /* end switch */
HDfprintf(stream, "%*s%-*s %t\n", indent, "", fwidth,
"Free-space persist:", fsinfo->persist);
HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth,
"Free space section threshold:", fsinfo->threshold);
"Free-space section threshold:", fsinfo->threshold);
if(fsinfo->strategy == H5F_FILE_SPACE_ALL_PERSIST) {
for(type = H5FD_MEM_SUPER; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, type))
HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth,
"Free space manager address:", fsinfo->fs_addr[type-1]);
HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth,
"File space page size:", fsinfo->page_size);
HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
"Page end metadata threshold:", fsinfo->pgend_meta_thres);
HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth,
"eoa_pre_fsm_fsalloc:", fsinfo->eoa_pre_fsm_fsalloc);
if(fsinfo->persist) {
for(ptype = H5F_MEM_PAGE_SUPER; ptype < H5F_MEM_PAGE_NTYPES; H5_INC_ENUM(H5F_mem_page_t, ptype))
HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth,
"Free space manager address:", fsinfo->fs_addr[ptype-1]);
} /* end if */
FUNC_LEAVE_NOAPI(SUCCEED)

View File

@ -2253,3 +2253,55 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_flush_msgs() */
/*-------------------------------------------------------------------------
* Function: H5O_msg_get_flags
*
* Purpose: Queries a message's message flags in the object header
*
* Return: Non-negative on success/Negative on failure
*
* Programmer: Vailin; Jan 2013
*
*-------------------------------------------------------------------------
*/
herr_t
H5O_msg_get_flags(const H5O_loc_t *loc, unsigned type_id, hid_t dxpl_id, uint8_t *flags)
{
H5O_t *oh = NULL; /* Object header to use */
const H5O_msg_class_t *type; /* Actual H5O class type for the ID */
H5O_mesg_t *idx_msg; /* Pointer to message to modify */
unsigned idx; /* Index of message to modify */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* check args */
HDassert(loc);
HDassert(loc->file);
HDassert(H5F_addr_defined(loc->addr));
HDassert(type_id < NELMTS(H5O_msg_class_g));
type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */
HDassert(type);
/* Get the object header */
if(NULL == (oh = H5O_protect(loc, dxpl_id, H5AC__READ_ONLY_FLAG, FALSE)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object header")
/* Locate message of correct type */
for(idx = 0, idx_msg = &oh->mesg[0]; idx < oh->nmesgs; idx++, idx_msg++)
if(type == idx_msg->type)
break;
if(idx == oh->nmesgs)
HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "message type not found")
/* Set return value */
*flags = idx_msg->flags;
done:
if(oh && H5O_unprotect(loc, dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_msg_get_flags() */

View File

@ -791,9 +791,16 @@ typedef unsigned H5O_unknown_t; /* Original message type ID */
* (Data structure in memory)
*/
typedef struct H5O_fsinfo_t {
H5F_file_space_type_t strategy; /* File space strategy */
hsize_t threshold; /* Free space section threshold */
haddr_t fs_addr[H5FD_MEM_NTYPES-1]; /* Addresses of free space managers */
H5F_fspace_strategy_t strategy; /* File space strategy */
hbool_t persist; /* Persisting free-space or not */
hsize_t threshold; /* Free-space section threshold */
hsize_t page_size; /* For paged aggregation: file space page size */
size_t pgend_meta_thres; /* For paged aggregation: page end metadata threshold */
haddr_t eoa_pre_fsm_fsalloc; /* For paged aggregation: the eoa before free-space headers & sinfo */
haddr_t fs_addr[H5F_MEM_PAGE_NTYPES - 1]; /* 13 addresses of free-space managers */
/* For non-paged aggregation: only 6 addresses are used */
hbool_t mapped; /* Not stored */
/* Indicate the message is mapped from version 0 to version 1 */
} H5O_fsinfo_t;
/*
@ -920,6 +927,7 @@ H5_DLL void* H5O_msg_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
unsigned type_id, const unsigned char *buf);
H5_DLL herr_t H5O_msg_delete(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
unsigned type_id, void *mesg);
H5_DLL herr_t H5O_msg_get_flags(const H5O_loc_t *loc, unsigned type_id, hid_t dxpl_id, uint8_t *flags);
/* Object metadata flush/refresh routines */
H5_DLL herr_t H5O_flush_common(H5O_loc_t *oloc, hid_t obj_id, hid_t dxpl_id);

1533
src/H5PB.c Normal file

File diff suppressed because it is too large Load Diff

34
src/H5PBmodule.h Normal file
View File

@ -0,0 +1,34 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
* 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. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
* Programmer: Quincey Koziol <koziol@hdfgroup.org>
* Saturday, September 12, 2015
*
* Purpose: This file contains declarations which define macros for the
* H5PB package. Including this header means that the source file
* is part of the H5PB package.
*/
#ifndef _H5PBmodule_H
#define _H5PBmodule_H
/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error
* reporting macros.
*/
#define H5PB_MODULE
#define H5_MY_PKG H5PB
#define H5_MY_PKG_ERR H5E_RESOURCE
#define H5_MY_PKG_INIT NO
#endif /* _H5PBmodule_H */

60
src/H5PBpkg.h Normal file
View File

@ -0,0 +1,60 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* 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. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#if !(defined H5PB_FRIEND || defined H5PB_MODULE)
#error "Do not include this file outside the H5PB package!"
#endif
#ifndef _H5PBpkg_H
#define _H5PBpkg_H
/* Get package's private header */
#include "H5PBprivate.h"
/* Other private headers needed by this file */
/**************************/
/* Package Private Macros */
/**************************/
/****************************/
/* Package Private Typedefs */
/****************************/
typedef struct H5PB_entry_t {
void *page_buf_ptr; /* Pointer to the buffer containing the data */
haddr_t addr; /* Address of the page in the file */
H5F_mem_page_t type; /* Type of the page entry (H5F_MEM_PAGE_RAW/META) */
hbool_t is_dirty; /* Flag indicating whether the page has dirty data or not */
/* Fields supporting replacement policies */
struct H5PB_entry_t *next; /* next pointer in the LRU list */
struct H5PB_entry_t *prev; /* previous pointer in the LRU list */
} H5PB_entry_t;
/*****************************/
/* Package Private Variables */
/*****************************/
/******************************/
/* Package Private Prototypes */
/******************************/
#endif /* _H5PBpkg_H */

108
src/H5PBprivate.h Normal file
View File

@ -0,0 +1,108 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* 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. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*-------------------------------------------------------------------------
*
* Created: H5PBprivate.h
* June 2014
* Mohamad Chaarawi
*
*-------------------------------------------------------------------------
*/
#ifndef _H5PBprivate_H
#define _H5PBprivate_H
/* Include package's public header */
#ifdef NOT_YET
#include "H5PBpublic.h"
#endif /* NOT_YET */
/* Private headers needed by this header */
#include "H5private.h" /* Generic Functions */
#include "H5Fprivate.h" /* File access */
#include "H5FLprivate.h" /* Free Lists */
#include "H5SLprivate.h" /* Skip List */
/**************************/
/* Library Private Macros */
/**************************/
/****************************/
/* Library Private Typedefs */
/****************************/
/* Forward declaration for a page buffer entry */
struct H5PB_entry_t;
/* Typedef for the main structure for the page buffer */
typedef struct H5PB_t {
size_t max_size; /* The total page buffer size */
size_t page_size; /* Size of a single page */
unsigned min_meta_perc; /* Minimum ratio of metadata entries required before evicting meta entries */
unsigned min_raw_perc; /* Minimum ratio of raw data entries required before evicting raw entries */
unsigned meta_count; /* Number of entries for metadata */
unsigned raw_count; /* Number of entries for raw data */
unsigned min_meta_count; /* Minimum # of entries for metadata */
unsigned min_raw_count; /* Minimum # of entries for raw data */
H5SL_t *slist_ptr; /* Skip list with all the active page entries */
H5SL_t *mf_slist_ptr; /* Skip list containing newly allocated page entries inserted from the MF layer */
size_t LRU_list_len; /* Number of entries in the LRU (identical to slist_ptr count) */
struct H5PB_entry_t *LRU_head_ptr; /* Head pointer of the LRU */
struct H5PB_entry_t *LRU_tail_ptr; /* Tail pointer of the LRU */
H5FL_fac_head_t *page_fac; /* Factory for allocating pages */
/* Statistics */
unsigned accesses[2];
unsigned hits[2];
unsigned misses[2];
unsigned evictions[2];
unsigned bypasses[2];
} H5PB_t;
/*****************************/
/* Library-private Variables */
/*****************************/
/***************************************/
/* Library-private Function Prototypes */
/***************************************/
/* General routines */
H5_DLL herr_t H5PB_create(H5F_t *file, size_t page_buffer_size, unsigned page_buf_min_meta_perc, unsigned page_buf_min_raw_perc);
H5_DLL herr_t H5PB_flush(const H5F_io_info2_t *fio_info);
H5_DLL herr_t H5PB_dest(H5F_t *file);
H5_DLL herr_t H5PB_add_new_page(H5F_t *f, H5FD_mem_t type, haddr_t page_addr);
H5_DLL herr_t H5PB_update_entry(H5PB_t *page_buf, haddr_t addr, size_t size, const void *buf);
H5_DLL herr_t H5PB_remove_entry(const H5F_t *f, haddr_t addr);
H5_DLL herr_t H5PB_read(const H5F_io_info2_t *fio_info, H5FD_mem_t type,
haddr_t addr, size_t size, void *buf/*out*/);
H5_DLL herr_t H5PB_write(const H5F_io_info2_t *f, H5FD_mem_t type, haddr_t addr,
size_t size, const void *buf);
/* Statistics routines */
H5_DLL herr_t H5PB_reset_stats(H5PB_t *page_buf);
H5_DLL herr_t H5PB_get_stats(const H5PB_t *page_buf, unsigned accesses[2],
unsigned hits[2], unsigned misses[2], unsigned evictions[2], unsigned bypasses[2]);
H5_DLL herr_t H5PB_print_stats(const H5PB_t *page_buf);
#endif /* !_H5PBprivate_H */

View File

@ -488,5 +488,135 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_version() */
/*-------------------------------------------------------------------------
* Function: H5Pset_file_space
*
* Purpose: It is mapped to H5Pset_file_space_strategy().
*
* Return: Non-negative on success/Negative on failure
*
* Programmer: Vailin Choi; Jan 2017
*-------------------------------------------------------------------------
*/
herr_t
H5Pset_file_space(hid_t plist_id, H5F_file_space_type_t strategy, hsize_t threshold)
{
H5F_fspace_strategy_t new_strategy; /* File space strategy type */
hbool_t new_persist = H5F_FREE_SPACE_PERSIST_DEF; /* Persisting free-space or not */
hsize_t new_threshold = H5F_FREE_SPACE_THRESHOLD_DEF; /* Free-space section threshold */
H5F_file_space_type_t in_strategy = strategy; /* Input strategy */
hsize_t in_threshold = threshold; /* Input threshold */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE3("e", "iFfh", plist_id, strategy, threshold);
if((unsigned)in_strategy >= H5F_FILE_SPACE_NTYPES)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid strategy")
/*
* For 1.10.0 H5Pset_file_space:
* If strategy is zero, the property is not changed;
* the existing strategy is retained.
* If threshold is zero, the property is not changed;
* the existing threshold is retained.
*/
if(!in_strategy)
H5Pget_file_space(plist_id, &in_strategy, NULL);
if(!in_threshold)
H5Pget_file_space(plist_id, NULL, &in_threshold);
switch(in_strategy) {
case H5F_FILE_SPACE_ALL_PERSIST:
new_strategy = H5F_FSPACE_STRATEGY_FSM_AGGR;
new_persist = TRUE;
new_threshold = in_threshold;
break;
case H5F_FILE_SPACE_ALL:
new_strategy = H5F_FSPACE_STRATEGY_FSM_AGGR;
new_threshold = in_threshold;
break;
case H5F_FILE_SPACE_AGGR_VFD:
new_strategy = H5F_FSPACE_STRATEGY_AGGR;
break;
case H5F_FILE_SPACE_VFD:
new_strategy = H5F_FSPACE_STRATEGY_NONE;
break;
case H5F_FILE_SPACE_NTYPES:
case H5F_FILE_SPACE_DEFAULT:
default:
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file space strategy")
}
if(H5Pset_file_space_strategy(plist_id, new_strategy, new_persist, new_threshold) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set file space strategy")
done:
FUNC_LEAVE_API(ret_value)
} /* H5Pset_file_space() */
/*-------------------------------------------------------------------------
* Function: H5Pget_file_space
*
* Purpose: It is mapped to H5Pget_file_space_strategy().
*
* Return: Non-negative on success/Negative on failure
*
* Programmer: Vailin Choi; Jan 2017
*
*-------------------------------------------------------------------------
*/
herr_t
H5Pget_file_space(hid_t plist_id, H5F_file_space_type_t *strategy, hsize_t *threshold)
{
H5F_fspace_strategy_t new_strategy; /* File space strategy type */
hbool_t new_persist; /* Persisting free-space or not */
hsize_t new_threshold; /* Free-space section threshold */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE3("e", "i*Ff*h", plist_id, strategy, threshold);
/* Get current file space info */
if(H5Pget_file_space_strategy(plist_id, &new_strategy, &new_persist, &new_threshold) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get file space strategy")
/* Get value(s) */
if(strategy) {
switch(new_strategy) {
case H5F_FSPACE_STRATEGY_FSM_AGGR:
if(new_persist)
*strategy = H5F_FILE_SPACE_ALL_PERSIST;
else
*strategy = H5F_FILE_SPACE_ALL;
break;
case H5F_FSPACE_STRATEGY_AGGR:
*strategy = H5F_FILE_SPACE_AGGR_VFD;
break;
case H5F_FSPACE_STRATEGY_NONE:
*strategy = H5F_FILE_SPACE_VFD;
break;
case H5F_FSPACE_STRATEGY_PAGE:
case H5F_FSPACE_STRATEGY_NTYPES:
default:
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file space strategy")
}
}
if(threshold)
*threshold = new_threshold;
done:
FUNC_LEAVE_API(ret_value)
} /* H5Pget_file_space() */
#endif /* H5_NO_DEPRECATED_SYMBOLS */

View File

@ -80,18 +80,18 @@
#define H5F_ACS_PREEMPT_READ_CHUNKS_DEC H5P__decode_double
/* Definition for threshold for alignment */
#define H5F_ACS_ALIGN_THRHD_SIZE sizeof(hsize_t)
#define H5F_ACS_ALIGN_THRHD_DEF 1
#define H5F_ACS_ALIGN_THRHD_DEF H5F_ALIGN_THRHD_DEF
#define H5F_ACS_ALIGN_THRHD_ENC H5P__encode_hsize_t
#define H5F_ACS_ALIGN_THRHD_DEC H5P__decode_hsize_t
/* Definition for alignment */
#define H5F_ACS_ALIGN_SIZE sizeof(hsize_t)
#define H5F_ACS_ALIGN_DEF 1
#define H5F_ACS_ALIGN_DEF H5F_ALIGN_DEF
#define H5F_ACS_ALIGN_ENC H5P__encode_hsize_t
#define H5F_ACS_ALIGN_DEC H5P__decode_hsize_t
/* Definition for minimum metadata allocation block size (when
aggregating metadata allocations. */
#define H5F_ACS_META_BLOCK_SIZE_SIZE sizeof(hsize_t)
#define H5F_ACS_META_BLOCK_SIZE_DEF 2048
#define H5F_ACS_META_BLOCK_SIZE_DEF H5F_META_BLOCK_SIZE_DEF
#define H5F_ACS_META_BLOCK_SIZE_ENC H5P__encode_hsize_t
#define H5F_ACS_META_BLOCK_SIZE_DEC H5P__decode_hsize_t
/* Definition for maximum sieve buffer size (when data sieving
@ -103,7 +103,7 @@
/* Definition for minimum "small data" allocation block size (when
aggregating "small" raw data allocations. */
#define H5F_ACS_SDATA_BLOCK_SIZE_SIZE sizeof(hsize_t)
#define H5F_ACS_SDATA_BLOCK_SIZE_DEF 2048
#define H5F_ACS_SDATA_BLOCK_SIZE_DEF H5F_SDATA_BLOCK_SIZE_DEF
#define H5F_ACS_SDATA_BLOCK_SIZE_ENC H5P__encode_hsize_t
#define H5F_ACS_SDATA_BLOCK_SIZE_DEC H5P__decode_hsize_t
/* Definition for garbage-collect references */
@ -231,6 +231,21 @@
#define H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_ENC H5P__facc_cache_image_config_enc
#define H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_DEC H5P__facc_cache_image_config_dec
#define H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_CMP H5P__facc_cache_image_config_cmp
/* Definition for total size of page buffer(bytes) */
#define H5F_ACS_PAGE_BUFFER_SIZE_SIZE sizeof(size_t)
#define H5F_ACS_PAGE_BUFFER_SIZE_DEF 0
#define H5F_ACS_PAGE_BUFFER_SIZE_ENC H5P__encode_size_t
#define H5F_ACS_PAGE_BUFFER_SIZE_DEC H5P__decode_size_t
/* Definition for minimum metadata size of page buffer(bytes) */
#define H5F_ACS_PAGE_BUFFER_MIN_META_PERC_SIZE sizeof(unsigned)
#define H5F_ACS_PAGE_BUFFER_MIN_META_PERC_DEF 0
#define H5F_ACS_PAGE_BUFFER_MIN_META_PERC_ENC H5P__encode_unsigned
#define H5F_ACS_PAGE_BUFFER_MIN_META_PERC_DEC H5P__decode_unsigned
/* Definition for minimum raw data size of page buffer(bytes) */
#define H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_SIZE sizeof(unsigned)
#define H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_DEF 0
#define H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_ENC H5P__encode_unsigned
#define H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_DEC H5P__decode_unsigned
/******************/
@ -359,6 +374,9 @@ static const H5P_coll_md_read_flag_t H5F_def_coll_md_read_flag_g = H5F_ACS_COLL_
static const hbool_t H5F_def_coll_md_write_flag_g = H5F_ACS_COLL_MD_WRITE_FLAG_DEF; /* Default setting for the collective metedata write flag */
#endif /* H5_HAVE_PARALLEL */
static const H5AC_cache_image_config_t H5F_def_mdc_initCacheImageCfg_g = H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_DEF; /* Default metadata cache image settings */
static const size_t H5F_def_page_buf_size_g = H5F_ACS_PAGE_BUFFER_SIZE_DEF; /* Default page buffer size */
static const unsigned H5F_def_page_buf_min_meta_perc_g = H5F_ACS_PAGE_BUFFER_MIN_META_PERC_DEF; /* Default page buffer minimum metadata size */
static const unsigned H5F_def_page_buf_min_raw_perc_g = H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_DEF; /* Default page buffer minumum raw data size */
/*-------------------------------------------------------------------------
@ -574,6 +592,22 @@ H5P__facc_reg_prop(H5P_genclass_t *pclass)
NULL, NULL, H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_CMP, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the size of the page buffer size */
if(H5P_register_real(pclass, H5F_ACS_PAGE_BUFFER_SIZE_NAME, H5F_ACS_PAGE_BUFFER_SIZE_SIZE, &H5F_def_page_buf_size_g,
NULL, NULL, NULL, H5F_ACS_PAGE_BUFFER_SIZE_ENC, H5F_ACS_PAGE_BUFFER_SIZE_DEC,
NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the size of the page buffer minimum metadata size */
if(H5P_register_real(pclass, H5F_ACS_PAGE_BUFFER_MIN_META_PERC_NAME, H5F_ACS_PAGE_BUFFER_MIN_META_PERC_SIZE, &H5F_def_page_buf_min_meta_perc_g,
NULL, NULL, NULL, H5F_ACS_PAGE_BUFFER_MIN_META_PERC_ENC, H5F_ACS_PAGE_BUFFER_MIN_META_PERC_DEC,
NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the size of the page buffer minimum raw data size */
if(H5P_register_real(pclass, H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_NAME, H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_SIZE, &H5F_def_page_buf_min_raw_perc_g,
NULL, NULL, NULL, H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_ENC, H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_DEC,
NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P__facc_reg_prop() */
@ -4681,3 +4715,93 @@ done:
} /* end H5Pget_coll_metadata_write() */
#endif /* H5_HAVE_PARALLEL */
/*-------------------------------------------------------------------------
* Function: H5Pset_page_buffer_size
*
* Purpose: Set the maximum page buffering size. This has to be a
* multiple of the page allocation size which must be enabled;
* otherwise file create/open will fail.
*
* Return: Non-negative on success/Negative on failure
*
* Programmer: Mohamad Chaarawi
* June 2015
*
*-------------------------------------------------------------------------
*/
herr_t
H5Pset_page_buffer_size(hid_t plist_id, size_t buf_size, unsigned min_meta_perc, unsigned min_raw_perc)
{
H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value = SUCCEED; /* return value */
FUNC_ENTER_API(FAIL)
H5TRACE4("e", "izIuIu", plist_id, buf_size, min_meta_perc, min_raw_perc);
/* Get the plist structure */
if(NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
if(min_meta_perc > 100)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Minimum metadata fractions must be between 0 and 100 inclusive")
if(min_raw_perc > 100)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Minimum rawdata fractions must be between 0 and 100 inclusive")
if(min_meta_perc + min_raw_perc > 100)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Sum of minimum metadata and raw data fractions can't be bigger than 100");
/* Set size */
if(H5P_set(plist, H5F_ACS_PAGE_BUFFER_SIZE_NAME, &buf_size) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET,FAIL, "can't set page buffer size")
if(H5P_set(plist, H5F_ACS_PAGE_BUFFER_MIN_META_PERC_NAME, &min_meta_perc) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET,FAIL, "can't set percentage of min metadata entries")
if(H5P_set(plist, H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_NAME, &min_raw_perc) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET,FAIL, "can't set percentage of min rawdata entries")
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pset_page_buffer_size() */
/*-------------------------------------------------------------------------
* Function: H5Pget_page_buffer_size
*
* Purpose: Retrieves the maximum page buffer size.
*
* Return: Non-negative on success/Negative on failure
*
* Programmer: Mohamad Chaarawi
* June 2015
*
*-------------------------------------------------------------------------
*/
herr_t
H5Pget_page_buffer_size(hid_t plist_id, size_t *buf_size, unsigned *min_meta_perc, unsigned *min_raw_perc)
{
H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value = SUCCEED; /* return value */
FUNC_ENTER_API(FAIL)
H5TRACE4("e", "i*z*Iu*Iu", plist_id, buf_size, min_meta_perc, min_raw_perc);
/* Get the plist structure */
if(NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
/* Get size */
if(buf_size)
if(H5P_get(plist, H5F_ACS_PAGE_BUFFER_SIZE_NAME, buf_size) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET,FAIL, "can't get page buffer size")
if(min_meta_perc)
if(H5P_get(plist, H5F_ACS_PAGE_BUFFER_MIN_META_PERC_NAME, min_meta_perc) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET,FAIL, "can't get page buffer minimum metadata percent")
if(min_raw_perc)
if(H5P_get(plist, H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_NAME, min_raw_perc) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET,FAIL, "can't get page buffer minimum raw data percent")
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_page_buffer_size() */

View File

@ -97,14 +97,23 @@
#define H5F_CRT_SHMSG_BTREE_MIN_ENC H5P__encode_unsigned
#define H5F_CRT_SHMSG_BTREE_MIN_DEC H5P__decode_unsigned
/* Definitions for file space handling strategy */
#define H5F_CRT_FILE_SPACE_STRATEGY_SIZE sizeof(unsigned)
#define H5F_CRT_FILE_SPACE_STRATEGY_DEF H5F_FILE_SPACE_STRATEGY_DEF
#define H5F_CRT_FILE_SPACE_STRATEGY_ENC H5P__encode_unsigned
#define H5F_CRT_FILE_SPACE_STRATEGY_DEC H5P__decode_unsigned
#define H5F_CRT_FREE_SPACE_THRESHOLD_SIZE sizeof(hsize_t)
#define H5F_CRT_FREE_SPACE_THRESHOLD_DEF H5F_FREE_SPACE_THRESHOLD_DEF
#define H5F_CRT_FREE_SPACE_THRESHOLD_ENC H5P__encode_hsize_t
#define H5F_CRT_FREE_SPACE_THRESHOLD_DEC H5P__decode_hsize_t
#define H5F_CRT_FILE_SPACE_STRATEGY_SIZE sizeof(H5F_fspace_strategy_t)
#define H5F_CRT_FILE_SPACE_STRATEGY_DEF H5F_FILE_SPACE_STRATEGY_DEF
#define H5F_CRT_FILE_SPACE_STRATEGY_ENC H5P__fcrt_fspace_strategy_enc
#define H5F_CRT_FILE_SPACE_STRATEGY_DEC H5P__fcrt_fspace_strategy_dec
#define H5F_CRT_FREE_SPACE_PERSIST_SIZE sizeof(hbool_t)
#define H5F_CRT_FREE_SPACE_PERSIST_DEF H5F_FREE_SPACE_PERSIST_DEF
#define H5F_CRT_FREE_SPACE_PERSIST_ENC H5P__encode_hbool_t
#define H5F_CRT_FREE_SPACE_PERSIST_DEC H5P__decode_hbool_t
#define H5F_CRT_FREE_SPACE_THRESHOLD_SIZE sizeof(hsize_t)
#define H5F_CRT_FREE_SPACE_THRESHOLD_DEF H5F_FREE_SPACE_THRESHOLD_DEF
#define H5F_CRT_FREE_SPACE_THRESHOLD_ENC H5P__encode_hsize_t
#define H5F_CRT_FREE_SPACE_THRESHOLD_DEC H5P__decode_hsize_t
/* Definitions for file space page size in support of level-2 page caching */
#define H5F_CRT_FILE_SPACE_PAGE_SIZE_SIZE sizeof(hsize_t)
#define H5F_CRT_FILE_SPACE_PAGE_SIZE_DEF H5F_FILE_SPACE_PAGE_SIZE_DEF
#define H5F_CRT_FILE_SPACE_PAGE_SIZE_ENC H5P__encode_hsize_t
#define H5F_CRT_FILE_SPACE_PAGE_SIZE_DEC H5P__decode_hsize_t
/******************/
@ -131,6 +140,8 @@ static herr_t H5P__fcrt_shmsg_index_types_enc(const void *value, void **_pp, siz
static herr_t H5P__fcrt_shmsg_index_types_dec(const void **_pp, void *value);
static herr_t H5P__fcrt_shmsg_index_minsize_enc(const void *value, void **_pp, size_t *size);
static herr_t H5P__fcrt_shmsg_index_minsize_dec(const void **_pp, void *value);
static herr_t H5P__fcrt_fspace_strategy_enc(const void *value, void **_pp, size_t *size);
static herr_t H5P__fcrt_fspace_strategy_dec(const void **_pp, void *_value);
/*********************/
@ -178,8 +189,10 @@ static const unsigned H5F_def_sohm_index_flags_g[H5O_SHMESG_MAX_NINDEXES] = H
static const unsigned H5F_def_sohm_index_minsizes_g[H5O_SHMESG_MAX_NINDEXES] = H5F_CRT_SHMSG_INDEX_MINSIZE_DEF;
static const unsigned H5F_def_sohm_list_max_g = H5F_CRT_SHMSG_LIST_MAX_DEF;
static const unsigned H5F_def_sohm_btree_min_g = H5F_CRT_SHMSG_BTREE_MIN_DEF;
static const unsigned H5F_def_file_space_strategy_g = H5F_CRT_FILE_SPACE_STRATEGY_DEF;
static const H5F_fspace_strategy_t H5F_def_file_space_strategy_g = H5F_CRT_FILE_SPACE_STRATEGY_DEF;
static const hbool_t H5F_def_free_space_persist_g = H5F_CRT_FREE_SPACE_PERSIST_DEF;
static const hsize_t H5F_def_free_space_threshold_g = H5F_CRT_FREE_SPACE_THRESHOLD_DEF;
static const hsize_t H5F_def_file_space_page_size_g = H5F_CRT_FILE_SPACE_PAGE_SIZE_DEF;
@ -267,12 +280,24 @@ H5P_fcrt_reg_prop(H5P_genclass_t *pclass)
NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the free-space persist flag */
if(H5P_register_real(pclass, H5F_CRT_FREE_SPACE_PERSIST_NAME, H5F_CRT_FREE_SPACE_PERSIST_SIZE, &H5F_def_free_space_persist_g,
NULL, NULL, NULL, H5F_CRT_FREE_SPACE_PERSIST_ENC, H5F_CRT_FREE_SPACE_PERSIST_DEC,
NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the free space section threshold */
if(H5P_register_real(pclass, H5F_CRT_FREE_SPACE_THRESHOLD_NAME, H5F_CRT_FREE_SPACE_THRESHOLD_SIZE, &H5F_def_free_space_threshold_g,
NULL, NULL, NULL, H5F_CRT_FREE_SPACE_THRESHOLD_ENC, H5F_CRT_FREE_SPACE_THRESHOLD_DEC,
NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the file space page size */
if(H5P_register_real(pclass, H5F_CRT_FILE_SPACE_PAGE_SIZE_NAME, H5F_CRT_FILE_SPACE_PAGE_SIZE_SIZE, &H5F_def_file_space_page_size_g,
NULL, NULL, NULL, H5F_CRT_FILE_SPACE_PAGE_SIZE_ENC, H5F_CRT_FILE_SPACE_PAGE_SIZE_DEC,
NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P_fcrt_reg_prop() */
@ -1246,15 +1271,13 @@ H5Pget_shared_mesg_phase_change(hid_t plist_id, unsigned *max_list, unsigned *mi
if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_CREATE)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
/* Get value */
if (max_list) {
/* Get value(s) */
if(max_list)
if(H5P_get(plist, H5F_CRT_SHMSG_LIST_MAX_NAME, max_list) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get list maximum");
}
if (min_btree) {
if(min_btree)
if(H5P_get(plist, H5F_CRT_SHMSG_BTREE_MIN_NAME, min_btree) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get SOHM information");
}
done:
FUNC_LEAVE_API(ret_value)
@ -1262,15 +1285,12 @@ done:
/*-------------------------------------------------------------------------
* Function: H5Pset_file_space
* Function: H5Pset_file_space_strategy
*
* Purpose: Sets the strategy that the library employs in managing file space.
* If strategy is zero, the property is not changed; the existing
* strategy is retained.
* Sets the threshold value that the file's free space
* manager(s) will use to track free space sections.
* If threshold is zero, the property is not changed; the existing
* threshold is retained.
* Purpose: Sets the "strategy" that the library employs in managing file space
* Sets the "persist" value as to persist free-space or not
* Sets the "threshold" value that the free space manager(s) will use to track free space sections.
* Ignore "persist" and "threshold" for strategies that do not use free-space managers
*
* Return: Non-negative on success/Negative on failure
*
@ -1279,15 +1299,16 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
H5Pset_file_space(hid_t plist_id, H5F_file_space_type_t strategy, hsize_t threshold)
H5Pset_file_space_strategy(hid_t plist_id, H5F_fspace_strategy_t strategy, hbool_t persist, hsize_t threshold)
{
H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE3("e", "iFfh", plist_id, strategy, threshold);
H5TRACE4("e", "iFfbh", plist_id, strategy, persist, threshold);
if((unsigned)strategy >= H5F_FILE_SPACE_NTYPES)
/* Check arguments */
if(strategy >= H5F_FSPACE_STRATEGY_NTYPES)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid strategy")
/* Get the plist structure */
@ -1295,24 +1316,28 @@ H5Pset_file_space(hid_t plist_id, H5F_file_space_type_t strategy, hsize_t thresh
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
/* Set value(s), if non-zero */
if(strategy)
if(H5P_set(plist, H5F_CRT_FILE_SPACE_STRATEGY_NAME, &strategy) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set file space strategy")
if(threshold)
if(H5P_set(plist, H5F_CRT_FREE_SPACE_THRESHOLD_NAME, &threshold) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set free-space threshold")
if(H5P_set(plist, H5F_CRT_FILE_SPACE_STRATEGY_NAME, &strategy) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set file space strategy")
/* Ignore persist and threshold settings for strategies that do not use FSM */
if(strategy == H5F_FSPACE_STRATEGY_FSM_AGGR || strategy == H5F_FSPACE_STRATEGY_PAGE) {
if(H5P_set(plist, H5F_CRT_FREE_SPACE_PERSIST_NAME, &persist) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set free-space persisting status")
if(H5P_set(plist, H5F_CRT_FREE_SPACE_THRESHOLD_NAME, &threshold) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set free-space threshold")
} /* end if */
done:
FUNC_LEAVE_API(ret_value)
} /* H5Pset_file_space() */
} /* H5Pset_file_space_strategy() */
/*-------------------------------------------------------------------------
* Function: H5Pget_file_space
* Function: H5Pget_file_space_strategy
*
* Purpose: Retrieves the strategy that the library uses in managing file space.
* Retrieves the threshold value that the file's free space
* managers use to track free space sections.
* Purpose: Retrieves the strategy, persist, and threshold that the library
* uses in managing file space.
*
* Return: Non-negative on success/Negative on failure
*
@ -1321,13 +1346,13 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
H5Pget_file_space(hid_t plist_id, H5F_file_space_type_t *strategy, hsize_t *threshold)
H5Pget_file_space_strategy(hid_t plist_id, H5F_fspace_strategy_t *strategy, hbool_t *persist, hsize_t *threshold)
{
H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE3("e", "i*Ff*h", plist_id, strategy, threshold);
H5TRACE4("e", "i*Ff*b*h", plist_id, strategy, persist, threshold);
/* Get the plist structure */
if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_CREATE)))
@ -1337,11 +1362,158 @@ H5Pget_file_space(hid_t plist_id, H5F_file_space_type_t *strategy, hsize_t *thre
if(strategy)
if(H5P_get(plist, H5F_CRT_FILE_SPACE_STRATEGY_NAME, strategy) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get file space strategy")
if(persist)
if(H5P_get(plist, H5F_CRT_FREE_SPACE_PERSIST_NAME, persist) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get free-space persisting status")
if(threshold)
if(H5P_get(plist, H5F_CRT_FREE_SPACE_THRESHOLD_NAME, threshold) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get free-space threshold")
done:
FUNC_LEAVE_API(ret_value)
} /* H5Pget_file_space() */
} /* H5Pget_file_space_strategy() */
/*-------------------------------------------------------------------------
* Function: H5P__fcrt_fspace_strategy_enc
*
* Purpose: Callback routine which is called whenever the free-space
* strategy property in the file creation property list
* is encoded.
*
* Return: Success: Non-negative
* Failure: Negative
*
* Programmer: Quincey Koziol
* Friday, December 27, 2013
*
*-------------------------------------------------------------------------
*/
static herr_t
H5P__fcrt_fspace_strategy_enc(const void *value, void **_pp, size_t *size)
{
const H5F_fspace_strategy_t *strategy = (const H5F_fspace_strategy_t *)value; /* Create local alias for values */
uint8_t **pp = (uint8_t **)_pp;
FUNC_ENTER_STATIC_NOERR
/* Sanity check */
HDassert(strategy);
HDassert(size);
if(NULL != *pp)
/* Encode free-space strategy */
*(*pp)++ = (uint8_t)*strategy;
/* Size of free-space strategy */
(*size)++;
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5P__fcrt_fspace_strategy_enc() */
/*-------------------------------------------------------------------------
* Function: H5P__fcrt_fspace_strategy_dec
*
* Purpose: Callback routine which is called whenever the free-space
* strategy property in the file creation property list
* is decoded.
*
* Return: Success: Non-negative
* Failure: Negative
*
* Programmer: Quincey Koziol
* Friday, December 27, 2013
*
*-------------------------------------------------------------------------
*/
static herr_t
H5P__fcrt_fspace_strategy_dec(const void **_pp, void *_value)
{
H5F_fspace_strategy_t *strategy = (H5F_fspace_strategy_t *)_value; /* Free-space strategy */
const uint8_t **pp = (const uint8_t **)_pp;
FUNC_ENTER_STATIC_NOERR
/* Sanity checks */
HDassert(pp);
HDassert(*pp);
HDassert(strategy);
/* Decode free-space strategy */
*strategy = (H5F_fspace_strategy_t)*(*pp)++;
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5P__fcrt_fspace_strategy_dec() */
/*-------------------------------------------------------------------------
* Function: H5Pset_file_space_page_size
*
* Purpose: Sets the file space page size for paged aggregation.
*
* Return: Non-negative on success/Negative on failure
*
* Programmer: Vailin Choi; August 2012
*
*-------------------------------------------------------------------------
*/
herr_t
H5Pset_file_space_page_size(hid_t plist_id, hsize_t fsp_size)
{
H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "ih", plist_id, fsp_size);
/* Get the plist structure */
if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_CREATE)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
if(fsp_size < H5F_FILE_SPACE_PAGE_SIZE_MIN)
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "cannot set file space page size to less than 512")
/* Set the value*/
if(H5P_set(plist, H5F_CRT_FILE_SPACE_PAGE_SIZE_NAME, &fsp_size) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set file space page size")
done:
FUNC_LEAVE_API(ret_value)
} /* H5Pset_file_space_page_size() */
/*-------------------------------------------------------------------------
* Function: H5Pget_file_space_page_size
*
* Purpose: Retrieves the file space page size for aggregating small metadata
* or raw data in the parameter "fsp_size".
*
* Return: Non-negative on success/Negative on failure
*
* Programmer: Vailin Choi; August 2012
*
*-------------------------------------------------------------------------
*/
herr_t
H5Pget_file_space_page_size(hid_t plist_id, hsize_t *fsp_size)
{
H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "i*h", plist_id, fsp_size);
/* Get the plist structure */
if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_CREATE)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
/* Get value */
if(fsp_size)
if(H5P_get(plist, H5F_CRT_FILE_SPACE_PAGE_SIZE_NAME, fsp_size) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get file space page size")
done:
FUNC_LEAVE_API(ret_value)
} /* H5Pget_file_space_page_size() */

View File

@ -300,8 +300,10 @@ H5_DLL herr_t H5Pset_shared_mesg_index(hid_t plist_id, unsigned index_num, unsig
H5_DLL herr_t H5Pget_shared_mesg_index(hid_t plist_id, unsigned index_num, unsigned *mesg_type_flags, unsigned *min_mesg_size);
H5_DLL herr_t H5Pset_shared_mesg_phase_change(hid_t plist_id, unsigned max_list, unsigned min_btree);
H5_DLL herr_t H5Pget_shared_mesg_phase_change(hid_t plist_id, unsigned *max_list, unsigned *min_btree);
H5_DLL herr_t H5Pset_file_space(hid_t plist_id, H5F_file_space_type_t strategy, hsize_t threshold);
H5_DLL herr_t H5Pget_file_space(hid_t plist_id, H5F_file_space_type_t *strategy, hsize_t *threshold);
H5_DLL herr_t H5Pset_file_space_strategy(hid_t plist_id, H5F_fspace_strategy_t strategy, hbool_t persist, hsize_t threshold);
H5_DLL herr_t H5Pget_file_space_strategy(hid_t plist_id, H5F_fspace_strategy_t *strategy, hbool_t *persist, hsize_t *threshold);
H5_DLL herr_t H5Pset_file_space_page_size(hid_t plist_id, hsize_t fsp_size);
H5_DLL herr_t H5Pget_file_space_page_size(hid_t plist_id, hsize_t *fsp_size);
/* File access property list (FAPL) routines */
H5_DLL herr_t H5Pset_alignment(hid_t fapl_id, hsize_t threshold,
@ -367,6 +369,8 @@ H5_DLL herr_t H5Pget_coll_metadata_write(hid_t plist_id, hbool_t *is_collective)
#endif /* H5_HAVE_PARALLEL */
H5_DLL herr_t H5Pset_mdc_image_config(hid_t plist_id, H5AC_cache_image_config_t *config_ptr);
H5_DLL herr_t H5Pget_mdc_image_config(hid_t plist_id, H5AC_cache_image_config_t *config_ptr /*out*/);
H5_DLL herr_t H5Pset_page_buffer_size(hid_t plist_id, size_t buf_size, unsigned min_meta_per, unsigned min_raw_per);
H5_DLL herr_t H5Pget_page_buffer_size(hid_t plist_id, size_t *buf_size, unsigned *min_meta_per, unsigned *min_raw_per);
/* Dataset creation property list (DCPL) routines */
H5_DLL herr_t H5Pset_layout(hid_t plist_id, H5D_layout_t layout);
@ -534,6 +538,8 @@ H5_DLL herr_t H5Pget_filter_by_id1(hid_t plist_id, H5Z_filter_t id,
H5_DLL herr_t H5Pget_version(hid_t plist_id, unsigned *boot/*out*/,
unsigned *freelist/*out*/, unsigned *stab/*out*/,
unsigned *shhdr/*out*/);
H5_DLL herr_t H5Pset_file_space(hid_t plist_id, H5F_file_space_type_t strategy, hsize_t threshold);
H5_DLL herr_t H5Pget_file_space(hid_t plist_id, H5F_file_space_type_t *strategy, hsize_t *threshold);
#endif /* H5_NO_DEPRECATED_SYMBOLS */
#ifdef __cplusplus

View File

@ -77,6 +77,7 @@ MAJOR, H5E_SOHM, Shared Object Header Messages
MAJOR, H5E_EARRAY, Extensible Array
MAJOR, H5E_FARRAY, Fixed Array
MAJOR, H5E_PLUGIN, Plugin for dynamically loaded library
MAJOR, H5E_PAGEBUF, Page Buffering
MAJOR, H5E_NONE_MAJOR, No error
# Sections (for grouping minor errors)

View File

@ -895,32 +895,28 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
fprintf(out, "NULL");
} /* end if */
else {
H5F_file_space_type_t fs_type = (H5F_file_space_type_t)va_arg(ap, int);
H5F_fspace_strategy_t fs_strategy = (H5F_fspace_strategy_t)va_arg(ap, int);
switch(fs_type) {
case H5F_FILE_SPACE_DEFAULT:
fprintf(out, "H5F_FILE_SPACE_DEFAULT");
switch(fs_strategy) {
case H5F_FSPACE_STRATEGY_FSM_AGGR:
fprintf(out, "H5F_FSPACE_STRATEGY_FSM_AGGR");
break;
case H5F_FILE_SPACE_ALL_PERSIST:
fprintf(out, "H5F_FILE_SPACE_ALL_PERSIST");
case H5F_FSPACE_STRATEGY_PAGE:
fprintf(out, "H5F_FSPACE_STRATEGY_PAGE");
break;
case H5F_FILE_SPACE_ALL:
fprintf(out, "H5F_FILE_SPACE_ALL");
case H5F_FSPACE_STRATEGY_AGGR:
fprintf(out, "H5F_FSPACE_STRATEGY_AGGR");
break;
case H5F_FILE_SPACE_AGGR_VFD:
fprintf(out, "H5F_FILE_SPACE_AGGR_VFD");
case H5F_FSPACE_STRATEGY_NONE:
fprintf(out, "H5F_FSPACE_STRATEGY_NONE");
break;
case H5F_FILE_SPACE_VFD:
fprintf(out, "H5F_FILE_SPACE_VFD");
break;
case H5F_FILE_SPACE_NTYPES:
case H5F_FSPACE_STRATEGY_NTYPES:
default:
fprintf(out, "%ld", (long)fs_type);
fprintf(out, "%ld", (long)fs_strategy);
break;
} /* end switch */
} /* end else */
@ -1003,6 +999,15 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
} /* end else */
break;
case 't':
if(ptr) {
if(vp)
fprintf(out, "0x%lx", (unsigned long)vp);
else
fprintf(out, "NULL");
} /* end if */
break;
case 'v':
if(ptr) {
if(vp)

View File

@ -60,7 +60,7 @@ libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \
H5F.c H5Fint.c H5Faccum.c H5Fcwfs.c \
H5Fdbg.c H5Fdeprec.c H5Fefc.c H5Ffake.c H5Fio.c \
H5Fmount.c H5Fquery.c \
H5Fsfile.c H5Fsuper.c H5Fsuper_cache.c H5Ftest.c \
H5Fsfile.c H5Fspace.c H5Fsuper.c H5Fsuper_cache.c H5Ftest.c \
H5FA.c H5FAcache.c H5FAdbg.c H5FAdblock.c H5FAdblkpage.c H5FAhdr.c \
H5FAint.c H5FAstat.c H5FAtest.c \
H5FD.c H5FDcore.c \
@ -98,6 +98,7 @@ libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \
H5Pfapl.c H5Pfcpl.c H5Pfmpl.c \
H5Pgcpl.c H5Pint.c \
H5Plapl.c H5Plcpl.c H5Pocpl.c H5Pocpypl.c H5Pstrcpl.c H5Ptest.c \
H5PB.c \
H5PL.c \
H5R.c H5Rdeprec.c \
H5UC.c \

View File

@ -246,6 +246,7 @@ set (H5_TESTS
cross_read
freespace
mf
page_buffer
vds
file_image
unregister

View File

@ -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

View File

@ -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

BIN
test/aggr.h5 Normal file

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -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 */
/* 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(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 */
/* 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(paged)
my_fcpl = fcpl2_id;
if(!check_fapl_mdc_api_calls(paged, my_fcpl))
nerrs += 1;
if(!check_file_mdc_api_calls(paged, my_fcpl))
nerrs += 1;
if(!mdc_api_call_smoke_check(express_test, paged, my_fcpl))
nerrs += 1;
if(!check_file_mdc_api_errs(paged, my_fcpl))
nerrs += 1;
} /* end for paged */
if(!check_fapl_mdc_api_errs())
nerrs += 1;
}
if ( !check_file_mdc_api_calls() ) {
nerrs += 1;
}
if ( !mdc_api_call_smoke_check(express_test) ) {
nerrs += 1;
}
if ( !check_fapl_mdc_api_errs() ) {
nerrs += 1;
}
if ( !check_file_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

View File

@ -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) ) {

View File

@ -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,

View File

@ -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() */

View File

@ -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 */

View File

@ -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;
/* 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;
/* 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 */
/* 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 */
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);
/* Close 2nd FAPL */
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);

View File

@ -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);

Binary file not shown.

View File

@ -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

BIN
test/fsm_aggr_nopersist.h5 Normal file

Binary file not shown.

BIN
test/fsm_aggr_persist.h5 Normal file

Binary file not shown.

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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);

BIN
test/h5fc_ext1_f.h5 Normal file

Binary file not shown.

BIN
test/h5fc_ext1_i.h5 Normal file

Binary file not shown.

BIN
test/h5fc_ext2_if.h5 Normal file

Binary file not shown.

BIN
test/h5fc_ext2_sf.h5 Normal file

Binary file not shown.

BIN
test/h5fc_ext3_isf.h5 Normal file

Binary file not shown.

BIN
test/h5fc_ext_none.h5 Normal file

Binary file not shown.

View File

@ -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 */

5203
test/mf.c

File diff suppressed because it is too large Load Diff

2087
test/page_buffer.c Normal file

File diff suppressed because it is too large Load Diff

BIN
test/paged_persist.h5 Normal file

Binary file not shown.

View File

@ -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 */

View File

@ -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);

Some files were not shown because too many files have changed in this diff Show More