storage tokens duplications
Julien ÉLIE
julien at trigofacile.com
Sat Sep 5 16:07:27 UTC 2009
Hi,
> There is only the function which generates a token and the one which breaks
> a token in timecaf.c to patch so that not to use short ints (16 bits) but ARTNUM
> (32 bits).
Now fixed, thanks to Kamil Jonca.
I have also updated README.CAF to mention better sizes:
%%%
Each CAF file has a blocksize associated with it (512 bytes). The layout of a CAF
file is as follows:
1. Header (~300 bytes) containing information like low and high
article numbers, amount of free space, blocksize.
2. Free space bitmap (size given by the FreeZoneTabSize field of the
header). Its index is ~212 bytes (in fact, it is exactly between the end
of the header and the end of the block). Its main part depends on the
length of the index (n bits for the index => n bytes for the main free
space bitmap, therefore ~1696 blocks, thus ~868KB). Consequently, the
maximal length of a CAF file is ~3.5GB.
3. CAFTOCENTs (CAF Table of Contents Entries), 1 per article storable
in the file. Each CAFTOCENT gives the article's size, creation time,
and offset in the CAF file. Usually space is alloted in the CAF file
for 262144 CAFTOCENTs, even if the # of articles in the CAF file is
nowhere near that amount. The unused CAFTOCENTs are all zeros, and
this means CAF files are almost always sparse.
4. Articles, always stored starting at blocksize boundaries.
%%%
Limits are 3.5GB or 262144 articles in a CAF.
However, I have serious concerns on 64-bit architectures.
size_t, off_t, time_t and unsigned int could be 64-bit integers
and not 32-bit integers... When it is the case, the header has a length
greater than 512 blocks.
#define CAF_DEFAULT_FZSIZE (512-sizeof(CAFHEADER))
head.BlockSize = 512;
head.FreeZoneIndexSize = head.BlockSize - sizeof(CAFHEADER);
which is negative... And I believe the code happily breaks afterwards
at run time.
Two solutions:
* modify the block size from 512 bytes to something higher (1024? 4096?);
* only modify the length of the head (sizeof(CAFHEADER)/blocksize + 1).
Maybe the second approach is better.
--
Julien ÉLIE
« Je ne suis ni pour ni contre, bien au contraire ! » (Coluche)
More information about the inn-workers
mailing list