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

zdb -R doesn't always print the full output. #15723

Merged
merged 1 commit into from
Jan 16, 2024

Conversation

rincebrain
Copy link
Contributor

Motivation and Context

zdb -R has a minor flaw in which it will not always print the full output of a decompressed block. Oops.

While I was in there, I also reworked the logic so it won't try ZLE unless everything else fails, which will hopefully avoid most cases of the problem ZDB_NO_ZLE was intended to mitigate of reporting a lot of false positives of ZLE compressed blocks without needing an explicit env option...

Description

Reworked zdb_decompress_block to return the lsize it found, or -1 if it decided nothing worked, so that if the lsize we gave it wasn't accurate (like, say, if we just gave it a DVA and it doesn't know the lsize or compression type), it doesn't fail to print things longer than the asize.

Also reworked the testing logic so it only tries ZLE after trying literally everything else and finding nothing worked, so that we both don't waste time on ZLE for most use cases and we don't fail to decompress those cases when we did before, so this reordering shouldn't affect any correct behavior anyone was using...

How Has This Been Tested?

Previously, attempting decompression of a random 128k zstd record on my pool only printed up to the compressed size of 0x19000, and also printed incorrect results of ZLE compression when you run it without ZDB_NO_ZLE=1. With this change, it prints the correct full 128k record decompressed, and correctly picks zstd without that flag.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Performance enhancement (non-breaking change which improves efficiency)
  • Code cleanup (non-breaking change which makes code smaller or more readable)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Library ABI change (libzfs, libzfs_core, libnvpair, libuutil and libzfsbootenv)
  • Documentation (a change to man pages or other documentation)

Checklist:

Copy link
Contributor

@behlendorf behlendorf left a comment

Choose a reason for hiding this comment

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

This makes good sense. We'll just need to coordinate merging this since it conflicts with some related cleanup in #15733. @rincebrain if you could take a look at #15733 we could get that small change merged and then rebase this.

@behlendorf behlendorf added Status: Code Review Needed Ready for review and testing Status: Accepted Ready to integrate (reviewed, tested) and removed Status: Code Review Needed Ready for review and testing labels Jan 9, 2024
@behlendorf
Copy link
Contributor

Looks good after a rebase to resolve the conflict.

zdb -R has a minor flaw in which it will not always print the full
output of a decompressed block. Oops.

While I was in there, I also reworked the logic so it won't try
ZLE unless everything else fails, which will hopefully avoid the
problem ZDB_NO_ZLE was intended to mitigate of reporting a lot of
false positives of ZLE compressed blocks...

Signed-off-by: Rich Ercolani <rincebrain@gmail.com>
@behlendorf behlendorf merged commit 1f5bf96 into openzfs:master Jan 16, 2024
24 of 25 checks passed
lundman pushed a commit to openzfsonwindows/openzfs that referenced this pull request Mar 13, 2024
zdb -R has a minor flaw in which it will not always print the full
output of a decompressed block. Oops.

While I was in there, I also reworked the logic so it won't try
ZLE unless everything else fails, which will hopefully avoid the
problem ZDB_NO_ZLE was intended to mitigate of reporting a lot of
false positives of ZLE compressed blocks...

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Rich Ercolani <rincebrain@gmail.com>
Closes openzfs#15723
lundman pushed a commit to openzfsonwindows/openzfs that referenced this pull request Mar 13, 2024
zdb -R has a minor flaw in which it will not always print the full
output of a decompressed block. Oops.

While I was in there, I also reworked the logic so it won't try
ZLE unless everything else fails, which will hopefully avoid the
problem ZDB_NO_ZLE was intended to mitigate of reporting a lot of
false positives of ZLE compressed blocks...

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Rich Ercolani <rincebrain@gmail.com>
Closes openzfs#15723
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Accepted Ready to integrate (reviewed, tested)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants