List:Commits« Previous MessageNext Message »
From:vvaintroub Date:February 12 2008 9:40pm
Subject:bk commit into 6.0 tree (vlad:1.2813) BUG#33484
View as plain text  
Below is the list of changes that have just been committed into a local
6.0 repository of vlad. When vlad does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2008-02-12 15:40:50-05:00, vlad@stripped +1 -0
  Bug#33484 - 
  Cannot create Falcon table due to error in pwrite() on Linux 2.4 on 
  NFS file system. The problem was file system specific 
  alignment/buffersize requirement when using O_DIRECT on Linux 2.4 (
  on NFS it is 32KB), incompatible with Falcon buffer sizes.
  
  Solution: do not use O_DIRECT on Linux < 2.6, since it is too 
  complicated. If somebody want performance , he would need 2.6 
  anyway.

  storage/falcon/IO.cpp@stripped, 2008-02-12 15:40:47-05:00, vlad@stripped
+34 -6
    - Do not use O_DIRECT on linux versions < 2.6
    - Correct inconsistent indentation

diff -Nrup a/storage/falcon/IO.cpp b/storage/falcon/IO.cpp
--- a/storage/falcon/IO.cpp	2008-01-31 14:25:43 -05:00
+++ b/storage/falcon/IO.cpp	2008-02-12 15:40:47 -05:00
@@ -43,13 +43,18 @@
 #include "config.h"
 #endif
 
-#ifdef TARGET_OS_LINUX
+#ifdef  __linux__
 #include <linux/unistd.h>
+#include <sys/utsname.h>
+static  int getLinuxVersion();
+#define KERNEL_VERSION(a, b, c)	((a)<<16 | (b)<<8 | (c))
+#define haveBrokenODirect()	(getLinuxVersion() < KERNEL_VERSION(2,6,0))
 #else
-#define   LOCK_SH   1	/* shared lock */
-#define   LOCK_EX   2	/* exclusive lock */
-#define   LOCK_NB   4	/* don't block when locking */
-#define   LOCK_UN   8	/* unlock */
+#define LOCK_SH   1	/* shared lock */
+#define LOCK_EX   2	/* exclusive lock */
+#define LOCK_NB   4	/* don't block when locking */
+#define LOCK_UN   8	/* unlock */
+#define haveBrokenODirect()	0
 #endif
 #include <sys/file.h>
 #define O_BINARY		0
@@ -57,6 +62,7 @@
 #define MKDIR(dir)			mkdir(dir, S_IRUSR | S_IRGRP | S_IROTH | S_IWUSR | S_IWGRP | S_IXUSR
| S_IXGRP)
 #endif
 
+
 #ifndef O_SYNC
 #define O_SYNC		0
 #endif
@@ -630,7 +636,7 @@ void IO::reportWrites(void)
 int IO::getWriteMode(int attempt)
 {
 #ifdef O_DIRECT
-	if (attempt == 0 && falcon_direct_io > 0)
+	if (attempt == 0 && falcon_direct_io > 0 && !haveBrokenODirect())
 		return O_DIRECT;
 #endif
 
@@ -639,3 +645,25 @@ int IO::getWriteMode(int attempt)
 	
 	return 0;
 }
+
+#ifdef __linux__
+static int getLinuxVersion()
+{
+	static int vers = -1;
+
+	if(vers != -1)
+		return vers;
+
+	struct utsname utsname;
+
+	if(uname(&utsname) == -1)
+		return vers = 0;
+
+	int major, minor ,release;
+
+	if (sscanf(utsname.release,"%d.%d.%d",&major, &minor,&release) != 3)
+		return vers = 0;
+
+	return vers = KERNEL_VERSION(major,minor,release);
+}
+#endif
Thread
bk commit into 6.0 tree (vlad:1.2813) BUG#33484vvaintroub12 Feb 2008