2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (C) 2014 SUSE Linux Products GmbH. All Rights Reserved.
5 # FS QA Test No. btrfs/059
7 # Regression test for btrfs where removing the flag FS_COMPR_FL (chattr -c)
8 # from an inode wouldn't clear its compression property.
9 # This was fixed in the following linux kernel patch:
11 # Btrfs: add missing compression property remove in btrfs_ioctl_setflags
14 seqres=$RESULT_DIR/$seq
15 echo "QA output created by $seq"
20 status=1 # failure is the default!
21 trap "_cleanup; exit \$status" 0 1 2 3 15
28 # get standard environment, filters and checks
31 . ./common/filter.btrfs
33 # real QA test starts here
38 _require_btrfs_command "property"
42 _scratch_mkfs >> $seqres.full 2>&1
45 mkdir $SCRATCH_MNT/testdir
46 echo "Setting compression flag in the directory..."
47 $CHATTR_PROG +c $SCRATCH_MNT/testdir
48 echo "Directory compression property value:"
49 $BTRFS_UTIL_PROG property get $SCRATCH_MNT/testdir compression | \
50 _filter_btrfs_compress_property
52 touch $SCRATCH_MNT/testdir/file1
53 echo "file1 compression property value:"
54 $BTRFS_UTIL_PROG property get $SCRATCH_MNT/testdir/file1 compression | \
55 _filter_btrfs_compress_property
57 echo "Clearing compression flag from directory..."
58 $CHATTR_PROG -c $SCRATCH_MNT/testdir
59 echo "Directory compression property value:"
60 $BTRFS_UTIL_PROG property get $SCRATCH_MNT/testdir compression | \
61 _filter_btrfs_compress_property
63 touch $SCRATCH_MNT/testdir/file2
64 echo "file2 compression property value:"
65 $BTRFS_UTIL_PROG property get $SCRATCH_MNT/testdir/file2 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