summaryrefslogtreecommitdiffstats
path: root/src/H5T.c
diff options
context:
space:
mode:
authorNeil Fortner <nfortne2@hdfgroup.org>2021-01-27 23:48:31 (GMT)
committerGitHub <noreply@github.com>2021-01-27 23:48:31 (GMT)
commit98a27f1fe4f0cb96ce7fdeee2e95079ae19db5cd (patch)
tree2e0dd2c18e2b05870ea50835e8c7997935ac95a3 /src/H5T.c
parentdf1d5505c15e27eca9236952bbfef94a6dc8f20d (diff)
downloadhdf5-98a27f1fe4f0cb96ce7fdeee2e95079ae19db5cd.zip
hdf5-98a27f1fe4f0cb96ce7fdeee2e95079ae19db5cd.tar.gz
hdf5-98a27f1fe4f0cb96ce7fdeee2e95079ae19db5cd.tar.bz2
Merge PR #274 to 1.12 Branch (#283)
* Improve performance of multiple calls to H5Sget_select_elem_pointlist (#270) * Cache the pointer to the next point to process after the last call to H5S__get_select_elem_pointlist. This allows the normal process of iterating over the points in batches to be much more efficient, as the library does not need to traverse the entirety of the preceding points every time the funciton is re-entered. * Update RELEASE.txt for point selection iteration performance fix. * Fix problems with vlens and refs inside compound using H5VLget_file_type() (#274) * Fixed problems with vlens and refs inside compound using H5VLget_file_type() * Fix date in RELEASE.txt * Add assertions * Move some manipulation of H5VL_object_t struct fields into the H5VL package. * Add fix that was mistakenly left off merge commit. * Update src/H5Tprivate.h Co-authored-by: Larry Knox <lrknox@hdfgroup.org>
Diffstat (limited to 'src/H5T.c')
-rw-r--r--src/H5T.c63
1 files changed, 59 insertions, 4 deletions
diff --git a/src/H5T.c b/src/H5T.c
index c145a04..6f9fa13 100644
--- a/src/H5T.c
+++ b/src/H5T.c
@@ -1477,6 +1477,8 @@ done:
if (copied_dtype)
(void)H5T_close_real(dt);
else {
+ if (dt->shared->owned_vol_obj && H5VL_free_object(dt->shared->owned_vol_obj) < 0)
+ HDONE_ERROR(H5E_DATATYPE, H5E_CANTCLOSEOBJ, FAIL, "unable to close owned VOL object")
dt->shared = H5FL_FREE(H5T_shared_t, dt->shared);
dt = H5FL_FREE(H5T_t, dt);
} /* end else */
@@ -3384,6 +3386,8 @@ H5T__create(H5T_class_t type, size_t size)
done:
if (NULL == ret_value) {
if (dt) {
+ if (dt->shared->owned_vol_obj && H5VL_free_object(dt->shared->owned_vol_obj) < 0)
+ HDONE_ERROR(H5E_DATATYPE, H5E_CANTCLOSEOBJ, NULL, "unable to close owned VOL object")
dt->shared = H5FL_FREE(H5T_shared_t, dt->shared);
dt = H5FL_FREE(H5T_t, dt);
}
@@ -3426,9 +3430,12 @@ H5T__initiate_copy(const H5T_t *old_dt)
/* Copy shared information */
*(new_dt->shared) = *(old_dt->shared);
- /* Reset VOL fields */
+ /* Increment ref count on owned VOL object */
+ if (new_dt->shared->owned_vol_obj)
+ (void)H5VL_object_inc_rc(new_dt->shared->owned_vol_obj);
+
+ /* Reset vol_obj field */
new_dt->vol_obj = NULL;
- new_dt->shared->owned_vol_obj = NULL;
/* Set return value */
ret_value = new_dt;
@@ -3436,8 +3443,11 @@ H5T__initiate_copy(const H5T_t *old_dt)
done:
if (ret_value == NULL)
if (new_dt) {
- if (new_dt->shared)
+ if (new_dt->shared) {
+ if (new_dt->shared->owned_vol_obj && H5VL_free_object(new_dt->shared->owned_vol_obj) < 0)
+ HDONE_ERROR(H5E_DATATYPE, H5E_CANTCLOSEOBJ, NULL, "unable to close owned VOL object")
new_dt->shared = H5FL_FREE(H5T_shared_t, new_dt->shared);
+ } /* end if */
new_dt = H5FL_FREE(H5T_t, new_dt);
} /* end if */
@@ -3766,6 +3776,8 @@ done:
if (ret_value == NULL)
if (new_dt) {
HDassert(new_dt->shared);
+ if (new_dt->shared->owned_vol_obj && H5VL_free_object(new_dt->shared->owned_vol_obj) < 0)
+ HDONE_ERROR(H5E_DATATYPE, H5E_CANTCLOSEOBJ, NULL, "unable to close owned VOL object")
new_dt->shared = H5FL_FREE(H5T_shared_t, new_dt->shared);
new_dt = H5FL_FREE(H5T_t, new_dt);
} /* end if */
@@ -3833,6 +3845,8 @@ H5T_copy_reopen(H5T_t *old_dt)
/* The object is already open. Free the H5T_shared_t struct
* we had been using and use the one that already exists.
* Not terribly efficient. */
+ if (new_dt->shared->owned_vol_obj && H5VL_free_object(new_dt->shared->owned_vol_obj) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCLOSEOBJ, NULL, "unable to close owned VOL object")
new_dt->shared = H5FL_FREE(H5T_shared_t, new_dt->shared);
new_dt->shared = reopened_fo;
@@ -3869,6 +3883,8 @@ done:
if (ret_value == NULL)
if (new_dt) {
HDassert(new_dt->shared);
+ if (new_dt->shared->owned_vol_obj && H5VL_free_object(new_dt->shared->owned_vol_obj) < 0)
+ HDONE_ERROR(H5E_DATATYPE, H5E_CANTCLOSEOBJ, NULL, "unable to close owned VOL object")
new_dt->shared = H5FL_FREE(H5T_shared_t, new_dt->shared);
new_dt = H5FL_FREE(H5T_t, new_dt);
} /* end if */
@@ -3963,8 +3979,10 @@ H5T__alloc(void)
done:
if (ret_value == NULL)
if (dt) {
- if (dt->shared)
+ if (dt->shared) {
+ HDassert(!dt->shared->owned_vol_obj);
dt->shared = H5FL_FREE(H5T_shared_t, dt->shared);
+ } /* end if */
dt = H5FL_FREE(H5T_t, dt);
} /* end if */
@@ -4085,6 +4103,7 @@ H5T_close_real(H5T_t *dt)
if (H5T__free(dt) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTFREE, FAIL, "unable to free datatype");
+ HDassert(!dt->shared->owned_vol_obj);
dt->shared = H5FL_FREE(H5T_shared_t, dt->shared);
} /* end if */
else
@@ -4219,6 +4238,7 @@ H5T__set_size(H5T_t *dt, size_t size)
/* Check args */
HDassert(dt);
+ HDassert(dt->shared);
HDassert(size != 0);
HDassert(H5T_REFERENCE != dt->shared->type);
HDassert(!(H5T_ENUM == dt->shared->type && 0 == dt->shared->u.enumer.nmembs));
@@ -4406,11 +4426,38 @@ H5T_get_size(const H5T_t *dt)
/* check args */
HDassert(dt);
+ HDassert(dt->shared);
FUNC_LEAVE_NOAPI(dt->shared->size)
} /* end H5T_get_size() */
/*-------------------------------------------------------------------------
+ * Function: H5T_get_force_conv
+ *
+ * Purpose: Determines if the type has forced conversion. This will be
+ * true if and only if the type keeps a pointer to a file VOL
+ * object internally.
+ *
+ * Return: TRUE/FALSE (never fails)
+ *
+ * Programmer: Neil Fortner
+ * Thursday, January 21, 2021
+ *-------------------------------------------------------------------------
+ */
+hbool_t
+H5T_get_force_conv(const H5T_t *dt)
+{
+ /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+
+ /* check args */
+ HDassert(dt);
+ HDassert(dt->shared);
+
+ FUNC_LEAVE_NOAPI(dt->shared->force_conv)
+} /* end H5T_get_force_conv() */
+
+/*-------------------------------------------------------------------------
* Function: H5T_cmp
*
* Purpose: Compares two data types.
@@ -4446,6 +4493,9 @@ H5T_cmp(const H5T_t *dt1, const H5T_t *dt2, hbool_t superset)
if (dt1 == dt2)
HGOTO_DONE(0);
+ HDassert(dt1->shared);
+ HDassert(dt2->shared);
+
/* compare */
if (dt1->shared->type < dt2->shared->type)
HGOTO_DONE(-1);
@@ -4851,6 +4901,10 @@ H5T_cmp(const H5T_t *dt1, const H5T_t *dt2, hbool_t superset)
HGOTO_DONE(-1);
if (dt1->shared->u.atomic.u.r.loc > dt2->shared->u.atomic.u.r.loc)
HGOTO_DONE(1);
+ if (dt1->shared->u.atomic.u.r.file < dt2->shared->u.atomic.u.r.file)
+ HGOTO_DONE(-1);
+ if (dt1->shared->u.atomic.u.r.file > dt2->shared->u.atomic.u.r.file)
+ HGOTO_DONE(1);
break;
case H5T_NO_CLASS:
@@ -6229,6 +6283,7 @@ H5T_own_vol_obj(H5T_t *dt, H5VL_object_t *vol_obj)
/* Take ownership */
dt->shared->owned_vol_obj = vol_obj;
+ (void)H5VL_object_inc_rc(vol_obj);
done:
FUNC_LEAVE_NOAPI(ret_value)