54 int minh,
int maxh,
int rate)
56 int keep, pct, i, n = 0;
60 while(minsz > 1024*(1<<n)) n++;
62 else if (n && minsz < 1024*(1<<n)) n--;
66 if (maxh < 0) maxh = 0;
67 if (minh < 0) minh = 0;
68 if (maxh < minh) maxh = minh;
69 if (rate < 0) rate = 0;
73 if (!(slots = maxsz / incBsz)) slots = 1;
74 else if (maxsz % incBsz) slots++;
75 maxBsz = slots << shfBsz;
79 bSlot =
new BuffSlot[(
unsigned int)slots];
84 for (i = 0; i < slots; i++)
85 {bSlot[i].size = n; n += incBsz;
86 pct = (slots - i + 1)*100/slots;
87 if (pct >= 100) keep = maxh;
88 else {keep = ((maxh * pct) + 55)/100 - i*rate;
89 if (keep > maxh) keep = maxh;
90 else if (keep < minh) keep = minh;
92 bSlot[i].maxbuff = keep;
102 XrdOucBuffPool::BuffSlot *sP;
108 snum = (bsz <= incBsz ? 0 : (bsz + rndBsz) >> shfBsz);
109 if (snum >= slots)
return 0;
114 sP->SlotMutex.
Lock();
118 if ((bP = sP->buffFree))
119 {sP->buffFree = bP->buffNext;
125 if (sP->size >= alignit) mema = alignit;
126 else if (sP->size > 2048) mema = 4096;
127 else if (sP->size > 1024) mema = 2048;
129 if (posix_memalign((
void **)&(bP->data), mema, sP->size))