All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: david@fromorbit.com, darrick.wong@oracle.com
Cc: linux-btrfs@vger.kernel.org, Christoph Hellwig <hch@lst.de>,
	fstests@vger.kernel.org, xfs@oss.sgi.com
Subject: [PATCH 4/7] xfs: test per-ag allocation accounting during truncate-caused refcountbt expansion
Date: Wed, 25 May 2016 22:57:29 -0700	[thread overview]
Message-ID: <146424224949.6278.1122385565512290875.stgit@birch.djwong.org> (raw)
In-Reply-To: <146424222237.6278.4174636124436241002.stgit@birch.djwong.org>

Ensure that refcountbt allocations during truncate operations come
from the per-AG reservation and are not charged to the transaction.

Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 tests/xfs/855     |   95 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/855.out |   10 ++++++
 tests/xfs/group   |    1 +
 3 files changed, 106 insertions(+)
 create mode 100755 tests/xfs/855
 create mode 100644 tests/xfs/855.out


diff --git a/tests/xfs/855 b/tests/xfs/855
new file mode 100755
index 0000000..93bd286
--- /dev/null
+++ b/tests/xfs/855
@@ -0,0 +1,95 @@
+#! /bin/bash
+# FS QA Test No. 855
+#
+# Ensure that we can create enough distinct reflink entries to force creation
+# of a multi-level refcount btree by reflinking a file a number of times and
+# truncating the copies at successively lower sizes.  Delete and recreate a few
+# times to exercise the refcount btree grow/shrink functions.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2016, 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
+#-----------------------------------------------------------------------
+
+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()
+{
+    cd /
+    umount $SCRATCH_MNT > /dev/null 2>&1
+    rm -rf $tmp.*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/reflink
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs xfs
+_require_scratch_reflink
+_require_cp_reflink
+
+rm -f $seqres.full
+
+_scratch_mkfs >/dev/null 2>&1
+_scratch_mount
+
+testdir=$SCRATCH_MNT/test-$seq
+mkdir $testdir
+
+echo "Create the original file blocks"
+blksz="$(stat -f $testdir -c '%S')"
+nr_blks=$((2 * blksz / 12))
+
+for i in 1 2 x; do
+	_pwrite_byte 0x61 0 $((blksz * nr_blks)) $testdir/file1 >> $seqres.full
+
+	echo "$i: Reflink a bunch of times"
+	seq 1 $nr_blks | while read nr; do
+		_cp_reflink $testdir/file1 $testdir/file1.$nr >> $seqres.full
+	done
+	sync
+
+	echo "$i: Truncate files"
+	seq 1 $nr_blks | while read nr; do
+		truncate -s $((blksz * (nr_blks - nr))) $testdir/file1.$nr >> $seqres.full
+	done
+
+	umount $SCRATCH_MNT
+	_check_scratch_fs
+	_scratch_mount
+
+	test $i = "x" && break
+
+	echo "$i: Delete both files"
+	rm -rf $testdir
+	mkdir -p $testdir
+	umount $SCRATCH_MNT
+	_check_scratch_fs
+	_scratch_mount
+done
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/855.out b/tests/xfs/855.out
new file mode 100644
index 0000000..d196352
--- /dev/null
+++ b/tests/xfs/855.out
@@ -0,0 +1,10 @@
+QA output created by 855
+Create the original file blocks
+1: Reflink a bunch of times
+1: Truncate files
+1: Delete both files
+2: Reflink a bunch of times
+2: Truncate files
+2: Delete both files
+x: Reflink a bunch of times
+x: Truncate files
diff --git a/tests/xfs/group b/tests/xfs/group
index 4ac62c1..f0ca410 100644
--- a/tests/xfs/group
+++ b/tests/xfs/group
@@ -287,3 +287,4 @@
 305 auto quota
 853 auto quick clone
 854 auto quick clone
+855 auto clone


WARNING: multiple messages have this Message-ID (diff)
From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: david@fromorbit.com, darrick.wong@oracle.com
Cc: fstests@vger.kernel.org, Christoph Hellwig <hch@lst.de>,
	linux-btrfs@vger.kernel.org, xfs@oss.sgi.com
Subject: [PATCH 4/7] xfs: test per-ag allocation accounting during truncate-caused refcountbt expansion
Date: Wed, 25 May 2016 22:57:29 -0700	[thread overview]
Message-ID: <146424224949.6278.1122385565512290875.stgit@birch.djwong.org> (raw)
In-Reply-To: <146424222237.6278.4174636124436241002.stgit@birch.djwong.org>

Ensure that refcountbt allocations during truncate operations come
from the per-AG reservation and are not charged to the transaction.

Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 tests/xfs/855     |   95 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/855.out |   10 ++++++
 tests/xfs/group   |    1 +
 3 files changed, 106 insertions(+)
 create mode 100755 tests/xfs/855
 create mode 100644 tests/xfs/855.out


diff --git a/tests/xfs/855 b/tests/xfs/855
new file mode 100755
index 0000000..93bd286
--- /dev/null
+++ b/tests/xfs/855
@@ -0,0 +1,95 @@
+#! /bin/bash
+# FS QA Test No. 855
+#
+# Ensure that we can create enough distinct reflink entries to force creation
+# of a multi-level refcount btree by reflinking a file a number of times and
+# truncating the copies at successively lower sizes.  Delete and recreate a few
+# times to exercise the refcount btree grow/shrink functions.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2016, 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
+#-----------------------------------------------------------------------
+
+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()
+{
+    cd /
+    umount $SCRATCH_MNT > /dev/null 2>&1
+    rm -rf $tmp.*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/reflink
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs xfs
+_require_scratch_reflink
+_require_cp_reflink
+
+rm -f $seqres.full
+
+_scratch_mkfs >/dev/null 2>&1
+_scratch_mount
+
+testdir=$SCRATCH_MNT/test-$seq
+mkdir $testdir
+
+echo "Create the original file blocks"
+blksz="$(stat -f $testdir -c '%S')"
+nr_blks=$((2 * blksz / 12))
+
+for i in 1 2 x; do
+	_pwrite_byte 0x61 0 $((blksz * nr_blks)) $testdir/file1 >> $seqres.full
+
+	echo "$i: Reflink a bunch of times"
+	seq 1 $nr_blks | while read nr; do
+		_cp_reflink $testdir/file1 $testdir/file1.$nr >> $seqres.full
+	done
+	sync
+
+	echo "$i: Truncate files"
+	seq 1 $nr_blks | while read nr; do
+		truncate -s $((blksz * (nr_blks - nr))) $testdir/file1.$nr >> $seqres.full
+	done
+
+	umount $SCRATCH_MNT
+	_check_scratch_fs
+	_scratch_mount
+
+	test $i = "x" && break
+
+	echo "$i: Delete both files"
+	rm -rf $testdir
+	mkdir -p $testdir
+	umount $SCRATCH_MNT
+	_check_scratch_fs
+	_scratch_mount
+done
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/855.out b/tests/xfs/855.out
new file mode 100644
index 0000000..d196352
--- /dev/null
+++ b/tests/xfs/855.out
@@ -0,0 +1,10 @@
+QA output created by 855
+Create the original file blocks
+1: Reflink a bunch of times
+1: Truncate files
+1: Delete both files
+2: Reflink a bunch of times
+2: Truncate files
+2: Delete both files
+x: Reflink a bunch of times
+x: Truncate files
diff --git a/tests/xfs/group b/tests/xfs/group
index 4ac62c1..f0ca410 100644
--- a/tests/xfs/group
+++ b/tests/xfs/group
@@ -287,3 +287,4 @@
 305 auto quota
 853 auto quick clone
 854 auto quick clone
+855 auto clone

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

  parent reply	other threads:[~2016-05-26  5:57 UTC|newest]

Thread overview: 59+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-26  5:57 [PATCH 0/7] xfstests: minor fixes for the reflink/dedupe tests Darrick J. Wong
2016-05-26  5:57 ` Darrick J. Wong
2016-05-26  5:57 ` [PATCH 1/7] xfs/104: don't enospc when ag metadata overhead grows Darrick J. Wong
2016-05-26  5:57   ` Darrick J. Wong
2016-05-26  8:08   ` Christoph Hellwig
2016-05-26  8:08     ` Christoph Hellwig
2016-05-26  5:57 ` [PATCH 2/7] tests: don't put loop control files on the scratch mount Darrick J. Wong
2016-05-26  5:57   ` Darrick J. Wong
2016-05-26  8:09   ` Christoph Hellwig
2016-05-26  8:09     ` Christoph Hellwig
2016-05-26 16:07     ` Darrick J. Wong
2016-05-26 16:07       ` Darrick J. Wong
2016-05-27  3:28   ` [PATCH v2 " Darrick J. Wong
2016-05-27  3:28     ` Darrick J. Wong
2016-05-31 12:52     ` Christoph Hellwig
2016-05-31 12:52       ` Christoph Hellwig
2016-05-26  5:57 ` [PATCH 3/7] xfs: test copy-on-write leftover recovery Darrick J. Wong
2016-05-26  5:57   ` Darrick J. Wong
2016-05-26  8:22   ` Christoph Hellwig
2016-05-26  8:22     ` Christoph Hellwig
2016-05-26  5:57 ` Darrick J. Wong [this message]
2016-05-26  5:57   ` [PATCH 4/7] xfs: test per-ag allocation accounting during truncate-caused refcountbt expansion Darrick J. Wong
2016-05-26  8:23   ` Christoph Hellwig
2016-05-26  8:23     ` Christoph Hellwig
2016-05-26  5:57 ` [PATCH 5/7] reflink: test interaction with swap files Darrick J. Wong
2016-05-26  5:57   ` Darrick J. Wong
2016-05-26  8:24   ` Christoph Hellwig
2016-05-26  8:24     ` Christoph Hellwig
2016-05-26  5:57 ` [PATCH 6/7] xfs: test rmap behavior when multiple bmbt records map to a single rmapbt record Darrick J. Wong
2016-05-26  5:57   ` Darrick J. Wong
2016-05-26  8:04   ` Christoph Hellwig
2016-05-26  8:04     ` Christoph Hellwig
2016-05-26 16:12     ` Darrick J. Wong
2016-05-26 16:12       ` Darrick J. Wong
2016-05-27  3:28   ` [PATCH v2 " Darrick J. Wong
2016-05-27  3:28     ` Darrick J. Wong
2016-05-31 12:52     ` Christoph Hellwig
2016-05-31 12:52       ` Christoph Hellwig
2016-05-26  5:57 ` [PATCH 7/7] reflink: test changing sharers of a block while keeping refcount the same Darrick J. Wong
2016-05-26  5:57   ` Darrick J. Wong
2016-05-26  8:24   ` Christoph Hellwig
2016-05-26  8:24     ` Christoph Hellwig
2016-05-26  7:31 ` question about xfs/122 Xiao Yang
2016-05-26 16:32   ` Darrick J. Wong
2016-05-27  6:33     ` [PATCH] xfs/122: add check number of structure Xiao Yang
2016-05-27  7:28       ` Darrick J. Wong
2016-05-27  7:17         ` [PATCH] xfs/122: filter out reflink and rmap related outputs Xiao Yang
2016-05-27  8:00         ` [PATCH] xfs/122: add check number of structure Xiao Yang
2016-05-27  6:44     ` question about xfs/122 Xiao Yang
2016-05-27 18:02 ` [PATCH 8/7] xfs/122: don't break on old xfsprogs Darrick J. Wong
2016-05-27 18:02   ` Darrick J. Wong
2016-05-31 12:51   ` Christoph Hellwig
2016-05-31 12:51     ` Christoph Hellwig
2016-05-31 16:41     ` Darrick J. Wong
2016-05-31 16:41       ` Darrick J. Wong
2016-05-31 16:43   ` [PATCH v2 " Darrick J. Wong
2016-05-31 16:43     ` Darrick J. Wong
2016-05-31 19:33     ` Christoph Hellwig
2016-05-31 19:33       ` Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=146424224949.6278.1122385565512290875.stgit@birch.djwong.org \
    --to=darrick.wong@oracle.com \
    --cc=david@fromorbit.com \
    --cc=fstests@vger.kernel.org \
    --cc=hch@lst.de \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=xfs@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.