mirror of
https://github.com/linux-apfs/apfstests.git
synced 2026-05-01 15:01:44 -07:00
xfstests: move remaining tests out of top level directory
These are tests that are shared between multiple filesystems (moved to shared), and udf/btrfs/ext4 specific tests, moved to appropriate directories. I created the "shared" directory to indicate tests that are not truly generic, but also not filesystem specific. They might rely on a feature that is only implmented in a few filesystems and so can't be truly generic. Signed-off-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Phil White <pwhite@sgi.com> [rjohnston@sgi.com reworked for TOT changes] Signed-off-by: Rich Johnston <rjohnston@sgi.com>
This commit is contained in:
committed by
Rich Johnston
parent
fc48dfb966
commit
8ff10d6d1c
Executable
+106
@@ -0,0 +1,106 @@
|
||||
#! /bin/bash
|
||||
# FS QA Test No. 254
|
||||
#
|
||||
# Test btrfs's subvolume and snapshot support
|
||||
#
|
||||
#-----------------------------------------------------------------------
|
||||
# Copyright (c) 2011 Red Hat. 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`
|
||||
echo "QA output created by $seq"
|
||||
|
||||
here=`pwd`
|
||||
tmp=/tmp/$$
|
||||
status=1 # failure is the default!
|
||||
|
||||
_cleanup()
|
||||
{
|
||||
rm -f $tmp.*
|
||||
}
|
||||
|
||||
trap "_cleanup ; exit \$status" 0 1 2 3 15
|
||||
|
||||
# get standard environment, filters and checks
|
||||
. ./common.rc
|
||||
. ./common.filter
|
||||
|
||||
# real QA test starts here
|
||||
_supported_fs btrfs
|
||||
_supported_os Linux
|
||||
_require_scratch
|
||||
|
||||
_scratch_mkfs > /dev/null 2>&1
|
||||
_scratch_mount
|
||||
|
||||
# First test basic snapshotting
|
||||
echo "Creating file foo in root dir"
|
||||
dd if=/dev/zero of=$SCRATCH_MNT/foo bs=1M count=1 &> /dev/null
|
||||
echo "List root dir"
|
||||
ls $SCRATCH_MNT
|
||||
echo "Creating snapshot of root dir"
|
||||
btrfs subvolume snapshot $SCRATCH_MNT $SCRATCH_MNT/snap | _filter_scratch
|
||||
echo "List root dir after snapshot"
|
||||
ls $SCRATCH_MNT
|
||||
echo "List snapshot dir"
|
||||
ls $SCRATCH_MNT/snap
|
||||
rm -f $SCRATCH_MNT/foo
|
||||
echo "List root dir after rm of foo"
|
||||
ls $SCRATCH_MNT
|
||||
echo "List snapshot dir"
|
||||
ls $SCRATCH_MNT/snap
|
||||
|
||||
# Test creating a normal subvolme
|
||||
btrfs subvolume create $SCRATCH_MNT/subvol | _filter_scratch
|
||||
echo "Listing root dir"
|
||||
ls $SCRATCH_MNT
|
||||
echo "Listing subvol"
|
||||
ls $SCRATCH_MNT/subvol
|
||||
|
||||
# Test setting a default mount
|
||||
echo "Creating file bar in subvol"
|
||||
dd if=/dev/zero of=$SCRATCH_MNT/subvol/bar bs=1M count=1 &> /dev/null
|
||||
echo "Setting subvol to the default"
|
||||
btrfs subvolume set-default 0 $SCRATCH_MNT/subvol | _filter_scratch
|
||||
_scratch_remount
|
||||
echo "List root dir which is now subvol"
|
||||
ls $SCRATCH_MNT
|
||||
_scratch_unmount
|
||||
echo "Mounting sbuvolid=0 for the root dir"
|
||||
_scratch_mount "-o subvolid=0"
|
||||
echo "List root dir"
|
||||
ls $SCRATCH_MNT
|
||||
echo "Setting the root dir as the default again"
|
||||
btrfs subvolume set-default 0 $SCRATCH_MNT | _filter_scratch
|
||||
_scratch_remount
|
||||
echo "List root dir"
|
||||
ls $SCRATCH_MNT
|
||||
|
||||
# Test listing the subvolumes
|
||||
echo "Listing subvolumes"
|
||||
btrfs subvolume list $SCRATCH_MNT | awk '{ print $NF }'
|
||||
|
||||
# Delete the snapshot
|
||||
btrfs subvolume delete $SCRATCH_MNT/snap | _filter_scratch
|
||||
echo "List root dir"
|
||||
ls $SCRATCH_MNT
|
||||
_scratch_remount
|
||||
echo "List root dir"
|
||||
ls $SCRATCH_MNT
|
||||
|
||||
status=0 ; exit
|
||||
@@ -0,0 +1,40 @@
|
||||
QA output created by 254
|
||||
Creating file foo in root dir
|
||||
List root dir
|
||||
foo
|
||||
Creating snapshot of root dir
|
||||
Create a snapshot of 'SCRATCH_MNT' in 'SCRATCH_MNT/snap'
|
||||
List root dir after snapshot
|
||||
foo
|
||||
snap
|
||||
List snapshot dir
|
||||
foo
|
||||
List root dir after rm of foo
|
||||
snap
|
||||
List snapshot dir
|
||||
foo
|
||||
Create subvolume 'SCRATCH_MNT/subvol'
|
||||
Listing root dir
|
||||
snap
|
||||
subvol
|
||||
Listing subvol
|
||||
Creating file bar in subvol
|
||||
Setting subvol to the default
|
||||
List root dir which is now subvol
|
||||
bar
|
||||
Mounting sbuvolid=0 for the root dir
|
||||
List root dir
|
||||
snap
|
||||
subvol
|
||||
Setting the root dir as the default again
|
||||
List root dir
|
||||
snap
|
||||
subvol
|
||||
Listing subvolumes
|
||||
snap
|
||||
subvol
|
||||
Delete subvolume 'SCRATCH_MNT/snap'
|
||||
List root dir
|
||||
subvol
|
||||
List root dir
|
||||
subvol
|
||||
Executable
+191
@@ -0,0 +1,191 @@
|
||||
#!/bin/bash
|
||||
# FS QA Test No. 264
|
||||
#
|
||||
# Extented btrfs snapshot test cases
|
||||
#
|
||||
#-----------------------------------------------------------------------
|
||||
# Copyright (c) 2011 Oracle 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`
|
||||
echo "QA output created by $seq"
|
||||
|
||||
here=`pwd`
|
||||
tmp=/tmp/$$
|
||||
status=1 # failure is the default!
|
||||
|
||||
_cleanup()
|
||||
{
|
||||
rm -f $tmp.*
|
||||
}
|
||||
|
||||
trap "_cleanup ; exit \$status" 0 1 2 3 15
|
||||
|
||||
# get standard environment, filters and checks
|
||||
. ./common.rc
|
||||
. ./common.filter
|
||||
|
||||
_need_to_be_root
|
||||
_supported_fs btrfs
|
||||
_supported_os Linux
|
||||
_require_scratch
|
||||
|
||||
_scratch_mkfs $SCRATCH_DEV_POOL > /dev/null 2>&1 || _fail "mkfs failed"
|
||||
_scratch_mount
|
||||
|
||||
# Create and save sha256sum
|
||||
# arg1 FS to generate sha256
|
||||
# arg2 File name to save the sha256 output
|
||||
_save_checksum()
|
||||
{
|
||||
local i=0
|
||||
>$2
|
||||
cd $1
|
||||
for i in `find . -type f`; do sha256sum $i >> $2; done
|
||||
cd $OLDPWD
|
||||
}
|
||||
|
||||
# Verify the sha256sum for a FS
|
||||
# arg1 FS to be tested
|
||||
# arg2 sha256 file
|
||||
_verify_checksum()
|
||||
{
|
||||
cd $1
|
||||
[ -f $2 ] || _fail "checksum file $2 not found"
|
||||
sha256sum -c $2 | grep "FAILED"
|
||||
cd $OLDPWD
|
||||
}
|
||||
|
||||
# Create a snapshot
|
||||
# arg1 dest dir
|
||||
# Return snapshot name in the SNAPNAME
|
||||
_create_snap()
|
||||
{
|
||||
local x
|
||||
[ -d $1 ] || _fail "Destination dir $1 not present"
|
||||
SNAPNAME=`mktemp -u $SCRATCH_MNT/snap.XXXXXX`
|
||||
btrfs subvolume snapshot $1 $SNAPNAME > /dev/null || _fail "snapshot create failed"
|
||||
}
|
||||
|
||||
# Reads and writes new data but does not allocate new blocks
|
||||
# arg1 FS to be modified
|
||||
_read_modify_write()
|
||||
{
|
||||
local i
|
||||
local FSIZE
|
||||
for i in `find $1 -type f`
|
||||
do
|
||||
FSIZE=`stat -t $i | cut -d" " -f2`
|
||||
dd if=$i of=/dev/null obs=$FSIZE count=1 status=noxfer 2>/dev/null &
|
||||
dd if=/dev/urandom of=$i obs=$FSIZE count=1 status=noxfer 2>/dev/null &
|
||||
done
|
||||
wait $!
|
||||
}
|
||||
|
||||
# Fills the allocated blocks
|
||||
# arg1 FS in question
|
||||
_fill_blk()
|
||||
{
|
||||
local FSIZE
|
||||
local BLKS
|
||||
local NBLK
|
||||
local FALLOC
|
||||
local WS
|
||||
|
||||
for i in `find /$1 -type f`
|
||||
do
|
||||
FSIZE=`stat -t $i | cut -d" " -f2`
|
||||
BLKS=`stat -c "%B" $i`
|
||||
NBLK=`stat -c "%b" $i`
|
||||
FALLOC=$(($BLKS * $NBLK))
|
||||
WS=$(($FALLOC - $FSIZE))
|
||||
dd if=/dev/urandom of=$i oseek=$FSIZE obs=$WS count=1 status=noxfer 2>/dev/null &
|
||||
done
|
||||
wait $!
|
||||
}
|
||||
|
||||
|
||||
# Append a random size to the files
|
||||
# arg1 : FS in question
|
||||
_append_file()
|
||||
{
|
||||
local FSIZE
|
||||
local X
|
||||
local N
|
||||
local i
|
||||
N=0
|
||||
for i in `find $1 -type f`
|
||||
do
|
||||
if [ $N == 0 ]; then
|
||||
X=$i
|
||||
FSIZE=`stat -t $X | cut -d" " -f2`
|
||||
dd if=$X of=$X seek=1 bs=$FSIZE obs=$FSIZE count=1 status=noxfer 2>/dev/null &
|
||||
N=$(($N+1))
|
||||
continue
|
||||
fi
|
||||
FSIZE=`stat -t $i | cut -d" " -f2`
|
||||
dd if=$X of=$i seek=1 bs=$FSIZE obs=$FSIZE count=1 status=noxfer 2>/dev/null &
|
||||
X=$i
|
||||
done
|
||||
wait $!
|
||||
}
|
||||
|
||||
##################### real QA test starts here###################################
|
||||
# sv1 - is just a name nothing spl
|
||||
firstvol="$SCRATCH_MNT/sv1"
|
||||
btrfs subvolume create $firstvol > /dev/null || _fail "btrfs subvolume create $firstvol failed"
|
||||
dirp=`mktemp -duq $firstvol/dir.XXXXXX`
|
||||
_populate_fs -n 1 -f 20 -d 10 -r $dirp -s 10 -x
|
||||
SNAPNAME=0
|
||||
_create_snap $firstvol
|
||||
_save_checksum $firstvol $tmp.sv1.sum
|
||||
_verify_checksum $SNAPNAME $tmp.sv1.sum
|
||||
|
||||
#Append1 the files
|
||||
_fill_blk $SNAPNAME
|
||||
_verify_checksum $firstvol $tmp.sv1.sum
|
||||
|
||||
#Append2 the files
|
||||
_append_file $SNAPNAME
|
||||
_verify_checksum $firstvol $tmp.sv1.sum
|
||||
|
||||
#read modify write
|
||||
_read_modify_write $SNAPNAME
|
||||
_verify_checksum $firstvol $tmp.sv1.sum
|
||||
|
||||
#nested snapshot test
|
||||
src_vol=$firstvol
|
||||
for i in `seq 1 7`; do
|
||||
SNAPNAME=0
|
||||
_create_snap $src_vol
|
||||
_verify_checksum $SNAPNAME $tmp.sv1.sum
|
||||
src_vol=$SNAPNAME
|
||||
done
|
||||
|
||||
# file delete test
|
||||
SNAPNAME=0
|
||||
_create_snap $firstvol
|
||||
tname=`echo $SNAPNAME | rev | cut -d"/" -f1 | rev`
|
||||
_save_checksum $SNAPNAME $tmp.$tname.sum
|
||||
\rm -rf $firstvol/*
|
||||
_verify_checksum $SNAPNAME $tmp.$tname.sum
|
||||
|
||||
umount $SCRATCH_DEV || _fail "unmount failed"
|
||||
|
||||
echo "Silence is golden"
|
||||
status=0; exit
|
||||
@@ -0,0 +1,2 @@
|
||||
QA output created by 264
|
||||
Silence is golden
|
||||
Executable
+185
@@ -0,0 +1,185 @@
|
||||
#! /bin/bash
|
||||
# FS QA Test No. 265
|
||||
#
|
||||
# btrfs vol tests
|
||||
#
|
||||
#-----------------------------------------------------------------------
|
||||
# Copyright (c) 2011 Oracle. 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`
|
||||
echo "QA output created by $seq"
|
||||
|
||||
here=`pwd`
|
||||
tmp=/tmp/$$
|
||||
status=1 # failure is the default!
|
||||
dev_removed=0
|
||||
trap "_cleanup; exit \$status" 0 1 2 3 15
|
||||
|
||||
_cleanup()
|
||||
{
|
||||
cd /
|
||||
rm -f $tmp.*
|
||||
if [ $dev_removed == 1 ]; then
|
||||
umount $SCRATCH_MNT
|
||||
_devmgt_add "${DEVHTL}"
|
||||
fi
|
||||
}
|
||||
|
||||
# get standard environment, filters and checks
|
||||
. ./common.rc
|
||||
. ./common.filter
|
||||
|
||||
_need_to_be_root
|
||||
_supported_fs btrfs
|
||||
_supported_os Linux
|
||||
_require_scratch
|
||||
_require_scratch_dev_pool
|
||||
_require_deletable_scratch_dev_pool
|
||||
|
||||
# Test cases related to raid in btrfs
|
||||
_test_raid0()
|
||||
{
|
||||
export MKFS_OPTIONS="-m raid0 -d raid0"
|
||||
_scratch_mkfs $SCRATCH_DEV_POOL > /dev/null 2>&1 || _fail "mkfs failed"
|
||||
_scratch_mount
|
||||
dirp=`mktemp -duq $SCRATCH_MNT/dir.XXXXXX`
|
||||
_populate_fs -n 1 -f 20 -d 10 -r $dirp -s 10
|
||||
umount $SCRATCH_MNT
|
||||
}
|
||||
|
||||
_test_raid1()
|
||||
{
|
||||
export MKFS_OPTIONS="-m raid1 -d raid1"
|
||||
_scratch_mkfs $SCRATCH_DEV_POOL > /dev/null 2>&1 || _fail "mkfs failed"
|
||||
_scratch_mount
|
||||
dirp=`mktemp -duq $SCRATCH_MNT/dir.XXXXXX`
|
||||
_populate_fs -n 1 -f 20 -d 10 -r $dirp -s 10
|
||||
umount $SCRATCH_MNT
|
||||
}
|
||||
|
||||
_test_raid10()
|
||||
{
|
||||
export MKFS_OPTIONS="-m raid10 -d raid10"
|
||||
_scratch_mkfs $SCRATCH_DEV_POOL > /dev/null 2>&1 || _fail "mkfs failed"
|
||||
_scratch_mount
|
||||
dirp=`mktemp -duq $SCRATCH_MNT/dir.XXXXXX`
|
||||
_populate_fs -n 1 -f 20 -d 10 -r $dirp -s 10
|
||||
umount $SCRATCH_MNT
|
||||
}
|
||||
|
||||
_test_single()
|
||||
{
|
||||
export MKFS_OPTIONS="-m single -d single"
|
||||
_scratch_mkfs $SCRATCH_DEV_POOL > /dev/null 2>&1 || _fail "mkfs failed"
|
||||
_scratch_mount
|
||||
dirp=`mktemp -duq $SCRATCH_MNT/dir.XXXXXX`
|
||||
_populate_fs -n 1 -f 20 -d 10 -r $dirp -s 10
|
||||
umount $SCRATCH_MNT
|
||||
}
|
||||
|
||||
_test_add()
|
||||
{
|
||||
local i
|
||||
local devs[]="( $SCRATCH_DEV_POOL )"
|
||||
local n=${#devs[@]}
|
||||
|
||||
n=$(($n-1))
|
||||
|
||||
export MKFS_OPTIONS=""
|
||||
_scratch_mkfs > /dev/null 2>&1 || _fail "mkfs failed"
|
||||
_scratch_mount
|
||||
dirp=`mktemp -duq $SCRATCH_MNT/dir.XXXXXX`
|
||||
_populate_fs -n 1 -f 20 -d 10 -r $dirp -s 10
|
||||
for i in `seq 1 $n`; do
|
||||
btrfs device add ${devs[$i]} $SCRATCH_MNT > /dev/null 2>&1 || _fail "device add failed"
|
||||
done
|
||||
btrfs filesystem balance $SCRATCH_MNT || _fail "balance failed"
|
||||
umount $SCRATCH_MNT
|
||||
}
|
||||
|
||||
_test_replace()
|
||||
{
|
||||
local i
|
||||
local devs=( $SCRATCH_DEV_POOL )
|
||||
local n=${#devs[@]}
|
||||
local ds
|
||||
local d
|
||||
local DEVHTL=""
|
||||
|
||||
# exclude the last disk in the disk pool
|
||||
n=$(($n-1))
|
||||
ds=${devs[@]:0:$n}
|
||||
|
||||
export MKFS_OPTIONS="-m raid1 -d raid1"
|
||||
_scratch_mkfs "$ds" > /dev/null 2>&1 || _fail "tr: mkfs failed"
|
||||
_scratch_mount
|
||||
dirp=`mktemp -duq $SCRATCH_MNT/dir.XXXXXX`
|
||||
_populate_fs -n 1 -f 20 -d 10 -r $dirp -s 10
|
||||
|
||||
#pick the 2nd last disk
|
||||
ds=${devs[@]:$(($n-1)):1}
|
||||
|
||||
# retrive the HTL for this scsi disk
|
||||
d=`echo $ds|cut -d"/" -f3`
|
||||
DEVHTL=`ls -l /sys/class/block/${d} | rev | cut -d "/" -f 3 | rev`
|
||||
|
||||
#fail disk
|
||||
_devmgt_remove ${DEVHTL}
|
||||
dev_removed=1
|
||||
|
||||
btrfs fi show $SCRATCH_DEV | grep "Some devices missing" > /dev/null || _fail \
|
||||
"btrfs did not report device missing"
|
||||
|
||||
# add a new disk to btrfs
|
||||
ds=${devs[@]:$(($n)):1}
|
||||
btrfs device add ${ds} $SCRATCH_MNT > /dev/null 2>&1 || _fail "dev add failed"
|
||||
# in some system balance fails if there is no delay (a bug)
|
||||
# putting sleep 10 to work around as of now
|
||||
# sleep 10
|
||||
btrfs fi balance $SCRATCH_MNT || _fail "dev balance failed"
|
||||
|
||||
# cleaup. add the removed disk
|
||||
umount $SCRATCH_MNT
|
||||
_devmgt_add "${DEVHTL}"
|
||||
dev_removed=0
|
||||
}
|
||||
|
||||
_test_remove()
|
||||
{
|
||||
_scratch_mkfs "$SCRATCH_DEV_POOL" > /dev/null 2>&1 || _fail "mkfs failed"
|
||||
_scratch_mount
|
||||
dirp=`mktemp -duq $SCRATCH_MNT/dir.XXXXXX`
|
||||
_populate_fs -n 1 -f 20 -d 10 -r $dirp -s 10
|
||||
|
||||
# pick last dev in the list
|
||||
dev_del=`echo ${SCRATCH_DEV_POOL} | awk '{print $NF}'`
|
||||
btrfs device delete $dev_del $SCRATCH_MNT || _fail "btrfs device delete failed"
|
||||
btrfs fi show $SCRATCH_DEV 2>&1 | grep $dev_del > /dev/null && _fail "btrfs still shows the deleted dev"
|
||||
umount $SCRATCH_MNT
|
||||
}
|
||||
|
||||
_test_raid0
|
||||
_test_raid1
|
||||
_test_raid10
|
||||
_test_single
|
||||
_test_add
|
||||
_test_replace
|
||||
_test_remove
|
||||
|
||||
echo "Silence is golden"
|
||||
status=0; exit
|
||||
@@ -0,0 +1,2 @@
|
||||
QA output created by 265
|
||||
Silence is golden
|
||||
Executable
+269
@@ -0,0 +1,269 @@
|
||||
#! /bin/bash
|
||||
# FSQA Test No. 276
|
||||
#
|
||||
# Run fsstress to create a reasonably strange file system, make a
|
||||
# snapshot and run more fsstress. Then select some files from that fs,
|
||||
# run filefrag to get the extent mapping and follow the backrefs.
|
||||
# We check to end up back at the original file with the correct offset.
|
||||
#
|
||||
#-----------------------------------------------------------------------
|
||||
# Copyright (C) 2011 STRATO. 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`
|
||||
echo "QA output created by $seq"
|
||||
|
||||
here=`pwd`
|
||||
tmp=/tmp/$$
|
||||
status=1
|
||||
noise_pid=0
|
||||
|
||||
_cleanup()
|
||||
{
|
||||
if [ $noise_pid -ne 0 ]; then
|
||||
echo "background noise kill $noise_pid" >>$seq.full
|
||||
kill $noise_pid
|
||||
noise_pid=0
|
||||
wait
|
||||
fi
|
||||
echo "*** unmount"
|
||||
umount $SCRATCH_MNT 2>/dev/null
|
||||
rm -f $tmp.*
|
||||
}
|
||||
trap "_cleanup; exit \$status" 0 1 2 3 15
|
||||
|
||||
# get standard environment, filters and checks
|
||||
. ./common.rc
|
||||
. ./common.filter
|
||||
|
||||
# real QA test starts here
|
||||
_need_to_be_root
|
||||
_supported_fs btrfs
|
||||
_supported_os Linux
|
||||
_require_scratch
|
||||
_require_no_large_scratch_dev
|
||||
_require_btrfs inspect-internal
|
||||
_require_command "/usr/sbin/filefrag"
|
||||
|
||||
rm -f $seq.full
|
||||
|
||||
FILEFRAG_FILTER='if (/, blocksize (\d+)/) {$blocksize = $1; next} ($ext, '\
|
||||
'$logical, $physical, $expected, $length, $flags) = (/^\s*(\d+)\s+(\d+)'\
|
||||
'\s+(\d+)\s+(?:(\d+)\s+)?(\d+)\s+(.*)/) or next; $flags =~ '\
|
||||
'/(?:^|,)inline(?:,|$)/ and next; print $physical * $blocksize, "#", '\
|
||||
'$length * $blocksize, "#", $logical * $blocksize, " "'
|
||||
|
||||
# this makes filefrag output script readable by using a perl helper.
|
||||
# output is one extent per line, with three numbers separated by '#'
|
||||
# the numbers are: physical, length, logical (all in bytes)
|
||||
# sample output: "1234#10#5678" -> physical 1234, length 10, logical 5678
|
||||
_filter_extents()
|
||||
{
|
||||
tee -a $seq.full | $PERL_PROG -ne "$FILEFRAG_FILTER"
|
||||
}
|
||||
|
||||
_check_file_extents()
|
||||
{
|
||||
cmd="filefrag -v $1"
|
||||
echo "# $cmd" >> $seq.full
|
||||
out=`$cmd | _filter_extents`
|
||||
if [ -z "$out" ]; then
|
||||
return 1
|
||||
fi
|
||||
echo "after filter: $out" >> $seq.full
|
||||
echo $out
|
||||
return 0
|
||||
}
|
||||
|
||||
# use a logical address and walk the backrefs back to the inode.
|
||||
# compare to the expected result.
|
||||
# returns 0 on success, 1 on error (with output made)
|
||||
_btrfs_inspect_addr()
|
||||
{
|
||||
mp=$1
|
||||
addr=$2
|
||||
expect_addr=$3
|
||||
expect_inum=$4
|
||||
file=$5
|
||||
cmd="$BTRFS_UTIL_PROG inspect-internal logical-resolve -P $addr $mp"
|
||||
echo "# $cmd" >> $seq.full
|
||||
out=`$cmd`
|
||||
echo "$out" >> $seq.full
|
||||
grep_expr="inode $expect_inum offset $expect_addr root"
|
||||
echo "$out" | grep "^$grep_expr 5$" >/dev/null
|
||||
ret=$?
|
||||
if [ $ret -eq 0 ]; then
|
||||
# look for a root number that is not 5
|
||||
echo "$out" | grep "^$grep_expr \([0-46-9][0-9]*\|5[0-9]\+\)$" \
|
||||
>/dev/null
|
||||
ret=$?
|
||||
fi
|
||||
if [ $ret -eq 0 ]; then
|
||||
return 0
|
||||
fi
|
||||
echo "unexpected output from"
|
||||
echo " $cmd"
|
||||
echo "expected inum: $expect_inum, expected address: $expect_addr,"\
|
||||
"file: $file, got:"
|
||||
echo "$out"
|
||||
return 1
|
||||
}
|
||||
|
||||
# use an inode number and walk the backrefs back to the file name.
|
||||
# compare to the expected result.
|
||||
# returns 0 on success, 1 on error (with output made)
|
||||
_btrfs_inspect_inum()
|
||||
{
|
||||
file=$1
|
||||
inum=$2
|
||||
snap_name=$3
|
||||
mp="$SCRATCH_MNT/$snap_name"
|
||||
cmd="$BTRFS_UTIL_PROG inspect-internal inode-resolve $inum $mp"
|
||||
echo "# $cmd" >> $seq.full
|
||||
out=`$cmd`
|
||||
echo "$out" >> $seq.full
|
||||
grep_expr="^$file$"
|
||||
cnt=`echo "$out" | grep "$grep_expr" | wc -l`
|
||||
if [ $cnt -ge "1" ]; then
|
||||
return 0
|
||||
fi
|
||||
echo "unexpected output from"
|
||||
echo " $cmd"
|
||||
echo "expected path: $file, got:"
|
||||
echo "$out"
|
||||
return 1
|
||||
}
|
||||
|
||||
_btrfs_inspect_check()
|
||||
{
|
||||
file=$1
|
||||
physical=$2
|
||||
length=$3
|
||||
logical=$4
|
||||
snap_name=$5
|
||||
cmd="stat -c %i $file"
|
||||
echo "# $cmd" >> $seq.full
|
||||
inum=`$cmd`
|
||||
echo "$inum" >> $seq.full
|
||||
_btrfs_inspect_addr $SCRATCH_MNT $physical $logical $inum $file
|
||||
ret=$?
|
||||
if [ $ret -eq 0 ]; then
|
||||
_btrfs_inspect_inum $file $inum $snap_name
|
||||
ret=$?
|
||||
fi
|
||||
return $ret
|
||||
}
|
||||
|
||||
workout()
|
||||
{
|
||||
fsz=$1
|
||||
nfiles=$2
|
||||
procs=$3
|
||||
snap_name=$4
|
||||
do_bg_noise=$5
|
||||
|
||||
umount $SCRATCH_DEV >/dev/null 2>&1
|
||||
echo "*** mkfs -dsize=$fsz" >>$seq.full
|
||||
echo "" >>$seq.full
|
||||
_scratch_mkfs_sized $fsz >>$seq.full 2>&1 \
|
||||
|| _fail "size=$fsz mkfs failed"
|
||||
run_check _scratch_mount
|
||||
# -w ensures that the only ops are ones which cause write I/O
|
||||
run_check $FSSTRESS_PROG -d $SCRATCH_MNT -w -p $procs -n 2000 \
|
||||
$FSSTRESS_AVOID
|
||||
|
||||
run_check $BTRFS_UTIL_PROG subvol snap $SCRATCH_MNT \
|
||||
$SCRATCH_MNT/$snap_name
|
||||
|
||||
run_check umount $SCRATCH_DEV >/dev/null 2>&1
|
||||
run_check _scratch_mount "-o compress=lzo"
|
||||
|
||||
# make some noise but ensure we're not touching existing data
|
||||
# extents.
|
||||
run_check $FSSTRESS_PROG -d $SCRATCH_MNT -p $procs -n 4000 \
|
||||
-z -f chown=3 -f link=1 -f mkdir=2 -f mknod=2 \
|
||||
-f rename=2 -f setxattr=1 -f symlink=2
|
||||
|
||||
clean_dir="$SCRATCH_MNT/next"
|
||||
mkdir $clean_dir
|
||||
# now make more files to get a higher tree
|
||||
run_check $FSSTRESS_PROG -d $clean_dir -w -p $procs -n 2000 \
|
||||
$FSSTRESS_AVOID
|
||||
run_check umount $SCRATCH_DEV >/dev/null 2>&1
|
||||
run_check _scratch_mount "-o atime"
|
||||
|
||||
if [ $do_bg_noise -ne 0 ]; then
|
||||
# make background noise while backrefs are being walked
|
||||
while /bin/true; do
|
||||
echo background fsstress >>$seq.full
|
||||
run_check $FSSTRESS_PROG -d $SCRATCH_MNT/bgnoise -n 999
|
||||
echo background rm >>$seq.full
|
||||
rm -rf $SCRATCH_MNT/bgnoise/
|
||||
done &
|
||||
noise_pid=`jobs -p %1`
|
||||
echo "background noise by $noise_pid" >>$seq.full
|
||||
fi
|
||||
|
||||
cnt=0
|
||||
errcnt=0
|
||||
dir="$SCRATCH_MNT/$snap_name/"
|
||||
for file in `find $dir -name f\* -size +0 | sort -R`; do
|
||||
extents=`_check_file_extents $file`
|
||||
ret=$?
|
||||
if [ $ret -ne 0 ]; then
|
||||
continue;
|
||||
fi
|
||||
for i in $extents; do
|
||||
physical=$i
|
||||
length=$i
|
||||
logical=$i
|
||||
physical=`echo $physical | sed -e 's/#.*//'`
|
||||
length=`echo $length | sed -e 's/[^#]+#//'`
|
||||
length=`echo $length | sed -e 's/#.*//'`
|
||||
logical=`echo $logical | sed -e 's/.*#//'`
|
||||
_btrfs_inspect_check $file $physical $length $logical \
|
||||
$snap_name
|
||||
ret=$?
|
||||
if [ $ret -ne 0 ]; then
|
||||
errcnt=`expr $errcnt + 1`
|
||||
fi
|
||||
done
|
||||
cnt=`expr $cnt + 1`
|
||||
if [ $cnt -ge $nfiles ]; then
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [ $errcnt -gt 0 ]; then
|
||||
_fail "test failed: $errcnt error(s)"
|
||||
fi
|
||||
}
|
||||
|
||||
echo "*** test backref walking"
|
||||
|
||||
snap_name="snap1"
|
||||
filesize=`expr 2000 \* 1024 \* 1024`
|
||||
nfiles=4
|
||||
numprocs=1
|
||||
do_bg_noise=1
|
||||
|
||||
workout $filesize $nfiles $numprocs $snap_name $do_bg_noise
|
||||
|
||||
echo "*** done"
|
||||
status=0
|
||||
exit
|
||||
@@ -0,0 +1,4 @@
|
||||
QA output created by 276
|
||||
*** test backref walking
|
||||
*** done
|
||||
*** unmount
|
||||
+170
@@ -0,0 +1,170 @@
|
||||
#! /bin/bash
|
||||
# FS QA Test No. 284
|
||||
#
|
||||
# Btrfs Online defragmentation tests
|
||||
#
|
||||
#-----------------------------------------------------------------------
|
||||
# Copyright (c) 2012 Fujitsu Liu Bo. 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`
|
||||
echo "QA output created by $seq"
|
||||
here="`pwd`"
|
||||
tmp=/tmp/$$
|
||||
cnt=11999
|
||||
filesize=48000
|
||||
|
||||
status=1 # failure is the default!
|
||||
trap "_cleanup; exit \$status" 0 1 2 3 15
|
||||
|
||||
_cleanup()
|
||||
{
|
||||
cd /
|
||||
rm -f $tmp.*
|
||||
}
|
||||
|
||||
_create_file()
|
||||
{
|
||||
if [ $1 -ne 2 ]; then
|
||||
tmpfile="$SCRATCH_MNT/tmp_file"
|
||||
else
|
||||
mkdir -p $SCRATCH_MNT/tmp_dir
|
||||
tmpfile="$SCRATCH_MNT/tmp_dir/tmp_file"
|
||||
fi
|
||||
|
||||
for i in `seq $cnt -1 0`; do
|
||||
dd if=/dev/zero of=$tmpfile bs=4k count=1 \
|
||||
conv=notrunc seek=$i oflag=sync &>/dev/null
|
||||
done
|
||||
# get md5sum
|
||||
md5sum $tmpfile > /tmp/checksum
|
||||
}
|
||||
|
||||
_btrfs_online_defrag()
|
||||
{
|
||||
str=""
|
||||
if [ "$2" = "2" ];then
|
||||
str="$str -s -1 -l $((filesize / 2)) "
|
||||
elif [ "$2" = "3" ];then
|
||||
str="$str -s $((filesize + 1)) -l $((filesize / 2)) "
|
||||
HAVE_DEFRAG=1
|
||||
elif [ "$2" = "4" ];then
|
||||
str="$str -l -1 "
|
||||
elif [ "$2" = "5" ];then
|
||||
str="$str -l $((filesize + 1)) "
|
||||
elif [ "$2" = "6" ];then
|
||||
str="$str -l $((filesize / 2)) "
|
||||
fi
|
||||
|
||||
if [ "$3" = "2" ];then
|
||||
str="$str -c "
|
||||
fi
|
||||
|
||||
if [ "$str" != "" ]; then
|
||||
btrfs filesystem defragment $str $SCRATCH_MNT/tmp_file
|
||||
else
|
||||
if [ "$1" = "1" ];then
|
||||
btrfs filesystem defragment $SCRATCH_MNT/tmp_file
|
||||
elif [ "$1" = "2" ];then
|
||||
btrfs filesystem defragment $SCRATCH_MNT/tmp_dir
|
||||
elif [ "$1" = "3" ];then
|
||||
btrfs filesystem defragment $SCRATCH_MNT
|
||||
fi
|
||||
fi
|
||||
ret_val=$?
|
||||
_scratch_remount
|
||||
if [ $ret_val -ne 20 ];then
|
||||
echo "btrfs filesystem defragment failed! err is $ret_val"
|
||||
fi
|
||||
}
|
||||
|
||||
_checksum()
|
||||
{
|
||||
md5sum -c /tmp/checksum > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "md5 checksum failed!"
|
||||
fi
|
||||
}
|
||||
|
||||
_cleanup_defrag()
|
||||
{
|
||||
umount $SCRATCH_MNT > /dev/null 2>&1
|
||||
}
|
||||
|
||||
_setup_defrag()
|
||||
{
|
||||
umount $SCRATCH_MNT > /dev/null 2>&1
|
||||
_scratch_mkfs > /dev/null 2>&1
|
||||
_scratch_mount
|
||||
_create_file $1
|
||||
}
|
||||
|
||||
_rundefrag()
|
||||
{
|
||||
_setup_defrag $1
|
||||
_btrfs_online_defrag $1 $2 $3
|
||||
_checksum
|
||||
_cleanup_defrag
|
||||
_check_scratch_fs
|
||||
}
|
||||
|
||||
# get standard environment, filters and checks
|
||||
. ./common.rc
|
||||
. ./common.filter
|
||||
. ./common.defrag
|
||||
|
||||
# real QA test starts here
|
||||
_supported_fs btrfs
|
||||
_supported_os Linux
|
||||
|
||||
_setup_testdir
|
||||
## We require scratch so that we'll have free contiguous space
|
||||
_require_scratch
|
||||
_scratch_mkfs >/dev/null 2>&1
|
||||
_scratch_mount
|
||||
_require_defrag
|
||||
|
||||
echo "defrag object | defragment range | defragment compress"
|
||||
echo "a single file | default | off"
|
||||
_rundefrag 1 1 1
|
||||
|
||||
echo "a single file | default | on"
|
||||
_rundefrag 1 1 2
|
||||
|
||||
echo "a single file | start < 0 && 0 < len < file size | off"
|
||||
_rundefrag 1 2 1
|
||||
|
||||
echo "a single file | start > file size && 0 < len < file size | off"
|
||||
_rundefrag 1 3 1
|
||||
|
||||
echo "a single file | start = 0 && len < 0 | off"
|
||||
_rundefrag 1 4 1
|
||||
|
||||
echo "a single file | start = 0 && len > file size | off"
|
||||
_rundefrag 1 5 1
|
||||
|
||||
echo "a single file | start = 0 && 0 < len < file size | off"
|
||||
_rundefrag 1 6 1
|
||||
|
||||
echo "a directory | default | off"
|
||||
_rundefrag 2 1 1
|
||||
|
||||
echo "a filesystem | default | off"
|
||||
_rundefrag 3 1 1
|
||||
|
||||
status=0
|
||||
exit
|
||||
@@ -0,0 +1,11 @@
|
||||
QA output created by 284
|
||||
defrag object | defragment range | defragment compress
|
||||
a single file | default | off
|
||||
a single file | default | on
|
||||
a single file | start < 0 && 0 < len < file size | off
|
||||
a single file | start > file size && 0 < len < file size | off
|
||||
a single file | start = 0 && len < 0 | off
|
||||
a single file | start = 0 && len > file size | off
|
||||
a single file | start = 0 && 0 < len < file size | off
|
||||
a directory | default | off
|
||||
a filesystem | default | off
|
||||
@@ -0,0 +1,94 @@
|
||||
#! /bin/bash
|
||||
# FS QA Test No. 307
|
||||
#
|
||||
# run basic btrfs information commands in various ways
|
||||
# sanity tests: filesystem show, label, sync, and device stats
|
||||
#
|
||||
#-----------------------------------------------------------------------
|
||||
# Copyright (c) 2013 Red Hat, Inc. 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`
|
||||
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
|
||||
. ./btrfs.filter
|
||||
|
||||
# real QA test starts here
|
||||
|
||||
# Modify as appropriate.
|
||||
_supported_fs btrfs
|
||||
_supported_os Linux
|
||||
_require_scratch
|
||||
_require_scratch_dev_pool
|
||||
|
||||
rm -f $seq.full
|
||||
|
||||
FIRST_POOL_DEV=`echo $SCRATCH_DEV_POOL | awk '{print $1}'`
|
||||
LAST_POOL_DEV=`echo $SCRATCH_DEV_POOL | awk '{print $NF}'`
|
||||
TOTAL_DEVS=`echo $SCRATCH_DEV $SCRATCH_DEV_POOL | wc -w`
|
||||
LABEL=TestLabel.$seq
|
||||
|
||||
echo "Scratch $SCRATCH_DEV First $FIRST_POOL_DEV last $LAST_POOL_DEV Total $TOTAL_DEVS" > $seq.full
|
||||
|
||||
_scratch_mkfs $SCRATCH_DEV_POOL >> $seq.full 2>&1 || _fail "mkfs failed"
|
||||
|
||||
# These have to be done unmounted...?
|
||||
echo "== Set filesystem label to $LABEL"
|
||||
$BTRFS_UTIL_PROG filesystem label $SCRATCH_DEV $LABEL
|
||||
echo "== Get filesystem label"
|
||||
$BTRFS_UTIL_PROG filesystem label $SCRATCH_DEV
|
||||
|
||||
echo "== Mount."
|
||||
_scratch_mount
|
||||
|
||||
echo "== Show filesystem by label"
|
||||
$BTRFS_UTIL_PROG filesystem show $LABEL | _filter_btrfs_filesystem_show $TOTAL_DEVS
|
||||
UUID=`$BTRFS_UTIL_PROG filesystem show $LABEL | grep uuid: | awk '{print $NF}'`
|
||||
|
||||
echo "UUID $UUID" >> $seq.full
|
||||
|
||||
echo "== Show filesystem by UUID"
|
||||
$BTRFS_UTIL_PROG filesystem show $UUID | _filter_btrfs_filesystem_show $TOTAL_DEVS $UUID
|
||||
|
||||
echo "== Sync filesystem"
|
||||
$BTRFS_UTIL_PROG filesystem sync $SCRATCH_MNT | _filter_scratch
|
||||
|
||||
echo "== Show device stats by mountpoint"
|
||||
$BTRFS_UTIL_PROG device stats $SCRATCH_MNT | _filter_btrfs_device_stats $TOTAL_DEVS
|
||||
echo "== Show device stats by first/scratch dev"
|
||||
$BTRFS_UTIL_PROG device stats $SCRATCH_DEV | _filter_btrfs_device_stats
|
||||
echo "== Show device stats by second dev"
|
||||
$BTRFS_UTIL_PROG device stats $FIRST_POOL_DEV | sed -e "s,$FIRST_POOL_DEV,FIRST_POOL_DEV,g"
|
||||
echo "== Show device stats by last dev"
|
||||
$BTRFS_UTIL_PROG device stats $LAST_POOL_DEV | sed -e "s,$LAST_POOL_DEV,LAST_POOL_DEV,g"
|
||||
|
||||
# success, all done
|
||||
status=0
|
||||
exit
|
||||
@@ -0,0 +1,41 @@
|
||||
== QA output created by 307
|
||||
== Set filesystem label to TestLabel.307
|
||||
== Get filesystem label
|
||||
TestLabel.307
|
||||
== Mount.
|
||||
== Show filesystem by label
|
||||
Label: 'TestLabel.307' uuid: <UUID>
|
||||
Total devices <EXACTNUM> FS bytes used <SIZE>
|
||||
devid <DEVID> size <SIZE> used <SIZE> path SCRATCH_DEV
|
||||
|
||||
== Show filesystem by UUID
|
||||
Label: 'TestLabel.307' uuid: <EXACTUUID>
|
||||
Total devices <EXACTNUM> FS bytes used <SIZE>
|
||||
devid <DEVID> size <SIZE> used <SIZE> path SCRATCH_DEV
|
||||
|
||||
== Sync filesystem
|
||||
FSSync 'SCRATCH_MNT'
|
||||
== Show device stats by mountpoint
|
||||
<NUMDEVS> [SCRATCH_DEV].corruption_errs <NUM>
|
||||
<NUMDEVS> [SCRATCH_DEV].flush_io_errs <NUM>
|
||||
<NUMDEVS> [SCRATCH_DEV].generation_errs <NUM>
|
||||
<NUMDEVS> [SCRATCH_DEV].read_io_errs <NUM>
|
||||
<NUMDEVS> [SCRATCH_DEV].write_io_errs <NUM>
|
||||
== Show device stats by first/scratch dev
|
||||
[SCRATCH_DEV].corruption_errs <NUM>
|
||||
[SCRATCH_DEV].flush_io_errs <NUM>
|
||||
[SCRATCH_DEV].generation_errs <NUM>
|
||||
[SCRATCH_DEV].read_io_errs <NUM>
|
||||
[SCRATCH_DEV].write_io_errs <NUM>
|
||||
== Show device stats by second dev
|
||||
[FIRST_POOL_DEV].write_io_errs 0
|
||||
[FIRST_POOL_DEV].read_io_errs 0
|
||||
[FIRST_POOL_DEV].flush_io_errs 0
|
||||
[FIRST_POOL_DEV].corruption_errs 0
|
||||
[FIRST_POOL_DEV].generation_errs 0
|
||||
== Show device stats by last dev
|
||||
[LAST_POOL_DEV].write_io_errs 0
|
||||
[LAST_POOL_DEV].read_io_errs 0
|
||||
[LAST_POOL_DEV].flush_io_errs 0
|
||||
[LAST_POOL_DEV].corruption_errs 0
|
||||
[LAST_POOL_DEV].generation_errs 0
|
||||
@@ -0,0 +1,11 @@
|
||||
# QA groups control file
|
||||
# Defines test groups and nominal group owners
|
||||
# - do not start group names with a digit
|
||||
# - comment line before each group is "new" description
|
||||
#
|
||||
254 auto quick
|
||||
264 auto
|
||||
265 auto
|
||||
276 auto rw metadata
|
||||
284 auto
|
||||
307 auto quick
|
||||
Executable
+66
@@ -0,0 +1,66 @@
|
||||
#! /bin/bash
|
||||
# FSQA Test No. 271
|
||||
#
|
||||
# Regression testcase for d583fb87a3ff0 (ext4 extent corruption)
|
||||
#
|
||||
#-----------------------------------------------------------------------
|
||||
# Copyright (c) 2006 Silicon Graphics, Inc. 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`
|
||||
echo "QA output created by $seq"
|
||||
|
||||
here=`pwd`
|
||||
tmp=/tmp/$$
|
||||
status=1 # failure is the default!
|
||||
trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
|
||||
|
||||
# get standard environment, filters and checks
|
||||
. ./common.rc
|
||||
. ./common.filter
|
||||
|
||||
# real QA test starts here
|
||||
_supported_fs ext4
|
||||
_supported_os Linux
|
||||
_need_to_be_root
|
||||
_require_scratch
|
||||
|
||||
_scratch_mkfs_sized $((128 * 1024 * 1024)) >> $seq.full 2>&1
|
||||
|
||||
# -onoload and EXT4_SYNC_FL on file is important becase result in
|
||||
# metadata sync writes inside ext4_handle_dirty_metadata()
|
||||
_scratch_mount -onoload
|
||||
touch $SCRATCH_MNT/file
|
||||
chattr +S $SCRATCH_MNT/file
|
||||
# Create sparse file
|
||||
for ((i = 0; i < 21; i++))
|
||||
do
|
||||
dd if=/dev/zero of=$SCRATCH_MNT/file bs=4k count=1 seek=$((i*10))
|
||||
done
|
||||
# truncate last extent
|
||||
$XFS_IO_PROG -F -f -c "truncate $((4096*200))" $SCRATCH_MNT/file
|
||||
|
||||
if ! _scratch_unmount; then
|
||||
echo "failed to umount"
|
||||
status=1
|
||||
exit
|
||||
fi
|
||||
echo "Check filesystem"
|
||||
_check_scratch_fs
|
||||
status=$?
|
||||
exit
|
||||
@@ -0,0 +1,44 @@
|
||||
QA output created by 271
|
||||
1+0 records in
|
||||
1+0 records out
|
||||
1+0 records in
|
||||
1+0 records out
|
||||
1+0 records in
|
||||
1+0 records out
|
||||
1+0 records in
|
||||
1+0 records out
|
||||
1+0 records in
|
||||
1+0 records out
|
||||
1+0 records in
|
||||
1+0 records out
|
||||
1+0 records in
|
||||
1+0 records out
|
||||
1+0 records in
|
||||
1+0 records out
|
||||
1+0 records in
|
||||
1+0 records out
|
||||
1+0 records in
|
||||
1+0 records out
|
||||
1+0 records in
|
||||
1+0 records out
|
||||
1+0 records in
|
||||
1+0 records out
|
||||
1+0 records in
|
||||
1+0 records out
|
||||
1+0 records in
|
||||
1+0 records out
|
||||
1+0 records in
|
||||
1+0 records out
|
||||
1+0 records in
|
||||
1+0 records out
|
||||
1+0 records in
|
||||
1+0 records out
|
||||
1+0 records in
|
||||
1+0 records out
|
||||
1+0 records in
|
||||
1+0 records out
|
||||
1+0 records in
|
||||
1+0 records out
|
||||
1+0 records in
|
||||
1+0 records out
|
||||
Check filesystem
|
||||
+124
@@ -0,0 +1,124 @@
|
||||
#! /bin/bash
|
||||
# FSQA Test No. 301
|
||||
#
|
||||
# Ext4 defragmentation stress test
|
||||
# Defragment file while other task does direct io
|
||||
#-----------------------------------------------------------------------
|
||||
# (c) 2013 Dmitry Monakhov
|
||||
#
|
||||
# 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`
|
||||
echo "QA output created by $seq"
|
||||
|
||||
here=`pwd`
|
||||
tmp=/tmp/$$
|
||||
status=1 # failure is the default!
|
||||
trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
|
||||
|
||||
# get standard environment, filters and checks
|
||||
. ./common.rc
|
||||
. ./common.filter
|
||||
. ./common.defrag
|
||||
|
||||
# real QA test starts here
|
||||
_supported_os Linux
|
||||
_supported_fs ext4
|
||||
_need_to_be_root
|
||||
_require_scratch
|
||||
_require_defrag
|
||||
|
||||
NUM_JOBS=$((4*LOAD_FACTOR))
|
||||
BLK_DEV_SIZE=`blockdev --getsz $SCRATCH_DEV`
|
||||
# We need space for 2 files (test file, and donor one)
|
||||
# reserve 30% in order to avoid ENOSPC
|
||||
FILE_SIZE=$((BLK_DEV_SIZE * (512 / (2 + 1))))
|
||||
|
||||
cat >$tmp-$seq.fio <<EOF
|
||||
# Common e4defrag regression tests
|
||||
[global]
|
||||
ioengine=ioe_e4defrag
|
||||
iodepth=1
|
||||
directory=${SCRATCH_MNT}
|
||||
filesize=${FILE_SIZE}
|
||||
size=999G
|
||||
buffered=0
|
||||
fadvise_hint=0
|
||||
group_reporting
|
||||
|
||||
#################################
|
||||
# Test1
|
||||
# Defragment file while other task does direct io
|
||||
|
||||
# Continious sequential defrag activity
|
||||
[defrag-4k]
|
||||
ioengine=e4defrag
|
||||
iodepth=1
|
||||
bs=128k
|
||||
donorname=test1.def
|
||||
filename=test1
|
||||
inplace=0
|
||||
rw=write
|
||||
numjobs=${NUM_JOBS}
|
||||
runtime=30*${TIME_FACTOR}
|
||||
time_based
|
||||
|
||||
# Verifier
|
||||
[aio-dio-verifier]
|
||||
ioengine=libaio
|
||||
iodepth=128*${LOAD_FACTOR}
|
||||
numjobs=1
|
||||
verify=crc32c-intel
|
||||
verify_fatal=1
|
||||
verify_dump=1
|
||||
verify_backlog=1024
|
||||
verify_async=1
|
||||
verifysort=1
|
||||
direct=1
|
||||
bs=64k
|
||||
rw=randwrite
|
||||
filename=test1
|
||||
runtime=30*${TIME_FACTOR}
|
||||
time_based
|
||||
EOF
|
||||
|
||||
_workout()
|
||||
{
|
||||
echo ""
|
||||
echo " Start defragment activity"
|
||||
echo ""
|
||||
cat $tmp-$seq.fio >> $seq.full
|
||||
run_check $FIO_PROG $tmp-$seq.fio
|
||||
}
|
||||
|
||||
_require_fio $tmp-$seq.fio
|
||||
|
||||
_scratch_mkfs >> $seq.full 2>&1
|
||||
_scratch_mount
|
||||
|
||||
if ! _workout; then
|
||||
umount $SCRATCH_DEV 2>/dev/null
|
||||
exit
|
||||
fi
|
||||
|
||||
if ! _scratch_unmount; then
|
||||
echo "failed to umount"
|
||||
status=1
|
||||
exit
|
||||
fi
|
||||
_check_scratch_fs
|
||||
status=$?
|
||||
@@ -0,0 +1,4 @@
|
||||
QA output created by 301
|
||||
|
||||
Start defragment activity
|
||||
|
||||
+141
@@ -0,0 +1,141 @@
|
||||
#! /bin/bash
|
||||
# FSQA Test No. 302
|
||||
#
|
||||
# Ext4 defragmentation stress test
|
||||
# Perform defragmentation on file under buffered io
|
||||
# while third task does direct io to donor file
|
||||
#-----------------------------------------------------------------------
|
||||
# (c) 2013 Dmitry Monakhov
|
||||
#
|
||||
# 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`
|
||||
echo "QA output created by $seq"
|
||||
|
||||
here=`pwd`
|
||||
tmp=/tmp/$$
|
||||
status=1 # failure is the default!
|
||||
trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
|
||||
|
||||
# get standard environment, filters and checks
|
||||
. ./common.rc
|
||||
. ./common.filter
|
||||
. ./common.defrag
|
||||
|
||||
# real QA test starts here
|
||||
_supported_os Linux
|
||||
_supported_fs ext4
|
||||
_need_to_be_root
|
||||
_require_scratch
|
||||
_require_defrag
|
||||
|
||||
BLK_DEV_SIZE=`blockdev --getsz $SCRATCH_DEV`
|
||||
# We need space for 2 files (test file, and donor one)
|
||||
# reserve 30% in order to avoid ENOSPC
|
||||
FILE_SIZE=$((BLK_DEV_SIZE * (512 / (2 + 1))))
|
||||
|
||||
cat >$tmp-$seq.fio <<EOF
|
||||
# Common e4defrag regression tests
|
||||
[global]
|
||||
ioengine=ioe_e4defrag
|
||||
iodepth=1
|
||||
directory=${SCRATCH_MNT}
|
||||
filesize=${FILE_SIZE}
|
||||
size=999G
|
||||
buffered=0
|
||||
fadvise_hint=0
|
||||
group_reporting
|
||||
|
||||
##########################################
|
||||
# Test2
|
||||
# Perform defragmentation on file under buffered io
|
||||
# while third task does direct io to donor file
|
||||
#
|
||||
# Continuous sequential defrag activity
|
||||
[defrag-4k]
|
||||
stonewall
|
||||
ioengine=e4defrag
|
||||
iodepth=1
|
||||
bs=128k
|
||||
donorname=test2.def
|
||||
filename=test2
|
||||
inplace=0
|
||||
rw=write
|
||||
numjobs=${LOAD_FACTOR}
|
||||
runtime=30*${TIME_FACTOR}
|
||||
time_based
|
||||
|
||||
# Run DIO/AIO for donor file
|
||||
[donor-file-fuzzer]
|
||||
ioengine=libaio
|
||||
iodepth=128*${LOAD_FACTOR}
|
||||
numjobs=${LOAD_FACTOR}
|
||||
verify=0
|
||||
direct=1
|
||||
bs=64k
|
||||
rw=randwrite
|
||||
filename=test2.def
|
||||
runtime=30*${TIME_FACTOR}
|
||||
time_based
|
||||
|
||||
# Verifier thread
|
||||
[aio-dio-verifier]
|
||||
ioengine=libaio
|
||||
iodepth=128*${LOAD_FACTOR}
|
||||
numjobs=1
|
||||
verify=crc32c-intel
|
||||
verify_fatal=1
|
||||
verify_dump=1
|
||||
verify_backlog=1024
|
||||
verify_async=1
|
||||
verifysort=1
|
||||
buffered=1
|
||||
bs=64k
|
||||
rw=randrw
|
||||
filename=test2
|
||||
runtime=30*${TIME_FACTOR}
|
||||
time_based
|
||||
|
||||
EOF
|
||||
|
||||
_workout()
|
||||
{
|
||||
echo ""
|
||||
echo " Start defragment activity"
|
||||
echo ""
|
||||
cat $tmp-$seq.fio >> $seq.full
|
||||
run_check $FIO_PROG $tmp-$seq.fio
|
||||
}
|
||||
|
||||
_require_fio $tmp-$seq.fio
|
||||
|
||||
_scratch_mkfs >> $seq.full 2>&1
|
||||
_scratch_mount
|
||||
|
||||
if ! _workout; then
|
||||
umount $SCRATCH_DEV 2>/dev/null
|
||||
exit
|
||||
fi
|
||||
|
||||
if ! _scratch_unmount; then
|
||||
echo "failed to umount"
|
||||
status=1
|
||||
exit
|
||||
fi
|
||||
_check_scratch_fs
|
||||
status=$?
|
||||
exit
|
||||
@@ -0,0 +1,4 @@
|
||||
QA output created by 302
|
||||
|
||||
Start defragment activity
|
||||
|
||||
+151
@@ -0,0 +1,151 @@
|
||||
#! /bin/bash
|
||||
# FSQA Test No. 303
|
||||
#
|
||||
# Ext4 defragmentation stress test
|
||||
# Two defrag tasks use common donor file
|
||||
#
|
||||
#-----------------------------------------------------------------------
|
||||
# (c) 2013 Dmitry Monakhov
|
||||
#
|
||||
# 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`
|
||||
echo "QA output created by $seq"
|
||||
|
||||
here=`pwd`
|
||||
tmp=/tmp/$$
|
||||
status=1 # failure is the default!
|
||||
trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
|
||||
|
||||
# get standard environment, filters and checks
|
||||
. ./common.rc
|
||||
. ./common.filter
|
||||
. ./common.defrag
|
||||
|
||||
# real QA test starts here
|
||||
_supported_os Linux
|
||||
_supported_fs ext4
|
||||
_need_to_be_root
|
||||
_require_scratch
|
||||
_require_defrag
|
||||
|
||||
BLK_DEV_SIZE=`blockdev --getsz $SCRATCH_DEV`
|
||||
# We need space for 3 files (one donor file and two test files)
|
||||
# Reserve space for 4 files in order to avoid ENOSPC
|
||||
FILE_SIZE=$((BLK_DEV_SIZE * (512 / (3+1))))
|
||||
|
||||
cat >$tmp-$seq.fio <<EOF
|
||||
# Common e4defrag regression tests
|
||||
[global]
|
||||
ioengine=ioe_e4defrag
|
||||
iodepth=1
|
||||
directory=${SCRATCH_MNT}
|
||||
filesize=${FILE_SIZE}
|
||||
size=999G
|
||||
buffered=0
|
||||
fadvise_hint=0
|
||||
group_reporting
|
||||
|
||||
#################################
|
||||
# Test3
|
||||
# Two defrag tasks use common donor file
|
||||
[defrag-1]
|
||||
ioengine=e4defrag
|
||||
iodepth=1
|
||||
bs=128k
|
||||
donorname=test3.def
|
||||
filename=test31
|
||||
inplace=0
|
||||
rw=write
|
||||
numjobs=${LOAD_FACTOR}
|
||||
runtime=30*${TIME_FACTOR}
|
||||
time_based
|
||||
|
||||
[defrag-2]
|
||||
ioengine=e4defrag
|
||||
iodepth=1
|
||||
bs=128k
|
||||
donorname=test3.def
|
||||
filename=test32
|
||||
inplace=0
|
||||
rw=write
|
||||
numjobs=${LOAD_FACTOR}
|
||||
runtime=30*${TIME_FACTOR}
|
||||
time_based
|
||||
|
||||
[aio-dio-verifier-1]
|
||||
ioengine=libaio
|
||||
iodepth=128*${LOAD_FACTOR}
|
||||
numjobs=1
|
||||
verify=crc32c-intel
|
||||
verify_fatal=1
|
||||
verify_dump=1
|
||||
verify_backlog=1024
|
||||
verify_async=1
|
||||
verifysort=1
|
||||
direct=1
|
||||
bs=64k
|
||||
rw=write
|
||||
filename=test31
|
||||
runtime=30*${TIME_FACTOR}
|
||||
time_based
|
||||
|
||||
[aio-buffer-verifier-2]
|
||||
ioengine=libaio
|
||||
numjobs=1
|
||||
verify=crc32c-intel
|
||||
verify_fatal=1
|
||||
verify_dump=1
|
||||
verify_backlog=1024
|
||||
verify_async=1
|
||||
verifysort=1
|
||||
buffered=1
|
||||
bs=64k
|
||||
rw=randrw
|
||||
filename=test32
|
||||
runtime=30*${TIME_FACTOR}
|
||||
time_based
|
||||
|
||||
EOF
|
||||
|
||||
_workout()
|
||||
{
|
||||
echo ""
|
||||
echo " Start defragment activity"
|
||||
echo ""
|
||||
cat $tmp-$seq.fio >> $seq.full
|
||||
run_check $FIO_PROG $tmp-$seq.fio
|
||||
}
|
||||
|
||||
_require_fio $tmp-$seq.fio
|
||||
|
||||
_scratch_mkfs >> $seq.full 2>&1
|
||||
_scratch_mount
|
||||
|
||||
if ! _workout; then
|
||||
umount $SCRATCH_DEV 2>/dev/null
|
||||
exit
|
||||
fi
|
||||
|
||||
if ! _scratch_unmount; then
|
||||
echo "failed to umount"
|
||||
status=1
|
||||
exit
|
||||
fi
|
||||
_check_scratch_fs
|
||||
status=$?
|
||||
exit
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user