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
48 # real QA test starts here
53 _require_btrfs "property"
57 _scratch_mkfs >> $seqres.full 2>&1
60 mkdir $SCRATCH_MNT/testdir
61 echo "Setting compression flag in the directory..."
62 chattr +c $SCRATCH_MNT/testdir
63 echo "Directory compression property value:"
64 $BTRFS_UTIL_PROG property get $SCRATCH_MNT/testdir compression
66 touch $SCRATCH_MNT/testdir/file1
67 echo "file1 compression property value:"
68 $BTRFS_UTIL_PROG property get $SCRATCH_MNT/testdir/file1 compression
70 echo "Clearing compression flag from directory..."
71 chattr -c $SCRATCH_MNT/testdir
72 echo "Directory compression property value:"
73 $BTRFS_UTIL_PROG property get $SCRATCH_MNT/testdir compression
75 touch $SCRATCH_MNT/testdir/file2
76 echo "file2 compression property value:"
77 $BTRFS_UTIL_PROG property get $SCRATCH_MNT/testdir/file2 compression
79 touch $SCRATCH_MNT/testdir/file1
80 echo "file1 compression property value:"
81 $BTRFS_UTIL_PROG property get $SCRATCH_MNT/testdir/file1 compression