flight recorder: enable temporary 0 buffer size protection

The flight recoder doesn't handle a 0 byte allocation properly
and it would fail miserably by allocating a single PAGE_SIZE
to handle the logging. That means an enormous performance hit
because of the constant wrapping around the buffer.

If any requested buffer is < 64000 bytes, then force to at least
64000.

In future we will be able to handle small buffers properly, but
for now enable a simple workaround to protect us and the user.



git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@2256 fd59a12c-fef9-0310-b244-a6a79926bd2f
This commit is contained in:
Fabio M. Di Nitto 2009-06-18 18:14:00 +00:00
parent 9a94d633cf
commit 951a416532

View File

@ -1057,6 +1057,17 @@ int _logsys_rec_init (unsigned int fltsize)
*/
size_t flt_real_size;
/*
* XXX: kill me for 1.1 because I am a dirty hack
* temporary workaround that will be replaced by supporting
* 0 byte size flight recorder buffer.
* 0 byte size buffer will enable direct printing to logs
* without flight recoder.
*/
if (fltsize < 64000) {
fltsize = 64000;
}
flt_real_size = ROUNDUP(
(fltsize + (2 * sizeof (unsigned int))),
sysconf(_SC_PAGESIZE));