5 # The contents of this file are subject to the terms of the
6 # Common Development and Distribution License (the "License").
7 # You may not use this file except in compliance with the License.
9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 # or http://www.opensolaris.org/os/licensing.
11 # See the License for the specific language governing permissions
12 # and limitations under the License.
14 # When distributing Covered Code, include this CDDL HEADER in each
15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 # If applicable, add the following below this CDDL HEADER, with the
17 # fields enclosed by brackets "[]" replaced with your own identifying
18 # information: Portions Copyright [yyyy] [name of copyright owner]
24 # Copyright 2007 Sun Microsystems, Inc. All rights reserved.
25 # Use is subject to license terms.
29 # Copyright (c) 2013, 2016 by Delphix. All rights reserved.
32 .
$STF_SUITE/include
/libtest.shlib
36 # With 'compression' or 'compress' set, changing filesystem blocksize cannot
40 # 1. Set 'compression' or "compress" to on
41 # 2. Set different blocksize with ZFS filesystem
42 # 3. Use 'mkfile' create single block and multi-block files
43 # 4. Verify the system continued work
46 verify_runnable
"both"
53 log_assert
"Changing blocksize doesn't casue system panic with compression settings"
57 single_blk_file
=$TESTDIR/singleblkfile.$$
58 multi_blk_file
=$TESTDIR/multiblkfile.$$
59 typeset
-i blksize
=512
63 for propname
in "compression" "compress"
65 for value
in $
(get_compress_opts zfs_compress
)
67 log_must zfs
set $propname=$value $fs
68 if [[ $value == "gzip-6" ]]; then
71 real_val
=$
(get_prop
$propname $fs)
72 [[ $real_val != $value ]] && \
73 log_fail
"Set property $propname=$value failed."
76 while (( blksize
<= 131072 )); do
77 log_must zfs
set recordsize
=$blksize $fs
78 (( offset
= $RANDOM ))
79 if (( offset
> blksize
)); then
80 (( offset
= offset
% blksize
))
82 if (( (offset
% 2) == 0 )); then
83 #keep offset as non-power-of-2
84 (( offset
= offset
+ 1 ))
87 log_must mkfile
$fsize $single_blk_file
88 (( fsize
= blksize
+ offset
))
89 log_must mkfile
$fsize $multi_blk_file
91 (( blksize
= blksize
* 2 ))
96 log_pass
"The system works as expected while changing blocksize with compression settings"