--- rrdtool-1.0.49/src/rrd_open.c_orig	2004-08-08 05:58:14.000000000 -0500
+++ rrdtool-1.0.49/src/rrd_open.c	2007-04-13 16:23:44.000000000 -0500
@@ -10,8 +10,10 @@
  *
  *****************************************************************************/
 
+#define _POSIX_C_SOURCE 200112L /* for posix_fadvise */
 #include "rrd_tool.h"
 #define MEMBLK 8192
+#include <fcntl.h> /* for posix_fadvise */
 
 /* open a database file, return its header and a open filehandle */
 /* positioned to the first cdp in the first rra */
@@ -41,6 +43,12 @@
 	rrd_set_error("opening '%s': %s",file_name, strerror(errno));
 	return (-1);
     }
+
+    /* on Linux 2.6.9, POSIX_FADV_RANDOM supresses read-ahead */
+    if (0 != posix_fadvise(fileno(*in_file), 0, 0, POSIX_FADV_RANDOM)) {
+       fclose(*in_file);
+       return(-1);
+    }
     
 #define MYFREAD(MYVAR,MYVART,MYCNT) \
     if ((MYVAR = malloc(sizeof(MYVART) * MYCNT)) == NULL) {\
