Skip to content

Commit

Permalink
Default to ON for compression
Browse files Browse the repository at this point in the history
A simple change, but so many tests break with it,
and those are the majority of this.

Reviewed-by: George Melikov <mail@gmelikov.ru>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Rich Ercolani <rincebrain@gmail.com>
Closes openzfs#13078
  • Loading branch information
rincebrain authored and andrewc12 committed Sep 23, 2022
1 parent dd6acb8 commit 1125179
Show file tree
Hide file tree
Showing 39 changed files with 124 additions and 43 deletions.
3 changes: 2 additions & 1 deletion contrib/pyzfs/libzfs_core/test/test_libzfs_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -4132,7 +4132,8 @@ def __init__(self, size=128 * 1024 * 1024, readonly=False, filesystems=[]):
cachefile = 'none'
self._zpool_create = [
'zpool', 'create', '-o', 'cachefile=' + cachefile,
'-O', 'mountpoint=legacy', self._pool_name, self._pool_file_path]
'-O', 'mountpoint=legacy', '-O', 'compression=off',
self._pool_name, self._pool_file_path]
try:
os.ftruncate(fd, size)
os.close(fd)
Expand Down
2 changes: 1 addition & 1 deletion include/sys/zio.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ enum zio_checksum {
#define ZIO_COMPRESS_LEGACY_ON_VALUE ZIO_COMPRESS_LZJB
#define ZIO_COMPRESS_LZ4_ON_VALUE ZIO_COMPRESS_LZ4

#define ZIO_COMPRESS_DEFAULT ZIO_COMPRESS_OFF
#define ZIO_COMPRESS_DEFAULT ZIO_COMPRESS_ON

#define BOOTFS_COMPRESS_VALID(compress) \
((compress) == ZIO_COMPRESS_LZJB || \
Expand Down
4 changes: 2 additions & 2 deletions man/man7/zfsprops.7
Original file line number Diff line number Diff line change
Expand Up @@ -784,9 +784,9 @@ Changing this property affects only newly-written data.
.Xc
Controls the compression algorithm used for this dataset.
.Pp
Setting compression to
When set to
.Sy on
indicates that the current default compression algorithm should be used.
(the default), indicates that the current default compression algorithm should be used.
The default balances compression and decompression speed, with compression ratio
and is expected to work well on a wide variety of workloads.
Unlike all other settings for this property,
Expand Down
48 changes: 35 additions & 13 deletions tests/zfs-tests/include/libtest.shlib
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ function create_recv_clone
datasetexists $recvfs && log_fail "Recv filesystem must not exist."
datasetexists $sendfs && log_fail "Send filesystem must not exist."

log_must zfs create -o mountpoint="$mountpoint" $sendfs
log_must zfs create -o compression=off -o mountpoint="$mountpoint" $sendfs
log_must zfs snapshot $snap
log_must eval "zfs send $snap | zfs recv -u $recvfs"
log_must mkfile 1m "$mountpoint/data"
Expand Down Expand Up @@ -3567,17 +3567,19 @@ function wait_replacing #pool
done
}

#
# Wait for a pool to be scrubbed
#
# $1 pool name
# $2 timeout
#
function wait_scrubbed
function wait_scrubbed #pool timeout
{
typeset pool=${1:-$TESTPOOL}
while ! is_pool_scrubbed $pool ; do
sleep 1
done
typeset timeout=${2:-300}
typeset pool=${1:-$TESTPOOL}
for (( timer = 0; timer < $timeout; timer++ )); do
is_pool_scrubbed $pool && break;
sleep 1;
done
}

# Backup the zed.rc in our test directory so that we can edit it for our test.
Expand Down Expand Up @@ -3671,6 +3673,21 @@ function zed_cleanup
rmdir $ZEDLET_DIR
}

#
# Check if ZED is currently running; if so, returns PIDs
#
function zed_check
{
if ! is_linux; then
return
fi
zedpids="$(pgrep -x zed)"
# ret1=$?
zedpids2="$(pgrep -x lt-zed)"
# ret2=$?
echo ${zedpids} ${zedpids2}
}

#
# Check if ZED is currently running, if not start ZED.
#
Expand All @@ -3686,9 +3703,14 @@ function zed_start
fi

# Verify the ZED is not already running.
pgrep -x zed > /dev/null
if (($? == 0)); then
log_note "ZED already running"
zedpids=$(zed_check)
if [ -n "$zedpids" ]; then
# We never, ever, really want it to just keep going if zed
# is already running - usually this implies our test cases
# will break very strangely because whatever we wanted to
# configure zed for won't be listening to our changes in the
# tmpdir
log_fail "ZED already running - ${zedpids}"
else
log_note "Starting ZED"
# run ZED in the background and redirect foreground logging
Expand All @@ -3707,13 +3729,13 @@ function zed_start
function zed_stop
{
if ! is_linux; then
return
return ""
fi

log_note "Stopping ZED"
while true; do
zedpids="$(pgrep -x zed)"
[ "$?" -ne 0 ] && break
zedpids=$(zed_check)
[ ! -n "$zedpids" ] && break

log_must kill $zedpids
sleep 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ log_assert "Verify that the space used by multiple copies is charged correctly."
log_onexit cleanup

for val in 1 2 3; do
log_must zfs create -o copies=$val $TESTPOOL/fs_$val
log_must zfs create -o compression=off -o copies=$val $TESTPOOL/fs_$val

log_must mkfile $FILESIZE /$TESTPOOL/fs_$val/$FILE
done
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,4 @@
DISK=${DISKS%% *}

default_setup $DISK
zfs set compression=off $TESTPOOL/$TESTFS
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ function cleanup
set_tunable64 LIVELIST_MAX_ENTRIES $ORIGINAL_MAX
# reset the minimum percent shared to 75
set_tunable32 LIVELIST_MIN_PERCENT_SHARED $ORIGINAL_MIN
log_must zfs inherit compression $TESTPOOL
}

function check_ll_len
Expand Down Expand Up @@ -116,6 +117,11 @@ ORIGINAL_MAX=$(get_tunable LIVELIST_MAX_ENTRIES)
ORIGINAL_MIN=$(get_tunable LIVELIST_MIN_PERCENT_SHARED)

log_onexit cleanup
# You might think that setting compression=off for $TESTFS1 would be
# sufficient. You would be mistaken.
# You need compression=off for whatever the parent of $TESTFS1 is,
# and $TESTFS1.
log_must zfs set compression=off $TESTPOOL
log_must zfs create $TESTPOOL/$TESTFS1
log_must mkfile 5m /$TESTPOOL/$TESTFS1/atestfile
log_must zfs snapshot $TESTPOOL/$TESTFS1@snap
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ function cleanup
# reset the condense tests to 0
set_tunable32 LIVELIST_CONDENSE_ZTHR_PAUSE 0
set_tunable32 LIVELIST_CONDENSE_SYNC_PAUSE 0
log_must zfs inherit compression $TESTPOOL
}

function delete_race
Expand Down Expand Up @@ -93,6 +94,11 @@ ORIGINAL_MAX=$(get_tunable LIVELIST_MAX_ENTRIES)

log_onexit cleanup

# You might think that setting compression=off for $TESTFS1 would be
# sufficient. You would be mistaken.
# You need compression=off for whatever the parent of $TESTFS1 is,
# and $TESTFS1.
log_must zfs set compression=off $TESTPOOL
log_must zfs create $TESTPOOL/$TESTFS1
log_must mkfile 100m /$TESTPOOL/$TESTFS1/atestfile
sync_pool $TESTPOOL
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,16 @@ function test_dedup
ORIGINAL_MIN_SHARED=$(get_tunable LIVELIST_MIN_PERCENT_SHARED)

log_onexit cleanup
# You might think that setting compression=off for $TESTFS1 would be
# sufficient. You would be mistaken.
# You need compression=off for whatever the parent of $TESTFS1 is,
# and $TESTFS1.
log_must zfs set compression=off $TESTPOOL
log_must zfs create $TESTPOOL/$TESTFS1
log_must mkfile 5m /$TESTPOOL/$TESTFS1/atestfile
log_must zfs snapshot $TESTPOOL/$TESTFS1@snap
test_dedup

log_must zfs inherit compression $TESTPOOL

log_pass "Clone's livelist processes dedup blocks as expected."
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ function cleanup
datasetexists $TESTPOOL/$TESTFS1 && destroy_dataset $TESTPOOL/$TESTFS1 -R
# reset the livelist sublist size to its original value
set_tunable64 LIVELIST_MAX_ENTRIES $ORIGINAL_MAX
log_must zfs inherit compression $TESTPOOL
}

function clone_write_file
Expand Down Expand Up @@ -146,6 +147,11 @@ function test_clone_clone_promote
ORIGINAL_MAX=$(get_tunable LIVELIST_MAX_ENTRIES)

log_onexit cleanup
# You might think that setting compression=off for $TESTFS1 would be
# sufficient. You would be mistaken.
# You need compression=off for whatever the parent of $TESTFS1 is,
# and $TESTFS1.
log_must zfs set compression=off $TESTPOOL
log_must zfs create $TESTPOOL/$TESTFS1
log_must mkfile 20m /$TESTPOOL/$TESTFS1/atestfile
log_must zfs snapshot $TESTPOOL/$TESTFS1@snap
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ VIRTUAL_DISK2=$TEST_BASE_DIR/disk2
log_must truncate -s $(($MINVDEVSIZE * 8)) $VIRTUAL_DISK1
log_must truncate -s $(($MINVDEVSIZE * 16)) $VIRTUAL_DISK2

log_must zpool create $TESTPOOL2 $VIRTUAL_DISK1
log_must zpool create -O compression=off $TESTPOOL2 $VIRTUAL_DISK1
log_must poolexists $TESTPOOL2

log_must zfs create $TESTPOOL2/$TESTFS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ log_must eval "check_prop_inherit $destsub copies $dest"
log_must eval "check_prop_inherit $destsub atime $dest"
log_must eval "check_prop_inherit $destsub checksum $dest"
log_must eval "check_prop_source $destsub quota 0 default"
log_must eval "check_prop_source $destsub compression off default"
log_must eval "check_prop_source $destsub compression on default"
# Cleanup
log_must zfs destroy -r -f $orig
log_must zfs destroy -r -f $dest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ log_must eval "check_prop_inherit $destsub atime $dest"
log_must eval "check_prop_inherit $destsub checksum $dest"
log_must eval "check_prop_inherit $destsub '$userprop:dest2' $dest"
log_must eval "check_prop_source $destsub quota 0 default"
log_must eval "check_prop_source $destsub compression off default"
log_must eval "check_prop_source $destsub compression on default"
log_must eval "check_prop_missing $dest '$userprop:orig'"
log_must eval "check_prop_missing $destsub '$userprop:orig'"
log_must eval "check_prop_source " \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ if [[ -d $TESTDIR2 ]]; then
log_unresolved Could not remove $TESTDIR2
fi
fi
log_must zfs create $TESTPOOL/$DATAFS
log_must zfs set compression=off $TESTPOOL/$TESTFS
log_must zfs create -o compression=off $TESTPOOL/$DATAFS
log_must zfs set mountpoint=$TESTDIR2 $TESTPOOL/$DATAFS
log_must eval "dd if=$IF of=$OF bs=$BS count=$CNT >/dev/null 2>&1"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ log_must set_tunable64 TRIM_EXTENT_BYTES_MIN 4096

log_must mkdir "$TESTDIR"
log_must truncate -s $LARGESIZE "$LARGEFILE"
log_must zpool create $TESTPOOL "$LARGEFILE"
log_must zpool create -O compression=off $TESTPOOL "$LARGEFILE"
log_must mkfile $(( floor(LARGESIZE * 0.80) )) /$TESTPOOL/file
sync_all_pools

Expand Down
2 changes: 2 additions & 0 deletions tests/zfs-tests/tests/functional/events/cleanup.ksh
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,6 @@

zed_cleanup all-debug.sh all-syslog.sh all-dumpfds

zed_stop

default_cleanup
2 changes: 1 addition & 1 deletion tests/zfs-tests/tests/functional/events/events_002_pos.ksh
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ log_must truncate -s $MINVDEVSIZE $VDEV1 $VDEV2
# 1. Create a pool and generate some events.
log_must truncate -s 0 $ZED_DEBUG_LOG
log_must zpool events -c
log_must zpool create $MPOOL mirror $VDEV1 $VDEV2
log_must zpool create -O compression=off $MPOOL mirror $VDEV1 $VDEV2

# 2. Start the ZED and verify it handles missed events.
log_must zed_start
Expand Down
8 changes: 7 additions & 1 deletion tests/zfs-tests/tests/functional/events/zed_fd_spill.ksh
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,14 @@ log_onexit cleanup
logdir="$(mktemp -d)"
log_must ln -s "$logdir" /tmp/zts-zed_fd_spill-logdir


self="$(readlink -f "$0")"
log_must ln -s "${self%/*}/zed_fd_spill-zedlet" "${ZEDLET_DIR}/all-dumpfds"
zedlet="${self%/*}/zed_fd_spill-zedlet"
log_must ln -s $zedlet "${ZEDLET_DIR}/all-dumpfds"

# zed will cry foul and refuse to run it if this isn't true
sudo chown root $zedlet
sudo chmod 700 $zedlet

log_must zpool events -c
log_must zed_stop
Expand Down
1 change: 1 addition & 0 deletions tests/zfs-tests/tests/functional/fault/decrypt_fault.ksh
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ function cleanup
log_onexit cleanup

default_mirror_setup_noexit $DISK1 $DISK2
log_must zfs set compression=off $TESTPOOL
log_must eval "echo 'password' | zfs create -o encryption=on \
-o keyformat=passphrase -o keylocation=prompt $TESTPOOL/fs"
mntpt=$(get_prop mountpoint $TESTPOOL/fs)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -388,12 +388,12 @@ set -A prop "checksum" "" \
# above must have a corresponding entry in the two arrays below.
#

set -A def_val "on" "off" "on" \
set -A def_val "on" "on" "on" \
"off" "" \
"hidden" \
"off"

set -A local_val "off" "on" "off" \
set -A local_val "off" "off" "off" \
"on" "" \
"visible" \
"off"
Expand Down
2 changes: 2 additions & 0 deletions tests/zfs-tests/tests/functional/projectquota/setup.ksh
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,6 @@ fi
DISK=${DISKS%% *}
default_setup_noexit $DISK

zfs set compression=off $TESTPOOL

log_pass
4 changes: 3 additions & 1 deletion tests/zfs-tests/tests/functional/quota/setup.ksh
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,6 @@

DISK=${DISKS%% *}

default_container_setup $DISK
default_setup_noexit $DISK "true"
log_must zfs set compression=off $TESTPOOL
log_pass
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ function setup_test_env

log_must truncate -s $MINVDEVSIZE $vdevs

log_must zpool create -f -m $TESTDIR $pool $keyword $vdevs
log_must zpool create -O compression=off -f -m $TESTDIR $pool $keyword $vdevs

log_note "Filling up the filesystem ..."
typeset -i ret=0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ for nparity in 1 2 3; do
raid=draid$nparity
dir=$TEST_BASE_DIR

log_must zpool create -f -o cachefile=none $TESTPOOL $raid ${disks[@]}
log_must zpool create -O compression=off -f -o cachefile=none $TESTPOOL $raid ${disks[@]}
log_must zfs set primarycache=metadata $TESTPOOL

log_must zfs create $TESTPOOL/fs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@ function test_sequential_resilver # <pool> <parity> <dir>

for (( i=0; i<$nparity; i=i+1 )); do
spare=draid${nparity}-0-$i
log_must zpool replace -fsw $pool $dir/dev-$i $spare
zpool status $pool
zpool replace -fsw $pool $dir/dev-$i $spare
zpool status $pool
done

log_must zpool scrub -w $pool
Expand Down Expand Up @@ -128,7 +130,7 @@ for nparity in 1 2 3; do
raid=draid${nparity}:${nparity}s
dir=$TEST_BASE_DIR

log_must zpool create -f -o cachefile=none $TESTPOOL $raid ${disks[@]}
log_must zpool create -O compression=off -f -o cachefile=none $TESTPOOL $raid ${disks[@]}
log_must zfs set primarycache=metadata $TESTPOOL

log_must zfs create $TESTPOOL/fs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ for nparity in 1 2 3; do
raid=raidz$nparity
dir=$TEST_BASE_DIR

log_must zpool create -f -o cachefile=none $TESTPOOL $raid ${disks[@]}
log_must zpool create -O compression=off -f -o cachefile=none $TESTPOOL $raid ${disks[@]}
log_must zfs set primarycache=metadata $TESTPOOL

log_must zfs create $TESTPOOL/fs
Expand Down
4 changes: 3 additions & 1 deletion tests/zfs-tests/tests/functional/refquota/setup.ksh
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,6 @@

verify_runnable "both"
DISK=${DISKS%% *}
default_setup $DISK
default_setup_noexit $DISK
log_must zfs set compression=off $TESTPOOL
log_pass
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ for parity in 1 2 3; do
continue
fi

log_must zpool create "$TESTPOOL" "$raid" "${disks[@]}"
log_must zpool create -O compression=off "$TESTPOOL" "$raid" "${disks[@]}"

for bits in "${allshifts[@]}"; do
vbs=$((1 << bits))
Expand Down
Loading

0 comments on commit 1125179

Please sign in to comment.