List:Commits« Previous MessageNext Message »
From:Marc Alff Date:July 30 2009 4:33pm
Subject:bzr commit into mysql-5.4-perfschema branch (marc.alff:2841)
View as plain text  
#At file:///home/malff/BZR-TREE/mysql-azalea-perfschema/ based on revid:marc.alff@stripped

 2841 Marc Alff	2009-07-30
      Revised the previous fix in the file io instrumentation,
      fixed the code interpreting the return value of my_read/my_write/etc.
      Minor cleanup in pfs_atomic.
      modified:
        include/mysql/psi/mysql_file.h
        storage/perfschema/pfs_atomic.cc

=== modified file 'include/mysql/psi/mysql_file.h'
--- a/include/mysql/psi/mysql_file.h	2009-07-30 15:11:22 +0000
+++ b/include/mysql/psi/mysql_file.h	2009-07-30 16:33:11 +0000
@@ -761,12 +761,10 @@ inline_mysql_file_fread(
   if (locker)
   {
     size_t bytes_read;
-    if (result)
-      /* my_fread does not always return the number of bytes read. */
-      bytes_read= (flags & (MY_NABP | MY_FNABP)) ? count : (size_t) result;
+    if (flags & (MY_NABP | MY_FNABP))
+      bytes_read= (result == 0) ? count : 0;
     else
-      /* reporting 0 in case of error */
-      bytes_read= 0;
+      bytes_read= (result > 0) ? (size_t) result : 0;
     PSI_server->end_file_wait(locker, bytes_read);
   }
 #endif
@@ -793,12 +791,10 @@ inline_mysql_file_fwrite(
   if (locker)
   {
     size_t bytes_written;
-    if (result)
-      /* my_fwrite does not always return the number of bytes written. */
-      bytes_written= (flags & (MY_NABP | MY_FNABP)) ? count : (size_t) result;
+    if (flags & (MY_NABP | MY_FNABP))
+      bytes_written= (result == 0) ? count : 0;
     else
-      /* reporting 0 in case of error */
-      bytes_written= 0;
+      bytes_written= (result > 0) ? (size_t) result : 0;
     PSI_server->end_file_wait(locker, bytes_written);
   }
 #endif
@@ -963,12 +959,10 @@ inline_mysql_file_read(
   if (locker)
   {
     size_t bytes_read;
-    if (result)
-      /* my_read does not always return the number of bytes read. */
-      bytes_read= (flags & (MY_NABP | MY_FNABP)) ? count : (size_t) result;
+    if (flags & (MY_NABP | MY_FNABP))
+      bytes_read= (result == 0) ? count : 0;
     else
-      /* reporting 0 in case of error */
-      bytes_read= 0;
+      bytes_read= (result > 0) ? (size_t) result : 0;
     PSI_server->end_file_wait(locker, bytes_read);
   }
 #endif
@@ -995,12 +989,10 @@ inline_mysql_file_write(
   if (locker)
   {
     size_t bytes_written;
-    if (result)
-      /* my_write does not always return the number of bytes written. */
-      bytes_written= (flags & (MY_NABP | MY_FNABP)) ? count : (size_t) result;
+    if (flags & (MY_NABP | MY_FNABP))
+      bytes_written= (result == 0) ? count : 0;
     else
-      /* reporting 0 in case of error */
-      bytes_written= 0;
+      bytes_written= (result > 0) ? (size_t) result : 0;
     PSI_server->end_file_wait(locker, bytes_written);
   }
 #endif
@@ -1027,12 +1019,10 @@ inline_mysql_file_pread(
   if (locker)
   {
     size_t bytes_read;
-    if (result)
-      /* my_pread does not always return the number of bytes read. */
-      bytes_read= (flags & (MY_NABP | MY_FNABP)) ? count : (size_t) result;
+    if (flags & (MY_NABP | MY_FNABP))
+      bytes_read= (result == 0) ? count : 0;
     else
-      /* reporting 0 in case of error */
-      bytes_read= 0;
+      bytes_read= (result > 0) ? (size_t) result : 0;
     PSI_server->end_file_wait(locker, bytes_read);
   }
 #endif
@@ -1059,12 +1049,10 @@ inline_mysql_file_pwrite(
   if (locker)
   {
     size_t bytes_written;
-    if (result)
-      /* my_pwrite does not always return the number of bytes written. */
-      bytes_written= (flags & (MY_NABP | MY_FNABP)) ? count : (size_t) result;
+    if (flags & (MY_NABP | MY_FNABP))
+      bytes_written= (result == 0) ? count : 0;
     else
-      /* reporting 0 in case of error */
-      bytes_written= 0;
+      bytes_written= (result > 0) ? (size_t) result : 0;
     PSI_server->end_file_wait(locker, bytes_written);
   }
 #endif

=== modified file 'storage/perfschema/pfs_atomic.cc'
--- a/storage/perfschema/pfs_atomic.cc	2009-07-30 15:22:07 +0000
+++ b/storage/perfschema/pfs_atomic.cc	2009-07-30 16:33:11 +0000
@@ -62,21 +62,17 @@ my_atomic_rwlock_t PFS_atomic::m_rwlock_
 
 void PFS_atomic::init(void)
 {
-#ifdef MY_ATOMIC_MODE_RWLOCKS
   uint i;
 
   for (i=0; i< array_elements(m_rwlock_array); i++)
     my_atomic_rwlock_init(& m_rwlock_array[i]);
-#endif
 }
 
 void PFS_atomic::cleanup(void)
 {
-#ifdef MY_ATOMIC_MODE_RWLOCKS
   uint i;
 
   for (i=0; i< array_elements(m_rwlock_array); i++)
     my_atomic_rwlock_destroy(& m_rwlock_array[i]);
-#endif
 }
 

Thread
bzr commit into mysql-5.4-perfschema branch (marc.alff:2841) Marc Alff30 Jul
  • Re: bzr commit into mysql-5.4-perfschema branch (marc.alff:2841)Guilhem Bichot30 Jul
    • Re: bzr commit into mysql-5.4-perfschema branch (marc.alff:2841)Marc Alff31 Jul
      • Re: bzr commit into mysql-5.4-perfschema branch (marc.alff:2841)Guilhem Bichot31 Jul