[Bizgres-general] bitmap.h again
Mark Kirkwood
markir at paradise.net.nz
Fri Jan 27 09:41:53 GMT 2006
I hear cries of 'Noooooooooo...' from the Bizgres boys, but. err , I
have a suggested change to the new (i.e patch 01-15) bitmap.h.
Essentially it reflects that fact that there are 2 equations to solve:
no_header_words = no_words/wordsize_bits (1)
no_words*wordsize_bytes + no_headerwords*wordsize_bytes <=
max_possible_words*wordsize_bytes (2)
we can solve these via simple substitution of (1) into (2):
no_headerwords*wordsize_bits*wordsize_bytes +
no_headerwords*wordsize_bytes <= max_possible_words*wordsize_bytes
Now divide out wordsize_bytes:
no_headerwords*wordsize_bits + no_headerwords*wordsize=bytes <=
max_possible_words
Factorize and divide:
no_headerwords <= max_possible_words/(1 + wordsize_bits)
Clearly we can then use this equation with <= changed to = .
For typical cases, this changes the values of max header words and
number of words per page from (1020, 7140) to (906, 7248).
Note that currently you could actually only use 893 or the 1020 header
words!
Hey - it's not earth shattering, but may as well pack 'em it as tight as
we can!
Cheers
Mark
-------------- next part --------------
--- src/include/access/bitmap.h.orig Fri Jan 27 21:18:17 2006
+++ src/include/access/bitmap.h Fri Jan 27 21:19:26 2006
@@ -135,7 +135,7 @@
MAXALIGN(sizeof(PageHeaderData)) - \
MAXALIGN(sizeof(BMBitmapOpaqueData)))/sizeof(BM_HRL_WORD))
#define BM_MAX_NUM_OF_HEADER_WORDS \
- (BM_MAX_NUM_OF_HRL_WORDS_PER_PAGE/BM_HRL_WORD_SIZE)
+ (BM_MAX_NUM_OF_HRL_WORDS_PER_PAGE/(BM_HRL_WORD_SIZE + 1))
#define BM_NUM_OF_HRL_WORDS_PER_PAGE \
(BM_MAX_NUM_OF_HRL_WORDS_PER_PAGE - BM_MAX_NUM_OF_HEADER_WORDS)
More information about the Bizgres-general
mailing list