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