reflink: ensure that we can handle reflinking a lot of extents

Update the existing stress tests to ensure that we can handle
reflinking the same block a million times, and that we can handle
reflinking million different extents.  Add a couple of tests to ensure
that we can ^C and SIGKILL our way out of long-running reflinks.

v2: Don't run the signal tests on NFS, as we cannot interrupt NFS
clone operations.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
[hch@lst.de: don't run on NFS]
Signed-off-by: Christoph Hellwig <hch@lst.de>
This commit is contained in:
Darrick J. Wong
2016-02-04 09:26:03 -08:00
parent 37059d0ca7
commit ddf6ff2f94
12 changed files with 328 additions and 59 deletions
+14 -32
View File
@@ -1,12 +1,10 @@
#! /bin/bash
# FS QA Test No. 175
#
# Try to hit the maximum reference count (eek!)
#
# This test runs extremely slowly, so it's not automatically run anywhere.
# See how well reflink handles reflinking the same block a million times.
#
#-----------------------------------------------------------------------
# Copyright (c) 2015, Oracle and/or its affiliates. All Rights Reserved.
# 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
@@ -34,7 +32,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
_cleanup()
{
cd /
rm -rf "$tmp".* "$testdir1"
rm -rf "$tmp".*
}
# get standard environment, filters and checks
@@ -55,43 +53,27 @@ _scratch_mkfs > "$seqres.full" 2>&1
_scratch_mount >> "$seqres.full" 2>&1
testdir="$SCRATCH_MNT/test-$seq"
rm -rf "$testdir"
mkdir "$testdir"
# Well let's hope the maximum reflink count is (less than (ha!)) 2^32...
echo "Create a one block file"
blksz="$(stat -f "$testdir" -c '%S')"
_pwrite_byte 0x61 0 $blksz "$testdir/file1" >> "$seqres.full"
_pwrite_byte 0x62 0 $blksz "$testdir/file2" >> "$seqres.full"
_cp_reflink "$testdir/file1" "$testdir/file2" >> "$seqres.full"
nr=32
fnr=32
fnr=19
echo "Create extents"
truncate -s $(( (2 ** i) * blksz)) "$testdir/file1"
for i in $(seq 0 $fnr); do
echo " ++ Reflink size $i, $(( (2 ** i) * blksz)) bytes" | tee -a "$seqres.full"
echo " ++ Reflink size $i, $((2 ** i)) blocks" >> "$seqres.full"
n=$(( (2 ** i) * blksz))
_reflink_range "$testdir/file1" 0 "$testdir/file1" $n $n >> "$seqres.full" || break
_reflink_range "$testdir/file1" 0 "$testdir/file1" $n $n >> "$seqres.full"
done
_scratch_remount
nrf=$((nr - fnr))
echo "Clone $((2 ** nrf)) files"
seq 0 $((2 ** nrf)) | while read i; do
_cp-reflink "$testdir/file1" "$testdir/file1-$i"
done
echo "Check scratch fs"
umount "$SCRATCH_MNT"
_check_scratch_fs
echo "Remove big file and recheck"
_scratch_mount >> "$seqres.full" 2>&1
umount "$SCRATCH_MNT"
_check_scratch_fs
echo "Remove all files and recheck"
_scratch_mount >> "$seqres.full" 2>&1
umount "$SCRATCH_MNT"
echo "Reflink the big file"
blks=$((2 ** (fnr + 1) ))
bytes=$((blks * blksz))
echo "reflinking $blks blocks, $bytes bytes" >> "$seqres.full"
_reflink_range "$testdir/file1" 0 "$testdir/file2" 0 $bytes >> "$seqres.full"
# success, all done
status=0