mirror of
https://github.com/linux-apfs/apfstests.git
synced 2026-05-01 15:01:44 -07:00
reflink: more CoW tests for reflink and dedupe
These tests examine the behavior of advanced and tricky copy on write situations. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
This commit is contained in:
committed by
Dave Chinner
parent
877d1daada
commit
c8a13e5303
Executable
+101
@@ -0,0 +1,101 @@
|
||||
#! /bin/bash
|
||||
# FS QA Test No. 183
|
||||
#
|
||||
# Ensuring that copy on write in direct-io mode works when the CoW
|
||||
# range originally covers multiple extents.
|
||||
# - Create two files
|
||||
# - Reflink the odd blocks of the first file into a third file.
|
||||
# - Reflink the even blocks of the second file into the third file.
|
||||
# - directio CoW across the halfway mark.
|
||||
# - Check that the files are now different where we say they're different.
|
||||
#
|
||||
#-----------------------------------------------------------------------
|
||||
# Copyright (c) 2015, 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 /
|
||||
rm -rf "$tmp".* "$TESTDIR"
|
||||
}
|
||||
|
||||
# get standard environment, filters and checks
|
||||
. ./common/rc
|
||||
. ./common/filter
|
||||
. ./common/reflink
|
||||
|
||||
# real QA test starts here
|
||||
_supported_os Linux
|
||||
_require_scratch_reflink
|
||||
|
||||
rm -f "$seqres.full"
|
||||
|
||||
echo "Format and mount"
|
||||
_scratch_mkfs > "$seqres.full" 2>&1
|
||||
_scratch_mount >> "$seqres.full" 2>&1
|
||||
|
||||
TESTDIR="$SCRATCH_MNT/test-$seq"
|
||||
rm -rf $TESTDIR
|
||||
mkdir $TESTDIR
|
||||
|
||||
echo "Create the original files"
|
||||
BLKSZ=65536
|
||||
NR=64
|
||||
_pwrite_byte 0x61 0 $((BLKSZ * NR)) "$TESTDIR/file1" >> "$seqres.full"
|
||||
_pwrite_byte 0x62 0 $((BLKSZ * NR)) "$TESTDIR/file2" >> "$seqres.full"
|
||||
seq 0 2 $((NR-1)) | while read f; do
|
||||
_reflink_range "$TESTDIR/file1" $((BLKSZ * f)) "$TESTDIR/file3" $((BLKSZ * f)) $BLKSZ >> "$seqres.full"
|
||||
_pwrite_byte 0x61 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full"
|
||||
done
|
||||
seq 1 2 $NR | while read f; do
|
||||
_reflink_range "$TESTDIR/file2" $((BLKSZ * f)) "$TESTDIR/file3" $((BLKSZ * f)) $BLKSZ >> "$seqres.full"
|
||||
_pwrite_byte 0x62 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full"
|
||||
done
|
||||
_scratch_remount
|
||||
|
||||
echo "Compare files"
|
||||
md5sum "$TESTDIR/file1" | _filter_scratch
|
||||
md5sum "$TESTDIR/file2" | _filter_scratch
|
||||
md5sum "$TESTDIR/file3" | _filter_scratch
|
||||
md5sum "$TESTDIR/file3.chk" | _filter_scratch
|
||||
|
||||
echo "directio CoW across the transition"
|
||||
"$XFS_IO_PROG" -d -f -c "pwrite -S 0x63 -b $((BLKSZ * NR / 2)) $((BLKSZ * NR / 4)) $((BLKSZ * NR / 2))" "$TESTDIR/file3" >> "$seqres.full"
|
||||
_pwrite_byte 0x63 $((BLKSZ * NR / 4)) $((BLKSZ * NR / 2)) "$TESTDIR/file3.chk" >> "$seqres.full"
|
||||
_scratch_remount
|
||||
|
||||
echo "Compare files"
|
||||
md5sum "$TESTDIR/file1" | _filter_scratch
|
||||
md5sum "$TESTDIR/file2" | _filter_scratch
|
||||
md5sum "$TESTDIR/file3" | _filter_scratch
|
||||
md5sum "$TESTDIR/file3.chk" | _filter_scratch
|
||||
|
||||
echo "Check for damage"
|
||||
umount "$SCRATCH_MNT"
|
||||
_check_scratch_fs
|
||||
|
||||
# success, all done
|
||||
status=0
|
||||
exit
|
||||
@@ -0,0 +1,15 @@
|
||||
QA output created by 183
|
||||
Format and mount
|
||||
Create the original files
|
||||
Compare files
|
||||
bdbcf02ee0aa977795a79d25fcfdccb1 SCRATCH_MNT/test-183/file1
|
||||
b83f9394092e15bdcda585cd8e776dc6 SCRATCH_MNT/test-183/file2
|
||||
d3959a68638c50af07f0258e032cb554 SCRATCH_MNT/test-183/file3
|
||||
d3959a68638c50af07f0258e032cb554 SCRATCH_MNT/test-183/file3.chk
|
||||
directio CoW across the transition
|
||||
Compare files
|
||||
bdbcf02ee0aa977795a79d25fcfdccb1 SCRATCH_MNT/test-183/file1
|
||||
b83f9394092e15bdcda585cd8e776dc6 SCRATCH_MNT/test-183/file2
|
||||
55968a95dfc0120df4e8485576514320 SCRATCH_MNT/test-183/file3
|
||||
55968a95dfc0120df4e8485576514320 SCRATCH_MNT/test-183/file3.chk
|
||||
Check for damage
|
||||
Executable
+101
@@ -0,0 +1,101 @@
|
||||
#! /bin/bash
|
||||
# FS QA Test No. 185
|
||||
#
|
||||
# Ensuring that copy on write in buffered mode works when the CoW
|
||||
# range originally covers multiple extents.
|
||||
# - Create two files
|
||||
# - Reflink the odd blocks of the first file into a third file.
|
||||
# - Reflink the even blocks of the second file into the third file.
|
||||
# - CoW across the halfway mark.
|
||||
# - Check that the files are now different where we say they're different.
|
||||
#
|
||||
#-----------------------------------------------------------------------
|
||||
# Copyright (c) 2015, 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 /
|
||||
rm -rf "$tmp".* "$TESTDIR"
|
||||
}
|
||||
|
||||
# get standard environment, filters and checks
|
||||
. ./common/rc
|
||||
. ./common/filter
|
||||
. ./common/reflink
|
||||
|
||||
# real QA test starts here
|
||||
_supported_os Linux
|
||||
_require_scratch_reflink
|
||||
|
||||
rm -f "$seqres.full"
|
||||
|
||||
echo "Format and mount"
|
||||
_scratch_mkfs > "$seqres.full" 2>&1
|
||||
_scratch_mount >> "$seqres.full" 2>&1
|
||||
|
||||
TESTDIR="$SCRATCH_MNT/test-$seq"
|
||||
rm -rf $TESTDIR
|
||||
mkdir $TESTDIR
|
||||
|
||||
echo "Create the original files"
|
||||
BLKSZ=65536
|
||||
NR=64
|
||||
_pwrite_byte 0x61 0 $((BLKSZ * NR)) "$TESTDIR/file1" >> "$seqres.full"
|
||||
_pwrite_byte 0x62 0 $((BLKSZ * NR)) "$TESTDIR/file2" >> "$seqres.full"
|
||||
seq 0 2 $((NR-1)) | while read f; do
|
||||
_reflink_range "$TESTDIR/file1" $((BLKSZ * f)) "$TESTDIR/file3" $((BLKSZ * f)) $BLKSZ >> "$seqres.full"
|
||||
_pwrite_byte 0x61 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full"
|
||||
done
|
||||
seq 1 2 $NR | while read f; do
|
||||
_reflink_range "$TESTDIR/file2" $((BLKSZ * f)) "$TESTDIR/file3" $((BLKSZ * f)) $BLKSZ >> "$seqres.full"
|
||||
_pwrite_byte 0x62 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full"
|
||||
done
|
||||
_scratch_remount
|
||||
|
||||
echo "Compare files"
|
||||
md5sum "$TESTDIR/file1" | _filter_scratch
|
||||
md5sum "$TESTDIR/file2" | _filter_scratch
|
||||
md5sum "$TESTDIR/file3" | _filter_scratch
|
||||
md5sum "$TESTDIR/file3.chk" | _filter_scratch
|
||||
|
||||
echo "CoW across the transition"
|
||||
_pwrite_byte 0x63 $((BLKSZ * NR / 4)) $((BLKSZ * NR / 2)) "$TESTDIR/file3" >> "$seqres.full"
|
||||
_pwrite_byte 0x63 $((BLKSZ * NR / 4)) $((BLKSZ * NR / 2)) "$TESTDIR/file3.chk" >> "$seqres.full"
|
||||
_scratch_remount
|
||||
|
||||
echo "Compare files"
|
||||
md5sum "$TESTDIR/file1" | _filter_scratch
|
||||
md5sum "$TESTDIR/file2" | _filter_scratch
|
||||
md5sum "$TESTDIR/file3" | _filter_scratch
|
||||
md5sum "$TESTDIR/file3.chk" | _filter_scratch
|
||||
|
||||
echo "Check for damage"
|
||||
umount "$SCRATCH_MNT"
|
||||
_check_scratch_fs
|
||||
|
||||
# success, all done
|
||||
status=0
|
||||
exit
|
||||
@@ -0,0 +1,15 @@
|
||||
QA output created by 185
|
||||
Format and mount
|
||||
Create the original files
|
||||
Compare files
|
||||
bdbcf02ee0aa977795a79d25fcfdccb1 SCRATCH_MNT/test-185/file1
|
||||
b83f9394092e15bdcda585cd8e776dc6 SCRATCH_MNT/test-185/file2
|
||||
d3959a68638c50af07f0258e032cb554 SCRATCH_MNT/test-185/file3
|
||||
d3959a68638c50af07f0258e032cb554 SCRATCH_MNT/test-185/file3.chk
|
||||
CoW across the transition
|
||||
Compare files
|
||||
bdbcf02ee0aa977795a79d25fcfdccb1 SCRATCH_MNT/test-185/file1
|
||||
b83f9394092e15bdcda585cd8e776dc6 SCRATCH_MNT/test-185/file2
|
||||
55968a95dfc0120df4e8485576514320 SCRATCH_MNT/test-185/file3
|
||||
55968a95dfc0120df4e8485576514320 SCRATCH_MNT/test-185/file3.chk
|
||||
Check for damage
|
||||
Executable
+146
@@ -0,0 +1,146 @@
|
||||
#! /bin/bash
|
||||
# FS QA Test No. 186
|
||||
#
|
||||
# Ensuring that copy on write in buffered mode works when free space
|
||||
# is heavily fragmented.
|
||||
# - Create two files
|
||||
# - Reflink the odd blocks of the first file into a third file.
|
||||
# - Reflink the even blocks of the second file into the third file.
|
||||
# - Try to fragment the free space by allocating a huge file and
|
||||
# punching out every other block.
|
||||
# - CoW across the halfway mark.
|
||||
# - Check that the files are now different where we say they're different.
|
||||
#
|
||||
#-----------------------------------------------------------------------
|
||||
# Copyright (c) 2015, 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 /
|
||||
# rm -rf "$tmp".* "$TESTDIR"
|
||||
}
|
||||
|
||||
# get standard environment, filters and checks
|
||||
. ./common/rc
|
||||
. ./common/filter
|
||||
. ./common/reflink
|
||||
|
||||
# real QA test starts here
|
||||
_supported_os Linux
|
||||
_require_scratch_reflink
|
||||
_require_cp_reflink
|
||||
_require_xfs_io_command "falloc"
|
||||
_require_xfs_io_command "fpunch"
|
||||
test "$FSTYP" = "btrfs" && _notrun "Can't fragment free space on btrfs."
|
||||
|
||||
rm -f "$seqres.full"
|
||||
|
||||
_fragment_freesp()
|
||||
{
|
||||
file="$1"
|
||||
|
||||
# consume nearly all available space (leave ~1MB)
|
||||
avail=`_get_available_space $SCRATCH_MNT`
|
||||
echo "$avail bytes left"
|
||||
filesize=$((avail - 1048576))
|
||||
$XFS_IO_PROG -fc "truncate $filesize" "$file"
|
||||
|
||||
chunks=20
|
||||
chunksizemb=$((filesize / chunks / 1048576))
|
||||
seq 1 $chunks | while read f; do
|
||||
echo "$((f * chunksizemb)) file size $f / 20"
|
||||
$XFS_IO_PROG -fc "falloc -k $(( (f - 1) * chunksizemb))m ${chunksizemb}m" "$file"
|
||||
done
|
||||
|
||||
chunks=100
|
||||
chunksizemb=$((filesize / chunks / 1048576))
|
||||
seq 80 $chunks | while read f; do
|
||||
echo "$((f * chunksizemb)) file size $f / $chunks"
|
||||
$XFS_IO_PROG -fc "falloc -k $(( (f - 1) * chunksizemb))m ${chunksizemb}m" "$file"
|
||||
done
|
||||
|
||||
filesizemb=$((filesize / 1048576))
|
||||
$XFS_IO_PROG -fc "falloc -k 0 ${filesizemb}m" "$file"
|
||||
|
||||
# Try again anyway
|
||||
avail=`_get_available_space $SCRATCH_MNT`
|
||||
$XFS_IO_PROG -fc "pwrite -S 0x65 0 $avail" "${file}.${i}"
|
||||
|
||||
# Punch out whatever we need
|
||||
seq 1 $((NR * 4)) | while read f; do
|
||||
$XFS_IO_PROG -f -c "fpunch $((f * 2 * BLKSZ)) $BLKSZ" "$file"
|
||||
done
|
||||
}
|
||||
|
||||
echo "Format and mount"
|
||||
_scratch_mkfs > "$seqres.full" 2>&1
|
||||
_scratch_mount >> "$seqres.full" 2>&1
|
||||
|
||||
TESTDIR="$SCRATCH_MNT/test-$seq"
|
||||
rm -rf $TESTDIR
|
||||
mkdir $TESTDIR
|
||||
|
||||
echo "Create the original files"
|
||||
BLKSZ=65536
|
||||
NR=1024
|
||||
_pwrite_byte 0x61 0 $((BLKSZ * NR)) "$TESTDIR/file1" >> "$seqres.full"
|
||||
_pwrite_byte 0x62 0 $((BLKSZ * NR)) "$TESTDIR/file2" >> "$seqres.full"
|
||||
seq 0 2 $((NR-1)) | while read f; do
|
||||
_reflink_range "$TESTDIR/file1" $((BLKSZ * f)) "$TESTDIR/file3" $((BLKSZ * f)) $BLKSZ >> "$seqres.full"
|
||||
_pwrite_byte 0x61 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full"
|
||||
done
|
||||
seq 1 2 $NR | while read f; do
|
||||
_reflink_range "$TESTDIR/file2" $((BLKSZ * f)) "$TESTDIR/file3" $((BLKSZ * f)) $BLKSZ >> "$seqres.full"
|
||||
_pwrite_byte 0x62 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full"
|
||||
done
|
||||
_scratch_remount
|
||||
_fragment_freesp "$TESTDIR/bigfile" >> "$seqres.full" 2>&1
|
||||
_scratch_remount
|
||||
|
||||
echo "Compare files"
|
||||
md5sum "$TESTDIR/file1" | _filter_scratch
|
||||
md5sum "$TESTDIR/file2" | _filter_scratch
|
||||
md5sum "$TESTDIR/file3" | _filter_scratch
|
||||
md5sum "$TESTDIR/file3.chk" | _filter_scratch
|
||||
|
||||
echo "CoW with multiple extents?"
|
||||
"$XFS_IO_PROG" -f -c "pwrite -S 0x63 -b $((BLKSZ * NR / 2)) $((BLKSZ * NR / 4)) $((BLKSZ * NR / 2))" "$TESTDIR/file3" >> "$seqres.full"
|
||||
_pwrite_byte 0x63 $((BLKSZ * NR / 4)) $((BLKSZ * NR / 2)) "$TESTDIR/file3.chk" >> "$seqres.full"
|
||||
_scratch_remount
|
||||
|
||||
echo "Compare files"
|
||||
md5sum "$TESTDIR/file1" | _filter_scratch
|
||||
md5sum "$TESTDIR/file2" | _filter_scratch
|
||||
md5sum "$TESTDIR/file3" | _filter_scratch
|
||||
md5sum "$TESTDIR/file3.chk" | _filter_scratch
|
||||
|
||||
echo "Check for damage"
|
||||
umount "$SCRATCH_MNT"
|
||||
_check_scratch_fs
|
||||
|
||||
# success, all done
|
||||
status=0
|
||||
exit
|
||||
@@ -0,0 +1,15 @@
|
||||
QA output created by 186
|
||||
Format and mount
|
||||
Create the original files
|
||||
Compare files
|
||||
6488f52f2d2351fa5ca1f6410df8684d SCRATCH_MNT/test-186/file1
|
||||
35219c511215d00a857243965ea5ed9c SCRATCH_MNT/test-186/file2
|
||||
8d9ea4925db533da10a45d2919d8d2d9 SCRATCH_MNT/test-186/file3
|
||||
8d9ea4925db533da10a45d2919d8d2d9 SCRATCH_MNT/test-186/file3.chk
|
||||
CoW with multiple extents?
|
||||
Compare files
|
||||
6488f52f2d2351fa5ca1f6410df8684d SCRATCH_MNT/test-186/file1
|
||||
35219c511215d00a857243965ea5ed9c SCRATCH_MNT/test-186/file2
|
||||
1801718b8daeb8d3ad4900bd9137b3e8 SCRATCH_MNT/test-186/file3
|
||||
1801718b8daeb8d3ad4900bd9137b3e8 SCRATCH_MNT/test-186/file3.chk
|
||||
Check for damage
|
||||
Executable
+146
@@ -0,0 +1,146 @@
|
||||
#! /bin/bash
|
||||
# FS QA Test No. 187
|
||||
#
|
||||
# Ensuring that copy on write in directio mode works when free space
|
||||
# is heavily fragmented.
|
||||
# - Create two files
|
||||
# - Reflink the odd blocks of the first file into a third file.
|
||||
# - Reflink the even blocks of the second file into the third file.
|
||||
# - Try to fragment the free space by allocating a huge file and
|
||||
# punching out every other block.
|
||||
# - CoW across the halfway mark.
|
||||
# - Check that the files are now different where we say they're different.
|
||||
#
|
||||
#-----------------------------------------------------------------------
|
||||
# Copyright (c) 2015, 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 /
|
||||
# rm -rf "$tmp".* "$TESTDIR"
|
||||
}
|
||||
|
||||
# get standard environment, filters and checks
|
||||
. ./common/rc
|
||||
. ./common/filter
|
||||
. ./common/reflink
|
||||
|
||||
# real QA test starts here
|
||||
_supported_os Linux
|
||||
_require_scratch_reflink
|
||||
_require_cp_reflink
|
||||
_require_xfs_io_command "falloc"
|
||||
_require_xfs_io_command "fpunch"
|
||||
test "$FSTYP" = "btrfs" && _notrun "Can't fragment free space on btrfs."
|
||||
|
||||
rm -f "$seqres.full"
|
||||
|
||||
_fragment_freesp()
|
||||
{
|
||||
file="$1"
|
||||
|
||||
# consume nearly all available space (leave ~1MB)
|
||||
avail=`_get_available_space $SCRATCH_MNT`
|
||||
echo "$avail bytes left"
|
||||
filesize=$((avail - 1048576))
|
||||
$XFS_IO_PROG -fc "truncate $filesize" "$file"
|
||||
|
||||
chunks=20
|
||||
chunksizemb=$((filesize / chunks / 1048576))
|
||||
seq 1 $chunks | while read f; do
|
||||
echo "$((f * chunksizemb)) file size $f / 20"
|
||||
$XFS_IO_PROG -fc "falloc -k $(( (f - 1) * chunksizemb))m ${chunksizemb}m" "$file"
|
||||
done
|
||||
|
||||
chunks=100
|
||||
chunksizemb=$((filesize / chunks / 1048576))
|
||||
seq 80 $chunks | while read f; do
|
||||
echo "$((f * chunksizemb)) file size $f / $chunks"
|
||||
$XFS_IO_PROG -fc "falloc -k $(( (f - 1) * chunksizemb))m ${chunksizemb}m" "$file"
|
||||
done
|
||||
|
||||
filesizemb=$((filesize / 1048576))
|
||||
$XFS_IO_PROG -fc "falloc -k 0 ${filesizemb}m" "$file"
|
||||
|
||||
# Try again anyway
|
||||
avail=`_get_available_space $SCRATCH_MNT`
|
||||
$XFS_IO_PROG -fc "pwrite -S 0x65 0 $avail" "${file}.${i}"
|
||||
|
||||
# Punch out whatever we need
|
||||
seq 1 $((NR * 4)) | while read f; do
|
||||
$XFS_IO_PROG -f -c "fpunch $((f * 2 * BLKSZ)) $BLKSZ" "$file"
|
||||
done
|
||||
}
|
||||
|
||||
echo "Format and mount"
|
||||
_scratch_mkfs > "$seqres.full" 2>&1
|
||||
_scratch_mount >> "$seqres.full" 2>&1
|
||||
|
||||
TESTDIR="$SCRATCH_MNT/test-$seq"
|
||||
rm -rf $TESTDIR
|
||||
mkdir $TESTDIR
|
||||
|
||||
echo "Create the original files"
|
||||
BLKSZ=65536
|
||||
NR=1024
|
||||
_pwrite_byte 0x61 0 $((BLKSZ * NR)) "$TESTDIR/file1" >> "$seqres.full"
|
||||
_pwrite_byte 0x62 0 $((BLKSZ * NR)) "$TESTDIR/file2" >> "$seqres.full"
|
||||
seq 0 2 $((NR-1)) | while read f; do
|
||||
_reflink_range "$TESTDIR/file1" $((BLKSZ * f)) "$TESTDIR/file3" $((BLKSZ * f)) $BLKSZ >> "$seqres.full"
|
||||
_pwrite_byte 0x61 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full"
|
||||
done
|
||||
seq 1 2 $NR | while read f; do
|
||||
_reflink_range "$TESTDIR/file2" $((BLKSZ * f)) "$TESTDIR/file3" $((BLKSZ * f)) $BLKSZ >> "$seqres.full"
|
||||
_pwrite_byte 0x62 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full"
|
||||
done
|
||||
_scratch_remount
|
||||
_fragment_freesp "$TESTDIR/bigfile" >> "$seqres.full" 2>&1
|
||||
_scratch_remount
|
||||
|
||||
echo "Compare files"
|
||||
md5sum "$TESTDIR/file1" | _filter_scratch
|
||||
md5sum "$TESTDIR/file2" | _filter_scratch
|
||||
md5sum "$TESTDIR/file3" | _filter_scratch
|
||||
md5sum "$TESTDIR/file3.chk" | _filter_scratch
|
||||
|
||||
echo "CoW with multiple extents?"
|
||||
"$XFS_IO_PROG" -d -f -c "pwrite -S 0x63 -b $((BLKSZ * NR / 2)) $((BLKSZ * NR / 4)) $((BLKSZ * NR / 2))" "$TESTDIR/file3" >> "$seqres.full"
|
||||
_pwrite_byte 0x63 $((BLKSZ * NR / 4)) $((BLKSZ * NR / 2)) "$TESTDIR/file3.chk" >> "$seqres.full"
|
||||
_scratch_remount
|
||||
|
||||
echo "Compare files"
|
||||
md5sum "$TESTDIR/file1" | _filter_scratch
|
||||
md5sum "$TESTDIR/file2" | _filter_scratch
|
||||
md5sum "$TESTDIR/file3" | _filter_scratch
|
||||
md5sum "$TESTDIR/file3.chk" | _filter_scratch
|
||||
|
||||
echo "Check for damage"
|
||||
umount "$SCRATCH_MNT"
|
||||
_check_scratch_fs
|
||||
|
||||
# success, all done
|
||||
status=0
|
||||
exit
|
||||
@@ -0,0 +1,15 @@
|
||||
QA output created by 187
|
||||
Format and mount
|
||||
Create the original files
|
||||
Compare files
|
||||
6488f52f2d2351fa5ca1f6410df8684d SCRATCH_MNT/test-187/file1
|
||||
35219c511215d00a857243965ea5ed9c SCRATCH_MNT/test-187/file2
|
||||
8d9ea4925db533da10a45d2919d8d2d9 SCRATCH_MNT/test-187/file3
|
||||
8d9ea4925db533da10a45d2919d8d2d9 SCRATCH_MNT/test-187/file3.chk
|
||||
CoW with multiple extents?
|
||||
Compare files
|
||||
6488f52f2d2351fa5ca1f6410df8684d SCRATCH_MNT/test-187/file1
|
||||
35219c511215d00a857243965ea5ed9c SCRATCH_MNT/test-187/file2
|
||||
1801718b8daeb8d3ad4900bd9137b3e8 SCRATCH_MNT/test-187/file3
|
||||
1801718b8daeb8d3ad4900bd9137b3e8 SCRATCH_MNT/test-187/file3.chk
|
||||
Check for damage
|
||||
Executable
+96
@@ -0,0 +1,96 @@
|
||||
#! /bin/bash
|
||||
# FS QA Test No. 188
|
||||
#
|
||||
# Ensuring that copy on write in direct-io mode works when the CoW
|
||||
# range originally covers multiple extents, some unwritten, some not.
|
||||
# - Create a file and fallocate a second file.
|
||||
# - Reflink the odd blocks of the first file into the second file.
|
||||
# - directio CoW across the halfway mark, starting with the unwritten extent.
|
||||
# - Check that the files are now different where we say they're different.
|
||||
#
|
||||
#-----------------------------------------------------------------------
|
||||
# Copyright (c) 2015, 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 /
|
||||
rm -rf "$tmp".* "$TESTDIR"
|
||||
}
|
||||
|
||||
# get standard environment, filters and checks
|
||||
. ./common/rc
|
||||
. ./common/filter
|
||||
. ./common/reflink
|
||||
|
||||
# real QA test starts here
|
||||
_supported_os Linux
|
||||
_require_scratch_reflink
|
||||
_require_xfs_io_command "falloc"
|
||||
|
||||
rm -f "$seqres.full"
|
||||
|
||||
echo "Format and mount"
|
||||
_scratch_mkfs > "$seqres.full" 2>&1
|
||||
_scratch_mount >> "$seqres.full" 2>&1
|
||||
|
||||
TESTDIR="$SCRATCH_MNT/test-$seq"
|
||||
rm -rf $TESTDIR
|
||||
mkdir $TESTDIR
|
||||
|
||||
echo "Create the original files"
|
||||
BLKSZ=65536
|
||||
NR=64
|
||||
_pwrite_byte 0x61 0 $((BLKSZ * NR)) "$TESTDIR/file1" >> "$seqres.full"
|
||||
$XFS_IO_PROG -f -c "falloc 0 $((BLKSZ * NR))" "$TESTDIR/file3" >> "$seqres.full"
|
||||
_pwrite_byte 0x00 0 $((BLKSZ * NR)) "$TESTDIR/file3.chk" >> "$seqres.full"
|
||||
seq 0 2 $((NR-1)) | while read f; do
|
||||
_reflink_range "$TESTDIR/file1" $((BLKSZ * f)) "$TESTDIR/file3" $((BLKSZ * f)) $BLKSZ >> "$seqres.full"
|
||||
_pwrite_byte 0x61 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full"
|
||||
done
|
||||
_scratch_remount
|
||||
|
||||
echo "Compare files"
|
||||
md5sum "$TESTDIR/file1" | _filter_scratch
|
||||
md5sum "$TESTDIR/file3" | _filter_scratch
|
||||
md5sum "$TESTDIR/file3.chk" | _filter_scratch
|
||||
|
||||
echo "directio CoW across the transition"
|
||||
"$XFS_IO_PROG" -d -f -c "pwrite -S 0x63 -b $((BLKSZ * NR / 2)) $((BLKSZ * NR / 4)) $((BLKSZ * NR / 2))" "$TESTDIR/file3" >> "$seqres.full"
|
||||
_pwrite_byte 0x63 $((BLKSZ * NR / 4)) $((BLKSZ * NR / 2)) "$TESTDIR/file3.chk" >> "$seqres.full"
|
||||
_scratch_remount
|
||||
|
||||
echo "Compare files"
|
||||
md5sum "$TESTDIR/file1" | _filter_scratch
|
||||
md5sum "$TESTDIR/file3" | _filter_scratch
|
||||
md5sum "$TESTDIR/file3.chk" | _filter_scratch
|
||||
|
||||
echo "Check for damage"
|
||||
umount "$SCRATCH_MNT"
|
||||
_check_scratch_fs
|
||||
|
||||
# success, all done
|
||||
status=0
|
||||
exit
|
||||
@@ -0,0 +1,13 @@
|
||||
QA output created by 188
|
||||
Format and mount
|
||||
Create the original files
|
||||
Compare files
|
||||
bdbcf02ee0aa977795a79d25fcfdccb1 SCRATCH_MNT/test-188/file1
|
||||
fa50dba51826899c372464a153cb2117 SCRATCH_MNT/test-188/file3
|
||||
fa50dba51826899c372464a153cb2117 SCRATCH_MNT/test-188/file3.chk
|
||||
directio CoW across the transition
|
||||
Compare files
|
||||
bdbcf02ee0aa977795a79d25fcfdccb1 SCRATCH_MNT/test-188/file1
|
||||
09101629908f9bdd5d178e7ce20bb1bb SCRATCH_MNT/test-188/file3
|
||||
09101629908f9bdd5d178e7ce20bb1bb SCRATCH_MNT/test-188/file3.chk
|
||||
Check for damage
|
||||
Executable
+96
@@ -0,0 +1,96 @@
|
||||
#! /bin/bash
|
||||
# FS QA Test No. 189
|
||||
#
|
||||
# Ensuring that copy on write in buffered mode works when the CoW
|
||||
# range originally covers multiple extents, some unwritten, some not.
|
||||
# - Create a file and fallocate a second file.
|
||||
# - Reflink the odd blocks of the first file into the second file.
|
||||
# - CoW across the halfway mark, starting with the unwritten extent.
|
||||
# - Check that the files are now different where we say they're different.
|
||||
#
|
||||
#-----------------------------------------------------------------------
|
||||
# Copyright (c) 2015, 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 /
|
||||
rm -rf "$tmp".* "$TESTDIR"
|
||||
}
|
||||
|
||||
# get standard environment, filters and checks
|
||||
. ./common/rc
|
||||
. ./common/filter
|
||||
. ./common/reflink
|
||||
|
||||
# real QA test starts here
|
||||
_supported_os Linux
|
||||
_require_scratch_reflink
|
||||
_require_xfs_io_command "falloc"
|
||||
|
||||
rm -f "$seqres.full"
|
||||
|
||||
echo "Format and mount"
|
||||
_scratch_mkfs > "$seqres.full" 2>&1
|
||||
_scratch_mount >> "$seqres.full" 2>&1
|
||||
|
||||
TESTDIR="$SCRATCH_MNT/test-$seq"
|
||||
rm -rf $TESTDIR
|
||||
mkdir $TESTDIR
|
||||
|
||||
echo "Create the original files"
|
||||
BLKSZ=65536
|
||||
NR=64
|
||||
_pwrite_byte 0x61 0 $((BLKSZ * NR)) "$TESTDIR/file1" >> "$seqres.full"
|
||||
$XFS_IO_PROG -f -c "falloc 0 $((BLKSZ * NR))" "$TESTDIR/file3" >> "$seqres.full"
|
||||
_pwrite_byte 0x00 0 $((BLKSZ * NR)) "$TESTDIR/file3.chk" >> "$seqres.full"
|
||||
seq 0 2 $((NR-1)) | while read f; do
|
||||
_reflink_range "$TESTDIR/file1" $((BLKSZ * f)) "$TESTDIR/file3" $((BLKSZ * f)) $BLKSZ >> "$seqres.full"
|
||||
_pwrite_byte 0x61 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full"
|
||||
done
|
||||
_scratch_remount
|
||||
|
||||
echo "Compare files"
|
||||
md5sum "$TESTDIR/file1" | _filter_scratch
|
||||
md5sum "$TESTDIR/file3" | _filter_scratch
|
||||
md5sum "$TESTDIR/file3.chk" | _filter_scratch
|
||||
|
||||
echo "CoW across the transition"
|
||||
"$XFS_IO_PROG" -f -c "pwrite -S 0x63 -b $((BLKSZ * NR / 2)) $((BLKSZ * NR / 4)) $((BLKSZ * NR / 2))" "$TESTDIR/file3" >> "$seqres.full"
|
||||
_pwrite_byte 0x63 $((BLKSZ * NR / 4)) $((BLKSZ * NR / 2)) "$TESTDIR/file3.chk" >> "$seqres.full"
|
||||
_scratch_remount
|
||||
|
||||
echo "Compare files"
|
||||
md5sum "$TESTDIR/file1" | _filter_scratch
|
||||
md5sum "$TESTDIR/file3" | _filter_scratch
|
||||
md5sum "$TESTDIR/file3.chk" | _filter_scratch
|
||||
|
||||
echo "Check for damage"
|
||||
umount "$SCRATCH_MNT"
|
||||
_check_scratch_fs
|
||||
|
||||
# success, all done
|
||||
status=0
|
||||
exit
|
||||
@@ -0,0 +1,13 @@
|
||||
QA output created by 189
|
||||
Format and mount
|
||||
Create the original files
|
||||
Compare files
|
||||
bdbcf02ee0aa977795a79d25fcfdccb1 SCRATCH_MNT/test-189/file1
|
||||
fa50dba51826899c372464a153cb2117 SCRATCH_MNT/test-189/file3
|
||||
fa50dba51826899c372464a153cb2117 SCRATCH_MNT/test-189/file3.chk
|
||||
CoW across the transition
|
||||
Compare files
|
||||
bdbcf02ee0aa977795a79d25fcfdccb1 SCRATCH_MNT/test-189/file1
|
||||
09101629908f9bdd5d178e7ce20bb1bb SCRATCH_MNT/test-189/file3
|
||||
09101629908f9bdd5d178e7ce20bb1bb SCRATCH_MNT/test-189/file3.chk
|
||||
Check for damage
|
||||
Executable
+96
@@ -0,0 +1,96 @@
|
||||
#! /bin/bash
|
||||
# FS QA Test No. 190
|
||||
#
|
||||
# Ensuring that copy on write in direct-io mode works when the CoW
|
||||
# range originally covers multiple extents, some holes, some not.
|
||||
# - Create a file and truncate a second file.
|
||||
# - Reflink the odd blocks of the first file into the second file.
|
||||
# - directio CoW across the halfway mark, starting with the unwritten extent.
|
||||
# - Check that the files are now different where we say they're different.
|
||||
#
|
||||
#-----------------------------------------------------------------------
|
||||
# Copyright (c) 2015, 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 /
|
||||
rm -rf "$tmp".* "$TESTDIR"
|
||||
}
|
||||
|
||||
# get standard environment, filters and checks
|
||||
. ./common/rc
|
||||
. ./common/filter
|
||||
. ./common/reflink
|
||||
|
||||
# real QA test starts here
|
||||
_supported_os Linux
|
||||
_require_scratch_reflink
|
||||
_require_xfs_io_command "falloc"
|
||||
|
||||
rm -f "$seqres.full"
|
||||
|
||||
echo "Format and mount"
|
||||
_scratch_mkfs > "$seqres.full" 2>&1
|
||||
_scratch_mount >> "$seqres.full" 2>&1
|
||||
|
||||
TESTDIR="$SCRATCH_MNT/test-$seq"
|
||||
rm -rf $TESTDIR
|
||||
mkdir $TESTDIR
|
||||
|
||||
echo "Create the original files"
|
||||
BLKSZ=65536
|
||||
NR=64
|
||||
_pwrite_byte 0x61 0 $((BLKSZ * NR)) "$TESTDIR/file1" >> "$seqres.full"
|
||||
$XFS_IO_PROG -f -c "truncate $((BLKSZ * NR))" "$TESTDIR/file3" >> "$seqres.full"
|
||||
_pwrite_byte 0x00 0 $((BLKSZ * NR)) "$TESTDIR/file3.chk" >> "$seqres.full"
|
||||
seq 0 2 $((NR-1)) | while read f; do
|
||||
_reflink_range "$TESTDIR/file1" $((BLKSZ * f)) "$TESTDIR/file3" $((BLKSZ * f)) $BLKSZ >> "$seqres.full"
|
||||
_pwrite_byte 0x61 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full"
|
||||
done
|
||||
_scratch_remount
|
||||
|
||||
echo "Compare files"
|
||||
md5sum "$TESTDIR/file1" | _filter_scratch
|
||||
md5sum "$TESTDIR/file3" | _filter_scratch
|
||||
md5sum "$TESTDIR/file3.chk" | _filter_scratch
|
||||
|
||||
echo "directio CoW across the transition"
|
||||
"$XFS_IO_PROG" -d -f -c "pwrite -S 0x63 -b $((BLKSZ * NR / 2)) $((BLKSZ * NR / 4)) $((BLKSZ * NR / 2))" "$TESTDIR/file3" >> "$seqres.full"
|
||||
_pwrite_byte 0x63 $((BLKSZ * NR / 4)) $((BLKSZ * NR / 2)) "$TESTDIR/file3.chk" >> "$seqres.full"
|
||||
_scratch_remount
|
||||
|
||||
echo "Compare files"
|
||||
md5sum "$TESTDIR/file1" | _filter_scratch
|
||||
md5sum "$TESTDIR/file3" | _filter_scratch
|
||||
md5sum "$TESTDIR/file3.chk" | _filter_scratch
|
||||
|
||||
echo "Check for damage"
|
||||
umount "$SCRATCH_MNT"
|
||||
_check_scratch_fs
|
||||
|
||||
# success, all done
|
||||
status=0
|
||||
exit
|
||||
@@ -0,0 +1,13 @@
|
||||
QA output created by 190
|
||||
Format and mount
|
||||
Create the original files
|
||||
Compare files
|
||||
bdbcf02ee0aa977795a79d25fcfdccb1 SCRATCH_MNT/test-190/file1
|
||||
fa50dba51826899c372464a153cb2117 SCRATCH_MNT/test-190/file3
|
||||
fa50dba51826899c372464a153cb2117 SCRATCH_MNT/test-190/file3.chk
|
||||
directio CoW across the transition
|
||||
Compare files
|
||||
bdbcf02ee0aa977795a79d25fcfdccb1 SCRATCH_MNT/test-190/file1
|
||||
09101629908f9bdd5d178e7ce20bb1bb SCRATCH_MNT/test-190/file3
|
||||
09101629908f9bdd5d178e7ce20bb1bb SCRATCH_MNT/test-190/file3.chk
|
||||
Check for damage
|
||||
Executable
+96
@@ -0,0 +1,96 @@
|
||||
#! /bin/bash
|
||||
# FS QA Test No. 191
|
||||
#
|
||||
# Ensuring that copy on write in buffered mode works when the CoW
|
||||
# range originally covers multiple extents, some holes, some not.
|
||||
# - Create a file and truncate a second file.
|
||||
# - Reflink the odd blocks of the first file into the second file.
|
||||
# - CoW across the halfway mark, starting with the unwritten extent.
|
||||
# - Check that the files are now different where we say they're different.
|
||||
#
|
||||
#-----------------------------------------------------------------------
|
||||
# Copyright (c) 2015, 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 /
|
||||
rm -rf "$tmp".* "$TESTDIR"
|
||||
}
|
||||
|
||||
# get standard environment, filters and checks
|
||||
. ./common/rc
|
||||
. ./common/filter
|
||||
. ./common/reflink
|
||||
|
||||
# real QA test starts here
|
||||
_supported_os Linux
|
||||
_require_scratch_reflink
|
||||
_require_xfs_io_command "falloc"
|
||||
|
||||
rm -f "$seqres.full"
|
||||
|
||||
echo "Format and mount"
|
||||
_scratch_mkfs > "$seqres.full" 2>&1
|
||||
_scratch_mount >> "$seqres.full" 2>&1
|
||||
|
||||
TESTDIR="$SCRATCH_MNT/test-$seq"
|
||||
rm -rf $TESTDIR
|
||||
mkdir $TESTDIR
|
||||
|
||||
echo "Create the original files"
|
||||
BLKSZ=65536
|
||||
NR=64
|
||||
_pwrite_byte 0x61 0 $((BLKSZ * NR)) "$TESTDIR/file1" >> "$seqres.full"
|
||||
$XFS_IO_PROG -f -c "truncate $((BLKSZ * NR))" "$TESTDIR/file3" >> "$seqres.full"
|
||||
_pwrite_byte 0x00 0 $((BLKSZ * NR)) "$TESTDIR/file3.chk" >> "$seqres.full"
|
||||
seq 0 2 $((NR-1)) | while read f; do
|
||||
_reflink_range "$TESTDIR/file1" $((BLKSZ * f)) "$TESTDIR/file3" $((BLKSZ * f)) $BLKSZ >> "$seqres.full"
|
||||
_pwrite_byte 0x61 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full"
|
||||
done
|
||||
_scratch_remount
|
||||
|
||||
echo "Compare files"
|
||||
md5sum "$TESTDIR/file1" | _filter_scratch
|
||||
md5sum "$TESTDIR/file3" | _filter_scratch
|
||||
md5sum "$TESTDIR/file3.chk" | _filter_scratch
|
||||
|
||||
echo "CoW across the transition"
|
||||
"$XFS_IO_PROG" -f -c "pwrite -S 0x63 -b $((BLKSZ * NR / 2)) $((BLKSZ * NR / 4)) $((BLKSZ * NR / 2))" "$TESTDIR/file3" >> "$seqres.full"
|
||||
_pwrite_byte 0x63 $((BLKSZ * NR / 4)) $((BLKSZ * NR / 2)) "$TESTDIR/file3.chk" >> "$seqres.full"
|
||||
_scratch_remount
|
||||
|
||||
echo "Compare files"
|
||||
md5sum "$TESTDIR/file1" | _filter_scratch
|
||||
md5sum "$TESTDIR/file3" | _filter_scratch
|
||||
md5sum "$TESTDIR/file3.chk" | _filter_scratch
|
||||
|
||||
echo "Check for damage"
|
||||
umount "$SCRATCH_MNT"
|
||||
_check_scratch_fs
|
||||
|
||||
# success, all done
|
||||
status=0
|
||||
exit
|
||||
@@ -0,0 +1,13 @@
|
||||
QA output created by 191
|
||||
Format and mount
|
||||
Create the original files
|
||||
Compare files
|
||||
bdbcf02ee0aa977795a79d25fcfdccb1 SCRATCH_MNT/test-191/file1
|
||||
fa50dba51826899c372464a153cb2117 SCRATCH_MNT/test-191/file3
|
||||
fa50dba51826899c372464a153cb2117 SCRATCH_MNT/test-191/file3.chk
|
||||
CoW across the transition
|
||||
Compare files
|
||||
bdbcf02ee0aa977795a79d25fcfdccb1 SCRATCH_MNT/test-191/file1
|
||||
09101629908f9bdd5d178e7ce20bb1bb SCRATCH_MNT/test-191/file3
|
||||
09101629908f9bdd5d178e7ce20bb1bb SCRATCH_MNT/test-191/file3.chk
|
||||
Check for damage
|
||||
Executable
+101
@@ -0,0 +1,101 @@
|
||||
#! /bin/bash
|
||||
# FS QA Test No. 194
|
||||
#
|
||||
# Ensuring that copy on write in direct-io mode works when the CoW
|
||||
# range originally covers multiple extents, some delalloc, some not.
|
||||
# - Create a file.
|
||||
# - Reflink the odd blocks of the first file into the second file.
|
||||
# - Buffered write the even blocks of the second file.
|
||||
# - directio CoW across the halfway mark, starting with the unwritten extent.
|
||||
# - Check that the files are now different where we say they're different.
|
||||
#
|
||||
#-----------------------------------------------------------------------
|
||||
# Copyright (c) 2015, 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 /
|
||||
rm -rf "$tmp".* "$TESTDIR"
|
||||
}
|
||||
|
||||
# get standard environment, filters and checks
|
||||
. ./common/rc
|
||||
. ./common/filter
|
||||
. ./common/reflink
|
||||
|
||||
# real QA test starts here
|
||||
_supported_os Linux
|
||||
_require_scratch_reflink
|
||||
_require_xfs_io_command "falloc"
|
||||
|
||||
rm -f "$seqres.full"
|
||||
|
||||
echo "Format and mount"
|
||||
_scratch_mkfs > "$seqres.full" 2>&1
|
||||
_scratch_mount >> "$seqres.full" 2>&1
|
||||
|
||||
TESTDIR="$SCRATCH_MNT/test-$seq"
|
||||
rm -rf $TESTDIR
|
||||
mkdir $TESTDIR
|
||||
|
||||
echo "Create the original files"
|
||||
BLKSZ=65536
|
||||
NR=64
|
||||
_pwrite_byte 0x61 0 $((BLKSZ * NR)) "$TESTDIR/file1" >> "$seqres.full"
|
||||
$XFS_IO_PROG -f -c "truncate $((BLKSZ * NR))" "$TESTDIR/file3" >> "$seqres.full"
|
||||
_pwrite_byte 0x00 0 $((BLKSZ * NR)) "$TESTDIR/file3.chk" >> "$seqres.full"
|
||||
seq 0 2 $((NR-1)) | while read f; do
|
||||
_reflink_range "$TESTDIR/file1" $((BLKSZ * f)) "$TESTDIR/file3" $((BLKSZ * f)) $BLKSZ >> "$seqres.full"
|
||||
_pwrite_byte 0x61 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full"
|
||||
done
|
||||
_scratch_remount
|
||||
|
||||
echo "Compare files"
|
||||
md5sum "$TESTDIR/file1" | _filter_scratch
|
||||
md5sum "$TESTDIR/file3" | _filter_scratch
|
||||
md5sum "$TESTDIR/file3.chk" | _filter_scratch
|
||||
|
||||
echo "directio CoW across the transition"
|
||||
seq 1 2 $NR | while read f; do
|
||||
_pwrite_byte 0x62 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3" >> "$seqres.full"
|
||||
_pwrite_byte 0x62 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full"
|
||||
done
|
||||
"$XFS_IO_PROG" -d -f -c "pwrite -S 0x63 -b $((BLKSZ * NR / 2)) $((BLKSZ * NR / 4)) $((BLKSZ * NR / 2))" "$TESTDIR/file3" >> "$seqres.full"
|
||||
_pwrite_byte 0x63 $((BLKSZ * NR / 4)) $((BLKSZ * NR / 2)) "$TESTDIR/file3.chk" >> "$seqres.full"
|
||||
_scratch_remount
|
||||
|
||||
echo "Compare files"
|
||||
md5sum "$TESTDIR/file1" | _filter_scratch
|
||||
md5sum "$TESTDIR/file3" | _filter_scratch
|
||||
md5sum "$TESTDIR/file3.chk" | _filter_scratch
|
||||
|
||||
echo "Check for damage"
|
||||
umount "$SCRATCH_MNT"
|
||||
_check_scratch_fs
|
||||
|
||||
# success, all done
|
||||
status=0
|
||||
exit
|
||||
@@ -0,0 +1,13 @@
|
||||
QA output created by 194
|
||||
Format and mount
|
||||
Create the original files
|
||||
Compare files
|
||||
bdbcf02ee0aa977795a79d25fcfdccb1 SCRATCH_MNT/test-194/file1
|
||||
fa50dba51826899c372464a153cb2117 SCRATCH_MNT/test-194/file3
|
||||
fa50dba51826899c372464a153cb2117 SCRATCH_MNT/test-194/file3.chk
|
||||
directio CoW across the transition
|
||||
Compare files
|
||||
bdbcf02ee0aa977795a79d25fcfdccb1 SCRATCH_MNT/test-194/file1
|
||||
55968a95dfc0120df4e8485576514320 SCRATCH_MNT/test-194/file3
|
||||
55968a95dfc0120df4e8485576514320 SCRATCH_MNT/test-194/file3.chk
|
||||
Check for damage
|
||||
Executable
+101
@@ -0,0 +1,101 @@
|
||||
#! /bin/bash
|
||||
# FS QA Test No. 195
|
||||
#
|
||||
# Ensuring that copy on write in buffered mode works when the CoW
|
||||
# range originally covers multiple extents, some delalloc, some not.
|
||||
# - Create a file.
|
||||
# - Reflink the odd blocks of the first file into the second file.
|
||||
# - Buffered write the even blocks of the second file.
|
||||
# - CoW across the halfway mark, starting with the unwritten extent.
|
||||
# - Check that the files are now different where we say they're different.
|
||||
#
|
||||
#-----------------------------------------------------------------------
|
||||
# Copyright (c) 2015, 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 /
|
||||
rm -rf "$tmp".* "$TESTDIR"
|
||||
}
|
||||
|
||||
# get standard environment, filters and checks
|
||||
. ./common/rc
|
||||
. ./common/filter
|
||||
. ./common/reflink
|
||||
|
||||
# real QA test starts here
|
||||
_supported_os Linux
|
||||
_require_scratch_reflink
|
||||
_require_xfs_io_command "falloc"
|
||||
|
||||
rm -f "$seqres.full"
|
||||
|
||||
echo "Format and mount"
|
||||
_scratch_mkfs > "$seqres.full" 2>&1
|
||||
_scratch_mount >> "$seqres.full" 2>&1
|
||||
|
||||
TESTDIR="$SCRATCH_MNT/test-$seq"
|
||||
rm -rf $TESTDIR
|
||||
mkdir $TESTDIR
|
||||
|
||||
echo "Create the original files"
|
||||
BLKSZ=65536
|
||||
NR=64
|
||||
_pwrite_byte 0x61 0 $((BLKSZ * NR)) "$TESTDIR/file1" >> "$seqres.full"
|
||||
$XFS_IO_PROG -f -c "truncate $((BLKSZ * NR))" "$TESTDIR/file3" >> "$seqres.full"
|
||||
_pwrite_byte 0x00 0 $((BLKSZ * NR)) "$TESTDIR/file3.chk" >> "$seqres.full"
|
||||
seq 0 2 $((NR-1)) | while read f; do
|
||||
_reflink_range "$TESTDIR/file1" $((BLKSZ * f)) "$TESTDIR/file3" $((BLKSZ * f)) $BLKSZ >> "$seqres.full"
|
||||
_pwrite_byte 0x61 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full"
|
||||
done
|
||||
_scratch_remount
|
||||
|
||||
echo "Compare files"
|
||||
md5sum "$TESTDIR/file1" | _filter_scratch
|
||||
md5sum "$TESTDIR/file3" | _filter_scratch
|
||||
md5sum "$TESTDIR/file3.chk" | _filter_scratch
|
||||
|
||||
echo "CoW across the transition"
|
||||
seq 1 2 $NR | while read f; do
|
||||
_pwrite_byte 0x62 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3" >> "$seqres.full"
|
||||
_pwrite_byte 0x62 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full"
|
||||
done
|
||||
"$XFS_IO_PROG" -f -c "pwrite -S 0x63 -b $((BLKSZ * NR / 2)) $((BLKSZ * NR / 4)) $((BLKSZ * NR / 2))" "$TESTDIR/file3" >> "$seqres.full"
|
||||
_pwrite_byte 0x63 $((BLKSZ * NR / 4)) $((BLKSZ * NR / 2)) "$TESTDIR/file3.chk" >> "$seqres.full"
|
||||
_scratch_remount
|
||||
|
||||
echo "Compare files"
|
||||
md5sum "$TESTDIR/file1" | _filter_scratch
|
||||
md5sum "$TESTDIR/file3" | _filter_scratch
|
||||
md5sum "$TESTDIR/file3.chk" | _filter_scratch
|
||||
|
||||
echo "Check for damage"
|
||||
umount "$SCRATCH_MNT"
|
||||
_check_scratch_fs
|
||||
|
||||
# success, all done
|
||||
status=0
|
||||
exit
|
||||
@@ -0,0 +1,13 @@
|
||||
QA output created by 195
|
||||
Format and mount
|
||||
Create the original files
|
||||
Compare files
|
||||
bdbcf02ee0aa977795a79d25fcfdccb1 SCRATCH_MNT/test-195/file1
|
||||
fa50dba51826899c372464a153cb2117 SCRATCH_MNT/test-195/file3
|
||||
fa50dba51826899c372464a153cb2117 SCRATCH_MNT/test-195/file3.chk
|
||||
CoW across the transition
|
||||
Compare files
|
||||
bdbcf02ee0aa977795a79d25fcfdccb1 SCRATCH_MNT/test-195/file1
|
||||
55968a95dfc0120df4e8485576514320 SCRATCH_MNT/test-195/file3
|
||||
55968a95dfc0120df4e8485576514320 SCRATCH_MNT/test-195/file3.chk
|
||||
Check for damage
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user