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