summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDana Robinson <derobins@hdfgroup.org>2020-06-22 12:31:08 (GMT)
committerDana Robinson <derobins@hdfgroup.org>2020-06-22 12:31:08 (GMT)
commitcafb6e572822c0a7bb985f237b600944f9fcdb3c (patch)
tree4e528337878a2ddf67a1ff92c1190e1174bfa838
parent8e62f1fe7b38b630f1a41007a03341cb66dec4b3 (diff)
parent3c9eaf294fb1862af75837f0150990112c735530 (diff)
downloadhdf5-cafb6e572822c0a7bb985f237b600944f9fcdb3c.zip
hdf5-cafb6e572822c0a7bb985f237b600944f9fcdb3c.tar.gz
hdf5-cafb6e572822c0a7bb985f237b600944f9fcdb3c.tar.bz2
Merge pull request #2658 in HDFFV/hdf5 from ~DEROBINS/hdf5_der:1_10_normalization to hdf5_1_10
* commit '3c9eaf294fb1862af75837f0150990112c735530': Reduce overhead for H5open, which is involved in the public symbols like H5T_NATIVE_INT, etc. H5PB and H5Faccum normalization with develop. H5F normalizations with develop.
-rw-r--r--src/H5.c8
-rw-r--r--src/H5F.c67
-rw-r--r--src/H5Faccum.c73
-rw-r--r--src/H5Fint.c81
-rw-r--r--src/H5Fio.c6
-rw-r--r--src/H5Fpkg.h22
-rw-r--r--src/H5Fprivate.h16
-rw-r--r--src/H5Fquery.c69
-rw-r--r--src/H5Fsfile.c26
-rw-r--r--src/H5MF.c16
-rw-r--r--src/H5MFsection.c2
-rw-r--r--src/H5PB.c135
-rw-r--r--src/H5PBprivate.h16
-rw-r--r--src/H5private.h29
-rw-r--r--test/accum.c6
-rw-r--r--test/mount.c54
16 files changed, 367 insertions, 259 deletions
diff --git a/src/H5.c b/src/H5.c
index cf1ad6b..ed09c7c 100644
--- a/src/H5.c
+++ b/src/H5.c
@@ -846,11 +846,13 @@ H5open(void)
{
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_API_NOCLEAR(FAIL)
- H5TRACE0("e","");
+ FUNC_ENTER_API_NOPUSH(FAIL)
+ /*NO TRACE*/
+
/* all work is done by FUNC_ENTER() */
+
done:
- FUNC_LEAVE_API(ret_value)
+ FUNC_LEAVE_API_NOPUSH(ret_value)
} /* end H5open() */
diff --git a/src/H5F.c b/src/H5F.c
index b04db89..83ce5f6 100644
--- a/src/H5F.c
+++ b/src/H5F.c
@@ -21,20 +21,20 @@
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5Aprivate.h" /* Attributes */
-#include "H5ACprivate.h" /* Metadata cache */
-#include "H5CXprivate.h" /* API Contexts */
-#include "H5Dprivate.h" /* Datasets */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5Fpkg.h" /* File access */
-#include "H5FDprivate.h" /* File drivers */
-#include "H5Gprivate.h" /* Groups */
-#include "H5Iprivate.h" /* IDs */
-#include "H5MFprivate.h" /* File memory management */
-#include "H5MMprivate.h" /* Memory management */
-#include "H5Pprivate.h" /* Property lists */
-#include "H5Tprivate.h" /* Datatypes */
+#include "H5private.h" /* Generic Functions */
+#include "H5Aprivate.h" /* Attributes */
+#include "H5ACprivate.h" /* Metadata cache */
+#include "H5CXprivate.h" /* API Contexts */
+#include "H5Dprivate.h" /* Datasets */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Fpkg.h" /* File access */
+#include "H5FDprivate.h" /* File drivers */
+#include "H5Gprivate.h" /* Groups */
+#include "H5Iprivate.h" /* IDs */
+#include "H5MFprivate.h" /* File memory management */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5Pprivate.h" /* Property lists */
+#include "H5Tprivate.h" /* Datatypes */
/****************/
@@ -76,10 +76,10 @@ hbool_t H5_PKG_INIT_VAR = FALSE;
/* File ID class */
static const H5I_class_t H5I_FILE_CLS[1] = {{
- H5I_FILE, /* ID class value */
- 0, /* Class flags */
- 0, /* # of reserved IDs for class */
- (H5I_free_t)H5F__close_cb /* Callback routine for closing objects of this class */
+ H5I_FILE, /* ID class value */
+ 0, /* Class flags */
+ 0, /* # of reserved IDs for class */
+ (H5I_free_t)H5F__close_cb /* Callback routine for closing objects of this class */
}};
@@ -1492,38 +1492,39 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Fformat_convert
+ * Function: H5Fformat_convert (Internal)
*
- * Purpose: Downgrade the superblock version to v2 and
- * downgrade persistent file space to non-persistent
- * for 1.8 library.
+ * Purpose: Downgrade the superblock version to v2 and
+ * downgrade persistent file space to non-persistent
+ * for 1.8 library.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*-------------------------------------------------------------------------
*/
herr_t
-H5Fformat_convert(hid_t fid)
+H5Fformat_convert(hid_t file_id)
{
H5F_t *f; /* File to flush */
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE1("e", "i", fid);
+ H5TRACE1("e", "i", file_id);
- if(H5I_FILE != H5I_get_type(fid))
+ /* Check args */
+ if(H5I_FILE != H5I_get_type(file_id))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
/* Get file object */
- if(NULL == (f = (H5F_t *)H5I_object(fid)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier")
+ if(NULL == (f = (H5F_t *)H5I_object(file_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "file_id parameter is not a valid file identifier")
/* Set up collective metadata if appropriate */
- if(H5CX_set_loc(fid) < 0)
+ if(H5CX_set_loc(file_id) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set collective metadata read info")
- /* Call the internal routine */
+ /* Convert the format */
if(H5F__format_convert(f) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTCONVERT, FAIL, "unable to convert file format")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTCONVERT, FAIL, "can't convert file format")
done:
FUNC_LEAVE_API(ret_value)
@@ -1556,7 +1557,7 @@ H5Freset_page_buffering_stats(hid_t file_id)
/* Reset the statistics */
if(H5PB_reset_stats(file->shared->page_buf) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't reset stats for page buffering")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't reset stats for page buffering")
done:
FUNC_LEAVE_API(ret_value)
diff --git a/src/H5Faccum.c b/src/H5Faccum.c
index 8d7852b..74a170b 100644
--- a/src/H5Faccum.c
+++ b/src/H5Faccum.c
@@ -111,7 +111,7 @@ H5FL_BLK_DEFINE_STATIC(meta_accum);
*-------------------------------------------------------------------------
*/
herr_t
-H5F__accum_read(H5F_t *f, H5FD_mem_t map_type, haddr_t addr,
+H5F__accum_read(H5F_shared_t *f_sh, H5FD_mem_t map_type, haddr_t addr,
size_t size, void *buf/*out*/)
{
H5FD_t *file; /* File driver pointer */
@@ -120,18 +120,18 @@ H5F__accum_read(H5F_t *f, H5FD_mem_t map_type, haddr_t addr,
FUNC_ENTER_PACKAGE
/* Sanity checks */
- HDassert(f);
+ HDassert(f_sh);
HDassert(buf);
/* Translate to file driver I/O info object */
- file = f->shared->lf;
+ file = f_sh->lf;
/* Check if this information is in the metadata accumulator */
- if((f->shared->feature_flags & H5FD_FEAT_ACCUMULATE_METADATA) && map_type != H5FD_MEM_DRAW) {
+ if((f_sh->feature_flags & H5FD_FEAT_ACCUMULATE_METADATA) && map_type != H5FD_MEM_DRAW) {
H5F_meta_accum_t *accum; /* Alias for file's metadata accumulator */
/* Set up alias for file's metadata accumulator info */
- accum = &f->shared->accum;
+ accum = &f_sh->accum;
if(size < H5F_ACCUM_MAX_SIZE) {
/* Sanity check */
@@ -419,7 +419,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5F__accum_write(H5F_t *f, H5FD_mem_t map_type, haddr_t addr,
+H5F__accum_write(H5F_shared_t *f_sh, H5FD_mem_t map_type, haddr_t addr,
size_t size, const void *buf)
{
H5FD_t *file; /* File driver pointer */
@@ -428,19 +428,19 @@ H5F__accum_write(H5F_t *f, H5FD_mem_t map_type, haddr_t addr,
FUNC_ENTER_NOAPI(FAIL)
/* Sanity checks */
- HDassert(f);
- HDassert(H5F_INTENT(f) & H5F_ACC_RDWR);
+ HDassert(f_sh);
+ HDassert(H5F_SHARED_INTENT(f_sh) & H5F_ACC_RDWR);
HDassert(buf);
/* Translate to file driver pointer */
- file = f->shared->lf;
+ file = f_sh->lf;
/* Check for accumulating metadata */
- if((f->shared->feature_flags & H5FD_FEAT_ACCUMULATE_METADATA) && map_type != H5FD_MEM_DRAW) {
+ if((f_sh->feature_flags & H5FD_FEAT_ACCUMULATE_METADATA) && map_type != H5FD_MEM_DRAW) {
H5F_meta_accum_t *accum; /* Alias for file's metadata accumulator */
/* Set up alias for file's metadata accumulator info */
- accum = &f->shared->accum;
+ accum = &f_sh->accum;
if(size < H5F_ACCUM_MAX_SIZE) {
/* Sanity check */
@@ -732,9 +732,9 @@ H5F__accum_write(H5F_t *f, H5FD_mem_t map_type, haddr_t addr,
} /* end if */
else {
/* Make certain that data in accumulator is visible before new write */
- if((H5F_INTENT(f) & H5F_ACC_SWMR_WRITE) > 0)
+ if((H5F_SHARED_INTENT(f_sh) & H5F_ACC_SWMR_WRITE) > 0)
/* Flush if dirty and reset accumulator */
- if(H5F__accum_reset(f, TRUE) < 0)
+ if(H5F__accum_reset(f_sh, TRUE) < 0)
HGOTO_ERROR(H5E_IO, H5E_CANTRESET, FAIL, "can't reset accumulator")
/* Write the data */
@@ -783,7 +783,7 @@ H5F__accum_write(H5F_t *f, H5FD_mem_t map_type, haddr_t addr,
} /* end if */
else { /* Access covers whole accumulator */
/* Reset accumulator, but don't flush */
- if(H5F__accum_reset(f, FALSE) < 0)
+ if(H5F__accum_reset(f_sh, FALSE) < 0)
HGOTO_ERROR(H5E_IO, H5E_CANTRESET, FAIL, "can't reset accumulator")
} /* end else */
} /* end if */
@@ -847,7 +847,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5F__accum_free(H5F_t *f, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t addr,
+H5F__accum_free(H5F_shared_t *f_sh, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t addr,
hsize_t size)
{
H5F_meta_accum_t *accum; /* Alias for file's metadata accumulator */
@@ -857,16 +857,16 @@ H5F__accum_free(H5F_t *f, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t addr,
FUNC_ENTER_PACKAGE
/* check arguments */
- HDassert(f);
+ HDassert(f_sh);
/* Set up alias for file's metadata accumulator info */
- accum = &f->shared->accum;
+ accum = &f_sh->accum;
/* Translate to file driver pointer */
- file = f->shared->lf;
+ file = f_sh->lf;
/* Adjust the metadata accumulator to remove the freed block, if it overlaps */
- if((f->shared->feature_flags & H5FD_FEAT_ACCUMULATE_METADATA)
+ if((f_sh->feature_flags & H5FD_FEAT_ACCUMULATE_METADATA)
&& H5F_addr_overlap(addr, size, accum->loc, accum->size)) {
size_t overlap_size; /* Size of overlap with accumulator */
@@ -1013,28 +1013,28 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5F__accum_flush(H5F_t *f)
+H5F__accum_flush(H5F_shared_t *f_sh)
{
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity checks */
- HDassert(f);
+ HDassert(f_sh);
/* Check if we need to flush out the metadata accumulator */
- if((f->shared->feature_flags & H5FD_FEAT_ACCUMULATE_METADATA) && f->shared->accum.dirty) {
+ if((f_sh->feature_flags & H5FD_FEAT_ACCUMULATE_METADATA) && f_sh->accum.dirty) {
H5FD_t *file; /* File driver pointer */
/* Translate to file driver pointer */
- file = f->shared->lf;
+ file = f_sh->lf;
/* Flush the metadata contents */
- if(H5FD_write(file, H5FD_MEM_DEFAULT, f->shared->accum.loc + f->shared->accum.dirty_off, f->shared->accum.dirty_len, f->shared->accum.buf + f->shared->accum.dirty_off) < 0)
+ if(H5FD_write(file, H5FD_MEM_DEFAULT, f_sh->accum.loc + f_sh->accum.dirty_off, f_sh->accum.dirty_len, f_sh->accum.buf + f_sh->accum.dirty_off) < 0)
HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed")
/* Reset the dirty flag */
- f->shared->accum.dirty = FALSE;
+ f_sh->accum.dirty = FALSE;
} /* end if */
done:
@@ -1056,34 +1056,31 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5F__accum_reset(H5F_t *f, hbool_t flush)
+H5F__accum_reset(H5F_shared_t *f_sh, hbool_t flush)
{
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
/* Sanity checks */
- HDassert(f);
+ HDassert(f_sh);
/* Flush any dirty data in accumulator, if requested */
if(flush)
- if(H5F__accum_flush(f) < 0)
+ if(H5F__accum_flush(f_sh) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "can't flush metadata accumulator")
/* Check if we need to reset the metadata accumulator information */
- if(f->shared->feature_flags & H5FD_FEAT_ACCUMULATE_METADATA) {
- /* Sanity check */
- HDassert(!f->closing || FALSE == f->shared->accum.dirty);
-
+ if(f_sh->feature_flags & H5FD_FEAT_ACCUMULATE_METADATA) {
/* Free the buffer */
- if(f->shared->accum.buf)
- f->shared->accum.buf = H5FL_BLK_FREE(meta_accum, f->shared->accum.buf);
+ if(f_sh->accum.buf)
+ f_sh->accum.buf = H5FL_BLK_FREE(meta_accum, f_sh->accum.buf);
/* Reset the buffer sizes & location */
- f->shared->accum.alloc_size = f->shared->accum.size = 0;
- f->shared->accum.loc = HADDR_UNDEF;
- f->shared->accum.dirty = FALSE;
- f->shared->accum.dirty_len = 0;
+ f_sh->accum.alloc_size = f_sh->accum.size = 0;
+ f_sh->accum.loc = HADDR_UNDEF;
+ f_sh->accum.dirty = FALSE;
+ f_sh->accum.dirty_len = 0;
} /* end if */
done:
diff --git a/src/H5Fint.c b/src/H5Fint.c
index 73776ff..8760e4c 100644
--- a/src/H5Fint.c
+++ b/src/H5Fint.c
@@ -1069,7 +1069,7 @@ H5F__new(H5F_shared_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5F
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to create open object data structure")
/* Add new "shared" struct to list of open files */
- if(H5F_sfile_add(f->shared) < 0)
+ if(H5F__sfile_add(f->shared) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to append to list of open files")
} /* end else */
@@ -1264,7 +1264,7 @@ H5F__dest(H5F_t *f, hbool_t flush)
HDassert(H5AC_cache_is_clean(f, H5AC_RING_MDFSM));
/* Remove shared file struct from list of open files */
- if(H5F_sfile_remove(f->shared) < 0)
+ if(H5F__sfile_remove(f->shared) < 0)
/* Push error, but keep going*/
HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "problems closing file")
@@ -1277,7 +1277,7 @@ H5F__dest(H5F_t *f, hbool_t flush)
HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "problems closing file")
/* Shutdown the page buffer cache */
- if(H5PB_dest(f) < 0)
+ if(H5PB_dest(f->shared) < 0)
/* Push error, but keep going*/
HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "problems closing page buffer cache")
@@ -1298,7 +1298,7 @@ H5F__dest(H5F_t *f, hbool_t flush)
} /* end if */
/* Destroy other components of the file */
- if(H5F__accum_reset(f, TRUE) < 0)
+ if(H5F__accum_reset(f->shared, TRUE) < 0)
/* Push error, but keep going*/
HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "problems closing file")
if(H5FO_dest(f) < 0)
@@ -1514,7 +1514,7 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id)
} /* end if */
/* Is the file already open? */
- if((shared = H5F_sfile_search(lf)) != NULL) {
+ if((shared = H5F__sfile_search(lf)) != NULL) {
/*
* The file is already open, so use that one instead of the one we
* just opened. We only one one H5FD_t* per file so one doesn't
@@ -1631,7 +1631,7 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id)
/* Create the page buffer before initializing the superblock */
if(page_buf_size)
- if(H5PB_create(file, page_buf_size, page_buf_min_meta_perc, page_buf_min_raw_perc) < 0)
+ if(H5PB_create(shared, page_buf_size, page_buf_min_meta_perc, page_buf_min_raw_perc) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to create page buffer")
/* Initialize information about the superblock and allocate space for it */
@@ -1653,7 +1653,7 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id)
/* Create the page buffer before initializing the superblock */
if(page_buf_size)
- if(H5PB_create(file, page_buf_size, page_buf_min_meta_perc, page_buf_min_raw_perc) < 0)
+ if(H5PB_create(shared, page_buf_size, page_buf_min_meta_perc, page_buf_min_raw_perc) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to create page buffer")
/* Open the root group */
@@ -1669,16 +1669,6 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id)
*/
if(H5P_get(a_plist, H5F_ACS_CLOSE_DEGREE_NAME, &fc_degree) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get file close degree")
-
- /* This is a private property to clear the status_flags in the super block */
- /* Use by h5clear and a routine in test/flush2.c to clear the test file's status_flags */
- if(H5P_exist_plist(a_plist, H5F_ACS_CLEAR_STATUS_FLAGS_NAME) > 0) {
- if(H5P_get(a_plist, H5F_ACS_CLEAR_STATUS_FLAGS_NAME, &clear) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get clearance for status_flags")
- else if(clear)
- file->shared->sblock->status_flags = 0;
- } /* end if */
-
if(shared->nrefs == 1) {
if(fc_degree == H5F_CLOSE_DEFAULT)
shared->fc_degree = lf->cls->fc_degree;
@@ -1692,6 +1682,15 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id)
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "file close degree doesn't match")
} /* end if */
+ /* This is a private property to clear the status_flags in the super block */
+ /* Use by h5clear and a routine in test/flush2.c to clear the test file's status_flags */
+ if(H5P_exist_plist(a_plist, H5F_ACS_CLEAR_STATUS_FLAGS_NAME) > 0) {
+ if(H5P_get(a_plist, H5F_ACS_CLEAR_STATUS_FLAGS_NAME, &clear) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get clearance for status_flags")
+ else if(clear)
+ file->shared->sblock->status_flags = 0;
+ } /* end if */
+
/* Record the evict-on-close MDC behavior. If it's the first time opening
* the file, set it to access property list value; if it's the second time
* or later, verify that the access property list value matches the value
@@ -1862,12 +1861,12 @@ H5F__flush_phase2(H5F_t *f, hbool_t closing)
#endif /* H5_HAVE_PARALLEL */
/* Flush out the metadata accumulator */
- if(H5F__accum_flush(f) < 0)
+ if(H5F__accum_flush(f->shared) < 0)
/* Push error, but keep going*/
HDONE_ERROR(H5E_IO, H5E_CANTFLUSH, FAIL, "unable to flush metadata accumulator")
/* Flush the page buffer */
- if(H5PB_flush(f) < 0)
+ if(H5PB_flush(f->shared) < 0)
/* Push error, but keep going*/
HDONE_ERROR(H5E_IO, H5E_CANTFLUSH, FAIL, "page buffer flush failed")
@@ -3366,7 +3365,7 @@ H5F__start_swmr_write(H5F_t *f)
} /* end if */
/* Flush and reset the accumulator */
- if(H5F__accum_reset(f, TRUE) < 0)
+ if(H5F__accum_reset(f->shared, TRUE) < 0)
HGOTO_ERROR(H5E_IO, H5E_CANTRESET, FAIL, "can't reset accumulator")
/* Turn on SWMR write in shared file open flags */
@@ -3412,7 +3411,6 @@ H5F__start_swmr_write(H5F_t *f)
done:
if(ret_value < 0 && setup) {
- HDassert(f);
/* Re-enable accumulator */
f->shared->feature_flags |= (unsigned)H5FD_FEAT_ACCUMULATE_METADATA;
@@ -3485,30 +3483,31 @@ H5F__format_convert(H5F_t *f)
f->shared->fs_persist == H5F_FREE_SPACE_PERSIST_DEF &&
f->shared->fs_threshold == H5F_FREE_SPACE_THRESHOLD_DEF &&
f->shared->fs_page_size == H5F_FILE_SPACE_PAGE_SIZE_DEF)) {
- /* Check to remove free-space manager info message from superblock extension */
- if(H5F_addr_defined(f->shared->sblock->ext_addr))
- if(H5F__super_ext_remove_msg(f, H5O_FSINFO_ID) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "error in removing message from superblock extension")
-
- /* Close freespace manager */
- if(H5MF_try_close(f) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "unable to free free-space address")
-
- /* Set non-persistent freespace manager */
- f->shared->fs_strategy = H5F_FILE_SPACE_STRATEGY_DEF;
- f->shared->fs_persist = H5F_FREE_SPACE_PERSIST_DEF;
- f->shared->fs_threshold = H5F_FREE_SPACE_THRESHOLD_DEF;
- f->shared->fs_page_size = H5F_FILE_SPACE_PAGE_SIZE_DEF;
-
- /* Indicate that the superblock should be marked dirty */
- mark_dirty = TRUE;
+
+ /* Check to remove free-space manager info message from superblock extension */
+ if(H5F_addr_defined(f->shared->sblock->ext_addr))
+ if(H5F__super_ext_remove_msg(f, H5O_FSINFO_ID) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "error in removing message from superblock extension")
+
+ /* Close freespace manager */
+ if(H5MF_try_close(f) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "unable to free free-space address")
+
+ /* Set non-persistent freespace manager */
+ f->shared->fs_strategy = H5F_FILE_SPACE_STRATEGY_DEF;
+ f->shared->fs_persist = H5F_FREE_SPACE_PERSIST_DEF;
+ f->shared->fs_threshold = H5F_FREE_SPACE_THRESHOLD_DEF;
+ f->shared->fs_page_size = H5F_FILE_SPACE_PAGE_SIZE_DEF;
+
+ /* Indicate that the superblock should be marked dirty */
+ mark_dirty = TRUE;
} /* end if */
/* Check if we should mark the superblock dirty */
if(mark_dirty)
- /* Mark superblock as dirty */
- if(H5F_super_dirty(f) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTMARKDIRTY, FAIL, "unable to mark superblock as dirty")
+ /* Mark superblock as dirty */
+ if(H5F_super_dirty(f) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTMARKDIRTY, FAIL, "unable to mark superblock as dirty")
done:
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5Fio.c b/src/H5Fio.c
index 11a9e76..a4a6e01 100644
--- a/src/H5Fio.c
+++ b/src/H5Fio.c
@@ -113,7 +113,7 @@ H5F_block_read(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, void *buf/*
map_type = (type == H5FD_MEM_GHEAP) ? H5FD_MEM_DRAW : type;
/* Pass through page buffer layer */
- if(H5PB_read(f, map_type, addr, size, buf) < 0)
+ if(H5PB_read(f->shared, map_type, addr, size, buf) < 0)
HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "read through page buffer failed")
done:
@@ -159,7 +159,7 @@ H5F_block_write(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, const void
map_type = (type == H5FD_MEM_GHEAP) ? H5FD_MEM_DRAW : type;
/* Pass through page buffer layer */
- if(H5PB_write(f, map_type, addr, size, buf) < 0)
+ if(H5PB_write(f->shared, map_type, addr, size, buf) < 0)
HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "write through page buffer failed")
done:
@@ -192,7 +192,7 @@ H5F_flush_tagged_metadata(H5F_t *f, haddr_t tag)
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush tagged metadata")
/* Flush and reset the accumulator */
- if(H5F__accum_reset(f, TRUE) < 0)
+ if(H5F__accum_reset(f->shared, TRUE) < 0)
HGOTO_ERROR(H5E_IO, H5E_CANTRESET, FAIL, "can't reset accumulator")
/* Flush file buffers to disk. */
diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h
index 5aff3a6..b73005a 100644
--- a/src/H5Fpkg.h
+++ b/src/H5Fpkg.h
@@ -326,7 +326,7 @@ struct H5F_shared_t {
/* been used accessed for either */
/* allocation or deallocation */
/* since file open. */
- haddr_t eoa_pre_fsm_fsalloc; /* eoa pre file space allocation */
+ haddr_t eoa_pre_fsm_fsalloc; /* eoa pre file space allocation */
/* for self referential FSMs */
haddr_t eoa_post_fsm_fsalloc; /* eoa post file space allocation */
/* for self referential FSMs */
@@ -354,7 +354,7 @@ struct H5F_shared_t {
/* Object flush info */
H5F_object_flush_t object_flush; /* Information for object flush callback */
- hbool_t crt_dset_min_ohdr_flag; /* flag to create minimized dataset object headers */
+ hbool_t crt_dset_min_ohdr_flag; /* flag to minimize created dataset object header */
};
/*
@@ -366,7 +366,7 @@ struct H5F_t {
char *open_name; /* Name used to open file */
char *actual_name; /* Actual name of the file, after resolving symlinks, etc. */
char *extpath; /* Path for searching target external link file */
- H5F_shared_t *shared; /* The shared file info */
+ H5F_shared_t *shared; /* The shared file info */
unsigned nopen_objs; /* Number of open object headers */
H5FO_t *obj_count; /* # of time each object is opened through top file structure */
hid_t file_id; /* ID of this file */
@@ -428,16 +428,16 @@ H5_DLL herr_t H5F__super_ext_remove_msg(H5F_t *f, unsigned id);
H5_DLL herr_t H5F__super_ext_close(H5F_t *f, H5O_loc_t *ext_ptr, hbool_t was_created);
/* Metadata accumulator routines */
-H5_DLL herr_t H5F__accum_read(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, void *buf);
-H5_DLL herr_t H5F__accum_write(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, const void *buf);
-H5_DLL herr_t H5F__accum_free(H5F_t *f, H5FD_mem_t type, haddr_t addr, hsize_t size);
-H5_DLL herr_t H5F__accum_flush(H5F_t *f);
-H5_DLL herr_t H5F__accum_reset(H5F_t *f, hbool_t flush);
+H5_DLL herr_t H5F__accum_read(H5F_shared_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, void *buf);
+H5_DLL herr_t H5F__accum_write(H5F_shared_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, const void *buf);
+H5_DLL herr_t H5F__accum_free(H5F_shared_t *f, H5FD_mem_t type, haddr_t addr, hsize_t size);
+H5_DLL herr_t H5F__accum_flush(H5F_shared_t *f_sh);
+H5_DLL herr_t H5F__accum_reset(H5F_shared_t *f_sh, hbool_t flush);
/* Shared file list related routines */
-H5_DLL herr_t H5F_sfile_add(H5F_shared_t *shared);
-H5_DLL H5F_shared_t * H5F_sfile_search(H5FD_t *lf);
-H5_DLL herr_t H5F_sfile_remove(H5F_shared_t *shared);
+H5_DLL herr_t H5F__sfile_add(H5F_shared_t *shared);
+H5_DLL H5F_shared_t *H5F__sfile_search(H5FD_t *lf);
+H5_DLL herr_t H5F__sfile_remove(H5F_shared_t *shared);
/* External file cache routines */
H5_DLL H5F_efc_t *H5F__efc_create(unsigned max_nfiles);
diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h
index 17317b9..57318a7 100644
--- a/src/H5Fprivate.h
+++ b/src/H5Fprivate.h
@@ -25,13 +25,14 @@ typedef struct H5F_t H5F_t;
#include "H5Fpublic.h"
/* Public headers needed by this file */
-#include "H5FDpublic.h" /* File drivers */
+#include "H5FDpublic.h" /* File drivers */
/* Private headers needed by this file */
+#include "H5MMprivate.h" /* Memory management */
#ifdef H5_HAVE_PARALLEL
-#include "H5Pprivate.h" /* Property lists */
+#include "H5Pprivate.h" /* Property lists */
#endif /* H5_HAVE_PARALLEL */
-#include "H5VMprivate.h" /* Vectors and arrays */
+#include "H5VMprivate.h" /* Vectors and arrays */
/**************************/
@@ -277,6 +278,7 @@ typedef struct H5F_t H5F_t;
#ifdef H5F_MODULE
#define H5F_LOW_BOUND(F) ((F)->shared->low_bound)
#define H5F_HIGH_BOUND(F) ((F)->shared->high_bound)
+#define H5F_SHARED_INTENT(F_SH) ((F_SH)->flags)
#define H5F_INTENT(F) ((F)->shared->flags)
#define H5F_OPEN_NAME(F) ((F)->open_name)
#define H5F_ACTUAL_NAME(F) ((F)->actual_name)
@@ -292,6 +294,7 @@ typedef struct H5F_t H5F_t;
#define H5F_GET_READ_ATTEMPTS(F) ((F)->shared->read_attempts)
#define H5F_DRIVER_ID(F) ((F)->shared->lf->driver_id)
#define H5F_GET_FILENO(F,FILENUM) ((FILENUM) = (F)->shared->lf->fileno)
+#define H5F_SHARED_HAS_FEATURE(F_SH,FL) ((F_SH)->lf->feature_flags & (FL))
#define H5F_HAS_FEATURE(F,FL) ((F)->shared->lf->feature_flags & (FL))
#define H5F_BASE_ADDR(F) ((F)->shared->sblock->base_addr)
#define H5F_SYM_LEAF_K(F) ((F)->shared->sblock->sym_leaf_k)
@@ -336,6 +339,7 @@ typedef struct H5F_t H5F_t;
#else /* H5F_MODULE */
#define H5F_LOW_BOUND(F) (H5F_get_low_bound(F))
#define H5F_HIGH_BOUND(F) (H5F_get_high_bound(F))
+#define H5F_SHARED_INTENT(F_SH) (H5F_shared_get_intent(F_SH))
#define H5F_INTENT(F) (H5F_get_intent(F))
#define H5F_OPEN_NAME(F) (H5F_get_open_name(F))
#define H5F_ACTUAL_NAME(F) (H5F_get_actual_name(F))
@@ -351,6 +355,7 @@ typedef struct H5F_t H5F_t;
#define H5F_GET_READ_ATTEMPTS(F) (H5F_get_read_attempts(F))
#define H5F_DRIVER_ID(F) (H5F_get_driver_id(F))
#define H5F_GET_FILENO(F,FILENUM) (H5F_get_fileno((F), &(FILENUM)))
+#define H5F_SHARED_HAS_FEATURE(F_SH,FL) (H5F_shared_has_feature(F_SH,FL))
#define H5F_HAS_FEATURE(F,FL) (H5F_has_feature(F,FL))
#define H5F_BASE_ADDR(F) (H5F_get_base_addr(F))
#define H5F_SYM_LEAF_K(F) (H5F_sym_leaf_k(F))
@@ -725,6 +730,7 @@ H5_DLL herr_t H5F_start_swmr_write(H5F_t *file);
/* Functions that retrieve values from the file struct */
H5_DLL H5F_libver_t H5F_get_low_bound(const H5F_t *f);
H5_DLL H5F_libver_t H5F_get_high_bound(const H5F_t *f);
+H5_DLL unsigned H5F_shared_get_intent(const H5F_shared_t *f);
H5_DLL unsigned H5F_get_intent(const H5F_t *f);
H5_DLL char *H5F_get_open_name(const H5F_t *f);
H5_DLL char *H5F_get_actual_name(const H5F_t *f);
@@ -790,7 +796,9 @@ H5_DLL char *H5F_mdc_log_location(const H5F_t *f);
/* Functions that retrieve values from VFD layer */
H5_DLL hid_t H5F_get_driver_id(const H5F_t *f);
H5_DLL herr_t H5F_get_fileno(const H5F_t *f, unsigned long *filenum);
+H5_DLL hbool_t H5F_shared_has_feature(const H5F_shared_t *f, unsigned feature);
H5_DLL hbool_t H5F_has_feature(const H5F_t *f, unsigned feature);
+H5_DLL haddr_t H5F_shared_get_eoa(const H5F_shared_t *f_sh, H5FD_mem_t type);
H5_DLL haddr_t H5F_get_eoa(const H5F_t *f, H5FD_mem_t type);
H5_DLL herr_t H5F_get_vfd_handle(const H5F_t *file, hid_t fapl, void **file_handle);
@@ -806,7 +814,7 @@ H5_DLL herr_t H5F_block_write(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t si
/* Functions that flush or evict */
H5_DLL herr_t H5F_flush_tagged_metadata(H5F_t *f, haddr_t tag);
-H5_DLL herr_t H5F_evict_tagged_metadata(H5F_t * f, haddr_t tag);
+H5_DLL herr_t H5F_evict_tagged_metadata(H5F_t *f, haddr_t tag);
/* Functions that verify a piece of metadata with checksum */
H5_DLL herr_t H5F_get_checksums(const uint8_t *buf, size_t chk_size, uint32_t *s_chksum, uint32_t *c_chksum);
diff --git a/src/H5Fquery.c b/src/H5Fquery.c
index 4a1a009..667a2937 100644
--- a/src/H5Fquery.c
+++ b/src/H5Fquery.c
@@ -75,6 +75,28 @@
/*-------------------------------------------------------------------------
+ * Function: H5F_shared_get_intent
+ *
+ * Purpose: Quick and dirty routine to retrieve the file's 'intent' flags
+ * (Mainly added to stop non-file routines from poking about in the
+ * H5F_shared_t data structure)
+ *
+ * Return: 'intent' on success/abort on failure (shouldn't fail)
+ *-------------------------------------------------------------------------
+ */
+unsigned
+H5F_shared_get_intent(const H5F_shared_t *f_sh)
+{
+ /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+
+ HDassert(f_sh);
+
+ FUNC_LEAVE_NOAPI(f_sh->flags)
+} /* end H5F_shared_get_intent() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5F_get_intent
*
* Purpose: Quick and dirty routine to retrieve the file's 'intent' flags
@@ -827,6 +849,27 @@ H5F_store_msg_crt_idx(const H5F_t *f)
/*-------------------------------------------------------------------------
+ * Function: H5F_shared_has_feature
+ *
+ * Purpose: Check if a file has a particular feature enabled
+ *
+ * Return: Success: Non-negative - TRUE or FALSE
+ * Failure: Negative (should not happen)
+ *-------------------------------------------------------------------------
+ */
+hbool_t
+H5F_shared_has_feature(const H5F_shared_t *f_sh, unsigned feature)
+{
+ /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+
+ HDassert(f_sh);
+
+ FUNC_LEAVE_NOAPI((hbool_t)(f_sh->lf->feature_flags & feature))
+} /* end H5F_shared_has_feature() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5F_has_feature
*
* Purpose: Check if a file has a particular feature enabled
@@ -904,6 +947,32 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5F_shared_get_eoa
+ *
+ * Purpose: Quick and dirty routine to retrieve the file's 'eoa' value
+ *
+ * Return: Non-negative on success/Negative on failure
+ *-------------------------------------------------------------------------
+ */
+haddr_t
+H5F_shared_get_eoa(const H5F_shared_t *f_sh, H5FD_mem_t type)
+{
+ haddr_t ret_value = HADDR_UNDEF; /* Return value */
+
+ FUNC_ENTER_NOAPI(HADDR_UNDEF)
+
+ HDassert(f_sh);
+
+ /* Dispatch to driver */
+ if(HADDR_UNDEF == (ret_value = H5FD_get_eoa(f_sh->lf, type)))
+ HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "driver get_eoa request failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5F_shared_get_eoa() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5F_get_eoa
*
* Purpose: Quick and dirty routine to retrieve the file's 'eoa' value
diff --git a/src/H5Fsfile.c b/src/H5Fsfile.c
index 1678f49..9a9bbab 100644
--- a/src/H5Fsfile.c
+++ b/src/H5Fsfile.c
@@ -84,7 +84,7 @@ H5F_sfile_assert_num(unsigned n)
/*-------------------------------------------------------------------------
- * Function: H5F_sfile_add
+ * Function: H5F__sfile_add
*
* Purpose: Add a "shared" file struct to the list of open files
*
@@ -96,12 +96,12 @@ H5F_sfile_assert_num(unsigned n)
*-------------------------------------------------------------------------
*/
herr_t
-H5F_sfile_add(H5F_shared_t *shared)
+H5F__sfile_add(H5F_shared_t *shared)
{
H5F_sfile_node_t *new_shared; /* New shared file node */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(shared);
@@ -119,11 +119,11 @@ H5F_sfile_add(H5F_shared_t *shared)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5F_sfile_add() */
+} /* end H5F__sfile_add() */
/*-------------------------------------------------------------------------
- * Function: H5F_sfile_search
+ * Function: H5F__sfile_search
*
* Purpose: Search for a "shared" file with low-level file info that
* matches
@@ -136,12 +136,12 @@ done:
*-------------------------------------------------------------------------
*/
H5F_shared_t *
-H5F_sfile_search(H5FD_t *lf)
+H5F__sfile_search(H5FD_t *lf)
{
H5F_sfile_node_t *curr; /* Current shared file node */
- H5F_shared_t *ret_value = NULL; /* Return value */
+ H5F_shared_t *ret_value = NULL; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_PACKAGE_NOERR
/* Sanity check */
HDassert(lf);
@@ -159,11 +159,11 @@ H5F_sfile_search(H5FD_t *lf)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5F_sfile_search() */
+} /* end H5F__sfile_search() */
/*-------------------------------------------------------------------------
- * Function: H5F_sfile_remove
+ * Function: H5F__sfile_remove
*
* Purpose: Remove a "shared" file struct from the list of open files
*
@@ -175,13 +175,13 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5F_sfile_remove(H5F_shared_t *shared)
+H5F__sfile_remove(H5F_shared_t *shared)
{
H5F_sfile_node_t *curr; /* Current shared file node */
H5F_sfile_node_t *last; /* Last shared file node */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(shared);
@@ -213,5 +213,5 @@ H5F_sfile_remove(H5F_shared_t *shared)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5F_sfile_remove() */
+} /* end H5F__sfile_remove() */
diff --git a/src/H5MF.c b/src/H5MF.c
index dac713b..38e84dc 100644
--- a/src/H5MF.c
+++ b/src/H5MF.c
@@ -909,12 +909,12 @@ HDfprintf(stderr, "%s: alloc_type = %u, size = %Hu\n", FUNC, (unsigned)alloc_typ
H5MF__alloc_to_fs_type(f, alloc_type, size, &ptype);
switch(ptype) {
- case H5F_MEM_PAGE_GENERIC:
- case H5F_MEM_PAGE_LARGE_BTREE:
- case H5F_MEM_PAGE_LARGE_DRAW:
- case H5F_MEM_PAGE_LARGE_GHEAP:
- case H5F_MEM_PAGE_LARGE_LHEAP:
- case H5F_MEM_PAGE_LARGE_OHDR:
+ case H5F_MEM_PAGE_GENERIC:
+ case H5F_MEM_PAGE_LARGE_BTREE:
+ case H5F_MEM_PAGE_LARGE_DRAW:
+ case H5F_MEM_PAGE_LARGE_GHEAP:
+ case H5F_MEM_PAGE_LARGE_LHEAP:
+ case H5F_MEM_PAGE_LARGE_OHDR:
{
haddr_t eoa; /* EOA for the file */
hsize_t frag_size = 0; /* Fragment size */
@@ -981,7 +981,7 @@ HDfprintf(stderr, "%s: alloc_type = %u, size = %Hu\n", FUNC, (unsigned)alloc_typ
/* Insert the new page into the Page Buffer list of new pages so
we don't read an empty page from disk */
- if(f->shared->page_buf != NULL && H5PB_add_new_page(f, alloc_type, new_page) < 0)
+ if(f->shared->page_buf != NULL && H5PB_add_new_page(f->shared, alloc_type, new_page) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINSERT, HADDR_UNDEF, "can't add new page to Page Buffer new page list")
ret_value = new_page;
@@ -1140,7 +1140,7 @@ HDfprintf(stderr, "%s: Entering - alloc_type = %u, addr = %a, size = %Hu\n", FUN
*/
if(H5FD_MEM_DRAW != alloc_type) {
/* Check if the space to free intersects with the file's metadata accumulator */
- if(H5F__accum_free(f, alloc_type, addr, size) < 0)
+ if(H5F__accum_free(f->shared, alloc_type, addr, size) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "can't check free space intersection w/metadata accumulator")
} /* end if */
diff --git a/src/H5MFsection.c b/src/H5MFsection.c
index a373360..715ece4 100644
--- a/src/H5MFsection.c
+++ b/src/H5MFsection.c
@@ -776,7 +776,7 @@ H5MF__sect_small_merge(H5FS_section_info_t **_sect1, H5FS_section_info_t *_sect2
/* Note: Large metadata page bypasses the PB cache */
/* Note: Update of raw data page (large or small sized) is handled by the PB cache */
if(udata->f->shared->page_buf != NULL && udata->alloc_type != H5FD_MEM_DRAW)
- if(H5PB_remove_entry(udata->f, (*sect1)->sect_info.addr) < 0)
+ if(H5PB_remove_entry(udata->f->shared, (*sect1)->sect_info.addr) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "can't free merged section")
if(H5MF__sect_free((H5FS_section_info_t *)(*sect1)) < 0)
diff --git a/src/H5PB.c b/src/H5PB.c
index 6c61e4c..907fe82 100644
--- a/src/H5PB.c
+++ b/src/H5PB.c
@@ -124,8 +124,8 @@ typedef struct {
/* Local Prototypes */
/********************/
static herr_t H5PB__insert_entry(H5PB_t *page_buf, H5PB_entry_t *page_entry);
-static htri_t H5PB__make_space(H5F_t *f, H5PB_t *page_buf, H5FD_mem_t inserted_type);
-static herr_t H5PB__write_entry(H5F_t *f, H5PB_entry_t *page_entry);
+static htri_t H5PB__make_space(H5F_shared_t *f_sh, H5PB_t *page_buf, H5FD_mem_t inserted_type);
+static herr_t H5PB__write_entry(H5F_shared_t *f_sh, H5PB_entry_t *page_entry);
/*********************/
@@ -289,7 +289,7 @@ H5PB_print_stats(const H5PB_t *page_buf)
*-------------------------------------------------------------------------
*/
herr_t
-H5PB_create(H5F_t *f, size_t size, unsigned page_buf_min_meta_perc, unsigned page_buf_min_raw_perc)
+H5PB_create(H5F_shared_t *f_sh, size_t size, unsigned page_buf_min_meta_perc, unsigned page_buf_min_raw_perc)
{
H5PB_t *page_buf = NULL;
herr_t ret_value = SUCCEED; /* Return value */
@@ -297,36 +297,35 @@ H5PB_create(H5F_t *f, size_t size, unsigned page_buf_min_meta_perc, unsigned pag
FUNC_ENTER_NOAPI(FAIL)
/* Sanity checks */
- HDassert(f);
- HDassert(f->shared);
+ HDassert(f_sh);
/* Check args */
- if(f->shared->fs_strategy != H5F_FSPACE_STRATEGY_PAGE)
+ if(f_sh->fs_strategy != H5F_FSPACE_STRATEGY_PAGE)
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "Enabling Page Buffering requires PAGE file space strategy")
/* round down the size if it is larger than the page size */
- else if(size > f->shared->fs_page_size) {
+ else if(size > f_sh->fs_page_size) {
hsize_t temp_size;
- temp_size = (size / f->shared->fs_page_size) * f->shared->fs_page_size;
+ temp_size = (size / f_sh->fs_page_size) * f_sh->fs_page_size;
H5_CHECKED_ASSIGN(size, size_t, temp_size, hsize_t);
} /* end if */
- else if(0 != size % f->shared->fs_page_size)
+ else if(0 != size % f_sh->fs_page_size)
HGOTO_ERROR(H5E_PAGEBUF, H5E_CANTINIT, FAIL, "Page Buffer size must be >= to the page size")
/* Allocate the new page buffering structure */
if(NULL == (page_buf = H5FL_CALLOC(H5PB_t)))
- HGOTO_ERROR(H5E_PAGEBUF, H5E_NOSPACE, FAIL, "memory allocation failed")
+ HGOTO_ERROR(H5E_PAGEBUF, H5E_NOSPACE, FAIL, "memory allocation failed")
page_buf->max_size = size;
- H5_CHECKED_ASSIGN(page_buf->page_size, size_t, f->shared->fs_page_size, hsize_t);
+ H5_CHECKED_ASSIGN(page_buf->page_size, size_t, f_sh->fs_page_size, hsize_t);
page_buf->min_meta_perc = page_buf_min_meta_perc;
page_buf->min_raw_perc = page_buf_min_raw_perc;
/* Calculate the minimum page count for metadata and raw data
* based on the fractions provided
*/
- page_buf->min_meta_count = (unsigned)((size * page_buf_min_meta_perc) / (f->shared->fs_page_size * 100));
- page_buf->min_raw_count = (unsigned)((size * page_buf_min_raw_perc) / (f->shared->fs_page_size * 100));
+ page_buf->min_meta_count = (unsigned)((size * page_buf_min_meta_perc) / (f_sh->fs_page_size * 100));
+ page_buf->min_raw_count = (unsigned)((size * page_buf_min_raw_perc) / (f_sh->fs_page_size * 100));
if(NULL == (page_buf->slist_ptr = H5SL_create(H5SL_TYPE_HADDR, NULL)))
HGOTO_ERROR(H5E_PAGEBUF, H5E_CANTCREATE, FAIL, "can't create skip list")
@@ -336,7 +335,7 @@ H5PB_create(H5F_t *f, size_t size, unsigned page_buf_min_meta_perc, unsigned pag
if(NULL == (page_buf->page_fac = H5FL_fac_init(page_buf->page_size)))
HGOTO_ERROR(H5E_PAGEBUF, H5E_CANTINIT, FAIL, "can't create page factory")
- f->shared->page_buf = page_buf;
+ f_sh->page_buf = page_buf;
done:
if(ret_value < 0) {
@@ -370,18 +369,18 @@ static herr_t
H5PB__flush_cb(void *item, void H5_ATTR_UNUSED *key, void *_op_data)
{
H5PB_entry_t *page_entry = (H5PB_entry_t *)item; /* Pointer to page entry node */
- H5F_t *f = (H5F_t *)_op_data;
+ H5F_shared_t *f_sh = (H5F_shared_t *)_op_data;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
/* Sanity checks */
HDassert(page_entry);
- HDassert(f);
+ HDassert(f_sh);
/* Flush the page if it's dirty */
if(page_entry->is_dirty)
- if(H5PB__write_entry(f, page_entry) < 0)
+ if(H5PB__write_entry(f_sh, page_entry) < 0)
HGOTO_ERROR(H5E_PAGEBUF, H5E_WRITEERROR, FAIL, "file write failed")
done:
@@ -401,21 +400,21 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5PB_flush(H5F_t *f)
+H5PB_flush(H5F_shared_t *f_sh)
{
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
- HDassert(f);
+ HDassert(f_sh);
/* Flush all the entries in the PB skiplist, if we have write access on the file */
- if(f->shared->page_buf && (H5F_ACC_RDWR & H5F_INTENT(f))) {
- H5PB_t *page_buf = f->shared->page_buf;
+ if(f_sh->page_buf && (H5F_ACC_RDWR & H5F_SHARED_INTENT(f_sh))) {
+ H5PB_t *page_buf = f_sh->page_buf;
/* Iterate over all entries in page buffer skip list */
- if(H5SL_iterate(page_buf->slist_ptr, H5PB__flush_cb, (void *)f))
+ if(H5SL_iterate(page_buf->slist_ptr, H5PB__flush_cb, f_sh))
HGOTO_ERROR(H5E_PAGEBUF, H5E_BADITER, FAIL, "can't flush page buffer skip list")
} /* end if */
@@ -473,21 +472,21 @@ H5PB__dest_cb(void *item, void H5_ATTR_UNUSED *key, void *_op_data)
*-------------------------------------------------------------------------
*/
herr_t
-H5PB_dest(H5F_t *f)
+H5PB_dest(H5F_shared_t *f_sh)
{
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity checks */
- HDassert(f);
+ HDassert(f_sh);
/* flush and destroy the page buffer, if it exists */
- if(f->shared->page_buf) {
- H5PB_t *page_buf = f->shared->page_buf;
+ if(f_sh->page_buf) {
+ H5PB_t *page_buf = f_sh->page_buf;
H5PB_ud1_t op_data; /* Iteration context */
- if(H5PB_flush(f) < 0)
+ if(H5PB_flush(f_sh) < 0)
HGOTO_ERROR(H5E_PAGEBUF, H5E_CANTFLUSH, FAIL, "can't flush page buffer")
/* Set up context info */
@@ -507,7 +506,7 @@ H5PB_dest(H5F_t *f)
if(H5FL_fac_term(page_buf->page_fac) < 0)
HGOTO_ERROR(H5E_PAGEBUF, H5E_CANTRELEASE, FAIL, "can't destroy page buffer page factory")
- f->shared->page_buf = H5FL_FREE(H5PB_t, page_buf);
+ f_sh->page_buf = H5FL_FREE(H5PB_t, page_buf);
} /* end if */
done:
@@ -530,15 +529,17 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5PB_add_new_page(H5F_t *f, H5FD_mem_t type, haddr_t page_addr)
+H5PB_add_new_page(H5F_shared_t *f_sh, H5FD_mem_t type, haddr_t page_addr)
{
- H5PB_t *page_buf = f->shared->page_buf;
- H5PB_entry_t *page_entry = NULL; /* pointer to the corresponding page entry */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5PB_t *page_buf; /* Page buffer to operate on */
+ H5PB_entry_t *page_entry = NULL; /* Pointer to the corresponding page entry */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity checks */
+ HDassert(f_sh);
+ page_buf = f_sh->page_buf;
HDassert(page_buf);
/* If there is an existing page, this means that at some point the
@@ -636,15 +637,17 @@ H5PB_update_entry(H5PB_t *page_buf, haddr_t addr, size_t size, const void *buf)
*-------------------------------------------------------------------------
*/
herr_t
-H5PB_remove_entry(const H5F_t *f, haddr_t addr)
+H5PB_remove_entry(const H5F_shared_t *f_sh, haddr_t addr)
{
- H5PB_t *page_buf = f->shared->page_buf;
- H5PB_entry_t *page_entry = NULL; /* pointer to the page entry being searched */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5PB_t *page_buf; /* Page buffer to operate on */
+ H5PB_entry_t *page_entry = NULL; /* Pointer to the page entry being searched */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity checks */
+ HDassert(f_sh);
+ page_buf = f_sh->page_buf;
HDassert(page_buf);
/* Search for address in the skip list */
@@ -684,7 +687,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5PB_read(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, void *buf/*out*/)
+H5PB_read(H5F_shared_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, void *buf/*out*/)
{
H5PB_t *page_buf; /* Page buffering info for this file */
H5PB_entry_t *page_entry; /* Pointer to the corresponding page entry */
@@ -701,21 +704,21 @@ H5PB_read(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, void *buf/*out*/
FUNC_ENTER_NOAPI(FAIL)
/* Sanity checks */
- HDassert(f);
+ HDassert(f_sh);
HDassert(type != H5FD_MEM_GHEAP);
/* Get pointer to page buffer info for this file */
- page_buf = f->shared->page_buf;
+ page_buf = f_sh->page_buf;
#ifdef H5_HAVE_PARALLEL
- if(H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI)) {
+ if(H5F_SHARED_HAS_FEATURE(f_sh, H5FD_FEAT_HAS_MPI)) {
#if 1
bypass_pb = TRUE;
#else
/* MSC - why this stopped working ? */
int mpi_size;
- if((mpi_size = H5F_mpi_get_size(f)) < 0)
+ if((mpi_size = H5F_shared_mpi_get_size(f_sh)) < 0)
HGOTO_ERROR(H5E_PAGEBUF, H5E_CANTGET, FAIL, "can't retrieve MPI communicator size")
if(1 != mpi_size)
bypass_pb = TRUE;
@@ -729,7 +732,7 @@ H5PB_read(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, void *buf/*out*/
*/
if(NULL == page_buf || size >= page_buf->page_size ||
(bypass_pb && H5FD_MEM_DRAW == type)) {
- if(H5F__accum_read(f, type, addr, size, buf) < 0)
+ if(H5F__accum_read(f_sh, type, addr, size, buf) < 0)
HGOTO_ERROR(H5E_PAGEBUF, H5E_READERROR, FAIL, "read through metadata accumulator failed")
/* Update statistics */
@@ -780,7 +783,7 @@ H5PB_read(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, void *buf/*out*/
} /* end else */
/* Translate to file driver I/O info object */
- file = f->shared->lf;
+ file = f_sh->lf;
/* Copy raw data from dirty pages into the read buffer if the read
request spans pages in the page buffer*/
@@ -895,7 +898,7 @@ H5PB_read(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, void *buf/*out*/
htri_t can_make_space;
/* check if we can make space in page buffer */
- if((can_make_space = H5PB__make_space(f, page_buf, type)) < 0)
+ if((can_make_space = H5PB__make_space(f_sh, page_buf, type)) < 0)
HGOTO_ERROR(H5E_PAGEBUF, H5E_NOSPACE, FAIL, "make space in Page buffer Failed")
/* if make_space returns 0, then we can't use the page
@@ -920,7 +923,7 @@ H5PB_read(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, void *buf/*out*/
/* Read page through the VFD layer, but make sure we don't read past the EOA. */
/* Retrieve the 'eoa' for the file */
- if(HADDR_UNDEF == (eoa = H5F_get_eoa(f, type)))
+ if(HADDR_UNDEF == (eoa = H5F_shared_get_eoa(f_sh, type)))
HGOTO_ERROR(H5E_PAGEBUF, H5E_CANTGET, FAIL, "driver get_eoa request failed")
/* If the entire page falls outside the EOA, then fail */
@@ -981,7 +984,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5PB_write(H5F_t *f, H5FD_mem_t type, haddr_t addr,
+H5PB_write(H5F_shared_t *f_sh, H5FD_mem_t type, haddr_t addr,
size_t size, const void *buf)
{
H5PB_t *page_buf; /* Page buffering info for this file */
@@ -999,20 +1002,20 @@ H5PB_write(H5F_t *f, H5FD_mem_t type, haddr_t addr,
FUNC_ENTER_NOAPI(FAIL)
/* Sanity checks */
- HDassert(f);
+ HDassert(f_sh);
/* Get pointer to page buffer info for this file */
- page_buf = f->shared->page_buf;
+ page_buf = f_sh->page_buf;
#ifdef H5_HAVE_PARALLEL
- if(H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI)) {
+ if(H5F_SHARED_HAS_FEATURE(f_sh, H5FD_FEAT_HAS_MPI)) {
#if 1
bypass_pb = TRUE;
#else
/* MSC - why this stopped working ? */
int mpi_size;
- if((mpi_size = H5F_mpi_get_size(f)) < 0)
+ if((mpi_size = H5F_shared_mpi_get_size(f_sh)) < 0)
HGOTO_ERROR(H5E_PAGEBUF, H5E_CANTGET, FAIL, "can't retrieve MPI communicator size")
if(1 != mpi_size)
bypass_pb = TRUE;
@@ -1025,7 +1028,7 @@ H5PB_write(H5F_t *f, H5FD_mem_t type, haddr_t addr,
* buffering.
*/
if(NULL == page_buf || size >= page_buf->page_size || bypass_pb) {
- if(H5F__accum_write(f, type, addr, size, buf) < 0)
+ if(H5F__accum_write(f_sh, type, addr, size, buf) < 0)
HGOTO_ERROR(H5E_PAGEBUF, H5E_WRITEERROR, FAIL, "write through metadata accumulator failed")
/* Update statistics */
@@ -1084,7 +1087,7 @@ H5PB_write(H5F_t *f, H5FD_mem_t type, haddr_t addr,
} /* end else */
/* Translate to file driver I/O info object */
- file = f->shared->lf;
+ file = f_sh->lf;
/* Check if existing pages for raw data need to be updated since raw data access is not atomic */
if(H5FD_MEM_DRAW == type && size >= page_buf->page_size) {
@@ -1196,7 +1199,7 @@ H5PB_write(H5F_t *f, H5FD_mem_t type, haddr_t addr,
htri_t can_make_space;
/* Check if we can make space in page buffer */
- if((can_make_space = H5PB__make_space(f, page_buf, type)) < 0)
+ if((can_make_space = H5PB__make_space(f_sh, page_buf, type)) < 0)
HGOTO_ERROR(H5E_PAGEBUF, H5E_NOSPACE, FAIL, "make space in Page buffer Failed")
/* If make_space returns 0, then we can't use the page
@@ -1215,7 +1218,7 @@ H5PB_write(H5F_t *f, H5FD_mem_t type, haddr_t addr,
} /* end if */
/* Don't bother searching if there is no write access */
- if(H5F_ACC_RDWR & H5F_INTENT(f))
+ if(H5F_ACC_RDWR & H5F_SHARED_INTENT(f_sh))
/* Lookup & remove the page from the new skip list page if
* it exists to see if this is a new page from the MF layer
*/
@@ -1258,7 +1261,7 @@ H5PB_write(H5F_t *f, H5FD_mem_t type, haddr_t addr,
page_entry->type = (H5F_mem_page_t)type;
/* Retrieve the 'eoa' for the file */
- if(HADDR_UNDEF == (eoa = H5F_get_eoa(f, type)))
+ if(HADDR_UNDEF == (eoa = H5F_shared_get_eoa(f_sh, type)))
HGOTO_ERROR(H5E_PAGEBUF, H5E_CANTGET, FAIL, "driver get_eoa request failed")
/* If the entire page falls outside the EOA, then fail */
@@ -1269,8 +1272,8 @@ H5PB_write(H5F_t *f, H5FD_mem_t type, haddr_t addr,
* returned will most likely be HADDR_UNDEF, so skip
* that check.
*/
- if(!H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI))
- if(HADDR_UNDEF == (eof = H5FD_get_eof(f->shared->lf, H5FD_MEM_DEFAULT)))
+ if(!H5F_SHARED_HAS_FEATURE(f_sh, H5FD_FEAT_HAS_MPI))
+ if(HADDR_UNDEF == (eof = H5FD_get_eof(f_sh->lf, H5FD_MEM_DEFAULT)))
HGOTO_ERROR(H5E_PAGEBUF, H5E_CANTGET, FAIL, "driver get_eof request failed")
/* Adjust the read size to not go beyond the EOA */
@@ -1306,7 +1309,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5PB_write() */
-
+
/*-------------------------------------------------------------------------
* Function: H5PB__insert_entry()
*
@@ -1375,7 +1378,7 @@ done:
*-------------------------------------------------------------------------
*/
static htri_t
-H5PB__make_space(H5F_t *f, H5PB_t *page_buf, H5FD_mem_t inserted_type)
+H5PB__make_space(H5F_shared_t *f_sh, H5PB_t *page_buf, H5FD_mem_t inserted_type)
{
H5PB_entry_t *page_entry; /* Pointer to page eviction candidate */
htri_t ret_value = TRUE; /* Return value */
@@ -1383,7 +1386,7 @@ H5PB__make_space(H5F_t *f, H5PB_t *page_buf, H5FD_mem_t inserted_type)
FUNC_ENTER_STATIC
/* Sanity check */
- HDassert(f);
+ HDassert(f_sh);
HDassert(page_buf);
/* Get oldest entry */
@@ -1440,7 +1443,7 @@ H5PB__make_space(H5F_t *f, H5PB_t *page_buf, H5FD_mem_t inserted_type)
/* Flush page if dirty */
if(page_entry->is_dirty)
- if(H5PB__write_entry(f, page_entry) < 0)
+ if(H5PB__write_entry(f_sh, page_entry) < 0)
HGOTO_ERROR(H5E_PAGEBUF, H5E_WRITEERROR, FAIL, "file write failed")
/* Update statistics */
@@ -1473,7 +1476,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5PB__write_entry(H5F_t *f, H5PB_entry_t *page_entry)
+H5PB__write_entry(H5F_shared_t *f_sh, H5PB_entry_t *page_entry)
{
haddr_t eoa; /* Current EOA for the file */
herr_t ret_value = SUCCEED; /* Return value */
@@ -1481,11 +1484,11 @@ H5PB__write_entry(H5F_t *f, H5PB_entry_t *page_entry)
FUNC_ENTER_STATIC
/* Sanity check */
- HDassert(f);
+ HDassert(f_sh);
HDassert(page_entry);
/* Retrieve the 'eoa' for the file */
- if(HADDR_UNDEF == (eoa = H5F_get_eoa(f, (H5FD_mem_t)page_entry->type)))
+ if(HADDR_UNDEF == (eoa = H5F_shared_get_eoa(f_sh, (H5FD_mem_t)page_entry->type)))
HGOTO_ERROR(H5E_PAGEBUF, H5E_CANTGET, FAIL, "driver get_eoa request failed")
/* If the starting address of the page is larger than
@@ -1493,14 +1496,14 @@ H5PB__write_entry(H5F_t *f, H5PB_entry_t *page_entry)
*/
if(page_entry->addr <= eoa) {
H5FD_t *file; /* File driver I/O info */
- size_t page_size = f->shared->page_buf->page_size;
+ size_t page_size = f_sh->page_buf->page_size;
/* Adjust the page length if it exceeds the EOA */
if((page_entry->addr + page_size) > eoa)
page_size = (size_t)(eoa - page_entry->addr);
/* Translate to file driver I/O info object */
- file = f->shared->lf;
+ file = f_sh->lf;
if(H5FD_write(file, (H5FD_mem_t)page_entry->type, page_entry->addr, page_size, page_entry->page_buf_ptr) < 0)
HGOTO_ERROR(H5E_PAGEBUF, H5E_WRITEERROR, FAIL, "file write failed")
diff --git a/src/H5PBprivate.h b/src/H5PBprivate.h
index aef87e1..82d010d 100644
--- a/src/H5PBprivate.h
+++ b/src/H5PBprivate.h
@@ -85,16 +85,14 @@ typedef struct H5PB_t {
/***************************************/
/* General routines */
-H5_DLL herr_t H5PB_create(H5F_t *file, size_t page_buffer_size, unsigned page_buf_min_meta_perc, unsigned page_buf_min_raw_perc);
-H5_DLL herr_t H5PB_flush(H5F_t *f);
-H5_DLL herr_t H5PB_dest(H5F_t *f);
-H5_DLL herr_t H5PB_add_new_page(H5F_t *f, H5FD_mem_t type, haddr_t page_addr);
+H5_DLL herr_t H5PB_create(H5F_shared_t *f_sh, size_t page_buffer_size, unsigned page_buf_min_meta_perc, unsigned page_buf_min_raw_perc);
+H5_DLL herr_t H5PB_flush(H5F_shared_t *f_sh);
+H5_DLL herr_t H5PB_dest(H5F_shared_t *f_sh);
+H5_DLL herr_t H5PB_add_new_page(H5F_shared_t *f_sh, H5FD_mem_t type, haddr_t page_addr);
H5_DLL herr_t H5PB_update_entry(H5PB_t *page_buf, haddr_t addr, size_t size, const void *buf);
-H5_DLL herr_t H5PB_remove_entry(const H5F_t *f, haddr_t addr);
-H5_DLL herr_t H5PB_read(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size,
- void *buf/*out*/);
-H5_DLL herr_t H5PB_write(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size,
- const void *buf);
+H5_DLL herr_t H5PB_remove_entry(const H5F_shared_t *f_sh, haddr_t addr);
+H5_DLL herr_t H5PB_read(H5F_shared_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, void *buf/*out*/);
+H5_DLL herr_t H5PB_write(H5F_shared_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, const void *buf);
/* Statistics routines */
H5_DLL herr_t H5PB_reset_stats(H5PB_t *page_buf);
diff --git a/src/H5private.h b/src/H5private.h
index 4cca41d..c628fcf 100644
--- a/src/H5private.h
+++ b/src/H5private.h
@@ -2115,8 +2115,9 @@ H5_DLL herr_t H5CX_pop(void);
} /* end if */ \
\
/* Initialize the package, if appropriate */ \
- H5_PACKAGE_INIT(H5_MY_PKG_INIT, err) \
- \
+ H5_PACKAGE_INIT(H5_MY_PKG_INIT, err)
+
+#define FUNC_ENTER_API_PUSH(err) \
/* Push the name of this function on the function stack */ \
H5_PUSH_FUNC \
\
@@ -2130,6 +2131,7 @@ H5_DLL herr_t H5CX_pop(void);
#define FUNC_ENTER_API(err) {{ \
FUNC_ENTER_API_COMMON \
FUNC_ENTER_API_INIT(err); \
+ FUNC_ENTER_API_PUSH(err); \
/* Clear thread error stack entering public functions */ \
H5E_clear_stack(NULL); \
{
@@ -2141,6 +2143,7 @@ H5_DLL herr_t H5CX_pop(void);
#define FUNC_ENTER_API_NOCLEAR(err) {{ \
FUNC_ENTER_API_COMMON \
FUNC_ENTER_API_INIT(err); \
+ FUNC_ENTER_API_PUSH(err); \
{
/*
@@ -2169,6 +2172,18 @@ H5_DLL herr_t H5CX_pop(void);
BEGIN_MPE_LOG \
{
+/*
+ * Use this macro for API functions that should only perform initialization
+ * of the library or an interface, but not push any state (API context,
+ * function name, start MPE logging, etc) examples are: H5open.
+ *
+ */
+#define FUNC_ENTER_API_NOPUSH(err) {{{{{ \
+ FUNC_ENTER_COMMON(H5_IS_API(FUNC)); \
+ FUNC_ENTER_API_THREADSAFE; \
+ FUNC_ENTER_API_INIT(err); \
+ {
+
/* Note: this macro only works when there's _no_ interface initialization routine for the module */
#define FUNC_ENTER_NOAPI_INIT(err) \
/* Initialize the package, if appropriate */ \
@@ -2358,6 +2373,16 @@ H5_DLL herr_t H5CX_pop(void);
return(ret_value); \
}}}} /*end scope from beginning of FUNC_ENTER*/
+/* Use this macro to match the FUNC_ENTER_API_NOPUSH macro */
+#define FUNC_LEAVE_API_NOPUSH(ret_value) \
+ ; \
+ } /*end scope from end of FUNC_ENTER*/ \
+ if(err_occurred) \
+ (void)H5E_dump_api_stack(TRUE); \
+ FUNC_LEAVE_API_THREADSAFE \
+ return(ret_value); \
+}}}}} /*end scope from beginning of FUNC_ENTER*/
+
#define FUNC_LEAVE_NOAPI(ret_value) \
; \
} /*end scope from end of FUNC_ENTER*/ \
diff --git a/test/accum.c b/test/accum.c
index fb07580..8006112 100644
--- a/test/accum.c
+++ b/test/accum.c
@@ -62,9 +62,9 @@ void accum_printf(const H5F_t *f);
/* Private Test H5Faccum Function Wrappers */
#define accum_write(a,s,b) H5F_block_write(f, H5FD_MEM_DEFAULT, (haddr_t)(a), (size_t)(s), (b))
#define accum_read(a,s,b) H5F_block_read(f, H5FD_MEM_DEFAULT, (haddr_t)(a), (size_t)(s), (b))
-#define accum_free(f,a,s) H5F__accum_free(f, H5FD_MEM_DEFAULT, (haddr_t)(a), (hsize_t)(s))
-#define accum_flush(f) H5F__accum_flush(f)
-#define accum_reset(f) H5F__accum_reset(f, TRUE)
+#define accum_free(f,a,s) H5F__accum_free(f->shared, H5FD_MEM_DEFAULT, (haddr_t)(a), (hsize_t)(s))
+#define accum_flush(f) H5F__accum_flush(f->shared)
+#define accum_reset(f) H5F__accum_reset(f->shared, TRUE)
/* ================= */
/* Main Test Routine */
diff --git a/test/mount.c b/test/mount.c
index b7d2858..181b8cb 100644
--- a/test/mount.c
+++ b/test/mount.c
@@ -404,39 +404,42 @@ test_hide(hid_t fapl)
char filename1[1024], filename2[1024];
TESTING("name hiding under mount point");
- h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1);
- h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2);
+ h5_fixname(FILENAME[0], fapl, filename1, sizeof(filename1));
+ h5_fixname(FILENAME[1], fapl, filename2, sizeof(filename2));
if((file1 = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0 ||
(file2 = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0)
FAIL_STACK_ERROR
/* Get information about file1:/mnt1/file1 for later */
- if(H5Oget_info_by_name2(file1, "/mnt1/file1", &oi1, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if(H5Oget_info_by_name2(file1, "/mnt1/file1", &oi1, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Build the virtual file */
- if(H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if(H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Original names under file1:/mnt1 should not be accessible */
H5E_BEGIN_TRY {
- grp = H5Gopen2(file1, "/mnt1/file1", H5P_DEFAULT);
+ grp = H5Gopen2(file1, "/mnt1/file1", H5P_DEFAULT);
} H5E_END_TRY;
if(grp >= 0) {
- H5_FAILED();
- HDputs(" Name is still accessible under mount point.");
- TEST_ERROR
- } /* end if */
+ H5_FAILED();
+ HDputs(" Name is still accessible under mount point.");
+ TEST_ERROR
+ }
/*
* The original objects under file1:/mnt1 are still accessible by their
* other names. This is a rather stupid test but demonstrates a point.
*/
- if(H5Oget_info_by_name2(file1, "/file1", &oi2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if(H5Oget_info_by_name2(file1, "/file1", &oi2, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
if(oi1.fileno != oi2.fileno || H5F_addr_ne(oi1.addr, oi2.addr)) {
- H5_FAILED();
- HDputs(" Hard link failed for hidden object.");
- TEST_ERROR
- } /* end if */
+ H5_FAILED();
+ HDputs(" Hard link failed for hidden object.");
+ TEST_ERROR
+ }
/* Unmount and close objects */
if(H5Funmount(file1, "/mnt1") < 0) FAIL_STACK_ERROR
@@ -448,9 +451,9 @@ test_hide(hid_t fapl)
error:
H5E_BEGIN_TRY {
- H5Gclose(grp);
- H5Fclose(file1);
- H5Fclose(file2);
+ H5Gclose(grp);
+ H5Fclose(file1);
+ H5Fclose(file2);
} H5E_END_TRY;
return 1;
} /* end test_hide() */
@@ -490,20 +493,23 @@ test_assoc(hid_t fapl)
FAIL_STACK_ERROR
/* Get information about the root of file2 */
- if(H5Oget_info2(file2, &oi1, H5O_INFO_BASIC) < 0) FAIL_STACK_ERROR
+ if(H5Oget_info2(file2, &oi1, H5O_INFO_BASIC) < 0)
+ FAIL_STACK_ERROR
/* Create the virtual file */
- if(H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if(H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/*
* Get info about the mount point -- should be the same as the root group
* of file2.
*/
- if(H5Oget_info_by_name2(file1, "/mnt1", &oi2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if(H5Oget_info_by_name2(file1, "/mnt1", &oi2, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
if(oi1.fileno != oi2.fileno || H5F_addr_ne(oi1.addr, oi2.addr)) {
- H5_FAILED();
- HDputs(" Association failed.");
+ H5_FAILED();
+ HDputs(" Association failed.");
TEST_ERROR
} /* end if */
@@ -517,8 +523,8 @@ test_assoc(hid_t fapl)
error:
H5E_BEGIN_TRY {
- H5Fclose(file2);
- H5Fclose(file1);
+ H5Fclose(file2);
+ H5Fclose(file1);
} H5E_END_TRY;
return 1;
} /* end test_assoc() */