diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2009-05-27 23:21:24 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2009-05-27 23:21:24 (GMT) |
commit | bae373c32236ad99425154f5fcec4cb185e583d0 (patch) | |
tree | 9ba2bd0e8e3157eafc9c5ff84d1cb45762639672 /src/H5Dearray.c | |
parent | 29d45ed0d13493d07d7d744950e1fe1b6d5bbff1 (diff) | |
download | hdf5-bae373c32236ad99425154f5fcec4cb185e583d0.zip hdf5-bae373c32236ad99425154f5fcec4cb185e583d0.tar.gz hdf5-bae373c32236ad99425154f5fcec4cb185e583d0.tar.bz2 |
[svn-r16988] Description:
Refactor layout initialization so that chunk index information can be
set for extensible array indices.
Tested on:
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (jam) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/Intel compilers w/default API=1.6.x,
w/C++ & FORTRAN, in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in debug mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
Mac OS X/32 10.5.6 (amazon) in debug mode
Mac OS X/32 10.5.6 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
Diffstat (limited to 'src/H5Dearray.c')
-rw-r--r-- | src/H5Dearray.c | 54 |
1 files changed, 46 insertions, 8 deletions
diff --git a/src/H5Dearray.c b/src/H5Dearray.c index 9862a15..66de57d 100644 --- a/src/H5Dearray.c +++ b/src/H5Dearray.c @@ -114,6 +114,8 @@ static herr_t H5D_earray_filt_debug(FILE *stream, int indent, int fwidth, hsize_t idx, const void *elmt); /* Chunked layout indexing callbacks */ +static herr_t H5D_earray_idx_init(const H5D_chk_idx_info_t *idx_info, + haddr_t dset_ohdr_addr); static herr_t H5D_earray_idx_create(const H5D_chk_idx_info_t *idx_info); static hbool_t H5D_earray_idx_is_space_alloc(const H5O_layout_t *layout); static herr_t H5D_earray_idx_insert(const H5D_chk_idx_info_t *idx_info, @@ -148,7 +150,7 @@ static herr_t H5D_earray_idx_dest(const H5D_chk_idx_info_t *idx_info); /* Extensible array indexed chunk I/O ops */ const H5D_chunk_ops_t H5D_COPS_EARRAY[1] = {{ TRUE, /* Extensible array indices support SWMR access */ - NULL, + H5D_earray_idx_init, H5D_earray_idx_create, H5D_earray_idx_is_space_alloc, H5D_earray_idx_insert, @@ -598,8 +600,12 @@ H5D_earray_filt_debug(FILE *stream, int indent, int fwidth, hsize_t idx, /*------------------------------------------------------------------------- * Function: H5D_earray_idx_open * - * Purpose: Opens an existing extensible array and initializes - * the layout struct with information about the storage. + * Purpose: Opens an existing extensible array. + * + * Note: This information is passively initialized from each index + * operation callback because those abstract chunk index operations + * are designed to work with the v1 B-tree chunk indices also, + * which don't require an 'open' for the data structure. * * Return: Success: non-negative * Failure: negative @@ -642,6 +648,37 @@ done: /*------------------------------------------------------------------------- + * Function: H5D_earray_idx_init + * + * Purpose: Initialize the indexing information for a dataset. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * Wednesday, May 27, 2009 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D_earray_idx_init(const H5D_chk_idx_info_t *idx_info, haddr_t dset_ohdr_addr) +{ + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_earray_idx_init) + + /* Check args */ + HDassert(idx_info); + HDassert(idx_info->f); + HDassert(idx_info->pline); + HDassert(idx_info->layout); + HDassert(H5F_addr_defined(dset_ohdr_addr)); + + /* Store the dataset's object header address for later */ + idx_info->layout->u.chunk.u.earray.dset_ohdr_addr = dset_ohdr_addr; + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5D_earray_idx_init() */ + + +/*------------------------------------------------------------------------- * Function: H5D_earray_idx_create * * Purpose: Creates a new indexed-storage extensible array and initializes @@ -1277,7 +1314,6 @@ static herr_t H5D_earray_idx_copy_setup(const H5D_chk_idx_info_t *idx_info_src, const H5D_chk_idx_info_t *idx_info_dst) { - H5EA_t *ea_src; /* Pointer to extensible array structure */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5D_earray_idx_copy_setup) @@ -1299,9 +1335,6 @@ H5D_earray_idx_copy_setup(const H5D_chk_idx_info_t *idx_info_src, HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open extensible array") } /* end if */ - /* Set convenience pointer to extensible array structure */ - ea_src = idx_info_src->layout->u.chunk.u.earray.ea; - /* Create the extensible array that describes chunked storage in the dest. file */ if(H5D_earray_idx_create(idx_info_dst) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize chunked storage") @@ -1430,8 +1463,10 @@ H5D_earray_idx_reset(H5O_layout_t *layout, hbool_t reset_addr) HDassert(layout); /* Reset index info */ - if(reset_addr) + if(reset_addr) { layout->u.chunk.u.earray.addr = HADDR_UNDEF; + layout->u.chunk.u.earray.dset_ohdr_addr = HADDR_UNDEF; + } /* end if */ layout->u.chunk.u.earray.ea = NULL; FUNC_LEAVE_NOAPI(SUCCEED) @@ -1593,6 +1628,9 @@ H5D_earray_idx_dest(const H5D_chk_idx_info_t *idx_info) /* Check if the extensible array is open */ if(idx_info->layout->u.chunk.u.earray.ea) { + /* Sanity check */ + HDassert(H5F_addr_defined(idx_info->layout->u.chunk.u.earray.dset_ohdr_addr)); + if(H5EA_close(idx_info->layout->u.chunk.u.earray.ea, idx_info->dxpl_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to close extensible array") idx_info->layout->u.chunk.u.earray.ea = NULL; |