diff options
author | Quincey Koziol <koziol@lbl.gov> | 2016-11-26 01:47:25 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@lbl.gov> | 2016-11-26 01:47:25 (GMT) |
commit | 61e0a035bcc96b4fa38e443332bcbb6041e56b5d (patch) | |
tree | 5fa6f8c47cc3b83f0ef10073b8073f977d9ef9b8 /src/H5C.c | |
parent | b0321f7e7d45a2c3ad45f26c3ea1c6bf106d613a (diff) | |
parent | ea4d18c3d9c3b6c77030abdf2f0509bc68224559 (diff) | |
download | hdf5-61e0a035bcc96b4fa38e443332bcbb6041e56b5d.zip hdf5-61e0a035bcc96b4fa38e443332bcbb6041e56b5d.tar.gz hdf5-61e0a035bcc96b4fa38e443332bcbb6041e56b5d.tar.bz2 |
Merge pull request #172 in HDFFV/hdf5 from ~KOZIOL/hdf5:develop to develop
* commit 'ea4d18c3d9c3b6c77030abdf2f0509bc68224559':
Remove unnecessary assert.
Add a flag for H5C__flush_single_entry() to allow the parallel code to request that images for entries be generated, even when not writing the entry from an MPI rank.
Diffstat (limited to 'src/H5C.c')
-rw-r--r-- | src/H5C.c | 58 |
1 files changed, 31 insertions, 27 deletions
@@ -5739,6 +5739,7 @@ H5C__flush_single_entry(const H5F_t *f, hid_t dxpl_id, H5C_cache_entry_t *entry_ hbool_t during_flush; /* external flag */ hbool_t write_entry; /* internal flag */ hbool_t destroy_entry; /* internal flag */ + hbool_t generate_image; /* internal flag */ hbool_t was_dirty; haddr_t entry_addr = HADDR_UNDEF; herr_t ret_value = SUCCEED; /* Return value */ @@ -5759,6 +5760,7 @@ H5C__flush_single_entry(const H5F_t *f, hid_t dxpl_id, H5C_cache_entry_t *entry_ take_ownership = ((flags & H5C__TAKE_OWNERSHIP_FLAG) != 0); del_from_slist_on_destroy = ((flags & H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG) != 0); during_flush = ((flags & H5C__DURING_FLUSH_FLAG) != 0); + generate_image = ((flags & H5C__GENERATE_IMAGE_FLAG) != 0); /* Set the flag for destroying the entry, based on the 'take ownership' * and 'destroy' flags @@ -5818,29 +5820,13 @@ H5C__flush_single_entry(const H5F_t *f, hid_t dxpl_id, H5C_cache_entry_t *entry_ entry_ptr->flush_in_progress = TRUE; entry_ptr->flush_marker = FALSE; - /* serialize the entry if necessary, and then write it to disk. */ - if(write_entry) { - - /* The entry is dirty, and we are doing either a flush, - * or a flush destroy. In either case, serialize the - * entry and write it to disk. - * - * Note that this may cause the entry to be re-sized and/or - * moved in the cache. - * - * As we will not update the metadata cache's data structures - * until we we finish the write, we must touch up these - * data structures for size and location changes even if we - * are about to delete the entry from the cache (i.e. on a - * flush destroy). - */ + /* The entry is dirty, and we are doing a flush, a flush destroy or have + * been requested to generate an image. In those cases, serialize the + * entry. + */ + if(write_entry || generate_image) { HDassert(entry_ptr->is_dirty); -#if H5C_DO_SANITY_CHECKS - if(cache_ptr->check_write_permitted && !(cache_ptr->write_permitted)) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Write when writes are always forbidden!?!?!") -#endif /* H5C_DO_SANITY_CHECKS */ - if(NULL == entry_ptr->image_ptr) { if(NULL == (entry_ptr->image_ptr = H5MM_malloc(entry_ptr->size + H5C_IMAGE_EXTRA_SPACE))) HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed for on disk image buffer") @@ -5854,13 +5840,22 @@ H5C__flush_single_entry(const H5F_t *f, hid_t dxpl_id, H5C_cache_entry_t *entry_ if(H5C__generate_image(f, cache_ptr, entry_ptr, dxpl_id) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "can't generate entry's image") } /* end if ( ! (entry_ptr->image_up_to_date) ) */ + } /* end if */ + + /* Finally, write the image to disk. + * + * Note that if the H5AC__CLASS_SKIP_WRITES flag is set in the + * in the entry's type, we silently skip the write. This + * flag should only be used in test code. + */ + if(write_entry) { + HDassert(entry_ptr->is_dirty); + +#if H5C_DO_SANITY_CHECKS + if(cache_ptr->check_write_permitted && !(cache_ptr->write_permitted)) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Write when writes are always forbidden!?!?!") +#endif /* H5C_DO_SANITY_CHECKS */ - /* Finally, write the image to disk. - * - * Note that if the H5AC__CLASS_SKIP_WRITES flag is set in the - * in the entry's type, we silently skip the write. This - * flag should only be used in test code. - */ if(((entry_ptr->type->flags) & H5C__CLASS_SKIP_WRITES) == 0) { #ifdef H5_HAVE_PARALLEL if(collective_write_list) { @@ -7600,6 +7595,15 @@ H5C__assert_flush_dep_nocycle(const H5C_cache_entry_t * entry, * * Purpose: Serialize an entry and generate its image. * + * Note: This may cause the entry to be re-sized and/or moved in + * the cache. + * + * As we will not update the metadata cache's data structures + * until we we finish the write, we must touch up these + * data structures for size and location changes even if we + * are about to delete the entry from the cache (i.e. on a + * flush destroy). + * * Return: Non-negative on success/Negative on failure * * Programmer: Mohamad Chaarawi |