Amanda-Users

Re: largest fit peculiarities

2005-04-29 05:28:28
Subject: Re: largest fit peculiarities
From: Paul Bijnens <paul.bijnens AT xplanation DOT com>
To: Matt Hyclak <hyclak AT math.ohiou DOT edu>
Date: Fri, 29 Apr 2005 11:19:33 +0200
Matt Hyclak wrote:

Yes, as Paul Bijnens pointed out in a private mail, I had already gone over
what amanda knew about. In that case, largestfit falls back to the largest
dump available.

Actually falls back to "first" (in the queue).  But by Murphy's Law
that image rarely fits in the small unknown gap before the Real End
Of Tape.


I'm waiting to hear back from him, but Paul said he modified his
installation to fall back to the smallest dump available in that case, in
the hope that it might fit on the tape. I think that makes the most sense to
do.

Attached is a patch against 2.4.4p4.
The idea and patch is actually from Orion Poplawsky, who posted it
to amanda-hackers, including some other fixes:

http://marc.theaimsgroup.com/?l=amanda-hackers&m=109356032821052&w=2

I noticed some spelling errors in some comments in the patch  -- those
were by me :-) .

I haven't had yet the time to download and install 2.4.5.  Maybe
it's already included in there.  If not, I would be very happy this
is included in the next version.  It really helps filling a tape
to the last byte (and saves me a tape each day).


--
Paul Bijnens, Xplanation                            Tel  +32 16 397.511
Technologielaan 21 bus 2, B-3001 Leuven, BELGIUM    Fax  +32 16 397.512
http://www.xplanation.com/          email:  Paul.Bijnens AT xplanation DOT com
***********************************************************************
* I think I've got the hang of it now:  exit, ^D, ^C, ^\, ^Z, ^Q, F6, *
* quit,  ZZ, :q, :q!,  M-Z, ^X^C,  logoff, logout, close, bye,  /bye, *
* stop, end, F3, ~., ^]c, +++ ATH, disconnect, halt,  abort,  hangup, *
* PF4, F20, ^X^X, :D::D, KJOB, F14-f-e, F8-e,  kill -1 $$,  shutdown, *
* kill -9 1,  Alt-F4,  Ctrl-Alt-Del,  AltGr-NumLock,  Stop-A,  ...    *
* ...  "Are you sure?"  ...   YES   ...   Phew ...   I'm out          *
***********************************************************************

--- amanda-2.4.4p4/server-src/driver.c  2004-10-21 14:31:52.000000000 +0200
+++ amanda-2.4.4p4_smallest_if_nothing_fits/server-src/driver.c 2004-12-20 
12:29:10.000000000 +0100
@@ -526,7 +526,8 @@
        case ALGO_LARGESTFIT: 
                fit = tapeq.head;
                while (fit != NULL) {
-                   if(sched(fit)->act_size <= tape_left &&
+                   if(tape_left > 0 &&
+                       sched(fit)->act_size <= tape_left &&
                       (!dp || sched(fit)->act_size > sched(dp)->act_size) &&
                       strcmp(sched(fit)->datestamp, datestamp) <= 0) {
                        dp = fit;
@@ -536,6 +537,7 @@
                if(dp) remove_disk(&tapeq, dp);
                break;
        case ALGO_SMALLEST: 
+           algo_smallest:
                fit = dp = tapeq.head;
                while (fit != NULL) {
                    if(sched(fit)->act_size < sched(dp)->act_size &&
@@ -544,7 +546,8 @@
                    }
                    fit = fit->next;
                }
-               if(dp) remove_disk(&tapeq, dp);
+               /* if(dp) remove_disk(&tapeq, dp);   --  PBI@20041213 : always 
do smallest */  
+               remove_disk(&tapeq, dp);
                break;
        case ALGO_LAST:
                dp = tapeq.tail;
@@ -552,9 +555,12 @@
                break;
        }
        if(!dp) {
-           dp = dequeue_disk(&tapeq); /* first if nothing fit */
+           
+           /*  dp = dequeue_disk(&tapeq);  -- PBI@20041213 /* first if nothing 
fit */
            fprintf(stderr,
-                   "driver: startaflush: Using first because nothing fit\n");
+                   /* "driver: startaflush: Using first because nothing 
fit\n"); -- PBI@20041213 smallist instead! */
+                   "driver: startaflush: Using smallest because nothing 
fit\n");
+               goto algo_smallest;
        }
        taper_disk = dp;
        taper_busy = 1;
<Prev in Thread] Current Thread [Next in Thread>