diff options
author | Scot Breitenfeld <brtnfld@hdfgroup.org> | 2015-06-10 19:23:09 (GMT) |
---|---|---|
committer | Scot Breitenfeld <brtnfld@hdfgroup.org> | 2015-06-10 19:23:09 (GMT) |
commit | 6c4e3759f533f36f7832f1277e4f0c725e663653 (patch) | |
tree | 39b6cbb8d2d6fb61ad602bbc25f42bd89e6e9ca4 | |
parent | f2d14c76b8a8e7c09285fff9db25b101a84354b0 (diff) | |
parent | b9f2a18b5ae9adf23cac4c0336291373a25f0721 (diff) | |
download | hdf5-6c4e3759f533f36f7832f1277e4f0c725e663653.zip hdf5-6c4e3759f533f36f7832f1277e4f0c725e663653.tar.gz hdf5-6c4e3759f533f36f7832f1277e4f0c725e663653.tar.bz2 |
[svn-r27187] svn merge -r27135:27186 https://svn.hdfgroup.uiuc.edu/hdf5/trunk
63 files changed, 923 insertions, 680 deletions
@@ -1117,6 +1117,7 @@ ./testpar/t_pshutdown.c ./testpar/t_prestart.c ./testpar/t_span_tree.c +./testpar/t_init_term.c ./testpar/testpar.h ./testpar/testphdf5.c ./testpar/testphdf5.h @@ -1,4 +1,4 @@ -HDF5 version 1.9.221 currently under development +HDF5 version 1.9.222 currently under development Please refer to the release_docs/INSTALL file for installation instructions. ------------------------------------------------------------------------------ @@ -179,7 +179,7 @@ sub argstring ($$$) { # Normalize the data type by removing redundant white space, # certain type qualifiers, and indirection. $atype =~ s/^\bconst\b//; - $atype =~ s/\bUNUSED\b//g; + $atype =~ s/\bH5_ATTR_UNUSED\b//g; $atype =~ s/\s+/ /g; $ptr = length $1 if $atype =~ s/(\*+)//; $atype =~ s/^\s+//; diff --git a/c++/src/Makefile.in b/c++/src/Makefile.in index 8362633..3ca4f55 100644 --- a/c++/src/Makefile.in +++ b/c++/src/Makefile.in @@ -684,7 +684,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog *.clog2 # After making changes, run bin/reconfigure to update other configure related # files like Makefile.in. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 211 +LT_VERS_REVISION = 212 LT_VERS_AGE = 0 # This is our main target diff --git a/c++/src/cpp_doc_config b/c++/src/cpp_doc_config index d2a0d28..a4aa9af 100644 --- a/c++/src/cpp_doc_config +++ b/c++/src/cpp_doc_config @@ -38,7 +38,7 @@ PROJECT_NAME = "HDF5 C++ API" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = HDF5 version 1.9.221 currently under development +PROJECT_NUMBER = HDF5 version 1.9.222 currently under development # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/config/cmake/scripts/HDF518config.cmake b/config/cmake/scripts/HDF518config.cmake index f0aceea..aee5389 100755 --- a/config/cmake/scripts/HDF518config.cmake +++ b/config/cmake/scripts/HDF518config.cmake @@ -9,7 +9,8 @@ cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR)
set(CTEST_SOURCE_VERSION 1.8.15)
-set(CTEST_SOURCE_NAME hdf5-${CTEST_SOURCE_VERSION})
+set(CTEST_SOURCE_VERSEXT "")
+set(CTEST_SOURCE_NAME hdf5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT})
set(CTEST_BINARY_NAME "build")
set(CTEST_DASHBOARD_ROOT "${CTEST_SCRIPT_DIRECTORY}")
if(WIN32)
@@ -86,7 +87,7 @@ set(SITE_BUILDNAME_SUFFIX "STATIC") #set(LOCAL_UPDATE "TRUE")
set(REPOSITORY_URL "http://svn.hdfgroup.uiuc.edu/hdf5/branches/hdf5_1_8")
#uncomment to use a compressed source file: *.tar on linux or mac *.zip on windows
-#set(CTEST_USE_TAR_SOURCE "${CTEST_SOURCE_VERSION}")
+#set(CTEST_USE_TAR_SOURCE "${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}")
###################################################################
###################################################################
@@ -100,7 +101,7 @@ set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DBUILD_SHARED_LIBS:BOOL=OFF") #### ext libraries ####
### ext libs from tgz
-set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ALLOW_EXTERNAL_SUPPORT:STRING=TGZ -DTGZPATH:PATH=\"${CTEST_SCRIPT_DIRECTORY}\"")
+set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ALLOW_EXTERNAL_SUPPORT:STRING=TGZ -DTGZPATH:PATH=${CTEST_SCRIPT_DIRECTORY}")
### ext libs from svn
#set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ALLOW_EXTERNAL_SUPPORT:STRING=SVN")
### ext libs on system
@@ -131,41 +132,41 @@ set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_PACKAGE_EXTLIBS:BOOL=ON") if(WIN32)
include(${CTEST_SCRIPT_DIRECTORY}\\CTestScript.cmake)
- if(EXISTS "${CTEST_BINARY_DIRECTORY}\\HDF5-${CTEST_SOURCE_VERSION}-win${SITE_OS_BITS}.exe")
- file(COPY "${CTEST_BINARY_DIRECTORY}\\HDF5-${CTEST_SOURCE_VERSION}-win${SITE_OS_BITS}.exe" DESTINATION ${CTEST_SCRIPT_DIRECTORY})
+ if(EXISTS "${CTEST_BINARY_DIRECTORY}\\HDF5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}-win${SITE_OS_BITS}.exe")
+ file(COPY "${CTEST_BINARY_DIRECTORY}\\HDF5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}-win${SITE_OS_BITS}.exe" DESTINATION ${CTEST_SCRIPT_DIRECTORY})
endif()
- if(EXISTS "${CTEST_BINARY_DIRECTORY}\\HDF5-${CTEST_SOURCE_VERSION}-win${SITE_OS_BITS}.msi")
- file(COPY "${CTEST_BINARY_DIRECTORY}\\HDF5-${CTEST_SOURCE_VERSION}-win${SITE_OS_BITS}.msi" DESTINATION ${CTEST_SCRIPT_DIRECTORY})
+ if(EXISTS "${CTEST_BINARY_DIRECTORY}\\HDF5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}-win${SITE_OS_BITS}.msi")
+ file(COPY "${CTEST_BINARY_DIRECTORY}\\HDF5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}-win${SITE_OS_BITS}.msi" DESTINATION ${CTEST_SCRIPT_DIRECTORY})
endif()
- if(EXISTS "${CTEST_BINARY_DIRECTORY}\\HDF5-${CTEST_SOURCE_VERSION}-win${SITE_OS_BITS}.zip")
- file(COPY "${CTEST_BINARY_DIRECTORY}\\HDF5-${CTEST_SOURCE_VERSION}-win${SITE_OS_BITS}.zip" DESTINATION ${CTEST_SCRIPT_DIRECTORY})
+ if(EXISTS "${CTEST_BINARY_DIRECTORY}\\HDF5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}-win${SITE_OS_BITS}.zip")
+ file(COPY "${CTEST_BINARY_DIRECTORY}\\HDF5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}-win${SITE_OS_BITS}.zip" DESTINATION ${CTEST_SCRIPT_DIRECTORY})
endif()
else()
include(${CTEST_SCRIPT_DIRECTORY}/CTestScript.cmake)
if(APPLE)
- if(EXISTS "${CTEST_BINARY_DIRECTORY}/HDF5-${CTEST_SOURCE_VERSION}-Darwin.dmg")
- file(COPY "${CTEST_BINARY_DIRECTORY}/HDF5-${CTEST_SOURCE_VERSION}-Darwin.dmg" DESTINATION ${CTEST_SCRIPT_DIRECTORY})
+ if(EXISTS "${CTEST_BINARY_DIRECTORY}/HDF5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}-Darwin.dmg")
+ file(COPY "${CTEST_BINARY_DIRECTORY}/HDF5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}-Darwin.dmg" DESTINATION ${CTEST_SCRIPT_DIRECTORY})
endif()
- if(EXISTS "${CTEST_BINARY_DIRECTORY}/HDF5-${CTEST_SOURCE_VERSION}-Darwin.tar.gz")
- file(COPY "${CTEST_BINARY_DIRECTORY}/HDF5-${CTEST_SOURCE_VERSION}-Darwin.tar.gz" DESTINATION ${CTEST_SCRIPT_DIRECTORY})
+ if(EXISTS "${CTEST_BINARY_DIRECTORY}/HDF5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}-Darwin.tar.gz")
+ file(COPY "${CTEST_BINARY_DIRECTORY}/HDF5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}-Darwin.tar.gz" DESTINATION ${CTEST_SCRIPT_DIRECTORY})
endif()
- if(EXISTS "${CTEST_BINARY_DIRECTORY}/HDF5-${CTEST_SOURCE_VERSION}-Darwin.sh")
- file(COPY "${CTEST_BINARY_DIRECTORY}/HDF5-${CTEST_SOURCE_VERSION}-Darwin.sh" DESTINATION ${CTEST_SCRIPT_DIRECTORY})
+ if(EXISTS "${CTEST_BINARY_DIRECTORY}/HDF5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}-Darwin.sh")
+ file(COPY "${CTEST_BINARY_DIRECTORY}/HDF5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}-Darwin.sh" DESTINATION ${CTEST_SCRIPT_DIRECTORY})
endif()
else()
if(CYGWIN)
- if(EXISTS "${CTEST_BINARY_DIRECTORY}/HDF5-${CTEST_SOURCE_VERSION}-CYGWIN.sh")
- file(COPY "${CTEST_BINARY_DIRECTORY}/HDF5-${CTEST_SOURCE_VERSION}-CYGWIN.sh" DESTINATION ${CTEST_SCRIPT_DIRECTORY})
+ if(EXISTS "${CTEST_BINARY_DIRECTORY}/HDF5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}-CYGWIN.sh")
+ file(COPY "${CTEST_BINARY_DIRECTORY}/HDF5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}-CYGWIN.sh" DESTINATION ${CTEST_SCRIPT_DIRECTORY})
endif()
- if(EXISTS "${CTEST_BINARY_DIRECTORY}/HDF5-${CTEST_SOURCE_VERSION}-CYGWIN.tar.gz")
- file(COPY "${CTEST_BINARY_DIRECTORY}/HDF5-${CTEST_SOURCE_VERSION}-CYGWIN.tar.gz" DESTINATION ${CTEST_SCRIPT_DIRECTORY})
+ if(EXISTS "${CTEST_BINARY_DIRECTORY}/HDF5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}-CYGWIN.tar.gz")
+ file(COPY "${CTEST_BINARY_DIRECTORY}/HDF5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}-CYGWIN.tar.gz" DESTINATION ${CTEST_SCRIPT_DIRECTORY})
endif()
else()
- if(EXISTS "${CTEST_BINARY_DIRECTORY}/HDF5-${CTEST_SOURCE_VERSION}-Linux.sh")
- file(COPY "${CTEST_BINARY_DIRECTORY}/HDF5-${CTEST_SOURCE_VERSION}-Linux.sh" DESTINATION ${CTEST_SCRIPT_DIRECTORY})
+ if(EXISTS "${CTEST_BINARY_DIRECTORY}/HDF5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}-Linux.sh")
+ file(COPY "${CTEST_BINARY_DIRECTORY}/HDF5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}-Linux.sh" DESTINATION ${CTEST_SCRIPT_DIRECTORY})
endif()
- if(EXISTS "${CTEST_BINARY_DIRECTORY}/HDF5-${CTEST_SOURCE_VERSION}-Linux.tar.gz")
- file(COPY "${CTEST_BINARY_DIRECTORY}/HDF5-${CTEST_SOURCE_VERSION}-Linux.tar.gz" DESTINATION ${CTEST_SCRIPT_DIRECTORY})
+ if(EXISTS "${CTEST_BINARY_DIRECTORY}/HDF5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}-Linux.tar.gz")
+ file(COPY "${CTEST_BINARY_DIRECTORY}/HDF5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}-Linux.tar.gz" DESTINATION ${CTEST_SCRIPT_DIRECTORY})
endif()
endif()
endif()
diff --git a/config/lt_vers.am b/config/lt_vers.am index ac9150e..f9e6f77 100644 --- a/config/lt_vers.am +++ b/config/lt_vers.am @@ -19,7 +19,7 @@ # After making changes, run bin/reconfigure to update other configure related # files like Makefile.in. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 211 +LT_VERS_REVISION = 212 LT_VERS_AGE = 0 ## If the API changes *at all*, increment LT_VERS_INTERFACE and @@ -1,7 +1,7 @@ #! /bin/sh # From configure.ac Id: configure.ac 22697 2012-08-19 14:35:47Z hdftest . # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for HDF5 1.9.221. +# Generated by GNU Autoconf 2.69 for HDF5 1.9.222. # # Report bugs to <help@hdfgroup.org>. # @@ -591,8 +591,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='HDF5' PACKAGE_TARNAME='hdf5' -PACKAGE_VERSION='1.9.221' -PACKAGE_STRING='HDF5 1.9.221' +PACKAGE_VERSION='1.9.222' +PACKAGE_STRING='HDF5 1.9.222' PACKAGE_BUGREPORT='help@hdfgroup.org' PACKAGE_URL='' @@ -1474,7 +1474,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures HDF5 1.9.221 to adapt to many kinds of systems. +\`configure' configures HDF5 1.9.222 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1544,7 +1544,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of HDF5 1.9.221:";; + short | recursive ) echo "Configuration of HDF5 1.9.222:";; esac cat <<\_ACEOF @@ -1731,7 +1731,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -HDF5 configure 1.9.221 +HDF5 configure 1.9.222 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2662,7 +2662,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by HDF5 $as_me 1.9.221, which was +It was created by HDF5 $as_me 1.9.222, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -3533,7 +3533,7 @@ fi # Define the identity of the package. PACKAGE='hdf5' - VERSION='1.9.221' + VERSION='1.9.222' cat >>confdefs.h <<_ACEOF @@ -29166,7 +29166,7 @@ Usage: $0 [OPTIONS] Report bugs to <bug-libtool@gnu.org>." lt_cl_version="\ -HDF5 config.lt 1.9.221 +HDF5 config.lt 1.9.222 configured by $0, generated by GNU Autoconf 2.69. Copyright (C) 2011 Free Software Foundation, Inc. @@ -31262,7 +31262,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by HDF5 $as_me 1.9.221, which was +This file was extended by HDF5 $as_me 1.9.222, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -31328,7 +31328,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -HDF5 config.status 1.9.221 +HDF5 config.status 1.9.222 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/configure.ac b/configure.ac index 20eb696..96c43f9 100644 --- a/configure.ac +++ b/configure.ac @@ -26,7 +26,7 @@ AC_PREREQ([2.69]) ## NOTE: Do not forget to change the version number here when we do a ## release!!! ## -AC_INIT([HDF5], [1.9.221], [help@hdfgroup.org]) +AC_INIT([HDF5], [1.9.222], [help@hdfgroup.org]) AC_CONFIG_SRCDIR([src/H5.c]) AC_CONFIG_HEADER([src/H5config.h]) diff --git a/fortran/src/Makefile.in b/fortran/src/Makefile.in index eac35d6..16be9d1 100644 --- a/fortran/src/Makefile.in +++ b/fortran/src/Makefile.in @@ -722,7 +722,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog *.clog2 # After making changes, run bin/reconfigure to update other configure related # files like Makefile.in. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 211 +LT_VERS_REVISION = 212 LT_VERS_AGE = 0 AM_FCLIBS = $(LIBHDF5) diff --git a/hl/c++/src/Makefile.in b/hl/c++/src/Makefile.in index 171964a..1771c8b 100644 --- a/hl/c++/src/Makefile.in +++ b/hl/c++/src/Makefile.in @@ -676,7 +676,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog *.clog2 # After making changes, run bin/reconfigure to update other configure related # files like Makefile.in. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 211 +LT_VERS_REVISION = 212 LT_VERS_AGE = 0 # This is our main target diff --git a/hl/fortran/src/Makefile.in b/hl/fortran/src/Makefile.in index 5882ada..4f8052d 100644 --- a/hl/fortran/src/Makefile.in +++ b/hl/fortran/src/Makefile.in @@ -697,7 +697,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog *.clog2 # After making changes, run bin/reconfigure to update other configure related # files like Makefile.in. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 211 +LT_VERS_REVISION = 212 LT_VERS_AGE = 0 # Our main target, the high-level fortran library diff --git a/hl/src/Makefile.in b/hl/src/Makefile.in index 7b52771..47f32c8 100644 --- a/hl/src/Makefile.in +++ b/hl/src/Makefile.in @@ -675,7 +675,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog *.clog2 # After making changes, run bin/reconfigure to update other configure related # files like Makefile.in. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 211 +LT_VERS_REVISION = 212 LT_VERS_AGE = 0 # This library is our main target. diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index df1117b..18b800e 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -1,4 +1,4 @@ -HDF5 version 1.9.221 currently under development +HDF5 version 1.9.222 currently under development ================================================================================ @@ -115,26 +115,27 @@ H5_init_library(void) #ifdef H5_HAVE_PARALLEL { int mpi_initialized; + int mpi_finalized; int mpi_code; MPI_Initialized(&mpi_initialized); + MPI_Finalized(&mpi_finalized); #ifdef H5_HAVE_MPE /* Initialize MPE instrumentation library. */ - if (!H5_MPEinit_g) - { - int mpe_code; - if (mpi_initialized){ - mpe_code = MPE_Init_log(); - HDassert(mpe_code >=0); - H5_MPEinit_g = TRUE; - } + if (!H5_MPEinit_g) { + int mpe_code; + if (mpi_initialized && !mpi_finalized) { + mpe_code = MPE_Init_log(); + HDassert(mpe_code >=0); + H5_MPEinit_g = TRUE; } + } #endif /*H5_HAVE_MPE*/ /* add an attribute on MPI_COMM_SELF to call H5_term_library when it is destroyed, i.e. on MPI_Finalize */ - if (mpi_initialized) { + if (mpi_initialized && !mpi_finalized) { int key_val; if(MPI_SUCCESS != (mpi_code = MPI_Comm_create_keyval(MPI_NULL_COPY_FN, @@ -334,11 +335,14 @@ H5_term_library(void) * down if any of the below code involves using the instrumentation code. */ if(H5_MPEinit_g) { - int mpe_code; int mpi_initialized; + int mpi_finalized; + int mpe_code; MPI_Initialized(&mpi_initialized); - if(mpi_initialized) { + MPI_Finalized(&mpi_finalized); + + if (mpi_initialized && !mpi_finalized) { mpe_code = MPE_Finish_log("h5log"); HDassert(mpe_code >=0); } /* end if */ @@ -1002,7 +1002,7 @@ H5AC_mark_entry_dirty(void *thing) * is really necessary in the trace file. Write the result to catch * occult errors. */ - if((H5C_get_trace_file_ptr_from_entry(thing, &trace_file_ptr) >= 0) && + if((H5C_get_trace_file_ptr_from_entry((const H5C_cache_entry_t *) thing, &trace_file_ptr) >= 0) && (NULL != trace_file_ptr)) sprintf(trace, "%s 0x%lx", FUNC, (unsigned long)(((H5C_cache_entry_t *)thing)->addr)); @@ -1150,7 +1150,7 @@ H5AC_pin_protected_entry(void *thing) /* For the pin protected entry call, only the addr is really necessary * in the trace file. Also write the result to catch occult errors. */ - if((H5C_get_trace_file_ptr_from_entry(thing, &trace_file_ptr) >= 0) && + if((H5C_get_trace_file_ptr_from_entry((const H5C_cache_entry_t *)thing, &trace_file_ptr) >= 0) && (NULL != trace_file_ptr)) sprintf(trace, "%s 0x%lx", FUNC, (unsigned long)(((H5C_cache_entry_t *)thing)->addr)); @@ -1198,7 +1198,7 @@ H5AC_create_flush_dependency(void * parent_thing, void * child_thing) HDassert(child_thing); #if H5AC__TRACE_FILE_ENABLED - if((H5C_get_trace_file_ptr_from_entry(parent_thing, &trace_file_ptr) >= 0) && + if((H5C_get_trace_file_ptr_from_entry((H5C_cache_entry_t *)parent_thing, &trace_file_ptr) >= 0) && (NULL != trace_file_ptr)) sprintf(trace, "%s %lx %lx", FUNC, @@ -1309,10 +1309,8 @@ H5AC_protect(H5F_t *f, } #endif /* H5AC__TRACE_FILE_ENABLED */ - if ( rw == H5AC_READ ) { - + if ( rw == H5AC_READ ) protect_flags |= H5C__READ_ONLY_FLAG; - } thing = H5C_protect(f, dxpl_id, @@ -1385,7 +1383,7 @@ H5AC_resize_entry(void *thing, size_t new_size) * really necessary in the trace file. Write the result to catch * occult errors. */ - if((H5C_get_trace_file_ptr_from_entry(thing, &trace_file_ptr) >= 0) && + if((H5C_get_trace_file_ptr_from_entry((H5C_cache_entry_t *)thing, &trace_file_ptr) >= 0) && (NULL != trace_file_ptr)) sprintf(trace, "%s 0x%lx %d", FUNC, (unsigned long)(((H5C_cache_entry_t *)thing)->addr), @@ -1451,7 +1449,7 @@ H5AC_unpin_entry(void *thing) /* For the unpin entry call, only the addr is really necessary * in the trace file. Also write the result to catch occult errors. */ - if((H5C_get_trace_file_ptr_from_entry(thing, &trace_file_ptr) >= 0) && + if((H5C_get_trace_file_ptr_from_entry((H5C_cache_entry_t *)thing, &trace_file_ptr) >= 0) && (NULL != trace_file_ptr)) sprintf(trace, "%s 0x%lx", FUNC, (unsigned long)(((H5C_cache_entry_t *)thing)->addr)); @@ -1498,8 +1496,8 @@ H5AC_destroy_flush_dependency(void * parent_thing, void * child_thing) HDassert(child_thing); #if H5AC__TRACE_FILE_ENABLED - if((H5C_get_trace_file_ptr_from_entry(parent_thing, &trace_file_ptr) >= 0) && - (NULL != trace_file_ptr)) + if((H5C_get_trace_file_ptr_from_entry((H5C_cache_entry_t *)parent_thing, &trace_file_ptr) >= 0) && + (NULL != trace_file_ptr)) sprintf(trace, "%s %llx %llx", FUNC, (unsigned long long)(((H5C_cache_entry_t *)parent_thing)->addr), @@ -1648,7 +1646,7 @@ H5AC_unprotect(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, done: #if H5AC__TRACE_FILE_ENABLED if(trace_file_ptr != NULL) - HDfprintf(trace_file_ptr, "%s %x %d\n", + HDfprintf(trace_file_ptr, "%s 0x%x %d\n", trace, (unsigned)flags, (int)ret_value); #endif /* H5AC__TRACE_FILE_ENABLED */ @@ -2154,7 +2152,7 @@ done: ( trace_file_ptr != NULL ) ) { HDfprintf(trace_file_ptr, - "%s %d %d %d %d \"%s\" %d %d %d %f %d %d %ld %d %f %f %d %f %f %d %d %d %f %f %d %d %d %d %f %d %d %d\n", + "%s %d %d %d %d \"%s\" %d %d %d %f %d %d %ld %d %f %f %d %f %f %d %d %d %f %f %d %d %d %d %f %zu %d %d\n", "H5AC_set_cache_auto_resize_config", trace_config.version, (int)(trace_config.rpt_fcn_enabled), @@ -2450,7 +2448,7 @@ H5AC_open_trace_file(H5AC_t * cache_ptr, HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "trace file open failed.") } - HDfprintf(file_ptr, "### HDF5 metadata cache trace file ###\n"); + HDfprintf(file_ptr, "### HDF5 metadata cache trace file version 1 ###\n"); if ( H5C_set_trace_file_ptr(cache_ptr, file_ptr) < 0 ) { @@ -5002,15 +5000,15 @@ H5AC_run_sync_point(H5F_t *f, #if H5AC_DEBUG_DIRTY_BYTES_CREATION HDfprintf(stdout, - "%d:H5AC_propagate...:%d: (u/uu/i/iu/r/ru) = %d/%d/%d/%d/%d/%d\n", - (int)(aux_ptr->mpi_rank), - (int)(aux_ptr->dirty_bytes_propagations), - (int)(aux_ptr->unprotect_dirty_bytes), - (int)(aux_ptr->unprotect_dirty_bytes_updates), - (int)(aux_ptr->insert_dirty_bytes), - (int)(aux_ptr->insert_dirty_bytes_updates), - (int)(aux_ptr->rename_dirty_bytes), - (int)(aux_ptr->rename_dirty_bytes_updates)); + "%d:H5AC_propagate...:%u: (u/uu/i/iu/r/ru) = %zu/%u/%zu/%u/%zu/%u\n", + aux_ptr->mpi_rank, + aux_ptr->dirty_bytes_propagations, + aux_ptr->unprotect_dirty_bytes, + aux_ptr->unprotect_dirty_bytes_updates, + aux_ptr->insert_dirty_bytes, + aux_ptr->insert_dirty_bytes_updates, + aux_ptr->rename_dirty_bytes, + aux_ptr->rename_dirty_bytes_updates); #endif /* H5AC_DEBUG_DIRTY_BYTES_CREATION */ switch(aux_ptr->metadata_write_strategy) { diff --git a/src/H5ACpkg.h b/src/H5ACpkg.h index ad768ef..5b8ac86 100644 --- a/src/H5ACpkg.h +++ b/src/H5ACpkg.h @@ -64,10 +64,10 @@ *------------------------------------------------------------------------- */ -#define H5AC__MIN_DIRTY_BYTES_THRESHOLD (int32_t) \ +#define H5AC__MIN_DIRTY_BYTES_THRESHOLD (size_t) \ (H5C__MIN_MAX_CACHE_SIZE / 2) #define H5AC__DEFAULT_DIRTY_BYTES_THRESHOLD (256 * 1024) -#define H5AC__MAX_DIRTY_BYTES_THRESHOLD (int32_t) \ +#define H5AC__MAX_DIRTY_BYTES_THRESHOLD (size_t) \ (H5C__MAX_MAX_CACHE_SIZE / 4) @@ -142,6 +142,29 @@ * * JRM - 6/27/05 * + * Update: When the above was written, I planned to allow the process + * 0 metadata cache to write dirty metadata between sync points. + * However, testing indicated that this allowed occasional + * messages from the future to reach the caches on other processes. + * + * To resolve this, the code was altered to require that all metadata + * writes take place during sync points -- which solved the problem. + * Initially all writes were performed by the process 0 cache. This + * approach was later replaced with a distributed write approach + * in which each process writes a subset of the metadata to be + * written. + * + * After thinking on the matter for a while, I arrived at the + * conclusion that the process 0 cache could be allowed to write + * dirty metadata between sync points if it restricted itself to + * entries that had been dirty at the time of the previous sync point. + * + * To date, there has been no attempt to implement this optimization. + * However, should it be attempted, much of the supporting code + * should still be around. + * + * JRM -- 1/6/15 + * * magic: Unsigned 32 bit integer always set to * H5AC__H5AC_AUX_T_MAGIC. This field is used to validate * pointers to instances of H5AC_aux_t. @@ -180,6 +203,10 @@ * field exists to facilitate experiments with other * strategies. * + * At present, this field must be set to either + * H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY or + * H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED. + * * dirty_bytes_propagations: This field only exists when the * H5AC_DEBUG_DIRTY_BYTES_CREATION #define is TRUE. * @@ -344,24 +371,24 @@ typedef struct H5AC_aux_t hbool_t write_permitted; - int32_t dirty_bytes_threshold; + size_t dirty_bytes_threshold; - int32_t dirty_bytes; + size_t dirty_bytes; int32_t metadata_write_strategy; #if H5AC_DEBUG_DIRTY_BYTES_CREATION - int32_t dirty_bytes_propagations; + unsigned dirty_bytes_propagations; - int32_t unprotect_dirty_bytes; - int32_t unprotect_dirty_bytes_updates; + size_t unprotect_dirty_bytes; + unsigned unprotect_dirty_bytes_updates; - int32_t insert_dirty_bytes; - int32_t insert_dirty_bytes_updates; + size_t insert_dirty_bytes; + unsigned insert_dirty_bytes_updates; - int32_t move_dirty_bytes; - int32_t move_dirty_bytes_updates; + size_t move_dirty_bytes; + unsigned move_dirty_bytes_updates; #endif /* H5AC_DEBUG_DIRTY_BYTES_CREATION */ diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h index cf4c122..e259a24 100644 --- a/src/H5ACprivate.h +++ b/src/H5ACprivate.h @@ -255,7 +255,7 @@ H5_DLLVAR hid_t H5AC_ind_dxpl_id; /* int epochs_before_eviction = */ 3, \ /* hbool_t apply_empty_reserve = */ TRUE, \ /* double empty_reserve = */ 0.1f, \ - /* int dirty_bytes_threshold = */ (256 * 1024), \ + /* size_t dirty_bytes_threshold = */ (256 * 1024), \ /* int metadata_write_strategy = */ \ H5AC__DEFAULT_METADATA_WRITE_STRATEGY \ } @@ -291,7 +291,7 @@ H5_DLLVAR hid_t H5AC_ind_dxpl_id; /* int epochs_before_eviction = */ 3, \ /* hbool_t apply_empty_reserve = */ TRUE, \ /* double empty_reserve = */ 0.1f, \ - /* int dirty_bytes_threshold = */ (256 * 1024), \ + /* size_t dirty_bytes_threshold = */ (256 * 1024), \ /* int metadata_write_strategy = */ \ H5AC__DEFAULT_METADATA_WRITE_STRATEGY \ } diff --git a/src/H5ACpublic.h b/src/H5ACpublic.h index 639179c..598197f 100644 --- a/src/H5ACpublic.h +++ b/src/H5ACpublic.h @@ -496,7 +496,7 @@ typedef struct H5AC_cache_config_t /* parallel configuration fields: */ - int dirty_bytes_threshold; + size_t dirty_bytes_threshold; int metadata_write_strategy; } H5AC_cache_config_t; diff --git a/src/H5B2hdr.c b/src/H5B2hdr.c index 97b979e..d873cf6 100644 --- a/src/H5B2hdr.c +++ b/src/H5B2hdr.c @@ -256,7 +256,7 @@ H5B2__hdr_alloc(H5F_t *f) hdr->f = f; hdr->sizeof_addr = H5F_SIZEOF_ADDR(f); hdr->sizeof_size = H5F_SIZEOF_SIZE(f); - hdr->hdr_size = H5B2_HEADER_SIZE(hdr); + hdr->hdr_size = H5B2_HEADER_SIZE_HDR(hdr); hdr->root.addr = HADDR_UNDEF; /* Set return value */ diff --git a/src/H5B2pkg.h b/src/H5B2pkg.h index 72476eb..a2d32e6 100644 --- a/src/H5B2pkg.h +++ b/src/H5B2pkg.h @@ -45,10 +45,10 @@ /* Size of a "tree pointer" (on disk) */ /* (essentially, the largest internal pointer allowed) */ -#define H5B2_TREE_POINTER_SIZE(h) ( \ - (h)->sizeof_addr + \ +#define H5B2_TREE_POINTER_SIZE(sizeof_addr, sizeof_size) ( \ + (sizeof_addr) + \ H5B2_SIZEOF_RECORDS_PER_NODE + \ - (h)->sizeof_size \ + (sizeof_size) \ ) /* Size of a internal node pointer (on disk) */ @@ -70,7 +70,7 @@ ) /* Size of the v2 B-tree header on disk */ -#define H5B2_HEADER_SIZE(h) ( \ +#define H5B2_HEADER_SIZE(sizeof_addr, sizeof_size) ( \ /* General metadata fields */ \ H5B2_METADATA_PREFIX_SIZE \ \ @@ -80,7 +80,17 @@ + (unsigned)2 /* Depth of tree */ \ + (unsigned)1 /* Split % of full (as integer, ie. "98" means 98%) */ \ + (unsigned)1 /* Merge % of full (as integer, ie. "98" means 98%) */ \ - + H5B2_TREE_POINTER_SIZE(h) /* Node pointer to root node in tree */ \ + + H5B2_TREE_POINTER_SIZE(sizeof_addr, sizeof_size) /* Node pointer to root node in tree */ \ + ) + +/* Size of the v2 B-tree header on disk (via file pointer) */ +#define H5B2_HEADER_SIZE_FILE(f) ( \ + H5B2_HEADER_SIZE(H5F_SIZEOF_ADDR(f), H5F_SIZEOF_SIZE(f)) \ + ) + +/* Size of the v2 B-tree header on disk (via v2 B-tree header) */ +#define H5B2_HEADER_SIZE_HDR(h) ( \ + H5B2_HEADER_SIZE((h)->sizeof_addr, (h)->sizeof_size) \ ) /* Size of the v2 B-tree internal node prefix */ @@ -621,7 +621,7 @@ H5C_apply_candidate_list(H5F_t * f, (int)(cache_ptr->LRU_list_len)); #endif /* H5C_APPLY_CANDIDATE_LIST__DEBUG */ - /* ====================================================================== * + /* ===================================================================== * * Now scan the LRU and PEL lists, flushing or clearing entries as * needed. * @@ -632,7 +632,7 @@ H5C_apply_candidate_list(H5F_t * f, * to account for this one case where they come into play. If these flags * are ever expanded upon, this function and the following flushing steps * should be reworked to account for additional cases. - * ====================================================================== */ + * ===================================================================== */ entries_examined = 0; initial_list_len = cache_ptr->LRU_list_len; @@ -1612,9 +1612,7 @@ H5C_expunge_entry(H5F_t * f, HDassert(f); HDassert(f->shared); - cache_ptr = f->shared->cache; - HDassert(cache_ptr); HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); HDassert(type); @@ -2394,7 +2392,7 @@ H5C_get_cache_hit_rate(H5C_t * cache_ptr, double * hit_rate_ptr) FUNC_ENTER_NOAPI(FAIL) - if((cache_ptr == NULL ) || (cache_ptr->magic != H5C__H5C_T_MAGIC)) + if((cache_ptr == NULL) || (cache_ptr->magic != H5C__H5C_T_MAGIC)) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad cache_ptr on entry.") if(hit_rate_ptr == NULL) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad hit_rate_ptr on entry.") @@ -2733,7 +2731,7 @@ H5C_insert_entry(H5F_t * f, entry_ptr->cache_ptr = cache_ptr; entry_ptr->addr = addr; entry_ptr->type = type; - + /* Apply tag to newly inserted entry */ if(H5C_tag_entry(cache_ptr, entry_ptr, primary_dxpl_id) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, "Cannot tag metadata entry") @@ -3469,7 +3467,7 @@ H5C_move_entry(H5C_t * cache_ptr, #endif /* H5C_DO_SANITY_CHECKS */ H5C__UPDATE_RP_FOR_MOVE(cache_ptr, entry_ptr, was_dirty, FAIL) - } + } } H5C__UPDATE_STATS_FOR_MOVE(cache_ptr, entry_ptr) @@ -4729,11 +4727,9 @@ H5C_stats(H5C_t * cache_ptr, total_clears += cache_ptr->clears[i]; total_flushes += cache_ptr->flushes[i]; total_evictions += cache_ptr->evictions[i]; - total_moves += cache_ptr->moves[i]; - total_entry_flush_moves - += cache_ptr->entry_flush_moves[i]; - total_cache_flush_moves - += cache_ptr->cache_flush_moves[i]; + total_moves += cache_ptr->moves[i]; + total_entry_flush_moves += cache_ptr->entry_flush_moves[i]; + total_cache_flush_moves += cache_ptr->cache_flush_moves[i]; total_size_increases += cache_ptr->size_increases[i]; total_size_decreases += cache_ptr->size_decreases[i]; total_entry_flush_size_changes @@ -4889,14 +4885,14 @@ H5C_stats(H5C_t * cache_ptr, (long)total_evictions); HDfprintf(stdout, - "%s Total insertions(pinned) / moves = %ld(%ld) / %ld\n", + "%s Total insertions(pinned) / moves = %ld(%ld) / %ld\n", cache_ptr->prefix, (long)total_insertions, (long)total_pinned_insertions, (long)total_moves); HDfprintf(stdout, - "%s Total entry / cache flush moves = %ld / %ld\n", + "%s Total entry / cache flush moves = %ld / %ld\n", cache_ptr->prefix, (long)total_entry_flush_moves, (long)total_cache_flush_moves); @@ -5018,14 +5014,14 @@ H5C_stats(H5C_t * cache_ptr, (long)(cache_ptr->evictions[i])); HDfprintf(stdout, - "%s insertions(pinned) / moves = %ld(%ld) / %ld\n", + "%s insertions(pinned) / moves = %ld(%ld) / %ld\n", cache_ptr->prefix, (long)(cache_ptr->insertions[i]), (long)(cache_ptr->pinned_insertions[i]), (long)(cache_ptr->moves[i])); HDfprintf(stdout, - "%s entry / cache flush moves = %ld / %ld\n", + "%s entry / cache flush moves = %ld / %ld\n", cache_ptr->prefix, (long)(cache_ptr->entry_flush_moves[i]), (long)(cache_ptr->cache_flush_moves[i])); @@ -5050,7 +5046,7 @@ H5C_stats(H5C_t * cache_ptr, (long)(cache_ptr->unpins[i])); HDfprintf(stdout, - "%s entry dirty pins/pin'd flushes = %ld / %ld\n", + "%s entry dirty pins/pin'd flushes = %ld / %ld\n", cache_ptr->prefix, (long)(cache_ptr->dirty_pins[i]), (long)(cache_ptr->pinned_flushes[i])); @@ -5144,8 +5140,8 @@ H5C_stats__reset(H5C_t H5_ATTR_UNUSED * cache_ptr) cache_ptr->flushes[i] = 0; cache_ptr->evictions[i] = 0; cache_ptr->moves[i] = 0; - cache_ptr->entry_flush_moves[i] = 0; - cache_ptr->cache_flush_moves[i] = 0; + cache_ptr->entry_flush_moves[i] = 0; + cache_ptr->cache_flush_moves[i] = 0; cache_ptr->pins[i] = 0; cache_ptr->unpins[i] = 0; cache_ptr->dirty_pins[i] = 0; @@ -8943,7 +8939,6 @@ H5C_make_space_in_cache(H5F_t * f, total_entries_scanned++; #endif /* H5C_COLLECT_CACHE_STATS */ - } else { /* Skip epoch markers. Set result to SUCCEED to avoid diff --git a/src/H5Cpkg.h b/src/H5Cpkg.h index ae6bdad..7c278e8 100644 --- a/src/H5Cpkg.h +++ b/src/H5Cpkg.h @@ -530,7 +530,7 @@ * * cache_full: Boolean flag used to keep track of whether the cache is * full, so we can refrain from increasing the size of a - * cache which hasn't used up the space alotted to it. + * cache which hasn't used up the space allotted to it. * * The field is initialized to FALSE, and then set to TRUE * whenever we attempt to make space in the cache. @@ -542,7 +542,7 @@ * resize_enabled = size_increase_possible || * size_decrease_possible; * - * size_decreased: Boolean flag set to TRUE whenever the maximun cache + * size_decreased: Boolean flag set to TRUE whenever the maximum cache * size is decreased. The flag triggers a call to * H5C_make_space_in_cache() on the next call to H5C_protect(). * @@ -667,7 +667,7 @@ * pinned into the cache in the current epoch. * * clears: Array of int64 of length H5C__MAX_NUM_TYPE_IDS + 1. The cells - * are used to record the number of times an entry with type + * are used to record the number of times a dirty entry with type * id equal to the array index has been cleared in the current * epoch. * @@ -1217,78 +1217,78 @@ if ( ( (new_size) > (dll_size) ) || \ #define H5C__DLL_APPEND(entry_ptr, head_ptr, tail_ptr, len, Size, fail_val) \ - H5C__DLL_PRE_INSERT_SC(entry_ptr, head_ptr, tail_ptr, len, Size, \ - fail_val) \ - if ( (head_ptr) == NULL ) \ - { \ - (head_ptr) = (entry_ptr); \ - (tail_ptr) = (entry_ptr); \ - } \ - else \ - { \ - (tail_ptr)->next = (entry_ptr); \ - (entry_ptr)->prev = (tail_ptr); \ - (tail_ptr) = (entry_ptr); \ - } \ - (len)++; \ - (Size) += (entry_ptr)->size; +{ \ + H5C__DLL_PRE_INSERT_SC(entry_ptr, head_ptr, tail_ptr, len, Size, \ + fail_val) \ + if ( (head_ptr) == NULL ) \ + { \ + (head_ptr) = (entry_ptr); \ + (tail_ptr) = (entry_ptr); \ + } \ + else \ + { \ + (tail_ptr)->next = (entry_ptr); \ + (entry_ptr)->prev = (tail_ptr); \ + (tail_ptr) = (entry_ptr); \ + } \ + (len)++; \ + (Size) += (entry_ptr)->size; \ +} /* H5C__DLL_APPEND() */ #define H5C__DLL_PREPEND(entry_ptr, head_ptr, tail_ptr, len, Size, fail_val) \ - H5C__DLL_PRE_INSERT_SC(entry_ptr, head_ptr, tail_ptr, len, Size, \ - fail_val) \ - if ( (head_ptr) == NULL ) \ - { \ - (head_ptr) = (entry_ptr); \ - (tail_ptr) = (entry_ptr); \ - } \ - else \ - { \ - (head_ptr)->prev = (entry_ptr); \ - (entry_ptr)->next = (head_ptr); \ - (head_ptr) = (entry_ptr); \ - } \ - (len)++; \ - (Size) += entry_ptr->size; +{ \ + H5C__DLL_PRE_INSERT_SC(entry_ptr, head_ptr, tail_ptr, len, Size, \ + fail_val) \ + if ( (head_ptr) == NULL ) \ + { \ + (head_ptr) = (entry_ptr); \ + (tail_ptr) = (entry_ptr); \ + } \ + else \ + { \ + (head_ptr)->prev = (entry_ptr); \ + (entry_ptr)->next = (head_ptr); \ + (head_ptr) = (entry_ptr); \ + } \ + (len)++; \ + (Size) += entry_ptr->size; \ +} /* H5C__DLL_PREPEND() */ #define H5C__DLL_REMOVE(entry_ptr, head_ptr, tail_ptr, len, Size, fail_val) \ - H5C__DLL_PRE_REMOVE_SC(entry_ptr, head_ptr, tail_ptr, len, Size, \ - fail_val) \ - { \ - if ( (head_ptr) == (entry_ptr) ) \ - { \ - (head_ptr) = (entry_ptr)->next; \ - if ( (head_ptr) != NULL ) \ - { \ - (head_ptr)->prev = NULL; \ - } \ - } \ - else \ - { \ - (entry_ptr)->prev->next = (entry_ptr)->next; \ - } \ - if ( (tail_ptr) == (entry_ptr) ) \ - { \ - (tail_ptr) = (entry_ptr)->prev; \ - if ( (tail_ptr) != NULL ) \ - { \ - (tail_ptr)->next = NULL; \ - } \ - } \ - else \ - { \ - (entry_ptr)->next->prev = (entry_ptr)->prev; \ - } \ - entry_ptr->next = NULL; \ - entry_ptr->prev = NULL; \ - (len)--; \ - (Size) -= entry_ptr->size; \ - } +{ \ + H5C__DLL_PRE_REMOVE_SC(entry_ptr, head_ptr, tail_ptr, len, Size, \ + fail_val) \ + { \ + if ( (head_ptr) == (entry_ptr) ) \ + { \ + (head_ptr) = (entry_ptr)->next; \ + if ( (head_ptr) != NULL ) \ + (head_ptr)->prev = NULL; \ + } \ + else \ + (entry_ptr)->prev->next = (entry_ptr)->next; \ + if ( (tail_ptr) == (entry_ptr) ) \ + { \ + (tail_ptr) = (entry_ptr)->prev; \ + if ( (tail_ptr) != NULL ) \ + (tail_ptr)->next = NULL; \ + } \ + else \ + (entry_ptr)->next->prev = (entry_ptr)->prev; \ + entry_ptr->next = NULL; \ + entry_ptr->prev = NULL; \ + (len)--; \ + (Size) -= entry_ptr->size; \ + } \ +} /* H5C__DLL_REMOVE() */ #define H5C__DLL_UPDATE_FOR_SIZE_CHANGE(dll_len, dll_size, old_size, new_size) \ - H5C__DLL_PRE_SIZE_UPDATE_SC(dll_len, dll_size, old_size, new_size) \ - (dll_size) -= (old_size); \ - (dll_size) += (new_size); \ - H5C__DLL_POST_SIZE_UPDATE_SC(dll_len, dll_size, old_size, new_size) +{ \ + H5C__DLL_PRE_SIZE_UPDATE_SC(dll_len, dll_size, old_size, new_size) \ + (dll_size) -= (old_size); \ + (dll_size) += (new_size); \ + H5C__DLL_POST_SIZE_UPDATE_SC(dll_len, dll_size, old_size, new_size) \ +} /* H5C__DLL_UPDATE_FOR_SIZE_CHANGE() */ #if H5C_DO_SANITY_CHECKS @@ -1365,72 +1365,68 @@ if ( ( (entry_ptr) == NULL ) || \ #define H5C__AUX_DLL_APPEND(entry_ptr, head_ptr, tail_ptr, len, Size, fail_val)\ - H5C__AUX_DLL_PRE_INSERT_SC(entry_ptr, head_ptr, tail_ptr, len, Size, \ - fail_val) \ - if ( (head_ptr) == NULL ) \ - { \ - (head_ptr) = (entry_ptr); \ - (tail_ptr) = (entry_ptr); \ - } \ - else \ - { \ - (tail_ptr)->aux_next = (entry_ptr); \ - (entry_ptr)->aux_prev = (tail_ptr); \ - (tail_ptr) = (entry_ptr); \ - } \ - (len)++; \ - (Size) += entry_ptr->size; +{ \ + H5C__AUX_DLL_PRE_INSERT_SC(entry_ptr, head_ptr, tail_ptr, len, Size, \ + fail_val) \ + if ( (head_ptr) == NULL ) \ + { \ + (head_ptr) = (entry_ptr); \ + (tail_ptr) = (entry_ptr); \ + } \ + else \ + { \ + (tail_ptr)->aux_next = (entry_ptr); \ + (entry_ptr)->aux_prev = (tail_ptr); \ + (tail_ptr) = (entry_ptr); \ + } \ + (len)++; \ + (Size) += entry_ptr->size; \ +} /* H5C__AUX_DLL_APPEND() */ #define H5C__AUX_DLL_PREPEND(entry_ptr, head_ptr, tail_ptr, len, Size, fv) \ - H5C__AUX_DLL_PRE_INSERT_SC(entry_ptr, head_ptr, tail_ptr, len, Size, \ - fv) \ - if ( (head_ptr) == NULL ) \ - { \ - (head_ptr) = (entry_ptr); \ - (tail_ptr) = (entry_ptr); \ - } \ - else \ - { \ - (head_ptr)->aux_prev = (entry_ptr); \ - (entry_ptr)->aux_next = (head_ptr); \ - (head_ptr) = (entry_ptr); \ - } \ - (len)++; \ - (Size) += entry_ptr->size; +{ \ + H5C__AUX_DLL_PRE_INSERT_SC(entry_ptr, head_ptr, tail_ptr, len, Size, fv) \ + if ( (head_ptr) == NULL ) \ + { \ + (head_ptr) = (entry_ptr); \ + (tail_ptr) = (entry_ptr); \ + } \ + else \ + { \ + (head_ptr)->aux_prev = (entry_ptr); \ + (entry_ptr)->aux_next = (head_ptr); \ + (head_ptr) = (entry_ptr); \ + } \ + (len)++; \ + (Size) += entry_ptr->size; \ +} /* H5C__AUX_DLL_PREPEND() */ #define H5C__AUX_DLL_REMOVE(entry_ptr, head_ptr, tail_ptr, len, Size, fv) \ - H5C__AUX_DLL_PRE_REMOVE_SC(entry_ptr, head_ptr, tail_ptr, len, Size, \ - fv) \ - { \ - if ( (head_ptr) == (entry_ptr) ) \ - { \ - (head_ptr) = (entry_ptr)->aux_next; \ - if ( (head_ptr) != NULL ) \ - { \ - (head_ptr)->aux_prev = NULL; \ - } \ - } \ - else \ - { \ - (entry_ptr)->aux_prev->aux_next = (entry_ptr)->aux_next; \ - } \ - if ( (tail_ptr) == (entry_ptr) ) \ - { \ - (tail_ptr) = (entry_ptr)->aux_prev; \ - if ( (tail_ptr) != NULL ) \ - { \ - (tail_ptr)->aux_next = NULL; \ - } \ - } \ - else \ - { \ - (entry_ptr)->aux_next->aux_prev = (entry_ptr)->aux_prev; \ - } \ - entry_ptr->aux_next = NULL; \ - entry_ptr->aux_prev = NULL; \ - (len)--; \ - (Size) -= entry_ptr->size; \ - } +{ \ + H5C__AUX_DLL_PRE_REMOVE_SC(entry_ptr, head_ptr, tail_ptr, len, Size, fv) \ + { \ + if ( (head_ptr) == (entry_ptr) ) \ + { \ + (head_ptr) = (entry_ptr)->aux_next; \ + if ( (head_ptr) != NULL ) \ + (head_ptr)->aux_prev = NULL; \ + } \ + else \ + (entry_ptr)->aux_prev->aux_next = (entry_ptr)->aux_next; \ + if ( (tail_ptr) == (entry_ptr) ) \ + { \ + (tail_ptr) = (entry_ptr)->aux_prev; \ + if ( (tail_ptr) != NULL ) \ + (tail_ptr)->aux_next = NULL; \ + } \ + else \ + (entry_ptr)->aux_next->aux_prev = (entry_ptr)->aux_prev; \ + entry_ptr->aux_next = NULL; \ + entry_ptr->aux_prev = NULL; \ + (len)--; \ + (Size) -= entry_ptr->size; \ + } \ +} /* H5C__AUX_DLL_REMOVE() */ /*********************************************************************** @@ -1544,185 +1540,195 @@ if ( ( (entry_ptr) == NULL ) || \ #if H5C_COLLECT_CACHE_ENTRY_STATS #define H5C__RESET_CACHE_ENTRY_STATS(entry_ptr) \ - (entry_ptr)->accesses = 0; \ - (entry_ptr)->clears = 0; \ - (entry_ptr)->flushes = 0; \ - (entry_ptr)->pins = 0; - -#define H5C__UPDATE_STATS_FOR_CLEAR(cache_ptr, entry_ptr) \ - (((cache_ptr)->clears)[(entry_ptr)->type->id])++; \ - if ( (entry_ptr)->is_pinned ) { \ - (((cache_ptr)->pinned_clears)[(entry_ptr)->type->id])++; \ - } \ - ((entry_ptr)->clears)++; - -#define H5C__UPDATE_STATS_FOR_FLUSH(cache_ptr, entry_ptr) \ - (((cache_ptr)->flushes)[(entry_ptr)->type->id])++; \ - if ( (entry_ptr)->is_pinned ) { \ - (((cache_ptr)->pinned_flushes)[(entry_ptr)->type->id])++; \ - } \ - ((entry_ptr)->flushes)++; - -#define H5C__UPDATE_STATS_FOR_EVICTION(cache_ptr, entry_ptr) \ - (((cache_ptr)->evictions)[(entry_ptr)->type->id])++; \ - if ( (entry_ptr)->accesses > \ - ((cache_ptr)->max_accesses)[(entry_ptr)->type->id] ) { \ - ((cache_ptr)->max_accesses)[(entry_ptr)->type->id] \ - = (entry_ptr)->accesses; \ - } \ - if ( (entry_ptr)->accesses < \ - ((cache_ptr)->min_accesses)[(entry_ptr)->type->id] ) { \ - ((cache_ptr)->min_accesses)[(entry_ptr)->type->id] \ - = (entry_ptr)->accesses; \ - } \ - if ( (entry_ptr)->clears > \ - ((cache_ptr)->max_clears)[(entry_ptr)->type->id] ) { \ - ((cache_ptr)->max_clears)[(entry_ptr)->type->id] \ - = (entry_ptr)->clears; \ - } \ - if ( (entry_ptr)->flushes > \ - ((cache_ptr)->max_flushes)[(entry_ptr)->type->id] ) { \ - ((cache_ptr)->max_flushes)[(entry_ptr)->type->id] \ - = (entry_ptr)->flushes; \ - } \ - if ( (entry_ptr)->size > \ - ((cache_ptr)->max_size)[(entry_ptr)->type->id] ) { \ - ((cache_ptr)->max_size)[(entry_ptr)->type->id] \ - = (entry_ptr)->size; \ - } \ - if ( (entry_ptr)->pins > \ - ((cache_ptr)->max_pins)[(entry_ptr)->type->id] ) { \ - ((cache_ptr)->max_pins)[(entry_ptr)->type->id] \ - = (entry_ptr)->pins; \ - } - -#define H5C__UPDATE_STATS_FOR_INSERTION(cache_ptr, entry_ptr) \ - (((cache_ptr)->insertions)[(entry_ptr)->type->id])++; \ - if ( (entry_ptr)->is_pinned ) { \ - (((cache_ptr)->pinned_insertions)[(entry_ptr)->type->id])++; \ - ((cache_ptr)->pins)[(entry_ptr)->type->id]++; \ - (entry_ptr)->pins++; \ - if ( (cache_ptr)->pel_len > (cache_ptr)->max_pel_len ) \ - (cache_ptr)->max_pel_len = (cache_ptr)->pel_len; \ - if ( (cache_ptr)->pel_size > (cache_ptr)->max_pel_size ) \ - (cache_ptr)->max_pel_size = (cache_ptr)->pel_size; \ - } \ - if ( (cache_ptr)->index_len > (cache_ptr)->max_index_len ) \ - (cache_ptr)->max_index_len = (cache_ptr)->index_len; \ - H5C__UPDATE_MAX_INDEX_SIZE_STATS(cache_ptr) \ - if ( (cache_ptr)->slist_len > (cache_ptr)->max_slist_len ) \ - (cache_ptr)->max_slist_len = (cache_ptr)->slist_len; \ - if ( (cache_ptr)->slist_size > (cache_ptr)->max_slist_size ) \ - (cache_ptr)->max_slist_size = (cache_ptr)->slist_size; \ - if ( (entry_ptr)->size > \ - ((cache_ptr)->max_size)[(entry_ptr)->type->id] ) { \ - ((cache_ptr)->max_size)[(entry_ptr)->type->id] \ - = (entry_ptr)->size; \ - } - -#define H5C__UPDATE_STATS_FOR_PROTECT(cache_ptr, entry_ptr, hit) \ - if ( hit ) \ - ((cache_ptr)->hits)[(entry_ptr)->type->id]++; \ - else \ - ((cache_ptr)->misses)[(entry_ptr)->type->id]++; \ - if ( ! ((entry_ptr)->is_read_only) ) { \ - ((cache_ptr)->write_protects)[(entry_ptr)->type->id]++; \ - } else { \ - ((cache_ptr)->read_protects)[(entry_ptr)->type->id]++; \ - if ( ((entry_ptr)->ro_ref_count) > \ - ((cache_ptr)->max_read_protects)[(entry_ptr)->type->id] ) { \ - ((cache_ptr)->max_read_protects)[(entry_ptr)->type->id] = \ - ((entry_ptr)->ro_ref_count); \ - } \ - } \ - if ( (cache_ptr)->index_len > (cache_ptr)->max_index_len ) \ - (cache_ptr)->max_index_len = (cache_ptr)->index_len; \ - H5C__UPDATE_MAX_INDEX_SIZE_STATS(cache_ptr) \ - if ( (cache_ptr)->pl_len > (cache_ptr)->max_pl_len ) \ - (cache_ptr)->max_pl_len = (cache_ptr)->pl_len; \ - if ( (cache_ptr)->pl_size > (cache_ptr)->max_pl_size ) \ - (cache_ptr)->max_pl_size = (cache_ptr)->pl_size; \ - if ( (entry_ptr)->size > \ - ((cache_ptr)->max_size)[(entry_ptr)->type->id] ) { \ - ((cache_ptr)->max_size)[(entry_ptr)->type->id] \ - = (entry_ptr)->size; \ - } \ - ((entry_ptr)->accesses)++; - -#define H5C__UPDATE_STATS_FOR_PIN(cache_ptr, entry_ptr) \ - ((cache_ptr)->pins)[(entry_ptr)->type->id]++; \ - (entry_ptr)->pins++; \ - if ( (cache_ptr)->pel_len > (cache_ptr)->max_pel_len ) \ - (cache_ptr)->max_pel_len = (cache_ptr)->pel_len; \ - if ( (cache_ptr)->pel_size > (cache_ptr)->max_pel_size ) \ - (cache_ptr)->max_pel_size = (cache_ptr)->pel_size; +{ \ + (entry_ptr)->accesses = 0; \ + (entry_ptr)->clears = 0; \ + (entry_ptr)->flushes = 0; \ + (entry_ptr)->pins = 0; \ +} + +#define H5C__UPDATE_STATS_FOR_CLEAR(cache_ptr, entry_ptr) \ +{ \ + (((cache_ptr)->clears)[(entry_ptr)->type->id])++; \ + if ( (entry_ptr)->is_pinned ) \ + (((cache_ptr)->pinned_clears)[(entry_ptr)->type->id])++; \ + ((entry_ptr)->clears)++; \ +} + +#define H5C__UPDATE_STATS_FOR_FLUSH(cache_ptr, entry_ptr) \ +{ \ + (((cache_ptr)->flushes)[(entry_ptr)->type->id])++; \ + if ( (entry_ptr)->is_pinned ) \ + (((cache_ptr)->pinned_flushes)[(entry_ptr)->type->id])++; \ + ((entry_ptr)->flushes)++; \ +} + +#define H5C__UPDATE_STATS_FOR_EVICTION(cache_ptr, entry_ptr) \ +{ \ + (((cache_ptr)->evictions)[(entry_ptr)->type->id])++; \ + if ( (entry_ptr)->accesses > \ + ((cache_ptr)->max_accesses)[(entry_ptr)->type->id] ) \ + ((cache_ptr)->max_accesses)[(entry_ptr)->type->id] = \ + (entry_ptr)->accesses; \ + if ( (entry_ptr)->accesses < \ + ((cache_ptr)->min_accesses)[(entry_ptr)->type->id] ) \ + ((cache_ptr)->min_accesses)[(entry_ptr)->type->id] = \ + (entry_ptr)->accesses; \ + if ( (entry_ptr)->clears > \ + ((cache_ptr)->max_clears)[(entry_ptr)->type->id] ) \ + ((cache_ptr)->max_clears)[(entry_ptr)->type->id] \ + = (entry_ptr)->clears; \ + if ( (entry_ptr)->flushes > \ + ((cache_ptr)->max_flushes)[(entry_ptr)->type->id] ) \ + ((cache_ptr)->max_flushes)[(entry_ptr)->type->id] \ + = (entry_ptr)->flushes; \ + if ( (entry_ptr)->size > \ + ((cache_ptr)->max_size)[(entry_ptr)->type->id] ) \ + ((cache_ptr)->max_size)[(entry_ptr)->type->id] \ + = (entry_ptr)->size; \ + if ( (entry_ptr)->pins > \ + ((cache_ptr)->max_pins)[(entry_ptr)->type->id] ) \ + ((cache_ptr)->max_pins)[(entry_ptr)->type->id] \ + = (entry_ptr)->pins; \ +} + +#define H5C__UPDATE_STATS_FOR_INSERTION(cache_ptr, entry_ptr) \ +{ \ + (((cache_ptr)->insertions)[(entry_ptr)->type->id])++; \ + if ( (entry_ptr)->is_pinned ) { \ + (((cache_ptr)->pinned_insertions)[(entry_ptr)->type->id])++; \ + ((cache_ptr)->pins)[(entry_ptr)->type->id]++; \ + (entry_ptr)->pins++; \ + if ( (cache_ptr)->pel_len > (cache_ptr)->max_pel_len ) \ + (cache_ptr)->max_pel_len = (cache_ptr)->pel_len; \ + if ( (cache_ptr)->pel_size > (cache_ptr)->max_pel_size ) \ + (cache_ptr)->max_pel_size = (cache_ptr)->pel_size; \ + } \ + if ( (cache_ptr)->index_len > (cache_ptr)->max_index_len ) \ + (cache_ptr)->max_index_len = (cache_ptr)->index_len; \ + H5C__UPDATE_MAX_INDEX_SIZE_STATS(cache_ptr) \ + if ( (cache_ptr)->slist_len > (cache_ptr)->max_slist_len ) \ + (cache_ptr)->max_slist_len = (cache_ptr)->slist_len; \ + if ( (cache_ptr)->slist_size > (cache_ptr)->max_slist_size ) \ + (cache_ptr)->max_slist_size = (cache_ptr)->slist_size; \ + if ( (entry_ptr)->size > \ + ((cache_ptr)->max_size)[(entry_ptr)->type->id] ) \ + ((cache_ptr)->max_size)[(entry_ptr)->type->id] \ + = (entry_ptr)->size; \ + } \ +} + +#define H5C__UPDATE_STATS_FOR_PROTECT(cache_ptr, entry_ptr, hit) \ +{ \ + if ( hit ) \ + ((cache_ptr)->hits)[(entry_ptr)->type->id]++; \ + else \ + ((cache_ptr)->misses)[(entry_ptr)->type->id]++; \ + if ( ! ((entry_ptr)->is_read_only) ) { \ + ((cache_ptr)->write_protects)[(entry_ptr)->type->id]++; \ + } else { \ + ((cache_ptr)->read_protects)[(entry_ptr)->type->id]++; \ + if ( ((entry_ptr)->ro_ref_count) > \ + ((cache_ptr)->max_read_protects)[(entry_ptr)->type->id] ) \ + ((cache_ptr)->max_read_protects)[(entry_ptr)->type->id] = \ + ((entry_ptr)->ro_ref_count); \ + } \ + if ( (cache_ptr)->index_len > (cache_ptr)->max_index_len ) \ + (cache_ptr)->max_index_len = (cache_ptr)->index_len; \ + H5C__UPDATE_MAX_INDEX_SIZE_STATS(cache_ptr) \ + if ( (cache_ptr)->pl_len > (cache_ptr)->max_pl_len ) \ + (cache_ptr)->max_pl_len = (cache_ptr)->pl_len; \ + if ( (cache_ptr)->pl_size > (cache_ptr)->max_pl_size ) \ + (cache_ptr)->max_pl_size = (cache_ptr)->pl_size; \ + if ( (entry_ptr)->size > \ + ((cache_ptr)->max_size)[(entry_ptr)->type->id] ) \ + ((cache_ptr)->max_size)[(entry_ptr)->type->id] = (entry_ptr)->size; \ + ((entry_ptr)->accesses)++; \ +} + +#define H5C__UPDATE_STATS_FOR_PIN(cache_ptr, entry_ptr) \ +{ \ + ((cache_ptr)->pins)[(entry_ptr)->type->id]++; \ + (entry_ptr)->pins++; \ + if ( (cache_ptr)->pel_len > (cache_ptr)->max_pel_len ) \ + (cache_ptr)->max_pel_len = (cache_ptr)->pel_len; \ + if ( (cache_ptr)->pel_size > (cache_ptr)->max_pel_size ) \ + (cache_ptr)->max_pel_size = (cache_ptr)->pel_size; \ +} #else /* H5C_COLLECT_CACHE_ENTRY_STATS */ #define H5C__RESET_CACHE_ENTRY_STATS(entry_ptr) -#define H5C__UPDATE_STATS_FOR_CLEAR(cache_ptr, entry_ptr) \ - if ( (entry_ptr)->is_pinned ) { \ - (((cache_ptr)->pinned_clears)[(entry_ptr)->type->id])++; \ - } \ - (((cache_ptr)->clears)[(entry_ptr)->type->id])++; +#define H5C__UPDATE_STATS_FOR_CLEAR(cache_ptr, entry_ptr) \ +{ \ + if ( (entry_ptr)->is_pinned ) \ + (((cache_ptr)->pinned_clears)[(entry_ptr)->type->id])++; \ + (((cache_ptr)->clears)[(entry_ptr)->type->id])++; \ +} -#define H5C__UPDATE_STATS_FOR_FLUSH(cache_ptr, entry_ptr) \ - (((cache_ptr)->flushes)[(entry_ptr)->type->id])++; \ - if ( (entry_ptr)->is_pinned ) { \ - (((cache_ptr)->pinned_flushes)[(entry_ptr)->type->id])++; \ - } +#define H5C__UPDATE_STATS_FOR_FLUSH(cache_ptr, entry_ptr) \ +{ \ + (((cache_ptr)->flushes)[(entry_ptr)->type->id])++; \ + if ( (entry_ptr)->is_pinned ) \ + (((cache_ptr)->pinned_flushes)[(entry_ptr)->type->id])++; \ +} -#define H5C__UPDATE_STATS_FOR_EVICTION(cache_ptr, entry_ptr) \ - (((cache_ptr)->evictions)[(entry_ptr)->type->id])++; - -#define H5C__UPDATE_STATS_FOR_INSERTION(cache_ptr, entry_ptr) \ - (((cache_ptr)->insertions)[(entry_ptr)->type->id])++; \ - if ( (entry_ptr)->is_pinned ) { \ - (((cache_ptr)->pinned_insertions)[(entry_ptr)->type->id])++; \ - ((cache_ptr)->pins)[(entry_ptr)->type->id]++; \ - if ( (cache_ptr)->pel_len > (cache_ptr)->max_pel_len ) \ - (cache_ptr)->max_pel_len = (cache_ptr)->pel_len; \ - if ( (cache_ptr)->pel_size > (cache_ptr)->max_pel_size ) \ - (cache_ptr)->max_pel_size = (cache_ptr)->pel_size; \ - } \ - if ( (cache_ptr)->index_len > (cache_ptr)->max_index_len ) \ - (cache_ptr)->max_index_len = (cache_ptr)->index_len; \ - H5C__UPDATE_MAX_INDEX_SIZE_STATS(cache_ptr) \ - if ( (cache_ptr)->slist_len > (cache_ptr)->max_slist_len ) \ - (cache_ptr)->max_slist_len = (cache_ptr)->slist_len; \ - if ( (cache_ptr)->slist_size > (cache_ptr)->max_slist_size ) \ - (cache_ptr)->max_slist_size = (cache_ptr)->slist_size; - -#define H5C__UPDATE_STATS_FOR_PROTECT(cache_ptr, entry_ptr, hit) \ - if ( hit ) \ - ((cache_ptr)->hits)[(entry_ptr)->type->id]++; \ - else \ - ((cache_ptr)->misses)[(entry_ptr)->type->id]++; \ - if ( ! ((entry_ptr)->is_read_only) ) { \ - ((cache_ptr)->write_protects)[(entry_ptr)->type->id]++; \ - } else { \ - ((cache_ptr)->read_protects)[(entry_ptr)->type->id]++; \ - if ( ((entry_ptr)->ro_ref_count) > \ - ((cache_ptr)->max_read_protects)[(entry_ptr)->type->id] ) { \ - ((cache_ptr)->max_read_protects)[(entry_ptr)->type->id] = \ - ((entry_ptr)->ro_ref_count); \ - } \ - } \ - if ( (cache_ptr)->index_len > (cache_ptr)->max_index_len ) \ - (cache_ptr)->max_index_len = (cache_ptr)->index_len; \ - H5C__UPDATE_MAX_INDEX_SIZE_STATS(cache_ptr) \ - if ( (cache_ptr)->pl_len > (cache_ptr)->max_pl_len ) \ - (cache_ptr)->max_pl_len = (cache_ptr)->pl_len; \ - if ( (cache_ptr)->pl_size > (cache_ptr)->max_pl_size ) \ - (cache_ptr)->max_pl_size = (cache_ptr)->pl_size; - -#define H5C__UPDATE_STATS_FOR_PIN(cache_ptr, entry_ptr) \ - ((cache_ptr)->pins)[(entry_ptr)->type->id]++; \ - if ( (cache_ptr)->pel_len > (cache_ptr)->max_pel_len ) \ - (cache_ptr)->max_pel_len = (cache_ptr)->pel_len; \ - if ( (cache_ptr)->pel_size > (cache_ptr)->max_pel_size ) \ - (cache_ptr)->max_pel_size = (cache_ptr)->pel_size; +#define H5C__UPDATE_STATS_FOR_EVICTION(cache_ptr, entry_ptr) \ + (((cache_ptr)->evictions)[(entry_ptr)->type->id])++; + +#define H5C__UPDATE_STATS_FOR_INSERTION(cache_ptr, entry_ptr) \ +{ \ + (((cache_ptr)->insertions)[(entry_ptr)->type->id])++; \ + if ( (entry_ptr)->is_pinned ) { \ + (((cache_ptr)->pinned_insertions)[(entry_ptr)->type->id])++; \ + ((cache_ptr)->pins)[(entry_ptr)->type->id]++; \ + if ( (cache_ptr)->pel_len > (cache_ptr)->max_pel_len ) \ + (cache_ptr)->max_pel_len = (cache_ptr)->pel_len; \ + if ( (cache_ptr)->pel_size > (cache_ptr)->max_pel_size ) \ + (cache_ptr)->max_pel_size = (cache_ptr)->pel_size; \ + } \ + if ( (cache_ptr)->index_len > (cache_ptr)->max_index_len ) \ + (cache_ptr)->max_index_len = (cache_ptr)->index_len; \ + H5C__UPDATE_MAX_INDEX_SIZE_STATS(cache_ptr) \ + if ( (cache_ptr)->slist_len > (cache_ptr)->max_slist_len ) \ + (cache_ptr)->max_slist_len = (cache_ptr)->slist_len; \ + if ( (cache_ptr)->slist_size > (cache_ptr)->max_slist_size ) \ + (cache_ptr)->max_slist_size = (cache_ptr)->slist_size; \ +} + +#define H5C__UPDATE_STATS_FOR_PROTECT(cache_ptr, entry_ptr, hit) \ +{ \ + if ( hit ) \ + ((cache_ptr)->hits)[(entry_ptr)->type->id]++; \ + else \ + ((cache_ptr)->misses)[(entry_ptr)->type->id]++; \ + if ( ! ((entry_ptr)->is_read_only) ) \ + ((cache_ptr)->write_protects)[(entry_ptr)->type->id]++; \ + else { \ + ((cache_ptr)->read_protects)[(entry_ptr)->type->id]++; \ + if ( ((entry_ptr)->ro_ref_count) > \ + ((cache_ptr)->max_read_protects)[(entry_ptr)->type->id] ) \ + ((cache_ptr)->max_read_protects)[(entry_ptr)->type->id] = \ + ((entry_ptr)->ro_ref_count); \ + } \ + if ( (cache_ptr)->index_len > (cache_ptr)->max_index_len ) \ + (cache_ptr)->max_index_len = (cache_ptr)->index_len; \ + H5C__UPDATE_MAX_INDEX_SIZE_STATS(cache_ptr) \ + if ( (cache_ptr)->pl_len > (cache_ptr)->max_pl_len ) \ + (cache_ptr)->max_pl_len = (cache_ptr)->pl_len; \ + if ( (cache_ptr)->pl_size > (cache_ptr)->max_pl_size ) \ + (cache_ptr)->max_pl_size = (cache_ptr)->pl_size; \ +} + +#define H5C__UPDATE_STATS_FOR_PIN(cache_ptr, entry_ptr) \ +{ \ + ((cache_ptr)->pins)[(entry_ptr)->type->id]++; \ + if ( (cache_ptr)->pel_len > (cache_ptr)->max_pel_len ) \ + (cache_ptr)->max_pel_len = (cache_ptr)->pel_len; \ + if ( (cache_ptr)->pel_size > (cache_ptr)->max_pel_size ) \ + (cache_ptr)->max_pel_size = (cache_ptr)->pel_size; \ +} #endif /* H5C_COLLECT_CACHE_ENTRY_STATS */ diff --git a/src/H5EAcache.c b/src/H5EAcache.c index b9acc49..70686fb 100644 --- a/src/H5EAcache.c +++ b/src/H5EAcache.c @@ -227,7 +227,7 @@ H5EA__cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata)) H5E_THROW(H5E_CANTINIT, "can't wrap buffer") /* Compute the 'base' size of the extensible array header on disk */ - size = H5EA_HEADER_SIZE(hdr); + size = H5EA_HEADER_SIZE_HDR(hdr); /* Get a pointer to a buffer that's large enough for serialized header */ if(NULL == (buf = (uint8_t *)H5WB_actual(wb, size))) @@ -1789,7 +1789,7 @@ H5EA__cache_dblk_page_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata)) H5E_THROW(H5E_CANTINIT, "can't wrap buffer") /* Compute the size of the extensible array data block page on disk */ - size = H5EA_DBLK_PAGE_SIZE(dblk_page); + size = H5EA_DBLK_PAGE_SIZE(udata->hdr); /* Get a pointer to a buffer that's large enough for serialized info */ if(NULL == (buf = (uint8_t *)H5WB_actual(wb, size))) diff --git a/src/H5EAdblkpage.c b/src/H5EAdblkpage.c index 3c2da7c..37fd68b 100644 --- a/src/H5EAdblkpage.c +++ b/src/H5EAdblkpage.c @@ -169,7 +169,7 @@ HDfprintf(stderr, "%s: Called, addr = %a\n", FUNC, addr); /* Set info about data block page on disk */ dblk_page->addr = addr; - dblk_page->size = H5EA_DBLK_PAGE_SIZE(dblk_page); + dblk_page->size = H5EA_DBLK_PAGE_SIZE(hdr); #ifdef QAK HDfprintf(stderr, "%s: dblk_page->size = %Zu\n", FUNC, dblk_page->size); #endif /* QAK */ diff --git a/src/H5EAhdr.c b/src/H5EAhdr.c index 136cf1e..76ea6d8 100644 --- a/src/H5EAhdr.c +++ b/src/H5EAhdr.c @@ -230,7 +230,7 @@ HDfprintf(stderr, "%s: hdr->sblk_info[%Zu] = {%Zu, %Zu, %Hu, %Hu}\n", FUNC, u, h } /* end for */ /* Set size of header on disk (locally and in statistics) */ - hdr->stats.computed.hdr_size = hdr->size = H5EA_HEADER_SIZE(hdr); + hdr->stats.computed.hdr_size = hdr->size = H5EA_HEADER_SIZE_HDR(hdr); /* Create the callback context, if there's one */ if(hdr->cparam.cls->crt_context) { diff --git a/src/H5EApkg.h b/src/H5EApkg.h index d89a35e..5382eac 100644 --- a/src/H5EApkg.h +++ b/src/H5EApkg.h @@ -66,7 +66,7 @@ ) /* Size of the extensible array header on disk */ -#define H5EA_HEADER_SIZE(h) ( \ +#define H5EA_HEADER_SIZE(sizeof_addr, sizeof_size) ( \ /* General metadata fields */ \ H5EA_METADATA_PREFIX_SIZE(TRUE) \ \ @@ -79,15 +79,25 @@ + 1 /* Log2(Max. # of elements in data block page) - i.e. # of bits needed to store max. # of elements in data block page */ \ \ /* Extensible Array statistics fields */ \ - + (h)->sizeof_size /* Number of super blocks created */ \ - + (h)->sizeof_size /* Size of super blocks created */ \ - + (h)->sizeof_size /* Number of data blocks created */ \ - + (h)->sizeof_size /* Size of data blocks created */ \ - + (h)->sizeof_size /* Max. index set */ \ - + (h)->sizeof_size /* Number of elements 'realized' */ \ + + (sizeof_size) /* Number of super blocks created */ \ + + (sizeof_size) /* Size of super blocks created */ \ + + (sizeof_size) /* Number of data blocks created */ \ + + (sizeof_size) /* Size of data blocks created */ \ + + (sizeof_size) /* Max. index set */ \ + + (sizeof_size) /* Number of elements 'realized' */ \ \ /* Extensible Array Header specific fields */ \ - + (h)->sizeof_addr /* File address of index block */ \ + + (sizeof_addr) /* File address of index block */ \ + ) + +/* Size of the extensible array header on disk (via file pointer) */ +#define H5EA_HEADER_SIZE_FILE(f) ( \ + H5EA_HEADER_SIZE(H5F_SIZEOF_ADDR(f), H5F_SIZEOF_SIZE(f)) \ + ) + +/* Size of the extensible array header on disk (via extensible array header) */ +#define H5EA_HEADER_SIZE_HDR(h) ( \ + H5EA_HEADER_SIZE((h)->sizeof_addr, (h)->sizeof_size) \ ) /* Size of the extensible array index block on disk */ @@ -139,8 +149,8 @@ ) /* Size of the extensible array data block page on disk */ -#define H5EA_DBLK_PAGE_SIZE(p) ( \ - + ((p)->hdr->dblk_page_nelmts * (size_t)(p)->hdr->cparam.raw_elmt_size) /* Elements in data block page */ \ +#define H5EA_DBLK_PAGE_SIZE(h) ( \ + + ((h)->dblk_page_nelmts * (size_t)(h)->cparam.raw_elmt_size) /* Elements in data block page */ \ + H5EA_SIZEOF_CHKSUM /* Checksum for each page */ \ ) diff --git a/src/H5Eint.c b/src/H5Eint.c index 2092566..07d1e46 100644 --- a/src/H5Eint.c +++ b/src/H5Eint.c @@ -272,10 +272,12 @@ H5E_walk1_cb(int n, H5E_error1_t *err_desc, void *client_data) /* try show the process or thread id in multiple processes cases*/ #ifdef H5_HAVE_PARALLEL { - int mpi_rank, mpi_initialized; + int mpi_rank, mpi_initialized, mpi_finalized; MPI_Initialized(&mpi_initialized); - if(mpi_initialized) { + MPI_Finalized(&mpi_finalized); + + if(mpi_initialized && !mpi_finalized) { MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); fprintf(stream, "MPI-process %d", mpi_rank); } /* end if */ @@ -402,10 +404,12 @@ H5E_walk2_cb(unsigned n, const H5E_error2_t *err_desc, void *client_data) /* try show the process or thread id in multiple processes cases*/ #ifdef H5_HAVE_PARALLEL { - int mpi_rank, mpi_initialized; + int mpi_rank, mpi_initialized, mpi_finalized; MPI_Initialized(&mpi_initialized); - if(mpi_initialized) { + MPI_Finalized(&mpi_finalized); + + if(mpi_initialized && !mpi_finalized) { MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); fprintf(stream, "MPI-process %d", mpi_rank); } /* end if */ @@ -1477,3 +1477,4 @@ H5Fclear_elink_file_cache(hid_t file_id) done: FUNC_LEAVE_API(ret_value) } /* end H5Fclear_elink_file_cache() */ + diff --git a/src/H5FAcache.c b/src/H5FAcache.c index a26aee6..9a1fc57 100644 --- a/src/H5FAcache.c +++ b/src/H5FAcache.c @@ -189,7 +189,7 @@ H5FA__cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata)) H5E_THROW(H5E_CANTINIT, "can't wrap buffer") /* Compute the 'base' size of the fixed array header on disk */ - size = H5FA_HEADER_SIZE(hdr); + size = H5FA_HEADER_SIZE_HDR(hdr); /* Get a pointer to a buffer that's large enough for serialized header */ if(NULL == (buf = (uint8_t *)H5WB_actual(wb, size))) @@ -883,7 +883,7 @@ H5FA__cache_dblk_page_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata)) H5E_THROW(H5E_CANTINIT, "can't wrap buffer") /* Compute the size of the fixed array data block page on disk */ - size = H5FA_DBLK_PAGE_SIZE(dblk_page, udata->nelmts); + size = H5FA_DBLK_PAGE_SIZE(udata->hdr, udata->nelmts); /* Get a pointer to a buffer that's large enough for serialized info */ if(NULL == (buf = (uint8_t *)H5WB_actual(wb, size))) diff --git a/src/H5FAdblkpage.c b/src/H5FAdblkpage.c index b5ef82c..1f6b706 100644 --- a/src/H5FAdblkpage.c +++ b/src/H5FAdblkpage.c @@ -167,7 +167,7 @@ HDfprintf(stderr, "%s: Called, addr = %a\n", FUNC, addr); /* Set info about data block page on disk */ dblk_page->addr = addr; - dblk_page->size = H5FA_DBLK_PAGE_SIZE(dblk_page, nelmts); + dblk_page->size = H5FA_DBLK_PAGE_SIZE(hdr, nelmts); #ifdef H5FA_DEBUG HDfprintf(stderr, "%s: dblk_page->size = %Zu\n", FUNC, dblk_page->size); #endif /* H5FA_DEBUG */ diff --git a/src/H5FAhdr.c b/src/H5FAhdr.c index 5970ff0..23c20bc 100644 --- a/src/H5FAhdr.c +++ b/src/H5FAhdr.c @@ -148,7 +148,7 @@ H5FA__hdr_init(H5FA_hdr_t *hdr, void *ctx_udata)) HDassert(hdr); /* Set size of header on disk (locally and in statistics) */ - hdr->stats.hdr_size = hdr->size = H5FA_HEADER_SIZE(hdr); + hdr->stats.hdr_size = hdr->size = H5FA_HEADER_SIZE_HDR(hdr); /* Set number of elements for Fixed Array in statistics */ hdr->stats.nelmts = hdr->cparam.nelmts; diff --git a/src/H5FApkg.h b/src/H5FApkg.h index 7101f0b..e7993a6 100644 --- a/src/H5FApkg.h +++ b/src/H5FApkg.h @@ -70,7 +70,7 @@ ) /* Size of the Fixed Array header on disk */ -#define H5FA_HEADER_SIZE(h) ( \ +#define H5FA_HEADER_SIZE(sizeof_addr, sizeof_size) ( \ /* General metadata fields */ \ H5FA_METADATA_PREFIX_SIZE(TRUE) \ \ @@ -79,10 +79,20 @@ + 1 /* Log2(Max. # of elements in data block page) - i.e. # of bits needed to store max. # of elements in data block page */ \ \ /* Fixed Array statistics fields */ \ - + (h)->sizeof_size /* # of elements in the fixed array */ \ + + (sizeof_size) /* # of elements in the fixed array */ \ \ /* Fixed Array Header specific fields */ \ - + (h)->sizeof_addr /* File address of Fixed Array data block */ \ + + (sizeof_addr) /* File address of Fixed Array data block */ \ + ) + +/* Size of the fixed array header on disk (via file pointer) */ +#define H5FA_HEADER_SIZE_FILE(f) ( \ + H5FA_HEADER_SIZE(H5F_SIZEOF_ADDR(f), H5F_SIZEOF_SIZE(f)) \ + ) + +/* Size of the fixed array header on disk (via fixed array header) */ +#define H5FA_HEADER_SIZE_HDR(h) ( \ + H5FA_HEADER_SIZE((h)->sizeof_addr, (h)->sizeof_size) \ ) /* Size of the Fixed Array data block prefix on disk */ @@ -108,9 +118,9 @@ ) /* Size of the Fixed Array data block page on disk */ -#define H5FA_DBLK_PAGE_SIZE(d, nelmts) ( \ +#define H5FA_DBLK_PAGE_SIZE(h, nelmts) ( \ /* Fixed Array Data Block Page */ \ - + (nelmts * (size_t)(d)->hdr->cparam.raw_elmt_size) /* Elements in data block page */ \ + + (nelmts * (size_t)(h)->cparam.raw_elmt_size) /* Elements in data block page */ \ + H5FA_SIZEOF_CHKSUM /* Checksum for each page */ \ ) @@ -605,7 +605,7 @@ H5FS__new(const H5F_t *f, uint16_t nclasses, const H5FS_section_class_t *classes HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for free space free list") /* Set immutable free list parameters */ - fspace->nclasses = nclasses; + H5_CHECKED_ASSIGN(fspace->nclasses, unsigned, nclasses, size_t); if(nclasses > 0) { if(NULL == (fspace->sect_cls = H5FL_SEQ_MALLOC(H5FS_section_class_t, nclasses))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for free space section class array") diff --git a/src/H5Fint.c b/src/H5Fint.c index 775c91f..e012ba6 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -2049,3 +2049,66 @@ H5F_get_file_image(H5F_t *file, void *buf_ptr, size_t buf_len) done: FUNC_LEAVE_NOAPI(ret_value) } /* H5F_get_file_image() */ + + +/*------------------------------------------------------------------------- + * Function: H5F__set_base_addr + * + * Purpose: Quick and dirty routine to set the file's 'base_addr' value + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol <koziol@hdfgroup.org> + * July 19, 2013 + * + *------------------------------------------------------------------------- + */ +herr_t +H5F__set_base_addr(const H5F_t *f, haddr_t addr) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE + + HDassert(f); + HDassert(f->shared); + + /* Dispatch to driver */ + if(H5FD_set_base_addr(f->shared->lf, addr) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "driver set_base_addr request failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5F__set_base_addr() */ + + +/*------------------------------------------------------------------------- + * Function: H5F__set_eoa + * + * Purpose: Quick and dirty routine to set the file's 'eoa' value + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol <koziol@hdfgroup.org> + * July 19, 2013 + * + *------------------------------------------------------------------------- + */ +herr_t +H5F__set_eoa(const H5F_t *f, H5F_mem_t type, haddr_t addr) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE + + HDassert(f); + HDassert(f->shared); + + /* Dispatch to driver */ + if(H5FD_set_eoa(f->shared->lf, type, addr) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "driver set_eoa request failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5F__set_eoa() */ + diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index a645fd3..9f70e12 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -89,34 +89,34 @@ + 1 /* reserved */ \ + 4 /* group leaf k, group internal k */ \ + 4) /* consistency flags */ -#define H5F_SUPERBLOCK_VARLEN_SIZE_V0(f) \ +#define H5F_SUPERBLOCK_VARLEN_SIZE_V0(sizeof_addr, sizeof_size) \ ( H5F_SUPERBLOCK_VARLEN_SIZE_COMMON /* Common variable-length info */ \ - + H5F_SIZEOF_ADDR(f) /* base address */ \ - + H5F_SIZEOF_ADDR(f) /* <unused> */ \ - + H5F_SIZEOF_ADDR(f) /* EOF address */ \ - + H5F_SIZEOF_ADDR(f) /* driver block address */ \ - + H5G_SIZEOF_ENTRY(f)) /* root group ptr */ -#define H5F_SUPERBLOCK_VARLEN_SIZE_V1(f) \ + + (sizeof_addr) /* base address */ \ + + (sizeof_addr) /* <unused> */ \ + + (sizeof_addr) /* EOF address */ \ + + (sizeof_addr) /* driver block address */ \ + + H5G_SIZEOF_ENTRY(sizeof_addr, sizeof_size)) /* root group ptr */ +#define H5F_SUPERBLOCK_VARLEN_SIZE_V1(sizeof_addr, sizeof_size) \ ( H5F_SUPERBLOCK_VARLEN_SIZE_COMMON /* Common variable-length info */ \ + 2 /* indexed B-tree internal k */ \ + 2 /* reserved */ \ - + H5F_SIZEOF_ADDR(f) /* base address */ \ - + H5F_SIZEOF_ADDR(f) /* <unused> */ \ - + H5F_SIZEOF_ADDR(f) /* EOF address */ \ - + H5F_SIZEOF_ADDR(f) /* driver block address */ \ - + H5G_SIZEOF_ENTRY(f)) /* root group ptr */ -#define H5F_SUPERBLOCK_VARLEN_SIZE_V2(f) \ + + (sizeof_addr) /* base address */ \ + + (sizeof_addr) /* <unused> */ \ + + (sizeof_addr) /* EOF address */ \ + + (sizeof_addr) /* driver block address */ \ + + H5G_SIZEOF_ENTRY(sizeof_addr, sizeof_size)) /* root group ptr */ +#define H5F_SUPERBLOCK_VARLEN_SIZE_V2(sizeof_addr) \ ( 2 /* size of address, size of lengths */ \ + 1 /* consistency flags */ \ - + H5F_SIZEOF_ADDR(f) /* base address */ \ - + H5F_SIZEOF_ADDR(f) /* superblock extension address */ \ - + H5F_SIZEOF_ADDR(f) /* EOF address */ \ - + H5F_SIZEOF_ADDR(f) /* root group object header address */ \ + + (sizeof_addr) /* base address */ \ + + (sizeof_addr) /* superblock extension address */ \ + + (sizeof_addr) /* EOF address */ \ + + (sizeof_addr) /* root group object header address */ \ + H5F_SIZEOF_CHKSUM) /* superblock checksum (keep this last) */ #define H5F_SUPERBLOCK_VARLEN_SIZE(v, f) ( \ - (v == 0 ? H5F_SUPERBLOCK_VARLEN_SIZE_V0(f) : 0) \ - + (v == 1 ? H5F_SUPERBLOCK_VARLEN_SIZE_V1(f) : 0) \ - + (v == 2 ? H5F_SUPERBLOCK_VARLEN_SIZE_V2(f) : 0)) + (v == 0 ? H5F_SUPERBLOCK_VARLEN_SIZE_V0(H5F_SIZEOF_ADDR(f), H5F_SIZEOF_SIZE(f)) : 0) \ + + (v == 1 ? H5F_SUPERBLOCK_VARLEN_SIZE_V1(H5F_SIZEOF_ADDR(f), H5F_SIZEOF_SIZE(f)) : 0) \ + + (v == 2 ? H5F_SUPERBLOCK_VARLEN_SIZE_V2(H5F_SIZEOF_ADDR(f)) : 0)) /* Total size of superblock, depends on superblock version */ #define H5F_SUPERBLOCK_SIZE(v, f) ( H5F_SUPERBLOCK_FIXED_SIZE \ @@ -340,6 +340,10 @@ 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); +/* 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); + /* Testing functions */ #ifdef H5F_TESTING H5_DLL herr_t H5F_get_sohm_mesg_count_test(hid_t fid, unsigned type_id, diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index 9a5bfb3..36d7429 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -394,13 +394,13 @@ */ #if (H5_SIZEOF_SIZE_T >= H5_SIZEOF_OFF_T) # define H5F_OVERFLOW_SIZET2OFFT(X) \ - ((size_t)(X)>=(size_t)((size_t)1<<(8*sizeof(off_t)-1))) + ((size_t)(X)>=(size_t)((size_t)1<<(8*sizeof(HDoff_t)-1))) #else # define H5F_OVERFLOW_SIZET2OFFT(X) 0 #endif #if (H5_SIZEOF_HSIZE_T >= H5_SIZEOF_OFF_T) # define H5F_OVERFLOW_HSIZET2OFFT(X) \ - ((hsize_t)(X)>=(hsize_t)((hsize_t)1<<(8*sizeof(off_t)-1))) + ((hsize_t)(X)>=(hsize_t)((hsize_t)1<<(8*sizeof(HDoff_t)-1))) #else # define H5F_OVERFLOW_HSIZET2OFFT(X) 0 #endif diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c index 6db631e..166247a 100644 --- a/src/H5Fsuper.c +++ b/src/H5Fsuper.c @@ -279,7 +279,7 @@ H5F__super_read(H5F_t *f, hid_t dxpl_id) /* Check for userblock present */ if(H5F_addr_gt(super_addr, 0)) { /* Set the base address for the file in the VFD now */ - if(H5FD_set_base_addr(f->shared->lf, super_addr) < 0) + if(H5F__set_base_addr(f, super_addr) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "failed to set base address for file driver") } /* end if */ @@ -418,13 +418,13 @@ H5F__super_init(H5F_t *f, hid_t dxpl_id) sblock->status_flags = 0; /* Reserve space for the userblock */ - if(H5FD_set_eoa(f->shared->lf, H5FD_MEM_SUPER, userblock_size) < 0) + if(H5F__set_eoa(f, H5FD_MEM_SUPER, userblock_size) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to set EOA value for userblock") /* Set the base address for the file in the VFD now, after allocating * space for userblock. */ - if(H5FD_set_base_addr(f->shared->lf, sblock->base_addr) < 0) + if(H5F__set_base_addr(f, sblock->base_addr) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "failed to set base address for file driver") /* Save a local copy of the superblock version number */ @@ -455,7 +455,7 @@ H5F__super_init(H5F_t *f, hid_t dxpl_id) superblock_size += driver_size; /* Reserve space in the file for the superblock, instead of allocating it */ - if(H5FD_set_eoa(f->shared->lf, H5FD_MEM_SUPER, superblock_size) < 0) + 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") /* Insert superblock into cache, pinned */ diff --git a/src/H5Gent.c b/src/H5Gent.c index 2cef9f7..3f243de 100644 --- a/src/H5Gent.c +++ b/src/H5Gent.c @@ -173,7 +173,7 @@ H5G_ent_decode(const H5F_t *f, const uint8_t **pp, H5G_entry_t *ent) HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "unknown symbol table entry cache type") } /* end switch */ - *pp = p_ret + H5G_SIZEOF_ENTRY(f); + *pp = p_ret + H5G_SIZEOF_ENTRY_FILE(f); done: FUNC_LEAVE_NOAPI(ret_value) @@ -240,7 +240,7 @@ done: herr_t H5G_ent_encode(const H5F_t *f, uint8_t **pp, const H5G_entry_t *ent) { - uint8_t *p_ret = *pp + H5G_SIZEOF_ENTRY(f); + uint8_t *p_ret = *pp + H5G_SIZEOF_ENTRY_FILE(f); herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) diff --git a/src/H5Gpkg.h b/src/H5Gpkg.h index b194adb..7346b41 100644 --- a/src/H5Gpkg.h +++ b/src/H5Gpkg.h @@ -55,7 +55,7 @@ + 2 /* Number of symbols */ \ \ /* Entries */ \ - + ((2 * H5F_SYM_LEAF_K(f)) * H5G_SIZEOF_ENTRY(f)) \ + + ((2 * H5F_SYM_LEAF_K(f)) * H5G_SIZEOF_ENTRY_FILE(f)) \ ) diff --git a/src/H5Gprivate.h b/src/H5Gprivate.h index 50f8bda..130c742 100644 --- a/src/H5Gprivate.h +++ b/src/H5Gprivate.h @@ -47,12 +47,14 @@ * The disk size for a symbol table entry... */ #define H5G_SIZEOF_SCRATCH 16 -#define H5G_SIZEOF_ENTRY(F) \ - (H5F_SIZEOF_SIZE(F) + /*offset of name into heap */ \ - H5F_SIZEOF_ADDR(F) + /*address of object header */ \ +#define H5G_SIZEOF_ENTRY(sizeof_addr, sizeof_size) \ + ((sizeof_size) + /*offset of name into heap */ \ + (sizeof_addr) + /*address of object header */ \ 4 + /*entry type */ \ 4 + /*reserved */ \ H5G_SIZEOF_SCRATCH) /*scratch pad space */ +#define H5G_SIZEOF_ENTRY_FILE(F) \ + H5G_SIZEOF_ENTRY(H5F_SIZEOF_ADDR(F), H5F_SIZEOF_SIZE(F)) /* ========= Group Creation properties ============ */ diff --git a/src/H5HFcache.c b/src/H5HFcache.c index 9f8dfd9..07e5b36 100644 --- a/src/H5HFcache.c +++ b/src/H5HFcache.c @@ -262,6 +262,10 @@ H5HF__dtable_encode(H5F_t *f, uint8_t **pp, const H5HF_dtable_t *dtable) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5HF__dtable_encode() */ +/**************************************************/ +/* metadata cache callback definitions for header */ +/**************************************************/ + /*------------------------------------------------------------------------- * Function: H5HF_cache_hdr_load @@ -379,8 +383,8 @@ H5HF_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata) /* Compute the size of the extra filter information */ filter_info_size = (size_t)(hdr->sizeof_size /* Size of size for filtered root direct block */ - + (unsigned)4 /* Size of filter mask for filtered root direct block */ - + hdr->filter_len); /* Size of encoded I/O filter info */ + + (unsigned)4 /* Size of filter mask for filtered root direct block */ + + hdr->filter_len); /* Size of encoded I/O filter info */ /* Compute the heap header's size */ hdr->heap_size = size + filter_info_size; @@ -724,6 +728,10 @@ H5HF_cache_hdr_size(const H5F_t H5_ATTR_UNUSED *f, const H5HF_hdr_t *hdr, size_t FUNC_LEAVE_NOAPI(SUCCEED) } /* H5HF_cache_hdr_size() */ +/***********************************************************/ +/* metadata cache callback definitions for indirect blocks */ +/***********************************************************/ + /*------------------------------------------------------------------------- * Function: H5HF_cache_iblock_load @@ -1366,6 +1374,10 @@ H5HF_cache_iblock_size(const H5F_t H5_ATTR_UNUSED *f, const H5HF_indirect_t *ibl FUNC_LEAVE_NOAPI(SUCCEED) } /* H5HF_cache_iblock_size() */ +/*********************************************************/ +/* metadata cache callback definitions for direct blocks */ +/*********************************************************/ + /*------------------------------------------------------------------------- * Function: H5HF_cache_dblock_load diff --git a/src/H5HGcache.c b/src/H5HGcache.c index f1b5fc6..aac73ed 100644 --- a/src/H5HGcache.c +++ b/src/H5HGcache.c @@ -129,10 +129,10 @@ H5HG_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata) /* Read the initial 4k page */ if(NULL == (heap = H5FL_CALLOC(H5HG_heap_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") heap->shared = H5F_SHARED(f); if(NULL == (heap->chunk = H5FL_BLK_MALLOC(gheap_chunk, (size_t)H5HG_MINSIZE))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") if(H5F_block_read(f, H5FD_MEM_GHEAP, addr, (size_t)H5HG_MINSIZE, dxpl_id, heap->chunk) < 0) HGOTO_ERROR(H5E_HEAP, H5E_READERROR, NULL, "unable to read global heap collection") p = heap->chunk; @@ -260,7 +260,7 @@ H5HG_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata) done: if(!ret_value && heap) if(H5HG_free(heap) < 0) - HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, NULL, "unable to destroy global heap collection") + HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, NULL, "unable to destroy global heap collection") FUNC_LEAVE_NOAPI(ret_value) } /* end H5HG_load() */ @@ -367,11 +367,11 @@ done: static herr_t H5HG_clear(H5F_t *f, H5HG_heap_t *heap, hbool_t destroy) { - herr_t ret_value = SUCCEED; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT - /* Check arguments */ + /* Sanity checks */ HDassert(heap); /* Mark heap as clean */ @@ -565,7 +565,7 @@ HDfprintf(stderr, "%s: size = %Hu\n", FUNC, size); HDassert(size > 0); /* Retrieve the 'eoa' for the file */ - if(HADDR_UNDEF == (eoa = H5FD_get_eoa(f->shared->lf, H5FD_MEM_DEFAULT))) + if(HADDR_UNDEF == (eoa = H5F_get_eoa(f, H5FD_MEM_DEFAULT))) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, HADDR_UNDEF, "driver get_eoa request failed") /* Compute value to return */ @@ -598,7 +598,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5MF_xfree(H5F_t *f, H5FD_mem_t alloc_type, hid_t dxpl_id, haddr_t addr, +H5MF_xfree(const H5F_t *f, H5FD_mem_t alloc_type, hid_t dxpl_id, haddr_t addr, hsize_t size) { H5F_io_info_t fio_info; /* I/O info for operation */ @@ -862,7 +862,7 @@ H5MF_get_freespace(H5F_t *f, hid_t dxpl_id, hsize_t *tot_space, hsize_t *meta_si HDassert(f->shared->lf); /* Retrieve the 'eoa' for the file */ - if(HADDR_UNDEF == (eoa = H5FD_get_eoa(f->shared->lf, H5FD_MEM_DEFAULT))) + if(HADDR_UNDEF == (eoa = H5F_get_eoa(f, H5FD_MEM_DEFAULT))) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "driver get_eoa request failed") /* Retrieve metadata aggregator info, if available */ diff --git a/src/H5MFdbg.c b/src/H5MFdbg.c index d6fc5ce..3a664ef 100644 --- a/src/H5MFdbg.c +++ b/src/H5MFdbg.c @@ -238,7 +238,7 @@ HDfprintf(stderr, "%s: Dumping file free space sections\n", FUNC); HDassert(stream); /* Retrieve the 'eoa' for the file */ - if(HADDR_UNDEF == (eoa = H5FD_get_eoa(f->shared->lf, H5FD_MEM_DEFAULT))) + if(HADDR_UNDEF == (eoa = H5F_get_eoa(f, H5FD_MEM_DEFAULT))) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "driver get_eoa request failed") #ifdef H5MF_ALLOC_DEBUG HDfprintf(stderr, "%s: for type = H5FD_MEM_DEFAULT, eoa = %a\n", FUNC, eoa); @@ -265,7 +265,7 @@ HDfprintf(stderr, "%s: sda_addr = %a, sda_size = %Hu, end of sda = %a\n", FUNC, 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 = H5FD_get_eoa(f->shared->lf, 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:", diff --git a/src/H5MFprivate.h b/src/H5MFprivate.h index ad5e385..024cc91 100644 --- a/src/H5MFprivate.h +++ b/src/H5MFprivate.h @@ -67,7 +67,7 @@ H5_DLL herr_t H5MF_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 herr_t H5MF_xfree(H5F_t *f, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, +H5_DLL herr_t H5MF_xfree(const 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, haddr_t addr, hsize_t size, hsize_t extra_requested); diff --git a/src/H5MFsection.c b/src/H5MFsection.c index bc147ed..20b9984 100644 --- a/src/H5MFsection.c +++ b/src/H5MFsection.c @@ -310,7 +310,7 @@ H5MF_sect_simple_can_shrink(const H5FS_section_info_t *_sect, void *_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))) + if(HADDR_UNDEF == (eoa = H5F_get_eoa(udata->f, udata->alloc_type))) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "driver get_eoa request failed") /* Compute address of end of section to check */ diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h index 3707367..cc262a0 100644 --- a/src/H5Oprivate.h +++ b/src/H5Oprivate.h @@ -35,6 +35,7 @@ #include "H5Spublic.h" /* Dataspace functions */ /* Private headers needed by this file */ +#include "H5private.h" /* Generic Functions */ #include "H5ACprivate.h" /* Metadata cache */ #include "H5Fprivate.h" /* File access */ #include "H5SLprivate.h" /* Skip lists */ diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c index 79726e1..6b3d4ac 100644 --- a/src/H5Pfapl.c +++ b/src/H5Pfapl.c @@ -2698,8 +2698,8 @@ H5P__facc_cache_config_enc(const void *value, void **_pp, size_t *size) H5_ENCODE_DOUBLE(*pp, config->empty_reserve); - /* int */ - INT32ENCODE(*pp, (int32_t)config->dirty_bytes_threshold); + /* unsigned */ + UINT32ENCODE(*pp, (uint32_t)config->dirty_bytes_threshold); /* int */ INT32ENCODE(*pp, (int32_t)config->metadata_write_strategy); @@ -2850,8 +2850,8 @@ H5P__facc_cache_config_dec(const void **_pp, void *_value) H5_DECODE_DOUBLE(*pp, config->empty_reserve); - /* int */ - INT32DECODE(*pp, config->dirty_bytes_threshold); + /* unsigned */ + UINT32DECODE(*pp, config->dirty_bytes_threshold); /* int */ INT32DECODE(*pp, config->metadata_write_strategy); diff --git a/src/H5SMcache.c b/src/H5SMcache.c index 98b5213..eaeb889 100644 --- a/src/H5SMcache.c +++ b/src/H5SMcache.c @@ -130,13 +130,13 @@ static H5SM_master_table_t * H5SM_table_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void H5_ATTR_UNUSED *udata) { H5SM_master_table_t *table = NULL; - H5WB_t *wb = NULL; /* Wrapped buffer for table data */ + H5WB_t *wb = NULL; /* Wrapped buffer for table data */ uint8_t tbl_buf[H5SM_TBL_BUF_SIZE]; /* Buffer for table */ - uint8_t *buf; /* Reading buffer */ - const uint8_t *p; /* Pointer into input buffer */ - uint32_t stored_chksum; /* Stored metadata checksum value */ - uint32_t computed_chksum; /* Computed metadata checksum value */ - size_t x; /* Counter variable for index headers */ + uint8_t *buf; /* Reading buffer */ + const uint8_t *p; /* Pointer into input buffer */ + uint32_t stored_chksum; /* Stored metadata checksum value */ + uint32_t computed_chksum; /* Computed metadata checksum value */ + size_t u; /* Counter variable for index headers */ H5SM_master_table_t *ret_value; FUNC_ENTER_NOAPI_NOINIT @@ -187,37 +187,37 @@ H5SM_table_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void H5_ATTR_UNUSED *udat HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, NULL, "memory allocation failed for SOHM indexes") /* Read in the index headers */ - for(x = 0; x < table->num_indexes; ++x) { + for(u = 0; u < table->num_indexes; ++u) { /* Verify correct version of index list */ if(H5SM_LIST_VERSION != *p++) HGOTO_ERROR(H5E_SOHM, H5E_VERSION, NULL, "bad shared message list version number") /* Type of the index (list or B-tree) */ - table->indexes[x].index_type= (H5SM_index_type_t)*p++; + table->indexes[u].index_type= (H5SM_index_type_t)*p++; /* Type of messages in the index */ - UINT16DECODE(p, table->indexes[x].mesg_types); + UINT16DECODE(p, table->indexes[u].mesg_types); /* Minimum size of message to share */ - UINT32DECODE(p, table->indexes[x].min_mesg_size); + UINT32DECODE(p, table->indexes[u].min_mesg_size); /* List cutoff; fewer than this number and index becomes a list */ - UINT16DECODE(p, table->indexes[x].list_max); + UINT16DECODE(p, table->indexes[u].list_max); /* B-tree cutoff; more than this number and index becomes a B-tree */ - UINT16DECODE(p, table->indexes[x].btree_min); + UINT16DECODE(p, table->indexes[u].btree_min); /* Number of messages shared */ - UINT16DECODE(p, table->indexes[x].num_messages); + UINT16DECODE(p, table->indexes[u].num_messages); /* Address of the actual index */ - H5F_addr_decode(f, &p, &(table->indexes[x].index_addr)); + H5F_addr_decode(f, &p, &(table->indexes[u].index_addr)); /* Address of the index's heap */ - H5F_addr_decode(f, &p, &(table->indexes[x].heap_addr)); + H5F_addr_decode(f, &p, &(table->indexes[u].heap_addr)); /* Compute the size of a list index for this SOHM index */ - table->indexes[x].list_size = H5SM_LIST_SIZE(f, table->indexes[x].list_max); + table->indexes[u].list_size = H5SM_LIST_SIZE(f, table->indexes[u].list_max); } /* end for */ /* Read in checksum */ @@ -279,7 +279,7 @@ H5SM_table_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5SM_ma uint8_t *buf; /* Temporary buffer */ uint8_t *p; /* Pointer into raw data buffer */ uint32_t computed_chksum; /* Computed metadata checksum value */ - size_t x; /* Counter variable */ + size_t u; /* Counter variable */ /* Verify that we're writing version 0 of the table; this is the only * version defined so far. @@ -302,33 +302,33 @@ H5SM_table_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5SM_ma p += H5_SIZEOF_MAGIC; /* Encode each index header */ - for(x = 0; x < table->num_indexes; ++x) { - /* Version for this list. */ + for(u = 0; u < table->num_indexes; ++u) { + /* Version for this list */ *p++ = H5SM_LIST_VERSION; /* Is message index a list or a B-tree? */ - *p++ = table->indexes[x].index_type; + *p++ = table->indexes[u].index_type; /* Type of messages in the index */ - UINT16ENCODE(p, table->indexes[x].mesg_types); + UINT16ENCODE(p, table->indexes[u].mesg_types); /* Minimum size of message to share */ - UINT32ENCODE(p, table->indexes[x].min_mesg_size); + UINT32ENCODE(p, table->indexes[u].min_mesg_size); /* List cutoff; fewer than this number and index becomes a list */ - UINT16ENCODE(p, table->indexes[x].list_max); + UINT16ENCODE(p, table->indexes[u].list_max); /* B-tree cutoff; more than this number and index becomes a B-tree */ - UINT16ENCODE(p, table->indexes[x].btree_min); + UINT16ENCODE(p, table->indexes[u].btree_min); /* Number of messages shared */ - UINT16ENCODE(p, table->indexes[x].num_messages); + UINT16ENCODE(p, table->indexes[u].num_messages); /* Address of the actual index */ - H5F_addr_encode(f, &p, table->indexes[x].index_addr); + H5F_addr_encode(f, &p, table->indexes[u].index_addr); /* Address of the index's heap */ - H5F_addr_encode(f, &p, table->indexes[x].heap_addr); + H5F_addr_encode(f, &p, table->indexes[u].heap_addr); } /* end for */ /* Compute checksum on buffer */ @@ -477,7 +477,7 @@ H5SM_list_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata) uint8_t *p; /* Pointer into input buffer */ uint32_t stored_chksum; /* Stored metadata checksum value */ uint32_t computed_chksum; /* Computed metadata checksum value */ - size_t x; /* Counter variable for messages in list */ + size_t u; /* Counter variable for messages in list */ H5SM_list_t *ret_value; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -517,8 +517,8 @@ H5SM_list_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata) /* Read messages into the list array */ ctx.sizeof_addr = H5F_SIZEOF_ADDR(udata->f); - for(x = 0; x < udata->header->num_messages; x++) { - if(H5SM_message_decode(p, &(list->messages[x]), &ctx) < 0) + for(u = 0; u < udata->header->num_messages; u++) { + if(H5SM_message_decode(p, &(list->messages[u]), &ctx) < 0) HGOTO_ERROR(H5E_SOHM, H5E_CANTLOAD, NULL, "can't decode shared message") p += H5SM_SOHM_ENTRY_SIZE(udata->f); } /* end for */ @@ -537,8 +537,8 @@ H5SM_list_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata) HGOTO_ERROR(H5E_SOHM, H5E_BADVALUE, NULL, "incorrect metadata checksum for shared message list") /* Initialize the rest of the array */ - for(x = udata->header->num_messages; x < udata->header->list_max; x++) - list->messages[x].location = H5SM_NO_LOC; + for(u = udata->header->num_messages; u < udata->header->list_max; u++) + list->messages[u].location = H5SM_NO_LOC; /* Set return value */ ret_value = list; @@ -590,7 +590,7 @@ H5SM_list_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5SM_lis uint8_t *p; /* Pointer into raw data buffer */ uint32_t computed_chksum; /* Computed metadata checksum value */ size_t mesgs_written; /* Number of messages written to list */ - size_t x; /* Local index variable */ + size_t u; /* Local index variable */ /* Wrap the local buffer for serialized list index info */ if(NULL == (wb = H5WB_wrap(lst_buf, sizeof(lst_buf)))) @@ -610,9 +610,9 @@ H5SM_list_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5SM_lis /* Write messages from the messages array to disk */ mesgs_written = 0; ctx.sizeof_addr = H5F_SIZEOF_ADDR(f); - for(x = 0; x < list->header->list_max && mesgs_written < list->header->num_messages; x++) { - if(list->messages[x].location != H5SM_NO_LOC) { - if(H5SM_message_encode(p, &(list->messages[x]), &ctx) < 0) + for(u = 0; u < list->header->list_max && mesgs_written < list->header->num_messages; u++) { + if(list->messages[u].location != H5SM_NO_LOC) { + if(H5SM_message_encode(p, &(list->messages[u]), &ctx) < 0) HGOTO_ERROR(H5E_SOHM, H5E_CANTFLUSH, FAIL, "unable to write shared message to disk") p += H5SM_SOHM_ENTRY_SIZE(f); diff --git a/src/H5public.h b/src/H5public.h index bf6c6de..e625367 100644 --- a/src/H5public.h +++ b/src/H5public.h @@ -94,10 +94,10 @@ extern "C" { /* Version numbers */ #define H5_VERS_MAJOR 1 /* For major interface/format changes */ #define H5_VERS_MINOR 9 /* For minor interface/format changes */ -#define H5_VERS_RELEASE 221 /* For tweaks, bug-fixes, or development */ +#define H5_VERS_RELEASE 222 /* For tweaks, bug-fixes, or development */ #define H5_VERS_SUBRELEASE "" /* For pre-releases like snap0 */ /* Empty string for real releases. */ -#define H5_VERS_INFO "HDF5 library version: 1.9.221" /* Full version string */ +#define H5_VERS_INFO "HDF5 library version: 1.9.222" /* Full version string */ #define H5check() H5check_version(H5_VERS_MAJOR,H5_VERS_MINOR, \ H5_VERS_RELEASE) diff --git a/src/Makefile.in b/src/Makefile.in index 593d2d4..9390993 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -736,7 +736,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog *.clog2 # After making changes, run bin/reconfigure to update other configure related # files like Makefile.in. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 211 +LT_VERS_REVISION = 212 LT_VERS_AGE = 0 # Our main target, the HDF5 library diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 55b3c44..651e4eb 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -85,7 +85,7 @@ if (BUILD_SHARED_LIBS) TARGET ${HDF5_TEST_PLUGIN_LIB_TARGET} POST_BUILD COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different + ARGS -E copy_if_different "$<TARGET_FILE:${HDF5_TEST_PLUGIN_LIB_TARGET}>" "${CMAKE_BINARY_DIR}/testdir1/$<TARGET_FILE_NAME:${HDF5_TEST_PLUGIN_LIB_TARGET}>" ) @@ -116,7 +116,7 @@ if (BUILD_SHARED_LIBS) TARGET ${HDF5_TEST_PLUGIN_LIB_TARGET} POST_BUILD COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different + ARGS -E copy_if_different "$<TARGET_FILE:${HDF5_TEST_PLUGIN_LIB_TARGET}>" "${CMAKE_BINARY_DIR}/testdir2/$<TARGET_FILE_NAME:${HDF5_TEST_PLUGIN_LIB_TARGET}>" ) @@ -293,7 +293,7 @@ set_target_properties (links_env PROPERTIES FOLDER test) #-- Adding test for libinfo set (GREP_RUNNER ${PROJECT_BINARY_DIR}/GrepRunner.cmake) -file (WRITE ${GREP_RUNNER} +file (WRITE ${GREP_RUNNER} "file (STRINGS \${TEST_PROGRAM} TEST_RESULT REGEX \"SUMMARY OF THE HDF5 CONFIGURATION\") if (\${TEST_RESULT} STREQUAL \"0\") message (FATAL_ERROR \"Failed: The output: \${TEST_RESULT} of \${TEST_PROGRAM} did not contain SUMMARY OF THE HDF5 CONFIGURATION\") diff --git a/test/CMakeTests.cmake b/test/CMakeTests.cmake index 92e4574..c7803f6 100644 --- a/test/CMakeTests.cmake +++ b/test/CMakeTests.cmake @@ -204,7 +204,7 @@ endif (HDF5_TEST_VFD) add_test ( NAME H5TEST-clear-testhdf5-objects COMMAND ${CMAKE_COMMAND} - -E remove + -E remove coord.h5 dtypes10.h5 sys_file1 @@ -259,7 +259,7 @@ else (HDF5_ENABLE_USING_MEMCHECKER) WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) endif (HDF5_ENABLE_USING_MEMCHECKER) - + ############################################################################## ############################################################################## ### T H E T E S T S M A C R O S ### @@ -270,7 +270,7 @@ endif (HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5TEST-clear-objects COMMAND ${CMAKE_COMMAND} - -E remove + -E remove dt_arith1.h5 dt_arith2.h5 dtransform.h5 @@ -335,9 +335,16 @@ add_test ( ) foreach (test ${H5_TESTS}) - add_test (NAME H5TEST-${test} COMMAND $<TARGET_FILE:${test}>) + if (${test} STREQUAL "big" AND CYGWIN) + add_test ( + NAME H5TEST-${test} + COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${test}" + ) + else (${test} STREQUAL "big" AND CYGWIN) + add_test (NAME H5TEST-${test} COMMAND $<TARGET_FILE:${test}>) + endif (${test} STREQUAL "big" AND CYGWIN) set_tests_properties (H5TEST-${test} PROPERTIES - DEPENDS H5TEST-clear-objects + DEPENDS H5TEST-clear-objects ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) @@ -358,7 +365,7 @@ set_tests_properties (H5TEST-big PROPERTIES TIMEOUT 1800) add_test ( NAME H5TEST-clear-cache-objects COMMAND ${CMAKE_COMMAND} - -E remove + -E remove cache_test.h5 WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST @@ -374,14 +381,14 @@ set_tests_properties (H5TEST-cache PROPERTIES add_test ( NAME H5TEST-clear-cache_api-objects COMMAND ${CMAKE_COMMAND} - -E remove + -E remove cache_api_test.h5 WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) add_test (NAME H5TEST-cache_api COMMAND $<TARGET_FILE:cache_api>) set_tests_properties (H5TEST-cache_api PROPERTIES - DEPENDS H5TEST-clear-cache_api-objects + DEPENDS H5TEST-clear-cache_api-objects ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) @@ -390,7 +397,7 @@ set_tests_properties (H5TEST-cache_api PROPERTIES add_test ( NAME H5TEST-clear-cache_tagging-objects COMMAND ${CMAKE_COMMAND} - -E remove + -E remove tagging_test.h5 tagging_ext_test.h5 WORKING_DIRECTORY @@ -407,7 +414,7 @@ set_tests_properties (H5TEST-cache_tagging PROPERTIES add_test ( NAME H5TEST-clear-ttsafe-objects COMMAND ${CMAKE_COMMAND} - -E remove + -E remove ttsafe_error.h5 ttsafe_dcreate.h5 ttsafe_cancel.h5 @@ -427,7 +434,7 @@ if (HDF5_ENABLE_DEPRECATED_SYMBOLS) add_test ( NAME H5TEST-clear-err_compat-objects COMMAND ${CMAKE_COMMAND} - -E remove + -E remove err_compat.txt err_compat.txt.err WORKING_DIRECTORY @@ -454,7 +461,7 @@ endif (HDF5_ENABLE_DEPRECATED_SYMBOLS) add_test ( NAME H5TEST-clear-error_test-objects COMMAND ${CMAKE_COMMAND} - -E remove + -E remove error_test.txt error_test.txt.err WORKING_DIRECTORY @@ -470,7 +477,7 @@ add_test (NAME H5TEST-error_test COMMAND "${CMAKE_COMMAND}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/H5TEST" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) -set_tests_properties (H5TEST-error_test PROPERTIES +set_tests_properties (H5TEST-error_test PROPERTIES DEPENDS H5TEST-clear-error_test-objects ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST;HDF5_PLUGIN_PRELOAD=::" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST @@ -482,7 +489,7 @@ add_test ( COMMAND ${CMAKE_COMMAND} -E remove links_env.txt - links_env.txt.err + links_env.txt.err extlinks_env0.h5 extlinks_env1.h5 tmp/extlinks_env1.h5 @@ -610,7 +617,7 @@ if (HDF5_TEST_VFD) if (${vfdname} STREQUAL "multi" OR ${vfdname} STREQUAL "split") if (NOT BUILD_SHARED_LIBS AND NOT CMAKE_BUILD_TYPE MATCHES Debug) add_test ( - NAME VFD-${vfdname}-${vfdtest} + NAME VFD-${vfdname}-${vfdtest} COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$<TARGET_FILE:${vfdtest}>" -D "TEST_ARGS:STRING=" @@ -632,7 +639,7 @@ if (HDF5_TEST_VFD) endif(NOT BUILD_SHARED_LIBS AND NOT CMAKE_BUILD_TYPE MATCHES Debug) else (${vfdname} STREQUAL "multi" OR ${vfdname} STREQUAL "split") add_test ( - NAME VFD-${vfdname}-${vfdtest} + NAME VFD-${vfdname}-${vfdtest} COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$<TARGET_FILE:${vfdtest}>" -D "TEST_ARGS:STRING=" @@ -649,7 +656,7 @@ if (HDF5_TEST_VFD) endif (${vfdname} STREQUAL "multi" OR ${vfdname} STREQUAL "split") else (${vfdtest} STREQUAL "flush1" OR ${vfdtest} STREQUAL "flush2") add_test ( - NAME VFD-${vfdname}-${vfdtest} + NAME VFD-${vfdname}-${vfdtest} COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$<TARGET_FILE:${vfdtest}>" -D "TEST_ARGS:STRING=" @@ -672,7 +679,7 @@ if (HDF5_TEST_VFD) CHECK_VFD_TEST (${test} ${vfdname} ${resultcode}) else (WIN32) add_test ( - NAME VFD-${vfdname}-${test} + NAME VFD-${vfdname}-${test} COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$<TARGET_FILE:${test}>" -D "TEST_ARGS:STRING=" @@ -693,7 +700,7 @@ if (HDF5_TEST_VFD) set_tests_properties (VFD-${vfdname}-flush2 PROPERTIES TIMEOUT 10) if (HDF5_TEST_FHEAP_VFD) add_test ( - NAME VFD-${vfdname}-fheap + NAME VFD-${vfdname}-fheap COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$<TARGET_FILE:fheap>" -D "TEST_ARGS:STRING=" @@ -710,7 +717,7 @@ if (HDF5_TEST_VFD) ) endif (HDF5_TEST_FHEAP_VFD) ENDMACRO (ADD_VFD_TEST) - + # Run test with different Virtual File Driver foreach (vfd ${VFD_LIST}) ADD_VFD_TEST (${vfd} 0) diff --git a/test/cache.c b/test/cache.c index 8d6076a..9bf225e 100644 --- a/test/cache.c +++ b/test/cache.c @@ -271,7 +271,7 @@ smoke_check_1(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - row_major_scan_forward(/* file_ptr */ file_ptr, + row_major_scan_forward(/* file_ptr */ file_ptr, /* lag */ lag, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -289,7 +289,7 @@ smoke_check_1(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - row_major_scan_backward(/* file_ptr */ file_ptr, + row_major_scan_backward(/* file_ptr */ file_ptr, /* lag */ lag, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -307,7 +307,7 @@ smoke_check_1(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - row_major_scan_forward(/* file_ptr */ file_ptr, + row_major_scan_forward(/* file_ptr */ file_ptr, /* lag */ lag, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -336,7 +336,7 @@ smoke_check_1(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - col_major_scan_forward(/* file_ptr */ file_ptr, + col_major_scan_forward(/* file_ptr */ file_ptr, /* lag */ lag, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -360,7 +360,7 @@ smoke_check_1(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - col_major_scan_backward(/* file_ptr */ file_ptr, + col_major_scan_backward(/* file_ptr */ file_ptr, /* lag */ lag, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -456,7 +456,7 @@ smoke_check_2(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - row_major_scan_forward(/* file_ptr */ file_ptr, + row_major_scan_forward(/* file_ptr */ file_ptr, /* lag */ lag, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -474,7 +474,7 @@ smoke_check_2(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - row_major_scan_backward(/* file_ptr */ file_ptr, + row_major_scan_backward(/* file_ptr */ file_ptr, /* lag */ lag, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -492,7 +492,7 @@ smoke_check_2(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - row_major_scan_forward(/* file_ptr */ file_ptr, + row_major_scan_forward(/* file_ptr */ file_ptr, /* lag */ lag, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -521,7 +521,7 @@ smoke_check_2(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - col_major_scan_forward(/* file_ptr */ file_ptr, + col_major_scan_forward(/* file_ptr */ file_ptr, /* lag */ lag, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -545,7 +545,7 @@ smoke_check_2(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - col_major_scan_backward(/* file_ptr */ file_ptr, + col_major_scan_backward(/* file_ptr */ file_ptr, /* lag */ lag, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -640,7 +640,7 @@ smoke_check_3(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - row_major_scan_forward(/* file_ptr */ file_ptr, + row_major_scan_forward(/* file_ptr */ file_ptr, /* lag */ lag, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -825,7 +825,7 @@ smoke_check_4(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - row_major_scan_forward(/* file_ptr */ file_ptr, + row_major_scan_forward(/* file_ptr */ file_ptr, /* lag */ lag, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -843,7 +843,7 @@ smoke_check_4(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - row_major_scan_backward(/* file_ptr */ file_ptr, + row_major_scan_backward(/* file_ptr */ file_ptr, /* lag */ lag, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -861,7 +861,7 @@ smoke_check_4(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - row_major_scan_forward(/* file_ptr */ file_ptr, + row_major_scan_forward(/* file_ptr */ file_ptr, /* lag */ lag, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -890,7 +890,7 @@ smoke_check_4(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - col_major_scan_forward(/* file_ptr */ file_ptr, + col_major_scan_forward(/* file_ptr */ file_ptr, /* lag */ lag, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -914,7 +914,7 @@ smoke_check_4(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - col_major_scan_backward(/* file_ptr */ file_ptr, + col_major_scan_backward(/* file_ptr */ file_ptr, /* lag */ lag, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -13206,8 +13206,8 @@ check_expunge_entry(void) */ result = H5C_get_entry_status(file_ptr, entry_ptr->addr, &entry_size, - &in_cache, &is_dirty, &is_protected, - &is_pinned, NULL, NULL); + &in_cache, &is_dirty, &is_protected, + &is_pinned, NULL, NULL); if ( result < 0 ) { diff --git a/test/cache_common.c b/test/cache_common.c index cce87a9..12001b2 100644 --- a/test/cache_common.c +++ b/test/cache_common.c @@ -19,7 +19,6 @@ * This file contains common code for tests of the cache * implemented in H5C.c */ -#include "H5private.h" /* Put this first, so H5open() isn't invoked in public macros */ #include "h5test.h" #include "H5Cprivate.h" #include "H5Iprivate.h" @@ -799,7 +798,6 @@ notify_dest(H5F_t * f, void * thing) * *------------------------------------------------------------------------- */ - herr_t flush(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, @@ -871,7 +869,6 @@ flush(H5F_t *f, } return(SUCCEED); - } /* flush() */ herr_t @@ -962,7 +959,6 @@ notify_flush(H5F_t *f, hid_t dxpl_id, hbool_t dest, haddr_t addr, return(flush(f, dxpl_id, dest, addr, thing, flags_ptr)); } - /*------------------------------------------------------------------------- * Function: load & friends @@ -1108,7 +1104,6 @@ notify_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata) * *------------------------------------------------------------------------- */ - herr_t size(H5F_t H5_ATTR_UNUSED * f, void * thing, @@ -1134,7 +1129,6 @@ size(H5F_t H5_ATTR_UNUSED * f, *size_ptr = entry_ptr->size; return(SUCCEED); - } /* size() */ herr_t diff --git a/test/h5test.c b/test/h5test.c index d73c120..fefacda 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -700,21 +700,24 @@ h5_show_hostname(void) { char hostname[80]; #ifdef H5_HAVE_WIN32_API - WSADATA wsaData; - int err; + WSADATA wsaData; + int err; #endif /* try show the process or thread id in multiple processes cases*/ #ifdef H5_HAVE_PARALLEL { - int mpi_rank, mpi_initialized; - - MPI_Initialized(&mpi_initialized); - if (mpi_initialized){ - MPI_Comm_rank(MPI_COMM_WORLD,&mpi_rank); - printf("MPI-process %d.", mpi_rank); - }else - printf("thread 0."); + int mpi_rank, mpi_initialized, mpi_finalized; + + MPI_Initialized(&mpi_initialized); + MPI_Finalized(&mpi_finalized); + + if(mpi_initialized && !mpi_finalized) { + MPI_Comm_rank(MPI_COMM_WORLD,&mpi_rank); + printf("MPI-process %d.", mpi_rank); + } + else + printf("thread 0."); } #elif defined(H5_HAVE_THREADSAFE) printf("thread %lu.", HDpthread_self_ulong()); @@ -723,31 +726,31 @@ h5_show_hostname(void) #endif #ifdef H5_HAVE_WIN32_API - err = WSAStartup( MAKEWORD(2,2), &wsaData ); - if ( err != 0 ) { - /* could not find a usable WinSock DLL */ - return; - } - -/* Confirm that the WinSock DLL supports 2.2.*/ -/* Note that if the DLL supports versions greater */ -/* than 2.2 in addition to 2.2, it will still return */ -/* 2.2 in wVersion since that is the version we */ -/* requested. */ - - if ( LOBYTE( wsaData.wVersion ) != 2 || - HIBYTE( wsaData.wVersion ) != 2 ) { - /* could not find a usable WinSock DLL */ - WSACleanup( ); - return; - } + err = WSAStartup( MAKEWORD(2,2), &wsaData ); + if ( err != 0 ) { + /* could not find a usable WinSock DLL */ + return; + } + + /* Confirm that the WinSock DLL supports 2.2.*/ + /* Note that if the DLL supports versions greater */ + /* than 2.2 in addition to 2.2, it will still return */ + /* 2.2 in wVersion since that is the version we */ + /* requested. */ + + if ( LOBYTE( wsaData.wVersion ) != 2 || + HIBYTE( wsaData.wVersion ) != 2 ) { + /* could not find a usable WinSock DLL */ + WSACleanup( ); + return; + } #endif #ifdef H5_HAVE_GETHOSTNAME if (gethostname(hostname, (size_t)80) < 0) - printf(" gethostname failed\n"); + printf(" gethostname failed\n"); else - printf(" hostname=%s\n", hostname); + printf(" hostname=%s\n", hostname); #else printf(" gethostname not supported\n"); #endif @@ -1099,61 +1102,62 @@ int h5_szip_can_encode(void ) char * getenv_all(MPI_Comm comm, int root, const char* name) { - int mpi_size, mpi_rank, mpi_initialized; + int mpi_size, mpi_rank, mpi_initialized, mpi_finalized; int len; static char* env = NULL; assert(name); MPI_Initialized(&mpi_initialized); - if(!mpi_initialized) { - /* use original getenv */ - if(env) - HDfree(env); - env = HDgetenv(name); - } /* end if */ - else { - MPI_Comm_rank(comm, &mpi_rank); - MPI_Comm_size(comm, &mpi_size); - assert(root < mpi_size); - - /* The root task does the getenv call - * and sends the result to the other tasks */ - if(mpi_rank == root) { - env = HDgetenv(name); - if(env) { - len = (int)HDstrlen(env); - MPI_Bcast(&len, 1, MPI_INT, root, comm); - MPI_Bcast(env, len, MPI_CHAR, root, comm); - } - else { - /* len -1 indicates that the variable was not in the environment */ - len = -1; - MPI_Bcast(&len, 1, MPI_INT, root, comm); - } - } - else { - MPI_Bcast(&len, 1, MPI_INT, root, comm); - if(len >= 0) { - if(env == NULL) - env = (char*) HDmalloc((size_t)len+1); - else if(HDstrlen(env) < (size_t)len) - env = (char*) HDrealloc(env, (size_t)len+1); - - MPI_Bcast(env, len, MPI_CHAR, root, comm); - env[len] = '\0'; - } - else { - if(env) - HDfree(env); - env = NULL; - } - } - } - + MPI_Finalized(&mpi_finalized); + + if(mpi_initialized && !mpi_finalized) { + MPI_Comm_rank(comm, &mpi_rank); + MPI_Comm_size(comm, &mpi_size); + assert(root < mpi_size); + + /* The root task does the getenv call + * and sends the result to the other tasks */ + if(mpi_rank == root) { + env = HDgetenv(name); + if(env) { + len = (int)HDstrlen(env); + MPI_Bcast(&len, 1, MPI_INT, root, comm); + MPI_Bcast(env, len, MPI_CHAR, root, comm); + } + else { + /* len -1 indicates that the variable was not in the environment */ + len = -1; + MPI_Bcast(&len, 1, MPI_INT, root, comm); + } + } + else { + MPI_Bcast(&len, 1, MPI_INT, root, comm); + if(len >= 0) { + if(env == NULL) + env = (char*) HDmalloc((size_t)len+1); + else if(HDstrlen(env) < (size_t)len) + env = (char*) HDrealloc(env, (size_t)len+1); + + MPI_Bcast(env, len, MPI_CHAR, root, comm); + env[len] = '\0'; + } + else { + if(env) + HDfree(env); + env = NULL; + } + } #ifndef NDEBUG - MPI_Barrier(comm); + MPI_Barrier(comm); #endif + } + else { + /* use original getenv */ + if(env) + HDfree(env); + env = HDgetenv(name); + } /* end if */ return env; } diff --git a/testpar/CMakeLists.txt b/testpar/CMakeLists.txt index 70e0246..b02c8e2 100644 --- a/testpar/CMakeLists.txt +++ b/testpar/CMakeLists.txt @@ -48,6 +48,7 @@ set (H5P_TESTS t_pflush2 t_pshutdown t_prestart + t_init_term t_shapesame ) diff --git a/testpar/Makefile.am b/testpar/Makefile.am index 1eae439..4fe0ba8 100644 --- a/testpar/Makefile.am +++ b/testpar/Makefile.am @@ -25,7 +25,7 @@ AM_CPPFLAGS+=-I$(top_srcdir)/src -I$(top_srcdir)/test # Test programs. These are our main targets. # -TEST_PROG_PARA=t_mpi testphdf5 t_cache t_pflush1 t_pflush2 t_pshutdown t_prestart t_shapesame +TEST_PROG_PARA=t_mpi testphdf5 t_cache t_pflush1 t_pflush2 t_pshutdown t_prestart t_init_term t_shapesame check_PROGRAMS = $(TEST_PROG_PARA) @@ -40,7 +40,8 @@ LDADD = $(LIBH5TEST) $(LIBHDF5) # MPItest.h5 is from t_mpi # Para*.h5 are from testphdf # shutdown.h5 is from t_pshutdown +# after_mpi_fin.h5 is from t_init_term # go is used for debugging. See testphdf5.c. -CHECK_CLEANFILES+=MPItest.h5 Para*.h5 CacheTestDummy.h5 shutdown.h5 go +CHECK_CLEANFILES+=MPItest.h5 Para*.h5 CacheTestDummy.h5 shutdown.h5 after_mpi_fin.h5 go include $(top_srcdir)/config/conclude.am diff --git a/testpar/Makefile.in b/testpar/Makefile.in index ba1e43f..228d678 100644 --- a/testpar/Makefile.in +++ b/testpar/Makefile.in @@ -114,7 +114,7 @@ CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__EXEEXT_1 = t_mpi$(EXEEXT) testphdf5$(EXEEXT) t_cache$(EXEEXT) \ t_pflush1$(EXEEXT) t_pflush2$(EXEEXT) t_pshutdown$(EXEEXT) \ - t_prestart$(EXEEXT) t_shapesame$(EXEEXT) + t_prestart$(EXEEXT) t_init_term$(EXEEXT) t_shapesame$(EXEEXT) t_cache_SOURCES = t_cache.c t_cache_OBJECTS = t_cache.$(OBJEXT) t_cache_LDADD = $(LDADD) @@ -123,6 +123,10 @@ AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = +t_init_term_SOURCES = t_init_term.c +t_init_term_OBJECTS = t_init_term.$(OBJEXT) +t_init_term_LDADD = $(LDADD) +t_init_term_DEPENDENCIES = $(LIBH5TEST) $(LIBHDF5) t_mpi_SOURCES = t_mpi.c t_mpi_OBJECTS = t_mpi.$(OBJEXT) t_mpi_LDADD = $(LDADD) @@ -189,10 +193,10 @@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = -SOURCES = t_cache.c t_mpi.c t_pflush1.c t_pflush2.c t_prestart.c \ - t_pshutdown.c t_shapesame.c $(testphdf5_SOURCES) -DIST_SOURCES = t_cache.c t_mpi.c t_pflush1.c t_pflush2.c t_prestart.c \ - t_pshutdown.c t_shapesame.c $(testphdf5_SOURCES) +SOURCES = t_cache.c t_init_term.c t_mpi.c t_pflush1.c t_pflush2.c \ + t_prestart.c t_pshutdown.c t_shapesame.c $(testphdf5_SOURCES) +DIST_SOURCES = t_cache.c t_init_term.c t_mpi.c t_pflush1.c t_pflush2.c \ + t_prestart.c t_pshutdown.c t_shapesame.c $(testphdf5_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ @@ -701,13 +705,14 @@ TRACE = perl $(top_srcdir)/bin/trace # MPItest.h5 is from t_mpi # Para*.h5 are from testphdf # shutdown.h5 is from t_pshutdown +# after_mpi_fin.h5 is from t_init_term # go is used for debugging. See testphdf5.c. CHECK_CLEANFILES = *.chkexe *.chklog *.clog *.clog2 MPItest.h5 \ - Para*.h5 CacheTestDummy.h5 shutdown.h5 go + Para*.h5 CacheTestDummy.h5 shutdown.h5 after_mpi_fin.h5 go # Test programs. These are our main targets. # -TEST_PROG_PARA = t_mpi testphdf5 t_cache t_pflush1 t_pflush2 t_pshutdown t_prestart t_shapesame +TEST_PROG_PARA = t_mpi testphdf5 t_cache t_pflush1 t_pflush2 t_pshutdown t_prestart t_init_term t_shapesame testphdf5_SOURCES = testphdf5.c t_dset.c t_file.c t_file_image.c t_mdset.c \ t_ph5basic.c t_coll_chunk.c t_span_tree.c t_chunk_alloc.c t_filter_read.c \ t_prop.c @@ -784,6 +789,10 @@ t_cache$(EXEEXT): $(t_cache_OBJECTS) $(t_cache_DEPENDENCIES) $(EXTRA_t_cache_DEP @rm -f t_cache$(EXEEXT) $(AM_V_CCLD)$(LINK) $(t_cache_OBJECTS) $(t_cache_LDADD) $(LIBS) +t_init_term$(EXEEXT): $(t_init_term_OBJECTS) $(t_init_term_DEPENDENCIES) $(EXTRA_t_init_term_DEPENDENCIES) + @rm -f t_init_term$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_init_term_OBJECTS) $(t_init_term_LDADD) $(LIBS) + t_mpi$(EXEEXT): $(t_mpi_OBJECTS) $(t_mpi_DEPENDENCIES) $(EXTRA_t_mpi_DEPENDENCIES) @rm -f t_mpi$(EXEEXT) $(AM_V_CCLD)$(LINK) $(t_mpi_OBJECTS) $(t_mpi_LDADD) $(LIBS) @@ -825,6 +834,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_file.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_file_image.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_filter_read.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_init_term.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_mdset.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_mpi.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_pflush1.Po@am__quote@ diff --git a/testpar/t_cache.c b/testpar/t_cache.c index 91c1113..02792b1 100644 --- a/testpar/t_cache.c +++ b/testpar/t_cache.c @@ -31,6 +31,7 @@ #include "H5Iprivate.h" +#define BASE_ADDR (haddr_t)512 int nerrors = 0; @@ -767,7 +768,7 @@ init_data(void) 1974, 3194, 5168, 8362, 13539}; int i; int j = 0; - haddr_t addr = 512; + haddr_t addr = BASE_ADDR; /* this must hold so moves don't change entry size. */ HDassert( (NUM_DATA_ENTRIES / 2) % 20 == 0 ); @@ -4709,7 +4710,7 @@ verify_total_writes(int expected_total_writes) * Updated for the new local_len field in datum. * *****************************************************************************/ -void +static void unlock_entry(H5F_t * file_ptr, int32_t idx, unsigned int flags) diff --git a/testpar/t_init_term.c b/testpar/t_init_term.c new file mode 100644 index 0000000..824f773 --- /dev/null +++ b/testpar/t_init_term.c @@ -0,0 +1,76 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Programmer: Mohamad Chaarawi + * June 2015 + * + * Purpose: This test checks for the correct initialization and + * termination of the HDF5 library with MPI init and finalize. + */ + +#include "testphdf5.h" + +int nerrors = 0; /* errors count */ + +const char *FILENAME[] = { + "after_mpi_fin", + NULL +}; + +int +main (int argc, char **argv) +{ + int mpi_size, mpi_rank; + MPI_Comm comm = MPI_COMM_WORLD; + + /* Initialize and finalize MPI */ + MPI_Init(&argc, &argv); + MPI_Comm_size(comm, &mpi_size); + MPI_Comm_rank(comm, &mpi_rank); + + if(MAINPROCESS) + TESTING("Usage of Serial HDF5 after MPI_Finalize() is called"); + + MPI_Finalize(); + + nerrors += GetTestNumErrs(); + + /* test if we can initialize the library with MPI being finalized + and create a file serially */ + H5open(); + + if(mpi_rank == 0) { + char filename[1024]; + hid_t file_id; + + h5_fixname(FILENAME[0], H5P_DEFAULT, filename, sizeof filename); + file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + VRFY((file_id >= 0), "H5Fcreate succeeded"); + H5Fclose(file_id); + file_id = -1; + } + + H5close(); + + if(MAINPROCESS) { + if(0 == nerrors) + PASSED() + else + H5_FAILED() + } + + return (nerrors!=0); +} diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c index 10d150f..c820aff 100644 --- a/tools/lib/h5tools.c +++ b/tools/lib/h5tools.c @@ -54,9 +54,6 @@ unsigned long long packed_data_mask; /* mask in which packed bits to display */ /* module-scoped variables */ static int h5tools_init_g; /* if h5tools lib has been initialized */ -#ifdef H5_HAVE_PARALLEL -static int h5tools_mpi_init_g; /* if MPI_Init() has been called */ -#endif /* H5_HAVE_PARALLEL */ /* Names of VFDs */ static const char *drivernames[]={ @@ -516,11 +513,14 @@ h5tools_get_fapl(hid_t fapl, const char *driver, unsigned *drivernum) } #ifdef H5_HAVE_PARALLEL else if(!HDstrcmp(driver, drivernames[MPIO_IDX])) { + int mpi_initialized, mpi_finalized; + /* MPI-I/O Driver */ - /* check if MPI has been initialized. */ - if(!h5tools_mpi_init_g) - MPI_Initialized(&h5tools_mpi_init_g); - if(h5tools_mpi_init_g) { + /* check if MPI is available. */ + MPI_Initialized(&mpi_initialized); + MPI_Finalized(&mpi_finalized); + + if(mpi_initialized && !mpi_finalized) { if(H5Pset_fapl_mpio(new_fapl, MPI_COMM_WORLD, MPI_INFO_NULL) < 0) goto error; if(drivernum) |