On Wed, Oct 15, 2008 at 11:55:26AM +0100, [EMAIL PROTECTED] wrote:
> Now using munmap followed by a new call to mmap
> 
> This has a few consequences:
> 
> - The effects of any previous madvise calls will be lost, it should only
> be an issue for rrd_create though as nothing else should append the rrd
> file.

Daniel,

#ifdef MMAP, it looks like the code in r1601 would end up calling mremap
(now munmap/mmap) for every piece of the header?  It looks like it would
be called every time the file is extended.  I count (4+DS*2+RRA) extensions.

I think a better approach would be to determine the length of the file in
advance and just create/mmap it once.  I already wrote the code that
determines the size of the data portion (it's in rrd_open):

      off_t correct_len = rrd_file->header_len +
        sizeof(rrd_value_t) * row_cnt * rrd->stat_head->ds_cnt;

It should be a trivial matter to pre-determine the rrd_file->header_len.
Then you can create the entire file once and mmap it.  There will be no
need to munmap/mmap repeatedly.

-- 
 kevin brintnall =~ /[EMAIL PROTECTED]/

_______________________________________________
rrd-developers mailing list
rrd-developers@lists.oetiker.ch
https://lists.oetiker.ch/cgi-bin/listinfo/rrd-developers

Reply via email to