#define MAXNUMSYSNAMES 32 /* max that current constants allow */
#define NOTOKTIMEOUT (2*3600) /* time after which to timeout conns sans tokens */
#define NOPAG 0xffffffff
-#define AFS_NCBRS 300 /* max # of call back return entries */
-#define AFS_MAXCBRSCALL 16 /* max to return in a given call */
+#define AFS_NCBRS 1024 /* max # of call back return entries */
+#define AFS_MAXCBRSCALL 32 /* max to return in a given call (must be <= AFSCBMAX) */
#define AFS_SALLOC_LOW_WATER 250 /* Min free blocks before allocating more */
#define AFS_LRALLOCSIZ 4096 /* "Large" allocated size */
#define VCACHE_FREE 5
struct afs_cbr *hash_next;
struct AFSFid fid;
+ unsigned int dynalloc:1;
};
/* cellinfo file magic number */
*/
static struct afs_cbr *afs_cbrSpace = 0;
/* if alloc limit below changes, fix me! */
-static struct afs_cbr *afs_cbrHeads[2];
+static struct afs_cbr *afs_cbrHeads[16];
struct afs_cbr *
afs_AllocCBR(void)
{
register struct afs_cbr *tsp;
int i;
- while (!afs_cbrSpace) {
- if (afs_stats_cmperf.CallBackAlloced >= 2) {
- /* don't allocate more than 2 * AFS_NCBRS for now */
- afs_FlushVCBs(0);
+ if (!afs_cbrSpace) {
+ afs_osi_CancelWait(&AFS_WaitHandler); /* trigger FlushVCBs asap */
+
+ if (afs_stats_cmperf.CallBackAlloced >= sizeof(afs_cbrHeads)/sizeof(afs_cbrHeads[0])) {
+ /* don't allocate more than 16 * AFS_NCBRS for now */
+ tsp = (struct afs_cbr *)osi_AllocSmallSpace(sizeof(*tsp));
+ tsp->dynalloc = 1;
+ tsp->next = NULL;
afs_stats_cmperf.CallBackFlushes++;
} else {
/* try allocating */
sizeof(struct afs_cbr));
for (i = 0; i < AFS_NCBRS - 1; i++) {
tsp[i].next = &tsp[i + 1];
+ tsp[i].dynalloc = 0;
}
tsp[AFS_NCBRS - 1].next = 0;
- afs_cbrSpace = tsp;
+ tsp[AFS_NCBRS - 1].dynalloc = 0;
+ afs_cbrSpace = tsp->next;
afs_cbrHeads[afs_stats_cmperf.CallBackAlloced] = tsp;
afs_stats_cmperf.CallBackAlloced++;
}
+ } else {
+ tsp = afs_cbrSpace;
+ afs_cbrSpace = tsp->next;
}
- tsp = afs_cbrSpace;
- afs_cbrSpace = tsp->next;
return tsp;
}
if (asp->hash_next)
asp->hash_next->hash_pprev = asp->hash_pprev;
- asp->next = afs_cbrSpace;
- afs_cbrSpace = asp;
+ if (asp->dynalloc) {
+ osi_FreeSmallSpace(asp);
+ } else {
+ asp->next = afs_cbrSpace;
+ afs_cbrSpace = asp;
+ }
return 0;
}