From 3e990fed8edb25df58d79097f7cef9b908ef5a0d Mon Sep 17 00:00:00 2001 From: vchoi Date: Thu, 21 Apr 2022 13:56:59 -0500 Subject: Modifications to: A) Allow automatic generation of metadata file names for VDS support B) Allow VFD SWMR reader to open an existing HDF5 file either before the VFD SWMR writer has opened it or after it has closed. C) Remove the usage of H5P_FILE_ACCESS_ANY_VFD. D) Add H5FD_FEAT_SUPPORTS_VFD_SWMR feature flag. E) Do not map H5FD_MEM_GHEAP to H5FD_MEM_DRAW when vfd swmr IS enabled; map H5FD_MEM_GHEAP to H5FD_MEM_DRAW when vfd swmr is NOT enabled. For details regarding #A and #B above, see version 9 of the RFC. --- src/H5Dvirtual.c | 11 +- src/H5FDprivate.h | 4 + src/H5FDpublic.h | 6 + src/H5FDvfd_swmr.c | 378 ++++++++++++++++++++++++++++++++++++---- src/H5Fint.c | 34 ++-- src/H5Fio.c | 14 +- src/H5Fpkg.h | 2 + src/H5Fprivate.h | 4 + src/H5Fpublic.h | 32 +++- src/H5Fquery.c | 19 ++ src/H5Ftest.c | 6 +- src/H5Fvfd_swmr.c | 59 ++++++- src/H5Pfapl.c | 30 ++-- src/H5Pint.c | 3 - src/H5Ppublic.h | 2 - test/page_buffer.c | 4 +- test/test_vfd_swmr.sh.in | 6 + test/vfd_swmr.c | 293 +++++++++++++++++-------------- test/vfd_swmr_addrem_writer.c | 7 +- test/vfd_swmr_attrdset_writer.c | 182 +++++++++---------- test/vfd_swmr_bigset_writer.c | 26 ++- test/vfd_swmr_common.c | 30 ++-- test/vfd_swmr_common.h | 9 +- test/vfd_swmr_dsetchks_writer.c | 9 +- test/vfd_swmr_dsetops_writer.c | 7 +- test/vfd_swmr_generator.c | 7 +- test/vfd_swmr_gfail_writer.c | 9 +- test/vfd_swmr_gperf_writer.c | 9 +- test/vfd_swmr_group_writer.c | 9 +- test/vfd_swmr_indep_rw_writer.c | 18 +- test/vfd_swmr_reader.c | 7 +- test/vfd_swmr_remove_reader.c | 7 +- test/vfd_swmr_remove_writer.c | 7 +- test/vfd_swmr_sparse_reader.c | 7 +- test/vfd_swmr_sparse_writer.c | 7 +- test/vfd_swmr_vlstr_reader.c | 7 +- test/vfd_swmr_vlstr_writer.c | 8 +- test/vfd_swmr_writer.c | 7 +- test/vfd_swmr_zoo_writer.c | 7 +- 39 files changed, 892 insertions(+), 401 deletions(-) diff --git a/src/H5Dvirtual.c b/src/H5Dvirtual.c index c26697c..d549bad 100644 --- a/src/H5Dvirtual.c +++ b/src/H5Dvirtual.c @@ -912,16 +912,9 @@ H5D__virtual_open_source_dset(const H5D_t *vdset, H5O_storage_virtual_ent_t *vir /* Get the virtual dataset's file open flags ("intent") */ intent = H5F_INTENT(vdset->oloc.file); - /* Try opening the file */ - /* XXX Pass the special file-access property list ID, - * H5P_FILE_ACCESS_ANY_VFD, so that if the file is already open in - * VFD SWMR mode, the library just creates a new H5F_t for the file - * instead of returning an error because of the discrepancy between - * the default file-access properties and the already-open file's - * VFD SWMR properties. - */ + /* Remove H5P_FILE_ACCESS_ANY_VFD and restore the original code */ src_file = H5F_prefix_open_file(vdset->oloc.file, H5F_PREFIX_VDS, vdset->shared->vds_prefix, - source_dset->file_name, intent, H5P_FILE_ACCESS_ANY_VFD); + source_dset->file_name, intent, vdset->shared->layout.storage.u.virt.source_fapl); /* If we opened the source file here, we should close it when leaving */ if (src_file) diff --git a/src/H5FDprivate.h b/src/H5FDprivate.h index fa51574..bdd1a68 100644 --- a/src/H5FDprivate.h +++ b/src/H5FDprivate.h @@ -375,6 +375,10 @@ H5_DLL herr_t H5FD_vfd_swmr_get_tick_and_idx(H5FD_t *_file, hbool_t read_index, H5_DLL void H5FD_vfd_swmr_dump_status(H5FD_t *file, uint64_t page); H5_DLL void H5FD_vfd_swmr_set_pb_configured(H5FD_t *_file); H5_DLL void H5FD_vfd_swmr_record_elapsed_ticks(H5FD_t *_file, uint64_t elapsed); +H5_DLL void H5FD_vfd_swmr_get_md_path_name(H5FD_t *_file, char **name); +H5_DLL hbool_t H5FD_vfd_swmr_get_make_believe(H5FD_t *_file); +H5_DLL void H5FD_vfd_swmr_set_make_believe(H5FD_t *_file, hbool_t make_believe); +H5_DLL htri_t H5FD_vfd_swmr_assess_make_believe(H5FD_t *_file); H5_DLL H5FD_t *H5FD_vfd_swmr_dedup(H5FD_t *_self, H5FD_t *_other, hid_t fapl_id); /* Function prototypes for MPI based VFDs*/ diff --git a/src/H5FDpublic.h b/src/H5FDpublic.h index a8d85c6..d232200 100644 --- a/src/H5FDpublic.h +++ b/src/H5FDpublic.h @@ -179,6 +179,12 @@ * operations when appropriate. */ #define H5FD_FEAT_MEMMANAGE 0x00010000 +/* + * Defining H5FD_FEAT_SUPPORTS_VFD_SWMR for a VFL driver means that the + * driver supports the SWMR feature that is implemented in a more modular + * fashion and simplies maintenance. + */ +#define H5FD_FEAT_SUPPORTS_VFD_SWMR 0x00020000 /* ctl function definitions: */ #define H5FD_CTL_OPC_RESERVED 512 /* Opcodes below this value are reserved for library use */ diff --git a/src/H5FDvfd_swmr.c b/src/H5FDvfd_swmr.c index fb88de3..ab74613 100644 --- a/src/H5FDvfd_swmr.c +++ b/src/H5FDvfd_swmr.c @@ -15,9 +15,10 @@ */ #include "H5FDdrvr_module.h" /* This source code file is part of the H5FD driver module */ +#define H5F_FRIEND /* Suppress error about including H5Fpkg */ #include "H5Eprivate.h" /* Error handling */ -#include "H5Fprivate.h" /* File access */ +#include "H5Fpkg.h" /* Files */ #include "H5FDprivate.h" /* File drivers */ #include "H5FDvfd_swmr.h" /* VFD SWMR file driver */ #include "H5FLprivate.h" /* Free Lists */ @@ -40,7 +41,7 @@ typedef struct H5FD_vfd_swmr_t { /* Metadata file */ int md_fd; /* File descriptor for the metadata file */ uint32_t md_pages_reserved; /* # of pages reserved at the head of the metadata file */ - char md_file_path[H5FD_MAX_FILENAME_LEN]; /* Name of the metadate file */ + char md_file_path_name[H5FD_MAX_FILENAME_LEN+1]; /* Name of the metadate file */ H5FD_vfd_swmr_md_header md_header; /* Metadata file header */ H5FD_vfd_swmr_md_index md_index; /* Metadata file index */ @@ -60,10 +61,15 @@ typedef struct H5FD_vfd_swmr_t { * to the lower VFD instance. */ hbool_t writer; + /* + * Indicate whether we are in make_believe state or not + */ + hbool_t make_believe; } H5FD_vfd_swmr_t; #define MAXADDR (((haddr_t)1 << (8 * sizeof(HDoff_t) - 1)) - 1) +#define VFD_SWMR_MD_SUFFIX ".md" /* Prototypes */ static herr_t H5FD__vfd_swmr_term(void); @@ -217,6 +223,10 @@ done: * * Return: SUCCEED/FAIL * + * Modifications: + * Vailin Choi: 2/18/2022 + * VDS changes: Try opening metadata file and loading header/index if make_believe is FALSE. + * *------------------------------------------------------------------------- */ static herr_t @@ -235,30 +245,117 @@ H5FD__swmr_reader_open(H5FD_vfd_swmr_t *file) if (file->api_elapsed_ticks == NULL) HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "could not allocate API elapsed ticks") - /* Retry on opening the metadata file */ - for (do_try = H5_retry_init(&retry, H5FD_VFD_SWMR_MD_FILE_RETRY_MAX, H5_RETRY_DEFAULT_MINIVAL, - H5_RETRY_DEFAULT_MAXIVAL); - do_try; do_try = H5_retry_next(&retry)) { - if ((file->md_fd = HDopen(file->md_file_path, O_RDONLY)) >= 0) - break; - } + if(!file->make_believe) { + /* Retry on opening the metadata file */ + for (do_try = H5_retry_init(&retry, H5FD_VFD_SWMR_MD_FILE_RETRY_MAX, H5_RETRY_DEFAULT_MINIVAL, + H5_RETRY_DEFAULT_MAXIVAL); + do_try; do_try = H5_retry_next(&retry)) { + if ((file->md_fd = HDopen(file->md_file_path_name, O_RDONLY)) >= 0) + break; + } - /* Exhaust all retries for opening the md file */ - if (!do_try) - HGOTO_ERROR(H5E_VFL, H5E_OPENERROR, FAIL, - "unable to open the metadata file after all retry attempts"); + /* Exhaust all retries for opening the md file */ + if (!do_try) + HGOTO_ERROR(H5E_VFL, H5E_OPENERROR, FAIL, + "unable to open the metadata file after all retry attempts"); - /* Retry on loading and decoding the header and index in the - * metadata file - */ - if (H5FD__vfd_swmr_load_hdr_and_idx(file, TRUE) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "unable to load/decode the md file header/index"); + /* Retry on loading and decoding the header and index in the + * metadata file + */ + if (H5FD__vfd_swmr_load_hdr_and_idx(file, TRUE) < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "unable to load/decode the md file header/index"); + } done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD__swmr_reader_open() */ /*------------------------------------------------------------------------- + * + * Function: H5FD_vfd_swmr_build_md_path_name + * + * Purpose: To construct the metadata file's full name based on config's + * md_file_path and md_file_name. See RFC for details. + * + * + * Return: Success: SUCCEED + * Failure: FAIL + * + * Programmer: Vailin Choi -- 1/13/2022 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5FD_vfd_swmr_build_md_path_name(H5F_vfd_swmr_config_t *config, const char *hdf5_filename, char *name /*out*/) +{ + size_t tot_len = 0; + size_t tmp_len = 0; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE + + if((tot_len = HDstrlen(config->md_file_path)) != 0) { + + /* md_file_path + '/' */ + if(++tot_len > H5F__MAX_VFD_SWMR_FILE_NAME_LEN) + HGOTO_ERROR(H5E_FILE, H5E_CANTCOPY, FAIL, "md_file_path and md_file_name exceeds maximum"); + HDstrcat(name, config->md_file_path); + HDstrcat(name, "/"); + } + + if((tmp_len = HDstrlen(config->md_file_name)) != 0) { + if((tot_len += tmp_len) > H5F__MAX_VFD_SWMR_FILE_NAME_LEN) + HGOTO_ERROR(H5E_FILE, H5E_CANTCOPY, FAIL, "md_file_path and md_file_name exceeds maxiumum"); + HDstrcat(name, config->md_file_name); + } else { + /* Automatic generation of metadata file name based on hdf5_filename + '.md' */ + if((tot_len += (HDstrlen(hdf5_filename) + 3)) > H5F__MAX_VFD_SWMR_FILE_NAME_LEN) + HGOTO_ERROR(H5E_FILE, H5E_CANTCOPY, FAIL, "md_file_path and md_file_name maxiumum"); + + HDstrcat(name, hdf5_filename); + HDstrcat(name, VFD_SWMR_MD_SUFFIX); + } + +done: + + FUNC_LEAVE_NOAPI(ret_value) + +} /* H5FD_vfd_swmr_build_md_path_name() */ + +/*------------------------------------------------------------------------- + * Function: H5FD_vfd_swmr_create_make_believe_data + * + * Purpose: Set up pretend data when make_believe is true + * + * Return: VOID + * + * Programmer: Vailin Choi -- 1/13/2022 + * + *------------------------------------------------------------------------- + */ +static void +H5FD_vfd_swmr_create_make_believe_data(H5FD_vfd_swmr_t *_file) +{ + H5FD_vfd_swmr_t *file = (H5FD_vfd_swmr_t *)_file; + + FUNC_ENTER_PACKAGE_NOERR + + HDassert(file->make_believe); + + /* Create make_believe data: empty header and index */ + file->md_header.fs_page_size = 0; + file->md_header.tick_num = 0; + file->md_header.index_offset = H5FD_MD_HEADER_SIZE; + file->md_header.index_length = H5FD_MD_INDEX_SIZE(0); + + file->md_index.tick_num = 0; + file->md_index.num_entries = 0; + + FUNC_LEAVE_NOAPI_VOID + +} /* H5FD_vfd_swmr_create_make_believe_data() */ + +/*------------------------------------------------------------------------- * Function: H5FD__vfd_swmr_open * * Purpose: Open the metadata file and the underlying HDF5 file @@ -268,6 +365,11 @@ done: * caller, which is always H5FD_open(). * Failure: NULL * + * Modifications: + * Vailin Choi: 2/18/2022 + * VDS changes: --Build metadata file name + * --Determine make_believe or not + * *------------------------------------------------------------------------- */ static H5FD_t * @@ -278,6 +380,7 @@ H5FD__vfd_swmr_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t max H5P_genplist_t * plist; H5F_vfd_swmr_config_t *vfd_swmr_config; H5FD_t * ret_value = NULL; /* Return value */ + htri_t is_hdf5; FUNC_ENTER_PACKAGE @@ -314,16 +417,33 @@ H5FD__vfd_swmr_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t max file->hdf5_filename[sizeof(file->hdf5_filename) - 1] = '\0'; /* Retain a copy of the metadata file name */ - HDstrncpy(file->md_file_path, vfd_swmr_config->md_file_path, sizeof(file->md_file_path)); - file->md_file_path[sizeof(file->md_file_path) - 1] = '\0'; + if(H5FD_vfd_swmr_build_md_path_name(vfd_swmr_config, name, file->md_file_path_name) < 0) + HGOTO_ERROR(H5E_VFL, H5E_OPENERROR, NULL, "building md_file_path and md_file_name failed") + + file->md_file_path_name[sizeof(file->md_file_path_name) - 1] = '\0'; file->writer = vfd_swmr_config->writer; - /* Ensure that this is the reader */ - if (!vfd_swmr_config->writer && H5FD__swmr_reader_open(file) < 0) - HGOTO_ERROR(H5E_VFL, H5E_OPENERROR, NULL, "perform reader-specific opening steps failed") + /* Make sure the hdf5 file exists and is valid */ + is_hdf5 = H5F__is_hdf5(name, H5P_FILE_ACCESS_DEFAULT); + + /* Ensure reader */ + if(!vfd_swmr_config->writer) { + /* Metadata file does not exist, presume_posix is true, HDF5 file exist */ + if (HDaccess(file->md_file_path_name, F_OK) < 0 && + vfd_swmr_config->presume_posix_semantics && + is_hdf5 == TRUE) { + + file->make_believe = TRUE; + H5FD_vfd_swmr_create_make_believe_data(file); + } + if (H5FD__swmr_reader_open(file) < 0) + HGOTO_ERROR(H5E_VFL, H5E_OPENERROR, NULL, "perform reader-specific opening steps failed") + } /* Hard-wired to open the underlying HDF5 file with SEC2 */ + /* H5FD_SEC2 is the default driver for H5P_FILE_ACCESS_DEFAULT except when + the environment variable HDF5_DRIVER is set to otherwise */ if ((file->hdf5_file_lf = H5FD_open(name, flags, H5P_FILE_ACCESS_DEFAULT, maxaddr)) == NULL) HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, NULL, "can't set driver info"); @@ -456,7 +576,7 @@ H5FD__vfd_swmr_cmp(const H5FD_t *_f1, const H5FD_t *_f2) } /* end H5FD_vfd__swmr_cmp() */ /*------------------------------------------------------------------------- - * Function: H5FD_vfd_swmr_dedup + * Function: H5FD_vfd_swmr_dedup (original description with H5P_FILE_ACCESS_ANY_VFD) * * Purpose: Compare the already-opened VFD instance `_self` with the * VFD instance `_other` newly-opened with file-access properties @@ -497,6 +617,42 @@ H5FD__vfd_swmr_cmp(const H5FD_t *_f1, const H5FD_t *_f2) * Failure: NULL *------------------------------------------------------------------------- */ +/*------------------------------------------------------------------------- + * Function: H5FD_vfd_swmr_dedup (modified version without H5P_FILE_ACCESS_ANY_VFD) + * + * Purpose: Compare the already-opened VFD instance `_self` with the + * VFD instance `_other` newly-opened with file-access properties + * `fapl_id` and indicate whether the instances duplicate each + * other, if they conflict with each other, or if they are + * dissimilar. + * + * If `_self` duplicates `_other`, return `_self`. + * + * Return NULL on error, or if `_other` and `_self` refer to the + * same file but the file-access properties, `fapl_id`, conflict + * with the properties of `_self`. + * + * If `_other` neither duplicates nor conflicts with `_self`, + * then return `_other`. + * + * NOTE: Judging duplicate/conflicting/dissimilar VFD instances + * + * `_self` DUPLICATES `_other` if `_other` is also an instance + * of SWMR class, the instances' lower files are equal under + * `H5FD_cmp()`, and the file-access properties of `_self` match + * `fapl_id`. + * + * `_self` and `_other` CONFLICT if both are SWMR instances + * referring to the same lower file, and their file-access + * properties differ. + * + * `_self` and `_other` CONFLICT if `_other` is not a SWMR + * instance, it equals the lower file of `_self`. + * + * Return: Success: `_self' or `_other', as described above + * Failure: NULL + *------------------------------------------------------------------------- + */ H5FD_t * H5FD_vfd_swmr_dedup(H5FD_t *_self, H5FD_t *_other, hid_t fapl_id) { @@ -523,11 +679,6 @@ H5FD_vfd_swmr_dedup(H5FD_t *_self, H5FD_t *_other, hid_t fapl_id) if (H5FD_cmp(self->hdf5_file_lf, other->hdf5_file_lf) != 0) HGOTO_DONE(_other) - /* If fapl_id == _ANY_VFD, then the match between lower files is - * sufficient. - */ - if (fapl_id == H5P_FILE_ACCESS_ANY_VFD) - HGOTO_DONE(_self) /* If fapl_id != _ANY_VFD, then we have either a duplicate or * a conflict. If the VFD SWMR parameters match, then @@ -552,7 +703,7 @@ H5FD_vfd_swmr_dedup(H5FD_t *_self, H5FD_t *_other, hid_t fapl_id) HGOTO_ERROR(H5E_VFL, H5E_CANTGET, NULL, "inconsistent VFD SWMR config") } else if (H5FD_cmp(self->hdf5_file_lf, _other) == 0) - ret_value = (fapl_id == H5P_FILE_ACCESS_ANY_VFD) ? _self : NULL; + ret_value = NULL; else ret_value = _other; @@ -752,6 +903,11 @@ done: * buffer BUF. * Failure: FAIL, Contents of buffer BUF are undefined. * + * Modifications: + * Vailin Choi: 2/18/2022 + * VDS changes: If fs_page_size is 0, i.e. in make_believe state, + * read from the underlying HDF5 file + * *------------------------------------------------------------------------- */ static herr_t @@ -780,10 +936,16 @@ H5FD__vfd_swmr_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id num_entries = file->md_index.num_entries; fs_page_size = file->md_header.fs_page_size; - /* Try finding the addr from the index */ - target_page = addr / fs_page_size; + if(!fs_page_size) { + HDassert(!num_entries); + HDassert(file->make_believe); + entry = NULL; + } else { + /* Try finding the addr from the index */ + target_page = addr / fs_page_size; - entry = H5FD_vfd_swmr_pageno_to_mdf_idx_entry(index, num_entries, target_page, FALSE); + entry = H5FD_vfd_swmr_pageno_to_mdf_idx_entry(index, num_entries, target_page, FALSE); + } if (entry == NULL) { /* Cannot find addr in index, read from the underlying hdf5 file */ @@ -791,7 +953,7 @@ H5FD__vfd_swmr_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "file read request failed") HGOTO_DONE(SUCCEED); - } + } /* Found in index, read from the metadata file */ HDassert(addr >= target_page * fs_page_size); @@ -1007,6 +1169,10 @@ done: * * Return: Success: SUCCEED * Failure: FAIL + * + * Modifications: + * Vailin Choi: 2/18/2022 + * VDS changes: Update the header's fs_page size if it is still 0 * *------------------------------------------------------------------------- */ @@ -1113,6 +1279,14 @@ H5FD__vfd_swmr_load_hdr_and_idx(H5FD_vfd_swmr_t *file, hbool_t open) md_index.entries = NULL; done: + /* Need to update the header's fs_page_size if it is still 0 + because it is possible that md_header.tick_num == file->md_header.tick_num + and the loading is not done */ + if(ret_value == SUCCEED && !file->md_header.fs_page_size) { + HDassert(md_header.fs_page_size); + HDassert(file->make_believe); + file->md_header.fs_page_size = md_header.fs_page_size; + } FUNC_LEAVE_NOAPI(ret_value) @@ -1501,3 +1675,139 @@ H5FD_vfd_swmr_record_elapsed_ticks(H5FD_t *_file, uint64_t elapsed) FUNC_LEAVE_NOAPI_VOID } /* end H5FD_vfd_swmr_record_elapsed_ticks() */ + +/*------------------------------------------------------------------------- + * Function: H5FD_vfd_swmr_get_md_name + * + * Purpose: To retrieve the metadata file's full name + * + * Return: VOID + * + * Programmer: Vailin Choi; 02/18/2022 + * + *------------------------------------------------------------------------- + * + */ +void +H5FD_vfd_swmr_get_md_path_name(H5FD_t *_file, char **name) +{ + FUNC_ENTER_NOAPI_NOINIT_NOERR + + H5FD_vfd_swmr_t *file = (H5FD_vfd_swmr_t *)_file; + + *name = H5MM_xstrdup(file->md_file_path_name); + + FUNC_LEAVE_NOAPI_VOID + +} /* H5FD_vfd_swmr_get_md_path_name() */ + +/*------------------------------------------------------------------------- + * Function: H5FD_vfd_swmr_get_make_believe + * + * Purpose: To retrieve the value of make_believe + * + * Return: TRUE/FALSE + * + * Programmer: Vailin Choi; 02/18/2022 + * + *------------------------------------------------------------------------- + * + */ +hbool_t +H5FD_vfd_swmr_get_make_believe(H5FD_t *_file) +{ + H5FD_vfd_swmr_t *file = (H5FD_vfd_swmr_t *)_file; + + FUNC_ENTER_NOAPI_NOINIT_NOERR + + HDassert(file); + + FUNC_LEAVE_NOAPI(file->make_believe) + +} /* H5FD_vfd_swmr_get_make_believe() */ + + +/*------------------------------------------------------------------------- + * Function: H5FD_vfd_swmr_set_make_believe + * + * Purpose: To set the VFD's make believe to the + * parameter "make_believe" + * + * Return: VOID + * + * Programmer: Vailin Choi; 02/18/2022 + * + *------------------------------------------------------------------------- + * + */ +void +H5FD_vfd_swmr_set_make_believe(H5FD_t *_file, hbool_t make_believe) +{ + FUNC_ENTER_NOAPI_NOINIT_NOERR + + H5FD_vfd_swmr_t *file = (H5FD_vfd_swmr_t *)_file; + + HDassert(file); + + /* Set return value */ + file->make_believe = make_believe; + + FUNC_LEAVE_NOAPI_VOID + +} /* H5FD_vfd_swmr_make_believe() */ + +/*------------------------------------------------------------------------- + * Function: H5FD_vfd_swmr_assess_make_believe + * + * Purpose: To determine whether continuing with make_believe or not. + * Return TRUE: + * --if metadata file does not exist, continue with make_believe + * Return FALSE: + * --if metadata file exists and can be opened successfully, + * discontinue with make_believe + * Return FAIL: + * --error in opening the metadata file + * + * + * Return: TRUE/FALSE/FAIL + * + * Programmer: Vailin Choi; 02/18/2022 + *------------------------------------------------------------------------- + */ +htri_t +H5FD_vfd_swmr_assess_make_believe(H5FD_t *_file) +{ + H5FD_vfd_swmr_t *file = (H5FD_vfd_swmr_t *)_file; /* VFD SWMR file struct */ + h5_retry_t retry; + hbool_t do_try; /* more tries remain */ + htri_t ret_value = TRUE; /* Return value */ + + FUNC_ENTER_NOAPI(FALSE) + + HDassert(file->make_believe); + + if (HDaccess(file->md_file_path_name, F_OK) >= 0) { + /* MD file exists now, proceed to open it */ + HDassert(file->md_fd < 0); + + /* Retry on opening the metadata file */ + for (do_try = H5_retry_init(&retry, H5FD_VFD_SWMR_MD_FILE_RETRY_MAX, H5_RETRY_DEFAULT_MINIVAL, + H5_RETRY_DEFAULT_MAXIVAL); + do_try; do_try = H5_retry_next(&retry)) { + if ((file->md_fd = HDopen(file->md_file_path_name, O_RDONLY)) >= 0) + break; + } + + /* Exhaust all retries for opening the md file */ + if (!do_try) + HGOTO_ERROR(H5E_VFL, H5E_OPENERROR, FAIL, + "unable to open the metadata file after all retry attempts"); + + /* Succeed in opening the MD file, discontinue make_believe */ + ret_value = FALSE; + } + +done: + FUNC_LEAVE_NOAPI(ret_value) + +} /* end H5FD_vfd_swmr_assess_make_believe() */ diff --git a/src/H5Fint.c b/src/H5Fint.c index 2822d9d..68c53f2 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -1828,10 +1828,25 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) FUNC_ENTER_NOAPI(NULL) + /* + * If the driver has a 'cmp' method then the driver is capable of + * determining when two file handles refer to the same file and the + * library can insure that when the application opens a file twice + * that the two handles coordinate their operations appropriately. + * Otherwise it is the application's responsibility to never open the + * same file more than once at a time. + */ + if (NULL == (drvr = H5FD_get_class(fapl_id))) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "unable to retrieve VFL class") + /* Get the file access property list, for future queries */ if (NULL == (a_plist = (H5P_genplist_t *)H5I_object(fapl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not file access property list") + /* Check if we are using file locking */ + if (H5F__check_if_using_file_locks(a_plist, &use_file_locking) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "unable to get file locking flag") + /* Allocate space for VFD SWMR configuration info */ if (NULL == (vfd_swmr_config_ptr = H5MM_calloc(sizeof(H5F_vfd_swmr_config_t)))) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "can't allocate memory for mdc log file name") @@ -1854,25 +1869,6 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) } /* - * If the driver has a 'cmp' method then the driver is capable of - * determining when two file handles refer to the same file and the - * library can insure that when the application opens a file twice - * that the two handles coordinate their operations appropriately. - * Otherwise it is the application's responsibility to never open the - * same file more than once at a time. - */ - if (NULL == (drvr = H5FD_get_class(fapl_id))) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "unable to retrieve VFL class") - - /* Get the file access property list, for future queries */ - if (NULL == (a_plist = (H5P_genplist_t *)H5I_object(fapl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not file access property list") - - /* Check if we are using file locking */ - if (H5F__check_if_using_file_locks(a_plist, &use_file_locking) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "unable to get file locking flag") - - /* * Opening a file is a two step process. First we try to open the * file in a way which doesn't affect its state (like not truncating * or creating it) so we can compare it with files that are already diff --git a/src/H5Fio.c b/src/H5Fio.c index ca069e0..7bda83b 100644 --- a/src/H5Fio.c +++ b/src/H5Fio.c @@ -83,6 +83,7 @@ herr_t H5F_shared_block_read(H5F_shared_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, void *buf /*out*/) { + H5FD_mem_t map_type = type; /* Mapped memory type */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -96,8 +97,12 @@ H5F_shared_block_read(H5F_shared_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t if (H5F_addr_le(f_sh->tmp_addr, (addr + size))) HGOTO_ERROR(H5E_IO, H5E_BADRANGE, FAIL, "attempting I/O in temporary file space") + if(!H5F_SHARED_USE_VFD_SWMR(f_sh)) + /* Treat global heap as raw data */ + map_type = (type == H5FD_MEM_GHEAP) ? H5FD_MEM_DRAW : type; + /* Pass through page buffer layer */ - if (H5PB_read(f_sh, type, addr, size, buf) < 0) + if (H5PB_read(f_sh, map_type, addr, size, buf) < 0) HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "read through page buffer failed") done: @@ -141,6 +146,7 @@ H5F_block_read(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, void *buf / herr_t H5F_shared_block_write(H5F_shared_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, const void *buf) { + H5FD_mem_t map_type = type; /* Mapped memory type */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -155,8 +161,12 @@ H5F_shared_block_write(H5F_shared_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t if (H5F_addr_le(f_sh->tmp_addr, (addr + size))) HGOTO_ERROR(H5E_IO, H5E_BADRANGE, FAIL, "attempting I/O in temporary file space") + if(!H5F_SHARED_USE_VFD_SWMR(f_sh)) + /* Treat global heap as raw data */ + map_type = (type == H5FD_MEM_GHEAP) ? H5FD_MEM_DRAW : type; + /* Pass through page buffer layer */ - if (H5PB_write(f_sh, type, addr, size, buf) < 0) + if (H5PB_write(f_sh, map_type, addr, size, buf) < 0) HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "write through page buffer failed") done: diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index ca714c1..152680a 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -528,6 +528,8 @@ struct H5F_shared_t { * --if vfd_swmr_config.writer is TRUE, this field * is not used and is set to -1. */ + char *md_file_path_name; /* Name composed of md_file_path and md_file_name from vfd_swmr_config */ + H5F_generate_md_ck_t generate_md_ck_cb; /* For testing only: * Invoke the user-defined callback if exists to diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index ffc369b..c594ed8 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -374,6 +374,7 @@ typedef struct H5F_t H5F_t; #define H5F_THRESHOLD(F) ((F)->shared->threshold) #define H5F_PGEND_META_THRES(F) ((F)->shared->fs.pgend_meta_thres) #define H5F_POINT_OF_NO_RETURN(F) ((F)->shared->fs.point_of_no_return) +#define H5F_SHARED_USE_VFD_SWMR(F_SH) ((F_SH)->vfd_swmr) #define H5F_USE_VFD_SWMR(F) ((F)->shared->vfd_swmr) #define H5F_NULL_FSM_ADDR(F) ((F)->shared->null_fsm_addr) #define H5F_GET_MIN_DSET_OHDR(F) ((F)->shared->crt_dset_min_ohdr_flag) @@ -438,6 +439,7 @@ typedef struct H5F_t H5F_t; #define H5F_THRESHOLD(F) (H5F_get_threshold(F)) #define H5F_PGEND_META_THRES(F) (H5F_get_pgend_meta_thres(F)) #define H5F_POINT_OF_NO_RETURN(F) (H5F_get_point_of_no_return(F)) +#define H5F_SHARED_USE_VFD_SWMR(F_SH) (H5F_shared_get_use_vfd_swmr(F_SH)) #define H5F_USE_VFD_SWMR(F) (H5F_get_use_vfd_swmr(F)) #define H5F_NULL_FSM_ADDR(F) (H5F_get_null_fsm_addr(F)) #define H5F_GET_MIN_DSET_OHDR(F) (H5F_get_min_dset_ohdr(F)) @@ -628,6 +630,7 @@ typedef struct H5F_t H5F_t; /* int32_t version = */ 0, \ /* int32_t tick_len = */ 0, \ /* int32_t max_lag = */ 0, \ + /* hbool_t presume_posix_semantics = */ FALSE, \ /* hbool_t vfd_swmr_writer = */ FALSE, \ /* hbool_t maintain_metadata_file = */ FALSE, \ /* hbool_t generate_updater_files = */ FALSE, \ @@ -635,6 +638,7 @@ typedef struct H5F_t H5F_t; /* int32_t md_pages_reserved = */ 0, \ /* int32_t pb_expansion_threshold = */ 0, \ /* char md_file_path[] = */ "", \ + /* char md_file_name[] = */ "", \ /* char updater_file_path[] = */ "", \ /* char log_file_path[] = */ "" \ } diff --git a/src/H5Fpublic.h b/src/H5Fpublic.h index e9d3340..76317fb 100644 --- a/src/H5Fpublic.h +++ b/src/H5Fpublic.h @@ -271,6 +271,20 @@ typedef herr_t (*H5F_flush_cb_t)(hid_t object_id, void *udata); * between the writer and the readers. This value must be at least 3, * with 10 being the recommended minimum value. * + * presume_posix_semantics + * A boolean flag that is only relevant to the reader. + * This flag should be set to TRUE if both of the following conditions hold: + * 1) Both the metadata file and HDF5 file are being written on a POSIX + * file system that is local to the reader. + * 2) The metadata file is being maintained directly by the VFD SWMR + * writer (i.e. without use of updater files and the auxiliary process.) + * If this flag is FALSE, the VFD SWMR reader must make the two adjustments: + * 1) Per legacy SWMR, the VFD that reads the HDF5 file proper must allow + * reads past EOF without error. + * 2) The VFD SWMR reader is not permitted to open an existing HDF5 file + * either before the VFD SWMR writer has opened it, or after it has + * closed it. + * * writer: * A boolean flag indicating whether the file opened with this FAPL entry * will be opened R/W. (i.e. as a VFD SWMR writer) @@ -333,9 +347,19 @@ typedef herr_t (*H5F_flush_cb_t)(hid_t object_id, void *udata); * * md_file_path: * If both the writer and maintain_metadata_file fields are TRUE, this - * field contains the path of the metadata file. - * If writer is FALSE, this field contains the path of the (possibly - * local copy of the) metadata file. + * field contains the path but not the name of the metadata file. + * If writer is FALSE, this field contains the path (but not the name) + * of the (possibly local copy of the) metadata file. + * + * md_file_name: + * If both the writer and maintain_metadata_file fields are TRUE, this + * field is defined, and must contain the name (but not the path) of + * the metadata file, or NULL. + * If writer is FALSE, this field is defined, and must contain either + * the name (but not the path) of the metadata file, or NULL. + * If the field is defined but NULL, the metadata file name is + * generated by adding the ".md" suffix to the HDF5 file name. + * If the field is not NULL, the metadata file name is used as provided. * * updater_file_path: * If generate_updater_files is TRUE, the contents of this field depends @@ -353,6 +377,7 @@ typedef struct H5F_vfd_swmr_config_t { int32_t version; uint32_t tick_len; uint32_t max_lag; + hbool_t presume_posix_semantics; hbool_t writer; hbool_t maintain_metadata_file; hbool_t generate_updater_files; @@ -360,6 +385,7 @@ typedef struct H5F_vfd_swmr_config_t { uint32_t md_pages_reserved; uint32_t pb_expansion_threshold; char md_file_path[H5F__MAX_VFD_SWMR_FILE_NAME_LEN + 1]; + char md_file_name[H5F__MAX_VFD_SWMR_FILE_NAME_LEN + 1]; char updater_file_path[H5F__MAX_VFD_SWMR_FILE_NAME_LEN + 1]; char log_file_path[H5F__MAX_VFD_SWMR_FILE_NAME_LEN + 1]; } H5F_vfd_swmr_config_t; diff --git a/src/H5Fquery.c b/src/H5Fquery.c index acdf521..22b9f78 100644 --- a/src/H5Fquery.c +++ b/src/H5Fquery.c @@ -1344,6 +1344,25 @@ H5F_get_file_locking(const H5F_t *f) } /* end H5F_get_file_locking */ /*------------------------------------------------------------------------- + * Function: H5F_shared_get_use_vfd_swmr + * + * Purpose: Determine if VFD SWMR is enabled for this file. + * + * Return: TRUE/FALSE + *------------------------------------------------------------------------- + */ +unsigned +H5F_shared_get_use_vfd_swmr(const H5F_shared_t *f_sh) +{ + /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ + FUNC_ENTER_NOAPI_NOINIT_NOERR + + HDassert(f_sh); + + FUNC_LEAVE_NOAPI(f_sh->vfd_swmr) +} /* end H5F_shared_get_use_vfd_swmr() */ + +/*------------------------------------------------------------------------- * Function: H5F_get_use_vfd_swmr * * Purpose: Determine if VFD SWMR is enabled for this file. diff --git a/src/H5Ftest.c b/src/H5Ftest.c index 0213cd1..86b3c0b 100644 --- a/src/H5Ftest.c +++ b/src/H5Ftest.c @@ -338,11 +338,11 @@ H5F__vfd_swmr_writer_create_open_flush_test(hid_t file_id, hbool_t file_create) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file") /* Open the metadata file */ - if ((md_fd = HDopen(f->shared->vfd_swmr_config.md_file_path, O_RDONLY)) < 0) + if ((md_fd = HDopen(f->shared->md_file_path_name, O_RDONLY)) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "error opening metadata file") /* Verify the minimum size for the metadata file */ - if (HDstat(f->shared->vfd_swmr_config.md_file_path, &stat_buf) < 0) + if (HDstat(f->shared->md_file_path_name, &stat_buf) < 0) HGOTO_ERROR(H5E_FILE, H5E_BADFILE, FAIL, "unable to stat the metadata file") if (file_create) { /* Creating file */ @@ -634,7 +634,7 @@ H5F__vfd_swmr_writer_md_test(hid_t file_id, unsigned num_entries, H5FD_vfd_swmr_ HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "incorrect # of entries in the delayed list") /* Open the metadata file */ - if ((md_fd = HDopen(f->shared->vfd_swmr_config.md_file_path, O_RDONLY)) < 0) + if ((md_fd = HDopen(f->shared->md_file_path_name, O_RDONLY)) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "error opening metadata file") /* Decode the header in the metadata file */ diff --git a/src/H5Fvfd_swmr.c b/src/H5Fvfd_swmr.c index cd3a345..fce5e88 100644 --- a/src/H5Fvfd_swmr.c +++ b/src/H5Fvfd_swmr.c @@ -186,8 +186,10 @@ H5F_vfd_swmr_init(H5F_t *f, hbool_t file_create) shared->vfd_swmr_writer = TRUE; shared->tick_num = 0; - /* Create the metadata file */ - if (((shared->vfd_swmr_md_fd = HDopen(shared->vfd_swmr_config.md_file_path, + /* Retrieve the metadata filename built with md_file_path and md_file_name */ + H5FD_vfd_swmr_get_md_path_name(f->shared->lf, &shared->md_file_path_name); + + if (((shared->vfd_swmr_md_fd = HDopen(shared->md_file_path_name, O_CREAT | O_RDWR | O_TRUNC, H5_POSIX_CREATE_MODE_RW))) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to create the metadata file") @@ -215,7 +217,7 @@ H5F_vfd_swmr_init(H5F_t *f, hbool_t file_create) /* For VFD SWMR testing: invoke callback if set to generate metadata file checksum */ if (shared->generate_md_ck_cb) { - if (shared->generate_md_ck_cb(shared->vfd_swmr_config.md_file_path, shared->updater_seq_num) < 0) + if (shared->generate_md_ck_cb(shared->md_file_path_name, shared->updater_seq_num) < 0) HGOTO_ERROR(H5E_FILE, H5E_SYSTEM, FAIL, "error from generate_md_ck_cb()") } @@ -331,14 +333,16 @@ H5F_vfd_swmr_close_or_flush(H5F_t *f, hbool_t closing) /* For VFD SWMR testing: invoke callback if set to generate metadata file checksum */ if (shared->generate_md_ck_cb) { - if (shared->generate_md_ck_cb(shared->vfd_swmr_config.md_file_path, shared->updater_seq_num) < 0) + if (shared->generate_md_ck_cb(shared->md_file_path_name, shared->updater_seq_num) < 0) HGOTO_ERROR(H5E_FILE, H5E_SYSTEM, FAIL, "error from generate_md_ck_cb()") } /* Unlink the md file */ - if (HDunlink(shared->vfd_swmr_config.md_file_path) < 0) + if (HDunlink(shared->md_file_path_name) < 0) HSYS_GOTO_ERROR(H5E_FILE, H5E_CANTREMOVE, FAIL, "unable to unlink the metadata file") + shared->md_file_path_name = (char *)H5MM_xfree(shared->md_file_path_name); + /* Close the free-space manager for the metadata file */ if (H5MV_close(f) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, @@ -571,7 +575,7 @@ H5F_update_vfd_swmr_metadata_file(H5F_t *f, uint32_t num_entries, H5FD_vfd_swmr_ /* For VFD SWMR testing: invoke callback if set to generate metadata file checksum */ if (shared->generate_md_ck_cb) { - if (shared->generate_md_ck_cb(shared->vfd_swmr_config.md_file_path, shared->updater_seq_num) < 0) + if (shared->generate_md_ck_cb(shared->md_file_path_name, shared->updater_seq_num) < 0) HGOTO_ERROR(H5E_FILE, H5E_SYSTEM, FAIL, "error from generate_md_ck_cb()") } @@ -1031,6 +1035,14 @@ H5F_vfd_swmr_writer_dump_index(H5F_shared_t *shared) * 9) Increment the tick, and update the end of tick. * * Return: SUCCEED/FAIL + * + * Programmer: John Mainzer 12/29/18 + * + * Changes: + * VDS changes: Check make_believe whether to continue the same or + * get out of make_believe and load header/index. + * For details, see RFC for VDS changes. + * *------------------------------------------------------------------------- */ herr_t @@ -1053,6 +1065,7 @@ H5F_vfd_swmr_reader_end_of_tick(H5F_t *f, hbool_t entering_api) herr_t ret_value = SUCCEED; uint32_t i, j, nchanges; H5FD_t * file = shared->lf; + htri_t ret; FUNC_ENTER_NOAPI(FAIL) @@ -1071,9 +1084,34 @@ H5F_vfd_swmr_reader_end_of_tick(H5F_t *f, hbool_t entering_api) * so as to detect the need to allocate more space for the * index. */ - if (H5FD_vfd_swmr_get_tick_and_idx(file, TRUE, &tmp_tick_num, &vfd_entries, NULL) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "error in retrieving tick_num from driver") + /* Check if make_believe is set */ + if(H5FD_vfd_swmr_get_make_believe(file)) { + + /* Return value is TRUE: metadata file is not found, continue with make_believe + and skip eot processing */ + if((ret = H5FD_vfd_swmr_assess_make_believe(file)) == TRUE) { + /* Skip most of the EOT processing */ + goto reader_update_eot; + } else if (ret == FAIL) + HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "error in assessing make_believe from driver") + + /* Return value is FALSE i.e. found the metadata file */ + HDassert(!ret); + + /* Try to load the metadata file header and index */ + if (H5FD_vfd_swmr_get_tick_and_idx(file, TRUE, &tmp_tick_num, &vfd_entries, NULL) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "error in retrieving tick_num from driver") + + /* Set make_believe to FALSE; + get out from make_believe state, continue normal processing */ + H5FD_vfd_swmr_set_make_believe(file, FALSE); + + } else { + /* make_believe is not set, continue normal processing */ + if (H5FD_vfd_swmr_get_tick_and_idx(file, TRUE, &tmp_tick_num, &vfd_entries, NULL) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "error in retrieving tick_num from driver") + } /* This is ok if we're entering the API, but it should * not happen if we're exiting the API. @@ -1288,6 +1326,8 @@ H5F_vfd_swmr_reader_end_of_tick(H5F_t *f, hbool_t entering_api) } } +reader_update_eot: + /* Remove the entry from the EOT queue */ if (H5F_vfd_swmr_remove_entry_eot(f) < 0) HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "unable to remove entry from EOT queue") @@ -2305,7 +2345,8 @@ H5F__generate_updater_file(H5F_t *f, uint32_t num_entries, uint16_t flags, uint8 if (sz > H5F__MAX_VFD_SWMR_FILE_NAME_LEN) HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "string passed to snprintf would be truncated") newname[H5F__MAX_VFD_SWMR_FILE_NAME_LEN - 1] = '\0'; - HDrename(namebuf, newname); + if (HDrename(namebuf, newname) < 0) + HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "error from renaming the updater file") ++shared->updater_seq_num; diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c index 7d3cf57..f900965 100644 --- a/src/H5Pfapl.c +++ b/src/H5Pfapl.c @@ -863,12 +863,6 @@ H5P__facc_reg_prop(H5P_genclass_t *pclass) H5F_ACS_IGNORE_DISABLED_FILE_LOCKS_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - if (H5P_LST_FILE_ACCESS_ANY_VFD_g == H5I_INVALID_HID) { - H5P_LST_FILE_ACCESS_ANY_VFD_g = H5P_create_id(pclass, false); - if (H5P_LST_FILE_ACCESS_ANY_VFD_g == H5I_INVALID_HID) { - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't create any-vfd fapl"); - } - } done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__facc_reg_prop() */ @@ -4637,6 +4631,7 @@ H5P__facc_vfd_swmr_config_enc(const void *value, void **_pp, size_t *size) INT32ENCODE(*pp, (int32_t)config->version); INT32ENCODE(*pp, (int32_t)config->tick_len); INT32ENCODE(*pp, (int32_t)config->max_lag); + H5_ENCODE_UNSIGNED(*pp, config->presume_posix_semantics); H5_ENCODE_UNSIGNED(*pp, config->writer); H5_ENCODE_UNSIGNED(*pp, config->maintain_metadata_file); H5_ENCODE_UNSIGNED(*pp, config->generate_updater_files); @@ -4645,6 +4640,8 @@ H5P__facc_vfd_swmr_config_enc(const void *value, void **_pp, size_t *size) INT32ENCODE(*pp, (int32_t)config->pb_expansion_threshold); HDmemcpy(*pp, (const uint8_t *)(config->md_file_path), (size_t)(H5F__MAX_VFD_SWMR_FILE_NAME_LEN + 1)); *pp += H5F__MAX_VFD_SWMR_FILE_NAME_LEN + 1; + HDmemcpy(*pp, (const uint8_t *)(config->md_file_name), (size_t)(H5F__MAX_VFD_SWMR_FILE_NAME_LEN + 1)); + *pp += H5F__MAX_VFD_SWMR_FILE_NAME_LEN + 1; HDmemcpy(*pp, (const uint8_t *)(config->updater_file_path), (size_t)(H5F__MAX_VFD_SWMR_FILE_NAME_LEN + 1)); *pp += H5F__MAX_VFD_SWMR_FILE_NAME_LEN + 1; @@ -4655,7 +4652,7 @@ H5P__facc_vfd_swmr_config_enc(const void *value, void **_pp, size_t *size) } /* end if */ /* Compute encoded size */ - *size += ((5 * sizeof(int32_t)) + (4 * sizeof(unsigned)) + (3 * (H5F__MAX_VFD_SWMR_FILE_NAME_LEN + 1))); + *size += ((5 * sizeof(int32_t)) + (5 * sizeof(unsigned)) + (4 * (H5F__MAX_VFD_SWMR_FILE_NAME_LEN + 1))); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5P__facc_vfd_swmr_config_enc() */ @@ -4694,6 +4691,7 @@ H5P__facc_vfd_swmr_config_dec(const void **_pp, void *_value) INT32DECODE(*pp, config->version); UINT32DECODE(*pp, config->tick_len); UINT32DECODE(*pp, config->max_lag); + UINT32DECODE(*pp, config->presume_posix_semantics); H5_DECODE_UNSIGNED(*pp, config->writer); H5_DECODE_UNSIGNED(*pp, config->maintain_metadata_file); @@ -4707,6 +4705,9 @@ H5P__facc_vfd_swmr_config_dec(const void **_pp, void *_value) HDstrcpy(config->md_file_path, (const char *)(*pp)); *pp += H5F__MAX_VFD_SWMR_FILE_NAME_LEN + 1; + HDstrcpy(config->md_file_name, (const char *)(*pp)); + *pp += H5F__MAX_VFD_SWMR_FILE_NAME_LEN + 1; + HDstrcpy(config->updater_file_path, (const char *)(*pp)); *pp += H5F__MAX_VFD_SWMR_FILE_NAME_LEN + 1; @@ -6257,14 +6258,13 @@ H5Pset_vfd_swmr_config(hid_t plist_id, H5F_vfd_swmr_config_t *config_ptr) "either maintain_metadata_file or generate_updater_files must be TRUE") } - if ((config_ptr->writer && config_ptr->maintain_metadata_file) || !config_ptr->writer) { - /* Must provide the path and base name of the metadata file */ - name_len = HDstrlen(config_ptr->md_file_path); - if (name_len == 0) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "md_file_path is empty") - else if (name_len > H5F__MAX_VFD_SWMR_FILE_NAME_LEN) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "md_file_path is too long") - } + /* md_file_path can be "" or a name (+"/")*/ + /* md_file_name can be "" (+ ".md") or a name */ + /* pattern: */ + /* Can only validate for , cases */ + name_len = HDstrlen(config_ptr->md_file_path) + HDstrlen(config_ptr->md_file_name); + if (name_len > H5F__MAX_VFD_SWMR_FILE_NAME_LEN) + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "md_file_name + md_file_path is too long") if (config_ptr->writer && config_ptr->generate_updater_files) { /* Must provide the path and base name of the metadata updater files */ diff --git a/src/H5Pint.c b/src/H5Pint.c index 400795a..da8ca1c 100644 --- a/src/H5Pint.c +++ b/src/H5Pint.c @@ -182,7 +182,6 @@ hid_t H5P_LST_DATASET_CREATE_ID_g = H5I_INVALID_HID; hid_t H5P_LST_DATASET_XFER_ID_g = H5I_INVALID_HID; hid_t H5P_LST_DATATYPE_ACCESS_ID_g = H5I_INVALID_HID; hid_t H5P_LST_DATATYPE_CREATE_ID_g = H5I_INVALID_HID; -hid_t H5P_LST_FILE_ACCESS_ANY_VFD_g = H5I_INVALID_HID; hid_t H5P_LST_FILE_ACCESS_ID_g = H5I_INVALID_HID; hid_t H5P_LST_FILE_CREATE_ID_g = H5I_INVALID_HID; hid_t H5P_LST_FILE_MOUNT_ID_g = H5I_INVALID_HID; @@ -605,7 +604,6 @@ H5P_term_package(void) H5P_LST_DATASET_XFER_ID_g = H5I_INVALID_HID; H5P_LST_DATATYPE_ACCESS_ID_g = H5I_INVALID_HID; H5P_LST_DATATYPE_CREATE_ID_g = H5I_INVALID_HID; - H5P_LST_FILE_ACCESS_ANY_VFD_g = H5I_INVALID_HID; H5P_LST_FILE_ACCESS_ID_g = H5I_INVALID_HID; H5P_LST_FILE_CREATE_ID_g = H5I_INVALID_HID; H5P_LST_FILE_MOUNT_ID_g = H5I_INVALID_HID; @@ -660,7 +658,6 @@ H5P_term_package(void) H5P_CLS_DATASET_XFER_ID_g = H5I_INVALID_HID; H5P_CLS_DATATYPE_ACCESS_ID_g = H5I_INVALID_HID; H5P_CLS_DATATYPE_CREATE_ID_g = H5I_INVALID_HID; - H5P_LST_FILE_ACCESS_ANY_VFD_g = H5I_INVALID_HID; H5P_CLS_FILE_ACCESS_ID_g = H5I_INVALID_HID; H5P_CLS_FILE_CREATE_ID_g = H5I_INVALID_HID; H5P_CLS_FILE_MOUNT_ID_g = H5I_INVALID_HID; diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h index ed9db10..4262026 100644 --- a/src/H5Ppublic.h +++ b/src/H5Ppublic.h @@ -78,7 +78,6 @@ */ #define H5P_FILE_CREATE_DEFAULT (H5OPEN H5P_LST_FILE_CREATE_ID_g) #define H5P_FILE_ACCESS_DEFAULT (H5OPEN H5P_LST_FILE_ACCESS_ID_g) -#define H5P_FILE_ACCESS_ANY_VFD (H5OPEN H5P_LST_FILE_ACCESS_ANY_VFD_g) #define H5P_DATASET_CREATE_DEFAULT (H5OPEN H5P_LST_DATASET_CREATE_ID_g) #define H5P_DATASET_ACCESS_DEFAULT (H5OPEN H5P_LST_DATASET_ACCESS_ID_g) #define H5P_DATASET_XFER_DEFAULT (H5OPEN H5P_LST_DATASET_XFER_ID_g) @@ -397,7 +396,6 @@ H5_DLLVAR hid_t H5P_CLS_REFERENCE_ACCESS_ID_g; /* (Internal to library, do not use! Use macros above) */ H5_DLLVAR hid_t H5P_LST_FILE_CREATE_ID_g; H5_DLLVAR hid_t H5P_LST_FILE_ACCESS_ID_g; -H5_DLLVAR hid_t H5P_LST_FILE_ACCESS_ANY_VFD_g; H5_DLLVAR hid_t H5P_LST_DATASET_CREATE_ID_g; H5_DLLVAR hid_t H5P_LST_DATASET_ACCESS_ID_g; H5_DLLVAR hid_t H5P_LST_DATASET_XFER_ID_g; diff --git a/test/page_buffer.c b/test/page_buffer.c index c3555aa..9e45809 100644 --- a/test/page_buffer.c +++ b/test/page_buffer.c @@ -115,7 +115,9 @@ swmr_fapl_augment(hid_t fapl, const char *filename, uint32_t max_lag) HDfprintf(stderr, "H5_basename() failed\n"); return -1; } - HDsnprintf(config.md_file_path, sizeof(config.md_file_path), "%s/%s.shadow", dname, bname); + HDsnprintf(config.md_file_path, sizeof(config.md_file_path), "%s", dname); + HDsnprintf(config.md_file_name, sizeof(config.md_file_name), "%s.shadow", bname); + HDfree(dname); HDfree(bname); diff --git a/test/test_vfd_swmr.sh.in b/test/test_vfd_swmr.sh.in index 08d2706..4548775 100644 --- a/test/test_vfd_swmr.sh.in +++ b/test/test_vfd_swmr.sh.in @@ -1095,6 +1095,9 @@ for options in "-d 1" "-d 1 -F" "-d 2 -l 16" "-d 2 -F -l 16" "-d 1 -t" "-d 1 -t if [ ${do_many_small:-no} = no ]; then continue fi + + rm vfd_swmr_bigset*.h5 2> /dev/null + # # Test many small datasets of two or three dimensions. # @@ -1188,6 +1191,9 @@ for options in "-d 1" "-d 1 -F" "-d 2 -l 10" "-d 2 -F -l 10" "-d 1 -t -l 10" "-d if [ ${do_few_big:-no} = no ]; then continue fi + + rm vfd_swmr_bigset*.h5 2> /dev/null + echo launch vfd_swmr_bigset_writer few big, options $options ......may take some time...... # Launch the auxiliary process for testing NFS if the --enable-aux-process option is enabled for configuration. diff --git a/test/vfd_swmr.c b/test/vfd_swmr.c index e7eb3da..f53b453 100644 --- a/test/vfd_swmr.c +++ b/test/vfd_swmr.c @@ -16,8 +16,12 @@ * * Tests the VFD SWMR Feature. * + * Note: Relevant tests in this file are modified to reflect the + * changes to the fapl for VDS. See latest RFC. + * *************************************************************/ +#include "H5queue.h" #include "h5test.h" #include "vfd_swmr_common.h" @@ -103,11 +107,8 @@ static unsigned test_updater_generate_md_checksums(hbool_t file_create); * --tick_len: should be >= 0 * --max_lag: should be >= 3 * --md_pages_reserved: should be >= 2 - * --md_file_path: should contain the metadata file path (POSIX) * --at least one of maintain_metadata_file and generate_updater_files * must be true - * --if both the writer and maintain_metadata_file fields are true, - * then md_file_path field shouldn't be empty * --if both the writer and generate_updater_files fields are true, * then updater_file_path field shouldn't be empty * B) Verify that info set in the fapl is retrieved correctly. @@ -182,16 +183,8 @@ test_fapl(void) /* Set valid md_pages_reserved */ my_config->md_pages_reserved = 2; - /* Should fail: empty md_file_path */ - H5E_BEGIN_TRY - { - ret = H5Pset_vfd_swmr_config(fapl, my_config); - } - H5E_END_TRY; - if (ret >= 0) - TEST_ERROR; - my_config->writer = TRUE; + /* Should fail: at least one of maintain_metadata_file and generate_updater_files must be true */ H5E_BEGIN_TRY { @@ -203,16 +196,8 @@ test_fapl(void) my_config->writer = TRUE; my_config->maintain_metadata_file = TRUE; - /* Should fail: empty md_file_path */ - H5E_BEGIN_TRY - { - ret = H5Pset_vfd_swmr_config(fapl, my_config); - } - H5E_END_TRY; - if (ret >= 0) - TEST_ERROR; - my_config->generate_updater_files = TRUE; + /* Should fail: empty updater_file_path */ H5E_BEGIN_TRY { @@ -222,8 +207,8 @@ test_fapl(void) if (ret >= 0) TEST_ERROR; - /* Set md_file_path */ - HDstrcpy(my_config->md_file_path, MD_FILENAME); + /* Set md_file_name */ + HDstrcpy(my_config->md_file_name, MD_FILENAME); my_config->generate_updater_files = FALSE; /* Should succeed in setting the configuration info */ @@ -244,7 +229,9 @@ test_fapl(void) TEST_ERROR; if (my_config->generate_updater_files) TEST_ERROR; - if (HDstrcmp(my_config->md_file_path, MD_FILENAME) != 0) + + /* Check md_file_name instead of md_file_path */ + if (HDstrcmp(my_config->md_file_name, MD_FILENAME) != 0) TEST_ERROR; my_config->generate_updater_files = TRUE; @@ -269,7 +256,9 @@ test_fapl(void) TEST_ERROR; if (!my_config->maintain_metadata_file) TEST_ERROR; - if (HDstrcmp(my_config->md_file_path, MD_FILENAME) != 0) + + /* Check md_file_name instead of md_file_path */ + if (HDstrcmp(my_config->md_file_name, MD_FILENAME) != 0) TEST_ERROR; /* Close the file access property list */ @@ -348,9 +337,10 @@ test_file_fapl(void) * Configured as VFD SWMR reader + no page buffering */ - /* config, tick_len, max_lag, writer, maintain_metadata_file, generate_updater_files, - flush_raw_data, md_pages_reserved, md_file_path, updater_file_path */ - init_vfd_swmr_config(config1, 4, 7, FALSE, TRUE, FALSE, TRUE, 2, MD_FILENAME, NULL); + /* config, tick_len, max_lag, presume_posix_semantics, writer, + * maintain_metadata_file, generate_updater_files, flush_raw_data, md_pages_reserved, + * md_file_path, md_file_name, updater_file_path */ + init_vfd_swmr_config(config1, 4, 7, FALSE, FALSE, TRUE, FALSE, TRUE, 2, NULL, MD_FILENAME, NULL); /* use_latest_format, use_vfd_swmr, only_meta_page, page_buf_size, config */ fapl1 = vfd_swmr_create_fapl(FALSE, TRUE, FALSE, 0, config1); @@ -373,9 +363,10 @@ test_file_fapl(void) * Configured as VFD SWMR writer + no page buffering */ - /* config, tick_len, max_lag, writer, maintain_metadata_file, generate_updater_files, - flush_raw_data, md_pages_reserved, md_file_path, updater_file_path */ - init_vfd_swmr_config(config1, 4, 7, TRUE, TRUE, TRUE, TRUE, 2, MD_FILENAME, UD_FILENAME); + /* config, tick_len, max_lag, presume_posix_semantics, writer, + * maintain_metadata_file, generate_updater_files, flush_raw_data, md_pages_reserved, + * md_file_path, md_file_name, updater_file_path */ + init_vfd_swmr_config(config1, 4, 7, FALSE, TRUE, TRUE, TRUE, TRUE, 2, NULL, MD_FILENAME, UD_FILENAME); /* use_latest_format, use_vfd_swmr, only_meta_page, page_buf_size, config */ fapl1 = vfd_swmr_create_fapl(FALSE, TRUE, FALSE, 0, config1); @@ -413,9 +404,10 @@ test_file_fapl(void) * Configured as VFD SWMR writer + page buffering */ - /* config, tick_len, max_lag, writer, maintain_metadata_file, generate_updater_files, - flush_raw_data, md_pages_reserved, md_file_path, updater_file_path */ - init_vfd_swmr_config(config1, 4, 7, TRUE, TRUE, FALSE, TRUE, 2, MD_FILENAME, NULL); + /* config, tick_len, max_lag, presume_posix_semantics, writer, + * maintain_metadata_file, generate_updater_files, flush_raw_data, md_pages_reserved, + * md_file_path, md_file_name, updater_file_path */ + init_vfd_swmr_config(config1, 4, 7, FALSE, TRUE, TRUE, FALSE, TRUE, 2, NULL, MD_FILENAME, NULL); /* use_latest_format, use_vfd_swmr, only_meta_page, page_buf_size, config */ fapl1 = vfd_swmr_create_fapl(FALSE, TRUE, FALSE, 4096, config1); @@ -485,9 +477,10 @@ test_file_fapl(void) * Set up different VFD SWMR configuration + page_buffering */ - /* config, tick_len, max_lag, writer, maintain_metadata_file, generate_updater_files, - flush_raw_data, md_pages_reserved, md_file_path, updater_file_path */ - init_vfd_swmr_config(config2, 4, 10, TRUE, TRUE, FALSE, TRUE, 2, MD_FILENAME, NULL); + /* config, tick_len, max_lag, presume_posix_semantics, writer, + * maintain_metadata_file, generate_updater_files, flush_raw_data, md_pages_reserved, + * md_file_path, md_file_name, updater_file_path */ + init_vfd_swmr_config(config2, 4, 10, FALSE, TRUE, TRUE, FALSE, TRUE, 2, NULL, MD_FILENAME, NULL); /* use_latest_format, use_vfd_swmr, only_meta_page, page_buf_size, config */ fapl2 = vfd_swmr_create_fapl(FALSE, TRUE, FALSE, 4096, config2); @@ -525,9 +518,10 @@ test_file_fapl(void) * Set up as VFD SWMR writer in config1 but different from config2 */ - /* config, tick_len, max_lag, writer, maintain_metadata_file, generate_updater_files, - flush_raw_data, md_pages_reserved, md_file_path, updater_file_path */ - init_vfd_swmr_config(config1, 3, 8, TRUE, TRUE, FALSE, TRUE, 3, MD_FILENAME, NULL); + /* config, tick_len, max_lag, presume_posix_semantics, writer, + * maintain_metadata_file, generate_updater_files, flush_raw_data, md_pages_reserved, + * md_file_path, md_file_name, updater_file_path */ + init_vfd_swmr_config(config1, 3, 8, FALSE, TRUE, TRUE, FALSE, TRUE, 3, NULL, MD_FILENAME, NULL); /* use_latest_format, use_vfd_swmr, only_meta_page, page_buf_size, config */ fapl1 = vfd_swmr_create_fapl(FALSE, TRUE, FALSE, 4096, config1); @@ -553,7 +547,10 @@ test_file_fapl(void) * Set up as VFD SWMR reader in config1 which is same as config2 */ - init_vfd_swmr_config(config1, 4, 10, TRUE, TRUE, FALSE, TRUE, 2, MD_FILENAME, NULL); + /* config, tick_len, max_lag, presume_posix_semantics, writer, + * maintain_metadata_file, generate_updater_files, flush_raw_data, md_pages_reserved, + * md_file_path, md_file_name, updater_file_path */ + init_vfd_swmr_config(config1, 4, 10, FALSE, TRUE, TRUE, FALSE, TRUE, 2, NULL, MD_FILENAME, NULL); /* use_latest_format, use_vfd_swmr, only_meta_page, page_buf_size, config */ fapl1 = vfd_swmr_create_fapl(FALSE, TRUE, FALSE, 4096, config1); @@ -691,9 +688,10 @@ test_file_end_tick(void) * Configured file 1 as VFD SWMR writer + page buffering */ - /* config, tick_len, max_lag, writer, maintain_metadata_file, generate_updater_files, - flush_raw_data, md_pages_reserved, md_file_path, updater_file_path */ - init_vfd_swmr_config(config1, 10, 15, TRUE, TRUE, FALSE, TRUE, 2, MD_FILENAME, NULL); + /* config, tick_len, max_lag, presume_posix_semantics, writer, + * maintain_metadata_file, generate_updater_files, flush_raw_data, md_pages_reserved, + * md_file_path, md_file_name, updater_file_path */ + init_vfd_swmr_config(config1, 10, 15, FALSE, TRUE, TRUE, FALSE, TRUE, 2, NULL, MD_FILENAME, NULL); /* use_latest_format, use_vfd_swmr, only_meta_page, page_buf_size, config */ fapl1 = vfd_swmr_create_fapl(FALSE, TRUE, FALSE, 4096, config1); @@ -705,9 +703,10 @@ test_file_end_tick(void) * Configured file 2 as VFD SWMR writer + page buffering */ - /* config, tick_len, max_lag, writer, maintain_metadata_file, generate_updater_files, - flush_raw_data, md_pages_reserved, md_file_path, updater_file_path */ - init_vfd_swmr_config(config2, 5, 6, TRUE, TRUE, FALSE, TRUE, 2, MD_FILENAME2, NULL); + /* config, tick_len, max_lag, presume_posix_semantics, writer, + * maintain_metadata_file, generate_updater_files, flush_raw_data, md_pages_reserved, + * md_file_path, md_file_name, updater_file_path */ + init_vfd_swmr_config(config2, 5, 6, FALSE, TRUE, TRUE, FALSE, TRUE, 2, NULL, MD_FILENAME2, NULL); /* use_latest_format, use_vfd_swmr, only_meta_page, page_buf_size, config */ fapl2 = vfd_swmr_create_fapl(FALSE, TRUE, FALSE, 4096, config2); @@ -719,9 +718,10 @@ test_file_end_tick(void) * Configured file 3 as VFD SWMR writer + page buffering */ - /* config, tick_len, max_lag, writer, maintain_metadata_file, generate_updater_files, - flush_raw_data, md_pages_reserved, md_file_path, updater_file_path */ - init_vfd_swmr_config(config3, 3, 6, TRUE, TRUE, FALSE, TRUE, 2, MD_FILENAME3, NULL); + /* config, tick_len, max_lag, presume_posix_semantics, writer, + * maintain_metadata_file, generate_updater_files, flush_raw_data, md_pages_reserved, + * md_file_path, md_file_name, updater_file_path */ + init_vfd_swmr_config(config3, 3, 6, FALSE, TRUE, TRUE, FALSE, TRUE, 2, NULL, MD_FILENAME3, NULL); /* use_latest_format, use_vfd_swmr, only_meta_page, page_buf_size, config */ fapl3 = vfd_swmr_create_fapl(FALSE, TRUE, FALSE, 4096, config3); @@ -896,9 +896,10 @@ test_writer_create_open_flush(void) * Set up the VFD SWMR configuration + page buffering */ - /* config, tick_len, max_lag, writer, maintain_metadata_file, generate_updater_files, - flush_raw_data, md_pages_reserved, md_file_path, updater_file_path */ - init_vfd_swmr_config(my_config, 1, 3, TRUE, TRUE, FALSE, TRUE, 2, MD_FILENAME, NULL); + /* config, tick_len, max_lag, presume_posix_semantics, writer, + * maintain_metadata_file, generate_updater_files, flush_raw_data, md_pages_reserved, + * md_file_path, md_file_name, updater_file_path */ + init_vfd_swmr_config(my_config, 1, 3, FALSE, TRUE, TRUE, FALSE, TRUE, 2, NULL, MD_FILENAME, NULL); /* use_latest_format, use_vfd_swmr, only_meta_page, page_buf_size, config */ fapl = vfd_swmr_create_fapl(FALSE, TRUE, FALSE, 4096, my_config); @@ -1017,9 +1018,10 @@ test_writer_md(void) if ((my_config = HDmalloc(sizeof(H5F_vfd_swmr_config_t))) == NULL) FAIL_STACK_ERROR; - /* config, tick_len, max_lag, writer, maintain_metadata_file, generate_updater_files, - flush_raw_data, md_pages_reserved, md_file_path, updater_file_path */ - init_vfd_swmr_config(my_config, 1, 3, TRUE, TRUE, FALSE, TRUE, 256, MD_FILENAME, NULL); + /* config, tick_len, max_lag, presume_posix_semantics, writer, + * maintain_metadata_file, generate_updater_files, flush_raw_data, md_pages_reserved, + * md_file_path, md_file_name, updater_file_path */ + init_vfd_swmr_config(my_config, 1, 3, FALSE, TRUE, TRUE, FALSE, TRUE, 256, NULL, MD_FILENAME, NULL); /* use_latest_format, use_vfd_swmr, only_meta_page, page_buf_size, config */ fapl = vfd_swmr_create_fapl(FALSE, TRUE, FALSE, FS_PAGE_SIZE, my_config); @@ -1327,9 +1329,10 @@ test_reader_md_concur(void) * Set up the VFD SWMR configuration + page buffering */ - /* config, tick_len, max_lag, writer, maintain_metadata_file, generate_updater_files, - flush_raw_data, md_pages_reserved, md_file_path, updater_file_path */ - init_vfd_swmr_config(config_writer, 1, 3, TRUE, TRUE, FALSE, TRUE, 256, MD_FILENAME, NULL); + /* config, tick_len, max_lag, presume_posix_semantics, writer, + * maintain_metadata_file, generate_updater_files, flush_raw_data, md_pages_reserved, + * md_file_path, md_file_name, updater_file_path */ + init_vfd_swmr_config(config_writer, 1, 3, FALSE, TRUE, TRUE, FALSE, TRUE, 256, NULL, MD_FILENAME, NULL); /* use_latest_format, use_vfd_swmr, only_meta_page, page_buf_size, config */ fapl_writer = vfd_swmr_create_fapl(FALSE, TRUE, FALSE, FS_PAGE_SIZE, config_writer); @@ -1403,9 +1406,10 @@ test_reader_md_concur(void) * Set up the VFD SWMR configuration as reader + page buffering */ - /* config, tick_len, max_lag, writer, maintain_metadata_file, generate_updater_files, - flush_raw_data, md_pages_reserved, md_file_path, updater_file_path */ - init_vfd_swmr_config(config_reader, 1, 3, FALSE, TRUE, FALSE, TRUE, 256, MD_FILENAME, NULL); + /* config, tick_len, max_lag, presume_posix_semantics, writer, + * maintain_metadata_file, generate_updater_files, flush_raw_data, md_pages_reserved, + * md_file_path, md_file_name, updater_file_path */ + init_vfd_swmr_config(config_reader, 1, 3, FALSE, FALSE, TRUE, FALSE, TRUE, 256, NULL, MD_FILENAME, NULL); /* use_latest_format, use_vfd_swmr, only_meta_page, page_buf_size, config */ fapl_reader = vfd_swmr_create_fapl(FALSE, TRUE, FALSE, FS_PAGE_SIZE, config_reader); @@ -2010,9 +2014,10 @@ test_multiple_file_opens_concur(void) /* Set the VFD SWMR configuration in fapl_writer + page buffering */ - /* config, tick_len, max_lag, writer, maintain_metadata_file, generate_updater_files, - flush_raw_data, md_pages_reserved, md_file_path, updater_file_path */ - init_vfd_swmr_config(config_writer, 1, 3, TRUE, TRUE, FALSE, TRUE, 256, MD_FILENAME2, NULL); + /* config, tick_len, max_lag, presume_posix_semantics, writer, + * maintain_metadata_file, generate_updater_files, flush_raw_data, md_pages_reserved, + * md_file_path, md_file_name, updater_file_path */ + init_vfd_swmr_config(config_writer, 1, 3, FALSE, TRUE, TRUE, FALSE, TRUE, 256, NULL, MD_FILENAME2, NULL); /* use_latest_format, use_vfd_swmr, only_meta_page, page_buf_size, config */ fapl_writer = vfd_swmr_create_fapl(FALSE, TRUE, FALSE, FS_PAGE_SIZE, config_writer); @@ -2077,9 +2082,10 @@ test_multiple_file_opens_concur(void) if ((config1 = HDmalloc(sizeof(*config1))) == NULL) FAIL_STACK_ERROR; - /* config, tick_len, max_lag, writer, maintain_metadata_file, generate_updater_files, - flush_raw_data, md_pages_reserved, md_file_path, updater_file_path */ - init_vfd_swmr_config(config1, 7, 10, TRUE, TRUE, FALSE, TRUE, 256, MD_FILENAME, NULL); + /* config, tick_len, max_lag, presume_posix_semantics, writer, + * maintain_metadata_file, generate_updater_files, flush_raw_data, md_pages_reserved, + * md_file_path, md_file_name, updater_file_path */ + init_vfd_swmr_config(config1, 7, 10, FALSE, TRUE, TRUE, FALSE, TRUE, 256, NULL, MD_FILENAME, NULL); /* use_latest_format, use_vfd_swmr, only_meta_page, page_buf_size, config */ fapl1 = vfd_swmr_create_fapl(FALSE, TRUE, FALSE, FS_PAGE_SIZE, config1); @@ -2120,9 +2126,10 @@ test_multiple_file_opens_concur(void) if ((config2 = HDmalloc(sizeof(*config2))) == NULL) FAIL_STACK_ERROR; - /* config, tick_len, max_lag, writer, maintain_metadata_file, generate_updater_files, - flush_raw_data, md_pages_reserved, md_file_path, updater_file_path */ - init_vfd_swmr_config(config2, 1, 3, FALSE, TRUE, FALSE, TRUE, 256, MD_FILENAME2, NULL); + /* config, tick_len, max_lag, presume_posix_semantics, writer, + * maintain_metadata_file, generate_updater_files, flush_raw_data, md_pages_reserved, + * md_file_path, md_file_name, updater_file_path */ + init_vfd_swmr_config(config2, 1, 3, FALSE, FALSE, TRUE, FALSE, TRUE, 256, NULL, MD_FILENAME2, NULL); /* use_latest_format, use_vfd_swmr, only_meta_page, page_buf_size, config */ fapl2 = vfd_swmr_create_fapl(FALSE, TRUE, FALSE, FS_PAGE_SIZE, config2); @@ -2259,9 +2266,10 @@ test_disable_enable_eot_concur(void) * Set up the VFD SWMR configuration + page buffering */ - /* config, tick_len, max_lag, writer, maintain_metadata_file, generate_updater_files, - flush_raw_data, md_pages_reserved, md_file_path, updater_file_path */ - init_vfd_swmr_config(config_writer, 1, 3, TRUE, TRUE, FALSE, TRUE, 256, MD_FILENAME, NULL); + /* config, tick_len, max_lag, presume_posix_semantics, writer, + * maintain_metadata_file, generate_updater_files, flush_raw_data, md_pages_reserved, + * md_file_path, md_file_name, updater_file_path */ + init_vfd_swmr_config(config_writer, 1, 3, FALSE, TRUE, TRUE, FALSE, TRUE, 256, NULL, MD_FILENAME, NULL); /* use_latest_format, use_vfd_swmr, only_meta_page, page_buf_size, config */ fapl_writer = vfd_swmr_create_fapl(FALSE, TRUE, FALSE, FS_PAGE_SIZE, config_writer); @@ -2339,9 +2347,10 @@ test_disable_enable_eot_concur(void) * Set up the VFD SWMR configuration as reader + page buffering */ - /* config, tick_len, max_lag, writer, maintain_metadata_file, generate_updater_files, - flush_raw_data, md_pages_reserved, md_file_path, updater_file_path */ - init_vfd_swmr_config(config_reader, 1, 3, FALSE, TRUE, FALSE, TRUE, 256, MD_FILENAME, NULL); + /* config, tick_len, max_lag, presume_posix_semantics, writer, + * maintain_metadata_file, generate_updater_files, flush_raw_data, md_pages_reserved, + * md_file_path, md_file_name, updater_file_path */ + init_vfd_swmr_config(config_reader, 1, 3, FALSE, FALSE, TRUE, FALSE, TRUE, 256, NULL, MD_FILENAME, NULL); /* use_latest_format, use_vfd_swmr, only_meta_page, page_buf_size, config */ fapl_reader = vfd_swmr_create_fapl(FALSE, TRUE, FALSE, FS_PAGE_SIZE, config_reader); @@ -2549,9 +2558,10 @@ test_file_end_tick_concur(void) * Set up the VFD SWMR configuration + page buffering */ - /* config, tick_len, max_lag, writer, maintain_metadata_file, generate_updater_files, - flush_raw_data, md_pages_reserved, md_file_path, updater_file_path */ - init_vfd_swmr_config(config_writer, 1, 3, TRUE, TRUE, FALSE, TRUE, 256, MD_FILENAME, NULL); + /* config, tick_len, max_lag, presume_posix_semantics, writer, + * maintain_metadata_file, generate_updater_files, flush_raw_data, md_pages_reserved, + * md_file_path, md_file_name, updater_file_path */ + init_vfd_swmr_config(config_writer, 1, 3, FALSE, TRUE, TRUE, FALSE, TRUE, 256, NULL, MD_FILENAME, NULL); /* use_latest_format, use_vfd_swmr, only_meta_page, page_buf_size, config */ fapl_writer = vfd_swmr_create_fapl(FALSE, TRUE, FALSE, FS_PAGE_SIZE, config_writer); @@ -2625,9 +2635,10 @@ test_file_end_tick_concur(void) if ((config_reader = HDmalloc(sizeof(*config_reader))) == NULL) HDexit(EXIT_FAILURE); - /* config, tick_len, max_lag, writer, maintain_metadata_file, generate_updater_files, - flush_raw_data, md_pages_reserved, md_file_path, updater_file_path */ - init_vfd_swmr_config(config_reader, 1, 3, FALSE, TRUE, FALSE, TRUE, 256, MD_FILENAME, NULL); + /* config, tick_len, max_lag, presume_posix_semantics, writer, + * maintain_metadata_file, generate_updater_files, flush_raw_data, md_pages_reserved, + * md_file_path, md_file_name, updater_file_path */ + init_vfd_swmr_config(config_reader, 1, 3, FALSE, FALSE, TRUE, FALSE, TRUE, 256, NULL, MD_FILENAME, NULL); /* use_latest_format, use_vfd_swmr, only_meta_page, page_buf_size, config */ fapl_reader = vfd_swmr_create_fapl(FALSE, TRUE, FALSE, FS_PAGE_SIZE, config_reader); @@ -2822,18 +2833,20 @@ test_multiple_file_opens(void) * Configured as VFD SWMR writer + page buffering */ - /* config, tick_len, max_lag, writer, maintain_metadata_file, generate_updater_files, - flush_raw_data, md_pages_reserved, md_file_path, updater_file_path */ - init_vfd_swmr_config(config1, 4, 6, TRUE, TRUE, FALSE, TRUE, 2, MD_FILENAME, NULL); + /* config, tick_len, max_lag, presume_posix_semantics, writer, + * maintain_metadata_file, generate_updater_files, flush_raw_data, md_pages_reserved, + * md_file_path, md_file_name, updater_file_path */ + init_vfd_swmr_config(config1, 4, 6, FALSE, TRUE, TRUE, FALSE, TRUE, 2, NULL, MD_FILENAME, NULL); /* use_latest_format, use_vfd_swmr, only_meta_page, page_buf_size, config */ fapl1 = vfd_swmr_create_fapl(FALSE, TRUE, FALSE, 4096, config1); if (fapl1 == H5I_INVALID_HID) FAIL_STACK_ERROR; - /* config, tick_len, max_lag, writer, maintain_metadata_file, generate_updater_files, - flush_raw_data, md_pages_reserved, md_file_path, updater_file_path */ - init_vfd_swmr_config(config2, 4, 6, TRUE, TRUE, FALSE, TRUE, 2, MD_FILENAME2, NULL); + /* config, tick_len, max_lag, presume_posix_semantics, writer, + * maintain_metadata_file, generate_updater_files, flush_raw_data, md_pages_reserved, + * md_file_path, md_file_name, updater_file_path */ + init_vfd_swmr_config(config2, 4, 6, FALSE, TRUE, TRUE, FALSE, TRUE, 2, NULL, MD_FILENAME2, NULL); /* use_latest_format, use_vfd_swmr, only_meta_page, page_buf_size, config */ fapl2 = vfd_swmr_create_fapl(FALSE, TRUE, FALSE, 4096, config2); @@ -3033,9 +3046,10 @@ test_same_file_opens(void) * Set the VFD SWMR configuration in fapl1 + page buffering */ - /* config, tick_len, max_lag, writer, maintain_metadata_file, generate_updater_files, - flush_raw_data, md_pages_reserved, md_file_path, updater_file_path */ - init_vfd_swmr_config(config1, 4, 10, TRUE, TRUE, FALSE, TRUE, 2, MD_FILENAME, NULL); + /* config, tick_len, max_lag, presume_posix_semantics, writer, + * maintain_metadata_file, generate_updater_files, flush_raw_data, md_pages_reserved, + * md_file_path, md_file_name, updater_file_path */ + init_vfd_swmr_config(config1, 4, 10, FALSE, TRUE, TRUE, FALSE, TRUE, 2, NULL, MD_FILENAME, NULL); /* use_latest_format, use_vfd_swmr, only_meta_page, page_buf_size, config */ fapl1 = vfd_swmr_create_fapl(FALSE, TRUE, FALSE, 4096, config1); @@ -3061,9 +3075,10 @@ test_same_file_opens(void) * Set the VFD SWMR configuration in fapl2 + page buffering */ - /* config, tick_len, max_lag, writer, maintain_metadata_file, generate_updater_files, - flush_raw_data, md_pages_reserved, md_file_path, updater_file_path */ - init_vfd_swmr_config(config2, 3, 8, FALSE, TRUE, FALSE, TRUE, 3, MD_FILENAME, NULL); + /* config, tick_len, max_lag, presume_posix_semantics, writer, + * maintain_metadata_file, generate_updater_files, flush_raw_data, md_pages_reserved, + * md_file_path, md_file_name, updater_file_path */ + init_vfd_swmr_config(config2, 3, 8, FALSE, FALSE, TRUE, FALSE, TRUE, 3, NULL, MD_FILENAME, NULL); /* use_latest_format, use_vfd_swmr, only_meta_page, page_buf_size, config */ fapl2 = vfd_swmr_create_fapl(FALSE, TRUE, FALSE, 4096, config2); @@ -3116,9 +3131,10 @@ test_same_file_opens(void) * Set up as VFD SWMR reader + page buffering */ - /* config, tick_len, max_lag, writer, maintain_metadata_file, generate_updater_files, - flush_raw_data, md_pages_reserved, md_file_path, updater_file_path */ - init_vfd_swmr_config(config1, 4, 10, FALSE, TRUE, FALSE, TRUE, 2, MD_FILENAME, NULL); + /* config, tick_len, max_lag, presume_posix_semantics, writer, + * maintain_metadata_file, generate_updater_files, flush_raw_data, md_pages_reserved, + * md_file_path, md_file_name, updater_file_path */ + init_vfd_swmr_config(config1, 4, 10, FALSE, FALSE, TRUE, FALSE, TRUE, 2, NULL, MD_FILENAME, NULL); /* use_latest_format, use_vfd_swmr, only_meta_page, page_buf_size, config */ fapl1 = vfd_swmr_create_fapl(FALSE, TRUE, FALSE, 4096, config1); @@ -3153,9 +3169,10 @@ test_same_file_opens(void) * Set up as VFD SWMR writer + page buffering */ - /* config, tick_len, max_lag, writer, maintain_metadata_file, generate_updater_files, - flush_raw_data, md_pages_reserved, md_file_path, updater_file_path */ - init_vfd_swmr_config(config1, 4, 10, TRUE, TRUE, FALSE, TRUE, 2, MD_FILENAME, NULL); + /* config, tick_len, max_lag, presume_posix_semantics, writer, + * maintain_metadata_file, generate_updater_files, flush_raw_data, md_pages_reserved, + * md_file_path, md_file_name, updater_file_path */ + init_vfd_swmr_config(config1, 4, 10, FALSE, TRUE, TRUE, FALSE, TRUE, 2, NULL, MD_FILENAME, NULL); /* use_latest_format, use_vfd_swmr, only_meta_page, page_buf_size, config */ fapl1 = vfd_swmr_create_fapl(FALSE, TRUE, FALSE, 4096, config1); @@ -3209,9 +3226,10 @@ test_same_file_opens(void) * Set up as VFD SWMR writer + page buffering */ - /* config, tick_len, max_lag, writer, maintain_metadata_file, generate_updater_files, - flush_raw_data, md_pages_reserved, md_file_path, updater_file_path */ - init_vfd_swmr_config(config1, 4, 10, TRUE, TRUE, FALSE, TRUE, 2, MD_FILENAME, NULL); + /* config, tick_len, max_lag, presume_posix_semantics, writer, + * maintain_metadata_file, generate_updater_files, flush_raw_data, md_pages_reserved, + * md_file_path, md_file_name, updater_file_path */ + init_vfd_swmr_config(config1, 4, 10, FALSE, TRUE, TRUE, FALSE, TRUE, 2, NULL, MD_FILENAME, NULL); /* use_latest_format, use_vfd_swmr, only_meta_page, page_buf_size, config */ fapl1 = vfd_swmr_create_fapl(FALSE, TRUE, FALSE, 4096, config1); @@ -3418,9 +3436,10 @@ test_enable_disable_eot(void) * Configured first file as VFD SWMR writer + page buffering */ - /* config, tick_len, max_lag, writer, maintain_metadata_file, generate_updater_files, - flush_raw_data, md_pages_reserved, md_file_path, updater_file_path */ - init_vfd_swmr_config(config1, 4, 6, TRUE, TRUE, FALSE, TRUE, 2, MD_FILENAME, NULL); + /* config, tick_len, max_lag, presume_posix_semantics, writer, + * maintain_metadata_file, generate_updater_files, flush_raw_data, md_pages_reserved, + * md_file_path, md_file_name, updater_file_path */ + init_vfd_swmr_config(config1, 4, 6, FALSE, TRUE, TRUE, FALSE, TRUE, 2, NULL, MD_FILENAME, NULL); /* use_latest_format, use_vfd_swmr, only_meta_page, page_buf_size, config */ fapl1 = vfd_swmr_create_fapl(FALSE, TRUE, FALSE, 4096, config1); @@ -3432,9 +3451,10 @@ test_enable_disable_eot(void) * Configured second file as VFD SWMR writer + page buffering */ - /* config, tick_len, max_lag, writer, maintain_metadata_file, generate_updater_files, - flush_raw_data, md_pages_reserved, md_file_path, updater_file_path */ - init_vfd_swmr_config(config2, 4, 6, TRUE, TRUE, FALSE, TRUE, 2, MD_FILENAME2, NULL); + /* config, tick_len, max_lag, presume_posix_semantics, writer, + * maintain_metadata_file, generate_updater_files, flush_raw_data, md_pages_reserved, + * md_file_path, md_file_name, updater_file_path */ + init_vfd_swmr_config(config2, 4, 6, FALSE, TRUE, TRUE, FALSE, TRUE, 2, NULL, MD_FILENAME2, NULL); /* use_latest_format, use_vfd_swmr, only_meta_page, page_buf_size, config */ fapl2 = vfd_swmr_create_fapl(FALSE, TRUE, FALSE, 4096, config2); @@ -3446,9 +3466,10 @@ test_enable_disable_eot(void) * Configured third file as VFD SWMR writer + page buffering */ - /* config, tick_len, max_lag, writer, maintain_metadata_file, generate_updater_files, - flush_raw_data, md_pages_reserved, md_file_path, updater_file_path */ - init_vfd_swmr_config(config3, 4, 6, TRUE, TRUE, FALSE, TRUE, 2, MD_FILENAME3, NULL); + /* config, tick_len, max_lag, presume_posix_semantics, writer, + * maintain_metadata_file, generate_updater_files, flush_raw_data, md_pages_reserved, + * md_file_path, md_file_name, updater_file_path */ + init_vfd_swmr_config(config3, 4, 6, FALSE, TRUE, TRUE, FALSE, TRUE, 2, NULL, MD_FILENAME3, NULL); /* use_latest_format, use_vfd_swmr, only_meta_page, page_buf_size, config */ fapl3 = vfd_swmr_create_fapl(FALSE, TRUE, FALSE, 4096, config3); @@ -3700,6 +3721,7 @@ error: static unsigned test_updater_flags(void) { + char filename[FILE_NAME_LEN]; /* Filename to use */ hid_t fid = H5I_INVALID_HID; /* File ID */ hid_t fcpl = H5I_INVALID_HID; /* File creation property list ID */ hid_t fapl = H5I_INVALID_HID; /* File access property list ID */ @@ -3731,9 +3753,10 @@ test_updater_flags(void) * Configured as VFD SWMR writer + page buffering + generate updater files */ - /* config, tick_len, max_lag, writer, maintain_metadata_file, generate_updater_files, - flush_raw_data, md_pages_reserved, md_file_path, updater_file_path */ - init_vfd_swmr_config(config, 4, 7, TRUE, TRUE, TRUE, TRUE, 2, MD_FILENAME, UD_FILENAME); + /* config, tick_len, max_lag, presume_posix_semantics, writer, + * maintain_metadata_file, generate_updater_files, flush_raw_data, md_pages_reserved, + * md_file_path, md_file_name, updater_file_path */ + init_vfd_swmr_config(config, 4, 7, FALSE, TRUE, TRUE, TRUE, TRUE, 2, NULL, MD_FILENAME, UD_FILENAME); /* use_latest_format, use_vfd_swmr, only_meta_page, page_buf_size, config */ fapl = vfd_swmr_create_fapl(FALSE, TRUE, FALSE, 4096, config); @@ -3741,12 +3764,16 @@ test_updater_flags(void) if (fapl == H5I_INVALID_HID) TEST_ERROR; + /* FILENAME */ + h5_fixname("vfd_swmr_file", fapl, filename, sizeof(filename)); + if ((fcpl = vfd_swmr_create_fcpl(H5F_FSPACE_STRATEGY_PAGE, 4096)) < 0) { HDprintf("vfd_swmr_create_fcpl() failed"); FAIL_STACK_ERROR; } - if ((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl)) < 0) + + if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0) TEST_ERROR; /* Get the file's file access property list */ @@ -3769,7 +3796,7 @@ test_updater_flags(void) TEST_ERROR; /* Check updater file size */ - if (HDstat(namebuf, &sb) == 0 && sb.st_size != H5F_UD_HEADER_SIZE) + if (HDstat(namebuf, &sb) == 0 && sb.st_size < H5F_UD_HEADER_SIZE) TEST_ERROR; /* Closing */ @@ -3880,9 +3907,10 @@ test_updater_flags_same_file_opens(void) * Set the VFD SWMR configuration in fapl1 + page buffering */ - /* config, tick_len, max_lag, writer, maintain_metadata_file, generate_updater_files, - flush_raw_data, md_pages_reserved, md_file_path, updater_file_path */ - init_vfd_swmr_config(config1, 4, 10, TRUE, TRUE, TRUE, TRUE, 2, MD_FILENAME, UD_FILENAME); + /* config, tick_len, max_lag, presume_posix_semantics, writer, + * maintain_metadata_file, generate_updater_files, flush_raw_data, md_pages_reserved, + * md_file_path, md_file_name, updater_file_path */ + init_vfd_swmr_config(config1, 4, 10, FALSE, TRUE, TRUE, TRUE, TRUE, 2, NULL, MD_FILENAME, UD_FILENAME); /* use_latest_format, use_vfd_swmr, only_meta_page, page_buf_size, config */ fapl1 = vfd_swmr_create_fapl(FALSE, TRUE, FALSE, 4096, config1); @@ -4253,6 +4281,8 @@ test_updater_generate_md_checksums(hbool_t file_create) hid_t fapl = H5I_INVALID_HID; /* File access property list ID */ H5F_vfd_swmr_config_t config; /* Configuration for VFD SWMR */ H5F_generate_md_ck_cb_t cb_info; /* Callback */ + H5F_t * f = NULL; /* Internal file object pointer */ + char *md_file_path_name; if (file_create) { TESTING("VFD SWMR updater generate checksums for metadata file with H5Fcreate"); @@ -4261,9 +4291,10 @@ test_updater_generate_md_checksums(hbool_t file_create) TESTING("VFD SWMR updater generate checksums for metadata file with H5Fopen"); } - /* config, tick_len, max_lag, writer, maintain_metadata_file, generate_updater_files, - * flush_raw_data, md_pages_reserved, md_file_path, updater_file_path */ - init_vfd_swmr_config(&config, 4, 7, TRUE, TRUE, TRUE, TRUE, 2, MD_FILE, UD_FILE); + /* config, tick_len, max_lag, presume_posix_semantics, writer, + * maintain_metadata_file, generate_updater_files, flush_raw_data, md_pages_reserved, + * md_file_path, md_file_name, updater_file_path */ + init_vfd_swmr_config(&config, 4, 7, FALSE, TRUE, TRUE, TRUE, TRUE, 2, NULL, MD_FILE, UD_FILE); /* use_latest_format, use_vfd_swmr, only_meta_page, page_buf_size, config */ fapl = vfd_swmr_create_fapl(TRUE, TRUE, FALSE, 4096, &config); @@ -4298,6 +4329,14 @@ test_updater_generate_md_checksums(hbool_t file_create) FAIL_STACK_ERROR; } + /* Get a pointer to the internal file object */ + if (NULL == (f = (H5F_t *)H5VL_object(fid))) + TEST_ERROR + + /* Get the full metadata file pathname */ + md_file_path_name = HDstrdup(f->shared->md_file_path_name); + + /* Close the file */ if (H5Fclose(fid) < 0) FAIL_STACK_ERROR; @@ -4308,11 +4347,11 @@ test_updater_generate_md_checksums(hbool_t file_create) FAIL_STACK_ERROR; /* Verify contents of checksum file and updater files */ - if (verify_ud_chk(config.md_file_path, config.updater_file_path) < 0) + if (verify_ud_chk(md_file_path_name, config.updater_file_path) < 0) TEST_ERROR; /* It's important to clean up the checksum and updater files. */ - clean_chk_ud_files(config.md_file_path, config.updater_file_path); + clean_chk_ud_files(md_file_path_name, config.updater_file_path); PASSED(); @@ -4328,7 +4367,7 @@ error: H5E_END_TRY; /* It's important to clean up the chechsum and updater files. */ - clean_chk_ud_files(config.md_file_path, config.updater_file_path); + clean_chk_ud_files(md_file_path_name, config.updater_file_path); return 1; diff --git a/test/vfd_swmr_addrem_writer.c b/test/vfd_swmr_addrem_writer.c index 0cd1713..ea395f6 100644 --- a/test/vfd_swmr_addrem_writer.c +++ b/test/vfd_swmr_addrem_writer.c @@ -94,9 +94,10 @@ open_skeleton(const char *filename, unsigned verbose) if ((config = HDcalloc(1, sizeof(*config))) == NULL) goto error; - /* config, tick_len, max_lag, writer, maintain_metadata_file, generate_updater_files, - * flush_raw_data, md_pages_reserved, md_file_path, updater_file_path */ - init_vfd_swmr_config(config, 4, 5, TRUE, TRUE, FALSE, TRUE, 128, "rw-shadow", NULL); + /* config, tick_len, max_lag, presume_posix_semantics, writer, + * maintain_metadata_file, generate_updater_files, flush_raw_data, md_pages_reserved, + * md_file_path, md_file_name, updater_file_path */ + init_vfd_swmr_config(config, 4, 5, FALSE, TRUE, TRUE, FALSE, TRUE, 128, NULL, "rw-shadow", NULL); /* use_latest_format, use_vfd_swmr, only_meta_page, page_buf_size, config */ if ((fapl = vfd_swmr_create_fapl(TRUE, TRUE, FALSE, 4096, config)) < 0) diff --git a/test/vfd_swmr_attrdset_writer.c b/test/vfd_swmr_attrdset_writer.c index 37c4c72..4b3dbc0 100644 --- a/test/vfd_swmr_attrdset_writer.c +++ b/test/vfd_swmr_attrdset_writer.c @@ -130,40 +130,40 @@ typedef struct { .fd_reader_to_writer = -1, .notify = 0, .verify = 0 \ } -static herr_t state_init(state_t *s, int argc, const char *const *argv); +static hbool_t state_init(state_t *s, int argc, const char *const *argv); -static herr_t np_init(np_state_t *np, hbool_t writer); -static herr_t np_close(np_state_t *np, hbool_t writer); -static herr_t np_writer(hbool_t result, unsigned step, const state_t *s, np_state_t *np, +static hbool_t np_init(np_state_t *np, hbool_t writer); +static hbool_t np_close(np_state_t *np, hbool_t writer); +static hbool_t np_writer(hbool_t result, unsigned step, const state_t *s, np_state_t *np, H5F_vfd_swmr_config_t *config); -static herr_t np_reader(hbool_t result, unsigned step, const state_t *s, np_state_t *np); -static herr_t np_confirm_verify_notify(int fd, unsigned step, const state_t *s, np_state_t *np); -static herr_t np_reader_no_verification(const state_t *s, np_state_t *np, H5F_vfd_swmr_config_t *config); +static hbool_t np_reader(hbool_t result, unsigned step, const state_t *s, np_state_t *np); +static hbool_t np_confirm_verify_notify(int fd, unsigned step, const state_t *s, np_state_t *np); +static hbool_t np_reader_no_verification(const state_t *s, np_state_t *np, H5F_vfd_swmr_config_t *config); -static herr_t create_dsets(const state_t *s, dsets_state_t *ds); -static herr_t open_dsets(const state_t *s, dsets_state_t *ds); -static herr_t open_dset_real(hid_t fid, hid_t *did, const char *name, unsigned *max_compact, +static hbool_t create_dsets(const state_t *s, dsets_state_t *ds); +static hbool_t open_dsets(const state_t *s, dsets_state_t *ds); +static hbool_t open_dset_real(hid_t fid, hid_t *did, const char *name, unsigned *max_compact, unsigned *min_dense); -static herr_t close_dsets(const dsets_state_t *ds); +static hbool_t close_dsets(const dsets_state_t *ds); -static herr_t perform_dsets_operations(state_t *s, dsets_state_t *ds, H5F_vfd_swmr_config_t *config, +static hbool_t perform_dsets_operations(state_t *s, dsets_state_t *ds, H5F_vfd_swmr_config_t *config, np_state_t *np); -static herr_t attr_dsets_action(unsigned action, const state_t *s, const dsets_state_t *ds, unsigned which); -static herr_t attr_action(unsigned action, const state_t *s, hid_t did, unsigned which); -static herr_t add_attr(const state_t *s, hid_t did, unsigned int which); -static herr_t modify_attr(const state_t *s, hid_t did, unsigned int which); -static herr_t delete_attr(hid_t did, unsigned int which); +static hbool_t attr_dsets_action(unsigned action, const state_t *s, const dsets_state_t *ds, unsigned which); +static hbool_t attr_action(unsigned action, const state_t *s, hid_t did, unsigned which); +static hbool_t add_attr(const state_t *s, hid_t did, unsigned int which); +static hbool_t modify_attr(const state_t *s, hid_t did, unsigned int which); +static hbool_t delete_attr(hid_t did, unsigned int which); -static herr_t verify_dsets_operations(state_t *s, dsets_state_t *ds, H5F_vfd_swmr_config_t *config, +static hbool_t verify_dsets_operations(state_t *s, dsets_state_t *ds, H5F_vfd_swmr_config_t *config, np_state_t *np); -static herr_t verify_attr_dsets_action(unsigned action, const state_t *s, const dsets_state_t *ds, +static hbool_t verify_attr_dsets_action(unsigned action, const state_t *s, const dsets_state_t *ds, unsigned which); -static herr_t verify_attr_action(unsigned action, hid_t did, unsigned which); -static herr_t verify_add_or_modify_attr(unsigned action, hid_t did, char *attr_name, unsigned int which); -static herr_t verify_delete_attr(hid_t did, char *attr_name); -static herr_t verify_storage_cont(unsigned action, hid_t did, unsigned int which, unsigned max_compact, +static hbool_t verify_attr_action(unsigned action, hid_t did, unsigned which); +static hbool_t verify_add_or_modify_attr(unsigned action, hid_t did, char *attr_name, unsigned int which); +static hbool_t verify_delete_attr(hid_t did, char *attr_name); +static hbool_t verify_storage_cont(unsigned action, hid_t did, unsigned int which, unsigned max_compact, unsigned min_dense, unsigned asteps); -static herr_t verify_storage_cont_real(hid_t did, unsigned int which, unsigned cut_point); +static hbool_t verify_storage_cont_real(hid_t did, unsigned int which, unsigned cut_point); /* Names for datasets */ #define DSET_COMPACT_NAME "compact_dset" @@ -215,7 +215,7 @@ usage(const char *progname) /* * Initialize option info in state_t */ -static herr_t +static hbool_t state_init(state_t *s, int argc, const char *const *argv) { unsigned long tmp; @@ -347,20 +347,20 @@ state_init(state_t *s, int argc, const char *const *argv) /* The test file name */ esnprintf(s->filename, sizeof(s->filename), "vfd_swmr_attrdset.h5"); - return SUCCEED; + return true; error: if (tfile) HDfree(tfile); - return FAIL; + return false; } /* state_init() */ /* * Create the datasets as specified on the command line. */ -static herr_t +static hbool_t create_dsets(const state_t *s, dsets_state_t *ds) { hid_t dcpl = H5I_INVALID_HID; @@ -719,7 +719,7 @@ create_dsets(const state_t *s, dsets_state_t *ds) } } - return SUCCEED; + return true; error: H5E_BEGIN_TRY @@ -741,14 +741,14 @@ error: } H5E_END_TRY; - return FAIL; + return false; } /* create_dsets() */ /* * Open the datasets as specified. */ -static herr_t +static hbool_t open_dsets(const state_t *s, dsets_state_t *ds) { *ds = DSETS_INITIALIZER; @@ -796,10 +796,10 @@ open_dsets(const state_t *s, dsets_state_t *ds) } } - return SUCCEED; + return true; error: - return FAIL; + return false; } /* open_dsets() */ @@ -807,7 +807,7 @@ error: * Do the real work of opening the dataset. * Retrieve the max_compact and min_dense values for the dataset. */ -static herr_t +static hbool_t open_dset_real(hid_t fid, hid_t *did, const char *name, unsigned *max_compact, unsigned *min_dense) { hid_t dcpl = H5I_INVALID_HID; @@ -832,7 +832,7 @@ open_dset_real(hid_t fid, hid_t *did, const char *name, unsigned *max_compact, u TEST_ERROR; } - return SUCCEED; + return true; error: H5E_BEGIN_TRY @@ -842,13 +842,13 @@ error: } H5E_END_TRY; - return FAIL; + return false; } /* open_dset_real() */ /* * Close all the datasets as specified. */ -static herr_t +static hbool_t close_dsets(const dsets_state_t *ds) { if (ds->compact_did != H5I_INVALID_HID && H5Dclose(ds->compact_did) < 0) { @@ -886,7 +886,7 @@ close_dsets(const dsets_state_t *ds) TEST_ERROR; } - return SUCCEED; + return true; error: H5E_BEGIN_TRY @@ -901,7 +901,7 @@ error: } H5E_END_TRY; - return FAIL; + return false; } /* close_dsets() */ /* @@ -914,7 +914,7 @@ error: * MODIFY_ATTR : -m option * DELETE_ATTR : -d option */ -static herr_t +static hbool_t perform_dsets_operations(state_t *s, dsets_state_t *ds, H5F_vfd_swmr_config_t *config, np_state_t *np) { unsigned step; @@ -974,10 +974,10 @@ perform_dsets_operations(state_t *s, dsets_state_t *ds, H5F_vfd_swmr_config_t *c } } - return SUCCEED; + return true; error: - return FAIL; + return false; } /* perform_dsets_operations() */ @@ -987,7 +987,7 @@ error: * -g: contiguous dataset * -k: 5 chunked datasets with 5 indexing types */ -static herr_t +static hbool_t attr_dsets_action(unsigned action, const state_t *s, const dsets_state_t *ds, unsigned which) { int nerrors = 0; @@ -1035,7 +1035,7 @@ attr_dsets_action(unsigned action, const state_t *s, const dsets_state_t *ds, un } if (nerrors) - ret = FALSE; + ret = false; return (ret); @@ -1047,7 +1047,7 @@ attr_dsets_action(unsigned action, const state_t *s, const dsets_state_t *ds, un * MODIFY_ATTR : modify `which` attribute * DELETE_ATTR : delete `which` attribute */ -static herr_t +static hbool_t attr_action(unsigned action, const state_t *s, hid_t did, unsigned which) { hbool_t ret; @@ -1080,7 +1080,7 @@ attr_action(unsigned action, const state_t *s, hid_t did, unsigned which) * H5T_NATIVE_UINT32 (-b) or * H5T_NATIVE_UINT32 (default) */ -static herr_t +static hbool_t add_attr(const state_t *s, hid_t did, unsigned int which) { hid_t aid = H5I_INVALID_HID; @@ -1140,7 +1140,7 @@ add_attr(const state_t *s, hid_t did, unsigned int which) if (val) HDfree(val); - return SUCCEED; + return true; error: H5E_BEGIN_TRY @@ -1153,14 +1153,14 @@ error: if (val) HDfree(val); - return FAIL; + return false; } /* add_attr() */ /* * Modify the attribute data. */ -static herr_t +static hbool_t modify_attr(const state_t *s, hid_t did, unsigned int which) { hid_t aid = H5I_INVALID_HID; @@ -1224,7 +1224,7 @@ modify_attr(const state_t *s, hid_t did, unsigned int which) if (val) HDfree(val); - return SUCCEED; + return true; error: H5E_BEGIN_TRY { @@ -1236,13 +1236,13 @@ error: if (val) HDfree(val); - return FAIL; + return false; } /* modify_attr() */ /* * Delete the attribute */ -static herr_t +static hbool_t delete_attr(hid_t did, unsigned int which) { char name[sizeof("attr-9999999999")]; @@ -1255,10 +1255,10 @@ delete_attr(hid_t did, unsigned int which) TEST_ERROR; } - return SUCCEED; + return true; error: - return FAIL; + return false; } /* delete_attr() */ @@ -1276,7 +1276,7 @@ error: * --[-c ] is 1 * --not applicable for -m option */ -static herr_t +static hbool_t verify_dsets_operations(state_t *s, dsets_state_t *ds, H5F_vfd_swmr_config_t *config, np_state_t *np) { unsigned step; @@ -1360,11 +1360,11 @@ verify_dsets_operations(state_t *s, dsets_state_t *ds, H5F_vfd_swmr_config_t *co } } - return SUCCEED; + return true; error: - return FAIL; + return false; } /* verify_dsets_operations() */ /* @@ -1373,7 +1373,7 @@ error: * -g: contiguous dataset * -k: 5 chunked datasets with 5 indexing types */ -static herr_t +static hbool_t verify_attr_dsets_action(unsigned action, const state_t *s, const dsets_state_t *ds, unsigned which) { int nerrors = 0; @@ -1465,7 +1465,7 @@ verify_attr_dsets_action(unsigned action, const state_t *s, const dsets_state_t /* * Verify the attribute action on the specified dataset. */ -static herr_t +static hbool_t verify_attr_action(unsigned action, hid_t did, unsigned which) { char name[sizeof("attr-9999999999")]; @@ -1496,7 +1496,7 @@ verify_attr_action(unsigned action, hid_t did, unsigned which) /* * Verify the attribute is added or modified */ -static herr_t +static hbool_t verify_add_or_modify_attr(unsigned action, hid_t did, char *attr_name, unsigned int which) { unsigned int read_which; @@ -1575,14 +1575,14 @@ error: if (is_vl) H5free_memory(read_vl_which); - return FAIL; + return false; } /* verify_add_or_modify_attr() */ /* * Verify the attribute does not exist. */ -static herr_t +static hbool_t verify_delete_attr(hid_t did, char *attr_name) { int ret; @@ -1592,14 +1592,14 @@ verify_delete_attr(hid_t did, char *attr_name) TEST_ERROR; } else if (!ret) /* attribute does not exist */ - ret = TRUE; + ret = true; else /* attribute exist */ - ret = FALSE; + ret = false; return ret; error: - return FAIL; + return false; } /* verify_delete_attr() */ @@ -1617,11 +1617,11 @@ error: * --`which` is at min_dense: dense storage, no continuation block * --`which` is at (min_dense - 1): compact storage, continuation block exists */ -static herr_t +static hbool_t verify_storage_cont(unsigned action, hid_t did, unsigned int which, unsigned max_compact, unsigned min_dense, unsigned asteps) { - hbool_t ret = TRUE; + hbool_t ret = true; HDassert(action == ADD_ATTR || action == DELETE_ATTR); @@ -1660,7 +1660,7 @@ verify_storage_cont(unsigned action, hid_t did, unsigned int which, unsigned max /* * Verify the storage condition at the specific checkpoint */ -static herr_t +static hbool_t verify_storage_cont_real(hid_t did, unsigned int which, unsigned cut_point) { H5O_native_info_t ninfo; @@ -1687,7 +1687,7 @@ verify_storage_cont_real(hid_t did, unsigned int which, unsigned cut_point) } error: - return FAIL; + return false; } /* verify_storage_cont_real() */ @@ -1698,7 +1698,7 @@ error: /* * Initialize the named pipes for test synchronization. */ -static herr_t +static hbool_t np_init(np_state_t *np, hbool_t writer) { *np = NP_INITIALIZER; @@ -1746,17 +1746,17 @@ np_init(np_state_t *np, hbool_t writer) TEST_ERROR; } - return SUCCEED; + return true; error: - return FAIL; + return false; } /* np_init() */ /* * Close the named pipes. */ -static herr_t +static hbool_t np_close(np_state_t *np, hbool_t writer) { /* Both the writer and reader close the named pipes */ @@ -1782,16 +1782,16 @@ np_close(np_state_t *np, hbool_t writer) TEST_ERROR; } } - return SUCCEED; + return true; error: - return FAIL; + return false; } /* np_close() */ /* * Writer synchronization depending on the result from the attribute action performed. */ -static herr_t +static hbool_t np_writer(hbool_t result, unsigned step, const state_t *s, np_state_t *np, H5F_vfd_swmr_config_t *config) { unsigned int i; @@ -1841,10 +1841,10 @@ np_writer(hbool_t result, unsigned step, const state_t *s, np_state_t *np, H5F_v } } } - return SUCCEED; + return true; error: - return FAIL; + return false; } /* np_writer() */ @@ -1852,7 +1852,7 @@ error: * * Reader synchronization depending on the result from the verification. */ -static herr_t +static hbool_t np_reader(hbool_t result, unsigned step, const state_t *s, np_state_t *np) { /* The verification fails */ @@ -1882,10 +1882,10 @@ np_reader(hbool_t result, unsigned step, const state_t *s, np_state_t *np) } } } - return SUCCEED; + return true; error: - return FAIL; + return false; } /* np_reader() */ @@ -1893,7 +1893,7 @@ error: * Handshake between writer and reader: * Confirm `verify` is same as `notify`. */ -static herr_t +static hbool_t np_confirm_verify_notify(int fd, unsigned step, const state_t *s, np_state_t *np) { if (step % s->csteps == 0) { @@ -1914,17 +1914,17 @@ np_confirm_verify_notify(int fd, unsigned step, const state_t *s, np_state_t *np } } - return SUCCEED; + return true; error: - return FAIL; + return false; } /* confirm_verify_notify() */ /* * Synchronization done by the reader before moving onto the * next verification phase. */ -static herr_t +static hbool_t np_reader_no_verification(const state_t *s, np_state_t *np, H5F_vfd_swmr_config_t *config) { if (s->use_np) { @@ -1946,10 +1946,10 @@ np_reader_no_verification(const state_t *s, np_state_t *np, H5F_vfd_swmr_config_ } } - return SUCCEED; + return true; error: - return FAIL; + return false; } /* np_reader_no_verification() */ @@ -1981,10 +1981,10 @@ main(int argc, char **argv) TEST_ERROR; } - /* config, tick_len, max_lag, writer, maintain_metadata_file, generate_updater_files, - * flush_raw_data, md_pages_reserved, md_file_path, updater_file_path - */ - init_vfd_swmr_config(&config, 4, 7, writer, TRUE, FALSE, TRUE, 128, "./attrdset-shadow", NULL); + /* config, tick_len, max_lag, presume_posix_semantics, writer, + * maintain_metadata_file, generate_updater_files, flush_raw_data, md_pages_reserved, + * md_file_path, md_file_name, updater_file_path */ + init_vfd_swmr_config(&config, 4, 7, FALSE, writer, TRUE, FALSE, TRUE, 128, "./", "attrdset-shadow", NULL); /* use_latest_format, use_vfd_swmr, only_meta_page, page_buf_size, config */ if ((fapl = vfd_swmr_create_fapl(TRUE, s.use_vfd_swmr, TRUE, 4096, &config)) < 0) { diff --git a/test/vfd_swmr_bigset_writer.c b/test/vfd_swmr_bigset_writer.c index 71bd730..b647dd6 100644 --- a/test/vfd_swmr_bigset_writer.c +++ b/test/vfd_swmr_bigset_writer.c @@ -2580,22 +2580,32 @@ main(int argc, char **argv) continue; } - /* config, tick_len, max_lag, writer, maintain_metadata_file, generate_updater_files, - * flush_raw_data, md_pages_reserved, md_file_path, updater_file_path */ + /* config, tick_len, max_lag, presume_posix_semantics, writer, + * maintain_metadata_file, generate_updater_files, flush_raw_data, md_pages_reserved, + * md_file_path, md_file_name, updater_file_path */ + #ifdef H5_HAVE_AUX_PROCESS + /* If using the auxiliary process, the writer creates the updater files. * The reader uses the metadata file generated by the auxiliary process. */ if (s.writer) { - init_vfd_swmr_config(&config, s.tick_len, s.max_lag, s.writer, FALSE, TRUE, s.flush_raw_data, 128, - "./bigset-shadow-%zu", "bigset_updater", i); + init_vfd_swmr_config(&config, s.tick_len, s.max_lag, FALSE, s.writer, FALSE, TRUE, s.flush_raw_data, 128, + "./", "bigset-shadow-%zu", "bigset_updater", i); } else { - init_vfd_swmr_config(&config, s.tick_len, s.max_lag, s.writer, TRUE, FALSE, s.flush_raw_data, 128, - "./mdfile", NULL); + init_vfd_swmr_config(&config, s.tick_len, s.max_lag, FALSE, s.writer, TRUE, FALSE, s.flush_raw_data, 128, + "./", "mdfile", NULL); } #else - init_vfd_swmr_config(&config, s.tick_len, s.max_lag, s.writer, TRUE, FALSE, s.flush_raw_data, 128, - "./bigset-shadow-%zu", NULL, i); + + if(s.vds == vds_multi || s.vds == vds_single) { + init_vfd_swmr_config(&config, s.tick_len, s.max_lag, TRUE, s.writer, TRUE, FALSE, s.flush_raw_data, 128, + "", "", NULL); + } else { + init_vfd_swmr_config(&config, s.tick_len, s.max_lag, FALSE, s.writer, TRUE, FALSE, s.flush_raw_data, 128, + "./", "bigset-shadow-%zu", NULL, i); + } + #endif /* use_latest_format, use_vfd_swmr, only_meta_page, page_buf_size, config */ diff --git a/test/vfd_swmr_common.c b/test/vfd_swmr_common.c index 931b49b..e1d1ccc 100644 --- a/test/vfd_swmr_common.c +++ b/test/vfd_swmr_common.c @@ -326,15 +326,14 @@ await_signal(hid_t fid) #endif /* H5_HAVE_WIN32_API */ -/* Revised support routines that can be used for all VFD SWMR integration tests - * NOTE: For tests that call this common routine, md_file_path needs to be set - * regardless of whether maintain_metadata_file is true or false. +/* + * Revised support routines that can be used for all VFD SWMR integration tests */ void -init_vfd_swmr_config(H5F_vfd_swmr_config_t *config, uint32_t tick_len, uint32_t max_lag, hbool_t writer, - hbool_t maintain_metadata_file, hbool_t generate_updater_files, hbool_t flush_raw_data, - uint32_t md_pages_reserved, const char *md_file_fmtstr, const char *updater_file_path, - ...) +init_vfd_swmr_config(H5F_vfd_swmr_config_t *config, uint32_t tick_len, uint32_t max_lag, + hbool_t presume_posix_semantics, hbool_t writer, hbool_t maintain_metadata_file, + hbool_t generate_updater_files, hbool_t flush_raw_data, uint32_t md_pages_reserved, + const char *md_file_path, const char *md_file_fmtstr, const char *updater_file_path, ...) { va_list ap; @@ -345,17 +344,28 @@ init_vfd_swmr_config(H5F_vfd_swmr_config_t *config, uint32_t tick_len, uint32_t config->tick_len = tick_len; config->max_lag = max_lag; + config->presume_posix_semantics = presume_posix_semantics; config->writer = writer; config->maintain_metadata_file = maintain_metadata_file; config->generate_updater_files = generate_updater_files; config->flush_raw_data = flush_raw_data; config->md_pages_reserved = md_pages_reserved; - HDva_start(ap, updater_file_path); + if(md_file_path == NULL) + config->md_file_path[0] = '\0'; + else + HDstrcpy(config->md_file_path, md_file_path); - evsnprintf(config->md_file_path, sizeof(config->md_file_path), md_file_fmtstr, ap); + if(md_file_fmtstr == NULL) + config->md_file_name[0] = '\0'; - HDva_end(ap); + else { + HDva_start(ap, updater_file_path); + + evsnprintf(config->md_file_name, sizeof(config->md_file_path), md_file_fmtstr, ap); + + HDva_end(ap); + } if (config->generate_updater_files && updater_file_path != NULL) HDstrcpy(config->updater_file_path, updater_file_path); diff --git a/test/vfd_swmr_common.h b/test/vfd_swmr_common.h index 4fd45b4..0453d91 100644 --- a/test/vfd_swmr_common.h +++ b/test/vfd_swmr_common.h @@ -74,10 +74,11 @@ H5TEST_DLL hid_t vfd_swmr_create_fapl(bool use_latest_format, bool use_vfd_swmr, size_t page_buf_size, H5F_vfd_swmr_config_t *config); H5TEST_DLL void init_vfd_swmr_config(H5F_vfd_swmr_config_t *config, uint32_t tick_len, uint32_t max_lag, - hbool_t writer, hbool_t maintain_metadata_file, - hbool_t generate_updater_files, hbool_t flush_raw_data, - uint32_t md_pages_reserved, const char *md_file_fmtstr, - const char *updater_file_path, ...) H5_ATTR_FORMAT(printf, 9, 11); + hbool_t presume_posix_semantics, hbool_t writer, + hbool_t maintain_metadata_file, hbool_t generate_updater_files, + hbool_t flush_raw_data, uint32_t md_pages_reserved, + const char *md_file_path, const char *md_file_fmtstr, + const char *updater_file_path, ...) H5_ATTR_FORMAT(printf, 11, 13); H5TEST_DLL void init_vfd_swmr_log(H5F_vfd_swmr_config_t *config, const char *log_file_fmtstr, ...) H5_ATTR_FORMAT(printf, 2, 3); diff --git a/test/vfd_swmr_dsetchks_writer.c b/test/vfd_swmr_dsetchks_writer.c index caaad1b..0acacce 100644 --- a/test/vfd_swmr_dsetchks_writer.c +++ b/test/vfd_swmr_dsetchks_writer.c @@ -2308,10 +2308,11 @@ main(int argc, char **argv) TEST_ERROR; } - /* config, tick_len, max_lag, writer, maintain_metadata_file, generate_updater_files, - * flush_raw_data, md_pages_reserved, md_file_path, updater_file_path */ - init_vfd_swmr_config(&config, 4, 7, writer, TRUE, FALSE, s.flush_raw_data, 128, "./dsetchks-shadow", - NULL); + /* config, tick_len, max_lag, presume_posix_semantics, writer, + * maintain_metadata_file, generate_updater_files, flush_raw_data, md_pages_reserved, + * md_file_path, md_file_name, updater_file_path */ + init_vfd_swmr_config(&config, 4, 7, FALSE, writer, TRUE, FALSE, s.flush_raw_data, 128, + "./", "dsetchks-shadow", NULL); /* use_latest_format, use_vfd_swmr, only_meta_page, page_buf_size, config */ if ((fapl = vfd_swmr_create_fapl(true, s.use_vfd_swmr, true, 4096, &config)) < 0) { diff --git a/test/vfd_swmr_dsetops_writer.c b/test/vfd_swmr_dsetops_writer.c index 8ef0962..bce1d08 100644 --- a/test/vfd_swmr_dsetops_writer.c +++ b/test/vfd_swmr_dsetops_writer.c @@ -2228,9 +2228,10 @@ main(int argc, char **argv) TEST_ERROR; } - /* config, tick_len, max_lag, writer, maintain_metadata_file, generate_updater_files, - * flush_raw_data, md_pages_reserved, md_file_path, updater_file_path */ - init_vfd_swmr_config(&config, 4, 7, writer, TRUE, FALSE, s.flush_raw_data, 128, "./dsetops-shadow", NULL); + /* config, tick_len, max_lag, presume_posix_semantics, writer, + * maintain_metadata_file, generate_updater_files, flush_raw_data, md_pages_reserved, + * md_file_path, md_file_name, updater_file_path */ + init_vfd_swmr_config(&config, 4, 7, FALSE, writer, TRUE, FALSE, s.flush_raw_data, 128, "./", "dsetops-shadow", NULL); /* use_latest_format, use_vfd_swmr, only_meta_page, page_buf_size, config */ if ((fapl = vfd_swmr_create_fapl(true, s.use_vfd_swmr, true, 4096, &config)) < 0) { diff --git a/test/vfd_swmr_generator.c b/test/vfd_swmr_generator.c index a78abbc..e002b4d 100644 --- a/test/vfd_swmr_generator.c +++ b/test/vfd_swmr_generator.c @@ -125,9 +125,10 @@ gen_skeleton(const char *filename, hbool_t verbose, hbool_t vfd_swmr_write, int if ((config = HDcalloc(1, sizeof(*config))) == NULL) return -1; - /* config, tick_len, max_lag, writer, maintain_metadata_file, generate_updater_files, - * flush_raw_data, md_pages_reserved, md_file_path, updater_file_path */ - init_vfd_swmr_config(config, 4, 10, vfd_swmr_write, TRUE, FALSE, TRUE, 128, "generator-shadow", NULL); + /* config, tick_len, max_lag, presume_posix_semantics, writer, + * maintain_metadata_file, generate_updater_files, flush_raw_data, md_pages_reserved, + * md_file_path, md_file_name, updater_file_path */ + init_vfd_swmr_config(config, 4, 10, FALSE, vfd_swmr_write, TRUE, FALSE, TRUE, 128, NULL, "generator-shadow", NULL); } /* use_latest_format, use_vfd_swmr, only_meta_page, page_buf_size, config */ diff --git a/test/vfd_swmr_gfail_writer.c b/test/vfd_swmr_gfail_writer.c index 27d6c31..fc3bcb0 100644 --- a/test/vfd_swmr_gfail_writer.c +++ b/test/vfd_swmr_gfail_writer.c @@ -544,10 +544,11 @@ main(int argc, char **argv) TEST_ERROR; } - /* config, tick_len, max_lag, writer, maintain_metadata_file, generate_updater_files, - * flush_raw_data, md_pages_reserved, md_file_path, updater_file_path */ - init_vfd_swmr_config(&config, s.tick_len, s.max_lag, writer, TRUE, FALSE, TRUE, 128, "./group-shadow", - NULL); + /* config, tick_len, max_lag, presume_posix_semantics, writer, + * maintain_metadata_file, generate_updater_files, flush_raw_data, md_pages_reserved, + * md_file_path, md_file_name, updater_file_path */ + init_vfd_swmr_config(&config, s.tick_len, s.max_lag, FALSE, writer, TRUE, FALSE, TRUE, 128, + "./", "group-shadow", NULL); /* If old-style option is chosen, use the earliest file format(H5F_LIBVER_EARLIEST) * as the second parameter of H5Pset_libver_bound() that is called by diff --git a/test/vfd_swmr_gperf_writer.c b/test/vfd_swmr_gperf_writer.c index 66fd22f..a1f3ff1 100644 --- a/test/vfd_swmr_gperf_writer.c +++ b/test/vfd_swmr_gperf_writer.c @@ -2804,10 +2804,11 @@ main(int argc, char **argv) return EXIT_SUCCESS; } - /* config, tick_len, max_lag, writer, maintain_metadata_file, generate_updater_files, - * flush_raw_data, md_pages_reserved, md_file_path, updater_file_path */ - init_vfd_swmr_config(&config, s.tick_len, s.max_lag, writer, TRUE, FALSE, FALSE, 128, "./group-shadow", - NULL); + /* config, tick_len, max_lag, presume_posix_semantics, writer, + * maintain_metadata_file, generate_updater_files, flush_raw_data, md_pages_reserved, + * md_file_path, md_file_name, updater_file_path */ + init_vfd_swmr_config(&config, s.tick_len, s.max_lag, FALSE, writer, TRUE, FALSE, FALSE, 128, + "./", "group-shadow", NULL); /* If the log flag is on, create the log file log-test under the current directory. */ if (s.glog == true) diff --git a/test/vfd_swmr_group_writer.c b/test/vfd_swmr_group_writer.c index 53c9cec..50e0535 100644 --- a/test/vfd_swmr_group_writer.c +++ b/test/vfd_swmr_group_writer.c @@ -5003,10 +5003,11 @@ main(int argc, char **argv) TEST_ERROR; } - /* config, tick_len, max_lag, writer, maintain_metadata_file, generate_updater_files, - * flush_raw_data, md_pages_reserved, md_file_path, updater_file_path */ - init_vfd_swmr_config(&config, s.tick_len, s.max_lag, writer, TRUE, FALSE, TRUE, 128, "./group-shadow", - NULL); + /* config, tick_len, max_lag, presume_posix_semantics, writer, + * maintain_metadata_file, generate_updater_files, flush_raw_data, md_pages_reserved, + * md_file_path, md_file_name, updater_file_path */ + init_vfd_swmr_config(&config, s.tick_len, s.max_lag, FALSE, writer, TRUE, FALSE, TRUE, 128, + "./", "group-shadow", NULL); /* If old-style option is chosen, use the earliest file format(H5F_LIBVER_EARLIEST) * as the second parameter of H5Pset_libver_bound() that is called by diff --git a/test/vfd_swmr_indep_rw_writer.c b/test/vfd_swmr_indep_rw_writer.c index fae4d82..97bb9b1 100644 --- a/test/vfd_swmr_indep_rw_writer.c +++ b/test/vfd_swmr_indep_rw_writer.c @@ -359,14 +359,16 @@ error: * for the VFD SMWR independence of the reader/writer test. */ static hbool_t -indep_init_vfd_swmr_config_plist(state_t *s, hbool_t writer, const char *mdf_path) +indep_init_vfd_swmr_config_plist(state_t *s, hbool_t writer, const char *mdf_name) { H5F_vfd_swmr_config_t config; - /* config, tick_len, max_lag, writer, maintain_metadata_file, generate_updater_files, - * flush_raw_data, md_pages_reserved, md_file_path, updater_file_path */ - init_vfd_swmr_config(&config, s->tick_len, s->max_lag, writer, TRUE, FALSE, TRUE, 128, mdf_path, NULL); + /* config, tick_len, max_lag, presume_posix_semantics, writer, + * maintain_metadata_file, generate_updater_files, flush_raw_data, md_pages_reserved, + * md_file_path, md_file_name, updater_file_path */ + init_vfd_swmr_config(&config, s->tick_len, s->max_lag, FALSE, writer, TRUE, FALSE, TRUE, 128, + "./", mdf_name, NULL); /* Pass the use_vfd_swmr, only_meta_page, page buffer size, config to vfd_swmr_create_fapl().*/ if ((s->fapl = vfd_swmr_create_fapl(TRUE, s->use_vfd_swmr, TRUE, s->pbs, &config)) < 0) { @@ -645,7 +647,7 @@ main(int argc, char **argv) if (s.first_proc) { writer = TRUE; - if (FALSE == indep_init_vfd_swmr_config_plist(&s, writer, "./file1-shadow")) { + if (FALSE == indep_init_vfd_swmr_config_plist(&s, writer, "file1-shadow")) { HDfprintf(stderr, "Writer: Cannot initialize file property lists for file %s\n", s.filename[0]); TEST_ERROR; } @@ -678,7 +680,7 @@ main(int argc, char **argv) } writer = FALSE; - if (FALSE == indep_init_vfd_swmr_config_plist(&s, writer, "./file2-shadow")) { + if (FALSE == indep_init_vfd_swmr_config_plist(&s, writer, "file2-shadow")) { HDfprintf(stderr, "Reader: Cannot initialize file property lists for file %s\n", s.filename[1]); TEST_ERROR; } @@ -715,7 +717,7 @@ main(int argc, char **argv) * then writes a dataset in the second file for the first process to read. */ writer = FALSE; - if (FALSE == indep_init_vfd_swmr_config_plist(&s, writer, "./file1-shadow")) { + if (FALSE == indep_init_vfd_swmr_config_plist(&s, writer, "file1-shadow")) { HDfprintf(stderr, "Reader: Cannot initialize file property lists for file %s\n", s.filename[0]); TEST_ERROR; } @@ -737,7 +739,7 @@ main(int argc, char **argv) } writer = TRUE; - if (FALSE == indep_init_vfd_swmr_config_plist(&s, writer, "./file2-shadow")) { + if (FALSE == indep_init_vfd_swmr_config_plist(&s, writer, "file2-shadow")) { HDfprintf(stderr, "writer: Cannot initialize file property lists for file %s\n", s.filename[1]); TEST_ERROR; } diff --git a/test/vfd_swmr_reader.c b/test/vfd_swmr_reader.c index 153048c..2e918b0 100644 --- a/test/vfd_swmr_reader.c +++ b/test/vfd_swmr_reader.c @@ -319,9 +319,10 @@ read_records(const char *filename, hbool_t verbose, FILE *verbose_file, unsigned goto error; } - /* config, tick_len, max_lag, writer, maintain_metadata_file, generate_updater_files, - * flush_raw_data, md_pages_reserved, md_file_path, updater_file_path */ - init_vfd_swmr_config(config, 4, 5, FALSE, TRUE, FALSE, TRUE, 128, "rw-shadow", NULL); + /* config, tick_len, max_lag, presume_posix_semantics, writer, + * maintain_metadata_file, generate_updater_files, flush_raw_data, md_pages_reserved, + * md_file_path, md_file_name, updater_file_path */ + init_vfd_swmr_config(config, 4, 5, FALSE, FALSE, TRUE, FALSE, TRUE, 128, NULL, "rw-shadow", NULL); /* use_latest_format, use_vfd_swmr, only_meta_page, page_buf_size, config */ if ((fapl = vfd_swmr_create_fapl(FALSE, TRUE, FALSE, 4096, config)) < 0) { diff --git a/test/vfd_swmr_remove_reader.c b/test/vfd_swmr_remove_reader.c index 9c684f5..9b73adc 100644 --- a/test/vfd_swmr_remove_reader.c +++ b/test/vfd_swmr_remove_reader.c @@ -303,9 +303,10 @@ read_records(const char *filename, unsigned verbose, unsigned long nseconds, uns if ((config = HDcalloc(1, sizeof(*config))) == NULL) goto error; - /* config, tick_len, max_lag, writer, maintain_metadata_file, generate_updater_files, - * flush_raw_data, md_pages_reserved, md_file_path, updater_file_path */ - init_vfd_swmr_config(config, 4, 5, FALSE, TRUE, FALSE, TRUE, 128, "rw-shadow", NULL); + /* config, tick_len, max_lag, presume_posix_semantics, writer, + * maintain_metadata_file, generate_updater_files, flush_raw_data, md_pages_reserved, + * md_file_path, md_file_name, updater_file_path */ + init_vfd_swmr_config(config, 4, 5, FALSE, FALSE, TRUE, FALSE, TRUE, 128, NULL, "rw-shadow", NULL); /* use_latest_format, use_vfd_swmr, only_meta_page, page_buf_size, config */ if ((fapl = vfd_swmr_create_fapl(FALSE, TRUE, FALSE, 4096, config)) < 0) { diff --git a/test/vfd_swmr_remove_writer.c b/test/vfd_swmr_remove_writer.c index 1e40a18..72209f8 100644 --- a/test/vfd_swmr_remove_writer.c +++ b/test/vfd_swmr_remove_writer.c @@ -86,9 +86,10 @@ open_skeleton(const char *filename, unsigned verbose, unsigned old H5_ATTR_UNUSE if ((config = (H5F_vfd_swmr_config_t *)HDcalloc(1, sizeof(H5F_vfd_swmr_config_t))) == NULL) goto error; - /* config, tick_len, max_lag, writer, maintain_metadata_file, generate_updater_files, - * flush_raw_data, md_pages_reserved, md_file_path, updater_file_path */ - init_vfd_swmr_config(config, 4, 5, TRUE, TRUE, FALSE, TRUE, 128, "rw-shadow", NULL); + /* config, tick_len, max_lag, presume_posix_semantics, writer, + * maintain_metadata_file, generate_updater_files, flush_raw_data, md_pages_reserved, + * md_file_path, md_file_name, updater_file_path */ + init_vfd_swmr_config(config, 4, 5, FALSE, TRUE, TRUE, FALSE, TRUE, 128, NULL, "rw-shadow", NULL); /* use_latest_format, use_vfd_swmr, only_meta_page, page_buf_size, config */ if ((fapl = vfd_swmr_create_fapl(TRUE, TRUE, FALSE, 4096, config)) < 0) diff --git a/test/vfd_swmr_sparse_reader.c b/test/vfd_swmr_sparse_reader.c index 1d9557c..2f7856c 100644 --- a/test/vfd_swmr_sparse_reader.c +++ b/test/vfd_swmr_sparse_reader.c @@ -207,9 +207,10 @@ read_records(const char *filename, unsigned verbose, unsigned long nrecords, uns if ((config = HDcalloc(1, sizeof(H5F_vfd_swmr_config_t))) == NULL) goto error; - /* config, tick_len, max_lag, writer, maintain_metadata_file, generate_updater_files, - * flush_raw_data, md_pages_reserved, md_file_path, updater_file_path */ - init_vfd_swmr_config(config, 4, 5, FALSE, TRUE, FALSE, TRUE, 128, "rw-shadow", NULL); + /* config, tick_len, max_lag, presume_posix_semantics, writer, + * maintain_metadata_file, generate_updater_files, flush_raw_data, md_pages_reserved, + * md_file_path, md_file_name, updater_file_path */ + init_vfd_swmr_config(config, 4, 5, FALSE, FALSE, TRUE, FALSE, TRUE, 128, NULL, "rw-shadow", NULL); /* use_latest_format, use_vfd_swmr, only_meta_page, page_buf_size, config */ if ((fapl = vfd_swmr_create_fapl(FALSE, TRUE, FALSE, 4096, config)) < 0) { diff --git a/test/vfd_swmr_sparse_writer.c b/test/vfd_swmr_sparse_writer.c index 0d521b7..a233bb3 100644 --- a/test/vfd_swmr_sparse_writer.c +++ b/test/vfd_swmr_sparse_writer.c @@ -86,9 +86,10 @@ open_skeleton(const char *filename, unsigned verbose) if ((config = (H5F_vfd_swmr_config_t *)HDcalloc(1, sizeof(H5F_vfd_swmr_config_t))) == NULL) goto error; - /* config, tick_len, max_lag, writer, maintain_metadata_file, generate_updater_files, - * flush_raw_data, md_pages_reserved, md_file_path, updater_file_path */ - init_vfd_swmr_config(config, 4, 5, TRUE, TRUE, FALSE, TRUE, 128, "rw-shadow", NULL); + /* config, tick_len, max_lag, presume_posix_semantics, writer, + * maintain_metadata_file, generate_updater_files, flush_raw_data, md_pages_reserved, + * md_file_path, md_file_name, updater_file_path */ + init_vfd_swmr_config(config, 4, 5, FALSE, TRUE, TRUE, FALSE, TRUE, 128, NULL, "rw-shadow", NULL); /* use_latest_format, use_vfd_swmr, only_meta_page, page_buf_size, config */ if ((fapl = vfd_swmr_create_fapl(TRUE, TRUE, FALSE, 4096, config)) < 0) diff --git a/test/vfd_swmr_vlstr_reader.c b/test/vfd_swmr_vlstr_reader.c index cbcc6c0..406f13b 100644 --- a/test/vfd_swmr_vlstr_reader.c +++ b/test/vfd_swmr_vlstr_reader.c @@ -115,9 +115,10 @@ main(int argc, char **argv) if (argc > 0) errx(EXIT_FAILURE, "unexpected command-line arguments"); - /* config, tick_len, max_lag, writer, maintain_metadata_file, generate_updater_files, - * flush_raw_data, md_pages_reserved, md_file_path, updater_file_path */ - init_vfd_swmr_config(&config, 4, 7, FALSE, TRUE, FALSE, TRUE, 128, "./vlstr-shadow", NULL); + /* config, tick_len, max_lag, presume_posix_semantics, writer, + * maintain_metadata_file, generate_updater_files, flush_raw_data, md_pages_reserved, + * md_file_path, md_file_name, updater_file_path */ + init_vfd_swmr_config(&config, 4, 7, FALSE, false, TRUE, FALSE, TRUE, 128, "./", "vlstr-shadow", NULL); /* use_latest_format, use_vfd_swmr, only_meta_page, page_buf_size, config */ fapl = vfd_swmr_create_fapl(TRUE, use_vfd_swmr, sel == TEST_OOB, 4096, &config); diff --git a/test/vfd_swmr_vlstr_writer.c b/test/vfd_swmr_vlstr_writer.c index 682e86a..6a747a2 100644 --- a/test/vfd_swmr_vlstr_writer.c +++ b/test/vfd_swmr_vlstr_writer.c @@ -152,10 +152,10 @@ main(int argc, char **argv) if (argc > 0) errx(EXIT_FAILURE, "unexpected command-line arguments"); - /* config, tick_len, max_lag, writer, maintain_metadata_file, generate_updater_files, - * flush_raw_data, md_pages_reserved, md_file_path, updater_file_path - */ - init_vfd_swmr_config(&config, 4, 7, TRUE, TRUE, FALSE, TRUE, 128, "./vlstr-shadow", NULL); + /* config, tick_len, max_lag, presume_posix_semantics, writer, + * maintain_metadata_file, generate_updater_files, flush_raw_data, md_pages_reserved, + * md_file_path, md_file_name, updater_file_path */ + init_vfd_swmr_config(&config, 4, 7, FALSE, true, TRUE, FALSE, TRUE, 128, "./", "vlstr-shadow", NULL); /* use_latest_format, use_vfd_swmr, only_meta_page, page_buf_size, config */ fapl = vfd_swmr_create_fapl(TRUE, use_vfd_swmr, sel == TEST_OOB, 4096, &config); diff --git a/test/vfd_swmr_writer.c b/test/vfd_swmr_writer.c index eeceb49..ba9938f 100644 --- a/test/vfd_swmr_writer.c +++ b/test/vfd_swmr_writer.c @@ -87,9 +87,10 @@ open_skeleton(const char *filename, hbool_t verbose, FILE *verbose_file, unsigne if ((config = (H5F_vfd_swmr_config_t *)HDcalloc(1, sizeof(H5F_vfd_swmr_config_t))) == NULL) return -1; - /* config, tick_len, max_lag, writer, maintain_metadata_file, generate_updater_files, - * flush_raw_data, md_pages_reserved, md_file_path, updater_file_path */ - init_vfd_swmr_config(config, 4, 5, TRUE, TRUE, FALSE, TRUE, 128, "rw-shadow", NULL); + /* config, tick_len, max_lag, presume_posix_semantics, writer, + * maintain_metadata_file, generate_updater_files, flush_raw_data, md_pages_reserved, + * md_file_path, md_file_name, updater_file_path */ + init_vfd_swmr_config(config, 4, 5, FALSE, TRUE, TRUE, FALSE, TRUE, 128, NULL, "rw-shadow", NULL); /* use_latest_format, use_vfd_swmr, only_meta_page, page_buf_size, config */ if ((fapl = vfd_swmr_create_fapl(TRUE, TRUE, FALSE, 4096, config)) < 0) diff --git a/test/vfd_swmr_zoo_writer.c b/test/vfd_swmr_zoo_writer.c index 32726f7..a040fca 100644 --- a/test/vfd_swmr_zoo_writer.c +++ b/test/vfd_swmr_zoo_writer.c @@ -475,9 +475,10 @@ main(int argc, char **argv) parse_command_line_options(argc, argv); - /* config, tick_len, max_lag, writer, maintain_metadata_file, generate_updater_files, - * flush_raw_data, md_pages_reserved, md_file_path, updater_file_path */ - init_vfd_swmr_config(&vfd_swmr_config, TICK_LEN, 7, writer, TRUE, FALSE, TRUE, 128, "./zoo-shadow", NULL); + /* config, tick_len, max_lag, presume_posix_semantics, writer, + * maintain_metadata_file, generate_updater_files, flush_raw_data, md_pages_reserved, + * md_file_path, md_file_name, updater_file_path */ + init_vfd_swmr_config(&vfd_swmr_config, TICK_LEN, 7, FALSE, writer, TRUE, FALSE, TRUE, 128, "./", "zoo-shadow", NULL); /* ? turn off use latest format argument via 1st argument? since later on it reset to early format */ /* use_latest_format, use_vfd_swmr, only_meta_page, page_buf_size, config */ -- cgit v0.12