From d8cfeadd906c13421c4fe9abe1a5318a956236f6 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Fri, 6 Feb 2004 10:34:01 -0500 Subject: [svn-r8158] Purpose: Code cleanup/optimization Description: Query property list values once, at the beginning of the I/O routines, instead of querying the property list values multiple (lots!) of times in lower level routines. Solution: Create "property list caches" for internal library queries of the property list values. Platforms tested: IBM p690 (copper) w/parallel & fphdf5 h5committest --- src/H5D.c | 20 ++- src/H5Dio.c | 464 ++++++++++++++++++++++++++++++++++++------------------ src/H5Distore.c | 156 ++++++++---------- src/H5Dprivate.h | 26 ++- src/H5Dseq.c | 32 ++-- src/H5FDprivate.h | 3 + src/H5Fistore.c | 156 ++++++++---------- src/H5Fpkg.h | 16 +- src/H5Fprivate.h | 36 +++-- src/H5Fseq.c | 32 ++-- src/H5Pdcpl.c | 50 +----- src/H5Pprivate.h | 2 - src/H5Smpio.c | 27 ++-- src/H5Spkg.h | 24 ++- src/H5Sprivate.h | 34 ++-- src/H5Sselect.c | 108 ++++--------- 16 files changed, 623 insertions(+), 563 deletions(-) diff --git a/src/H5D.c b/src/H5D.c index 95801fb..da14a45 100644 --- a/src/H5D.c +++ b/src/H5D.c @@ -21,7 +21,6 @@ #include "H5private.h" /* Generic Functions */ #include "H5Dpkg.h" /* Datasets */ #include "H5Eprivate.h" /* Error handling */ -#include "H5FDprivate.h" /* File drivers */ #include "H5FLprivate.h" /* Free Lists */ #include "H5FOprivate.h" /* File objects */ #include "H5HLprivate.h" /* Local heaps */ @@ -3235,6 +3234,7 @@ done: herr_t H5Dvlen_reclaim(hid_t type_id, hid_t space_id, hid_t plist_id, void *buf) { + H5T_vlen_alloc_info_t vl_alloc_info; /* VL allocation info */ herr_t ret_value; FUNC_ENTER_API(H5Dvlen_reclaim, FAIL) @@ -3253,8 +3253,12 @@ H5Dvlen_reclaim(hid_t type_id, hid_t space_id, hid_t plist_id, void *buf) if (TRUE!=H5P_isa_class(plist_id,H5P_DATASET_XFER)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not xfer parms") + /* Get the allocation info */ + if(H5T_vlen_get_alloc_info(plist_id,&vl_alloc_info)<0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "unable to retrieve VL allocation info"); + /* Call H5Diterate with args, etc. */ - ret_value=H5Diterate(buf,type_id,space_id,H5T_vlen_reclaim,&plist_id); + ret_value=H5Diterate(buf,type_id,space_id,H5T_vlen_reclaim,&vl_alloc_info); done: FUNC_LEAVE_API(ret_value) @@ -3538,7 +3542,6 @@ H5D_set_extent(H5D_t *dset, const hsize_t *size, hid_t dxpl_id) int rank; /* Dataspace # of dimensions */ herr_t ret_value = SUCCEED; /* Return value */ H5S_t *space = NULL; - H5P_genplist_t *plist; int u; unsigned shrink = 0; /* Flag to indicate a dimension has shrank */ unsigned expand = 0; /* Flag to indicate a dimension has grown */ @@ -3599,16 +3602,23 @@ H5D_set_extent(H5D_t *dset, const hsize_t *size, hid_t dxpl_id) *------------------------------------------------------------------------- */ if(shrink && H5D_CHUNKED == dset->layout.type) { + H5P_genplist_t *plist; + H5D_dxpl_cache_t dxpl_cache; /* Cached data transfer properties */ + /* Get the dataset creation property list */ if(NULL == (plist = H5I_object(dset->dcpl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dset creation property list") + /* Fill the DXPL cache values for later use */ + if (H5D_get_dxpl_cache(dxpl_id,&dxpl_cache)<0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't fill dxpl cache") + /* Remove excess chunks */ - if(H5F_istore_prune_by_extent(dset->ent.file, dxpl_id, &dset->layout, space) < 0) + if(H5F_istore_prune_by_extent(dset->ent.file, &dxpl_cache, dxpl_id, &dset->layout, space) < 0) HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to remove chunks ") /* Reset the elements outsize the new dimensions, but in existing chunks */ - if(H5F_istore_initialize_by_extent(dset->ent.file, dxpl_id, &dset->layout, plist, space) < 0) + if(H5F_istore_initialize_by_extent(dset->ent.file, &dxpl_cache, dxpl_id, &dset->layout, plist, space) < 0) HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to initialize chunks ") } /* end if */ } /* end if */ diff --git a/src/H5Dio.c b/src/H5Dio.c index f1d6890..13c3422 100644 --- a/src/H5Dio.c +++ b/src/H5Dio.c @@ -21,7 +21,6 @@ #include "H5private.h" /* Generic Functions */ #include "H5Dpkg.h" /* Dataset functions */ #include "H5Eprivate.h" /* Error handling */ -#include "H5FDprivate.h" /* File drivers */ #include "H5FLprivate.h" /* Free Lists */ #include "H5Iprivate.h" /* IDs */ #include "H5MMprivate.h" /* Memory management */ @@ -79,28 +78,34 @@ static herr_t H5D_write(H5D_t *dataset, const H5T_t *mem_type, hid_t dset_xfer_plist, const void *buf); static herr_t H5D_contig_read(hsize_t nelmts, H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, - const H5S_t *file_space, H5T_path_t *tpath, H5S_conv_t *sconv, H5P_genplist_t *dc_plist, - H5P_genplist_t *dx_plist, hid_t dxpl_id, + const H5S_t *file_space, H5T_path_t *tpath, H5S_conv_t *sconv, + const H5D_dcpl_cache_t *dcpl_cache, + const H5D_dxpl_cache_t *dxpl_cache, hid_t dxpl_id, hid_t src_id, hid_t dst_id, void *buf/*out*/); static herr_t H5D_contig_write(hsize_t nelmts, H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, - const H5S_t *file_space, H5T_path_t *tpath, H5S_conv_t *sconv, H5P_genplist_t *dc_plist, - H5P_genplist_t *dx_plist, hid_t dxpl_id, + const H5S_t *file_space, H5T_path_t *tpath, H5S_conv_t *sconv, + const H5D_dcpl_cache_t *dcpl_cache, + const H5D_dxpl_cache_t *dxpl_cache, hid_t dxpl_id, hid_t src_id, hid_t dst_id, const void *buf); static herr_t H5D_chunk_read(hsize_t nelmts, H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, - const H5S_t *file_space, H5T_path_t *tpath, H5S_conv_t *sconv, H5P_genplist_t *dc_plist, - H5P_genplist_t *dx_plist, hid_t dxpl_id, + const H5S_t *file_space, H5T_path_t *tpath, H5S_conv_t *sconv, + const H5D_dcpl_cache_t *dcpl_cache, + const H5D_dxpl_cache_t *dxpl_cache, hid_t dxpl_id, hid_t src_id, hid_t dst_id, void *buf/*out*/); static herr_t H5D_chunk_write(hsize_t nelmts, H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, - const H5S_t *file_space, H5T_path_t *tpath, H5S_conv_t *sconv, H5P_genplist_t *dc_plist, - H5P_genplist_t *dx_plist, hid_t dxpl_id, + const H5S_t *file_space, H5T_path_t *tpath, H5S_conv_t *sconv, + const H5D_dcpl_cache_t *dcpl_cache, + const H5D_dxpl_cache_t *dxpl_cache, hid_t dxpl_id, hid_t src_id, hid_t dst_id, const void *buf); #ifdef H5_HAVE_PARALLEL static herr_t -H5D_io_assist_mpio(H5P_genplist_t *dx_plist, H5FD_mpio_xfer_t xfer_mode, +H5D_io_assist_mpio(hid_t dxpl_id, H5D_dxpl_cache_t *dxpl_cache, hbool_t *xfer_mode_changed); +static herr_t +H5D_io_restore_mpio(hid_t dxpl_id); #endif /*H5_HAVE_PARALLEL*/ static herr_t H5D_create_chunk_map(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *file_space, const H5S_t *mem_space, fm_map *fm); @@ -271,6 +276,138 @@ done: } /* H5D_fill() */ +/*-------------------------------------------------------------------------- + NAME + H5D_get_dxpl_cache + PURPOSE + Get all the values for the DXPL cache. + USAGE + herr_t H5D_get_dxpl_cache(dxpl_id, cache) + hid_t dxpl_id; IN: DXPL to query + H5D_dxpl_cache_t *cache;IN/OUT: DXPL cache to fill with values + RETURNS + Non-negative on success/Negative on failure. + DESCRIPTION + Query all the values from a DXPL that are needed by internal routines + within the library. + GLOBAL VARIABLES + COMMENTS, BUGS, ASSUMPTIONS + EXAMPLES + REVISION LOG +--------------------------------------------------------------------------*/ +herr_t +H5D_get_dxpl_cache(hid_t dxpl_id, H5D_dxpl_cache_t *cache) +{ + H5P_genplist_t *dx_plist; /* Data transfer property list */ + herr_t ret_value=SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(H5D_get_dxpl_cache,FAIL) + + /* Check args */ + assert(cache); + + /* Get the dataset transfer property list */ + if (NULL == (dx_plist = H5I_object(dxpl_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset transfer property list") + + /* Get maximum temporary buffer size */ + if(H5P_get(dx_plist, H5D_XFER_MAX_TEMP_BUF_NAME, &cache->max_temp_buf)<0) + HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve maximum temporary buffer size") + + /* Get temporary buffer pointer */ + if(H5P_get(dx_plist, H5D_XFER_TCONV_BUF_NAME, &cache->tconv_buf)<0) + HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve temporary buffer pointer") + + /* Get background buffer pointer */ + if(H5P_get(dx_plist, H5D_XFER_BKGR_BUF_NAME, &cache->bkgr_buf)<0) + HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve background buffer pointer") + + /* Get background buffer type */ + if(H5P_get(dx_plist, H5D_XFER_BKGR_BUF_TYPE_NAME, &cache->bkgr_buf_type)<0) + HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve background buffer type") + + /* Get B-tree split ratios */ + if(H5P_get(dx_plist, H5D_XFER_BTREE_SPLIT_RATIO_NAME, &cache->btree_split_ratio)<0) + HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve background buffer type") + + /* Get B-tree split ratios */ + if(H5P_get(dx_plist, H5D_XFER_BTREE_SPLIT_RATIO_NAME, &cache->btree_split_ratio)<0) + HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve background buffer type") + + /* Get I/O vector size */ + if(H5P_get(dx_plist, H5D_XFER_HYPER_VECTOR_SIZE_NAME, &cache->vec_size)<0) + HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve I/O vector size") + +#ifdef H5_HAVE_PARALLEL + /* Collect Parallel I/O information for possible later use */ + if(H5P_get(dx_plist, H5D_XFER_IO_XFER_MODE_NAME, &cache->xfer_mode)<0) + HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve parallel transfer method") +#endif /*H5_HAVE_PARALLEL*/ + + /* Get error detection properties */ + if(H5P_get(dx_plist, H5D_XFER_EDC_NAME, &cache->err_detect)<0) + HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve error detection info") + + /* Get filter callback function */ + if(H5P_get(dx_plist, H5D_XFER_FILTER_CB_NAME, &cache->filter_cb)<0) + HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve filter callback function") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5D_get_dxpl_cache() */ + + +/*-------------------------------------------------------------------------- + NAME + H5D_get_dcpl_cache + PURPOSE + Get all the values for the DCPL cache. + USAGE + herr_t H5D_get_dcpl_cache(dcpl_id, cache) + hid_t dcpl_id; IN: DCPL to query + H5D_dcpl_cache_t *cache;IN/OUT: DCPL cache to fill with values + RETURNS + Non-negative on success/Negative on failure. + DESCRIPTION + Query all the values from a DCPL that are needed by internal routines + within the library. + GLOBAL VARIABLES + COMMENTS, BUGS, ASSUMPTIONS + EXAMPLES + REVISION LOG +--------------------------------------------------------------------------*/ +static herr_t +H5D_get_dcpl_cache(hid_t dcpl_id, H5D_dcpl_cache_t *cache) +{ + H5P_genplist_t *dc_plist; /* Data transfer property list */ + herr_t ret_value=SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT(H5D_get_dcpl_cache) + + /* Check args */ + assert(cache); + + /* Get the dataset transfer property list */ + if (NULL == (dc_plist = H5I_object(dcpl_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset creation property list") + + /* Get I/O pipeline info */ + if(H5P_get(dc_plist, H5D_CRT_DATA_PIPELINE_NAME, &cache->pline)<0) + HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve I/O pipeline info") + + /* Get fill value info */ + if(H5P_get(dc_plist, H5D_CRT_FILL_VALUE_NAME, &cache->fill)<0) + HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve fill value info") + + /* Get fill time info */ + if(H5P_get(dc_plist, H5D_CRT_FILL_TIME_NAME, &cache->fill_time)<0) + HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve fill time") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5D_get_dcpl_cache() */ + + /*------------------------------------------------------------------------- * Function: H5Dread * @@ -516,11 +653,10 @@ H5D_read(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, H5S_conv_t *sconv=NULL; /*space conversion funcs*/ hbool_t use_par_opt_io=FALSE; /* Whether the 'optimized' I/O routines with be parallel */ #ifdef H5_HAVE_PARALLEL - H5FD_mpio_xfer_t xfer_mode; /*xfer_mode for this request */ hbool_t xfer_mode_changed=FALSE; /* Whether the transfer mode was changed */ #endif /*H5_HAVE_PARALLEL*/ - H5P_genplist_t *dx_plist=NULL; /* Data transfer property list */ - H5P_genplist_t *dc_plist; /* Dataset creation roperty list */ + H5D_dxpl_cache_t dxpl_cache; /* Data transfer property cache */ + H5D_dcpl_cache_t dcpl_cache; /* Dataset creation property cache */ unsigned sconv_flags=0; /* Flags for the space conversion */ herr_t ret_value = SUCCEED; /* Return value */ @@ -531,14 +667,6 @@ H5D_read(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, assert(mem_type); assert(buf); - /* Get the dataset's creation property list */ - if (NULL == (dc_plist = H5I_object(dataset->dcpl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset creation property list") - - /* Get the dataset transfer property list */ - if (NULL == (dx_plist = H5I_object(dxpl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset creation property list") - if (!file_space) file_space = dataset->space; if (!mem_space) @@ -547,17 +675,22 @@ H5D_read(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "src dataspace has invalid selection") H5_ASSIGN_OVERFLOW(nelmts,snelmts,hssize_t,hsize_t); -#ifdef H5_HAVE_PARALLEL - /* Collect Parallel I/O information for possible later use */ - xfer_mode=(H5FD_mpio_xfer_t)H5P_peek_unsigned(dx_plist, H5D_XFER_IO_XFER_MODE_NAME); + /* Fill the DCPL cache values for later use */ + if (H5D_get_dcpl_cache(dataset->dcpl_id,&dcpl_cache)<0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't fill dcpl cache") + /* Fill the DXPL cache values for later use */ + if (H5D_get_dxpl_cache(dxpl_id,&dxpl_cache)<0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't fill dxpl cache") + +#ifdef H5_HAVE_PARALLEL /* Collective access is not permissible without a MPI based VFD */ - if (xfer_mode==H5FD_MPIO_COLLECTIVE && !IS_H5FD_MPI(dataset->ent.file)) + if (dxpl_cache.xfer_mode==H5FD_MPIO_COLLECTIVE && !IS_H5FD_MPI(dataset->ent.file)) HGOTO_ERROR (H5E_DATASET, H5E_UNSUPPORTED, FAIL, "collective access for MPI-based drivers only") /* Set the "parallel I/O possible" flag, for H5S_find(), if we are doing collective I/O */ /* (Don't set the parallel I/O possible flag for the MPI-posix driver, since it doesn't do real collective I/O) */ - if (H5S_mpi_opt_types_g && xfer_mode==H5FD_MPIO_COLLECTIVE && !IS_H5FD_MPIPOSIX(dataset->ent.file)) + if (H5S_mpi_opt_types_g && dxpl_cache.xfer_mode==H5FD_MPIO_COLLECTIVE && !IS_H5FD_MPIPOSIX(dataset->ent.file)) sconv_flags |= H5S_CONV_PAR_IO_POSSIBLE; #endif /*H5_HAVE_PARALLEL*/ @@ -576,29 +709,23 @@ H5D_read(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, */ if(nelmts > 0 && dataset->efl.nused==0 && dataset->layout.type!=H5D_COMPACT && dataset->layout.addr==HADDR_UNDEF) { - H5O_fill_t fill={NULL,0,NULL}; /* Fill value info */ - H5D_fill_time_t fill_time; /* When to write the fill values */ H5D_fill_value_t fill_status; /* Whether/How the fill value is defined */ /* Retrieve dataset's fill-value properties */ - if(H5P_fill_value_defined(dc_plist, &fill_status)<0) + if(H5P_is_fill_value_defined(&dcpl_cache.fill, &fill_status)<0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't tell if fill value defined") - if((fill_status==H5D_FILL_VALUE_DEFAULT || fill_status==H5D_FILL_VALUE_USER_DEFINED) - && H5P_get(dc_plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL,"can't retrieve fill value") - if(H5P_get(dc_plist, H5D_CRT_FILL_TIME_NAME, &fill_time) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL,"can't retrieve fill time") /* Should be impossible, but check anyway... */ - if(fill_status == H5D_FILL_VALUE_UNDEFINED && (fill_time == H5D_FILL_TIME_ALLOC || fill_time == H5D_FILL_TIME_IFSET)) + if(fill_status == H5D_FILL_VALUE_UNDEFINED && + (dcpl_cache.fill_time == H5D_FILL_TIME_ALLOC || dcpl_cache.fill_time == H5D_FILL_TIME_IFSET)) HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "read failed: dataset doesn't exist, no data can be read") /* If we're never going to fill this dataset, just leave the junk in the user's buffer */ - if(fill_time == H5D_FILL_TIME_NEVER) + if(dcpl_cache.fill_time == H5D_FILL_TIME_NEVER) HGOTO_DONE(SUCCEED) /* Go fill the user's selection with the dataset's fill value */ - if(H5D_fill(fill.buf,dataset->type,buf,mem_type,mem_space, dxpl_id)<0) + if(H5D_fill(dcpl_cache.fill.buf,dataset->type,buf,mem_type,mem_space,dxpl_id)<0) HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "filling buf failed") else HGOTO_DONE(SUCCEED) @@ -645,33 +772,26 @@ H5D_read(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, #ifdef H5_HAVE_PARALLEL /* Don't reset the transfer mode if we can't or won't use it */ if(!use_par_opt_io || !H5T_path_noop(tpath)) - H5D_io_assist_mpio(dx_plist, xfer_mode, &xfer_mode_changed); + H5D_io_assist_mpio(dxpl_id, &dxpl_cache, &xfer_mode_changed); #endif /*H5_HAVE_PARALLEL*/ /* Determine correct I/O routine to invoke */ if(dataset->layout.type!=H5D_CHUNKED) { - if(H5D_contig_read(nelmts, dataset, mem_type, mem_space, file_space, tpath, sconv, dc_plist, - dx_plist, dxpl_id, src_id, dst_id, buf)<0) + if(H5D_contig_read(nelmts, dataset, mem_type, mem_space, file_space, tpath, sconv, &dcpl_cache, + &dxpl_cache, dxpl_id, src_id, dst_id, buf)<0) HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read data") } /* end if */ else { - if(H5D_chunk_read(nelmts, dataset, mem_type, mem_space, file_space, tpath, sconv, dc_plist, - dx_plist, dxpl_id, src_id, dst_id, buf)<0) + if(H5D_chunk_read(nelmts, dataset, mem_type, mem_space, file_space, tpath, sconv, &dcpl_cache, + &dxpl_cache, dxpl_id, src_id, dst_id, buf)<0) HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read data") } /* end else */ done: #ifdef H5_HAVE_PARALLEL - /* restore xfer_mode due to the kludge */ - if (xfer_mode_changed) { -#ifdef H5D_DEBUG - if (H5DEBUG(D)) - fprintf (H5DEBUG(D), "H5D: xfer_mode was COLLECTIVE, restored to INDEPENDENT\n"); -#endif - xfer_mode = H5FD_MPIO_COLLECTIVE; - if(H5P_set (dx_plist, H5D_XFER_IO_XFER_MODE_NAME, &xfer_mode) < 0) - HDONE_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set transfer mode") - } /* end if */ + /* Restore xfer_mode due to the kludge */ + if (xfer_mode_changed) + H5D_io_restore_mpio(dxpl_id); #endif /*H5_HAVE_PARALLEL*/ if (src_id >= 0) { if(H5I_dec_ref(src_id)<0) @@ -741,11 +861,10 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, H5S_conv_t *sconv=NULL; /*space conversion funcs*/ hbool_t use_par_opt_io=FALSE; /* Whether the 'optimized' I/O routines with be parallel */ #ifdef H5_HAVE_PARALLEL - H5FD_mpio_xfer_t xfer_mode; /*xfer_mode for this request */ hbool_t xfer_mode_changed=FALSE; /* Whether the transfer mode was changed */ #endif /*H5_HAVE_PARALLEL*/ - H5P_genplist_t *dx_plist=NULL; /* Data transfer property list */ - H5P_genplist_t *dc_plist; /* Dataset creation roperty list */ + H5D_dxpl_cache_t dxpl_cache; /* Data transfer property cache */ + H5D_dcpl_cache_t dcpl_cache; /* Dataset creation property cache */ unsigned sconv_flags=0; /* Flags for the space conversion */ herr_t ret_value = SUCCEED; /* Return value */ @@ -776,13 +895,13 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, if (0==(H5F_get_intent(dataset->ent.file) & H5F_ACC_RDWR)) HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "no write intent on file") - /* Get the dataset's creation property list */ - if (NULL == (dc_plist = H5I_object(dataset->dcpl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset creation property list") + /* Fill the DCPL cache values for later use */ + if (H5D_get_dcpl_cache(dataset->dcpl_id,&dcpl_cache)<0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't fill dcpl cache") - /* Get the dataset transfer property list */ - if (NULL == (dx_plist = H5I_object(dxpl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset creation property list") + /* Fill the DXPL cache values for later use */ + if (H5D_get_dxpl_cache(dxpl_id,&dxpl_cache)<0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't fill dxpl cache") if (!file_space) file_space = dataset->space; @@ -793,16 +912,13 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, H5_ASSIGN_OVERFLOW(nelmts,snelmts,hssize_t,hsize_t); #ifdef H5_HAVE_PARALLEL - /* Collect Parallel I/O information for possible later use */ - xfer_mode=(H5FD_mpio_xfer_t)H5P_peek_unsigned(dx_plist, H5D_XFER_IO_XFER_MODE_NAME); - /* Collective access is not permissible without a MPI based VFD */ - if (xfer_mode==H5FD_MPIO_COLLECTIVE && !IS_H5FD_MPI(dataset->ent.file)) + if (dxpl_cache.xfer_mode==H5FD_MPIO_COLLECTIVE && !IS_H5FD_MPI(dataset->ent.file)) HGOTO_ERROR (H5E_DATASET, H5E_UNSUPPORTED, FAIL, "collective access for MPI-based driver only") /* Set the "parallel I/O possible" flag, for H5S_find(), if we are doing collective I/O */ /* (Don't set the parallel I/O possible flag for the MPI-posix driver, since it doesn't do real collective I/O) */ - if (H5S_mpi_opt_types_g && xfer_mode==H5FD_MPIO_COLLECTIVE && !IS_H5FD_MPIPOSIX(dataset->ent.file)) + if (H5S_mpi_opt_types_g && dxpl_cache.xfer_mode==H5FD_MPIO_COLLECTIVE && !IS_H5FD_MPIPOSIX(dataset->ent.file)) sconv_flags |= H5S_CONV_PAR_IO_POSSIBLE; #endif /*H5_HAVE_PARALLEL*/ @@ -874,19 +990,20 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, #ifdef H5_HAVE_PARALLEL /* Don't reset the transfer mode if we can't or won't use it */ - if(!use_par_opt_io || !H5T_path_noop(tpath)) - H5D_io_assist_mpio(dx_plist, xfer_mode, &xfer_mode_changed); + if(!use_par_opt_io || !H5T_path_noop(tpath)) { + H5D_io_assist_mpio(dxpl_id, &dxpl_cache, &xfer_mode_changed); + } /* end if */ #endif /*H5_HAVE_PARALLEL*/ /* Determine correct I/O routine to invoke */ if(dataset->layout.type!=H5D_CHUNKED) { - if(H5D_contig_write(nelmts, dataset, mem_type, mem_space, file_space, tpath, sconv, dc_plist, - dx_plist, dxpl_id, src_id, dst_id, buf)<0) + if(H5D_contig_write(nelmts, dataset, mem_type, mem_space, file_space, tpath, sconv, &dcpl_cache, + &dxpl_cache, dxpl_id, src_id, dst_id, buf)<0) HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't write data") } /* end if */ else { - if(H5D_chunk_write(nelmts, dataset, mem_type, mem_space, file_space, tpath, sconv, dc_plist, - dx_plist, dxpl_id, src_id, dst_id, buf)<0) + if(H5D_chunk_write(nelmts, dataset, mem_type, mem_space, file_space, tpath, sconv, &dcpl_cache, + &dxpl_cache, dxpl_id, src_id, dst_id, buf)<0) HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't write data") } /* end else */ @@ -907,16 +1024,9 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, done: #ifdef H5_HAVE_PARALLEL - /* restore xfer_mode due to the kludge */ - if (xfer_mode_changed) { -#ifdef H5D_DEBUG - if (H5DEBUG(D)) - fprintf (H5DEBUG(D), "H5D: xfer_mode was COLLECTIVE, restored to INDEPENDENT\n"); -#endif - xfer_mode = H5FD_MPIO_COLLECTIVE; - if(H5P_set (dx_plist, H5D_XFER_IO_XFER_MODE_NAME, &xfer_mode) < 0) - HDONE_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set transfer mode") - } /* end if */ + /* Restore xfer_mode due to the kludge */ + if (xfer_mode_changed) + H5D_io_restore_mpio(dxpl_id); #endif /*H5_HAVE_PARALLEL*/ if (src_id >= 0) { if(H5I_dec_ref(src_id)<0) @@ -951,8 +1061,9 @@ done: static herr_t H5D_contig_read(hsize_t nelmts, H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, const H5S_t *file_space, H5T_path_t *tpath, - H5S_conv_t *sconv, H5P_genplist_t *dc_plist, H5P_genplist_t *dx_plist, - hid_t dxpl_id, hid_t src_id, hid_t dst_id, void *buf/*out*/) + H5S_conv_t *sconv, const H5D_dcpl_cache_t *dcpl_cache, + const H5D_dxpl_cache_t *dxpl_cache, hid_t dxpl_id, + hid_t src_id, hid_t dst_id, void *buf/*out*/) { herr_t status; /*function return status*/ #ifdef H5S_DEBUG @@ -989,8 +1100,8 @@ H5D_contig_read(hsize_t nelmts, H5D_t *dataset, const H5T_t *mem_type, assert(dataset->layout.addr!=HADDR_UNDEF || dataset->efl.nused>0 || dataset->layout.type==H5D_COMPACT); status = (sconv->read)(dataset->ent.file, &(dataset->layout), - dc_plist, (H5D_storage_t *)&(dataset->efl), H5T_get_size(dataset->type), - file_space, mem_space, dxpl_id, buf/*out*/); + dcpl_cache, (H5D_storage_t *)&(dataset->efl), H5T_get_size(dataset->type), + file_space, mem_space, dxpl_cache, dxpl_id, buf/*out*/); #ifdef H5S_DEBUG H5_timer_end(&(sconv->stats[1].read_timer), &timer); sconv->stats[1].read_nbytes += nelmts * H5T_get_size(dataset->type); @@ -1012,7 +1123,7 @@ H5D_contig_read(hsize_t nelmts, H5D_t *dataset, const H5T_t *mem_type, /* Compute element sizes and other parameters */ src_type_size = H5T_get_size(dataset->type); dst_type_size = H5T_get_size(mem_type); - target_size = H5P_peek_size_t(dx_plist,H5D_XFER_MAX_TEMP_BUF_NAME); + target_size = dxpl_cache->max_temp_buf; /* XXX: This could cause a problem if the user sets their buffer size * to the same size as the default, and then the dataset elements are * too large for the buffer... - QAK @@ -1048,19 +1159,18 @@ H5D_contig_read(hsize_t nelmts, H5D_t *dataset, const H5T_t *mem_type, H5T_bkg_t path_bkg; /* Type conversion's background info */ /* Retrieve the bkgr buffer property */ - if(H5P_get(dx_plist, H5D_XFER_BKGR_BUF_TYPE_NAME, &need_bkg)<0) - HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve background buffer type") + need_bkg=dxpl_cache->bkgr_buf_type; path_bkg = H5T_path_bkg(tpath); need_bkg = MAX(path_bkg, need_bkg); } else { need_bkg = H5T_BKG_NO; /*never needed even if app says yes*/ } /* end else */ - if (NULL==(tconv_buf=H5P_peek_voidp(dx_plist,H5D_XFER_TCONV_BUF_NAME))) { + if (NULL==(tconv_buf=dxpl_cache->tconv_buf)) { /* Allocate temporary buffer */ if((tconv_buf=H5FL_BLK_MALLOC(type_conv,target_size))==NULL) HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for type conversion") } /* end if */ - if (need_bkg && NULL==(bkg_buf=H5P_peek_voidp(dx_plist,H5D_XFER_BKGR_BUF_NAME))) { + if (need_bkg && NULL==(bkg_buf=dxpl_cache->bkgr_buf)) { /* Allocate background buffer */ H5_CHECK_OVERFLOW((request_nelmts*dst_type_size),hsize_t,size_t); if((bkg_buf=H5FL_BLK_CALLOC(type_conv,(size_t)(request_nelmts*dst_type_size)))==NULL) @@ -1085,8 +1195,8 @@ H5D_contig_read(hsize_t nelmts, H5D_t *dataset, const H5T_t *mem_type, assert(dataset->layout.addr!=HADDR_UNDEF || dataset->efl.nused>0 || dataset->layout.type==H5D_COMPACT); n = H5S_select_fgath(dataset->ent.file, &(dataset->layout), - dc_plist, (H5D_storage_t *)&(dataset->efl), src_type_size, file_space, - &file_iter, smine_nelmts, dxpl_id, tconv_buf/*out*/); + dcpl_cache, (H5D_storage_t *)&(dataset->efl), src_type_size, file_space, + &file_iter, smine_nelmts, dxpl_cache, dxpl_id, tconv_buf/*out*/); #ifdef H5S_DEBUG H5_timer_end(&(sconv->stats[1].gath_timer), &timer); @@ -1101,7 +1211,7 @@ H5D_contig_read(hsize_t nelmts, H5D_t *dataset, const H5T_t *mem_type, H5_timer_begin(&timer); #endif n = H5S_select_mgath(buf, dst_type_size, mem_space, &bkg_iter, - smine_nelmts, dxpl_id, bkg_buf/*out*/); + smine_nelmts, dxpl_cache, bkg_buf/*out*/); #ifdef H5S_DEBUG H5_timer_end(&(sconv->stats[1].bkg_timer), &timer); sconv->stats[1].bkg_nbytes += n * dst_type_size; @@ -1124,7 +1234,7 @@ H5D_contig_read(hsize_t nelmts, H5D_t *dataset, const H5T_t *mem_type, H5_timer_begin(&timer); #endif status = H5S_select_mscat(tconv_buf, dst_type_size, mem_space, - &mem_iter, smine_nelmts, dxpl_id, buf/*out*/); + &mem_iter, smine_nelmts, dxpl_cache, buf/*out*/); #ifdef H5S_DEBUG H5_timer_end(&(sconv->stats[1].scat_timer), &timer); sconv->stats[1].scat_nbytes += smine_nelmts * dst_type_size; @@ -1150,10 +1260,9 @@ done: HDONE_ERROR (H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator") } /* end if */ - assert(dx_plist); - if (tconv_buf && NULL==H5P_peek_voidp(dx_plist,H5D_XFER_TCONV_BUF_NAME)) + if (tconv_buf && NULL==dxpl_cache->tconv_buf) H5FL_BLK_FREE(type_conv,tconv_buf); - if (bkg_buf && NULL==H5P_peek_voidp(dx_plist,H5D_XFER_BKGR_BUF_NAME)) + if (bkg_buf && NULL==dxpl_cache->bkgr_buf) H5FL_BLK_FREE(type_conv,bkg_buf); FUNC_LEAVE_NOAPI(ret_value) @@ -1179,8 +1288,9 @@ done: /* ARGSUSED */ static herr_t H5D_contig_write(hsize_t nelmts, H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, - const H5S_t *file_space, H5T_path_t *tpath, H5S_conv_t *sconv, H5P_genplist_t *dc_plist, - H5P_genplist_t *dx_plist, hid_t dxpl_id, + const H5S_t *file_space, H5T_path_t *tpath, H5S_conv_t *sconv, + const H5D_dcpl_cache_t *dcpl_cache, + const H5D_dxpl_cache_t *dxpl_cache, hid_t dxpl_id, hid_t src_id, hid_t dst_id, const void *buf) { herr_t status; /*function return status*/ @@ -1215,8 +1325,8 @@ H5D_contig_write(hsize_t nelmts, H5D_t *dataset, const H5T_t *mem_type, const H5 H5_timer_begin(&timer); #endif status = (sconv->write)(dataset->ent.file, &(dataset->layout), - dc_plist, (H5D_storage_t *)&(dataset->efl), H5T_get_size(dataset->type), - file_space, mem_space, dxpl_id, buf); + dcpl_cache, (H5D_storage_t *)&(dataset->efl), H5T_get_size(dataset->type), + file_space, mem_space, dxpl_cache, dxpl_id, buf); #ifdef H5S_DEBUG H5_timer_end(&(sconv->stats[0].write_timer), &timer); sconv->stats[0].write_nbytes += nelmts * H5T_get_size(mem_type); @@ -1238,7 +1348,7 @@ H5D_contig_write(hsize_t nelmts, H5D_t *dataset, const H5T_t *mem_type, const H5 /* Compute element sizes and other parameters */ src_type_size = H5T_get_size(mem_type); dst_type_size = H5T_get_size(dataset->type); - target_size = H5P_peek_size_t(dx_plist,H5D_XFER_MAX_TEMP_BUF_NAME); + target_size = dxpl_cache->max_temp_buf; /* XXX: This could cause a problem if the user sets their buffer size * to the same size as the default, and then the dataset elements are * too large for the buffer... - QAK @@ -1278,19 +1388,18 @@ H5D_contig_write(hsize_t nelmts, H5D_t *dataset, const H5T_t *mem_type, const H5 H5T_bkg_t path_bkg; /* Type conversion's background info */ /* Retrieve the bkgr buffer property */ - if(H5P_get(dx_plist, H5D_XFER_BKGR_BUF_TYPE_NAME, &need_bkg)<0) - HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve background buffer type") + need_bkg=dxpl_cache->bkgr_buf_type; path_bkg = H5T_path_bkg(tpath); need_bkg = MAX (path_bkg, need_bkg); } else { need_bkg = H5T_BKG_NO; /*never needed even if app says yes*/ } /* end else */ - if (NULL==(tconv_buf=H5P_peek_voidp(dx_plist,H5D_XFER_TCONV_BUF_NAME))) { + if (NULL==(tconv_buf=dxpl_cache->tconv_buf)) { /* Allocate temporary buffer */ if((tconv_buf=H5FL_BLK_MALLOC(type_conv,target_size))==NULL) HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for type conversion") } /* end if */ - if (need_bkg && NULL==(bkg_buf=H5P_peek_voidp(dx_plist,H5D_XFER_BKGR_BUF_NAME))) { + if (need_bkg && NULL==(bkg_buf=dxpl_cache->bkgr_buf)) { /* Allocate background buffer */ H5_CHECK_OVERFLOW((request_nelmts*dst_type_size),hsize_t,size_t); if((bkg_buf=H5FL_BLK_CALLOC(type_conv,(size_t)(request_nelmts*dst_type_size)))==NULL) @@ -1312,7 +1421,7 @@ H5D_contig_write(hsize_t nelmts, H5D_t *dataset, const H5T_t *mem_type, const H5 H5_timer_begin(&timer); #endif n = H5S_select_mgath(buf, src_type_size, mem_space, &mem_iter, - smine_nelmts, dxpl_id, tconv_buf/*out*/); + smine_nelmts, dxpl_cache, tconv_buf/*out*/); #ifdef H5S_DEBUG H5_timer_end(&(sconv->stats[0].gath_timer), &timer); sconv->stats[0].gath_nbytes += n * src_type_size; @@ -1326,8 +1435,8 @@ H5D_contig_write(hsize_t nelmts, H5D_t *dataset, const H5T_t *mem_type, const H5 H5_timer_begin(&timer); #endif n = H5S_select_fgath(dataset->ent.file, &(dataset->layout), - dc_plist, (H5D_storage_t *)&(dataset->efl), dst_type_size, file_space, - &bkg_iter, smine_nelmts, dxpl_id, bkg_buf/*out*/); + dcpl_cache, (H5D_storage_t *)&(dataset->efl), dst_type_size, file_space, + &bkg_iter, smine_nelmts, dxpl_cache, dxpl_id, bkg_buf/*out*/); #ifdef H5S_DEBUG H5_timer_end(&(sconv->stats[0].bkg_timer), &timer); @@ -1351,8 +1460,8 @@ H5D_contig_write(hsize_t nelmts, H5D_t *dataset, const H5T_t *mem_type, const H5 H5_timer_begin(&timer); #endif status = H5S_select_fscat(dataset->ent.file, &(dataset->layout), - dc_plist, (H5D_storage_t *)&(dataset->efl), dst_type_size, file_space, &file_iter, - smine_nelmts, dxpl_id, tconv_buf); + dcpl_cache, (H5D_storage_t *)&(dataset->efl), dst_type_size, file_space, &file_iter, + smine_nelmts, dxpl_cache, dxpl_id, tconv_buf); #ifdef H5S_DEBUG H5_timer_end(&(sconv->stats[0].scat_timer), &timer); @@ -1378,10 +1487,9 @@ done: HDONE_ERROR (H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator") } /* end if */ - assert(dx_plist); - if (tconv_buf && NULL==H5P_peek_voidp(dx_plist,H5D_XFER_TCONV_BUF_NAME)) + if (tconv_buf && NULL==dxpl_cache->tconv_buf) H5FL_BLK_FREE(type_conv,tconv_buf); - if (bkg_buf && NULL==H5P_peek_voidp(dx_plist,H5D_XFER_BKGR_BUF_NAME)) + if (bkg_buf && NULL==dxpl_cache->bkgr_buf) H5FL_BLK_FREE(type_conv,bkg_buf); FUNC_LEAVE_NOAPI(ret_value) @@ -1411,8 +1519,10 @@ H5D_chunk_read(hsize_t UNUSED #endif /* NDEBUG */ nelmts, H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, - const H5S_t *file_space, H5T_path_t *tpath, H5S_conv_t *sconv, H5P_genplist_t *dc_plist, - H5P_genplist_t *dx_plist, hid_t dxpl_id, hid_t src_id, hid_t dst_id, void *buf/*out*/) + const H5S_t *file_space, H5T_path_t *tpath, H5S_conv_t *sconv, + const H5D_dcpl_cache_t *dcpl_cache, + const H5D_dxpl_cache_t *dxpl_cache, hid_t dxpl_id, + hid_t src_id, hid_t dst_id, void *buf/*out*/) { fm_map fm; /* File<->memory mapping */ H5TB_NODE *chunk_node; /* Current node in chunk TBBT */ @@ -1481,8 +1591,8 @@ UNUSED /* Perform the actual read operation */ status = (sconv->read)(dataset->ent.file, &(dataset->layout), - dc_plist, &store, H5T_get_size(dataset->type), - chunk_info->fspace, chunk_info->mspace, dxpl_id, buf); + dcpl_cache, &store, H5T_get_size(dataset->type), + chunk_info->fspace, chunk_info->mspace, dxpl_cache, dxpl_id, buf); /* Check return value from optimized read */ if (status<0) @@ -1509,7 +1619,7 @@ UNUSED /* Compute element sizes and other parameters */ src_type_size = H5T_get_size(dataset->type); dst_type_size = H5T_get_size(mem_type); - target_size = H5P_peek_size_t(dx_plist,H5D_XFER_MAX_TEMP_BUF_NAME); + target_size = dxpl_cache->max_temp_buf; /* XXX: This could cause a problem if the user sets their buffer size * to the same size as the default, and then the dataset elements are * too large for the buffer... - QAK @@ -1534,19 +1644,18 @@ UNUSED H5T_bkg_t path_bkg; /* Type conversion's background info */ /* Retrieve the bkgr buffer property */ - if(H5P_get(dx_plist, H5D_XFER_BKGR_BUF_TYPE_NAME, &need_bkg)<0) - HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve background buffer type") + need_bkg=dxpl_cache->bkgr_buf_type; path_bkg = H5T_path_bkg(tpath); need_bkg = MAX(path_bkg, need_bkg); } else { need_bkg = H5T_BKG_NO; /*never needed even if app says yes*/ } /* end else */ - if (NULL==(tconv_buf=H5P_peek_voidp(dx_plist,H5D_XFER_TCONV_BUF_NAME))) { + if (NULL==(tconv_buf=dxpl_cache->tconv_buf)) { /* Allocate temporary buffer */ if((tconv_buf=H5FL_BLK_MALLOC(type_conv,target_size))==NULL) HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for type conversion") } /* end if */ - if (need_bkg && NULL==(bkg_buf=H5P_peek_voidp(dx_plist,H5D_XFER_BKGR_BUF_NAME))) { + if (need_bkg && NULL==(bkg_buf=dxpl_cache->bkgr_buf)) { /* Allocate background buffer */ H5_CHECK_OVERFLOW((request_nelmts*dst_type_size),hsize_t,size_t); if((bkg_buf=H5FL_BLK_CALLOC(type_conv,(size_t)(request_nelmts*dst_type_size)))==NULL) @@ -1602,8 +1711,8 @@ UNUSED assert(dataset->layout.addr!=HADDR_UNDEF || dataset->efl.nused>0 || dataset->layout.type==H5D_COMPACT); n = H5S_select_fgath(dataset->ent.file, &(dataset->layout), - dc_plist, &store, src_type_size, chunk_info->fspace, - &file_iter, smine_nelmts, dxpl_id, tconv_buf/*out*/); + dcpl_cache, &store, src_type_size, chunk_info->fspace, + &file_iter, smine_nelmts, dxpl_cache, dxpl_id, tconv_buf/*out*/); #ifdef H5S_DEBUG H5_timer_end(&(sconv->stats[1].gath_timer), &timer); @@ -1618,7 +1727,7 @@ UNUSED H5_timer_begin(&timer); #endif n = H5S_select_mgath(buf, dst_type_size, chunk_info->mspace, &bkg_iter, - smine_nelmts, dxpl_id, bkg_buf/*out*/); + smine_nelmts, dxpl_cache, bkg_buf/*out*/); #ifdef H5S_DEBUG H5_timer_end(&(sconv->stats[1].bkg_timer), &timer); sconv->stats[1].bkg_nbytes += n * dst_type_size; @@ -1642,7 +1751,7 @@ UNUSED H5_timer_begin(&timer); #endif status = H5S_select_mscat(tconv_buf, dst_type_size, chunk_info->mspace, - &mem_iter, smine_nelmts, dxpl_id, buf/*out*/); + &mem_iter, smine_nelmts, dxpl_cache, buf/*out*/); #ifdef H5S_DEBUG H5_timer_end(&(sconv->stats[1].scat_timer), &timer); sconv->stats[1].scat_nbytes += smine_nelmts * dst_type_size; @@ -1674,10 +1783,9 @@ UNUSED } /* end while */ done: - assert(dx_plist); - if (tconv_buf && NULL==H5P_peek_voidp(dx_plist,H5D_XFER_TCONV_BUF_NAME)) + if (tconv_buf && NULL==dxpl_cache->tconv_buf) H5FL_BLK_FREE(type_conv,tconv_buf); - if (bkg_buf && NULL==H5P_peek_voidp(dx_plist,H5D_XFER_BKGR_BUF_NAME)) + if (bkg_buf && NULL==dxpl_cache->bkgr_buf) H5FL_BLK_FREE(type_conv,bkg_buf); /* Release selection iterators, if necessary */ @@ -1725,8 +1833,9 @@ H5D_chunk_write(hsize_t UNUSED #endif /* NDEBUG */ nelmts, H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, - const H5S_t *file_space, H5T_path_t *tpath, H5S_conv_t *sconv, H5P_genplist_t *dc_plist, - H5P_genplist_t *dx_plist, hid_t dxpl_id, + const H5S_t *file_space, H5T_path_t *tpath, H5S_conv_t *sconv, + const H5D_dcpl_cache_t *dcpl_cache, + const H5D_dxpl_cache_t *dxpl_cache, hid_t dxpl_id, hid_t src_id, hid_t dst_id, const void *buf) { fm_map fm; /* File<->memory mapping */ @@ -1819,8 +1928,8 @@ nelmts, H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, /* Perform the actual write operation */ status = (sconv->write)(dataset->ent.file, &(dataset->layout), - dc_plist, &store, H5T_get_size(dataset->type), - chunk_info->fspace, chunk_info->mspace, dxpl_id, buf); + dcpl_cache, &store, H5T_get_size(dataset->type), + chunk_info->fspace, chunk_info->mspace, dxpl_cache, dxpl_id, buf); /* Check return value from optimized write */ if (status<0) @@ -1863,7 +1972,7 @@ nelmts, H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, /* Compute element sizes and other parameters */ src_type_size = H5T_get_size(mem_type); dst_type_size = H5T_get_size(dataset->type); - target_size = H5P_peek_size_t(dx_plist,H5D_XFER_MAX_TEMP_BUF_NAME); + target_size = dxpl_cache->max_temp_buf; /* XXX: This could cause a problem if the user sets their buffer size * to the same size as the default, and then the dataset elements are * too large for the buffer... - QAK @@ -1892,19 +2001,18 @@ nelmts, H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, H5T_bkg_t path_bkg; /* Type conversion's background info */ /* Retrieve the bkgr buffer property */ - if(H5P_get(dx_plist, H5D_XFER_BKGR_BUF_TYPE_NAME, &need_bkg)<0) - HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve background buffer type") + need_bkg=dxpl_cache->bkgr_buf_type; path_bkg = H5T_path_bkg(tpath); need_bkg = MAX (path_bkg, need_bkg); } else { need_bkg = H5T_BKG_NO; /*never needed even if app says yes*/ } /* end else */ - if (NULL==(tconv_buf=H5P_peek_voidp(dx_plist,H5D_XFER_TCONV_BUF_NAME))) { + if (NULL==(tconv_buf=dxpl_cache->tconv_buf)) { /* Allocate temporary buffer */ if((tconv_buf=H5FL_BLK_MALLOC(type_conv,target_size))==NULL) HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for type conversion") } /* end if */ - if (need_bkg && NULL==(bkg_buf=H5P_peek_voidp(dx_plist,H5D_XFER_BKGR_BUF_NAME))) { + if (need_bkg && NULL==(bkg_buf=dxpl_cache->bkgr_buf)) { /* Allocate background buffer */ H5_CHECK_OVERFLOW((request_nelmts*dst_type_size),hsize_t,size_t); if((bkg_buf=H5FL_BLK_CALLOC(type_conv,(size_t)(request_nelmts*dst_type_size)))==NULL) @@ -1957,7 +2065,7 @@ nelmts, H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, H5_timer_begin(&timer); #endif n = H5S_select_mgath(buf, src_type_size, chunk_info->mspace, &mem_iter, - smine_nelmts, dxpl_id, tconv_buf/*out*/); + smine_nelmts, dxpl_cache, tconv_buf/*out*/); #ifdef H5S_DEBUG H5_timer_end(&(sconv->stats[1].gath_timer), &timer); @@ -1972,8 +2080,8 @@ nelmts, H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, H5_timer_begin(&timer); #endif n = H5S_select_fgath(dataset->ent.file, &(dataset->layout), - dc_plist, &store, dst_type_size, chunk_info->fspace, - &bkg_iter, smine_nelmts, dxpl_id, bkg_buf/*out*/); + dcpl_cache, &store, dst_type_size, chunk_info->fspace, + &bkg_iter, smine_nelmts, dxpl_cache, dxpl_id, bkg_buf/*out*/); #ifdef H5S_DEBUG H5_timer_end(&(sconv->stats[0].bkg_timer), &timer); @@ -1998,8 +2106,8 @@ nelmts, H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, H5_timer_begin(&timer); #endif status = H5S_select_fscat(dataset->ent.file, &(dataset->layout), - dc_plist, &store, dst_type_size, chunk_info->fspace, - &file_iter, smine_nelmts, dxpl_id, tconv_buf); + dcpl_cache, &store, dst_type_size, chunk_info->fspace, + &file_iter, smine_nelmts, dxpl_cache, dxpl_id, tconv_buf); #ifdef H5S_DEBUG H5_timer_end(&(sconv->stats[0].scat_timer), &timer); @@ -2032,10 +2140,9 @@ nelmts, H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, } /* end while */ done: - assert(dx_plist); - if (tconv_buf && NULL==H5P_peek_voidp(dx_plist,H5D_XFER_TCONV_BUF_NAME)) + if (tconv_buf && NULL==dxpl_cache->tconv_buf) H5FL_BLK_FREE(type_conv,tconv_buf); - if (bkg_buf && NULL==H5P_peek_voidp(dx_plist,H5D_XFER_BKGR_BUF_NAME)) + if (bkg_buf && NULL==dxpl_cache->bkgr_buf) H5FL_BLK_FREE(type_conv,bkg_buf); /* Release selection iterators, if necessary */ @@ -2079,7 +2186,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5D_io_assist_mpio(H5P_genplist_t *dx_plist, H5FD_mpio_xfer_t xfer_mode, +H5D_io_assist_mpio(hid_t dxpl_id, H5D_dxpl_cache_t *dxpl_cache, hbool_t *xfer_mode_changed) { herr_t ret_value = SUCCEED; /*return value */ @@ -2091,25 +2198,68 @@ H5D_io_assist_mpio(H5P_genplist_t *dx_plist, H5FD_mpio_xfer_t xfer_mode, * request according to the MPI collective specification. * Do the collective request via independent mode. */ - if (xfer_mode==H5FD_MPIO_COLLECTIVE) { + if (dxpl_cache->xfer_mode==H5FD_MPIO_COLLECTIVE) { + H5P_genplist_t *dx_plist; /* Data transer property list */ + + /* Get the dataset transfer property list */ + if (NULL == (dx_plist = H5I_object(dxpl_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset creation property list") + /* Kludge: change the xfer_mode to independent, handle the request, * then xfer_mode before return. * Better way is to get a temporary data_xfer property with * INDEPENDENT xfer_mode and pass it downwards. */ - xfer_mode = H5FD_MPIO_INDEPENDENT; - if(H5P_set (dx_plist, H5D_XFER_IO_XFER_MODE_NAME, &xfer_mode) < 0) + dxpl_cache->xfer_mode = H5FD_MPIO_INDEPENDENT; + if(H5P_set (dx_plist, H5D_XFER_IO_XFER_MODE_NAME, &dxpl_cache->xfer_mode) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set transfer mode") *xfer_mode_changed=TRUE; /* restore it before return */ -#ifdef H5D_DEBUG - if (H5DEBUG(D)) - fprintf(H5DEBUG(D), "H5D: Cannot handle this COLLECTIVE write request. Do it via INDEPENDENT calls\n"); -#endif } /* end if */ done: FUNC_LEAVE_NOAPI(ret_value) -} +} /* end H5D_io_assist_mpio() */ + + +/*------------------------------------------------------------------------- + * Function: H5D_io_restore_mpio + * + * Purpose: Common logic for restoring MPI transfer mode + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * Friday, February 6, 2004 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D_io_restore_mpio(hid_t dxpl_id) +{ + H5P_genplist_t *dx_plist; /* Data transer property list */ + H5FD_mpio_xfer_t xfer_mode; /*xfer_mode for this request */ + herr_t ret_value = SUCCEED; /*return value */ + + FUNC_ENTER_NOAPI_NOINIT(H5D_io_restore_mpio) + + /* Get the dataset transfer property list */ + if (NULL == (dx_plist = H5I_object(dxpl_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset creation property list") + + /* Kludge: change the xfer_mode to independent, handle the request, + * then xfer_mode before return. + * Better way is to get a temporary data_xfer property with + * INDEPENDENT xfer_mode and pass it downwards. + */ + xfer_mode = H5FD_MPIO_COLLECTIVE; + if(H5P_set (dx_plist, H5D_XFER_IO_XFER_MODE_NAME, &xfer_mode) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set transfer mode") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5D_io_restore_mpio() */ #endif /*H5_HAVE_PARALLEL*/ diff --git a/src/H5Distore.c b/src/H5Distore.c index b726c68..f8ae032 100644 --- a/src/H5Distore.c +++ b/src/H5Distore.c @@ -910,7 +910,8 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5F_istore_flush_entry(H5F_t *f, hid_t dxpl_id, H5F_rdcc_ent_t *ent, hbool_t reset) +H5F_istore_flush_entry(H5F_t *f, const H5D_dxpl_cache_t *dxpl_cache, + hid_t dxpl_id, H5F_rdcc_ent_t *ent, hbool_t reset) { herr_t ret_value=SUCCEED; /*return value */ H5F_istore_ud1_t udata; /*pass through B-tree */ @@ -939,10 +940,6 @@ H5F_istore_flush_entry(H5F_t *f, hid_t dxpl_id, H5F_rdcc_ent_t *ent, hbool_t res /* Should the chunk be filtered before writing it to disk? */ if (ent->pline && ent->pline->nused) { - H5P_genplist_t *plist; /* Data xfer property list */ - H5Z_cb_t cb_struct; - H5Z_EDC_t edc; - if (!reset) { /* * Copy the chunk to a new buffer before running it through @@ -966,17 +963,8 @@ H5F_istore_flush_entry(H5F_t *f, hid_t dxpl_id, H5F_rdcc_ent_t *ent, hbool_t res point_of_no_return = TRUE; ent->chunk = NULL; } - /* Don't know whether we should involve transfer property list. So - * just pass in H5Z_ENABLE_EDC and default callback setting for data - * read. */ - if (NULL == (plist = H5P_object_verify(dxpl_id,H5P_DATASET_XFER))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset transfer property list"); - if(H5P_get(plist,H5D_XFER_EDC_NAME,&edc)<0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get edc information"); - if(H5P_get(plist,H5D_XFER_FILTER_CB_NAME,&cb_struct)<0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get filter callback struct"); - if (H5Z_pipeline(ent->pline, 0, &(udata.key.filter_mask), edc, - cb_struct, &(udata.key.nbytes), &alloc, &buf)<0) { + if (H5Z_pipeline(ent->pline, 0, &(udata.key.filter_mask), dxpl_cache->err_detect, + dxpl_cache->filter_cb, &(udata.key.nbytes), &alloc, &buf)<0) { HGOTO_ERROR(H5E_PLINE, H5E_WRITEERROR, FAIL, "output pipeline failed"); } @@ -1046,7 +1034,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5F_istore_preempt(H5F_t *f, hid_t dxpl_id, H5F_rdcc_ent_t * ent, hbool_t flush) +H5F_istore_preempt(H5F_t *f, const H5D_dxpl_cache_t *dxpl_cache, hid_t dxpl_id, H5F_rdcc_ent_t * ent, hbool_t flush) { H5F_rdcc_t *rdcc = &(f->shared->rdcc); herr_t ret_value=SUCCEED; /* Return value */ @@ -1060,7 +1048,7 @@ H5F_istore_preempt(H5F_t *f, hid_t dxpl_id, H5F_rdcc_ent_t * ent, hbool_t flush) if(flush) { /* Flush */ - if(H5F_istore_flush_entry(f, dxpl_id, ent, TRUE) < 0) + if(H5F_istore_flush_entry(f, dxpl_cache, dxpl_id, ent, TRUE) < 0) HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "cannot flush indexed storage buffer"); } else { @@ -1116,6 +1104,7 @@ done: herr_t H5F_istore_flush (H5F_t *f, hid_t dxpl_id, unsigned flags) { + H5D_dxpl_cache_t dxpl_cache; /* Cached data transfer properties */ H5F_rdcc_t *rdcc = &(f->shared->rdcc); int nerrors=0; H5F_rdcc_ent_t *ent=NULL, *next=NULL; @@ -1123,6 +1112,10 @@ H5F_istore_flush (H5F_t *f, hid_t dxpl_id, unsigned flags) FUNC_ENTER_NOAPI(H5F_istore_flush, FAIL); + /* Fill the DXPL cache values for later use */ + if (H5D_get_dxpl_cache(dxpl_id,&dxpl_cache)<0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't fill dxpl cache") + for (ent=rdcc->head; ent; ent=next) { next = ent->next; if ((flags&H5F_FLUSH_CLEAR_ONLY)) { @@ -1130,10 +1123,10 @@ H5F_istore_flush (H5F_t *f, hid_t dxpl_id, unsigned flags) ent->dirty = FALSE; } /* end if */ else if ((flags&H5F_FLUSH_INVALIDATE)) { - if (H5F_istore_preempt(f, dxpl_id, ent, TRUE )<0) + if (H5F_istore_preempt(f, &dxpl_cache, dxpl_id, ent, TRUE )<0) nerrors++; } else { - if (H5F_istore_flush_entry(f, dxpl_id, ent, FALSE)<0) + if (H5F_istore_flush_entry(f, &dxpl_cache, dxpl_id, ent, FALSE)<0) nerrors++; } } @@ -1166,6 +1159,7 @@ done: herr_t H5F_istore_dest (H5F_t *f, hid_t dxpl_id) { + H5D_dxpl_cache_t dxpl_cache; /* Cached data transfer properties */ H5F_rdcc_t *rdcc = &(f->shared->rdcc); int nerrors=0; H5F_rdcc_ent_t *ent=NULL, *next=NULL; @@ -1173,13 +1167,17 @@ H5F_istore_dest (H5F_t *f, hid_t dxpl_id) FUNC_ENTER_NOAPI(H5F_istore_dest, FAIL); + /* Fill the DXPL cache values for later use */ + if (H5D_get_dxpl_cache(dxpl_id,&dxpl_cache)<0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't fill dxpl cache") + for (ent=rdcc->head; ent; ent=next) { #ifdef H5F_ISTORE_DEBUG HDfputc('c', stderr); HDfflush(stderr); #endif next = ent->next; - if (H5F_istore_preempt(f, dxpl_id, ent, TRUE )<0) + if (H5F_istore_preempt(f, &dxpl_cache, dxpl_id, ent, TRUE )<0) nerrors++; } if (nerrors) @@ -1212,7 +1210,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5F_istore_prune (H5F_t *f, hid_t dxpl_id, size_t size) +H5F_istore_prune (H5F_t *f, const H5D_dxpl_cache_t *dxpl_cache, hid_t dxpl_id, size_t size) { int i, j, nerrors=0; H5F_rdcc_t *rdcc = &(f->shared->rdcc); @@ -1291,7 +1289,7 @@ H5F_istore_prune (H5F_t *f, hid_t dxpl_id, size_t size) if (n[j]==cur) n[j] = cur->next; } - if (H5F_istore_preempt(f, dxpl_id, cur, TRUE)<0) + if (H5F_istore_preempt(f, dxpl_cache, dxpl_id, cur, TRUE)<0) nerrors++; } } @@ -1346,7 +1344,7 @@ done: *------------------------------------------------------------------------- */ static void * -H5F_istore_lock(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, +H5F_istore_lock(H5F_t *f, const H5D_dxpl_cache_t *dxpl_cache, hid_t dxpl_id, const H5O_layout_t *layout, const H5O_pline_t *pline, const H5O_fill_t *fill, H5D_fill_time_t fill_time, const hssize_t offset[], hbool_t relax, unsigned *idx_hint/*in,out*/) @@ -1363,15 +1361,10 @@ H5F_istore_lock(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, herr_t status; /*func return status */ void *chunk=NULL; /*the file chunk */ void *ret_value; /*return value */ - H5P_genplist_t *plist; /* Property list */ - H5Z_EDC_t edc; - H5Z_cb_t cb_struct; FUNC_ENTER_NOAPI_NOINIT(H5F_istore_lock); assert(TRUE==H5P_isa_class(dxpl_id,H5P_DATASET_XFER)); - plist=H5I_object(dxpl_id); - assert(plist!=NULL); HDmemset(&udata, 0, sizeof(H5F_istore_ud1_t)); if (rdcc->nslots>0) { @@ -1447,12 +1440,8 @@ H5F_istore_lock(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for raw data chunk"); if (H5F_block_read(f, H5FD_MEM_DRAW, udata.addr, udata.key.nbytes, dxpl_id, chunk)<0) HGOTO_ERROR (H5E_IO, H5E_READERROR, NULL, "unable to read raw data chunk"); - if(H5P_get(plist,H5D_XFER_EDC_NAME,&edc)<0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, NULL, "can't get edc information"); - if(H5P_get(plist,H5D_XFER_FILTER_CB_NAME,&cb_struct)<0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, NULL, "can't get filter callback struct"); - if (H5Z_pipeline(pline, H5Z_FLAG_REVERSE, &(udata.key.filter_mask), edc, - cb_struct, &(udata.key.nbytes), &chunk_alloc, &chunk)<0) { + if (H5Z_pipeline(pline, H5Z_FLAG_REVERSE, &(udata.key.filter_mask), dxpl_cache->err_detect, + dxpl_cache->filter_cb, &(udata.key.nbytes), &chunk_alloc, &chunk)<0) { HGOTO_ERROR(H5E_PLINE, H5E_READERROR, NULL, "data pipeline read failed"); } rdcc->nmisses++; @@ -1500,10 +1489,10 @@ H5F_istore_lock(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, HDputc('#', stderr); HDfflush(stderr); #endif - if (H5F_istore_preempt(f, dxpl_id, ent, TRUE)<0) + if (H5F_istore_preempt(f, dxpl_cache, dxpl_id, ent, TRUE)<0) HGOTO_ERROR(H5E_IO, H5E_CANTINIT, NULL, "unable to preempt chunk from cache"); } - if (H5F_istore_prune(f, dxpl_id, chunk_size)<0) + if (H5F_istore_prune(f, dxpl_cache, dxpl_id, chunk_size)<0) HGOTO_ERROR(H5E_IO, H5E_CANTINIT, NULL, "unable to preempt chunk(s) from cache"); /* Create a new entry */ @@ -1520,7 +1509,7 @@ H5F_istore_lock(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, ent->wr_count = chunk_size; ent->chunk = chunk; - H5P_get(plist,H5D_XFER_BTREE_SPLIT_RATIO_NAME,&(ent->split_ratios)); + HDmemcpy(&(ent->split_ratios),&dxpl_cache->btree_split_ratio,H5D_XFER_BTREE_SPLIT_RATIO_SIZE); /* Add it to the cache */ assert(NULL==rdcc->slot[idx]); @@ -1619,16 +1608,14 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5F_istore_unlock(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, - const H5O_pline_t *pline, hbool_t dirty, - const hssize_t offset[], unsigned *idx_hint, - uint8_t *chunk, size_t naccessed) +H5F_istore_unlock(H5F_t *f, const H5D_dxpl_cache_t *dxpl_cache, hid_t dxpl_id, + const H5O_layout_t *layout, const H5O_pline_t *pline, hbool_t dirty, + const hssize_t offset[], unsigned *idx_hint, uint8_t *chunk, size_t naccessed) { H5F_rdcc_t *rdcc = &(f->shared->rdcc); H5F_rdcc_ent_t *ent = NULL; int found = -1; unsigned u; - H5P_genplist_t *plist; /* Property list */ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5F_istore_unlock); @@ -1664,12 +1651,9 @@ H5F_istore_unlock(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, x.alloc_size = x.chunk_size; x.chunk = chunk; - assert(TRUE==H5P_isa_class(dxpl_id,H5P_DATASET_XFER)); - plist=H5I_object(dxpl_id); - assert(plist!=NULL); - H5P_get(plist,H5D_XFER_BTREE_SPLIT_RATIO_NAME,&(x.split_ratios)); + HDmemcpy(&(x.split_ratios),&dxpl_cache->btree_split_ratio,H5D_XFER_BTREE_SPLIT_RATIO_SIZE); - H5F_istore_flush_entry (f, dxpl_id, &x, TRUE); + H5F_istore_flush_entry (f, dxpl_cache, dxpl_id, &x, TRUE); } else { if(chunk) H5MM_xfree (chunk); @@ -1709,8 +1693,8 @@ H5F_istore_unlock(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, *------------------------------------------------------------------------- */ ssize_t -H5F_istore_readvv(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, - H5P_genplist_t *dc_plist, hssize_t chunk_coords[], +H5F_istore_readvv(H5F_t *f, const struct H5D_dxpl_cache_t *dxpl_cache, hid_t dxpl_id, + const H5O_layout_t *layout, const struct H5D_dcpl_cache_t *dcpl_cache, hssize_t chunk_coords[], size_t chunk_max_nseq, size_t *chunk_curr_seq, size_t chunk_len_arr[], hsize_t chunk_offset_arr[], size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_offset_arr[], void *buf) @@ -1718,7 +1702,6 @@ H5F_istore_readvv(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, hsize_t chunk_size; /* Chunk size, in bytes */ haddr_t chunk_addr; /* Chunk address on disk */ hssize_t chunk_coords_in_elmts[H5O_LAYOUT_NDIMS]; - H5O_pline_t pline; /* I/O pipeline information */ size_t u; /* Local index variables */ ssize_t ret_value; /* Return value */ @@ -1726,18 +1709,16 @@ H5F_istore_readvv(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, /* Check args */ assert(f); + assert(dxpl_cache); assert(layout && H5D_CHUNKED==layout->type); assert(layout->ndims>0 && layout->ndims<=H5O_LAYOUT_NDIMS); + assert(dcpl_cache); assert(chunk_len_arr); assert(chunk_offset_arr); assert(mem_len_arr); assert(mem_offset_arr); assert(buf); - /* Get necessary properties from property list */ - if(H5P_get(dc_plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get data pipeline"); - /* Compute chunk size */ for (u=0, chunk_size=1; undims; u++) chunk_size *= layout->dim[u]; @@ -1771,29 +1752,21 @@ HDfprintf(stderr,"%s: mem_offset_arr[%Zu]=%Hu\n",FUNC,*mem_curr_seq,mem_offset_a * for the chunk has been defined, then don't load the chunk into the * cache, just write the data to it directly. */ - if (chunk_size>f->shared->rdcc_nbytes && pline.nused==0 && + if (chunk_size>f->shared->rdcc_nbytes && dcpl_cache->pline.nused==0 && chunk_addr!=HADDR_UNDEF) { if ((ret_value=H5F_contig_readvv(f, chunk_size, chunk_addr, chunk_max_nseq, chunk_curr_seq, chunk_len_arr, chunk_offset_arr, mem_max_nseq, mem_curr_seq, mem_len_arr, mem_offset_arr, dxpl_id, buf))<0) HGOTO_ERROR (H5E_IO, H5E_READERROR, FAIL, "unable to read raw data to file"); } /* end if */ else { uint8_t *chunk; /* Pointer to cached chunk in memory */ - H5O_fill_t fill; /* Fill value information */ - H5D_fill_time_t fill_time; /* Fill time information */ unsigned idx_hint=0; /* Cache index hint */ ssize_t naccessed; /* Number of bytes accessed in chunk */ - /* Get necessary properties from property list */ - if(H5P_get(dc_plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get fill value"); - if(H5P_get(dc_plist, H5D_CRT_FILL_TIME_NAME, &fill_time) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get fill time"); - /* * Lock the chunk, copy from application to chunk, then unlock the * chunk. */ - if (NULL==(chunk=H5F_istore_lock(f, dxpl_id, layout, &pline, &fill, fill_time, + if (NULL==(chunk=H5F_istore_lock(f, dxpl_cache, dxpl_id, layout, &dcpl_cache->pline, &dcpl_cache->fill, dcpl_cache->fill_time, chunk_coords_in_elmts, FALSE, &idx_hint))) HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "unable to read raw data chunk"); @@ -1802,7 +1775,7 @@ HDfprintf(stderr,"%s: mem_offset_arr[%Zu]=%Hu\n",FUNC,*mem_curr_seq,mem_offset_a HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "vectorized memcpy failed"); H5_CHECK_OVERFLOW(naccessed,ssize_t,size_t); - if (H5F_istore_unlock(f, dxpl_id, layout, &pline, FALSE, + if (H5F_istore_unlock(f, dxpl_cache, dxpl_id, layout, &dcpl_cache->pline, FALSE, chunk_coords_in_elmts, &idx_hint, chunk, (size_t)naccessed)<0) HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "unable to unlock raw data chunk"); @@ -1831,8 +1804,9 @@ done: *------------------------------------------------------------------------- */ ssize_t -H5F_istore_writevv(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, - H5P_genplist_t *dc_plist, hssize_t chunk_coords[], +H5F_istore_writevv(H5F_t *f, const struct H5D_dxpl_cache_t *dxpl_cache, + hid_t dxpl_id, const H5O_layout_t *layout, + const struct H5D_dcpl_cache_t *dcpl_cache, hssize_t chunk_coords[], size_t chunk_max_nseq, size_t *chunk_curr_seq, size_t chunk_len_arr[], hsize_t chunk_offset_arr[], size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_offset_arr[], const void *buf) @@ -1840,7 +1814,6 @@ H5F_istore_writevv(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, hsize_t chunk_size; /* Chunk size, in bytes */ haddr_t chunk_addr; /* Chunk address on disk */ hssize_t chunk_coords_in_elmts[H5O_LAYOUT_NDIMS]; - H5O_pline_t pline; /* I/O pipeline information */ size_t u; /* Local index variables */ ssize_t ret_value; /* Return value */ @@ -1848,18 +1821,16 @@ H5F_istore_writevv(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, /* Check args */ assert(f); + assert(dxpl_cache); assert(layout && H5D_CHUNKED==layout->type); assert(layout->ndims>0 && layout->ndims<=H5O_LAYOUT_NDIMS); + assert(dcpl_cache); assert(chunk_len_arr); assert(chunk_offset_arr); assert(mem_len_arr); assert(mem_offset_arr); assert(buf); - /* Get necessary properties from property list */ - if(H5P_get(dc_plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get data pipeline"); - /* Compute chunk size */ for (u=0, chunk_size=1; undims; u++) chunk_size *= layout->dim[u]; @@ -1898,11 +1869,11 @@ HDfprintf(stderr,"%s: mem_offset_arr[%Zu]=%Hu\n",FUNC,*mem_curr_seq,mem_offset_a * writing to other elements in the same chunk. Do a direct * write-through of only the elements requested. */ - if ((chunk_size>f->shared->rdcc_nbytes && pline.nused==0 && chunk_addr!=HADDR_UNDEF) + if ((chunk_size>f->shared->rdcc_nbytes && dcpl_cache->pline.nused==0 && chunk_addr!=HADDR_UNDEF) || (IS_H5FD_MPI(f) && (H5F_ACC_RDWR & f->shared->flags))) { #ifdef H5_HAVE_PARALLEL /* Additional sanity check when operating in parallel */ - if (chunk_addr==HADDR_UNDEF || pline.nused>0) + if (chunk_addr==HADDR_UNDEF || dcpl_cache->pline.nused>0) HGOTO_ERROR (H5E_IO, H5E_WRITEERROR, FAIL, "unable to locate raw data chunk"); #endif /* H5_HAVE_PARALLEL */ if ((ret_value=H5F_contig_writevv(f, chunk_size, chunk_addr, chunk_max_nseq, chunk_curr_seq, chunk_len_arr, chunk_offset_arr, mem_max_nseq, mem_curr_seq, mem_len_arr, mem_offset_arr, dxpl_id, buf))<0) @@ -1910,18 +1881,10 @@ HDfprintf(stderr,"%s: mem_offset_arr[%Zu]=%Hu\n",FUNC,*mem_curr_seq,mem_offset_a } /* end if */ else { uint8_t *chunk; /* Pointer to cached chunk in memory */ - H5O_fill_t fill; /* Fill value information */ - H5D_fill_time_t fill_time; /* Fill time information */ unsigned idx_hint=0; /* Cache index hint */ ssize_t naccessed; /* Number of bytes accessed in chunk */ hbool_t relax; /* Whether whole chunk is selected */ - /* Get necessary properties from property list */ - if(H5P_get(dc_plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get fill value"); - if(H5P_get(dc_plist, H5D_CRT_FILL_TIME_NAME, &fill_time) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get fill time"); - /* * Lock the chunk, copy from application to chunk, then unlock the * chunk. @@ -1931,7 +1894,7 @@ HDfprintf(stderr,"%s: mem_offset_arr[%Zu]=%Hu\n",FUNC,*mem_curr_seq,mem_offset_a else relax = FALSE; - if (NULL==(chunk=H5F_istore_lock(f, dxpl_id, layout, &pline, &fill, fill_time, + if (NULL==(chunk=H5F_istore_lock(f, dxpl_cache, dxpl_id, layout, &dcpl_cache->pline, &dcpl_cache->fill, dcpl_cache->fill_time, chunk_coords_in_elmts, relax, &idx_hint))) HGOTO_ERROR (H5E_IO, H5E_WRITEERROR, FAIL, "unable to read raw data chunk"); @@ -1940,7 +1903,7 @@ HDfprintf(stderr,"%s: mem_offset_arr[%Zu]=%Hu\n",FUNC,*mem_curr_seq,mem_offset_a HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "vectorized memcpy failed"); H5_CHECK_OVERFLOW(naccessed,ssize_t,size_t); - if (H5F_istore_unlock(f, dxpl_id, layout, &pline, TRUE, + if (H5F_istore_unlock(f, dxpl_cache, dxpl_id, layout, &dcpl_cache->pline, TRUE, chunk_coords_in_elmts, &idx_hint, chunk, (size_t)naccessed)<0) HGOTO_ERROR (H5E_IO, H5E_WRITEERROR, FAIL, "uanble to unlock raw data chunk"); @@ -2174,7 +2137,7 @@ H5F_istore_allocate(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, assert(layout->ndims>0 && layout->ndims<=H5O_LAYOUT_NDIMS); assert(H5F_addr_defined(layout->addr)); assert(TRUE==H5P_isa_class(dxpl_id,H5P_DATASET_XFER)); - assert(dc_plist!=NULL); + assert(dc_plist); /* Get necessary properties from dataset creation property list */ if(H5P_get(dc_plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0) @@ -2467,7 +2430,8 @@ done: *------------------------------------------------------------------------- */ herr_t -H5F_istore_prune_by_extent(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, const H5S_t * space) +H5F_istore_prune_by_extent(H5F_t *f, const struct H5D_dxpl_cache_t *dxpl_cache, + hid_t dxpl_id, const H5O_layout_t *layout, const H5S_t * space) { H5F_rdcc_t *rdcc = &(f->shared->rdcc); /*raw data chunk cache */ H5F_rdcc_ent_t *ent = NULL, *next = NULL; /*cache entry */ @@ -2520,7 +2484,7 @@ H5F_istore_prune_by_extent(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, #endif /* Preempt the entry from the cache, but do not flush it to disk */ - if(H5F_istore_preempt(f, dxpl_id, ent, FALSE) < 0) + if(H5F_istore_preempt(f, dxpl_cache, dxpl_id, ent, FALSE) < 0) HGOTO_ERROR(H5E_IO, H5E_CANTINIT, 0, "unable to preempt chunk"); } } @@ -2677,8 +2641,9 @@ done: *------------------------------------------------------------------------- */ herr_t -H5F_istore_initialize_by_extent(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, - H5P_genplist_t *dc_plist, const H5S_t * space) +H5F_istore_initialize_by_extent(H5F_t *f, const struct H5D_dxpl_cache_t *dxpl_cache, + hid_t dxpl_id, const H5O_layout_t *layout, + H5P_genplist_t *dc_plist, const H5S_t * space) { uint8_t *chunk = NULL; /*the file chunk */ unsigned idx_hint = 0; /*input value for H5F_istore_lock */ @@ -2775,7 +2740,7 @@ H5F_istore_initialize_by_extent(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *lay if(found) { - if(NULL == (chunk = H5F_istore_lock(f, dxpl_id, layout, &pline, &fill, fill_time, + if(NULL == (chunk = H5F_istore_lock(f, dxpl_cache, dxpl_id, layout, &pline, &fill, fill_time, chunk_offset, FALSE, &idx_hint))) HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to read raw data chunk"); @@ -2808,7 +2773,7 @@ H5F_istore_initialize_by_extent(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *lay if(H5S_select_fill(fill.buf, (size_t)size[rank], space_chunk, chunk) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTENCODE, FAIL, "filling selection failed"); - if(H5F_istore_unlock(f, dxpl_id, layout, &pline, TRUE, + if(H5F_istore_unlock(f, dxpl_cache, dxpl_id, layout, &pline, TRUE, chunk_offset, &idx_hint, chunk, (size_t)naccessed) < 0) HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to unlock raw data chunk"); } /*found */ @@ -2848,6 +2813,7 @@ done: herr_t H5F_istore_delete(H5F_t *f, hid_t dxpl_id, const struct H5O_layout_t *layout) { + H5D_dxpl_cache_t dxpl_cache; /* Cached data transfer properties */ H5F_istore_ud1_t udata; /* User data for B-tree iterator call */ H5F_rdcc_t *rdcc = &(f->shared->rdcc); /* File's raw data chunk cache */ H5F_rdcc_ent_t *ent, *next; /* Pointers to cache entries */ @@ -2855,6 +2821,10 @@ H5F_istore_delete(H5F_t *f, hid_t dxpl_id, const struct H5O_layout_t *layout) FUNC_ENTER_NOAPI(H5F_istore_delete, FAIL); + /* Fill the DXPL cache values for later use */ + if (H5D_get_dxpl_cache(dxpl_id,&dxpl_cache)<0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't fill dxpl cache") + /* Check if the B-tree has been created in the file */ if(H5F_addr_defined(layout->addr)) { /* Iterate through the entries in the cache, checking for the chunks to be deleted */ @@ -2865,7 +2835,7 @@ H5F_istore_delete(H5F_t *f, hid_t dxpl_id, const struct H5O_layout_t *layout) /* Is the chunk to be deleted this cache entry? */ if(layout->addr==ent->layout->addr) /* Remove entry without flushing */ - if (H5F_istore_preempt(f, dxpl_id, ent, FALSE )<0) + if (H5F_istore_preempt(f, &dxpl_cache, dxpl_id, ent, FALSE )<0) HGOTO_ERROR (H5E_IO, H5E_CANTFLUSH, FAIL, "unable to flush one or more raw data chunks"); } /* end for */ diff --git a/src/H5Dprivate.h b/src/H5Dprivate.h index 81075fc..d0755e4 100644 --- a/src/H5Dprivate.h +++ b/src/H5Dprivate.h @@ -22,6 +22,7 @@ #include "H5Dpublic.h" /* Private headers needed by this file */ +#include "H5FDprivate.h" /* File drivers */ #include "H5Oprivate.h" /* Object headers */ /* @@ -126,7 +127,7 @@ #define H5D_XFER_IO_XFER_MODE_SIZE sizeof(H5FD_mpio_xfer_t) #define H5D_XFER_IO_XFER_MODE_DEF H5FD_MPIO_INDEPENDENT /* Definitions for EDC property */ -#define H5D_XFER_EDC_NAME "error-detecting" +#define H5D_XFER_EDC_NAME "err_detect" #define H5D_XFER_EDC_SIZE sizeof(H5Z_EDC_t) #define H5D_XFER_EDC_DEF H5Z_ENABLE_EDC /* Definitions for filter callback function property */ @@ -147,6 +148,28 @@ typedef union H5D_storage_t { hssize_t *chunk_coords; /* chunk's coordinates in file chunks */ } H5D_storage_t; +/* Typedef for cached dataset transfer property list information */ +typedef struct H5D_dxpl_cache_t { + size_t max_temp_buf; /* Maximum temporary buffer size (H5D_XFER_MAX_TEMP_BUF_NAME) */ + void *tconv_buf; /* Temporary conversion buffer (H5D_XFER_TCONV_BUF_NAME) */ + void *bkgr_buf; /* Background conversion buffer (H5D_XFER_BKGR_BUF_NAME) */ + H5T_bkg_t bkgr_buf_type; /* Background buffer type (H5D_XFER_BKGR_BUF_NAME) */ + double btree_split_ratio[3];/* B-tree split ratios (H5D_XFER_BTREE_SPLIT_RATIO_NAME) */ + size_t vec_size; /* Size of hyperslab vector (H5D_XFER_HYPER_VECTOR_SIZE_NAME) */ +#ifdef H5_HAVE_PARALLEL + H5FD_mpio_xfer_t xfer_mode; /* Parallel transfer for this request (H5D_XFER_IO_XFER_MODE_NAME) */ +#endif /*H5_HAVE_PARALLEL*/ + H5Z_EDC_t err_detect; /* Error detection info (H5D_XFER_EDC_NAME) */ + H5Z_cb_t filter_cb; /* Filter callback function (H5D_XFER_FILTER_CB_NAME) */ +} H5D_dxpl_cache_t; + +/* Typedef for cached dataset creation property list information */ +typedef struct H5D_dcpl_cache_t { + H5O_pline_t pline; /* I/O pipeline info (H5D_CRT_DATA_PIPELINE_NAME) */ + H5O_fill_t fill; /* Fill value info (H5D_CRT_FILL_VALUE_NAME) */ + H5D_fill_time_t fill_time; /* Fill time (H5D_CRT_FILL_TIME_NAME) */ +} H5D_dcpl_cache_t; + /* Library-private functions defined in H5D package */ H5_DLL herr_t H5D_init(void); H5_DLL hid_t H5D_open(H5G_entry_t *ent, hid_t dxpl_id); @@ -161,5 +184,6 @@ H5_DLL herr_t H5D_xfer_copy(hid_t new_plist_id, hid_t old_plist_id, void *copy_data); H5_DLL herr_t H5D_xfer_close(hid_t dxpl_id, void *close_data); H5_DLL herr_t H5D_flush(const H5F_t *f, hid_t dxpl_id); +H5_DLL herr_t H5D_get_dxpl_cache(hid_t dxpl_id, H5D_dxpl_cache_t *cache); #endif diff --git a/src/H5Dseq.c b/src/H5Dseq.c index 03c10fe..3e8ce3b 100644 --- a/src/H5Dseq.c +++ b/src/H5Dseq.c @@ -68,8 +68,9 @@ static int interface_initialize_g = 0; *------------------------------------------------------------------------- */ herr_t -H5F_seq_read(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, - H5P_genplist_t *dc_plist, const H5D_storage_t *store, +H5F_seq_read(H5F_t *f, const struct H5D_dxpl_cache_t *dxpl_cache, + hid_t dxpl_id, const H5O_layout_t *layout, + const struct H5D_dcpl_cache_t *dcpl_cache, const H5D_storage_t *store, size_t seq_len, hsize_t dset_offset, void *buf/*out*/) { hsize_t mem_off=0; /* Offset in memory */ @@ -86,7 +87,7 @@ H5F_seq_read(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, assert(buf); assert(TRUE==H5P_isa_class(dxpl_id,H5P_DATASET_XFER)); - if (H5F_seq_readvv(f, dxpl_id, layout, dc_plist, store, 1, &dset_curr_seq, &seq_len, &dset_offset, 1, &mem_curr_seq, &mem_len, &mem_off, buf)<0) + if (H5F_seq_readvv(f, dxpl_cache, dxpl_id, layout, dcpl_cache, store, 1, &dset_curr_seq, &seq_len, &dset_offset, 1, &mem_curr_seq, &mem_len, &mem_off, buf)<0) HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "vector read failed"); done: @@ -116,8 +117,9 @@ done: *------------------------------------------------------------------------- */ herr_t -H5F_seq_write(H5F_t *f, hid_t dxpl_id, H5O_layout_t *layout, - H5P_genplist_t *dc_plist, const H5D_storage_t *store, +H5F_seq_write(H5F_t *f, const struct H5D_dxpl_cache_t *dxpl_cache, + hid_t dxpl_id, H5O_layout_t *layout, + const struct H5D_dcpl_cache_t *dcpl_cache, const H5D_storage_t *store, size_t seq_len, hsize_t dset_offset, const void *buf) { hsize_t mem_off=0; /* Offset in memory */ @@ -134,7 +136,7 @@ H5F_seq_write(H5F_t *f, hid_t dxpl_id, H5O_layout_t *layout, assert(buf); assert(TRUE==H5P_isa_class(dxpl_id,H5P_DATASET_XFER)); - if (H5F_seq_writevv(f, dxpl_id, layout, dc_plist, store, 1, &dset_curr_seq, &seq_len, &dset_offset, 1, &mem_curr_seq, &mem_len, &mem_off, buf)<0) + if (H5F_seq_writevv(f, dxpl_cache, dxpl_id, layout, dcpl_cache, store, 1, &dset_curr_seq, &seq_len, &dset_offset, 1, &mem_curr_seq, &mem_len, &mem_off, buf)<0) HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "vector write failed"); done: @@ -183,8 +185,9 @@ done: *------------------------------------------------------------------------- */ ssize_t -H5F_seq_readvv(H5F_t *f, hid_t dxpl_id, const struct H5O_layout_t *layout, - struct H5P_genplist_t *dc_plist, const H5D_storage_t *store, +H5F_seq_readvv(H5F_t *f, const struct H5D_dxpl_cache_t *dxpl_cache, hid_t dxpl_id, + const struct H5O_layout_t *layout, + const struct H5D_dcpl_cache_t *dcpl_cache, const H5D_storage_t *store, 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[], void *buf/*out*/) @@ -197,7 +200,7 @@ H5F_seq_readvv(H5F_t *f, hid_t dxpl_id, const struct H5O_layout_t *layout, assert(f); assert(TRUE==H5P_isa_class(dxpl_id,H5P_DATASET_XFER)); /* Make certain we have the correct type of property list */ assert(layout); - assert(dc_plist); + assert(dcpl_cache); assert(dset_curr_seq); assert(*dset_curr_seqchunk_coords, + if((ret_value=H5F_istore_readvv(f, dxpl_cache, dxpl_id, layout, dcpl_cache, store->chunk_coords, dset_max_nseq, dset_curr_seq, dset_len_arr, dset_offset_arr, mem_max_nseq, mem_curr_seq, mem_len_arr, mem_offset_arr, buf))<0) @@ -298,8 +301,9 @@ done: *------------------------------------------------------------------------- */ ssize_t -H5F_seq_writevv(H5F_t *f, hid_t dxpl_id, struct H5O_layout_t *layout, - struct H5P_genplist_t *dc_plist, const H5D_storage_t *store, +H5F_seq_writevv(H5F_t *f, const struct H5D_dxpl_cache_t *dxpl_cache, + hid_t dxpl_id, struct H5O_layout_t *layout, + const struct H5D_dcpl_cache_t *dcpl_cache, const H5D_storage_t *store, 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[], const void *buf) @@ -312,7 +316,7 @@ H5F_seq_writevv(H5F_t *f, hid_t dxpl_id, struct H5O_layout_t *layout, assert(f); assert(TRUE==H5P_isa_class(dxpl_id,H5P_DATASET_XFER)); /* Make certain we have the correct type of property list */ assert(layout); - assert(dc_plist); + assert(dcpl_cache); assert(dset_curr_seq); assert(*dset_curr_seqchunk_coords, + if((ret_value=H5F_istore_writevv(f, dxpl_cache, dxpl_id, layout, dcpl_cache, store->chunk_coords, dset_max_nseq, dset_curr_seq, dset_len_arr, dset_offset_arr, mem_max_nseq, mem_curr_seq, mem_len_arr, mem_offset_arr, buf))<0) diff --git a/src/H5FDprivate.h b/src/H5FDprivate.h index 064d337..52747d0 100644 --- a/src/H5FDprivate.h +++ b/src/H5FDprivate.h @@ -32,6 +32,9 @@ /* Macros */ +/* Forward declarations for prototype arguments */ +struct H5P_genplist_t; + /* Prototypes */ H5_DLL int H5FD_term_interface(void); H5_DLL H5FD_class_t *H5FD_get_class(hid_t id); diff --git a/src/H5Fistore.c b/src/H5Fistore.c index b726c68..f8ae032 100644 --- a/src/H5Fistore.c +++ b/src/H5Fistore.c @@ -910,7 +910,8 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5F_istore_flush_entry(H5F_t *f, hid_t dxpl_id, H5F_rdcc_ent_t *ent, hbool_t reset) +H5F_istore_flush_entry(H5F_t *f, const H5D_dxpl_cache_t *dxpl_cache, + hid_t dxpl_id, H5F_rdcc_ent_t *ent, hbool_t reset) { herr_t ret_value=SUCCEED; /*return value */ H5F_istore_ud1_t udata; /*pass through B-tree */ @@ -939,10 +940,6 @@ H5F_istore_flush_entry(H5F_t *f, hid_t dxpl_id, H5F_rdcc_ent_t *ent, hbool_t res /* Should the chunk be filtered before writing it to disk? */ if (ent->pline && ent->pline->nused) { - H5P_genplist_t *plist; /* Data xfer property list */ - H5Z_cb_t cb_struct; - H5Z_EDC_t edc; - if (!reset) { /* * Copy the chunk to a new buffer before running it through @@ -966,17 +963,8 @@ H5F_istore_flush_entry(H5F_t *f, hid_t dxpl_id, H5F_rdcc_ent_t *ent, hbool_t res point_of_no_return = TRUE; ent->chunk = NULL; } - /* Don't know whether we should involve transfer property list. So - * just pass in H5Z_ENABLE_EDC and default callback setting for data - * read. */ - if (NULL == (plist = H5P_object_verify(dxpl_id,H5P_DATASET_XFER))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset transfer property list"); - if(H5P_get(plist,H5D_XFER_EDC_NAME,&edc)<0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get edc information"); - if(H5P_get(plist,H5D_XFER_FILTER_CB_NAME,&cb_struct)<0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get filter callback struct"); - if (H5Z_pipeline(ent->pline, 0, &(udata.key.filter_mask), edc, - cb_struct, &(udata.key.nbytes), &alloc, &buf)<0) { + if (H5Z_pipeline(ent->pline, 0, &(udata.key.filter_mask), dxpl_cache->err_detect, + dxpl_cache->filter_cb, &(udata.key.nbytes), &alloc, &buf)<0) { HGOTO_ERROR(H5E_PLINE, H5E_WRITEERROR, FAIL, "output pipeline failed"); } @@ -1046,7 +1034,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5F_istore_preempt(H5F_t *f, hid_t dxpl_id, H5F_rdcc_ent_t * ent, hbool_t flush) +H5F_istore_preempt(H5F_t *f, const H5D_dxpl_cache_t *dxpl_cache, hid_t dxpl_id, H5F_rdcc_ent_t * ent, hbool_t flush) { H5F_rdcc_t *rdcc = &(f->shared->rdcc); herr_t ret_value=SUCCEED; /* Return value */ @@ -1060,7 +1048,7 @@ H5F_istore_preempt(H5F_t *f, hid_t dxpl_id, H5F_rdcc_ent_t * ent, hbool_t flush) if(flush) { /* Flush */ - if(H5F_istore_flush_entry(f, dxpl_id, ent, TRUE) < 0) + if(H5F_istore_flush_entry(f, dxpl_cache, dxpl_id, ent, TRUE) < 0) HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "cannot flush indexed storage buffer"); } else { @@ -1116,6 +1104,7 @@ done: herr_t H5F_istore_flush (H5F_t *f, hid_t dxpl_id, unsigned flags) { + H5D_dxpl_cache_t dxpl_cache; /* Cached data transfer properties */ H5F_rdcc_t *rdcc = &(f->shared->rdcc); int nerrors=0; H5F_rdcc_ent_t *ent=NULL, *next=NULL; @@ -1123,6 +1112,10 @@ H5F_istore_flush (H5F_t *f, hid_t dxpl_id, unsigned flags) FUNC_ENTER_NOAPI(H5F_istore_flush, FAIL); + /* Fill the DXPL cache values for later use */ + if (H5D_get_dxpl_cache(dxpl_id,&dxpl_cache)<0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't fill dxpl cache") + for (ent=rdcc->head; ent; ent=next) { next = ent->next; if ((flags&H5F_FLUSH_CLEAR_ONLY)) { @@ -1130,10 +1123,10 @@ H5F_istore_flush (H5F_t *f, hid_t dxpl_id, unsigned flags) ent->dirty = FALSE; } /* end if */ else if ((flags&H5F_FLUSH_INVALIDATE)) { - if (H5F_istore_preempt(f, dxpl_id, ent, TRUE )<0) + if (H5F_istore_preempt(f, &dxpl_cache, dxpl_id, ent, TRUE )<0) nerrors++; } else { - if (H5F_istore_flush_entry(f, dxpl_id, ent, FALSE)<0) + if (H5F_istore_flush_entry(f, &dxpl_cache, dxpl_id, ent, FALSE)<0) nerrors++; } } @@ -1166,6 +1159,7 @@ done: herr_t H5F_istore_dest (H5F_t *f, hid_t dxpl_id) { + H5D_dxpl_cache_t dxpl_cache; /* Cached data transfer properties */ H5F_rdcc_t *rdcc = &(f->shared->rdcc); int nerrors=0; H5F_rdcc_ent_t *ent=NULL, *next=NULL; @@ -1173,13 +1167,17 @@ H5F_istore_dest (H5F_t *f, hid_t dxpl_id) FUNC_ENTER_NOAPI(H5F_istore_dest, FAIL); + /* Fill the DXPL cache values for later use */ + if (H5D_get_dxpl_cache(dxpl_id,&dxpl_cache)<0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't fill dxpl cache") + for (ent=rdcc->head; ent; ent=next) { #ifdef H5F_ISTORE_DEBUG HDfputc('c', stderr); HDfflush(stderr); #endif next = ent->next; - if (H5F_istore_preempt(f, dxpl_id, ent, TRUE )<0) + if (H5F_istore_preempt(f, &dxpl_cache, dxpl_id, ent, TRUE )<0) nerrors++; } if (nerrors) @@ -1212,7 +1210,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5F_istore_prune (H5F_t *f, hid_t dxpl_id, size_t size) +H5F_istore_prune (H5F_t *f, const H5D_dxpl_cache_t *dxpl_cache, hid_t dxpl_id, size_t size) { int i, j, nerrors=0; H5F_rdcc_t *rdcc = &(f->shared->rdcc); @@ -1291,7 +1289,7 @@ H5F_istore_prune (H5F_t *f, hid_t dxpl_id, size_t size) if (n[j]==cur) n[j] = cur->next; } - if (H5F_istore_preempt(f, dxpl_id, cur, TRUE)<0) + if (H5F_istore_preempt(f, dxpl_cache, dxpl_id, cur, TRUE)<0) nerrors++; } } @@ -1346,7 +1344,7 @@ done: *------------------------------------------------------------------------- */ static void * -H5F_istore_lock(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, +H5F_istore_lock(H5F_t *f, const H5D_dxpl_cache_t *dxpl_cache, hid_t dxpl_id, const H5O_layout_t *layout, const H5O_pline_t *pline, const H5O_fill_t *fill, H5D_fill_time_t fill_time, const hssize_t offset[], hbool_t relax, unsigned *idx_hint/*in,out*/) @@ -1363,15 +1361,10 @@ H5F_istore_lock(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, herr_t status; /*func return status */ void *chunk=NULL; /*the file chunk */ void *ret_value; /*return value */ - H5P_genplist_t *plist; /* Property list */ - H5Z_EDC_t edc; - H5Z_cb_t cb_struct; FUNC_ENTER_NOAPI_NOINIT(H5F_istore_lock); assert(TRUE==H5P_isa_class(dxpl_id,H5P_DATASET_XFER)); - plist=H5I_object(dxpl_id); - assert(plist!=NULL); HDmemset(&udata, 0, sizeof(H5F_istore_ud1_t)); if (rdcc->nslots>0) { @@ -1447,12 +1440,8 @@ H5F_istore_lock(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for raw data chunk"); if (H5F_block_read(f, H5FD_MEM_DRAW, udata.addr, udata.key.nbytes, dxpl_id, chunk)<0) HGOTO_ERROR (H5E_IO, H5E_READERROR, NULL, "unable to read raw data chunk"); - if(H5P_get(plist,H5D_XFER_EDC_NAME,&edc)<0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, NULL, "can't get edc information"); - if(H5P_get(plist,H5D_XFER_FILTER_CB_NAME,&cb_struct)<0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, NULL, "can't get filter callback struct"); - if (H5Z_pipeline(pline, H5Z_FLAG_REVERSE, &(udata.key.filter_mask), edc, - cb_struct, &(udata.key.nbytes), &chunk_alloc, &chunk)<0) { + if (H5Z_pipeline(pline, H5Z_FLAG_REVERSE, &(udata.key.filter_mask), dxpl_cache->err_detect, + dxpl_cache->filter_cb, &(udata.key.nbytes), &chunk_alloc, &chunk)<0) { HGOTO_ERROR(H5E_PLINE, H5E_READERROR, NULL, "data pipeline read failed"); } rdcc->nmisses++; @@ -1500,10 +1489,10 @@ H5F_istore_lock(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, HDputc('#', stderr); HDfflush(stderr); #endif - if (H5F_istore_preempt(f, dxpl_id, ent, TRUE)<0) + if (H5F_istore_preempt(f, dxpl_cache, dxpl_id, ent, TRUE)<0) HGOTO_ERROR(H5E_IO, H5E_CANTINIT, NULL, "unable to preempt chunk from cache"); } - if (H5F_istore_prune(f, dxpl_id, chunk_size)<0) + if (H5F_istore_prune(f, dxpl_cache, dxpl_id, chunk_size)<0) HGOTO_ERROR(H5E_IO, H5E_CANTINIT, NULL, "unable to preempt chunk(s) from cache"); /* Create a new entry */ @@ -1520,7 +1509,7 @@ H5F_istore_lock(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, ent->wr_count = chunk_size; ent->chunk = chunk; - H5P_get(plist,H5D_XFER_BTREE_SPLIT_RATIO_NAME,&(ent->split_ratios)); + HDmemcpy(&(ent->split_ratios),&dxpl_cache->btree_split_ratio,H5D_XFER_BTREE_SPLIT_RATIO_SIZE); /* Add it to the cache */ assert(NULL==rdcc->slot[idx]); @@ -1619,16 +1608,14 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5F_istore_unlock(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, - const H5O_pline_t *pline, hbool_t dirty, - const hssize_t offset[], unsigned *idx_hint, - uint8_t *chunk, size_t naccessed) +H5F_istore_unlock(H5F_t *f, const H5D_dxpl_cache_t *dxpl_cache, hid_t dxpl_id, + const H5O_layout_t *layout, const H5O_pline_t *pline, hbool_t dirty, + const hssize_t offset[], unsigned *idx_hint, uint8_t *chunk, size_t naccessed) { H5F_rdcc_t *rdcc = &(f->shared->rdcc); H5F_rdcc_ent_t *ent = NULL; int found = -1; unsigned u; - H5P_genplist_t *plist; /* Property list */ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5F_istore_unlock); @@ -1664,12 +1651,9 @@ H5F_istore_unlock(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, x.alloc_size = x.chunk_size; x.chunk = chunk; - assert(TRUE==H5P_isa_class(dxpl_id,H5P_DATASET_XFER)); - plist=H5I_object(dxpl_id); - assert(plist!=NULL); - H5P_get(plist,H5D_XFER_BTREE_SPLIT_RATIO_NAME,&(x.split_ratios)); + HDmemcpy(&(x.split_ratios),&dxpl_cache->btree_split_ratio,H5D_XFER_BTREE_SPLIT_RATIO_SIZE); - H5F_istore_flush_entry (f, dxpl_id, &x, TRUE); + H5F_istore_flush_entry (f, dxpl_cache, dxpl_id, &x, TRUE); } else { if(chunk) H5MM_xfree (chunk); @@ -1709,8 +1693,8 @@ H5F_istore_unlock(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, *------------------------------------------------------------------------- */ ssize_t -H5F_istore_readvv(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, - H5P_genplist_t *dc_plist, hssize_t chunk_coords[], +H5F_istore_readvv(H5F_t *f, const struct H5D_dxpl_cache_t *dxpl_cache, hid_t dxpl_id, + const H5O_layout_t *layout, const struct H5D_dcpl_cache_t *dcpl_cache, hssize_t chunk_coords[], size_t chunk_max_nseq, size_t *chunk_curr_seq, size_t chunk_len_arr[], hsize_t chunk_offset_arr[], size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_offset_arr[], void *buf) @@ -1718,7 +1702,6 @@ H5F_istore_readvv(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, hsize_t chunk_size; /* Chunk size, in bytes */ haddr_t chunk_addr; /* Chunk address on disk */ hssize_t chunk_coords_in_elmts[H5O_LAYOUT_NDIMS]; - H5O_pline_t pline; /* I/O pipeline information */ size_t u; /* Local index variables */ ssize_t ret_value; /* Return value */ @@ -1726,18 +1709,16 @@ H5F_istore_readvv(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, /* Check args */ assert(f); + assert(dxpl_cache); assert(layout && H5D_CHUNKED==layout->type); assert(layout->ndims>0 && layout->ndims<=H5O_LAYOUT_NDIMS); + assert(dcpl_cache); assert(chunk_len_arr); assert(chunk_offset_arr); assert(mem_len_arr); assert(mem_offset_arr); assert(buf); - /* Get necessary properties from property list */ - if(H5P_get(dc_plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get data pipeline"); - /* Compute chunk size */ for (u=0, chunk_size=1; undims; u++) chunk_size *= layout->dim[u]; @@ -1771,29 +1752,21 @@ HDfprintf(stderr,"%s: mem_offset_arr[%Zu]=%Hu\n",FUNC,*mem_curr_seq,mem_offset_a * for the chunk has been defined, then don't load the chunk into the * cache, just write the data to it directly. */ - if (chunk_size>f->shared->rdcc_nbytes && pline.nused==0 && + if (chunk_size>f->shared->rdcc_nbytes && dcpl_cache->pline.nused==0 && chunk_addr!=HADDR_UNDEF) { if ((ret_value=H5F_contig_readvv(f, chunk_size, chunk_addr, chunk_max_nseq, chunk_curr_seq, chunk_len_arr, chunk_offset_arr, mem_max_nseq, mem_curr_seq, mem_len_arr, mem_offset_arr, dxpl_id, buf))<0) HGOTO_ERROR (H5E_IO, H5E_READERROR, FAIL, "unable to read raw data to file"); } /* end if */ else { uint8_t *chunk; /* Pointer to cached chunk in memory */ - H5O_fill_t fill; /* Fill value information */ - H5D_fill_time_t fill_time; /* Fill time information */ unsigned idx_hint=0; /* Cache index hint */ ssize_t naccessed; /* Number of bytes accessed in chunk */ - /* Get necessary properties from property list */ - if(H5P_get(dc_plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get fill value"); - if(H5P_get(dc_plist, H5D_CRT_FILL_TIME_NAME, &fill_time) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get fill time"); - /* * Lock the chunk, copy from application to chunk, then unlock the * chunk. */ - if (NULL==(chunk=H5F_istore_lock(f, dxpl_id, layout, &pline, &fill, fill_time, + if (NULL==(chunk=H5F_istore_lock(f, dxpl_cache, dxpl_id, layout, &dcpl_cache->pline, &dcpl_cache->fill, dcpl_cache->fill_time, chunk_coords_in_elmts, FALSE, &idx_hint))) HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "unable to read raw data chunk"); @@ -1802,7 +1775,7 @@ HDfprintf(stderr,"%s: mem_offset_arr[%Zu]=%Hu\n",FUNC,*mem_curr_seq,mem_offset_a HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "vectorized memcpy failed"); H5_CHECK_OVERFLOW(naccessed,ssize_t,size_t); - if (H5F_istore_unlock(f, dxpl_id, layout, &pline, FALSE, + if (H5F_istore_unlock(f, dxpl_cache, dxpl_id, layout, &dcpl_cache->pline, FALSE, chunk_coords_in_elmts, &idx_hint, chunk, (size_t)naccessed)<0) HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "unable to unlock raw data chunk"); @@ -1831,8 +1804,9 @@ done: *------------------------------------------------------------------------- */ ssize_t -H5F_istore_writevv(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, - H5P_genplist_t *dc_plist, hssize_t chunk_coords[], +H5F_istore_writevv(H5F_t *f, const struct H5D_dxpl_cache_t *dxpl_cache, + hid_t dxpl_id, const H5O_layout_t *layout, + const struct H5D_dcpl_cache_t *dcpl_cache, hssize_t chunk_coords[], size_t chunk_max_nseq, size_t *chunk_curr_seq, size_t chunk_len_arr[], hsize_t chunk_offset_arr[], size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_offset_arr[], const void *buf) @@ -1840,7 +1814,6 @@ H5F_istore_writevv(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, hsize_t chunk_size; /* Chunk size, in bytes */ haddr_t chunk_addr; /* Chunk address on disk */ hssize_t chunk_coords_in_elmts[H5O_LAYOUT_NDIMS]; - H5O_pline_t pline; /* I/O pipeline information */ size_t u; /* Local index variables */ ssize_t ret_value; /* Return value */ @@ -1848,18 +1821,16 @@ H5F_istore_writevv(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, /* Check args */ assert(f); + assert(dxpl_cache); assert(layout && H5D_CHUNKED==layout->type); assert(layout->ndims>0 && layout->ndims<=H5O_LAYOUT_NDIMS); + assert(dcpl_cache); assert(chunk_len_arr); assert(chunk_offset_arr); assert(mem_len_arr); assert(mem_offset_arr); assert(buf); - /* Get necessary properties from property list */ - if(H5P_get(dc_plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get data pipeline"); - /* Compute chunk size */ for (u=0, chunk_size=1; undims; u++) chunk_size *= layout->dim[u]; @@ -1898,11 +1869,11 @@ HDfprintf(stderr,"%s: mem_offset_arr[%Zu]=%Hu\n",FUNC,*mem_curr_seq,mem_offset_a * writing to other elements in the same chunk. Do a direct * write-through of only the elements requested. */ - if ((chunk_size>f->shared->rdcc_nbytes && pline.nused==0 && chunk_addr!=HADDR_UNDEF) + if ((chunk_size>f->shared->rdcc_nbytes && dcpl_cache->pline.nused==0 && chunk_addr!=HADDR_UNDEF) || (IS_H5FD_MPI(f) && (H5F_ACC_RDWR & f->shared->flags))) { #ifdef H5_HAVE_PARALLEL /* Additional sanity check when operating in parallel */ - if (chunk_addr==HADDR_UNDEF || pline.nused>0) + if (chunk_addr==HADDR_UNDEF || dcpl_cache->pline.nused>0) HGOTO_ERROR (H5E_IO, H5E_WRITEERROR, FAIL, "unable to locate raw data chunk"); #endif /* H5_HAVE_PARALLEL */ if ((ret_value=H5F_contig_writevv(f, chunk_size, chunk_addr, chunk_max_nseq, chunk_curr_seq, chunk_len_arr, chunk_offset_arr, mem_max_nseq, mem_curr_seq, mem_len_arr, mem_offset_arr, dxpl_id, buf))<0) @@ -1910,18 +1881,10 @@ HDfprintf(stderr,"%s: mem_offset_arr[%Zu]=%Hu\n",FUNC,*mem_curr_seq,mem_offset_a } /* end if */ else { uint8_t *chunk; /* Pointer to cached chunk in memory */ - H5O_fill_t fill; /* Fill value information */ - H5D_fill_time_t fill_time; /* Fill time information */ unsigned idx_hint=0; /* Cache index hint */ ssize_t naccessed; /* Number of bytes accessed in chunk */ hbool_t relax; /* Whether whole chunk is selected */ - /* Get necessary properties from property list */ - if(H5P_get(dc_plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get fill value"); - if(H5P_get(dc_plist, H5D_CRT_FILL_TIME_NAME, &fill_time) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get fill time"); - /* * Lock the chunk, copy from application to chunk, then unlock the * chunk. @@ -1931,7 +1894,7 @@ HDfprintf(stderr,"%s: mem_offset_arr[%Zu]=%Hu\n",FUNC,*mem_curr_seq,mem_offset_a else relax = FALSE; - if (NULL==(chunk=H5F_istore_lock(f, dxpl_id, layout, &pline, &fill, fill_time, + if (NULL==(chunk=H5F_istore_lock(f, dxpl_cache, dxpl_id, layout, &dcpl_cache->pline, &dcpl_cache->fill, dcpl_cache->fill_time, chunk_coords_in_elmts, relax, &idx_hint))) HGOTO_ERROR (H5E_IO, H5E_WRITEERROR, FAIL, "unable to read raw data chunk"); @@ -1940,7 +1903,7 @@ HDfprintf(stderr,"%s: mem_offset_arr[%Zu]=%Hu\n",FUNC,*mem_curr_seq,mem_offset_a HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "vectorized memcpy failed"); H5_CHECK_OVERFLOW(naccessed,ssize_t,size_t); - if (H5F_istore_unlock(f, dxpl_id, layout, &pline, TRUE, + if (H5F_istore_unlock(f, dxpl_cache, dxpl_id, layout, &dcpl_cache->pline, TRUE, chunk_coords_in_elmts, &idx_hint, chunk, (size_t)naccessed)<0) HGOTO_ERROR (H5E_IO, H5E_WRITEERROR, FAIL, "uanble to unlock raw data chunk"); @@ -2174,7 +2137,7 @@ H5F_istore_allocate(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, assert(layout->ndims>0 && layout->ndims<=H5O_LAYOUT_NDIMS); assert(H5F_addr_defined(layout->addr)); assert(TRUE==H5P_isa_class(dxpl_id,H5P_DATASET_XFER)); - assert(dc_plist!=NULL); + assert(dc_plist); /* Get necessary properties from dataset creation property list */ if(H5P_get(dc_plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0) @@ -2467,7 +2430,8 @@ done: *------------------------------------------------------------------------- */ herr_t -H5F_istore_prune_by_extent(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, const H5S_t * space) +H5F_istore_prune_by_extent(H5F_t *f, const struct H5D_dxpl_cache_t *dxpl_cache, + hid_t dxpl_id, const H5O_layout_t *layout, const H5S_t * space) { H5F_rdcc_t *rdcc = &(f->shared->rdcc); /*raw data chunk cache */ H5F_rdcc_ent_t *ent = NULL, *next = NULL; /*cache entry */ @@ -2520,7 +2484,7 @@ H5F_istore_prune_by_extent(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, #endif /* Preempt the entry from the cache, but do not flush it to disk */ - if(H5F_istore_preempt(f, dxpl_id, ent, FALSE) < 0) + if(H5F_istore_preempt(f, dxpl_cache, dxpl_id, ent, FALSE) < 0) HGOTO_ERROR(H5E_IO, H5E_CANTINIT, 0, "unable to preempt chunk"); } } @@ -2677,8 +2641,9 @@ done: *------------------------------------------------------------------------- */ herr_t -H5F_istore_initialize_by_extent(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, - H5P_genplist_t *dc_plist, const H5S_t * space) +H5F_istore_initialize_by_extent(H5F_t *f, const struct H5D_dxpl_cache_t *dxpl_cache, + hid_t dxpl_id, const H5O_layout_t *layout, + H5P_genplist_t *dc_plist, const H5S_t * space) { uint8_t *chunk = NULL; /*the file chunk */ unsigned idx_hint = 0; /*input value for H5F_istore_lock */ @@ -2775,7 +2740,7 @@ H5F_istore_initialize_by_extent(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *lay if(found) { - if(NULL == (chunk = H5F_istore_lock(f, dxpl_id, layout, &pline, &fill, fill_time, + if(NULL == (chunk = H5F_istore_lock(f, dxpl_cache, dxpl_id, layout, &pline, &fill, fill_time, chunk_offset, FALSE, &idx_hint))) HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to read raw data chunk"); @@ -2808,7 +2773,7 @@ H5F_istore_initialize_by_extent(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *lay if(H5S_select_fill(fill.buf, (size_t)size[rank], space_chunk, chunk) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTENCODE, FAIL, "filling selection failed"); - if(H5F_istore_unlock(f, dxpl_id, layout, &pline, TRUE, + if(H5F_istore_unlock(f, dxpl_cache, dxpl_id, layout, &pline, TRUE, chunk_offset, &idx_hint, chunk, (size_t)naccessed) < 0) HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to unlock raw data chunk"); } /*found */ @@ -2848,6 +2813,7 @@ done: herr_t H5F_istore_delete(H5F_t *f, hid_t dxpl_id, const struct H5O_layout_t *layout) { + H5D_dxpl_cache_t dxpl_cache; /* Cached data transfer properties */ H5F_istore_ud1_t udata; /* User data for B-tree iterator call */ H5F_rdcc_t *rdcc = &(f->shared->rdcc); /* File's raw data chunk cache */ H5F_rdcc_ent_t *ent, *next; /* Pointers to cache entries */ @@ -2855,6 +2821,10 @@ H5F_istore_delete(H5F_t *f, hid_t dxpl_id, const struct H5O_layout_t *layout) FUNC_ENTER_NOAPI(H5F_istore_delete, FAIL); + /* Fill the DXPL cache values for later use */ + if (H5D_get_dxpl_cache(dxpl_id,&dxpl_cache)<0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't fill dxpl cache") + /* Check if the B-tree has been created in the file */ if(H5F_addr_defined(layout->addr)) { /* Iterate through the entries in the cache, checking for the chunks to be deleted */ @@ -2865,7 +2835,7 @@ H5F_istore_delete(H5F_t *f, hid_t dxpl_id, const struct H5O_layout_t *layout) /* Is the chunk to be deleted this cache entry? */ if(layout->addr==ent->layout->addr) /* Remove entry without flushing */ - if (H5F_istore_preempt(f, dxpl_id, ent, FALSE )<0) + if (H5F_istore_preempt(f, &dxpl_cache, dxpl_id, ent, FALSE )<0) HGOTO_ERROR (H5E_IO, H5E_CANTFLUSH, FAIL, "unable to flush one or more raw data chunks"); } /* end for */ diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index 59e2e48..8160a98 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -186,6 +186,10 @@ struct H5F_t { H5F_mtab_t mtab; /* File mount table */ }; +/* Forward declarations for prototype arguments */ +struct H5D_dxpl_cache_t; +struct H5D_dcpl_cache_t; + /* Private functions, not part of the publicly documented API */ #ifdef NOT_YET H5_DLL void H5F_encode_length_unusual(const H5F_t *f, uint8_t **p, uint8_t *l); @@ -197,13 +201,17 @@ H5_DLL herr_t H5F_sieve_overlap_clear(const H5F_t *f, hid_t dxpl_id, haddr_t add H5_DLL herr_t H5F_istore_init (H5F_t *f); H5_DLL herr_t H5F_istore_flush (H5F_t *f, hid_t dxpl_id, unsigned flags); H5_DLL herr_t H5F_istore_dest (H5F_t *f, hid_t dxpl_id); -H5_DLL ssize_t H5F_istore_readvv(H5F_t *f, hid_t dxpl_id, - const struct H5O_layout_t *layout, struct H5P_genplist_t *dc_plist, hssize_t chunk_coords[], +H5_DLL ssize_t H5F_istore_readvv(H5F_t *f, const struct H5D_dxpl_cache_t *dxpl_cache, + hid_t dxpl_id, + const struct H5O_layout_t *layout, const struct H5D_dcpl_cache_t *dcpl_cache, + hssize_t chunk_coords[], size_t chunk_max_nseq, size_t *chunk_curr_seq, size_t chunk_len_arr[], hsize_t chunk_offset_arr[], size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_offset_arr[], void *buf); -H5_DLL ssize_t H5F_istore_writevv(H5F_t *f, hid_t dxpl_id, - const struct H5O_layout_t *layout, struct H5P_genplist_t *dc_plist, hssize_t chunk_coords[], +H5_DLL ssize_t H5F_istore_writevv(H5F_t *f, const struct H5D_dxpl_cache_t *dxpl_cache, + hid_t dxpl_id, + const struct H5O_layout_t *layout, const struct H5D_dcpl_cache_t *dcpl_cache, + hssize_t chunk_coords[], size_t chunk_max_nseq, size_t *chunk_curr_seq, size_t chunk_len_arr[], hsize_t chunk_offset_arr[], size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_offset_arr[], const void *buf); diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index 3b2176c..addb247 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -379,6 +379,8 @@ struct H5O_fill_t; struct H5O_layout_t; struct H5P_genplist_t; struct H5S_t; +struct H5D_dxpl_cache_t; +struct H5D_dcpl_cache_t; /* Private functions, not part of the publicly documented API */ H5_DLL herr_t H5F_init(void); @@ -407,25 +409,25 @@ H5_DLL herr_t H5F_block_write(const H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, hid_t dxpl_id, const void *buf); /* Functions that operate on byte sequences */ -H5_DLL herr_t H5F_seq_read(H5F_t *f, hid_t dxpl_id, - const struct H5O_layout_t *layout, - struct H5P_genplist_t *dc_plist, const union H5D_storage_t *store, - size_t seq_len, - hsize_t file_offset, void *_buf/*out*/); -H5_DLL herr_t H5F_seq_write (H5F_t *f, hid_t dxpl_id, - struct H5O_layout_t *layout, - struct H5P_genplist_t *dc_plist, const union H5D_storage_t *store, - size_t seq_len, - hsize_t file_offset, const void *_buf); +H5_DLL herr_t H5F_seq_read(H5F_t *f, const struct H5D_dxpl_cache_t *dxpl_cache, + hid_t dxpl_id, const struct H5O_layout_t *layout, + const struct H5D_dcpl_cache_t *dcpl_cache, const union H5D_storage_t *store, + size_t seq_len, hsize_t file_offset, void *_buf/*out*/); +H5_DLL herr_t H5F_seq_write (H5F_t *f, const struct H5D_dxpl_cache_t *dxpl_cache, + hid_t dxpl_id, struct H5O_layout_t *layout, + const struct H5D_dcpl_cache_t *dcpl_cache, const union H5D_storage_t *store, + size_t seq_len, hsize_t file_offset, const void *_buf); /* Functions that operate on byte sequences in memory and on disk */ -H5_DLL ssize_t H5F_seq_readvv(H5F_t *f, hid_t dxpl_id, const struct H5O_layout_t *layout, - struct H5P_genplist_t *dc_plist, const union H5D_storage_t *store, +H5_DLL ssize_t H5F_seq_readvv(H5F_t *f, const struct H5D_dxpl_cache_t *dxpl_cache, + hid_t dxpl_id, const struct H5O_layout_t *layout, + const struct H5D_dcpl_cache_t *dcpl_cache, const union H5D_storage_t *store, 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[], void *buf); -H5_DLL ssize_t H5F_seq_writevv(H5F_t *f, hid_t dxpl_id, struct H5O_layout_t *layout, - struct H5P_genplist_t *dc_plist, const union H5D_storage_t *store, +H5_DLL ssize_t H5F_seq_writevv(H5F_t *f, const struct H5D_dxpl_cache_t *dxpl_cache, + hid_t dxpl_id, struct H5O_layout_t *layout, + const struct H5D_dcpl_cache_t *dcpl_cache, const union H5D_storage_t *store, 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[], const void *buf); @@ -448,9 +450,11 @@ H5_DLL herr_t H5F_istore_allocate (H5F_t *f, hid_t dxpl_id, H5_DLL hsize_t H5F_istore_allocated(H5F_t *f, hid_t dxpl_id, unsigned ndims, haddr_t addr); H5_DLL herr_t H5F_istore_dump_btree(H5F_t *f, hid_t dxpl_id, FILE *stream, unsigned ndims, haddr_t addr); -H5_DLL herr_t H5F_istore_prune_by_extent( H5F_t *f, hid_t dxpl_id, +H5_DLL herr_t H5F_istore_prune_by_extent( H5F_t *f, + const struct H5D_dxpl_cache_t *dxpl_cache, hid_t dxpl_id, const struct H5O_layout_t *layout, const struct H5S_t *space); -H5_DLL herr_t H5F_istore_initialize_by_extent( H5F_t *f, hid_t dxpl_id, +H5_DLL herr_t H5F_istore_initialize_by_extent( H5F_t *f, + const struct H5D_dxpl_cache_t *dxpl_cache, hid_t dxpl_id, const struct H5O_layout_t *layout, struct H5P_genplist_t *dc_plist, const struct H5S_t *space ); H5_DLL herr_t H5F_istore_delete(H5F_t *f, hid_t dxpl_id, diff --git a/src/H5Fseq.c b/src/H5Fseq.c index 03c10fe..3e8ce3b 100644 --- a/src/H5Fseq.c +++ b/src/H5Fseq.c @@ -68,8 +68,9 @@ static int interface_initialize_g = 0; *------------------------------------------------------------------------- */ herr_t -H5F_seq_read(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, - H5P_genplist_t *dc_plist, const H5D_storage_t *store, +H5F_seq_read(H5F_t *f, const struct H5D_dxpl_cache_t *dxpl_cache, + hid_t dxpl_id, const H5O_layout_t *layout, + const struct H5D_dcpl_cache_t *dcpl_cache, const H5D_storage_t *store, size_t seq_len, hsize_t dset_offset, void *buf/*out*/) { hsize_t mem_off=0; /* Offset in memory */ @@ -86,7 +87,7 @@ H5F_seq_read(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, assert(buf); assert(TRUE==H5P_isa_class(dxpl_id,H5P_DATASET_XFER)); - if (H5F_seq_readvv(f, dxpl_id, layout, dc_plist, store, 1, &dset_curr_seq, &seq_len, &dset_offset, 1, &mem_curr_seq, &mem_len, &mem_off, buf)<0) + if (H5F_seq_readvv(f, dxpl_cache, dxpl_id, layout, dcpl_cache, store, 1, &dset_curr_seq, &seq_len, &dset_offset, 1, &mem_curr_seq, &mem_len, &mem_off, buf)<0) HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "vector read failed"); done: @@ -116,8 +117,9 @@ done: *------------------------------------------------------------------------- */ herr_t -H5F_seq_write(H5F_t *f, hid_t dxpl_id, H5O_layout_t *layout, - H5P_genplist_t *dc_plist, const H5D_storage_t *store, +H5F_seq_write(H5F_t *f, const struct H5D_dxpl_cache_t *dxpl_cache, + hid_t dxpl_id, H5O_layout_t *layout, + const struct H5D_dcpl_cache_t *dcpl_cache, const H5D_storage_t *store, size_t seq_len, hsize_t dset_offset, const void *buf) { hsize_t mem_off=0; /* Offset in memory */ @@ -134,7 +136,7 @@ H5F_seq_write(H5F_t *f, hid_t dxpl_id, H5O_layout_t *layout, assert(buf); assert(TRUE==H5P_isa_class(dxpl_id,H5P_DATASET_XFER)); - if (H5F_seq_writevv(f, dxpl_id, layout, dc_plist, store, 1, &dset_curr_seq, &seq_len, &dset_offset, 1, &mem_curr_seq, &mem_len, &mem_off, buf)<0) + if (H5F_seq_writevv(f, dxpl_cache, dxpl_id, layout, dcpl_cache, store, 1, &dset_curr_seq, &seq_len, &dset_offset, 1, &mem_curr_seq, &mem_len, &mem_off, buf)<0) HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "vector write failed"); done: @@ -183,8 +185,9 @@ done: *------------------------------------------------------------------------- */ ssize_t -H5F_seq_readvv(H5F_t *f, hid_t dxpl_id, const struct H5O_layout_t *layout, - struct H5P_genplist_t *dc_plist, const H5D_storage_t *store, +H5F_seq_readvv(H5F_t *f, const struct H5D_dxpl_cache_t *dxpl_cache, hid_t dxpl_id, + const struct H5O_layout_t *layout, + const struct H5D_dcpl_cache_t *dcpl_cache, const H5D_storage_t *store, 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[], void *buf/*out*/) @@ -197,7 +200,7 @@ H5F_seq_readvv(H5F_t *f, hid_t dxpl_id, const struct H5O_layout_t *layout, assert(f); assert(TRUE==H5P_isa_class(dxpl_id,H5P_DATASET_XFER)); /* Make certain we have the correct type of property list */ assert(layout); - assert(dc_plist); + assert(dcpl_cache); assert(dset_curr_seq); assert(*dset_curr_seqchunk_coords, + if((ret_value=H5F_istore_readvv(f, dxpl_cache, dxpl_id, layout, dcpl_cache, store->chunk_coords, dset_max_nseq, dset_curr_seq, dset_len_arr, dset_offset_arr, mem_max_nseq, mem_curr_seq, mem_len_arr, mem_offset_arr, buf))<0) @@ -298,8 +301,9 @@ done: *------------------------------------------------------------------------- */ ssize_t -H5F_seq_writevv(H5F_t *f, hid_t dxpl_id, struct H5O_layout_t *layout, - struct H5P_genplist_t *dc_plist, const H5D_storage_t *store, +H5F_seq_writevv(H5F_t *f, const struct H5D_dxpl_cache_t *dxpl_cache, + hid_t dxpl_id, struct H5O_layout_t *layout, + const struct H5D_dcpl_cache_t *dcpl_cache, const H5D_storage_t *store, 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[], const void *buf) @@ -312,7 +316,7 @@ H5F_seq_writevv(H5F_t *f, hid_t dxpl_id, struct H5O_layout_t *layout, assert(f); assert(TRUE==H5P_isa_class(dxpl_id,H5P_DATASET_XFER)); /* Make certain we have the correct type of property list */ assert(layout); - assert(dc_plist); + assert(dcpl_cache); assert(dset_curr_seq); assert(*dset_curr_seqchunk_coords, + if((ret_value=H5F_istore_writevv(f, dxpl_cache, dxpl_id, layout, dcpl_cache, store->chunk_coords, dset_max_nseq, dset_curr_seq, dset_len_arr, dset_offset_arr, mem_max_nseq, mem_curr_seq, mem_len_arr, mem_offset_arr, buf))<0) diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c index 0493db8..a510f85 100644 --- a/src/H5Pdcpl.c +++ b/src/H5Pdcpl.c @@ -1388,45 +1388,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5P_fill_value_defined - * - * Purpose: Check if fill value is defined. Internal version of function - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Raymond Lu - * Wednesday, January 16, 2002 - * - * Modifications: - * - * - *------------------------------------------------------------------------- - */ -herr_t -H5P_fill_value_defined(H5P_genplist_t *plist, H5D_fill_value_t *status) -{ - herr_t ret_value = SUCCEED; - H5O_fill_t fill; - - FUNC_ENTER_NOAPI(H5P_fill_value_defined, FAIL); - - assert(plist); - assert(status); - - /* Get the fill value struct */ - if(H5P_get(plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fill value"); - - /* Get the fill-value status */ - if(H5P_is_fill_value_defined(&fill, status) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't check fill value status"); - -done: - FUNC_LEAVE_NOAPI(ret_value); -} /* end H5P_fill_value_defined() */ - - -/*------------------------------------------------------------------------- * Function: H5Pfill_value_defined * * Purpose: Check if fill value is defined. @@ -1445,6 +1406,7 @@ herr_t H5Pfill_value_defined(hid_t plist_id, H5D_fill_value_t *status) { H5P_genplist_t *plist; + H5O_fill_t fill; herr_t ret_value = SUCCEED; FUNC_ENTER_API(H5Pfill_value_defined, FAIL); @@ -1456,9 +1418,13 @@ H5Pfill_value_defined(hid_t plist_id, H5D_fill_value_t *status) if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_CREATE))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); - /* Call the internal function */ - if(H5P_fill_value_defined(plist, status) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fill value info"); + /* Get the fill value struct */ + if(H5P_get(plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fill value"); + + /* Get the fill-value status */ + if(H5P_is_fill_value_defined(&fill, status) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't check fill value status"); done: FUNC_LEAVE_API(ret_value); diff --git a/src/H5Pprivate.h b/src/H5Pprivate.h index e087624..69990e3 100644 --- a/src/H5Pprivate.h +++ b/src/H5Pprivate.h @@ -60,8 +60,6 @@ H5_DLL herr_t H5P_set_vlen_mem_manager(H5P_genplist_t *plist, void *free_info); H5_DLL herr_t H5P_is_fill_value_defined(const struct H5O_fill_t *fill, H5D_fill_value_t *status); -H5_DLL herr_t H5P_fill_value_defined(H5P_genplist_t *plist, - H5D_fill_value_t *status); /* *SPECIAL* Don't make more of these! -QAK */ H5_DLL htri_t H5P_isa_class(hid_t plist_id, hid_t pclass_id); diff --git a/src/H5Smpio.c b/src/H5Smpio.c index fca460f..2312347 100644 --- a/src/H5Smpio.c +++ b/src/H5Smpio.c @@ -623,9 +623,9 @@ done: */ static herr_t H5S_mpio_spaces_xfer(H5F_t *f, const H5O_layout_t *layout, size_t elmt_size, - const H5S_t *file_space, const H5S_t *mem_space, - hid_t dxpl_id, void *_buf /*out*/, - hbool_t do_write ) + const H5S_t *file_space, const H5S_t *mem_space, + hid_t dxpl_id, void *_buf /*out*/, + hbool_t do_write ) { haddr_t addr; /* Address of dataset (or selection) within file */ size_t mpi_buf_count, mpi_file_count; /* Number of "objects" to transfer */ @@ -740,17 +740,16 @@ done: */ herr_t H5S_mpio_spaces_read(H5F_t *f, const H5O_layout_t *layout, - H5P_genplist_t UNUSED *dc_plist, const H5D_storage_t UNUSED *store, size_t elmt_size, - const H5S_t *file_space, const H5S_t *mem_space, hid_t dxpl_id, - void *buf/*out*/) + const H5D_dcpl_cache_t UNUSED *dcpl_cache, const H5D_storage_t UNUSED *store, size_t elmt_size, + const H5S_t *file_space, const H5S_t *mem_space, const H5D_dxpl_cache_t UNUSED *dxpl_cache, + hid_t dxpl_id, void *buf/*out*/) { herr_t ret_value; FUNC_ENTER_NOAPI(H5S_mpio_spaces_read, FAIL); - ret_value = H5S_mpio_spaces_xfer(f, layout, elmt_size, - file_space, mem_space, dxpl_id, - buf, 0/*read*/); + ret_value = H5S_mpio_spaces_xfer(f, layout, elmt_size, file_space, + mem_space, dxpl_id, buf, 0/*read*/); done: FUNC_LEAVE_NOAPI(ret_value); @@ -779,17 +778,17 @@ done: */ herr_t H5S_mpio_spaces_write(H5F_t *f, H5O_layout_t *layout, - H5P_genplist_t UNUSED *dc_plist, const H5D_storage_t UNUSED *store, size_t elmt_size, - const H5S_t *file_space, const H5S_t *mem_space, hid_t dxpl_id, - const void *buf) + const H5D_dcpl_cache_t UNUSED *dcpl_cache, const H5D_storage_t UNUSED *store, size_t elmt_size, + const H5S_t *file_space, const H5S_t *mem_space, const H5D_dxpl_cache_t UNUSED *dxpl_cache, + hid_t dxpl_id, const void *buf) { herr_t ret_value; FUNC_ENTER_NOAPI(H5S_mpio_spaces_write, FAIL); /*OKAY: CAST DISCARDS CONST QUALIFIER*/ - ret_value = H5S_mpio_spaces_xfer(f, layout, elmt_size, - file_space, mem_space, dxpl_id, (void*)buf, 1/*write*/); + ret_value = H5S_mpio_spaces_xfer(f, layout, elmt_size, file_space, + mem_space, dxpl_id, (void*)buf, 1/*write*/); done: FUNC_LEAVE_NOAPI(ret_value); diff --git a/src/H5Spkg.h b/src/H5Spkg.h index e23cda9..5d73fa2 100644 --- a/src/H5Spkg.h +++ b/src/H5Spkg.h @@ -261,22 +261,18 @@ H5_DLL herr_t H5S_none_get_seq_list(const H5S_t *space, unsigned flags, #ifdef H5_HAVE_PARALLEL /* MPI-IO function to read directly from app buffer to file rky980813 */ -H5_DLL herr_t H5S_mpio_spaces_read(H5F_t *f, - const struct H5O_layout_t *layout, - H5P_genplist_t *dc_plist, - const H5D_storage_t *store, - size_t elmt_size, const H5S_t *file_space, - const H5S_t *mem_space, hid_t dxpl_id, - void *buf/*out*/); +H5_DLL herr_t H5S_mpio_spaces_read(H5F_t *f, const struct H5O_layout_t *layout, + const H5D_dcpl_cache_t *dcpl_cache, const H5D_storage_t *store, + size_t elmt_size, const H5S_t *file_space, + const H5S_t *mem_space, const H5D_dxpl_cache_t *dxpl_cache, hid_t dxpl_id, + void *buf/*out*/); /* MPI-IO function to write directly from app buffer to file rky980813 */ -H5_DLL herr_t H5S_mpio_spaces_write(H5F_t *f, - struct H5O_layout_t *layout, - H5P_genplist_t *dc_plist, - const H5D_storage_t *store, - size_t elmt_size, const H5S_t *file_space, - const H5S_t *mem_space, hid_t dxpl_id, - const void *buf); +H5_DLL herr_t H5S_mpio_spaces_write(H5F_t *f, struct H5O_layout_t *layout, + const H5D_dcpl_cache_t *dcpl_cache, const H5D_storage_t *store, + size_t elmt_size, const H5S_t *file_space, + const H5S_t *mem_space, const H5D_dxpl_cache_t *dxpl_cache, hid_t dxpl_id, + const void *buf); /* MPI-IO function to check if a direct I/O transfer is possible between * memory and the file */ diff --git a/src/H5Sprivate.h b/src/H5Sprivate.h index a734993..2fcdad7 100644 --- a/src/H5Sprivate.h +++ b/src/H5Sprivate.h @@ -128,16 +128,18 @@ typedef struct H5S_conv_t { /* Read from file to application w/o intermediate scratch buffer */ herr_t (*read)(H5F_t *f, const struct H5O_layout_t *layout, - H5P_genplist_t *dc_plist, const union H5D_storage_t *store, + const H5D_dcpl_cache_t *dcpl_cache, const union H5D_storage_t *store, size_t elmt_size, const H5S_t *file_space, - const H5S_t *mem_space, hid_t dxpl_id, void *buf/*out*/); + const H5S_t *mem_space, const H5D_dxpl_cache_t *dxpl_cache, + hid_t dxpl_id, void *buf/*out*/); /* Write directly from app buffer to file */ herr_t (*write)(H5F_t *f, struct H5O_layout_t *layout, - H5P_genplist_t *dc_plist, const union H5D_storage_t *store, + const H5D_dcpl_cache_t *dcpl_cache, const union H5D_storage_t *store, size_t elmt_size, const H5S_t *file_space, - const H5S_t *mem_space, hid_t dxpl_id, const void *buf); + const H5S_t *mem_space, const H5D_dxpl_cache_t *dxpl_cache, + hid_t dxpl_id, const void *buf); #ifdef H5S_DEBUG struct { @@ -191,27 +193,27 @@ H5_DLL herr_t H5S_select_iterate(void *buf, hid_t type_id, const H5S_t *space, H5_DLL herr_t H5S_select_fill(void *fill, size_t fill_size, const H5S_t *space, void *buf); H5_DLL herr_t H5S_select_fscat (H5F_t *f, struct H5O_layout_t *layout, - H5P_genplist_t *dc_plist, const union H5D_storage_t *store, size_t elmt_size, + const H5D_dcpl_cache_t *dcpl_cache, const union H5D_storage_t *store, size_t elmt_size, const H5S_t *file_space, H5S_sel_iter_t *file_iter, hsize_t nelmts, - hid_t dxpl_id, const void *_buf); + const H5D_dxpl_cache_t *dxpl_cache, hid_t dxpl_id, const void *_buf); H5_DLL hsize_t H5S_select_fgath (H5F_t *f, const struct H5O_layout_t *layout, - H5P_genplist_t *dc_plist, const union H5D_storage_t *store, size_t elmt_size, + const H5D_dcpl_cache_t *dcpl_cache, const union H5D_storage_t *store, size_t elmt_size, const H5S_t *file_space, H5S_sel_iter_t *file_iter, hsize_t nelmts, - hid_t dxpl_id, void *buf); + const H5D_dxpl_cache_t *dxpl_cache, hid_t dxpl_id, void *buf); H5_DLL herr_t H5S_select_mscat (const void *_tscat_buf, size_t elmt_size, const H5S_t *space, H5S_sel_iter_t *iter, hsize_t nelmts, - hid_t dxpl_id, void *_buf/*out*/); + const H5D_dxpl_cache_t *dxpl_cache, void *_buf/*out*/); H5_DLL hsize_t H5S_select_mgath (const void *_buf, size_t elmt_size, const H5S_t *space, H5S_sel_iter_t *iter, hsize_t nelmts, - hid_t dxpl_id, void *_tgath_buf/*out*/); + const H5D_dxpl_cache_t *dxpl_cache, void *_tgath_buf/*out*/); H5_DLL herr_t H5S_select_read(H5F_t *f, const struct H5O_layout_t *layout, - H5P_genplist_t *dc_plist, const union H5D_storage_t *store, size_t elmt_size, - const H5S_t *file_space, const H5S_t *mem_space, hid_t dxpl_id, - void *buf/*out*/); + const H5D_dcpl_cache_t *dcpl_cache, const union H5D_storage_t *store, size_t elmt_size, + const H5S_t *file_space, const H5S_t *mem_space, const H5D_dxpl_cache_t *dxpl_cache, + hid_t dxpl_id, void *buf/*out*/); H5_DLL herr_t H5S_select_write(H5F_t *f, struct H5O_layout_t *layout, - H5P_genplist_t *dc_plist, const union H5D_storage_t *store, size_t elmt_size, - const H5S_t *file_space, const H5S_t *mem_space, hid_t dxpl_id, - const void *buf/*out*/); + const H5D_dcpl_cache_t *dcpl_cache, const union H5D_storage_t *store, size_t elmt_size, + const H5S_t *file_space, const H5S_t *mem_space, const H5D_dxpl_cache_t *dxpl_cache, + hid_t dxpl_id, const void *buf/*out*/); H5_DLL htri_t H5S_select_valid(const H5S_t *space); H5_DLL hssize_t H5S_get_select_npoints(const H5S_t *space); H5_DLL herr_t H5S_get_select_bounds(const H5S_t *space, hssize_t *start, hssize_t *end); diff --git a/src/H5Sselect.c b/src/H5Sselect.c index 3128cb8..a52bb12 100644 --- a/src/H5Sselect.c +++ b/src/H5Sselect.c @@ -56,50 +56,6 @@ H5FL_BLK_EXTERN(type_elem); /*-------------------------------------------------------------------------- NAME - H5S_get_vector_size - PURPOSE - Gets the size of the I/O vector - USAGE - ssize_t H5S_get_vector_size(dxpl_id) - hid_t dxpl_id; IN: The dataset transfer property list to query - RETURNS - Non-negative number of entries in I/O vector on success, negative on failure - DESCRIPTION - Retrieves the number of I/O vector entries to use for a given dataset - transfer. If the default dataset property list is used, the default - number of I/O vectors is returned. - GLOBAL VARIABLES - COMMENTS, BUGS, ASSUMPTIONS - EXAMPLES - REVISION LOG ---------------------------------------------------------------------------*/ -static ssize_t -H5S_get_vector_size(hid_t dxpl_id) -{ - ssize_t ret_value; /* return value */ - - FUNC_ENTER_NOAPI_NOINIT(H5S_get_vector_size); - - if(dxpl_id==H5P_DATASET_XFER_DEFAULT) { - ret_value=H5D_XFER_HYPER_VECTOR_SIZE_DEF; - } /* end if */ - else { - H5P_genplist_t *dx_plist; /* Dataset transfer property list */ - - /* Get the hyperslab vector size */ - if(NULL == (dx_plist = H5I_object(dxpl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset transfer property list"); - if (H5P_get(dx_plist,H5D_XFER_HYPER_VECTOR_SIZE_NAME,&ret_value)<0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value"); - } /* end else */ - -done: - FUNC_LEAVE_NOAPI(ret_value); -} /* H5S_get_vector_size() */ - - -/*-------------------------------------------------------------------------- - NAME H5S_select_offset PURPOSE Set the selection offset for a datapace @@ -945,10 +901,8 @@ H5S_select_iterate(void *buf, hid_t type_id, const H5S_t *space, H5D_operator_t assert(space); assert(op); - /* Get the hyperslab vector size */ - /* (from the default data transfer property list, for now) */ - if((vector_size=H5S_get_vector_size(H5P_DATASET_XFER_DEFAULT))<0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get I/O vector size"); + /* Get the (default) hyperslab vector size */ + vector_size=H5D_XFER_HYPER_VECTOR_SIZE_DEF; /* Allocate the vector I/O arrays */ if((len = H5FL_ARR_MALLOC(size_t,(size_t)vector_size))==NULL) @@ -1388,10 +1342,8 @@ H5S_select_fill(void *_fill, size_t fill_size, const H5S_t *space, void *_buf) HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "fill value buffer allocation failed"); } /* end if */ - /* Get the hyperslab vector size */ - /* (from the default data transfer property list, for now) */ - if((vector_size=H5S_get_vector_size(H5P_DATASET_XFER_DEFAULT))<0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get I/O vector size"); + /* Get the (default) hyperslab vector size */ + vector_size=H5D_XFER_HYPER_VECTOR_SIZE_DEF; /* Allocate the vector I/O arrays */ if((len = H5FL_ARR_MALLOC(size_t,(size_t)vector_size))==NULL) @@ -1473,9 +1425,10 @@ done: */ herr_t H5S_select_fscat (H5F_t *f, struct H5O_layout_t *layout, - H5P_genplist_t *dc_plist, const H5D_storage_t *store, + const H5D_dcpl_cache_t *dcpl_cache, const H5D_storage_t *store, size_t elmt_size, const H5S_t *space, H5S_sel_iter_t *iter, - hsize_t nelmts, hid_t dxpl_id, const void *_buf) + hsize_t nelmts, const H5D_dxpl_cache_t *dxpl_cache, hid_t dxpl_id, + const void *_buf) { const uint8_t *buf=_buf; /* Alias for pointer arithmetic */ hsize_t *off=NULL; /* Array to store sequence offsets */ @@ -1504,8 +1457,7 @@ H5S_select_fscat (H5F_t *f, struct H5O_layout_t *layout, assert(TRUE==H5P_isa_class(dxpl_id,H5P_DATASET_XFER)); /* Get the hyperslab vector size */ - if((vector_size=H5S_get_vector_size(dxpl_id))<0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get I/O vector size"); + vector_size=dxpl_cache->vec_size; /* Allocate the vector I/O arrays */ if((len = H5FL_ARR_MALLOC(size_t,(size_t)vector_size))==NULL) @@ -1528,7 +1480,7 @@ H5S_select_fscat (H5F_t *f, struct H5O_layout_t *layout, mem_off=0; /* Write sequence list out */ - if (H5F_seq_writevv(f, dxpl_id, layout, dc_plist, store, nseq, &dset_curr_seq, len, off, 1, &mem_curr_seq, &mem_len, &mem_off, buf)<0) + if (H5F_seq_writevv(f, dxpl_cache, dxpl_id, layout, dcpl_cache, store, nseq, &dset_curr_seq, len, off, 1, &mem_curr_seq, &mem_len, &mem_off, buf)<0) HGOTO_ERROR(H5E_DATASPACE, H5E_WRITEERROR, FAIL, "write error"); /* Update buffer */ @@ -1573,9 +1525,10 @@ done: */ hsize_t H5S_select_fgath (H5F_t *f, const struct H5O_layout_t *layout, - H5P_genplist_t *dc_plist, const H5D_storage_t *store, + const H5D_dcpl_cache_t *dcpl_cache, const H5D_storage_t *store, size_t elmt_size, const H5S_t *space, H5S_sel_iter_t *iter, - hsize_t nelmts, hid_t dxpl_id, void *_buf/*out*/) + hsize_t nelmts, const H5D_dxpl_cache_t *dxpl_cache, + hid_t dxpl_id, void *_buf/*out*/) { uint8_t *buf=_buf; /* Alias for pointer arithmetic */ hsize_t *off=NULL; /* Array to store sequence offsets */ @@ -1603,8 +1556,7 @@ H5S_select_fgath (H5F_t *f, const struct H5O_layout_t *layout, assert (_buf); /* Get the hyperslab vector size */ - if((vector_size=H5S_get_vector_size(dxpl_id))<0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, 0, "unable to get I/O vector size"); + vector_size=dxpl_cache->vec_size; /* Allocate the vector I/O arrays */ if((len = H5FL_ARR_MALLOC(size_t,(size_t)vector_size))==NULL) @@ -1627,7 +1579,7 @@ H5S_select_fgath (H5F_t *f, const struct H5O_layout_t *layout, mem_off=0; /* Read sequence list in */ - if (H5F_seq_readvv(f, dxpl_id, layout, dc_plist, store, nseq, &dset_curr_seq, len, off, 1, &mem_curr_seq, &mem_len, &mem_off, buf)<0) + if (H5F_seq_readvv(f, dxpl_cache, dxpl_id, layout, dcpl_cache, store, nseq, &dset_curr_seq, len, off, 1, &mem_curr_seq, &mem_len, &mem_off, buf)<0) HGOTO_ERROR(H5E_DATASPACE, H5E_READERROR, 0, "read error"); /* Update buffer */ @@ -1666,7 +1618,8 @@ done: */ herr_t H5S_select_mscat (const void *_tscat_buf, size_t elmt_size, const H5S_t *space, - H5S_sel_iter_t *iter, hsize_t nelmts, hid_t dxpl_id, void *_buf/*out*/) + H5S_sel_iter_t *iter, hsize_t nelmts, const H5D_dxpl_cache_t *dxpl_cache, + void *_buf/*out*/) { uint8_t *buf=(uint8_t *)_buf; /* Get local copies for address arithmetic */ const uint8_t *tscat_buf=(const uint8_t *)_tscat_buf; @@ -1691,8 +1644,7 @@ H5S_select_mscat (const void *_tscat_buf, size_t elmt_size, const H5S_t *space, assert (buf); /* Get the hyperslab vector size */ - if((vector_size=H5S_get_vector_size(dxpl_id))<0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get I/O vector size"); + vector_size=dxpl_cache->vec_size; /* Allocate the vector I/O arrays */ if((len = H5FL_ARR_MALLOC(size_t,(size_t)vector_size))==NULL) @@ -1755,7 +1707,8 @@ done: */ hsize_t H5S_select_mgath (const void *_buf, size_t elmt_size, const H5S_t *space, - H5S_sel_iter_t *iter, hsize_t nelmts, hid_t dxpl_id, void *_tgath_buf/*out*/) + H5S_sel_iter_t *iter, hsize_t nelmts, const H5D_dxpl_cache_t *dxpl_cache, + void *_tgath_buf/*out*/) { const uint8_t *buf=(const uint8_t *)_buf; /* Get local copies for address arithmetic */ uint8_t *tgath_buf=(uint8_t *)_tgath_buf; @@ -1780,8 +1733,7 @@ H5S_select_mgath (const void *_buf, size_t elmt_size, const H5S_t *space, assert (tgath_buf); /* Get the hyperslab vector size */ - if((vector_size=H5S_get_vector_size(dxpl_id))<0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, 0, "unable to get I/O vector size"); + vector_size=dxpl_cache->vec_size; /* Allocate the vector I/O arrays */ if((len = H5FL_ARR_MALLOC(size_t,(size_t)vector_size))==NULL) @@ -1838,9 +1790,10 @@ done: *------------------------------------------------------------------------- */ herr_t -H5S_select_read(H5F_t *f, const H5O_layout_t *layout, H5P_genplist_t *dc_plist, +H5S_select_read(H5F_t *f, const H5O_layout_t *layout, const H5D_dcpl_cache_t *dcpl_cache, const H5D_storage_t *store, size_t elmt_size, const H5S_t *file_space, - const H5S_t *mem_space, hid_t dxpl_id, void *buf/*out*/) + const H5S_t *mem_space, const H5D_dxpl_cache_t *dxpl_cache, hid_t dxpl_id, + void *buf/*out*/) { H5S_sel_iter_t mem_iter; /* Memory selection iteration info */ hbool_t mem_iter_init=0; /* Memory selection iteration info has been initialized */ @@ -1880,8 +1833,7 @@ H5S_select_read(H5F_t *f, const H5O_layout_t *layout, H5P_genplist_t *dc_plist, mem_iter_init=1; /* Memory selection iteration info has been initialized */ /* Get the hyperslab vector size */ - if((vector_size=H5S_get_vector_size(dxpl_id))<0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get I/O vector size"); + vector_size=dxpl_cache->vec_size; /* Allocate the vector I/O arrays */ if((mem_len = H5FL_ARR_MALLOC(size_t,(size_t)vector_size))==NULL) @@ -1936,7 +1888,7 @@ HDfprintf(stderr,"%s: file_off[%Zu]=%Hu, file_len[%Zu]=%Zu\n",FUNC,curr_file_seq HDfprintf(stderr,"%s: mem_off[%Zu]=%Hu, mem_len[%Zu]=%Zu\n",FUNC,curr_mem_seq,mem_off[curr_mem_seq],curr_mem_seq,mem_len[curr_mem_seq]); #endif /* QAK */ /* Read file sequences into current memory sequence */ - if ((tmp_file_len=H5F_seq_readvv(f, dxpl_id, layout, dc_plist, store, + if ((tmp_file_len=H5F_seq_readvv(f, dxpl_cache, dxpl_id, layout, dcpl_cache, store, file_nseq, &curr_file_seq, file_len, file_off, mem_nseq, &curr_mem_seq, mem_len, mem_off, buf))<0) @@ -1987,9 +1939,10 @@ done: *------------------------------------------------------------------------- */ herr_t -H5S_select_write(H5F_t *f, H5O_layout_t *layout, H5P_genplist_t *dc_plist, +H5S_select_write(H5F_t *f, H5O_layout_t *layout, const H5D_dcpl_cache_t *dcpl_cache, const H5D_storage_t *store, size_t elmt_size, const H5S_t *file_space, - const H5S_t *mem_space, hid_t dxpl_id, const void *buf/*out*/) + const H5S_t *mem_space, const H5D_dxpl_cache_t *dxpl_cache, hid_t dxpl_id, + const void *buf/*out*/) { H5S_sel_iter_t mem_iter; /* Memory selection iteration info */ hbool_t mem_iter_init=0; /* Memory selection iteration info has been initialized */ @@ -2028,8 +1981,7 @@ H5S_select_write(H5F_t *f, H5O_layout_t *layout, H5P_genplist_t *dc_plist, assert(TRUE==H5P_isa_class(dxpl_id,H5P_DATASET_XFER)); /* Get the hyperslab vector size */ - if((vector_size=H5S_get_vector_size(dxpl_id))<0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get I/O vector size"); + vector_size=dxpl_cache->vec_size; /* Allocate the vector I/O arrays */ if((mem_len = H5FL_ARR_MALLOC(size_t,(size_t)vector_size))==NULL) @@ -2127,7 +2079,7 @@ for(u=curr_mem_seq; u