Author: glen                         Date: Tue Dec 22 07:33:41 2009 GMT
Module: packages                      Tag: MYSQL_5_0
---- Log message:
- 5.0.87-b20

---- Files affected:
packages/mysql:
   mysql-innodb_rw_lock.patch (1.1.2.4 -> 1.1.2.5) , percona.sh (1.4 -> 1.5) 

---- Diffs:

================================================================
Index: packages/mysql/mysql-innodb_rw_lock.patch
diff -u packages/mysql/mysql-innodb_rw_lock.patch:1.1.2.4 
packages/mysql/mysql-innodb_rw_lock.patch:1.1.2.5
--- packages/mysql/mysql-innodb_rw_lock.patch:1.1.2.4   Wed Aug 26 12:17:02 2009
+++ packages/mysql/mysql-innodb_rw_lock.patch   Tue Dec 22 08:33:35 2009
@@ -1,215 +1,550 @@
+diff -ruN a/innobase/btr/btr0cur.c b/innobase/btr/btr0cur.c
+--- a/innobase/btr/btr0cur.c   2009-10-22 15:15:05.000000000 +0900
++++ b/innobase/btr/btr0cur.c   2009-10-22 15:18:44.000000000 +0900
+@@ -313,7 +313,7 @@
+ #ifdef UNIV_SEARCH_PERF_STAT
+       info->n_searches++;
+ #endif        
+-      if (btr_search_latch.writer == RW_LOCK_NOT_LOCKED
++      if (rw_lock_get_writer(&btr_search_latch) == RW_LOCK_NOT_LOCKED
+               && latch_mode <= BTR_MODIFY_LEAF && info->last_hash_succ
+               && !estimate
+ #ifdef PAGE_CUR_LE_OR_EXTENDS
 diff -ruN a/innobase/btr/btr0sea.c b/innobase/btr/btr0sea.c
---- a/innobase/btr/btr0sea.c   2009-05-20 14:21:44.000000000 +0900
-+++ b/innobase/btr/btr0sea.c   2009-05-20 14:39:34.000000000 +0900
-@@ -773,7 +773,7 @@
+--- a/innobase/btr/btr0sea.c   2009-10-22 15:15:05.000000000 +0900
++++ b/innobase/btr/btr0sea.c   2009-10-22 15:18:44.000000000 +0900
+@@ -773,8 +773,8 @@
                rw_lock_s_lock(&btr_search_latch);
        }
  
 -      ut_ad(btr_search_latch.writer != RW_LOCK_EX);
-+      ut_ad(btr_search_latch.writer_count == 0);
-       ut_ad(btr_search_latch.reader_count > 0);
+-      ut_ad(btr_search_latch.reader_count > 0);
++      ut_ad(rw_lock_get_writer(&btr_search_latch) != RW_LOCK_EX);
++      ut_ad(rw_lock_get_reader_count(&btr_search_latch) > 0);
  
        rec = ha_search_and_get_data(btr_search_sys->hash_index, fold);
-diff -ruN a/innobase/include/sync0rw.h b/innobase/include/sync0rw.h
---- a/innobase/include/sync0rw.h       2009-01-30 06:42:20.000000000 +0900
-+++ b/innobase/include/sync0rw.h       2009-04-16 16:15:28.000000000 +0900
-@@ -325,7 +325,17 @@
- Accessor functions for rw lock. */
- UNIV_INLINE
- ulint
--rw_lock_get_waiters(
-+rw_lock_get_s_waiters(
-+/*==================*/
-+      rw_lock_t*      lock);
-+UNIV_INLINE
-+ulint
-+rw_lock_get_x_waiters(
-+/*==================*/
-+      rw_lock_t*      lock);
-+UNIV_INLINE
-+ulint
-+rw_lock_get_wx_waiters(
- /*================*/
-       rw_lock_t*      lock);
- UNIV_INLINE
-@@ -408,6 +418,17 @@
-       rw_lock_debug_t*        info);  /* in: debug struct */
- #endif /* UNIV_SYNC_DEBUG */
  
+diff -ruN a/innobase/buf/buf0buf.c b/innobase/buf/buf0buf.c
+--- a/innobase/buf/buf0buf.c   2009-10-22 15:15:05.000000000 +0900
++++ b/innobase/buf/buf0buf.c   2009-10-22 15:18:44.000000000 +0900
+@@ -1292,7 +1292,7 @@
+ 
+       if (mode == BUF_GET_NOWAIT) {
+               if (rw_latch == RW_S_LATCH) {
+-                      success = rw_lock_s_lock_func_nowait(&(block->lock),
++                      success = rw_lock_s_lock_nowait(&(block->lock),
+                                                               file, line);
+                       fix_type = MTR_MEMO_PAGE_S_FIX;
+               } else {
+@@ -1442,7 +1442,7 @@
+       ut_ad(!ibuf_inside() || ibuf_page(block->space, block->offset));
+ 
+       if (rw_latch == RW_S_LATCH) {
+-              success = rw_lock_s_lock_func_nowait(&(block->lock),
++              success = rw_lock_s_lock_nowait(&(block->lock),
+                                                               file, line);
+               fix_type = MTR_MEMO_PAGE_S_FIX;
+       } else {
+@@ -1596,7 +1596,7 @@
+       ut_ad(!ibuf_inside() || (mode == BUF_KEEP_OLD));
+ 
+       if (rw_latch == RW_S_LATCH) {
+-              success = rw_lock_s_lock_func_nowait(&(block->lock),
++              success = rw_lock_s_lock_nowait(&(block->lock),
+                                                               file, line);
+               fix_type = MTR_MEMO_PAGE_S_FIX;
+       } else {
+diff -ruN a/innobase/include/buf0buf.ic b/innobase/include/buf0buf.ic
+--- a/innobase/include/buf0buf.ic      2009-10-22 15:15:05.000000000 +0900
++++ b/innobase/include/buf0buf.ic      2009-10-22 16:12:25.000000000 +0900
+@@ -523,7 +523,7 @@
+ #ifdef UNIV_SYNC_DEBUG        
+       ibool   ret;
+ 
+-      ret = rw_lock_s_lock_func_nowait(&(block->debug_latch), file, line);
++      ret = rw_lock_s_lock_nowait(&(block->debug_latch), file, line);
+ 
+       ut_ad(ret == TRUE);
+       ut_ad(mutex_own(&block->mutex));
+diff -ruN a/innobase/include/os0sync.h b/innobase/include/os0sync.h
+--- a/innobase/include/os0sync.h       2009-09-10 04:02:59.000000000 +0900
++++ b/innobase/include/os0sync.h       2009-10-22 15:18:44.000000000 +0900
+@@ -1,11 +1,35 @@
++/*****************************************************************************
++
++Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved.
++Copyright (c) 2008, Google Inc.
++
++Portions of this file contain modifications contributed and copyrighted by
++Google, Inc. Those modifications are gratefully acknowledged and are described
++briefly in the InnoDB documentation. The contributions by Google are
++incorporated with their permission, and subject to the conditions contained in
++the file COPYING.Google.
++
++This program is free software; you can redistribute it and/or modify it under
++the terms of the GNU General Public License as published by the Free Software
++Foundation; version 2 of the License.
++
++This program is distributed in the hope that it will be useful, but WITHOUT
++ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
++FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
++
++You should have received a copy of the GNU General Public License along with
++this program; if not, write to the Free Software Foundation, Inc., 59 Temple
++Place, Suite 330, Boston, MA 02111-1307 USA
++
++*****************************************************************************/
++
+ /******************************************************
+ The interface to the operating system
+ synchronization primitives.
+ 
+-(c) 1995 Innobase Oy
+-
+ Created 9/6/1995 Heikki Tuuri
+ *******************************************************/
++
+ #ifndef os0sync_h
+ #define os0sync_h
+ 
+@@ -261,6 +285,23 @@
+ /*===============*/
+       os_fast_mutex_t*        fast_mutex);    /* in: mutex to free */
+       
 +#ifdef HAVE_ATOMIC_BUILTINS
-+/* This value means NOT_LOCKED */
-+#define RW_LOCK_BIAS          0x00100000
-+#else
-+#error HAVE_ATOMIC_BUILTINS is not defined. Do you use enough new GCC or 
compatibles?
-+#error Or do you use exact options for CFLAGS?
-+#error e.g. (for x86_32): "-m32 -march=i586 -mtune=i686"
-+#error e.g. (for Sparc_64): "-m64 -mcpu=v9"
-+#error Otherwise, this build may be slower than normal version.
-+#endif
++/**************************************************************
++Atomic compare-and-swap for InnoDB. Currently requires GCC atomic builtins.
++Returns true if swapped, ptr is pointer to target, old_val is value to
++compare to, new_val is the value to swap in. */
++#define os_compare_and_swap(ptr, old_val, new_val) \
++      __sync_bool_compare_and_swap(ptr, old_val, new_val)
++
++/**************************************************************
++Atomic increment for InnoDB. Currently requires GCC atomic builtins.
++Returns the resulting value, ptr is pointer to target, amount is the
++amount of increment. */
++#define os_atomic_increment(ptr, amount) \
++      __sync_add_and_fetch(ptr, amount)
++
++#endif /* HAVE_ATOMIC_BUILTINS */
++
+ #ifndef UNIV_NONINL
+ #include "os0sync.ic"
+ #endif
+diff -ruN a/innobase/include/sync0rw.h b/innobase/include/sync0rw.h
+--- a/innobase/include/sync0rw.h       2009-09-10 04:02:59.000000000 +0900
++++ b/innobase/include/sync0rw.h       2009-10-22 15:18:44.000000000 +0900
+@@ -1,8 +1,31 @@
++/*****************************************************************************
++
++Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved.
++Copyright (c) 2008, Google Inc.
++
++Portions of this file contain modifications contributed and copyrighted by
++Google, Inc. Those modifications are gratefully acknowledged and are described
++briefly in the InnoDB documentation. The contributions by Google are
++incorporated with their permission, and subject to the conditions contained in
++the file COPYING.Google.
++
++This program is free software; you can redistribute it and/or modify it under
++the terms of the GNU General Public License as published by the Free Software
++Foundation; version 2 of the License.
++
++This program is distributed in the hope that it will be useful, but WITHOUT
++ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
++FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
++
++You should have received a copy of the GNU General Public License along with
++this program; if not, write to the Free Software Foundation, Inc., 59 Temple
++Place, Suite 330, Boston, MA 02111-1307 USA
++
++*****************************************************************************/
 +
- /* NOTE! The structure appears here only for the compiler to know its size.
- Do not use its fields directly! The structure used in the spin lock
- implementation of a read-write lock. Several threads may have a shared lock
-@@ -417,9 +438,9 @@
+ /******************************************************
+ The read-write lock (for threads, not for database transactions)
+ 
+-(c) 1995 Innobase Oy
+-
+ Created 9/11/1995 Heikki Tuuri
+ *******************************************************/
+ 
+@@ -24,6 +47,12 @@
+ #define       RW_X_LATCH      2
+ #define       RW_NO_LATCH     3
+ 
++/* We decrement lock_word by this amount for each x_lock. It is also the
++start value for the lock_word, meaning that it limits the maximum number
++of concurrent read locks before the rw_lock breaks. The current value of
++0x00100000 allows 1,048,575 concurrent readers and 2047 recursive writers.*/
++#define X_LOCK_DECR           0x00100000
++
+ typedef struct rw_lock_struct         rw_lock_t;
+ #ifdef UNIV_SYNC_DEBUG
+ typedef struct rw_lock_debug_struct   rw_lock_debug_t;
+@@ -47,14 +76,14 @@
+                                       there may be waiters for the event */
+ #endif /* UNIV_SYNC_DEBUG */
+ 
+-extern        ulint   rw_s_system_call_count;
+-extern        ulint   rw_s_spin_wait_count;
+-extern        ulint   rw_s_exit_count;
+-extern        ulint   rw_s_os_wait_count;
+-extern        ulint   rw_x_system_call_count;
+-extern        ulint   rw_x_spin_wait_count;
+-extern        ulint   rw_x_os_wait_count;
+-extern        ulint   rw_x_exit_count;
++extern        ib_longlong     rw_s_spin_wait_count;
++extern        ib_longlong     rw_s_spin_round_count;
++extern        ib_longlong     rw_s_exit_count;
++extern        ib_longlong     rw_s_os_wait_count;
++extern        ib_longlong     rw_x_spin_wait_count;
++extern        ib_longlong     rw_x_spin_round_count;
++extern        ib_longlong     rw_x_os_wait_count;
++extern        ib_longlong     rw_x_exit_count;
+ 
+ /**********************************************************************
+ Creates, or rather, initializes an rw-lock object in a specified memory
+@@ -116,8 +145,22 @@
+ NOTE! The following macros should be used in rw s-locking, not the
+ corresponding function. */
+ 
+-#define rw_lock_s_lock_nowait(M)    rw_lock_s_lock_func_nowait(\
+-                                           (M), __FILE__, __LINE__)
++#define rw_lock_s_lock_nowait(M, F, L)    rw_lock_s_lock_low(\
++                                        (M), 0, (F), (L))
++/**********************************************************************
++Low-level function which tries to lock an rw-lock in s-mode. Performs no
++spinning. */
++UNIV_INLINE
++ibool
++rw_lock_s_lock_low(
++/*===============*/
++                              /* out: TRUE if success */
++      rw_lock_t*      lock,   /* in: pointer to rw-lock */
++      ulint           pass __attribute__((unused)),
++                              /* in: pass value; != 0, if the lock will be
++                              passed to another thread to unlock */
++      const char*     file_name, /* in: file name where lock requested */
++      ulint           line);  /* in: line where requested */
+ /**********************************************************************
+ NOTE! Use the corresponding macro, not directly this function, except if
+ you supply the file name and line number. Lock an rw-lock in shared mode
+@@ -135,18 +178,6 @@
+       const char*     file_name,/* in: file name where lock requested */
+       ulint           line);  /* in: line where requested */
+ /**********************************************************************
+-NOTE! Use the corresponding macro, not directly this function, except if
+-you supply the file name and line number. Lock an rw-lock in shared mode
+-for the current thread if the lock can be acquired immediately. */
+-UNIV_INLINE
+-ibool
+-rw_lock_s_lock_func_nowait(
+-/*=======================*/
+-                              /* out: TRUE if success */
+-        rw_lock_t*    lock,   /* in: pointer to rw-lock */
+-      const char*     file_name,/* in: file name where lock requested */
+-      ulint           line);  /* in: line where requested */
+-/**********************************************************************
+ NOTE! Use the corresponding macro, not directly this function! Lock an
+ rw-lock in exclusive mode for the current thread if the lock can be
+ obtained immediately. */
+@@ -338,6 +369,41 @@
+ rw_lock_get_reader_count(
+ /*=====================*/
+       rw_lock_t*      lock);
++/**********************************************************************
++Decrements lock_word the specified amount if it is greater than 0.
++This is used by both s_lock and x_lock operations. */
++UNIV_INLINE
++ibool
++rw_lock_lock_word_decr(
++/*===================*/
++                                      /* out: TRUE if decr occurs */
++      rw_lock_t*      lock,           /* in: rw-lock */
++      ulint           amount);        /* in: amount to decrement */
++/**********************************************************************
++Increments lock_word the specified amount and returns new value. */
++UNIV_INLINE
++lint
++rw_lock_lock_word_incr(
++/*===================*/
++                                      /* out: TRUE if decr occurs */
++      rw_lock_t*      lock,
++      ulint           amount);        /* in: rw-lock */
++/**********************************************************************
++This function sets the lock->writer_thread and lock->recursive fields.
++For platforms where we are using atomic builtins instead of lock->mutex
++it sets the lock->writer_thread field using atomics to ensure memory
++ordering. Note that it is assumed that the caller of this function
++effectively owns the lock i.e.: nobody else is allowed to modify
++lock->writer_thread at this point in time.
++The protocol is that lock->writer_thread MUST be updated BEFORE the
++lock->recursive flag is set. */
++UNIV_INLINE
++void
++rw_lock_set_writer_id_and_recursion_flag(
++/*=====================================*/
++      rw_lock_t*      lock,           /* in/out: lock to work on */
++      ibool           recursive);     /* in: TRUE if recursion
++                                      allowed */
+ #ifdef UNIV_SYNC_DEBUG
+ /**********************************************************************
+ Checks if the thread has locked the rw-lock in the specified mode, with
+@@ -417,47 +483,33 @@
  field. Then no new readers are allowed in. */
  
  struct rw_lock_struct {
--      os_event_t      event;  /* Used by sync0arr.c for thread queueing */
++      volatile lint   lock_word;
++                              /* Holds the state of the lock. */
++      volatile ulint  waiters;/* 1: there are waiters */
++      volatile ibool  recursive;/* Default value FALSE which means the lock
++                              is non-recursive. The value is typically set
++                              to TRUE making normal rw_locks recursive. In
++                              case of asynchronous IO, when a non-zero
++                              value of 'pass' is passed then we keep the
++                              lock non-recursive.
++                              This flag also tells us about the state of
++                              writer_thread field. If this flag is set
++                              then writer_thread MUST contain the thread
++                              id of the current x-holder or wait-x thread.
++                              This flag must be reset in x_unlock
++                              functions before incrementing the lock_word */
++      volatile os_thread_id_t writer_thread;
++                              /* Thread id of writer thread. Is only
++                              guaranteed to have sane and non-stale
++                              value iff recursive flag is set. */
+       os_event_t      event;  /* Used by sync0arr.c for thread queueing */
 -
 -#ifdef __WIN__
-+                      /* Used by sync0arr.c for thread queueing */
-+      os_event_t      s_event;        /* Used for s_lock */
-+      os_event_t      x_event;        /* Used for x_lock */
-       os_event_t      wait_ex_event;  /* This windows specific event is
-                               used by the thread which has set the
-                               lock state to RW_LOCK_WAIT_EX. The
-@@ -427,31 +448,35 @@
-                               thread will be the next one to proceed
-                               once the current the event gets
-                               signalled. See LEMMA 2 in sync0sync.c */
-+
-+#ifdef HAVE_ATOMIC_BUILTINS
-+      volatile lint   lock_word;      /* Used by using atomic builtin */
- #endif
- 
+-      os_event_t      wait_ex_event;  /* This windows specific event is
+-                              used by the thread which has set the
+-                              lock state to RW_LOCK_WAIT_EX. The
+-                              rw_lock design guarantees that this
+-                              thread will be the next one to proceed
+-                              once the current the event gets
+-                              signalled. See LEMMA 2 in sync0sync.c */
+-#endif
+-
 -      ulint   reader_count;   /* Number of readers who have locked this
-+      volatile ulint  reader_count;   /* Number of readers who have locked 
this
-                               lock in the shared mode */
+-                              lock in the shared mode */
 -      ulint   writer;         /* This field is set to RW_LOCK_EX if there
-+      volatile ulint  writer;         /* This field is set to RW_LOCK_EX if 
there
-                               is a writer owning the lock (in exclusive
-                               mode), RW_LOCK_WAIT_EX if a writer is
-                               queueing for the lock, and
-                               RW_LOCK_NOT_LOCKED, otherwise. */
+-                              is a writer owning the lock (in exclusive
+-                              mode), RW_LOCK_WAIT_EX if a writer is
+-                              queueing for the lock, and
+-                              RW_LOCK_NOT_LOCKED, otherwise. */
 -      os_thread_id_t  writer_thread;
-+      volatile os_thread_id_t writer_thread;
-                               /* Thread id of a possible writer thread */
+-                              /* Thread id of a possible writer thread */
 -      ulint   writer_count;   /* Number of times the same thread has
-+      volatile ulint  writer_count;   /* Number of times the same thread has
-                               recursively locked the lock in the exclusive
-                               mode */
+-                              recursively locked the lock in the exclusive
+-                              mode */
++      os_event_t      wait_ex_event;
++                              /* Event for next-writer to wait on. A thread
++                              must decrement lock_word before waiting. */
 +#ifndef HAVE_ATOMIC_BUILTINS
        mutex_t mutex;          /* The mutex protecting rw_lock_struct */
-+#endif
-       ulint   pass;           /* Default value 0. This is set to some
-                               value != 0 given by the caller of an x-lock
-                               operation, if the x-lock is to be passed to
-                               another thread to unlock (which happens in
-                               asynchronous i/o). */
+-      ulint   pass;           /* Default value 0. This is set to some
+-                              value != 0 given by the caller of an x-lock
+-                              operation, if the x-lock is to be passed to
+-                              another thread to unlock (which happens in
+-                              asynchronous i/o). */
 -      ulint   waiters;        /* This ulint is set to 1 if there are
 -                              waiters (readers or writers) in the global
 -                              wait array, waiting for this rw_lock.
 -                              Otherwise, == 0. */
 -      ibool   writer_is_wait_ex;
-+      volatile ulint  s_waiters; /* 1: there are waiters (s_lock) */
-+      volatile ulint  x_waiters; /* 1: there are waiters (x_lock) */
-+      volatile ulint  wait_ex_waiters; /* 1: there are waiters (wait_ex) */
-+      volatile ibool  writer_is_wait_ex;
-                               /* This is TRUE if the writer field is
-                               RW_LOCK_WAIT_EX; this field is located far
-                               from the memory update hotspot fields which
+-                              /* This is TRUE if the writer field is
+-                              RW_LOCK_WAIT_EX; this field is located far
+-                              from the memory update hotspot fields which
+-                              are at the start of this struct, thus we can
+-                              peek this field without causing much memory
+-                              bus traffic */
++#endif /* HAVE_ATOMIC_BUILTINS */
++
+       UT_LIST_NODE_T(rw_lock_t) list;
+                               /* All allocated rw locks are put into a
+                               list */
+@@ -465,15 +517,23 @@
+       UT_LIST_BASE_NODE_T(rw_lock_debug_t) debug_list;
+                               /* In the debug version: pointer to the debug
+                               info list of the lock */
++      ulint   level;          /* Level in the global latching order. */
+ #endif /* UNIV_SYNC_DEBUG */
+-      ulint   level;          /* Level in the global latching
+-                              order; default SYNC_LEVEL_NONE */
++      ulint count_os_wait;    /* Count of os_waits. May not be accurate */
+       const char*     cfile_name;/* File name where lock created */
+-      ulint   cline;          /* Line where created */
++        /* last s-lock file/line is not guaranteed to be correct */
+       const char*     last_s_file_name;/* File name where last s-locked */
+       const char*     last_x_file_name;/* File name where last x-locked */
+-      ulint   last_s_line;    /* Line number where last time s-locked */
+-      ulint   last_x_line;    /* Line number where last time x-locked */
++      ibool           writer_is_wait_ex;
++                              /* This is TRUE if the writer field is
++                              RW_LOCK_WAIT_EX; this field is located far
++                              from the memory update hotspot fields which
++                              are at the start of this struct, thus we can
++                              peek this field without causing much memory
++                              bus traffic */
++      unsigned        cline:14;       /* Line where created */
++      unsigned        last_s_line:14; /* Line number where last time s-locked 
*/
++      unsigned        last_x_line:14; /* Line number where last time x-locked 
*/
+       ulint   magic_n;
+ };
+ 
 diff -ruN a/innobase/include/sync0rw.ic b/innobase/include/sync0rw.ic
---- a/innobase/include/sync0rw.ic      2009-01-30 06:42:20.000000000 +0900
-+++ b/innobase/include/sync0rw.ic      2009-04-16 17:06:53.000000000 +0900
-@@ -47,20 +47,64 @@
- Accessor functions for rw lock. */
- UNIV_INLINE
+--- a/innobase/include/sync0rw.ic      2009-09-10 04:02:59.000000000 +0900
++++ b/innobase/include/sync0rw.ic      2009-10-22 15:18:44.000000000 +0900
+@@ -1,8 +1,31 @@
++/*****************************************************************************
++
++Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved.
++Copyright (c) 2008, Google Inc.
++
++Portions of this file contain modifications contributed and copyrighted by
++Google, Inc. Those modifications are gratefully acknowledged and are described
++briefly in the InnoDB documentation. The contributions by Google are
++incorporated with their permission, and subject to the conditions contained in
++the file COPYING.Google.
++
++This program is free software; you can redistribute it and/or modify it under
++the terms of the GNU General Public License as published by the Free Software
++Foundation; version 2 of the License.
++
++This program is distributed in the hope that it will be useful, but WITHOUT
++ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
++FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
++
++You should have received a copy of the GNU General Public License along with
++this program; if not, write to the Free Software Foundation, Inc., 59 Temple
++Place, Suite 330, Boston, MA 02111-1307 USA
++
++*****************************************************************************/
++
+ /******************************************************
+ The read-write lock (for threads)
+ 
+-(c) 1995 Innobase Oy
+-
+ Created 9/11/1995 Heikki Tuuri
+ *******************************************************/
+ 
+@@ -49,53 +72,88 @@
  ulint
--rw_lock_get_waiters(
-+rw_lock_get_s_waiters(
+ rw_lock_get_waiters(
  /*================*/
-       rw_lock_t*      lock)
+-      rw_lock_t*      lock)
++                              /* out: 1 if waiters, 0 otherwise */
++      rw_lock_t*      lock)   /* in: rw-lock */
  {
--      return(lock->waiters);
-+      return(lock->s_waiters);
+       return(lock->waiters);
  }
++
++/************************************************************************
++Sets lock->waiters to 1. It is not an error if lock->waiters is already
++1. On platforms where ATOMIC builtins are used this function enforces a
++memory barrier. */
  UNIV_INLINE
--void
+ void
 -rw_lock_set_waiters(
-+ulint
-+rw_lock_get_x_waiters(
- /*================*/
-+      rw_lock_t*      lock)
-+{
-+      return(lock->x_waiters);
-+}
-+UNIV_INLINE
-+ulint
-+rw_lock_get_wx_waiters(
-+/*================*/
-+      rw_lock_t*      lock)
-+{
-+      return(lock->wait_ex_waiters);
-+}
-+UNIV_INLINE
-+void
-+rw_lock_set_s_waiters(
-       rw_lock_t*      lock,
-       ulint           flag)
+-/*================*/
+-      rw_lock_t*      lock,
+-      ulint           flag)
++rw_lock_set_waiter_flag(
++/*====================*/
++      rw_lock_t*      lock)   /* in: rw-lock */
  {
 -      lock->waiters = flag;
 +#ifdef HAVE_ATOMIC_BUILTINS
-+      __sync_lock_test_and_set(&lock->s_waiters, flag);
-+#else
-+      lock->s_waiters = flag;
-+#endif
-+}
-+UNIV_INLINE
-+void
-+rw_lock_set_x_waiters(
-+      rw_lock_t*      lock,
-+      ulint           flag)
-+{
-+#ifdef HAVE_ATOMIC_BUILTINS
-+      __sync_lock_test_and_set(&lock->x_waiters, flag);
-+#else
-+      lock->x_waiters = flag;
-+#endif
-+}
-+UNIV_INLINE
<<Diff was trimmed, longer than 597 lines>>

---- CVS-web:
    
http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/mysql/mysql-innodb_rw_lock.patch?r1=1.1.2.4&r2=1.1.2.5&f=u
    
http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/mysql/percona.sh?r1=1.4&r2=1.5&f=u

_______________________________________________
pld-cvs-commit mailing list
[email protected]
http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit

Reply via email to