| 14 |
|
|
| 15 |
|
#ifndef CACHESIZE |
| 16 |
|
#ifdef BIGMEM |
| 17 |
< |
#define CACHESIZE 32 /* default cache size (Mbytes, 0==inf) */ |
| 17 |
> |
#define CACHESIZE 17 /* default cache size (Mbytes, 0==inf) */ |
| 18 |
|
#else |
| 19 |
< |
#define CACHESIZE 12 |
| 19 |
> |
#define CACHESIZE 5 |
| 20 |
|
#endif |
| 21 |
|
#endif |
| 22 |
|
#ifndef FREEBEAMS |
| 30 |
|
#endif |
| 31 |
|
#ifndef FF_DEFAULT |
| 32 |
|
/* when to free a beam fragment */ |
| 33 |
< |
#define FF_DEFAULT (FF_ALLOC|FF_WRITE|FF_KILL) |
| 33 |
> |
#define FF_DEFAULT (FF_WRITE|FF_KILL) |
| 34 |
|
#endif |
| 35 |
|
#ifndef MINDIRSEL |
| 36 |
|
/* minimum directory seek length */ |
| 559 |
|
biglob(hp)->nrd -= bi->nrd; /* tell fragment it's free */ |
| 560 |
|
bi->nrd = 0; |
| 561 |
|
bi->fo = 0L; |
| 562 |
+ |
hdmarkdirty(hp, i); /* assume we'll reallocate */ |
| 563 |
|
return(1); |
| 564 |
|
} |
| 565 |
|
|
| 622 |
|
register HOLO *hp; |
| 623 |
|
register int i; |
| 624 |
|
{ |
| 625 |
+ |
int fragfreed; |
| 626 |
|
unsigned int4 nrays; |
| 627 |
|
unsigned int n; |
| 628 |
|
long nfo; |
| 634 |
|
/* is current fragment OK? */ |
| 635 |
|
if (hp->bl[i] == NULL || (nrays = hp->bl[i]->nrm) == hp->bi[i].nrd) |
| 636 |
|
return(0); |
| 637 |
< |
if (hdfragflags&FF_WRITE && hp->bi[i].nrd) |
| 638 |
< |
hdfreefrag(hp, i); /* relinquish old fragment */ |
| 637 |
> |
/* relinquish old fragment? */ |
| 638 |
> |
fragfreed = hdfragflags&FF_WRITE && hp->bi[i].nrd && hdfreefrag(hp,i); |
| 639 |
|
if (nrays) { /* get and write new fragment */ |
| 640 |
|
nfo = hdallocfrag(hp->fd, nrays); |
| 641 |
|
errno = 0; |
| 652 |
|
hp->bi[i].fo = 0L; |
| 653 |
|
biglob(hp)->nrd += nrays - hp->bi[i].nrd; |
| 654 |
|
hp->bi[i].nrd = nrays; |
| 655 |
< |
hdmarkdirty(hp, i); /* section directory now out of date */ |
| 655 |
> |
if (!fragfreed) |
| 656 |
> |
hdmarkdirty(hp, i); /* need to flag dir. ent. */ |
| 657 |
|
return(1); |
| 658 |
|
} |
| 659 |
|
|
| 729 |
|
if (hp->bl[i] != NULL) { /* free memory */ |
| 730 |
|
blglob(hp)->nrm -= nchanged = hp->bl[i]->nrm; |
| 731 |
|
free((char *)hp->bl[i]); |
| 732 |
+ |
hp->bl[i] = NULL; |
| 733 |
|
} else |
| 734 |
|
nchanged = hp->bi[i].nrd; |
| 735 |
< |
if (hp->bi[i].nrd) { |
| 736 |
< |
if (hdfragflags&FF_KILL) |
| 737 |
< |
hdfreefrag(hp, i); |
| 734 |
< |
biglob(hp)->nrd -= hp->bi[i].nrd; |
| 735 |
< |
hp->bi[i].nrd = 0; /* make sure it's gone */ |
| 735 |
> |
if (hp->bi[i].nrd && !(hdfragflags&FF_KILL && hdfreefrag(hp,i))) { |
| 736 |
> |
biglob(hp)->nrd -= hp->bi[i].nrd; /* free failed */ |
| 737 |
> |
hp->bi[i].nrd = 0; |
| 738 |
|
hp->bi[i].fo = 0L; |
| 739 |
+ |
hdmarkdirty(hp, i); |
| 740 |
|
} |
| 738 |
– |
hp->bl[i] = NULL; |
| 741 |
|
return(nchanged); |
| 742 |
|
} |
| 743 |
|
|