diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/H5D.c | 105 | ||||
-rw-r--r-- | src/H5Dio.c | 667 | ||||
-rw-r--r-- | src/H5Distore.c | 168 | ||||
-rw-r--r-- | src/H5Dpkg.h | 6 | ||||
-rw-r--r-- | src/H5Dprivate.h | 29 | ||||
-rw-r--r-- | src/H5Dseq.c | 32 | ||||
-rw-r--r-- | src/H5F.c | 4 | ||||
-rw-r--r-- | src/H5Fistore.c | 168 | ||||
-rw-r--r-- | src/H5Fpkg.h | 18 | ||||
-rw-r--r-- | src/H5Fprivate.h | 36 | ||||
-rw-r--r-- | src/H5Fseq.c | 32 | ||||
-rw-r--r-- | src/H5Smpio.c | 52 | ||||
-rw-r--r-- | src/H5Spkg.h | 24 | ||||
-rw-r--r-- | src/H5Sprivate.h | 34 | ||||
-rw-r--r-- | src/H5Sselect.c | 108 |
15 files changed, 845 insertions, 638 deletions
@@ -85,6 +85,9 @@ H5FL_BLK_DEFINE_STATIC(vlen_fl_buf); /* Define a static "default" dataset structure to use to initialize new datasets */ static H5D_t H5D_def_dset; +/* Define a "default" dataset transfer property list cache structure to use for default DXPLs */ +H5D_dxpl_cache_t H5D_def_dxpl_cache; + /*------------------------------------------------------------------------- * Function: H5D_init @@ -234,7 +237,7 @@ H5D_init_interface(void) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); /* Register the B-Tree node splitting ratios property */ - if(H5P_register(xfer_pclass,H5D_XFER_BTREE_SPLIT_RATIO_NAME,H5D_XFER_BTREE_SPLIT_RATIO_SIZE,&def_btree_split_ratio,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0) + if(H5P_register(xfer_pclass,H5D_XFER_BTREE_SPLIT_RATIO_NAME,H5D_XFER_BTREE_SPLIT_RATIO_SIZE,def_btree_split_ratio,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); #ifdef H5_WANT_H5_V1_4_COMPAT @@ -380,6 +383,13 @@ H5D_init_interface(void) if (H5P_get(def_dcpl, H5D_CRT_FILL_VALUE_NAME, &H5D_def_dset.fill) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve fill value"); + /* Reset the "default DXPL cache" information */ + HDmemset(&H5D_def_dxpl_cache,0,sizeof(H5D_dxpl_cache_t)); + + /* Get the default DXPL cache information */ + if (H5D_get_dxpl_cache_real(H5P_DATASET_XFER_DEFAULT, &H5D_def_dxpl_cache) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve default DXPL info") + done: FUNC_LEAVE_NOAPI(ret_value); } @@ -490,10 +500,11 @@ H5D_crt_copy(hid_t new_plist_id, hid_t old_plist_id, void UNUSED *copy_data) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline"); /* Make copies of fill value, external file list, and data pipeline */ - if(src_fill.buf && (NULL==H5O_copy(H5O_FILL_ID, &src_fill, &dst_fill))) { - HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't copy fill value"); - } - else if (!src_fill.buf) { + if(src_fill.buf) { + if(NULL==H5O_copy(H5O_FILL_ID, &src_fill, &dst_fill)) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't copy fill value") + } /* end if */ + else { dst_fill.type = dst_fill.buf = NULL; dst_fill.size = src_fill.size; } @@ -950,6 +961,57 @@ done: } /* end H5D_xfer_close() */ +/*-------------------------------------------------------------------------- + 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: H5Dcreate * @@ -1203,12 +1265,14 @@ done: * *------------------------------------------------------------------------- */ -herr_t H5Dget_space_status(hid_t dset_id, H5D_space_status_t *allocation) +herr_t +H5Dget_space_status(hid_t dset_id, H5D_space_status_t *allocation) { H5D_t *dset = NULL; herr_t ret_value = SUCCEED; FUNC_ENTER_API(H5Dget_space_status, FAIL); + H5TRACE2("e","i*Ds",dset_id,allocation); /* Check arguments */ if(NULL==(dset=H5I_object_verify(dset_id, H5I_DATASET))) @@ -1239,7 +1303,8 @@ done: * *------------------------------------------------------------------------- */ -static herr_t H5D_get_space_status(H5D_t *dset, H5D_space_status_t *allocation, hid_t dxpl_id) +static herr_t +H5D_get_space_status(H5D_t *dset, H5D_space_status_t *allocation, hid_t dxpl_id) { H5S_t *space; /* Dataset's dataspace */ hsize_t space_allocated; /* The number of bytes allocated for chunks */ @@ -1419,7 +1484,7 @@ H5Dget_create_plist(hid_t dset_id) done: if(ret_value<0) { if(new_dcpl_id>0) - H5Pclose(new_dcpl_id); + (void)H5I_dec_ref(new_dcpl_id); } /* end if */ FUNC_LEAVE_API(ret_value); @@ -2077,6 +2142,10 @@ H5D_create(H5G_entry_t *loc, const char *name, hid_t type_id, const H5S_t *space if (H5D_update_entry_info(file, dxpl_id, new_dset, dc_plist) != SUCCEED) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "can't update the metadata cache"); + /* Get the dataset's DCPL cache info */ + if (H5D_get_dcpl_cache(new_dset->dcpl_id,&new_dset->dcpl_cache)<0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, NULL, "can't fill DCPL cache") + /* * Give the dataset a name. That is, create and add a new * "H5G_entry_t" object to the group this dataset is being initially @@ -2205,8 +2274,10 @@ H5D_open(H5G_entry_t *ent, hid_t dxpl_id) } /* end if */ /* Add the dataset to the list of opened objects in the file */ - if(H5FO_insert(ent->file,ent->header,ret_value)<0) + if(H5FO_insert(ent->file,ent->header,ret_value)<0) { + (void)H5I_dec_ref(ret_value); HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "can't insert dataset into list of open objects"); + } /* end if */ } /* end if */ else { /* Dataset is already open, increment the reference count on the ID */ @@ -2422,6 +2493,10 @@ H5D_open_oid(H5G_entry_t *ent, hid_t dxpl_id) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to initialize file storage"); } + /* Get the dataset's DCPL cache info */ + if (H5D_get_dcpl_cache(dataset->dcpl_id,&dataset->dcpl_cache)<0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, NULL, "can't fill DCPL cache") + /* Success */ ret_value = dataset; @@ -3500,7 +3575,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 */ @@ -3561,16 +3635,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 7be69fb..ad515f0 100644 --- a/src/H5Dio.c +++ b/src/H5Dio.c @@ -79,28 +79,30 @@ 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_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_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_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_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); @@ -270,6 +272,129 @@ done: } /* H5D_fill() */ +/*-------------------------------------------------------------------------- + NAME + H5D_get_dxpl_cache_real + PURPOSE + Get all the values for the DXPL cache. + USAGE + herr_t H5D_get_dxpl_cache_real(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_real(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_real,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_real() */ + + +/*-------------------------------------------------------------------------- + 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); + + /* Check for the default DXPL */ + if(dxpl_id==H5P_DATASET_XFER_DEFAULT) + HDmemcpy(cache,&H5D_def_dxpl_cache,sizeof(H5D_dxpl_cache_t)); + else + if(H5D_get_dxpl_cache_real(dxpl_id,cache)<0) + HGOTO_ERROR (H5E_DATASET, H5E_CANTGET, FAIL, "Can't retrieve DXPL values") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5D_get_dxpl_cache() */ + + /*------------------------------------------------------------------------- * Function: H5Dread * @@ -515,11 +640,9 @@ 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 */ unsigned sconv_flags=0; /* Flags for the space conversion */ herr_t ret_value = SUCCEED; /* Return value */ @@ -530,33 +653,26 @@ 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) mem_space = file_space; if((snelmts = H5S_get_select_npoints(mem_space))<0) HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "src dataspace has invalid selection"); - nelmts=snelmts; + 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 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 the MPIO or MPIPOSIX driver */ - 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() */ + /* 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*/ @@ -575,29 +691,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; /* 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 */ + 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(&dataset->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) + if(fill_status == H5D_FILL_VALUE_UNDEFINED && + (dataset->dcpl_cache.fill_time == H5D_FILL_TIME_ALLOC || dataset->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(dataset->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(dataset->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); @@ -644,38 +754,35 @@ 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, + &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, + &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) - H5I_dec_ref(src_id); - if (dst_id >= 0) - H5I_dec_ref(dst_id); + if (src_id >= 0) { + if(H5I_dec_ref(src_id)<0) + HDONE_ERROR (H5E_DATASET, H5E_CANTFREE, FAIL, "Can't decrement temporary datatype ID") + } /* end if */ + if (dst_id >= 0) { + if(H5I_dec_ref(dst_id)<0) + HDONE_ERROR (H5E_DATASET, H5E_CANTFREE, FAIL, "Can't decrement temporary datatype ID") + } /* end if */ FUNC_LEAVE_NOAPI(ret_value); } /* end H5D_read() */ @@ -736,11 +843,9 @@ 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 */ unsigned sconv_flags=0; /* Flags for the space conversion */ herr_t ret_value = SUCCEED; /* Return value */ @@ -772,13 +877,9 @@ 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"); - - /* 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; @@ -786,19 +887,16 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, mem_space = file_space; if((snelmts = H5S_get_select_npoints(mem_space))<0) HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "src dataspace has invalid selection"); - nelmts=snelmts; + 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*/ @@ -871,18 +969,18 @@ 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); + 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_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, + &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, + &dxpl_cache, dxpl_id, src_id, dst_id, buf)<0) HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't write data"); } /* end else */ @@ -903,21 +1001,18 @@ 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) - H5I_dec_ref(src_id); - if (dst_id >= 0) - H5I_dec_ref(dst_id); + if (src_id >= 0) { + if(H5I_dec_ref(src_id)<0) + HDONE_ERROR (H5E_DATASET, H5E_CANTFREE, FAIL, "Can't decrement temporary datatype ID") + } /* end if */ + if (dst_id >= 0) { + if(H5I_dec_ref(dst_id)<0) + HDONE_ERROR (H5E_DATASET, H5E_CANTFREE, FAIL, "Can't decrement temporary datatype ID") + } /* end if */ FUNC_LEAVE_NOAPI(ret_value); } /* end H5D_write() */ @@ -940,9 +1035,10 @@ 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, +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, + 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*/ @@ -980,8 +1076,8 @@ H5D_contig_read(hsize_t nelmts, H5D_t *dataset, const H5T_t *mem_type, const H5S 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*/); + &dataset->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); @@ -1003,7 +1099,7 @@ H5D_contig_read(hsize_t nelmts, H5D_t *dataset, const H5T_t *mem_type, const H5S /* 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 @@ -1014,7 +1110,7 @@ H5D_contig_read(hsize_t nelmts, H5D_t *dataset, const H5T_t *mem_type, const H5S request_nelmts = target_size / MAX(src_type_size, dst_type_size); /* Sanity check elements in temporary buffer */ - if (request_nelmts<=0) + if (request_nelmts==0) HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL, "temporary buffer max size is too small"); /* Figure out the strip mine size. */ @@ -1036,19 +1132,21 @@ H5D_contig_read(hsize_t nelmts, H5D_t *dataset, const H5T_t *mem_type, const H5S * same size over and over. */ if (H5T_path_bkg(tpath)) { + 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 = MAX(H5T_path_bkg(tpath), need_bkg); + 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) @@ -1073,8 +1171,8 @@ H5D_contig_read(hsize_t nelmts, H5D_t *dataset, const H5T_t *mem_type, const H5S 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*/); + &dataset->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); @@ -1089,7 +1187,7 @@ H5D_contig_read(hsize_t nelmts, H5D_t *dataset, const H5T_t *mem_type, const H5S 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; @@ -1112,7 +1210,7 @@ H5D_contig_read(hsize_t nelmts, H5D_t *dataset, const H5T_t *mem_type, const H5S 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; @@ -1125,17 +1223,22 @@ H5D_contig_read(hsize_t nelmts, H5D_t *dataset, const H5T_t *mem_type, const H5S done: /* Release selection iterators */ - if(file_iter_init) - H5S_select_iter_release(&file_iter); - if(mem_iter_init) - H5S_select_iter_release(&mem_iter); - if(bkg_iter_init) - H5S_select_iter_release(&bkg_iter); - - assert(dx_plist); - if (tconv_buf && NULL==H5P_peek_voidp(dx_plist,H5D_XFER_TCONV_BUF_NAME)) + if(file_iter_init) { + if(H5S_select_iter_release(&file_iter)<0) + HDONE_ERROR (H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator") + } /* end if */ + if(mem_iter_init) { + if(H5S_select_iter_release(&mem_iter)<0) + HDONE_ERROR (H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator") + } /* end if */ + if(bkg_iter_init) { + if(H5S_select_iter_release(&bkg_iter)<0) + HDONE_ERROR (H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator") + } /* end if */ + + 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); @@ -1160,8 +1263,8 @@ done: */ 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_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*/ @@ -1196,8 +1299,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); + &dataset->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); @@ -1219,7 +1322,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 @@ -1230,7 +1333,7 @@ H5D_contig_write(hsize_t nelmts, H5D_t *dataset, const H5T_t *mem_type, const H5 request_nelmts = target_size / MAX (src_type_size, dst_type_size); /* Sanity check elements in temporary buffer */ - if (request_nelmts<=0) + if (request_nelmts==0) HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL, "temporary buffer max size is too small"); /* Figure out the strip mine size. */ @@ -1256,19 +1359,21 @@ H5D_contig_write(hsize_t nelmts, H5D_t *dataset, const H5T_t *mem_type, const H5 * data is used later for freeing heap objects. */ need_bkg = H5T_BKG_YES; } else if (H5T_path_bkg(tpath)) { + 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 = MAX (H5T_path_bkg(tpath), need_bkg); + 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) @@ -1290,7 +1395,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; @@ -1304,8 +1409,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*/); + &dataset->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); @@ -1329,8 +1434,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); + &dataset->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); @@ -1343,17 +1448,22 @@ H5D_contig_write(hsize_t nelmts, H5D_t *dataset, const H5T_t *mem_type, const H5 done: /* Release selection iterators */ - if(file_iter_init) - H5S_select_iter_release(&file_iter); - if(mem_iter_init) - H5S_select_iter_release(&mem_iter); - if(bkg_iter_init) - H5S_select_iter_release(&bkg_iter); - - assert(dx_plist); - if (tconv_buf && NULL==H5P_peek_voidp(dx_plist,H5D_XFER_TCONV_BUF_NAME)) + if(file_iter_init) { + if(H5S_select_iter_release(&file_iter)<0) + HDONE_ERROR (H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator") + } /* end if */ + if(mem_iter_init) { + if(H5S_select_iter_release(&mem_iter)<0) + HDONE_ERROR (H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator") + } /* end if */ + if(bkg_iter_init) { + if(H5S_select_iter_release(&bkg_iter)<0) + HDONE_ERROR (H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator") + } /* end if */ + + 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); @@ -1382,8 +1492,8 @@ 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, + const H5S_t *file_space, H5T_path_t *tpath, H5S_conv_t *sconv, + 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 */ @@ -1396,6 +1506,7 @@ UNUSED size_t dst_type_size; /*size of destination type*/ size_t target_size; /*desired buffer size */ hsize_t request_nelmts; /*requested strip mine */ + hssize_t schunk_nelmts; /* Number of elements selected in current chunk */ hsize_t chunk_nelmts; /* Number of elements selected in current chunk */ hsize_t smine_start; /*strip mine start loc */ hsize_t n, smine_nelmts; /*elements per strip */ @@ -1441,7 +1552,9 @@ UNUSED #ifdef H5S_DEBUG /* Get the number of elements selected in this chunk */ - chunk_nelmts=H5S_get_select_npoints(chunk_info->fspace); + if((schunk_nelmts=H5S_get_select_npoints(chunk_info->fspace))<0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTCOUNT, FAIL, "bad # of elements in selection") + H5_ASSIGN_OVERFLOW(chunk_nelmts,schunk_nelmts,hssize_t,hsize_t); assert(chunk_nelmts<=nelmts); #endif /* H5S_DEBUG */ @@ -1450,8 +1563,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); + &dataset->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) @@ -1478,7 +1591,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 @@ -1489,7 +1602,7 @@ UNUSED request_nelmts = target_size / MAX (src_type_size, dst_type_size); /* Sanity check elements in temporary buffer */ - if (request_nelmts<=0) + if (request_nelmts==0) HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL, "temporary buffer max size is too small"); /* @@ -1500,19 +1613,21 @@ UNUSED * same size over and over. */ if (H5T_path_bkg(tpath)) { + 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 = MAX(H5T_path_bkg(tpath), need_bkg); + 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) @@ -1532,7 +1647,9 @@ UNUSED chunk_info=chunk_node->data; /* Get the number of elements selected in this chunk */ - chunk_nelmts=H5S_get_select_npoints(chunk_info->fspace); + if((schunk_nelmts=H5S_get_select_npoints(chunk_info->fspace))<0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTCOUNT, FAIL, "bad # of elements in selection") + H5_ASSIGN_OVERFLOW(chunk_nelmts,schunk_nelmts,hssize_t,hsize_t); assert(chunk_nelmts<=nelmts); /* initialize selection iterator */ @@ -1566,8 +1683,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*/); + &dataset->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); @@ -1582,7 +1699,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; @@ -1606,7 +1723,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; @@ -1618,15 +1735,18 @@ UNUSED /* Release selection iterators */ if(file_iter_init) { - H5S_select_iter_release(&file_iter); + if(H5S_select_iter_release(&file_iter)<0) + HGOTO_ERROR (H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator") file_iter_init=0; } /* end if */ if(mem_iter_init) { - H5S_select_iter_release(&mem_iter); + if(H5S_select_iter_release(&mem_iter)<0) + HGOTO_ERROR (H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator") mem_iter_init=0; } /* end if */ if(bkg_iter_init) { - H5S_select_iter_release(&bkg_iter); + if(H5S_select_iter_release(&bkg_iter)<0) + HGOTO_ERROR (H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator") bkg_iter_init=0; } /* end if */ @@ -1635,20 +1755,25 @@ UNUSED } /* end while */ done: - assert(dx_plist); - if (tconv_buf && NULL==H5P_peek_voidp(dx_plist,H5D_XFER_TCONV_BUF_NAME)) + /* Release selection iterators, if necessary */ + if(file_iter_init) { + if(H5S_select_iter_release(&file_iter)<0) + HDONE_ERROR (H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator") + } /* end if */ + if(mem_iter_init) { + if(H5S_select_iter_release(&mem_iter)<0) + HDONE_ERROR (H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator") + } /* end if */ + if(bkg_iter_init) { + if(H5S_select_iter_release(&bkg_iter)<0) + HDONE_ERROR (H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator") + } /* end if */ + + 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 */ - if(file_iter_init) - H5S_select_iter_release(&file_iter); - if(mem_iter_init) - H5S_select_iter_release(&mem_iter); - if(bkg_iter_init) - H5S_select_iter_release(&bkg_iter); - /* Release chunk mapping information */ if(H5D_destroy_chunk_map(&fm) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "can't release chunk mapping"); @@ -1679,8 +1804,8 @@ 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_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 */ @@ -1693,6 +1818,7 @@ nelmts, H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, size_t dst_type_size; /*size of destination type*/ size_t target_size; /*desired buffer size */ hsize_t request_nelmts; /*requested strip mine */ + hssize_t schunk_nelmts; /* Number of elements selected in current chunk */ hsize_t chunk_nelmts; /* Number of elements selected in current chunk */ hsize_t smine_start; /*strip mine start loc */ hsize_t n, smine_nelmts; /*elements per strip */ @@ -1761,7 +1887,9 @@ nelmts, H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, #ifdef H5S_DEBUG /* Get the number of elements selected in this chunk */ - chunk_nelmts=H5S_get_select_npoints(chunk_info->fspace); + if((schunk_nelmts=H5S_get_select_npoints(chunk_info->fspace))<0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTCOUNT, FAIL, "bad # of elements in selection") + H5_ASSIGN_OVERFLOW(chunk_nelmts,schunk_nelmts,hssize_t,hsize_t); assert(chunk_nelmts<=nelmts); #endif /* H5S_DEBUG */ @@ -1770,8 +1898,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); + &dataset->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) @@ -1814,7 +1942,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 @@ -1825,7 +1953,7 @@ nelmts, H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, request_nelmts = target_size / MAX (src_type_size, dst_type_size); /* Sanity check elements in temporary buffer */ - if (request_nelmts<=0) + if (request_nelmts==0) HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL, "temporary buffer max size is too small"); /* @@ -1840,19 +1968,21 @@ nelmts, H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, * data is used later for freeing heap objects. */ need_bkg = H5T_BKG_YES; } else if (H5T_path_bkg(tpath)) { + 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 = MAX (H5T_path_bkg(tpath), need_bkg); + 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) @@ -1872,7 +2002,9 @@ nelmts, H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, chunk_info=chunk_node->data; /* Get the number of elements selected in this chunk */ - chunk_nelmts=H5S_get_select_npoints(chunk_info->fspace); + if((schunk_nelmts=H5S_get_select_npoints(chunk_info->fspace))<0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTCOUNT, FAIL, "bad # of elements in selection") + H5_ASSIGN_OVERFLOW(chunk_nelmts,schunk_nelmts,hssize_t,hsize_t); assert(chunk_nelmts<=nelmts); /* initialize selection iterator */ @@ -1903,7 +2035,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); @@ -1918,8 +2050,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*/); + &dataset->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); @@ -1944,8 +2076,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); + &dataset->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); @@ -1958,15 +2090,18 @@ nelmts, H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, /* Release selection iterators */ if(file_iter_init) { - H5S_select_iter_release(&file_iter); + if(H5S_select_iter_release(&file_iter)<0) + HGOTO_ERROR (H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator") file_iter_init=0; } /* end if */ if(mem_iter_init) { - H5S_select_iter_release(&mem_iter); + if(H5S_select_iter_release(&mem_iter)<0) + HGOTO_ERROR (H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator") mem_iter_init=0; } /* end if */ if(bkg_iter_init) { - H5S_select_iter_release(&bkg_iter); + if(H5S_select_iter_release(&bkg_iter)<0) + HGOTO_ERROR (H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator") bkg_iter_init=0; } /* end if */ @@ -1975,20 +2110,25 @@ 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)) + /* Release selection iterators, if necessary */ + if(file_iter_init) { + if(H5S_select_iter_release(&file_iter)<0) + HDONE_ERROR (H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator") + } /* end if */ + if(mem_iter_init) { + if(H5S_select_iter_release(&mem_iter)<0) + HDONE_ERROR (H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator") + } /* end if */ + if(bkg_iter_init) { + if(H5S_select_iter_release(&bkg_iter)<0) + HDONE_ERROR (H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator") + } /* end if */ + + 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 */ - if(file_iter_init) - H5S_select_iter_release(&file_iter); - if(mem_iter_init) - H5S_select_iter_release(&mem_iter); - if(bkg_iter_init) - H5S_select_iter_release(&bkg_iter); - /* Release chunk mapping information */ if(H5D_destroy_chunk_map(&fm) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "can't release chunk mapping"); @@ -2016,7 +2156,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 */ @@ -2028,25 +2168,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) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set transfer mode"); + 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); } + + +/*------------------------------------------------------------------------- + * 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*/ @@ -2118,9 +2301,9 @@ H5D_create_chunk_map(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *file_sp hsize_t nchunks, last_nchunks; /* Number of chunks in dataset */ H5TB_NODE *curr_node; /* Current node in TBBT */ H5S_sel_type fsel_type; /* Selection type on disk */ - char bogus; /* "bogus" buffer to pass to selection iterator */ - unsigned u; /* Local index variable */ - herr_t ret_value = SUCCEED; /*return value */ + char bogus; /* "bogus" buffer to pass to selection iterator */ + unsigned u; /* Local index variable */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5D_create_chunk_map); #ifdef QAK @@ -2164,7 +2347,7 @@ H5D_create_chunk_map(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *file_sp fm->f_ndims=f_ndims=dataset->layout.ndims-1; if((sm_ndims = H5S_get_simple_extent_ndims(tmp_mspace))<0) HGOTO_ERROR (H5E_DATASPACE, H5E_CANTGET, FAIL, "unable to get dimension number"); - fm->m_ndims=sm_ndims; + H5_ASSIGN_OVERFLOW(fm->m_ndims,sm_ndims,int,unsigned); /* De-select the mem space copy */ if(H5S_select_none(tmp_mspace)<0) @@ -2366,8 +2549,10 @@ done: if (H5S_select_iter_release(&(fm->mem_iter))<0) HDONE_ERROR (H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection iterator"); } - if(f_tid!=(-1)) - H5Tclose(f_tid); + if(f_tid!=(-1)) { + if(H5I_dec_ref(f_tid)<0) + HDONE_ERROR (H5E_DATASET, H5E_CANTFREE, FAIL, "Can't decrement temporary datatype ID") + } /* end if */ #ifdef QAK { @@ -2498,6 +2683,9 @@ H5D_create_chunk_file_map_hyper(const fm_map *fm) FUNC_ENTER_NOAPI_NOINIT(H5D_create_chunk_file_map_hyper); + /* Sanity check */ + assert(fm->f_ndims>0); + /* Make a copy of file dataspace */ if((tmp_fspace = H5S_copy(fm->file_space))==NULL) HGOTO_ERROR (H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy memory space"); @@ -2512,7 +2700,8 @@ H5D_create_chunk_file_map_hyper(const fm_map *fm) /* Set initial chunk location & hyperslab size */ for(u=0; u<fm->f_ndims; u++) { - start_coords[u]=(sel_start[u]/fm->layout->dim[u])*fm->layout->dim[u]; + H5_CHECK_OVERFLOW(fm->layout->dim[u],hsize_t,hssize_t); + start_coords[u]=(sel_start[u]/(hssize_t)fm->layout->dim[u])*(hssize_t)fm->layout->dim[u]; coords[u]=start_coords[u]; count[u]=fm->layout->dim[u]; } /* end for */ @@ -2526,7 +2715,7 @@ H5D_create_chunk_file_map_hyper(const fm_map *fm) HGOTO_ERROR (H5E_DATASPACE, H5E_BADRANGE, FAIL, "can't get chunk index"); /* Iterate through each chunk in the dataset */ - while(1) { + while(sel_points) { /* Check for intersection of temporary chunk and file selection */ if(H5S_hyper_intersect(tmp_fspace,fm->file_space)==TRUE) { H5S_t *tmp_fchunk; /* Temporary file dataspace */ @@ -2575,7 +2764,10 @@ H5D_create_chunk_file_map_hyper(const fm_map *fm) new_chunk_info->mspace=NULL; /* Compute the chunk's coordinates */ - H5D_chunk_coords_assist(new_chunk_info->coords, fm->f_ndims, fm->chunks, chunk_index); + if(H5D_chunk_coords_assist(new_chunk_info->coords, fm->f_ndims, fm->chunks, chunk_index)<0) { + H5D_free_chunk_info(new_chunk_info); + HGOTO_ERROR(H5E_DATASPACE,H5E_CANTCOUNT,FAIL,"can't compute chunk info") + } /* end if */ /* Insert the new chunk into the TBBT tree */ if(H5TB_dins(fm->fsel,new_chunk_info,new_chunk_info)==NULL) { @@ -2600,10 +2792,11 @@ H5D_create_chunk_file_map_hyper(const fm_map *fm) chunk_index++; /* Set current increment dimension */ - curr_dim=fm->f_ndims-1; + curr_dim=(int)fm->f_ndims-1; /* Increment chunk location in fastest changing dimension */ - coords[curr_dim]+=count[curr_dim]; + H5_CHECK_OVERFLOW(count[curr_dim],hsize_t,hssize_t); + coords[curr_dim]+=(hssize_t)count[curr_dim]; /* Bring chunk location back into bounds, if necessary */ if(coords[curr_dim]>sel_end[curr_dim]) { @@ -2615,7 +2808,7 @@ H5D_create_chunk_file_map_hyper(const fm_map *fm) curr_dim--; /* Increment chunk location in current dimension */ - coords[curr_dim]+=count[curr_dim]; + coords[curr_dim]+=(hssize_t)count[curr_dim]; } while(coords[curr_dim]>sel_end[curr_dim]); /* Re-Calculate the index of this chunk */ @@ -2679,6 +2872,9 @@ H5D_create_chunk_mem_map_hyper(const fm_map *fm) } #endif /* QAK */ + /* Sanity check */ + assert(fm->f_ndims>0); + /* Get offset of first block in file selection */ if(H5S_get_select_hyper_blocklist(fm->file_space, 1, (hsize_t)0, (hsize_t)1, file_off)<0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get file selection block info"); @@ -2689,8 +2885,11 @@ H5D_create_chunk_mem_map_hyper(const fm_map *fm) /* Calculate the adjustment for memory selection from file selection */ assert(fm->m_ndims==fm->f_ndims); - for(u=0; u<fm->f_ndims; u++) - adjust[u]=file_off[u]-mem_off[u]; + for(u=0; u<fm->f_ndims; u++) { + H5_CHECK_OVERFLOW(file_off[u],hsize_t,hssize_t); + H5_CHECK_OVERFLOW(mem_off[u],hsize_t,hssize_t); + adjust[u]=(hssize_t)file_off[u]-(hssize_t)mem_off[u]; + } /* end for */ #ifdef QAK { int mpi_rank; @@ -2732,8 +2931,10 @@ for(u=0; u<fm->f_ndims; u++) HGOTO_ERROR (H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy selection"); /* Compensate for the chunk offset */ - for(u=0; u<fm->f_ndims; u++) - chunk_adjust[u]=adjust[u]-(chunk_info->coords[u]*fm->layout->dim[u]); + for(u=0; u<fm->f_ndims; u++) { + H5_CHECK_OVERFLOW(fm->layout->dim[u],hsize_t,hssize_t); + chunk_adjust[u]=adjust[u]-(chunk_info->coords[u]*(hssize_t)fm->layout->dim[u]); /*lint !e771 The adjust array will always be initialized */ + } /* end for */ #ifdef QAK { int mpi_rank; diff --git a/src/H5Distore.c b/src/H5Distore.c index 30d89b1..28d35b3 100644 --- a/src/H5Distore.c +++ b/src/H5Distore.c @@ -216,7 +216,7 @@ H5B_class_t H5B_ISTORE[1] = {{ /* Declare a free list to manage H5F_rdcc_ent_t objects */ H5FL_DEFINE_STATIC(H5F_rdcc_ent_t); -/* Declare a PQ free list to manage the H5F_rdcc_ent_ptr_t array information */ +/* Declare a free list to manage the H5F_rdcc_ent_ptr_t sequence information */ H5FL_SEQ_DEFINE_STATIC(H5F_rdcc_ent_ptr_t); @@ -914,7 +914,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 */ @@ -943,10 +944,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->nfilters) { - 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 @@ -970,17 +967,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"); } @@ -1050,7 +1038,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 */ @@ -1064,7 +1052,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 { @@ -1120,6 +1108,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; @@ -1127,6 +1116,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)) { @@ -1134,10 +1127,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++; } } @@ -1170,6 +1163,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; @@ -1177,13 +1171,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) @@ -1216,7 +1214,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); @@ -1295,7 +1293,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++; } } @@ -1350,7 +1348,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*/) @@ -1366,15 +1364,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) { @@ -1448,12 +1441,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++; @@ -1501,10 +1490,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 */ @@ -1521,7 +1510,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]); @@ -1620,16 +1609,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); @@ -1663,12 +1650,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); @@ -1708,15 +1692,14 @@ 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) { 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 */ @@ -1724,18 +1707,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"); - #ifndef NDEBUG for (u=0; u<layout->ndims; u++) assert(chunk_coords[u]>=0); /*negative coordinates not supported (yet) */ @@ -1765,29 +1746,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 (layout->chunk_size>f->shared->rdcc_nbytes && pline.nfilters==0 && + if (layout->chunk_size>f->shared->rdcc_nbytes && dcpl_cache->pline.nfilters==0 && chunk_addr!=HADDR_UNDEF) { if ((ret_value=H5F_contig_readvv(f, layout->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"); @@ -1796,7 +1769,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"); @@ -1825,15 +1798,15 @@ 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) { 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 */ @@ -1841,18 +1814,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"); - #ifndef NDEBUG for (u=0; u<layout->ndims; u++) assert(chunk_coords[u]>=0); /*negative coordinates not supported (yet) */ @@ -1887,13 +1858,13 @@ 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 ((layout->chunk_size>f->shared->rdcc_nbytes && pline.nfilters==0 && + if ((layout->chunk_size>f->shared->rdcc_nbytes && dcpl_cache->pline.nfilters==0 && chunk_addr!=HADDR_UNDEF) || ((IS_H5FD_MPIO(f) ||IS_H5FD_MPIPOSIX(f) || IS_H5FD_FPHDF5(f)) && (H5F_ACC_RDWR & f->shared->flags))) { #ifdef H5_HAVE_PARALLEL /* Additional sanity check when operating in parallel */ - if (chunk_addr==HADDR_UNDEF || pline.nfilters>0) + if (chunk_addr==HADDR_UNDEF || dcpl_cache->pline.nfilters>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, layout->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) @@ -1901,18 +1872,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. @@ -1922,7 +1885,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"); @@ -1931,7 +1894,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"); @@ -2143,7 +2106,6 @@ H5F_istore_allocate(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, #ifdef H5_HAVE_PARALLEL MPI_Comm mpi_comm=MPI_COMM_NULL; /* MPI communicator for file */ int mpi_rank=(-1); /* This process's rank */ - int mpi_size=(-1); /* Total # of processes */ int mpi_code; /* MPI return code */ unsigned blocks_written=0; /* Flag to indicate that chunk was actually written */ unsigned using_mpi=0; /* Flag to indicate that the file is being accessed with an MPI-capable file driver */ @@ -2165,7 +2127,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) @@ -2195,8 +2157,6 @@ H5F_istore_allocate(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, /* Get the MPI rank & size */ if ((mpi_rank=H5FD_mpio_mpi_rank(f->shared->lf))<0) HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "Can't retrieve MPI rank"); - if ((mpi_size=H5FD_mpio_mpi_size(f->shared->lf))<0) - HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "Can't retrieve MPI size"); /* Set the MPI-capable file driver flag */ using_mpi=1; @@ -2209,8 +2169,6 @@ H5F_istore_allocate(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, /* Get the MPI rank & size */ if ((mpi_rank=H5FD_mpiposix_mpi_rank(f->shared->lf))<0) HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "Can't retrieve MPI rank"); - if ((mpi_size=H5FD_mpiposix_mpi_size(f->shared->lf))<0) - HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "Can't retrieve MPI size"); /* Set the MPI-capable file driver flag */ using_mpi=1; @@ -2225,9 +2183,6 @@ H5F_istore_allocate(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, if ((mpi_rank = H5FD_fphdf5_mpi_rank(f->shared->lf)) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "Can't retrieve MPI rank"); - if ((mpi_size = H5FD_fphdf5_mpi_size(f->shared->lf)) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "Can't retrieve MPI size"); - /* Set the MPI-capable file driver flag */ using_mpi = 1; } /* end if */ @@ -2490,7 +2445,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 */ @@ -2543,7 +2499,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"); } } @@ -2700,8 +2656,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 */ @@ -2798,7 +2755,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"); @@ -2831,7 +2788,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 */ @@ -2871,6 +2828,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 */ @@ -2878,6 +2836,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 */ @@ -2888,7 +2850,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 */ @@ -2944,6 +2906,7 @@ done: FUNC_LEAVE_NOAPI(ret_value); } +#ifdef H5F_ISTORE_DEBUG /*------------------------------------------------------------------------- * Function: H5F_istore_stats @@ -3008,6 +2971,7 @@ H5F_istore_stats (H5F_t *f, hbool_t headers) done: FUNC_LEAVE_NOAPI(ret_value); } +#endif /* H5F_ISTORE_DEBUG */ /*------------------------------------------------------------------------- diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h index 5b74873..b9047a6 100644 --- a/src/H5Dpkg.h +++ b/src/H5Dpkg.h @@ -58,6 +58,7 @@ struct H5D_t { H5T_t *type; /* datatype of this dataset */ H5S_t *space; /* dataspace of this dataset */ hid_t dcpl_id; /* dataset creation property id */ + H5D_dcpl_cache_t dcpl_cache; /* Cached DCPL values */ H5O_layout_t layout; /* data layout */ /* Cache some frequently accessed values from the DCPL */ H5O_efl_t efl; /* External file list information */ @@ -74,6 +75,11 @@ typedef enum { H5D_ALLOC_WRITE /* Dataset is being extended */ } H5D_time_alloc_t; +/*****************************/ +/* Package Private Variables */ +/*****************************/ +extern H5D_dxpl_cache_t H5D_def_dxpl_cache; + /******************************/ /* Package Private Prototypes */ /******************************/ diff --git a/src/H5Dprivate.h b/src/H5Dprivate.h index c63a0b7..7068ff5 100644 --- a/src/H5Dprivate.h +++ b/src/H5Dprivate.h @@ -22,6 +22,9 @@ #include "H5Dpublic.h" /* Private headers needed by this file */ +#include "H5FDfphdf5.h" +#include "H5FDmpio.h" +#include "H5FDmpiposix.h" #include "H5Oprivate.h" /* Object headers */ /* @@ -46,7 +49,7 @@ #define H5D_CRT_CHUNK_SIZE_NAME "chunk_size" #define H5D_CRT_CHUNK_SIZE_SIZE sizeof(hsize_t[H5O_LAYOUT_NDIMS]) #define H5D_CRT_CHUNK_SIZE_DEF {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,\ - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1} + 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1} /* Definitions for fill value. size=0 means fill value will be 0 as * library default; size=-1 means fill value is undefined. */ #define H5D_CRT_FILL_VALUE_NAME "fill_value" @@ -161,6 +164,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); @@ -175,5 +200,7 @@ 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(H5F_t *f, hid_t dxpl_id); +H5_DLL herr_t H5D_get_dxpl_cache(hid_t dxpl_id, H5D_dxpl_cache_t *cache); +H5_DLL herr_t H5D_get_dxpl_cache_real(hid_t dxpl_id, H5D_dxpl_cache_t *cache); #endif diff --git a/src/H5Dseq.c b/src/H5Dseq.c index dd8301f..918b010 100644 --- a/src/H5Dseq.c +++ b/src/H5Dseq.c @@ -72,8 +72,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 */ @@ -90,7 +91,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: @@ -120,8 +121,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 */ @@ -138,7 +140,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: @@ -187,8 +189,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*/) @@ -201,7 +204,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_seq<dset_max_nseq); assert(dset_len_arr); @@ -245,7 +248,7 @@ H5F_seq_readvv(H5F_t *f, hid_t dxpl_id, const struct H5O_layout_t *layout, case H5D_CHUNKED: assert(store); - if((ret_value=H5F_istore_readvv(f, dxpl_id, layout, dc_plist, store->chunk_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) @@ -302,8 +305,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) @@ -316,7 +320,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_seq<dset_max_nseq); assert(dset_len_arr); @@ -360,7 +364,7 @@ H5F_seq_writevv(H5F_t *f, hid_t dxpl_id, struct H5O_layout_t *layout, case H5D_CHUNKED: assert(store); - if((ret_value=H5F_istore_writevv(f, dxpl_id, layout, dc_plist, store->chunk_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) @@ -3074,8 +3074,12 @@ H5F_close(H5F_t *f) /* Only flush at this point if the file will be closed */ if (closing) { /* Dump debugging info */ +#ifdef H5AC_DEBUG H5AC_debug(f); +#endif /* H5AC_DEBUG */ +#ifdef H5F_ISTORE_DEBUG H5F_istore_stats(f, FALSE); +#endif /* H5F_ISTORE_DEBUG */ /* Only try to flush the file if it was opened with write access */ if(f->intent&H5F_ACC_RDWR) { diff --git a/src/H5Fistore.c b/src/H5Fistore.c index 30d89b1..28d35b3 100644 --- a/src/H5Fistore.c +++ b/src/H5Fistore.c @@ -216,7 +216,7 @@ H5B_class_t H5B_ISTORE[1] = {{ /* Declare a free list to manage H5F_rdcc_ent_t objects */ H5FL_DEFINE_STATIC(H5F_rdcc_ent_t); -/* Declare a PQ free list to manage the H5F_rdcc_ent_ptr_t array information */ +/* Declare a free list to manage the H5F_rdcc_ent_ptr_t sequence information */ H5FL_SEQ_DEFINE_STATIC(H5F_rdcc_ent_ptr_t); @@ -914,7 +914,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 */ @@ -943,10 +944,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->nfilters) { - 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 @@ -970,17 +967,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"); } @@ -1050,7 +1038,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 */ @@ -1064,7 +1052,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 { @@ -1120,6 +1108,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; @@ -1127,6 +1116,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)) { @@ -1134,10 +1127,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++; } } @@ -1170,6 +1163,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; @@ -1177,13 +1171,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) @@ -1216,7 +1214,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); @@ -1295,7 +1293,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++; } } @@ -1350,7 +1348,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*/) @@ -1366,15 +1364,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) { @@ -1448,12 +1441,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++; @@ -1501,10 +1490,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 */ @@ -1521,7 +1510,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]); @@ -1620,16 +1609,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); @@ -1663,12 +1650,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); @@ -1708,15 +1692,14 @@ 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) { 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 */ @@ -1724,18 +1707,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"); - #ifndef NDEBUG for (u=0; u<layout->ndims; u++) assert(chunk_coords[u]>=0); /*negative coordinates not supported (yet) */ @@ -1765,29 +1746,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 (layout->chunk_size>f->shared->rdcc_nbytes && pline.nfilters==0 && + if (layout->chunk_size>f->shared->rdcc_nbytes && dcpl_cache->pline.nfilters==0 && chunk_addr!=HADDR_UNDEF) { if ((ret_value=H5F_contig_readvv(f, layout->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"); @@ -1796,7 +1769,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"); @@ -1825,15 +1798,15 @@ 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) { 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 */ @@ -1841,18 +1814,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"); - #ifndef NDEBUG for (u=0; u<layout->ndims; u++) assert(chunk_coords[u]>=0); /*negative coordinates not supported (yet) */ @@ -1887,13 +1858,13 @@ 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 ((layout->chunk_size>f->shared->rdcc_nbytes && pline.nfilters==0 && + if ((layout->chunk_size>f->shared->rdcc_nbytes && dcpl_cache->pline.nfilters==0 && chunk_addr!=HADDR_UNDEF) || ((IS_H5FD_MPIO(f) ||IS_H5FD_MPIPOSIX(f) || IS_H5FD_FPHDF5(f)) && (H5F_ACC_RDWR & f->shared->flags))) { #ifdef H5_HAVE_PARALLEL /* Additional sanity check when operating in parallel */ - if (chunk_addr==HADDR_UNDEF || pline.nfilters>0) + if (chunk_addr==HADDR_UNDEF || dcpl_cache->pline.nfilters>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, layout->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) @@ -1901,18 +1872,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. @@ -1922,7 +1885,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"); @@ -1931,7 +1894,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"); @@ -2143,7 +2106,6 @@ H5F_istore_allocate(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, #ifdef H5_HAVE_PARALLEL MPI_Comm mpi_comm=MPI_COMM_NULL; /* MPI communicator for file */ int mpi_rank=(-1); /* This process's rank */ - int mpi_size=(-1); /* Total # of processes */ int mpi_code; /* MPI return code */ unsigned blocks_written=0; /* Flag to indicate that chunk was actually written */ unsigned using_mpi=0; /* Flag to indicate that the file is being accessed with an MPI-capable file driver */ @@ -2165,7 +2127,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) @@ -2195,8 +2157,6 @@ H5F_istore_allocate(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, /* Get the MPI rank & size */ if ((mpi_rank=H5FD_mpio_mpi_rank(f->shared->lf))<0) HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "Can't retrieve MPI rank"); - if ((mpi_size=H5FD_mpio_mpi_size(f->shared->lf))<0) - HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "Can't retrieve MPI size"); /* Set the MPI-capable file driver flag */ using_mpi=1; @@ -2209,8 +2169,6 @@ H5F_istore_allocate(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, /* Get the MPI rank & size */ if ((mpi_rank=H5FD_mpiposix_mpi_rank(f->shared->lf))<0) HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "Can't retrieve MPI rank"); - if ((mpi_size=H5FD_mpiposix_mpi_size(f->shared->lf))<0) - HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "Can't retrieve MPI size"); /* Set the MPI-capable file driver flag */ using_mpi=1; @@ -2225,9 +2183,6 @@ H5F_istore_allocate(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, if ((mpi_rank = H5FD_fphdf5_mpi_rank(f->shared->lf)) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "Can't retrieve MPI rank"); - if ((mpi_size = H5FD_fphdf5_mpi_size(f->shared->lf)) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "Can't retrieve MPI size"); - /* Set the MPI-capable file driver flag */ using_mpi = 1; } /* end if */ @@ -2490,7 +2445,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 */ @@ -2543,7 +2499,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"); } } @@ -2700,8 +2656,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 */ @@ -2798,7 +2755,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"); @@ -2831,7 +2788,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 */ @@ -2871,6 +2828,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 */ @@ -2878,6 +2836,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 */ @@ -2888,7 +2850,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 */ @@ -2944,6 +2906,7 @@ done: FUNC_LEAVE_NOAPI(ret_value); } +#ifdef H5F_ISTORE_DEBUG /*------------------------------------------------------------------------- * Function: H5F_istore_stats @@ -3008,6 +2971,7 @@ H5F_istore_stats (H5F_t *f, hbool_t headers) done: FUNC_LEAVE_NOAPI(ret_value); } +#endif /* H5F_ISTORE_DEBUG */ /*------------------------------------------------------------------------- diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index 2956002..b99cdba 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -185,6 +185,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); @@ -198,17 +202,23 @@ H5_DLL herr_t H5F_sieve_overlap_clear(H5F_t *f, hid_t dxpl_id, haddr_t addr, hsi 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); +#ifdef H5F_ISTORE_DEBUG H5_DLL herr_t H5F_istore_stats (H5F_t *f, hbool_t headers); +#endif /* H5F_ISTORE_DEBUG */ H5_DLL herr_t H5F_istore_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, int indent, int fwidth, int ndims); diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index 8b302f0..5d9f1c9 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -380,6 +380,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(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 dd8301f..918b010 100644 --- a/src/H5Fseq.c +++ b/src/H5Fseq.c @@ -72,8 +72,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 */ @@ -90,7 +91,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: @@ -120,8 +121,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 */ @@ -138,7 +140,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: @@ -187,8 +189,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*/) @@ -201,7 +204,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_seq<dset_max_nseq); assert(dset_len_arr); @@ -245,7 +248,7 @@ H5F_seq_readvv(H5F_t *f, hid_t dxpl_id, const struct H5O_layout_t *layout, case H5D_CHUNKED: assert(store); - if((ret_value=H5F_istore_readvv(f, dxpl_id, layout, dc_plist, store->chunk_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) @@ -302,8 +305,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) @@ -316,7 +320,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_seq<dset_max_nseq); assert(dset_len_arr); @@ -360,7 +364,7 @@ H5F_seq_writevv(H5F_t *f, hid_t dxpl_id, struct H5O_layout_t *layout, case H5D_CHUNKED: assert(store); - if((ret_value=H5F_istore_writevv(f, dxpl_id, layout, dc_plist, store->chunk_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/H5Smpio.c b/src/H5Smpio.c index a027171..e820b92 100644 --- a/src/H5Smpio.c +++ b/src/H5Smpio.c @@ -24,27 +24,17 @@ #define H5F_PACKAGE /*suppress error about including H5Fpkg */ #define H5S_PACKAGE /*suppress error about including H5Spkg */ -#include "H5private.h" /* Internal types, etc. */ -#include "H5Eprivate.h" /* Error reporting */ -#include "H5Fpkg.h" /* Ugly, but necessary for the MPIO I/O accesses */ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fpkg.h" /* Files */ #include "H5FDmpio.h" /* MPIO file driver */ -#include "H5FDprivate.h" /* Necessary for the H5FD_write & H5FD_read prototypes.. */ -#include "H5Iprivate.h" /* Object IDs */ -#include "H5Pprivate.h" /* Property Lists */ -#include "H5Spkg.h" /* Dataspaces */ - -#ifndef H5_HAVE_PARALLEL -/* - * The H5S_mpio_xxxx functions are for parallel I/O only and are - * valid only when H5_HAVE_PARALLEL is #defined. This empty #ifndef - * body is used to allow this source file be included in the serial - * distribution. - * Some compilers/linkers may complain about "empty" object file. - * If that happens, uncomment the following statement to pacify - * them. - */ -/* const hbool_t H5S_mpio_avail = FALSE; */ -#else /* H5_HAVE_PARALLEL */ +#include "H5FDprivate.h" /* File drivers */ +#include "H5Iprivate.h" /* IDs */ +#include "H5Pprivate.h" /* Property lists */ +#include "H5Spkg.h" /* Dataspaces */ + +#ifdef H5_HAVE_PARALLEL + /* Interface initialization */ #define PABLO_MASK H5Sall_mask #define INTERFACE_INIT NULL @@ -751,17 +741,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); @@ -790,18 +779,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 c443c90..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 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 1ca409c..0c9f8e8 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 @@ -974,10 +930,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_SEQ_MALLOC(size_t,(size_t)vector_size))==NULL) @@ -1417,10 +1371,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_SEQ_MALLOC(size_t,(size_t)vector_size))==NULL) @@ -1502,9 +1454,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 */ @@ -1533,8 +1486,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_SEQ_MALLOC(size_t,(size_t)vector_size))==NULL) @@ -1557,7 +1509,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 */ @@ -1602,9 +1554,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 */ @@ -1632,8 +1585,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_SEQ_MALLOC(size_t,(size_t)vector_size))==NULL) @@ -1656,7 +1608,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 */ @@ -1695,7 +1647,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; @@ -1720,8 +1673,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_SEQ_MALLOC(size_t,(size_t)vector_size))==NULL) @@ -1784,7 +1736,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; @@ -1809,8 +1762,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_SEQ_MALLOC(size_t,(size_t)vector_size))==NULL) @@ -1867,9 +1819,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 */ @@ -1909,8 +1862,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_SEQ_MALLOC(size_t,(size_t)vector_size))==NULL) @@ -1965,7 +1917,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) @@ -2016,9 +1968,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 */ @@ -2057,8 +2010,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_SEQ_MALLOC(size_t,(size_t)vector_size))==NULL) @@ -2156,7 +2108,7 @@ for(u=curr_mem_seq; u<mem_nseq; u++) } #endif /* QAK */ /* Write memory sequences into file sequences */ - if ((tmp_file_len=H5F_seq_writevv(f, dxpl_id, layout, dc_plist, store, + if ((tmp_file_len=H5F_seq_writevv(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) |