summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVailin Choi <vchoi@jam.ad.hdfgroup.org>2019-06-26 20:47:54 (GMT)
committerVailin Choi <vchoi@jam.ad.hdfgroup.org>2019-06-26 20:47:54 (GMT)
commit9cafc8d4de8bf63ed26a1e6c6e3b8d13b33b4567 (patch)
tree08b81869621fc3b6f7d6c14999a372ff33c3e03a /src
parent7485981bcabfeb09ced49b840bf828c00816157a (diff)
parent439ea92d7e58c9900ef617bbe616a5ce36c709e9 (diff)
downloadhdf5-9cafc8d4de8bf63ed26a1e6c6e3b8d13b33b4567.zip
hdf5-9cafc8d4de8bf63ed26a1e6c6e3b8d13b33b4567.tar.gz
hdf5-9cafc8d4de8bf63ed26a1e6c6e3b8d13b33b4567.tar.bz2
Merge branch 'develop' of https://bitbucket.hdfgroup.org/scm/~vchoi/my_third_fork into bugfix/new_shutdown_fsm
Diffstat (limited to 'src')
-rw-r--r--src/H5Fpkg.h3
-rw-r--r--src/H5Fsuper.c63
-rw-r--r--src/H5MF.c3
-rw-r--r--src/H5Ofsinfo.c10
-rw-r--r--src/H5Oprivate.h12
-rw-r--r--src/H5Tnative.c24
6 files changed, 97 insertions, 18 deletions
diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h
index 4a9bbf0..5f25ddc 100644
--- a/src/H5Fpkg.h
+++ b/src/H5Fpkg.h
@@ -318,6 +318,9 @@ struct H5F_file_t {
H5F_fspace_strategy_t fs_strategy; /* File space handling strategy */
hsize_t fs_threshold; /* Free space section threshold */
hbool_t fs_persist; /* Free-space persist or not */
+ unsigned fs_version; /* Free-space version: */
+ /* It is used to update fsinfo message in the superblock
+ extension when closing down the free-space managers */
hbool_t use_tmp_space; /* Whether temp. file space allocation is allowed */
haddr_t tmp_addr; /* Next address to use for temp. space in the file */
hbool_t point_of_no_return; /* Flag to indicate that we can't go back and delete a freespace header when it's used up */
diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c
index fb68c73..4576f3d 100644
--- a/src/H5Fsuper.c
+++ b/src/H5Fsuper.c
@@ -80,6 +80,15 @@ static const unsigned HDF5_superblock_ver_bounds[] = {
HDF5_SUPERBLOCK_VERSION_LATEST /* H5F_LIBVER_LATEST */
};
+/* Format version bounds for fsinfo message */
+/* This message exists starting library release v1.10 */
+static const unsigned H5O_fsinfo_ver_bounds[] = {
+ H5O_INVALID_VERSION, /* H5F_LIBVER_EARLIEST */
+ H5O_INVALID_VERSION, /* H5F_LIBVER_V18 */
+ H5O_FSINFO_VERSION_1, /* H5F_LIBVER_V110 */
+ H5O_FSINFO_VERSION_LATEST /* H5F_LIBVER_LATEST */
+};
+
/*-------------------------------------------------------------------------
* Function: H5F__super_ext_create
@@ -782,6 +791,14 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get free-space manager info message")
/* Update changed values */
+
+ /* Version bounds check */
+ if(H5O_fsinfo_ver_bounds[H5F_HIGH_BOUND(f)] == H5O_INVALID_VERSION ||
+ fsinfo.version > H5O_fsinfo_ver_bounds[H5F_HIGH_BOUND(f)])
+ HGOTO_ERROR(H5E_FILE, H5E_BADRANGE, FAIL, "File space info message's version out of bounds")
+ if(f->shared->fs_version != fsinfo.version)
+ f->shared->fs_version = fsinfo.version;
+
if(f->shared->fs_strategy != fsinfo.strategy) {
f->shared->fs_strategy = fsinfo.strategy;
@@ -1381,6 +1398,11 @@ H5F__super_init(H5F_t *f)
fsinfo.eoa_pre_fsm_fsalloc = HADDR_UNDEF;
fsinfo.mapped = FALSE;
+ /* Set the version for the fsinfo message */
+ if(H5O__fsinfo_set_version(f, &fsinfo) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set version of fsinfo")
+ f->shared->fs_version = fsinfo.version;
+
for(ptype = H5F_MEM_PAGE_SUPER; ptype < H5F_MEM_PAGE_NTYPES; H5_INC_ENUM(H5F_mem_page_t, ptype))
fsinfo.fs_addr[ptype - 1] = HADDR_UNDEF;
@@ -1807,3 +1829,44 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5F__super_ext_remove_msg() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5O__fsinfo_set_version
+ *
+ * Purpose: Set the version to encode the fsinfo message with.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Vailin Choi; June 2019
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5O__fsinfo_set_version(H5F_t *f, H5O_fsinfo_t *fsinfo)
+{
+ unsigned version; /* Message version */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity check */
+ HDassert(f);
+ HDassert(fsinfo);
+
+ version = H5O_FSINFO_VERSION_1;
+
+ /* Upgrade to the version indicated by the file's low bound if higher */
+ if(H5O_fsinfo_ver_bounds[H5F_LOW_BOUND(f)] != H5O_INVALID_VERSION)
+ version = MAX(version, H5O_fsinfo_ver_bounds[H5F_LOW_BOUND(f)]);
+
+ /* Version bounds check */
+ if(H5O_fsinfo_ver_bounds[H5F_HIGH_BOUND(f)] == H5O_INVALID_VERSION ||
+ version > H5O_fsinfo_ver_bounds[H5F_HIGH_BOUND(f)])
+ HGOTO_ERROR(H5E_DATASET, H5E_BADRANGE, FAIL, "File space info message's version out of bounds")
+
+ /* Set the message version */
+ fsinfo->version = version;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O__fsinfo_set_version() */
diff --git a/src/H5MF.c b/src/H5MF.c
index d825d86..00856e1 100644
--- a/src/H5MF.c
+++ b/src/H5MF.c
@@ -1813,6 +1813,7 @@ HDfprintf(stderr, "%s: Entering\n", FUNC);
fsinfo.page_size = f->shared->fs_page_size;
fsinfo.pgend_meta_thres = f->shared->pgend_meta_thres;
fsinfo.eoa_pre_fsm_fsalloc = f->shared->eoa_fsm_fsalloc;
+ fsinfo.version = f->shared->fs_version;
/* Write the free space manager message -- message must already exist */
if(H5F__super_ext_write_msg(f, H5O_FSINFO_ID, &fsinfo, FALSE, H5O_MSG_FLAG_MARK_IF_UNKNOWN) < 0)
@@ -1951,6 +1952,8 @@ HDfprintf(stderr, "%s: Entering\n", FUNC);
fsinfo.page_size = f->shared->fs_page_size;
fsinfo.pgend_meta_thres = f->shared->pgend_meta_thres;
fsinfo.eoa_pre_fsm_fsalloc = HADDR_UNDEF;
+ fsinfo.version = f->shared->fs_version;
+
for(ptype = H5F_MEM_PAGE_META; ptype < H5F_MEM_PAGE_NTYPES; H5_INC_ENUM(H5F_mem_page_t, ptype))
fsinfo.fs_addr[ptype - 1] = HADDR_UNDEF;
diff --git a/src/H5Ofsinfo.c b/src/H5Ofsinfo.c
index bb15f62..ec2328c 100644
--- a/src/H5Ofsinfo.c
+++ b/src/H5Ofsinfo.c
@@ -65,10 +65,6 @@ const H5O_msg_class_t H5O_MSG_FSINFO[1] = {{
H5O__fsinfo_debug /* debug the message */
}};
-/* Current version of free-space manager info information */
-#define H5O_FSINFO_VERSION_0 0
-#define H5O_FSINFO_VERSION_1 1
-
/* Declare a free list to manage the H5O_fsinfo_t struct */
H5FL_DEFINE_STATIC(H5O_fsinfo_t);
@@ -157,11 +153,13 @@ H5O_fsinfo_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh,
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid file space strategy")
} /* end switch */
+ fsinfo->version = H5O_FSINFO_VERSION_1;
fsinfo->mapped = TRUE;
} else {
- HDassert(vers == H5O_FSINFO_VERSION_1);
+ HDassert(vers >= H5O_FSINFO_VERSION_1);
+ fsinfo->version = vers;
fsinfo->strategy = (H5F_fspace_strategy_t)*p++; /* File space strategy */
fsinfo->persist = *p++; /* Free-space persist or not */
H5F_DECODE_LENGTH(f, p, fsinfo->threshold); /* Free-space section threshold */
@@ -214,7 +212,7 @@ H5O_fsinfo_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, c
HDassert(p);
HDassert(fsinfo);
- *p++ = H5O_FSINFO_VERSION_1; /* message version */
+ *p++ = (uint8_t)fsinfo->version; /* message version */
*p++ = fsinfo->strategy; /* File space strategy */
*p++ = (unsigned char)fsinfo->persist; /* Free-space persist or not */
H5F_ENCODE_LENGTH(f, p, fsinfo->threshold); /* Free-space section size threshold */
diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h
index 5987ecf..d143f31 100644
--- a/src/H5Oprivate.h
+++ b/src/H5Oprivate.h
@@ -804,6 +804,17 @@ typedef uint32_t H5O_refcount_t; /* Contains # of links to object, if >1
*/
typedef unsigned H5O_unknown_t; /* Original message type ID */
+/* To indicate an invalid version for a message that does not exist yet for the release */
+/* Message version is 1 byte so the value can be 0 to 255 */
+#define H5O_INVALID_VERSION 256
+
+/* The initial version of the fsinfo message: deprecated */
+/* This version is mapped to version 1 from release 1.10.1 onwards */
+#define H5O_FSINFO_VERSION_0 0
+
+/* The latest version for fsinfo message */
+#define H5O_FSINFO_VERSION_1 1
+#define H5O_FSINFO_VERSION_LATEST H5O_FSINFO_VERSION_1
/*
* File space info Message.
* Contains file space management info and
@@ -811,6 +822,7 @@ typedef unsigned H5O_unknown_t; /* Original message type ID */
* (Data structure in memory)
*/
typedef struct H5O_fsinfo_t {
+ unsigned version; /* Version number */
H5F_fspace_strategy_t strategy; /* File space strategy */
hbool_t persist; /* Persisting free-space or not */
hsize_t threshold; /* Free-space section threshold */
diff --git a/src/H5Tnative.c b/src/H5Tnative.c
index f40d81b..d213c45 100644
--- a/src/H5Tnative.c
+++ b/src/H5Tnative.c
@@ -515,6 +515,9 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5T__get_native_type() */
+/* Disable warning for intentional identical branches here -QAK */
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wduplicated-branches"
/*-------------------------------------------------------------------------
* Function: H5T__get_native_integer
@@ -551,9 +554,6 @@ H5T__get_native_integer(size_t prec, H5T_sign_t sign, H5T_direction_t direction,
FUNC_ENTER_STATIC
if(direction == H5T_DIR_DEFAULT || direction == H5T_DIR_ASCEND) {
-/* Disable warning for intentional identical branches here -QAK */
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wduplicated-branches"
if(prec <= H5T_get_precision((H5T_t *)H5I_object(H5T_NATIVE_SCHAR_g))) {
match = H5T_NATIVE_INT_MATCH_CHAR;
native_size = sizeof(char);
@@ -573,7 +573,6 @@ H5T__get_native_integer(size_t prec, H5T_sign_t sign, H5T_direction_t direction,
match = H5T_NATIVE_INT_MATCH_LLONG;
native_size = sizeof(long long);
}
-#pragma GCC diagnostic pop
} else if(direction == H5T_DIR_DESCEND) {
if(prec > H5T_get_precision((H5T_t *)H5I_object(H5T_NATIVE_LONG_g))) {
match = H5T_NATIVE_INT_MATCH_LLONG;
@@ -659,7 +658,11 @@ H5T__get_native_integer(size_t prec, H5T_sign_t sign, H5T_direction_t direction,
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5T__get_native_integer() */
+#pragma GCC diagnostic pop
+/* Disable warning for intentional identical branches here -QAK */
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wduplicated-branches"
/*-------------------------------------------------------------------------
* Function: H5T__get_native_float
@@ -698,9 +701,6 @@ H5T__get_native_float(size_t size, H5T_direction_t direction, size_t *struct_ali
HDassert(size>0);
if(direction == H5T_DIR_DEFAULT || direction == H5T_DIR_ASCEND) {
-/* Disable warning for intentional identical branches here -QAK */
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wduplicated-branches"
if(size<=sizeof(float)) {
match=H5T_NATIVE_FLOAT_MATCH_FLOAT;
native_size = sizeof(float);
@@ -724,7 +724,6 @@ H5T__get_native_float(size_t size, H5T_direction_t direction, size_t *struct_ali
native_size = sizeof(double);
#endif
}
-#pragma GCC diagnostic pop
} else {
#if H5_SIZEOF_LONG_DOUBLE !=0
if(size>sizeof(double)) {
@@ -788,7 +787,11 @@ H5T__get_native_float(size_t size, H5T_direction_t direction, size_t *struct_ali
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5T__get_native_float() */
+#pragma GCC diagnostic pop
+/* Disable warning for intentional identical branches here -QAK */
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wduplicated-branches"
/*-------------------------------------------------------------------------
* Function: H5T__get_native_bitfield
@@ -818,9 +821,6 @@ H5T__get_native_bitfield(size_t prec, H5T_direction_t direction,
FUNC_ENTER_STATIC
if(direction == H5T_DIR_DEFAULT || direction == H5T_DIR_ASCEND) {
-/* Disable warning for intentional identical branches here -QAK */
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wduplicated-branches"
if(prec<=H5T_get_precision((H5T_t *)H5I_object(H5T_NATIVE_B8_g))) {
tid = H5T_NATIVE_B8;
native_size = 1;
@@ -842,7 +842,6 @@ H5T__get_native_bitfield(size_t prec, H5T_direction_t direction,
native_size = 8;
align = H5T_NATIVE_UINT64_ALIGN_g;
}
-#pragma GCC diagnostic pop
} else if(direction == H5T_DIR_DESCEND) {
if(prec>H5T_get_precision((H5T_t *)H5I_object(H5T_NATIVE_B32_g))) {
tid = H5T_NATIVE_B64;
@@ -878,6 +877,7 @@ H5T__get_native_bitfield(size_t prec, H5T_direction_t direction,
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5T__get_native_bitfield() */
+#pragma GCC diagnostic pop
/*-------------------------------------------------------------------------