e4c60fded31390db6c319f9a0e433a911dafa748
[xfstests-dev.git] / common.dump
1 ##/bin/sh
2
3 #
4 # Functions useful for xfsdump/xfsrestore tests
5 #
6 # Copyright (c) 2000 Silicon Graphics, Inc.  All Rights Reserved.
7
8 # This program is free software; you can redistribute it and/or modify it
9 # under the terms of version 2 of the GNU General Public License as
10 # published by the Free Software Foundation.
11
12 # This program is distributed in the hope that it would be useful, but
13 # WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15
16 # Further, this software is distributed without any warranty that it is
17 # free of the rightful claim of any third person regarding infringement
18 # or the like.  Any license provided herein, whether implied or
19 # otherwise, applies only to this software file.  Patent licenses, if
20 # any, provided herein do not apply to combinations of this program with
21 # other software, or any other product whatsoever.
22
23 # You should have received a copy of the GNU General Public License along
24 # with this program; if not, write the Free Software Foundation, Inc., 59
25 # Temple Place - Suite 330, Boston MA 02111-1307, USA.
26
27 # Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
28 # Mountain View, CA  94043, or:
29
30 # http://www.sgi.com 
31
32 # For further information regarding this notice, see: 
33
34 # http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
35 #
36
37 # --- initializations ---
38 rm -f $seq.full
39
40 if [ -n "$DEBUGDUMP" ]; then
41   _dump_debug=-v5
42   _restore_debug=-v5
43   _invutil_debug=-d
44 fi
45  
46 # Use dump/restore out of workareas
47 PATH="../dump/dump:../dump/restore:../dump/invutil:$PATH"
48 export PATH
49
50 # status returned for not run tests
51 NOTRUNSTS=2
52
53 # name those directories
54 dump_dir=$SCRATCH_MNT/dump.$$
55 dump_file=$tmp.dumpfile
56 dump_sdir=dump.$$
57 restore_dir=$SCRATCH_MNT/restore.$$
58 restore_sdir=restore.$$
59
60 dumptape=$TAPE_DEV
61 media_label="stress_tape_media"
62 session_label="stress_$seq"
63
64 nobody=4 # define this uid/gid as a number
65
66 _need_to_be_root
67
68 # install our cleaner
69 trap "_cleanup; exit \$status" 0 1 2 3 15
70
71 # start inventory from a known base - move it aside for test
72 if [ -d /var/xfsdump/inventory ]; then
73     if [ -d /var/xfsdump/inventory.$seq ]; then    
74         rm -rf /var/xfsdump/inventory.$seq
75     fi
76     mv /var/xfsdump/inventory /var/xfsdump/inventory.$seq
77 fi
78
79
80 #
81 # do a remote/local mt
82 #
83 _mt()
84 {
85     op=$1
86     if _isrmt; then  
87         # REMOTE
88         _rmthost=`echo $dumptape | awk -F: '{print $1}'`
89         _rmtdev=`echo $dumptape | awk -F: '{print $2}'`
90         rsh -n $_rmthost "mt -t $_rmtdev $op"
91     else
92         #LOCAL
93         mt -t $dumptape $op
94     fi
95 }
96
97 _check_onl()
98 {
99     _limit=10
100     i=0
101     while [ $i -lt $_limit ]; do  
102         echo "Checking online..." >>$seq.full
103         if _mt status >$tmp.status 2>&1; then
104             break; 
105         else
106             sleep 2 
107         fi
108         i=`expr $i + 1`
109     done
110
111
112     if [ $i -eq $_limit ]; then
113         echo "ERROR: mt -f $dumptape failed"
114         cat $tmp.status
115
116         echo "mt -f $dumptape failed" >$seq.notrun 
117         status=$NOTRUNSTS
118         exit
119     fi 
120
121
122     if egrep -i 'onl|ready' $tmp.status | grep -iv 'not ready' >/dev/null; then
123         :
124     else
125         echo "ERROR: $dumptape is not online"
126         cat $tmp.status
127
128         echo "dumptape, $dumptape, is not online" >$seq.notrun 
129         status=$NOTRUNSTS
130         exit
131     fi
132 }
133
134 _wait_tape()
135 {
136     echo "Wait for tape, $dumptape, ..." >>$seq.full
137
138     i=0
139     while [ $i -lt 20 ]; do  
140         echo "Checking status..." >>$seq.full
141         if _mt status 2>&1 | tee -a $seq.full | egrep -i "onl|ready" >/dev/null; then
142             break; 
143         else
144             sleep 2 
145         fi
146         i=`expr $i + 1`
147     done
148 }
149
150 #
151 # Keep trying so we know we really have rewound
152 #
153 _rewind()
154 {
155     echo "Initiate rewind..." >>$seq.full
156     _wait_tape
157     _mt rewind >/dev/null
158     _wait_tape
159 }
160
161 #
162 # Do a custom erase because: 
163 # (i) some machines don't support it
164 # (ii) some machines take forever to do it
165 #
166 _erase_soft()
167 {
168     echo "Erasing tape" | tee -a $seq.full
169     _rewind
170     _mt weof 3
171     _rewind
172 }
173
174 _erase_hard()
175 {
176     echo "Erasing tape" | tee -a $seq.full
177     _mt erase
178 }
179
180 _isrmt()
181 {
182     echo $dumptape | grep ':' >/dev/null
183 }
184
185 #
186 # Get tape ready
187 #
188 _set_variable()
189 {
190     if _isrmt; then
191         :
192     else
193         # LOCAL
194         echo "Put scsi tape driver into variable block size mode"
195         mt -f $dumptape setblk 0
196     fi  
197 }
198
199 _require_tape()
200 {
201     if [ $# -eq 0 ]; then
202         dumptape=$TAPE_DEV
203     else
204         dumptape=$1
205     fi
206
207     if [ -z "$dumptape" ]; then
208         echo "This test requires a dump tape - none was specified"
209         echo "No dump tape specified" >$seq.notrun 
210         status=$NOTRUNSTS
211         exit
212     fi
213
214     _check_onl
215     _set_variable
216 }
217
218 _error()
219 {
220     echo "Error: $*" | tee -a $seq.full
221     echo "(see $seq.full for details)"
222     status=1
223     exit
224 }
225
226 _wipe_fs()
227 {
228     _require_scratch
229
230     mkfs -t xfs -f $SCRATCH_DEV >>$seq.full  ||\
231         _error "mkfs failed"
232       
233     mount -t xfs $SCRATCH_DEV $SCRATCH_MNT >>$seq.full ||\
234         _error "mount failed"
235 }
236
237
238 # Cleanup created dirs and files
239 # Called by trap
240 #
241 _cleanup()
242 {
243     cd $here
244     rm -f $tmp.*
245
246     if [ -n "$DEBUGDUMP" ]; then
247         # save it for inspection
248         tar -zcvf $seq.inventory.tgz /var/xfsdump/inventory
249         ls -lR /var/xfsdump/inventory >$seq.inventory.ls
250     fi
251
252     # put inventory dir back
253     if [ -d /var/xfsdump/inventory.$seq ]; then
254         rm -rf /var/xfsdump/inventory # get rid of new one
255         mv /var/xfsdump/inventory.$seq /var/xfsdump/inventory
256     fi
257
258     if [ $status -ne $NOTRUNSTS ]; then
259         # Sleep added to stop _check_fs from complaining that the
260         # scratch_dev is still busy
261         sleep 10
262
263         _check_fs $SCRATCH_DEV
264     fi
265 }
266
267 _stable_fs()
268 {
269 #    umount $SCRATCH_MNT >/dev/null 
270 #    mount $SCRATCH_MNT >/dev/null
271     sync; sync; sleep 15
272 }
273
274 #
275 # Run src/fsstress to create a mixture of 
276 # files,dirs,links,symlinks
277 #
278 # Pinched from test 013.
279 #
280 _create_dumpdir_stress()
281 {
282     echo "Creating directory system to dump using src/fsstress."
283
284     _wipe_fs
285
286     _param="-f link=10 -f creat=10 -f mkdir=10 -f truncate=5 -f symlink=10"
287     _count=200
288     rm -rf $dump_dir
289     if ! mkdir $dump_dir; then
290         echo "    failed to mkdir $dump_dir"
291         status=1
292         exit
293     fi
294     echo ""
295     echo "-----------------------------------------------"
296     echo "fsstress : $_param"
297     echo "-----------------------------------------------"
298     if ! $here/src/fsstress $_param $FSSTRESS_AVOID -n $_count -d $dump_dir >$tmp.out 2>&1
299     then
300         echo "    fsstress (count=$_count) returned $? - see $seq.full"
301         
302         echo "--------------------------------------"       >>$here/$seq.full
303         echo "output from fsstress:"                        >>$here/$seq.full
304         echo "--------------------------------------"       >>$here/$seq.full
305         cat $tmp.out                                        >>$here/$seq.full
306         status=1
307     fi
308
309     _stable_fs
310 }
311
312 _mk_fillconfig1()
313 {
314     cat <<End-of-File >$tmp.config
315 # pathname      size in bytes   owner   group
316 #
317 small           10      $nobody $nobody
318 big             102400  daemon  sys
319 sub/small       10      bin     bin
320 sub/big         102400  $nobody sys
321 #
322 sub/a           1       $nobody $nobody
323 sub/b           2       $nobody $nobody
324 sub/c           4       $nobody $nobody
325 sub/d           8       $nobody $nobody
326 sub/e           16      $nobody $nobody
327 sub/f           32      $nobody $nobody
328 sub/g           64      $nobody $nobody
329 sub/h           128     $nobody $nobody
330 sub/i           256     $nobody $nobody
331 sub/j           512     $nobody $nobody
332 sub/k           1024    $nobody $nobody
333 sub/l           2048    $nobody $nobody
334 sub/m           4096    $nobody $nobody
335 sub/n           8192    $nobody $nobody
336 #
337 sub/a00         100     $nobody $nobody
338 sub/b00         200     $nobody $nobody
339 sub/c00         400     $nobody $nobody
340 sub/d00         800     $nobody $nobody
341 sub/e00         1600    $nobody $nobody
342 sub/f00         3200    $nobody $nobody
343 sub/g00         6400    $nobody $nobody
344 sub/h00         12800   $nobody $nobody
345 sub/i00         25600   $nobody $nobody
346 sub/j00         51200   $nobody $nobody
347 sub/k00         102400  $nobody $nobody
348 sub/l00         204800  $nobody $nobody
349 sub/m00         409600  $nobody $nobody
350 sub/n00         819200  $nobody $nobody
351 #
352 sub/a000        1000    $nobody $nobody
353 sub/e000        16000   $nobody $nobody
354 sub/h000        128000  $nobody $nobody
355 sub/k000        1024000 $nobody $nobody
356 End-of-File
357 }
358
359 _mk_fillconfig2()
360 {
361     cat <<End-of-File >$tmp.config
362 # pathname      size in bytes
363 #
364 smalll          10      $nobody $nobody
365 biggg           102400  $nobody $nobody
366 sub/smalll      10      $nobody $nobody
367 sub/biggg       102400  $nobody $nobody
368 End-of-File
369 }
370
371 #
372 # Create a bunch of directories/files of different sizes
373 # filled with data.
374 #
375 # Pinched from test 001.
376 #
377 _do_create_dumpdir_fill()
378 {
379     echo "Creating directory system to dump using src/fill."
380
381     if mkdir -p $dump_dir
382     then
383         :
384     else
385         echo "Error: cannot mkdir \"$dump_dir\""
386         exit 1
387     fi
388     cd $dump_dir
389
390     $verbose && echo -n "Setup "
391     sed -e '/^#/d' $tmp.config \
392     | while read file nbytes owner group perms
393     do
394         dir=`dirname $file`
395         if [ "$dir" != "." ]
396         then
397             if [ ! -d $dir ]
398             then
399                 if mkdir $dir
400                 then
401                     :
402                 else
403                     $verbose && echo
404                     echo "Error: cannot mkdir \"$dir\""
405                     exit 1
406                 fi
407             fi
408         fi
409         rm -f $file
410         if $here/src/fill $file $file $nbytes
411         then
412             :
413         else
414             $verbose && echo
415             echo "Error: cannot create \"$file\""
416             exit 1
417         fi
418         if [ -n "$owner" -a -n "$group" ]; then
419             chown $owner.$group $file
420         fi
421         if [ -n "$perms" ]; then
422             chmod $perms $file
423         fi
424         $verbose && echo -n "."
425     done
426     $verbose && echo
427
428     cd $here
429 }
430
431
432 _create_dumpdir_fill()
433 {
434     _wipe_fs
435     _mk_fillconfig1
436     _do_create_dumpdir_fill
437     _stable_fs
438 }       
439
440 _create_dumpdir_fill2()
441 {
442     _wipe_fs
443     _mk_fillconfig2
444     _do_create_dumpdir_fill
445     _stable_fs
446 }       
447
448
449
450 #
451 # Append a subset of the fill'ed files
452 # So we can see if just these get dumped on an incremental
453 #
454 _append_dumpdir_fill()
455 {
456     cd $dump_dir
457     cat <<End-of-File >$tmp.config
458 # pathname
459 #
460 small   
461 sub/big 
462 #
463 sub/a
464 sub/c
465 sub/e
466 End-of-File
467     sed -e '/^#/d' $tmp.config \
468     | while read file
469     do
470         echo 'Extra text' >>$file
471     done
472
473     cd $here
474 }
475
476 _do_create_dump_symlinks()
477 {
478     echo "Creating directory system of symlinks to dump."
479
480     if mkdir -p $dump_dir
481     then
482         :
483     else
484         echo "Error: cannot mkdir \"$dump_dir\""
485         exit 1
486     fi
487     cd $dump_dir
488
489     $verbose && echo -n "Setup "
490     sed -e '/^#/d' $tmp.config \
491     | while read file nbytes owner group owner2 group2 perms perms2
492     do
493         dir=`dirname $file`
494         if [ "$dir" != "." ]
495         then
496             if [ ! -d $dir ]
497             then
498                 if mkdir $dir
499                 then
500                     :
501                 else
502                     $verbose && echo
503                     echo "Error: cannot mkdir \"$dir\""
504                     exit 1
505                 fi
506             fi
507         fi
508         rm -f $file
509         touch $file
510
511         # Do chmod on symlink using umask.
512         # This won't do the right thing as it subtracts permissions.
513         # However, I don't care, as long as I get some different perms
514         # for testing.
515         if [ -n "$perms2" ]; then
516             omask=`umask`
517             umask $perms2
518         fi
519         ln -s $file $file-link
520         if [ -n "$perms2" ]; then
521             umask $omask        
522         fi
523
524         if [ -n "$owner" -a -n "$group" ]; then
525             chown $owner.$group $file
526         fi
527         if [ -n "$owner" -a -n "$group" ]; then
528             chown -h $owner.$group $file-link
529         fi
530         if [ -n "$perms" ]; then
531             chmod $perms $file
532         fi
533         $verbose && echo -n "."
534     done
535     $verbose && echo
536
537     cd $here
538 }
539
540 _mk_symlink_config()
541 {
542     cat <<End-of-File >$tmp.config
543 # path  size    owner1  group1  owner2  group2  perm1   perm2 
544 #
545 a       0       $nobody $nobody daemon  sys     124     421
546 b       0       daemon  sys     bin     bin     347     743
547 sub/a   0       bin     bin     $nobody sys     777     777
548 sub/b   0       $nobody sys     $nobody $nobody 367     763
549 End-of-File
550 }
551
552 _create_dumpdir_symlinks()
553 {
554     _wipe_fs
555     _mk_symlink_config
556     _do_create_dump_symlinks
557     _stable_fs
558 }       
559
560 #
561 # Filter for ls
562 # Filter out dates on symlinks
563 #
564 _ls_filter()
565 {
566   $AWK_PROG '/^l/ { date = $8; sub(date,"DATE"); print}
567         {print}' \
568   | sed -e 's/total [0-9][0-9]*/total TOTAL/'
569 }
570
571
572
573 # Filter out the non-deterministic dump msgs from
574 # xfsdump and xfsrestore
575 #
576 _dump_filter()
577 {
578   sed \
579       -e "s/`hostname`/HOSTNAME/"   \
580       -e "s#$SCRATCH_DEV#SCRATCH_DEV#"    \
581       -e "s#$dumptape#TAPE_DEV#"    \
582       -e "s#$SCRATCH_MNT#SCRATCH_MNT#"    \
583       -e "s#$dump_file#DUMP_FILE#"  \
584       -e 's/id:[        ]*[0-9a-f-]*/id: ID/'  \
585       -e 's/time:[      ].*/time: TIME/'       \
586       -e 's/date:[      ].*/date: DATE/'       \
587       -e 's/dump begun .*/dump begun DATE/'    \
588       -e 's/[0-9][0-9]* seconds/SECS seconds/' \
589       -e '/: dump size/s/[1-9][0-9]*/NUM/'     \
590       -e '/dump size:/s/[1-9][0-9]*/NUM/'      \
591       -e '/media file size/s/[1-9][0-9]*/NUM/' \
592       -e '/\/dev\/tty/d' \
593       -e '/inventory session uuid/d' \
594
595 }
596
597 _invutil_filter()
598 {
599   _dump_filter \
600   | sed \
601         -e 's/UUID[     ]*:[    ][0-9a-f-]*/UUID                :       ID/' \
602         -e 's/TIME OF DUMP[     ]*:.*/TIME OF DUMP      :       TIME/' \
603         -e 's/HOSTNAME:SCRATCH_MNT.*/HOSTNAME:SCRATCH_MNT/' \
604         -e 's#inventory/[0-9a-f-]*#inventory/UUID#' \
605
606 }
607
608 _dir_filter()
609 {
610   sed \
611     -e "s#$dump_file#DUMP_FILE#"      \
612     -e "s#$SCRATCH_DEV#SCRATCH_DEV#"        \
613     -e "s#$dumptape#TAPE_DEV#"         \
614     -e "s#$dump_dir#DUMP_DIR#g"       \
615     -e "s#$restore_dir#RESTORE_DIR#g" \
616     -e "s#$SCRATCH_MNT#SCRATCH_MNT#g"       \
617     -e "s#$dump_sdir#DUMP_SUBDIR#g"   \
618     -e "s#$restore_sdir#RESTORE_SUBDIR#g" \
619
620 }
621
622 _parse_args()
623 {
624     OPTIND=0
625     dump_args=""
626     while getopts "f:FL:o" c $*
627     do
628         case $c
629         in
630         f)
631             [ -z "$OPTARG" ] && _error "missing argument for -f"
632             dumptape=$OPTARG    
633             ;;
634         L)
635             [ -z "$OPTARG" ] && _error "missing argument for -L"
636             session_label=$OPTARG       
637             ;;
638         o)
639             dump_args="$dump_args -o"
640             ;;
641         F)
642             dump_args="$dump_args -F"
643             ;;
644         \?)
645             _error "invalid argument"
646             ;;
647         esac
648     done
649 }
650
651
652 #
653 # Dump a subdir
654 #
655 _do_dump_sub()
656 {
657     _parse_args $*
658
659     echo "Dumping to tape..."
660     opts="$_dump_debug$dump_args -s $dump_sdir -f $dumptape -M $media_label -L $session_label $SCRATCH_MNT"
661     echo "xfsdump $opts" | _dir_filter  
662     xfsdump $opts 2>&1 | tee -a $seq.full | _dump_filter
663 }
664
665 #
666 # Do full level 0 dump
667 #
668 _do_dump()
669 {
670     _parse_args $*
671
672     echo "Dumping to tape..."
673     opts="$_dump_debug$dump_args -l0 -f $dumptape -M $media_label -L $session_label $SCRATCH_MNT"
674     echo "xfsdump $opts" | _dir_filter  
675     xfsdump $opts 2>&1 | tee -a $seq.full | _dump_filter
676 }
677
678
679 #
680 # Do full dump with -m
681 #
682 _do_dump_min()
683 {
684     _parse_args $*
685
686     echo "Dumping to tape..."
687     onemeg=1048576
688     opts="$_dump_debug$dump_args -m -b $onemeg -l0 -f $dumptape -M $media_label -L $session_label $SCRATCH_MNT"
689     echo "xfsdump $opts" | _dir_filter  
690     xfsdump $opts 2>&1 | tee -a $seq.full | _dump_filter
691 }
692
693 #
694 # Do level 1 incremental dump
695 #
696 _do_dump_incremental()
697 {
698     _parse_args $*
699
700     echo "Dumping incrementally to tape..."
701     opts="$_dump_debug$dump_args -l1 -f $dumptape -M $media_label -L $session_label $SCRATCH_MNT"
702     echo "xfsdump $opts" | _dir_filter  
703     xfsdump $opts 2>&1 | tee -a $seq.full | _dump_filter
704 }
705
706 #
707 # Do full dump to file
708 #
709 _do_dump_file()
710 {
711     _parse_args $*
712
713     echo "Dumping to file..."
714     opts="$_dump_debug$dump_args -f $dump_file -M $media_label -L $session_label $SCRATCH_MNT"
715     echo "xfsdump $opts" | _dir_filter  
716     xfsdump $opts 2>&1 | tee -a $seq.full | _dump_filter
717 }
718
719
720 _prepare_restore_dir()
721 {
722     rm -rf $restore_dir
723     if ! mkdir $restore_dir; then
724         echo "    failed to mkdir $restore_dir"
725         status=1
726         exit
727     fi
728 }
729
730
731 #
732 # Get tape ready and restore dir
733 #
734 _prepare_restore()
735 {
736     _prepare_restore_dir
737
738     echo "Rewinding tape"
739     _rewind
740 }
741
742 #
743 # Restore the tape into $restore_dir
744 #
745 _do_restore()
746 {
747     _parse_args $*
748     _prepare_restore
749
750
751     echo "Restoring from tape..."
752     opts="$_restore_debug$dump_args -f $dumptape  -L $session_label $restore_dir"
753     echo "xfsrestore $opts" | _dir_filter  
754     xfsrestore $opts 2>&1 | tee -a $seq.full | _dump_filter
755 }
756
757 #
758 # Restore the tape into $restore_dir using -m
759 #
760 _do_restore_min()
761 {
762     _parse_args $*
763     _prepare_restore
764
765     echo "Restoring from tape..."
766     onemeg=1048576
767     opts="$_restore_debug$dump_args -m -b $onemeg -f $dumptape  -L $session_label $restore_dir"
768     echo "xfsrestore $opts" | _dir_filter  
769     xfsrestore $opts 2>&1 | tee -a $seq.full | _dump_filter
770 }
771
772 #
773 # Restore the tape from a dump file
774 #
775 _do_restore_file()
776 {
777     _parse_args $*
778     _prepare_restore_dir
779
780     echo "Restoring from file..."
781     opts="$_restore_debug$dumpargs -f $dump_file  -L $session_label $restore_dir"
782     echo "xfsrestore $opts" | _dir_filter  
783     xfsrestore $opts 2>&1 | tee -a $seq.full | _dump_filter
784 }
785
786 #
787 # Do xfsdump piped into xfsrestore - xfsdump | xfsrestore
788 #
789 # Use -s as we want to dump and restore to the same xfs partition
790 #
791 _do_dump_restore()
792 {
793     _parse_args $*
794     _prepare_restore_dir
795     echo "xfsdump|xfsrestore ..."
796     restore_opts="$_restore_debug - $restore_dir"
797     dump_opts="$_dump_debug$dump_args -s $dump_sdir - $SCRATCH_MNT"
798     echo "xfsdump $dump_opts | xfsrestore $restore_opts" | _dir_filter  
799     xfsdump $dump_opts 2>$tmp.dump.mlog | xfsrestore $restore_opts 2>&1 | tee -a $seq.full | _dump_filter
800     _dump_filter <$tmp.dump.mlog
801 }
802
803 #
804 # Compare dumped subdirectory with restored dir
805 # using ls -lR.
806 # Thus no contents are compared but permissions, sizes,
807 # owners, etc... are.
808 #
809 _ls_compare_sub()
810 {
811     #
812     # verify we got back what we dumped
813     #
814     echo "Comparing listing of dump directory with restore directory"
815     ls -lR $dump_dir | tee -a $seq.full | _ls_filter >$tmp.dump_dir
816     ls -lR $restore_dir/$dump_sdir | tee -a $seq.full | _ls_filter \
817     | sed -e "s#$restore_sdir\/##" >$tmp.restore_dir
818
819     diff -cs $tmp.dump_dir $tmp.restore_dir | sed -e "s#$tmp#TMP#g"
820 }
821
822
823 #
824 # Compare using recursive diff the files of the dumped
825 # subdirectory.
826 # This one will compare the contents.
827 #
828 _diff_compare_sub()
829 {
830     echo "Comparing dump directory with restore directory"
831     diff -rs $dump_dir $restore_dir/$dump_sdir | _dir_filter
832 }
833
834 #
835 # Compare using recursive diff the files of the dumped
836 # filesystem
837 #
838 _diff_compare()
839 {
840     echo "Comparing dump directory with restore directory"
841     diff -rs $SCRATCH_MNT $restore_dir | _dir_filter
842 }
843
844 #
845 # Check out the dump inventory
846 #
847 _dump_inventory()
848 {
849     xfsdump $_dump_debug -I | tee -a $seq.full | _dump_filter 
850 }
851
852 #
853 # Do the xfsinvutil cmd with debug and filters
854 # Need to set variable: "$middate" to the invutil date 
855 #
856 _do_invutil()
857 {
858     host=`hostname`
859     echo "xfsinvutil $_invutil_debug -M $host:$SCRATCH_MNT \"$middate\" $*" >$seq.full
860     xfsinvutil $_invutil_debug -M $host:$SCRATCH_MNT "$middate" $* \
861     | tee -a $seq.full | _invutil_filter
862 }
863
864 # make sure this script returns success
865 /bin/true