Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VOL refactor and cleanup #4856

Merged
merged 27 commits into from
Oct 3, 2024
Merged

VOL refactor and cleanup #4856

merged 27 commits into from
Oct 3, 2024

Conversation

qkoziol
Copy link
Contributor

@qkoziol qkoziol commented Sep 18, 2024

Cleanup and prepare for thread-safety changes.

Big ideas:

  • Wrap H5VL_class_t with H5VL_connector_t, so use of the class can be refcounted within the H5VL package, instead of relying on storing an ID within the H5VL_t struct and incrementing & decrementing the ID's refcount.
  • Register H5VL_connector_t* for VOL connector IDs, instead of the H5VL_class_t*
  • Stop other packages from rummaging around inside H5VL_connector_t and H5VL_object_t data structures, so that the H5VL package can change implementation details without coupled changes throughout the library

Small things:

  • Simplified the coding for creating links
  • Moved some routines into more logical locations

qkoziol and others added 12 commits September 6, 2024 17:47
Signed-off-by: Quincey Koziol <quincey@koziol.cc>
Signed-off-by: Quincey Koziol <quincey@koziol.cc>
So they don't sound like they are operating on connectors.

Signed-off-by: Quincey Koziol <quincey@koziol.cc>
Signed-off-by: Quincey Koziol <quincey@koziol.cc>
Also, small code tidying

Signed-off-by: Quincey Koziol <quincey@koziol.cc>
Signed-off-by: Quincey Koziol <quincey@koziol.cc>
Signed-off-by: Quincey Koziol <quincey@koziol.cc>
Also simplify and enforce some modularity boundaries around them, so that
other packages can't modify VOL data structures.

Signed-off-by: Quincey Koziol <quincey@koziol.cc>
Signed-off-by: Quincey Koziol <quincey@koziol.cc>
Signed-off-by: Quincey Koziol <quincey@koziol.cc>
!!
!! See C API: @ref H5VLcmp_connector_cls()
!!
SUBROUTINE H5VLcmp_connector_cls_f(are_same, conn_id1, conn_id2, hdferr)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This routine is necessary because it's possible to have VOL connector IDs that are different, but point to the same underlying VOL connector class.


f_ptr = C_NULL_PTR
CALL H5Pset_vol_f(fapl_id, vol_id, error, f_ptr)
CALL check("H5Pset_vol_f",error,total_error)

CALL H5Pget_vol_id_f(fapl_id, vol_id_out, error)
CALL check("H5Pget_vol_id_f",error,total_error)
CALL VERIFY("H5Pget_vol_id_f", vol_id_out, vol_id, total_error)
are_same = .FALSE.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use new routine instead of directly comparing IDs.

/**
* @ingroup JH5VL
*
* H5VLcmp_connector_cls Determines whether two connector identifiers refer to the same connector.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This routine is necessary because it's possible to have VOL connector IDs that are different, but point to the same underlying VOL connector class.

@@ -98,7 +98,8 @@ public void testH5VLget_connector_id()
*/
String connector = System.getenv("HDF5_VOL_CONNECTOR");
if (connector == null)
assertEquals(HDF5Constants.H5VL_NATIVE, native_id);
assertTrue("H5.H5VLcmp_connector_cls(H5VL_NATIVE_NAME, native_id)",
H5.H5VLcmp_connector_cls(HDF5Constants.H5VL_NATIVE, native_id));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use new routine instead of directly comparing IDs.

@@ -125,7 +125,7 @@ H5A__create_common(H5VL_object_t *vol_obj, H5VL_loc_params_t *loc_params, const
HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, H5I_INVALID_HID, "unable to create attribute");

/* Register the new attribute and get an ID for it */
if ((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->connector, true)) < 0)
if ((ret_value = H5VL_register(H5I_ATTR, attr, H5VL_OBJ_CONNECTOR(vol_obj), true)) < 0)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes, and similar ones in non-H5VL packages, are to remove the code coupling to the H5VL package, allowing it to change implementation of H5VL data structures without rippling through the library.

@@ -931,33 +931,27 @@ H5CX_retrieve_state(H5CX_state_t **api_state)
} /* end if */

/* Keep a copy of the VOL connector property, if there is one */
if ((*head)->ctx.vol_connector_prop_valid && (*head)->ctx.vol_connector_prop.connector_id > 0) {
if ((*head)->ctx.vol_connector_prop_valid && (*head)->ctx.vol_connector_prop.connector) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VOL connector property stores a pointer to the connector struct now, instead of nesting an ID inside the property list.

@@ -88,12 +88,6 @@ static herr_t H5F__flush_api_common(hid_t object_id, H5F_scope_t scope, void **t
/* Local Variables */
/*******************/

/* Declare a free list to manage the H5VL_t struct */
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused (and should not be used outside the H5VL package)

src/H5VL.c Show resolved Hide resolved
Signed-off-by: Quincey Koziol <quincey@koziol.cc>
src/H5VLint.c Outdated Show resolved Hide resolved
Signed-off-by: Quincey Koziol <quincey@koziol.cc>
@jhendersonHDF
Copy link
Collaborator

General comment: H5VLpeek_connector_id_by_name is used by the log-based VOL and H5VLpeek_connector_id_by_value is used by the REST and DAOS VOLs, so we'll want to decide how to handle that switchover gracefully.

@qkoziol
Copy link
Contributor Author

qkoziol commented Sep 25, 2024

General comment: H5VLpeek_connector_id_by_name is used by the log-based VOL and H5VLpeek_connector_id_by_value is used by the REST and DAOS VOLs, so we'll want to decide how to handle that switchover gracefully.

Yes. I added info to the RELEASE.txt note suggesting the correct action for developers who are using them. Anything else needed? We can update the connectors after the merge.

qkoziol and others added 7 commits September 26, 2024 15:41
Aligns them with the way the H5T, H5P, H5E packages return an ID back to
an application, and removes calling an internal routine from the public header.

Extra work for the internal passthru connector, to keep the main passthru
source file using only public API calls.

Signed-off-by: Quincey Koziol <quincey@koziol.cc>
Signed-off-by: Quincey Koziol <quincey@koziol.cc>
@qkoziol
Copy link
Contributor Author

qkoziol commented Oct 2, 2024

@jhendersonHDF - Any other comments for this PR? I'd like to get it merged ASAP after the 1.16 branch is created, so I can queue the next large one up.

@jhendersonHDF
Copy link
Collaborator

@qkoziol I don't think I have any other complaints in particular, though I believe @fortnern mentioned he still needed to review it and I also believe we decided to discuss this PR at the next working group meeting.

@qkoziol
Copy link
Contributor Author

qkoziol commented Oct 2, 2024

I've already discussed it at last week's meeting, although I'm happy to run through it again. I believe it's ready for any final review and merge.

@derobins derobins merged commit 767282f into HDFGroup:develop Oct 3, 2024
60 checks passed
@qkoziol qkoziol deleted the vol_cleanup branch October 3, 2024 19:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component - C Library Core C library issues (usually in the src directory) Component - Fortran Fortran wrappers Component - Java Java wrappers Component - Testing Code in test or testpar directories, GitHub workflows Component - Tools Command-line tools like h5dump, includes high-level tools Merge - Develop Only This cannot be merged to previous versions of HDF5 (file format or breaking API changes) Priority - 1. High 🔼 These are important issues that should be resolved in the next release Type - Improvement Improvements that don't add a new feature or functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants