diff options
author | Neil Fortner <nfortne2@hdfgroup.org> | 2015-06-17 15:25:34 (GMT) |
---|---|---|
committer | Neil Fortner <nfortne2@hdfgroup.org> | 2015-06-17 15:25:34 (GMT) |
commit | 17078f2b9de30d8c8f3a10551a9e76daf014fc8c (patch) | |
tree | de594d32646fe7ca7f9b603dd0b58706c1259607 /src/H5Dvirtual.c | |
parent | fc0fba145e327423103039283db67fdeb6395727 (diff) | |
download | hdf5-17078f2b9de30d8c8f3a10551a9e76daf014fc8c.zip hdf5-17078f2b9de30d8c8f3a10551a9e76daf014fc8c.tar.gz hdf5-17078f2b9de30d8c8f3a10551a9e76daf014fc8c.tar.bz2 |
[svn-r27224] Fix bug that prevented reading from datasets with unlimited mappings with
missing source datasets. Decided not to attempt to open the source dataset in
this case, as doing so could create issues related to the sizing of the VDS.
Users should call H5Dget_space to open these datasets. No regression test yet.
Tested: ummon
Diffstat (limited to 'src/H5Dvirtual.c')
-rw-r--r-- | src/H5Dvirtual.c | 72 |
1 files changed, 41 insertions, 31 deletions
diff --git a/src/H5Dvirtual.c b/src/H5Dvirtual.c index 4a9f79f..4804c72 100644 --- a/src/H5Dvirtual.c +++ b/src/H5Dvirtual.c @@ -1663,42 +1663,52 @@ H5D__virtual_pre_io(H5D_io_info_t *io_info, } /* end for */ } /* end if */ else { - HDassert(storage->list[i].source_dset.clipped_virtual_select); - - /* Project intersection of file space and mapping virtual space onto - * memory space */ - if(H5S_select_project_intersection(file_space, mem_space, storage->list[i].source_dset.clipped_virtual_select, &storage->list[i].source_dset.projected_mem_space) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCLIP, FAIL, "can't project virtual intersection onto memory space") + if(storage->list[i].source_dset.clipped_virtual_select) { + /* Project intersection of file space and mapping virtual space onto + * memory space */ + if(H5S_select_project_intersection(file_space, mem_space, storage->list[i].source_dset.clipped_virtual_select, &storage->list[i].source_dset.projected_mem_space) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTCLIP, FAIL, "can't project virtual intersection onto memory space") - /* Check number of elements selected, add to tot_nelmts */ - if((select_nelmts = (hssize_t)H5S_GET_SELECT_NPOINTS(storage->list[i].source_dset.projected_mem_space)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCOUNT, FAIL, "unable to get number of elements in selection") + /* Check number of elements selected, add to tot_nelmts */ + if((select_nelmts = (hssize_t)H5S_GET_SELECT_NPOINTS(storage->list[i].source_dset.projected_mem_space)) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTCOUNT, FAIL, "unable to get number of elements in selection") - /* Check if anything is selected */ - if(select_nelmts > (hssize_t)0) { - /* Open source dataset */ - if(!storage->list[i].source_dset.dset) - /* Try to open dataset */ - if(H5D__virtual_open_source_dset(io_info->dset, &storage->list[i], &storage->list[i].source_dset, io_info->dxpl_id) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "unable to open source dataset") + /* Check if anything is selected */ + if(select_nelmts > (hssize_t)0) { + /* Open source dataset */ + if(!storage->list[i].source_dset.dset) + /* Try to open dataset */ + if(H5D__virtual_open_source_dset(io_info->dset, &storage->list[i], &storage->list[i].source_dset, io_info->dxpl_id) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "unable to open source dataset") - /* If the source dataset is not open, mark the selected elements - * as zero so projected_mem_space is freed */ - if(!storage->list[i].source_dset.dset) { - HDassert(0 && "Checking code coverage..."); //VDSINC - select_nelmts = (hssize_t)0; - } //VDSINC - } /* end if */ + /* If the source dataset is not open, mark the selected elements + * as zero so projected_mem_space is freed */ + if(!storage->list[i].source_dset.dset) { + HDassert(0 && "Checking code coverage..."); //VDSINC + select_nelmts = (hssize_t)0; + } //VDSINC + } /* end if */ - /* If there are not elements selected in this mapping, free - * projected_mem_space, otherwise update tot_nelmts */ - if(select_nelmts == (hssize_t)0) { - if(H5S_close(storage->list[i].source_dset.projected_mem_space) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "can't close projected memory space") - storage->list[i].source_dset.projected_mem_space = NULL; + /* If there are not elements selected in this mapping, free + * projected_mem_space, otherwise update tot_nelmts */ + if(select_nelmts == (hssize_t)0) { + if(H5S_close(storage->list[i].source_dset.projected_mem_space) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "can't close projected memory space") + storage->list[i].source_dset.projected_mem_space = NULL; + } /* end if */ + else + *tot_nelmts += (hsize_t)select_nelmts; } /* end if */ - else - *tot_nelmts += (hsize_t)select_nelmts; + else { + HDassert(0 && "Checking code coverage..."); //VDSINC + /* If there is no clipped_dim_virtual, this must be an unlimited + * selection whose dataset was not found in the last call to + * H5Dget_space(). Do not attempt to open it as this might + * affect the extent and we are not going to recalculate it + * here. */ + HDassert(storage->list[i].unlim_dim_virtual >= 0); + HDassert(!storage->list[i].source_dset.dset); + } /* end else */ } /* end else */ } /* end for */ |