summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Laird <jlaird@hdfgroup.org>2006-11-17 19:39:14 (GMT)
committerJames Laird <jlaird@hdfgroup.org>2006-11-17 19:39:14 (GMT)
commite215d22a79d497518040d74c1d1bd3fce34780cb (patch)
treeb311e41efd3ee0d23dae8558f94b4530b4f7db44
parent5660250f25e8e4cb8f05a838d8d2a6f8466ef55c (diff)
downloadhdf5-e215d22a79d497518040d74c1d1bd3fce34780cb.zip
hdf5-e215d22a79d497518040d74c1d1bd3fce34780cb.tar.gz
hdf5-e215d22a79d497518040d74c1d1bd3fce34780cb.tar.bz2
[svn-r12935] Added list-to-btree conversion, changed SOHM apis, and pushed SOHM table
version and size information into the superblock to eliminate a read when loading it. This is a file format change, and hopefully the last one (knock on wood). Tested on kagiso and Windows (mostly just a SOHM change).
-rw-r--r--src/H5Edefin.h14
-rw-r--r--src/H5Einit.h54
-rw-r--r--src/H5Epubgen.h24
-rw-r--r--src/H5Eterm.h14
-rw-r--r--src/H5F.c6
-rw-r--r--src/H5Fdbg.c6
-rw-r--r--src/H5Fpkg.h4
-rw-r--r--src/H5Fprivate.h9
-rw-r--r--src/H5Fsuper.c24
-rw-r--r--src/H5Opublic.h16
-rw-r--r--src/H5Pfcpl.c293
-rw-r--r--src/H5Ppublic.h13
-rwxr-xr-xsrc/H5SM.c138
-rwxr-xr-xsrc/H5SMbtree2.c49
-rw-r--r--src/H5SMcache.c68
-rwxr-xr-xsrc/H5SMpkg.h18
-rwxr-xr-xsrc/H5SMprivate.h9
-rwxr-xr-xsrc/H5SMpublic.h16
-rw-r--r--src/hdf5.h1
-rw-r--r--test/testhdf5.c2
-rw-r--r--test/tmisc.c18
-rw-r--r--test/tsohm.c127
22 files changed, 557 insertions, 366 deletions
diff --git a/src/H5Edefin.h b/src/H5Edefin.h
index f54228e..e99fe67 100644
--- a/src/H5Edefin.h
+++ b/src/H5Edefin.h
@@ -182,6 +182,13 @@ hid_t H5E_CANTNEXT_g = FAIL; /* Can't move to next iterator location
hid_t H5E_BADSELECT_g = FAIL; /* Invalid selection */
hid_t H5E_CANTCOMPARE_g = FAIL; /* Can't compare objects */
+/* Argument errors */
+hid_t H5E_UNINITIALIZED_g = FAIL; /* Information is uinitialized */
+hid_t H5E_UNSUPPORTED_g = FAIL; /* Feature is unsupported */
+hid_t H5E_BADTYPE_g = FAIL; /* Inappropriate type */
+hid_t H5E_BADRANGE_g = FAIL; /* Out of range */
+hid_t H5E_BADVALUE_g = FAIL; /* Bad value */
+
/* B-tree related errors */
hid_t H5E_NOTFOUND_g = FAIL; /* Object not found */
hid_t H5E_EXISTS_g = FAIL; /* Object already exists */
@@ -195,13 +202,6 @@ hid_t H5E_CANTLIST_g = FAIL; /* Unable to list node */
hid_t H5E_CANTMODIFY_g = FAIL; /* Unable to modify record */
hid_t H5E_CANTREMOVE_g = FAIL; /* Unable to remove object */
-/* Argument errors */
-hid_t H5E_UNINITIALIZED_g = FAIL; /* Information is uinitialized */
-hid_t H5E_UNSUPPORTED_g = FAIL; /* Feature is unsupported */
-hid_t H5E_BADTYPE_g = FAIL; /* Inappropriate type */
-hid_t H5E_BADRANGE_g = FAIL; /* Out of range */
-hid_t H5E_BADVALUE_g = FAIL; /* Bad value */
-
/* Datatype conversion errors */
hid_t H5E_CANTCONVERT_g = FAIL; /* Can't convert datatypes */
hid_t H5E_BADSIZE_g = FAIL; /* Bad size for object */
diff --git a/src/H5Einit.h b/src/H5Einit.h
index 2da01ba..a96f798 100644
--- a/src/H5Einit.h
+++ b/src/H5Einit.h
@@ -688,6 +688,33 @@ if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't compare objects"))==NULL)
if((H5E_CANTCOMPARE_g = H5I_register(H5I_ERROR_MSG, msg))<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
+/* Argument errors */
+assert(H5E_UNINITIALIZED_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MINOR, "Information is uinitialized"))==NULL)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
+if((H5E_UNINITIALIZED_g = H5I_register(H5I_ERROR_MSG, msg))<0)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
+assert(H5E_UNSUPPORTED_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MINOR, "Feature is unsupported"))==NULL)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
+if((H5E_UNSUPPORTED_g = H5I_register(H5I_ERROR_MSG, msg))<0)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
+assert(H5E_BADTYPE_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MINOR, "Inappropriate type"))==NULL)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
+if((H5E_BADTYPE_g = H5I_register(H5I_ERROR_MSG, msg))<0)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
+assert(H5E_BADRANGE_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MINOR, "Out of range"))==NULL)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
+if((H5E_BADRANGE_g = H5I_register(H5I_ERROR_MSG, msg))<0)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
+assert(H5E_BADVALUE_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MINOR, "Bad value"))==NULL)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
+if((H5E_BADVALUE_g = H5I_register(H5I_ERROR_MSG, msg))<0)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
+
/* B-tree related errors */
assert(H5E_NOTFOUND_g==(-1));
if((msg = H5E_create_msg(cls, H5E_MINOR, "Object not found"))==NULL)
@@ -745,33 +772,6 @@ if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to remove object"))==NULL)
if((H5E_CANTREMOVE_g = H5I_register(H5I_ERROR_MSG, msg))<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-/* Argument errors */
-assert(H5E_UNINITIALIZED_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MINOR, "Information is uinitialized"))==NULL)
- HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_UNINITIALIZED_g = H5I_register(H5I_ERROR_MSG, msg))<0)
- HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-assert(H5E_UNSUPPORTED_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MINOR, "Feature is unsupported"))==NULL)
- HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_UNSUPPORTED_g = H5I_register(H5I_ERROR_MSG, msg))<0)
- HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-assert(H5E_BADTYPE_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MINOR, "Inappropriate type"))==NULL)
- HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_BADTYPE_g = H5I_register(H5I_ERROR_MSG, msg))<0)
- HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-assert(H5E_BADRANGE_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MINOR, "Out of range"))==NULL)
- HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_BADRANGE_g = H5I_register(H5I_ERROR_MSG, msg))<0)
- HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-assert(H5E_BADVALUE_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MINOR, "Bad value"))==NULL)
- HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_BADVALUE_g = H5I_register(H5I_ERROR_MSG, msg))<0)
- HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-
/* Datatype conversion errors */
assert(H5E_CANTCONVERT_g==(-1));
if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't convert datatypes"))==NULL)
diff --git a/src/H5Epubgen.h b/src/H5Epubgen.h
index 7c517cf..393b6f4 100644
--- a/src/H5Epubgen.h
+++ b/src/H5Epubgen.h
@@ -312,6 +312,18 @@ H5_DLLVAR hid_t H5E_CANTNEXT_g; /* Can't move to next iterator location */
H5_DLLVAR hid_t H5E_BADSELECT_g; /* Invalid selection */
H5_DLLVAR hid_t H5E_CANTCOMPARE_g; /* Can't compare objects */
+/* Argument errors */
+#define H5E_UNINITIALIZED (H5OPEN H5E_UNINITIALIZED_g)
+#define H5E_UNSUPPORTED (H5OPEN H5E_UNSUPPORTED_g)
+#define H5E_BADTYPE (H5OPEN H5E_BADTYPE_g)
+#define H5E_BADRANGE (H5OPEN H5E_BADRANGE_g)
+#define H5E_BADVALUE (H5OPEN H5E_BADVALUE_g)
+H5_DLLVAR hid_t H5E_UNINITIALIZED_g; /* Information is uinitialized */
+H5_DLLVAR hid_t H5E_UNSUPPORTED_g; /* Feature is unsupported */
+H5_DLLVAR hid_t H5E_BADTYPE_g; /* Inappropriate type */
+H5_DLLVAR hid_t H5E_BADRANGE_g; /* Out of range */
+H5_DLLVAR hid_t H5E_BADVALUE_g; /* Bad value */
+
/* B-tree related errors */
#define H5E_NOTFOUND (H5OPEN H5E_NOTFOUND_g)
#define H5E_EXISTS (H5OPEN H5E_EXISTS_g)
@@ -336,18 +348,6 @@ H5_DLLVAR hid_t H5E_CANTLIST_g; /* Unable to list node */
H5_DLLVAR hid_t H5E_CANTMODIFY_g; /* Unable to modify record */
H5_DLLVAR hid_t H5E_CANTREMOVE_g; /* Unable to remove object */
-/* Argument errors */
-#define H5E_UNINITIALIZED (H5OPEN H5E_UNINITIALIZED_g)
-#define H5E_UNSUPPORTED (H5OPEN H5E_UNSUPPORTED_g)
-#define H5E_BADTYPE (H5OPEN H5E_BADTYPE_g)
-#define H5E_BADRANGE (H5OPEN H5E_BADRANGE_g)
-#define H5E_BADVALUE (H5OPEN H5E_BADVALUE_g)
-H5_DLLVAR hid_t H5E_UNINITIALIZED_g; /* Information is uinitialized */
-H5_DLLVAR hid_t H5E_UNSUPPORTED_g; /* Feature is unsupported */
-H5_DLLVAR hid_t H5E_BADTYPE_g; /* Inappropriate type */
-H5_DLLVAR hid_t H5E_BADRANGE_g; /* Out of range */
-H5_DLLVAR hid_t H5E_BADVALUE_g; /* Bad value */
-
/* Datatype conversion errors */
#define H5E_CANTCONVERT (H5OPEN H5E_CANTCONVERT_g)
#define H5E_BADSIZE (H5OPEN H5E_BADSIZE_g)
diff --git a/src/H5Eterm.h b/src/H5Eterm.h
index a188ab4..3825203 100644
--- a/src/H5Eterm.h
+++ b/src/H5Eterm.h
@@ -184,6 +184,13 @@ H5E_CANTNEXT_g=
H5E_BADSELECT_g=
H5E_CANTCOMPARE_g=
+/* Argument errors */
+H5E_UNINITIALIZED_g=
+H5E_UNSUPPORTED_g=
+H5E_BADTYPE_g=
+H5E_BADRANGE_g=
+H5E_BADVALUE_g=
+
/* B-tree related errors */
H5E_NOTFOUND_g=
H5E_EXISTS_g=
@@ -197,13 +204,6 @@ H5E_CANTLIST_g=
H5E_CANTMODIFY_g=
H5E_CANTREMOVE_g=
-/* Argument errors */
-H5E_UNINITIALIZED_g=
-H5E_UNSUPPORTED_g=
-H5E_BADTYPE_g=
-H5E_BADRANGE_g=
-H5E_BADVALUE_g=
-
/* Datatype conversion errors */
H5E_CANTCONVERT_g=
H5E_BADSIZE_g= (-1);
diff --git a/src/H5F.c b/src/H5F.c
index 01f426c..76f98f3 100644
--- a/src/H5F.c
+++ b/src/H5F.c
@@ -944,6 +944,8 @@ H5F_new(H5F_file_t *shared, hid_t fcpl_id, hid_t fapl_id, H5FD_t *lf)
f->shared->base_addr = HADDR_UNDEF;
f->shared->freespace_addr = HADDR_UNDEF;
f->shared->sohm_addr = HADDR_UNDEF;
+ f->shared->sohm_vers = 0;
+ f->shared->sohm_nindexes = 0;
f->shared->driver_addr = HADDR_UNDEF;
f->shared->lf = lf;
@@ -977,7 +979,7 @@ H5F_new(H5F_file_t *shared, hid_t fcpl_id, hid_t fapl_id, H5FD_t *lf)
/* The shared object header message table gets created later, but if
* it is present we should use version 2 of the superblock.
*/
- if(H5P_get(plist, H5F_CRT_SOHM_NINDEXES_NAME, &sohm_indexes)<0)
+ if(H5P_get(plist, H5F_CRT_SHMSG_NINDEXES_NAME, &sohm_indexes)<0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get number of SOHM indexes")
if(sohm_indexes > 0) {
@@ -1412,7 +1414,7 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t d
if(NULL == (c_plist = H5P_object_verify(fcpl_id,H5P_FILE_CREATE)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, NULL, "can't find object for ID");
- if(H5P_get(c_plist, H5F_CRT_SOHM_NINDEXES_NAME, &num_sohm_indexes)<0)
+ if(H5P_get(c_plist, H5F_CRT_SHMSG_NINDEXES_NAME, &num_sohm_indexes)<0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get SOHM information")
if(num_sohm_indexes > 0)
diff --git a/src/H5Fdbg.c b/src/H5Fdbg.c
index 1377c36..3ac3abc 100644
--- a/src/H5Fdbg.c
+++ b/src/H5Fdbg.c
@@ -127,7 +127,11 @@ H5F_debug(H5F_t *f, hid_t dxpl_id, FILE * stream, int indent, int fwidth)
HDfprintf(stream, "%*s%-*s %a (rel)\n", indent, "", fwidth,
"Free list address:", f->shared->freespace_addr);
HDfprintf(stream, "%*s%-*s %a (rel)\n", indent, "", fwidth,
- "Shared object header table address:", f->shared->sohm_addr);
+ "Shared object header message table address:", f->shared->sohm_addr);
+ HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
+ "Shared object header message version number:", (unsigned) f->shared->sohm_vers);
+ HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
+ "Number of shared object header message indexes:", (unsigned) f->shared->sohm_nindexes);
HDfprintf(stream, "%*s%-*s %a (rel)\n", indent, "", fwidth,
"Address of driver information block:", f->shared->driver_addr);
diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h
index 081c970..a58c413 100644
--- a/src/H5Fpkg.h
+++ b/src/H5Fpkg.h
@@ -59,7 +59,7 @@
#endif
/* Maximum size of super-block buffer */
-#define H5F_SUPERBLOCK_SIZE 128
+#define H5F_SUPERBLOCK_SIZE 130
#define H5F_DRVINFOBLOCK_SIZE 1024
/* Define the HDF5 file signature */
@@ -93,6 +93,8 @@ typedef struct H5F_file_t {
haddr_t base_addr; /* Absolute base address for rel.addrs. */
haddr_t freespace_addr; /* Relative address of free-space info */
haddr_t sohm_addr; /* Relative address of shared object header message table */
+ unsigned sohm_vers; /* Version of shared message table on disk */
+ unsigned sohm_nindexes; /* Number of shared messages indexes in the table */
haddr_t driver_addr; /* File driver information block address*/
hbool_t fam_to_sec2; /* Is h5repart changing driver from family to sec2 */
diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h
index 25b8f98..f28c8c1 100644
--- a/src/H5Fprivate.h
+++ b/src/H5Fprivate.h
@@ -341,10 +341,11 @@ typedef struct H5F_t H5F_t;
#define H5F_CRT_FREESPACE_VERS_NAME "free_space_version" /* Free-space version number */
#define H5F_CRT_OBJ_DIR_VERS_NAME "obj_dir_version" /* Object directory version number */
#define H5F_CRT_SHARE_HEAD_VERS_NAME "share_head_version" /* Shared-header format version */
-#define H5F_CRT_SOHM_NINDEXES_NAME "num_sohm_indexes" /* Number of shared object header message indexes */
-#define H5F_CRT_INDEX_TYPES_NAME "sohm_message_types" /* Types of message in each index */
-#define H5F_CRT_SOHM_L2B_NAME "sohm_list_to_btree" /* SOHM list maximum size */
-#define H5F_CRT_SOHM_B2L_NAME "sohm_btree_to_list" /* SOHM B-tree minimum size */
+#define H5F_CRT_SHMSG_NINDEXES_NAME "num_shmsg_indexes" /* Number of shared object header message indexes */
+#define H5F_CRT_SHMSG_INDEX_TYPES_NAME "shmsg_message_types" /* Types of message in each index */
+#define H5F_CRT_SHMSG_INDEX_MINSIZE_NAME "shmsg_message_minsize" /* Minimum size of messages in each index */
+#define H5F_CRT_SHMSG_LIST_MAX_NAME "shmsg_list_max" /* Shared message list maximum size */
+#define H5F_CRT_SHMSG_BTREE_MIN_NAME "shmsg_btree_min" /* Shared message B-tree minimum size */
diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c
index 234c08d..a77030c 100644
--- a/src/H5Fsuper.c
+++ b/src/H5Fsuper.c
@@ -240,9 +240,11 @@ H5F_read_superblock(H5F_t *f, hid_t dxpl_id, H5G_loc_t *root_loc, haddr_t addr,
H5F_addr_decode(f, (const uint8_t **)&p, &shared->base_addr/*out*/);
H5F_addr_decode(f, (const uint8_t **)&p, &shared->freespace_addr/*out*/);
- /* If the superblock version is greater than 1, read in the shared OH message table address */
+ /* If the superblock version is greater than 1, read in the shared OH message table information */
if(super_vers > 1) {
H5F_addr_decode(f, (const uint8_t **)&p, &shared->sohm_addr/*out*/);
+ shared->sohm_vers = *p++;
+ shared->sohm_nindexes = *p++;
}
H5F_addr_decode(f, (const uint8_t **)&p, &stored_eoa/*out*/);
H5F_addr_decode(f, (const uint8_t **)&p, &shared->driver_addr/*out*/);
@@ -374,27 +376,27 @@ H5F_read_superblock(H5F_t *f, hid_t dxpl_id, H5G_loc_t *root_loc, haddr_t addr,
size_t sohm_l2b; /* SOHM list-to-btree cutoff */
size_t sohm_b2l; /* SOHM btree-to-list cutoff */
+ HDassert(shared->sohm_nindexes > 0 && shared->sohm_nindexes <= H5SM_MAX_NUM_INDEXES);
+
/* Read in the shared OH message information if there is any */
- if(H5SM_get_info(f, shared->sohm_addr, &nindexes, index_flags, &sohm_l2b, &sohm_b2l, dxpl_id) < 0)
+ if(H5SM_get_info(f, index_flags, &sohm_l2b, &sohm_b2l, dxpl_id) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to read SOHM table information")
- HDassert(nindexes > 0 && nindexes <= H5SM_MAX_NUM_INDEXES);
-
/* Set values in the property list */
- if(H5P_set(c_plist, H5F_CRT_SOHM_NINDEXES_NAME, &nindexes) < 0)
+ if(H5P_set(c_plist, H5F_CRT_SHMSG_NINDEXES_NAME, &(shared->sohm_nindexes)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set number of SOHM indexes");
- if(H5P_set(c_plist, H5F_CRT_INDEX_TYPES_NAME, index_flags) < 0)
+ if(H5P_set(c_plist, H5F_CRT_SHMSG_INDEX_TYPES_NAME, index_flags) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set type flags for indexes");
- if(H5P_set(c_plist, H5F_CRT_SOHM_L2B_NAME, &sohm_l2b) < 0)
+ if(H5P_set(c_plist, H5F_CRT_SHMSG_LIST_MAX_NAME, &sohm_l2b) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set SOHM cutoff in property list");
- if(H5P_set(c_plist, H5F_CRT_SOHM_B2L_NAME, &sohm_b2l) < 0)
+ if(H5P_set(c_plist, H5F_CRT_SHMSG_BTREE_MIN_NAME, &sohm_b2l) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set SOHM cutoff in property list");
}
else
{
/* Shared object header messages are disabled */
nindexes = 0;
- if(H5P_set(c_plist, H5F_CRT_SOHM_NINDEXES_NAME, &nindexes) < 0)
+ if(H5P_set(c_plist, H5F_CRT_SHMSG_NINDEXES_NAME, &nindexes) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set number of SOHM indexes");
}
@@ -459,7 +461,7 @@ H5F_init_superblock(const H5F_t *f, hid_t dxpl_id)
+ 16 /* Length of required fixed-size portion */
+ ((super_vers>0) ? 4 : 0) /* Version specific fixed-size portion */
+ 4 * H5F_sizeof_addr(f) /* Variable-sized addresses */
- + (super_vers>1 ? H5F_sizeof_addr(f) : 0) + /*SOHM table address*/
+ + (super_vers>1 ? H5F_sizeof_addr(f) + 2: 0) + /*SOHM table info*/
+ H5G_SIZEOF_ENTRY(f); /* Size of root group symbol table entry */
/* Compute the size of the driver information block. */
@@ -587,6 +589,8 @@ H5F_write_superblock(H5F_t *f, hid_t dxpl_id)
H5F_addr_encode(f, &p, f->shared->freespace_addr);
if(super_vers > 1) {
H5F_addr_encode(f, &p, f->shared->sohm_addr);
+ *p++ = f->shared->sohm_vers;
+ *p++ = f->shared->sohm_nindexes;
}
H5F_addr_encode(f, &p, H5FD_get_eoa(f->shared->lf));
H5F_addr_encode(f, &p, f->shared->driver_addr);
diff --git a/src/H5Opublic.h b/src/H5Opublic.h
index bb61f8b..9576ff1 100644
--- a/src/H5Opublic.h
+++ b/src/H5Opublic.h
@@ -41,6 +41,22 @@
#define H5O_COPY_PRESERVE_NULL_FLAG (0x0020u) /* Copy NULL messages (empty space) */
#define H5O_COPY_ALL (0x003Fu) /* All object copying flags (for internal checking) */
+/* Flags for shared message indexes.
+ * Pass these flags in using the mesg_type_flags parameter in
+ * H5P_set_shared_mesg_index.
+ * (Developers: These flags correspond to object header message type_ids,
+ * but we need to assign each kind of message to a different bit so that
+ * one index can hold multiple types.)
+ */
+#define H5O_MESG_NONE_FLAG 0x0000 /* No shared messages */
+#define H5O_MESG_SDSPACE_FLAG 0x0001 /* Simple Dataspace Message. */
+#define H5O_MESG_DTYPE_FLAG 0x0002 /* Datatype Message. */
+#define H5O_MESG_FILL_FLAG 0x0004 /* Fill Value Message. */
+#define H5O_MESG_PLINE_FLAG 0x0008 /* Filter pipeline message. */
+#define H5O_MESG_ATTR_FLAG 0x0010 /* Attribute Message. */
+#define H5O_MESG_ALL_FLAG (H5O_MESG_SDSPACE_FLAG | H5O_MESG_DTYPE_FLAG | H5O_MESG_FILL_FLAG | H5O_MESG_PLINE_FLAG | H5O_MESG_ATTR_FLAG)
+
+
typedef struct H5O_stat_t {
hsize_t size; /* Total size of object header in file */
hsize_t free; /* Free space within object header */
diff --git a/src/H5Pfcpl.c b/src/H5Pfcpl.c
index 7c7012b..b4ba4b9 100644
--- a/src/H5Pfcpl.c
+++ b/src/H5Pfcpl.c
@@ -73,16 +73,18 @@
#define H5F_CRT_SHARE_HEAD_VERS_SIZE sizeof(unsigned)
#define H5F_CRT_SHARE_HEAD_VERS_DEF HDF5_SHAREDHEADER_VERSION
/* Definitions for shared object header messages */
-#define H5F_CRT_SOHM_NINDEXES_SIZE sizeof(unsigned)
-#define H5F_CRT_SOHM_NINDEXES_DEF (0)
-#define H5F_CRT_INDEX_TYPES_SIZE sizeof(unsigned[H5SM_MAX_NUM_INDEXES])
-#define H5F_CRT_INDEX_TYPES_DEF { 0,0,0,0,0,0}
-/*#define H5SM_INDEX_TYPES_DEF { H5SM_FILL_FLAG |H5SM_SDSPACE_FLAG,H5SM_ATTR_FLAG, 0, H5SM_DTYPE_FLAG,0,H5SM_PLINE_FLAG} JAMES */
-/* Definitions for shared object header list/btree cutoffs */
-#define H5F_CRT_SOHM_L2B_SIZE sizeof(size_t)
-#define H5F_CRT_SOHM_L2B_DEF (50) /* JAMES */
-#define H5F_CRT_SOHM_B2L_SIZE sizeof(size_t)
-#define H5F_CRT_SOHM_B2L_DEF (40) /* JAMES */
+#define H5F_CRT_SHMSG_NINDEXES_SIZE sizeof(unsigned)
+#define H5F_CRT_SHMSG_NINDEXES_DEF (0)
+#define H5F_CRT_SHMSG_INDEX_TYPES_SIZE sizeof(unsigned[H5SM_MAX_NUM_INDEXES])
+#define H5F_CRT_SHMSG_INDEX_TYPES_DEF {0,0,0,0,0,0}
+// JAMES #define H5F_CRT_SHMSG_INDEX_TYPES_DEF { H5O_MESG_FILL_FLAG |H5O_MESG_SDSPACE_FLAG,H5O_MESG_ATTR_FLAG, 0, H5O_MESG_DTYPE_FLAG,0,H5O_MESG_PLINE_FLAG}
+#define H5F_CRT_SHMSG_INDEX_MINSIZE_SIZE sizeof(unsigned[H5SM_MAX_NUM_INDEXES])
+#define H5F_CRT_SHMSG_INDEX_MINSIZE_DEF {250,250,250,250,250,250}
+/* Definitions for shared object header list/btree phase change cutoffs */
+#define H5F_CRT_SHMSG_LIST_MAX_SIZE sizeof(unsigned)
+#define H5F_CRT_SHMSG_LIST_MAX_DEF (50)
+#define H5F_CRT_SHMSG_BTREE_MIN_SIZE sizeof(unsigned)
+#define H5F_CRT_SHMSG_BTREE_MIN_DEF (40)
/******************/
@@ -108,7 +110,7 @@ static herr_t H5P_fcrt_reg_prop(H5P_genclass_t *pclass);
/* File creation property list class library initialization object */
const H5P_libclass_t H5P_CLS_FCRT[1] = {{
- "file create", /* Class name for debugging */
+ "file create", /* Class name for debugging */
&H5P_CLS_GROUP_CREATE_g, /* Parent class ID */
&H5P_CLS_FILE_CREATE_g, /* Pointer to class ID */
&H5P_LST_FILE_CREATE_g, /* Pointer to default property list ID */
@@ -156,10 +158,11 @@ H5P_fcrt_reg_prop(H5P_genclass_t *pclass)
unsigned freespace_ver = H5F_CRT_FREESPACE_VERS_DEF;/* Default free space version # */
unsigned objectdir_ver = H5F_CRT_OBJ_DIR_VERS_DEF; /* Default object directory version # */
unsigned sharedheader_ver = H5F_CRT_SHARE_HEAD_VERS_DEF; /* Default shared header message version # */
- unsigned num_sohm_indexes = H5F_CRT_SOHM_NINDEXES_DEF;
- unsigned sohm_index_flags[H5SM_MAX_NUM_INDEXES] = H5F_CRT_INDEX_TYPES_DEF;
- size_t sohm_list_to_btree = H5F_CRT_SOHM_L2B_DEF;
- size_t sohm_btree_to_list = H5F_CRT_SOHM_B2L_DEF;
+ unsigned num_sohm_indexes = H5F_CRT_SHMSG_NINDEXES_DEF;
+ unsigned sohm_index_flags[H5SM_MAX_NUM_INDEXES] = H5F_CRT_SHMSG_INDEX_TYPES_DEF;
+ unsigned sohm_index_minsizes[H5SM_MAX_NUM_INDEXES] = H5F_CRT_SHMSG_INDEX_MINSIZE_DEF;
+ size_t sohm_list_max = H5F_CRT_SHMSG_LIST_MAX_DEF;
+ size_t sohm_btree_min = H5F_CRT_SHMSG_BTREE_MIN_DEF;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5P_fcrt_reg_prop)
@@ -201,15 +204,17 @@ H5P_fcrt_reg_prop(H5P_genclass_t *pclass)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the shared OH message information */
- if(H5P_register(pclass,H5F_CRT_SOHM_NINDEXES_NAME, H5F_CRT_SOHM_NINDEXES_SIZE, &num_sohm_indexes,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ if(H5P_register(pclass,H5F_CRT_SHMSG_NINDEXES_NAME, H5F_CRT_SHMSG_NINDEXES_SIZE, &num_sohm_indexes,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
- if(H5P_register(pclass,H5F_CRT_INDEX_TYPES_NAME, H5F_CRT_INDEX_TYPES_SIZE, &sohm_index_flags,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ if(H5P_register(pclass,H5F_CRT_SHMSG_INDEX_TYPES_NAME, H5F_CRT_SHMSG_INDEX_TYPES_SIZE, &sohm_index_flags,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
+ if(H5P_register(pclass,H5F_CRT_SHMSG_INDEX_MINSIZE_NAME, H5F_CRT_SHMSG_INDEX_MINSIZE_SIZE, &sohm_index_minsizes,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the shared OH cutoff size information */
- if(H5P_register(pclass,H5F_CRT_SOHM_L2B_NAME, H5F_CRT_SOHM_L2B_SIZE, &sohm_list_to_btree,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ if(H5P_register(pclass,H5F_CRT_SHMSG_LIST_MAX_NAME, H5F_CRT_SHMSG_LIST_MAX_SIZE, &sohm_list_max,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
- if(H5P_register(pclass,H5F_CRT_SOHM_B2L_NAME, H5F_CRT_SOHM_B2L_SIZE, &sohm_btree_to_list,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ if(H5P_register(pclass,H5F_CRT_SHMSG_BTREE_MIN_NAME, H5F_CRT_SHMSG_BTREE_MIN_SIZE, &sohm_btree_min,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
done:
@@ -727,12 +732,12 @@ H5Pset_shared_mesgs(hid_t plist_id, unsigned nindexes, const unsigned mesg_type_
if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_CREATE)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
- flags_used = H5SM_NONE_FLAG;
+ flags_used = H5O_MESG_NONE_FLAG;
for (i=0; i<nindexes; i++) {
- if (mesg_type_flags[i] == H5SM_NONE_FLAG)
+ if (mesg_type_flags[i] == H5O_MESG_NONE_FLAG)
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "at least one flag must be set");
- if (mesg_type_flags[i] != (mesg_type_flags[i] & H5SM_ALL_FLAG))
+ if (mesg_type_flags[i] != (mesg_type_flags[i] & H5O_MESG_ALL_FLAG))
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid mesg type flag set");
if (mesg_type_flags[i] & flags_used)
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "flag set for two different indexes");
@@ -740,9 +745,9 @@ H5Pset_shared_mesgs(hid_t plist_id, unsigned nindexes, const unsigned mesg_type_
flags_used |= mesg_type_flags[i]; /* Make sure the user doesn't re-use a flag */
} /* end for */
- if(H5P_set(plist, H5F_CRT_SOHM_NINDEXES_NAME, &nindexes) < 0)
+ if(H5P_set(plist, H5F_CRT_SHMSG_NINDEXES_NAME, &nindexes) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set number of SOHM indexes");
- if(H5P_set(plist, H5F_CRT_INDEX_TYPES_NAME, type_flags) < 0)
+ if(H5P_set(plist, H5F_CRT_SHMSG_INDEX_TYPES_NAME, type_flags) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set type flags for indexes");
done:
@@ -751,10 +756,14 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Pget_shared_nindexes
+ * Function: H5Pset_shared_mesg_nindexes
*
- * Purpose: Get the number of Shared Object Header Message (SOHM)
- * indexes specified in this property list.
+ * Purpose: Set the number of Shared Object Header Message (SOHM)
+ * indexes specified in this property list. If this is
+ * zero then shared object header messages are disabled
+ * for this file.
+ *
+ * These indexes can be configured with JAMES
*
* Return: Non-negative on success/Negative on failure
*
@@ -764,93 +773,70 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Pget_shared_nindexes(hid_t plist_id, unsigned *nindexes)
+H5Pset_shared_mesg_nindexes(hid_t plist_id, unsigned nindexes)
{
H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_API(H5Pget_shared_nindexes, FAIL);
- H5TRACE2("e","i*Iu",plist_id,nindexes);
+ FUNC_ENTER_API(H5Pset_shared_mesg_nindexes, FAIL);
+ H5TRACE2("e","iIu",plist_id,nindexes);
+
+ /* Check argument */
+ if (nindexes > H5SM_MAX_NUM_INDEXES)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "number of indexes is greater than H5SM_MAX_NUM_INDEXES");
/* Get the plist structure */
if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_CREATE)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
- if(H5P_get(plist, H5F_CRT_SOHM_NINDEXES_NAME, nindexes) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get number of indexes");
+ if(H5P_set(plist, H5F_CRT_SHMSG_NINDEXES_NAME, &nindexes) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set number of indexes");
done:
FUNC_LEAVE_API(ret_value);
-
}
+
/*-------------------------------------------------------------------------
- * Function: H5Pget_shared_mesg_types
- *
- * Purpose: Get the mesg_type_flags array for this property list.
- * At most max_nindexes values will be copied to the
- * mesg_type_flags array.
+ * Function: H5Pget_shared_imesg_nindexes
*
- * Each entry in the array represents the types of messages
- * to be shared in the corresponding Shared Object Header
- * Message (SOHM) index.
+ * Purpose: Get the number of Shared Object Header Message (SOHM)
+ * indexes specified in this property list.
*
* Return: Non-negative on success/Negative on failure
*
* Programmer: James Laird
- * Wednesday, April 5, 2006
+ * Monday, October 9, 2006
*
*-------------------------------------------------------------------------
*/
herr_t
-H5Pget_shared_mesg_types(hid_t plist_id, unsigned max_nindexes, unsigned mesg_type_flags[])
+H5Pget_shared_mesg_nindexes(hid_t plist_id, unsigned *nindexes)
{
H5P_genplist_t *plist; /* Property list pointer */
- unsigned nindexes; /* Number of SOHM indexes */
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_API(H5Pget_shared_mesg_types, FAIL);
- H5TRACE3("e","iIu*Iu",plist_id,max_nindexes,mesg_type_flags);
+ FUNC_ENTER_API(H5Pget_shared_mesg_nindexes, FAIL);
+ H5TRACE2("e","i*Iu",plist_id,nindexes);
/* Get the plist structure */
if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_CREATE)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
- if(H5P_get(plist, H5F_CRT_SOHM_NINDEXES_NAME, &nindexes) < 0)
+ if(H5P_get(plist, H5F_CRT_SHMSG_NINDEXES_NAME, nindexes) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get number of indexes");
- if(mesg_type_flags) {
- unsigned i;
- unsigned type_flags[H5SM_MAX_NUM_INDEXES];
-
- /* JAMES: make this H5F_CRT_SOHM_IDX_TYPES_NAME or something? */
- if(H5P_get(plist, H5F_CRT_INDEX_TYPES_NAME, type_flags) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get index types");
-
- /* Get the flags */
- for (i=0; i<nindexes && i<max_nindexes; ++i)
- mesg_type_flags[i] = type_flags[i];
- } /* end if */
-
done:
FUNC_LEAVE_API(ret_value);
-}
+}
/*-------------------------------------------------------------------------
- * Function: H5Pset_sohm_list_max
+ * Function: H5Pset_shared_mesg_index
*
- * Purpose: Sets the maximum size for a list storing Shared Object
- * Header Messages in this file. If more than this many
- * messages are stored in an index, that index will become a
- * B-tree.
- *
- * This value must be no greater than the list maximum plus
- * one (i.e., there cannot be any values which are too many
- * for a list but too few for a B-tree).
- *
- * If this is zero then SOHM indexes in this file will never
- * be lists but will be created as B-trees.
+ * Purpose: Configure a given shared message index. Sets the types of
+ * message that should be stored in this index and the minimum
+ * size of a message in the index.
*
* Return: Non-negative on success/Negative on failure
*
@@ -860,32 +846,69 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Pset_sohm_list_max(hid_t plist_id, size_t max)
+H5Pset_shared_mesg_index(hid_t plist_id, unsigned index_num, unsigned mesg_type_flags, unsigned min_mesg_size)
{
H5P_genplist_t *plist; /* Property list pointer */
+ unsigned nindexes; /* Number of SOHM indexes */
+ unsigned type_flags[H5SM_MAX_NUM_INDEXES]; /* Array of mesg_type_flags*/
+ unsigned minsizes[H5SM_MAX_NUM_INDEXES]; /* Array of min_mesg_sizes*/
+ unsigned x;
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_API(H5Pset_sohm_list_max, FAIL);
- H5TRACE2("e","iz",plist_id,max);
+ FUNC_ENTER_API(H5Pset_shared_mesg_index, FAIL);
+ H5TRACE4("e","iIuIuIu",plist_id,index_num,mesg_type_flags,min_mesg_size);
+
+ /* Check arguments */
+ if(index_num == 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "index_num must be at least 1");
+ if(mesg_type_flags > H5O_MESG_ALL_FLAG)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "unrecognized flags in mesg_type_flags");
/* Get the plist structure */
if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_CREATE)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
- /* No need to check value in max, since it cannot be negative */
- if(H5P_set(plist, H5F_CRT_SOHM_L2B_NAME, &max) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set SOHM information");
+ /* Read the current number of indexes */
+ if(H5P_get(plist, H5F_CRT_SHMSG_NINDEXES_NAME, &nindexes) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get number of indexes");
+
+ if(index_num > nindexes)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "index_num is greater than number of indexes in property list");
+
+ /* Get arrays of type flags and message sizes */
+ if(H5P_get(plist, H5F_CRT_SHMSG_INDEX_TYPES_NAME, type_flags) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get current index type flags")
+ if(H5P_get(plist, H5F_CRT_SHMSG_INDEX_MINSIZE_NAME, minsizes) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get current min sizes")
+
+ /* Set values in arrays */
+ type_flags[index_num - 1] = mesg_type_flags;
+ minsizes[index_num - 1] = min_mesg_size;
+
+ /* Check that type flags does introduce any duplicate values */
+ for(x=0; x < nindexes; ++x) {
+ if(x != (index_num - 1) && (type_flags[index_num - 1] & type_flags[x]) != 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't assign the same flag to different indexes")
+ }
+
+ /* Write arrays back to plist */
+ if(H5P_set(plist, H5F_CRT_SHMSG_INDEX_TYPES_NAME, type_flags) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set index type flags");
+ if(H5P_set(plist, H5F_CRT_SHMSG_INDEX_MINSIZE_NAME, minsizes) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set min mesg sizes");
done:
FUNC_LEAVE_API(ret_value);
}
+
/*-------------------------------------------------------------------------
- * Function: H5Pget_sohm_list_max
+ * Function: H5Pget_shared_mesg_index
*
- * Purpose: Gets the maximum size of a SOHM list index before it becomes
- * a B-tree.
+ * Purpose: Get information about a given shared message index. Gets
+ * the types of message that are stored in the index and the
+ * minimum size of a message in the index.
*
* Return: Non-negative on success/Negative on failure
*
@@ -895,39 +918,61 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Pget_sohm_list_max(hid_t plist_id, size_t *max)
+H5Pget_shared_mesg_index(hid_t plist_id, unsigned index_num, unsigned *mesg_type_flags, unsigned *min_mesg_size)
{
H5P_genplist_t *plist; /* Property list pointer */
+ unsigned nindexes; /* Number of SOHM indexes */
+ unsigned type_flags[H5SM_MAX_NUM_INDEXES]; /* Array of mesg_type_flags*/
+ unsigned minsizes[H5SM_MAX_NUM_INDEXES]; /* Array of min_mesg_sizes*/
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_API(H5Pget_sohm_list_max, FAIL);
- H5TRACE2("e","i*z",plist_id,max);
+ FUNC_ENTER_API(H5Pget_shared_mesg_index, FAIL);
+ H5TRACE4("e","iIu*Iu*Iu",plist_id,index_num,mesg_type_flags,min_mesg_size);
+
+ /* Check arguments */
+ if(index_num == 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "index_num must be at least 1")
/* Get the plist structure */
if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
- /* Get value */
- if (max) {
- if(H5P_get(plist, H5F_CRT_SOHM_L2B_NAME, max) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get SOHM information");
- }
+ /* Read the current number of indexes */
+ if(H5P_get(plist, H5F_CRT_SHMSG_NINDEXES_NAME, &nindexes) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get number of indexes")
+
+ if(index_num > nindexes)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "index_num is greater than number of indexes in property list")
+
+ /* Get arrays of type flags and message sizes */
+ if(H5P_get(plist, H5F_CRT_SHMSG_INDEX_TYPES_NAME, type_flags) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get current index type flags")
+ if(H5P_get(plist, H5F_CRT_SHMSG_INDEX_MINSIZE_NAME, minsizes) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get current min sizes")
+
+ /* Get values from arrays */
+ if(mesg_type_flags)
+ *mesg_type_flags = type_flags[index_num - 1];
+ if(min_mesg_size)
+ *min_mesg_size = minsizes[index_num - 1];
done:
FUNC_LEAVE_API(ret_value);
}
+
+
/*-------------------------------------------------------------------------
- * Function: H5Pset_sohm_btree_min
+ * Function: H5Pset_shared_mesg_phase_change
*
- * Purpose: Sets the minimum size for a B-tree storing Shared Object
- * Header Messages in this file. If fewer than this many
- * messages are stored in an index, that index will become a
- * list.
+ * Purpose: Sets the cutoff values for indexes storing shared object
+ * header messages in this file. If more than max_list
+ * messages are in an index, that index will become a B-tree.
+ * Likewise, a B-tree index containing fewer than min_btree
+ * messages will be converted to a list.
*
- * This value must be no greater than the list maximum plus
- * one (i.e., there cannot be any values which are too many
- * for a list but too few for a B-tree).
+ * If the max_list is zero then SOHM indexes in this file will
+ * never be lists but will be created as B-trees.
*
* Return: Non-negative on success/Negative on failure
*
@@ -937,21 +982,35 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Pset_sohm_btree_min(hid_t plist_id, size_t min)
+H5Pset_shared_mesg_phase_change(hid_t plist_id, unsigned max_list, unsigned min_btree)
{
H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_API(H5Pset_sohm_btree_min, FAIL);
- H5TRACE2("e","iz",plist_id,min);
+ FUNC_ENTER_API(H5Pset_shared_mesg_phase_change, FAIL);
+ H5TRACE3("e","iIuIu",plist_id,max_list,min_btree);
+
+ /* Check that values are sensible. The min_btree value must be no greater
+ * than the max list plus one.
+ * No need to check values otherwise, since they can't be negative.
+ */
+ if(max_list + 1 < min_btree)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "minimum B-tree value is greater than maximum list value")
+
+ /* Avoid the strange case where max_list == 0 and min_btree == 1, so deleting the
+ * last message in a B-tree makes it become an empty list.
+ */
+ if(max_list == 0)
+ min_btree = 0;
/* Get the plist structure */
if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_CREATE)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
- /* No need to check value in min, since it cannot be negative */
- if(H5P_set(plist, H5F_CRT_SOHM_B2L_NAME, &min) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set SOHM information");
+ if(H5P_set(plist, H5F_CRT_SHMSG_LIST_MAX_NAME, &max_list) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set list maximum in property list");
+ if(H5P_set(plist, H5F_CRT_SHMSG_BTREE_MIN_NAME, &min_btree) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set B-tree minimum in property list");
done:
FUNC_LEAVE_API(ret_value);
@@ -959,38 +1018,42 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Pget_sohm_btree_min
+ * Function: H5Pget_sohm_list_max
*
- * Purpose: Gets the minimum size of a SOHM B-tree index before it becomes
- * a list.
+ * Purpose: Gets the maximum size of a SOHM list index before it becomes
+ * a B-tree.
*
* Return: Non-negative on success/Negative on failure
*
* Programmer: James Laird
- * Thursday, May 11, 2006
+ * Wednesday, April 5, 2006
*
*-------------------------------------------------------------------------
*/
herr_t
-H5Pget_sohm_btree_min(hid_t plist_id, size_t *min)
+H5Pget_shared_mesg_phase_change(hid_t plist_id, unsigned *max_list, unsigned *min_btree)
{
H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_API(H5Pget_sohm_btree_min, FAIL);
- H5TRACE2("e","i*z",plist_id,min);
+ FUNC_ENTER_API(H5Pget_shared_mesg_phase_change, FAIL);
+ H5TRACE3("e","i*Iu*Iu",plist_id,max_list,min_btree);
/* Get the plist structure */
if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_CREATE)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
/* Get value */
- if (min) {
- if(H5P_get(plist, H5F_CRT_SOHM_B2L_NAME, min) < 0)
+ if (max_list) {
+ if(H5P_get(plist, H5F_CRT_SHMSG_LIST_MAX_NAME, max_list) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get list maximum");
+ }
+ if (min_btree) {
+ if(H5P_get(plist, H5F_CRT_SHMSG_BTREE_MIN_NAME, min_btree) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get SOHM information");
}
done:
FUNC_LEAVE_API(ret_value);
}
-
+
diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h
index 2620652..ea929b8 100644
--- a/src/H5Ppublic.h
+++ b/src/H5Ppublic.h
@@ -227,13 +227,12 @@ H5_DLL herr_t H5Pset_sym_k(hid_t plist_id, unsigned ik, unsigned lk);
H5_DLL herr_t H5Pget_sym_k(hid_t plist_id, unsigned *ik/*out*/, unsigned *lk/*out*/);
H5_DLL herr_t H5Pset_istore_k(hid_t plist_id, unsigned ik);
H5_DLL herr_t H5Pget_istore_k(hid_t plist_id, unsigned *ik/*out*/);
-H5_DLL herr_t H5Pset_shared_mesgs(hid_t plist_id, unsigned nindexes, const unsigned * mesg_type_flags);
-H5_DLL herr_t H5Pget_shared_nindexes(hid_t plist_id, unsigned *nindexes);
-H5_DLL herr_t H5Pget_shared_mesg_types(hid_t plist_id, unsigned max_nindexes, unsigned * mesg_type_flags);
-H5_DLL herr_t H5Pset_sohm_list_max(hid_t plist_id, size_t max);
-H5_DLL herr_t H5Pget_sohm_list_max(hid_t plist_id, size_t *max);
-H5_DLL herr_t H5Pset_sohm_btree_min(hid_t plist_id, size_t min);
-H5_DLL herr_t H5Pget_sohm_btree_min(hid_t plist_id, size_t *min);
+H5_DLL herr_t H5Pset_shared_mesg_nindexes(hid_t plist_id, unsigned nindexes);
+H5_DLL herr_t H5Pget_shared_mesg_nindexes(hid_t plist_id, unsigned *nindexes);
+H5_DLL herr_t H5Pset_shared_mesg_index(hid_t plist_id, unsigned index_num, unsigned mesg_type_flags, unsigned min_mesg_size);
+H5_DLL herr_t H5Pget_shared_mesg_index(hid_t plist_id, unsigned index_num, unsigned *mesg_type_flags, unsigned *min_mesg_size);
+H5_DLL herr_t H5Pset_shared_mesg_phase_change(hid_t plist_id, unsigned max_list, unsigned min_btree);
+H5_DLL herr_t H5Pget_shared_mesg_phase_change(hid_t plist_id, unsigned *max_list, unsigned *min_btree);
/* File access property list (FAPL) routines */
diff --git a/src/H5SM.c b/src/H5SM.c
index 79d0c05..6c0e3b5 100755
--- a/src/H5SM.c
+++ b/src/H5SM.c
@@ -52,9 +52,6 @@
/* Local Prototypes */
/********************/
static herr_t H5SM_create_index(H5F_t *f, H5SM_index_header_t *header, hid_t dxpl_id);
-/* JAMES
-static herr_t H5SM_write_index(H5F_t *f, haddr_t index_addr, hsize_t sohm_hash, haddr_t sohm_addr, hid_t dxpl_id);
-*/
static haddr_t H5SM_create_list(H5F_t *f, H5SM_index_header_t *header, hid_t dxpl_id);
static herr_t H5SM_write_mesg(H5F_t *f, hid_t dxpl_id, H5SM_index_header_t *header,
unsigned type_id, void *mesg, unsigned *cache_flags_ptr);
@@ -105,7 +102,7 @@ H5SM_init(H5F_t *f, H5P_genplist_t * fc_plist, hid_t dxpl_id)
H5SM_master_table_t *table = NULL;
haddr_t table_addr = HADDR_UNDEF;
unsigned num_indexes;
- size_t list_to_btree, btree_to_list;
+ unsigned list_to_btree, btree_to_list;
unsigned index_type_flags[H5SM_MAX_NUM_INDEXES];
ssize_t x;
hsize_t table_size;
@@ -122,27 +119,31 @@ H5SM_init(H5F_t *f, H5P_genplist_t * fc_plist, hid_t dxpl_id)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for SOHM table")
/* Get information from fcpl */
- if(H5P_get(fc_plist, H5F_CRT_SOHM_NINDEXES_NAME, &num_indexes)<0)
+ if(H5P_get(fc_plist, H5F_CRT_SHMSG_NINDEXES_NAME, &num_indexes)<0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get SOHM information")
- if(H5P_get(fc_plist, H5F_CRT_INDEX_TYPES_NAME, &index_type_flags)<0)
+ if(H5P_get(fc_plist, H5F_CRT_SHMSG_INDEX_TYPES_NAME, &index_type_flags)<0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get SOHM information")
- if(H5P_get(fc_plist, H5F_CRT_SOHM_L2B_NAME, &list_to_btree)<0)
+ if(H5P_get(fc_plist, H5F_CRT_SHMSG_LIST_MAX_NAME, &list_to_btree)<0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get SOHM information")
- if(H5P_get(fc_plist, H5F_CRT_SOHM_B2L_NAME, &btree_to_list)<0)
+ if(H5P_get(fc_plist, H5F_CRT_SHMSG_BTREE_MIN_NAME, &btree_to_list)<0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get SOHM information")
- /* Right now we just use one byte to hold the number of indexes */
+ /* Set version and number of indexes in table and in superblock.
+ * Right now we just use one byte to hold the number of indexes.
+ */
HDassert(num_indexes < 256);
table->num_indexes = num_indexes;
+ table->version = H5SM_MASTER_TABLE_VERSION;
+
+ f->shared->sohm_nindexes = table->num_indexes;
+ f->shared->sohm_vers = table->version;
/* Check that list and btree cutoffs make sense. There can't be any
* values greater than the list max but less than the btree min; the
* list max has to be greater than or equal to one less than the btree
* min.
*/
- if(list_to_btree + 1 < btree_to_list)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "SOHM list max is less than btree min")
-
+ HDassert(list_to_btree + 1 >= btree_to_list);
HDassert(table->num_indexes > 0 && table->num_indexes <= H5SM_MAX_NUM_INDEXES);
/* Allocate the SOHM indexes as an array. */
@@ -224,19 +225,19 @@ H5SM_get_index(const H5SM_master_table_t *table, unsigned type_id)
switch(type_id)
{
case H5O_SDSPACE_ID:
- type_flag = H5SM_SDSPACE_FLAG;
+ type_flag = H5O_MESG_SDSPACE_FLAG;
break;
case H5O_DTYPE_ID:
- type_flag = H5SM_DTYPE_FLAG;
+ type_flag = H5O_MESG_DTYPE_FLAG;
break;
case H5O_FILL_NEW_ID:
- type_flag = H5SM_FILL_FLAG;
+ type_flag = H5O_MESG_FILL_FLAG;
break;
case H5O_PLINE_ID:
- type_flag = H5SM_PLINE_FLAG;
+ type_flag = H5O_MESG_PLINE_FLAG;
break;
case H5O_ATTR_ID:
- type_flag = H5SM_ATTR_FLAG;
+ type_flag = H5O_MESG_ATTR_FLAG;
break;
default:
HGOTO_ERROR(H5E_OHDR, H5E_BADTYPE, FAIL, "unknown message type ID")
@@ -502,7 +503,7 @@ H5SM_try_share(H5F_t *f, hid_t dxpl_id, unsigned type_id, void *mesg)
/* If the message isn't big enough, don't bother sharing it */
if((mesg_size = H5O_mesg_size(type_id, f, mesg, 0)) <0)
HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, FAIL, "unable to get OH message size")
- if(mesg_size < 15) /* JAMES: arbitrary value. Make this per-index, along with index sizes? */
+ if(mesg_size < 50) /* JAMES: arbitrary value. Make this per-index, along with index sizes? */
HGOTO_DONE(FALSE);
/* JAMES_HEAP: skip this step if it's already shared--just increment the refcount on the message itself */
@@ -679,7 +680,43 @@ H5SM_write_mesg(H5F_t *f, hid_t dxpl_id, H5SM_index_header_t *header,
if(H5HF_insert(fheap, dxpl_id, mesg_size, key.encoding, &(shared.u.heap_id)) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTINSERT, FAIL, "unable to insert message into fractal heap")
- /* JAMES: this is where we should check for conversion to B-tree. */
+ /* Check whether the list has grown enough that it needs to become a B-tree */
+ /* JAMES: make this a separate function */
+ if(header->index_type == H5SM_LIST && header->num_messages > header->list_to_btree)
+ {
+ hsize_t list_size; /* Size of list on disk */
+ haddr_t tree_addr;
+
+ if(H5B2_create(f, dxpl_id, H5SM_INDEX, H5SM_B2_NODE_SIZE,
+ H5SM_SOHM_ENTRY_SIZE(f), H5SM_B2_SPLIT_PERCENT,
+ H5SM_B2_MERGE_PERCENT, &tree_addr) <0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTCREATE, FAIL, "B-tree creation failed for SOHM index")
+
+ /* Insert each record into the new B-tree */
+ for(x=0; x<header->list_to_btree; x++)
+ {
+ /* JAMES: I'd like to stop relying on H5O_HASH_UNDEF */
+ if(list->messages[x].hash != H5O_HASH_UNDEF)
+ {
+ if(H5B2_insert(f, dxpl_id, H5SM_INDEX, tree_addr, &(list->messages[x])) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, FAIL, "couldn't add SOHM to B-tree")
+ }
+ }
+
+ /* Delete the old list */
+ HDassert(list);
+ if(H5AC_unprotect(f, dxpl_id, H5AC_SOHM_LIST, header->index_addr, list, H5AC__DELETED_FLAG) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM index")
+ list = NULL;
+
+ list_size = H5SM_LIST_SIZE(f, header->list_to_btree);
+ if(H5MF_xfree(f, H5FD_MEM_SOHM, dxpl_id, header->index_addr, list_size) < 0)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, HADDR_UNDEF, "unable to free shared message list")
+
+ header->index_addr = tree_addr;
+ header->index_type = H5SM_BTREE;
+ }
+
/* JAMES: should be H5SM_insert or something */
/* Find an empty spot in the list for the message JAMES: combine this with the previous traversal */
@@ -928,6 +965,43 @@ H5SM_delete_from_index(H5F_t *f, hid_t dxpl_id, H5SM_index_header_t *header, uns
/* Update the index header, so set its dirty flag */
--header->num_messages;
*cache_flags |= H5AC__DIRTIED_FLAG;
+
+ /* If we've just passed the btree-to-list cutoff, convert this B-tree
+ * into a list
+ */
+ /* JAMES: there's an off-by-one error here */
+ /* JAMES: make this a separate function */
+ if(header->num_messages < header->btree_to_list)
+ {
+ /* Remember the btree address for this index; we'll overwrite the
+ * address in the index header
+ */
+ haddr_t btree_addr = header->index_addr;
+ H5SM_index_header_t temp_header;
+
+ /* The protect callback expects a header corresponding to the list
+ * index. Create a "temporary" header to hold the old B-tree
+ * index and reset values in the "real" header to point to an
+ * empty list index.
+ */
+ HDmemcpy(&temp_header, header, sizeof(H5SM_index_header_t));
+ header->num_messages = 0;
+ header->index_type = H5SM_LIST;
+
+ /* Create a new list index */
+ if(HADDR_UNDEF == (header->index_addr = H5SM_create_list(f, header, dxpl_id)))
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTINIT, FAIL, "unable to create shared message list")
+
+ HDassert(NULL == list);
+ if (NULL == (list = H5AC_protect(f, dxpl_id, H5AC_SOHM_LIST, header->index_addr, NULL, header, H5AC_WRITE)))
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM index")
+
+ /* Delete the B-tree and have messages copy themselves to the
+ * list as they're deleted
+ */
+ if(H5B2_delete(f, dxpl_id, H5SM_INDEX, temp_header.index_addr, H5SM_convert_to_list_op, list) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTDELETE, FAIL, "unable to delete B-tree")
+ }
}
done:
@@ -961,23 +1035,35 @@ done:
*
*-------------------------------------------------------------------------
*/
-herr_t H5SM_get_info(H5F_t *f, haddr_t table_addr, unsigned *nindexes,
- unsigned *index_flags, size_t *list_to_btree,
+herr_t H5SM_get_info(H5F_t *f, unsigned *index_flags, size_t *list_to_btree,
size_t *btree_to_list, hid_t dxpl_id)
{
- H5SM_master_table_t *table = NULL;
- unsigned i;
+ H5SM_master_table_t *table = NULL;
+ haddr_t table_addr;
+ uint8_t i;
herr_t ret_value = SUCCEED;
FUNC_ENTER_NOAPI(H5SM_get_info, FAIL)
+ HDassert(f);
+
+ /* Convenience variables */
+ table_addr = f->shared->sohm_addr;
+
HDassert(table_addr != HADDR_UNDEF);
+ HDassert(f->shared->sohm_nindexes > 0);
+
+ /* Allocate and initialize the master table structure */
+ if(NULL == (table = H5MM_calloc(sizeof(H5SM_master_table_t))))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
+
+ table->version = f->shared->sohm_vers;
+ table->num_indexes = f->shared->sohm_nindexes;
- /* Get the SOHM table from the cache */
- if (NULL == (table = H5AC_protect(f, dxpl_id, H5AC_SOHM_TABLE, table_addr, NULL, NULL, H5AC_READ)))
+ /* Read the rest of the SOHM table information from the cache */
+ if (NULL == (table = H5AC_protect(f, dxpl_id, H5AC_SOHM_TABLE, table_addr, NULL, table, H5AC_READ)))
HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table")
/* Return info */
- *nindexes = table->num_indexes;
*list_to_btree = table->indexes[0].list_to_btree;
*btree_to_list = table->indexes[0].btree_to_list;
diff --git a/src/H5SMbtree2.c b/src/H5SMbtree2.c
index 7e98b06..666ead7 100755
--- a/src/H5SMbtree2.c
+++ b/src/H5SMbtree2.c
@@ -43,6 +43,7 @@
/* Local Prototypes */
/********************/
+/* JAMES: name these as "H5SM_btree_store", etc? */
static herr_t H5SM_message_store(void *native, const void *udata);
static herr_t H5SM_message_retrieve(void *udata, const void *native);
static herr_t H5SM_message_debug(FILE *stream, const H5F_t *f, hid_t dxpl_id,
@@ -207,7 +208,7 @@ H5SM_message_encode(const H5F_t *f, uint8_t *raw, const void *_nrecord)
/* Encode the SOHM's fields */
UINT32ENCODE(raw, message->hash);
- UINT16ENCODE(raw, message->ref_count);
+ UINT32ENCODE(raw, message->ref_count);
UINT64ENCODE(raw, message->fheap_id);
FUNC_LEAVE_NOAPI(SUCCEED)
@@ -227,6 +228,7 @@ H5SM_message_encode(const H5F_t *f, uint8_t *raw, const void *_nrecord)
*
*-------------------------------------------------------------------------
*/
+/* JAMES: can we combine this with H5SMcache functions? */
herr_t
H5SM_message_decode(const H5F_t *f, const uint8_t *raw, void *_nrecord)
{
@@ -236,7 +238,7 @@ H5SM_message_decode(const H5F_t *f, const uint8_t *raw, void *_nrecord)
/* Encode the SOHM's fields */
UINT32DECODE(raw, message->hash);
- UINT16DECODE(raw, message->ref_count);
+ UINT32DECODE(raw, message->ref_count);
UINT64DECODE(raw, message->fheap_id);
FUNC_LEAVE_NOAPI(SUCCEED)
@@ -349,3 +351,46 @@ H5SM_decr_ref(void *record, void *op_data, hbool_t *changed)
}
+
+/*-------------------------------------------------------------------------
+ * Function: H5SM_convert_to_list_op
+ *
+ * Purpose: An H5B2_remove_t callback function to convert a SOHM
+ * B-tree index to a list.
+ *
+ * Inserts this record into the list passed through op_data.
+ *
+ * Return: Non-negative on success
+ * Negative on failure
+ *
+ * Programmer: James Laird
+ * Monday, November 6, 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5SM_convert_to_list_op(void * record, void *op_data)
+{
+ H5SM_sohm_t *message = (H5SM_sohm_t *) record;
+ H5SM_list_t *list = (H5SM_list_t *) op_data;
+ hsize_t x;
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5SM_convert_to_list_op)
+
+ HDassert(record);
+ HDassert(op_data);
+
+ /* Insert this message into the list */
+ for(x=0; x<list->header->list_to_btree; x++)
+ {
+ if(list->messages[x].hash == H5O_HASH_UNDEF) /* JAMES: is this a valid test? */
+ {
+ HDmemcpy(&(list->messages[x]), message, sizeof(H5SM_sohm_t));
+ break;
+ }
+ }
+
+ /* Increment the number of messages in the list */
+ ++list->header->num_messages;
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} \ No newline at end of file
diff --git a/src/H5SMcache.c b/src/H5SMcache.c
index 6403dc3..57c181b 100644
--- a/src/H5SMcache.c
+++ b/src/H5SMcache.c
@@ -47,6 +47,8 @@
/* JAMES: should this change according to address size? */
#define H5F_LISTBUF_SIZE H5SM_LIST_SIZEOF_MAGIC + H5SM_MAX_LIST_ELEMS * 16
+#define H5SM_LIST_VERSION 0 /* Verion of Shared Object Header Message List Indexes */
+
/******************/
/* Local Typedefs */
/******************/
@@ -55,7 +57,7 @@
/* Local Prototypes */
/********************/
static herr_t H5SM_flush_table(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5SM_master_table_t *table);
-static H5SM_master_table_t *H5SM_load_table(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *udata1, void *udata2);
+static H5SM_master_table_t *H5SM_load_table(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *udata1, H5SM_master_table_t *table);
static herr_t H5SM_clear_table(H5F_t *f, H5SM_master_table_t *table, hbool_t destroy);
static herr_t H5SM_dest_table(H5F_t *f, H5SM_master_table_t* table);
static herr_t H5SM_table_size(const H5F_t *f, const H5SM_master_table_t *table, size_t *size_ptr);
@@ -137,9 +139,7 @@ H5SM_flush_table(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5SM_ma
HDmemcpy(p, H5SM_TABLE_MAGIC, (size_t)H5SM_TABLE_SIZEOF_MAGIC);
p += H5SM_TABLE_SIZEOF_MAGIC;
- *p++ = HDF5_SOHMTABLE_VERSION; /* Version */
-
- *p++ = table->num_indexes; /* Number of indexes in the table */
+ *p++ = H5SM_MASTER_TABLE_VERSION; /* Version */
/* Encode each index header */
for(x=0; x<table->num_indexes; ++x) {
@@ -154,6 +154,8 @@ H5SM_flush_table(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5SM_ma
H5F_addr_encode(f, &p, table->indexes[x].heap_addr); /* Address of the index's heap */
}
+ /* JAMES: do checksum */
+
/* Write the table to disk */
HDassert((size_t)(p - buf) == size);
if(H5F_block_write(f, H5FD_MEM_SOHM, addr, size, dxpl_id, buf) < 0)
@@ -186,11 +188,9 @@ done:
*-------------------------------------------------------------------------
*/
static H5SM_master_table_t *
-H5SM_load_table(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *udata1, void UNUSED *udata2)
+H5SM_load_table(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *udata1, H5SM_master_table_t *table)
{
- H5SM_master_table_t *table; /* The SOHM table being read in */
size_t table_size; /* Size of SOHM master table on disk */
- size_t indexes_size; /* Size of index headers on disk */
uint8_t *buf=NULL; /* Reading buffer */
uint8_t *p; /* Pointer into input buffer */
uint8_t x; /* Counter variable for index headers */
@@ -198,12 +198,13 @@ H5SM_load_table(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *udata1
FUNC_ENTER_NOAPI(H5SM_load_table, NULL)
- /* Allocate space for the SOHM table data structure */
- if(NULL == (table = H5MM_calloc(sizeof(H5SM_master_table_t))))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
+ HDassert(table);
+ HDassert(table->num_indexes > 0);
- /* Compute the size of the SOHM table header on disk. Read in just the table first */
- table_size = H5SM_TABLE_SIZE(f);
+ /* Compute the size of the SOHM table header on disk. This is the "table" itself
+ * plus each index within the table
+ */
+ table_size = H5SM_TABLE_SIZE(f) + (table->num_indexes * H5SM_INDEX_HEADER_SIZE(f));
/* Allocate temporary buffer */
if(NULL == (buf = HDmalloc(table_size)))
@@ -221,31 +222,19 @@ H5SM_load_table(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *udata1
p += H5SM_TABLE_SIZEOF_MAGIC;
/* Version number */
- if (HDF5_SOHMTABLE_VERSION != *p++)
- HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unknown SOHM table version number")
-
- table->num_indexes = *p++; /* Number of indexes in the table */
+ if (table->version != *p++)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "wrong SOHM table version number")
- HDassert((size_t)(p - buf) == table_size);
+ /* Don't count the checksum in the table size yet, since it comes after
+ * all of the index headers
+ */
+ HDassert((size_t)(p - buf) == H5SM_TABLE_SIZE(f) /* JAMES: minus checksum size */);
- /* Allocate space for the index headers */
+ /* Allocate space for the index headers in memory*/
if(NULL == (table->indexes = H5FL_ARR_MALLOC(H5SM_index_header_t, table->num_indexes)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for SOHM indexes")
- /* Now read in the list of index headers */
- indexes_size = table->num_indexes * H5SM_INDEX_HEADER_SIZE(f);
-
- /* Re-allocate temporary buffer */
- HDassert(buf);
- HDfree(buf);
- if(NULL == (buf = HDmalloc(indexes_size)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
-
-
- if(H5F_block_read(f, H5FD_MEM_SOHM, addr + table_size, indexes_size, dxpl_id, buf) < 0)
- HGOTO_ERROR(H5E_SOHM, H5E_READERROR, NULL, "can't read SOHM table")
- p=buf;
-
+ /* Read in the index headers */
for(x=0; x<table->num_indexes; ++x) {
table->indexes[x].index_type= *p++; /* type of the index (list or B-tree) */
@@ -257,7 +246,9 @@ H5SM_load_table(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *udata1
H5F_addr_decode(f, &p, &(table->indexes[x].heap_addr));
}
- HDassert((size_t)(p - buf) == indexes_size);
+ /* Read in checksum */
+
+ HDassert((size_t)(p - buf) == table_size);
ret_value = table;
done:
@@ -406,6 +397,9 @@ H5SM_flush_list(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5SM_lis
HDmemcpy(p, H5SM_LIST_MAGIC, (size_t)H5SM_LIST_SIZEOF_MAGIC);
p += H5SM_LIST_SIZEOF_MAGIC;
+ /* Encode version */
+ *p++ = H5SM_LIST_VERSION;
+
/* Write messages from the messages array to disk */
/* JAMES: we have to search the whole array. not the best way to do it; could go until we've written
* num_messages */
@@ -413,7 +407,7 @@ H5SM_flush_list(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5SM_lis
if(list->messages[x].fheap_id != 0 && list->messages[x].hash != H5O_HASH_UNDEF) {
/* JAMES: use H5SM_message_encode here */
UINT32ENCODE(p, list->messages[x].hash); /* Read the hash value for this message */
- UINT16ENCODE(p, list->messages[x].ref_count); /* Read the reference count for this message */
+ UINT32ENCODE(p, list->messages[x].ref_count); /* Read the reference count for this message */
UINT64ENCODE(p, list->messages[x].fheap_id); /* Get the heap ID for the message */
}
}
@@ -492,11 +486,15 @@ H5SM_load_list(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *udata1,
HGOTO_ERROR(H5E_SOHM, H5E_CANTLOAD, NULL, "bad SOHM list signature");
p += H5SM_LIST_SIZEOF_MAGIC;
+ /* Check version JAMES: should be in master table, not list */
+ if (H5SM_LIST_VERSION != *p++)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "wrong shared message list version number")
+
/* Read messages into the list array */
for(x=0; x<header->num_messages; x++)
{
UINT32DECODE(p, list->messages[x].hash); /* Read the hash value for this message */
- UINT16DECODE(p, list->messages[x].ref_count); /* Read the reference count for this message */
+ UINT32DECODE(p, list->messages[x].ref_count); /* Read the reference count for this message */
UINT64DECODE(p, list->messages[x].fheap_id); /* Get the heap ID for the message */
}
diff --git a/src/H5SMpkg.h b/src/H5SMpkg.h
index 9016884..752ce84 100755
--- a/src/H5SMpkg.h
+++ b/src/H5SMpkg.h
@@ -36,13 +36,15 @@
#define H5SM_TABLE_MAGIC "SMTB"
#define H5SM_TABLE_SIZEOF_MAGIC 4
+#define H5SM_MASTER_TABLE_VERSION 0 /* Version of the Shared Object Header Message Master Table*/
+
#define H5SM_SOHM_ENTRY_SIZE(f) (4 /* Hash value */ \
- + 2 /* reference count*/ \
+ + 4 /* reference count*/ \
+ 8) /* JAMES: size of hash value on disk */
#define H5SM_TABLE_SIZE(f) ( H5SM_TABLE_SIZEOF_MAGIC \
+ 1 /* Table version */ \
- + 1) /* Number of indexes */
+ + 0/* JAMES checksum */) /* Checksum */
#define H5SM_INDEX_HEADER_SIZE(f) (1 /* Whether index is a list or B-tree */ \
+ 2 /* Type of messages stored in the index */ \
@@ -50,7 +52,9 @@
+ H5F_SIZEOF_ADDR(f) /* Location of list or B-tree */ \
+ H5F_SIZEOF_ADDR(f)) /* Address of heap */
+/* JAMES: add checksum? */
#define H5SM_LIST_SIZE(f, num_mesg) H5SM_LIST_SIZEOF_MAGIC \
+ + 1 /* List version */ \
+ (H5SM_SOHM_ENTRY_SIZE(f) * num_mesg)
#define H5SM_MAX_INDEXES 8
@@ -134,8 +138,9 @@ typedef struct {
/* Information for H5AC cache functions, _must_ be first field in structure */
H5AC_info_t cache_info;
- uint8_t num_indexes; /* Number of indexes */
- H5SM_index_header_t *indexes; /* Array of num_indexes indexes */
+ unsigned version; /* Version of the table struct */
+ uint8_t num_indexes; /* Number of indexes */
+ H5SM_index_header_t *indexes; /* Array of num_indexes indexes */
} H5SM_master_table_t;
@@ -170,5 +175,8 @@ H5_DLL herr_t H5SM_message_compare(const H5SM_mesg_key_t *rec1,
/* H5B2_modify_t callbacks to adjust record's refcount. */
H5_DLL herr_t H5SM_incr_ref(void *record, void *op_data, hbool_t *changed);
H5_DLL herr_t H5SM_decr_ref(void *record, void *op_data, hbool_t *changed);
-#endif /*_H5SMpkg_H*/
+/* H5B2_remove_t callback to add messages to a list index */
+H5_DLL herr_t H5SM_convert_to_list_op(void * record, void *op_data);
+
+#endif /*_H5SMpkg_H*/
diff --git a/src/H5SMprivate.h b/src/H5SMprivate.h
index f1c2ad5..5d75213 100755
--- a/src/H5SMprivate.h
+++ b/src/H5SMprivate.h
@@ -22,7 +22,6 @@
#ifndef _H5SMprivate_H
#define _H5SMprivate_H
-#include "H5SMpublic.h"
#include "H5Oprivate.h"
#include "H5Pprivate.h"
@@ -30,9 +29,6 @@
/* Library Private Typedefs */
/****************************/
-#define HDF5_SOHMTABLE_VERSION 0 /* Version of the Shared Object Header Message Master Table*/
-#define HDF5_SOHMINDEX_VERSION 0 /* Verion of Shared Object Header Message Indexes */
-
#define H5SM_MAX_NUM_INDEXES 6
/* Typedef for a SOHM index node */
@@ -50,9 +46,8 @@ H5_DLL herr_t H5SM_init(H5F_t *f, H5P_genplist_t *fc_plist, hid_t dxpl_id);
H5_DLL htri_t H5SM_try_share(H5F_t *f, hid_t dxpl_id, unsigned type_id,
void *mesg);
H5_DLL herr_t H5SM_try_delete(H5F_t *f, hid_t dxpl_id, unsigned type_id, const H5O_shared_t *mesg);
-H5_DLL herr_t H5SM_get_info(H5F_t *f, haddr_t table_addr, unsigned *nindexes,
- unsigned *index_flags, size_t *list_to_btree,
- size_t *btree_to_list, hid_t dxpl_id);
+H5_DLL herr_t H5SM_get_info(H5F_t *f, unsigned *index_flags,
+ size_t *list_to_btree, size_t *btree_to_list, hid_t dxpl_id);
H5_DLL haddr_t H5SM_get_fheap_addr(H5F_t *f, unsigned type_id, hid_t dxpl_id);
#endif /*_H5SMprivate_H*/
diff --git a/src/H5SMpublic.h b/src/H5SMpublic.h
index c1531f7..4f7f074 100755
--- a/src/H5SMpublic.h
+++ b/src/H5SMpublic.h
@@ -22,21 +22,5 @@
#ifndef _H5SMpublic_H
#define _H5SMpublic_H
-/* Flags indicating which kinds of object header messages a given SOHM index
- * holds.
- * Pass these flags in using the mesg_type_flags array in
- * H5P_set_shared_mesgs.
- * (Developers: These flags correspond to object header message type_ids,
- * but we need to assign each kind of message to a different bit so that
- * one index can hold multiple types.)
- */
-#define H5SM_NONE_FLAG 0x0000 /* No shared messages */
-#define H5SM_SDSPACE_FLAG 0x0001 /* Simple Dataspace Message. */
-#define H5SM_DTYPE_FLAG 0x0002 /* Datatype Message. */
-#define H5SM_FILL_FLAG 0x0004 /* Fill Value Message. */
-#define H5SM_PLINE_FLAG 0x0008 /* Filter pipeline message. */
-#define H5SM_ATTR_FLAG 0x0010 /* Attribute Message. */
-#define H5SM_ALL_FLAG (H5SM_SDSPACE_FLAG | H5SM_DTYPE_FLAG | H5SM_FILL_FLAG | H5SM_PLINE_FLAG | H5SM_ATTR_FLAG)
-
#endif /*_H5SMpublic_H*/
diff --git a/src/hdf5.h b/src/hdf5.h
index 0b973f9..a3ae138 100644
--- a/src/hdf5.h
+++ b/src/hdf5.h
@@ -35,7 +35,6 @@
#include "H5Ppublic.h" /* Property lists */
#include "H5Rpublic.h" /* References */
#include "H5Spublic.h" /* Dataspaces */
-#include "H5SMpublic.h" /* Shared Object Header Messages */
#include "H5Tpublic.h" /* Datatypes */
#include "H5Zpublic.h" /* Data filters */
diff --git a/test/testhdf5.c b/test/testhdf5.c
index c98b141..425abbf 100644
--- a/test/testhdf5.c
+++ b/test/testhdf5.c
@@ -63,7 +63,7 @@ main(int argc, char *argv[])
AddTest("array", test_array, cleanup_array, "Array Datatypes", NULL);
AddTest("genprop", test_genprop, cleanup_genprop, "Generic Properties", NULL);
AddTest("unicode", test_unicode, cleanup_unicode, "UTF-8 Encoding", NULL);
- AddTest("sohm", test_sohm, NULL, "Shared Object Header Messages", NULL);
+ AddTest("sohm", test_sohm, cleanup_sohm, "Shared Object Header Messages", NULL);
AddTest("id", test_ids, NULL, "User-Created Identifiers", NULL);
AddTest("misc", test_misc, cleanup_misc, "Miscellaneous", NULL);
diff --git a/test/tmisc.c b/test/tmisc.c
index 5d14a44..7aad459 100644
--- a/test/tmisc.c
+++ b/test/tmisc.c
@@ -159,8 +159,7 @@ typedef struct
#define MISC11_SYM_LK 8
#define MISC11_SYM_IK 32
#define MISC11_ISTORE_IK 64
-#define MISC11_SOHM_NINDEXES 1
-#define MISC11_SOHM_INDEX_FLAGS { H5SM_ALL_FLAG }
+#define MISC11_NINDEXES 1
/* Definitions for misc. test #12 */
#define MISC12_FILE "tmisc12.h5"
@@ -1786,7 +1785,8 @@ test_misc11(void)
unsigned freelist; /* Free list version # */
unsigned stab; /* Symbol table entry version # */
unsigned shhdr; /* Shared object header version # */
- unsigned misc11_sohm_values[MISC11_SOHM_NINDEXES] = {MISC11_SOHM_INDEX_FLAGS};
+ unsigned nindexes; /* Shared message number of indexes */
+/* JAMES: add more SOHM properties here */
herr_t ret; /* Generic return value */
/* Output message about test being performed */
@@ -1807,9 +1807,7 @@ test_misc11(void)
/* Get the file's version information */
ret=H5Pget_version(fcpl, &super, &freelist, &stab, &shhdr);
CHECK(ret, FAIL, "H5Pget_version");
-#ifdef JAMES
VERIFY(super,0,"H5Pget_version");
-#endif /* JAMES */
VERIFY(freelist,0,"H5Pget_version");
VERIFY(stab,0,"H5Pget_version");
VERIFY(shhdr,0,"H5Pget_version");
@@ -1840,8 +1838,8 @@ test_misc11(void)
ret=H5Pset_istore_k(fcpl,MISC11_ISTORE_IK);
CHECK(ret, FAIL, "H5Pset_istore_k");
- ret=H5Pset_shared_mesgs(fcpl,MISC11_SOHM_NINDEXES, misc11_sohm_values);
- CHECK(ret, FAIL, "H5Pset_shared_mesg");
+ ret=H5Pset_shared_mesg_nindexes(fcpl,MISC11_NINDEXES);
+ CHECK(ret, FAIL, "H5Pset_istore_k");
/* Creating a file with the non-default file creation property list should
* create a version 1 superblock
@@ -1862,7 +1860,6 @@ test_misc11(void)
/* Get the file's version information */
ret=H5Pget_version(fcpl, &super, &freelist, &stab, &shhdr);
CHECK(ret, FAIL, "H5Pget_version");
-/* JAMES VERIFY(super,1,"H5Pget_version"); */
VERIFY(super,2,"H5Pget_version");
VERIFY(freelist,0,"H5Pget_version");
VERIFY(stab,0,"H5Pget_version");
@@ -1887,7 +1884,6 @@ test_misc11(void)
/* Get the file's version information */
ret=H5Pget_version(fcpl, &super, &freelist, &stab, &shhdr);
CHECK(ret, FAIL, "H5Pget_version");
-/* JAMES VERIFY(super,1,"H5Pget_version"); */
VERIFY(super,2,"H5Pget_version");
VERIFY(freelist,0,"H5Pget_version");
VERIFY(stab,0,"H5Pget_version");
@@ -1912,6 +1908,10 @@ test_misc11(void)
CHECK(ret, FAIL, "H5Pget_istore_k");
VERIFY(istore_ik, MISC11_ISTORE_IK, "H5Pget_istore_k");
+ ret=H5Pget_shared_mesg_nindexes(fcpl,&nindexes);
+ CHECK(ret, FAIL, "H5Pget_shared_mesg_nindexes");
+ VERIFY(nindexes, MISC11_NINDEXES, "H5Pget_shared_mesg_nindexes");
+
/* Close file */
ret=H5Fclose(file);
CHECK(ret, FAIL, "H5Fclose");
diff --git a/test/tsohm.c b/test/tsohm.c
index bf86e19..6eda3e3 100644
--- a/test/tsohm.c
+++ b/test/tsohm.c
@@ -36,10 +36,10 @@ const unsigned def_type_flags[MAX_INDEXES] = {0,0,0,0,0,0};
/* Non-default SOHM values for testing */
#define TEST_NUM_INDEXES 4
const unsigned test_type_flags[MAX_INDEXES] =
- {H5SM_FILL_FLAG,
- H5SM_DTYPE_FLAG | H5SM_ATTR_FLAG,
- H5SM_SDSPACE_FLAG,
- H5SM_PLINE_FLAG,
+ {H5O_MESG_FILL_FLAG,
+ H5O_MESG_DTYPE_FLAG | H5O_MESG_ATTR_FLAG,
+ H5O_MESG_SDSPACE_FLAG,
+ H5O_MESG_PLINE_FLAG,
0, 0};
#define TEST_L2B 65
#define TEST_B2L 64
@@ -57,34 +57,30 @@ static void check_fcpl_values(hid_t fcpl_id, const unsigned nindexes_in,
const unsigned *flags_in, size_t l2b, size_t b2l)
{
unsigned num_indexes;
- unsigned index_flags[MAX_INDEXES];
- size_t size;
+ unsigned index_flags, min_mesg_size;
+ size_t list_size, btree_size;
unsigned x;
herr_t ret;
/* Verify number of indexes is set to default */
- ret = H5Pget_shared_nindexes(fcpl_id, &num_indexes);
- CHECK_I(ret, "H5Pget_shared_nindexes");
- VERIFY(num_indexes, nindexes_in, "H5Pget_shared_nindexes");
+ ret = H5Pget_shared_mesg_nindexes(fcpl_id, &num_indexes);
+ CHECK_I(ret, "H5Pget_shared_mesg_nindexes");
+ VERIFY(num_indexes, nindexes_in, "H5Pget_shared_mesg_nindexes");
/* Verify index flags are set to default */
- ret = H5Pget_shared_mesg_types(fcpl_id, MAX_INDEXES, index_flags);
- CHECK_I(ret, "H5Pget_shared_mesg_types");
-
- for(x=0; x<num_indexes; ++x)
- VERIFY(index_flags[x], flags_in[x], "H5Pget_shared_indexes");
-/* JAMES: can other values be undefined?
- for(x=0; x<MAX_INDEXES; ++x)
- VERIFY(index_flags[x], flags_in[x], "H5Pget_shared_indexes");
-*/
+ for(x=1; x<=num_indexes; ++x)
+ {
+ ret = H5Pget_shared_mesg_index(fcpl_id, x, &index_flags, &min_mesg_size);
+ CHECK_I(ret, "H5Pget_shared_mesg_index");
+ VERIFY(index_flags, flags_in[x-1], "H5Pget_shared_mesg_index");
+ /* JAMES: check min_mesg_size here */
+ }
/* Check list-to-btree and btree-to-list values */
- ret = H5Pget_sohm_list_max(fcpl_id, &size);
- CHECK_I(ret, "H5Pget_sohm_list_max");
- VERIFY(size, l2b, "H5Pget_sohm_list_max");
- ret = H5Pget_sohm_btree_min(fcpl_id, &size);
- CHECK_I(ret, "H5Pget_sohm_btree_min");
- VERIFY(size, b2l, "H5Pget_sohm_btree_min");
+ ret = H5Pget_shared_mesg_phase_change(fcpl_id, &list_size, &btree_size);
+ CHECK_I(ret, "H5Pset_shared_mesg_phase_change");
+ VERIFY(list_size, l2b, "H5Pset_shared_mesg_phase_change");
+ VERIFY(btree_size, b2l, "H5Pset_shared_mesg_phase_change");
}
@@ -151,13 +147,18 @@ static void test_sohm_fcpl(void)
/* Start over with a non-default fcpl */
fcpl_id = H5Pcreate(H5P_FILE_CREATE);
CHECK_I(fcpl_id, "H5Pcreate");
- ret = H5Pset_shared_mesgs(fcpl_id, TEST_NUM_INDEXES, test_type_flags);
- CHECK_I(ret, "H5Pset_shared_mesgs");
- ret = H5Pset_sohm_list_max(fcpl_id, TEST_L2B);
- CHECK_I(ret, "H5Pset_sohm_list_max");
- ret = H5Pset_sohm_btree_min(fcpl_id, TEST_B2L);
- CHECK_I(ret, "H5Pset_sohm_btree_min");
+ /* Set up index values */
+ ret = H5Pset_shared_mesg_nindexes(fcpl_id, TEST_NUM_INDEXES);
+ CHECK_I(ret, "H5Pset_shared_mesg_nindexes");
+ for(x=1; x<=TEST_NUM_INDEXES; ++x)
+ {
+ ret = H5Pset_shared_mesg_index(fcpl_id, x, test_type_flags[x-1], 15 /* JAMES */);
+ CHECK_I(ret, "H5Pset_shared_mesg_index");
+ }
+
+ ret = H5Pset_shared_mesg_phase_change(fcpl_id, TEST_L2B, TEST_B2L);
+ CHECK_I(ret, "H5Pset_shared_mesg_phase_change");
check_fcpl_values(fcpl_id, TEST_NUM_INDEXES, test_type_flags, TEST_L2B, TEST_B2L);
@@ -195,58 +196,42 @@ static void test_sohm_fcpl(void)
/* Test giving bogus values to H5P* functions */
H5E_BEGIN_TRY {
- ret = H5Pset_shared_mesgs(fcpl_id, -1, def_type_flags);
- VERIFY(ret, -1, "H5Pset_shared_mesgs");
- ret = H5Pset_shared_mesgs(fcpl_id, MAX_INDEXES + 1, test_type_flags);
- VERIFY(ret, -1, "H5Pset_shared_mesgs");
-
- /* Initialize bad_flags */
- for(x=0; x<MAX_INDEXES; ++x)
- bad_flags[x] = H5SM_NONE_FLAG;
-
- ret = H5Pset_shared_mesgs(fcpl_id, 1, bad_flags);
- VERIFY(ret, -1, "H5Pset_shared_mesgs");
-
- bad_flags[0]=H5SM_ALL_FLAG + 1;
- ret = H5Pset_shared_mesgs(fcpl_id, 1, bad_flags);
- VERIFY(ret, -1, "H5Pset_shared_mesgs");
-
- bad_flags[0]=H5SM_DTYPE_FLAG;
- bad_flags[1]=H5SM_FILL_FLAG;
- bad_flags[2]=H5SM_ATTR_FLAG | H5SM_DTYPE_FLAG;
- ret = H5Pset_shared_mesgs(fcpl_id, 3, bad_flags);
- VERIFY(ret, -1, "H5Pset_shared_mesgs");
-
- bad_flags[1] = H5SM_ALL_FLAG;
- ret = H5Pset_shared_mesgs(fcpl_id, 2, bad_flags);
- VERIFY(ret, -1, "H5Pset_shared_mesgs");
-
- bad_flags[1] = H5SM_FILL_FLAG;
- bad_flags[2] = H5SM_NONE_FLAG;
- bad_flags[3] = H5SM_ATTR_FLAG;
- ret = H5Pset_shared_mesgs(fcpl_id, 4, bad_flags);
- VERIFY(ret, -1, "H5Pset_shared_mesgs");
+ /* Trying to set index 0 or an index higher than the current number
+ * of indexes should fail.
+ */
+ ret = H5Pset_shared_mesg_index(fcpl_id, 0, 0, 15 /* JAMES */);
+ VERIFY(ret, -1, "H5Pset_shared_mesg_index");
+ ret = H5Pset_shared_mesg_index(fcpl_id, MAX_INDEXES + 1, 0, 15);
+ VERIFY(ret, -1, "H5Pset_shared_mesg_index");
+ ret = H5Pset_shared_mesg_index(fcpl_id, TEST_NUM_INDEXES + 1, 0, 15);
+ VERIFY(ret, -1, "H5Pset_shared_mesg_index");
+
+ /* Setting an unknown flag (all flags + 1) should fail */
+ ret = H5Pset_shared_mesg_index(fcpl_id, 1, H5O_MESG_ALL_FLAG + 1, 15);
+ VERIFY(ret, -1, "H5Pset_shared_mesg_index");
+
+ /* Try setting two different indexes to hold fill messages */
+ ret = H5Pset_shared_mesg_index(fcpl_id, 1, H5O_MESG_FILL_FLAG, 15 /* JAMES */);
+ CHECK_I(ret, "H5Pset_shared_mesg_index");
+ ret = H5Pset_shared_mesg_index(fcpl_id, 2, H5O_MESG_FILL_FLAG, 15 /* JAMES */);
+ VERIFY(ret, -1, "H5Pset_shared_mesg_index");
+ ret = H5Pset_shared_mesg_index(fcpl_id, 2, H5O_MESG_DTYPE_FLAG | H5O_MESG_FILL_FLAG, 15 /* JAMES */);
+ VERIFY(ret, -1, "H5Pset_shared_mesg_index");
/* Test list/btree cutoffs. We can set these to any positive value,
* but if the list max is less than the btree min we'll get an error
* when the file is created.
*/
- ret = H5Pset_sohm_list_max(fcpl_id, 10);
- CHECK_I(ret, "H5Pset_sohm_list_max");
- ret = H5Pset_sohm_btree_min(fcpl_id, 12);
- CHECK_I(ret, "H5Pset_sohm_btree_min");
- fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl_id, H5P_DEFAULT);
- VERIFY(fid, -1, "H5Fcreate");
+ ret = H5Pset_shared_mesg_phase_change(fcpl_id, 10, 12);
+ VERIFY(ret, -1, "H5Pset_shared_mesg_phase_change");
} H5E_END_TRY
/* Actually, the list max can be exactly 1 greater than the
* btree min, but no more. Also, the errors above shouldn't
* have corrupted the fcpl.
*/
- ret = H5Pset_sohm_list_max(fcpl_id, 10);
- CHECK_I(ret, "H5Pset_sohm_list_max");
- ret = H5Pset_sohm_btree_min(fcpl_id, 11);
- CHECK_I(ret, "H5Pset_sohm_btree_min");
+ ret = H5Pset_shared_mesg_phase_change(fcpl_id, 10, 11);
+ CHECK_I(ret, "H5Pset_shared_mesg_phase_change");
fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl_id, H5P_DEFAULT);
CHECK_I(fid, "H5Fcreate");