Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for the bug exposed from running test/set_extent.c when selection… #3319

Merged
merged 10 commits into from
Aug 4, 2023
44 changes: 32 additions & 12 deletions src/H5Dchunk.c
Original file line number Diff line number Diff line change
Expand Up @@ -2731,11 +2731,20 @@ H5D__chunk_read(H5D_io_info_t *io_info, H5D_dset_io_info_t *dset_info)
}
} /* end if */
else if (!skip_missing_chunks) {
/* Set up nonexistent dataset info for (fill value) read from nonexistent chunk */
nonexistent_dset_info.layout_io_info.contig_piece_info = chunk_info;
nonexistent_dset_info.file_space = chunk_info->fspace;
nonexistent_dset_info.mem_space = chunk_info->mspace;
nonexistent_dset_info.nelmts = chunk_info->piece_points;

/* Set request_nelmts. This is not normally set by the upper layers because selection I/O
* usually does not use strip mining (H5D__scatgath_write), and instead allocates buffers
* large enough for the entire I/O. Set request_nelmts to be large enough for all selected
* elements in this chunk because it must be at least that large */
nonexistent_dset_info.type_info.request_nelmts = nonexistent_dset_info.nelmts;

/* Perform the actual read operation from the nonexistent chunk
*/
nonexistent_dset_info.file_space = chunk_info->fspace;
nonexistent_dset_info.mem_space = chunk_info->mspace;
nonexistent_dset_info.nelmts = chunk_info->piece_points;
if ((dset_info->io_ops.single_read)(&nonexistent_io_info, &nonexistent_dset_info) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "chunked read failed");
} /* end if */
Expand Down Expand Up @@ -2866,9 +2875,10 @@ H5D__chunk_read(H5D_io_info_t *io_info, H5D_dset_io_info_t *dset_info)

/* Perform the actual read operation */
assert(chk_io_info->count == 1);
chk_io_info->dsets_info[0].file_space = chunk_info->fspace;
chk_io_info->dsets_info[0].mem_space = chunk_info->mspace;
chk_io_info->dsets_info[0].nelmts = chunk_info->piece_points;
chk_io_info->dsets_info[0].layout_io_info.contig_piece_info = chunk_info;
chk_io_info->dsets_info[0].file_space = chunk_info->fspace;
chk_io_info->dsets_info[0].mem_space = chunk_info->mspace;
chk_io_info->dsets_info[0].nelmts = chunk_info->piece_points;
if ((dset_info->io_ops.single_read)(chk_io_info, &chk_io_info->dsets_info[0]) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "chunked read failed");

Expand Down Expand Up @@ -3055,10 +3065,19 @@ H5D__chunk_write(H5D_io_info_t *io_info, H5D_dset_io_info_t *dset_info)
/* Set up the storage buffer information for this chunk */
cpt_store.compact.buf = chunk;

/* Set up compact dataset info for write to cached chunk */
cpt_dset_info.layout_io_info.contig_piece_info = chunk_info;
cpt_dset_info.file_space = chunk_info->fspace;
cpt_dset_info.mem_space = chunk_info->mspace;
cpt_dset_info.nelmts = chunk_info->piece_points;

/* Set request_nelmts. This is not normally set by the upper layers because selection I/O
* usually does not use strip mining (H5D__scatgath_write), and instead allocates buffers
* large enough for the entire I/O. Set request_nelmts to be large enough for all selected
* elements in this chunk because it must be at least that large */
cpt_dset_info.type_info.request_nelmts = cpt_dset_info.nelmts;

/* Perform the actual write operation */
cpt_dset_info.file_space = chunk_info->fspace;
cpt_dset_info.mem_space = chunk_info->mspace;
cpt_dset_info.nelmts = chunk_info->piece_points;
if ((dset_info->io_ops.single_write)(&cpt_io_info, &cpt_dset_info) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "chunked write failed");

Expand Down Expand Up @@ -3253,9 +3272,10 @@ H5D__chunk_write(H5D_io_info_t *io_info, H5D_dset_io_info_t *dset_info)

/* Perform the actual write operation */
assert(chk_io_info->count == 1);
chk_io_info->dsets_info[0].file_space = chunk_info->fspace;
chk_io_info->dsets_info[0].mem_space = chunk_info->mspace;
chk_io_info->dsets_info[0].nelmts = chunk_info->piece_points;
chk_io_info->dsets_info[0].layout_io_info.contig_piece_info = chunk_info;
chk_io_info->dsets_info[0].file_space = chunk_info->fspace;
chk_io_info->dsets_info[0].mem_space = chunk_info->mspace;
chk_io_info->dsets_info[0].nelmts = chunk_info->piece_points;
if ((dset_info->io_ops.single_write)(chk_io_info, &chk_io_info->dsets_info[0]) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "chunked write failed");

Expand Down
5 changes: 3 additions & 2 deletions src/H5Dcompact.c
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,9 @@ H5D__compact_io_init(H5D_io_info_t *io_info, H5D_dset_io_info_t *dinfo)
{
FUNC_ENTER_PACKAGE_NOERR

dinfo->store->compact.buf = dinfo->dset->shared->layout.storage.u.compact.buf;
dinfo->store->compact.dirty = &dinfo->dset->shared->layout.storage.u.compact.dirty;
dinfo->store->compact.buf = dinfo->dset->shared->layout.storage.u.compact.buf;
dinfo->store->compact.dirty = &dinfo->dset->shared->layout.storage.u.compact.dirty;
dinfo->layout_io_info.contig_piece_info = NULL;

/* Disable selection I/O */
io_info->use_select_io = H5D_SELECTION_IO_MODE_OFF;
Expand Down
3 changes: 3 additions & 0 deletions src/H5Defl.c
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,9 @@ H5D__efl_io_init(H5D_io_info_t *io_info, H5D_dset_io_info_t *dinfo)

H5MM_memcpy(&dinfo->store->efl, &(dinfo->dset->shared->dcpl_cache.efl), sizeof(H5O_efl_t));

/* No "pieces" selected */
dinfo->layout_io_info.contig_piece_info = NULL;

/* Disable selection I/O */
io_info->use_select_io = H5D_SELECTION_IO_MODE_OFF;
io_info->no_selection_io_cause |= H5D_SEL_IO_NOT_CONTIGUOUS_OR_CHUNKED_DATASET;
Expand Down
Loading