Signed-off-by: Koen De Wit <koen.de.wit@xxxxxxxxxx>
---
300 | 84
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
300.out | 4 +++
2 files changed, 88 insertions(+), 0 deletions(-)
create mode 100644 300
create mode 100644 300.out
diff --git a/300 b/300
new file mode 100644
index 0000000..a6f706c
--- /dev/null
+++ b/300
@@ -0,0 +1,84 @@
+#! /bin/bash
+# FS QA Test No. 300
+#
+# Diskspace consumption of sparse file clones ("reflinks") on btrfs
+# - Check that a reflink does not consume space
+# - Check that a reflink starts to consume space when the original file
+# is modified
+# - Check that diskspace is freed up after deleting all files
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2013, Oracle and/or its affiliates. All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#-----------------------------------------------------------------------
+#
+# creator
+owner=koen.de.wit@xxxxxxxxxx
+
+seq=`basename $0`
+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()
+{
+ cd /
+ rm -f $tmp.*
+}
+
+# get standard environment, filters and checks
+. ./common.rc
+. ./common.filter
+
+# real QA test starts here
+_supported_fs btrfs
+_supported_os Linux
+
+_require_cp_reflink
+
+TESTDIR1=$TEST_DIR/test-$seq.$$
+mkdir $TESTDIR1
+
+_free() {
+ _df_dir $TEST_DIR | $AWK_PROG '{ print $5 }'
+}
+
+free_before=`_free`
+$XFS_IO_PROG -f -c "pwrite -S 0x61 0 10m" -c "fsync" $TESTDIR1/original
> /dev/null
+cp --reflink=always $TESTDIR1/original $TESTDIR1/copy1
+cp --reflink=auto $TESTDIR1/copy1 $TESTDIR1/copy2
+btrfs filesystem sync $TEST_DIR > /dev/null
+free_after_creating_reflinks=`_free`
+_within_tolerance "free space after creating 1 file and 2 reflinks" \
+ `expr $free_before - $free_after_creating_reflinks` 10252 512 -v
+
+$XFS_IO_PROG -c "pwrite -S 0x62 3m 5m" -c "fsync" $TESTDIR1/original >
/dev/null
+btrfs filesystem sync $TEST_DIR > /dev/null
+free_after_overwriting=`_free`
+_within_tolerance "free space after overwriting original file" \
+ `expr $free_before - $free_after_overwriting` 15376 512 -v
+
+rm $TESTDIR1/original $TESTDIR1/copy1 $TESTDIR1/copy2
+btrfs filesystem sync $TEST_DIR > /dev/null
+free_after_removing=`_free`
+_within_tolerance "free space after removing all files" \
+ `expr $free_before - $free_after_removing` 0 128 -v
+
+# success, all done
+status=0
+exit
diff --git a/300.out b/300.out
new file mode 100644
index 0000000..bbb94f4
--- /dev/null
+++ b/300.out
@@ -0,0 +1,4 @@
+QA output created by 300
+free space after creating 1 file and 2 reflinks is in range
+free space after overwriting original file is in range
+free space after removing all files is in range
--
1.7.2.5
_______________________________________________
xfs mailing list
xfs@xxxxxxxxxxx
http://oss.sgi.com/mailman/listinfo/xfs