skip "Need MDS >= 2.14.0.88 for compression support"
local tf=$DIR/$tdir/$tfile
- local type="gzip lz4 lz4hc lzo"
+ local type="gzip lz4 lz4hc"
+ # lzo does not grok a compression level, add here other such algs
+ local type_nolvl="lzo"
local l1=1
local c1="64"
local p="$TMP/$TESTSUITE-$TESTNAME.parameters"
}
# normal compress type
- for t1 in $type; do
+ for t1 in $type $type_nolvl; do
+ local has_level=""
+
rm -f $tf
- $LFS setstripe -Eeof -S4M -Z $t1:$l1 --compress-chunk=${c1} \
- $tf || error "set a compress component in $tf failed"
+ [[ "$type_nolvl" =~ "$t1" ]] || has_level="y"
+ $LFS setstripe -Eeof -S4M -Z $t1${has_level:+":$l1"} \
+ --compress-chunk=${c1} $tf ||
+ error "set a compress component in $tf failed"
local t2=$($LFS getstripe --compr-type $tf)
local l2=$($LFS getstripe --compr-level $tf)
$LFS getstripe $tf
error "compress type $t1 != $t2"
}
- (( $l1 == $l2 )) || {
+ [[ -z "$has_level" || "$l1" == "$l2" ]] || {
$LFS getstripe $tf
error "compress level $l1 != $l2"
}
skip "Need MDS >= 2.14.0.88 for compression support"
local tf=$DIR/$tdir/$tfile
- local type="gzip lz4 lz4hc lzo"
+ local type="gzip lz4 lz4hc"
+ local type_num=$(wc -w <<< $type)
+ # lzo does not grok a compression level, add here other such algs
+ local type_nolvl="lzo"
+ local type_nolvl_num=$(wc -w <<< $type_nolvl)
local lvl=1
local cs="64"
local p="$TMP/$TESTSUITE-$TESTNAME.parameters"
+ local expect
save_lustre_params client "llite.*.enable_compression" > $p
stack_trap "rm -rf $DIR/$tdir; restore_lustre_params < $p" EXIT
error "setstripe upon $DIR/$tdir failed"
# create compress component files
- for tp in $type; do
- $LFS setstripe -Eeof -Z $tp:$lvl --compress-chunk=${cs} \
- ${tf}_${tp} ||
- error "set a compress component in $tf_${tp} failed"
+ for tp in $type $type_nolvl; do
+ local has_level=""
+
+ [[ "$type_nolvl" =~ "$tp" ]] || has_level="y"
+ $LFS setstripe -Eeof -Z $tp${has_level:+":$lvl"} \
+ --compress-chunk=${cs} ${tf}_${tp} ||
+ error "set a compress component in $tf_${tp} failed"
$LFS setstripe -Eeof --comp-flags=nocompr ${tf}_nocompr_${tp} ||
error "set a nocompr component in $tf_nocompr_${tp} failed"
$LFS setstripe -Eeof ${tf}_not_${tp} ||
local flg_opts="--comp-flags=compress"
found=$($LFS find $flg_opts $DIR/$tdir | wc -l)
- (( $found == 4 )) ||
- error "found $found compress (--comp-flags) file != 4"
+ expect=$((type_num + type_nolvl_num))
+ (( found == expect )) ||
+ error "found $found compress (--comp-flags) files != $expect"
flg_opts="--comp-flags=nocompr"
found=$($LFS find $flg_opts $DIR/$tdir | wc -l)
- (( $found == 4 )) || error "found $found nocompr file != 4"
+ (( found == expect )) ||
+ error "found $found nocompr file != $expect"
flg_opts="--comp-flags=^compress"
found=$($LFS find $flg_opts $DIR/$tdir | wc -l)
- (( $found == 9 )) || error "found $found ^compress file != 9"
+ (( found == 2*expect+1 )) ||
+ error "found $found ^compress file != $((2*expect+1))"
flg_opts="-L compress"
found=$($LFS find $flg_opts $DIR/$tdir | wc -l)
- (( $found == 4 )) || error "found $found compress (--layout) file != 4"
+ (( found == expect )) ||
+ error "found $found compress (--layout) file != $expect"
- for tp in $type; do
+ for tp in $type $type_nolvl; do
flg_opts="--compr-type=$tp"
found=$($LFS find $flg_opts $DIR/$tdir | wc -l)
- (( $found == 1 )) || error "found $found $tp compress file != 1"
+ (( found == 1 )) || error "found $found $tp compress file != 1"
done
+ flg_opts="--compr-level=0"
+ found=$($LFS find $flg_opts $DIR/$tdir | wc -l)
+ (( found == type_nolvl_num )) ||
+ error "found $found compr level $lvl file != $type_nolvl_num"
- for lvl in $(seq 1 4); do
+ for lvl in $(seq 1 $type_num); do
flg_opts="--compr-level=$lvl"
found=$($LFS find $flg_opts $DIR/$tdir | wc -l)
- (( $found == 1 )) ||
+ (( found == 1 )) ||
error "found $found compress level $lvl file != 1"
-
flg_opts="--compr-level=+$lvl"
found=$($LFS find $flg_opts $DIR/$tdir | wc -l)
- expect=$((4 - lvl))
- (( $found == $expect )) ||
+ expect=$(($type_num - lvl))
+ (( found == expect )) ||
error "found $found compress level +$lvl file != $expect"
flg_opts="--compr-level=-$lvl"
found=$($LFS find $flg_opts $DIR/$tdir | wc -l)
- expect=$lvl
- (( $found == $expect )) ||
+ expect=$((lvl + type_nolvl_num))
+ (( found == expect )) ||
error "found $found compress level -$lvl file != $expect"
done
for chunk in $cs; do
flg_opts="--compr-chunk=$chunk"
found=$($LFS find $flg_opts $DIR/$tdir | wc -l)
- (( $found == 1 )) ||
+ (( found == 1 )) ||
error "found $found compress $chunk file != 1"
flg_opts="--compr-chunk=+$chunk"
found=$($LFS find $flg_opts $DIR/$tdir | wc -l)
- expect=$((4 - i))
- (( $found == $expect )) ||
+ expect=$(($type_num + $type_nolvl_num - i))
+ (( found == expect )) ||
error "found $found compress chunk +$chunk file != $expect"
flg_opts="--compr-chunk=-$chunk"
found=$($LFS find $flg_opts $DIR/$tdir | wc -l)
expect=$i
- (( $found == $expect )) ||
+ (( found == expect )) ||
error "found $found compress chunk -$chunk file != $expect"
((i++))