diff options
-rw-r--r-- | src/H5Dbtree.c | 174 | ||||
-rw-r--r-- | src/H5Dchunk.c | 97 | ||||
-rw-r--r-- | src/H5Dcompact.c | 27 | ||||
-rw-r--r-- | src/H5Dcontig.c | 31 | ||||
-rw-r--r-- | src/H5Defl.c | 27 | ||||
-rw-r--r-- | src/H5Dint.c | 97 | ||||
-rw-r--r-- | src/H5Dio.c | 9 | ||||
-rw-r--r-- | src/H5Doh.c | 2 | ||||
-rw-r--r-- | src/H5Dpkg.h | 10 | ||||
-rw-r--r-- | src/H5Dprivate.h | 5 | ||||
-rw-r--r-- | src/H5Dpublic.h | 5 | ||||
-rw-r--r-- | src/H5Olayout.c | 255 | ||||
-rw-r--r-- | src/H5Oprivate.h | 11 | ||||
-rw-r--r-- | src/H5Pdcpl.c | 15 | ||||
-rw-r--r-- | tools/h5stat/testfiles/h5stat_filters-d.ddl | 2 | ||||
-rw-r--r-- | tools/h5stat/testfiles/h5stat_filters-dT.ddl | 2 | ||||
-rw-r--r-- | tools/h5stat/testfiles/h5stat_filters.ddl | 2 |
17 files changed, 523 insertions, 248 deletions
diff --git a/src/H5Dbtree.c b/src/H5Dbtree.c index baa4c6b..b0988c1 100644 --- a/src/H5Dbtree.c +++ b/src/H5Dbtree.c @@ -156,6 +156,7 @@ static herr_t H5D_btree_debug_key(FILE *stream, H5F_t *f, hid_t dxpl_id, /* Chunked layout indexing callbacks */ static herr_t H5D_btree_idx_init(const H5D_chk_idx_info_t *idx_info); static herr_t H5D_btree_idx_create(const H5D_chk_idx_info_t *idx_info); +static hbool_t H5D_btree_idx_is_space_alloc(const H5O_layout_t *layout); static herr_t H5D_btree_idx_insert(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata); static herr_t H5D_btree_idx_get_addr(const H5D_chk_idx_info_t *idx_info, @@ -171,6 +172,9 @@ static herr_t H5D_btree_idx_copy_shutdown(H5O_layout_t *layout_src, H5O_layout_t *layout_dst); static herr_t H5D_btree_idx_size(const H5D_chk_idx_info_t *idx_info, hsize_t *size); +static herr_t H5D_btree_idx_reset(H5O_layout_t *layout); +static herr_t H5D_btree_idx_dump(const H5D_chk_idx_info_t *idx_info, + FILE *stream); static herr_t H5D_btree_idx_dest(const H5D_chk_idx_info_t *idx_info); @@ -182,6 +186,7 @@ static herr_t H5D_btree_idx_dest(const H5D_chk_idx_info_t *idx_info); const H5D_chunk_ops_t H5D_COPS_BTREE[1] = {{ H5D_btree_idx_init, H5D_btree_idx_create, + H5D_btree_idx_is_space_alloc, H5D_btree_idx_insert, H5D_btree_idx_get_addr, H5D_btree_idx_iterate, @@ -190,6 +195,8 @@ const H5D_chunk_ops_t H5D_COPS_BTREE[1] = {{ H5D_btree_idx_copy_setup, H5D_btree_idx_copy_shutdown, H5D_btree_idx_size, + H5D_btree_idx_reset, + H5D_btree_idx_dump, H5D_btree_idx_dest }}; @@ -246,13 +253,14 @@ H5D_btree_get_shared(const H5F_t UNUSED *f, const void *_udata) HDassert(udata); HDassert(udata->mesg); - HDassert(udata->mesg->u.chunk.btree_shared); + HDassert(udata->mesg->u.chunk.idx_type == H5D_CHUNK_BTREE); + HDassert(udata->mesg->u.chunk.u.btree.shared); /* Increment reference count on B-tree info */ - H5RC_INC(udata->mesg->u.chunk.btree_shared); + H5RC_INC(udata->mesg->u.chunk.u.btree.shared); /* Return the pointer to the ref-count object */ - FUNC_LEAVE_NOAPI(udata->mesg->u.chunk.btree_shared) + FUNC_LEAVE_NOAPI(udata->mesg->u.chunk.u.btree.shared) } /* end H5D_btree_get_shared() */ @@ -832,7 +840,7 @@ H5D_btree_shared_create(const H5F_t *f, H5O_layout_t *layout) /* <none> */ /* Make shared B-tree info reference counted */ - if(NULL == (layout->u.chunk.btree_shared = H5RC_create(shared, H5B_shared_free))) + if(NULL == (layout->u.chunk.u.btree.shared = H5RC_create(shared, H5B_shared_free))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't create ref-count wrapper for shared B-tree info") done: @@ -903,12 +911,13 @@ H5D_btree_idx_create(const H5D_chk_idx_info_t *idx_info) HDassert(idx_info); HDassert(idx_info->f); HDassert(idx_info->layout); + HDassert(!H5F_addr_defined(idx_info->layout->u.chunk.u.btree.addr)); /* Initialize "user" data for B-tree callbacks, etc. */ udata.mesg = idx_info->layout; /* Create the v1 B-tree for the chunk index */ - if(H5B_create(idx_info->f, idx_info->dxpl_id, H5B_BTREE, &udata, &(idx_info->layout->u.chunk.addr)/*out*/) < 0) + if(H5B_create(idx_info->f, idx_info->dxpl_id, H5B_BTREE, &udata, &(idx_info->layout->u.chunk.u.btree.addr)/*out*/) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't create B-tree") done: @@ -917,6 +926,35 @@ done: /*------------------------------------------------------------------------- + * Function: H5D_btree_idx_is_space_alloc + * + * Purpose: Query if space is allocated for index method + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * Thursday, January 15, 2009 + * + *------------------------------------------------------------------------- + */ +static hbool_t +H5D_btree_idx_is_space_alloc(const H5O_layout_t *layout) +{ + hbool_t ret_value; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_btree_idx_is_space_alloc) + + /* Check args */ + HDassert(layout); + + /* Set return value */ + ret_value = (hbool_t)H5F_addr_defined(layout->u.chunk.u.btree.addr); + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5D_btree_idx_is_space_alloc() */ + + +/*------------------------------------------------------------------------- * Function: H5D_btree_idx_insert * * Purpose: Create the chunk it if it doesn't exist, or reallocate the @@ -939,13 +977,14 @@ H5D_btree_idx_insert(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata) HDassert(idx_info); HDassert(idx_info->f); HDassert(idx_info->layout); + HDassert(H5F_addr_defined(idx_info->layout->u.chunk.u.btree.addr)); HDassert(udata); /* * Create the chunk it if it doesn't exist, or reallocate the chunk if * its size changed. */ - if(H5B_insert(idx_info->f, idx_info->dxpl_id, H5B_BTREE, idx_info->layout->u.chunk.addr, udata) < 0) + if(H5B_insert(idx_info->f, idx_info->dxpl_id, H5B_BTREE, idx_info->layout->u.chunk.u.btree.addr, udata) < 0) HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to allocate chunk") done: @@ -981,7 +1020,7 @@ H5D_btree_idx_get_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata HDassert(udata); /* Go get the chunk information from the B-tree */ - if(H5B_find(idx_info->f, idx_info->dxpl_id, H5B_BTREE, idx_info->layout->u.chunk.addr, udata) < 0) + if(H5B_find(idx_info->f, idx_info->dxpl_id, H5B_BTREE, idx_info->layout->u.chunk.u.btree.addr, udata) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk info") done: @@ -1062,6 +1101,7 @@ H5D_btree_idx_iterate(const H5D_chk_idx_info_t *idx_info, HDassert(idx_info); HDassert(idx_info->f); HDassert(idx_info->layout); + HDassert(H5F_addr_defined(idx_info->layout->u.chunk.u.btree.addr)); HDassert(chunk_cb); HDassert(chunk_udata); @@ -1072,7 +1112,7 @@ H5D_btree_idx_iterate(const H5D_chk_idx_info_t *idx_info, udata.udata = chunk_udata; /* Iterate over existing chunks */ - if((ret_value = H5B_iterate(idx_info->f, idx_info->dxpl_id, H5B_BTREE, idx_info->layout->u.chunk.addr, H5D_btree_idx_iterate_cb, &udata)) < 0) + if((ret_value = H5B_iterate(idx_info->f, idx_info->dxpl_id, H5B_BTREE, idx_info->layout->u.chunk.u.btree.addr, H5D_btree_idx_iterate_cb, &udata)) < 0) HERROR(H5E_DATASET, H5E_BADITER, "unable to iterate over chunk B-tree"); FUNC_LEAVE_NOAPI(ret_value) @@ -1101,12 +1141,13 @@ H5D_btree_idx_remove(const H5D_chk_idx_info_t *idx_info, H5D_chunk_common_ud_t * HDassert(idx_info); HDassert(idx_info->f); HDassert(idx_info->layout); + HDassert(H5F_addr_defined(idx_info->layout->u.chunk.u.btree.addr)); HDassert(udata); /* Remove the chunk from the v1 B-tree index and release the space for the * chunk (in the B-tree callback). */ - if(H5B_remove(idx_info->f, idx_info->dxpl_id, H5B_BTREE, idx_info->layout->u.chunk.addr, udata) < 0) + if(H5B_remove(idx_info->f, idx_info->dxpl_id, H5B_BTREE, idx_info->layout->u.chunk.u.btree.addr, udata) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTDELETE, FAIL, "unable to remove chunk entry") done: @@ -1131,8 +1172,6 @@ done: static herr_t H5D_btree_idx_delete(const H5D_chk_idx_info_t *idx_info) { - H5O_layout_t tmp_layout; /* Local copy of layout info */ - H5D_btree_ud0_t udata; /* User data for B-tree iterator call */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5D_btree_idx_delete) @@ -1141,26 +1180,31 @@ H5D_btree_idx_delete(const H5D_chk_idx_info_t *idx_info) HDassert(idx_info); HDassert(idx_info->f); HDassert(idx_info->layout); - HDassert(H5F_addr_defined(idx_info->layout->u.chunk.addr)); - /* Set up user data for B-tree deletion */ - HDmemset(&udata, 0, sizeof udata); - tmp_layout = *idx_info->layout; - udata.mesg = &tmp_layout; + /* Check if the index data structure has been allocated */ + if(H5F_addr_defined(idx_info->layout->u.chunk.u.btree.addr)) { + H5O_layout_t tmp_layout; /* Local copy of layout info */ + H5D_btree_ud0_t udata; /* User data for B-tree iterator call */ - /* Set up the shared structure */ - if(H5D_btree_shared_create(idx_info->f, &tmp_layout) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't create wrapper for shared B-tree info") + /* Set up user data for B-tree deletion */ + HDmemset(&udata, 0, sizeof udata); + tmp_layout = *idx_info->layout; + udata.mesg = &tmp_layout; - /* Delete entire B-tree */ - if(H5B_delete(idx_info->f, idx_info->dxpl_id, H5B_BTREE, tmp_layout.u.chunk.addr, &udata) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTDELETE, FAIL, "unable to delete chunk B-tree") + /* Set up the shared structure */ + if(H5D_btree_shared_create(idx_info->f, &tmp_layout) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't create wrapper for shared B-tree info") - /* Free the raw B-tree node buffer */ - if(NULL == tmp_layout.u.chunk.btree_shared) - HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "ref-counted page nil") - if(H5RC_DEC(tmp_layout.u.chunk.btree_shared) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to decrement ref-counted page") + /* Delete entire B-tree */ + if(H5B_delete(idx_info->f, idx_info->dxpl_id, H5B_BTREE, tmp_layout.u.chunk.u.btree.addr, &udata) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTDELETE, FAIL, "unable to delete chunk B-tree") + + /* Free the raw B-tree node buffer */ + if(NULL == tmp_layout.u.chunk.u.btree.shared) + HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "ref-counted page nil") + if(H5RC_DEC(tmp_layout.u.chunk.u.btree.shared) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to decrement ref-counted page") + } /* end if */ done: FUNC_LEAVE_NOAPI(ret_value) @@ -1193,7 +1237,7 @@ H5D_btree_idx_copy_setup(const H5D_chk_idx_info_t *idx_info_src, HDassert(idx_info_dst); HDassert(idx_info_dst->f); HDassert(idx_info_dst->layout); - HDassert(!H5F_addr_defined(idx_info_dst->layout->u.chunk.addr)); + HDassert(!H5F_addr_defined(idx_info_dst->layout->u.chunk.u.btree.addr)); /* Create shared B-tree info for each file */ if(H5D_btree_shared_create(idx_info_src->f, idx_info_src->layout) < 0) @@ -1204,6 +1248,7 @@ H5D_btree_idx_copy_setup(const H5D_chk_idx_info_t *idx_info_src, /* Create the root of the B-tree that describes chunked storage in the dest. file */ if(H5D_btree_idx_create(idx_info_dst) < 0) HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "unable to initialize chunked storage") + HDassert(H5F_addr_defined(idx_info_dst->layout->u.chunk.u.btree.addr)); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1233,9 +1278,9 @@ H5D_btree_idx_copy_shutdown(H5O_layout_t *layout_src, H5O_layout_t *layout_dst) HDassert(layout_dst); /* Decrement refcount on shared B-tree info */ - if(H5RC_DEC(layout_src->u.chunk.btree_shared) < 0) + if(H5RC_DEC(layout_src->u.chunk.u.btree.shared) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "unable to decrement ref-counted page") - if(H5RC_DEC(layout_dst->u.chunk.btree_shared) < 0) + if(H5RC_DEC(layout_dst->u.chunk.u.btree.shared) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "unable to decrement ref-counted page") done: @@ -1282,7 +1327,7 @@ H5D_btree_idx_size(const H5D_chk_idx_info_t *idx_info, hsize_t *index_size) udata.mesg = idx_info->layout; /* Get metadata information for B-tree */ - if(H5B_get_info(idx_info->f, idx_info->dxpl_id, H5B_BTREE, idx_info->layout->u.chunk.addr, &bt_info, NULL, &udata) < 0) + if(H5B_get_info(idx_info->f, idx_info->dxpl_id, H5B_BTREE, idx_info->layout->u.chunk.u.btree.addr, &bt_info, NULL, &udata) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "unable to iterate over chunk B-tree") /* Set the size of the B-tree */ @@ -1290,9 +1335,9 @@ H5D_btree_idx_size(const H5D_chk_idx_info_t *idx_info, hsize_t *index_size) done: if(shared_init) { - if(idx_info->layout->u.chunk.btree_shared == NULL) + if(NULL == idx_info->layout->u.chunk.u.btree.shared) HDONE_ERROR(H5E_IO, H5E_CANTFREE, FAIL, "ref-counted page nil") - if(H5RC_DEC(idx_info->layout->u.chunk.btree_shared) < 0) + if(H5RC_DEC(idx_info->layout->u.chunk.u.btree.shared) < 0) HDONE_ERROR(H5E_IO, H5E_CANTFREE, FAIL, "unable to decrement ref-counted page") } /* end if */ @@ -1301,6 +1346,61 @@ done: /*------------------------------------------------------------------------- + * Function: H5D_btree_idx_reset + * + * Purpose: Reset indexing information. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * Thursday, January 15, 2009 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D_btree_idx_reset(H5O_layout_t *layout) +{ + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_btree_idx_reset) + + HDassert(layout); + + /* Reset index info */ + layout->u.chunk.u.btree.addr = HADDR_UNDEF; + layout->u.chunk.u.btree.shared = NULL; + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5D_btree_idx_reset() */ + + +/*------------------------------------------------------------------------- + * Function: H5D_btree_idx_dump + * + * Purpose: Dump indexing information to a stream. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * Thursday, January 15, 2009 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D_btree_idx_dump(const H5D_chk_idx_info_t *idx_info, FILE *stream) +{ + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_btree_idx_dump) + + HDassert(idx_info); + HDassert(idx_info->f); + HDassert(idx_info->layout); + HDassert(stream); + + HDfprintf(stream, " Address: %a\n", idx_info->layout->u.chunk.u.btree.addr); + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5D_btree_idx_dump() */ + + +/*------------------------------------------------------------------------- * Function: H5D_btree_idx_dest * * Purpose: Release indexing information in memory. @@ -1324,9 +1424,9 @@ H5D_btree_idx_dest(const H5D_chk_idx_info_t *idx_info) HDassert(idx_info->layout); /* Free the raw B-tree node buffer */ - if(idx_info->layout->u.chunk.btree_shared == NULL) + if(NULL == idx_info->layout->u.chunk.u.btree.shared) HGOTO_ERROR(H5E_IO, H5E_CANTFREE, FAIL, "ref-counted page nil") - if(H5RC_DEC(idx_info->layout->u.chunk.btree_shared) < 0) + if(H5RC_DEC(idx_info->layout->u.chunk.u.btree.shared) < 0) HGOTO_ERROR(H5E_IO, H5E_CANTFREE, FAIL, "unable to decrement ref-counted page") done: @@ -1374,9 +1474,9 @@ H5D_btree_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, int indent done: if(shared_init) { /* Free the raw B-tree node buffer */ - if(layout.u.chunk.btree_shared == NULL) + if(NULL == layout.u.chunk.u.btree.shared) HDONE_ERROR(H5E_IO, H5E_CANTFREE, FAIL, "ref-counted page nil") - if(H5RC_DEC(layout.u.chunk.btree_shared) < 0) + if(H5RC_DEC(layout.u.chunk.u.btree.shared) < 0) HDONE_ERROR(H5E_IO, H5E_CANTFREE, FAIL, "unable to decrement ref-counted page") } /* end if */ diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index c56ff85..afcdc6d 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -192,9 +192,10 @@ static herr_t H5D_chunk_mem_cb(void *elem, hid_t type_id, unsigned ndims, /* Package Variables */ /*********************/ -/* Compact storage layout I/O ops */ +/* Chunked storage layout I/O ops */ const H5D_layout_ops_t H5D_LOPS_CHUNK[1] = {{ H5D_chunk_new, + H5D_chunk_is_space_alloc, H5D_chunk_io_init, H5D_chunk_read, H5D_chunk_write, @@ -218,6 +219,7 @@ const H5D_layout_ops_t H5D_LOPS_NULL[1] = {{ NULL, NULL, NULL, + NULL, #ifdef H5_HAVE_PARALLEL NULL, NULL, @@ -283,7 +285,6 @@ H5D_chunk_new(H5F_t *f, hid_t dapl_id, hid_t dxpl_id, H5D_t *dset, /* Increment # of chunk dimensions, to account for datatype size as last element */ dset->shared->layout.u.chunk.ndims++; HDassert((unsigned)(dset->shared->layout.u.chunk.ndims) <= NELMTS(dset->shared->layout.u.chunk.dim)); - HDassert(!H5F_addr_defined(dset->shared->layout.u.chunk.addr)); /* Chunked storage is not compatible with external storage (currently) */ if(dset->shared->dcpl_cache.efl.nused > 0) @@ -328,6 +329,35 @@ done: /*------------------------------------------------------------------------- + * Function: H5D_chunk_is_space_alloc + * + * Purpose: Query if space is allocated for layout + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * Thursday, January 15, 2009 + * + *------------------------------------------------------------------------- + */ +hbool_t +H5D_chunk_is_space_alloc(const H5O_layout_t *layout) +{ + hbool_t ret_value; /* Return value */ + + FUNC_ENTER_NOAPI_NOFUNC(H5D_chunk_is_space_alloc) + + /* Sanity checks */ + HDassert(layout); + + /* Query index layer */ + ret_value = (layout->u.chunk.ops->is_space_alloc)(layout); + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5D_chunk_is_space_alloc() */ + + +/*------------------------------------------------------------------------- * Function: H5D_chunk_io_init * * Purpose: Performs initialization before any sort of I/O on the raw data @@ -1795,6 +1825,38 @@ done: /*------------------------------------------------------------------------- + * Function: H5D_chunk_idx_reset + * + * Purpose: Reset index information + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * Thursday, January 15, 2009 + * + *------------------------------------------------------------------------- + */ +herr_t +H5D_chunk_idx_reset(H5O_layout_t *layout) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(H5D_chunk_idx_reset, FAIL) + + /* Sanity checks */ + HDassert(layout); + HDassert(layout->u.chunk.ops); + + /* Reset index structures */ + if((layout->u.chunk.ops->reset)(layout) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to reset chunk index info") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5D_chunk_idx_reset() */ + + +/*------------------------------------------------------------------------- * Function: H5D_chunk_cinfo_cache_reset * * Purpose: Reset the cached chunk info @@ -2879,7 +2941,6 @@ H5D_chunk_allocate(H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite) /* Check args */ HDassert(dset && H5D_CHUNKED == layout->type); HDassert(layout->u.chunk.ndims > 0 && layout->u.chunk.ndims <= H5O_LAYOUT_NDIMS); - HDassert(H5F_addr_defined(layout->u.chunk.addr)); HDassert(TRUE == H5P_isa_class(dxpl_id, H5P_DATASET_XFER)); /* Retrieve the dataset dimensions */ @@ -3451,7 +3512,6 @@ H5D_chunk_prune_by_extent(H5D_t *dset, hid_t dxpl_id, const hsize_t *old_dims) /* Check args */ HDassert(dset && H5D_CHUNKED == layout->type); HDassert(layout->u.chunk.ndims > 0 && layout->u.chunk.ndims <= H5O_LAYOUT_NDIMS); - HDassert(H5F_addr_defined(layout->u.chunk.addr)); HDassert(dxpl_cache); /* Fill the DXPL cache values for later use */ @@ -3670,12 +3730,9 @@ H5D_chunk_delete(H5F_t *f, hid_t dxpl_id, H5O_layout_t *layout) idx_info.dxpl_id = dxpl_id; idx_info.layout = layout; - /* Check if the index has been created in the file */ - if(H5F_addr_defined(layout->u.chunk.addr)) { - /* Delete the chunked storage information in the file */ - if((layout->u.chunk.ops->delete)(&idx_info) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTDELETE, FAIL, "unable to delete chunk index") - } /* end if */ + /* Delete the chunked storage information in the file */ + if((layout->u.chunk.ops->delete)(&idx_info) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTDELETE, FAIL, "unable to delete chunk index") done: FUNC_LEAVE_NOAPI(ret_value) @@ -4010,7 +4067,6 @@ H5D_chunk_copy(H5F_t *f_src, H5O_layout_t *layout_src, H5F_t *f_dst, /* Call the index-specific "copy setup" routine */ if((layout_src->u.chunk.ops->copy_setup)(&idx_info_src, &idx_info_dst) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to set up index-specific chunk copying information") - HDassert(H5F_addr_defined(layout_dst->u.chunk.addr)); copy_setup_done = TRUE; /* Create datatype ID for src datatype */ @@ -4273,7 +4329,6 @@ H5D_chunk_dump_index_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) herr_t H5D_chunk_dump_index(H5D_t *dset, hid_t dxpl_id, FILE *stream) { - H5D_chunk_it_ud4_t udata; /* User data for callback */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5D_chunk_dump_index, FAIL) @@ -4283,21 +4338,23 @@ H5D_chunk_dump_index(H5D_t *dset, hid_t dxpl_id, FILE *stream) /* Only display info if stream is defined */ if(stream) { - H5D_chk_idx_info_t idx_info; /* Chunked index info */ + H5D_chk_idx_info_t idx_info; /* Chunked index info */ + H5D_chunk_it_ud4_t udata; /* User data for callback */ - /* Display address of index */ - HDfprintf(stream, " Address: %a\n", dset->shared->layout.u.chunk.addr); + /* Compose chunked index info struct */ + idx_info.f = dset->oloc.file; + idx_info.dxpl_id = dxpl_id; + idx_info.layout = &dset->shared->layout; + + /* Display info for index */ + if((dset->shared->layout.u.chunk.ops->dump)(&idx_info, stream) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "unable to dump chunk index info") /* Set up user data for callback */ udata.stream = stream; udata.header_displayed = FALSE; udata.ndims = dset->shared->layout.u.chunk.ndims; - /* Compose chunked index info struct */ - idx_info.f = dset->oloc.file; - idx_info.dxpl_id = dxpl_id; - idx_info.layout = &dset->shared->layout; - /* Iterate over index and dump chunk info */ if((dset->shared->layout.u.chunk.ops->iterate)(&idx_info, H5D_chunk_dump_index_cb, &udata) < 0) HGOTO_ERROR(H5E_DATASET, H5E_BADITER, FAIL, "unable to iterate over chunk index to dump chunk info") diff --git a/src/H5Dcompact.c b/src/H5Dcompact.c index 00471d6..ad95e18 100644 --- a/src/H5Dcompact.c +++ b/src/H5Dcompact.c @@ -59,6 +59,7 @@ /* Layout operation callbacks */ static herr_t H5D_compact_new(H5F_t *f, hid_t dapl_id, hid_t dxpl_id, H5D_t *dset, const H5P_genplist_t *dc_plist); +static hbool_t H5D_compact_is_space_alloc(const H5O_layout_t *layout); static herr_t H5D_compact_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_t nelmts, const H5S_t *file_space, const H5S_t *mem_space, H5D_chunk_map_t *cm); @@ -77,6 +78,7 @@ static ssize_t H5D_compact_writevv(const H5D_io_info_t *io_info, /* Compact storage layout I/O ops */ const H5D_layout_ops_t H5D_LOPS_COMPACT[1] = {{ H5D_compact_new, + H5D_compact_is_space_alloc, H5D_compact_io_init, H5D_contig_read, H5D_contig_write, @@ -199,6 +201,31 @@ done: /*------------------------------------------------------------------------- + * Function: H5D_compact_is_space_alloc + * + * Purpose: Query if space is allocated for layout + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * Thursday, January 15, 2009 + * + *------------------------------------------------------------------------- + */ +static hbool_t +H5D_compact_is_space_alloc(const H5O_layout_t UNUSED *layout) +{ + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_compact_is_space_alloc) + + /* Sanity checks */ + HDassert(layout); + + /* Compact storage is currently always allocated */ + FUNC_LEAVE_NOAPI(TRUE) +} /* end H5D_compact_is_space_alloc() */ + + +/*------------------------------------------------------------------------- * Function: H5D_compact_io_init * * Purpose: Performs initialization before any sort of I/O on the raw data diff --git a/src/H5Dcontig.c b/src/H5Dcontig.c index 4b7a5df..112eea5 100644 --- a/src/H5Dcontig.c +++ b/src/H5Dcontig.c @@ -63,6 +63,7 @@ /* Layout operation callbacks */ static herr_t H5D_contig_new(H5F_t *f, hid_t dapl_id, hid_t dxpl_id, H5D_t *dset, const H5P_genplist_t *dc_plist); +static hbool_t H5D_contig_is_space_alloc(const H5O_layout_t *layout); static herr_t H5D_contig_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_t nelmts, const H5S_t *file_space, const H5S_t *mem_space, H5D_chunk_map_t *cm); @@ -79,6 +80,7 @@ static herr_t H5D_contig_write_one(H5D_io_info_t *io_info, hsize_t offset, /* Contiguous storage layout I/O ops */ const H5D_layout_ops_t H5D_LOPS_CONTIG[1] = {{ H5D_contig_new, + H5D_contig_is_space_alloc, H5D_contig_io_init, H5D_contig_read, H5D_contig_write, @@ -413,6 +415,35 @@ done: /*------------------------------------------------------------------------- + * Function: H5D_contig_is_space_alloc + * + * Purpose: Query if space is allocated for layout + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * Thursday, January 15, 2009 + * + *------------------------------------------------------------------------- + */ +static hbool_t +H5D_contig_is_space_alloc(const H5O_layout_t *layout) +{ + hbool_t ret_value; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_contig_is_space_alloc) + + /* Sanity checks */ + HDassert(layout); + + /* Set return value */ + ret_value = (hbool_t)H5F_addr_defined(layout->u.contig.addr); + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5D_contig_is_space_alloc() */ + + +/*------------------------------------------------------------------------- * Function: H5D_contig_io_init * * Purpose: Performs initialization before any sort of I/O on the raw data diff --git a/src/H5Defl.c b/src/H5Defl.c index 880edfd..f3b346e 100644 --- a/src/H5Defl.c +++ b/src/H5Defl.c @@ -51,6 +51,7 @@ /* Layout operation callbacks */ static herr_t H5D_efl_new(H5F_t *f, hid_t dapl_id, hid_t dxpl_id, H5D_t *dset, const H5P_genplist_t *dc_plist); +static hbool_t H5D_efl_is_space_alloc(const H5O_layout_t *layout); static herr_t H5D_efl_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_t nelmts, const H5S_t *file_space, const H5S_t *mem_space, H5D_chunk_map_t *cm); @@ -75,6 +76,7 @@ static herr_t H5D_efl_write(const H5O_efl_t *efl, haddr_t addr, size_t size, /* External File List (EFL) storage layout I/O ops */ const H5D_layout_ops_t H5D_LOPS_EFL[1] = {{ H5D_efl_new, + H5D_efl_is_space_alloc, H5D_efl_io_init, H5D_contig_read, H5D_contig_write, @@ -169,6 +171,31 @@ done: /*------------------------------------------------------------------------- + * Function: H5D_efl_is_space_alloc + * + * Purpose: Query if space is allocated for layout + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * Thursday, January 15, 2009 + * + *------------------------------------------------------------------------- + */ +static hbool_t +H5D_efl_is_space_alloc(const H5O_layout_t UNUSED *layout) +{ + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_efl_is_space_alloc) + + /* Sanity checks */ + HDassert(layout); + + /* EFL storage is currently treated as allocated */ + FUNC_LEAVE_NOAPI(TRUE) +} /* end H5D_efl_is_space_alloc() */ + + +/*------------------------------------------------------------------------- * Function: H5D_efl_io_init * * Purpose: Performs initialization before any sort of I/O on the raw data diff --git a/src/H5Dint.c b/src/H5Dint.c index 37a4701..0e71ef8 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -966,6 +966,9 @@ H5D_update_oh_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset) #endif /* H5O_ENABLE_BOGUS */ /* Add a modification time message, if using older format. */ + /* (If using the latest format, the modification time is part of the object + * header and doesn't use a separate message -QAK) + */ if(!use_latest_format) if(H5O_touch_oh(file, dxpl_id, oh, TRUE) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update modification time message") @@ -1109,7 +1112,7 @@ H5D_create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id, HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't retrieve external file list") } /* end if */ - /* Set the latest version of the pline & fill messages, if requested */ + /* Set the latest version of the layout, pline & fill messages, if requested */ if(H5F_USE_LATEST_FORMAT(file)) { /* Set the latest version for the I/O pipeline message */ if(H5Z_set_latest_version(&new_dset->shared->dcpl_cache.pline) < 0) @@ -1223,7 +1226,7 @@ H5D_open(const H5G_loc_t *loc, hid_t dapl_id, hid_t dxpl_id) HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, NULL, "can't copy path") /* Check if dataset was already open */ - if((shared_fo = (H5D_shared_t *)H5FO_opened(dataset->oloc.file, dataset->oloc.addr)) == NULL) { + if(NULL == (shared_fo = (H5D_shared_t *)H5FO_opened(dataset->oloc.file, dataset->oloc.addr))) { /* Clear any errors from H5FO_opened() */ H5E_clear_stack(NULL); @@ -1352,38 +1355,36 @@ H5D_open_oid(H5D_t *dataset, hid_t dapl_id, hid_t dxpl_id) */ if(NULL == H5O_msg_read(&(dataset->oloc), H5O_LAYOUT_ID, &(dataset->shared->layout), dxpl_id)) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to read data layout message") + + /* Check for external file list message (which might not exist) */ + if((msg_exists = H5O_msg_exists(&(dataset->oloc), H5O_EFL_ID, dxpl_id)) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't check if message exists") + if(msg_exists) { + /* Retrieve the EFL message */ + if(NULL == H5O_msg_read(&(dataset->oloc), H5O_EFL_ID, &dataset->shared->dcpl_cache.efl, dxpl_id)) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't retrieve message") + + /* Set the EFL info in the property list */ + if(H5P_set(plist, H5D_CRT_EXT_FILE_LIST_NAME, &dataset->shared->dcpl_cache.efl) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set external file list") + + /* Set the dataset's I/O operations */ + dataset->shared->layout.ops = H5D_LOPS_EFL; + } /* end if */ + + /* Sanity check that the layout operations are set up */ + HDassert(dataset->shared->layout.ops); + /* Adjust chunk dimensions to omit datatype size (in last dimension) for creation property */ if(H5D_CHUNKED == dataset->shared->layout.type) dataset->shared->layout.u.chunk.ndims--; + /* Copy layout to the DCPL */ if(H5P_set(plist, H5D_CRT_LAYOUT_NAME, &dataset->shared->layout) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set layout") /* Adjust chunk dimensions back again (*sigh*) */ if(H5D_CHUNKED == dataset->shared->layout.type) dataset->shared->layout.u.chunk.ndims++; - /* Get the external file list message, which might not exist. Space is - * also undefined when space allocate time is H5D_ALLOC_TIME_LATE. */ - if((dataset->shared->layout.type == H5D_CONTIGUOUS && !H5F_addr_defined(dataset->shared->layout.u.contig.addr)) - || (dataset->shared->layout.type == H5D_CHUNKED && !H5F_addr_defined(dataset->shared->layout.u.chunk.addr))) { - if((msg_exists = H5O_msg_exists(&(dataset->oloc), H5O_EFL_ID, dxpl_id)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't check if message exists") - if(msg_exists) { - /* Retrieve the EFL message */ - if(NULL == H5O_msg_read(&(dataset->oloc), H5O_EFL_ID, &dataset->shared->dcpl_cache.efl, dxpl_id)) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't retrieve message") - - /* Set the EFL info in the property list */ - if(H5P_set(plist, H5D_CRT_EXT_FILE_LIST_NAME, &dataset->shared->dcpl_cache.efl) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set external file list") - - /* Set the dataset's I/O operations */ - dataset->shared->layout.ops = H5D_LOPS_EFL; - } /* end if */ - } /* end if */ - - /* Sanity check that the layout operations are set up */ - HDassert(dataset->shared->layout.ops); - switch(dataset->shared->layout.type) { case H5D_CONTIGUOUS: /* Compute the size of the contiguous storage for versions of the @@ -1476,8 +1477,7 @@ H5D_open_oid(H5D_t *dataset, hid_t dapl_id, hid_t dxpl_id) * be fully allocated before I/O can happen. */ if((H5F_INTENT(dataset->oloc.file) & H5F_ACC_RDWR) - && ((dataset->shared->layout.type == H5D_CONTIGUOUS && !H5F_addr_defined(dataset->shared->layout.u.contig.addr)) - || (dataset->shared->layout.type == H5D_CHUNKED && !H5F_addr_defined(dataset->shared->layout.u.chunk.addr))) + && !(*dataset->shared->layout.ops->is_space_alloc)(&dataset->shared->layout) && IS_H5FD_MPI(dataset->oloc.file)) { if(H5D_alloc_storage(dataset, dxpl_id, H5D_ALLOC_OPEN, FALSE) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize file storage") @@ -1758,7 +1758,7 @@ H5D_alloc_storage(H5D_t *dset/*in,out*/, hid_t dxpl_id, H5D_time_alloc_t time_al switch(layout->type) { case H5D_CONTIGUOUS: - if(!H5F_addr_defined(layout->u.contig.addr)) { + if(!(*dset->shared->layout.ops->is_space_alloc)(&dset->shared->layout)) { /* Reserve space in the file for the entire array */ if(H5D_contig_alloc(f, dxpl_id, layout/*out*/) < 0) HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "unable to initialize contiguous storage") @@ -1772,7 +1772,7 @@ H5D_alloc_storage(H5D_t *dset/*in,out*/, hid_t dxpl_id, H5D_time_alloc_t time_al break; case H5D_CHUNKED: - if(!H5F_addr_defined(layout->u.chunk.addr)) { + if(!(*dset->shared->layout.ops->is_space_alloc)(&dset->shared->layout)) { /* Create the root of the B-tree that describes chunked storage */ if(H5D_chunk_create(dset /*in,out*/, dxpl_id) < 0) HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "unable to initialize chunked storage") @@ -1954,19 +1954,20 @@ H5D_get_storage_size(H5D_t *dset, hid_t dxpl_id) switch(dset->shared->layout.type) { case H5D_CHUNKED: - if(dset->shared->layout.u.chunk.addr == HADDR_UNDEF) - ret_value = 0; - else + if((*dset->shared->layout.ops->is_space_alloc)(&dset->shared->layout)) { if(H5D_chunk_allocated(dset, dxpl_id, &ret_value) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, 0, "can't retrieve chunked dataset allocated size") + } /* end if */ + else + ret_value = 0; break; case H5D_CONTIGUOUS: /* Datasets which are not allocated yet are using no space on disk */ - if(dset->shared->layout.u.contig.addr == HADDR_UNDEF) - ret_value = 0; + if((*dset->shared->layout.ops->is_space_alloc)(&dset->shared->layout)) + ret_value = dset->shared->layout.u.contig.size; else - ret_value = dset->shared->layout.u.contig.size; + ret_value = 0; break; case H5D_COMPACT: @@ -2285,18 +2286,10 @@ H5D_set_extent(H5D_t *dset, const hsize_t *size, hid_t dxpl_id) HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "no write intent on file") /* Check if we are allowed to modify the space; only datasets with chunked and external storage are allowed to be modified */ - if( H5D_COMPACT == dset->shared->layout.type ) - { + if(H5D_COMPACT == dset->shared->layout.type) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "dataset has compact storage") - } - if( H5D_CONTIGUOUS == dset->shared->layout.type ) - { - if( 0 == dset->shared->dcpl_cache.efl.nused) - { - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "dataset has contiguous storage") - } - - } + if(H5D_CONTIGUOUS == dset->shared->layout.type && 0 == dset->shared->dcpl_cache.efl.nused) + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "dataset has contiguous storage") /* Check if the filters in the DCPL will need to encode, and if so, can they? */ if(H5D_check_filters(dset) < 0) @@ -2314,15 +2307,13 @@ H5D_set_extent(H5D_t *dset, const hsize_t *size, hid_t dxpl_id) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to modify size of data space") /* Don't bother updating things, unless they've changed */ - if(changed) - { + if(changed) { hbool_t shrink = FALSE; /* Flag to indicate a dimension has shrank */ hbool_t expand = FALSE; /* Flag to indicate a dimension has grown */ unsigned u; /* Local index variable */ /* Determine if we are shrinking and/or expanding any dimensions */ - for(u = 0; u < (unsigned)rank; u++) - { + for(u = 0; u < (unsigned)rank; u++) { if(size[u] < curr_dims[u]) shrink = TRUE; if(size[u] > curr_dims[u]) @@ -2350,10 +2341,8 @@ H5D_set_extent(H5D_t *dset, const hsize_t *size, hid_t dxpl_id) * and if the chunks are written *------------------------------------------------------------------------- */ - if( shrink && - H5D_CHUNKED == dset->shared->layout.type && - H5F_addr_defined(dset->shared->layout.u.chunk.addr)) - { + if(shrink && H5D_CHUNKED == dset->shared->layout.type && + (*dset->shared->layout.ops->is_space_alloc)(&dset->shared->layout)) { /* Remove excess chunks */ if(H5D_chunk_prune_by_extent(dset, dxpl_id, curr_dims) < 0) HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to remove chunks ") diff --git a/src/H5Dio.c b/src/H5Dio.c index 9308c33..c1d57fd 100644 --- a/src/H5Dio.c +++ b/src/H5Dio.c @@ -351,8 +351,7 @@ H5D_read(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space, * has been overwritten. So just proceed in reading. */ if(nelmts > 0 && dataset->shared->dcpl_cache.efl.nused == 0 && - ((dataset->shared->layout.type == H5D_CONTIGUOUS && !H5F_addr_defined(dataset->shared->layout.u.contig.addr)) - || (dataset->shared->layout.type == H5D_CHUNKED && !H5F_addr_defined(dataset->shared->layout.u.chunk.addr)))) { + !(*dataset->shared->layout.ops->is_space_alloc)(&dataset->shared->layout)) { H5D_fill_value_t fill_status; /* Whether/How the fill value is defined */ /* Retrieve dataset's fill-value properties */ @@ -386,8 +385,7 @@ H5D_read(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space, /* Sanity check that space is allocated, if there are elements */ if(nelmts > 0) - HDassert(((dataset->shared->layout.type == H5D_CONTIGUOUS && H5F_addr_defined(dataset->shared->layout.u.contig.addr)) - || (dataset->shared->layout.type == H5D_CHUNKED && H5F_addr_defined(dataset->shared->layout.u.chunk.addr))) + HDassert((*dataset->shared->layout.ops->is_space_alloc)(&dataset->shared->layout) || dataset->shared->dcpl_cache.efl.nused > 0 || dataset->shared->layout.type == H5D_COMPACT); @@ -537,8 +535,7 @@ H5D_write(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space, /* Allocate data space and initialize it if it hasn't been. */ if(nelmts > 0 && dataset->shared->dcpl_cache.efl.nused == 0 && - ((dataset->shared->layout.type == H5D_CONTIGUOUS && !H5F_addr_defined(dataset->shared->layout.u.contig.addr)) - || (dataset->shared->layout.type == H5D_CHUNKED && !H5F_addr_defined(dataset->shared->layout.u.chunk.addr)))) { + !(*dataset->shared->layout.ops->is_space_alloc)(&dataset->shared->layout)) { hssize_t file_nelmts; /* Number of elements in file dataset's dataspace */ hbool_t full_overwrite; /* Whether we are over-writing all the elements */ diff --git a/src/H5Doh.c b/src/H5Doh.c index 88ab971..be4c5bd 100644 --- a/src/H5Doh.c +++ b/src/H5Doh.c @@ -376,7 +376,7 @@ H5O_dset_bh_info(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5_ih_info_t *bh_info) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't find LAYOUT message") /* Check for chunked dataset storage */ - if((layout.type == H5D_CHUNKED) && H5F_addr_defined(layout.u.chunk.addr)) + if(layout.type == H5D_CHUNKED && H5D_chunk_is_space_alloc(&layout)) if(H5D_chunk_bh_info(f, dxpl_id, &layout, &(bh_info->index_size)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't determine chunked dataset btree info") diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h index b0d7d6a..4bf4e75 100644 --- a/src/H5Dpkg.h +++ b/src/H5Dpkg.h @@ -102,6 +102,7 @@ struct H5D_chunk_map_t; /* Function pointers for I/O on particular types of dataset layouts */ typedef herr_t (*H5D_layout_new_func_t)(H5F_t *f, hid_t dapl_id, hid_t dxpl_id, H5D_t *dset, const H5P_genplist_t *dc_plist); +typedef hbool_t (*H5D_layout_is_space_alloc_func_t)(const H5O_layout_t *layout); typedef herr_t (*H5D_layout_io_init_func_t)(const struct H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_t nelmts, const H5S_t *file_space, const H5S_t *mem_space, @@ -123,6 +124,7 @@ typedef herr_t (*H5D_layout_io_term_func_t)(const struct H5D_chunk_map_t *cm); /* Typedef for grouping layout I/O routines */ typedef struct H5D_layout_ops_t { H5D_layout_new_func_t new; /* Layout constructor for new datasets */ + H5D_layout_is_space_alloc_func_t is_space_alloc; /* Query routine to determine if storage is allocated */ H5D_layout_io_init_func_t io_init; /* I/O initialization routine */ H5D_layout_read_func_t ser_read; /* High-level I/O routine for reading data in serial */ H5D_layout_write_func_t ser_write; /* High-level I/O routine for writing data in serial */ @@ -262,6 +264,7 @@ typedef int (*H5D_chunk_cb_func_t)(const H5D_chunk_rec_t *chunk_rec, /* Typedefs for chunk operations */ typedef herr_t (*H5D_chunk_init_func_t)(const H5D_chk_idx_info_t *idx_info); typedef herr_t (*H5D_chunk_create_func_t)(const H5D_chk_idx_info_t *idx_info); +typedef hbool_t (*H5D_chunk_is_space_alloc_func_t)(const H5O_layout_t *layout); typedef herr_t (*H5D_chunk_insert_func_t)(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata); typedef herr_t (*H5D_chunk_get_addr_func_t)(const H5D_chk_idx_info_t *idx_info, @@ -277,12 +280,16 @@ typedef herr_t (*H5D_chunk_copy_shutdown_func_t)(H5O_layout_t *layout_src, H5O_layout_t *layout_dst); typedef herr_t (*H5D_chunk_size_func_t)(const H5D_chk_idx_info_t *idx_info, hsize_t *idx_size); +typedef herr_t (*H5D_chunk_reset_func_t)(H5O_layout_t *layout); +typedef herr_t (*H5D_chunk_dump_func_t)(const H5D_chk_idx_info_t *idx_info, + FILE *stream); typedef herr_t (*H5D_chunk_dest_func_t)(const H5D_chk_idx_info_t *idx_info); /* Typedef for grouping chunk I/O routines */ typedef struct H5D_chunk_ops_t { H5D_chunk_init_func_t init; /* Routine to initialize indexing information in memory */ H5D_chunk_create_func_t create; /* Routine to create chunk index */ + H5D_chunk_is_space_alloc_func_t is_space_alloc; /* Query routine to determine if storage/index is allocated */ H5D_chunk_insert_func_t insert; /* Routine to insert a chunk into an index */ H5D_chunk_get_addr_func_t get_addr; /* Routine to retrieve address of chunk in file */ H5D_chunk_iterate_func_t iterate; /* Routine to iterate over chunks */ @@ -291,6 +298,8 @@ typedef struct H5D_chunk_ops_t { H5D_chunk_copy_setup_func_t copy_setup; /* Routine to perform any necessary setup for copying chunks */ H5D_chunk_copy_shutdown_func_t copy_shutdown; /* Routine to perform any necessary shutdown for copying chunks */ H5D_chunk_size_func_t size; /* Routine to get size of indexing information */ + H5D_chunk_reset_func_t reset; /* Routine to reset indexing information */ + H5D_chunk_dump_func_t dump; /* Routine to dump indexing information */ H5D_chunk_dest_func_t dest; /* Routine to destroy indexing information in memory */ } H5D_chunk_ops_t; @@ -566,6 +575,7 @@ H5_DLL hbool_t H5D_chunk_cacheable(const H5D_io_info_t *io_info, haddr_t caddr); H5_DLL herr_t H5D_chunk_cinfo_cache_reset(H5D_chunk_cached_t *last); H5_DLL herr_t H5D_chunk_create(H5D_t *dset /*in,out*/, hid_t dxpl_id); H5_DLL herr_t H5D_chunk_init(H5F_t *f, hid_t dapl_id, hid_t dxpl_id, const H5D_t *dset); +H5_DLL hbool_t H5D_chunk_is_space_alloc(const H5O_layout_t *layout); H5_DLL herr_t H5D_chunk_get_info(const H5D_t *dset, hid_t dxpl_id, const hsize_t *chunk_offset, H5D_chunk_ud_t *udata); H5_DLL void *H5D_chunk_lock(const H5D_io_info_t *io_info, diff --git a/src/H5Dprivate.h b/src/H5Dprivate.h index 7f044e5..7c78d71 100644 --- a/src/H5Dprivate.h +++ b/src/H5Dprivate.h @@ -28,6 +28,7 @@ #include "H5Sprivate.h" /* Dataspaces */ #include "H5Zprivate.h" /* Data filters */ + /**************************/ /* Library Private Macros */ /**************************/ @@ -106,6 +107,7 @@ #define H5D_VLEN_FREE NULL #define H5D_VLEN_FREE_INFO NULL + /****************************/ /* Library Private Typedefs */ /****************************/ @@ -137,10 +139,12 @@ typedef struct H5D_dcpl_cache_t { H5O_efl_t efl; /* External file list info (H5D_CRT_EXT_FILE_LIST_NAME) */ } H5D_dcpl_cache_t; + /*****************************/ /* Library Private Variables */ /*****************************/ + /******************************/ /* Library Private Prototypes */ /******************************/ @@ -162,6 +166,7 @@ H5_DLL herr_t H5D_contig_delete(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout); /* Functions that operate on chunked storage */ +H5_DLL herr_t H5D_chunk_idx_reset(H5O_layout_t *layout); H5_DLL herr_t H5D_chunk_delete(H5F_t *f, hid_t dxpl_id, H5O_layout_t *layout); /* Functions that operate on indexed storage */ diff --git a/src/H5Dpublic.h b/src/H5Dpublic.h index 636c449..bae5dcf 100644 --- a/src/H5Dpublic.h +++ b/src/H5Dpublic.h @@ -48,6 +48,11 @@ typedef enum H5D_layout_t { H5D_NLAYOUTS = 3 /*this one must be last! */ } H5D_layout_t; +/* Types of chunk index data structures */ +typedef enum H5D_chunk_index_t { + H5D_CHUNK_BTREE = 0, /* v1 B-tree index */ +} H5D_chunk_index_t; + /* Values for the space allocation time property */ typedef enum H5D_alloc_time_t { H5D_ALLOC_TIME_ERROR = -1, diff --git a/src/H5Olayout.c b/src/H5Olayout.c index 59cd7db..a23e3ef 100644 --- a/src/H5Olayout.c +++ b/src/H5Olayout.c @@ -110,7 +110,6 @@ H5O_layout_decode(H5F_t *f, hid_t UNUSED dxpl_id, unsigned UNUSED mesg_flags, if(NULL == (mesg = H5FL_CALLOC(H5O_layout_t))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") - /* Version. 1 when space allocated; 2 when space allocation is delayed */ mesg->version = *p++; if(mesg->version < H5O_LAYOUT_VERSION_1 || mesg->version > H5O_LAYOUT_VERSION_3) HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "bad version number for layout message") @@ -138,13 +137,14 @@ H5O_layout_decode(H5F_t *f, hid_t UNUSED dxpl_id, unsigned UNUSED mesg_flags, mesg->ops = H5D_LOPS_CONTIG; } /* end if */ else if(mesg->type == H5D_CHUNKED) { - H5F_addr_decode(f, &p, &(mesg->u.chunk.addr)); + H5F_addr_decode(f, &p, &(mesg->u.chunk.u.btree.addr)); /* Set the layout operations */ mesg->ops = H5D_LOPS_CHUNK; /* Set the chunk operations */ - /* (Only "btree" indexing type currently supported */ + /* (Only "btree" indexing type currently supported in this version) */ + mesg->u.chunk.idx_type = H5D_CHUNK_BTREE; mesg->u.chunk.ops = H5D_COPS_BTREE; } /* end if */ else { @@ -219,7 +219,7 @@ H5O_layout_decode(H5F_t *f, hid_t UNUSED dxpl_id, unsigned UNUSED mesg_flags, HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "dimensionality is too large") /* B-tree address */ - H5F_addr_decode(f, &p, &(mesg->u.chunk.addr)); + H5F_addr_decode(f, &p, &(mesg->u.chunk.u.btree.addr)); /* Chunk dimensions */ for(u = 0; u < mesg->u.chunk.ndims; u++) @@ -229,12 +229,13 @@ H5O_layout_decode(H5F_t *f, hid_t UNUSED dxpl_id, unsigned UNUSED mesg_flags, for(u = 1, mesg->u.chunk.size = mesg->u.chunk.dim[0]; u < mesg->u.chunk.ndims; u++) mesg->u.chunk.size *= mesg->u.chunk.dim[u]; - /* Set the layout operations */ - mesg->ops = H5D_LOPS_CHUNK; - /* Set the chunk operations */ - /* (Only "btree" indexing type currently supported */ + /* (Only "btree" indexing type supported with v3 of message format) */ + mesg->u.chunk.idx_type = H5D_CHUNK_BTREE; mesg->u.chunk.ops = H5D_COPS_BTREE; + + /* Set the layout operations */ + mesg->ops = H5D_LOPS_CHUNK; break; default: @@ -298,8 +299,8 @@ H5O_layout_encode(H5F_t *f, hbool_t UNUSED disable_shared, uint8_t *p, const voi HDassert(mesg); HDassert(p); - /* Version 3 by default now. */ - *p++ = H5O_LAYOUT_VERSION_3; + /* Message version */ + *p++ = (uint8_t)mesg->version; /* Layout class */ *p++ = mesg->type; @@ -331,7 +332,7 @@ H5O_layout_encode(H5F_t *f, hbool_t UNUSED disable_shared, uint8_t *p, const voi *p++ = (uint8_t)mesg->u.chunk.ndims; /* B-tree address */ - H5F_addr_encode(f, &p, mesg->u.chunk.addr); + H5F_addr_encode(f, &p, mesg->u.chunk.u.btree.addr); /* Dimension sizes */ for(u = 0; u < mesg->u.chunk.ndims; u++) @@ -398,69 +399,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5O_layout_meta_size - * - * Purpose: Returns the size of the raw message in bytes except raw data - * part for compact dataset. This function doesn't take into - * account message alignment. - * - * Return: Success: Message data size in bytes(except raw data - * for compact dataset) - * Failure: 0 - * - * Programmer: Raymond Lu - * August 14, 2002 - * - *------------------------------------------------------------------------- - */ -size_t -H5O_layout_meta_size(const H5F_t *f, const void *_mesg) -{ - const H5O_layout_t *mesg = (const H5O_layout_t *) _mesg; - size_t ret_value; - - FUNC_ENTER_NOAPI_NOINIT(H5O_layout_meta_size) - - /* check args */ - HDassert(f); - HDassert(mesg); - - ret_value = 1 + /* Version number */ - 1; /* layout class type */ - - switch(mesg->type) { - case H5D_COMPACT: - /* Size of raw data */ - ret_value += 2; - break; - - case H5D_CONTIGUOUS: - ret_value += H5F_SIZEOF_ADDR(f); /* Address of data */ - ret_value += H5F_SIZEOF_SIZE(f); /* Length of data */ - break; - - case H5D_CHUNKED: - /* Number of dimensions (1 byte) */ - assert(mesg->u.chunk.ndims > 0 && mesg->u.chunk.ndims <= H5O_LAYOUT_NDIMS); - ret_value++; - - /* B-tree address */ - ret_value += H5F_SIZEOF_ADDR(f); /* Address of data */ - - /* Dimension sizes */ - ret_value += mesg->u.chunk.ndims * 4; - break; - - default: - HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, 0, "Invalid layout class") - } /* end switch */ - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_layout_meta_size() */ - - -/*------------------------------------------------------------------------- * Function: H5O_layout_size * * Purpose: Returns the size of the raw message in bytes. If it's @@ -666,9 +604,6 @@ H5O_layout_copy_file(H5F_t *file_src, void *mesg_src, H5F_t *file_dst, HGOTO_ERROR(H5E_IO, H5E_CANTINIT, NULL, "unable to copy chunked storage") layout_dst->u.compact.dirty = TRUE; - - /* Freed by copy routine */ - udata->src_dtype = NULL; } /* end if */ break; @@ -685,23 +620,18 @@ H5O_layout_copy_file(H5F_t *file_src, void *mesg_src, H5F_t *file_dst, /* create contig layout */ if(H5D_contig_copy(file_src, layout_src, file_dst, layout_dst, udata->src_dtype, cpy_info, dxpl_id) < 0) HGOTO_ERROR(H5E_IO, H5E_CANTINIT, NULL, "unable to copy contiguous storage") - - /* Freed by copy routine */ - udata->src_dtype = NULL; } /* if ( H5F_addr_defined(layout_src->u.contig.addr)) */ break; case H5D_CHUNKED: - if(H5F_addr_defined(layout_src->u.chunk.addr)) { - /* layout is not created in the destination file, undef btree address */ - layout_dst->u.chunk.addr = HADDR_UNDEF; + if(H5D_chunk_is_space_alloc(layout_src)) { + /* Layout is not created in the destination file, reset index address */ + if(H5D_chunk_idx_reset(layout_dst) < 0) + HGOTO_ERROR(H5E_IO, H5E_CANTINIT, NULL, "unable to reset chunked storage index in dest") - /* create chunked layout */ + /* Create chunked layout */ if(H5D_chunk_copy(file_src, layout_src, file_dst, layout_dst, udata->src_dtype, cpy_info, udata->src_pline, dxpl_id) < 0) HGOTO_ERROR(H5E_IO, H5E_CANTINIT, NULL, "unable to copy chunked storage") - - /* Freed by copy routine */ - udata->src_dtype = NULL; } /* if ( H5F_addr_defined(layout_srct->u.chunk.addr)) */ break; @@ -709,6 +639,9 @@ H5O_layout_copy_file(H5F_t *file_src, void *mesg_src, H5F_t *file_dst, HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "Invalid layout class") } /* end switch */ + /* Freed by copy routine */ + udata->src_dtype = NULL; + /* Set return value */ ret_value = layout_dst; @@ -742,7 +675,7 @@ H5O_layout_debug(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *_mesg, const H5O_layout_t *mesg = (const H5O_layout_t *) _mesg; unsigned u; - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_layout_debug); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_layout_debug) /* check args */ HDassert(f); @@ -753,37 +686,121 @@ H5O_layout_debug(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *_mesg, HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Version:", mesg->version); - if(mesg->type==H5D_CHUNKED) { - HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, - "Type:", "Chunked"); - HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, - "B-tree address:", mesg->u.chunk.addr); - HDfprintf(stream, "%*s%-*s %lu\n", indent, "", fwidth, - "Number of dimensions:", - (unsigned long) (mesg->u.chunk.ndims)); - /* Size */ - HDfprintf(stream, "%*s%-*s {", indent, "", fwidth, "Size:"); - for (u = 0; u < mesg->u.chunk.ndims; u++) { - HDfprintf(stream, "%s%lu", u ? ", " : "", - (unsigned long) (mesg->u.chunk.dim[u])); - } - HDfprintf(stream, "}\n"); - } /* end if */ - else if(mesg->type==H5D_CONTIGUOUS) { - HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, - "Type:", "Contiguous"); - HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, - "Data address:", mesg->u.contig.addr); - HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, - "Data Size:", mesg->u.contig.size); - } /* end if */ - else { - HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, - "Type:", "Compact"); - HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, - "Data Size:", mesg->u.compact.size); - } /* end else */ + switch(mesg->type) { + case H5D_CHUNKED: + HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, + "Type:", "Chunked"); + + /* Chunk # of dims & size */ + HDfprintf(stream, "%*s%-*s %lu\n", indent, "", fwidth, + "Number of dimensions:", + (unsigned long)(mesg->u.chunk.ndims)); + HDfprintf(stream, "%*s%-*s {", indent, "", fwidth, "Size:"); + for(u = 0; u < mesg->u.chunk.ndims; u++) + HDfprintf(stream, "%s%lu", u ? ", " : "", (unsigned long)(mesg->u.chunk.dim[u])); + HDfprintf(stream, "}\n"); + + /* Index information */ + switch(mesg->u.chunk.idx_type) { + case H5D_CHUNK_BTREE: + HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, + "Index Type:", "v1 B-tree"); + HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, + "B-tree address:", mesg->u.chunk.u.btree.addr); + break; + + default: + HDfprintf(stream, "%*s%-*s %s (%u)\n", indent, "", fwidth, + "Index Type:", "Unknown", (unsigned)mesg->u.chunk.idx_type); + break; + } /* end switch */ + break; - FUNC_LEAVE_NOAPI(SUCCEED); + case H5D_CONTIGUOUS: + HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, + "Type:", "Contiguous"); + HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, + "Data address:", mesg->u.contig.addr); + HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, + "Data Size:", mesg->u.contig.size); + break; + + case H5D_COMPACT: + HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, + "Type:", "Compact"); + HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, + "Data Size:", mesg->u.compact.size); + break; + + default: + HDfprintf(stream, "%*s%-*s %s (%u)\n", indent, "", fwidth, + "Type:", "Unknown", (unsigned)mesg->type); + break; + } /* end switch */ + + FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O_layout_debug() */ + +/*------------------------------------------------------------------------- + * Function: H5O_layout_meta_size + * + * Purpose: Returns the size of the raw message in bytes except raw data + * part for compact dataset. This function doesn't take into + * account message alignment. + * + * Return: Success: Message data size in bytes(except raw data + * for compact dataset) + * Failure: 0 + * + * Programmer: Raymond Lu + * August 14, 2002 + * + *------------------------------------------------------------------------- + */ +size_t +H5O_layout_meta_size(const H5F_t *f, const void *_mesg) +{ + const H5O_layout_t *mesg = (const H5O_layout_t *) _mesg; + size_t ret_value; + + FUNC_ENTER_NOAPI_NOINIT(H5O_layout_meta_size) + + /* check args */ + HDassert(f); + HDassert(mesg); + + ret_value = 1 + /* Version number */ + 1; /* layout class type */ + + switch(mesg->type) { + case H5D_COMPACT: + /* Size of raw data */ + ret_value += 2; + break; + + case H5D_CONTIGUOUS: + ret_value += H5F_SIZEOF_ADDR(f); /* Address of data */ + ret_value += H5F_SIZEOF_SIZE(f); /* Length of data */ + break; + + case H5D_CHUNKED: + /* Number of dimensions (1 byte) */ + HDassert(mesg->u.chunk.ndims > 0 && mesg->u.chunk.ndims <= H5O_LAYOUT_NDIMS); + ret_value++; + + /* Dimension sizes */ + ret_value += mesg->u.chunk.ndims * 4; + + /* B-tree address */ + ret_value += H5F_SIZEOF_ADDR(f); /* Address of data */ + break; + + default: + HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, 0, "Invalid layout class") + } /* end switch */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5O_layout_meta_size() */ + diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h index 3ef3fc3..cc88bdc 100644 --- a/src/H5Oprivate.h +++ b/src/H5Oprivate.h @@ -356,13 +356,20 @@ typedef struct H5O_layout_contig_t { hsize_t size; /* Size of data in bytes */ } H5O_layout_contig_t; -typedef struct H5O_layout_chunk_t { +typedef struct H5O_layout_chunk_btree_t { haddr_t addr; /* File address of B-tree */ + H5RC_t *shared; /* Ref-counted shared info for B-tree nodes */ +} H5O_layout_chunk_btree_t; + +typedef struct H5O_layout_chunk_t { + H5D_chunk_index_t idx_type; /* Type of chunk index */ unsigned ndims; /* Num dimensions in chunk */ uint32_t dim[H5O_LAYOUT_NDIMS]; /* Size of chunk in elements */ uint32_t size; /* Size of chunk in bytes */ - H5RC_t *btree_shared; /* Ref-counted info for B-tree nodes */ const struct H5D_chunk_ops_t *ops; /* Pointer to chunked layout operations */ + union { + H5O_layout_chunk_btree_t btree; /* Information for v1 B-tree index */ + } u; } H5O_layout_chunk_t; typedef struct H5O_layout_compact_t { diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c index d84997a..43696fc 100644 --- a/src/H5Pdcpl.c +++ b/src/H5Pdcpl.c @@ -50,7 +50,7 @@ /* Define default layout information */ #define H5D_DEF_LAYOUT_COMPACT_INIT {(hbool_t)FALSE, (size_t)0, NULL} #define H5D_DEF_LAYOUT_CONTIG_INIT {HADDR_UNDEF, (hsize_t)0} -#define H5D_DEF_LAYOUT_CHUNK_INIT {HADDR_UNDEF, (unsigned)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}, (uint32_t)0, NULL, NULL} +#define H5D_DEF_LAYOUT_CHUNK_INIT {H5D_CHUNK_BTREE, (unsigned)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}, (uint32_t)0, NULL, {{HADDR_UNDEF, NULL}}} #ifdef H5_HAVE_C99_DESIGNATED_INITIALIZER #define H5D_DEF_LAYOUT_COMPACT {H5D_COMPACT, H5O_LAYOUT_VERSION_3, NULL, { .compact = H5D_DEF_LAYOUT_COMPACT_INIT }} #define H5D_DEF_LAYOUT_CONTIG {H5D_CONTIGUOUS, H5O_LAYOUT_VERSION_3, NULL, { .contig = H5D_DEF_LAYOUT_CONTIG_INIT }} @@ -222,9 +222,6 @@ done: * Programmer: Raymond Lu * Tuesday, October 2, 2001 * - * Modifications: pvn, April 02, 2007 - * Reset external file list slots name_offset to a state when created - * *------------------------------------------------------------------------- */ /* ARGSUSED */ @@ -277,9 +274,15 @@ H5P_dcrt_copy(hid_t dst_plist_id, hid_t src_plist_id, void UNUSED *copy_data) break; case H5D_CHUNKED: - dst_layout.u.chunk.addr = HADDR_UNDEF; + /* Reset chunk size */ dst_layout.u.chunk.size = 0; - dst_layout.u.chunk.btree_shared = NULL; + + /* Reset index info, if the chunk ops are set */ + if(dst_layout.u.chunk.ops) + if(H5D_chunk_idx_reset(&dst_layout) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "unable to reset chunked storage index in dest") + + /* Reset chunk index ops */ dst_layout.u.chunk.ops = NULL; break; diff --git a/tools/h5stat/testfiles/h5stat_filters-d.ddl b/tools/h5stat/testfiles/h5stat_filters-d.ddl index e83c6c4..42d0de3 100644 --- a/tools/h5stat/testfiles/h5stat_filters-d.ddl +++ b/tools/h5stat/testfiles/h5stat_filters-d.ddl @@ -15,7 +15,7 @@ Dataset dimension information: # of datasets of size 100 - 999: 1 Total # of datasets: 1 Dataset storage information: - Total raw data size: 8659 + Total raw data size: 9059 Dataset layout information: Dataset layout counts[COMPACT]: 1 Dataset layout counts[CONTIG]: 2 diff --git a/tools/h5stat/testfiles/h5stat_filters-dT.ddl b/tools/h5stat/testfiles/h5stat_filters-dT.ddl index 62735f0..2edcf7e 100644 --- a/tools/h5stat/testfiles/h5stat_filters-dT.ddl +++ b/tools/h5stat/testfiles/h5stat_filters-dT.ddl @@ -15,7 +15,7 @@ Dataset dimension information: # of datasets of size 100 - 999: 1 Total # of datasets: 1 Dataset storage information: - Total raw data size: 8659 + Total raw data size: 9059 Dataset layout information: Dataset layout counts[COMPACT]: 1 Dataset layout counts[CONTIG]: 2 diff --git a/tools/h5stat/testfiles/h5stat_filters.ddl b/tools/h5stat/testfiles/h5stat_filters.ddl index df2e304..8afdf82 100644 --- a/tools/h5stat/testfiles/h5stat_filters.ddl +++ b/tools/h5stat/testfiles/h5stat_filters.ddl @@ -45,7 +45,7 @@ Dataset dimension information: # of datasets of size 100 - 999: 1 Total # of datasets: 1 Dataset storage information: - Total raw data size: 8659 + Total raw data size: 9059 Dataset layout information: Dataset layout counts[COMPACT]: 1 Dataset layout counts[CONTIG]: 2 |