mirror of
https://github.com/linux-apfs/apfstests.git
synced 2026-05-01 15:01:44 -07:00
generic: add new defragment test
Check defrag utility on file with large number of fragments, from 20 to 2000. 2000 fragments means that b+tree will have at least two index blocks. Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
This commit is contained in:
committed by
Dave Chinner
parent
2f87a77e0f
commit
5eedd36a03
@@ -0,0 +1,81 @@
|
||||
#! /bin/bash
|
||||
# FS QA Test No. generic/324
|
||||
#
|
||||
# Sanity check for defrag utility.
|
||||
#
|
||||
#-----------------------------------------------------------------------
|
||||
# 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`
|
||||
seqres=$RESULT_DIR/$seq
|
||||
echo "QA output created by $seq"
|
||||
|
||||
PIDS=""
|
||||
tmp=/tmp/$$
|
||||
status=1 # failure is the default!
|
||||
trap "_cleanup; exit \$status" 0 1 2 3 15
|
||||
|
||||
_cleanup()
|
||||
{
|
||||
rm -f $tmp.*
|
||||
}
|
||||
|
||||
# get standard environment, filters and checks
|
||||
. ./common/rc
|
||||
. ./common/filter
|
||||
. ./common/defrag
|
||||
|
||||
# real QA test starts here
|
||||
_supported_os Linux
|
||||
_need_to_be_root
|
||||
_require_scratch
|
||||
_require_defrag
|
||||
|
||||
rm -f $seqres.full
|
||||
|
||||
_workout()
|
||||
{
|
||||
nr=$1
|
||||
echo "Defragment file with $nr * 2 fragments"
|
||||
# Create sparse file
|
||||
for ((i=0;i<nr;i++))
|
||||
do
|
||||
$XFS_IO_PROG -f -c "falloc $((409600*i)) 4k" \
|
||||
$SCRATCH_MNT/test.$nr >> $seqres.full 2>&1
|
||||
done
|
||||
# Fill holes for half of range , as result file will contain nr*1.5 fragments
|
||||
$XFS_IO_PROG -c "falloc 0 $((204800*nr))" \
|
||||
$SCRATCH_MNT/test.$nr | _filter_xfs_io
|
||||
# Data wrilte will convert extetns to inialized ones
|
||||
for ((i=0;i<nr;i++))
|
||||
do
|
||||
patt=`printf "0x%x" $i`
|
||||
$XFS_IO_PROG -c "pwrite -S $patt $((i*123400)) 1234" \
|
||||
$SCRATCH_MNT/test.$nr | _filter_xfs_io
|
||||
done
|
||||
_defrag --min_before $nr --max_before $((nr*4)) \
|
||||
--min_after 1 $SCRATCH_MNT/test.$nr
|
||||
}
|
||||
|
||||
|
||||
# Actual testing starting from here
|
||||
_scratch_mkfs >> $seqres.full 2>&1
|
||||
_scratch_mount
|
||||
_workout 10
|
||||
_workout 250
|
||||
_workout 1000
|
||||
status=0
|
||||
File diff suppressed because it is too large
Load Diff
@@ -143,3 +143,4 @@
|
||||
321 auto quick metadata log
|
||||
322 auto quick metadata log
|
||||
323 auto aio stress
|
||||
324 auto fsr quick
|
||||
|
||||
Reference in New Issue
Block a user