summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt14
-rw-r--r--src/H5.c146
-rw-r--r--src/H5A.c191
-rw-r--r--src/H5AC.c207
-rw-r--r--src/H5ACmpio.c52
-rw-r--r--src/H5ACprivate.h30
-rw-r--r--src/H5Abtree2.c41
-rw-r--r--src/H5Adeprec.c18
-rw-r--r--src/H5Aint.c60
-rw-r--r--src/H5Apkg.h15
-rw-r--r--src/H5Atest.c2
-rw-r--r--src/H5B.c13
-rw-r--r--src/H5B2.c159
-rw-r--r--src/H5B2cache.c4
-rw-r--r--src/H5B2dbg.c44
-rw-r--r--src/H5B2hdr.c19
-rw-r--r--src/H5B2int.c520
-rw-r--r--src/H5B2pkg.h35
-rw-r--r--src/H5B2private.h10
-rw-r--r--src/H5B2test.c187
-rw-r--r--src/H5Bcache.c2
-rw-r--r--src/H5C.c1181
-rw-r--r--src/H5Cmpio.c332
-rw-r--r--src/H5Cpkg.h271
-rw-r--r--src/H5Cprivate.h18
-rw-r--r--src/H5D.c65
-rw-r--r--src/H5Dbtree2.c1491
-rw-r--r--src/H5Dchunk.c1129
-rw-r--r--src/H5Dcompact.c7
-rw-r--r--src/H5Dcontig.c58
-rw-r--r--src/H5Ddbg.c2
-rw-r--r--src/H5Ddeprec.c26
-rw-r--r--src/H5Dearray.c1740
-rw-r--r--src/H5Defl.c172
-rw-r--r--src/H5Dfarray.c1638
-rw-r--r--src/H5Dfill.c6
-rw-r--r--src/H5Dint.c273
-rw-r--r--src/H5Dio.c128
-rw-r--r--src/H5Dlayout.c288
-rw-r--r--src/H5Dmpio.c54
-rw-r--r--src/H5Doh.c20
-rw-r--r--src/H5Dpkg.h104
-rw-r--r--src/H5Dprivate.h1
-rw-r--r--src/H5Dpublic.h11
-rw-r--r--src/H5Dscatgath.c8
-rw-r--r--src/H5Dselect.c2
-rw-r--r--src/H5Dtest.c41
-rw-r--r--src/H5Dvirtual.c25
-rw-r--r--src/H5E.c5
-rw-r--r--src/H5EA.c198
-rw-r--r--src/H5EApkg.h60
-rw-r--r--src/H5EAprivate.h35
-rw-r--r--src/H5Eint.c5
-rw-r--r--src/H5Eprivate.h2
-rw-r--r--src/H5F.c101
-rw-r--r--src/H5FA.c37
-rw-r--r--src/H5FAprivate.h12
-rw-r--r--src/H5FDcore.c4
-rw-r--r--src/H5FDint.c38
-rw-r--r--src/H5FDlog.c14
-rw-r--r--src/H5FDmpio.c87
-rw-r--r--src/H5FDmulti.c12
-rw-r--r--src/H5FDprivate.h19
-rw-r--r--src/H5FDstdio.c21
-rw-r--r--src/H5FS.c4
-rw-r--r--src/H5FScache.c6
-rw-r--r--src/H5FSpkg.h4
-rw-r--r--src/H5FSprivate.h2
-rw-r--r--src/H5FSsection.c8
-rw-r--r--src/H5Faccum.c47
-rw-r--r--src/H5Fdeprec.c6
-rw-r--r--src/H5Fint.c82
-rw-r--r--src/H5Fio.c30
-rw-r--r--src/H5Fmount.c6
-rw-r--r--src/H5Fmpi.c98
-rw-r--r--src/H5Fpkg.h11
-rw-r--r--src/H5Fprivate.h39
-rw-r--r--src/H5Fpublic.h25
-rw-r--r--src/H5Fquery.c47
-rw-r--r--src/H5Fsuper.c16
-rw-r--r--src/H5Fsuper_cache.c5
-rw-r--r--src/H5Ftest.c2
-rw-r--r--src/H5G.c75
-rw-r--r--src/H5Gbtree2.c53
-rw-r--r--src/H5Gcache.c2
-rw-r--r--src/H5Gdeprec.c157
-rw-r--r--src/H5Gint.c14
-rw-r--r--src/H5Gobj.c2
-rw-r--r--src/H5Gprivate.h7
-rw-r--r--src/H5Gstab.c4
-rw-r--r--src/H5Gtest.c16
-rw-r--r--src/H5HFbtree2.c109
-rw-r--r--src/H5HFcache.c10
-rw-r--r--src/H5HFdblock.c4
-rw-r--r--src/H5HFhdr.c2
-rw-r--r--src/H5HFhuge.c6
-rw-r--r--src/H5HFiblock.c8
-rw-r--r--src/H5HFsection.c13
-rw-r--r--src/H5HFtiny.c5
-rw-r--r--src/H5HG.c40
-rw-r--r--src/H5HGpkg.h6
-rw-r--r--src/H5HLcache.c2
-rw-r--r--src/H5HLdblk.c2
-rw-r--r--src/H5I.c4
-rw-r--r--src/H5Itest.c2
-rw-r--r--src/H5L.c350
-rw-r--r--src/H5Lexternal.c32
-rw-r--r--src/H5Lprivate.h4
-rw-r--r--src/H5MF.c6
-rw-r--r--src/H5MFprivate.h9
-rw-r--r--src/H5MFsection.c4
-rw-r--r--src/H5MM.c377
-rw-r--r--src/H5MMprivate.h14
-rw-r--r--src/H5O.c155
-rw-r--r--src/H5Oainfo.c13
-rw-r--r--src/H5Oalloc.c16
-rw-r--r--src/H5Obogus.c30
-rw-r--r--src/H5Ocache.c14
-rw-r--r--src/H5Ochunk.c8
-rw-r--r--src/H5Ocopy.c68
-rw-r--r--src/H5Ofill.c6
-rw-r--r--src/H5Olayout.c314
-rw-r--r--src/H5Opkg.h15
-rw-r--r--src/H5Oprivate.h97
-rw-r--r--src/H5Otest.c50
-rw-r--r--src/H5P.c2
-rw-r--r--src/H5PL.c6
-rw-r--r--src/H5Pdapl.c384
-rw-r--r--src/H5Pdcpl.c184
-rw-r--r--src/H5Pdxpl.c33
-rw-r--r--src/H5Pfapl.c312
-rw-r--r--src/H5Pint.c131
-rw-r--r--src/H5Plapl.c22
-rw-r--r--src/H5Ppkg.h30
-rw-r--r--src/H5Pprivate.h53
-rw-r--r--src/H5Ppublic.h14
-rw-r--r--src/H5Ptest.c46
-rw-r--r--src/H5R.c23
-rw-r--r--src/H5Rdeprec.c4
-rw-r--r--src/H5S.c4
-rw-r--r--src/H5SM.c68
-rw-r--r--src/H5SMbtree2.c44
-rw-r--r--src/H5SMcache.c3
-rw-r--r--src/H5SMmessage.c39
-rw-r--r--src/H5SMpkg.h2
-rw-r--r--src/H5STprivate.h4
-rw-r--r--src/H5T.c364
-rw-r--r--src/H5TS.c17
-rw-r--r--src/H5Tcommit.c47
-rw-r--r--src/H5Tdeprec.c4
-rw-r--r--src/H5Tnative.c4
-rw-r--r--src/H5Tvlen.c8
-rw-r--r--src/H5VLint.c3
-rw-r--r--src/H5VLnative.c56
-rw-r--r--src/H5VMprivate.h16
-rw-r--r--src/H5Z.c2
-rw-r--r--src/H5Zscaleoffset.c6
-rw-r--r--src/H5Ztrans.c4
-rw-r--r--src/H5private.h103
-rw-r--r--src/H5public.h4
-rw-r--r--src/H5system.c133
-rw-r--r--src/H5timer.c2
-rw-r--r--src/H5trace.c38
-rw-r--r--src/H5win32defs.h27
-rw-r--r--src/Makefile.am12
-rw-r--r--src/libhdf5.settings.in76
166 files changed, 13104 insertions, 3303 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index d488179..c822e70 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -103,12 +103,15 @@ IDE_GENERATED_PROPERTIES ("H5CS" "${H5CS_HDRS}" "${H5CS_SRCS}" )
set (H5D_SRCS
${HDF5_SRC_DIR}/H5D.c
${HDF5_SRC_DIR}/H5Dbtree.c
+ ${HDF5_SRC_DIR}/H5Dbtree2.c
${HDF5_SRC_DIR}/H5Dchunk.c
${HDF5_SRC_DIR}/H5Dcompact.c
${HDF5_SRC_DIR}/H5Dcontig.c
${HDF5_SRC_DIR}/H5Ddbg.c
${HDF5_SRC_DIR}/H5Ddeprec.c
+ ${HDF5_SRC_DIR}/H5Dearray.c
${HDF5_SRC_DIR}/H5Defl.c
+ ${HDF5_SRC_DIR}/H5Dfarray.c
${HDF5_SRC_DIR}/H5Dfill.c
${HDF5_SRC_DIR}/H5Dint.c
${HDF5_SRC_DIR}/H5Dio.c
@@ -797,8 +800,7 @@ set (H5_GENERATED_HEADERS
${HDF5_SRC_DIR}/H5overflow.h
)
-option (HDF5_GENERATE_HEADERS "Rebuild Generated Files" ON)
-mark_as_advanced (HDF5_GENERATE_HEADERS)
+option (HDF5_GENERATE_HEADERS "Rebuild Generated Files" OFF)
if (HDF5_GENERATE_HEADERS)
set_source_files_properties(${H5_GENERATED_HEADERS} PROPERTIES GENERATED TRUE)
find_package (Perl)
@@ -874,11 +876,11 @@ set_target_properties (${HDF5_LIB_TARGET} PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
)
-option (HDF5_ENABLE_DEBUG_APIS "Turn on debugging in all packages" OFF)
+option (HDF5_ENABLE_DEBUG_APIS "Turn on extra debug output in all packages" OFF)
if (HDF5_ENABLE_DEBUG_APIS)
set_target_properties (${HDF5_LIB_TARGET} PROPERTIES
COMPILE_DEFINITIONS
- "H5Z_DEBUG;H5VM_DEBUG;H5T_DEBUG;H5S_DEBUG;H5P_DEBUG;H5O_DEBUG;H5MM_DEBUG;H5MF_DEBUG;H5I_DEBUG;H5HL_DEBUG;H5HG_DEBUG;H5G_DEBUG;H5F_DEBUG;H5E_DEBUG;H5D_DEBUG;H5B_DEBUG;H5AC_DEBUG"
+ "H5Z_DEBUG;H5T_DEBUG;H5ST_DEBUG;H5S_DEBUG;H5O_DEBUG;H5I_DEBUG;H5HL_DEBUG;H5F_DEBUG;H5D_DEBUG;H5B2_DEBUG;H5AC_DEBUG"
)
endif (HDF5_ENABLE_DEBUG_APIS)
set (install_targets ${HDF5_LIB_TARGET})
@@ -912,7 +914,7 @@ if (BUILD_SHARED_LIBS)
target_link_libraries (${HDF5_LIBSH_TARGET} ${MPI_C_LIBRARIES})
endif (H5_HAVE_PARALLEL AND MPI_C_FOUND)
set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_LIBSH_TARGET}")
- H5_SET_LIB_OPTIONS (${HDF5_LIBSH_TARGET} ${HDF5_LIB_NAME} SHARED)
+ H5_SET_LIB_OPTIONS (${HDF5_LIBSH_TARGET} ${HDF5_LIB_NAME} SHARED ${HDF5_PACKAGE_SOVERSION})
set_target_properties (${HDF5_LIBSH_TARGET} PROPERTIES
FOLDER libraries
COMPILE_DEFINITIONS "H5_BUILT_AS_DYNAMIC_LIB"
@@ -930,7 +932,7 @@ if (BUILD_SHARED_LIBS)
if (HDF5_ENABLE_DEBUG_APIS)
set_property (TARGET ${HDF5_LIBSH_TARGET}
APPEND PROPERTY COMPILE_DEFINITIONS
- "H5Z_DEBUG;H5VM_DEBUG;H5T_DEBUG;H5S_DEBUG;H5P_DEBUG;H5O_DEBUG;H5MM_DEBUG;H5MF_DEBUG;H5I_DEBUG;H5HL_DEBUG;H5HG_DEBUG;H5G_DEBUG;H5F_DEBUG;H5E_DEBUG;H5D_DEBUG;H5B_DEBUG;H5AC_DEBUG"
+ "H5Z_DEBUG;H5T_DEBUG;H5ST_DEBUG;H5S_DEBUG;H5O_DEBUG;H5I_DEBUG;H5HL_DEBUG;H5F_DEBUG;H5D_DEBUG;H5B2_DEBUG;H5AC_DEBUG"
)
endif (HDF5_ENABLE_DEBUG_APIS)
set (install_targets ${install_targets} ${HDF5_LIBSH_TARGET})
diff --git a/src/H5.c b/src/H5.c
index 85e8b91..81b54c6 100644
--- a/src/H5.c
+++ b/src/H5.c
@@ -195,7 +195,8 @@ H5_init_library(void)
/* Normal library termination code */
(void)HDatexit(H5_term_library);
- H5_dont_atexit_g = TRUE;
+
+ H5_dont_atexit_g = TRUE;
} /* end if */
/*
@@ -401,6 +402,11 @@ H5_term_library(void)
(void)H5MM_free(tmp_open_stream);
} /* end while */
+#if defined H5_MEMORY_ALLOC_SANITY_CHECK
+ /* Sanity check memory allocations */
+ H5MM_final_sanity_check();
+#endif /* H5_MEMORY_ALLOC_SANITY_CHECK */
+
/* Reset flag indicating that the library is being shut down */
H5_TERM_GLOBAL = FALSE;
@@ -552,30 +558,29 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5_debug_mask
+ * Function: H5_debug_mask
*
- * Purpose: Set runtime debugging flags according to the string S. The
- * string should contain file numbers and package names
- * separated by other characters. A file number applies to all
- * following package names up to the next file number. The
- * initial file number is `2' (the standard error stream). Each
- * package name can be preceded by a `+' or `-' to add or remove
- * the package from the debugging list (`+' is the default). The
- * special name `all' means all packages.
+ * Purpose: Set runtime debugging flags according to the string S. The
+ * string should contain file numbers and package names
+ * separated by other characters. A file number applies to all
+ * following package names up to the next file number. The
+ * initial file number is `2' (the standard error stream). Each
+ * package name can be preceded by a `+' or `-' to add or remove
+ * the package from the debugging list (`+' is the default). The
+ * special name `all' means all packages.
*
- * The name `trace' indicates that API tracing is to be turned
- * on or off.
+ * The name `trace' indicates that API tracing is to be turned
+ * on or off.
*
- * Return: void
+ * The name 'ttop' indicates that only top-level API calls
+ * should be shown. This also turns on tracing as if the
+ * 'trace' word was shown.
*
- * Programmer: Robb Matzke
+ * Return: void
+ *
+ * Programmer: Robb Matzke
* Wednesday, August 19, 1998
*
- * Modifications:
- * Robb Matzke, 2002-08-08
- * Accepts the `ttop' word. If enabled then show only the
- * top level API calls, otherwise show all API calls. Also
- * turns on tracing as if the `trace' word was present.
*-------------------------------------------------------------------------
*/
static void
@@ -587,55 +592,57 @@ H5_debug_mask(const char *s)
hbool_t clear;
while (s && *s) {
- if (HDisalpha(*s) || '-'==*s || '+'==*s) {
- /* Enable or Disable debugging? */
- if ('-'==*s) {
- clear = TRUE;
- s++;
- } else if ('+'==*s) {
- clear = FALSE;
- s++;
- } else {
- clear = FALSE;
- }
-
- /* Get the name */
- for (i=0; HDisalpha(*s); i++, s++)
- if (i<sizeof pkg_name)
+
+ if (HDisalpha(*s) || '-'==*s || '+'==*s) {
+
+ /* Enable or Disable debugging? */
+ if ('-'==*s) {
+ clear = TRUE;
+ s++;
+ } else if ('+'==*s) {
+ clear = FALSE;
+ s++;
+ } else {
+ clear = FALSE;
+ } /* end if */
+
+ /* Get the name */
+ for (i=0; HDisalpha(*s); i++, s++)
+ if (i<sizeof pkg_name)
pkg_name[i] = *s;
- pkg_name[MIN(sizeof(pkg_name)-1, i)] = '\0';
+ pkg_name[MIN(sizeof(pkg_name)-1, i)] = '\0';
- /* Trace, all, or one? */
- if (!HDstrcmp(pkg_name, "trace")) {
- H5_debug_g.trace = clear ? NULL : stream;
+ /* Trace, all, or one? */
+ if (!HDstrcmp(pkg_name, "trace")) {
+ H5_debug_g.trace = clear ? NULL : stream;
} else if (!HDstrcmp(pkg_name, "ttop")) {
H5_debug_g.trace = stream;
H5_debug_g.ttop = (hbool_t)!clear;
} else if (!HDstrcmp(pkg_name, "ttimes")) {
H5_debug_g.trace = stream;
H5_debug_g.ttimes = (hbool_t)!clear;
- } else if (!HDstrcmp(pkg_name, "all")) {
- for (i=0; i<(size_t)H5_NPKGS; i++)
- H5_debug_g.pkg[i].stream = clear ? NULL : stream;
- } else {
- for (i=0; i<(size_t)H5_NPKGS; i++) {
- if (!HDstrcmp(H5_debug_g.pkg[i].name, pkg_name)) {
- H5_debug_g.pkg[i].stream = clear ? NULL : stream;
- break;
- }
- }
- if (i>=(size_t)H5_NPKGS)
- fprintf(stderr, "HDF5_DEBUG: ignored %s\n", pkg_name);
- }
-
- } else if (HDisdigit(*s)) {
- int fd = (int)HDstrtol(s, &rest, 0);
- H5_debug_open_stream_t *open_stream;
-
- if((stream = HDfdopen(fd, "w")) != NULL) {
- (void)HDsetvbuf(stream, NULL, _IOLBF, (size_t)0);
-
- if(NULL == (open_stream = (H5_debug_open_stream_t *)H5MM_malloc(sizeof(H5_debug_open_stream_t)))) {
+ } else if (!HDstrcmp(pkg_name, "all")) {
+ for (i=0; i<(size_t)H5_NPKGS; i++)
+ H5_debug_g.pkg[i].stream = clear ? NULL : stream;
+ } else {
+ for (i=0; i<(size_t)H5_NPKGS; i++) {
+ if (!HDstrcmp(H5_debug_g.pkg[i].name, pkg_name)) {
+ H5_debug_g.pkg[i].stream = clear ? NULL : stream;
+ break;
+ } /* end if */
+ } /* end for */
+ if (i>=(size_t)H5_NPKGS)
+ fprintf(stderr, "HDF5_DEBUG: ignored %s\n", pkg_name);
+ } /* end if-else */
+
+ } else if (HDisdigit(*s)) {
+ int fd = (int)HDstrtol(s, &rest, 0);
+ H5_debug_open_stream_t *open_stream;
+
+ if((stream = HDfdopen(fd, "w")) != NULL) {
+ (void)HDsetvbuf(stream, NULL, _IOLBF, (size_t)0);
+
+ if(NULL == (open_stream = (H5_debug_open_stream_t *)H5MM_malloc(sizeof(H5_debug_open_stream_t)))) {
(void)HDfclose(stream);
return;
} /* end if */
@@ -644,11 +651,15 @@ H5_debug_mask(const char *s)
open_stream->next = H5_debug_g.open_stream;
H5_debug_g.open_stream = open_stream;
} /* end if */
- s = rest;
- } else {
- s++;
- }
- }
+
+ s = rest;
+ } else {
+ s++;
+ } /* end if-else */
+ } /* end while */
+
+ return;
+
} /* end H5_debug_mask() */
#ifdef H5_HAVE_PARALLEL
@@ -947,7 +958,6 @@ H5allocate_memory(size_t size, hbool_t clear)
ret_value = H5MM_malloc(size);
FUNC_LEAVE_API(ret_value)
-
} /* end H5allocate_memory() */
@@ -986,7 +996,6 @@ H5resize_memory(void *mem, size_t size)
ret_value = H5MM_realloc(mem, size);
FUNC_LEAVE_API(ret_value)
-
} /* end H5resize_memory() */
@@ -1009,10 +1018,9 @@ H5free_memory(void *mem)
H5TRACE1("e", "*x", mem);
/* At this time, it is impossible for this to fail. */
- HDfree(mem);
+ H5MM_xfree(mem);
FUNC_LEAVE_API(SUCCEED)
-
} /* end H5free_memory() */
diff --git a/src/H5A.c b/src/H5A.c
index c3abfcb..ddf7693 100644
--- a/src/H5A.c
+++ b/src/H5A.c
@@ -247,12 +247,13 @@ H5A_term_package(void)
--------------------------------------------------------------------------*/
hid_t
H5Acreate2(hid_t loc_id, const char *attr_name, hid_t type_id, hid_t space_id,
- hid_t acpl_id, hid_t H5_ATTR_UNUSED aapl_id)
+ hid_t acpl_id, hid_t aapl_id)
{
void *attr = NULL; /* attr token from VOL plugin */
H5VL_object_t *obj = NULL; /* object token of loc_id */
H5P_genplist_t *plist; /* Property list pointer */
H5VL_loc_params_t loc_params;
+ hid_t dxpl_id = H5AC_ind_read_dxpl_id; /* dxpl used by library */
hid_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -268,6 +269,10 @@ H5Acreate2(hid_t loc_id, const char *attr_name, hid_t type_id, hid_t space_id,
if(H5P_DEFAULT == acpl_id)
acpl_id = H5P_ATTRIBUTE_CREATE_DEFAULT;
+ /* Verify access property list and get correct dxpl */
+ if(H5P_verify_apl_and_dxpl(&aapl_id, H5P_CLS_AACC, &dxpl_id, loc_id, TRUE) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists")
+
/* Get the plist structure */
if(NULL == (plist = (H5P_genplist_t *)H5I_object(acpl_id)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
@@ -287,7 +292,7 @@ H5Acreate2(hid_t loc_id, const char *attr_name, hid_t type_id, hid_t space_id,
/* Create the attribute through the VOL */
if(NULL == (attr = H5VL_attr_create(obj->vol_obj, loc_params, obj->vol_info->vol_cls, attr_name,
- acpl_id, aapl_id, H5AC_dxpl_id, H5_REQUEST_NULL)))
+ acpl_id, aapl_id, dxpl_id, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create attribute")
/* Get an atom for the attribute */
@@ -296,7 +301,7 @@ H5Acreate2(hid_t loc_id, const char *attr_name, hid_t type_id, hid_t space_id,
done:
if (ret_value < 0 && attr)
- if(H5VL_attr_close(attr, obj->vol_info->vol_cls, H5AC_dxpl_id, H5_REQUEST_NULL) < 0)
+ if(H5VL_attr_close(attr, obj->vol_info->vol_cls, dxpl_id, H5_REQUEST_NULL) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "unable to release attr")
FUNC_LEAVE_API(ret_value)
@@ -335,13 +340,14 @@ done:
--------------------------------------------------------------------------*/
hid_t
H5Acreate_by_name(hid_t loc_id, const char *obj_name, const char *attr_name,
- hid_t type_id, hid_t space_id, hid_t acpl_id, hid_t H5_ATTR_UNUSED aapl_id,
+ hid_t type_id, hid_t space_id, hid_t acpl_id, hid_t aapl_id,
hid_t lapl_id)
{
void *attr = NULL; /* attr token from VOL plugin */
H5VL_object_t *obj = NULL; /* object token of loc_id */
H5P_genplist_t *plist; /* Property list pointer */
H5VL_loc_params_t loc_params;
+ hid_t dxpl_id = H5AC_ind_read_dxpl_id; /* dxpl used by library */
hid_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -360,6 +366,10 @@ H5Acreate_by_name(hid_t loc_id, const char *obj_name, const char *attr_name,
if(H5P_DEFAULT == acpl_id)
acpl_id = H5P_ATTRIBUTE_CREATE_DEFAULT;
+ /* Verify access property list and get correct dxpl */
+ if(H5P_verify_apl_and_dxpl(&aapl_id, H5P_CLS_AACC, &dxpl_id, loc_id, TRUE) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists")
+
/* Get the plist structure */
if(NULL == (plist = (H5P_genplist_t *)H5I_object(acpl_id)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
@@ -381,7 +391,7 @@ H5Acreate_by_name(hid_t loc_id, const char *obj_name, const char *attr_name,
/* Create the attribute through the VOL */
if(NULL == (attr = H5VL_attr_create(obj->vol_obj, loc_params, obj->vol_info->vol_cls, attr_name,
- acpl_id, aapl_id, H5AC_dxpl_id, H5_REQUEST_NULL)))
+ acpl_id, aapl_id, dxpl_id, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create attribute")
/* Get an atom for the attribute */
@@ -390,7 +400,7 @@ H5Acreate_by_name(hid_t loc_id, const char *obj_name, const char *attr_name,
done:
if (ret_value < 0 && attr)
- if(H5VL_attr_close (attr, obj->vol_info->vol_cls, H5AC_dxpl_id, H5_REQUEST_NULL) < 0)
+ if(H5VL_attr_close (attr, obj->vol_info->vol_cls, dxpl_id, H5_REQUEST_NULL) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "unable to release attr")
FUNC_LEAVE_API(ret_value)
} /* H5Acreate_by_name() */
@@ -416,11 +426,12 @@ done:
H5Aclose or resource leaks will develop.
--------------------------------------------------------------------------*/
hid_t
-H5Aopen(hid_t loc_id, const char *attr_name, hid_t H5_ATTR_UNUSED aapl_id)
+H5Aopen(hid_t loc_id, const char *attr_name, hid_t aapl_id)
{
void *attr = NULL; /* attr token from VOL plugin */
H5VL_object_t *obj = NULL; /* object token of loc_id */
H5VL_loc_params_t loc_params;
+ hid_t dxpl_id = H5AC_ind_read_dxpl_id; /* dxpl used by library */
hid_t ret_value;
FUNC_ENTER_API(FAIL)
@@ -432,6 +443,10 @@ H5Aopen(hid_t loc_id, const char *attr_name, hid_t H5_ATTR_UNUSED aapl_id)
if(!attr_name || !*attr_name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name")
+ /* Verify access property list and get correct dxpl */
+ if(H5P_verify_apl_and_dxpl(&aapl_id, H5P_CLS_AACC, &dxpl_id, loc_id, FALSE) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists")
+
loc_params.type = H5VL_OBJECT_BY_SELF;
loc_params.obj_type = H5I_get_type(loc_id);
@@ -441,7 +456,7 @@ H5Aopen(hid_t loc_id, const char *attr_name, hid_t H5_ATTR_UNUSED aapl_id)
/* Open the attribute through the VOL */
if(NULL == (attr = H5VL_attr_open(obj->vol_obj, loc_params, obj->vol_info->vol_cls,
- attr_name, aapl_id, H5AC_ind_dxpl_id, H5_REQUEST_NULL)))
+ attr_name, aapl_id, dxpl_id, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open attribute")
/* Get an atom for the attribute */
@@ -450,7 +465,7 @@ H5Aopen(hid_t loc_id, const char *attr_name, hid_t H5_ATTR_UNUSED aapl_id)
done:
if (ret_value < 0 && attr)
- if(H5VL_attr_close (attr, obj->vol_info->vol_cls, H5AC_dxpl_id, H5_REQUEST_NULL) < 0)
+ if(H5VL_attr_close (attr, obj->vol_info->vol_cls, dxpl_id, H5_REQUEST_NULL) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "unable to release attr")
FUNC_LEAVE_API(ret_value)
} /* H5Aopen() */
@@ -479,11 +494,12 @@ done:
--------------------------------------------------------------------------*/
hid_t
H5Aopen_by_name(hid_t loc_id, const char *obj_name, const char *attr_name,
- hid_t H5_ATTR_UNUSED aapl_id, hid_t lapl_id)
+ hid_t aapl_id, hid_t lapl_id)
{
void *attr = NULL; /* attr token from VOL plugin */
H5VL_object_t *obj = NULL; /* object token of loc_id */
H5VL_loc_params_t loc_params;
+ hid_t dxpl_id = H5AC_ind_read_dxpl_id; /* dxpl used by library */
hid_t ret_value;
FUNC_ENTER_API(FAIL)
@@ -502,6 +518,10 @@ H5Aopen_by_name(hid_t loc_id, const char *obj_name, const char *attr_name,
if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID")
+ /* Verify access property list and get correct dxpl */
+ if(H5P_verify_apl_and_dxpl(&aapl_id, H5P_CLS_AACC, &dxpl_id, loc_id, FALSE) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists")
+
loc_params.type = H5VL_OBJECT_BY_NAME;
loc_params.loc_data.loc_by_name.name = obj_name;
loc_params.loc_data.loc_by_name.lapl_id = lapl_id;
@@ -513,7 +533,7 @@ H5Aopen_by_name(hid_t loc_id, const char *obj_name, const char *attr_name,
/* Open the attribute through the VOL */
if(NULL == (attr = H5VL_attr_open(obj->vol_obj, loc_params, obj->vol_info->vol_cls,
- attr_name, aapl_id, H5AC_ind_dxpl_id, H5_REQUEST_NULL)))
+ attr_name, aapl_id, dxpl_id, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open attribute")
/* Get an atom for the attribute */
@@ -522,7 +542,7 @@ H5Aopen_by_name(hid_t loc_id, const char *obj_name, const char *attr_name,
done:
if (ret_value < 0 && attr)
- if(H5VL_attr_close (attr, obj->vol_info->vol_cls, H5AC_dxpl_id, H5_REQUEST_NULL) < 0)
+ if(H5VL_attr_close (attr, obj->vol_info->vol_cls, dxpl_id, H5_REQUEST_NULL) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "unable to release attr")
FUNC_LEAVE_API(ret_value)
@@ -555,11 +575,12 @@ done:
--------------------------------------------------------------------------*/
hid_t
H5Aopen_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
- H5_iter_order_t order, hsize_t n, hid_t H5_ATTR_UNUSED aapl_id, hid_t lapl_id)
+ H5_iter_order_t order, hsize_t n, hid_t aapl_id, hid_t lapl_id)
{
void *attr = NULL; /* attr token from VOL plugin */
H5VL_object_t *obj = NULL; /* object token of loc_id */
H5VL_loc_params_t loc_params;
+ hid_t dxpl_id = H5AC_ind_read_dxpl_id; /* dxpl used by library */
hid_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -581,6 +602,10 @@ H5Aopen_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID")
+ /* Verify access property list and get correct dxpl */
+ if(H5P_verify_apl_and_dxpl(&aapl_id, H5P_CLS_AACC, &dxpl_id, loc_id, FALSE) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists")
+
loc_params.type = H5VL_OBJECT_BY_IDX;
loc_params.loc_data.loc_by_idx.name = obj_name;
loc_params.loc_data.loc_by_idx.idx_type = idx_type;
@@ -595,7 +620,7 @@ H5Aopen_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
/* Open the attribute through the VOL */
if(NULL == (attr = H5VL_attr_open(obj->vol_obj, loc_params, obj->vol_info->vol_cls,
- NULL, aapl_id, H5AC_ind_dxpl_id, H5_REQUEST_NULL)))
+ NULL, aapl_id, dxpl_id, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open attribute")
/* Get an atom for the attribute */
@@ -604,7 +629,7 @@ H5Aopen_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
done:
if (ret_value < 0 && attr)
- if(H5VL_attr_close (attr, obj->vol_info->vol_cls, H5AC_dxpl_id, H5_REQUEST_NULL) < 0)
+ if(H5VL_attr_close (attr, obj->vol_info->vol_cls, dxpl_id, H5_REQUEST_NULL) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "unable to release attr")
FUNC_LEAVE_API(ret_value)
} /* H5Aopen_by_idx() */
@@ -630,6 +655,8 @@ herr_t
H5Awrite(hid_t attr_id, hid_t dtype_id, const void *buf)
{
H5VL_object_t *attr;
+ hid_t dxpl_id = H5AC_ind_read_dxpl_id; /* dxpl used by library */
+ hid_t aapl_id = H5P_DEFAULT; /* temp access plist */
herr_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -641,9 +668,13 @@ H5Awrite(hid_t attr_id, hid_t dtype_id, const void *buf)
if(NULL == buf)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "null attribute buffer")
+ /* Verify access property list and get correct dxpl */
+ if(H5P_verify_apl_and_dxpl(&aapl_id, H5P_CLS_AACC, &dxpl_id, attr_id, TRUE) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists")
+
/* write the data through the VOL */
if((ret_value = H5VL_attr_write(attr->vol_obj, attr->vol_info->vol_cls,
- dtype_id, buf, H5AC_dxpl_id, H5_REQUEST_NULL)) < 0)
+ dtype_id, buf, dxpl_id, H5_REQUEST_NULL)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_READERROR, FAIL, "can't read data")
done:
@@ -671,6 +702,8 @@ herr_t
H5Aread(hid_t attr_id, hid_t dtype_id, void *buf)
{
H5VL_object_t *attr;
+ hid_t dxpl_id = H5AC_ind_read_dxpl_id; /* dxpl used by library */
+ hid_t aapl_id = H5P_DEFAULT; /* temp access plist */
herr_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -682,9 +715,13 @@ H5Aread(hid_t attr_id, hid_t dtype_id, void *buf)
if(NULL == buf)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "null attribute buffer")
+ /* Verify access property list and get correct dxpl */
+ if(H5P_verify_apl_and_dxpl(&aapl_id, H5P_CLS_AACC, &dxpl_id, attr_id, FALSE) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists")
+
/* Read the data through the VOL */
if((ret_value = H5VL_attr_read(attr->vol_obj, attr->vol_info->vol_cls,
- dtype_id, buf, H5AC_ind_dxpl_id, H5_REQUEST_NULL)) < 0)
+ dtype_id, buf, dxpl_id, H5_REQUEST_NULL)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_READERROR, FAIL, "can't read data")
done:
@@ -712,7 +749,6 @@ hid_t
H5Aget_space(hid_t attr_id)
{
H5VL_object_t *attr;
- H5S_t *ds = NULL;
hid_t ret_value;
FUNC_ENTER_API(FAIL)
@@ -724,7 +760,7 @@ H5Aget_space(hid_t attr_id)
/* get the dataspace through the VOL */
if(H5VL_attr_get(attr->vol_obj, attr->vol_info->vol_cls, H5VL_ATTR_GET_SPACE,
- H5AC_dxpl_id, H5_REQUEST_NULL, &ret_value) < 0)
+ H5AC_ind_read_dxpl_id, H5_REQUEST_NULL, &ret_value) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get data space")
done:
@@ -752,7 +788,6 @@ hid_t
H5Aget_type(hid_t attr_id)
{
H5VL_object_t *attr;
- H5T_t *dt = NULL;
hid_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -764,7 +799,7 @@ H5Aget_type(hid_t attr_id)
/* get the datatype through the VOL */
if(H5VL_attr_get(attr->vol_obj, attr->vol_info->vol_cls, H5VL_ATTR_GET_TYPE,
- H5AC_dxpl_id, H5_REQUEST_NULL, &ret_value) < 0)
+ H5AC_ind_read_dxpl_id, H5_REQUEST_NULL, &ret_value) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get type")
done:
@@ -808,7 +843,7 @@ H5Aget_create_plist(hid_t attr_id)
/* get the acpl through the VOL */
if(H5VL_attr_get(attr->vol_obj, attr->vol_info->vol_cls, H5VL_ATTR_GET_ACPL,
- H5AC_dxpl_id, H5_REQUEST_NULL, &ret_value) < 0)
+ H5AC_ind_read_dxpl_id, H5_REQUEST_NULL, &ret_value) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get acpl")
done:
@@ -858,7 +893,7 @@ H5Aget_name(hid_t attr_id, size_t buf_size, char *buf)
/* get the name through the VOL */
if(H5VL_attr_get(attr->vol_obj, attr->vol_info->vol_cls, H5VL_ATTR_GET_NAME,
- H5AC_ind_dxpl_id, H5_REQUEST_NULL,
+ H5AC_ind_read_dxpl_id, H5_REQUEST_NULL,
loc_params, buf_size, buf, &ret_value) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get name")
@@ -891,6 +926,7 @@ H5Aget_name_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
{
H5VL_object_t *obj;
H5VL_loc_params_t loc_params;
+ hid_t dxpl_id = H5AC_ind_read_dxpl_id; /* dxpl used by library */
ssize_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -906,11 +942,10 @@ H5Aget_name_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
- if(H5P_DEFAULT == lapl_id)
- lapl_id = H5P_LINK_ACCESS_DEFAULT;
- else
- if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID")
+
+ /* Verify access property list and get correct dxpl */
+ if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, loc_id, FALSE) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists")
/* get the object */
if(NULL == (obj = H5VL_get_object(loc_id)))
@@ -926,7 +961,7 @@ H5Aget_name_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
/* get the name through the VOL */
if(H5VL_attr_get(obj->vol_obj, obj->vol_info->vol_cls, H5VL_ATTR_GET_NAME,
- H5AC_ind_dxpl_id, H5_REQUEST_NULL, loc_params, size, name, &ret_value) < 0)
+ dxpl_id, H5_REQUEST_NULL, loc_params, size, name, &ret_value) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get name")
done:
@@ -966,7 +1001,7 @@ H5Aget_storage_size(hid_t attr_id)
/* get the storage size through the VOL */
if(H5VL_attr_get(attr->vol_obj, attr->vol_info->vol_cls, H5VL_ATTR_GET_STORAGE_SIZE,
- H5AC_dxpl_id, H5_REQUEST_NULL, &ret_value) < 0)
+ H5AC_ind_read_dxpl_id, H5_REQUEST_NULL, &ret_value) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, 0, "unable to get acpl")
done:
@@ -1006,7 +1041,7 @@ H5Aget_info(hid_t attr_id, H5A_info_t *ainfo)
/* get the attribute info through the VOL */
if(H5VL_attr_get(attr->vol_obj, attr->vol_info->vol_cls, H5VL_ATTR_GET_INFO,
- H5AC_ind_dxpl_id, H5_REQUEST_NULL, loc_params, ainfo) < 0)
+ H5AC_ind_read_dxpl_id, H5_REQUEST_NULL, loc_params, ainfo) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get attribute info")
done:
@@ -1033,6 +1068,7 @@ H5Aget_info_by_name(hid_t loc_id, const char *obj_name, const char *attr_name,
{
H5VL_object_t *obj;
H5VL_loc_params_t loc_params;
+ hid_t dxpl_id = H5AC_ind_read_dxpl_id; /* dxpl used by library */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -1047,11 +1083,10 @@ H5Aget_info_by_name(hid_t loc_id, const char *obj_name, const char *attr_name,
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name")
if(NULL == ainfo)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid info pointer")
- if(H5P_DEFAULT == lapl_id)
- lapl_id = H5P_LINK_ACCESS_DEFAULT;
- else
- if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID")
+
+ /* Verify access property list and get correct dxpl */
+ if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, loc_id, FALSE) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists")
loc_params.type = H5VL_OBJECT_BY_NAME;
loc_params.loc_data.loc_by_name.name = obj_name;
@@ -1064,7 +1099,7 @@ H5Aget_info_by_name(hid_t loc_id, const char *obj_name, const char *attr_name,
/* get the attribute info through the VOL */
if(H5VL_attr_get(obj->vol_obj, obj->vol_info->vol_cls, H5VL_ATTR_GET_INFO,
- H5AC_ind_dxpl_id, H5_REQUEST_NULL, loc_params, ainfo, attr_name) < 0)
+ dxpl_id, H5_REQUEST_NULL, loc_params, ainfo, attr_name) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get attribute info")
done:
@@ -1092,6 +1127,7 @@ H5Aget_info_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
{
H5VL_object_t *obj;
H5VL_loc_params_t loc_params;
+ hid_t dxpl_id = H5AC_ind_read_dxpl_id; /* dxpl used by library */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -1109,11 +1145,10 @@ H5Aget_info_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
if(NULL == ainfo)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid info pointer")
- if(H5P_DEFAULT == lapl_id)
- lapl_id = H5P_LINK_ACCESS_DEFAULT;
- else
- if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID")
+
+ /* Verify access property list and get correct dxpl */
+ if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, loc_id, FALSE) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists")
loc_params.type = H5VL_OBJECT_BY_IDX;
loc_params.loc_data.loc_by_idx.name = obj_name;
@@ -1129,7 +1164,7 @@ H5Aget_info_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
/* get the attribute info through the VOL */
if(H5VL_attr_get(obj->vol_obj, obj->vol_info->vol_cls, H5VL_ATTR_GET_INFO,
- H5AC_ind_dxpl_id, H5_REQUEST_NULL, loc_params, ainfo) < 0)
+ dxpl_id, H5_REQUEST_NULL, loc_params, ainfo) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get attribute info")
done:
@@ -1178,7 +1213,7 @@ H5Arename(hid_t loc_id, const char *old_name, const char *new_name)
/* rename the attribute info through the VOL */
if((ret_value = H5VL_attr_specific(obj->vol_obj, loc_params, obj->vol_info->vol_cls, H5VL_ATTR_RENAME,
- H5AC_dxpl_id, H5_REQUEST_NULL, old_name, new_name)) < 0)
+ H5AC_ind_read_dxpl_id, H5_REQUEST_NULL, old_name, new_name)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute")
}
done:
@@ -1218,16 +1253,16 @@ H5Arename_by_name(hid_t loc_id, const char *obj_name, const char *old_attr_name,
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no old attribute name")
if(!new_attr_name || !*new_attr_name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no new attribute name")
- if(H5P_DEFAULT == lapl_id)
- lapl_id = H5P_LINK_ACCESS_DEFAULT;
- else
- if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID")
/* Avoid thrashing things if the names are the same */
if(HDstrcmp(old_attr_name, new_attr_name)) {
H5VL_object_t *obj;
H5VL_loc_params_t loc_params;
+ hid_t dxpl_id = H5AC_ind_read_dxpl_id; /* dxpl used by the library */
+
+ /* Verify access property list and get correct dxpl */
+ if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, loc_id, TRUE) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists")
loc_params.type = H5VL_OBJECT_BY_NAME;
loc_params.loc_data.loc_by_name.name = obj_name;
@@ -1240,7 +1275,7 @@ H5Arename_by_name(hid_t loc_id, const char *obj_name, const char *old_attr_name,
/* rename the attribute info through the VOL */
if((ret_value = H5VL_attr_specific(obj->vol_obj, loc_params, obj->vol_info->vol_cls, H5VL_ATTR_RENAME,
- H5AC_dxpl_id, H5_REQUEST_NULL, old_attr_name, new_attr_name)) < 0)
+ dxpl_id, H5_REQUEST_NULL, old_attr_name, new_attr_name)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute")
} /* end if */
@@ -1318,7 +1353,7 @@ H5Aiterate2(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t order,
/* iterate over the links through the VOL */
if((ret_value = H5VL_attr_specific(obj->vol_obj, loc_params, obj->vol_info->vol_cls, H5VL_ATTR_ITER,
- H5AC_dxpl_id, H5_REQUEST_NULL,
+ H5AC_ind_read_dxpl_id, H5_REQUEST_NULL,
idx_type, order, idx, op, op_data)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "attribute iteration failed")
@@ -1377,6 +1412,7 @@ H5Aiterate_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
{
H5VL_object_t *obj = NULL; /* object token of loc_id */
H5VL_loc_params_t loc_params;
+ hid_t dxpl_id = H5AC_ind_read_dxpl_id; /* dxpl used by library */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -1392,11 +1428,10 @@ H5Aiterate_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
- if(H5P_DEFAULT == lapl_id)
- lapl_id = H5P_LINK_ACCESS_DEFAULT;
- else
- if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID")
+
+ /* Verify access property list and get correct dxpl */
+ if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, loc_id, FALSE) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists")
loc_params.type = H5VL_OBJECT_BY_NAME;
loc_params.obj_type = H5I_get_type(loc_id);
@@ -1409,7 +1444,7 @@ H5Aiterate_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
/* iterate over the links through the VOL */
if((ret_value = H5VL_attr_specific(obj->vol_obj, loc_params, obj->vol_info->vol_cls, H5VL_ATTR_ITER,
- H5AC_dxpl_id, H5_REQUEST_NULL,
+ dxpl_id, H5_REQUEST_NULL,
idx_type, order, idx, op, op_data)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "attribute iteration failed")
@@ -1457,7 +1492,7 @@ H5Adelete(hid_t loc_id, const char *name)
/* Delete the attribute through the VOL */
if((ret_value = H5VL_attr_specific(obj->vol_obj, loc_params, obj->vol_info->vol_cls, H5VL_ATTR_DELETE,
- H5AC_dxpl_id, H5_REQUEST_NULL, name)) < 0)
+ H5AC_ind_read_dxpl_id, H5_REQUEST_NULL, name)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute")
done:
@@ -1487,6 +1522,7 @@ H5Adelete_by_name(hid_t loc_id, const char *obj_name, const char *attr_name,
{
H5VL_object_t *obj;
H5VL_loc_params_t loc_params;
+ hid_t dxpl_id = H5AC_ind_read_dxpl_id; /* dxpl used by library */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -1499,11 +1535,10 @@ H5Adelete_by_name(hid_t loc_id, const char *obj_name, const char *attr_name,
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no object name")
if(!attr_name || !*attr_name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name")
- if(H5P_DEFAULT == lapl_id)
- lapl_id = H5P_LINK_ACCESS_DEFAULT;
- else
- if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID")
+
+ /* Verify access property list and get correct dxpl */
+ if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, loc_id, TRUE) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists")
loc_params.type = H5VL_OBJECT_BY_NAME;
loc_params.loc_data.loc_by_name.name = obj_name;
@@ -1516,7 +1551,7 @@ H5Adelete_by_name(hid_t loc_id, const char *obj_name, const char *attr_name,
/* Delete the attribute through the VOL */
if((ret_value = H5VL_attr_specific(obj->vol_obj, loc_params, obj->vol_info->vol_cls, H5VL_ATTR_DELETE,
- H5AC_dxpl_id, H5_REQUEST_NULL, attr_name)) < 0)
+ dxpl_id, H5_REQUEST_NULL, attr_name)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute")
done:
@@ -1554,6 +1589,7 @@ H5Adelete_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
{
H5VL_object_t *obj;
H5VL_loc_params_t loc_params;
+ hid_t dxpl_id = H5AC_ind_read_dxpl_id; /* dxpl used by library */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -1568,11 +1604,10 @@ H5Adelete_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
- if(H5P_DEFAULT == lapl_id)
- lapl_id = H5P_LINK_ACCESS_DEFAULT;
- else
- if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID")
+
+ /* Verify access property list and get correct dxpl */
+ if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, loc_id, TRUE) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists")
loc_params.type = H5VL_OBJECT_BY_IDX;
loc_params.loc_data.loc_by_idx.name = obj_name;
@@ -1588,7 +1623,7 @@ H5Adelete_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
/* Delete the attribute through the VOL */
if((ret_value = H5VL_attr_specific(obj->vol_obj, loc_params, obj->vol_info->vol_cls, H5VL_ATTR_DELETE,
- H5AC_dxpl_id, H5_REQUEST_NULL, NULL)) < 0)
+ dxpl_id, H5_REQUEST_NULL, NULL)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute")
done:
@@ -1671,7 +1706,7 @@ H5Aexists(hid_t obj_id, const char *attr_name)
/* Check existence of attribute through the VOL */
if(H5VL_attr_specific(obj->vol_obj, loc_params, obj->vol_info->vol_cls, H5VL_ATTR_EXISTS,
- H5AC_ind_dxpl_id, H5_REQUEST_NULL, attr_name, &ret_value) < 0)
+ H5AC_ind_read_dxpl_id, H5_REQUEST_NULL, attr_name, &ret_value) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to determine if attribute exists")
done:
FUNC_LEAVE_API(ret_value)
@@ -1697,6 +1732,7 @@ H5Aexists_by_name(hid_t loc_id, const char *obj_name, const char *attr_name,
{
H5VL_object_t *obj;
H5VL_loc_params_t loc_params;
+ hid_t dxpl_id = H5AC_ind_read_dxpl_id; /* dxpl used by library */
htri_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -1709,11 +1745,10 @@ H5Aexists_by_name(hid_t loc_id, const char *obj_name, const char *attr_name,
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no object name")
if(!attr_name || !*attr_name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name")
- if(H5P_DEFAULT == lapl_id)
- lapl_id = H5P_LINK_ACCESS_DEFAULT;
- else
- if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID")
+
+ /* Verify access property list and get correct dxpl */
+ if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, loc_id, FALSE) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists")
/* get the object */
if(NULL == (obj = H5VL_get_object(loc_id)))
@@ -1726,7 +1761,7 @@ H5Aexists_by_name(hid_t loc_id, const char *obj_name, const char *attr_name,
/* Check existence of attribute through the VOL */
if(H5VL_attr_specific(obj->vol_obj, loc_params, obj->vol_info->vol_cls, H5VL_ATTR_EXISTS,
- H5AC_ind_dxpl_id, H5_REQUEST_NULL, attr_name, &ret_value) < 0)
+ dxpl_id, H5_REQUEST_NULL, attr_name, &ret_value) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to determine if attribute exists")
done:
@@ -1758,7 +1793,7 @@ H5A_close_attr(void *_attr)
/* Close the attr through the VOL*/
if((ret_value = H5VL_attr_close(attr->vol_obj, attr->vol_info->vol_cls,
- H5AC_dxpl_id, H5_REQUEST_NULL)) < 0)
+ H5AC_ind_read_dxpl_id, H5_REQUEST_NULL)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "unable to close attribute")
/* free attribute */
diff --git a/src/H5AC.c b/src/H5AC.c
index f5b331f..64edc87 100644
--- a/src/H5AC.c
+++ b/src/H5AC.c
@@ -32,7 +32,7 @@
/****************/
#include "H5ACmodule.h" /* This source code file is part of the H5AC module */
-#define H5F_FRIEND /*suppress error about including H5Fpkg */
+#define H5F_FRIEND /* Suppress error about including H5Fpkg */
/***********/
@@ -76,22 +76,28 @@ static herr_t H5AC__ext_config_2_int_config(H5AC_cache_config_t *ext_conf_ptr,
/* Package initialization variable */
hbool_t H5_PKG_INIT_VAR = FALSE;
-
/*****************************/
/* Library Private Variables */
/*****************************/
-/* Default dataset transfer property list for metadata I/O calls */
-/* (Collective set, "block before metadata write" set and "library internal" set) */
-/* (Global variable definition, declaration is in H5ACprivate.h also) */
-hid_t H5AC_dxpl_id = (-1);
+/* Default dataset transfer property list for metadata I/O calls (coll write, ind read) */
+hid_t H5AC_ind_read_dxpl_id = (-1);
+#ifdef H5_HAVE_PARALLEL
+/* collective metadata read property */
+hid_t H5AC_coll_read_dxpl_id = (-1);
+#endif /* H5_HAVE_PARALLEL */
-/* Dataset transfer property list for independent metadata I/O calls */
-/* (just "library internal" set - i.e. independent transfer mode) */
-/* (Global variable definition, declaration is in H5ACprivate.h also) */
-H5P_genplist_t *H5AC_ind_dxpl_g = NULL;
-hid_t H5AC_ind_dxpl_id = (-1);
+/* DXPL to be used in operations that will not result in I/O calls */
+hid_t H5AC_noio_dxpl_id = (-1);
+/* Default DXPL to be used for raw data I/O operations when one is not
+ provided by the user (fill values in H5Dcreate) */
+hid_t H5AC_rawdata_dxpl_id = (-1);
+
+#ifdef H5_HAVE_PARALLEL
+/* Environment variable for collective API sanity checks */
+hbool_t H5_coll_api_sanity_check_g = false;
+#endif /* H5_HAVE_PARALLEL */
/*******************/
/* Local Variables */
@@ -172,57 +178,101 @@ done:
herr_t
H5AC__init_package(void)
{
-#ifdef H5_HAVE_PARALLEL
H5P_genplist_t *xfer_plist; /* Dataset transfer property list object */
- unsigned coll_meta_write; /* "collective metadata write" property value */
+#ifdef H5_HAVE_PARALLEL
+ H5P_coll_md_read_flag_t coll_meta_read;
#endif /* H5_HAVE_PARALLEL */
+#ifdef H5_DEBUG_BUILD
+ H5FD_dxpl_type_t dxpl_type; /* Property indicating the type of the internal dxpl */
+#endif /* H5_DEBUG_BUILD */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
#ifdef H5_HAVE_PARALLEL
- /* Sanity check */
- HDassert(H5P_CLS_DATASET_XFER_g != NULL);
+ /* check whether to enable strict collective function calling
+ sanity checks using MPI barriers */
+ {
+ const char *s; /* String for environment variables */
+
+ s = HDgetenv("H5_COLL_API_SANITY_CHECK");
+ if(s && HDisdigit(*s)) {
+ H5_coll_api_sanity_check_g = (hbool_t)HDstrtol(s, NULL, 0);
+ }
+ }
+#endif /* H5_HAVE_PARALLEL */
- /* Get an ID for the collective H5AC dxpl */
- if((H5AC_dxpl_id = H5P_create_id(H5P_CLS_DATASET_XFER_g, FALSE)) < 0)
+#if defined(H5_HAVE_PARALLEL) || defined(H5_DEBUG_BUILD)
+ /* Get an ID for the internal independent metadata dxpl */
+ if((H5AC_ind_read_dxpl_id = H5P_create_id(H5P_CLS_DATASET_XFER_g, FALSE)) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTCREATE, FAIL, "unable to register property list")
- /* Get the property list object */
- if (NULL == (xfer_plist = (H5P_genplist_t *)H5I_object(H5AC_dxpl_id)))
- HGOTO_ERROR(H5E_CACHE, H5E_BADATOM, FAIL, "can't get new property list object")
-
- /* Insert 'collective metadata write' property */
- coll_meta_write = 1;
- if(H5P_insert(xfer_plist, H5AC_COLLECTIVE_META_WRITE_NAME, H5AC_COLLECTIVE_META_WRITE_SIZE, &coll_meta_write,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTSET, FAIL, "can't insert metadata cache dxpl property")
+ /* Get an ID for the no I/O internal dxpl */
+ if((H5AC_noio_dxpl_id = H5P_create_id(H5P_CLS_DATASET_XFER_g, FALSE)) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTCREATE, FAIL, "unable to register property list")
- /* Get an ID for the independent H5AC dxpl */
- if((H5AC_ind_dxpl_id = H5P_create_id(H5P_CLS_DATASET_XFER_g, FALSE)) < 0)
+ /* Get an ID for the raw data (H5AC) dxpl */
+ if((H5AC_rawdata_dxpl_id = H5P_create_id(H5P_CLS_DATASET_XFER_g, FALSE)) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTCREATE, FAIL, "unable to register property list")
+ /* if this is a debug build, set the dxpl type flag on the
+ independent metadata dxpl and create the noio and raw data internal dxpls */
+#ifdef H5_DEBUG_BUILD
/* Get the property list object */
- if(NULL == (H5AC_ind_dxpl_g = (H5P_genplist_t *)H5I_object(H5AC_ind_dxpl_id)))
+ if (NULL == (xfer_plist = (H5P_genplist_t *)H5I_object(H5AC_ind_read_dxpl_id)))
HGOTO_ERROR(H5E_CACHE, H5E_BADATOM, FAIL, "can't get new property list object")
+ /* Insert the dxpl type property */
+ dxpl_type = H5FD_METADATA_DXPL;
+ if(H5P_set(xfer_plist, H5FD_DXPL_TYPE_NAME, &dxpl_type) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTSET, FAIL, "can't set dxpl type property")
- /* Insert 'collective metadata write' property */
- coll_meta_write = 0;
- if(H5P_insert(H5AC_ind_dxpl_g, H5AC_COLLECTIVE_META_WRITE_NAME, H5AC_COLLECTIVE_META_WRITE_SIZE, &coll_meta_write,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTSET, FAIL, "can't insert metadata cache dxpl property")
-#else /* H5_HAVE_PARALLEL */
- /* Sanity check */
- HDassert(H5P_LST_DATASET_XFER_ID_g!=(-1));
-
- H5AC_dxpl_id = H5P_DATASET_XFER_DEFAULT;
- H5AC_ind_dxpl_id = H5P_DATASET_XFER_DEFAULT;
+ /* Get the property list object */
+ if (NULL == (xfer_plist = (H5P_genplist_t *)H5I_object(H5AC_noio_dxpl_id)))
+ HGOTO_ERROR(H5E_CACHE, H5E_BADATOM, FAIL, "can't get new property list object")
+ /* Insert the dxpl type property */
+ dxpl_type = H5FD_NOIO_DXPL;
+ if(H5P_set(xfer_plist, H5FD_DXPL_TYPE_NAME, &dxpl_type) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTSET, FAIL, "can't set dxpl type property")
- /* Get the property list objects for the IDs */
- if(NULL == (H5AC_ind_dxpl_g = (H5P_genplist_t *)H5I_object(H5AC_ind_dxpl_id)))
- HGOTO_ERROR(H5E_CACHE, H5E_BADATOM, FAIL, "can't get property list object")
+ /* Get the property list object */
+ if (NULL == (xfer_plist = (H5P_genplist_t *)H5I_object(H5AC_rawdata_dxpl_id)))
+ HGOTO_ERROR(H5E_CACHE, H5E_BADATOM, FAIL, "can't get new property list object")
+ /* Insert the dxpl type property */
+ dxpl_type = H5FD_RAWDATA_DXPL;
+ if(H5P_set(xfer_plist, H5FD_DXPL_TYPE_NAME, &dxpl_type) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTSET, FAIL, "can't set dxpl type property")
+#endif /* H5_DEBUG_BUILD */
+
+ /* if this is a parallel build, create an internal dxpl for
+ collective metadata reads */
+#ifdef H5_HAVE_PARALLEL
+ /* Get an ID for H5AC_coll_read_dxpl_id */
+ if((H5AC_coll_read_dxpl_id = H5P_create_id(H5P_CLS_DATASET_XFER_g, FALSE)) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTCREATE, FAIL, "unable to register property list")
+ /* Get the property list object */
+ if (NULL == (xfer_plist = (H5P_genplist_t *)H5I_object(H5AC_coll_read_dxpl_id)))
+ HGOTO_ERROR(H5E_CACHE, H5E_BADATOM, FAIL, "can't get new property list object")
+ /* set 'collective metadata read' property */
+ coll_meta_read = H5P_USER_TRUE;
+ if(H5P_set(xfer_plist, H5_COLL_MD_READ_FLAG_NAME, &coll_meta_read) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set collective metadata read flag")
+
+ /* if we have a debug build, set the dxpl type to metadata on the
+ collective metadata dxpl */
+#ifdef H5_DEBUG_BUILD
+ /* set metadata dxpl type */
+ dxpl_type = H5FD_METADATA_DXPL;
+ if(H5P_set(xfer_plist, H5FD_DXPL_TYPE_NAME, &dxpl_type) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTSET, FAIL, "can't set dxpl type property")
+#endif /* H5_DEBUG_BUILD */
#endif /* H5_HAVE_PARALLEL */
+#else /* defined(H5_HAVE_PARALLEL) || defined(H5_DEBUG_BUILD) */
+ H5AC_ind_read_dxpl_id = H5P_DATASET_XFER_DEFAULT;
+ H5AC_noio_dxpl_id = H5P_DATASET_XFER_DEFAULT;
+ H5AC_rawdata_dxpl_id = H5P_DATASET_XFER_DEFAULT;
+#endif /* defined(H5_HAVE_PARALLEL) || defined(H5_DEBUG_BUILD) */
+
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5AC__init_package() */
@@ -250,20 +300,34 @@ H5AC_term_package(void)
FUNC_ENTER_NOAPI_NOINIT_NOERR
if(H5_PKG_INIT_VAR) {
+ if(H5AC_ind_read_dxpl_id > 0 || H5AC_noio_dxpl_id > 0 || H5AC_rawdata_dxpl_id > 0
#ifdef H5_HAVE_PARALLEL
- if(H5AC_dxpl_id > 0 || H5AC_ind_dxpl_id > 0) {
+ || H5AC_coll_read_dxpl_id > 0
+#endif /* H5_HAVE_PARALLEL */
+ ) {
+#if defined(H5_HAVE_PARALLEL) || defined(H5_DEBUG_BUILD)
/* Indicate more work to do */
n = 1; /* H5I */
- /* Close H5AC dxpl */
- if(H5I_dec_ref(H5AC_dxpl_id) < 0 || H5I_dec_ref(H5AC_ind_dxpl_id) < 0)
+ /* Close H5AC dxpls */
+ if(H5I_dec_ref(H5AC_ind_read_dxpl_id) < 0 ||
+ H5I_dec_ref(H5AC_noio_dxpl_id) < 0 ||
+ H5I_dec_ref(H5AC_rawdata_dxpl_id) < 0
+#ifdef H5_HAVE_PARALLEL
+ || H5I_dec_ref(H5AC_coll_read_dxpl_id) < 0
+#endif /* H5_HAVE_PARALLEL */
+ )
H5E_clear_stack(NULL); /*ignore error*/
- } /* end if */
+#endif /* defined(H5_HAVE_PARALLEL) || defined(H5_DEBUG_BUILD) */
+
+ /* Reset static IDs */
+ H5AC_ind_read_dxpl_id = (-1);
+ H5AC_noio_dxpl_id = (-1);
+ H5AC_rawdata_dxpl_id = (-1);
+#ifdef H5_HAVE_PARALLEL
+ H5AC_coll_read_dxpl_id = (-1);
#endif /* H5_HAVE_PARALLEL */
-
- /* Reset static IDs */
- H5AC_dxpl_id = (-1);
- H5AC_ind_dxpl_id = (-1);
+ } /* end if */
/* Reset interface initialization flag */
if(0 == n)
@@ -478,7 +542,11 @@ H5AC_dest(H5F_t *f, hid_t dxpl_id)
#endif /* H5AC__TRACE_FILE_ENABLED */
#ifdef H5_HAVE_PARALLEL
- aux_ptr = H5C_get_aux_ptr(f->shared->cache);
+ /* destroying the cache, so clear all collective entries */
+ if(H5C_clear_coll_entries(f->shared->cache, 0) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "H5C_clear_coll_entries() failed.")
+
+ aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(f->shared->cache);
if(aux_ptr)
/* Sanity check */
HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC);
@@ -616,6 +684,10 @@ H5AC_flush(H5F_t *f, hid_t dxpl_id)
#endif /* H5AC__TRACE_FILE_ENABLED */
#ifdef H5_HAVE_PARALLEL
+ /* flushing the cache, so clear all collective entries */
+ if(H5C_clear_coll_entries(f->shared->cache, 0) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "H5C_clear_coll_entries() failed.")
+
/* Attempt to flush all entries from rank 0 & Bcast clean list to other ranks */
if(H5AC__flush_entries(f, dxpl_id) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't flush.")
@@ -766,14 +838,14 @@ H5AC_insert_entry(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t add
{
H5AC_aux_t *aux_ptr;
- if(NULL != (aux_ptr = H5C_get_aux_ptr(f->shared->cache))) {
+ if(NULL != (aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(f->shared->cache))) {
/* Log the new entry */
if(H5AC__log_inserted_entry((H5AC_info_t *)thing) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTINS, FAIL, "H5AC__log_inserted_entry() failed")
/* Check if we should try to flush */
if(aux_ptr->dirty_bytes >= aux_ptr->dirty_bytes_threshold)
- if(H5AC__run_sync_point(f, H5AC_dxpl_id, H5AC_SYNC_POINT_OP__FLUSH_TO_MIN_CLEAN) < 0)
+ if(H5AC__run_sync_point(f, dxpl_id, H5AC_SYNC_POINT_OP__FLUSH_TO_MIN_CLEAN) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't run sync point.")
} /* end if */
}
@@ -832,7 +904,7 @@ H5AC_mark_entry_dirty(void *thing)
H5C_t *cache_ptr = entry_ptr->cache_ptr;
H5AC_aux_t *aux_ptr;
- aux_ptr = H5C_get_aux_ptr(cache_ptr);
+ aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr);
if((!entry_ptr->is_dirty) && (!entry_ptr->is_protected) &&
(entry_ptr->is_pinned) && (NULL != aux_ptr))
if(H5AC__log_dirtied_entry(entry_ptr) < 0)
@@ -868,7 +940,8 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5AC_move_entry(H5F_t *f, const H5AC_class_t *type, haddr_t old_addr, haddr_t new_addr)
+H5AC_move_entry(H5F_t *f, const H5AC_class_t *type, haddr_t old_addr,
+ haddr_t new_addr, hid_t dxpl_id)
{
#if H5AC__TRACE_FILE_ENABLED
char trace[128] = "";
@@ -901,7 +974,7 @@ H5AC_move_entry(H5F_t *f, const H5AC_class_t *type, haddr_t old_addr, haddr_t ne
#ifdef H5_HAVE_PARALLEL
/* Log moving the entry */
- if(NULL != (aux_ptr = H5C_get_aux_ptr(f->shared->cache)))
+ if(NULL != (aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(f->shared->cache)))
if(H5AC__log_moved_entry(f, old_addr, new_addr) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "can't log moved entry")
#endif /* H5_HAVE_PARALLEL */
@@ -912,7 +985,7 @@ H5AC_move_entry(H5F_t *f, const H5AC_class_t *type, haddr_t old_addr, haddr_t ne
#ifdef H5_HAVE_PARALLEL
/* Check if we should try to flush */
if(NULL != aux_ptr && aux_ptr->dirty_bytes >= aux_ptr->dirty_bytes_threshold)
- if(H5AC__run_sync_point(f, H5AC_dxpl_id, H5AC_SYNC_POINT_OP__FLUSH_TO_MIN_CLEAN) < 0)
+ if(H5AC__run_sync_point(f, dxpl_id, H5AC_SYNC_POINT_OP__FLUSH_TO_MIN_CLEAN) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't run sync point.")
#endif /* H5_HAVE_PARALLEL */
@@ -1166,7 +1239,7 @@ H5AC_resize_entry(void *thing, size_t new_size)
H5C_t *cache_ptr = entry_ptr->cache_ptr;
H5AC_aux_t *aux_ptr;
- aux_ptr = H5C_get_aux_ptr(cache_ptr);
+ aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr);
if((!entry_ptr->is_dirty) && (NULL != aux_ptr))
if(H5AC__log_dirtied_entry(entry_ptr) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, "can't log dirtied entry")
@@ -1377,7 +1450,7 @@ H5AC_unprotect(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr,
} /* end if */
#ifdef H5_HAVE_PARALLEL
- if(NULL != (aux_ptr = H5C_get_aux_ptr(f->shared->cache))) {
+ if(NULL != (aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(f->shared->cache))) {
if(dirtied && ((H5AC_info_t *)thing)->is_dirty == FALSE)
if(H5AC__log_dirtied_entry((H5AC_info_t *)thing) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "can't log dirtied entry")
@@ -1394,7 +1467,7 @@ H5AC_unprotect(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr,
#ifdef H5_HAVE_PARALLEL
/* Check if we should try to flush */
if((aux_ptr != NULL) && (aux_ptr->dirty_bytes >= aux_ptr->dirty_bytes_threshold))
- if(H5AC__run_sync_point(f, H5AC_dxpl_id, H5AC_SYNC_POINT_OP__FLUSH_TO_MIN_CLEAN) < 0)
+ if(H5AC__run_sync_point(f, dxpl_id, H5AC_SYNC_POINT_OP__FLUSH_TO_MIN_CLEAN) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't run sync point.")
#endif /* H5_HAVE_PARALLEL */
@@ -1502,7 +1575,7 @@ H5AC_get_cache_auto_resize_config(const H5AC_t *cache_ptr,
{
H5AC_aux_t *aux_ptr;
- aux_ptr = H5C_get_aux_ptr(cache_ptr);
+ aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr);
if((aux_ptr != NULL) && (aux_ptr->magic != H5AC__H5AC_AUX_T_MAGIC))
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad aux_ptr on entry.")
}
@@ -1549,7 +1622,7 @@ H5AC_get_cache_auto_resize_config(const H5AC_t *cache_ptr,
{
H5AC_aux_t *aux_ptr;
- if(NULL != (aux_ptr = H5C_get_aux_ptr(cache_ptr))) {
+ if(NULL != (aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr))) {
config_ptr->dirty_bytes_threshold = aux_ptr->dirty_bytes_threshold;
config_ptr->metadata_write_strategy = aux_ptr->metadata_write_strategy;
} /* end if */
@@ -1691,7 +1764,7 @@ H5AC_set_cache_auto_resize_config(H5AC_t *cache_ptr, H5AC_cache_config_t *config
{
H5AC_aux_t *aux_ptr;
- aux_ptr = H5C_get_aux_ptr(cache_ptr);
+ aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr);
if((aux_ptr != NULL) && (aux_ptr->magic != H5AC__H5AC_AUX_T_MAGIC))
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "bad aux_ptr on entry.")
}
@@ -1735,7 +1808,7 @@ H5AC_set_cache_auto_resize_config(H5AC_t *cache_ptr, H5AC_cache_config_t *config
/* Set parallel configuration values */
/* (Which are only held in the H5AC layer -QAK) */
- if(NULL != (aux_ptr = H5C_get_aux_ptr(cache_ptr))) {
+ if(NULL != (aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr))) {
aux_ptr->dirty_bytes_threshold = config_ptr->dirty_bytes_threshold;
aux_ptr->metadata_write_strategy = config_ptr->metadata_write_strategy;
} /* end if */
@@ -1950,7 +2023,7 @@ H5AC_open_trace_file(H5AC_t *cache_ptr, const char *trace_file_name)
{
H5AC_aux_t * aux_ptr;
- aux_ptr = H5C_get_aux_ptr(cache_ptr);
+ aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr);
if(aux_ptr == NULL)
sprintf(file_name, "%s", trace_file_name);
else {
@@ -2131,7 +2204,7 @@ H5_ATTR_UNUSED
HDassert(f != NULL);
HDassert(f->shared != NULL);
HDassert(f->shared->cache != NULL);
- aux_ptr = H5C_get_aux_ptr(f->shared->cache);
+ aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(f->shared->cache);
if(aux_ptr != NULL) {
HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC);
diff --git a/src/H5ACmpio.c b/src/H5ACmpio.c
index fdad19a..db291cf 100644
--- a/src/H5ACmpio.c
+++ b/src/H5ACmpio.c
@@ -159,7 +159,7 @@ H5AC__set_sync_point_done_callback(H5C_t * cache_ptr,
/* Sanity checks */
HDassert(cache_ptr);
- aux_ptr = H5C_get_aux_ptr(cache_ptr);
+ aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr);
HDassert(aux_ptr != NULL);
HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC);
@@ -192,7 +192,7 @@ H5AC__set_write_done_callback(H5C_t * cache_ptr, void (* write_done)(void))
/* Sanity checks */
HDassert(cache_ptr);
- aux_ptr = H5C_get_aux_ptr(cache_ptr);
+ aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr);
HDassert(aux_ptr != NULL);
HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC);
@@ -231,7 +231,7 @@ H5AC_add_candidate(H5AC_t * cache_ptr, haddr_t addr)
/* Sanity checks */
HDassert(cache_ptr != NULL);
- aux_ptr = H5C_get_aux_ptr(cache_ptr);
+ aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr);
HDassert(aux_ptr != NULL);
HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC);
HDassert(aux_ptr->metadata_write_strategy == H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED);
@@ -295,7 +295,7 @@ H5AC__broadcast_candidate_list(H5AC_t *cache_ptr, int *num_entries_ptr,
/* Sanity checks */
HDassert(cache_ptr != NULL);
- aux_ptr = H5C_get_aux_ptr(cache_ptr);
+ aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr);
HDassert(aux_ptr != NULL);
HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC);
HDassert(aux_ptr->mpi_rank == 0);
@@ -427,7 +427,7 @@ H5AC__broadcast_clean_list(H5AC_t * cache_ptr)
/* Sanity checks */
HDassert(cache_ptr != NULL);
- aux_ptr = H5C_get_aux_ptr(cache_ptr);
+ aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr);
HDassert(aux_ptr != NULL);
HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC);
HDassert(aux_ptr->mpi_rank == 0);
@@ -624,7 +624,7 @@ H5AC__copy_candidate_list_to_buffer(const H5AC_t *cache_ptr, int *num_entries_pt
/* Sanity checks */
HDassert(cache_ptr != NULL);
- aux_ptr = H5C_get_aux_ptr(cache_ptr);
+ aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr);
HDassert(aux_ptr != NULL);
HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC);
HDassert(aux_ptr->metadata_write_strategy == H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED);
@@ -700,7 +700,7 @@ H5AC__log_deleted_entry(const H5AC_info_t *entry_ptr)
addr = entry_ptr->addr;
cache_ptr = entry_ptr->cache_ptr;
HDassert(cache_ptr != NULL);
- aux_ptr = H5C_get_aux_ptr(cache_ptr);
+ aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr);
HDassert(aux_ptr != NULL);
HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC);
HDassert(aux_ptr->mpi_rank == 0);
@@ -756,7 +756,7 @@ H5AC__log_dirtied_entry(const H5AC_info_t *entry_ptr)
HDassert(entry_ptr->is_dirty == FALSE);
cache_ptr = entry_ptr->cache_ptr;
HDassert(cache_ptr != NULL);
- aux_ptr = H5C_get_aux_ptr(cache_ptr);
+ aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr);
HDassert(aux_ptr != NULL);
HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC);
@@ -839,7 +839,7 @@ H5AC__log_flushed_entry(H5C_t *cache_ptr, haddr_t addr, hbool_t was_dirty,
/* Sanity check */
HDassert(cache_ptr != NULL);
- aux_ptr = H5C_get_aux_ptr(cache_ptr);
+ aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr);
HDassert(aux_ptr != NULL);
HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC);
HDassert(aux_ptr->mpi_rank == 0);
@@ -907,7 +907,7 @@ H5AC__log_inserted_entry(const H5AC_info_t *entry_ptr)
HDassert(entry_ptr);
cache_ptr = entry_ptr->cache_ptr;
HDassert(cache_ptr != NULL);
- aux_ptr = H5C_get_aux_ptr(cache_ptr);
+ aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr);
HDassert(aux_ptr != NULL);
HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC);
@@ -1010,7 +1010,7 @@ H5AC__log_moved_entry(const H5F_t *f, haddr_t old_addr, haddr_t new_addr)
HDassert(f->shared);
cache_ptr = (H5AC_t *)f->shared->cache;
HDassert(cache_ptr);
- aux_ptr = H5C_get_aux_ptr(cache_ptr);
+ aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr);
HDassert(aux_ptr != NULL);
HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC);
@@ -1188,7 +1188,7 @@ H5AC__propagate_and_apply_candidate_list(H5F_t *f, hid_t dxpl_id)
HDassert(f != NULL);
cache_ptr = f->shared->cache;
HDassert(cache_ptr != NULL);
- aux_ptr = H5C_get_aux_ptr(cache_ptr);
+ aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr);
HDassert(aux_ptr != NULL);
HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC);
HDassert(aux_ptr->metadata_write_strategy == H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED);
@@ -1352,7 +1352,7 @@ H5AC__propagate_flushed_and_still_clean_entries_list(H5F_t *f, hid_t dxpl_id)
HDassert(f != NULL);
cache_ptr = f->shared->cache;
HDassert(cache_ptr != NULL);
- aux_ptr = H5C_get_aux_ptr(cache_ptr);
+ aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr);
HDassert(aux_ptr != NULL);
HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC);
HDassert(aux_ptr->metadata_write_strategy == H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY);
@@ -1477,7 +1477,7 @@ H5AC__receive_and_apply_clean_list(H5F_t *f, hid_t dxpl_id)
HDassert(f != NULL);
cache_ptr = f->shared->cache;
HDassert(cache_ptr != NULL);
- aux_ptr = H5C_get_aux_ptr(cache_ptr);
+ aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr);
HDassert(aux_ptr != NULL);
HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC);
HDassert(aux_ptr->mpi_rank != 0);
@@ -1537,7 +1537,7 @@ H5AC__receive_candidate_list(const H5AC_t *cache_ptr, int *num_entries_ptr,
/* Sanity checks */
HDassert(cache_ptr != NULL);
- aux_ptr = H5C_get_aux_ptr(cache_ptr);
+ aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr);
HDassert(aux_ptr != NULL);
HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC);
HDassert(aux_ptr->mpi_rank != 0);
@@ -1621,7 +1621,7 @@ H5AC__rsp__dist_md_write__flush(H5F_t *f, hid_t dxpl_id)
HDassert(f != NULL);
cache_ptr = f->shared->cache;
HDassert(cache_ptr != NULL);
- aux_ptr = H5C_get_aux_ptr(cache_ptr);
+ aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr);
HDassert(aux_ptr != NULL);
HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC);
HDassert(aux_ptr->metadata_write_strategy == H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED);
@@ -1761,7 +1761,7 @@ H5AC__rsp__dist_md_write__flush_to_min_clean(H5F_t *f, hid_t dxpl_id)
HDassert(f != NULL);
cache_ptr = f->shared->cache;
HDassert(cache_ptr != NULL);
- aux_ptr = H5C_get_aux_ptr(cache_ptr);
+ aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr);
HDassert(aux_ptr != NULL);
HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC);
HDassert(aux_ptr->metadata_write_strategy == H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED);
@@ -1836,7 +1836,7 @@ H5AC__rsp__p0_only__flush(H5F_t *f, hid_t dxpl_id)
HDassert(f != NULL);
cache_ptr = f->shared->cache;
HDassert(cache_ptr != NULL);
- aux_ptr = H5C_get_aux_ptr(cache_ptr);
+ aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr);
HDassert(aux_ptr != NULL);
HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC);
HDassert(aux_ptr->metadata_write_strategy == H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY);
@@ -1874,7 +1874,7 @@ H5AC__rsp__p0_only__flush(H5F_t *f, hid_t dxpl_id)
} /* end if */
/* Propagate cleaned entries to other ranks. */
- if(H5AC__propagate_flushed_and_still_clean_entries_list(f, H5AC_dxpl_id) < 0)
+ if(H5AC__propagate_flushed_and_still_clean_entries_list(f, dxpl_id) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't propagate clean entries list.")
done:
@@ -1938,7 +1938,7 @@ H5AC__rsp__p0_only__flush_to_min_clean(H5F_t *f, hid_t dxpl_id)
HDassert(f != NULL);
cache_ptr = f->shared->cache;
HDassert(cache_ptr != NULL);
- aux_ptr = H5C_get_aux_ptr(cache_ptr);
+ aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr);
HDassert(aux_ptr != NULL);
HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC);
HDassert(aux_ptr->metadata_write_strategy == H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY);
@@ -2047,7 +2047,7 @@ H5AC__run_sync_point(H5F_t *f, hid_t dxpl_id, int sync_point_op)
HDassert(f != NULL);
cache_ptr = f->shared->cache;
HDassert(cache_ptr != NULL);
- aux_ptr = H5C_get_aux_ptr(cache_ptr);
+ aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr);
HDassert(aux_ptr != NULL);
HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC);
HDassert((sync_point_op == H5AC_SYNC_POINT_OP__FLUSH_TO_MIN_CLEAN) ||
@@ -2065,6 +2065,14 @@ HDfprintf(stdout, "%d:H5AC_propagate...:%u: (u/uu/i/iu/r/ru) = %zu/%u/%zu/%u/%zu
aux_ptr->rename_dirty_bytes_updates);
#endif /* H5AC_DEBUG_DIRTY_BYTES_CREATION */
+ /* clear collective access flag on half of the entries in the
+ cache and mark them as independent in case they need to be
+ evicted later. All ranks are guranteed to mark the same entries
+ since we don't modify the order of the collectively accessed
+ entries except through collective access. */
+ if(H5C_clear_coll_entries(cache_ptr, TRUE) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "H5C_clear_coll_entries() failed.")
+
switch(aux_ptr->metadata_write_strategy) {
case H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY:
switch(sync_point_op) {
@@ -2171,7 +2179,7 @@ H5AC__tidy_cache_0_lists(H5AC_t *cache_ptr, int num_candidates,
/* Sanity checks */
HDassert(cache_ptr != NULL);
- aux_ptr = H5C_get_aux_ptr(cache_ptr);
+ aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr);
HDassert(aux_ptr != NULL);
HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC);
HDassert(aux_ptr->metadata_write_strategy == H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED);
diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h
index e634a45..711d441 100644
--- a/src/H5ACprivate.h
+++ b/src/H5ACprivate.h
@@ -181,32 +181,24 @@ typedef H5C_cache_entry_t H5AC_info_t;
/* Typedef for metadata cache (defined in H5Cpkg.h) */
typedef H5C_t H5AC_t;
-/* Metadata specific properties for FAPL */
-/* (Only used for parallel I/O) */
-#ifdef H5_HAVE_PARALLEL
-/* Definitions for "collective metadata write" property */
-#define H5AC_COLLECTIVE_META_WRITE_NAME "H5AC_collective_metadata_write"
-#define H5AC_COLLECTIVE_META_WRITE_SIZE sizeof(unsigned)
-#define H5AC_COLLECTIVE_META_WRITE_DEF 0
-#endif /* H5_HAVE_PARALLEL */
-
#define H5AC_METADATA_TAG_NAME "H5AC_metadata_tag"
#define H5AC_METADATA_TAG_SIZE sizeof(haddr_t)
#define H5AC_METADATA_TAG_DEF H5AC__INVALID_TAG
#define H5AC_RING_NAME "H5AC_ring_type"
-/* Dataset transfer property list for flush calls */
-/* (Collective set, "block before metadata write" set and "library internal" set) */
-/* (Global variable declaration, definition is in H5AC.c) */
-extern hid_t H5AC_dxpl_id;
+/* Dataset transfer property lists for metadata calls */
+H5_DLLVAR hid_t H5AC_ind_read_dxpl_id;
+#ifdef H5_HAVE_PARALLEL
+H5_DLLVAR hid_t H5AC_coll_read_dxpl_id;
+#endif /* H5_HAVE_PARALLEL */
-/* Dataset transfer property list for independent metadata I/O calls */
-/* (just "library internal" set - i.e. independent transfer mode) */
-/* (Global variable declaration, definition is in H5AC.c) */
-H5_DLLVAR H5P_genplist_t *H5AC_ind_dxpl_g;
-H5_DLLVAR hid_t H5AC_ind_dxpl_id;
+/* DXPL to be used in operations that will not result in I/O calls */
+H5_DLLVAR hid_t H5AC_noio_dxpl_id;
+/* DXPL to be used for raw data I/O operations when one is not
+ provided by the user (fill values in H5Dcreate) */
+H5_DLLVAR hid_t H5AC_rawdata_dxpl_id;
/* Default cache configuration. */
@@ -346,7 +338,7 @@ H5_DLL herr_t H5AC_unprotect(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type,
H5_DLL herr_t H5AC_flush(H5F_t *f, hid_t dxpl_id);
H5_DLL herr_t H5AC_mark_entry_dirty(void *thing);
H5_DLL herr_t H5AC_move_entry(H5F_t *f, const H5AC_class_t *type,
- haddr_t old_addr, haddr_t new_addr);
+ haddr_t old_addr, haddr_t new_addr, hid_t dxpl_id);
H5_DLL herr_t H5AC_dest(H5F_t *f, hid_t dxpl_id);
H5_DLL herr_t H5AC_expunge_entry(H5F_t *f, hid_t dxpl_id,
const H5AC_class_t *type, haddr_t addr, unsigned flags);
diff --git a/src/H5Abtree2.c b/src/H5Abtree2.c
index 972fb0b..a9c77d2 100644
--- a/src/H5Abtree2.c
+++ b/src/H5Abtree2.c
@@ -80,7 +80,7 @@ typedef struct H5A_fh_ud_cmp_t {
/* v2 B-tree driver callbacks for 'creation order' index */
static herr_t H5A__dense_btree2_corder_store(void *native, const void *udata);
-static herr_t H5A__dense_btree2_corder_compare(const void *rec1, const void *rec2);
+static herr_t H5A__dense_btree2_corder_compare(const void *rec1, const void *rec2, int *result);
static herr_t H5A__dense_btree2_corder_encode(uint8_t *raw, const void *native,
void *ctx);
static herr_t H5A__dense_btree2_corder_decode(const uint8_t *raw, void *native,
@@ -90,7 +90,7 @@ static herr_t H5A__dense_btree2_corder_debug(FILE *stream, int indent, int fwidt
/* v2 B-tree driver callbacks for 'name' index */
static herr_t H5A__dense_btree2_name_store(void *native, const void *udata);
-static herr_t H5A__dense_btree2_name_compare(const void *rec1, const void *rec2);
+static herr_t H5A__dense_btree2_name_compare(const void *rec1, const void *rec2, int *result);
static herr_t H5A__dense_btree2_name_encode(uint8_t *raw, const void *native,
void *ctx);
static herr_t H5A__dense_btree2_name_decode(const uint8_t *raw, void *native,
@@ -116,9 +116,7 @@ const H5B2_class_t H5A_BT2_NAME[1]={{ /* B-tree class information */
H5A__dense_btree2_name_compare, /* Record comparison callback */
H5A__dense_btree2_name_encode, /* Record encoding callback */
H5A__dense_btree2_name_decode, /* Record decoding callback */
- H5A__dense_btree2_name_debug, /* Record debugging callback */
- NULL, /* Create debugging context */
- NULL /* Destroy debugging context */
+ H5A__dense_btree2_name_debug /* Record debugging callback */
}};
/* v2 B-tree class for indexing 'creation order' field of attributes */
@@ -132,9 +130,7 @@ const H5B2_class_t H5A_BT2_CORDER[1]={{ /* B-tree class information */
H5A__dense_btree2_corder_compare, /* Record comparison callback */
H5A__dense_btree2_corder_encode, /* Record encoding callback */
H5A__dense_btree2_corder_decode, /* Record decoding callback */
- H5A__dense_btree2_corder_debug, /* Record debugging callback */
- NULL, /* Create debugging context */
- NULL /* Destroy debugging context */
+ H5A__dense_btree2_corder_debug /* Record debugging callback */
}};
@@ -249,13 +245,13 @@ H5A__dense_btree2_name_store(void *_nrecord, const void *_udata)
*-------------------------------------------------------------------------
*/
static herr_t
-H5A__dense_btree2_name_compare(const void *_bt2_udata, const void *_bt2_rec)
+H5A__dense_btree2_name_compare(const void *_bt2_udata, const void *_bt2_rec, int *result)
{
const H5A_bt2_ud_common_t *bt2_udata = (const H5A_bt2_ud_common_t *)_bt2_udata;
const H5A_dense_bt2_name_rec_t *bt2_rec = (const H5A_dense_bt2_name_rec_t *)_bt2_rec;
- herr_t ret_value = FAIL; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_STATIC_NOERR
+ FUNC_ENTER_STATIC
/* Sanity check */
HDassert(bt2_udata);
@@ -263,13 +259,12 @@ H5A__dense_btree2_name_compare(const void *_bt2_udata, const void *_bt2_rec)
/* Check hash value */
if(bt2_udata->name_hash < bt2_rec->hash)
- ret_value = (-1);
+ *result = (-1);
else if(bt2_udata->name_hash > bt2_rec->hash)
- ret_value = 1;
+ *result = 1;
else {
H5A_fh_ud_cmp_t fh_udata; /* User data for fractal heap 'op' callback */
H5HF_t *fheap; /* Fractal heap handle to use for finding object */
- herr_t status; /* Status from fractal heap 'op' routine */
/* Sanity check */
HDassert(bt2_udata->name_hash == bt2_rec->hash);
@@ -294,13 +289,14 @@ H5A__dense_btree2_name_compare(const void *_bt2_udata, const void *_bt2_rec)
HDassert(fheap);
/* Check if the user's attribute and the B-tree's attribute have the same name */
- status = H5HF_op(fheap, bt2_udata->dxpl_id, &bt2_rec->id, H5A__dense_fh_name_cmp, &fh_udata);
- HDassert(status >= 0);
+ if(H5HF_op(fheap, bt2_udata->dxpl_id, &bt2_rec->id, H5A__dense_fh_name_cmp, &fh_udata) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records")
/* Callback will set comparison value */
- ret_value = fh_udata.cmp;
+ *result = fh_udata.cmp;
} /* end else */
+done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5A__dense_btree2_name_compare() */
@@ -441,11 +437,10 @@ H5A__dense_btree2_corder_store(void *_nrecord, const void *_udata)
*-------------------------------------------------------------------------
*/
static herr_t
-H5A__dense_btree2_corder_compare(const void *_bt2_udata, const void *_bt2_rec)
+H5A__dense_btree2_corder_compare(const void *_bt2_udata, const void *_bt2_rec, int *result)
{
const H5A_bt2_ud_common_t *bt2_udata = (const H5A_bt2_ud_common_t *)_bt2_udata;
const H5A_dense_bt2_corder_rec_t *bt2_rec = (const H5A_dense_bt2_corder_rec_t *)_bt2_rec;
- herr_t ret_value = FAIL; /* Return value */
FUNC_ENTER_STATIC_NOERR
@@ -455,13 +450,13 @@ H5A__dense_btree2_corder_compare(const void *_bt2_udata, const void *_bt2_rec)
/* Check creation order value */
if(bt2_udata->corder < bt2_rec->corder)
- ret_value = -1;
+ *result = -1;
else if(bt2_udata->corder > bt2_rec->corder)
- ret_value = 1;
+ *result = 1;
else
- ret_value = 0;
+ *result = 0;
- FUNC_LEAVE_NOAPI(ret_value)
+ FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5A__dense_btree2_corder_compare() */
diff --git a/src/H5Adeprec.c b/src/H5Adeprec.c
index 10d966c..4f83aca 100644
--- a/src/H5Adeprec.c
+++ b/src/H5Adeprec.c
@@ -153,7 +153,7 @@ H5Acreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id,
/* Create the attribute through the VOL */
if(NULL == (attr = H5VL_attr_create(obj->vol_obj, loc_params, obj->vol_info->vol_cls, name,
- plist_id, H5P_DEFAULT, H5AC_dxpl_id, H5_REQUEST_NULL)))
+ plist_id, H5P_DEFAULT, H5AC_ind_read_dxpl_id, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create attribute")
/* Get an atom for the attribute */
@@ -162,7 +162,7 @@ H5Acreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id,
done:
if (ret_value < 0 && attr)
- if(H5VL_attr_close(attr, obj->vol_info->vol_cls, H5AC_dxpl_id, H5_REQUEST_NULL) < 0)
+ if(H5VL_attr_close(attr, obj->vol_info->vol_cls, H5AC_ind_read_dxpl_id, H5_REQUEST_NULL) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "unable to release attr")
FUNC_LEAVE_API(ret_value)
@@ -217,7 +217,7 @@ H5Aopen_name(hid_t loc_id, const char *name)
/* Open the attribute through the VOL */
if(NULL == (attr = H5VL_attr_open(obj->vol_obj, loc_params, obj->vol_info->vol_cls,
- name, H5P_DEFAULT, H5AC_ind_dxpl_id, H5_REQUEST_NULL)))
+ name, H5P_DEFAULT, H5AC_ind_read_dxpl_id, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open attribute")
/* Get an atom for the attribute */
@@ -226,7 +226,7 @@ H5Aopen_name(hid_t loc_id, const char *name)
done:
if (ret_value < 0 && attr)
- if(H5VL_attr_close(attr, obj->vol_info->vol_cls, H5AC_dxpl_id, H5_REQUEST_NULL) < 0)
+ if(H5VL_attr_close(attr, obj->vol_info->vol_cls, H5AC_ind_read_dxpl_id, H5_REQUEST_NULL) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "unable to release attr")
FUNC_LEAVE_API(ret_value)
@@ -284,7 +284,7 @@ H5Aopen_idx(hid_t loc_id, unsigned idx)
/* Open the attribute through the VOL */
if(NULL == (attr = H5VL_attr_open(obj->vol_obj, loc_params, obj->vol_info->vol_cls,
- NULL, H5P_DEFAULT, H5AC_ind_dxpl_id, H5_REQUEST_NULL)))
+ NULL, H5P_DEFAULT, H5AC_ind_read_dxpl_id, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open attribute")
/* Get an atom for the attribute */
@@ -293,7 +293,7 @@ H5Aopen_idx(hid_t loc_id, unsigned idx)
done:
if (ret_value < 0 && attr)
- if(H5VL_attr_close(attr, obj->vol_info->vol_cls, H5AC_dxpl_id, H5_REQUEST_NULL) < 0)
+ if(H5VL_attr_close(attr, obj->vol_info->vol_cls, H5AC_ind_read_dxpl_id, H5_REQUEST_NULL) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "unable to release attr")
FUNC_LEAVE_API(ret_value)
@@ -337,8 +337,8 @@ H5Aget_num_attrs(hid_t loc_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* Get the group info through the VOL using the location token */
- if(H5VL_object_optional(obj->vol_obj, obj->vol_info->vol_cls, H5AC_ind_dxpl_id, H5_REQUEST_NULL,
- H5VL_OBJECT_GET_INFO, loc_params, &oinfo) < 0)
+ if(H5VL_object_optional(obj->vol_obj, obj->vol_info->vol_cls, H5AC_ind_read_dxpl_id,
+ H5_REQUEST_NULL, H5VL_OBJECT_GET_INFO, loc_params, &oinfo) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get group info")
ret_value = oinfo.num_attrs;
@@ -406,7 +406,7 @@ H5Aiterate1(hid_t loc_id, unsigned *attr_num, H5A_operator1_t op, void *op_data)
/* Call attribute iteration routine */
last_attr = start_idx = (hsize_t)(attr_num ? *attr_num : 0);
- if((ret_value = H5O_attr_iterate(loc_id, H5AC_ind_dxpl_id, H5_INDEX_CRT_ORDER, H5_ITER_INC, start_idx, &last_attr, &attr_op, op_data)) < 0)
+ if((ret_value = H5O_attr_iterate(loc_id, H5AC_ind_read_dxpl_id, H5_INDEX_CRT_ORDER, H5_ITER_INC, start_idx, &last_attr, &attr_op, op_data)) < 0)
HERROR(H5E_ATTR, H5E_BADITER, "error iterating over attributes");
/* Set the last attribute information */
diff --git a/src/H5Aint.c b/src/H5Aint.c
index cea52b8..64dcbaf 100644
--- a/src/H5Aint.c
+++ b/src/H5Aint.c
@@ -161,7 +161,7 @@ H5A_create(const H5G_loc_t *loc, const char *name, const H5T_t *type,
* name, but it's going to be hard to unwind all the special cases on
* failure, so just check first, for now - QAK)
*/
- if((exists = H5O_attr_exists(loc->oloc, name, H5AC_ind_dxpl_id)) < 0)
+ if((exists = H5O_attr_exists(loc->oloc, name, dxpl_id)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, NULL, "error checking attributes")
else if(exists > 0)
HGOTO_ERROR(H5E_ATTR, H5E_ALREADYEXISTS, NULL, "attribute already exists")
@@ -207,7 +207,7 @@ H5A_create(const H5G_loc_t *loc, const char *name, const H5T_t *type,
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "invalid datatype location")
/* Set the latest format for datatype, if requested */
- if(H5F_USE_LATEST_FORMAT(loc->oloc->file))
+ if(H5F_USE_LATEST_FLAGS(loc->oloc->file, H5F_LATEST_DATATYPE))
if(H5T_set_latest_version(attr->shared->dt) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't set latest version of datatype")
@@ -215,7 +215,7 @@ H5A_create(const H5G_loc_t *loc, const char *name, const H5T_t *type,
attr->shared->ds = H5S_copy(space, FALSE, TRUE);
/* Set the latest format for dataspace, if requested */
- if(H5F_USE_LATEST_FORMAT(loc->oloc->file))
+ if(H5F_USE_LATEST_FLAGS(loc->oloc->file, H5F_LATEST_DATASPACE))
if(H5S_set_latest_version(attr->shared->ds) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't set latest version of dataspace")
@@ -796,7 +796,7 @@ H5A_get_type(H5A_t *attr)
/* Patch the datatype's "top level" file pointer */
if(H5T_patch_file(attr->shared->dt, attr->oloc.file) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "unable to patch datatype's file pointer")
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to patch datatype's file pointer")
/*
* Copy the attribute's datatype. If the type is a named type then
@@ -1870,7 +1870,7 @@ herr_t
H5A_set_version(const H5F_t *f, H5A_t *attr)
{
hbool_t type_shared, space_shared; /* Flags to indicate that shared messages are used for this attribute */
- hbool_t use_latest_format; /* Flag indicating the newest file format should be used */
+ hbool_t use_latest_format; /* Flag indicating the latest attribute version support is enabled */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -1879,8 +1879,8 @@ H5A_set_version(const H5F_t *f, H5A_t *attr)
HDassert(f);
HDassert(attr);
- /* Get the file's 'use the latest version of the format' flag */
- use_latest_format = H5F_USE_LATEST_FORMAT(f);
+ /* Get the file's 'use the latest attribute version support' flag */
+ use_latest_format = H5F_USE_LATEST_FLAGS(f, H5F_LATEST_ATTRIBUTE);
/* Check whether datatype and dataspace are shared */
if(H5O_msg_is_shared(H5O_DTYPE_ID, attr->shared->dt) > 0)
@@ -2122,7 +2122,7 @@ H5A_attr_copy_file(const H5A_t *attr_src, H5F_t *file_dst, hbool_t *recompute_si
HDmemcpy(attr_dst->shared->data, buf, attr_dst->shared->data_size);
- if(H5D_vlen_reclaim(tid_mem, buf_space, H5P_DATASET_XFER_DEFAULT, reclaim_buf) < 0)
+ if(H5D_vlen_reclaim(tid_mem, buf_space, dxpl_id, reclaim_buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_BADITER, NULL, "unable to reclaim variable-length data")
} /* end if */
else {
@@ -2371,8 +2371,7 @@ H5A_dense_post_copy_file_all(const H5O_loc_t *src_oloc, const H5O_ainfo_t *ainfo
attr_op.op_type = H5A_ATTR_OP_LIB;
attr_op.u.lib_op = H5A__dense_post_copy_file_cb;
-
- if(H5A_dense_iterate(src_oloc->file, dxpl_id, (hid_t)0, ainfo_src, H5_INDEX_NAME,
+ if(H5A_dense_iterate(src_oloc->file, dxpl_id, (hid_t)0, ainfo_src, H5_INDEX_NAME,
H5_ITER_NATIVE, (hsize_t)0, NULL, &attr_op, &udata) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "error building attribute table")
@@ -2414,7 +2413,7 @@ H5A_rename_by_name(H5G_loc_t loc, const char *obj_name, const char *old_attr_nam
H5G_loc_reset(&obj_loc);
/* Find the object's location */
- if(H5G_loc_find(&loc, obj_name, &obj_loc/*out*/, lapl_id, H5AC_ind_dxpl_id) < 0)
+ if(H5G_loc_find(&loc, obj_name, &obj_loc/*out*/, lapl_id, dxpl_id) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "object not found")
loc_found = TRUE;
@@ -2446,7 +2445,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t H5A_iterate(void *obj, H5VL_loc_params_t loc_params, H5_index_t idx_type,
- H5_iter_order_t order, hsize_t *idx, H5A_operator2_t op, void *op_data)
+ H5_iter_order_t order, hsize_t *idx, H5A_operator2_t op, void *op_data, hid_t dxpl_id)
{
H5G_loc_t loc; /* Object location */
H5G_loc_t obj_loc; /* Location used to open group */
@@ -2475,25 +2474,22 @@ herr_t H5A_iterate(void *obj, H5VL_loc_params_t loc_params, H5_index_t idx_type,
last_attr = start_idx = (idx ? *idx : 0);
/* Iterate over the attributess */
- if(loc_params.type == H5VL_OBJECT_BY_SELF) {
- if((obj_loc_id = H5VL_native_register(loc_params.obj_type, obj, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register object")
- }
- else if(loc_params.type == H5VL_OBJECT_BY_NAME) {
+ if(loc_params.type == H5VL_OBJECT_BY_SELF || loc_params.type == H5VL_OBJECT_BY_NAME) {
+ hid_t lapl_id = (loc_params.type == H5VL_OBJECT_BY_SELF ? H5P_LINK_ACCESS_DEFAULT : loc_params.loc_data.loc_by_name.lapl_id);
+
/* Set up opened group location to fill in */
obj_loc.oloc = &obj_oloc;
obj_loc.path = &obj_path;
H5G_loc_reset(&obj_loc);
/* Find the object's location */
- if(H5G_loc_find(&loc, loc_params.loc_data.loc_by_name.name, &obj_loc/*out*/,
- loc_params.loc_data.loc_by_name.lapl_id, H5AC_ind_dxpl_id) < 0)
+ if(H5G_loc_find(&loc, (loc_params.type == H5VL_OBJECT_BY_SELF ? "." : loc_params.loc_data.loc_by_name.name),
+ &obj_loc, lapl_id, dxpl_id) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "object not found");
loc_found = TRUE;
/* Open the object */
- if((obj_loc_id = H5O_open_by_loc(&obj_loc, loc_params.loc_data.loc_by_name.lapl_id,
- H5AC_ind_dxpl_id, TRUE)) < 0)
+ if((obj_loc_id = H5O_open_by_loc(&obj_loc, lapl_id, dxpl_id, TRUE)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open object");
/* get the native object from the ID created by the object header and create
@@ -2510,7 +2506,7 @@ herr_t H5A_iterate(void *obj, H5VL_loc_params_t loc_params, H5_index_t idx_type,
}
/* Do the real iteration */
- if((ret_value = H5O_attr_iterate(obj_loc_id, H5AC_ind_dxpl_id, idx_type, order,
+ if((ret_value = H5O_attr_iterate(obj_loc_id, dxpl_id, idx_type, order,
start_idx, &last_attr, &attr_op, op_data)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_BADITER, FAIL, "error iterating over attributes");
@@ -2520,13 +2516,7 @@ herr_t H5A_iterate(void *obj, H5VL_loc_params_t loc_params, H5_index_t idx_type,
done:
/* Release resources */
- if(loc_params.type == H5VL_OBJECT_BY_SELF) {
- if(H5VL_native_unregister(obj_loc_id) < 0)
- HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to decrement vol plugin ref count")
- if(obj_loc_id >= 0 && NULL == H5I_remove(obj_loc_id))
- HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to free identifier");
- }
- else if(loc_params.type == H5VL_OBJECT_BY_NAME) {
+ if(loc_params.type == H5VL_OBJECT_BY_SELF || loc_params.type == H5VL_OBJECT_BY_NAME) {
if(obj_loc_id >= 0) {
if(H5I_dec_app_ref(obj_loc_id) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CANTDEC, FAIL, "unable to close temporary object");
@@ -2556,7 +2546,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5A_delete(void *obj, H5VL_loc_params_t loc_params, const char *attr_name)
+H5A_delete(void *obj, H5VL_loc_params_t loc_params, const char *attr_name, hid_t dxpl_id)
{
H5G_loc_t loc; /* Object location */
H5G_loc_t obj_loc; /* Location used to open group */
@@ -2573,7 +2563,7 @@ H5A_delete(void *obj, H5VL_loc_params_t loc_params, const char *attr_name)
if(H5VL_OBJECT_BY_SELF == loc_params.type) { /* H5Adelete */
/* Delete the attribute from the location */
- if(H5O_attr_remove(loc.oloc, attr_name, H5AC_dxpl_id) < 0)
+ if(H5O_attr_remove(loc.oloc, attr_name, dxpl_id) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute")
}
else if(H5VL_OBJECT_BY_NAME == loc_params.type) { /* H5Adelete_by_name */
@@ -2584,12 +2574,12 @@ H5A_delete(void *obj, H5VL_loc_params_t loc_params, const char *attr_name)
/* Find the object's location */
if(H5G_loc_find(&loc, loc_params.loc_data.loc_by_name.name, &obj_loc/*out*/,
- loc_params.loc_data.loc_by_name.lapl_id, H5AC_ind_dxpl_id) < 0)
+ loc_params.loc_data.loc_by_name.lapl_id, dxpl_id) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "object not found")
loc_found = TRUE;
/* Delete the attribute from the location */
- if(H5O_attr_remove(obj_loc.oloc, attr_name, H5AC_dxpl_id) < 0)
+ if(H5O_attr_remove(obj_loc.oloc, attr_name, dxpl_id) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute")
}
else if(H5VL_OBJECT_BY_IDX == loc_params.type) { /* H5Adelete_by_idx */
@@ -2600,14 +2590,14 @@ H5A_delete(void *obj, H5VL_loc_params_t loc_params, const char *attr_name)
/* Find the object's location */
if(H5G_loc_find(&loc, loc_params.loc_data.loc_by_idx.name, &obj_loc/*out*/,
- loc_params.loc_data.loc_by_idx.lapl_id, H5AC_ind_dxpl_id) < 0)
+ loc_params.loc_data.loc_by_idx.lapl_id, dxpl_id) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "object not found")
loc_found = TRUE;
/* Delete the attribute from the location */
if(H5O_attr_remove_by_idx(obj_loc.oloc, loc_params.loc_data.loc_by_idx.idx_type,
loc_params.loc_data.loc_by_idx.order,
- loc_params.loc_data.loc_by_idx.n, H5AC_dxpl_id) < 0)
+ loc_params.loc_data.loc_by_idx.n, dxpl_id) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute")
}
else {
diff --git a/src/H5Apkg.h b/src/H5Apkg.h
index 53ed6d2..be066de 100644
--- a/src/H5Apkg.h
+++ b/src/H5Apkg.h
@@ -203,8 +203,8 @@ H5_DLL herr_t H5A_rename_by_name(H5G_loc_t loc, const char *obj_name, const char
H5_DLL htri_t H5A_exists_by_name(H5G_loc_t loc, const char *obj_name, const char *attr_name,
hid_t lapl_id, hid_t dxpl_id);
H5_DLL herr_t H5A_iterate(void *obj, H5VL_loc_params_t loc_params, H5_index_t idx_type,
- H5_iter_order_t order, hsize_t *idx, H5A_operator2_t op, void *op_data);
-H5_DLL herr_t H5A_delete(void *obj, H5VL_loc_params_t loc_params, const char *attr_name);
+ H5_iter_order_t order, hsize_t *idx, H5A_operator2_t op, void *op_data, hid_t dxpl_id);
+H5_DLL herr_t H5A_delete(void *obj, H5VL_loc_params_t loc_params, const char *attr_name, hid_t dxpl_id);
H5_DLL herr_t H5A__write(H5A_t *attr, const H5T_t *mem_type, const void *buf, hid_t dxpl_id);
H5_DLL herr_t H5A__read(const H5A_t *attr, const H5T_t *mem_type, void *buf, hid_t dxpl_id);
H5_DLL ssize_t H5A__get_name(H5A_t *attr, size_t buf_size, char *buf);
@@ -223,15 +223,15 @@ H5_DLL herr_t H5A_dense_iterate(H5F_t *f, hid_t dxpl_id, hid_t loc_id,
const H5O_ainfo_t *ainfo, H5_index_t idx_type, H5_iter_order_t order,
hsize_t skip, hsize_t *last_attr, const H5A_attr_iter_op_t *attr_op,
void *op_data);
-H5_DLL herr_t H5A_dense_remove(H5F_t *f, hid_t dxpl_id, const H5O_ainfo_t *ainfo,
- const char *name);
-H5_DLL herr_t H5A_dense_remove_by_idx(H5F_t *f, hid_t dxpl_id, const H5O_ainfo_t *ainfo,
- H5_index_t idx_type, H5_iter_order_t order, hsize_t n);
+H5_DLL herr_t H5A_dense_remove(H5F_t *f, hid_t dxpl_id,
+ const H5O_ainfo_t *ainfo, const char *name);
+H5_DLL herr_t H5A_dense_remove_by_idx(H5F_t *f, hid_t dxpl_id,
+ const H5O_ainfo_t *ainfo, H5_index_t idx_type, H5_iter_order_t order,
+ hsize_t n);
H5_DLL htri_t H5A_dense_exists(H5F_t *f, hid_t dxpl_id, const H5O_ainfo_t *ainfo,
const char *name);
H5_DLL herr_t H5A_dense_delete(H5F_t *f, hid_t dxpl_id, H5O_ainfo_t *ainfo);
-
/* Attribute table operations */
H5_DLL herr_t H5A_compact_build_table(H5F_t *f, hid_t dxpl_id, H5O_t *oh,
H5_index_t idx_type, H5_iter_order_t order, H5A_attr_table_t *atable);
@@ -270,7 +270,6 @@ H5_DLL herr_t H5A_attr_post_copy_file(const H5O_loc_t *src_oloc, const H5A_t *me
H5_DLL herr_t H5A_dense_post_copy_file_all(const H5O_loc_t *src_oloc, const H5O_ainfo_t * ainfo_src,
H5O_loc_t *dst_oloc, H5O_ainfo_t *ainfo_dst, hid_t dxpl_id, H5O_copy_t *cpy_info);
-
/* Testing functions */
#ifdef H5A_TESTING
H5_DLL htri_t H5A_is_shared_test(hid_t aid);
diff --git a/src/H5Atest.c b/src/H5Atest.c
index 54bbdce..1cf1b2e 100644
--- a/src/H5Atest.c
+++ b/src/H5Atest.c
@@ -140,7 +140,7 @@ H5A_get_shared_rc_test(hid_t attr_id, hsize_t *ref_count)
HDassert(H5O_msg_is_shared(H5O_ATTR_ID, attr));
/* Retrieve ref count for shared or shareable attribute */
- if(H5SM_get_refcount(attr->oloc.file, H5AC_ind_dxpl_id, H5O_ATTR_ID,
+ if(H5SM_get_refcount(attr->oloc.file, H5AC_ind_read_dxpl_id, H5O_ATTR_ID,
&attr->sh_loc, ref_count) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't retrieve shared message ref count")
diff --git a/src/H5B.c b/src/H5B.c
index b26c38b..fcf61e1 100644
--- a/src/H5B.c
+++ b/src/H5B.c
@@ -653,7 +653,7 @@ H5B_insert(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, void
bt_ud.bt = NULL; /* Make certain future references will be caught */
/* Move the location of the old root on the disk */
- if(H5AC_move_entry(f, H5AC_BT, bt_ud.addr, old_root_addr) < 0)
+ if(H5AC_move_entry(f, H5AC_BT, bt_ud.addr, old_root_addr, dxpl_id) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to move B-tree root node")
bt_ud.addr = old_root_addr;
@@ -1731,14 +1731,13 @@ H5B_shared_new(const H5F_t *f, const H5B_class_t *type, size_t sizeof_rkey)
(shared->two_k + 1) * shared->sizeof_rkey); /*keys */
HDassert(shared->sizeof_rnode);
- /* Allocate shared buffers */
+ /* Allocate and clear shared buffers */
if(NULL == (shared->page = H5FL_BLK_MALLOC(page, shared->sizeof_rnode)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "memory allocation failed for B-tree page")
-#ifdef H5_CLEAR_MEMORY
-HDmemset(shared->page, 0, shared->sizeof_rnode);
-#endif /* H5_CLEAR_MEMORY */
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "memory allocation failed for B-tree page")
+ HDmemset(shared->page, 0, shared->sizeof_rnode);
+
if(NULL == (shared->nkey = H5FL_SEQ_MALLOC(size_t, (size_t)(shared->two_k + 1))))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "memory allocation failed for B-tree native keys")
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "memory allocation failed for B-tree native keys")
/* Initialize the offsets into the native key buffer */
for(u = 0; u < (shared->two_k + 1); u++)
diff --git a/src/H5B2.c b/src/H5B2.c
index a171917..bce6a9f 100644
--- a/src/H5B2.c
+++ b/src/H5B2.c
@@ -42,6 +42,7 @@
#include "H5private.h" /* Generic Functions */
#include "H5B2pkg.h" /* v2 B-trees */
#include "H5Eprivate.h" /* Error handling */
+#include "H5MMprivate.h" /* Memory management */
/****************/
@@ -86,6 +87,9 @@ extern const H5B2_class_t H5G_BT2_CORDER[1];
extern const H5B2_class_t H5SM_INDEX[1];
extern const H5B2_class_t H5A_BT2_NAME[1];
extern const H5B2_class_t H5A_BT2_CORDER[1];
+extern const H5B2_class_t H5D_BT2[1];
+extern const H5B2_class_t H5D_BT2_FILT[1];
+extern const H5B2_class_t H5B2_TEST2[1];
const H5B2_class_t *const H5B2_client_class_g[] = {
H5B2_TEST, /* 0 - H5B2_TEST_ID */
@@ -98,6 +102,9 @@ const H5B2_class_t *const H5B2_client_class_g[] = {
H5SM_INDEX, /* 7 - H5B2_SOHM_INDEX_ID */
H5A_BT2_NAME, /* 8 - H5B2_ATTR_DENSE_NAME_ID */
H5A_BT2_CORDER, /* 9 - H5B2_ATTR_DENSE_CORDER_ID */
+ H5D_BT2, /* 10 - H5B2_CDSET_ID */
+ H5D_BT2_FILT, /* 11 - H5B2_CDSET_FILT_ID */
+ H5B2_TEST2 /* 12 - H5B2_TEST_ID */
};
@@ -282,36 +289,78 @@ H5B2_insert(H5B2_t *bt2, hid_t dxpl_id, void *udata)
/* Get the v2 B-tree header */
hdr = bt2->hdr;
+ /* Insert the record */
+ if(H5B2__insert_hdr(hdr, dxpl_id, udata) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, FAIL, "unable to insert record into B-tree")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5B2_insert() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5B2_update
+ *
+ * Purpose: Insert or modify a record to the B-tree.
+ * If the record exists already, it is modified as if H5B2_modify
+ * was called). If it doesn't exist, it is inserted as if
+ * H5B2_insert was called.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Dec 23 2015
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5B2_update(H5B2_t *bt2, hid_t dxpl_id, void *udata, H5B2_modify_t op, void *op_data)
+{
+ H5B2_hdr_t *hdr; /* Pointer to the B-tree header */
+ H5B2_update_status_t status = H5B2_UPDATE_UNKNOWN; /* Whether the record was inserted/modified */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Check arguments. */
+ HDassert(bt2);
+ HDassert(udata);
+
+ /* Set the shared v2 B-tree header's file context for this operation */
+ bt2->hdr->f = bt2->f;
+
+ /* Get the v2 B-tree header */
+ hdr = bt2->hdr;
+
/* Check if the root node is allocated yet */
if(!H5F_addr_defined(hdr->root.addr)) {
/* Create root node as leaf node in B-tree */
if(H5B2__create_leaf(hdr, dxpl_id, &(hdr->root)) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "unable to create root node")
} /* end if */
- /* Check if we need to split the root node (equiv. to a 1->2 node split) */
- else if(hdr->root.node_nrec == hdr->node_info[hdr->depth].split_nrec) {
- /* Split root node */
- if(H5B2__split_root(hdr, dxpl_id) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to split root node")
- } /* end if */
/* Attempt to insert record into B-tree */
if(hdr->depth > 0) {
- if(H5B2__insert_internal(hdr, dxpl_id, hdr->depth, NULL, &hdr->root, H5B2_POS_ROOT, udata) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, FAIL, "unable to insert record into B-tree internal node")
+ if(H5B2__update_internal(hdr, dxpl_id, hdr->depth, NULL, &hdr->root, &status, H5B2_POS_ROOT, udata, op, op_data) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, FAIL, "unable to update record in B-tree internal node")
} /* end if */
else {
- if(H5B2__insert_leaf(hdr, dxpl_id, &hdr->root, H5B2_POS_ROOT, udata) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, FAIL, "unable to insert record into B-tree leaf node")
+ if(H5B2__update_leaf(hdr, dxpl_id, &hdr->root, &status, H5B2_POS_ROOT, udata, op, op_data) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, FAIL, "unable to update record in B-tree leaf node")
} /* end else */
- /* Mark B-tree header as dirty */
- if(H5B2__hdr_dirty(hdr) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTMARKDIRTY, FAIL, "unable to mark B-tree header dirty")
+ /* Sanity check */
+ HDassert(H5B2_UPDATE_UNKNOWN != status);
+
+ /* Use insert algorithm if nodes to leaf full */
+ if(H5B2_UPDATE_INSERT_CHILD_FULL == status)
+ if(H5B2__insert_hdr(hdr, dxpl_id, udata) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, FAIL, "unable to insert record into B-tree")
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5B2_insert() */
+} /* H5B2_update() */
/*-------------------------------------------------------------------------
@@ -448,8 +497,10 @@ H5B2_find(H5B2_t *bt2, hid_t dxpl_id, void *udata, H5B2_found_t op,
* find candidates or avoid further searching.
*/
if(hdr->min_native_rec != NULL) {
- if((cmp = (hdr->cls->compare)(udata, hdr->min_native_rec)) < 0)
- HGOTO_DONE(FALSE) /* Less than the least record--not found */
+ if((hdr->cls->compare)(udata, hdr->min_native_rec, &cmp) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records")
+ if(cmp < 0)
+ HGOTO_DONE(FALSE) /* Less than the least record--not found */
else if(cmp == 0) { /* Record is found */
if(op && (op)(hdr->min_native_rec, op_data) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "'found' callback failed for B-tree find operation")
@@ -457,8 +508,10 @@ H5B2_find(H5B2_t *bt2, hid_t dxpl_id, void *udata, H5B2_found_t op,
} /* end if */
} /* end if */
if(hdr->max_native_rec != NULL) {
- if((cmp = (hdr->cls->compare)(udata, hdr->max_native_rec)) > 0)
- HGOTO_DONE(FALSE) /* Greater than the greatest record--not found */
+ if((hdr->cls->compare)(udata, hdr->max_native_rec, &cmp) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records")
+ if(cmp > 0)
+ HGOTO_DONE(FALSE) /* Less than the least record--not found */
else if(cmp == 0) { /* Record is found */
if(op && (op)(hdr->max_native_rec, op_data) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "'found' callback failed for B-tree find operation")
@@ -481,10 +534,15 @@ H5B2_find(H5B2_t *bt2, hid_t dxpl_id, void *udata, H5B2_found_t op,
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree internal node")
/* Locate node pointer for child */
- cmp = H5B2__locate_record(hdr->cls, internal->nrec, hdr->nat_off, internal->int_native, udata, &idx);
+ if(H5B2__locate_record(hdr->cls, internal->nrec, hdr->nat_off, internal->int_native,
+ udata, &idx, &cmp) < 0) {
+ /* Unlock current node before failing */
+ H5AC_unprotect(hdr->f, dxpl_id, H5AC_BT2_INT, curr_node_ptr.addr, internal, H5AC__NO_FLAGS_SET);
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records")
+ } /* end if */
+
if(cmp > 0)
idx++;
-
if(cmp != 0) {
/* Get node pointer for next node to search */
next_node_ptr=internal->node_ptrs[idx];
@@ -544,7 +602,12 @@ H5B2_find(H5B2_t *bt2, hid_t dxpl_id, void *udata, H5B2_found_t op,
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node")
/* Locate record */
- cmp = H5B2__locate_record(hdr->cls, leaf->nrec, hdr->nat_off, leaf->leaf_native, udata, &idx);
+ if(H5B2__locate_record(hdr->cls, leaf->nrec, hdr->nat_off, leaf->leaf_native,
+ udata, &idx, &cmp) < 0) {
+ /* unlock current node before failing */
+ H5AC_unprotect(hdr->f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr.addr, leaf, H5AC__NO_FLAGS_SET);
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records")
+ }
if(cmp != 0) {
/* Unlock leaf node */
@@ -570,7 +633,7 @@ H5B2_find(H5B2_t *bt2, hid_t dxpl_id, void *udata, H5B2_found_t op,
if(idx == 0) {
if(H5B2_POS_LEFT == curr_pos || H5B2_POS_ROOT == curr_pos) {
if(hdr->min_native_rec == NULL)
- if(NULL == (hdr->min_native_rec = (uint8_t *)HDmalloc(hdr->cls->nrec_size)))
+ if(NULL == (hdr->min_native_rec = H5MM_malloc(hdr->cls->nrec_size)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "memory allocation failed for v2 B-tree min record info")
HDmemcpy(hdr->min_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size);
} /* end if */
@@ -578,7 +641,7 @@ H5B2_find(H5B2_t *bt2, hid_t dxpl_id, void *udata, H5B2_found_t op,
if(idx == (unsigned)(leaf->nrec - 1)) {
if(H5B2_POS_RIGHT == curr_pos || H5B2_POS_ROOT == curr_pos) {
if(hdr->max_native_rec == NULL)
- if(NULL == (hdr->max_native_rec = (uint8_t *)HDmalloc(hdr->cls->nrec_size)))
+ if(NULL == (hdr->max_native_rec = H5MM_malloc(hdr->cls->nrec_size)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "memory allocation failed for v2 B-tree max record info")
HDmemcpy(hdr->max_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size);
} /* end if */
@@ -1072,7 +1135,13 @@ H5B2_modify(H5B2_t *bt2, hid_t dxpl_id, void *udata, H5B2_modify_t op,
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree internal node")
/* Locate node pointer for child */
- cmp = H5B2__locate_record(hdr->cls, internal->nrec, hdr->nat_off, internal->int_native, udata, &idx);
+ if(H5B2__locate_record(hdr->cls, internal->nrec, hdr->nat_off, internal->int_native,
+ udata, &idx, &cmp) < 0) {
+ /* Unlock current node */
+ H5AC_unprotect(hdr->f, dxpl_id, H5AC_BT2_INT, curr_node_ptr.addr, internal, H5AC__NO_FLAGS_SET);
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records")
+ }
+
if(cmp > 0)
idx++;
@@ -1144,7 +1213,11 @@ H5B2_modify(H5B2_t *bt2, hid_t dxpl_id, void *udata, H5B2_modify_t op,
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node")
/* Locate record */
- cmp = H5B2__locate_record(hdr->cls, leaf->nrec, hdr->nat_off, leaf->leaf_native, udata, &idx);
+ if(H5B2__locate_record(hdr->cls, leaf->nrec, hdr->nat_off, leaf->leaf_native,
+ udata, &idx, &cmp) < 0) {
+ H5AC_unprotect(hdr->f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr.addr, leaf, H5AC__NO_FLAGS_SET);
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records")
+ }
if(cmp != 0) {
/* Unlock leaf node */
@@ -1180,7 +1253,7 @@ H5B2_modify(H5B2_t *bt2, hid_t dxpl_id, void *udata, H5B2_modify_t op,
if(idx == 0) {
if(H5B2_POS_LEFT == curr_pos || H5B2_POS_ROOT == curr_pos) {
if(hdr->min_native_rec == NULL)
- if(NULL == (hdr->min_native_rec = (uint8_t *)HDmalloc(hdr->cls->nrec_size)))
+ if(NULL == (hdr->min_native_rec = H5MM_malloc(hdr->cls->nrec_size)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "memory allocation failed for v2 B-tree min record info")
HDmemcpy(hdr->min_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size);
} /* end if */
@@ -1188,7 +1261,7 @@ H5B2_modify(H5B2_t *bt2, hid_t dxpl_id, void *udata, H5B2_modify_t op,
if(idx == (unsigned)(leaf->nrec - 1)) {
if(H5B2_POS_RIGHT == curr_pos || H5B2_POS_ROOT == curr_pos) {
if(hdr->max_native_rec == NULL)
- if(NULL == (hdr->max_native_rec = (uint8_t *)HDmalloc(hdr->cls->nrec_size)))
+ if(NULL == (hdr->max_native_rec = H5MM_malloc(hdr->cls->nrec_size)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "memory allocation failed for v2 B-tree max record info")
HDmemcpy(hdr->max_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size);
} /* end if */
@@ -1202,7 +1275,7 @@ H5B2_modify(H5B2_t *bt2, hid_t dxpl_id, void *udata, H5B2_modify_t op,
/* Unlock current node */
if(H5AC_unprotect(hdr->f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr.addr, leaf, leaf_flags) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
- }
+ } /* end block */
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -1376,3 +1449,33 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5B2_delete() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5B2_patch_file
+ *
+ * Purpose: Patch the top-level file pointer contained in bt2
+ * to point to idx_info->f if they are different.
+ * This is possible because the file pointer in bt2 can be
+ * closed out if bt2 remains open.
+ *
+ * Return: SUCCEED
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5B2_patch_file(H5B2_t *bt2, H5F_t *f)
+{
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+
+ /*
+ * Check arguments.
+ */
+ HDassert(bt2);
+ HDassert(f);
+
+ if(bt2->f != f || bt2->hdr->f != f)
+ bt2->f = bt2->hdr->f = f;
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* H5B2_patch_file() */
+
diff --git a/src/H5B2cache.c b/src/H5B2cache.c
index 57f794b..b899f6a 100644
--- a/src/H5B2cache.c
+++ b/src/H5B2cache.c
@@ -698,10 +698,8 @@ H5B2__cache_int_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED le
/* Sanity check */
HDassert((size_t)(image - (uint8_t *)_image) <= len);
-#ifdef H5_CLEAR_MEMORY
/* Clear rest of internal node */
HDmemset(image, 0, len - (size_t)(image - (uint8_t *)_image));
-#endif /* H5_CLEAR_MEMORY */
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -975,10 +973,8 @@ H5B2__cache_leaf_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED l
/* Sanity check */
HDassert((size_t)(image - (uint8_t *)_image) <= len);
-#ifdef H5_CLEAR_MEMORY
/* Clear rest of leaf node */
HDmemset(image, 0, len - (size_t)(image - (uint8_t *)_image));
-#endif /* H5_CLEAR_MEMORY */
done:
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5B2dbg.c b/src/H5B2dbg.c
index 73084d2..ddff9e9 100644
--- a/src/H5B2dbg.c
+++ b/src/H5B2dbg.c
@@ -92,7 +92,6 @@ H5B2__hdr_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent,
const H5B2_class_t *type, haddr_t obj_addr)
{
H5B2_hdr_t *hdr = NULL; /* B-tree header info */
- void *dbg_ctx = NULL; /* v2 B-tree debugging context */
unsigned u; /* Local index variable */
char temp_str[128]; /* Temporary string, for formatting */
herr_t ret_value = SUCCEED; /* Return value */
@@ -109,17 +108,9 @@ H5B2__hdr_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent,
HDassert(indent >= 0);
HDassert(fwidth >= 0);
HDassert(type);
- HDassert((type->crt_dbg_ctx && type->dst_dbg_ctx) ||
- (NULL == type->crt_dbg_ctx && NULL == type->dst_dbg_ctx));
-
- /* Check for debugging context callback available */
- if(type->crt_dbg_ctx)
- /* Create debugging context */
- if(NULL == (dbg_ctx = (type->crt_dbg_ctx)(f, dxpl_id, obj_addr)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "unable to create v2 B-tree debugging context")
/* Load the B-tree header */
- if(NULL == (hdr = H5B2__hdr_protect(f, dxpl_id, addr, dbg_ctx, H5AC__READ_ONLY_FLAG)))
+ if(NULL == (hdr = H5B2__hdr_protect(f, dxpl_id, addr, f, H5AC__READ_ONLY_FLAG)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load B-tree header")
/* Set file pointer for this B-tree operation */
@@ -171,8 +162,6 @@ H5B2__hdr_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent,
} /* end for */
done:
- if(dbg_ctx && (type->dst_dbg_ctx)(dbg_ctx) < 0)
- HDONE_ERROR(H5E_BTREE, H5E_CANTRELEASE, FAIL, "unable to release v2 B-tree debugging context")
if(hdr && H5B2__hdr_unprotect(hdr, dxpl_id, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release v2 B-tree header")
@@ -199,7 +188,6 @@ H5B2__int_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent,
{
H5B2_hdr_t *hdr = NULL; /* B-tree header */
H5B2_internal_t *internal = NULL; /* B-tree internal node */
- void *dbg_ctx = NULL; /* v2 B-tree debugging context */
unsigned u; /* Local index variable */
char temp_str[128]; /* Temporary string, for formatting */
herr_t ret_value=SUCCEED; /* Return value */
@@ -215,21 +203,12 @@ H5B2__int_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent,
HDassert(indent >= 0);
HDassert(fwidth >= 0);
HDassert(type);
- HDassert((type->crt_dbg_ctx && type->dst_dbg_ctx) ||
- (NULL == type->crt_dbg_ctx && NULL == type->dst_dbg_ctx));
HDassert(H5F_addr_defined(hdr_addr));
HDassert(H5F_addr_defined(obj_addr));
HDassert(nrec > 0);
- /* Check for debugging context callback available */
- if(type->crt_dbg_ctx) {
- /* Create debugging context */
- if(NULL == (dbg_ctx = (type->crt_dbg_ctx)(f, dxpl_id, obj_addr)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "unable to create v2 B-tree debugging context")
- } /* end if */
-
/* Load the B-tree header */
- if(NULL == (hdr = H5B2__hdr_protect(f, dxpl_id, hdr_addr, dbg_ctx, H5AC__READ_ONLY_FLAG)))
+ if(NULL == (hdr = H5B2__hdr_protect(f, dxpl_id, hdr_addr, f, H5AC__READ_ONLY_FLAG)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load v2 B-tree header")
/* Set file pointer for this B-tree operation */
@@ -279,7 +258,7 @@ H5B2__int_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent,
HDfprintf(stream, "%*s%-*s\n", indent + 3, "", MAX(0, fwidth - 3),
temp_str);
HDassert(H5B2_INT_NREC(internal, hdr, u));
- (void)(type->debug)(stream, indent + 6, MAX (0, fwidth-6), H5B2_INT_NREC(internal, hdr, u), dbg_ctx);
+ (void)(type->debug)(stream, indent + 6, MAX (0, fwidth-6), H5B2_INT_NREC(internal, hdr, u), hdr->cb_ctx);
} /* end for */
/* Print final node pointer */
@@ -291,8 +270,6 @@ H5B2__int_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent,
internal->node_ptrs[u].addr);
done:
- if(dbg_ctx && (type->dst_dbg_ctx)(dbg_ctx) < 0)
- HDONE_ERROR(H5E_BTREE, H5E_CANTRELEASE, FAIL, "unable to release v2 B-tree debugging context")
if(hdr && H5B2__hdr_unprotect(hdr, dxpl_id, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release v2 B-tree header")
if(internal && H5AC_unprotect(f, dxpl_id, H5AC_BT2_INT, addr, internal, H5AC__NO_FLAGS_SET) < 0)
@@ -321,7 +298,6 @@ H5B2__leaf_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent
{
H5B2_hdr_t *hdr = NULL; /* B-tree header */
H5B2_leaf_t *leaf = NULL; /* B-tree leaf node */
- void *dbg_ctx = NULL; /* v2 B-tree debugging context */
unsigned u; /* Local index variable */
char temp_str[128]; /* Temporary string, for formatting */
herr_t ret_value = SUCCEED; /* Return value */
@@ -337,20 +313,12 @@ H5B2__leaf_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent
HDassert(indent >= 0);
HDassert(fwidth >= 0);
HDassert(type);
- HDassert((type->crt_dbg_ctx && type->dst_dbg_ctx) ||
- (NULL == type->crt_dbg_ctx && NULL == type->dst_dbg_ctx));
HDassert(H5F_addr_defined(hdr_addr));
HDassert(H5F_addr_defined(obj_addr));
HDassert(nrec > 0);
- /* Check for debugging context callback available */
- if(type->crt_dbg_ctx)
- /* Create debugging context */
- if(NULL == (dbg_ctx = (type->crt_dbg_ctx)(f, dxpl_id, obj_addr)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "unable to create v2 B-tree debugging context")
-
/* Load the B-tree header */
- if(NULL == (hdr = H5B2__hdr_protect(f, dxpl_id, hdr_addr, dbg_ctx, H5AC__READ_ONLY_FLAG)))
+ if(NULL == (hdr = H5B2__hdr_protect(f, dxpl_id, hdr_addr, f, H5AC__READ_ONLY_FLAG)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect v2 B-tree header")
/* Set file pointer for this B-tree operation */
@@ -391,12 +359,10 @@ H5B2__leaf_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent
HDfprintf(stream, "%*s%-*s\n", indent + 3, "", MAX(0, fwidth - 3),
temp_str);
HDassert(H5B2_LEAF_NREC(leaf, hdr, u));
- (void)(type->debug)(stream, indent + 6, MAX (0, fwidth-6), H5B2_LEAF_NREC(leaf, hdr, u), dbg_ctx);
+ (void)(type->debug)(stream, indent + 6, MAX (0, fwidth-6), H5B2_LEAF_NREC(leaf, hdr, u), hdr->cb_ctx);
} /* end for */
done:
- if(dbg_ctx && (type->dst_dbg_ctx)(dbg_ctx) < 0)
- HDONE_ERROR(H5E_BTREE, H5E_CANTRELEASE, FAIL, "unable to release v2 B-tree debugging context")
if(hdr && H5B2__hdr_unprotect(hdr, dxpl_id, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release B-tree header")
if(leaf && H5AC_unprotect(f, dxpl_id, H5AC_BT2_LEAF, addr, leaf, H5AC__NO_FLAGS_SET) < 0)
diff --git a/src/H5B2hdr.c b/src/H5B2hdr.c
index 25ac141..49ffb5b 100644
--- a/src/H5B2hdr.c
+++ b/src/H5B2hdr.c
@@ -38,7 +38,8 @@
#include "H5B2pkg.h" /* v2 B-trees */
#include "H5Eprivate.h" /* Error handling */
#include "H5MFprivate.h" /* File memory management */
-#include "H5VMprivate.h" /* Vectors and arrays */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5VMprivate.h" /* Vectors and arrays */
/****************/
/* Local Macros */
@@ -151,9 +152,7 @@ H5B2__hdr_init(H5B2_hdr_t *hdr, const H5B2_create_t *cparam, void *ctx_udata,
/* Allocate "page" for node I/O */
if(NULL == (hdr->page = H5FL_BLK_MALLOC(node_page, hdr->node_size)))
HGOTO_ERROR(H5E_BTREE, H5E_NOSPACE, FAIL, "memory allocation failed")
-#ifdef H5_CLEAR_MEMORY
-HDmemset(hdr->page, 0, hdr->node_size);
-#endif /* H5_CLEAR_MEMORY */
+ HDmemset(hdr->page, 0, hdr->node_size);
/* Allocate array of node info structs */
if(NULL == (hdr->node_info = H5FL_SEQ_MALLOC(H5B2_node_info_t, (size_t)(hdr->depth + 1))))
@@ -619,14 +618,10 @@ H5B2__hdr_free(H5B2_hdr_t *hdr)
} /* end if */
/* Release the min & max record info, if set */
- if(hdr->min_native_rec) {
- HDfree(hdr->min_native_rec);
- hdr->min_native_rec = NULL;
- } /* end if */
- if(hdr->max_native_rec) {
- HDfree(hdr->max_native_rec);
- hdr->max_native_rec = NULL;
- } /* end if */
+ if(hdr->min_native_rec)
+ hdr->min_native_rec = H5MM_xfree(hdr->min_native_rec);
+ if(hdr->max_native_rec)
+ hdr->max_native_rec = H5MM_xfree(hdr->max_native_rec);
/* Free B-tree header info */
hdr = H5FL_FREE(H5B2_hdr_t, hdr);
diff --git a/src/H5B2int.c b/src/H5B2int.c
index b8c9634..8bdde3e 100644
--- a/src/H5B2int.c
+++ b/src/H5B2int.c
@@ -38,7 +38,8 @@
#include "H5B2pkg.h" /* v2 B-trees */
#include "H5Eprivate.h" /* Error handling */
#include "H5MFprivate.h" /* File memory management */
-#include "H5VMprivate.h" /* Vectors and arrays */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5VMprivate.h" /* Vectors and arrays */
/****************/
/* Local Macros */
@@ -133,28 +134,33 @@ H5FL_SEQ_EXTERN(H5B2_node_info_t);
*
*-------------------------------------------------------------------------
*/
-int
+herr_t
H5B2__locate_record(const H5B2_class_t *type, unsigned nrec, size_t *rec_off,
- const uint8_t *native, const void *udata, unsigned *idx)
+ const uint8_t *native, const void *udata, unsigned *idx, int *cmp)
{
unsigned lo = 0, hi; /* Low & high index values */
unsigned my_idx = 0; /* Final index value */
- int cmp = -1; /* Key comparison value */
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_PACKAGE
- FUNC_ENTER_PACKAGE_NOERR
+ *cmp = -1;
hi = nrec;
- while(lo < hi && cmp) {
- my_idx = (lo + hi) / 2;
- if((cmp = (type->compare)(udata, native + rec_off[my_idx])) < 0)
- hi = my_idx;
- else
- lo = my_idx + 1;
- }
+ while(lo < hi && *cmp) {
+ my_idx = (lo + hi) / 2;
+ if((type->compare)(udata, native + rec_off[my_idx], cmp) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records")
+ if(*cmp < 0)
+ hi = my_idx;
+ else
+ lo = my_idx + 1;
+ } /* end while */
*idx = my_idx;
- FUNC_LEAVE_NOAPI(cmp)
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5B2__locate_record */
@@ -1513,6 +1519,62 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5B2__insert_hdr
+ *
+ * Purpose: Adds a new record to the B-tree.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Dec 23 2015
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5B2__insert_hdr(H5B2_hdr_t *hdr, hid_t dxpl_id, void *udata)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ /* Check arguments. */
+ HDassert(hdr);
+ HDassert(udata);
+
+ /* Check if the root node is allocated yet */
+ if(!H5F_addr_defined(hdr->root.addr)) {
+ /* Create root node as leaf node in B-tree */
+ if(H5B2__create_leaf(hdr, dxpl_id, &(hdr->root)) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "unable to create root node")
+ } /* end if */
+ /* Check if we need to split the root node (equiv. to a 1->2 node split) */
+ else if(hdr->root.node_nrec == hdr->node_info[hdr->depth].split_nrec) {
+ /* Split root node */
+ if(H5B2__split_root(hdr, dxpl_id) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to split root node")
+ } /* end if */
+
+ /* Attempt to insert record into B-tree */
+ if(hdr->depth > 0) {
+ if(H5B2__insert_internal(hdr, dxpl_id, hdr->depth, NULL, &hdr->root, H5B2_POS_ROOT, udata) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, FAIL, "unable to insert record into B-tree internal node")
+ } /* end if */
+ else {
+ if(H5B2__insert_leaf(hdr, dxpl_id, &hdr->root, H5B2_POS_ROOT, udata) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, FAIL, "unable to insert record into B-tree leaf node")
+ } /* end else */
+
+ /* Mark B-tree header as dirty */
+ if(H5B2__hdr_dirty(hdr) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTMARKDIRTY, FAIL, "unable to mark B-tree header dirty")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5B2__insert_hdr() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5B2__insert_leaf
*
* Purpose: Adds a new record to a B-tree leaf node.
@@ -1557,7 +1619,9 @@ H5B2__insert_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, H5B2_node_ptr_t *curr_node_ptr
idx = 0;
else {
/* Find correct location to insert this record */
- if((cmp = H5B2__locate_record(hdr->cls, leaf->nrec, hdr->nat_off, leaf->leaf_native, udata, &idx)) == 0)
+ if(H5B2__locate_record(hdr->cls, leaf->nrec, hdr->nat_off, leaf->leaf_native, udata, &idx, &cmp) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records")
+ if(cmp == 0)
HGOTO_ERROR(H5E_BTREE, H5E_EXISTS, FAIL, "record is already in B-tree")
if(cmp > 0)
idx++;
@@ -1584,7 +1648,7 @@ H5B2__insert_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, H5B2_node_ptr_t *curr_node_ptr
if(idx == 0) {
if(H5B2_POS_LEFT == curr_pos || H5B2_POS_ROOT == curr_pos) {
if(hdr->min_native_rec == NULL)
- if(NULL == (hdr->min_native_rec = (uint8_t *)HDmalloc(hdr->cls->nrec_size)))
+ if(NULL == (hdr->min_native_rec = H5MM_malloc(hdr->cls->nrec_size)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "memory allocation failed for v2 B-tree min record info")
HDmemcpy(hdr->min_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size);
} /* end if */
@@ -1592,7 +1656,7 @@ H5B2__insert_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, H5B2_node_ptr_t *curr_node_ptr
if(idx == (unsigned)(leaf->nrec - 1)) {
if(H5B2_POS_RIGHT == curr_pos || H5B2_POS_ROOT == curr_pos) {
if(hdr->max_native_rec == NULL)
- if(NULL == (hdr->max_native_rec = (uint8_t *)HDmalloc(hdr->cls->nrec_size)))
+ if(NULL == (hdr->max_native_rec = H5MM_malloc(hdr->cls->nrec_size)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "memory allocation failed for v2 B-tree max record info")
HDmemcpy(hdr->max_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size);
} /* end if */
@@ -1644,6 +1708,9 @@ H5B2__insert_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, uint16_t depth,
if(NULL == (internal = H5B2__protect_internal(hdr, dxpl_id, curr_node_ptr->addr, curr_node_ptr->node_nrec, depth, H5AC__NO_FLAGS_SET)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node")
+ /* Sanity check number of records */
+ HDassert(internal->nrec == curr_node_ptr->node_nrec);
+
/* Split or redistribute child node pointers, if necessary */
{
int cmp; /* Comparison value of records */
@@ -1651,7 +1718,10 @@ H5B2__insert_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, uint16_t depth,
size_t split_nrec; /* Number of records to split node at */
/* Locate node pointer for child */
- if((cmp = H5B2__locate_record(hdr->cls, internal->nrec, hdr->nat_off, internal->int_native, udata, &idx)) == 0)
+ if(H5B2__locate_record(hdr->cls, internal->nrec, hdr->nat_off, internal->int_native,
+ udata, &idx, &cmp) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records")
+ if(cmp == 0)
HGOTO_ERROR(H5E_BTREE, H5E_EXISTS, FAIL, "record is already in B-tree")
if(cmp > 0)
idx++;
@@ -1706,8 +1776,11 @@ H5B2__insert_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, uint16_t depth,
} /* end else */
/* Locate node pointer for child (after split/redistribute) */
-/* Actually, this can be easily updated (for 2-node redistrib.) and shouldn't require re-searching */
- if((cmp = H5B2__locate_record(hdr->cls, internal->nrec, hdr->nat_off, internal->int_native, udata, &idx)) == 0)
+ /* Actually, this can be easily updated (for 2-node redistrib.) and shouldn't require re-searching */
+ if(H5B2__locate_record(hdr->cls, internal->nrec, hdr->nat_off, internal->int_native,
+ udata, &idx, &cmp) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records")
+ if(cmp == 0)
HGOTO_ERROR(H5E_BTREE, H5E_EXISTS, FAIL, "record is already in B-tree")
if(cmp > 0)
idx++;
@@ -1755,6 +1828,350 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5B2__update_leaf
+ *
+ * Purpose: Insert or modify a record in a B-tree leaf node.
+ * If the record exists already, it is modified as if H5B2_modify
+ * was called). If it doesn't exist, it is inserted as if
+ * H5B2_insert was called.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Dec 23 2015
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5B2__update_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, H5B2_node_ptr_t *curr_node_ptr,
+ H5B2_update_status_t *status, H5B2_nodepos_t curr_pos, void *udata,
+ H5B2_modify_t op, void *op_data)
+{
+ H5B2_leaf_t *leaf; /* Pointer to leaf node */
+ unsigned leaf_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting the leaf node */
+ int cmp = -1; /* Comparison value of records */
+ unsigned idx; /* Location of record which matches key */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ /* Check arguments. */
+ HDassert(hdr);
+ HDassert(curr_node_ptr);
+ HDassert(H5F_addr_defined(curr_node_ptr->addr));
+
+ /* Lock current B-tree node */
+ if(NULL == (leaf = H5B2__protect_leaf(hdr, dxpl_id, curr_node_ptr->addr, curr_node_ptr->node_nrec, H5AC__NO_FLAGS_SET)))
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node")
+
+ /* Sanity check number of records */
+ HDassert(curr_node_ptr->all_nrec == curr_node_ptr->node_nrec);
+ HDassert(leaf->nrec == curr_node_ptr->node_nrec);
+
+ /* Check for inserting into empty leaf */
+ if(leaf->nrec == 0)
+ idx = 0;
+ else {
+ /* Find correct location to insert this record */
+ if(H5B2__locate_record(hdr->cls, leaf->nrec, hdr->nat_off, leaf->leaf_native, udata, &idx, &cmp) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records")
+
+ /* Check for inserting a record */
+ if(0 != cmp) {
+ /* Check if the leaf node is full */
+ if(curr_node_ptr->node_nrec == hdr->node_info[0].split_nrec) {
+ /* Indicate that the leaf is full, but we need to insert */
+ *status = H5B2_UPDATE_INSERT_CHILD_FULL;
+
+ /* Let calling routine handle insertion */
+ HGOTO_DONE(SUCCEED)
+ } /* end if */
+
+ /* Adjust index to leave room for record to insert */
+ if(cmp > 0)
+ idx++;
+
+ /* Make room for new record */
+ if(idx < leaf->nrec)
+ HDmemmove(H5B2_LEAF_NREC(leaf, hdr, idx + 1), H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size * (leaf->nrec - idx));
+ } /* end if */
+ } /* end else */
+
+ /* Check for modifying existing record */
+ if(0 == cmp) {
+ hbool_t changed = FALSE; /* Whether the 'modify' callback changed the record */
+
+ /* Make callback for current record */
+ if((op)(H5B2_LEAF_NREC(leaf, hdr, idx), op_data, &changed) < 0) {
+ /* Make certain that the callback didn't modify the value if it failed */
+ HDassert(changed == FALSE);
+
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTMODIFY, FAIL, "'modify' callback failed for B-tree update operation")
+ } /* end if */
+
+ /* Mark the node as dirty if it changed */
+ leaf_flags |= (changed ? H5AC__DIRTIED_FLAG : 0);
+
+ /* Indicate that the record was modified */
+ *status = H5B2_UPDATE_MODIFY_DONE;
+ } /* end if */
+ else {
+ /* Must have a leaf node with enough space to insert a record now */
+ HDassert(curr_node_ptr->node_nrec < hdr->node_info[0].max_nrec);
+
+ /* Make callback to store record in native form */
+ if((hdr->cls->store)(H5B2_LEAF_NREC(leaf, hdr, idx), udata) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, FAIL, "unable to insert record into leaf node")
+
+ /* Mark the node as dirty if it changed */
+ leaf_flags |= H5AC__DIRTIED_FLAG;
+
+ /* Indicate that the record was inserted */
+ *status = H5B2_UPDATE_INSERT_DONE;
+
+ /* Update record count for node pointer to current node */
+ curr_node_ptr->all_nrec++;
+ curr_node_ptr->node_nrec++;
+
+ /* Update record count for current node */
+ leaf->nrec++;
+ } /* end else */
+
+ /* Check for new record being the min or max for the tree */
+ /* (Don't use 'else' for the idx check, to allow for root leaf node) */
+ if(H5B2_POS_MIDDLE != curr_pos) {
+ if(idx == 0) {
+ if(H5B2_POS_LEFT == curr_pos || H5B2_POS_ROOT == curr_pos) {
+ if(hdr->min_native_rec == NULL)
+ if(NULL == (hdr->min_native_rec = H5MM_malloc(hdr->cls->nrec_size)))
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "memory allocation failed for v2 B-tree min record info")
+ HDmemcpy(hdr->min_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size);
+ } /* end if */
+ } /* end if */
+ if(idx == (unsigned)(leaf->nrec - 1)) {
+ if(H5B2_POS_RIGHT == curr_pos || H5B2_POS_ROOT == curr_pos) {
+ if(hdr->max_native_rec == NULL)
+ if(NULL == (hdr->max_native_rec = H5MM_malloc(hdr->cls->nrec_size)))
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "memory allocation failed for v2 B-tree max record info")
+ HDmemcpy(hdr->max_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size);
+ } /* end if */
+ } /* end if */
+ } /* end if */
+
+done:
+ /* Release the B-tree leaf node */
+ if(leaf && H5AC_unprotect(hdr->f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr->addr, leaf, leaf_flags) < 0)
+ HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release leaf B-tree node")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5B2__update_leaf() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5B2__update_internal
+ *
+ * Purpose: Insert or modify a record in a B-tree leaf node.
+ * If the record exists already, it is modified as if H5B2_modify
+ * was called). If it doesn't exist, it is inserted as if
+ * H5B2_insert was called.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Dec 24 2015
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5B2__update_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, uint16_t depth,
+ unsigned *parent_cache_info_flags_ptr, H5B2_node_ptr_t *curr_node_ptr,
+ H5B2_update_status_t *status, H5B2_nodepos_t curr_pos, void *udata,
+ H5B2_modify_t op, void *op_data)
+{
+ H5B2_internal_t *internal = NULL; /* Pointer to internal node */
+ unsigned internal_flags = H5AC__NO_FLAGS_SET;
+ int cmp; /* Comparison value of records */
+ unsigned idx; /* Location of record which matches key */
+ H5B2_nodepos_t next_pos = H5B2_POS_MIDDLE; /* Position of node */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ /* Check arguments. */
+ HDassert(hdr);
+ HDassert(depth > 0);
+ HDassert(curr_node_ptr);
+ HDassert(H5F_addr_defined(curr_node_ptr->addr));
+
+ /* Lock current B-tree node */
+ if(NULL == (internal = H5B2__protect_internal(hdr, dxpl_id, curr_node_ptr->addr, curr_node_ptr->node_nrec, depth, H5AC__NO_FLAGS_SET)))
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node")
+
+ /* Sanity check number of records */
+ HDassert(internal->nrec == curr_node_ptr->node_nrec);
+
+ /* Locate node pointer for child */
+ if(H5B2__locate_record(hdr->cls, internal->nrec, hdr->nat_off, internal->int_native, udata, &idx, &cmp) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records")
+
+ /* Check for modifying existing record */
+ if(0 == cmp) {
+ hbool_t changed = FALSE; /* Whether the 'modify' callback changed the record */
+
+ /* Make callback for current record */
+ if((op)(H5B2_INT_NREC(internal, hdr, idx), op_data, &changed) < 0) {
+ /* Make certain that the callback didn't modify the value if it failed */
+ HDassert(changed == FALSE);
+
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTMODIFY, FAIL, "'modify' callback failed for B-tree update operation")
+ } /* end if */
+
+ /* Mark the node as dirty if it changed */
+ internal_flags |= (changed ? H5AC__DIRTIED_FLAG : 0);
+
+ /* Indicate that the record was modified */
+ *status = H5B2_UPDATE_MODIFY_DONE;
+ } /* end if */
+ else {
+ /* Adjust index to leave room for node to insert */
+ if(cmp > 0)
+ idx++;
+
+ /* Check if this node is left/right-most */
+ if(H5B2_POS_MIDDLE != curr_pos) {
+ if(idx == 0) {
+ if(H5B2_POS_LEFT == curr_pos || H5B2_POS_ROOT == curr_pos)
+ next_pos = H5B2_POS_LEFT;
+ } /* end if */
+ else if(idx == internal->nrec) {
+ if(H5B2_POS_RIGHT == curr_pos || H5B2_POS_ROOT == curr_pos)
+ next_pos = H5B2_POS_RIGHT;
+ } /* end else */
+ } /* end if */
+
+ /* Attempt to update record in child */
+ if(depth > 1) {
+ if(H5B2__update_internal(hdr, dxpl_id, (uint16_t)(depth - 1), &internal_flags, &internal->node_ptrs[idx], status, next_pos, udata, op, op_data) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTUPDATE, FAIL, "unable to update record in internal B-tree node")
+ } /* end if */
+ else {
+ if(H5B2__update_leaf(hdr, dxpl_id, &internal->node_ptrs[idx], status, next_pos, udata, op, op_data) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTUPDATE, FAIL, "unable to update record in leaf B-tree node")
+ } /* end else */
+
+ /* Take actions based on child's status report */
+ switch(*status) {
+ case H5B2_UPDATE_MODIFY_DONE:
+ /* No action */
+ break;
+
+ case H5B2_UPDATE_INSERT_DONE:
+ /* Mark node as dirty */
+ internal_flags |= H5AC__DIRTIED_FLAG;
+
+ /* Update total record count for node pointer to current node */
+ curr_node_ptr->all_nrec++;
+ break;
+
+ case H5B2_UPDATE_INSERT_CHILD_FULL:
+ /* Split/redistribute this node */
+ if(internal->nrec == hdr->node_info[depth].split_nrec) {
+ hbool_t could_split = FALSE; /* Whether the child node could split */
+
+#ifdef QAK
+HDfprintf(stderr, "%s: idx = %u, internal->nrec = %u\n", FUNC, idx, internal->nrec);
+HDfprintf(stderr, "%s: hdr->node_info[%u].split_nrec = %u\n", FUNC, (unsigned)depth, (unsigned)hdr->node_info[depth].split_nrec);
+HDfprintf(stderr, "%s: hdr->node_info[%u].split_nrec = %u\n", FUNC, (unsigned)(depth - 1), (unsigned)hdr->node_info[depth - 1].split_nrec);
+#endif /* QAK */
+ if(idx == 0) { /* Left-most child */
+#ifdef QAK
+HDfprintf(stderr, "%s: Left-most child\n", FUNC);
+HDfprintf(stderr, "%s: internal->node_ptrs[%u].node_nrec = %u\n", FUNC, (unsigned)idx, (unsigned)internal->node_ptrs[idx].node_nrec);
+HDfprintf(stderr, "%s: internal->node_ptrs[%u].node_nrec = %u\n", FUNC, (unsigned)(idx + 1), (unsigned)internal->node_ptrs[idx + 1].node_nrec);
+#endif /* QAK */
+ /* Check for left-most child and its neighbor being close to full */
+ if((internal->node_ptrs[idx].node_nrec + internal->node_ptrs[idx + 1].node_nrec)
+ >= ((hdr->node_info[depth - 1].split_nrec * 2) - 1))
+ could_split = TRUE;
+ } /* end if */
+ else if(idx == internal->nrec) { /* Right-most child */
+#ifdef QAK
+HDfprintf(stderr, "%s: Right-most child\n", FUNC);
+HDfprintf(stderr, "%s: internal->node_ptrs[%u].node_nrec = %u\n", FUNC, (unsigned)(idx - 1), (unsigned)internal->node_ptrs[idx - 1].node_nrec);
+HDfprintf(stderr, "%s: internal->node_ptrs[%u].node_nrec = %u\n", FUNC, (unsigned)idx, (unsigned)internal->node_ptrs[idx].node_nrec);
+#endif /* QAK */
+ /* Check for right-most child and its neighbor being close to full */
+ if((internal->node_ptrs[idx - 1].node_nrec + internal->node_ptrs[idx].node_nrec)
+ >= ((hdr->node_info[depth - 1].split_nrec * 2) - 1))
+ could_split = TRUE;
+ } /* end else-if */
+ else { /* Middle child */
+#ifdef QAK
+HDfprintf(stderr, "%s: Middle child\n", FUNC);
+HDfprintf(stderr, "%s: internal->node_ptrs[%u].node_nrec = %u\n", FUNC, (unsigned)(idx - 1), (unsigned)internal->node_ptrs[idx - 1].node_nrec);
+HDfprintf(stderr, "%s: internal->node_ptrs[%u].node_nrec = %u\n", FUNC, (unsigned)idx, (unsigned)internal->node_ptrs[idx].node_nrec);
+HDfprintf(stderr, "%s: internal->node_ptrs[%u].node_nrec = %u\n", FUNC, (unsigned)(idx + 1), (unsigned)internal->node_ptrs[idx + 1].node_nrec);
+#endif /* QAK */
+ /* Check for middle child and its left neighbor being close to full */
+ if((internal->node_ptrs[idx - 1].node_nrec + internal->node_ptrs[idx].node_nrec)
+ >= ((hdr->node_info[depth - 1].split_nrec * 2) - 1))
+ could_split = TRUE;
+ /* Check for middle child and its right neighbor being close to full */
+ else if((internal->node_ptrs[idx].node_nrec + internal->node_ptrs[idx + 1].node_nrec)
+ >= ((hdr->node_info[depth - 1].split_nrec * 2) - 1))
+ could_split = TRUE;
+ } /* end if */
+
+ /* If this node is full and the child node insertion could
+ * cause a split, punt back up to caller, leaving the
+ * "insert child full" status.
+ */
+ if(could_split) {
+ /* Release the internal B-tree node */
+ if(H5AC_unprotect(hdr->f, dxpl_id, H5AC_BT2_INT, curr_node_ptr->addr, internal, internal_flags) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release internal B-tree node")
+ internal = NULL;
+
+#ifdef QAK
+HDfprintf(stderr, "%s: Punting back to caller\n", FUNC);
+#endif /* QAK */
+ /* Punt back to caller */
+ HGOTO_DONE(SUCCEED);
+ } /* end if */
+ } /* end if */
+
+ /* Release the internal B-tree node */
+ if(H5AC_unprotect(hdr->f, dxpl_id, H5AC_BT2_INT, curr_node_ptr->addr, internal, internal_flags) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release internal B-tree node")
+ internal = NULL;
+
+ /* Indicate that the record was inserted */
+ *status = H5B2_UPDATE_INSERT_DONE;
+
+ /* Dodge sideways into inserting a record into this node */
+ if(H5B2__insert_internal(hdr, dxpl_id, depth, parent_cache_info_flags_ptr, curr_node_ptr, curr_pos, udata) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, FAIL, "unable to insert record into internal B-tree node")
+ break;
+
+ case H5B2_UPDATE_UNKNOWN:
+ default:
+ HDassert(0 && "Invalid update status");
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTUPDATE, FAIL, "invalid update status")
+ } /* end switch */
+ } /* end else */
+
+done:
+ /* Release the internal B-tree node */
+ if(internal && H5AC_unprotect(hdr->f, dxpl_id, H5AC_BT2_INT, curr_node_ptr->addr, internal, internal_flags) < 0)
+ HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release internal B-tree node")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5B2__update_internal() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5B2__create_leaf
*
* Purpose: Creates empty leaf node of a B-tree and update node pointer
@@ -1789,32 +2206,30 @@ H5B2__create_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, H5B2_node_ptr_t *node_ptr)
/* Increment ref. count on B-tree header */
if(H5B2__hdr_incr(hdr) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTINC, FAIL, "can't increment ref. count on B-tree header")
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTINC, FAIL, "can't increment ref. count on B-tree header")
/* Share B-tree header information */
leaf->hdr = hdr;
/* Allocate space for the native keys in memory */
if(NULL == (leaf->leaf_native = (uint8_t *)H5FL_FAC_MALLOC(hdr->node_info[0].nat_rec_fac)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for B-tree leaf native keys")
-#ifdef H5_CLEAR_MEMORY
-HDmemset(leaf->leaf_native, 0, hdr->cls->nrec_size * hdr->node_info[0].max_nrec);
-#endif /* H5_CLEAR_MEMORY */
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for B-tree leaf native keys")
+ HDmemset(leaf->leaf_native, 0, hdr->cls->nrec_size * hdr->node_info[0].max_nrec);
/* Set number of records */
leaf->nrec = 0;
/* Allocate space on disk for the leaf */
if(HADDR_UNDEF == (node_ptr->addr = H5MF_alloc(hdr->f, H5FD_MEM_BTREE, dxpl_id, (hsize_t)hdr->node_size)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "file allocation failed for B-tree leaf node")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "file allocation failed for B-tree leaf node")
/* Cache the new B-tree node */
if(H5AC_insert_entry(hdr->f, dxpl_id, H5AC_BT2_LEAF, node_ptr->addr, leaf, H5AC__NO_FLAGS_SET) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "can't add B-tree leaf to cache")
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "can't add B-tree leaf to cache")
done:
if(ret_value < 0) {
- if(leaf)
+ if(leaf)
if(H5B2__leaf_free(leaf) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, "unable to release v2 B-tree leaf node")
} /* end if */
@@ -1911,16 +2326,12 @@ H5B2__create_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, H5B2_node_ptr_t *node_ptr,
/* Allocate space for the native keys in memory */
if(NULL == (internal->int_native = (uint8_t *)H5FL_FAC_MALLOC(hdr->node_info[depth].nat_rec_fac)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for B-tree internal native keys")
-#ifdef H5_CLEAR_MEMORY
-HDmemset(internal->int_native, 0, hdr->cls->nrec_size * hdr->node_info[depth].max_nrec);
-#endif /* H5_CLEAR_MEMORY */
+ HDmemset(internal->int_native, 0, hdr->cls->nrec_size * hdr->node_info[depth].max_nrec);
/* Allocate space for the node pointers in memory */
if(NULL == (internal->node_ptrs = (H5B2_node_ptr_t *)H5FL_FAC_MALLOC(hdr->node_info[depth].node_ptr_fac)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for B-tree internal node pointers")
-#ifdef H5_CLEAR_MEMORY
-HDmemset(internal->node_ptrs, 0, sizeof(H5B2_node_ptr_t) * (hdr->node_info[depth].max_nrec + 1));
-#endif /* H5_CLEAR_MEMORY */
+ HDmemset(internal->node_ptrs, 0, sizeof(H5B2_node_ptr_t) * (hdr->node_info[depth].max_nrec + 1));
/* Set number of records & depth of the node */
internal->nrec = 0;
@@ -2124,6 +2535,7 @@ H5B2__remove_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, H5B2_node_ptr_t *curr_node_ptr
haddr_t leaf_addr = HADDR_UNDEF; /* Leaf address on disk */
unsigned leaf_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting leaf node */
unsigned idx; /* Location of record which matches key */
+ int cmp; /* Comparison value of records */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -2143,7 +2555,9 @@ H5B2__remove_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, H5B2_node_ptr_t *curr_node_ptr
HDassert(leaf->nrec == curr_node_ptr->node_nrec);
/* Find correct location to remove this record */
- if(H5B2__locate_record(hdr->cls, leaf->nrec, hdr->nat_off, leaf->leaf_native, udata, &idx) != 0)
+ if(H5B2__locate_record(hdr->cls, leaf->nrec, hdr->nat_off, leaf->leaf_native, udata, &idx, &cmp) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records")
+ if(cmp != 0)
HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "record is not in B-tree")
/* Check for invalidating the min/max record for the tree */
@@ -2151,18 +2565,14 @@ H5B2__remove_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, H5B2_node_ptr_t *curr_node_ptr
/* (Don't use 'else' for the idx check, to allow for root leaf node) */
if(idx == 0) {
if(H5B2_POS_LEFT == curr_pos || H5B2_POS_ROOT == curr_pos) {
- if(hdr->min_native_rec) {
- HDfree(hdr->min_native_rec);
- hdr->min_native_rec = NULL;
- } /* end if */
+ if(hdr->min_native_rec)
+ hdr->min_native_rec = H5MM_xfree(hdr->min_native_rec);
} /* end if */
} /* end if */
if(idx == (unsigned)(leaf->nrec - 1)) {
if(H5B2_POS_RIGHT == curr_pos || H5B2_POS_ROOT == curr_pos) {
- if(hdr->max_native_rec) {
- HDfree(hdr->max_native_rec);
- hdr->max_native_rec = NULL;
- } /* end if */
+ if(hdr->max_native_rec)
+ hdr->max_native_rec = H5MM_xfree(hdr->max_native_rec);
} /* end if */
} /* end if */
} /* end if */
@@ -2291,7 +2701,9 @@ H5B2__remove_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, hbool_t *depth_decreased,
if(swap_loc)
idx = 0;
else {
- cmp = H5B2__locate_record(hdr->cls, internal->nrec, hdr->nat_off, internal->int_native, udata, &idx);
+ if(H5B2__locate_record(hdr->cls, internal->nrec, hdr->nat_off, internal->int_native,
+ udata, &idx, &cmp) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records")
if(cmp >= 0)
idx++;
} /* end else */
@@ -2353,7 +2765,8 @@ H5B2__remove_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, hbool_t *depth_decreased,
idx = 0;
else {
/* Actually, this can be easily updated (for 2-node redistrib.) and shouldn't require re-searching */
- cmp = H5B2__locate_record(hdr->cls, internal->nrec, hdr->nat_off, internal->int_native, udata, &idx);
+ if(H5B2__locate_record(hdr->cls, internal->nrec, hdr->nat_off, internal->int_native, udata, &idx, &cmp) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records")
if(cmp >= 0)
idx++;
} /* end else */
@@ -2466,18 +2879,14 @@ H5B2__remove_leaf_by_idx(H5B2_hdr_t *hdr, hid_t dxpl_id,
/* (Don't use 'else' for the idx check, to allow for root leaf node) */
if(idx == 0) {
if(H5B2_POS_LEFT == curr_pos || H5B2_POS_ROOT == curr_pos) {
- if(hdr->min_native_rec) {
- HDfree(hdr->min_native_rec);
- hdr->min_native_rec = NULL;
- } /* end if */
+ if(hdr->min_native_rec)
+ hdr->min_native_rec = H5MM_xfree(hdr->min_native_rec);
} /* end if */
} /* end if */
if(idx == (unsigned)(leaf->nrec - 1)) {
if(H5B2_POS_RIGHT == curr_pos || H5B2_POS_ROOT == curr_pos) {
- if(hdr->max_native_rec) {
- HDfree(hdr->max_native_rec);
- hdr->max_native_rec = NULL;
- } /* end if */
+ if(hdr->max_native_rec)
+ hdr->max_native_rec = H5MM_xfree(hdr->max_native_rec);
} /* end if */
} /* end if */
} /* end if */
@@ -2841,7 +3250,8 @@ H5B2__neighbor_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, H5B2_node_ptr_t *curr_node_p
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node")
/* Locate node pointer for child */
- cmp = H5B2__locate_record(hdr->cls, leaf->nrec, hdr->nat_off, leaf->leaf_native, udata, &idx);
+ if(H5B2__locate_record(hdr->cls, leaf->nrec, hdr->nat_off, leaf->leaf_native, udata, &idx, &cmp) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records")
if(cmp > 0)
idx++;
else
@@ -2928,7 +3338,9 @@ H5B2__neighbor_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, uint16_t depth,
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node")
/* Locate node pointer for child */
- cmp = H5B2__locate_record(hdr->cls, internal->nrec, hdr->nat_off, internal->int_native, udata, &idx);
+ if(H5B2__locate_record(hdr->cls, internal->nrec, hdr->nat_off, internal->int_native,
+ udata, &idx, &cmp) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records")
if(cmp > 0)
idx++;
diff --git a/src/H5B2pkg.h b/src/H5B2pkg.h
index f58850e..edac296 100644
--- a/src/H5B2pkg.h
+++ b/src/H5B2pkg.h
@@ -182,8 +182,8 @@ typedef struct H5B2_hdr_t {
uint8_t *page; /* Common disk page for I/O */
size_t *nat_off; /* Array of offsets of native records */
H5B2_node_info_t *node_info; /* Table of node info structs for current depth of B-tree */
- uint8_t *min_native_rec; /* Pointer to minimum native record */
- uint8_t *max_native_rec; /* Pointer to maximum native record */
+ void *min_native_rec; /* Pointer to minimum native record */
+ void *max_native_rec; /* Pointer to maximum native record */
/* Client information (not stored) */
const H5B2_class_t *cls; /* Class of B-tree client */
@@ -228,6 +228,14 @@ typedef enum H5B2_nodepos_t {
H5B2_POS_MIDDLE /* Node is neither right or left-most in tree */
} H5B2_nodepos_t;
+/* Update status */
+typedef enum H5B2_update_status_t {
+ H5B2_UPDATE_UNKNOWN, /* Unknown update status (initial state) */
+ H5B2_UPDATE_MODIFY_DONE, /* Update successfully modified existing record */
+ H5B2_UPDATE_INSERT_DONE, /* Update inserted record successfully */
+ H5B2_UPDATE_INSERT_CHILD_FULL /* Update will insert record, but child is full */
+} H5B2_update_status_t;
+
/* Callback info for loading a free space header into the cache */
typedef struct H5B2_hdr_cache_ud_t {
H5F_t *f; /* File that v2 b-tree header is within */
@@ -252,7 +260,7 @@ typedef struct H5B2_leaf_cache_ud_t {
#ifdef H5B2_TESTING
/* Node information for testing */
-typedef struct {
+typedef struct H5B2_node_info_test_t {
unsigned depth; /* Depth of node */
unsigned nrec; /* Number of records in node */
} H5B2_node_info_test_t;
@@ -281,6 +289,13 @@ H5FL_EXTERN(H5B2_leaf_t);
/* Internal v2 B-tree testing class */
#ifdef H5B2_TESTING
H5_DLLVAR const H5B2_class_t H5B2_TEST[1];
+H5_DLLVAR const H5B2_class_t H5B2_TEST2[1];
+
+/* B-tree record for testing H5B2_TEST2 class */
+typedef struct H5B2_test_rec_t {
+ hsize_t key; /* Key for record */
+ hsize_t val; /* Value for record */
+} H5B2_test_rec_t;
#endif /* H5B2_TESTING */
/* Array of v2 B-tree client ID -> client class mappings */
@@ -327,12 +342,22 @@ H5_DLL herr_t H5B2__leaf_free(H5B2_leaf_t *l);
H5_DLL herr_t H5B2__internal_free(H5B2_internal_t *i);
/* Routines for inserting records */
+H5_DLL herr_t H5B2__insert_hdr(H5B2_hdr_t *hdr, hid_t dxpl_id, void *udata);
H5_DLL herr_t H5B2__insert_internal(H5B2_hdr_t *hdr, hid_t dxpl_id,
uint16_t depth, unsigned *parent_cache_info_flags_ptr,
H5B2_node_ptr_t *curr_node_ptr, H5B2_nodepos_t curr_pos, void *udata);
H5_DLL herr_t H5B2__insert_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id,
H5B2_node_ptr_t *curr_node_ptr, H5B2_nodepos_t curr_pos, void *udata);
+/* Routines for update records */
+H5_DLL herr_t H5B2__update_internal(H5B2_hdr_t *hdr, hid_t dxpl_id,
+ uint16_t depth, unsigned *parent_cache_info_flags_ptr,
+ H5B2_node_ptr_t *curr_node_ptr, H5B2_update_status_t *status,
+ H5B2_nodepos_t curr_pos, void *udata, H5B2_modify_t op, void *op_data);
+H5_DLL herr_t H5B2__update_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id,
+ H5B2_node_ptr_t *curr_node_ptr, H5B2_update_status_t *status,
+ H5B2_nodepos_t curr_pos, void *udata, H5B2_modify_t op, void *op_data);
+
/* Routines for iterating over nodes/records */
H5_DLL herr_t H5B2__iterate_node(H5B2_hdr_t *hdr, hid_t dxpl_id, uint16_t depth,
const H5B2_node_ptr_t *curr_node, H5B2_operator_t op, void *op_data);
@@ -340,8 +365,8 @@ H5_DLL herr_t H5B2__node_size(H5B2_hdr_t *hdr, hid_t dxpl_id,
uint16_t depth, const H5B2_node_ptr_t *curr_node, hsize_t *op_data);
/* Routines for locating records */
-H5_DLL int H5B2__locate_record(const H5B2_class_t *type, unsigned nrec,
- size_t *rec_off, const uint8_t *native, const void *udata, unsigned *idx);
+H5_DLL herr_t H5B2__locate_record(const H5B2_class_t *type, unsigned nrec,
+ size_t *rec_off, const uint8_t *native, const void *udata, unsigned *idx, int *result);
H5_DLL herr_t H5B2__neighbor_internal(H5B2_hdr_t *hdr, hid_t dxpl_id,
uint16_t depth, H5B2_node_ptr_t *curr_node_ptr, void *neighbor_loc,
H5B2_compare_t comp, void *udata, H5B2_found_t op, void *op_data);
diff --git a/src/H5B2private.h b/src/H5B2private.h
index 9e3c2d7..3caf41f 100644
--- a/src/H5B2private.h
+++ b/src/H5B2private.h
@@ -54,6 +54,9 @@ typedef enum H5B2_subid_t {
H5B2_SOHM_INDEX_ID, /* B-tree is an index for shared object header messages */
H5B2_ATTR_DENSE_NAME_ID, /* B-tree is for indexing 'name' field for "dense" attribute storage on objects */
H5B2_ATTR_DENSE_CORDER_ID, /* B-tree is for indexing 'creation order' field for "dense" attribute storage on objects */
+ H5B2_CDSET_ID, /* B-tree is for non-filtered chunked dataset storage w/ >1 unlim dims */
+ H5B2_CDSET_FILT_ID, /* B-tree is for filtered chunked dataset storage w/ >1 unlim dims */
+ H5B2_TEST2_ID, /* Another B-tree is for testing (do not use for actual data) */
H5B2_NUM_BTREE_ID /* Number of B-tree IDs (must be last) */
} H5B2_subid_t;
@@ -89,13 +92,11 @@ struct H5B2_class_t {
void *(*crt_context)(void *udata); /* Create context for other client callbacks */
herr_t (*dst_context)(void *ctx); /* Destroy client callback context */
herr_t (*store)(void *nrecord, const void *udata); /* Store application record in native record table */
- herr_t (*compare)(const void *rec1, const void *rec2); /* Compare two native records */
+ herr_t (*compare)(const void *rec1, const void *rec2, int *result); /* Compare two native records */
herr_t (*encode)(uint8_t *raw, const void *record, void *ctx); /* Encode record from native form to disk storage form */
herr_t (*decode)(const uint8_t *raw, void *record, void *ctx); /* Decode record from disk storage form to native form */
herr_t (*debug)(FILE *stream, int indent, int fwidth, /* Print a record for debugging */
const void *record, const void *ctx);
- void *(*crt_dbg_ctx)(H5F_t *f, hid_t dxpl_id, haddr_t obj_addr); /* Create debugging context */
- herr_t (*dst_dbg_ctx)(void *dbg_ctx); /* Destroy debugging context */
};
/* v2 B-tree creation parameters */
@@ -140,6 +141,8 @@ H5_DLL herr_t H5B2_neighbor(H5B2_t *bt2, hid_t dxpl_id, H5B2_compare_t range,
void *udata, H5B2_found_t op, void *op_data);
H5_DLL herr_t H5B2_modify(H5B2_t *bt2, hid_t dxpl_id, void *udata,
H5B2_modify_t op, void *op_data);
+H5_DLL herr_t H5B2_update(H5B2_t *bt2, hid_t dxpl_id, void *udata,
+ H5B2_modify_t op, void *op_data);
H5_DLL herr_t H5B2_remove(H5B2_t *b2, hid_t dxpl_id, void *udata,
H5B2_remove_t op, void *op_data);
H5_DLL herr_t H5B2_remove_by_idx(H5B2_t *bt2, hid_t dxpl_id,
@@ -150,6 +153,7 @@ H5_DLL herr_t H5B2_size(H5B2_t *bt2, hid_t dxpl_id,
H5_DLL herr_t H5B2_close(H5B2_t *bt2, hid_t dxpl_id);
H5_DLL herr_t H5B2_delete(H5F_t *f, hid_t dxpl_id, haddr_t addr,
void *ctx_udata, H5B2_remove_t op, void *op_data);
+H5_DLL herr_t H5B2_patch_file(H5B2_t *fa, H5F_t *f);
/* Statistics routines */
H5_DLL herr_t H5B2_stat_info(H5B2_t *bt2, H5B2_stat_t *info);
diff --git a/src/H5B2test.c b/src/H5B2test.c
index 87fddf7..24163e0 100644
--- a/src/H5B2test.c
+++ b/src/H5B2test.c
@@ -61,21 +61,30 @@ typedef struct H5B2_test_ctx_t {
/* Local Prototypes */
/********************/
+/* v2 B-tree driver callbacks for 'test' B-trees */
static void *H5B2__test_crt_context(void *udata);
static herr_t H5B2__test_dst_context(void *ctx);
static herr_t H5B2__test_store(void *nrecord, const void *udata);
-static herr_t H5B2__test_compare(const void *rec1, const void *rec2);
+static herr_t H5B2__test_compare(const void *rec1, const void *rec2, int *result);
static herr_t H5B2__test_encode(uint8_t *raw, const void *nrecord, void *ctx);
static herr_t H5B2__test_decode(const uint8_t *raw, void *nrecord, void *ctx);
static herr_t H5B2__test_debug(FILE *stream, int indent, int fwidth,
const void *record, const void *_udata);
-static void *H5B2__test_crt_dbg_context(H5F_t *f, hid_t dxpl_id, haddr_t addr);
+
+/* v2 B-tree driver callbacks for 'test2' B-trees */
+static herr_t H5B2__test2_store(void *nrecord, const void *udata);
+static herr_t H5B2__test2_compare(const void *rec1, const void *rec2, int *result);
+static herr_t H5B2__test2_encode(uint8_t *raw, const void *nrecord, void *ctx);
+static herr_t H5B2__test2_decode(const uint8_t *raw, void *nrecord, void *ctx);
+static herr_t H5B2__test2_debug(FILE *stream, int indent, int fwidth,
+ const void *record, const void *_udata);
/*********************/
/* Package Variables */
/*********************/
+/* Class structure for testing simple B-tree records */
const H5B2_class_t H5B2_TEST[1]={{ /* B-tree class information */
H5B2_TEST_ID, /* Type of B-tree */
"H5B2_TEST_ID", /* Name of B-tree class */
@@ -86,9 +95,21 @@ const H5B2_class_t H5B2_TEST[1]={{ /* B-tree class information */
H5B2__test_compare, /* Record comparison callback */
H5B2__test_encode, /* Record encoding callback */
H5B2__test_decode, /* Record decoding callback */
- H5B2__test_debug, /* Record debugging callback */
- H5B2__test_crt_dbg_context, /* Create debugging context */
- H5B2__test_dst_context /* Destroy debugging context */
+ H5B2__test_debug /* Record debugging callback */
+}};
+
+/* Class structure for testing key/value B-tree records */
+const H5B2_class_t H5B2_TEST2[1]={{ /* B-tree class information */
+ H5B2_TEST2_ID, /* Type of B-tree */
+ "H5B2_TEST2_ID", /* Name of B-tree class */
+ sizeof(H5B2_test_rec_t), /* Size of native record */
+ H5B2__test_crt_context, /* Create client callback context */
+ H5B2__test_dst_context, /* Destroy client callback context */
+ H5B2__test2_store, /* Record storage callback */
+ H5B2__test2_compare, /* Record comparison callback */
+ H5B2__test2_encode, /* Record encoding callback */
+ H5B2__test2_decode, /* Record decoding callback */
+ H5B2__test2_debug /* Record debugging callback */
}};
@@ -215,11 +236,13 @@ H5B2__test_store(void *nrecord, const void *udata)
*-------------------------------------------------------------------------
*/
static herr_t
-H5B2__test_compare(const void *rec1, const void *rec2)
+H5B2__test_compare(const void *rec1, const void *rec2, int *result)
{
FUNC_ENTER_STATIC_NOERR
- FUNC_LEAVE_NOAPI((herr_t)(*(const hssize_t *)rec1 - *(const hssize_t *)rec2))
+ *result = (int)(*(const hssize_t *)rec1 - *(const hssize_t *)rec2);
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5B2__test_compare() */
@@ -310,42 +333,141 @@ H5B2__test_debug(FILE *stream, int indent, int fwidth, const void *record,
/*-------------------------------------------------------------------------
- * Function: H5B2__test_crt_dbg_context
+ * Function: H5B2__test2_store
*
- * Purpose: Create context for debugging callback
+ * Purpose: Store native information into record for B-tree
*
- * Return: Success: non-NULL
- * Failure: NULL
+ * Return: Success: non-negative
+ * Failure: negative
*
* Programmer: Quincey Koziol
- * Tuesday, December 1, 2009
+ * Friday, December 25, 2015
*
*-------------------------------------------------------------------------
*/
-static void *
-H5B2__test_crt_dbg_context(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, haddr_t H5_ATTR_UNUSED addr)
+static herr_t
+H5B2__test2_store(void *nrecord, const void *udata)
{
- H5B2_test_ctx_t *ctx; /* Callback context structure */
- void *ret_value = NULL; /* Return value */
+ FUNC_ENTER_STATIC_NOERR
- FUNC_ENTER_STATIC
+ *(H5B2_test_rec_t *)nrecord = *(const H5B2_test_rec_t *)udata;
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* H5B2__test2_store() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5B2__test2_compare
+ *
+ * Purpose: Compare two native information records, according to some key
+ *
+ * Return: <0 if rec1 < rec2
+ * =0 if rec1 == rec2
+ * >0 if rec1 > rec2
+ *
+ * Programmer: Quincey Koziol
+ * Friday, December 25, 2015
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5B2__test2_compare(const void *rec1, const void *rec2, int *result)
+{
+ FUNC_ENTER_STATIC_NOERR
+
+ *result = (int)(((const H5B2_test_rec_t *)rec1)->key - ((const H5B2_test_rec_t *)rec2)->key);
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* H5B2__test2_compare() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5B2__test2_encode
+ *
+ * Purpose: Encode native information into raw form for storing on disk
+ *
+ * Return: Success: non-negative
+ * Failure: negative
+ *
+ * Programmer: Quincey Koziol
+ * Friday, December 25, 2015
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5B2__test2_encode(uint8_t *raw, const void *nrecord, void *_ctx)
+{
+ H5B2_test_ctx_t *ctx = (H5B2_test_ctx_t *)_ctx; /* Callback context structure */
+
+ FUNC_ENTER_STATIC_NOERR
/* Sanity check */
- HDassert(f);
+ HDassert(ctx);
- /* Allocate callback context */
- if(NULL == (ctx = H5FL_MALLOC(H5B2_test_ctx_t)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "can't allocate callback context")
+ H5F_ENCODE_LENGTH_LEN(raw, ((const H5B2_test_rec_t *)nrecord)->key, ctx->sizeof_size);
+ H5F_ENCODE_LENGTH_LEN(raw, ((const H5B2_test_rec_t *)nrecord)->val, ctx->sizeof_size);
- /* Determine the size of addresses & lengths in the file */
- ctx->sizeof_size = H5F_SIZEOF_SIZE(f);
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* H5B2__test2_encode() */
- /* Set return value */
- ret_value = ctx;
+
+/*-------------------------------------------------------------------------
+ * Function: H5B2__test2_decode
+ *
+ * Purpose: Decode raw disk form of record into native form
+ *
+ * Return: Success: non-negative
+ * Failure: negative
+ *
+ * Programmer: Quincey Koziol
+ * Friday, December 25, 2015
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5B2__test2_decode(const uint8_t *raw, void *nrecord, void *_ctx)
+{
+ H5B2_test_ctx_t *ctx = (H5B2_test_ctx_t *)_ctx; /* Callback context structure */
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5B2__test_crt_dbg_context() */
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Sanity check */
+ HDassert(ctx);
+
+ H5F_DECODE_LENGTH_LEN(raw, ((H5B2_test_rec_t *)nrecord)->key, ctx->sizeof_size);
+ H5F_DECODE_LENGTH_LEN(raw, ((H5B2_test_rec_t *)nrecord)->val, ctx->sizeof_size);
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* H5B2__test2_decode() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5B2__test2_debug
+ *
+ * Purpose: Debug native form of record
+ *
+ * Return: Success: non-negative
+ * Failure: negative
+ *
+ * Programmer: Quincey Koziol
+ * Friday, December 25, 2015
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5B2__test2_debug(FILE *stream, int indent, int fwidth, const void *record,
+ const void H5_ATTR_UNUSED *_udata)
+{
+ FUNC_ENTER_STATIC_NOERR
+
+ HDassert(record);
+
+ HDfprintf(stream, "%*s%-*s (%Hu, %Hu)\n", indent, "", fwidth, "Record:",
+ ((const H5B2_test_rec_t *)record)->key,
+ ((const H5B2_test_rec_t *)record)->val);
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* H5B2__test2_debug() */
/*-------------------------------------------------------------------------
@@ -433,7 +555,10 @@ H5B2_get_node_info_test(H5B2_t *bt2, hid_t dxpl_id, void *udata,
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree internal node")
/* Locate node pointer for child */
- cmp = H5B2__locate_record(hdr->cls, internal->nrec, hdr->nat_off, internal->int_native, udata, &idx);
+ if(H5B2__locate_record(hdr->cls, internal->nrec, hdr->nat_off, internal->int_native,
+ udata, &idx, &cmp) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records")
+
if(cmp > 0)
idx++;
@@ -473,7 +598,9 @@ H5B2_get_node_info_test(H5B2_t *bt2, hid_t dxpl_id, void *udata,
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node")
/* Locate record */
- cmp = H5B2__locate_record(hdr->cls, leaf->nrec, hdr->nat_off, leaf->leaf_native, udata, &idx);
+ if(H5B2__locate_record(hdr->cls, leaf->nrec, hdr->nat_off, leaf->leaf_native,
+ udata, &idx, &cmp) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records")
/* Unlock current node */
if(H5AC_unprotect(hdr->f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr.addr, leaf, H5AC__NO_FLAGS_SET) < 0)
diff --git a/src/H5Bcache.c b/src/H5Bcache.c
index d08f1bc..747e4c4 100644
--- a/src/H5Bcache.c
+++ b/src/H5Bcache.c
@@ -344,10 +344,8 @@ H5B__serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED len,
/* Sanity check */
HDassert((size_t)(image - (uint8_t *)_image) <= len);
-#ifdef H5_CLEAR_MEMORY
/* Clear rest of node */
HDmemset(image, 0, len - (size_t)(image - (uint8_t *)_image));
-#endif /* H5_CLEAR_MEMORY */
done:
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5C.c b/src/H5C.c
index c78c32c..8df9679 100644
--- a/src/H5C.c
+++ b/src/H5C.c
@@ -88,13 +88,11 @@
#include "H5Cpkg.h" /* Cache */
#include "H5Eprivate.h" /* Error handling */
#include "H5Fpkg.h" /* Files */
-#include "H5FDprivate.h" /* File drivers */
#include "H5FLprivate.h" /* Free Lists */
#include "H5Iprivate.h" /* IDs */
#include "H5MFprivate.h" /* File memory management */
#include "H5MMprivate.h" /* Memory management */
#include "H5Pprivate.h" /* Property lists */
-#include "H5SLprivate.h" /* Skip lists */
/****************/
@@ -156,6 +154,9 @@ static herr_t H5C_flush_ring(H5F_t *f, hid_t dxpl_id, H5C_ring_t ring,
static void * H5C_load_entry(H5F_t * f,
hid_t dxpl_id,
+#ifdef H5_HAVE_PARALLEL
+ hbool_t coll_access,
+#endif /* H5_HAVE_PARALLEL */
const H5C_class_t * type,
haddr_t addr,
void * udata);
@@ -180,6 +181,9 @@ static herr_t H5C_mark_tagged_entries(H5C_t * cache_ptr,
static herr_t H5C_flush_marked_entries(H5F_t * f,
hid_t dxpl_id);
+static herr_t H5C__generate_image(const H5F_t *f, H5C_t * cache_ptr, H5C_cache_entry_t *entry_ptr,
+ hid_t dxpl_id, int64_t *entry_size_change_ptr);
+
#if H5C_DO_TAGGING_SANITY_CHECKS
static herr_t H5C_verify_tag(int id, haddr_t tag);
#endif
@@ -220,6 +224,9 @@ hbool_t H5_PKG_INIT_VAR = FALSE;
/* Declare a free list to manage the H5C_t struct */
H5FL_DEFINE_STATIC(H5C_t);
+/* Declare extern free list to manage the H5C_collective_write_t struct */
+H5FL_EXTERN(H5C_collective_write_t);
+
/****************************************************************************
@@ -456,8 +463,6 @@ H5C_create(size_t max_cache_size,
HDassert( max_type_id < H5C__MAX_NUM_TYPE_IDS );
HDassert( type_name_table_ptr );
- HDassert( ( write_permitted == TRUE ) || ( write_permitted == FALSE ) );
-
for ( i = 0; i <= max_type_id; i++ ) {
HDassert( (type_name_table_ptr)[i] );
@@ -551,6 +556,13 @@ H5C_create(size_t max_cache_size,
cache_ptr->LRU_head_ptr = NULL;
cache_ptr->LRU_tail_ptr = NULL;
+#ifdef H5_HAVE_PARALLEL
+ cache_ptr->coll_list_len = 0;
+ cache_ptr->coll_list_size = (size_t)0;
+ cache_ptr->coll_head_ptr = NULL;
+ cache_ptr->coll_tail_ptr = NULL;
+#endif /* H5_HAVE_PARALLEL */
+
cache_ptr->cLRU_list_len = 0;
cache_ptr->cLRU_list_size = (size_t)0;
cache_ptr->cLRU_head_ptr = NULL;
@@ -972,6 +984,12 @@ H5C_expunge_entry(H5F_t *f, hid_t dxpl_id, const H5C_class_t *type,
HGOTO_ERROR(H5E_CACHE, H5E_CANTEXPUNGE, FAIL, "Target entry is protected.")
if(entry_ptr->is_pinned)
HGOTO_ERROR(H5E_CACHE, H5E_CANTEXPUNGE, FAIL, "Target entry is pinned.")
+#ifdef H5_HAVE_PARALLEL
+ if(entry_ptr->coll_access) {
+ entry_ptr->coll_access = FALSE;
+ H5C__REMOVE_FROM_COLL_LIST(cache_ptr, entry_ptr, FAIL)
+ } /* end if */
+#endif /* H5_HAVE_PARALLEL */
/* If we get this far, call H5C__flush_single_entry() with the
* H5C__FLUSH_INVALIDATE_FLAG and the H5C__FLUSH_CLEAR_ONLY_FLAG.
@@ -989,7 +1007,7 @@ H5C_expunge_entry(H5F_t *f, hid_t dxpl_id, const H5C_class_t *type,
/* Delete the entry from the skip list on destroy */
flush_flags |= H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG;
- if(H5C__flush_single_entry(f, dxpl_id, entry_ptr, flush_flags, NULL) < 0)
+ if(H5C__flush_single_entry(f, dxpl_id, entry_ptr, flush_flags, NULL, NULL) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTEXPUNGE, FAIL, "can't flush entry")
#if H5C_DO_SANITY_CHECKS
@@ -1752,19 +1770,19 @@ H5C_insert_entry(H5F_t * f,
void * thing,
unsigned int flags)
{
- H5C_t * cache_ptr;
+ H5C_t *cache_ptr;
H5P_genplist_t *dxpl;
H5AC_ring_t ring = H5C_RING_UNDEFINED;
hbool_t insert_pinned;
hbool_t flush_last;
#ifdef H5_HAVE_PARALLEL
- hbool_t flush_collectively;
+ hbool_t coll_access = FALSE; /* whether access to the cache entry is done collectively */
#endif /* H5_HAVE_PARALLEL */
hbool_t set_flush_marker;
hbool_t write_permitted = TRUE;
size_t empty_space;
- H5C_cache_entry_t * entry_ptr;
- H5C_cache_entry_t * test_entry_ptr;
+ H5C_cache_entry_t *entry_ptr;
+ H5C_cache_entry_t *test_entry_ptr;
unsigned u; /* Local index variable */
herr_t ret_value = SUCCEED; /* Return value */
@@ -1797,9 +1815,6 @@ H5C_insert_entry(H5F_t * f,
set_flush_marker = ( (flags & H5C__SET_FLUSH_MARKER_FLAG) != 0 );
insert_pinned = ( (flags & H5C__PIN_ENTRY_FLAG) != 0 );
flush_last = ( (flags & H5C__FLUSH_LAST_FLAG) != 0 );
-#ifdef H5_HAVE_PARALLEL
- flush_collectively = ( (flags & H5C__FLUSH_COLLECTIVELY_FLAG) != 0 );
-#endif /* H5_HAVE_PARALLEL */
/* Get the dataset transfer property list */
if(NULL == (dxpl = (H5P_genplist_t *)H5I_object_verify(dxpl_id, H5I_GENPROP_LST)))
@@ -1844,9 +1859,6 @@ H5C_insert_entry(H5F_t * f,
entry_ptr->pinned_from_client = insert_pinned;
entry_ptr->pinned_from_cache = FALSE;
entry_ptr->flush_me_last = flush_last;
-#ifdef H5_HAVE_PARALLEL
- entry_ptr->flush_me_collectively = flush_collectively;
-#endif
/* newly inserted entries are assumed to be dirty */
entry_ptr->is_dirty = TRUE;
@@ -1903,6 +1915,11 @@ H5C_insert_entry(H5F_t * f,
entry_ptr->aux_next = NULL;
entry_ptr->aux_prev = NULL;
+#ifdef H5_HAVE_PARALLEL
+ entry_ptr->coll_next = NULL;
+ entry_ptr->coll_prev = NULL;
+#endif /* H5_HAVE_PARALLEL */
+
H5C__RESET_CACHE_ENTRY_STATS(entry_ptr)
if ( ( cache_ptr->flash_size_increase_possible ) &&
@@ -1991,11 +2008,8 @@ H5C_insert_entry(H5F_t * f,
#if H5C_DO_EXTREME_SANITY_CHECKS
if ( ( H5C_validate_protected_entry_list(cache_ptr) < 0 ) ||
( H5C_validate_pinned_entry_list(cache_ptr) < 0 ) ||
- ( H5C_validate_lru_list(cache_ptr) < 0 ) ) {
-
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \
- "an extreme sanity check failed just before done.\n");
- }
+ ( H5C_validate_lru_list(cache_ptr) < 0 ) )
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed just before done.\n")
#endif /* H5C_DO_EXTREME_SANITY_CHECKS */
/* If the entry's type has a 'notify' callback send a 'after insertion'
@@ -2007,20 +2021,53 @@ H5C_insert_entry(H5F_t * f,
H5C__UPDATE_STATS_FOR_INSERTION(cache_ptr, entry_ptr)
-done:
+#ifdef H5_HAVE_PARALLEL
+ /* Get the dataset transfer property list */
+ if(NULL == (dxpl = (H5P_genplist_t *)H5I_object(dxpl_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list");
+
+ if(H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI)) {
+ coll_access = (H5P_USER_TRUE == f->coll_md_read ? TRUE : FALSE);
+
+ if(!coll_access && H5P_FORCE_FALSE != f->coll_md_read) {
+ H5P_coll_md_read_flag_t prop_value;
+
+ /* Get the property value */
+ if(H5P_get(dxpl, H5_COLL_MD_READ_FLAG_NAME, &prop_value) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "Can't get collective metadata access flag")
+ coll_access = (H5P_USER_TRUE == prop_value ? TRUE : FALSE);
+ } /* end if */
+ } /* end if */
+
+ entry_ptr->coll_access = coll_access;
+ if(coll_access) {
+ H5C__INSERT_IN_COLL_LIST(cache_ptr, entry_ptr, FAIL)
+
+ /* Make sure the size of the collective entries in the cache remain in check */
+ if(H5P_USER_TRUE == f->coll_md_read) {
+ if(cache_ptr->max_cache_size * 80 < cache_ptr->coll_list_size * 100) {
+ if(H5C_clear_coll_entries(cache_ptr, TRUE) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "can't clear collective metadata entries")
+ } /* end if */
+ } /* end if */
+ else {
+ if(cache_ptr->max_cache_size * 40 < cache_ptr->coll_list_size * 100) {
+ if(H5C_clear_coll_entries(cache_ptr, TRUE) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "can't clear collective metadata entries")
+ } /* end if */
+ } /* end else */
+ } /* end if */
+#endif
+done:
#if H5C_DO_EXTREME_SANITY_CHECKS
if ( ( H5C_validate_protected_entry_list(cache_ptr) < 0 ) ||
( H5C_validate_pinned_entry_list(cache_ptr) < 0 ) ||
- ( H5C_validate_lru_list(cache_ptr) < 0 ) ) {
-
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \
- "an extreme sanity check failed on exit.\n");
- }
+ ( H5C_validate_lru_list(cache_ptr) < 0 ) )
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on exit.\n")
#endif /* H5C_DO_EXTREME_SANITY_CHECKS */
FUNC_LEAVE_NOAPI(ret_value)
-
} /* H5C_insert_entry() */
@@ -2368,6 +2415,14 @@ H5C_resize_entry(void *thing, size_t new_size)
(entry_ptr->size), (new_size))
} /* end if */
+#ifdef H5_HAVE_PARALLEL
+ if(entry_ptr->coll_access) {
+ H5C__DLL_UPDATE_FOR_SIZE_CHANGE((cache_ptr->coll_list_len), \
+ (cache_ptr->coll_list_size), \
+ (entry_ptr->size), (new_size))
+ } /* end if */
+#endif /* H5_HAVE_PARALLEL */
+
/* update the hash table */
H5C__UPDATE_INDEX_FOR_SIZE_CHANGE((cache_ptr), (entry_ptr->size),\
(new_size), (entry_ptr), (was_clean));
@@ -2573,10 +2628,10 @@ done:
* This allows H5C_protect to accept flags other than
* H5C__READ_ONLY_FLAG.
*
- * Added support for the H5C__FLUSH_LAST_FLAG and
- * H5C__FLUSH_COLLECTIVELY_FLAG flags. At present, these
- * flags are only applied if the entry is not in cache, and
- * is loaded into the cache as a result of this call.
+ * Added support for the H5C__FLUSH_LAST_FLAG.
+ * At present, this flag is only applied if the entry is
+ * not in cache, and is loaded into the cache as a result of
+ * this call.
*
*-------------------------------------------------------------------------
*/
@@ -2589,19 +2644,19 @@ H5C_protect(H5F_t * f,
unsigned flags)
{
H5C_t * cache_ptr;
- H5P_genplist_t *dxpl;
H5AC_ring_t ring = H5C_RING_UNDEFINED;
hbool_t hit;
hbool_t have_write_permitted = FALSE;
hbool_t read_only = FALSE;
hbool_t flush_last;
#ifdef H5_HAVE_PARALLEL
- hbool_t flush_collectively;
+ hbool_t coll_access = FALSE; /* whether access to the cache entry is done collectively */
#endif /* H5_HAVE_PARALLEL */
hbool_t write_permitted;
size_t empty_space;
void * thing;
H5C_cache_entry_t * entry_ptr;
+ H5P_genplist_t * dxpl; /* dataset transfer property list */
void * ret_value = NULL; /* Return value */
FUNC_ENTER_NOAPI(NULL)
@@ -2629,9 +2684,6 @@ H5C_protect(H5F_t * f,
read_only = ( (flags & H5C__READ_ONLY_FLAG) != 0 );
flush_last = ( (flags & H5C__FLUSH_LAST_FLAG) != 0 );
-#ifdef H5_HAVE_PARALLEL
- flush_collectively = ( (flags & H5C__FLUSH_COLLECTIVELY_FLAG) != 0 );
-#endif /* H5_HAVE_PARALLEL */
/* Get the dataset transfer property list */
if(NULL == (dxpl = (H5P_genplist_t *)H5I_object_verify(dxpl_id, H5I_GENPROP_LST)))
@@ -2641,6 +2693,21 @@ H5C_protect(H5F_t * f,
if((H5P_get(dxpl, H5AC_RING_NAME, &ring)) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, NULL, "unable to query ring value")
+#ifdef H5_HAVE_PARALLEL
+ if(H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI)) {
+ coll_access = (H5P_USER_TRUE == f->coll_md_read ? TRUE : FALSE);
+
+ if(!coll_access && H5P_FORCE_FALSE != f->coll_md_read) {
+ H5P_coll_md_read_flag_t prop_value;
+
+ /* get the property value */
+ if(H5P_get(dxpl, H5_COLL_MD_READ_FLAG_NAME, &prop_value) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "Can't get collective metadata access flag")
+ coll_access = (H5P_USER_TRUE == prop_value ? TRUE : FALSE);
+ } /* end if */
+ } /* end if */
+#endif /* H5_HAVE_PARALLEL */
+
/* first check to see if the target is in cache */
H5C__SEARCH_INDEX(cache_ptr, addr, entry_ptr, NULL)
@@ -2652,6 +2719,62 @@ H5C_protect(H5F_t * f,
if(entry_ptr->type != type)
HGOTO_ERROR(H5E_CACHE, H5E_BADTYPE, NULL, "incorrect cache entry type")
+ /* if this is a collective metadata read, the entry is not
+ marked as collective, and is clean, it is possible that
+ other processes will not have it in its cache and will
+ expect a bcast of the entry from process 0. So process 0
+ will bcast the entry to all other ranks. Ranks that do have
+ the entry in their cache still have to participate in the
+ bcast. */
+#ifdef H5_HAVE_PARALLEL
+ if(H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI) && coll_access) {
+ if(!(entry_ptr->is_dirty) && !(entry_ptr->coll_access)) {
+ MPI_Comm comm; /* File MPI Communicator */
+ int mpi_code; /* MPI error code */
+ int buf_size;
+
+ if(MPI_COMM_NULL == (comm = H5F_mpi_get_comm(f)))
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "get_comm request failed")
+
+ if(entry_ptr->image_ptr == NULL) {
+ int mpi_rank;
+ size_t image_size;
+
+ if((mpi_rank = H5F_mpi_get_rank(f)) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "Can't get MPI rank")
+
+ if(entry_ptr->compressed)
+ image_size = entry_ptr->compressed_size;
+ else
+ image_size = entry_ptr->size;
+ HDassert(image_size > 0);
+
+ if(NULL == (entry_ptr->image_ptr = H5MM_malloc(image_size + H5C_IMAGE_EXTRA_SPACE)))
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, NULL, "memory allocation failed for on disk image buffer")
+#if H5C_DO_MEMORY_SANITY_CHECKS
+ HDmemcpy(((uint8_t *)entry_ptr->image_ptr) + image_size,
+ H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE);
+#endif /* H5C_DO_MEMORY_SANITY_CHECKS */
+ if(0 == mpi_rank)
+ if(H5C__generate_image(f, cache_ptr, entry_ptr, dxpl_id, NULL) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, NULL, "can't generate entry's image")
+ } /* end if */
+ HDassert(entry_ptr->image_ptr);
+
+ H5_CHECKED_ASSIGN(buf_size, int, entry_ptr->size, size_t);
+ if(MPI_SUCCESS != (mpi_code = MPI_Bcast(entry_ptr->image_ptr, buf_size, MPI_BYTE, 0, comm)))
+ HMPI_GOTO_ERROR(NULL, "MPI_Bcast failed", mpi_code)
+
+ /* Mark the entry as collective and insert into the collective list */
+ entry_ptr->coll_access = TRUE;
+ H5C__INSERT_IN_COLL_LIST(cache_ptr, entry_ptr, NULL)
+ } /* end if */
+ else if(entry_ptr->coll_access) {
+ H5C__MOVE_TO_TOP_IN_COLL_LIST(cache_ptr, entry_ptr, NULL)
+ } /* end else-if */
+ } /* end if */
+#endif /* H5_HAVE_PARALLEL */
+
#if H5C_DO_TAGGING_SANITY_CHECKS
{
haddr_t tag = HADDR_UNDEF;
@@ -2684,16 +2807,19 @@ H5C_protect(H5F_t * f,
hit = FALSE;
- thing = H5C_load_entry(f, dxpl_id, type, addr, udata);
-
- if ( thing == NULL ) {
-
+ if(NULL == (thing = H5C_load_entry(f, dxpl_id,
+#ifdef H5_HAVE_PARALLEL
+ coll_access,
+#endif /* H5_HAVE_PARALLEL */
+ type, addr, udata)))
HGOTO_ERROR(H5E_CACHE, H5E_CANTLOAD, NULL, "can't load entry")
- }
entry_ptr = (H5C_cache_entry_t *)thing;
-
entry_ptr->ring = ring;
+#ifdef H5_HAVE_PARALLEL
+ if(H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI) && entry_ptr->coll_access)
+ H5C__INSERT_IN_COLL_LIST(cache_ptr, entry_ptr, NULL)
+#endif /* H5_HAVE_PARALLEL */
/* Apply tag to newly protected entry */
if(H5C_tag_entry(cache_ptr, entry_ptr, dxpl_id) < 0)
@@ -2795,20 +2921,16 @@ H5C_protect(H5F_t * f,
*
* *******************************************
*
- * Set the flush_last (and possibly flush_collectively) fields
+ * Set the flush_last field
* of the newly loaded entry before inserting it into the
* index. Must do this, as the index tracked the number of
* entries with the flush_last field set, but assumes that
* the field will not change after insertion into the index.
*
- * Note that this means that the H5C__FLUSH_LAST_FLAG and
- * H5C__FLUSH_COLLECTIVELY_FLAG flags are ignored if the
- * entry is already in cache.
+ * Note that this means that the H5C__FLUSH_LAST_FLAG flag
+ * is ignored if the entry is already in cache.
*/
entry_ptr->flush_me_last = flush_last;
-#ifdef H5_HAVE_PARALLEL
- entry_ptr->flush_me_collectively = flush_collectively;
-#endif
H5C__INSERT_IN_INDEX(cache_ptr, entry_ptr, NULL)
@@ -2931,16 +3053,31 @@ H5C_protect(H5F_t * f,
}
}
+#ifdef H5_HAVE_PARALLEL
+ if(H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI)) {
+ /* Make sure the size of the collective entries in the cache remain in check */
+ if(coll_access) {
+ if(H5P_USER_TRUE == f->coll_md_read) {
+ if(cache_ptr->max_cache_size * 80 < cache_ptr->coll_list_size * 100)
+ if(H5C_clear_coll_entries(cache_ptr, TRUE) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, NULL, "can't clear collective metadata entries")
+ } /* end if */
+ else {
+ if(cache_ptr->max_cache_size * 40 < cache_ptr->coll_list_size * 100)
+ if(H5C_clear_coll_entries(cache_ptr, TRUE) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, NULL, "can't clear collective metadata entries")
+ } /* end else */
+ } /* end if */
+ } /* end if */
+#endif /* H5_HAVE_PARALLEL */
+
done:
#if H5C_DO_EXTREME_SANITY_CHECKS
if ( ( H5C_validate_protected_entry_list(cache_ptr) < 0 ) ||
( H5C_validate_pinned_entry_list(cache_ptr) < 0 ) ||
- ( H5C_validate_lru_list(cache_ptr) < 0 ) ) {
-
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, NULL, \
- "an extreme sanity check failed on exit.\n");
- }
+ ( H5C_validate_lru_list(cache_ptr) < 0 ) )
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, NULL, "an extreme sanity check failed on exit.\n")
#endif /* H5C_DO_EXTREME_SANITY_CHECKS */
FUNC_LEAVE_NOAPI(ret_value)
@@ -3279,23 +3416,14 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5C_set_evictions_enabled(H5C_t *cache_ptr,
- hbool_t evictions_enabled)
+H5C_set_evictions_enabled(H5C_t *cache_ptr, hbool_t evictions_enabled)
{
herr_t ret_value = SUCCEED; /* Return value */
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 ( ( evictions_enabled != TRUE ) && ( evictions_enabled != FALSE ) ) {
-
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \
- "Bad evictions_enabled on entry.")
- }
/* There is no fundamental reason why we should not permit
* evictions to be disabled while automatic resize is enabled.
@@ -3303,20 +3431,15 @@ H5C_set_evictions_enabled(H5C_t *cache_ptr,
* want to, and allowing it would greatly complicate testing
* the feature. Hence the following:
*/
- if ( ( evictions_enabled != TRUE ) &&
- ( ( cache_ptr->resize_ctl.incr_mode != H5C_incr__off ) ||
- ( cache_ptr->resize_ctl.decr_mode != H5C_decr__off ) ) ) {
-
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \
- "Can't disable evictions when auto resize enabled.")
- }
+ if((evictions_enabled != TRUE) &&
+ ((cache_ptr->resize_ctl.incr_mode != H5C_incr__off) ||
+ (cache_ptr->resize_ctl.decr_mode != H5C_decr__off)))
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't disable evictions when auto resize enabled.")
cache_ptr->evictions_enabled = evictions_enabled;
done:
-
FUNC_LEAVE_NOAPI(ret_value)
-
} /* H5C_set_evictions_enabled() */
@@ -4591,7 +4714,7 @@ H5C_unprotect(H5F_t * f,
/* Delete the entry from the skip list on destroy */
flush_flags |= H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG;
- if(H5C__flush_single_entry(f, dxpl_id, entry_ptr, flush_flags, NULL) < 0)
+ if(H5C__flush_single_entry(f, dxpl_id, entry_ptr, flush_flags, NULL, NULL) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "Can't flush entry")
#if H5C_DO_SANITY_CHECKS
@@ -4617,7 +4740,7 @@ H5C_unprotect(H5F_t * f,
else if(test_entry_ptr != entry_ptr)
HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "hash table contains multiple entries for addr?!?.")
- if(H5C__flush_single_entry(f, dxpl_id, entry_ptr, H5C__FLUSH_CLEAR_ONLY_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG, NULL) < 0)
+ if(H5C__flush_single_entry(f, dxpl_id, entry_ptr, H5C__FLUSH_CLEAR_ONLY_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG, NULL, NULL) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "Can't clear entry")
}
#endif /* H5_HAVE_PARALLEL */
@@ -4679,27 +4802,14 @@ H5C_validate_resize_config(H5C_auto_size_ctl_t * config_ptr,
if ( (tests & H5C_RESIZE_CFG__VALIDATE_GENERAL) != 0 ) {
- if ( ( config_ptr->set_initial_size != TRUE ) &&
- ( config_ptr->set_initial_size != FALSE ) ) {
-
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \
- "set_initial_size must be either TRUE or FALSE");
- }
-
- if ( config_ptr->max_size > H5C__MAX_MAX_CACHE_SIZE ) {
-
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "max_size too big");
- }
+ if(config_ptr->max_size > H5C__MAX_MAX_CACHE_SIZE)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "max_size too big")
- if ( config_ptr->min_size < H5C__MIN_MAX_CACHE_SIZE ) {
+ if(config_ptr->min_size < H5C__MIN_MAX_CACHE_SIZE)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "min_size too small")
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "min_size too small");
- }
-
- if ( config_ptr->min_size > config_ptr->max_size ) {
-
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "min_size > max_size");
- }
+ if(config_ptr->min_size > config_ptr->max_size)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "min_size > max_size")
if ( ( config_ptr->set_initial_size ) &&
( ( config_ptr->initial_size < config_ptr->min_size ) ||
@@ -4738,25 +4848,12 @@ H5C_validate_resize_config(H5C_auto_size_ctl_t * config_ptr,
if ( config_ptr->incr_mode == H5C_incr__threshold ) {
- if ( ( config_ptr->lower_hr_threshold < (double)0.0f ) ||
- ( config_ptr->lower_hr_threshold > (double)1.0f ) ) {
+ if((config_ptr->lower_hr_threshold < (double)0.0f) ||
+ (config_ptr->lower_hr_threshold > (double)1.0f))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "lower_hr_threshold must be in the range [0.0, 1.0]")
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \
- "lower_hr_threshold must be in the range [0.0, 1.0]");
- }
-
- if ( config_ptr->increment < (double)1.0f ) {
-
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \
- "increment must be greater than or equal to 1.0");
- }
-
- if ( ( config_ptr->apply_max_increment != TRUE ) &&
- ( config_ptr->apply_max_increment != FALSE ) ) {
-
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \
- "apply_max_increment must be either TRUE or FALSE");
- }
+ if(config_ptr->increment < (double)1.0f)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "increment must be greater than or equal to 1.0")
/* no need to check max_increment, as it is a size_t,
* and thus must be non-negative.
@@ -4834,26 +4931,13 @@ H5C_validate_resize_config(H5C_auto_size_ctl_t * config_ptr,
"epochs_before_eviction must be positive");
}
- if ( config_ptr->epochs_before_eviction > H5C__MAX_EPOCH_MARKERS ) {
-
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \
- "epochs_before_eviction too big");
- }
+ if(config_ptr->epochs_before_eviction > H5C__MAX_EPOCH_MARKERS)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "epochs_before_eviction too big")
- if ( ( config_ptr->apply_empty_reserve != TRUE ) &&
- ( config_ptr->apply_empty_reserve != FALSE ) ) {
-
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \
- "apply_empty_reserve must be either TRUE or FALSE");
- }
-
- if ( ( config_ptr->apply_empty_reserve ) &&
- ( ( config_ptr->empty_reserve > (double)1.0f ) ||
- ( config_ptr->empty_reserve < (double)0.0f ) ) ) {
-
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \
- "empty_reserve must be in the interval [0.0, 1.0]");
- }
+ if((config_ptr->apply_empty_reserve) &&
+ ((config_ptr->empty_reserve > (double)1.0f) ||
+ (config_ptr->empty_reserve < (double)0.0f)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "empty_reserve must be in the interval [0.0, 1.0]")
/* no need to check max_decrement as it is a size_t
* and thus must be non-negative.
@@ -5949,7 +6033,7 @@ H5C__autoadjust__ageout__evict_aged_out_entries(H5F_t * f,
cache_ptr->entries_removed_counter = 0;
cache_ptr->last_entry_removed_ptr = NULL;
- if(H5C__flush_single_entry(f, dxpl_id, entry_ptr, H5C__NO_FLAGS_SET, NULL) < 0)
+ if(H5C__flush_single_entry(f, dxpl_id, entry_ptr, H5C__NO_FLAGS_SET, NULL, NULL) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush entry")
if ( ( cache_ptr->entries_removed_counter > 1 ) ||
@@ -5961,7 +6045,7 @@ H5C__autoadjust__ageout__evict_aged_out_entries(H5F_t * f,
bytes_evicted += entry_ptr->size;
- if(H5C__flush_single_entry(f, dxpl_id, entry_ptr, H5C__FLUSH_INVALIDATE_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG, NULL) < 0 )
+ if(H5C__flush_single_entry(f, dxpl_id, entry_ptr, H5C__FLUSH_INVALIDATE_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG, NULL, NULL) < 0 )
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush entry")
}
@@ -6041,8 +6125,7 @@ H5C__autoadjust__ageout__evict_aged_out_entries(H5F_t * f,
prev_ptr = entry_ptr->prev;
if ( ! (entry_ptr->is_dirty) ) {
-
- if(H5C__flush_single_entry(f, dxpl_id, entry_ptr, H5C__FLUSH_INVALIDATE_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG, NULL) < 0)
+ if(H5C__flush_single_entry(f, dxpl_id, entry_ptr, H5C__FLUSH_INVALIDATE_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG, NULL, NULL) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush clean entry")
}
/* just skip the entry if it is dirty, as we can't do
@@ -6890,7 +6973,7 @@ H5C_flush_invalidate_ring(const H5F_t * f, hid_t dxpl_id, H5C_ring_t ring,
entry_size_change = 0;
#endif /* H5C_DO_SANITY_CHECKS */
- if(H5C__flush_single_entry(f, dxpl_id, entry_ptr, H5C__NO_FLAGS_SET, entry_size_change_ptr) < 0)
+ if(H5C__flush_single_entry(f, dxpl_id, entry_ptr, H5C__NO_FLAGS_SET, entry_size_change_ptr, NULL) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "dirty pinned entry flush failed.")
#if H5C_DO_SANITY_CHECKS
/* entry size may have changed during the flush.
@@ -6935,9 +7018,9 @@ H5C_flush_invalidate_ring(const H5F_t * f, hid_t dxpl_id, H5C_ring_t ring,
entry_size_change = 0;
#endif /* H5C_DO_SANITY_CHECKS */
- if(H5C__flush_single_entry(f, dxpl_id, entry_ptr,
+ if(H5C__flush_single_entry(f, dxpl_id, entry_ptr,
(cooked_flags | H5C__FLUSH_INVALIDATE_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG),
- entry_size_change_ptr) < 0)
+ entry_size_change_ptr, NULL) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "dirty entry flush destroy failed.")
#if H5C_DO_SANITY_CHECKS
/* entry size may have changed during the flush.
@@ -7058,8 +7141,8 @@ H5C_flush_invalidate_ring(const H5F_t * f, hid_t dxpl_id, H5C_ring_t ring,
entry_was_dirty = entry_ptr->is_dirty;
if(H5C__flush_single_entry(f, dxpl_id, entry_ptr,
- (cooked_flags | H5C__FLUSH_INVALIDATE_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG),
- NULL) < 0)
+ (cooked_flags | H5C__FLUSH_INVALIDATE_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG),
+ NULL, NULL) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Entry flush destroy failed.")
if(entry_was_dirty) {
@@ -7429,7 +7512,7 @@ H5C_flush_ring(H5F_t *f, hid_t dxpl_id, H5C_ring_t ring, unsigned flags)
entry_size_change = 0;
#endif /* H5C_DO_SANITY_CHECKS */
- if(H5C__flush_single_entry(f, dxpl_id, entry_ptr, flags, entry_size_change_ptr) < 0)
+ if(H5C__flush_single_entry(f, dxpl_id, entry_ptr, flags, entry_size_change_ptr, NULL) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "dirty pinned entry flush failed.")
#if H5C_DO_SANITY_CHECKS
@@ -7474,7 +7557,7 @@ H5C_flush_ring(H5F_t *f, hid_t dxpl_id, H5C_ring_t ring, unsigned flags)
flushed_entries_size += (int64_t)entry_ptr->size;
entry_size_change = 0;
#endif /* H5C_DO_SANITY_CHECKS */
- if(H5C__flush_single_entry(f, dxpl_id, entry_ptr, flags, entry_size_change_ptr) < 0)
+ if(H5C__flush_single_entry(f, dxpl_id, entry_ptr, flags, entry_size_change_ptr, NULL) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't flush entry.")
#if H5C_DO_SANITY_CHECKS
@@ -7623,7 +7706,11 @@ done:
*/
herr_t
H5C__flush_single_entry(const H5F_t *f, hid_t dxpl_id, H5C_cache_entry_t *entry_ptr,
- unsigned flags, int64_t *entry_size_change_ptr)
+ unsigned flags, int64_t *entry_size_change_ptr, H5SL_t
+#ifndef H5_HAVE_PARALLEL
+ H5_ATTR_UNUSED
+#endif /* NDEBUG */
+ *collective_write_list)
{
H5C_t * cache_ptr; /* Cache for file */
hbool_t destroy; /* external flag */
@@ -7634,10 +7721,7 @@ H5C__flush_single_entry(const H5F_t *f, hid_t dxpl_id, H5C_cache_entry_t *entry_
hbool_t write_entry; /* internal flag */
hbool_t destroy_entry; /* internal flag */
hbool_t was_dirty;
- haddr_t new_addr = HADDR_UNDEF;
- haddr_t old_addr = HADDR_UNDEF;
- size_t new_len = 0;
- size_t new_compressed_len = 0;
+ haddr_t entry_addr = HADDR_UNDEF;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -7668,6 +7752,10 @@ H5C__flush_single_entry(const H5F_t *f, hid_t dxpl_id, H5C_cache_entry_t *entry_
else
destroy_entry = destroy;
+#ifdef H5_HAVE_PARALLEL
+ HDassert(FALSE == entry_ptr->coll_access);
+#endif
+
/* we will write the entry to disk if it exists, is dirty, and if the
* clear only flag is not set.
*/
@@ -7716,34 +7804,8 @@ H5C__flush_single_entry(const H5F_t *f, hid_t dxpl_id, H5C_cache_entry_t *entry_
entry_ptr->flush_in_progress = TRUE;
entry_ptr->flush_marker = FALSE;
-#ifdef H5_HAVE_PARALLEL
-#ifndef NDEBUG
- /* If MPI based VFD is used, do special parallel I/O sanity checks.
- * Note that we only do these sanity checks when the clear_only flag
- * is not set, and the entry to be flushed is dirty. Don't bother
- * otherwise as no file I/O can result.
- */
- if(!clear_only && entry_ptr->is_dirty && H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI)) {
- H5P_genplist_t *dxpl; /* Dataset transfer property list */
- unsigned coll_meta; /* Collective metadata write flag */
-
- /* Get the dataset transfer property list */
- if(NULL == (dxpl = (H5P_genplist_t *)H5I_object(dxpl_id)))
- HGOTO_ERROR(H5E_CACHE, H5E_BADTYPE, FAIL, "not a dataset transfer property list")
-
- /* Get the collective metadata write property */
- if(H5P_get(dxpl, H5AC_COLLECTIVE_META_WRITE_NAME, &coll_meta) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "can't retrieve xfer mode")
-
- /* Sanity check collective metadata write flag */
- HDassert(coll_meta);
- } /* end if */
-#endif /* NDEBUG */
-#endif /* H5_HAVE_PARALLEL */
-
/* serialize the entry if necessary, and then write it to disk. */
if(write_entry) {
- unsigned serialize_flags = H5C__SERIALIZE_NO_FLAGS_SET;
/* The entry is dirty, and we are doing either a flush,
* or a flush destroy. In either case, serialize the
@@ -7783,225 +7845,9 @@ H5C__flush_single_entry(const H5F_t *f, hid_t dxpl_id, H5C_cache_entry_t *entry_
} /* end if */
if(!(entry_ptr->image_up_to_date)) {
- /* reset cache_ptr->slist_changed so we can detect slist
- * modifications in the pre_serialize call.
- */
- cache_ptr->slist_changed = FALSE;
-
- /* make note of the entry's current address */
- old_addr = entry_ptr->addr;
-
- /* Call client's pre-serialize callback, if there's one */
- if ( ( entry_ptr->type->pre_serialize != NULL ) &&
- ( (entry_ptr->type->pre_serialize)(f, dxpl_id,
- (void *)entry_ptr,
- entry_ptr->addr,
- entry_ptr->size,
- entry_ptr->compressed_size,
- &new_addr, &new_len,
- &new_compressed_len,
- &serialize_flags) < 0 ) )
- HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to pre-serialize entry")
-
- /* set cache_ptr->slist_change_in_pre_serialize if the
- * slist was modified.
- */
- if(cache_ptr->slist_changed)
- cache_ptr->slist_change_in_pre_serialize = TRUE;
-
- /* Check for any flags set in the pre-serialize callback */
- if(serialize_flags != H5C__SERIALIZE_NO_FLAGS_SET) {
- /* Check for unexpected flags from serialize callback */
- if(serialize_flags & ~(H5C__SERIALIZE_RESIZED_FLAG |
- H5C__SERIALIZE_MOVED_FLAG |
- H5C__SERIALIZE_COMPRESSED_FLAG))
- HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unknown serialize flag(s)")
-#ifdef H5_HAVE_PARALLEL
- /* In the parallel case, resizes and moves in
- * the serialize operation can cause problems.
- * If they occur, scream and die.
- *
- * At present, in the parallel case, the aux_ptr
- * will only be set if there is more than one
- * process. Thus we can use this to detect
- * the parallel case.
- *
- * This works for now, but if we start using the
- * aux_ptr for other purposes, we will have to
- * change this test accordingly.
- *
- * NB: While this test detects entryies that attempt
- * to resize or move themselves during a flush
- * in the parallel case, it will not detect an
- * entry that dirties, resizes, and/or moves
- * other entries during its flush.
- *
- * From what Quincey tells me, this test is
- * sufficient for now, as any flush routine that
- * does the latter will also do the former.
- *
- * If that ceases to be the case, further
- * tests will be necessary.
- */
- if(cache_ptr->aux_ptr != NULL)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "resize/move in serialize occured in parallel case.")
-#endif /* H5_HAVE_PARALLEL */
-
- /* Resize the buffer if required */
- if ( ( ( ! entry_ptr->compressed ) &&
- ( serialize_flags & H5C__SERIALIZE_RESIZED_FLAG ) ) ||
- ( ( entry_ptr->compressed ) &&
- ( serialize_flags & H5C__SERIALIZE_COMPRESSED_FLAG ) ) )
- {
- size_t new_image_size;
-
- if(entry_ptr->compressed)
- new_image_size = new_compressed_len;
- else
- new_image_size = new_len;
- HDassert(new_image_size > 0);
-
- /* Release the current image */
- if(entry_ptr->image_ptr)
- entry_ptr->image_ptr = H5MM_xfree(entry_ptr->image_ptr);
-
- /* Allocate a new image buffer */
- if(NULL == (entry_ptr->image_ptr = H5MM_malloc(new_image_size + H5C_IMAGE_EXTRA_SPACE)))
- HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed for on disk image buffer")
-#if H5C_DO_MEMORY_SANITY_CHECKS
- HDmemcpy(((uint8_t *)entry_ptr->image_ptr) + new_image_size, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE);
-#endif /* H5C_DO_MEMORY_SANITY_CHECKS */
- } /* end if */
-
- /* If required, update the entry and the cache data structures
- * for a resize.
- */
- if(serialize_flags & H5C__SERIALIZE_RESIZED_FLAG) {
- H5C__UPDATE_STATS_FOR_ENTRY_SIZE_CHANGE(cache_ptr, \
- entry_ptr, new_len)
-
- /* update the hash table for the size change*/
- H5C__UPDATE_INDEX_FOR_SIZE_CHANGE(cache_ptr, \
- entry_ptr->size, \
- new_len, entry_ptr, \
- !(entry_ptr->is_dirty));
-
- /* The entry can't be protected since we are
- * in the process of flushing it. Thus we must
- * update the replacement policy data
- * structures for the size change. The macro
- * deals with the pinned case.
- */
- H5C__UPDATE_RP_FOR_SIZE_CHANGE(cache_ptr, entry_ptr, new_len);
-
- /* as we haven't updated the cache data structures for
- * for the flush or flush destroy yet, the entry should
- * be in the slist. Thus update it for the size change.
- */
- HDassert(entry_ptr->in_slist);
- H5C__UPDATE_SLIST_FOR_SIZE_CHANGE(cache_ptr, entry_ptr->size, \
- new_len)
-
- /* if defined, update *entry_size_change_ptr for the
- * change in entry size.
- */
- if(entry_size_change_ptr != NULL)
- *entry_size_change_ptr = (int64_t)new_len - (int64_t)(entry_ptr->size);
-
- /* finally, update the entry for its new size */
- entry_ptr->size = new_len;
- } /* end if */
-
- /* If required, udate the entry and the cache data structures
- * for a move
- */
- if(serialize_flags & H5C__SERIALIZE_MOVED_FLAG) {
-#if H5C_DO_SANITY_CHECKS
- int64_t saved_slist_len_increase;
- int64_t saved_slist_size_increase;
-#endif /* H5C_DO_SANITY_CHECKS */
-
- H5C__UPDATE_STATS_FOR_MOVE(cache_ptr, entry_ptr)
-
- if(entry_ptr->addr == old_addr) {
- /* we must update cache data structures for the
- * change in address.
- */
-
- /* delete the entry from the hash table and the slist */
- H5C__DELETE_FROM_INDEX(cache_ptr, entry_ptr)
- H5C__REMOVE_ENTRY_FROM_SLIST(cache_ptr, entry_ptr)
-
- /* update the entry for its new address */
- entry_ptr->addr = new_addr;
-
- /* and then reinsert in the index and slist */
- H5C__INSERT_IN_INDEX(cache_ptr, entry_ptr, FAIL)
-
-#if H5C_DO_SANITY_CHECKS
- /* save cache_ptr->slist_len_increase and
- * cache_ptr->slist_size_increase before the
- * reinsertion into the slist, and restore
- * them afterwards to avoid skewing our sanity
- * checking.
- */
- saved_slist_len_increase = cache_ptr->slist_len_increase;
- saved_slist_size_increase = cache_ptr->slist_size_increase;
-#endif /* H5C_DO_SANITY_CHECKS */
-
- H5C__INSERT_ENTRY_IN_SLIST(cache_ptr, entry_ptr, FAIL)
-
-#if H5C_DO_SANITY_CHECKS
- cache_ptr->slist_len_increase = saved_slist_len_increase;
- cache_ptr->slist_size_increase = saved_slist_size_increase;
-#endif /* H5C_DO_SANITY_CHECKS */
- }
- else /* move is alread done for us -- just do sanity checks */
- HDassert(entry_ptr->addr == new_addr);
- } /* end if */
-
- if(serialize_flags & H5C__SERIALIZE_COMPRESSED_FLAG) {
- /* just save the new compressed entry size in
- * entry_ptr->compressed_size. We don't need to
- * do more, as compressed size is only used for I/O.
- */
- HDassert(entry_ptr->compressed);
- entry_ptr->compressed_size = new_compressed_len;
- }
- } /* end if ( serialize_flags != H5C__SERIALIZE_NO_FLAGS_SET ) */
-
- /* Serialize object into buffer */
- {
- size_t image_len;
-
- if(entry_ptr->compressed)
- image_len = entry_ptr->compressed_size;
- else
- image_len = entry_ptr->size;
-
- /* reset cache_ptr->slist_changed so we can detect slist
- * modifications in the serialize call.
- */
- cache_ptr->slist_changed = FALSE;
-
-
- if(entry_ptr->type->serialize(f, entry_ptr->image_ptr,
- image_len, (void *)entry_ptr) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to serialize entry")
-
- /* set cache_ptr->slist_change_in_serialize if the
- * slist was modified.
- */
- if(cache_ptr->slist_changed)
- cache_ptr->slist_change_in_pre_serialize = TRUE;
-
-#if H5C_DO_MEMORY_SANITY_CHECKS
- HDassert(0 == HDmemcmp(((uint8_t *)entry_ptr->image_ptr) + image_len,
- H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE));
-#endif /* H5C_DO_MEMORY_SANITY_CHECKS */
-
- entry_ptr->image_up_to_date = TRUE;
- }
+ /* Generate the entry's image */
+ if(H5C__generate_image(f, cache_ptr, entry_ptr, dxpl_id, entry_size_change_ptr) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "can't generate entry's image")
} /* end if ( ! (entry_ptr->image_up_to_date) ) */
/* Finally, write the image to disk.
@@ -8025,6 +7871,25 @@ H5C__flush_single_entry(const H5F_t *f, hid_t dxpl_id, H5C_cache_entry_t *entry_
else
image_size = entry_ptr->size;
+#ifdef H5_HAVE_PARALLEL
+ if(collective_write_list) {
+ H5C_collective_write_t *item;
+
+ if(NULL == (item = (H5C_collective_write_t *)H5FL_MALLOC(H5C_collective_write_t)))
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "unable to allocate skip list item")
+
+ item->length = image_size;
+ item->free_buf = FALSE;
+ item->buf = entry_ptr->image_ptr;
+ item->offset = entry_ptr->addr;
+
+ if(H5SL_insert(collective_write_list, item, &item->offset) < 0) {
+ H5MM_free(item);
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTINSERT, FAIL, "unable to insert skip list item")
+ } /* end if */
+ } /* end if */
+ else
+#endif /* H5_HAVE_PARALLEL */
if(H5F_block_write(f, entry_ptr->type->mem_type, entry_ptr->addr,
image_size, dxpl_id, entry_ptr->image_ptr) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't write image to file.")
@@ -8131,6 +7996,10 @@ H5C__flush_single_entry(const H5F_t *f, hid_t dxpl_id, H5C_cache_entry_t *entry_
/* reset the flush_in progress flag */
entry_ptr->flush_in_progress = FALSE;
+ /* capture the cache entry address for the log_flush call at the
+ end before the entry_ptr gets freed */
+ entry_addr = entry_ptr->addr;
+
/* Internal cache data structures should now be up to date, and
* consistant with the status of the entry.
*
@@ -8242,7 +8111,7 @@ H5C__flush_single_entry(const H5F_t *f, hid_t dxpl_id, H5C_cache_entry_t *entry_
} /* if (destroy) */
if(cache_ptr->log_flush)
- if((cache_ptr->log_flush)(cache_ptr, entry_ptr->addr, was_dirty, flags) < 0)
+ if((cache_ptr->log_flush)(cache_ptr, entry_addr, was_dirty, flags) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "log_flush callback failed.")
done:
@@ -8261,12 +8130,12 @@ done:
* Function: H5C_load_entry
*
* Purpose: Attempt to load the entry at the specified disk address
- * and with the specified type into memory. If successful.
- * return the in memory address of the entry. Return NULL
- * on failure.
+ * and with the specified type into memory. If successful.
+ * return the in memory address of the entry. Return NULL
+ * on failure.
*
- * Note that this function simply loads the entry into
- * core. It does not insert it into the cache.
+ * Note that this function simply loads the entry into
+ * core. It does not insert it into the cache.
*
* Return: Non-NULL on success / NULL on failure.
*
@@ -8275,27 +8144,35 @@ done:
*-------------------------------------------------------------------------
*/
static void *
-H5C_load_entry(H5F_t * f,
- hid_t dxpl_id,
- const H5C_class_t * type,
- haddr_t addr,
- void * udata)
+H5C_load_entry(H5F_t * f,
+ hid_t dxpl_id,
+#ifdef H5_HAVE_PARALLEL
+ hbool_t coll_access,
+#endif /* H5_HAVE_PARALLEL */
+ const H5C_class_t * type,
+ haddr_t addr,
+ void * udata)
{
- hbool_t dirty = FALSE; /* Flag indicating whether thing was dirtied during deserialize */
- hbool_t compressed = FALSE; /* flag indicating whether thing */
- /* will be run through filters on */
- /* on read and write. Usually FALSE */
- /* set to true if appropriate. */
- size_t compressed_size = 0; /* entry compressed size if */
- /* known -- otherwise uncompressed. */
- /* Zero indicates compression not */
- /* enabled. */
- void * image = NULL; /* Buffer for disk image */
- void * thing = NULL; /* Pointer to thing loaded */
- H5C_cache_entry_t * entry; /* Alias for thing loaded, as cache entry */
- size_t len; /* Size of image in file */
- unsigned u; /* Local index variable */
- void * ret_value = NULL; /* Return value */
+ hbool_t dirty = FALSE; /* Flag indicating whether thing was dirtied during deserialize */
+ hbool_t compressed = FALSE; /* flag indicating whether thing */
+ /* will be run through filters on */
+ /* on read and write. Usually FALSE */
+ /* set to true if appropriate. */
+ size_t compressed_size = 0; /* entry compressed size if */
+ /* known -- otherwise uncompressed. */
+ /* Zero indicates compression not */
+ /* enabled. */
+ void * image = NULL; /* Buffer for disk image */
+ void * thing = NULL; /* Pointer to thing loaded */
+ H5C_cache_entry_t *entry = NULL; /* Alias for thing loaded, as cache entry */
+ size_t len; /* Size of image in file */
+ unsigned u; /* Local index variable */
+#ifdef H5_HAVE_PARALLEL
+ int mpi_rank = 0; /* MPI process rank */
+ MPI_Comm comm = MPI_COMM_NULL; /* File MPI Communicator */
+ int mpi_code; /* MPI error code */
+#endif /* H5_HAVE_PARALLEL */
+ void * ret_value = NULL; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
@@ -8334,74 +8211,15 @@ H5C_load_entry(H5F_t * f,
/* Check for possible speculative read off the end of the file */
if(type->flags & H5C__CLASS_SPECULATIVE_LOAD_FLAG) {
-/* Quincey has added patches for eoa calculations -- leave the original
- * code around until we see the effect of these patches.
- * JRM -- 1/1/15
- */
-#if 0 /* original code */ /* JRM */
- /* the original version of this code has several problems:
- *
- * First, the sblock is not available until the sblock
- * has been read in, which causes a seg fault. This is
- * dealt with easily enough by testing to see if
- * f->shared->sblock is NULL, and calling H5FD_get_base_addr()
- * to obtain the base addr when it is.
- *
- * The second issue is more subtle. H5F_get_eoa() calls
- * H5FD_get_eoa(). However, this function returns the EOA as
- * a relative address -- i.e. relative to the base address.
- * This means that the base addr + addr < eoa sanity check will
- * fail whenever the super block is not at address 0 when
- * reading in the first chunk of the super block.
- *
- * To address these issues, I have rewritten the code to
- * simply verify that the address plus length is less than
- * the eoa. I think this is sufficient, but further testing
- * should tell me if it isn't.
- * JRM -- 8/29/14
- */
- haddr_t eoa; /* End-of-allocation in the file */
- haddr_t base_addr; /* Base address of file data */
-
- /* Get the file's end-of-allocation value */
- eoa = H5F_get_eoa(f, type->mem_type);
- HDassert(H5F_addr_defined(eoa));
-
- /* Get the file's base address */
- if ( f->shared->sblock )
-
- base_addr = H5F_BASE_ADDR(f);
-
- else { /* sblock not loaded yet -- use file driver info */
-
- HDassert(f->shared->lf);
- base_addr = H5FD_get_base_addr(f->shared->lf);
-
- }
- HDassert(H5F_addr_defined(base_addr));
-
- /* Check for bad address in general */
- if((addr + base_addr) > eoa)
- HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, NULL, \
- "address of object past end of allocation")
-
- /* Check if the amount of data to read will be past the eoa */
- if((addr + base_addr + len) > eoa)
- /* Trim down the length of the metadata */
- len = (size_t)(eoa - (addr + base_addr));
-
-#else /* modified code */ /* JRM */
-
haddr_t eoa; /* End-of-allocation in the file */
H5FD_mem_t cooked_type;
- /* if type == H5FD_MEM_GHEAP, H5F_block_read() forces
+ /* if type == H5FD_MEM_GHEAP, H5F_block_read() forces
* type to H5FD_MEM_DRAW via its call to H5F__accum_read().
* Thus we do the same for purposes of computing the eoa
* for sanity checks.
*/
- cooked_type =
- (type->mem_type == H5FD_MEM_GHEAP) ? H5FD_MEM_DRAW : type->mem_type;
+ cooked_type = (type->mem_type == H5FD_MEM_GHEAP) ? H5FD_MEM_DRAW : type->mem_type;
/* Get the file's end-of-allocation value */
eoa = H5F_get_eoa(f, cooked_type);
@@ -8410,27 +8228,23 @@ H5C_load_entry(H5F_t * f,
/* Check for bad address in general */
if ( H5F_addr_gt(addr, eoa) )
-
- HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, NULL, \
- "address of object past end of allocation")
+ HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, NULL, "address of object past end of allocation")
/* Check if the amount of data to read will be past the eoa */
if( H5F_addr_gt((addr + len), eoa) ) {
/* Trim down the length of the metadata */
-
/* Note that for some cache clients, this will cause an
- * assertion failure. JRM -- 8/29/14
+ * assertion failure. JRM -- 8/29/14
*/
len = (size_t)(eoa - addr);
- }
+ } /* end if */
if ( len <= 0 )
- HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, NULL, \
- "len not positive after adjustment for EOA.")
+ HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, NULL, "len not positive after adjustment for EOA.")
+
+ } /* end if */
-#endif /* modified code */ /* JRM */
- }
/* Allocate the buffer for reading the on-disk entry image */
if(NULL == (image = H5MM_malloc(len + H5C_IMAGE_EXTRA_SPACE)))
HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, NULL, "memory allocation failed for on disk image buffer.")
@@ -8439,10 +8253,40 @@ H5C_load_entry(H5F_t * f,
HDmemcpy(image + len, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE);
#endif /* H5C_DO_MEMORY_SANITY_CHECKS */
+#ifdef H5_HAVE_PARALLEL
+ if(H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI)) {
+ if((mpi_rank = H5F_mpi_get_rank(f)) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "Can't get MPI rank")
+ if((comm = H5F_mpi_get_comm(f)) == MPI_COMM_NULL)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "get_comm request failed")
+ } /* end if */
+#endif /* H5_HAVE_PARALLEL */
+
/* Get the on-disk entry image */
- if ( 0 == (type->flags & H5C__CLASS_SKIP_READS) )
- if(H5F_block_read(f, type->mem_type, addr, len, dxpl_id, image) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_READERROR, NULL, "Can't read image*")
+ if(0 == (type->flags & H5C__CLASS_SKIP_READS)) {
+#ifdef H5_HAVE_PARALLEL
+ if(!coll_access || 0 == mpi_rank) {
+#endif /* H5_HAVE_PARALLEL */
+
+ if(H5F_block_read(f, type->mem_type, addr, len, dxpl_id, image) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_READERROR, NULL, "Can't read image*")
+
+#ifdef H5_HAVE_PARALLEL
+ } /* end if */
+
+ /* if the collective metadata read optimization is turned on,
+ * bcast the metadata read from process 0 to all ranks in the file
+ * communicator
+ */
+ if(coll_access) {
+ int buf_size;
+
+ H5_CHECKED_ASSIGN(buf_size, int, len, size_t);
+ if(MPI_SUCCESS != (mpi_code = MPI_Bcast(image, buf_size, MPI_BYTE, 0, comm)))
+ HMPI_GOTO_ERROR(NULL, "MPI_Bcast failed", mpi_code)
+ } /* end if */
+#endif /* H5_HAVE_PARALLEL */
+ } /* end if */
/* Deserialize the on-disk image into the native memory form */
if(NULL == (thing = type->deserialize(image, len, udata, &dirty)))
@@ -8452,7 +8296,7 @@ H5C_load_entry(H5F_t * f,
if(type->image_len) {
size_t new_len; /* New size of on-disk image */
- /* set magic and type field in *entry_ptr. While the image_len
+ /* set magic and type field in *entry_ptr. While the image_len
* callback shouldn't touch the cache specific fields, it may check
* these fields to ensure that it it has received the expected
* value.
@@ -8464,22 +8308,22 @@ H5C_load_entry(H5F_t * f,
entry->magic = H5C__H5C_CACHE_ENTRY_T_MAGIC;
entry->type = type;
- /* verify that compressed and compressed_len are initialized */
+ /* verify that compressed and compressed_len are initialized */
HDassert(compressed == FALSE);
HDassert(compressed_size == 0);
/* Get the actual image size for the thing */
if(type->image_len(thing, &new_len, &compressed, &compressed_size) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, NULL, "can't retrieve image length")
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, NULL, "can't retrieve image length")
- if(new_len == 0)
- HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, NULL, "image length is 0")
+ if(new_len == 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, NULL, "image length is 0")
HDassert(((type->flags & H5C__CLASS_COMPRESSED_FLAG) != 0) ||
((compressed == FALSE) && (compressed_size == 0)));
HDassert((compressed == TRUE) || (compressed_size == 0));
- if(new_len != len) {
+ if(new_len != len) {
if(type->flags & H5C__CLASS_COMPRESSED_FLAG) {
@@ -8491,12 +8335,12 @@ H5C_load_entry(H5F_t * f,
* size -- which must equal len.
*
* We can't verify the uncompressed size, but we can
- * verify the rest with the following assertions.
+ * verify the rest with the following assertions.
*/
- HDassert(compressed);
+ HDassert(compressed);
HDassert(compressed_size == len);
- /* new_len should contain the uncompressed size. Set len
+ /* new_len should contain the uncompressed size. Set len
* equal to new_len, so that the cache will use the
* uncompressed size for purposes of space allocation, etc.
*/
@@ -8506,11 +8350,11 @@ H5C_load_entry(H5F_t * f,
void *new_image; /* Buffer for disk image */
- /* compressed must be FALSE, and compressed_size
+ /* compressed must be FALSE, and compressed_size
* must be zero.
*/
- HDassert(!compressed);
- HDassert(compressed_size == 0);
+ HDassert(!compressed);
+ HDassert(compressed_size == 0);
/* Adjust the size of the image to match new_len */
if(NULL == (new_image = H5MM_realloc(image,
@@ -8521,9 +8365,7 @@ H5C_load_entry(H5F_t * f,
image = new_image;
#if H5C_DO_MEMORY_SANITY_CHECKS
-
HDmemcpy(((uint8_t *)image) + new_len, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE);
-
#endif /* H5C_DO_MEMORY_SANITY_CHECKS */
/* If the thing's image needs to be bigger for a speculatively
@@ -8545,24 +8387,36 @@ H5C_load_entry(H5F_t * f,
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, NULL, "free_icr callback failed")
+#ifdef H5_HAVE_PARALLEL
+ if(!coll_access || 0 == mpi_rank) {
+#endif /* H5_HAVE_PARALLEL */
+
/* Go get the on-disk image again */
if(H5F_block_read(f, type->mem_type, addr,
new_len, dxpl_id, image) < 0)
-
HGOTO_ERROR(H5E_CACHE, H5E_CANTLOAD, NULL, "Can't read image")
- /* Deserialize on-disk image into native memory
- * form again
- */
- if(NULL == (thing = type->deserialize(image, new_len,
- udata, &dirty)))
+#ifdef H5_HAVE_PARALLEL
+ }
+ /* if the collective metadata read optimization is turned on,
+ bcast the metadata read from process 0 to all ranks in the file
+ communicator */
+ if(coll_access) {
+ int buf_size;
+
+ H5_CHECKED_ASSIGN(buf_size, int, new_len, size_t);
+ if(MPI_SUCCESS != (mpi_code = MPI_Bcast(image, buf_size, MPI_BYTE, 0, comm)))
+ HMPI_GOTO_ERROR(NULL, "MPI_Bcast failed", mpi_code)
+ } /* end if */
+#endif /* H5_HAVE_PARALLEL */
- HGOTO_ERROR(H5E_CACHE, H5E_CANTLOAD, NULL, \
- "Can't deserialize image")
+ /* Deserialize on-disk image into native memory form again */
+ if(NULL == (thing = type->deserialize(image, new_len, udata, &dirty)))
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTLOAD, NULL, "Can't deserialize image")
#ifndef NDEBUG
- {
- /* new_compressed and new_compressed_size must be
+ {
+ /* new_compressed and new_compressed_size must be
* initialize to FALSE / 0 respectively, as clients
* that don't use compression may ignore these two
* parameters.
@@ -8584,7 +8438,7 @@ H5C_load_entry(H5F_t * f,
HDassert(new_new_len == new_len);
HDassert(!new_compressed);
HDassert(new_compressed_size == 0);
- }
+ } /* end block */
#endif /* NDEBUG */
} /* end if (new_len > len) */
@@ -8596,7 +8450,7 @@ H5C_load_entry(H5F_t * f,
HGOTO_ERROR(H5E_CACHE, H5E_UNSUPPORTED, NULL, \
"size of non-speculative, non-compressed object changed")
}
- } /* end if (new_len != len) */
+ } /* end if (new_len != len) */
} /* end if */
entry = (H5C_cache_entry_t *)thing;
@@ -8643,14 +8497,15 @@ H5C_load_entry(H5F_t * f,
#ifdef H5_HAVE_PARALLEL
entry->clear_on_unprotect = FALSE;
entry->flush_immediately = FALSE;
+ entry->coll_access = coll_access;
#endif /* H5_HAVE_PARALLEL */
entry->flush_in_progress = FALSE;
entry->destroy_in_progress = FALSE;
- entry->ring = H5C_RING_UNDEFINED;
+ entry->ring = H5C_RING_UNDEFINED;
/* Initialize flush dependency height fields */
- entry->flush_dep_parent = NULL;
+ entry->flush_dep_parent = NULL;
for(u = 0; u < H5C__NUM_FLUSH_DEP_HEIGHTS; u++)
entry->child_flush_dep_height_rc[u] = 0;
entry->flush_dep_height = 0;
@@ -8663,6 +8518,11 @@ H5C_load_entry(H5F_t * f,
entry->aux_next = NULL;
entry->aux_prev = NULL;
+#ifdef H5_HAVE_PARALLEL
+ entry->coll_next = NULL;
+ entry->coll_prev = NULL;
+#endif /* H5_HAVE_PARALLEL */
+
H5C__RESET_CACHE_ENTRY_STATS(entry);
ret_value = thing;
@@ -8670,13 +8530,9 @@ H5C_load_entry(H5F_t * f,
done:
/* Cleanup on error */
if(NULL == ret_value) {
-
/* Release resources */
- if ( thing && type->free_icr(thing) < 0 )
-
- HDONE_ERROR(H5E_CACHE, H5E_CANTFLUSH, NULL, \
- "free_icr callback failed")
-
+ if(thing && type->free_icr(thing) < 0)
+ HDONE_ERROR(H5E_CACHE, H5E_CANTFLUSH, NULL, "free_icr callback failed")
if(image)
image = H5MM_xfree(image);
} /* end if */
@@ -8855,7 +8711,14 @@ H5C_make_space_in_cache(H5F_t * f,
cache_ptr->entries_removed_counter = 0;
cache_ptr->last_entry_removed_ptr = NULL;
- if(H5C__flush_single_entry(f, dxpl_id, entry_ptr, H5C__NO_FLAGS_SET, NULL) < 0)
+#ifdef H5_HAVE_PARALLEL
+ if(TRUE == entry_ptr->coll_access) {
+ entry_ptr->coll_access = FALSE;
+ H5C__REMOVE_FROM_COLL_LIST(cache_ptr, entry_ptr, FAIL)
+ } /* end if */
+#endif
+
+ if(H5C__flush_single_entry(f, dxpl_id, entry_ptr, H5C__NO_FLAGS_SET, NULL, NULL) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush entry")
if ( ( cache_ptr->entries_removed_counter > 1 ) ||
@@ -8863,14 +8726,16 @@ H5C_make_space_in_cache(H5F_t * f,
restart_scan = TRUE;
- } else if ( (cache_ptr->index_size + space_needed)
- >
- cache_ptr->max_cache_size ) {
+ } else if ( (cache_ptr->index_size + space_needed) > cache_ptr->max_cache_size
+#ifdef H5_HAVE_PARALLEL
+ && !(entry_ptr->coll_access)
+#endif /* H5_HAVE_PARALLEL */
+ ) {
#if H5C_COLLECT_CACHE_STATS
cache_ptr->entries_scanned_to_make_space++;
#endif /* H5C_COLLECT_CACHE_STATS */
- if(H5C__flush_single_entry(f, dxpl_id, entry_ptr, H5C__FLUSH_INVALIDATE_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG, NULL) < 0)
+ if(H5C__flush_single_entry(f, dxpl_id, entry_ptr, H5C__FLUSH_INVALIDATE_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG, NULL, NULL) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush entry")
} else {
/* We have enough space so don't flush clean entry. */
@@ -9006,8 +8871,14 @@ H5C_make_space_in_cache(H5F_t * f,
prev_ptr = entry_ptr->aux_prev;
- if(H5C__flush_single_entry(f, dxpl_id, entry_ptr, H5C__FLUSH_INVALIDATE_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG, NULL) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush entry")
+#ifdef H5_HAVE_PARALLEL
+ if(!(entry_ptr->coll_access)) {
+#endif /* H5_HAVE_PARALLEL */
+ if(H5C__flush_single_entry(f, dxpl_id, entry_ptr, H5C__FLUSH_INVALIDATE_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush entry")
+#ifdef H5_HAVE_PARALLEL
+ } /* end if */
+#endif /* H5_HAVE_PARALLEL */
/* we are scanning the clean LRU, so the serialize function
* will not be called on any entry -- thus there is no
@@ -10046,3 +9917,245 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C_get_entry_ring() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5C__generate_image
+ *
+ * Purpose: Serialize an entry and generate its image.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Mohamad Chaarawi
+ * 2/10/16
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C__generate_image(const H5F_t *f, H5C_t *cache_ptr, H5C_cache_entry_t *entry_ptr,
+ hid_t dxpl_id, int64_t *entry_size_change_ptr)
+{
+ haddr_t new_addr = HADDR_UNDEF;
+ haddr_t old_addr = HADDR_UNDEF;
+ size_t new_len = 0;
+ size_t new_compressed_len = 0;
+ unsigned serialize_flags = H5C__SERIALIZE_NO_FLAGS_SET;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity check */
+ HDassert(!entry_ptr->image_up_to_date);
+
+ /* reset cache_ptr->slist_changed so we can detect slist
+ * modifications in the pre_serialize call.
+ */
+ cache_ptr->slist_changed = FALSE;
+
+ /* make note of the entry's current address */
+ old_addr = entry_ptr->addr;
+
+ /* Call client's pre-serialize callback, if there's one */
+ if(entry_ptr->type->pre_serialize &&
+ (entry_ptr->type->pre_serialize)(f, dxpl_id,
+ (void *)entry_ptr, entry_ptr->addr, entry_ptr->size,
+ entry_ptr->compressed_size, &new_addr, &new_len,
+ &new_compressed_len, &serialize_flags) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to pre-serialize entry")
+
+ /* set cache_ptr->slist_change_in_pre_serialize if the
+ * slist was modified.
+ */
+ if(cache_ptr->slist_changed)
+ cache_ptr->slist_change_in_pre_serialize = TRUE;
+
+ /* Check for any flags set in the pre-serialize callback */
+ if(serialize_flags != H5C__SERIALIZE_NO_FLAGS_SET) {
+ /* Check for unexpected flags from serialize callback */
+ if(serialize_flags & ~(H5C__SERIALIZE_RESIZED_FLAG |
+ H5C__SERIALIZE_MOVED_FLAG |
+ H5C__SERIALIZE_COMPRESSED_FLAG))
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unknown serialize flag(s)")
+
+#ifdef H5_HAVE_PARALLEL
+ /* In the parallel case, resizes and moves in
+ * the serialize operation can cause problems.
+ * If they occur, scream and die.
+ *
+ * At present, in the parallel case, the aux_ptr
+ * will only be set if there is more than one
+ * process. Thus we can use this to detect
+ * the parallel case.
+ *
+ * This works for now, but if we start using the
+ * aux_ptr for other purposes, we will have to
+ * change this test accordingly.
+ *
+ * NB: While this test detects entryies that attempt
+ * to resize or move themselves during a flush
+ * in the parallel case, it will not detect an
+ * entry that dirties, resizes, and/or moves
+ * other entries during its flush.
+ *
+ * From what Quincey tells me, this test is
+ * sufficient for now, as any flush routine that
+ * does the latter will also do the former.
+ *
+ * If that ceases to be the case, further
+ * tests will be necessary.
+ */
+ if(cache_ptr->aux_ptr != NULL)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "resize/move in serialize occured in parallel case.")
+#endif
+
+ /* Resize the buffer if required */
+ if(((!entry_ptr->compressed) && (serialize_flags & H5C__SERIALIZE_RESIZED_FLAG)) ||
+ ((entry_ptr->compressed) && (serialize_flags & H5C__SERIALIZE_COMPRESSED_FLAG))) {
+ size_t new_image_size;
+
+ if(entry_ptr->compressed)
+ new_image_size = new_compressed_len;
+ else
+ new_image_size = new_len;
+ HDassert(new_image_size > 0);
+
+ /* Release the current image */
+ if(entry_ptr->image_ptr)
+ entry_ptr->image_ptr = H5MM_xfree(entry_ptr->image_ptr);
+
+ /* Allocate a new image buffer */
+ if(NULL == (entry_ptr->image_ptr = H5MM_malloc(new_image_size + H5C_IMAGE_EXTRA_SPACE)))
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed for on disk image buffer")
+
+#if H5C_DO_MEMORY_SANITY_CHECKS
+ HDmemcpy(((uint8_t *)entry_ptr->image_ptr) + new_image_size, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE);
+#endif /* H5C_DO_MEMORY_SANITY_CHECKS */
+ } /* end if */
+
+ /* If required, update the entry and the cache data structures
+ * for a resize.
+ */
+ if(serialize_flags & H5C__SERIALIZE_RESIZED_FLAG) {
+ H5C__UPDATE_STATS_FOR_ENTRY_SIZE_CHANGE(cache_ptr, entry_ptr, new_len);
+
+ /* update the hash table for the size change*/
+ H5C__UPDATE_INDEX_FOR_SIZE_CHANGE(cache_ptr, entry_ptr->size, \
+ new_len, entry_ptr, !(entry_ptr->is_dirty));
+
+ /* The entry can't be protected since we are
+ * in the process of flushing it. Thus we must
+ * update the replacement policy data
+ * structures for the size change. The macro
+ * deals with the pinned case.
+ */
+ H5C__UPDATE_RP_FOR_SIZE_CHANGE(cache_ptr, entry_ptr, new_len);
+
+ /* as we haven't updated the cache data structures for
+ * for the flush or flush destroy yet, the entry should
+ * be in the slist. Thus update it for the size change.
+ */
+ HDassert(entry_ptr->in_slist);
+ H5C__UPDATE_SLIST_FOR_SIZE_CHANGE(cache_ptr, entry_ptr->size, new_len);
+
+ /* if defined, update *entry_size_change_ptr for the
+ * change in entry size.
+ */
+ if(entry_size_change_ptr != NULL)
+ *entry_size_change_ptr = (int64_t)new_len - (int64_t)(entry_ptr->size);
+
+ /* finally, update the entry for its new size */
+ entry_ptr->size = new_len;
+ } /* end if */
+
+ /* If required, udate the entry and the cache data structures
+ * for a move
+ */
+ if(serialize_flags & H5C__SERIALIZE_MOVED_FLAG) {
+#if H5C_DO_SANITY_CHECKS
+ int64_t saved_slist_len_increase;
+ int64_t saved_slist_size_increase;
+#endif /* H5C_DO_SANITY_CHECKS */
+
+ H5C__UPDATE_STATS_FOR_MOVE(cache_ptr, entry_ptr);
+
+ if(entry_ptr->addr == old_addr) {
+ /* we must update cache data structures for the
+ * change in address.
+ */
+
+ /* delete the entry from the hash table and the slist */
+ H5C__DELETE_FROM_INDEX(cache_ptr, entry_ptr);
+ H5C__REMOVE_ENTRY_FROM_SLIST(cache_ptr, entry_ptr);
+
+ /* update the entry for its new address */
+ entry_ptr->addr = new_addr;
+
+ /* and then reinsert in the index and slist */
+ H5C__INSERT_IN_INDEX(cache_ptr, entry_ptr, FAIL);
+
+#if H5C_DO_SANITY_CHECKS
+ /* save cache_ptr->slist_len_increase and
+ * cache_ptr->slist_size_increase before the
+ * reinsertion into the slist, and restore
+ * them afterwards to avoid skewing our sanity
+ * checking.
+ */
+ saved_slist_len_increase = cache_ptr->slist_len_increase;
+ saved_slist_size_increase = cache_ptr->slist_size_increase;
+#endif /* H5C_DO_SANITY_CHECKS */
+
+ H5C__INSERT_ENTRY_IN_SLIST(cache_ptr, entry_ptr, FAIL);
+
+#if H5C_DO_SANITY_CHECKS
+ cache_ptr->slist_len_increase = saved_slist_len_increase;
+ cache_ptr->slist_size_increase = saved_slist_size_increase;
+#endif /* H5C_DO_SANITY_CHECKS */
+ } /* end if */
+ else /* move is already done for us -- just do sanity checks */
+ HDassert(entry_ptr->addr == new_addr);
+ } /* end if */
+
+ if(serialize_flags & H5C__SERIALIZE_COMPRESSED_FLAG) {
+ /* just save the new compressed entry size in
+ * entry_ptr->compressed_size. We don't need to
+ * do more, as compressed size is only used for I/O.
+ */
+ HDassert(entry_ptr->compressed);
+ entry_ptr->compressed_size = new_compressed_len;
+ } /* end if */
+ } /* end if(serialize_flags != H5C__SERIALIZE_NO_FLAGS_SET) */
+
+ /* Serialize object into buffer */
+ {
+ size_t image_len;
+
+ if(entry_ptr->compressed)
+ image_len = entry_ptr->compressed_size;
+ else
+ image_len = entry_ptr->size;
+
+ /* reset cache_ptr->slist_changed so we can detect slist
+ * modifications in the serialize call.
+ */
+ cache_ptr->slist_changed = FALSE;
+
+ if(entry_ptr->type->serialize(f, entry_ptr->image_ptr, image_len, (void *)entry_ptr) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to serialize entry")
+
+ /* set cache_ptr->slist_change_in_serialize if the
+ * slist was modified.
+ */
+ if(cache_ptr->slist_changed)
+ cache_ptr->slist_change_in_pre_serialize = TRUE;
+
+#if H5C_DO_MEMORY_SANITY_CHECKS
+ HDassert(0 == HDmemcmp(((uint8_t *)entry_ptr->image_ptr) + image_len,
+ H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE));
+#endif /* H5C_DO_MEMORY_SANITY_CHECKS */
+
+ entry_ptr->image_up_to_date = TRUE;
+ } /* end block */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__generate_image */
+
diff --git a/src/H5Cmpio.c b/src/H5Cmpio.c
index 6b63ad5..4e88e44 100644
--- a/src/H5Cmpio.c
+++ b/src/H5Cmpio.c
@@ -39,14 +39,17 @@
#include "H5private.h" /* Generic Functions */
#include "H5ACprivate.h" /* Metadata cache */
#include "H5Cpkg.h" /* Cache */
+#include "H5Dprivate.h" /* Datasets */
#include "H5Eprivate.h" /* Error handling */
#include "H5Fpkg.h" /* Files */
+#include "H5FDprivate.h" /* File drivers */
+#include "H5FLprivate.h" /* Free Lists */
#include "H5Iprivate.h" /* IDs */
#include "H5MMprivate.h" /* Memory management */
+#include "H5Pprivate.h" /* Property lists */
#ifdef H5_HAVE_PARALLEL
-
/****************/
/* Local Macros */
/****************/
@@ -61,6 +64,9 @@
/********************/
/* Local Prototypes */
/********************/
+static herr_t H5C__collective_write(H5F_t *f, hid_t dxpl_id,
+ H5SL_t *collective_write_list);
+static herr_t H5C__collective_write_free(void *_item, void *key, void *op_data);
/*********************/
@@ -77,6 +83,9 @@
/* Local Variables */
/*******************/
+/* Declare a free list to manage the H5C_collective_write_t struct */
+H5FL_DEFINE(H5C_collective_write_t);
+
/*-------------------------------------------------------------------------
@@ -221,6 +230,7 @@ H5C_apply_candidate_list(H5F_t * f,
H5C_cache_entry_t * entry_ptr = NULL;
H5C_cache_entry_t * flush_ptr = NULL;
H5C_cache_entry_t * delayed_ptr = NULL;
+ H5SL_t * collective_write_list = NULL;
#if H5C_DO_SANITY_CHECKS
haddr_t last_addr;
#endif /* H5C_DO_SANITY_CHECKS */
@@ -253,6 +263,12 @@ H5C_apply_candidate_list(H5F_t * f,
HDfprintf(stdout, "%s", tbl_buf);
#endif /* H5C_APPLY_CANDIDATE_LIST__DEBUG */
+ if(f->coll_md_write) {
+ /* Create skip list of entries for collective write */
+ if(NULL == (collective_write_list = H5SL_create(H5SL_TYPE_HADDR, NULL)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTCREATE, FAIL, "can't create skip list for entries")
+ } /* end if */
+
n = num_candidates / mpi_size;
m = num_candidates % mpi_size;
HDassert(n >= 0);
@@ -357,6 +373,16 @@ H5C_apply_candidate_list(H5F_t * f,
entries_to_clear++;
entry_ptr->clear_on_unprotect = TRUE;
} /* end else */
+
+ /* Entries marked as collectively accessed and are in the
+ candidate list to clear from the cache have to be
+ removed from the coll list. This is OK since the
+ candidate list is collective and uniform across all
+ ranks. */
+ if(TRUE == entry_ptr->coll_access) {
+ entry_ptr->coll_access = FALSE;
+ H5C__REMOVE_FROM_COLL_LIST(cache_ptr, entry_ptr, FAIL)
+ } /* end if */
} /* end else */
} /* end for */
@@ -386,7 +412,7 @@ H5C_apply_candidate_list(H5F_t * f,
* Now scan the LRU and PEL lists, flushing or clearing entries as
* needed.
*
- * The flush_me_last and flush_me_collectively flags may dictate how or
+ * The flush_me_last flag may dictate how or
* when some entries can be flushed, and should be addressed here.
* However, in their initial implementation, these flags only apply to the
* superblock, so there's only a relatively small change to this function
@@ -433,8 +459,8 @@ H5C_apply_candidate_list(H5F_t * f,
* will not call either the pre_serialize or serialize callbacks.
*/
- if(H5C__flush_single_entry(f, dxpl_id, clear_ptr, H5C__FLUSH_CLEAR_ONLY_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG, NULL) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't clear entry.")
+ if(H5C__flush_single_entry(f, dxpl_id, clear_ptr, H5C__FLUSH_CLEAR_ONLY_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't clear entry.")
} /* end if */
/* Else, if this process needs to flush this entry. */
@@ -478,8 +504,9 @@ H5C_apply_candidate_list(H5F_t * f,
cache_ptr->entries_removed_counter = 0;
cache_ptr->last_entry_removed_ptr = NULL;
- if(H5C__flush_single_entry(f, dxpl_id, flush_ptr, H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG, NULL) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't flush entry.")
+ /* Add this entry to the list of entries to collectively write */
+ if(H5C__flush_single_entry(f, dxpl_id, flush_ptr, H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG, NULL, collective_write_list) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't flush entry.")
if ( ( cache_ptr->entries_removed_counter > 1 ) ||
( cache_ptr->last_entry_removed_ptr == entry_ptr ) )
@@ -607,11 +634,10 @@ H5C_apply_candidate_list(H5F_t * f,
it is the simple case of a single pinned entry needing
flushed last and collectively is just a minor addition to
this routine, but signficantly buffing up the usage of
- flush_me_last or flush_me_collectively will require a more
+ flush_me_last will require a more
intense rework of this function and potentially the function
of candidate lists as a whole. */
- HDassert(entry_ptr->flush_me_collectively);
entries_to_flush_or_clear_last++;
entries_to_flush_collectively++;
HDassert(entries_to_flush_or_clear_last == 1);
@@ -633,12 +659,12 @@ H5C_apply_candidate_list(H5F_t * f,
entries_cleared++;
#if ( H5C_APPLY_CANDIDATE_LIST__DEBUG > 1 )
- HDfprintf(stdout, "%s:%d: clearing 0x%llx.\n", FUNC, mpi_rank,
- (long long)clear_ptr->addr);
+ HDfprintf(stdout, "%s:%d: clearing 0x%llx.\n", FUNC, mpi_rank,
+ (long long)clear_ptr->addr);
#endif /* H5C_APPLY_CANDIDATE_LIST__DEBUG */
- if(H5C__flush_single_entry(f, dxpl_id, clear_ptr, H5C__FLUSH_CLEAR_ONLY_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG, NULL) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't clear entry.")
+ if(H5C__flush_single_entry(f, dxpl_id, clear_ptr, H5C__FLUSH_CLEAR_ONLY_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't clear entry.")
} /* end else-if */
/* Else, if this process needs to independently flush this entry. */
@@ -653,8 +679,9 @@ H5C_apply_candidate_list(H5F_t * f,
(long long)flush_ptr->addr);
#endif /* H5C_APPLY_CANDIDATE_LIST__DEBUG */
- if(H5C__flush_single_entry(f, dxpl_id, flush_ptr, H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG, NULL) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't clear entry.")
+ /* Add this entry to the list of entries to collectively write */
+ if(H5C__flush_single_entry(f, dxpl_id, flush_ptr, H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG, NULL, collective_write_list) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't clear entry.")
} /* end else-if */
} /* end if */
@@ -687,20 +714,33 @@ H5C_apply_candidate_list(H5F_t * f,
if (delayed_ptr) {
if (delayed_ptr->clear_on_unprotect) {
+ if(H5C__flush_single_entry(f, dxpl_id, delayed_ptr, H5C__FLUSH_CLEAR_ONLY_FLAG, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't flush entry.")
+
entry_ptr->clear_on_unprotect = FALSE;
entries_cleared++;
} else if (delayed_ptr->flush_immediately) {
+ /* Add this entry to the list of entries to collectively write */
+ if(H5C__flush_single_entry(f, dxpl_id, delayed_ptr, H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG, NULL, collective_write_list) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't flush entry collectively.")
+
entry_ptr->flush_immediately = FALSE;
entries_flushed++;
} /* end if */
- if(H5C__flush_single_entry(f, dxpl_id, delayed_ptr, H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG, NULL) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't flush entry collectively.")
-
entries_flushed_collectively++;
entries_flushed_or_cleared_last++;
} /* end if */
+ /* If we've deferred writing to do it collectively, take care of that now */
+ if(f->coll_md_write) {
+ HDassert(collective_write_list);
+
+ /* Write collective list */
+ if(H5C__collective_write(f, dxpl_id, collective_write_list) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_WRITEERROR, FAIL, "Can't write metadata collectively")
+ } /* end if */
+
/* ====================================================================== *
* Finished flushing everything. *
* ====================================================================== */
@@ -711,15 +751,19 @@ H5C_apply_candidate_list(H5F_t * f,
HDassert((entries_flushed_collectively == entries_to_flush_collectively));
if((entries_flushed != entries_to_flush) ||
- (entries_cleared != entries_to_clear) ||
- (entries_flushed_or_cleared_last != entries_to_flush_or_clear_last) ||
- (entries_flushed_collectively != entries_to_flush_collectively))
+ (entries_cleared != entries_to_clear) ||
+ (entries_flushed_or_cleared_last != entries_to_flush_or_clear_last) ||
+ (entries_flushed_collectively != entries_to_flush_collectively))
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "entry count mismatch.")
done:
if(candidate_assignment_table != NULL)
candidate_assignment_table = (int *)H5MM_xfree((void *)candidate_assignment_table);
+ if(collective_write_list)
+ if(H5SL_destroy(collective_write_list, H5C__collective_write_free, NULL) < 0)
+ HDONE_ERROR(H5E_CACHE, H5E_CANTFREE, FAIL, "failed to destroy skip list")
+
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C_apply_candidate_list() */
@@ -1083,6 +1127,14 @@ H5C_mark_entries_as_clean(H5F_t * f,
* scan the LRU list shortly, and clear all those entries
* not currently protected.
*/
+
+ /* Make sure first that we clear the collective flag from
+ it so it can be cleared */
+ if(TRUE == entry_ptr->coll_access) {
+ entry_ptr->coll_access = FALSE;
+ H5C__REMOVE_FROM_COLL_LIST(cache_ptr, entry_ptr, FAIL)
+ } /* end if */
+
entry_ptr->clear_on_unprotect = TRUE;
#if H5C_DO_SANITY_CHECKS
if ( entry_ptr->is_protected ) {
@@ -1143,8 +1195,8 @@ H5C_mark_entries_as_clean(H5F_t * f,
entry_ptr = entry_ptr->prev;
entries_cleared++;
- if(H5C__flush_single_entry(f, dxpl_id, clear_ptr, H5C__FLUSH_CLEAR_ONLY_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG, NULL) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't clear entry.")
+ if(H5C__flush_single_entry(f, dxpl_id, clear_ptr, H5C__FLUSH_CLEAR_ONLY_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't clear entry.")
} else {
entry_ptr = entry_ptr->prev;
@@ -1171,8 +1223,8 @@ H5C_mark_entries_as_clean(H5F_t * f,
entry_ptr = entry_ptr->next;
entries_cleared++;
- if(H5C__flush_single_entry(f, dxpl_id, clear_ptr, H5C__FLUSH_CLEAR_ONLY_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG, NULL) < 0 )
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't clear entry.")
+ if(H5C__flush_single_entry(f, dxpl_id, clear_ptr, H5C__FLUSH_CLEAR_ONLY_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG, NULL, NULL) < 0 )
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't clear entry.")
} else {
entry_ptr = entry_ptr->next;
@@ -1216,5 +1268,237 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C_mark_entries_as_clean() */
+
+
+/*-------------------------------------------------------------------------
+ *
+ * Function: H5C_clear_coll_entries
+ *
+ * Purpose: Clear half or the entire list of collective entries and
+ * mark them as independent.
+ *
+ * Return: FAIL if error is detected, SUCCEED otherwise.
+ *
+ * Programmer: Mohamad Chaarawi
+ * April, 2015
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5C_clear_coll_entries(H5C_t *cache_ptr, hbool_t partial)
+{
+ int32_t clear_cnt;
+ H5C_cache_entry_t * entry_ptr = NULL;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+ entry_ptr = cache_ptr->coll_tail_ptr;
+ clear_cnt = (partial ? cache_ptr->coll_list_len / 2 : cache_ptr->coll_list_len);
+ while(entry_ptr && clear_cnt > 0) {
+ H5C_cache_entry_t *prev_ptr = entry_ptr->coll_prev;
+
+ /* Sanity check */
+ HDassert(entry_ptr->coll_access);
+
+ /* Mark entry as independent */
+ entry_ptr->coll_access = FALSE;
+ H5C__REMOVE_FROM_COLL_LIST(cache_ptr, entry_ptr, FAIL)
+
+ /* Decrement entry count */
+ clear_cnt--;
+
+ /* Advance to next entry */
+ entry_ptr = prev_ptr;
+ } /* end while */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C_clear_coll_entries */
+
+
+/*-------------------------------------------------------------------------
+ *
+ * Function: H5C__collective_write
+ *
+ * Purpose: Perform a collective write of a list of metadata entries.
+ *
+ * Return: FAIL if error is detected, SUCCEED otherwise.
+ *
+ * Programmer: Mohamad Chaarawi
+ * February, 2016
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C__collective_write(H5F_t *f, hid_t dxpl_id, H5SL_t *collective_write_list)
+{
+ H5P_genplist_t *plist = NULL;
+ H5FD_mpio_xfer_t orig_xfer_mode = H5FD_MPIO_COLLECTIVE;
+ int count;
+ int *length_array = NULL;
+ MPI_Aint *buf_array = NULL;
+ MPI_Aint *offset_array = NULL;
+ MPI_Datatype btype;
+ hbool_t btype_created = FALSE;
+ MPI_Datatype ftype;
+ hbool_t ftype_created = FALSE;
+ int mpi_code;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ /* Get original transfer mode */
+ if(NULL == (plist = (H5P_genplist_t *)H5I_object(dxpl_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data transfer property list")
+ if(H5P_get(plist, H5D_XFER_IO_XFER_MODE_NAME, &orig_xfer_mode) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set MPI-I/O property")
+
+ /* Get number of entries in collective write list */
+ count = (int)H5SL_count(collective_write_list);
+
+ if(count > 0) {
+ H5FD_mpio_xfer_t xfer_mode = H5FD_MPIO_COLLECTIVE;
+ H5SL_node_t *node;
+ H5C_collective_write_t *item;
+ void *base_buf;
+ int i;
+
+ if(H5P_set(plist, H5D_XFER_IO_XFER_MODE_NAME, &xfer_mode) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set MPI-I/O property")
+
+ /* Allocate arrays */
+ if(NULL == (length_array = (int *)H5MM_malloc((size_t)count * sizeof(int))))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "memory allocation failed for collective write table length array")
+ if(NULL == (buf_array = (MPI_Aint *)H5MM_malloc((size_t)count * sizeof(MPI_Aint))))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "memory allocation failed for collective buf table length array")
+ if(NULL == (offset_array = (MPI_Aint *)H5MM_malloc((size_t)count * sizeof(MPI_Aint))))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "memory allocation failed for collective offset table length array")
+
+ /* Fill arrays */
+ node = H5SL_first(collective_write_list);
+ HDassert(node);
+ if(NULL == (item = (H5C_collective_write_t *)H5SL_item(node)))
+ HGOTO_ERROR(H5E_CACHE, H5E_NOTFOUND, FAIL, "can't retrieve skip list item")
+
+ /* Set up initial array position & buffer base address */
+ length_array[0] = (int)item->length;
+ base_buf = item->buf;
+ buf_array[0] = (MPI_Aint)0;
+ offset_array[0] = (MPI_Aint)item->offset;
+
+ node = H5SL_next(node);
+ i = 1;
+ while(node) {
+ if(NULL == (item = (H5C_collective_write_t *)H5SL_item(node)))
+ HGOTO_ERROR(H5E_CACHE, H5E_NOTFOUND, FAIL, "can't retrieve skip list item")
+
+ /* Set up array position */
+ length_array[i] = (int)item->length;
+ buf_array[i] = (MPI_Aint)item->buf - (MPI_Aint)base_buf;
+ offset_array[i] = (MPI_Aint)item->offset;
+
+ /* Advance to next node & array location */
+ node = H5SL_next(node);
+ i++;
+ } /* end while */
+
+ /* Create memory MPI type */
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hindexed(count, length_array, buf_array, MPI_BYTE, &btype)))
+ HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hindexed failed", mpi_code)
+ btype_created = TRUE;
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_commit(&btype)))
+ HMPI_GOTO_ERROR(FAIL, "MPI_Type_commit failed", mpi_code)
+
+ /* Create file MPI type */
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hindexed(count, length_array, offset_array, MPI_BYTE, &ftype)))
+ HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hindexed failed", mpi_code)
+ ftype_created = TRUE;
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_commit(&ftype)))
+ HMPI_GOTO_ERROR(FAIL, "MPI_Type_commit failed", mpi_code)
+
+ /* Pass buf type, file type to the file driver */
+ if(H5FD_mpi_setup_collective(dxpl_id, &btype, &ftype) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set MPI-I/O properties")
+
+ /* Write data */
+ if(H5F_block_write(f, H5FD_MEM_DEFAULT, (haddr_t)0, (size_t)1, dxpl_id, base_buf) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to write entries collectively")
+ } /* end if */
+ else {
+ MPI_Status mpi_stat;
+ MPI_File mpi_fh_p;
+ MPI_File mpi_fh;
+
+ if(H5F_get_mpi_handle(f, (MPI_File **)&mpi_fh_p) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get mpi file handle")
+ mpi_fh = *(MPI_File*)mpi_fh_p;
+
+ /* just to match up with the 1st MPI_File_set_view from H5FD_mpio_write() */
+ if(MPI_SUCCESS != (mpi_code = MPI_File_set_view(mpi_fh, (MPI_Offset)0, MPI_BYTE, MPI_BYTE, "native", MPI_INFO_NULL)))
+ HMPI_GOTO_ERROR(FAIL, "MPI_File_set_view failed", mpi_code)
+
+ /* just to match up with MPI_File_write_at_all from H5FD_mpio_write() */
+ HDmemset(&mpi_stat, 0, sizeof(MPI_Status));
+ if(MPI_SUCCESS != (mpi_code = MPI_File_write_at_all(mpi_fh, (MPI_Offset)0, NULL, 0, MPI_BYTE, &mpi_stat)))
+ HMPI_GOTO_ERROR(FAIL, "MPI_File_write_at_all failed", mpi_code)
+
+ /* just to match up with the 2nd MPI_File_set_view (reset) in H5FD_mpio_write() */
+ if(MPI_SUCCESS != (mpi_code = MPI_File_set_view(mpi_fh, (MPI_Offset)0, MPI_BYTE, MPI_BYTE, "native", MPI_INFO_NULL)))
+ HMPI_GOTO_ERROR(FAIL, "MPI_File_set_view failed", mpi_code)
+ } /* end else */
+
+done:
+ /* Free arrays */
+ length_array = (int *)H5MM_xfree(length_array);
+ buf_array = (MPI_Aint *)H5MM_xfree(buf_array);
+ offset_array = (MPI_Aint *)H5MM_xfree(offset_array);
+
+ /* Free MPI Types */
+ if(btype_created && MPI_SUCCESS != (mpi_code = MPI_Type_free(&btype)))
+ HMPI_DONE_ERROR(FAIL, "MPI_Type_free failed", mpi_code)
+ if(ftype_created && MPI_SUCCESS != (mpi_code = MPI_Type_free(&ftype)))
+ HMPI_DONE_ERROR(FAIL, "MPI_Type_free failed", mpi_code)
+
+ /* Reset dxpl */
+ if(orig_xfer_mode != H5FD_MPIO_COLLECTIVE) {
+ HDassert(plist);
+ if(H5P_set(plist, H5D_XFER_IO_XFER_MODE_NAME, &orig_xfer_mode) < 0)
+ HDONE_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set MPI-I/O property")
+ } /* end if */
+
+ FUNC_LEAVE_NOAPI(ret_value);
+} /* end H5C__collective_write() */
+
+
+/*-------------------------------------------------------------------------
+ *
+ * Function: H5C__collective_write_free
+ *
+ * Purpose: Release node on collective write skiplist
+ *
+ * Return: FAIL if error is detected, SUCCEED otherwise.
+ *
+ * Programmer: Mohamad Chaarawi
+ * February, 2016
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C__collective_write_free(void *_item, void H5_ATTR_UNUSED *key, void H5_ATTR_UNUSED *op_data)
+{
+ H5C_collective_write_t *item = (H5C_collective_write_t *)_item;
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Sanity check */
+ HDassert(item);
+
+ if(item->free_buf)
+ item->buf = H5MM_xfree(item->buf);
+ H5FL_FREE(H5C_collective_write_t, item);
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5C__collective_write_free() */
#endif /* H5_HAVE_PARALLEL */
diff --git a/src/H5Cpkg.h b/src/H5Cpkg.h
index 9508b98..08be52b 100644
--- a/src/H5Cpkg.h
+++ b/src/H5Cpkg.h
@@ -2542,7 +2542,16 @@ if ( ( (cache_ptr)->index_size != \
HDassert( ((entry_ptr)->ro_ref_count) == 0 ); \
HDassert( (entry_ptr)->size > 0 ); \
HDassert( new_size > 0 ); \
- \
+ \
+ if ( (entry_ptr)->coll_access ) { \
+ \
+ H5C__DLL_UPDATE_FOR_SIZE_CHANGE((cache_ptr)->coll_list_len, \
+ (cache_ptr)->coll_list_size, \
+ (entry_ptr)->size, \
+ (new_size)); \
+ \
+ } \
+ \
if ( (entry_ptr)->is_pinned ) { \
\
H5C__DLL_UPDATE_FOR_SIZE_CHANGE((cache_ptr)->pel_len, \
@@ -2892,6 +2901,247 @@ if ( ( (cache_ptr)->index_size != \
#endif /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */
+#ifdef H5_HAVE_PARALLEL
+
+#if H5C_DO_SANITY_CHECKS
+
+#define H5C__COLL_DLL_PRE_REMOVE_SC(entry_ptr, hd_ptr, tail_ptr, len, Size, fv) \
+if ( ( (hd_ptr) == NULL ) || \
+ ( (tail_ptr) == NULL ) || \
+ ( (entry_ptr) == NULL ) || \
+ ( (len) <= 0 ) || \
+ ( (Size) < (entry_ptr)->size ) || \
+ ( ( (Size) == (entry_ptr)->size ) && ( ! ( (len) == 1 ) ) ) || \
+ ( ( (entry_ptr)->coll_prev == NULL ) && ( (hd_ptr) != (entry_ptr) ) ) || \
+ ( ( (entry_ptr)->coll_next == NULL ) && ( (tail_ptr) != (entry_ptr) ) ) || \
+ ( ( (len) == 1 ) && \
+ ( ! ( ( (hd_ptr) == (entry_ptr) ) && ( (tail_ptr) == (entry_ptr) ) && \
+ ( (entry_ptr)->coll_next == NULL ) && \
+ ( (entry_ptr)->coll_prev == NULL ) && \
+ ( (Size) == (entry_ptr)->size ) \
+ ) \
+ ) \
+ ) \
+ ) { \
+ HDassert(0 && "coll DLL pre remove SC failed"); \
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, (fv), "coll DLL pre remove SC failed") \
+}
+
+#define H5C__COLL_DLL_SC(head_ptr, tail_ptr, len, Size, fv) \
+if ( ( ( ( (head_ptr) == NULL ) || ( (tail_ptr) == NULL ) ) && \
+ ( (head_ptr) != (tail_ptr) ) \
+ ) || \
+ ( (len) < 0 ) || \
+ ( (Size) < 0 ) || \
+ ( ( (len) == 1 ) && \
+ ( ( (head_ptr) != (tail_ptr) ) || ( (Size) <= 0 ) || \
+ ( (head_ptr) == NULL ) || ( (head_ptr)->size != (Size) ) \
+ ) \
+ ) || \
+ ( ( (len) >= 1 ) && \
+ ( ( (head_ptr) == NULL ) || ( (head_ptr)->coll_prev != NULL ) || \
+ ( (tail_ptr) == NULL ) || ( (tail_ptr)->coll_next != NULL ) \
+ ) \
+ ) \
+ ) { \
+ HDassert(0 && "COLL DLL sanity check failed"); \
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, (fv), "COLL DLL sanity check failed") \
+}
+
+#define H5C__COLL_DLL_PRE_INSERT_SC(entry_ptr, hd_ptr, tail_ptr, len, Size, fv) \
+if ( ( (entry_ptr) == NULL ) || \
+ ( (entry_ptr)->coll_next != NULL ) || \
+ ( (entry_ptr)->coll_prev != NULL ) || \
+ ( ( ( (hd_ptr) == NULL ) || ( (tail_ptr) == NULL ) ) && \
+ ( (hd_ptr) != (tail_ptr) ) \
+ ) || \
+ ( (len) < 0 ) || \
+ ( ( (len) == 1 ) && \
+ ( ( (hd_ptr) != (tail_ptr) ) || ( (Size) <= 0 ) || \
+ ( (hd_ptr) == NULL ) || ( (hd_ptr)->size != (Size) ) \
+ ) \
+ ) || \
+ ( ( (len) >= 1 ) && \
+ ( ( (hd_ptr) == NULL ) || ( (hd_ptr)->coll_prev != NULL ) || \
+ ( (tail_ptr) == NULL ) || ( (tail_ptr)->coll_next != NULL ) \
+ ) \
+ ) \
+ ) { \
+ HDassert(0 && "COLL DLL pre insert SC failed"); \
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, (fv), "COLL DLL pre insert SC failed") \
+}
+
+#else /* H5C_DO_SANITY_CHECKS */
+
+#define H5C__COLL_DLL_PRE_REMOVE_SC(entry_ptr, hd_ptr, tail_ptr, len, Size, fv)
+#define H5C__COLL_DLL_SC(head_ptr, tail_ptr, len, Size, fv)
+#define H5C__COLL_DLL_PRE_INSERT_SC(entry_ptr, hd_ptr, tail_ptr, len, Size, fv)
+
+#endif /* H5C_DO_SANITY_CHECKS */
+
+
+#define H5C__COLL_DLL_APPEND(entry_ptr, head_ptr, tail_ptr, len, Size, fail_val) \
+{ \
+ H5C__COLL_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)->coll_next = (entry_ptr); \
+ (entry_ptr)->coll_prev = (tail_ptr); \
+ (tail_ptr) = (entry_ptr); \
+ } \
+ (len)++; \
+ (Size) += entry_ptr->size; \
+} /* H5C__COLL_DLL_APPEND() */
+
+#define H5C__COLL_DLL_PREPEND(entry_ptr, head_ptr, tail_ptr, len, Size, fv) \
+{ \
+ H5C__COLL_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)->coll_prev = (entry_ptr); \
+ (entry_ptr)->coll_next = (head_ptr); \
+ (head_ptr) = (entry_ptr); \
+ } \
+ (len)++; \
+ (Size) += entry_ptr->size; \
+} /* H5C__COLL_DLL_PREPEND() */
+
+#define H5C__COLL_DLL_REMOVE(entry_ptr, head_ptr, tail_ptr, len, Size, fv) \
+{ \
+ H5C__COLL_DLL_PRE_REMOVE_SC(entry_ptr, head_ptr, tail_ptr, len, Size, fv)\
+ { \
+ if ( (head_ptr) == (entry_ptr) ) \
+ { \
+ (head_ptr) = (entry_ptr)->coll_next; \
+ if ( (head_ptr) != NULL ) \
+ (head_ptr)->coll_prev = NULL; \
+ } \
+ else \
+ { \
+ (entry_ptr)->coll_prev->coll_next = (entry_ptr)->coll_next; \
+ } \
+ if ( (tail_ptr) == (entry_ptr) ) \
+ { \
+ (tail_ptr) = (entry_ptr)->coll_prev; \
+ if ( (tail_ptr) != NULL ) \
+ (tail_ptr)->coll_next = NULL; \
+ } \
+ else \
+ (entry_ptr)->coll_next->coll_prev = (entry_ptr)->coll_prev; \
+ entry_ptr->coll_next = NULL; \
+ entry_ptr->coll_prev = NULL; \
+ (len)--; \
+ (Size) -= entry_ptr->size; \
+ } \
+} /* H5C__COLL_DLL_REMOVE() */
+
+
+/*-------------------------------------------------------------------------
+ *
+ * Macro: H5C__INSERT_IN_COLL_LIST
+ *
+ * Purpose: Insert entry into collective entries list
+ *
+ * Return: N/A
+ *
+ * Programmer: Mohamad Chaarawi
+ *
+ *-------------------------------------------------------------------------
+ */
+
+#define H5C__INSERT_IN_COLL_LIST(cache_ptr, entry_ptr, fail_val) \
+{ \
+ HDassert( (cache_ptr) ); \
+ HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \
+ HDassert( (entry_ptr) ); \
+ \
+ /* insert the entry at the head of the list. */ \
+ \
+ H5C__COLL_DLL_PREPEND((entry_ptr), (cache_ptr)->coll_head_ptr, \
+ (cache_ptr)->coll_tail_ptr, \
+ (cache_ptr)->coll_list_len, \
+ (cache_ptr)->coll_list_size, \
+ (fail_val)) \
+ \
+} /* H5C__INSERT_IN_COLL_LIST */
+
+
+/*-------------------------------------------------------------------------
+ *
+ * Macro: H5C__REMOVE_FROM_COLL_LIST
+ *
+ * Purpose: Remove entry from collective entries list
+ *
+ * Return: N/A
+ *
+ * Programmer: Mohamad Chaarawi
+ *
+ *-------------------------------------------------------------------------
+ */
+
+#define H5C__REMOVE_FROM_COLL_LIST(cache_ptr, entry_ptr, fail_val) \
+{ \
+ HDassert( (cache_ptr) ); \
+ HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \
+ HDassert( (entry_ptr) ); \
+ \
+ /* remove the entry from the list. */ \
+ \
+ H5C__COLL_DLL_REMOVE((entry_ptr), (cache_ptr)->coll_head_ptr, \
+ (cache_ptr)->coll_tail_ptr, \
+ (cache_ptr)->coll_list_len, \
+ (cache_ptr)->coll_list_size, \
+ (fail_val)) \
+ \
+} /* H5C__REMOVE_FROM_COLL_LIST */
+
+
+/*-------------------------------------------------------------------------
+ *
+ * Macro: H5C__MOVE_TO_TOP_IN_COLL_LIST
+ *
+ * Purpose: Update entry position in collective entries list
+ *
+ * Return: N/A
+ *
+ * Programmer: Mohamad Chaarawi
+ *
+ *-------------------------------------------------------------------------
+ */
+
+#define H5C__MOVE_TO_TOP_IN_COLL_LIST(cache_ptr, entry_ptr, fail_val) \
+{ \
+ HDassert( (cache_ptr) ); \
+ HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \
+ HDassert( (entry_ptr) ); \
+ \
+ /* Remove entry and insert at the head of the list. */ \
+ H5C__COLL_DLL_REMOVE((entry_ptr), (cache_ptr)->coll_head_ptr, \
+ (cache_ptr)->coll_tail_ptr, \
+ (cache_ptr)->coll_list_len, \
+ (cache_ptr)->coll_list_size, \
+ (fail_val)) \
+ \
+ H5C__COLL_DLL_PREPEND((entry_ptr), (cache_ptr)->coll_head_ptr, \
+ (cache_ptr)->coll_tail_ptr, \
+ (cache_ptr)->coll_list_len, \
+ (cache_ptr)->coll_list_size, \
+ (fail_val)) \
+ \
+} /* H5C__MOVE_TO_TOP_IN_COLL_LIST */
+#endif /* H5_HAVE_PARALLEL */
+
/****************************/
/* Package Private Typedefs */
@@ -3885,6 +4135,13 @@ struct H5C_t {
H5C_cache_entry_t * dLRU_head_ptr;
H5C_cache_entry_t * dLRU_tail_ptr;
+#ifdef H5_HAVE_PARALLEL
+ int32_t coll_list_len;
+ size_t coll_list_size;
+ H5C_cache_entry_t * coll_head_ptr;
+ H5C_cache_entry_t * coll_tail_ptr;
+#endif /* H5_HAVE_PARALLEL */
+
/* Fields for automatic cache size adjustment */
hbool_t size_increase_possible;
hbool_t flash_size_increase_possible;
@@ -3988,6 +4245,16 @@ struct H5C_t {
#endif /* NDEBUG */
};
+#ifdef H5_HAVE_PARALLEL
+typedef struct H5C_collective_write_t {
+ size_t length;
+ hbool_t free_buf;
+ void *buf;
+ haddr_t offset;
+} H5C_collective_write_t;
+#endif /* H5_HAVE_PARALLEL */
+
+
/*****************************/
/* Package Private Variables */
/*****************************/
@@ -3997,7 +4264,7 @@ struct H5C_t {
/* Package Private Prototypes */
/******************************/
H5_DLL herr_t H5C__flush_single_entry(const H5F_t *f, hid_t dxpl_id,
- H5C_cache_entry_t *entry_ptr, unsigned flags, int64_t *entry_size_change_ptr);
+ H5C_cache_entry_t *entry_ptr, unsigned flags, int64_t *entry_size_change_ptr, H5SL_t *collective_write_list);
#endif /* _H5Cpkg_H */
diff --git a/src/H5Cprivate.h b/src/H5Cprivate.h
index 4c65bb4..a062214 100644
--- a/src/H5Cprivate.h
+++ b/src/H5Cprivate.h
@@ -41,8 +41,8 @@
/**************************/
/* Cache configuration settings */
-#define H5C__MAX_NUM_TYPE_IDS 28
-#define H5C__PREFIX_LEN 32
+#define H5C__MAX_NUM_TYPE_IDS 28
+#define H5C__PREFIX_LEN 32
/* This sanity checking constant was picked out of the air. Increase
* or decrease it if appropriate. Its purposes is to detect corrupt
@@ -1383,13 +1383,10 @@ typedef int H5C_ring_t;
* flushed from the cache until all other entries without
* the flush_me_last flag set have been flushed.
*
- * flush_me_collectively: Boolean flag indicating that this entry needs
- * to be flushed collectively when in a parallel situation.
- *
* Note:
*
- * At this time, the flush_me_last and flush_me_collectively
- * flags will only be applied to one entry, the superblock,
+ * At this time, the flush_me_last
+ * flag will only be applied to one entry, the superblock,
* and the code utilizing these flags is protected with HDasserts
* to enforce this. This restraint can certainly be relaxed in
* the future if the the need for multiple entries getting flushed
@@ -1609,9 +1606,9 @@ typedef struct H5C_cache_entry_t {
hbool_t flush_marker;
hbool_t flush_me_last;
#ifdef H5_HAVE_PARALLEL
- hbool_t flush_me_collectively;
hbool_t clear_on_unprotect;
hbool_t flush_immediately;
+ hbool_t coll_access;
#endif /* H5_HAVE_PARALLEL */
hbool_t flush_in_progress;
hbool_t destroy_in_progress;
@@ -1635,6 +1632,10 @@ typedef struct H5C_cache_entry_t {
struct H5C_cache_entry_t * prev;
struct H5C_cache_entry_t * aux_next;
struct H5C_cache_entry_t * aux_prev;
+#ifdef H5_HAVE_PARALLEL
+ struct H5C_cache_entry_t * coll_next;
+ struct H5C_cache_entry_t * coll_prev;
+#endif /* H5_HAVE_PARALLEL */
#if H5C_COLLECT_CACHE_ENTRY_STATS
/* cache entry stats fields */
@@ -2000,6 +2001,7 @@ H5_DLL herr_t H5C_apply_candidate_list(H5F_t *f, hid_t dxpl_id,
int mpi_rank, int mpi_size);
H5_DLL herr_t H5C_construct_candidate_list__clean_cache(H5C_t *cache_ptr);
H5_DLL herr_t H5C_construct_candidate_list__min_clean(H5C_t *cache_ptr);
+H5_DLL herr_t H5C_clear_coll_entries(H5C_t * cache_ptr, hbool_t partial);
H5_DLL herr_t H5C_mark_entries_as_clean(H5F_t *f, hid_t dxpl_id, int32_t ce_array_len,
haddr_t *ce_array_ptr);
#endif /* H5_HAVE_PARALLEL */
diff --git a/src/H5D.c b/src/H5D.c
index e3f07a8..0e45bc6 100644
--- a/src/H5D.c
+++ b/src/H5D.c
@@ -107,6 +107,7 @@ H5Dcreate2(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id,
H5VL_object_t *obj = NULL; /* object token of loc_id */
H5VL_loc_params_t loc_params;
H5P_genplist_t *plist = NULL; /* Property list pointer */
+ hid_t dxpl_id = H5AC_ind_read_dxpl_id; /* dxpl used by library */
hid_t ret_value = FAIL; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -130,12 +131,9 @@ H5Dcreate2(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id,
if(TRUE != H5P_isa_class(dcpl_id, H5P_DATASET_CREATE))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not dataset create property list ID")
- /* Get correct property list */
- if(H5P_DEFAULT == dapl_id)
- dapl_id = H5P_DATASET_ACCESS_DEFAULT;
- else
- if(TRUE != H5P_isa_class(dapl_id, H5P_DATASET_ACCESS))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not dataset access property list")
+ /* Verify access property list and get correct dxpl */
+ if(H5P_verify_apl_and_dxpl(&dapl_id, H5P_CLS_DACC, &dxpl_id, loc_id, TRUE) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set access and transfer property lists")
/* Get the plist structure */
if(NULL == (plist = (H5P_genplist_t *)H5I_object(dcpl_id)))
@@ -158,7 +156,7 @@ H5Dcreate2(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id,
/* Create the dataset through the VOL */
if(NULL == (dset = H5VL_dataset_create(obj->vol_obj, loc_params, obj->vol_info->vol_cls,
- name, dcpl_id, dapl_id, H5AC_dxpl_id, H5_REQUEST_NULL)))
+ name, dcpl_id, dapl_id, dxpl_id, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create dataset")
/* Get an atom for the dataset */
@@ -167,7 +165,7 @@ H5Dcreate2(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id,
done:
if (ret_value < 0 && dset)
- if(H5VL_dataset_close (dset, obj->vol_info->vol_cls, H5AC_dxpl_id, H5_REQUEST_NULL) < 0)
+ if(H5VL_dataset_close (dset, obj->vol_info->vol_cls, dxpl_id, H5_REQUEST_NULL) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataset")
FUNC_LEAVE_API(ret_value)
} /* end H5Dcreate2() */
@@ -216,6 +214,7 @@ H5Dcreate_anon(hid_t loc_id, hid_t type_id, hid_t space_id, hid_t dcpl_id,
H5VL_object_t *obj = NULL; /* object token of loc_id */
H5VL_loc_params_t loc_params;
H5P_genplist_t *plist; /* Property list pointer */
+ hid_t dxpl_id = H5AC_ind_read_dxpl_id; /* dxpl used by library */
hid_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -228,12 +227,9 @@ H5Dcreate_anon(hid_t loc_id, hid_t type_id, hid_t space_id, hid_t dcpl_id,
if(TRUE != H5P_isa_class(dcpl_id, H5P_DATASET_CREATE))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not dataset create property list ID")
- /* Get correct property list */
- if(H5P_DEFAULT == dapl_id)
- dapl_id = H5P_DATASET_ACCESS_DEFAULT;
- else
- if(TRUE != H5P_isa_class(dapl_id, H5P_DATASET_ACCESS))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not dataset access property list")
+ /* Verify access property list and get correct dxpl */
+ if(H5P_verify_apl_and_dxpl(&dapl_id, H5P_CLS_DACC, &dxpl_id, loc_id, TRUE) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set access and transfer property lists")
/* get the location object */
if(NULL == (obj = (H5VL_object_t *)H5I_object(loc_id)))
@@ -255,7 +251,7 @@ H5Dcreate_anon(hid_t loc_id, hid_t type_id, hid_t space_id, hid_t dcpl_id,
/* Create the dataset through the VOL */
if(NULL == (dset = H5VL_dataset_create(obj->vol_obj, loc_params, obj->vol_info->vol_cls,
NULL, dcpl_id, dapl_id,
- H5AC_dxpl_id, H5_REQUEST_NULL)))
+ dxpl_id, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create dataset")
/* Get an atom for the dataset */
@@ -264,7 +260,7 @@ H5Dcreate_anon(hid_t loc_id, hid_t type_id, hid_t space_id, hid_t dcpl_id,
done:
if (ret_value < 0 && dset)
- if(H5VL_dataset_close (dset, obj->vol_info->vol_cls, H5AC_dxpl_id, H5_REQUEST_NULL) < 0)
+ if(H5VL_dataset_close (dset, obj->vol_info->vol_cls, dxpl_id, H5_REQUEST_NULL) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataset")
FUNC_LEAVE_API(ret_value)
} /* end H5Dcreate_anon() */
@@ -293,7 +289,7 @@ H5Dopen2(hid_t loc_id, const char *name, hid_t dapl_id)
void *dset = NULL; /* dset token from VOL plugin */
H5VL_object_t *obj = NULL; /* object token of loc_id */
H5VL_loc_params_t loc_params;
- hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl to use to open datset */
+ hid_t dxpl_id = H5AC_ind_read_dxpl_id; /* dxpl used by library */
hid_t ret_value;
FUNC_ENTER_API(FAIL)
@@ -303,12 +299,9 @@ H5Dopen2(hid_t loc_id, const char *name, hid_t dapl_id)
if(!name || !*name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name")
- /* Get correct property list */
- if(H5P_DEFAULT == dapl_id)
- dapl_id = H5P_DATASET_ACCESS_DEFAULT;
- else
- if(TRUE != H5P_isa_class(dapl_id, H5P_DATASET_ACCESS))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not dataset access property list")
+ /* Verify access property list and get correct dxpl */
+ if(H5P_verify_apl_and_dxpl(&dapl_id, H5P_CLS_DACC, &dxpl_id, loc_id, FALSE) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set access and transfer property lists")
loc_params.type = H5VL_OBJECT_BY_SELF;
loc_params.obj_type = H5I_get_type(loc_id);
@@ -402,8 +395,8 @@ H5Dget_space(hid_t dset_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset identifier")
/* get the dataspace through the VOL */
- if(H5VL_dataset_get(dset->vol_obj, dset->vol_info->vol_cls, H5VL_DATASET_GET_SPACE, H5AC_dxpl_id,
- H5_REQUEST_NULL, &ret_value) < 0)
+ if(H5VL_dataset_get(dset->vol_obj, dset->vol_info->vol_cls, H5VL_DATASET_GET_SPACE,
+ H5AC_ind_read_dxpl_id, H5_REQUEST_NULL, &ret_value) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get data space")
done:
@@ -440,7 +433,7 @@ H5Dget_space_status(hid_t dset_id, H5D_space_status_t *allocation)
/* Read data space address through the VOL and return */
if((ret_value = H5VL_dataset_get(dset->vol_obj, dset->vol_info->vol_cls, H5VL_DATASET_GET_SPACE_STATUS,
- H5AC_ind_dxpl_id, H5_REQUEST_NULL, allocation)) < 0)
+ H5AC_ind_read_dxpl_id, H5_REQUEST_NULL, allocation)) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get space status")
done:
@@ -479,7 +472,7 @@ H5Dget_type(hid_t dset_id)
/* get the datatype through the VOL */
if(H5VL_dataset_get(dset->vol_obj, dset->vol_info->vol_cls, H5VL_DATASET_GET_TYPE,
- H5AC_dxpl_id, H5_REQUEST_NULL, &ret_value) < 0)
+ H5AC_ind_read_dxpl_id, H5_REQUEST_NULL, &ret_value) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get datatype")
done:
@@ -516,8 +509,8 @@ H5Dget_create_plist(hid_t dset_id)
if(NULL == (dset = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset identifier")
- if(H5VL_dataset_get(dset->vol_obj, dset->vol_info->vol_cls, H5VL_DATASET_GET_DCPL, H5AC_dxpl_id,
- H5_REQUEST_NULL, &ret_value) < 0)
+ if(H5VL_dataset_get(dset->vol_obj, dset->vol_info->vol_cls, H5VL_DATASET_GET_DCPL,
+ H5AC_ind_read_dxpl_id, H5_REQUEST_NULL, &ret_value) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get dataset creation properties")
done:
@@ -572,7 +565,7 @@ H5Dget_access_plist(hid_t dset_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset identifier")
if(H5VL_dataset_get(dset->vol_obj, dset->vol_info->vol_cls, H5VL_DATASET_GET_DAPL,
- H5AC_dxpl_id, H5_REQUEST_NULL, &ret_value) < 0)
+ H5AC_ind_read_dxpl_id, H5_REQUEST_NULL, &ret_value) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get dataset access properties")
done:
@@ -613,7 +606,7 @@ H5Dget_storage_size(hid_t dset_id)
/* get storage size through the VOL */
if(H5VL_dataset_get(dset->vol_obj, dset->vol_info->vol_cls, H5VL_DATASET_GET_STORAGE_SIZE,
- H5AC_ind_dxpl_id, H5_REQUEST_NULL, &ret_value) < 0)
+ H5AC_ind_read_dxpl_id, H5_REQUEST_NULL, &ret_value) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, 0, "unable to get storage size")
done:
@@ -650,7 +643,7 @@ H5Dget_offset(hid_t dset_id)
/* get offset through the VOL */
if(H5VL_dataset_get(dset->vol_obj, dset->vol_info->vol_cls, H5VL_DATASET_GET_OFFSET,
- H5AC_dxpl_id, H5_REQUEST_NULL, &ret_value) < 0)
+ H5AC_ind_read_dxpl_id, H5_REQUEST_NULL, &ret_value) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, HADDR_UNDEF, "unable to get offset")
done:
@@ -863,8 +856,8 @@ H5Dvlen_get_buf_size(hid_t dataset_id, hid_t type_id, hid_t space_id,
vlen_bufsize.mspace_id = FAIL;
/* Get a copy of the dataspace ID */
- if(H5VL_dataset_get(dset->vol_obj, dset->vol_info->vol_cls, H5VL_DATASET_GET_SPACE, H5AC_dxpl_id,
- H5_REQUEST_NULL, &vlen_bufsize.fspace_id) < 0)
+ if(H5VL_dataset_get(dset->vol_obj, dset->vol_info->vol_cls, H5VL_DATASET_GET_SPACE,
+ H5AC_ind_read_dxpl_id, H5_REQUEST_NULL, &vlen_bufsize.fspace_id) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "can't copy dataspace")
/* Create a scalar for the memory dataspace */
@@ -958,7 +951,7 @@ H5Dset_extent(hid_t dset_id, const hsize_t size[])
/* set the extent through the VOL */
if((ret_value = H5VL_dataset_specific(dset->vol_obj, dset->vol_info->vol_cls, H5VL_DATASET_SET_EXTENT,
- H5AC_dxpl_id, H5_REQUEST_NULL, size)) < 0)
+ H5AC_ind_read_dxpl_id, H5_REQUEST_NULL, size)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to set extent of dataset")
done:
@@ -990,7 +983,7 @@ H5D_close_dataset(void *_dset)
/* Close the dataset through the VOL */
if((ret_value = H5VL_dataset_close(dset->vol_obj, dset->vol_info->vol_cls,
- H5AC_dxpl_id, H5_REQUEST_NULL)) < 0)
+ H5AC_ind_read_dxpl_id, H5_REQUEST_NULL)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to close dataset")
done:
diff --git a/src/H5Dbtree2.c b/src/H5Dbtree2.c
new file mode 100644
index 0000000..9de609f
--- /dev/null
+++ b/src/H5Dbtree2.c
@@ -0,0 +1,1491 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the files COPYING and Copyright.html. COPYING can be found at the root *
+ * of the source code distribution tree; Copyright.html can be found at the *
+ * root level of an installed copy of the electronic HDF5 document set and *
+ * is linked from the top-level documents page. It can also be found at *
+ * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
+ * access to either file, you may request a copy from help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ *
+ * Purpose: v2 B-tree indexing for chunked datasets with > 1 unlimited dimensions.
+ * Each dataset chunk in the b-tree is identified by its dimensional offset.
+ *
+ */
+
+/****************/
+/* Module Setup */
+/****************/
+
+#include "H5Dmodule.h" /* This source code file is part of the H5D module */
+
+
+/***********/
+/* Headers */
+/***********/
+#include "H5private.h" /* Generic Functions */
+#include "H5Dpkg.h" /* Datasets */
+#include "H5FLprivate.h" /* Free Lists */
+#include "H5MFprivate.h" /* File space management */
+#include "H5VMprivate.h" /* Vector and array functions */
+
+
+/****************/
+/* Local Macros */
+/****************/
+
+
+/******************/
+/* Local Typedefs */
+/******************/
+/* User data for creating callback context */
+typedef struct H5D_bt2_ctx_ud_t {
+ const H5F_t *f; /* Pointer to file info */
+ uint32_t chunk_size; /* Size of chunk (bytes; for filtered object) */
+ unsigned ndims; /* Number of dimensions */
+ uint32_t *dim; /* Size of chunk in elements */
+} H5D_bt2_ctx_ud_t;
+
+/* The callback context */
+typedef struct H5D_bt2_ctx_t {
+ uint32_t chunk_size; /* Size of chunk (bytes; constant for unfiltered object) */
+ size_t sizeof_addr; /* Size of file addresses in the file (bytes) */
+ size_t chunk_size_len; /* Size of chunk sizes in the file (bytes) */
+ unsigned ndims; /* Number of dimensions in chunk */
+ uint32_t *dim; /* Size of chunk in elements */
+} H5D_bt2_ctx_t;
+
+/* User data for the chunk's removal callback routine */
+typedef struct H5D_bt2_remove_ud_t {
+ H5F_t *f; /* File pointer for operation */
+ hid_t dxpl_id; /* DXPL ID for operation */
+} H5D_bt2_remove_ud_t;
+
+/* Callback info for iteration over chunks in v2 B-tree */
+typedef struct H5D_bt2_it_ud_t {
+ H5D_chunk_cb_func_t cb; /* Callback routine for the chunk */
+ void *udata; /* User data for the chunk's callback routine */
+} H5D_bt2_it_ud_t;
+
+/* User data for compare callback */
+typedef struct H5D_bt2_ud_t {
+ H5D_chunk_rec_t rec; /* The record to search for */
+ unsigned ndims; /* Number of dimensions for the chunked dataset */
+} H5D_bt2_ud_t;
+
+
+/********************/
+/* Local Prototypes */
+/********************/
+
+/* Shared v2 B-tree methods for indexing filtered and non-filtered chunked datasets */
+static void *H5D__bt2_crt_context(void *udata);
+static herr_t H5D__bt2_dst_context(void *ctx);
+static herr_t H5D__bt2_store(void *native, const void *udata);
+static herr_t H5D__bt2_compare(const void *rec1, const void *rec2, int *result);
+
+/* v2 B-tree class for indexing non-filtered chunked datasets */
+static herr_t H5D__bt2_unfilt_encode(uint8_t *raw, const void *native, void *ctx);
+static herr_t H5D__bt2_unfilt_decode(const uint8_t *raw, void *native, void *ctx);
+static herr_t H5D__bt2_unfilt_debug(FILE *stream, int indent, int fwidth,
+ const void *record, const void *u_ctx);
+
+/* v2 B-tree class for indexing filtered chunked datasets */
+static herr_t H5D__bt2_filt_encode(uint8_t *raw, const void *native, void *ctx);
+static herr_t H5D__bt2_filt_decode(const uint8_t *raw, void *native, void *ctx);
+static herr_t H5D__bt2_filt_debug(FILE *stream, int indent, int fwidth,
+ const void *record, const void *u_ctx);
+
+/* Helper routine */
+static herr_t H5D__bt2_idx_open(const H5D_chk_idx_info_t *idx_info);
+
+/* Callback for H5B2_iterate() which is called in H5D__bt2_idx_iterate() */
+static int H5D__bt2_idx_iterate_cb(const void *_record, void *_udata);
+
+/* Callback for H5B2_find() which is called in H5D__bt2_idx_get_addr() */
+static herr_t H5D__bt2_found_cb(const void *nrecord, void *op_data);
+
+/*
+ * Callback for H5B2_remove() and H5B2_delete() which is called
+ * in H5D__bt2_idx_remove() and H5D__bt2_idx_delete().
+ */
+static herr_t H5D__bt2_remove_cb(const void *nrecord, void *_udata);
+
+/* Callback for H5B2_modify() which is called in H5D__bt2_idx_insert() */
+static herr_t H5D__bt2_mod_cb(void *_record, void *_op_data, hbool_t *changed);
+
+/* Chunked layout indexing callbacks for v2 B-tree indexing */
+static herr_t H5D__bt2_idx_init(const H5D_chk_idx_info_t *idx_info,
+ const H5S_t *space, haddr_t dset_ohdr_addr);
+static herr_t H5D__bt2_idx_create(const H5D_chk_idx_info_t *idx_info);
+static hbool_t H5D__bt2_idx_is_space_alloc(const H5O_storage_chunk_t *storage);
+static herr_t H5D__bt2_idx_insert(const H5D_chk_idx_info_t *idx_info,
+ H5D_chunk_ud_t *udata, const H5D_t *dset);
+static herr_t H5D__bt2_idx_get_addr(const H5D_chk_idx_info_t *idx_info,
+ H5D_chunk_ud_t *udata);
+static int H5D__bt2_idx_iterate(const H5D_chk_idx_info_t *idx_info,
+ H5D_chunk_cb_func_t chunk_cb, void *chunk_udata);
+static herr_t H5D__bt2_idx_remove(const H5D_chk_idx_info_t *idx_info,
+ H5D_chunk_common_ud_t *udata);
+static herr_t H5D__bt2_idx_delete(const H5D_chk_idx_info_t *idx_info);
+static herr_t H5D__bt2_idx_copy_setup(const H5D_chk_idx_info_t *idx_info_src,
+ const H5D_chk_idx_info_t *idx_info_dst);
+static herr_t H5D__bt2_idx_copy_shutdown(H5O_storage_chunk_t *storage_src,
+ H5O_storage_chunk_t *storage_dst, hid_t dxpl_id);
+static herr_t H5D__bt2_idx_size(const H5D_chk_idx_info_t *idx_info, hsize_t *size);
+static herr_t H5D__bt2_idx_reset(H5O_storage_chunk_t *storage, hbool_t reset_addr);
+static herr_t H5D__bt2_idx_dump(const H5O_storage_chunk_t *storage,
+ FILE *stream);
+static herr_t H5D__bt2_idx_dest(const H5D_chk_idx_info_t *idx_info);
+
+
+/*********************/
+/* Package Variables */
+/*********************/
+
+/* Chunked dataset I/O ops for v2 B-tree indexing */
+const H5D_chunk_ops_t H5D_COPS_BT2[1] = {{
+ H5D__bt2_idx_init, /* init */
+ H5D__bt2_idx_create, /* create */
+ H5D__bt2_idx_is_space_alloc, /* is_space_alloc */
+ H5D__bt2_idx_insert, /* insert */
+ H5D__bt2_idx_get_addr, /* get_addr */
+ NULL, /* resize */
+ H5D__bt2_idx_iterate, /* iterate */
+ H5D__bt2_idx_remove, /* remove */
+ H5D__bt2_idx_delete, /* delete */
+ H5D__bt2_idx_copy_setup, /* copy_setup */
+ H5D__bt2_idx_copy_shutdown, /* copy_shutdown */
+ H5D__bt2_idx_size, /* size */
+ H5D__bt2_idx_reset, /* reset */
+ H5D__bt2_idx_dump, /* dump */
+ H5D__bt2_idx_dest /* destroy */
+}};
+
+
+/*****************************/
+/* Library Private Variables */
+/*****************************/
+
+/* v2 B-tree class for indexing non-filtered chunked datasets */
+const H5B2_class_t H5D_BT2[1] = {{ /* B-tree class information */
+ H5B2_CDSET_ID, /* Type of B-tree */
+ "H5B2_CDSET_ID", /* Name of B-tree class */
+ sizeof(H5D_chunk_rec_t), /* Size of native record */
+ H5D__bt2_crt_context, /* Create client callback context */
+ H5D__bt2_dst_context, /* Destroy client callback context */
+ H5D__bt2_store, /* Record storage callback */
+ H5D__bt2_compare, /* Record comparison callback */
+ H5D__bt2_unfilt_encode, /* Record encoding callback */
+ H5D__bt2_unfilt_decode, /* Record decoding callback */
+ H5D__bt2_unfilt_debug /* Record debugging callback */
+}};
+
+/* v2 B-tree class for indexing filtered chunked datasets */
+const H5B2_class_t H5D_BT2_FILT[1] = {{ /* B-tree class information */
+ H5B2_CDSET_FILT_ID, /* Type of B-tree */
+ "H5B2_CDSET_FILT_ID", /* Name of B-tree class */
+ sizeof(H5D_chunk_rec_t), /* Size of native record */
+ H5D__bt2_crt_context, /* Create client callback context */
+ H5D__bt2_dst_context, /* Destroy client callback context */
+ H5D__bt2_store, /* Record storage callback */
+ H5D__bt2_compare, /* Record comparison callback */
+ H5D__bt2_filt_encode, /* Record encoding callback */
+ H5D__bt2_filt_decode, /* Record decoding callback */
+ H5D__bt2_filt_debug /* Record debugging callback */
+}};
+
+
+/*******************/
+/* Local Variables */
+/*******************/
+
+/* Declare a free list to manage the H5D_bt2_ctx_t struct */
+H5FL_DEFINE_STATIC(H5D_bt2_ctx_t);
+/* Declare a free list to manage the page elements */
+H5FL_BLK_DEFINE(chunk_dim);
+
+
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__bt2_crt_context
+ *
+ * Purpose: Create client callback context
+ *
+ * Return: Success: non-NULL
+ * Failure: NULL
+ *
+ * Programmer: Vailin Choi; June 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+static void *
+H5D__bt2_crt_context(void *_udata)
+{
+ H5D_bt2_ctx_ud_t *udata = (H5D_bt2_ctx_ud_t *)_udata; /* User data for building callback context */
+ H5D_bt2_ctx_t *ctx; /* Callback context structure */
+ uint32_t *my_dim = NULL; /* Pointer to copy of chunk dimension size */
+ void *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity check */
+ HDassert(udata);
+ HDassert(udata->f);
+ HDassert(udata->ndims > 0 && udata->ndims < H5O_LAYOUT_NDIMS);
+
+ /* Allocate callback context */
+ if(NULL == (ctx = H5FL_MALLOC(H5D_bt2_ctx_t)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, NULL, "can't allocate callback context")
+
+ /* Determine the size of addresses and set the chunk size and # of dimensions for the dataset */
+ ctx->sizeof_addr = H5F_SIZEOF_ADDR(udata->f);
+ ctx->chunk_size = udata->chunk_size;
+ ctx->ndims = udata->ndims;
+
+ /* Set up the "local" information for this dataset's chunk dimension sizes */
+ if(NULL == (my_dim = (uint32_t *)H5FL_BLK_MALLOC(chunk_dim, H5O_LAYOUT_NDIMS * sizeof(uint32_t))))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, NULL, "can't allocate chunk dims")
+ HDmemcpy(my_dim, udata->dim, H5O_LAYOUT_NDIMS * sizeof(uint32_t));
+ ctx->dim = my_dim;
+
+ /*
+ * Compute the size required for encoding the size of a chunk,
+ * allowing for an extra byte, in case the filter makes the chunk larger.
+ */
+ ctx->chunk_size_len = 1 + ((H5VM_log2_gen((uint64_t)udata->chunk_size) + 8) / 8);
+ if(ctx->chunk_size_len > 8)
+ ctx->chunk_size_len = 8;
+
+ /* Set return value */
+ ret_value = ctx;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5D__bt2_crt_context() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__bt2_dst_context
+ *
+ * Purpose: Destroy client callback context
+ *
+ * Return: Success: non-negative
+ * Failure: negative
+ *
+ * Programmer: Vailin Choi; June 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5D__bt2_dst_context(void *_ctx)
+{
+ H5D_bt2_ctx_t *ctx = (H5D_bt2_ctx_t *)_ctx; /* Callback context structure */
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Sanity check */
+ HDassert(ctx);
+
+ /* Free array for chunk dimension sizes */
+ if(ctx->dim)
+ (void)H5FL_BLK_FREE(chunk_dim, ctx->dim);
+ /* Release callback context */
+ ctx = H5FL_FREE(H5D_bt2_ctx_t, ctx);
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* H5D__bt2_dst_context() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__bt2_store
+ *
+ * Purpose: Store native information into record for v2 B-tree
+ * (non-filtered)
+ *
+ * Return: Success: non-negative
+ * Failure: negative
+ *
+ * Programmer: Vailin Choi; June 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5D__bt2_store(void *record, const void *_udata)
+{
+ const H5D_bt2_ud_t *udata = (const H5D_bt2_ud_t *)_udata; /* User data */
+
+ FUNC_ENTER_STATIC_NOERR
+
+ *(H5D_chunk_rec_t *)record = udata->rec;
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* H5D__bt2_store() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__bt2_compare
+ *
+ * Purpose: Compare two native information records, according to some key
+ * (non-filtered)
+ *
+ * Return: <0 if rec1 < rec2
+ * =0 if rec1 == rec2
+ * >0 if rec1 > rec2
+ *
+ * Programmer: Vailin Choi; June 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5D__bt2_compare(const void *_udata, const void *_rec2, int *result)
+{
+ const H5D_bt2_ud_t *udata = (const H5D_bt2_ud_t *)_udata; /* User data */
+ const H5D_chunk_rec_t *rec1 = &(udata->rec); /* The search record */
+ const H5D_chunk_rec_t *rec2 = (const H5D_chunk_rec_t *)_rec2; /* The native record */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Sanity checks */
+ HDassert(rec1);
+ HDassert(rec2);
+
+ /* Compare the offsets but ignore the other fields */
+ *result = H5VM_vector_cmp_u(udata->ndims, rec1->scaled, rec2->scaled);
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5D__bt2_compare() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__bt2_unfilt_encode
+ *
+ * Purpose: Encode native information into raw form for storing on disk
+ * (non-filtered)
+ *
+ * Return: Success: non-negative
+ * Failure: negative
+ *
+ * Programmer: Vailin Choi; June 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5D__bt2_unfilt_encode(uint8_t *raw, const void *_record, void *_ctx)
+{
+ H5D_bt2_ctx_t *ctx = (H5D_bt2_ctx_t *)_ctx; /* Callback context structure */
+ const H5D_chunk_rec_t *record = (const H5D_chunk_rec_t *)_record; /* The native record */
+ unsigned u; /* Local index varible */
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Sanity check */
+ HDassert(ctx);
+
+ /* Encode the record's fields */
+ H5F_addr_encode_len(ctx->sizeof_addr, &raw, record->chunk_addr);
+ /* (Don't encode the chunk size & filter mask for non-filtered B-tree records) */
+ for(u = 0; u < ctx->ndims; u++)
+ UINT64ENCODE(raw, record->scaled[u]);
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* H5D__bt2_unfilt_encode() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__bt2_unfilt_decode
+ *
+ * Purpose: Decode raw disk form of record into native form
+ * (non-filtered)
+ *
+ * Return: Success: non-negative
+ * Failure: negative
+ *
+ * Programmer: Vailin Choi; June 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5D__bt2_unfilt_decode(const uint8_t *raw, void *_record, void *_ctx)
+{
+ H5D_bt2_ctx_t *ctx = (H5D_bt2_ctx_t *)_ctx; /* Callback context structure */
+ H5D_chunk_rec_t *record = (H5D_chunk_rec_t *)_record; /* The native record */
+ unsigned u; /* Local index variable */
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Sanity check */
+ HDassert(ctx);
+
+ /* Decode the record's fields */
+ H5F_addr_decode_len(ctx->sizeof_addr, &raw, &record->chunk_addr);
+ record->nbytes = ctx->chunk_size;
+ record->filter_mask = 0;
+ for(u = 0; u < ctx->ndims; u++)
+ UINT64DECODE(raw, record->scaled[u]);
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* H5D__bt2_unfilt_decode() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__bt2_unfilt_debug
+ *
+ * Purpose: Debug native form of record (non-filtered)
+ *
+ * Return: Success: non-negative
+ * Failure: negative
+ *
+ * Programmer: Vailin Choi; June 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5D__bt2_unfilt_debug(FILE *stream, int indent, int fwidth,
+ const void *_record, const void *_ctx)
+{
+ const H5D_chunk_rec_t *record = (const H5D_chunk_rec_t *)_record; /* The native record */
+ const H5D_bt2_ctx_t *ctx = (const H5D_bt2_ctx_t *)_ctx; /* Callback context */
+ unsigned u; /* Local index variable */
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Sanity checks */
+ HDassert(record);
+ HDassert(ctx->chunk_size == record->nbytes);
+ HDassert(0 == record->filter_mask);
+
+ HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, "Chunk address:", record->chunk_addr);
+
+ HDfprintf(stream, "%*s%-*s {", indent, "", fwidth, "Logical offset:");
+ for(u = 0; u < ctx->ndims; u++)
+ HDfprintf(stream, "%s%Hd", u?", ":"", record->scaled[u] * ctx->dim[u]);
+ HDfputs("}\n", stream);
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* H5D__bt2_unfilt_debug() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__bt2_filt_encode
+ *
+ * Purpose: Encode native information into raw form for storing on disk
+ * (filtered)
+ *
+ * Return: Success: non-negative
+ * Failure: negative
+ *
+ * Programmer: Vailin Choi; June 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5D__bt2_filt_encode(uint8_t *raw, const void *_record, void *_ctx)
+{
+ H5D_bt2_ctx_t *ctx = (H5D_bt2_ctx_t *)_ctx; /* Callback context structure */
+ const H5D_chunk_rec_t *record = (const H5D_chunk_rec_t *)_record; /* The native record */
+ unsigned u; /* Local index variable */
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Sanity check */
+ HDassert(ctx);
+ HDassert(record);
+ HDassert(H5F_addr_defined(record->chunk_addr));
+ HDassert(0 != record->nbytes);
+
+ /* Encode the record's fields */
+ H5F_addr_encode_len(ctx->sizeof_addr, &raw, record->chunk_addr);
+ UINT64ENCODE_VAR(raw, record->nbytes, ctx->chunk_size_len);
+ UINT32ENCODE(raw, record->filter_mask);
+ for(u = 0; u < ctx->ndims; u++)
+ UINT64ENCODE(raw, record->scaled[u]);
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* H5D__bt2_filt_encode() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__bt2_filt_decode
+ *
+ * Purpose: Decode raw disk form of record into native form
+ * (filtered)
+ *
+ * Return: Success: non-negative
+ * Failure: negative
+ *
+ * Programmer: Vailin Choi; June 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5D__bt2_filt_decode(const uint8_t *raw, void *_record, void *_ctx)
+{
+ H5D_bt2_ctx_t *ctx = (H5D_bt2_ctx_t *)_ctx; /* Callback context structure */
+ H5D_chunk_rec_t *record = (H5D_chunk_rec_t *)_record; /* The native record */
+ unsigned u; /* Local index variable */
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Sanity check */
+ HDassert(ctx);
+ HDassert(record);
+
+ /* Decode the record's fields */
+ H5F_addr_decode_len(ctx->sizeof_addr, &raw, &record->chunk_addr);
+ UINT64DECODE_VAR(raw, record->nbytes, ctx->chunk_size_len);
+ UINT32DECODE(raw, record->filter_mask);
+ for(u = 0; u < ctx->ndims; u++)
+ UINT64DECODE(raw, record->scaled[u]);
+
+ /* Sanity checks */
+ HDassert(H5F_addr_defined(record->chunk_addr));
+ HDassert(0 != record->nbytes);
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* H5D__bt2_filt_decode() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__bt2_filt_debug
+ *
+ * Purpose: Debug native form of record (filtered)
+ *
+ * Return: Success: non-negative
+ * Failure: negative
+ *
+ * Programmer: Vailin Choi; June 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5D__bt2_filt_debug(FILE *stream, int indent, int fwidth,
+ const void *_record, const void *_ctx)
+{
+ const H5D_chunk_rec_t *record = (const H5D_chunk_rec_t *)_record; /* The native record */
+ const H5D_bt2_ctx_t *ctx = (const H5D_bt2_ctx_t *)_ctx; /* Callback context */
+ unsigned u; /* Local index variable */
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Sanity checks */
+ HDassert(record);
+ HDassert(H5F_addr_defined(record->chunk_addr));
+ HDassert(0 != record->nbytes);
+
+ HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, "Chunk address:", record->chunk_addr);
+ HDfprintf(stream, "%*s%-*s %u bytes\n", indent, "", fwidth, "Chunk size:", (unsigned)record->nbytes);
+ HDfprintf(stream, "%*s%-*s 0x%08x\n", indent, "", fwidth, "Filter mask:", record->filter_mask);
+
+ HDfprintf(stream, "%*s%-*s {", indent, "", fwidth, "Logical offset:");
+ for(u = 0; u < ctx->ndims; u++)
+ HDfprintf(stream, "%s%Hd", u?", ":"", record->scaled[u] * ctx->dim[u]);
+ HDfputs("}\n", stream);
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* H5D__bt2_filt_debug() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__bt2_idx_init
+ *
+ * Purpose: Initialize the indexing information for a dataset.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Neil Fortner
+ * Wednesday, May 23, 2012
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5D__bt2_idx_init(const H5D_chk_idx_info_t H5_ATTR_UNUSED *idx_info,
+ const H5S_t H5_ATTR_UNUSED *space, haddr_t dset_ohdr_addr)
+{
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Check args */
+ HDassert(H5F_addr_defined(dset_ohdr_addr));
+
+ idx_info->storage->u.btree2.dset_ohdr_addr = dset_ohdr_addr;
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5D__bt2_idx_init() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__bt2_idx_open()
+ *
+ * Purpose: Opens an existing v2 B-tree.
+ *
+ * Note: This information is passively initialized from each index
+ * operation callback because those abstract chunk index operations
+ * are designed to work with the v2 B-tree chunk indices also,
+ * which don't require an 'open' for the data structure.
+ *
+ * Return: Success: non-negative
+ * Failure: negative
+ *
+ * Programmer: Vailin Choi; June 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5D__bt2_idx_open(const H5D_chk_idx_info_t *idx_info)
+{
+ H5D_bt2_ctx_ud_t u_ctx; /* user data for creating context */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check args */
+ HDassert(idx_info);
+ HDassert(idx_info->f);
+ HDassert(idx_info->pline);
+ HDassert(idx_info->layout);
+ HDassert(H5D_CHUNK_IDX_BT2 == idx_info->layout->idx_type);
+ HDassert(idx_info->storage);
+ HDassert(H5F_addr_defined(idx_info->storage->idx_addr));
+ HDassert(NULL == idx_info->storage->u.btree2.bt2);
+
+ /* Set up the user data */
+ u_ctx.f = idx_info->f;
+ u_ctx.ndims = idx_info->layout->ndims - 1;
+ u_ctx.chunk_size = idx_info->layout->size;
+ u_ctx.dim = idx_info->layout->dim;
+
+ /* Open v2 B-tree for the chunk index */
+ if(NULL == (idx_info->storage->u.btree2.bt2 = H5B2_open(idx_info->f, idx_info->dxpl_id, idx_info->storage->idx_addr, &u_ctx)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't open v2 B-tree for tracking chunked dataset")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5D__bt2_idx_open() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__bt2_idx_create
+ *
+ * Purpose: Create the v2 B-tree for tracking dataset chunks
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Vailin Choi; June 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5D__bt2_idx_create(const H5D_chk_idx_info_t *idx_info)
+{
+ H5B2_create_t bt2_cparam; /* v2 B-tree creation parameters */
+ H5D_bt2_ctx_ud_t u_ctx; /* data for context call */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check args */
+ HDassert(idx_info);
+ HDassert(idx_info->f);
+ HDassert(idx_info->pline);
+ HDassert(idx_info->layout);
+ HDassert(idx_info->storage);
+ HDassert(!H5F_addr_defined(idx_info->storage->idx_addr));
+
+ bt2_cparam.rrec_size = H5F_SIZEOF_ADDR(idx_info->f) /* Address of chunk */
+ + (idx_info->layout->ndims - 1) * 8; /* # of dimensions x 64-bit chunk offsets */
+
+ /* General parameters */
+ if(idx_info->pline->nused > 0) {
+ unsigned chunk_size_len; /* Size of encoded chunk size */
+
+ /*
+ * Compute the size required for encoding the size of a chunk,
+ * allowing for an extra byte, in case the filter makes the chunk larger.
+ */
+ chunk_size_len = 1 + ((H5VM_log2_gen((uint64_t)idx_info->layout->size) + 8) / 8);
+ if(chunk_size_len > 8)
+ chunk_size_len = 8;
+
+ bt2_cparam.rrec_size += chunk_size_len + 4; /* Size of encoded chunk size & filter mask */
+ bt2_cparam.cls = H5D_BT2_FILT;
+ } /* end if */
+ else
+ bt2_cparam.cls = H5D_BT2;
+
+ bt2_cparam.node_size = idx_info->layout->u.btree2.cparam.node_size;
+ bt2_cparam.split_percent = idx_info->layout->u.btree2.cparam.split_percent;
+ bt2_cparam.merge_percent = idx_info->layout->u.btree2.cparam.merge_percent;
+
+ u_ctx.f = idx_info->f;
+ u_ctx.ndims = idx_info->layout->ndims - 1;
+ u_ctx.chunk_size = idx_info->layout->size;
+ u_ctx.dim = idx_info->layout->dim;
+
+ /* Create the v2 B-tree for the chunked dataset */
+ if(NULL == (idx_info->storage->u.btree2.bt2 = H5B2_create(idx_info->f, idx_info->dxpl_id, &bt2_cparam, &u_ctx)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTCREATE, FAIL, "can't create v2 B-tree for tracking chunked dataset")
+
+ /* Retrieve the v2 B-tree's address in the file */
+ if(H5B2_get_addr(idx_info->storage->u.btree2.bt2, &(idx_info->storage->idx_addr)) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get v2 B-tree address for tracking chunked dataset")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5D__bt2_idx_create() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__bt2_idx_is_space_alloc
+ *
+ * Purpose: Query if space is allocated for index method
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Vailin Choi; June 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+static hbool_t
+H5D__bt2_idx_is_space_alloc(const H5O_storage_chunk_t *storage)
+{
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Check args */
+ HDassert(storage);
+
+ FUNC_LEAVE_NOAPI((hbool_t)H5F_addr_defined(storage->idx_addr))
+} /* end H5D__bt2_idx_is_space_alloc() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__bt2_mod_cb
+ *
+ * Purpose: Modify record for dataset chunk when it is found in a v2 B-tree.
+ * This is the callback for H5B2_modify() which is called in
+ * H5D__bt2_idx_insert().
+ *
+ * Return: Success: non-negative
+ * Failure: negative
+ *
+ * Programmer: Vailin Choi; June 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5D__bt2_mod_cb(void *_record, void *_op_data, hbool_t *changed)
+{
+ H5D_bt2_ud_t *op_data = (H5D_bt2_ud_t *)_op_data; /* User data for v2 B-tree calls */
+ H5D_chunk_rec_t *record = (H5D_chunk_rec_t *)_record; /* Chunk record */
+
+ FUNC_ENTER_STATIC_NOERR
+
+/* Sanity check */
+#ifndef NDEBUG
+{
+ unsigned u; /* Local index variable */
+
+ for(u = 0; u < op_data->ndims; u++)
+ HDassert(record->scaled[u] == op_data->rec.scaled[u]);
+}
+#endif /* NDEBUG */
+
+ /* Modify record */
+ *record = op_data->rec;
+
+ /* Note that the record changed */
+ *changed = TRUE;
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5D__bt2_mod_cb() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__bt2_idx_insert
+ *
+ * Purpose: Insert chunk address into the indexing structure.
+ * A non-filtered chunk:
+ * Should not exist
+ * Allocate the chunk and pass chunk address back up
+ * A filtered chunk:
+ * If it was not found, create the chunk and pass chunk address back up
+ * If it was found but its size changed, reallocate the chunk and pass chunk address back up
+ * If it was found but its size was the same, pass chunk address back up
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Vailin Choi; June 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5D__bt2_idx_insert(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata,
+ const H5D_t H5_ATTR_UNUSED *dset)
+{
+ H5B2_t *bt2; /* v2 B-tree handle for indexing chunks */
+ H5D_bt2_ud_t bt2_udata; /* User data for v2 B-tree calls */
+ unsigned u; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(idx_info);
+ HDassert(idx_info->f);
+ HDassert(idx_info->pline);
+ HDassert(idx_info->layout);
+ HDassert(idx_info->storage);
+ HDassert(H5F_addr_defined(idx_info->storage->idx_addr));
+ HDassert(udata);
+ HDassert(H5F_addr_defined(udata->chunk_block.offset));
+
+ /* Check if the v2 B-tree is open yet */
+ if(NULL == idx_info->storage->u.btree2.bt2) {
+ /* Open existing v2 B-tree */
+ if(H5D__bt2_idx_open(idx_info) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open v2 B-tree")
+ } /* end if */
+ else /* Patch the top level file pointer contained in bt2 if needed */
+ if(H5B2_patch_file(idx_info->storage->u.btree2.bt2, idx_info->f) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't patch v2 B-tree file pointer")
+
+ /* Set convenience pointer to v2 B-tree structure */
+ bt2 = idx_info->storage->u.btree2.bt2;
+
+ /* Set up callback info */
+ bt2_udata.ndims = idx_info->layout->ndims - 1;
+ bt2_udata.rec.chunk_addr = udata->chunk_block.offset;
+ if(idx_info->pline->nused > 0) { /* filtered chunk */
+ H5_CHECKED_ASSIGN(bt2_udata.rec.nbytes, uint32_t, udata->chunk_block.length, hsize_t);
+ bt2_udata.rec.filter_mask = udata->filter_mask;
+ } /* end if */
+ else { /* non-filtered chunk */
+ bt2_udata.rec.nbytes = idx_info->layout->size;
+ bt2_udata.rec.filter_mask = 0;
+ } /* end else */
+ for(u = 0; u < (idx_info->layout->ndims - 1); u++)
+ bt2_udata.rec.scaled[u] = udata->common.scaled[u];
+
+ /* Update record for v2 B-tree (could be insert or modify) */
+ if(H5B2_update(bt2, idx_info->dxpl_id, &bt2_udata, H5D__bt2_mod_cb, &bt2_udata) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTUPDATE, FAIL, "unable to update record in v2 B-tree")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5D__bt2_idx_insert() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__bt2_found_cb
+ *
+ * Purpose: Retrieve record for dataset chunk when it is found in a v2 B-tree.
+ * This is the callback for H5B2_find() which is called in
+ * H5D__bt2_idx_get_addr() and H5D__bt2_idx_insert().
+ *
+ * Return: Success: non-negative
+ * Failure: negative
+ *
+ * Programmer: Vailin Choi; June 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5D__bt2_found_cb(const void *nrecord, void *op_data)
+{
+ FUNC_ENTER_STATIC_NOERR
+
+ *(H5D_chunk_rec_t *)op_data = *(const H5D_chunk_rec_t *)nrecord;
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* H5D__bt2_found_cb() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__bt2_idx_get_addr
+ *
+ * Purpose: Get the file address of a chunk if file space has been
+ * assigned. Save the retrieved information in the udata
+ * supplied.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Vailin Choi; June 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5D__bt2_idx_get_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata)
+{
+ H5B2_t *bt2; /* v2 B-tree handle for indexing chunks */
+ H5D_bt2_ud_t bt2_udata; /* User data for v2 B-tree calls */
+ H5D_chunk_rec_t found_rec; /* Record found from searching for object */
+ unsigned u; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(idx_info);
+ HDassert(idx_info->f);
+ HDassert(idx_info->pline);
+ HDassert(idx_info->layout);
+ HDassert(idx_info->layout->ndims > 0);
+ HDassert(idx_info->storage);
+ HDassert(H5F_addr_defined(idx_info->storage->idx_addr));
+ HDassert(udata);
+
+ /* Check if the v2 B-tree is open yet */
+ if(NULL == idx_info->storage->u.btree2.bt2) {
+ /* Open existing v2 B-tree */
+ if(H5D__bt2_idx_open(idx_info) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open v2 B-tree")
+ } /* end if */
+ else /* Patch the top level file pointer contained in bt2 if needed */
+ if(H5B2_patch_file(idx_info->storage->u.btree2.bt2, idx_info->f) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't patch v2 B-tree file pointer")
+
+ /* Set convenience pointer to v2 B-tree structure */
+ bt2 = idx_info->storage->u.btree2.bt2;
+
+ /* Clear the found record */
+ found_rec.chunk_addr = HADDR_UNDEF;
+ found_rec.nbytes = 0;
+ found_rec.filter_mask = 0;
+
+ /* Prepare user data for compare callback */
+ bt2_udata.rec.chunk_addr = HADDR_UNDEF;
+ bt2_udata.ndims = idx_info->layout->ndims - 1;
+
+ /* Set the chunk offset to be searched for */
+ for(u = 0; u < (idx_info->layout->ndims - 1); u++)
+ bt2_udata.rec.scaled[u] = udata->common.scaled[u];
+
+ /* Go get chunk information from v2 B-tree */
+ if(H5B2_find(bt2, idx_info->dxpl_id, &bt2_udata, H5D__bt2_found_cb, &found_rec) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_NOTFOUND, FAIL, "can't find object in v2 B-tree")
+
+ /* Set common info for the chunk */
+ udata->chunk_block.offset = found_rec.chunk_addr;
+
+ /* Check for setting other info */
+ if(H5F_addr_defined(udata->chunk_block.offset)) {
+ /* Sanity check */
+ HDassert(0 != found_rec.nbytes);
+
+ /* Set other info for the chunk */
+ if(idx_info->pline->nused > 0) { /* filtered chunk */
+ udata->chunk_block.length = found_rec.nbytes;
+ udata->filter_mask = found_rec.filter_mask;
+ } /* end if */
+ else { /* non-filtered chunk */
+ udata->chunk_block.length = idx_info->layout->size;
+ udata->filter_mask = 0;
+ } /* end else */
+ } /* end if */
+ else {
+ udata->chunk_block.length = 0;
+ udata->filter_mask = 0;
+ } /* end else */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5D__bt2_idx_get_addr() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__bt2_idx_iterate_cb
+ *
+ * Purpose: Translate the B-tree specific chunk record into a generic
+ * form and make the callback to the generic chunk callback
+ * routine.
+ * This is the callback for H5B2_iterate() which is called in
+ * H5D__bt2_idx_iterate().
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Vailin Choi; June 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+H5D__bt2_idx_iterate_cb(const void *_record, void *_udata)
+{
+ H5D_bt2_it_ud_t *udata = (H5D_bt2_it_ud_t *)_udata; /* User data */
+ const H5D_chunk_rec_t *record = (const H5D_chunk_rec_t *)_record; /* Native record */
+ int ret_value = -1; /* Return value */
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Make "generic chunk" callback */
+ if((ret_value = (udata->cb)(record, udata->udata)) < 0)
+ HERROR(H5E_DATASET, H5E_CALLBACK, "failure in generic chunk iterator callback");
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5D__bt2_idx_iterate_cb() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__bt2_idx_iterate
+ *
+ * Purpose: Iterate over the chunks in an index, making a callback
+ * for each one.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Vailin Choi; June 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+H5D__bt2_idx_iterate(const H5D_chk_idx_info_t *idx_info,
+ H5D_chunk_cb_func_t chunk_cb, void *chunk_udata)
+{
+ H5B2_t *bt2; /* v2 B-tree handle for indexing chunks */
+ H5D_bt2_it_ud_t udata; /* User data for B-tree iterator callback */
+ int ret_value = FAIL; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(idx_info);
+ HDassert(idx_info->f);
+ HDassert(idx_info->pline);
+ HDassert(idx_info->layout);
+ HDassert(idx_info->storage);
+ HDassert(H5F_addr_defined(idx_info->storage->idx_addr));
+ HDassert(chunk_cb);
+ HDassert(chunk_udata);
+
+ /* Check if the v2 B-tree is open yet */
+ if(NULL == idx_info->storage->u.btree2.bt2) {
+ /* Open existing v2 B-tree */
+ if(H5D__bt2_idx_open(idx_info) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open v2 B-tree")
+ } /* end if */
+ else /* Patch the top level file pointer contained in bt2 if needed */
+ if(H5B2_patch_file(idx_info->storage->u.btree2.bt2, idx_info->f) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't patch v2 B-tree file pointer")
+
+ /* Set convenience pointer to v2 B-tree structure */
+ bt2 = idx_info->storage->u.btree2.bt2;
+
+ /* Prepare user data for iterate callback */
+ udata.cb = chunk_cb;
+ udata.udata = chunk_udata;
+
+ /* Iterate over the records in the v2 B-tree */
+ if((ret_value = H5B2_iterate(bt2, idx_info->dxpl_id, H5D__bt2_idx_iterate_cb, &udata)) < 0)
+ HERROR(H5E_DATASET, H5E_BADITER, "unable to iterate over chunk v2 B-tree");
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5D__bt2_idx_iterate() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__bt2_remove_cb()
+ *
+ * Purpose: Free space for 'dataset chunk' object as v2 B-tree
+ * is being deleted or v2 B-tree node is removed.
+ * This is the callback for H5B2_remove() and H5B2_delete() which
+ * which are called in H5D__bt2_idx_remove() and H5D__bt2_idx_delete().
+ *
+ * Return: Success: non-negative
+ * Failure: negative
+ *
+ * Programmer: Vailin Choi; June 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5D__bt2_remove_cb(const void *_record, void *_udata)
+{
+ const H5D_chunk_rec_t *record = (const H5D_chunk_rec_t *)_record; /* The native record */
+ H5D_bt2_remove_ud_t *udata = (H5D_bt2_remove_ud_t *)_udata; /* User data for removal callback */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(udata);
+ HDassert(udata->f);
+
+ /* Free the space in the file for the object being removed */
+ H5_CHECK_OVERFLOW(record->nbytes, uint32_t, hsize_t);
+ if(H5MF_xfree(udata->f, H5FD_MEM_DRAW, udata->dxpl_id, record->chunk_addr, (hsize_t)record->nbytes) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to free chunk")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5D__bt2_remove_cb() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__bt2_idx_remove
+ *
+ * Purpose: Remove chunk from index.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Vailin Choi; June 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5D__bt2_idx_remove(const H5D_chk_idx_info_t *idx_info, H5D_chunk_common_ud_t *udata)
+{
+ H5B2_t *bt2; /* v2 B-tree handle for indexing chunks */
+ H5D_bt2_remove_ud_t remove_udata; /* User data for removal callback */
+ H5D_bt2_ud_t bt2_udata; /* User data for v2 B-tree find call */
+ unsigned u; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(idx_info);
+ HDassert(idx_info->f);
+ HDassert(idx_info->pline);
+ HDassert(idx_info->layout);
+ HDassert(idx_info->storage);
+ HDassert(H5F_addr_defined(idx_info->storage->idx_addr));
+ HDassert(udata);
+
+ /* Check if the v2 B-tree is open yet */
+ if(NULL == idx_info->storage->u.btree2.bt2)
+ /* Open existing v2 B-tree */
+ if(H5D__bt2_idx_open(idx_info) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open v2 B-tree")
+
+ /* Set convenience pointer to v2 B-tree structure */
+ bt2 = idx_info->storage->u.btree2.bt2;
+
+ /* Initialize user data for removal callback */
+ remove_udata.f = idx_info->f;
+ remove_udata.dxpl_id = idx_info->dxpl_id;
+
+ /* Prepare user data for compare callback */
+ bt2_udata.ndims = idx_info->layout->ndims - 1;
+
+ /* Initialize the record to search for */
+ for(u = 0; u < (idx_info->layout->ndims - 1); u++)
+ bt2_udata.rec.scaled[u] = udata->scaled[u];
+
+ /* Remove the record for the "dataset chunk" object from the v2 B-tree */
+ /* (space in the file for the object is freed in the 'remove' callback) */
+ if(H5B2_remove(bt2, idx_info->dxpl_id, &bt2_udata, H5D__bt2_remove_cb, &remove_udata) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTREMOVE, FAIL, "can't remove object from B-tree")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5D__bt2_idx_remove() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__bt2_idx_delete
+ *
+ * Purpose: Delete index and raw data storage for entire dataset
+ * (i.e. all chunks)
+ *
+ * Return: Success: Non-negative
+ * Failure: negative
+ *
+ * Programmer: Vailin Choi; June 2010
+ *
+ * Modifications:
+ * Vailin Choi; March 2011
+ * Initialize size of an unfiltered chunk.
+ * This is a fix for for the assertion failure in:
+ * [src/H5FSsection.c:968: H5FS_sect_link_size: Assertion `bin < sinfo->nbins' failed.]
+ * which is uncovered by test_unlink_chunked_dataset() in test/unlink.c
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5D__bt2_idx_delete(const H5D_chk_idx_info_t *idx_info)
+{
+ H5D_bt2_remove_ud_t remove_udata; /* User data for removal callback */
+ H5B2_remove_t remove_op; /* The removal callback */
+ H5D_bt2_ctx_ud_t u_ctx; /* data for context call */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(idx_info);
+ HDassert(idx_info->f);
+ HDassert(idx_info->pline);
+ HDassert(idx_info->layout);
+ HDassert(idx_info->storage);
+
+ /* Check if the index data structure has been allocated */
+ if(H5F_addr_defined(idx_info->storage->idx_addr)) {
+ /* Set up user data for creating context */
+ u_ctx.f = idx_info->f;
+ u_ctx.ndims = idx_info->layout->ndims - 1;
+ u_ctx.chunk_size = idx_info->layout->size;
+ u_ctx.dim = idx_info->layout->dim;
+
+ /* Initialize user data for removal callback */
+ remove_udata.f = idx_info->f;
+ remove_udata.dxpl_id = idx_info->dxpl_id;
+
+ /* Set remove operation. */
+ remove_op = H5D__bt2_remove_cb;
+
+ /* Delete the v2 B-tree */
+ /*(space in the file for each object is freed in the 'remove' callback) */
+ if(H5B2_delete(idx_info->f, idx_info->dxpl_id, idx_info->storage->idx_addr, &u_ctx, remove_op, &remove_udata) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTDELETE, FAIL, "can't delete v2 B-tree")
+
+ idx_info->storage->idx_addr = HADDR_UNDEF;
+ } /* end if */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5D__bt2_idx_delete() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__bt2_idx_copy_setup
+ *
+ * Purpose: Set up any necessary information for copying chunks
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Vailin Choi; June 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5D__bt2_idx_copy_setup(const H5D_chk_idx_info_t *idx_info_src,
+ const H5D_chk_idx_info_t *idx_info_dst)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Source file */
+ HDassert(idx_info_src);
+ HDassert(idx_info_src->f);
+ HDassert(idx_info_src->pline);
+ HDassert(idx_info_src->layout);
+ HDassert(idx_info_src->storage);
+
+ /* Destination file */
+ HDassert(idx_info_dst);
+ HDassert(idx_info_dst->f);
+ HDassert(idx_info_dst->pline);
+ HDassert(idx_info_dst->layout);
+ HDassert(idx_info_dst->storage);
+ HDassert(!H5F_addr_defined(idx_info_dst->storage->idx_addr));
+
+ /* Check if the source v2 B-tree is open yet */
+ if(NULL == idx_info_src->storage->u.btree2.bt2)
+ if(H5D__bt2_idx_open(idx_info_src) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open v2 B-tree")
+
+ /* Set copied metadata tag */
+ H5_BEGIN_TAG(idx_info_dst->dxpl_id, H5AC__COPIED_TAG, FAIL);
+
+ /* Create v2 B-tree that describes the chunked dataset in the destination file */
+ if(H5D__bt2_idx_create(idx_info_dst) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize chunked storage")
+ HDassert(H5F_addr_defined(idx_info_dst->storage->idx_addr));
+
+ /* Reset metadata tag */
+ H5_END_TAG(FAIL);
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5D__bt2_idx_copy_setup() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__bt2_idx_copy_shutdown
+ *
+ * Purpose: Shutdown any information from copying chunks
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Vailin Choi; June 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5D__bt2_idx_copy_shutdown(H5O_storage_chunk_t *storage_src,
+ H5O_storage_chunk_t *storage_dst, hid_t H5_ATTR_UNUSED dxpl_id)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check args */
+ HDassert(storage_src);
+ HDassert(storage_src->u.btree2.bt2);
+ HDassert(storage_dst);
+ HDassert(storage_dst->u.btree2.bt2);
+
+ /* Close v2 B-tree for source file */
+ if(H5B2_close(storage_src->u.btree2.bt2, dxpl_id) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to close v2 B-tree")
+ storage_src->u.btree2.bt2 = NULL;
+
+ /* Close v2 B-tree for destination file */
+ if(H5B2_close(storage_dst->u.btree2.bt2, dxpl_id) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to close v2 B-tree")
+ storage_dst->u.btree2.bt2 = NULL;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5D__bt2_idx_copy_shutdown() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__bt2_idx_size
+ *
+ * Purpose: Retrieve the amount of index storage for chunked dataset
+ *
+ * Return: Success: Non-negative
+ * Failure: negative
+ *
+ * Programmer: Vailin Choi; June 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5D__bt2_idx_size(const H5D_chk_idx_info_t *idx_info, hsize_t *index_size)
+{
+ H5B2_t *bt2_cdset = NULL; /* Pointer to v2 B-tree structure */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check args */
+ HDassert(idx_info);
+ HDassert(idx_info->f);
+ HDassert(idx_info->pline);
+ HDassert(idx_info->layout);
+ HDassert(idx_info->storage);
+ HDassert(H5F_addr_defined(idx_info->storage->idx_addr));
+ HDassert(index_size);
+
+ /* Open v2 B-tree */
+ if(H5D__bt2_idx_open(idx_info) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open v2 B-tree")
+
+ /* Set convenience pointer to v2 B-tree structure */
+ bt2_cdset = idx_info->storage->u.btree2.bt2;
+
+ /* Get v2 B-tree size for indexing chunked dataset */
+ if(H5B2_size(bt2_cdset, idx_info->dxpl_id, index_size) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve v2 B-tree storage info for chunked dataset")
+
+done:
+ /* Close v2 B-tree index */
+ if(bt2_cdset && H5B2_close(bt2_cdset, idx_info->dxpl_id) < 0)
+ HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for tracking chunked dataset")
+ idx_info->storage->u.btree2.bt2 = NULL;
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5D__bt2_idx_size() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__bt2_idx_reset
+ *
+ * Purpose: Reset indexing information.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Vailin Choi; June 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5D__bt2_idx_reset(H5O_storage_chunk_t *storage, hbool_t reset_addr)
+{
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Sanity checks */
+ HDassert(storage);
+
+ /* Reset index info */
+ if(reset_addr)
+ storage->idx_addr = HADDR_UNDEF;
+ storage->u.btree2.bt2 = NULL;
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5D__bt2_idx_reset() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__bt2_idx_dump
+ *
+ * Purpose: Dump indexing information to a stream.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Vailin Choi; June 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5D__bt2_idx_dump(const H5O_storage_chunk_t *storage, FILE *stream)
+{
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Sanity checks */
+ HDassert(storage);
+ HDassert(stream);
+
+ HDfprintf(stream, " Address: %a\n", storage->idx_addr);
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5D__bt2_idx_dump() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__bt2_idx_dest
+ *
+ * Purpose: Release indexing information in memory.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Vailin Choi; June 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5D__bt2_idx_dest(const H5D_chk_idx_info_t *idx_info)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check args */
+ HDassert(idx_info);
+ HDassert(idx_info->f);
+ HDassert(idx_info->storage);
+
+ /* Check if the v2-btree is open */
+ if(idx_info->storage->u.btree2.bt2) {
+ /* Close v2 B-tree */
+ if(H5B2_close(idx_info->storage->u.btree2.bt2, idx_info->dxpl_id) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree")
+ idx_info->storage->u.btree2.bt2 = NULL;
+ } /* end if */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5D__bt2_idx_dest() */
+
diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c
index ab621ca..c3a3d9d 100644
--- a/src/H5Dchunk.c
+++ b/src/H5Dchunk.c
@@ -56,6 +56,7 @@
#endif /* H5_HAVE_PARALLEL */
#include "H5Dpkg.h" /* Dataset functions */
#include "H5Eprivate.h" /* Error handling */
+#include "H5Fprivate.h" /* File functions */
#include "H5FLprivate.h" /* Free Lists */
#include "H5Iprivate.h" /* IDs */
#include "H5MMprivate.h" /* Memory management */
@@ -72,6 +73,13 @@
#define H5D_CHUNK_GET_NODE_INFO(map, node) (map->use_single ? map->single_chunk_info : (H5D_chunk_info_t *)H5SL_item(node))
#define H5D_CHUNK_GET_NEXT_NODE(map, node) (map->use_single ? (H5SL_node_t *)NULL : H5SL_next(node))
+/* Sanity check on chunk index types: commonly used by a lot of routines in this file */
+#define H5D_CHUNK_STORAGE_INDEX_CHK(storage) \
+ HDassert((H5D_CHUNK_IDX_EARRAY == storage->idx_type && H5D_COPS_EARRAY == storage->ops) || \
+ (H5D_CHUNK_IDX_FARRAY == storage->idx_type && H5D_COPS_FARRAY == storage->ops) || \
+ (H5D_CHUNK_IDX_BT2 == storage->idx_type && H5D_COPS_BT2 == storage->ops) || \
+ (H5D_CHUNK_IDX_BTREE == storage->idx_type && H5D_COPS_BTREE == storage->ops));
+
/*
* Feature: If this constant is defined then every cache preemption and load
* causes a character to be printed on the standard error stream:
@@ -98,11 +106,36 @@
/*#define H5D_CHUNK_DEBUG */
+/* Flags for the "edge_chunk_state" field below */
+#define H5D_RDCC_DISABLE_FILTERS 0x01u /* Disable filters on this chunk */
+#define H5D_RDCC_NEWLY_DISABLED_FILTERS 0x02u /* Filters have been disabled since
+ * the last flush */
+
/******************/
/* Local Typedefs */
/******************/
+/* Raw data chunks are cached. Each entry in the cache is: */
+typedef struct H5D_rdcc_ent_t {
+ hbool_t locked; /*entry is locked in cache */
+ hbool_t dirty; /*needs to be written to disk? */
+ hbool_t deleted; /*chunk about to be deleted */
+ unsigned edge_chunk_state; /*states related to edge chunks (see above) */
+ hsize_t scaled[H5O_LAYOUT_NDIMS]; /*scaled chunk 'name' (coordinates) */
+ uint32_t rd_count; /*bytes remaining to be read */
+ uint32_t wr_count; /*bytes remaining to be written */
+ H5F_block_t chunk_block; /*offset/length of chunk in file */
+ hsize_t chunk_idx; /*index of chunk in dataset */
+ uint8_t *chunk; /*the unfiltered chunk data */
+ unsigned idx; /*index in hash table */
+ struct H5D_rdcc_ent_t *next;/*next item in doubly-linked list */
+ struct H5D_rdcc_ent_t *prev;/*previous item in doubly-linked list */
+ struct H5D_rdcc_ent_t *tmp_next;/*next item in temporary doubly-linked list */
+ struct H5D_rdcc_ent_t *tmp_prev;/*previous item in temporary doubly-linked list */
+} H5D_rdcc_ent_t;
+typedef H5D_rdcc_ent_t *H5D_rdcc_ent_ptr_t; /* For free lists */
+
/* Callback info for iteration to prune chunks */
typedef struct H5D_chunk_it_ud1_t {
H5D_chunk_common_ud_t common; /* Common info for B-tree user data (must be first) */
@@ -150,6 +183,8 @@ typedef struct H5D_chunk_it_ud3_t {
/* needed for compressed variable-length data */
const H5O_pline_t *pline; /* Filter pipeline */
+ unsigned dset_ndims; /* Number of dimensions in dataset */
+ const hsize_t *dset_dims; /* Dataset dimensions */
/* needed for copy object pointed by refs */
H5O_copy_t *cpy_info; /* Copy options */
@@ -215,7 +250,7 @@ H5D__nonexistent_readvv(const H5D_io_info_t *io_info,
/* Helper routines */
static herr_t H5D__chunk_set_info_real(H5O_layout_chunk_t *layout, unsigned ndims,
- const hsize_t *curr_dims);
+ const hsize_t *curr_dims, const hsize_t *max_dims);
static void *H5D__chunk_mem_alloc(size_t size, const H5O_pline_t *pline);
static void *H5D__chunk_mem_xfree(void *chk, const H5O_pline_t *pline);
static void *H5D__chunk_mem_realloc(void *chk, size_t size,
@@ -240,9 +275,16 @@ static herr_t H5D__chunk_flush_entry(const H5D_t *dset, hid_t dxpl_id,
const H5D_dxpl_cache_t *dxpl_cache, H5D_rdcc_ent_t *ent, hbool_t reset);
static herr_t H5D__chunk_cache_evict(const H5D_t *dset, hid_t dxpl_id,
const H5D_dxpl_cache_t *dxpl_cache, H5D_rdcc_ent_t *ent, hbool_t flush);
+static hbool_t H5D__chunk_is_partial_edge_chunk(unsigned dset_ndims,
+ const uint32_t *chunk_dims, const hsize_t *chunk_scaled, const hsize_t *dset_dims);
+static void *H5D__chunk_lock(const H5D_io_info_t *io_info,
+ H5D_chunk_ud_t *udata, hbool_t relax, hbool_t prev_unfilt_chunk);
+static herr_t H5D__chunk_unlock(const H5D_io_info_t *io_info,
+ const H5D_chunk_ud_t *udata, hbool_t dirty, void *chunk,
+ uint32_t naccessed);
static herr_t H5D__chunk_cache_prune(const H5D_t *dset, hid_t dxpl_id,
const H5D_dxpl_cache_t *dxpl_cache, size_t size);
-static herr_t H5D__chunk_prune_fill(H5D_chunk_it_ud1_t *udata);
+static herr_t H5D__chunk_prune_fill(H5D_chunk_it_ud1_t *udata, hbool_t new_unfilt_chunk);
static herr_t H5D__chunk_file_alloc(const H5D_chk_idx_info_t *idx_info,
const H5F_block_t *old_chunk, H5F_block_t *new_chunk, hbool_t *need_insert);
#ifdef H5_HAVE_PARALLEL
@@ -333,22 +375,35 @@ H5D__chunk_direct_write(const H5D_t *dset, hid_t dxpl_id, uint32_t filters,
H5D_chk_idx_info_t idx_info; /* Chunked index info */
hsize_t scaled[H5S_MAX_RANK]; /* Scaled coordinates for this chunk */
hbool_t need_insert = FALSE; /* Whether the chunk needs to be inserted into the index */
+ H5D_io_info_t io_info; /* to hold the dset and two dxpls (meta and raw data) */
+ hbool_t md_dxpl_generated = FALSE; /* bool to indicate whether we should free the md_dxpl_id at exit */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC_TAG(dxpl_id, dset->oloc.addr, FAIL)
+ io_info.dset = dset;
+ io_info.raw_dxpl_id = dxpl_id;
+ io_info.md_dxpl_id = dxpl_id;
+
+ /* set the dxpl IO type for sanity checking at the FD layer */
+#ifdef H5_DEBUG_BUILD
+ if(H5D_set_io_info_dxpls(&io_info, dxpl_id) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't set metadata and raw data dxpls")
+ md_dxpl_generated = TRUE;
+#endif /* H5_DEBUG_BUILD */
+
/* Allocate dataspace and initialize it if it hasn't been. */
- if(!(*layout->ops->is_space_alloc)(&layout->storage))
+ if(!(*layout->ops->is_space_alloc)(&layout->storage)) {
/* Allocate storage */
- if(H5D__alloc_storage(dset, dxpl_id, H5D_ALLOC_WRITE, FALSE, NULL) < 0)
+ if(H5D__alloc_storage(&io_info, H5D_ALLOC_WRITE, FALSE, NULL) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize storage")
-
+ }
/* Calculate the index of this chunk */
H5VM_chunk_scaled(dset->shared->ndims, offset, layout->u.chunk.dim, scaled);
scaled[dset->shared->ndims] = 0;
/* Find out the file address of the chunk (if any) */
- if(H5D__chunk_lookup(dset, dxpl_id, scaled, &udata) < 0)
+ if(H5D__chunk_lookup(dset, io_info.md_dxpl_id, scaled, &udata) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address")
/* Sanity check */
@@ -366,7 +421,7 @@ H5D__chunk_direct_write(const H5D_t *dset, hid_t dxpl_id, uint32_t filters,
/* Compose chunked index info struct */
idx_info.f = dset->oloc.file;
- idx_info.dxpl_id = dxpl_id;
+ idx_info.dxpl_id = io_info.md_dxpl_id;
idx_info.pline = &(dset->shared->dcpl_cache.pline);
idx_info.layout = &(dset->shared->layout.u.chunk);
idx_info.storage = &(dset->shared->layout.storage.u.chunk);
@@ -392,15 +447,15 @@ H5D__chunk_direct_write(const H5D_t *dset, hid_t dxpl_id, uint32_t filters,
const H5D_rdcc_t *rdcc = &(dset->shared->cache.chunk); /*raw data chunk cache */
/* Fill the DXPL cache values for later use */
- if(H5D__get_dxpl_cache(dxpl_id, &dxpl_cache) < 0)
+ if(H5D__get_dxpl_cache(io_info.raw_dxpl_id, &dxpl_cache) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't fill dxpl cache")
- if(H5D__chunk_cache_evict(dset, dxpl_id, dxpl_cache, rdcc->slot[udata.idx_hint], FALSE) < 0)
+ if(H5D__chunk_cache_evict(dset, io_info.md_dxpl_id, dxpl_cache, rdcc->slot[udata.idx_hint], FALSE) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTREMOVE, FAIL, "unable to evict chunk")
} /* end if */
/* Write the data to the file */
- if(H5F_block_write(dset->oloc.file, H5FD_MEM_DRAW, udata.chunk_block.offset, data_size, dxpl_id, buf) < 0)
+ if(H5F_block_write(dset->oloc.file, H5FD_MEM_DRAW, udata.chunk_block.offset, data_size, io_info.raw_dxpl_id, buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to write raw data to file")
/* Insert the chunk record into the index */
@@ -413,6 +468,10 @@ H5D__chunk_direct_write(const H5D_t *dset, hid_t dxpl_id, uint32_t filters,
} /* end if */
done:
+#ifdef H5_DEBUG_BUILD
+ if(md_dxpl_generated && H5I_dec_ref(io_info.md_dxpl_id) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "can't close metadata dxpl")
+#endif /* H5_DEBUG_BUILD */
FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL)
} /* end H5D__chunk_direct_write() */
@@ -430,7 +489,8 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5D__chunk_set_info_real(H5O_layout_chunk_t *layout, unsigned ndims, const hsize_t *curr_dims)
+H5D__chunk_set_info_real(H5O_layout_chunk_t *layout, unsigned ndims,
+ const hsize_t *curr_dims, const hsize_t *max_dims)
{
unsigned u; /* Local index variable */
herr_t ret_value = SUCCEED; /* Return value */
@@ -443,17 +503,21 @@ H5D__chunk_set_info_real(H5O_layout_chunk_t *layout, unsigned ndims, const hsize
HDassert(curr_dims);
/* Compute the # of chunks in dataset dimensions */
- for(u = 0, layout->nchunks = 1; u < ndims; u++) {
+ for(u = 0, layout->nchunks = 1, layout->max_nchunks = 1; u < ndims; u++) {
/* Round up to the next integer # of chunks, to accomodate partial chunks */
layout->chunks[u] = ((curr_dims[u] + layout->dim[u]) - 1) / layout->dim[u];
+ layout->max_chunks[u] = ((max_dims[u] + layout->dim[u]) - 1) / layout->dim[u];
/* Accumulate the # of chunks */
layout->nchunks *= layout->chunks[u];
+ layout->max_nchunks *= layout->max_chunks[u];
} /* end for */
/* Get the "down" sizes for each dimension */
if(H5VM_array_down(ndims, layout->chunks, layout->down_chunks) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't compute 'down' chunk size value")
+ if(H5VM_array_down(ndims, layout->max_chunks, layout->max_down_chunks) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't compute 'down' chunk size value")
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -483,7 +547,7 @@ H5D__chunk_set_info(const H5D_t *dset)
HDassert(dset);
/* Set the base layout information */
- if(H5D__chunk_set_info_real(&dset->shared->layout.u.chunk, dset->shared->ndims, dset->shared->curr_dims) < 0)
+ if(H5D__chunk_set_info_real(&dset->shared->layout.u.chunk, dset->shared->ndims, dset->shared->curr_dims, dset->shared->max_dims) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set layout's chunk info")
/* Call the index's "resize" callback */
@@ -496,6 +560,69 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5D__chunk_set_sizes
+ *
+ * Purpose: Sets chunk and type sizes.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * December 2015
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5D__chunk_set_sizes(H5D_t *dset)
+{
+ uint64_t chunk_size; /* Size of chunk in bytes */
+ unsigned max_enc_bytes_per_dim; /* Max. number of bytes required to encode this dimension */
+ unsigned u; /* Iterator */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity checks */
+ HDassert(dset);
+
+ /* Increment # of chunk dimensions, to account for datatype size as last element */
+ dset->shared->layout.u.chunk.ndims++;
+
+ /* Set the last dimension of the chunk size to the size of the datatype */
+ dset->shared->layout.u.chunk.dim[dset->shared->layout.u.chunk.ndims - 1] = (uint32_t)H5T_GET_SIZE(dset->shared->type);
+
+ /* Compute number of bytes to use for encoding chunk dimensions */
+ max_enc_bytes_per_dim = 0;
+ for(u = 0; u < (unsigned)dset->shared->layout.u.chunk.ndims; u++) {
+ unsigned enc_bytes_per_dim; /* Number of bytes required to encode this dimension */
+
+ /* Get encoded size of dim, in bytes */
+ enc_bytes_per_dim = (H5VM_log2_gen(dset->shared->layout.u.chunk.dim[u]) + 8) / 8;
+
+ /* Check if this is the largest value so far */
+ if(enc_bytes_per_dim > max_enc_bytes_per_dim)
+ max_enc_bytes_per_dim = enc_bytes_per_dim;
+ } /* end for */
+ HDassert(max_enc_bytes_per_dim > 0 && max_enc_bytes_per_dim <= 8);
+ dset->shared->layout.u.chunk.enc_bytes_per_dim = max_enc_bytes_per_dim;
+
+ /* Compute and store the total size of a chunk */
+ /* (Use 64-bit value to ensure that we can detect >4GB chunks) */
+ for(u = 1, chunk_size = (uint64_t)dset->shared->layout.u.chunk.dim[0]; u < dset->shared->layout.u.chunk.ndims; u++)
+ chunk_size *= (uint64_t)dset->shared->layout.u.chunk.dim[u];
+
+ /* Check for chunk larger than can be represented in 32-bits */
+ /* (Chunk size is encoded in 32-bit value in v1 B-tree records) */
+ if(chunk_size > (uint64_t)0xffffffff)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "chunk size must be < 4GB")
+
+ H5_CHECKED_ASSIGN(dset->shared->layout.u.chunk.size, uint32_t, chunk_size, uint64_t);
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5D__chunk_set_sizes */
+
+
+/*-------------------------------------------------------------------------
* Function: H5D__chunk_construct
*
* Purpose: Constructs new chunked layout information for dataset
@@ -510,8 +637,6 @@ done:
static herr_t
H5D__chunk_construct(H5F_t H5_ATTR_UNUSED *f, H5D_t *dset)
{
- const H5T_t *type = dset->shared->type; /* Convenience pointer to dataset's datatype */
- uint64_t chunk_size; /* Size of chunk in bytes */
unsigned u; /* Local index variable */
herr_t ret_value = SUCCEED; /* Return value */
@@ -524,22 +649,18 @@ H5D__chunk_construct(H5F_t H5_ATTR_UNUSED *f, H5D_t *dset)
/* Check for invalid chunk dimension rank */
if(0 == dset->shared->layout.u.chunk.ndims)
HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "no chunk information set?")
-
- /* Set up layout information */
if(dset->shared->layout.u.chunk.ndims != dset->shared->ndims)
HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "dimensionality of chunks doesn't match the dataspace")
- /* Increment # of chunk dimensions, to account for datatype size as last element */
- dset->shared->layout.u.chunk.ndims++;
+ /* Set chunk sizes */
+ if(H5D__chunk_set_sizes(dset) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "unable to set chunk sizes")
HDassert((unsigned)(dset->shared->layout.u.chunk.ndims) <= NELMTS(dset->shared->layout.u.chunk.dim));
/* Chunked storage is not compatible with external storage (currently) */
if(dset->shared->dcpl_cache.efl.nused > 0)
HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "external storage not supported with chunked layout")
- /* Set the last dimension of the chunk size to the size of the datatype */
- dset->shared->layout.u.chunk.dim[dset->shared->layout.u.chunk.ndims - 1] = (uint32_t)H5T_GET_SIZE(type);
-
/* Sanity check dimensions */
for(u = 0; u < dset->shared->layout.u.chunk.ndims - 1; u++) {
/* Don't allow zero-sized chunk dimensions */
@@ -555,19 +676,6 @@ H5D__chunk_construct(H5F_t H5_ATTR_UNUSED *f, H5D_t *dset)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "chunk size must be <= maximum dimension size for fixed-sized dimensions")
} /* end for */
- /* Compute the total size of a chunk */
- /* (Use 64-bit value to ensure that we can detect >4GB chunks) */
- for(u = 1, chunk_size = (uint64_t)dset->shared->layout.u.chunk.dim[0]; u < dset->shared->layout.u.chunk.ndims; u++)
- chunk_size *= (uint64_t)dset->shared->layout.u.chunk.dim[u];
-
- /* Check for chunk larger than can be represented in 32-bits */
- /* (Chunk size is encoded in 32-bit value in v1 B-tree records) */
- if(chunk_size > (uint64_t)0xffffffff)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "chunk size must be < 4GB")
-
- /* Retain computed chunk size */
- H5_CHECKED_ASSIGN(dset->shared->layout.u.chunk.size, uint32_t, chunk_size, uint64_t);
-
/* Reset address and pointer of the array struct for the chunked storage index */
if(H5D_chunk_idx_reset(&dset->shared->layout.storage.u.chunk, TRUE) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to reset chunked storage index")
@@ -596,6 +704,7 @@ H5D__chunk_init(H5F_t *f, hid_t dxpl_id, const H5D_t *dset, hid_t dapl_id)
H5D_chk_idx_info_t idx_info; /* Chunked index info */
H5D_rdcc_t *rdcc = &(dset->shared->cache.chunk); /* Convenience pointer to dataset's chunk cache */
H5P_genplist_t *dapl; /* Data access property list object pointer */
+ H5O_storage_chunk_t *sc = &(dset->shared->layout.storage.u.chunk);
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -603,6 +712,7 @@ H5D__chunk_init(H5F_t *f, hid_t dxpl_id, const H5D_t *dset, hid_t dapl_id)
/* Sanity check */
HDassert(f);
HDassert(dset);
+ H5D_CHUNK_STORAGE_INDEX_CHK(sc);
if(NULL == (dapl = (H5P_genplist_t *)H5I_object(dapl_id)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for fapl ID")
@@ -686,12 +796,14 @@ done:
hbool_t
H5D__chunk_is_space_alloc(const H5O_storage_t *storage)
{
+ const H5O_storage_chunk_t *sc = &(storage->u.chunk);
hbool_t ret_value = FALSE; /* Return value */
FUNC_ENTER_PACKAGE_NOERR
/* Sanity checks */
HDassert(storage);
+ H5D_CHUNK_STORAGE_INDEX_CHK(sc);
/* Query index layer */
ret_value = (storage->u.chunk.ops->is_space_alloc)(&storage->u.chunk);
@@ -1020,9 +1132,8 @@ H5D__chunk_mem_alloc(size_t size, const H5O_pline_t *pline)
FUNC_ENTER_STATIC_NOERR
HDassert(size);
- HDassert(pline);
- if(pline->nused > 0)
+ if(pline && pline->nused)
ret_value = H5MM_malloc(size);
else
ret_value = H5FL_BLK_MALLOC(chunk, size);
@@ -1050,10 +1161,8 @@ H5D__chunk_mem_xfree(void *chk, const H5O_pline_t *pline)
{
FUNC_ENTER_STATIC_NOERR
- HDassert(pline);
-
if(chk) {
- if(pline->nused > 0)
+ if(pline && pline->nused)
H5MM_xfree(chk);
else
chk = H5FL_BLK_FREE(chunk, chk);
@@ -1343,6 +1452,9 @@ H5D__create_chunk_file_map_hyper(H5D_chunk_map_t *fm, const H5D_io_info_t
HDmemcpy(new_chunk_info->scaled, scaled, sizeof(hsize_t) * fm->f_ndims);
new_chunk_info->scaled[fm->f_ndims] = 0;
+ /* Copy the chunk's scaled coordinates */
+ HDmemcpy(new_chunk_info->scaled, scaled, sizeof(hsize_t) * fm->f_ndims);
+
/* Insert the new chunk into the skip list */
if(H5SL_insert(fm->sel_chunks, new_chunk_info, &new_chunk_info->index) < 0) {
H5D__free_chunk_info(new_chunk_info, NULL, NULL);
@@ -1600,6 +1712,7 @@ H5D__chunk_file_cb(void H5_ATTR_UNUSED *elem, const H5T_t H5_ATTR_UNUSED *type,
/* Set the chunk's scaled coordinates */
HDmemcpy(chunk_info->scaled, scaled, sizeof(hsize_t) * fm->f_ndims);
chunk_info->scaled[fm->f_ndims] = 0;
+ HDmemcpy(chunk_info->scaled, scaled, sizeof(hsize_t) * fm->f_ndims);
/* Insert the new chunk into the skip list */
if(H5SL_insert(fm->sel_chunks,chunk_info,&chunk_info->index) < 0) {
@@ -1729,15 +1842,32 @@ htri_t
H5D__chunk_cacheable(const H5D_io_info_t *io_info, haddr_t caddr, hbool_t write_op)
{
const H5D_t *dataset = io_info->dset; /* Local pointer to dataset info */
+ hbool_t has_filters = FALSE; /* Whether there are filters on the chunk or not */
htri_t ret_value = FAIL; /* Return value */
FUNC_ENTER_PACKAGE
+ /* Sanity check */
HDassert(io_info);
HDassert(dataset);
- /* Must bring the whole chunk in if there are any filters */
- if(dataset->shared->dcpl_cache.pline.nused > 0)
+ /* Must bring the whole chunk in if there are any filters on the chunk.
+ * Make sure to check if filters are on the dataset but disabled for the
+ * chunk because it is a partial edge chunk. */
+ if(dataset->shared->dcpl_cache.pline.nused > 0) {
+ if(dataset->shared->layout.u.chunk.flags
+ & H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS) {
+ has_filters = !H5D__chunk_is_partial_edge_chunk(
+ io_info->dset->shared->ndims,
+ io_info->dset->shared->layout.u.chunk.dim,
+ io_info->store->chunk.scaled,
+ io_info->dset->shared->curr_dims);
+ } /* end if */
+ else
+ has_filters = TRUE;
+ } /* end if */
+
+ if(has_filters)
ret_value = TRUE;
else {
#ifdef H5_HAVE_PARALLEL
@@ -1871,7 +2001,7 @@ H5D__chunk_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
chunk_info = H5D_CHUNK_GET_NODE_INFO(fm, chunk_node);
/* Get the info for the chunk in the file */
- if(H5D__chunk_lookup(io_info->dset, io_info->dxpl_id, chunk_info->scaled, &udata) < 0)
+ if(H5D__chunk_lookup(io_info->dset, io_info->md_dxpl_id, chunk_info->scaled, &udata) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address")
/* Sanity check */
@@ -1885,6 +2015,9 @@ H5D__chunk_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
void *chunk = NULL; /* Pointer to locked chunk buffer */
htri_t cacheable; /* Whether the chunk is cacheable */
+ /* Set chunk's [scaled] coordinates */
+ io_info->store->chunk.scaled = chunk_info->scaled;
+
/* Determine if we should use the chunk cache */
if((cacheable = H5D__chunk_cacheable(io_info, udata.chunk_block.offset, FALSE)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't tell if chunk is cacheable")
@@ -1895,11 +2028,8 @@ H5D__chunk_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
H5_CHECK_OVERFLOW(type_info->src_type_size, /*From:*/ size_t, /*To:*/ uint32_t);
src_accessed_bytes = chunk_info->chunk_points * (uint32_t)type_info->src_type_size;
- /* Set chunk's [scaled] coordinates */
- io_info->store->chunk.scaled = chunk_info->scaled;
-
/* Lock the chunk into the cache */
- if(NULL == (chunk = H5D__chunk_lock(io_info, &udata, FALSE)))
+ if(NULL == (chunk = H5D__chunk_lock(io_info, &udata, FALSE, FALSE)))
HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "unable to read raw data chunk")
/* Set up the storage buffer information for this chunk */
@@ -2004,13 +2134,16 @@ H5D__chunk_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
chunk_info = H5D_CHUNK_GET_NODE_INFO(fm, chunk_node);
/* Look up the chunk */
- if(H5D__chunk_lookup(io_info->dset, io_info->dxpl_id, chunk_info->scaled, &udata) < 0)
+ if(H5D__chunk_lookup(io_info->dset, io_info->md_dxpl_id, chunk_info->scaled, &udata) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address")
/* Sanity check */
HDassert((H5F_addr_defined(udata.chunk_block.offset) && udata.chunk_block.length > 0) ||
(!H5F_addr_defined(udata.chunk_block.offset) && udata.chunk_block.length == 0));
+ /* Set chunk's [scaled] coordinates */
+ io_info->store->chunk.scaled = chunk_info->scaled;
+
/* Determine if we should use the chunk cache */
if((cacheable = H5D__chunk_cacheable(io_info, udata.chunk_block.offset, TRUE)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't tell if chunk is cacheable")
@@ -2029,11 +2162,8 @@ H5D__chunk_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
fm->fsel_type == H5S_SEL_POINTS)
entire_chunk = FALSE;
- /* Set chunk's [scaled] coordinates */
- io_info->store->chunk.scaled = chunk_info->scaled;
-
/* Lock the chunk into the cache */
- if(NULL == (chunk = H5D__chunk_lock(io_info, &udata, entire_chunk)))
+ if(NULL == (chunk = H5D__chunk_lock(io_info, &udata, entire_chunk, FALSE)))
HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "unable to read raw data chunk")
/* Set up the storage buffer information for this chunk */
@@ -2047,7 +2177,7 @@ H5D__chunk_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
if(!H5F_addr_defined(udata.chunk_block.offset)) {
/* Compose chunked index info struct */
idx_info.f = io_info->dset->oloc.file;
- idx_info.dxpl_id = io_info->dxpl_id;
+ idx_info.dxpl_id = io_info->md_dxpl_id;
idx_info.pline = &(io_info->dset->shared->dcpl_cache.pline);
idx_info.layout = &(io_info->dset->shared->layout.u.chunk);
idx_info.storage = &(io_info->dset->shared->layout.storage.u.chunk);
@@ -2221,12 +2351,14 @@ H5D__chunk_dest(H5D_t *dset, hid_t dxpl_id)
H5D_rdcc_t *rdcc = &(dset->shared->cache.chunk); /* Dataset's chunk cache */
H5D_rdcc_ent_t *ent = NULL, *next = NULL; /* Pointer to current & next cache entries */
int nerrors = 0; /* Accumulated count of errors */
+ H5O_storage_chunk_t *sc = &(dset->shared->layout.storage.u.chunk);
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC_TAG(dxpl_id, dset->oloc.addr, FAIL)
/* Sanity checks */
HDassert(dset);
+ H5D_CHUNK_STORAGE_INDEX_CHK(sc);
/* Fill the DXPL cache values for later use */
if(H5D__get_dxpl_cache(dxpl_id, &dxpl_cache) < 0)
@@ -2287,6 +2419,7 @@ H5D_chunk_idx_reset(H5O_storage_chunk_t *storage, hbool_t reset_addr)
/* Sanity checks */
HDassert(storage);
HDassert(storage->ops);
+ H5D_CHUNK_STORAGE_INDEX_CHK(storage);
/* Reset index structures */
if((storage->ops->reset)(storage, reset_addr) < 0)
@@ -2351,6 +2484,7 @@ H5D__chunk_cinfo_cache_update(H5D_chunk_cached_t *last, const H5D_chunk_ud_t *ud
HDmemcpy(last->scaled, udata->common.scaled, sizeof(hsize_t) * udata->common.layout->ndims);
last->addr = udata->chunk_block.offset;
H5_CHECKED_ASSIGN(last->nbytes, uint32_t, udata->chunk_block.length, hsize_t);
+ last->chunk_idx = udata->chunk_idx;
last->filter_mask = udata->filter_mask;
/* Indicate that the cached info is valid */
@@ -2397,6 +2531,7 @@ H5D__chunk_cinfo_cache_found(const H5D_chunk_cached_t *last, H5D_chunk_ud_t *uda
/* Retrieve the information from the cache */
udata->chunk_block.offset = last->addr;
udata->chunk_block.length = last->nbytes;
+ udata->chunk_idx = last->chunk_idx;
udata->filter_mask = last->filter_mask;
/* Indicate that the data was found */
@@ -2427,6 +2562,7 @@ herr_t
H5D__chunk_create(const H5D_t *dset /*in,out*/, hid_t dxpl_id)
{
H5D_chk_idx_info_t idx_info; /* Chunked index info */
+ H5O_storage_chunk_t *sc = &(dset->shared->layout.storage.u.chunk);
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -2435,6 +2571,8 @@ H5D__chunk_create(const H5D_t *dset /*in,out*/, hid_t dxpl_id)
HDassert(dset);
HDassert(H5D_CHUNKED == dset->shared->layout.type);
HDassert(dset->shared->layout.u.chunk.ndims > 0 && dset->shared->layout.u.chunk.ndims <= H5O_LAYOUT_NDIMS);
+ H5D_CHUNK_STORAGE_INDEX_CHK(sc);
+
#ifndef NDEBUG
{
unsigned u; /* Local index variable */
@@ -2525,44 +2663,59 @@ H5D__chunk_lookup(const H5D_t *dset, hid_t dxpl_id, const hsize_t *scaled,
H5D_chunk_ud_t *udata)
{
H5D_rdcc_ent_t *ent = NULL; /* Cache entry */
- hbool_t found = FALSE; /* In cache? */
- unsigned u; /* Counter */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5O_storage_chunk_t *sc = &(dset->shared->layout.storage.u.chunk);
+ unsigned idx; /* Index of chunk in cache, if present */
+ hbool_t found = FALSE; /* In cache? */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
+ /* Sanity checks */
HDassert(dset);
HDassert(dset->shared->layout.u.chunk.ndims > 0);
+ H5D_CHUNK_STORAGE_INDEX_CHK(sc);
HDassert(scaled);
HDassert(udata);
/* Initialize the query information about the chunk we are looking for */
udata->common.layout = &(dset->shared->layout.u.chunk);
udata->common.storage = &(dset->shared->layout.storage.u.chunk);
- udata->common.scaled = scaled;
+ udata->common.scaled = scaled;
/* Reset information about the chunk we are looking for */
udata->chunk_block.offset = HADDR_UNDEF;
udata->chunk_block.length = 0;
udata->filter_mask = 0;
+ udata->new_unfilt_chunk = FALSE;
/* Check for chunk in cache */
if(dset->shared->cache.chunk.nslots > 0) {
- udata->idx_hint = H5D__chunk_hash_val(dset->shared, scaled);
- ent = dset->shared->cache.chunk.slot[udata->idx_hint];
+ /* Determine the chunk's location in the hash table */
+ idx = H5D__chunk_hash_val(dset->shared, scaled);
+
+ /* Get the chunk cache entry for that location */
+ ent = dset->shared->cache.chunk.slot[idx];
+ if(ent) {
+ unsigned u; /* Counter */
- if(ent)
- for(u = 0, found = TRUE; u < dset->shared->ndims; u++)
+ /* Speculatively set the 'found' flag */
+ found = TRUE;
+
+ /* Verify that the cache entry is the correct chunk */
+ for(u = 0; u < dset->shared->ndims; u++)
if(scaled[u] != ent->scaled[u]) {
found = FALSE;
break;
} /* end if */
+ } /* end if */
} /* end if */
- /* Find chunk addr */
+ /* Retrieve chunk addr */
if(found) {
+ udata->idx_hint = idx;
udata->chunk_block.offset = ent->chunk_block.offset;
udata->chunk_block.length = ent->chunk_block.length;;
+ udata->chunk_idx = ent->chunk_idx;
} /* end if */
else {
/* Invalidate idx_hint, to signal that the chunk is not in cache */
@@ -2571,6 +2724,9 @@ H5D__chunk_lookup(const H5D_t *dset, hid_t dxpl_id, const hsize_t *scaled,
/* Check for cached information */
if(!H5D__chunk_cinfo_cache_found(&dset->shared->cache.chunk.last, udata)) {
H5D_chk_idx_info_t idx_info; /* Chunked index info */
+#ifdef H5_HAVE_PARALLEL
+ H5P_coll_md_read_flag_t temp_cmr; /* Temp value to hold the coll metadata read setting */
+#endif /* H5_HAVE_PARALLEL */
/* Compose chunked index info struct */
idx_info.f = dset->oloc.file;
@@ -2579,10 +2735,26 @@ H5D__chunk_lookup(const H5D_t *dset, hid_t dxpl_id, const hsize_t *scaled,
idx_info.layout = &dset->shared->layout.u.chunk;
idx_info.storage = &dset->shared->layout.storage.u.chunk;
+#ifdef H5_HAVE_PARALLEL
+ if(H5F_HAS_FEATURE(idx_info.f, H5FD_FEAT_HAS_MPI)) {
+ /* disable collective metadata read for chunk indexes
+ as it is highly unlikely that users would read the
+ same chunks from all processes. MSC - might turn on
+ for root node? */
+ temp_cmr = H5F_COLL_MD_READ(idx_info.f);
+ H5F_set_coll_md_read(idx_info.f, H5P_FORCE_FALSE);
+ } /* end if */
+#endif /* H5_HAVE_PARALLEL */
+
/* Go get the chunk information */
if((dset->shared->layout.storage.u.chunk.ops->get_addr)(&idx_info, udata) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't query chunk address")
+#ifdef H5_HAVE_PARALLEL
+ if(H5F_HAS_FEATURE(idx_info.f, H5FD_FEAT_HAS_MPI))
+ H5F_set_coll_md_read(idx_info.f, temp_cmr);
+#endif /* H5_HAVE_PARALLEL */
+
/* Cache the information retrieved */
H5D__chunk_cinfo_cache_update(&dset->shared->cache.chunk.last, udata);
} /* end if */
@@ -2614,12 +2786,14 @@ H5D__chunk_flush_entry(const H5D_t *dset, hid_t dxpl_id, const H5D_dxpl_cache_t
{
void *buf = NULL; /* Temporary buffer */
hbool_t point_of_no_return = FALSE;
+ H5O_storage_chunk_t *sc = &(dset->shared->layout.storage.u.chunk);
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC_TAG(dxpl_id, dset->oloc.addr, FAIL)
HDassert(dset);
HDassert(dset->shared);
+ H5D_CHUNK_STORAGE_INDEX_CHK(sc);
HDassert(dxpl_cache);
HDassert(ent);
HDassert(!ent->locked);
@@ -2638,9 +2812,11 @@ H5D__chunk_flush_entry(const H5D_t *dset, hid_t dxpl_id, const H5D_dxpl_cache_t
udata.chunk_block.offset = ent->chunk_block.offset;
udata.chunk_block.length = dset->shared->layout.u.chunk.size;
udata.filter_mask = 0;
+ udata.chunk_idx = ent->chunk_idx;
/* Should the chunk be filtered before writing it to disk? */
- if(dset->shared->dcpl_cache.pline.nused) {
+ if(dset->shared->dcpl_cache.pline.nused
+ && !(ent->edge_chunk_state & H5D_RDCC_DISABLE_FILTERS)) {
size_t alloc = udata.chunk_block.length; /* Bytes allocated for BUF */
size_t nbytes; /* Chunk size (in bytes) */
@@ -2679,10 +2855,27 @@ H5D__chunk_flush_entry(const H5D_t *dset, hid_t dxpl_id, const H5D_dxpl_cache_t
/* Indicate that the chunk must be allocated */
must_alloc = TRUE;
} /* end if */
- else if(!H5F_addr_defined(udata.chunk_block.offset))
+ else if(!H5F_addr_defined(udata.chunk_block.offset)) {
/* Indicate that the chunk must be allocated */
must_alloc = TRUE;
+ /* This flag could be set for this chunk, just remove and ignore it
+ */
+ ent->edge_chunk_state &= ~H5D_RDCC_NEWLY_DISABLED_FILTERS;
+ } /* end else */
+ else if(ent->edge_chunk_state & H5D_RDCC_NEWLY_DISABLED_FILTERS) {
+ /* Chunk on disk is still filtered, must insert to allocate correct
+ * size */
+ must_alloc = TRUE;
+
+ /* Set the disable filters field back to the standard disable
+ * filters setting, as it no longer needs to be inserted with every
+ * flush */
+ ent->edge_chunk_state &= ~H5D_RDCC_NEWLY_DISABLED_FILTERS;
+ } /* end else */
+
+ HDassert(!(ent->edge_chunk_state & H5D_RDCC_NEWLY_DISABLED_FILTERS));
+
/* Check if the chunk needs to be allocated (it also could exist already
* and the chunk alloc operation could resize it)
*/
@@ -2708,7 +2901,7 @@ H5D__chunk_flush_entry(const H5D_t *dset, hid_t dxpl_id, const H5D_dxpl_cache_t
/* Write the data to the file */
HDassert(H5F_addr_defined(udata.chunk_block.offset));
H5_CHECK_OVERFLOW(udata.chunk_block.length, hsize_t, size_t);
- if(H5F_block_write(dset->oloc.file, H5FD_MEM_DRAW, udata.chunk_block.offset, (size_t)udata.chunk_block.length, dxpl_id, buf) < 0)
+ if(H5F_block_write(dset->oloc.file, H5FD_MEM_DRAW, udata.chunk_block.offset, (size_t)udata.chunk_block.length, H5AC_rawdata_dxpl_id, buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to write raw data to file")
/* Insert the chunk record into the index */
@@ -2732,7 +2925,9 @@ H5D__chunk_flush_entry(const H5D_t *dset, hid_t dxpl_id, const H5D_dxpl_cache_t
if(buf == ent->chunk)
buf = NULL;
if(ent->chunk != NULL)
- ent->chunk = (uint8_t *)H5D__chunk_mem_xfree(ent->chunk, &(dset->shared->dcpl_cache.pline));
+ ent->chunk = (uint8_t *)H5D__chunk_mem_xfree(ent->chunk,
+ ((ent->edge_chunk_state & H5D_RDCC_DISABLE_FILTERS) ? NULL
+ : &(dset->shared->dcpl_cache.pline)));
} /* end if */
done:
@@ -2748,7 +2943,9 @@ done:
*/
if(ret_value < 0 && point_of_no_return)
if(ent->chunk)
- ent->chunk = (uint8_t *)H5D__chunk_mem_xfree(ent->chunk, &(dset->shared->dcpl_cache.pline));
+ ent->chunk = (uint8_t *)H5D__chunk_mem_xfree(ent->chunk,
+ ((ent->edge_chunk_state & H5D_RDCC_DISABLE_FILTERS) ? NULL
+ : &(dset->shared->dcpl_cache.pline)));
FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL)
} /* end H5D__chunk_flush_entry() */
@@ -2790,7 +2987,9 @@ H5D__chunk_cache_evict(const H5D_t *dset, hid_t dxpl_id, const H5D_dxpl_cache_t
else {
/* Don't flush, just free chunk */
if(ent->chunk != NULL)
- ent->chunk = (uint8_t *)H5D__chunk_mem_xfree(ent->chunk, &(dset->shared->dcpl_cache.pline));
+ ent->chunk = (uint8_t *)H5D__chunk_mem_xfree(ent->chunk,
+ ((ent->edge_chunk_state & H5D_RDCC_DISABLE_FILTERS) ? NULL
+ : &(dset->shared->dcpl_cache.pline)));
} /* end else */
/* Unlink from list */
@@ -2804,8 +3003,19 @@ H5D__chunk_cache_evict(const H5D_t *dset, hid_t dxpl_id, const H5D_dxpl_cache_t
rdcc->tail = ent->prev;
ent->prev = ent->next = NULL;
- /* Only clear hash table slot if chunk was not marked as deleted already */
- if(!ent->deleted)
+ /* Unlink from temporary list */
+ if(ent->tmp_prev) {
+ HDassert(rdcc->tmp_head->tmp_next);
+ ent->tmp_prev->tmp_next = ent->tmp_next;
+ if(ent->tmp_next) {
+ ent->tmp_next->tmp_prev = ent->tmp_prev;
+ ent->tmp_next = NULL;
+ } /* end if */
+ ent->tmp_prev = NULL;
+ } /* end if */
+ else
+ /* Only clear hash table slot if the chunk was not on the temporary list
+ */
rdcc->slot[ent->idx] = NULL;
/* Remove from cache */
@@ -2956,12 +3166,13 @@ done:
*
*-------------------------------------------------------------------------
*/
-void *
+static void *
H5D__chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata,
- hbool_t relax)
+ hbool_t relax, hbool_t prev_unfilt_chunk)
{
const H5D_t *dset = io_info->dset; /* Local pointer to the dataset info */
const H5O_pline_t *pline = &(dset->shared->dcpl_cache.pline); /* I/O pipeline info - always equal to the pline passed to H5D__chunk_mem_alloc */
+ const H5O_pline_t *old_pline = pline; /* Old pipeline, i.e. pipeline used to read the chunk */
const H5O_layout_t *layout = &(dset->shared->layout); /* Dataset layout */
const H5O_fill_t *fill = &(dset->shared->dcpl_cache.fill); /* Fill value info */
H5D_fill_buf_info_t fb_info; /* Dataset's fill buffer info */
@@ -2969,17 +3180,21 @@ H5D__chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata,
H5D_rdcc_t *rdcc = &(dset->shared->cache.chunk); /*raw data chunk cache*/
H5D_rdcc_ent_t *ent; /*cache entry */
size_t chunk_size; /*size of a chunk */
+ hbool_t disable_filters = FALSE; /* Whether to disable filters (when adding to cache) */
void *chunk = NULL; /*the file chunk */
void *ret_value = NULL; /* Return value */
- FUNC_ENTER_PACKAGE
+ FUNC_ENTER_STATIC
HDassert(io_info);
HDassert(io_info->dxpl_cache);
HDassert(io_info->store);
HDassert(udata);
HDassert(dset);
- HDassert(TRUE == H5P_isa_class(io_info->dxpl_id, H5P_DATASET_XFER));
+ HDassert(TRUE == H5P_isa_class(io_info->md_dxpl_id, H5P_DATASET_XFER));
+ HDassert(TRUE == H5P_isa_class(io_info->raw_dxpl_id, H5P_DATASET_XFER));
+ HDassert(!(udata->new_unfilt_chunk && prev_unfilt_chunk));
+ HDassert(!rdcc->tmp_head);
/* Get the chunk's size */
HDassert(layout->u.chunk.size > 0);
@@ -2999,7 +3214,7 @@ H5D__chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata,
unsigned u; /*counters */
/* Make sure this is the right chunk */
- for(u = 0; u < layout->u.chunk.ndims; u++)
+ for(u = 0; u < layout->u.chunk.ndims - 1; u++)
HDassert(io_info->store->chunk.scaled[u] == ent->scaled[u]);
}
#endif /* NDEBUG */
@@ -3009,6 +3224,66 @@ H5D__chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata,
*/
rdcc->stats.nhits++;
+ /* Make adjustments if the edge chunk status changed recently */
+ if(pline->nused) {
+ /* If the chunk recently became an unfiltered partial edge chunk
+ * while in cache, we must make some changes to the entry */
+ if(udata->new_unfilt_chunk) {
+ /* If this flag is set then partial chunk filters must be
+ * disabled, and the chunk must not have previously been a
+ * partial chunk (with disabled filters) */
+ HDassert(layout->u.chunk.flags
+ & H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS);
+ HDassert(!(ent->edge_chunk_state & H5D_RDCC_DISABLE_FILTERS));
+ HDassert(old_pline->nused);
+
+ /* Disable filters. Set pline to NULL instead of just the
+ * default pipeline to make a quick failure more likely if the
+ * code is changed in an inappropriate/incomplete way. */
+ pline = NULL;
+
+ /* Reallocate the chunk so H5D__chunk_mem_xfree doesn't get confused
+ */
+ if(NULL == (chunk = H5D__chunk_mem_alloc(chunk_size, pline)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for raw data chunk")
+ HDmemcpy(chunk, ent->chunk, chunk_size);
+ ent->chunk = (uint8_t *)H5D__chunk_mem_xfree(ent->chunk, old_pline);
+ ent->chunk = (uint8_t *)chunk;
+ chunk = NULL;
+
+ /* Mark the chunk as having filters disabled as well as "newly
+ * disabled" so it is inserted on flush */
+ ent->edge_chunk_state |= H5D_RDCC_DISABLE_FILTERS;
+ ent->edge_chunk_state |= H5D_RDCC_NEWLY_DISABLED_FILTERS;
+ } /* end if */
+ else if(prev_unfilt_chunk) {
+ /* If this flag is set then partial chunk filters must be
+ * disabled, and the chunk must have previously been a partial
+ * chunk (with disabled filters) */
+ HDassert(layout->u.chunk.flags
+ & H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS);
+ HDassert((ent->edge_chunk_state & H5D_RDCC_DISABLE_FILTERS));
+ HDassert(pline->nused);
+
+ /* Mark the old pipeline as having been disabled */
+ old_pline = NULL;
+
+ /* Reallocate the chunk so H5D__chunk_mem_xfree doesn't get confused
+ */
+ if(NULL == (chunk = H5D__chunk_mem_alloc(chunk_size, pline)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for raw data chunk")
+ HDmemcpy(chunk, ent->chunk, chunk_size);
+
+ ent->chunk = (uint8_t *)H5D__chunk_mem_xfree(ent->chunk, old_pline);
+ ent->chunk = (uint8_t *)chunk;
+ chunk = NULL;
+
+ /* Mark the chunk as having filters enabled */
+ ent->edge_chunk_state &= ~(H5D_RDCC_DISABLE_FILTERS
+ | H5D_RDCC_NEWLY_DISABLED_FILTERS);
+ } /* end else */
+ } /* end if */
+
/*
* If the chunk is not at the beginning of the cache; move it backward
* by one slot. This is how we implement the LRU preemption
@@ -3037,6 +3312,39 @@ H5D__chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata,
chunk_addr = udata->chunk_block.offset;
chunk_alloc = udata->chunk_block.length;
+ /* Check if we should disable filters on this chunk */
+ if(pline->nused) {
+ if(udata->new_unfilt_chunk) {
+ HDassert(layout->u.chunk.flags
+ & H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS);
+
+ /* Disable the filters for writing */
+ disable_filters = TRUE;
+ pline = NULL;
+ } /* end if */
+ else if(prev_unfilt_chunk) {
+ HDassert(layout->u.chunk.flags
+ & H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS);
+
+ /* Mark the filters as having been previously disabled (for the
+ * chunk as currently on disk) - disable the filters for reading
+ */
+ old_pline = NULL;
+ } /* end if */
+ else if(layout->u.chunk.flags
+ & H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS) {
+ /* Check if this is an edge chunk */
+ if(H5D__chunk_is_partial_edge_chunk(io_info->dset->shared->ndims,
+ layout->u.chunk.dim, io_info->store->chunk.scaled,
+ io_info->dset->shared->curr_dims)) {
+ /* Disable the filters for both writing and reading */
+ disable_filters = TRUE;
+ old_pline = NULL;
+ pline = NULL;
+ } /* end if */
+ } /* end if */
+ } /* end if */
+
if(relax) {
/*
* Not in the cache, but we're about to overwrite the whole thing
@@ -3066,16 +3374,32 @@ H5D__chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata,
/* Chunk size on disk isn't [likely] the same size as the final chunk
* size in memory, so allocate memory big enough. */
- if(NULL == (chunk = H5D__chunk_mem_alloc(my_chunk_alloc, pline)))
+ if(NULL == (chunk = H5D__chunk_mem_alloc(my_chunk_alloc, (udata->new_unfilt_chunk ? old_pline : pline))))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for raw data chunk")
- if(H5F_block_read(dset->oloc.file, H5FD_MEM_DRAW, chunk_addr, my_chunk_alloc, io_info->dxpl_id, chunk) < 0)
+ if(H5F_block_read(dset->oloc.file, H5FD_MEM_DRAW, chunk_addr, my_chunk_alloc, io_info->raw_dxpl_id, chunk) < 0)
HGOTO_ERROR(H5E_IO, H5E_READERROR, NULL, "unable to read raw data chunk")
- if(pline->nused)
- if(H5Z_pipeline(pline, H5Z_FLAG_REVERSE, &(udata->filter_mask), io_info->dxpl_cache->err_detect,
- io_info->dxpl_cache->filter_cb, &my_chunk_alloc, &buf_alloc, &chunk) < 0)
+ if(old_pline && old_pline->nused) {
+ if(H5Z_pipeline(old_pline, H5Z_FLAG_REVERSE,
+ &(udata->filter_mask),
+ io_info->dxpl_cache->err_detect,
+ io_info->dxpl_cache->filter_cb,
+ &my_chunk_alloc, &buf_alloc, &chunk) < 0)
HGOTO_ERROR(H5E_PLINE, H5E_CANTFILTER, NULL, "data pipeline read failed")
+ /* Reallocate chunk if necessary */
+ if(udata->new_unfilt_chunk) {
+ void *tmp_chunk = chunk;
+
+ if(NULL == (chunk = H5D__chunk_mem_alloc(my_chunk_alloc, pline))) {
+ (void)H5D__chunk_mem_xfree(tmp_chunk, old_pline);
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for raw data chunk")
+ } /* end if */
+ HDmemcpy(chunk, tmp_chunk, chunk_size);
+ (void)H5D__chunk_mem_xfree(tmp_chunk, old_pline);
+ } /* end if */
+ } /* end if */
+
/* Increment # of cache misses */
rdcc->stats.nmisses++;
} /* end if */
@@ -3106,14 +3430,14 @@ H5D__chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata,
/* (use the compact dataset storage buffer as the fill value buffer) */
if(H5D__fill_init(&fb_info, chunk, NULL, NULL, NULL, NULL,
&dset->shared->dcpl_cache.fill, dset->shared->type,
- dset->shared->type_id, (size_t)0, chunk_size, io_info->dxpl_id) < 0)
+ dset->shared->type_id, (size_t)0, chunk_size, io_info->md_dxpl_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "can't initialize fill buffer info")
fb_info_init = TRUE;
/* Check for VL datatype & non-default fill value */
if(fb_info.has_vlen_fill_type)
/* Fill the buffer with VL datatype fill values */
- if(H5D__fill_refill_vl(&fb_info, fb_info.elmts_per_buf, io_info->dxpl_id) < 0)
+ if(H5D__fill_refill_vl(&fb_info, fb_info.elmts_per_buf, io_info->md_dxpl_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCONVERT, NULL, "can't refill fill value buffer")
} /* end if */
else
@@ -3134,19 +3458,24 @@ H5D__chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata,
if(!ent || !ent->locked) {
/* Preempt enough things from the cache to make room */
if(ent) {
- if(H5D__chunk_cache_evict(io_info->dset, io_info->dxpl_id, io_info->dxpl_cache, ent, TRUE) < 0)
+ if(H5D__chunk_cache_evict(io_info->dset, io_info->md_dxpl_id, io_info->dxpl_cache, ent, TRUE) < 0)
HGOTO_ERROR(H5E_IO, H5E_CANTINIT, NULL, "unable to preempt chunk from cache")
} /* end if */
- if(H5D__chunk_cache_prune(io_info->dset, io_info->dxpl_id, io_info->dxpl_cache, chunk_size) < 0)
+ if(H5D__chunk_cache_prune(io_info->dset, io_info->md_dxpl_id, io_info->dxpl_cache, chunk_size) < 0)
HGOTO_ERROR(H5E_IO, H5E_CANTINIT, NULL, "unable to preempt chunk(s) from cache")
/* Create a new entry */
if(NULL == (ent = H5FL_CALLOC(H5D_rdcc_ent_t)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, NULL, "can't allocate raw data chunk entry")
+ ent->edge_chunk_state = disable_filters ? H5D_RDCC_DISABLE_FILTERS : 0;
+ if(udata->new_unfilt_chunk)
+ ent->edge_chunk_state |= H5D_RDCC_NEWLY_DISABLED_FILTERS;
+
/* Initialize the new entry */
ent->chunk_block.offset = chunk_addr;
ent->chunk_block.length = chunk_alloc;
+ ent->chunk_idx = udata->chunk_idx;
HDmemcpy(ent->scaled, udata->common.scaled, sizeof(hsize_t) * layout->u.chunk.ndims);
H5_CHECKED_ASSIGN(ent->rd_count, uint32_t, chunk_size, size_t);
H5_CHECKED_ASSIGN(ent->wr_count, uint32_t, chunk_size, size_t);
@@ -3167,6 +3496,9 @@ H5D__chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata,
} /* end if */
else
rdcc->head = rdcc->tail = ent;
+ ent->tmp_next = NULL;
+ ent->tmp_prev = NULL;
+
} /* end if */
else
/* We did not add the chunk to cache */
@@ -3229,7 +3561,7 @@ done:
*
*-------------------------------------------------------------------------
*/
-herr_t
+static herr_t
H5D__chunk_unlock(const H5D_io_info_t *io_info, const H5D_chunk_ud_t *udata,
hbool_t dirty, void *chunk, uint32_t naccessed)
{
@@ -3237,8 +3569,9 @@ H5D__chunk_unlock(const H5D_io_info_t *io_info, const H5D_chunk_ud_t *udata,
const H5D_rdcc_t *rdcc = &(io_info->dset->shared->cache.chunk);
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_PACKAGE
+ FUNC_ENTER_STATIC
+ /* Sanity check */
HDassert(io_info);
HDassert(udata);
@@ -3246,26 +3579,45 @@ H5D__chunk_unlock(const H5D_io_info_t *io_info, const H5D_chunk_ud_t *udata,
/*
* It's not in the cache, probably because it's too big. If it's
* dirty then flush it to disk. In any case, free the chunk.
- * Note: we have to copy the layout and filter messages so we
- * don't discard the `const' qualifier.
*/
+ hbool_t is_unfiltered_edge_chunk = FALSE; /* Whether the chunk is an unfiltered edge chunk */
+
+ /* Check if we should disable filters on this chunk */
+ if(udata->new_unfilt_chunk) {
+ HDassert(layout->u.chunk.flags & H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS);
+
+ is_unfiltered_edge_chunk = TRUE;
+ } /* end if */
+ else if(layout->u.chunk.flags & H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS) {
+ /* Check if the chunk is an edge chunk, and disable filters if so */
+ is_unfiltered_edge_chunk = H5D__chunk_is_partial_edge_chunk(
+ io_info->dset->shared->ndims, layout->u.chunk.dim,
+ io_info->store->chunk.scaled, io_info->dset->shared->curr_dims);
+ } /* end if */
+
if(dirty) {
H5D_rdcc_ent_t fake_ent; /* "fake" chunk cache entry */
HDmemset(&fake_ent, 0, sizeof(fake_ent));
fake_ent.dirty = TRUE;
+ if(is_unfiltered_edge_chunk)
+ fake_ent.edge_chunk_state = H5D_RDCC_DISABLE_FILTERS;
+ if(udata->new_unfilt_chunk)
+ fake_ent.edge_chunk_state |= H5D_RDCC_NEWLY_DISABLED_FILTERS;
HDmemcpy(fake_ent.scaled, udata->common.scaled, sizeof(hsize_t) * layout->u.chunk.ndims);
HDassert(layout->u.chunk.size > 0);
+ fake_ent.chunk_idx = udata->chunk_idx;
fake_ent.chunk_block.offset = udata->chunk_block.offset;
fake_ent.chunk_block.length = udata->chunk_block.length;
fake_ent.chunk = (uint8_t *)chunk;
- if(H5D__chunk_flush_entry(io_info->dset, io_info->dxpl_id, io_info->dxpl_cache, &fake_ent, TRUE) < 0)
+ if(H5D__chunk_flush_entry(io_info->dset, io_info->md_dxpl_id, io_info->dxpl_cache, &fake_ent, TRUE) < 0)
HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "cannot flush indexed storage buffer")
} /* end if */
else {
if(chunk)
- chunk = H5D__chunk_mem_xfree(chunk, &(io_info->dset->shared->dcpl_cache.pline));
+ chunk = H5D__chunk_mem_xfree(chunk, (is_unfiltered_edge_chunk ? NULL
+ : &(io_info->dset->shared->dcpl_cache.pline)));
} /* end else */
} /* end if */
else {
@@ -3344,12 +3696,14 @@ H5D__chunk_allocated(H5D_t *dset, hid_t dxpl_id, hsize_t *nbytes)
H5D_dxpl_cache_t _dxpl_cache; /* Data transfer property cache buffer */
H5D_dxpl_cache_t *dxpl_cache = &_dxpl_cache; /* Data transfer property cache */
hsize_t chunk_bytes = 0; /* Number of bytes allocated for chunks */
+ H5O_storage_chunk_t *sc = &(dset->shared->layout.storage.u.chunk);
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
HDassert(dset);
HDassert(dset->shared);
+ H5D_CHUNK_STORAGE_INDEX_CHK(sc);
/* Fill the DXPL cache values for later use */
if(H5D__get_dxpl_cache(dxpl_id, &dxpl_cache) < 0)
@@ -3396,9 +3750,9 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5D__chunk_allocate(const H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite,
- hsize_t old_dim[])
+H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_t old_dim[])
{
+ const H5D_t *dset = io_info->dset; /* the dataset pointer */
H5D_chk_idx_info_t idx_info; /* Chunked index info */
const H5D_chunk_ops_t *ops = dset->shared->layout.storage.u.chunk.ops; /* Chunk operations */
hsize_t min_unalloc[H5O_LAYOUT_NDIMS]; /* First chunk in each dimension that is unallocated (in scaled coordinates) */
@@ -3409,9 +3763,12 @@ H5D__chunk_allocate(const H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite,
unsigned filter_mask = 0; /* Filter mask for chunks that have them */
const H5O_layout_t *layout = &(dset->shared->layout); /* Dataset layout */
const H5O_pline_t *pline = &(dset->shared->dcpl_cache.pline); /* I/O pipeline info */
+ const H5O_pline_t def_pline = H5O_CRT_PIPELINE_DEF; /* Default pipeline */
const H5O_fill_t *fill = &(dset->shared->dcpl_cache.fill); /* Fill value info */
H5D_fill_value_t fill_status; /* The fill value status */
hbool_t should_fill = FALSE; /* Whether fill values should be written */
+ void *unfilt_fill_buf = NULL; /* Unfiltered fill value buffer */
+ void **fill_buf = NULL; /* Pointer to the fill buffer to use for a chunk */
H5D_dxpl_cache_t _dxpl_cache; /* Data transfer property cache buffer */
H5D_dxpl_cache_t *dxpl_cache = &_dxpl_cache; /* Data transfer property cache */
#ifdef H5_HAVE_PARALLEL
@@ -3419,6 +3776,8 @@ H5D__chunk_allocate(const H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite,
hbool_t using_mpi = FALSE; /* Flag to indicate that the file is being accessed with an MPI-capable file driver */
H5D_chunk_coll_info_t chunk_info; /* chunk address information for doing I/O */
#endif /* H5_HAVE_PARALLEL */
+ hid_t md_dxpl_id = io_info->md_dxpl_id;
+ hid_t raw_dxpl_id = io_info->raw_dxpl_id;
hbool_t carry; /* Flag to indicate that chunk increment carrys to higher dimension (sorta) */
unsigned space_ndims; /* Dataset's space rank */
const hsize_t *space_dim; /* Dataset's dataspace dimensions */
@@ -3426,14 +3785,21 @@ H5D__chunk_allocate(const H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite,
unsigned op_dim; /* Current operating dimension */
H5D_fill_buf_info_t fb_info; /* Dataset's fill buffer info */
hbool_t fb_info_init = FALSE; /* Whether the fill value buffer has been initialized */
+ hbool_t has_unfilt_edge_chunks = FALSE; /* Whether there are partial edge chunks with disabled filters */
+ hbool_t unfilt_edge_chunk_dim[H5O_LAYOUT_NDIMS]; /* Whether there are unfiltered edge chunks at the edge of each dimension */
+ hsize_t edge_chunk_scaled[H5O_LAYOUT_NDIMS]; /* Offset of the unfiltered edge chunks at the edge of each dimension */
+ unsigned nunfilt_edge_chunk_dims = 0; /* Number of dimensions on an edge */
+ const H5O_storage_chunk_t *sc = &(layout->storage.u.chunk);
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_PACKAGE_TAG(dxpl_id, dset->oloc.addr, FAIL)
+ FUNC_ENTER_PACKAGE_TAG(md_dxpl_id, dset->oloc.addr, FAIL)
/* Check args */
HDassert(dset && H5D_CHUNKED == layout->type);
HDassert(layout->u.chunk.ndims > 0 && layout->u.chunk.ndims <= H5O_LAYOUT_NDIMS);
- HDassert(TRUE == H5P_isa_class(dxpl_id, H5P_DATASET_XFER));
+ H5D_CHUNK_STORAGE_INDEX_CHK(sc);
+ HDassert(TRUE == H5P_isa_class(md_dxpl_id, H5P_DATASET_XFER));
+ HDassert(TRUE == H5P_isa_class(raw_dxpl_id, H5P_DATASET_XFER));
/* Retrieve the dataset dimensions */
space_dim = dset->shared->curr_dims;
@@ -3464,9 +3830,32 @@ H5D__chunk_allocate(const H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite,
#endif /* H5_HAVE_PARALLEL */
/* Fill the DXPL cache values for later use */
- if(H5D__get_dxpl_cache(dxpl_id, &dxpl_cache) < 0)
+ if(H5D__get_dxpl_cache(raw_dxpl_id, &dxpl_cache) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't fill dxpl cache")
+ /* Calculate the minimum and maximum chunk offsets in each dimension, and
+ * determine if there are any unfiltered partial edge chunks. Note that we
+ * assume here that all elements of space_dim are > 0. This is checked at
+ * the top of this function. */
+ for(op_dim=0; op_dim<space_ndims; op_dim++) {
+ min_unalloc[op_dim] = (old_dim[op_dim] + chunk_dim[op_dim] - 1) / chunk_dim[op_dim];
+ max_unalloc[op_dim] = (space_dim[op_dim] - 1) / chunk_dim[op_dim];
+
+ /* Calculate if there are unfiltered edge chunks at the edge of this
+ * dimension. Note the edge_chunk_scaled is uninitialized for
+ * dimensions where unfilt_edge_chunk_dim is FALSE. Also */
+ if((layout->u.chunk.flags
+ & H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS)
+ && pline->nused > 0
+ && space_dim[op_dim] % chunk_dim[op_dim] != 0) {
+ has_unfilt_edge_chunks = TRUE;
+ unfilt_edge_chunk_dim[op_dim] = TRUE;
+ edge_chunk_scaled[op_dim] = max_unalloc[op_dim];
+ } /* end if */
+ else
+ unfilt_edge_chunk_dim[op_dim] = FALSE;
+ } /* end for */
+
/* Get original chunk size */
H5_CHECKED_ASSIGN(orig_chunk_size, size_t, layout->u.chunk.size, uint32_t);
@@ -3494,10 +3883,15 @@ H5D__chunk_allocate(const H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite,
if(H5D__fill_init(&fb_info, NULL, (H5MM_allocate_t)H5D__chunk_mem_alloc,
(void *)pline, (H5MM_free_t)H5D__chunk_mem_xfree, (void *)pline,
&dset->shared->dcpl_cache.fill, dset->shared->type,
- dset->shared->type_id, (size_t)0, orig_chunk_size, dxpl_id) < 0)
+ dset->shared->type_id, (size_t)0, orig_chunk_size, md_dxpl_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't initialize fill buffer info")
fb_info_init = TRUE;
+ /* Initialize the fill_buf pointer to the buffer in fb_info. If edge
+ * chunk filters are disabled, we will switch the buffer as appropriate
+ * for each chunk. */
+ fill_buf = &fb_info.fill_buf;
+
/* Check if there are filters which need to be applied to the chunk */
/* (only do this in advance when the chunk info can be re-used (i.e.
* it doesn't contain any non-default VL datatype fill values)
@@ -3505,6 +3899,14 @@ H5D__chunk_allocate(const H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite,
if(!fb_info.has_vlen_fill_type && pline->nused > 0) {
size_t buf_size = orig_chunk_size;
+ /* If the dataset has disabled partial chunk filters, create a copy
+ * of the unfiltered fill_buf to use for partial chunks */
+ if(has_unfilt_edge_chunks) {
+ if(NULL == (unfilt_fill_buf = H5D__chunk_mem_alloc(orig_chunk_size, &def_pline)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for raw data chunk")
+ HDmemcpy(unfilt_fill_buf, fb_info.fill_buf, orig_chunk_size);
+ } /* end if */
+
/* Push the chunk through the filters */
if(H5Z_pipeline(pline, 0, &filter_mask, dxpl_cache->err_detect, dxpl_cache->filter_cb, &orig_chunk_size, &buf_size, &fb_info.fill_buf) < 0)
HGOTO_ERROR(H5E_PLINE, H5E_WRITEERROR, FAIL, "output pipeline failed")
@@ -3518,19 +3920,11 @@ H5D__chunk_allocate(const H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite,
/* Compose chunked index info struct */
idx_info.f = dset->oloc.file;
- idx_info.dxpl_id = dxpl_id;
+ idx_info.dxpl_id = md_dxpl_id;
idx_info.pline = &dset->shared->dcpl_cache.pline;
idx_info.layout = &dset->shared->layout.u.chunk;
idx_info.storage = &dset->shared->layout.storage.u.chunk;
- /* Calculate the minimum and maximum chunk offsets in each dimension. Note
- * that we assume here that all elements of space_dim are > 0. This is
- * checked at the top of this function. */
- for(op_dim = 0; op_dim < (unsigned)space_ndims; op_dim++) {
- min_unalloc[op_dim] = (old_dim[op_dim] + chunk_dim[op_dim] - 1) / chunk_dim[op_dim];
- max_unalloc[op_dim] = (space_dim[op_dim] - 1) / chunk_dim[op_dim];
- } /* end for */
-
/* Loop over all chunks */
/* The algorithm is:
* For each dimension:
@@ -3552,8 +3946,10 @@ H5D__chunk_allocate(const H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite,
* Note that min_unalloc & max_unalloc are in scaled coordinates.
*
*/
+ chunk_size = orig_chunk_size;
for(op_dim = 0; op_dim < space_ndims; op_dim++) {
H5D_chunk_ud_t udata; /* User data for querying chunk info */
+ unsigned u; /* Local index variable */
int i; /* Local index variable */
/* Check if allocation along this dimension is really necessary */
@@ -3564,34 +3960,50 @@ H5D__chunk_allocate(const H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite,
HDmemset(scaled, 0, (space_ndims * sizeof(scaled[0])));
scaled[op_dim] = min_unalloc[op_dim];
+ if(has_unfilt_edge_chunks) {
+ /* Initialize nunfilt_edge_chunk_dims */
+ nunfilt_edge_chunk_dims = 0;
+ for(u = 0; u < space_ndims; u++)
+ if(unfilt_edge_chunk_dim[u] && scaled[u]
+ == edge_chunk_scaled[u])
+ nunfilt_edge_chunk_dims++;
+
+ /* Initialize chunk_size and fill_buf */
+ if(should_fill && !fb_info.has_vlen_fill_type) {
+ HDassert(fb_info_init);
+ HDassert(unfilt_fill_buf);
+ if(nunfilt_edge_chunk_dims) {
+ fill_buf = &unfilt_fill_buf;
+ chunk_size = layout->u.chunk.size;
+ } /* end if */
+ else {
+ fill_buf = &fb_info.fill_buf;
+ chunk_size = orig_chunk_size;
+ } /* end else */
+ } /* end if */
+ } /* end if */
+
carry = FALSE;
} /* end else */
while(!carry) {
hbool_t need_insert = FALSE; /* Whether the chunk needs to be inserted into the index */
- /* Reset size of chunk in bytes, in case filtered size changes */
- chunk_size = orig_chunk_size;
-
+ /* Look up this chunk */
+ if(H5D__chunk_lookup(dset, md_dxpl_id, scaled, &udata) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address")
#ifndef NDEBUG
/* None of the chunks should be allocated */
- {
- /* Look up this chunk */
- if(H5D__chunk_lookup(dset, dxpl_id, scaled, &udata) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address")
-
- HDassert(!H5F_addr_defined(udata.chunk_block.offset));
- } /* end block */
/* Make sure the chunk is really in the dataset and outside the
* original dimensions */
{
- unsigned u; /* Local index variable */
+ unsigned v; /* Local index variable */
hbool_t outside_orig = FALSE;
- for(u = 0; u < space_ndims; u++) {
- HDassert((scaled[u] * chunk_dim[u]) < space_dim[u]);
- if((scaled[u] * chunk_dim[u]) >= old_dim[u])
+ for(v = 0; v < space_ndims; v++) {
+ HDassert((scaled[v] * chunk_dim[v]) < space_dim[v]);
+ if((scaled[v] * chunk_dim[v]) >= old_dim[v])
outside_orig = TRUE;
} /* end for */
HDassert(outside_orig);
@@ -3602,6 +4014,7 @@ H5D__chunk_allocate(const H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite,
if(fb_info_init && fb_info.has_vlen_fill_type) {
/* Sanity check */
HDassert(should_fill);
+ HDassert(!unfilt_fill_buf);
#ifdef H5_HAVE_PARALLEL
HDassert(!using_mpi); /* Can't write VL datatypes in parallel currently */
#endif
@@ -3616,11 +4029,11 @@ H5D__chunk_allocate(const H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite,
} /* end if */
/* Fill the buffer with VL datatype fill values */
- if(H5D__fill_refill_vl(&fb_info, fb_info.elmts_per_buf, dxpl_id) < 0)
+ if(H5D__fill_refill_vl(&fb_info, fb_info.elmts_per_buf, md_dxpl_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCONVERT, FAIL, "can't refill fill value buffer")
/* Check if there are filters which need to be applied to the chunk */
- if(pline->nused > 0) {
+ if((pline->nused > 0) && !nunfilt_edge_chunk_dims) {
size_t nbytes = orig_chunk_size;
/* Push the chunk through the filters */
@@ -3636,6 +4049,10 @@ H5D__chunk_allocate(const H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite,
/* Keep the number of bytes the chunk turned in to */
chunk_size = nbytes;
} /* end if */
+ else
+ chunk_size = layout->u.chunk.size;
+
+ HDassert(*fill_buf == fb_info.fill_buf);
} /* end if */
/* Initialize the chunk information */
@@ -3663,8 +4080,11 @@ H5D__chunk_allocate(const H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite,
/* collect all chunk addresses to be written to
write collectively at the end */
/* allocate/resize address array if no more space left */
+ /* Note that if we add support for parallel filters we must
+ * also store an array of chunk sizes and pass it to the
+ * apporpriate collective write function */
if(0 == chunk_info.num_io % 1024)
- if(NULL == (chunk_info.addr = (haddr_t *)HDrealloc(chunk_info.addr, (chunk_info.num_io + 1024) * sizeof(haddr_t))))
+ if(NULL == (chunk_info.addr = (haddr_t *)H5MM_realloc(chunk_info.addr, (chunk_info.num_io + 1024) * sizeof(haddr_t))))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "memory allocation failed for chunk addresses")
/* Store the chunk's address for later */
@@ -3676,7 +4096,7 @@ H5D__chunk_allocate(const H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite,
} /* end if */
else {
#endif /* H5_HAVE_PARALLEL */
- if(H5F_block_write(dset->oloc.file, H5FD_MEM_DRAW, udata.chunk_block.offset, chunk_size, dxpl_id, fb_info.fill_buf) < 0)
+ if(H5F_block_write(dset->oloc.file, H5FD_MEM_DRAW, udata.chunk_block.offset, chunk_size, raw_dxpl_id, *fill_buf) < 0)
HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to write raw data to file")
#ifdef H5_HAVE_PARALLEL
} /* end else */
@@ -3684,9 +4104,6 @@ H5D__chunk_allocate(const H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite,
} /* end if */
/* Insert the chunk record into the index */
- /* (Note that this isn't safe, from a SWMR perspective, unlike
- * serial operation. -QAK
- */
if(need_insert && ops->insert)
if((ops->insert)(&idx_info, &udata, dset) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert chunk addr into index")
@@ -3700,8 +4117,31 @@ H5D__chunk_allocate(const H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite,
scaled[i] = min_unalloc[i];
else
scaled[i] = 0;
- } /* end if */
+
+ /* Check if we just left the edge in this dimension */
+ if(unfilt_edge_chunk_dim[i]
+ && edge_chunk_scaled[i] == max_unalloc[i]
+ && scaled[i] < edge_chunk_scaled[i]) {
+ nunfilt_edge_chunk_dims--;
+ if(should_fill && nunfilt_edge_chunk_dims == 0 && !fb_info.has_vlen_fill_type) {
+ HDassert(!H5D__chunk_is_partial_edge_chunk(space_ndims, chunk_dim, scaled, space_dim));
+ fill_buf = &fb_info.fill_buf;
+ chunk_size = orig_chunk_size;
+ } /* end if */
+ } /* end if */
+ } /* end if */
else {
+ /* Check if we just entered the edge in this dimension */
+ if(unfilt_edge_chunk_dim[i] && scaled[i] == edge_chunk_scaled[i]) {
+ HDassert(edge_chunk_scaled[i] == max_unalloc[i]);
+ nunfilt_edge_chunk_dims++;
+ if(should_fill && nunfilt_edge_chunk_dims == 1 && !fb_info.has_vlen_fill_type) {
+ HDassert(H5D__chunk_is_partial_edge_chunk(space_ndims, chunk_dim, scaled, space_dim));
+ fill_buf = &unfilt_fill_buf;
+ chunk_size = layout->u.chunk.size;
+ } /* end if */
+ } /* end if */
+
carry = FALSE;
break;
} /* end else */
@@ -3720,7 +4160,7 @@ H5D__chunk_allocate(const H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite,
#ifdef H5_HAVE_PARALLEL
/* do final collective I/O */
if(using_mpi && blocks_written)
- if(H5D__chunk_collective_fill(dset, dxpl_id, &chunk_info, chunk_size, fb_info.fill_buf) < 0)
+ if(H5D__chunk_collective_fill(dset, raw_dxpl_id, &chunk_info, chunk_size, fb_info.fill_buf) < 0)
HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to write raw data to file")
#endif /* H5_HAVE_PARALLEL */
@@ -3732,14 +4172,196 @@ done:
if(fb_info_init && H5D__fill_term(&fb_info) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release fill buffer info")
+ /* Free the unfiltered fill value buffer */
+ unfilt_fill_buf = H5D__chunk_mem_xfree(unfilt_fill_buf, &def_pline);
+
#ifdef H5_HAVE_PARALLEL
if(using_mpi && chunk_info.addr)
- HDfree(chunk_info.addr);
+ H5MM_free(chunk_info.addr);
#endif
FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL)
} /* end H5D__chunk_allocate() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__chunk_update_old_edge_chunks
+ *
+ * Purpose: Update all chunks which were previously partial edge
+ * chunks and are now complete. Determines exactly which
+ * chunks need to be updated and locks each into cache using
+ * the 'prev_unfilt_chunk' flag, then unlocks it, causing
+ * filters to be applied as necessary.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Neil Fortner
+ * April 14, 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5D__chunk_update_old_edge_chunks(H5D_t *dset, hid_t dxpl_id, hsize_t old_dim[])
+{
+ hsize_t old_edge_chunk_sc[H5O_LAYOUT_NDIMS]; /* Offset of first previously incomplete chunk in each dimension */
+ hsize_t max_edge_chunk_sc[H5O_LAYOUT_NDIMS]; /* largest offset of chunks that might need to be modified in each dimension */
+ hbool_t new_full_dim[H5O_LAYOUT_NDIMS]; /* Whether the plane of chunks in this dimension needs to be modified */
+ const H5O_layout_t *layout = &(dset->shared->layout); /* Dataset layout */
+ const H5O_pline_t *pline = &(dset->shared->dcpl_cache.pline); /* I/O pipeline info */
+ hsize_t chunk_sc[H5O_LAYOUT_NDIMS]; /* Offset of current chunk */
+ const uint32_t *chunk_dim = layout->u.chunk.dim; /* Convenience pointer to chunk dimensions */
+ unsigned space_ndims; /* Dataset's space rank */
+ const hsize_t *space_dim; /* Dataset's dataspace dimensions */
+ unsigned op_dim; /* Current operationg dimension */
+ H5D_io_info_t chk_io_info; /* Chunked I/O info object */
+ H5D_chunk_ud_t chk_udata; /* User data for locking chunk */
+ H5D_storage_t chk_store; /* Chunk storage information */
+ H5D_dxpl_cache_t _dxpl_cache; /* Data transfer property cache buffer */
+ H5D_dxpl_cache_t *dxpl_cache = &_dxpl_cache; /* Data transfer property cache */
+ void *chunk; /* The file chunk */
+ hbool_t carry; /* Flag to indicate that chunk increment carrys to higher dimension (sorta) */
+ const H5O_storage_chunk_t *sc = &(layout->storage.u.chunk);
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ /* Check args */
+ HDassert(dset && H5D_CHUNKED == layout->type);
+ HDassert(layout->u.chunk.ndims > 0 && layout->u.chunk.ndims <= H5O_LAYOUT_NDIMS);
+ H5D_CHUNK_STORAGE_INDEX_CHK(sc);
+ HDassert(TRUE == H5P_isa_class(dxpl_id, H5P_DATASET_XFER));
+ HDassert(pline->nused > 0);
+ HDassert(layout->u.chunk.flags
+ & H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS);
+
+ /* Retrieve the dataset dimensions */
+ space_dim = dset->shared->curr_dims;
+ space_ndims = dset->shared->ndims;
+
+ /* The last dimension in chunk_offset is always 0 */
+ chunk_sc[space_ndims] = (hsize_t)0;
+
+ /* Check if any current dimensions are smaller than the chunk size, or if
+ * any old dimensions are 0. If so we do not have to do anything. */
+ for(op_dim=0; op_dim<space_ndims; op_dim++)
+ if((space_dim[op_dim] < chunk_dim[op_dim]) || old_dim[op_dim] == 0) {
+ /* Reset any cached chunk info for this dataset */
+ H5D__chunk_cinfo_cache_reset(&dset->shared->cache.chunk.last);
+ HGOTO_DONE(SUCCEED)
+ } /* end if */
+
+ /*
+ * Initialize structures needed to lock chunks into cache
+ */
+ /* Fill the DXPL cache values for later use */
+ if(H5D__get_dxpl_cache(dxpl_id, &dxpl_cache) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't fill dxpl cache")
+
+ /* Set up chunked I/O info object, for operations on chunks (in callback).
+ * Note that we only need to set chunk_offset once, as the array's address
+ * will never change. */
+ chk_store.chunk.scaled = chunk_sc;
+ H5D_BUILD_IO_INFO_RD(&chk_io_info, dset, dxpl_cache, dxpl_id, H5AC_rawdata_dxpl_id, &chk_store, NULL);
+
+ /*
+ * Determine the edges of the dataset which need to be modified
+ */
+ for(op_dim=0; op_dim<space_ndims; op_dim++) {
+ /* Start off with this dimension marked as not needing to be modified */
+ new_full_dim[op_dim] = FALSE;
+
+ /* Calulate offset of first previously incomplete chunk in this
+ * dimension */
+ old_edge_chunk_sc[op_dim] = (old_dim[op_dim] / chunk_dim[op_dim]);
+
+ /* Calculate the largest offset of chunks that might need to be
+ * modified in this dimension */
+ max_edge_chunk_sc[op_dim] = MIN((old_dim[op_dim] - 1) / chunk_dim[op_dim],
+ MAX((space_dim[op_dim] / chunk_dim[op_dim]), 1) - 1);
+
+ /* Check for old_dim aligned with chunk boundary in this dimension, if
+ * so we do not need to modify chunks along the edge in this dimension
+ */
+ if(old_dim[op_dim] % chunk_dim[op_dim] == 0)
+ continue;
+
+ /* Check if the dataspace expanded enough to cause the old edge chunks
+ * in this dimension to become full */
+ if((space_dim[op_dim]/chunk_dim[op_dim]) >= (old_edge_chunk_sc[op_dim] + 1))
+ new_full_dim[op_dim] = TRUE;
+ } /* end for */
+
+ /* Main loop: fix old edge chunks */
+ for(op_dim=0; op_dim<space_ndims; op_dim++) {
+ /* Check if allocation along this dimension is really necessary */
+ if(!new_full_dim[op_dim])
+ continue;
+ else {
+ HDassert(max_edge_chunk_sc[op_dim] == old_edge_chunk_sc[op_dim]);
+
+ /* Reset the chunk offset indices */
+ HDmemset(chunk_sc, 0, (space_ndims * sizeof(chunk_sc[0])));
+ chunk_sc[op_dim] = old_edge_chunk_sc[op_dim];
+
+ carry = FALSE;
+ } /* end if */
+
+ while(!carry) {
+ int i; /* Local index variable */
+
+ /* Make sure the chunk is really a former edge chunk */
+ HDassert(H5D__chunk_is_partial_edge_chunk(space_ndims, chunk_dim, chunk_sc, old_dim)
+ && !H5D__chunk_is_partial_edge_chunk(space_ndims, chunk_dim, chunk_sc, space_dim));
+
+ /* Lookup the chunk */
+ if(H5D__chunk_lookup(dset, dxpl_id, chunk_sc, &chk_udata) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address")
+
+ /* If this chunk does not exist in cache or on disk, no need to do
+ * anything */
+ if(H5F_addr_defined(chk_udata.chunk_block.offset)
+ || (UINT_MAX != chk_udata.idx_hint)) {
+ /* Lock the chunk into cache. H5D__chunk_lock will take care of
+ * updating the chunk to no longer be an edge chunk. */
+ if(NULL == (chunk = (void *)H5D__chunk_lock(&chk_io_info, &chk_udata, FALSE, TRUE)))
+ HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "unable to lock raw data chunk")
+
+ /* Unlock the chunk */
+ if(H5D__chunk_unlock(&chk_io_info, &chk_udata, TRUE, chunk, (uint32_t)0) < 0)
+ HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to unlock raw data chunk")
+ } /* end if */
+
+ /* Increment indices */
+ carry = TRUE;
+ for(i = ((int)space_ndims - 1); i >= 0; --i) {
+ if((unsigned)i != op_dim) {
+ ++chunk_sc[i];
+ if(chunk_sc[i] > (hsize_t) max_edge_chunk_sc[i])
+ chunk_sc[i] = 0;
+ else {
+ carry = FALSE;
+ break;
+ } /* end else */
+ } /* end if */
+ } /* end for */
+ } /* end while(!carry) */
+
+ /* Adjust max_edge_chunk_sc so we don't modify the same chunk twice.
+ * Also check if this dimension started from 0 (and hence modified all
+ * of the old edge chunks. */
+ if(old_edge_chunk_sc[op_dim] == 0)
+ break;
+ else
+ --max_edge_chunk_sc[op_dim];
+ } /* end for(op_dim=0...) */
+
+ /* Reset any cached chunk info for this dataset */
+ H5D__chunk_cinfo_cache_reset(&dset->shared->cache.chunk.last);
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5D__chunk_update_old_edge_chunks() */
+
#ifdef H5_HAVE_PARALLEL
/*-------------------------------------------------------------------------
@@ -3910,7 +4532,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5D__chunk_prune_fill(H5D_chunk_it_ud1_t *udata)
+H5D__chunk_prune_fill(H5D_chunk_it_ud1_t *udata, hbool_t new_unfilt_chunk)
{
const H5D_io_info_t *io_info = udata->io_info; /* Local pointer to I/O info */
const H5D_t *dset = io_info->dset; /* Local pointer to the dataset info */
@@ -3935,8 +4557,9 @@ H5D__chunk_prune_fill(H5D_chunk_it_ud1_t *udata)
H5_CHECKED_ASSIGN(chunk_size, size_t, layout->u.chunk.size, uint32_t);
/* Get the info for the chunk in the file */
- if(H5D__chunk_lookup(dset, io_info->dxpl_id, scaled, &chk_udata) < 0)
+ if(H5D__chunk_lookup(dset, io_info->md_dxpl_id, scaled, &chk_udata) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address")
+ chk_udata.new_unfilt_chunk = new_unfilt_chunk;
/* If this chunk does not exist in cache or on disk, no need to do anything */
if(!H5F_addr_defined(chk_udata.chunk_block.offset) && UINT_MAX == chk_udata.idx_hint)
@@ -3948,7 +4571,7 @@ H5D__chunk_prune_fill(H5D_chunk_it_ud1_t *udata)
if(H5D__fill_init(&udata->fb_info, NULL, NULL, NULL, NULL, NULL,
&dset->shared->dcpl_cache.fill,
dset->shared->type, dset->shared->type_id, (size_t)udata->elmts_per_chunk,
- chunk_size, io_info->dxpl_id) < 0)
+ chunk_size, io_info->md_dxpl_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't initialize fill buffer info")
udata->fb_info_init = TRUE;
} /* end if */
@@ -3968,7 +4591,7 @@ H5D__chunk_prune_fill(H5D_chunk_it_ud1_t *udata)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSELECT, FAIL, "unable to select hyperslab")
/* Lock the chunk into the cache, to get a pointer to the chunk buffer */
- if(NULL == (chunk = (void *)H5D__chunk_lock(io_info, &chk_udata, FALSE)))
+ if(NULL == (chunk = (void *)H5D__chunk_lock(io_info, &chk_udata, FALSE, FALSE)))
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "unable to lock raw data chunk")
@@ -3985,7 +4608,7 @@ H5D__chunk_prune_fill(H5D_chunk_it_ud1_t *udata)
/* Check for VL datatype & non-default fill value */
if(udata->fb_info.has_vlen_fill_type)
/* Re-fill the buffer to use for this I/O operation */
- if(H5D__fill_refill_vl(&udata->fb_info, (size_t)sel_nelmts, io_info->dxpl_id) < 0)
+ if(H5D__fill_refill_vl(&udata->fb_info, (size_t)sel_nelmts, io_info->md_dxpl_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCONVERT, FAIL, "can't refill fill value buffer")
/* Create a selection iterator for scattering the elements to memory buffer */
@@ -4122,6 +4745,8 @@ H5D__chunk_prune_by_extent(H5D_t *dset, hid_t dxpl_id, const hsize_t *old_dim)
hsize_t max_mod_chunk_sc[H5O_LAYOUT_NDIMS]; /* Scaled offset of last chunk to modify in each dimension */
hssize_t max_fill_chunk_sc[H5O_LAYOUT_NDIMS]; /* Scaled offset of last chunk that might be filled in each dimension */
hbool_t fill_dim[H5O_LAYOUT_NDIMS]; /* Whether the plane of edge chunks in this dimension needs to be filled */
+ hsize_t min_partial_chunk_sc[H5O_LAYOUT_NDIMS]; /* Offset of first partial (or empty) chunk in each dimension */
+ hbool_t new_unfilt_dim[H5O_LAYOUT_NDIMS]; /* Whether the plane of edge chunks in this dimension are newly unfiltered */
H5D_chk_idx_info_t idx_info; /* Chunked index info */
H5D_io_info_t chk_io_info; /* Chunked I/O info object */
H5D_storage_t chk_store; /* Chunk storage information */
@@ -4141,7 +4766,10 @@ H5D__chunk_prune_by_extent(H5D_t *dset, hid_t dxpl_id, const hsize_t *old_dim)
hsize_t scaled[H5O_LAYOUT_NDIMS]; /* Scaled offset of current chunk */
hsize_t hyper_start[H5O_LAYOUT_NDIMS]; /* Starting location of hyperslab */
uint32_t elmts_per_chunk; /* Elements in chunk */
+ hbool_t disable_edge_filters = FALSE; /* Whether to disable filters on partial edge chunks */
+ hbool_t new_unfilt_chunk = FALSE; /* Whether the chunk is newly unfiltered */
unsigned u; /* Local index variable */
+ const H5O_storage_chunk_t *sc = &(layout->storage.u.chunk);
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -4149,6 +4777,7 @@ H5D__chunk_prune_by_extent(H5D_t *dset, hid_t dxpl_id, const hsize_t *old_dim)
/* Check args */
HDassert(dset && H5D_CHUNKED == layout->type);
HDassert(layout->u.chunk.ndims > 0 && layout->u.chunk.ndims <= H5O_LAYOUT_NDIMS);
+ H5D_CHUNK_STORAGE_INDEX_CHK(sc);
HDassert(dxpl_cache);
/* Fill the DXPL cache values for later use */
@@ -4194,7 +4823,8 @@ H5D__chunk_prune_by_extent(H5D_t *dset, hid_t dxpl_id, const hsize_t *old_dim)
* Note that we only need to set scaled once, as the array's address
* will never change. */
chk_store.chunk.scaled = scaled;
- H5D_BUILD_IO_INFO_RD(&chk_io_info, dset, dxpl_cache, dxpl_id, &chk_store, NULL);
+ H5D_BUILD_IO_INFO_RD(&chk_io_info, dset, dxpl_cache, dxpl_id, H5AC_rawdata_dxpl_id, &chk_store, NULL);
+ chk_io_info.raw_dxpl_id = H5AC_rawdata_dxpl_id;
/* Compose chunked index info struct */
idx_info.f = dset->oloc.file;
@@ -4221,6 +4851,11 @@ H5D__chunk_prune_by_extent(H5D_t *dset, hid_t dxpl_id, const hsize_t *old_dim)
idx_udata.layout = &layout->u.chunk;
idx_udata.storage = &layout->storage.u.chunk;
+ /* Determine if partial edge chunk filters are disabled */
+ disable_edge_filters = (layout->u.chunk.flags
+ & H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS)
+ && (idx_info.pline->nused > 0);
+
/*
* Determine the chunks which need to be filled or removed
*/
@@ -4247,13 +4882,31 @@ H5D__chunk_prune_by_extent(H5D_t *dset, hid_t dxpl_id, const hsize_t *old_dim)
min_mod_chunk_sc[op_dim] = space_dim[op_dim] / chunk_dim[op_dim];
/* Determine if we need to fill chunks in this dimension */
- if((hssize_t)min_mod_chunk_sc[op_dim] == max_fill_chunk_sc[op_dim])
+ if((hssize_t)min_mod_chunk_sc[op_dim] == max_fill_chunk_sc[op_dim]) {
fill_dim[op_dim] = TRUE;
- else
+
+ /* If necessary, check if chunks in this dimension that need to
+ * be filled are new partial edge chunks */
+ if(disable_edge_filters && old_dim[op_dim] >= (min_mod_chunk_sc[op_dim] + 1))
+ new_unfilt_dim[op_dim] = TRUE;
+ else
+ new_unfilt_dim[op_dim] = FALSE;
+ } /* end if */
+ else {
fill_dim[op_dim] = FALSE;
+ new_unfilt_dim[op_dim] = FALSE;
+ } /* end else */
} /* end if */
- else
+ else {
fill_dim[op_dim] = FALSE;
+ new_unfilt_dim[op_dim] = FALSE;
+ } /* end else */
+
+ /* If necessary, calculate the smallest offset of non-previously full
+ * chunks in this dimension, so we know these chunks were previously
+ * unfiltered */
+ if(disable_edge_filters)
+ min_partial_chunk_sc[op_dim] = old_dim[op_dim] / chunk_dim[op_dim];
} /* end for */
/* Main loop: fill or remove chunks */
@@ -4287,12 +4940,33 @@ H5D__chunk_prune_by_extent(H5D_t *dset, hid_t dxpl_id, const hsize_t *old_dim)
while(!carry) {
int i; /* Local index variable */
+ udata.common.scaled = scaled;
+
if(0 == ndims_outside_fill) {
HDassert(fill_dim[op_dim]);
HDassert(scaled[op_dim] == min_mod_chunk_sc[op_dim]);
+ /* Make sure this is an edge chunk */
+ HDassert(H5D__chunk_is_partial_edge_chunk(space_ndims, layout->u.chunk.dim, scaled, space_dim));
+
+ /* Determine if the chunk just became an unfiltered chunk */
+ if(new_unfilt_dim[op_dim]) {
+ new_unfilt_chunk = TRUE;
+ for(u = 0; u < space_ndims; u++)
+ if(scaled[u] == min_partial_chunk_sc[u]) {
+ new_unfilt_chunk = FALSE;
+ break;
+ } /* end if */
+ } /* end if */
+
+ /* Make sure that, if we think this is a new unfiltered chunk,
+ * it was previously not an edge chunk */
+ HDassert(!new_unfilt_dim[op_dim] || (!new_unfilt_chunk !=
+ !H5D__chunk_is_partial_edge_chunk(space_ndims, layout->u.chunk.dim, scaled, old_dim)));
+ HDassert(!new_unfilt_chunk || new_unfilt_dim[op_dim]);
+
/* Fill the unused parts of the chunk */
- if(H5D__chunk_prune_fill(&udata) < 0)
+ if(H5D__chunk_prune_fill(&udata, new_unfilt_chunk) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to write fill value")
} /* end if */
else {
@@ -4325,7 +4999,7 @@ H5D__chunk_prune_by_extent(H5D_t *dset, hid_t dxpl_id, const hsize_t *old_dim)
/* Remove the chunk from disk, if present */
if(H5F_addr_defined(chk_udata.chunk_block.offset)) {
/* Update the offset in idx_udata */
- idx_udata.scaled = scaled;
+ idx_udata.scaled = udata.common.scaled;
/* Remove the chunk from disk */
if((layout->storage.u.chunk.ops->remove)(&idx_info, &idx_udata) < 0)
@@ -4447,12 +5121,14 @@ H5D__chunk_addrmap(const H5D_io_info_t *io_info, haddr_t chunk_addr[])
H5D_chk_idx_info_t idx_info; /* Chunked index info */
const H5D_t *dset = io_info->dset; /* Local pointer to dataset info */
H5D_chunk_it_ud2_t udata; /* User data for iteration callback */
+ H5O_storage_chunk_t *sc = &(dset->shared->layout.storage.u.chunk);
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
HDassert(dset);
HDassert(dset->shared);
+ H5D_CHUNK_STORAGE_INDEX_CHK(sc);
HDassert(chunk_addr);
/* Set up user data for B-tree callback */
@@ -4463,7 +5139,7 @@ H5D__chunk_addrmap(const H5D_io_info_t *io_info, haddr_t chunk_addr[])
/* Compose chunked index info struct */
idx_info.f = dset->oloc.file;
- idx_info.dxpl_id = io_info->dxpl_id;
+ idx_info.dxpl_id = io_info->md_dxpl_id;
idx_info.pline = &dset->shared->dcpl_cache.pline;
idx_info.layout = &dset->shared->layout.u.chunk;
idx_info.storage = &dset->shared->layout.storage.u.chunk;
@@ -4500,6 +5176,7 @@ H5D__chunk_delete(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5O_storage_t *storage)
H5O_pline_t pline; /* I/O pipeline message */
hbool_t pline_read = FALSE; /* Whether the I/O pipeline message was read from the file */
htri_t exists; /* Flag if header message of interest exists */
+ H5O_storage_chunk_t *sc = &(storage->u.chunk);
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -4508,6 +5185,7 @@ H5D__chunk_delete(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5O_storage_t *storage)
HDassert(f);
HDassert(oh);
HDassert(storage);
+ H5D_CHUNK_STORAGE_INDEX_CHK(sc);
/* Check for I/O pipeline message */
if((exists = H5O_msg_exists_oh(oh, H5O_PLINE_ID)) < 0)
@@ -4574,6 +5252,8 @@ H5D__chunk_update_cache(H5D_t *dset, hid_t dxpl_id)
{
H5D_rdcc_t *rdcc = &(dset->shared->cache.chunk); /*raw data chunk cache */
H5D_rdcc_ent_t *ent, *next; /*cache entry */
+ H5D_rdcc_ent_t tmp_head; /* Sentinel entry for temporary entry list */
+ H5D_rdcc_ent_t *tmp_tail; /* Tail pointer for temporary entry list */
H5D_dxpl_cache_t _dxpl_cache; /* Data transfer property cache buffer */
H5D_dxpl_cache_t *dxpl_cache = &_dxpl_cache; /* Data transfer property cache */
herr_t ret_value = SUCCEED; /* Return value */
@@ -4591,6 +5271,11 @@ H5D__chunk_update_cache(H5D_t *dset, hid_t dxpl_id)
if(H5D__get_dxpl_cache(dxpl_id, &dxpl_cache) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't fill dxpl cache")
+ /* Add temporary entry list to rdcc */
+ (void)HDmemset(&tmp_head, 0, sizeof(tmp_head));
+ rdcc->tmp_head = &tmp_head;
+ tmp_tail = &tmp_head;
+
/* Recompute the index for each cached chunk that is in a dataset */
for(ent = rdcc->head; ent; ent = next) {
unsigned old_idx; /* Previous index number */
@@ -4611,37 +5296,58 @@ H5D__chunk_update_cache(H5D_t *dset, hid_t dxpl_id)
HDassert(old_ent->locked == FALSE);
HDassert(old_ent->deleted == FALSE);
- /* Mark the old entry as deleted, but do not evict (yet).
- * Make sure we do not make any calls to the index
+ /* Insert the old entry into the temporary list, but do not
+ * evict (yet). Make sure we do not make any calls to the index
* until all chunks have updated indices! */
- old_ent->deleted = TRUE;
+ HDassert(!old_ent->tmp_next);
+ HDassert(!old_ent->tmp_prev);
+ tmp_tail->tmp_next = old_ent;
+ old_ent->tmp_prev = tmp_tail;
+ tmp_tail = old_ent;
} /* end if */
/* Insert this chunk into correct location in hash table */
rdcc->slot[ent->idx] = ent;
- /* If this chunk was previously marked as deleted and therefore
- * not in the hash table, reset the deleted flag.
+ /* If this chunk was previously on the temporary list and therefore
+ * not in the hash table, remove it from the temporary list.
* Otherwise clear the old hash table slot. */
- if(ent->deleted)
- ent->deleted = FALSE;
+ if(ent->tmp_prev) {
+ HDassert(tmp_head.tmp_next);
+ HDassert(tmp_tail != &tmp_head);
+ ent->tmp_prev->tmp_next = ent->tmp_next;
+ if(ent->tmp_next) {
+ ent->tmp_next->tmp_prev = ent->tmp_prev;
+ ent->tmp_next = NULL;
+ } /* end if */
+ else {
+ HDassert(tmp_tail == ent);
+ tmp_tail = ent->tmp_prev;
+ } /* end else */
+ ent->tmp_prev = NULL;
+ } /* end if */
else
rdcc->slot[old_idx] = NULL;
} /* end if */
} /* end for */
- /* Evict chunks that are still marked as deleted */
- for(ent = rdcc->head; ent; ent = next) {
- /* Get the pointer to the next cache entry */
- next = ent->next;
+ /* tmp_tail is no longer needed, and will be invalidated by
+ * H5D_chunk_cache_evict anyways. */
+ tmp_tail = NULL;
+
+ /* Evict chunks that are still on the temporary list */
+ while(tmp_head.tmp_next) {
+ ent = tmp_head.tmp_next;
/* Remove the old entry from the cache */
- if(ent->deleted)
- if(H5D__chunk_cache_evict(dset, dxpl_id, dxpl_cache, ent, TRUE) < 0)
- HGOTO_ERROR(H5E_IO, H5E_CANTFLUSH, FAIL, "unable to flush one or more raw data chunks")
- } /* end for */
+ if(H5D__chunk_cache_evict(dset, dxpl_id, dxpl_cache, ent, TRUE) < 0)
+ HGOTO_ERROR(H5E_IO, H5E_CANTFLUSH, FAIL, "unable to flush one or more raw data chunks")
+ } /* end while */
done:
+ /* Remove temporary list from rdcc */
+ rdcc->tmp_head = NULL;
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__chunk_update_cache() */
@@ -4678,7 +5384,6 @@ H5D__chunk_copy_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata)
hbool_t must_filter = FALSE; /* Whether chunk must be filtered during copy */
size_t nbytes; /* Size of chunk in file (in bytes) */
H5Z_cb_t cb_struct; /* Filter failure callback struct */
-
int ret_value = H5_ITER_CONT; /* Return value */
FUNC_ENTER_STATIC
@@ -4698,8 +5403,15 @@ H5D__chunk_copy_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata)
/* Check for filtered chunks */
if((is_vlen || fix_ref) && pline && pline->nused) {
- must_filter = TRUE;
- cb_struct.func = NULL; /* no callback function when failed */
+ /* Check if we should disable filters on this chunk */
+ if(udata->common.layout->flags
+ & H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS) {
+ /* Check if the chunk is an edge chunk, and disable filters if so */
+ if(!H5D__chunk_is_partial_edge_chunk(udata->dset_ndims, udata->common.layout->dim, chunk_rec->scaled, udata->dset_dims))
+ must_filter = TRUE;
+ } /* end if */
+ else
+ must_filter = TRUE;
} /* end if */
/* Resize the buf if it is too small to hold the data */
@@ -4725,13 +5437,14 @@ H5D__chunk_copy_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata)
} /* end if */
/* read chunk data from the source file */
- if(H5F_block_read(udata->file_src, H5FD_MEM_DRAW, chunk_rec->chunk_addr, nbytes, udata->idx_info_dst->dxpl_id, buf) < 0)
+ if(H5F_block_read(udata->file_src, H5FD_MEM_DRAW, chunk_rec->chunk_addr, nbytes, H5AC_rawdata_dxpl_id, buf) < 0)
HGOTO_ERROR(H5E_IO, H5E_READERROR, H5_ITER_ERROR, "unable to read raw data chunk")
/* Need to uncompress variable-length & reference data elements */
if(must_filter) {
unsigned filter_mask = chunk_rec->filter_mask;
+ cb_struct.func = NULL; /* no callback function when failed */
if(H5Z_pipeline(pline, H5Z_FLAG_REVERSE, &filter_mask, H5Z_NO_EDC, cb_struct, &nbytes, &buf_size, &buf) < 0)
HGOTO_ERROR(H5E_PLINE, H5E_CANTFILTER, H5_ITER_ERROR, "data pipeline read failed")
} /* end if */
@@ -4763,7 +5476,7 @@ H5D__chunk_copy_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5_ITER_ERROR, "datatype conversion failed")
/* Reclaim space from variable length data */
- if(H5D_vlen_reclaim(tid_mem, buf_space, H5P_DATASET_XFER_DEFAULT, reclaim_buf) < 0)
+ if(H5D_vlen_reclaim(tid_mem, buf_space, udata->idx_info_dst->dxpl_id, reclaim_buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_BADITER, H5_ITER_ERROR, "unable to reclaim variable-length data")
} /* end if */
else if(fix_ref) {
@@ -4806,13 +5519,16 @@ H5D__chunk_copy_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata)
udata->buf_size = buf_size;
} /* end if */
+ udata_dst.chunk_idx = H5VM_array_offset_pre(udata_dst.common.layout->ndims - 1,
+ udata_dst.common.layout->down_chunks, udata_dst.common.scaled);
+
/* Allocate chunk in the file */
if(H5D__chunk_file_alloc(udata->idx_info_dst, NULL, &udata_dst.chunk_block, &need_insert) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert/resize chunk on chunk level")
/* Write chunk data to destination file */
HDassert(H5F_addr_defined(udata_dst.chunk_block.offset));
- if(H5F_block_write(udata->idx_info_dst->f, H5FD_MEM_DRAW, udata_dst.chunk_block.offset, nbytes, udata->idx_info_dst->dxpl_id, buf) < 0)
+ if(H5F_block_write(udata->idx_info_dst->f, H5FD_MEM_DRAW, udata_dst.chunk_block.offset, nbytes, H5AC_rawdata_dxpl_id, buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, H5_ITER_ERROR, "unable to write raw data to file")
/* Set metadata tag in dxpl_id */
@@ -4853,6 +5569,9 @@ H5D__chunk_copy(H5F_t *f_src, H5O_storage_chunk_t *storage_src,
H5D_chunk_it_ud3_t udata; /* User data for iteration callback */
H5D_chk_idx_info_t idx_info_dst; /* Dest. chunked index info */
H5D_chk_idx_info_t idx_info_src; /* Source chunked index info */
+ int sndims; /* Rank of dataspace */
+ hsize_t curr_dims[H5O_LAYOUT_NDIMS]; /* Curr. size of dataset dimensions */
+ hsize_t max_dims[H5O_LAYOUT_NDIMS]; /* Curr. size of dataset dimensions */
H5O_pline_t _pline; /* Temporary pipeline info */
const H5O_pline_t *pline; /* Pointer to pipeline info to use */
H5T_path_t *tpath_src_mem = NULL, *tpath_mem_dst = NULL; /* Datatype conversion paths */
@@ -4876,9 +5595,11 @@ H5D__chunk_copy(H5F_t *f_src, H5O_storage_chunk_t *storage_src,
/* Check args */
HDassert(f_src);
HDassert(storage_src);
+ H5D_CHUNK_STORAGE_INDEX_CHK(storage_src);
HDassert(layout_src);
HDassert(f_dst);
HDassert(storage_dst);
+ H5D_CHUNK_STORAGE_INDEX_CHK(storage_dst);
HDassert(ds_extent_src);
HDassert(dt_src);
@@ -4896,17 +5617,15 @@ H5D__chunk_copy(H5F_t *f_src, H5O_storage_chunk_t *storage_src,
/* Initialize layout information */
{
- hsize_t curr_dims[H5O_LAYOUT_NDIMS]; /* Curr. size of dataset dimensions */
- int sndims; /* Rank of dataspace */
unsigned ndims; /* Rank of dataspace */
/* Get the dim info for dataset */
- if((sndims = H5S_extent_get_dims(ds_extent_src, curr_dims, NULL)) < 0)
+ if((sndims = H5S_extent_get_dims(ds_extent_src, curr_dims, max_dims)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get dataspace dimensions")
H5_CHECKED_ASSIGN(ndims, unsigned, sndims, int);
/* Set the source layout chunk information */
- if(H5D__chunk_set_info_real(layout_src, ndims, curr_dims) < 0)
+ if(H5D__chunk_set_info_real(layout_src, ndims, curr_dims, max_dims) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set layout's chunk info")
} /* end block */
@@ -5108,6 +5827,7 @@ H5D__chunk_bh_info(const H5O_loc_t *loc, hid_t dxpl_id, H5O_t *oh, H5O_layout_t
H5D_chk_idx_info_t idx_info; /* Chunked index info */
H5S_t *space = NULL; /* Dataset's dataspace */
H5O_pline_t pline; /* I/O pipeline message */
+ H5O_storage_chunk_t *sc = &(layout->storage.u.chunk);
htri_t exists; /* Flag if header message of interest exists */
hbool_t idx_info_init = FALSE; /* Whether the chunk index info has been initialized */
hbool_t pline_read = FALSE; /* Whether the I/O pipeline message was read */
@@ -5120,6 +5840,7 @@ H5D__chunk_bh_info(const H5O_loc_t *loc, hid_t dxpl_id, H5O_t *oh, H5O_layout_t
HDassert(loc->file);
HDassert(H5F_addr_defined(loc->addr));
HDassert(layout);
+ H5D_CHUNK_STORAGE_INDEX_CHK(sc);
HDassert(index_size);
/* Check for I/O pipeline message */
@@ -5229,12 +5950,14 @@ H5D__chunk_dump_index_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata)
herr_t
H5D__chunk_dump_index(H5D_t *dset, hid_t dxpl_id, FILE *stream)
{
+ H5O_storage_chunk_t *sc = &(dset->shared->layout.storage.u.chunk);
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(dset);
+ H5D_CHUNK_STORAGE_INDEX_CHK(sc);
/* Only display info if stream is defined */
if(stream) {
@@ -5423,7 +6146,7 @@ H5D__nonexistent_readvv(const H5D_io_info_t *io_info,
/* Set up user data for H5VM_opvv() */
udata.rbuf = (unsigned char *)io_info->u.rbuf;
udata.dset = io_info->dset;
- udata.dxpl_id = io_info->dxpl_id;
+ udata.dxpl_id = io_info->md_dxpl_id;
/* Call generic sequence operation routine */
if((ret_value = H5VM_opvv(chunk_max_nseq, chunk_curr_seq, chunk_len_arr, chunk_off_arr,
@@ -5437,6 +6160,45 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5D__chunk_is_partial_edge_chunk
+ *
+ * Purpose: Checks to see if the chunk is a partial edge chunk.
+ * Either dset or (dset_dims and dset_ndims) must be
+ * provided.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Neil Fortner
+ * 19 Nov 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+static hbool_t
+H5D__chunk_is_partial_edge_chunk(unsigned dset_ndims, const uint32_t *chunk_dims,
+ const hsize_t scaled[], const hsize_t *dset_dims)
+{
+ unsigned u; /* Local index variable */
+ hbool_t ret_value = FALSE; /* Return value */
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Check args */
+ HDassert(scaled);
+ HDassert(dset_ndims > 0);
+ HDassert(dset_dims);
+ HDassert(chunk_dims);
+
+ /* check if this is a partial edge chunk */
+ for(u = 0; u < dset_ndims; u++)
+ if(((scaled[u] + 1) * chunk_dims[u]) > dset_dims[u])
+ HGOTO_DONE(TRUE);
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5D__chunk_is_partial_edge_chunk() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5D__chunk_file_alloc()
*
* Purpose: Chunk allocation:
@@ -5469,6 +6231,8 @@ H5D__chunk_file_alloc(const H5D_chk_idx_info_t *idx_info, const H5F_block_t *old
HDassert(new_chunk);
HDassert(need_insert);
+ *need_insert = FALSE;
+
/* Check for filters on chunks */
if(idx_info->pline->nused > 0) {
/* Sanity/error checking block */
@@ -5523,21 +6287,24 @@ H5D__chunk_file_alloc(const H5D_chk_idx_info_t *idx_info, const H5F_block_t *old
/* Actually allocate space for the chunk in the file */
if(alloc_chunk) {
- switch(idx_info->storage->idx_type) {
- case H5D_CHUNK_IDX_BTREE:
+ switch(idx_info->storage->idx_type) {
+ case H5D_CHUNK_IDX_EARRAY:
+ case H5D_CHUNK_IDX_FARRAY:
+ case H5D_CHUNK_IDX_BT2:
+ case H5D_CHUNK_IDX_BTREE:
HDassert(new_chunk->length > 0);
- H5_CHECK_OVERFLOW(new_chunk->length, /*From: */uint32_t, /*To: */hsize_t);
- new_chunk->offset = H5MF_alloc(idx_info->f, H5FD_MEM_DRAW, idx_info->dxpl_id, (hsize_t)new_chunk->length);
- if(!H5F_addr_defined(new_chunk->offset))
- HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "file allocation failed")
- *need_insert = TRUE;
- break;
-
- case H5D_CHUNK_IDX_NTYPES:
- default:
- HDassert(0 && "This should never be executed!");
- break;
- } /* end switch */
+ H5_CHECK_OVERFLOW(new_chunk->length, /*From: */uint32_t, /*To: */hsize_t);
+ new_chunk->offset = H5MF_alloc(idx_info->f, H5FD_MEM_DRAW, idx_info->dxpl_id, (hsize_t)new_chunk->length);
+ if(!H5F_addr_defined(new_chunk->offset))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "file allocation failed")
+ *need_insert = TRUE;
+ break;
+
+ case H5D_CHUNK_IDX_NTYPES:
+ default:
+ HDassert(0 && "This should never be executed!");
+ break;
+ } /* end switch */
} /* end if */
HDassert(H5F_addr_defined(new_chunk->offset));
diff --git a/src/H5Dcompact.c b/src/H5Dcompact.c
index ebe75bd..224a1d1 100644
--- a/src/H5Dcompact.c
+++ b/src/H5Dcompact.c
@@ -440,12 +440,9 @@ H5D__compact_copy(H5F_t *f_src, H5O_storage_compact_t *storage_src, H5F_t *f_dst
HDassert(storage_src);
HDassert(f_dst);
HDassert(storage_dst);
+ HDassert(storage_dst->buf);
HDassert(dt_src);
- /* Allocate space for destination data */
- if(NULL == (storage_dst->buf = H5MM_malloc(storage_src->size)))
- HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "unable to allocate memory for compact dataset")
-
/* Create datatype ID for src datatype, so it gets freed */
if((tid_src = H5I_register(H5I_DATATYPE, dt_src, FALSE)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register source file datatype")
@@ -549,7 +546,7 @@ H5D__compact_copy(H5F_t *f_src, H5O_storage_compact_t *storage_src, H5F_t *f_dst
HDmemcpy(storage_dst->buf, buf, storage_dst->size);
- if(H5D_vlen_reclaim(tid_mem, buf_space, H5P_DATASET_XFER_DEFAULT, reclaim_buf) < 0)
+ if(H5D_vlen_reclaim(tid_mem, buf_space, dxpl_id, reclaim_buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_BADITER, FAIL, "unable to reclaim variable-length data")
} /* end if */
else if(H5T_get_class(dt_src, FALSE) == H5T_REFERENCE) {
diff --git a/src/H5Dcontig.c b/src/H5Dcontig.c
index b5b9b0d..a24abe6 100644
--- a/src/H5Dcontig.c
+++ b/src/H5Dcontig.c
@@ -195,8 +195,9 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5D__contig_fill(const H5D_t *dset, hid_t dxpl_id)
+H5D__contig_fill(const H5D_io_info_t *io_info)
{
+ const H5D_t *dset = io_info->dset; /* the dataset pointer */
H5D_io_info_t ioinfo; /* Dataset I/O info */
H5D_storage_t store; /* Union of storage info for dataset */
H5D_dxpl_cache_t _dxpl_cache; /* Data transfer property cache buffer */
@@ -211,15 +212,17 @@ H5D__contig_fill(const H5D_t *dset, hid_t dxpl_id)
hbool_t blocks_written = FALSE; /* Flag to indicate that chunk was actually written */
hbool_t using_mpi = FALSE; /* Flag to indicate that the file is being accessed with an MPI-capable file driver */
#endif /* H5_HAVE_PARALLEL */
+ hid_t md_dxpl_id = io_info->md_dxpl_id;
+ hid_t raw_dxpl_id = io_info->raw_dxpl_id;
H5D_fill_buf_info_t fb_info; /* Dataset's fill buffer info */
hbool_t fb_info_init = FALSE; /* Whether the fill value buffer has been initialized */
- hid_t my_dxpl_id; /* DXPL ID to use for this operation */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
/* Check args */
- HDassert(TRUE == H5P_isa_class(dxpl_id, H5P_DATASET_XFER));
+ HDassert(TRUE == H5P_isa_class(md_dxpl_id, H5P_DATASET_XFER));
+ HDassert(TRUE == H5P_isa_class(raw_dxpl_id, H5P_DATASET_XFER));
HDassert(dset && H5D_CONTIGUOUS == dset->shared->layout.type);
HDassert(H5F_addr_defined(dset->shared->layout.storage.u.contig.addr));
HDassert(dset->shared->layout.storage.u.contig.size > 0);
@@ -239,20 +242,11 @@ H5D__contig_fill(const H5D_t *dset, hid_t dxpl_id)
/* Set the MPI-capable file driver flag */
using_mpi = TRUE;
-
- /* Use the internal "independent" DXPL */
- my_dxpl_id = H5AC_ind_dxpl_id;
} /* end if */
- else {
-#endif /* H5_HAVE_PARALLEL */
- /* Use the DXPL we were given */
- my_dxpl_id = dxpl_id;
-#ifdef H5_HAVE_PARALLEL
- } /* end else */
#endif /* H5_HAVE_PARALLEL */
/* Fill the DXPL cache values for later use */
- if(H5D__get_dxpl_cache(my_dxpl_id, &dxpl_cache) < 0)
+ if(H5D__get_dxpl_cache(raw_dxpl_id, &dxpl_cache) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't fill dxpl cache")
/* Initialize storage info for this dataset */
@@ -268,7 +262,7 @@ H5D__contig_fill(const H5D_t *dset, hid_t dxpl_id)
if(H5D__fill_init(&fb_info, NULL, NULL, NULL, NULL, NULL,
&dset->shared->dcpl_cache.fill,
dset->shared->type, dset->shared->type_id, npoints,
- dxpl_cache->max_temp_buf, my_dxpl_id) < 0)
+ dxpl_cache->max_temp_buf, md_dxpl_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't initialize fill buffer info")
fb_info_init = TRUE;
@@ -276,7 +270,7 @@ H5D__contig_fill(const H5D_t *dset, hid_t dxpl_id)
offset = 0;
/* Simple setup for dataset I/O info struct */
- H5D_BUILD_IO_INFO_WRT(&ioinfo, dset, dxpl_cache, my_dxpl_id, &store, fb_info.fill_buf);
+ H5D_BUILD_IO_INFO_WRT(&ioinfo, dset, dxpl_cache, H5AC_ind_read_dxpl_id, raw_dxpl_id, &store, fb_info.fill_buf);
/*
* Fill the entire current extent with the fill value. We can do
@@ -296,7 +290,7 @@ H5D__contig_fill(const H5D_t *dset, hid_t dxpl_id)
/* Check for VL datatype & non-default fill value */
if(fb_info.has_vlen_fill_type)
/* Re-fill the buffer to use for this I/O operation */
- if(H5D__fill_refill_vl(&fb_info, curr_points, my_dxpl_id) < 0)
+ if(H5D__fill_refill_vl(&fb_info, curr_points, md_dxpl_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCONVERT, FAIL, "can't refill fill value buffer")
#ifdef H5_HAVE_PARALLEL
@@ -940,7 +934,7 @@ H5D__contig_readvv(const H5D_io_info_t *io_info,
udata.dset_contig = &(io_info->dset->shared->cache.contig);
udata.store_contig = &(io_info->store->contig);
udata.rbuf = (unsigned char *)io_info->u.rbuf;
- udata.dxpl_id = io_info->dxpl_id;
+ udata.dxpl_id = io_info->raw_dxpl_id;
/* Call generic sequence operation routine */
if((ret_value = H5VM_opvv(dset_max_nseq, dset_curr_seq, dset_len_arr, dset_off_arr,
@@ -955,7 +949,7 @@ H5D__contig_readvv(const H5D_io_info_t *io_info,
udata.file = io_info->dset->oloc.file;
udata.dset_addr = io_info->store->contig.dset_addr;
udata.rbuf = (unsigned char *)io_info->u.rbuf;
- udata.dxpl_id = io_info->dxpl_id;
+ udata.dxpl_id = io_info->raw_dxpl_id;
/* Call generic sequence operation routine */
if((ret_value = H5VM_opvv(dset_max_nseq, dset_curr_seq, dset_len_arr, dset_off_arr,
@@ -1026,10 +1020,9 @@ H5D__contig_writevv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len,
if(NULL == (dset_contig->sieve_buf = H5FL_BLK_CALLOC(sieve_buf, dset_contig->sieve_buf_size)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "memory allocation failed")
-#ifdef H5_CLEAR_MEMORY
-if(dset_contig->sieve_size > len)
- HDmemset(dset_contig->sieve_buf + len, 0, (dset_contig->sieve_size - len));
-#endif /* H5_CLEAR_MEMORY */
+ /* Clear memory */
+ if(dset_contig->sieve_size > len)
+ HDmemset(dset_contig->sieve_buf + len, 0, (dset_contig->sieve_size - len));
/* Determine the new sieve buffer size & location */
dset_contig->sieve_loc = addr;
@@ -1267,7 +1260,7 @@ H5D__contig_writevv(const H5D_io_info_t *io_info,
udata.dset_contig = &(io_info->dset->shared->cache.contig);
udata.store_contig = &(io_info->store->contig);
udata.wbuf = (const unsigned char *)io_info->u.wbuf;
- udata.dxpl_id = io_info->dxpl_id;
+ udata.dxpl_id = io_info->raw_dxpl_id;
/* Call generic sequence operation routine */
if((ret_value = H5VM_opvv(dset_max_nseq, dset_curr_seq, dset_len_arr, dset_off_arr,
@@ -1282,7 +1275,7 @@ H5D__contig_writevv(const H5D_io_info_t *io_info,
udata.file = io_info->dset->oloc.file;
udata.dset_addr = io_info->store->contig.dset_addr;
udata.wbuf = (const unsigned char *)io_info->u.wbuf;
- udata.dxpl_id = io_info->dxpl_id;
+ udata.dxpl_id = io_info->raw_dxpl_id;
/* Call generic sequence operation routine */
if((ret_value = H5VM_opvv(dset_max_nseq, dset_curr_seq, dset_len_arr, dset_off_arr,
@@ -1309,7 +1302,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5D__contig_flush(H5D_t *dset, hid_t dxpl_id)
+H5D__contig_flush(H5D_t *dset, hid_t H5_ATTR_UNUSED dxpl_id)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -1318,8 +1311,9 @@ H5D__contig_flush(H5D_t *dset, hid_t dxpl_id)
/* Sanity check */
HDassert(dset);
- /* Flush any data in sieve buffer */
- if(H5D__flush_sieve_buf(dset, dxpl_id) < 0)
+ /* Flush any data in sieve buffer - use the raw data dxpl since
+ the one passed in is a metadata dxpl. */
+ if(H5D__flush_sieve_buf(dset, H5AC_rawdata_dxpl_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to flush sieve buffer")
done:
@@ -1518,8 +1512,8 @@ H5D__contig_copy(H5F_t *f_src, const H5O_storage_contig_t *storage_src,
dst_nbytes = mem_nbytes = src_nbytes;
} /* end if */
- /* Read raw data from source file */
- if(H5F_block_read(f_src, H5FD_MEM_DRAW, addr_src, src_nbytes, H5P_DATASET_XFER_DEFAULT, buf) < 0)
+ /* Read raw data from source file - use raw dxpl because passed in one is metadata */
+ if(H5F_block_read(f_src, H5FD_MEM_DRAW, addr_src, src_nbytes, H5AC_rawdata_dxpl_id, buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "unable to read raw data")
/* Perform datatype conversion, if necessary */
@@ -1539,7 +1533,7 @@ H5D__contig_copy(H5F_t *f_src, const H5O_storage_contig_t *storage_src,
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "datatype conversion failed")
/* Reclaim space from variable length data */
- if(H5D_vlen_reclaim(tid_mem, buf_space, H5P_DATASET_XFER_DEFAULT, reclaim_buf) < 0)
+ if(H5D_vlen_reclaim(tid_mem, buf_space, dxpl_id, reclaim_buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_BADITER, FAIL, "unable to reclaim variable-length data")
} /* end if */
else if(fix_ref) {
@@ -1562,8 +1556,8 @@ H5D__contig_copy(H5F_t *f_src, const H5O_storage_contig_t *storage_src,
HDmemset(buf, 0, src_nbytes);
} /* end if */
- /* Write raw data to destination file */
- if(H5F_block_write(f_dst, H5FD_MEM_DRAW, addr_dst, dst_nbytes, H5P_DATASET_XFER_DEFAULT, buf) < 0)
+ /* Write raw data to destination file - use raw dxpl because passed in one is metadata */
+ if(H5F_block_write(f_dst, H5FD_MEM_DRAW, addr_dst, dst_nbytes, H5AC_rawdata_dxpl_id, buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to write raw data")
/* Adjust loop variables */
diff --git a/src/H5Ddbg.c b/src/H5Ddbg.c
index 38fcbc2..ee1bf41 100644
--- a/src/H5Ddbg.c
+++ b/src/H5Ddbg.c
@@ -90,7 +90,7 @@ H5Ddebug(hid_t dset_id)
/* Print B-tree information */
if(H5D_CHUNKED == dset->shared->layout.type)
- (void)H5D__chunk_dump_index(dset, H5AC_ind_dxpl_id, stdout);
+ (void)H5D__chunk_dump_index(dset, H5AC_ind_read_dxpl_id, stdout);
else if(H5D_CONTIGUOUS == dset->shared->layout.type)
HDfprintf(stdout, " %-10s %a\n", "Address:", dset->shared->layout.storage.u.contig.addr);
diff --git a/src/H5Ddeprec.c b/src/H5Ddeprec.c
index e95084e..e5bb321 100644
--- a/src/H5Ddeprec.c
+++ b/src/H5Ddeprec.c
@@ -154,7 +154,7 @@ H5Dcreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id,
/* Create the dataset through the VOL */
if(NULL == (dset = H5VL_dataset_create(obj->vol_obj, loc_params, obj->vol_info->vol_cls, name, dcpl_id,
- H5P_DATASET_ACCESS_DEFAULT, H5AC_dxpl_id, H5_REQUEST_NULL)))
+ H5P_DATASET_ACCESS_DEFAULT, H5AC_ind_read_dxpl_id, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create dataset")
/* Get an atom for the dataset */
@@ -163,7 +163,7 @@ H5Dcreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id,
done:
if (ret_value < 0 && dset)
- if(H5VL_dataset_close (dset, obj->vol_info->vol_cls, H5AC_dxpl_id, H5_REQUEST_NULL) < 0)
+ if(H5VL_dataset_close (dset, obj->vol_info->vol_cls, H5AC_ind_read_dxpl_id, H5_REQUEST_NULL) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataset")
FUNC_LEAVE_API(ret_value)
} /* end H5Dcreate1() */
@@ -190,10 +190,9 @@ hid_t
H5Dopen1(hid_t loc_id, const char *name)
{
void *dset = NULL; /* dset token from VOL plugin */
- H5VL_object_t *obj = NULL; /* object token of loc_id */
+ H5VL_object_t *obj = NULL; /* object token of loc_id */
H5VL_loc_params_t loc_params;
- hid_t dapl_id = H5P_DATASET_ACCESS_DEFAULT; /* dapl to use to open dataset */
- hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl to use to open datset */
+ hid_t dxpl_id = H5AC_ind_read_dxpl_id; /* dxpl to use to open datset */
hid_t ret_value;
FUNC_ENTER_API(FAIL)
@@ -211,7 +210,8 @@ H5Dopen1(hid_t loc_id, const char *name)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* Create the dataset through the VOL */
- if(NULL == (dset = H5VL_dataset_open(obj->vol_obj, loc_params, obj->vol_info->vol_cls, name, dapl_id, dxpl_id, H5_REQUEST_NULL)))
+ if(NULL == (dset = H5VL_dataset_open(obj->vol_obj, loc_params, obj->vol_info->vol_cls, name,
+ H5P_DATASET_ACCESS_DEFAULT, dxpl_id, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create dataset")
/* Get an atom for the dataset */
@@ -258,7 +258,7 @@ H5Dextend(hid_t dset_id, const hsize_t size[])
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no size specified")
/* Increase size */
- if(H5D__extend(dset, size, H5AC_dxpl_id) < 0)
+ if(H5D__extend(dset, size, H5AC_ind_read_dxpl_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to extend dataset")
done:
@@ -377,10 +377,16 @@ H5D__extend(H5D_t *dataset, const hsize_t *size, hid_t dxpl_id)
/* Allocate space for the new parts of the dataset, if appropriate */
fill = &dataset->shared->dcpl_cache.fill;
- if(fill->alloc_time == H5D_ALLOC_TIME_EARLY)
- if(H5D__alloc_storage(dataset, dxpl_id, H5D_ALLOC_EXTEND, FALSE, old_dims) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize dataset with fill value")
+ if(fill->alloc_time == H5D_ALLOC_TIME_EARLY) {
+ H5D_io_info_t io_info;
+ io_info.dset = dataset;
+ io_info.raw_dxpl_id = H5AC_rawdata_dxpl_id;
+ io_info.md_dxpl_id = dxpl_id;
+
+ if(H5D__alloc_storage(&io_info, H5D_ALLOC_EXTEND, FALSE, old_dims) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize dataset with fill value")
+ }
/* Mark the dataspace as dirty, for later writing to the file */
if(H5D__mark(dataset, dxpl_id, H5D_MARK_SPACE) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to mark dataspace as dirty")
diff --git a/src/H5Dearray.c b/src/H5Dearray.c
new file mode 100644
index 0000000..f24c69a
--- /dev/null
+++ b/src/H5Dearray.c
@@ -0,0 +1,1740 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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: Quincey Koziol <koziol@hdfgroup.org>
+ * Tuesday, January 27, 2009
+ *
+ * Purpose: Extensible array indexed (chunked) I/O functions. The chunks
+ * are given a single-dimensional index which is used as the
+ * offset in an extensible array that maps a chunk coordinate to
+ * a disk address.
+ *
+ */
+
+/****************/
+/* Module Setup */
+/****************/
+
+#include "H5Dmodule.h" /* This source code file is part of the H5D module */
+
+
+/***********/
+/* Headers */
+/***********/
+#include "H5private.h" /* Generic Functions */
+#include "H5Dpkg.h" /* Datasets */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5EAprivate.h" /* Extensible arrays */
+#include "H5FLprivate.h" /* Free Lists */
+#include "H5MFprivate.h" /* File space management */
+#include "H5VMprivate.h" /* Vector functions */
+
+
+/****************/
+/* Local Macros */
+/****************/
+
+/* Value to fill unset array elements with */
+#define H5D_EARRAY_FILL HADDR_UNDEF
+#define H5D_EARRAY_FILT_FILL {HADDR_UNDEF, 0, 0}
+
+
+/******************/
+/* Local Typedefs */
+/******************/
+
+/* Extensible array create/open user data */
+typedef struct H5D_earray_ctx_ud_t {
+ const H5F_t *f; /* Pointer to file info */
+ uint32_t chunk_size; /* Size of chunk (bytes) */
+} H5D_earray_ctx_ud_t;
+
+/* Extensible array callback context */
+typedef struct H5D_earray_ctx_t {
+ size_t file_addr_len; /* Size of addresses in the file (bytes) */
+ size_t chunk_size_len; /* Size of chunk sizes in the file (bytes) */
+} H5D_earray_ctx_t;
+
+/* User data for chunk callbacks */
+typedef struct H5D_earray_ud_t {
+ H5F_t *f; /* File pointer for operation */
+ hid_t dxpl_id; /* DXPL ID for operation */
+} H5D_earray_ud_t;
+
+/* Extensible Array callback info for iteration over chunks */
+typedef struct H5D_earray_it_ud_t {
+ H5D_chunk_common_ud_t common; /* Common info for Fixed Array user data (must be first) */
+ H5D_chunk_rec_t chunk_rec; /* Generic chunk record for callback */
+ hbool_t filtered; /* Whether the chunks are filtered */
+ H5D_chunk_cb_func_t cb; /* Chunk callback routine */
+ void *udata; /* User data for chunk callback routine */
+} H5D_earray_it_ud_t;
+
+/* Native extensible array element for chunks w/filters */
+typedef struct H5D_earray_filt_elmt_t {
+ haddr_t addr; /* Address of chunk */
+ uint32_t nbytes; /* Size of chunk (in file) */
+ uint32_t filter_mask; /* Excluded filters for chunk */
+} H5D_earray_filt_elmt_t;
+
+
+/********************/
+/* Local Prototypes */
+/********************/
+/* Extensible array iterator callbacks */
+static int H5D__earray_idx_iterate_cb(hsize_t idx, const void *_elmt, void *_udata);
+static int H5D__earray_idx_delete_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata);
+
+/* Extensible array class callbacks for chunks w/o filters */
+static void *H5D__earray_crt_context(void *udata);
+static herr_t H5D__earray_dst_context(void *ctx);
+static herr_t H5D__earray_fill(void *nat_blk, size_t nelmts);
+static herr_t H5D__earray_encode(void *raw, const void *elmt, size_t nelmts,
+ void *ctx);
+static herr_t H5D__earray_decode(const void *raw, void *elmt, size_t nelmts,
+ void *ctx);
+static herr_t H5D__earray_debug(FILE *stream, int indent, int fwidth,
+ hsize_t idx, const void *elmt);
+static void *H5D__earray_crt_dbg_context(H5F_t *f, hid_t dxpl_id, haddr_t obj_addr);
+static herr_t H5D__earray_dst_dbg_context(void *dbg_ctx);
+
+/* Extensible array class callbacks for chunks w/filters */
+/* (some shared with callbacks for chunks w/o filters) */
+static herr_t H5D__earray_filt_fill(void *nat_blk, size_t nelmts);
+static herr_t H5D__earray_filt_encode(void *raw, const void *elmt, size_t nelmts,
+ void *ctx);
+static herr_t H5D__earray_filt_decode(const void *raw, void *elmt, size_t nelmts,
+ void *ctx);
+static herr_t H5D__earray_filt_debug(FILE *stream, int indent, int fwidth,
+ hsize_t idx, const void *elmt);
+
+/* Chunked layout indexing callbacks */
+static herr_t H5D__earray_idx_init(const H5D_chk_idx_info_t *idx_info,
+ const H5S_t *space, haddr_t dset_ohdr_addr);
+static herr_t H5D__earray_idx_create(const H5D_chk_idx_info_t *idx_info);
+static hbool_t H5D__earray_idx_is_space_alloc(const H5O_storage_chunk_t *storage);
+static herr_t H5D__earray_idx_insert(const H5D_chk_idx_info_t *idx_info,
+ H5D_chunk_ud_t *udata, const H5D_t *dset);
+static herr_t H5D__earray_idx_get_addr(const H5D_chk_idx_info_t *idx_info,
+ H5D_chunk_ud_t *udata);
+static herr_t H5D__earray_idx_resize(H5O_layout_chunk_t *layout);
+static int H5D__earray_idx_iterate(const H5D_chk_idx_info_t *idx_info,
+ H5D_chunk_cb_func_t chunk_cb, void *chunk_udata);
+static herr_t H5D__earray_idx_remove(const H5D_chk_idx_info_t *idx_info,
+ H5D_chunk_common_ud_t *udata);
+static herr_t H5D__earray_idx_delete(const H5D_chk_idx_info_t *idx_info);
+static herr_t H5D__earray_idx_copy_setup(const H5D_chk_idx_info_t *idx_info_src,
+ const H5D_chk_idx_info_t *idx_info_dst);
+static herr_t H5D__earray_idx_copy_shutdown(H5O_storage_chunk_t *storage_src,
+ H5O_storage_chunk_t *storage_dst, hid_t dxpl_id);
+static herr_t H5D__earray_idx_size(const H5D_chk_idx_info_t *idx_info,
+ hsize_t *size);
+static herr_t H5D__earray_idx_reset(H5O_storage_chunk_t *storage, hbool_t reset_addr);
+static herr_t H5D__earray_idx_dump(const H5O_storage_chunk_t *storage,
+ FILE *stream);
+static herr_t H5D__earray_idx_dest(const H5D_chk_idx_info_t *idx_info);
+
+/* Generic extensible array routines */
+static herr_t H5D__earray_idx_open(const H5D_chk_idx_info_t *idx_info);
+
+
+/*********************/
+/* Package Variables */
+/*********************/
+
+/* Extensible array indexed chunk I/O ops */
+const H5D_chunk_ops_t H5D_COPS_EARRAY[1] = {{
+ H5D__earray_idx_init, /* init */
+ H5D__earray_idx_create, /* create */
+ H5D__earray_idx_is_space_alloc, /* is_space_alloc */
+ H5D__earray_idx_insert, /* insert */
+ H5D__earray_idx_get_addr, /* get_addr */
+ H5D__earray_idx_resize, /* resize */
+ H5D__earray_idx_iterate, /* iterate */
+ H5D__earray_idx_remove, /* remove */
+ H5D__earray_idx_delete, /* delete */
+ H5D__earray_idx_copy_setup, /* copy_setup */
+ H5D__earray_idx_copy_shutdown, /* copy_shutdown */
+ H5D__earray_idx_size, /* size */
+ H5D__earray_idx_reset, /* reset */
+ H5D__earray_idx_dump, /* dump */
+ H5D__earray_idx_dest /* destroy */
+}};
+
+
+/*****************************/
+/* Library Private Variables */
+/*****************************/
+
+/* Extensible array class callbacks for dataset chunks w/o filters */
+const H5EA_class_t H5EA_CLS_CHUNK[1]={{
+ H5EA_CLS_CHUNK_ID, /* Type of extensible array */
+ "Chunk w/o filters", /* Name of extensible array class */
+ sizeof(haddr_t), /* Size of native element */
+ H5D__earray_crt_context, /* Create context */
+ H5D__earray_dst_context, /* Destroy context */
+ H5D__earray_fill, /* Fill block of missing elements callback */
+ H5D__earray_encode, /* Element encoding callback */
+ H5D__earray_decode, /* Element decoding callback */
+ H5D__earray_debug, /* Element debugging callback */
+ H5D__earray_crt_dbg_context, /* Create debugging context */
+ H5D__earray_dst_dbg_context /* Destroy debugging context */
+}};
+
+/* Extensible array class callbacks for dataset chunks w/filters */
+const H5EA_class_t H5EA_CLS_FILT_CHUNK[1]={{
+ H5EA_CLS_FILT_CHUNK_ID, /* Type of extensible array */
+ "Chunk w/filters", /* Name of extensible array class */
+ sizeof(H5D_earray_filt_elmt_t), /* Size of native element */
+ H5D__earray_crt_context, /* Create context */
+ H5D__earray_dst_context, /* Destroy context */
+ H5D__earray_filt_fill, /* Fill block of missing elements callback */
+ H5D__earray_filt_encode, /* Element encoding callback */
+ H5D__earray_filt_decode, /* Element decoding callback */
+ H5D__earray_filt_debug, /* Element debugging callback */
+ H5D__earray_crt_dbg_context, /* Create debugging context */
+ H5D__earray_dst_dbg_context /* Destroy debugging context */
+}};
+
+
+/*******************/
+/* Local Variables */
+/*******************/
+
+/* Declare a free list to manage the H5D_earray_ctx_t struct */
+/* Declare a free list to manage the H5D_earray_ctx_ud_t struct */
+H5FL_DEFINE_STATIC(H5D_earray_ctx_t);
+H5FL_DEFINE_STATIC(H5D_earray_ctx_ud_t);
+
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__earray_crt_context
+ *
+ * Purpose: Create context for callbacks
+ *
+ * Return: Success: non-NULL
+ * Failure: NULL
+ *
+ * Programmer: Quincey Koziol
+ * Thursday, January 29, 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+static void *
+H5D__earray_crt_context(void *_udata)
+{
+ H5D_earray_ctx_t *ctx; /* Extensible array callback context */
+ H5D_earray_ctx_ud_t *udata = (H5D_earray_ctx_ud_t *)_udata; /* User data for extensible array context */
+ void *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(udata);
+ HDassert(udata->f);
+ HDassert(udata->chunk_size > 0);
+
+ /* Allocate new context structure */
+ if(NULL == (ctx = H5FL_MALLOC(H5D_earray_ctx_t)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, NULL, "can't allocate extensible array client callback context")
+
+ /* Initialize the context */
+ ctx->file_addr_len = H5F_SIZEOF_ADDR(udata->f);
+
+ /* Compute the size required for encoding the size of a chunk, allowing
+ * for an extra byte, in case the filter makes the chunk larger.
+ */
+ ctx->chunk_size_len = 1 + ((H5VM_log2_gen((uint64_t)udata->chunk_size) + 8) / 8);
+ if(ctx->chunk_size_len > 8)
+ ctx->chunk_size_len = 8;
+
+ /* Set return value */
+ ret_value = ctx;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5D__earray_crt_context() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__earray_dst_context
+ *
+ * Purpose: Destroy context for callbacks
+ *
+ * Return: Success: non-NULL
+ * Failure: NULL
+ *
+ * Programmer: Quincey Koziol
+ * Thursday, January 29, 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5D__earray_dst_context(void *_ctx)
+{
+ H5D_earray_ctx_t *ctx = (H5D_earray_ctx_t *)_ctx; /* Extensible array callback context */
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Sanity checks */
+ HDassert(ctx);
+
+ /* Release context structure */
+ ctx = H5FL_FREE(H5D_earray_ctx_t, ctx);
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5D__earray_dst_context() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__earray_fill
+ *
+ * Purpose: Fill "missing elements" in block of elements
+ *
+ * Return: Success: non-negative
+ * Failure: negative
+ *
+ * Programmer: Quincey Koziol
+ * Tuesday, January 27, 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5D__earray_fill(void *nat_blk, size_t nelmts)
+{
+ haddr_t fill_val = H5D_EARRAY_FILL; /* Value to fill elements with */
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Sanity checks */
+ HDassert(nat_blk);
+ HDassert(nelmts);
+
+ H5VM_array_fill(nat_blk, &fill_val, H5EA_CLS_CHUNK->nat_elmt_size, nelmts);
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5D__earray_fill() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__earray_encode
+ *
+ * Purpose: Encode an element from "native" to "raw" form
+ *
+ * Return: Success: non-negative
+ * Failure: negative
+ *
+ * Programmer: Quincey Koziol
+ * Tuesday, January 27, 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5D__earray_encode(void *raw, const void *_elmt, size_t nelmts, void *_ctx)
+{
+ H5D_earray_ctx_t *ctx = (H5D_earray_ctx_t *)_ctx; /* Extensible array callback context */
+ const haddr_t *elmt = (const haddr_t *)_elmt; /* Convenience pointer to native elements */
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Sanity checks */
+ HDassert(raw);
+ HDassert(elmt);
+ HDassert(nelmts);
+ HDassert(ctx);
+
+ /* Encode native elements into raw elements */
+ while(nelmts) {
+ /* Encode element */
+ /* (advances 'raw' pointer) */
+ H5F_addr_encode_len(ctx->file_addr_len, (uint8_t **)&raw, *elmt);
+
+ /* Advance native element pointer */
+ elmt++;
+
+ /* Decrement # of elements to encode */
+ nelmts--;
+ } /* end while */
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5D__earray_encode() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__earray_decode
+ *
+ * Purpose: Decode an element from "raw" to "native" form
+ *
+ * Return: Success: non-negative
+ * Failure: negative
+ *
+ * Programmer: Quincey Koziol
+ * Thursday, January 29, 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5D__earray_decode(const void *_raw, void *_elmt, size_t nelmts, void *_ctx)
+{
+ H5D_earray_ctx_t *ctx = (H5D_earray_ctx_t *)_ctx; /* Extensible array callback context */
+ haddr_t *elmt = (haddr_t *)_elmt; /* Convenience pointer to native elements */
+ const uint8_t *raw = (const uint8_t *)_raw; /* Convenience pointer to raw elements */
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Sanity checks */
+ HDassert(raw);
+ HDassert(elmt);
+ HDassert(nelmts);
+
+ /* Decode raw elements into native elements */
+ while(nelmts) {
+ /* Decode element */
+ /* (advances 'raw' pointer) */
+ H5F_addr_decode_len(ctx->file_addr_len, &raw, elmt);
+
+ /* Advance native element pointer */
+ elmt++;
+
+ /* Decrement # of elements to decode */
+ nelmts--;
+ } /* end while */
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5D__earray_decode() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__earray_debug
+ *
+ * Purpose: Display an element for debugging
+ *
+ * Return: Success: non-negative
+ * Failure: negative
+ *
+ * Programmer: Quincey Koziol
+ * Thursday, January 29, 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5D__earray_debug(FILE *stream, int indent, int fwidth, hsize_t idx,
+ const void *elmt)
+{
+ char temp_str[128]; /* Temporary string, for formatting */
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Sanity checks */
+ HDassert(stream);
+ HDassert(elmt);
+
+ /* Print element */
+ sprintf(temp_str, "Element #%llu:", (unsigned long long)idx);
+ HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, temp_str,
+ *(const haddr_t *)elmt);
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5D__earray_debug() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__earray_filt_fill
+ *
+ * Purpose: Fill "missing elements" in block of elements
+ *
+ * Return: Success: non-negative
+ * Failure: negative
+ *
+ * Programmer: Quincey Koziol
+ * Saturday, January 31, 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5D__earray_filt_fill(void *nat_blk, size_t nelmts)
+{
+ H5D_earray_filt_elmt_t fill_val = H5D_EARRAY_FILT_FILL; /* Value to fill elements with */
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Sanity checks */
+ HDassert(nat_blk);
+ HDassert(nelmts);
+ HDassert(sizeof(fill_val) == H5EA_CLS_FILT_CHUNK->nat_elmt_size);
+
+ H5VM_array_fill(nat_blk, &fill_val, H5EA_CLS_FILT_CHUNK->nat_elmt_size, nelmts);
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5D__earray_filt_fill() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__earray_filt_encode
+ *
+ * Purpose: Encode an element from "native" to "raw" form
+ *
+ * Return: Success: non-negative
+ * Failure: negative
+ *
+ * Programmer: Quincey Koziol
+ * Saturday, January 31, 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5D__earray_filt_encode(void *_raw, const void *_elmt, size_t nelmts, void *_ctx)
+{
+ H5D_earray_ctx_t *ctx = (H5D_earray_ctx_t *)_ctx; /* Extensible array callback context */
+ uint8_t *raw = (uint8_t *)_raw; /* Convenience pointer to raw elements */
+ const H5D_earray_filt_elmt_t *elmt = (const H5D_earray_filt_elmt_t *)_elmt; /* Convenience pointer to native elements */
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Sanity checks */
+ HDassert(raw);
+ HDassert(elmt);
+ HDassert(nelmts);
+ HDassert(ctx);
+
+ /* Encode native elements into raw elements */
+ while(nelmts) {
+ /* Encode element */
+ /* (advances 'raw' pointer) */
+ H5F_addr_encode_len(ctx->file_addr_len, &raw, elmt->addr);
+ UINT64ENCODE_VAR(raw, elmt->nbytes, ctx->chunk_size_len);
+ UINT32ENCODE(raw, elmt->filter_mask);
+
+ /* Advance native element pointer */
+ elmt++;
+
+ /* Decrement # of elements to encode */
+ nelmts--;
+ } /* end while */
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5D__earray_filt_encode() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__earray_filt_decode
+ *
+ * Purpose: Decode an element from "raw" to "native" form
+ *
+ * Return: Success: non-negative
+ * Failure: negative
+ *
+ * Programmer: Quincey Koziol
+ * Saturday, January 31, 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5D__earray_filt_decode(const void *_raw, void *_elmt, size_t nelmts, void *_ctx)
+{
+ H5D_earray_ctx_t *ctx = (H5D_earray_ctx_t *)_ctx; /* Extensible array callback context */
+ H5D_earray_filt_elmt_t *elmt = (H5D_earray_filt_elmt_t *)_elmt; /* Convenience pointer to native elements */
+ const uint8_t *raw = (const uint8_t *)_raw; /* Convenience pointer to raw elements */
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Sanity checks */
+ HDassert(raw);
+ HDassert(elmt);
+ HDassert(nelmts);
+
+ /* Decode raw elements into native elements */
+ while(nelmts) {
+ /* Decode element */
+ /* (advances 'raw' pointer) */
+ H5F_addr_decode_len(ctx->file_addr_len, &raw, &elmt->addr);
+ UINT64DECODE_VAR(raw, elmt->nbytes, ctx->chunk_size_len);
+ UINT32DECODE(raw, elmt->filter_mask);
+
+ /* Advance native element pointer */
+ elmt++;
+
+ /* Decrement # of elements to decode */
+ nelmts--;
+ } /* end while */
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5D__earray_filt_decode() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__earray_filt_debug
+ *
+ * Purpose: Display an element for debugging
+ *
+ * Return: Success: non-negative
+ * Failure: negative
+ *
+ * Programmer: Quincey Koziol
+ * Saturday, January 31, 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5D__earray_filt_debug(FILE *stream, int indent, int fwidth, hsize_t idx,
+ const void *_elmt)
+{
+ const H5D_earray_filt_elmt_t *elmt = (const H5D_earray_filt_elmt_t *)_elmt; /* Convenience pointer to native elements */
+ char temp_str[128]; /* Temporary string, for formatting */
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Sanity checks */
+ HDassert(stream);
+ HDassert(elmt);
+
+ /* Print element */
+ sprintf(temp_str, "Element #%llu:", (unsigned long long)idx);
+ HDfprintf(stream, "%*s%-*s {%a, %u, %0x}\n", indent, "", fwidth, temp_str,
+ elmt->addr, elmt->nbytes, elmt->filter_mask);
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5D__earray_filt_debug() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__earray_crt_dbg_context
+ *
+ * Purpose: Create context for debugging callback
+ * (get the layout message in the specified object header)
+ *
+ * Return: Success: non-NULL
+ * Failure: NULL
+ *
+ * Programmer: Vailin Choi; July 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+static void *
+H5D__earray_crt_dbg_context(H5F_t *f, hid_t dxpl_id, haddr_t obj_addr)
+{
+ H5D_earray_ctx_ud_t *dbg_ctx = NULL; /* Context for fixed array callback */
+ H5O_loc_t obj_loc; /* Pointer to an object's location */
+ hbool_t obj_opened = FALSE; /* Flag to indicate that the object header was opened */
+ H5O_layout_t layout; /* Layout message */
+ void *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(f);
+ HDassert(H5F_addr_defined(obj_addr));
+
+ /* Allocate context for debugging callback */
+ if(NULL == (dbg_ctx = H5FL_MALLOC(H5D_earray_ctx_ud_t)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, NULL, "can't allocate extensible array client callback context")
+
+ /* Set up the object header location info */
+ H5O_loc_reset(&obj_loc);
+ obj_loc.file = f;
+ obj_loc.addr = obj_addr;
+
+ /* Open the object header where the layout message resides */
+ if(H5O_open(&obj_loc) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, NULL, "can't open object header")
+ obj_opened = TRUE;
+
+ /* Read the layout message */
+ if(NULL == H5O_msg_read(&obj_loc, H5O_LAYOUT_ID, &layout, dxpl_id))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, NULL, "can't get layout info")
+
+ /* close the object header */
+ if(H5O_close(&obj_loc) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, NULL, "can't close object header")
+
+ /* Create user data */
+ dbg_ctx->f = f;
+ dbg_ctx->chunk_size = layout.u.chunk.size;
+
+ /* Set return value */
+ ret_value = dbg_ctx;
+
+done:
+ /* Cleanup on error */
+ if(ret_value == NULL) {
+ /* Release context structure */
+ if(dbg_ctx)
+ dbg_ctx = H5FL_FREE(H5D_earray_ctx_ud_t, dbg_ctx);
+
+ /* Close object header */
+ if(obj_opened) {
+ if(H5O_close(&obj_loc) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, NULL, "can't close object header")
+ } /* end if */
+ } /* end if */
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5D__earray_crt_dbg_context() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__earray_dst_dbg_context
+ *
+ * Purpose: Destroy context for debugging callback
+ * (free the layout message from the specified object header)
+ *
+ * Return: Success: non-negative
+ * Failure: negative
+ *
+ * Programmer: Vailin Choi; July 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5D__earray_dst_dbg_context(void *_dbg_ctx)
+{
+ H5D_earray_ctx_ud_t *dbg_ctx = (H5D_earray_ctx_ud_t *)_dbg_ctx; /* Context for extensible array callback */
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Sanity checks */
+ HDassert(dbg_ctx);
+
+ /* Release context structure */
+ dbg_ctx = H5FL_FREE(H5D_earray_ctx_ud_t, dbg_ctx);
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5D__earray_dst_dbg_context() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__earray_idx_open
+ *
+ * Purpose: Opens an existing extensible array.
+ *
+ * Note: This information is passively initialized from each index
+ * operation callback because those abstract chunk index operations
+ * are designed to work with the v1 B-tree chunk indices also,
+ * which don't require an 'open' for the data structure.
+ *
+ * Return: Success: non-negative
+ * Failure: negative
+ *
+ * Programmer: Quincey Koziol
+ * Thursday, January 29, 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5D__earray_idx_open(const H5D_chk_idx_info_t *idx_info)
+{
+ H5D_earray_ctx_ud_t udata; /* User data for extensible array open call */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check args */
+ HDassert(idx_info);
+ HDassert(idx_info->f);
+ HDassert(idx_info->pline);
+ HDassert(idx_info->layout);
+ HDassert(H5D_CHUNK_IDX_EARRAY == idx_info->layout->idx_type);
+ HDassert(idx_info->storage);
+ HDassert(H5D_CHUNK_IDX_EARRAY == idx_info->storage->idx_type);
+ HDassert(H5F_addr_defined(idx_info->storage->idx_addr));
+ HDassert(NULL == idx_info->storage->u.earray.ea);
+
+ /* Set up the user data */
+ udata.f = idx_info->f;
+ udata.chunk_size = idx_info->layout->size;
+
+ /* Open the extensible array for the chunk index */
+ if(NULL == (idx_info->storage->u.earray.ea = H5EA_open(idx_info->f, idx_info->dxpl_id, idx_info->storage->idx_addr, &udata)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't open extensible array")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5D__earray_idx_open() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__earray_idx_init
+ *
+ * Purpose: Initialize the indexing information for a dataset.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Wednesday, May 27, 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5D__earray_idx_init(const H5D_chk_idx_info_t *idx_info, const H5S_t *space,
+ haddr_t dset_ohdr_addr)
+{
+ hsize_t max_dims[H5O_LAYOUT_NDIMS]; /* Max. size of dataset dimensions */
+ int unlim_dim; /* Rank of the dataset's unlimited dimension */
+ int sndims; /* Rank of dataspace */
+ unsigned ndims; /* Rank of dataspace */
+ unsigned u; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check args */
+ HDassert(idx_info);
+ HDassert(idx_info->f);
+ HDassert(idx_info->pline);
+ HDassert(idx_info->layout);
+ HDassert(idx_info->storage);
+ HDassert(space);
+ HDassert(H5F_addr_defined(dset_ohdr_addr));
+
+ /* Get the dim info for dataset */
+ if((sndims = H5S_get_simple_extent_dims(space, NULL, max_dims)) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get dataspace dimensions")
+ H5_CHECKED_ASSIGN(ndims, unsigned, sndims, int);
+
+ /* Find the rank of the unlimited dimension */
+ unlim_dim = (-1);
+ for(u = 0; u < ndims; u++) {
+ /* Check for unlimited dimension */
+ if(H5S_UNLIMITED == max_dims[u]) {
+ /* Check if we've already found an unlimited dimension */
+ if(unlim_dim >= 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_ALREADYINIT, FAIL, "already found unlimited dimension")
+
+ /* Set the unlimited dimension */
+ unlim_dim = (int)u;
+ } /* end if */
+ } /* end for */
+
+ /* Check if we didn't find an unlimited dimension */
+ if(unlim_dim < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_UNINITIALIZED, FAIL, "didn't find unlimited dimension")
+
+ /* Set the unlimited dimension for the layout's future use */
+ idx_info->layout->u.earray.unlim_dim = (unsigned)unlim_dim;
+
+ /* Store the dataset's object header address for later */
+ idx_info->storage->u.earray.dset_ohdr_addr = dset_ohdr_addr;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5D__earray_idx_init() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__earray_idx_create
+ *
+ * Purpose: Creates a new indexed-storage extensible array and initializes
+ * the layout struct with information about the storage. The
+ * struct should be immediately written to the object header.
+ *
+ * This function must be called before passing LAYOUT to any of
+ * the other indexed storage functions!
+ *
+ * Return: Non-negative on success (with the LAYOUT argument initialized
+ * and ready to write to an object header). Negative on failure.
+ *
+ * Programmer: Quincey Koziol
+ * Tuesday, January 27, 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5D__earray_idx_create(const H5D_chk_idx_info_t *idx_info)
+{
+ H5EA_create_t cparam; /* Extensible array creation parameters */
+ H5D_earray_ctx_ud_t udata; /* User data for extensible array create call */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check args */
+ HDassert(idx_info);
+ HDassert(idx_info->f);
+ HDassert(idx_info->pline);
+ HDassert(idx_info->layout);
+ HDassert(idx_info->storage);
+ HDassert(!H5F_addr_defined(idx_info->storage->idx_addr));
+ HDassert(NULL == idx_info->storage->u.earray.ea);
+
+ /* General parameters */
+ if(idx_info->pline->nused > 0) {
+ unsigned chunk_size_len; /* Size of encoded chunk size */
+
+ /* Compute the size required for encoding the size of a chunk, allowing
+ * for an extra byte, in case the filter makes the chunk larger.
+ */
+ chunk_size_len = 1 + ((H5VM_log2_gen((uint64_t)idx_info->layout->size) + 8) / 8);
+ if(chunk_size_len > 8)
+ chunk_size_len = 8;
+
+ cparam.cls = H5EA_CLS_FILT_CHUNK;
+ cparam.raw_elmt_size = (uint8_t)(H5F_SIZEOF_ADDR(idx_info->f) + chunk_size_len + 4);
+ } /* end if */
+ else {
+ cparam.cls = H5EA_CLS_CHUNK;
+ cparam.raw_elmt_size = (uint8_t)H5F_SIZEOF_ADDR(idx_info->f);
+ } /* end else */
+ cparam.max_nelmts_bits = idx_info->layout->u.earray.cparam.max_nelmts_bits;
+ HDassert(cparam.max_nelmts_bits > 0);
+ cparam.idx_blk_elmts = idx_info->layout->u.earray.cparam.idx_blk_elmts;
+ HDassert(cparam.idx_blk_elmts > 0);
+ cparam.sup_blk_min_data_ptrs = idx_info->layout->u.earray.cparam.sup_blk_min_data_ptrs;
+ HDassert(cparam.sup_blk_min_data_ptrs > 0);
+ cparam.data_blk_min_elmts = idx_info->layout->u.earray.cparam.data_blk_min_elmts;
+ HDassert(cparam.data_blk_min_elmts > 0);
+ cparam.max_dblk_page_nelmts_bits = idx_info->layout->u.earray.cparam.max_dblk_page_nelmts_bits;
+ HDassert(cparam.max_dblk_page_nelmts_bits > 0);
+
+ /* Set up the user data */
+ udata.f = idx_info->f;
+ udata.chunk_size = idx_info->layout->size;
+
+ /* Create the extensible array for the chunk index */
+ if(NULL == (idx_info->storage->u.earray.ea = H5EA_create(idx_info->f, idx_info->dxpl_id, &cparam, &udata)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't create extensible array")
+
+ /* Get the address of the extensible array in file */
+ if(H5EA_get_addr(idx_info->storage->u.earray.ea, &(idx_info->storage->idx_addr)) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't query extensible array address")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5D__earray_idx_create() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__earray_idx_is_space_alloc
+ *
+ * Purpose: Query if space is allocated for index method
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Thursday, January 29, 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+static hbool_t
+H5D__earray_idx_is_space_alloc(const H5O_storage_chunk_t *storage)
+{
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Check args */
+ HDassert(storage);
+
+ FUNC_LEAVE_NOAPI((hbool_t)H5F_addr_defined(storage->idx_addr))
+} /* end H5D__earray_idx_is_space_alloc() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__earray_idx_insert
+ *
+ * Purpose: Insert chunk address into the indexing structure.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Vailin Choi; May 2014
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5D__earray_idx_insert(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata,
+ const H5D_t H5_ATTR_UNUSED *dset)
+{
+ H5EA_t *ea; /* Pointer to extensible array structure */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(idx_info);
+ HDassert(idx_info->f);
+ HDassert(idx_info->pline);
+ HDassert(idx_info->layout);
+ HDassert(idx_info->storage);
+ HDassert(H5F_addr_defined(idx_info->storage->idx_addr));
+ HDassert(udata);
+
+ /* Check if the extensible array is open yet */
+ if(NULL == idx_info->storage->u.earray.ea) {
+ /* Open the extensible array in file */
+ if(H5D__earray_idx_open(idx_info) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open extensible array")
+ } else /* Patch the top level file pointer contained in ea if needed */
+ H5EA_patch_file(idx_info->storage->u.earray.ea, idx_info->f);
+
+ /* Set convenience pointer to extensible array structure */
+ ea = idx_info->storage->u.earray.ea;
+
+ if(!H5F_addr_defined(udata->chunk_block.offset))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "The chunk should have allocated already")
+ if(udata->chunk_idx != (udata->chunk_idx & 0xffffffff)) /* negative value */
+ HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "chunk index must be less than 2^32")
+
+ /* Check for filters on chunks */
+ if(idx_info->pline->nused > 0) {
+ H5D_earray_filt_elmt_t elmt; /* Extensible array element */
+
+ elmt.addr = udata->chunk_block.offset;
+ H5_CHECKED_ASSIGN(elmt.nbytes, uint32_t, udata->chunk_block.length, hsize_t);
+ elmt.filter_mask = udata->filter_mask;
+
+ /* Set the info for the chunk */
+ if(H5EA_set(ea, idx_info->dxpl_id, udata->chunk_idx, &elmt) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set chunk info")
+ } /* end if */
+ else {
+ /* Set the address for the chunk */
+ if(H5EA_set(ea, idx_info->dxpl_id, udata->chunk_idx, &udata->chunk_block.offset) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set chunk address")
+ } /* end else */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5D__earray_idx_insert() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__earray_idx_get_addr
+ *
+ * Purpose: Get the file address of a chunk if file space has been
+ * assigned. Save the retrieved information in the udata
+ * supplied.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Thursday, January 29, 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5D__earray_idx_get_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata)
+{
+ H5EA_t *ea; /* Pointer to extensible array structure */
+ hsize_t idx; /* Array index of chunk */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(idx_info);
+ HDassert(idx_info->f);
+ HDassert(idx_info->pline);
+ HDassert(idx_info->layout);
+ HDassert(idx_info->storage);
+ HDassert(H5F_addr_defined(idx_info->storage->idx_addr));
+ HDassert(udata);
+
+ /* Check if the extensible array is open yet */
+ if(NULL == idx_info->storage->u.earray.ea) {
+ /* Open the extensible array in file */
+ if(H5D__earray_idx_open(idx_info) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open extensible array")
+ } else /* Patch the top level file pointer contained in ea if needed */
+ H5EA_patch_file(idx_info->storage->u.earray.ea, idx_info->f);
+
+ /* Set convenience pointer to extensible array structure */
+ ea = idx_info->storage->u.earray.ea;
+
+ /* Check for unlimited dim. not being the slowest-changing dim. */
+ if(idx_info->layout->u.earray.unlim_dim > 0) {
+ hsize_t swizzled_coords[H5O_LAYOUT_NDIMS]; /* swizzled chunk coordinates */
+ unsigned ndims = (idx_info->layout->ndims - 1); /* Number of dimensions */
+ unsigned u;
+
+ /* Compute coordinate offset from scaled offset */
+ for(u = 0; u < ndims; u++)
+ swizzled_coords[u] = udata->common.scaled[u] * idx_info->layout->dim[u];
+
+ H5VM_swizzle_coords(hsize_t, swizzled_coords, idx_info->layout->u.earray.unlim_dim);
+
+ /* Calculate the index of this chunk */
+ idx = H5VM_chunk_index(ndims, swizzled_coords, idx_info->layout->u.earray.swizzled_dim, idx_info->layout->u.earray.swizzled_down_chunks);
+ } /* end if */
+ else {
+ /* Calculate the index of this chunk */
+ idx = H5VM_array_offset_pre((idx_info->layout->ndims - 1), idx_info->layout->down_chunks, udata->common.scaled);
+ } /* end else */
+
+ udata->chunk_idx = idx;
+
+ /* Check for filters on chunks */
+ if(idx_info->pline->nused > 0) {
+ H5D_earray_filt_elmt_t elmt; /* Extensible array element */
+
+ /* Get the information for the chunk */
+ if(H5EA_get(ea, idx_info->dxpl_id, idx, &elmt) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk info")
+
+ /* Set the info for the chunk */
+ udata->chunk_block.offset = elmt.addr;
+ udata->chunk_block.length = elmt.nbytes;
+ udata->filter_mask = elmt.filter_mask;
+ } /* end if */
+ else {
+ /* Get the address for the chunk */
+ if(H5EA_get(ea, idx_info->dxpl_id, idx, &udata->chunk_block.offset) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk address")
+
+ /* Update the other (constant) information for the chunk */
+ udata->chunk_block.length = idx_info->layout->size;
+ udata->filter_mask = 0;
+ } /* end else */
+
+ if(!H5F_addr_defined(udata->chunk_block.offset))
+ udata->chunk_block.length = 0;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5D__earray_idx_get_addr() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__earray_idx_resize
+ *
+ * Purpose: Calculate/setup the swizzled down chunk array, used for chunk
+ * index calculations.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Thursday, July 23, 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5D__earray_idx_resize(H5O_layout_chunk_t *layout)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check args */
+ HDassert(layout);
+
+ /* "Swizzle" constant dimensions for this dataset */
+ if(layout->u.earray.unlim_dim > 0) {
+ hsize_t swizzled_chunks[H5O_LAYOUT_NDIMS]; /* Swizzled form of # of chunks in each dimension */
+
+ /* Get the swizzled chunk dimensions */
+ HDmemcpy(layout->u.earray.swizzled_dim, layout->dim, (layout->ndims - 1) * sizeof(layout->dim[0]));
+ H5VM_swizzle_coords(uint32_t, layout->u.earray.swizzled_dim, layout->u.earray.unlim_dim);
+
+ /* Get the swizzled number of chunks in each dimension */
+ HDmemcpy(swizzled_chunks, layout->chunks, (layout->ndims - 1) * sizeof(swizzled_chunks[0]));
+ H5VM_swizzle_coords(hsize_t, swizzled_chunks, layout->u.earray.unlim_dim);
+
+ /* Get the swizzled "down" sizes for each dimension */
+ if(H5VM_array_down((layout->ndims - 1), swizzled_chunks, layout->u.earray.swizzled_down_chunks) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't compute swizzled 'down' chunk size value")
+ } /* end if */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5D__earray_idx_resize() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__earray_idx_iterate_cb
+ *
+ * Purpose: Callback routine for extensible array element iteration.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Vailin Choi; Feb 2015
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+H5D__earray_idx_iterate_cb(hsize_t H5_ATTR_UNUSED idx, const void *_elmt, void *_udata)
+{
+ H5D_earray_it_ud_t *udata = (H5D_earray_it_ud_t *)_udata; /* User data */
+ unsigned ndims; /* Rank of chunk */
+ int curr_dim; /* Current dimension */
+ int ret_value = H5_ITER_CONT; /* Return value */
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Compose generic chunk record for callback */
+ if(udata->filtered) {
+ const H5D_earray_filt_elmt_t *filt_elmt = (const H5D_earray_filt_elmt_t *)_elmt;
+
+ udata->chunk_rec.chunk_addr = filt_elmt->addr;
+ udata->chunk_rec.nbytes = filt_elmt->nbytes;
+ udata->chunk_rec.filter_mask = filt_elmt->filter_mask;
+ } /* end if */
+ else
+ udata->chunk_rec.chunk_addr = *(const haddr_t *)_elmt;
+
+ /* Make "generic chunk" callback */
+ if(H5F_addr_defined(udata->chunk_rec.chunk_addr))
+ if((ret_value = (udata->cb)(&udata->chunk_rec, udata->udata)) < 0)
+ HERROR(H5E_DATASET, H5E_CALLBACK, "failure in generic chunk iterator callback");
+
+ /* Update coordinates of chunk in dataset */
+ ndims = udata->common.layout->ndims - 1;
+ HDassert(ndims > 0);
+ curr_dim = (int)(ndims - 1);
+ while(curr_dim >= 0) {
+ /* Increment coordinate in current dimension */
+ udata->chunk_rec.scaled[curr_dim]++;
+
+ /* Check if we went off the end of the current dimension */
+ if(udata->chunk_rec.scaled[curr_dim] >= udata->common.layout->chunks[curr_dim]) {
+ /* Reset coordinate & move to next faster dimension */
+ udata->chunk_rec.scaled[curr_dim] = 0;
+ curr_dim--;
+ } /* end if */
+ else
+ break;
+ } /* end while */
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5D__earray_idx_iterate_cb() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__earray_idx_iterate
+ *
+ * Purpose: Iterate over the chunks in an index, making a callback
+ * for each one.
+ *
+ * Note: This implementation is slow, particularly for sparse
+ * extensible arrays, replace it with call to H5EA_iterate()
+ * when that's available.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Thursday, January 29, 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+H5D__earray_idx_iterate(const H5D_chk_idx_info_t *idx_info,
+ H5D_chunk_cb_func_t chunk_cb, void *chunk_udata)
+{
+ H5EA_t *ea; /* Pointer to extensible array structure */
+ H5EA_stat_t ea_stat; /* Extensible array statistics */
+ int ret_value = H5_ITER_CONT; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(idx_info);
+ HDassert(idx_info->f);
+ HDassert(idx_info->pline);
+ HDassert(idx_info->layout);
+ HDassert(idx_info->storage);
+ HDassert(H5F_addr_defined(idx_info->storage->idx_addr));
+ HDassert(chunk_cb);
+ HDassert(chunk_udata);
+
+ /* Check if the extensible array is open yet */
+ if(NULL == idx_info->storage->u.earray.ea) {
+ /* Open the extensible array in file */
+ if(H5D__earray_idx_open(idx_info) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open extensible array")
+ } else /* Patch the top level file pointer contained in ea if needed */
+ H5EA_patch_file(idx_info->storage->u.earray.ea, idx_info->f);
+
+ /* Set convenience pointer to extensible array structure */
+ ea = idx_info->storage->u.earray.ea;
+
+ /* Get the extensible array statistics */
+ if(H5EA_get_stats(ea, &ea_stat) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't query extensible array statistics")
+
+ if(ea_stat.stored.max_idx_set > 0) {
+ H5D_earray_it_ud_t udata; /* User data for iteration callback */
+
+ /* Initialize userdata */
+ HDmemset(&udata, 0, sizeof udata);
+ udata.common.layout = idx_info->layout;
+ udata.common.storage = idx_info->storage;
+ HDmemset(&udata.chunk_rec, 0, sizeof(udata.chunk_rec));
+ udata.filtered = (idx_info->pline->nused > 0);
+ if(!udata.filtered) {
+ udata.chunk_rec.nbytes = idx_info->layout->size;
+ udata.chunk_rec.filter_mask = 0;
+ } /* end if */
+ udata.cb = chunk_cb;
+ udata.udata = chunk_udata;
+
+ /* Iterate over the extensible array elements */
+ if((ret_value = H5EA_iterate(ea, idx_info->dxpl_id, H5D__earray_idx_iterate_cb, &udata)) < 0)
+ HERROR(H5E_DATASET, H5E_BADITER, "unable to iterate over fixed array chunk index");
+ } /* end if */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5D__earray_idx_iterate() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__earray_idx_remove
+ *
+ * Purpose: Remove chunk from index.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Thursday, January 29, 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5D__earray_idx_remove(const H5D_chk_idx_info_t *idx_info, H5D_chunk_common_ud_t *udata)
+{
+ H5EA_t *ea; /* Pointer to extensible array structure */
+ hsize_t idx; /* Array index of chunk */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(idx_info);
+ HDassert(idx_info->f);
+ HDassert(idx_info->pline);
+ HDassert(idx_info->layout);
+ HDassert(idx_info->storage);
+ HDassert(H5F_addr_defined(idx_info->storage->idx_addr));
+ HDassert(udata);
+
+ /* Check if the extensible array is open yet */
+ if(NULL == idx_info->storage->u.earray.ea)
+ /* Open the extensible array in file */
+ if(H5D__earray_idx_open(idx_info) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open extensible array")
+
+ /* Set convenience pointer to extensible array structure */
+ ea = idx_info->storage->u.earray.ea;
+
+ /* Check for unlimited dim. not being the slowest-changing dim. */
+ if(idx_info->layout->u.earray.unlim_dim > 0) {
+ hsize_t swizzled_coords[H5O_LAYOUT_NDIMS]; /* swizzled chunk coordinates */
+ unsigned ndims = (idx_info->layout->ndims - 1); /* Number of dimensions */
+ unsigned u;
+
+ /* Compute coordinate offset from scaled offset */
+ for(u = 0; u < ndims; u++)
+ swizzled_coords[u] = udata->scaled[u] * idx_info->layout->dim[u];
+
+ H5VM_swizzle_coords(hsize_t, swizzled_coords, idx_info->layout->u.earray.unlim_dim);
+
+ /* Calculate the index of this chunk */
+ idx = H5VM_chunk_index(ndims, swizzled_coords, idx_info->layout->u.earray.swizzled_dim, idx_info->layout->u.earray.swizzled_down_chunks);
+ } /* end if */
+ else {
+ /* Calculate the index of this chunk */
+ idx = H5VM_array_offset_pre((idx_info->layout->ndims - 1), idx_info->layout->down_chunks, udata->scaled);
+ } /* end else */
+
+ /* Check for filters on chunks */
+ if(idx_info->pline->nused > 0) {
+ H5D_earray_filt_elmt_t elmt; /* Extensible array element */
+
+ /* Get the info about the chunk for the index */
+ if(H5EA_get(ea, idx_info->dxpl_id, idx, &elmt) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk info")
+
+ /* Remove raw data chunk from file */
+ HDassert(H5F_addr_defined(elmt.addr));
+ H5_CHECK_OVERFLOW(elmt.nbytes, /*From: */uint32_t, /*To: */hsize_t);
+ if(H5MF_xfree(idx_info->f, H5FD_MEM_DRAW, idx_info->dxpl_id, elmt.addr, (hsize_t)elmt.nbytes) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to free chunk")
+
+ /* Reset the info about the chunk for the index */
+ elmt.addr = HADDR_UNDEF;
+ elmt.nbytes = 0;
+ elmt.filter_mask = 0;
+ if(H5EA_set(ea, idx_info->dxpl_id, idx, &elmt) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to reset chunk info")
+ } /* end if */
+ else {
+ haddr_t addr = HADDR_UNDEF; /* Chunk address */
+
+ /* Get the address of the chunk for the index */
+ if(H5EA_get(ea, idx_info->dxpl_id, idx, &addr) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk address")
+
+ /* Remove raw data chunk from file */
+ HDassert(H5F_addr_defined(addr));
+ H5_CHECK_OVERFLOW(idx_info->layout->size, /*From: */uint32_t, /*To: */hsize_t);
+ if(H5MF_xfree(idx_info->f, H5FD_MEM_DRAW, idx_info->dxpl_id, addr, (hsize_t)idx_info->layout->size) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to free chunk")
+
+ /* Reset the address of the chunk for the index */
+ addr = HADDR_UNDEF;
+ if(H5EA_set(ea, idx_info->dxpl_id, idx, &addr) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to reset chunk address")
+ } /* end else */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5D__earray_idx_remove() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__earray_idx_delete_cb
+ *
+ * Purpose: Delete space for chunk in file
+ *
+ * Return: Success: Non-negative
+ * Failure: negative
+ *
+ * Programmer: Quincey Koziol
+ * Saturday, January 31, 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+H5D__earray_idx_delete_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata)
+{
+ H5D_earray_ud_t *udata = (H5D_earray_ud_t *)_udata; /* User data for callback */
+ int ret_value = H5_ITER_CONT; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(chunk_rec);
+ HDassert(H5F_addr_defined(chunk_rec->chunk_addr));
+ HDassert(chunk_rec->nbytes > 0);
+ HDassert(udata);
+ HDassert(udata->f);
+
+ /* Remove raw data chunk from file */
+ H5_CHECK_OVERFLOW(chunk_rec->nbytes, /*From: */uint32_t, /*To: */hsize_t);
+ if(H5MF_xfree(udata->f, H5FD_MEM_DRAW, udata->dxpl_id, chunk_rec->chunk_addr, (hsize_t)chunk_rec->nbytes) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, H5_ITER_ERROR, "unable to free chunk")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5D__earray_idx_delete_cb() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__earray_idx_delete
+ *
+ * Purpose: Delete index and raw data storage for entire dataset
+ * (i.e. all chunks)
+ *
+ * Note: This implementation is slow, particularly for sparse
+ * extensible arrays, replace it with call to H5EA_iterate()
+ * when that's available.
+ *
+ * Return: Success: Non-negative
+ * Failure: negative
+ *
+ * Programmer: Quincey Koziol
+ * Thursday, January 29, 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5D__earray_idx_delete(const H5D_chk_idx_info_t *idx_info)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(idx_info);
+ HDassert(idx_info->f);
+ HDassert(idx_info->pline);
+ HDassert(idx_info->layout);
+ HDassert(idx_info->storage);
+
+ /* Check if the index data structure has been allocated */
+ if(H5F_addr_defined(idx_info->storage->idx_addr)) {
+ H5D_earray_ud_t udata; /* User data for callback */
+ H5D_earray_ctx_ud_t ctx_udata; /* User data for extensible array open call */
+
+ /* Initialize user data for callback */
+ udata.f = idx_info->f;
+ udata.dxpl_id = idx_info->dxpl_id;
+
+ /* Iterate over the chunk addresses in the extensible array, deleting each chunk */
+ if(H5D__earray_idx_iterate(idx_info, H5D__earray_idx_delete_cb, &udata) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_BADITER, FAIL, "unable to iterate over chunk addresses")
+
+ /* Close extensible array */
+ if(H5EA_close(idx_info->storage->u.earray.ea, idx_info->dxpl_id) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to close extensible array")
+ idx_info->storage->u.earray.ea = NULL;
+
+ /* Set up the context user data */
+ ctx_udata.f = idx_info->f;
+ ctx_udata.chunk_size = idx_info->layout->size;
+
+ /* Delete extensible array */
+ if(H5EA_delete(idx_info->f, idx_info->dxpl_id, idx_info->storage->idx_addr, &ctx_udata) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTDELETE, FAIL, "unable to delete chunk extensible array")
+ idx_info->storage->idx_addr = HADDR_UNDEF;
+ } /* end if */
+ else
+ HDassert(NULL == idx_info->storage->u.earray.ea);
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5D__earray_idx_delete() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__earray_idx_copy_setup
+ *
+ * Purpose: Set up any necessary information for copying chunks
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Saturday, January 31, 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5D__earray_idx_copy_setup(const H5D_chk_idx_info_t *idx_info_src,
+ const H5D_chk_idx_info_t *idx_info_dst)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check args */
+ HDassert(idx_info_src);
+ HDassert(idx_info_src->f);
+ HDassert(idx_info_src->pline);
+ HDassert(idx_info_src->layout);
+ HDassert(idx_info_src->storage);
+ HDassert(idx_info_dst);
+ HDassert(idx_info_dst->f);
+ HDassert(idx_info_dst->pline);
+ HDassert(idx_info_dst->layout);
+ HDassert(idx_info_dst->storage);
+ HDassert(!H5F_addr_defined(idx_info_dst->storage->idx_addr));
+
+ /* Check if the source extensible array is open yet */
+ if(NULL == idx_info_src->storage->u.earray.ea)
+ /* Open the extensible array in file */
+ if(H5D__earray_idx_open(idx_info_src) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open extensible array")
+
+ /* Set copied metadata tag */
+ H5_BEGIN_TAG(idx_info_dst->dxpl_id, H5AC__COPIED_TAG, FAIL);
+
+ /* Create the extensible array that describes chunked storage in the dest. file */
+ if(H5D__earray_idx_create(idx_info_dst) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize chunked storage")
+ HDassert(H5F_addr_defined(idx_info_dst->storage->idx_addr));
+
+ /* Reset metadata tag */
+ H5_END_TAG(FAIL);
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5D__earray_idx_copy_setup() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__earray_idx_copy_shutdown
+ *
+ * Purpose: Shutdown any information from copying chunks
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Saturday, January 31, 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5D__earray_idx_copy_shutdown(H5O_storage_chunk_t *storage_src,
+ H5O_storage_chunk_t *storage_dst, hid_t dxpl_id)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check args */
+ HDassert(storage_src);
+ HDassert(storage_src->u.earray.ea);
+ HDassert(storage_dst);
+ HDassert(storage_dst->u.earray.ea);
+
+ /* Close extensible arrays */
+ if(H5EA_close(storage_src->u.earray.ea, dxpl_id) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to close extensible array")
+ storage_src->u.earray.ea = NULL;
+ if(H5EA_close(storage_dst->u.earray.ea, dxpl_id) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to close extensible array")
+ storage_dst->u.earray.ea = NULL;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5D__earray_idx_copy_shutdown() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__earray_idx_size
+ *
+ * Purpose: Retrieve the amount of index storage for chunked dataset
+ *
+ * Return: Success: Non-negative
+ * Failure: negative
+ *
+ * Programmer: Quincey Koziol
+ * Saturday, January 31, 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5D__earray_idx_size(const H5D_chk_idx_info_t *idx_info, hsize_t *index_size)
+{
+ H5EA_t *ea; /* Pointer to extensible array structure */
+ H5EA_stat_t ea_stat; /* Extensible array statistics */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check args */
+ HDassert(idx_info);
+ HDassert(idx_info->f);
+ HDassert(idx_info->pline);
+ HDassert(idx_info->layout);
+ HDassert(idx_info->storage);
+ HDassert(H5F_addr_defined(idx_info->storage->idx_addr));
+ HDassert(index_size);
+
+ /* Open the extensible array in file */
+ if(H5D__earray_idx_open(idx_info) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open extensible array")
+
+ /* Set convenience pointer to extensible array structure */
+ ea = idx_info->storage->u.earray.ea;
+
+ /* Get the extensible array statistics */
+ if(H5EA_get_stats(ea, &ea_stat) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't query extensible array statistics")
+
+ /* Set the size of the extensible array */
+ *index_size = ea_stat.computed.hdr_size + ea_stat.computed.index_blk_size
+ + ea_stat.stored.super_blk_size + ea_stat.stored.data_blk_size;
+
+done:
+ if(idx_info->storage->u.earray.ea) {
+ if(H5EA_close(idx_info->storage->u.earray.ea, idx_info->dxpl_id) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to close extensible array")
+ idx_info->storage->u.earray.ea = NULL;
+ } /* end if */
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5D__earray_idx_size() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__earray_idx_reset
+ *
+ * Purpose: Reset indexing information.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Saturday, January 31, 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5D__earray_idx_reset(H5O_storage_chunk_t *storage, hbool_t reset_addr)
+{
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Check args */
+ HDassert(storage);
+
+ /* Reset index info */
+ if(reset_addr) {
+ storage->idx_addr = HADDR_UNDEF;
+ storage->u.earray.dset_ohdr_addr = HADDR_UNDEF;
+ } /* end if */
+ storage->u.earray.ea = NULL;
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5D__earray_idx_reset() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__earray_idx_dump
+ *
+ * Purpose: Dump indexing information to a stream.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Saturday, January 31, 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5D__earray_idx_dump(const H5O_storage_chunk_t *storage, FILE *stream)
+{
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Check args */
+ HDassert(storage);
+ HDassert(stream);
+
+ HDfprintf(stream, " Address: %a\n", storage->idx_addr);
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5D__earray_idx_dump() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__earray_idx_dest
+ *
+ * Purpose: Release indexing information in memory.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Saturday, January 31, 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5D__earray_idx_dest(const H5D_chk_idx_info_t *idx_info)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check args */
+ HDassert(idx_info);
+ HDassert(idx_info->f);
+ HDassert(idx_info->storage);
+
+ /* Check if the extensible array is open */
+ if(idx_info->storage->u.earray.ea) {
+ /* Close extensible array */
+ if(H5EA_close(idx_info->storage->u.earray.ea, idx_info->dxpl_id) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to close extensible array")
+ idx_info->storage->u.earray.ea = NULL;
+ } /* end if */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5D__earray_idx_dest() */
+
diff --git a/src/H5Defl.c b/src/H5Defl.c
index ec96ae7..cf1b36c 100644
--- a/src/H5Defl.c
+++ b/src/H5Defl.c
@@ -28,12 +28,13 @@
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5Dpkg.h" /* Datasets */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5Fprivate.h" /* Files */
-#include "H5HLprivate.h" /* Local Heaps */
-#include "H5VMprivate.h" /* Vector and array functions */
+#include "H5private.h" /* Generic Functions */
+#include "H5Dpkg.h" /* Datasets */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Fprivate.h" /* Files */
+#include "H5HLprivate.h" /* Local Heaps */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5VMprivate.h" /* Vector and array functions */
/****************/
@@ -48,12 +49,14 @@
/* Callback info for readvv operation */
typedef struct H5D_efl_readvv_ud_t {
const H5O_efl_t *efl; /* Pointer to efl info */
+ const H5D_t *dset; /* The dataset */
unsigned char *rbuf; /* Read buffer */
} H5D_efl_readvv_ud_t;
/* Callback info for writevv operation */
typedef struct H5D_efl_writevv_ud_t {
const H5O_efl_t *efl; /* Pointer to efl info */
+ const H5D_t *dset; /* The dataset */
const unsigned char *wbuf; /* Write buffer */
} H5D_efl_writevv_ud_t;
@@ -75,9 +78,9 @@ static ssize_t H5D__efl_writevv(const H5D_io_info_t *io_info,
size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_offset_arr[]);
/* Helper routines */
-static herr_t H5D__efl_read(const H5O_efl_t *efl, haddr_t addr, size_t size,
+static herr_t H5D__efl_read(const H5O_efl_t *efl, const H5D_t *dset, haddr_t addr, size_t size,
uint8_t *buf);
-static herr_t H5D__efl_write(const H5O_efl_t *efl, haddr_t addr, size_t size,
+static herr_t H5D__efl_write(const H5O_efl_t *efl, const H5D_t *dset, haddr_t addr, size_t size,
const uint8_t *buf);
@@ -232,25 +235,22 @@ H5D__efl_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t H5_ATTR_UNU
/*-------------------------------------------------------------------------
- * Function: H5D__efl_read
+ * Function: H5D__efl_read
*
- * Purpose: Reads data from an external file list. It is an error to
- * read past the logical end of file, but reading past the end
- * of any particular member of the external file list results in
- * zeros.
+ * Purpose: Reads data from an external file list. It is an error to
+ * read past the logical end of file, but reading past the end
+ * of any particular member of the external file list results in
+ * zeros.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Wednesday, March 4, 1998
*
- * Modifications:
- * Robb Matzke, 1999-07-28
- * The ADDR argument is passed by value.
*-------------------------------------------------------------------------
*/
static herr_t
-H5D__efl_read(const H5O_efl_t *efl, haddr_t addr, size_t size, uint8_t *buf)
+H5D__efl_read(const H5O_efl_t *efl, const H5D_t *dset, haddr_t addr, size_t size, uint8_t *buf)
{
int fd = -1;
size_t to_read;
@@ -261,6 +261,7 @@ H5D__efl_read(const H5O_efl_t *efl, haddr_t addr, size_t size, uint8_t *buf)
haddr_t cur;
ssize_t n;
size_t u; /* Local index variable */
+ char *full_name = NULL; /* File name with prefix */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -273,44 +274,49 @@ H5D__efl_read(const H5O_efl_t *efl, haddr_t addr, size_t size, uint8_t *buf)
/* Find the first efl member from which to read */
for (u=0, cur=0; u<efl->nused; u++) {
- if(H5O_EFL_UNLIMITED == efl->slot[u].size || addr < cur + efl->slot[u].size) {
- skip = addr - cur;
- break;
- } /* end if */
- cur += efl->slot[u].size;
+ if(H5O_EFL_UNLIMITED == efl->slot[u].size || addr < cur + efl->slot[u].size) {
+ skip = addr - cur;
+ break;
+ } /* end if */
+ cur += efl->slot[u].size;
} /* end for */
/* Read the data */
while(size) {
HDassert(buf);
- if(u >= efl->nused)
- HGOTO_ERROR(H5E_EFL, H5E_OVERFLOW, FAIL, "read past logical end of file")
- if(H5F_OVERFLOW_HSIZET2OFFT(efl->slot[u].offset + skip))
- HGOTO_ERROR(H5E_EFL, H5E_OVERFLOW, FAIL, "external file address overflowed")
- if((fd = HDopen(efl->slot[u].name, O_RDONLY, 0)) < 0)
- HGOTO_ERROR(H5E_EFL, H5E_CANTOPENFILE, FAIL, "unable to open external raw data file")
- if(HDlseek(fd, (HDoff_t)(efl->slot[u].offset + skip), SEEK_SET) < 0)
- HGOTO_ERROR(H5E_EFL, H5E_SEEKERROR, FAIL, "unable to seek in external raw data file")
+ if(u >= efl->nused)
+ HGOTO_ERROR(H5E_EFL, H5E_OVERFLOW, FAIL, "read past logical end of file")
+ if(H5F_OVERFLOW_HSIZET2OFFT(efl->slot[u].offset + skip))
+ HGOTO_ERROR(H5E_EFL, H5E_OVERFLOW, FAIL, "external file address overflowed")
+ if(H5_combine_path(dset->shared->extfile_prefix, efl->slot[u].name, &full_name) < 0)
+ HGOTO_ERROR(H5E_EFL, H5E_NOSPACE, FAIL, "can't build external file name")
+ if((fd = HDopen(full_name, O_RDONLY, 0)) < 0)
+ HGOTO_ERROR(H5E_EFL, H5E_CANTOPENFILE, FAIL, "unable to open external raw data file")
+ if(HDlseek(fd, (HDoff_t)(efl->slot[u].offset + skip), SEEK_SET) < 0)
+ HGOTO_ERROR(H5E_EFL, H5E_SEEKERROR, FAIL, "unable to seek in external raw data file")
#ifndef NDEBUG
- tempto_read = MIN(efl->slot[u].size-skip, (hsize_t)size);
+ tempto_read = MIN((size_t)(efl->slot[u].size-skip), (hsize_t)size);
H5_CHECK_OVERFLOW(tempto_read, hsize_t, size_t);
- to_read = (size_t)tempto_read;
+ to_read = (size_t)tempto_read;
#else /* NDEBUG */
- to_read = MIN((size_t)(efl->slot[u].size - skip), size);
+ to_read = MIN((size_t)(efl->slot[u].size - skip), (hsize_t)size);
#endif /* NDEBUG */
- if((n = HDread(fd, buf, to_read)) < 0)
- HGOTO_ERROR(H5E_EFL, H5E_READERROR, FAIL, "read error in external raw data file")
- else if((size_t)n < to_read)
- HDmemset(buf + n, 0, to_read - (size_t)n);
- HDclose(fd);
- fd = -1;
- size -= to_read;
- buf += to_read;
- skip = 0;
- u++;
+ if((n = HDread(fd, buf, to_read)) < 0)
+ HGOTO_ERROR(H5E_EFL, H5E_READERROR, FAIL, "read error in external raw data file")
+ else if((size_t)n < to_read)
+ HDmemset(buf + n, 0, to_read - (size_t)n);
+ full_name = (char *)H5MM_xfree(full_name);
+ HDclose(fd);
+ fd = -1;
+ size -= to_read;
+ buf += to_read;
+ skip = 0;
+ u++;
} /* end while */
done:
+ if(full_name)
+ full_name = (char *)H5MM_xfree(full_name);
if(fd >= 0)
HDclose(fd);
@@ -337,7 +343,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5D__efl_write(const H5O_efl_t *efl, haddr_t addr, size_t size, const uint8_t *buf)
+H5D__efl_write(const H5O_efl_t *efl, const H5D_t *dset, haddr_t addr, size_t size, const uint8_t *buf)
{
int fd = -1;
size_t to_write;
@@ -346,7 +352,8 @@ H5D__efl_write(const H5O_efl_t *efl, haddr_t addr, size_t size, const uint8_t *b
#endif /* NDEBUG */
haddr_t cur;
hsize_t skip = 0;
- size_t u; /* Local index variable */
+ size_t u; /* Local index variable */
+ char *full_name = NULL; /* File name with prefix */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -359,46 +366,51 @@ H5D__efl_write(const H5O_efl_t *efl, haddr_t addr, size_t size, const uint8_t *b
/* Find the first efl member in which to write */
for(u = 0, cur = 0; u < efl->nused; u++) {
- if(H5O_EFL_UNLIMITED == efl->slot[u].size || addr < cur + efl->slot[u].size) {
- skip = addr - cur;
- break;
- } /* end if */
- cur += efl->slot[u].size;
+ if(H5O_EFL_UNLIMITED == efl->slot[u].size || addr < cur + efl->slot[u].size) {
+ skip = addr - cur;
+ break;
+ } /* end if */
+ cur += efl->slot[u].size;
} /* end for */
/* Write the data */
while(size) {
HDassert(buf);
- if(u >= efl->nused)
- HGOTO_ERROR(H5E_EFL, H5E_OVERFLOW, FAIL, "write past logical end of file")
- if(H5F_OVERFLOW_HSIZET2OFFT(efl->slot[u].offset + skip))
- HGOTO_ERROR(H5E_EFL, H5E_OVERFLOW, FAIL, "external file address overflowed")
- if((fd = HDopen(efl->slot[u].name, O_CREAT | O_RDWR, 0666)) < 0) {
- if(HDaccess(efl->slot[u].name, F_OK) < 0)
- HGOTO_ERROR(H5E_EFL, H5E_CANTOPENFILE, FAIL, "external raw data file does not exist")
- else
- HGOTO_ERROR(H5E_EFL, H5E_CANTOPENFILE, FAIL, "unable to open external raw data file")
- } /* end if */
- if(HDlseek(fd, (HDoff_t)(efl->slot[u].offset + skip), SEEK_SET) < 0)
- HGOTO_ERROR(H5E_EFL, H5E_SEEKERROR, FAIL, "unable to seek in external raw data file")
+ if(u >= efl->nused)
+ HGOTO_ERROR(H5E_EFL, H5E_OVERFLOW, FAIL, "write past logical end of file")
+ if(H5F_OVERFLOW_HSIZET2OFFT(efl->slot[u].offset + skip))
+ HGOTO_ERROR(H5E_EFL, H5E_OVERFLOW, FAIL, "external file address overflowed")
+ if(H5_combine_path(dset->shared->extfile_prefix, efl->slot[u].name, &full_name) < 0)
+ HGOTO_ERROR(H5E_EFL, H5E_NOSPACE, FAIL, "can't build external file name")
+ if((fd = HDopen(full_name, O_CREAT | O_RDWR, 0666)) < 0) {
+ if(HDaccess(full_name, F_OK) < 0)
+ HGOTO_ERROR(H5E_EFL, H5E_CANTOPENFILE, FAIL, "external raw data file does not exist")
+ else
+ HGOTO_ERROR(H5E_EFL, H5E_CANTOPENFILE, FAIL, "unable to open external raw data file")
+ } /* end if */
+ if(HDlseek(fd, (HDoff_t)(efl->slot[u].offset + skip), SEEK_SET) < 0)
+ HGOTO_ERROR(H5E_EFL, H5E_SEEKERROR, FAIL, "unable to seek in external raw data file")
#ifndef NDEBUG
- tempto_write = MIN(efl->slot[u].size - skip, (hsize_t)size);
+ tempto_write = MIN(efl->slot[u].size - skip, (hsize_t)size);
H5_CHECK_OVERFLOW(tempto_write, hsize_t, size_t);
to_write = (size_t)tempto_write;
#else /* NDEBUG */
- to_write = MIN((size_t)(efl->slot[u].size - skip), size);
+ to_write = MIN((size_t)(efl->slot[u].size - skip), size);
#endif /* NDEBUG */
- if((size_t)HDwrite(fd, buf, to_write) != to_write)
- HGOTO_ERROR(H5E_EFL, H5E_READERROR, FAIL, "write error in external raw data file")
- HDclose (fd);
- fd = -1;
- size -= to_write;
- buf += to_write;
- skip = 0;
- u++;
+ if((size_t)HDwrite(fd, buf, to_write) != to_write)
+ HGOTO_ERROR(H5E_EFL, H5E_READERROR, FAIL, "write error in external raw data file")
+ full_name = (char *)H5MM_xfree(full_name);
+ HDclose (fd);
+ fd = -1;
+ size -= to_write;
+ buf += to_write;
+ skip = 0;
+ u++;
} /* end while */
done:
+ if(full_name)
+ full_name = (char *)H5MM_xfree(full_name);
if(fd >= 0)
HDclose(fd);
@@ -427,7 +439,7 @@ H5D__efl_readvv_cb(hsize_t dst_off, hsize_t src_off, size_t len, void *_udata)
FUNC_ENTER_STATIC
/* Read data */
- if(H5D__efl_read(udata->efl, dst_off, len, (udata->rbuf + src_off)) < 0)
+ if(H5D__efl_read(udata->efl, udata->dset, dst_off, len, (udata->rbuf + src_off)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "EFL read failed")
done:
@@ -464,6 +476,9 @@ H5D__efl_readvv(const H5D_io_info_t *io_info,
HDassert(io_info);
HDassert(io_info->store->efl.nused > 0);
HDassert(io_info->u.rbuf);
+ HDassert(io_info->dset);
+ HDassert(io_info->dset->shared);
+ HDassert(io_info->dset->shared->extfile_prefix);
HDassert(dset_curr_seq);
HDassert(dset_len_arr);
HDassert(dset_off_arr);
@@ -473,6 +488,7 @@ H5D__efl_readvv(const H5D_io_info_t *io_info,
/* Set up user data for H5VM_opvv() */
udata.efl = &(io_info->store->efl);
+ udata.dset = io_info->dset;
udata.rbuf = (unsigned char *)io_info->u.rbuf;
/* Call generic sequence operation routine */
@@ -507,7 +523,7 @@ H5D__efl_writevv_cb(hsize_t dst_off, hsize_t src_off, size_t len, void *_udata)
FUNC_ENTER_STATIC
/* Write data */
- if(H5D__efl_write(udata->efl, dst_off, len, (udata->wbuf + src_off)) < 0)
+ if(H5D__efl_write(udata->efl, udata->dset, dst_off, len, (udata->wbuf + src_off)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "EFL write failed")
done:
@@ -544,6 +560,9 @@ H5D__efl_writevv(const H5D_io_info_t *io_info,
HDassert(io_info);
HDassert(io_info->store->efl.nused > 0);
HDassert(io_info->u.wbuf);
+ HDassert(io_info->dset);
+ HDassert(io_info->dset->shared);
+ HDassert(io_info->dset->shared->extfile_prefix);
HDassert(dset_curr_seq);
HDassert(dset_len_arr);
HDassert(dset_off_arr);
@@ -553,6 +572,7 @@ H5D__efl_writevv(const H5D_io_info_t *io_info,
/* Set up user data for H5VM_opvv() */
udata.efl = &(io_info->store->efl);
+ udata.dset = io_info->dset;
udata.wbuf = (const unsigned char *)io_info->u.wbuf;
/* Call generic sequence operation routine */
diff --git a/src/H5Dfarray.c b/src/H5Dfarray.c
new file mode 100644
index 0000000..af60bb1
--- /dev/null
+++ b/src/H5Dfarray.c
@@ -0,0 +1,1638 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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: Vailin Choi <vchoi@hdfgroup.org>
+ * Thursday, April 30, 2009
+ *
+ * Purpose: Fixed array indexed (chunked) I/O functions.
+ * The chunk coordinate is mapped as an index into an array of
+ * disk addresses for the chunks.
+ *
+ */
+
+/****************/
+/* Module Setup */
+/****************/
+
+#include "H5Dmodule.h" /* This source code file is part of the H5D module */
+
+
+/***********/
+/* Headers */
+/***********/
+#include "H5private.h" /* Generic Functions */
+#include "H5Dpkg.h" /* Datasets */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5FAprivate.h" /* Fixed arrays */
+#include "H5FLprivate.h" /* Free Lists */
+#include "H5MFprivate.h" /* File space management */
+#include "H5VMprivate.h" /* Vector functions */
+
+
+/****************/
+/* Local Macros */
+/****************/
+
+/* Value to fill unset array elements with */
+#define H5D_FARRAY_FILL HADDR_UNDEF
+#define H5D_FARRAY_FILT_FILL {HADDR_UNDEF, 0, 0}
+
+
+/******************/
+/* Local Typedefs */
+/******************/
+
+/* Fixed array create/open user data */
+typedef struct H5D_farray_ctx_ud_t {
+ const H5F_t *f; /* Pointer to file info */
+ uint32_t chunk_size; /* Size of chunk (bytes) */
+} H5D_farray_ctx_ud_t;
+
+/* Fixed array callback context */
+typedef struct H5D_farray_ctx_t {
+ size_t file_addr_len; /* Size of addresses in the file (bytes) */
+ size_t chunk_size_len; /* Size of chunk sizes in the file (bytes) */
+} H5D_farray_ctx_t;
+
+/* User data for chunk deletion callback */
+typedef struct H5D_farray_del_ud_t {
+ H5F_t *f; /* File pointer for operation */
+ hid_t dxpl_id; /* DXPL ID for operation */
+ hbool_t filtered; /* Whether the chunks are filtered */
+ uint32_t unfilt_size; /* Size of unfiltered chunk in bytes */
+} H5D_farray_del_ud_t;
+
+/* Fixed Array callback info for iteration over chunks */
+typedef struct H5D_farray_it_ud_t {
+ H5D_chunk_common_ud_t common; /* Common info for Fixed Array user data (must be first) */
+ H5D_chunk_rec_t chunk_rec; /* Generic chunk record for callback */
+ hbool_t filtered; /* Whether the chunks are filtered */
+ H5D_chunk_cb_func_t cb; /* Chunk callback routine */
+ void *udata; /* User data for chunk callback routine */
+} H5D_farray_it_ud_t;
+
+/* Native fixed array element for chunks w/filters */
+typedef struct H5D_farray_filt_elmt_t {
+ haddr_t addr; /* Address of chunk */
+ uint32_t nbytes; /* Size of chunk (in file) */
+ uint32_t filter_mask; /* Excluded filters for chunk */
+} H5D_farray_filt_elmt_t;
+
+
+/********************/
+/* Local Prototypes */
+/********************/
+
+/* Fixed Array iterator callbacks */
+static int H5D__farray_idx_iterate_cb(hsize_t idx, const void *_elmt, void *_udata);
+static int H5D__farray_idx_delete_cb(hsize_t idx, const void *_elmt, void *_udata);
+
+/* Fixed array class callbacks for chunks w/o filters */
+static void *H5D__farray_crt_context(void *udata);
+static herr_t H5D__farray_dst_context(void *ctx);
+static herr_t H5D__farray_fill(void *nat_blk, size_t nelmts);
+static herr_t H5D__farray_encode(void *raw, const void *elmt, size_t nelmts,
+ void *ctx);
+static herr_t H5D__farray_decode(const void *raw, void *elmt, size_t nelmts,
+ void *ctx);
+static herr_t H5D__farray_debug(FILE *stream, int indent, int fwidth,
+ hsize_t idx, const void *elmt);
+static void *H5D__farray_crt_dbg_context(H5F_t *f, hid_t dxpl_id,
+ haddr_t obj_addr);
+static herr_t H5D__farray_dst_dbg_context(void *dbg_ctx);
+
+/* Fixed array class callbacks for chunks w/filters */
+/* (some shared with callbacks for chunks w/o filters) */
+static herr_t H5D__farray_filt_fill(void *nat_blk, size_t nelmts);
+static herr_t H5D__farray_filt_encode(void *raw, const void *elmt, size_t nelmts,
+ void *ctx);
+static herr_t H5D__farray_filt_decode(const void *raw, void *elmt, size_t nelmts,
+ void *ctx);
+static herr_t H5D__farray_filt_debug(FILE *stream, int indent, int fwidth,
+ hsize_t idx, const void *elmt);
+
+/* Chunked layout indexing callbacks */
+static herr_t H5D__farray_idx_init(const H5D_chk_idx_info_t *idx_info,
+ const H5S_t *space, haddr_t dset_ohdr_addr);
+static herr_t H5D__farray_idx_create(const H5D_chk_idx_info_t *idx_info);
+static hbool_t H5D__farray_idx_is_space_alloc(const H5O_storage_chunk_t *storage);
+static herr_t H5D__farray_idx_insert(const H5D_chk_idx_info_t *idx_info,
+ H5D_chunk_ud_t *udata, const H5D_t *dset);
+static herr_t H5D__farray_idx_get_addr(const H5D_chk_idx_info_t *idx_info,
+ H5D_chunk_ud_t *udata);
+static int H5D__farray_idx_iterate(const H5D_chk_idx_info_t *idx_info,
+ H5D_chunk_cb_func_t chunk_cb, void *chunk_udata);
+static herr_t H5D__farray_idx_remove(const H5D_chk_idx_info_t *idx_info,
+ H5D_chunk_common_ud_t *udata);
+static herr_t H5D__farray_idx_delete(const H5D_chk_idx_info_t *idx_info);
+static herr_t H5D__farray_idx_copy_setup(const H5D_chk_idx_info_t *idx_info_src,
+ const H5D_chk_idx_info_t *idx_info_dst);
+static herr_t H5D__farray_idx_copy_shutdown(H5O_storage_chunk_t *storage_src,
+ H5O_storage_chunk_t *storage_dst, hid_t dxpl_id);
+static herr_t H5D__farray_idx_size(const H5D_chk_idx_info_t *idx_info,
+ hsize_t *size);
+static herr_t H5D__farray_idx_reset(H5O_storage_chunk_t *storage, hbool_t reset_addr);
+static herr_t H5D__farray_idx_dump(const H5O_storage_chunk_t *storage, FILE *stream);
+static herr_t H5D__farray_idx_dest(const H5D_chk_idx_info_t *idx_info);
+
+/* Generic extensible array routines */
+static herr_t H5D__farray_idx_open(const H5D_chk_idx_info_t *idx_info);
+
+/*********************/
+/* Package Variables */
+/*********************/
+
+/* Fixed array indexed chunk I/O ops */
+const H5D_chunk_ops_t H5D_COPS_FARRAY[1] = {{
+ H5D__farray_idx_init, /* init */
+ H5D__farray_idx_create, /* create */
+ H5D__farray_idx_is_space_alloc, /* is_space_alloc */
+ H5D__farray_idx_insert, /* insert */
+ H5D__farray_idx_get_addr, /* get_addr */
+ NULL, /* resize */
+ H5D__farray_idx_iterate, /* iterate */
+ H5D__farray_idx_remove, /* remove */
+ H5D__farray_idx_delete, /* delete */
+ H5D__farray_idx_copy_setup, /* copy_setup */
+ H5D__farray_idx_copy_shutdown, /* copy_shutdown */
+ H5D__farray_idx_size, /* size */
+ H5D__farray_idx_reset, /* reset */
+ H5D__farray_idx_dump, /* dump */
+ H5D__farray_idx_dest /* destroy */
+}};
+
+
+/*****************************/
+/* Library Private Variables */
+/*****************************/
+
+
+/*******************/
+/* Local Variables */
+/*******************/
+
+/* Fixed array class callbacks for dataset chunks w/o filters */
+const H5FA_class_t H5FA_CLS_CHUNK[1]={{
+ H5FA_CLS_CHUNK_ID, /* Type of fixed array */
+ "Chunk w/o filters", /* Name of fixed array class */
+ sizeof(haddr_t), /* Size of native element */
+ H5D__farray_crt_context, /* Create context */
+ H5D__farray_dst_context, /* Destroy context */
+ H5D__farray_fill, /* Fill block of missing elements callback */
+ H5D__farray_encode, /* Element encoding callback */
+ H5D__farray_decode, /* Element decoding callback */
+ H5D__farray_debug, /* Element debugging callback */
+ H5D__farray_crt_dbg_context, /* Create debugging context */
+ H5D__farray_dst_dbg_context /* Destroy debugging context */
+}};
+
+/* Fixed array class callbacks for dataset chunks w/filters */
+const H5FA_class_t H5FA_CLS_FILT_CHUNK[1]={{
+ H5FA_CLS_FILT_CHUNK_ID, /* Type of fixed array */
+ "Chunk w/filters", /* Name of fixed array class */
+ sizeof(H5D_farray_filt_elmt_t), /* Size of native element */
+ H5D__farray_crt_context, /* Create context */
+ H5D__farray_dst_context, /* Destroy context */
+ H5D__farray_filt_fill, /* Fill block of missing elements callback */
+ H5D__farray_filt_encode, /* Element encoding callback */
+ H5D__farray_filt_decode, /* Element decoding callback */
+ H5D__farray_filt_debug, /* Element debugging callback */
+ H5D__farray_crt_dbg_context, /* Create debugging context */
+ H5D__farray_dst_dbg_context /* Destroy debugging context */
+}};
+
+/* Declare a free list to manage the H5D_farray_ctx_t struct */
+H5FL_DEFINE_STATIC(H5D_farray_ctx_t);
+
+/* Declare a free list to manage the H5D_farray_ctx_ud_t struct */
+H5FL_DEFINE_STATIC(H5D_farray_ctx_ud_t);
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__farray_crt_context
+ *
+ * Purpose: Create context for callbacks
+ *
+ * Return: Success: non-NULL
+ * Failure: NULL
+ *
+ * Programmer: Vailin Choi
+ * Thursday, April 30, 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+static void *
+H5D__farray_crt_context(void *_udata)
+{
+ H5D_farray_ctx_t *ctx; /* Fixed array callback context */
+ H5D_farray_ctx_ud_t *udata = (H5D_farray_ctx_ud_t *)_udata; /* User data for fixed array context */
+ void *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(udata);
+ HDassert(udata->f);
+ HDassert(udata->chunk_size > 0);
+
+ /* Allocate new context structure */
+ if(NULL == (ctx = H5FL_MALLOC(H5D_farray_ctx_t)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, NULL, "can't allocate fixed array client callback context")
+
+ /* Initialize the context */
+ ctx->file_addr_len = H5F_SIZEOF_ADDR(udata->f);
+
+ /* Compute the size required for encoding the size of a chunk, allowing
+ * for an extra byte, in case the filter makes the chunk larger.
+ */
+ ctx->chunk_size_len = 1 + ((H5VM_log2_gen((uint64_t)udata->chunk_size) + 8) / 8);
+ if(ctx->chunk_size_len > 8)
+ ctx->chunk_size_len = 8;
+
+ /* Set return value */
+ ret_value = ctx;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5D__farray_crt_context() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__farray_dst_context
+ *
+ * Purpose: Destroy context for callbacks
+ *
+ * Return: Success: non-NULL
+ * Failure: NULL
+ *
+ * Programmer: Vailin Choi
+ * Thursday, April 30, 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5D__farray_dst_context(void *_ctx)
+{
+ H5D_farray_ctx_t *ctx = (H5D_farray_ctx_t *)_ctx; /* Fixed array callback context */
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Sanity checks */
+ HDassert(ctx);
+
+ /* Release context structure */
+ ctx = H5FL_FREE(H5D_farray_ctx_t, ctx);
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5D__farray_dst_context() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__farray_fill
+ *
+ * Purpose: Fill "missing elements" in block of elements
+ *
+ * Return: Success: non-negative
+ * Failure: negative
+ *
+ * Programmer: Vailin Choi
+ * Thursday, April 30, 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5D__farray_fill(void *nat_blk, size_t nelmts)
+{
+ haddr_t fill_val = H5D_FARRAY_FILL; /* Value to fill elements with */
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Sanity checks */
+ HDassert(nat_blk);
+ HDassert(nelmts);
+
+ H5VM_array_fill(nat_blk, &fill_val, H5FA_CLS_CHUNK->nat_elmt_size, nelmts);
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5D__farray_fill() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__farray_encode
+ *
+ * Purpose: Encode an element from "native" to "raw" form
+ *
+ * Return: Success: non-negative
+ * Failure: negative
+ *
+ * Programmer: Vailin Choi
+ * Thursday, April 30, 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5D__farray_encode(void *raw, const void *_elmt, size_t nelmts, void *_ctx)
+{
+ H5D_farray_ctx_t *ctx = (H5D_farray_ctx_t *)_ctx; /* Fixed array callback context */
+ const haddr_t *elmt = (const haddr_t *)_elmt; /* Convenience pointer to native elements */
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Sanity checks */
+ HDassert(raw);
+ HDassert(elmt);
+ HDassert(nelmts);
+ HDassert(ctx);
+
+ /* Encode native elements into raw elements */
+ while(nelmts) {
+ /* Encode element */
+ /* (advances 'raw' pointer) */
+ H5F_addr_encode_len(ctx->file_addr_len, (uint8_t **)&raw, *elmt);
+
+ /* Advance native element pointer */
+ elmt++;
+
+ /* Decrement # of elements to encode */
+ nelmts--;
+ } /* end while */
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5D__farray_encode() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__farray_decode
+ *
+ * Purpose: Decode an element from "raw" to "native" form
+ *
+ * Return: Success: non-negative
+ * Failure: negative
+ *
+ * Programmer: Vailin Choi
+ * Thursday, April 30, 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5D__farray_decode(const void *_raw, void *_elmt, size_t nelmts, void *_ctx)
+{
+ H5D_farray_ctx_t *ctx = (H5D_farray_ctx_t *)_ctx; /* Fixed array callback context */
+ haddr_t *elmt = (haddr_t *)_elmt; /* Convenience pointer to native elements */
+ const uint8_t *raw = (const uint8_t *)_raw; /* Convenience pointer to raw elements */
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Sanity checks */
+ HDassert(raw);
+ HDassert(elmt);
+ HDassert(nelmts);
+
+ /* Decode raw elements into native elements */
+ while(nelmts) {
+ /* Decode element */
+ /* (advances 'raw' pointer) */
+ H5F_addr_decode_len(ctx->file_addr_len, &raw, elmt);
+
+ /* Advance native element pointer */
+ elmt++;
+
+ /* Decrement # of elements to decode */
+ nelmts--;
+ } /* end while */
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5D__farray_decode() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__farray_debug
+ *
+ * Purpose: Display an element for debugging
+ *
+ * Return: Success: non-negative
+ * Failure: negative
+ *
+ * Programmer: Vailin Choi
+ * Thursday, April 30, 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5D__farray_debug(FILE *stream, int indent, int fwidth, hsize_t idx,
+ const void *elmt)
+{
+ char temp_str[128]; /* Temporary string, for formatting */
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Sanity checks */
+ HDassert(stream);
+ HDassert(elmt);
+
+ /* Print element */
+ sprintf(temp_str, "Element #%llu:", (unsigned long long)idx);
+ HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, temp_str,
+ *(const haddr_t *)elmt);
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5D__farray_debug() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__farray_crt_dbg_context
+ *
+ * Purpose: Create context for debugging callback
+ * (get the layout message in the specified object header)
+ *
+ * Return: Success: non-NULL
+ * Failure: NULL
+ *
+ * Programmer: Vailin Choi
+ * 5th August, 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+static void *
+H5D__farray_crt_dbg_context(H5F_t *f, hid_t dxpl_id, haddr_t obj_addr)
+{
+ H5D_farray_ctx_ud_t *dbg_ctx = NULL; /* Context for fixed array callback */
+ H5O_loc_t obj_loc; /* Pointer to an object's location */
+ hbool_t obj_opened = FALSE; /* Flag to indicate that the object header was opened */
+ H5O_layout_t layout; /* Layout message */
+ void *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(f);
+ HDassert(H5F_addr_defined(obj_addr));
+
+ /* Allocate context for debugging callback */
+ if(NULL == (dbg_ctx = H5FL_MALLOC(H5D_farray_ctx_ud_t)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, NULL, "can't allocate fixed array client callback context")
+
+ /* Set up the object header location info */
+ H5O_loc_reset(&obj_loc);
+ obj_loc.file = f;
+ obj_loc.addr = obj_addr;
+
+ /* Open the object header where the layout message resides */
+ if(H5O_open(&obj_loc) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, NULL, "can't open object header")
+ obj_opened = TRUE;
+
+ /* Read the layout message */
+ if(NULL == H5O_msg_read(&obj_loc, H5O_LAYOUT_ID, &layout, dxpl_id))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, NULL, "can't get layout info")
+
+ /* close the object header */
+ if(H5O_close(&obj_loc) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, NULL, "can't close object header")
+
+ /* Create user data */
+ dbg_ctx->f = f;
+ dbg_ctx->chunk_size = layout.u.chunk.size;
+
+ /* Set return value */
+ ret_value = dbg_ctx;
+
+done:
+ /* Cleanup on error */
+ if(ret_value == NULL) {
+ /* Release context structure */
+ if(dbg_ctx)
+ dbg_ctx = H5FL_FREE(H5D_farray_ctx_ud_t, dbg_ctx);
+
+ /* Close object header */
+ if(obj_opened) {
+ if(H5O_close(&obj_loc) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, NULL, "can't close object header")
+ } /* end if */
+ } /* end if */
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5D__farray_crt_dbg_context() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__farray_dst_dbg_context
+ *
+ * Purpose: Destroy context for debugging callback
+ * (free the layout message from the specified object header)
+ *
+ * Return: Success: non-negative
+ * Failure: negative
+ *
+ * Programmer: Quincey Koziol
+ * 24th September, 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5D__farray_dst_dbg_context(void *_dbg_ctx)
+{
+ H5D_farray_ctx_ud_t *dbg_ctx = (H5D_farray_ctx_ud_t *)_dbg_ctx; /* Context for fixed array callback */
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Sanity checks */
+ HDassert(dbg_ctx);
+
+ /* Release context structure */
+ dbg_ctx = H5FL_FREE(H5D_farray_ctx_ud_t, dbg_ctx);
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5D__farray_dst_dbg_context() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__farray_filt_fill
+ *
+ * Purpose: Fill "missing elements" in block of elements
+ *
+ * Return: Success: non-negative
+ * Failure: negative
+ *
+ * Programmer: Vailin Choi
+ * Thursday, April 30, 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5D__farray_filt_fill(void *nat_blk, size_t nelmts)
+{
+ H5D_farray_filt_elmt_t fill_val = H5D_FARRAY_FILT_FILL; /* Value to fill elements with */
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Sanity checks */
+ HDassert(nat_blk);
+ HDassert(nelmts);
+ HDassert(sizeof(fill_val) == H5FA_CLS_FILT_CHUNK->nat_elmt_size);
+
+ H5VM_array_fill(nat_blk, &fill_val, H5FA_CLS_FILT_CHUNK->nat_elmt_size, nelmts);
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5D__farray_filt_fill() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__farray_filt_encode
+ *
+ * Purpose: Encode an element from "native" to "raw" form
+ *
+ * Return: Success: non-negative
+ * Failure: negative
+ *
+ * Programmer: Vailin Choi
+ * Thursday, April 30, 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5D__farray_filt_encode(void *_raw, const void *_elmt, size_t nelmts, void *_ctx)
+{
+ H5D_farray_ctx_t *ctx = (H5D_farray_ctx_t *)_ctx; /* Fixed array callback context */
+ uint8_t *raw = (uint8_t *)_raw; /* Convenience pointer to raw elements */
+ const H5D_farray_filt_elmt_t *elmt = (const H5D_farray_filt_elmt_t *)_elmt; /* Convenience pointer to native elements */
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Sanity checks */
+ HDassert(raw);
+ HDassert(elmt);
+ HDassert(nelmts);
+ HDassert(ctx);
+
+ /* Encode native elements into raw elements */
+ while(nelmts) {
+ /* Encode element */
+ /* (advances 'raw' pointer) */
+ H5F_addr_encode_len(ctx->file_addr_len, &raw, elmt->addr);
+ UINT64ENCODE_VAR(raw, elmt->nbytes, ctx->chunk_size_len);
+ UINT32ENCODE(raw, elmt->filter_mask);
+
+ /* Advance native element pointer */
+ elmt++;
+
+ /* Decrement # of elements to encode */
+ nelmts--;
+ } /* end while */
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5D__farray_filt_encode() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__farray_filt_decode
+ *
+ * Purpose: Decode an element from "raw" to "native" form
+ *
+ * Return: Success: non-negative
+ * Failure: negative
+ *
+ * Programmer: Vailin Choi
+ * Thursday, April 30, 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5D__farray_filt_decode(const void *_raw, void *_elmt, size_t nelmts, void *_ctx)
+{
+ H5D_farray_ctx_t *ctx = (H5D_farray_ctx_t *)_ctx; /* Fixed array callback context */
+ H5D_farray_filt_elmt_t *elmt = (H5D_farray_filt_elmt_t *)_elmt; /* Convenience pointer to native elements */
+ const uint8_t *raw = (const uint8_t *)_raw; /* Convenience pointer to raw elements */
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Sanity checks */
+ HDassert(raw);
+ HDassert(elmt);
+ HDassert(nelmts);
+
+ /* Decode raw elements into native elements */
+ while(nelmts) {
+ /* Decode element */
+ /* (advances 'raw' pointer) */
+ H5F_addr_decode_len(ctx->file_addr_len, &raw, &elmt->addr);
+ UINT64DECODE_VAR(raw, elmt->nbytes, ctx->chunk_size_len);
+ UINT32DECODE(raw, elmt->filter_mask);
+
+ /* Advance native element pointer */
+ elmt++;
+
+ /* Decrement # of elements to decode */
+ nelmts--;
+ } /* end while */
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5D__farray_filt_decode() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__farray_filt_debug
+ *
+ * Purpose: Display an element for debugging
+ *
+ * Return: Success: non-negative
+ * Failure: negative
+ *
+ * Programmer: Vailin Choi
+ * Thursday, April 30, 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5D__farray_filt_debug(FILE *stream, int indent, int fwidth, hsize_t idx,
+ const void *_elmt)
+{
+ const H5D_farray_filt_elmt_t *elmt = (const H5D_farray_filt_elmt_t *)_elmt; /* Convenience pointer to native elements */
+ char temp_str[128]; /* Temporary string, for formatting */
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Sanity checks */
+ HDassert(stream);
+ HDassert(elmt);
+
+ /* Print element */
+ sprintf(temp_str, "Element #%llu:", (unsigned long long)idx);
+ HDfprintf(stream, "%*s%-*s {%a, %u, %0x}\n", indent, "", fwidth, temp_str,
+ elmt->addr, elmt->nbytes, elmt->filter_mask);
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5D__farray_filt_debug() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__farray_idx_init
+ *
+ * Purpose: Initialize the indexing information for a dataset.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Neil Fortner
+ * Wednensday, May 23, 2012
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5D__farray_idx_init(const H5D_chk_idx_info_t *idx_info, const H5S_t H5_ATTR_UNUSED *space, haddr_t dset_ohdr_addr)
+{
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Check args */
+ HDassert(idx_info);
+ HDassert(idx_info->storage);
+ HDassert(H5F_addr_defined(dset_ohdr_addr));
+
+ idx_info->storage->u.farray.dset_ohdr_addr = dset_ohdr_addr;
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5D__farray_idx_init() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__farray_idx_open
+ *
+ * Purpose: Opens an existing fixed array and initializes
+ * the layout struct with information about the storage.
+ *
+ * Return: Success: non-negative
+ * Failure: negative
+ *
+ * Programmer: Vailin Choi
+ * Thursday, April 30, 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5D__farray_idx_open(const H5D_chk_idx_info_t *idx_info)
+{
+ H5D_farray_ctx_ud_t udata; /* User data for fixed array open call */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check args */
+ HDassert(idx_info);
+ HDassert(idx_info->f);
+ HDassert(idx_info->pline);
+ HDassert(idx_info->layout);
+ HDassert(H5D_CHUNK_IDX_FARRAY == idx_info->layout->idx_type);
+ HDassert(idx_info->storage);
+ HDassert(H5D_CHUNK_IDX_FARRAY == idx_info->storage->idx_type);
+ HDassert(H5F_addr_defined(idx_info->storage->idx_addr));
+ HDassert(NULL == idx_info->storage->u.farray.fa);
+
+ /* Set up the user data */
+ udata.f = idx_info->f;
+ udata.chunk_size = idx_info->layout->size;
+
+ /* Open the fixed array for the chunk index */
+ if(NULL == (idx_info->storage->u.farray.fa = H5FA_open(idx_info->f, idx_info->dxpl_id, idx_info->storage->idx_addr, &udata)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't open fixed array")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5D__farray_idx_open() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__farray_idx_create
+ *
+ * Purpose: Creates a new indexed-storage fixed array and initializes
+ * the layout struct with information about the storage. The
+ * struct should be immediately written to the object header.
+ *
+ * This function must be called before passing LAYOUT to any of
+ * the other indexed storage functions!
+ *
+ * Return: Non-negative on success (with the LAYOUT argument initialized
+ * and ready to write to an object header). Negative on failure.
+ *
+ * Programmer: Vailin Choi
+ * Thursday, April 30, 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5D__farray_idx_create(const H5D_chk_idx_info_t *idx_info)
+{
+ H5FA_create_t cparam; /* Fixed array creation parameters */
+ H5D_farray_ctx_ud_t udata; /* User data for fixed array create call */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check args */
+ HDassert(idx_info);
+ HDassert(idx_info->f);
+ HDassert(idx_info->pline);
+ HDassert(idx_info->layout);
+ HDassert(idx_info->storage);
+ HDassert(!H5F_addr_defined(idx_info->storage->idx_addr));
+ HDassert(NULL == idx_info->storage->u.farray.fa);
+ HDassert(idx_info->layout->nchunks);
+
+ /* General parameters */
+ if(idx_info->pline->nused > 0) {
+ unsigned chunk_size_len; /* Size of encoded chunk size */
+
+ /* Compute the size required for encoding the size of a chunk, allowing
+ * for an extra byte, in case the filter makes the chunk larger.
+ */
+ chunk_size_len = 1 + ((H5VM_log2_gen((uint64_t)idx_info->layout->size) + 8) / 8);
+ if(chunk_size_len > 8)
+ chunk_size_len = 8;
+
+ cparam.cls = H5FA_CLS_FILT_CHUNK;
+ cparam.raw_elmt_size = (uint8_t)(H5F_SIZEOF_ADDR(idx_info->f) + chunk_size_len + 4);
+ } /* end if */
+ else {
+ cparam.cls = H5FA_CLS_CHUNK;
+ cparam.raw_elmt_size = (uint8_t)H5F_SIZEOF_ADDR(idx_info->f);
+ } /* end else */
+ cparam.max_dblk_page_nelmts_bits = idx_info->layout->u.farray.cparam.max_dblk_page_nelmts_bits;
+ HDassert(cparam.max_dblk_page_nelmts_bits > 0);
+ cparam.nelmts = idx_info->layout->max_nchunks;
+
+ /* Set up the user data */
+ udata.f = idx_info->f;
+ udata.chunk_size = idx_info->layout->size;
+
+ /* Create the fixed array for the chunk index */
+ if(NULL == (idx_info->storage->u.farray.fa = H5FA_create(idx_info->f, idx_info->dxpl_id, &cparam, &udata)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't create fixed array")
+
+ /* Get the address of the fixed array in file */
+ if(H5FA_get_addr(idx_info->storage->u.farray.fa, &(idx_info->storage->idx_addr)) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't query fixed array address")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5D__farray_idx_create() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__farray_idx_is_space_alloc
+ *
+ * Purpose: Query if space is allocated for index method
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Vailin Choi
+ * Thursday, April 30, 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+static hbool_t
+H5D__farray_idx_is_space_alloc(const H5O_storage_chunk_t *storage)
+{
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Check args */
+ HDassert(storage);
+
+ FUNC_LEAVE_NOAPI((hbool_t)H5F_addr_defined(storage->idx_addr))
+} /* end H5D__farray_idx_is_space_alloc() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__farray_idx_insert
+ *
+ * Purpose: Insert chunk address into the indexing structure.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Vailin Choi; 5 May 2014
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5D__farray_idx_insert(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata,
+ const H5D_t H5_ATTR_UNUSED *dset)
+{
+ H5FA_t *fa; /* Pointer to fixed array structure */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(idx_info);
+ HDassert(idx_info->f);
+ HDassert(idx_info->pline);
+ HDassert(idx_info->layout);
+ HDassert(idx_info->storage);
+ HDassert(H5F_addr_defined(idx_info->storage->idx_addr));
+ HDassert(udata);
+
+ /* Check if the fixed array is open yet */
+ if(NULL == idx_info->storage->u.farray.fa) {
+ /* Open the fixed array in file */
+ if(H5D__farray_idx_open(idx_info) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open fixed array")
+ } else /* Patch the top level file pointer contained in fa if needed */
+ H5FA_patch_file(idx_info->storage->u.farray.fa, idx_info->f);
+
+ /* Set convenience pointer to fixed array structure */
+ fa = idx_info->storage->u.farray.fa;
+
+ if(!H5F_addr_defined(udata->chunk_block.offset))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "The chunk should have allocated already")
+ if(udata->chunk_idx != (udata->chunk_idx & 0xffffffff)) /* negative value */
+ HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "chunk index must be less than 2^32")
+
+ /* Check for filters on chunks */
+ if(idx_info->pline->nused > 0) {
+ H5D_farray_filt_elmt_t elmt; /* Fixed array element */
+
+ elmt.addr = udata->chunk_block.offset;
+ H5_CHECKED_ASSIGN(elmt.nbytes, uint32_t, udata->chunk_block.length, hsize_t);
+ elmt.filter_mask = udata->filter_mask;
+
+ /* Set the info for the chunk */
+ if(H5FA_set(fa, idx_info->dxpl_id, udata->chunk_idx, &elmt) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set chunk info")
+ } /* end if */
+ else {
+ /* Set the address for the chunk */
+ if(H5FA_set(fa, idx_info->dxpl_id, udata->chunk_idx, &udata->chunk_block.offset) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set chunk address")
+ } /* end else */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5D__farray_idx_insert() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__farray_idx_get_addr
+ *
+ * Purpose: Get the file address of a chunk if file space has been
+ * assigned. Save the retrieved information in the udata
+ * supplied.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Vailin Choi
+ * Thursday, April 30, 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5D__farray_idx_get_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata)
+{
+ H5FA_t *fa; /* Pointer to fixed array structure */
+ hsize_t idx; /* Array index of chunk */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(idx_info);
+ HDassert(idx_info->f);
+ HDassert(idx_info->pline);
+ HDassert(idx_info->layout);
+ HDassert(idx_info->storage);
+ HDassert(H5F_addr_defined(idx_info->storage->idx_addr));
+ HDassert(udata);
+
+ /* Check if the fixed array is open yet */
+ if(NULL == idx_info->storage->u.farray.fa) {
+ /* Open the fixed array in file */
+ if(H5D__farray_idx_open(idx_info) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open fixed array")
+ } else /* Patch the top level file pointer contained in fa if needed */
+ H5FA_patch_file(idx_info->storage->u.farray.fa, idx_info->f);
+
+ /* Set convenience pointer to fixed array structure */
+ fa = idx_info->storage->u.farray.fa;
+
+ /* Calculate the index of this chunk */
+ idx = H5VM_array_offset_pre((idx_info->layout->ndims - 1), idx_info->layout->max_down_chunks, udata->common.scaled);
+
+ udata->chunk_idx = idx;
+
+ /* Check for filters on chunks */
+ if(idx_info->pline->nused > 0) {
+ H5D_farray_filt_elmt_t elmt; /* Fixed array element */
+
+ /* Get the information for the chunk */
+ if(H5FA_get(fa, idx_info->dxpl_id, idx, &elmt) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk info")
+
+ /* Set the info for the chunk */
+ udata->chunk_block.offset = elmt.addr;
+ udata->chunk_block.length = elmt.nbytes;
+ udata->filter_mask = elmt.filter_mask;
+ } /* end if */
+ else {
+ /* Get the address for the chunk */
+ if(H5FA_get(fa, idx_info->dxpl_id, idx, &udata->chunk_block.offset) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk address")
+
+ /* Update the other (constant) information for the chunk */
+ udata->chunk_block.length = idx_info->layout->size;
+ udata->filter_mask = 0;
+ } /* end else */
+
+ if(!H5F_addr_defined(udata->chunk_block.offset))
+ udata->chunk_block.length = 0;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5D__farray_idx_get_addr() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__farray_idx_iterate_cb
+ *
+ * Purpose: Callback routine for fixed array element iteration.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Vailin Choi
+ * Thursday, April 30, 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+H5D__farray_idx_iterate_cb(hsize_t H5_ATTR_UNUSED idx, const void *_elmt, void *_udata)
+{
+ H5D_farray_it_ud_t *udata = (H5D_farray_it_ud_t *)_udata; /* User data */
+ unsigned ndims; /* Rank of chunk */
+ int curr_dim; /* Current dimension */
+ int ret_value = H5_ITER_CONT; /* Return value */
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Compose generic chunk record for callback */
+ if(udata->filtered) {
+ const H5D_farray_filt_elmt_t *filt_elmt = (const H5D_farray_filt_elmt_t *)_elmt;
+
+ udata->chunk_rec.chunk_addr = filt_elmt->addr;
+ udata->chunk_rec.nbytes = filt_elmt->nbytes;
+ udata->chunk_rec.filter_mask = filt_elmt->filter_mask;
+ } /* end if */
+ else
+ udata->chunk_rec.chunk_addr = *(const haddr_t *)_elmt;
+
+ /* Make "generic chunk" callback */
+ if(H5F_addr_defined(udata->chunk_rec.chunk_addr))
+ if((ret_value = (udata->cb)(&udata->chunk_rec, udata->udata)) < 0)
+ HERROR(H5E_DATASET, H5E_CALLBACK, "failure in generic chunk iterator callback");
+
+ /* Update coordinates of chunk in dataset */
+ ndims = udata->common.layout->ndims - 1;
+ HDassert(ndims > 0);
+ curr_dim = (int)(ndims - 1);
+ while(curr_dim >= 0) {
+ /* Increment coordinate in current dimension */
+ udata->chunk_rec.scaled[curr_dim]++;
+
+ /* Check if we went off the end of the current dimension */
+ if(udata->chunk_rec.scaled[curr_dim] >= udata->common.layout->chunks[curr_dim]) {
+ /* Reset coordinate & move to next faster dimension */
+ udata->chunk_rec.scaled[curr_dim] = 0;
+ curr_dim--;
+ } /* end if */
+ else
+ break;
+ } /* end while */
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5D__farray_idx_iterate_cb() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__farray_idx_iterate
+ *
+ * Purpose: Iterate over the chunks in an index, making a callback
+ * for each one.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Vailin Choi
+ * Thursday, April 30, 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+H5D__farray_idx_iterate(const H5D_chk_idx_info_t *idx_info,
+ H5D_chunk_cb_func_t chunk_cb, void *chunk_udata)
+{
+ H5FA_t *fa; /* Pointer to fixed array structure */
+ H5FA_stat_t fa_stat; /* Fixed array statistics */
+ int ret_value = FAIL; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(idx_info);
+ HDassert(idx_info->f);
+ HDassert(idx_info->pline);
+ HDassert(idx_info->layout);
+ HDassert(idx_info->storage);
+ HDassert(H5F_addr_defined(idx_info->storage->idx_addr));
+ HDassert(chunk_cb);
+ HDassert(chunk_udata);
+
+ /* Check if the fixed array is open yet */
+ if(NULL == idx_info->storage->u.farray.fa) {
+ /* Open the fixed array in file */
+ if(H5D__farray_idx_open(idx_info) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open fixed array")
+ } else /* Patch the top level file pointer contained in fa if needed */
+ H5FA_patch_file(idx_info->storage->u.farray.fa, idx_info->f);
+
+ /* Set convenience pointer to fixed array structure */
+ fa = idx_info->storage->u.farray.fa;
+
+ /* Get the fixed array statistics */
+ if(H5FA_get_stats(fa, &fa_stat) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't query fixed array statistics")
+
+ /* Check if there are any array elements */
+ if(fa_stat.nelmts > 0) {
+ H5D_farray_it_ud_t udata; /* User data for iteration callback */
+
+ /* Initialize userdata */
+ HDmemset(&udata, 0, sizeof udata);
+ udata.common.layout = idx_info->layout;
+ udata.common.storage = idx_info->storage;
+ HDmemset(&udata.chunk_rec, 0, sizeof(udata.chunk_rec));
+ udata.filtered = (idx_info->pline->nused > 0);
+ if(!udata.filtered) {
+ udata.chunk_rec.nbytes = idx_info->layout->size;
+ udata.chunk_rec.filter_mask = 0;
+ } /* end if */
+ udata.cb = chunk_cb;
+ udata.udata = chunk_udata;
+
+ /* Iterate over the fixed array elements */
+ if((ret_value = H5FA_iterate(fa, idx_info->dxpl_id, H5D__farray_idx_iterate_cb, &udata)) < 0)
+ HERROR(H5E_DATASET, H5E_BADITER, "unable to iterate over fixed array chunk index");
+ } /* end if */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5D__farray_idx_iterate() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__farray_idx_remove
+ *
+ * Purpose: Remove chunk from index.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Vailin Choi
+ * Thursday, April 30, 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5D__farray_idx_remove(const H5D_chk_idx_info_t *idx_info, H5D_chunk_common_ud_t *udata)
+{
+ H5FA_t *fa; /* Pointer to fixed array structure */
+ hsize_t idx; /* Array index of chunk */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(idx_info);
+ HDassert(idx_info->f);
+ HDassert(idx_info->pline);
+ HDassert(idx_info->layout);
+ HDassert(idx_info->storage);
+ HDassert(H5F_addr_defined(idx_info->storage->idx_addr));
+ HDassert(udata);
+
+ /* Check if the fixed array is open yet */
+ if(NULL == idx_info->storage->u.farray.fa)
+ /* Open the fixed array in file */
+ if(H5D__farray_idx_open(idx_info) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open fixed array")
+
+ /* Set convenience pointer to fixed array structure */
+ fa = idx_info->storage->u.farray.fa;
+
+ /* Calculate the index of this chunk */
+ idx = H5VM_array_offset_pre((idx_info->layout->ndims - 1), idx_info->layout->max_down_chunks, udata->scaled);
+
+ /* Check for filters on chunks */
+ if(idx_info->pline->nused > 0) {
+ H5D_farray_filt_elmt_t elmt; /* Fixed array element */
+
+ /* Get the info about the chunk for the index */
+ if(H5FA_get(fa, idx_info->dxpl_id, idx, &elmt) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk info")
+
+ /* Remove raw data chunk from file */
+ HDassert(H5F_addr_defined(elmt.addr));
+ H5_CHECK_OVERFLOW(elmt.nbytes, /*From: */uint32_t, /*To: */hsize_t);
+ if(H5MF_xfree(idx_info->f, H5FD_MEM_DRAW, idx_info->dxpl_id, elmt.addr, (hsize_t)elmt.nbytes) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to free chunk")
+
+ /* Reset the info about the chunk for the index */
+ elmt.addr = HADDR_UNDEF;
+ elmt.nbytes = 0;
+ elmt.filter_mask = 0;
+ if(H5FA_set(fa, idx_info->dxpl_id, idx, &elmt) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to reset chunk info")
+ } /* end if */
+ else {
+ haddr_t addr = HADDR_UNDEF; /* Chunk address */
+
+ /* Get the address of the chunk for the index */
+ if(H5FA_get(fa, idx_info->dxpl_id, idx, &addr) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk address")
+
+ /* Remove raw data chunk from file */
+ HDassert(H5F_addr_defined(addr));
+ H5_CHECK_OVERFLOW(idx_info->layout->size, /*From: */uint32_t, /*To: */hsize_t);
+ if(H5MF_xfree(idx_info->f, H5FD_MEM_DRAW, idx_info->dxpl_id, addr, (hsize_t)idx_info->layout->size) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to free chunk")
+
+ /* Reset the address of the chunk for the index */
+ addr = HADDR_UNDEF;
+ if(H5FA_set(fa, idx_info->dxpl_id, idx, &addr) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to reset chunk address")
+ } /* end else */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5D__farray_idx_remove() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__farray_idx_delete_cb
+ *
+ * Purpose: Delete space for chunk in file
+ *
+ * Return: Success: Non-negative
+ * Failure: negative
+ *
+ * Programmer: Vailin Choi
+ * Thursday, April 30, 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+H5D__farray_idx_delete_cb(hsize_t H5_ATTR_UNUSED idx, const void *_elmt, void *_udata)
+{
+ H5D_farray_del_ud_t *udata = (H5D_farray_del_ud_t *)_udata; /* User data for callback */
+ haddr_t chunk_addr; /* Address of chunk */
+ uint32_t nbytes; /* Size of chunk */
+ int ret_value = H5_ITER_CONT; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(_elmt);
+ HDassert(udata);
+ HDassert(udata->f);
+
+ /* Check for filtered elements */
+ if(udata->filtered) {
+ const H5D_farray_filt_elmt_t *filt_elmt = (const H5D_farray_filt_elmt_t *)_elmt;
+
+ chunk_addr = filt_elmt->addr;
+ nbytes = filt_elmt->nbytes;
+ } /* end if */
+ else {
+ chunk_addr = *(const haddr_t *)_elmt;
+ nbytes = udata->unfilt_size;
+ } /* end else */
+
+ /* Remove raw data chunk from file */
+ H5_CHECK_OVERFLOW(nbytes, /*From: */uint32_t, /*To: */hsize_t);
+ if(H5MF_xfree(udata->f, H5FD_MEM_DRAW, udata->dxpl_id, chunk_addr, (hsize_t)nbytes) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, H5_ITER_ERROR, "unable to free chunk")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5D__farray_idx_delete_cb() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__farray_idx_delete
+ *
+ * Purpose: Delete index and raw data storage for entire dataset
+ * (i.e. all chunks)
+ *
+ * Return: Success: Non-negative
+ * Failure: negative
+ *
+ * Programmer: Vailin Choi
+ * Thursday, April 30, 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5D__farray_idx_delete(const H5D_chk_idx_info_t *idx_info)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(idx_info);
+ HDassert(idx_info->f);
+ HDassert(idx_info->pline);
+ HDassert(idx_info->layout);
+ HDassert(idx_info->storage);
+
+ /* Check if the index data structure has been allocated */
+ if(H5F_addr_defined(idx_info->storage->idx_addr)) {
+ H5FA_t *fa; /* Pointer to fixed array structure */
+ H5FA_stat_t fa_stat; /* Fixed array statistics */
+ H5D_farray_ctx_ud_t ctx_udata; /* User data for fixed array open call */
+
+ /* Check if the fixed array is open yet */
+ if(NULL == idx_info->storage->u.farray.fa)
+ /* Open the fixed array in file */
+ if(H5D__farray_idx_open(idx_info) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open fixed array")
+
+ /* Set convenience pointer to fixed array structure */
+ fa = idx_info->storage->u.farray.fa;
+
+ /* Get the fixed array statistics */
+ if(H5FA_get_stats(fa, &fa_stat) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't query fixed array statistics")
+
+ /* Check if there are any array elements */
+ if(fa_stat.nelmts > 0) {
+ H5D_farray_del_ud_t udata; /* User data for callback */
+
+ /* Initialize user data for callback */
+ udata.f = idx_info->f;
+ udata.dxpl_id = idx_info->dxpl_id;
+ udata.filtered = (idx_info->pline->nused > 0);
+ udata.unfilt_size = idx_info->layout->size;
+
+ /* Iterate over the chunk addresses in the fixed array, deleting each chunk */
+ if(H5FA_iterate(fa, idx_info->dxpl_id, H5D__farray_idx_delete_cb, &udata) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_BADITER, FAIL, "unable to iterate over chunk addresses")
+ } /* end if */
+
+ /* Close fixed array */
+ if(H5FA_close(idx_info->storage->u.farray.fa, idx_info->dxpl_id) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to close fixed array")
+ idx_info->storage->u.farray.fa = NULL;
+
+ /* Set up the user data */
+ ctx_udata.f = idx_info->f;
+ ctx_udata.chunk_size = idx_info->layout->size;
+
+ /* Delete fixed array */
+ if(H5FA_delete(idx_info->f, idx_info->dxpl_id, idx_info->storage->idx_addr, &ctx_udata) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTDELETE, FAIL, "unable to delete chunk fixed array")
+ idx_info->storage->idx_addr = HADDR_UNDEF;
+ } /* end if */
+ else
+ HDassert(NULL == idx_info->storage->u.farray.fa);
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5D__farray_idx_delete() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__farray_idx_copy_setup
+ *
+ * Purpose: Set up any necessary information for copying chunks
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Vailin Choi
+ * Thursday, April 30, 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5D__farray_idx_copy_setup(const H5D_chk_idx_info_t *idx_info_src,
+ const H5D_chk_idx_info_t *idx_info_dst)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check args */
+ HDassert(idx_info_src);
+ HDassert(idx_info_src->f);
+ HDassert(idx_info_src->pline);
+ HDassert(idx_info_src->layout);
+ HDassert(idx_info_src->storage);
+ HDassert(idx_info_dst);
+ HDassert(idx_info_dst->f);
+ HDassert(idx_info_dst->pline);
+ HDassert(idx_info_dst->layout);
+ HDassert(idx_info_dst->storage);
+ HDassert(!H5F_addr_defined(idx_info_dst->storage->idx_addr));
+
+ /* Check if the source fixed array is open yet */
+ if(NULL == idx_info_src->storage->u.farray.fa)
+ /* Open the fixed array in file */
+ if(H5D__farray_idx_open(idx_info_src) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open fixed array")
+
+ /* Set copied metadata tag */
+ H5_BEGIN_TAG(idx_info_dst->dxpl_id, H5AC__COPIED_TAG, FAIL);
+
+ /* Create the fixed array that describes chunked storage in the dest. file */
+ if(H5D__farray_idx_create(idx_info_dst) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize chunked storage")
+ HDassert(H5F_addr_defined(idx_info_dst->storage->idx_addr));
+
+ /* Reset metadata tag */
+ H5_END_TAG(FAIL);
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5D__farray_idx_copy_setup() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__farray_idx_copy_shutdown
+ *
+ * Purpose: Shutdown any information from copying chunks
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Vailin Choi
+ * Thursday, April 30, 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5D__farray_idx_copy_shutdown(H5O_storage_chunk_t *storage_src,
+ H5O_storage_chunk_t *storage_dst, hid_t dxpl_id)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check args */
+ HDassert(storage_src);
+ HDassert(storage_src->u.farray.fa);
+ HDassert(storage_dst);
+ HDassert(storage_dst->u.farray.fa);
+
+ /* Close fixed arrays */
+ if(H5FA_close(storage_src->u.farray.fa, dxpl_id) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to close fixed array")
+ storage_src->u.farray.fa = NULL;
+ if(H5FA_close(storage_dst->u.farray.fa, dxpl_id) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to close fixed array")
+ storage_dst->u.farray.fa = NULL;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5D__farray_idx_copy_shutdown() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__farray_idx_size
+ *
+ * Purpose: Retrieve the amount of index storage for chunked dataset
+ *
+ * Return: Success: Non-negative
+ * Failure: negative
+ *
+ * Programmer: Vailin Choi
+ * Thursday, April 30, 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5D__farray_idx_size(const H5D_chk_idx_info_t *idx_info, hsize_t *index_size)
+{
+ H5FA_t *fa; /* Pointer to fixed array structure */
+ H5FA_stat_t fa_stat; /* Fixed array statistics */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check args */
+ HDassert(idx_info);
+ HDassert(idx_info->f);
+ HDassert(idx_info->pline);
+ HDassert(idx_info->layout);
+ HDassert(idx_info->storage);
+ HDassert(H5F_addr_defined(idx_info->storage->idx_addr));
+ HDassert(index_size);
+
+ /* Open the fixed array in file */
+ if(H5D__farray_idx_open(idx_info) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open fixed array")
+
+ /* Set convenience pointer to fixed array structure */
+ fa = idx_info->storage->u.farray.fa;
+
+ /* Get the fixed array statistics */
+ if(H5FA_get_stats(fa, &fa_stat) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't query fixed array statistics")
+
+ *index_size = fa_stat.hdr_size;
+ *index_size += fa_stat.dblk_size;
+
+done:
+ if(idx_info->storage->u.farray.fa) {
+ if(H5FA_close(idx_info->storage->u.farray.fa, idx_info->dxpl_id) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to close fixed array")
+ idx_info->storage->u.farray.fa = NULL;
+ } /* end if */
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5D__farray_idx_size() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__farray_idx_reset
+ *
+ * Purpose: Reset indexing information.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Vailin Choi
+ * Thursday, April 30, 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5D__farray_idx_reset(H5O_storage_chunk_t *storage, hbool_t reset_addr)
+{
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Check args */
+ HDassert(storage);
+
+ /* Reset index info */
+ if(reset_addr)
+ storage->idx_addr = HADDR_UNDEF;
+ storage->u.farray.fa = NULL;
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5D__farray_idx_reset() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__farray_idx_dump
+ *
+ * Purpose: Dump indexing information to a stream.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Vailin Choi
+ * Thursday, April 30, 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5D__farray_idx_dump(const H5O_storage_chunk_t *storage, FILE *stream)
+{
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Check args */
+ HDassert(storage);
+ HDassert(stream);
+
+ HDfprintf(stream, " Address: %a\n", storage->idx_addr);
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5D__farray_idx_dump() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__farray_idx_dest
+ *
+ * Purpose: Release indexing information in memory.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Vailin Choi
+ * Thursday, April 30, 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5D__farray_idx_dest(const H5D_chk_idx_info_t *idx_info)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check args */
+ HDassert(idx_info);
+ HDassert(idx_info->f);
+ HDassert(idx_info->storage);
+
+ /* Check if the fixed array is open */
+ if(idx_info->storage->u.farray.fa) {
+ /* Close fixed array */
+ if(H5FA_close(idx_info->storage->u.farray.fa, idx_info->dxpl_id) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to close fixed array")
+ idx_info->storage->u.farray.fa = NULL;
+ } /* end if */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5D__farray_idx_dest() */
+
diff --git a/src/H5Dfill.c b/src/H5Dfill.c
index 947a177..e5b2161 100644
--- a/src/H5Dfill.c
+++ b/src/H5Dfill.c
@@ -134,7 +134,7 @@ H5Dfill(const void *fill, hid_t fill_type_id, void *buf, hid_t buf_type_id, hid_
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not a datatype")
/* Fill the selection in the memory buffer */
- if(H5D__fill(fill, fill_type, buf, buf_type, space, H5AC_ind_dxpl_id) < 0)
+ if(H5D__fill(fill, fill_type, buf, buf_type, space, H5AC_noio_dxpl_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTENCODE, FAIL, "filling selection failed")
done:
@@ -172,7 +172,7 @@ done:
--------------------------------------------------------------------------*/
herr_t
H5D__fill(const void *fill, const H5T_t *fill_type, void *buf,
- const H5T_t *buf_type, const H5S_t *space, hid_t dxpl_id)
+ const H5T_t *buf_type, const H5S_t *space, hid_t dxpl_id)
{
H5WB_t *elem_wb = NULL; /* Wrapped buffer for element data */
uint8_t elem_buf[H5T_ELEM_BUF_SIZE]; /* Buffer for element data */
@@ -565,7 +565,7 @@ done:
*/
herr_t
H5D__fill_refill_vl(H5D_fill_buf_info_t *fb_info, size_t nelmts, hid_t dxpl_id)
-{
+{
herr_t ret_value = SUCCEED; /* Return value */
void * buf = NULL; /* Temporary fill buffer */
diff --git a/src/H5Dint.c b/src/H5Dint.c
index a1702fd..7c7b673 100644
--- a/src/H5Dint.c
+++ b/src/H5Dint.c
@@ -63,9 +63,11 @@ static herr_t H5D__cache_dataspace_info(const H5D_t *dset);
static herr_t H5D__init_space(H5F_t *file, const H5D_t *dset, const H5S_t *space);
static herr_t H5D__update_oh_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset,
hid_t dapl_id);
+static herr_t H5D_build_extfile_prefix(const H5D_t *dset, hid_t dapl_id,
+ char **extfile_prefix);
static herr_t H5D__open_oid(H5D_t *dataset, hid_t dapl_id, hid_t dxpl_id);
-static herr_t H5D__init_storage(const H5D_t *dataset, hbool_t full_overwrite,
- hsize_t old_dim[], hid_t dxpl_id);
+static herr_t H5D__init_storage(const H5D_io_info_t *io_info, hbool_t full_overwrite,
+ hsize_t old_dim[]);
/*********************/
@@ -646,7 +648,7 @@ H5D__init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, const H5T_t *type)
{
htri_t relocatable; /* Flag whether the type is relocatable */
htri_t immutable; /* Flag whether the type is immutable */
- hbool_t use_latest_format; /* Flag indicating the newest file format should be used */
+ hbool_t use_latest_format; /* Flag indicating the 'latest datatype version support' is enabled */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -664,8 +666,8 @@ H5D__init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, const H5T_t *type)
if((immutable = H5T_is_immutable(type)) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't check datatype?")
- /* Get the file's 'use the latest version of the format' flag */
- use_latest_format = H5F_USE_LATEST_FORMAT(file);
+ /* Get the file's 'use the latest datatype version support' flag */
+ use_latest_format = H5F_USE_LATEST_FLAGS(file, H5F_LATEST_DATATYPE);
/* Copy the datatype if it's a custom datatype or if it'll change when it's location is changed */
if(!immutable || relocatable || use_latest_format) {
@@ -718,6 +720,7 @@ static herr_t
H5D__cache_dataspace_info(const H5D_t *dset)
{
int sndims; /* Signed number of dimensions of dataspace rank */
+ unsigned u; /* Local index value */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -730,6 +733,10 @@ H5D__cache_dataspace_info(const H5D_t *dset)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't cache dataspace dimensions")
dset->shared->ndims = (unsigned)sndims;
+ /* Compute the inital 'power2up' values */
+ for(u = 0; u < dset->shared->ndims; u++)
+ dset->shared->curr_power2up[u] = H5VM_power2up(dset->shared->curr_dims[u]);
+
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__cache_dataspace_info() */
@@ -752,7 +759,7 @@ done:
static herr_t
H5D__init_space(H5F_t *file, const H5D_t *dset, const H5S_t *space)
{
- hbool_t use_latest_format; /* Flag indicating the newest file format should be used */
+ hbool_t use_latest_format; /* Flag indicating the 'latest dataspace version support' is enabled */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -762,8 +769,8 @@ H5D__init_space(H5F_t *file, const H5D_t *dset, const H5S_t *space)
HDassert(dset);
HDassert(space);
- /* Get the file's 'use the latest version of the format' flag */
- use_latest_format = H5F_USE_LATEST_FORMAT(file);
+ /* Get the file's 'use the latest dataspace version support' flag */
+ use_latest_format = H5F_USE_LATEST_FLAGS(file, H5F_LATEST_DATASPACE);
/* Copy dataspace for dataset */
if(NULL == (dset->shared->space = H5S_copy(space, FALSE, TRUE)))
@@ -808,7 +815,6 @@ H5D__update_oh_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset, hid_t dapl_id)
H5O_loc_t *oloc = NULL; /* Dataset's object location */
H5O_layout_t *layout; /* Dataset's layout information */
H5T_t *type; /* Dataset's datatype */
- hbool_t use_latest_format; /* Flag indicating the newest file format should be used */
H5O_fill_t *fill_prop; /* Pointer to dataset's fill value information */
H5D_fill_value_t fill_status; /* Fill value status */
hbool_t fill_changed = FALSE; /* Flag indicating the fill value was changed */
@@ -827,9 +833,6 @@ H5D__update_oh_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset, hid_t dapl_id)
type = dset->shared->type;
fill_prop = &dset->shared->dcpl_cache.fill;
- /* Get the file's 'use the latest version of the format' flag */
- use_latest_format = H5F_USE_LATEST_FORMAT(file);
-
/* Retrieve "defined" status of fill value */
if(H5P_is_fill_value_defined(fill_prop, &fill_status) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't tell if fill value defined")
@@ -906,8 +909,8 @@ H5D__update_oh_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset, hid_t dapl_id)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update new fill value header message")
/* If there is valid information for the old fill value struct, add it */
- /* (only if we aren't trying to write the latest version of the file format) */
- if(fill_prop->buf && !use_latest_format) {
+ /* (only if we aren't trying to write the 'latest fill message version support') */
+ if(fill_prop->buf && !(H5F_USE_LATEST_FLAGS(file, H5F_LATEST_FILL_MSG))) {
H5O_fill_t old_fill_prop; /* Copy of fill value property, for writing as "old" fill value */
/* Shallow copy the fill value property */
@@ -938,25 +941,31 @@ H5D__update_oh_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset, hid_t dapl_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get dataset creation property list")
/* Check whether to add a "bogus" message */
- if(H5P_exist_plist(dc_plist, H5O_BOGUS_MSG_FLAGS_NAME) > 0) {
+ if( (H5P_exist_plist(dc_plist, H5O_BOGUS_MSG_FLAGS_NAME) > 0) &&
+ (H5P_exist_plist(dc_plist, H5O_BOGUS_MSG_ID_NAME) > 0) ) {
+
uint8_t bogus_flags = 0; /* Flags for creating "bogus" message */
+ unsigned bogus_id; /* "bogus" ID */
+ /* Retrieve "bogus" message ID */
+ if(H5P_get(dc_plist, H5O_BOGUS_MSG_ID_NAME, &bogus_id) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get bogus ID options")
/* Retrieve "bogus" message flags */
if(H5P_get(dc_plist, H5O_BOGUS_MSG_FLAGS_NAME, &bogus_flags) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get bogus message options")
/* Add a "bogus" message (for error testing). */
- if(H5O_bogus_oh(file, dxpl_id, oh, (unsigned)bogus_flags) < 0)
+ if(H5O_bogus_oh(file, dxpl_id, oh, bogus_id, (unsigned)bogus_flags) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create 'bogus' message")
} /* end if */
}
#endif /* H5O_ENABLE_BOGUS */
/* Add a modification time message, if using older format. */
- /* (If using the latest format, the modification time is part of the object
+ /* (If using the latest 'no modification time message' version support, the modification time is part of the object
* header and doesn't use a separate message -QAK)
*/
- if(!use_latest_format)
+ if(!(H5F_USE_LATEST_FLAGS(file, H5F_LATEST_NO_MOD_TIME_MSG)))
if(H5O_touch_oh(file, dxpl_id, oh, TRUE) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update modification time message")
@@ -977,6 +986,84 @@ done:
} /* end H5D__update_oh_info() */
+/*--------------------------------------------------------------------------
+ * Function: H5D_build_extfile_prefix
+ *
+ * Purpose: Determine the external file prefix to be used and store
+ * it in extfile_prefix. Stores an empty string if no prefix
+ * should be used.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Steffen Kiess
+ * October 16, 2015
+ *--------------------------------------------------------------------------
+ */
+static herr_t
+H5D_build_extfile_prefix(const H5D_t *dset, hid_t dapl_id, char **extfile_prefix /*out*/)
+{
+ char *prefix = NULL; /* prefix used to look for the file */
+ char *extpath = NULL; /* absolute path of directory the HDF5 file is in */
+ size_t extpath_len; /* length of extpath */
+ size_t prefix_len; /* length of prefix */
+ size_t extfile_prefix_len; /* length of expanded prefix */
+ H5P_genplist_t *plist = NULL; /* Property list pointer */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+ HDassert(dset);
+ HDassert(dset->oloc.file);
+
+ extpath = H5F_EXTPATH(dset->oloc.file);
+ HDassert(extpath);
+
+ /* XXX: Future thread-safety note - getenv is not required
+ * to be reentrant.
+ */
+ prefix = HDgetenv("HDF5_EXTFILE_PREFIX");
+
+ if(prefix == NULL || *prefix == '\0') {
+ /* Set prefix to value of H5D_ACS_EFILE_PREFIX_NAME property */
+ if(NULL == (plist = H5P_object_verify(dapl_id, H5P_DATASET_ACCESS)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ if(H5P_peek(plist, H5D_ACS_EFILE_PREFIX_NAME, &prefix) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get external file prefix")
+ } /* end if */
+
+ /* Prefix has to be checked for NULL / empty string again because the
+ * code above might have updated it.
+ */
+ if(prefix == NULL || *prefix == '\0' || HDstrcmp(prefix, ".") == 0) {
+ /* filename is interpreted as relative to the current directory,
+ * does not need to be expanded
+ */
+ if(NULL == (*extfile_prefix = (char *)H5MM_strdup("")))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
+ } /* end if */
+ else {
+ if (HDstrncmp(prefix, "${ORIGIN}", HDstrlen("${ORIGIN}")) == 0) {
+ /* Replace ${ORIGIN} at beginning of prefix by directory of HDF5 file */
+ extpath_len = HDstrlen(extpath);
+ prefix_len = HDstrlen(prefix);
+ extfile_prefix_len = extpath_len + prefix_len - HDstrlen("${ORIGIN}") + 1;
+
+ if(NULL == (*extfile_prefix = (char *)H5MM_malloc(extfile_prefix_len)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate buffer")
+ HDsnprintf(*extfile_prefix, extfile_prefix_len, "%s%s", extpath, prefix + HDstrlen("${ORIGIN}"));
+ } /* end if */
+ else {
+ if(NULL == (*extfile_prefix = (char *)H5MM_strdup(prefix)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
+ } /* end else */
+ } /* end else */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5D_build_extfile_prefix() */
+
+
/*-------------------------------------------------------------------------
* Function: H5D__create
*
@@ -1120,14 +1207,28 @@ H5D__create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id,
} /* end if */
/* Set the latest version of the layout, pline & fill messages, if requested */
- if(H5F_USE_LATEST_FORMAT(file)) {
+ if(H5F_USE_LATEST_FLAGS(file, H5F_LATEST_DSET_MSG_FLAGS)) {
/* Set the latest version for the I/O pipeline message */
- if(H5O_pline_set_latest_version(&new_dset->shared->dcpl_cache.pline) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't set latest version of I/O filter pipeline")
-
- /* Set the latest version for the fill value message */
- if(H5O_fill_set_latest_version(&new_dset->shared->dcpl_cache.fill) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't set latest version of fill value")
+ if(H5F_USE_LATEST_FLAGS(file, H5F_LATEST_PLINE_MSG))
+ if(H5O_pline_set_latest_version(&new_dset->shared->dcpl_cache.pline) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't set latest version of I/O filter pipeline")
+
+ /* Set the latest version for the fill message */
+ if(H5F_USE_LATEST_FLAGS(file, H5F_LATEST_FILL_MSG))
+ /* Set the latest version for the fill value message */
+ if(H5O_fill_set_latest_version(&new_dset->shared->dcpl_cache.fill) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't set latest version of fill value")
+
+ /* Set the latest version for the layout message */
+ if(H5F_USE_LATEST_FLAGS(file, H5F_LATEST_LAYOUT_MSG))
+ /* Set the latest version for the layout message */
+ if(H5D__layout_set_latest_version(&new_dset->shared->layout, new_dset->shared->space, &new_dset->shared->dcpl_cache) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't set latest version of layout")
+ } /* end if */
+ else if(new_dset->shared->layout.version >= H5O_LAYOUT_VERSION_4) {
+ /* Use latest indexing type for layout message version >= 4 */
+ if(H5D__layout_set_latest_indexing(&new_dset->shared->layout, new_dset->shared->space, &new_dset->shared->dcpl_cache) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't set latest indexing")
} /* end if */
/* Check if this dataset is going into a parallel file and set space allocation time */
@@ -1149,6 +1250,10 @@ H5D__create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id,
/* Indicate that the layout information was initialized */
layout_init = TRUE;
+ /* Set the external file prefix */
+ if(H5D_build_extfile_prefix(new_dset, dapl_id, &new_dset->shared->extfile_prefix) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to initialize external file prefix")
+
/* Add the dataset to the list of opened objects in the file */
if(H5FO_top_incr(new_dset->oloc.file, new_dset->oloc.addr) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINC, NULL, "can't incr object ref. count")
@@ -1193,6 +1298,7 @@ done:
} /* end if */
if(new_dset->shared->dcpl_id != 0 && H5I_dec_ref(new_dset->shared->dcpl_id) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, NULL, "unable to decrement ref count on property list")
+ new_dset->shared->extfile_prefix = (char *)H5MM_xfree(new_dset->shared->extfile_prefix);
new_dset->shared = H5FL_FREE(H5D_shared_t, new_dset->shared);
} /* end if */
new_dset->oloc.file = NULL;
@@ -1286,7 +1392,8 @@ H5D_open(const H5G_loc_t *loc, hid_t dapl_id, hid_t dxpl_id)
{
H5D_shared_t *shared_fo = NULL;
H5D_t *dataset = NULL;
- H5D_t *ret_value = NULL; /* Return value */
+ char *extfile_prefix = NULL; /* Expanded external file prefix */
+ H5D_t *ret_value = NULL; /* Return value */
FUNC_ENTER_NOAPI(NULL)
@@ -1305,6 +1412,10 @@ H5D_open(const H5G_loc_t *loc, hid_t dapl_id, hid_t dxpl_id)
if(H5G_name_copy(&(dataset->path), loc->path, H5_COPY_SHALLOW) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, NULL, "can't copy path")
+ /* Get the external file prefix */
+ if(H5D_build_extfile_prefix(dataset, dapl_id, &extfile_prefix) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to initialize external file prefix")
+
/* Check if dataset was already open */
if(NULL == (shared_fo = (H5D_shared_t *)H5FO_opened(dataset->oloc.file, dataset->oloc.addr))) {
/* Clear any errors from H5FO_opened() */
@@ -1324,6 +1435,12 @@ H5D_open(const H5G_loc_t *loc, hid_t dapl_id, hid_t dxpl_id)
/* We're the first dataset to use the the shared info */
dataset->shared->fo_count = 1;
+
+ /* Set the external file prefix */
+ dataset->shared->extfile_prefix = extfile_prefix;
+ /* Prevent string from being freed during done: */
+ extfile_prefix = NULL;
+
} /* end if */
else {
/* Point to shared info */
@@ -1332,6 +1449,12 @@ H5D_open(const H5G_loc_t *loc, hid_t dapl_id, hid_t dxpl_id)
/* Increment # of datasets using shared information */
shared_fo->fo_count++;
+ /* Check whether the external file prefix of the already open dataset
+ * matches the new external file prefix
+ */
+ if(HDstrcmp(extfile_prefix, dataset->shared->extfile_prefix) != 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, NULL, "new external file prefix does not match external file prefix of already open dataset")
+
/* Check if the object has been opened through the top file yet */
if(H5FO_top_count(dataset->oloc.file, dataset->oloc.addr) == 0) {
/* Open the object through this top file */
@@ -1348,11 +1471,15 @@ H5D_open(const H5G_loc_t *loc, hid_t dapl_id, hid_t dxpl_id)
ret_value = dataset;
done:
+ extfile_prefix = (char *)H5MM_xfree(extfile_prefix);
+
if(ret_value == NULL) {
/* Free the location--casting away const*/
if(dataset) {
- if(shared_fo == NULL) /* Need to free shared fo */
+ if(shared_fo == NULL && dataset->shared) { /* Need to free shared fo */
+ dataset->shared->extfile_prefix = (char *)H5MM_xfree(dataset->shared->extfile_prefix);
dataset->shared = H5FL_FREE(H5D_shared_t, dataset->shared);
+ }
H5O_loc_free(&(dataset->oloc));
H5G_name_free(&(dataset->path));
@@ -1502,7 +1629,13 @@ H5D__open_oid(H5D_t *dataset, hid_t dapl_id, hid_t dxpl_id)
if((H5F_INTENT(dataset->oloc.file) & H5F_ACC_RDWR)
&& !(*dataset->shared->layout.ops->is_space_alloc)(&dataset->shared->layout.storage)
&& H5F_HAS_FEATURE(dataset->oloc.file, H5FD_FEAT_ALLOCATE_EARLY)) {
- if(H5D__alloc_storage(dataset, dxpl_id, H5D_ALLOC_OPEN, FALSE, NULL) < 0)
+ H5D_io_info_t io_info;
+
+ io_info.dset = dataset;
+ io_info.raw_dxpl_id = H5AC_rawdata_dxpl_id;
+ io_info.md_dxpl_id = dxpl_id;
+
+ if(H5D__alloc_storage(&io_info, H5D_ALLOC_OPEN, FALSE, NULL) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize file storage")
} /* end if */
@@ -1567,7 +1700,7 @@ H5D_close(H5D_t *dataset)
dataset->shared->fo_count--;
if(dataset->shared->fo_count == 0) {
/* Flush the dataset's information. Continue to close even if it fails. */
- if(H5D__flush_real(dataset, H5AC_dxpl_id) < 0)
+ if(H5D__flush_real(dataset, H5AC_ind_read_dxpl_id) < 0)
HDONE_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to flush cached dataset info")
/* Set a flag to indicate the dataset is closing, before we start freeing things */
@@ -1647,9 +1780,12 @@ H5D_close(H5D_t *dataset)
} /* end switch */ /*lint !e788 All appropriate cases are covered */
/* Destroy any cached layout information for the dataset */
- if(dataset->shared->layout.ops->dest && (dataset->shared->layout.ops->dest)(dataset, H5AC_dxpl_id) < 0)
+ if(dataset->shared->layout.ops->dest && (dataset->shared->layout.ops->dest)(dataset, H5AC_ind_read_dxpl_id) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "unable to destroy layout info")
+ /* Free the external file prefix */
+ dataset->shared->extfile_prefix = (char *)H5MM_xfree(dataset->shared->extfile_prefix);
+
/* Release layout, fill-value, efl & pipeline messages */
if(dataset->shared->dcpl_id != H5P_DATASET_CREATE_DEFAULT)
free_failed |= (H5O_msg_reset(H5O_PLINE_ID, &dataset->shared->dcpl_cache.pline) < 0) ||
@@ -1668,7 +1804,7 @@ H5D_close(H5D_t *dataset)
/* Remove the dataset from the list of opened objects in the file */
if(H5FO_top_decr(dataset->oloc.file, dataset->oloc.addr) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "can't decrement count for object")
- if(H5FO_delete(dataset->oloc.file, H5AC_dxpl_id, dataset->oloc.addr) < 0)
+ if(H5FO_delete(dataset->oloc.file, H5AC_ind_read_dxpl_id, dataset->oloc.addr) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "can't remove dataset from list of open objects")
/* Close the dataset object */
@@ -1805,9 +1941,10 @@ H5D_typeof(const H5D_t *dset)
*-------------------------------------------------------------------------
*/
herr_t
-H5D__alloc_storage(const H5D_t *dset, hid_t dxpl_id, H5D_time_alloc_t time_alloc,
+H5D__alloc_storage(const H5D_io_info_t *io_info, H5D_time_alloc_t time_alloc,
hbool_t full_overwrite, hsize_t old_dim[])
{
+ const H5D_t *dset = io_info->dset; /* The dataset object */
H5F_t *f = dset->oloc.file; /* The dataset's file pointer */
H5O_layout_t *layout; /* The dataset's layout information */
hbool_t must_init_space = FALSE; /* Flag to indicate that space should be initialized */
@@ -1834,7 +1971,7 @@ H5D__alloc_storage(const H5D_t *dset, hid_t dxpl_id, H5D_time_alloc_t time_alloc
/* Check if we have a zero-sized dataset */
if(layout->storage.u.contig.size > 0) {
/* Reserve space in the file for the entire array */
- if(H5D__contig_alloc(f, dxpl_id, &layout->storage.u.contig/*out*/) < 0)
+ if(H5D__contig_alloc(f, io_info->md_dxpl_id, &layout->storage.u.contig/*out*/) < 0)
HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "unable to initialize contiguous storage")
/* Indicate that we should initialize storage space */
@@ -1851,7 +1988,7 @@ H5D__alloc_storage(const H5D_t *dset, hid_t dxpl_id, H5D_time_alloc_t time_alloc
case H5D_CHUNKED:
if(!(*dset->shared->layout.ops->is_space_alloc)(&dset->shared->layout.storage)) {
/* Create the root of the index that manages chunked storage */
- if(H5D__chunk_create(dset /*in,out*/, dxpl_id) < 0)
+ if(H5D__chunk_create(dset /*in,out*/, io_info->md_dxpl_id) < 0)
HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "unable to initialize chunked storage")
/* Indicate that we set the storage addr */
@@ -1924,7 +2061,7 @@ H5D__alloc_storage(const H5D_t *dset, hid_t dxpl_id, H5D_time_alloc_t time_alloc
* this is icky. -QAK
*/
if(!(dset->shared->dcpl_cache.fill.alloc_time == H5D_ALLOC_TIME_INCR && time_alloc == H5D_ALLOC_WRITE))
- if(H5D__init_storage(dset, full_overwrite, old_dim, dxpl_id) < 0)
+ if(H5D__init_storage(io_info, full_overwrite, old_dim) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize dataset with fill value")
} /* end if */
else {
@@ -1938,7 +2075,7 @@ H5D__alloc_storage(const H5D_t *dset, hid_t dxpl_id, H5D_time_alloc_t time_alloc
* the fill value _is_ set, do that now */
if(dset->shared->dcpl_cache.fill.fill_time == H5D_FILL_TIME_ALLOC ||
(dset->shared->dcpl_cache.fill.fill_time == H5D_FILL_TIME_IFSET && fill_status == H5D_FILL_VALUE_USER_DEFINED))
- if(H5D__init_storage(dset, full_overwrite, old_dim, dxpl_id) < 0)
+ if(H5D__init_storage(io_info, full_overwrite, old_dim) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize dataset with fill value")
} /* end else */
} /* end if */
@@ -1952,7 +2089,7 @@ H5D__alloc_storage(const H5D_t *dset, hid_t dxpl_id, H5D_time_alloc_t time_alloc
*/
if(time_alloc != H5D_ALLOC_CREATE && addr_set)
/* Mark the layout as dirty, for later writing to the file */
- if(H5D__mark(dset, dxpl_id, H5D_MARK_LAYOUT) < 0)
+ if(H5D__mark(dset, io_info->md_dxpl_id, H5D_MARK_LAYOUT) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to mark dataspace as dirty")
} /* end if */
@@ -1976,10 +2113,10 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5D__init_storage(const H5D_t *dset, hbool_t full_overwrite, hsize_t old_dim[],
- hid_t dxpl_id)
+H5D__init_storage(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_t old_dim[])
{
- herr_t ret_value = SUCCEED; /* Return value */
+ const H5D_t *dset = io_info->dset; /* dataset pointer */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -1990,7 +2127,7 @@ H5D__init_storage(const H5D_t *dset, hbool_t full_overwrite, hsize_t old_dim[],
/* If we will be immediately overwriting the values, don't bother to clear them */
if(!full_overwrite) {
/* Fill the compact dataset storage */
- if(H5D__compact_fill(dset, dxpl_id) < 0)
+ if(H5D__compact_fill(dset, io_info->md_dxpl_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize compact dataset storage")
} /* end if */
break;
@@ -1999,7 +2136,7 @@ H5D__init_storage(const H5D_t *dset, hbool_t full_overwrite, hsize_t old_dim[],
/* Don't write default fill values to external files */
/* If we will be immediately overwriting the values, don't bother to clear them */
if((dset->shared->dcpl_cache.efl.nused == 0 || dset->shared->dcpl_cache.fill.buf) && !full_overwrite)
- if(H5D__contig_fill(dset, dxpl_id) < 0)
+ if(H5D__contig_fill(io_info) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to allocate all chunks of dataset")
break;
@@ -2015,7 +2152,7 @@ H5D__init_storage(const H5D_t *dset, hbool_t full_overwrite, hsize_t old_dim[],
if(old_dim == NULL)
old_dim = zero_dim;
- if(H5D__chunk_allocate(dset, dxpl_id, full_overwrite, old_dim) < 0)
+ if(H5D__chunk_allocate(io_info, full_overwrite, old_dim) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to allocate all chunks of dataset")
break;
} /* end block */
@@ -2491,21 +2628,35 @@ H5D__set_extent(H5D_t *dset, const hsize_t *size, hid_t dxpl_id)
} /* end if */
/* Allocate space for the new parts of the dataset, if appropriate */
- if(expand && dset->shared->dcpl_cache.fill.alloc_time == H5D_ALLOC_TIME_EARLY)
- if(H5D__alloc_storage(dset, dxpl_id, H5D_ALLOC_EXTEND, FALSE, curr_dims) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to extend dataset storage")
+ if(expand && dset->shared->dcpl_cache.fill.alloc_time == H5D_ALLOC_TIME_EARLY) {
+ H5D_io_info_t io_info;
+
+ io_info.dset = dset;
+ io_info.raw_dxpl_id = H5AC_rawdata_dxpl_id;
+ io_info.md_dxpl_id = dxpl_id;
+ if(H5D__alloc_storage(&io_info, H5D_ALLOC_EXTEND, FALSE, curr_dims) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to extend dataset storage")
+ }
/*-------------------------------------------------------------------------
* Remove chunk information in the case of chunked datasets
* This removal takes place only in case we are shrinking the dateset
* and if the chunks are written
*-------------------------------------------------------------------------
*/
- if(shrink && H5D_CHUNKED == dset->shared->layout.type &&
- (*dset->shared->layout.ops->is_space_alloc)(&dset->shared->layout.storage))
- /* Remove excess chunks */
- if(H5D__chunk_prune_by_extent(dset, dxpl_id, curr_dims) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to remove chunks")
+ if(H5D_CHUNKED == dset->shared->layout.type) {
+ if(shrink && (*dset->shared->layout.ops->is_space_alloc)(&dset->shared->layout.storage))
+ /* Remove excess chunks */
+ if(H5D__chunk_prune_by_extent(dset, dxpl_id, curr_dims) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to remove chunks")
+
+ /* Update chunks that are no longer edge chunks as a result of
+ * expansion */
+ if(expand && (dset->shared->layout.u.chunk.flags & H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS)
+ && (dset->shared->dcpl_cache.pline.nused > 0))
+ if(H5D__chunk_update_old_edge_chunks(dset, dxpl_id, curr_dims) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to do update old edge chunks")
+ } /* end if */
/* Mark the dataspace as dirty, for later writing to the file */
if(H5D__mark(dset, dxpl_id, H5D_MARK_SPACE) < 0)
@@ -2774,7 +2925,7 @@ H5D_get_create_plist(H5D_t *dset)
HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "can't get property list")
/* Retrieve any object creation properties */
- if(H5O_get_create_plist(&dset->oloc, H5AC_ind_dxpl_id, new_plist) < 0)
+ if(H5O_get_create_plist(&dset->oloc, H5AC_ind_read_dxpl_id, new_plist) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get object creation info")
/* Get the layout property */
@@ -2836,7 +2987,7 @@ H5D_get_create_plist(H5D_t *dset)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to copy dataset datatype for fill value")
/* Set up type conversion function */
- if(NULL == (tpath = H5T_path_find(dset->shared->type, copied_fill.type, NULL, NULL, H5AC_ind_dxpl_id, FALSE)))
+ if(NULL == (tpath = H5T_path_find(dset->shared->type, copied_fill.type, NULL, NULL, H5AC_noio_dxpl_id, FALSE)))
HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "unable to convert between src and dest data types")
/* Convert disk form of fill value into memory form */
@@ -2864,7 +3015,7 @@ H5D_get_create_plist(H5D_t *dset)
} /* end if */
/* Convert fill value */
- if(H5T_convert(tpath, src_id, dst_id, (size_t)1, (size_t)0, (size_t)0, copied_fill.buf, bkg_buf, H5AC_ind_dxpl_id) < 0) {
+ if(H5T_convert(tpath, src_id, dst_id, (size_t)1, (size_t)0, (size_t)0, copied_fill.buf, bkg_buf, H5AC_noio_dxpl_id) < 0) {
H5I_dec_ref(src_id);
H5I_dec_ref(dst_id);
if(bkg_buf)
@@ -2959,6 +3110,18 @@ H5D_get_access_plist(H5D_t *dset)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set preempt read chunks")
} /* end if */
+ /* Set the VDS view option */
+ if(H5P_set(new_plist, H5D_ACS_VDS_VIEW_NAME, &(dset->shared->layout.storage.u.virt.view)) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set VDS view")
+
+ /* Set the VDS printf gap option */
+ if(H5P_set(new_plist, H5D_ACS_VDS_PRINTF_GAP_NAME, &(dset->shared->layout.storage.u.virt.printf_gap)) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set VDS printf gap")
+
+ /* Set the external file prefix option */
+ if(H5P_set(new_plist, H5D_ACS_EFILE_PREFIX_NAME, &(dset->shared->extfile_prefix)) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set external file prefix")
+
/* Set the return value */
ret_value = new_dapl_id;
@@ -2997,7 +3160,7 @@ H5D_get_space(H5D_t *dset)
/* If the layout is virtual, update the extent */
if(dset->shared->layout.type == H5D_VIRTUAL)
- if(H5D__virtual_set_extent_unlim(dset, H5AC_ind_dxpl_id) < 0)
+ if(H5D__virtual_set_extent_unlim(dset, H5AC_ind_read_dxpl_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update virtual dataset extent")
/* Read the data space message and return a data space object */
diff --git a/src/H5Dio.c b/src/H5Dio.c
index 4f37b65..2dcdec1 100644
--- a/src/H5Dio.c
+++ b/src/H5Dio.c
@@ -381,9 +381,7 @@ H5D__read(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space,
H5D_storage_t store; /*union of EFL and chunk pointer in file space */
hssize_t snelmts; /*total number of elmts (signed) */
hsize_t nelmts; /*total number of elmts */
-#ifdef H5_HAVE_PARALLEL
hbool_t io_info_init = FALSE; /* Whether the I/O info has been initialized */
-#endif /*H5_HAVE_PARALLEL*/
hbool_t io_op_init = FALSE; /* Whether the I/O op has been initialized */
H5D_dxpl_cache_t _dxpl_cache; /* Data transfer property cache buffer */
H5D_dxpl_cache_t *dxpl_cache = &_dxpl_cache; /* Data transfer property cache */
@@ -500,7 +498,8 @@ H5D__read(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space,
HGOTO_DONE(SUCCEED)
/* Go fill the user's selection with the dataset's fill value */
- if(H5D__fill(dataset->shared->dcpl_cache.fill.buf, dataset->shared->type, buf, type_info.mem_type, mem_space, dxpl_id) < 0)
+ if(H5D__fill(dataset->shared->dcpl_cache.fill.buf, dataset->shared->type, buf,
+ type_info.mem_type, mem_space, dxpl_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "filling buf failed")
else
HGOTO_DONE(SUCCEED)
@@ -511,9 +510,7 @@ H5D__read(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space,
io_info.u.rbuf = buf;
if(H5D__ioinfo_init(dataset, dxpl_cache, dxpl_id, &type_info, &store, &io_info) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "unable to set up I/O operation")
-#ifdef H5_HAVE_PARALLEL
io_info_init = TRUE;
-#endif /*H5_HAVE_PARALLEL*/
/* Sanity check that space is allocated, if there are elements */
if(nelmts > 0)
@@ -541,12 +538,20 @@ done:
/* Shut down the I/O op information */
if(io_op_init && io_info.layout_ops.io_term && (*io_info.layout_ops.io_term)(&fm) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to shut down I/O op info")
+
+ if(io_info_init) {
+#ifdef H5_DEBUG_BUILD
+ /* release the metadata dxpl that was copied in the init function */
+ if(H5I_dec_ref(io_info.md_dxpl_id) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "can't close metadata dxpl")
+#endif /* H5_DEBUG_BUILD */
#ifdef H5_HAVE_PARALLEL
- /* Shut down io_info struct */
- if(io_info_init)
+ /* Shut down io_info struct */
if(H5D__ioinfo_term(&io_info) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "can't shut down io_info")
#endif /*H5_HAVE_PARALLEL*/
+ }
+
/* Shut down datatype info for operation */
if(type_info_init && H5D__typeinfo_term(&type_info) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to shut down type info")
@@ -597,9 +602,7 @@ H5D__write(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space,
H5D_storage_t store; /*union of EFL and chunk pointer in file space */
hssize_t snelmts; /*total number of elmts (signed) */
hsize_t nelmts; /*total number of elmts */
-#ifdef H5_HAVE_PARALLEL
hbool_t io_info_init = FALSE; /* Whether the I/O info has been initialized */
-#endif /*H5_HAVE_PARALLEL*/
hbool_t io_op_init = FALSE; /* Whether the I/O op has been initialized */
H5D_dxpl_cache_t _dxpl_cache; /* Data transfer property cache buffer */
H5D_dxpl_cache_t *dxpl_cache = &_dxpl_cache; /* Data transfer property cache */
@@ -729,6 +732,13 @@ H5D__write(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space,
/* Retrieve dataset properties */
/* <none needed currently> */
+ /* Set up I/O operation */
+ io_info.op_type = H5D_IO_OP_WRITE;
+ io_info.u.wbuf = buf;
+ if(H5D__ioinfo_init(dataset, dxpl_cache, dxpl_id, &type_info, &store, &io_info) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to set up I/O operation")
+ io_info_init = TRUE;
+
/* Allocate data space and initialize it if it hasn't been. */
if(nelmts > 0 && dataset->shared->dcpl_cache.efl.nused == 0 &&
!(*dataset->shared->layout.ops->is_space_alloc)(&dataset->shared->layout.storage)) {
@@ -745,20 +755,11 @@ H5D__write(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space,
else
full_overwrite = (hbool_t)((hsize_t)file_nelmts == nelmts ? TRUE : FALSE);
- /* Allocate storage */
- if(H5D__alloc_storage(dataset, dxpl_id, H5D_ALLOC_WRITE, full_overwrite, NULL) < 0)
+ /* Allocate storage */
+ if(H5D__alloc_storage(&io_info, H5D_ALLOC_WRITE, full_overwrite, NULL) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize storage")
} /* end if */
- /* Set up I/O operation */
- io_info.op_type = H5D_IO_OP_WRITE;
- io_info.u.wbuf = buf;
- if(H5D__ioinfo_init(dataset, dxpl_cache, dxpl_id, &type_info, &store, &io_info) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to set up I/O operation")
-#ifdef H5_HAVE_PARALLEL
- io_info_init = TRUE;
-#endif /*H5_HAVE_PARALLEL*/
-
/* Call storage method's I/O initialization routine */
HDmemset(&fm, 0, sizeof(H5D_chunk_map_t));
if(io_info.layout_ops.io_init && (*io_info.layout_ops.io_init)(&io_info, &type_info, nelmts, file_space, mem_space, &fm) < 0)
@@ -797,11 +798,20 @@ done:
/* Shut down the I/O op information */
if(io_op_init && io_info.layout_ops.io_term && (*io_info.layout_ops.io_term)(&fm) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to shut down I/O op info")
+
+ if(io_info_init) {
+#ifdef H5_DEBUG_BUILD
+ /* release the metadata dxpl that was copied in the init function */
+ if(H5I_dec_ref(io_info.md_dxpl_id) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "can't close metadata dxpl")
+#endif /* H5_DEBUG_BUILD */
#ifdef H5_HAVE_PARALLEL
- /* Shut down io_info struct */
- if(io_info_init && H5D__ioinfo_term(&io_info) < 0)
- HDONE_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "can't shut down io_info")
+ /* Shut down io_info struct */
+ if(H5D__ioinfo_term(&io_info) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "can't shut down io_info")
#endif /*H5_HAVE_PARALLEL*/
+ }
+
/* Shut down datatype info for operation */
if(type_info_init && H5D__typeinfo_term(&type_info) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to shut down type info")
@@ -836,7 +846,9 @@ const
H5D_dxpl_cache_t *dxpl_cache, hid_t dxpl_id,
const H5D_type_info_t *type_info, H5D_storage_t *store, H5D_io_info_t *io_info)
{
- FUNC_ENTER_STATIC_NOERR
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
/* check args */
HDassert(dset);
@@ -845,10 +857,19 @@ const
HDassert(type_info->tpath);
HDassert(io_info);
+ /* init both dxpls to the original one */
+ io_info->md_dxpl_id = dxpl_id;
+ io_info->raw_dxpl_id = dxpl_id;
+
+ /* set the dxpl IO type for sanity checking at the FD layer */
+#ifdef H5_DEBUG_BUILD
+ if(H5D_set_io_info_dxpls(io_info, dxpl_id) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't set metadata and raw data dxpls")
+#endif /* H5_DEBUG_BUILD */
+
/* Set up "normal" I/O fields */
io_info->dset = dset;
io_info->dxpl_cache = dxpl_cache;
- io_info->dxpl_id = dxpl_id;
io_info->store = store;
/* Set I/O operations to initial values */
@@ -880,7 +901,8 @@ const
io_info->using_mpi_vfd = H5F_HAS_FEATURE(dset->oloc.file, H5FD_FEAT_HAS_MPI);
#endif /* H5_HAVE_PARALLEL */
- FUNC_LEAVE_NOAPI(SUCCEED)
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__ioinfo_init() */
@@ -1160,7 +1182,7 @@ H5D__ioinfo_term(H5D_io_info_t *io_info)
H5P_genplist_t *dx_plist; /* Data transer property list */
/* Get the dataset transfer property list */
- if(NULL == (dx_plist = (H5P_genplist_t *)H5I_object(io_info->dxpl_id)))
+ if(NULL == (dx_plist = (H5P_genplist_t *)H5I_object(io_info->raw_dxpl_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset transfer property list")
/* Restore the original parallel I/O mode */
@@ -1173,7 +1195,7 @@ H5D__ioinfo_term(H5D_io_info_t *io_info)
H5P_genplist_t *dx_plist; /* Data transer property list */
/* Get the dataset transfer property list */
- if(NULL == (dx_plist = (H5P_genplist_t *)H5I_object(io_info->dxpl_id)))
+ if(NULL == (dx_plist = (H5P_genplist_t *)H5I_object(io_info->raw_dxpl_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset transfer property list")
/* Restore the original parallel I/O mode */
@@ -1219,3 +1241,53 @@ H5D__typeinfo_term(const H5D_type_info_t *type_info)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5D__typeinfo_term() */
+#ifdef H5_DEBUG_BUILD
+
+/*-------------------------------------------------------------------------
+ * Function: H5D_set_io_info_dxpls
+ *
+ * Purpose: Set the metadata and raw data dxpls in an io_info struct
+ * for sanity checking at the H5FD layer.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Mohamad Chaarawi
+ * January 2016
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5D_set_io_info_dxpls(H5D_io_info_t *io_info, hid_t dxpl_id)
+{
+ H5P_genplist_t *xfer_plist = NULL; /* Dataset transfer property list object */
+ H5FD_dxpl_type_t dxpl_type; /* Property indicating the type of the internal dxpl */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Get the property list object */
+ if (NULL == (xfer_plist = (H5P_genplist_t *)H5I_object(dxpl_id)))
+ HGOTO_ERROR(H5E_DATASET, H5E_BADATOM, FAIL, "can't get new property list object")
+
+ /* create the metadata dxpl */
+ if((io_info->md_dxpl_id = H5P_copy_plist(xfer_plist, FALSE)) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't copy dxpl")
+
+ /* Set the dxpl type property */
+ dxpl_type = H5FD_RAWDATA_DXPL;
+ if(H5P_set(xfer_plist, H5FD_DXPL_TYPE_NAME, &dxpl_type) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set dxpl type property")
+
+ /* Get the property list object */
+ if (NULL == (xfer_plist = (H5P_genplist_t *)H5I_object(io_info->md_dxpl_id)))
+ HGOTO_ERROR(H5E_DATASET, H5E_BADATOM, FAIL, "can't get new property list object")
+
+ /* Set the dxpl type property */
+ dxpl_type = H5FD_METADATA_DXPL;
+ if(H5P_set(xfer_plist, H5FD_DXPL_TYPE_NAME, &dxpl_type) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set dxpl type property")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5D_set_io_info_dxpls */
+#endif /* H5_DEBUG_BUILD */
diff --git a/src/H5Dlayout.c b/src/H5Dlayout.c
index 8676d7c..bf99b9d 100644
--- a/src/H5Dlayout.c
+++ b/src/H5Dlayout.c
@@ -23,10 +23,10 @@
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5Dpkg.h" /* Datasets */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5HLprivate.h" /* Local heaps */
+#include "H5private.h" /* Generic Functions */
+#include "H5Dpkg.h" /* Datasets */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5HLprivate.h" /* Local heaps */
/****************/
@@ -61,15 +61,15 @@
/*-------------------------------------------------------------------------
- * Function: H5D__layout_set_io_ops
+ * Function: H5D__layout_set_io_ops
*
- * Purpose: Set the I/O operation function pointers for a dataset,
+ * Purpose: Set the I/O operation function pointers for a dataset,
* according to the dataset's layout
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Quincey Koziol
- * Thursday, March 20, 2008
+ * Programmer: Quincey Koziol
+ * Thursday, March 20, 2008
*
*-------------------------------------------------------------------------
*/
@@ -96,8 +96,28 @@ H5D__layout_set_io_ops(const H5D_t *dataset)
dataset->shared->layout.ops = H5D_LOPS_CHUNK;
/* Set the chunk operations */
- /* (Only "B-tree" indexing type currently supported) */
- dataset->shared->layout.storage.u.chunk.ops = H5D_COPS_BTREE;
+ switch(dataset->shared->layout.u.chunk.idx_type) {
+ case H5D_CHUNK_IDX_BTREE:
+ dataset->shared->layout.storage.u.chunk.ops = H5D_COPS_BTREE;
+ break;
+
+ case H5D_CHUNK_IDX_FARRAY:
+ dataset->shared->layout.storage.u.chunk.ops = H5D_COPS_FARRAY;
+ break;
+
+ case H5D_CHUNK_IDX_EARRAY:
+ dataset->shared->layout.storage.u.chunk.ops = H5D_COPS_EARRAY;
+ break;
+
+ case H5D_CHUNK_IDX_BT2:
+ dataset->shared->layout.storage.u.chunk.ops = H5D_COPS_BT2;
+ break;
+
+ case H5D_CHUNK_IDX_NTYPES:
+ default:
+ HDassert(0 && "Unknown chunk index method!");
+ HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "unknown chunk index method")
+ } /* end switch */
break;
case H5D_COMPACT:
@@ -150,6 +170,7 @@ H5D__layout_meta_size(const H5F_t *f, const H5O_layout_t *layout, hbool_t includ
switch(layout->type) {
case H5D_COMPACT:
+ /* This information only present in older versions of message */
/* Size of raw data */
ret_value += 2;
if(include_compact_data)
@@ -157,20 +178,68 @@ H5D__layout_meta_size(const H5F_t *f, const H5O_layout_t *layout, hbool_t includ
break;
case H5D_CONTIGUOUS:
+ /* This information only present in older versions of message */
ret_value += H5F_SIZEOF_ADDR(f); /* Address of data */
ret_value += H5F_SIZEOF_SIZE(f); /* Length of data */
break;
case H5D_CHUNKED:
- /* Number of dimensions (1 byte) */
- HDassert(layout->u.chunk.ndims > 0 && layout->u.chunk.ndims <= H5O_LAYOUT_NDIMS);
- ret_value++;
+ if(layout->version < H5O_LAYOUT_VERSION_4) {
+ /* Number of dimensions (1 byte) */
+ HDassert(layout->u.chunk.ndims > 0 && layout->u.chunk.ndims <= H5O_LAYOUT_NDIMS);
+ ret_value++;
- /* Dimension sizes */
- ret_value += layout->u.chunk.ndims * 4;
+ /* B-tree address */
+ ret_value += H5F_SIZEOF_ADDR(f); /* Address of data */
- /* B-tree address */
- ret_value += H5F_SIZEOF_ADDR(f); /* Address of data */
+ /* Dimension sizes */
+ ret_value += layout->u.chunk.ndims * 4;
+ } /* end if */
+ else {
+ /* Chunked layout feature flags */
+ ret_value++;
+
+ /* Number of dimensions (1 byte) */
+ HDassert(layout->u.chunk.ndims > 0 && layout->u.chunk.ndims <= H5O_LAYOUT_NDIMS);
+ ret_value++;
+
+ /* Encoded # of bytes for each chunk dimension */
+ HDassert(layout->u.chunk.enc_bytes_per_dim > 0 && layout->u.chunk.enc_bytes_per_dim <= 8);
+ ret_value++;
+
+ /* Dimension sizes */
+ ret_value += layout->u.chunk.ndims * layout->u.chunk.enc_bytes_per_dim;
+
+ /* Type of chunk index */
+ ret_value++;
+
+ switch(layout->u.chunk.idx_type) {
+ case H5D_CHUNK_IDX_BTREE:
+ HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, 0, "v1 B-tree index type found for layout message >v3")
+
+ case H5D_CHUNK_IDX_FARRAY:
+ /* Fixed array creation parameters */
+ ret_value += H5D_FARRAY_CREATE_PARAM_SIZE;
+ break;
+
+ case H5D_CHUNK_IDX_EARRAY:
+ /* Extensible array creation parameters */
+ ret_value += H5D_EARRAY_CREATE_PARAM_SIZE;
+ break;
+
+ case H5D_CHUNK_IDX_BT2:
+ /* v2 B-tree creation parameters */
+ ret_value += H5D_BT2_CREATE_PARAM_SIZE;
+ break;
+
+ case H5D_CHUNK_IDX_NTYPES:
+ default:
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, 0, "Invalid chunk index type")
+ } /* end switch */
+
+ /* Chunk index address */
+ ret_value += H5F_SIZEOF_ADDR(f);
+ } /* end else */
break;
case H5D_VIRTUAL:
@@ -190,15 +259,160 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5D__layout_oh_create
+ * Function: H5D__layout_set_latest_version
*
- * Purpose: Create layout/pline/efl information for dataset
+ * Purpose: Set the encoding for a layout to the latest version.
+ * Part of the coding in this routine is moved to
+ * H5D__layout_set_latest_indexing().
*
- * Return: Success: SUCCEED
- * Failure: FAIL
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Quincey Koziol
- * Monday, July 27, 2009
+ * Programmer: Quincey Koziol
+ * Thursday, January 15, 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5D__layout_set_latest_version(H5O_layout_t *layout, const H5S_t *space,
+ const H5D_dcpl_cache_t *dcpl_cache)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ /* Sanity check */
+ HDassert(layout);
+ HDassert(space);
+ HDassert(dcpl_cache);
+
+ /* Set encoding of layout to latest version */
+ layout->version = H5O_LAYOUT_VERSION_LATEST;
+
+ /* Set the latest indexing type for the layout message */
+ if(H5D__layout_set_latest_indexing(layout, space, dcpl_cache) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set latest indexing type")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5D__layout_set_latest_version() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__layout_set_latest_indexing
+ *
+ * Purpose: Set the latest indexing type for a layout message
+ * This is moved from H5D_layout_set_latest_version().
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Thursday, January 15, 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5D__layout_set_latest_indexing(H5O_layout_t *layout, const H5S_t *space,
+ const H5D_dcpl_cache_t *dcpl_cache)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ /* Sanity check */
+ HDassert(layout);
+ HDassert(space);
+ HDassert(dcpl_cache);
+
+ /* The indexing methods only apply to chunked datasets (currently) */
+ if(layout->type == H5D_CHUNKED) {
+ int sndims; /* Rank of dataspace */
+ unsigned ndims; /* Rank of dataspace */
+
+ /* Query the dimensionality of the dataspace */
+ if((sndims = H5S_GET_EXTENT_NDIMS(space)) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "invalid dataspace rank")
+ ndims = (unsigned)sndims;
+
+ /* Avoid scalar/null dataspace */
+ if(ndims > 0) {
+ hsize_t max_dims[H5O_LAYOUT_NDIMS]; /* Maximum dimension sizes */
+ hsize_t cur_dims[H5O_LAYOUT_NDIMS]; /* Current dimension sizes */
+ unsigned unlim_count = 0; /* Count of unlimited max. dimensions */
+ unsigned u; /* Local index variable */
+
+ /* Query the dataspace's dimensions */
+ if(H5S_get_simple_extent_dims(space, cur_dims, max_dims) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get dataspace max. dimensions")
+
+ /* Spin through the max. dimensions, looking for unlimited dimensions */
+ for(u = 0; u < ndims; u++) {
+ if(max_dims[u] == H5S_UNLIMITED)
+ unlim_count++;
+ } /* end for */
+
+ /* Chunked datasets with unlimited dimension(s) */
+ if(unlim_count) { /* dataset with unlimited dimension(s) must be chunked */
+ if(1 == unlim_count) { /* Chunked dataset with only 1 unlimited dimension */
+ /* Set the chunk index type to an extensible array */
+ layout->u.chunk.idx_type = H5D_CHUNK_IDX_EARRAY;
+ layout->storage.u.chunk.idx_type = H5D_CHUNK_IDX_EARRAY;
+ layout->storage.u.chunk.ops = H5D_COPS_EARRAY;
+
+ /* Set the extensible array creation parameters */
+ /* (use hard-coded defaults for now, until we give applications
+ * control over this with a property list - QAK)
+ */
+ layout->u.chunk.u.earray.cparam.max_nelmts_bits = H5D_EARRAY_MAX_NELMTS_BITS;
+ layout->u.chunk.u.earray.cparam.idx_blk_elmts = H5D_EARRAY_IDX_BLK_ELMTS;
+ layout->u.chunk.u.earray.cparam.sup_blk_min_data_ptrs = H5D_EARRAY_SUP_BLK_MIN_DATA_PTRS;
+ layout->u.chunk.u.earray.cparam.data_blk_min_elmts = H5D_EARRAY_DATA_BLK_MIN_ELMTS;
+ layout->u.chunk.u.earray.cparam.max_dblk_page_nelmts_bits = H5D_EARRAY_MAX_DBLOCK_PAGE_NELMTS_BITS;
+ } /* end if */
+ else { /* Chunked dataset with > 1 unlimited dimensions */
+ /* Set the chunk index type to v2 B-tree */
+ layout->u.chunk.idx_type = H5D_CHUNK_IDX_BT2;
+ layout->storage.u.chunk.idx_type = H5D_CHUNK_IDX_BT2;
+ layout->storage.u.chunk.ops = H5D_COPS_BT2;
+
+ /* Set the v2 B-tree creation parameters */
+ /* (use hard-coded defaults for now, until we give applications
+ * control over this with a property list - QAK)
+ */
+ layout->u.chunk.u.btree2.cparam.node_size = H5D_BT2_NODE_SIZE;
+ layout->u.chunk.u.btree2.cparam.split_percent = H5D_BT2_SPLIT_PERC;
+ layout->u.chunk.u.btree2.cparam.merge_percent = H5D_BT2_MERGE_PERC;
+ } /* end else */
+ } /* end if */
+ else {
+ /* Set the chunk index type to Fixed Array */
+ layout->u.chunk.idx_type = H5D_CHUNK_IDX_FARRAY;
+ layout->storage.u.chunk.idx_type = H5D_CHUNK_IDX_FARRAY;
+ layout->storage.u.chunk.ops = H5D_COPS_FARRAY;
+
+ /* Set the fixed array creation parameters */
+ /* (use hard-coded defaults for now, until we give applications
+ * control over this with a property list - QAK)
+ */
+ layout->u.chunk.u.farray.cparam.max_dblk_page_nelmts_bits = H5D_FARRAY_MAX_DBLK_PAGE_NELMTS_BITS;
+ } /* end else */
+ } /* end if */
+ } /* end if */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5D__layout_set_latest_indexing() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__layout_oh_create
+ *
+ * Purpose: Create layout/pline/efl information for dataset
+ *
+ * Return: Success: SUCCEED
+ * Failure: FAIL
+ *
+ * Programmer: Quincey Koziol
+ * Monday, July 27, 2009
*
*-------------------------------------------------------------------------
*/
@@ -206,8 +420,8 @@ herr_t
H5D__layout_oh_create(H5F_t *file, hid_t dxpl_id, H5O_t *oh, H5D_t *dset,
hid_t dapl_id)
{
- H5O_layout_t *layout; /* Dataset's layout information */
- const H5O_fill_t *fill_prop; /* Pointer to dataset's fill value information */
+ H5O_layout_t *layout; /* Dataset's layout information */
+ const H5O_fill_t *fill_prop; /* Pointer to dataset's fill value information */
hbool_t layout_init = FALSE; /* Flag to indicate that chunk information was initialized */
herr_t ret_value = SUCCEED; /* Return value */
@@ -242,10 +456,16 @@ H5D__layout_oh_create(H5F_t *file, hid_t dxpl_id, H5O_t *oh, H5D_t *dset,
* Allocate storage if space allocate time is early; otherwise delay
* allocation until later.
*/
- if(fill_prop->alloc_time == H5D_ALLOC_TIME_EARLY)
- if(H5D__alloc_storage(dset, dxpl_id, H5D_ALLOC_CREATE, FALSE, NULL) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize storage")
+ if(fill_prop->alloc_time == H5D_ALLOC_TIME_EARLY) {
+ H5D_io_info_t io_info;
+ io_info.dset = dset;
+ io_info.raw_dxpl_id = H5AC_rawdata_dxpl_id;
+ io_info.md_dxpl_id = dxpl_id;
+
+ if(H5D__alloc_storage(&io_info, H5D_ALLOC_CREATE, FALSE, NULL) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize storage")
+ }
/* Update external storage message, if it's used */
if(dset->shared->dcpl_cache.efl.nused > 0) {
H5O_efl_t *efl = &dset->shared->dcpl_cache.efl; /* Dataset's external file list */
@@ -386,12 +606,14 @@ H5D__layout_oh_read(H5D_t *dataset, hid_t dxpl_id, hid_t dapl_id, H5P_genplist_t
/* Adjust chunk dimensions to omit datatype size (in last dimension) for creation property */
if(H5D_CHUNKED == dataset->shared->layout.type)
dataset->shared->layout.u.chunk.ndims--;
+
/* Copy layout to the DCPL */
if(H5P_set(plist, H5D_CRT_LAYOUT_NAME, &dataset->shared->layout) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set layout")
- /* Adjust chunk dimensions back again (*sigh*) */
- if(H5D_CHUNKED == dataset->shared->layout.type)
- dataset->shared->layout.u.chunk.ndims++;
+
+ /* Set chunk sizes */
+ if(H5D__chunk_set_sizes(dataset) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "unable to set chunk sizes")
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -401,7 +623,7 @@ done:
/*-------------------------------------------------------------------------
* Function: H5D__layout_oh_write
*
- * Purpose: Write layout/pline/efl information for dataset
+ * Purpose: Write layout information for dataset
*
* Return: Success: SUCCEED
* Failure: FAIL
diff --git a/src/H5Dmpio.c b/src/H5Dmpio.c
index a5f34d1..441cc96 100644
--- a/src/H5Dmpio.c
+++ b/src/H5Dmpio.c
@@ -263,7 +263,7 @@ H5D__mpio_select_read(const H5D_io_info_t *io_info, const H5D_type_info_t H5_ATT
FUNC_ENTER_PACKAGE
H5_CHECK_OVERFLOW(mpi_buf_count, hsize_t, size_t);
- if(H5F_block_read(io_info->dset->oloc.file, H5FD_MEM_DRAW, store_contig->dset_addr, (size_t)mpi_buf_count, io_info->dxpl_id, io_info->u.rbuf) < 0)
+ if(H5F_block_read(io_info->dset->oloc.file, H5FD_MEM_DRAW, store_contig->dset_addr, (size_t)mpi_buf_count, io_info->raw_dxpl_id, io_info->u.rbuf) < 0)
HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "can't finish collective parallel read")
done:
@@ -293,7 +293,7 @@ H5D__mpio_select_write(const H5D_io_info_t *io_info, const H5D_type_info_t H5_AT
/*OKAY: CAST DISCARDS CONST QUALIFIER*/
H5_CHECK_OVERFLOW(mpi_buf_count, hsize_t, size_t);
- if(H5F_block_write(io_info->dset->oloc.file, H5FD_MEM_DRAW, store_contig->dset_addr, (size_t)mpi_buf_count, io_info->dxpl_id, io_info->u.wbuf) < 0)
+ if(H5F_block_write(io_info->dset->oloc.file, H5FD_MEM_DRAW, store_contig->dset_addr, (size_t)mpi_buf_count, io_info->raw_dxpl_id, io_info->u.wbuf) < 0)
HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "can't finish collective parallel write")
done:
@@ -475,14 +475,14 @@ H5D__contig_collective_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_
/* Sanity check */
HDassert(H5FD_MPIO == H5F_DRIVER_ID(io_info->dset->oloc.file));
- HDassert(TRUE == H5P_isa_class(io_info->dxpl_id, H5P_DATASET_XFER));
+ HDassert(TRUE == H5P_isa_class(io_info->raw_dxpl_id, H5P_DATASET_XFER));
/* Call generic internal collective I/O routine */
if(H5D__inter_collective_io(io_info, type_info, file_space, mem_space) < 0)
HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "couldn't finish shared collective MPI-IO")
/* Obtain the data transfer properties */
- if(NULL == (dx_plist = H5I_object(io_info->dxpl_id)))
+ if(NULL == (dx_plist = H5I_object(io_info->raw_dxpl_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data transfer property list")
/* Set the actual I/O mode property. internal_collective_io will not break to
@@ -522,14 +522,14 @@ H5D__contig_collective_write(H5D_io_info_t *io_info, const H5D_type_info_t *type
/* Sanity check */
HDassert(H5FD_MPIO == H5F_DRIVER_ID(io_info->dset->oloc.file));
- HDassert(TRUE == H5P_isa_class(io_info->dxpl_id, H5P_DATASET_XFER));
+ HDassert(TRUE == H5P_isa_class(io_info->raw_dxpl_id, H5P_DATASET_XFER));
/* Call generic internal collective I/O routine */
if(H5D__inter_collective_io(io_info, type_info, file_space, mem_space) < 0)
HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "couldn't finish shared collective MPI-IO")
/* Obtain the data transfer properties */
- if(NULL == (dx_plist = H5I_object(io_info->dxpl_id)))
+ if(NULL == (dx_plist = H5I_object(io_info->raw_dxpl_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data transfer property list")
/* Set the actual I/O mode property. internal_collective_io will not break to
@@ -601,7 +601,7 @@ H5D__chunk_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *type_inf
HDassert(fm);
/* Obtain the data transfer properties */
- if(NULL == (dx_plist = H5I_object(io_info->dxpl_id)))
+ if(NULL == (dx_plist = H5I_object(io_info->raw_dxpl_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list")
/* Check the optional property list on what to do with collective chunk IO. */
@@ -643,7 +643,7 @@ H5D__chunk_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *type_inf
int new_value;
/* Get the dataset transfer property list */
- if(NULL == (plist = (H5P_genplist_t *)H5I_object(io_info->dxpl_id)))
+ if(NULL == (plist = (H5P_genplist_t *)H5I_object(io_info->raw_dxpl_id)))
HGOTO_ERROR(H5E_IO, H5E_BADTYPE, FAIL, "not a dataset transfer property list")
/*** Test collective chunk user-input optimization APIs. ***/
@@ -863,7 +863,7 @@ H5D__link_chunk_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *typ
mspace = chunk_info->mspace;
/* Look up address of chunk */
- if(H5D__chunk_lookup(io_info->dset, io_info->dxpl_id, chunk_info->scaled, &udata) < 0)
+ if(H5D__chunk_lookup(io_info->dset, io_info->md_dxpl_id, chunk_info->scaled, &udata) < 0)
HGOTO_ERROR(H5E_STORAGE, H5E_CANTGET, FAIL, "couldn't get chunk address")
ctg_store.contig.dset_addr = udata.chunk_block.offset;
} /* end else */
@@ -1436,7 +1436,7 @@ H5D__final_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *type_inf
FUNC_ENTER_STATIC
/* Pass buf type, file type to the file driver. */
- if(H5FD_mpi_setup_collective(io_info->dxpl_id, mpi_buf_type, mpi_file_type) < 0)
+ if(H5FD_mpi_setup_collective(io_info->raw_dxpl_id, mpi_buf_type, mpi_file_type) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set MPI-I/O properties")
if(io_info->op_type == H5D_IO_OP_WRITE) {
@@ -1590,7 +1590,7 @@ if(H5DEBUG(D))
H5D_chunk_ud_t udata; /* User data for querying chunk info */
/* Get address of chunk */
- if(H5D__chunk_lookup(io_info->dset, io_info->dxpl_id, chunk_info->scaled, &udata) < 0)
+ if(H5D__chunk_lookup(io_info->dset, io_info->md_dxpl_id, chunk_info->scaled, &udata) < 0)
HGOTO_ERROR(H5E_STORAGE, H5E_CANTGET, FAIL, "couldn't get chunk info from skipped list")
chunk_addr = udata.chunk_block.offset;
} /* end if */
@@ -1680,7 +1680,6 @@ H5D__obtain_mpio_mode(H5D_io_info_t* io_info, H5D_chunk_map_t *fm,
MPI_Comm comm;
int ic, root;
int mpi_code;
- hbool_t mem_cleanup = FALSE;
#ifdef H5_HAVE_INSTRUMENTED_LIBRARY
int new_value;
htri_t check_prop;
@@ -1715,12 +1714,14 @@ H5D__obtain_mpio_mode(H5D_io_info_t* io_info, H5D_chunk_map_t *fm,
threshold_nproc_per_chunk = mpi_size * percent_nproc_per_chunk/100;
/* Allocate memory */
- io_mode_info = (uint8_t *)H5MM_calloc(total_chunks);
- mergebuf = H5MM_malloc((sizeof(haddr_t) + 1) * total_chunks);
+ if(NULL == (io_mode_info = (uint8_t *)H5MM_calloc(total_chunks)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate I/O mode info buffer")
+ if(NULL == (mergebuf = H5MM_malloc((sizeof(haddr_t) + 1) * total_chunks)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate mergebuf buffer")
tempbuf = mergebuf + total_chunks;
if(mpi_rank == root)
- recv_io_mode_info = (uint8_t *)H5MM_malloc(total_chunks * mpi_size);
- mem_cleanup = TRUE;
+ if(NULL == (recv_io_mode_info = (uint8_t *)H5MM_malloc(total_chunks * mpi_size)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate recv I/O mode info buffer")
/* Obtain the regularity and selection information for all chunks in this process. */
chunk_node = H5SL_first(fm->sel_chunks);
@@ -1742,11 +1743,12 @@ H5D__obtain_mpio_mode(H5D_io_info_t* io_info, H5D_chunk_map_t *fm,
/* pre-computing: calculate number of processes and
regularity of the selection occupied in each chunk */
- nproc_per_chunk = (int*)H5MM_calloc(total_chunks * sizeof(int));
+ if(NULL == (nproc_per_chunk = (int*)H5MM_calloc(total_chunks * sizeof(int))))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate nproc_per_chunk buffer")
/* calculating the chunk address */
if(H5D__chunk_addrmap(io_info, chunk_addr) < 0) {
- HDfree(nproc_per_chunk);
+ H5MM_free(nproc_per_chunk);
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk address")
} /* end if */
@@ -1774,7 +1776,7 @@ H5D__obtain_mpio_mode(H5D_io_info_t* io_info, H5D_chunk_map_t *fm,
HDmemcpy(mergebuf, assign_io_mode, total_chunks);
HDmemcpy(tempbuf, chunk_addr, sizeof(haddr_t) * total_chunks);
- HDfree(nproc_per_chunk);
+ H5MM_free(nproc_per_chunk);
} /* end if */
/* Broadcasting the MPI_IO option info. and chunk address info. */
@@ -1789,7 +1791,7 @@ H5D__obtain_mpio_mode(H5D_io_info_t* io_info, H5D_chunk_map_t *fm,
H5P_genplist_t *plist; /* Property list pointer */
/* Get the dataset transfer property list */
- if(NULL == (plist = (H5P_genplist_t *)H5I_object(io_info->dxpl_id)))
+ if(NULL == (plist = (H5P_genplist_t *)H5I_object(io_info->raw_dxpl_id)))
HGOTO_ERROR(H5E_IO, H5E_BADTYPE, FAIL, "not a dataset transfer property list")
check_prop = H5P_exist_plist(plist, H5D_XFER_COLL_CHUNK_MULTI_RATIO_COLL_NAME);
@@ -1824,11 +1826,13 @@ H5D__obtain_mpio_mode(H5D_io_info_t* io_info, H5D_chunk_map_t *fm,
#endif
done:
- if(mem_cleanup) {
- HDfree(io_mode_info);
- HDfree(mergebuf);
- if(mpi_rank == root)
- HDfree(recv_io_mode_info);
+ if(io_mode_info)
+ H5MM_free(io_mode_info);
+ if(mergebuf)
+ H5MM_free(mergebuf);
+ if(recv_io_mode_info) {
+ HDassert(mpi_rank == root);
+ H5MM_free(recv_io_mode_info);
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5Doh.c b/src/H5Doh.c
index fb829f1..f4baa5c 100644
--- a/src/H5Doh.c
+++ b/src/H5Doh.c
@@ -55,7 +55,7 @@ static void *H5O__dset_create(H5F_t *f, void *_crt_info, H5G_loc_t *obj_loc,
static H5O_loc_t *H5O__dset_get_oloc(hid_t obj_id);
static herr_t H5O__dset_bh_info(const H5O_loc_t *loc, hid_t dxpl_id, H5O_t *oh,
H5_ih_info_t *bh_info);
-static herr_t H5O__dset_flush(H5G_loc_t *obj_loc, hid_t dxpl_id);
+static herr_t H5O__dset_flush(void *_obj_ptr, hid_t dxpl_id);
/*********************/
@@ -443,33 +443,27 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5O__dset_flush(H5G_loc_t *obj_loc, hid_t dxpl_id)
+H5O__dset_flush(void *_obj_ptr, hid_t dxpl_id)
{
- H5D_t *dset = NULL; /* Dataset opened */
+ H5D_t *dset = (H5D_t *)_obj_ptr; /* Pointer to dataset object */
H5O_type_t obj_type; /* Type of object at location */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
- HDassert(obj_loc);
- HDassert(obj_loc->oloc);
+ HDassert(dset);
+ HDassert(&dset->oloc);
/* Check that the object found is the correct type */
- if(H5O_obj_type(obj_loc->oloc, &obj_type, dxpl_id) < 0)
+ if(H5O_obj_type(&dset->oloc, &obj_type, dxpl_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get object type")
if(obj_type != H5O_TYPE_DATASET)
HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "not a dataset")
- /* Open the dataset */
- if(NULL == (dset = H5D_open(obj_loc, H5P_DATASET_ACCESS_DEFAULT, dxpl_id)))
- HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "unable to open dataset")
-
if(H5D__flush_real(dset, dxpl_id) < 0)
- HDONE_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to flush cached dataset info")
+ HDONE_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to flush cached dataset info")
done:
- if(dset && H5D_close(dset) < 0)
- HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataset")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O__dset_flush() */
diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h
index a242b8e..8eaf265 100644
--- a/src/H5Dpkg.h
+++ b/src/H5Dpkg.h
@@ -33,6 +33,7 @@
/* Other private headers needed by this file */
#include "H5ACprivate.h" /* Metadata cache */
+#include "H5B2private.h" /* v2 B-trees */
#include "H5Fprivate.h" /* File access */
#include "H5Gprivate.h" /* Groups */
#include "H5SLprivate.h" /* Skip lists */
@@ -46,17 +47,19 @@
#define H5D_MINHDR_SIZE 256
/* [Simple] Macro to construct a H5D_io_info_t from it's components */
-#define H5D_BUILD_IO_INFO_WRT(io_info, ds, dxpl_c, dxpl_i, str, buf) \
+#define H5D_BUILD_IO_INFO_WRT(io_info, ds, dxpl_c, dxpl_m, dxpl_r, str, buf) \
(io_info)->dset = ds; \
(io_info)->dxpl_cache = dxpl_c; \
- (io_info)->dxpl_id = dxpl_i; \
+ (io_info)->raw_dxpl_id = dxpl_r; \
+ (io_info)->md_dxpl_id = dxpl_m; \
(io_info)->store = str; \
(io_info)->op_type = H5D_IO_OP_WRITE; \
(io_info)->u.wbuf = buf
-#define H5D_BUILD_IO_INFO_RD(io_info, ds, dxpl_c, dxpl_i, str, buf) \
+#define H5D_BUILD_IO_INFO_RD(io_info, ds, dxpl_c, dxpl_m, dxpl_r, str, buf) \
(io_info)->dset = ds; \
(io_info)->dxpl_cache = dxpl_c; \
- (io_info)->dxpl_id = dxpl_i; \
+ (io_info)->raw_dxpl_id = dxpl_r; \
+ (io_info)->md_dxpl_id = dxpl_m; \
(io_info)->store = str; \
(io_info)->op_type = H5D_IO_OP_READ; \
(io_info)->u.rbuf = buf
@@ -65,6 +68,27 @@
#define H5D_MARK_SPACE 0x01
#define H5D_MARK_LAYOUT 0x02
+/* Default creation parameters for chunk index data structures */
+/* See H5O_layout_chunk_t */
+
+/* Fixed array creation values */
+#define H5D_FARRAY_CREATE_PARAM_SIZE 1 /* Size of the creation parameters in bytes */
+#define H5D_FARRAY_MAX_DBLK_PAGE_NELMTS_BITS 10 /* i.e. 1024 elements per data block page */
+
+/* Extensible array creation values */
+#define H5D_EARRAY_CREATE_PARAM_SIZE 5 /* Size of the creation parameters in bytes */
+#define H5D_EARRAY_MAX_NELMTS_BITS 32 /* i.e. 4 giga-elements */
+#define H5D_EARRAY_IDX_BLK_ELMTS 4
+#define H5D_EARRAY_SUP_BLK_MIN_DATA_PTRS 4
+#define H5D_EARRAY_DATA_BLK_MIN_ELMTS 16
+#define H5D_EARRAY_MAX_DBLOCK_PAGE_NELMTS_BITS 10 /* i.e. 1024 elements per data block page */
+
+/* v2 B-tree creation values for raw meta_size */
+#define H5D_BT2_CREATE_PARAM_SIZE 6 /* Size of the creation parameters in bytes */
+#define H5D_BT2_NODE_SIZE 2048
+#define H5D_BT2_SPLIT_PERC 100
+#define H5D_BT2_MERGE_PERC 40
+
/****************************/
/* Package Private Typedefs */
@@ -192,7 +216,8 @@ typedef struct H5D_io_info_t {
const
#endif /* H5_HAVE_PARALLEL */
H5D_dxpl_cache_t *dxpl_cache; /* Pointer to cached DXPL info */
- hid_t dxpl_id; /* Original DXPL ID */
+ hid_t raw_dxpl_id; /* Original DXPL ID */
+ hid_t md_dxpl_id; /* metadata dxpl needed for parallel HDF5 */
#ifdef H5_HAVE_PARALLEL
MPI_Comm comm; /* MPI communicator for file */
hbool_t using_mpi_vfd; /* Whether the file is using an MPI-based VFD */
@@ -240,7 +265,7 @@ typedef struct H5D_chk_idx_info_t {
typedef struct H5D_chunk_rec_t {
hsize_t scaled[H5O_LAYOUT_NDIMS]; /* Logical offset to start */
uint32_t nbytes; /* Size of stored data */
- unsigned filter_mask; /* Excluded filters */
+ uint32_t filter_mask; /* Excluded filters */
haddr_t chunk_addr; /* Address of chunk in file */
} H5D_chunk_rec_t;
@@ -250,7 +275,6 @@ typedef struct H5D_chunk_rec_t {
* to which the index points.
*/
typedef struct H5D_chunk_common_ud_t {
- /* downward */
const H5O_layout_chunk_t *layout; /* Chunk layout description */
const H5O_storage_chunk_t *storage; /* Chunk storage description */
const hsize_t *scaled; /* Scaled coordinates for a chunk */
@@ -258,12 +282,15 @@ typedef struct H5D_chunk_common_ud_t {
/* B-tree callback info for various operations */
typedef struct H5D_chunk_ud_t {
+ /* Downward */
H5D_chunk_common_ud_t common; /* Common info for B-tree user data (must be first) */
/* Upward */
- unsigned idx_hint; /*index of chunk in cache, if present */
- H5F_block_t chunk_block; /*offset/length of chunk in file */
- unsigned filter_mask; /*excluded filters */
+ unsigned idx_hint; /* Index of chunk in cache, if present */
+ H5F_block_t chunk_block; /* Offset/length of chunk in file */
+ unsigned filter_mask; /* Excluded filters */
+ hbool_t new_unfilt_chunk; /* Whether the chunk just became unfiltered */
+ hsize_t chunk_idx; /* Chunk index for EA, FA indexing */
} H5D_chunk_ud_t;
/* Typedef for "generic" chunk callbacks */
@@ -363,10 +390,12 @@ typedef struct H5D_chunk_cached_t {
hsize_t scaled[H5O_LAYOUT_NDIMS]; /*scaled offset of chunk*/
haddr_t addr; /*file address of chunk */
uint32_t nbytes; /*size of stored data */
+ hsize_t chunk_idx; /*index of chunk in dataset */
unsigned filter_mask; /*excluded filters */
} H5D_chunk_cached_t;
/* The raw data chunk cache */
+struct H5D_rdcc_ent_t; /* Forward declaration of struct used below */
typedef struct H5D_rdcc_t {
struct {
unsigned ninits; /* Number of chunk creations */
@@ -379,6 +408,7 @@ typedef struct H5D_rdcc_t {
double w0; /* Chunk preemption policy */
struct H5D_rdcc_ent_t *head; /* Head of doubly linked list */
struct H5D_rdcc_ent_t *tail; /* Tail of doubly linked list */
+ struct H5D_rdcc_ent_t *tmp_head; /* Head of temporary doubly linked list. Chunks on this list are not in the hash table (slot). The head entry is a sentinel (does not refer to an actual chunk). */
size_t nbytes_used; /* Current cached raw data in bytes */
int nused; /* Number of chunk slots in use */
H5D_chunk_cached_t last; /* Cached copy of last chunk information */
@@ -422,6 +452,7 @@ typedef struct H5D_shared_t {
/* Cached dataspace info */
unsigned ndims; /* The dataset's dataspace rank */
hsize_t curr_dims[H5S_MAX_RANK]; /* The curr. size of dataset dimensions */
+ hsize_t curr_power2up[H5S_MAX_RANK]; /* The curr. dim sizes, rounded up to next power of 2 */
hsize_t max_dims[H5S_MAX_RANK]; /* The max. size of dataset dimensions */
/* Buffered/cached information for types of raw data storage*/
@@ -433,6 +464,8 @@ typedef struct H5D_shared_t {
*/
H5D_rdcc_t chunk; /* Information about chunked data */
} cache;
+
+ char *extfile_prefix; /* expanded external file prefix */
} H5D_shared_t;
struct H5D_t {
@@ -493,22 +526,6 @@ typedef struct {
hsize_t size; /* Accumulated number of bytes for the selection */
} H5D_vlen_bufsize_t;
-/* Raw data chunks are cached. Each entry in the cache is: */
-typedef struct H5D_rdcc_ent_t {
- hbool_t locked; /*entry is locked in cache */
- hbool_t dirty; /*needs to be written to disk? */
- hbool_t deleted; /*chunk about to be deleted */
- hsize_t scaled[H5O_LAYOUT_NDIMS]; /*scaled chunk 'name' (coordinates) */
- uint32_t rd_count; /*bytes remaining to be read */
- uint32_t wr_count; /*bytes remaining to be written */
- H5F_block_t chunk_block; /*offset/length of chunk in file */
- uint8_t *chunk; /*the unfiltered chunk data */
- unsigned idx; /*index in hash table */
- struct H5D_rdcc_ent_t *next;/*next item in doubly-linked list */
- struct H5D_rdcc_ent_t *prev;/*previous item in doubly-linked list */
-} H5D_rdcc_ent_t;
-typedef H5D_rdcc_ent_t *H5D_rdcc_ent_ptr_t; /* For free lists */
-
/*****************************/
/* Package Private Variables */
@@ -524,6 +541,13 @@ H5_DLLVAR const H5D_layout_ops_t H5D_LOPS_VIRTUAL[1];
/* Chunked layout operations */
H5_DLLVAR const H5D_chunk_ops_t H5D_COPS_BTREE[1];
+H5_DLLVAR const H5D_chunk_ops_t H5D_COPS_EARRAY[1];
+H5_DLLVAR const H5D_chunk_ops_t H5D_COPS_FARRAY[1];
+H5_DLLVAR const H5D_chunk_ops_t H5D_COPS_BT2[1];
+
+/* The v2 B-tree class for indexing chunked datasets with >1 unlimited dimensions */
+H5_DLLVAR const H5B2_class_t H5D_BT2[1];
+H5_DLLVAR const H5B2_class_t H5D_BT2_FILT[1];
/******************************/
@@ -539,7 +563,7 @@ H5_DLL H5D_t *H5D__open_name(const H5G_loc_t *loc, const char *name,
hid_t dapl_id, hid_t dxpl_id);
H5_DLL herr_t H5D__get_space_status(H5D_t *dset, H5D_space_status_t *allocation,
hid_t dxpl_id);
-H5_DLL herr_t H5D__alloc_storage(const H5D_t *dset, hid_t dxpl_id, H5D_time_alloc_t time_alloc,
+H5_DLL herr_t H5D__alloc_storage(const H5D_io_info_t *io_info, H5D_time_alloc_t time_alloc,
hbool_t full_overwrite, hsize_t old_dim[]);
H5_DLL herr_t H5D__get_storage_size(H5D_t *dset, hid_t dxpl_id, hsize_t *storage_size);
H5_DLL haddr_t H5D__get_offset(const H5D_t *dset);
@@ -550,8 +574,11 @@ H5_DLL herr_t H5D__check_filters(H5D_t *dataset);
H5_DLL herr_t H5D__set_extent(H5D_t *dataset, const hsize_t *size, hid_t dxpl_id);
H5_DLL herr_t H5D__get_dxpl_cache(hid_t dxpl_id, H5D_dxpl_cache_t **cache);
H5_DLL herr_t H5D__flush_sieve_buf(H5D_t *dataset, hid_t dxpl_id);
-H5_DLL herr_t H5D__mark(const H5D_t *dataset, hid_t dxpl_id, unsigned flags);
H5_DLL herr_t H5D__flush_real(H5D_t *dataset, hid_t dxpl_id);
+H5_DLL herr_t H5D__mark(const H5D_t *dataset, hid_t dxpl_id, unsigned flags);
+#ifdef H5_DEBUG_BUILD
+H5_DLL herr_t H5D_set_io_info_dxpls(H5D_io_info_t *io_info, hid_t dxpl_id);
+#endif /* H5_DEBUG_BUILD */
/* Internal I/O routines */
H5_DLL herr_t H5D__pre_write(H5D_t *dset, hbool_t direct_write, hid_t mem_type_id,
@@ -584,6 +611,10 @@ H5_DLL herr_t H5D__scatgath_write(const H5D_io_info_t *io_info,
H5_DLL herr_t H5D__layout_set_io_ops(const H5D_t *dataset);
H5_DLL size_t H5D__layout_meta_size(const H5F_t *f, const H5O_layout_t *layout,
hbool_t include_compact_data);
+H5_DLL herr_t H5D__layout_set_latest_version(H5O_layout_t *layout,
+ const H5S_t *space, const H5D_dcpl_cache_t *dcpl_cache);
+H5_DLL herr_t H5D__layout_set_latest_indexing(H5O_layout_t *layout,
+ const H5S_t *space, const H5D_dcpl_cache_t *dcpl_cache);
H5_DLL herr_t H5D__layout_oh_create(H5F_t *file, hid_t dxpl_id, H5O_t *oh,
H5D_t *dset, hid_t dapl_id);
H5_DLL herr_t H5D__layout_oh_read(H5D_t *dset, hid_t dxpl_id, hid_t dapl_id,
@@ -595,7 +626,7 @@ H5_DLL herr_t H5D__layout_oh_write(H5D_t *dataset, hid_t dxpl_id, H5O_t *oh,
H5_DLL herr_t H5D__contig_alloc(H5F_t *f, hid_t dxpl_id,
H5O_storage_contig_t *storage);
H5_DLL hbool_t H5D__contig_is_space_alloc(const H5O_storage_t *storage);
-H5_DLL herr_t H5D__contig_fill(const H5D_t *dset, hid_t dxpl_id);
+H5_DLL herr_t H5D__contig_fill(const H5D_io_info_t *io_info);
H5_DLL herr_t H5D__contig_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
hsize_t nelmts, const H5S_t *file_space, const H5S_t *mem_space,
H5D_chunk_map_t *fm);
@@ -616,16 +647,13 @@ H5_DLL herr_t H5D__chunk_set_info(const H5D_t *dset);
H5_DLL hbool_t H5D__chunk_is_space_alloc(const H5O_storage_t *storage);
H5_DLL herr_t H5D__chunk_lookup(const H5D_t *dset, hid_t dxpl_id,
const hsize_t *scaled, H5D_chunk_ud_t *udata);
-H5_DLL void *H5D__chunk_lock(const H5D_io_info_t *io_info,
- H5D_chunk_ud_t *udata, hbool_t relax);
-H5_DLL herr_t H5D__chunk_unlock(const H5D_io_info_t *io_info,
- const H5D_chunk_ud_t *udata, hbool_t dirty, void *chunk,
- uint32_t naccessed);
H5_DLL herr_t H5D__chunk_allocated(H5D_t *dset, hid_t dxpl_id, hsize_t *nbytes);
-H5_DLL herr_t H5D__chunk_allocate(const H5D_t *dset, hid_t dxpl_id,
- hbool_t full_overwrite, hsize_t old_dim[]);
+H5_DLL herr_t H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_t old_dim[]);
+H5_DLL herr_t H5D__chunk_update_old_edge_chunks(H5D_t *dset, hid_t dxpl_id,
+ hsize_t old_dim[]);
H5_DLL herr_t H5D__chunk_prune_by_extent(H5D_t *dset, hid_t dxpl_id,
const hsize_t *old_dim);
+H5_DLL herr_t H5D__chunk_set_sizes(H5D_t *dset);
#ifdef H5_HAVE_PARALLEL
H5_DLL herr_t H5D__chunk_addrmap(const H5D_io_info_t *io_info, haddr_t chunk_addr[]);
#endif /* H5_HAVE_PARALLEL */
@@ -675,8 +703,7 @@ H5_DLL herr_t H5D__fill_init(H5D_fill_buf_info_t *fb_info, void *caller_fill_buf
H5MM_free_t free_func, void *free_info,
const H5O_fill_t *fill, const H5T_t *dset_type, hid_t dset_type_id,
size_t nelmts, size_t min_buf_size, hid_t dxpl_id);
-H5_DLL herr_t H5D__fill_refill_vl(H5D_fill_buf_info_t *fb_info, size_t nelmts,
- hid_t dxpl_id);
+H5_DLL herr_t H5D__fill_refill_vl(H5D_fill_buf_info_t *fb_info, size_t nelmts, hid_t dxpl_id);
H5_DLL herr_t H5D__fill_term(H5D_fill_buf_info_t *fb_info);
#ifdef H5_HAVE_PARALLEL
@@ -725,6 +752,7 @@ H5_DLL htri_t H5D__mpio_opt_possible(const H5D_io_info_t *io_info,
#ifdef H5D_TESTING
H5_DLL herr_t H5D__layout_version_test(hid_t did, unsigned *version);
H5_DLL herr_t H5D__layout_contig_size_test(hid_t did, hsize_t *size);
+H5_DLL herr_t H5D__layout_idx_type_test(hid_t did, H5D_chunk_index_t *idx_type);
H5_DLL herr_t H5D__current_cache_size_test(hid_t did, size_t *nbytes_used, int *nused);
#endif /* H5D_TESTING */
diff --git a/src/H5Dprivate.h b/src/H5Dprivate.h
index 3b43aaf..ab60a50 100644
--- a/src/H5Dprivate.h
+++ b/src/H5Dprivate.h
@@ -54,6 +54,7 @@
#define H5D_ACS_PREEMPT_READ_CHUNKS_NAME "rdcc_w0" /* Preemption read chunks first */
#define H5D_ACS_VDS_VIEW_NAME "vds_view" /* VDS view option */
#define H5D_ACS_VDS_PRINTF_GAP_NAME "vds_printf_gap" /* VDS printf gap size */
+#define H5D_ACS_EFILE_PREFIX_NAME "external file prefix" /* External file prefix */
/* ======== Data transfer properties ======== */
#define H5D_XFER_MAX_TEMP_BUF_NAME "max_temp_buf" /* Maximum temp buffer size */
diff --git a/src/H5Dpublic.h b/src/H5Dpublic.h
index a1f87e3..07f8dbe 100644
--- a/src/H5Dpublic.h
+++ b/src/H5Dpublic.h
@@ -34,6 +34,9 @@
#define H5D_CHUNK_CACHE_NBYTES_DEFAULT ((size_t) -1)
#define H5D_CHUNK_CACHE_W0_DEFAULT (-1.0f)
+/* Bit flags for the H5Pset_chunk_opts() and H5Pget_chunk_opts() */
+#define H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS (0x0002u)
+
/* Property names for H5LTDdirect_chunk_write */
#define H5D_XFER_DIRECT_CHUNK_WRITE_FLAG_NAME "direct_chunk_flag"
#define H5D_XFER_DIRECT_CHUNK_WRITE_FILTERS_NAME "direct_chunk_filters"
@@ -57,8 +60,11 @@ typedef enum H5D_layout_t {
/* Types of chunk index data structures */
typedef enum H5D_chunk_index_t {
- H5D_CHUNK_IDX_BTREE = 0, /* v1 B-tree index */
- H5D_CHUNK_IDX_NTYPES /* this one must be last! */
+ H5D_CHUNK_IDX_BTREE = 0, /* v1 B-tree index (default) */
+ H5D_CHUNK_IDX_FARRAY = 3, /* Fixed array (for 0 unlimited dims) */
+ H5D_CHUNK_IDX_EARRAY = 4, /* Extensible array (for 1 unlimited dim) */
+ H5D_CHUNK_IDX_BT2 = 5, /* v2 B-tree index (for >1 unlimited dims) */
+ H5D_CHUNK_IDX_NTYPES /* This one must be last! */
} H5D_chunk_index_t;
/* Values for the space allocation time property */
@@ -162,6 +168,7 @@ H5_DLL herr_t H5Ddebug(hid_t dset_id);
#ifndef H5_NO_DEPRECATED_SYMBOLS
/* Macros */
+#define H5D_CHUNK_BTREE H5D_CHUNK_IDX_BTREE
/* Typedefs */
diff --git a/src/H5Dscatgath.c b/src/H5Dscatgath.c
index 9902b7b..7c1abca 100644
--- a/src/H5Dscatgath.c
+++ b/src/H5Dscatgath.c
@@ -538,7 +538,7 @@ H5D__scatgath_read(const H5D_io_info_t *io_info, const H5D_type_info_t *type_inf
*/
if(H5T_convert(type_info->tpath, type_info->src_type_id, type_info->dst_type_id,
smine_nelmts, (size_t)0, (size_t)0, type_info->tconv_buf,
- type_info->bkg_buf, io_info->dxpl_id) < 0)
+ type_info->bkg_buf, io_info->md_dxpl_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCONVERT, FAIL, "datatype conversion failed")
/* Do the data transform after the conversion (since we're using type mem_type) */
@@ -674,7 +674,7 @@ H5D__scatgath_write(const H5D_io_info_t *io_info, const H5D_type_info_t *type_in
*/
if(H5T_convert(type_info->tpath, type_info->src_type_id, type_info->dst_type_id,
smine_nelmts, (size_t)0, (size_t)0, type_info->tconv_buf,
- type_info->bkg_buf, io_info->dxpl_id) < 0)
+ type_info->bkg_buf, io_info->md_dxpl_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCONVERT, FAIL, "datatype conversion failed")
} /* end else */
@@ -948,7 +948,7 @@ H5Dscatter(H5D_scatter_func_t op, void *op_data, hid_t type_id,
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no destination buffer provided")
/* Fill the DXPL cache values for later use */
- if(H5D__get_dxpl_cache(H5P_DATASET_XFER_DEFAULT, &dxpl_cache) < 0)
+ if(H5D__get_dxpl_cache(H5AC_noio_dxpl_id, &dxpl_cache) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't fill dxpl cache")
/* Get datatype element size */
@@ -1050,7 +1050,7 @@ H5Dgather(hid_t src_space_id, const void *src_buf, hid_t type_id,
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no destination buffer provided")
/* Fill the DXPL cache values for later use */
- if(H5D__get_dxpl_cache(H5P_DATASET_XFER_DEFAULT, &dxpl_cache) < 0)
+ if(H5D__get_dxpl_cache(H5AC_noio_dxpl_id, &dxpl_cache) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't fill dxpl cache")
/* Get datatype element size */
diff --git a/src/H5Dselect.c b/src/H5Dselect.c
index ce6073c..312beba 100644
--- a/src/H5Dselect.c
+++ b/src/H5Dselect.c
@@ -111,7 +111,7 @@ H5D__select_io(const H5D_io_info_t *io_info, size_t elmt_size,
HDassert(io_info);
HDassert(io_info->dset);
HDassert(io_info->store);
- HDassert(TRUE == H5P_isa_class(io_info->dxpl_id, H5P_DATASET_XFER));
+ HDassert(TRUE == H5P_isa_class(io_info->raw_dxpl_id, H5P_DATASET_XFER));
HDassert(io_info->u.rbuf);
/* Allocate the vector I/O arrays */
diff --git a/src/H5Dtest.c b/src/H5Dtest.c
index c66bcc8..2a9b26c 100644
--- a/src/H5Dtest.c
+++ b/src/H5Dtest.c
@@ -144,6 +144,47 @@ done:
/*--------------------------------------------------------------------------
NAME
+ H5D__layout_idx_type_test
+ PURPOSE
+ Determine the storage layout index type for a dataset's layout information
+ USAGE
+ herr_t H5D__layout_idx_type_test(did, idx_type)
+ hid_t did; IN: Dataset to query
+ H5D_chunk_index_t *idx_type; OUT: Pointer to location to place index type info
+ RETURNS
+ Non-negative on success, negative on failure
+ DESCRIPTION
+ Checks the index type of the storage layout information for a dataset.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ DO NOT USE THIS FUNCTION FOR ANYTHING EXCEPT TESTING
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+herr_t
+H5D__layout_idx_type_test(hid_t did, H5D_chunk_index_t *idx_type)
+{
+ H5D_t *dset; /* Pointer to dataset to query */
+ herr_t ret_value = SUCCEED; /* return value */
+
+ FUNC_ENTER_PACKAGE
+
+ /* Check args */
+ if(NULL == (dset = (H5D_t *)H5VL_object_verify(did, H5I_DATASET)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset")
+ if(dset->shared->layout.type != H5D_CHUNKED)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dataset is not chunked")
+
+ if(idx_type)
+ *idx_type = dset->shared->layout.u.chunk.idx_type;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5D__layout_idx_type_test() */
+
+
+/*--------------------------------------------------------------------------
+ NAME
H5D__current_cache_size_test
PURPOSE
Determine current the size of the dataset's chunk cache
diff --git a/src/H5Dvirtual.c b/src/H5Dvirtual.c
index 7c5186d..c516c58 100644
--- a/src/H5Dvirtual.c
+++ b/src/H5Dvirtual.c
@@ -446,10 +446,10 @@ H5D__virtual_copy_layout(H5O_layout_t *layout)
/* Copy original source names */
if(NULL == (layout->storage.u.virt.list[i].source_file_name
- = HDstrdup(orig_list[i].source_file_name)))
+ = H5MM_strdup(orig_list[i].source_file_name)))
HGOTO_ERROR(H5E_DATASET, H5E_RESOURCE, FAIL, "unable to duplicate source file name")
if(NULL == (layout->storage.u.virt.list[i].source_dset_name
- = HDstrdup(orig_list[i].source_dset_name)))
+ = H5MM_strdup(orig_list[i].source_dset_name)))
HGOTO_ERROR(H5E_DATASET, H5E_RESOURCE, FAIL, "unable to duplicate source dataset name")
/* Copy source selection */
@@ -488,7 +488,7 @@ H5D__virtual_copy_layout(H5O_layout_t *layout)
} /* end if */
else
if(NULL == (layout->storage.u.virt.list[i].source_dset.file_name
- = HDstrdup(orig_list[i].source_dset.file_name)))
+ = H5MM_strdup(orig_list[i].source_dset.file_name)))
HGOTO_ERROR(H5E_DATASET, H5E_RESOURCE, FAIL, "unable to duplicate source file name")
} /* end if */
if(orig_list[i].source_dset.dset_name) {
@@ -504,7 +504,7 @@ H5D__virtual_copy_layout(H5O_layout_t *layout)
} /* end if */
else
if(NULL == (layout->storage.u.virt.list[i].source_dset.dset_name
- = HDstrdup(orig_list[i].source_dset.dset_name)))
+ = H5MM_strdup(orig_list[i].source_dset.dset_name)))
HGOTO_ERROR(H5E_DATASET, H5E_RESOURCE, FAIL, "unable to duplicate source dataset name")
} /* end if */
@@ -1124,7 +1124,7 @@ H5D__virtual_copy_parsed_name(H5O_storage_virtual_name_seg_t **dst,
/* Duplicate name segment */
if(p_src->name_segment) {
- if(NULL == ((*p_dst)->name_segment = HDstrdup(p_src->name_segment)))
+ if(NULL == ((*p_dst)->name_segment = H5MM_strdup(p_src->name_segment)))
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "unable to duplicate name segment")
} /* end if */
@@ -2099,7 +2099,7 @@ H5D__virtual_pre_io(H5D_io_info_t *io_info,
/* Initialize layout if necessary */
if(!storage->init)
- if(H5D__virtual_init_all(io_info->dset, io_info->dxpl_id) < 0)
+ if(H5D__virtual_init_all(io_info->dset, io_info->md_dxpl_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't initialize virtual layout")
/* Initialize tot_nelmts */
@@ -2157,7 +2157,7 @@ H5D__virtual_pre_io(H5D_io_info_t *io_info,
* open the source dataset to patch it */
if(storage->list[i].source_space_status != H5O_VIRTUAL_STATUS_CORRECT) {
HDassert(!storage->list[i].sub_dset[j].dset);
- if(H5D__virtual_open_source_dset(io_info->dset, &storage->list[i], &storage->list[i].sub_dset[j], io_info->dxpl_id) < 0)
+ if(H5D__virtual_open_source_dset(io_info->dset, &storage->list[i], &storage->list[i].sub_dset[j], io_info->md_dxpl_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "unable to open source dataset")
} /* end if */
@@ -2229,7 +2229,7 @@ H5D__virtual_pre_io(H5D_io_info_t *io_info,
/* Open source dataset */
if(!storage->list[i].sub_dset[j].dset)
/* Try to open dataset */
- if(H5D__virtual_open_source_dset(io_info->dset, &storage->list[i], &storage->list[i].sub_dset[j], io_info->dxpl_id) < 0)
+ if(H5D__virtual_open_source_dset(io_info->dset, &storage->list[i], &storage->list[i].sub_dset[j], io_info->md_dxpl_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "unable to open source dataset")
/* If the source dataset is not open, mark the selected
@@ -2266,7 +2266,7 @@ H5D__virtual_pre_io(H5D_io_info_t *io_info,
/* Open source dataset */
if(!storage->list[i].source_dset.dset)
/* Try to open dataset */
- if(H5D__virtual_open_source_dset(io_info->dset, &storage->list[i], &storage->list[i].source_dset, io_info->dxpl_id) < 0)
+ if(H5D__virtual_open_source_dset(io_info->dset, &storage->list[i], &storage->list[i].source_dset, io_info->md_dxpl_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "unable to open source dataset")
/* If the source dataset is not open, mark the selected elements
@@ -2388,7 +2388,7 @@ H5D__virtual_read_one(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
HGOTO_ERROR(H5E_DATASET, H5E_CANTCLIP, FAIL, "can't project virtual intersection onto source space")
/* Perform read on source dataset */
- if(H5D__read(source_dset->dset, type_info->dst_type_id, source_dset->projected_mem_space, projected_src_space, io_info->dxpl_id, io_info->u.rbuf) < 0)
+ if(H5D__read(source_dset->dset, type_info->dst_type_id, source_dset->projected_mem_space, projected_src_space, io_info->raw_dxpl_id, io_info->u.rbuf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read source dataset")
/* Close projected_src_space */
@@ -2505,7 +2505,8 @@ H5D__virtual_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
HGOTO_ERROR(H5E_DATASET, H5E_CANTCLIP, FAIL, "unable to clip fill selection")
/* Write fill values to memory buffer */
- if(H5D__fill(io_info->dset->shared->dcpl_cache.fill.buf, io_info->dset->shared->type, io_info->u.rbuf, type_info->mem_type, fill_space, io_info->dxpl_id) < 0)
+ if(H5D__fill(io_info->dset->shared->dcpl_cache.fill.buf, io_info->dset->shared->type, io_info->u.rbuf,
+ type_info->mem_type, fill_space, io_info->md_dxpl_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "filling buf failed")
#ifndef NDEBUG
@@ -2579,7 +2580,7 @@ H5D__virtual_write_one(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
HGOTO_ERROR(H5E_DATASET, H5E_CANTCLIP, FAIL, "can't project virtual intersection onto source space")
/* Perform write on source dataset */
- if(H5D__write(source_dset->dset, type_info->dst_type_id, source_dset->projected_mem_space, projected_src_space, io_info->dxpl_id, io_info->u.wbuf) < 0)
+ if(H5D__write(source_dset->dset, type_info->dst_type_id, source_dset->projected_mem_space, projected_src_space, io_info->raw_dxpl_id, io_info->u.wbuf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't write to source dataset")
/* Close projected_src_space */
diff --git a/src/H5E.c b/src/H5E.c
index 4374f1d..efa83e4 100644
--- a/src/H5E.c
+++ b/src/H5E.c
@@ -1417,8 +1417,13 @@ H5Epush2(hid_t err_stack, const char *file, const char *func, unsigned line,
done:
if(va_started)
va_end(ap);
+#ifdef H5_HAVE_VASPRINTF
+ if(tmp)
+ HDfree(tmp);
+#else /* H5_HAVE_VASPRINTF */
if(tmp)
H5MM_xfree(tmp);
+#endif /* H5_HAVE_VASPRINTF */
FUNC_LEAVE_API(ret_value)
} /* end H5Epush2() */
diff --git a/src/H5EA.c b/src/H5EA.c
index be60301..756eb93 100644
--- a/src/H5EA.c
+++ b/src/H5EA.c
@@ -88,6 +88,8 @@ hbool_t H5_PKG_INIT_VAR = FALSE;
* client class..
*/
const H5EA_class_t *const H5EA_client_class_g[] = {
+ H5EA_CLS_CHUNK, /* 0 - H5EA_CLS_CHUNK_ID */
+ H5EA_CLS_FILT_CHUNK, /* 1 - H5EA_CLS_FILT_CHUNK_ID */
H5EA_CLS_TEST, /* ? - H5EA_CLS_TEST_ID */
};
@@ -104,6 +106,8 @@ const H5EA_class_t *const H5EA_client_class_g[] = {
/* Declare a free list to manage the H5EA_t struct */
H5FL_DEFINE_STATIC(H5EA_t);
+/* Declare a PQ free list to manage the element */
+H5FL_BLK_DEFINE(ea_native_elmt);
/*-------------------------------------------------------------------------
@@ -877,116 +881,6 @@ END_FUNC(PRIV) /* end H5EA_undepend() */
/*-------------------------------------------------------------------------
- * Function: H5EA_support
- *
- * Purpose: Create a child flush dependency on the array metadata that
- * contains the element for an array index.
- *
- * Return: SUCCEED/FAIL
- *
- * Programmer: Quincey Koziol
- * koziol@hdfgroup.org
- * May 21 2009
- *
- *-------------------------------------------------------------------------
- */
-BEGIN_FUNC(PRIV, ERR,
-herr_t, SUCCEED, FAIL,
-H5EA_support(const H5EA_t *ea, hid_t dxpl_id, hsize_t idx, H5AC_info_t *child_entry))
-
- /* Local variables */
- void *thing = NULL; /* Pointer to the array metadata containing the array index we are interested in */
- uint8_t *thing_elmt_buf; /* Pointer to the element buffer for the array metadata */
- hsize_t thing_elmt_idx; /* Index of the element in the element buffer for the array metadata */
- H5EA__unprotect_func_t thing_unprot_func; /* Function pointer for unprotecting the array metadata */
-
-#ifdef QAK
-HDfprintf(stderr, "%s: Called\n", FUNC);
-HDfprintf(stderr, "%s: Index %Hu\n", FUNC, idx);
-#endif /* QAK */
-
- /*
- * Check arguments.
- */
- HDassert(ea);
-
- /* Look up the array metadata containing the element we want to set */
- if(H5EA__lookup_elmt(ea, dxpl_id, idx, H5AC__NO_FLAGS_SET, &thing, &thing_elmt_buf, &thing_elmt_idx, &thing_unprot_func) < 0)
- H5E_THROW(H5E_CANTPROTECT, "unable to protect array metadata")
-
- /* Sanity check */
- HDassert(thing);
- HDassert(thing_elmt_buf);
- HDassert(thing_unprot_func);
-
- /* Set up flush dependency between child_entry and metadata array 'thing' */
- if(H5EA__create_flush_depend((H5AC_info_t *)thing, child_entry) < 0)
- H5E_THROW(H5E_CANTDEPEND, "unable to create flush dependency on array metadata")
-
-CATCH
- /* Release resources */
- if(thing && (thing_unprot_func)(thing, dxpl_id, H5AC__NO_FLAGS_SET) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array metadata")
-
-END_FUNC(PRIV) /* end H5EA_support() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5EA_unsupport
- *
- * Purpose: Remove a flush dependency on the array metadata that contains
- * the element for an array index.
- *
- * Return: SUCCEED/FAIL
- *
- * Programmer: Quincey Koziol
- * koziol@hdfgroup.org
- * May 21 2009
- *
- *-------------------------------------------------------------------------
- */
-BEGIN_FUNC(PRIV, ERR,
-herr_t, SUCCEED, FAIL,
-H5EA_unsupport(const H5EA_t *ea, hid_t dxpl_id, hsize_t idx, H5AC_info_t *child_entry))
-
- /* Local variables */
- void *thing = NULL; /* Pointer to the array metadata containing the array index we are interested in */
- uint8_t *thing_elmt_buf; /* Pointer to the element buffer for the array metadata */
- hsize_t thing_elmt_idx; /* Index of the element in the element buffer for the array metadata */
- H5EA__unprotect_func_t thing_unprot_func; /* Function pointer for unprotecting the array metadata */
-
-#ifdef QAK
-HDfprintf(stderr, "%s: Called\n", FUNC);
-HDfprintf(stderr, "%s: Index %Hu\n", FUNC, idx);
-#endif /* QAK */
-
- /*
- * Check arguments.
- */
- HDassert(ea);
-
- /* Look up the array metadata containing the element we want to set */
- if(H5EA__lookup_elmt(ea, dxpl_id, idx, H5AC__READ_ONLY_FLAG, &thing, &thing_elmt_buf, &thing_elmt_idx, &thing_unprot_func) < 0)
- H5E_THROW(H5E_CANTPROTECT, "unable to protect array metadata")
-
- /* Sanity check */
- HDassert(thing);
- HDassert(thing_elmt_buf);
- HDassert(thing_unprot_func);
-
- /* Remove flush dependency between child_entry and metadata array 'thing' */
- if(H5EA__destroy_flush_depend((H5AC_info_t *)thing, child_entry) < 0)
- H5E_THROW(H5E_CANTUNDEPEND, "unable to destroy flush dependency on array metadata")
-
-CATCH
- /* Release resources */
- if(thing && (thing_unprot_func)(thing, dxpl_id, H5AC__NO_FLAGS_SET) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array metadata")
-
-END_FUNC(PRIV) /* end H5EA_unsupport() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5EA_close
*
* Purpose: Close an extensible array
@@ -1142,3 +1036,87 @@ CATCH
END_FUNC(PRIV) /* end H5EA_delete() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5EA_iterate
+ *
+ * Purpose: Iterate over the elements of an extensible array
+ * (copied and modified from FA_iterate() in H5FA.c)
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Vailin Choi; Feb 2015
+ *
+ *-------------------------------------------------------------------------
+ */
+BEGIN_FUNC(PRIV, ERR,
+herr_t, SUCCEED, FAIL,
+H5EA_iterate(H5EA_t *ea, hid_t dxpl_id, H5EA_operator_t op, void *udata))
+
+ /* Local variables */
+ uint8_t *elmt = NULL;
+ hsize_t u;
+
+ /*
+ * Check arguments.
+ */
+ HDassert(ea);
+ HDassert(op);
+ HDassert(udata);
+
+ /* Allocate space for a native array element */
+ if(NULL == (elmt = H5FL_BLK_MALLOC(ea_native_elmt, ea->hdr->cparam.cls->nat_elmt_size)))
+ H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array element")
+
+ /* Iterate over all elements in array */
+ for(u = 0; u < ea->hdr->stats.stored.max_idx_set; u++) {
+ int cb_ret; /* Return value from callback */
+
+ /* Get array element */
+ if(H5EA_get(ea, dxpl_id, u, elmt) < 0)
+ H5E_THROW(H5E_CANTGET, "unable to delete fixed array")
+
+ /* Make callback */
+ if((cb_ret = (*op)(u, elmt, udata)) < 0) {
+ H5E_PRINTF(H5E_BADITER, "iterator function failed");
+ H5_LEAVE(cb_ret)
+ } /* end if */
+ } /* end for */
+
+CATCH
+
+ if(elmt)
+ elmt = H5FL_BLK_FREE(ea_native_elmt, elmt);
+
+END_FUNC(PRIV) /* end H5EA_iterate() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5EA_patch_file
+ *
+ * Purpose: Patch the top-level file pointer contained in ea
+ * to point to idx_info->f if they are different.
+ * This is possible because the file pointer in ea can be
+ * closed out if ea remains open.
+ *
+ * Return: SUCCEED
+ *
+ *-------------------------------------------------------------------------
+ */
+BEGIN_FUNC(PRIV, NOERR,
+herr_t, SUCCEED, -,
+H5EA_patch_file(H5EA_t *ea, H5F_t *f))
+
+ /* Local variables */
+
+ /*
+ * Check arguments.
+ */
+ HDassert(ea);
+ HDassert(f);
+
+ if(ea->f != f || ea->hdr->f != f)
+ ea->f = ea->hdr->f = f;
+
+END_FUNC(PRIV) /* end H5EA_patch_file() */
+
diff --git a/src/H5EApkg.h b/src/H5EApkg.h
index 3af1b2c..2e13694 100644
--- a/src/H5EApkg.h
+++ b/src/H5EApkg.h
@@ -14,12 +14,12 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Quincey Koziol <koziol@hdfgroup.org>
- * Tuesday, June 17, 2008
+ * Programmer: Quincey Koziol <koziol@hdfgroup.org>
+ * Tuesday, June 17, 2008
*
- * Purpose: This file contains declarations which are visible only within
- * the H5EA package. Source files outside the H5EA package should
- * include H5EAprivate.h instead.
+ * Purpose: This file contains declarations which are visible only
+ * within the H5EA package. Source files outside the H5EA
+ * package should include H5EAprivate.h instead.
*/
#if !(defined(H5EA_FRIEND) | defined(H5EA_MODULE))
#error "Do not include this file outside the H5EA package!"
@@ -32,7 +32,7 @@
#include "H5EAprivate.h"
/* Other private headers needed by this file */
-#include "H5FLprivate.h" /* Free Lists */
+#include "H5FLprivate.h" /* Free Lists */
/**************************/
@@ -95,10 +95,10 @@
/* General metadata fields */ \
H5EA_METADATA_PREFIX_SIZE(TRUE) \
\
- /* Sanity-checking fields */ \
+ /* Sanity-checking fields */ \
+ (i)->hdr->sizeof_addr /* File address of array owning the block */ \
\
- /* Extensible Array Index Block specific fields */ \
+ /* Extensible Array Index Block specific fields */ \
+ ((size_t)(i)->hdr->cparam.idx_blk_elmts * (size_t)(i)->hdr->cparam.raw_elmt_size) /* Elements in index block */ \
+ ((i)->ndblk_addrs * (i)->hdr->sizeof_addr) /* Data block addresses in index block */ \
+ ((i)->nsblk_addrs * (i)->hdr->sizeof_addr) /* Super block addresses in index block */ \
@@ -109,31 +109,31 @@
/* General metadata fields */ \
H5EA_METADATA_PREFIX_SIZE(TRUE) \
\
- /* Sanity-checking fields */ \
+ /* Sanity-checking fields */ \
+ (s)->hdr->sizeof_addr /* File address of array owning the block */ \
+ (s)->hdr->arr_off_size /* Offset of the block in the array */ \
\
- /* Extensible Array Super Block specific fields */ \
+ /* Extensible Array Super Block specific fields */ \
+ ((s)->ndblks * (s)->dblk_page_init_size) /* Data block 'page init' bitmasks in super block (can be 0 if no pages) */ \
+ ((s)->ndblks * (s)->hdr->sizeof_addr) /* Data block addresses in super block */ \
)
/* Size of the extensible array data block prefix on disk */
-#define H5EA_DBLOCK_PREFIX_SIZE(d) ( \
+#define H5EA_DBLOCK_PREFIX_SIZE(d) ( \
/* General metadata fields */ \
H5EA_METADATA_PREFIX_SIZE(TRUE) \
\
- /* Sanity-checking fields */ \
+ /* Sanity-checking fields */ \
+ (d)->hdr->sizeof_addr /* File address of array owning the block */ \
+ (d)->hdr->arr_off_size /* Offset of the block in the array */ \
)
/* Size of the extensible array data block on disk */
-#define H5EA_DBLOCK_SIZE(d) ( \
+#define H5EA_DBLOCK_SIZE(d) ( \
/* Data block prefix size */ \
H5EA_DBLOCK_PREFIX_SIZE(d) \
\
- /* Extensible Array Data Block specific fields */ \
+ /* Extensible Array Data Block specific fields */ \
+ ((d)->nelmts * (size_t)(d)->hdr->cparam.raw_elmt_size) /* Elements in data block */ \
+ ((d)->npages * H5EA_SIZEOF_CHKSUM) /* Checksum for each page */ \
)
@@ -219,9 +219,9 @@ typedef struct H5EA_iblock_t {
haddr_t *sblk_addrs; /* Buffer for addresses of super blocks in index block */
/* Internal array information (not stored) */
- H5EA_hdr_t *hdr; /* Shared array header info */
- haddr_t addr; /* Address of this index block on disk */
- size_t size; /* Size of index block on disk */
+ H5EA_hdr_t *hdr; /* Shared array header info */
+ haddr_t addr; /* Address of this index block on disk */
+ size_t size; /* Size of index block on disk */
/* Computed/cached values (not stored) */
size_t nsblks; /* # of super blocks whose data block addresses are in index block */
@@ -240,10 +240,10 @@ typedef struct H5EA_sblock_t {
uint8_t *page_init; /* Bitmap of whether a data block page is initialized */
/* Internal array information (not stored) */
- H5EA_hdr_t *hdr; /* Shared array header info */
- H5EA_iblock_t *parent; /* Parent object for super block (index block) */
- haddr_t addr; /* Address of this index block on disk */
- size_t size; /* Size of index block on disk */
+ H5EA_hdr_t *hdr; /* Shared array header info */
+ H5EA_iblock_t *parent; /* Parent object for super block (index block) */
+ haddr_t addr; /* Address of this index block on disk */
+ size_t size; /* Size of index block on disk */
/* Computed/cached values (not stored) */
unsigned idx; /* Super block index within the extensible array */
@@ -264,10 +264,10 @@ typedef struct H5EA_dblock_t {
void *elmts; /* Buffer for elements stored in data block */
/* Internal array information (not stored) */
- H5EA_hdr_t *hdr; /* Shared array header info */
- void *parent; /* Parent object for data block (index or super block) */
- haddr_t addr; /* Address of this data block on disk */
- size_t size; /* Size of data block on disk */
+ H5EA_hdr_t *hdr; /* Shared array header info */
+ void *parent; /* Parent object for data block (index or super block) */
+ haddr_t addr; /* Address of this data block on disk */
+ size_t size; /* Size of data block on disk */
/* Computed/cached values (not stored) */
size_t nelmts; /* Number of elements in block */
@@ -283,10 +283,10 @@ typedef struct H5EA_dbk_page_t {
void *elmts; /* Buffer for elements stored in data block page */
/* Internal array information (not stored) */
- H5EA_hdr_t *hdr; /* Shared array header info */
- H5EA_sblock_t *parent; /* Parent object for data block page (super block) */
- haddr_t addr; /* Address of this data block page on disk */
- size_t size; /* Size of data block page on disk */
+ H5EA_hdr_t *hdr; /* Shared array header info */
+ H5EA_sblock_t *parent; /* Parent object for data block page (super block) */
+ haddr_t addr; /* Address of this data block page on disk */
+ size_t size; /* Size of data block page on disk */
/* Computed/cached values (not stored) */
/* <none> */
@@ -360,7 +360,7 @@ H5_DLLVAR const H5AC_class_t H5AC_EARRAY_DBLK_PAGE[1];
H5_DLLVAR const H5EA_class_t H5EA_CLS_TEST[1];
/* Array of extensible array client ID -> client class mappings */
-extern const H5EA_class_t *const H5EA_client_class_g[H5EA_NUM_CLS_ID];
+H5_DLLVAR const H5EA_class_t *const H5EA_client_class_g[H5EA_NUM_CLS_ID];
/******************************/
diff --git a/src/H5EAprivate.h b/src/H5EAprivate.h
index 6ce3062..0a1b945 100644
--- a/src/H5EAprivate.h
+++ b/src/H5EAprivate.h
@@ -15,12 +15,12 @@
/*-------------------------------------------------------------------------
*
- * Created: H5EAprivate.h
- * Jun 17 2008
- * Quincey Koziol <koziol@hdfgroup.org>
+ * Created: H5EAprivate.h
+ * Jun 17 2008
+ * Quincey Koziol <koziol@hdfgroup.org>
*
- * Purpose: Private header for library accessible extensible
- * array routines.
+ * Purpose: Private header for library accessible extensible
+ * array routines.
*
*-------------------------------------------------------------------------
*/
@@ -34,8 +34,8 @@
#endif /* NOT_YET */
/* Private headers needed by this file */
-#include "H5ACprivate.h" /* Metadata cache */
-#include "H5Fprivate.h" /* File access */
+#include "H5ACprivate.h" /* Metadata cache */
+#include "H5Fprivate.h" /* File access */
/**************************/
@@ -49,9 +49,12 @@
/* Extensible array class IDs */
typedef enum H5EA_cls_id_t {
+ H5EA_CLS_CHUNK_ID = 0, /* Extensible array is for indexing dataset chunks w/o filters */
+ H5EA_CLS_FILT_CHUNK_ID, /* Extensible array is for indexing dataset chunks w/filters */
+
/* Start real class IDs at 0 -QAK */
/* (keep these last) */
- H5EA_CLS_TEST_ID, /* Extensible array is for testing (do not use for actual data) */
+ H5EA_CLS_TEST_ID, /* Extensible array is for testing (do not use for actual data) */
H5EA_NUM_CLS_ID /* Number of Extensible Array class IDs (must be last) */
} H5EA_cls_id_t;
@@ -112,11 +115,20 @@ typedef struct H5EA_stat_t {
/* Extensible array info (forward decl - defined in H5EApkg.h) */
typedef struct H5EA_t H5EA_t;
+/* Define the operator callback function pointer for H5EA_iterate() */
+typedef int (*H5EA_operator_t)(hsize_t idx, const void *_elmt, void *_udata);
+
/*****************************/
/* Library-private Variables */
/*****************************/
+/* The Extensible Array class for dataset chunks w/o filters*/
+H5_DLLVAR const H5EA_class_t H5EA_CLS_CHUNK[1];
+
+/* The Extensible Array class for dataset chunks w/ filters*/
+H5_DLLVAR const H5EA_class_t H5EA_CLS_FILT_CHUNK[1];
+
/***************************************/
/* Library-private Function Prototypes */
@@ -131,13 +143,10 @@ H5_DLL herr_t H5EA_get_addr(const H5EA_t *ea, haddr_t *addr);
H5_DLL herr_t H5EA_set(const H5EA_t *ea, hid_t dxpl_id, hsize_t idx, const void *elmt);
H5_DLL herr_t H5EA_get(const H5EA_t *ea, hid_t dxpl_id, hsize_t idx, void *elmt);
H5_DLL herr_t H5EA_depend(H5AC_info_t *parent_entry, H5EA_t *ea);
-H5_DLL herr_t H5EA_undepend(H5AC_info_t *parent_entry, H5EA_t *ea);
-H5_DLL herr_t H5EA_support(const H5EA_t *ea, hid_t dxpl_id, hsize_t idx,
- H5AC_info_t *child_entry);
-H5_DLL herr_t H5EA_unsupport(const H5EA_t *ea, hid_t dxpl_id, hsize_t idx,
- H5AC_info_t *child_entry);
+H5_DLL herr_t H5EA_iterate(H5EA_t *fa, hid_t dxpl_id, H5EA_operator_t op, void *udata);
H5_DLL herr_t H5EA_close(H5EA_t *ea, hid_t dxpl_id);
H5_DLL herr_t H5EA_delete(H5F_t *f, hid_t dxpl_id, haddr_t ea_addr, void *ctx_udata);
+H5_DLL herr_t H5EA_patch_file(H5EA_t *fa, H5F_t *f);
/* Statistics routines */
H5_DLL herr_t H5EA_get_stats(const H5EA_t *ea, H5EA_stat_t *stats);
diff --git a/src/H5Eint.c b/src/H5Eint.c
index 6e84a09..6ed405f 100644
--- a/src/H5Eint.c
+++ b/src/H5Eint.c
@@ -743,8 +743,13 @@ H5E_printf_stack(H5E_t *estack, const char *file, const char *func, unsigned lin
done:
if(va_started)
va_end(ap);
+#ifdef H5_HAVE_VASPRINTF
+ if(tmp)
+ HDfree(tmp);
+#else /* H5_HAVE_VASPRINTF */
if(tmp)
H5MM_xfree(tmp);
+#endif /* H5_HAVE_VASPRINTF */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5E_printf_stack() */
diff --git a/src/H5Eprivate.h b/src/H5Eprivate.h
index ba17ada..db413e3 100644
--- a/src/H5Eprivate.h
+++ b/src/H5Eprivate.h
@@ -125,7 +125,7 @@ extern int H5E_mpi_error_str_len;
#define HMPI_ERROR(mpierr){ \
MPI_Error_string(mpierr, H5E_mpi_error_str, &H5E_mpi_error_str_len); \
- HERROR(H5E_INTERNAL, H5E_MPIERRSTR, H5E_mpi_error_str); \
+ HERROR(H5E_INTERNAL, H5E_MPIERRSTR, "%s", H5E_mpi_error_str); \
}
#define HMPI_DONE_ERROR(retcode, str, mpierr){ \
HMPI_ERROR(mpierr); \
diff --git a/src/H5F.c b/src/H5F.c
index 5487b97..ec2e388 100644
--- a/src/H5F.c
+++ b/src/H5F.c
@@ -51,7 +51,6 @@
/********************/
-
/*********************/
/* Package Variables */
/*********************/
@@ -188,7 +187,7 @@ H5Fget_create_plist(hid_t file_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier")
if(H5VL_file_get(obj->vol_obj, obj->vol_info->vol_cls, H5VL_FILE_GET_FCPL,
- H5AC_dxpl_id, H5_REQUEST_NULL, &ret_value) < 0)
+ H5AC_ind_read_dxpl_id, H5_REQUEST_NULL, &ret_value) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get file creation properties")
done:
@@ -232,7 +231,7 @@ H5Fget_access_plist(hid_t file_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier")
if(H5VL_file_get(file->vol_obj, file->vol_info->vol_cls, H5VL_FILE_GET_FAPL,
- H5AC_dxpl_id, H5_REQUEST_NULL, &fapl_id) < 0)
+ H5AC_ind_read_dxpl_id, H5_REQUEST_NULL, &fapl_id) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get file creation properties")
ret_value = fapl_id;
@@ -300,7 +299,7 @@ H5Fget_obj_count(hid_t file_id, unsigned types)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file id")
if(H5VL_file_get(obj->vol_obj, obj->vol_info->vol_cls, H5VL_FILE_GET_OBJ_COUNT,
- H5AC_dxpl_id, H5_REQUEST_NULL, types, &ret_value) < 0)
+ H5AC_ind_read_dxpl_id, H5_REQUEST_NULL, types, &ret_value) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get object count in file(s)")
}
/* iterate over all open files and get the obj count for each */
@@ -408,7 +407,7 @@ H5Fget_obj_ids(hid_t file_id, unsigned types, size_t max_objs, hid_t *oid_list)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier")
if(H5VL_file_get(obj->vol_obj, obj->vol_info->vol_cls, H5VL_FILE_GET_OBJ_IDS,
- H5AC_dxpl_id, H5_REQUEST_NULL, types, max_objs, oid_list, &ret_value) < 0)
+ H5AC_ind_read_dxpl_id, H5_REQUEST_NULL, types, max_objs, oid_list, &ret_value) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get object count in file(s)")
}
/* iterate over all open files and get the obj count for each */
@@ -478,8 +477,8 @@ H5Fget_vfd_handle(hid_t file_id, hid_t fapl, void **file_handle)
if(NULL == (obj = (H5VL_object_t *)H5I_object(file_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier")
- if(H5VL_file_optional(obj->vol_obj, obj->vol_info->vol_cls, H5AC_dxpl_id, H5_REQUEST_NULL,
- H5VL_FILE_GET_VFD_HANDLE, file_handle, fapl) < 0)
+ if(H5VL_file_optional(obj->vol_obj, obj->vol_info->vol_cls, H5AC_ind_read_dxpl_id,
+ H5_REQUEST_NULL, H5VL_FILE_GET_VFD_HANDLE, file_handle, fapl) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get file handle")
done:
@@ -521,7 +520,7 @@ H5Fis_accessible(const char *name, hid_t fapl_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not file access property list")
/* Call into the VOL to check if file is accessible */
- if(H5VL_file_specific(NULL, NULL, H5VL_FILE_IS_ACCESSIBLE, H5AC_dxpl_id,
+ if(H5VL_file_specific(NULL, NULL, H5VL_FILE_IS_ACCESSIBLE, H5AC_ind_read_dxpl_id,
H5_REQUEST_NULL, fapl_id, name, &ret_value) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get file handle")
@@ -564,7 +563,8 @@ H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id)
H5P_genplist_t *plist; /* Property list pointer */
H5VL_class_t *vol_cls = NULL; /* VOL Class structure for callback info */
H5VL_t *vol_info = NULL; /* VOL info struct */
- H5VL_plugin_prop_t plugin_prop; /* Property for vol plugin ID & info */
+ H5VL_plugin_prop_t plugin_prop; /* Property for vol plugin ID & info */
+ hid_t dxpl_id = H5AC_ind_read_dxpl_id; /* dxpl used by library */
hid_t ret_value; /* return value */
FUNC_ENTER_API(FAIL)
@@ -589,12 +589,9 @@ H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id)
if(TRUE != H5P_isa_class(fcpl_id, H5P_FILE_CREATE))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not file create property list")
- /* Check the file access property list */
- if(H5P_DEFAULT == fapl_id)
- fapl_id = H5P_FILE_ACCESS_DEFAULT;
- else
- if(TRUE != H5P_isa_class(fapl_id, H5P_FILE_ACCESS))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not file access property list")
+ /* Verify access property list and get correct dxpl */
+ if(H5P_verify_apl_and_dxpl(&fapl_id, H5P_CLS_FACC, &dxpl_id, H5I_INVALID_HID, TRUE) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set access and transfer property lists")
/* get the VOL info from the fapl */
if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id)))
@@ -608,7 +605,7 @@ H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id)
/* create a new file or truncate an existing file through the VOL */
if(NULL == (file = H5VL_file_create(vol_cls, filename, flags, fcpl_id, fapl_id,
- H5AC_dxpl_id, H5_REQUEST_NULL)))
+ dxpl_id, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to create file")
/* setup VOL info struct */
@@ -676,6 +673,7 @@ H5Fopen(const char *filename, unsigned flags, hid_t fapl_id)
H5VL_plugin_prop_t plugin_prop; /* Property for vol plugin ID & info */
H5VL_class_t *vol_cls = NULL; /* VOL Class structure for callback info */
H5VL_t *vol_info = NULL; /* VOL info struct */
+ hid_t dxpl_id = H5AC_ind_read_dxpl_id; /* dxpl used by library */
hid_t ret_value; /* return value */
FUNC_ENTER_API(FAIL)
@@ -688,11 +686,10 @@ H5Fopen(const char *filename, unsigned flags, hid_t fapl_id)
if((flags & ~H5F_ACC_PUBLIC_FLAGS) ||
(flags & H5F_ACC_TRUNC) || (flags & H5F_ACC_EXCL))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file open flags")
- if(H5P_DEFAULT == fapl_id)
- fapl_id = H5P_FILE_ACCESS_DEFAULT;
- else
- if(TRUE != H5P_isa_class(fapl_id, H5P_FILE_ACCESS))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not file access property list")
+
+ /* Verify access property list and get correct dxpl */
+ if(H5P_verify_apl_and_dxpl(&fapl_id, H5P_CLS_FACC, &dxpl_id, H5I_INVALID_HID, TRUE) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set access and transfer property lists")
/* get the VOL info from the fapl */
if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id)))
@@ -704,7 +701,7 @@ H5Fopen(const char *filename, unsigned flags, hid_t fapl_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID")
/* Open the file through the VOL layer */
- if(NULL == (file = H5VL_file_open(vol_cls, filename, flags, fapl_id, H5AC_dxpl_id, H5_REQUEST_NULL)))
+ if(NULL == (file = H5VL_file_open(vol_cls, filename, flags, fapl_id, dxpl_id, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to create file")
/* setup VOL info struct */
@@ -758,8 +755,8 @@ H5Fflush(hid_t object_id, H5F_scope_t scope)
if(NULL == (obj = H5VL_get_object(object_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier")
- if(H5VL_file_specific(obj->vol_obj, obj->vol_info->vol_cls, H5VL_FILE_FLUSH, H5AC_dxpl_id,
- H5_REQUEST_NULL, obj_type, scope) < 0)
+ if(H5VL_file_specific(obj->vol_obj, obj->vol_info->vol_cls, H5VL_FILE_FLUSH,
+ H5AC_ind_read_dxpl_id, H5_REQUEST_NULL, obj_type, scope) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush file")
done:
@@ -833,7 +830,7 @@ H5F_close_file(void *_file)
/* Close the file through the VOL*/
if((ret_value = H5VL_file_close(file->vol_obj, file->vol_info->vol_cls,
- H5AC_dxpl_id, H5_REQUEST_NULL)) < 0)
+ H5AC_ind_read_dxpl_id, H5_REQUEST_NULL)) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "unable to close file")
/* free file */
@@ -860,10 +857,6 @@ done:
* Programmer: Robb Matzke
* Friday, October 16, 1998
*
- * Modifications:
- * Quincey Koziol, May 14, 2002
- * Keep old file's read/write intent in reopened file.
- *
*-------------------------------------------------------------------------
*/
hid_t
@@ -877,19 +870,19 @@ H5Freopen(hid_t file_id)
H5TRACE1("i", "i", file_id);
/* get the file object */
- if(NULL == (obj = (H5VL_object_t *)H5I_object(file_id)))
+ if(NULL == (obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier")
- if(H5VL_file_optional(obj->vol_obj, obj->vol_info->vol_cls, H5AC_dxpl_id, H5_REQUEST_NULL,
- H5VL_FILE_REOPEN, &file) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to reopen file")
+ if(H5VL_file_optional(obj->vol_obj, obj->vol_info->vol_cls, H5AC_ind_read_dxpl_id,
+ H5_REQUEST_NULL, H5VL_FILE_REOPEN, &file) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to reopen file")
if (NULL == file)
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to reopen file")
/* Get an atom for the file */
if((ret_value = H5VL_register_id(H5I_FILE, file, obj->vol_info, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize file handle")
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize file handle")
done:
FUNC_LEAVE_API(ret_value)
@@ -926,7 +919,7 @@ H5Fget_intent(hid_t file_id, unsigned *intent_flags)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier")
if((ret_value = H5VL_file_get(obj->vol_obj, obj->vol_info->vol_cls, H5VL_FILE_GET_INTENT,
- H5AC_dxpl_id, H5_REQUEST_NULL, intent_flags)) < 0)
+ H5AC_ind_read_dxpl_id, H5_REQUEST_NULL, intent_flags)) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get file intent")
}
@@ -962,8 +955,8 @@ H5Fget_freespace(hid_t file_id)
if(NULL == (obj = (H5VL_object_t *)H5I_object(file_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier")
- if(H5VL_file_optional(obj->vol_obj, obj->vol_info->vol_cls, H5AC_ind_dxpl_id, H5_REQUEST_NULL,
- H5VL_FILE_GET_FREE_SPACE, &ret_value) < 0)
+ if(H5VL_file_optional(obj->vol_obj, obj->vol_info->vol_cls, H5AC_ind_read_dxpl_id,
+ H5_REQUEST_NULL, H5VL_FILE_GET_FREE_SPACE, &ret_value) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get file free space")
done:
@@ -1000,8 +993,8 @@ H5Fget_filesize(hid_t file_id, hsize_t *size)
if(NULL == (file = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID")
- if(H5VL_file_optional(file->vol_obj, file->vol_info->vol_cls, H5AC_dxpl_id, H5_REQUEST_NULL,
- H5VL_FILE_GET_SIZE, size) < 0)
+ if(H5VL_file_optional(file->vol_obj, file->vol_info->vol_cls, H5AC_ind_read_dxpl_id,
+ H5_REQUEST_NULL, H5VL_FILE_GET_SIZE, size) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get file size")
done:
@@ -1064,7 +1057,7 @@ H5Fget_file_image(hid_t file_id, void *buf_ptr, size_t buf_len)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID")
/* get image through the VOL */
- if(H5VL_file_optional(file->vol_obj, file->vol_info->vol_cls, H5AC_dxpl_id, H5_REQUEST_NULL,
+ if(H5VL_file_optional(file->vol_obj, file->vol_info->vol_cls, H5AC_ind_read_dxpl_id, H5_REQUEST_NULL,
H5VL_FILE_GET_FILE_IMAGE, buf_ptr, &ret_value, buf_len) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get file image")
@@ -1108,8 +1101,8 @@ H5Fget_mdc_config(hid_t file_id, H5AC_cache_config_t *config_ptr)
if(NULL == (obj = (H5VL_object_t *)H5I_object(file_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier")
- if(H5VL_file_optional(obj->vol_obj, obj->vol_info->vol_cls, H5AC_dxpl_id, H5_REQUEST_NULL,
- H5VL_FILE_GET_MDC_CONF, config_ptr) < 0)
+ if(H5VL_file_optional(obj->vol_obj, obj->vol_info->vol_cls, H5AC_ind_read_dxpl_id,
+ H5_REQUEST_NULL, H5VL_FILE_GET_MDC_CONF, config_ptr) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get mdc configuration")
done:
@@ -1145,8 +1138,8 @@ H5Fset_mdc_config(hid_t file_id, H5AC_cache_config_t *config_ptr)
if(NULL == (obj = (H5VL_object_t *)H5I_object(file_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier")
- if(H5VL_file_optional(obj->vol_obj, obj->vol_info->vol_cls, H5AC_dxpl_id, H5_REQUEST_NULL,
- H5VL_FILE_SET_MDC_CONFIG, config_ptr) < 0)
+ if(H5VL_file_optional(obj->vol_obj, obj->vol_info->vol_cls, H5AC_ind_read_dxpl_id,
+ H5_REQUEST_NULL, H5VL_FILE_SET_MDC_CONFIG, config_ptr) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "uanvle to set MDC configuration")
done:
@@ -1186,8 +1179,8 @@ H5Fget_mdc_hit_rate(hid_t file_id, double *hit_rate_ptr)
if(NULL == hit_rate_ptr)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL hit rate pointer")
- if(H5VL_file_optional(file->vol_obj, file->vol_info->vol_cls, H5AC_dxpl_id, H5_REQUEST_NULL,
- H5VL_FILE_GET_MDC_HR, hit_rate_ptr) < 0)
+ if(H5VL_file_optional(file->vol_obj, file->vol_info->vol_cls, H5AC_ind_read_dxpl_id,
+ H5_REQUEST_NULL, H5VL_FILE_GET_MDC_HR, hit_rate_ptr) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get MDC hit rate")
done:
@@ -1227,7 +1220,7 @@ H5Fget_mdc_size(hid_t file_id, size_t *max_size_ptr, size_t *min_clean_size_ptr,
if(NULL == (file = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID")
- if(H5VL_file_optional(file->vol_obj, file->vol_info->vol_cls, H5AC_dxpl_id,
+ if(H5VL_file_optional(file->vol_obj, file->vol_info->vol_cls, H5AC_ind_read_dxpl_id,
H5_REQUEST_NULL, H5VL_FILE_GET_MDC_SIZE,
max_size_ptr, min_clean_size_ptr, cur_size_ptr, cur_num_entries_ptr) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get MDC size")
@@ -1270,8 +1263,8 @@ H5Freset_mdc_hit_rate_stats(hid_t file_id)
if(NULL == (obj = (H5VL_object_t *)H5I_object(file_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier")
- if(H5VL_file_optional(obj->vol_obj, obj->vol_info->vol_cls, H5AC_dxpl_id, H5_REQUEST_NULL,
- H5VL_FILE_RESET_MDC_HIT_RATE) < 0)
+ if(H5VL_file_optional(obj->vol_obj, obj->vol_info->vol_cls, H5AC_ind_read_dxpl_id,
+ H5_REQUEST_NULL, H5VL_FILE_RESET_MDC_HIT_RATE) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "can't reset cache hit rate")
done:
@@ -1322,7 +1315,7 @@ H5Fget_name(hid_t obj_id, char *name/*out*/, size_t size)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier")
if(H5VL_file_get(obj->vol_obj, obj->vol_info->vol_cls, H5VL_FILE_GET_NAME,
- H5AC_dxpl_id, H5_REQUEST_NULL, type, size, name, &ret_value) < 0)
+ H5AC_ind_read_dxpl_id, H5_REQUEST_NULL, type, size, name, &ret_value) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get file name")
done:
@@ -1371,7 +1364,7 @@ H5Fget_info2(hid_t obj_id, H5F_info2_t *finfo)
if(NULL == (obj = H5VL_get_object(obj_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier")
- if(H5VL_file_optional(obj->vol_obj, obj->vol_info->vol_cls, H5AC_ind_dxpl_id, H5_REQUEST_NULL,
+ if(H5VL_file_optional(obj->vol_obj, obj->vol_info->vol_cls, H5AC_ind_read_dxpl_id, H5_REQUEST_NULL,
H5VL_FILE_GET_INFO, type, finfo) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get file info")
@@ -1411,7 +1404,7 @@ H5Fget_free_sections(hid_t file_id, H5F_mem_t type, size_t nsects,
if(sect_info && nsects == 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "nsects must be > 0")
- if(H5VL_file_optional(file->vol_obj, file->vol_info->vol_cls, H5AC_ind_dxpl_id, H5_REQUEST_NULL,
+ if(H5VL_file_optional(file->vol_obj, file->vol_info->vol_cls, H5AC_ind_read_dxpl_id, H5_REQUEST_NULL,
H5VL_FILE_GET_FREE_SECTIONS, sect_info, &ret_value, type, nsects) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get file free sections")
done:
@@ -1446,8 +1439,8 @@ H5Fclear_elink_file_cache(hid_t file_id)
if(NULL == (file = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier")
- if(H5VL_file_optional(file->vol_obj, file->vol_info->vol_cls, H5AC_dxpl_id, H5_REQUEST_NULL,
- H5VL_FILE_CLEAR_ELINK_CACHE) < 0)
+ if(H5VL_file_optional(file->vol_obj, file->vol_info->vol_cls, H5AC_ind_read_dxpl_id,
+ H5_REQUEST_NULL, H5VL_FILE_CLEAR_ELINK_CACHE) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't release external file cache")
done:
diff --git a/src/H5FA.c b/src/H5FA.c
index 1be3f2e..9678f45 100644
--- a/src/H5FA.c
+++ b/src/H5FA.c
@@ -79,7 +79,9 @@ hbool_t H5_PKG_INIT_VAR = FALSE;
* client class..
*/
const H5FA_class_t *const H5FA_client_class_g[] = {
- H5FA_CLS_TEST, /* ? - H5FA_CLS_TEST_ID */
+ H5FA_CLS_CHUNK, /* 0 - H5FA_CLS_CHUNK_ID */
+ H5FA_CLS_FILT_CHUNK, /* 1 - H5FA_CLS_FILT_CHUNK_ID */
+ H5FA_CLS_TEST, /* ? - H5FA_CLS_TEST_ID */
};
@@ -739,3 +741,36 @@ CATCH
END_FUNC(PRIV) /* end H5FA_iterate() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5FA_patch_file
+ *
+ * Purpose: Patch the top-level file pointer contained in fa
+ * to point to idx_info->f if they are different.
+ * This is possible because the file pointer in fa can be
+ * closed out if fa remains open.
+ *
+ * Return: SUCCEED
+ *
+ *-------------------------------------------------------------------------
+ */
+BEGIN_FUNC(PRIV, NOERR,
+herr_t, SUCCEED, -,
+H5FA_patch_file(H5FA_t *fa, H5F_t *f))
+
+ /* Local variables */
+
+#ifdef H5FA_DEBUG
+HDfprintf(stderr, "%s: Called\n", FUNC);
+#endif /* H5FA_DEBUG */
+
+ /*
+ * Check arguments.
+ */
+ HDassert(fa);
+ HDassert(f);
+
+ if(fa->f != f || fa->hdr->f != f)
+ fa->f = fa->hdr->f = f;
+
+END_FUNC(PRIV) /* end H5FA_patch_file() */
diff --git a/src/H5FAprivate.h b/src/H5FAprivate.h
index aa88003..1e76468 100644
--- a/src/H5FAprivate.h
+++ b/src/H5FAprivate.h
@@ -32,7 +32,7 @@
#endif /* NOT_YET */
/* Private headers needed by this file */
-#include "H5Fprivate.h" /* File access */
+#include "H5Fprivate.h" /* File access */
/**************************/
@@ -46,6 +46,9 @@
/* Fixed Array class IDs */
typedef enum H5FA_cls_id_t {
+ H5FA_CLS_CHUNK_ID = 0, /* Fixed array is for indexing dataset chunks w/o filters */
+ H5FA_CLS_FILT_CHUNK_ID, /* Fixed array is for indexing dataset chunks w/filters */
+
/* Start real class IDs at 0 -QAK */
/* (keep these last) */
H5FA_CLS_TEST_ID, /* Fixed array is for testing (do not use for actual data) */
@@ -104,6 +107,12 @@ typedef int (*H5FA_operator_t)(hsize_t idx, const void *_elmt, void *_udata);
/* Library-private Variables */
/*****************************/
+/* The Fixed Array class for dataset chunks w/o filters*/
+H5_DLLVAR const H5FA_class_t H5FA_CLS_CHUNK[1];
+
+/* The Fixed Array class for dataset chunks w/ filters*/
+H5_DLLVAR const H5FA_class_t H5FA_CLS_FILT_CHUNK[1];
+
/***************************************/
/* Library-private Function Prototypes */
@@ -120,6 +129,7 @@ H5_DLL herr_t H5FA_get(const H5FA_t *fa, hid_t dxpl_id, hsize_t idx, void *elmt)
H5_DLL herr_t H5FA_iterate(H5FA_t *fa, hid_t dxpl_id, H5FA_operator_t op, void *udata);
H5_DLL herr_t H5FA_close(H5FA_t *fa, hid_t dxpl_id);
H5_DLL herr_t H5FA_delete(H5F_t *f, hid_t dxpl_id, haddr_t fa_addr, void *ctx_udata);
+H5_DLL herr_t H5FA_patch_file(H5FA_t *fa, H5F_t *f);
/* Statistics routines */
H5_DLL herr_t H5FA_get_stats(const H5FA_t *ea, H5FA_stat_t *stats);
diff --git a/src/H5FDcore.c b/src/H5FDcore.c
index f4aa240..778baa0 100644
--- a/src/H5FDcore.c
+++ b/src/H5FDcore.c
@@ -1295,9 +1295,7 @@ H5FD__core_write(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UN
HGOTO_ERROR(H5E_FILE, H5E_CANTALLOC, FAIL, "unable to allocate memory block of %llu bytes", (unsigned long long)new_eof)
} /* end else */
-#ifdef H5_CLEAR_MEMORY
HDmemset(x + file->eof, 0, (size_t)(new_eof - file->eof));
-#endif /* H5_CLEAR_MEMORY */
file->mem = x;
file->eof = new_eof;
@@ -1469,10 +1467,8 @@ H5FD__core_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t closing
HGOTO_ERROR(H5E_FILE, H5E_CANTALLOC, FAIL, "unable to allocate memory block")
} /* end else */
-#ifdef H5_CLEAR_MEMORY
if(file->eof < new_eof)
HDmemset(x + file->eof, 0, (size_t)(new_eof - file->eof));
-#endif /* H5_CLEAR_MEMORY */
file->mem = x;
/* Update backing store, if using it and if closing */
diff --git a/src/H5FDint.c b/src/H5FDint.c
index e7cb2c0..128f30f 100644
--- a/src/H5FDint.c
+++ b/src/H5FDint.c
@@ -170,6 +170,25 @@ H5FD_read(H5FD_t *file, const H5P_genplist_t *dxpl, H5FD_mem_t type, haddr_t add
HDassert(TRUE == H5P_class_isa(H5P_CLASS(dxpl), H5P_CLS_DATASET_XFER_g));
HDassert(buf);
+ /* Sanity check the dxpl type against the mem type */
+#ifdef H5_DEBUG_BUILD
+ {
+ H5FD_dxpl_type_t dxpl_type; /* Property indicating the type of the internal dxpl */
+
+ /* get the dxpl type */
+ if(H5P_get(dxpl, H5FD_DXPL_TYPE_NAME, &dxpl_type) < 0)
+ HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't retrieve dxpl type")
+
+ /* we shouldn't be here if the dxpl is labeled with NO I/O */
+ HDassert(H5FD_NOIO_DXPL != dxpl_type);
+
+ if(H5FD_MEM_DRAW == type)
+ HDassert(H5FD_RAWDATA_DXPL == dxpl_type);
+ else
+ HDassert(H5FD_METADATA_DXPL == dxpl_type);
+ }
+#endif /* H5_DEBUG_BUILD */
+
#ifndef H5_HAVE_PARALLEL
/* Do not return early for Parallel mode since the I/O could be a */
/* collective transfer. */
@@ -219,6 +238,25 @@ H5FD_write(H5FD_t *file, const H5P_genplist_t *dxpl, H5FD_mem_t type, haddr_t ad
HDassert(TRUE == H5P_class_isa(H5P_CLASS(dxpl), H5P_CLS_DATASET_XFER_g));
HDassert(buf);
+ /* Sanity check the dxpl type against the mem type */
+#ifdef H5_DEBUG_BUILD
+ {
+ H5FD_dxpl_type_t dxpl_type; /* Property indicating the type of the internal dxpl */
+
+ /* get the dxpl type */
+ if(H5P_get(dxpl, H5FD_DXPL_TYPE_NAME, &dxpl_type) < 0)
+ HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't retrieve dxpl type")
+
+ /* we shouldn't be here if the dxpl is labeled with NO I/O */
+ HDassert(H5FD_NOIO_DXPL != dxpl_type);
+
+ if(H5FD_MEM_DRAW == type)
+ HDassert(H5FD_RAWDATA_DXPL == dxpl_type);
+ else
+ HDassert(H5FD_METADATA_DXPL == dxpl_type);
+ }
+#endif /* H5_DEBUG_BUILD */
+
#ifndef H5_HAVE_PARALLEL
/* Do not return early for Parallel mode since the I/O could be a */
/* collective transfer. */
diff --git a/src/H5FDlog.c b/src/H5FDlog.c
index a8228e0..4bb72ce 100644
--- a/src/H5FDlog.c
+++ b/src/H5FDlog.c
@@ -406,7 +406,7 @@ H5FD_log_fapl_copy(const void *_old_fa)
/* Deep copy the log file name */
if(old_fa->logfile != NULL)
- if(NULL == (new_fa->logfile = H5MM_xstrdup(old_fa->logfile)))
+ if(NULL == (new_fa->logfile = H5MM_strdup(old_fa->logfile)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "unable to allocate log file name")
/* Set return value */
@@ -416,7 +416,7 @@ done:
if(NULL == ret_value)
if(new_fa) {
if(new_fa->logfile)
- H5MM_free(new_fa->logfile);
+ new_fa->logfile = H5MM_xfree(new_fa->logfile);
H5MM_free(new_fa);
} /* end if */
@@ -445,7 +445,7 @@ H5FD_log_fapl_free(void *_fa)
/* Free the fapl information */
if(fa->logfile)
- H5MM_xfree(fa->logfile);
+ fa->logfile = H5MM_xfree(fa->logfile);
H5MM_xfree(fa);
FUNC_LEAVE_NOAPI(SUCCEED)
@@ -594,7 +594,7 @@ H5FD_log_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
/* Get the flags for logging */
file->fa.flags = fa->flags;
if(fa->logfile)
- file->fa.logfile = HDstrdup(fa->logfile);
+ file->fa.logfile = H5MM_strdup(fa->logfile);
else
file->fa.logfile = NULL;
file->fa.buf_size = fa->buf_size;
@@ -798,10 +798,8 @@ H5FD_log_close(H5FD_t *_file)
HDfclose(file->logfp);
} /* end if */
- if(file->fa.logfile) {
- HDfree(file->fa.logfile);
- file->fa.logfile = NULL;
- }
+ if(file->fa.logfile)
+ file->fa.logfile = H5MM_xfree(file->fa.logfile);
/* Release the file info */
file = H5FL_FREE(H5FD_log_t, file);
diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c
index b3ef1f2..ed70e20 100644
--- a/src/H5FDmpio.c
+++ b/src/H5FDmpio.c
@@ -96,12 +96,6 @@ static int H5FD_mpio_mpi_rank(const H5FD_t *_file);
static int H5FD_mpio_mpi_size(const H5FD_t *_file);
static MPI_Comm H5FD_mpio_communicator(const H5FD_t *_file);
-/* MPIO-specific file access properties */
-typedef struct H5FD_mpio_fapl_t {
- MPI_Comm comm; /*communicator */
- MPI_Info info; /*file information */
-} H5FD_mpio_fapl_t;
-
/* The MPIO file driver information */
static const H5FD_class_mpi_t H5FD_mpio_g = {
{ /* Start of superclass information */
@@ -1436,7 +1430,7 @@ H5FD_mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t dxpl_id, had
#endif
/* Only look for MPI views for raw data transfers */
- if(type==H5FD_MEM_DRAW) {
+ if(type == H5FD_MEM_DRAW) {
H5FD_mpio_xfer_t xfer_mode; /* I/O tranfer mode */
/* Obtain the data transfer properties */
@@ -1702,6 +1696,7 @@ H5FD_mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr,
int size_i;
hbool_t use_view_this_time = FALSE;
H5P_genplist_t *plist = NULL; /* Property list pointer */
+ H5FD_mpio_xfer_t xfer_mode; /* I/O tranfer mode */
herr_t ret_value = SUCCEED;
FUNC_ENTER_NOAPI_NOINIT
@@ -1732,57 +1727,42 @@ H5FD_mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr,
fprintf(stdout, "in H5FD_mpio_write mpi_off=%ld size_i=%d\n", (long)mpi_off, size_i);
#endif
- if(type == H5FD_MEM_DRAW) {
- H5FD_mpio_xfer_t xfer_mode; /* I/O tranfer mode */
+ /* Obtain the data transfer properties */
+ if(NULL == (plist = (H5P_genplist_t *)H5I_object(dxpl_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list")
- /* Obtain the data transfer properties */
- if(NULL == (plist = (H5P_genplist_t *)H5I_object(dxpl_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list")
-
- /* get the transfer mode from the dxpl */
- if(H5P_get(plist, H5D_XFER_IO_XFER_MODE_NAME, &xfer_mode)<0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get MPI-I/O transfer mode")
+ /* get the transfer mode from the dxpl */
+ if(H5P_get(plist, H5D_XFER_IO_XFER_MODE_NAME, &xfer_mode)<0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get MPI-I/O transfer mode")
- /*
- * Set up for a fancy xfer using complex types, or single byte block. We
- * wouldn't need to rely on the use_view field if MPI semantics allowed
- * us to test that btype=ftype=MPI_BYTE (or even MPI_TYPE_NULL, which
- * could mean "use MPI_BYTE" by convention).
- */
- if(xfer_mode == H5FD_MPIO_COLLECTIVE) {
- MPI_Datatype file_type;
+ /*
+ * Set up for a fancy xfer using complex types, or single byte block. We
+ * wouldn't need to rely on the use_view field if MPI semantics allowed
+ * us to test that btype=ftype=MPI_BYTE (or even MPI_TYPE_NULL, which
+ * could mean "use MPI_BYTE" by convention).
+ */
+ if(xfer_mode == H5FD_MPIO_COLLECTIVE) {
+ MPI_Datatype file_type;
- /* Remember that views are used */
- use_view_this_time = TRUE;
+ /* Remember that views are used */
+ use_view_this_time = TRUE;
- /* prepare for a full-blown xfer using btype, ftype, and disp */
- if(H5P_get(plist, H5FD_MPI_XFER_MEM_MPI_TYPE_NAME, &buf_type) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get MPI-I/O type property")
- if(H5P_get(plist, H5FD_MPI_XFER_FILE_MPI_TYPE_NAME, &file_type) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get MPI-I/O type property")
+ /* prepare for a full-blown xfer using btype, ftype, and disp */
+ if(H5P_get(plist, H5FD_MPI_XFER_MEM_MPI_TYPE_NAME, &buf_type) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get MPI-I/O type property")
+ if(H5P_get(plist, H5FD_MPI_XFER_FILE_MPI_TYPE_NAME, &file_type) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get MPI-I/O type property")
- /*
- * Set the file view when we are using MPI derived types
- */
- if(MPI_SUCCESS != (mpi_code = MPI_File_set_view(file->f, mpi_off, MPI_BYTE, file_type, H5FD_mpi_native_g, file->info)))
- HMPI_GOTO_ERROR(FAIL, "MPI_File_set_view failed", mpi_code)
+ /*
+ * Set the file view when we are using MPI derived types
+ */
+ if(MPI_SUCCESS != (mpi_code = MPI_File_set_view(file->f, mpi_off, MPI_BYTE, file_type, H5FD_mpi_native_g, file->info)))
+ HMPI_GOTO_ERROR(FAIL, "MPI_File_set_view failed", mpi_code)
- /* When using types, use the address as the displacement for
- * MPI_File_set_view and reset the address for the read to zero
- */
- mpi_off = 0;
- } /* end if */
- } /* end if */
- else {
-#if 0 /* JRM -- 3/23/10 */ /* this is no longer always the case */
- /* Only one process can do the actual metadata write */
- if(file->mpi_rank != H5_PAR_META_WRITE)
-#ifdef LATER
- HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "can't write metadata from non-zero rank")
-#else /* LATER */
- HGOTO_DONE(SUCCEED) /* skip the actual write */
-#endif /* LATER */
-#endif /* JRM */
+ /* When using types, use the address as the displacement for
+ * MPI_File_set_view and reset the address for the read to zero
+ */
+ mpi_off = 0;
} /* end if */
/* Write the data. */
@@ -1793,6 +1773,7 @@ H5FD_mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr,
if(H5FD_mpio_Debug[(int)'t'])
fprintf(stdout, "H5FD_mpio_write: using MPIO collective mode\n");
#endif
+
/* Get the collective_opt property to check whether the application wants to do IO individually. */
HDassert(plist);
/* get the transfer mode from the dxpl */
@@ -1808,6 +1789,8 @@ H5FD_mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr,
HMPI_GOTO_ERROR(FAIL, "MPI_File_write_at_all failed", mpi_code)
} /* end if */
else {
+ if(type != H5FD_MEM_DRAW)
+ HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "Metadata Coll opt property should be collective at this point")
#ifdef H5FDmpio_DEBUG
if(H5FD_mpio_Debug[(int)'t'])
fprintf(stdout, "H5FD_mpio_write: doing MPI independent IO\n");
diff --git a/src/H5FDmulti.c b/src/H5FDmulti.c
index 181ad39..b4460b8 100644
--- a/src/H5FDmulti.c
+++ b/src/H5FDmulti.c
@@ -1592,11 +1592,8 @@ H5FD_multi_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr,
size_t size, void *_buf/*out*/)
{
H5FD_multi_t *file = (H5FD_multi_t*)_file;
- H5FD_multi_dxpl_t dx;
- htri_t prop_exists = FALSE; /* Whether the multi VFD DXPL property already exists */
H5FD_mem_t mt, mmt, hi = H5FD_MEM_DEFAULT;
haddr_t start_addr = 0;
- dxpl_id = dxpl_id; /* Suppress compiler warning */
/* Clear the error stack */
H5Eclear2(H5E_DEFAULT);
@@ -1618,8 +1615,7 @@ H5FD_multi_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr,
assert(hi > 0);
/* Read from that member */
- return H5FDread(file->memb[hi], type, (prop_exists ? dx.memb_dxpl[hi] : H5P_DEFAULT),
- addr - start_addr, size, _buf);
+ return H5FDread(file->memb[hi], type, dxpl_id, addr - start_addr, size, _buf);
} /* end H5FD_multi_read() */
@@ -1644,11 +1640,8 @@ H5FD_multi_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr,
size_t size, const void *_buf)
{
H5FD_multi_t *file = (H5FD_multi_t*)_file;
- H5FD_multi_dxpl_t dx;
- htri_t prop_exists = FALSE; /* Whether the multi VFD DXPL property already exists */
H5FD_mem_t mt, mmt, hi = H5FD_MEM_DEFAULT;
haddr_t start_addr = 0;
- dxpl_id = dxpl_id; /* Suppress compiler warning */
/* Clear the error stack */
H5Eclear2(H5E_DEFAULT);
@@ -1670,8 +1663,7 @@ H5FD_multi_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr,
assert(hi > 0);
/* Write to that member */
- return H5FDwrite(file->memb[hi], type, (prop_exists ? dx.memb_dxpl[hi] : H5P_DEFAULT),
- addr - start_addr, size, _buf);
+ return H5FDwrite(file->memb[hi], type, dxpl_id, addr - start_addr, size, _buf);
} /* end H5FD_multi_write() */
diff --git a/src/H5FDprivate.h b/src/H5FDprivate.h
index 0f195ce..639f3eb 100644
--- a/src/H5FDprivate.h
+++ b/src/H5FDprivate.h
@@ -96,6 +96,25 @@ typedef struct {
const void *driver_info; /* Driver info, for open callbacks */
} H5FD_driver_prop_t;
+#ifdef H5_HAVE_PARALLEL
+/* MPIO-specific file access properties */
+typedef struct H5FD_mpio_fapl_t {
+ MPI_Comm comm; /*communicator */
+ MPI_Info info; /*file information */
+} H5FD_mpio_fapl_t;
+#endif /* H5_HAVE_PARALLEL */
+
+#ifdef H5_DEBUG_BUILD
+/* Definitions for the internal DXPL types created in H5AC__init_package() */
+typedef enum {
+ H5FD_METADATA_DXPL = 0,
+ H5FD_NOIO_DXPL,
+ H5FD_RAWDATA_DXPL
+} H5FD_dxpl_type_t;
+
+#define H5FD_DXPL_TYPE_NAME "H5P_dxpl_type"
+#endif /* H5_DEBUG_BUILD */
+
/*****************************/
/* Library Private Variables */
diff --git a/src/H5FDstdio.c b/src/H5FDstdio.c
index d5b3d40..bc85c74 100644
--- a/src/H5FDstdio.c
+++ b/src/H5FDstdio.c
@@ -126,23 +126,14 @@ typedef struct H5FD_stdio_t {
#endif /* H5_HAVE_MINGW */
#endif /* H5_HAVE_WIN32_API */
-/* Use file_xxx to indicate these are local macros, avoiding confusing
- * with the global HD_xxx macros.
- * Assume fseeko, which is POSIX standard, is always supported;
- * but prefer to use fseeko64 if supported.
+/* If these functions weren't re-defined for Windows, give them
+ * more platform-independent names.
*/
#ifndef file_fseek
- #ifdef H5_HAVE_FSEEKO64
- #define file_fseek fseeko64
- #define file_offset_t off64_t
- #define file_ftruncate ftruncate64
- #define file_ftell ftello64
- #else
- #define file_fseek fseeko
- #define file_offset_t off_t
- #define file_ftruncate ftruncate
- #define file_ftell ftello
- #endif /* H5_HAVE_FSEEKO64 */
+ #define file_fseek fseeko
+ #define file_offset_t off_t
+ #define file_ftruncate ftruncate
+ #define file_ftell ftello
#endif /* file_fseek */
/* These macros check for overflow of various quantities. These macros
diff --git a/src/H5FS.c b/src/H5FS.c
index 90f04ac..19ff8e4 100644
--- a/src/H5FS.c
+++ b/src/H5FS.c
@@ -1184,7 +1184,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5FS_assert(const H5FS_t *fspace)
+H5FS_assert(const H5FS_t *fspace, hid_t dxpl_id)
{
FUNC_ENTER_NOAPI_NOINIT_NOERR
#ifdef QAK
@@ -1194,7 +1194,7 @@ HDfprintf(stderr, "%s: fspace->tot_sect_count = %Hu\n", "H5FS_assert", fspace->t
/* Checks for section info, if it's available */
if(fspace->sinfo) {
/* Sanity check sections */
- H5FS_sect_assert(fspace);
+ H5FS_sect_assert(fspace, dxpl_id);
/* General assumptions about the section size counts */
HDassert(fspace->sinfo->tot_size_count >= fspace->sinfo->serial_size_count);
diff --git a/src/H5FScache.c b/src/H5FScache.c
index 2f7dda8..1d27972 100644
--- a/src/H5FScache.c
+++ b/src/H5FScache.c
@@ -529,7 +529,7 @@ H5FS__cache_hdr_pre_serialize(const H5F_t *f, hid_t dxpl_id, void *_thing,
HDassert(fspace->sinfo->cache_info.size == fspace->alloc_sect_size);
/* Let the metadata cache know the section info moved */
- if(H5AC_move_entry((H5F_t *)f, H5AC_FSPACE_SINFO, fspace->sect_addr, new_sect_addr) < 0)
+ if(H5AC_move_entry((H5F_t *)f, H5AC_FSPACE_SINFO, fspace->sect_addr, new_sect_addr, dxpl_id) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTMOVE, FAIL, "unable to move section info")
fspace->sect_addr = new_sect_addr;
@@ -591,7 +591,7 @@ H5FS__cache_hdr_pre_serialize(const H5F_t *f, hid_t dxpl_id, void *_thing,
HDassert(!H5F_addr_eq(fspace->sect_addr, new_sect_addr));
/* Let the metadata cache know the section info moved */
- if(H5AC_move_entry((H5F_t *)f, H5AC_FSPACE_SINFO, fspace->sect_addr, new_sect_addr) < 0)
+ if(H5AC_move_entry((H5F_t *)f, H5AC_FSPACE_SINFO, fspace->sect_addr, new_sect_addr, dxpl_id) < 0)
HGOTO_ERROR(H5E_FSPACE, H5E_CANTMOVE, FAIL, "unable to move section info")
/* Update the internal address for the section info */
@@ -1080,7 +1080,7 @@ H5FS__cache_sinfo_pre_serialize(const H5F_t *f, hid_t dxpl_id, void *_thing,
HDassert(!H5F_addr_eq(sinfo->fspace->sect_addr, sinfo_addr));
/* Let the metadata cache know the section info moved */
- if(H5AC_move_entry((H5F_t *)f, H5AC_FSPACE_SINFO, sinfo->fspace->sect_addr, sinfo_addr) < 0)
+ if(H5AC_move_entry((H5F_t *)f, H5AC_FSPACE_SINFO, sinfo->fspace->sect_addr, sinfo_addr, dxpl_id) < 0)
HGOTO_ERROR(H5E_FSPACE, H5E_CANTMOVE, FAIL, "unable to move section info")
/* Update the internal address for the section info */
diff --git a/src/H5FSpkg.h b/src/H5FSpkg.h
index 08c2529..eafe3c2 100644
--- a/src/H5FSpkg.h
+++ b/src/H5FSpkg.h
@@ -238,8 +238,8 @@ H5_DLL herr_t H5FS_sinfo_dest(H5FS_sinfo_t *sinfo);
/* Sanity check routines */
#ifdef H5FS_DEBUG
-H5_DLL herr_t H5FS_assert(const H5FS_t *fspace);
-H5_DLL herr_t H5FS_sect_assert(const H5FS_t *fspace);
+H5_DLL herr_t H5FS_assert(const H5FS_t *fspace, hid_t dxpl_id);
+H5_DLL herr_t H5FS_sect_assert(const H5FS_t *fspace, hid_t dxpl_id);
#endif /* H5FS_DEBUG */
/* Testing routines */
diff --git a/src/H5FSprivate.h b/src/H5FSprivate.h
index c5ad38f..20fdff1 100644
--- a/src/H5FSprivate.h
+++ b/src/H5FSprivate.h
@@ -106,7 +106,7 @@ typedef struct H5FS_section_class_t {
htri_t (*can_shrink)(const H5FS_section_info_t *, void *); /* Routine to determine if node can shrink container */
herr_t (*shrink)(H5FS_section_info_t **, void *); /* Routine to shrink container */
herr_t (*free)(H5FS_section_info_t *); /* Routine to free node */
- herr_t (*valid)(const struct H5FS_section_class_t *, const H5FS_section_info_t *); /* Routine to check if a section is valid */
+ herr_t (*valid)(const struct H5FS_section_class_t *, const H5FS_section_info_t *, hid_t dxpl_id); /* Routine to check if a section is valid */
H5FS_section_info_t *(*split)(H5FS_section_info_t *, hsize_t); /* Routine to create the split section */
herr_t (*debug)(const H5FS_section_info_t *, FILE *, int , int ); /* Routine to dump debugging information about a section */
} H5FS_section_class_t;
diff --git a/src/H5FSsection.c b/src/H5FSsection.c
index 62500e7..5638f4f 100644
--- a/src/H5FSsection.c
+++ b/src/H5FSsection.c
@@ -1421,7 +1421,7 @@ done:
#ifdef H5FS_DEBUG_ASSERT
if(!(flags & (H5FS_ADD_DESERIALIZING | H5FS_ADD_SKIP_VALID)))
- H5FS_assert(fspace);
+ H5FS_assert(fspace, dxpl_id);
#endif /* H5FS_DEBUG_ASSERT */
#ifdef H5FS_SINFO_DEBUG
HDfprintf(stderr, "%s: Leaving, ret_value = %d\n", FUNC, ret_value);
@@ -1840,7 +1840,7 @@ done:
HDONE_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't release section info")
#ifdef H5FS_DEBUG_ASSERT
- H5FS_assert(fspace);
+ H5FS_assert(fspace, dxpl_id);
#endif /* H5FS_DEBUG_ASSERT */
FUNC_LEAVE_NOAPI(ret_value)
} /* H5FS_sect_find() */
@@ -2198,7 +2198,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5FS_sect_assert(const H5FS_t *fspace)
+H5FS_sect_assert(const H5FS_t *fspace, hid_t dxpl_id)
{
hsize_t separate_obj; /* The number of separate objects managed */
@@ -2270,7 +2270,7 @@ HDfprintf(stderr, "%s: sect->size = %Hu, sect->addr = %a, sect->type = %u\n", "H
HDassert(H5F_addr_defined(sect->addr));
HDassert(fspace_node->sect_size == sect->size);
if(cls->valid)
- (*cls->valid)(cls, sect);
+ (*cls->valid)(cls, sect, dxpl_id);
/* Add to correct count */
if(cls->flags & H5FS_CLS_GHOST_OBJ)
diff --git a/src/H5Faccum.c b/src/H5Faccum.c
index 53f51ad..3fac184 100644
--- a/src/H5Faccum.c
+++ b/src/H5Faccum.c
@@ -112,10 +112,9 @@ H5FL_BLK_DEFINE_STATIC(meta_accum);
*-------------------------------------------------------------------------
*/
herr_t
-H5F__accum_read(const H5F_io_info_t *fio_info, H5FD_mem_t type, haddr_t addr,
+H5F__accum_read(const H5F_io_info_t *fio_info, H5FD_mem_t map_type, haddr_t addr,
size_t size, void *buf/*out*/)
{
- H5FD_mem_t map_type; /* Mapped memory type */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -125,9 +124,6 @@ H5F__accum_read(const H5F_io_info_t *fio_info, H5FD_mem_t type, haddr_t addr,
HDassert(fio_info->dxpl);
HDassert(buf);
- /* Treat global heap as raw data */
- map_type = (type == H5FD_MEM_GHEAP) ? H5FD_MEM_DRAW : type;
-
/* Check if this information is in the metadata accumulator */
if((fio_info->f->shared->feature_flags & H5FD_FEAT_ACCUMULATE_METADATA) && map_type != H5FD_MEM_DRAW) {
H5F_meta_accum_t *accum; /* Alias for file's metadata accumulator */
@@ -164,9 +160,9 @@ H5F__accum_read(const H5F_io_info_t *fio_info, H5FD_mem_t type, haddr_t addr,
/* Note the new buffer size */
accum->alloc_size = new_alloc_size;
-#ifdef H5_CLEAR_MEMORY
- HDmemset(accum->buf + accum->size, 0, (accum->alloc_size - accum->size));
-#endif /* H5_CLEAR_MEMORY */
+
+ /* Clear the memory */
+ HDmemset(accum->buf + accum->size, 0, (accum->alloc_size - accum->size));
} /* end if */
/* Read the part before the metadata accumulator */
@@ -395,9 +391,9 @@ H5F__accum_adjust(H5F_meta_accum_t *accum, const H5F_io_info_t *fio_info,
/* Update accumulator info */
accum->buf = new_buf;
accum->alloc_size = new_size;
-#ifdef H5_CLEAR_MEMORY
-HDmemset(accum->buf + accum->size, 0, (accum->alloc_size - (accum->size + size)));
-#endif /* H5_CLEAR_MEMORY */
+
+ /* Clear the memory */
+ HDmemset(accum->buf + accum->size, 0, (accum->alloc_size - (accum->size + size)));
} /* end if */
} /* end if */
@@ -421,10 +417,9 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5F__accum_write(const H5F_io_info_t *fio_info, H5FD_mem_t type, haddr_t addr,
+H5F__accum_write(const H5F_io_info_t *fio_info, H5FD_mem_t map_type, haddr_t addr,
size_t size, const void *buf)
{
- H5FD_mem_t map_type; /* Mapped memory type */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -435,9 +430,6 @@ H5F__accum_write(const H5F_io_info_t *fio_info, H5FD_mem_t type, haddr_t addr,
HDassert(fio_info->dxpl);
HDassert(buf);
- /* Treat global heap as raw data */
- map_type = (type == H5FD_MEM_GHEAP) ? H5FD_MEM_DRAW : type;
-
/* Check for accumulating metadata */
if((fio_info->f->shared->feature_flags & H5FD_FEAT_ACCUMULATE_METADATA) && map_type != H5FD_MEM_DRAW) {
H5F_meta_accum_t *accum; /* Alias for file's metadata accumulator */
@@ -623,9 +615,9 @@ H5F__accum_write(const H5F_io_info_t *fio_info, H5FD_mem_t type, haddr_t addr,
/* Note the new buffer size */
accum->alloc_size = new_alloc_size;
-#ifdef H5_CLEAR_MEMORY
-HDmemset(accum->buf + size, 0, (accum->alloc_size - size));
-#endif /* H5_CLEAR_MEMORY */
+
+ /* Clear the memory */
+ HDmemset(accum->buf + size, 0, (accum->alloc_size - size));
} /* end if */
/* Copy the new metadata to the buffer */
@@ -656,6 +648,7 @@ HDmemset(accum->buf + size, 0, (accum->alloc_size - size));
/* Check if we need to resize the buffer */
if(size > accum->alloc_size) {
size_t new_size; /* New size of accumulator */
+ size_t clear_size; /* Size of memory that needs clearing */
/* Adjust the buffer size to be a power of 2 that is large enough to hold data */
new_size = (size_t)1 << (1 + H5VM_log2_gen((uint64_t)(size - 1)));
@@ -666,12 +659,10 @@ HDmemset(accum->buf + size, 0, (accum->alloc_size - size));
/* Note the new buffer size */
accum->alloc_size = new_size;
-#ifdef H5_CLEAR_MEMORY
-{
-size_t clear_size = MAX(accum->size, size);
-HDmemset(accum->buf + clear_size, 0, (accum->alloc_size - clear_size));
-}
-#endif /* H5_CLEAR_MEMORY */
+
+ /* Clear the memory */
+ clear_size = MAX(accum->size, size);
+ HDmemset(accum->buf + clear_size, 0, (accum->alloc_size - clear_size));
} /* end if */
else {
/* Check if we should shrink the accumulator buffer */
@@ -716,9 +707,9 @@ HDmemset(accum->buf + clear_size, 0, (accum->alloc_size - clear_size));
/* Note the new buffer size */
accum->alloc_size = new_size;
-#ifdef H5_CLEAR_MEMORY
-HDmemset(accum->buf + size, 0, (accum->alloc_size - size));
-#endif /* H5_CLEAR_MEMORY */
+
+ /* Clear the memory */
+ HDmemset(accum->buf + size, 0, (accum->alloc_size - size));
} /* end if */
/* Update the metadata accumulator information */
diff --git a/src/H5Fdeprec.c b/src/H5Fdeprec.c
index 986072b..d423b21 100644
--- a/src/H5Fdeprec.c
+++ b/src/H5Fdeprec.c
@@ -133,12 +133,12 @@ H5Fget_info1(hid_t obj_id, H5F_info1_t *finfo)
HDmemset(finfo, 0, sizeof(*finfo));
/* Get the size of the superblock extension */
- if(H5F__super_size(f, H5AC_ind_dxpl_id, NULL, &finfo->super_ext_size) < 0)
+ if(H5F__super_size(f, H5AC_ind_read_dxpl_id, NULL, &finfo->super_ext_size) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "Unable to retrieve superblock extension size")
/* Check for SOHM info */
if(H5F_addr_defined(f->shared->sohm_addr))
- if(H5SM_ih_size(f, H5AC_ind_dxpl_id, &finfo->sohm.hdr_size, &finfo->sohm.msgs_info) < 0)
+ if(H5SM_ih_size(f, H5AC_ind_read_dxpl_id, &finfo->sohm.hdr_size, &finfo->sohm.msgs_info) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "Unable to retrieve SOHM index & heap storage info")
done:
@@ -179,7 +179,7 @@ H5Fis_hdf5(const char *name)
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "no file name specified")
/* Call private routine */
- if((ret_value = H5F_is_hdf5(name, H5P_FILE_ACCESS_DEFAULT)) < 0)
+ if((ret_value = H5F_is_hdf5(name, H5P_FILE_ACCESS_DEFAULT, H5AC_ind_read_dxpl_id)) < 0)
HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "unable to open file")
done:
diff --git a/src/H5Fint.c b/src/H5Fint.c
index 1b08934..6346f67 100644
--- a/src/H5Fint.c
+++ b/src/H5Fint.c
@@ -134,6 +134,7 @@ H5F_get_access_plist(H5F_t *f, hbool_t app_ref)
H5FD_driver_prop_t driver_prop; /* Property for driver ID & info */
hbool_t driver_prop_copied = FALSE; /* Whether the driver property has been set up */
unsigned efc_size = 0;
+ hbool_t latest_format = FALSE; /* Always use the latest format? */
hid_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -170,12 +171,20 @@ H5F_get_access_plist(H5F_t *f, hbool_t app_ref)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't sieve buffer size")
if(H5P_set(new_plist, H5F_ACS_SDATA_BLOCK_SIZE_NAME, &(f->shared->sdata_aggr.alloc_size)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set 'small data' cache size")
- if(H5P_set(new_plist, H5F_ACS_LATEST_FORMAT_NAME, &(f->shared->latest_format)) < 0)
+ if(f->shared->latest_flags > 0)
+ latest_format = TRUE;
+ if(H5P_set(new_plist, H5F_ACS_LATEST_FORMAT_NAME, &latest_format) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set 'latest format' flag")
if(f->shared->efc)
efc_size = H5F_efc_max_nfiles(f->shared->efc);
if(H5P_set(new_plist, H5F_ACS_EFC_SIZE_NAME, &efc_size) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set elink file cache size")
+#ifdef H5_HAVE_PARALLEL
+ if(H5P_set(new_plist, H5_COLL_MD_READ_FLAG_NAME, &(f->coll_md_read)) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set collective metadata read flag")
+ if(H5P_set(new_plist, H5F_ACS_COLL_MD_WRITE_FLAG_NAME, &(f->coll_md_write)) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set collective metadata read flag")
+#endif /* H5_HAVE_PARALLEL */
/* Prepare the driver property */
driver_prop.driver_id = f->shared->lf->driver_id;
@@ -503,32 +512,32 @@ done:
*-------------------------------------------------------------------------
*/
htri_t
-H5F_is_hdf5(const char *name, hid_t fapl_id)
+H5F_is_hdf5(const char *name, hid_t fapl_id, hid_t dxpl_id)
{
H5F_t *file = NULL; /* Low-level file struct */
haddr_t sig_addr; /* Addess of hdf5 file signature */
+ H5P_genplist_t *xfer_plist= NULL; /* Dataset transfer property list object */
htri_t ret_value = FAIL; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
- /* Open the file at the virtual file layer */
- //if(NULL == (file = H5FD_open(name, H5F_ACC_RDONLY, fapl_id, HADDR_UNDEF)))
- //HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "unable to open file")
-
/* Open the file */
if(NULL == (file = H5F_open(name, H5F_ACC_RDONLY, H5P_FILE_CREATE_DEFAULT,
- fapl_id, H5AC_ind_dxpl_id)))
+ fapl_id, dxpl_id)))
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FALSE, "unable to open file")
- /* The file is an hdf5 file if the hdf5 file signature can be found */
- if(H5FD_locate_signature(file->shared->lf, H5AC_ind_dxpl_g, &sig_addr) < 0)
+ /* Get the property list object */
+ if(NULL == (xfer_plist = (H5P_genplist_t *)H5I_object(dxpl_id)))
+ HGOTO_ERROR(H5E_CACHE, H5E_BADATOM, FAIL, "can't get new property list object")
+
+ if(H5FD_locate_signature(file->shared->lf, xfer_plist, &sig_addr) < 0)
HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, FALSE, "unable to locate file signature")
+
ret_value = (HADDR_UNDEF != sig_addr);
done:
/* Close the file */
if(file)
- //if(H5FD_close(file) < 0 && ret_value >= 0)
if(H5F_close(file) < 0 && ret_value >= 0)
HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "unable to close file")
@@ -576,6 +585,7 @@ H5F_new(H5F_file_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_t
else {
H5P_genplist_t *plist; /* Property list */
unsigned efc_size; /* External file cache size */
+ hbool_t latest_format; /* Always use the latest format? */
size_t u; /* Local index variable */
HDassert(lf != NULL);
@@ -631,8 +641,11 @@ H5F_new(H5F_file_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_t
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get garbage collect reference")
if(H5P_get(plist, H5F_ACS_SIEVE_BUF_SIZE_NAME, &(f->shared->sieve_buf_size)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get sieve buffer size")
- if(H5P_get(plist, H5F_ACS_LATEST_FORMAT_NAME, &(f->shared->latest_format)) < 0)
+ if(H5P_get(plist, H5F_ACS_LATEST_FORMAT_NAME, &latest_format) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get 'latest format' flag")
+ /* For latest format, activate all latest version support */
+ if(latest_format)
+ f->shared->latest_flags |= H5F_LATEST_ALL_FLAGS;
if(H5P_get(plist, H5F_ACS_META_BLOCK_SIZE_NAME, &(f->shared->meta_aggr.alloc_size)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get metadata cache size")
f->shared->meta_aggr.feature_flag = H5FD_FEAT_AGGREGATE_METADATA;
@@ -644,6 +657,12 @@ H5F_new(H5F_file_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_t
if(efc_size > 0)
if(NULL == (f->shared->efc = H5F_efc_create(efc_size)))
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "can't create external file cache")
+#ifdef H5_HAVE_PARALLEL
+ if(H5P_get(plist, H5_COLL_MD_READ_FLAG_NAME, &(f->coll_md_read)) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get collective metadata read flag")
+ if(H5P_get(plist, H5F_ACS_COLL_MD_WRITE_FLAG_NAME, &(f->coll_md_write)) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get collective metadata write flag")
+#endif /* H5_HAVE_PARALLEL */
/* Get the VFD values to cache */
f->shared->maxaddr = H5FD_get_maxaddr(lf);
@@ -1410,7 +1429,7 @@ H5F_try_close(H5F_t *f)
* shared H5F_file_t struct. If the reference count for the H5F_file_t
* struct reaches zero then destroy it also.
*/
- if(H5F_dest(f, H5AC_dxpl_id, TRUE) < 0)
+ if(H5F_dest(f, H5AC_ind_read_dxpl_id, TRUE) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "problems closing file")
done:
@@ -1998,7 +2017,7 @@ H5F_set_store_msg_crt_idx(H5F_t *f, hbool_t flag)
*-------------------------------------------------------------------------
*/
ssize_t
-H5F_get_file_image(H5F_t *file, void *buf_ptr, size_t buf_len)
+H5F_get_file_image(H5F_t *file, void *buf_ptr, size_t buf_len, hid_t dxpl_id)
{
H5FD_t *fd_ptr; /* file driver */
haddr_t eoa; /* End of file address */
@@ -2066,6 +2085,7 @@ H5F_get_file_image(H5F_t *file, void *buf_ptr, size_t buf_len)
/* test to see if a buffer was provided -- if not, we are done */
if(buf_ptr != NULL) {
size_t space_needed; /* size of file image */
+ H5P_genplist_t *xfer_plist= NULL; /* Dataset transfer property list object */
/* Check for buffer too small */
if((haddr_t)buf_len < eoa)
@@ -2073,9 +2093,13 @@ H5F_get_file_image(H5F_t *file, void *buf_ptr, size_t buf_len)
space_needed = (size_t)eoa;
+ /* Get the property list object */
+ if(NULL == (xfer_plist = (H5P_genplist_t *)H5I_object(dxpl_id)))
+ HGOTO_ERROR(H5E_CACHE, H5E_BADATOM, FAIL, "can't get new property list object")
+
/* read in the file image */
/* (Note compensation for base address addition in internal routine) */
- if(H5FD_read(fd_ptr, H5AC_ind_dxpl_g, H5FD_MEM_DEFAULT, 0, space_needed, buf_ptr) < 0)
+ if(H5FD_read(fd_ptr, xfer_plist, H5FD_MEM_DEFAULT, 0, space_needed, buf_ptr) < 0)
HGOTO_ERROR(H5E_FILE, H5E_READERROR, FAIL, "file image read request failed")
} /* end if */
@@ -2145,3 +2169,33 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5F__set_eoa() */
+#ifdef H5_HAVE_PARALLEL
+
+/*-------------------------------------------------------------------------
+ * Function: H5F_set_coll_md_read
+ *
+ * Purpose: Set the coll_md_read field with a new value.
+ *
+ * Return: Success: SUCCEED
+ * Failure: FAIL
+ *
+ * Programmer: Quincey Koziol
+ * 2/10/16
+ *
+ *-------------------------------------------------------------------------
+ */
+void
+H5F_set_coll_md_read(H5F_t *f, H5P_coll_md_read_flag_t cmr)
+{
+ /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+
+ /* Sanity check */
+ HDassert(f);
+
+ f->coll_md_read = cmr;
+
+ FUNC_LEAVE_NOAPI_VOID
+} /* H5F_set_coll_md_read() */
+#endif /* H5_HAVE_PARALLEL */
+
diff --git a/src/H5Fio.c b/src/H5Fio.c
index 04c4055..d001bc0 100644
--- a/src/H5Fio.c
+++ b/src/H5Fio.c
@@ -97,6 +97,8 @@ H5F_block_read(const H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size,
hid_t dxpl_id, void *buf/*out*/)
{
H5F_io_info_t fio_info; /* I/O info for operation */
+ H5FD_mem_t map_type; /* Mapped memory type */
+ hid_t my_dxpl_id = dxpl_id; /* transfer property to use for I/O */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -113,13 +115,22 @@ HDfprintf(stderr, "%s: read from addr = %a, size = %Zu\n", FUNC, addr, size);
if(H5F_addr_le(f->shared->tmp_addr, (addr + size)))
HGOTO_ERROR(H5E_IO, H5E_BADRANGE, FAIL, "attempting I/O in temporary file space")
+ /* Treat global heap as raw data */
+ map_type = (type == H5FD_MEM_GHEAP) ? H5FD_MEM_DRAW : type;
+
+#ifdef H5_DEBUG_BUILD
+ /* GHEAP type is treated as RAW, so update the dxpl type property too */
+ if(H5FD_MEM_GHEAP == type)
+ my_dxpl_id = H5AC_rawdata_dxpl_id;
+#endif /* H5_DEBUG_BUILD */
+
/* Set up I/O info for operation */
fio_info.f = f;
- if(NULL == (fio_info.dxpl = (H5P_genplist_t *)H5I_object(dxpl_id)))
+ if(NULL == (fio_info.dxpl = (H5P_genplist_t *)H5I_object(my_dxpl_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get property list")
/* Pass through metadata accumulator layer */
- if(H5F__accum_read(&fio_info, type, addr, size, buf) < 0)
+ if(H5F__accum_read(&fio_info, map_type, addr, size, buf) < 0)
HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "read through metadata accumulator failed")
done:
@@ -147,6 +158,8 @@ H5F_block_write(const H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size,
hid_t dxpl_id, const void *buf)
{
H5F_io_info_t fio_info; /* I/O info for operation */
+ H5FD_mem_t map_type; /* Mapped memory type */
+ hid_t my_dxpl_id = dxpl_id; /* transfer property to use for I/O */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -164,13 +177,22 @@ HDfprintf(stderr, "%s: write to addr = %a, size = %Zu\n", FUNC, addr, size);
if(H5F_addr_le(f->shared->tmp_addr, (addr + size)))
HGOTO_ERROR(H5E_IO, H5E_BADRANGE, FAIL, "attempting I/O in temporary file space")
+ /* Treat global heap as raw data */
+ map_type = (type == H5FD_MEM_GHEAP) ? H5FD_MEM_DRAW : type;
+
+#ifdef H5_DEBUG_BUILD
+ /* GHEAP type is treated as RAW, so update the dxpl type property too */
+ if(H5FD_MEM_GHEAP == type)
+ my_dxpl_id = H5AC_rawdata_dxpl_id;
+#endif /* H5_DEBUG_BUILD */
+
/* Set up I/O info for operation */
fio_info.f = f;
- if(NULL == (fio_info.dxpl = (H5P_genplist_t *)H5I_object(dxpl_id)))
+ if(NULL == (fio_info.dxpl = (H5P_genplist_t *)H5I_object(my_dxpl_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get property list")
/* Pass through metadata accumulator layer */
- if(H5F__accum_write(&fio_info, type, addr, size, buf) < 0)
+ if(H5F__accum_write(&fio_info, map_type, addr, size, buf) < 0)
HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "write through metadata accumulator failed")
done:
diff --git a/src/H5Fmount.c b/src/H5Fmount.c
index 314ac56..0276cf3 100644
--- a/src/H5Fmount.c
+++ b/src/H5Fmount.c
@@ -476,7 +476,7 @@ H5Fmount(hid_t loc_id, const char *name, hid_t child_id, hid_t plist_id)
if (obj->vol_info->vol_cls->value != file->vol_info->vol_cls->value)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "Can't mount file onto object from different VOL plugin")
- if(H5VL_file_specific(obj->vol_obj, obj->vol_info->vol_cls, H5VL_FILE_MOUNT, H5AC_dxpl_id,
+ if(H5VL_file_specific(obj->vol_obj, obj->vol_info->vol_cls, H5VL_FILE_MOUNT, H5AC_ind_read_dxpl_id,
H5_REQUEST_NULL, type, name, file->vol_obj, plist_id) < 0)
HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "unable to mount file")
@@ -527,8 +527,8 @@ H5Funmount(hid_t loc_id, const char *name)
if(NULL == (obj = (H5VL_object_t *)H5I_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier")
- if(H5VL_file_specific(obj->vol_obj, obj->vol_info->vol_cls, H5VL_FILE_UNMOUNT, H5AC_dxpl_id,
- H5_REQUEST_NULL, type, name) < 0)
+ if(H5VL_file_specific(obj->vol_obj, obj->vol_info->vol_cls, H5VL_FILE_UNMOUNT,
+ H5AC_ind_read_dxpl_id, H5_REQUEST_NULL, type, name) < 0)
HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "unable to unmount file")
done:
diff --git a/src/H5Fmpi.c b/src/H5Fmpi.c
index a6412f4..0692b8c 100644
--- a/src/H5Fmpi.c
+++ b/src/H5Fmpi.c
@@ -77,6 +77,35 @@
#ifdef H5_HAVE_PARALLEL
+
+/*-------------------------------------------------------------------------
+ * Function: H5F_get_mpi_handle
+ *
+ * Purpose: Retrieves MPI File handle.
+ *
+ * Return: Success: The size (positive)
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5F_get_mpi_handle(const H5F_t *f, MPI_File **f_handle)
+{
+ herr_t ret_value = SUCCEED;
+ hid_t fapl = -1;
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ assert(f && f->shared);
+
+ /* Dispatch to driver */
+ if ((ret_value = H5FD_get_vfd_handle(f->shared->lf, fapl, (void **)f_handle)) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get mpi file handle")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5F_get_mpi_handle() */
+
/*-------------------------------------------------------------------------
* Function: H5F_mpi_get_rank
@@ -258,5 +287,74 @@ H5Fget_mpi_atomicity(hid_t file_id, hbool_t *flag)
done:
FUNC_LEAVE_API(ret_value)
}
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5F_mpi_retrieve_comm
+ *
+ * Purpose: Retrieves an MPI communicator from the file the location ID
+ * is in. If the loc_id is invalid, the fapl_id is used to
+ * retrieve the communicator.
+ *
+ * Return: Success: Non-negative
+ *
+ * Failure: Negative
+ *
+ * Programmer: Mohamad Chaarawi
+ * Feb 14, 2012
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5F_mpi_retrieve_comm(hid_t loc_id, hid_t acspl_id, MPI_Comm *mpi_comm)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ HDassert(mpi_comm);
+ *mpi_comm = MPI_COMM_NULL;
+
+ /* if the loc_id is valid, then get the comm from the file
+ attached to the loc_id */
+ if(H5I_INVALID_HID != loc_id) {
+ H5G_loc_t loc;
+ H5F_t *f = NULL;
+
+ /* retrieve the file structure */
+ if(H5G_loc(loc_id, &loc) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
+ f = loc.oloc->file;
+ HDassert(f);
+
+ /* check if MPIO driver is used */
+ if(H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI)) {
+ /* retrieve the file communicator */
+ if(MPI_COMM_NULL == (*mpi_comm = H5F_mpi_get_comm(f)))
+ HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't get MPI communicator")
+ }
+ }
+ /* otherwise, this if from H5Fopen or H5Fcreate and has to be collective */
+ else {
+ H5P_genplist_t *plist; /* Property list pointer */
+
+ HDassert(H5P_isa_class(acspl_id, H5P_FILE_ACCESS));
+
+ if(NULL == (plist = H5P_object_verify(acspl_id, H5P_FILE_ACCESS)))
+ HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a file access list")
+
+ if(H5FD_MPIO == H5P_peek_driver(plist)) {
+ const H5FD_mpio_fapl_t *fa; /* MPIO fapl info */
+
+ if(NULL == (fa = (const H5FD_mpio_fapl_t *)H5P_peek_driver_info(plist)))
+ HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "bad VFL driver info")
+
+ *mpi_comm = fa->comm;
+ }
+ }
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5F_mpi_retrieve_comm */
+
#endif /* H5_HAVE_PARALLEL */
diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h
index 0cff752..8084b97 100644
--- a/src/H5Fpkg.h
+++ b/src/H5Fpkg.h
@@ -269,7 +269,7 @@ struct H5F_file_t {
hsize_t threshold; /* Threshold for alignment */
hsize_t alignment; /* Alignment */
unsigned gc_ref; /* Garbage-collect references? */
- hbool_t latest_format; /* Always use the latest format? */
+ unsigned latest_flags; /* The latest version support */
hbool_t store_msg_crt_idx; /* Store creation index for object header messages? */
unsigned ncwfs; /* Num entries on cwfs list */
struct H5HG_heap_t **cwfs; /* Global heap cache */
@@ -312,6 +312,10 @@ struct H5F_t {
hbool_t closing; /* File is in the process of being closed */
struct H5F_t *parent; /* Parent file that this file is mounted to */
unsigned nmounts; /* Number of children mounted to this file */
+#ifdef H5_HAVE_PARALLEL
+ H5P_coll_md_read_flag_t coll_md_read; /* Do all metadata reads collectively */
+ hbool_t coll_md_write; /* Do all metadata writes collectively */
+#endif /* H5_HAVE_PARALLEL */
};
/* types for file optional VOL operations */
@@ -366,10 +370,11 @@ H5_DLLVAR const H5AC_class_t H5AC_DRVRINFO[1];
/* General routines */
H5_DLL H5F_t *H5F_reopen(H5F_t *f);
H5_DLL herr_t H5F_flush(H5F_t *f, hid_t dxpl_id, hbool_t closing);
-H5_DLL htri_t H5F_is_hdf5(const char *name, hid_t fapl_id);
+H5_DLL htri_t H5F_is_hdf5(const char *name, hid_t fapl_id, hid_t dxpl_id);
H5_DLL herr_t H5F_get_objects(const H5F_t *f, unsigned types, size_t max_index, hid_t *obj_id_list,
hbool_t app_ref, size_t *obj_id_count_ptr);
H5_DLL int H5F_get_objects_cb(void *obj_ptr, hid_t obj_id, void *key);
+H5_DLL ssize_t H5F_get_file_image(H5F_t *f, void *buf_ptr, size_t buf_len, hid_t dxpl_id);
H5_DLL herr_t H5F_close(H5F_t *f);
/* File mount related routines */
@@ -387,7 +392,7 @@ H5_DLL herr_t H5F__super_free(H5F_super_t *sblock);
/* Superblock extension related routines */
H5_DLL herr_t H5F_super_ext_open(H5F_t *f, haddr_t ext_addr, H5O_loc_t *ext_ptr);
-H5_DLL herr_t H5F_super_ext_write_msg(H5F_t *f, hid_t dxpl_id, void *mesg, unsigned id, hbool_t may_create);
+H5_DLL herr_t H5F_super_ext_write_msg(H5F_t *f, hid_t dxpl_id, unsigned id, void *mesg, hbool_t may_create);
H5_DLL herr_t H5F_super_ext_remove_msg(H5F_t *f, hid_t dxpl_id, unsigned id);
H5_DLL herr_t H5F_super_ext_close(H5F_t *f, H5O_loc_t *ext_ptr, hid_t dxpl_id,
hbool_t was_created);
diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h
index eb4185e..049035a 100644
--- a/src/H5Fprivate.h
+++ b/src/H5Fprivate.h
@@ -27,6 +27,9 @@
#include "H5FDpublic.h" /* File drivers */
/* Private headers needed by this file */
+#ifdef H5_HAVE_PARALLEL
+#include "H5Pprivate.h" /* Property lists */
+#endif /* H5_HAVE_PARALLEL */
#include "H5VMprivate.h" /* Vectors and arrays */
@@ -306,13 +309,16 @@
#define H5F_RDCC_W0(F) ((F)->shared->rdcc_w0)
#define H5F_SIEVE_BUF_SIZE(F) ((F)->shared->sieve_buf_size)
#define H5F_GC_REF(F) ((F)->shared->gc_ref)
-#define H5F_USE_LATEST_FORMAT(F) ((F)->shared->latest_format)
+#define H5F_USE_LATEST_FLAGS(F,FL) ((F)->shared->latest_flags & (FL))
#define H5F_STORE_MSG_CRT_IDX(F) ((F)->shared->store_msg_crt_idx)
#define H5F_SET_STORE_MSG_CRT_IDX(F, FL) ((F)->shared->store_msg_crt_idx = (FL))
#define H5F_GRP_BTREE_SHARED(F) ((F)->shared->grp_btree_shared)
#define H5F_SET_GRP_BTREE_SHARED(F, RC) (((F)->shared->grp_btree_shared = (RC)) ? SUCCEED : FAIL)
#define H5F_USE_TMP_SPACE(F) ((F)->shared->use_tmp_space)
#define H5F_IS_TMP_ADDR(F, ADDR) (H5F_addr_le((F)->shared->tmp_addr, (ADDR)))
+#ifdef H5_HAVE_PARALLEL
+#define H5F_COLL_MD_READ(F) ((F)->coll_md_read)
+#endif /* H5_HAVE_PARALLEL */
#else /* H5F_MODULE */
#define H5F_INTENT(F) (H5F_get_intent(F))
#define H5F_OPEN_NAME(F) (H5F_get_open_name(F))
@@ -348,13 +354,16 @@
#define H5F_RDCC_W0(F) (H5F_rdcc_w0(F))
#define H5F_SIEVE_BUF_SIZE(F) (H5F_sieve_buf_size(F))
#define H5F_GC_REF(F) (H5F_gc_ref(F))
-#define H5F_USE_LATEST_FORMAT(F) (H5F_use_latest_format(F))
+#define H5F_USE_LATEST_FLAGS(F,FL) (H5F_use_latest_flags(F,FL))
#define H5F_STORE_MSG_CRT_IDX(F) (H5F_store_msg_crt_idx(F))
#define H5F_SET_STORE_MSG_CRT_IDX(F, FL) (H5F_set_store_msg_crt_idx((F), (FL)))
#define H5F_GRP_BTREE_SHARED(F) (H5F_grp_btree_shared(F))
#define H5F_SET_GRP_BTREE_SHARED(F, RC) (H5F_set_grp_btree_shared((F), (RC)))
#define H5F_USE_TMP_SPACE(F) (H5F_use_tmp_space(F))
#define H5F_IS_TMP_ADDR(F, ADDR) (H5F_is_tmp_addr((F), (ADDR)))
+#ifdef H5_HAVE_PARALLEL
+#define H5F_COLL_MD_READ(F) (H5F_coll_md_read(F))
+#endif /* H5_HAVE_PARALLEL */
#endif /* H5F_MODULE */
@@ -456,6 +465,7 @@
#define H5F_ACS_FILE_IMAGE_INFO_NAME "file_image_info" /* struct containing initial file image and callback info */
#define H5F_ACS_CORE_WRITE_TRACKING_FLAG_NAME "core_write_tracking_flag" /* Whether or not core VFD backing store write tracking is enabled */
#define H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_NAME "core_write_tracking_page_size" /* The page size in kiB when core VFD write tracking is enabled */
+#define H5F_ACS_COLL_MD_WRITE_FLAG_NAME "collective_metadata_write" /* property indicating whether metadata writes are done collectively or not */
/* ======================== File Mount properties ====================*/
#define H5F_MNT_SYM_LOCAL_NAME "local" /* Whether absolute symlinks local to file. */
@@ -547,6 +557,22 @@
#define H5SM_LIST_MAGIC "SMLI" /* Shared Message List */
+/* Latest format will activate the following latest version support */
+/* "latest_flags" in H5F_file_t */
+#define H5F_LATEST_DATATYPE 0x0001
+#define H5F_LATEST_DATASPACE 0x0002
+#define H5F_LATEST_ATTRIBUTE 0x0004
+#define H5F_LATEST_FILL_MSG 0x0008
+#define H5F_LATEST_PLINE_MSG 0x0010
+#define H5F_LATEST_LAYOUT_MSG 0x0020
+#define H5F_LATEST_NO_MOD_TIME_MSG 0x0040
+#define H5F_LATEST_STYLE_GROUP 0x0080
+#define H5F_LATEST_OBJ_HEADER 0x0100
+#define H5F_LATEST_SUPERBLOCK 0x0200
+#define H5F_LATEST_ALL_FLAGS (H5F_LATEST_DATATYPE | H5F_LATEST_DATASPACE | H5F_LATEST_ATTRIBUTE | H5F_LATEST_FILL_MSG | H5F_LATEST_PLINE_MSG | H5F_LATEST_LAYOUT_MSG | H5F_LATEST_NO_MOD_TIME_MSG | H5F_LATEST_STYLE_GROUP | H5F_LATEST_OBJ_HEADER | H5F_LATEST_SUPERBLOCK)
+
+#define H5F_LATEST_DSET_MSG_FLAGS (H5F_LATEST_FILL_MSG | H5F_LATEST_PLINE_MSG | H5F_LATEST_LAYOUT_MSG)
+
/****************************/
/* Library Private Typedefs */
/****************************/
@@ -607,7 +633,6 @@ H5_DLL unsigned H5F_get_nopen_objs(const H5F_t *f);
H5_DLL unsigned H5F_incr_nopen_objs(H5F_t *f);
H5_DLL unsigned H5F_decr_nopen_objs(H5F_t *f);
H5_DLL hbool_t H5F_file_id_exists(const H5F_t *f);
-H5_DLL ssize_t H5F_get_file_image(H5F_t *f, void *buf_ptr, size_t buf_len);
H5_DLL H5F_t *H5F_get_parent(const H5F_t *f);
H5_DLL unsigned H5F_get_nmounts(const H5F_t *f);
H5_DLL hid_t H5F_get_access_plist(H5F_t *f, hbool_t app_ref);
@@ -635,13 +660,17 @@ H5_DLL size_t H5F_rdcc_nslots(const H5F_t *f);
H5_DLL double H5F_rdcc_w0(const H5F_t *f);
H5_DLL size_t H5F_sieve_buf_size(const H5F_t *f);
H5_DLL unsigned H5F_gc_ref(const H5F_t *f);
-H5_DLL hbool_t H5F_use_latest_format(const H5F_t *f);
+H5_DLL unsigned H5F_use_latest_flags(const H5F_t *f, unsigned fl);
H5_DLL hbool_t H5F_store_msg_crt_idx(const H5F_t *f);
H5_DLL herr_t H5F_set_store_msg_crt_idx(H5F_t *f, hbool_t flag);
H5_DLL struct H5UC_t *H5F_grp_btree_shared(const H5F_t *f);
H5_DLL herr_t H5F_set_grp_btree_shared(H5F_t *f, struct H5UC_t *rc);
H5_DLL hbool_t H5F_use_tmp_space(const H5F_t *f);
H5_DLL hbool_t H5F_is_tmp_addr(const H5F_t *f, haddr_t addr);
+#ifdef H5_HAVE_PARALLEL
+H5_DLL H5P_coll_md_read_flag_t H5F_coll_md_read(const H5F_t *f);
+H5_DLL void H5F_set_coll_md_read(H5F_t *f, H5P_coll_md_read_flag_t flag);
+#endif /* H5_HAVE_PARALLEL */
/* Functions that retrieve values from VFD layer */
H5_DLL hid_t H5F_get_driver_id(const H5F_t *f);
@@ -680,9 +709,11 @@ H5_DLL herr_t H5F_super_dirty(H5F_t *f);
/* Parallel I/O (i.e. MPI) related routines */
#ifdef H5_HAVE_PARALLEL
+H5_DLL herr_t H5F_get_mpi_handle(const H5F_t *f, MPI_File **f_handle);
H5_DLL int H5F_mpi_get_rank(const H5F_t *f);
H5_DLL MPI_Comm H5F_mpi_get_comm(const H5F_t *f);
H5_DLL int H5F_mpi_get_size(const H5F_t *f);
+H5_DLL herr_t H5F_mpi_retrieve_comm(hid_t loc_id, hid_t acspl_id, MPI_Comm *mpi_comm);
#endif /* H5_HAVE_PARALLEL */
/* External file cache routines */
diff --git a/src/H5Fpublic.h b/src/H5Fpublic.h
index f899a50..b5337c6 100644
--- a/src/H5Fpublic.h
+++ b/src/H5Fpublic.h
@@ -32,6 +32,14 @@
#define H5CHECK
#endif /* _H5private_H */
+/* When this header is included from a private HDF5 header, don't make calls to H5open() */
+#undef H5OPEN
+#ifndef _H5private_H
+#define H5OPEN H5open(),
+#else /* _H5private_H */
+#define H5OPEN
+#endif /* _H5private_H */
+
/*
* These are the bits that can be passed to the `flags' argument of
* H5Fcreate() and H5Fopen(). Use the bit-wise OR operator (|) to combine
@@ -40,20 +48,17 @@
* which are compatible with the library to which the application is linked.
* We're assuming that these constants are used rather early in the hdf5
* session.
- *
- * Note that H5F_ACC_DEBUG is deprecated (nonfuncational) but retained as a
- * symbol for backward compatibility.
*/
-#define H5F_ACC_RDONLY (H5CHECK 0x0000u) /*absence of rdwr => rd-only */
-#define H5F_ACC_RDWR (H5CHECK 0x0001u) /*open for read and write */
-#define H5F_ACC_TRUNC (H5CHECK 0x0002u) /*overwrite existing files */
-#define H5F_ACC_EXCL (H5CHECK 0x0004u) /*fail if file already exists*/
+#define H5F_ACC_RDONLY (H5CHECK H5OPEN 0x0000u) /*absence of rdwr => rd-only */
+#define H5F_ACC_RDWR (H5CHECK H5OPEN 0x0001u) /*open for read and write */
+#define H5F_ACC_TRUNC (H5CHECK H5OPEN 0x0002u) /*overwrite existing files */
+#define H5F_ACC_EXCL (H5CHECK H5OPEN 0x0004u) /*fail if file already exists*/
/* NOTE: 0x0008u was H5F_ACC_DEBUG, now deprecated */
-#define H5F_ACC_CREAT (H5CHECK 0x0010u) /*create non-existing files */
+#define H5F_ACC_CREAT (H5CHECK H5OPEN 0x0010u) /*create non-existing files */
/* Value passed to H5Pset_elink_acc_flags to cause flags to be taken from the
* parent file. */
-#define H5F_ACC_DEFAULT (H5CHECK 0xffffu) /*ignore setting on lapl */
+#define H5F_ACC_DEFAULT (H5CHECK H5OPEN 0xffffu) /*ignore setting on lapl */
/* Flags for H5Fget_obj_count() & H5Fget_obj_ids() calls */
#define H5F_OBJ_FILE (0x0001u) /* File objects */
@@ -223,7 +228,7 @@ H5_DLL herr_t H5Fget_mpi_atomicity(hid_t file_id, hbool_t *flag);
#ifndef H5_NO_DEPRECATED_SYMBOLS
/* Macros */
-#define H5F_ACC_DEBUG (H5CHECK 0x0000u) /*print debug info (deprecated)*/
+#define H5F_ACC_DEBUG (H5CHECK H5OPEN 0x0000u) /*print debug info (deprecated)*/
/* Typedefs */
diff --git a/src/H5Fquery.c b/src/H5Fquery.c
index 7490f4b..5dd0d05 100644
--- a/src/H5Fquery.c
+++ b/src/H5Fquery.c
@@ -158,7 +158,7 @@ H5F_get_actual_name(const H5F_t *f)
* Function: H5F_get_extpath
*
* Purpose: Retrieve the file's 'extpath' flags
- * This is used by H5L_extern_traverse() to retrieve the main file's location
+ * This is used by H5L_extern_traverse() and H5D_build_extfile_prefix() to retrieve the main file's location
* when searching the target file.
*
* Return: 'extpath' on success/abort on failure (shouldn't fail)
@@ -779,23 +779,22 @@ H5F_gc_ref(const H5F_t *f)
/*-------------------------------------------------------------------------
- * Function: H5F_use_latest_format
+ * Function: H5F_use_latest_flags
*
- * Purpose: Retrieve the 'use the latest version of the format' flag for
- * the file.
+ * Purpose: Retrieve the 'latest version support' for the file.
*
- * Return: Success: Non-negative, the 'use the latest format' flag
+ * Return: Success: Non-negative, the requested 'version support'
*
* Failure: (can't happen)
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
- * Oct 2 2006
+ * Mar 5 2007
*
*-------------------------------------------------------------------------
*/
-hbool_t
-H5F_use_latest_format(const H5F_t *f)
+unsigned
+H5F_use_latest_flags(const H5F_t *f, unsigned fl)
{
/* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -803,8 +802,8 @@ H5F_use_latest_format(const H5F_t *f)
HDassert(f);
HDassert(f->shared);
- FUNC_LEAVE_NOAPI(f->shared->latest_format)
-} /* end H5F_use_latest_format() */
+ FUNC_LEAVE_NOAPI(f->shared->latest_flags & (fl))
+} /* end H5F_use_latest_flags() */
/*-------------------------------------------------------------------------
@@ -1073,3 +1072,31 @@ H5F_use_tmp_space(const H5F_t *f)
FUNC_LEAVE_NOAPI(f->shared->use_tmp_space)
} /* end H5F_use_tmp_space() */
+#ifdef H5_HAVE_PARALLEL
+
+/*-------------------------------------------------------------------------
+ * Function: H5F_coll_md_read
+ *
+ * Purpose: Retrieve the 'collective metadata reads' flag for the file.
+ *
+ * Return: Success: Non-negative, the 'collective metadata reads' flag
+ * Failure: (can't happen)
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Feb 10 2016
+ *
+ *-------------------------------------------------------------------------
+ */
+H5P_coll_md_read_flag_t
+H5F_coll_md_read(const H5F_t *f)
+{
+ /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+
+ HDassert(f);
+
+ FUNC_LEAVE_NOAPI(f->coll_md_read)
+} /* end H5F_coll_md_read() */
+#endif /* H5_HAVE_PARALLEL */
+
diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c
index a0f9536..4aca221 100644
--- a/src/H5Fsuper.c
+++ b/src/H5Fsuper.c
@@ -115,7 +115,7 @@ H5F_super_ext_create(H5F_t *f, hid_t dxpl_id, H5O_loc_t *ext_ptr)
* extension.
*/
H5O_loc_reset(ext_ptr);
- if(H5O_create(f, dxpl_id, 0, (size_t)1, H5P_GROUP_CREATE_DEFAULT, ext_ptr) < 0)
+ if(H5O_create(f, dxpl_id, (size_t)0, (size_t)1, H5P_GROUP_CREATE_DEFAULT, ext_ptr) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTCREATE, FAIL, "unable to create superblock extension")
/* Record the address of the superblock extension */
@@ -510,8 +510,10 @@ H5F__super_read(H5F_t *f, hid_t dxpl_id)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "driver info message not present")
/* Validate and decode driver information */
- if(H5FD_sb_load(f->shared->lf, drvinfo.name, drvinfo.buf) < 0)
+ if(H5FD_sb_load(f->shared->lf, drvinfo.name, drvinfo.buf) < 0) {
+ H5O_msg_reset(H5O_DRVINFO_ID, &drvinfo);
HGOTO_ERROR(H5E_FILE, H5E_CANTDECODE, FAIL, "unable to decode driver information")
+ } /* end if */
/* Reset driver info message */
H5O_msg_reset(H5O_DRVINFO_ID, &drvinfo);
@@ -620,7 +622,7 @@ H5F__super_read(H5F_t *f, hid_t dxpl_id)
f->shared->sblock = sblock;
#endif /* JRM */
- if(H5F_super_ext_write_msg(f, dxpl_id, &drvinfo, H5O_DRVINFO_ID, FALSE) < 0)
+ if(H5F_super_ext_write_msg(f, dxpl_id, H5O_DRVINFO_ID, &drvinfo, FALSE) < 0)
HGOTO_ERROR(H5E_FILE, H5E_WRITEERROR, FAIL, "error in writing message to superblock extension")
#if 1 /* bug fix test code -- tidy this up if all goes well */ /* JRM */
@@ -742,8 +744,8 @@ H5F__super_init(H5F_t *f, hid_t dxpl_id)
if(H5P_get(plist, H5F_CRT_BTREE_RANK_NAME, &sblock->btree_k[0]) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get rank for btree internal nodes")
- /* Bump superblock version if we are to use the latest version of the format */
- if(f->shared->latest_format)
+ /* Bump superblock version if latest superblock version support is enabled */
+ if(H5F_USE_LATEST_FLAGS(f, H5F_LATEST_SUPERBLOCK))
super_vers = HDF5_SUPERBLOCK_VERSION_LATEST;
/* Bump superblock version to create superblock extension for SOHM info */
else if(f->shared->sohm_nindexes > 0)
@@ -957,7 +959,7 @@ H5F__super_init(H5F_t *f, hid_t dxpl_id)
for(type = H5FD_MEM_SUPER; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, type))
fsinfo.fs_addr[type-1] = HADDR_UNDEF;
- if(H5O_msg_create(&ext_loc, H5O_FSINFO_ID, H5O_MSG_FLAG_DONTSHARE, H5O_UPDATE_TIME, &fsinfo, dxpl_id) < 0)
+ if(H5O_msg_create(&ext_loc, H5O_FSINFO_ID, H5O_MSG_FLAG_DONTSHARE, H5O_UPDATE_TIME, &fsinfo, dxpl_id) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to update free-space info header message")
} /* end if */
} /* end if */
@@ -1195,7 +1197,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5F_super_ext_write_msg(H5F_t *f, hid_t dxpl_id, void *mesg, unsigned id, hbool_t may_create)
+H5F_super_ext_write_msg(H5F_t *f, hid_t dxpl_id, unsigned id, void *mesg, hbool_t may_create)
{
H5P_genplist_t *dxpl = NULL; /* DXPL for setting ring */
H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */
diff --git a/src/H5Fsuper_cache.c b/src/H5Fsuper_cache.c
index c2c7bc9..f445303 100644
--- a/src/H5Fsuper_cache.c
+++ b/src/H5Fsuper_cache.c
@@ -195,7 +195,7 @@ H5F__cache_superblock_deserialize(const void *_image, size_t len, void *_udata,
H5F_super_t *sblock = NULL; /* File's superblock */
H5F_superblock_cache_ud_t *udata = (H5F_superblock_cache_ud_t *)_udata; /* User data */
const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */
- size_t variable_size; /* Sariable size of superblock */
+ size_t variable_size; /* Variable size of superblock */
unsigned super_vers; /* Superblock version */
uint8_t sizeof_addr; /* Size of offsets in the file (in bytes) */
uint8_t sizeof_size; /* Size of lengths in the file (in bytes) */
@@ -625,9 +625,6 @@ H5F__cache_superblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNU
/* (We'll rely on the cache to make sure it actually *is* flushed
last (and collectively in parallel), but this check doesn't hurt) */
HDassert(sblock->cache_info.flush_me_last);
-#ifdef H5_HAVE_PARALLEL
- HDassert(sblock->cache_info.flush_me_collectively);
-#endif
/* Encode the common portion of the file superblock for all versions */
HDmemcpy(image, H5F_SIGNATURE, (size_t)H5F_SIGNATURE_LEN);
diff --git a/src/H5Ftest.c b/src/H5Ftest.c
index 0478523..fbd432d 100644
--- a/src/H5Ftest.c
+++ b/src/H5Ftest.c
@@ -109,7 +109,7 @@ H5F_get_sohm_mesg_count_test(hid_t file_id, unsigned type_id,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file")
/* Retrieve count for message type */
- if(H5SM_get_mesg_count_test(file, H5AC_ind_dxpl_id, type_id, mesg_count) < 0)
+ if(H5SM_get_mesg_count_test(file, H5AC_ind_read_dxpl_id, type_id, mesg_count) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve shared message count")
done:
diff --git a/src/H5G.c b/src/H5G.c
index 0d571a7..5d44a8f 100644
--- a/src/H5G.c
+++ b/src/H5G.c
@@ -292,6 +292,7 @@ H5Gcreate2(hid_t loc_id, const char *name, hid_t lcpl_id, hid_t gcpl_id, hid_t g
H5VL_object_t *obj = NULL; /* object token of loc_id */
H5VL_loc_params_t loc_params;
H5P_genplist_t *plist; /* Property list pointer */
+ hid_t dxpl_id = H5AC_ind_read_dxpl_id; /* dxpl used by library */
hid_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -315,12 +316,9 @@ H5Gcreate2(hid_t loc_id, const char *name, hid_t lcpl_id, hid_t gcpl_id, hid_t g
if(TRUE != H5P_isa_class(gcpl_id, H5P_GROUP_CREATE))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not group create property list")
- /* Check the group access property list */
- if(H5P_DEFAULT == gapl_id)
- gapl_id = H5P_GROUP_ACCESS_DEFAULT;
- else
- if(TRUE != H5P_isa_class(gapl_id, H5P_GROUP_ACCESS))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not group access property list")
+ /* Verify access property list and get correct dxpl */
+ if(H5P_verify_apl_and_dxpl(&gapl_id, H5P_CLS_GACC, &dxpl_id, loc_id, TRUE) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set access and transfer property lists")
/* Get the plist structure */
if(NULL == (plist = (H5P_genplist_t *)H5I_object(gcpl_id)))
@@ -338,7 +336,7 @@ H5Gcreate2(hid_t loc_id, const char *name, hid_t lcpl_id, hid_t gcpl_id, hid_t g
/* Create the group through the VOL */
if(NULL == (grp = H5VL_group_create(obj->vol_obj, loc_params, obj->vol_info->vol_cls, name,
- gcpl_id, gapl_id, H5AC_dxpl_id, H5_REQUEST_NULL)))
+ gcpl_id, gapl_id, dxpl_id, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create group")
/* Get an atom for the group */
@@ -347,7 +345,7 @@ H5Gcreate2(hid_t loc_id, const char *name, hid_t lcpl_id, hid_t gcpl_id, hid_t g
done:
if (ret_value < 0 && grp)
- if(H5VL_group_close (grp, obj->vol_info->vol_cls, H5AC_dxpl_id, H5_REQUEST_NULL) < 0)
+ if(H5VL_group_close (grp, obj->vol_info->vol_cls, dxpl_id, H5_REQUEST_NULL) < 0)
HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "unable to release group")
FUNC_LEAVE_API(ret_value)
} /* end H5Gcreate2() */
@@ -394,6 +392,7 @@ H5Gcreate_anon(hid_t loc_id, hid_t gcpl_id, hid_t gapl_id)
void *grp = NULL; /* group token from VOL plugin */
H5VL_object_t *obj = NULL; /* object token of loc_id */
H5VL_loc_params_t loc_params;
+ hid_t dxpl_id = H5AC_ind_read_dxpl_id; /* dxpl used by library */
hid_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -406,12 +405,9 @@ H5Gcreate_anon(hid_t loc_id, hid_t gcpl_id, hid_t gapl_id)
if(TRUE != H5P_isa_class(gcpl_id, H5P_GROUP_CREATE))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not group create property list")
- /* Check the group access property list */
- if(H5P_DEFAULT == gapl_id)
- gapl_id = H5P_GROUP_ACCESS_DEFAULT;
- else
- if(TRUE != H5P_isa_class(gapl_id, H5P_GROUP_ACCESS))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not group access property list")
+ /* Verify access property list and get correct dxpl */
+ if(H5P_verify_apl_and_dxpl(&gapl_id, H5P_CLS_GACC, &dxpl_id, loc_id, TRUE) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set access and transfer property lists")
loc_params.type = H5VL_OBJECT_BY_SELF;
loc_params.obj_type = H5I_get_type(loc_id);
@@ -422,7 +418,7 @@ H5Gcreate_anon(hid_t loc_id, hid_t gcpl_id, hid_t gapl_id)
/* Create the group through the VOL */
if(NULL == (grp = H5VL_group_create(obj->vol_obj, loc_params, obj->vol_info->vol_cls, NULL,
- gcpl_id, gapl_id, H5AC_dxpl_id, H5_REQUEST_NULL)))
+ gcpl_id, gapl_id, dxpl_id, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create group")
/* Get an atom for the group */
@@ -431,7 +427,7 @@ H5Gcreate_anon(hid_t loc_id, hid_t gcpl_id, hid_t gapl_id)
done:
if (ret_value < 0 && grp)
- if(H5VL_group_close (grp, obj->vol_info->vol_cls, H5AC_dxpl_id, H5_REQUEST_NULL) < 0)
+ if(H5VL_group_close (grp, obj->vol_info->vol_cls, dxpl_id, H5_REQUEST_NULL) < 0)
HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "unable to release group")
FUNC_LEAVE_API(ret_value)
} /* end H5Gcreate_anon() */
@@ -460,6 +456,7 @@ H5Gopen2(hid_t loc_id, const char *name, hid_t gapl_id)
void *grp = NULL; /* group token from VOL plugin */
H5VL_object_t *obj = NULL; /* object token of loc_id */
H5VL_loc_params_t loc_params;
+ hid_t dxpl_id = H5AC_ind_read_dxpl_id; /* dxpl used by library */
hid_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -469,12 +466,9 @@ H5Gopen2(hid_t loc_id, const char *name, hid_t gapl_id)
if(!name || !*name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name")
- /* Check the group access property list */
- if(H5P_DEFAULT == gapl_id)
- gapl_id = H5P_GROUP_ACCESS_DEFAULT;
- else
- if(TRUE != H5P_isa_class(gapl_id, H5P_GROUP_ACCESS))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not group access property list")
+ /* Verify access property list and get correct dxpl */
+ if(H5P_verify_apl_and_dxpl(&gapl_id, H5P_CLS_GACC, &dxpl_id, loc_id, FALSE) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set access and transfer property lists")
loc_params.type = H5VL_OBJECT_BY_SELF;
loc_params.obj_type = H5I_get_type(loc_id);
@@ -485,7 +479,7 @@ H5Gopen2(hid_t loc_id, const char *name, hid_t gapl_id)
/* Create the group through the VOL */
if(NULL == (grp = H5VL_group_open(obj->vol_obj, loc_params, obj->vol_info->vol_cls,
- name, gapl_id, H5AC_ind_dxpl_id, H5_REQUEST_NULL)))
+ name, gapl_id, dxpl_id, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open group")
/* Get an atom for the group */
@@ -494,7 +488,7 @@ H5Gopen2(hid_t loc_id, const char *name, hid_t gapl_id)
done:
if (ret_value < 0 && grp)
- if(H5VL_group_close (grp, obj->vol_info->vol_cls, H5AC_ind_dxpl_id, H5_REQUEST_NULL) < 0)
+ if(H5VL_group_close (grp, obj->vol_info->vol_cls, dxpl_id, H5_REQUEST_NULL) < 0)
HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "unable to release group")
FUNC_LEAVE_API(ret_value)
} /* end H5Gopen2() */
@@ -530,7 +524,7 @@ H5Gget_create_plist(hid_t grp_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group")
if(H5VL_group_get(grp->vol_obj, grp->vol_info->vol_cls, H5VL_GROUP_GET_GCPL,
- H5AC_dxpl_id, H5_REQUEST_NULL, &ret_value) < 0)
+ H5AC_ind_read_dxpl_id, H5_REQUEST_NULL, &ret_value) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get group creation properties")
done:
@@ -578,7 +572,7 @@ H5Gget_info(hid_t loc_id, H5G_info_t *grp_info)
/* Get the group info through the VOL using the location token */
if((ret_value = H5VL_group_get(obj->vol_obj, obj->vol_info->vol_cls, H5VL_GROUP_GET_INFO,
- H5AC_ind_dxpl_id, H5_REQUEST_NULL, loc_params, grp_info)) < 0)
+ H5AC_ind_read_dxpl_id, H5_REQUEST_NULL, loc_params, grp_info)) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get group info")
done:
@@ -605,6 +599,7 @@ H5Gget_info_by_name(hid_t loc_id, const char *name, H5G_info_t *grp_info,
{
H5VL_object_t *obj;
H5VL_loc_params_t loc_params;
+ hid_t dxpl_id = H5AC_ind_read_dxpl_id; /* dxpl used by library */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -615,11 +610,10 @@ H5Gget_info_by_name(hid_t loc_id, const char *name, H5G_info_t *grp_info,
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name")
if(!grp_info)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct")
- if(H5P_DEFAULT == lapl_id)
- lapl_id = H5P_LINK_ACCESS_DEFAULT;
- else
- if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID")
+
+ /* Verify access property list and get correct dxpl */
+ if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, loc_id, FALSE) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set access and transfer property lists")
loc_params.type = H5VL_OBJECT_BY_NAME;
loc_params.loc_data.loc_by_name.name = name;
@@ -632,7 +626,7 @@ H5Gget_info_by_name(hid_t loc_id, const char *name, H5G_info_t *grp_info,
/* Get the group info through the VOL using the location token */
if((ret_value = H5VL_group_get(obj->vol_obj, obj->vol_info->vol_cls, H5VL_GROUP_GET_INFO,
- H5AC_ind_dxpl_id, H5_REQUEST_NULL, loc_params, grp_info)) < 0)
+ dxpl_id, H5_REQUEST_NULL, loc_params, grp_info)) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get group info")
done:
@@ -660,6 +654,7 @@ H5Gget_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type,
{
H5VL_object_t *obj;
H5VL_loc_params_t loc_params;
+ hid_t dxpl_id = H5AC_ind_read_dxpl_id; /* dxpl used by library */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -675,11 +670,10 @@ H5Gget_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type,
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
if(!grp_info)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct")
- if(H5P_DEFAULT == lapl_id)
- lapl_id = H5P_LINK_ACCESS_DEFAULT;
- else
- if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID")
+
+ /* Verify access property list and get correct dxpl */
+ if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, loc_id, FALSE) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set access and transfer property lists")
loc_params.type = H5VL_OBJECT_BY_IDX;
loc_params.loc_data.loc_by_idx.name = group_name;
@@ -694,9 +688,8 @@ H5Gget_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* Get the group info through the VOL using the location token */
- if((ret_value = H5VL_group_get(obj->vol_obj, obj->vol_info->vol_cls,
- H5VL_GROUP_GET_INFO, H5AC_ind_dxpl_id,
- H5_REQUEST_NULL, loc_params, grp_info)) < 0)
+ if((ret_value = H5VL_group_get(obj->vol_obj, obj->vol_info->vol_cls, H5VL_GROUP_GET_INFO,
+ dxpl_id, H5_REQUEST_NULL, loc_params, grp_info)) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get group info")
done:
@@ -765,7 +758,7 @@ H5G_close_group(void *_grp)
/* Close the group through the VOL*/
if((ret_value = H5VL_group_close(grp->vol_obj, grp->vol_info->vol_cls,
- H5AC_dxpl_id, H5_REQUEST_NULL)) < 0)
+ H5AC_ind_read_dxpl_id, H5_REQUEST_NULL)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "unable to close group")
/* free group */
diff --git a/src/H5Gbtree2.c b/src/H5Gbtree2.c
index b464930..ff7e200 100644
--- a/src/H5Gbtree2.c
+++ b/src/H5Gbtree2.c
@@ -78,7 +78,7 @@ typedef struct H5G_fh_ud_cmp_t {
/* v2 B-tree driver callbacks for 'creation order' index */
static herr_t H5G_dense_btree2_corder_store(void *native, const void *udata);
-static herr_t H5G_dense_btree2_corder_compare(const void *rec1, const void *rec2);
+static herr_t H5G_dense_btree2_corder_compare(const void *rec1, const void *rec2, int *result);
static herr_t H5G_dense_btree2_corder_encode(uint8_t *raw, const void *native,
void *ctx);
static herr_t H5G_dense_btree2_corder_decode(const uint8_t *raw, void *native,
@@ -88,7 +88,7 @@ static herr_t H5G_dense_btree2_corder_debug(FILE *stream, int indent, int fwidth
/* v2 B-tree driver callbacks for 'name' index */
static herr_t H5G_dense_btree2_name_store(void *native, const void *udata);
-static herr_t H5G_dense_btree2_name_compare(const void *rec1, const void *rec2);
+static herr_t H5G__dense_btree2_name_compare(const void *rec1, const void *rec2, int *result);
static herr_t H5G_dense_btree2_name_encode(uint8_t *raw, const void *native,
void *ctx);
static herr_t H5G_dense_btree2_name_decode(const uint8_t *raw, void *native,
@@ -111,12 +111,10 @@ const H5B2_class_t H5G_BT2_NAME[1]={{ /* B-tree class information */
NULL, /* Create client callback context */
NULL, /* Destroy client callback context */
H5G_dense_btree2_name_store, /* Record storage callback */
- H5G_dense_btree2_name_compare, /* Record comparison callback */
+ H5G__dense_btree2_name_compare, /* Record comparison callback */
H5G_dense_btree2_name_encode, /* Record encoding callback */
H5G_dense_btree2_name_decode, /* Record decoding callback */
- H5G_dense_btree2_name_debug, /* Record debugging callback */
- NULL, /* Create debugging context */
- NULL /* Destroy debugging context */
+ H5G_dense_btree2_name_debug /* Record debugging callback */
}};
/* v2 B-tree class for indexing 'creation order' field of links */
@@ -130,9 +128,7 @@ const H5B2_class_t H5G_BT2_CORDER[1]={{ /* B-tree class information */
H5G_dense_btree2_corder_compare, /* Record comparison callback */
H5G_dense_btree2_corder_encode, /* Record encoding callback */
H5G_dense_btree2_corder_decode, /* Record decoding callback */
- H5G_dense_btree2_corder_debug, /* Record debugging callback */
- NULL, /* Create debugging context */
- NULL /* Destroy debugging context */
+ H5G_dense_btree2_corder_debug /* Record debugging callback */
}};
/*****************************/
@@ -220,7 +216,7 @@ H5G_dense_btree2_name_store(void *_nrecord, const void *_udata)
/*-------------------------------------------------------------------------
- * Function: H5G_dense_btree2_name_compare
+ * Function: H5G__dense_btree2_name_compare
*
* Purpose: Compare two native information records, according to some key
*
@@ -234,13 +230,13 @@ H5G_dense_btree2_name_store(void *_nrecord, const void *_udata)
*-------------------------------------------------------------------------
*/
static herr_t
-H5G_dense_btree2_name_compare(const void *_bt2_udata, const void *_bt2_rec)
+H5G__dense_btree2_name_compare(const void *_bt2_udata, const void *_bt2_rec, int *result)
{
const H5G_bt2_ud_common_t *bt2_udata = (const H5G_bt2_ud_common_t *)_bt2_udata;
const H5G_dense_bt2_name_rec_t *bt2_rec = (const H5G_dense_bt2_name_rec_t *)_bt2_rec;
- herr_t ret_value = FAIL; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC
/* Sanity check */
HDassert(bt2_udata);
@@ -250,20 +246,19 @@ H5G_dense_btree2_name_compare(const void *_bt2_udata, const void *_bt2_rec)
{
unsigned u;
-HDfprintf(stderr, "%s: bt2_udata = {'%s', %x}\n", "H5G_dense_btree2_name_compare", bt2_udata->name, (unsigned)bt2_udata->name_hash);
-HDfprintf(stderr, "%s: bt2_rec = {%x, ", "H5G_dense_btree2_name_compare", (unsigned)bt2_rec->hash);
+HDfprintf(stderr, "%s: bt2_udata = {'%s', %x}\n", "H5G__dense_btree2_name_compare", bt2_udata->name, (unsigned)bt2_udata->name_hash);
+HDfprintf(stderr, "%s: bt2_rec = {%x, ", "H5G__dense_btree2_name_compare", (unsigned)bt2_rec->hash);
for(u = 0; u < H5G_DENSE_FHEAP_ID_LEN; u++)
HDfprintf(stderr, "%02x%s", bt2_rec->id[u], (u < (H5G_DENSE_FHEAP_ID_LEN - 1) ? " " : "}\n"));
}
#endif /* QAK */
/* Check hash value */
if(bt2_udata->name_hash < bt2_rec->hash)
- ret_value = (-1);
+ *result = (-1);
else if(bt2_udata->name_hash > bt2_rec->hash)
- ret_value = 1;
+ *result = 1;
else {
H5G_fh_ud_cmp_t fh_udata; /* User data for fractal heap 'op' callback */
- herr_t status; /* Status from fractal heap 'op' routine */
/* Sanity check */
HDassert(bt2_udata->name_hash == bt2_rec->hash);
@@ -280,16 +275,17 @@ for(u = 0; u < H5G_DENSE_FHEAP_ID_LEN; u++)
fh_udata.cmp = 0;
/* Check if the user's link and the B-tree's link have the same name */
- status = H5HF_op(bt2_udata->fheap, bt2_udata->dxpl_id, bt2_rec->id,
- H5G_dense_fh_name_cmp, &fh_udata);
- HDassert(status >= 0);
+ if(H5HF_op(bt2_udata->fheap, bt2_udata->dxpl_id, bt2_rec->id,
+ H5G_dense_fh_name_cmp, &fh_udata) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records")
/* Callback will set comparison value */
- ret_value = fh_udata.cmp;
+ *result = fh_udata.cmp;
} /* end else */
+done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5G_dense_btree2_name_compare() */
+} /* H5G__dense_btree2_name_compare() */
/*-------------------------------------------------------------------------
@@ -423,11 +419,10 @@ H5G_dense_btree2_corder_store(void *_nrecord, const void *_udata)
*-------------------------------------------------------------------------
*/
static herr_t
-H5G_dense_btree2_corder_compare(const void *_bt2_udata, const void *_bt2_rec)
+H5G_dense_btree2_corder_compare(const void *_bt2_udata, const void *_bt2_rec, int *result)
{
const H5G_bt2_ud_common_t *bt2_udata = (const H5G_bt2_ud_common_t *)_bt2_udata;
const H5G_dense_bt2_corder_rec_t *bt2_rec = (const H5G_dense_bt2_corder_rec_t *)_bt2_rec;
- herr_t ret_value = FAIL; /* Return value */
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -447,13 +442,13 @@ for(u = 0; u < H5G_DENSE_FHEAP_ID_LEN; u++)
#endif /* QAK */
/* Check creation order value */
if(bt2_udata->corder < bt2_rec->corder)
- ret_value = -1;
+ *result = -1;
else if(bt2_udata->corder > bt2_rec->corder)
- ret_value = 1;
+ *result = 1;
else
- ret_value = 0;
+ *result = 0;
- FUNC_LEAVE_NOAPI(ret_value)
+ FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5G_dense_btree2_corder_compare() */
diff --git a/src/H5Gcache.c b/src/H5Gcache.c
index e7d44b5..e3303d1 100644
--- a/src/H5Gcache.c
+++ b/src/H5Gcache.c
@@ -316,10 +316,8 @@ H5G__cache_node_serialize(const H5F_t *f, void *_image, size_t len,
if(H5G__ent_encode_vec(f, &image, sym->entry, sym->nsyms) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTENCODE, FAIL, "can't serialize")
-#ifdef H5_CLEAR_MEMORY
/* Clear rest of symbol table node */
HDmemset(image, 0, len - (size_t)(image - (uint8_t *)_image));
-#endif /* H5_CLEAR_MEMORY */
done:
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5Gdeprec.c b/src/H5Gdeprec.c
index 63e5a23..16e8c05 100644
--- a/src/H5Gdeprec.c
+++ b/src/H5Gdeprec.c
@@ -234,7 +234,7 @@ H5Gcreate1(hid_t loc_id, const char *name, size_t size_hint)
/* Create the group through the VOL */
if(NULL == (grp = H5VL_group_create(obj->vol_obj, loc_params, obj->vol_info->vol_cls, name, tmp_gcpl,
- H5P_GROUP_ACCESS_DEFAULT, H5AC_dxpl_id, H5_REQUEST_NULL)))
+ H5P_GROUP_ACCESS_DEFAULT, H5AC_ind_read_dxpl_id, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create group")
/* Get an atom for the group */
@@ -246,7 +246,7 @@ done:
if(H5I_dec_ref(tmp_gcpl) < 0)
HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "unable to release property list")
if (ret_value < 0 && grp)
- if(H5VL_group_close (grp, obj->vol_info->vol_cls, H5AC_dxpl_id, H5_REQUEST_NULL) < 0)
+ if(H5VL_group_close (grp, obj->vol_info->vol_cls, H5AC_ind_read_dxpl_id, H5_REQUEST_NULL) < 0)
HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "unable to release group")
FUNC_LEAVE_API(ret_value)
@@ -294,7 +294,7 @@ H5Gopen1(hid_t loc_id, const char *name)
/* Create the group through the VOL */
if(NULL == (grp = H5VL_group_open(obj->vol_obj, loc_params, obj->vol_info->vol_cls, name, H5P_DEFAULT,
- H5AC_ind_dxpl_id, H5_REQUEST_NULL)))
+ H5AC_ind_read_dxpl_id, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create group")
/* Get an atom for the group */
@@ -303,7 +303,7 @@ H5Gopen1(hid_t loc_id, const char *name)
done:
if (ret_value < 0 && grp)
- if(H5VL_group_close (grp, obj->vol_info->vol_cls, H5AC_ind_dxpl_id, H5_REQUEST_NULL) < 0)
+ if(H5VL_group_close (grp, obj->vol_info->vol_cls, H5AC_ind_read_dxpl_id, H5_REQUEST_NULL) < 0)
HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "unable to release group")
FUNC_LEAVE_API(ret_value)
} /* end H5Gopen1() */
@@ -363,7 +363,7 @@ H5Glink(hid_t cur_loc_id, H5G_link_t type, const char *cur_name, const char *new
/* Create the link through the VOL */
if((ret_value = H5VL_link_create(H5VL_LINK_CREATE_HARD, NULL, loc_params2, obj->vol_info->vol_cls,
- lcpl_id, H5P_DEFAULT, H5AC_dxpl_id, H5_REQUEST_NULL)) < 0)
+ lcpl_id, H5P_DEFAULT, H5AC_ind_read_dxpl_id, H5_REQUEST_NULL)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link")
} /* end if */
else if(type == H5L_TYPE_SOFT) {
@@ -385,7 +385,7 @@ H5Glink(hid_t cur_loc_id, H5G_link_t type, const char *cur_name, const char *new
/* Create the link through the VOL */
if((ret_value = H5VL_link_create(H5VL_LINK_CREATE_SOFT, obj->vol_obj, loc_params, obj->vol_info->vol_cls,
- lcpl_id, H5P_DEFAULT, H5AC_dxpl_id, H5_REQUEST_NULL)) < 0)
+ lcpl_id, H5P_DEFAULT, H5AC_ind_read_dxpl_id, H5_REQUEST_NULL)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link")
} /* end else if */
else
@@ -455,7 +455,7 @@ H5Glink2(hid_t cur_loc_id, const char *cur_name, H5G_link_t type,
/* Create the link through the VOL */
if((ret_value = H5VL_link_create(H5VL_LINK_CREATE_HARD, obj2->vol_obj, loc_params2, obj2->vol_info->vol_cls,
- lcpl_id, H5P_DEFAULT, H5AC_dxpl_id, H5_REQUEST_NULL)) < 0)
+ lcpl_id, H5P_DEFAULT, H5AC_ind_read_dxpl_id, H5_REQUEST_NULL)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link")
} /* end if */
else if(type == H5L_TYPE_SOFT) {
@@ -482,7 +482,7 @@ H5Glink2(hid_t cur_loc_id, const char *cur_name, H5G_link_t type,
/* Create the link through the VOL */
if((ret_value = H5VL_link_create(H5VL_LINK_CREATE_SOFT, obj->vol_obj, loc_params, obj->vol_info->vol_cls,
- lcpl_id, H5P_DEFAULT, H5AC_dxpl_id, H5_REQUEST_NULL)) < 0)
+ lcpl_id, H5P_DEFAULT, H5AC_ind_read_dxpl_id, H5_REQUEST_NULL)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link")
} /* end else if */
else
@@ -494,6 +494,60 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5G_link_hard
+ *
+ * Purpose: Creates a hard link from NEW_NAME to CUR_NAME.
+ *
+ * CUR_NAME must name an existing object. CUR_NAME and
+ * NEW_NAME are interpreted relative to CUR_LOC_ID and
+ * NEW_LOC_ID, which are either file IDs or group IDs.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Monday, November 6, 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5G_link_hard(hid_t cur_loc_id, const char *cur_name, hid_t new_loc_id,
+ const char *new_name)
+{
+ H5G_loc_t cur_loc, *cur_loc_p; /* Information about current link's group */
+ H5G_loc_t new_loc, *new_loc_p; /* Information about new link's group */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+ /* Finish checking arguments */
+ if(cur_loc_id == H5L_SAME_LOC && new_loc_id == H5L_SAME_LOC)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "source and destination should not be both H5L_SAME_LOC")
+ if(cur_loc_id != H5L_SAME_LOC && H5G_loc(cur_loc_id, &cur_loc) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
+ if(new_loc_id != H5L_SAME_LOC && H5G_loc(new_loc_id, &new_loc) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
+
+ /* Set up current & new location pointers */
+ cur_loc_p = &cur_loc;
+ new_loc_p = &new_loc;
+ if(cur_loc_id == H5L_SAME_LOC)
+ cur_loc_p = new_loc_p;
+ else if(new_loc_id == H5L_SAME_LOC)
+ new_loc_p = cur_loc_p;
+ else if(cur_loc_p->oloc->file != new_loc_p->oloc->file)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "source and destination should be in the same file.")
+
+ /* Create the link */
+ if(H5L_create_hard(cur_loc_p, cur_name, new_loc_p, new_name,
+ H5P_DEFAULT, H5P_DEFAULT, H5AC_ind_read_dxpl_id) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5G_link_hard() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5Gmove
*
* Purpose: Moves and renames a link. The new API to do this is H5Lmove.
@@ -526,7 +580,7 @@ H5Gmove(hid_t src_loc_id, const char *src_name, const char *dst_name)
/* Create the link through the VOL */
if((ret_value = H5VL_link_move(obj->vol_obj, loc_params1, NULL, loc_params2, obj->vol_info->vol_cls,
- H5P_DEFAULT, H5P_DEFAULT, H5AC_dxpl_id, H5_REQUEST_NULL)) < 0)
+ H5P_DEFAULT, H5P_DEFAULT, H5AC_ind_read_dxpl_id, H5_REQUEST_NULL)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link")
done:
@@ -578,8 +632,8 @@ H5Gmove2(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id,
/* Move the link through the VOL */
if((ret_value = H5VL_link_move(obj1->vol_obj, loc_params1, obj2->vol_obj, loc_params2,
- obj1->vol_info->vol_cls,
- H5P_DEFAULT, H5P_DEFAULT, H5AC_dxpl_id, H5_REQUEST_NULL)) < 0)
+ obj1->vol_info->vol_cls, H5P_DEFAULT, H5P_DEFAULT,
+ H5AC_ind_read_dxpl_id, H5_REQUEST_NULL)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link")
done:
@@ -588,6 +642,63 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5G_move
+ *
+ * Purpose: Renames an object within an HDF5 file and moves it to a new
+ * group. The original name SRC is unlinked from the group graph
+ * and then inserted with the new name DST (which can specify a
+ * new path for the object) as an atomic operation. The names
+ * are interpreted relative to SRC_LOC_ID and
+ * DST_LOC_ID, which are either file IDs or group ID.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Monday, November 6, 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5G_move(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id,
+ const char *dst_name)
+{
+ H5G_loc_t src_loc, *src_loc_p; /* Group info for source location */
+ H5G_loc_t dst_loc, *dst_loc_p; /* Group info for destination location */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+ /* Check arguments */
+ if(src_loc_id == H5L_SAME_LOC && dst_loc_id == H5L_SAME_LOC)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "source and destination should not both be H5L_SAME_LOC")
+ if(src_loc_id != H5L_SAME_LOC && H5G_loc(src_loc_id, &src_loc) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
+ if(dst_loc_id != H5L_SAME_LOC && H5G_loc(dst_loc_id, &dst_loc) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
+ if(!src_name || !*src_name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no current name specified")
+ if(!dst_name || !*dst_name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no destination name specified")
+
+ /* Set up src & dst location pointers */
+ src_loc_p = &src_loc;
+ dst_loc_p = &dst_loc;
+ if(src_loc_id == H5L_SAME_LOC)
+ src_loc_p = dst_loc_p;
+ else if(dst_loc_id == H5L_SAME_LOC)
+ dst_loc_p = src_loc_p;
+
+ /* Move the link */
+ if(H5L_move(src_loc_p, src_name, dst_loc_p, dst_name, FALSE, H5P_DEFAULT,
+ H5P_DEFAULT, H5AC_ind_read_dxpl_id) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTMOVE, FAIL, "unable to move link")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5G_move() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5Gunlink
*
* Purpose: Removes a link. The new API is H5Ldelete/H5Ldelete_by_idx.
@@ -618,7 +729,7 @@ H5Gunlink(hid_t loc_id, const char *name)
/* Delete the link through the VOL */
if(H5VL_link_specific(obj->vol_obj, loc_params, obj->vol_info->vol_cls, H5VL_LINK_DELETE,
- H5AC_dxpl_id, H5_REQUEST_NULL) < 0)
+ H5AC_ind_read_dxpl_id, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete link")
done:
@@ -659,7 +770,7 @@ H5Gget_linkval(hid_t loc_id, const char *name, size_t size, char *buf/*out*/)
/* Get the link info through the VOL */
if((ret_value = H5VL_link_get(obj->vol_obj, loc_params, obj->vol_info->vol_cls, H5VL_LINK_GET_VAL,
- H5AC_ind_dxpl_id, H5_REQUEST_NULL, buf, size)) < 0)
+ H5AC_ind_read_dxpl_id, H5_REQUEST_NULL, buf, size)) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get link value")
done:
@@ -698,7 +809,7 @@ H5Gset_comment(hid_t loc_id, const char *name, const char *comment)
if(!name || !*name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified")
- if(H5G_loc_set_comment(&loc, name, comment, H5P_DEFAULT, H5AC_dxpl_id) < 0)
+ if(H5G_loc_set_comment(&loc, name, comment, H5P_DEFAULT, H5AC_ind_read_dxpl_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to set comment value")
done:
@@ -745,7 +856,7 @@ H5Gget_comment(hid_t loc_id, const char *name, size_t bufsize, char *buf)
if(bufsize > 0 && !buf)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no buffer specified")
- if((ret_value = (int)H5G_loc_get_comment(&loc, name, buf, bufsize, H5P_DEFAULT, H5AC_ind_dxpl_id)) < 0)
+ if((ret_value = (int)H5G_loc_get_comment(&loc, name, buf, bufsize, H5P_DEFAULT, H5AC_ind_read_dxpl_id)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to get comment value")
done:
@@ -812,7 +923,7 @@ H5Giterate(hid_t loc_id, const char *name, int *idx_p, H5G_iterate_t op,
lnk_op.op_func.op_old = op;
/* Call private function. */
- if((ret_value = H5G_iterate(&loc, name, H5_INDEX_NAME, H5_ITER_INC, idx, &last_obj, &lnk_op, op_data, H5P_DEFAULT, H5AC_ind_dxpl_id)) < 0)
+ if((ret_value = H5G_iterate(&loc, name, H5_INDEX_NAME, H5_ITER_INC, idx, &last_obj, &lnk_op, op_data, H5P_DEFAULT, H5AC_ind_read_dxpl_id)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "group iteration failed")
/* Set the index we stopped at */
@@ -854,7 +965,7 @@ H5Gget_num_objs(hid_t loc_id, hsize_t *num_objs)
/* Check args */
if(H5G_loc(loc_id, &loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location ID")
- if(H5O_obj_type(loc.oloc, &obj_type, H5AC_ind_dxpl_id) < 0)
+ if(H5O_obj_type(loc.oloc, &obj_type, H5AC_ind_read_dxpl_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get object type")
if(obj_type != H5O_TYPE_GROUP)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group")
@@ -862,7 +973,7 @@ H5Gget_num_objs(hid_t loc_id, hsize_t *num_objs)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bad pointer to # of objects")
/* Retrieve information about the group */
- if(H5G__obj_info(loc.oloc, &grp_info, H5AC_ind_dxpl_id) < 0)
+ if(H5G__obj_info(loc.oloc, &grp_info, H5AC_ind_read_dxpl_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTCOUNT, FAIL, "can't determine")
/* Set the number of objects [sic: links] in the group */
@@ -907,7 +1018,7 @@ H5Gget_objinfo(hid_t loc_id, const char *name, hbool_t follow_link,
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified")
/* Get info */
- if(H5G_get_objinfo(&loc, name, follow_link, statbuf, H5AC_ind_dxpl_id) < 0)
+ if(H5G_get_objinfo(&loc, name, follow_link, statbuf, H5AC_ind_read_dxpl_id) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, FAIL, "cannot stat object")
done:
@@ -1100,14 +1211,14 @@ H5Gget_objname_by_idx(hid_t loc_id, hsize_t idx, char *name, size_t size)
/* Check args */
if(H5G_loc(loc_id, &loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location ID")
- if(H5O_obj_type(loc.oloc, &obj_type, H5AC_ind_dxpl_id) < 0)
+ if(H5O_obj_type(loc.oloc, &obj_type, H5AC_ind_read_dxpl_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get object type")
if(obj_type != H5O_TYPE_GROUP)
HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "not a group")
/* Call internal function */
if((ret_value = H5G_obj_get_name_by_idx(loc.oloc, H5_INDEX_NAME, H5_ITER_INC,
- idx, name, size, H5AC_ind_dxpl_id)) < 0)
+ idx, name, size, H5AC_ind_read_dxpl_id)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "can't get object name")
done:
@@ -1143,13 +1254,13 @@ H5Gget_objtype_by_idx(hid_t loc_id, hsize_t idx)
/* Check args */
if(H5G_loc(loc_id, &loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5G_UNKNOWN, "not a location ID")
- if(H5O_obj_type(loc.oloc, &obj_type, H5AC_ind_dxpl_id) < 0)
+ if(H5O_obj_type(loc.oloc, &obj_type, H5AC_ind_read_dxpl_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5G_UNKNOWN, "can't get object type")
if(obj_type != H5O_TYPE_GROUP)
HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, H5G_UNKNOWN, "not a group")
/* Call internal function*/
- if((ret_value = H5G_obj_get_type_by_idx(loc.oloc, idx, H5AC_ind_dxpl_id)) == H5G_UNKNOWN)
+ if((ret_value = H5G_obj_get_type_by_idx(loc.oloc, idx, H5AC_ind_read_dxpl_id)) == H5G_UNKNOWN)
HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, H5G_UNKNOWN, "can't get object type")
done:
diff --git a/src/H5Gint.c b/src/H5Gint.c
index 5cdf8fa..e58af79 100644
--- a/src/H5Gint.c
+++ b/src/H5Gint.c
@@ -489,7 +489,7 @@ H5G_close(H5G_t *grp)
/* Remove the group from the list of opened objects in the file */
if(H5FO_top_decr(grp->oloc.file, grp->oloc.addr) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "can't decrement count for object")
- if(H5FO_delete(grp->oloc.file, H5AC_dxpl_id, grp->oloc.addr) < 0)
+ if(H5FO_delete(grp->oloc.file, H5AC_ind_read_dxpl_id, grp->oloc.addr) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "can't remove group from list of open objects")
if(H5O_close(&(grp->oloc)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to close")
@@ -1193,17 +1193,17 @@ H5G_get_create_plist(H5G_t *grp)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get property list")
/* Retrieve any object creation properties */
- if(H5O_get_create_plist(&grp->oloc, H5AC_ind_dxpl_id, new_plist) < 0)
+ if(H5O_get_create_plist(&grp->oloc, H5AC_ind_read_dxpl_id, new_plist) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get object creation info")
/* Check for the group having a group info message */
- if((ginfo_exists = H5O_msg_exists(&(grp->oloc), H5O_GINFO_ID, H5AC_ind_dxpl_id)) < 0)
+ if((ginfo_exists = H5O_msg_exists(&(grp->oloc), H5O_GINFO_ID, H5AC_ind_read_dxpl_id)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header")
if(ginfo_exists) {
H5O_ginfo_t ginfo; /* Group info message */
/* Read the group info */
- if(NULL == H5O_msg_read(&(grp->oloc), H5O_GINFO_ID, &ginfo, H5AC_ind_dxpl_id))
+ if(NULL == H5O_msg_read(&(grp->oloc), H5O_GINFO_ID, &ginfo, H5AC_ind_read_dxpl_id))
HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "can't get group info")
/* Set the group info for the property list */
@@ -1212,7 +1212,7 @@ H5G_get_create_plist(H5G_t *grp)
} /* end if */
/* Check for the group having a link info message */
- if((linfo_exists = H5G__obj_get_linfo(&(grp->oloc), &linfo, H5AC_ind_dxpl_id)) < 0)
+ if((linfo_exists = H5G__obj_get_linfo(&(grp->oloc), &linfo, H5AC_ind_read_dxpl_id)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header")
if(linfo_exists) {
/* Set the link info for the property list */
@@ -1221,13 +1221,13 @@ H5G_get_create_plist(H5G_t *grp)
} /* end if */
/* Check for the group having a pipeline message */
- if((pline_exists = H5O_msg_exists(&(grp->oloc), H5O_PLINE_ID, H5AC_ind_dxpl_id)) < 0)
+ if((pline_exists = H5O_msg_exists(&(grp->oloc), H5O_PLINE_ID, H5AC_ind_read_dxpl_id)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to read object header")
if(pline_exists) {
H5O_pline_t pline; /* Pipeline message */
/* Read the pipeline */
- if(NULL == H5O_msg_read(&(grp->oloc), H5O_PLINE_ID, &pline, H5AC_ind_dxpl_id))
+ if(NULL == H5O_msg_read(&(grp->oloc), H5O_PLINE_ID, &pline, H5AC_ind_read_dxpl_id))
HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "can't get link pipeline")
/* Set the pipeline for the property list */
diff --git a/src/H5Gobj.c b/src/H5Gobj.c
index f7782a6..92ad0af 100644
--- a/src/H5Gobj.c
+++ b/src/H5Gobj.c
@@ -208,7 +208,7 @@ H5G__obj_create_real(H5F_t *f, hid_t dxpl_id, const H5O_ginfo_t *ginfo,
/* Check for using the latest version of the group format */
/* (add more checks for creating "new format" groups when needed) */
- if(H5F_USE_LATEST_FORMAT(f) || linfo->track_corder
+ if(H5F_USE_LATEST_FLAGS(f, H5F_LATEST_STYLE_GROUP) || linfo->track_corder
|| (pline && pline->nused))
use_latest_format = TRUE;
else
diff --git a/src/H5Gprivate.h b/src/H5Gprivate.h
index 59403c9..ff04d99 100644
--- a/src/H5Gprivate.h
+++ b/src/H5Gprivate.h
@@ -37,13 +37,6 @@
#include "H5RSprivate.h" /* Reference-counted strings */
/*
- * Define this to enable debugging.
- */
-#ifdef NDEBUG
-# undef H5G_DEBUG
-#endif
-
-/*
* The disk size for a symbol table entry...
*/
#define H5G_SIZEOF_SCRATCH 16
diff --git a/src/H5Gstab.c b/src/H5Gstab.c
index 3a7cd9e..ed3dd84 100644
--- a/src/H5Gstab.c
+++ b/src/H5Gstab.c
@@ -153,10 +153,10 @@ H5G__stab_create_components(H5F_t *f, H5O_stab_t *stab, size_t size_hint, hid_t
/* Create the B-tree */
if(H5B_create(f, dxpl_id, H5B_SNODE, NULL, &(stab->btree_addr)/*out*/) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create B-tree")
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create B-tree")
/* Create symbol table private heap */
- if(FAIL == H5HL_create(f, dxpl_id, size_hint, &(stab->heap_addr)/*out*/))
+ if(H5HL_create(f, dxpl_id, size_hint, &(stab->heap_addr)/*out*/) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create heap")
/* Pin the heap down in memory */
diff --git a/src/H5Gtest.c b/src/H5Gtest.c
index c35e5e1..408bfa0 100644
--- a/src/H5Gtest.c
+++ b/src/H5Gtest.c
@@ -98,7 +98,7 @@ H5G__is_empty_test(hid_t gid)
H5G_t *grp = NULL; /* Pointer to group */
htri_t msg_exists = FALSE; /* Indicate that a header message is present */
htri_t linfo_exists = FALSE;/* Indicate that the 'link info' message is present */
- hid_t dxpl_id = H5AC_ind_dxpl_id; /* transfer property list used for this operation */
+ hid_t dxpl_id = H5AC_ind_read_dxpl_id; /* transfer property list used for this operation */
htri_t ret_value = TRUE; /* Return value */
FUNC_ENTER_PACKAGE
@@ -210,7 +210,7 @@ H5G__has_links_test(hid_t gid, unsigned *nmsgs)
{
H5G_t *grp = NULL; /* Pointer to group */
htri_t msg_exists = 0; /* Indicate that a header message is present */
- hid_t dxpl_id = H5AC_ind_dxpl_id; /* transfer property list used for this operation */
+ hid_t dxpl_id = H5AC_ind_read_dxpl_id; /* transfer property list used for this operation */
htri_t ret_value = TRUE; /* Return value */
FUNC_ENTER_PACKAGE
@@ -269,7 +269,7 @@ H5G__has_stab_test(hid_t gid)
{
H5G_t *grp = NULL; /* Pointer to group */
htri_t msg_exists = 0; /* Indicate that a header message is present */
- hid_t dxpl_id = H5AC_ind_dxpl_id; /* transfer property list used for this operation */
+ hid_t dxpl_id = H5AC_ind_read_dxpl_id; /* transfer property list used for this operation */
htri_t ret_value = TRUE; /* Return value */
FUNC_ENTER_PACKAGE
@@ -320,7 +320,7 @@ H5G__is_new_dense_test(hid_t gid)
{
H5G_t *grp = NULL; /* Pointer to group */
htri_t msg_exists = 0; /* Indicate that a header message is present */
- hid_t dxpl_id = H5AC_ind_dxpl_id; /* transfer property list used for this operation */
+ hid_t dxpl_id = H5AC_ind_read_dxpl_id; /* transfer property list used for this operation */
htri_t ret_value = TRUE; /* Return value */
FUNC_ENTER_PACKAGE
@@ -391,7 +391,7 @@ H5G__new_dense_info_test(hid_t gid, hsize_t *name_count, hsize_t *corder_count)
H5B2_t *bt2_corder = NULL; /* v2 B-tree handle for creation order index */
H5O_linfo_t linfo; /* Link info message */
H5G_t *grp = NULL; /* Pointer to group */
- hid_t dxpl_id = H5AC_ind_dxpl_id; /* transfer property list used for this operation */
+ hid_t dxpl_id = H5AC_ind_read_dxpl_id; /* transfer property list used for this operation */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -472,7 +472,7 @@ H5G__lheap_size_test(hid_t gid, size_t *lheap_size)
{
H5G_t *grp = NULL; /* Pointer to group */
H5O_stab_t stab; /* Symbol table message */
- hid_t dxpl_id = H5AC_ind_dxpl_id; /* transfer property list used for this operation */
+ hid_t dxpl_id = H5AC_ind_read_dxpl_id; /* transfer property list used for this operation */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -615,7 +615,7 @@ H5G__verify_cached_stab_test(H5O_loc_t *grp_oloc, H5G_entry_t *ent)
{
H5O_stab_t stab; /* Symbol table */
H5HL_t *heap = NULL; /* Pointer to local heap */
- hid_t dxpl_id = H5AC_ind_dxpl_id; /* transfer property list used for this operation */
+ hid_t dxpl_id = H5AC_ind_read_dxpl_id; /* transfer property list used for this operation */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE_TAG(dxpl_id, grp_oloc->addr, FAIL)
@@ -772,7 +772,7 @@ H5G__verify_cached_stabs_test(hid_t gid)
H5O_stab_t stab; /* Symbol table message */
H5G_bt_common_t udata = {NULL, NULL}; /* Dummy udata so H5B_iterate doesn't freak out */
haddr_t prev_tag = HADDR_UNDEF; /* Previous metadata tag */
- hid_t dxpl_id = H5AC_ind_dxpl_id; /* transfer property list used for this operation */
+ hid_t dxpl_id = H5AC_ind_read_dxpl_id; /* transfer property list used for this operation */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
diff --git a/src/H5HFbtree2.c b/src/H5HFbtree2.c
index d82de93..d4a30b8 100644
--- a/src/H5HFbtree2.c
+++ b/src/H5HFbtree2.c
@@ -71,11 +71,10 @@ typedef struct H5HF_huge_bt2_ctx_t {
/* Common callbacks */
static void *H5HF__huge_bt2_crt_context(void *udata);
static herr_t H5HF__huge_bt2_dst_context(void *ctx);
-static void *H5HF__huge_bt2_crt_dbg_context(H5F_t *f, hid_t dxpl_id, haddr_t addr);
/* Callbacks for indirect objects */
static herr_t H5HF__huge_bt2_indir_store(void *native, const void *udata);
-static herr_t H5HF__huge_bt2_indir_compare(const void *rec1, const void *rec2);
+static herr_t H5HF__huge_bt2_indir_compare(const void *rec1, const void *rec2, int *result);
static herr_t H5HF__huge_bt2_indir_encode(uint8_t *raw, const void *native,
void *ctx);
static herr_t H5HF__huge_bt2_indir_decode(const uint8_t *raw, void *native,
@@ -85,7 +84,7 @@ static herr_t H5HF__huge_bt2_indir_debug(FILE *stream, int indent, int fwidth,
/* Callbacks for filtered indirect objects */
static herr_t H5HF__huge_bt2_filt_indir_store(void *native, const void *udata);
-static herr_t H5HF__huge_bt2_filt_indir_compare(const void *rec1, const void *rec2);
+static herr_t H5HF__huge_bt2_filt_indir_compare(const void *rec1, const void *rec2, int *result);
static herr_t H5HF__huge_bt2_filt_indir_encode(uint8_t *raw, const void *native,
void *ctx);
static herr_t H5HF__huge_bt2_filt_indir_decode(const uint8_t *raw, void *native,
@@ -95,7 +94,7 @@ static herr_t H5HF__huge_bt2_filt_indir_debug(FILE *stream, int indent, int fwid
/* Callbacks for direct objects */
static herr_t H5HF__huge_bt2_dir_store(void *native, const void *udata);
-static herr_t H5HF__huge_bt2_dir_compare(const void *rec1, const void *rec2);
+static herr_t H5HF__huge_bt2_dir_compare(const void *rec1, const void *rec2, int *result);
static herr_t H5HF__huge_bt2_dir_encode(uint8_t *raw, const void *native,
void *ctx);
static herr_t H5HF__huge_bt2_dir_decode(const uint8_t *raw, void *native,
@@ -105,7 +104,7 @@ static herr_t H5HF__huge_bt2_dir_debug(FILE *stream, int indent, int fwidth,
/* Callbacks for filtered direct objects */
static herr_t H5HF__huge_bt2_filt_dir_store(void *native, const void *udata);
-static herr_t H5HF__huge_bt2_filt_dir_compare(const void *rec1, const void *rec2);
+static herr_t H5HF__huge_bt2_filt_dir_compare(const void *rec1, const void *rec2, int *result);
static herr_t H5HF__huge_bt2_filt_dir_encode(uint8_t *raw, const void *native,
void *ctx);
static herr_t H5HF__huge_bt2_filt_dir_decode(const uint8_t *raw, void *native,
@@ -127,9 +126,7 @@ const H5B2_class_t H5HF_HUGE_BT2_INDIR[1]={{ /* B-tree class information */
H5HF__huge_bt2_indir_compare, /* Record comparison callback */
H5HF__huge_bt2_indir_encode, /* Record encoding callback */
H5HF__huge_bt2_indir_decode, /* Record decoding callback */
- H5HF__huge_bt2_indir_debug, /* Record debugging callback */
- H5HF__huge_bt2_crt_dbg_context, /* Create debugging context */
- H5HF__huge_bt2_dst_context /* Destroy debugging context */
+ H5HF__huge_bt2_indir_debug /* Record debugging callback */
}};
/* v2 B-tree class for indirectly accessed, filtered 'huge' objects */
@@ -143,9 +140,7 @@ const H5B2_class_t H5HF_HUGE_BT2_FILT_INDIR[1]={{ /* B-tree class information */
H5HF__huge_bt2_filt_indir_compare, /* Record comparison callback */
H5HF__huge_bt2_filt_indir_encode, /* Record encoding callback */
H5HF__huge_bt2_filt_indir_decode, /* Record decoding callback */
- H5HF__huge_bt2_filt_indir_debug, /* Record debugging callback */
- H5HF__huge_bt2_crt_dbg_context, /* Create debugging context */
- H5HF__huge_bt2_dst_context /* Destroy debugging context */
+ H5HF__huge_bt2_filt_indir_debug /* Record debugging callback */
}};
/* v2 B-tree class for directly accessed 'huge' objects */
@@ -159,9 +154,7 @@ const H5B2_class_t H5HF_HUGE_BT2_DIR[1]={{ /* B-tree class information */
H5HF__huge_bt2_dir_compare, /* Record comparison callback */
H5HF__huge_bt2_dir_encode, /* Record encoding callback */
H5HF__huge_bt2_dir_decode, /* Record decoding callback */
- H5HF__huge_bt2_dir_debug, /* Record debugging callback */
- H5HF__huge_bt2_crt_dbg_context, /* Create debugging context */
- H5HF__huge_bt2_dst_context /* Destroy debugging context */
+ H5HF__huge_bt2_dir_debug /* Record debugging callback */
}};
/* v2 B-tree class for directly accessed, filtered 'huge' objects */
@@ -175,9 +168,7 @@ const H5B2_class_t H5HF_HUGE_BT2_FILT_DIR[1]={{ /* B-tree class information */
H5HF__huge_bt2_filt_dir_compare, /* Record comparison callback */
H5HF__huge_bt2_filt_dir_encode, /* Record encoding callback */
H5HF__huge_bt2_filt_dir_decode, /* Record decoding callback */
- H5HF__huge_bt2_filt_dir_debug, /* Record debugging callback */
- H5HF__huge_bt2_crt_dbg_context, /* Create debugging context */
- H5HF__huge_bt2_dst_context /* Destroy debugging context */
+ H5HF__huge_bt2_filt_dir_debug /* Record debugging callback */
}};
/*****************************/
@@ -270,46 +261,6 @@ H5HF__huge_bt2_dst_context(void *_ctx)
/*-------------------------------------------------------------------------
- * Function: H5HF__huge_bt2_crt_dbg_context
- *
- * Purpose: Create context for debugging callback
- *
- * Return: Success: non-NULL
- * Failure: NULL
- *
- * Programmer: Quincey Koziol
- * Tuesday, December 1, 2009
- *
- *-------------------------------------------------------------------------
- */
-static void *
-H5HF__huge_bt2_crt_dbg_context(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, haddr_t H5_ATTR_UNUSED addr)
-{
- H5HF_huge_bt2_ctx_t *ctx; /* Callback context structure */
- void *ret_value = NULL; /* Return value */
-
- FUNC_ENTER_STATIC
-
- /* Sanity check */
- HDassert(f);
-
- /* Allocate callback context */
- if(NULL == (ctx = H5FL_MALLOC(H5HF_huge_bt2_ctx_t)))
- HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "can't allocate callback context")
-
- /* Determine the size of addresses & lengths in the file */
- ctx->sizeof_addr = H5F_SIZEOF_ADDR(f);
- ctx->sizeof_size = H5F_SIZEOF_SIZE(f);
-
- /* Set return value */
- ret_value = ctx;
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5HF__huge_bt2_crt_dbg_context() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5HF__huge_bt2_indir_found
*
* Purpose: Retrieve record for indirectly accessed 'huge' object, when
@@ -407,11 +358,14 @@ H5HF__huge_bt2_indir_store(void *nrecord, const void *udata)
*-------------------------------------------------------------------------
*/
static herr_t
-H5HF__huge_bt2_indir_compare(const void *_rec1, const void *_rec2)
+H5HF__huge_bt2_indir_compare(const void *_rec1, const void *_rec2, int *result)
{
FUNC_ENTER_STATIC_NOERR
- FUNC_LEAVE_NOAPI((herr_t)(((const H5HF_huge_bt2_indir_rec_t *)_rec1)->id - ((const H5HF_huge_bt2_indir_rec_t *)_rec2)->id))
+ *result = (int)(((const H5HF_huge_bt2_indir_rec_t *)_rec1)->id -
+ ((const H5HF_huge_bt2_indir_rec_t *)_rec2)->id);
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5HF__huge_bt2_indir_compare() */
@@ -607,11 +561,14 @@ H5HF__huge_bt2_filt_indir_store(void *nrecord, const void *udata)
*-------------------------------------------------------------------------
*/
static herr_t
-H5HF__huge_bt2_filt_indir_compare(const void *_rec1, const void *_rec2)
+H5HF__huge_bt2_filt_indir_compare(const void *_rec1, const void *_rec2, int *result)
{
FUNC_ENTER_STATIC_NOERR
- FUNC_LEAVE_NOAPI((herr_t)(((const H5HF_huge_bt2_filt_indir_rec_t *)_rec1)->id - ((const H5HF_huge_bt2_filt_indir_rec_t *)_rec2)->id))
+ *result = (int)(((const H5HF_huge_bt2_filt_indir_rec_t *)_rec1)->id -
+ ((const H5HF_huge_bt2_filt_indir_rec_t *)_rec2)->id);
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5HF__huge_bt2_filt_indir_compare() */
@@ -786,26 +743,25 @@ H5HF__huge_bt2_dir_store(void *nrecord, const void *udata)
*-------------------------------------------------------------------------
*/
static herr_t
-H5HF__huge_bt2_dir_compare(const void *_rec1, const void *_rec2)
+H5HF__huge_bt2_dir_compare(const void *_rec1, const void *_rec2, int *result)
{
const H5HF_huge_bt2_dir_rec_t *rec1 = (const H5HF_huge_bt2_dir_rec_t *)_rec1;
const H5HF_huge_bt2_dir_rec_t *rec2 = (const H5HF_huge_bt2_dir_rec_t *)_rec2;
- herr_t ret_value = FAIL; /* Return value */
FUNC_ENTER_STATIC_NOERR
if(rec1->addr < rec2->addr)
- ret_value = -1;
+ *result = -1;
else if(rec1->addr > rec2->addr)
- ret_value = 1;
+ *result = 1;
else if(rec1->len < rec2->len)
- ret_value = -1;
+ *result = -1;
else if(rec1->len > rec2->len)
- ret_value = 1;
+ *result = 1;
else
- ret_value = 0;
+ *result = 0;
- FUNC_LEAVE_NOAPI(ret_value)
+ FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5HF__huge_bt2_dir_compare() */
@@ -999,26 +955,25 @@ H5HF__huge_bt2_filt_dir_store(void *nrecord, const void *udata)
*-------------------------------------------------------------------------
*/
static herr_t
-H5HF__huge_bt2_filt_dir_compare(const void *_rec1, const void *_rec2)
+H5HF__huge_bt2_filt_dir_compare(const void *_rec1, const void *_rec2, int *result)
{
const H5HF_huge_bt2_filt_dir_rec_t *rec1 = (const H5HF_huge_bt2_filt_dir_rec_t *)_rec1;
const H5HF_huge_bt2_filt_dir_rec_t *rec2 = (const H5HF_huge_bt2_filt_dir_rec_t *)_rec2;
- herr_t ret_value = FAIL; /* Return value */
FUNC_ENTER_STATIC_NOERR
if(rec1->addr < rec2->addr)
- ret_value = -1;
+ *result = -1;
else if(rec1->addr > rec2->addr)
- ret_value = 1;
+ *result = 1;
else if(rec1->len < rec2->len)
- ret_value = -1;
+ *result = -1;
else if(rec1->len > rec2->len)
- ret_value = 1;
+ *result = 1;
else
- ret_value = 0;
+ *result = 0;
- FUNC_LEAVE_NOAPI(ret_value)
+ FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5HF__huge_bt2_filt_dir_compare() */
diff --git a/src/H5HFcache.c b/src/H5HFcache.c
index 4f3dfc3..38556b7 100644
--- a/src/H5HFcache.c
+++ b/src/H5HFcache.c
@@ -1185,7 +1185,7 @@ H5HF__cache_iblock_pre_serialize(const H5F_t *f, hid_t dxpl_id, void *_thing,
HDassert(!H5F_addr_eq(iblock->addr, iblock_addr));
/* Let the metadata cache know the block moved */
- if(H5AC_move_entry((H5F_t *)f, H5AC_FHEAP_IBLOCK, iblock->addr, iblock_addr) < 0)
+ if(H5AC_move_entry((H5F_t *)f, H5AC_FHEAP_IBLOCK, iblock->addr, iblock_addr, dxpl_id) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTMOVE, FAIL, "unable to move indirect block")
/* Update the internal address for the block */
@@ -2101,7 +2101,7 @@ H5HF__cache_dblock_pre_serialize(const H5F_t *f, hid_t dxpl_id, void *_thing,
/* Let the metadata cache know, if the block moved */
if(!H5F_addr_eq(hdr->man_dtable.table_addr, dblock_addr))
- if(H5AC_move_entry((H5F_t *)f, H5AC_FHEAP_DBLOCK, hdr->man_dtable.table_addr, dblock_addr) < 0)
+ if(H5AC_move_entry((H5F_t *)f, H5AC_FHEAP_DBLOCK, hdr->man_dtable.table_addr, dblock_addr, dxpl_id) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTMOVE, FAIL, "unable to move direct block")
/* Update information about compressed direct block's
@@ -2159,7 +2159,7 @@ H5HF__cache_dblock_pre_serialize(const H5F_t *f, hid_t dxpl_id, void *_thing,
/* Let the metadata cache know, if the block moved */
if(!H5F_addr_eq(par_iblock->ents[par_entry].addr, dblock_addr))
- if(H5AC_move_entry((H5F_t *)f, H5AC_FHEAP_DBLOCK, par_iblock->ents[par_entry].addr, dblock_addr) < 0)
+ if(H5AC_move_entry((H5F_t *)f, H5AC_FHEAP_DBLOCK, par_iblock->ents[par_entry].addr, dblock_addr, dxpl_id) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTMOVE, FAIL, "unable to move direct block")
/* Update information about compressed direct block's
@@ -2211,7 +2211,7 @@ H5HF__cache_dblock_pre_serialize(const H5F_t *f, hid_t dxpl_id, void *_thing,
HDassert(!H5F_addr_eq(hdr->man_dtable.table_addr, dblock_addr));
/* Let the metadata cache know the block moved */
- if(H5AC_move_entry((H5F_t *)f, H5AC_FHEAP_DBLOCK, hdr->man_dtable.table_addr, dblock_addr) < 0)
+ if(H5AC_move_entry((H5F_t *)f, H5AC_FHEAP_DBLOCK, hdr->man_dtable.table_addr, dblock_addr, dxpl_id) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTMOVE, FAIL, "unable to move direct block")
/* Update information about direct block's location */
@@ -2235,7 +2235,7 @@ H5HF__cache_dblock_pre_serialize(const H5F_t *f, hid_t dxpl_id, void *_thing,
HDassert(!H5F_addr_eq(par_iblock->ents[par_entry].addr, dblock_addr));
/* Let the metadata cache know the block moved */
- if(H5AC_move_entry((H5F_t *)f, H5AC_FHEAP_DBLOCK, par_iblock->ents[par_entry].addr, dblock_addr) < 0)
+ if(H5AC_move_entry((H5F_t *)f, H5AC_FHEAP_DBLOCK, par_iblock->ents[par_entry].addr, dblock_addr, dxpl_id) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTMOVE, FAIL, "unable to move direct block")
/* Update information about direct block's location */
diff --git a/src/H5HFdblock.c b/src/H5HFdblock.c
index 73db840..1272ab0 100644
--- a/src/H5HFdblock.c
+++ b/src/H5HFdblock.c
@@ -146,9 +146,7 @@ H5HF_man_dblock_create(hid_t dxpl_id, H5HF_hdr_t *hdr, H5HF_indirect_t *par_iblo
/* XXX: Change to using free-list factories */
if((dblock->blk = H5FL_BLK_MALLOC(direct_block, dblock->size)) == NULL)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
-#ifdef H5_CLEAR_MEMORY
-HDmemset(dblock->blk, 0, dblock->size);
-#endif /* H5_CLEAR_MEMORY */
+ HDmemset(dblock->blk, 0, dblock->size);
dblock->write_buf = NULL;
dblock->write_size = 0;
diff --git a/src/H5HFhdr.c b/src/H5HFhdr.c
index 19ea14a..42857c0 100644
--- a/src/H5HFhdr.c
+++ b/src/H5HFhdr.c
@@ -427,7 +427,7 @@ H5HF_hdr_create(H5F_t *f, hid_t dxpl_id, const H5HF_create_t *cparam)
HGOTO_ERROR(H5E_HEAP, H5E_CANTCOPY, HADDR_UNDEF, "can't copy I/O filter pipeline")
/* Pay attention to the latest version flag for the file */
- if(H5F_USE_LATEST_FORMAT(hdr->f))
+ if(H5F_USE_LATEST_FLAGS(hdr->f, H5F_LATEST_PLINE_MSG))
/* Set the latest version for the I/O pipeline message */
if(H5O_pline_set_latest_version(&(hdr->pline)) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTSET, HADDR_UNDEF, "can't set latest version of I/O filter pipeline")
diff --git a/src/H5HFhuge.c b/src/H5HFhuge.c
index ccee89e..94433c4 100644
--- a/src/H5HFhuge.c
+++ b/src/H5HFhuge.c
@@ -379,7 +379,7 @@ HDfprintf(stderr, "%s: obj_size = %Zu, obj = %p\n", FUNC, obj_size, obj);
HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, "file allocation failed for fractal heap huge object")
/* Write the object's data to disk */
- if(H5F_block_write(hdr->f, H5FD_MEM_FHEAP_HUGE_OBJ, obj_addr, write_size, dxpl_id, write_buf) < 0)
+ if(H5F_block_write(hdr->f, H5FD_MEM_FHEAP_HUGE_OBJ, obj_addr, write_size, H5AC_rawdata_dxpl_id, write_buf) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_WRITEERROR, FAIL, "writing 'huge' object to file failed")
/* Release buffer for writing, if we had one */
@@ -770,7 +770,7 @@ H5HF_huge_op_real(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id,
/* Read the object's (possibly filtered) data from the file */
/* (reads directly into application's buffer if no filters are present) */
- if(H5F_block_read(hdr->f, H5FD_MEM_FHEAP_HUGE_OBJ, obj_addr, (size_t)obj_size, dxpl_id, read_buf) < 0)
+ if(H5F_block_read(hdr->f, H5FD_MEM_FHEAP_HUGE_OBJ, obj_addr, (size_t)obj_size, H5AC_rawdata_dxpl_id, read_buf) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_READERROR, FAIL, "can't read 'huge' object's data from the file")
/* Check for I/O pipeline filter on heap */
@@ -889,7 +889,7 @@ H5HF_huge_write(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id,
/* Write the object's data to the file */
/* (writes directly from application's buffer) */
- if(H5F_block_write(hdr->f, H5FD_MEM_FHEAP_HUGE_OBJ, obj_addr, obj_size, dxpl_id, obj) < 0)
+ if(H5F_block_write(hdr->f, H5FD_MEM_FHEAP_HUGE_OBJ, obj_addr, obj_size, H5AC_rawdata_dxpl_id, obj) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_WRITEERROR, FAIL, "writing 'huge' object to file failed")
done:
diff --git a/src/H5HFiblock.c b/src/H5HFiblock.c
index f3ec78f..341f423 100644
--- a/src/H5HFiblock.c
+++ b/src/H5HFiblock.c
@@ -315,7 +315,7 @@ H5HF_iblock_decr(H5HF_indirect_t *iblock)
/* Detach from parent indirect block */
if(iblock->parent) {
/* Detach from parent indirect block */
- if(H5HF_man_iblock_detach(iblock->parent, H5AC_dxpl_id, iblock->par_entry) < 0)
+ if(H5HF_man_iblock_detach(iblock->parent, H5AC_ind_read_dxpl_id, iblock->par_entry) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTATTACH, FAIL, "can't detach from parent indirect block")
iblock->parent = NULL;
iblock->par_entry = 0;
@@ -339,7 +339,7 @@ H5HF_iblock_decr(H5HF_indirect_t *iblock)
if (!H5F_IS_TMP_ADDR(hdr->f, iblock_addr))
cache_flags |= H5AC__FREE_FILE_SPACE_FLAG;
- if(H5AC_expunge_entry(hdr->f, H5AC_dxpl_id, H5AC_FHEAP_IBLOCK, iblock_addr, cache_flags) < 0)
+ if(H5AC_expunge_entry(hdr->f, H5AC_ind_read_dxpl_id, H5AC_FHEAP_IBLOCK, iblock_addr, cache_flags) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTREMOVE, FAIL, "unable to remove indirect block from cache")
} /* end if */
} /* end if */
@@ -630,7 +630,7 @@ H5HF_man_iblock_root_double(H5HF_hdr_t *hdr, hid_t dxpl_id, size_t min_dblock_si
/* Move object in cache, if it actually was relocated */
if(H5F_addr_ne(iblock->addr, new_addr)) {
- if(H5AC_move_entry(hdr->f, H5AC_FHEAP_IBLOCK, iblock->addr, new_addr) < 0)
+ if(H5AC_move_entry(hdr->f, H5AC_FHEAP_IBLOCK, iblock->addr, new_addr, dxpl_id) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTMOVE, FAIL, "unable to move fractal heap root indirect block")
iblock->addr = new_addr;
} /* end if */
@@ -799,7 +799,7 @@ H5HF_man_iblock_root_halve(H5HF_indirect_t *iblock, hid_t dxpl_id)
/* Move object in cache, if it actually was relocated */
if(H5F_addr_ne(iblock->addr, new_addr)) {
- if(H5AC_move_entry(hdr->f, H5AC_FHEAP_IBLOCK, iblock->addr, new_addr) < 0)
+ if(H5AC_move_entry(hdr->f, H5AC_FHEAP_IBLOCK, iblock->addr, new_addr, dxpl_id) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTSPLIT, FAIL, "unable to move fractal heap root indirect block")
iblock->addr = new_addr;
} /* end if */
diff --git a/src/H5HFsection.c b/src/H5HFsection.c
index 8699827..37ff8f4 100644
--- a/src/H5HFsection.c
+++ b/src/H5HFsection.c
@@ -99,7 +99,7 @@ static htri_t H5HF_sect_single_can_shrink(const H5FS_section_info_t *sect,
static herr_t H5HF_sect_single_shrink(H5FS_section_info_t **_sect,
void *udata);
static herr_t H5HF_sect_single_valid(const H5FS_section_class_t *cls,
- const H5FS_section_info_t *sect);
+ const H5FS_section_info_t *sect, hid_t dxpl_id);
/* 'row' section routines */
static H5HF_free_section_t *H5HF_sect_row_create(haddr_t sect_off,
@@ -129,7 +129,7 @@ static herr_t H5HF_sect_row_shrink(H5FS_section_info_t **sect,
void *udata);
static herr_t H5HF_sect_row_free(H5FS_section_info_t *sect);
static herr_t H5HF_sect_row_valid(const H5FS_section_class_t *cls,
- const H5FS_section_info_t *sect);
+ const H5FS_section_info_t *sect, hid_t dxpl_id);
static herr_t H5HF_sect_row_debug(const H5FS_section_info_t *sect,
FILE *stream, int indent, int fwidth);
@@ -1172,7 +1172,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5HF_sect_single_valid(const H5FS_section_class_t H5_ATTR_UNUSED *cls, const H5FS_section_info_t *_sect)
+H5HF_sect_single_valid(const H5FS_section_class_t H5_ATTR_UNUSED *cls, const H5FS_section_info_t *_sect, hid_t dxpl_id)
{
const H5HF_free_section_t *sect = (const H5HF_free_section_t *)_sect; /* Pointer to section to check */
@@ -1222,7 +1222,7 @@ H5HF_sect_single_valid(const H5FS_section_class_t H5_ATTR_UNUSED *cls, const H5F
H5HF_direct_t *dblock; /* Direct block for section */
/* Protect the direct block for the section */
- dblock = H5HF_man_dblock_protect(iblock->hdr, H5AC_dxpl_id, dblock_addr, dblock_size, iblock, sect->u.single.par_entry, H5AC__READ_ONLY_FLAG);
+ dblock = H5HF_man_dblock_protect(iblock->hdr, dxpl_id, dblock_addr, dblock_size, iblock, sect->u.single.par_entry, H5AC__READ_ONLY_FLAG);
HDassert(dblock);
/* Sanity check settings for section */
@@ -1233,7 +1233,7 @@ H5HF_sect_single_valid(const H5FS_section_class_t H5_ATTR_UNUSED *cls, const H5F
(sect->sect_info.addr + sect->sect_info.size)));
/* Release direct block */
- status = H5AC_unprotect(iblock->hdr->f, H5AC_dxpl_id, H5AC_FHEAP_DBLOCK, dblock_addr, dblock, H5AC__NO_FLAGS_SET);
+ status = H5AC_unprotect(iblock->hdr->f, dxpl_id, H5AC_FHEAP_DBLOCK, dblock_addr, dblock, H5AC__NO_FLAGS_SET);
HDassert(status >= 0);
} /* end if */
} /* end if */
@@ -1992,7 +1992,8 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5HF_sect_row_valid(const H5FS_section_class_t *cls, const H5FS_section_info_t *_sect)
+H5HF_sect_row_valid(const H5FS_section_class_t *cls, const H5FS_section_info_t *_sect,
+ hid_t H5_ATTR_UNUSED dxpl_id)
{
H5HF_sect_private_t *cls_prvt; /* Pointer to class private info */
const H5HF_hdr_t *hdr; /* Fractal heap header */
diff --git a/src/H5HFtiny.c b/src/H5HFtiny.c
index bdfe30d..711ceb9 100644
--- a/src/H5HFtiny.c
+++ b/src/H5HFtiny.c
@@ -177,10 +177,9 @@ HDfprintf(stderr, "%s: obj_size = %Zu\n", FUNC, obj_size);
((enc_obj_size & H5HF_TINY_MASK_EXT_1) >> 8));
*id++ = enc_obj_size & H5HF_TINY_MASK_EXT_2;
} /* end else */
+
HDmemcpy(id, obj, obj_size);
-#ifdef H5_CLEAR_MEMORY
-HDmemset(id + obj_size, 0, (hdr->id_len - ((size_t)1 + (size_t)hdr->tiny_len_extended + obj_size)));
-#endif /* H5_CLEAR_MEMORY */
+ HDmemset(id + obj_size, 0, (hdr->id_len - ((size_t)1 + (size_t)hdr->tiny_len_extended + obj_size)));
/* Update statistics about heap */
hdr->tiny_size += obj_size;
diff --git a/src/H5HG.c b/src/H5HG.c
index 57a1cf2..f95b607 100644
--- a/src/H5HG.c
+++ b/src/H5HG.c
@@ -154,22 +154,20 @@ H5HG_create(H5F_t *f, hid_t dxpl_id, size_t size)
/* Create it */
H5_CHECK_OVERFLOW(size, size_t, hsize_t);
if(HADDR_UNDEF == (addr = H5MF_alloc(f, H5FD_MEM_GHEAP, dxpl_id, (hsize_t)size)))
- HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, HADDR_UNDEF, "unable to allocate file space for global heap")
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, HADDR_UNDEF, "unable to allocate file space for global heap")
if(NULL == (heap = H5FL_MALLOC(H5HG_heap_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, HADDR_UNDEF, "memory allocation failed")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, HADDR_UNDEF, "memory allocation failed")
heap->addr = addr;
heap->size = size;
heap->shared = H5F_SHARED(f);
if(NULL == (heap->chunk = H5FL_BLK_MALLOC(gheap_chunk, size)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, HADDR_UNDEF, "memory allocation failed")
-#ifdef H5_CLEAR_MEMORY
-HDmemset(heap->chunk, 0, size);
-#endif /* H5_CLEAR_MEMORY */
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, HADDR_UNDEF, "memory allocation failed")
+ HDmemset(heap->chunk, 0, size);
heap->nalloc = H5HG_NOBJS(f, size);
heap->nused = 1; /* account for index 0, which is used for the free object */
if(NULL == (heap->obj = H5FL_SEQ_MALLOC(H5HG_obj_t, heap->nalloc)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, HADDR_UNDEF, "memory allocation failed")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, HADDR_UNDEF, "memory allocation failed")
/* Initialize the header */
HDmemcpy(heap->chunk, H5HG_MAGIC, (size_t)H5_SIZEOF_MAGIC);
@@ -299,9 +297,9 @@ done:
static size_t
H5HG_alloc(H5F_t *f, H5HG_heap_t *heap, size_t size, unsigned *heap_flags_ptr)
{
- size_t idx;
- uint8_t *p;
- size_t need = H5HG_SIZEOF_OBJHDR(f) + H5HG_ALIGN(size);
+ size_t idx;
+ uint8_t *p;
+ size_t need = H5HG_SIZEOF_OBJHDR(f) + H5HG_ALIGN(size);
size_t ret_value = 0; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
@@ -360,11 +358,11 @@ H5HG_alloc(H5F_t *f, H5HG_heap_t *heap, size_t size, unsigned *heap_flags_ptr)
/* Fix the free space object */
if(need == heap->obj[0].size) {
- /*
- * All free space has been exhausted from this collection.
- */
- heap->obj[0].size = 0;
- heap->obj[0].begin = NULL;
+ /*
+ * All free space has been exhausted from this collection.
+ */
+ heap->obj[0].size = 0;
+ heap->obj[0].begin = NULL;
} /* end if */
else if(heap->obj[0].size-need >= H5HG_SIZEOF_OBJHDR (f)) {
/*
@@ -452,9 +450,7 @@ H5HG_extend(H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t need)
/* Re-allocate the heap information in memory */
if(NULL == (new_chunk = H5FL_BLK_REALLOC(gheap_chunk, heap->chunk, (heap->size + need))))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "new heap allocation failed")
-#ifdef H5_CLEAR_MEMORY
-HDmemset(new_chunk + heap->size, 0, need);
-#endif /* H5_CLEAR_MEMORY */
+ HDmemset(new_chunk + heap->size, 0, need);
/* Adjust the size of the heap */
old_size = heap->size;
@@ -789,10 +785,10 @@ done:
herr_t
H5HG_remove (H5F_t *f, hid_t dxpl_id, H5HG_t *hobj)
{
- H5HG_heap_t *heap = NULL;
- uint8_t *p = NULL, *obj_start = NULL;
- size_t need;
- unsigned u;
+ H5HG_heap_t *heap = NULL;
+ uint8_t *p = NULL, *obj_start = NULL;
+ size_t need;
+ unsigned u;
unsigned flags = H5AC__NO_FLAGS_SET;/* Whether the heap gets deleted */
herr_t ret_value = SUCCEED; /* Return value */
diff --git a/src/H5HGpkg.h b/src/H5HGpkg.h
index ffbf7c6..e566ece 100644
--- a/src/H5HGpkg.h
+++ b/src/H5HGpkg.h
@@ -116,9 +116,9 @@ H5FL_BLK_EXTERN(gheap_chunk);
/****************************/
typedef struct H5HG_obj_t {
- int nrefs; /*reference count */
- size_t size; /*total size of object */
- uint8_t *begin; /*ptr to object into heap->chunk*/
+ int nrefs; /* reference count */
+ size_t size; /* total size of object */
+ uint8_t *begin; /* ptr to object into heap->chunk */
} H5HG_obj_t;
/* Forward declarations for fields */
diff --git a/src/H5HLcache.c b/src/H5HLcache.c
index faa5ff2..95ab65d 100644
--- a/src/H5HLcache.c
+++ b/src/H5HLcache.c
@@ -572,10 +572,8 @@ H5HL__cache_prefix_serialize(const H5F_t *f, void *_image, size_t len,
/* Sanity check */
HDassert((size_t)(image - (uint8_t *)_image) <= len);
-#ifdef H5_CLEAR_MEMORY
/* Clear rest of local heap */
HDmemset(image, 0, len - (size_t)(image - (uint8_t *)_image));
-#endif /* H5_CLEAR_MEMORY */
} /* end else */
FUNC_LEAVE_NOAPI(SUCCEED)
diff --git a/src/H5HLdblk.c b/src/H5HLdblk.c
index 6a4d8ce..69e0334 100644
--- a/src/H5HLdblk.c
+++ b/src/H5HLdblk.c
@@ -266,7 +266,7 @@ H5HL__dblk_realloc(H5F_t *f, hid_t dxpl_id, H5HL_t *heap, size_t new_heap_size))
H5E_THROW(H5E_CANTRESIZE, "unable to resize heap data block in cache");
/* Relocate the heap data block in the cache */
- if(FAIL == H5AC_move_entry(f, H5AC_LHEAP_DBLK, old_addr, new_addr))
+ if(FAIL == H5AC_move_entry(f, H5AC_LHEAP_DBLK, old_addr, new_addr, dxpl_id))
H5E_THROW(H5E_CANTMOVE, "unable to move heap data block in cache");
} /* end else */
diff --git a/src/H5I.c b/src/H5I.c
index 1486603..0fbc58f 100644
--- a/src/H5I.c
+++ b/src/H5I.c
@@ -2147,7 +2147,7 @@ H5Iget_name(hid_t id, char *name/*out*/, size_t size)
HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "can't retrieve object location")
/* Call internal group routine to retrieve object's name */
- if((ret_value = H5G_get_name(&loc, name, size, NULL, H5P_DEFAULT, H5AC_ind_dxpl_id)) < 0)
+ if((ret_value = H5G_get_name(&loc, name, size, NULL, H5P_DEFAULT, H5AC_ind_read_dxpl_id)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "can't retrieve object name")
done:
@@ -2197,7 +2197,7 @@ H5Iget_file_id(hid_t obj_id)
/* Get the file through the VOL */
if(H5VL_file_get(obj->vol_obj, obj->vol_info->vol_cls, H5VL_OBJECT_GET_FILE,
- H5AC_dxpl_id, H5_REQUEST_NULL, type, &file) < 0)
+ H5AC_ind_read_dxpl_id, H5_REQUEST_NULL, type, &file) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_CANTINIT, FAIL, "unable to get file")
if (NULL == file)
diff --git a/src/H5Itest.c b/src/H5Itest.c
index 9d451c6..506ca87 100644
--- a/src/H5Itest.c
+++ b/src/H5Itest.c
@@ -89,7 +89,7 @@ H5I_get_name_test(hid_t id, char *name/*out*/, size_t size, hbool_t *cached)
HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "can't retrieve object location")
/* Call internal group routine to retrieve object's name */
- if((ret_value = H5G_get_name(&loc, name, size, cached, H5P_DEFAULT, H5AC_ind_dxpl_id)) < 0)
+ if((ret_value = H5G_get_name(&loc, name, size, cached, H5P_DEFAULT, H5AC_ind_read_dxpl_id)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "can't retrieve object name")
done:
diff --git a/src/H5L.c b/src/H5L.c
index 7828ca7..ab6dffb 100644
--- a/src/H5L.c
+++ b/src/H5L.c
@@ -82,6 +82,17 @@ typedef struct {
hid_t dxpl_id; /* Dataset transfer property list */
} H5L_trav_mv2_t;
+/* User data for path traversal routine for checking if a link exists */
+typedef struct {
+ /* Down */
+ char *sep; /* Pointer to next separator in the string */
+ hid_t lapl_id; /* Link access property list */
+ hid_t dxpl_id; /* Dataset transfer property list */
+
+ /* Up */
+ hbool_t exists; /* Whether the link exists or not */
+} H5L_trav_le_t;
+
/* User data for path traversal routine for getting link value */
typedef struct {
size_t size; /* Size of user buffer */
@@ -123,7 +134,10 @@ static herr_t H5L_move_cb(H5G_loc_t *grp_loc/*in*/, const char *name,
static herr_t H5L_move_dest_cb(H5G_loc_t *grp_loc/*in*/, const char *name,
const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/,
H5G_own_loc_t *own_loc/*out*/);
-static herr_t H5L_exists_cb(H5G_loc_t *grp_loc/*in*/, const char *name,
+static herr_t H5L__exists_final_cb(H5G_loc_t *grp_loc/*in*/, const char *name,
+ const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/,
+ H5G_own_loc_t *own_loc/*out*/);
+static herr_t H5L__exists_inter_cb(H5G_loc_t *grp_loc/*in*/, const char *name,
const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/,
H5G_own_loc_t *own_loc/*out*/);
static herr_t H5L_get_info_cb(H5G_loc_t *grp_loc/*in*/, const char *name,
@@ -275,6 +289,7 @@ H5Lmove(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id,
H5VL_loc_params_t loc_params1;
H5VL_object_t *obj2 = NULL; /* object token of dst_id */
H5VL_loc_params_t loc_params2;
+ hid_t dxpl_id = H5AC_ind_read_dxpl_id; /* dxpl used by library */
herr_t ret_value=SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -294,9 +309,12 @@ H5Lmove(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id,
/* Check the link create property list */
if(H5P_DEFAULT == lcpl_id)
lcpl_id = H5P_LINK_CREATE_DEFAULT;
- /* Check the link access property list */
- if(H5P_DEFAULT == lapl_id)
- lapl_id = H5P_LINK_ACCESS_DEFAULT;
+
+ /* Verify access property list and get correct dxpl */
+ if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id,
+ ((src_loc_id != H5L_SAME_LOC) ? src_loc_id : dst_loc_id),
+ TRUE) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists")
/* set location paramter for source object */
loc_params1.type = H5VL_OBJECT_BY_NAME;
@@ -330,7 +348,7 @@ H5Lmove(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id,
if(H5VL_link_move((obj1 ? obj1->vol_obj : NULL), loc_params1,
(obj2 ? obj2->vol_obj : NULL), loc_params2,
(obj1 ? obj1->vol_info->vol_cls : obj2->vol_info->vol_cls),
- lcpl_id, lapl_id, H5AC_dxpl_id, H5_REQUEST_NULL) < 0)
+ lcpl_id, lapl_id, dxpl_id, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link")
done:
@@ -360,6 +378,7 @@ H5Lcopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id,
H5VL_loc_params_t loc_params1;
H5VL_object_t *obj2 = NULL; /* object token of dst_id */
H5VL_loc_params_t loc_params2;
+ hid_t dxpl_id = H5AC_ind_read_dxpl_id; /* dxpl used by library */
herr_t ret_value=SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -379,9 +398,12 @@ H5Lcopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id,
/* Check the link create property list */
if(H5P_DEFAULT == lcpl_id)
lcpl_id = H5P_LINK_CREATE_DEFAULT;
- /* Check the link access property list */
- if(H5P_DEFAULT == lapl_id)
- lapl_id = H5P_LINK_ACCESS_DEFAULT;
+
+ /* Verify access property list and get correct dxpl */
+ if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id,
+ ((src_loc_id != H5L_SAME_LOC) ? src_loc_id : dst_loc_id),
+ TRUE) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists")
/* set location paramter for source object */
loc_params1.type = H5VL_OBJECT_BY_NAME;
@@ -415,7 +437,7 @@ H5Lcopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id,
if(H5VL_link_copy((obj1 ? obj1->vol_obj : NULL), loc_params1,
(obj2 ? obj2->vol_obj : NULL), loc_params2,
(obj1 ? obj1->vol_info->vol_cls : obj2->vol_info->vol_cls),
- lcpl_id, lapl_id, H5AC_dxpl_id, H5_REQUEST_NULL) < 0)
+ lcpl_id, lapl_id, dxpl_id, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link")
done:
FUNC_LEAVE_API(ret_value)
@@ -447,6 +469,7 @@ H5Lcreate_soft(const char *link_target,
H5VL_object_t *obj = NULL; /* object token of loc_id */
H5VL_loc_params_t loc_params;
H5P_genplist_t *plist; /* Property list pointer */
+ hid_t dxpl_id = H5AC_ind_read_dxpl_id; /* dxpl used by library */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -465,9 +488,10 @@ H5Lcreate_soft(const char *link_target,
/* Check the group access property list */
if(H5P_DEFAULT == lcpl_id)
lcpl_id = H5P_LINK_CREATE_DEFAULT;
- /* Check the link access property list */
- if(H5P_DEFAULT == lapl_id)
- lapl_id = H5P_LINK_ACCESS_DEFAULT;
+
+ /* Verify access property list and get correct dxpl */
+ if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, link_loc_id, TRUE) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists")
loc_params.type = H5VL_OBJECT_BY_NAME;
loc_params.loc_data.loc_by_name.name = link_name;
@@ -488,7 +512,7 @@ H5Lcreate_soft(const char *link_target,
/* Create the link through the VOL */
if(H5VL_link_create(H5VL_LINK_CREATE_SOFT, obj->vol_obj, loc_params, obj->vol_info->vol_cls,
- lcpl_id, lapl_id, H5AC_dxpl_id, H5_REQUEST_NULL) < 0)
+ lcpl_id, lapl_id, dxpl_id, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link")
done:
@@ -521,6 +545,7 @@ H5Lcreate_hard(hid_t cur_loc_id, const char *cur_name,
H5VL_loc_params_t loc_params1;
H5VL_loc_params_t loc_params2;
H5P_genplist_t *plist; /* Property list pointer */
+ hid_t dxpl_id = H5AC_ind_read_dxpl_id; /* dxpl used by library */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -540,9 +565,10 @@ H5Lcreate_hard(hid_t cur_loc_id, const char *cur_name,
/* Check the link create property list */
if(H5P_DEFAULT == lcpl_id)
lcpl_id = H5P_LINK_CREATE_DEFAULT;
- /* Check the link access property list */
- if(H5P_DEFAULT == lapl_id)
- lapl_id = H5P_LINK_ACCESS_DEFAULT;
+
+ /* Verify access property list and get correct dxpl */
+ if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, cur_loc_id, TRUE) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists")
loc_params1.type = H5VL_OBJECT_BY_NAME;
loc_params1.obj_type = H5I_get_type(cur_loc_id);
@@ -583,7 +609,7 @@ H5Lcreate_hard(hid_t cur_loc_id, const char *cur_name,
/* Create the link through the VOL */
if(H5VL_link_create(H5VL_LINK_CREATE_HARD, (obj2 ? (obj2->vol_obj) : NULL), loc_params2,
(obj1!=NULL ? obj1->vol_info->vol_cls : obj2->vol_info->vol_cls),
- lcpl_id, lapl_id, H5AC_dxpl_id, H5_REQUEST_NULL) < 0)
+ lcpl_id, lapl_id, dxpl_id, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link")
done:
@@ -622,6 +648,7 @@ H5Lcreate_ud(hid_t link_loc_id, const char *link_name, H5L_type_t link_type,
H5VL_object_t *obj = NULL; /* object token of loc_id */
H5VL_loc_params_t loc_params;
H5P_genplist_t *plist; /* Property list pointer */
+ hid_t dxpl_id = H5AC_ind_read_dxpl_id; /* dxpl used by library */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -637,9 +664,10 @@ H5Lcreate_ud(hid_t link_loc_id, const char *link_name, H5L_type_t link_type,
/* Check the group access property list */
if(H5P_DEFAULT == lcpl_id)
lcpl_id = H5P_LINK_CREATE_DEFAULT;
- /* Check the link access property list */
- if(H5P_DEFAULT == lapl_id)
- lapl_id = H5P_LINK_ACCESS_DEFAULT;
+
+ /* Verify access property list and get correct dxpl */
+ if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, link_loc_id, TRUE) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists")
loc_params.type = H5VL_OBJECT_BY_NAME;
loc_params.loc_data.loc_by_name.name = link_name;
@@ -664,7 +692,7 @@ H5Lcreate_ud(hid_t link_loc_id, const char *link_name, H5L_type_t link_type,
/* Create the link through the VOL */
if(H5VL_link_create(H5VL_LINK_CREATE_UD, obj->vol_obj, loc_params, obj->vol_info->vol_cls,
- lcpl_id, lapl_id, H5AC_dxpl_id, H5_REQUEST_NULL) < 0)
+ lcpl_id, lapl_id, dxpl_id, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link")
done:
@@ -694,6 +722,7 @@ H5Ldelete(hid_t loc_id, const char *name, hid_t lapl_id)
{
H5VL_object_t *obj = NULL; /* object token of loc_id */
H5VL_loc_params_t loc_params;
+ hid_t dxpl_id = H5AC_ind_read_dxpl_id; /* dxpl used by library */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -703,6 +732,10 @@ H5Ldelete(hid_t loc_id, const char *name, hid_t lapl_id)
if(!name || !*name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name")
+ /* Verify access property list and get correct dxpl */
+ if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, loc_id, TRUE) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists")
+
loc_params.type = H5VL_OBJECT_BY_NAME;
loc_params.obj_type = H5I_get_type(loc_id);
loc_params.loc_data.loc_by_name.name = name;
@@ -714,7 +747,7 @@ H5Ldelete(hid_t loc_id, const char *name, hid_t lapl_id)
/* Delete the link through the VOL */
if(H5VL_link_specific(obj->vol_obj, loc_params, obj->vol_info->vol_cls, H5VL_LINK_DELETE,
- H5AC_dxpl_id, H5_REQUEST_NULL) < 0)
+ dxpl_id, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete link")
done:
@@ -747,6 +780,7 @@ H5Ldelete_by_idx(hid_t loc_id, const char *group_name,
{
H5VL_object_t *obj = NULL; /* object token of loc_id */
H5VL_loc_params_t loc_params;
+ hid_t dxpl_id = H5AC_ind_read_dxpl_id; /* dxpl used by library */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -759,11 +793,10 @@ H5Ldelete_by_idx(hid_t loc_id, const char *group_name,
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
- if(H5P_DEFAULT == lapl_id)
- lapl_id = H5P_LINK_ACCESS_DEFAULT;
- else
- if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID")
+
+ /* Verify access property list and get correct dxpl */
+ if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, loc_id, TRUE) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists")
loc_params.type = H5VL_OBJECT_BY_IDX;
loc_params.loc_data.loc_by_idx.name = group_name;
@@ -779,7 +812,7 @@ H5Ldelete_by_idx(hid_t loc_id, const char *group_name,
/* Delete the link through the VOL */
if(H5VL_link_specific(obj->vol_obj, loc_params, obj->vol_info->vol_cls, H5VL_LINK_DELETE,
- H5AC_dxpl_id, H5_REQUEST_NULL) < 0)
+ dxpl_id, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete link")
done:
@@ -812,6 +845,7 @@ H5Lget_val(hid_t loc_id, const char *name, void *buf/*out*/, size_t size,
{
H5VL_object_t *obj = NULL; /* object token of loc_id */
H5VL_loc_params_t loc_params;
+ hid_t dxpl_id = H5AC_ind_read_dxpl_id; /* dxpl used by library */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -820,11 +854,10 @@ H5Lget_val(hid_t loc_id, const char *name, void *buf/*out*/, size_t size,
/* Check arguments */
if(!name || !*name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified")
- if(H5P_DEFAULT == lapl_id)
- lapl_id = H5P_LINK_ACCESS_DEFAULT;
- else
- if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID")
+
+ /* Verify access property list and get correct dxpl */
+ if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, loc_id, FALSE) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists")
loc_params.type = H5VL_OBJECT_BY_NAME;
loc_params.obj_type = H5I_get_type(loc_id);
@@ -837,7 +870,7 @@ H5Lget_val(hid_t loc_id, const char *name, void *buf/*out*/, size_t size,
/* Get the link info through the VOL */
if(H5VL_link_get(obj->vol_obj, loc_params, obj->vol_info->vol_cls, H5VL_LINK_GET_VAL,
- H5AC_ind_dxpl_id, H5_REQUEST_NULL, buf, size) < 0)
+ dxpl_id, H5_REQUEST_NULL, buf, size) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get link value")
done:
@@ -870,6 +903,7 @@ H5Lget_val_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type,
{
H5VL_object_t *obj = NULL; /* object token of loc_id */
H5VL_loc_params_t loc_params;
+ hid_t dxpl_id = H5AC_ind_read_dxpl_id; /* dxpl used by library */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -883,11 +917,10 @@ H5Lget_val_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type,
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
- if(H5P_DEFAULT == lapl_id)
- lapl_id = H5P_LINK_ACCESS_DEFAULT;
- else
- if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID")
+
+ /* Verify access property list and get correct dxpl */
+ if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, loc_id, FALSE) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists")
loc_params.type = H5VL_OBJECT_BY_IDX;
loc_params.loc_data.loc_by_idx.name = group_name;
@@ -903,7 +936,7 @@ H5Lget_val_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type,
/* Get the link info through the VOL */
if(H5VL_link_get(obj->vol_obj, loc_params, obj->vol_info->vol_cls, H5VL_LINK_GET_VAL,
- H5AC_ind_dxpl_id, H5_REQUEST_NULL, buf, size) < 0)
+ dxpl_id, H5_REQUEST_NULL, buf, size) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get link value")
done:
@@ -929,6 +962,7 @@ H5Lexists(hid_t loc_id, const char *name, hid_t lapl_id)
{
H5VL_object_t *obj = NULL; /* object token of loc_id */
H5VL_loc_params_t loc_params;
+ hid_t dxpl_id = H5AC_ind_read_dxpl_id; /* dxpl used by library */
htri_t ret_value;
FUNC_ENTER_API(FAIL)
@@ -937,11 +971,10 @@ H5Lexists(hid_t loc_id, const char *name, hid_t lapl_id)
/* Check arguments */
if(!name || !*name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified")
- if(H5P_DEFAULT == lapl_id)
- lapl_id = H5P_LINK_ACCESS_DEFAULT;
- else
- if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID")
+
+ /* Verify access property list and get correct dxpl */
+ if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, loc_id, FALSE) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists")
loc_params.type = H5VL_OBJECT_BY_NAME;
loc_params.obj_type = H5I_get_type(loc_id);
@@ -954,7 +987,7 @@ H5Lexists(hid_t loc_id, const char *name, hid_t lapl_id)
/* check link existence through the VOL */
if(H5VL_link_specific(obj->vol_obj, loc_params, obj->vol_info->vol_cls, H5VL_LINK_EXISTS,
- H5AC_ind_dxpl_id, H5_REQUEST_NULL, &ret_value) < 0)
+ dxpl_id, H5_REQUEST_NULL, &ret_value) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get link info")
done:
@@ -982,6 +1015,7 @@ H5Lget_info(hid_t loc_id, const char *name, H5L_info_t *linfo /*out*/,
{
H5VL_object_t *obj = NULL; /* object token of loc_id */
H5VL_loc_params_t loc_params;
+ hid_t dxpl_id = H5AC_ind_read_dxpl_id; /* dxpl used by library */
herr_t ret_value = SUCCEED;
FUNC_ENTER_API(FAIL)
@@ -989,11 +1023,10 @@ H5Lget_info(hid_t loc_id, const char *name, H5L_info_t *linfo /*out*/,
if(!name || !*name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified")
- if(H5P_DEFAULT == lapl_id)
- lapl_id = H5P_LINK_ACCESS_DEFAULT;
- else
- if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID")
+
+ /* Verify access property list and get correct dxpl */
+ if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, loc_id, FALSE) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists")
loc_params.type = H5VL_OBJECT_BY_NAME;
loc_params.obj_type = H5I_get_type(loc_id);
@@ -1006,7 +1039,7 @@ H5Lget_info(hid_t loc_id, const char *name, H5L_info_t *linfo /*out*/,
/* Get the link info through the VOL */
if(H5VL_link_get(obj->vol_obj, loc_params, obj->vol_info->vol_cls, H5VL_LINK_GET_INFO,
- H5AC_ind_dxpl_id, H5_REQUEST_NULL, linfo) < 0)
+ dxpl_id, H5_REQUEST_NULL, linfo) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get link info")
done:
@@ -1035,6 +1068,7 @@ H5Lget_info_by_idx(hid_t loc_id, const char *group_name,
{
H5VL_object_t *obj = NULL; /* object token of loc_id */
H5VL_loc_params_t loc_params;
+ hid_t dxpl_id = H5AC_ind_read_dxpl_id; /* dxpl used by library */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -1048,11 +1082,10 @@ H5Lget_info_by_idx(hid_t loc_id, const char *group_name,
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
- if(H5P_DEFAULT == lapl_id)
- lapl_id = H5P_LINK_ACCESS_DEFAULT;
- else
- if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID")
+
+ /* Verify access property list and get correct dxpl */
+ if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, loc_id, FALSE) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists")
loc_params.type = H5VL_OBJECT_BY_IDX;
loc_params.loc_data.loc_by_idx.name = group_name;
@@ -1068,7 +1101,7 @@ H5Lget_info_by_idx(hid_t loc_id, const char *group_name,
/* Get the link info through the VOL */
if(H5VL_link_get(obj->vol_obj, loc_params, obj->vol_info->vol_cls, H5VL_LINK_GET_INFO,
- H5AC_ind_dxpl_id, H5_REQUEST_NULL, linfo) < 0)
+ dxpl_id, H5_REQUEST_NULL, linfo) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get link info")
done:
@@ -1227,6 +1260,7 @@ H5Lget_name_by_idx(hid_t loc_id, const char *group_name,
{
H5VL_object_t *obj = NULL; /* object token of loc_id */
H5VL_loc_params_t loc_params;
+ hid_t dxpl_id = H5AC_ind_read_dxpl_id; /* dxpl used by library */
ssize_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -1240,11 +1274,10 @@ H5Lget_name_by_idx(hid_t loc_id, const char *group_name,
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
- if(H5P_DEFAULT == lapl_id)
- lapl_id = H5P_LINK_ACCESS_DEFAULT;
- else
- if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID")
+
+ /* Verify access property list and get correct dxpl */
+ if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, loc_id, FALSE) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists")
loc_params.type = H5VL_OBJECT_BY_IDX;
loc_params.loc_data.loc_by_idx.name = group_name;
@@ -1260,7 +1293,7 @@ H5Lget_name_by_idx(hid_t loc_id, const char *group_name,
/* Get the link info through the VOL */
if(H5VL_link_get(obj->vol_obj, loc_params, obj->vol_info->vol_cls, H5VL_LINK_GET_NAME,
- H5AC_ind_dxpl_id, H5_REQUEST_NULL, name, size, &ret_value) < 0)
+ dxpl_id, H5_REQUEST_NULL, name, size, &ret_value) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get link name")
done:
@@ -1322,7 +1355,7 @@ H5Literate(hid_t id, H5_index_t idx_type, H5_iter_order_t order,
/* iterate over the links through the VOL */
if((ret_value = H5VL_link_specific(obj->vol_obj, loc_params, obj->vol_info->vol_cls, H5VL_LINK_ITER,
- H5AC_ind_dxpl_id, H5_REQUEST_NULL,
+ H5AC_ind_read_dxpl_id, H5_REQUEST_NULL,
FALSE, idx_type, order, idx_p, op, op_data)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "link iteration failed")
@@ -1360,6 +1393,7 @@ H5Literate_by_name(hid_t loc_id, const char *group_name,
{
H5VL_object_t *obj = NULL; /* object token of loc_id */
H5VL_loc_params_t loc_params;
+ hid_t dxpl_id = H5AC_ind_read_dxpl_id; /* dxpl used by library */
herr_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -1375,11 +1409,10 @@ H5Literate_by_name(hid_t loc_id, const char *group_name,
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
if(!op)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no operator specified")
- if(H5P_DEFAULT == lapl_id)
- lapl_id = H5P_LINK_ACCESS_DEFAULT;
- else
- if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID")
+
+ /* Verify access property list and get correct dxpl */
+ if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, loc_id, FALSE) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists")
loc_params.type = H5VL_OBJECT_BY_NAME;
loc_params.obj_type = H5I_get_type(loc_id);
@@ -1392,8 +1425,7 @@ H5Literate_by_name(hid_t loc_id, const char *group_name,
/* iterate over the links through the VOL */
if((ret_value = H5VL_link_specific(obj->vol_obj, loc_params, obj->vol_info->vol_cls, H5VL_LINK_ITER,
- H5AC_ind_dxpl_id, H5_REQUEST_NULL,
- FALSE, idx_type, order, idx_p, op, op_data)) < 0)
+ dxpl_id, H5_REQUEST_NULL, FALSE, idx_type, order, idx_p, op, op_data)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "link iteration failed")
done:
@@ -1462,7 +1494,7 @@ H5Lvisit(hid_t grp_id, H5_index_t idx_type, H5_iter_order_t order,
/* iterate over the links through the VOL */
if((ret_value = H5VL_link_specific(obj->vol_obj, loc_params, obj->vol_info->vol_cls, H5VL_LINK_ITER,
- H5AC_ind_dxpl_id, H5_REQUEST_NULL,
+ H5AC_ind_read_dxpl_id, H5_REQUEST_NULL,
TRUE, idx_type, order, NULL, op, op_data)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "link visit failed")
@@ -1505,6 +1537,7 @@ H5Lvisit_by_name(hid_t loc_id, const char *group_name, H5_index_t idx_type,
{
H5VL_object_t *obj = NULL; /* object token of loc_id */
H5VL_loc_params_t loc_params;
+ hid_t dxpl_id = H5AC_ind_read_dxpl_id; /* dxpl used by library */
herr_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -1520,11 +1553,10 @@ H5Lvisit_by_name(hid_t loc_id, const char *group_name, H5_index_t idx_type,
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
if(!op)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback operator specified")
- if(H5P_DEFAULT == lapl_id)
- lapl_id = H5P_LINK_ACCESS_DEFAULT;
- else
- if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID")
+
+ /* Verify access property list and get correct dxpl */
+ if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, loc_id, FALSE) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists")
loc_params.type = H5VL_OBJECT_BY_NAME;
loc_params.obj_type = H5I_get_type(loc_id);
@@ -1537,7 +1569,7 @@ H5Lvisit_by_name(hid_t loc_id, const char *group_name, H5_index_t idx_type,
/* visit the links through the VOL */
if((ret_value = H5VL_link_specific(obj->vol_obj, loc_params, obj->vol_info->vol_cls, H5VL_LINK_ITER,
- H5AC_ind_dxpl_id, H5_REQUEST_NULL,
+ dxpl_id, H5_REQUEST_NULL,
TRUE, idx_type, order, NULL, op, op_data)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "link visit failed")
@@ -2934,9 +2966,10 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5L_exists_cb
+ * Function: H5L__exists_final_cb
*
- * Purpose: Callback for checking whether a link exists
+ * Purpose: Callback for checking whether a link exists, as the final
+ * component of a path
*
* Return: Non-negative on success/Negative on failure
*
@@ -2946,23 +2979,152 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5L_exists_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc/*in*/, const char H5_ATTR_UNUSED *name,
+H5L__exists_final_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc/*in*/, const char H5_ATTR_UNUSED *name,
const H5O_link_t *lnk, H5G_loc_t H5_ATTR_UNUSED *obj_loc, void *_udata/*in,out*/,
H5G_own_loc_t *own_loc/*out*/)
{
- hbool_t *udata = (hbool_t *)_udata; /* User data passed in */
+ H5L_trav_le_t *udata = (H5L_trav_le_t *)_udata; /* User data passed in */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Check if the name in this group resolved to a valid link */
- *udata = (hbool_t)(lnk != NULL);
+ udata->exists = (hbool_t)(lnk != NULL);
/* Indicate that this callback didn't take ownership of the group *
* location for the object */
*own_loc = H5G_OWN_NONE;
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5L_exists_cb() */
+} /* end H5L__exists_final_cb() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5L__exists_inter_cb
+ *
+ * Purpose: Callback for checking whether a link exists, as an intermediate
+ * component of a path
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Thursday, December 31 2015
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5L__exists_inter_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc/*in*/, const char H5_ATTR_UNUSED *name,
+ const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/,
+ H5G_own_loc_t *own_loc/*out*/)
+{
+ H5L_trav_le_t *udata = (H5L_trav_le_t *)_udata; /* User data passed in */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check if the name in this group resolved to a valid link */
+ if(lnk != NULL) {
+ /* Check for more components to the path */
+ if(udata->sep) {
+ H5G_traverse_t cb_func; /* Callback function for tranversal */
+ char *next; /* Pointer to next component name */
+
+ /* Look for another separator */
+ next = udata->sep;
+ if(NULL == (udata->sep = HDstrchr(udata->sep, '/')))
+ cb_func = H5L__exists_final_cb;
+ else {
+ /* Chew through adjacent separators, if present */
+ do {
+ *udata->sep = '\0';
+ udata->sep++;
+ } while('/' == *udata->sep);
+ cb_func = H5L__exists_inter_cb;
+ } /* end else */
+ if(H5G_traverse(obj_loc, next, H5G_TARGET_SLINK | H5G_TARGET_UDLINK, cb_func, udata, udata->lapl_id, udata->dxpl_id) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't determine if link exists")
+ } /* end if */
+ else
+ udata->exists = TRUE;
+ } /* end if */
+ else
+ udata->exists = FALSE;
+
+ /* Indicate that this callback didn't take ownership of the group *
+ * location for the object */
+ *own_loc = H5G_OWN_NONE;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5L__exists_inter_cb() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5L_exists_tolerant
+ *
+ * Purpose: Returns whether a link exists in a group
+ *
+ * Note: Same as H5L_exists, except that missing links are reported
+ * as 'FALSE' instead of causing failures
+ *
+ * Return: Non-negative (TRUE/FALSE) on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Thursday, December 31 2015
+ *
+ *-------------------------------------------------------------------------
+ */
+htri_t
+H5L_exists_tolerant(const H5G_loc_t *loc, const char *name, hid_t lapl_id, hid_t dxpl_id)
+{
+ H5L_trav_le_t udata; /* User data for traversal */
+ H5G_traverse_t cb_func; /* Callback function for tranversal */
+ char *name_copy = NULL; /* Duplicate of name */
+ char *name_trav; /* Name to traverse */
+ htri_t ret_value = FAIL; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity checks */
+ HDassert(loc);
+ HDassert(name);
+
+ /* Copy the name and skip leading '/'s */
+ name_trav = name_copy = H5MM_strdup(name);
+ while('/' == *name_trav)
+ name_trav++;
+
+ /* A path of "/" will always exist in a file */
+ if('\0' == *name_trav)
+ HGOTO_DONE(TRUE)
+
+ /* Set up user data & correct callback */
+ udata.lapl_id = lapl_id;
+ udata.dxpl_id = dxpl_id;
+ udata.exists = FALSE;
+ if(NULL == (udata.sep = HDstrchr(name_trav, '/')))
+ cb_func = H5L__exists_final_cb;
+ else {
+ /* Chew through adjacent separators, if present */
+ do {
+ *udata.sep = '\0';
+ udata.sep++;
+ } while('/' == *udata.sep);
+ cb_func = H5L__exists_inter_cb;
+ } /* end else */
+
+ /* Traverse the group hierarchy to locate the link to check */
+ if(H5G_traverse(loc, name_trav, H5G_TARGET_SLINK | H5G_TARGET_UDLINK, cb_func, &udata, lapl_id, dxpl_id) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't determine if link exists")
+
+ /* Set return value */
+ ret_value = (htri_t)udata.exists;
+
+done:
+ /* Release duplicated string */
+ H5MM_xfree(name_copy);
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5L_exists_tolerant() */
/*-------------------------------------------------------------------------
@@ -2970,6 +3132,9 @@ H5L_exists_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc/*in*/, const char H5_ATTR_UNUSED
*
* Purpose: Returns whether a link exists in a group
*
+ * Note: Same as H5L_exists_tolerant, except that missing links are reported
+ * as failures
+ *
* Return: Non-negative (TRUE/FALSE) on success/Negative on failure
*
* Programmer: Quincey Koziol
@@ -2980,17 +3145,22 @@ H5L_exists_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc/*in*/, const char H5_ATTR_UNUSED
htri_t
H5L_exists(const H5G_loc_t *loc, const char *name, hid_t lapl_id, hid_t dxpl_id)
{
- hbool_t exists = FALSE; /* Whether the link exists in the group */
+ H5L_trav_le_t udata; /* User data for traversal */
htri_t ret_value = FAIL; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
+ /* A path of "/" will always exist in a file */
+ if(0 == HDstrcmp(name, "/"))
+ HGOTO_DONE(TRUE)
+
/* Traverse the group hierarchy to locate the object to get info about */
- if(H5G_traverse(loc, name, H5G_TARGET_SLINK|H5G_TARGET_UDLINK, H5L_exists_cb, &exists, lapl_id, dxpl_id) < 0)
+ udata.exists = FALSE;
+ if(H5G_traverse(loc, name, H5G_TARGET_SLINK | H5G_TARGET_UDLINK, H5L__exists_final_cb, &udata, lapl_id, dxpl_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_EXISTS, FAIL, "path doesn't exist")
/* Set return value */
- ret_value = (htri_t)exists;
+ ret_value = (htri_t)udata.exists;
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -3400,7 +3570,7 @@ herr_t H5L_iterate(void *obj, H5VL_loc_params_t loc_params, hbool_t recursive,
H5L_iterate_t op, void *op_data, hid_t dxpl_id)
{
H5G_loc_t loc;
- herr_t ret_value; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
diff --git a/src/H5Lexternal.c b/src/H5Lexternal.c
index 88f7497..0c31375 100644
--- a/src/H5Lexternal.c
+++ b/src/H5Lexternal.c
@@ -223,6 +223,7 @@ H5L_extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group,
char *actual_file_name = NULL; /* Parent file's actual name */
H5P_genplist_t *fa_plist; /* File access property list pointer */
H5F_close_degree_t fc_degree = H5F_CLOSE_WEAK; /* File close degree for target file */
+ hid_t dxpl_id = H5AC_ind_read_dxpl_id; /* dxpl used by library */
hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -246,6 +247,10 @@ H5L_extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group,
if(NULL == (plist = H5P_object_verify(lapl_id, H5P_LINK_ACCESS)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ /* Verify access property list and get correct dxpl */
+ if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, cur_group, FALSE) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists")
+
/* Get the fapl_id set for lapl_id if any */
if(H5P_get(plist, H5L_ACS_ELINK_FAPL_NAME, &fapl_id) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fapl for links")
@@ -283,7 +288,7 @@ H5L_extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group,
parent_file_name = H5F_OPEN_NAME(loc.oloc->file);
/* Query length of parent group name */
- if((group_name_len = H5G_get_name(&loc, NULL, (size_t) 0, NULL, lapl_id, H5AC_ind_dxpl_id)) < 0)
+ if((group_name_len = H5G_get_name(&loc, NULL, (size_t) 0, NULL, lapl_id, dxpl_id)) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to retrieve length of group name")
/* Account for null terminator */
@@ -298,7 +303,7 @@ H5L_extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group,
parent_group_name = local_group_name;
/* Get parent group name */
- if(H5G_get_name(&loc, parent_group_name, (size_t) group_name_len, NULL, lapl_id, H5AC_ind_dxpl_id) < 0)
+ if(H5G_get_name(&loc, parent_group_name, (size_t) group_name_len, NULL, lapl_id, dxpl_id) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to retrieve group name")
/* Make callback */
@@ -329,7 +334,7 @@ H5L_extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group,
/* target file_name is an absolute pathname: see RM for detailed description */
if(H5_CHECK_ABSOLUTE(file_name) || H5_CHECK_ABS_PATH(file_name)) {
/* Try opening file */
- if(NULL == (ext_file = H5F_efc_open(loc.oloc->file, file_name, intent, H5P_FILE_CREATE_DEFAULT, fapl_id, H5AC_dxpl_id))) {
+ if(NULL == (ext_file = H5F_efc_open(loc.oloc->file, file_name, intent, H5P_FILE_CREATE_DEFAULT, fapl_id, dxpl_id))) {
char *ptr;
H5E_clear_stack(NULL);
@@ -348,7 +353,7 @@ H5L_extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group,
} /* end if */
else if(H5_CHECK_ABS_DRIVE(file_name)) {
/* Try opening file */
- if(NULL == (ext_file = H5F_efc_open(loc.oloc->file, file_name, intent, H5P_FILE_CREATE_DEFAULT, fapl_id, H5AC_dxpl_id))) {
+ if(NULL == (ext_file = H5F_efc_open(loc.oloc->file, file_name, intent, H5P_FILE_CREATE_DEFAULT, fapl_id, dxpl_id))) {
H5E_clear_stack(NULL);
@@ -378,7 +383,7 @@ H5L_extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group,
HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't prepend prefix to filename")
} /* end if */
- ext_file = H5F_efc_open(loc.oloc->file, full_name, intent, H5P_FILE_CREATE_DEFAULT, fapl_id, H5AC_dxpl_id);
+ ext_file = H5F_efc_open(loc.oloc->file, full_name, intent, H5P_FILE_CREATE_DEFAULT, fapl_id, dxpl_id);
full_name = (char *)H5MM_xfree(full_name);
if(ext_file != NULL)
break;
@@ -396,7 +401,7 @@ H5L_extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group,
if(my_prefix) {
if(H5L_build_name(my_prefix, temp_file_name, &full_name/*out*/) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't prepend prefix to filename")
- if(NULL == (ext_file = H5F_efc_open(loc.oloc->file, full_name, intent, H5P_FILE_CREATE_DEFAULT, fapl_id, H5AC_dxpl_id)))
+ if(NULL == (ext_file = H5F_efc_open(loc.oloc->file, full_name, intent, H5P_FILE_CREATE_DEFAULT, fapl_id, dxpl_id)))
H5E_clear_stack(NULL);
full_name = (char *)H5MM_xfree(full_name);
} /* end if */
@@ -409,7 +414,7 @@ H5L_extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group,
if(NULL != (extpath = H5F_EXTPATH(loc.oloc->file))) {
if(H5L_build_name(extpath, temp_file_name, &full_name/*out*/) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't prepend prefix to filename")
- if(NULL == (ext_file = H5F_efc_open(loc.oloc->file, full_name, intent, H5P_FILE_CREATE_DEFAULT, fapl_id, H5AC_dxpl_id)))
+ if(NULL == (ext_file = H5F_efc_open(loc.oloc->file, full_name, intent, H5P_FILE_CREATE_DEFAULT, fapl_id, dxpl_id)))
H5E_clear_stack(NULL);
full_name = (char *)H5MM_xfree(full_name);
} /* end if */
@@ -417,7 +422,7 @@ H5L_extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group,
/* try the relative file_name stored in temp_file_name */
if(ext_file == NULL) {
- if(NULL == (ext_file = H5F_efc_open(loc.oloc->file, temp_file_name, intent, H5P_FILE_CREATE_DEFAULT, fapl_id, H5AC_dxpl_id)))
+ if(NULL == (ext_file = H5F_efc_open(loc.oloc->file, temp_file_name, intent, H5P_FILE_CREATE_DEFAULT, fapl_id, dxpl_id)))
H5E_clear_stack(NULL);
} /* end if */
@@ -444,7 +449,7 @@ H5L_extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group,
HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't prepend prefix to filename")
/* Try opening with the resolved name */
- if(NULL == (ext_file = H5F_efc_open(loc.oloc->file, full_name, intent, H5P_FILE_CREATE_DEFAULT, fapl_id, H5AC_dxpl_id)))
+ if(NULL == (ext_file = H5F_efc_open(loc.oloc->file, full_name, intent, H5P_FILE_CREATE_DEFAULT, fapl_id, dxpl_id)))
HGOTO_ERROR(H5E_LINK, H5E_CANTOPENFILE, FAIL, "unable to open external file, external link file name = '%s', temp_file_name = '%s'", file_name, temp_file_name)
full_name = (char *)H5MM_xfree(full_name);
} /* end if */
@@ -455,7 +460,7 @@ H5L_extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group,
HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "unable to create location for file")
/* Open the object referenced in the external file */
- if((ext_obj = H5O_open_name(&root_loc, obj_name, lapl_id, FALSE)) < 0)
+ if((ext_obj = H5O_open_name(&root_loc, obj_name, lapl_id, dxpl_id, FALSE)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open object")
/* get the native object from the ID created by the object header and create
@@ -581,6 +586,7 @@ H5Lcreate_external(const char *file_name, const char *obj_name,
H5VL_loc_params_t loc_params;
H5P_genplist_t *plist; /* Property list pointer */
H5L_type_t link_type = H5L_TYPE_EXTERNAL;
+ hid_t dxpl_id = H5AC_ind_read_dxpl_id; /* dxpl used by library */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -617,6 +623,10 @@ H5Lcreate_external(const char *file_name, const char *obj_name,
p += file_name_len;
HDstrncpy((char *)p, norm_obj_name, buf_size - (file_name_len + 1)); /* External link's object */
+ /* Verify access property list and get correct dxpl */
+ if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, link_loc_id, TRUE) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists")
+
loc_params.type = H5VL_OBJECT_BY_NAME;
loc_params.loc_data.loc_by_name.name = link_name;
loc_params.loc_data.loc_by_name.lapl_id = lapl_id;
@@ -640,7 +650,7 @@ H5Lcreate_external(const char *file_name, const char *obj_name,
/* Create the link through the VOL */
if((ret_value = H5VL_link_create(H5VL_LINK_CREATE_UD, obj->vol_obj, loc_params, obj->vol_info->vol_cls,
- lcpl_id, lapl_id, H5AC_dxpl_id, H5_REQUEST_NULL)) < 0)
+ lcpl_id, lapl_id, dxpl_id, H5_REQUEST_NULL)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link")
done:
diff --git a/src/H5Lprivate.h b/src/H5Lprivate.h
index badd18e..2336016 100644
--- a/src/H5Lprivate.h
+++ b/src/H5Lprivate.h
@@ -128,13 +128,15 @@ H5_DLL hid_t H5L_get_default_lcpl(void);
H5_DLL herr_t H5L_move(H5G_loc_t *src_loc, const char *src_name,
H5G_loc_t *dst_loc, const char *dst_name, hbool_t copy_flag,
hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id);
+H5_DLL htri_t H5L_exists_tolerant(const H5G_loc_t *loc, const char *name, hid_t lapl_id,
+ hid_t dxpl_id);
+H5_DLL htri_t H5L_exists(const H5G_loc_t *loc, const char *name, hid_t lapl_id, hid_t dxpl_id);
H5_DLL herr_t H5L_get_info(const H5G_loc_t *loc, const char *name,
H5L_info_t *linkbuf/*out*/, hid_t lapl_id, hid_t dxpl_id);
H5_DLL herr_t H5L_delete(H5G_loc_t *loc, const char *name, hid_t lapl_id,
hid_t dxpl_id);
H5_DLL herr_t H5L_delete_by_idx(H5G_loc_t *loc, const char *name,
void *udata, hid_t lapl_id, hid_t dxpl_id);
-H5_DLL htri_t H5L_exists(const H5G_loc_t *loc, const char *name, hid_t lapl_id, hid_t dxpl_id);
H5_DLL herr_t H5L_get_info_by_idx(H5G_loc_t *loc, const char *name, void *udata,
hid_t lapl_id, hid_t dxpl_id);
H5_DLL herr_t H5L_get_name_by_idx(H5G_loc_t *loc, const char *name, void *udata,
diff --git a/src/H5MF.c b/src/H5MF.c
index 52ea82a..15e7a96 100644
--- a/src/H5MF.c
+++ b/src/H5MF.c
@@ -1032,7 +1032,7 @@ H5MF_try_shrink(H5F_t *f, H5FD_mem_t alloc_type, hid_t dxpl_id, haddr_t addr,
H5MF_sect_ud_t udata; /* User data for callback */
H5P_genplist_t *dxpl = NULL; /* DXPL for setting ring */
H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */
- htri_t ret_value = FAIL; /* Return value */
+ htri_t ret_value = FAIL; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
#ifdef H5MF_ALLOC_DEBUG
@@ -1237,7 +1237,7 @@ HDfprintf(stderr, "%s: Entering\n", FUNC);
/* Write free-space manager info message to superblock extension object header */
/* Create the superblock extension object header in advance if needed */
- if(H5F_super_ext_write_msg(f, dxpl_id, &fsinfo, H5O_FSINFO_ID, TRUE) < 0)
+ if(H5F_super_ext_write_msg(f, dxpl_id, H5O_FSINFO_ID, &fsinfo, TRUE) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_WRITEERROR, FAIL, "error in writing message to superblock extension")
/* Re-allocate free-space manager header and/or section info header */
@@ -1272,7 +1272,7 @@ HDfprintf(stderr, "%s: Entering\n", FUNC);
/* Update the free space manager info message in superblock extension object header */
if(update)
- if(H5F_super_ext_write_msg(f, dxpl_id, &fsinfo, H5O_FSINFO_ID, FALSE) < 0)
+ if(H5F_super_ext_write_msg(f, dxpl_id, H5O_FSINFO_ID, &fsinfo, FALSE) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_WRITEERROR, FAIL, "error in writing message to superblock extension")
/* Final close of free-space managers */
diff --git a/src/H5MFprivate.h b/src/H5MFprivate.h
index 024cc91..766834d 100644
--- a/src/H5MFprivate.h
+++ b/src/H5MFprivate.h
@@ -21,8 +21,6 @@
*
* Purpose: Private header file for file memory management.
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
#ifndef _H5MFprivate_H
@@ -36,13 +34,6 @@
/* Library Private Macros */
/**************************/
-/*
- * Feature: Define H5MF_DEBUG on the compiler command line if you want to
- * see diagnostics from this layer.
- */
-#ifdef NDEBUG
-# undef H5MF_DEBUG
-#endif
/****************************/
/* Library Private Typedefs */
diff --git a/src/H5MFsection.c b/src/H5MFsection.c
index f333356..e5a0cf0 100644
--- a/src/H5MFsection.c
+++ b/src/H5MFsection.c
@@ -66,7 +66,7 @@ static htri_t H5MF_sect_simple_can_merge(const H5FS_section_info_t *sect1,
static herr_t H5MF_sect_simple_merge(H5FS_section_info_t *sect1,
H5FS_section_info_t *sect2, void *udata);
static herr_t H5MF_sect_simple_valid(const H5FS_section_class_t *cls,
- const H5FS_section_info_t *sect);
+ const H5FS_section_info_t *sect, hid_t dxpl_id);
static H5FS_section_info_t *H5MF_sect_simple_split(H5FS_section_info_t *sect,
hsize_t frag_size);
@@ -488,7 +488,7 @@ H5MF_sect_simple_valid(const H5FS_section_class_t H5_ATTR_UNUSED *cls,
#ifdef NDEBUG
H5_ATTR_UNUSED
#endif /* NDEBUG */
- *_sect)
+ *_sect, hid_t H5_ATTR_UNUSED dxpl_id)
{
#ifndef NDEBUG
const H5MF_free_section_t *sect = (const H5MF_free_section_t *)_sect; /* File free section */
diff --git a/src/H5MM.c b/src/H5MM.c
index a37bbff..5c2a731 100644
--- a/src/H5MM.c
+++ b/src/H5MM.c
@@ -25,9 +25,225 @@
*/
-#include "H5private.h"
-#include "H5Eprivate.h"
-#include "H5MMprivate.h"
+/****************/
+/* Module Setup */
+/****************/
+
+
+/***********/
+/* Headers */
+/***********/
+#include "H5private.h" /* Generic Functions */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5MMprivate.h" /* Memory management */
+
+
+/****************/
+/* Local Macros */
+/****************/
+#if defined H5_MEMORY_ALLOC_SANITY_CHECK
+#define H5MM_SIG_SIZE 4
+#define H5MM_HEAD_GUARD_SIZE 8
+#define H5MM_TAIL_GUARD_SIZE 8
+#define H5MM_BLOCK_FROM_BUF(mem) ((H5MM_block_t *)((unsigned char *)mem - (offsetof(H5MM_block_t, b) + H5MM_HEAD_GUARD_SIZE)))
+#endif /* H5_MEMORY_ALLOC_SANITY_CHECK */
+
+
+/******************/
+/* Local Typedefs */
+/******************/
+
+#if defined H5_MEMORY_ALLOC_SANITY_CHECK
+/* Memory allocation "block", wrapped around each allocation */
+struct H5MM_block_t; /* Forward declaration for typedef */
+typedef struct H5MM_block_t {
+ unsigned char sig[H5MM_SIG_SIZE]; /* Signature for the block, to indicate it was allocated with H5MM* interface */
+ struct H5MM_block_t *next; /* Pointer to next block in the list of allocated blocks */
+ struct H5MM_block_t *prev; /* Pointer to previous block in the list of allocated blocks */
+ union {
+ struct {
+ size_t size; /* Size of allocated block */
+ hbool_t in_use; /* Whether the block is in use or is free */
+ } info;
+ double _align; /* Align following buffer (b) to double boundary (unused) */
+ } u;
+ unsigned char b[]; /* Buffer for caller (includes header and footer) */
+} H5MM_block_t;
+#endif /* H5_MEMORY_ALLOC_SANITY_CHECK */
+
+
+/********************/
+/* Local Prototypes */
+/********************/
+#if defined H5_MEMORY_ALLOC_SANITY_CHECK
+static hbool_t H5MM__is_our_block(void *mem);
+static void H5MM__sanity_check_block(const H5MM_block_t *block);
+static void H5MM__sanity_check(void *mem);
+#endif /* H5_MEMORY_ALLOC_SANITY_CHECK */
+
+
+/*********************/
+/* Package Variables */
+/*********************/
+
+
+/*****************************/
+/* Library Private Variables */
+/*****************************/
+
+
+/*******************/
+/* Local Variables */
+/*******************/
+
+#if defined H5_MEMORY_ALLOC_SANITY_CHECK
+/* Constant strings for block signature, head & tail guards */
+static const char H5MM_block_signature_s[H5MM_SIG_SIZE] = {'H', '5', 'M', 'M'};
+static const char H5MM_block_head_guard_s[H5MM_HEAD_GUARD_SIZE] = {'D', 'E', 'A', 'D', 'B', 'E', 'E', 'F'};
+static const char H5MM_block_tail_guard_s[H5MM_TAIL_GUARD_SIZE] = {'B', 'E', 'E', 'F', 'D', 'E', 'A', 'D'};
+
+/* Flag to indicate the the interface has been initialized */
+static hbool_t H5MM_init_s = FALSE;
+
+/* Head of the list of allocated blocks */
+static H5MM_block_t H5MM_block_head_s;
+
+/* Statistics about block allocations */
+static unsigned long long H5MM_total_alloc_bytes_s = 0;
+static unsigned long long H5MM_curr_alloc_bytes_s = 0;
+static unsigned long long H5MM_peak_alloc_bytes_s = 0;
+static size_t H5MM_max_block_size_s = 0;
+static size_t H5MM_total_alloc_blocks_count_s = 0;
+static size_t H5MM_curr_alloc_blocks_count_s = 0;
+static size_t H5MM_peak_alloc_blocks_count_s = 0;
+#endif /* H5_MEMORY_ALLOC_SANITY_CHECK */
+
+
+#if defined H5_MEMORY_ALLOC_SANITY_CHECK
+
+/*-------------------------------------------------------------------------
+ * Function: H5MM__is_our_block
+ *
+ * Purpose: Try to determine if a memory buffer has been allocated through
+ * the H5MM* interface, instead of the system's malloc() routines.
+ *
+ * Return: Success: TRUE/FALSE
+ * Failure: (Can't fail)
+ *
+ * Programmer: Quincey Koziol
+ * Dec 30 2015
+ *
+ *-------------------------------------------------------------------------
+ */
+static hbool_t
+H5MM__is_our_block(void *mem)
+{
+ H5MM_block_t *block = H5MM_BLOCK_FROM_BUF(mem);
+
+ return(0 == HDmemcmp(block->sig, H5MM_block_signature_s, H5MM_SIG_SIZE));
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5MM__sanity_check_block
+ *
+ * Purpose: Check a block wrapper around a buffer to validate it.
+ *
+ * Return: N/A (void)
+ *
+ * Programmer: Quincey Koziol
+ * Dec 30 2015
+ *
+ *-------------------------------------------------------------------------
+ */
+static void
+H5MM__sanity_check_block(const H5MM_block_t *block)
+{
+ HDassert(block->u.info.size > 0);
+ HDassert(block->u.info.in_use);
+ /* Check for head & tail guards, if not head of linked list */
+ if(block->u.info.size != SIZET_MAX) {
+ HDassert(0 == HDmemcmp(block->b, H5MM_block_head_guard_s, H5MM_HEAD_GUARD_SIZE));
+ HDassert(0 == HDmemcmp(block->b + H5MM_HEAD_GUARD_SIZE + block->u.info.size, H5MM_block_tail_guard_s, H5MM_TAIL_GUARD_SIZE));
+ }
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5MM__sanity_check
+ *
+ * Purpose: Check a buffer to validate it (just calls
+ * H5MM__sanity_check_block after finding block for buffer)
+ *
+ * Return: N/A (void)
+ *
+ * Programmer: Quincey Koziol
+ * Dec 30 2015
+ *
+ *-------------------------------------------------------------------------
+ */
+static void
+H5MM__sanity_check(void *mem)
+{
+ H5MM_block_t *block = H5MM_BLOCK_FROM_BUF(mem);
+
+ H5MM__sanity_check_block(block);
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5MM_sanity_check_all
+ *
+ * Purpose: Sanity check all current memory allocations.
+ *
+ * Return: N/A (void)
+ *
+ * Programmer: Quincey Koziol
+ * Jan 5 2016
+ *
+ *-------------------------------------------------------------------------
+ */
+void
+H5MM_sanity_check_all(void)
+{
+ H5MM_block_t *curr = NULL;
+
+ curr = H5MM_block_head_s.next;
+ while(curr != &H5MM_block_head_s) {
+ H5MM__sanity_check_block(curr);
+ curr = curr->next;
+ } /* end while */
+} /* end H5MM_sanity_check_all() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5MM_final_sanity_check
+ *
+ * Purpose: Final sanity checks on memory allocation.
+ *
+ * Return: N/A (void)
+ *
+ * Programmer: Quincey Koziol
+ * Jan 1 2016
+ *
+ *-------------------------------------------------------------------------
+ */
+void
+H5MM_final_sanity_check(void)
+{
+ HDassert(0 == H5MM_curr_alloc_bytes_s);
+ HDassert(0 == H5MM_curr_alloc_blocks_count_s);
+ HDassert(H5MM_block_head_s.next == &H5MM_block_head_s);
+ HDassert(H5MM_block_head_s.prev == &H5MM_block_head_s);
+#ifdef H5MM_PRINT_MEMORY_STATS
+ HDfprintf(stderr, "%s: H5MM_total_alloc_bytes_s = %llu\n", __func__, H5MM_total_alloc_bytes_s);
+ HDfprintf(stderr, "%s: H5MM_peak_alloc_bytes_s = %llu\n", __func__, H5MM_peak_alloc_bytes_s);
+ HDfprintf(stderr, "%s: H5MM_max_block_size_s = %zu\n", __func__, H5MM_max_block_size_s);
+ HDfprintf(stderr, "%s: H5MM_total_alloc_blocks_count_s = %zu\n", __func__, H5MM_total_alloc_blocks_count_s);
+ HDfprintf(stderr, "%s: H5MM_peak_alloc_blocks_count_s = %zu\n", __func__, H5MM_peak_alloc_blocks_count_s);
+#endif /* H5MM_PRINT_MEMORY_STATS */
+}
+#endif /* H5_MEMORY_ALLOC_SANITY_CHECK */
/*-------------------------------------------------------------------------
@@ -41,9 +257,8 @@
* considered an error condition since allocations of zero
* bytes usually indicate problems.
*
- * Return: Success: Pointer new memory
- *
- * Failure: NULL
+ * Return: Success: Pointer to new memory
+ * Failure: NULL
*
* Programmer: Quincey Koziol
* Nov 8 2003
@@ -53,19 +268,68 @@
void *
H5MM_malloc(size_t size)
{
- void *ret_value;
+ void *ret_value = NULL;
HDassert(size);
/* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
FUNC_ENTER_NOAPI_NOINIT_NOERR
- if(size)
+#if defined H5_MEMORY_ALLOC_SANITY_CHECK
+ /* Initialize block list head singleton */
+ if(!H5MM_init_s) {
+ HDmemcpy(H5MM_block_head_s.sig, H5MM_block_signature_s, H5MM_SIG_SIZE);
+ H5MM_block_head_s.next = &H5MM_block_head_s;
+ H5MM_block_head_s.prev = &H5MM_block_head_s;
+ H5MM_block_head_s.u.info.size = SIZET_MAX;
+ H5MM_block_head_s.u.info.in_use = TRUE;
+
+ H5MM_init_s = TRUE;
+ } /* end if */
+#endif /* H5_MEMORY_ALLOC_SANITY_CHECK */
+
+ if(size) {
+#if defined H5_MEMORY_ALLOC_SANITY_CHECK
+ H5MM_block_t *block;
+ size_t alloc_size = sizeof(H5MM_block_t) + size + H5MM_HEAD_GUARD_SIZE + H5MM_TAIL_GUARD_SIZE;
+
+ if(NULL != (block = (H5MM_block_t *)HDmalloc(alloc_size))) {
+ /* Set up block */
+ HDmemcpy(block->sig, H5MM_block_signature_s, H5MM_SIG_SIZE);
+ block->next = H5MM_block_head_s.next;
+ H5MM_block_head_s.next = block;
+ block->next->prev = block;
+ block->prev = &H5MM_block_head_s;
+ block->u.info.size = size;
+ block->u.info.in_use = TRUE;
+ HDmemcpy(block->b, H5MM_block_head_guard_s, H5MM_HEAD_GUARD_SIZE);
+ HDmemcpy(block->b + H5MM_HEAD_GUARD_SIZE + size, H5MM_block_tail_guard_s, H5MM_TAIL_GUARD_SIZE);
+
+ /* Update statistics */
+ H5MM_total_alloc_bytes_s += size;
+ H5MM_curr_alloc_bytes_s += size;
+ if(H5MM_curr_alloc_bytes_s > H5MM_peak_alloc_bytes_s)
+ H5MM_peak_alloc_bytes_s = H5MM_curr_alloc_bytes_s;
+ if(size > H5MM_max_block_size_s)
+ H5MM_max_block_size_s = size;
+ H5MM_total_alloc_blocks_count_s++;
+ H5MM_curr_alloc_blocks_count_s++;
+ if(H5MM_curr_alloc_blocks_count_s > H5MM_peak_alloc_blocks_count_s)
+ H5MM_peak_alloc_blocks_count_s = H5MM_curr_alloc_blocks_count_s;
+
+ /* Set buffer to return */
+ ret_value = block->b + H5MM_HEAD_GUARD_SIZE;
+ } /* end if */
+ else
+ ret_value = NULL;
+#else /* H5_MEMORY_ALLOC_SANITY_CHECK */
ret_value = HDmalloc(size);
+#endif /* H5_MEMORY_ALLOC_SANITY_CHECK */
+ } /* end if */
else
ret_value = NULL;
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5MM_malloc() */
@@ -82,9 +346,8 @@ H5MM_malloc(size_t size)
* bytes usually indicate problems.
*
*
- * Return: Success: Pointer new memory
- *
- * Failure: NULL
+ * Return: Success: Pointer to new memory
+ * Failure: NULL
*
* Programmer: Quincey Koziol
* Nov 8 2003
@@ -94,19 +357,25 @@ H5MM_malloc(size_t size)
void *
H5MM_calloc(size_t size)
{
- void *ret_value;
+ void *ret_value = NULL;
HDassert(size);
/* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
FUNC_ENTER_NOAPI_NOINIT_NOERR
- if(size)
+ if(size) {
+#if defined H5_MEMORY_ALLOC_SANITY_CHECK
+ if(NULL != (ret_value = H5MM_malloc(size)))
+ HDmemset(ret_value, 0, size);
+#else /* H5_MEMORY_ALLOC_SANITY_CHECK */
ret_value = HDcalloc((size_t)1, size);
+#endif /* H5_MEMORY_ALLOC_SANITY_CHECK */
+ } /* end if */
else
ret_value = NULL;
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5MM_calloc() */
@@ -123,10 +392,9 @@ H5MM_calloc(size_t size)
* Note that the (NULL, 0) combination is undefined behavior
* in the C standard.
*
- * Return: Success: Ptr to new memory if size > 0
- * NULL if size is zero
- *
- * Failure: NULL (input buffer is unchanged on failure)
+ * Return: Success: Ptr to new memory if size > 0
+ * NULL if size is zero
+ * Failure: NULL (input buffer is unchanged on failure)
*
* Programmer: Robb Matzke
* Jul 10 1997
@@ -136,24 +404,46 @@ H5MM_calloc(size_t size)
void *
H5MM_realloc(void *mem, size_t size)
{
- void *ret_value;
+ void *ret_value = NULL;
/* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
FUNC_ENTER_NOAPI_NOINIT_NOERR
HDassert(mem || size);
- if(NULL == mem && 0 == size) {
+ if(NULL == mem && 0 == size)
/* Not defined in the standard, return NULL */
ret_value = NULL;
- }
else {
+#if defined H5_MEMORY_ALLOC_SANITY_CHECK
+ if(size > 0) {
+ if(mem) {
+ if(H5MM__is_our_block(mem)) {
+ H5MM_block_t *block = H5MM_BLOCK_FROM_BUF(mem);
+ size_t old_size = block->u.info.size;
+
+ H5MM__sanity_check(mem);
+
+ ret_value = H5MM_malloc(size);
+ HDmemcpy(ret_value, mem, MIN(size, old_size));
+ H5MM_xfree(mem);
+ } /* end if */
+ else
+ ret_value = HDrealloc(mem, size);
+ }
+ else
+ ret_value = H5MM_malloc(size);
+ }
+ else
+ ret_value = H5MM_xfree(mem);
+#else /* H5_MEMORY_ALLOC_SANITY_CHECK */
ret_value = HDrealloc(mem, size);
/* Some platforms do not return NULL if size is zero. */
if(0 == size)
ret_value = NULL;
- }
+#endif /* H5_MEMORY_ALLOC_SANITY_CHECK */
+ } /* end else */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5MM_realloc() */
@@ -169,7 +459,6 @@ H5MM_realloc(void *mem, size_t size)
* Failure: abort()
*
* Programmer: Robb Matzke
- * matzke@llnl.gov
* Jul 10 1997
*-------------------------------------------------------------------------
*/
@@ -201,17 +490,16 @@ done:
* an error will be raised.
*
* Return: Success: Pointer to a new string
- * Failure: abort()
+ * Failure: NULL
*
* Programmer: Robb Matzke
- * matzke@llnl.gov
* Jul 10 1997
*-------------------------------------------------------------------------
*/
char *
H5MM_strdup(const char *s)
{
- char *ret_value;
+ char *ret_value = NULL;
FUNC_ENTER_NOAPI(NULL)
@@ -239,7 +527,6 @@ done:
* Failure: never fails
*
* Programmer: Robb Matzke
- * matzke@llnl.gov
* Jul 10 1997
*
*-------------------------------------------------------------------------
@@ -250,8 +537,38 @@ H5MM_xfree(void *mem)
/* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
FUNC_ENTER_NOAPI_NOINIT_NOERR
- if(mem)
+ if(mem) {
+#if defined H5_MEMORY_ALLOC_SANITY_CHECK
+ if(H5MM__is_our_block(mem)) {
+ H5MM_block_t *block = H5MM_BLOCK_FROM_BUF(mem);
+
+ /* Run sanity checks on this block and its neighbors */
+ H5MM__sanity_check(mem);
+ H5MM__sanity_check_block(block->next);
+ H5MM__sanity_check_block(block->prev);
+
+ /* Update statistics */
+ H5MM_curr_alloc_bytes_s -= block->u.info.size;
+ H5MM_curr_alloc_blocks_count_s--;
+
+ /* Reset block info */
+ HDmemset(block->sig, 0, H5MM_SIG_SIZE);
+ block->next->prev = block->prev;
+ block->prev->next = block->next;
+ block->next = NULL;
+ block->prev = NULL;
+ block->u.info.in_use = FALSE;
+
+ /* Free the block (finally!) */
+ HDfree(block);
+ }
+ else
+ HDfree(mem);
+#else /* H5_MEMORY_ALLOC_SANITY_CHECK */
HDfree(mem);
+#endif /* H5_MEMORY_ALLOC_SANITY_CHECK */
+ } /* end if */
- FUNC_LEAVE_NOAPI(NULL);
+ FUNC_LEAVE_NOAPI(NULL)
} /* end H5MM_xfree() */
+
diff --git a/src/H5MMprivate.h b/src/H5MMprivate.h
index 0d608b2..14bd28d 100644
--- a/src/H5MMprivate.h
+++ b/src/H5MMprivate.h
@@ -21,8 +21,6 @@
*
* Purpose: Private header for memory management.
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
#ifndef _H5MMprivate_H
@@ -33,7 +31,12 @@
/* Private headers needed by this file */
#include "H5private.h"
+#if defined H5_MEMORY_ALLOC_SANITY_CHECK
+/*#define H5MM_PRINT_MEMORY_STATS */
+#define H5MM_free(Z) H5MM_xfree(Z)
+#else /* H5_MEMORY_ALLOC_SANITY_CHECK */
#define H5MM_free(Z) HDfree(Z)
+#endif /* H5_MEMORY_ALLOC_SANITY_CHECK */
/*
* Library prototypes...
@@ -44,5 +47,10 @@ H5_DLL void *H5MM_realloc(void *mem, size_t size);
H5_DLL char *H5MM_xstrdup(const char *s);
H5_DLL char *H5MM_strdup(const char *s);
H5_DLL void *H5MM_xfree(void *mem);
+#if defined H5_MEMORY_ALLOC_SANITY_CHECK
+H5_DLL void H5MM_sanity_check_all(void);
+H5_DLL void H5MM_final_sanity_check(void);
+#endif /* H5_MEMORY_ALLOC_SANITY_CHECK */
+
+#endif /* _H5MMprivate_H */
-#endif
diff --git a/src/H5O.c b/src/H5O.c
index 95bd9aa..d7c6a4c 100644
--- a/src/H5O.c
+++ b/src/H5O.c
@@ -109,9 +109,9 @@ const H5O_msg_class_t *const H5O_msg_class_g[] = {
H5O_MSG_EFL, /*0x0007 Data storage -- external data files */
H5O_MSG_LAYOUT, /*0x0008 Data Layout */
#ifdef H5O_ENABLE_BOGUS
- H5O_MSG_BOGUS, /*0x0009 "Bogus" (for testing) */
+ H5O_MSG_BOGUS_VALID, /*0x0009 "Bogus valid" (for testing) */
#else /* H5O_ENABLE_BOGUS */
- NULL, /*0x0009 "Bogus" (for testing) */
+ NULL, /*0x0009 "Bogus valid" (for testing) */
#endif /* H5O_ENABLE_BOGUS */
H5O_MSG_GINFO, /*0x000A Group information */
H5O_MSG_PLINE, /*0x000B Data storage -- filter pipeline */
@@ -128,6 +128,11 @@ const H5O_msg_class_t *const H5O_msg_class_g[] = {
H5O_MSG_REFCOUNT, /*0x0016 Object's ref. count */
H5O_MSG_FSINFO, /*0x0017 Free-space manager info message */
H5O_MSG_UNKNOWN, /*0x0018 Placeholder for unknown message */
+#ifdef H5O_ENABLE_BOGUS
+ H5O_MSG_BOGUS_INVALID, /*0x0019 "Bogus invalid" (for testing) */
+#else /* H5O_ENABLE_BOGUS */
+ NULL, /*0x0019 "Bogus invalid" (for testing) */
+#endif /* H5O_ENABLE_BOGUS */
};
/* Declare a free list to manage the H5O_t struct */
@@ -231,6 +236,7 @@ H5Oopen(hid_t loc_id, const char *name, hid_t lapl_id)
H5I_type_t opened_type;
void *opened_obj = NULL;
H5VL_loc_params_t loc_params;
+ hid_t dxpl_id = H5AC_ind_read_dxpl_id; /* dxpl used by library */
hid_t ret_value = FAIL;
FUNC_ENTER_API(FAIL)
@@ -239,6 +245,10 @@ H5Oopen(hid_t loc_id, const char *name, hid_t lapl_id)
if(!name || !*name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name")
+ /* Verify access property list and get correct dxpl */
+ if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, loc_id, FALSE) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access and transfer property lists")
+
/* get the location object */
if(NULL == (obj = (H5VL_object_t *)H5I_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
@@ -249,8 +259,8 @@ H5Oopen(hid_t loc_id, const char *name, hid_t lapl_id)
loc_params.obj_type = H5I_get_type(loc_id);
/* Open the object through the VOL */
- if(NULL == (opened_obj = H5VL_object_open(obj->vol_obj, loc_params, obj->vol_info->vol_cls, &opened_type,
- H5AC_dxpl_id, H5_REQUEST_NULL)))
+ if(NULL == (opened_obj = H5VL_object_open(obj->vol_obj, loc_params, obj->vol_info->vol_cls,
+ &opened_type, dxpl_id, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open object")
if((ret_value = H5VL_register_id(opened_type, opened_obj, obj->vol_info, TRUE)) < 0)
@@ -291,6 +301,7 @@ H5Oopen_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type,
H5I_type_t opened_type;
void *opened_obj = NULL;
H5VL_loc_params_t loc_params;
+ hid_t dxpl_id = H5AC_ind_read_dxpl_id; /* dxpl used by library */
hid_t ret_value = FAIL;
FUNC_ENTER_API(FAIL)
@@ -303,11 +314,10 @@ H5Oopen_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type,
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
- if(H5P_DEFAULT == lapl_id)
- lapl_id = H5P_LINK_ACCESS_DEFAULT;
- else
- if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID")
+
+ /* Verify access property list and get correct dxpl */
+ if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, loc_id, FALSE) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access and transfer property lists")
loc_params.type = H5VL_OBJECT_BY_IDX;
loc_params.loc_data.loc_by_idx.name = group_name;
@@ -316,14 +326,12 @@ H5Oopen_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type,
loc_params.loc_data.loc_by_idx.n = n;
loc_params.loc_data.loc_by_idx.lapl_id = lapl_id;
loc_params.obj_type = H5I_get_type(loc_id);
-
/* get the location object */
if(NULL == (obj = (H5VL_object_t *)H5I_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
-
/* Open the object through the VOL */
- if(NULL == (opened_obj = H5VL_object_open(obj->vol_obj, loc_params, obj->vol_info->vol_cls, &opened_type,
- H5AC_ind_dxpl_id, H5_REQUEST_NULL)))
+ if(NULL == (opened_obj = H5VL_object_open(obj->vol_obj, loc_params, obj->vol_info->vol_cls,
+ &opened_type, dxpl_id, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open object")
if((ret_value = H5VL_register_id(opened_type, opened_obj, obj->vol_info, TRUE)) < 0)
@@ -391,7 +399,7 @@ H5Oopen_by_addr(hid_t loc_id, haddr_t addr)
/* Open the object through the VOL */
if(NULL == (opened_obj = H5VL_object_open(obj->vol_obj, loc_params, obj->vol_info->vol_cls, &opened_type,
- H5AC_ind_dxpl_id, H5_REQUEST_NULL)))
+ H5AC_ind_read_dxpl_id, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open object")
if((ret_value = H5VL_register_id(opened_type, opened_obj, obj->vol_info, TRUE)) < 0)
@@ -432,6 +440,7 @@ H5Olink(hid_t obj_id, hid_t new_loc_id, const char *new_name, hid_t lcpl_id,
H5VL_loc_params_t loc_params1;
H5VL_loc_params_t loc_params2;
H5P_genplist_t *plist; /* Property list pointer */
+ hid_t dxpl_id = H5AC_ind_read_dxpl_id; /* dxpl used by library */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -454,6 +463,10 @@ H5Olink(hid_t obj_id, hid_t new_loc_id, const char *new_name, hid_t lcpl_id,
if(H5P_DEFAULT == lcpl_id)
lcpl_id = H5P_LINK_CREATE_DEFAULT;
+ /* Verify access property list and get correct dxpl */
+ if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, obj_id, TRUE) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access and transfer property lists")
+
loc_params1.type = H5VL_OBJECT_BY_SELF;
loc_params1.obj_type = H5I_get_type(obj_id);
@@ -491,7 +504,7 @@ H5Olink(hid_t obj_id, hid_t new_loc_id, const char *new_name, hid_t lcpl_id,
/* Create the link through the VOL */
if(H5VL_link_create(H5VL_LINK_CREATE_HARD, obj2->vol_obj, loc_params2,
(obj1!=NULL ? obj1->vol_info->vol_cls : obj2->vol_info->vol_cls),
- lcpl_id, lapl_id, H5AC_dxpl_id, H5_REQUEST_NULL) < 0)
+ lcpl_id, lapl_id, dxpl_id, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link")
done:
@@ -538,7 +551,7 @@ H5Oincr_refcount(hid_t object_id)
/* change the ref count through the VOL */
if(H5VL_object_specific(obj->vol_obj, loc_params, obj->vol_info->vol_cls, H5VL_OBJECT_CHANGE_REF_COUNT,
- H5AC_dxpl_id, H5_REQUEST_NULL, 1) < 0)
+ H5AC_ind_read_dxpl_id, H5_REQUEST_NULL, 1) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "modifying object link count failed")
done:
@@ -585,7 +598,7 @@ H5Odecr_refcount(hid_t object_id)
/* change the ref count through the VOL */
if(H5VL_object_specific(obj->vol_obj, loc_params, obj->vol_info->vol_cls, H5VL_OBJECT_CHANGE_REF_COUNT,
- H5AC_dxpl_id, H5_REQUEST_NULL, -1) < 0)
+ H5AC_ind_read_dxpl_id, H5_REQUEST_NULL, -1) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "modifying object link count failed")
done:
@@ -609,9 +622,10 @@ done:
htri_t
H5Oexists_by_name(hid_t loc_id, const char *name, hid_t lapl_id)
{
- H5VL_object_t *obj = NULL; /* object token of loc_id */
+ H5VL_object_t *obj = NULL; /* object token of loc_id */
H5VL_loc_params_t loc_params;
- htri_t ret_value = FAIL; /* Return value */
+ hid_t dxpl_id = H5AC_ind_read_dxpl_id; /* dxpl used by library */
+ htri_t ret_value = FAIL; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE3("t", "i*si", loc_id, name, lapl_id);
@@ -619,24 +633,23 @@ H5Oexists_by_name(hid_t loc_id, const char *name, hid_t lapl_id)
/* Check args */
if(!name || !*name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name")
- if(H5P_DEFAULT == lapl_id)
- lapl_id = H5P_LINK_ACCESS_DEFAULT;
- else
- if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID")
loc_params.type = H5VL_OBJECT_BY_NAME;
loc_params.loc_data.loc_by_name.name = name;
loc_params.loc_data.loc_by_name.lapl_id = lapl_id;
loc_params.obj_type = H5I_get_type(loc_id);
+ /* Verify access property list and get correct dxpl */
+ if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, loc_id, FALSE) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access and transfer property lists")
+
/* get the location object */
if(NULL == (obj = H5VL_get_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* change the ref count through the VOL */
if(H5VL_object_specific(obj->vol_obj, loc_params, obj->vol_info->vol_cls, H5VL_OBJECT_EXISTS,
- H5AC_ind_dxpl_id, H5_REQUEST_NULL, &ret_value) < 0)
+ dxpl_id, H5_REQUEST_NULL, &ret_value) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to determine if '%s' exists", name)
done:
@@ -679,8 +692,8 @@ H5Oget_info(hid_t loc_id, H5O_info_t *oinfo)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* Get the group info through the VOL using the location token */
- if(H5VL_object_optional(obj->vol_obj, obj->vol_info->vol_cls, H5AC_ind_dxpl_id, H5_REQUEST_NULL,
- H5VL_OBJECT_GET_INFO, loc_params, oinfo) < 0)
+ if(H5VL_object_optional(obj->vol_obj, obj->vol_info->vol_cls, H5AC_ind_read_dxpl_id,
+ H5_REQUEST_NULL, H5VL_OBJECT_GET_INFO, loc_params, oinfo) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get group info")
done:
@@ -706,6 +719,7 @@ H5Oget_info_by_name(hid_t loc_id, const char *name, H5O_info_t *oinfo, hid_t lap
{
H5VL_object_t *obj = NULL; /* object token of loc_id */
H5VL_loc_params_t loc_params;
+ hid_t dxpl_id = H5AC_ind_read_dxpl_id; /* dxpl used by library */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -716,11 +730,10 @@ H5Oget_info_by_name(hid_t loc_id, const char *name, H5O_info_t *oinfo, hid_t lap
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name")
if(!oinfo)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct")
- if(H5P_DEFAULT == lapl_id)
- lapl_id = H5P_LINK_ACCESS_DEFAULT;
- else
- if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID")
+
+ /* Verify access property list and get correct dxpl */
+ if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, loc_id, FALSE) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access and transfer property lists")
loc_params.type = H5VL_OBJECT_BY_NAME;
loc_params.loc_data.loc_by_name.name = name;
@@ -732,7 +745,7 @@ H5Oget_info_by_name(hid_t loc_id, const char *name, H5O_info_t *oinfo, hid_t lap
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* Get the group info through the VOL using the location token */
- if(H5VL_object_optional(obj->vol_obj, obj->vol_info->vol_cls, H5AC_ind_dxpl_id, H5_REQUEST_NULL,
+ if(H5VL_object_optional(obj->vol_obj, obj->vol_info->vol_cls, dxpl_id, H5_REQUEST_NULL,
H5VL_OBJECT_GET_INFO, loc_params, oinfo) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get group info")
@@ -761,6 +774,7 @@ H5Oget_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type,
{
H5VL_object_t *obj = NULL; /* object token of loc_id */
H5VL_loc_params_t loc_params;
+ hid_t dxpl_id = H5AC_ind_read_dxpl_id; /* dxpl used by library */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -776,11 +790,10 @@ H5Oget_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type,
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
if(!oinfo)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct")
- if(H5P_DEFAULT == lapl_id)
- lapl_id = H5P_LINK_ACCESS_DEFAULT;
- else
- if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID")
+
+ /* Verify access property list and get correct dxpl */
+ if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, loc_id, FALSE) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access and transfer property lists")
loc_params.type = H5VL_OBJECT_BY_IDX;
loc_params.loc_data.loc_by_idx.name = group_name;
@@ -795,7 +808,7 @@ H5Oget_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* Get the group info through the VOL using the location token */
- if(H5VL_object_optional(obj->vol_obj, obj->vol_info->vol_cls, H5AC_ind_dxpl_id, H5_REQUEST_NULL,
+ if(H5VL_object_optional(obj->vol_obj, obj->vol_info->vol_cls, dxpl_id, H5_REQUEST_NULL,
H5VL_OBJECT_GET_INFO, loc_params, oinfo) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get group info")
@@ -839,8 +852,8 @@ H5Oset_comment(hid_t obj_id, const char *comment)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* set comment on object through the VOL */
- if(H5VL_object_optional(obj->vol_obj, obj->vol_info->vol_cls, H5AC_ind_dxpl_id, H5_REQUEST_NULL,
- H5VL_OBJECT_SET_COMMENT, loc_params, comment) < 0)
+ if(H5VL_object_optional(obj->vol_obj, obj->vol_info->vol_cls, H5AC_ind_read_dxpl_id,
+ H5_REQUEST_NULL, H5VL_OBJECT_SET_COMMENT, loc_params, comment) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to set comment value")
done:
@@ -871,6 +884,7 @@ H5Oset_comment_by_name(hid_t loc_id, const char *name, const char *comment,
{
H5VL_object_t *obj = NULL; /* object token of loc_id */
H5VL_loc_params_t loc_params;
+ hid_t dxpl_id = H5AC_ind_read_dxpl_id; /* dxpl used by library */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -879,11 +893,10 @@ H5Oset_comment_by_name(hid_t loc_id, const char *name, const char *comment,
/* Check args */
if(!name || !*name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name")
- if(H5P_DEFAULT == lapl_id)
- lapl_id = H5P_LINK_ACCESS_DEFAULT;
- else
- if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID")
+
+ /* Verify access property list and get correct dxpl */
+ if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, loc_id, TRUE) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access and transfer property lists")
loc_params.type = H5VL_OBJECT_BY_NAME;
loc_params.loc_data.loc_by_name.name = name;
@@ -895,7 +908,7 @@ H5Oset_comment_by_name(hid_t loc_id, const char *name, const char *comment,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* set comment on object through the VOL */
- if(H5VL_object_optional(obj->vol_obj, obj->vol_info->vol_cls, H5AC_ind_dxpl_id, H5_REQUEST_NULL,
+ if(H5VL_object_optional(obj->vol_obj, obj->vol_info->vol_cls, dxpl_id, H5_REQUEST_NULL,
H5VL_OBJECT_SET_COMMENT, loc_params, comment) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to set comment value")
@@ -937,7 +950,7 @@ H5Oget_comment(hid_t loc_id, char *comment, size_t bufsize)
if(NULL == (obj = H5VL_get_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
- if(H5VL_object_optional(obj->vol_obj, obj->vol_info->vol_cls, H5AC_ind_dxpl_id, H5_REQUEST_NULL,
+ if(H5VL_object_optional(obj->vol_obj, obj->vol_info->vol_cls, H5AC_ind_read_dxpl_id, H5_REQUEST_NULL,
H5VL_OBJECT_GET_COMMENT, loc_params, comment, bufsize, &ret_value) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get object comment")
@@ -968,6 +981,7 @@ H5Oget_comment_by_name(hid_t loc_id, const char *name, char *comment, size_t buf
{
H5VL_object_t *obj = NULL; /* object token of loc_id */
H5VL_loc_params_t loc_params;
+ hid_t dxpl_id = H5AC_ind_read_dxpl_id; /* dxpl used by library */
ssize_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -976,11 +990,10 @@ H5Oget_comment_by_name(hid_t loc_id, const char *name, char *comment, size_t buf
/* Check args */
if(!name || !*name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name")
- if(H5P_DEFAULT == lapl_id)
- lapl_id = H5P_LINK_ACCESS_DEFAULT;
- else
- if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID")
+
+ /* Verify access property list and get correct dxpl */
+ if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, loc_id, FALSE) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access and transfer property lists")
loc_params.type = H5VL_OBJECT_BY_NAME;
loc_params.loc_data.loc_by_name.name = name;
@@ -991,7 +1004,7 @@ H5Oget_comment_by_name(hid_t loc_id, const char *name, char *comment, size_t buf
if(NULL == (obj = H5VL_get_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
- if(H5VL_object_optional(obj->vol_obj, obj->vol_info->vol_cls, H5AC_ind_dxpl_id, H5_REQUEST_NULL,
+ if(H5VL_object_optional(obj->vol_obj, obj->vol_info->vol_cls, dxpl_id, H5_REQUEST_NULL,
H5VL_OBJECT_GET_COMMENT, loc_params, comment, bufsize, &ret_value) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get object info")
@@ -1060,7 +1073,7 @@ H5Ovisit(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order,
/* iterate over the objects through the VOL */
if((ret_value = H5VL_object_specific(obj->vol_obj, loc_params, obj->vol_info->vol_cls,
- H5VL_OBJECT_VISIT, H5AC_ind_dxpl_id, H5_REQUEST_NULL,
+ H5VL_OBJECT_VISIT, H5AC_ind_read_dxpl_id, H5_REQUEST_NULL,
idx_type, order, op, op_data)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "link iteration failed")
@@ -1107,6 +1120,7 @@ H5Ovisit_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
{
H5VL_object_t *obj = NULL; /* object token of loc_id */
H5VL_loc_params_t loc_params;
+ hid_t dxpl_id = H5AC_ind_read_dxpl_id; /* dxpl used by library */
herr_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -1122,11 +1136,10 @@ H5Ovisit_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
if(!op)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback operator specified")
- if(H5P_DEFAULT == lapl_id)
- lapl_id = H5P_LINK_ACCESS_DEFAULT;
- else
- if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID")
+
+ /* Verify access property list and get correct dxpl */
+ if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, loc_id, FALSE) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access and transfer property lists")
loc_params.type = H5VL_OBJECT_BY_NAME;
loc_params.loc_data.loc_by_name.name = obj_name;
@@ -1139,7 +1152,7 @@ H5Ovisit_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
/* iterate over the objects through the VOL */
if((ret_value = H5VL_object_specific(obj->vol_obj, loc_params, obj->vol_info->vol_cls,
- H5VL_OBJECT_VISIT, H5AC_ind_dxpl_id, H5_REQUEST_NULL,
+ H5VL_OBJECT_VISIT, dxpl_id, H5_REQUEST_NULL,
idx_type, order, op, op_data)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "link iteration failed")
@@ -1270,7 +1283,7 @@ H5O_create(H5F_t *f, hid_t dxpl_id, size_t size_hint, size_t initial_rc,
/* Initialize file-specific information for object header */
store_msg_crt_idx = H5F_STORE_MSG_CRT_IDX(f);
- if(H5F_USE_LATEST_FORMAT(f) || store_msg_crt_idx || (oh_flags & H5O_HDR_ATTR_CRT_ORDER_TRACKED))
+ if(H5F_USE_LATEST_FLAGS(f, H5F_LATEST_OBJ_HEADER) || store_msg_crt_idx || (oh_flags & H5O_HDR_ATTR_CRT_ORDER_TRACKED))
oh->version = H5O_VERSION_LATEST;
else
oh->version = H5O_VERSION_1;
@@ -1464,13 +1477,12 @@ done:
*-------------------------------------------------------------------------
*/
hid_t
-H5O_open_name(H5G_loc_t *loc, const char *name, hid_t lapl_id, hbool_t app_ref)
+H5O_open_name(H5G_loc_t *loc, const char *name, hid_t lapl_id, hid_t dxpl_id, hbool_t app_ref)
{
H5G_loc_t obj_loc; /* Location used to open group */
H5G_name_t obj_path; /* Opened object group hier. path */
H5O_loc_t obj_oloc; /* Opened object object location */
hbool_t loc_found = FALSE; /* Entry at 'name' found */
- hid_t dxpl_id = H5AC_ind_dxpl_id; /* transfer property list used for this operation */
hid_t ret_value = FAIL;
FUNC_ENTER_NOAPI(FAIL)
@@ -2257,9 +2269,10 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5O_bogus_oh(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned mesg_flags)
+H5O_bogus_oh(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned bogus_id, unsigned mesg_flags)
{
size_t idx; /* Local index variable */
+ H5O_msg_class_t *type; /* Message class type */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -2269,7 +2282,8 @@ H5O_bogus_oh(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned mesg_flags)
/* Look for existing message */
for(idx = 0; idx < oh->nmesgs; idx++)
- if(H5O_MSG_BOGUS == oh->mesg[idx].type)
+ if(H5O_MSG_BOGUS_VALID == oh->mesg[idx].type ||
+ H5O_MSG_BOGUS_INVALID == oh->mesg[idx].type)
break;
/* Create a new message */
@@ -2283,8 +2297,15 @@ H5O_bogus_oh(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned mesg_flags)
/* Update the native value */
bogus->u = H5O_BOGUS_VALUE;
+ if(bogus_id == H5O_BOGUS_VALID_ID)
+ type = H5O_MSG_BOGUS_VALID;
+ else if(bogus_id == H5O_BOGUS_INVALID_ID)
+ type = H5O_MSG_BOGUS_INVALID;
+ else
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "invalid ID for 'bogus' message")
+
/* Allocate space in the object header for bogus message */
- if(H5O_msg_alloc(f, dxpl_id, oh, H5O_MSG_BOGUS, &mesg_flags, bogus, &idx) < 0)
+ if(H5O_msg_alloc(f, dxpl_id, oh, type, &mesg_flags, bogus, &idx) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to allocate space for 'bogus' message")
/* Point to "bogus" information (take it over) */
diff --git a/src/H5Oainfo.c b/src/H5Oainfo.c
index c5f692d..44c6611 100644
--- a/src/H5Oainfo.c
+++ b/src/H5Oainfo.c
@@ -324,7 +324,9 @@ H5O_ainfo_free(void *mesg)
/*-------------------------------------------------------------------------
* Function: H5O_ainfo_delete
*
- * Purpose: Free file space referenced by message
+ * Purpose: Free file space referenced by message. Note that open_oh
+ * *must* be non-NULL - this means that calls to
+ * H5O_msg_delete must include an oh if the type is ainfo.
*
* Return: Non-negative on success/Negative on failure
*
@@ -334,7 +336,7 @@ H5O_ainfo_free(void *mesg)
*-------------------------------------------------------------------------
*/
static herr_t
-H5O_ainfo_delete(H5F_t *f, hid_t dxpl_id, H5O_t H5_ATTR_UNUSED *open_oh, void *_mesg)
+H5O_ainfo_delete(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, void *_mesg)
{
H5O_ainfo_t *ainfo = (H5O_ainfo_t *)_mesg;
herr_t ret_value = SUCCEED; /* Return value */
@@ -344,11 +346,14 @@ H5O_ainfo_delete(H5F_t *f, hid_t dxpl_id, H5O_t H5_ATTR_UNUSED *open_oh, void *_
/* check args */
HDassert(f);
HDassert(ainfo);
+ HDassert(open_oh);
/* If the object is using "dense" attribute storage, delete it */
- if(H5F_addr_defined(ainfo->fheap_addr))
+ if(H5F_addr_defined(ainfo->fheap_addr)) {
+ /* Delete the attribute */
if(H5A_dense_delete(f, dxpl_id, ainfo) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to free dense attribute storage")
+ } /* end if */
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -428,7 +433,7 @@ H5O_ainfo_copy_file(H5F_t *file_src, void *mesg_src, H5F_t *file_dst,
*ainfo_dst = *ainfo_src;
if(H5F_addr_defined(ainfo_src->fheap_addr)) {
- /* copy dense attribute */
+ /* Prepare to copy dense attributes - actual copy in post_copy */
/* Set copied metadata tag */
H5_BEGIN_TAG(dxpl_id, H5AC__COPIED_TAG, NULL);
diff --git a/src/H5Oalloc.c b/src/H5Oalloc.c
index 3d930f0..99f1322 100644
--- a/src/H5Oalloc.c
+++ b/src/H5Oalloc.c
@@ -921,7 +921,7 @@ H5O_alloc_new_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, size_t size, size_t *new
oh->chunk = x;
} /* end if */
- chunkno = oh->nchunks++;
+ chunkno = (unsigned)oh->nchunks++;
oh->chunk[chunkno].addr = new_chunk_addr;
oh->chunk[chunkno].size = size;
oh->chunk[chunkno].gap = 0;
@@ -966,6 +966,8 @@ H5O_alloc_new_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, size_t size, size_t *new
oh->nmesgs--;
} /* end if */
else {
+ HDassert(curr_msg->type->id != H5O_CONT_ID);
+
/* Copy the raw data */
HDmemcpy(p, curr_msg->raw - (size_t)H5O_SIZEOF_MSGHDR_OH(oh),
curr_msg->raw_size + (size_t)H5O_SIZEOF_MSGHDR_OH(oh));
@@ -1544,13 +1546,13 @@ H5O_move_msgs_forward(H5F_t *f, hid_t dxpl_id, H5O_t *oh)
if(H5O_CONT_ID == curr_msg->type->id) {
htri_t status; /* Status from moving messages */
- if((status = H5O_move_cont(f, dxpl_id, oh, u)) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "Error in moving messages into cont message")
- else if(status > 0) { /* Message(s) got moved into "continuation" message */
+ if((status = H5O_move_cont(f, dxpl_id, oh, u)) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "Error in moving messages into cont message")
+ else if(status > 0) { /* Message(s) got moved into "continuation" message */
packed_msg = TRUE;
- break;
- } /* end else-if */
- } /* end if */
+ break;
+ } /* end else-if */
+ } /* end if */
/* Don't let locked messages be moved into earlier chunk */
if(!curr_msg->locked) {
diff --git a/src/H5Obogus.c b/src/H5Obogus.c
index de205f6..d1085c8 100644
--- a/src/H5Obogus.c
+++ b/src/H5Obogus.c
@@ -47,9 +47,9 @@ static herr_t H5O_bogus_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, FILE *
int indent, int fwidth);
/* This message derives from H5O message class */
-const H5O_msg_class_t H5O_MSG_BOGUS[1] = {{
- H5O_BOGUS_ID, /*message id number */
- "bogus", /*message name for debugging */
+const H5O_msg_class_t H5O_MSG_BOGUS_VALID[1] = {{
+ H5O_BOGUS_VALID_ID, /*message id number */
+ "bogus valid", /*message name for debugging */
0, /*native message size */
0, /* messages are sharable? */
H5O_bogus_decode, /*decode message */
@@ -70,6 +70,30 @@ const H5O_msg_class_t H5O_MSG_BOGUS[1] = {{
H5O_bogus_debug /*debug the message */
}};
+/* This message derives from H5O message class */
+const H5O_msg_class_t H5O_MSG_BOGUS_INVALID[1] = {{
+ H5O_BOGUS_INVALID_ID, /*message id number */
+ "bogus invalid", /*message name for debugging */
+ 0, /*native message size */
+ 0, /* messages are sharable? */
+ H5O_bogus_decode, /*decode message */
+ H5O_bogus_encode, /*encode message */
+ NULL, /*copy the native value */
+ H5O_bogus_size, /*raw message size */
+ NULL, /*free internal memory */
+ NULL, /*free method */
+ NULL, /* file delete method */
+ NULL, /* link method */
+ NULL, /*set share method */
+ NULL, /*can share method */
+ NULL, /* pre copy native value to file */
+ NULL, /* copy native value to file */
+ NULL, /* post copy native value to file */
+ NULL, /* get creation index */
+ NULL, /* set creation index */
+ H5O_bogus_debug /*debug the message */
+}};
+
/*-------------------------------------------------------------------------
* Function: H5O_bogus_decode
diff --git a/src/H5Ocache.c b/src/H5Ocache.c
index 945d12e..e085242 100644
--- a/src/H5Ocache.c
+++ b/src/H5Ocache.c
@@ -158,7 +158,6 @@ H5FL_SEQ_DEFINE(H5O_cont_t);
/* Local Variables */
/*******************/
-
/*-------------------------------------------------------------------------
* Function: H5O__cache_get_load_size()
@@ -1149,10 +1148,6 @@ H5O__chunk_deserialize(H5O_t *oh, haddr_t addr, size_t len, const uint8_t *image
else
id = *chunk_image++;
- /* Check for unknown message ID getting encoded in file */
- if(id >= H5O_UNKNOWN_ID)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "'unknown' message ID encoded in file?!?")
-
/* Message size */
UINT16DECODE(chunk_image, mesg_size);
HDassert(mesg_size == H5O_ALIGN_OH(oh, mesg_size));
@@ -1222,8 +1217,13 @@ H5O__chunk_deserialize(H5O_t *oh, haddr_t addr, size_t len, const uint8_t *image
/* Point unknown messages at 'unknown' message class */
/* (Usually from future versions of the library) */
- if(id >= NELMTS(H5O_msg_class_g) || NULL == H5O_msg_class_g[id]) {
- H5O_unknown_t *unknown; /* Pointer to "unknown" message info */
+ if(id >= H5O_UNKNOWN_ID ||
+#ifdef H5O_ENABLE_BOGUS
+ id == H5O_BOGUS_VALID_ID ||
+#endif
+ NULL == H5O_msg_class_g[id]) {
+
+ H5O_unknown_t *unknown; /* Pointer to "unknown" message info */
/* Allocate "unknown" message info */
if(NULL == (unknown = H5FL_MALLOC(H5O_unknown_t)))
diff --git a/src/H5Ochunk.c b/src/H5Ochunk.c
index 8abe660..18561b3 100644
--- a/src/H5Ochunk.c
+++ b/src/H5Ochunk.c
@@ -95,7 +95,7 @@ H5FL_DEFINE(H5O_chunk_proxy_t);
herr_t
H5O_chunk_add(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned idx)
{
- H5O_chunk_proxy_t *chk_proxy = NULL; /* Proxy for chunk, to mark it dirty in the cache */
+ H5O_chunk_proxy_t *chk_proxy = NULL; /* Proxy for chunk, to mark it dirty in the cache */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_TAG(dxpl_id, oh->cache_info.addr, FAIL)
@@ -121,6 +121,7 @@ H5O_chunk_add(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned idx)
/* Insert the chunk proxy into the cache */
if(H5AC_insert_entry(f, dxpl_id, H5AC_OHDR_CHK, oh->chunk[idx].addr, chk_proxy, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "unable to cache object header chunk")
+
chk_proxy = NULL;
done:
@@ -372,6 +373,7 @@ H5O_chunk_delete(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned idx)
{
H5O_chunk_proxy_t *chk_proxy; /* Proxy for chunk, to mark it dirty in the cache */
H5O_chk_cache_ud_t chk_udata; /* User data for loading chunk */
+ unsigned cache_flags = H5AC__DELETED_FLAG; /* Flags for unprotecting proxy */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_TAG(dxpl_id, oh->cache_info.addr, FAIL)
@@ -397,8 +399,10 @@ H5O_chunk_delete(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned idx)
HDassert(chk_proxy->oh == oh);
HDassert(chk_proxy->chunkno == idx);
+ cache_flags |= H5AC__DIRTIED_FLAG | H5AC__FREE_FILE_SPACE_FLAG;
+
/* Release the chunk proxy from the cache, marking it deleted */
- if(H5AC_unprotect(f, dxpl_id, H5AC_OHDR_CHK, oh->chunk[idx].addr, chk_proxy, (H5AC__DIRTIED_FLAG | H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG)) < 0)
+ if(H5AC_unprotect(f, dxpl_id, H5AC_OHDR_CHK, oh->chunk[idx].addr, chk_proxy, cache_flags) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header chunk")
done:
diff --git a/src/H5Ocopy.c b/src/H5Ocopy.c
index 90363ec..e28c620 100644
--- a/src/H5Ocopy.c
+++ b/src/H5Ocopy.c
@@ -247,7 +247,7 @@ H5Ocopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id,
/* Open the object through the VOL */
if((ret_value = H5VL_object_copy(obj1->vol_obj, loc_params1, obj1->vol_info->vol_cls, src_name,
obj2->vol_obj, loc_params2, obj2->vol_info->vol_cls, dst_name,
- ocpypl_id, lcpl_id, H5AC_dxpl_id, H5_REQUEST_NULL)) < 0)
+ ocpypl_id, lcpl_id, H5AC_ind_read_dxpl_id, H5_REQUEST_NULL)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to copy object")
done:
@@ -268,36 +268,24 @@ done:
*-------------------------------------------------------------------------
*/
herr_t H5O_copy(H5G_loc_t *loc, const char *src_name, H5G_loc_t *dst_loc, const char *dst_name,
- hid_t ocpypl_id, hid_t lcpl_id)
+ hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id)
{
H5G_loc_t src_loc; /* Source object group location */
/* for opening the destination object */
H5G_name_t src_path; /* Opened source object hier. path */
H5O_loc_t src_oloc; /* Opened source object object location */
+ htri_t dst_exists; /* Does destination name exist already? */
hbool_t loc_found = FALSE; /* Location at 'name' found */
hbool_t obj_open = FALSE; /* Entry at 'name' found */
-
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
/* check if destination name already exists */
- {
- H5G_name_t tmp_path;
- H5O_loc_t tmp_oloc;
- H5G_loc_t tmp_loc;
-
- /* Set up group location */
- tmp_loc.oloc = &tmp_oloc;
- tmp_loc.path = &tmp_path;
- H5G_loc_reset(&tmp_loc);
-
- /* Check if object already exists in destination */
- if(H5G_loc_find(dst_loc, dst_name, &tmp_loc, H5P_DEFAULT, H5AC_ind_dxpl_id) >= 0) {
- H5G_name_free(&tmp_path);
- HGOTO_ERROR(H5E_SYM, H5E_EXISTS, FAIL, "destination object already exists")
- } /* end if */
- }
+ if((dst_exists = H5L_exists_tolerant(dst_loc, dst_name, H5P_DEFAULT, dxpl_id)) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to check if destination name exists")
+ if(TRUE == dst_exists)
+ HGOTO_ERROR(H5E_OHDR, H5E_EXISTS, FAIL, "destination object already exists")
/* Set up opened group location to fill in */
src_loc.oloc = &src_oloc;
@@ -305,7 +293,7 @@ herr_t H5O_copy(H5G_loc_t *loc, const char *src_name, H5G_loc_t *dst_loc, const
H5G_loc_reset(&src_loc);
/* Find the source object to copy */
- if(H5G_loc_find(loc, src_name, &src_loc/*out*/, H5P_DEFAULT, H5AC_ind_dxpl_id) < 0)
+ if(H5G_loc_find(loc, src_name, &src_loc/*out*/, H5P_DEFAULT, dxpl_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "source object not found")
loc_found = TRUE;
@@ -315,7 +303,7 @@ herr_t H5O_copy(H5G_loc_t *loc, const char *src_name, H5G_loc_t *dst_loc, const
obj_open = TRUE;
/* Do the actual copying of the object */
- if(H5O_copy_obj(&src_loc, dst_loc, dst_name, ocpypl_id, lcpl_id, H5AC_dxpl_id) < 0)
+ if(H5O_copy_obj(&src_loc, dst_loc, dst_name, ocpypl_id, lcpl_id, dxpl_id) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object")
done:
@@ -398,17 +386,43 @@ H5O_copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out*/,
H5G_loc_t tmp_loc; /* Location of object */
H5O_loc_t tmp_oloc; /* Location of object */
H5G_name_t tmp_path; /* Object's path */
+ H5I_type_t opened_type;
+ void *obj_ptr = NULL; /* Object pointer */
+ hid_t tmp_id = -1; /* Object ID */
tmp_loc.oloc = &tmp_oloc;
tmp_loc.path = &tmp_path;
tmp_oloc.file = oloc_src->file;
tmp_oloc.addr = oloc_src->addr;
- tmp_oloc.holding_file = oloc_src->holding_file;
+ tmp_oloc.holding_file = FALSE;
H5G_name_reset(tmp_loc.path);
- /* Flush the object of this class */
- if(obj_class->flush && obj_class->flush(&tmp_loc, dxpl_id) < 0)
+ /* Get a temporary ID */
+ if((tmp_id = obj_class->open(&tmp_loc, H5P_DEFAULT, dxpl_id, FALSE)) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to open object")
+
+ opened_type = H5I_get_type (tmp_id);
+
+ /* Get object pointer */
+ obj_ptr = H5I_remove(tmp_id);
+
+ /* Flush the object */
+ if(obj_class->flush && obj_class->flush(obj_ptr, dxpl_id) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to flush object")
+
+ switch(opened_type) {
+ case H5I_GROUP:
+ H5G_close(obj_ptr);
+ break;
+ case H5I_DATATYPE:
+ H5T_close(obj_ptr);
+ break;
+ case H5I_DATASET:
+ H5D_close(obj_ptr);
+ break;
+ default:
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file object")
+ }
} /* end if */
/* Get source object header */
@@ -508,7 +522,7 @@ H5O_copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out*/,
/* Allocate memory for "deleted" array. This array marks the message in
* the source that shouldn't be copied to the destination.
*/
- if(NULL == (deleted = (hbool_t *)HDmalloc(sizeof(hbool_t) * oh_src->nmesgs)))
+ if(NULL == (deleted = (hbool_t *)H5MM_malloc(sizeof(hbool_t) * oh_src->nmesgs)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
HDmemset(deleted, FALSE, sizeof(hbool_t) * oh_src->nmesgs);
@@ -915,7 +929,7 @@ H5O_copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out*/,
done:
/* Free deleted array */
if(deleted)
- HDfree(deleted);
+ H5MM_free(deleted);
/* Release pointer to source object header and its derived objects */
if(oh_src && H5O_unprotect(oloc_src, dxpl_id, oh_src, H5AC__NO_FLAGS_SET) < 0)
diff --git a/src/H5Ofill.c b/src/H5Ofill.c
index ebcb5d3..745d027 100644
--- a/src/H5Ofill.c
+++ b/src/H5Ofill.c
@@ -527,7 +527,7 @@ H5O_fill_copy(const void *_src, void *_dst)
H5T_path_t *tpath; /* Conversion information */
/* Set up type conversion function */
- if(NULL == (tpath = H5T_path_find(src->type, dst->type, NULL, NULL, H5AC_ind_dxpl_id, FALSE)))
+ if(NULL == (tpath = H5T_path_find(src->type, dst->type, NULL, NULL, H5AC_noio_dxpl_id, FALSE)))
HGOTO_ERROR(H5E_OHDR, H5E_UNSUPPORTED, NULL, "unable to convert between src and dst data types")
/* If necessary, convert fill value datatypes (which copies VL components, etc.) */
@@ -555,7 +555,7 @@ H5O_fill_copy(const void *_src, void *_dst)
} /* end if */
/* Convert fill value */
- if(H5T_convert(tpath, src_id, dst_id, (size_t)1, (size_t)0, (size_t)0, dst->buf, bkg_buf, H5AC_ind_dxpl_id) < 0) {
+ if(H5T_convert(tpath, src_id, dst_id, (size_t)1, (size_t)0, (size_t)0, dst->buf, bkg_buf, H5AC_noio_dxpl_id) < 0) {
H5I_dec_ref(src_id);
H5I_dec_ref(dst_id);
if(bkg_buf)
@@ -709,7 +709,7 @@ H5O_fill_reset_dyn(H5O_fill_t *fill)
HGOTO_ERROR(H5E_OHDR, H5E_CANTCREATE, FAIL, "can't create scalar dataspace")
/* Reclaim any variable length components of the fill value */
- if(H5D_vlen_reclaim(fill_type_id, fill_space, H5P_DATASET_XFER_DEFAULT, fill->buf) < 0) {
+ if(H5D_vlen_reclaim(fill_type_id, fill_space, H5AC_noio_dxpl_id, fill->buf) < 0) {
H5S_close(fill_space);
HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "unable to reclaim variable-length fill value data")
} /* end if */
diff --git a/src/H5Olayout.c b/src/H5Olayout.c
index 0c13498..bc1ebc6 100644
--- a/src/H5Olayout.c
+++ b/src/H5Olayout.c
@@ -19,18 +19,18 @@
* Purpose: Messages related to data layout.
*/
-#define H5D_FRIEND /*suppress error about including H5Dpkg */
+#define H5D_FRIEND /*suppress error about including H5Dpkg */
#include "H5Omodule.h" /* This source code file is part of the H5O module */
-#include "H5private.h" /* Generic Functions */
-#include "H5Dpkg.h" /* Dataset functions */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5FLprivate.h" /* Free Lists */
-#include "H5MFprivate.h" /* File space management */
-#include "H5MMprivate.h" /* Memory management */
-#include "H5Opkg.h" /* Object headers */
-#include "H5Pprivate.h" /* Property lists */
+#include "H5private.h" /* Generic Functions */
+#include "H5Dpkg.h" /* Dataset functions */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5FLprivate.h" /* Free Lists */
+#include "H5MFprivate.h" /* File space management */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5Opkg.h" /* Object headers */
+#include "H5Pprivate.h" /* Property lists */
/* Local macros */
@@ -52,31 +52,31 @@ static herr_t H5O__layout_delete(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
static void *H5O__layout_copy_file(H5F_t *file_src, void *mesg_src,
H5F_t *file_dst, hbool_t *recompute_size, unsigned *mesg_flags,
H5O_copy_t *cpy_info, void *udata, hid_t dxpl_id);
-static herr_t H5O__layout_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, FILE * stream,
- int indent, int fwidth);
+static herr_t H5O__layout_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg,
+ FILE * stream, int indent, int fwidth);
/* This message derives from H5O message class */
const H5O_msg_class_t H5O_MSG_LAYOUT[1] = {{
- H5O_LAYOUT_ID, /*message id number */
- "layout", /*message name for debugging */
- sizeof(H5O_layout_t), /*native message size */
- 0, /* messages are sharable? */
- H5O__layout_decode, /*decode message */
- H5O__layout_encode, /*encode message */
- H5O__layout_copy, /*copy the native value */
- H5O__layout_size, /*size of message on disk */
- H5O__layout_reset, /*reset method */
- H5O__layout_free, /*free the struct */
- H5O__layout_delete, /* file delete method */
- NULL, /* link method */
- NULL, /*set share method */
- NULL, /*can share method */
- NULL, /* pre copy native value to file */
- H5O__layout_copy_file, /* copy native value to file */
- NULL, /* post copy native value to file */
- NULL, /* get creation index */
- NULL, /* set creation index */
- H5O__layout_debug /*debug the message */
+ H5O_LAYOUT_ID, /* message id number */
+ "layout", /* message name for debugging */
+ sizeof(H5O_layout_t), /* native message size */
+ 0, /* messages are sharable? */
+ H5O__layout_decode, /* decode message */
+ H5O__layout_encode, /* encode message */
+ H5O__layout_copy, /* copy the native value */
+ H5O__layout_size, /* size of message on disk */
+ H5O__layout_reset, /* reset method */
+ H5O__layout_free, /* free the struct */
+ H5O__layout_delete, /* file delete method */
+ NULL, /* link method */
+ NULL, /* set share method */
+ NULL, /* can share method */
+ NULL, /* pre copy native value to file */
+ H5O__layout_copy_file, /* copy native value to file */
+ NULL, /* post copy native value to file */
+ NULL, /* get creation index */
+ NULL, /* set creation index */
+ H5O__layout_debug /* debug the message */
}};
@@ -124,7 +124,7 @@ H5O__layout_decode(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED
HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "bad version number for layout message")
if(mesg->version < H5O_LAYOUT_VERSION_3) {
- unsigned ndims; /* Num dimensions in chunk */
+ unsigned ndims; /* Num dimensions in chunk */
/* Dimensionality */
ndims = *p++;
@@ -233,26 +233,120 @@ H5O__layout_decode(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED
break;
case H5D_CHUNKED:
- /* Dimensionality */
- mesg->u.chunk.ndims = *p++;
- if(mesg->u.chunk.ndims > H5O_LAYOUT_NDIMS)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "dimensionality is too large")
-
- /* B-tree address */
- H5F_addr_decode(f, &p, &(mesg->storage.u.chunk.idx_addr));
-
- /* Chunk dimensions */
- for(u = 0; u < mesg->u.chunk.ndims; u++)
- UINT32DECODE(p, mesg->u.chunk.dim[u]);
-
- /* Compute chunk size */
- for(u = 1, mesg->u.chunk.size = mesg->u.chunk.dim[0]; u < mesg->u.chunk.ndims; u++)
- mesg->u.chunk.size *= mesg->u.chunk.dim[u];
-
- /* Set the chunk operations */
- /* (Only "btree" indexing type supported with v3 of message format) */
- mesg->storage.u.chunk.idx_type = H5D_CHUNK_IDX_BTREE;
- mesg->storage.u.chunk.ops = H5D_COPS_BTREE;
+ if(mesg->version < H5O_LAYOUT_VERSION_4) {
+ /* Set the chunked layout flags */
+ mesg->u.chunk.flags = (uint8_t)0;
+
+ /* Dimensionality */
+ mesg->u.chunk.ndims = *p++;
+ if(mesg->u.chunk.ndims > H5O_LAYOUT_NDIMS)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "dimensionality is too large")
+
+ /* B-tree address */
+ H5F_addr_decode(f, &p, &(mesg->storage.u.chunk.idx_addr));
+
+ /* Chunk dimensions */
+ for(u = 0; u < mesg->u.chunk.ndims; u++)
+ UINT32DECODE(p, mesg->u.chunk.dim[u]);
+
+ /* Compute chunk size */
+ for(u = 1, mesg->u.chunk.size = mesg->u.chunk.dim[0]; u < mesg->u.chunk.ndims; u++)
+ mesg->u.chunk.size *= mesg->u.chunk.dim[u];
+
+ /* Set the chunk operations */
+ /* (Only "btree" indexing type supported with v3 of message format) */
+ mesg->storage.u.chunk.idx_type = H5D_CHUNK_IDX_BTREE;
+ mesg->storage.u.chunk.ops = H5D_COPS_BTREE;
+ } /* end if */
+ else {
+ /* Get the chunked layout flags */
+ mesg->u.chunk.flags = *p++;
+
+ /* Check for valid flags */
+ /* (Currently issues an error for all non-zero values,
+ * until features are added for the flags)
+ */
+ if(mesg->u.chunk.flags & ~H5O_LAYOUT_ALL_CHUNK_FLAGS)
+ HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, NULL, "bad flag value for message")
+
+ /* Dimensionality */
+ mesg->u.chunk.ndims = *p++;
+ if(mesg->u.chunk.ndims > H5O_LAYOUT_NDIMS)
+ HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, NULL, "dimensionality is too large")
+
+ /* Encoded # of bytes for each chunk dimension */
+ mesg->u.chunk.enc_bytes_per_dim = *p++;
+ if(mesg->u.chunk.enc_bytes_per_dim == 0 || mesg->u.chunk.enc_bytes_per_dim > 8)
+ HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, NULL, "encoded chunk dimension size is too large")
+
+ /* Chunk dimensions */
+ for(u = 0; u < mesg->u.chunk.ndims; u++)
+ UINT64DECODE_VAR(p, mesg->u.chunk.dim[u], mesg->u.chunk.enc_bytes_per_dim);
+
+ /* Compute chunk size */
+ for(u = 1, mesg->u.chunk.size = mesg->u.chunk.dim[0]; u < mesg->u.chunk.ndims; u++)
+ mesg->u.chunk.size *= mesg->u.chunk.dim[u];
+
+ /* Chunk index type */
+ mesg->u.chunk.idx_type = (H5D_chunk_index_t)*p++;
+ if(mesg->u.chunk.idx_type >= H5D_CHUNK_IDX_NTYPES)
+ HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, NULL, "unknown chunk index type")
+ mesg->storage.u.chunk.idx_type = mesg->u.chunk.idx_type;
+
+ switch(mesg->u.chunk.idx_type) {
+ case H5D_CHUNK_IDX_BTREE:
+ HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, NULL, "v1 B-tree index type should never be in a v4 layout message")
+ break;
+
+ case H5D_CHUNK_IDX_FARRAY:
+ /* Fixed array creation parameters */
+ mesg->u.chunk.u.farray.cparam.max_dblk_page_nelmts_bits = *p++;
+ if(0 == mesg->u.chunk.u.farray.cparam.max_dblk_page_nelmts_bits)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "invalid fixed array creation parameter")
+
+ /* Set the chunk operations */
+ mesg->storage.u.chunk.ops = H5D_COPS_FARRAY;
+ break;
+
+ case H5D_CHUNK_IDX_EARRAY:
+ /* Extensible array creation parameters */
+ mesg->u.chunk.u.earray.cparam.max_nelmts_bits = *p++;
+ if(0 == mesg->u.chunk.u.earray.cparam.max_nelmts_bits)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "invalid extensible array creation parameter")
+ mesg->u.chunk.u.earray.cparam.idx_blk_elmts = *p++;
+ if(0 == mesg->u.chunk.u.earray.cparam.idx_blk_elmts)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "invalid extensible array creation parameter")
+ mesg->u.chunk.u.earray.cparam.sup_blk_min_data_ptrs = *p++;
+ if(0 == mesg->u.chunk.u.earray.cparam.sup_blk_min_data_ptrs)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "invalid extensible array creation parameter")
+ mesg->u.chunk.u.earray.cparam.data_blk_min_elmts = *p++;
+ if(0 == mesg->u.chunk.u.earray.cparam.data_blk_min_elmts)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "invalid extensible array creation parameter")
+ mesg->u.chunk.u.earray.cparam.max_dblk_page_nelmts_bits = *p++;
+ if(0 == mesg->u.chunk.u.earray.cparam.max_dblk_page_nelmts_bits)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "invalid extensible array creation parameter")
+
+ /* Set the chunk operations */
+ mesg->storage.u.chunk.ops = H5D_COPS_EARRAY;
+ break;
+
+ case H5D_CHUNK_IDX_BT2: /* v2 B-tree index */
+ UINT32DECODE(p, mesg->u.chunk.u.btree2.cparam.node_size);
+ mesg->u.chunk.u.btree2.cparam.split_percent = *p++;
+ mesg->u.chunk.u.btree2.cparam.merge_percent = *p++;
+
+ /* Set the chunk operations */
+ mesg->storage.u.chunk.ops = H5D_COPS_BT2;
+ break;
+
+ case H5D_CHUNK_IDX_NTYPES:
+ default:
+ HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, NULL, "Invalid chunk index type")
+ } /* end switch */
+
+ /* Chunk index address */
+ H5F_addr_decode(f, &p, &(mesg->storage.u.chunk.idx_addr));
+ } /* end else */
/* Set the layout operations */
mesg->ops = H5D_LOPS_CHUNK;
@@ -457,8 +551,8 @@ H5O__layout_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p,
HDassert(p);
/* Message version */
- *p++ = mesg->type == H5D_VIRTUAL ? (uint8_t)H5O_LAYOUT_VERSION_4
- : (uint8_t)H5O_LAYOUT_VERSION_3;
+ *p++ = (uint8_t)((mesg->version < H5O_LAYOUT_VERSION_3) ?
+ H5O_LAYOUT_VERSION_3 : mesg->version);
/* Layout class */
*p++ = mesg->type;
@@ -488,16 +582,74 @@ H5O__layout_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p,
break;
case H5D_CHUNKED:
- /* Number of dimensions */
- HDassert(mesg->u.chunk.ndims > 0 && mesg->u.chunk.ndims <= H5O_LAYOUT_NDIMS);
- *p++ = (uint8_t)mesg->u.chunk.ndims;
+ if(mesg->version < H5O_LAYOUT_VERSION_4) {
+ /* Number of dimensions */
+ HDassert(mesg->u.chunk.ndims > 0 && mesg->u.chunk.ndims <= H5O_LAYOUT_NDIMS);
+ *p++ = (uint8_t)mesg->u.chunk.ndims;
+
+ /* B-tree address */
+ H5F_addr_encode(f, &p, mesg->storage.u.chunk.idx_addr);
+
+ /* Dimension sizes */
+ for(u = 0; u < mesg->u.chunk.ndims; u++)
+ UINT32ENCODE(p, mesg->u.chunk.dim[u]);
+ } /* end if */
+ else {
+ /* Chunk feature flags */
+ *p++ = mesg->u.chunk.flags;
- /* B-tree address */
- H5F_addr_encode(f, &p, mesg->storage.u.chunk.idx_addr);
+ /* Number of dimensions */
+ HDassert(mesg->u.chunk.ndims > 0 && mesg->u.chunk.ndims <= H5O_LAYOUT_NDIMS);
+ *p++ = (uint8_t)mesg->u.chunk.ndims;
- /* Dimension sizes */
- for(u = 0; u < mesg->u.chunk.ndims; u++)
- UINT32ENCODE(p, mesg->u.chunk.dim[u]);
+ /* Encoded # of bytes for each chunk dimension */
+ HDassert(mesg->u.chunk.enc_bytes_per_dim > 0 && mesg->u.chunk.enc_bytes_per_dim <= 8);
+ *p++ = (uint8_t)mesg->u.chunk.enc_bytes_per_dim;
+
+ /* Dimension sizes */
+ for(u = 0; u < mesg->u.chunk.ndims; u++)
+ UINT64ENCODE_VAR(p, mesg->u.chunk.dim[u], mesg->u.chunk.enc_bytes_per_dim);
+
+ /* Chunk index type */
+ *p++ = (uint8_t)mesg->u.chunk.idx_type;
+
+ switch(mesg->u.chunk.idx_type) {
+ case H5D_CHUNK_IDX_BTREE:
+ HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, FAIL, "v1 B-tree index type should never be in a v4 layout message")
+ break;
+
+ case H5D_CHUNK_IDX_FARRAY:
+ /* Fixed array creation parameters */
+ *p++ = mesg->u.chunk.u.farray.cparam.max_dblk_page_nelmts_bits;
+ break;
+
+ case H5D_CHUNK_IDX_EARRAY:
+ /* Extensible array creation parameters */
+ *p++ = mesg->u.chunk.u.earray.cparam.max_nelmts_bits;
+ *p++ = mesg->u.chunk.u.earray.cparam.idx_blk_elmts;
+ *p++ = mesg->u.chunk.u.earray.cparam.sup_blk_min_data_ptrs;
+ *p++ = mesg->u.chunk.u.earray.cparam.data_blk_min_elmts;
+ *p++ = mesg->u.chunk.u.earray.cparam.max_dblk_page_nelmts_bits;
+ break;
+
+ case H5D_CHUNK_IDX_BT2: /* v2 B-tree index */
+ UINT32ENCODE(p, mesg->u.chunk.u.btree2.cparam.node_size);
+ *p++ = mesg->u.chunk.u.btree2.cparam.split_percent;
+ *p++ = mesg->u.chunk.u.btree2.cparam.merge_percent;
+ break;
+
+ case H5D_CHUNK_IDX_NTYPES:
+ default:
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "Invalid chunk index type")
+ } /* end switch */
+
+ /*
+ * Implicit index: Address of the chunks
+ * Single chunk index: address of the single chunk
+ * Other indexes: chunk index address
+ */
+ H5F_addr_encode(f, &p, mesg->storage.u.chunk.idx_addr);
+ } /* end else */
break;
case H5D_VIRTUAL:
@@ -593,7 +745,7 @@ H5O__layout_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p,
UINT32ENCODE(heap_block_p, chksum)
/* Insert block into global heap */
- if(H5HG_insert(f, H5AC_ind_dxpl_id, block_size, heap_block, &((H5O_layout_t *)mesg)->storage.u.virt.serial_list_hobjid) < 0) /* Casting away const OK --NAF */
+ if(H5HG_insert(f, H5AC_ind_read_dxpl_id, block_size, heap_block, &((H5O_layout_t *)mesg)->storage.u.virt.serial_list_hobjid) < 0) /* Casting away const OK --NAF */
HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "unable to insert virtual dataset heap block")
} /* end if */
@@ -740,14 +892,14 @@ H5O__layout_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const vo
/*-------------------------------------------------------------------------
- * Function: H5O__layout_reset
+ * Function: H5O__layout_reset
*
- * Purpose: Frees resources within a data type message, but doesn't free
- * the message itself.
+ * Purpose: Frees resources within a data type message, but doesn't free
+ * the message itself.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Friday, September 13, 2002
*
*-------------------------------------------------------------------------
@@ -1016,20 +1168,38 @@ H5O__layout_debug(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, const v
HDfprintf(stream, "}\n");
/* Index information */
- switch(mesg->storage.u.chunk.idx_type) {
+ switch(mesg->u.chunk.idx_type) {
case H5D_CHUNK_IDX_BTREE:
HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
"Index Type:", "v1 B-tree");
- HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth,
- "B-tree address:", mesg->storage.u.chunk.idx_addr);
+ break;
+
+ case H5D_CHUNK_IDX_FARRAY:
+ HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
+ "Index Type:", "Fixed Array");
+ /* (Should print the fixed array creation parameters) */
+ break;
+
+ case H5D_CHUNK_IDX_EARRAY:
+ HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
+ "Index Type:", "Extensible Array");
+ /* (Should print the extensible array creation parameters) */
+ break;
+
+ case H5D_CHUNK_IDX_BT2:
+ HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
+ "Index Type:", "v2 B-tree");
+ /* (Should print the v2-Btree creation parameters) */
break;
case H5D_CHUNK_IDX_NTYPES:
default:
HDfprintf(stream, "%*s%-*s %s (%u)\n", indent, "", fwidth,
- "Index Type:", "Unknown", (unsigned)mesg->storage.u.chunk.idx_type);
+ "Index Type:", "Unknown", (unsigned)mesg->u.chunk.idx_type);
break;
} /* end switch */
+ HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth,
+ "Index address:", mesg->storage.u.chunk.idx_addr);
break;
case H5D_CONTIGUOUS:
diff --git a/src/H5Opkg.h b/src/H5Opkg.h
index 9125744..48b9c74 100644
--- a/src/H5Opkg.h
+++ b/src/H5Opkg.h
@@ -31,7 +31,7 @@
#define H5O_NMESGS 8 /*initial number of messages */
#define H5O_NCHUNKS 2 /*initial number of chunks */
#define H5O_MIN_SIZE 22 /* Min. obj header data size (must be big enough for a message prefix and a continuation message) */
-#define H5O_MSG_TYPES 25 /* # of types of messages */
+#define H5O_MSG_TYPES 26 /* # of types of messages */
#define H5O_MAX_CRT_ORDER_IDX 65535 /* Max. creation order index value */
/* Versions of object header structure */
@@ -66,7 +66,7 @@
#define H5O_ALIGN_OH(O, X) \
H5O_ALIGN_VERS((O)->version, X)
#define H5O_ALIGN_F(F, X) \
- H5O_ALIGN_VERS((H5F_USE_LATEST_FORMAT(F) ? H5O_VERSION_LATEST : H5O_VERSION_1), X)
+ H5O_ALIGN_VERS((H5F_USE_LATEST_FLAGS(F, H5F_LATEST_OBJ_HEADER) ? H5O_VERSION_LATEST : H5O_VERSION_1), X)
/* Size of checksum (on disk) */
#define H5O_SIZEOF_CHKSUM 4
@@ -138,7 +138,7 @@
#define H5O_SIZEOF_MSGHDR_OH(O) \
H5O_SIZEOF_MSGHDR_VERS((O)->version, (O)->flags & H5O_HDR_ATTR_CRT_ORDER_TRACKED)
#define H5O_SIZEOF_MSGHDR_F(F, C) \
- H5O_SIZEOF_MSGHDR_VERS((H5F_USE_LATEST_FORMAT(F) || H5F_STORE_MSG_CRT_IDX(F)) ? H5O_VERSION_LATEST : H5O_VERSION_1, (C))
+ H5O_SIZEOF_MSGHDR_VERS((H5F_USE_LATEST_FLAGS(F, H5F_LATEST_OBJ_HEADER) || H5F_STORE_MSG_CRT_IDX(F)) ? H5O_VERSION_LATEST : H5O_VERSION_1, (C))
/*
* Size of chunk "header" for each chunk
@@ -325,7 +325,7 @@ typedef struct H5O_obj_class_t {
void *(*create)(H5F_t *, void *, H5G_loc_t *, hid_t ); /*create an object of this class */
H5O_loc_t *(*get_oloc)(hid_t ); /*get the object header location for an object */
herr_t (*bh_info)(const H5O_loc_t *loc, hid_t dxpl_id, H5O_t *oh, H5_ih_info_t *bh_info); /*get the index & heap info for an object */
- herr_t (*flush)(H5G_loc_t *loc, hid_t dxpl_id); /*flush an opened object of this class */
+ herr_t (*flush)(void *obj_ptr, hid_t dxpl_id); /*flush an opened object of this class */
} H5O_obj_class_t;
/* Node in skip list to map addresses from one file to another during object header copy */
@@ -446,11 +446,13 @@ H5_DLLVAR const H5O_msg_class_t H5O_MSG_EFL[1];
H5_DLLVAR const H5O_msg_class_t H5O_MSG_LAYOUT[1];
#ifdef H5O_ENABLE_BOGUS
-/* "Bogus" Message. (0x0009) */
+/* "Bogus valid" Message. (0x0009) */
+/* "Bogus invalid" Message. (0x0019) */
/*
* Used for debugging - should never be found in valid HDF5 file.
*/
-H5_DLLVAR const H5O_msg_class_t H5O_MSG_BOGUS[1];
+H5_DLLVAR const H5O_msg_class_t H5O_MSG_BOGUS_VALID[1];
+H5_DLLVAR const H5O_msg_class_t H5O_MSG_BOGUS_INVALID[1];
#endif /* H5O_ENABLE_BOGUS */
/* Group Information Message. (0x000a) */
@@ -613,7 +615,6 @@ H5_DLL herr_t H5O_attr_link(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, void *_mesg
H5_DLL herr_t H5O_attr_count_real(H5F_t *f, hid_t dxpl_id, H5O_t *oh,
hsize_t *nattrs);
-
/* These functions operate on object locations */
H5_DLL H5O_loc_t *H5O_get_loc(hid_t id);
diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h
index 957b88e..57aefa7 100644
--- a/src/H5Oprivate.h
+++ b/src/H5Oprivate.h
@@ -98,7 +98,13 @@ typedef struct H5O_t H5O_t;
#ifdef H5O_ENABLE_BOGUS
#define H5O_BOGUS_MSG_FLAGS_NAME "bogus msg flags" /* Flags for 'bogus' message */
#define H5O_BOGUS_MSG_FLAGS_SIZE sizeof(uint8_t)
+
+/* bogus ID can be either (a) H5O_BOGUS_VALID_ID 0x0009 or (b) H5O_BOGUS_INVALID_ID 0x0019 */
+#define H5O_BOGUS_MSG_ID_NAME "bogus msg id" /* ID for 'bogus' message */
+#define H5O_BOGUS_MSG_ID_SIZE sizeof(unsigned)
+
#endif /* H5O_ENABLE_BOGUS */
+
#ifdef H5O_ENABLE_BAD_MESG_COUNT
#define H5O_BAD_MESG_COUNT_NAME "bad message count" /* Flag setting bad message count */
#define H5O_BAD_MESG_COUNT_SIZE sizeof(hbool_t)
@@ -183,7 +189,7 @@ typedef struct H5O_copy_t {
#define H5O_LINK_ID 0x0006 /* Link Message. */
#define H5O_EFL_ID 0x0007 /* External File List Message */
#define H5O_LAYOUT_ID 0x0008 /* Data Layout Message. */
-#define H5O_BOGUS_ID 0x0009 /* "Bogus" Message. */
+#define H5O_BOGUS_VALID_ID 0x0009 /* "Bogus valid" Message. */
#define H5O_GINFO_ID 0x000a /* Group info Message. */
#define H5O_PLINE_ID 0x000b /* Filter pipeline message. */
#define H5O_ATTR_ID 0x000c /* Attribute Message. */
@@ -200,6 +206,7 @@ typedef struct H5O_copy_t {
#define H5O_FSINFO_ID 0x0017 /* Free-space manager info message. */
#define H5O_UNKNOWN_ID 0x0018 /* Placeholder message ID for unknown message. */
/* (this should never exist in a file) */
+#define H5O_BOGUS_INVALID_ID 0x0019 /* "Bogus invalid" Message. */
/* Shared object message types.
* Shared objects can be committed, in which case the shared message contains
@@ -360,6 +367,12 @@ typedef struct H5O_efl_t {
*/
#define H5O_LAYOUT_NDIMS (H5S_MAX_RANK+1)
+/* Flags for chunked layout feature encoding */
+#define H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS 0x01
+#define H5O_LAYOUT_ALL_CHUNK_FLAGS ( \
+ H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS \
+ )
+
/* Initial version of the layout information. Used when space is allocated */
#define H5O_LAYOUT_VERSION_1 1
@@ -403,12 +416,39 @@ typedef struct H5O_storage_chunk_btree_t {
H5UC_t *shared; /* Ref-counted shared info for B-tree nodes */
} H5O_storage_chunk_btree_t;
+/* Forward declaration of structs used below */
+struct H5FA_t; /* Defined in H5FAprivate.h */
+
+typedef struct H5O_storage_chunk_farray_t {
+ haddr_t dset_ohdr_addr; /* File address dataset's object header */
+ struct H5FA_t *fa; /* Pointer to fixed index array struct */
+} H5O_storage_chunk_farray_t;
+
+/* Forward declaration of structs used below */
+struct H5EA_t; /* Defined in H5EAprivate.h */
+
+typedef struct H5O_storage_chunk_earray_t {
+ haddr_t dset_ohdr_addr; /* File address dataset's object header */
+ struct H5EA_t *ea; /* Pointer to extensible index array struct */
+} H5O_storage_chunk_earray_t;
+
+/* Forward declaration of structs used below */
+struct H5B2_t; /* Defined in H5B2pkg.h */
+
+typedef struct H5O_storage_chunk_bt2_t {
+ haddr_t dset_ohdr_addr; /* File address dataset's object header */
+ struct H5B2_t *bt2; /* Pointer to b-tree 2 struct */
+} H5O_storage_chunk_bt2_t;
+
typedef struct H5O_storage_chunk_t {
H5D_chunk_index_t idx_type; /* Type of chunk index */
haddr_t idx_addr; /* File address of chunk index */
const struct H5D_chunk_ops_t *ops; /* Pointer to chunked storage operations */
union {
H5O_storage_chunk_btree_t btree; /* Information for v1 B-tree index */
+ H5O_storage_chunk_bt2_t btree2; /* Information for v2 B-tree index */
+ H5O_storage_chunk_earray_t earray; /* Information for extensible array index */
+ H5O_storage_chunk_farray_t farray; /* Information for fixed array index */
} u;
} H5O_storage_chunk_t;
@@ -503,13 +543,57 @@ typedef struct H5O_storage_t {
} u;
} H5O_storage_t;
+typedef struct H5O_layout_chunk_farray_t {
+ /* Creation parameters for fixed array data structure */
+ struct {
+ uint8_t max_dblk_page_nelmts_bits; /* Log2(Max. # of elements in a data block page) -
+ i.e. # of bits needed to store max. # of elements
+ in a data block page */
+ } cparam;
+} H5O_layout_chunk_farray_t;
+
+typedef struct H5O_layout_chunk_earray_t {
+ /* Creation parameters for extensible array data structure */
+ struct {
+ uint8_t max_nelmts_bits; /* Log2(Max. # of elements in array) - i.e. # of bits needed to store max. # of elements */
+ uint8_t idx_blk_elmts; /* # of elements to store in index block */
+ uint8_t data_blk_min_elmts; /* Min. # of elements per data block */
+ uint8_t sup_blk_min_data_ptrs; /* Min. # of data block pointers for a super block */
+ uint8_t max_dblk_page_nelmts_bits; /* Log2(Max. # of elements in data block page) - i.e. # of bits needed to store max. # of elements in data block page */
+ } cparam;
+
+ unsigned unlim_dim; /* Rank of unlimited dimension for dataset */
+ uint32_t swizzled_dim[H5O_LAYOUT_NDIMS]; /* swizzled chunk dimensions */
+ hsize_t swizzled_down_chunks[H5O_LAYOUT_NDIMS]; /* swizzled "down" size of number of chunks in each dimension */
+} H5O_layout_chunk_earray_t;
+
+typedef struct H5O_layout_chunk_bt2_t {
+ /* Creation parameters for v2 B-tree data structure */
+ struct {
+ uint32_t node_size; /* Size of each node (in bytes) */
+ uint8_t split_percent; /* % full to split nodes */
+ uint8_t merge_percent; /* % full to merge nodes */
+ } cparam;
+} H5O_layout_chunk_bt2_t;
+
typedef struct H5O_layout_chunk_t {
+ H5D_chunk_index_t idx_type; /* Type of chunk index */
+ uint8_t flags; /* Chunk layout flags */
unsigned ndims; /* Num dimensions in chunk */
uint32_t dim[H5O_LAYOUT_NDIMS]; /* Size of chunk in elements */
+ unsigned enc_bytes_per_dim; /* Encoded # of bytes for storing each chunk dimension */
uint32_t size; /* Size of chunk in bytes */
hsize_t nchunks; /* Number of chunks in dataset */
+ hsize_t max_nchunks; /* Max. number of chunks in dataset */
hsize_t chunks[H5O_LAYOUT_NDIMS]; /* # of chunks in each dataset dimension */
+ hsize_t max_chunks[H5O_LAYOUT_NDIMS]; /* # of chunks in each dataset's max. dimension */
hsize_t down_chunks[H5O_LAYOUT_NDIMS]; /* "down" size of number of chunks in each dimension */
+ hsize_t max_down_chunks[H5O_LAYOUT_NDIMS]; /* "down" size of number of chunks in each max dim */
+ union {
+ H5O_layout_chunk_farray_t farray; /* Information for fixed array index */
+ H5O_layout_chunk_earray_t earray; /* Information for extensible array index */
+ H5O_layout_chunk_bt2_t btree2; /* Information for v2 B-tree index */
+ } u;
} H5O_layout_chunk_t;
typedef struct H5O_layout_t {
@@ -697,11 +781,6 @@ typedef struct H5O_fsinfo_t {
typedef herr_t (*H5O_operator_t)(const void *mesg/*in*/, unsigned idx,
void *operator_data/*in,out*/);
-#ifdef OUT
-/* Typedef for "internal library" iteration operations */
-typedef herr_t (*H5O_lib_operator_t)(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/,
- unsigned sequence, hbool_t *oh_modified/*out*/, void *operator_data/*in,out*/);
-#endif
/* Typedef for "internal library" iteration operations */
typedef herr_t (*H5O_lib_operator_t)(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/,
unsigned sequence, unsigned *oh_modified/*out*/, void *operator_data/*in,out*/);
@@ -751,7 +830,7 @@ H5_DLL herr_t H5O_touch(const H5O_loc_t *loc, hbool_t force, hid_t dxpl_id);
H5_DLL herr_t H5O_touch_oh(H5F_t *f, hid_t dxpl_id, H5O_t *oh,
hbool_t force);
#ifdef H5O_ENABLE_BOGUS
-H5_DLL herr_t H5O_bogus_oh(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned mesg_flags);
+H5_DLL herr_t H5O_bogus_oh(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned mesg_id, unsigned mesg_flags);
#endif /* H5O_ENABLE_BOGUS */
H5_DLL herr_t H5O_delete(H5F_t *f, hid_t dxpl_id, haddr_t addr);
H5_DLL herr_t H5O_get_hdr_info(const H5O_loc_t *oloc, hid_t dxpl_id, H5O_hdr_info_t *hdr);
@@ -759,7 +838,7 @@ H5_DLL herr_t H5O_get_info(const H5O_loc_t *oloc, hid_t dxpl_id, hbool_t want_ih
H5O_info_t *oinfo);
H5_DLL herr_t H5O_obj_type(const H5O_loc_t *loc, H5O_type_t *obj_type, hid_t dxpl_id);
H5_DLL herr_t H5O_get_create_plist(const H5O_loc_t *loc, hid_t dxpl_id, struct H5P_genplist_t *oc_plist);
-H5_DLL hid_t H5O_open_name(H5G_loc_t *loc, const char *name, hid_t lapl_id, hbool_t app_ref);
+H5_DLL hid_t H5O_open_name(H5G_loc_t *loc, const char *name, hid_t lapl_id, hid_t dxpl_id, hbool_t app_ref);
H5_DLL herr_t H5O_get_nlinks(const H5O_loc_t *loc, hid_t dxpl_id, hsize_t *nlinks);
H5_DLL void *H5O_obj_create(H5F_t *f, H5O_type_t obj_type, void *crt_info, H5G_loc_t *obj_loc, hid_t dxpl_id);
H5_DLL haddr_t H5O_get_oh_addr(const H5O_t *oh);
@@ -823,7 +902,7 @@ H5_DLL herr_t H5O_copy_expand_ref(H5F_t *file_src, void *_src_ref, hid_t dxpl_id
H5O_copy_t *cpy_info);
H5_DLL herr_t H5O_copy(H5G_loc_t *src_loc, const char *src_name,
H5G_loc_t *dst_loc, const char *dst_name,
- hid_t ocpypl_id, hid_t lcpl_id);
+ hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id);
/* Debugging routines */
H5_DLL herr_t H5O_debug_id(unsigned type_id, H5F_t *f, hid_t dxpl_id, const void *mesg, FILE *stream, int indent, int fwidth);
diff --git a/src/H5Otest.c b/src/H5Otest.c
index 1c149e3..c3e487d 100644
--- a/src/H5Otest.c
+++ b/src/H5Otest.c
@@ -108,14 +108,14 @@ H5O_is_attr_dense_test(hid_t oid)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found")
/* Get the object header */
- if(NULL == (oh = H5O_protect(loc, H5AC_ind_dxpl_id, H5AC__READ_ONLY_FLAG)))
+ if(NULL == (oh = H5O_protect(loc, H5AC_ind_read_dxpl_id, H5AC__READ_ONLY_FLAG)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header")
/* Check for attribute info stored */
ainfo.fheap_addr = HADDR_UNDEF;
if(oh->version > H5O_VERSION_1) {
/* Check for (& retrieve if available) attribute info */
- if(H5A_get_ainfo(loc->file, H5AC_ind_dxpl_id, oh, &ainfo) < 0)
+ if(H5A_get_ainfo(loc->file, H5AC_ind_read_dxpl_id, oh, &ainfo) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't check for attribute info message")
} /* end if */
@@ -130,7 +130,7 @@ H5O_is_attr_dense_test(hid_t oid)
ret_value = FALSE;
done:
- if(oh && H5O_unprotect(loc, H5AC_ind_dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0)
+ if(oh && H5O_unprotect(loc, H5AC_ind_read_dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
FUNC_LEAVE_NOAPI(ret_value)
@@ -173,13 +173,13 @@ H5O_is_attr_empty_test(hid_t oid)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found")
/* Get the object header */
- if(NULL == (oh = H5O_protect(loc, H5AC_ind_dxpl_id, H5AC__READ_ONLY_FLAG)))
+ if(NULL == (oh = H5O_protect(loc, H5AC_ind_read_dxpl_id, H5AC__READ_ONLY_FLAG)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header")
/* Check for attribute info stored */
if(oh->version > H5O_VERSION_1) {
/* Check for (& retrieve if available) attribute info */
- if((ainfo_exists = H5A_get_ainfo(loc->file, H5AC_ind_dxpl_id, oh, &ainfo)) < 0)
+ if((ainfo_exists = H5A_get_ainfo(loc->file, H5AC_ind_read_dxpl_id, oh, &ainfo)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't check for attribute info message")
} /* end if */
@@ -195,10 +195,10 @@ H5O_is_attr_empty_test(hid_t oid)
HDassert(nattrs == 0);
/* Set metadata tag in dxpl_id */
- H5_BEGIN_TAG(H5AC_ind_dxpl_id, loc->addr, FAIL);
+ H5_BEGIN_TAG(H5AC_ind_read_dxpl_id, loc->addr, FAIL);
/* Open the name index v2 B-tree */
- if(NULL == (bt2_name = H5B2_open(loc->file, H5AC_ind_dxpl_id, ainfo.name_bt2_addr, NULL)))
+ if(NULL == (bt2_name = H5B2_open(loc->file, H5AC_ind_read_dxpl_id, ainfo.name_bt2_addr, NULL)))
HGOTO_ERROR_TAG(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index")
/* Reset metadata tag in dxpl_id */
@@ -221,9 +221,9 @@ H5O_is_attr_empty_test(hid_t oid)
done:
/* Release resources */
- if(bt2_name && H5B2_close(bt2_name, H5AC_ind_dxpl_id) < 0)
+ if(bt2_name && H5B2_close(bt2_name, H5AC_ind_read_dxpl_id) < 0)
HDONE_ERROR(H5E_OHDR, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for name index")
- if(oh && H5O_unprotect(loc, H5AC_ind_dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0)
+ if(oh && H5O_unprotect(loc, H5AC_ind_read_dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
FUNC_LEAVE_NOAPI(ret_value)
@@ -266,14 +266,14 @@ H5O_num_attrs_test(hid_t oid, hsize_t *nattrs)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found")
/* Get the object header */
- if(NULL == (oh = H5O_protect(loc, H5AC_ind_dxpl_id, H5AC__READ_ONLY_FLAG)))
+ if(NULL == (oh = H5O_protect(loc, H5AC_ind_read_dxpl_id, H5AC__READ_ONLY_FLAG)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header")
/* Check for attribute info stored */
ainfo.fheap_addr = HADDR_UNDEF;
if(oh->version > H5O_VERSION_1) {
/* Check for (& retrieve if available) attribute info */
- if(H5A_get_ainfo(loc->file, H5AC_ind_dxpl_id, oh, &ainfo) < 0)
+ if(H5A_get_ainfo(loc->file, H5AC_ind_read_dxpl_id, oh, &ainfo) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't check for attribute info message")
} /* end if */
@@ -288,10 +288,10 @@ H5O_num_attrs_test(hid_t oid, hsize_t *nattrs)
HDassert(obj_nattrs == 0);
/* Set metadata tag in dxpl_id */
- H5_BEGIN_TAG(H5AC_ind_dxpl_id, loc->addr, FAIL);
+ H5_BEGIN_TAG(H5AC_ind_read_dxpl_id, loc->addr, FAIL);
/* Open the name index v2 B-tree */
- if(NULL == (bt2_name = H5B2_open(loc->file, H5AC_ind_dxpl_id, ainfo.name_bt2_addr, NULL)))
+ if(NULL == (bt2_name = H5B2_open(loc->file, H5AC_ind_read_dxpl_id, ainfo.name_bt2_addr, NULL)))
HGOTO_ERROR_TAG(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index")
/* Reset metadata tag in dxpl_id */
@@ -311,9 +311,9 @@ H5O_num_attrs_test(hid_t oid, hsize_t *nattrs)
done:
/* Release resources */
- if(bt2_name && H5B2_close(bt2_name, H5AC_ind_dxpl_id) < 0)
+ if(bt2_name && H5B2_close(bt2_name, H5AC_ind_read_dxpl_id) < 0)
HDONE_ERROR(H5E_OHDR, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for name index")
- if(oh && H5O_unprotect(loc, H5AC_ind_dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0)
+ if(oh && H5O_unprotect(loc, H5AC_ind_read_dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
FUNC_LEAVE_NOAPI(ret_value)
@@ -358,17 +358,17 @@ H5O_attr_dense_info_test(hid_t oid, hsize_t *name_count, hsize_t *corder_count)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found")
/* Set metadata tag in dxpl_id */
- H5_BEGIN_TAG(H5AC_ind_dxpl_id, loc->addr, FAIL);
+ H5_BEGIN_TAG(H5AC_ind_read_dxpl_id, loc->addr, FAIL);
/* Get the object header */
- if(NULL == (oh = H5O_protect(loc, H5AC_ind_dxpl_id, H5AC__READ_ONLY_FLAG)))
+ if(NULL == (oh = H5O_protect(loc, H5AC_ind_read_dxpl_id, H5AC__READ_ONLY_FLAG)))
HGOTO_ERROR_TAG(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header")
/* Check for attribute info stored */
ainfo.fheap_addr = HADDR_UNDEF;
if(oh->version > H5O_VERSION_1) {
/* Check for (& retrieve if available) attribute info */
- if(H5A_get_ainfo(loc->file, H5AC_ind_dxpl_id, oh, &ainfo) < 0)
+ if(H5A_get_ainfo(loc->file, H5AC_ind_read_dxpl_id, oh, &ainfo) < 0)
HGOTO_ERROR_TAG(H5E_ATTR, H5E_CANTGET, FAIL, "can't check for attribute info message")
} /* end if */
@@ -379,7 +379,7 @@ H5O_attr_dense_info_test(hid_t oid, hsize_t *name_count, hsize_t *corder_count)
HGOTO_DONE_TAG(FAIL, FAIL)
/* Open the name index v2 B-tree */
- if(NULL == (bt2_name = H5B2_open(loc->file, H5AC_ind_dxpl_id, ainfo.name_bt2_addr, NULL)))
+ if(NULL == (bt2_name = H5B2_open(loc->file, H5AC_ind_read_dxpl_id, ainfo.name_bt2_addr, NULL)))
HGOTO_ERROR_TAG(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index")
/* Retrieve # of records in name index */
@@ -389,7 +389,7 @@ H5O_attr_dense_info_test(hid_t oid, hsize_t *name_count, hsize_t *corder_count)
/* Check if there is a creation order index */
if(H5F_addr_defined(ainfo.corder_bt2_addr)) {
/* Open the creation order index v2 B-tree */
- if(NULL == (bt2_corder = H5B2_open(loc->file, H5AC_ind_dxpl_id, ainfo.corder_bt2_addr, NULL)))
+ if(NULL == (bt2_corder = H5B2_open(loc->file, H5AC_ind_read_dxpl_id, ainfo.corder_bt2_addr, NULL)))
HGOTO_ERROR_TAG(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for creation order index")
/* Retrieve # of records in creation order index */
@@ -404,11 +404,11 @@ H5O_attr_dense_info_test(hid_t oid, hsize_t *name_count, hsize_t *corder_count)
done:
/* Release resources */
- if(bt2_name && H5B2_close(bt2_name, H5AC_ind_dxpl_id) < 0)
+ if(bt2_name && H5B2_close(bt2_name, H5AC_ind_read_dxpl_id) < 0)
HDONE_ERROR(H5E_OHDR, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for name index")
- if(bt2_corder && H5B2_close(bt2_corder, H5AC_ind_dxpl_id) < 0)
+ if(bt2_corder && H5B2_close(bt2_corder, H5AC_ind_read_dxpl_id) < 0)
HDONE_ERROR(H5E_OHDR, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for creation order index")
- if(oh && H5O_unprotect(loc, H5AC_ind_dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0)
+ if(oh && H5O_unprotect(loc, H5AC_ind_read_dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
FUNC_LEAVE_NOAPI(ret_value)
@@ -452,7 +452,7 @@ H5O_check_msg_marked_test(hid_t oid, hbool_t flag_val)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found")
/* Get the object header */
- if(NULL == (oh = H5O_protect(loc, H5AC_ind_dxpl_id, H5AC__READ_ONLY_FLAG)))
+ if(NULL == (oh = H5O_protect(loc, H5AC_ind_read_dxpl_id, H5AC__READ_ONLY_FLAG)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header")
/* Locate "unknown" message */
@@ -471,7 +471,7 @@ H5O_check_msg_marked_test(hid_t oid, hbool_t flag_val)
HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "'unknown' message type not found")
done:
- if(oh && H5O_unprotect(loc, H5AC_ind_dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0)
+ if(oh && H5O_unprotect(loc, H5AC_ind_read_dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5P.c b/src/H5P.c
index 3d09231..f075b92 100644
--- a/src/H5P.c
+++ b/src/H5P.c
@@ -639,7 +639,7 @@ done:
PURPOSE
Routine to set a property's value in a property list.
USAGE
- herr_t H5P_set(plist_id, name, value)
+ herr_t H5Pset(plist_id, name, value)
hid_t plist_id; IN: Property list to find property in
const char *name; IN: Name of property to set
void *value; IN: Pointer to the value for the property
diff --git a/src/H5PL.c b/src/H5PL.c
index 7c31639..f639725 100644
--- a/src/H5PL.c
+++ b/src/H5PL.c
@@ -435,9 +435,9 @@ H5PL__init_path_table(void)
*/
origin_dl_path = HDgetenv("HDF5_PLUGIN_PATH");
if(NULL == origin_dl_path)
- dl_path = HDstrdup(H5PL_DEFAULT_PATH);
+ dl_path = H5MM_strdup(H5PL_DEFAULT_PATH);
else
- dl_path = HDstrdup(origin_dl_path);
+ dl_path = H5MM_strdup(origin_dl_path);
if(NULL == dl_path)
HGOTO_ERROR(H5E_PLUGIN, H5E_CANTALLOC, FAIL, "can't allocate memory for path")
@@ -447,7 +447,7 @@ H5PL__init_path_table(void)
/* Check for too many directories in path */
if(H5PL_num_paths_g == H5PL_MAX_PATH_NUM)
HGOTO_ERROR(H5E_PLUGIN, H5E_NOSPACE, FAIL, "too many directories in path for table")
- if(NULL == (H5PL_path_table_g[H5PL_num_paths_g] = HDstrdup(dir)))
+ if(NULL == (H5PL_path_table_g[H5PL_num_paths_g] = H5MM_strdup(dir)))
HGOTO_ERROR(H5E_PLUGIN, H5E_CANTALLOC, FAIL, "can't allocate memory for path")
H5PL_num_paths_g++;
dir = HDstrtok(NULL, H5PL_PATH_SEPARATOR);
diff --git a/src/H5Pdapl.c b/src/H5Pdapl.c
index eab9337..6407d4c 100644
--- a/src/H5Pdapl.c
+++ b/src/H5Pdapl.c
@@ -16,8 +16,8 @@
/*-------------------------------------------------------------------------
*
* Created: H5Pdapl.c
- * October 27, 2008
- * Neil Fortner <nfortne2@hdfgroup.org>
+ * October 27, 2008
+ * Neil Fortner <nfortne2@hdfgroup.org>
*
* Purpose: Dataset access property list class routines
*
@@ -39,7 +39,8 @@
#include "H5Eprivate.h" /* Error handling */
#include "H5Fprivate.h" /* Files */
#include "H5Iprivate.h" /* IDs */
-#include "H5Ppkg.h" /* Property lists */
+#include "H5Ppkg.h" /* Property lists */
+#include "H5MMprivate.h" /* Memory management */
/****************/
@@ -72,6 +73,17 @@
#define H5D_ACS_VDS_PRINTF_GAP_DEF (hsize_t)0
#define H5D_ACS_VDS_PRINTF_GAP_ENC H5P__encode_hsize_t
#define H5D_ACS_VDS_PRINTF_GAP_DEC H5P__decode_hsize_t
+/* Definitions for external file prefix */
+#define H5D_ACS_EFILE_PREFIX_SIZE sizeof(char *)
+#define H5D_ACS_EFILE_PREFIX_DEF NULL /*default is no prefix */
+#define H5D_ACS_EFILE_PREFIX_SET H5P__dapl_efile_pref_set
+#define H5D_ACS_EFILE_PREFIX_GET H5P__dapl_efile_pref_get
+#define H5D_ACS_EFILE_PREFIX_ENC H5P__dapl_efile_pref_enc
+#define H5D_ACS_EFILE_PREFIX_DEC H5P__dapl_efile_pref_dec
+#define H5D_ACS_EFILE_PREFIX_DEL H5P__dapl_efile_pref_del
+#define H5D_ACS_EFILE_PREFIX_COPY H5P__dapl_efile_pref_copy
+#define H5D_ACS_EFILE_PREFIX_CMP H5P__dapl_efile_pref_cmp
+#define H5D_ACS_EFILE_PREFIX_CLOSE H5P__dapl_efile_pref_close
/******************/
/* Local Typedefs */
@@ -100,6 +112,16 @@ static herr_t H5P__decode_chunk_cache_nbytes(const void **_pp, void *_value);
static herr_t H5P__dacc_vds_view_enc(const void *value, void **pp, size_t *size);
static herr_t H5P__dacc_vds_view_dec(const void **pp, void *value);
+/* Property list callbacks */
+static herr_t H5P__dapl_efile_pref_set(hid_t prop_id, const char* name, size_t size, void* value);
+static herr_t H5P__dapl_efile_pref_get(hid_t prop_id, const char* name, size_t size, void* value);
+static herr_t H5P__dapl_efile_pref_enc(const void *value, void **_pp, size_t *size);
+static herr_t H5P__dapl_efile_pref_dec(const void **_pp, void *value);
+static herr_t H5P__dapl_efile_pref_del(hid_t prop_id, const char* name, size_t size, void* value);
+static herr_t H5P__dapl_efile_pref_copy(const char* name, size_t size, void* value);
+static int H5P__dapl_efile_pref_cmp(const void *value1, const void *value2, size_t size);
+static herr_t H5P__dapl_efile_pref_close(const char* name, size_t size, void* value);
+
/*********************/
/* Package Variables */
@@ -134,6 +156,9 @@ const H5P_libclass_t H5P_CLS_DACC[1] = {{
/* Local Variables */
/*******************/
+/* Property value defaults */
+static const char *H5D_def_efile_prefix_g = H5D_ACS_EFILE_PREFIX_DEF; /* Default external file prefix string */
+
/*-------------------------------------------------------------------------
@@ -187,12 +212,274 @@ H5P__dacc_reg_prop(H5P_genclass_t *pclass)
NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
+ /* Register property for external file prefix */
+ if(H5P_register_real(pclass, H5D_ACS_EFILE_PREFIX_NAME, H5D_ACS_EFILE_PREFIX_SIZE, &H5D_def_efile_prefix_g,
+ NULL, H5D_ACS_EFILE_PREFIX_SET, H5D_ACS_EFILE_PREFIX_GET, H5D_ACS_EFILE_PREFIX_ENC, H5D_ACS_EFILE_PREFIX_DEC,
+ H5D_ACS_EFILE_PREFIX_DEL, H5D_ACS_EFILE_PREFIX_COPY, H5D_ACS_EFILE_PREFIX_CMP, H5D_ACS_EFILE_PREFIX_CLOSE) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
+
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P__dacc_reg_prop() */
/*-------------------------------------------------------------------------
+ * Function: H5P__dapl_efile_pref_set
+ *
+ * Purpose: Copies an external file prefix property when it's set
+ * for a property list
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5P__dapl_efile_pref_set(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name,
+ size_t H5_ATTR_UNUSED size, void *value)
+{
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Sanity check */
+ HDassert(value);
+
+ /* Copy the prefix */
+ *(char **)value = H5MM_xstrdup(*(const char **)value);
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5P__dapl_efile_pref_set() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5P__dapl_efile_pref_get
+ *
+ * Purpose: Copies an external file prefix property when it's retrieved
+ * from a property list
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5P__dapl_efile_pref_get(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name,
+ size_t H5_ATTR_UNUSED size, void *value)
+{
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Sanity check */
+ HDassert(value);
+
+ /* Copy the prefix */
+ *(char **)value = H5MM_xstrdup(*(const char **)value);
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5P__dapl_efile_pref_get() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5P__dapl_efile_pref_enc
+ *
+ * Purpose: Callback routine which is called whenever the efile flags
+ * property in the dataset access property list is
+ * encoded.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5P__dapl_efile_pref_enc(const void *value, void **_pp, size_t *size)
+{
+ const char *efile_pref = *(const char * const *)value;
+ uint8_t **pp = (uint8_t **)_pp;
+ size_t len = 0;
+ uint64_t enc_value;
+ unsigned enc_size;
+
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+
+ HDcompile_assert(sizeof(size_t) <= sizeof(uint64_t));
+
+ /* calculate prefix length */
+ if(NULL != efile_pref)
+ len = HDstrlen(efile_pref);
+
+ enc_value = (uint64_t)len;
+ enc_size = H5VM_limit_enc_size(enc_value);
+ HDassert(enc_size < 256);
+
+ if(NULL != *pp) {
+ /* encode the length of the prefix */
+ *(*pp)++ = (uint8_t)enc_size;
+ UINT64ENCODE_VAR(*pp, enc_value, enc_size);
+
+ /* encode the prefix */
+ if(NULL != efile_pref) {
+ HDmemcpy(*(char **)pp, efile_pref, len);
+ *pp += len;
+ } /* end if */
+ } /* end if */
+
+ *size += (1 + enc_size);
+ if(NULL != efile_pref)
+ *size += len;
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5P__dapl_efile_pref_enc() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5P__dapl_efile_pref_dec
+ *
+ * Purpose: Callback routine which is called whenever the efile prefix
+ * property in the dataset access property list is
+ * decoded.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5P__dapl_efile_pref_dec(const void **_pp, void *_value)
+{
+ char **efile_pref = (char **)_value;
+ const uint8_t **pp = (const uint8_t **)_pp;
+ size_t len;
+ uint64_t enc_value; /* Decoded property value */
+ unsigned enc_size; /* Size of encoded property */
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+ HDassert(pp);
+ HDassert(*pp);
+ HDassert(efile_pref);
+ HDcompile_assert(sizeof(size_t) <= sizeof(uint64_t));
+
+ /* Decode the size */
+ enc_size = *(*pp)++;
+ HDassert(enc_size < 256);
+
+ /* Decode the value */
+ UINT64DECODE_VAR(*pp, enc_value, enc_size);
+ len = (size_t)enc_value;
+
+ if(0 != len) {
+ /* Make a copy of the user's prefix string */
+ if(NULL == (*efile_pref = (char *)H5MM_malloc(len + 1)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "memory allocation failed for prefix")
+ HDstrncpy(*efile_pref, *(const char **)pp, len);
+ (*efile_pref)[len] = '\0';
+
+ *pp += len;
+ } /* end if */
+ else
+ *efile_pref = NULL;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5P__dapl_efile_pref_dec() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5P__dapl_efile_pref_del
+ *
+ * Purpose: Frees memory used to store the external file prefix string
+ *
+ * Return: SUCCEED (Can't fail)
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5P__dapl_efile_pref_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name,
+ size_t H5_ATTR_UNUSED size, void *value)
+{
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+
+ HDassert(value);
+
+ H5MM_xfree(*(void **)value);
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5P__dapl_efile_pref_del() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5P__dapl_efile_pref_copy
+ *
+ * Purpose: Creates a copy of the external file prefix string
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5P__dapl_efile_pref_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value)
+{
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+
+ HDassert(value);
+
+ *(char **)value = H5MM_xstrdup(*(const char **)value);
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5P__dapl_efile_pref_copy() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5P__dapl_efile_pref_cmp
+ *
+ * Purpose: Callback routine which is called whenever the efile prefix
+ * property in the dataset creation property list is
+ * compared.
+ *
+ * Return: zero if VALUE1 and VALUE2 are equal, non zero otherwise.
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+H5P__dapl_efile_pref_cmp(const void *value1, const void *value2, size_t H5_ATTR_UNUSED size)
+{
+ const char *pref1 = *(const char * const *)value1;
+ const char *pref2 = *(const char * const *)value2;
+ int ret_value = 0;
+
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+
+ if(NULL == pref1 && NULL != pref2)
+ HGOTO_DONE(1);
+ if(NULL != pref1 && NULL == pref2)
+ HGOTO_DONE(-1);
+ if(NULL != pref1 && NULL != pref2)
+ ret_value = HDstrcmp(pref1, pref2);
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5P__dapl_efile_pref_cmp() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5P__dapl_efile_pref_close
+ *
+ * Purpose: Frees memory used to store the external file prefix string
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5P__dapl_efile_pref_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value)
+{
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+
+ HDassert(value);
+
+ H5MM_xfree(*(void **)value);
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5P__dapl_efile_pref_close() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5Pset_chunk_cache
*
* Purpose: Set the number of objects in the meta data cache and the
@@ -787,3 +1074,94 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_virtual_printf_gap() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pset_efile_prefix
+ *
+ * Purpose: Set a prefix to be used for any external files.
+ *
+ * If the prefix starts with ${ORIGIN}, this will be replaced by
+ * the absolute path of the directory of the HDF5 file containing
+ * the dataset.
+ *
+ * If the prefix is ".", no prefix will be applied.
+ *
+ * This property can be overwritten by the environment variable
+ * HDF5_EXTFILE_PREFIX.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pset_efile_prefix(hid_t plist_id, const char *prefix)
+{
+ H5P_genplist_t *plist; /* Property list pointer */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE2("e", "i*s", plist_id, prefix);
+
+ /* Get the plist structure */
+ if(NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_ACCESS)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+
+ /* Set prefix */
+ if(H5P_set(plist, H5D_ACS_EFILE_PREFIX_NAME, &prefix) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set prefix info")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Pset_efile_prefix() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pget_efile_prefix
+ *
+ * Purpose: Gets the prefix to be used for any external files.
+ *
+ * If the pointer is not NULL, it points to a user-allocated
+ * buffer.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ *-------------------------------------------------------------------------
+ */
+ssize_t
+H5Pget_efile_prefix(hid_t plist_id, char *prefix, size_t size)
+{
+ H5P_genplist_t *plist; /* Property list pointer */
+ char *my_prefix; /* Library's copy of the prefix */
+ size_t len; /* Length of prefix string */
+ ssize_t ret_value; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE3("Zs", "i*sz", plist_id, prefix, size);
+
+ /* Get the plist structure */
+ if(NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_ACCESS)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+
+ /* Get the current prefix */
+ if(H5P_peek(plist, H5D_ACS_EFILE_PREFIX_NAME, &my_prefix) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get external file prefix")
+
+ /* Check for prefix being set */
+ if(my_prefix) {
+ /* Copy to user's buffer, if given */
+ len = HDstrlen(my_prefix);
+ if(prefix) {
+ HDstrncpy(prefix, my_prefix, MIN(len + 1, size));
+ if(len >= size)
+ prefix[size - 1] = '\0';
+ } /* end if */
+ } /* end if */
+ else
+ len = 0;
+
+ /* Set return value */
+ ret_value = (ssize_t)len;
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Pget_efile_prefix() */
diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c
index 7643679..32538c6 100644
--- a/src/H5Pdcpl.c
+++ b/src/H5Pdcpl.c
@@ -29,14 +29,14 @@
/****************/
#include "H5Pmodule.h" /* This source code file is part of the H5P module */
+#define H5D_FRIEND /* Suppress error about including H5Dpkg */
/***********/
/* Headers */
/***********/
#include "H5private.h" /* Generic Functions */
-#include "H5ACprivate.h" /* Metadata cache */
-#include "H5Dprivate.h" /* Datasets */
+#include "H5Dpkg.h" /* Datasets */
#include "H5Eprivate.h" /* Error handling */
#include "H5FLprivate.h" /* Free Lists */
#include "H5Iprivate.h" /* IDs */
@@ -45,6 +45,7 @@
#include "H5Ppkg.h" /* Property lists */
#include "H5Sprivate.h" /* Dataspaces */
#include "H5Tprivate.h" /* Datatypes */
+#include "H5VMprivate.h" /* Vectors and arrays */
#include "H5Zprivate.h" /* Data filters */
@@ -55,28 +56,28 @@
/* Define default layout information */
#define H5D_DEF_STORAGE_COMPACT_INIT {(hbool_t)FALSE, (size_t)0, NULL}
#define H5D_DEF_STORAGE_CONTIG_INIT {HADDR_UNDEF, (hsize_t)0}
-#define H5D_DEF_STORAGE_CHUNK_INIT {H5D_CHUNK_IDX_BTREE, HADDR_UNDEF, NULL, {{HADDR_UNDEF, NULL}}}
-#define H5D_DEF_LAYOUT_CHUNK_INIT {(unsigned)0, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, (uint32_t)0, (hsize_t)0, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}}
+#define H5D_DEF_STORAGE_CHUNK_INIT {H5D_CHUNK_IDX_BTREE, HADDR_UNDEF, H5D_COPS_BTREE, {{HADDR_UNDEF, NULL}}}
+#define H5D_DEF_LAYOUT_CHUNK_INIT {H5D_CHUNK_IDX_BTREE, (uint8_t)0, (unsigned)0, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, (unsigned)0, (uint32_t)0, (hsize_t)0, (hsize_t)0, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {{{(uint8_t)0}}}}
#define H5D_DEF_STORAGE_VIRTUAL_INIT {{HADDR_UNDEF, 0}, 0, NULL, 0, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, H5D_VDS_ERROR, HSIZE_UNDEF, -1, -1, FALSE}
#ifdef H5_HAVE_C99_DESIGNATED_INITIALIZER
#define H5D_DEF_STORAGE_COMPACT {H5D_COMPACT, { .compact = H5D_DEF_STORAGE_COMPACT_INIT }}
#define H5D_DEF_STORAGE_CONTIG {H5D_CONTIGUOUS, { .contig = H5D_DEF_STORAGE_CONTIG_INIT }}
#define H5D_DEF_STORAGE_CHUNK {H5D_CHUNKED, { .chunk = H5D_DEF_STORAGE_CHUNK_INIT }}
#define H5D_DEF_STORAGE_VIRTUAL {H5D_VIRTUAL, { .virt = H5D_DEF_STORAGE_VIRTUAL_INIT }}
-#define H5D_DEF_LAYOUT_COMPACT {H5D_COMPACT, H5O_LAYOUT_VERSION_3, NULL, {H5D_DEF_LAYOUT_CHUNK_INIT}, H5D_DEF_STORAGE_COMPACT}
-#define H5D_DEF_LAYOUT_CONTIG {H5D_CONTIGUOUS, H5O_LAYOUT_VERSION_3, NULL, {H5D_DEF_LAYOUT_CHUNK_INIT}, H5D_DEF_STORAGE_CONTIG}
-#define H5D_DEF_LAYOUT_CHUNK {H5D_CHUNKED, H5O_LAYOUT_VERSION_3, NULL, {H5D_DEF_LAYOUT_CHUNK_INIT}, H5D_DEF_STORAGE_CHUNK}
-#define H5D_DEF_LAYOUT_VIRTUAL {H5D_VIRTUAL, H5O_LAYOUT_VERSION_3, NULL, {H5D_DEF_LAYOUT_CHUNK_INIT}, H5D_DEF_STORAGE_VIRTUAL}
+#define H5D_DEF_LAYOUT_COMPACT {H5D_COMPACT, H5O_LAYOUT_VERSION_DEFAULT, H5D_LOPS_COMPACT, {H5D_DEF_LAYOUT_CHUNK_INIT}, H5D_DEF_STORAGE_COMPACT}
+#define H5D_DEF_LAYOUT_CONTIG {H5D_CONTIGUOUS, H5O_LAYOUT_VERSION_DEFAULT, H5D_LOPS_CONTIG, {H5D_DEF_LAYOUT_CHUNK_INIT}, H5D_DEF_STORAGE_CONTIG}
+#define H5D_DEF_LAYOUT_CHUNK {H5D_CHUNKED, H5O_LAYOUT_VERSION_DEFAULT, H5D_LOPS_CHUNK, {H5D_DEF_LAYOUT_CHUNK_INIT}, H5D_DEF_STORAGE_CHUNK}
+#define H5D_DEF_LAYOUT_VIRTUAL {H5D_VIRTUAL, H5O_LAYOUT_VERSION_4, H5D_LOPS_VIRTUAL, {H5D_DEF_LAYOUT_CHUNK_INIT}, H5D_DEF_STORAGE_VIRTUAL}
#else /* H5_HAVE_C99_DESIGNATED_INITIALIZER */
/* Note that the compact & chunked layout initialization values are using the
* contiguous layout initialization in the union, because the contiguous
* layout is first in the union. These values are overridden in the
* H5P__init_def_layout() routine. -QAK
*/
-#define H5D_DEF_LAYOUT_COMPACT {H5D_COMPACT, H5O_LAYOUT_VERSION_3, NULL, {H5D_DEF_LAYOUT_CHUNK_INIT}, {H5D_CONTIGUOUS, H5D_DEF_STORAGE_CONTIG_INIT}}
-#define H5D_DEF_LAYOUT_CONTIG {H5D_CONTIGUOUS, H5O_LAYOUT_VERSION_3, NULL, {H5D_DEF_LAYOUT_CHUNK_INIT}, {H5D_CONTIGUOUS, H5D_DEF_STORAGE_CONTIG_INIT}}
-#define H5D_DEF_LAYOUT_CHUNK {H5D_CHUNKED, H5O_LAYOUT_VERSION_3, NULL, {H5D_DEF_LAYOUT_CHUNK_INIT}, {H5D_CONTIGUOUS, H5D_DEF_STORAGE_CONTIG_INIT}}
-#define H5D_DEF_LAYOUT_VIRTUAL {H5D_VIRTUAL, H5O_LAYOUT_VERSION_3, NULL, {H5D_DEF_LAYOUT_CHUNK_INIT}, {H5D_CONTIGUOUS, H5D_DEF_STORAGE_CONTIG_INIT}}
+#define H5D_DEF_LAYOUT_COMPACT {H5D_COMPACT, H5O_LAYOUT_VERSION_DEFAULT, NULL, {H5D_DEF_LAYOUT_CHUNK_INIT}, {H5D_CONTIGUOUS, H5D_DEF_STORAGE_CONTIG_INIT}}
+#define H5D_DEF_LAYOUT_CONTIG {H5D_CONTIGUOUS, H5O_LAYOUT_VERSION_DEFAULT, NULL, {H5D_DEF_LAYOUT_CHUNK_INIT}, {H5D_CONTIGUOUS, H5D_DEF_STORAGE_CONTIG_INIT}}
+#define H5D_DEF_LAYOUT_CHUNK {H5D_CHUNKED, H5O_LAYOUT_VERSION_DEFAULT, NULL, {H5D_DEF_LAYOUT_CHUNK_INIT}, {H5D_CONTIGUOUS, H5D_DEF_STORAGE_CONTIG_INIT}}
+#define H5D_DEF_LAYOUT_VIRTUAL {H5D_VIRTUAL, H5O_LAYOUT_VERSION_4, NULL, {H5D_DEF_LAYOUT_CHUNK_INIT}, {H5D_CONTIGUOUS, H5D_DEF_STORAGE_CONTIG_INIT}}
#endif /* H5_HAVE_C99_DESIGNATED_INITIALIZER */
/* ======== Dataset creation properties ======== */
@@ -791,12 +792,6 @@ H5P__dcrt_layout_cmp(const void *_layout1, const void *_layout2,
if(layout1->type > layout2->type)
HGOTO_DONE(1)
- /* Check for different layout version */
- if(layout1->version < layout2->version)
- HGOTO_DONE(-1)
- if(layout1->version > layout2->version)
- HGOTO_DONE(1)
-
/* Compare non-dataset-specific fields in layout info */
switch(layout1->type) {
case H5D_COMPACT:
@@ -1668,14 +1663,6 @@ H5P__dcrt_ext_file_list_cmp(const void *_efl1, const void *_efl2,
HDassert(efl2);
HDassert(size == sizeof(H5O_efl_t));
- /* Check the heap address of external file lists */
- if(H5F_addr_defined(efl1->heap_addr) || H5F_addr_defined(efl2->heap_addr)) {
- if(!H5F_addr_defined(efl1->heap_addr) && H5F_addr_defined(efl2->heap_addr)) HGOTO_DONE(-1);
- if(H5F_addr_defined(efl1->heap_addr) && !H5F_addr_defined(efl2->heap_addr)) HGOTO_DONE(1);
- if((cmp_value = H5F_addr_cmp(efl1->heap_addr, efl2->heap_addr)) != 0)
- HGOTO_DONE(cmp_value);
- } /* end if */
-
/* Check the number of allocated efl entries */
if(efl1->nalloc < efl2->nalloc) HGOTO_DONE(-1);
if(efl1->nalloc > efl2->nalloc) HGOTO_DONE(1);
@@ -2231,9 +2218,9 @@ H5Pset_virtual(hid_t dcpl_id, hid_t vspace_id, const char *src_file_name,
HDmemset(ent, 0, sizeof(H5O_storage_virtual_ent_t)); /* Clear before starting to set up */
if(NULL == (ent->source_dset.virtual_select = H5S_copy(vspace, FALSE, TRUE)))
HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "unable to copy virtual selection")
- if(NULL == (ent->source_file_name = HDstrdup(src_file_name)))
+ if(NULL == (ent->source_file_name = H5MM_xstrdup(src_file_name)))
HGOTO_ERROR(H5E_PLIST, H5E_RESOURCE, FAIL, "can't duplicate source file name")
- if(NULL == (ent->source_dset_name = HDstrdup(src_dset_name)))
+ if(NULL == (ent->source_dset_name = H5MM_xstrdup(src_dset_name)))
HGOTO_ERROR(H5E_PLIST, H5E_RESOURCE, FAIL, "can't duplicate source file name")
if(NULL == (ent->source_select = H5S_copy(src_space, FALSE, TRUE)))
HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "unable to copy source selection")
@@ -2521,8 +2508,8 @@ done:
*
* If the length of the filename, which determines the
* required value of size, is unknown, a preliminary call to
- * H5Pget_virtual_filename with the last two parameters set
- * to NULL can be made. The return value of this call will
+ * H5Pget_virtual_filename with 'name' set to NULL and 'size'
+ * set to zero can be made. The return value of this call will
* be the size in bytes of the filename. That value, plus 1
* for a NULL terminator, is then assigned to size for a
* second H5Pget_virtual_filename call, which will retrieve
@@ -2582,14 +2569,14 @@ done:
* additional characters, if any, are not returned to the
* user application.
*
- * If the length of the filename, which determines the
+ * If the length of the dataset name, which determines the
* required value of size, is unknown, a preliminary call to
- * H5Pget_virtual_dsetname with the last two parameters set
- * to NULL can be made. The return value of this call will
- * be the size in bytes of the filename. That value, plus 1
+ * H5Pget_virtual_dsetname with 'name' set to NULL and 'size'
+ * set to zero can be made. The return value of this call will
+ * be the size in bytes of the dataset name. That value, plus 1
* for a NULL terminator, is then assigned to size for a
* second H5Pget_virtual_dsetname call, which will retrieve
- * the actual filename.
+ * the actual dataset name.
*
* Return: Returns the length of the name if successful, otherwise
* returns a negative value.
@@ -2635,6 +2622,127 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5Pset_chunk_opts
+ *
+ * Purpose: Sets the options related to chunked storage for a dataset.
+ * The storage must already be set to chunked.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Neil Fortner
+ * Thursday, January 21, 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pset_chunk_opts(hid_t plist_id, unsigned options)
+{
+ H5P_genplist_t *plist; /* Property list pointer */
+ H5O_layout_t layout; /* Layout information for setting chunk info */
+ uint8_t layout_flags = 0; /* "options" translated into layout message flags format */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE2("e", "iIu", plist_id, options);
+
+ /* Check arguments */
+ if(options & ~(H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "unknown chunk options")
+
+#ifndef H5_HAVE_C99_DESIGNATED_INITIALIZER
+ /* If the compiler doesn't support C99 designated initializers, check if
+ * the default layout structs have been initialized yet or not. *ick* -QAK
+ */
+ if(!H5P_dcrt_def_layout_init_g)
+ if(H5P__init_def_layout() < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't initialize default layout info")
+#endif /* H5_HAVE_C99_DESIGNATED_INITIALIZER */
+
+ /* Get the plist structure */
+ if(NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+
+ /* Retrieve the layout property */
+ if(H5P_peek(plist, H5D_CRT_LAYOUT_NAME, &layout) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't get layout")
+ if(H5D_CHUNKED != layout.type)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a chunked storage layout")
+
+ /* Translate options into flags that can be used with the layout message */
+ if(options & H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS)
+ layout_flags |= H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS;
+
+ /* Update the layout message, including the version (if necessary) */
+ /* This probably isn't the right way to do this, and should be changed once
+ * this branch gets the "real" way to set the layout version */
+ layout.u.chunk.flags = layout_flags;
+ if(layout.version < H5O_LAYOUT_VERSION_4)
+ layout.version = H5O_LAYOUT_VERSION_4;
+
+ /* Set layout value */
+ if(H5P_poke(plist, H5D_CRT_LAYOUT_NAME, &layout) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't set layout")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Pset_chunk_opts() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pget_chunk_opts
+ *
+ * Purpose: Gets the options related to chunked storage for a dataset.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Neil Fortner
+ * Friday, January 22, 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pget_chunk_opts(hid_t plist_id, unsigned *options)
+{
+ H5P_genplist_t *plist; /* Property list pointer */
+ H5O_layout_t layout; /* Layout information for setting chunk info */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE2("e", "i*Iu", plist_id, options);
+
+#ifndef H5_HAVE_C99_DESIGNATED_INITIALIZER
+ /* If the compiler doesn't support C99 designated initializers, check if
+ * the default layout structs have been initialized yet or not. *ick* -QAK
+ */
+ if(!H5P_dcrt_def_layout_init_g)
+ if(H5P__init_def_layout() < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't initialize default layout info")
+#endif /* H5_HAVE_C99_DESIGNATED_INITIALIZER */
+
+ /* Get the plist structure */
+ if(NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+
+ /* Retrieve the layout property */
+ if(H5P_peek(plist, H5D_CRT_LAYOUT_NAME, &layout) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't get layout")
+ if(H5D_CHUNKED != layout.type)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a chunked storage layout")
+
+ if(options) {
+ /* Translate options from flags that can be used with the layout message
+ * to those known to the public */
+ *options = 0;
+ if(layout.u.chunk.flags & H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS)
+ *options |= H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS;
+ } /* end if */
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Pget_chunk_opts() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5Pset_external
*
* Purpose: Adds an external file to the list of external files. PLIST_ID
@@ -3129,7 +3237,7 @@ H5Pset_fill_value(hid_t plist_id, hid_t type_id, const void *value)
HDmemcpy(fill.buf, value, (size_t)fill.size);
/* Set up type conversion function */
- if(NULL == (tpath = H5T_path_find(type, type, NULL, NULL, H5AC_ind_dxpl_id, FALSE)))
+ if(NULL == (tpath = H5T_path_find(type, type, NULL, NULL, H5AC_ind_read_dxpl_id, FALSE)))
HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "unable to convert between src and dest data types")
/* If necessary, convert fill value datatypes (which copies VL components, etc.) */
@@ -3141,7 +3249,7 @@ H5Pset_fill_value(hid_t plist_id, hid_t type_id, const void *value)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
/* Convert the fill value */
- if(H5T_convert(tpath, type_id, type_id, (size_t)1, (size_t)0, (size_t)0, fill.buf, bkg_buf, H5AC_ind_dxpl_id) < 0) {
+ if(H5T_convert(tpath, type_id, type_id, (size_t)1, (size_t)0, (size_t)0, fill.buf, bkg_buf, H5AC_ind_read_dxpl_id) < 0) {
if(bkg_buf)
bkg_buf = H5FL_BLK_FREE(type_conv, bkg_buf);
HGOTO_ERROR(H5E_DATASET, H5E_CANTCONVERT, FAIL, "datatype conversion failed")
@@ -3296,7 +3404,7 @@ H5Pget_fill_value(hid_t plist_id, hid_t type_id, void *value/*out*/)
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
/* Get the fill value */
- if(H5P_get_fill_value(plist, type, value, H5AC_ind_dxpl_id) < 0)
+ if(H5P_get_fill_value(plist, type, value, H5AC_ind_read_dxpl_id) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fill value")
done:
diff --git a/src/H5Pdxpl.c b/src/H5Pdxpl.c
index d56a52a..9353094 100644
--- a/src/H5Pdxpl.c
+++ b/src/H5Pdxpl.c
@@ -38,6 +38,7 @@
#include "H5ACprivate.h" /* Cache */
#include "H5Dprivate.h" /* Datasets */
#include "H5Eprivate.h" /* Error handling */
+#include "H5FDprivate.h" /* File drivers */
#include "H5Iprivate.h" /* IDs */
#include "H5MMprivate.h" /* Memory management */
#include "H5Ppkg.h" /* Property lists */
@@ -175,6 +176,18 @@
#define H5AC_XFER_RING_DEF H5AC_RING_US
#define H5AC_XFER_RING_ENC H5P__encode_unsigned
#define H5AC_XFER_RING_DEC H5P__decode_unsigned
+#ifdef H5_DEBUG_BUILD
+/* dxpl I/O type - private property */
+#define H5FD_DXPL_TYPE_SIZE sizeof(H5FD_dxpl_type_t)
+#endif /* H5_DEBUG_BUILD */
+#ifdef H5_HAVE_PARALLEL
+/* Definition for reading metadata collectively */
+#define H5D_XFER_COLL_MD_READ_SIZE sizeof(H5P_coll_md_read_flag_t)
+#define H5D_XFER_COLL_MD_READ_DEF H5P_USER_FALSE
+#define H5D_XFER_COLL_MD_READ_ENC H5P__encode_coll_md_read_flag_t
+#define H5D_XFER_COLL_MD_READ_DEC H5P__decode_coll_md_read_flag_t
+#endif /* H5_HAVE_PARALLEL */
+
/******************/
/* Local Typedefs */
@@ -272,6 +285,7 @@ static const H5D_mpio_no_collective_cause_t H5D_def_mpio_no_collective_cause_g =
#ifdef H5_HAVE_PARALLEL
static const MPI_Datatype H5D_def_btype_g = H5FD_MPI_XFER_MEM_MPI_TYPE_DEF; /* Default value for MPI buffer type */
static const MPI_Datatype H5D_def_ftype_g = H5FD_MPI_XFER_FILE_MPI_TYPE_DEF; /* Default value for MPI file type */
+static const H5P_coll_md_read_flag_t H5D_def_coll_md_read_g = H5D_XFER_COLL_MD_READ_DEF; /* Default setting for the collective metedata read flag */
#endif /* H5_HAVE_PARALLEL */
static const H5Z_EDC_t H5D_def_enable_edc_g = H5D_XFER_EDC_DEF; /* Default value for EDC property */
static const H5Z_cb_t H5D_def_filter_cb_g = H5D_XFER_FILTER_CB_DEF; /* Default value for filter callback */
@@ -282,6 +296,9 @@ static const uint32_t H5D_def_direct_chunk_filters_g = H5D_XFER_DIRECT_CHUNK_WRI
static const hsize_t *H5D_def_direct_chunk_offset_g = H5D_XFER_DIRECT_CHUNK_WRITE_OFFSET_DEF; /* Default value for the offset of direct chunk write */
static const uint32_t H5D_def_direct_chunk_datasize_g = H5D_XFER_DIRECT_CHUNK_WRITE_DATASIZE_DEF; /* Default value for the datasize of direct chunk write */
static const H5AC_ring_t H5D_ring_g = H5AC_XFER_RING_DEF; /* Default value for the cache entry ring type */
+#ifdef H5_DEBUG_BUILD
+static const H5FD_dxpl_type_t H5D_dxpl_type_g = H5FD_NOIO_DXPL; /* Default value for the dxpl type */
+#endif /* H5_DEBUG_BUILD */
/*-------------------------------------------------------------------------
@@ -426,6 +443,13 @@ H5P__dxfr_reg_prop(H5P_genclass_t *pclass)
if(H5P_register_real(pclass, H5FD_MPI_XFER_FILE_MPI_TYPE_NAME, H5FD_MPI_XFER_FILE_MPI_TYPE_SIZE, &H5D_def_ftype_g,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
+
+ /* Register the metadata collective read flag */
+ if(H5P_register_real(pclass, H5_COLL_MD_READ_FLAG_NAME, H5D_XFER_COLL_MD_READ_SIZE,
+ &H5D_def_coll_md_read_g,
+ NULL, NULL, NULL, H5D_XFER_COLL_MD_READ_ENC, H5D_XFER_COLL_MD_READ_DEC,
+ NULL, NULL, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
#endif /* H5_HAVE_PARALLEL */
/* Register the EDC property */
@@ -476,12 +500,19 @@ H5P__dxfr_reg_prop(H5P_genclass_t *pclass)
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
- /* Register the data transform property */
+ /* Register the ring property (private) */
if(H5P_register_real(pclass, H5AC_RING_NAME, H5AC_XFER_RING_SIZE, &H5D_ring_g,
NULL, NULL, NULL, H5AC_XFER_RING_ENC, H5AC_XFER_RING_DEC,
NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
+#ifdef H5_DEBUG_BUILD
+ /* Register the dxpl IO type property */
+ if(H5P_register_real(pclass, H5FD_DXPL_TYPE_NAME, H5FD_DXPL_TYPE_SIZE, &H5D_dxpl_type_g,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
+#endif /* H5_DEBUG_BUILD */
+
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P__dxfr_reg_prop() */
diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c
index 0eb6ef6..61a63ea 100644
--- a/src/H5Pfapl.c
+++ b/src/H5Pfapl.c
@@ -196,6 +196,18 @@
#define H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_DEF 524288
#define H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_ENC H5P__encode_size_t
#define H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_DEC H5P__decode_size_t
+#ifdef H5_HAVE_PARALLEL
+/* Definition of collective metadata read mode flag */
+#define H5F_ACS_COLL_MD_READ_FLAG_SIZE sizeof(H5P_coll_md_read_flag_t)
+#define H5F_ACS_COLL_MD_READ_FLAG_DEF H5P_USER_FALSE
+#define H5F_ACS_COLL_MD_READ_FLAG_ENC H5P__encode_coll_md_read_flag_t
+#define H5F_ACS_COLL_MD_READ_FLAG_DEC H5P__decode_coll_md_read_flag_t
+/* Definition of collective metadata write mode flag */
+#define H5F_ACS_COLL_MD_WRITE_FLAG_SIZE sizeof(hbool_t)
+#define H5F_ACS_COLL_MD_WRITE_FLAG_DEF FALSE
+#define H5F_ACS_COLL_MD_WRITE_FLAG_ENC H5P__encode_hbool_t
+#define H5F_ACS_COLL_MD_WRITE_FLAG_DEC H5P__decode_hbool_t
+#endif /* H5_HAVE_PARALLEL */
/******************/
/* Local Typedefs */
@@ -307,7 +319,10 @@ static const unsigned H5F_def_efc_size_g = H5F_ACS_EFC_SIZE_DEF;
static const H5FD_file_image_info_t H5F_def_file_image_info_g = H5F_ACS_FILE_IMAGE_INFO_DEF; /* Default file image info and callbacks */
static const hbool_t H5F_def_core_write_tracking_flag_g = H5F_ACS_CORE_WRITE_TRACKING_FLAG_DEF; /* Default setting for core VFD write tracking */
static const size_t H5F_def_core_write_tracking_page_size_g = H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_DEF; /* Default core VFD write tracking page size */
-
+#ifdef H5_HAVE_PARALLEL
+static const H5P_coll_md_read_flag_t H5F_def_coll_md_read_flag_g = H5F_ACS_COLL_MD_READ_FLAG_DEF; /* Default setting for the collective metedata read flag */
+static const hbool_t H5F_def_coll_md_write_flag_g = H5F_ACS_COLL_MD_WRITE_FLAG_DEF; /* Default setting for the collective metedata write flag */
+#endif /* H5_HAVE_PARALLEL */
/*-------------------------------------------------------------------------
@@ -462,17 +477,31 @@ H5P__facc_reg_prop(H5P_genclass_t *pclass)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the core VFD backing store write tracking flag */
- if(H5P_register_real(pclass, H5F_ACS_CORE_WRITE_TRACKING_FLAG_NAME, H5F_ACS_CORE_WRITE_TRACKING_FLAG_SIZE, &H5F_def_core_write_tracking_flag_g ,
+ if(H5P_register_real(pclass, H5F_ACS_CORE_WRITE_TRACKING_FLAG_NAME, H5F_ACS_CORE_WRITE_TRACKING_FLAG_SIZE, &H5F_def_core_write_tracking_flag_g,
NULL, NULL, NULL, H5F_ACS_CORE_WRITE_TRACKING_FLAG_ENC, H5F_ACS_CORE_WRITE_TRACKING_FLAG_DEC,
NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the size of the core VFD backing store page size */
- if(H5P_register_real(pclass, H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_NAME, H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_SIZE, &H5F_def_core_write_tracking_page_size_g ,
+ if(H5P_register_real(pclass, H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_NAME, H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_SIZE, &H5F_def_core_write_tracking_page_size_g,
NULL, NULL, NULL, H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_ENC, H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_DEC,
NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
+#ifdef H5_HAVE_PARALLEL
+ /* Register the metadata collective read flag */
+ if(H5P_register_real(pclass, H5_COLL_MD_READ_FLAG_NAME, H5F_ACS_COLL_MD_READ_FLAG_SIZE, &H5F_def_coll_md_read_flag_g,
+ NULL, NULL, NULL, H5F_ACS_COLL_MD_READ_FLAG_ENC, H5F_ACS_COLL_MD_READ_FLAG_DEC,
+ NULL, NULL, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
+
+ /* Register the metadata collective write flag */
+ if(H5P_register_real(pclass, H5F_ACS_COLL_MD_WRITE_FLAG_NAME, H5F_ACS_COLL_MD_WRITE_FLAG_SIZE, &H5F_def_coll_md_write_flag_g,
+ NULL, NULL, NULL, H5F_ACS_COLL_MD_WRITE_FLAG_ENC, H5F_ACS_COLL_MD_WRITE_FLAG_DEC,
+ NULL, NULL, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
+#endif /* H5_HAVE_PARALLEL */
+
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P__facc_reg_prop() */
@@ -3971,6 +4000,9 @@ H5P__facc_multi_type_dec(const void **_pp, void *_value)
*
* Return: Non-negative on success/Negative on failure
*
+ * Programmer: Dana Robinson
+ * Tuesday, April 8, 2014
+ *
*-------------------------------------------------------------------------
*/
herr_t
@@ -3998,7 +4030,7 @@ H5Pset_core_write_tracking(hid_t plist_id, hbool_t is_enabled, size_t page_size)
done:
FUNC_LEAVE_API(ret_value)
-}
+} /* end H5Pset_core_write_tracking() */
/*-------------------------------------------------------------------------
@@ -4009,6 +4041,9 @@ done:
*
* Return: Non-negative on success/Negative on failure
*
+ * Programmer: Dana Robinson
+ * Tuesday, April 8, 2014
+ *
*-------------------------------------------------------------------------
*/
herr_t
@@ -4037,5 +4072,272 @@ H5Pget_core_write_tracking(hid_t plist_id, hbool_t *is_enabled, size_t *page_siz
done:
FUNC_LEAVE_API(ret_value)
-}
+} /* end H5Pget_core_write_tracking() */
+
+#ifdef H5_HAVE_PARALLEL
+
+/*-------------------------------------------------------------------------
+ * Function: H5P__encode_coll_md_read_flag_t
+ *
+ * Purpose: Generic encoding callback routine for 'coll_md_read_flag' properties.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Mohamad Chaarawi
+ * Sunday, June 21, 2015
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5P__encode_coll_md_read_flag_t(const void *value, void **_pp, size_t *size)
+{
+ const H5P_coll_md_read_flag_t *coll_md_read_flag = (const H5P_coll_md_read_flag_t *)value;
+ uint8_t **pp = (uint8_t **)_pp;
+
+ FUNC_ENTER_PACKAGE_NOERR
+
+ /* Sanity checks */
+ HDassert(coll_md_read_flag);
+ HDassert(size);
+
+ if(NULL != *pp) {
+ /* Encode the value */
+ HDmemcpy(*pp, coll_md_read_flag, sizeof(H5P_coll_md_read_flag_t));
+ *pp += sizeof(H5P_coll_md_read_flag_t);
+ } /* end if */
+
+ /* Set size needed for encoding */
+ *size += sizeof(H5P_coll_md_read_flag_t);
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5P__encode_coll_md_read_flag_t() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5P__decode_coll_md_read_flag_t
+ *
+ * Purpose: Generic decoding callback routine for 'coll_md_read_flag' properties.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Mohamad Chaarawi
+ * Sunday, June 21, 2015
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5P__decode_coll_md_read_flag_t(const void **_pp, void *_value)
+{
+ H5P_coll_md_read_flag_t *coll_md_read_flag = (H5P_coll_md_read_flag_t *)_value; /* File close degree */
+ const uint8_t **pp = (const uint8_t **)_pp;
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Sanity checks */
+ HDassert(pp);
+ HDassert(*pp);
+ HDassert(coll_md_read_flag);
+
+ /* Decode file close degree */
+ *coll_md_read_flag = (H5P_coll_md_read_flag_t)*(*pp);
+ *pp += sizeof(H5P_coll_md_read_flag_t);
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5P__decode_coll_md_read_flag_t() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pset_all_coll_metadata_ops
+ *
+ * Purpose: Tell the library whether the metadata read operations will
+ * be done collectively (1) or not (0). Default is independent.
+ * With collective mode, the library will optimize access to
+ * metadata operations on the file.
+ *
+ * Note: This routine accepts file access property lists, link
+ * access property lists, attribute access property lists,
+ * dataset access property lists, group access property lists,
+ * named datatype access property lists,
+ * and dataset transfer property lists.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Mohamad Chaarawi
+ * Sunday, June 21, 2015
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pset_all_coll_metadata_ops(hid_t plist_id, hbool_t is_collective)
+{
+ H5P_genplist_t *plist; /* Property list pointer */
+ H5P_coll_md_read_flag_t coll_meta_read; /* Property value */
+ herr_t ret_value = SUCCEED; /* return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE2("e", "ib", plist_id, is_collective);
+
+ /* Compare the property list's class against the other class */
+ /* (Dataset, group, attribute, and named datype access property lists
+ * are sub-classes of link access property lists -QAK)
+ */
+ if(TRUE != H5P_isa_class(plist_id, H5P_LINK_ACCESS) &&
+ TRUE != H5P_isa_class(plist_id, H5P_FILE_ACCESS) &&
+ TRUE != H5P_isa_class(plist_id, H5P_DATASET_XFER))
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "property list is not an access plist")
+
+ /* set property to either TRUE if > 0, or FALSE otherwise */
+ if(is_collective)
+ coll_meta_read = H5P_USER_TRUE;
+ else
+ coll_meta_read = H5P_USER_FALSE;
+
+ /* Get the plist structure */
+ if(NULL == (plist = (H5P_genplist_t *)H5I_object(plist_id)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+
+ /* Set values */
+ if(H5P_set(plist, H5_COLL_MD_READ_FLAG_NAME, &coll_meta_read) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set collective metadata read flag")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Pset_all_coll_metadata_ops() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pget_all_coll_metadata_ops
+ *
+ * Purpose: Gets information about collective metadata read mode.
+ *
+ * Note: This routine accepts file access property lists, link
+ * access property lists, attribute access property lists,
+ * dataset access property lists, group access property lists,
+ * named datatype access property lists,
+ * and dataset transfer property lists.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Mohamad Chaarawi
+ * Sunday, June 21, 2015
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pget_all_coll_metadata_ops(hid_t plist_id, hbool_t *is_collective)
+{
+ herr_t ret_value = SUCCEED; /* return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE2("e", "i*b", plist_id, is_collective);
+
+ /* Compare the property list's class against the other class */
+ /* (Dataset, group, attribute, and named datype access property lists
+ * are sub-classes of link access property lists -QAK)
+ */
+ if(TRUE != H5P_isa_class(plist_id, H5P_LINK_ACCESS) &&
+ TRUE != H5P_isa_class(plist_id, H5P_FILE_ACCESS) &&
+ TRUE != H5P_isa_class(plist_id, H5P_DATASET_XFER))
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "property list is not an access plist")
+
+ /* Get value */
+ if(is_collective) {
+ H5P_coll_md_read_flag_t internal_flag; /* property setting. we need to convert to either TRUE or FALSE */
+ H5P_genplist_t *plist; /* Property list pointer */
+
+ /* Get the plist structure */
+ if(NULL == (plist = (H5P_genplist_t *)H5I_object(plist_id)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+
+ if(H5P_get(plist, H5_COLL_MD_READ_FLAG_NAME, &internal_flag) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get core collective metadata read flag")
+
+ if(internal_flag < 0)
+ *is_collective = FALSE;
+ else
+ *is_collective = (hbool_t)internal_flag;
+ } /* end if */
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* H5Pget_all_coll_metadata_ops */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pset_coll_metadata_write
+ *
+ * Purpose: Tell the library whether the metadata write operations will
+ * be done collectively (1) or not (0). Default is collective.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Mohamad Chaarawi
+ * Sunday, June 21, 2015
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pset_coll_metadata_write(hid_t plist_id, hbool_t is_collective)
+{
+ H5P_genplist_t *plist; /* Property list pointer */
+ herr_t ret_value = SUCCEED; /* return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE2("e", "ib", plist_id, is_collective);
+
+ /* Compare the property list's class against the other class */
+ if(TRUE != H5P_isa_class(plist_id, H5P_FILE_ACCESS))
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "property list is not a file access plist")
+
+ /* Get the plist structure */
+ if(NULL == (plist = (H5P_genplist_t *)H5I_object(plist_id)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+
+ /* Set values */
+ if(H5P_set(plist, H5F_ACS_COLL_MD_WRITE_FLAG_NAME, &is_collective) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set collective metadata write flag")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Pset_coll_metadata_write() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pget_coll_metadata_write
+ *
+ * Purpose: Gets information about collective metadata write mode.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Mohamad Chaarawi
+ * Sunday, June 21, 2015
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pget_coll_metadata_write(hid_t plist_id, hbool_t *is_collective)
+{
+ H5P_genplist_t *plist; /* Property list pointer */
+ herr_t ret_value = SUCCEED; /* return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE2("e", "i*b", plist_id, is_collective);
+
+ /* Compare the property list's class against the other class */
+ if(TRUE != H5P_isa_class(plist_id, H5P_FILE_ACCESS))
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "property list is not an access plist")
+
+ /* Get the plist structure */
+ if(NULL == (plist = (H5P_genplist_t *)H5I_object(plist_id)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+
+ if(H5P_get(plist, H5F_ACS_COLL_MD_WRITE_FLAG_NAME, is_collective) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get collective metadata write flag")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Pget_coll_metadata_write() */
+#endif /* H5_HAVE_PARALLEL */
diff --git a/src/H5Pint.c b/src/H5Pint.c
index 052fe0a..4e26dcd 100644
--- a/src/H5Pint.c
+++ b/src/H5Pint.c
@@ -29,7 +29,11 @@
/* Headers */
/***********/
#include "H5private.h" /* Generic Functions */
+#ifdef H5_HAVE_PARALLEL
+#include "H5ACprivate.h" /* Metadata cache */
+#endif /* H5_HAVE_PARALLEL */
#include "H5Eprivate.h" /* Error handling */
+#include "H5Fprivate.h" /* File access */
#include "H5FLprivate.h" /* Free lists */
#include "H5Iprivate.h" /* IDs */
#include "H5MMprivate.h" /* Memory management */
@@ -139,6 +143,8 @@ hid_t H5P_CLS_DATATYPE_ACCESS_ID_g = FAIL;
H5P_genclass_t *H5P_CLS_DATATYPE_ACCESS_g = NULL;
hid_t H5P_CLS_ATTRIBUTE_CREATE_ID_g = FAIL;
H5P_genclass_t *H5P_CLS_ATTRIBUTE_CREATE_g = NULL;
+hid_t H5P_CLS_ATTRIBUTE_ACCESS_ID_g = FAIL;
+H5P_genclass_t *H5P_CLS_ATTRIBUTE_ACCESS_g = NULL;
hid_t H5P_CLS_OBJECT_COPY_ID_g = FAIL;
H5P_genclass_t *H5P_CLS_OBJECT_COPY_g = NULL;
hid_t H5P_CLS_LINK_CREATE_ID_g = FAIL;
@@ -163,6 +169,7 @@ hid_t H5P_LST_GROUP_ACCESS_ID_g = FAIL;
hid_t H5P_LST_DATATYPE_CREATE_ID_g = FAIL;
hid_t H5P_LST_DATATYPE_ACCESS_ID_g = FAIL;
hid_t H5P_LST_ATTRIBUTE_CREATE_ID_g = FAIL;
+hid_t H5P_LST_ATTRIBUTE_ACCESS_ID_g = FAIL;
hid_t H5P_LST_OBJECT_COPY_ID_g = FAIL;
hid_t H5P_LST_LINK_CREATE_ID_g = FAIL;
hid_t H5P_LST_LINK_ACCESS_ID_g = FAIL;
@@ -186,6 +193,26 @@ const H5P_libclass_t H5P_CLS_ROOT[1] = {{
NULL /* Class close callback info */
}};
+/* Attribute access property list class library initialization object */
+/* (move to proper source code file when used for real) */
+const H5P_libclass_t H5P_CLS_AACC[1] = {{
+ "attribute access", /* Class name for debugging */
+ H5P_TYPE_ATTRIBUTE_ACCESS, /* Class type */
+
+ &H5P_CLS_LINK_ACCESS_g, /* Parent class */
+ &H5P_CLS_ATTRIBUTE_ACCESS_g, /* Pointer to class */
+ &H5P_CLS_ATTRIBUTE_ACCESS_ID_g, /* Pointer to class ID */
+ &H5P_LST_ATTRIBUTE_ACCESS_ID_g, /* Pointer to default property list ID */
+ NULL, /* Default property registration routine */
+
+ NULL, /* Class creation callback */
+ NULL, /* Class creation callback info */
+ NULL, /* Class copy callback */
+ NULL, /* Class copy callback info */
+ NULL, /* Class close callback */
+ NULL /* Class close callback info */
+}};
+
/* Group access property list class library initialization object */
/* (move to proper source code file when used for real) */
const H5P_libclass_t H5P_CLS_GACC[1] = {{
@@ -250,13 +277,10 @@ const H5P_libclass_t H5P_CLS_TACC[1] = {{
/* Library property list classes defined in other code modules */
H5_DLLVAR const H5P_libclass_t H5P_CLS_OCRT[1]; /* Object creation */
H5_DLLVAR const H5P_libclass_t H5P_CLS_STRCRT[1]; /* String create */
-H5_DLLVAR const H5P_libclass_t H5P_CLS_LACC[1]; /* Link access */
H5_DLLVAR const H5P_libclass_t H5P_CLS_GCRT[1]; /* Group create */
H5_DLLVAR const H5P_libclass_t H5P_CLS_OCPY[1]; /* Object copy */
H5_DLLVAR const H5P_libclass_t H5P_CLS_FCRT[1]; /* File creation */
-H5_DLLVAR const H5P_libclass_t H5P_CLS_FACC[1]; /* File access */
H5_DLLVAR const H5P_libclass_t H5P_CLS_DCRT[1]; /* Dataset creation */
-H5_DLLVAR const H5P_libclass_t H5P_CLS_DACC[1]; /* Dataset access */
H5_DLLVAR const H5P_libclass_t H5P_CLS_DXFR[1]; /* Data transfer */
H5_DLLVAR const H5P_libclass_t H5P_CLS_FMNT[1]; /* File mount */
H5_DLLVAR const H5P_libclass_t H5P_CLS_ACRT[1]; /* Attribute creation */
@@ -297,6 +321,7 @@ static H5P_libclass_t const * const init_class[] = {
H5P_CLS_TCRT, /* Datatype creation */
H5P_CLS_TACC, /* Datatype access */
H5P_CLS_ACRT, /* Attribute creation */
+ H5P_CLS_AACC, /* Attribute access */
H5P_CLS_LCRT /* Link creation */
};
@@ -487,6 +512,7 @@ H5P_term_package(void)
H5P_LST_DATATYPE_CREATE_ID_g =
H5P_LST_DATATYPE_ACCESS_ID_g =
H5P_LST_ATTRIBUTE_CREATE_ID_g =
+ H5P_LST_ATTRIBUTE_ACCESS_ID_g =
H5P_LST_OBJECT_COPY_ID_g =
H5P_LST_LINK_CREATE_ID_g =
H5P_LST_LINK_ACCESS_ID_g =
@@ -513,6 +539,7 @@ H5P_term_package(void)
H5P_CLS_DATATYPE_ACCESS_g =
H5P_CLS_STRING_CREATE_g =
H5P_CLS_ATTRIBUTE_CREATE_g =
+ H5P_CLS_ATTRIBUTE_ACCESS_g =
H5P_CLS_OBJECT_COPY_g =
H5P_CLS_LINK_CREATE_g =
H5P_CLS_LINK_ACCESS_g =
@@ -531,6 +558,7 @@ H5P_term_package(void)
H5P_CLS_DATATYPE_ACCESS_ID_g =
H5P_CLS_STRING_CREATE_ID_g =
H5P_CLS_ATTRIBUTE_CREATE_ID_g =
+ H5P_CLS_ATTRIBUTE_ACCESS_ID_g =
H5P_CLS_OBJECT_COPY_ID_g =
H5P_CLS_LINK_CREATE_ID_g =
H5P_CLS_LINK_ACCESS_ID_g =
@@ -1187,7 +1215,7 @@ H5P__find_prop_plist(const H5P_genplist_t *plist, const char *name)
/* Check if the property has been deleted from list */
if(H5SL_search(plist->del,name) != NULL) {
- HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, NULL, "can't find property in skip list")
+ HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, NULL, "property deleted from skip list")
} /* end if */
else {
/* Get the property data from the skip list */
@@ -5253,7 +5281,7 @@ H5P__new_plist_of_type(H5P_plist_type_t type)
FUNC_ENTER_PACKAGE
/* Sanity checks */
- HDcompile_assert(H5P_TYPE_LINK_ACCESS == (H5P_TYPE_MAX_TYPE - 1));
+ HDcompile_assert(H5P_TYPE_ATTRIBUTE_ACCESS == (H5P_TYPE_MAX_TYPE - 1));
HDassert(type >= H5P_TYPE_USER && type <= H5P_TYPE_LINK_ACCESS);
/* Check arguments */
@@ -5316,6 +5344,10 @@ H5P__new_plist_of_type(H5P_plist_type_t type)
class_id = H5P_CLS_ATTRIBUTE_CREATE_ID_g;
break;
+ case H5P_TYPE_ATTRIBUTE_ACCESS:
+ class_id = H5P_CLS_ATTRIBUTE_ACCESS_ID_g;
+ break;
+
case H5P_TYPE_OBJECT_COPY:
class_id = H5P_CLS_OBJECT_COPY_ID_g;
break;
@@ -5424,3 +5456,92 @@ H5P_ignore_cmp(const void H5_ATTR_UNUSED *val1, const void H5_ATTR_UNUSED *val2,
FUNC_LEAVE_NOAPI(0)
} /* end H5P_ignore_cmp() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5P_verify_apl_and_dxpl
+ *
+ * Purpose: Validate access property list and/or switch from generic
+ * property list to default of correct type.
+ *
+ * Also, if using internal DXPL and collective flag is set,
+ * switch to internal collective DXPL.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Mohamad Chaarawi
+ * Sunday, June 21, 2015
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5P_verify_apl_and_dxpl(hid_t *acspl_id, const H5P_libclass_t *libclass, hid_t *dxpl_id,
+ hid_t
+#ifndef H5_HAVE_PARALLEL
+ H5_ATTR_UNUSED
+#endif /* H5_HAVE_PARALLEL */
+ loc_id, hbool_t
+#ifndef H5_HAVE_PARALLEL
+ H5_ATTR_UNUSED
+#endif /* H5_HAVE_PARALLEL */
+ is_collective)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+ /* Sanity check */
+ HDassert(acspl_id);
+ HDassert(libclass);
+ HDassert(dxpl_id);
+
+#ifdef H5_HAVE_PARALLEL
+ /* If parallel is enabled and the file driver used in the MPI-IO
+ VFD, issue an MPI barrier for easier debugging if the API function
+ calling this is supposed to be called collectively. Note that this
+ happens only when the environment variable H5_COLL_BARRIER is set
+ to non 0. */
+ if(is_collective && H5_coll_api_sanity_check_g) {
+ MPI_Comm mpi_comm; /* file communicator */
+
+ /* retrieve the MPI communicator from the loc_id or the fapl_id */
+ if(H5F_mpi_retrieve_comm(loc_id, *acspl_id, &mpi_comm) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get MPI communicator")
+
+ /* issue the barrier */
+ if(mpi_comm != MPI_COMM_NULL)
+ MPI_Barrier(mpi_comm);
+ }
+#endif /* H5_HAVE_PARALLEL */
+
+ /* Set access plist to the default property list of the appropriate class if it's the generic default */
+ if(H5P_DEFAULT == *acspl_id)
+ *acspl_id = *libclass->def_plist_id;
+ else {
+#ifdef H5_HAVE_PARALLEL
+ H5P_coll_md_read_flag_t md_coll_read; /* Collective metadata read flag */
+ H5P_genplist_t *plist; /* Property list pointer */
+#endif /* H5_HAVE_PARALLEL */
+
+ /* Sanity check the access property list class */
+ if(TRUE != H5P_isa_class(*acspl_id, *libclass->class_id))
+ HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not the required access property list")
+
+#ifdef H5_HAVE_PARALLEL
+ /* Get the plist structure for the access property list */
+ if(NULL == (plist = (H5P_genplist_t *)H5I_object(*acspl_id)))
+ HGOTO_ERROR(H5E_PLIST, H5E_BADATOM, FAIL, "can't find object for ID")
+
+ /* Get the collective metadata read flag */
+ if(H5P_peek(plist, H5_COLL_MD_READ_FLAG_NAME, &md_coll_read) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get core collective metadata read flag")
+
+ /* If collective metadata read requested and using internal DXPL, switch to internal collective DXPL */
+ if(H5P_USER_TRUE == md_coll_read)
+ *dxpl_id = H5AC_coll_read_dxpl_id;
+#endif /* H5_HAVE_PARALLEL */
+ } /* end else */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5P_verify_apl_and_dxpl() */
diff --git a/src/H5Plapl.c b/src/H5Plapl.c
index b7c682c..266dc63 100644
--- a/src/H5Plapl.c
+++ b/src/H5Plapl.c
@@ -88,6 +88,13 @@
#define H5L_ACS_ELINK_CB_SIZE sizeof(H5L_elink_cb_t)
#define H5L_ACS_ELINK_CB_DEF {NULL,NULL}
+#ifdef H5_HAVE_PARALLEL
+/* Definition for reading metadata collectively */
+#define H5L_ACS_COLL_MD_READ_SIZE sizeof(H5P_coll_md_read_flag_t)
+#define H5L_ACS_COLL_MD_READ_DEF H5P_USER_FALSE
+#define H5L_ACS_COLL_MD_READ_ENC H5P__encode_coll_md_read_flag_t
+#define H5L_ACS_COLL_MD_READ_DEC H5P__decode_coll_md_read_flag_t
+#endif /* H5_HAVE_PARALLEL */
/******************/
/* Local Typedefs */
@@ -164,7 +171,9 @@ static const char *H5L_def_elink_prefix_g = H5L_ACS_ELINK_PREFIX_DEF; /* Default
static const hid_t H5L_def_fapl_id_g = H5L_ACS_ELINK_FAPL_DEF; /* Default fapl for external link access */
static const unsigned H5L_def_elink_flags_g = H5L_ACS_ELINK_FLAGS_DEF; /* Default file access flags for external link traversal */
static const H5L_elink_cb_t H5L_def_elink_cb_g = H5L_ACS_ELINK_CB_DEF; /* Default external link traversal callback */
-
+#ifdef H5_HAVE_PARALLEL
+static const H5P_coll_md_read_flag_t H5L_def_coll_md_read_g = H5L_ACS_COLL_MD_READ_DEF; /* Default setting for the collective metedata read flag */
+#endif /* H5_HAVE_PARALLEL */
/*-------------------------------------------------------------------------
@@ -216,6 +225,14 @@ H5P__lacc_reg_prop(H5P_genclass_t *pclass)
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
+#ifdef H5_HAVE_PARALLEL
+ /* Register the metadata collective read flag */
+ if(H5P_register_real(pclass, H5_COLL_MD_READ_FLAG_NAME, H5L_ACS_COLL_MD_READ_SIZE, &H5L_def_coll_md_read_g,
+ NULL, NULL, NULL, H5L_ACS_COLL_MD_READ_ENC, H5L_ACS_COLL_MD_READ_DEC,
+ NULL, NULL, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
+#endif /* H5_HAVE_PARALLEL */
+
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P__lacc_reg_prop() */
@@ -783,7 +800,8 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5P__lacc_elink_pref_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value)
+H5P__lacc_elink_pref_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name,
+ size_t H5_ATTR_UNUSED size, void *value)
{
FUNC_ENTER_STATIC_NOERR
diff --git a/src/H5Ppkg.h b/src/H5Ppkg.h
index 105baf7..7d29f3d 100644
--- a/src/H5Ppkg.h
+++ b/src/H5Ppkg.h
@@ -115,33 +115,6 @@ struct H5P_genplist_t {
H5SL_t *props; /* Skip list containing properties */
};
-/* Function pointer for library classes with properties to register */
-typedef herr_t (*H5P_init_class_op_t)(H5P_genclass_t *pclass);
-typedef herr_t (*H5P_reg_prop_func_t)(H5P_genclass_t *pclass);
-
-/*
- * Each library property list class has a variable of this type that contains
- * class variables and methods used to initialize the class.
- */
-typedef struct H5P_libclass_t {
- const char *name; /* Class name */
- H5P_plist_type_t type; /* Class type */
-
- H5P_genclass_t * * par_pclass; /* Pointer to global parent class property list class */
- H5P_genclass_t * * pclass; /* Pointer to global property list class */
- hid_t * const class_id; /* Pointer to global property list class ID */
- hid_t * const def_plist_id; /* Pointer to global default property list ID */
- H5P_reg_prop_func_t reg_prop_func; /* Register class's properties */
-
- /* Class callback function pointers & info */
- H5P_cls_create_func_t create_func; /* Function to call when a property list is created */
- void *create_data; /* Pointer to user data to pass along to create callback */
- H5P_cls_copy_func_t copy_func; /* Function to call when a property list is copied */
- void *copy_data; /* Pointer to user data to pass along to copy callback */
- H5P_cls_close_func_t close_func; /* Function to call when a property list is closed */
- void *close_data; /* Pointer to user data to pass along to close callback */
-} H5P_libclass_t;
-
/* Property list/class iterator callback function pointer */
typedef int (*H5P_iterate_int_t)(H5P_genprop_t *prop, void *udata);
@@ -219,6 +192,8 @@ H5_DLL herr_t H5P__decode_unsigned(const void **_pp, void *value);
H5_DLL herr_t H5P__decode_uint8_t(const void **_pp, void *value);
H5_DLL herr_t H5P__decode_hbool_t(const void **_pp, void *value);
H5_DLL herr_t H5P__decode_double(const void **_pp, void *value);
+H5_DLL herr_t H5P__encode_coll_md_read_flag_t(const void *value, void **_pp, size_t *size);
+H5_DLL herr_t H5P__decode_coll_md_read_flag_t(const void **_pp, void *value);
/* Private OCPL routines */
H5_DLL herr_t H5P_get_filter(const struct H5Z_filter_info_t *filter,
@@ -229,7 +204,6 @@ H5_DLL herr_t H5P_get_filter(const struct H5Z_filter_info_t *filter,
#ifdef H5P_TESTING
H5_DLL char *H5P_get_class_path_test(hid_t pclass_id);
H5_DLL hid_t H5P_open_class_path_test(const char *path);
-H5_DLL herr_t H5P_reset_external_file_test(hid_t dcpl_id);
#endif /* H5P_TESTING */
#endif /* _H5Ppkg_H */
diff --git a/src/H5Pprivate.h b/src/H5Pprivate.h
index 3a82b79..6cadc3b 100644
--- a/src/H5Pprivate.h
+++ b/src/H5Pprivate.h
@@ -42,11 +42,19 @@
#define H5P_CLASS(P) (H5P_get_class(P))
#endif /* H5P_MODULE */
+#define H5_COLL_MD_READ_FLAG_NAME "collective_metadata_read"
+
/****************************/
/* Library Private Typedefs */
/****************************/
+typedef enum H5P_coll_md_read_flag_t {
+ H5P_FORCE_FALSE = -1,
+ H5P_USER_FALSE = 0,
+ H5P_USER_TRUE = 1
+} H5P_coll_md_read_flag_t;
+
/* Forward declarations (for prototypes & type definitions) */
struct H5O_fill_t;
struct H5T_t;
@@ -74,9 +82,36 @@ typedef enum H5P_plist_type_t {
H5P_TYPE_OBJECT_COPY = 15,
H5P_TYPE_LINK_CREATE = 16,
H5P_TYPE_LINK_ACCESS = 17,
+ H5P_TYPE_ATTRIBUTE_ACCESS = 18,
H5P_TYPE_MAX_TYPE
} H5P_plist_type_t;
+/* Function pointer for library classes with properties to register */
+typedef herr_t (*H5P_reg_prop_func_t)(H5P_genclass_t *pclass);
+
+/*
+ * Each library property list class has a variable of this type that contains
+ * class variables and methods used to initialize the class.
+ */
+typedef struct H5P_libclass_t {
+ const char *name; /* Class name */
+ H5P_plist_type_t type; /* Class type */
+
+ H5P_genclass_t * * par_pclass; /* Pointer to global parent class property list class */
+ H5P_genclass_t * * pclass; /* Pointer to global property list class */
+ hid_t * const class_id; /* Pointer to global property list class ID */
+ hid_t * const def_plist_id; /* Pointer to global default property list ID */
+ H5P_reg_prop_func_t reg_prop_func; /* Register class's properties */
+
+ /* Class callback function pointers & info */
+ H5P_cls_create_func_t create_func; /* Function to call when a property list is created */
+ void *create_data; /* Pointer to user data to pass along to create callback */
+ H5P_cls_copy_func_t copy_func; /* Function to call when a property list is copied */
+ void *copy_data; /* Pointer to user data to pass along to copy callback */
+ H5P_cls_close_func_t close_func; /* Function to call when a property list is closed */
+ void *close_data; /* Pointer to user data to pass along to close callback */
+} H5P_libclass_t;
+
/*****************************/
/* Library Private Variables */
/*****************************/
@@ -95,11 +130,19 @@ H5_DLLVAR H5P_genclass_t *H5P_CLS_GROUP_ACCESS_g;
H5_DLLVAR H5P_genclass_t *H5P_CLS_DATATYPE_CREATE_g;
H5_DLLVAR H5P_genclass_t *H5P_CLS_DATATYPE_ACCESS_g;
H5_DLLVAR H5P_genclass_t *H5P_CLS_ATTRIBUTE_CREATE_g;
+H5_DLLVAR H5P_genclass_t *H5P_CLS_ATTRIBUTE_ACCESS_g;
H5_DLLVAR H5P_genclass_t *H5P_CLS_OBJECT_COPY_g;
H5_DLLVAR H5P_genclass_t *H5P_CLS_LINK_CREATE_g;
H5_DLLVAR H5P_genclass_t *H5P_CLS_LINK_ACCESS_g;
H5_DLLVAR H5P_genclass_t *H5P_CLS_STRING_CREATE_g;
+/* Internal property list classes */
+H5_DLLVAR const struct H5P_libclass_t H5P_CLS_LACC[1]; /* Link access */
+H5_DLLVAR const struct H5P_libclass_t H5P_CLS_AACC[1]; /* Attribute access */
+H5_DLLVAR const struct H5P_libclass_t H5P_CLS_DACC[1]; /* Dataset access */
+H5_DLLVAR const struct H5P_libclass_t H5P_CLS_GACC[1]; /* Group access */
+H5_DLLVAR const struct H5P_libclass_t H5P_CLS_TACC[1]; /* Named datatype access */
+H5_DLLVAR const struct H5P_libclass_t H5P_CLS_FACC[1]; /* File access */
/******************************/
/* Library Private Prototypes */
@@ -125,6 +168,8 @@ H5_DLL herr_t H5P_remove(H5P_genplist_t *plist, const char *name);
H5_DLL htri_t H5P_exist_plist(const H5P_genplist_t *plist, const char *name);
H5_DLL htri_t H5P_class_isa(const H5P_genclass_t *pclass1, const H5P_genclass_t *pclass2);
H5_DLL char *H5P_get_class_name(H5P_genclass_t *pclass);
+
+/* Internal helper routines */
H5_DLL herr_t H5P_get_nprops_pclass(const H5P_genclass_t *pclass, size_t *nprops,
hbool_t recurse);
H5_DLL hid_t H5P_peek_driver(H5P_genplist_t *plist);
@@ -146,6 +191,8 @@ H5_DLL herr_t H5P_get_filter_by_id(H5P_genplist_t *plist, H5Z_filter_t id,
unsigned int *flags, size_t *cd_nelmts, unsigned cd_values[],
size_t namelen, char name[], unsigned *filter_config);
H5_DLL htri_t H5P_filter_in_pline(H5P_genplist_t *plist, H5Z_filter_t id);
+H5_DLL herr_t H5P_verify_apl_and_dxpl(hid_t *acspl_id, const H5P_libclass_t *libclass,
+ hid_t *dxpl_id, hid_t loc_id, hbool_t is_collective);
/* Query internal fields of the property list struct */
H5_DLL hid_t H5P_get_plist_id(const H5P_genplist_t *plist);
@@ -155,12 +202,6 @@ H5_DLL H5P_genclass_t *H5P_get_class(const H5P_genplist_t *plist);
H5_DLL htri_t H5P_isa_class(hid_t plist_id, hid_t pclass_id);
H5_DLL H5P_genplist_t *H5P_object_verify(hid_t plist_id, hid_t pclass_id);
-/* Private functions to "peek" at properties of a certain type */
-H5_DLL unsigned H5P_peek_unsigned(H5P_genplist_t *plist, const char *name);
-H5_DLL hid_t H5P_peek_hid_t(H5P_genplist_t *plist, const char *name);
-H5_DLL void *H5P_peek_voidp(H5P_genplist_t *plist, const char *name);
-H5_DLL size_t H5P_peek_size_t(H5P_genplist_t *plist, const char *name);
-
/* Private DCPL routines */
H5_DLL herr_t H5P_fill_value_defined(H5P_genplist_t *plist,
H5D_fill_value_t *status);
diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h
index 0a68851..bb116fc 100644
--- a/src/H5Ppublic.h
+++ b/src/H5Ppublic.h
@@ -66,6 +66,7 @@
#define H5P_DATATYPE_ACCESS (H5OPEN H5P_CLS_DATATYPE_ACCESS_ID_g)
#define H5P_STRING_CREATE (H5OPEN H5P_CLS_STRING_CREATE_ID_g)
#define H5P_ATTRIBUTE_CREATE (H5OPEN H5P_CLS_ATTRIBUTE_CREATE_ID_g)
+#define H5P_ATTRIBUTE_ACCESS (H5OPEN H5P_CLS_ATTRIBUTE_ACCESS_ID_g)
#define H5P_OBJECT_COPY (H5OPEN H5P_CLS_OBJECT_COPY_ID_g)
#define H5P_LINK_CREATE (H5OPEN H5P_CLS_LINK_CREATE_ID_g)
#define H5P_LINK_ACCESS (H5OPEN H5P_CLS_LINK_ACCESS_ID_g)
@@ -84,6 +85,7 @@
#define H5P_DATATYPE_CREATE_DEFAULT (H5OPEN H5P_LST_DATATYPE_CREATE_ID_g)
#define H5P_DATATYPE_ACCESS_DEFAULT (H5OPEN H5P_LST_DATATYPE_ACCESS_ID_g)
#define H5P_ATTRIBUTE_CREATE_DEFAULT (H5OPEN H5P_LST_ATTRIBUTE_CREATE_ID_g)
+#define H5P_ATTRIBUTE_ACCESS_DEFAULT (H5OPEN H5P_LST_ATTRIBUTE_ACCESS_ID_g)
#define H5P_OBJECT_COPY_DEFAULT (H5OPEN H5P_LST_OBJECT_COPY_ID_g)
#define H5P_LINK_CREATE_DEFAULT (H5OPEN H5P_LST_LINK_CREATE_ID_g)
#define H5P_LINK_ACCESS_DEFAULT (H5OPEN H5P_LST_LINK_ACCESS_ID_g)
@@ -189,6 +191,7 @@ H5_DLLVAR hid_t H5P_CLS_DATATYPE_CREATE_ID_g;
H5_DLLVAR hid_t H5P_CLS_DATATYPE_ACCESS_ID_g;
H5_DLLVAR hid_t H5P_CLS_STRING_CREATE_ID_g;
H5_DLLVAR hid_t H5P_CLS_ATTRIBUTE_CREATE_ID_g;
+H5_DLLVAR hid_t H5P_CLS_ATTRIBUTE_ACCESS_ID_g;
H5_DLLVAR hid_t H5P_CLS_OBJECT_COPY_ID_g;
H5_DLLVAR hid_t H5P_CLS_LINK_CREATE_ID_g;
H5_DLLVAR hid_t H5P_CLS_LINK_ACCESS_ID_g;
@@ -206,6 +209,7 @@ H5_DLLVAR hid_t H5P_LST_GROUP_ACCESS_ID_g;
H5_DLLVAR hid_t H5P_LST_DATATYPE_CREATE_ID_g;
H5_DLLVAR hid_t H5P_LST_DATATYPE_ACCESS_ID_g;
H5_DLLVAR hid_t H5P_LST_ATTRIBUTE_CREATE_ID_g;
+H5_DLLVAR hid_t H5P_LST_ATTRIBUTE_ACCESS_ID_g;
H5_DLLVAR hid_t H5P_LST_OBJECT_COPY_ID_g;
H5_DLLVAR hid_t H5P_LST_LINK_CREATE_ID_g;
H5_DLLVAR hid_t H5P_LST_LINK_ACCESS_ID_g;
@@ -355,6 +359,12 @@ H5_DLL herr_t H5Pget_file_image_callbacks(hid_t fapl_id,
H5FD_file_image_callbacks_t *callbacks_ptr);
H5_DLL herr_t H5Pset_core_write_tracking(hid_t fapl_id, hbool_t is_enabled, size_t page_size);
H5_DLL herr_t H5Pget_core_write_tracking(hid_t fapl_id, hbool_t *is_enabled, size_t *page_size);
+#ifdef H5_HAVE_PARALLEL
+H5_DLL herr_t H5Pset_all_coll_metadata_ops(hid_t plist_id, hbool_t is_collective);
+H5_DLL herr_t H5Pget_all_coll_metadata_ops(hid_t plist_id, hbool_t *is_collective);
+H5_DLL herr_t H5Pset_coll_metadata_write(hid_t plist_id, hbool_t is_collective);
+H5_DLL herr_t H5Pget_coll_metadata_write(hid_t plist_id, hbool_t *is_collective);
+#endif /* H5_HAVE_PARALLEL */
/* Dataset creation property list (DCPL) routines */
H5_DLL herr_t H5Pset_layout(hid_t plist_id, H5D_layout_t layout);
@@ -372,6 +382,8 @@ H5_DLL ssize_t H5Pget_virtual_dsetname(hid_t dcpl_id, size_t index,
char *name/*out*/, size_t size);
H5_DLL herr_t H5Pset_external(hid_t plist_id, const char *name, off_t offset,
hsize_t size);
+H5_DLL herr_t H5Pset_chunk_opts(hid_t plist_id, unsigned opts);
+H5_DLL herr_t H5Pget_chunk_opts(hid_t plist_id, unsigned *opts);
H5_DLL int H5Pget_external_count(hid_t plist_id);
H5_DLL herr_t H5Pget_external(hid_t plist_id, unsigned idx, size_t name_size,
char *name/*out*/, off_t *offset/*out*/,
@@ -404,6 +416,8 @@ H5_DLL herr_t H5Pset_virtual_view(hid_t plist_id, H5D_vds_view_t view);
H5_DLL herr_t H5Pget_virtual_view(hid_t plist_id, H5D_vds_view_t *view);
H5_DLL herr_t H5Pset_virtual_printf_gap(hid_t plist_id, hsize_t gap_size);
H5_DLL herr_t H5Pget_virtual_printf_gap(hid_t plist_id, hsize_t *gap_size);
+H5_DLL herr_t H5Pset_efile_prefix(hid_t dapl_id, const char* prefix);
+H5_DLL ssize_t H5Pget_efile_prefix(hid_t dapl_id, char* prefix /*out*/, size_t size);
/* Dataset xfer property list (DXPL) routines */
H5_DLL herr_t H5Pset_data_transform(hid_t plist_id, const char* expression);
diff --git a/src/H5Ptest.c b/src/H5Ptest.c
index 8240f6a..f6cc97e 100644
--- a/src/H5Ptest.c
+++ b/src/H5Ptest.c
@@ -125,49 +125,3 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5P_open_class_path_test() */
-
-/*--------------------------------------------------------------------------
- NAME
- H5P_reset_external_file_test
- PURPOSE
- Routine to reset external file list
- USAGE
- herr_t H5P_reset_external_file_test(plist)
- hid_t dcpl_id; IN: the property list
-
- RETURNS
- Non-negative on success/Negative on failure
-
- PROGRAMMER
- Peter Cao
- April 30, 2007
---------------------------------------------------------------------------*/
-herr_t
-H5P_reset_external_file_test(hid_t dcpl_id)
-{
- H5O_efl_t efl; /* External file list */
- H5P_genplist_t *plist; /* Property list */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(FAIL)
-
- /* Check arguments */
- if(NULL == (plist = (H5P_genplist_t *)H5I_object(dcpl_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset creation property list")
-
- /* get external file list */
- if(H5P_peek(plist, H5D_CRT_EXT_FILE_LIST_NAME, &efl) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get external file list")
-
- /* Clean up any values set for the external file-list */
- if(H5O_msg_reset(H5O_EFL_ID, &efl) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "can't release external file list info")
-
- /* set external file list */
- if(H5P_poke(plist, H5D_CRT_EXT_FILE_LIST_NAME, &efl) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set external file list")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5P_reset_external_file_test() */
-
diff --git a/src/H5R.c b/src/H5R.c
index 0e062d1..018400e 100644
--- a/src/H5R.c
+++ b/src/H5R.c
@@ -395,7 +395,7 @@ H5Rcreate(void *ref, hid_t loc_id, const char *name, H5R_type_t ref_type, hid_t
/* create the ref through the VOL */
if((ret_value = H5VL_object_specific(obj->vol_obj, loc_params, obj->vol_info->vol_cls, H5VL_REF_CREATE,
- H5AC_dxpl_id, H5_REQUEST_NULL,
+ H5AC_ind_read_dxpl_id, H5_REQUEST_NULL,
ref, name, ref_type, space_id)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "modifying object link count failed")
@@ -541,12 +541,6 @@ H5R_dereference(H5F_t *file, hid_t oapl_id, hid_t dxpl_id, H5R_type_t ref_type,
{
H5D_t *dset; /* Pointer to dataset to open */
- /* Get correct property list */
- if(H5P_DEFAULT == oapl_id)
- oapl_id = H5P_DATASET_ACCESS_DEFAULT;
- else if(TRUE != H5P_isa_class(oapl_id, H5P_DATASET_ACCESS))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not dataset access property list")
-
/* Open the dataset */
if(NULL == (dset = H5D_open(&loc, oapl_id, dxpl_id)))
HGOTO_ERROR(H5E_DATASET, H5E_NOTFOUND, FAIL, "not found")
@@ -604,6 +598,7 @@ H5Rdereference2(hid_t obj_id, hid_t oapl_id, H5R_type_t ref_type, const void *_r
H5I_type_t opened_type;
void *opened_obj = NULL;
H5VL_loc_params_t loc_params;
+ hid_t dxpl_id = H5AC_ind_read_dxpl_id; /* dxpl used by library */
hid_t ret_value = FAIL;
FUNC_ENTER_API(FAIL)
@@ -617,6 +612,10 @@ H5Rdereference2(hid_t obj_id, hid_t oapl_id, H5R_type_t ref_type, const void *_r
if(_ref == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference pointer")
+ /* Verify access property list and get correct dxpl */
+ if(H5P_verify_apl_and_dxpl(&oapl_id, H5P_CLS_DACC, &dxpl_id, obj_id, FALSE) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, FAIL, "can't set access and transfer property lists")
+
/* get the vol object */
if(NULL == (obj = H5VL_get_object(obj_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier")
@@ -628,8 +627,8 @@ H5Rdereference2(hid_t obj_id, hid_t oapl_id, H5R_type_t ref_type, const void *_r
loc_params.obj_type = H5I_get_type(obj_id);
/* Open the object through the VOL */
- if(NULL == (opened_obj = H5VL_object_open(obj->vol_obj, loc_params, obj->vol_info->vol_cls, &opened_type,
- H5AC_ind_dxpl_id, H5_REQUEST_NULL)))
+ if(NULL == (opened_obj = H5VL_object_open(obj->vol_obj, loc_params, obj->vol_info->vol_cls,
+ &opened_type, dxpl_id, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, FAIL, "unable to dereference object")
if((ret_value = H5VL_register_id(opened_type, opened_obj, obj->vol_info, TRUE)) < 0)
@@ -757,7 +756,7 @@ H5Rget_region(hid_t id, H5R_type_t ref_type, const void *ref)
/* Get the space id through the VOL */
if(H5VL_object_get(obj->vol_obj, loc_params, obj->vol_info->vol_cls, H5VL_REF_GET_REGION,
- H5AC_ind_dxpl_id, H5_REQUEST_NULL, &ret_value, ref_type, ref) < 0)
+ H5AC_ind_read_dxpl_id, H5_REQUEST_NULL, &ret_value, ref_type, ref) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get group info")
done:
@@ -900,7 +899,7 @@ H5Rget_obj_type2(hid_t id, H5R_type_t ref_type, const void *ref,
/* get the object type through the VOL */
if((ret_value = H5VL_object_get(obj->vol_obj, loc_params, obj->vol_info->vol_cls,
- H5VL_REF_GET_TYPE, H5AC_ind_dxpl_id,
+ H5VL_REF_GET_TYPE, H5AC_ind_read_dxpl_id,
H5_REQUEST_NULL, obj_type, ref_type, ref)) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get group info")
@@ -1073,7 +1072,7 @@ H5Rget_name(hid_t id, H5R_type_t ref_type, const void *_ref, char *name,
/* get the object type through the VOL */
if(H5VL_object_get(obj->vol_obj, loc_params, obj->vol_info->vol_cls, H5VL_REF_GET_NAME,
- H5AC_ind_dxpl_id, H5_REQUEST_NULL,
+ H5AC_ind_read_dxpl_id, H5_REQUEST_NULL,
&ret_value, name, size, ref_type, _ref) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get group info")
done:
diff --git a/src/H5Rdeprec.c b/src/H5Rdeprec.c
index 710adaf..f1b9016 100644
--- a/src/H5Rdeprec.c
+++ b/src/H5Rdeprec.c
@@ -134,7 +134,7 @@ H5Rget_obj_type1(hid_t id, H5R_type_t ref_type, const void *ref)
/* get the object type through the VOL */
if((ret_value = H5VL_object_get(obj->vol_obj, loc_params, obj->vol_info->vol_cls, H5VL_REF_GET_TYPE,
- H5AC_ind_dxpl_id, H5_REQUEST_NULL, &obj_type, ref_type, ref)) < 0)
+ H5AC_ind_read_dxpl_id, H5_REQUEST_NULL, &obj_type, ref_type, ref)) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get group info")
/* Set return value */
@@ -197,7 +197,7 @@ H5Rdereference1(hid_t obj_id, H5R_type_t ref_type, const void *_ref)
/* Open the object through the VOL */
if(NULL == (opened_obj = H5VL_object_open(obj->vol_obj, loc_params, obj->vol_info->vol_cls, &opened_type,
- H5AC_ind_dxpl_id, H5_REQUEST_NULL)))
+ H5AC_ind_read_dxpl_id, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to open object")
/* Get an atom for the object */
diff --git a/src/H5S.c b/src/H5S.c
index 738a7da..2fab71a 100644
--- a/src/H5S.c
+++ b/src/H5S.c
@@ -37,7 +37,7 @@
/* Local Macros */
/****************/
-/* Version of datatype encoding */
+/* Version of dataspace encoding */
#define H5S_ENCODE_VERSION 0
@@ -1550,7 +1550,7 @@ H5Sencode(hid_t obj_id, void *buf, size_t *nalloc)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
if(H5S_encode(dspace, (unsigned char **)&buf, nalloc)<0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTENCODE, FAIL, "can't encode datatype")
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTENCODE, FAIL, "can't encode dataspace")
done:
FUNC_LEAVE_API(ret_value)
diff --git a/src/H5SM.c b/src/H5SM.c
index 4a562dd..0b72e40 100644
--- a/src/H5SM.c
+++ b/src/H5SM.c
@@ -60,7 +60,8 @@ static herr_t H5SM_create_index(H5F_t *f, H5SM_index_header_t *header,
static herr_t H5SM_delete_index(H5F_t *f, H5SM_index_header_t *header,
hid_t dxpl_id, hbool_t delete_heap);
static haddr_t H5SM_create_list(H5F_t *f, H5SM_index_header_t *header, hid_t dxpl_id);
-static size_t H5SM_find_in_list(const H5SM_list_t *list, const H5SM_mesg_key_t *key, size_t *empty_pos);
+static herr_t H5SM__find_in_list(const H5SM_list_t *list, const H5SM_mesg_key_t *key,
+ size_t *empty_pos, size_t *list_pos);
static herr_t H5SM_convert_list_to_btree(H5F_t * f, H5SM_index_header_t * header,
H5SM_list_t **_list, H5HF_t *fheap, H5O_t *open_oh, hid_t dxpl_id);
static herr_t H5SM_convert_btree_to_list(H5F_t * f, H5SM_index_header_t * header, hid_t dxpl_id);
@@ -1303,7 +1304,9 @@ H5SM_write_mesg(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
* Also record the first empty list position we find in case we need it
* later.
*/
- list_pos = H5SM_find_in_list(list, &key, &empty_pos);
+ if(H5SM__find_in_list(list, &key, &empty_pos, &list_pos) < 0)
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTINSERT, FAIL, "unable to search for message in list")
+
if(defer) {
if(list_pos != UFAIL)
found = TRUE;
@@ -1375,11 +1378,23 @@ H5SM_write_mesg(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
} /* end else */
} /* end else */
- if(found)
+ if(found) {
/* If the message was found, it's shared in the heap (now). Set up a
* shared message so we can mark it as shared.
*/
shared.type = H5O_SHARE_TYPE_SOHM;
+
+#ifdef H5_USING_MEMCHECKER
+ /* Reset the shared message payload if deferring. This doesn't matter
+ * in the long run since the payload will get overwritten when the
+ * non-deferred call to this routine occurs, but it stops memory
+ * checkers like valgrind from whining when the partially initialized
+ * shared message is serialized. -QAK
+ */
+ if(defer)
+ HDmemset(&shared.u, 0, sizeof(shared.u));
+#endif /* H5_USING_MEMCHECKER */
+ } /* end if */
else {
htri_t share_in_ohdr; /* Whether the new message can be shared in another object's header */
@@ -1452,10 +1467,15 @@ H5SM_write_mesg(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
/* Insert the new message into the SOHM index */
if(header->index_type == H5SM_LIST) {
/* Index is a list. Find an empty spot if we haven't already */
- if(empty_pos == UFAIL)
- if((H5SM_find_in_list(list, NULL, &empty_pos) == UFAIL) || empty_pos == UFAIL)
- HGOTO_ERROR(H5E_SOHM, H5E_CANTINSERT, FAIL, "unable to find empty entry in list")
+ if(empty_pos == UFAIL) {
+ size_t pos;
+
+ if(H5SM__find_in_list(list, NULL, &empty_pos, &pos) < 0)
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTINSERT, FAIL, "unable to search for message in list")
+ if(pos == UFAIL || empty_pos == UFAIL)
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTINSERT, FAIL, "unable to find empty entry in list")
+ }
/* Insert message into list */
HDassert(list->messages[empty_pos].location == H5SM_NO_LOC);
HDassert(key.message.location != H5SM_NO_LOC);
@@ -1598,7 +1618,7 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5SM_find_in_list
+ * Function: H5SM__find_in_list
*
* Purpose: Find a message's location in a list. Also find the first
* empty location in the list (since if we don't find the
@@ -1618,13 +1638,13 @@ done:
*
*-------------------------------------------------------------------------
*/
-static size_t
-H5SM_find_in_list(const H5SM_list_t *list, const H5SM_mesg_key_t *key, size_t *empty_pos)
+static herr_t
+H5SM__find_in_list(const H5SM_list_t *list, const H5SM_mesg_key_t *key, size_t *empty_pos, size_t *pos)
{
size_t x;
- size_t ret_value = 0; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC
HDassert(list);
/* Both key and empty_pos can be NULL, but not both! */
@@ -1638,9 +1658,17 @@ H5SM_find_in_list(const H5SM_list_t *list, const H5SM_mesg_key_t *key, size_t *e
* Also record the first empty position we find.
*/
for(x = 0; x < list->header->list_max; x++) {
- if((list->messages[x].location != H5SM_NO_LOC) &&
- (0 == H5SM__message_compare(key, &(list->messages[x]))))
- HGOTO_DONE(x)
+ if(list->messages[x].location != H5SM_NO_LOC) {
+ int cmp;
+
+ if(H5SM__message_compare(key, &(list->messages[x]), &cmp) < 0)
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTCOMPARE, FAIL, "can't compare message records")
+
+ if(0 == cmp) {
+ *pos = x;
+ HGOTO_DONE(SUCCEED)
+ }
+ }
else if(empty_pos && list->messages[x].location == H5SM_NO_LOC) {
/* Note position */
*empty_pos = x;
@@ -1651,11 +1679,11 @@ H5SM_find_in_list(const H5SM_list_t *list, const H5SM_mesg_key_t *key, size_t *e
} /* end for */
/* If we reached this point, we didn't find the message */
- ret_value = UFAIL;
+ *pos = UFAIL;
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5SM_find_in_list */
+} /* end H5SM__find_in_list */
/*-------------------------------------------------------------------------
@@ -1822,7 +1850,9 @@ H5SM_delete_from_index(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM index")
/* Find the message in the list */
- if((list_pos = H5SM_find_in_list(list, &key, NULL)) == UFAIL)
+ if(H5SM__find_in_list(list, &key, NULL, &list_pos) < 0)
+ HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "unable to search for message in list")
+ if(list_pos == UFAIL)
HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "message not in index")
if(list->messages[list_pos].location == H5SM_IN_HEAP)
@@ -2205,7 +2235,9 @@ H5SM_get_refcount(H5F_t *f, hid_t dxpl_id, unsigned type_id,
HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM index")
/* Find the message in the list */
- if((list_pos = H5SM_find_in_list(list, &key, NULL)) == UFAIL)
+ if(H5SM__find_in_list(list, &key, NULL, &list_pos) < 0)
+ HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "unable to search for message in list")
+ if(list_pos == UFAIL)
HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "message not in index")
/* Copy the message */
diff --git a/src/H5SMbtree2.c b/src/H5SMbtree2.c
index e533ae8..0110c1e 100644
--- a/src/H5SMbtree2.c
+++ b/src/H5SMbtree2.c
@@ -50,7 +50,6 @@ static herr_t H5SM__bt2_dst_context(void *ctx);
static herr_t H5SM__bt2_store(void *native, const void *udata);
static herr_t H5SM__bt2_debug(FILE *stream, int indent, int fwidth,
const void *record, const void *_udata);
-static void *H5SM__bt2_crt_dbg_context(H5F_t *f, hid_t dxpl_id, haddr_t addr);
/*****************************/
@@ -67,9 +66,7 @@ const H5B2_class_t H5SM_INDEX[1]={{ /* B-tree class information */
H5SM__message_compare, /* Record comparison callback */
H5SM__message_encode, /* Record encoding callback */
H5SM__message_decode, /* Record decoding callback */
- H5SM__bt2_debug, /* Record debugging callback */
- H5SM__bt2_crt_dbg_context, /* Create debugging context */
- H5SM__bt2_dst_context /* Destroy debugging context */
+ H5SM__bt2_debug /* Record debugging callback */
}};
@@ -218,45 +215,6 @@ H5SM__bt2_debug(FILE *stream, int indent, int fwidth,
/*-------------------------------------------------------------------------
- * Function: H5SM__bt2_crt_dbg_context
- *
- * Purpose: Create context for debugging callback
- *
- * Return: Success: non-NULL
- * Failure: NULL
- *
- * Programmer: Quincey Koziol
- * Tuesday, December 1, 2009
- *
- *-------------------------------------------------------------------------
- */
-static void *
-H5SM__bt2_crt_dbg_context(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, haddr_t H5_ATTR_UNUSED addr)
-{
- H5SM_bt2_ctx_t *ctx; /* Callback context structure */
- void *ret_value = NULL; /* Return value */
-
- FUNC_ENTER_STATIC
-
- /* Sanity check */
- HDassert(f);
-
- /* Allocate callback context */
- if(NULL == (ctx = H5FL_MALLOC(H5SM_bt2_ctx_t)))
- HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "can't allocate callback context")
-
- /* Determine the size of addresses & lengths in the file */
- ctx->sizeof_addr = H5F_SIZEOF_ADDR(f);
-
- /* Set return value */
- ret_value = ctx;
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5SM__bt2_crt_dbg_context() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5SM_bt2_convert_to_list_op
*
* Purpose: An H5B2_remove_t callback function to convert a SOHM
diff --git a/src/H5SMcache.c b/src/H5SMcache.c
index bbd7e87..4de86e2 100644
--- a/src/H5SMcache.c
+++ b/src/H5SMcache.c
@@ -678,9 +678,8 @@ H5SM__cache_list_serialize(const H5F_t *f, void *_image, size_t len,
/* sanity check */
HDassert((size_t)(image - (uint8_t *)_image) <= list->header->list_size);
-#ifdef H5_CLEAR_MEMORY
+ /* Clear memory */
HDmemset(image, 0, (list->header->list_size - (size_t)(image - (uint8_t *)_image)));
-#endif /* H5_CLEAR_MEMORY */
done:
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5SMmessage.c b/src/H5SMmessage.c
index 426ea20..92b6a75 100644
--- a/src/H5SMmessage.c
+++ b/src/H5SMmessage.c
@@ -186,13 +186,13 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5SM__message_compare(const void *rec1, const void *rec2)
+H5SM__message_compare(const void *rec1, const void *rec2, int *result)
{
const H5SM_mesg_key_t *key = (const H5SM_mesg_key_t *) rec1;
const H5SM_sohm_t *mesg = (const H5SM_sohm_t *) rec2;
- herr_t ret_value = 0;
+ herr_t ret_value = SUCCEED;
- FUNC_ENTER_PACKAGE_NOERR
+ FUNC_ENTER_PACKAGE
/* If the key has an fheap ID, we're looking for a message that's
* already in the index; if the fheap ID matches, we've found the message
@@ -201,28 +201,31 @@ H5SM__message_compare(const void *rec1, const void *rec2)
* message in the index, we've found the message.
*/
if(mesg->location == H5SM_IN_HEAP && key->message.location == H5SM_IN_HEAP) {
- if(key->message.u.heap_loc.fheap_id.val == mesg->u.heap_loc.fheap_id.val)
- HGOTO_DONE(0);
+ if(key->message.u.heap_loc.fheap_id.val == mesg->u.heap_loc.fheap_id.val) {
+ *result = 0;
+ HGOTO_DONE(SUCCEED);
+ }
} /* end if */
else if(mesg->location == H5SM_IN_OH && key->message.location == H5SM_IN_OH) {
if(key->message.u.mesg_loc.oh_addr == mesg->u.mesg_loc.oh_addr &&
- key->message.u.mesg_loc.index == mesg->u.mesg_loc.index &&
- key->message.msg_type_id == mesg->msg_type_id)
- HGOTO_DONE(0);
+ key->message.u.mesg_loc.index == mesg->u.mesg_loc.index &&
+ key->message.msg_type_id == mesg->msg_type_id) {
+ *result = 0;
+ HGOTO_DONE(SUCCEED);
+ }
} /* end if */
/* Compare hash values */
if(key->message.hash > mesg->hash)
- ret_value = 1;
+ *result = 1;
else if(key->message.hash < mesg->hash)
- ret_value = -1;
+ *result = -1;
/* If the hash values match, make sure the messages are really the same */
else {
/* Hash values match; compare the encoded message with the one in
* the index.
*/
H5SM_compare_udata_t udata;
- herr_t status;
HDassert(key->message.hash == mesg->hash);
HDassert(key->encoding_size > 0 && key->encoding);
@@ -235,8 +238,8 @@ H5SM__message_compare(const void *rec1, const void *rec2)
*/
if(mesg->location == H5SM_IN_HEAP) {
/* Call heap op routine with comparison callback */
- status = H5HF_op(key->fheap, key->dxpl_id, &(mesg->u.heap_loc.fheap_id), H5SM_compare_cb, &udata);
- HDassert(status >= 0);
+ if(H5HF_op(key->fheap, key->dxpl_id, &(mesg->u.heap_loc.fheap_id), H5SM_compare_cb, &udata) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records")
} /* end if */
else {
H5O_loc_t oloc; /* Object owning the message */
@@ -247,8 +250,8 @@ H5SM__message_compare(const void *rec1, const void *rec2)
HDassert(mesg->location == H5SM_IN_OH);
/* Reset the object location */
- status = H5O_loc_reset(&oloc);
- HDassert(status >= 0);
+ if(H5O_loc_reset(&oloc) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTRESET, FAIL, "unable to initialize target location")
/* Set up object location */
oloc.file = key->file;
@@ -260,11 +263,11 @@ H5SM__message_compare(const void *rec1, const void *rec2)
/* Locate the right message and compare with it */
op.op_type = H5O_MESG_OP_LIB;
op.u.lib_op = H5SM_compare_iter_op;
- status = H5O_msg_iterate(&oloc, mesg->msg_type_id, &op, &udata, key->dxpl_id);
- HDassert(status >= 0);
+ if(H5O_msg_iterate(&oloc, mesg->msg_type_id, &op, &udata, key->dxpl_id) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "error iterating over links")
} /* end else */
- ret_value = udata.ret;
+ *result = udata.ret;
} /* end if */
done:
diff --git a/src/H5SMpkg.h b/src/H5SMpkg.h
index f072741..3b13e23 100644
--- a/src/H5SMpkg.h
+++ b/src/H5SMpkg.h
@@ -268,7 +268,7 @@ H5_DLLVAR const H5B2_class_t H5SM_INDEX[1];
H5_DLL ssize_t H5SM_get_index(const H5SM_master_table_t *table, unsigned type_id);
/* Encode and decode routines, used for B-tree and cache encoding/decoding */
-H5_DLL herr_t H5SM__message_compare(const void *rec1, const void *rec2);
+H5_DLL herr_t H5SM__message_compare(const void *rec1, const void *rec2, int *result);
H5_DLL herr_t H5SM__message_encode(uint8_t *raw, const void *native, void *ctx);
H5_DLL herr_t H5SM__message_decode(const uint8_t *raw, void *native, void *ctx);
diff --git a/src/H5STprivate.h b/src/H5STprivate.h
index 892f04a..9b49b07 100644
--- a/src/H5STprivate.h
+++ b/src/H5STprivate.h
@@ -58,7 +58,9 @@ H5_DLL H5ST_ptr_t H5ST_findfirst(H5ST_tree_t *p);
H5_DLL H5ST_ptr_t H5ST_findnext(H5ST_ptr_t p);
H5_DLL void *H5ST_remove(H5ST_tree_t *root, const char *s);
H5_DLL herr_t H5ST_delete(H5ST_tree_t *root, H5ST_ptr_t p);
-H5_DLL herr_t H5ST_dump(H5ST_ptr_t p);
+#ifdef H5ST_DEBUG
+H5_DLL herr_t H5ST_dump(H5ST_tree_t *tree);
+#endif /* H5ST_DEBUG */
#endif /* _H5STprivate_H */
diff --git a/src/H5T.c b/src/H5T.c
index 9d233e9..3f93982 100644
--- a/src/H5T.c
+++ b/src/H5T.c
@@ -994,24 +994,24 @@ H5T__init_package(void)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype")
status = 0;
- status |= H5T_register(H5T_PERS_SOFT, "i_i", fixedpt, fixedpt, H5T__conv_i_i, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_SOFT, "i_f", fixedpt, floatpt, H5T__conv_i_f, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_SOFT, "f_f", floatpt, floatpt, H5T__conv_f_f, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_SOFT, "f_i", floatpt, fixedpt, H5T__conv_f_i, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_SOFT, "s_s", string, string, H5T__conv_s_s, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_SOFT, "b_b", bitfield, bitfield, H5T__conv_b_b, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_SOFT, "ibo", fixedpt, fixedpt, H5T__conv_order, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_SOFT, "ibo(opt)", fixedpt, fixedpt, H5T__conv_order_opt, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_SOFT, "fbo", floatpt, floatpt, H5T__conv_order, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_SOFT, "fbo(opt)", floatpt, floatpt, H5T__conv_order_opt, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_SOFT, "struct(no-opt)", compound, compound, H5T__conv_struct, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_SOFT, "struct(opt)", compound, compound, H5T__conv_struct_opt, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_SOFT, "enum", enum_type, enum_type, H5T__conv_enum, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_SOFT, "enum_i", enum_type, fixedpt, H5T__conv_enum_numeric, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_SOFT, "enum_f", enum_type, floatpt, H5T__conv_enum_numeric, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_SOFT, "vlen", vlen, vlen, H5T__conv_vlen, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_SOFT, "array", array, array, H5T__conv_array, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_SOFT, "objref", objref, objref, H5T__conv_order_opt, H5AC_ind_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_SOFT, "i_i", fixedpt, fixedpt, H5T__conv_i_i, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_SOFT, "i_f", fixedpt, floatpt, H5T__conv_i_f, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_SOFT, "f_f", floatpt, floatpt, H5T__conv_f_f, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_SOFT, "f_i", floatpt, fixedpt, H5T__conv_f_i, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_SOFT, "s_s", string, string, H5T__conv_s_s, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_SOFT, "b_b", bitfield, bitfield, H5T__conv_b_b, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_SOFT, "ibo", fixedpt, fixedpt, H5T__conv_order, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_SOFT, "ibo(opt)", fixedpt, fixedpt, H5T__conv_order_opt, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_SOFT, "fbo", floatpt, floatpt, H5T__conv_order, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_SOFT, "fbo(opt)", floatpt, floatpt, H5T__conv_order_opt, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_SOFT, "struct(no-opt)", compound, compound, H5T__conv_struct, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_SOFT, "struct(opt)", compound, compound, H5T__conv_struct_opt, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_SOFT, "enum", enum_type, enum_type, H5T__conv_enum, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_SOFT, "enum_i", enum_type, fixedpt, H5T__conv_enum_numeric, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_SOFT, "enum_f", enum_type, floatpt, H5T__conv_enum_numeric, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_SOFT, "vlen", vlen, vlen, H5T__conv_vlen, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_SOFT, "array", array, array, H5T__conv_array, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_SOFT, "objref", objref, objref, H5T__conv_order_opt, H5AC_noio_dxpl_id, FALSE);
/*
* Native conversions should be listed last since we can use hardware to
@@ -1022,221 +1022,221 @@ H5T__init_package(void)
*/
/* floating point */
- status |= H5T_register(H5T_PERS_HARD, "flt_dbl", native_float, native_double, H5T__conv_float_double, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "dbl_flt", native_double, native_float, H5T__conv_double_float, H5AC_ind_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "flt_dbl", native_float, native_double, H5T__conv_float_double, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "dbl_flt", native_double, native_float, H5T__conv_double_float, H5AC_noio_dxpl_id, FALSE);
#if H5_SIZEOF_LONG_DOUBLE != 0
- status |= H5T_register(H5T_PERS_HARD, "flt_ldbl", native_float, native_ldouble, H5T__conv_float_ldouble, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "dbl_ldbl", native_double, native_ldouble, H5T__conv_double_ldouble, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "ldbl_flt", native_ldouble, native_float, H5T__conv_ldouble_float, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "ldbl_dbl", native_ldouble, native_double, H5T__conv_ldouble_double, H5AC_ind_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "flt_ldbl", native_float, native_ldouble, H5T__conv_float_ldouble, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "dbl_ldbl", native_double, native_ldouble, H5T__conv_double_ldouble, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "ldbl_flt", native_ldouble, native_float, H5T__conv_ldouble_float, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "ldbl_dbl", native_ldouble, native_double, H5T__conv_ldouble_double, H5AC_noio_dxpl_id, FALSE);
#endif /* H5_SIZEOF_LONG_DOUBLE != 0 */
/* from long long */
- status |= H5T_register(H5T_PERS_HARD, "llong_ullong", native_llong, native_ullong, H5T__conv_llong_ullong, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "ullong_llong", native_ullong, native_llong, H5T__conv_ullong_llong, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "llong_long", native_llong, native_long, H5T__conv_llong_long, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "llong_ulong", native_llong, native_ulong, H5T__conv_llong_ulong, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "ullong_long", native_ullong, native_long, H5T__conv_ullong_long, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "ullong_ulong", native_ullong, native_ulong, H5T__conv_ullong_ulong, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "llong_short", native_llong, native_short, H5T__conv_llong_short, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "llong_ushort", native_llong, native_ushort, H5T__conv_llong_ushort, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "ullong_short", native_ullong, native_short, H5T__conv_ullong_short, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "ullong_ushort", native_ullong, native_ushort, H5T__conv_ullong_ushort, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "llong_int", native_llong, native_int, H5T__conv_llong_int, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "llong_uint", native_llong, native_uint, H5T__conv_llong_uint, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "ullong_int", native_ullong, native_int, H5T__conv_ullong_int, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "ullong_uint", native_ullong, native_uint, H5T__conv_ullong_uint, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "llong_schar", native_llong, native_schar, H5T__conv_llong_schar, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "llong_uchar", native_llong, native_uchar, H5T__conv_llong_uchar, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "ullong_schar", native_ullong, native_schar, H5T__conv_ullong_schar, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "ullong_uchar", native_ullong, native_uchar, H5T__conv_ullong_uchar, H5AC_ind_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "llong_ullong", native_llong, native_ullong, H5T__conv_llong_ullong, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "ullong_llong", native_ullong, native_llong, H5T__conv_ullong_llong, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "llong_long", native_llong, native_long, H5T__conv_llong_long, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "llong_ulong", native_llong, native_ulong, H5T__conv_llong_ulong, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "ullong_long", native_ullong, native_long, H5T__conv_ullong_long, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "ullong_ulong", native_ullong, native_ulong, H5T__conv_ullong_ulong, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "llong_short", native_llong, native_short, H5T__conv_llong_short, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "llong_ushort", native_llong, native_ushort, H5T__conv_llong_ushort, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "ullong_short", native_ullong, native_short, H5T__conv_ullong_short, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "ullong_ushort", native_ullong, native_ushort, H5T__conv_ullong_ushort, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "llong_int", native_llong, native_int, H5T__conv_llong_int, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "llong_uint", native_llong, native_uint, H5T__conv_llong_uint, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "ullong_int", native_ullong, native_int, H5T__conv_ullong_int, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "ullong_uint", native_ullong, native_uint, H5T__conv_ullong_uint, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "llong_schar", native_llong, native_schar, H5T__conv_llong_schar, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "llong_uchar", native_llong, native_uchar, H5T__conv_llong_uchar, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "ullong_schar", native_ullong, native_schar, H5T__conv_ullong_schar, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "ullong_uchar", native_ullong, native_uchar, H5T__conv_ullong_uchar, H5AC_noio_dxpl_id, FALSE);
/* From long */
- status |= H5T_register(H5T_PERS_HARD, "long_llong", native_long, native_llong, H5T__conv_long_llong, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "long_ullong", native_long, native_ullong, H5T__conv_long_ullong, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "ulong_llong", native_ulong, native_llong, H5T__conv_ulong_llong, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "ulong_ullong", native_ulong, native_ullong, H5T__conv_ulong_ullong, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "long_ulong", native_long, native_ulong, H5T__conv_long_ulong, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "ulong_long", native_ulong, native_long, H5T__conv_ulong_long, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "long_short", native_long, native_short, H5T__conv_long_short, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "long_ushort", native_long, native_ushort, H5T__conv_long_ushort, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "ulong_short", native_ulong, native_short, H5T__conv_ulong_short, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "ulong_ushort", native_ulong, native_ushort, H5T__conv_ulong_ushort, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "long_int", native_long, native_int, H5T__conv_long_int, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "long_uint", native_long, native_uint, H5T__conv_long_uint, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "ulong_int", native_ulong, native_int, H5T__conv_ulong_int, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "ulong_uint", native_ulong, native_uint, H5T__conv_ulong_uint, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "long_schar", native_long, native_schar, H5T__conv_long_schar, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "long_uchar", native_long, native_uchar, H5T__conv_long_uchar, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "ulong_schar", native_ulong, native_schar, H5T__conv_ulong_schar, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "ulong_uchar", native_ulong, native_uchar, H5T__conv_ulong_uchar, H5AC_ind_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "long_llong", native_long, native_llong, H5T__conv_long_llong, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "long_ullong", native_long, native_ullong, H5T__conv_long_ullong, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "ulong_llong", native_ulong, native_llong, H5T__conv_ulong_llong, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "ulong_ullong", native_ulong, native_ullong, H5T__conv_ulong_ullong, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "long_ulong", native_long, native_ulong, H5T__conv_long_ulong, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "ulong_long", native_ulong, native_long, H5T__conv_ulong_long, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "long_short", native_long, native_short, H5T__conv_long_short, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "long_ushort", native_long, native_ushort, H5T__conv_long_ushort, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "ulong_short", native_ulong, native_short, H5T__conv_ulong_short, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "ulong_ushort", native_ulong, native_ushort, H5T__conv_ulong_ushort, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "long_int", native_long, native_int, H5T__conv_long_int, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "long_uint", native_long, native_uint, H5T__conv_long_uint, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "ulong_int", native_ulong, native_int, H5T__conv_ulong_int, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "ulong_uint", native_ulong, native_uint, H5T__conv_ulong_uint, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "long_schar", native_long, native_schar, H5T__conv_long_schar, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "long_uchar", native_long, native_uchar, H5T__conv_long_uchar, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "ulong_schar", native_ulong, native_schar, H5T__conv_ulong_schar, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "ulong_uchar", native_ulong, native_uchar, H5T__conv_ulong_uchar, H5AC_noio_dxpl_id, FALSE);
/* From short */
- status |= H5T_register(H5T_PERS_HARD, "short_llong", native_short, native_llong, H5T__conv_short_llong, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "short_ullong", native_short, native_ullong, H5T__conv_short_ullong, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "ushort_llong", native_ushort, native_llong, H5T__conv_ushort_llong, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "ushort_ullong", native_ushort, native_ullong, H5T__conv_ushort_ullong, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "short_long", native_short, native_long, H5T__conv_short_long, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "short_ulong", native_short, native_ulong, H5T__conv_short_ulong, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "ushort_long", native_ushort, native_long, H5T__conv_ushort_long, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "ushort_ulong", native_ushort, native_ulong, H5T__conv_ushort_ulong, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "short_ushort", native_short, native_ushort, H5T__conv_short_ushort, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "ushort_short", native_ushort, native_short, H5T__conv_ushort_short, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "short_int", native_short, native_int, H5T__conv_short_int, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "short_uint", native_short, native_uint, H5T__conv_short_uint, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "ushort_int", native_ushort, native_int, H5T__conv_ushort_int, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "ushort_uint", native_ushort, native_uint, H5T__conv_ushort_uint, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "short_schar", native_short, native_schar, H5T__conv_short_schar, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "short_uchar", native_short, native_uchar, H5T__conv_short_uchar, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "ushort_schar", native_ushort, native_schar, H5T__conv_ushort_schar, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "ushort_uchar", native_ushort, native_uchar, H5T__conv_ushort_uchar, H5AC_ind_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "short_llong", native_short, native_llong, H5T__conv_short_llong, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "short_ullong", native_short, native_ullong, H5T__conv_short_ullong, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "ushort_llong", native_ushort, native_llong, H5T__conv_ushort_llong, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "ushort_ullong", native_ushort, native_ullong, H5T__conv_ushort_ullong, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "short_long", native_short, native_long, H5T__conv_short_long, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "short_ulong", native_short, native_ulong, H5T__conv_short_ulong, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "ushort_long", native_ushort, native_long, H5T__conv_ushort_long, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "ushort_ulong", native_ushort, native_ulong, H5T__conv_ushort_ulong, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "short_ushort", native_short, native_ushort, H5T__conv_short_ushort, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "ushort_short", native_ushort, native_short, H5T__conv_ushort_short, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "short_int", native_short, native_int, H5T__conv_short_int, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "short_uint", native_short, native_uint, H5T__conv_short_uint, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "ushort_int", native_ushort, native_int, H5T__conv_ushort_int, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "ushort_uint", native_ushort, native_uint, H5T__conv_ushort_uint, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "short_schar", native_short, native_schar, H5T__conv_short_schar, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "short_uchar", native_short, native_uchar, H5T__conv_short_uchar, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "ushort_schar", native_ushort, native_schar, H5T__conv_ushort_schar, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "ushort_uchar", native_ushort, native_uchar, H5T__conv_ushort_uchar, H5AC_noio_dxpl_id, FALSE);
/* From int */
- status |= H5T_register(H5T_PERS_HARD, "int_llong", native_int, native_llong, H5T__conv_int_llong, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "int_ullong", native_int, native_ullong, H5T__conv_int_ullong, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "uint_llong", native_uint, native_llong, H5T__conv_uint_llong, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "uint_ullong", native_uint, native_ullong, H5T__conv_uint_ullong, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "int_long", native_int, native_long, H5T__conv_int_long, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "int_ulong", native_int, native_ulong, H5T__conv_int_ulong, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "uint_long", native_uint, native_long, H5T__conv_uint_long, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "uint_ulong", native_uint, native_ulong, H5T__conv_uint_ulong, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "int_short", native_int, native_short, H5T__conv_int_short, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "int_ushort", native_int, native_ushort, H5T__conv_int_ushort, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "uint_short", native_uint, native_short, H5T__conv_uint_short, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "uint_ushort", native_uint, native_ushort, H5T__conv_uint_ushort, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "int_uint", native_int, native_uint, H5T__conv_int_uint, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "uint_int", native_uint, native_int, H5T__conv_uint_int, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "int_schar", native_int, native_schar, H5T__conv_int_schar, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "int_uchar", native_int, native_uchar, H5T__conv_int_uchar, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "uint_schar", native_uint, native_schar, H5T__conv_uint_schar, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "uint_uchar", native_uint, native_uchar, H5T__conv_uint_uchar, H5AC_ind_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "int_llong", native_int, native_llong, H5T__conv_int_llong, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "int_ullong", native_int, native_ullong, H5T__conv_int_ullong, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "uint_llong", native_uint, native_llong, H5T__conv_uint_llong, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "uint_ullong", native_uint, native_ullong, H5T__conv_uint_ullong, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "int_long", native_int, native_long, H5T__conv_int_long, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "int_ulong", native_int, native_ulong, H5T__conv_int_ulong, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "uint_long", native_uint, native_long, H5T__conv_uint_long, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "uint_ulong", native_uint, native_ulong, H5T__conv_uint_ulong, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "int_short", native_int, native_short, H5T__conv_int_short, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "int_ushort", native_int, native_ushort, H5T__conv_int_ushort, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "uint_short", native_uint, native_short, H5T__conv_uint_short, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "uint_ushort", native_uint, native_ushort, H5T__conv_uint_ushort, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "int_uint", native_int, native_uint, H5T__conv_int_uint, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "uint_int", native_uint, native_int, H5T__conv_uint_int, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "int_schar", native_int, native_schar, H5T__conv_int_schar, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "int_uchar", native_int, native_uchar, H5T__conv_int_uchar, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "uint_schar", native_uint, native_schar, H5T__conv_uint_schar, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "uint_uchar", native_uint, native_uchar, H5T__conv_uint_uchar, H5AC_noio_dxpl_id, FALSE);
/* From char */
- status |= H5T_register(H5T_PERS_HARD, "schar_llong", native_schar, native_llong, H5T__conv_schar_llong, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "schar_ullong", native_schar, native_ullong, H5T__conv_schar_ullong, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "uchar_llong", native_uchar, native_llong, H5T__conv_uchar_llong, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "uchar_ullong", native_uchar, native_ullong, H5T__conv_uchar_ullong, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "schar_long", native_schar, native_long, H5T__conv_schar_long, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "schar_ulong", native_schar, native_ulong, H5T__conv_schar_ulong, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "uchar_long", native_uchar, native_long, H5T__conv_uchar_long, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "uchar_ulong", native_uchar, native_ulong, H5T__conv_uchar_ulong, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "schar_short", native_schar, native_short, H5T__conv_schar_short, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "schar_ushort", native_schar, native_ushort, H5T__conv_schar_ushort, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "uchar_short", native_uchar, native_short, H5T__conv_uchar_short, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "uchar_ushort", native_uchar, native_ushort, H5T__conv_uchar_ushort, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "schar_int", native_schar, native_int, H5T__conv_schar_int, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "schar_uint", native_schar, native_uint, H5T__conv_schar_uint, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "uchar_int", native_uchar, native_int, H5T__conv_uchar_int, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "uchar_uint", native_uchar, native_uint, H5T__conv_uchar_uint, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "schar_uchar", native_schar, native_uchar, H5T__conv_schar_uchar, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "uchar_schar", native_uchar, native_schar, H5T__conv_uchar_schar, H5AC_ind_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "schar_llong", native_schar, native_llong, H5T__conv_schar_llong, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "schar_ullong", native_schar, native_ullong, H5T__conv_schar_ullong, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "uchar_llong", native_uchar, native_llong, H5T__conv_uchar_llong, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "uchar_ullong", native_uchar, native_ullong, H5T__conv_uchar_ullong, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "schar_long", native_schar, native_long, H5T__conv_schar_long, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "schar_ulong", native_schar, native_ulong, H5T__conv_schar_ulong, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "uchar_long", native_uchar, native_long, H5T__conv_uchar_long, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "uchar_ulong", native_uchar, native_ulong, H5T__conv_uchar_ulong, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "schar_short", native_schar, native_short, H5T__conv_schar_short, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "schar_ushort", native_schar, native_ushort, H5T__conv_schar_ushort, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "uchar_short", native_uchar, native_short, H5T__conv_uchar_short, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "uchar_ushort", native_uchar, native_ushort, H5T__conv_uchar_ushort, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "schar_int", native_schar, native_int, H5T__conv_schar_int, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "schar_uint", native_schar, native_uint, H5T__conv_schar_uint, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "uchar_int", native_uchar, native_int, H5T__conv_uchar_int, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "uchar_uint", native_uchar, native_uint, H5T__conv_uchar_uint, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "schar_uchar", native_schar, native_uchar, H5T__conv_schar_uchar, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "uchar_schar", native_uchar, native_schar, H5T__conv_uchar_schar, H5AC_noio_dxpl_id, FALSE);
/* From char to floats */
- status |= H5T_register(H5T_PERS_HARD, "schar_flt", native_schar, native_float, H5T__conv_schar_float, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "schar_dbl", native_schar, native_double, H5T__conv_schar_double, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "schar_ldbl", native_schar, native_ldouble, H5T__conv_schar_ldouble, H5AC_ind_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "schar_flt", native_schar, native_float, H5T__conv_schar_float, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "schar_dbl", native_schar, native_double, H5T__conv_schar_double, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "schar_ldbl", native_schar, native_ldouble, H5T__conv_schar_ldouble, H5AC_noio_dxpl_id, FALSE);
/* From unsigned char to floats */
- status |= H5T_register(H5T_PERS_HARD, "uchar_flt", native_uchar, native_float, H5T__conv_uchar_float, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "uchar_dbl", native_uchar, native_double, H5T__conv_uchar_double, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "uchar_ldbl", native_uchar, native_ldouble, H5T__conv_uchar_ldouble, H5AC_ind_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "uchar_flt", native_uchar, native_float, H5T__conv_uchar_float, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "uchar_dbl", native_uchar, native_double, H5T__conv_uchar_double, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "uchar_ldbl", native_uchar, native_ldouble, H5T__conv_uchar_ldouble, H5AC_noio_dxpl_id, FALSE);
/* From short to floats */
- status |= H5T_register(H5T_PERS_HARD, "short_flt", native_short, native_float, H5T__conv_short_float, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "short_dbl", native_short, native_double, H5T__conv_short_double, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "short_ldbl", native_short, native_ldouble, H5T__conv_short_ldouble, H5AC_ind_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "short_flt", native_short, native_float, H5T__conv_short_float, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "short_dbl", native_short, native_double, H5T__conv_short_double, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "short_ldbl", native_short, native_ldouble, H5T__conv_short_ldouble, H5AC_noio_dxpl_id, FALSE);
/* From unsigned short to floats */
- status |= H5T_register(H5T_PERS_HARD, "ushort_flt", native_ushort, native_float, H5T__conv_ushort_float, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "ushort_dbl", native_ushort, native_double, H5T__conv_ushort_double, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "ushort_ldbl", native_ushort, native_ldouble, H5T__conv_ushort_ldouble, H5AC_ind_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "ushort_flt", native_ushort, native_float, H5T__conv_ushort_float, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "ushort_dbl", native_ushort, native_double, H5T__conv_ushort_double, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "ushort_ldbl", native_ushort, native_ldouble, H5T__conv_ushort_ldouble, H5AC_noio_dxpl_id, FALSE);
/* From int to floats */
- status |= H5T_register(H5T_PERS_HARD, "int_flt", native_int, native_float, H5T__conv_int_float, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "int_dbl", native_int, native_double, H5T__conv_int_double, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "int_ldbl", native_int, native_ldouble, H5T__conv_int_ldouble, H5AC_ind_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "int_flt", native_int, native_float, H5T__conv_int_float, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "int_dbl", native_int, native_double, H5T__conv_int_double, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "int_ldbl", native_int, native_ldouble, H5T__conv_int_ldouble, H5AC_noio_dxpl_id, FALSE);
/* From unsigned int to floats */
- status |= H5T_register(H5T_PERS_HARD, "uint_flt", native_uint, native_float, H5T__conv_uint_float, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "uint_dbl", native_uint, native_double, H5T__conv_uint_double, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "uint_ldbl", native_uint, native_ldouble, H5T__conv_uint_ldouble, H5AC_ind_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "uint_flt", native_uint, native_float, H5T__conv_uint_float, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "uint_dbl", native_uint, native_double, H5T__conv_uint_double, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "uint_ldbl", native_uint, native_ldouble, H5T__conv_uint_ldouble, H5AC_noio_dxpl_id, FALSE);
/* From long to floats */
- status |= H5T_register(H5T_PERS_HARD, "long_flt", native_long, native_float, H5T__conv_long_float, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "long_dbl", native_long, native_double, H5T__conv_long_double, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "long_ldbl", native_long, native_ldouble, H5T__conv_long_ldouble, H5AC_ind_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "long_flt", native_long, native_float, H5T__conv_long_float, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "long_dbl", native_long, native_double, H5T__conv_long_double, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "long_ldbl", native_long, native_ldouble, H5T__conv_long_ldouble, H5AC_noio_dxpl_id, FALSE);
/* From unsigned long to floats */
- status |= H5T_register(H5T_PERS_HARD, "ulong_flt", native_ulong, native_float, H5T__conv_ulong_float, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "ulong_dbl", native_ulong, native_double, H5T__conv_ulong_double, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "ulong_ldbl", native_ulong, native_ldouble, H5T__conv_ulong_ldouble, H5AC_ind_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "ulong_flt", native_ulong, native_float, H5T__conv_ulong_float, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "ulong_dbl", native_ulong, native_double, H5T__conv_ulong_double, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "ulong_ldbl", native_ulong, native_ldouble, H5T__conv_ulong_ldouble, H5AC_noio_dxpl_id, FALSE);
/* From long long to floats */
- status |= H5T_register(H5T_PERS_HARD, "llong_flt", native_llong, native_float, H5T__conv_llong_float, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "llong_dbl", native_llong, native_double, H5T__conv_llong_double, H5AC_ind_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "llong_flt", native_llong, native_float, H5T__conv_llong_float, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "llong_dbl", native_llong, native_double, H5T__conv_llong_double, H5AC_noio_dxpl_id, FALSE);
#ifdef H5T_CONV_INTERNAL_LLONG_LDOUBLE
- status |= H5T_register(H5T_PERS_HARD, "llong_ldbl", native_llong, native_ldouble, H5T__conv_llong_ldouble, H5AC_ind_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "llong_ldbl", native_llong, native_ldouble, H5T__conv_llong_ldouble, H5AC_noio_dxpl_id, FALSE);
#endif /* H5T_CONV_INTERNAL_LLONG_LDOUBLE */
/* From unsigned long long to floats */
- status |= H5T_register(H5T_PERS_HARD, "ullong_flt", native_ullong, native_float, H5T__conv_ullong_float, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "ullong_dbl", native_ullong, native_double, H5T__conv_ullong_double, H5AC_ind_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "ullong_flt", native_ullong, native_float, H5T__conv_ullong_float, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "ullong_dbl", native_ullong, native_double, H5T__conv_ullong_double, H5AC_noio_dxpl_id, FALSE);
#ifdef H5T_CONV_INTERNAL_ULLONG_LDOUBLE
- status |= H5T_register(H5T_PERS_HARD, "ullong_ldbl", native_ullong, native_ldouble, H5T__conv_ullong_ldouble, H5AC_ind_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "ullong_ldbl", native_ullong, native_ldouble, H5T__conv_ullong_ldouble, H5AC_noio_dxpl_id, FALSE);
#endif /* H5T_CONV_INTERNAL_ULLONG_LDOUBLE */
/* From floats to char */
- status |= H5T_register(H5T_PERS_HARD, "flt_schar", native_float, native_schar, H5T__conv_float_schar, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "dbl_schar", native_double, native_schar, H5T__conv_double_schar, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "ldbl_schar", native_ldouble, native_schar, H5T__conv_ldouble_schar, H5AC_ind_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "flt_schar", native_float, native_schar, H5T__conv_float_schar, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "dbl_schar", native_double, native_schar, H5T__conv_double_schar, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "ldbl_schar", native_ldouble, native_schar, H5T__conv_ldouble_schar, H5AC_noio_dxpl_id, FALSE);
/* From floats to unsigned char */
- status |= H5T_register(H5T_PERS_HARD, "flt_uchar", native_float, native_uchar, H5T__conv_float_uchar, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "dbl_uchar", native_double, native_uchar, H5T__conv_double_uchar, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "ldbl_uchar", native_ldouble, native_uchar, H5T__conv_ldouble_uchar, H5AC_ind_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "flt_uchar", native_float, native_uchar, H5T__conv_float_uchar, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "dbl_uchar", native_double, native_uchar, H5T__conv_double_uchar, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "ldbl_uchar", native_ldouble, native_uchar, H5T__conv_ldouble_uchar, H5AC_noio_dxpl_id, FALSE);
/* From floats to short */
- status |= H5T_register(H5T_PERS_HARD, "flt_short", native_float, native_short, H5T__conv_float_short, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "dbl_short", native_double, native_short, H5T__conv_double_short, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "ldbl_short", native_ldouble, native_short, H5T__conv_ldouble_short, H5AC_ind_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "flt_short", native_float, native_short, H5T__conv_float_short, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "dbl_short", native_double, native_short, H5T__conv_double_short, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "ldbl_short", native_ldouble, native_short, H5T__conv_ldouble_short, H5AC_noio_dxpl_id, FALSE);
/* From floats to unsigned short */
- status |= H5T_register(H5T_PERS_HARD, "flt_ushort", native_float, native_ushort, H5T__conv_float_ushort, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "dbl_ushort", native_double, native_ushort, H5T__conv_double_ushort, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "ldbl_ushort", native_ldouble, native_ushort, H5T__conv_ldouble_ushort, H5AC_ind_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "flt_ushort", native_float, native_ushort, H5T__conv_float_ushort, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "dbl_ushort", native_double, native_ushort, H5T__conv_double_ushort, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "ldbl_ushort", native_ldouble, native_ushort, H5T__conv_ldouble_ushort, H5AC_noio_dxpl_id, FALSE);
/* From floats to int */
- status |= H5T_register(H5T_PERS_HARD, "flt_int", native_float, native_int, H5T__conv_float_int, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "dbl_int", native_double, native_int, H5T__conv_double_int, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "ldbl_int", native_ldouble, native_int, H5T__conv_ldouble_int, H5AC_ind_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "flt_int", native_float, native_int, H5T__conv_float_int, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "dbl_int", native_double, native_int, H5T__conv_double_int, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "ldbl_int", native_ldouble, native_int, H5T__conv_ldouble_int, H5AC_noio_dxpl_id, FALSE);
/* From floats to unsigned int */
- status |= H5T_register(H5T_PERS_HARD, "flt_uint", native_float, native_uint, H5T__conv_float_uint, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "dbl_uint", native_double, native_uint, H5T__conv_double_uint, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "ldbl_uint", native_ldouble, native_uint, H5T__conv_ldouble_uint, H5AC_ind_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "flt_uint", native_float, native_uint, H5T__conv_float_uint, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "dbl_uint", native_double, native_uint, H5T__conv_double_uint, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "ldbl_uint", native_ldouble, native_uint, H5T__conv_ldouble_uint, H5AC_noio_dxpl_id, FALSE);
/* From floats to long */
- status |= H5T_register(H5T_PERS_HARD, "flt_long", native_float, native_long, H5T__conv_float_long, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "dbl_long", native_double, native_long, H5T__conv_double_long, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "ldbl_long", native_ldouble, native_long, H5T__conv_ldouble_long, H5AC_ind_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "flt_long", native_float, native_long, H5T__conv_float_long, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "dbl_long", native_double, native_long, H5T__conv_double_long, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "ldbl_long", native_ldouble, native_long, H5T__conv_ldouble_long, H5AC_noio_dxpl_id, FALSE);
/* From floats to unsigned long */
- status |= H5T_register(H5T_PERS_HARD, "flt_ulong", native_float, native_ulong, H5T__conv_float_ulong, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "dbl_ulong", native_double, native_ulong, H5T__conv_double_ulong, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "ldbl_ulong", native_ldouble, native_ulong, H5T__conv_ldouble_ulong, H5AC_ind_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "flt_ulong", native_float, native_ulong, H5T__conv_float_ulong, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "dbl_ulong", native_double, native_ulong, H5T__conv_double_ulong, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "ldbl_ulong", native_ldouble, native_ulong, H5T__conv_ldouble_ulong, H5AC_noio_dxpl_id, FALSE);
/* From floats to long long */
- status |= H5T_register(H5T_PERS_HARD, "flt_llong", native_float, native_llong, H5T__conv_float_llong, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "dbl_llong", native_double, native_llong, H5T__conv_double_llong, H5AC_ind_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "flt_llong", native_float, native_llong, H5T__conv_float_llong, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "dbl_llong", native_double, native_llong, H5T__conv_double_llong, H5AC_noio_dxpl_id, FALSE);
#ifdef H5T_CONV_INTERNAL_LDOUBLE_LLONG
- status |= H5T_register(H5T_PERS_HARD, "ldbl_llong", native_ldouble, native_llong, H5T__conv_ldouble_llong, H5AC_ind_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "ldbl_llong", native_ldouble, native_llong, H5T__conv_ldouble_llong, H5AC_noio_dxpl_id, FALSE);
#endif /* H5T_CONV_INTERNAL_LDOUBLE_LLONG */
/* From floats to unsigned long long */
- status |= H5T_register(H5T_PERS_HARD, "flt_ullong", native_float, native_ullong, H5T__conv_float_ullong, H5AC_ind_dxpl_id, FALSE);
- status |= H5T_register(H5T_PERS_HARD, "dbl_ullong", native_double, native_ullong, H5T__conv_double_ullong, H5AC_ind_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "flt_ullong", native_float, native_ullong, H5T__conv_float_ullong, H5AC_noio_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "dbl_ullong", native_double, native_ullong, H5T__conv_double_ullong, H5AC_noio_dxpl_id, FALSE);
#if H5T_CONV_INTERNAL_LDOUBLE_ULLONG
- status |= H5T_register(H5T_PERS_HARD, "ldbl_ullong", native_ldouble, native_ullong, H5T__conv_ldouble_ullong, H5AC_ind_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "ldbl_ullong", native_ldouble, native_ullong, H5T__conv_ldouble_ullong, H5AC_noio_dxpl_id, FALSE);
#endif /* H5T_CONV_INTERNAL_LDOUBLE_ULLONG */
/*
@@ -1244,7 +1244,7 @@ H5T__init_package(void)
* data types we use are not important as long as the source and
* destination are equal.
*/
- status |= H5T_register(H5T_PERS_HARD, "no-op", native_int, native_int, H5T__conv_noop, H5AC_ind_dxpl_id, FALSE);
+ status |= H5T_register(H5T_PERS_HARD, "no-op", native_int, native_int, H5T__conv_noop, H5AC_noio_dxpl_id, FALSE);
/* Initialize the +/- Infinity values for floating-point types */
status |= H5T__init_inf();
@@ -1366,7 +1366,7 @@ H5T_top_term_package(void)
H5T__print_stats(path, &nprint/*in,out*/);
path->cdata.command = H5T_CONV_FREE;
if((path->func)((hid_t)FAIL, (hid_t)FAIL, &(path->cdata), (size_t)0,
- (size_t)0, (size_t)0, NULL, NULL,H5AC_ind_dxpl_id) < 0) {
+ (size_t)0, (size_t)0, NULL, NULL,H5AC_noio_dxpl_id) < 0) {
#ifdef H5T_DEBUG
if (H5DEBUG(T)) {
fprintf(H5DEBUG(T), "H5T: conversion function "
@@ -2461,7 +2461,7 @@ H5Tregister(H5T_pers_t pers, const char *name, hid_t src_id, hid_t dst_id,
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no conversion function specified")
/* Go register the function */
- if(H5T_register(pers, name, src, dst, func, H5AC_ind_dxpl_id, TRUE) < 0)
+ if(H5T_register(pers, name, src, dst, func, H5AC_noio_dxpl_id, TRUE) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't register conversion function")
done:
@@ -2600,7 +2600,7 @@ H5Tunregister(H5T_pers_t pers, const char *name, hid_t src_id, hid_t dst_id,
if(dst_id > 0 && (NULL == (dst = (H5T_t *)H5I_object_verify(dst_id, H5I_DATATYPE))))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dst is not a data type")
- if(H5T_unregister(pers, name, src, dst, func, H5AC_ind_dxpl_id) < 0)
+ if(H5T_unregister(pers, name, src, dst, func, H5AC_noio_dxpl_id) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTDELETE, FAIL, "internal unregister function failed")
done:
@@ -2644,7 +2644,7 @@ H5Tfind(hid_t src_id, hid_t dst_id, H5T_cdata_t **pcdata)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "no address to receive cdata pointer")
/* Find it */
- if(NULL == (path = H5T_path_find(src, dst, NULL, NULL, H5AC_ind_dxpl_id, FALSE)))
+ if(NULL == (path = H5T_path_find(src, dst, NULL, NULL, H5AC_noio_dxpl_id, FALSE)))
HGOTO_ERROR(H5E_DATATYPE, H5E_NOTFOUND, NULL, "conversion function not found")
if(pcdata)
@@ -2940,7 +2940,7 @@ H5T_decode(const unsigned char *buf)
HGOTO_ERROR(H5E_DATATYPE, H5E_VERSION, NULL, "unknown version of encoded datatype")
/* Decode the serialized datatype message */
- if(NULL == (ret_value = (H5T_t *)H5O_msg_decode(f, H5AC_ind_dxpl_id, NULL, H5O_DTYPE_ID, buf)))
+ if(NULL == (ret_value = (H5T_t *)H5O_msg_decode(f, H5AC_noio_dxpl_id, NULL, H5O_DTYPE_ID, buf)))
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTDECODE, NULL, "can't decode object")
/* Mark datatype as being in memory now */
@@ -3525,7 +3525,7 @@ H5T__free(H5T_t *dt)
/* Remove the datatype from the list of opened objects in the file */
if(H5FO_top_decr(dt->sh_loc.file, dt->sh_loc.u.loc.oh_addr) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTRELEASE, FAIL, "can't decrement count for object")
- if(H5FO_delete(dt->sh_loc.file, H5AC_dxpl_id, dt->sh_loc.u.loc.oh_addr) < 0)
+ if(H5FO_delete(dt->sh_loc.file, H5AC_ind_read_dxpl_id, dt->sh_loc.u.loc.oh_addr) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTRELEASE, FAIL, "can't remove datatype from list of open objects")
if(H5O_close(&dt->oloc) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to close data type object header")
@@ -4765,7 +4765,7 @@ H5T_compiler_conv(H5T_t *src, H5T_t *dst)
FUNC_ENTER_NOAPI_NOINIT
/* Find it */
- if (NULL==(path=H5T_path_find(src, dst, NULL, NULL, H5AC_ind_dxpl_id, FALSE)))
+ if (NULL==(path=H5T_path_find(src, dst, NULL, NULL, H5AC_noio_dxpl_id, FALSE)))
HGOTO_ERROR(H5E_DATATYPE, H5E_NOTFOUND, FAIL, "conversion function not found")
ret_value = (htri_t)path->is_hard;
diff --git a/src/H5TS.c b/src/H5TS.c
index 987bead..6a64a14 100644
--- a/src/H5TS.c
+++ b/src/H5TS.c
@@ -255,19 +255,18 @@ H5TS_cancel_count_inc(void)
if (!cancel_counter) {
/*
- * First time thread calls library - create new counter and associate
+ * First time thread calls library - create new counter and associate
* with key
*/
- cancel_counter = (H5TS_cancel_t *)H5MM_calloc(sizeof(H5TS_cancel_t));
+ cancel_counter = (H5TS_cancel_t *)HDcalloc(1, sizeof(H5TS_cancel_t));
- if (!cancel_counter) {
- H5E_push_stack(NULL, "H5TS_cancel_count_inc",
- __FILE__, __LINE__, H5E_ERR_CLS_g, H5E_RESOURCE, H5E_NOSPACE, "memory allocation failed");
- return FAIL;
- }
+ if (!cancel_counter) {
+ H5E_push_stack(NULL, "H5TS_cancel_count_inc", __FILE__, __LINE__,
+ H5E_ERR_CLS_g, H5E_RESOURCE, H5E_NOSPACE, "memory allocation failed");
+ return FAIL;
+ }
- ret_value = pthread_setspecific(H5TS_cancel_key_g,
- (void *)cancel_counter);
+ ret_value = pthread_setspecific(H5TS_cancel_key_g, (void *)cancel_counter);
}
if (cancel_counter->cancel_count == 0)
diff --git a/src/H5Tcommit.c b/src/H5Tcommit.c
index 8b70a7b..bd00543 100644
--- a/src/H5Tcommit.c
+++ b/src/H5Tcommit.c
@@ -106,6 +106,7 @@ H5Tcommit2(hid_t loc_id, const char *name, hid_t type_id, hid_t lcpl_id,
H5VL_object_t *new_obj = NULL; /* VOL object that holds the datatype object and the VOL info */
H5T_t *type = NULL; /* high level datatype object that wraps the VOL object */
H5VL_object_t *obj = NULL; /* object token of loc_id */
+ hid_t dxpl_id = H5AC_ind_read_dxpl_id; /* dxpl used by library */
H5VL_loc_params_t loc_params;
herr_t ret_value = SUCCEED; /* Return value */
@@ -134,12 +135,9 @@ H5Tcommit2(hid_t loc_id, const char *name, hid_t type_id, hid_t lcpl_id,
if(TRUE != H5P_isa_class(tcpl_id, H5P_DATATYPE_CREATE))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not datatype creation property list")
- /* Get correct property list */
- if(H5P_DEFAULT == tapl_id)
- tapl_id = H5P_DATATYPE_ACCESS_DEFAULT;
- else
- if(TRUE != H5P_isa_class(tapl_id, H5P_DATATYPE_ACCESS))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not datatype access property list")
+ /* Verify access property list and get correct dxpl */
+ if(H5P_verify_apl_and_dxpl(&tapl_id, H5P_CLS_TACC, &dxpl_id, loc_id, TRUE) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access and transfer property lists")
loc_params.type = H5VL_OBJECT_BY_SELF;
loc_params.obj_type = H5I_get_type(loc_id);
@@ -151,7 +149,7 @@ H5Tcommit2(hid_t loc_id, const char *name, hid_t type_id, hid_t lcpl_id,
/* commit the datatype through the VOL */
if (NULL == (dt = H5VL_datatype_commit(obj->vol_obj, loc_params, obj->vol_info->vol_cls,
name, type_id, lcpl_id, tcpl_id, tapl_id,
- H5AC_dxpl_id, H5_REQUEST_NULL)))
+ dxpl_id, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to commit datatype")
/* setup VOL object */
@@ -277,6 +275,7 @@ H5Tcommit_anon(hid_t loc_id, hid_t type_id, hid_t tcpl_id, hid_t tapl_id)
H5VL_object_t *new_obj = NULL; /* VOL object that holds the datatype object and the VOL info */
H5T_t *type = NULL; /* high level datatype object that wraps the VOL object */
H5VL_object_t *obj = NULL; /* object token of loc_id */
+ hid_t dxpl_id = H5AC_ind_read_dxpl_id; /* dxpl used by library */
H5VL_loc_params_t loc_params;
herr_t ret_value = SUCCEED; /* Return value */
@@ -296,12 +295,9 @@ H5Tcommit_anon(hid_t loc_id, hid_t type_id, hid_t tcpl_id, hid_t tapl_id)
if(TRUE != H5P_isa_class(tcpl_id, H5P_DATATYPE_CREATE))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not datatype creation property list")
- /* Get correct property list */
- if(H5P_DEFAULT == tapl_id)
- tapl_id = H5P_DATATYPE_ACCESS_DEFAULT;
- else
- if(TRUE != H5P_isa_class(tapl_id, H5P_DATATYPE_ACCESS))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not datatype access property list")
+ /* Verify access property list and get correct dxpl */
+ if(H5P_verify_apl_and_dxpl(&tapl_id, H5P_CLS_TACC, &dxpl_id, loc_id, TRUE) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access and transfer property lists")
loc_params.type = H5VL_OBJECT_BY_SELF;
loc_params.obj_type = H5I_get_type(loc_id);
@@ -313,7 +309,7 @@ H5Tcommit_anon(hid_t loc_id, hid_t type_id, hid_t tcpl_id, hid_t tapl_id)
/* commite the datatype through the VOL */
if (NULL == (dt = H5VL_datatype_commit(obj->vol_obj, loc_params, obj->vol_info->vol_cls,
NULL, type_id, H5P_DEFAULT, tcpl_id, tapl_id,
- H5AC_dxpl_id, H5_REQUEST_NULL)))
+ dxpl_id, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to commit datatype")
/* setup VOL object */
@@ -391,7 +387,7 @@ H5T__commit(H5F_t *file, H5T_t *type, hid_t tcpl_id, hid_t dxpl_id)
loc_init = TRUE;
/* Set the latest format, if requested */
- if(H5F_USE_LATEST_FORMAT(file))
+ if(H5F_USE_LATEST_FLAGS(file, H5F_LATEST_DATATYPE))
if(H5T_set_latest_version(type) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set latest version of datatype")
@@ -541,8 +537,8 @@ H5Topen2(hid_t loc_id, const char *name, hid_t tapl_id)
void *vol_dt = NULL; /* datatype token created by VOL plugin */
H5VL_object_t *obj = NULL; /* object token of loc_id */
H5VL_loc_params_t loc_params;
- hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl to use to open datatype */
- hid_t ret_value = FAIL; /* Return value */
+ hid_t dxpl_id = H5AC_ind_read_dxpl_id; /* dxpl used by library */
+ hid_t ret_value = FAIL; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE3("i", "i*si", loc_id, name, tapl_id);
@@ -551,12 +547,9 @@ H5Topen2(hid_t loc_id, const char *name, hid_t tapl_id)
if(!name || !*name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name")
- /* Get correct property list */
- if(H5P_DEFAULT == tapl_id)
- tapl_id = H5P_DATATYPE_ACCESS_DEFAULT;
- else
- if(TRUE != H5P_isa_class(tapl_id, H5P_DATATYPE_ACCESS))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not datatype access property list")
+ /* Verify access property list and get correct dxpl */
+ if(H5P_verify_apl_and_dxpl(&tapl_id, H5P_CLS_TACC, &dxpl_id, loc_id, FALSE) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access and transfer property lists")
loc_params.type = H5VL_OBJECT_BY_SELF;
loc_params.obj_type = H5I_get_type(loc_id);
@@ -633,7 +626,7 @@ H5Tget_create_plist(hid_t dtype_id)
/* get the rest of the plist through the VOL */
if(H5VL_datatype_get(vol_dt->vol_obj, vol_dt->vol_info->vol_cls, H5VL_DATATYPE_GET_TCPL,
- H5AC_ind_dxpl_id, H5_REQUEST_NULL, &ret_value) < 0)
+ H5AC_ind_read_dxpl_id, H5_REQUEST_NULL, &ret_value) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get datatype")
} /* end if */
@@ -930,7 +923,7 @@ H5T_construct_datatype(H5VL_object_t *dt_obj)
/* get required buf size for encoding the datatype */
if(H5VL_datatype_get(dt_obj->vol_obj, dt_obj->vol_info->vol_cls, H5VL_DATATYPE_GET_BINARY,
- H5AC_dxpl_id, H5_REQUEST_NULL, &nalloc, NULL, 0) < 0)
+ H5AC_ind_read_dxpl_id, H5_REQUEST_NULL, &nalloc, NULL, 0) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to get datatype serialized size")
/* allocate buffer to store binary description of the datatype */
@@ -939,7 +932,7 @@ H5T_construct_datatype(H5VL_object_t *dt_obj)
/* get binary description of the datatype */
if(H5VL_datatype_get(dt_obj->vol_obj, dt_obj->vol_info->vol_cls, H5VL_DATATYPE_GET_BINARY,
- H5AC_dxpl_id, H5_REQUEST_NULL, &nalloc, buf, (size_t)nalloc) < 0)
+ H5AC_ind_read_dxpl_id, H5_REQUEST_NULL, &nalloc, buf, (size_t)nalloc) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to get serialized datatype")
if(NULL == (dt = H5T_decode((const unsigned char *)buf)))
@@ -983,7 +976,7 @@ H5T_close_datatype(void *type)
/* Close the datatype through the VOL*/
if((ret_value = H5VL_datatype_close(vol_dt->vol_obj, vol_dt->vol_info->vol_cls,
- H5AC_dxpl_id, H5_REQUEST_NULL)) < 0)
+ H5AC_ind_read_dxpl_id, H5_REQUEST_NULL)) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, FAIL, "unable to close datatype")
/* free attribute */
diff --git a/src/H5Tdeprec.c b/src/H5Tdeprec.c
index d2ba3a3..0ab57fc 100644
--- a/src/H5Tdeprec.c
+++ b/src/H5Tdeprec.c
@@ -134,7 +134,7 @@ H5Tcommit1(hid_t loc_id, const char *name, hid_t type_id)
if (NULL == (dt = H5VL_datatype_commit(obj->vol_obj, loc_params, obj->vol_info->vol_cls,
name, type_id, H5P_LINK_CREATE_DEFAULT,
H5P_DATATYPE_CREATE_DEFAULT, H5P_DATATYPE_ACCESS_DEFAULT,
- H5AC_dxpl_id, H5_REQUEST_NULL)))
+ H5AC_ind_read_dxpl_id, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to commit datatype")
/* setup VOL object */
@@ -175,7 +175,7 @@ H5Topen1(hid_t loc_id, const char *name)
H5T_t *dt = NULL; /* upper level H5T_t for datatype */
H5VL_object_t *obj = NULL; /* object token of loc_id */
H5VL_loc_params_t loc_params;
- hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl to use to open datatype */
+ hid_t dxpl_id = H5AC_ind_read_dxpl_id; /* dxpl to use to open datatype */
hid_t ret_value = FAIL; /* Return value */
FUNC_ENTER_API(FAIL)
diff --git a/src/H5Tnative.c b/src/H5Tnative.c
index 229fe94..9dbce09 100644
--- a/src/H5Tnative.c
+++ b/src/H5Tnative.c
@@ -358,7 +358,7 @@ H5T_get_native_type(H5T_t *dtype, H5T_direction_t direction, size_t *struct_alig
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "unable to create enum type")
/* Find the conversion function */
- if(NULL == (tpath = H5T_path_find(super_type, nat_super_type, NULL, NULL, H5P_DEFAULT, FALSE)))
+ if(NULL == (tpath = H5T_path_find(super_type, nat_super_type, NULL, NULL, H5AC_noio_dxpl_id, FALSE)))
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to convert between src and dst data types")
/* Retrieve member info and insert members into new enum type */
@@ -372,7 +372,7 @@ H5T_get_native_type(H5T_t *dtype, H5T_direction_t direction, size_t *struct_alig
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot get member value")
HDmemcpy(memb_value, tmp_memb_value, H5T_get_size(super_type));
- if(H5T_convert(tpath, super_type_id, nat_super_type_id, (size_t)1, (size_t)0, (size_t)0, memb_value, NULL, H5P_DATASET_XFER_DEFAULT) < 0)
+ if(H5T_convert(tpath, super_type_id, nat_super_type_id, (size_t)1, (size_t)0, (size_t)0, memb_value, NULL, H5AC_noio_dxpl_id) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot get member value")
if(H5T__enum_insert(new_type, memb_name, memb_value) < 0)
diff --git a/src/H5Tvlen.c b/src/H5Tvlen.c
index 2abdf6f..0ed8209 100644
--- a/src/H5Tvlen.c
+++ b/src/H5Tvlen.c
@@ -465,7 +465,7 @@ H5T_vlen_seq_mem_write(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, co
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for VL data")
} /* end if */
else { /* Default to system malloc */
- if(NULL==(vl.p=H5MM_malloc(len)))
+ if(NULL == (vl.p = HDmalloc(len)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for VL data")
} /* end else */
@@ -691,7 +691,7 @@ H5T_vlen_str_mem_write(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, co
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for VL data")
} /* end if */
else { /* Default to system malloc */
- if(NULL==(t = (char *)H5MM_malloc((seq_len+1)*base_size)))
+ if(NULL == (t = (char *)HDmalloc((seq_len + 1) * base_size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for VL data")
} /* end else */
@@ -1073,14 +1073,14 @@ H5T_vlen_reclaim_recurse(void *elem, const H5T_t *dt, H5MM_free_t free_func, voi
if(free_func != NULL)
(*free_func)(vl->p, free_info);
else
- H5MM_xfree(vl->p);
+ HDfree(vl->p);
} /* end if */
} else if(dt->shared->u.vlen.type == H5T_VLEN_STRING) {
/* Free the VL string */
if(free_func != NULL)
(*free_func)(*(char **)elem, free_info);
else
- H5MM_xfree(*(char **)elem);
+ HDfree(*(char **)elem);
} else {
HDassert(0 && "Invalid VL type");
} /* end else */
diff --git a/src/H5VLint.c b/src/H5VLint.c
index 02361c5..a9388b7 100644
--- a/src/H5VLint.c
+++ b/src/H5VLint.c
@@ -149,6 +149,7 @@ hid_t
H5VL_register_id(H5I_type_t type, void *object, H5VL_t *vol_plugin, hbool_t app_ref)
{
H5VL_object_t *new_obj = NULL;
+ H5T_t *dt = NULL;
hid_t ret_value = FAIL;
FUNC_ENTER_NOAPI(FAIL)
@@ -165,8 +166,6 @@ H5VL_register_id(H5I_type_t type, void *object, H5VL_t *vol_plugin, hbool_t app_
new_obj->vol_obj = object;
if(H5I_DATATYPE == type) {
- H5T_t *dt = NULL;
-
if(NULL == (dt = H5T_construct_datatype(new_obj)))
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't construct datatype object");
diff --git a/src/H5VLnative.c b/src/H5VLnative.c
index 0bc164f..4d74fbd 100644
--- a/src/H5VLnative.c
+++ b/src/H5VLnative.c
@@ -387,9 +387,8 @@ H5VL_native_register(H5I_type_t type, void *obj, hbool_t app_ref)
HDassert(obj);
/* make sure this is from the internal Native plugin not from the API */
- if(type == H5I_DATATYPE) {
+ if(type == H5I_DATATYPE)
HDassert(((H5T_t *)obj)->vol_obj == NULL);
- }
/* Get an atom for the object */
if ((ret_value = H5VL_object_register(obj, type, H5VL_NATIVE_g, app_ref)) < 0)
@@ -558,7 +557,7 @@ H5VL_native_attr_create(void *obj, H5VL_loc_params_t loc_params, const char *att
/* Find the object's location */
if(H5G_loc_find(&loc, loc_params.loc_data.loc_by_name.name, &obj_loc/*out*/,
- loc_params.loc_data.loc_by_name.lapl_id, H5AC_ind_dxpl_id) < 0)
+ loc_params.loc_data.loc_by_name.lapl_id, dxpl_id) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, NULL, "object not found")
loc_found = TRUE;
@@ -912,7 +911,7 @@ H5VL_native_attr_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_attr_spe
{
char *attr_name = va_arg (arguments, char *);
- if(H5A_delete(obj, loc_params, attr_name) < 0)
+ if(H5A_delete(obj, loc_params, attr_name, dxpl_id) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "error deleting attribute")
break;
}
@@ -950,7 +949,7 @@ H5VL_native_attr_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_attr_spe
H5A_operator2_t op = va_arg (arguments, H5A_operator2_t);
void *op_data = va_arg (arguments, void *);
- if((ret_value = H5A_iterate(obj, loc_params, idx_type, order, idx, op, op_data)) < 0)
+ if((ret_value = H5A_iterate(obj, loc_params, idx_type, order, idx, op, op_data, dxpl_id)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_BADITER, FAIL, "error iterating over attributes")
break;
}
@@ -1036,7 +1035,7 @@ H5VL_native_datatype_commit(void *obj, H5VL_loc_params_t loc_params, const char
{
H5G_loc_t loc; /* Location to commit datatype */
H5T_t *dt; /* Datatype for ID */
- H5T_t *type; /* copy of the original type which will be committed */
+ H5T_t *type = NULL; /* copy of the original type which will be committed */
void *ret_value = NULL; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
@@ -1094,6 +1093,8 @@ H5VL_native_datatype_commit(void *obj, H5VL_loc_params_t loc_params, const char
ret_value = (void *)type;
done:
+ if(NULL == ret_value && type)
+ H5T_close(type);
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5VL_native_datatype_commit() */
@@ -1979,7 +1980,7 @@ H5VL_native_file_specific(void *obj, H5VL_file_specific_t specific_type, hid_t d
htri_t *ret = va_arg (arguments, htri_t *);
/* Call private routine */
- if((*ret = H5F_is_hdf5(name, fapl_id)) < 0)
+ if((*ret = H5F_is_hdf5(name, fapl_id, dxpl_id)) < 0)
HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "unable to open file")
break;
}
@@ -2048,7 +2049,7 @@ H5VL_native_file_optional(void *obj, hid_t dxpl_id, void H5_ATTR_UNUSED **req, v
f = (H5F_t *)obj;
/* Do the actual work */
- if((*ret = H5F_get_file_image(f, buf_ptr, buf_len)) < 0)
+ if((*ret = H5F_get_file_image(f, buf_ptr, buf_len, dxpl_id)) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "get file image failed")
break;
}
@@ -2098,16 +2099,16 @@ H5VL_native_file_optional(void *obj, hid_t dxpl_id, void H5_ATTR_UNUSED **req, v
HDmemset(finfo, 0, sizeof(*finfo));
/* Get the size of the superblock and any superblock extensions */
- if(H5F__super_size(f, H5AC_ind_dxpl_id, &finfo->super.super_size, &finfo->super.super_ext_size) < 0)
+ if(H5F__super_size(f, dxpl_id, &finfo->super.super_size, &finfo->super.super_ext_size) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "Unable to retrieve superblock sizes")
/* Get the size of any persistent free space */
- if(H5MF_get_freespace(f, H5AC_ind_dxpl_id, &finfo->free.tot_space, &finfo->free.meta_size) < 0)
+ if(H5MF_get_freespace(f, dxpl_id, &finfo->free.tot_space, &finfo->free.meta_size) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "Unable to retrieve free space information")
/* Check for SOHM info */
if(H5F_addr_defined(f->shared->sohm_addr))
- if(H5SM_ih_size(f, H5AC_ind_dxpl_id, &finfo->sohm.hdr_size, &finfo->sohm.msgs_info) < 0)
+ if(H5SM_ih_size(f, dxpl_id, &finfo->sohm.hdr_size, &finfo->sohm.msgs_info) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "Unable to retrieve SOHM index & heap storage info")
/* Set version # fields */
@@ -2190,6 +2191,7 @@ H5VL_native_file_optional(void *obj, hid_t dxpl_id, void H5_ATTR_UNUSED **req, v
if(NULL == (new_file = H5F_reopen(f)))
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to reopen file")
new_file->id_exists = TRUE;
+ new_file->extpath = H5MM_xstrdup(f->extpath);
*ret = (void *)new_file;
break;
@@ -2784,7 +2786,7 @@ H5VL_native_link_get(void *obj, H5VL_loc_params_t loc_params, H5VL_link_get_t ge
if(loc_params.type == H5VL_OBJECT_BY_NAME) { /* H5Lget_info */
if(H5L_get_info(&loc, loc_params.loc_data.loc_by_name.name, linfo,
loc_params.loc_data.loc_by_name.lapl_id, dxpl_id) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to get link info")
+ HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to get link info")
}
else if(loc_params.type == H5VL_OBJECT_BY_IDX) { /* H5Lget_info_by_idx */
H5L_trav_gibi_t udata; /* User data for callback */
@@ -2797,10 +2799,10 @@ H5VL_native_link_get(void *obj, H5VL_loc_params_t loc_params, H5VL_link_get_t ge
udata.linfo = linfo;
if(H5L_get_info_by_idx(&loc, loc_params.loc_data.loc_by_idx.name, &udata,
loc_params.loc_data.loc_by_idx.lapl_id, dxpl_id) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to get link info")
+ HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to get link info")
}
else
- HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to get link info")
+ HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to get link info")
break;
}
/* H5Lget_name_by_idx */
@@ -2823,7 +2825,7 @@ H5VL_native_link_get(void *obj, H5VL_loc_params_t loc_params, H5VL_link_get_t ge
/* Get the link name */
if(H5L_get_name_by_idx(&loc, loc_params.loc_data.loc_by_idx.name, &udata,
loc_params.loc_data.loc_by_idx.lapl_id, dxpl_id) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to get link info")
+ HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to get link info")
*ret = udata.name_len;
break;
@@ -2838,7 +2840,7 @@ H5VL_native_link_get(void *obj, H5VL_loc_params_t loc_params, H5VL_link_get_t ge
if(loc_params.type == H5VL_OBJECT_BY_NAME) { /* H5Lget_val */
if(H5L_get_val(&loc, loc_params.loc_data.loc_by_name.name, buf, size,
loc_params.loc_data.loc_by_name.lapl_id, dxpl_id) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to get link value")
+ HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to get link value")
}
else if(loc_params.type == H5VL_OBJECT_BY_IDX) { /* H5Lget_val_by_idx */
H5L_trav_gvbi_t udata; /* User data for callback */
@@ -2853,10 +2855,10 @@ H5VL_native_link_get(void *obj, H5VL_loc_params_t loc_params, H5VL_link_get_t ge
if(H5L_get_val_by_idx(&loc, loc_params.loc_data.loc_by_idx.name, &udata,
loc_params.loc_data.loc_by_idx.lapl_id, dxpl_id) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to get link val")
+ HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to get link val")
}
else
- HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to get link val")
+ HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to get link val")
break;
}
@@ -2902,7 +2904,7 @@ H5VL_native_link_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_link_spe
/* Check for the existence of the link */
if((*ret = H5L_exists(&loc, loc_params.loc_data.loc_by_name.name,
loc_params.loc_data.loc_by_name.lapl_id, dxpl_id)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to specific link info")
+ HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to specific link info")
break;
}
case H5VL_LINK_ITER:
@@ -2916,7 +2918,7 @@ H5VL_native_link_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_link_spe
if((ret_value = H5L_iterate(obj, loc_params, recursive, idx_type, order,
idx_p, op, op_data, dxpl_id)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "error iterating over links")
+ HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "error iterating over links")
break;
}
case H5VL_LINK_DELETE:
@@ -2993,7 +2995,7 @@ H5VL_native_object_open(void *obj, H5VL_loc_params_t loc_params, H5I_type_t *ope
{
/* Open the object */
if((temp_id = H5O_open_name(&loc, loc_params.loc_data.loc_by_name.name,
- loc_params.loc_data.loc_by_name.lapl_id, TRUE)) < 0)
+ loc_params.loc_data.loc_by_name.lapl_id, dxpl_id, TRUE)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, NULL, "unable to open object")
break;
}
@@ -3047,10 +3049,10 @@ H5VL_native_object_open(void *obj, H5VL_loc_params_t loc_params, H5I_type_t *ope
/* Create reference */
if((temp_id = H5R_dereference(file, loc_params.loc_data.loc_by_ref.lapl_id,
- dxpl_id,
- loc_params.loc_data.loc_by_ref.ref_type,
- loc_params.loc_data.loc_by_ref._ref,
- TRUE)) < 0)
+ dxpl_id,
+ loc_params.loc_data.loc_by_ref.ref_type,
+ loc_params.loc_data.loc_by_ref._ref,
+ TRUE)) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, NULL, "unable to dereference object")
break;
}
@@ -3088,7 +3090,7 @@ done:
static herr_t
H5VL_native_object_copy(void *src_obj, H5VL_loc_params_t loc_params1, const char *src_name,
void *dst_obj, H5VL_loc_params_t loc_params2, const char *dst_name,
- hid_t ocpypl_id, hid_t lcpl_id, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req)
+ hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id, void H5_ATTR_UNUSED **req)
{
H5G_loc_t src_loc; /* Source object group location */
H5G_loc_t dst_loc; /* Destination group location */
@@ -3103,7 +3105,7 @@ H5VL_native_object_copy(void *src_obj, H5VL_loc_params_t loc_params1, const char
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
/* Open the object */
- if((ret_value = H5O_copy(&src_loc, src_name, &dst_loc, dst_name, ocpypl_id, lcpl_id)) < 0)
+ if((ret_value = H5O_copy(&src_loc, src_name, &dst_loc, dst_name, ocpypl_id, lcpl_id, dxpl_id)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTCOPY, FAIL, "unable to copy object")
done:
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5VMprivate.h b/src/H5VMprivate.h
index 7d3361b..f402b36 100644
--- a/src/H5VMprivate.h
+++ b/src/H5VMprivate.h
@@ -49,6 +49,22 @@ typedef herr_t (*H5VM_opvv_func_t)(hsize_t dst_off, hsize_t src_off,
#define H5VM_vector_zero(N,DST) HDmemset(DST,0,(N)*sizeof(*(DST)))
+/* Given a coordinate offset array (COORDS) of type TYPE, move the unlimited
+ * dimension (UNLIM_DIM) value to offset 0, sliding any intermediate values down
+ * one position. */
+#define H5VM_swizzle_coords(TYPE,COORDS,UNLIM_DIM) { \
+ /* COORDS must be an array of type TYPE */ \
+ HDassert(sizeof(COORDS[0]) == sizeof(TYPE)); \
+ \
+ /* Nothing to do when unlimited dimension is at position 0 */ \
+ if(0 != (UNLIM_DIM)) { \
+ TYPE _tmp = (COORDS)[UNLIM_DIM]; \
+ \
+ HDmemmove(&(COORDS)[1], &(COORDS)[0], sizeof(TYPE) * (UNLIM_DIM)); \
+ (COORDS)[0] = _tmp; \
+ } /* end if */ \
+}
+
/* A null pointer is equivalent to a zero vector */
#define H5VM_ZERO NULL
diff --git a/src/H5Z.c b/src/H5Z.c
index 5c9a6a7..ded3e12 100644
--- a/src/H5Z.c
+++ b/src/H5Z.c
@@ -626,7 +626,7 @@ H5Z__flush_file_cb(void *obj_ptr, hid_t H5_ATTR_UNUSED obj_id, void H5_ATTR_UNUS
/* Call the flush routine for mounted file hierarchies. Do a global flush
* if the file is opened for write */
if(H5F_ACC_RDWR & H5F_INTENT((H5F_t *)obj_ptr)) {
- if(H5F_flush_mounts((H5F_t *)obj_ptr, H5AC_dxpl_id) < 0)
+ if(H5F_flush_mounts((H5F_t *)obj_ptr, H5AC_ind_read_dxpl_id) < 0)
HGOTO_ERROR(H5E_PLINE, H5E_CANTFLUSH, FAIL, "unable to flush file hierarchy")
} /* end if */
diff --git a/src/H5Zscaleoffset.c b/src/H5Zscaleoffset.c
index 0dc12a3..7c9dbf9 100644
--- a/src/H5Zscaleoffset.c
+++ b/src/H5Zscaleoffset.c
@@ -883,10 +883,8 @@ H5Z_set_local_scaleoffset(hid_t dcpl_id, hid_t type_id, hid_t space_id)
if(NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype")
-#ifdef H5_CLEAR_MEMORY
/* Initialize the parameters to a known state */
HDmemset(cd_values, 0, sizeof(cd_values));
-#endif /* H5_CLEAR_MEMORY */
/* Get the filter's current parameters */
if(H5P_get_filter_by_id(dcpl_plist, H5Z_FILTER_SCALEOFFSET, &flags, &cd_nelmts, cd_values, (size_t)0, NULL, NULL) < 0)
@@ -1005,7 +1003,7 @@ H5Z_set_local_scaleoffset(hid_t dcpl_id, hid_t type_id, hid_t space_id)
HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "cannot use C integer datatype for cast")
/* Get dataset fill value and store in cd_values[] */
- if(H5Z_scaleoffset_set_parms_fillval(dcpl_plist, type, scale_type, cd_values, need_convert, H5AC_ind_dxpl_id) < 0)
+ if(H5Z_scaleoffset_set_parms_fillval(dcpl_plist, type, scale_type, cd_values, need_convert, H5AC_noio_dxpl_id) < 0)
HGOTO_ERROR(H5E_PLINE, H5E_CANTSET, FAIL, "unable to set fill value")
} /* end else */
@@ -1266,13 +1264,11 @@ H5Z_filter_scaleoffset(unsigned flags, size_t cd_nelmts, const unsigned cd_value
for(i = 0; i < sizeof(unsigned long long); i++)
((unsigned char *)outbuf)[5+i] = (unsigned char)((minval & ((unsigned long long)0xff << i*8)) >> i*8);
-#ifdef H5_CLEAR_MEMORY
/* Zero out remaining, unused bytes */
/* (Looks like an error in the original determination of how many
* bytes would be needed for parameters. - QAK, 2010/08/19)
*/
HDmemset(outbuf + 13, 0, (size_t)8);
-#endif /* H5_CLEAR_MEMORY */
/* special case: minbits equal to full precision */
if(minbits == p.size * 8) {
diff --git a/src/H5Ztrans.c b/src/H5Ztrans.c
index 0a9a4da..2627a29 100644
--- a/src/H5Ztrans.c
+++ b/src/H5Ztrans.c
@@ -1032,7 +1032,7 @@ H5Z_xform_eval(H5Z_data_xform_t *data_xform_prop, void* array, size_t array_size
/* Free the temporary arrays we used */
if(data_xform_prop->dat_val_pointers->num_ptrs > 1)
for(i=0; i<data_xform_prop->dat_val_pointers->num_ptrs; i++)
- HDfree(data_xform_prop->dat_val_pointers->ptr_dat_val[i]);
+ H5MM_xfree(data_xform_prop->dat_val_pointers->ptr_dat_val[i]);
} /* end else */
done:
@@ -1042,7 +1042,7 @@ done:
if(data_xform_prop->dat_val_pointers->num_ptrs > 1)
for(i = 0; i < data_xform_prop->dat_val_pointers->num_ptrs; i++)
if(data_xform_prop->dat_val_pointers->ptr_dat_val[i])
- HDfree(data_xform_prop->dat_val_pointers->ptr_dat_val[i]);
+ H5MM_xfree(data_xform_prop->dat_val_pointers->ptr_dat_val[i]);
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5private.h b/src/H5private.h
index fa31fcc..a86cdcd 100644
--- a/src/H5private.h
+++ b/src/H5private.h
@@ -541,20 +541,21 @@
* It's the developer's responsibility not to pass in the value 0, which
* may cause the equation to fail.
*/
-#define H5_FLT_ABS_EQUAL(X,Y) (HDfabsf(X-Y) < FLT_EPSILON)
-#define H5_DBL_ABS_EQUAL(X,Y) (HDfabs (X-Y) < DBL_EPSILON)
-#define H5_LDBL_ABS_EQUAL(X,Y) (HDfabsl(X-Y) < LDBL_EPSILON)
+#define H5_FLT_ABS_EQUAL(X,Y) (HDfabsf((X)-(Y)) < FLT_EPSILON)
+#define H5_DBL_ABS_EQUAL(X,Y) (HDfabs ((X)-(Y)) < DBL_EPSILON)
+#define H5_LDBL_ABS_EQUAL(X,Y) (HDfabsl((X)-(Y)) < LDBL_EPSILON)
-#define H5_FLT_REL_EQUAL(X,Y,M) (HDfabsf((Y-X) / X) < M)
-#define H5_DBL_REL_EQUAL(X,Y,M) (HDfabs ((Y-X) / X) < M)
-#define H5_LDBL_REL_EQUAL(X,Y,M) (HDfabsl((Y-X) / X) < M)
+#define H5_FLT_REL_EQUAL(X,Y,M) (HDfabsf(((Y)-(X)) / (X)) < (M))
+#define H5_DBL_REL_EQUAL(X,Y,M) (HDfabs (((Y)-(X)) / (X)) < (M))
+#define H5_LDBL_REL_EQUAL(X,Y,M) (HDfabsl(((Y)-(X)) / (X)) < (M))
-/* KiB, MiB, GiB, TiB, EiB - Used in profiling and timing code */
+/* KiB, MiB, GiB, TiB, PiB, EiB - Used in profiling and timing code */
#define H5_KB (1024.0F)
#define H5_MB (1024.0F * 1024.0F)
#define H5_GB (1024.0F * 1024.0F * 1024.0F)
#define H5_TB (1024.0F * 1024.0F * 1024.0F * 1024.0F)
-#define H5_EB (1024.0F * 1024.0F * 1024.0F * 1024.0F * 1024.0F)
+#define H5_PB (1024.0F * 1024.0F * 1024.0F * 1024.0F * 1024.0F)
+#define H5_EB (1024.0F * 1024.0F * 1024.0F * 1024.0F * 1024.0F * 1024.0F)
#ifndef H5_HAVE_FLOCK
/* flock() operations. Used in the source so we have to define them when
@@ -873,58 +874,37 @@ H5_DLL int HDfprintf (FILE *stream, const char *fmt, ...);
#endif /* HDfrexpl */
/* fscanf() variable arguments */
#ifndef HDfseek
- #ifdef H5_HAVE_FSEEKO
- #define HDfseek(F,O,W) fseeko(F,O,W)
- #else /* H5_HAVE_FSEEKO */
- #define HDfseek(F,O,W) fseek(F,O,W)
- #endif /* H5_HAVE_FSEEKO */
+ #define HDfseek(F,O,W) fseeko(F,O,W)
#endif /* HDfseek */
#ifndef HDfsetpos
#define HDfsetpos(F,P) fsetpos(F,P)
#endif /* HDfsetpos */
-/* definitions related to the file stat utilities.
- * For Unix, if off_t is not 64bit big, try use the pseudo-standard
- * xxx64 versions if available.
+#ifndef HDfstat
+ #define HDfstat(F,B) fstat(F,B)
+#endif /* HDfstat */
+#ifndef HDlstat
+ #define HDlstat(S,B) lstat(S,B)
+#endif /* HDlstat */
+#ifndef HDstat
+ #define HDstat(S,B) stat(S,B)
+#endif /* HDstat */
+
+#ifndef H5_HAVE_WIN32_API
+/* These definitions differ in Windows and are defined in
+ * H5win32defs for that platform.
*/
-#if !defined(HDfstat) || !defined(HDstat) || !defined(HDlstat)
- #if H5_SIZEOF_OFF_T!=8 && H5_SIZEOF_OFF64_T==8 && defined(H5_HAVE_STAT64)
- #ifndef HDfstat
- #define HDfstat(F,B) fstat64(F,B)
- #endif /* HDfstat */
- #ifndef HDlstat
- #define HDlstat(S,B) lstat64(S,B)
- #endif /* HDlstat */
- #ifndef HDstat
- #define HDstat(S,B) stat64(S,B)
- #endif /* HDstat */
- typedef struct stat64 h5_stat_t;
- typedef off64_t h5_stat_size_t;
- #define H5_SIZEOF_H5_STAT_SIZE_T H5_SIZEOF_OFF64_T
- #else /* H5_SIZEOF_OFF_T!=8 && ... */
- #ifndef HDfstat
- #define HDfstat(F,B) fstat(F,B)
- #endif /* HDfstat */
- #ifndef HDlstat
- #define HDlstat(S,B) lstat(S,B)
- #endif /* HDlstat */
- #ifndef HDstat
- #define HDstat(S,B) stat(S,B)
- #endif /* HDstat */
- typedef struct stat h5_stat_t;
- typedef off_t h5_stat_size_t;
- #define H5_SIZEOF_H5_STAT_SIZE_T H5_SIZEOF_OFF_T
- #endif /* H5_SIZEOF_OFF_T!=8 && ... */
-#endif /* !defined(HDfstat) || !defined(HDstat) */
+typedef struct stat h5_stat_t;
+typedef off_t h5_stat_size_t;
+#define HDoff_t off_t
+#endif /* H5_HAVE_WIN32_API */
+
+#define H5_SIZEOF_H5_STAT_SIZE_T H5_SIZEOF_OFF_T
#ifndef HDftell
- #define HDftell(F) ftell(F)
+ #define HDftell(F) ftello(F)
#endif /* HDftell */
#ifndef HDftruncate
- #ifdef H5_HAVE_FTRUNCATE64
- #define HDftruncate(F,L) ftruncate64(F,L)
- #else
#define HDftruncate(F,L) ftruncate(F,L)
- #endif
#endif /* HDftruncate */
#ifndef HDfwrite
#define HDfwrite(M,Z,N,F) fwrite(M,Z,N,F)
@@ -1067,15 +1047,8 @@ H5_DLL int HDfprintf (FILE *stream, const char *fmt, ...);
#ifndef HDlongjmp
#define HDlongjmp(J,N) longjmp(J,N)
#endif /* HDlongjmp */
-/* HDlseek and HDoff_t must be defined together for consistency. */
#ifndef HDlseek
- #ifdef H5_HAVE_LSEEK64
- #define HDlseek(F,O,W) lseek64(F,O,W)
- #define HDoff_t off64_t
- #else
- #define HDlseek(F,O,W) lseek(F,O,W)
- #define HDoff_t off_t
- #endif
+ #define HDlseek(F,O,W) lseek(F,O,W)
#endif /* HDlseek */
#ifndef HDmalloc
#define HDmalloc(Z) malloc(Z)
@@ -1220,6 +1193,9 @@ H5_DLL int HDfprintf (FILE *stream, const char *fmt, ...);
#ifndef HDsetbuf
#define HDsetbuf(F,S) setbuf(F,S)
#endif /* HDsetbuf */
+#ifndef HDsetenv
+ #define HDsetenv(N,V,O) setenv(N,V,O)
+#endif /* HDsetenv */
#ifndef HDsetgid
#define HDsetgid(G) setgid(G)
#endif /* HDsetgid */
@@ -1286,7 +1262,9 @@ H5_DLL int HDfprintf (FILE *stream, const char *fmt, ...);
#ifndef HDsnprintf
#define HDsnprintf snprintf /*varargs*/
#endif /* HDsnprintf */
-/* sprintf() variable arguments */
+#ifndef HDsprintf
+ #define HDsprintf sprintf /*varargs*/
+#endif /* HDsprintf */
#ifndef HDsqrt
#define HDsqrt(X) sqrt(X)
#endif /* HDsqrt */
@@ -1703,6 +1681,10 @@ typedef struct H5_debug_t {
H5_debug_open_stream_t *open_stream; /* Stack of open output streams */
} H5_debug_t;
+#ifdef H5_HAVE_PARALLEL
+extern hbool_t H5_coll_api_sanity_check_g;
+#endif /* H5_HAVE_PARALLEL */
+
extern H5_debug_t H5_debug_g;
#define H5DEBUG(X) (H5_debug_g.pkg[H5_PKG_##X].stream)
/* Do not use const else AIX strings does not show it. */
@@ -2592,7 +2574,8 @@ H5_DLL uint32_t H5_hash_string(const char *str);
H5_DLL time_t H5_make_time(struct tm *tm);
/* Functions for building paths, etc. */
-H5_DLL herr_t H5_build_extpath(const char *, char ** /*out*/ );
+H5_DLL herr_t H5_build_extpath(const char *name, char **extpath /*out*/);
+H5_DLL herr_t H5_combine_path(const char *path1, const char *path2, char **full_name /*out*/);
/* Functions for debugging */
H5_DLL herr_t H5_buffer_dump(FILE *stream, int indent, const uint8_t *buf,
diff --git a/src/H5public.h b/src/H5public.h
index 5b95fb7..554ad26 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 233 /* For tweaks, bug-fixes, or development */
+#define H5_VERS_RELEASE 234 /* 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.233" /* Full version string */
+#define H5_VERS_INFO "HDF5 library version: 1.9.234" /* Full version string */
#define H5check() H5check_version(H5_VERS_MAJOR,H5_VERS_MINOR, \
H5_VERS_RELEASE)
diff --git a/src/H5system.c b/src/H5system.c
index 4baebc5..e6ca5d4 100644
--- a/src/H5system.c
+++ b/src/H5system.c
@@ -728,7 +728,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5_make_time() */
-#ifdef H5_HAVE_VISUAL_STUDIO
+#ifdef H5_HAVE_WIN32_API
/* Offset between 1/1/1601 and 1/1/1970 in 100 nanosecond units */
#define _W32_FT_OFFSET (116444736000000000ULL)
@@ -757,7 +757,7 @@ done:
*/
int
Wgettimeofday(struct timeval *tv, struct timezone *tz)
- {
+{
union {
unsigned long long ns100; /*time since 1 Jan 1601 in 100ns units */
FILETIME ft;
@@ -783,7 +783,42 @@ Wgettimeofday(struct timeval *tv, struct timezone *tz)
/* Always return 0 as per Open Group Base Specifications Issue 6.
Do not set errno on error. */
return 0;
-}
+} /* end Wgettimeofday() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: Wsetenv
+ *
+ * Purpose: Wrapper function for setenv on Windows systems.
+ * Interestingly, getenv *is* available in the Windows
+ * POSIX layer, just not setenv.
+ *
+ * Return: Success: 0
+ * Failure: non-zero error code
+ *
+ * Programmer: Dana Robinson
+ * February 2016
+ *
+ *-------------------------------------------------------------------------
+ */
+int
+Wsetenv(const char *name, const char *value, int overwrite)
+{
+ size_t bufsize;
+ errno_t err;
+
+ /* If we're not overwriting, check if the environment variable exists.
+ * If it does (i.e.: the required buffer size to store the variable's
+ * value is non-zero), then return an error code.
+ */
+ if(!overwrite) {
+ err = getenv_s(&bufsize, NULL, 0, name);
+ if (err || bufsize)
+ return (int)err;
+ } /* end if */
+
+ return (int)_putenv_s(name, value);
+} /* end Wsetenv() */
#ifdef H5_HAVE_WINSOCK2_H
#pragma comment(lib, "advapi32.lib")
@@ -877,30 +912,29 @@ Wflock(int fd, int operation) {
return 0;
} /* end Wflock() */
-#endif /* H5_HAVE_VISUAL_STUDIO */
+#endif /* H5_HAVE_WIN32_API */
/*-------------------------------------------------------------------------
- * Function: H5_build_extpath
+ * Function: H5_build_extpath
*
- * Purpose: To build the path for later searching of target file for external
- * link. This path can be either:
+ * Purpose: To build the path for later searching of target file for external
+ * links and external files. This path can be either:
* 1. The absolute path of NAME
* or
* 2. The current working directory + relative path of NAME
*
- * Return: Success: 0
- * Failure: -1
+ * Return: SUCCEED/FAIL
*
* Programmer: Vailin Choi
- * April 2, 2008
+ * April 2, 2008
*
*-------------------------------------------------------------------------
*/
#define MAX_PATH_LEN 1024
herr_t
-H5_build_extpath(const char *name, char **extpath/*out*/)
+H5_build_extpath(const char *name, char **extpath /*out*/)
{
char *full_path = NULL; /* Pointer to the full path, as built or passed in */
char *cwdpath = NULL; /* Pointer to the current working directory path */
@@ -998,5 +1032,80 @@ done:
H5MM_xfree(new_name);
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5_build_extpath() */
+} /* end H5_build_extpath() */
+
+
+/*--------------------------------------------------------------------------
+ * Function: H5_combine_path
+ *
+ * Purpose: If path2 is relative, interpret path2 as relative to path1
+ * and store the result in full_name. Otherwise store path2
+ * in full_name.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Steffen Kiess
+ * June 22, 2015
+ *--------------------------------------------------------------------------
+ */
+herr_t
+H5_combine_path(const char* path1, const char* path2, char **full_name /*out*/)
+{
+ size_t path1_len; /* length of path1 */
+ size_t path2_len; /* length of path2 */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+ HDassert(path1);
+ HDassert(path2);
+
+ path1_len = HDstrlen(path1);
+ path2_len = HDstrlen(path2);
+
+ if(*path1 == '\0' || H5_CHECK_ABSOLUTE(path2)) {
+
+ /* If path1 is empty or path2 is absolute, simply use path2 */
+ if(NULL == (*full_name = (char *)H5MM_strdup(path2)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
+
+ } /* end if */
+ else if(H5_CHECK_ABS_PATH(path2)) {
+
+ /* On windows path2 is a path absolute name */
+ if (H5_CHECK_ABSOLUTE(path1) || H5_CHECK_ABS_DRIVE(path1)) {
+ /* path1 is absolute or drive absolute and path2 is path absolute.
+ * Use the drive letter of path1 + path2
+ */
+ if(NULL == (*full_name = (char *)H5MM_malloc(path2_len + 3)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate path2 buffer")
+ HDsnprintf(*full_name, (path2_len + 3), "%c:%s", path1[0], path2);
+ } /* end if */
+ else {
+ /* On windows path2 is path absolute name ("\foo\bar"),
+ * path1 does not have a drive letter (i.e. is "a\b" or "\a\b").
+ * Use path2.
+ */
+ if(NULL == (*full_name = (char *)H5MM_strdup(path2)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
+ } /* end else */
+
+ } /* end else if */
+ else {
+
+ /* Relative path2:
+ * Allocate a buffer to hold path1 + path2 + possibly the delimiter
+ * + terminating null byte
+ */
+ if(NULL == (*full_name = (char *)H5MM_malloc(path1_len + path2_len + 2)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate filename buffer")
+
+ /* Compose the full file name */
+ HDsnprintf(*full_name, (path1_len + path2_len + 2), "%s%s%s", path1,
+ (H5_CHECK_DELIMITER(path1[path1_len - 1]) ? "" : H5_DIR_SEPS), path2);
+ } /* end else */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5_combine_name() */
diff --git a/src/H5timer.c b/src/H5timer.c
index 94f2883..d9be6bb 100644
--- a/src/H5timer.c
+++ b/src/H5timer.c
@@ -228,7 +228,7 @@ H5_bandwidth(char *buf/*out*/, double nbytes, double nseconds)
} else if(bw < H5_TB) {
sprintf(buf, "%05.4f", bw / H5_GB);
HDstrcpy(buf+5, " GB/s");
- } else if(bw < H5_EB) {
+ } else if(bw < H5_PB) {
sprintf(buf, "%05.4f", bw / H5_TB);
HDstrcpy(buf+5, " TB/s");
} else {
diff --git a/src/H5trace.c b/src/H5trace.c
index d7e3a02..90fed85 100644
--- a/src/H5trace.c
+++ b/src/H5trace.c
@@ -495,6 +495,44 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
} /* end else */
break;
+ case 'k':
+ if(ptr) {
+ if(vp)
+ fprintf(out, "0x%lx", (unsigned long)vp);
+ else
+ fprintf(out, "NULL");
+ } /* end if */
+ else {
+ H5D_chunk_index_t idx = (H5D_chunk_index_t)va_arg(ap, int);
+
+ switch(idx) {
+ case H5D_CHUNK_IDX_BTREE:
+ fprintf(out, "H5D_CHUNK_IDX_BTREE");
+ break;
+
+ case H5D_CHUNK_IDX_FARRAY:
+ fprintf(out, "H5D_CHUNK_IDX_FARRAY");
+ break;
+
+ case H5D_CHUNK_IDX_EARRAY:
+ fprintf(out, "H5D_CHUNK_IDX_EARRAY");
+ break;
+
+ case H5D_CHUNK_IDX_BT2:
+ fprintf(out, "H5D_CHUNK_IDX_BT2");
+ break;
+
+ case H5D_CHUNK_IDX_NTYPES:
+ fprintf(out, "ERROR: H5D_CHUNK_IDX_NTYPES (invalid value)");
+ break;
+
+ default:
+ fprintf(out, "UNKNOWN VALUE: %ld", (long)idx);
+ break;
+ } /* end switch */
+ } /* end else */
+ break;
+
case 'l':
if(ptr) {
if(vp)
diff --git a/src/H5win32defs.h b/src/H5win32defs.h
index e84def9..a757832 100644
--- a/src/H5win32defs.h
+++ b/src/H5win32defs.h
@@ -65,29 +65,32 @@ typedef __int64 h5_stat_size_t;
*/
#define HDmemset(X,C,Z) memset((void*)(X),C,Z)
+#endif /* H5_HAVE_VISUAL_STUDIO */
+
struct timezone {
int tz_minuteswest;
int tz_dsttime;
};
#ifdef __cplusplus
- extern "C" {
+extern "C" {
#endif /* __cplusplus */
- H5_DLL int Wgettimeofday(struct timeval *tv, struct timezone *tz);
- H5_DLL int Wflock(int fd, int operation);
- H5_DLL char* Wgetlogin(void);
- H5_DLL int c99_snprintf(char* str, size_t size, const char* format, ...);
- H5_DLL int c99_vsnprintf(char* str, size_t size, const char* format, va_list ap);
+ H5_DLL int Wgettimeofday(struct timeval *tv, struct timezone *tz);
+ H5_DLL int Wsetenv(const char *name, const char *value, int overwrite);
+ H5_DLL int Wflock(int fd, int operation);
+ H5_DLL char* Wgetlogin(void);
+ H5_DLL int c99_snprintf(char* str, size_t size, const char* format, ...);
+ H5_DLL int c99_vsnprintf(char* str, size_t size, const char* format, va_list ap);
#ifdef __cplusplus
- }
+}
#endif /* __cplusplus */
+
#define HDgettimeofday(V,Z) Wgettimeofday(V,Z)
+#define HDsetenv(N,V,O) Wsetenv(N,V,O)
#define HDflock(F,L) Wflock(F,L)
#define HDgetlogin() Wgetlogin()
#define HDsnprintf c99_snprintf /*varargs*/
-#define HDvsnprintf c99_vsnprintf
-
-#endif /* H5_HAVE_VISUAL_STUDIO */
+#define HDvsnprintf c99_vsnprintf /*varargs*/
/* Non-POSIX functions */
@@ -98,5 +101,7 @@ struct timezone {
#ifndef H5_HAVE_MINGW
#define HDftruncate(F,L) _chsize_s(F,L)
#define HDfseek(F,O,W) _fseeki64(F,O,W)
-#endif
+#endif /* H5_HAVE_MINGW */
+
#endif /* H5_HAVE_WIN32_API */
+
diff --git a/src/Makefile.am b/src/Makefile.am
index 9680923..38a06dd 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -47,8 +47,8 @@ libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \
H5B2.c H5B2cache.c H5B2dbg.c H5B2hdr.c H5B2int.c H5B2stat.c H5B2test.c \
H5C.c \
H5CS.c \
- H5D.c H5Dbtree.c H5Dchunk.c H5Dcompact.c H5Dcontig.c H5Ddbg.c \
- H5Ddeprec.c H5Defl.c H5Dfill.c H5Dint.c \
+ H5D.c H5Dbtree.c H5Dbtree2.c H5Dchunk.c H5Dcompact.c H5Dcontig.c H5Ddbg.c \
+ H5Ddeprec.c H5Dearray.c H5Defl.c H5Dfarray.c H5Dfill.c H5Dint.c \
H5Dio.c H5Dlayout.c \
H5Doh.c H5Dscatgath.c H5Dselect.c H5Dtest.c H5Dvirtual.c \
H5E.c H5Edeprec.c H5Eint.c \
@@ -85,8 +85,10 @@ libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \
H5Olayout.c \
H5Olinfo.c H5Olink.c H5Omessage.c H5Omtime.c \
H5Oname.c H5Onull.c H5Opline.c H5Orefcount.c \
- H5Osdspace.c H5Oshared.c H5Ostab.c \
- H5Oshmesg.c H5Otest.c H5Ounknown.c \
+ H5Osdspace.c H5Oshared.c \
+ H5Oshmesg.c \
+ H5Ostab.c \
+ H5Otest.c H5Ounknown.c \
H5P.c H5Pacpl.c H5Pdapl.c H5Pdcpl.c \
H5Pdeprec.c H5Pdxpl.c H5Pencdec.c \
H5Pfapl.c H5Pfcpl.c H5Pfmpl.c \
@@ -127,7 +129,7 @@ include_HEADERS = hdf5.h H5api_adpt.h H5overflow.h H5pubconf.h H5public.h H5vers
H5Cpublic.h H5Dpublic.h \
H5Epubgen.h H5Epublic.h H5ESpublic.h H5Fpublic.h \
H5FDpublic.h H5FDcore.h H5FDdirect.h \
- H5FDfamily.h H5FDlog.h H5FDmpi.h H5FDmpio.h \
+ H5FDfamily.h H5FDlog.h H5FDmpi.h H5FDmpio.h \
H5FDmulti.h H5FDsec2.h H5FDstdio.h \
H5VLpublic.h H5VLnative.h \
H5Gpublic.h H5Ipublic.h H5Lpublic.h \
diff --git a/src/libhdf5.settings.in b/src/libhdf5.settings.in
index 2355543..8017594 100644
--- a/src/libhdf5.settings.in
+++ b/src/libhdf5.settings.in
@@ -3,40 +3,47 @@
General Information:
-------------------
- HDF5 Version: @H5_VERSION@
- Configured on: @CONFIG_DATE@
- Configured by: @CONFIG_USER@
- Configure mode: @CONFIG_MODE@
- Host system: @host_cpu@-@host_vendor@-@host_os@
- Uname information: @UNAME_INFO@
- Byte sex: @BYTESEX@
- Libraries: @STATIC_SHARED@
- Installation point: @prefix@
+ HDF5 Version: @H5_VERSION@
+ Configured on: @CONFIG_DATE@
+ Configured by: @CONFIG_USER@
+ Host system: @host_cpu@-@host_vendor@-@host_os@
+ Uname information: @UNAME_INFO@
+ Byte sex: @BYTESEX@
+ Installation point: @prefix@
Compiling Options:
------------------
- Compilation Mode: @CONFIG_MODE@
- C Compiler: @CC_VERSION@
- CFLAGS: @CFLAGS@
- H5_CFLAGS: @H5_CFLAGS@
- AM_CFLAGS: @AM_CFLAGS@
- CPPFLAGS: @CPPFLAGS@
- H5_CPPFLAGS: @H5_CPPFLAGS@
- AM_CPPFLAGS: @AM_CPPFLAGS@
- Shared C Library: @enable_shared@
- Static C Library: @enable_static@
+ Build Mode: @BUILD_MODE@
+ Debugging Symbols: @SYMBOLS@
+ Asserts: @ASSERTS@
+ Profiling: @PROFILING@
+ Optimization Level: @OPTIMIZATION@
+
+Linking Options:
+----------------
+ Libraries: @STATIC_SHARED@
Statically Linked Executables: @LT_STATIC_EXEC@
LDFLAGS: @LDFLAGS@
H5_LDFLAGS: @H5_LDFLAGS@
AM_LDFLAGS: @AM_LDFLAGS@
- Extra libraries: @LIBS@
- Archiver: @AR@
- Ranlib: @RANLIB@
- Debugged Packages: @DEBUG_PKG@
- API Tracing: @TRACE_API@
+ Extra libraries: @LIBS@
+ Archiver: @AR@
+ Ranlib: @RANLIB@
Languages:
----------
+ C: yes
+ C Compiler: @CC_VERSION@
+ CPPFLAGS: @CPPFLAGS@
+ H5_CPPFLAGS: @H5_CPPFLAGS@
+ AM_CPPFLAGS: @AM_CPPFLAGS@
+ C Flags: @CFLAGS@
+ H5 C Flags: @H5_CFLAGS@
+ AM C Flags: @AM_CFLAGS@
+ Shared C Library: @enable_shared@
+ Static C Library: @enable_static@
+
+
Fortran: @HDF_FORTRAN@
@BUILD_FORTRAN_CONDITIONAL_TRUE@ Fortran Compiler: @FC_VERSION@
@BUILD_FORTRAN_CONDITIONAL_TRUE@ Fortran Flags: @FCFLAGS@
@@ -53,19 +60,26 @@ Languages:
@BUILD_CXX_CONDITIONAL_TRUE@ Shared C++ Library: @enable_shared@
@BUILD_CXX_CONDITIONAL_TRUE@ Static C++ Library: @enable_static@
+ Java: @HDF_JAVA@
+@BUILD_JAVA_CONDITIONAL_TRUE@ Java Compiler: @JAVA_VERSION@
+
+
Features:
---------
Parallel HDF5: @PARALLEL@
- High Level library: @HDF5_HL@
+ High-level library: @HDF5_HL@
Threadsafety: @THREADSAFE@
- Default API Mapping: @DEFAULT_API_VERSION@
- With Deprecated Public Symbols: @DEPRECATED_SYMBOLS@
+ Default API mapping: @DEFAULT_API_VERSION@
+ With deprecated public symbols: @DEPRECATED_SYMBOLS@
I/O filters (external): @EXTERNAL_FILTERS@
MPE: @MPE@
Direct VFD: @DIRECT_VFD@
dmalloc: @HAVE_DMALLOC@
-Clear file buffers before write: @CLEARFILEBUF@
+ Packages w/ extra debug output: @INTERNAL_DEBUG_OUTPUT@
+ API tracing: @TRACE_API@
Using memory checker: @USINGMEMCHECKER@
- Function Stack Tracing: @CODESTACK@
- Strict File Format Checks: @STRICT_FORMAT_CHECKS@
- Optimization Instrumentation: @INSTRUMENT@
+Memory allocation sanity checks: @MEMORYALLOCSANITYCHECK@
+ Metadata trace file: @METADATATRACEFILE@
+ Function stack tracing: @CODESTACK@
+ Strict file format checks: @STRICT_FORMAT_CHECKS@
+ Optimization instrumentation: @INSTRUMENT_LIBRARY@