diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2009-08-25 14:14:21 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2009-08-25 14:14:21 (GMT) |
commit | b043ee1241522fc0b87787ead985f5d9f3b7af26 (patch) | |
tree | d7f3eeea14b36276fb1c29904dcf092c6d81116b /src | |
parent | 6c5e37a5938f3dc614f908d5d955b3103db4f367 (diff) | |
download | hdf5-b043ee1241522fc0b87787ead985f5d9f3b7af26.zip hdf5-b043ee1241522fc0b87787ead985f5d9f3b7af26.tar.gz hdf5-b043ee1241522fc0b87787ead985f5d9f3b7af26.tar.bz2 |
[svn-r17417] Description:
Bring r17365:17416 from trunk to revise_chunks branch
Tested on:
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (jam) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/Intel compilers w/default API=1.6.x,
w/C++ & FORTRAN, in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in debug mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
Mac OS X/32 10.5.8 (amazon) in debug mode
Mac OS X/32 10.5.8 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
Diffstat (limited to 'src')
-rw-r--r-- | src/H5AC.c | 310 | ||||
-rw-r--r-- | src/H5ACprivate.h | 2 | ||||
-rw-r--r-- | src/H5C.c | 163 | ||||
-rw-r--r-- | src/H5Cprivate.h | 2 | ||||
-rw-r--r-- | src/H5Dchunk.c | 19 | ||||
-rw-r--r-- | src/H5Dcompact.c | 4 | ||||
-rw-r--r-- | src/H5Dcontig.c | 4 | ||||
-rw-r--r-- | src/H5Defl.c | 8 | ||||
-rw-r--r-- | src/H5Dint.c | 14 | ||||
-rw-r--r-- | src/H5Dpkg.h | 3 | ||||
-rw-r--r-- | src/H5Dprivate.h | 2 | ||||
-rw-r--r-- | src/H5F.c | 159 | ||||
-rw-r--r-- | src/H5FD.c | 20 | ||||
-rw-r--r-- | src/H5FDcore.c | 20 | ||||
-rw-r--r-- | src/H5FDprivate.h | 2 | ||||
-rw-r--r-- | src/H5FDsec2.c | 5 | ||||
-rw-r--r-- | src/H5FDwindows.c | 51 | ||||
-rw-r--r-- | src/H5FSprivate.h | 2 | ||||
-rw-r--r-- | src/H5Faccum.c | 14 | ||||
-rw-r--r-- | src/H5Fmount.c | 77 | ||||
-rw-r--r-- | src/H5Fpkg.h | 6 | ||||
-rw-r--r-- | src/H5Fprivate.h | 11 | ||||
-rw-r--r-- | src/H5Fpublic.h | 3 | ||||
-rw-r--r-- | src/H5Fsuper.c | 2 | ||||
-rw-r--r-- | src/H5Fsuper_cache.c | 12 | ||||
-rw-r--r-- | src/H5MF.c | 75 | ||||
-rw-r--r-- | src/H5MFaggr.c | 97 | ||||
-rw-r--r-- | src/H5MFpkg.h | 2 | ||||
-rw-r--r-- | src/H5MFprivate.h | 2 | ||||
-rw-r--r-- | src/H5T.c | 6 | ||||
-rw-r--r-- | src/H5Tconv.c | 8 | ||||
-rw-r--r-- | src/H5Tpkg.h | 12 | ||||
-rw-r--r-- | src/H5config.h.in | 4 | ||||
-rw-r--r-- | src/H5trace.c | 4 | ||||
-rw-r--r-- | src/H5win32defs.h | 1 |
35 files changed, 536 insertions, 590 deletions
@@ -193,6 +193,8 @@ static herr_t H5AC_receive_and_apply_clean_list(H5F_t * f, static herr_t H5AC_log_renamed_entry(H5AC_t * cache_ptr, haddr_t old_addr, haddr_t new_addr); + +static herr_t H5AC_flush_entries(H5F_t *f); #endif /* H5_HAVE_PARALLEL */ @@ -766,64 +768,52 @@ done: herr_t H5AC_dest(H5F_t *f, hid_t dxpl_id) { - H5AC_t *cache = NULL; - herr_t ret_value=SUCCEED; /* Return value */ #ifdef H5_HAVE_PARALLEL H5AC_aux_t * aux_ptr = NULL; #endif /* H5_HAVE_PARALLEL */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5AC_dest, FAIL) - assert(f); - assert(f->shared->cache); - cache = f->shared->cache; -#ifdef H5_HAVE_PARALLEL - aux_ptr = cache->aux_ptr; - - if ( aux_ptr != NULL ) { - - HDassert ( aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC ); - } -#endif /* H5_HAVE_PARALLEL */ + /* Sanity check */ + HDassert(f); + HDassert(f->shared->cache); #if H5AC__TRACE_FILE_ENABLED - if ( H5AC_close_trace_file(cache) < 0 ) { - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "H5AC_close_trace_file() failed.") - } + if(H5AC_close_trace_file(f->shared->cache) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC_close_trace_file() failed.") #endif /* H5AC__TRACE_FILE_ENABLED */ - if ( H5C_dest(f, dxpl_id, H5AC_noblock_dxpl_id, cache) < 0 ) { +#ifdef H5_HAVE_PARALLEL + aux_ptr = f->shared->cache->aux_ptr; + if(aux_ptr) + /* Sanity check */ + HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); - HGOTO_ERROR(H5E_CACHE, H5E_CANTFREE, FAIL, "can't destroy cache") - } + /* Attempt to flush all entries from rank 0 & Bcast clean list to other ranks */ + if(H5AC_flush_entries(f) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't flush.") +#endif /* H5_HAVE_PARALLEL */ + /* Destroy the cache */ + if(H5C_dest(f, dxpl_id, H5AC_noblock_dxpl_id, f->shared->cache) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFREE, FAIL, "can't destroy cache") f->shared->cache = NULL; #ifdef H5_HAVE_PARALLEL - if ( aux_ptr != NULL ) { - - if ( aux_ptr->d_slist_ptr != NULL ) { - + if(aux_ptr != NULL) { + if(aux_ptr->d_slist_ptr != NULL) H5SL_close(aux_ptr->d_slist_ptr); - } - - if ( aux_ptr->c_slist_ptr != NULL ) { - + if(aux_ptr->c_slist_ptr != NULL) H5SL_close(aux_ptr->c_slist_ptr); - } - aux_ptr->magic = 0; H5FL_FREE(H5AC_aux_t, aux_ptr); aux_ptr = NULL; - } + } /* end if */ #endif /* H5_HAVE_PARALLEL */ done: - FUNC_LEAVE_NOAPI(ret_value) - } /* H5AC_dest() */ @@ -923,43 +913,11 @@ done: * Purpose: Flush (and possibly destroy) the metadata cache associated * with the specified file. * - * This is a re-write of an earlier version of the function - * which was reputedly capable of flushing (and destroying - * if requested) individual entries, individual entries if - * they match the supplied type, all entries of a given type, - * as well as all entries in the cache. - * - * As only this last capability is actually used at present, - * I have not implemented the other capabilities in this - * version of the function. - * - * The type and addr parameters are retained to avoid source - * code changed, but values other than NULL and HADDR_UNDEF - * respectively are errors. If all goes well, they should - * be removed, and the function renamed to something more - * descriptive -- perhaps H5AC_flush_cache. - * * If the cache contains protected entries, the function will * fail, as protected entries cannot be flushed. However * all unprotected entries should be flushed before the * function returns failure. * - * For historical purposes, the original version of the - * purpose section is reproduced below: - * - * ============ Original Version of "Purpose:" ============ - * - * Flushes (and destroys if DESTROY is non-zero) the specified - * entry from the cache. If the entry TYPE is CACHE_FREE and - * ADDR is HADDR_UNDEF then all types of entries are - * flushed. If TYPE is CACHE_FREE and ADDR is defined then - * whatever is cached at ADDR is flushed. Otherwise the thing - * at ADDR is flushed if it is the correct type. - * - * If there are protected objects they will not be flushed. - * However, an attempt will be made to flush all non-protected - * items before this function returns failure. - * * Return: Non-negative on success/Negative on failure if there was a * request to flush all items and something was protected. * @@ -967,45 +925,16 @@ done: * matzke@llnl.gov * Jul 9 1997 * - * Modifications: - * Robb Matzke, 1999-07-27 - * The ADDR argument is passed by value. - * - * Complete re-write. See above for details. -- JRM 5/11/04 - * - * Abstracted the guts of the function to H5C_flush_cache() - * in H5C.c, and then re-wrote the function as a wrapper for - * H5C_flush_cache(). - * - * JRM - 6/7/04 - * - * JRM - 7/5/05 - * Modified function as part of a fix for a cache coherency - * bug in PHDF5. See the header comments on the H5AC_aux_t - * structure for details. - * - * JRM -- 5/11/06 - * Added call to the write_done callback. - * - * JRM -- 6/6/06 - * Added trace file support. - * *------------------------------------------------------------------------- */ herr_t -H5AC_flush(H5F_t *f, hid_t dxpl_id, unsigned flags) +H5AC_flush(H5F_t *f, hid_t dxpl_id) { - herr_t status; - herr_t ret_value = SUCCEED; /* Return value */ -#ifdef H5_HAVE_PARALLEL - H5AC_aux_t * aux_ptr = NULL; - int mpi_code; -#endif /* H5_HAVE_PARALLEL */ #if H5AC__TRACE_FILE_ENABLED char trace[128] = ""; FILE * trace_file_ptr = NULL; #endif /* H5AC__TRACE_FILE_ENABLED */ - + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5AC_flush, FAIL) @@ -1016,108 +945,31 @@ H5AC_flush(H5F_t *f, hid_t dxpl_id, unsigned flags) /* For the flush, only the flags are really necessary in the trace file. * Write the result to catch occult errors. */ - if ( ( f != NULL ) && - ( f->shared != NULL ) && - ( f->shared->cache != NULL ) && - ( H5C_get_trace_file_ptr(f->shared->cache, &trace_file_ptr) >= 0 ) && - ( trace_file_ptr != NULL ) ) { - - sprintf(trace, "H5AC_flush 0x%x", flags); - } + if((f != NULL) && + (f->shared != NULL) && + (f->shared->cache != NULL) && + (H5C_get_trace_file_ptr(f->shared->cache, &trace_file_ptr) >= 0) && + (trace_file_ptr != NULL)) + sprintf(trace, "H5AC_flush"); #endif /* H5AC__TRACE_FILE_ENABLED */ #ifdef H5_HAVE_PARALLEL - aux_ptr = f->shared->cache->aux_ptr; - - if ( aux_ptr != NULL ) { - -#if H5AC_DEBUG_DIRTY_BYTES_CREATION - HDfprintf(stdout, - "%d::H5AC_flush: (u/uu/i/iu/r/ru) = %d/%d/%d/%d/%d/%d\n", - (int)(aux_ptr->mpi_rank), - (int)(aux_ptr->unprotect_dirty_bytes), - (int)(aux_ptr->unprotect_dirty_bytes_updates), - (int)(aux_ptr->insert_dirty_bytes), - (int)(aux_ptr->insert_dirty_bytes_updates), - (int)(aux_ptr->rename_dirty_bytes), - (int)(aux_ptr->rename_dirty_bytes_updates)); -#endif /* H5AC_DEBUG_DIRTY_BYTES_CREATION */ - - /* to prevent "messages from the future" we must synchronize all - * processes before we start the flush. Hence the following - * barrier. - */ - if ( MPI_SUCCESS != (mpi_code = MPI_Barrier(aux_ptr->mpi_comm)) ) { - - HMPI_GOTO_ERROR(FAIL, "MPI_Barrier failed", mpi_code) - } - - /* if the clear only flag is set, this flush will not involve any - * disk I/O. In such cases, it is not necessary to let process 0 - * flush first. - */ - if ( ( aux_ptr->mpi_rank == 0 ) && - ( (flags & H5AC__FLUSH_CLEAR_ONLY_FLAG) == 0 ) ) { - - unsigned init_flush_flags = H5AC__NO_FLAGS_SET; - - if ( ( (flags & H5AC__FLUSH_MARKED_ENTRIES_FLAG) != 0 ) && - ( (flags & H5AC__FLUSH_INVALIDATE_FLAG) == 0 ) ) { - - init_flush_flags |= H5AC__FLUSH_MARKED_ENTRIES_FLAG; - } - - aux_ptr->write_permitted = TRUE; - - status = H5C_flush_cache(f, - H5AC_noblock_dxpl_id, - H5AC_noblock_dxpl_id, - f->shared->cache, - init_flush_flags); - - aux_ptr->write_permitted = FALSE; - - if ( status < 0 ) { - - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't flush.") - } - - if ( aux_ptr->write_done != NULL ) { - - (aux_ptr->write_done)(); - } - - } /* end if ( aux_ptr->mpi_rank == 0 ) */ - - status = H5AC_propagate_flushed_and_still_clean_entries_list(f, - H5AC_noblock_dxpl_id, - f->shared->cache, - FALSE); - } /* end if ( aux_ptr != NULL ) */ + /* Attempt to flush all entries from rank 0 & Bcast clean list to other ranks */ + if(H5AC_flush_entries(f) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't flush.") #endif /* H5_HAVE_PARALLEL */ - status = H5C_flush_cache(f, - dxpl_id, - H5AC_noblock_dxpl_id, - f->shared->cache, - flags); - - if ( status < 0 ) { - - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't flush entry.") - } + /* Flush the cache */ + if(H5C_flush_cache(f, dxpl_id, H5AC_noblock_dxpl_id, f->shared->cache, H5AC__NO_FLAGS_SET) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't flush cache.") done: - #if H5AC__TRACE_FILE_ENABLED - if ( trace_file_ptr != NULL ) { - + if(trace_file_ptr != NULL) HDfprintf(trace_file_ptr, "%s %d\n", trace, (int)ret_value); - } #endif /* H5AC__TRACE_FILE_ENABLED */ FUNC_LEAVE_NOAPI(ret_value) - } /* H5AC_flush() */ @@ -4886,5 +4738,89 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5AC_receive_and_apply_clean_list() */ + + +/*------------------------------------------------------------------------- + * Function: H5AC_flush_entries + * + * Purpose: Flush the metadata cache associated with the specified file, + * only writing from rank 0, but propagating the cleaned entries + * to all ranks. + * + * Return: Non-negative on success/Negative on failure if there was a + * request to flush all items and something was protected. + * + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * Aug 22 2009 + * + *------------------------------------------------------------------------- + */ +herr_t +H5AC_flush_entries(H5F_t *f) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT(H5AC_flush_entries) + + HDassert(f); + HDassert(f->shared->cache); + + /* Check if we have >1 ranks */ + if(f->shared->cache->aux_ptr) { + H5AC_aux_t * aux_ptr = f->shared->cache->aux_ptr; + int mpi_code; + +#if H5AC_DEBUG_DIRTY_BYTES_CREATION + HDfprintf(stdout, + "%d::H5AC_flush: (u/uu/i/iu/r/ru) = %d/%d/%d/%d/%d/%d\n", + (int)(aux_ptr->mpi_rank), + (int)(aux_ptr->unprotect_dirty_bytes), + (int)(aux_ptr->unprotect_dirty_bytes_updates), + (int)(aux_ptr->insert_dirty_bytes), + (int)(aux_ptr->insert_dirty_bytes_updates), + (int)(aux_ptr->rename_dirty_bytes), + (int)(aux_ptr->rename_dirty_bytes_updates)); +#endif /* H5AC_DEBUG_DIRTY_BYTES_CREATION */ + + /* to prevent "messages from the future" we must synchronize all + * processes before we start the flush. Hence the following + * barrier. + */ + if(MPI_SUCCESS != (mpi_code = MPI_Barrier(aux_ptr->mpi_comm))) + HMPI_GOTO_ERROR(FAIL, "MPI_Barrier failed", mpi_code) + + /* Flush data to disk, from rank 0 process */ + if(aux_ptr->mpi_rank == 0 ) { + herr_t status; + + aux_ptr->write_permitted = TRUE; + + status = H5C_flush_cache(f, + H5AC_noblock_dxpl_id, + H5AC_noblock_dxpl_id, + f->shared->cache, + H5AC__NO_FLAGS_SET); + + aux_ptr->write_permitted = FALSE; + + if(status < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't flush.") + + if(aux_ptr->write_done != NULL) + (aux_ptr->write_done)(); + } /* end if ( aux_ptr->mpi_rank == 0 ) */ + + /* Propagate cleaned entries to other ranks */ + if(H5AC_propagate_flushed_and_still_clean_entries_list(f, + H5AC_noblock_dxpl_id, + f->shared->cache, + FALSE) < 0 ) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't propagate clean entries list.") + } /* end if ( aux_ptr != NULL ) */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5AC_flush_entries() */ #endif /* H5_HAVE_PARALLEL */ diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h index f264401..208dde1 100644 --- a/src/H5ACprivate.h +++ b/src/H5ACprivate.h @@ -344,7 +344,7 @@ H5_DLL herr_t H5AC_destroy_flush_dependency(H5F_t *f, void *parent_thing, H5_DLL herr_t H5AC_unprotect(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, void *thing, unsigned flags); -H5_DLL herr_t H5AC_flush(H5F_t *f, hid_t dxpl_id, unsigned flags); +H5_DLL herr_t H5AC_flush(H5F_t *f, hid_t dxpl_id); H5_DLL herr_t H5AC_mark_pinned_entry_dirty(H5F_t * f, void * thing, hbool_t size_changed, @@ -3434,10 +3434,6 @@ H5C_def_auto_resize_rpt_fcn(H5C_t * cache_ptr, * Programmer: John Mainzer * 6/2/04 * - * Modifications: - * - * None. - * *------------------------------------------------------------------------- */ herr_t @@ -3450,21 +3446,20 @@ H5C_dest(H5F_t * f, FUNC_ENTER_NOAPI(H5C_dest, FAIL) - HDassert( cache_ptr ); - HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC ); - HDassert( cache_ptr->skip_file_checks || f ); - - if ( H5C_flush_cache(f, primary_dxpl_id, secondary_dxpl_id, - cache_ptr, H5C__FLUSH_INVALIDATE_FLAG) < 0 ) { + /* Sanity check */ + HDassert(cache_ptr); + HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); + HDassert(cache_ptr->skip_file_checks || f); + /* Flush and invalidate all cache entries */ + if(H5C_flush_invalidate_cache(f, primary_dxpl_id, secondary_dxpl_id, + cache_ptr, H5C__NO_FLAGS_SET) < 0 ) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush cache") - } - - if ( cache_ptr->slist_ptr != NULL ) { + if(cache_ptr->slist_ptr != NULL) { H5SL_close(cache_ptr->slist_ptr); cache_ptr->slist_ptr = NULL; - } + } /* end if */ cache_ptr->magic = 0; @@ -3472,66 +3467,10 @@ H5C_dest(H5F_t * f, done: FUNC_LEAVE_NOAPI(ret_value) - } /* H5C_dest() */ /*------------------------------------------------------------------------- - * Function: H5C_dest_empty - * - * Purpose: Destroy an empty cache. - * - * This function fails if the cache is not empty on entry. - * - * Note that *cache_ptr has been freed upon successful return. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: John Mainzer - * 6/2/04 - * - * Modifications: - * - * None. - * - *------------------------------------------------------------------------- - */ -herr_t -H5C_dest_empty(H5C_t * cache_ptr) -{ - herr_t ret_value=SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(H5C_dest_empty, FAIL) - - /* This would normally be an assert, but we need to use an HGOTO_ERROR - * call to shut up the compiler. - */ - if ( ( ! cache_ptr ) || - ( cache_ptr->magic != H5C__H5C_T_MAGIC ) || - ( cache_ptr->index_len != 0 ) ) { - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "Bad cache_ptr or non-empty cache on entry.") - } - - - if ( cache_ptr->slist_ptr != NULL ) { - - H5SL_close(cache_ptr->slist_ptr); - cache_ptr->slist_ptr = NULL; - } - - cache_ptr->magic = 0; - - (void)H5FL_FREE(H5C_t, cache_ptr); - -done: - FUNC_LEAVE_NOAPI(ret_value) - -} /* H5C_dest_empty() */ - - -/*------------------------------------------------------------------------- * * Function: H5C_expunge_entry * @@ -3928,8 +3867,7 @@ H5C_flush_cache(H5F_t * f, #ifndef NDEBUG if ( entry_ptr->magic != H5C__H5C_CACHE_ENTRY_T_MAGIC ) { - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "entry_ptr->magic invalid ?!?!"); + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "entry_ptr->magic is invalid ?!?!") } else #endif /* NDEBUG */ @@ -3937,9 +3875,8 @@ H5C_flush_cache(H5F_t * f, ( ! entry_ptr->in_slist ) ) { /* the s-list has been modified out from under us. - * set node_ptr to NULL and break out of the inner loop. + * break out of the loop. */ - node_ptr = NULL; goto end_of_inner_loop;; } @@ -3950,11 +3887,8 @@ H5C_flush_cache(H5F_t * f, if ( node_ptr != NULL ) { next_entry_ptr = (H5C_cache_entry_t *)H5SL_item(node_ptr); - - if ( next_entry_ptr == NULL ) { - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "next_entry_ptr == NULL 2 ?!?!"); - } + if ( NULL == next_entry_ptr ) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "next_entry_ptr == NULL ?!?!") HDassert( next_entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC ); HDassert( next_entry_ptr->is_dirty ); HDassert( next_entry_ptr->in_slist ); @@ -3999,18 +3933,19 @@ H5C_flush_cache(H5F_t * f, FALSE); if ( status < 0 ) { - /* This shouldn't happen -- if it does, we are - * toast so just scream and die. + /* This shouldn't happen -- if it does, we are toast + * so just scream and die. */ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, \ "dirty pinned entry flush failed.") - } + } /* end if */ flushed_during_dep_loop = TRUE; } /* end if */ else if(entry_ptr->flush_dep_height < curr_flush_dep_height) /* This shouldn't happen -- if it does, just scream and die. */ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "dirty entry below current flush dep. height.") - } else { + } /* end if */ + else { /* Test to see if we are can flush the entry now. * If we can, go ahead and flush. Note that we * aren't trying to do a destroy here, so that @@ -10335,7 +10270,6 @@ H5C_flush_invalidate_cache(H5F_t * f, { herr_t status; herr_t ret_value = SUCCEED; - hbool_t done = FALSE; hbool_t first_flush = TRUE; int32_t protected_entries = 0; int32_t i; @@ -10411,7 +10345,7 @@ H5C_flush_invalidate_cache(H5F_t * f, cur_pel_len = cache_ptr->pel_len; old_pel_len = cache_ptr->pel_len; - while ( ! done ) + while ( cache_ptr->index_len > 0 ) { unsigned curr_flush_dep_height = 0; unsigned flush_dep_passes = 0; @@ -10436,24 +10370,19 @@ H5C_flush_invalidate_cache(H5F_t * f, } else { + /* Start at beginning of skip list each time */ node_ptr = H5SL_first(cache_ptr->slist_ptr); + HDassert( node_ptr != NULL ); - if ( node_ptr == NULL ) { - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "slist_len != 0 && node_ptr == NULL"); - } - + /* Get cache entry for this node */ next_entry_ptr = (H5C_cache_entry_t *)H5SL_item(node_ptr); - - if ( next_entry_ptr == NULL ) { - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "next_entry_ptr == NULL 1 ?!?!"); - } + if ( NULL == next_entry_ptr ) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "next_entry_ptr == NULL ?!?!") HDassert( next_entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC ); HDassert( next_entry_ptr->is_dirty ); HDassert( next_entry_ptr->in_slist ); - } + #if H5C_DO_SANITY_CHECKS /* Depending on circumstances, H5C_flush_single_entry() will * remove dirty entries from the slist as it flushes them. @@ -10518,8 +10447,7 @@ H5C_flush_invalidate_cache(H5F_t * f, #ifndef NDEBUG if ( entry_ptr->magic != H5C__H5C_CACHE_ENTRY_T_MAGIC ) { - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "entry_ptr->magic is invalid ?!?!"); + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "entry_ptr->magic is invalid ?!?!") } else #endif /* NDEBUG */ @@ -10538,19 +10466,13 @@ H5C_flush_invalidate_cache(H5F_t * f, node_ptr = H5SL_next(node_ptr); if ( node_ptr != NULL ) { - next_entry_ptr = (H5C_cache_entry_t *)H5SL_item(node_ptr); - - if ( next_entry_ptr == NULL ) { - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "next_entry_ptr == NULL 2 ?!?!"); - } + if ( NULL == next_entry_ptr ) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "next_entry_ptr == NULL ?!?!") HDassert( next_entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC ); HDassert( next_entry_ptr->is_dirty ); HDassert( next_entry_ptr->in_slist ); - } else { - next_entry_ptr = NULL; } @@ -10811,24 +10733,21 @@ end_of_inner_loop: HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, \ "Maximum passes on flush exceeded.") } - - if ( cache_ptr->index_len <= 0 ) { - - done = TRUE; - HDassert( cache_ptr->index_size == 0 ); - HDassert( cache_ptr->clean_index_size == 0 ); - HDassert( cache_ptr->dirty_index_size == 0 ); - HDassert( cache_ptr->slist_len == 0 ); - HDassert( cache_ptr->slist_size == 0 ); - HDassert( cache_ptr->pel_len == 0 ); - HDassert( cache_ptr->pel_size == 0 ); - HDassert( cache_ptr->pl_len == 0 ); - HDassert( cache_ptr->pl_size == 0 ); - HDassert( cache_ptr->LRU_list_len == 0 ); - HDassert( cache_ptr->LRU_list_size == 0 ); - } } /* main while loop */ + /* Invariants, after destroying all entries in the hash table */ + HDassert( cache_ptr->index_size == 0 ); + HDassert( cache_ptr->clean_index_size == 0 ); + HDassert( cache_ptr->dirty_index_size == 0 ); + HDassert( cache_ptr->slist_len == 0 ); + HDassert( cache_ptr->slist_size == 0 ); + HDassert( cache_ptr->pel_len == 0 ); + HDassert( cache_ptr->pel_size == 0 ); + HDassert( cache_ptr->pl_len == 0 ); + HDassert( cache_ptr->pl_size == 0 ); + HDassert( cache_ptr->LRU_list_len == 0 ); + HDassert( cache_ptr->LRU_list_size == 0 ); + HDassert( protected_entries <= cache_ptr->pl_len ); diff --git a/src/H5Cprivate.h b/src/H5Cprivate.h index 5524f2b..5c7fe9f 100644 --- a/src/H5Cprivate.h +++ b/src/H5Cprivate.h @@ -1026,8 +1026,6 @@ H5_DLL herr_t H5C_dest(H5F_t * f, hid_t secondary_dxpl_id, H5C_t * cache_ptr); -H5_DLL herr_t H5C_dest_empty(H5C_t * cache_ptr); - H5_DLL herr_t H5C_expunge_entry(H5F_t * f, hid_t primary_dxpl_id, hid_t secondary_dxpl_id, diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index 2c8ef5d..f05b3ce 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -181,7 +181,7 @@ static herr_t H5D_chunk_read(H5D_io_info_t *io_info, const H5D_type_info_t *type static herr_t H5D_chunk_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_t nelmts, const H5S_t *file_space, const H5S_t *mem_space, H5D_chunk_map_t *fm); -static herr_t H5D_chunk_flush(H5D_t *dset, hid_t dxpl_id, unsigned flags); +static herr_t H5D_chunk_flush(H5D_t *dset, hid_t dxpl_id); static herr_t H5D_chunk_io_term(const H5D_chunk_map_t *fm); /* "Nonexistent" layout operation callback */ @@ -1958,14 +1958,14 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5D_chunk_flush(H5D_t *dset, hid_t dxpl_id, unsigned flags) +H5D_chunk_flush(H5D_t *dset, hid_t dxpl_id) { H5D_dxpl_cache_t _dxpl_cache; /* Data transfer property cache buffer */ H5D_dxpl_cache_t *dxpl_cache = &_dxpl_cache; /* Data transfer property cache */ H5D_rdcc_t *rdcc = &(dset->shared->cache.chunk); - unsigned nerrors = 0; H5D_rdcc_ent_t *ent, *next; - herr_t ret_value = SUCCEED; /* Return value */ + unsigned nerrors = 0; /* Count of any errors encountered when flushing chunks */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5D_chunk_flush) @@ -1983,16 +1983,11 @@ H5D_chunk_flush(H5D_t *dset, hid_t dxpl_id, unsigned flags) /* Loop over all entries in the chunk cache */ for(ent = rdcc->head; ent; ent = next) { next = ent->next; - if((flags & H5F_FLUSH_INVALIDATE)) { - if(H5D_chunk_cache_evict(dset, dxpl_id, dxpl_cache, ent, TRUE) < 0) - nerrors++; - } else { - if(H5D_chunk_flush_entry(dset, dxpl_id, dxpl_cache, ent, FALSE) < 0) - nerrors++; - } + if(H5D_chunk_flush_entry(dset, dxpl_id, dxpl_cache, ent, FALSE) < 0) + nerrors++; } /* end for */ if(nerrors) - HGOTO_ERROR(H5E_IO, H5E_CANTFLUSH, FAIL, "unable to flush one or more raw data chunks") + HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to flush one or more raw data chunks") done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5Dcompact.c b/src/H5Dcompact.c index a33a62e..a3ce68a 100644 --- a/src/H5Dcompact.c +++ b/src/H5Dcompact.c @@ -69,7 +69,7 @@ static ssize_t H5D_compact_readvv(const H5D_io_info_t *io_info, static ssize_t H5D_compact_writevv(const H5D_io_info_t *io_info, size_t dset_max_nseq, size_t *dset_curr_seq, size_t dset_size_arr[], hsize_t dset_offset_arr[], size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_size_arr[], hsize_t mem_offset_arr[]); -static herr_t H5D_compact_flush(H5D_t *dset, hid_t dxpl_id, unsigned flags); +static herr_t H5D_compact_flush(H5D_t *dset, hid_t dxpl_id); /*********************/ @@ -350,7 +350,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5D_compact_flush(H5D_t *dset, hid_t dxpl_id, unsigned UNUSED flags) +H5D_compact_flush(H5D_t *dset, hid_t dxpl_id) { herr_t ret_value = SUCCEED; /* Return value */ diff --git a/src/H5Dcontig.c b/src/H5Dcontig.c index 712b17c..0ff3964 100644 --- a/src/H5Dcontig.c +++ b/src/H5Dcontig.c @@ -65,7 +65,7 @@ static herr_t H5D_contig_construct(H5F_t *f, H5D_t *dset); static herr_t H5D_contig_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_t nelmts, const H5S_t *file_space, const H5S_t *mem_space, H5D_chunk_map_t *cm); -static herr_t H5D_contig_flush(H5D_t *dset, hid_t dxpl_id, unsigned flags); +static herr_t H5D_contig_flush(H5D_t *dset, hid_t dxpl_id); /* Helper routines */ static herr_t H5D_contig_write_one(H5D_io_info_t *io_info, hsize_t offset, @@ -1186,7 +1186,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5D_contig_flush(H5D_t *dset, hid_t dxpl_id, unsigned UNUSED flags) +H5D_contig_flush(H5D_t *dset, hid_t dxpl_id) { herr_t ret_value = SUCCEED; /* Return value */ diff --git a/src/H5Defl.c b/src/H5Defl.c index af57eff..7ce0c67 100644 --- a/src/H5Defl.c +++ b/src/H5Defl.c @@ -50,7 +50,7 @@ /* Layout operation callbacks */ static herr_t H5D_efl_construct(H5F_t *f, H5D_t *dset); -static hbool_t H5D_efl_is_space_alloc(const H5O_layout_t *layout); +static hbool_t H5D_efl_is_space_alloc(const H5O_storage_t *storage); static herr_t H5D_efl_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_t nelmts, const H5S_t *file_space, const H5S_t *mem_space, H5D_chunk_map_t *cm); @@ -182,14 +182,14 @@ done: *------------------------------------------------------------------------- */ static hbool_t -H5D_efl_is_space_alloc(const H5O_layout_t UNUSED *layout) +H5D_efl_is_space_alloc(const H5O_storage_t UNUSED *storage) { FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_efl_is_space_alloc) /* Sanity checks */ - HDassert(layout); + HDassert(storage); - /* EFL storage is currently treated as allocated */ + /* EFL storage is currently always treated as allocated */ FUNC_LEAVE_NOAPI(TRUE) } /* end H5D_efl_is_space_alloc() */ diff --git a/src/H5Dint.c b/src/H5Dint.c index 6709628..8ad3736 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -48,7 +48,6 @@ typedef struct { const H5F_t *f; /* Pointer to file being flushed */ hid_t dxpl_id; /* DXPL for I/O operations */ - unsigned flags; /* Flags for flush operation */ } H5D_flush_ud_t; @@ -66,7 +65,7 @@ static herr_t H5D_init_space(H5F_t *file, const H5D_t *dset, const H5S_t *space) static herr_t H5D_update_oh_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset, hid_t dapl_id); static herr_t H5D_open_oid(H5D_t *dataset, hid_t dapl_id, hid_t dxpl_id); -static herr_t H5D_flush_real(H5D_t *dataset, hid_t dxpl_id, unsigned flags); +static herr_t H5D_flush_real(H5D_t *dataset, hid_t dxpl_id); /*********************/ @@ -1365,7 +1364,7 @@ H5D_close(H5D_t *dataset) dataset->shared->fo_count--; if(dataset->shared->fo_count == 0) { /* Flush the dataset's information */ - if(H5D_flush_real(dataset, H5AC_dxpl_id, H5F_FLUSH_NONE) < 0) + if(H5D_flush_real(dataset, H5AC_dxpl_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to flush cached dataset info") /* Free the data sieve buffer, if it's been allocated */ @@ -2238,7 +2237,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5D_flush_real(H5D_t *dataset, hid_t dxpl_id, unsigned flags) +H5D_flush_real(H5D_t *dataset, hid_t dxpl_id) { H5O_t *oh = NULL; /* Pointer to dataset's object header */ herr_t ret_value = SUCCEED; /* Return value */ @@ -2282,7 +2281,7 @@ H5D_flush_real(H5D_t *dataset, hid_t dxpl_id, unsigned flags) /* Flush cached raw data for each kind of dataset layout */ if(dataset->shared->layout.ops->flush && - (dataset->shared->layout.ops->flush)(dataset, dxpl_id, flags) < 0) + (dataset->shared->layout.ops->flush)(dataset, dxpl_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to flush raw data") done: @@ -2323,7 +2322,7 @@ H5D_flush_cb(void *_dataset, hid_t UNUSED id, void *_udata) /* Check for dataset in same file */ if(udata->f == dataset->oloc.file) { /* Flush the dataset's information */ - if(H5D_flush_real(dataset, udata->dxpl_id, udata->flags) < 0) + if(H5D_flush_real(dataset, udata->dxpl_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, H5_ITER_ERROR, "unable to flush cached dataset info") } /* end if */ @@ -2346,7 +2345,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5D_flush(const H5F_t *f, hid_t dxpl_id, unsigned flags) +H5D_flush(const H5F_t *f, hid_t dxpl_id) { H5D_flush_ud_t udata; /* User data for callback */ herr_t ret_value = SUCCEED; /* Return value */ @@ -2359,7 +2358,6 @@ H5D_flush(const H5F_t *f, hid_t dxpl_id, unsigned flags) /* Set user data for callback */ udata.f = f; udata.dxpl_id = dxpl_id; - udata.flags = flags; /* Iterate over all the open datasets */ H5I_search(H5I_DATASET, H5D_flush_cb, &udata, FALSE); diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h index 6ccb9c5..6790212 100644 --- a/src/H5Dpkg.h +++ b/src/H5Dpkg.h @@ -130,8 +130,7 @@ typedef ssize_t (*H5D_layout_readvv_func_t)(const struct H5D_io_info_t *io_info, typedef ssize_t (*H5D_layout_writevv_func_t)(const struct H5D_io_info_t *io_info, size_t dset_max_nseq, size_t *dset_curr_seq, size_t dset_len_arr[], hsize_t dset_offset_arr[], size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_offset_arr[]); -typedef herr_t (*H5D_layout_flush_func_t)(H5D_t *dataset, hid_t dxpl_id, - unsigned flags); +typedef herr_t (*H5D_layout_flush_func_t)(H5D_t *dataset, hid_t dxpl_id); typedef herr_t (*H5D_layout_io_term_func_t)(const struct H5D_chunk_map_t *cm); /* Typedef for grouping layout I/O routines */ diff --git a/src/H5Dprivate.h b/src/H5Dprivate.h index d5a1d16..3f5e379 100644 --- a/src/H5Dprivate.h +++ b/src/H5Dprivate.h @@ -163,7 +163,7 @@ H5_DLL herr_t H5D_close(H5D_t *dataset); H5_DLL H5O_loc_t *H5D_oloc(H5D_t *dataset); H5_DLL H5G_name_t *H5D_nameof(H5D_t *dataset); H5_DLL H5T_t *H5D_typeof(const H5D_t *dset); -H5_DLL herr_t H5D_flush(const H5F_t *f, hid_t dxpl_id, unsigned flags); +H5_DLL herr_t H5D_flush(const H5F_t *f, hid_t dxpl_id); /* Functions that operate on vlen data */ H5_DLL herr_t H5D_vlen_reclaim(hid_t type_id, H5S_t *space, hid_t plist_id, @@ -71,7 +71,6 @@ static herr_t H5F_get_vfd_handle(const H5F_t *file, hid_t fapl, void** file_hand static H5F_t *H5F_new(H5F_file_t *shared, hid_t fcpl_id, hid_t fapl_id, H5FD_t *lf); static herr_t H5F_dest(H5F_t *f, hid_t dxpl_id); -static herr_t H5F_flush(H5F_t *f, hid_t dxpl_id, H5F_scope_t scope, unsigned flags); static herr_t H5F_close(H5F_t *f); /* Declare a free list to manage the H5F_t struct */ @@ -890,7 +889,7 @@ H5F_new(H5F_file_t *shared, hid_t fcpl_id, hid_t fapl_id, H5FD_t *lf) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get byte number for address") if(H5P_get(plist, H5F_CRT_OBJ_BYTE_NUM_NAME, &f->shared->sizeof_size) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get byte number for object size") - if(H5P_get(plist, H5F_CRT_SHMSG_NINDEXES_NAME, &f->shared->sohm_nindexes)<0) + if(H5P_get(plist, H5F_CRT_SHMSG_NINDEXES_NAME, &f->shared->sohm_nindexes) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get number of SOHM indexes") HDassert(f->shared->sohm_nindexes < 255); @@ -1020,22 +1019,22 @@ H5F_dest(H5F_t *f, hid_t dxpl_id) H5AC_stats(f); #endif /* H5AC_DUMP_STATS_ON_CLOSE */ - /* Flush all caches and indicate we are closing the file */ - if(H5F_flush(f, dxpl_id, H5F_SCOPE_LOCAL, H5F_FLUSH_CLOSING) < 0) + /* Shutdown file free space manager(s) */ + /* (We should release the free space information now (before truncating + * the file and before the metadata cache is shut down) since the + * free space manager is holding some data structures in memory + * and also because releasing free space can shrink the file's + * 'eoa' value) + */ + if(H5MF_close(f, dxpl_id) < 0) /* Push error, but keep going*/ - HDONE_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush cache") + HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't release file free space info") /* Unpin the superblock, since we're about to destroy the cache */ if(H5AC_unpin_entry(f, f->shared->sblock) < 0) /* Push error, but keep going*/ HDONE_ERROR(H5E_FSPACE, H5E_CANTUNPIN, FAIL, "unable to unpin superblock") f->shared->sblock = NULL; - - /* Flush all caches and indicate all cached objects should be invalidated */ - /* (The caches should already be clean and we should just be invalidating objects) */ - if(H5F_flush(f, dxpl_id, H5F_SCOPE_LOCAL, H5F_FLUSH_INVALIDATE) < 0) - /* Push error, but keep going*/ - HDONE_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush cache") } /* end if */ /* Remove shared file struct from list of open files */ @@ -1043,6 +1042,11 @@ H5F_dest(H5F_t *f, hid_t dxpl_id) /* Push error, but keep going*/ HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "problems closing file") + /* Shutdown the metadata cache */ + if(H5AC_dest(f, dxpl_id)) + /* Push error, but keep going*/ + HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "problems closing file") + /* * Do not close the root group since we didn't count it, but free * the memory associated with it. @@ -1061,10 +1065,7 @@ H5F_dest(H5F_t *f, hid_t dxpl_id) } /* end if */ /* Destroy other components of the file */ - if(H5AC_dest(f, dxpl_id)) - /* Push error, but keep going*/ - HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "problems closing file") - if(H5F_accum_reset(f) < 0) + if(H5F_accum_reset(f, dxpl_id) < 0) /* Push error, but keep going*/ HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "problems closing file") if(H5FO_dest(f) < 0) @@ -1083,10 +1084,18 @@ H5F_dest(H5F_t *f, hid_t dxpl_id) /* Push error, but keep going*/ HDONE_ERROR(H5E_PLIST, H5E_CANTFREE, FAIL, "can't close property list") - /* Close low-level file */ + /* Only truncate the file on an orderly close, with write-access */ + if(f->closing && (H5F_ACC_RDWR & f->shared->flags)) { + /* Truncate the file to the current allocated size */ + if(H5FD_truncate(f->shared->lf, dxpl_id, (unsigned)TRUE) < 0) + /* Push error, but keep going*/ + HDONE_ERROR(H5E_FILE, H5E_WRITEERROR, FAIL, "low level truncate failed") + } /* end if */ + + /* Close the file */ if(H5FD_close(f->shared->lf) < 0) /* Push error, but keep going*/ - HDONE_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "problems closing file") + HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "unable to close file") /* Free mount table */ f->shared->mtab.child = (H5F_mount_t *)H5MM_xfree(f->shared->mtab.child); @@ -1627,8 +1636,26 @@ H5Fflush(hid_t object_id, H5F_scope_t scope) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "object is not associated with a file") /* Flush the file */ - if(H5F_flush(f, H5AC_dxpl_id, scope, H5F_FLUSH_NONE) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "flush failed") + /* + * Nothing to do if the file is read only. This determination is + * made at the shared open(2) flags level, implying that opening a + * file twice, once for read-only and once for read-write, and then + * calling H5Fflush() with the read-only handle, still causes data + * to be flushed. + */ + if(H5F_ACC_RDWR & f->shared->flags) { + /* Flush other files, depending on scope */ + if(H5F_SCOPE_GLOBAL == scope) { + /* Call the flush routine for mounted file hierarchies */ + if(H5F_flush_mounts(f, H5AC_dxpl_id) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush mounted file hierarchy") + } /* end if */ + else { + /* Call the flush routine, for this file */ + if(H5F_flush(f, H5AC_dxpl_id) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush file's cached information") + } /* end else */ + } /* end if */ done: FUNC_LEAVE_API(ret_value) @@ -1638,9 +1665,7 @@ done: /*------------------------------------------------------------------------- * Function: H5F_flush * - * Purpose: Flushes (and optionally invalidates) cached data plus the - * file superblock. If the logical file size field is zero - * then it is updated to be the length of the superblock. + * Purpose: Flushes cached data. * * Return: Non-negative on success/Negative on failure * @@ -1650,81 +1675,45 @@ done: * *------------------------------------------------------------------------- */ -static herr_t -H5F_flush(H5F_t *f, hid_t dxpl_id, H5F_scope_t scope, unsigned flags) +herr_t +H5F_flush(H5F_t *f, hid_t dxpl_id) { - unsigned nerrors = 0; /* Errors from nested flushes */ - unsigned i; /* Index variable */ - unsigned int H5AC_flags; /* translated flags for H5AC_flush() */ - herr_t ret_value; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT(H5F_flush) + FUNC_ENTER_NOAPI(H5F_flush, FAIL) /* Sanity check arguments */ HDassert(f); - /* - * Nothing to do if the file is read only. This determination is - * made at the shared open(2) flags level, implying that opening a - * file twice, once for read-only and once for read-write, and then - * calling H5F_flush() with the read-only handle, still causes data - * to be flushed. - */ - if(0 == (H5F_ACC_RDWR & f->shared->flags)) - HGOTO_DONE(SUCCEED) - - /* Flush other files, depending on scope */ - if(H5F_SCOPE_GLOBAL == scope) { - while(f->parent) - f = f->parent; - - scope = H5F_SCOPE_DOWN; - } /* end while */ - if(H5F_SCOPE_DOWN == scope) - for(i = 0; i < f->shared->mtab.nmounts; i++) - if(H5F_flush(f->shared->mtab.child[i].file, dxpl_id, scope, flags) < 0) - nerrors++; - /* Flush any cached dataset storage raw data */ - if(H5D_flush(f, dxpl_id, flags) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush dataset cache") - - /* If we will be closing the file, we should release the free space - * information now (needs to happen before truncating the file and - * before the metadata cache is shut down, since the free space manager is - * holding some data structures in memory and also because releasing free - * space can shrink the file's 'eoa' value) - */ - if(flags & H5F_FLUSH_CLOSING) { - /* Shutdown file free space manager(s) */ - if(H5MF_close(f, dxpl_id) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't release file free space info") - } /* end if */ + if(H5D_flush(f, dxpl_id) < 0) + /* Push error, but keep going*/ + HDONE_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush dataset cache") - /* Truncate the file to the current allocated size */ - /* (needs to happen before superblock write, since the 'eoa' value is - * written in superblock -QAK) + /* Release any space allocated to space aggregators, so that the eoa value + * corresponds to the end of the space written to in the file. */ - if(H5FD_truncate(f->shared->lf, dxpl_id, (unsigned)((flags & H5F_FLUSH_CLOSING) > 0)) < 0) - HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "low level truncate failed") + /* (needs to happen before cache flush, with superblock write, since the + * 'eoa' value is written in superblock -QAK) + */ + if(H5MF_free_aggrs(f, dxpl_id) < 0) + /* Push error, but keep going*/ + HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't release file space") - /* Flush (and invalidate, if requested) the entire metadata cache */ - H5AC_flags = 0; - if((flags & H5F_FLUSH_INVALIDATE) != 0 ) - H5AC_flags |= H5AC__FLUSH_INVALIDATE_FLAG; - if(H5AC_flush(f, dxpl_id, H5AC_flags) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush metadata cache") + /* Flush the entire metadata cache */ + if(H5AC_flush(f, dxpl_id) < 0) + /* Push error, but keep going*/ + HDONE_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush metadata cache") /* Flush out the metadata accumulator */ if(H5F_accum_flush(f, dxpl_id) < 0) - HGOTO_ERROR(H5E_IO, H5E_CANTFLUSH, FAIL, "unable to flush metadata accumulator") + /* Push error, but keep going*/ + HDONE_ERROR(H5E_IO, H5E_CANTFLUSH, FAIL, "unable to flush metadata accumulator") /* Flush file buffers to disk. */ - if(H5FD_flush(f->shared->lf, dxpl_id, (unsigned)((flags & H5F_FLUSH_CLOSING) > 0)) < 0) - HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "low level flush failed") - - /* Check flush errors for children - errors are already on the stack */ - ret_value = (nerrors ? FAIL : SUCCEED); + if(H5FD_flush(f->shared->lf, dxpl_id, FALSE) < 0) + /* Push error, but keep going*/ + HDONE_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "low level flush failed") done: FUNC_LEAVE_NOAPI(ret_value) @@ -1933,8 +1922,8 @@ H5F_try_close(H5F_t *f) * Only try to flush the file if it was opened with write access. */ if(f->intent&H5F_ACC_RDWR) { - /* Flush and destroy all caches */ - if(H5F_flush(f, H5AC_dxpl_id, H5F_SCOPE_LOCAL, H5AC__NO_FLAGS_SET) < 0) + /* Flush all caches */ + if(H5F_flush(f, H5AC_dxpl_id) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush cache") } /* end if */ @@ -2873,7 +2862,7 @@ H5Fget_info(hid_t obj_id, H5F_info_t *finfo) /* Check for superblock extension info */ if(H5F_super_size(f, H5AC_ind_dxpl_id, NULL, &finfo->super_ext_size) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "Unable to retrieve superblock sizes") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "Unable to retrieve superblock extension size") /* Check for SOHM info */ if(H5F_addr_defined(f->shared->sohm_addr)) @@ -1126,14 +1126,11 @@ done: * the `open' callback. * * Return: Success: Non-negative - * * Failure: Negative * * Programmer: Robb Matzke * Tuesday, July 27, 1999 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -1148,11 +1145,11 @@ H5FDclose(H5FD_t *file) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file pointer") if(H5FD_close(file) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "unable to close file") + HGOTO_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL, "unable to close file") done: FUNC_LEAVE_API(ret_value) -} +} /* end H5FDclose() */ /*------------------------------------------------------------------------- @@ -1161,22 +1158,11 @@ done: * Purpose: Private version of H5FDclose() * * Return: Success: Non-negative - * * Failure: Negative * * Programmer: Robb Matzke * Wednesday, August 4, 1999 * - * Modifications: - * Robb Matzke, 2000-11-10 - * Removed a call to set *file to all zero because the struct - * has already been freed by the close method. This fixes a write - * to freed memory. - * - * Bill Wendling, 2003-02-17 - * Split out the freeing of the freelist from this function - * so that the Flexible PHDF5 stuff can call it without - * having to call H5FD_close(). *------------------------------------------------------------------------- */ herr_t @@ -1201,7 +1187,7 @@ H5FD_close(H5FD_t *file) */ HDassert(driver->close); if((driver->close)(file) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "close failed") + HGOTO_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL, "close failed") done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5FDcore.c b/src/H5FDcore.c index 1e30ace..a08abdd 100644 --- a/src/H5FDcore.c +++ b/src/H5FDcore.c @@ -484,33 +484,33 @@ done: * Programmer: Robb Matzke * Thursday, July 29, 1999 * - * Modifications: - * Robb Matzke, 1999-10-19 - * The contents of memory are written to the backing store if - * one is open. *------------------------------------------------------------------------- */ static herr_t H5FD_core_close(H5FD_t *_file) { H5FD_core_t *file = (H5FD_core_t*)_file; - herr_t ret_value=SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5FD_core_close, FAIL) + /* Flush any changed buffers */ + if(H5FD_core_flush(_file, (hid_t)-1, TRUE) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush file") + /* Release resources */ - if (file->fd>=0) + if(file->fd >= 0) HDclose(file->fd); - if (file->name) + if(file->name) H5MM_xfree(file->name); - if (file->mem) + if(file->mem) H5MM_xfree(file->mem); HDmemset(file, 0, sizeof(H5FD_core_t)); H5MM_xfree(file); done: FUNC_LEAVE_NOAPI(ret_value) -} +} /* end H5FD_core_close() */ /*------------------------------------------------------------------------- @@ -973,7 +973,7 @@ H5FD_core_truncate(H5FD_t *_file, hid_t UNUSED dxpl_id, hbool_t UNUSED closing) new_eof += file->increment; /* Extend the file to make sure it's large enough */ - if(!H5F_addr_eq((haddr_t)new_eof, file->eof)) { + if(!H5F_addr_eq(file->eof, (haddr_t)new_eof)) { unsigned char *x; /* Pointer to new buffer for file data */ /* (Re)allocate memory for the file buffer */ diff --git a/src/H5FDprivate.h b/src/H5FDprivate.h index 6b2e4fe..fc38566 100644 --- a/src/H5FDprivate.h +++ b/src/H5FDprivate.h @@ -72,7 +72,7 @@ H5_DLL herr_t H5FD_read(H5FD_t *file, hid_t dxpl_id, H5FD_mem_t type, haddr_t addr, size_t size, void *buf/*out*/); H5_DLL herr_t H5FD_write(H5FD_t *file, hid_t dxpl_id, H5FD_mem_t type, haddr_t addr, size_t size, const void *buf); -H5_DLL herr_t H5FD_flush(H5FD_t *file, hid_t dxpl_id, unsigned closing); +H5_DLL herr_t H5FD_flush(H5FD_t *file, hid_t dxpl_id, hbool_t closing); H5_DLL herr_t H5FD_truncate(H5FD_t *file, hid_t dxpl_id, hbool_t closing); H5_DLL herr_t H5FD_get_fileno(const H5FD_t *file, unsigned long *filenum); H5_DLL herr_t H5FD_get_vfd_handle(H5FD_t *file, hid_t fapl, void** file_handle); diff --git a/src/H5FDsec2.c b/src/H5FDsec2.c index 0b4632d..c2d74a9 100644 --- a/src/H5FDsec2.c +++ b/src/H5FDsec2.c @@ -397,7 +397,7 @@ H5FD_sec2_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) /* Get the FAPL */ if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list") + HGOTO_ERROR(H5E_VFL, H5E_BADTYPE, NULL, "not a file access property list") /* This step is for h5repart tool only. If user wants to change file driver from * family to sec2 while using h5repart, this private property should be set so that @@ -406,7 +406,7 @@ H5FD_sec2_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) */ if(H5P_exist_plist(plist, H5F_ACS_FAMILY_TO_SEC2_NAME) > 0) if(H5P_get(plist, H5F_ACS_FAMILY_TO_SEC2_NAME, &file->fam_to_sec2) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get property of changing family to sec2") + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, NULL, "can't get property of changing family to sec2") } /* end if */ /* Set return value */ @@ -535,7 +535,6 @@ done: * *------------------------------------------------------------------------- */ -/* ARGSUSED */ static herr_t H5FD_sec2_query(const H5FD_t *_file, unsigned long *flags /* out */) { diff --git a/src/H5FDwindows.c b/src/H5FDwindows.c index 37228d7..aca03c8 100644 --- a/src/H5FDwindows.c +++ b/src/H5FDwindows.c @@ -91,7 +91,11 @@ typedef struct H5FD_windows_t { */ DWORD fileindexlo; DWORD fileindexhi; - DWORD volumeserialnumber; + DWORD volumeserialnumber; + + /* Information from properties set by 'h5repart' tool */ + hbool_t fam_to_sec2; /* Whether to eliminate the family driver info + * and convert this file to a single file */ } H5FD_windows_t; @@ -401,13 +405,31 @@ H5FD_windows_open(const char *name, unsigned flags, hid_t UNUSED fapl_id, file->write_access=write_access; /* Note the write_access for later */ #endif /* WINDOWS_USE_STDIO */ - if( (filehandle = (HANDLE)_get_osfhandle(fd)) == INVALID_HANDLE_VALUE) - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to get file handle for file") + if( (filehandle = (HANDLE)_get_osfhandle(fd)) == INVALID_HANDLE_VALUE) + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to get file handle for file") if(!GetFileInformationByHandle(filehandle, &fileinfo)) - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to get file information") + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to get file information") file->fileindexhi = fileinfo.nFileIndexHigh; file->fileindexlo = fileinfo.nFileIndexLow; - file->volumeserialnumber = fileinfo.dwVolumeSerialNumber; + file->volumeserialnumber = fileinfo.dwVolumeSerialNumber; + + /* Check for non-default FAPL */ + if(H5P_FILE_ACCESS_DEFAULT != fapl_id) { + H5P_genplist_t *plist; /* Property list pointer */ + + /* Get the FAPL */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) + HGOTO_ERROR(H5E_VFL, H5E_BADTYPE, NULL, "not a file access property list") + + /* This step is for h5repart tool only. If user wants to change file driver from + * family to sec2 while using h5repart, this private property should be set so that + * in the later step, the library can ignore the family driver information saved + * in the superblock. + */ + if(H5P_exist_plist(plist, H5F_ACS_FAMILY_TO_SEC2_NAME) > 0) + if(H5P_get(plist, H5F_ACS_FAMILY_TO_SEC2_NAME, &file->fam_to_sec2) < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, NULL, "can't get property of changing family to sec2") + } /* end if */ /* Set return value */ ret_value=(H5FD_t*)file; @@ -520,17 +542,14 @@ done: Based on code by Quincey Koziol * Thursday, May 24 2007 * - * Modifications: - * *------------------------------------------------------------------------- */ -/* ARGSUSED */ static herr_t -H5FD_windows_query(const H5FD_t UNUSED * _f, unsigned long *flags /* out */) +H5FD_windows_query(const H5FD_t *_file, unsigned long *flags /* out */) { - herr_t ret_value=SUCCEED; + const H5FD_windows_t *file = (const H5FD_windows_t*)_file; /* windows VFD info */ - FUNC_ENTER_NOAPI(H5FD_windows_query, FAIL) + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5FD_windows_query) /* Set the VFL feature flags that this driver supports */ if(flags) { @@ -539,11 +558,15 @@ H5FD_windows_query(const H5FD_t UNUSED * _f, unsigned long *flags /* out */) *flags|=H5FD_FEAT_ACCUMULATE_METADATA; /* OK to accumulate metadata for faster writes */ *flags|=H5FD_FEAT_DATA_SIEVE; /* OK to perform data sieving for faster raw data reads & writes */ *flags|=H5FD_FEAT_AGGREGATE_SMALLDATA; /* OK to aggregate "small" raw data allocations */ - } + + /* Check for flags that are set by h5repart */ + if(file->fam_to_sec2) + *flags |= H5FD_FEAT_IGNORE_DRVRINFO; /* Ignore the driver info when file is opened (which eliminates it) */ + } /* end if */ done: - FUNC_LEAVE_NOAPI(ret_value) -} + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5FD_windows_query() */ /*------------------------------------------------------------------------- * Function: H5FD_windows_get_eoa diff --git a/src/H5FSprivate.h b/src/H5FSprivate.h index e5763a5..056449d 100644 --- a/src/H5FSprivate.h +++ b/src/H5FSprivate.h @@ -184,7 +184,7 @@ H5_DLL herr_t H5FS_close(H5F_t *f, hid_t dxpl_id, H5FS_t *fspace); /* Free space section routines */ H5_DLL herr_t H5FS_sect_add(H5F_t *f, hid_t dxpl_id, H5FS_t *fspace, H5FS_section_info_t *node, unsigned flags, void *op_data); -H5_DLL herr_t H5FS_sect_try_extend(H5F_t *f, hid_t dxpl_id, H5FS_t *fspace, +H5_DLL htri_t H5FS_sect_try_extend(H5F_t *f, hid_t dxpl_id, H5FS_t *fspace, haddr_t addr, hsize_t size, hsize_t extra_requested); H5_DLL herr_t H5FS_sect_remove(H5F_t *f, hid_t dxpl_id, H5FS_t *fspace, H5FS_section_info_t *node); diff --git a/src/H5Faccum.c b/src/H5Faccum.c index d4e142b..d8b9820 100644 --- a/src/H5Faccum.c +++ b/src/H5Faccum.c @@ -722,13 +722,19 @@ done: *------------------------------------------------------------------------- */ herr_t -H5F_accum_reset(H5F_t *f) +H5F_accum_reset(H5F_t *f, hid_t dxpl_id) { - FUNC_ENTER_NOAPI_NOFUNC(H5F_accum_reset) + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(H5F_accum_reset, FAIL) HDassert(f); HDassert(f->shared); + /* Flush any dirty data in accumulator */ + if(H5F_accum_flush(f, dxpl_id) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "can't flush metadata accumulator") + /* Check if we need to reset the metadata accumulator information */ if(f->shared->feature_flags & H5FD_FEAT_ACCUMULATE_METADATA) { /* Sanity check */ @@ -744,7 +750,7 @@ H5F_accum_reset(H5F_t *f) f->shared->accum.dirty = FALSE; } /* end if */ - FUNC_LEAVE_NOAPI(SUCCEED) +done: + FUNC_LEAVE_NOAPI(ret_value) } /* end H5F_accum_reset() */ - diff --git a/src/H5Fmount.c b/src/H5Fmount.c index ff4b1eb..f70a7c6 100644 --- a/src/H5Fmount.c +++ b/src/H5Fmount.c @@ -627,3 +627,80 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5F_mount_count_ids() */ + +/*------------------------------------------------------------------------- + * Function: H5F_flush_mounts_recurse + * + * Purpose: Flush a mount hierarchy, recursively + * + * Return: SUCCEED/FAIL + * + * Programmer: Quincey Koziol + * Fri, August 21, 2009 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5F_flush_mounts_recurse(H5F_t *f, hid_t dxpl_id) +{ + unsigned nerrors = 0; /* Errors from recursive flushes */ + unsigned u; /* Index variable */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT(H5F_flush_mounts_recurse) + + /* Sanity check */ + HDassert(f); + + /* Flush all child files, not stopping for errors */ + for(u = 0; u < f->shared->mtab.nmounts; u++) + if(H5F_flush_mounts_recurse(f->shared->mtab.child[u].file, dxpl_id) < 0) + nerrors++; + + /* Call the "real" flush routine, for this file */ + if(H5F_flush(f, dxpl_id) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush file's cached information") + + /* Check flush errors for children - errors are already on the stack */ + if(nerrors) + HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush file's child mounts") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5F_flush_mounts_recurse() */ + + +/*------------------------------------------------------------------------- + * Function: H5F_flush_mounts + * + * Purpose: Flush a mount hierarchy + * + * Return: SUCCEED/FAIL + * + * Programmer: Quincey Koziol + * Fri, August 21, 2009 + * + *------------------------------------------------------------------------- + */ +herr_t +H5F_flush_mounts(H5F_t *f, hid_t dxpl_id) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(H5F_flush_mounts, FAIL) + + /* Sanity check */ + HDassert(f); + + /* Find the top file in the mount hierarchy */ + while(f->parent) + f = f->parent; + + /* Flush the mounted file hierarchy */ + if(H5F_flush_mounts_recurse(f, dxpl_id) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush mounted file hierarchy") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5F_flush_mounts() */ + diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index c9d2f46..5fdde37 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -243,7 +243,7 @@ typedef struct H5F_file_t { /* (if aggregating "small data" allocations) */ /* Metadata accumulator information */ - H5F_meta_accum_t accum; /* Metadata accumulator info */ + H5F_meta_accum_t accum; /* Metadata accumulator info */ } H5F_file_t; /* @@ -288,11 +288,13 @@ H5_DLLVAR const H5AC_class_t H5AC_SUPERBLOCK[1]; /* General routines */ H5_DLL herr_t H5F_init(void); H5_DLL haddr_t H5F_locate_signature(H5FD_t *file, hid_t dxpl_id); +H5_DLL herr_t H5F_flush(H5F_t *f, hid_t dxpl_id); /* File mount related routines */ H5_DLL herr_t H5F_close_mounts(H5F_t *f); H5_DLL int H5F_term_unmount_cb(void *obj_ptr, hid_t obj_id, void *key); H5_DLL herr_t H5F_mount_count_ids(H5F_t *f, unsigned *nopen_files, unsigned *nopen_objs); +H5_DLL herr_t H5F_flush_mounts(H5F_t *f, hid_t dxpl_id); /* Superblock related routines */ H5_DLL herr_t H5F_super_init(H5F_t *f, hid_t dxpl_id); @@ -312,7 +314,7 @@ H5_DLL htri_t H5F_accum_write(const H5F_t *f, hid_t dxpl_id, H5FD_mem_t type, H5_DLL herr_t H5F_accum_free(H5F_t *f, hid_t dxpl_id, H5FD_mem_t type, haddr_t addr, hsize_t size); H5_DLL herr_t H5F_accum_flush(H5F_t *f, hid_t dxpl_id); -H5_DLL herr_t H5F_accum_reset(H5F_t *f); +H5_DLL herr_t H5F_accum_reset(H5F_t *f, hid_t dxpl_id); /* Shared file list related routines */ H5_DLL herr_t H5F_sfile_add(H5F_file_t *shared); diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index f2223d0..1e816f9 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -28,6 +28,7 @@ /* Private headers needed by this file */ + /****************************/ /* Library Private Typedefs */ /****************************/ @@ -38,16 +39,6 @@ typedef struct H5F_t H5F_t; /* Block aggregation structure */ typedef struct H5F_blk_aggr_t H5F_blk_aggr_t; -/*===----------------------------------------------------------------------=== - * Flush Flags - *===----------------------------------------------------------------------=== - * - * Flags passed into the flush routines which indicate what type of - * flush we want to do. They can be ORed together. - */ -#define H5F_FLUSH_NONE (0U) /* No flags specified */ -#define H5F_FLUSH_INVALIDATE (1U << 0) /* Invalidate cached data */ -#define H5F_FLUSH_CLOSING (1U << 1) /* Closing the file */ /* * Encode and decode macros for file meta-data. diff --git a/src/H5Fpublic.h b/src/H5Fpublic.h index 5d1c8c8..6392c9e 100644 --- a/src/H5Fpublic.h +++ b/src/H5Fpublic.h @@ -96,8 +96,7 @@ /* The difference between a single file and a set of mounted files */ typedef enum H5F_scope_t { H5F_SCOPE_LOCAL = 0, /*specified file handle only */ - H5F_SCOPE_GLOBAL = 1, /*entire virtual file */ - H5F_SCOPE_DOWN = 2 /*for internal use only */ + H5F_SCOPE_GLOBAL = 1 /*entire virtual file */ } H5F_scope_t; /* Unlimited file size for H5Pset_external() */ diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c index b0096cb..3be8069 100644 --- a/src/H5Fsuper.c +++ b/src/H5Fsuper.c @@ -704,7 +704,7 @@ H5F_super_ext_write_msg(H5F_t *f, hid_t dxpl_id, void *mesg, unsigned id, hbool_ htri_t status; /* Indicate whether the message exists or not */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT(H5F_super_ext_write_msg) + FUNC_ENTER_NOAPI(H5F_super_ext_write_msg, FAIL) /* Sanity checks */ HDassert(f); diff --git a/src/H5Fsuper_cache.c b/src/H5Fsuper_cache.c index 7df8f31..240ac9f 100644 --- a/src/H5Fsuper_cache.c +++ b/src/H5Fsuper_cache.c @@ -727,7 +727,9 @@ H5F_sblock_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5F_sup H5_ASSIGN_OVERFLOW(driver_size, H5FD_sb_size(f->shared->lf), hsize_t, size_t); if(driver_size > 0) { H5O_drvinfo_t drvinfo; /* Driver info */ + H5O_loc_t ext_loc; /* "Object location" for superblock extension */ uint8_t dbuf[H5F_MAX_DRVINFOBLOCK_SIZE]; /* Driver info block encoding buffer */ + htri_t status; /* Indicate whether the message exists or not */ /* Sanity check */ HDassert(driver_size <= H5F_MAX_DRVINFOBLOCK_SIZE); @@ -735,12 +737,20 @@ H5F_sblock_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5F_sup /* Encode driver-specific data */ if(H5FD_sb_encode(f->shared->lf, drvinfo.name, dbuf) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to encode driver information") + + /* Open the superblock extension's object header */ + if(H5F_super_ext_open(f, sblock->ext_addr, &ext_loc) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENOBJ, FAIL, "unable to open file's superblock extension") /* Write driver info information to the superblock extension */ drvinfo.len = driver_size; drvinfo.buf = dbuf; - if(H5F_super_ext_write_msg(f, dxpl_id, &drvinfo, H5O_DRVINFO_ID, FALSE) < 0) + if(H5O_msg_write(&ext_loc, H5O_DRVINFO_ID, H5O_MSG_FLAG_DONTSHARE, H5O_UPDATE_TIME, &drvinfo, dxpl_id) < 0) HGOTO_ERROR(H5E_FILE, H5E_WRITEERROR, FAIL, "unable to update driver info header message") + + /* Close the superblock extension object header */ + if(H5F_super_ext_close(f, &ext_loc) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEOBJ, FAIL, "unable to close file's superblock extension") } /* end if */ } /* end if */ } /* end if */ @@ -938,74 +938,6 @@ HDfprintf(stderr, "%s: Leaving, ret_value = %d\n", FUNC, ret_value); /*------------------------------------------------------------------------- - * Function: H5MF_free_aggrs - * - * Purpose: Reset a block aggregator, returning any space back to file - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Vailin Choi - * July 1st, 2009 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5MF_free_aggrs(H5F_t *f, hid_t dxpl_id) -{ - H5F_blk_aggr_t *first_aggr; /* First aggregator to reset */ - H5F_blk_aggr_t *second_aggr; /* Second aggregator to reset */ - haddr_t ma_addr = HADDR_UNDEF; /* Base "metadata aggregator" address */ - hsize_t ma_size = 0; /* Size of "metadata aggregator" */ - haddr_t sda_addr = HADDR_UNDEF; /* Base "small data aggregator" address */ - hsize_t sda_size = 0; /* Size of "small data aggregator" */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(H5MF_free_aggrs, FAIL) - - /* Check args */ - HDassert(f); - HDassert(f->shared); - HDassert(f->shared->lf); - - /* Retrieve metadata aggregator info, if available */ - if(H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "can't query metadata aggregator stats") - - /* Retrieve 'small data' aggregator info, if available */ - if(H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sda_addr, &sda_size) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "can't query small data aggregator stats") - - /* Make certain we release the aggregator that's later in the file first */ - /* (so the file shrinks properly) */ - if(H5F_addr_defined(ma_addr) && H5F_addr_defined(sda_addr)) { - if(H5F_addr_lt(ma_addr, sda_addr)) { - first_aggr = &(f->shared->sdata_aggr); - second_aggr = &(f->shared->meta_aggr); - } /* end if */ - else { - first_aggr = &(f->shared->meta_aggr); - second_aggr = &(f->shared->sdata_aggr); - } /* end else */ - } /* end if */ - else { - first_aggr = &(f->shared->meta_aggr); - second_aggr = &(f->shared->sdata_aggr); - } /* end else */ - - /* Release the unused portion of the metadata and "small data" blocks back - * to the free lists in the file. - */ - if(H5MF_aggr_reset(f, dxpl_id, first_aggr) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTFREE, FAIL, "can't reset metadata block") - if(H5MF_aggr_reset(f, dxpl_id, second_aggr) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTFREE, FAIL, "can't reset 'small data' block") -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5MF_free_aggrs() */ - - -/*------------------------------------------------------------------------- * Function: H5MF_close * * Purpose: Close the free space tracker(s) for a file @@ -1033,6 +965,11 @@ HDfprintf(stderr, "%s: Entering\n", FUNC); HDassert(f->shared); HDassert(f->shared->lf); + /* Free the space in aggregators */ + /* (for space not at EOF, it may be put into free space managers) */ + if(H5MF_free_aggrs(f, dxpl_id) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTFREE, FAIL, "can't free aggregators") + /* Iterate over all the free space types that have managers and get each free list's space */ for(type = H5FD_MEM_DEFAULT; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, type)) { #ifdef H5MF_ALLOC_DEBUG_MORE @@ -1083,6 +1020,8 @@ HDfprintf(stderr, "%s: Before deleting free space manager\n", FUNC); } /* end if */ } /* end for */ + /* Free the space in aggregators (again) */ + /* (in case any free space information re-started them) */ if(H5MF_free_aggrs(f, dxpl_id) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTFREE, FAIL, "can't free aggregators") diff --git a/src/H5MFaggr.c b/src/H5MFaggr.c index 0b1bc91..1435d18 100644 --- a/src/H5MFaggr.c +++ b/src/H5MFaggr.c @@ -227,7 +227,7 @@ HDfprintf(stderr, "%s: aggr = {%a, %Hu, %Hu}\n", FUNC, aggr->addr, aggr->tot_siz ((other_aggr->tot_size - other_aggr->size) >= other_aggr->alloc_size)) { if(H5FD_free(f->shared->lf, dxpl_id, other_alloc_type, f, other_aggr->addr, other_aggr->size) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, HADDR_UNDEF, "can't free aggregation block") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, HADDR_UNDEF, "can't free aggregation block") other_aggr->addr = 0; other_aggr->tot_size = 0; @@ -236,7 +236,7 @@ HDfprintf(stderr, "%s: aggr = {%a, %Hu, %Hu}\n", FUNC, aggr->addr, aggr->tot_siz /* Allocate space from the VFD (i.e. at the end of the file) */ if(HADDR_UNDEF == (ret_value = H5FD_alloc(f->shared->lf, dxpl_id, type, f, size, &eoa_frag_addr, &eoa_frag_size))) - HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, HADDR_UNDEF, "can't allocate aggregation block") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, HADDR_UNDEF, "can't allocate aggregation block") } /* end else */ } /* end if */ else { @@ -271,7 +271,7 @@ HDfprintf(stderr, "%s: Allocating block\n", FUNC); ((other_aggr->tot_size - other_aggr->size) >= other_aggr->alloc_size)) { if(H5FD_free(f->shared->lf, dxpl_id, other_alloc_type, f, other_aggr->addr, other_aggr->size) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, HADDR_UNDEF, "can't free aggregation block") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, HADDR_UNDEF, "can't free aggregation block") other_aggr->addr = 0; other_aggr->tot_size = 0; other_aggr->size = 0; @@ -279,12 +279,12 @@ HDfprintf(stderr, "%s: Allocating block\n", FUNC); /* Allocate space from the VFD (i.e. at the end of the file) */ if(HADDR_UNDEF == (new_space = H5FD_alloc(f->shared->lf, dxpl_id, alloc_type, f, aggr->alloc_size, &eoa_frag_addr, &eoa_frag_size))) - HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, HADDR_UNDEF, "can't allocate aggregation block") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, HADDR_UNDEF, "can't allocate aggregation block") /* Return the unused portion of the block to a free list */ if(aggr->size > 0) if(H5MF_xfree(f, alloc_type, dxpl_id, aggr->addr, aggr->size) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, HADDR_UNDEF, "can't free aggregation block") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, HADDR_UNDEF, "can't free aggregation block") /* Point the aggregator at the newly allocated block */ aggr->addr = new_space; @@ -301,12 +301,12 @@ HDfprintf(stderr, "%s: Allocating block\n", FUNC); /* Freeing any possible fragment due to file allocation */ if(eoa_frag_size) if(H5MF_xfree(f, type, dxpl_id, eoa_frag_addr, eoa_frag_size) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, HADDR_UNDEF, "can't free eoa fragment") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, HADDR_UNDEF, "can't free eoa fragment") /* Freeing any possible fragment due to alignment in the block after extension */ if(extended && frag_size) if(H5MF_xfree(f, type, dxpl_id, frag_addr, frag_size) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, HADDR_UNDEF, "can't free aggregation fragment") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, HADDR_UNDEF, "can't free aggregation fragment") } /* end if */ else { /* Allocate space out of the block */ @@ -317,7 +317,7 @@ HDfprintf(stderr, "%s: Allocating block\n", FUNC); /* free any possible fragment */ if (frag_size) if(H5MF_xfree(f, type, dxpl_id, frag_addr, frag_size) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, HADDR_UNDEF, "can't free aggregation fragment") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, HADDR_UNDEF, "can't free aggregation fragment") } /* end else */ } /* end if */ else { @@ -333,7 +333,7 @@ HDfprintf(stderr, "%s: Allocating block\n", FUNC); if(eoa_frag_size) /* Put fragment on the free list */ if(H5MF_xfree(f, type, dxpl_id, eoa_frag_addr, eoa_frag_size) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, HADDR_UNDEF, "can't free eoa fragment") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, HADDR_UNDEF, "can't free eoa fragment") } /* end else */ /* Sanity check for overlapping into file's temporary allocation space */ @@ -366,7 +366,7 @@ HDfprintf(stderr, "%s: ret_value = %a\n", FUNC, ret_value); *------------------------------------------------------------------------- */ htri_t -H5MF_aggr_try_extend(const H5F_t *f, H5F_blk_aggr_t *aggr, H5FD_mem_t type, +H5MF_aggr_try_extend(H5F_t *f, H5F_blk_aggr_t *aggr, H5FD_mem_t type, haddr_t blk_end, hsize_t extra_requested) { htri_t ret_value = FALSE; /* Return value */ @@ -605,13 +605,13 @@ H5MF_aggr_query(const H5F_t *f, const H5F_blk_aggr_t *aggr, haddr_t *addr, * *------------------------------------------------------------------------- */ -herr_t +static herr_t H5MF_aggr_reset(H5F_t *f, hid_t dxpl_id, H5F_blk_aggr_t *aggr) { H5FD_mem_t alloc_type; /* Type of file memory to work with */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5MF_aggr_reset, FAIL) + FUNC_ENTER_NOAPI_NOINIT(H5MF_aggr_reset) /* Check args */ HDassert(f); @@ -640,11 +640,80 @@ HDfprintf(stderr, "%s: tmp_addr = %a, tmp_size = %Hu\n", FUNC, tmp_addr, tmp_siz /* Return the unused portion of the metadata block to the file */ if(tmp_size > 0 && (H5F_INTENT(f) & H5F_ACC_RDWR)) - if(H5FD_free(f->shared->lf, dxpl_id, alloc_type, f, tmp_addr, tmp_size) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "can't free space") + if(H5MF_xfree(f, alloc_type, dxpl_id, tmp_addr, tmp_size) < 0) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "can't release aggregator's free space") } /* end if */ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5MF_aggr_reset() */ + +/*------------------------------------------------------------------------- + * Function: H5MF_free_aggrs + * + * Purpose: Reset a metadata & small block aggregators, returning any space + * back to file + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Vailin Choi + * July 1st, 2009 + * + *------------------------------------------------------------------------- + */ +herr_t +H5MF_free_aggrs(H5F_t *f, hid_t dxpl_id) +{ + H5F_blk_aggr_t *first_aggr; /* First aggregator to reset */ + H5F_blk_aggr_t *second_aggr; /* Second aggregator to reset */ + haddr_t ma_addr = HADDR_UNDEF; /* Base "metadata aggregator" address */ + hsize_t ma_size = 0; /* Size of "metadata aggregator" */ + haddr_t sda_addr = HADDR_UNDEF; /* Base "small data aggregator" address */ + hsize_t sda_size = 0; /* Size of "small data aggregator" */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(H5MF_free_aggrs, FAIL) + + /* Check args */ + HDassert(f); + HDassert(f->shared); + HDassert(f->shared->lf); + + /* Retrieve metadata aggregator info, if available */ + if(H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size) < 0) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "can't query metadata aggregator stats") + + /* Retrieve 'small data' aggregator info, if available */ + if(H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sda_addr, &sda_size) < 0) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "can't query small data aggregator stats") + + /* Make certain we release the aggregator that's later in the file first */ + /* (so the file shrinks properly) */ + if(H5F_addr_defined(ma_addr) && H5F_addr_defined(sda_addr)) { + if(H5F_addr_lt(ma_addr, sda_addr)) { + first_aggr = &(f->shared->sdata_aggr); + second_aggr = &(f->shared->meta_aggr); + } /* end if */ + else { + first_aggr = &(f->shared->meta_aggr); + second_aggr = &(f->shared->sdata_aggr); + } /* end else */ + } /* end if */ + else { + first_aggr = &(f->shared->meta_aggr); + second_aggr = &(f->shared->sdata_aggr); + } /* end else */ + + /* Release the unused portion of the metadata and "small data" blocks back + * to the free lists in the file. + */ + if(H5MF_aggr_reset(f, dxpl_id, first_aggr) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTFREE, FAIL, "can't reset metadata block") + if(H5MF_aggr_reset(f, dxpl_id, second_aggr) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTFREE, FAIL, "can't reset 'small data' block") +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5MF_free_aggrs() */ + diff --git a/src/H5MFpkg.h b/src/H5MFpkg.h index de63f56..25785ae 100644 --- a/src/H5MFpkg.h +++ b/src/H5MFpkg.h @@ -158,7 +158,7 @@ H5_DLL herr_t H5MF_sect_simple_free(H5FS_section_info_t *sect); /* Block aggregator routines */ H5_DLL haddr_t H5MF_aggr_alloc(H5F_t *f, hid_t dxpl_id, H5F_blk_aggr_t *aggr, H5F_blk_aggr_t *other_aggr, H5FD_mem_t type, hsize_t size); -H5_DLL htri_t H5MF_aggr_try_extend(const H5F_t *f, H5F_blk_aggr_t *aggr, +H5_DLL htri_t H5MF_aggr_try_extend(H5F_t *f, H5F_blk_aggr_t *aggr, H5FD_mem_t type, haddr_t abs_blk_end, hsize_t extra_requested); H5_DLL htri_t H5MF_aggr_can_absorb(const H5F_t *f, const H5F_blk_aggr_t *aggr, const H5MF_free_section_t *sect, H5MF_shrink_type_t *shrink); diff --git a/src/H5MFprivate.h b/src/H5MFprivate.h index 515fed8..3f2a427 100644 --- a/src/H5MFprivate.h +++ b/src/H5MFprivate.h @@ -78,7 +78,7 @@ H5_DLL htri_t H5MF_try_shrink(H5F_t *f, H5FD_mem_t alloc_type, hid_t dxpl_id, H5_DLL haddr_t H5MF_alloc_tmp(H5F_t *f, hsize_t size); /* 'block aggregator' routines */ -H5_DLL herr_t H5MF_aggr_reset(H5F_t *file, hid_t dxpl_id, H5F_blk_aggr_t *aggr); +H5_DLL herr_t H5MF_free_aggrs(H5F_t *f, hid_t dxpl_id); /* Debugging routines */ #ifdef H5MF_DEBUGGING @@ -1198,10 +1198,12 @@ H5T_init_interface(void) #endif /* H5T_CONV_INTERNAL_INTEGER_LDOUBLE */ /* From unsigned long to floats */ -#if H5T_CONV_INTERNAL_ULONG_FP +#if H5T_CONV_INTERNAL_ULONG_FLT status |= H5T_register(H5T_PERS_HARD, "ulong_flt", native_ulong, native_float, H5T_conv_ulong_float, H5AC_dxpl_id, FALSE); +#endif /* H5T_CONV_INTERNAL_ULONG_FLT */ +#if H5T_CONV_INTERNAL_ULONG_DBL status |= H5T_register(H5T_PERS_HARD, "ulong_dbl", native_ulong, native_double, H5T_conv_ulong_double, H5AC_dxpl_id, FALSE); -#endif /* H5T_CONV_INTERNAL_ULONG_FP */ +#endif /* H5T_CONV_INTERNAL_ULONG_DBL */ #if H5T_CONV_INTERNAL_ULONG_LDOUBLE status |= H5T_register(H5T_PERS_HARD, "ulong_ldbl", native_ulong, native_ldouble, H5T_conv_ulong_ldouble, H5AC_dxpl_id, FALSE); #endif /* H5T_CONV_INTERNAL_ULONG_LDOUBLE */ diff --git a/src/H5Tconv.c b/src/H5Tconv.c index c621bf4..08e7fa1 100644 --- a/src/H5Tconv.c +++ b/src/H5Tconv.c @@ -8417,7 +8417,7 @@ done: * *------------------------------------------------------------------------- */ -#if H5T_CONV_INTERNAL_ULONG_FP +#if H5T_CONV_INTERNAL_ULONG_FLT herr_t H5T_conv_ulong_float (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, @@ -8433,7 +8433,7 @@ H5T_conv_ulong_float (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, done: FUNC_LEAVE_NOAPI(ret_value) } -#endif /* H5T_CONV_INTERNAL_ULONG_FP */ +#endif /* H5T_CONV_INTERNAL_ULONG_FLT */ /*------------------------------------------------------------------------- @@ -8451,7 +8451,7 @@ done: * *------------------------------------------------------------------------- */ -#if H5T_CONV_INTERNAL_ULONG_FP +#if H5T_CONV_INTERNAL_ULONG_DBL herr_t H5T_conv_ulong_double (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, @@ -8467,7 +8467,7 @@ H5T_conv_ulong_double (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, done: FUNC_LEAVE_NOAPI(ret_value) } -#endif /* H5T_CONV_INTERNAL_ULONG_FP */ +#endif /* H5T_CONV_INTERNAL_ULONG_DBL */ /*------------------------------------------------------------------------- diff --git a/src/H5Tpkg.h b/src/H5Tpkg.h index 7ef4b63..18bf7cf 100644 --- a/src/H5Tpkg.h +++ b/src/H5Tpkg.h @@ -133,10 +133,18 @@ #define H5T_CONV_INTERNAL_INTEGER_LDOUBLE 1 #endif -/* Define an internal macro for converting unsigned (long) long to floating numbers. +/* Define an internal macro for converting unsigned long to float. + * Pathscale compiler on Sandia's Linux machine has some problem. + * 64-bit Solaris does different rounding. */ +#if (H5_WANT_DATA_ACCURACY && H5_ULONG_TO_FLOAT_ACCURATE && H5_ULONG_TO_FP_BOTTOM_BIT_ACCURATE) || \ + (!H5_WANT_DATA_ACCURACY) +#define H5T_CONV_INTERNAL_ULONG_FLT 1 +#endif + +/* Define an internal macro for converting unsigned (long) long to double. * 64-bit Solaris does different rounding. */ #if (H5_WANT_DATA_ACCURACY && H5_ULONG_TO_FP_BOTTOM_BIT_ACCURATE) || (!H5_WANT_DATA_ACCURACY) -#define H5T_CONV_INTERNAL_ULONG_FP 1 +#define H5T_CONV_INTERNAL_ULONG_DBL 1 #endif /* Define an internal macro for converting unsigned long to long double. SGI compilers give some diff --git a/src/H5config.h.in b/src/H5config.h.in index 5877c6d..bb03fc7 100644 --- a/src/H5config.h.in +++ b/src/H5config.h.in @@ -620,6 +620,10 @@ correct precision. */ #undef ULLONG_TO_LDOUBLE_PRECISION +/* Define if your system accurately converting unsigned long to float values. + */ +#undef ULONG_TO_FLOAT_ACCURATE + /* Define if your system can accurately convert unsigned (long) long values to floating-point values. */ #undef ULONG_TO_FP_BOTTOM_BIT_ACCURATE diff --git a/src/H5trace.c b/src/H5trace.c index 172a7f7..5f1e128 100644 --- a/src/H5trace.c +++ b/src/H5trace.c @@ -674,10 +674,6 @@ H5_trace (const double *returning, const char *func, const char *type, ...) case H5F_SCOPE_GLOBAL: fprintf(out, "H5F_SCOPE_GLOBAL"); break; - case H5F_SCOPE_DOWN: - fprintf(out, "H5F_SCOPE_DOWN " - "/*FOR INTERNAL USE ONLY!*/"); - break; default: fprintf(out, "%ld", (long)scope); break; diff --git a/src/H5win32defs.h b/src/H5win32defs.h index 89b41a0..2a170ea 100644 --- a/src/H5win32defs.h +++ b/src/H5win32defs.h @@ -60,6 +60,7 @@ typedef __int64 h5_stat_size_t; #define HDopen(S,F,M) _open(S,F|_O_BINARY,M) #define HDread(F,M,Z) _read(F,M,Z) #define HDsetvbuf(F,S,M,Z) setvbuf(F,S,M,(Z>1?Z:2)) +#define HDsleep(S) Sleep(S*1000) #define HDstrcasecmp(A,B) _stricmp(A,B) #define HDstrtoull(S,R,N) _strtoui64(S,R,N) #define HDstrdup(S) _strdup(S) |