diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/H5C.c | 6 | ||||
-rw-r--r-- | src/H5FDvfd_swmr.c | 82 | ||||
-rw-r--r-- | src/H5FDvfd_swmr_private.h | 12 | ||||
-rw-r--r-- | src/H5Fvfd_swmr.c | 157 | ||||
-rw-r--r-- | src/H5MF.c | 151 | ||||
-rw-r--r-- | src/H5MFsection.c | 4 | ||||
-rw-r--r-- | src/H5MV.c | 25 | ||||
-rw-r--r-- | src/H5PB.c | 100 | ||||
-rw-r--r-- | src/H5VLnative_object.c | 2 | ||||
-rw-r--r-- | src/H5private.h | 13 | ||||
-rw-r--r-- | src/H5retry_private.h | 6 | ||||
-rw-r--r-- | src/H5time_private.h | 6 | ||||
-rw-r--r-- | src/Makefile.am | 3 | ||||
-rw-r--r-- | src/hlog.c | 366 | ||||
-rw-r--r-- | src/hlog.h | 138 |
16 files changed, 122 insertions, 951 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index af4920b..038948c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -12,7 +12,6 @@ set (H5_SOURCES ${HDF5_SRC_DIR}/H5system.c ${HDF5_SRC_DIR}/H5timer.c ${HDF5_SRC_DIR}/H5trace.c - ${HDF5_SRC_DIR}/hlog.c ) set (H5_HDRS @@ -816,7 +815,6 @@ set (H5_PUBLIC_HEADERS set (H5_PRIVATE_HEADERS ${HDF5_SRC_DIR}/H5private.h - ${HDF5_SRC_DIR}/hlog.h ${HDF5_SRC_DIR}/H5Apkg.h ${HDF5_SRC_DIR}/H5Aprivate.h @@ -1325,13 +1325,7 @@ H5C_evict_or_refresh_all_entries_in_page(H5F_t * f, uint64_t page, entry_ptr = entry_ptr->pi_next; } - if (!found) { - hlog_fast(mdc_invalidation, "no MDC match for page %" PRIu64 - " length %" PRIu32 " tick %" PRIu64, page, length, tick); - } - done: - FUNC_LEAVE_NOAPI(ret_value) } /* H5C_evict_or_refresh_all_entries_in_page() */ diff --git a/src/H5FDvfd_swmr.c b/src/H5FDvfd_swmr.c index 898adaf..405bcd7 100644 --- a/src/H5FDvfd_swmr.c +++ b/src/H5FDvfd_swmr.c @@ -64,7 +64,7 @@ typedef struct H5FD_vfd_swmr_t { /* and to FALSE otherwise. */ /* Used for sanity checking. */ H5F_vfd_swmr_config_t config; - bool writer; /* True iff configured to write. + hbool_t writer; /* True iff configured to write. * All methods on a write-mode * SWMR VFD instance are passed * to the lower VFD instance. @@ -103,12 +103,6 @@ static htri_t H5FD__vfd_swmr_index_deserialize(const H5FD_vfd_swmr_t *file, H5FD_vfd_swmr_md_index *md_index, const H5FD_vfd_swmr_md_header *md_header); static herr_t H5FD__vfd_swmr_load_hdr_and_idx(H5FD_vfd_swmr_t *, hbool_t); -HLOG_OUTLET_SHORT_DEFN(index_motion, swmr); -HLOG_OUTLET_SHORT_DEFN(swmr_stats, swmr); -HLOG_OUTLET_SHORT_DEFN(swmr_read, swmr); -HLOG_OUTLET_SHORT_DEFN(swmr_read_exception, swmr_read); -HLOG_OUTLET_MEDIUM_DEFN(swmr_read_err, swmr_read_exception, HLOG_OUTLET_S_ON); - static const H5FD_class_t H5FD_vfd_swmr_g = { "vfd_swmr", /* name */ MAXADDR, /* maxaddr */ @@ -269,14 +263,14 @@ static herr_t H5FD__swmr_reader_open(H5FD_vfd_swmr_t *file) { h5_retry_t retry; - bool do_try; /* more tries remain */ + hbool_t do_try; /* more tries remain */ herr_t ret_value = SUCCEED; FUNC_ENTER_STATIC file->api_elapsed_nbuckets = file->config.max_lag + 1; file->api_elapsed_ticks = - calloc(file->api_elapsed_nbuckets, sizeof(*file->api_elapsed_ticks)); + H5MM_calloc(file->api_elapsed_nbuckets * sizeof(*file->api_elapsed_ticks)); if (file->api_elapsed_ticks == NULL) { HGOTO_ERROR(H5E_FILE, H5E_CANTALLOC, FAIL, @@ -430,15 +424,8 @@ swmr_reader_close(H5FD_vfd_swmr_t *file) { vfd_swmr_reader_did_increase_tick_to(0); - if (file->api_elapsed_ticks != NULL) { - uint32_t i; - for (i = 0; i < file->api_elapsed_nbuckets; i++) { - hlog_fast(swmr_stats, - "%s: %" PRIu32 " ticks elapsed in API %" PRIu64 " times", - __func__, i, file->api_elapsed_ticks[i]); - } - free(file->api_elapsed_ticks); - } + if (file->api_elapsed_ticks != NULL) + H5MM_xfree(file->api_elapsed_ticks); /* Close the metadata file */ if(file->md_fd >= 0 && HDclose(file->md_fd) < 0) { @@ -477,7 +464,7 @@ H5FD_vfd_swmr_close(H5FD_t *_file) if (file->hdf5_file_lf != NULL) { if (file->hdf5_file_lf->exc_owner != NULL) { - assert(file->hdf5_file_lf->exc_owner == &file->pub); + HDassert(file->hdf5_file_lf->exc_owner == &file->pub); file->hdf5_file_lf->exc_owner = NULL; } @@ -562,13 +549,13 @@ H5FD_vfd_swmr_dedup(H5FD_t *_self, H5FD_t *_other, hid_t fapl) { H5FD_vfd_swmr_t *self = (H5FD_vfd_swmr_t *)_self; - assert(_self->driver_id == H5FD_VFD_SWMR_g); + HDassert(_self->driver_id == H5FD_VFD_SWMR_g); if (_self->cls == _other->cls) { H5FD_vfd_swmr_t *other = (H5FD_vfd_swmr_t *)_other; H5P_genplist_t *plist; H5F_vfd_swmr_config_t *config; - bool equal_configs; + hbool_t equal_configs; if (H5FD_cmp(self->hdf5_file_lf, other->hdf5_file_lf) != 0) return _other; @@ -589,7 +576,7 @@ H5FD_vfd_swmr_dedup(H5FD_t *_self, H5FD_t *_other, hid_t fapl) return NULL; } - if ((config = malloc(sizeof(*config))) == NULL) { + if ((config = H5MM_malloc(sizeof(*config))) == NULL) { HERROR(H5E_ARGS, H5E_BADTYPE, "could not allocate config"); return NULL; } @@ -598,9 +585,9 @@ H5FD_vfd_swmr_dedup(H5FD_t *_self, H5FD_t *_other, hid_t fapl) return NULL; } - equal_configs = memcmp(&self->config, config, sizeof(*config)) == 0; + equal_configs = HDmemcmp(&self->config, config, sizeof(*config)) == 0; - free(config); + H5MM_xfree(config); if (equal_configs) return _self; @@ -856,11 +843,7 @@ H5FD_vfd_swmr_read(H5FD_t *_file, H5FD_mem_t type, target_page = addr / fs_page_size; entry = vfd_swmr_pageno_to_mdf_idx_entry(index, num_entries, target_page, - false); - - hlog_fast(swmr_read, "%s: enter type %d addr %" PRIuHADDR " size %zu " - "file %s", __func__, type, addr, size, - (entry == NULL) ? "lower" : "shadow"); + FALSE); if (entry == NULL) { /* Cannot find addr in index, read from the underlying hdf5 file */ @@ -926,31 +909,15 @@ H5FD_vfd_swmr_read(H5FD_t *_file, H5FD_mem_t type, * is John's hack to allow the library to find the superblock * signature. */ - if (!file->pb_configured) { - hlog_fast(swmr_read_exception, - "%s: skipping checksum, page buffer not configured", __func__); - } else if (entry->length != init_size) { - hlog_fast(swmr_read_exception, - "%s: skipping checksum, buffer size != entry size", __func__); - } else if (H5_checksum_metadata(buf, entry->length, 0) != entry->chksum) { + if (file->pb_configured && entry->length == init_size + && H5_checksum_metadata(buf, entry->length, 0) != entry->chksum) { H5FD_vfd_swmr_md_header tmp_header; - hlog_fast(swmr_read_err, "%s: bad checksum", __func__); - hlog_fast(swmr_read_err, "addr %" PRIuHADDR " page %" PRIuHADDR - " len %zu type %d ...", addr, addr / fs_page_size, init_size, type); - hlog_fast(swmr_read_err, "... index[%" PRId64 "] lower pgno %" PRIu64 - " shadow pgno %" PRIu64 " len %" PRIu32 " sum %" PRIx32, - (int64_t)(entry - index), entry->hdf5_page_offset, - entry->md_file_page_offset, entry->length, entry->chksum); - if (H5FD__vfd_swmr_header_deserialize(file, &tmp_header) != TRUE) { HGOTO_ERROR(H5E_VFL, H5E_CANTLOAD, FAIL, "checksum error in shadow file entry; could not load header"); } - hlog_fast(swmr_read_err, "... header tick last read %" PRIu64 - " latest %" PRIu64, file->md_header.tick_num, tmp_header.tick_num); - HGOTO_ERROR(H5E_VFL, H5E_CANTLOAD, FAIL, "checksum error in shadow file entry"); } @@ -1117,7 +1084,7 @@ done: static herr_t H5FD__vfd_swmr_load_hdr_and_idx(H5FD_vfd_swmr_t *file, hbool_t open) { - bool do_try; + hbool_t do_try; h5_retry_t retry; H5FD_vfd_swmr_md_header md_header; /* Metadata file header, take 1 */ H5FD_vfd_swmr_md_header md_header_two; /* Metadata file header, take 2 */ @@ -1145,11 +1112,8 @@ H5FD__vfd_swmr_load_hdr_and_idx(H5FD_vfd_swmr_t *file, hbool_t open) if (rc != TRUE) HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "could not read header"); - if (md_header.index_offset != last_index_offset) { - hlog_fast(index_motion, "index offset changed %" PRIu64 "\n", - md_header.index_offset); + if (md_header.index_offset != last_index_offset) last_index_offset = md_header.index_offset; - } if (open) ; // ignore tick number on open @@ -1263,13 +1227,13 @@ H5FD__vfd_swmr_header_deserialize(H5FD_vfd_swmr_t *file, FUNC_ENTER_STATIC /* Set file pointer to the beginning the file */ - if (lseek(file->md_fd, H5FD_MD_HEADER_OFF, SEEK_SET) < 0) { + if (HDlseek(file->md_fd, H5FD_MD_HEADER_OFF, SEEK_SET) < 0) { HGOTO_ERROR(H5E_VFL, H5E_SEEKERROR, FAIL, \ "unable to seek in metadata file"); } /* Read the header */ - nread = read(file->md_fd, image, H5FD_MD_HEADER_SIZE); + nread = HDread(file->md_fd, image, H5FD_MD_HEADER_SIZE); /* Try again if a signal interrupted the read. */ if (nread == -1 && errno == EINTR) @@ -1287,7 +1251,7 @@ H5FD__vfd_swmr_header_deserialize(H5FD_vfd_swmr_t *file, HGOTO_DONE(FALSE); /* Verify magic number */ - if (memcmp(image, H5FD_MD_HEADER_MAGIC, H5_SIZEOF_MAGIC) != 0) + if (HDmemcmp(image, H5FD_MD_HEADER_MAGIC, H5_SIZEOF_MAGIC) != 0) HGOTO_DONE(FALSE); /* Verify stored and computed checksums are equal */ @@ -1371,12 +1335,12 @@ H5FD__vfd_swmr_index_deserialize(const H5FD_vfd_swmr_t *file, } /* We may seek past EOF. That's ok, the read(2) will catch that. */ - if (lseek(file->md_fd, (HDoff_t)md_header->index_offset, SEEK_SET) < 0){ + if (HDlseek(file->md_fd, (HDoff_t)md_header->index_offset, SEEK_SET) < 0){ HGOTO_ERROR(H5E_VFL, H5E_SEEKERROR, FAIL, "unable to seek in metadata file"); } - nread = read(file->md_fd, image, md_header->index_length); + nread = HDread(file->md_fd, image, md_header->index_length); /* Try again if a signal interrupted the read. */ if (nread == -1 && errno == EINTR) @@ -1423,7 +1387,7 @@ H5FD__vfd_swmr_index_deserialize(const H5FD_vfd_swmr_t *file, * read bad magic. It's possible to recover by * re-reading the header. */ - if (memcmp(image, H5FD_MD_INDEX_MAGIC, H5_SIZEOF_MAGIC) != 0) + if (HDmemcmp(image, H5FD_MD_INDEX_MAGIC, H5_SIZEOF_MAGIC) != 0) HGOTO_DONE(FALSE); /* Verify stored and computed checksums are equal */ @@ -1521,7 +1485,7 @@ H5FD_vfd_swmr_get_tick_and_idx(H5FD_t *_file, hbool_t reload_hdr_and_index, H5FD_vfd_swmr_t *file = (H5FD_vfd_swmr_t *)_file; /* VFD SWMR file struct */ herr_t ret_value = SUCCEED; /* Return value */ - assert(index == NULL || num_entries_ptr != NULL); + HDassert(index == NULL || num_entries_ptr != NULL); FUNC_ENTER_NOAPI(FAIL) diff --git a/src/H5FDvfd_swmr_private.h b/src/H5FDvfd_swmr_private.h index d79ec94..e2270b9 100644 --- a/src/H5FDvfd_swmr_private.h +++ b/src/H5FDvfd_swmr_private.h @@ -13,7 +13,6 @@ #define H5FDvfd_swmr_private_H #include "H5queue.h" /* for TAILQ_* */ -#include "hlog.h" /* for TAILQ_* */ /* Forward declaration */ struct H5F_t; @@ -64,11 +63,6 @@ typedef TAILQ_HEAD(eot_queue, eot_queue_entry) eot_queue_t; extern eot_queue_t eot_queue_g; -HLOG_OUTLET_DECL(swmr); -HLOG_OUTLET_DECL(pbwr); -HLOG_OUTLET_DECL(shadow_index_reclaim); -HLOG_OUTLET_DECL(mdc_invalidation); - /***************************************/ /* Library-private Function Prototypes */ /***************************************/ @@ -80,10 +74,10 @@ H5_DLL herr_t H5F_update_vfd_swmr_metadata_file(struct H5F_t *f, H5_DLL herr_t H5F_vfd_swmr_writer__delay_write(struct H5F_shared_t *, uint64_t, uint64_t *); H5_DLL herr_t H5F_vfd_swmr_writer__prep_for_flush_or_close(struct H5F_t *f); -herr_t H5F_vfd_swmr_process_eot_queue(bool); -H5_DLL herr_t H5F_vfd_swmr_writer_end_of_tick(struct H5F_t *f, bool); +herr_t H5F_vfd_swmr_process_eot_queue(hbool_t); +H5_DLL herr_t H5F_vfd_swmr_writer_end_of_tick(struct H5F_t *f, hbool_t); H5_DLL herr_t H5F_vfd_swmr_writer__dump_index(struct H5F_shared_t *); -H5_DLL herr_t H5F_vfd_swmr_reader_end_of_tick(struct H5F_t *f, bool); +H5_DLL herr_t H5F_vfd_swmr_reader_end_of_tick(struct H5F_t *f, hbool_t); H5_DLL herr_t H5F_vfd_swmr_remove_entry_eot(struct H5F_t *f); H5_DLL herr_t H5F_vfd_swmr_insert_entry_eot(struct H5F_t *f); diff --git a/src/H5Fvfd_swmr.c b/src/H5Fvfd_swmr.c index 555619d..1ff9ef7 100644 --- a/src/H5Fvfd_swmr.c +++ b/src/H5Fvfd_swmr.c @@ -48,7 +48,6 @@ #include "H5Pprivate.h" /* Property lists */ #include "H5SMprivate.h" /* Shared Object Header Messages */ #include "H5Tprivate.h" /* Datatypes */ -#include "hlog.h" /****************/ /* Local Macros */ @@ -85,18 +84,6 @@ unsigned int vfd_swmr_api_entries_g = 0;/* Times the library was entered * on the 0->1 and 1->0 * transitions. */ -HLOG_OUTLET_SHORT_DEFN(swmr, all); -HLOG_OUTLET_SHORT_DEFN(eot, swmr); -HLOG_OUTLET_SHORT_DEFN(eotq, eot); -HLOG_OUTLET_SHORT_DEFN(shadow_defrees, swmr); -HLOG_OUTLET_MEDIUM_DEFN(noisy_shadow_defrees, shadow_defrees, - HLOG_OUTLET_S_OFF); -HLOG_OUTLET_SHORT_DEFN(shadow_index_enlarge, swmr); -HLOG_OUTLET_SHORT_DEFN(shadow_index_reclaim, swmr); -HLOG_OUTLET_SHORT_DEFN(shadow_index_update, swmr); -HLOG_OUTLET_SHORT_DEFN(tick, swmr); -HLOG_OUTLET_SHORT_DEFN(mdc_invalidation, swmr); - /* * The head of the end of tick queue (EOT queue) for files opened in either * VFD SWMR write or VFD SWMR read mode @@ -183,7 +170,7 @@ H5F_vfd_swmr_init(H5F_t *f, hbool_t file_create) md_size = (hsize_t)shared->vfd_swmr_config.md_pages_reserved * shared->fs_page_size; - assert(shared->fs_page_size >= H5FD_MD_HEADER_SIZE); + HDassert(shared->fs_page_size >= H5FD_MD_HEADER_SIZE); /* Allocate an entire page from the shadow file for the header. */ if ((hdr_addr = H5MV_alloc(f, shared->fs_page_size)) == HADDR_UNDEF){ @@ -246,12 +233,9 @@ H5F_vfd_swmr_init(H5F_t *f, hbool_t file_create) HGOTO_ERROR(H5E_FILE, H5E_CANTLOAD, FAIL, "unable to load/decode metadata file"); - assert(shared->tick_num != 0); + HDassert(shared->tick_num != 0); vfd_swmr_reader_did_increase_tick_to(shared->tick_num); - hlog_fast(tick, "%s first tick %" PRIu64, - __func__, shared->tick_num); - #if 0 /* JRM */ HDfprintf(stderr, "##### initialized index: tick/used/len = %lld/%d/%d #####\n", @@ -347,9 +331,8 @@ H5F_vfd_swmr_close_or_flush(H5F_t *f, hbool_t closing) TAILQ_REMOVE(&shared->shadow_defrees, curr, link); H5FL_FREE(shadow_defree_t, curr); } - hlog_fast(shadow_defrees, "Emptied deferred shadow frees."); - assert(TAILQ_EMPTY(&shared->shadow_defrees)); + HDassert(TAILQ_EMPTY(&shared->shadow_defrees)); } else { /* For file flush */ /* Update end_of_tick */ if (H5F__vfd_swmr_update_end_of_tick_and_tick_num(shared, TRUE) < 0) @@ -372,9 +355,6 @@ shadow_range_defer_free(H5F_shared_t *shared, uint64_t offset, uint32_t length) shadow_defree->length = length; shadow_defree->tick_num = shared->tick_num; - if (TAILQ_EMPTY(&shared->shadow_defrees)) - hlog_fast(shadow_defrees, "Adding first deferred shadow free."); - TAILQ_INSERT_HEAD(&shared->shadow_defrees, shadow_defree, link); return 0; } @@ -432,7 +412,7 @@ H5F_update_vfd_swmr_metadata_file(H5F_t *f, uint32_t num_entries, haddr_t md_addr; /* Address in the metadata file */ uint32_t i; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ - bool queue_was_nonempty; + hbool_t queue_was_nonempty; FUNC_ENTER_NOAPI(FAIL) @@ -441,7 +421,7 @@ H5F_update_vfd_swmr_metadata_file(H5F_t *f, uint32_t num_entries, HDqsort(index, num_entries, sizeof(*index), H5F__idx_entry_cmp); /* Assert that no HDF5 page offsets are duplicated. */ for (i = 1; i < num_entries; i++) - assert(index[i - 1].hdf5_page_offset < index[i].hdf5_page_offset); + HDassert(index[i - 1].hdf5_page_offset < index[i].hdf5_page_offset); } /* For each non-null entry_ptr in the index: @@ -474,10 +454,6 @@ H5F_update_vfd_swmr_metadata_file(H5F_t *f, uint32_t num_entries, HGOTO_ERROR(H5E_FILE, H5E_WRITEERROR, FAIL, \ "error in allocating space from the metadata file") - hlog_fast(noisy_shadow_defrees, - "shadow index %" PRIu32 " page offset %" PRIu64 " -> %" PRIuHADDR, - i, index[i].md_file_page_offset * shared->fs_page_size, md_addr); - HDassert(md_addr % shared->fs_page_size == 0); /* Compute checksum and update the index entry */ @@ -558,20 +534,12 @@ H5F_update_vfd_swmr_metadata_file(H5F_t *f, uint32_t num_entries, "unable to flush clean entry"); } - hlog_fast(noisy_shadow_defrees, - "released %" PRIu32 " bytes at %" PRIu64, - shadow_defree->length, shadow_defree->offset); - TAILQ_REMOVE(&shared->shadow_defrees, shadow_defree, link); H5FL_FREE(shadow_defree_t, shadow_defree); } - if (queue_was_nonempty && TAILQ_EMPTY(&shared->shadow_defrees)) - hlog_fast(shadow_defrees, "Removed last deferred shadow free."); - done: - FUNC_LEAVE_NOAPI(ret_value) } /* end H5F_update_vfd_swmr_metadata_file() */ @@ -644,7 +612,7 @@ H5F_vfd_swmr_writer__delay_write(H5F_shared_t *shared, uint64_t page, ie_ptr = NULL; } else { ie_ptr = vfd_swmr_pageno_to_mdf_idx_entry(idx, - shared->mdf_idx_entries_used, page, false); + shared->mdf_idx_entries_used, page, FALSE); } if (ie_ptr == NULL) @@ -710,7 +678,7 @@ H5F_vfd_swmr_writer__prep_for_flush_or_close(H5F_t *f) * tick so as to avoid attempts to flush entries on the page buffer * tick list that were modified during the current tick. */ - if ( H5F_vfd_swmr_writer_end_of_tick(f, true) < 0 ) + if ( H5F_vfd_swmr_writer_end_of_tick(f, TRUE) < 0 ) HGOTO_ERROR(H5E_FILE, H5E_SYSTEM, FAIL, \ "H5F_vfd_swmr_writer_end_of_tick() failed.") @@ -740,21 +708,10 @@ clean_shadow_index(H5F_t *f, uint32_t nentries, for (i = j = ndeleted = 0; i < nentries; i++) { ie = &idx[i]; - if (ie->clean) { - hlog_fast(shadow_index_reclaim, - "Visiting clean shadow index slot %" PRIu32 - " lower page %" PRIu64 " last flush %" PRIu64 " ticks ago", - i, ie->hdf5_page_offset, tick_num - ie->tick_of_last_flush); - } - if (ie->clean && ie->tick_of_last_flush + max_lag < tick_num) { - assert(!ie->garbage); - assert(ie->entry_ptr == NULL); - - hlog_fast(shadow_index_reclaim, - "Reclaiming shadow index slot %" PRIu32 - " lower page %" PRIu64, i, ie->hdf5_page_offset); + HDassert(!ie->garbage); + HDassert(ie->entry_ptr == NULL); if (ie->md_file_page_offset != 0) { if (shadow_image_defer_free(shared, ie) == -1) @@ -832,7 +789,7 @@ clean_shadow_index(H5F_t *f, uint32_t nentries, *------------------------------------------------------------------------- */ herr_t -H5F_vfd_swmr_writer_end_of_tick(H5F_t *f, bool wait_for_reader) +H5F_vfd_swmr_writer_end_of_tick(H5F_t *f, hbool_t wait_for_reader) { H5F_shared_t *shared = f->shared; uint32_t idx_entries_added = 0; @@ -841,7 +798,7 @@ H5F_vfd_swmr_writer_end_of_tick(H5F_t *f, bool wait_for_reader) uint32_t idx_ent_not_in_tl = 0; uint32_t idx_ent_not_in_tl_flushed = 0; herr_t ret_value = SUCCEED; /* Return value */ - bool incr_tick = false; + hbool_t incr_tick = FALSE; FUNC_ENTER_NOAPI(FAIL) @@ -853,7 +810,7 @@ H5F_vfd_swmr_writer_end_of_tick(H5F_t *f, bool wait_for_reader) wait_for_reader)) goto update_eot; - incr_tick = true; + incr_tick = TRUE; /* 1) If requested, flush all raw data to the HDF5 file. * @@ -992,9 +949,6 @@ update_eot: if(H5F_vfd_swmr_insert_entry_eot(f) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to insert entry into the EOT queue") - hlog_fast(eot, "%s leave tick %" PRIu64 " idx len %" PRIu32, - __func__, shared->tick_num, shared->mdf_idx_entries_used); - done: FUNC_LEAVE_NOAPI(ret_value) } @@ -1093,7 +1047,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5F_vfd_swmr_reader_end_of_tick(H5F_t *f, bool entering_api) +H5F_vfd_swmr_reader_end_of_tick(H5F_t *f, hbool_t entering_api) { uint64_t tmp_tick_num = 0; H5FD_vfd_swmr_idx_entry_t * tmp_mdf_idx; @@ -1119,10 +1073,6 @@ H5F_vfd_swmr_reader_end_of_tick(H5F_t *f, bool entering_api) HDassert(!shared->vfd_swmr_writer); HDassert(file); - hlog_fast(eot, "%s enter file %p index len %" PRIu32 " used %" PRIu32, - __func__, (void *)file, - shared->mdf_idx_len, shared->mdf_idx_entries_used); - /* 1) Direct the VFD SWMR reader VFD to load the current header * from the metadata file, and report the current tick. * @@ -1135,14 +1085,10 @@ H5F_vfd_swmr_reader_end_of_tick(H5F_t *f, bool entering_api) HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, \ "error in retrieving tick_num from driver") - hlog_fast(tick, - "%s last tick %" PRIu64 " new tick %" PRIu64, - __func__, shared->tick_num, tmp_tick_num); - /* This is ok if we're entering the API, but it should * not happen if we're exiting the API. */ - assert(entering_api || tmp_tick_num < + HDassert(entering_api || tmp_tick_num < shared->tick_num + shared->vfd_swmr_config.max_lag); if (!entering_api) { @@ -1244,14 +1190,7 @@ H5F_vfd_swmr_reader_end_of_tick(H5F_t *f, bool entering_api) * case where the new entry is *longer*, because the * extension could overlap with a second entry. */ - assert(oent->length == nent->length); - - hlog_fast(shadow_index_update, - "shadow page for slot %" PRIu32 " lower page %" PRIu64 - " moved, %" PRIu64 " -> %" PRIu64, i, - oent->hdf5_page_offset, - oent->md_file_page_offset, - nent->md_file_page_offset); + HDassert(oent->length == nent->length); /* the page has been altered -- evict it and * any contained metadata cache entries. @@ -1274,10 +1213,6 @@ H5F_vfd_swmr_reader_end_of_tick(H5F_t *f, bool entering_api) * for several ticks, we can probably omit this. However, * lets not worry about this for the first cut. */ - hlog_fast(shadow_index_update, - "writer removed shadow index slot %" PRIu32 - " for page %" PRIu64, i, oent->hdf5_page_offset); - change[nchanges].pgno = oent->hdf5_page_offset; change[nchanges].length = oent->length; nchanges++; @@ -1288,10 +1223,6 @@ H5F_vfd_swmr_reader_end_of_tick(H5F_t *f, bool entering_api) * nent->hdf5_page_offset */ - hlog_fast(shadow_index_update, - "writer added shadow index slot %" PRIu32 - " for page %" PRIu64, j, nent->hdf5_page_offset); - /* The page has been added to the index. */ change[nchanges].pgno = nent->hdf5_page_offset; change[nchanges].length = nent->length; @@ -1303,9 +1234,6 @@ H5F_vfd_swmr_reader_end_of_tick(H5F_t *f, bool entering_api) for (; j < new_mdf_idx_entries_used; j++) { const H5FD_vfd_swmr_idx_entry_t *nent = &new_mdf_idx[j]; - hlog_fast(shadow_index_update, - "writer added shadow index slot %" PRIu32 - " for page %" PRIu64, j, nent->hdf5_page_offset); change[nchanges].pgno = nent->hdf5_page_offset; change[nchanges].length = nent->length; nchanges++; @@ -1320,11 +1248,6 @@ H5F_vfd_swmr_reader_end_of_tick(H5F_t *f, bool entering_api) * index. Evict it from the page buffer and also evict any * contained metadata cache entries */ - - hlog_fast(shadow_index_update, - "writer removed shadow index slot %" PRIu32 - " for page %" PRIu64, i, oent->hdf5_page_offset); - change[nchanges].pgno = oent->hdf5_page_offset; change[nchanges].length = oent->length; nchanges++; @@ -1339,10 +1262,6 @@ H5F_vfd_swmr_reader_end_of_tick(H5F_t *f, bool entering_api) } } for (i = 0; i < nchanges; i++) { - hlog_fast(mdc_invalidation, - "invalidating MDC entries at page %" PRIu64 - " length %" PRIu32 " tick %" PRIu64, - change[i].pgno, change[i].length, tmp_tick_num); if (H5C_evict_or_refresh_all_entries_in_page(f, change[i].pgno, change[i].length, tmp_tick_num) < 0) { @@ -1387,16 +1306,6 @@ H5F_vfd_swmr_reader_end_of_tick(H5F_t *f, bool entering_api) done: - hlog_fast(eot, "%s exit tick %" PRIu64 - " len %" PRIu32 " -> %" PRIu32 - " used %" PRIu32 " -> %" PRIu32 - " added %" PRIu32 " removed %" PRIu32 " moved %" PRIu32 " %s", - __func__, shared->tick_num, - shared->old_mdf_idx_len, shared->mdf_idx_len, - shared->old_mdf_idx_entries_used, shared->mdf_idx_entries_used, - entries_added, entries_removed, entries_moved, - (ret_value == SUCCEED) ? "success" : "failure"); - if (change != NULL) free(change); @@ -1415,12 +1324,6 @@ insert_eot_entry(eot_queue_entry_t *entry_ptr) break; } - hlog_fast(eotq, "%s: entry %p after %p file %p " - "tick %" PRIu64 " ending %jd.%09ld", __func__, - (void *)entry_ptr, (void *)prec_ptr, (void *)entry_ptr->vfd_swmr_file, - entry_ptr->tick_num, (intmax_t)entry_ptr->end_of_tick.tv_sec, - entry_ptr->end_of_tick.tv_nsec); - /* Insert the entry onto the EOT queue */ if (prec_ptr != NULL) TAILQ_INSERT_AFTER(&eot_queue_g, prec_ptr, entry_ptr, link); @@ -1441,20 +1344,10 @@ H5F_vfd_swmr_update_entry_eot(eot_queue_entry_t *entry) TAILQ_REMOVE(&eot_queue_g, entry, link); - hlog_fast(eotq, "%s: updating entry %p file %p " - "tick %" PRIu64 " ending %jd.%09ld", __func__, - (void *)entry, (void *)entry->vfd_swmr_file, - entry->tick_num, (intmax_t)entry->end_of_tick.tv_sec, - entry->end_of_tick.tv_nsec); - - assert(entry->vfd_swmr_writer == shared->vfd_swmr_writer); + HDassert(entry->vfd_swmr_writer == shared->vfd_swmr_writer); entry->tick_num = shared->tick_num; entry->end_of_tick = shared->end_of_tick; - hlog_fast(eotq, "%s: ... to tick %" PRIu64 " ending %jd.%09ld", __func__, - entry->tick_num, (intmax_t)entry->end_of_tick.tv_sec, - entry->end_of_tick.tv_nsec); - insert_eot_entry(entry); } @@ -1487,11 +1380,6 @@ H5F_vfd_swmr_remove_entry_eot(H5F_t *f) } if (curr != NULL) { - hlog_fast(eotq, "%s: entry %p file %p " - "tick %" PRIu64 " ending %jd.%09ld", __func__, - (void *)curr, (void *)curr->vfd_swmr_file, curr->tick_num, - (intmax_t)curr->end_of_tick.tv_sec, - curr->end_of_tick.tv_nsec); TAILQ_REMOVE(&eot_queue_g, curr, link); curr = H5FL_FREE(eot_queue_entry_t, curr); } @@ -1632,9 +1520,6 @@ H5F__vfd_swmr_update_end_of_tick_and_tick_num(H5F_shared_t *shared, shared->tick_num++; - hlog_fast(tick, "%s tick %" PRIu64 " -> %" PRIu64, - __func__, shared->tick_num - 1, shared->tick_num); - if ( H5PB_vfd_swmr__set_tick(shared) < 0 ) HGOTO_ERROR(H5E_FILE, H5E_SYSTEM, FAIL, \ @@ -1951,8 +1836,6 @@ vfd_swmr_enlarge_shadow_index(H5F_t *f) FUNC_ENTER_NOAPI(NULL) - hlog_fast(shadow_index_enlarge, "Enlarging shadow index."); - old_mdf_idx = shared->mdf_idx; old_mdf_idx_len = shared->mdf_idx_len; @@ -1984,7 +1867,7 @@ vfd_swmr_enlarge_shadow_index(H5F_t *f) * process of adding entries, and some callers may not update * _entries_used immediately. */ - memcpy(new_mdf_idx, old_mdf_idx, sizeof(new_mdf_idx[0]) * old_mdf_idx_len); + H5MM_memcpy(new_mdf_idx, old_mdf_idx, sizeof(new_mdf_idx[0]) * old_mdf_idx_len); shared->writer_index_offset = idx_addr; ret_value = shared->mdf_idx = new_mdf_idx; @@ -2057,7 +1940,7 @@ H5F__vfd_swmr_writer__wait_a_tick(H5F_t *f) HGOTO_ERROR(H5E_FILE, H5E_SYSTEM, FAIL, "HDnanosleep() failed.") - if ( H5F_vfd_swmr_writer_end_of_tick(f, false) < 0 ) + if ( H5F_vfd_swmr_writer_end_of_tick(f, FALSE) < 0 ) HGOTO_ERROR(H5E_FILE, H5E_SYSTEM, FAIL, \ "H5F_vfd_swmr_writer_end_of_tick() failed.") @@ -2069,7 +1952,7 @@ done: } /* H5F__vfd_swmr_writer__wait_a_tick() */ herr_t -H5F_vfd_swmr_process_eot_queue(bool entering_api) +H5F_vfd_swmr_process_eot_queue(hbool_t entering_api) { struct timespec now; eot_queue_entry_t *first_head, *head; @@ -2098,7 +1981,7 @@ H5F_vfd_swmr_process_eot_queue(bool entering_api) if (timespeccmp(&head->end_of_tick, &shared->end_of_tick, <)) { H5F_vfd_swmr_update_entry_eot(head); } else if (shared->vfd_swmr_writer) { - if (H5F_vfd_swmr_writer_end_of_tick(f, false) < 0) + if (H5F_vfd_swmr_writer_end_of_tick(f, FALSE) < 0) HGOTO_ERROR(H5E_FUNC, H5E_CANTSET, FAIL, "end of tick error for VFD SWMR writer"); } else if (H5F_vfd_swmr_reader_end_of_tick(f, entering_api) < 0) { @@ -22,8 +22,6 @@ *------------------------------------------------------------------------- */ -#include "hlog.h" - /****************/ /* Module Setup */ /****************/ @@ -45,8 +43,6 @@ #include "H5VMprivate.h" /* Vectors and arrays */ -#include "hlog.h" - /****************/ /* Local Macros */ /****************/ @@ -117,6 +113,9 @@ static herr_t H5MF__close_delete_fstype(H5F_t *f, H5F_mem_page_t type); /* Callbacks */ static herr_t H5MF__sects_cb(H5FS_section_info_t *_sect, void *_udata); +/* VFD SWMR */ +static herr_t H5MF__defer_free(H5F_shared_t *shared, H5FD_mem_t alloc_type, + haddr_t addr, hsize_t size); /*********************/ /* Package Variables */ @@ -134,58 +133,38 @@ hbool_t H5_PKG_INIT_VAR = FALSE; /* Local Variables */ /*******************/ -HLOG_OUTLET_DECL(h5mf); -HLOG_OUTLET_SHORT_DEFN(h5mf, all); -HLOG_OUTLET_SHORT_DEFN(h5mf_defer, h5mf); -HLOG_OUTLET_SHORT_DEFN(h5mf_free, h5mf); -HLOG_OUTLET_SHORT_DEFN(h5mf_alloc, h5mf); -HLOG_OUTLET_MEDIUM_DEFN(noisy_h5mf_alloc, h5mf_alloc, HLOG_OUTLET_S_OFF); -HLOG_OUTLET_SHORT_DEFN(h5mf_extend, h5mf); -HLOG_OUTLET_SHORT_DEFN(h5mf_shrink, h5mf); - static herr_t -defer_free(H5F_shared_t *shared, H5FD_mem_t alloc_type, haddr_t addr, +H5MF__defer_free(H5F_shared_t *shared, H5FD_mem_t alloc_type, haddr_t addr, hsize_t size) { - lower_defree_t *df; + lower_defree_t *df = NULL; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC - if ((df = malloc(sizeof(*df))) == NULL) - return FAIL; + if ((df = H5MM_malloc(sizeof(*df))) == NULL) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "unable to allocate buffer") df->alloc_type = alloc_type; df->addr = addr; df->size = size; df->free_after_tick = shared->tick_num + shared->vfd_swmr_config.max_lag; - hlog_fast(h5mf_defer, - "%s.%d: deferred free at %" PRIuHADDR ", %" PRIuHSIZE - " bytes until tick %" PRIu64, __FILE__, __LINE__, addr, size, - df->free_after_tick); - SIMPLEQ_INSERT_TAIL(&shared->lower_defrees, df, link); - return SUCCEED; -} - -static uint64_t -H5MF_total_deferred_frees(H5F_shared_t *shared) -{ - lower_defree_t *df; - uint64_t total = 0; - - SIMPLEQ_FOREACH(df, &shared->lower_defrees, link) - total += df->size; - - return total; -} +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5MF__defer_free() */ herr_t H5MF_process_deferred_frees(H5F_t *f, const uint64_t tick_num) { lower_defree_t *df; - herr_t err = SUCCEED; H5F_shared_t *shared = f->shared; lower_defree_queue_t defrees = SIMPLEQ_HEAD_INITIALIZER(defrees); + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI_NOERR /* Have to empty the queue before processing it because we * could re-enter this routine through H5MF__xfree_impl. If @@ -197,25 +176,19 @@ H5MF_process_deferred_frees(H5F_t *f, const uint64_t tick_num) while ((df = SIMPLEQ_FIRST(&defrees)) != NULL) { if (tick_num <= df->free_after_tick) break; - hlog_fast(h5mf_defer, - "%s.%d: processing free at %" PRIuHADDR ", %" PRIuHSIZE " bytes", - __FILE__, __LINE__, df->addr, df->size); SIMPLEQ_REMOVE_HEAD(&defrees, link); - if (H5MF__xfree_impl(f, df->alloc_type, df->addr, df->size) < 0) - err = FAIL; - free(df); - } - if (err != SUCCEED) { - hlog_fast(h5mf_defer, "%s.%d: error: dropped entries on the floor", - __FILE__, __LINE__); + /* Record errors here, but keep trying to free */ + if (H5MF__xfree_impl(f, df->alloc_type, df->addr, df->size) < 0) + ret_value = FAIL; + H5MM_xfree(df); } - /* Save remaining entries for processing, later. */ + /* Save remaining entries for processing, later */ SIMPLEQ_CONCAT(&shared->lower_defrees, &defrees); - return err; -} + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5MF_process_deferred_frees() */ /*------------------------------------------------------------------------- @@ -882,11 +855,6 @@ H5MF_alloc(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size) FUNC_ENTER_NOAPI_TAG(H5AC__FREESPACE_TAG, HADDR_UNDEF) - hlog_fast(h5mf_alloc, - "%s: enter %p type %u size %" PRIuHSIZE " tick %" PRIu64, - __func__, (void *)f->shared, (unsigned)alloc_type, size, - f->shared->vfd_swmr_writer ? f->shared->tick_num : 0); - /* check arguments */ HDassert(f); HDassert(f->shared); @@ -901,8 +869,6 @@ H5MF_alloc(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size) } H5MF__alloc_to_fs_type(f->shared, alloc_type, size, &fs_type); - hlog_fast(noisy_h5mf_alloc, "%s: Check 1.0", __func__); - /* Set the ring type in the API context */ if(H5MF__fsm_type_is_self_referential(f->shared, fs_type)) fsm_ring = H5AC_RING_MDFSM; @@ -936,8 +902,6 @@ H5MF_alloc(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size) /* If no space is found from the free-space manager, continue further action */ if(!H5F_addr_defined(ret_value)) { - hlog_fast(noisy_h5mf_alloc, "%s: Check 2.0", __func__); - if(f->shared->fs_strategy == H5F_FSPACE_STRATEGY_PAGE) { HDassert(f->shared->fs_page_size >= H5F_FILE_SPACE_PAGE_SIZE_MIN); if(HADDR_UNDEF == (ret_value = H5MF__alloc_pagefs(f, alloc_type, size))) @@ -950,16 +914,11 @@ H5MF_alloc(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size) } /* end if */ HDassert(H5F_addr_defined(ret_value)); - hlog_fast(noisy_h5mf_alloc, "%s: Check 3.0", FUNC); - done: /* Reset the ring in the API context */ if(orig_ring != H5AC_RING_INV) H5AC_set_ring(orig_ring, NULL); - hlog_fast(h5mf_alloc, - "%s: leave %p type %u addr %" PRIuHADDR " size %" PRIuHSIZE, - __func__, (void *)f->shared, (unsigned)alloc_type, ret_value, size); #ifdef H5MF_ALLOC_DEBUG_DUMP H5MF__sects_dump(f, stderr); #endif /* H5MF_ALLOC_DEBUG_DUMP */ @@ -1189,12 +1148,7 @@ H5MF_xfree(H5F_t *f, H5FD_mem_t alloc_type, haddr_t addr, hsize_t size) FUNC_ENTER_NOAPI_TAG(H5AC__FREESPACE_TAG, FAIL) - hlog_fast(h5mf_free, "%s: Entering - alloc_type %u addr %" PRIuHADDR - " size %" PRIuHSIZE " tick %" PRIu64, - __func__, (unsigned)alloc_type, addr, size, - f->shared->vfd_swmr_writer ? f->shared->tick_num : 0); - - /* check arguments */ + /* Check arguments */ HDassert(f); if(!H5F_addr_defined(addr) || 0 == size) HGOTO_DONE(SUCCEED) @@ -1206,7 +1160,7 @@ H5MF_xfree(H5F_t *f, H5FD_mem_t alloc_type, haddr_t addr, hsize_t size) * file starts to close. */ ret_value = H5MF__xfree_impl(f, alloc_type, addr, size); - } else if (defer_free(f->shared, alloc_type, addr, size) < 0) + } else if (H5MF__defer_free(f->shared, alloc_type, addr, size) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "could not defer") else if (H5MF_process_deferred_frees(f, f->shared->tick_num) < 0) { HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGC, FAIL, @@ -1227,10 +1181,6 @@ H5MF__xfree_inner_impl(H5F_t *f, H5FD_mem_t alloc_type, haddr_t addr, hsize_t si H5AC_ring_t fsm_ring; /* Ring of FSM */ herr_t ret_value = SUCCEED; /* Return value */ - hlog_fast(h5mf_free, - "%s: enter %p type %u addr %" PRIuHADDR " size %" PRIuHSIZE, - __func__, (void *)f->shared, (unsigned)alloc_type, addr, size); - FUNC_ENTER_STATIC_TAG(H5AC__FREESPACE_TAG) H5MF__alloc_to_fs_type(f->shared, alloc_type, size, &fs_type); @@ -1271,25 +1221,16 @@ H5MF__xfree_inner_impl(H5F_t *f, H5FD_mem_t alloc_type, haddr_t addr, hsize_t si * space is at the end of the file */ - hlog_fast(h5mf_free, "%s: fs_addr %" PRIuHADDR, __func__, - f->shared->fs_addr[fs_type]); - if(!H5F_addr_defined(f->shared->fs_addr[fs_type])) { htri_t status; /* "can absorb" status for section into */ - hlog_fast(h5mf_free, "%s: Trying to avoid starting up free space manager", __func__); - /* Try to shrink the file or absorb the block into a block aggregator */ if((status = H5MF_try_shrink(f, alloc_type, addr, size)) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTMERGE, FAIL, "can't check for absorbing block") else if(status > 0) HGOTO_DONE(SUCCEED) - else if(size < f->shared->fs_threshold) { - hlog_fast(h5mf_free, "%s: dropping addr %" PRIuHADDR - " size %" PRIuHSIZE " on the floor!", - __func__, addr, size); - HGOTO_DONE(SUCCEED) - } + else if(size < f->shared->fs_threshold) + HGOTO_DONE(SUCCEED) } /* If we are deleting the free space manager, leave now, to avoid @@ -1303,8 +1244,6 @@ H5MF__xfree_inner_impl(H5F_t *f, H5FD_mem_t alloc_type, haddr_t addr, hsize_t si */ if(f->shared->fs_state[fs_type] == H5F_FS_STATE_DELETING || !H5F_HAVE_FREE_SPACE_MANAGER(f)) { - hlog_fast(h5mf_free, "%s: dropping addr %" PRIuHADDR - " size %" PRIuHSIZE " on the floor!", __func__, addr, size); HGOTO_DONE(SUCCEED) } @@ -1325,14 +1264,11 @@ H5MF__xfree_inner_impl(H5F_t *f, H5FD_mem_t alloc_type, haddr_t addr, hsize_t si if(size >= f->shared->fs_threshold) { HDassert(f->shared->fs_man[fs_type]); - hlog_fast(h5mf_free, "%s: Before H5FS_sect_add()", __func__); - /* Add to the free space for the file */ if(H5MF__add_sect(f, alloc_type, f->shared->fs_man[fs_type], node) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINSERT, FAIL, "can't add section to file free space") node = NULL; - hlog_fast(h5mf_free, "%s: After H5FS_sect_add()", __func__); } else { htri_t merged; /* Whether node was merged */ H5MF_sect_ud_t udata; /* User data for callback */ @@ -1361,9 +1297,6 @@ done: if(H5MF__sect_free((H5FS_section_info_t *)node) < 0) HDONE_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't free simple section node") - hlog_fast(h5mf_free, - "%s: %p leave %d", __func__, (void *)f->shared, ret_value); - #ifdef H5MF_ALLOC_DEBUG_DUMP H5MF__sects_dump(f, stderr); #endif /* H5MF_ALLOC_DEBUG_DUMP */ @@ -1459,10 +1392,6 @@ H5MF_try_extend(H5F_t *f, H5FD_mem_t alloc_type, haddr_t addr, hsize_t size, FUNC_ENTER_NOAPI_TAG(H5AC__FREESPACE_TAG, FAIL) - hlog_fast(h5mf_extend, "%s: Entering: alloc_type %u addr %" PRIuHADDR - " size %" PRIuHSIZE " extra_requested %" PRIuHSIZE, __func__, - (unsigned)alloc_type, addr, size, extra_requested); - /* Sanity check */ HDassert(f); HDassert(H5F_INTENT(f) & H5F_ACC_RDWR); @@ -1510,9 +1439,6 @@ H5MF_try_extend(H5F_t *f, H5FD_mem_t alloc_type, haddr_t addr, hsize_t size, if((ret_value = H5F__try_extend(f, map_type, end, extra_requested + frag_size)) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTEXTEND, FAIL, "error extending file") - hlog_fast(h5mf_extend, "%s: extended %s", __func__, - htri_to_string(ret_value)); - /* If extending at EOA succeeds: */ /* for paged aggregation, put the fragment into the large-sized free-space manager */ if(ret_value == TRUE && H5F_PAGED_AGGR(f) && frag_size) { @@ -1546,9 +1472,6 @@ H5MF_try_extend(H5F_t *f, H5FD_mem_t alloc_type, haddr_t addr, hsize_t size, aggr = (map_type == H5FD_MEM_DRAW) ? &(f->shared->sdata_aggr) : &(f->shared->meta_aggr); if((ret_value = H5MF__aggr_try_extend(f, aggr, map_type, end, extra_requested)) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTEXTEND, FAIL, "error extending aggregation block") - - hlog_fast(h5mf_extend, "%s: H5MF__aggr_try_extend %s", __func__, - htri_to_string(ret_value)); } /* If no extension so far, try to extend into a free-space section */ @@ -1571,8 +1494,6 @@ H5MF_try_extend(H5F_t *f, H5FD_mem_t alloc_type, haddr_t addr, hsize_t size, if((ret_value = H5FS_sect_try_extend(f, f->shared->fs_man[fs_type], addr, size, extra_requested, H5FS_ADD_RETURNED_SPACE, &udata)) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTEXTEND, FAIL, "error extending block in free space manager") - hlog_fast(h5mf_extend, "%s: Try to H5FS_sect_try_extend %s", - __func__, htri_to_string(ret_value)); } /* For paged aggregation and a metadata block: try to extend into page end threshold */ @@ -1581,8 +1502,6 @@ H5MF_try_extend(H5F_t *f, H5FD_mem_t alloc_type, haddr_t addr, hsize_t size, if(frag_size <= H5F_PGEND_META_THRES(f) && extra_requested <= frag_size) ret_value = TRUE; - - hlog_fast(h5mf_extend, "%s: Try to extend into the page end threshold %s", __func__, htri_to_string(ret_value)); } } } @@ -1592,9 +1511,6 @@ done: if(orig_ring != H5AC_RING_INV) H5AC_set_ring(orig_ring, NULL); - - hlog_fast(h5mf_extend, "%s: Leaving: ret_value %s", __func__, htri_to_string(ret_value)); - #ifdef H5MF_ALLOC_DEBUG_DUMP H5MF__sects_dump(f, stderr); #endif /* H5MF_ALLOC_DEBUG_DUMP */ @@ -1630,9 +1546,6 @@ H5MF_try_shrink(H5F_t *f, H5FD_mem_t alloc_type, haddr_t addr, hsize_t size) FUNC_ENTER_NOAPI_TAG(H5AC__FREESPACE_TAG, FAIL) - hlog_fast(h5mf_shrink, "%s: Entering - alloc_type %u addr %" PRIuHADDR - " size %" PRIuHSIZE, __func__, (unsigned)alloc_type, addr, size); - /* check arguments */ HDassert(f); HDassert(f->shared); @@ -1685,9 +1598,6 @@ done: if(node && H5MF__sect_free((H5FS_section_info_t *)node) < 0) HDONE_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't free simple section node") - hlog_fast(h5mf_shrink, "%s: Leaving, ret_value %d", __func__, - ret_value); - FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5MF_try_shrink() */ @@ -1711,15 +1621,10 @@ H5MF_close(H5F_t *f) FUNC_ENTER_NOAPI_TAG(H5AC__FREESPACE_TAG, FAIL) - hlog_fast(h5mf, "%s: entering", __func__); - /* check args */ HDassert(f); HDassert(f->shared); - hlog_fast(h5mf, "%s: total deferred frees %" PRIu64, __func__, - H5MF_total_deferred_frees(f->shared)); - if(H5F_PAGED_AGGR(f)) { if((ret_value = H5MF__close_pagefs(f)) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTFREE, FAIL, "can't close free-space managers for 'page' file space") @@ -1729,8 +1634,6 @@ H5MF_close(H5F_t *f) } /* end else */ done: - hlog_fast(h5mf, "%s: leaving", __func__); - FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5MF_close() */ diff --git a/src/H5MFsection.c b/src/H5MFsection.c index 1b9e756..6d23748 100644 --- a/src/H5MFsection.c +++ b/src/H5MFsection.c @@ -829,10 +829,10 @@ H5MF__sect_large_can_merge(const H5FS_section_info_t *_sect1, HDassert(sect2); HDassert(sect1->sect_info.type == sect2->sect_info.type); /* Checks "MERGE_SYM" flag */ if (!H5F_addr_lt(sect1->sect_info.addr, sect2->sect_info.addr)) { - fprintf(stderr, "%s.%d: sect1->sect_info.addr %" PRIuHADDR + HDfprintf(stderr, "%s.%d: sect1->sect_info.addr %" PRIuHADDR ", sect2->sect_info.addr %" PRIuHADDR "\n", __func__, __LINE__, sect1->sect_info.addr, sect2->sect_info.addr); - fprintf(stderr, "%s.%d: sect1->sect_info.size %" PRIuHSIZE + HDfprintf(stderr, "%s.%d: sect1->sect_info.size %" PRIuHSIZE ", sect2->sect_info.size %" PRIuHSIZE "\n", __func__, __LINE__, sect1->sect_info.size, sect2->sect_info.size); HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't merge") @@ -40,7 +40,6 @@ #include "H5MVpkg.h" /* File memory management */ #include "H5VMprivate.h" /* Vectors and arrays */ -#include "hlog.h" /****************/ /* Local Macros */ @@ -96,8 +95,6 @@ hbool_t H5_PKG_INIT_VAR = FALSE; /* Local Variables */ /*******************/ -HLOG_OUTLET_SHORT_DEFN(h5mv, all); - /*------------------------------------------------------------------------- * Function: H5MV__create() @@ -283,7 +280,6 @@ H5MV_alloc(H5F_t *f, hsize_t size) haddr_t ret_value = HADDR_UNDEF; /* Return value */ FUNC_ENTER_NOAPI(HADDR_UNDEF) - hlog_fast(h5mv, "%s: enter size %" PRIuHSIZE, __func__, size); /* check arguments */ HDassert(shared->vfd_swmr_md_fd >= 0); @@ -336,9 +332,6 @@ H5MV_alloc(H5F_t *f, hsize_t size) HDassert(H5F_addr_defined(ret_value)); done: - hlog_fast(h5mv, "%s: leave addr %" PRIuHADDR " size %" PRIuHSIZE, - __func__, ret_value, size); - FUNC_LEAVE_NOAPI(ret_value) } /* end H5MV_alloc() */ @@ -363,9 +356,6 @@ H5MV_free(H5F_t *f, haddr_t addr, hsize_t size) FUNC_ENTER_NOAPI(FAIL) - hlog_fast(h5mv, "%s: enter addr %" PRIuHADDR " size %" PRIuHSIZE, - __func__, addr, size); - /* check arguments */ HDassert(f); if(!H5F_addr_defined(addr) || 0 == size) @@ -381,9 +371,6 @@ H5MV_free(H5F_t *f, haddr_t addr, hsize_t size) */ htri_t status; /* "can absorb" status for section into */ - hlog_fast(h5mv, "%s: trying to avoid starting up free space manager", - __func__); - /* Try to shrink the file */ if((status = H5MV_try_shrink(f, addr, size)) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTMERGE, FAIL, "can't check for absorbing block") @@ -393,11 +380,8 @@ H5MV_free(H5F_t *f, haddr_t addr, hsize_t size) /* If we are deleting the free space manager, leave now, to avoid * [re-]starting it: dropping free space section on the floor. */ - if(shared->fs_state_md == H5F_FS_STATE_DELETING) { - hlog_fast(h5mv, "%s: dropping addr %" PRIuHADDR - " size %" PRIuHSIZE " on the floor!", __func__, addr, size); + if(shared->fs_state_md == H5F_FS_STATE_DELETING) HGOTO_DONE(SUCCEED) - } /* There's either already a free space manager, or the freed * space isn't at the end of the file, so start up (or create) @@ -413,25 +397,18 @@ H5MV_free(H5F_t *f, haddr_t addr, hsize_t size) HDassert(shared->fs_man_md); - hlog_fast(h5mv, "%s: before H5FS_sect_add, addr %" PRIuHADDR - " size %" PRIuHSIZE, __func__, addr, size); - /* Add the section */ if(H5FS_sect_add(f, shared->fs_man_md, &node->sect_info, H5FS_ADD_RETURNED_SPACE, f) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINSERT, FAIL, "can't re-add section to file free space") node = NULL; - hlog_fast(h5mv, "%s: after H5FS_sect_add", __func__); - done: /* Release section node, if allocated and not added to section list or merged */ if(node) if(H5MV__sect_free(&node->sect_info) < 0) HDONE_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't free simple section node") - hlog_fast(h5mv, "%s: leave %d", __func__, ret_value); - FUNC_LEAVE_NOAPI(ret_value) } /* end H5MV_free() */ @@ -45,8 +45,6 @@ #include "H5PBpkg.h" /* File access */ -#include "hlog.h" - /****************/ /* Local Macros */ /****************/ @@ -91,7 +89,7 @@ static herr_t H5PB__create_new_page(H5PB_t *pb_ptr, haddr_t addr, size_t size, static void H5PB__deallocate_page(H5PB_entry_t *entry_ptr); -static herr_t H5PB__evict_entry(H5F_shared_t *, H5PB_entry_t *, bool, bool); +static herr_t H5PB__evict_entry(H5F_shared_t *, H5PB_entry_t *, hbool_t, hbool_t); static herr_t H5PB__flush_entry(H5F_shared_t *, H5PB_t *, H5PB_entry_t *); @@ -143,17 +141,6 @@ H5FL_DEFINE_STATIC(H5PB_t); /* Declare a free list to manage the H5PB_entry_t struct */ H5FL_DEFINE_STATIC(H5PB_entry_t); -HLOG_OUTLET_DECL(pagebuffer); -HLOG_OUTLET_SHORT_DEFN(pagebuffer, all); -HLOG_OUTLET_SHORT_DEFN(pb_access_sizes, pagebuffer); -HLOG_OUTLET_SHORT_DEFN(pbflush, pagebuffer); -HLOG_OUTLET_SHORT_DEFN(pbflush_entry, pbflush); -HLOG_OUTLET_SHORT_DEFN(pbio, pagebuffer); -HLOG_OUTLET_SHORT_DEFN(pbrd, pbio); -HLOG_OUTLET_SHORT_DEFN(pbwr, pbio); -HLOG_OUTLET_SHORT_DEFN(lengthen_pbentry, pagebuffer); -HLOG_OUTLET_SHORT_DEFN(pbrm, pagebuffer); - /*------------------------------------------------------------------------- * @@ -773,7 +760,7 @@ H5PB_dest(H5F_shared_t *shared) "Can't flush entry") } - if ( H5PB__evict_entry(shared, evict_ptr, TRUE, true) < 0 ) + if ( H5PB__evict_entry(shared, evict_ptr, TRUE, TRUE) < 0 ) HGOTO_ERROR(H5E_PAGEBUF, H5E_SYSTEM, FAIL, \ "forced eviction failed") @@ -862,19 +849,11 @@ H5PB_flush(H5F_shared_t *shared) flush_ptr = entry_ptr; entry_ptr = entry_ptr->ht_next; - hlog_fast(pbflush, "%s: visiting %zu-byte page %" PRIu64, - __func__, flush_ptr->size, flush_ptr->page); if ( flush_ptr->is_dirty ) { - if (flush_ptr->delay_write_until != 0) { - hlog_fast(pbflush, "%s: delaying %zu-byte page %" PRIu64 - " until %" PRIu64 " (now %" PRIu64 ")", - __func__, flush_ptr->size, flush_ptr->page, - flush_ptr->delay_write_until, - shared->tick_num); + if (flush_ptr->delay_write_until != 0) continue; - } if ( H5PB__flush_entry(shared, pb_ptr, flush_ptr) < 0 ) @@ -967,20 +946,10 @@ H5PB_log_access_by_size_counts(const H5PB_t *pb) const size_t nslots = NELMTS(pb->access_size_count); size_t i, lo, hi; - hlog_fast(pb_access_sizes, "page buffer %p metadata accesses by size:", - (const void *)pb); - for (lo = 0, hi = pb->page_size, i = 0; i < nslots - 1; i++, lo = hi + 1, hi *= 2) { - hlog_fast(pb_access_sizes, - "%16" PRIu64 " accesses %8zu - %8zu bytes long", - pb->access_size_count[i], lo, hi); } - - hlog_fast(pb_access_sizes, - "%16" PRIu64 " accesses %8zu - greater bytes long", - pb->access_size_count[i], lo); } @@ -1179,10 +1148,6 @@ H5PB_read(H5F_shared_t *shared, H5FD_mem_t type, haddr_t addr, size_t size, /* Sanity checks */ HDassert(shared); - hlog_fast(pbrd, "%s %p type %d %" PRIuHADDR " size %zu", - __func__, (void *)shared, type, addr, size); - - pb_ptr = shared->pb_ptr; if (pb_ptr != NULL && type != H5FD_MEM_DRAW) @@ -1488,13 +1453,13 @@ done: * this routine performs an O(n) copy of index entries. */ static int -shadow_idx_entry_remove(H5F_shared_t *shared, uint64_t page, bool only_mark) +shadow_idx_entry_remove(H5F_shared_t *shared, uint64_t page, hbool_t only_mark) { ptrdiff_t i; H5FD_vfd_swmr_idx_entry_t *entry; entry = vfd_swmr_pageno_to_mdf_idx_entry(shared->mdf_idx, - shared->mdf_idx_entries_used, page, false); + shared->mdf_idx_entries_used, page, FALSE); if (entry == NULL) return 0; @@ -1506,7 +1471,7 @@ shadow_idx_entry_remove(H5F_shared_t *shared, uint64_t page, bool only_mark) } if (only_mark) { - entry->garbage = true; + entry->garbage = TRUE; return 0; } @@ -1515,7 +1480,7 @@ shadow_idx_entry_remove(H5F_shared_t *shared, uint64_t page, bool only_mark) if (shared->mdf_idx_entries_used > i + 1) { const size_t ntocopy = (size_t)(shared->mdf_idx_entries_used - (i + 1)); - memmove(&shared->mdf_idx[i], + HDmemmove(&shared->mdf_idx[i], &shared->mdf_idx[i + 1], ntocopy * sizeof(shared->mdf_idx[i + 1])); } @@ -1625,11 +1590,11 @@ H5PB_remove_entry(H5F_shared_t *shared, haddr_t addr) HGOTO_ERROR(H5E_PAGEBUF, H5E_SYSTEM, FAIL, \ "mark entry clean failed") - if ( H5PB__evict_entry(shared, entry_ptr, TRUE, false) < 0 ) + if ( H5PB__evict_entry(shared, entry_ptr, TRUE, FALSE) < 0 ) HGOTO_ERROR(H5E_PAGEBUF, H5E_SYSTEM, FAIL, "forced eviction failed") - assert(!shared->vfd_swmr_writer || vfd_swmr_pageno_to_mdf_idx_entry(shared->mdf_idx, shared->mdf_idx_entries_used, page, false) == NULL); + HDassert(!shared->vfd_swmr_writer || vfd_swmr_pageno_to_mdf_idx_entry(shared->mdf_idx, shared->mdf_idx_entries_used, page, FALSE) == NULL); } done: @@ -1959,7 +1924,7 @@ H5PB_vfd_swmr__release_delayed_writes(H5F_shared_t *shared) HGOTO_ERROR(H5E_PAGEBUF, H5E_WRITEERROR, FAIL, \ "flush of mpmde failed") - if ( H5PB__evict_entry(shared, entry_ptr, TRUE, false) < 0 ) + if ( H5PB__evict_entry(shared, entry_ptr, TRUE, FALSE) < 0 ) HGOTO_ERROR(H5E_PAGEBUF, H5E_SYSTEM, FAIL, \ "eviction of mpmde failed") @@ -2038,7 +2003,7 @@ H5PB_vfd_swmr__release_tick_list(H5F_shared_t *shared) HGOTO_ERROR(H5E_PAGEBUF, H5E_WRITEERROR, FAIL, \ "flush of mpmde failed") - if ( H5PB__evict_entry(shared, entry_ptr, TRUE, false) < 0 ) + if ( H5PB__evict_entry(shared, entry_ptr, TRUE, FALSE) < 0 ) HGOTO_ERROR(H5E_PAGEBUF, H5E_SYSTEM, FAIL, \ "eviction of mpmde failed") @@ -2252,7 +2217,7 @@ H5PB_vfd_swmr__update_index(H5F_t *f, /* see if the shadow index already contains an entry for *entry. */ ie_ptr = vfd_swmr_pageno_to_mdf_idx_entry(idx, - shared->mdf_idx_entries_used, target_page, false); + shared->mdf_idx_entries_used, target_page, FALSE); if ( ie_ptr == NULL ) { /* alloc new entry in the metadata file index*/ uint32_t new_index_entry_index; @@ -2266,7 +2231,7 @@ H5PB_vfd_swmr__update_index(H5F_t *f, "\n\nmax mdf index len (%" PRIu32 ") exceeded.\n\n", shared->mdf_idx_len); HDfprintf(stderr, "tick = %" PRIu64 ".\n", tick_num); - exit(EXIT_FAILURE); + HDexit(EXIT_FAILURE); } ie_ptr = idx + new_index_entry_index; @@ -2280,8 +2245,8 @@ H5PB_vfd_swmr__update_index(H5F_t *f, /* ie_ptr->clean initialized below */ /* ie_ptr->tick_of_last_flush initialized below */ ie_ptr->delayed_flush = entry->delay_write_until; - ie_ptr->moved_to_lower_file = false; - ie_ptr->garbage = false; + ie_ptr->moved_to_lower_file = FALSE; + ie_ptr->garbage = FALSE; ie_ptr->length = (uint32_t)entry->size; } else { @@ -2305,8 +2270,8 @@ H5PB_vfd_swmr__update_index(H5F_t *f, ie_ptr->entry_ptr = entry->image_ptr; ie_ptr->tick_of_last_change = tick_num; - assert(entry->is_dirty); - ie_ptr->clean = false; + HDassert(entry->is_dirty); + ie_ptr->clean = FALSE; ie_ptr->tick_of_last_flush = 0; } @@ -2333,9 +2298,6 @@ H5PB_vfd_swmr__update_index(H5F_t *f, H5PB__SEARCH_INDEX(pb_ptr, ie_ptr->hdf5_page_offset, entry, FAIL); 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; @@ -2522,9 +2484,6 @@ H5PB_write(H5F_shared_t *shared, H5FD_mem_t type, haddr_t addr, size_t size, FUNC_ENTER_NOAPI(FAIL) - hlog_fast(pbwr, "%s %p type %d addr %" PRIuHADDR " size %zu", - __func__, (void *)shared, type, addr, size); - pb_ptr = shared->pb_ptr; if (pb_ptr != NULL && type != H5FD_MEM_DRAW) @@ -3188,8 +3147,8 @@ H5PB__deallocate_page(H5PB_entry_t *entry_ptr) *------------------------------------------------------------------------- */ static herr_t -H5PB__evict_entry(H5F_shared_t *shared, H5PB_entry_t *entry_ptr, bool force, - bool only_mark) +H5PB__evict_entry(H5F_shared_t *shared, H5PB_entry_t *entry_ptr, hbool_t force, + hbool_t only_mark) { H5PB_t *pb_ptr = shared->pb_ptr; herr_t ret_value = SUCCEED; /* Return value */ @@ -3338,10 +3297,6 @@ H5PB__flush_entry(H5F_shared_t *shared, H5PB_t *pb_ptr, H5PB_entry_t *const entr HDassert((pb_ptr->vfd_swmr_writer) || (!(entry_ptr->is_mpmde))); HDassert(0 == entry_ptr->delay_write_until); - hlog_fast(pbflush_entry, - "%s: flushing %zu-byte page %" PRIu64 " @ %" PRIuHADDR, - __func__, entry_ptr->size, entry_ptr->page, entry_ptr->addr); - /* Retrieve the 'eoa' for the file */ if ( HADDR_UNDEF == (eoa = H5FD_get_eoa(shared->lf, entry_ptr->mem_type)) ) @@ -3688,7 +3643,7 @@ H5PB__make_space(H5F_shared_t *shared, H5PB_t *pb_ptr, H5FD_mem_t inserted_type) evict_ptr = search_ptr; search_ptr = search_ptr->prev; - if ( H5PB__evict_entry(shared, evict_ptr, FALSE, false) < 0 ) + if ( H5PB__evict_entry(shared, evict_ptr, FALSE, FALSE) < 0 ) HGOTO_ERROR(H5E_PAGEBUF, H5E_WRITEERROR, FAIL, \ "Can't evict entry") @@ -4153,7 +4108,7 @@ H5PB__read_meta(H5F_shared_t *shared, H5FD_mem_t type, haddr_t addr, HDassert( ! ( entry_ptr->is_dirty ) ); if ( H5PB__evict_entry(shared, entry_ptr, - TRUE, false) < 0 ) + TRUE, FALSE) < 0 ) HGOTO_ERROR(H5E_PAGEBUF, H5E_SYSTEM, FAIL, \ "forced eviction failed (1)") @@ -4718,14 +4673,9 @@ H5PB__write_meta(H5F_shared_t *shared, H5FD_mem_t type, haddr_t addr, uint64_t last_page = page + roundup(size, pb_ptr->page_size) / pb_ptr->page_size; - hlog_fast(lengthen_pbentry, - "lengthening page %" PRIu64 " from %zu bytes to %zu, " - "last page %" PRIu64 "\n", page, entry_ptr->size, size, - last_page); - for (iter_page = page + 1; iter_page < last_page; iter_page++) { H5PB__SEARCH_INDEX(pb_ptr, iter_page, overlap, FAIL) - assert(overlap == NULL); + HDassert(overlap == NULL); } if (new_image == NULL) { HGOTO_ERROR(H5E_PAGEBUF, H5E_SYSTEM, FAIL, @@ -4742,7 +4692,7 @@ H5PB__write_meta(H5F_shared_t *shared, H5FD_mem_t type, haddr_t addr, entry_ptr->image_ptr = H5MM_xfree(entry_ptr->image_ptr); entry_ptr->image_ptr = new_image; - entry_ptr->is_mpmde = true; + entry_ptr->is_mpmde = TRUE; entry_ptr->size = size; if (entry_ptr->modified_this_tick) @@ -4819,7 +4769,7 @@ H5PB__write_meta(H5F_shared_t *shared, H5FD_mem_t type, haddr_t addr, * already present. */ if (pb_ptr->vfd_swmr_writer && !entry_ptr->modified_this_tick) { - entry_ptr->modified_this_tick = true; + entry_ptr->modified_this_tick = TRUE; H5PB__INSERT_IN_TL(pb_ptr, entry_ptr, FAIL) } @@ -4974,7 +4924,7 @@ H5PB__write_raw(H5F_shared_t *shared, H5FD_mem_t type, haddr_t addr, HGOTO_ERROR(H5E_PAGEBUF, H5E_SYSTEM, FAIL, \ "mark entry clean failed") - if (H5PB__evict_entry(shared, entry_ptr, TRUE, false) < 0) + if (H5PB__evict_entry(shared, entry_ptr, TRUE, FALSE) < 0) HGOTO_ERROR(H5E_PAGEBUF, H5E_SYSTEM, FAIL, \ "forced eviction failed (1)") diff --git a/src/H5VLnative_object.c b/src/H5VLnative_object.c index 8f60ac4..4fdc0b0 100644 --- a/src/H5VLnative_object.c +++ b/src/H5VLnative_object.c @@ -342,7 +342,7 @@ H5VL__native_object_specific(void *obj, const H5VL_loc_params_t *loc_params, H5V /* Lookup object */ case H5VL_OBJECT_LOOKUP: { - H5O_token_t *token = va_arg(arguments, H5O_token_t *); + H5O_token_t *token = HDva_arg(arguments, H5O_token_t *); HDassert(token); diff --git a/src/H5private.h b/src/H5private.h index 702b0dc..66763b2 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -154,6 +154,13 @@ #endif /* + * Needed for dirname and basename on POSIX systems + */ +#ifdef H5_HAVE_LIBGEN_H +#include <libgen.h> +#endif + +/* * Dynamic library handling. These are needed for dynamically loading I/O * filters and VFDs. */ @@ -734,6 +741,9 @@ typedef struct { #ifndef HDatoll #define HDatoll(S) atoll(S) #endif /* HDatol */ +#ifndef HDbasename + #define HDbasename(P) basename(P) +#endif /* HDbasename */ #ifndef HDbind #define HDbind(A,B,C) bind((A),(B),(C)) /* mirror VFD */ #endif /* HDbind */ @@ -810,6 +820,9 @@ typedef struct { #define HDdifftime(X,Y) ((double)(X)-(double)(Y)) #endif /* H5_HAVE_DIFFTIME */ #endif /* HDdifftime */ +#ifndef HDdirname + #define HDdirname(P) dirname(P) +#endif /* HDdirname */ #ifndef HDdiv #define HDdiv(X,Y) div(X,Y) #endif /* HDdiv */ diff --git a/src/H5retry_private.h b/src/H5retry_private.h index 6621957..45ba8d2 100644 --- a/src/H5retry_private.h +++ b/src/H5retry_private.h @@ -9,8 +9,8 @@ * help@hdfgroup.org. */ -#ifndef _H5retry_private_H -#define _H5retry_private_H +#ifndef H5retry_private_H +#define H5retry_private_H /* * Data types and functions for retry loops. @@ -111,4 +111,4 @@ h5_retry_tries(struct h5_retry_t *r) return r->maxtries - r->tries; } -#endif /* _H5retry_private_H */ +#endif /* H5retry_private_H */ diff --git a/src/H5time_private.h b/src/H5time_private.h index 30cbaf1..603c273 100644 --- a/src/H5time_private.h +++ b/src/H5time_private.h @@ -73,8 +73,8 @@ * @(#)time.h 8.5 (Berkeley) 5/4/95 */ -#ifndef _H5time_private_H -#define _H5time_private_H +#ifndef H5time_private_H +#define H5time_private_H #ifdef __NetBSD__ #include <sys/time.h> @@ -106,4 +106,4 @@ #define timespec2ns(x) (((uint64_t)(x)->tv_sec) * 1000000000UL + (uint64_t)(x)->tv_nsec) #endif -#endif /* _H5time_private_H */ +#endif /* H5time_private_H */ diff --git a/src/Makefile.am b/src/Makefile.am index cb3fa3c..bf565d8 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -115,8 +115,7 @@ libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5lib_settings.c H5system.c \ H5VLpassthru.c \ H5VM.c H5WB.c H5Z.c \ H5Zdeflate.c H5Zfletcher32.c H5Znbit.c H5Zshuffle.c \ - H5Zscaleoffset.c H5Zszip.c H5Ztrans.c \ - hlog.c + H5Zscaleoffset.c H5Zszip.c H5Ztrans.c # Only compile parallel sources if necessary if BUILD_PARALLEL_CONDITIONAL diff --git a/src/hlog.c b/src/hlog.c deleted file mode 100644 index d2d0e51..0000000 --- a/src/hlog.c +++ /dev/null @@ -1,366 +0,0 @@ -/* - * Copyright (c) 2004, 2005, 2006, 2007 David Young. All rights reserved. - * - * See COPYING at the top of the HDF5 distribution for license terms. - */ -/* - * Copyright (c) 2004 Urbana-Champaign Independent Media Center. - * All rights reserved. - * - * See COPYING at the top of the HDF5 distribution for license terms. - */ -#include <err.h> -#include <errno.h> -#include <stdarg.h> -#include <stdbool.h> -#include <stdint.h> /* for uintmax_t */ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <time.h> - -#include <sys/param.h> -#include <sys/cdefs.h> - -#include "hlog.h" -#include "H5time_private.h" - -TAILQ_HEAD(, hlog_outlet) hlog_outlets = TAILQ_HEAD_INITIALIZER(hlog_outlets); - -HLOG_OUTLET_TOP_DEFN(all); - -static struct timespec timestamp_zero; - -void hlog_init(void) _constructor; -static void hlog_init_timestamps(void); - -void -hlog_init(void) -{ - const char *settings0; - char *item, *settings; - - if ((settings0 = getenv("HLOG")) == NULL) - return; - - if ((settings = strdup(settings0)) == NULL) { - warn("%s: cannot duplicate settings string", __func__); - return; - } - - while ((item = strsep(&settings, " ,")) != NULL) { - hlog_outlet_state_t state; - char key[64 + 1], val[4 + 1]; // + 1 for the terminating NUL - int nconverted; - - nconverted = sscanf(item, " %64[0-9a-z_] = %4s ", key, val); - if (nconverted != 2) { - warnx("%s: malformed HLOG item \"%s\"", __func__, item); - continue; - } - - if (strcmp(val, "on") == 0 || strcmp(val, "yes") == 0) - state = HLOG_OUTLET_S_ON; - else if (strcmp(val, "off") == 0 || strcmp(val, "no") == 0) - state = HLOG_OUTLET_S_OFF; - else if (strcmp(val, "pass") == 0) - state = HLOG_OUTLET_S_PASS; - else { - warnx("%s: bad HLOG value \"%s\" in item \"%s\"", __func__, - val, item); - continue; - } - - if (hlog_set_state(key, state, true) == -1) { - warn("%s: could not set state for HLOG item \"%s\"", __func__, - item); - } - } - - free(settings); -} - - -static void -hlog_init_timestamps(void) -{ - static bool initialized = false; - - if (initialized) - return; - - if (clock_gettime(CLOCK_MONOTONIC, ×tamp_zero) == -1) - err(EXIT_FAILURE, "%s: clock_gettime", __func__); - - initialized = true; -} - -static void -hlog_print_time(void) -{ - struct timespec elapsed, now; - - hlog_init_timestamps(); - - if (clock_gettime(CLOCK_MONOTONIC, &now) == -1) - err(EXIT_FAILURE, "%s: clock_gettime", __func__); - - timespecsub(&now, ×tamp_zero, &elapsed); - - fprintf(stderr, "%ju.%.9ld ", (uintmax_t)elapsed.tv_sec, elapsed.tv_nsec); -} - -void -vhlog(const char *fmt, va_list ap) -{ - hlog_print_time(); - (void)vfprintf(stderr, fmt, ap); - (void)fputc('\n', stderr); -} - -static char * -message_extend_stderr(const char *fmt0) -{ - static const char sep[] = ": "; - const char *m; - char *fmt; - size_t fmtlen; - - m = strerror(errno); - - fmtlen = strlen(fmt0) + strlen(m) + sizeof(sep); - - if ((fmt = malloc(fmtlen)) == NULL) { - err(EXIT_FAILURE, "%s: malloc failed", __func__); - return NULL; - } - - /* Note well the safe strcpy, strcat usage. Thank you. */ - strcpy(fmt, fmt0); - strcat(fmt, sep); - strcat(fmt, m); - - return fmt; -} - -static char * -message_extend(const char *fmt0) -{ - return message_extend_stderr(fmt0); -} - -void -vhlog_err(int status, const char *fmt0, va_list ap) -{ - char *fmt; - - if ((fmt = message_extend(fmt0)) == NULL) - exit(status); - vhlog(fmt, ap); - free(fmt); - - exit(status); -} - -void -vhlog_errx(int status, const char *fmt, va_list ap) -{ - vhlog(fmt, ap); - exit(status); -} - -void -vhlog_warn(const char *fmt0, va_list ap) -{ - char *fmt; - - if ((fmt = message_extend(fmt0)) == NULL) - return; - vhlog(fmt, ap); - free(fmt); -} - -void -vhlog_warnx(const char *fmt, va_list ap) -{ - vhlog(fmt, ap); -} - -void -hlog_err(int status, const char *fmt, ...) -{ - va_list ap; - - va_start(ap, fmt); - vhlog_err(status, fmt, ap); - va_end(ap); -} - -void -hlog_errx(int status, const char *fmt, ...) -{ - va_list ap; - - va_start(ap, fmt); - vhlog_errx(status, fmt, ap); - va_end(ap); -} - -void -hlog_warn(const char *fmt, ...) -{ - va_list ap; - - va_start(ap, fmt); - vhlog_warn(fmt, ap); - va_end(ap); -} - -void -hlog_warnx(const char *fmt, ...) -{ - va_list ap; - - va_start(ap, fmt); - vhlog_warnx(fmt, ap); - va_end(ap); -} - -struct hlog_outlet * -hlog_outlet_find_active(struct hlog_outlet *ls0) -{ - struct hlog_outlet *ls; - - HLOG_OUTLET_FOREACH(ls, ls0) { - switch (ls->ls_state) { - case HLOG_OUTLET_S_PASS: - continue; - case HLOG_OUTLET_S_OFF: - return NULL; - case HLOG_OUTLET_S_ON: - default: - return ls; - } - } - return NULL; -} - -void -hlog_always(struct hlog_outlet *ls _unused, const char *fmt, ...) -{ - va_list ap; - - va_start(ap, fmt); - vhlog(fmt, ap); - va_end(ap); -} - -void -hlog_impl(struct hlog_outlet *ls0, const char *fmt, ...) -{ - struct hlog_outlet *ls; - va_list ap; - - if ((ls = hlog_outlet_find_active(ls0)) == NULL) { - ls0->ls_resolved = HLOG_OUTLET_S_OFF; - return; - } - - ls0->ls_resolved = HLOG_OUTLET_S_ON; - - va_start(ap, fmt); - vhlog(fmt, ap); - va_end(ap); -} - -static void -hlog_outlet_reset_all(void) -{ - struct hlog_outlet *ls; - - TAILQ_FOREACH(ls, &hlog_outlets, ls_next) - ls->ls_resolved = HLOG_OUTLET_S_PASS; -} - -struct hlog_outlet * -hlog_outlet_lookup(const char *name) -{ - struct hlog_outlet *ls; - - TAILQ_FOREACH(ls, &hlog_outlets, ls_next) { - if (strcmp(ls->ls_name, name) == 0) - return ls; - } - return NULL; -} - -static struct hlog_outlet * -hlog_outlet_create(const char *name) -{ - struct hlog_outlet *ls; - - if ((ls = calloc(1, sizeof(*ls))) == NULL) - return NULL; - else if ((ls->ls_name0 = strdup(name)) == NULL) { - free(ls); - return NULL; - } - ls->ls_name = ls->ls_name0; - ls->ls_rendezvous = true; - return ls; -} - -static void -hlog_outlet_destroy(struct hlog_outlet *ls) -{ - /*LINTED*/ - if (ls->ls_name0 != NULL) - free(ls->ls_name0); - free(ls); -} - -int -hlog_set_state(const char *name, hlog_outlet_state_t state, bool rendezvous) -{ - struct hlog_outlet *ls; - errno = 0; - - switch (state) { - case HLOG_OUTLET_S_PASS: - case HLOG_OUTLET_S_OFF: - case HLOG_OUTLET_S_ON: - break; - default: - errno = EINVAL; - return -1; - } - if ((ls = hlog_outlet_lookup(name)) == NULL && !rendezvous) { - errno = ESRCH; - return -1; - } else if (ls == NULL) { - if ((ls = hlog_outlet_create(name)) == NULL) - return -1; - TAILQ_INSERT_TAIL(&hlog_outlets, ls, ls_next); - } - ls->ls_state = state; - hlog_outlet_reset_all(); - return 0; -} - -void -hlog_outlet_register(struct hlog_outlet *ls_arg) -{ - struct hlog_outlet *ls; - if ((ls = hlog_outlet_lookup(ls_arg->ls_name)) == NULL || - ls->ls_rendezvous) { - TAILQ_INSERT_TAIL(&hlog_outlets, ls_arg, ls_next); - if (ls == NULL) - return; - warnx("%s: rendezvous with log-outlet '%s'", __func__, - ls->ls_name); - ls_arg->ls_state = ls->ls_state; - TAILQ_REMOVE(&hlog_outlets, ls, ls_next); - hlog_outlet_destroy(ls); - } else - warnx("%s: duplicate log-outlet, '%s'", __func__, ls->ls_name); -} diff --git a/src/hlog.h b/src/hlog.h deleted file mode 100644 index 6a91674..0000000 --- a/src/hlog.h +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Copyright (c) 2004, 2005, 2006, 2007 David Young. All rights reserved. - * - * See COPYING at the top of the HDF5 distribution for license terms. - */ -/* - * Copyright (c) 2004 Urbana-Champaign Independent Media Center. - * All rights reserved. - * - * See COPYING at the top of the HDF5 distribution for license terms. - */ -#ifndef HLOG_H -#define HLOG_H - -#include <stdarg.h> -#include <stdbool.h> -#include <syslog.h> -#include <sys/cdefs.h> - -#include "H5queue.h" - -#ifndef _unused -#define _unused __attribute__((unused)) -#endif - -#ifndef _constructor -#define _constructor __attribute__((constructor)) -#endif - -#ifndef _noreturn -#define _noreturn __attribute__((__noreturn__)) -#endif - -#ifndef _printflike -#define _printflike(_fmt, _args) \ - __attribute__((__format__(__printf__,_fmt,_args))) -#endif - -enum hlog_outlet_state { - HLOG_OUTLET_S_PASS = 0 - , HLOG_OUTLET_S_OFF = 1 - , HLOG_OUTLET_S_ON = 2 -}; - -typedef enum hlog_outlet_state hlog_outlet_state_t; - -struct hlog_outlet { - hlog_outlet_state_t ls_resolved; - struct hlog_outlet *ls_parent; - hlog_outlet_state_t ls_state; - const char *ls_name; - char *ls_name0; - bool ls_rendezvous; - TAILQ_ENTRY(hlog_outlet) ls_next; -}; - -typedef struct hlog_outlet hlog_outlet_t; - -#define HLOG_CONSTRUCTOR(__sym) \ -void hlog_constructor_##__sym(void) _constructor; \ -void \ -hlog_constructor_##__sym(void) \ -{ \ - hlog_outlet_register(&__sym); \ -} \ -void hlog_undefined_##__sym(void) _constructor - -#define HLOG_OUTLET_FOREACH(__le, __le0) \ - for ((__le) = (__le0); (__le) != NULL; (__le) = (__le)->ls_parent) - -#define HLOG_OUTLET_DECL1(__sym) extern struct hlog_outlet __sym - -#define HLOG_JOIN_SYMS(x, y) x ## y - -#define HLOG_PREFIX(_sfx) HLOG_JOIN_SYMS(hlog_gbl_, _sfx) - -#define HLOG_OUTLET_DECL(__name) HLOG_OUTLET_DECL1(HLOG_PREFIX(__name)) - -#define HLOG_OUTLET_DEFN(__sym, __name, __parent, __state) \ - struct hlog_outlet __sym = { \ - .ls_name = __name \ - , .ls_parent = (__parent) \ - , .ls_state = (__state) \ - }; \ - HLOG_CONSTRUCTOR(__sym) - -#define HLOG_OUTLET_MEDIUM_DEFN(__name, __parent, __state) \ - HLOG_OUTLET_DEFN(HLOG_PREFIX(__name), #__name, &HLOG_PREFIX(__parent), \ - __state) - -#define HLOG_OUTLET_SHORT_DEFN(__name, __parent) \ - HLOG_OUTLET_MEDIUM_DEFN(__name, __parent, HLOG_OUTLET_S_PASS) - -#define HLOG_OUTLET_TOP_DEFN(__name) \ - HLOG_OUTLET_DEFN(HLOG_PREFIX(__name), #__name, NULL, HLOG_OUTLET_S_PASS) - -HLOG_OUTLET_DECL(all); - -#define hlog(_name, _fmt, ...) \ - hlog_impl(&HLOG_PREFIX(_name), _fmt, __VA_ARGS__) - -#define hlog_fast(_name, ...) \ - do { \ - hlog_outlet_t *_ls0 = &HLOG_PREFIX(_name); \ - \ - if (_ls0->ls_resolved == HLOG_OUTLET_S_OFF) \ - break; \ - else if (_ls0->ls_resolved == HLOG_OUTLET_S_ON) \ - hlog_always(_ls0, __VA_ARGS__); \ - else \ - hlog_impl(_ls0, __VA_ARGS__); \ - } while (/*CONSTCOND*/0) - -struct hlog_outlet *hlog_outlet_find_active(struct hlog_outlet *); -void hlog_outlet_register(struct hlog_outlet *); -struct hlog_outlet *hlog_outlet_lookup(const char *); -int hlog_set_state(const char *, hlog_outlet_state_t, bool); - -void vhlog(const char *, va_list) _printflike(1,0); - -void vhlog_warn(const char *, va_list) _printflike(1,0); -void vhlog_warnx(const char *, va_list) _printflike(1,0); -void vhlog_err(int, const char *, va_list) _printflike(2,0) _noreturn; -void vhlog_errx(int, const char *, va_list) _printflike(2,0) _noreturn; - -void hlog_warnx(const char *, ...) _printflike(1,2); -void hlog_warn(const char *, ...) _printflike(1,2); - -void hlog_err(int, const char *, ...) _printflike(2,3) _noreturn; -void hlog_errx(int, const char *, ...) _printflike(2,3) _noreturn; - -void hlog_always(struct hlog_outlet *, const char *, ...) - _printflike(2,3); - -void hlog_impl(struct hlog_outlet *, const char *, ...) - _printflike(2,3); - -#endif /* HLOG_H */ |