4 # Test concurrent copy up
6 #-----------------------------------------------------------------------
7 # Copyright (C) 2016 CTERA Networks. All Rights Reserved.
8 # Author: Amir Goldstein <amir73il@gmail.com>
10 # This program is free software; you can redistribute it and/or
11 # modify it under the terms of the GNU General Public License as
12 # published by the Free Software Foundation.
14 # This program is distributed in the hope that it would be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 # GNU General Public License for more details.
19 # You should have received a copy of the GNU General Public License
20 # along with this program; if not, write the Free Software Foundation,
21 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 #-----------------------------------------------------------------------
26 seqres=$RESULT_DIR/$seq
27 echo "QA output created by $seq"
31 status=1 # failure is the default!
32 trap "_cleanup; exit \$status" 0 1 2 3 15
40 # get standard environment, filters and checks
44 # remove previous $seqres.full before test
47 # real QA test starts here
52 # Remove all files from previous tests
55 # overlay copy_up doesn't deal with sparse file well, holes will be filled by
56 # zeros, so for the worst case of hitting all the copy up bomb files, we need
57 # (64*(16+32+64+128)M) free space on $SCRATCH_DEV.
58 # However, triggering more than a total of 16 copy up bombs would require
59 # really fast data copy (clone up doesn't take up space at all), so let's be
60 # conservative and reserve space for 16 data copy ups per directory.
61 _require_fs_space $SCRATCH_DEV $((16*(16+32+64+128)*1024))
63 lowerdir=$SCRATCH_DEV/$OVL_LOWER
67 d_low=$lowerdir/$testdir
70 # Create 4K empty files in 4 directories
71 echo $FSSTRESS_PROG -d $d_low -p 4 -z -f creat=1 -n 1024 -v >> $seqres.full
72 $FSSTRESS_PROG -d $d_low -p 4 -z -f creat=1 -n 1024 -v >> $seqres.full 2>&1
73 echo "--------------------------------------" >> $seqres.full
74 echo "Created 1K files in lower directory. " >> $seqres.full
76 # Plant 64 copy up bombs in each directory
77 for f in $d_low/p0/*0; do $XFS_IO_PROG -c "truncate 128m" $f ;done
78 for f in $d_low/p1/*4; do $XFS_IO_PROG -c "truncate 64m" $f ;done
79 for f in $d_low/p2/*8; do $XFS_IO_PROG -c "truncate 32m" $f ;done
80 for f in $d_low/p3/*b; do $XFS_IO_PROG -c "truncate 16m" $f ;done
81 echo "Created 64*4 copy up bombs. " >> $seqres.full
82 echo "--------------------------------------" >> $seqres.full
86 d_top=$SCRATCH_MNT/$testdir
89 # Run 2 process teams - 4 pairs of rival processes
90 # Each process pair competing on copy up of 1K files in 1 directory.
91 # Team 'touch' players touch all files in readdir order.
92 # Team 'truncate' players truncates all files in numeric (name) order.
94 # If player from team 'touch' reaches a copy up bomb before player
95 # from team 'truncate' does, the copy up of (sparse) data will delay
96 # the end of the process pair match.
98 # If copy up of bomb is not concurrent with other copy ups, then
99 # 'touch' player p0 with the largest copy up bombs will delay players
100 # of both teams and all matches will take longer.
102 # If copy up is concurrent with copy ups in different directories,
103 # process pair 3 match will be over first and process pair 0 match
106 # If copy up of data is concurrent with other copy ups on the same directory,
107 # then all the 'touch' team players will finish far behind their 'truncate'
110 # This test doesn't verify any of those conditions, it will only fail
111 # on unexpected errors of any of the touch/truncate operations.
112 # The test full output should demonstrate the expected game results,
113 # as described above and depending on concurrent copy up support in kernel.
116 echo "--------------------------------------" >> $seqres.full
117 echo "Go team touch!! " >> $seqres.full
118 find p0 -type f -print -exec touch {} \; >> $seqres.full &
119 find p1 -type f -print -exec touch {} \; >> $seqres.full &
120 find p2 -type f -print -exec touch {} \; >> $seqres.full &
121 find p3 -type f -print -exec touch {} \; >> $seqres.full &
124 echo "--------------------------------------" >> $seqres.full
125 echo "Go team truncate!! " >> $seqres.full
126 # Give team 'touch' a 1 second head start.
127 # Team 'truncate' players should catch up after few copy up bombs.
129 $FSSTRESS_PROG -d $d_top -p 4 -z -f creat=1 -n 1024 -v >> $seqres.full &
133 echo "Silence is golden"