summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlbert Cheng <acheng@hdfgroup.org>2000-11-26 06:56:29 (GMT)
committerAlbert Cheng <acheng@hdfgroup.org>2000-11-26 06:56:29 (GMT)
commitf0b45019bb22d6a5240b12dfdb77871c83377454 (patch)
treec6660ba43e90083dbe40936ceb4da5417f063351 /src
parent0cf81a0aa8fd8dc7de56d9cfeda1a587bcdf6660 (diff)
downloadhdf5-f0b45019bb22d6a5240b12dfdb77871c83377454.zip
hdf5-f0b45019bb22d6a5240b12dfdb77871c83377454.tar.gz
hdf5-f0b45019bb22d6a5240b12dfdb77871c83377454.tar.bz2
[svn-r3002]
Purpose: Bug fix Description: H5S_mpio_spaces_xfer() did not do clean up all the times especially the MPI_type freeing. Solution: Include the MPI_type freeing as part of cleanup code. Replaced most HRETURN_ERROR(...) with HGOTO_ERROR so that cleanup code will be executed. Platforms tested: IRIX64-64.
Diffstat (limited to 'src')
-rw-r--r--src/H5Smpio.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/src/H5Smpio.c b/src/H5Smpio.c
index 12daaf5..db6f762 100644
--- a/src/H5Smpio.c
+++ b/src/H5Smpio.c
@@ -531,13 +531,18 @@ H5S_mpio_space_type( const H5S_t *space, const size_t elmt_size,
* directly between app buffer and file.
*
* Return: non-negative on success, negative on failure.
+ * If MPI-IO is indeed used, must_convert is set to 0;
+ * otherwise it is set to 1 with return code succeed (so that the
+ * calling routine may try other means.)
*
* Programmer: rky 980813
*
* Modifications:
- *
- * rky 980918
- * Added must_convert parameter to let caller know we can't optimize the xfer.
+ * rky 980918
+ * Added must_convert parameter to let caller know we can't optimize
+ * the xfer.
+ * Albert Cheng, 001123
+ * Include the MPI_type freeing as part of cleanup code.
*
*-------------------------------------------------------------------------
*/
@@ -556,7 +561,8 @@ H5S_mpio_spaces_xfer(H5F_t *f, const struct H5O_layout_t *layout,
hsize_t mpi_count;
hsize_t mpi_buf_count, mpi_unused_count;
MPI_Datatype mpi_buf_type, mpi_file_type;
- hbool_t mbt_is_derived, mft_is_derived;
+ hbool_t mbt_is_derived=0,
+ mft_is_derived=0;
FUNC_ENTER (H5S_mpio_spaces_xfer, FAIL);
@@ -579,8 +585,9 @@ H5S_mpio_spaces_xfer(H5F_t *f, const struct H5O_layout_t *layout,
}
#endif
*must_convert = 1; /* can't do optimized xfer; do the old way */
- goto done;
+ HGOTO_DONE(SUCCEED);
}
+
/* create the MPI buffer type */
err = H5S_mpio_space_type( mem_space, elmt_size,
@@ -589,7 +596,7 @@ H5S_mpio_spaces_xfer(H5F_t *f, const struct H5O_layout_t *layout,
&mpi_buf_count,
&mbt_is_derived );
if (MPI_SUCCESS != err)
- HRETURN_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL,"couldn't create MPI buf type");
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL,"couldn't create MPI buf type");
/* create the MPI file type */
err = H5S_mpio_space_type( file_space, elmt_size,
@@ -598,7 +605,7 @@ H5S_mpio_spaces_xfer(H5F_t *f, const struct H5O_layout_t *layout,
&mpi_unused_count,
&mft_is_derived );
if (MPI_SUCCESS != err)
- HRETURN_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL,"couldn't create MPI file type");
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL,"couldn't create MPI file type");
/* calculate the absolute base addr (i.e., the file view disp) */
disp = f->shared->base_addr + layout->addr;
@@ -619,7 +626,7 @@ H5S_mpio_spaces_xfer(H5F_t *f, const struct H5O_layout_t *layout,
/* transfer the data */
mpi_count = (size_t)mpi_buf_count;
if (mpi_count != mpi_buf_count) {
- HRETURN_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL,
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL,
"transfer size overflows size_t");
}
if (do_write) {
@@ -634,6 +641,7 @@ H5S_mpio_spaces_xfer(H5F_t *f, const struct H5O_layout_t *layout,
}
}
+done:
/* free the MPI buf and file types */
if (mbt_is_derived) {
err = MPI_Type_free( &mpi_buf_type );
@@ -650,7 +658,6 @@ H5S_mpio_spaces_xfer(H5F_t *f, const struct H5O_layout_t *layout,
}
}
- done:
FUNC_LEAVE (ret_value);
}