summaryrefslogtreecommitdiffstats
path: root/src
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
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')
-rw-r--r--src/H5Dchunk.c5
-rw-r--r--src/H5Dlayout.c67
-rw-r--r--src/H5Dpkg.h1
-rw-r--r--src/H5Dpublic.h1
-rw-r--r--src/H5Dsingle.c556
-rw-r--r--src/H5Olayout.c23
-rw-r--r--src/H5Oprivate.h9
-rw-r--r--src/H5trace.c4
-rw-r--r--src/Makefile.am3
9 files changed, 650 insertions, 19 deletions
diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c
index 0acb385..08c671b 100644
--- a/src/H5Dchunk.c
+++ b/src/H5Dchunk.c
@@ -78,7 +78,8 @@
HDassert((H5D_CHUNK_IDX_EARRAY == storage->idx_type && H5D_COPS_EARRAY == storage->ops) || \
(H5D_CHUNK_IDX_FARRAY == storage->idx_type && H5D_COPS_FARRAY == storage->ops) || \
(H5D_CHUNK_IDX_BT2 == storage->idx_type && H5D_COPS_BT2 == storage->ops) || \
- (H5D_CHUNK_IDX_BTREE == storage->idx_type && H5D_COPS_BTREE == storage->ops));
+ (H5D_CHUNK_IDX_BTREE == storage->idx_type && H5D_COPS_BTREE == storage->ops) || \
+ (H5D_CHUNK_IDX_SINGLE == storage->idx_type && H5D_COPS_SINGLE == storage->ops));
/*
* Feature: If this constant is defined then every cache preemption and load
@@ -6232,7 +6233,6 @@ H5D__chunk_file_alloc(const H5D_chk_idx_info_t *idx_info, const H5F_block_t *old
HDassert(idx_info->pline);
HDassert(idx_info->layout);
HDassert(idx_info->storage);
- HDassert(H5F_addr_defined(idx_info->storage->idx_addr));
HDassert(new_chunk);
HDassert(need_insert);
@@ -6297,6 +6297,7 @@ H5D__chunk_file_alloc(const H5D_chk_idx_info_t *idx_info, const H5F_block_t *old
case H5D_CHUNK_IDX_FARRAY:
case H5D_CHUNK_IDX_BT2:
case H5D_CHUNK_IDX_BTREE:
+ case H5D_CHUNK_IDX_SINGLE:
HDassert(new_chunk->length > 0);
H5_CHECK_OVERFLOW(new_chunk->length, /*From: */uint32_t, /*To: */hsize_t);
new_chunk->offset = H5MF_alloc(idx_info->f, H5FD_MEM_DRAW, idx_info->dxpl_id, (hsize_t)new_chunk->length);
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)
diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h
index 2609412..0fb0d12 100644
--- a/src/H5Dpkg.h
+++ b/src/H5Dpkg.h
@@ -541,6 +541,7 @@ H5_DLLVAR const H5D_layout_ops_t H5D_LOPS_VIRTUAL[1];
/* Chunked layout operations */
H5_DLLVAR const H5D_chunk_ops_t H5D_COPS_BTREE[1];
+H5_DLLVAR const H5D_chunk_ops_t H5D_COPS_SINGLE[1];
H5_DLLVAR const H5D_chunk_ops_t H5D_COPS_EARRAY[1];
H5_DLLVAR const H5D_chunk_ops_t H5D_COPS_FARRAY[1];
H5_DLLVAR const H5D_chunk_ops_t H5D_COPS_BT2[1];
diff --git a/src/H5Dpublic.h b/src/H5Dpublic.h
index 07f8dbe..361174a 100644
--- a/src/H5Dpublic.h
+++ b/src/H5Dpublic.h
@@ -61,6 +61,7 @@ typedef enum H5D_layout_t {
/* Types of chunk index data structures */
typedef enum H5D_chunk_index_t {
H5D_CHUNK_IDX_BTREE = 0, /* v1 B-tree index (default) */
+ H5D_CHUNK_IDX_SINGLE = 1, /* Single Chunk index (cur dims[]=max dims[]=chunk dims[]; filtered & non-filtered) */
H5D_CHUNK_IDX_FARRAY = 3, /* Fixed array (for 0 unlimited dims) */
H5D_CHUNK_IDX_EARRAY = 4, /* Extensible array (for 1 unlimited dim) */
H5D_CHUNK_IDX_BT2 = 5, /* v2 B-tree index (for >1 unlimited dims) */
diff --git a/src/H5Dsingle.c b/src/H5Dsingle.c
new file mode 100644
index 0000000..e09a5cf
--- /dev/null
+++ b/src/H5Dsingle.c
@@ -0,0 +1,556 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the files COPYING and Copyright.html. COPYING can be found at the root *
+ * of the source code distribution tree; Copyright.html can be found at the *
+ * root level of an installed copy of the electronic HDF5 document set and *
+ * is linked from the top-level documents page. It can also be found at *
+ * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
+ * access to either file, you may request a copy from help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/* Programmer: Vailin Choi <vchoi@hdfgroup.org>
+ * May 2011; updated 10/2015
+ *
+ * Purpose: Single Chunk I/O functions.
+ * This is used when the dataset has only 1 chunk (with or without filter):
+ * cur_dims[] is equal to max_dims[] is equal to the chunk dims[]
+ * non-filter chunk record: [address of the chunk]
+ * filtered chunk record: [address of the chunk, chunk size, filter mask]
+ *
+ */
+
+/****************/
+/* Module Setup */
+/****************/
+
+#include "H5Dmodule.h" /* This source code file is part of the H5D module */
+
+
+/***********/
+/* Headers */
+/***********/
+#include "H5private.h" /* Generic Functions */
+#include "H5Dpkg.h" /* Datasets */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5FLprivate.h" /* Free Lists */
+#include "H5MFprivate.h" /* File space management */
+#include "H5VMprivate.h" /* Vector functions */
+
+
+/****************/
+/* Local Macros */
+/****************/
+
+
+/******************/
+/* Local Typedefs */
+/******************/
+
+
+/********************/
+/* Local Prototypes */
+/********************/
+
+/* Single Chunk Index chunking I/O ops */
+static herr_t H5D__single_idx_init(const H5D_chk_idx_info_t *idx_info,
+ const H5S_t *space, haddr_t dset_ohdr_addr);
+static herr_t H5D__single_idx_create(const H5D_chk_idx_info_t *idx_info);
+static hbool_t H5D__single_idx_is_space_alloc(const H5O_storage_chunk_t *storage);
+static herr_t H5D__single_idx_insert(const H5D_chk_idx_info_t *idx_info,
+ H5D_chunk_ud_t *udata, const H5D_t *dset);
+static herr_t H5D__single_idx_get_addr(const H5D_chk_idx_info_t *idx_info,
+ H5D_chunk_ud_t *udata);
+static int H5D__single_idx_iterate(const H5D_chk_idx_info_t *idx_info,
+ H5D_chunk_cb_func_t chunk_cb, void *chunk_udata);
+static herr_t H5D__single_idx_remove(const H5D_chk_idx_info_t *idx_info,
+ H5D_chunk_common_ud_t *udata);
+static herr_t H5D__single_idx_delete(const H5D_chk_idx_info_t *idx_info);
+static herr_t H5D__single_idx_copy_setup(const H5D_chk_idx_info_t *idx_info_src,
+ const H5D_chk_idx_info_t *idx_info_dst);
+static herr_t H5D__single_idx_size(const H5D_chk_idx_info_t *idx_info,
+ hsize_t *size);
+static herr_t H5D__single_idx_reset(H5O_storage_chunk_t *storage, hbool_t reset_addr);
+static herr_t H5D__single_idx_dump(const H5O_storage_chunk_t *storage, FILE *stream);
+
+
+/*********************/
+/* Package Variables */
+/*********************/
+
+/* Non Index chunk I/O ops */
+const H5D_chunk_ops_t H5D_COPS_SINGLE[1] = {{
+ H5D__single_idx_init, /* init */
+ H5D__single_idx_create, /* create */
+ H5D__single_idx_is_space_alloc, /* is_space_alloc */
+ H5D__single_idx_insert, /* insert */
+ H5D__single_idx_get_addr, /* get_addr */
+ NULL, /* resize */
+ H5D__single_idx_iterate, /* iterate */
+ H5D__single_idx_remove, /* remove */
+ H5D__single_idx_delete, /* delete */
+ H5D__single_idx_copy_setup, /* copy_setup */
+ NULL, /* copy_shutdown */
+ H5D__single_idx_size, /* size */
+ H5D__single_idx_reset, /* reset */
+ H5D__single_idx_dump, /* dump */
+ NULL /* destroy */
+}};
+
+
+/*****************************/
+/* Library Private Variables */
+/*****************************/
+
+
+/*******************/
+/* Local Variables */
+/*******************/
+
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__single_idx_init
+ *
+ * Purpose: Initialize the indexing information for a dataset.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Vailin Choi
+ * July, 2011
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5D__single_idx_init(const H5D_chk_idx_info_t *idx_info,
+ const H5S_t H5_ATTR_UNUSED *space, haddr_t H5_ATTR_UNUSED dset_ohdr_addr)
+{
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Check args */
+ HDassert(idx_info);
+ HDassert(idx_info->f);
+ HDassert(idx_info->pline);
+ HDassert(idx_info->layout);
+ HDassert(idx_info->storage);
+
+ if(idx_info->pline->nused)
+ idx_info->layout->flags |= H5O_LAYOUT_CHUNK_SINGLE_INDEX_WITH_FILTER;
+ else
+ idx_info->layout->flags = 0;
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5D__single_idx_init() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__single_idx_create
+ *
+ * Purpose: Set up Single Chunk Index: filtered or non-filtered
+ *
+ * Return: Non-negative on success
+ * Negative on failure.
+ *
+ * Programmer: Vailin Choi; July 2011
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5D__single_idx_create(const H5D_chk_idx_info_t *idx_info)
+{
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Check args */
+ HDassert(idx_info);
+ HDassert(idx_info->f);
+ HDassert(idx_info->pline);
+ HDassert(idx_info->layout);
+ HDassert(idx_info->storage);
+ HDassert(idx_info->layout->max_nchunks == idx_info->layout->nchunks);
+ HDassert(idx_info->layout->nchunks == 1);
+ HDassert(!H5F_addr_defined(idx_info->storage->idx_addr));
+
+ if(idx_info->pline->nused)
+ HDassert(idx_info->layout->flags & H5O_LAYOUT_CHUNK_SINGLE_INDEX_WITH_FILTER);
+ else
+ HDassert(!(idx_info->layout->flags & H5O_LAYOUT_CHUNK_SINGLE_INDEX_WITH_FILTER));
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5D__single_idx_create() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__single_idx_is_space_alloc
+ *
+ * Purpose: Query if space is allocated for the single chunk
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Vailin Choi; July 2011
+ *
+ *-------------------------------------------------------------------------
+ */
+static hbool_t
+H5D__single_idx_is_space_alloc(const H5O_storage_chunk_t *storage)
+{
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Check args */
+ HDassert(storage);
+
+ FUNC_LEAVE_NOAPI((hbool_t)H5F_addr_defined(storage->idx_addr))
+} /* end H5D__single_idx_is_space_alloc() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__single_idx_insert
+ *
+ * Purpose: Allocate space for the single chunk
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Vailin Choi; July 2011
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5D__single_idx_insert(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata,
+ const H5D_t *dset)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(idx_info);
+ HDassert(idx_info->f);
+ HDassert(idx_info->pline);
+ HDassert(idx_info->layout);
+ HDassert(idx_info->storage);
+ HDassert(idx_info->layout->nchunks == 1);
+ HDassert(idx_info->layout->max_nchunks == 1);
+ HDassert(udata);
+
+ /* Set the address for the chunk */
+ HDassert(H5F_addr_defined(udata->chunk_block.offset));
+ idx_info->storage->idx_addr = udata->chunk_block.offset;
+
+ if(idx_info->pline->nused > 0) {
+ H5_CHECKED_ASSIGN(idx_info->storage->u.single.nbytes, uint32_t, udata->chunk_block.length, hsize_t);
+ idx_info->storage->u.single.filter_mask = udata->filter_mask;
+ } /* end if */
+
+ if(dset) {
+ if(dset->shared->dcpl_cache.fill.alloc_time != H5D_ALLOC_TIME_EARLY || idx_info->pline->nused > 0) {
+ /* Mark the layout dirty so that the address of the single chunk will be flushed later */
+ if(H5D__mark(dset, idx_info->dxpl_id, H5D_MARK_LAYOUT) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to mark layout as dirty")
+ } /* end if */
+ } /* end if */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5D__single_idx_insert() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__single_idx_get_addr
+ *
+ * Purpose: Get the file address of a chunk.
+ * Save the retrieved information in the udata supplied.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Vailin Choi; July 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5D__single_idx_get_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata)
+{
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Sanity checks */
+ HDassert(idx_info);
+ HDassert(idx_info->f);
+ HDassert(idx_info->pline);
+ HDassert(idx_info->layout);
+ HDassert(idx_info->storage);
+ HDassert(idx_info->layout->nchunks == 1);
+ HDassert(idx_info->layout->max_nchunks == 1);
+ HDassert(udata);
+
+ udata->chunk_block.offset = idx_info->storage->idx_addr;
+ if(idx_info->layout->flags & H5O_LAYOUT_CHUNK_SINGLE_INDEX_WITH_FILTER) {
+ udata->chunk_block.length = idx_info->storage->u.single.nbytes;
+ udata->filter_mask = idx_info->storage->u.single.filter_mask;
+ } /* end if */
+ else {
+ udata->chunk_block.length = idx_info->layout->size;
+ udata->filter_mask = 0;
+ } /* end else */
+ if(!H5F_addr_defined(udata->chunk_block.offset))
+ udata->chunk_block.length = 0;
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* H5D__single_idx_get_addr() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__single_idx_iterate
+ *
+ * Purpose: Make callback for the single chunk
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Vailin Choi; July 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+H5D__single_idx_iterate(const H5D_chk_idx_info_t *idx_info,
+ H5D_chunk_cb_func_t chunk_cb, void *chunk_udata)
+{
+ H5D_chunk_rec_t chunk_rec; /* generic chunk record */
+ int ret_value = -1; /* Return value */
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Sanity checks */
+ HDassert(idx_info);
+ HDassert(idx_info->f);
+ HDassert(idx_info->pline);
+ HDassert(idx_info->layout);
+ HDassert(idx_info->storage);
+ HDassert(chunk_cb);
+ HDassert(chunk_udata);
+ HDassert(H5F_addr_defined(idx_info->storage->idx_addr));
+
+ /* Initialize generic chunk record */
+ HDmemset(&chunk_rec, 0, sizeof(chunk_rec));
+ chunk_rec.chunk_addr = idx_info->storage->idx_addr;
+
+ if(idx_info->layout->flags & H5O_LAYOUT_CHUNK_SINGLE_INDEX_WITH_FILTER) {
+ chunk_rec.nbytes = idx_info->storage->u.single.nbytes;
+ chunk_rec.filter_mask = idx_info->storage->u.single.filter_mask;
+ } /* end if */
+ else {
+ chunk_rec.nbytes = idx_info->layout->size;
+ chunk_rec.filter_mask = 0;
+ } /* end else */
+
+ /* Make "generic chunk" callback */
+ if((ret_value = (*chunk_cb)(&chunk_rec, chunk_udata)) < 0)
+ HERROR(H5E_DATASET, H5E_CALLBACK, "failure in generic chunk iterator callback");
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5D__single_idx_iterate() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__single_idx_remove
+ *
+ * Purpose: Remove the single chunk
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Vailin Choi; July 2011
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5D__single_idx_remove(const H5D_chk_idx_info_t *idx_info, H5D_chunk_common_ud_t H5_ATTR_UNUSED *udata)
+{
+ hsize_t nbytes; /* Size of all chunks */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(idx_info);
+ HDassert(idx_info->f);
+ HDassert(idx_info->pline);
+ HDassert(idx_info->layout);
+ HDassert(idx_info->storage);
+ HDassert(H5F_addr_defined(idx_info->storage->idx_addr));
+
+ if(idx_info->layout->flags & H5O_LAYOUT_CHUNK_SINGLE_INDEX_WITH_FILTER)
+ nbytes = idx_info->storage->u.single.nbytes;
+ else
+ nbytes = idx_info->layout->size;
+
+ if(H5MF_xfree(idx_info->f, H5FD_MEM_DRAW, idx_info->dxpl_id, idx_info->storage->idx_addr, nbytes) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, H5_ITER_ERROR, "unable to free dataset chunks")
+
+ idx_info->storage->idx_addr = HADDR_UNDEF;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5D__single_idx_remove() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__single_idx_delete
+ *
+ * Purpose: Delete raw data storage for entire dataset (i.e. the only chunk)
+ *
+ * Return: Success: Non-negative
+ * Failure: negative
+ *
+ * Programmer: Vailin Choi; Sept 2011
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5D__single_idx_delete(const H5D_chk_idx_info_t *idx_info)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Sanity checks */
+ HDassert(idx_info);
+ HDassert(idx_info->f);
+ HDassert(idx_info->pline);
+ HDassert(idx_info->layout);
+ HDassert(idx_info->storage);
+
+ if(H5F_addr_defined(idx_info->storage->idx_addr))
+ ret_value = H5D__single_idx_remove(idx_info, NULL);
+ else
+ HDassert(!H5F_addr_defined(idx_info->storage->idx_addr));
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5D__single_idx_delete() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__single_idx_copy_setup
+ *
+ * Purpose: Set up any necessary information for copying the single chunk
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Vailin Choi; Sept 2011
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5D__single_idx_copy_setup(const H5D_chk_idx_info_t *idx_info_src,
+ const H5D_chk_idx_info_t *idx_info_dst)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check args */
+ HDassert(idx_info_src);
+ HDassert(idx_info_src->f);
+ HDassert(idx_info_src->pline);
+ HDassert(idx_info_src->layout);
+ HDassert(idx_info_src->storage);
+ HDassert(H5F_addr_defined(idx_info_src->storage->idx_addr));
+
+ HDassert(idx_info_dst);
+ HDassert(idx_info_dst->f);
+ HDassert(idx_info_dst->pline);
+ HDassert(idx_info_dst->layout);
+ HDassert(idx_info_dst->storage);
+
+ /* Set copied metadata tag */
+ H5_BEGIN_TAG(idx_info_dst->dxpl_id, H5AC__COPIED_TAG, FAIL);
+
+ /* Set up information at the destination file */
+ if(H5D__single_idx_create(idx_info_dst) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize chunked storage")
+
+ /* Reset metadata tag */
+ H5_END_TAG(FAIL);
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5D__single_idx_copy_setup() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__single_idx_size
+ *
+ * Purpose: Retrieve the amount of index storage for the chunked dataset
+ *
+ * Return: Success: Non-negative
+ * Failure: negative
+ *
+ * Programmer: Vailin Choi; Sept 2011
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5D__single_idx_size(const H5D_chk_idx_info_t H5_ATTR_UNUSED *idx_info, hsize_t *index_size)
+{
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Check args */
+ HDassert(index_size);
+
+ *index_size = 0;
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5D__single_idx_size() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__single_idx_reset
+ *
+ * Purpose: Reset indexing information.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Vailin Choi; Sept 2011
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5D__single_idx_reset(H5O_storage_chunk_t *storage, hbool_t reset_addr)
+{
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Check args */
+ HDassert(storage);
+
+ /* Reset index info */
+ if(reset_addr)
+ storage->idx_addr = HADDR_UNDEF;
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5D__single_idx_reset() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__single_idx_dump
+ *
+ * Purpose: Dump the address of the single chunk
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Vailin Choi; September 2011
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5D__single_idx_dump(const H5O_storage_chunk_t *storage, FILE *stream)
+{
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Check args */
+ HDassert(storage);
+ HDassert(stream);
+
+ HDfprintf(stream, " Address: %a\n", storage->idx_addr);
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5D__single_idx_dump() */
+
diff --git a/src/H5Olayout.c b/src/H5Olayout.c
index bc1ebc6..299a43e 100644
--- a/src/H5Olayout.c
+++ b/src/H5Olayout.c
@@ -298,6 +298,16 @@ H5O__layout_decode(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED
HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, NULL, "v1 B-tree index type should never be in a v4 layout message")
break;
+ case H5D_CHUNK_IDX_SINGLE: /* Single Chunk Index */
+ if(mesg->u.chunk.flags & H5O_LAYOUT_CHUNK_SINGLE_INDEX_WITH_FILTER) {
+ H5F_DECODE_LENGTH(f, p, mesg->storage.u.chunk.u.single.nbytes);
+ UINT32DECODE(p, mesg->storage.u.chunk.u.single.filter_mask);
+ } /* end if */
+
+ /* Set the chunk operations */
+ mesg->storage.u.chunk.ops = H5D_COPS_SINGLE;
+ break;
+
case H5D_CHUNK_IDX_FARRAY:
/* Fixed array creation parameters */
mesg->u.chunk.u.farray.cparam.max_dblk_page_nelmts_bits = *p++;
@@ -618,6 +628,14 @@ H5O__layout_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p,
HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, FAIL, "v1 B-tree index type should never be in a v4 layout message")
break;
+ case H5D_CHUNK_IDX_SINGLE: /* Single Chunk */
+ /* Filter information */
+ if(mesg->u.chunk.flags & H5O_LAYOUT_CHUNK_SINGLE_INDEX_WITH_FILTER) {
+ H5F_ENCODE_LENGTH(f, p, mesg->storage.u.chunk.u.single.nbytes);
+ UINT32ENCODE(p, mesg->storage.u.chunk.u.single.filter_mask);
+ } /* end if */
+ break;
+
case H5D_CHUNK_IDX_FARRAY:
/* Fixed array creation parameters */
*p++ = mesg->u.chunk.u.farray.cparam.max_dblk_page_nelmts_bits;
@@ -1174,6 +1192,11 @@ H5O__layout_debug(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, const v
"Index Type:", "v1 B-tree");
break;
+ case H5D_CHUNK_IDX_SINGLE:
+ HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
+ "Index Type:", "Single Chunk");
+ break;
+
case H5D_CHUNK_IDX_FARRAY:
HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
"Index Type:", "Fixed Array");
diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h
index 46845a3..17ab665 100644
--- a/src/H5Oprivate.h
+++ b/src/H5Oprivate.h
@@ -369,8 +369,10 @@ typedef struct H5O_efl_t {
/* Flags for chunked layout feature encoding */
#define H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS 0x01
+#define H5O_LAYOUT_CHUNK_SINGLE_INDEX_WITH_FILTER 0x02
#define H5O_LAYOUT_ALL_CHUNK_FLAGS ( \
H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS \
+ | H5O_LAYOUT_CHUNK_SINGLE_INDEX_WITH_FILTER \
)
/* Initial version of the layout information. Used when space is allocated */
@@ -432,6 +434,12 @@ typedef struct H5O_storage_chunk_earray_t {
struct H5EA_t *ea; /* Pointer to extensible index array struct */
} H5O_storage_chunk_earray_t;
+/* Filtered info for single chunk index */
+typedef struct H5O_storage_chunk_single_filt_t {
+ uint32_t nbytes; /* Size of chunk (in file) */
+ uint32_t filter_mask; /* Excluded filters for chunk */
+} H5O_storage_chunk_single_filt_t;
+
/* Forward declaration of structs used below */
struct H5B2_t; /* Defined in H5B2pkg.h */
@@ -449,6 +457,7 @@ typedef struct H5O_storage_chunk_t {
H5O_storage_chunk_bt2_t btree2; /* Information for v2 B-tree index */
H5O_storage_chunk_earray_t earray; /* Information for extensible array index */
H5O_storage_chunk_farray_t farray; /* Information for fixed array index */
+ H5O_storage_chunk_single_filt_t single; /* Information for single chunk w/ filters index */
} u;
} H5O_storage_chunk_t;
diff --git a/src/H5trace.c b/src/H5trace.c
index a2ca7e2..92d3d20 100644
--- a/src/H5trace.c
+++ b/src/H5trace.c
@@ -522,6 +522,10 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
fprintf(out, "H5D_CHUNK_IDX_BT2");
break;
+ case H5D_CHUNK_IDX_SINGLE:
+ fprintf(out, "H5D_CHUNK_IDX_SINGLE");
+ break;
+
case H5D_CHUNK_IDX_NTYPES:
fprintf(out, "ERROR: H5D_CHUNK_IDX_NTYPES (invalid value)");
break;
diff --git a/src/Makefile.am b/src/Makefile.am
index ec8c007..f376969 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -50,7 +50,8 @@ libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \
H5D.c H5Dbtree.c H5Dbtree2.c H5Dchunk.c H5Dcompact.c H5Dcontig.c H5Ddbg.c \
H5Ddeprec.c H5Dearray.c H5Defl.c H5Dfarray.c H5Dfill.c H5Dint.c \
H5Dio.c H5Dlayout.c \
- H5Doh.c H5Dscatgath.c H5Dselect.c H5Dtest.c H5Dvirtual.c \
+ H5Doh.c H5Dscatgath.c H5Dselect.c \
+ H5Dsingle.c H5Dtest.c H5Dvirtual.c \
H5E.c H5Edeprec.c H5Eint.c \
H5EA.c H5EAcache.c H5EAdbg.c H5EAdblkpage.c H5EAdblock.c H5EAhdr.c \
H5EAiblock.c H5EAint.c H5EAsblock.c H5EAstat.c H5EAtest.c \