diff options
author | vchoi-hdfgroup <55293060+vchoi-hdfgroup@users.noreply.github.com> | 2022-04-04 19:40:16 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-04 19:40:16 (GMT) |
commit | ff7fe9e9af404591d3d50f3b33d190679529bb10 (patch) | |
tree | d2bd03b84b8e97d21dbcdfaa04199c898b6ae291 /src/H5Fpkg.h | |
parent | e3ff70f44a4360b26e569f6047a906f522fb28ed (diff) | |
parent | bc62da7eb911727497475d1cc90991230f33fa3d (diff) | |
download | hdf5-ff7fe9e9af404591d3d50f3b33d190679529bb10.zip hdf5-ff7fe9e9af404591d3d50f3b33d190679529bb10.tar.gz hdf5-ff7fe9e9af404591d3d50f3b33d190679529bb10.tar.bz2 |
Merge pull request #60 from HDFGroup/feature/vfd_swmr
Feature/vfd swmr
Diffstat (limited to 'src/H5Fpkg.h')
-rw-r--r-- | src/H5Fpkg.h | 142 |
1 files changed, 73 insertions, 69 deletions
diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index ca26941..ca714c1 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -79,7 +79,7 @@ #define H5F_SUPERBLOCK_FIXED_SIZE (H5F_SIGNATURE_LEN + 1) /* superblock version */ /* The H5F_SUPERBLOCK_MINIMAL_VARLEN_SIZE is the minimal amount of super block - * variable length data guarnateed to load the sizeof offsets and the sizeof + * variable length data guaranteed to load the sizeof offsets and the sizeof * lengths fields in all versions of the superblock. * * This is necessary in the V3 cache, as on the initial load, we need to @@ -153,6 +153,62 @@ /* Size of file consistency flags (status_flags) in the superblock */ #define H5F_SUPER_STATUS_FLAGS_SIZE(v) (v >= 2 ? 1 : 4) +/* VFD SMWR LOG REPORTING MACROS */ + +/* H5F_POST_VFD_SWMR_LOG_ENTRY is the macro that can help the developers debug VFD SWMR features. + * It calls an internal reporting function H5F_post_vfd_swmr_log_entry() that receives + * a log entry_type_code, which generates a log tag, and the message log_info, which + * the developers want to save into a log file. + * + * The macro H5F_POST_VFD_SWMR_LOG_ENTRY_PRODUCTION(f, c, number_entry_production, m) is + * called by H5F_POST_VFD_SWMR_LOG_ENTRY when the HDF5 library is built with the + * production mode. Number_entry_production will control the number of entry tags that + * applications can receive. Currently this number is set to 1 and is subject to change + * when more tags are useful to be present to applications. + * + * The first argument of the macro is the HDF5 file pointer(H5F_t *). + * Its value needs to be checked to avoid a failure caused by "Low-Level File I/O " + * in the testhdf5 program, which involves the test of a non-existing HDF5 file. + */ + +#define H5F_POST_VFD_SWMR_LOG_ENTRY_INTERNAL(fp, entry_type_code, log_info) \ + do { \ + if (fp != NULL) { \ + if (fp->shared != NULL) { \ + if (fp->shared->vfd_swmr_log_on == TRUE) { \ + H5F__post_vfd_swmr_log_entry(fp, entry_type_code, log_info); \ + } \ + } \ + } \ + } while (0) + +#define H5F_POST_VFD_SWMR_LOG_ENTRY_PRODUCTION(fp, entry_type_code, max_code, log_info) \ + do { \ + if (entry_type_code < max_code) { \ + H5F_POST_VFD_SWMR_LOG_ENTRY_INTERNAL(fp, entry_type_code, log_info); \ + } \ + } while (0) + +/* Note: change H5F_POST_VFD_SWMR_LOG_ENTRY_PRODUCTION(f, c, 1, m) on the following lines to + * H5F_POST_VFD_SWMR_LOG_ENTRY_PRODUCTION(f, c, your_number_entry_production, m) + * as necessary. + */ +#ifndef NDEBUG +#define H5F_POST_VFD_SWMR_LOG_ENTRY(f, c, m) H5F_POST_VFD_SWMR_LOG_ENTRY_INTERNAL(f, c, m) +#else +#define H5F_POST_VFD_SWMR_LOG_ENTRY(f, c, m) H5F_POST_VFD_SWMR_LOG_ENTRY_PRODUCTION(f, c, 1, m) +#endif + +/* Macros for VFD SWMR log entry code + * Note: this should be consistent with const char *H5Fvfd_swmr_log_tags[] declared at + * H5Fvfd_swmr.c . + */ +#define EOT_PROCESSING_TIME 0 +#define FILE_OPEN 1 +#define FILE_CLOSE 2 +#define EOT_TRIGGER_TIME 3 +#define EOT_META_FILE_INDEX 4 + /* Forward declaration external file cache struct used below (defined in * H5Fefc.c) */ typedef struct H5F_efc_t H5F_efc_t; @@ -218,10 +274,10 @@ typedef struct H5F_mtab_t { * the shadow file to release after max_lag ticks. */ typedef struct shadow_defree { - uint64_t offset; // offset of the region in *bytes* - uint32_t length; // length of the region in *bytes* - uint64_t tick_num; // tick number when the free was deferred - TAILQ_ENTRY(shadow_defree) link; // deferred-free queue linkage + uint64_t offset; /* offset of the region in *bytes* */ + uint32_t length; /* length of the region in *bytes* */ + uint64_t tick_num; /* tick number when the free was deferred */ + TAILQ_ENTRY(shadow_defree) link; /* deferred-free queue linkage */ } shadow_defree_t; /* Structure specifically to store superblock. This was originally @@ -247,10 +303,10 @@ typedef struct H5F_super_t { * the file below the SWMR VFD to release after a delay. */ typedef struct lower_defree { - SIMPLEQ_ENTRY(lower_defree) link; // deferred-free queue linkage - H5FD_mem_t alloc_type; // type with which the region was allocated - haddr_t addr; // start of the region *in bytes* - hsize_t size; // length of the region *in bytes* + SIMPLEQ_ENTRY(lower_defree) link; /* deferred-free queue linkage */ + H5FD_mem_t alloc_type; /* type with which the region was allocated */ + haddr_t addr; /* start of the region *in bytes* */ + hsize_t size; /* length of the region *in bytes* */ uint64_t free_after_tick; /* the region may be reused on tick * free_after_tick + 1 at the earliest */ @@ -385,7 +441,7 @@ struct H5F_shared_t { /* Metadata retry info */ unsigned read_attempts; /* The # of reads to try when reading metadata with checksum */ unsigned retries_nbins; /* # of bins for each retries[] */ - uint32_t *retries[H5AC_NTYPES]; /* Track # of read retries for metdata items with checksum */ + uint32_t *retries[H5AC_NTYPES]; /* Track # of read retries for metadata items with checksum */ /* Object flush info */ H5F_object_flush_t object_flush; /* Information for object flush callback */ @@ -441,7 +497,7 @@ struct H5F_shared_t { */ uint32_t mdf_idx_entries_used; /* Number of entries in *mdf_idx * that are in use -- these will - * be contiguous at indicies 0 + * be contiguous at indices 0 * through mdf_idx_entries_used - 1. */ @@ -482,7 +538,7 @@ struct H5F_shared_t { * file */ uint64_t updater_seq_num; /* Sequence number of the next updater file to be - * genereated. This field must be initialized to zero, + * generated. This field must be initialized to zero, * and incremented after each updater file is generated. */ @@ -564,6 +620,8 @@ H5_DLL herr_t H5F__set_libver_bounds(H5F_t *f, H5F_libver_t low, H5F_libver_t hi 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__delete(const char *filename, hid_t fapl_id); + +/* VFD SWMR routines */ H5_DLL herr_t H5F__vfd_swmr_end_tick(H5F_t *f); H5_DLL herr_t H5F__vfd_swmr_disable_end_of_tick(H5F_t *f); H5_DLL herr_t H5F__vfd_swmr_enable_end_of_tick(H5F_t *f); @@ -626,6 +684,9 @@ H5_DLL herr_t H5F__get_max_eof_eoa(const H5F_t *f, haddr_t *max_eof_eoa); /* Functions that flush or evict */ H5_DLL herr_t H5F__evict_cache_entries(H5F_t *f); +/* VFD SWMR log functions */ +H5_DLL void H5F__post_vfd_swmr_log_entry(H5F_t *f, int entry_type_code, const char *log_info); + /* Testing functions */ #ifdef H5F_TESTING H5_DLL herr_t H5F__get_sohm_mesg_count_test(hid_t fid, unsigned type_id, size_t *mesg_count); @@ -641,61 +702,4 @@ H5_DLL htri_t H5F__same_file_test(hid_t file_id1, hid_t file_id2); H5_DLL herr_t H5F__reparse_file_lock_variable_test(void); #endif /* H5F_TESTING */ -/* VFD SMWR LOG REPORTING MACROS */ - -/* H5F_POST_VFD_SWMR_LOG_ENTRY is the macro that can help the developers debug VFD SWMR features. - * It calls an internal reporting function H5F_post_vfd_swmr_log_entry() that receives - * a log entry_type_code, which generates a log tag, and the message log_info, which - * the developers want to save into a log file. - * - * The macro H5F_POST_VFD_SWMR_LOG_ENTRY_PRODUCTION(f, c, number_entry_production, m) is - * called by H5F_POST_VFD_SWMR_LOG_ENTRY when the HDF5 library is built with the - * production mode. Number_entry_production will control the number of entry tags that - * applications can receive. Currently this number is set to 1 and is subject to change - * when more tags are useful to be present to applications. - * - * The first argument of the macro is the HDF5 file pointer(H5F_t *). - * Its value needs to be checked to avoid a failure caused by "Low-Level File I/O " - * in the testhdf5 program, which involves the test of a non-existing HDF5 file. - */ - -H5_DLL void H5F_post_vfd_swmr_log_entry(H5F_t *f, int entry_type_code, char *log_info); - -#define H5F_POST_VFD_SWMR_LOG_ENTRY_INTERNAL(fp, entry_type_code, log_info) \ - do { \ - if (fp != NULL) { \ - if (fp->shared != NULL) { \ - if (fp->shared->vfd_swmr_log_on == TRUE) { \ - H5F_post_vfd_swmr_log_entry(fp, entry_type_code, log_info); \ - } \ - } \ - } \ - } while (0) - -#define H5F_POST_VFD_SWMR_LOG_ENTRY_PRODUCTION(fp, entry_type_code, max_code, log_info) \ - do { \ - if (entry_type_code < max_code) { \ - H5F_POST_VFD_SWMR_LOG_ENTRY_INTERNAL(fp, entry_type_code, log_info); \ - } \ - } while (0) - -/* Note: change H5F_POST_VFD_SWMR_LOG_ENTRY_PRODUCTION(f, c, 1, m) on the following lines to - * H5F_POST_VFD_SWMR_LOG_ENTRY_PRODUCTION(f, c, your_number_entry_production, m) - * as necessary. - */ -#ifndef NDEBUG -#define H5F_POST_VFD_SWMR_LOG_ENTRY(f, c, m) H5F_POST_VFD_SWMR_LOG_ENTRY_INTERNAL(f, c, m) -#else -#define H5F_POST_VFD_SWMR_LOG_ENTRY(f, c, m) H5F_POST_VFD_SWMR_LOG_ENTRY_PRODUCTION(f, c, 1, m) -#endif - -/* Macros for VFD SWMR log entry code - * Note: this should be consistent with const char *H5Fvfd_swmr_log_tags[] declared at - * H5Fvfd_swmr.c . - */ -#define EOT_PROCESSING_TIME 0 -#define FILE_OPEN 1 -#define FILE_CLOSE 2 -#define EOT_TRIGGER_TIME 3 -#define EOT_META_FILE_INDEX 4 #endif /* H5Fpkg_H */ |