summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Young <dyoung@hdfgroup.org>2020-04-07 15:39:33 (GMT)
committerDavid Young <dyoung@hdfgroup.org>2020-04-07 15:39:33 (GMT)
commit7b83633d5efa18746fc842ef755b25c09c3fcf38 (patch)
tree8023130f42b6bda5b9122619f38f78dc0d0c4722 /src
parent46832e59ecd74fac0cddf32ae32f2c75a6e2565f (diff)
downloadhdf5-7b83633d5efa18746fc842ef755b25c09c3fcf38.zip
hdf5-7b83633d5efa18746fc842ef755b25c09c3fcf38.tar.gz
hdf5-7b83633d5efa18746fc842ef755b25c09c3fcf38.tar.bz2
Simplify H5PB_vfd_swmr__update_index(), which figures in
my investigation of shadow-file freespace leaks. Copy the tick number from the H5F_shared_t to a temporary variable and use the temporary instead of spelling out `shared->tick_num`. Assert that every entry on the tick list is dirty, since clean entries will not appear on the tick list. Mark each corresponding shadow-index entry dirty, and set its "tick of last change" to the current tick and "tick of last flush" to 0. This makes the scan for entries that do not appear on the tick list more believable. Lower staircase in the loop that scans for shadow-index entries that did not appear on the tick list. Log indicies that are marked for reclamation.
Diffstat (limited to 'src')
-rw-r--r--src/H5PB.c44
1 files changed, 23 insertions, 21 deletions
diff --git a/src/H5PB.c b/src/H5PB.c
index 1ae72a2..6544603 100644
--- a/src/H5PB.c
+++ b/src/H5PB.c
@@ -1669,6 +1669,8 @@ H5PB_vfd_swmr__update_index(H5F_t *f,
uint32_t * idx_ent_not_in_tl_ptr,
uint32_t * idx_ent_not_in_tl_flushed_ptr)
{
+ H5F_shared_t * const shared = f->shared;
+ const uint64_t tick_num = shared->tick_num;
uint32_t i;
uint32_t idx_ent_added = 0;
uint32_t idx_ent_modified = 0;
@@ -1676,7 +1678,6 @@ H5PB_vfd_swmr__update_index(H5F_t *f,
uint32_t idx_ent_not_in_tl_flushed = 0;
H5PB_t * pb_ptr = NULL;
H5PB_entry_t *entry;
- H5F_shared_t *shared = f->shared;
H5FD_vfd_swmr_idx_entry_t * ie_ptr = NULL;
H5FD_vfd_swmr_idx_entry_t * idx = NULL;
herr_t ret_value = SUCCEED; /* Return value */
@@ -1726,7 +1727,7 @@ H5PB_vfd_swmr__update_index(H5F_t *f,
HDfprintf(stderr,
"\n\nmax mdf index len (%" PRIu32 ") exceeded.\n\n",
shared->mdf_idx_len);
- HDfprintf(stderr, "tick = %" PRIu64 ".\n", shared->tick_num);
+ HDfprintf(stderr, "tick = %" PRIu64 ".\n", tick_num);
exit(EXIT_FAILURE);
}
@@ -1752,10 +1753,10 @@ H5PB_vfd_swmr__update_index(H5F_t *f,
/* entry->size could have changed */
ie_ptr->length = (uint32_t)entry->size;
ie_ptr->entry_ptr = entry->image_ptr;
- ie_ptr->tick_of_last_change = shared->tick_num;
- ie_ptr->clean = !entry->is_dirty;
-
- ie_ptr->tick_of_last_flush = ie_ptr->clean ? shared->tick_num : 0;
+ ie_ptr->tick_of_last_change = tick_num;
+ assert(entry->is_dirty);
+ ie_ptr->clean = false;
+ ie_ptr->tick_of_last_flush = 0;
}
/* scan the metadata file index for entries that don't appear in the
@@ -1765,27 +1766,28 @@ H5PB_vfd_swmr__update_index(H5F_t *f,
*/
for ( i = 0; i < shared->mdf_idx_entries_used; i++ ) {
- HDassert( ( i == 0 ) ||
- ( idx[i - 1].hdf5_page_offset < idx[i].hdf5_page_offset ) );
-
- if ( idx[i].tick_of_last_change < shared->tick_num ) {
+ HDassert(i == 0 ||
+ idx[i - 1].hdf5_page_offset < idx[i].hdf5_page_offset);
- idx_ent_not_in_tl++;
+ ie_ptr = idx + i;
- ie_ptr = idx + i;
+ if (ie_ptr->tick_of_last_change == tick_num)
+ continue;
- if (!ie_ptr->clean) {
+ idx_ent_not_in_tl++;
- H5PB__SEARCH_INDEX(pb_ptr, ie_ptr->hdf5_page_offset, \
- entry, FAIL);
+ if (ie_ptr->clean)
+ continue;
- if (entry == NULL || !entry->is_dirty) {
+ H5PB__SEARCH_INDEX(pb_ptr, ie_ptr->hdf5_page_offset, entry, FAIL);
- idx_ent_not_in_tl_flushed++;
- ie_ptr->clean = TRUE;
- ie_ptr->tick_of_last_flush = shared->tick_num;
- }
- }
+ if (entry == NULL || !entry->is_dirty) {
+ hlog_fast(shadow_index_reclaim,
+ "Marking shadow index slot %" PRIu32 " clean at tick %" PRIu64,
+ i, tick_num);
+ idx_ent_not_in_tl_flushed++;
+ ie_ptr->clean = TRUE;
+ ie_ptr->tick_of_last_flush = tick_num;
}
}