summaryrefslogtreecommitdiffstats
path: root/src/H5Dlayout.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2016-04-19 04:21:12 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2016-04-19 04:21:12 (GMT)
commitf7aff7d5cf0f1c9cd056ebc0274ad8d0683890a2 (patch)
tree88247f058e18aebfcb06f802ea9d21967a37ab6b /src/H5Dlayout.c
parent6ce67650fbaa78b37ccb0734fb97bf34d3770af6 (diff)
downloadhdf5-f7aff7d5cf0f1c9cd056ebc0274ad8d0683890a2.zip
hdf5-f7aff7d5cf0f1c9cd056ebc0274ad8d0683890a2.tar.gz
hdf5-f7aff7d5cf0f1c9cd056ebc0274ad8d0683890a2.tar.bz2
[svn-r29738] Description:
Bring "single" chunk index from revise_chunks branch to trunk. Tested on: MacOSX/64 10.11.4 (amazon) w/serial, parallel & production (w/check-vfd) (h5committest forthcoming)
Diffstat (limited to 'src/H5Dlayout.c')
-rw-r--r--src/H5Dlayout.c67
1 files changed, 51 insertions, 16 deletions
diff --git a/src/H5Dlayout.c b/src/H5Dlayout.c
index bf99b9d..991ad95 100644
--- a/src/H5Dlayout.c
+++ b/src/H5Dlayout.c
@@ -101,6 +101,10 @@ H5D__layout_set_io_ops(const H5D_t *dataset)
dataset->shared->layout.storage.u.chunk.ops = H5D_COPS_BTREE;
break;
+ case H5D_CHUNK_IDX_SINGLE:
+ dataset->shared->layout.storage.u.chunk.ops = H5D_COPS_SINGLE;
+ break;
+
case H5D_CHUNK_IDX_FARRAY:
dataset->shared->layout.storage.u.chunk.ops = H5D_COPS_FARRAY;
break;
@@ -217,6 +221,14 @@ H5D__layout_meta_size(const H5F_t *f, const H5O_layout_t *layout, hbool_t includ
case H5D_CHUNK_IDX_BTREE:
HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, 0, "v1 B-tree index type found for layout message >v3")
+ case H5D_CHUNK_IDX_SINGLE:
+ /* Possible filter information */
+ if(layout->u.chunk.flags & H5O_LAYOUT_CHUNK_SINGLE_INDEX_WITH_FILTER) {
+ ret_value += H5F_SIZEOF_SIZE(f); /* Size of chunk (in file) */
+ ret_value += 4; /* Filter mask for chunk */
+ } /* end if */
+ break;
+
case H5D_CHUNK_IDX_FARRAY:
/* Fixed array creation parameters */
ret_value += H5D_FARRAY_CREATE_PARAM_SIZE;
@@ -338,6 +350,7 @@ H5D__layout_set_latest_indexing(H5O_layout_t *layout, const H5S_t *space,
hsize_t max_dims[H5O_LAYOUT_NDIMS]; /* Maximum dimension sizes */
hsize_t cur_dims[H5O_LAYOUT_NDIMS]; /* Current dimension sizes */
unsigned unlim_count = 0; /* Count of unlimited max. dimensions */
+ hbool_t single = TRUE; /* Fulfill single chunk indexing */
unsigned u; /* Local index variable */
/* Query the dataspace's dimensions */
@@ -348,6 +361,8 @@ H5D__layout_set_latest_indexing(H5O_layout_t *layout, const H5S_t *space,
for(u = 0; u < ndims; u++) {
if(max_dims[u] == H5S_UNLIMITED)
unlim_count++;
+ if(cur_dims[u] != max_dims[u] || cur_dims[u] != layout->u.chunk.dim[u])
+ single = FALSE;
} /* end for */
/* Chunked datasets with unlimited dimension(s) */
@@ -383,17 +398,25 @@ H5D__layout_set_latest_indexing(H5O_layout_t *layout, const H5S_t *space,
layout->u.chunk.u.btree2.cparam.merge_percent = H5D_BT2_MERGE_PERC;
} /* end else */
} /* end if */
- else {
- /* Set the chunk index type to Fixed Array */
- layout->u.chunk.idx_type = H5D_CHUNK_IDX_FARRAY;
- layout->storage.u.chunk.idx_type = H5D_CHUNK_IDX_FARRAY;
- layout->storage.u.chunk.ops = H5D_COPS_FARRAY;
-
- /* Set the fixed array creation parameters */
- /* (use hard-coded defaults for now, until we give applications
- * control over this with a property list - QAK)
- */
- layout->u.chunk.u.farray.cparam.max_dblk_page_nelmts_bits = H5D_FARRAY_MAX_DBLK_PAGE_NELMTS_BITS;
+ else { /* Chunked dataset with fixed dimensions */
+ /* Check for correct condition for using "single chunk" chunk index */
+ if(single) {
+ layout->u.chunk.idx_type = H5D_CHUNK_IDX_SINGLE;
+ layout->storage.u.chunk.idx_type = H5D_CHUNK_IDX_SINGLE;
+ layout->storage.u.chunk.ops = H5D_COPS_SINGLE;
+ } /* end if */
+ else {
+ /* Set the chunk index type to Fixed Array */
+ layout->u.chunk.idx_type = H5D_CHUNK_IDX_FARRAY;
+ layout->storage.u.chunk.idx_type = H5D_CHUNK_IDX_FARRAY;
+ layout->storage.u.chunk.ops = H5D_COPS_FARRAY;
+
+ /* Set the fixed array creation parameters */
+ /* (use hard-coded defaults for now, until we give applications
+ * control over this with a property list - QAK)
+ */
+ layout->u.chunk.u.farray.cparam.max_dblk_page_nelmts_bits = H5D_FARRAY_MAX_DBLK_PAGE_NELMTS_BITS;
+ } /* end else */
} /* end else */
} /* end if */
} /* end if */
@@ -422,6 +445,7 @@ H5D__layout_oh_create(H5F_t *file, hid_t dxpl_id, H5O_t *oh, H5D_t *dset,
{
H5O_layout_t *layout; /* Dataset's layout information */
const H5O_fill_t *fill_prop; /* Pointer to dataset's fill value information */
+ unsigned layout_mesg_flags; /* Flags for inserting layout message */
hbool_t layout_init = FALSE; /* Flag to indicate that chunk information was initialized */
herr_t ret_value = SUCCEED; /* Return value */
@@ -516,9 +540,14 @@ H5D__layout_oh_create(H5F_t *file, hid_t dxpl_id, H5O_t *oh, H5D_t *dset,
} /* end if */
/* Create layout message */
- /* (Don't make layout message constant unless allocation time is early, since space may not be allocated) */
+ /* (Don't make layout message constant unless allocation time is early and non-filtered, since space may not be allocated) */
/* (Note: this is relying on H5D__alloc_storage not calling H5O_msg_write during dataset creation) */
- if(H5O_msg_append_oh(file, dxpl_id, oh, H5O_LAYOUT_ID, ((fill_prop->alloc_time == H5D_ALLOC_TIME_EARLY && H5D_COMPACT != layout->type) ? H5O_MSG_FLAG_CONSTANT : 0), 0, layout) < 0)
+ if(fill_prop->alloc_time == H5D_ALLOC_TIME_EARLY && H5D_COMPACT != layout->type
+ && !dset->shared->dcpl_cache.pline.nused)
+ layout_mesg_flags = H5O_MSG_FLAG_CONSTANT;
+ else
+ layout_mesg_flags = 0;
+ if(H5O_msg_append_oh(file, dxpl_id, oh, H5O_LAYOUT_ID, layout_mesg_flags, 0, layout) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update layout")
done:
@@ -636,6 +665,7 @@ done:
herr_t
H5D__layout_oh_write(H5D_t *dataset, hid_t dxpl_id, H5O_t *oh, unsigned update_flags)
{
+ htri_t msg_exists; /* Whether the layout message exists */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -644,9 +674,14 @@ H5D__layout_oh_write(H5D_t *dataset, hid_t dxpl_id, H5O_t *oh, unsigned update_f
HDassert(dataset);
HDassert(oh);
- /* Write the layout message to the dataset's header */
- if(H5O_msg_write_oh(dataset->oloc.file, dxpl_id, oh, H5O_LAYOUT_ID, H5O_MSG_FLAG_CONSTANT, update_flags, &dataset->shared->layout) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to update layout message")
+ /* Check if the layout message has been added to the dataset's header */
+ if((msg_exists = H5O_msg_exists_oh(oh, H5O_LAYOUT_ID)) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to check if layout message exists")
+ if(msg_exists) {
+ /* Write the layout message to the dataset's header */
+ if(H5O_msg_write_oh(dataset->oloc.file, dxpl_id, oh, H5O_LAYOUT_ID, 0, update_flags, &dataset->shared->layout) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to update layout message")
+ } /* end if */
done:
FUNC_LEAVE_NOAPI(ret_value)