2 # FS QA Test No. btrfs/059
4 # Regression test for btrfs where removing the flag FS_COMPR_FL (chattr -c)
5 # from an inode wouldn't clear its compression property.
6 # This was fixed in the following linux kernel patch:
8 # Btrfs: add missing compression property remove in btrfs_ioctl_setflags
10 #-----------------------------------------------------------------------
11 # Copyright (C) 2014 SUSE Linux Products GmbH. All Rights Reserved.
12 # Author: Filipe Manana <fdmanana@suse.com>
14 # This program is free software; you can redistribute it and/or
15 # modify it under the terms of the GNU General Public License as
16 # published by the Free Software Foundation.
18 # This program is distributed in the hope that it would be useful,
19 # but WITHOUT ANY WARRANTY; without even the implied warranty of
20 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 # GNU General Public License for more details.
23 # You should have received a copy of the GNU General Public License
24 # along with this program; if not, write the Free Software Foundation,
25 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26 #-----------------------------------------------------------------------
30 seqres=$RESULT_DIR/$seq
31 echo "QA output created by $seq"
36 status=1 # failure is the default!
37 trap "_cleanup; exit \$status" 0 1 2 3 15
44 # get standard environment, filters and checks
47 . ./common/filter.btrfs
49 # real QA test starts here
54 _require_btrfs "property"
58 _scratch_mkfs >> $seqres.full 2>&1
61 mkdir $SCRATCH_MNT/testdir
62 echo "Setting compression flag in the directory..."
63 $CHATTR_PROG +c $SCRATCH_MNT/testdir
64 echo "Directory compression property value:"
65 $BTRFS_UTIL_PROG property get $SCRATCH_MNT/testdir compression | \
66 _filter_btrfs_compress_property
68 touch $SCRATCH_MNT/testdir/file1
69 echo "file1 compression property value:"
70 $BTRFS_UTIL_PROG property get $SCRATCH_MNT/testdir/file1 compression | \
71 _filter_btrfs_compress_property
73 echo "Clearing compression flag from directory..."
74 $CHATTR_PROG -c $SCRATCH_MNT/testdir
75 echo "Directory compression property value:"
76 $BTRFS_UTIL_PROG property get $SCRATCH_MNT/testdir compression | \
77 _filter_btrfs_compress_property
79 touch $SCRATCH_MNT/testdir/file2
80 echo "file2 compression property value:"
81 $BTRFS_UTIL_PROG property get $SCRATCH_MNT/testdir/file2 compression | \
82 _filter_btrfs_compress_property
84 touch $SCRATCH_MNT/testdir/file1
85 echo "file1 compression property value:"
86 $BTRFS_UTIL_PROG property get $SCRATCH_MNT/testdir/file1 compression | \
87 _filter_btrfs_compress_property