diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2009-05-27 17:00:29 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2009-05-27 17:00:29 (GMT) |
commit | 29d45ed0d13493d07d7d744950e1fe1b6d5bbff1 (patch) | |
tree | ec205638688c89f80b9d1018611cdbe503131e8d /src/H5Dearray.c | |
parent | e5d055581558413f5257edf27fbfab5650c02896 (diff) | |
download | hdf5-29d45ed0d13493d07d7d744950e1fe1b6d5bbff1.zip hdf5-29d45ed0d13493d07d7d744950e1fe1b6d5bbff1.tar.gz hdf5-29d45ed0d13493d07d7d744950e1fe1b6d5bbff1.tar.bz2 |
[svn-r16985] Description:
Interim checkin of work toward closing race condition window which can
cause errors when reading a file that is used for SWMR-write access.
This change introduces a chunk proxy in the metadata cache, which
participates in the metadata cache's flush dependencies while representing a
raw data chunk in a dataset's chunk cache.
Also, the extensible array's SWMR behavior is only invoked when the
file is opened for SWMR-write access, allowing more flexibility in flushing
extensible array data structure pieces when SWMR-write is not enabled.
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
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 | 109 |
1 files changed, 109 insertions, 0 deletions
diff --git a/src/H5Dearray.c b/src/H5Dearray.c index 7ae62e4..9862a15 100644 --- a/src/H5Dearray.c +++ b/src/H5Dearray.c @@ -132,6 +132,10 @@ static herr_t H5D_earray_idx_copy_shutdown(H5O_layout_t *layout_src, static herr_t H5D_earray_idx_size(const H5D_chk_idx_info_t *idx_info, hsize_t *size); static herr_t H5D_earray_idx_reset(H5O_layout_t *layout, hbool_t reset_addr); +static herr_t H5D_earray_idx_depend(const H5D_chk_idx_info_t *idx_info, + H5D_chunk_common_ud_t *udata, H5AC_info_t *child_entry); +static herr_t H5D_earray_idx_undepend(const H5D_chk_idx_info_t *idx_info, + H5D_chunk_common_ud_t *udata, H5AC_info_t *child_entry); static herr_t H5D_earray_idx_dump(const H5D_chk_idx_info_t *idx_info, FILE *stream); static herr_t H5D_earray_idx_dest(const H5D_chk_idx_info_t *idx_info); @@ -143,6 +147,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_create, H5D_earray_idx_is_space_alloc, @@ -155,6 +160,8 @@ const H5D_chunk_ops_t H5D_COPS_EARRAY[1] = {{ H5D_earray_idx_copy_shutdown, H5D_earray_idx_size, H5D_earray_idx_reset, + H5D_earray_idx_depend, + H5D_earray_idx_undepend, H5D_earray_idx_dump, H5D_earray_idx_dest }}; @@ -1432,6 +1439,108 @@ H5D_earray_idx_reset(H5O_layout_t *layout, hbool_t reset_addr) /*------------------------------------------------------------------------- + * Function: H5D_earray_idx_depend + * + * Purpose: Create a dependency between a chunk [proxy] and the index + * metadata that contains the record for the chunk. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * Thursday, May 21, 2009 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D_earray_idx_depend(const H5D_chk_idx_info_t *idx_info, + H5D_chunk_common_ud_t *udata, H5AC_info_t *child_entry) +{ + H5EA_t *ea; /* Pointer to extensible array structure */ + hsize_t idx; /* Array index of chunk */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT(H5D_earray_idx_depend) + + HDassert(idx_info); + HDassert(udata); + HDassert(child_entry); + + /* Check if the extensible array is open yet */ + if(NULL == idx_info->layout->u.chunk.u.earray.ea) { + /* Open the extensible array in file */ + if(H5D_earray_idx_open(idx_info) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open extensible array") + } /* end if */ + + /* Set convenience pointer to extensible array structure */ + ea = idx_info->layout->u.chunk.u.earray.ea; + + /* Compute array index for chunk offset */ + idx = udata->offset[0] / idx_info->layout->u.chunk.dim[0]; + + /* Create flush dependency between the child_entry and the piece of metadata + * in the extensible array that contains the entry for this chunk. + */ + if(H5EA_depend(ea, idx_info->dxpl_id, idx, child_entry) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTDEPEND, FAIL, "unable to create flush dependency on extensible array metadata") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5D_earray_idx_depend() */ + + +/*------------------------------------------------------------------------- + * Function: H5D_earray_idx_undepend + * + * Purpose: Remove a dependency between a chunk [proxy] and the index + * metadata that contains the record for the chunk. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * Thursday, May 21, 2009 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D_earray_idx_undepend(const H5D_chk_idx_info_t *idx_info, + H5D_chunk_common_ud_t *udata, H5AC_info_t *child_entry) +{ + H5EA_t *ea; /* Pointer to extensible array structure */ + hsize_t idx; /* Array index of chunk */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT(H5D_earray_idx_undepend) + + HDassert(idx_info); + HDassert(udata); + HDassert(child_entry); + + /* Check if the extensible array is open yet */ + if(NULL == idx_info->layout->u.chunk.u.earray.ea) { + /* Open the extensible array in file */ + if(H5D_earray_idx_open(idx_info) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open extensible array") + } /* end if */ + + /* Set convenience pointer to extensible array structure */ + ea = idx_info->layout->u.chunk.u.earray.ea; + + /* Compute array index for chunk offset */ + idx = udata->offset[0] / idx_info->layout->u.chunk.dim[0]; + + /* Remove flush dependency between the child_entry and the piece of metadata + * in the extensible array that contains the entry for this chunk. + */ + if(H5EA_undepend(ea, idx_info->dxpl_id, idx, child_entry) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTUNDEPEND, FAIL, "unable to remove flush dependency on extensible array metadata") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5D_earray_idx_undepend() */ + + +/*------------------------------------------------------------------------- * Function: H5D_earray_idx_dump * * Purpose: Dump indexing information to a stream. |