From aee40b370d9d005f7d15cc3f4c2b4c78fc8a9ab8 Mon Sep 17 00:00:00 2001 From: David Young Date: Mon, 20 Apr 2020 16:05:27 -0500 Subject: Retire globals vfd_swmr_writer_g and end_of_tick_g. --- src/H5FDvfd_swmr_private.h | 2 -- src/H5Fvfd_swmr.c | 24 ++---------------------- test/vfd_swmr.c | 22 +++++++++++----------- 3 files changed, 13 insertions(+), 35 deletions(-) diff --git a/src/H5FDvfd_swmr_private.h b/src/H5FDvfd_swmr_private.h index cb7cc79..1609eeb 100644 --- a/src/H5FDvfd_swmr_private.h +++ b/src/H5FDvfd_swmr_private.h @@ -58,8 +58,6 @@ typedef struct eot_queue_entry { } eot_queue_entry_t; extern unsigned int vfd_swmr_api_entries_g; -extern hbool_t vfd_swmr_writer_g; -extern struct timespec end_of_tick_g; /* The head of the EOT queue */ typedef TAILQ_HEAD(eot_queue, eot_queue_entry) eot_queue_t; diff --git a/src/H5Fvfd_swmr.c b/src/H5Fvfd_swmr.c index 17bfb11..0e7a3cc 100644 --- a/src/H5Fvfd_swmr.c +++ b/src/H5Fvfd_swmr.c @@ -76,9 +76,6 @@ static herr_t H5F__vfd_swmr_writer__wait_a_tick(H5F_t *f); * Globals for VFD SWMR */ -hbool_t vfd_swmr_writer_g = FALSE; /* Is this the VFD SWMR writer */ -struct timespec end_of_tick_g; /* The current end_of_tick */ - unsigned int vfd_swmr_api_entries_g = 0;/* Times the library was entered * and re-entered minus the times * it was exited. We only perform @@ -129,7 +126,6 @@ H5FL_DEFINE(eot_queue_entry_t); * * For VFD SWMR writer: * - * --set vfd_swmr_writer_g to TRUE * --set f->shared->tick_num to 1 * --create the metadata file * --when opening an existing HDF5 file, write header and @@ -137,7 +133,6 @@ H5FL_DEFINE(eot_queue_entry_t); * * For VFD SWMR reader: * - * --set vfd_swmr_writer_g to FALSE * --set f->shared->tick_num to the current tick read from the * metadata file * @@ -1438,12 +1433,6 @@ H5F_vfd_swmr_remove_entry_eot(H5F_t *f) curr = H5FL_FREE(eot_queue_entry_t, curr); } - if(!TAILQ_EMPTY(&eot_queue_g)) { - vfd_swmr_writer_g = TAILQ_FIRST(&eot_queue_g)->vfd_swmr_writer; - end_of_tick_g = TAILQ_FIRST(&eot_queue_g)->end_of_tick; - } else - vfd_swmr_writer_g = FALSE; - FUNC_LEAVE_NOAPI(SUCCEED) } /* H5F_vfd_swmr_remove_entry_eot() */ @@ -1492,13 +1481,6 @@ H5F_vfd_swmr_insert_entry_eot(H5F_t *f) else TAILQ_INSERT_HEAD(&eot_queue_g, entry_ptr, link); - /* Set up globals accordingly */ - if(!TAILQ_EMPTY(&eot_queue_g)) { - vfd_swmr_writer_g = TAILQ_FIRST(&eot_queue_g)->vfd_swmr_writer; - end_of_tick_g = TAILQ_FIRST(&eot_queue_g)->end_of_tick; - } else - vfd_swmr_writer_g = FALSE; - done: FUNC_LEAVE_NOAPI(ret_value) @@ -1553,7 +1535,7 @@ H5F_dump_eot_queue(void) * * Function: H5F__vfd_swmr_update_end_of_tick_and_tick_num * - * Purpose: Update end_of_tick (end_of_tick_g, f->shared->end_of_tick) + * Purpose: Update end_of_tick (f->shared->end_of_tick) * Update tick_num (f->shared->tick_num) * * Return: Success: SUCCEED @@ -1609,7 +1591,7 @@ H5F__vfd_swmr_update_end_of_tick_and_tick_num(H5F_t *f, hbool_t incr_tick_num) } /* - * Update end_of_tick_g, f->shared->end_of_tick + * Update f->shared->end_of_tick */ /* Calculate new end_of_tick */ @@ -1623,8 +1605,6 @@ H5F__vfd_swmr_update_end_of_tick_and_tick_num(H5F_t *f, hbool_t incr_tick_num) new_end_of_tick.tv_nsec = (long)(new_end_nsecs % nanosecs_per_second); new_end_of_tick.tv_sec = new_end_nsecs / nanosecs_per_second; - /* Update end_of_tick */ - end_of_tick_g = new_end_of_tick; f->shared->end_of_tick = new_end_of_tick; done: diff --git a/test/vfd_swmr.c b/test/vfd_swmr.c index 72d1581..02cb877 100644 --- a/test/vfd_swmr.c +++ b/test/vfd_swmr.c @@ -1832,7 +1832,7 @@ test_multiple_file_opens(void) FAIL_STACK_ERROR /* Verify the global vfd_swmr_writer_g is not set */ - if(vfd_swmr_writer_g) + if((curr = TAILQ_FIRST(&eot_queue_g)) != NULL && curr->vfd_swmr_writer) TEST_ERROR; /* The EOT queue should be empty */ if(!TAILQ_EMPTY(&eot_queue_g)) @@ -1846,8 +1846,8 @@ test_multiple_file_opens(void) if(NULL == (f1 = (H5F_t *)H5VL_object(fid1))) FAIL_STACK_ERROR - /* The global vfd_swmr_writer_g should be set */ - if(!vfd_swmr_writer_g) + /* Head of EOT queue should be a writer */ + if((curr = TAILQ_FIRST(&eot_queue_g)) == NULL || !curr->vfd_swmr_writer) TEST_ERROR; /* The EOT queue should be initialized with the first entry equals to f1 */ if((curr = TAILQ_FIRST(&eot_queue_g)) == NULL || curr->vfd_swmr_file != f1) @@ -1861,8 +1861,8 @@ test_multiple_file_opens(void) if(NULL == (f2 = (H5F_t *)H5VL_object(fid2))) FAIL_STACK_ERROR - /* The global vfd_swmr_writer_g should still be set */ - if(!vfd_swmr_writer_g) + /* Head of EOT queue should be a writer */ + if((curr = TAILQ_FIRST(&eot_queue_g)) == NULL || !curr->vfd_swmr_writer) TEST_ERROR; /* The EOT queue's first entry should be f1 */ if((curr = TAILQ_FIRST(&eot_queue_g)) == NULL || curr->vfd_swmr_file != f1) @@ -1878,8 +1878,8 @@ test_multiple_file_opens(void) if(H5Fclose(fid1) < 0) FAIL_STACK_ERROR; - /* The global vfd_swmr_writer_g should still be set */ - if(!vfd_swmr_writer_g) + /* Head of EOT queue should be a writer */ + if((curr = TAILQ_FIRST(&eot_queue_g)) == NULL || !curr->vfd_swmr_writer) TEST_ERROR; /* The EOT queue's first entry should be f2 */ if((curr = TAILQ_FIRST(&eot_queue_g)) == NULL || curr->vfd_swmr_file != f2) @@ -2146,8 +2146,8 @@ test_multiple_concur_file_opens(void) if(NULL == (f1 = (H5F_t *)H5VL_object(fid1))) FAIL_STACK_ERROR - /* The global vfd_swmr_writer_g should be set */ - if(!vfd_swmr_writer_g) + /* Head of EOT queue should be a writer */ + if((curr = TAILQ_FIRST(&eot_queue_g)) == NULL || !curr->vfd_swmr_writer) TEST_ERROR; /* The EOT queue's first entry should be f1 */ @@ -2202,8 +2202,8 @@ test_multiple_concur_file_opens(void) if(NULL == (f2 = (H5F_t *)H5VL_object(fid2))) FAIL_STACK_ERROR - /* The global vfd_swmr_writer_g should not be set */ - if(vfd_swmr_writer_g) + /* Head of EOT queue should NOT be a writer */ + if((curr = TAILQ_FIRST(&eot_queue_g)) != NULL && curr->vfd_swmr_writer) TEST_ERROR; /* The EOT queue's first entry should be f2 */ -- cgit v0.12