-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Misc libzfs sendrecv cleanup #12967
Misc libzfs sendrecv cleanup #12967
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like most of these commits are straight forward cleanup which should be easy to get integrated. If we could for the moment drop the WIP changes from this PR we could get the cleanup in sooner. The only additional thing I'd ask is to flesh out the individual commit comments so they contain more than just a subject.
We won't be passing a negative value here, so make it clear. Signed-off-by: Ryan Moeller <freqlabs@FreeBSD.org>
De-clutter the clode and make it clear the guid is only used here. Signed-off-by: Ryan Moeller <freqlabs@FreeBSD.org>
avl_add does avl_find internally, then avl_insert. We're already doing the avl_find, so using avl_insert directly avoids repeating the search. Signed-off-by: Ryan Moeller <freqlabs@FreeBSD.org>
There is no need to allocate a holds nvlist. lzc_get_holds does that for us. Signed-off-by: Ryan Moeller <freqlabs@FreeBSD.org>
* Add a high level comment. * Use local variables to reduce line wrapping. * Remove extra braces and insert space for clarity. * Assert precondition that the dataset name contains '@' for sanity. Signed-off-by: Ryan Moeller <freqlabs@FreeBSD.org>
* Add a high level comment. * Move locals closer to point of use. * Use fnv* routines rather than explicit verification of success. * Factor out duplicated code by introducing isspacelimit to clarify behavior. Signed-off-by: Ryan Moeller <freqlabs@FreeBSD.org>
* Capitalize and punctuate complete sentences in comments. * Separate out a group of locals to add a comment on their purpose. * Remove unnecessary line wrapping. * Make it clear that dds_origin is a string by using explicit character comparison to check for an empty string, rather than implictly treating it as a boolean. * Reorganize manipulation of props and holds nvlists to improve clarity. * There's no need to initialize the snapname buffer with zeros, we're immediately overwriting it. Signed-off-by: Ryan Moeller <freqlabs@FreeBSD.org>
* Reduce indentation. * Move locals closer to use. Signed-off-by: Ryan Moeller <freqlabs@FreeBSD.org>
* Don't bother building a debug nvlist if we can't return it. * Save errno after ioctl failure in case snprintf clobbers it. Signed-off-by: Ryan Moeller <freqlabs@FreeBSD.org>
In zfs_send_progress, initialize \*bytes_written and \*blocks_visited in case we have to return early due to ioctl failure. Signed-off-by: Ryan Moeller <freqlabs@FreeBSD.org>
This makes the header print before the sleep as well, which is fine. Signed-off-by: Ryan Moeller <freqlabs@FreeBSD.org>
* Add missing dgettext calls. * Avoid unnecessary line wraps. * Factor out duplicated parsable check. Signed-off-by: Ryan Moeller <freqlabs@FreeBSD.org>
* Add a high level comment. * Avoid unnecessary line wrapping. * Simplify size accounting logic. * Eliminate unnecessary buffer on the stack. Signed-off-by: Ryan Moeller <freqlabs@FreeBSD.org>
* Add high level comments. * Eliminate unnecessarily void arg. * Avoid unnecessary line wrapping. * Initialize sdd fields with the correct types. * Remove extra whitespace. * Refactor replication checks for clarity. Signed-off-by: Ryan Moeller <freqlabs@FreeBSD.org>
* Add a high level comment. * Eliminate unnecessarily void arg. * Capitalize and punctuate complete sentences in comments. Signed-off-by: Ryan Moeller <freqlabs@FreeBSD.org>
* Capitalize and punctuate complete sentences. * Add a blank line between functions. Signed-off-by: Ryan Moeller <freqlabs@FreeBSD.org>
Factor out get_bookmarks, find_redact_pair, and get_redact_complete helper functions to improve the readability of find_redact_book. Signed-off-by: Ryan Moeller <freqlabs@FreeBSD.org>
Improve the readability of zfs_send_resume_impl by moving resume nvl decoding into a separate helper function. Signed-off-by: Ryan Moeller <freqlabs@FreeBSD.org>
* Improve naming. * Reduce indentation. * Avoid boilerplate logic duplication. Signed-off-by: Ryan Moeller <freqlabs@FreeBSD.org>
De-clutter the clode and make it clear the guid is only used here. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Ryan Moeller <freqlabs@FreeBSD.org> Closes #12967
avl_add does avl_find internally, then avl_insert. We're already doing the avl_find, so using avl_insert directly avoids repeating the search. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Ryan Moeller <freqlabs@FreeBSD.org> Closes #12967
This makes the header print before the sleep as well, which is fine. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Ryan Moeller <freqlabs@FreeBSD.org> Closes openzfs#12967
* Add missing dgettext calls. * Avoid unnecessary line wraps. * Factor out duplicated parsable check. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Ryan Moeller <freqlabs@FreeBSD.org> Closes openzfs#12967
* Add a high level comment. * Avoid unnecessary line wrapping. * Simplify size accounting logic. * Eliminate unnecessary buffer on the stack. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Ryan Moeller <freqlabs@FreeBSD.org> Closes openzfs#12967
* Add high level comments. * Eliminate unnecessarily void arg. * Avoid unnecessary line wrapping. * Initialize sdd fields with the correct types. * Remove extra whitespace. * Refactor replication checks for clarity. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Ryan Moeller <freqlabs@FreeBSD.org> Closes openzfs#12967
* Add a high level comment. * Eliminate unnecessarily void arg. * Capitalize and punctuate complete sentences in comments. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Ryan Moeller <freqlabs@FreeBSD.org> Closes openzfs#12967
* Capitalize and punctuate complete sentences. * Add a blank line between functions. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Ryan Moeller <freqlabs@FreeBSD.org> Closes openzfs#12967
Factor out get_bookmarks, find_redact_pair, and get_redact_complete helper functions to improve the readability of find_redact_book. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Ryan Moeller <freqlabs@FreeBSD.org> Closes openzfs#12967
Improve the readability of zfs_send_resume_impl by moving resume nvl decoding into a separate helper function. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Ryan Moeller <freqlabs@FreeBSD.org> Closes openzfs#12967
* Improve naming. * Reduce indentation. * Avoid boilerplate logic duplication. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Ryan Moeller <freqlabs@FreeBSD.org> Closes openzfs#12967
We won't be passing a negative value here, so make it clear. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Ryan Moeller <freqlabs@FreeBSD.org> Closes openzfs#12967
De-clutter the clode and make it clear the guid is only used here. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Ryan Moeller <freqlabs@FreeBSD.org> Closes openzfs#12967
avl_add does avl_find internally, then avl_insert. We're already doing the avl_find, so using avl_insert directly avoids repeating the search. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Ryan Moeller <freqlabs@FreeBSD.org> Closes openzfs#12967
There is no need to allocate a holds nvlist. lzc_get_holds does that for us. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Ryan Moeller <freqlabs@FreeBSD.org> Closes openzfs#12967
* Add a high level comment. * Use local variables to reduce line wrapping. * Remove extra braces and insert space for clarity. * Assert precondition that the dataset name contains '@' for sanity. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Ryan Moeller <freqlabs@FreeBSD.org> Closes openzfs#12967
* Add a high level comment. * Move locals closer to point of use. * Use fnv* routines rather than explicit verification of success. * Factor out duplicated code by introducing isspacelimit to clarify behavior. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Ryan Moeller <freqlabs@FreeBSD.org> Closes openzfs#12967
* Capitalize and punctuate complete sentences in comments. * Separate out a group of locals to add a comment on their purpose. * Remove unnecessary line wrapping. * Make it clear that dds_origin is a string by using explicit character comparison to check for an empty string, rather than implictly treating it as a boolean. * Reorganize manipulation of props and holds nvlists to improve clarity. * There's no need to initialize the snapname buffer with zeros, we're immediately overwriting it. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Ryan Moeller <freqlabs@FreeBSD.org> Closes openzfs#12967
* Reduce indentation. * Move locals closer to use. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Ryan Moeller <freqlabs@FreeBSD.org> Closes openzfs#12967
* Don't bother building a debug nvlist if we can't return it. * Save errno after ioctl failure in case snprintf clobbers it. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Ryan Moeller <freqlabs@FreeBSD.org> Closes openzfs#12967
In zfs_send_progress, initialize \*bytes_written and \*blocks_visited in case we have to return early due to ioctl failure. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Ryan Moeller <freqlabs@FreeBSD.org> Closes openzfs#12967
This makes the header print before the sleep as well, which is fine. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Ryan Moeller <freqlabs@FreeBSD.org> Closes openzfs#12967
* Add missing dgettext calls. * Avoid unnecessary line wraps. * Factor out duplicated parsable check. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Ryan Moeller <freqlabs@FreeBSD.org> Closes openzfs#12967
* Add a high level comment. * Avoid unnecessary line wrapping. * Simplify size accounting logic. * Eliminate unnecessary buffer on the stack. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Ryan Moeller <freqlabs@FreeBSD.org> Closes openzfs#12967
* Add high level comments. * Eliminate unnecessarily void arg. * Avoid unnecessary line wrapping. * Initialize sdd fields with the correct types. * Remove extra whitespace. * Refactor replication checks for clarity. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Ryan Moeller <freqlabs@FreeBSD.org> Closes openzfs#12967
* Add a high level comment. * Eliminate unnecessarily void arg. * Capitalize and punctuate complete sentences in comments. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Ryan Moeller <freqlabs@FreeBSD.org> Closes openzfs#12967
* Capitalize and punctuate complete sentences. * Add a blank line between functions. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Ryan Moeller <freqlabs@FreeBSD.org> Closes openzfs#12967
Factor out get_bookmarks, find_redact_pair, and get_redact_complete helper functions to improve the readability of find_redact_book. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Ryan Moeller <freqlabs@FreeBSD.org> Closes openzfs#12967
Improve the readability of zfs_send_resume_impl by moving resume nvl decoding into a separate helper function. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Ryan Moeller <freqlabs@FreeBSD.org> Closes openzfs#12967
* Improve naming. * Reduce indentation. * Avoid boilerplate logic duplication. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Ryan Moeller <freqlabs@FreeBSD.org> Closes openzfs#12967
* Add missing dgettext calls. * Avoid unnecessary line wraps. * Factor out duplicated parsable check. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Ryan Moeller <freqlabs@FreeBSD.org> Closes #12967
Motivation and Context
I've been studying libzfs sendrecv code and cleaning up things as I go. This is far from complete, but I don't want to keep sitting on these patches.
Description
See individual commit messages for now.
How Has This Been Tested?
ZTS on FreeBSD.
Types of changes
Checklist:
Signed-off-by
.