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

Fix test, and kstat bug #22

Merged
merged 2 commits into from
Aug 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion module/zstd/zfs_zstd.c
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ zstd_compress(void *s_start, void *d_start, size_t s_len, size_t d_len,
* too small, that is not a failure. Everything else is a
* failure, so increment the compression failure counter.
*/
if (c_len != ZSTD_error_dstSize_tooSmall) {
if (ZSTD_getErrorCode(c_len) != ZSTD_error_dstSize_tooSmall) {
ZSTDSTAT_BUMP(zstd_stat_com_fail);
}
return (s_len);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,22 @@ log_assert "Setting compression=zstd should activate the"\
"dataset using that property, should revert the feature flag to"\
"the enabled state."

featureval="$(get_pool_prop feature@zstd_compress $TESTPOOL)"
export VDEV_ZSTD="$TEST_BASE_DIR/vdev-zstd"

function cleanup
{
if poolexists $TESTPOOL-zstd ; then
destroy_pool $TESTPOOL-zstd
fi

rm $VDEV_ZSTD
}
log_onexit cleanup

log_must truncate -s $SPA_MINDEVSIZE $VDEV_ZSTD
log_must zpool create $TESTPOOL-zstd $VDEV_ZSTD

featureval="$(get_pool_prop feature@zstd_compress $TESTPOOL-zstd)"

[[ "$featureval" == "disabled" ]] && \
log_unsupported "ZSTD feature flag unsupposed"
Expand All @@ -61,18 +76,18 @@ featureval="$(get_pool_prop feature@zstd_compress $TESTPOOL)"
random_level=$((RANDOM%19 + 1))
log_note "Randomly selected ZSTD level: $random_level"

log_must zfs create -o compress=zstd-$random_level $TESTPOOL/$TESTFS-zstd
log_must zfs create -o compress=zstd-$random_level $TESTPOOL-zstd/$TESTFS-zstd

featureval="$(get_pool_prop feature@zstd_compress $TESTPOOL)"
featureval="$(get_pool_prop feature@zstd_compress $TESTPOOL-zstd)"

log_note "After zfs set, feature flag value is: $featureval"

[[ "$featureval" == "active" ]] ||
log_fail "ZSTD feature flag not activated"

log_must zfs destroy $TESTPOOL/$TESTFS-zstd
log_must zfs destroy $TESTPOOL-zstd/$TESTFS-zstd

featureval="$(get_pool_prop feature@zstd_compress $TESTPOOL)"
featureval="$(get_pool_prop feature@zstd_compress $TESTPOOL-zstd)"

log_note "After zfs destroy, feature flag value is: $featureval"

Expand Down