diff options
author | Mohamad Chaarawi <chaarawi@hdfgroup.org> | 2015-12-21 18:55:54 (GMT) |
---|---|---|
committer | Mohamad Chaarawi <chaarawi@hdfgroup.org> | 2015-12-21 18:55:54 (GMT) |
commit | ea0f5d813bb26ec536f468d47f79bf93fb5a9401 (patch) | |
tree | 9d1f2cec912ce29b877327ada906721b98d5f0c5 /src/H5Dint.c | |
parent | 26b328aec8e10b9101c76bc049b6b5045b5f00a5 (diff) | |
parent | 9ceca0f89a0d27a6dfaeb3dd0cab2680281c5b60 (diff) | |
download | hdf5-ea0f5d813bb26ec536f468d47f79bf93fb5a9401.zip hdf5-ea0f5d813bb26ec536f468d47f79bf93fb5a9401.tar.gz hdf5-ea0f5d813bb26ec536f468d47f79bf93fb5a9401.tar.bz2 |
[svn-r28715] - merge from trunk
- fix farray, earray, and btree test to use correct function to retrieve internal file struct.
Diffstat (limited to 'src/H5Dint.c')
-rw-r--r-- | src/H5Dint.c | 93 |
1 files changed, 42 insertions, 51 deletions
diff --git a/src/H5Dint.c b/src/H5Dint.c index 32c817a..a1702fd 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -1551,7 +1551,7 @@ herr_t H5D_close(H5D_t *dataset) { hbool_t free_failed = FALSE; - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -1850,7 +1850,7 @@ H5D__alloc_storage(const H5D_t *dset, hid_t dxpl_id, H5D_time_alloc_t time_alloc case H5D_CHUNKED: if(!(*dset->shared->layout.ops->is_space_alloc)(&dset->shared->layout.storage)) { - /* Create the root of the B-tree that describes chunked storage */ + /* Create the root of the index that manages chunked storage */ if(H5D__chunk_create(dset /*in,out*/, dxpl_id) < 0) HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "unable to initialize chunked storage") @@ -1863,7 +1863,7 @@ H5D__alloc_storage(const H5D_t *dset, hid_t dxpl_id, H5D_time_alloc_t time_alloc /* If space allocation is set to 'early' and we are extending * the dataset, indicate that space should be allocated, so the - * B-tree gets expanded. -QAK + * index gets expanded. -QAK */ if(dset->shared->dcpl_cache.fill.alloc_time == H5D_ALLOC_TIME_EARLY && time_alloc == H5D_ALLOC_EXTEND) @@ -1914,7 +1914,7 @@ H5D__alloc_storage(const H5D_t *dset, hid_t dxpl_id, H5D_time_alloc_t time_alloc /* Check if we need to initialize the space */ if(must_init_space) { if(layout->type == H5D_CHUNKED) { - /* If we are doing incremental allocation and the B-tree got + /* If we are doing incremental allocation and the index got * created during a H5Dwrite call, don't initialize the storage * now, wait for the actual writes to each block and let the * low-level chunking routines handle initialize the fill-values. @@ -1937,10 +1937,9 @@ H5D__alloc_storage(const H5D_t *dset, hid_t dxpl_id, H5D_time_alloc_t time_alloc /* If we are filling the dataset on allocation or "if set" and * the fill value _is_ set, do that now */ if(dset->shared->dcpl_cache.fill.fill_time == H5D_FILL_TIME_ALLOC || - (dset->shared->dcpl_cache.fill.fill_time == H5D_FILL_TIME_IFSET && fill_status == H5D_FILL_VALUE_USER_DEFINED)) { + (dset->shared->dcpl_cache.fill.fill_time == H5D_FILL_TIME_IFSET && fill_status == H5D_FILL_VALUE_USER_DEFINED)) if(H5D__init_storage(dset, full_overwrite, old_dim, dxpl_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize dataset with fill value") - } /* end if */ } /* end else */ } /* end if */ @@ -2256,7 +2255,6 @@ H5D__vlen_get_buf_size_alloc(size_t size, void *info) * *------------------------------------------------------------------------- */ -/* ARGSUSED */ herr_t H5D__vlen_get_buf_size(void H5_ATTR_UNUSED *elem, hid_t type_id, unsigned H5_ATTR_UNUSED ndim, const hsize_t *point, void *op_data) { @@ -2576,7 +2574,6 @@ done: herr_t H5D__flush_real(H5D_t *dataset, hid_t dxpl_id) { - H5O_t *oh = NULL; /* Pointer to dataset's object header */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE_TAG(dxpl_id, dataset->oloc.addr, FAIL) @@ -2587,38 +2584,6 @@ H5D__flush_real(H5D_t *dataset, hid_t dxpl_id) /* Avoid flushing the dataset (again) if it's closing */ if(!dataset->shared->closing) { - /* Check for metadata changes that will require updating the object's modification time */ - if(dataset->shared->layout_dirty || dataset->shared->space_dirty) { - unsigned update_flags = H5O_UPDATE_TIME; /* Modification time flag */ - - /* Pin the object header */ - if(NULL == (oh = H5O_pin(&dataset->oloc, dxpl_id))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTPIN, FAIL, "unable to pin dataset object header") - - /* Update the layout on disk, if it's been changed */ - if(dataset->shared->layout_dirty) { - if(H5D__layout_oh_write(dataset, dxpl_id, oh, update_flags) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to update layout/pline/efl info") - dataset->shared->layout_dirty = FALSE; - - /* Reset the "update the modification time" flag, so we only do it once */ - update_flags = 0; - } /* end if */ - - /* Update the dataspace on disk, if it's been changed */ - if(dataset->shared->space_dirty) { - if(H5S_write(dataset->oloc.file, dxpl_id, oh, update_flags, dataset->shared->space) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to update file with new dataspace") - dataset->shared->space_dirty = FALSE; - - /* Reset the "update the modification time" flag, so we only do it once */ - update_flags = 0; - } /* end if */ - - /* _Somebody_ should have update the modification time! */ - HDassert(update_flags == 0); - } /* end if */ - /* Flush cached raw data for each kind of dataset layout */ if(dataset->shared->layout.ops->flush && (dataset->shared->layout.ops->flush)(dataset, dxpl_id) < 0) @@ -2626,11 +2591,6 @@ H5D__flush_real(H5D_t *dataset, hid_t dxpl_id) } /* end if */ done: - /* Release pointer to object header */ - if(oh != NULL) - if(H5O_unpin(oh) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTUNPIN, FAIL, "unable to unpin dataset object header") - FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) } /* end H5D__flush_real() */ @@ -2651,19 +2611,50 @@ done: herr_t H5D__mark(const H5D_t *dataset, hid_t H5_ATTR_UNUSED dxpl_id, unsigned flags) { + H5O_t *oh = NULL; /* Pointer to dataset's object header */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_NOERR + FUNC_ENTER_PACKAGE /* Check args */ HDassert(dataset); HDassert(!(flags & (unsigned)~(H5D_MARK_SPACE | H5D_MARK_LAYOUT))); /* Mark aspects of the dataset as dirty */ - if(flags & H5D_MARK_SPACE) - dataset->shared->space_dirty = TRUE; - if(flags & H5D_MARK_LAYOUT) - dataset->shared->layout_dirty = TRUE; + if(flags) { + unsigned update_flags = H5O_UPDATE_TIME; /* Modification time flag */ + + /* Pin the object header */ + if(NULL == (oh = H5O_pin(&dataset->oloc, dxpl_id))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTPIN, FAIL, "unable to pin dataset object header") + + /* Update the layout on disk, if it's been changed */ + if(flags & H5D_MARK_LAYOUT) { + if(H5D__layout_oh_write(dataset, dxpl_id, oh, update_flags) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to update layout info") + + /* Reset the "update the modification time" flag, so we only do it once */ + update_flags = 0; + } /* end if */ + + /* Update the dataspace on disk, if it's been changed */ + if(flags & H5D_MARK_SPACE) { + if(H5S_write(dataset->oloc.file, dxpl_id, oh, update_flags, dataset->shared->space) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to update file with new dataspace") + + /* Reset the "update the modification time" flag, so we only do it once */ + update_flags = 0; + } /* end if */ + + /* _Somebody_ should have update the modification time! */ + HDassert(update_flags == 0); + } /* end if */ + +done: + /* Release pointer to object header */ + if(oh != NULL) + if(H5O_unpin(oh) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CANTUNPIN, FAIL, "unable to unpin dataset object header") FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__mark() */ @@ -3000,7 +2991,7 @@ hid_t H5D_get_space(H5D_t *dset) { H5S_t *space = NULL; - hid_t ret_value = FAIL; + hid_t ret_value = H5I_INVALID_HID; FUNC_ENTER_NOAPI_NOINIT |