diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/H5Fint.c | 2 | ||||
-rw-r--r-- | src/H5Fpkg.h | 21 | ||||
-rw-r--r-- | src/H5Ftest.c | 12 | ||||
-rw-r--r-- | src/H5Fvfd_swmr.c | 56 | ||||
-rw-r--r-- | src/H5MF.c | 10 |
5 files changed, 51 insertions, 50 deletions
diff --git a/src/H5Fint.c b/src/H5Fint.c index 661ec40..f058c0c 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -1117,7 +1117,7 @@ H5F__new(H5F_shared_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5F f->shared->vfd_swmr_md_fd = -1; f->shared->fs_man_md = NULL; - TAILQ_INIT(&f->shared->old_images); + TAILQ_INIT(&f->shared->shadow_defrees); /* Get the VOL connector info */ if(H5F__set_vol_conn(f) < 0) diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index e26c0a5..10cd929 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -230,13 +230,13 @@ typedef struct H5F_mtab_t { * tick_num: Sequence # of the current tick * link: tailqueue linkage */ -typedef struct old_image { +typedef struct shadow_defree { uint64_t hdf5_page_offset; uint64_t md_file_page_offset; uint32_t length; uint64_t tick_num; - TAILQ_ENTRY(old_image) link; -} old_image_t; + TAILQ_ENTRY(shadow_defree) link; +} shadow_defree_t; /* Structure specifically to store superblock. This was originally * maintained entirely within H5F_shared_t, but is now extracted @@ -257,17 +257,18 @@ typedef struct H5F_super_t { H5G_entry_t *root_ent; /* Root group symbol table entry */ } H5F_super_t; -typedef struct deferred_free { - SIMPLEQ_ENTRY(deferred_free) link; +/* VFD SWMR: deferred free on the lower VFD. */ +typedef struct lower_defree { + SIMPLEQ_ENTRY(lower_defree) link; H5FD_mem_t alloc_type; haddr_t addr; hsize_t size; uint64_t free_after_tick; -} deferred_free_t; +} lower_defree_t; -typedef SIMPLEQ_HEAD(deferred_free_queue, deferred_free) deferred_free_queue_t; +typedef SIMPLEQ_HEAD(lower_defree_queue, lower_defree) lower_defree_queue_t; -typedef TAILQ_HEAD(old_image_queue, old_image) old_image_queue_t; +typedef TAILQ_HEAD(shadow_defree_queue, shadow_defree) shadow_defree_queue_t; /* * Define the structure to store the file information for HDF5 files. One of @@ -412,7 +413,7 @@ struct H5F_shared_t { */ uint64_t tick_num; /* Number of the current tick */ struct timespec end_of_tick; /* End time of the current tick */ - deferred_free_queue_t deferred_frees; /* For use by VFD SWMR writers. */ + lower_defree_queue_t lower_defrees; /* For use by VFD SWMR writers. */ /* VFD SWMR metadata file index */ H5FD_vfd_swmr_idx_entry_t * mdf_idx; /* pointer to an array of instance * of H5FD_vfd_swmr_idx_entry_t of @@ -469,7 +470,7 @@ struct H5F_shared_t { */ /* Delayed free space release doubly linked list */ - old_image_queue_t old_images; + shadow_defree_queue_t shadow_defrees; char *extpath; /* Path for searching target external link file */ #ifdef H5_HAVE_PARALLEL diff --git a/src/H5Ftest.c b/src/H5Ftest.c index e1569a7..ced4b2c 100644 --- a/src/H5Ftest.c +++ b/src/H5Ftest.c @@ -531,12 +531,12 @@ done: } /* H5F__vfd_swmr_verify_md_hdr_and_idx() */ static unsigned -count_old_images(old_image_queue_t *old_images) +count_shadow_defrees(shadow_defree_queue_t *shadow_defrees) { - old_image_t *old_image; + shadow_defree_t *shadow_defree; unsigned count = 0; - TAILQ_FOREACH(old_image, old_images, link) + TAILQ_FOREACH(shadow_defree, shadow_defrees, link) count++; return count; @@ -551,7 +551,7 @@ count_old_images(old_image_queue_t *old_images) * --info read from the metadata file is as indicated by * the input: num_entries, index * --# of entries on the delayed list is as indicated by - * the input: nold_images + * the input: nshadow_defrees * * Return: SUCCEED/FAIL * @@ -559,7 +559,7 @@ count_old_images(old_image_queue_t *old_images) */ herr_t H5F__vfd_swmr_writer_md_test(hid_t file_id, unsigned num_entries, - H5FD_vfd_swmr_idx_entry_t *index, unsigned nold_images) + H5FD_vfd_swmr_idx_entry_t *index, unsigned nshadow_defrees) { H5F_t *f; /* File pointer */ int md_fd = -1; /* The metadata file descriptor */ @@ -581,7 +581,7 @@ H5F__vfd_swmr_writer_md_test(hid_t file_id, unsigned num_entries, HGOTO_ERROR(H5E_FILE, H5E_CANTALLOC, FAIL, "error updating the md file with the index") /* Verify the number of entries in the delayed list is as expected */ - if(count_old_images(&f->shared->old_images) < nold_images) + if(count_shadow_defrees(&f->shared->shadow_defrees) < nshadow_defrees) HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "incorrect # of entries in the delayed list") /* Open the metadata file */ diff --git a/src/H5Fvfd_swmr.c b/src/H5Fvfd_swmr.c index 6c9ba05..2d8d58e 100644 --- a/src/H5Fvfd_swmr.c +++ b/src/H5Fvfd_swmr.c @@ -113,8 +113,8 @@ eot_queue_t eot_queue_g = TAILQ_HEAD_INITIALIZER(eot_queue_g); /* Local Variables */ /*******************/ -/* Declare a free list to manage the old_image_t struct */ -H5FL_DEFINE(old_image_t); +/* Declare a free list to manage the shadow_defree_t struct */ +H5FL_DEFINE(shadow_defree_t); /* Declare a free list to manage the eot_queue_entry_t struct */ H5FL_DEFINE(eot_queue_entry_t); @@ -173,7 +173,7 @@ H5F_vfd_swmr_init(H5F_t *f, hbool_t file_create) HDassert(f->shared->vfd_swmr_config.writer); - SIMPLEQ_INIT(&f->shared->deferred_frees); + SIMPLEQ_INIT(&f->shared->lower_defrees); f->shared->vfd_swmr_writer = TRUE; f->shared->tick_num = 1; @@ -314,7 +314,7 @@ done: herr_t H5F_vfd_swmr_close_or_flush(H5F_t *f, hbool_t closing) { - old_image_t *curr; + shadow_defree_t *curr; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -358,12 +358,12 @@ H5F_vfd_swmr_close_or_flush(H5F_t *f, hbool_t closing) "unable to close the free-space manager for the metadata file") /* Free the delayed list */ - while ((curr = TAILQ_FIRST(&f->shared->old_images)) != NULL) { - TAILQ_REMOVE(&f->shared->old_images, curr, link); - H5FL_FREE(old_image_t, curr); + while ((curr = TAILQ_FIRST(&f->shared->shadow_defrees)) != NULL) { + TAILQ_REMOVE(&f->shared->shadow_defrees, curr, link); + H5FL_FREE(shadow_defree_t, curr); } - assert(TAILQ_EMPTY(&f->shared->old_images)); + assert(TAILQ_EMPTY(&f->shared->shadow_defrees)); } else { /* For file flush */ /* Update end_of_tick */ @@ -383,20 +383,20 @@ int shadow_image_defer_free(H5F_shared_t *shared, const H5FD_vfd_swmr_idx_entry_t *entry) { - old_image_t *old_image; + shadow_defree_t *shadow_defree; - if (NULL == (old_image = H5FL_CALLOC(old_image_t))) + if (NULL == (shadow_defree = H5FL_CALLOC(shadow_defree_t))) return -1; - old_image->hdf5_page_offset = entry->hdf5_page_offset; - old_image->md_file_page_offset = entry->md_file_page_offset; - old_image->length = entry->length; - old_image->tick_num = shared->tick_num; + shadow_defree->hdf5_page_offset = entry->hdf5_page_offset; + shadow_defree->md_file_page_offset = entry->md_file_page_offset; + shadow_defree->length = entry->length; + shadow_defree->tick_num = shared->tick_num; - if (TAILQ_EMPTY(&shared->old_images)) + if (TAILQ_EMPTY(&shared->shadow_defrees)) ldbgf("Adding to the old images list.\n"); - TAILQ_INSERT_HEAD(&shared->old_images, old_image, link); + TAILQ_INSERT_HEAD(&shared->shadow_defrees, shadow_defree, link); return 0; } @@ -439,10 +439,10 @@ herr_t H5F_update_vfd_swmr_metadata_file(H5F_t *f, uint32_t num_entries, H5FD_vfd_swmr_idx_entry_t *index) { - old_image_t *prev; /* Points to the previous entry + shadow_defree_t *prev; /* Points to the previous entry * in the delayed list */ - old_image_t *old_image; /* Points to an entry in the + shadow_defree_t *shadow_defree; /* Points to an entry in the * delayed list */ haddr_t md_addr; /* Address in the metadata file */ @@ -555,31 +555,31 @@ H5F_update_vfd_swmr_metadata_file(H5F_t *f, uint32_t num_entries, * --remove the associated entries from the list */ - TAILQ_FOREACH_REVERSE_SAFE(old_image, &f->shared->old_images, - old_image_queue, link, prev) { + TAILQ_FOREACH_REVERSE_SAFE(shadow_defree, &f->shared->shadow_defrees, + shadow_defree_queue, link, prev) { /* max_lag is at least 3 */ if ( ( f->shared->tick_num > f->shared->vfd_swmr_config.max_lag ) && - ( old_image->tick_num <= + ( shadow_defree->tick_num <= f->shared->tick_num - f->shared->vfd_swmr_config.max_lag ) ) { - if ( H5MV_free(f, old_image->md_file_page_offset * - f->shared->fs_page_size, old_image->length) < 0 ) + if ( H5MV_free(f, shadow_defree->md_file_page_offset * + f->shared->fs_page_size, shadow_defree->length) < 0 ) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, \ "unable to flush clean entry") #if 0 fprintf(stderr, "released %" PRIu32 " bytes at %" PRIu64 "\n", - old_image->length, - old_image->md_file_page_offset * f->shared->fs_page_size); + shadow_defree->length, + shadow_defree->md_file_page_offset * f->shared->fs_page_size); #endif /* Remove the entry from the delayed list */ - TAILQ_REMOVE(&f->shared->old_images, old_image, link); + TAILQ_REMOVE(&f->shared->shadow_defrees, shadow_defree, link); /* Free the delayed entry struct */ - H5FL_FREE(old_image_t, old_image); + H5FL_FREE(shadow_defree_t, shadow_defree); } else { @@ -587,7 +587,7 @@ H5F_update_vfd_swmr_metadata_file(H5F_t *f, uint32_t num_entries, } } - if (TAILQ_EMPTY(&f->shared->old_images)) + if (TAILQ_EMPTY(&f->shared->shadow_defrees)) ldbgf("Emptied the old images list.\n"); done: @@ -136,7 +136,7 @@ static herr_t defer_free(H5F_shared_t *shared, H5FD_mem_t alloc_type, haddr_t addr, hsize_t size) { - deferred_free_t *df; + lower_defree_t *df; if ((df = malloc(sizeof(*df))) == NULL) return FAIL; @@ -146,7 +146,7 @@ defer_free(H5F_shared_t *shared, H5FD_mem_t alloc_type, haddr_t addr, df->size = size; df->free_after_tick = shared->tick_num + shared->vfd_swmr_config.max_lag; - SIMPLEQ_INSERT_TAIL(&shared->deferred_frees, df, link); + SIMPLEQ_INSERT_TAIL(&shared->lower_defrees, df, link); return SUCCEED; } @@ -154,12 +154,12 @@ defer_free(H5F_shared_t *shared, H5FD_mem_t alloc_type, haddr_t addr, static herr_t process_deferred_frees(H5F_t *f) { - deferred_free_t *df; + lower_defree_t *df; herr_t err = SUCCEED; H5F_shared_t *shared = f->shared; const uint64_t tick_num = shared->tick_num; - while ((df = SIMPLEQ_FIRST(&shared->deferred_frees)) != NULL) { + while ((df = SIMPLEQ_FIRST(&shared->lower_defrees)) != NULL) { if (tick_num <= df->free_after_tick) break; /* Have to remove the item before processing it because we @@ -167,7 +167,7 @@ process_deferred_frees(H5F_t *f) * the item was still on the queue, it would be processed * a second time, and that's not good. */ - SIMPLEQ_REMOVE_HEAD(&shared->deferred_frees, link); + SIMPLEQ_REMOVE_HEAD(&shared->lower_defrees, link); if (H5MF__xfree_impl(f, df->alloc_type, df->addr, df->size) < 0) err = FAIL; free(df); |