diff options
Diffstat (limited to 'src/H5ACpkg.h')
| -rw-r--r-- | src/H5ACpkg.h | 196 |
1 files changed, 117 insertions, 79 deletions
diff --git a/src/H5ACpkg.h b/src/H5ACpkg.h index ad768ef..8ccab4e 100644 --- a/src/H5ACpkg.h +++ b/src/H5ACpkg.h @@ -1,16 +1,13 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * * terms governing use, modification, and redistribution, is contained in * - * the files COPYING and Copyright.html. COPYING can be found at the root * - * of the source code distribution tree; Copyright.html can be found at the * - * root level of an installed copy of the electronic HDF5 document set and * - * is linked from the top-level documents page. It can also be found at * - * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * - * access to either file, you may request a copy from help@hdfgroup.org. * + * the COPYING file, which can be found at the root of the source code * + * distribution tree, or in https://www.hdfgroup.org/licenses. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* @@ -28,23 +25,32 @@ * */ -#ifndef H5AC_PACKAGE +#if !(defined H5AC_FRIEND || defined H5AC_MODULE) #error "Do not include this file outside the H5AC package!" #endif -#ifndef _H5ACpkg_H -#define _H5ACpkg_H +#ifndef H5ACpkg_H +#define H5ACpkg_H /* Get package's private header */ -#include "H5ACprivate.h" /* Metadata cache */ - +#include "H5ACprivate.h" /* Metadata cache */ /* Get needed headers */ -#include "H5Cprivate.h" /* Cache */ -#include "H5SLprivate.h" /* Skip lists */ +#include "H5Cprivate.h" /* Cache */ +#include "H5FLprivate.h" /* Free Lists */ + +/*****************************/ +/* Package Private Variables */ +/*****************************/ + +/* Declare extern the free list to manage the H5AC_aux_t struct */ +H5FL_EXTERN(H5AC_aux_t); +/**************************/ +/* Package Private Macros */ +/**************************/ -#define H5AC_DEBUG_DIRTY_BYTES_CREATION 0 +/* #define H5AC_DEBUG_DIRTY_BYTES_CREATION */ #ifdef H5_HAVE_PARALLEL @@ -52,8 +58,8 @@ * at a sync point. */ -#define H5AC_SYNC_POINT_OP__FLUSH_TO_MIN_CLEAN 0 -#define H5AC_SYNC_POINT_OP__FLUSH_CACHE 1 +#define H5AC_SYNC_POINT_OP__FLUSH_TO_MIN_CLEAN 0 +#define H5AC_SYNC_POINT_OP__FLUSH_CACHE 1 #endif /* H5_HAVE_PARALLEL */ @@ -64,12 +70,9 @@ *------------------------------------------------------------------------- */ -#define H5AC__MIN_DIRTY_BYTES_THRESHOLD (int32_t) \ - (H5C__MIN_MAX_CACHE_SIZE / 2) -#define H5AC__DEFAULT_DIRTY_BYTES_THRESHOLD (256 * 1024) -#define H5AC__MAX_DIRTY_BYTES_THRESHOLD (int32_t) \ - (H5C__MAX_MAX_CACHE_SIZE / 4) - +#define H5AC__MIN_DIRTY_BYTES_THRESHOLD (size_t)(H5C__MIN_MAX_CACHE_SIZE / 2) +#define H5AC__DEFAULT_DIRTY_BYTES_THRESHOLD (256 * 1024) +#define H5AC__MAX_DIRTY_BYTES_THRESHOLD (size_t)(H5C__MAX_MAX_CACHE_SIZE / 4) /**************************************************************************** * @@ -120,7 +123,7 @@ * Maintaining this count is easy for all processes not on process 0 -- * all that is necessary is to add the size of the entry to the total * whenever there is an insertion, a move of a previously clean entry, - * or whever a previously clean entry is marked dirty in an unprotect. + * or wherever a previously clean entry is marked dirty in an unprotect. * * On process 0, we have to be careful not to count dirty bytes twice. * If an entry is marked dirty, flushed, and marked dirty again, all @@ -142,6 +145,29 @@ * * JRM - 6/27/05 * + * Update: When the above was written, I planned to allow the process + * 0 metadata cache to write dirty metadata between sync points. + * However, testing indicated that this allowed occasional + * messages from the future to reach the caches on other processes. + * + * To resolve this, the code was altered to require that all metadata + * writes take place during sync points -- which solved the problem. + * Initially all writes were performed by the process 0 cache. This + * approach was later replaced with a distributed write approach + * in which each process writes a subset of the metadata to be + * written. + * + * After thinking on the matter for a while, I arrived at the + * conclusion that the process 0 cache could be allowed to write + * dirty metadata between sync points if it restricted itself to + * entries that had been dirty at the time of the previous sync point. + * + * To date, there has been no attempt to implement this optimization. + * However, should it be attempted, much of the supporting code + * should still be around. + * + * JRM -- 1/6/15 + * * magic: Unsigned 32 bit integer always set to * H5AC__H5AC_AUX_T_MAGIC. This field is used to validate * pointers to instances of H5AC_aux_t. @@ -157,7 +183,7 @@ * is permitted to write to file. * * dirty_bytes_threshold: Integer field containing the dirty bytes - * generation threashold. Whenever dirty byte creation + * generation threshold. Whenever dirty byte creation * exceeds this value, the metadata cache on process 0 * broadcasts a list of the entries it has flushed since * the last broadcast (or since the beginning of execution) @@ -174,12 +200,16 @@ * broadcast. This field is reset to zero after each such * broadcast. * - * metadata_write_strategy: Integer code indicating how we will be - * writing the metadata. In the first incarnation of + * metadata_write_strategy: Integer code indicating how we will be + * writing the metadata. In the first incarnation of * this code, all writes were done from process 0. This - * field exists to facilitate experiments with other + * field exists to facilitate experiments with other * strategies. * + * At present, this field must be set to either + * H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY or + * H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED. + * * dirty_bytes_propagations: This field only exists when the * H5AC_DEBUG_DIRTY_BYTES_CREATION #define is TRUE. * @@ -231,7 +261,7 @@ * * Things have changed a bit since the following four fields were defined. * If metadata_write_strategy is H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY, - * all comments hold as before -- with the caviate that pending further + * all comments hold as before -- with the caviate that pending further * coding, the process 0 metadata cache is forbidden to flush entries outside * of a sync point. * @@ -262,19 +292,14 @@ * dirtied flag set and the entry does not already appear * in the dirty entry list. * - * Entries are added to the dirty entry list whever they cause + * Entries are added to the dirty entry list wherever they cause * the dirty bytes count to be increased. They are removed * when they appear in a clean entries broadcast. Note that * moves must be reflected in the dirty entry list. * - * To reitterate, this field is only used on process 0 -- it + * To reiterate, this field is only used on process 0 -- it * should be NULL on all other processes. * - * d_slist_len: Integer field containing the number of entries in the - * dirty entry list. This field should always contain the - * value 0 on all processes other than process 0. It exists - * primarily for sanity checking. - * * c_slist_ptr: Pointer to an instance of H5SL_t used to maintain a list * of entries that were dirty, have been flushed * to disk since the last clean entries broadcast, and are @@ -285,11 +310,6 @@ * the next clean entries broadcast. The list emptied after * each broadcast. * - * c_slist_len: Integer field containing the number of entries in the clean - * entries list (*c_slist_ptr). This field should always - * contain the value 0 on all processes other than process 0. - * It exists primarily for sanity checking. - * * The following two fields are used only when metadata_write_strategy * is H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED. * @@ -298,9 +318,6 @@ * point. This list is then broadcast to the other processes, * which then either flush or mark clean all entries on it. * - * candidate_slist_len: Integer field containing the number of entries on the - * candidate list. It exists primarily for sanity checking. - * * write_done: In the parallel test bed, it is necessary to ensure that * all writes to the server process from cache 0 complete * before it enters the barrier call with the other caches. @@ -314,77 +331,98 @@ * needed. * * Note: This field has been extended for use by all processes - * with the addition of support for the distributed - * metadata write strategy. + * with the addition of support for the distributed + * metadata write strategy. * JRM -- 5/9/10 * * sync_point_done: In the parallel test bed, it is necessary to verify * that the expected writes, and only the expected writes, * have taken place at the end of each sync point. * - * The sync_point_done callback allows t_cache to perform - * this verification. The field is set to NULL when the + * The sync_point_done callback allows t_cache to perform + * this verification. The field is set to NULL when the * callback is not needed. * + * The following field supports the metadata cache image feature. + * + * p0_image_len: unsigned integer containing the length of the metadata cache + * image constructed by MPI process 0. This field should be 0 + * if the value is unknown, or if cache image is not enabled. + * ****************************************************************************/ #ifdef H5_HAVE_PARALLEL -#define H5AC__H5AC_AUX_T_MAGIC (unsigned)0x00D0A01 +#define H5AC__H5AC_AUX_T_MAGIC (unsigned)0x00D0A01 -typedef struct H5AC_aux_t -{ - uint32_t magic; +typedef struct H5AC_aux_t { + uint32_t magic; - MPI_Comm mpi_comm; + MPI_Comm mpi_comm; - int mpi_rank; + int mpi_rank; - int mpi_size; + int mpi_size; - hbool_t write_permitted; + hbool_t write_permitted; - int32_t dirty_bytes_threshold; + size_t dirty_bytes_threshold; - int32_t dirty_bytes; + size_t dirty_bytes; - int32_t metadata_write_strategy; + int32_t metadata_write_strategy; -#if H5AC_DEBUG_DIRTY_BYTES_CREATION +#ifdef H5AC_DEBUG_DIRTY_BYTES_CREATION - int32_t dirty_bytes_propagations; + unsigned dirty_bytes_propagations; - int32_t unprotect_dirty_bytes; - int32_t unprotect_dirty_bytes_updates; + size_t unprotect_dirty_bytes; + unsigned unprotect_dirty_bytes_updates; - int32_t insert_dirty_bytes; - int32_t insert_dirty_bytes_updates; + size_t insert_dirty_bytes; + unsigned insert_dirty_bytes_updates; - int32_t move_dirty_bytes; - int32_t move_dirty_bytes_updates; + size_t move_dirty_bytes; + unsigned move_dirty_bytes_updates; #endif /* H5AC_DEBUG_DIRTY_BYTES_CREATION */ - H5SL_t * d_slist_ptr; - - int32_t d_slist_len; + H5SL_t *d_slist_ptr; - H5SL_t * c_slist_ptr; + H5SL_t *c_slist_ptr; - int32_t c_slist_len; + H5SL_t *candidate_slist_ptr; - H5SL_t * candidate_slist_ptr; + void (*write_done)(void); - int32_t candidate_slist_len; + void (*sync_point_done)(unsigned num_writes, haddr_t *written_entries_tbl); - void (* write_done)(void); - - void (* sync_point_done)(int num_writes, - haddr_t * written_entries_tbl); + unsigned p0_image_len; } H5AC_aux_t; /* struct H5AC_aux_t */ +/* Typedefs for debugging function pointers */ +typedef void (*H5AC_sync_point_done_cb_t)(unsigned num_writes, haddr_t *written_entries_tbl); +typedef void (*H5AC_write_done_cb_t)(void); + #endif /* H5_HAVE_PARALLEL */ -#endif /* _H5ACpkg_H */ +/******************************/ +/* Package Private Prototypes */ +/******************************/ + +#ifdef H5_HAVE_PARALLEL +/* Parallel I/O routines */ +H5_DLL herr_t H5AC__log_deleted_entry(const H5AC_info_t *entry_ptr); +H5_DLL herr_t H5AC__log_dirtied_entry(const H5AC_info_t *entry_ptr); +H5_DLL herr_t H5AC__log_cleaned_entry(const H5AC_info_t *entry_ptr); +H5_DLL herr_t H5AC__log_flushed_entry(H5C_t *cache_ptr, haddr_t addr, hbool_t was_dirty, unsigned flags); +H5_DLL herr_t H5AC__log_inserted_entry(const H5AC_info_t *entry_ptr); +H5_DLL herr_t H5AC__log_moved_entry(const H5F_t *f, haddr_t old_addr, haddr_t new_addr); +H5_DLL herr_t H5AC__flush_entries(H5F_t *f); +H5_DLL herr_t H5AC__run_sync_point(H5F_t *f, int sync_point_op); +H5_DLL herr_t H5AC__set_sync_point_done_callback(H5C_t *cache_ptr, H5AC_sync_point_done_cb_t sync_point_done); +H5_DLL herr_t H5AC__set_write_done_callback(H5C_t *cache_ptr, H5AC_write_done_cb_t write_done); +#endif /* H5_HAVE_PARALLEL */ +#endif /* H5ACpkg_H */ |
