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
37 _require_btrfs_command "property"
41 _scratch_mkfs >> $seqres.full 2>&1
44 mkdir $SCRATCH_MNT/testdir
45 echo "Setting compression flag in the directory..."
46 $CHATTR_PROG +c $SCRATCH_MNT/testdir
47 echo "Directory compression property value:"
48 $BTRFS_UTIL_PROG property get $SCRATCH_MNT/testdir compression | \
49 _filter_btrfs_compress_property
51 touch $SCRATCH_MNT/testdir/file1
52 echo "file1 compression property value:"
53 $BTRFS_UTIL_PROG property get $SCRATCH_MNT/testdir/file1 compression | \
54 _filter_btrfs_compress_property
56 echo "Clearing compression flag from directory..."
57 $CHATTR_PROG -c $SCRATCH_MNT/testdir
58 echo "Directory compression property value:"
59 $BTRFS_UTIL_PROG property get $SCRATCH_MNT/testdir compression | \
60 _filter_btrfs_compress_property
62 touch $SCRATCH_MNT/testdir/file2
63 echo "file2 compression property value:"
64 $BTRFS_UTIL_PROG property get $SCRATCH_MNT/testdir/file2 compression | \
65 _filter_btrfs_compress_property
67 touch $SCRATCH_MNT/testdir/file1
68 echo "file1 compression property value:"
69 $BTRFS_UTIL_PROG property get $SCRATCH_MNT/testdir/file1 compression | \
70 _filter_btrfs_compress_property