fsx: increase number of logged operations
[xfstests-dev.git] / common / punch
1 ##/bin/bash
2 #
3 # Copyright (c) 2007 Silicon Graphics, Inc.  All Rights Reserved.
4 #
5 # This program is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU General Public License as
7 # published by the Free Software Foundation.
8 #
9 # This program is distributed in the hope that it would be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write the Free Software Foundation,
16 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
17 #
18 #
19 # common functions for excersizing hole punches with extent size hints etc.
20
21 # source dmap_scratch_mount etc.
22 . ./common/dmapi
23
24 _spawn_test_file() {
25         echo "# spawning test file with $*"
26         local blksize=$1
27         local file_size=`expr $2 \* $blksize`
28         local extent_size_hint=`expr $3 \* $blksize`
29         local test_file=$4
30         local reserve_space=$5
31
32         if [ $extent_size_hint -ne 0 ]; then
33                 echo "+ setting extent size hint to $extent_size_hint"
34                 $XFS_IO_PROG -f \
35                 -c "extsize $extent_size_hint" \
36                 $test_file
37         fi
38         # print extent size hint for $test_file
39         $XFS_IO_PROG -f \
40         -c "extsize" \
41         $test_file
42
43         if [ "$reserve_space" == "noresv" ]; then
44                 echo "+ not using resvsp at file creation"
45                 $XFS_IO_PROG -f \
46                 -c "truncate $file_size" \
47                 $test_file
48         else
49                 $XFS_IO_PROG -f \
50                 -c "truncate $file_size" \
51                 -c "resvsp 0 $file_size" \
52                 $test_file
53         fi
54 }
55
56 _do_punch() {
57         echo "# punching with $*"
58         # punch or bite the ear off $test_file to create a hole
59         local blksize=$1
60         local punch_offset=`expr $2 \* $blksize`
61         local punch_size=`expr $3 \* $blksize`
62         local punch_type=$4             # u for unresvsp, d for dm_punch
63         local test_file=$5
64
65         if [ "$punch_type" == "u" ]; then
66                 echo "+ hole punch using unresvsp"
67                 $XFS_IO_PROG -f \
68                 -c "unresvsp $punch_offset $punch_size" \
69                 $test_file
70         fi
71         if [ "$punch_type" == "d" ]; then
72                 echo "+ hole punch using dmapi punch_hole"
73                 ${DMAPI_QASUITE1_DIR}cmd/punch_hole -o $punch_offset -l $punch_size \
74                         ${SCRATCH_MNT}/$test_file
75         fi
76 }
77
78 _do_write() {
79         echo "# writing with $*"
80         local blksize=$1
81         local write_offset=`expr $2 \* $blksize`
82         local write_size=`expr $3 \* $blksize`
83         local test_file=$4
84
85         $XFS_IO_PROG -f \
86         -c "pwrite $write_offset $write_size" \
87         $test_file >/dev/null
88 }
89
90 _do_bmap() {
91         echo "# showing file state $*"
92         local test_file=$1
93
94         $XFS_IO_PROG -f \
95         -c "bmap -vvp" \
96         $test_file
97 }
98
99 _test_punch() {
100         echo "# testing $* ..."
101         local blksize=$1
102         # all points and sizes below are in terms of filesystem blocks
103         local extsize_hint_blks=$2              # extent size hint in FS blocks, 0=do not set
104         local file_size_blks=$3                 # the file size in blocks
105         local punch_points_blks=( $4 )  # array of places to punch holes in the file
106         local punch_sizes_blks=( $5 )   # array of size of each punch in blocks
107         local punch_types=( $6  )               # array of u=unresvsp or d=dm_punch
108         local write_points_blks=( $7 )  # array of places to pwrite in the file
109         local write_sizes_blks=( $8 )   # array of size of each write
110
111         local punch_write_order=( $9 )  # array of punch/write operation order
112                                                                         # e.g. "w p w w p" means: do 1st write...
113                                                                         # then 1st punch, 2nd & 3rd write, 2nd punch
114         local resvsp=${10}                              # if "noresv" then don't resvsp on file create
115         local filename=punch_test_file
116
117         cd /
118         umount $SCRATCH_MNT >/dev/null 2>&1
119
120         _scratch_mkfs_xfs -bsize=$blksize >/dev/null 2>&1 \
121                 || _fail "mkfs failed"
122
123         local this_punch_type=""
124         local dmap_punch_used=0
125         for this_punch_type in "${punch_types[@]}"; do
126                 [ "$this_punch_type" == "d" ] && dmap_punch_used=1
127         done
128         if [ $dmap_punch_used -ne 0 ]; then
129                 # a punch type of dm_punch has been specified, do a dmapi mount
130                 echo "+ mounting with dmapi enabled"
131                 _dmapi_scratch_mount
132         else
133                 # only unresvsp punch type is used, just do a normal mount
134                 _scratch_mount || _fail "mount failed"
135         fi
136
137         cd $SCRATCH_MNT
138
139         # check a size is specified for each punch
140         [ ${#punch_points_blks[*]} -eq ${#punch_sizes_blks[*]} ] \
141                 || _fail "num punch points given does not equal num punch sizes"
142
143         # check a type is specified for each punch
144         [ ${#punch_points_blks[*]} -eq ${#punch_types[*]} ] \
145                 || _fail "num punch points given does not equal num punch types"
146
147         # check a size is specified for each write
148         [ ${#write_points_blks[*]} -eq ${#write_sizes_blks[*]} ] \
149                 || _fail "num write points given does not equal num write sizes"
150
151         # check punch_write_order operations match number of punches + writes
152         local total_pw_operations=`expr ${#punch_points_blks[*]} + ${#write_points_blks[*]}`
153         [ $total_pw_operations -eq ${#punch_write_order[*]} ] \
154                 || _fail "punch_write_order ops doesn't match number of punches + writes"
155
156         # create the file and setup extent size hint
157         _spawn_test_file $blksize $file_size_blks $extsize_hint_blks $filename $resvsp
158
159         # do the writes and punches
160         local operation=""
161         local punch_index=0
162         local write_index=0
163         for operation in "${punch_write_order[@]}"; do
164                 if [ "$operation" == "p" ]; then
165                         _do_punch $blksize ${punch_points_blks[$punch_index]} \
166                                 ${punch_sizes_blks[$punch_index]} ${punch_types[$punch_index]} \
167                                 $filename
168                         punch_index=`expr $punch_index + 1`
169                 fi
170                 if [ "$operation" == "w" ]; then
171                         _do_write $blksize ${write_points_blks[$write_index]} \
172                                 ${write_sizes_blks[$write_index]} $filename
173                         write_index=`expr $write_index + 1`
174                 fi
175                 sync
176                 _do_bmap $filename              # print out the state of the file
177         done
178 }
179
180 _coalesce_extents()
181 {
182         awk -F: '
183         {
184                 range = $2;
185                 type = $3;
186
187                 split(range, bounds, "[\\[ \\.\\]]");
188                 low = bounds[3];
189                 high = bounds[5];
190
191                 if (type != prev_type) {
192                         if (prev_type != "")
193                                 printf("%u]:%s\n", low - 1, prev_type);
194                         printf("%u: [%u..", out_count++, low);
195                         prev_type = type;
196                 }
197         }
198         END {
199                 if (prev_type != "")
200                         printf("%u]:%s\n", high, prev_type);
201         }'
202 }
203
204 _filter_fiemap()
205 {
206         awk --posix '
207                 $3 ~ /hole/ {
208                         print $1, $2, $3;
209                         next;
210                 }
211                 $5 ~ /0x[[:xdigit:]]*8[[:xdigit:]]{2}/ {
212                         print $1, $2, "unwritten";
213                         next;
214                 }
215                 $5 ~ /0x[[:xdigit:]]+/ {
216                         print $1, $2, "data";
217                 }' |
218         _coalesce_extents
219 }
220
221 # Filters fiemap output to only print the 
222 # file offset column and whether or not
223 # it is an extent or a hole
224 _filter_hole_fiemap()
225 {
226         awk --posix '
227                 $3 ~ /hole/ {
228                         print $1, $2, $3; 
229                         next;
230                 }   
231                 $5 ~ /0x[[:xdigit:]]+/ {
232                         print $1, $2, "extent";
233                 }' |
234         _coalesce_extents
235 }
236
237 _filter_bmap()
238 {
239         awk '
240                 $3 ~ /hole/ {
241                         print $1, $2, $3;
242                         next;
243                 }
244                 $7 ~ /10000/ {
245                         print $1, $2, "unwritten";
246                         next;
247                 }
248                 $7 ~ /00000/ {
249                         print $1, $2, "data"
250                 }' |
251         _coalesce_extents
252 }
253
254 die_now()
255 {
256         status=1
257         exit
258 }
259
260 # test the different corner cases for zeroing a range:
261 #
262 #       1. into a hole
263 #       2. into allocated space
264 #       3. into unwritten space
265 #       4. hole -> data
266 #       5. hole -> unwritten
267 #       6. data -> hole
268 #       7. data -> unwritten
269 #       8. unwritten -> hole
270 #       9. unwritten -> data
271 #       10. hole -> data -> hole
272 #       11. data -> hole -> data
273 #       12. unwritten -> data -> unwritten
274 #       13. data -> unwritten -> data
275 #       14. data -> hole @ EOF
276 #       15. data -> hole @ 0
277 #       16. data -> cache cold ->hole
278 #       17. data -> hole in single block file
279 #
280 # Test file is removed, created and sync'd between tests.
281 #
282 # Use -k flag to keep the file between tests.  This will
283 # test the handling of pre-existing holes.
284 #
285 # Use the -d flag to not sync the file between tests.
286 # This will test the handling of delayed extents
287 #
288 # Use the -u flag to not run unwritten tests.
289 # This will eliminate some unnecessary information.
290 #
291 _test_generic_punch()
292 {
293
294         remove_testfile=1
295         sync_cmd="-c fsync"
296         unwritten_tests=1
297         OPTIND=1
298         while getopts 'dku' OPTION
299         do
300                 case $OPTION in
301                 k)      remove_testfile=
302                 ;;
303                 d)      sync_cmd=
304                 ;;
305                 u)      unwritten_tests=
306                 ;;
307                 ?)      echo Invalid flag
308                 exit 1
309                 ;;
310                 esac
311         done
312         shift $(($OPTIND - 1))
313
314         alloc_cmd=$1
315         punch_cmd=$2
316         zero_cmd=$3     #if not testing zero just set to punch
317         map_cmd=$4
318         filter_cmd=$5
319         testfile=$6
320         multiple=1
321
322         #
323         # If we are testing collapse range, we increare all the offsets of this
324         # test by a factor of 4. We do this because unlike punch, collapse
325         # range also decreases the size of file hence require bigger offsets.
326         #
327         if [ "$zero_cmd" == "fcollapse" ]; then
328                 multiple=4
329         fi
330
331         _4k="$((multiple * 4))k"
332         _8k="$((multiple * 8))k"
333         _12k="$((multiple * 12))k"
334         _20k="$((multiple * 20))k"
335
336         # initial test state must be defined, otherwise the first test can fail
337         # due ot stale file state left from previous tests.
338         rm -f $testfile
339
340         echo "  1. into a hole"
341         $XFS_IO_PROG -f -c "truncate $_20k" \
342                 -c "$zero_cmd $_4k $_8k" \
343                 -c "$map_cmd -v" $testfile | $filter_cmd
344         [ $? -ne 0 ] && die_now
345         _md5_checksum $testfile
346
347         echo "  2. into allocated space"
348         if [ "$remove_testfile" ]; then
349                 rm -f $testfile
350         fi
351         $XFS_IO_PROG -f -c "truncate $_20k" \
352                 -c "pwrite 0 $_20k" $sync_cmd \
353                 -c "$zero_cmd $_4k $_8k" \
354                 -c "$map_cmd -v" $testfile | $filter_cmd
355         [ $? -ne 0 ] && die_now
356         _md5_checksum $testfile
357
358         if [ "$unwritten_tests" ]; then
359                 echo "  3. into unwritten space"
360                 if [ "$remove_testfile" ]; then
361                         rm -f $testfile
362                 fi
363                 $XFS_IO_PROG -f -c "truncate $_20k" \
364                         -c "$alloc_cmd 0 $_20k" \
365                         -c "$zero_cmd $_4k $_8k" \
366                         -c "$map_cmd -v" $testfile | $filter_cmd
367                 [ $? -ne 0 ] && die_now
368                 _md5_checksum $testfile
369         fi
370
371         echo "  4. hole -> data"
372         if [ "$remove_testfile" ]; then
373                 rm -f $testfile
374         fi
375         $XFS_IO_PROG -f -c "truncate $_20k" \
376                 -c "pwrite $_8k $_8k" $sync_cmd \
377                 -c "$zero_cmd $_4k $_8k" \
378                 -c "$map_cmd -v" $testfile | $filter_cmd
379         [ $? -ne 0 ] && die_now
380         _md5_checksum $testfile
381
382         if [ "$unwritten_tests" ]; then
383                 echo "  5. hole -> unwritten"
384                 if [ "$remove_testfile" ]; then
385                         rm -f $testfile
386                 fi
387                 $XFS_IO_PROG -f -c "truncate $_20k" \
388                         -c "$alloc_cmd $_8k $_8k" \
389                         -c "$zero_cmd $_4k $_8k" \
390                         -c "$map_cmd -v" $testfile | $filter_cmd
391                 [ $? -ne 0 ] && die_now
392                 _md5_checksum $testfile
393         fi
394
395         echo "  6. data -> hole"
396         if [ "$remove_testfile" ]; then
397                 rm -f $testfile
398         fi
399         $XFS_IO_PROG -f -c "truncate $_20k" \
400                 -c "pwrite 0 $_8k" $sync_cmd \
401                  -c "$zero_cmd $_4k $_8k" \
402                 -c "$map_cmd -v" $testfile | $filter_cmd
403         [ $? -ne 0 ] && die_now
404         _md5_checksum $testfile
405
406         if [ "$unwritten_tests" ]; then
407                 echo "  7. data -> unwritten"
408                 if [ "$remove_testfile" ]; then
409                         rm -f $testfile
410                 fi
411                 $XFS_IO_PROG -f -c "truncate $_20k" \
412                         -c "pwrite 0 $_8k" $sync_cmd \
413                         -c "$alloc_cmd $_8k $_8k" \
414                         -c "$zero_cmd $_4k $_8k" \
415                         -c "$map_cmd -v" $testfile | $filter_cmd
416                 [ $? -ne 0 ] && die_now
417                 _md5_checksum $testfile
418
419                 echo "  8. unwritten -> hole"
420                 if [ "$remove_testfile" ]; then
421                         rm -f $testfile
422                 fi
423                 $XFS_IO_PROG -f -c "truncate $_20k" \
424                         -c "$alloc_cmd 0 $_8k" \
425                         -c "$zero_cmd $_4k $_8k" \
426                         -c "$map_cmd -v" $testfile | $filter_cmd
427                 [ $? -ne 0 ] && die_now
428                 _md5_checksum $testfile
429
430                 echo "  9. unwritten -> data"
431                 if [ "$remove_testfile" ]; then
432                         rm -f $testfile
433                 fi
434                 $XFS_IO_PROG -f -c "truncate $_20k" \
435                         -c "$alloc_cmd 0 $_8k" \
436                         -c "pwrite $_8k $_8k" $sync_cmd \
437                         -c "$zero_cmd $_4k $_8k" \
438                         -c "$map_cmd -v" $testfile | $filter_cmd
439                 [ $? -ne 0 ] && die_now
440                 _md5_checksum $testfile
441         fi
442
443         echo "  10. hole -> data -> hole"
444         if [ "$remove_testfile" ]; then
445                 rm -f $testfile
446         fi
447         $XFS_IO_PROG -f -c "truncate $_20k" \
448                 -c "pwrite $_8k $_4k" $sync_cmd \
449                 -c "$zero_cmd $_4k $_12k" \
450                 -c "$map_cmd -v" $testfile | $filter_cmd
451         [ $? -ne 0 ] && die_now
452         _md5_checksum $testfile
453
454         echo "  11. data -> hole -> data"
455         if [ "$remove_testfile" ]; then
456                 rm -f $testfile
457         fi
458         $XFS_IO_PROG -f -c "truncate $_20k" \
459                 -c "$alloc_cmd 0 $_20k" \
460                 -c "pwrite 0 $_8k" \
461                 -c "pwrite $_12k $_8k" $sync_cmd \
462                 -c "$punch_cmd $_8k $_4k" \
463                 -c "$zero_cmd $_4k $_12k" \
464                 -c "$map_cmd -v" $testfile | $filter_cmd
465         [ $? -ne 0 ] && die_now
466         _md5_checksum $testfile
467
468         if [ "$unwritten_tests" ]; then
469                 echo "  12. unwritten -> data -> unwritten"
470                 if [ "$remove_testfile" ]; then
471                         rm -f $testfile
472                 fi
473                 $XFS_IO_PROG -f -c "truncate $_20k" \
474                         -c "$alloc_cmd 0 $_20k" \
475                         -c "pwrite $_8k $_4k" $sync_cmd \
476                         -c "$zero_cmd $_4k $_12k" \
477                         -c "$map_cmd -v" $testfile | $filter_cmd
478                 [ $? -ne 0 ] && die_now
479                 _md5_checksum $testfile
480
481                 echo "  13. data -> unwritten -> data"
482                 if [ "$remove_testfile" ]; then
483                         rm -f $testfile
484                 fi
485                 $XFS_IO_PROG -f -c "truncate $_20k" \
486                         -c "$alloc_cmd 0 $_20k" \
487                         -c "pwrite 0k $_4k" $sync_cmd \
488                         -c "pwrite $_12k $_8k" -c "fsync" \
489                         -c "$zero_cmd $_4k $_12k" \
490                         -c "$map_cmd -v" $testfile | $filter_cmd
491                 [ $? -ne 0 ] && die_now
492                 _md5_checksum $testfile
493         fi
494
495         # Don't need to check EOF case for collapse range.
496         # VFS layer return invalid error in this case,
497         # So it is not a proper case for collapse range test of each local fs.
498         if [ "$zero_cmd" != "fcollapse" ]; then
499                 echo "  14. data -> hole @ EOF"
500                 rm -f $testfile
501                 $XFS_IO_PROG -f -c "truncate $_20k" \
502                         -c "pwrite 0 $_20k" $sync_cmd \
503                         -c "$zero_cmd $_12k $_8k" \
504                         -c "$map_cmd -v" $testfile | $filter_cmd
505                 [ $? -ne 0 ] && die_now
506                 _md5_checksum $testfile
507         fi
508
509         if [ "$zero_cmd" == "fcollapse" ]; then
510                 echo "  14. data -> hole @ 0"
511         else
512                 echo "  15. data -> hole @ 0"
513         fi
514
515         if [ "$remove_testfile" ]; then
516                 rm -f $testfile
517         fi
518         $XFS_IO_PROG -f -c "truncate $_20k" \
519                 -c "pwrite 0 $_20k" $sync_cmd \
520                 -c "$zero_cmd 0 $_8k" \
521                 -c "$map_cmd -v" $testfile | $filter_cmd
522         [ $? -ne 0 ] && die_now
523         _md5_checksum $testfile
524
525         # If zero_cmd is fcollpase, don't check unaligned offsets
526         if [ "$zero_cmd" == "fcollapse" ]; then
527                 return
528         fi
529
530         echo "  16. data -> cache cold ->hole"
531         if [ "$remove_testfile" ]; then
532                 rm -f $testfile
533                 rm -f $testfile.2
534         else
535                 cp $testfile $testfile.2
536         fi
537         $XFS_IO_PROG -f -c "truncate $_20k" \
538                 -c "pwrite $_8k $_12k" -c "fsync" $testfile.2 \
539                 > /dev/null
540         $XFS_IO_PROG -f -c "truncate $_20k" \
541                 -c "pwrite 0 $_20k" $sync_cmd \
542                 -c "$zero_cmd 0k $_8k" \
543                 -c "fadvise -d" \
544                 -c "$map_cmd -v" $testfile | $filter_cmd
545         diff $testfile $testfile.2
546         [ $? -ne 0 ] && die_now
547         rm -f $testfile.2
548         _md5_checksum $testfile
549
550         # different file sizes mean we can't use md5sum to check the hole is
551         # valid. Hence use hexdump to dump the contents and chop off the last
552         # line of output that indicates the file size. We also have to fudge
553         # the extent size as that will change with file size, too - that's what
554         # the sed line noise does - it will always result in an output of [0..7]
555         # so it matches 4k block size...
556         echo "  17. data -> hole in single block file"
557         if [ "$remove_testfile" ]; then
558                 rm -f $testfile
559         fi
560         block_size=`stat -f $TEST_DIR | grep "Block size" | cut -d " " -f3`
561         $XFS_IO_PROG -f -c "truncate $block_size" \
562                 -c "pwrite 0 $block_size" $sync_cmd \
563                 -c "$zero_cmd 128 128" \
564                 -c "$map_cmd -v" $testfile | $filter_cmd | \
565                          sed -e "s/\.\.[0-9]*\]/..7\]/"
566         [ $? -ne 0 ] && die_now
567         od -x $testfile | head -n -1
568 }
569
570 _test_block_boundaries()
571 {
572
573         remove_testfile=1
574         sync_cmd="-c fsync"
575         unwritten_tests=1
576         OPTIND=1
577         while getopts 'dk' OPTION
578         do
579                 case $OPTION in
580                 k)      remove_testfile=
581                 ;;
582                 d)      sync_cmd=
583                 ;;
584                 ?)      echo Invalid flag
585                 exit 1
586                 ;;
587                 esac
588         done
589         shift $(($OPTIND - 1))
590
591         bs=$1
592         zero_cmd=$2
593         filter_cmd=$3
594         testfile=$4
595
596         # Block size plus 1
597         bs_p1=$(($bs + 1))
598         # Block size plus 2
599         bs_p2=$(($bs + 2))
600
601         # Block size minus 1
602         bs_m1=$(($bs - 1))
603
604         # Block size multiplied by 2
605         bs_t2=$(($bs * 2))
606
607         # Block size divided by 2
608         bs_d2=$(($bs / 2))
609
610         echo "zero 0, 1"
611         $XFS_IO_PROG -f -t -c "pwrite -S 0x41 0 $bs" \
612                            -c "pwrite -S 0x42 $bs $bs" \
613                            -c "$zero_cmd 0 1" \
614                            -c "pread -v 0 $bs_t2" \
615                            $testfile | $filter_cmd
616
617         echo "zero 0, $bs_m1"
618         $XFS_IO_PROG -f -t -c "pwrite -S 0x41 0 $bs" \
619                            -c "pwrite -S 0x42 $bs $bs" \
620                            -c "$zero_cmd 0 $bs_m1" \
621                            -c "pread -v 0 $bs_t2" \
622                            $testfile | $filter_cmd
623
624         echo "zero 0, $bs"
625         $XFS_IO_PROG -f -t -c "pwrite -S 0x41 0 $bs" \
626                            -c "pwrite -S 0x42 $bs $bs" \
627                            -c "$zero_cmd 0 $bs" \
628                            -c "pread -v 0 $bs_t2" \
629                            $testfile | $filter_cmd
630
631         echo "zero 0, $bs_p1"
632         $XFS_IO_PROG -f -t -c "pwrite -S 0x41 0 $bs" \
633                            -c "pwrite -S 0x42 $bs $bs" \
634                            -c "$zero_cmd 0 $bs_p1" \
635                            -c "pread -v 0 $bs_t2" \
636                            $testfile | $filter_cmd
637
638         echo "zero $bs_m1, $bs"
639         $XFS_IO_PROG -f -t -c "pwrite -S 0x41 0 $bs" \
640                            -c "pwrite -S 0x42 $bs $bs" \
641                            -c "$zero_cmd $bs_m1 $bs" \
642                            -c "pread -v 0 $bs_t2" \
643                            $testfile | $filter_cmd
644
645         echo "zero $bs_m1, $bs_p1"
646         $XFS_IO_PROG -f -t -c "pwrite -S 0x41 0 $bs" \
647                            -c "pwrite -S 0x42 $bs $bs" \
648                            -c "$zero_cmd $bs_m1 $bs_p1" \
649                            -c "pread -v 0 $bs_t2" \
650                            $testfile | $filter_cmd
651
652         echo "zero $bs_m1, $bs_p2"
653         $XFS_IO_PROG -f -t -c "pwrite -S 0x41 0 $bs" \
654                            -c "pwrite -S 0x42 $bs $bs" \
655                            -c "$zero_cmd $bs_m1 $bs_p2" \
656                            -c "pread -v 0 $bs_t2" \
657                            $testfile | $filter_cmd
658
659
660         echo "zero $bs, $bs"
661         $XFS_IO_PROG -f -t -c "pwrite -S 0x41 0 $bs" \
662                            -c "pwrite -S 0x42 $bs $bs" \
663                            -c "$zero_cmd $bs $bs" \
664                            -c "pread -v 0 $bs_t2" \
665                            $testfile | $filter_cmd
666
667
668         echo "zero $bs_d2 , $bs"
669         $XFS_IO_PROG -f -t -c "pwrite -S 0x41 0 $bs" \
670                            -c "pwrite -S 0x42 $bs $bs" \
671                            -c "$zero_cmd $bs_d2 $bs" \
672                            -c "pread -v 0 $bs_t2" \
673                            $testfile | $filter_cmd
674 }