summaryrefslogtreecommitdiffstats
path: root/src/H5D.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/H5D.c')
-rw-r--r--src/H5D.c105
1 files changed, 93 insertions, 12 deletions
diff --git a/src/H5D.c b/src/H5D.c
index 81bad5a..066c048 100644
--- a/src/H5D.c
+++ b/src/H5D.c
@@ -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 */