diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2004-04-10 16:04:53 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2004-04-10 16:04:53 (GMT) |
commit | 4f7308af91e3364e6ca81b242cb5717aceb4a37f (patch) | |
tree | 09e137c85965259b13a37f16646baaf850502b45 /src/H5Dio.c | |
parent | eb7a675f0a1bb565bdeb4c97697c9821c5ce72cc (diff) | |
download | hdf5-4f7308af91e3364e6ca81b242cb5717aceb4a37f.zip hdf5-4f7308af91e3364e6ca81b242cb5717aceb4a37f.tar.gz hdf5-4f7308af91e3364e6ca81b242cb5717aceb4a37f.tar.bz2 |
[svn-r8337] Purpose:
Code optimization
Description:
Avoid another extraneous dataspace copy.
Platforms tested:
Solaris 2.7 (arabica)
FreeBSD 4.9 (sleipnir) w/parallel
too minor to require h5committest
Diffstat (limited to 'src/H5Dio.c')
-rw-r--r-- | src/H5Dio.c | 33 |
1 files changed, 15 insertions, 18 deletions
diff --git a/src/H5Dio.c b/src/H5Dio.c index 207efbf..41b2e2e 100644 --- a/src/H5Dio.c +++ b/src/H5Dio.c @@ -51,8 +51,8 @@ typedef struct H5D_chunk_info_t { typedef struct fm_map { H5TB_TREE *fsel; /* TBBT containing file dataspaces for all chunks */ hsize_t last_index; /* Index of last chunk operated on */ - H5S_t *file_space; /* Pointer to the file dataspace */ - H5S_t *mem_space; /* Pointer to the memory dataspace */ + const H5S_t *file_space; /* Pointer to the file dataspace */ + const H5S_t *mem_space; /* Pointer to the memory dataspace */ hsize_t f_dims[H5O_LAYOUT_NDIMS]; /* File dataspace dimensions */ H5S_t *last_chunk; /* Pointer to last memory chunk's dataspace */ H5S_t *mchunk_tmpl; /* Dataspace template for new memory chunks */ @@ -2388,9 +2388,8 @@ H5D_create_chunk_map(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *file_sp fm->last_index=(hsize_t)-1; fm->last_chunk=NULL; - /* Copy the dataspaces */ - if((fm->file_space = H5S_copy(file_space))==NULL) - HGOTO_ERROR (H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy file dataspace") + /* Point at the dataspaces */ + fm->file_space=file_space; fm->mem_space=equiv_mspace; /* Get type of selection on disk & in memory */ @@ -2414,14 +2413,6 @@ H5D_create_chunk_map(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *file_sp fm->last_chunk=NULL; } /* end if */ else { - /* Make certain selections are stored in span tree form (not "optimized hyperslab" or "all") */ - if(H5S_hyper_convert(fm->file_space)<0) - HGOTO_ERROR (H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to convert selection to span trees") - - /* Normalize the hyperslab selections by adjusting them by the offset */ - if(H5S_hyper_normalize_offset(fm->file_space)<0) - HGOTO_ERROR (H5E_DATASET, H5E_BADSELECT, FAIL, "unable to normalize dataspace by offset") - #ifdef QAK { int mpi_rank; @@ -2545,7 +2536,10 @@ done: HDONE_ERROR (H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release chunk mapping") } /* end if */ + /* Reset the global dataspace info */ + fm->file_space=NULL; fm->mem_space=NULL; + if(equiv_mspace_init && equiv_mspace) { if(H5S_close(equiv_mspace)<0) HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "can't release memory chunk dataspace template") @@ -2637,11 +2631,6 @@ H5D_destroy_chunk_map(const fm_map *fm) if(fm->fsel) H5TB_dfree(fm->fsel,H5D_free_chunk_info,NULL); - /* Free the file dataspace */ - if(fm->file_space) - if(H5S_close(fm->file_space)<0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "can't release file dataspace") - /* Free the memory chunk dataspace template */ if(fm->mchunk_tmpl) if(H5S_close(fm->mchunk_tmpl)<0) @@ -2719,6 +2708,14 @@ H5D_create_chunk_file_map_hyper(const fm_map *fm) if((tmp_fchunk = H5S_copy(fm->file_space))==NULL) HGOTO_ERROR (H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy memory space") + /* Make certain selections are stored in span tree form (not "optimized hyperslab" or "all") */ + if(H5S_hyper_convert(tmp_fchunk)<0) + HGOTO_ERROR (H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to convert selection to span trees") + + /* Normalize hyperslab selections by adjusting them by the offset */ + if(H5S_hyper_normalize_offset(tmp_fchunk)<0) + HGOTO_ERROR (H5E_DATASET, H5E_BADSELECT, FAIL, "unable to normalize dataspace by offset") + /* "AND" temporary chunk and current chunk */ if(H5S_select_hyperslab(tmp_fchunk,H5S_SELECT_AND,coords,NULL,count,NULL)<0) { (void)H5S_close(tmp_fchunk); |