summaryrefslogtreecommitdiff
path: root/tests/btrfs/059
blob: 27be694726d55e7937339071a24386508aa591a3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#! /bin/bash
# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2014 SUSE Linux Products GmbH. All Rights Reserved.
#
# 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
#
. ./common/preamble
_begin_fstest auto quick compress

# Override the default cleanup function.
_cleanup()
{
	rm -fr $tmp
}

. ./common/filter
. ./common/filter.btrfs

_supported_fs btrfs
_require_test
_require_scratch
_require_btrfs_command "property"
_require_btrfs_no_nodatacow

_scratch_mkfs >> $seqres.full 2>&1
_scratch_mount

mkdir $SCRATCH_MNT/testdir
echo "Setting compression flag in the directory..."
$CHATTR_PROG +c $SCRATCH_MNT/testdir
echo "Directory compression property value:"
$BTRFS_UTIL_PROG property get $SCRATCH_MNT/testdir compression | \
	_filter_btrfs_compress_property

touch $SCRATCH_MNT/testdir/file1
echo "file1 compression property value:"
$BTRFS_UTIL_PROG property get $SCRATCH_MNT/testdir/file1 compression | \
	_filter_btrfs_compress_property

echo "Clearing compression flag from directory..."
$CHATTR_PROG -c $SCRATCH_MNT/testdir
echo "Directory compression property value:"
$BTRFS_UTIL_PROG property get $SCRATCH_MNT/testdir compression | \
	_filter_btrfs_compress_property

touch $SCRATCH_MNT/testdir/file2
echo "file2 compression property value:"
$BTRFS_UTIL_PROG property get $SCRATCH_MNT/testdir/file2 compression | \
	_filter_btrfs_compress_property

touch $SCRATCH_MNT/testdir/file1
echo "file1 compression property value:"
$BTRFS_UTIL_PROG property get $SCRATCH_MNT/testdir/file1 compression | \
	_filter_btrfs_compress_property

status=0
exit