INN commit: trunk/storage/buffindexed (buffindexed.c)
INN Commit
Russ_Allbery at isc.org
Sat Nov 29 10:27:58 UTC 2008
Date: Saturday, November 29, 2008 @ 02:27:57
Author: iulius
Revision: 8192
Data placement optimization for buffindexed; the main idea is to place data
as tight as possible; current implementation scatters data over all
unavailable disk space.
This fix leads to a drastic reduction of expireover runtime (for instance
from 9 hours to about 1 hour or so).
Patch from Kirill Berezin.
Modified:
trunk/storage/buffindexed/buffindexed.c
---------------+
buffindexed.c | 30 ++++++++++--------------------
1 file changed, 10 insertions(+), 20 deletions(-)
Modified: buffindexed.c
===================================================================
--- buffindexed.c 2008-11-24 07:25:19 UTC (rev 8191)
+++ buffindexed.c 2008-11-29 10:27:57 UTC (rev 8192)
@@ -758,36 +758,26 @@
static void ovnextblock(OVBUFF *ovbuff) {
int i, j, last, lastbit, left;
- ULONG mask = 0x80000000;
ULONG *table;
last = ovbuff->totalblk/(sizeof(long) * 8);
if ((left = ovbuff->totalblk % (sizeof(long) * 8)) != 0) {
last++;
}
+
table = ((ULONG *) ovbuff->bitfield + (OV_BEFOREBITF / sizeof(long)));
- for (i = ovbuff->nextchunk ; i < last ; i++) {
- if (i == last - 1 && left != 0) {
- for (j = 1 ; j < left ; j++) {
- mask |= mask >> 1;
- }
- if ((table[i] & mask) != mask)
- break;
- } else {
- if ((table[i] ^ ~0) != 0)
- break;
- }
+
+ /* For tighter placement look for unused block from the begining on
+ * every run. */
+ for (i = 0 ; i < last ; i++) {
+ if ((table[i] ^ ~0) != 0)
+ break;
}
if (i == last) {
- for (i = 0 ; i < ovbuff->nextchunk ; i++) {
- if ((table[i] ^ ~0) != 0)
- break;
- }
- if (i == ovbuff->nextchunk) {
- ovbuff->freeblk = ovbuff->totalblk;
- return;
- }
+ ovbuff->freeblk = ovbuff->totalblk;
+ return;
}
+
if ((i - 1) >= 0 && (last - 1 == i) && left != 0) {
lastbit = left;
} else {
More information about the inn-committers
mailing list