summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/H5AC.c4
-rw-r--r--src/H5ACprivate.h2
-rw-r--r--src/H5C.c79
-rw-r--r--src/H5Centry.c58
-rw-r--r--src/H5Cint.c36
-rw-r--r--src/H5Cpkg.h9
-rw-r--r--src/H5Cprivate.h48
-rw-r--r--src/H5Ctag.c148
-rw-r--r--src/H5Fint.c103
-rw-r--r--src/H5Fpkg.h27
-rw-r--r--src/H5Ftest.c2
-rw-r--r--src/H5Oainfo.c6
-rw-r--r--src/H5Oattr.c4
-rw-r--r--src/H5Obogus.c7
-rw-r--r--src/H5Obtreek.c6
-rw-r--r--src/H5Ocache_image.c6
-rw-r--r--src/H5Ocont.c6
-rw-r--r--src/H5Odrvinfo.c7
-rw-r--r--src/H5Oefl.c6
-rw-r--r--src/H5Ofsinfo.c6
-rw-r--r--src/H5Oginfo.c6
-rw-r--r--src/H5Olayout.c6
-rw-r--r--src/H5Olinfo.c6
-rw-r--r--src/H5Olink.c6
-rw-r--r--src/H5Omessage.c4
-rw-r--r--src/H5Omtime.c16
-rw-r--r--src/H5Oname.c6
-rw-r--r--src/H5Opkg.h2
-rw-r--r--src/H5Orefcount.c7
-rw-r--r--src/H5Oshared.h2
-rw-r--r--src/H5Oshmesg.c6
-rw-r--r--src/H5Ostab.c6
-rw-r--r--src/H5Pfapl.c18
33 files changed, 306 insertions, 355 deletions
diff --git a/src/H5AC.c b/src/H5AC.c
index 802ccdd..b752803 100644
--- a/src/H5AC.c
+++ b/src/H5AC.c
@@ -459,7 +459,7 @@ H5AC_dest(H5F_t *f)
*/
if (H5F_ACC_RDWR & H5F_INTENT(f)) {
/* enable and load the skip list */
- if (H5C_set_slist_enabled(f->shared->cache, true, false) < 0)
+ if (H5C_set_slist_enabled(f->shared->cache, true, true) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "can't enable skip list");
if (H5AC__flush_entries(f) < 0)
@@ -1127,7 +1127,7 @@ H5AC_prep_for_file_flush(H5F_t *f)
assert(f->shared);
assert(f->shared->cache);
- if (H5C_set_slist_enabled(f->shared->cache, true, false) < 0)
+ if (H5C_set_slist_enabled(f->shared->cache, true, true) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "can't enable skip list");
done:
diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h
index 5e23036..51f1b35 100644
--- a/src/H5ACprivate.h
+++ b/src/H5ACprivate.h
@@ -312,14 +312,12 @@ typedef struct H5AC_proxy_entry_t {
*/
#define H5AC__NO_FLAGS_SET H5C__NO_FLAGS_SET
-#define H5AC__SET_FLUSH_MARKER_FLAG H5C__SET_FLUSH_MARKER_FLAG
#define H5AC__DELETED_FLAG H5C__DELETED_FLAG
#define H5AC__DIRTIED_FLAG H5C__DIRTIED_FLAG
#define H5AC__PIN_ENTRY_FLAG H5C__PIN_ENTRY_FLAG
#define H5AC__UNPIN_ENTRY_FLAG H5C__UNPIN_ENTRY_FLAG
#define H5AC__FLUSH_INVALIDATE_FLAG H5C__FLUSH_INVALIDATE_FLAG
#define H5AC__FLUSH_CLEAR_ONLY_FLAG H5C__FLUSH_CLEAR_ONLY_FLAG
-#define H5AC__FLUSH_MARKED_ENTRIES_FLAG H5C__FLUSH_MARKED_ENTRIES_FLAG
#define H5AC__FLUSH_IGNORE_PROTECTED_FLAG H5C__FLUSH_IGNORE_PROTECTED_FLAG
#define H5AC__READ_ONLY_FLAG H5C__READ_ONLY_FLAG
#define H5AC__FREE_FILE_SPACE_FLAG H5C__FREE_FILE_SPACE_FLAG
diff --git a/src/H5C.c b/src/H5C.c
index eb6e49e..1713e83 100644
--- a/src/H5C.c
+++ b/src/H5C.c
@@ -493,7 +493,7 @@ H5C_dest(H5F_t *f)
#endif /* H5AC_DUMP_IMAGE_STATS_ON_CLOSE */
/* Enable the slist, as it is needed in the flush */
- if (H5C_set_slist_enabled(f->shared->cache, true, false) < 0)
+ if (H5C_set_slist_enabled(f->shared->cache, true, true) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "set slist enabled failed");
/* Flush and invalidate all cache entries */
@@ -567,7 +567,7 @@ H5C_evict(H5F_t *f)
assert(f);
/* Enable the slist, as it is needed in the flush */
- if (H5C_set_slist_enabled(f->shared->cache, true, false) < 0)
+ if (H5C_set_slist_enabled(f->shared->cache, true, true) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "set slist enabled failed");
/* Flush and invalidate all cache entries except the pinned entries */
@@ -575,7 +575,7 @@ H5C_evict(H5F_t *f)
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to evict entries in the cache");
/* Disable the slist */
- if (H5C_set_slist_enabled(f->shared->cache, false, true) < 0)
+ if (H5C_set_slist_enabled(f->shared->cache, false, false) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "set slist disabled failed");
done:
@@ -1042,41 +1042,32 @@ done:
*
* 1) Verifies that the slist is empty.
*
- * 2) Scans the index list, and inserts all dirty entries
- * into the slist.
+ * 2) If the populate_slist parameter is true, scans the
+ * index list, and inserts all dirty entries into the
+ * slist.
*
* 3) Sets cache_ptr->slist_enabled = true.
*
- * Note that the clear_slist parameter is ignored if
- * the slist_enabed parameter is true.
- *
*
* If the slist_enabled_parameter is false, the function
- * shuts down the slist.
- *
- * Normally the slist will be empty at this point, however
- * that need not be the case if H5C_flush_cache() has been
- * called with the H5C__FLUSH_MARKED_ENTRIES_FLAG.
- *
- * Thus shutdown proceeds as follows:
+ * shuts down the slist:
*
* 1) Test to see if the slist is empty. If it is, proceed
* to step 3.
*
- * 2) Test to see if the clear_slist parameter is true.
- *
- * If it is, remove all entries from the slist.
- *
- * If it isn't, throw an error.
+ * 2) Remove all entries from the slist.
*
* 3) set cache_ptr->slist_enabled = false.
*
+ * Note that the populate_slist parameter is ignored if
+ * the slist_enabed parameter is false.
+ *
* Return: SUCCEED on success, and FAIL on failure.
*
*-------------------------------------------------------------------------
*/
herr_t
-H5C_set_slist_enabled(H5C_t *cache_ptr, bool slist_enabled, bool clear_slist)
+H5C_set_slist_enabled(H5C_t *cache_ptr, bool slist_enabled, bool populate_slist)
{
H5C_cache_entry_t *entry_ptr;
herr_t ret_value = SUCCEED; /* Return value */
@@ -1097,40 +1088,30 @@ H5C_set_slist_enabled(H5C_t *cache_ptr, bool slist_enabled, bool clear_slist)
*/
cache_ptr->slist_enabled = true;
- /* scan the index list and insert all dirty entries in the slist */
- entry_ptr = cache_ptr->il_head;
- while (entry_ptr != NULL) {
- if (entry_ptr->is_dirty)
- H5C__INSERT_ENTRY_IN_SLIST(cache_ptr, entry_ptr, FAIL);
- entry_ptr = entry_ptr->il_next;
- }
+ if (populate_slist) {
+ /* scan the index list and insert all dirty entries in the slist */
+ entry_ptr = cache_ptr->il_head;
+ while (entry_ptr != NULL) {
+ if (entry_ptr->is_dirty)
+ H5C__INSERT_ENTRY_IN_SLIST(cache_ptr, entry_ptr, FAIL);
+ entry_ptr = entry_ptr->il_next;
+ }
- /* we don't maintain a dirty index len, so we can't do a cross
- * check against it. Note that there is no point in cross checking
- * against the dirty LRU size, as the dirty LRU may not be maintained,
- * and in any case, there is no requirement that all dirty entries
- * will reside on the dirty LRU.
- */
- assert(cache_ptr->dirty_index_size == cache_ptr->slist_size);
+ /* we don't maintain a dirty index len, so we can't do a cross
+ * check against it. Note that there is no point in cross checking
+ * against the dirty LRU size, as the dirty LRU may not be maintained,
+ * and in any case, there is no requirement that all dirty entries
+ * will reside on the dirty LRU.
+ */
+ assert(cache_ptr->dirty_index_size == cache_ptr->slist_size);
+ }
}
else { /* take down the skip list */
if (!cache_ptr->slist_enabled)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "slist already disabled?");
- if ((cache_ptr->slist_len != 0) || (cache_ptr->slist_size != 0)) {
- if (clear_slist) {
- H5SL_node_t *node_ptr;
-
- node_ptr = H5SL_first(cache_ptr->slist_ptr);
- while (node_ptr != NULL) {
- entry_ptr = (H5C_cache_entry_t *)H5SL_item(node_ptr);
- H5C__REMOVE_ENTRY_FROM_SLIST(cache_ptr, entry_ptr, false, FAIL);
- node_ptr = H5SL_first(cache_ptr->slist_ptr);
- }
- }
- else
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "slist not empty?");
- }
+ if ((cache_ptr->slist_len != 0) || (cache_ptr->slist_size != 0))
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "slist not empty?");
cache_ptr->slist_enabled = false;
diff --git a/src/H5Centry.c b/src/H5Centry.c
index 2bbf9ac..fec1f4a 100644
--- a/src/H5Centry.c
+++ b/src/H5Centry.c
@@ -503,36 +503,24 @@ H5C__flush_single_entry(H5F_t *f, H5C_cache_entry_t *entry_ptr, unsigned flags)
if (cache_ptr->slist_enabled) {
if (entry_ptr->in_slist) {
assert(entry_ptr->is_dirty);
- if (entry_ptr->flush_marker && !entry_ptr->is_dirty)
+ if (!entry_ptr->is_dirty)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "entry in slist failed sanity checks");
} /* end if */
- else {
- assert(!entry_ptr->is_dirty);
- assert(!entry_ptr->flush_marker);
- if (entry_ptr->is_dirty || entry_ptr->flush_marker)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "entry failed sanity checks");
- } /* end else */
}
- else { /* slist is disabled */
+ else /* slist is disabled */
assert(!entry_ptr->in_slist);
- if (!entry_ptr->is_dirty)
- if (entry_ptr->flush_marker)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "flush marked clean entry?");
- }
#endif /* H5C_DO_SANITY_CHECKS */
if (entry_ptr->is_protected)
/* Attempt to flush a protected entry -- scream and die. */
HGOTO_ERROR(H5E_CACHE, H5E_PROTECT, FAIL, "Attempt to flush a protected entry");
- /* Set entry_ptr->flush_in_progress = true and set
- * entry_ptr->flush_marker = false
+ /* Set entry_ptr->flush_in_progress = true
*
* We will set flush_in_progress back to false at the end if the
* entry still exists at that point.
*/
entry_ptr->flush_in_progress = true;
- entry_ptr->flush_marker = false;
/* Preserve current dirty state for later */
was_dirty = entry_ptr->is_dirty;
@@ -1240,7 +1228,6 @@ H5C__load_entry(H5F_t *f,
entry->ro_ref_count = 0;
entry->is_pinned = false;
entry->in_slist = false;
- entry->flush_marker = false;
#ifdef H5_HAVE_PARALLEL
entry->clear_on_unprotect = false;
entry->flush_immediately = false;
@@ -1897,7 +1884,6 @@ H5C__deserialize_prefetched_entry(H5F_t *f, H5C_t *cache_ptr, H5C_cache_entry_t
ds_entry_ptr->ro_ref_count = 0;
ds_entry_ptr->is_pinned = false;
ds_entry_ptr->in_slist = false;
- ds_entry_ptr->flush_marker = false;
#ifdef H5_HAVE_PARALLEL
ds_entry_ptr->clear_on_unprotect = false;
ds_entry_ptr->flush_immediately = false;
@@ -2095,7 +2081,6 @@ H5C_insert_entry(H5F_t *f, const H5C_class_t *type, haddr_t addr, void *thing, u
#ifdef H5_HAVE_PARALLEL
bool coll_access = false; /* whether access to the cache entry is done collectively */
#endif /* H5_HAVE_PARALLEL */
- bool set_flush_marker;
bool write_permitted = true;
size_t empty_space;
H5C_cache_entry_t *entry_ptr = NULL;
@@ -2125,9 +2110,8 @@ H5C_insert_entry(H5F_t *f, const H5C_class_t *type, haddr_t addr, void *thing, u
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on entry");
#endif /* H5C_DO_EXTREME_SANITY_CHECKS */
- 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);
+ insert_pinned = ((flags & H5C__PIN_ENTRY_FLAG) != 0);
+ flush_last = ((flags & H5C__FLUSH_LAST_FLAG) != 0);
/* Get the ring type from the API context */
ring = H5CX_get_ring();
@@ -2301,7 +2285,6 @@ H5C_insert_entry(H5F_t *f, const H5C_class_t *type, haddr_t addr, void *thing, u
/* New entries are presumed to be dirty */
assert(entry_ptr->is_dirty);
- entry_ptr->flush_marker = set_flush_marker;
H5C__INSERT_ENTRY_IN_SLIST(cache_ptr, entry_ptr, FAIL);
H5C__UPDATE_RP_FOR_INSERTION(cache_ptr, entry_ptr, FAIL);
@@ -2497,9 +2480,6 @@ H5C_mark_entry_clean(void *_thing)
/* Mark the entry as clean if it isn't already */
entry_ptr->is_dirty = false;
- /* Also reset the 'flush_marker' flag, since the entry shouldn't be flushed now */
- entry_ptr->flush_marker = false;
-
/* Modify cache data structures */
if (was_dirty)
H5C__UPDATE_INDEX_FOR_ENTRY_CLEAN(cache_ptr, entry_ptr, FAIL);
@@ -3426,7 +3406,6 @@ H5C_unprotect(H5F_t *f, haddr_t addr, void *thing, unsigned flags)
H5C_t *cache_ptr;
bool deleted;
bool dirtied;
- bool set_flush_marker;
bool pin_entry;
bool unpin_entry;
bool free_file_space;
@@ -3441,13 +3420,12 @@ H5C_unprotect(H5F_t *f, haddr_t addr, void *thing, unsigned flags)
FUNC_ENTER_NOAPI(FAIL)
- deleted = ((flags & H5C__DELETED_FLAG) != 0);
- dirtied = ((flags & H5C__DIRTIED_FLAG) != 0);
- set_flush_marker = ((flags & H5C__SET_FLUSH_MARKER_FLAG) != 0);
- pin_entry = ((flags & H5C__PIN_ENTRY_FLAG) != 0);
- unpin_entry = ((flags & H5C__UNPIN_ENTRY_FLAG) != 0);
- free_file_space = ((flags & H5C__FREE_FILE_SPACE_FLAG) != 0);
- take_ownership = ((flags & H5C__TAKE_OWNERSHIP_FLAG) != 0);
+ deleted = ((flags & H5C__DELETED_FLAG) != 0);
+ dirtied = ((flags & H5C__DIRTIED_FLAG) != 0);
+ pin_entry = ((flags & H5C__PIN_ENTRY_FLAG) != 0);
+ unpin_entry = ((flags & H5C__UNPIN_ENTRY_FLAG) != 0);
+ free_file_space = ((flags & H5C__FREE_FILE_SPACE_FLAG) != 0);
+ take_ownership = ((flags & H5C__TAKE_OWNERSHIP_FLAG) != 0);
assert(f);
assert(f->shared);
@@ -3621,15 +3599,10 @@ H5C_unprotect(H5F_t *f, haddr_t addr, void *thing, unsigned flags)
entry_ptr->is_protected = false;
- /* if the entry is dirty, 'or' its flush_marker with the set flush flag,
- * and then add it to the skip list if it isn't there already.
- */
- if (entry_ptr->is_dirty) {
- entry_ptr->flush_marker |= set_flush_marker;
- if (!entry_ptr->in_slist)
- /* this is a no-op if cache_ptr->slist_enabled is false */
- H5C__INSERT_ENTRY_IN_SLIST(cache_ptr, entry_ptr, FAIL);
- } /* end if */
+ /* if the entry is dirty, add it to the skip list if it isn't there already. */
+ if (entry_ptr->is_dirty && !entry_ptr->in_slist)
+ /* this is a no-op if cache_ptr->slist_enabled is false */
+ H5C__INSERT_ENTRY_IN_SLIST(cache_ptr, entry_ptr, FAIL);
/* This implementation of the "deleted" option is a bit inefficient, as
* we re-insert the entry to be deleted into the replacement policy
@@ -4141,7 +4114,6 @@ H5C_remove_entry(void *_entry)
/* Additional internal cache consistency checks */
assert(!entry->in_slist);
- assert(!entry->flush_marker);
assert(!entry->flush_in_progress);
/* Note that the algorithm below is (very) similar to the set of operations
diff --git a/src/H5Cint.c b/src/H5Cint.c
index 31a947a..2e79a0d 100644
--- a/src/H5Cint.c
+++ b/src/H5Cint.c
@@ -1207,10 +1207,10 @@ H5C__flush_invalidate_ring(H5F_t *f, H5C_ring_t ring, unsigned flags)
old_ring_pel_len = cur_ring_pel_len;
while (cache_ptr->index_ring_len[ring] > 0) {
- /* first, try to flush-destroy any dirty entries. Do this by
+ /* First, try to flush-destroy any dirty entries. Do this by
* making a scan through the slist. Note that new dirty entries
- * may be created by the flush call backs. Thus it is possible
- * that the slist will not be empty after we finish the scan.
+ * may be created by the flush call back, thus we may need to
+ * restart the scan (see below).
*/
#ifdef H5C_DO_SANITY_CHECKS
@@ -1573,7 +1573,6 @@ H5C__flush_ring(H5F_t *f, H5C_ring_t ring, unsigned flags)
{
H5C_t *cache_ptr = f->shared->cache;
bool flushed_entries_last_pass;
- bool flush_marked_entries;
bool ignore_protected;
bool tried_to_flush_protected_entry = false;
bool restart_slist_scan;
@@ -1603,12 +1602,10 @@ H5C__flush_ring(H5F_t *f, H5C_ring_t ring, unsigned flags)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on entry");
#endif /* H5C_DO_EXTREME_SANITY_CHECKS */
- ignore_protected = ((flags & H5C__FLUSH_IGNORE_PROTECTED_FLAG) != 0);
- flush_marked_entries = ((flags & H5C__FLUSH_MARKED_ENTRIES_FLAG) != 0);
+ ignore_protected = ((flags & H5C__FLUSH_IGNORE_PROTECTED_FLAG) != 0);
- if (!flush_marked_entries)
- for (i = (int)H5C_RING_UNDEFINED; i < (int)ring; i++)
- assert(cache_ptr->slist_ring_len[i] == 0);
+ for (i = (int)H5C_RING_UNDEFINED; i < (int)ring; i++)
+ assert(cache_ptr->slist_ring_len[i] == 0);
assert(cache_ptr->flush_in_progress);
@@ -1712,9 +1709,7 @@ H5C__flush_ring(H5F_t *f, H5C_ring_t ring, unsigned flags)
*/
assert(entry_ptr->in_slist);
assert(entry_ptr->is_dirty);
-
- if (!flush_marked_entries || entry_ptr->flush_marker)
- assert(entry_ptr->ring >= ring);
+ assert(entry_ptr->ring >= ring);
/* Advance node pointer now, before we delete its target
* from the slist.
@@ -1727,19 +1722,14 @@ H5C__flush_ring(H5F_t *f, H5C_ring_t ring, unsigned flags)
assert(next_entry_ptr->is_dirty);
assert(next_entry_ptr->in_slist);
-
- if (!flush_marked_entries || next_entry_ptr->flush_marker)
- assert(next_entry_ptr->ring >= ring);
-
+ assert(next_entry_ptr->ring >= ring);
assert(entry_ptr != next_entry_ptr);
} /* end if */
else
next_entry_ptr = NULL;
- if ((!flush_marked_entries || entry_ptr->flush_marker) &&
- ((!entry_ptr->flush_me_last) ||
- ((entry_ptr->flush_me_last) && ((cache_ptr->num_last_entries >= cache_ptr->slist_len) ||
- (flush_marked_entries && entry_ptr->flush_marker)))) &&
+ if (((!entry_ptr->flush_me_last) ||
+ ((entry_ptr->flush_me_last) && cache_ptr->num_last_entries >= cache_ptr->slist_len)) &&
((entry_ptr->flush_dep_nchildren == 0) || (entry_ptr->flush_dep_ndirty_children == 0)) &&
(entry_ptr->ring == ring)) {
@@ -1790,10 +1780,8 @@ H5C__flush_ring(H5F_t *f, H5C_ring_t ring, unsigned flags)
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "cache has protected items");
#ifdef H5C_DO_SANITY_CHECKS
- if (!flush_marked_entries) {
- assert(cache_ptr->slist_ring_len[ring] == 0);
- assert(cache_ptr->slist_ring_size[ring] == 0);
- } /* end if */
+ assert(cache_ptr->slist_ring_len[ring] == 0);
+ assert(cache_ptr->slist_ring_size[ring] == 0);
#endif /* H5C_DO_SANITY_CHECKS */
done:
diff --git a/src/H5Cpkg.h b/src/H5Cpkg.h
index 5417684..4408774 100644
--- a/src/H5Cpkg.h
+++ b/src/H5Cpkg.h
@@ -2168,15 +2168,14 @@ typedef struct H5C_tag_info_t {
* insert all dirtly entries in the skip list, and enable operations
* on skip list by setting above control flag to true.
*
+ * In the case of a partial flush (i.e. flush tagged entries), we only
+ * add tagged entries to the skip list, thus avoiding unnecessary scans
+ * over the entire cache.
+ *
* At the end of a complete flush, we verify that the skip list is empty,
* and set the control flag back to false, so as to avoid skip list
* maintenance overhead until the next flush or close.
*
- * In the case of a partial flush (i.e. flush marked entries), we remove
- * all remaining entries from the skip list, and then set the control flag
- * back to false -- again avoiding skip list maintenance overhead until
- * the next flush or close.
- *
* slist_enabled: Boolean flag used to control operation of the skip
* list. If this filed is false, operations on the slist are
* no-ops, and the slist must be empty. If it is true,
diff --git a/src/H5Cprivate.h b/src/H5Cprivate.h
index 3477e75..9f12312 100644
--- a/src/H5Cprivate.h
+++ b/src/H5Cprivate.h
@@ -134,7 +134,6 @@
*
*
* These flags apply to H5C_insert_entry():
- * H5C__SET_FLUSH_MARKER_FLAG
* H5C__PIN_ENTRY_FLAG
* H5C__FLUSH_LAST_FLAG ; super block only
* H5C__FLUSH_COLLECTIVELY_FLAG ; super block only
@@ -145,7 +144,6 @@
* H5C__FLUSH_COLLECTIVELY_FLAG ; super block only
*
* These flags apply to H5C_unprotect():
- * H5C__SET_FLUSH_MARKER_FLAG
* H5C__DELETED_FLAG
* H5C__DIRTIED_FLAG
* H5C__PIN_ENTRY_FLAG
@@ -162,7 +160,6 @@
* These flags apply to H5C_flush_cache():
* H5C__FLUSH_INVALIDATE_FLAG
* H5C__FLUSH_CLEAR_ONLY_FLAG
- * H5C__FLUSH_MARKED_ENTRIES_FLAG
* H5C__FLUSH_IGNORE_PROTECTED_FLAG (can't use this flag in combination
* with H5C__FLUSH_INVALIDATE_FLAG)
* H5C__DURING_FLUSH_FLAG
@@ -170,32 +167,29 @@
* These flags apply to H5C_flush_single_entry():
* H5C__FLUSH_INVALIDATE_FLAG
* H5C__FLUSH_CLEAR_ONLY_FLAG
- * H5C__FLUSH_MARKED_ENTRIES_FLAG
* H5C__TAKE_OWNERSHIP_FLAG
* H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG
* H5C__GENERATE_IMAGE_FLAG
* H5C__UPDATE_PAGE_BUFFER_FLAG
*/
#define H5C__NO_FLAGS_SET 0x00000
-#define H5C__SET_FLUSH_MARKER_FLAG 0x00001
-#define H5C__DELETED_FLAG 0x00002
-#define H5C__DIRTIED_FLAG 0x00004
-#define H5C__PIN_ENTRY_FLAG 0x00008
-#define H5C__UNPIN_ENTRY_FLAG 0x00010
-#define H5C__FLUSH_INVALIDATE_FLAG 0x00020
-#define H5C__FLUSH_CLEAR_ONLY_FLAG 0x00040
-#define H5C__FLUSH_MARKED_ENTRIES_FLAG 0x00080
-#define H5C__FLUSH_IGNORE_PROTECTED_FLAG 0x00100
-#define H5C__READ_ONLY_FLAG 0x00200
-#define H5C__FREE_FILE_SPACE_FLAG 0x00400
-#define H5C__TAKE_OWNERSHIP_FLAG 0x00800
-#define H5C__FLUSH_LAST_FLAG 0x01000
-#define H5C__FLUSH_COLLECTIVELY_FLAG 0x02000
-#define H5C__EVICT_ALLOW_LAST_PINS_FLAG 0x04000
-#define H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG 0x08000
-#define H5C__DURING_FLUSH_FLAG 0x10000 /* Set when the entire cache is being flushed */
-#define H5C__GENERATE_IMAGE_FLAG 0x20000 /* Set during parallel I/O */
-#define H5C__UPDATE_PAGE_BUFFER_FLAG 0x40000 /* Set during parallel I/O */
+#define H5C__DELETED_FLAG 0x00001
+#define H5C__DIRTIED_FLAG 0x00002
+#define H5C__PIN_ENTRY_FLAG 0x00004
+#define H5C__UNPIN_ENTRY_FLAG 0x00008
+#define H5C__FLUSH_INVALIDATE_FLAG 0x00010
+#define H5C__FLUSH_CLEAR_ONLY_FLAG 0x00020
+#define H5C__FLUSH_IGNORE_PROTECTED_FLAG 0x00040
+#define H5C__READ_ONLY_FLAG 0x00080
+#define H5C__FREE_FILE_SPACE_FLAG 0x00100
+#define H5C__TAKE_OWNERSHIP_FLAG 0x00200
+#define H5C__FLUSH_LAST_FLAG 0x00400
+#define H5C__FLUSH_COLLECTIVELY_FLAG 0x00800
+#define H5C__EVICT_ALLOW_LAST_PINS_FLAG 0x01000
+#define H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG 0x02000
+#define H5C__DURING_FLUSH_FLAG 0x04000 /* Set when the entire cache is being flushed */
+#define H5C__GENERATE_IMAGE_FLAG 0x08000 /* Set during parallel I/O */
+#define H5C__UPDATE_PAGE_BUFFER_FLAG 0x10000 /* Set during parallel I/O */
/* Debugging/sanity checking/statistics settings */
/* #define H5C_DO_SANITY_CHECKS */
@@ -1074,11 +1068,6 @@ typedef int H5C_ring_t;
* As a general rule, entries are placed in the list when they are
* marked dirty.
*
- * flush_marker: Boolean flag indicating that the entry is to be flushed
- * the next time H5C_flush_cache() is called with the
- * H5C__FLUSH_MARKED_ENTRIES_FLAG. The flag is reset when
- * the entry is flushed for whatever reason.
- *
* flush_me_last: Boolean flag indicating that this entry should not be
* flushed from the cache until all other entries without the
* flush_me_last flag set have been flushed.
@@ -1557,7 +1546,6 @@ typedef struct H5C_cache_entry_t {
int ro_ref_count;
bool is_pinned;
bool in_slist;
- bool flush_marker;
bool flush_me_last;
#ifdef H5_HAVE_PARALLEL
bool clear_on_unprotect;
@@ -2207,7 +2195,7 @@ H5_DLL herr_t H5C_resize_entry(void *thing, size_t new_size);
H5_DLL herr_t H5C_set_cache_auto_resize_config(H5C_t *cache_ptr, H5C_auto_size_ctl_t *config_ptr);
H5_DLL herr_t H5C_set_cache_image_config(const H5F_t *f, H5C_t *cache_ptr, H5C_cache_image_ctl_t *config_ptr);
H5_DLL herr_t H5C_set_evictions_enabled(H5C_t *cache_ptr, bool evictions_enabled);
-H5_DLL herr_t H5C_set_slist_enabled(H5C_t *cache_ptr, bool slist_enabled, bool clear_slist);
+H5_DLL herr_t H5C_set_slist_enabled(H5C_t *cache_ptr, bool slist_enabled, bool populate_slist);
H5_DLL herr_t H5C_set_prefix(H5C_t *cache_ptr, char *prefix);
H5_DLL herr_t H5C_stats(H5C_t *cache_ptr, const char *cache_name, bool display_detailed_stats);
H5_DLL void H5C_stats__reset(H5C_t *cache_ptr);
diff --git a/src/H5Ctag.c b/src/H5Ctag.c
index a1a9f42..8da6c13 100644
--- a/src/H5Ctag.c
+++ b/src/H5Ctag.c
@@ -80,8 +80,6 @@ typedef struct {
/* Local Prototypes */
/********************/
static herr_t H5C__iter_tagged_entries_real(H5C_t *cache, haddr_t tag, H5C_tag_iter_cb_t cb, void *cb_ctx);
-static herr_t H5C__mark_tagged_entries(H5C_t *cache, haddr_t tag);
-static herr_t H5C__flush_marked_entries(H5F_t *f);
/*********************/
/* Package Variables */
@@ -520,101 +518,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C_evict_tagged_entries() */
-/*-------------------------------------------------------------------------
- * Function: H5C__mark_tagged_entries_cb
- *
- * Purpose: Callback to set the flush marker on dirty entries in the cache
- *
- * Return: H5_ITER_CONT (can't fail)
- *
- *-------------------------------------------------------------------------
- */
-static int
-H5C__mark_tagged_entries_cb(H5C_cache_entry_t *entry, void H5_ATTR_UNUSED *_ctx)
-{
- /* Function enter macro */
- FUNC_ENTER_PACKAGE_NOERR
-
- /* Sanity checks */
- assert(entry);
-
- /* We only want to set the flush marker on entries that
- * actually need flushed (i.e., dirty ones) */
- if (entry->is_dirty)
- entry->flush_marker = true;
-
- FUNC_LEAVE_NOAPI(H5_ITER_CONT)
-} /* H5C__mark_tagged_entries_cb() */
-
-/*-------------------------------------------------------------------------
- * Function: H5C__mark_tagged_entries
- *
- * Purpose: Set the flush marker on dirty entries in the cache that have
- * the specified tag, as well as all globally tagged entries.
- *
- * Return: FAIL if error is detected, SUCCEED otherwise.
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5C__mark_tagged_entries(H5C_t *cache, haddr_t tag)
-{
- herr_t ret_value = SUCCEED; /* Return value */
-
- /* Function enter macro */
- FUNC_ENTER_PACKAGE
-
- /* Sanity check */
- assert(cache);
-
- /* Iterate through hash table entries, marking those with specified tag, as
- * well as any major global entries which should always be flushed
- * when flushing based on tag value */
- if (H5C__iter_tagged_entries(cache, tag, true, H5C__mark_tagged_entries_cb, NULL) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_BADITER, FAIL, "Iteration of tagged entries failed");
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5C__mark_tagged_entries() */
-
-/*-------------------------------------------------------------------------
- * Function: H5C__flush_marked_entries
- *
- * Purpose: Flushes all marked entries in the cache.
- *
- * Return: FAIL if error is detected, SUCCEED otherwise.
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5C__flush_marked_entries(H5F_t *f)
-{
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_PACKAGE
-
- /* Assertions */
- assert(f != NULL);
-
- /* Enable the slist, as it is needed in the flush */
- if (H5C_set_slist_enabled(f->shared->cache, true, false) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "set slist enabled failed");
-
- /* Flush all marked entries */
- if (H5C_flush_cache(f, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_IGNORE_PROTECTED_FLAG) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't flush cache");
-
- /* Disable the slist. Set the clear_slist parameter to true
- * since we called H5C_flush_cache() with the
- * H5C__FLUSH_MARKED_ENTRIES_FLAG.
- */
- if (H5C_set_slist_enabled(f->shared->cache, false, true) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "disable slist failed");
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5C__flush_marked_entries */
-
#ifdef H5C_DO_TAGGING_SANITY_CHECKS
/*-------------------------------------------------------------------------
@@ -685,6 +588,36 @@ done:
#endif
/*-------------------------------------------------------------------------
+ * Function: H5C__flush_tagged_entries_cb
+ *
+ * Purpose: Callback to set the flush marker on dirty entries in the cache
+ *
+ * Return: H5_ITER_CONT (can't fail)
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+H5C__flush_tagged_entries_cb(H5C_cache_entry_t *entry, void *_ctx)
+{
+ H5C_t *cache_ptr = (H5C_t *)_ctx;
+ int ret_value = H5_ITER_CONT;
+
+ /* Function enter macro */
+ FUNC_ENTER_PACKAGE
+
+ /* Sanity checks */
+ assert(entry);
+ assert(cache_ptr);
+
+ /* We only want to add entries to the slist that actually need flushed (i.e., dirty ones) */
+ if (entry->is_dirty)
+ H5C__INSERT_ENTRY_IN_SLIST(cache_ptr, entry, H5_ITER_ERROR);
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__flush_tagged_entries_cb() */
+
+/*-------------------------------------------------------------------------
* Function: H5C_flush_tagged_entries
*
* Purpose: Flushes all entries with the specified tag to disk.
@@ -709,13 +642,22 @@ H5C_flush_tagged_entries(H5F_t *f, haddr_t tag)
/* Get cache pointer */
cache = f->shared->cache;
- /* Mark all entries with specified tag */
- if (H5C__mark_tagged_entries(cache, tag) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't mark tagged entries");
+ /* Enable the slist, as it is needed in the flush */
+ if (H5C_set_slist_enabled(f->shared->cache, true, false) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "set slist enabled failed");
+
+ /* Iterate through hash table entries, adding those with specified tag to the slist, as well as any major
+ * global entries which should always be flushed when flushing based on tag value */
+ if (H5C__iter_tagged_entries(cache, tag, true, H5C__flush_tagged_entries_cb, cache) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_BADITER, FAIL, "Iteration of tagged entries failed");
+
+ /* Flush all entries in the slist */
+ if (H5C_flush_cache(f, H5C__FLUSH_IGNORE_PROTECTED_FLAG) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't flush cache");
- /* Flush all marked entries */
- if (H5C__flush_marked_entries(f) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't flush marked entries");
+ /* Disable the slist */
+ if (H5C_set_slist_enabled(f->shared->cache, false, false) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "disable slist failed");
done:
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5Fint.c b/src/H5Fint.c
index 1feada6..7b5aeb4 100644
--- a/src/H5Fint.c
+++ b/src/H5Fint.c
@@ -79,7 +79,8 @@ static int H5F__get_objects_cb(void *obj_ptr, hid_t obj_id, void *key);
static herr_t H5F__build_name(const char *prefix, const char *file_name, char **full_name /*out*/);
static char *H5F__getenv_prefix_name(char **env_prefix /*in,out*/);
static H5F_t *H5F__new(H5F_shared_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_t *lf);
-static herr_t H5F__check_if_using_file_locks(H5P_genplist_t *fapl, bool *use_file_locking);
+static herr_t H5F__check_if_using_file_locks(H5P_genplist_t *fapl, bool *use_file_locking,
+ bool *ignore_disabled_locks);
static herr_t H5F__dest(H5F_t *f, bool flush, bool free_on_failure);
static herr_t H5F__build_actual_name(const H5F_t *f, const H5P_genplist_t *fapl, const char *name,
char ** /*out*/ actual_name);
@@ -94,7 +95,8 @@ static herr_t H5F__flush_phase2(H5F_t *f, bool closing);
* true/false have obvious meanings. FAIL means the environment variable was
* not set, so the code should ignore it and use the fapl value instead.
*/
-htri_t use_locks_env_g = FAIL;
+htri_t use_locks_env_g = FAIL;
+htri_t ignore_disabled_locks_g = FAIL;
/*****************************/
/* Library Private Variables */
@@ -140,7 +142,7 @@ H5F_init(void)
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to initialize interface");
/* Check the file locking environment variable */
- if (H5F__parse_file_lock_env_var(&use_locks_env_g) < 0)
+ if (H5F__parse_file_lock_env_var(&use_locks_env_g, &ignore_disabled_locks_g) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to parse file locking environment variable");
done:
@@ -237,7 +239,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5F__parse_file_lock_env_var(htri_t *use_locks)
+H5F__parse_file_lock_env_var(htri_t *use_locks, htri_t *ignore_disabled_locks)
{
char *lock_env_var = NULL; /* Environment variable pointer */
@@ -245,13 +247,23 @@ H5F__parse_file_lock_env_var(htri_t *use_locks)
/* Check the file locking environment variable */
lock_env_var = getenv(HDF5_USE_FILE_LOCKING);
- if (lock_env_var && (!strcmp(lock_env_var, "FALSE") || !strcmp(lock_env_var, "0")))
- *use_locks = false; /* Override: Never use locks */
- else if (lock_env_var && (!strcmp(lock_env_var, "TRUE") || !strcmp(lock_env_var, "BEST_EFFORT") ||
- !strcmp(lock_env_var, "1")))
- *use_locks = true; /* Override: Always use locks */
- else
- *use_locks = FAIL; /* Environment variable not set, or not set correctly */
+ if (lock_env_var && (!strcmp(lock_env_var, "FALSE") || !strcmp(lock_env_var, "0"))) {
+ *use_locks = false; /* Override: Never use locks */
+ *ignore_disabled_locks = FAIL;
+ }
+ else if (lock_env_var && !strcmp(lock_env_var, "BEST_EFFORT")) {
+ *use_locks = true; /* Override: Always use locks */
+ *ignore_disabled_locks = true; /* Override: Ignore disabled locks */
+ }
+ else if (lock_env_var && (!strcmp(lock_env_var, "TRUE") || !strcmp(lock_env_var, "1"))) {
+ *use_locks = true; /* Override: Always use locks */
+ *ignore_disabled_locks = false; /* Override: Don't ignore disabled locks */
+ }
+ else {
+ /* Environment variable not set, or not set correctly */
+ *use_locks = FAIL;
+ *ignore_disabled_locks = FAIL;
+ }
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5F__parse_file_lock_env_var() */
@@ -374,8 +386,13 @@ H5F_get_access_plist(H5F_t *f, bool app_ref)
if (H5P_set(new_plist, H5F_ACS_LIBVER_HIGH_BOUND_NAME, &f->shared->high_bound) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID,
"can't set 'high' bound for library format versions");
+ if (H5P_set(new_plist, H5F_ACS_USE_FILE_LOCKING_NAME, &f->shared->use_file_locking) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set file locking property");
+ if (H5P_set(new_plist, H5F_ACS_IGNORE_DISABLED_FILE_LOCKS_NAME, &f->shared->ignore_disabled_locks) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID,
+ "can't set 'ignore disabled file locks' property");
if (H5P_set(new_plist, H5F_ACS_METADATA_READ_ATTEMPTS_NAME, &(f->shared->read_attempts)) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set 'read attempts ' flag");
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set 'read attempts' flag");
if (H5P_set(new_plist, H5F_ACS_OBJECT_FLUSH_CB_NAME, &(f->shared->object_flush)) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set object flush callback");
@@ -1644,7 +1661,9 @@ H5F__dest(H5F_t *f, bool flush, bool free_on_failure)
/*-------------------------------------------------------------------------
* Function: H5F__check_if_using_file_locks
*
- * Purpose: Determines if this file will use file locks.
+ * Purpose: Determines if this file will use file locks and whether or
+ * not to ignore the case where file locking is disabled on
+ * the file system.
*
* There are three ways that file locking can be controlled:
*
@@ -1665,22 +1684,35 @@ H5F__dest(H5F_t *f, bool flush, bool free_on_failure)
*-------------------------------------------------------------------------
*/
static herr_t
-H5F__check_if_using_file_locks(H5P_genplist_t *fapl, bool *use_file_locking)
+H5F__check_if_using_file_locks(H5P_genplist_t *fapl, bool *use_file_locking, bool *ignore_disabled_locks)
{
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
- /* Make sure the out parameter has a value */
- *use_file_locking = true;
+ /* Make sure the out parameters have a value */
+ *use_file_locking = true;
+ *ignore_disabled_locks = false;
- /* Check the fapl property */
- if (H5P_get(fapl, H5F_ACS_USE_FILE_LOCKING_NAME, use_file_locking) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get use file locking flag");
+ /* Check file locking environment variable first */
+ if (use_locks_env_g != FAIL) {
+ *use_file_locking = (use_locks_env_g == true);
+ }
+ else {
+ /* Check the file locking fapl property */
+ if (H5P_get(fapl, H5F_ACS_USE_FILE_LOCKING_NAME, use_file_locking) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get use file locking flag");
+ }
- /* Check the environment variable */
- if (use_locks_env_g != FAIL)
- *use_file_locking = (use_locks_env_g == true) ? true : false;
+ /* Check "ignore disabled file locks" environment variable first */
+ if (ignore_disabled_locks_g != FAIL) {
+ *ignore_disabled_locks = (ignore_disabled_locks_g == true);
+ }
+ else {
+ /* Check the "ignore disabled file locks" fapl property */
+ if (H5P_get(fapl, H5F_ACS_IGNORE_DISABLED_FILE_LOCKS_NAME, ignore_disabled_locks) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get ignore disabled file locks property");
+ }
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -1775,10 +1807,11 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id)
bool set_flag = false; /*set the status_flags in the superblock */
bool clear = false; /*clear the status_flags */
bool evict_on_close; /* evict on close value from plist */
- bool use_file_locking = true; /* Using file locks? */
- bool ci_load = false; /* whether MDC ci load requested */
- bool ci_write = false; /* whether MDC CI write requested */
- H5F_t *ret_value = NULL; /*actual return value */
+ bool use_file_locking = true; /* Using file locks? */
+ bool ignore_disabled_locks = false; /* Ignore disabled file locks? */
+ bool ci_load = false; /* whether MDC ci load requested */
+ bool ci_write = false; /* whether MDC CI write requested */
+ H5F_t *ret_value = NULL; /*actual return value */
FUNC_ENTER_NOAPI(NULL)
@@ -1798,8 +1831,8 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not file access property list");
/* Check if we are using file locking */
- if (H5F__check_if_using_file_locks(a_plist, &use_file_locking) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "unable to get file locking flag");
+ if (H5F__check_if_using_file_locks(a_plist, &use_file_locking, &ignore_disabled_locks) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "unable to get file locking flags");
/*
* Opening a file is a two step process. First we try to open the
@@ -1951,14 +1984,20 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id)
shared = file->shared;
lf = shared->lf;
- /* Set the file locking flag. If the file is already open, the file
+ /* Set the file locking flags. If the file is already open, the file
* requested file locking flag must match that of the open file.
*/
- if (shared->nrefs == 1)
- file->shared->use_file_locking = use_file_locking;
- else if (shared->nrefs > 1)
+ if (shared->nrefs == 1) {
+ file->shared->use_file_locking = use_file_locking;
+ file->shared->ignore_disabled_locks = ignore_disabled_locks;
+ }
+ else if (shared->nrefs > 1) {
if (file->shared->use_file_locking != use_file_locking)
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "file locking flag values don't match");
+ if (file->shared->use_file_locking && (file->shared->ignore_disabled_locks != ignore_disabled_locks))
+ HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL,
+ "file locking 'ignore disabled locks' flag values don't match");
+ }
/* Check if page buffering is enabled */
if (H5P_get(a_plist, H5F_ACS_PAGE_BUFFER_SIZE_NAME, &page_buf_size) < 0)
diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h
index bc5c90b..60de31e 100644
--- a/src/H5Fpkg.h
+++ b/src/H5Fpkg.h
@@ -293,16 +293,17 @@ struct H5F_shared_t {
hsize_t threshold; /* Threshold for alignment */
hsize_t alignment; /* Alignment */
unsigned gc_ref; /* Garbage-collect references? */
- H5F_libver_t low_bound; /* The 'low' bound of library format versions */
- H5F_libver_t high_bound; /* The 'high' bound of library format versions */
- bool 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 */
- struct H5G_t *root_grp; /* Open root group */
- H5FO_t *open_objs; /* Open objects in file */
- H5UC_t *grp_btree_shared; /* Ref-counted group B-tree node info */
- bool use_file_locking; /* Whether or not to use file locking */
- bool closing; /* File is in the process of being closed */
+ H5F_libver_t low_bound; /* The 'low' bound of library format versions */
+ H5F_libver_t high_bound; /* The 'high' bound of library format versions */
+ bool 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 */
+ struct H5G_t *root_grp; /* Open root group */
+ H5FO_t *open_objs; /* Open objects in file */
+ H5UC_t *grp_btree_shared; /* Ref-counted group B-tree node info */
+ bool use_file_locking; /* Whether or not to use file locking */
+ bool ignore_disabled_locks; /* Whether or not to ignore disabled file locking */
+ bool closing; /* File is in the process of being closed */
/* Cached VOL connector ID & info */
hid_t vol_id; /* ID of VOL connector for the container */
@@ -391,9 +392,11 @@ H5FL_EXTERN(H5F_t);
H5FL_EXTERN(H5F_shared_t);
/* Whether or not to use file locking (based on the environment variable)
- * FAIL means ignore the environment variable.
+ * and whether or not to ignore disabled file locking. FAIL means ignore
+ * the environment variable.
*/
H5_DLLVAR htri_t use_locks_env_g;
+H5_DLLVAR htri_t ignore_disabled_locks_g;
/******************************/
/* Package Private Prototypes */
@@ -411,7 +414,7 @@ H5_DLL herr_t H5F__start_swmr_write(H5F_t *f);
H5_DLL herr_t H5F__close(H5F_t *f);
H5_DLL herr_t H5F__set_libver_bounds(H5F_t *f, H5F_libver_t low, H5F_libver_t high);
H5_DLL herr_t H5F__get_cont_info(const H5F_t *f, H5VL_file_cont_info_t *info);
-H5_DLL herr_t H5F__parse_file_lock_env_var(htri_t *use_locks);
+H5_DLL herr_t H5F__parse_file_lock_env_var(htri_t *use_locks, htri_t *ignore_disabled_locks);
H5_DLL herr_t H5F__delete(const char *filename, hid_t fapl_id);
/* File mount related routines */
diff --git a/src/H5Ftest.c b/src/H5Ftest.c
index 081fbda..7e34e0a 100644
--- a/src/H5Ftest.c
+++ b/src/H5Ftest.c
@@ -258,7 +258,7 @@ H5F__reparse_file_lock_variable_test(void)
FUNC_ENTER_PACKAGE
/* Check the file locking environment variable */
- if (H5F__parse_file_lock_env_var(&use_locks_env_g) < 0)
+ if (H5F__parse_file_lock_env_var(&use_locks_env_g, &ignore_disabled_locks_g) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to parse file locking environment variable");
done:
diff --git a/src/H5Oainfo.c b/src/H5Oainfo.c
index 1050212..8b82e39 100644
--- a/src/H5Oainfo.c
+++ b/src/H5Oainfo.c
@@ -31,7 +31,8 @@
/* PRIVATE PROTOTYPES */
static void *H5O__ainfo_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags,
size_t p_size, const uint8_t *p);
-static herr_t H5O__ainfo_encode(H5F_t *f, bool disable_shared, uint8_t *p, const void *_mesg);
+static herr_t H5O__ainfo_encode(H5F_t *f, bool disable_shared, size_t H5_ATTR_UNUSED p_size, uint8_t *p,
+ const void *_mesg);
static void *H5O__ainfo_copy(const void *_mesg, void *_dest);
static size_t H5O__ainfo_size(const H5F_t *f, bool disable_shared, const void *_mesg);
static herr_t H5O__ainfo_free(void *_mesg);
@@ -175,7 +176,8 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5O__ainfo_encode(H5F_t *f, bool H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg)
+H5O__ainfo_encode(H5F_t *f, bool H5_ATTR_UNUSED disable_shared, size_t H5_ATTR_UNUSED p_size, uint8_t *p,
+ const void *_mesg)
{
const H5O_ainfo_t *ainfo = (const H5O_ainfo_t *)_mesg;
unsigned char flags; /* Flags for encoding attribute info */
diff --git a/src/H5Oattr.c b/src/H5Oattr.c
index e86ec39..6852ebc 100644
--- a/src/H5Oattr.c
+++ b/src/H5Oattr.c
@@ -380,7 +380,7 @@ H5O__attr_encode(H5F_t *f, uint8_t *p, const void *mesg)
p += name_len;
/* encode the attribute datatype */
- if ((H5O_MSG_DTYPE->encode)(f, false, p, attr->shared->dt) < 0)
+ if ((H5O_MSG_DTYPE->encode)(f, false, SIZE_MAX, p, attr->shared->dt) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTENCODE, FAIL, "can't encode attribute datatype");
if (attr->shared->version < H5O_ATTR_VERSION_2) {
@@ -391,7 +391,7 @@ H5O__attr_encode(H5F_t *f, uint8_t *p, const void *mesg)
p += attr->shared->dt_size;
/* encode the attribute dataspace */
- if ((H5O_MSG_SDSPACE->encode)(f, false, p, &(attr->shared->ds->extent)) < 0)
+ if ((H5O_MSG_SDSPACE->encode)(f, false, SIZE_MAX, p, &(attr->shared->ds->extent)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTENCODE, FAIL, "can't encode attribute dataspace");
if (attr->shared->version < H5O_ATTR_VERSION_2) {
diff --git a/src/H5Obogus.c b/src/H5Obogus.c
index c9c2196..4948d61 100644
--- a/src/H5Obogus.c
+++ b/src/H5Obogus.c
@@ -35,7 +35,8 @@
/* PRIVATE PROTOTYPES */
static void *H5O__bogus_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags,
size_t p_size, const uint8_t *p);
-static herr_t H5O__bogus_encode(H5F_t *f, bool disable_shared, uint8_t *p, const void *_mesg);
+static herr_t H5O__bogus_encode(H5F_t *f, bool disable_shared, size_t H5_ATTR_UNUSED p_size, uint8_t *p,
+ const void *_mesg);
static size_t H5O__bogus_size(const H5F_t *f, bool disable_shared, const void *_mesg);
static herr_t H5O__bogus_debug(H5F_t *f, const void *_mesg, FILE *stream, int indent, int fwidth);
@@ -142,8 +143,8 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5O__bogus_encode(H5F_t H5_ATTR_UNUSED *f, bool H5_ATTR_UNUSED disable_shared, uint8_t *p,
- const void H5_ATTR_UNUSED *mesg)
+H5O__bogus_encode(H5F_t H5_ATTR_UNUSED *f, bool H5_ATTR_UNUSED disable_shared, size_t H5_ATTR_UNUSED p_size,
+ uint8_t *p, const void H5_ATTR_UNUSED *mesg)
{
FUNC_ENTER_PACKAGE_NOERR
diff --git a/src/H5Obtreek.c b/src/H5Obtreek.c
index 7f56b43..42e1ce0 100644
--- a/src/H5Obtreek.c
+++ b/src/H5Obtreek.c
@@ -24,7 +24,8 @@
static void *H5O__btreek_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags,
size_t p_size, const uint8_t *p);
-static herr_t H5O__btreek_encode(H5F_t *f, bool disable_shared, uint8_t *p, const void *_mesg);
+static herr_t H5O__btreek_encode(H5F_t *f, bool disable_shared, size_t H5_ATTR_UNUSED p_size, uint8_t *p,
+ const void *_mesg);
static void *H5O__btreek_copy(const void *_mesg, void *_dest);
static size_t H5O__btreek_size(const H5F_t *f, bool disable_shared, const void *_mesg);
static herr_t H5O__btreek_debug(H5F_t *f, const void *_mesg, FILE *stream, int indent, int fwidth);
@@ -120,7 +121,8 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5O__btreek_encode(H5F_t H5_ATTR_UNUSED *f, bool H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg)
+H5O__btreek_encode(H5F_t H5_ATTR_UNUSED *f, bool H5_ATTR_UNUSED disable_shared, size_t H5_ATTR_UNUSED p_size,
+ uint8_t *p, const void *_mesg)
{
const H5O_btreek_t *mesg = (const H5O_btreek_t *)_mesg;
diff --git a/src/H5Ocache_image.c b/src/H5Ocache_image.c
index 7c71178..d91b463 100644
--- a/src/H5Ocache_image.c
+++ b/src/H5Ocache_image.c
@@ -36,7 +36,8 @@
/* Callbacks for message class */
static void *H5O__mdci_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags, size_t p_size,
const uint8_t *p);
-static herr_t H5O__mdci_encode(H5F_t *f, bool disable_shared, uint8_t *p, const void *_mesg);
+static herr_t H5O__mdci_encode(H5F_t *f, bool disable_shared, size_t H5_ATTR_UNUSED p_size, uint8_t *p,
+ const void *_mesg);
static void *H5O__mdci_copy(const void *_mesg, void *_dest);
static size_t H5O__mdci_size(const H5F_t *f, bool disable_shared, const void *_mesg);
static herr_t H5O__mdci_free(void *mesg);
@@ -135,7 +136,8 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5O__mdci_encode(H5F_t *f, bool H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg)
+H5O__mdci_encode(H5F_t *f, bool H5_ATTR_UNUSED disable_shared, size_t H5_ATTR_UNUSED p_size, uint8_t *p,
+ const void *_mesg)
{
const H5O_mdci_t *mesg = (const H5O_mdci_t *)_mesg;
diff --git a/src/H5Ocont.c b/src/H5Ocont.c
index ff08218..6894eca 100644
--- a/src/H5Ocont.c
+++ b/src/H5Ocont.c
@@ -33,7 +33,8 @@
/* PRIVATE PROTOTYPES */
static void *H5O__cont_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags, size_t p_size,
const uint8_t *p);
-static herr_t H5O__cont_encode(H5F_t *f, bool disable_shared, uint8_t *p, const void *_mesg);
+static herr_t H5O__cont_encode(H5F_t *f, bool disable_shared, size_t H5_ATTR_UNUSED p_size, uint8_t *p,
+ const void *_mesg);
static size_t H5O__cont_size(const H5F_t *f, bool disable_shared, const void *_mesg);
static herr_t H5O__cont_free(void *mesg);
static herr_t H5O__cont_delete(H5F_t *f, H5O_t *open_oh, void *_mesg);
@@ -122,7 +123,8 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5O__cont_encode(H5F_t *f, bool H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg)
+H5O__cont_encode(H5F_t *f, bool H5_ATTR_UNUSED disable_shared, size_t H5_ATTR_UNUSED p_size, uint8_t *p,
+ const void *_mesg)
{
const H5O_cont_t *cont = (const H5O_cont_t *)_mesg;
diff --git a/src/H5Odrvinfo.c b/src/H5Odrvinfo.c
index 4ff9873..baec777 100644
--- a/src/H5Odrvinfo.c
+++ b/src/H5Odrvinfo.c
@@ -23,7 +23,8 @@
static void *H5O__drvinfo_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags,
size_t p_size, const uint8_t *p);
-static herr_t H5O__drvinfo_encode(H5F_t *f, bool disable_shared, uint8_t *p, const void *_mesg);
+static herr_t H5O__drvinfo_encode(H5F_t *f, bool disable_shared, size_t H5_ATTR_UNUSED p_size, uint8_t *p,
+ const void *_mesg);
static void *H5O__drvinfo_copy(const void *_mesg, void *_dest);
static size_t H5O__drvinfo_size(const H5F_t *f, bool disable_shared, const void *_mesg);
static herr_t H5O__drvinfo_reset(void *_mesg);
@@ -135,8 +136,8 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5O__drvinfo_encode(H5F_t H5_ATTR_UNUSED *f, bool H5_ATTR_UNUSED disable_shared, uint8_t *p,
- const void *_mesg)
+H5O__drvinfo_encode(H5F_t H5_ATTR_UNUSED *f, bool H5_ATTR_UNUSED disable_shared, size_t H5_ATTR_UNUSED p_size,
+ uint8_t *p, const void *_mesg)
{
const H5O_drvinfo_t *mesg = (const H5O_drvinfo_t *)_mesg;
diff --git a/src/H5Oefl.c b/src/H5Oefl.c
index c06ecf6..ebd92a7 100644
--- a/src/H5Oefl.c
+++ b/src/H5Oefl.c
@@ -22,7 +22,8 @@
/* PRIVATE PROTOTYPES */
static void *H5O__efl_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags, size_t p_size,
const uint8_t *p);
-static herr_t H5O__efl_encode(H5F_t *f, bool disable_shared, uint8_t *p, const void *_mesg);
+static herr_t H5O__efl_encode(H5F_t *f, bool disable_shared, size_t H5_ATTR_UNUSED p_size, uint8_t *p,
+ const void *_mesg);
static void *H5O__efl_copy(const void *_mesg, void *_dest);
static size_t H5O__efl_size(const H5F_t *f, bool disable_shared, const void *_mesg);
static herr_t H5O__efl_reset(void *_mesg);
@@ -197,7 +198,8 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5O__efl_encode(H5F_t *f, bool H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg)
+H5O__efl_encode(H5F_t *f, bool H5_ATTR_UNUSED disable_shared, size_t H5_ATTR_UNUSED p_size, uint8_t *p,
+ const void *_mesg)
{
const H5O_efl_t *mesg = (const H5O_efl_t *)_mesg;
size_t u; /* Local index variable */
diff --git a/src/H5Ofsinfo.c b/src/H5Ofsinfo.c
index ca3a3de..5b69235 100644
--- a/src/H5Ofsinfo.c
+++ b/src/H5Ofsinfo.c
@@ -30,7 +30,8 @@
/* PRIVATE PROTOTYPES */
static void *H5O__fsinfo_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags,
size_t p_size, const uint8_t *p);
-static herr_t H5O__fsinfo_encode(H5F_t *f, bool disable_shared, uint8_t *p, const void *_mesg);
+static herr_t H5O__fsinfo_encode(H5F_t *f, bool disable_shared, size_t H5_ATTR_UNUSED p_size, uint8_t *p,
+ const void *_mesg);
static void *H5O__fsinfo_copy(const void *_mesg, void *_dest);
static size_t H5O__fsinfo_size(const H5F_t *f, bool disable_shared, const void *_mesg);
static herr_t H5O__fsinfo_free(void *mesg);
@@ -221,7 +222,8 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5O__fsinfo_encode(H5F_t *f, bool H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg)
+H5O__fsinfo_encode(H5F_t *f, bool H5_ATTR_UNUSED disable_shared, size_t H5_ATTR_UNUSED p_size, uint8_t *p,
+ const void *_mesg)
{
const H5O_fsinfo_t *fsinfo = (const H5O_fsinfo_t *)_mesg;
H5F_mem_page_t ptype; /* Memory type for iteration */
diff --git a/src/H5Oginfo.c b/src/H5Oginfo.c
index 72d15af..645c5ff 100644
--- a/src/H5Oginfo.c
+++ b/src/H5Oginfo.c
@@ -29,7 +29,8 @@
/* PRIVATE PROTOTYPES */
static void *H5O__ginfo_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags,
size_t p_size, const uint8_t *p);
-static herr_t H5O__ginfo_encode(H5F_t *f, bool disable_shared, uint8_t *p, const void *_mesg);
+static herr_t H5O__ginfo_encode(H5F_t *f, bool disable_shared, size_t H5_ATTR_UNUSED p_size, uint8_t *p,
+ const void *_mesg);
static void *H5O__ginfo_copy(const void *_mesg, void *_dest);
static size_t H5O__ginfo_size(const H5F_t *f, bool disable_shared, const void *_mesg);
static herr_t H5O__ginfo_free(void *_mesg);
@@ -158,7 +159,8 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5O__ginfo_encode(H5F_t H5_ATTR_UNUSED *f, bool H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg)
+H5O__ginfo_encode(H5F_t H5_ATTR_UNUSED *f, bool H5_ATTR_UNUSED disable_shared, size_t H5_ATTR_UNUSED p_size,
+ uint8_t *p, const void *_mesg)
{
const H5O_ginfo_t *ginfo = (const H5O_ginfo_t *)_mesg;
unsigned char flags = 0; /* Flags for encoding group info */
diff --git a/src/H5Olayout.c b/src/H5Olayout.c
index 1f2b686..75456d6 100644
--- a/src/H5Olayout.c
+++ b/src/H5Olayout.c
@@ -31,7 +31,8 @@
/* PRIVATE PROTOTYPES */
static void *H5O__layout_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags,
size_t p_size, const uint8_t *p);
-static herr_t H5O__layout_encode(H5F_t *f, bool disable_shared, uint8_t *p, const void *_mesg);
+static herr_t H5O__layout_encode(H5F_t *f, bool disable_shared, size_t H5_ATTR_UNUSED p_size, uint8_t *p,
+ const void *_mesg);
static void *H5O__layout_copy(const void *_mesg, void *_dest);
static size_t H5O__layout_size(const H5F_t *f, bool disable_shared, const void *_mesg);
static herr_t H5O__layout_reset(void *_mesg);
@@ -794,7 +795,8 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5O__layout_encode(H5F_t *f, bool H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg)
+H5O__layout_encode(H5F_t *f, bool H5_ATTR_UNUSED disable_shared, size_t H5_ATTR_UNUSED p_size, uint8_t *p,
+ const void *_mesg)
{
const H5O_layout_t *mesg = (const H5O_layout_t *)_mesg;
unsigned u;
diff --git a/src/H5Olinfo.c b/src/H5Olinfo.c
index 9d26483..830e4e3 100644
--- a/src/H5Olinfo.c
+++ b/src/H5Olinfo.c
@@ -33,7 +33,8 @@
/* PRIVATE PROTOTYPES */
static void *H5O__linfo_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags,
size_t p_size, const uint8_t *p);
-static herr_t H5O__linfo_encode(H5F_t *f, bool disable_shared, uint8_t *p, const void *_mesg);
+static herr_t H5O__linfo_encode(H5F_t *f, bool disable_shared, size_t H5_ATTR_UNUSED p_size, uint8_t *p,
+ const void *_mesg);
static void *H5O__linfo_copy(const void *_mesg, void *_dest);
static size_t H5O__linfo_size(const H5F_t *f, bool disable_shared, const void *_mesg);
static herr_t H5O__linfo_free(void *_mesg);
@@ -183,7 +184,8 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5O__linfo_encode(H5F_t *f, bool H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg)
+H5O__linfo_encode(H5F_t *f, bool H5_ATTR_UNUSED disable_shared, size_t H5_ATTR_UNUSED p_size, uint8_t *p,
+ const void *_mesg)
{
const H5O_linfo_t *linfo = (const H5O_linfo_t *)_mesg;
unsigned char index_flags; /* Flags for encoding link index info */
diff --git a/src/H5Olink.c b/src/H5Olink.c
index 9d4d685..6657a50 100644
--- a/src/H5Olink.c
+++ b/src/H5Olink.c
@@ -35,7 +35,8 @@
/* PRIVATE PROTOTYPES */
static void *H5O__link_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags, size_t p_size,
const uint8_t *p);
-static herr_t H5O__link_encode(H5F_t *f, bool disable_shared, uint8_t *p, const void *_mesg);
+static herr_t H5O__link_encode(H5F_t *f, bool disable_shared, size_t H5_ATTR_UNUSED p_size, uint8_t *p,
+ const void *_mesg);
static void *H5O__link_copy(const void *_mesg, void *_dest);
static size_t H5O__link_size(const H5F_t *f, bool disable_shared, const void *_mesg);
static herr_t H5O__link_reset(void *_mesg);
@@ -289,7 +290,8 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5O__link_encode(H5F_t *f, bool H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg)
+H5O__link_encode(H5F_t *f, bool H5_ATTR_UNUSED disable_shared, size_t H5_ATTR_UNUSED p_size, uint8_t *p,
+ const void *_mesg)
{
const H5O_link_t *lnk = (const H5O_link_t *)_mesg;
uint64_t len; /* Length of a string in the message */
diff --git a/src/H5Omessage.c b/src/H5Omessage.c
index f6cafdc..bc4381b 100644
--- a/src/H5Omessage.c
+++ b/src/H5Omessage.c
@@ -1597,7 +1597,7 @@ H5O_msg_encode(H5F_t *f, unsigned type_id, bool disable_shared, unsigned char *b
assert(type);
/* Encode */
- if ((type->encode)(f, disable_shared, buf, mesg) < 0)
+ if ((type->encode)(f, disable_shared, SIZE_MAX, buf, mesg) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "unable to encode message");
done:
@@ -1972,7 +1972,7 @@ H5O_msg_flush(H5F_t *f, H5O_t *oh, H5O_mesg_t *mesg)
}
#endif /* NDEBUG */
assert(mesg->type->encode);
- if ((mesg->type->encode)(f, false, mesg->raw, mesg->native) < 0)
+ if ((mesg->type->encode)(f, false, mesg->raw_size, mesg->raw, mesg->native) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "unable to encode object header message");
} /* end if */
diff --git a/src/H5Omtime.c b/src/H5Omtime.c
index 9cf9400..864af93 100644
--- a/src/H5Omtime.c
+++ b/src/H5Omtime.c
@@ -24,12 +24,13 @@
static void *H5O__mtime_new_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags,
size_t p_size, const uint8_t *p);
-static herr_t H5O__mtime_new_encode(H5F_t *f, bool disable_shared, uint8_t *p, const void *_mesg);
+static herr_t H5O__mtime_new_encode(H5F_t *f, bool disable_shared, size_t H5_ATTR_UNUSED p_size, uint8_t *p,
+ const void *_mesg);
static size_t H5O__mtime_new_size(const H5F_t *f, bool disable_shared, const void *_mesg);
static void *H5O__mtime_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags,
size_t p_size, const uint8_t *p);
-static herr_t H5O__mtime_encode(H5F_t *f, bool disable_shared, uint8_t *p, const void *_mesg);
+static herr_t H5O__mtime_encode(H5F_t *f, bool disable_shared, size_t p_size, uint8_t *p, const void *_mesg);
static void *H5O__mtime_copy(const void *_mesg, void *_dest);
static size_t H5O__mtime_size(const H5F_t *f, bool disable_shared, const void *_mesg);
static herr_t H5O__mtime_free(void *_mesg);
@@ -221,8 +222,8 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5O__mtime_new_encode(H5F_t H5_ATTR_UNUSED *f, bool H5_ATTR_UNUSED disable_shared, uint8_t *p,
- const void *_mesg)
+H5O__mtime_new_encode(H5F_t H5_ATTR_UNUSED *f, bool H5_ATTR_UNUSED disable_shared,
+ size_t H5_ATTR_UNUSED p_size, uint8_t *p, const void *_mesg)
{
const time_t *mesg = (const time_t *)_mesg;
@@ -257,7 +258,8 @@ H5O__mtime_new_encode(H5F_t H5_ATTR_UNUSED *f, bool H5_ATTR_UNUSED disable_share
*-------------------------------------------------------------------------
*/
static herr_t
-H5O__mtime_encode(H5F_t H5_ATTR_UNUSED *f, bool H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg)
+H5O__mtime_encode(H5F_t H5_ATTR_UNUSED *f, bool H5_ATTR_UNUSED disable_shared, size_t p_size, uint8_t *p,
+ const void *_mesg)
{
const time_t *mesg = (const time_t *)_mesg;
struct tm *tm;
@@ -271,8 +273,8 @@ H5O__mtime_encode(H5F_t H5_ATTR_UNUSED *f, bool H5_ATTR_UNUSED disable_shared, u
/* encode */
tm = HDgmtime(mesg);
- sprintf((char *)p, "%04d%02d%02d%02d%02d%02d", 1900 + tm->tm_year, 1 + tm->tm_mon, tm->tm_mday,
- tm->tm_hour, tm->tm_min, tm->tm_sec);
+ snprintf((char *)p, p_size, "%04d%02d%02d%02d%02d%02d", 1900 + tm->tm_year, 1 + tm->tm_mon, tm->tm_mday,
+ tm->tm_hour, tm->tm_min, tm->tm_sec);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5O__mtime_encode() */
diff --git a/src/H5Oname.c b/src/H5Oname.c
index d600137..fc85c0b 100644
--- a/src/H5Oname.c
+++ b/src/H5Oname.c
@@ -29,7 +29,8 @@
/* PRIVATE PROTOTYPES */
static void *H5O__name_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags, size_t p_size,
const uint8_t *p);
-static herr_t H5O__name_encode(H5F_t *f, bool disable_shared, uint8_t *p, const void *_mesg);
+static herr_t H5O__name_encode(H5F_t *f, bool disable_shared, size_t H5_ATTR_UNUSED p_size, uint8_t *p,
+ const void *_mesg);
static void *H5O__name_copy(const void *_mesg, void *_dest);
static size_t H5O__name_size(const H5F_t *f, bool disable_shared, const void *_mesg);
static herr_t H5O__name_reset(void *_mesg);
@@ -110,7 +111,8 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5O__name_encode(H5F_t H5_ATTR_UNUSED *f, bool H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg)
+H5O__name_encode(H5F_t H5_ATTR_UNUSED *f, bool H5_ATTR_UNUSED disable_shared, size_t H5_ATTR_UNUSED p_size,
+ uint8_t *p, const void *_mesg)
{
const H5O_name_t *mesg = (const H5O_name_t *)_mesg;
diff --git a/src/H5Opkg.h b/src/H5Opkg.h
index feca86f..4c719bf 100644
--- a/src/H5Opkg.h
+++ b/src/H5Opkg.h
@@ -211,7 +211,7 @@ struct H5O_msg_class_t {
size_t native_size; /*size of native message */
unsigned share_flags; /* Message sharing settings */
void *(*decode)(H5F_t *, H5O_t *, unsigned, unsigned *, size_t, const uint8_t *);
- herr_t (*encode)(H5F_t *, bool, uint8_t *, const void *);
+ herr_t (*encode)(H5F_t *, bool, size_t, uint8_t *, const void *);
void *(*copy)(const void *, void *); /*copy native value */
size_t (*raw_size)(const H5F_t *, bool, const void *); /*sizeof encoded message */
herr_t (*reset)(void *); /*free nested data structs */
diff --git a/src/H5Orefcount.c b/src/H5Orefcount.c
index 426d2be..a93f429 100644
--- a/src/H5Orefcount.c
+++ b/src/H5Orefcount.c
@@ -29,7 +29,8 @@
/* PRIVATE PROTOTYPES */
static void *H5O__refcount_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags,
size_t p_size, const uint8_t *p);
-static herr_t H5O__refcount_encode(H5F_t *f, bool disable_shared, uint8_t *p, const void *_mesg);
+static herr_t H5O__refcount_encode(H5F_t *f, bool disable_shared, size_t H5_ATTR_UNUSED p_size, uint8_t *p,
+ const void *_mesg);
static void *H5O__refcount_copy(const void *_mesg, void *_dest);
static size_t H5O__refcount_size(const H5F_t *f, bool disable_shared, const void *_mesg);
static herr_t H5O__refcount_free(void *_mesg);
@@ -126,8 +127,8 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5O__refcount_encode(H5F_t H5_ATTR_UNUSED *f, bool H5_ATTR_UNUSED disable_shared, uint8_t *p,
- const void *_mesg)
+H5O__refcount_encode(H5F_t H5_ATTR_UNUSED *f, bool H5_ATTR_UNUSED disable_shared,
+ size_t H5_ATTR_UNUSED p_size, uint8_t *p, const void *_mesg)
{
const H5O_refcount_t *refcount = (const H5O_refcount_t *)_mesg;
diff --git a/src/H5Oshared.h b/src/H5Oshared.h
index 97539ba..2813bad 100644
--- a/src/H5Oshared.h
+++ b/src/H5Oshared.h
@@ -91,7 +91,7 @@ done:
*-------------------------------------------------------------------------
*/
static inline herr_t
-H5O_SHARED_ENCODE(H5F_t *f, bool disable_shared, uint8_t *p, const void *_mesg)
+H5O_SHARED_ENCODE(H5F_t *f, bool disable_shared, size_t H5_ATTR_UNUSED p_size, uint8_t *p, const void *_mesg)
{
const H5O_shared_t *sh_mesg =
(const H5O_shared_t *)_mesg; /* Pointer to shared message portion of actual message */
diff --git a/src/H5Oshmesg.c b/src/H5Oshmesg.c
index 50d6652..98f1829 100644
--- a/src/H5Oshmesg.c
+++ b/src/H5Oshmesg.c
@@ -24,7 +24,8 @@
static void *H5O__shmesg_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags,
size_t p_size, const uint8_t *p);
-static herr_t H5O__shmesg_encode(H5F_t *f, bool disable_shared, uint8_t *p, const void *_mesg);
+static herr_t H5O__shmesg_encode(H5F_t *f, bool disable_shared, size_t H5_ATTR_UNUSED p_size, uint8_t *p,
+ const void *_mesg);
static void *H5O__shmesg_copy(const void *_mesg, void *_dest);
static size_t H5O__shmesg_size(const H5F_t *f, bool disable_shared, const void *_mesg);
static herr_t H5O__shmesg_debug(H5F_t *f, const void *_mesg, FILE *stream, int indent, int fwidth);
@@ -113,7 +114,8 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5O__shmesg_encode(H5F_t *f, bool H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg)
+H5O__shmesg_encode(H5F_t *f, bool H5_ATTR_UNUSED disable_shared, size_t H5_ATTR_UNUSED p_size, uint8_t *p,
+ const void *_mesg)
{
const H5O_shmesg_table_t *mesg = (const H5O_shmesg_table_t *)_mesg;
diff --git a/src/H5Ostab.c b/src/H5Ostab.c
index a9c3dd1..5000ca8 100644
--- a/src/H5Ostab.c
+++ b/src/H5Ostab.c
@@ -32,7 +32,8 @@
/* PRIVATE PROTOTYPES */
static void *H5O__stab_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags, size_t p_size,
const uint8_t *p);
-static herr_t H5O__stab_encode(H5F_t *f, bool disable_shared, uint8_t *p, const void *_mesg);
+static herr_t H5O__stab_encode(H5F_t *f, bool disable_shared, size_t H5_ATTR_UNUSED p_size, uint8_t *p,
+ const void *_mesg);
static void *H5O__stab_copy(const void *_mesg, void *_dest);
static size_t H5O__stab_size(const H5F_t *f, bool disable_shared, const void *_mesg);
static herr_t H5O__stab_free(void *_mesg);
@@ -123,7 +124,8 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5O__stab_encode(H5F_t *f, bool H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg)
+H5O__stab_encode(H5F_t *f, bool H5_ATTR_UNUSED disable_shared, size_t H5_ATTR_UNUSED p_size, uint8_t *p,
+ const void *_mesg)
{
const H5O_stab_t *stab = (const H5O_stab_t *)_mesg;
diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c
index e7c1fb3..6c2ef47 100644
--- a/src/H5Pfapl.c
+++ b/src/H5Pfapl.c
@@ -3159,9 +3159,10 @@ done:
herr_t
H5Pset_file_image_callbacks(hid_t fapl_id, H5FD_file_image_callbacks_t *callbacks_ptr)
{
- H5P_genplist_t *fapl; /* Property list pointer */
- H5FD_file_image_info_t info; /* File image info */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5P_genplist_t *fapl; /* Property list pointer */
+ H5FD_file_image_info_t info; /* File image info */
+ bool copied_udata = false; /* Whether udata structure was copied */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "i*DI", fapl_id, callbacks_ptr);
@@ -3209,11 +3210,18 @@ H5Pset_file_image_callbacks(hid_t fapl_id, H5FD_file_image_callbacks_t *callback
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't copy the supplied udata");
} /* end if */
+ copied_udata = true;
+
/* Set values */
if (H5P_poke(fapl, H5F_ACS_FILE_IMAGE_INFO_NAME, &info) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set file image info");
done:
+ if (ret_value < 0) {
+ if (copied_udata && (callbacks_ptr->udata_free(info.callbacks.udata) < 0))
+ HDONE_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "udata_free callback failed");
+ }
+
FUNC_LEAVE_API(ret_value)
} /* end H5Pset_file_image_callbacks() */
@@ -4978,7 +4986,9 @@ H5Pget_file_locking(hid_t fapl_id, hbool_t *use_file_locking /*out*/, hbool_t *i
H5TRACE3("e", "ixx", fapl_id, use_file_locking, ignore_when_disabled);
/* Make sure this is a fapl */
- if (true != H5P_isa_class(fapl_id, H5P_FILE_ACCESS))
+ 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_PLIST, H5E_CANTREGISTER, FAIL, "property list is not an access plist");
/* Get the plist structure */