From 804e9c5a74a7de6a874070ec659cb8accb4db1bd Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Sun, 1 Jun 2008 18:44:24 +0000 Subject: [PATCH] Optimize writing EOF on two tapes git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@7087 91ce42f0-d328-0410-95d8-f526ca767f89 --- regress/scripts/prepare-two-tapes.in | 47 ++++++++++++++++++---------- 1 file changed, 30 insertions(+), 17 deletions(-) diff --git a/regress/scripts/prepare-two-tapes.in b/regress/scripts/prepare-two-tapes.in index b937ea115e..65bcce823c 100755 --- a/regress/scripts/prepare-two-tapes.in +++ b/regress/scripts/prepare-two-tapes.in @@ -2,32 +2,45 @@ # # Cleanup left over files -- both before and after test run # +# Write an EOF on tape in slot $SLOT1 and on tape in $SLOT2 . scripts/functions scripts/cleanup -if test x@autochanger@ != x/dev/null; then - slot=`bin/@changer_script@ @autochanger@ loaded 0 @tape_drive@ $DRIVE1` - if test "x${slot}" != "x$SLOT2"; then - bin/@changer_script@ @autochanger@ unload $slot @tape_drive@ $DRIVE1 - bin/@changer_script@ @autochanger@ load $SLOT2 @tape_drive@ $DRIVE1 - fi - - init_drive @tape_drive@ -fi - - # -# If we have an autochanger always load tape in slot 1 +# init first of two slots +# optimize so we don't unnecessarily unload and load slots # if test x@autochanger@ != x/dev/null; then slot=`bin/@changer_script@ @autochanger@ loaded 0 @tape_drive@ $DRIVE1` - if test "x${slot}" != "x$SLOT1"; then + case $slot in + 0) + bin/@changer_script@ @autochanger@ load $SLOT1 @tape_drive@ $DRIVE1 + init_drive @tape_drive@ + slot=$SLOT1 + ;; + $SLOT1) + init_drive @tape_drive@ + slot=$SLOT1 + ;; + $SLOT2) + init_drive @tape_drive@ + slot=$SLOT2 + ;; + esac + +# init the other slot + case $slot in + $SLOT1) + bin/@changer_script@ @autochanger@ unload $slot @tape_drive@ $DRIVE1 + bin/@changer_script@ @autochanger@ load $SLOT2 @tape_drive@ $DRIVE1 + init_drive @tape_drive@ + ;; + $SLOT2) bin/@changer_script@ @autochanger@ unload $slot @tape_drive@ $DRIVE1 bin/@changer_script@ @autochanger@ load $SLOT1 @tape_drive@ $DRIVE1 - fi + init_drive @tape_drive@ + ;; + esac fi - -init_drive @tape_drive@ - -- 2.39.5