Преглед изворни кода

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
Fabio M. Di Nitto пре 16 година
родитељ
комит
951a416532
1 измењених фајлова са 11 додато и 0 уклоњено
  1. 11 0
      exec/logsys.c

+ 11 - 0
exec/logsys.c

@@ -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));