summaryrefslogtreecommitdiffstats
path: root/src/H5Cimage.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/H5Cimage.c')
-rw-r--r--src/H5Cimage.c110
1 files changed, 70 insertions, 40 deletions
diff --git a/src/H5Cimage.c b/src/H5Cimage.c
index b8f46f1..6d211a4 100644
--- a/src/H5Cimage.c
+++ b/src/H5Cimage.c
@@ -137,7 +137,7 @@ static herr_t H5C__decode_cache_image_header(const H5F_t *f, H5C_t *cache_ptr, c
#ifndef NDEBUG /* only used in assertions */
static herr_t H5C__decode_cache_image_entry(const H5F_t *f, const H5C_t *cache_ptr, const uint8_t **buf,
unsigned entry_num);
-#endif /* NDEBUG */ /* only used in assertions */
+#endif
static herr_t H5C__destroy_pf_entry_child_flush_deps(H5C_t *cache_ptr, H5C_cache_entry_t *pf_entry_ptr,
H5C_cache_entry_t **fd_children);
static herr_t H5C__encode_cache_image_header(const H5F_t *f, const H5C_t *cache_ptr, uint8_t **buf);
@@ -401,8 +401,8 @@ H5C__construct_cache_image_buffer(H5F_t *f, H5C_t *cache_ptr)
fake_cache_ptr->image_entries = (H5C_image_entry_t *)H5MM_xfree(fake_cache_ptr->image_entries);
fake_cache_ptr = (H5C_t *)H5MM_xfree(fake_cache_ptr);
- } /* end block */
-#endif /* NDEBUG */
+ } /* end block */
+#endif
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -702,7 +702,7 @@ H5C__deserialize_prefetched_entry(H5F_t *f, H5C_t *cache_ptr, H5C_cache_entry_t
ds_entry_ptr->prefetched_dirty = pf_entry_ptr->prefetched_dirty;
#ifndef NDEBUG /* debugging field */
ds_entry_ptr->serialization_count = 0;
-#endif /* NDEBUG */
+#endif
H5C__RESET_CACHE_ENTRY_STATS(ds_entry_ptr);
@@ -746,7 +746,7 @@ H5C__deserialize_prefetched_entry(H5F_t *f, H5C_t *cache_ptr, H5C_cache_entry_t
H5C__SEARCH_INDEX(cache_ptr, addr, pf_entry_ptr, FAIL);
HDassert(NULL == pf_entry_ptr);
-#endif /* NDEBUG */
+#endif
/* Insert the deserialized entry into the cache. */
H5C__INSERT_IN_INDEX(cache_ptr, ds_entry_ptr, FAIL)
@@ -797,7 +797,7 @@ H5C__deserialize_prefetched_entry(H5F_t *f, H5C_t *cache_ptr, H5C_cache_entry_t
} /* end while */
HDassert(found);
}
-#endif /* NDEBUG */
+#endif
if (H5C_create_flush_dependency(ds_entry_ptr, fd_children[i]) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTDEPEND, FAIL, "Can't restore child flush dependency")
@@ -2007,7 +2007,7 @@ H5C__decode_cache_image_entry(const H5F_t *f, const H5C_t *cache_ptr, const uint
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C__decode_cache_image_entry() */
-#endif /* NDEBUG */
+#endif
/*-------------------------------------------------------------------------
* Function: H5C__destroy_pf_entry_child_flush_deps()
@@ -2039,10 +2039,12 @@ H5C__destroy_pf_entry_child_flush_deps(H5C_t *cache_ptr, H5C_cache_entry_t *pf_e
H5C_cache_entry_t **fd_children)
{
H5C_cache_entry_t *entry_ptr;
- unsigned entries_visited = 0;
- int fd_children_found = 0;
- hbool_t found;
- herr_t ret_value = SUCCEED; /* Return value */
+#ifndef NDEBUG
+ unsigned entries_visited = 0;
+#endif
+ int fd_children_found = 0;
+ hbool_t found;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -2119,11 +2121,13 @@ H5C__destroy_pf_entry_child_flush_deps(H5C_t *cache_ptr, H5C_cache_entry_t *pf_e
u++;
} /* end while */
HDassert(found);
-#endif /* NDEBUG */
+#endif
} /* end if */
} /* end if */
+#ifndef NDEBUG
entries_visited++;
+#endif
entry_ptr = entry_ptr->il_next;
} /* end while */
@@ -2374,12 +2378,14 @@ H5C__prep_for_file_close__compute_fd_heights(const H5C_t *cache_ptr)
{
H5C_cache_entry_t *entry_ptr;
H5C_cache_entry_t *parent_ptr;
- unsigned entries_removed_from_image = 0;
- unsigned external_parent_fd_refs_removed = 0;
- unsigned external_child_fd_refs_removed = 0;
- hbool_t done = FALSE;
- unsigned u; /* Local index variable */
- herr_t ret_value = SUCCEED;
+#ifndef NDEBUG
+ unsigned entries_removed_from_image = 0;
+ unsigned external_parent_fd_refs_removed = 0;
+ unsigned external_child_fd_refs_removed = 0;
+#endif
+ hbool_t done = FALSE;
+ unsigned u; /* Local index variable */
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_PACKAGE
@@ -2415,7 +2421,9 @@ H5C__prep_for_file_close__compute_fd_heights(const H5C_t *cache_ptr)
entry_ptr->include_in_image) {
/* Must remove child from image -- only do this once */
+#ifndef NDEBUG
entries_removed_from_image++;
+#endif
entry_ptr->include_in_image = FALSE;
} /* end if */
} /* for */
@@ -2458,7 +2466,9 @@ H5C__prep_for_file_close__compute_fd_heights(const H5C_t *cache_ptr)
parent_ptr->fd_dirty_child_count--;
} /* end if */
+#ifndef NDEBUG
external_child_fd_refs_removed++;
+#endif
} /* end if */
} /* for */
} /* end if */
@@ -2483,7 +2493,9 @@ H5C__prep_for_file_close__compute_fd_heights(const H5C_t *cache_ptr)
HDassert(parent_ptr->addr == entry_ptr->fd_parent_addrs[u]);
entry_ptr->fd_parent_addrs[u] = HADDR_UNDEF;
+#ifndef NDEBUG
external_parent_fd_refs_removed++;
+#endif
} /* end if */
} /* for */
@@ -2650,10 +2662,12 @@ static herr_t
H5C__prep_for_file_close__setup_image_entries_array(H5C_t *cache_ptr)
{
H5C_cache_entry_t *entry_ptr;
- H5C_image_entry_t *image_entries = NULL;
- uint32_t entries_visited = 0;
- unsigned u; /* Local index variable */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5C_image_entry_t *image_entries = NULL;
+#ifndef NDEBUG
+ uint32_t entries_visited = 0;
+#endif
+ unsigned u; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -2736,7 +2750,9 @@ H5C__prep_for_file_close__setup_image_entries_array(H5C_t *cache_ptr)
HDassert(u <= cache_ptr->num_entries_in_image);
} /* end if */
+#ifndef NDEBUG
entries_visited++;
+#endif
entry_ptr = entry_ptr->il_next;
} /* end while */
@@ -2789,14 +2805,16 @@ H5C__prep_for_file_close__scan_entries(const H5F_t *f, H5C_t *cache_ptr)
{
H5C_cache_entry_t *entry_ptr;
hbool_t include_in_image;
- unsigned entries_visited = 0;
- int lru_rank = 1;
- uint32_t num_entries_tentatively_in_image = 0;
- uint32_t num_entries_in_image = 0;
- size_t image_len;
- size_t entry_header_len;
- size_t fd_parents_list_len;
- herr_t ret_value = SUCCEED; /* Return value */
+ int lru_rank = 1;
+#ifndef NDEBUG
+ unsigned entries_visited = 0;
+ uint32_t num_entries_tentatively_in_image = 0;
+#endif
+ uint32_t num_entries_in_image = 0;
+ size_t image_len;
+ size_t entry_header_len;
+ size_t fd_parents_list_len;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -2897,10 +2915,14 @@ H5C__prep_for_file_close__scan_entries(const H5F_t *f, H5C_t *cache_ptr)
entry_ptr->fd_dirty_child_count = entry_ptr->flush_dep_ndirty_children;
} /* end if */
+#ifndef NDEBUG
num_entries_tentatively_in_image++;
+#endif
} /* end if */
+#ifndef NDEBUG
entries_visited++;
+#endif
entry_ptr = entry_ptr->il_next;
} /* end while */
HDassert(entries_visited == cache_ptr->index_len);
@@ -2931,12 +2953,14 @@ H5C__prep_for_file_close__scan_entries(const H5F_t *f, H5C_t *cache_ptr)
if (H5C__prep_for_file_close__compute_fd_heights(cache_ptr) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "computation of flush dependency heights failed?!?")
- /* At this point, all entries that will appear in the cache
- * image should be marked correctly. Compute the size of the
- * cache image.
- */
+ /* At this point, all entries that will appear in the cache
+ * image should be marked correctly. Compute the size of the
+ * cache image.
+ */
+#ifndef NDEBUG
entries_visited = 0;
- entry_ptr = cache_ptr->il_head;
+#endif
+ entry_ptr = cache_ptr->il_head;
while (entry_ptr != NULL) {
HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
@@ -2950,7 +2974,9 @@ H5C__prep_for_file_close__scan_entries(const H5F_t *f, H5C_t *cache_ptr)
num_entries_in_image++;
} /* end if */
+#ifndef NDEBUG
entries_visited++;
+#endif
entry_ptr = entry_ptr->il_next;
} /* end while */
HDassert(entries_visited == cache_ptr->index_len);
@@ -2968,7 +2994,9 @@ H5C__prep_for_file_close__scan_entries(const H5F_t *f, H5C_t *cache_ptr)
#endif
cache_ptr->num_entries_in_image = num_entries_in_image;
- entries_visited = 0;
+#ifndef NDEBUG
+ entries_visited = 0;
+#endif
/* Now scan the LRU list to set the lru_rank fields of all entries
* on the LRU.
@@ -3001,7 +3029,9 @@ H5C__prep_for_file_close__scan_entries(const H5F_t *f, H5C_t *cache_ptr)
lru_rank++;
} /* end else-if */
+#ifndef NDEBUG
entries_visited++;
+#endif
entry_ptr = entry_ptr->next;
} /* end while */
HDassert(entries_visited == cache_ptr->LRU_list_len);
@@ -3185,8 +3215,8 @@ H5C__reconstruct_cache_contents(H5F_t *f, H5C_t *cache_ptr)
* we add code to store and restore adaptive resize status.
*/
HDassert(lru_rank_holes <= H5C__MAX_EPOCH_MARKERS);
- } /* end block */
-#endif /* NDEBUG */
+ } /* end block */
+#endif
/* Check to see if the cache is oversize, and evict entries as
* necessary to remain within limits.
@@ -3237,7 +3267,7 @@ H5C__reconstruct_cache_entry(const H5F_t *f, H5C_t *cache_ptr, const uint8_t **b
hbool_t in_lru = FALSE;
hbool_t is_fd_parent = FALSE;
hbool_t is_fd_child = FALSE;
-#endif /* NDEBUG */ /* only used in assertions */
+#endif
const uint8_t *p;
hbool_t file_is_rw;
H5C_cache_entry_t *ret_value = NULL; /* Return value */
@@ -3274,7 +3304,7 @@ H5C__reconstruct_cache_entry(const H5F_t *f, H5C_t *cache_ptr, const uint8_t **b
is_fd_parent = TRUE;
if (flags & H5C__MDCI_ENTRY_IS_FD_CHILD_FLAG)
is_fd_child = TRUE;
-#endif /* NDEBUG */ /* only used in assertions */
+#endif
/* Force dirty entries to clean if the file read only -- must do
* this as otherwise the cache will attempt to write them on file