2014-09-29 12:54:55 +10:00
|
|
|
#! /bin/bash
|
2018-06-09 11:35:50 +10:00
|
|
|
# SPDX-License-Identifier: GPL-2.0
|
|
|
|
|
# Copyright (C) 2014 SUSE Linux Products GmbH. All Rights Reserved.
|
|
|
|
|
#
|
2014-09-29 12:54:55 +10:00
|
|
|
# FS QA Test No. btrfs/059
|
|
|
|
|
#
|
|
|
|
|
# Regression test for btrfs where removing the flag FS_COMPR_FL (chattr -c)
|
|
|
|
|
# from an inode wouldn't clear its compression property.
|
|
|
|
|
# This was fixed in the following linux kernel patch:
|
|
|
|
|
#
|
|
|
|
|
# Btrfs: add missing compression property remove in btrfs_ioctl_setflags
|
|
|
|
|
#
|
|
|
|
|
seq=`basename $0`
|
|
|
|
|
seqres=$RESULT_DIR/$seq
|
|
|
|
|
echo "QA output created by $seq"
|
|
|
|
|
|
|
|
|
|
here=`pwd`
|
|
|
|
|
tmp=/tmp/$$
|
|
|
|
|
|
|
|
|
|
status=1 # failure is the default!
|
|
|
|
|
trap "_cleanup; exit \$status" 0 1 2 3 15
|
|
|
|
|
|
|
|
|
|
_cleanup()
|
|
|
|
|
{
|
|
|
|
|
rm -fr $tmp
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# get standard environment, filters and checks
|
|
|
|
|
. ./common/rc
|
|
|
|
|
. ./common/filter
|
2016-03-23 17:39:11 +11:00
|
|
|
. ./common/filter.btrfs
|
2014-09-29 12:54:55 +10:00
|
|
|
|
|
|
|
|
# real QA test starts here
|
|
|
|
|
_supported_fs btrfs
|
|
|
|
|
_supported_os Linux
|
|
|
|
|
_require_test
|
|
|
|
|
_require_scratch
|
2016-12-08 16:12:12 +08:00
|
|
|
_require_btrfs_command "property"
|
2014-09-29 12:54:55 +10:00
|
|
|
|
|
|
|
|
rm -f $seqres.full
|
|
|
|
|
|
|
|
|
|
_scratch_mkfs >> $seqres.full 2>&1
|
|
|
|
|
_scratch_mount
|
|
|
|
|
|
|
|
|
|
mkdir $SCRATCH_MNT/testdir
|
|
|
|
|
echo "Setting compression flag in the directory..."
|
2016-04-05 11:46:12 +10:00
|
|
|
$CHATTR_PROG +c $SCRATCH_MNT/testdir
|
2014-09-29 12:54:55 +10:00
|
|
|
echo "Directory compression property value:"
|
2016-03-23 17:39:11 +11:00
|
|
|
$BTRFS_UTIL_PROG property get $SCRATCH_MNT/testdir compression | \
|
|
|
|
|
_filter_btrfs_compress_property
|
2014-09-29 12:54:55 +10:00
|
|
|
|
|
|
|
|
touch $SCRATCH_MNT/testdir/file1
|
|
|
|
|
echo "file1 compression property value:"
|
2016-03-23 17:39:11 +11:00
|
|
|
$BTRFS_UTIL_PROG property get $SCRATCH_MNT/testdir/file1 compression | \
|
|
|
|
|
_filter_btrfs_compress_property
|
2014-09-29 12:54:55 +10:00
|
|
|
|
|
|
|
|
echo "Clearing compression flag from directory..."
|
2016-04-05 11:46:12 +10:00
|
|
|
$CHATTR_PROG -c $SCRATCH_MNT/testdir
|
2014-09-29 12:54:55 +10:00
|
|
|
echo "Directory compression property value:"
|
2016-03-23 17:39:11 +11:00
|
|
|
$BTRFS_UTIL_PROG property get $SCRATCH_MNT/testdir compression | \
|
|
|
|
|
_filter_btrfs_compress_property
|
2014-09-29 12:54:55 +10:00
|
|
|
|
|
|
|
|
touch $SCRATCH_MNT/testdir/file2
|
|
|
|
|
echo "file2 compression property value:"
|
2016-03-23 17:39:11 +11:00
|
|
|
$BTRFS_UTIL_PROG property get $SCRATCH_MNT/testdir/file2 compression | \
|
|
|
|
|
_filter_btrfs_compress_property
|
2014-09-29 12:54:55 +10:00
|
|
|
|
|
|
|
|
touch $SCRATCH_MNT/testdir/file1
|
|
|
|
|
echo "file1 compression property value:"
|
2016-03-23 17:39:11 +11:00
|
|
|
$BTRFS_UTIL_PROG property get $SCRATCH_MNT/testdir/file1 compression | \
|
|
|
|
|
_filter_btrfs_compress_property
|
2014-09-29 12:54:55 +10:00
|
|
|
|
|
|
|
|
status=0
|
|
|
|
|
exit
|