diff options
author | Robb Matzke <matzke@llnl.gov> | 1999-08-18 18:28:06 (GMT) |
---|---|---|
committer | Robb Matzke <matzke@llnl.gov> | 1999-08-18 18:28:06 (GMT) |
commit | 42d5453fe11634264ea3f330d1c365ef36bb56c7 (patch) | |
tree | 8ff3f982993d227818ddc0de70ad2709514f1923 /src | |
parent | 0b7babc994e59b88a10fb55345159ea6951e72b1 (diff) | |
download | hdf5-42d5453fe11634264ea3f330d1c365ef36bb56c7.zip hdf5-42d5453fe11634264ea3f330d1c365ef36bb56c7.tar.gz hdf5-42d5453fe11634264ea3f330d1c365ef36bb56c7.tar.bz2 |
[svn-r1574] Changes since 19990817
----------------------
./src/H5D.c
./src/H5F.c
./src/H5FDmpio.c
./src/H5Fistore.c
./src/H5Fprivate.h
./src/H5Smpio.c
The `driver_id' for a file was accidently put in two
structs. I removed it from the H5F_file_t struct since it's
really an attribute of the VFL stuff.
More careful incrementing/decrementing the driver ID to fix a
memory leak.
./src/H5P.c
Rewrote H5Pcreate() in terms of H5P_copy() of a default
property list. This fixes some referencing counting bugs.
Diffstat (limited to 'src')
-rw-r--r-- | src/H5D.c | 25 | ||||
-rw-r--r-- | src/H5Distore.c | 4 | ||||
-rw-r--r-- | src/H5F.c | 19 | ||||
-rw-r--r-- | src/H5FDmpio.h | 6 | ||||
-rw-r--r-- | src/H5Fistore.c | 4 | ||||
-rw-r--r-- | src/H5Fprivate.h | 1 | ||||
-rw-r--r-- | src/H5P.c | 90 | ||||
-rw-r--r-- | src/H5Smpio.c | 2 |
8 files changed, 69 insertions, 82 deletions
@@ -900,7 +900,7 @@ H5D_create(H5G_entry_t *loc, const char *name, const H5T_t *type, #ifdef HAVE_PARALLEL /* If MPIO is used, no filter support yet. */ - if (H5FD_MPIO==f->shared->driver_id && + if (H5FD_MPIO==f->shared->lf->driver_id && create_parms->pline.nfilters>0) { HGOTO_ERROR (H5E_DATASET, H5E_UNSUPPORTED, NULL, "Parallel IO does not support filters yet"); @@ -1277,7 +1277,7 @@ H5D_open_oid(H5G_entry_t *ent) #ifdef HAVE_PARALLEL /* If MPIO is used, no filter support yet. */ - if (H5FD_MPIO==dataset->ent.file->shared->driver_id && + if (H5FD_MPIO==dataset->ent.file->shared->lf->driver_id && dataset->create_parms->pline.nfilters>0){ HGOTO_ERROR (H5E_DATASET, H5E_UNSUPPORTED, NULL, "Parallel IO does not support filters yet"); @@ -1511,7 +1511,7 @@ H5D_read(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, { /* Collective access is not permissible with the MPIO driver */ H5FD_mpio_dxpl_t *dx; - if (H5FD_MPIO==dataset->ent.file->shared->driver_id && + if (H5FD_MPIO==dataset->ent.file->shared->lf->driver_id && H5FD_MPIO==xfer_parms->driver_id && (dx=xfer_parms->driver_info) && H5FD_MPIO_COLLECTIVE==dx->xfer_mode) { @@ -1557,7 +1557,7 @@ H5D_read(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, * (the latter in case the arguments to sconv_funcs * turn out to be inappropriate for MPI-IO). */ if (H5_mpi_opt_types_g && - H5FD_MPIO==dataset->ent.file->shared->driver_id) { + H5FD_MPIO==dataset->ent.file->shared->lf->driver_id) { sconv->read = H5S_mpio_spaces_read; } #endif /*HAVE_PARALLEL*/ @@ -1868,7 +1868,7 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, /* If MPIO is used, no VL datatype support yet. */ /* This is because they use the global heap in the file and we don't */ /* support parallel access of that yet */ - if (H5FD_MPIO==dataset->ent.file->shared->driver_id && + if (H5FD_MPIO==dataset->ent.file->shared->lf->driver_id && H5T_get_class(mem_type)==H5T_VLEN) { HGOTO_ERROR (H5E_DATASET, H5E_UNSUPPORTED, FAIL, "Parallel IO does not support writing VL datatypes yet"); @@ -1878,7 +1878,7 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, /* If MPIO is used, no dataset region reference support yet. */ /* This is because they use the global heap in the file and we don't */ /* support parallel access of that yet */ - if (H5FD_MPIO==dataset->ent.file->shared->driver_id && + if (H5FD_MPIO==dataset->ent.file->shared->lf->driver_id && H5T_get_class(mem_type)==H5T_REFERENCE && H5T_get_ref_type(mem_type)==H5R_DATASET_REGION) { HGOTO_ERROR (H5E_DATASET, H5E_UNSUPPORTED, FAIL, @@ -1918,7 +1918,7 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, { /* Collective access is not permissible with the MPIO driver */ H5FD_mpio_dxpl_t *dx; - if (H5FD_MPIO==dataset->ent.file->shared->driver_id && + if (H5FD_MPIO==dataset->ent.file->shared->lf->driver_id && H5FD_MPIO==xfer_parms->driver_id && (dx=xfer_parms->driver_info) && H5FD_MPIO_COLLECTIVE==dx->xfer_mode) { @@ -1971,7 +1971,7 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, * (the latter in case the arguments to sconv_funcs * turn out to be inappropriate for MPI-IO). */ if (H5_mpi_opt_types_g && - H5FD_MPIO==dataset->ent.file->shared->driver_id) { + H5FD_MPIO==dataset->ent.file->shared->lf->driver_id) { sconv->write = H5S_mpio_spaces_write; } #endif /*HAVE_PARALLEL*/ @@ -2407,8 +2407,6 @@ H5D_init_storage(H5D_t *dset, const H5S_t *space) haddr_t addr; herr_t ret_value = FAIL; void *buf = NULL; - intn ndims; - hsize_t dim[H5O_LAYOUT_NDIMS]; FUNC_ENTER(H5D_init_storage, FAIL); assert(dset); @@ -2473,12 +2471,16 @@ H5D_init_storage(H5D_t *dset, const H5S_t *space) break; case H5D_CHUNKED: +#ifdef HAVE_PARALLEL /* * If the dataset is accessed via parallel I/O, allocate file space * for all chunks now and initialize each chunk with the fill value. */ - if (H5FD_MPIO==dset->ent.file->shared->driver_id) { + if (H5FD_MPIO==dset->ent.file->shared->lf->driver_id) { /* We only handle simple data spaces so far */ + intn ndims; + hsize_t dim[H5O_LAYOUT_NDIMS]; + if ((ndims=H5S_get_simple_extent_dims(space, dim, NULL))<0) { HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to get simple data space info"); @@ -2494,6 +2496,7 @@ H5D_init_storage(H5D_t *dset, const H5S_t *space) "unable to allocate all chunks of dataset"); } } +#endif /*HAVE_PARALLEL*/ break; } ret_value = SUCCEED; diff --git a/src/H5Distore.c b/src/H5Distore.c index acbc4a2..28e8337 100644 --- a/src/H5Distore.c +++ b/src/H5Distore.c @@ -1675,7 +1675,7 @@ H5F_istore_read(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, * MPI processes could be writing to other elements in the same chunk. * Do a direct write-through of only the elements requested. */ - if (H5FD_MPIO==f->shared->driver_id) { + if (H5FD_MPIO==f->shared->lf->driver_id) { H5F_istore_ud1_t udata; H5O_layout_t l; /* temporary layout */ @@ -1849,7 +1849,7 @@ H5F_istore_write(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, * MPI processes could be writing to other elements in the same chunk. * Do a direct write-through of only the elements requested. */ - if (H5FD_MPIO==f->shared->driver_id) { + if (H5FD_MPIO==f->shared->lf->driver_id) { H5F_istore_ud1_t udata; H5O_layout_t l; /* temporary layout */ if (H5F_istore_get_addr(f, layout, chunk_offset, &udata)<0){ @@ -21,9 +21,11 @@ static char RcsId[] = "@(#)$Revision$"; /* $Id$ */ /* Predefined file drivers */ -#include <H5FDsec2.h> /*Posix unbuffered I/O */ +#include <H5FDcore.h> /*temporary in-memory files */ #include <H5FDfamily.h> /*family of files */ #include <H5FDmpio.h> /*MPI-2 I/O */ +#include <H5FDmulti.h> /*multiple files partitioned by mem usage */ +#include <H5FDsec2.h> /*Posix unbuffered I/O */ /* Packages needed by this file... */ #include <H5private.h> /*library functions */ @@ -200,8 +202,11 @@ H5F_init_interface(void) H5E_BEGIN_TRY { if ((status=H5FD_SEC2)<0) goto end_registration; if ((status=H5FD_FAMILY)<0) goto end_registration; - /*...others just like above...*/ - + if ((status=H5FD_CORE)<0) goto end_registration; + if ((status=H5FD_MULTI)<0) goto end_registration; +#ifdef HAVE_PARALLEL + if ((status=H5FD_MPIO)<0) goto end_registration; +#endif end_registration: } H5E_END_TRY; if (status<0) { @@ -473,7 +478,7 @@ H5Fget_access_plist(hid_t file_id) _fapl.threshold = f->shared->threshold; _fapl.alignment = f->shared->alignment; _fapl.gc_ref = f->shared->gc_ref; - _fapl.driver_id = f->shared->driver_id; + _fapl.driver_id = f->shared->lf->driver_id; _fapl.driver_info = NULL; /*just for now */ /* Copy properties */ @@ -711,7 +716,6 @@ H5F_new(H5F_file_t *shared, hid_t fcpl_id, hid_t fapl_id) f->shared->threshold = fapl->threshold; f->shared->alignment = fapl->alignment; f->shared->gc_ref = fapl->gc_ref; - f->shared->driver_id = H5I_inc_ref(fapl->driver_id); #ifdef HAVE_PARALLEL /* @@ -719,7 +723,7 @@ H5F_new(H5F_file_t *shared, hid_t fcpl_id, hid_t fapl_id) * does not permit caching. (maybe able to relax it for * read only open.) */ - if (H5FD_MPIO==f->shared->driver_id){ + if (H5FD_MPIO==f->shared->lf->driver_id){ f->shared->rdcc_nbytes = 0; f->shared->mdc_nelmts = 0; } @@ -808,9 +812,6 @@ H5F_dest(H5F_t *f) /* Destroy file creation properties */ H5P_close(H5P_FILE_CREATE, f->shared->fcpl); - /* Destroy file access properties (most don't need destruction) */ - H5I_dec_ref(f->shared->driver_id); - /* Destroy shared file struct */ if (H5FD_close(f->shared->lf)<0) { HERROR(H5E_FILE, H5E_CANTINIT, "problems closing file"); diff --git a/src/H5FDmpio.h b/src/H5FDmpio.h index fa27918..e7332ac 100644 --- a/src/H5FDmpio.h +++ b/src/H5FDmpio.h @@ -25,7 +25,11 @@ typedef enum H5FD_mpio_xfer_t { H5FD_MPIO_COLLECTIVE } H5FD_mpio_xfer_t; -/* MPIO-specific data transfer properties */ +/* + * MPIO-specific data transfer properties. This struct is here only because + * we need it in special case code throughout the library. Applications + * please use H5Pset_dxpl_mpio() instead. + */ typedef struct H5FD_mpio_dxpl_t { H5FD_mpio_xfer_t xfer_mode; /*collective or independent I/O */ } H5FD_mpio_dxpl_t; diff --git a/src/H5Fistore.c b/src/H5Fistore.c index acbc4a2..28e8337 100644 --- a/src/H5Fistore.c +++ b/src/H5Fistore.c @@ -1675,7 +1675,7 @@ H5F_istore_read(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, * MPI processes could be writing to other elements in the same chunk. * Do a direct write-through of only the elements requested. */ - if (H5FD_MPIO==f->shared->driver_id) { + if (H5FD_MPIO==f->shared->lf->driver_id) { H5F_istore_ud1_t udata; H5O_layout_t l; /* temporary layout */ @@ -1849,7 +1849,7 @@ H5F_istore_write(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, * MPI processes could be writing to other elements in the same chunk. * Do a direct write-through of only the elements requested. */ - if (H5FD_MPIO==f->shared->driver_id) { + if (H5FD_MPIO==f->shared->lf->driver_id) { H5F_istore_ud1_t udata; H5O_layout_t l; /* temporary layout */ if (H5F_istore_get_addr(f, layout, chunk_offset, &udata)<0){ diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index d26f406..0c2360f 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -315,7 +315,6 @@ typedef struct H5F_file_t { hsize_t threshold; /* Threshold for alignment */ hsize_t alignment; /* Alignment */ uintn gc_ref; /* Garbage-collect references? */ - hid_t driver_id; /* File driver ID */ struct H5G_t *root_grp; /* Open root group */ intn ncwfs; /* Num entries on cwfs list */ struct H5HG_heap_t **cwfs; /* Global heap cache */ @@ -128,33 +128,30 @@ H5P_term_interface(void) return n; } -/*-------------------------------------------------------------------------- - NAME - H5Pcreate - PURPOSE - Returns a copy of the default property list for some class of property - * lists. - USAGE - herr_t H5Pcreate (type) - H5P_class_t type; IN: Property list class whose default is - * desired. - RETURNS - Property list ID or Negative - - ERRORS - ARGS BADVALUE Unknown property list class. - ATOM CANTINIT Can't register property list. - INTERNAL UNSUPPORTED Not implemented yet. - - DESCRIPTION - Returns a copy of the default property list for some class of property - * lists. ---------------------------------------------------------------------------*/ + +/*------------------------------------------------------------------------- + * Function: H5Pcreate + * + * Purpose: Creates a new property list by copying a default property + * list. + * + * Return: Success: A new copy of a default property list. + * + * Failure: NULL + * + * Programmer: Unknown + * + * Modifications: + * Robb Matzke, 1999-08-18 + * Rewritten in terms of H5P_copy() to fix memory leaks. + *------------------------------------------------------------------------- + */ hid_t H5Pcreate(H5P_class_t type) { - hid_t ret_value = FAIL; - void *plist = NULL; + hid_t ret_value = FAIL; + const void *src = NULL; + void *new_plist = NULL; FUNC_ENTER(H5Pcreate, FAIL); H5TRACE1("i","p",type); @@ -162,57 +159,40 @@ H5Pcreate(H5P_class_t type) /* Allocate a new property list and initialize it with default values */ switch (type) { case H5P_FILE_CREATE: - if (NULL==(plist = H5MM_malloc(sizeof(H5F_create_t)))) { - HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, - "memory allocation failed"); - } - HDmemcpy(plist, &H5F_create_dflt, sizeof(H5F_create_t)); + src = &H5F_create_dflt; break; - case H5P_FILE_ACCESS: - if (NULL==(plist = H5MM_malloc(sizeof(H5F_access_t)))) { - HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, - "memory allocation failed"); - } - HDmemcpy(plist, &H5F_access_dflt, sizeof(H5F_access_t)); + src = &H5F_access_dflt; break; - case H5P_DATASET_CREATE: - if (NULL==(plist = H5MM_malloc(sizeof(H5D_create_t)))) { - HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, - "memory allocation failed"); - } - HDmemcpy(plist, &H5D_create_dflt, sizeof(H5D_create_t)); + src = &H5D_create_dflt; break; - case H5P_DATA_XFER: - if (NULL==(plist = H5MM_malloc(sizeof(H5F_xfer_t)))) { - HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, - "memory allocation failed"); - } - HDmemcpy(plist, &H5F_xfer_dflt, sizeof(H5F_xfer_t)); + src = &H5F_xfer_dflt; break; - case H5P_MOUNT: - if (NULL==(plist = H5MM_malloc(sizeof(H5F_mprop_t)))) { - HRETURN_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, - "memory allocation failed"); - } - HDmemcpy(plist, &H5F_mount_dflt, sizeof(H5F_mprop_t)); + src = &H5F_mount_dflt; break; - default: HRETURN_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unknown property list class"); } + /* Copy the property list */ + if (NULL==(new_plist=H5P_copy(type, src))) { + HRETURN_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, + "unable to copy default property list"); + } + /* Atomize the new property list */ - if ((ret_value = H5P_create(type, plist)) < 0) { + if ((ret_value = H5P_create(type, new_plist)) < 0) { HRETURN_ERROR(H5E_ATOM, H5E_CANTINIT, FAIL, "unable to register property list"); } + FUNC_LEAVE(ret_value); } + /*------------------------------------------------------------------------- * Function: H5P_create diff --git a/src/H5Smpio.c b/src/H5Smpio.c index d75c5cc..4daa457 100644 --- a/src/H5Smpio.c +++ b/src/H5Smpio.c @@ -539,7 +539,7 @@ H5S_mpio_spaces_xfer(H5F_t *f, const struct H5O_layout_t *layout, assert (file_space); assert (mem_space); assert (buf); - assert (H5FD_MPIO==f->shared->driver_id); + assert (H5FD_MPIO==f->shared->lf->driver_id); /* INCOMPLETE!!! rky 980816 */ /* Currently can only handle H5D_CONTIGUOUS layout */ |