List:Commits« Previous MessageNext Message »
From:Marc Alff Date:May 7 2009 6:44am
Subject:bzr push into mysql-6.0-perfschema branch (marc.alff:3134 to 3135)
View as plain text  
 3135 Marc Alff	2009-05-07
      Implemented code review comments, continued
modified:
  include/mysql/psi/psi.h
  include/waiting_threads.h
  mysql-test/suite/perfschema/r/start_server64_on.result
  mysys/mf_keycache.c
  mysys/my_init.c
  mysys/thr_lock.c
  mysys/waiting_threads.c
  sql/mysqld.cc
  sql/tztime.cc
  storage/archive/azio.h
  storage/archive/ha_archive.cc
  storage/example/ha_example.cc
  storage/falcon/ha_falcon.cpp
  storage/federated/ha_federated.cc
  storage/federated/ha_federated.h
  storage/innobase/handler/ha_innodb.cc
  storage/maria/ma_dbug.c
  storage/maria/ma_examine_non_trans_log.c
  storage/maria/ma_ft_eval.c
  storage/maria/ma_loghandler.c
  storage/maria/ma_pagecache.c
  storage/maria/ma_static.c
  storage/maria/ma_test1.c
  storage/maria/ma_test2.c
  storage/maria/ma_test3.c
  storage/maria/ma_write.c
  storage/maria/maria_chk.c
  storage/maria/maria_def.h
  storage/maria/maria_pack.c
  storage/maria/maria_read_log.c
  storage/perfschema/pfs_instr.cc
  storage/perfschema/pfs_instr.h

 3134 Marc Alff	2009-05-06 [merge]
      Merge mysql-6.0 --> mysql-6.0-perfschema
removed:
  mysql-test/include/wait_for_status_var.inc
  mysql-test/suite/rpl/t/rpl_000015-slave.sh
added:
  mysql-test/collections/mysql-6.0-bugteam.push
  mysql-test/include/diff_master_slave.inc
  mysql-test/include/kill_query.inc
  mysql-test/include/kill_query_and_diff_master_slave.inc
  mysql-test/include/wait_for_status_var.inc
  mysql-test/r/myisam_crash_before_flush_keys.result
  mysql-test/r/myisam_debug.result
  mysql-test/r/parser_not_embedded.result
  mysql-test/std_data/bug37631.MYD
  mysql-test/std_data/bug37631.MYI
  mysql-test/std_data/bug37631.frm
  mysql-test/suite/bugs/r/rpl_bug38205.result
  mysql-test/suite/bugs/t/rpl_bug38205.test
  mysql-test/suite/ibmdb2i/
  mysql-test/suite/ibmdb2i/include/
  mysql-test/suite/ibmdb2i/include/have_i61.inc
  mysql-test/suite/ibmdb2i/include/have_ibmdb2i.inc
  mysql-test/suite/ibmdb2i/r/
  mysql-test/suite/ibmdb2i/r/ibmdb2i_bug_44020.result
  mysql-test/suite/ibmdb2i/r/ibmdb2i_bug_44025.result
  mysql-test/suite/ibmdb2i/t/
  mysql-test/suite/ibmdb2i/t/ibmdb2i_bug_44020.test
  mysql-test/suite/ibmdb2i/t/ibmdb2i_bug_44025.test
  mysql-test/suite/rpl/r/rpl_bug38694.result
  mysql-test/suite/rpl/r/rpl_init_slave_errors.result
  mysql-test/suite/rpl/r/rpl_killed_ddl.result
  mysql-test/suite/rpl/r/rpl_name_const.result
  mysql-test/suite/rpl/t/rpl_bug38694-slave.opt
  mysql-test/suite/rpl/t/rpl_bug38694.test
  mysql-test/suite/rpl/t/rpl_init_slave_errors.test
  mysql-test/suite/rpl/t/rpl_killed_ddl-master.opt
  mysql-test/suite/rpl/t/rpl_killed_ddl.test
  mysql-test/suite/rpl/t/rpl_name_const.test
  mysql-test/suite/rpl/t/rpl_start_stop_slave-slave.opt
  mysql-test/t/myisam_crash_before_flush_keys-master.opt
  mysql-test/t/myisam_crash_before_flush_keys.test
  mysql-test/t/myisam_debug.test
  mysql-test/t/parser_not_embedded.test
modified:
  BUILD/compile-alpha-ccc
  BUILD/compile-alpha-debug
  BUILD/compile-dist
  BUILD/compile-solaris-amd64
  BUILD/compile-solaris-sparc
  BUILD/compile-solaris-sparc-debug
  BUILD/compile-solaris-sparc-purify
  client/mysql.cc
  cmd-line-utils/libedit/readline/readline.h
  cmd-line-utils/libedit/term.c
  cmd-line-utils/libedit/vi.c
  config/ac-macros/libevent_configure.m4
  config/ac-macros/misc.m4
  configure.in
  extra/libevent/epoll.c
  include/my_global.h
  include/my_pthread.h
  include/thr_lock.h
  libmysql/Makefile.shared
  mysql-test/extra/rpl_tests/rpl_deadlock.test
  mysql-test/include/handler.inc
  mysql-test/include/mix1.inc
  mysql-test/lib/My/SafeProcess/Makefile.am
  mysql-test/mysql-test-run.pl
  mysql-test/r/count_distinct3.result
  mysql-test/r/ctype_utf32.result
  mysql-test/r/fulltext.result
  mysql-test/r/func_des_encrypt.result
  mysql-test/r/func_encrypt.result
  mysql-test/r/func_misc.result
  mysql-test/r/func_sapdb.result
  mysql-test/r/func_set.result
  mysql-test/r/func_str.result
  mysql-test/r/gis-rtree.result
  mysql-test/r/gis.result
  mysql-test/r/handler_innodb.result
  mysql-test/r/handler_myisam.result
  mysql-test/r/innodb.result
  mysql-test/r/innodb_mysql.result
  mysql-test/r/insert.result
  mysql-test/r/lock_multi.result
  mysql-test/r/merge.result
  mysql-test/r/myisam.result
  mysql-test/r/myisampack.result
  mysql-test/r/mysqlbinlog_row_big.result
  mysql-test/r/mysqldump.result
  mysql-test/r/not_embedded_server.result
  mysql-test/r/parser.result
  mysql-test/r/partition.result
  mysql-test/r/partition_mgm.result
  mysql-test/r/perror.result
  mysql-test/r/ps_1general.result
  mysql-test/r/repair.result
  mysql-test/r/shm.result
  mysql-test/r/sp-ucs2.result
  mysql-test/r/sp.result
  mysql-test/r/trigger.result
  mysql-test/r/type_time.result
  mysql-test/r/union.result
  mysql-test/r/upgrade.result
  mysql-test/r/varbinary.result
  mysql-test/r/variables-big.result
  mysql-test/r/variables-notembedded.result
  mysql-test/r/xml.result
  mysql-test/suite/binlog/r/binlog_stm_ps.result
  mysql-test/suite/binlog/r/binlog_unsafe.result
  mysql-test/suite/binlog/t/binlog_unsafe.test
  mysql-test/suite/funcs_1/t/disabled.def
  mysql-test/suite/funcs_2/charset/charset_master.test
  mysql-test/suite/perfschema/r/binlog_stmt.result
  mysql-test/suite/perfschema/r/myisam_file_io.result
  mysql-test/suite/rpl/include/rpl_mixed_ddl.inc
  mysql-test/suite/rpl/r/rpl_bug33931.result
  mysql-test/suite/rpl/r/rpl_deadlock_innodb.result
  mysql-test/suite/rpl/r/rpl_heartbeat.result
  mysql-test/suite/rpl/r/rpl_idempotency.result
  mysql-test/suite/rpl/r/rpl_skip_error.result
  mysql-test/suite/rpl/r/rpl_start_stop_slave.result
  mysql-test/suite/rpl/r/rpl_stm_loadfile.result
  mysql-test/suite/rpl/r/rpl_sync.result
  mysql-test/suite/rpl/r/rpl_udf.result
  mysql-test/suite/rpl/t/disabled.def
  mysql-test/suite/rpl/t/rpl_binlog_corruption.test
  mysql-test/suite/rpl/t/rpl_bug33931.test
  mysql-test/suite/rpl/t/rpl_heartbeat.test
  mysql-test/suite/rpl/t/rpl_idempotency.test
  mysql-test/suite/rpl/t/rpl_skip_error.test
  mysql-test/suite/rpl/t/rpl_start_stop_slave.test
  mysql-test/suite/rpl/t/rpl_sync.test
  mysql-test/suite/rpl/t/rpl_temp_table_mix_row.test
  mysql-test/suite/sys_vars/r/binlog_cache_size_basic_64.result
  mysql-test/suite/sys_vars/r/bulk_insert_buffer_size_basic_64.result
  mysql-test/suite/sys_vars/r/delayed_insert_limit_basic_64.result
  mysql-test/suite/sys_vars/r/delayed_queue_size_basic_64.result
  mysql-test/suite/sys_vars/r/join_buffer_size_basic_64.result
  mysql-test/suite/sys_vars/r/key_buffer_size_basic_64.result
  mysql-test/suite/sys_vars/r/log_warnings_basic_64.result
  mysql-test/suite/sys_vars/r/max_binlog_cache_size_basic_64.result
  mysql-test/suite/sys_vars/r/max_connect_errors_basic_64.result
  mysql-test/suite/sys_vars/r/max_heap_table_size_basic_64.result
  mysql-test/suite/sys_vars/r/max_seeks_for_key_basic_64.result
  mysql-test/suite/sys_vars/r/max_tmp_tables_basic_64.result
  mysql-test/suite/sys_vars/r/max_write_lock_count_basic_64.result
  mysql-test/suite/sys_vars/r/min_examined_row_limit_basic_64.result
  mysql-test/suite/sys_vars/r/myisam_max_sort_file_size_basic_64.result
  mysql-test/suite/sys_vars/r/myisam_repair_threads_basic_64.result
  mysql-test/suite/sys_vars/r/myisam_sort_buffer_size_basic_64.result
  mysql-test/suite/sys_vars/r/net_retry_count_basic_64.result
  mysql-test/suite/sys_vars/r/query_alloc_block_size_basic_64.result
  mysql-test/suite/sys_vars/r/query_cache_limit_basic_64.result
  mysql-test/suite/sys_vars/r/query_cache_min_res_unit_basic_64.result
  mysql-test/suite/sys_vars/r/query_cache_size_basic_64.result
  mysql-test/suite/sys_vars/r/query_prealloc_size_basic_64.result
  mysql-test/suite/sys_vars/r/range_alloc_block_size_basic_64.result
  mysql-test/suite/sys_vars/r/rpl_recovery_rank_basic_64.result
  mysql-test/suite/sys_vars/r/slave_transaction_retries_basic_64.result
  mysql-test/suite/sys_vars/r/sync_binlog_basic_64.result
  mysql-test/suite/sys_vars/r/tmp_table_size_basic.result
  mysql-test/suite/sys_vars/r/transaction_prealloc_size_basic_64.result
  mysql-test/suite/sys_vars/r/wait_timeout_basic_64.result
  mysql-test/suite/sys_vars/t/disabled.def
  mysql-test/suite/sys_vars/t/tmp_table_size_basic.test
  mysql-test/t/count_distinct3.test
  mysql-test/t/ctype_utf32.test
  mysql-test/t/disabled.def
  mysql-test/t/fulltext.test
  mysql-test/t/func_des_encrypt.test
  mysql-test/t/func_encrypt.test
  mysql-test/t/func_misc.test
  mysql-test/t/func_sapdb.test
  mysql-test/t/func_set.test
  mysql-test/t/func_str.test
  mysql-test/t/gis-rtree.test
  mysql-test/t/gis.test
  mysql-test/t/innodb_mysql.test
  mysql-test/t/insert.test
  mysql-test/t/lock_multi.test
  mysql-test/t/merge.test
  mysql-test/t/myisam.test
  mysql-test/t/myisampack.test
  mysql-test/t/mysqlbinlog_row_big.test
  mysql-test/t/mysqldump.test
  mysql-test/t/not_embedded_server.test
  mysql-test/t/parser.test
  mysql-test/t/partition.test
  mysql-test/t/partition_mgm.test
  mysql-test/t/ps_1general.test
  mysql-test/t/shm.test
  mysql-test/t/sp-ucs2.test
  mysql-test/t/sp.test
  mysql-test/t/sp_trans_log.test
  mysql-test/t/trigger.test
  mysql-test/t/type_time.test
  mysql-test/t/union.test
  mysql-test/t/upgrade.test
  mysql-test/t/variables-big.test
  mysql-test/t/variables-notembedded-master.opt
  mysql-test/t/xml.test
  mysys/charset.c
  mysys/mf_keycache.c
  mysys/my_init.c
  mysys/my_thr_init.c
  mysys/thr_mutex.c
  scripts/mysql_install_db.sh
  scripts/mysql_setpermission.sh
  scripts/mysqld_multi.sh
  scripts/mysqlhotcopy.sh
  sql/backup/backup_info.cc
  sql/backup/stream_v1.c
  sql/backup/stream_v1.h
  sql/backup/stream_v1_transport.c
  sql/events.cc
  sql/field.cc
  sql/handler.cc
  sql/item.cc
  sql/item_cmpfunc.cc
  sql/item_func.cc
  sql/item_geofunc.cc
  sql/item_strfunc.cc
  sql/item_strfunc.h
  sql/item_timefunc.cc
  sql/item_xmlfunc.cc
  sql/log.cc
  sql/log_event.cc
  sql/mysql_priv.h
  sql/parse_file.cc
  sql/parse_file.h
  sql/rpl_filter.cc
  sql/share/errmsg.txt
  sql/slave.cc
  sql/sp.cc
  sql/sp_head.cc
  sql/sp_head.h
  sql/sp_pcontext.cc
  sql/sp_pcontext.h
  sql/sql_acl.cc
  sql/sql_base.cc
  sql/sql_class.cc
  sql/sql_crypt.cc
  sql/sql_crypt.h
  sql/sql_db.cc
  sql/sql_delete.cc
  sql/sql_handler.cc
  sql/sql_lex.cc
  sql/sql_lex.h
  sql/sql_parse.cc
  sql/sql_partition.cc
  sql/sql_rename.cc
  sql/sql_repl.cc
  sql/sql_select.cc
  sql/sql_table.cc
  sql/sql_test.cc
  sql/sql_view.cc
  sql/sql_view.h
  sql/sql_yacc.yy
  storage/falcon/Interlock.h
  storage/falcon/plug.in
  storage/ibmdb2i/Makefile.am
  storage/ibmdb2i/db2i_collationSupport.cc
  storage/ibmdb2i/db2i_misc.h
  storage/ibmdb2i/ha_ibmdb2i.cc
  storage/myisam/CMakeLists.txt
  storage/myisam/ft_boolean_search.c
  storage/myisam/ha_myisam.cc
  storage/myisam/mi_close.c
  storage/myisam/mi_delete.c
  storage/myisam/mi_dynrec.c
  storage/myisam/mi_open.c
  storage/myisam/mi_packrec.c
  storage/myisam/mi_write.c
  storage/myisam/myisamchk.c
  storage/myisammrg/ha_myisammrg.cc
  storage/ndb/tools/restore/consumer_restore.cpp
  storage/ndb/tools/restore/consumer_restorem.cpp
  support-files/mysql.spec.sh
  tests/mysql_client_test.c
  vio/viosocket.c
  win/Makefile.am

=== modified file 'include/mysql/psi/psi.h'
--- a/include/mysql/psi/psi.h	2009-05-05 23:03:45 +0000
+++ b/include/mysql/psi/psi.h	2009-05-07 06:42:31 +0000
@@ -244,31 +244,36 @@ struct PSI_table_locker;
 
 /**
   Instrumented mutex key.
-  This is an opaque key.
+  To instrument a mutex, a mutex key must be obtained using @c register_mutex.
+  Using a zero key always disable the instrumentation.
 */
 typedef unsigned int PSI_mutex_key;
 
 /**
   Instrumented rwlock key.
-  This is an opaque key.
+  To instrument a rwlock, a rwlock key must be obtained using @c register_rwlock.
+  Using a zero key always disable the instrumentation.
 */
 typedef unsigned int PSI_rwlock_key;
 
 /**
   Instrumented cond key.
-  This is an opaque key.
+  To instrument a condition, a condition key must be obtained using @c register_cond.
+  Using a zero key always disable the instrumentation.
 */
 typedef unsigned int PSI_cond_key;
 
 /**
   Instrumented thread key.
-  This is an opaque key.
+  To instrument a thread, a thread key must be obtained using @c register_thread.
+  Using a zero key always disable the instrumentation.
 */
 typedef unsigned int PSI_thread_key;
 
 /**
   Instrumented file key.
-  This is an opaque key.
+  To instrument a file, a file key must be obtained using @c register_file.
+  Using a zero key always disable the instrumentation.
 */
 typedef unsigned int PSI_file_key;
 

=== modified file 'include/waiting_threads.h'
--- a/include/waiting_threads.h	2009-02-23 11:55:35 +0000
+++ b/include/waiting_threads.h	2009-05-07 06:42:31 +0000
@@ -23,6 +23,10 @@
 
 C_MODE_START
 
+#ifdef HAVE_PSI_INTERFACE
+extern void my_init_wt_psi_keys(void);
+#endif
+
 typedef struct st_wt_resource_id WT_RESOURCE_ID;
 typedef struct st_wt_resource WT_RESOURCE;
 
@@ -120,7 +124,7 @@ void wt_end(void);
 void wt_thd_lazy_init(WT_THD *, const ulong *, const ulong *, const ulong *, const ulong *);
 void wt_thd_destroy(WT_THD *);
 int wt_thd_will_wait_for(WT_THD *, WT_THD *, const WT_RESOURCE_ID *);
-int wt_thd_cond_timedwait(WT_THD *, pthread_mutex_t *);
+int wt_thd_cond_timedwait(WT_THD *, mysql_mutex_t *);
 void wt_thd_release(WT_THD *, const WT_RESOURCE_ID *);
 #define wt_thd_release_all(THD) wt_thd_release((THD), 0)
 my_bool wt_resource_id_memcmp(const void *, const void *);

=== modified file 'mysql-test/suite/perfschema/r/start_server64_on.result'
--- a/mysql-test/suite/perfschema/r/start_server64_on.result	2009-04-17 18:44:53 +0000
+++ b/mysql-test/suite/perfschema/r/start_server64_on.result	2009-05-07 06:42:31 +0000
@@ -50,10 +50,10 @@ performance_schema	(PFS_COND).ROW_SIZE	8
 performance_schema	(PFS_COND).ROW_COUNT	1000
 performance_schema	(PFS_COND).ROW_LOST	0
 performance_schema	(PFS_COND).MEMORY	88000
-performance_schema	(PFS_THREAD).ROW_SIZE	496
+performance_schema	(PFS_THREAD).ROW_SIZE	488
 performance_schema	(PFS_THREAD).ROW_COUNT	1000
 performance_schema	(PFS_THREAD).ROW_LOST	0
-performance_schema	(PFS_THREAD).MEMORY	496000
+performance_schema	(PFS_THREAD).MEMORY	488000
 performance_schema	(PFS_FILE).ROW_SIZE	632
 performance_schema	(PFS_FILE).ROW_COUNT	1000
 performance_schema	(PFS_FILE).ROW_LOST	0
@@ -61,7 +61,7 @@ performance_schema	(PFS_FILE).MEMORY	632
 performance_schema	EVENTS_WAITS_SUMMARY_BY_THREAD_BY_NAME.ROW_SIZE	32
 performance_schema	EVENTS_WAITS_SUMMARY_BY_THREAD_BY_NAME.ROW_COUNT	350000
 performance_schema	EVENTS_WAITS_SUMMARY_BY_THREAD_BY_NAME.MEMORY	11200000
-performance_schema	PERFORMANCE_SCHEMA.MEMORY	15251800
+performance_schema	PERFORMANCE_SCHEMA.MEMORY	15243800
 performance_schema	PERFORMANCE_SCHEMA.LOST	0
 select count(*) from performance_schema.PERFORMANCE_TIMERS;
 count(*)

=== modified file 'mysys/mf_keycache.c'
--- a/mysys/mf_keycache.c	2009-05-06 23:00:55 +0000
+++ b/mysys/mf_keycache.c	2009-05-07 06:42:31 +0000
@@ -314,20 +314,20 @@ static long keycache_thread_id;
   ((uint) (((char*)(h)-(char *) keycache->hash_link_root)/sizeof(HASH_LINK)))
 
 #if (defined(KEYCACHE_TIMEOUT) && !defined(__WIN__)) || defined(KEYCACHE_DEBUG)
-static int keycache_MYSQL_COND_WAIT(mysql_cond_t *cond,
+static int keycache_pthread_cond_wait(mysql_cond_t *cond,
                                       mysql_mutex_t *mutex);
 #else
-#define  keycache_MYSQL_COND_WAIT MYSQL_COND_WAIT
+#define  keycache_pthread_cond_wait(C,M) MYSQL_COND_WAIT(C,M)
 #endif
 
 #if defined(KEYCACHE_DEBUG)
-static int keycache_MYSQL_MUTEX_LOCK(mysql_mutex_t *mutex);
-static void keycache_MYSQL_MUTEX_UNLOCK(mysql_mutex_t *mutex);
-static int keycache_MYSQL_COND_SIGNAL(mysql_cond_t *cond);
+static int keycache_pthread_mutex_lock(mysql_mutex_t *mutex);
+static void keycache_pthread_mutex_unlock(mysql_mutex_t *mutex);
+static int keycache_pthread_cond_signal(mysql_cond_t *cond);
 #else
-#define keycache_MYSQL_MUTEX_LOCK MYSQL_MUTEX_LOCK
-#define keycache_MYSQL_MUTEX_UNLOCK MYSQL_MUTEX_UNLOCK
-#define keycache_MYSQL_COND_SIGNAL MYSQL_COND_SIGNAL
+#define keycache_pthread_mutex_lock(M) MYSQL_MUTEX_LOCK(M)
+#define keycache_pthread_mutex_unlock(M) MYSQL_MUTEX_UNLOCK(M)
+#define keycache_pthread_cond_signal(C) MYSQL_COND_SIGNAL(C)
 #endif /* defined(KEYCACHE_DEBUG) */
 
 #if !defined(DBUG_OFF)
@@ -581,7 +581,7 @@ int resize_key_cache(KEY_CACHE *keycache
     DBUG_RETURN(keycache->disk_blocks);
   }
 
-  keycache_MYSQL_MUTEX_LOCK(&keycache->cache_lock);
+  keycache_pthread_mutex_lock(&keycache->cache_lock);
 
 #ifdef THREAD
   /*
@@ -664,7 +664,7 @@ finish:
   /* Signal waiting threads. */
   release_whole_queue(&keycache->resize_queue);
 
-  keycache_MYSQL_MUTEX_UNLOCK(&keycache->cache_lock);
+  keycache_pthread_mutex_unlock(&keycache->cache_lock);
   DBUG_RETURN(blocks);
 }
 
@@ -711,14 +711,14 @@ void change_key_cache_param(KEY_CACHE *k
 {
   DBUG_ENTER("change_key_cache_param");
 
-  keycache_MYSQL_MUTEX_LOCK(&keycache->cache_lock);
+  keycache_pthread_mutex_lock(&keycache->cache_lock);
   if (division_limit)
     keycache->min_warm_blocks= (keycache->disk_blocks *
 				division_limit / 100 + 1);
   if (age_threshold)
     keycache->age_threshold=   (keycache->disk_blocks *
 				age_threshold / 100);
-  keycache_MYSQL_MUTEX_UNLOCK(&keycache->cache_lock);
+  keycache_pthread_mutex_unlock(&keycache->cache_lock);
   DBUG_VOID_RETURN;
 }
 
@@ -938,7 +938,7 @@ static void wait_on_queue(KEYCACHE_WQUEU
   do
   {
     KEYCACHE_DBUG_PRINT("wait", ("suspend thread %ld", thread->id));
-    keycache_MYSQL_COND_WAIT(&thread->suspend, mutex);
+    keycache_pthread_cond_wait(&thread->suspend, mutex);
   }
   while (thread->next);
 }
@@ -977,7 +977,7 @@ static void release_whole_queue(KEYCACHE
     KEYCACHE_DBUG_PRINT("release_whole_queue: signal",
                         ("thread %ld", thread->id));
     /* Signal the thread. */
-    keycache_MYSQL_COND_SIGNAL(&thread->suspend);
+    keycache_pthread_cond_signal(&thread->suspend);
     /* Take thread from queue. */
     next=thread->next;
     thread->next= NULL;
@@ -1182,7 +1182,7 @@ static void link_block(KEY_CACHE *keycac
       if ((HASH_LINK *) thread->opt_info == hash_link)
       {
         KEYCACHE_DBUG_PRINT("link_block: signal", ("thread %ld", thread->id));
-        keycache_MYSQL_COND_SIGNAL(&thread->suspend);
+        keycache_pthread_cond_signal(&thread->suspend);
         unlink_from_queue(&keycache->waiting_for_block, thread);
         block->requests++;
       }
@@ -1448,7 +1448,7 @@ static void remove_reader(BLOCK_LINK *bl
   DBUG_ASSERT(block->hash_link->requests);
 #ifdef THREAD
   if (! --block->hash_link->requests && block->condvar)
-    keycache_MYSQL_COND_SIGNAL(block->condvar);
+    keycache_pthread_cond_signal(block->condvar);
 #else
   --block->hash_link->requests;
 #endif
@@ -1482,7 +1482,7 @@ static void wait_for_readers(KEY_CACHE *
     /* There must be no other waiter. We have no queue here. */
     DBUG_ASSERT(!block->condvar);
     block->condvar= &thread->suspend;
-    keycache_MYSQL_COND_WAIT(&thread->suspend, &keycache->cache_lock);
+    keycache_pthread_cond_wait(&thread->suspend, &keycache->cache_lock);
     block->condvar= NULL;
   }
 #else
@@ -1543,7 +1543,7 @@ static void unlink_hash(KEY_CACHE *keyca
       if (page->file == hash_link->file && page->filepos == hash_link->diskpos)
       {
         KEYCACHE_DBUG_PRINT("unlink_hash: signal", ("thread %ld", thread->id));
-        keycache_MYSQL_COND_SIGNAL(&thread->suspend);
+        keycache_pthread_cond_signal(&thread->suspend);
         unlink_from_queue(&keycache->waiting_for_hash_link, thread);
       }
     }
@@ -1631,7 +1631,7 @@ restart:
       link_into_queue(&keycache->waiting_for_hash_link, thread);
       KEYCACHE_DBUG_PRINT("get_hash_link: wait",
                         ("suspend thread %ld", thread->id));
-      keycache_MYSQL_COND_WAIT(&thread->suspend,
+      keycache_pthread_cond_wait(&thread->suspend,
                                  &keycache->cache_lock);
       thread->opt_info= NULL;
 #else
@@ -1800,7 +1800,7 @@ restart:
       {
         KEYCACHE_DBUG_PRINT("find_key_block: wait",
                             ("suspend thread %ld", thread->id));
-        keycache_MYSQL_COND_WAIT(&thread->suspend,
+        keycache_pthread_cond_wait(&thread->suspend,
                                    &keycache->cache_lock);
       } while (thread->next);
       thread->opt_info= NULL;
@@ -2148,7 +2148,7 @@ restart:
           {
             KEYCACHE_DBUG_PRINT("find_key_block: wait",
                                 ("suspend thread %ld", thread->id));
-            keycache_MYSQL_COND_WAIT(&thread->suspend,
+            keycache_pthread_cond_wait(&thread->suspend,
                                        &keycache->cache_lock);
           }
           while (thread->next);
@@ -2244,7 +2244,7 @@ restart:
                            BLOCK_CHANGED | BLOCK_IN_USE));
               DBUG_ASSERT(block->hash_link);
 
-              keycache_MYSQL_MUTEX_UNLOCK(&keycache->cache_lock);
+              keycache_pthread_mutex_unlock(&keycache->cache_lock);
               /*
                 The call is thread safe because only the current
                 thread might change the block->hash_link value
@@ -2257,7 +2257,7 @@ restart:
                                       MYF(MY_NABP | MY_WAIT_IF_FULL),
                                       keycache->post_write,
                                       block->post_write_arg);
-              keycache_MYSQL_MUTEX_LOCK(&keycache->cache_lock);
+              keycache_pthread_mutex_lock(&keycache->cache_lock);
 
               /* Block status must not have changed. */
               DBUG_ASSERT((block->status & ~BLOCK_IN_EVICTION) ==
@@ -2474,14 +2474,14 @@ static void read_block(KEY_CACHE *keycac
 
     keycache->global_cache_read++;
     /* Page is not in buffer yet, is to be read from disk */
-    keycache_MYSQL_MUTEX_UNLOCK(&keycache->cache_lock);
+    keycache_pthread_mutex_unlock(&keycache->cache_lock);
     /*
       Here other threads may step in and register as secondary readers.
       They will register in block->wqueue[COND_FOR_REQUESTED].
     */
     got_length= my_pread(block->hash_link->file, block->buffer,
                          read_length, block->hash_link->diskpos, MYF(0));
-    keycache_MYSQL_MUTEX_LOCK(&keycache->cache_lock);
+    keycache_pthread_mutex_lock(&keycache->cache_lock);
     /*
       The block can now have been marked for free (in case of
       FLUSH_RELEASE). Otherwise the state must be unchanged.
@@ -2587,7 +2587,7 @@ uchar *key_cache_read(KEY_CACHE *keycach
       disabled cache. We always increment and decrement
       'cnt_for_resize_op' so that a resizer can wait for pending I/O.
     */
-    keycache_MYSQL_MUTEX_LOCK(&keycache->cache_lock);
+    keycache_pthread_mutex_lock(&keycache->cache_lock);
     /*
       Cache resizing has two phases: Flushing and re-initializing. In
       the flush phase read requests are allowed to bypass the cache for
@@ -2642,10 +2642,10 @@ uchar *key_cache_read(KEY_CACHE *keycach
           Read directly from file.
         */
         keycache->global_cache_read++;
-        keycache_MYSQL_MUTEX_UNLOCK(&keycache->cache_lock);
+        keycache_pthread_mutex_unlock(&keycache->cache_lock);
         error= (my_pread(file, (uchar*) buff, read_length,
                          filepos + offset, MYF(MY_NABP)) != 0);
-        keycache_MYSQL_MUTEX_LOCK(&keycache->cache_lock);
+        keycache_pthread_mutex_lock(&keycache->cache_lock);
         goto next_block;
       }
       if (!(block->status & BLOCK_ERROR))
@@ -2687,7 +2687,7 @@ uchar *key_cache_read(KEY_CACHE *keycach
         {
           DBUG_ASSERT(block->status & (BLOCK_READ | BLOCK_IN_USE));
 #if !defined(SERIALIZED_READ_FROM_CACHE)
-          keycache_MYSQL_MUTEX_UNLOCK(&keycache->cache_lock);
+          keycache_pthread_mutex_unlock(&keycache->cache_lock);
 #endif
 
           /* Copy data from the cache buffer */
@@ -2697,7 +2697,7 @@ uchar *key_cache_read(KEY_CACHE *keycach
             memcpy(buff, block->buffer+offset, (size_t) read_length);
 
 #if !defined(SERIALIZED_READ_FROM_CACHE)
-          keycache_MYSQL_MUTEX_LOCK(&keycache->cache_lock);
+          keycache_pthread_mutex_lock(&keycache->cache_lock);
           DBUG_ASSERT(block->status & (BLOCK_READ | BLOCK_IN_USE));
 #endif
         }
@@ -2747,17 +2747,17 @@ no_key_cache:
   keycache->global_cache_read++;
 
   if (locked_and_incremented)
-    keycache_MYSQL_MUTEX_UNLOCK(&keycache->cache_lock);
+    keycache_pthread_mutex_unlock(&keycache->cache_lock);
   if (my_pread(file, (uchar*) buff, length, filepos, MYF(MY_NABP)))
     error= 1;
   if (locked_and_incremented)
-    keycache_MYSQL_MUTEX_LOCK(&keycache->cache_lock);
+    keycache_pthread_mutex_lock(&keycache->cache_lock);
 
 end:
   if (locked_and_incremented)
   {
     dec_counter_for_resize_op(keycache);
-    keycache_MYSQL_MUTEX_UNLOCK(&keycache->cache_lock);
+    keycache_pthread_mutex_unlock(&keycache->cache_lock);
   }
   DBUG_PRINT("exit", ("error: %d", error ));
   DBUG_RETURN(error ? (uchar*) 0 : start);
@@ -2808,7 +2808,7 @@ int key_cache_insert(KEY_CACHE *keycache
       disabled cache. We always increment and decrement
       'cnt_for_resize_op' so that a resizer can wait for pending I/O.
     */
-    keycache_MYSQL_MUTEX_LOCK(&keycache->cache_lock);
+    keycache_pthread_mutex_lock(&keycache->cache_lock);
     /*
       We do not load index data into a disabled cache nor into an
       ongoing resize.
@@ -2904,7 +2904,7 @@ int key_cache_insert(KEY_CACHE *keycache
                       (block->status & BLOCK_READ));
 
 #if !defined(SERIALIZED_READ_FROM_CACHE)
-          keycache_MYSQL_MUTEX_UNLOCK(&keycache->cache_lock);
+          keycache_pthread_mutex_unlock(&keycache->cache_lock);
           /*
             Here other threads may step in and register as secondary readers.
             They will register in block->wqueue[COND_FOR_REQUESTED].
@@ -2918,7 +2918,7 @@ int key_cache_insert(KEY_CACHE *keycache
             memcpy(block->buffer+offset, buff, (size_t) read_length);
 
 #if !defined(SERIALIZED_READ_FROM_CACHE)
-          keycache_MYSQL_MUTEX_LOCK(&keycache->cache_lock);
+          keycache_pthread_mutex_lock(&keycache->cache_lock);
           DBUG_ASSERT(block->status & BLOCK_IN_USE);
           DBUG_ASSERT((page_st == PAGE_TO_BE_READ) ||
                       (block->status & BLOCK_READ));
@@ -3000,7 +3000,7 @@ int key_cache_insert(KEY_CACHE *keycache
   no_key_cache:
     if (locked_and_incremented)
       dec_counter_for_resize_op(keycache);
-    keycache_MYSQL_MUTEX_UNLOCK(&keycache->cache_lock);
+    keycache_pthread_mutex_unlock(&keycache->cache_lock);
   }
   DBUG_RETURN(error);
 }
@@ -3086,7 +3086,7 @@ int key_cache_write(KEY_CACHE *keycache,
       disabled cache. We always increment and decrement
       'cnt_for_resize_op' so that a resizer can wait for pending I/O.
     */
-    keycache_MYSQL_MUTEX_LOCK(&keycache->cache_lock);
+    keycache_pthread_mutex_lock(&keycache->cache_lock);
     /*
       Cache resizing has two phases: Flushing and re-initializing. In
       the flush phase write requests can modify dirty blocks that are
@@ -3136,13 +3136,13 @@ int key_cache_write(KEY_CACHE *keycache,
         {
           /* Used in the server. */
           keycache->global_cache_write++;
-          keycache_MYSQL_MUTEX_UNLOCK(&keycache->cache_lock);
+          keycache_pthread_mutex_unlock(&keycache->cache_lock);
           if (key_cache_pwrite(file, (uchar*) buff, read_length,
                                filepos + offset,
                                MYF(MY_NABP | MY_WAIT_IF_FULL),
                                keycache->post_write, post_write_arg))
             error=1;
-          keycache_MYSQL_MUTEX_LOCK(&keycache->cache_lock);
+          keycache_pthread_mutex_lock(&keycache->cache_lock);
         }
         goto next_block;
       }
@@ -3234,7 +3234,7 @@ int key_cache_write(KEY_CACHE *keycache,
       {
         block->post_write_arg= post_write_arg;
 #if !defined(SERIALIZED_READ_FROM_CACHE)
-        keycache_MYSQL_MUTEX_UNLOCK(&keycache->cache_lock);
+        keycache_pthread_mutex_unlock(&keycache->cache_lock);
 #endif
         if (!(read_length & 511))
 	  bmove512(block->buffer+offset, buff, read_length);
@@ -3242,7 +3242,7 @@ int key_cache_write(KEY_CACHE *keycache,
           memcpy(block->buffer+offset, buff, (size_t) read_length);
 
 #if !defined(SERIALIZED_READ_FROM_CACHE)
-        keycache_MYSQL_MUTEX_LOCK(&keycache->cache_lock);
+        keycache_pthread_mutex_lock(&keycache->cache_lock);
 #endif
       }
 
@@ -3317,20 +3317,20 @@ no_key_cache:
     keycache->global_cache_w_requests++;
     keycache->global_cache_write++;
     if (locked_and_incremented)
-      keycache_MYSQL_MUTEX_UNLOCK(&keycache->cache_lock);
+      keycache_pthread_mutex_unlock(&keycache->cache_lock);
     if (key_cache_pwrite(file, (uchar*) buff, length, filepos,
                          MYF(MY_NABP | MY_WAIT_IF_FULL),
                          keycache->post_write, post_write_arg))
       error=1;
     if (locked_and_incremented)
-      keycache_MYSQL_MUTEX_LOCK(&keycache->cache_lock);
+      keycache_pthread_mutex_lock(&keycache->cache_lock);
   }
 
 end:
   if (locked_and_incremented)
   {
     dec_counter_for_resize_op(keycache);
-    keycache_MYSQL_MUTEX_UNLOCK(&keycache->cache_lock);
+    keycache_pthread_mutex_unlock(&keycache->cache_lock);
   }
 #if !defined(DBUG_OFF) && defined(EXTRA_DEBUG)
   DBUG_EXECUTE("exec",
@@ -3517,14 +3517,14 @@ static int flush_cached_blocks(KEY_CACHE
   uint count= (uint) (end-cache);
 
   /* Don't lock the cache during the flush */
-  keycache_MYSQL_MUTEX_UNLOCK(&keycache->cache_lock);
+  keycache_pthread_mutex_unlock(&keycache->cache_lock);
   /*
      As all blocks referred in 'cache' are marked by BLOCK_IN_FLUSH
      we are guarunteed no thread will change them
   */
   my_qsort((uchar*) cache, count, sizeof(*cache), (qsort_cmp) cmp_sec_link);
 
-  keycache_MYSQL_MUTEX_LOCK(&keycache->cache_lock);
+  keycache_pthread_mutex_lock(&keycache->cache_lock);
   /*
     Note: Do not break the loop. We have registered a request on every
     block in 'cache'. These must be unregistered by free_block() or
@@ -3550,14 +3550,14 @@ static int flush_cached_blocks(KEY_CACHE
       DBUG_ASSERT((block->status & ~BLOCK_IN_EVICTION) ==
                   (BLOCK_READ | BLOCK_IN_FLUSH | BLOCK_CHANGED | BLOCK_IN_USE));
       block->status|= BLOCK_IN_FLUSHWRITE;
-      keycache_MYSQL_MUTEX_UNLOCK(&keycache->cache_lock);
+      keycache_pthread_mutex_unlock(&keycache->cache_lock);
       error= key_cache_pwrite(file,
                               block->buffer+block->offset,
                               block->length - block->offset,
                               block->hash_link->diskpos+ block->offset,
                               MYF(MY_NABP | MY_WAIT_IF_FULL),
                               keycache->post_write, block->post_write_arg);
-      keycache_MYSQL_MUTEX_LOCK(&keycache->cache_lock);
+      keycache_pthread_mutex_lock(&keycache->cache_lock);
       keycache->global_cache_write++;
       if (error)
       {
@@ -4099,7 +4099,7 @@ int flush_key_blocks(KEY_CACHE *keycache
   if (!keycache->key_cache_inited)
     DBUG_RETURN(0);
 
-  keycache_MYSQL_MUTEX_LOCK(&keycache->cache_lock);
+  keycache_pthread_mutex_lock(&keycache->cache_lock);
   /* While waiting for lock, keycache could have been ended. */
   if (keycache->disk_blocks > 0)
   {
@@ -4107,7 +4107,7 @@ int flush_key_blocks(KEY_CACHE *keycache
     res= flush_key_blocks_int(keycache, file, type);
     dec_counter_for_resize_op(keycache);
   }
-  keycache_MYSQL_MUTEX_UNLOCK(&keycache->cache_lock);
+  keycache_pthread_mutex_unlock(&keycache->cache_lock);
   DBUG_RETURN(res);
 }
 
@@ -4395,7 +4395,7 @@ static void keycache_dump(KEY_CACHE *key
 #if defined(KEYCACHE_TIMEOUT) && !defined(__WIN__)
 
 
-static int keycache_MYSQL_COND_WAIT(mysql_cond_t *cond,
+static int keycache_pthread_cond_wait(mysql_cond_t *cond,
                                       mysql_mutex_t *mutex)
 {
   int rc;
@@ -4444,7 +4444,7 @@ static int keycache_MYSQL_COND_WAIT(mysq
 }
 #else
 #if defined(KEYCACHE_DEBUG)
-static int keycache_MYSQL_COND_WAIT(mysql_cond_t *cond,
+static int keycache_pthread_cond_wait(mysql_cond_t *cond,
                                       mysql_mutex_t *mutex)
 {
   int rc;
@@ -4459,7 +4459,7 @@ static int keycache_MYSQL_COND_WAIT(mysq
 #if defined(KEYCACHE_DEBUG)
 
 
-static int keycache_MYSQL_MUTEX_LOCK(mysql_mutex_t *mutex)
+static int keycache_pthread_mutex_lock(mysql_mutex_t *mutex)
 {
   int rc;
   rc= MYSQL_MUTEX_LOCK(mutex);
@@ -4468,14 +4468,14 @@ static int keycache_MYSQL_MUTEX_LOCK(mys
 }
 
 
-static void keycache_MYSQL_MUTEX_UNLOCK(mysql_mutex_t *mutex)
+static void keycache_pthread_mutex_unlock(mysql_mutex_t *mutex)
 {
   KEYCACHE_THREAD_TRACE_END("");
   MYSQL_MUTEX_UNLOCK(mutex);
 }
 
 
-static int keycache_MYSQL_COND_SIGNAL(mysql_cond_t *cond)
+static int keycache_pthread_cond_signal(mysql_cond_t *cond)
 {
   int rc;
   KEYCACHE_THREAD_TRACE("signal");

=== modified file 'mysys/my_init.c'
--- a/mysys/my_init.c	2009-05-06 23:00:55 +0000
+++ b/mysys/my_init.c	2009-05-07 06:42:31 +0000
@@ -594,10 +594,6 @@ PSI_mutex_key key_LOCK_localtime_r;
 PSI_mutex_key key_LOCK_gethostbyname_r;
 #endif /* HAVE_GETHOSTBYNAME_R */
 
-#ifdef WT_RWLOCKS_USE_MUTEXES
-PSI_mutex_key key_WT_RESOURCE_lock_mutex;
-#endif /* WT_RWLOCKS_USE_MUTEXES */
-
 PSI_mutex_key key_KEY_CACHE_cache_lock;
 PSI_mutex_key key_IO_CACHE_append_buffer_lock;
 PSI_mutex_key key_IO_CACHE_SHARE_mutex;
@@ -623,85 +619,44 @@ PSI_mutex_key key_my_thread_var_mutex;
 static PSI_mutex_info all_mysys_mutexes[]=
 {
 #if !defined(HAVE_PREAD) && !defined(__WIN__)
-  { & key_my_file_info_mutex,
-    "my_file_info::mutex", 0},
+  { & key_my_file_info_mutex, "my_file_info::mutex", 0},
 #endif
 #if !defined(HAVE_LOCALTIME_R) || !defined(HAVE_GMTIME_R)
-  { & key_LOCK_localtime_r,
-    "LOCK_localtime_r", PSI_FLAG_GLOBAL},
+  { & key_LOCK_localtime_r, "LOCK_localtime_r", PSI_FLAG_GLOBAL},
 #endif
 #ifndef HAVE_GETHOSTBYNAME_R
-  { & key_LOCK_gethostbyname_r,
-    "LOCK_gethostbyname_r", PSI_FLAG_GLOBAL},
-#endif
-#ifdef WT_RWLOCKS_USE_MUTEXES
-  { & key_WT_RESOURCE_lock_mutex,
-    "WT_RESOURCE::lock_mutex, 0"},
+  { & key_LOCK_gethostbyname_r, "LOCK_gethostbyname_r", PSI_FLAG_GLOBAL},
 #endif
-  { & key_KEY_CACHE_cache_lock,
-    "KEY_CACHE::cache_lock", 0},
-  { & key_IO_CACHE_append_buffer_lock,
-    "IO_CACHE::append_buffer_lock", 0},
-  { & key_IO_CACHE_SHARE_mutex,
-    "IO_CACHE::SHARE_mutex", 0},
-  { & key_TMPDIR_mutex,
-    "TMPDIR::mutex", 0},
-  { & key_LOCK_uuid_generator,
-    "LOCK_uuid_generator", PSI_FLAG_GLOBAL},
-  { & key_BITMAP_mutex,
-    "BITMAP_mutex", 0},
-  { & key_LOCK_alarm,
-    "LOCK_alarm", PSI_FLAG_GLOBAL},
-  { & key_THR_LOCK_mutex,
-    "THR_LOCK_mutex", 0},
-  { & key_THR_LOCK_malloc,
-    "THR_LOCK_malloc", PSI_FLAG_GLOBAL},
-  { & key_THR_LOCK_open,
-    "THR_LOCK_open", PSI_FLAG_GLOBAL},
-  { & key_THR_LOCK_lock,
-    "THR_LOCK_lock", PSI_FLAG_GLOBAL},
-  { & key_THR_LOCK_isam,
-    "THR_LOCK_isam", PSI_FLAG_GLOBAL},
-  { & key_THR_LOCK_net,
-    "THR_LOCK_net", PSI_FLAG_GLOBAL},
-  { & key_THR_LOCK_charset,
-    "THR_LOCK_charset", PSI_FLAG_GLOBAL},
-  { & key_THR_LOCK_time,
-    "THR_LOCK_time", PSI_FLAG_GLOBAL},
-  { & key_THR_LOCK_myisam,
-    "THR_LOCK_myisam", PSI_FLAG_GLOBAL},
-  { & key_THR_LOCK_myisam_log,
-    "THR_LOCK_myisam_log", PSI_FLAG_GLOBAL},
-  { & key_THR_LOCK_heap,
-    "THR_LOCK_heap", PSI_FLAG_GLOBAL},
-  { & key_THR_LOCK_threads,
-    "THR_LOCK_threads", PSI_FLAG_GLOBAL},
-  { & key_my_thread_var_mutex,
-    "my_thread_var::mutex", 0}
+  { & key_KEY_CACHE_cache_lock, "KEY_CACHE::cache_lock", 0},
+  { & key_IO_CACHE_append_buffer_lock, "IO_CACHE::append_buffer_lock", 0},
+  { & key_IO_CACHE_SHARE_mutex, "IO_CACHE::SHARE_mutex", 0},
+  { & key_TMPDIR_mutex, "TMPDIR::mutex", 0},
+  { & key_LOCK_uuid_generator, "LOCK_uuid_generator", PSI_FLAG_GLOBAL},
+  { & key_BITMAP_mutex, "BITMAP_mutex", 0},
+  { & key_LOCK_alarm, "LOCK_alarm", PSI_FLAG_GLOBAL},
+  { & key_THR_LOCK_mutex, "THR_LOCK_mutex", 0},
+  { & key_THR_LOCK_malloc, "THR_LOCK_malloc", PSI_FLAG_GLOBAL},
+  { & key_THR_LOCK_open, "THR_LOCK_open", PSI_FLAG_GLOBAL},
+  { & key_THR_LOCK_lock, "THR_LOCK_lock", PSI_FLAG_GLOBAL},
+  { & key_THR_LOCK_isam, "THR_LOCK_isam", PSI_FLAG_GLOBAL},
+  { & key_THR_LOCK_net, "THR_LOCK_net", PSI_FLAG_GLOBAL},
+  { & key_THR_LOCK_charset, "THR_LOCK_charset", PSI_FLAG_GLOBAL},
+  { & key_THR_LOCK_time, "THR_LOCK_time", PSI_FLAG_GLOBAL},
+  { & key_THR_LOCK_myisam, "THR_LOCK_myisam", PSI_FLAG_GLOBAL},
+  { & key_THR_LOCK_myisam_log, "THR_LOCK_myisam_log", PSI_FLAG_GLOBAL},
+  { & key_THR_LOCK_heap, "THR_LOCK_heap", PSI_FLAG_GLOBAL},
+  { & key_THR_LOCK_threads, "THR_LOCK_threads", PSI_FLAG_GLOBAL},
+  { & key_my_thread_var_mutex, "my_thread_var::mutex", 0}
 };
 
-#ifndef WT_RWLOCKS_USE_MUTEXES
-PSI_rwlock_key key_WT_RESOURCE_lock;
-#endif /* WT_RWLOCKS_USE_MUTEXES */
-
 /* Yes, named mutex in struct SAFE_HASH, and it's really a rwlock. */
 PSI_rwlock_key key_SAFE_HASH_mutex;
 
 static PSI_rwlock_info all_mysys_rwlocks[]=
 {
-#ifndef WT_RWLOCKS_USE_MUTEXES
-  { & key_WT_RESOURCE_lock,
-    "WT_RESOURCE::lock", 0},
-#endif
-  { & key_SAFE_HASH_mutex,
-    "SAFE_HASH::mutex", 0}
+  { & key_SAFE_HASH_mutex, "SAFE_HASH::mutex", 0}
 };
 
-#ifdef WT_RWLOCKS_USE_MUTEXES
-PSI_cond_key key_WT_RESOURCE_lock_cond;
-#endif /* WT_RWLOCKS_USE_MUTEXES */
-
-PSI_cond_key key_WT_RESOURCE_cond;
 PSI_cond_key key_IO_CACHE_SHARE_cond;
 PSI_cond_key key_IO_CACHE_SHARE_cond_writer;
 PSI_cond_key key_COND_alarm;
@@ -710,22 +665,11 @@ PSI_cond_key key_my_thread_var_suspend;
 
 static PSI_cond_info all_mysys_conds[]=
 {
-#ifdef WT_RWLOCKS_USE_MUTEXES
-  { & key_WT_RESOURCE_lock_cond,
-    "WT_RESOURCE::lock_cond", 0},
-#endif
-  { & key_WT_RESOURCE_cond,
-    "WT_RESOURCE::cond", 0},
-  { & key_IO_CACHE_SHARE_cond,
-    "IO_CACHE_SHARE::cond", 0},
-  { & key_IO_CACHE_SHARE_cond_writer,
-    "IO_CACHE_SHARE::cond_writer", 0},
-  { & key_COND_alarm,
-    "COND_alarm", PSI_FLAG_GLOBAL},
-  { & key_THR_COND_threads,
-    "THR_COND_threads", PSI_FLAG_GLOBAL},
-  { & key_my_thread_var_suspend,
-    "my_thread_var::suspend", 0}
+  { & key_IO_CACHE_SHARE_cond, "IO_CACHE_SHARE::cond", 0},
+  { & key_IO_CACHE_SHARE_cond_writer, "IO_CACHE_SHARE::cond_writer", 0},
+  { & key_COND_alarm, "COND_alarm", PSI_FLAG_GLOBAL},
+  { & key_THR_COND_threads, "THR_COND_threads", PSI_FLAG_GLOBAL},
+  { & key_my_thread_var_suspend, "my_thread_var::suspend", 0}
 };
 
 PSI_file_key key_file_proc_meminfo;
@@ -734,12 +678,9 @@ PSI_file_key key_file_charset;
 
 static PSI_file_info all_mysys_files[]=
 {
-  { & key_file_proc_meminfo,
-    "proc_meminfo", 0},
-  { & key_file_cnf,
-    "cnf", 0},
-  { & key_file_charset,
-    "charset", 0}
+  { & key_file_proc_meminfo, "proc_meminfo", 0},
+  { & key_file_cnf, "cnf", 0},
+  { & key_file_charset, "charset", 0}
 };
 
 void my_init_mysys_psi_keys()

=== modified file 'mysys/thr_lock.c'
--- a/mysys/thr_lock.c	2009-05-05 23:03:45 +0000
+++ b/mysys/thr_lock.c	2009-05-07 06:42:31 +0000
@@ -381,6 +381,7 @@ void thr_lock_data_init(THR_LOCK *lock,T
   data->owner= 0;                               /* no owner yet */
   data->status_param=param;
   data->cond=0;
+  data->m_psi= NULL;
 }
 
 

=== modified file 'mysys/waiting_threads.c'
--- a/mysys/waiting_threads.c	2009-02-23 11:55:35 +0000
+++ b/mysys/waiting_threads.c	2009-05-07 06:42:31 +0000
@@ -174,6 +174,44 @@
 #include <waiting_threads.h>
 #include <m_string.h>
 
+#ifdef HAVE_PSI_INTERFACE
+
+#ifdef WT_RWLOCKS_USE_MUTEXES
+static PSI_mutex_key key_WT_RESOURCE_lock_mutex;
+static PSI_mutex_info info_wt_lock_mutex=
+{ & key_WT_RESOURCE_lock_mutex, "WT_RESOURCE::lock_mutex, 0"};
+
+static PSI_cond_key key_WT_RESOURCE_lock_cond;
+static PSI_cond_info info_wt_lock_cond=
+{ & key_WT_RESOURCE_lock_cond, "WT_RESOURCE::lock_cond", 0};
+#else
+static PSI_rwlock_key key_WT_RESOURCE_lock;
+static PSI_rwlock_info info_wt_lock=
+{ & key_WT_RESOURCE_lock, "WT_RESOURCE::lock", 0};
+#endif
+
+static PSI_cond_key key_WT_RESOURCE_cond;
+static PSI_cond_info info_wt_cond=
+{ & key_WT_RESOURCE_cond, "WT_RESOURCE::cond", 0};
+
+void my_init_wt_psi_keys()
+{
+  const char* category= "mysys";
+
+  if (PSI_server == NULL)
+    return;
+
+#ifdef WT_RWLOCKS_USE_MUTEXES
+  PSI_server->register_mutex(category, & info_wt_lock_mutex, 1);
+  PSI_server->register_cond(category, & info_wt_lock_cond, 1);
+#else
+  PSI_server->register_rwlock(category, & info_wt_lock, 1);
+#endif
+  PSI_server->register_cond(category, & info_wt_cond, 1);
+}
+
+#endif /* HAVE_PSI_INTERFACE */
+
 /* status variables */
 
 /**
@@ -253,7 +291,7 @@ struct st_wt_resource {
   uint            waiter_count;
   enum { ACTIVE, FREE } state;
 #ifndef DBUG_OFF
-  pthread_mutex_t  *cond_mutex; /* a mutex for the 'cond' below */
+  mysql_mutex_t  *cond_mutex; /* a mutex for the 'cond' below */
 #endif
   /*
     before the 'lock' all elements are mutable, after (and including) -
@@ -292,90 +330,90 @@ struct st_wt_resource {
     the contention is expected to be low.
   */
   struct {
-    pthread_cond_t   cond;
-    pthread_mutex_t  mutex;
+    mysql_cond_t   cond;
+    mysql_mutex_t  mutex;
     uint readers: 16;
     uint pending_writers: 15;
     uint write_locked: 1;
   } lock;
 #else
-  rw_lock_t lock;
+  mysql_rwlock_t lock;
 #endif
-  pthread_cond_t   cond; /* the corresponding mutex is provided by the caller */
+  mysql_cond_t   cond; /* the corresponding mutex is provided by the caller */
   DYNAMIC_ARRAY    owners;
 };
 
 #ifdef  WT_RWLOCKS_USE_MUTEXES
 static void rc_rwlock_init(WT_RESOURCE *rc)
 {
-  pthread_cond_init(&rc->lock.cond, 0);
-  pthread_mutex_init(&rc->lock.mutex, MY_MUTEX_INIT_FAST);
+  MYSQL_COND_INIT(key_WT_RESOURCE_lock_cond, &rc->lock.cond, 0);
+  MYSQL_MUTEX_INIT(key_WT_RESOURCE_lock_mutex, &rc->lock.mutex, MY_MUTEX_INIT_FAST);
 }
 static void rc_rwlock_destroy(WT_RESOURCE *rc)
 {
   DBUG_ASSERT(rc->lock.write_locked == 0);
   DBUG_ASSERT(rc->lock.readers == 0);
-  pthread_cond_destroy(&rc->lock.cond);
-  pthread_mutex_destroy(&rc->lock.mutex);
+  MYSQL_COND_DESTROY(&rc->lock.cond);
+  MYSQL_MUTEX_DESTROY(&rc->lock.mutex);
 }
 static void rc_rdlock(WT_RESOURCE *rc)
 {
   DBUG_PRINT("wt", ("TRYLOCK resid=%ld for READ", (ulong)rc->id.value));
-  pthread_mutex_lock(&rc->lock.mutex);
+  MYSQL_MUTEX_LOCK(&rc->lock.mutex);
   while (rc->lock.write_locked)
-    pthread_cond_wait(&rc->lock.cond, &rc->lock.mutex);
+    MYSQL_COND_WAIT(&rc->lock.cond, &rc->lock.mutex);
   rc->lock.readers++;
-  pthread_mutex_unlock(&rc->lock.mutex);
+  MYSQL_MUTEX_UNLOCK(&rc->lock.mutex);
   DBUG_PRINT("wt", ("LOCK resid=%ld for READ", (ulong)rc->id.value));
 }
 static void rc_wrlock(WT_RESOURCE *rc)
 {
   DBUG_PRINT("wt", ("TRYLOCK resid=%ld for WRITE", (ulong)rc->id.value));
-  pthread_mutex_lock(&rc->lock.mutex);
+  MYSQL_MUTEX_LOCK(&rc->lock.mutex);
   while (rc->lock.write_locked || rc->lock.readers)
-    pthread_cond_wait(&rc->lock.cond, &rc->lock.mutex);
+    MYSQL_COND_WAIT(&rc->lock.cond, &rc->lock.mutex);
   rc->lock.write_locked= 1;
-  pthread_mutex_unlock(&rc->lock.mutex);
+  MYSQL_MUTEX_UNLOCK(&rc->lock.mutex);
   DBUG_PRINT("wt", ("LOCK resid=%ld for WRITE", (ulong)rc->id.value));
 }
 static void rc_unlock(WT_RESOURCE *rc)
 {
   DBUG_PRINT("wt", ("UNLOCK resid=%ld", (ulong)rc->id.value));
-  pthread_mutex_lock(&rc->lock.mutex);
+  MYSQL_MUTEX_LOCK(&rc->lock.mutex);
   if (rc->lock.write_locked)
   {
     rc->lock.write_locked= 0;
-    pthread_cond_broadcast(&rc->lock.cond);
+    MYSQL_COND_BROADCAST(&rc->lock.cond);
   }
   else if (--rc->lock.readers == 0)
-    pthread_cond_broadcast(&rc->lock.cond);
-  pthread_mutex_unlock(&rc->lock.mutex);
+    MYSQL_COND_BROADCAST(&rc->lock.cond);
+  MYSQL_MUTEX_UNLOCK(&rc->lock.mutex);
 }
 #else
 static void rc_rwlock_init(WT_RESOURCE *rc)
 {
-  my_rwlock_init(&rc->lock, 0);
+  MYSQL_RWLOCK_INIT(key_WT_RESOURCE_lock, &rc->lock);
 }
 static void rc_rwlock_destroy(WT_RESOURCE *rc)
 {
-  rwlock_destroy(&rc->lock);
+  MYSQL_RWLOCK_DESTROY(&rc->lock);
 }
 static void rc_rdlock(WT_RESOURCE *rc)
 {
   DBUG_PRINT("wt", ("TRYLOCK resid=%ld for READ", (ulong)rc->id.value));
-  rw_rdlock(&rc->lock);
+  MYSQL_RWLOCK_RDLOCK(&rc->lock);
   DBUG_PRINT("wt", ("LOCK resid=%ld for READ", (ulong)rc->id.value));
 }
 static void rc_wrlock(WT_RESOURCE *rc)
 {
   DBUG_PRINT("wt", ("TRYLOCK resid=%ld for WRITE", (ulong)rc->id.value));
-  rw_wrlock(&rc->lock);
+  MYSQL_RWLOCK_WRLOCK(&rc->lock);
   DBUG_PRINT("wt", ("LOCK resid=%ld for WRITE", (ulong)rc->id.value));
 }
 static void rc_unlock(WT_RESOURCE *rc)
 {
   DBUG_PRINT("wt", ("UNLOCK resid=%ld", (ulong)rc->id.value));
-  rw_unlock(&rc->lock);
+  MYSQL_RWLOCK_UNLOCK(&rc->lock);
 }
 #endif
 
@@ -398,7 +436,7 @@ static void wt_resource_init(uchar *arg)
 
   bzero(rc, sizeof(*rc));
   rc_rwlock_init(rc);
-  pthread_cond_init(&rc->cond, 0);
+  MYSQL_COND_INIT(key_WT_RESOURCE_cond, &rc->cond, 0);
   my_init_dynamic_array(&rc->owners, sizeof(WT_THD *), 0, 5);
   DBUG_VOID_RETURN;
 }
@@ -416,7 +454,7 @@ static void wt_resource_destroy(uchar *a
 
   DBUG_ASSERT(rc->owners.elements == 0);
   rc_rwlock_destroy(rc);
-  pthread_cond_destroy(&rc->cond);
+  MYSQL_COND_DESTROY(&rc->cond);
   delete_dynamic(&rc->owners);
   DBUG_VOID_RETURN;
 }
@@ -795,7 +833,7 @@ static int deadlock(WT_THD *thd, WT_THD
   {
     DBUG_PRINT("wt", ("killing %s", arg.victim->name));
     arg.victim->killed= 1;
-    pthread_cond_broadcast(&arg.victim->waiting_for->cond);
+    MYSQL_COND_BROADCAST(&arg.victim->waiting_for->cond);
     rc_unlock(arg.victim->waiting_for);
     ret= WT_OK;
   }
@@ -1029,11 +1067,11 @@ retry:
   called by a *waiter* (thd) to start waiting
 
   It's supposed to be a drop-in replacement for
-  pthread_cond_timedwait(), and it takes mutex as an argument.
+  MYSQL_COND_TIMEDWAIT(), and it takes mutex as an argument.
 
   @return one of WT_TIMEOUT, WT_DEADLOCK, WT_OK
 */
-int wt_thd_cond_timedwait(WT_THD *thd, pthread_mutex_t *mutex)
+int wt_thd_cond_timedwait(WT_THD *thd, mysql_mutex_t *mutex)
 {
   int ret= WT_TIMEOUT;
   struct timespec timeout;
@@ -1047,7 +1085,7 @@ int wt_thd_cond_timedwait(WT_THD *thd, p
     DBUG_ASSERT(rc->cond_mutex == mutex);
   else
     rc->cond_mutex= mutex;
-  safe_mutex_assert_owner(mutex);
+  MYSQL_MUTEX_ASSERT_OWNER(mutex);
 #endif
 
   before= starttime= my_getsystime();
@@ -1074,7 +1112,7 @@ int wt_thd_cond_timedwait(WT_THD *thd, p
 
   set_timespec_time_nsec(timeout, starttime, (*thd->timeout_short)*ULL(1000));
   if (ret == WT_TIMEOUT && !thd->killed)
-    ret= pthread_cond_timedwait(&rc->cond, mutex, &timeout);
+    ret= MYSQL_COND_TIMEDWAIT(&rc->cond, mutex, &timeout);
   if (ret == WT_TIMEOUT && !thd->killed)
   {
     int r= deadlock(thd, thd, 0, *thd->deadlock_search_depth_long);
@@ -1086,7 +1124,7 @@ int wt_thd_cond_timedwait(WT_THD *thd, p
     {
       set_timespec_time_nsec(timeout, starttime, (*thd->timeout_long)*ULL(1000));
       if (!thd->killed)
-        ret= pthread_cond_timedwait(&rc->cond, mutex, &timeout);
+        ret= MYSQL_COND_TIMEDWAIT(&rc->cond, mutex, &timeout);
     }
   }
   after= my_getsystime();
@@ -1101,7 +1139,7 @@ int wt_thd_cond_timedwait(WT_THD *thd, p
 /**
   called by a *blocker* when it releases a resource
 
-  it's conceptually similar to pthread_cond_broadcast, and must be done
+  it's conceptually similar to MYSQL_COND_BROADCAST, and must be done
   under the same mutex as wt_thd_cond_timedwait().
 
   @param resid   a resource to release. 0 to release all resources
@@ -1132,10 +1170,10 @@ void wt_thd_release(WT_THD *thd, const W
       delete_dynamic_element(&rc->owners, j);
       if (rc->owners.elements == 0)
       {
-        pthread_cond_broadcast(&rc->cond);
+        MYSQL_COND_BROADCAST(&rc->cond);
 #ifndef DBUG_OFF
         if (rc->cond_mutex)
-          safe_mutex_assert_owner(rc->cond_mutex);
+          MYSQL_MUTEX_ASSERT_OWNER(rc->cond_mutex);
 #endif
       }
       unlock_lock_and_free_resource(thd, rc);

=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc	2009-05-06 23:00:55 +0000
+++ b/sql/mysqld.cc	2009-05-07 06:42:31 +0000
@@ -4555,6 +4555,7 @@ int main(int argc, char **argv)
       the performance schema itself, the next step is to register all the
       server and mysys instruments.
     */
+    my_init_wt_psi_keys();
     my_init_mysys_psi_keys();
     init_server_psi_keys();
     /* Instrument the main thread */
@@ -9572,145 +9573,78 @@ PSI_mutex_key key_mutex_relay_log_info_l
 static PSI_mutex_info all_server_mutexes[]=
 {
 #ifdef HAVE_OPENSSL
- { & key_LOCK_des_key_file,
-   "LOCK_des_key_file", PSI_FLAG_GLOBAL},
+ { & key_LOCK_des_key_file, "LOCK_des_key_file", PSI_FLAG_GLOBAL},
 #endif
 
 #ifdef HAVE_MMAP
- { & key_PAGE_lock,
-   "PAGE::lock", 0},
- { & key_LOCK_sync,
-   "LOCK_sync", PSI_FLAG_GLOBAL},
- { & key_LOCK_active,
-   "LOCK_active", PSI_FLAG_GLOBAL},
- { & key_LOCK_pool,
-   "LOCK_pool", PSI_FLAG_GLOBAL},
-#endif
-
- { & key_LOCK_mysql_create_db,
-   "LOCK_mysql_create_db", PSI_FLAG_GLOBAL},
- { & key_LOCK_open,
-   "LOCK_open", PSI_FLAG_GLOBAL},
- { & key_LOCK_lock_db,
-   "LOCK_lock_db", PSI_FLAG_GLOBAL},
- { & key_LOCK_thread_count,
-   "LOCK_thread_count", PSI_FLAG_GLOBAL},
- { & key_LOCK_mapped_file,
-   "LOCK_mapped_file", PSI_FLAG_GLOBAL},
- { & key_LOCK_status,
-   "LOCK_status", PSI_FLAG_GLOBAL},
- { & key_LOCK_error_log,
-   "LOCK_error_log", PSI_FLAG_GLOBAL},
- { & key_LOCK_delayed_insert,
-   "LOCK_delayed_insert", PSI_FLAG_GLOBAL},
- { & key_LOCK_uuid_short,
-   "LOCK_uuid_short", PSI_FLAG_GLOBAL},
- { & key_LOCK_delayed_status,
-   "LOCK_delayed_status", PSI_FLAG_GLOBAL},
- { & key_LOCK_delayed_create,
-   "LOCK_delayed_create", PSI_FLAG_GLOBAL},
- { & key_LOCK_crypt,
-   "LOCK_crypt", PSI_FLAG_GLOBAL},
- { & key_LOCK_timezone,
-   "LOCK_timezone", PSI_FLAG_GLOBAL},
- { & key_LOCK_slave_list,
-   "LOCK_slave_list", PSI_FLAG_GLOBAL},
- { & key_LOCK_active_mi,
-   "LOCK_active_mi", PSI_FLAG_GLOBAL},
- { & key_LOCK_manager,
-   "LOCK_manager", PSI_FLAG_GLOBAL},
- { & key_LOCK_global_read_lock,
-   "LOCK_global_read_lock", PSI_FLAG_GLOBAL},
- { & key_LOCK_global_system_variables,
-   "LOCK_global_system_variables", PSI_FLAG_GLOBAL},
- { & key_LOCK_user_conn,
-   "LOCK_user_conn", PSI_FLAG_GLOBAL},
- { & key_LOCK_prepared_stmt_count,
-   "LOCK_prepared_stmt_count", PSI_FLAG_GLOBAL},
- { & key_LOCK_connection_count,
-   "LOCK_connection_count", PSI_FLAG_GLOBAL},
- { & key_LOCK_server_started,
-   "LOCK_server_started", PSI_FLAG_GLOBAL},
- { & key_LOCK_rpl_status,
-   "LOCK_rpl_status", PSI_FLAG_GLOBAL},
- { & key_LOCK_delete,
-   "LOCK_delete", 0},
- { & key_hash_filo_lock,
-   "hash_filo::lock", 0},
- { & key_LOCK_ha_data,
-   "LOCK_ha_data", 0},
- { & key_LOG_LOCK_log,
-   "LOG::LOCK_log", 0},
- { & key_BINLOG_LOCK_index,
-   "BINLOG::LOCK_index", 0},
- { & key_BINLOG_LOCK_prep_xids,
-   "BINLOG::LOCK_prep_xids", 0},
- { & key_LOCK_logger,
-   "LOCK_logger", PSI_FLAG_GLOBAL},
- { & key_LOG_INFO_lock,
-   "LOG_INFO_lock", PSI_FLAG_GLOBAL},
- { & key_LOCK_backupid,
-   "BACKUP_LOG::LOCK_backupid", 0},
- { & key_structure_guard_mutex,
-   "structure_guard_mutex", PSI_FLAG_GLOBAL},
- { & key_RLI_run_lock,
-   "RLI_run_lock", PSI_FLAG_GLOBAL},
- { & key_RLI_data_lock,
-   "RLI_data_lock", PSI_FLAG_GLOBAL},
- { & key_RLI_log_space_lock,
-   "RLI_log_space_lock", PSI_FLAG_GLOBAL},
- { & key_mutex_rpl_info_run_lock,
-   "Rpl_info::run_lock", 0},
- { & key_mutex_rpl_info_data_lock,
-   "Rpl_info::data_lock", 0},
- { & key_event_scheduler_LOCK_scheduler_state,
-   "Event_scheduler::LOCK_scheduler_state", PSI_FLAG_GLOBAL},
- { & key_LOCK_event_metadata,
-   "LOCK_event_metadata", PSI_FLAG_GLOBAL},
- { & key_LOCK_event_queue,
-   "LOCK_event_queue", PSI_FLAG_GLOBAL},
- { & key_locking_thread_THR_LOCK_thread,
-   "locking_thread::THR_LOCK_thread", 0},
- { & key_locking_thread_THR_LOCK_caller,
-   "locking_thread::THR_LOCK_caller", 0},
- { & key_debug_sync_globals_ds_mutex,
-   "DEBUG_SYNC::mutex", PSI_FLAG_GLOBAL},
- { & key_LOCK_user_locks,
-   "LOCK_user_locks", PSI_FLAG_GLOBAL},
- { & key_LOCK_mdl,
-   "LOCK_mdl", PSI_FLAG_GLOBAL},
- { & key_LOCK_thd_add,
-   "LOCK_thd_add", PSI_FLAG_GLOBAL},
- { & key_LOCK_event_loop,
-   "LOCK_event_loop", PSI_FLAG_GLOBAL},
- { & key_Cversion_lock,
-   "Cversion_lock", PSI_FLAG_GLOBAL},
- { & key_LOCK_audit_mask,
-   "LOCK_audit_mask", PSI_FLAG_GLOBAL},
- { & key_LOCK_xid_cache,
-   "LOCK_xid_cache", PSI_FLAG_GLOBAL},
- { & key_Delayed_insert_mutex,
-   "Delayed_insert::mutex", 0},
- { & key_LOCK_plugin,
-   "LOCK_plugin", PSI_FLAG_GLOBAL},
- { & key_LOCK_gdl,
-   "LOCK_gdl", PSI_FLAG_GLOBAL},
- { & key_tz_LOCK,
-   "tz_LOCK", PSI_FLAG_GLOBAL},
- { & key_slave_start,
-   "slave_start", PSI_FLAG_GLOBAL},
- { & key_hadata_mutex,
-   "hadata::mutex", 0},
- { & key_mutex_THR_LOCK_BML,
-   "BML_class::THR_LOCK_BML", PSI_FLAG_GLOBAL},
- { & key_mutex_THR_LOCK_BML_active,
-   "BML_class::THR_LOCK_BML_active", PSI_FLAG_GLOBAL},
- { & key_mutex_THR_LOCK_BML_get,
-   "BML_class::THR_LOCK_BML_get", PSI_FLAG_GLOBAL},
- { & key_mutex_slave_reporting_capability_err_lock,
-   "Slave_reporting_capability::err_lock", 0},
- { & key_mutex_relay_log_info_log_space_lock,
-   "Relay_log_info::log_space_lock", 0}
+ { & key_PAGE_lock, "PAGE::lock", 0},
+ { & key_LOCK_sync, "LOCK_sync", PSI_FLAG_GLOBAL},
+ { & key_LOCK_active, "LOCK_active", PSI_FLAG_GLOBAL},
+ { & key_LOCK_pool, "LOCK_pool", PSI_FLAG_GLOBAL},
+#endif
+
+ { & key_LOCK_mysql_create_db, "LOCK_mysql_create_db", PSI_FLAG_GLOBAL},
+ { & key_LOCK_open, "LOCK_open", PSI_FLAG_GLOBAL},
+ { & key_LOCK_lock_db, "LOCK_lock_db", PSI_FLAG_GLOBAL},
+ { & key_LOCK_thread_count, "LOCK_thread_count", PSI_FLAG_GLOBAL},
+ { & key_LOCK_mapped_file, "LOCK_mapped_file", PSI_FLAG_GLOBAL},
+ { & key_LOCK_status, "LOCK_status", PSI_FLAG_GLOBAL},
+ { & key_LOCK_error_log, "LOCK_error_log", PSI_FLAG_GLOBAL},
+ { & key_LOCK_delayed_insert, "LOCK_delayed_insert", PSI_FLAG_GLOBAL},
+ { & key_LOCK_uuid_short, "LOCK_uuid_short", PSI_FLAG_GLOBAL},
+ { & key_LOCK_delayed_status, "LOCK_delayed_status", PSI_FLAG_GLOBAL},
+ { & key_LOCK_delayed_create, "LOCK_delayed_create", PSI_FLAG_GLOBAL},
+ { & key_LOCK_crypt, "LOCK_crypt", PSI_FLAG_GLOBAL},
+ { & key_LOCK_timezone, "LOCK_timezone", PSI_FLAG_GLOBAL},
+ { & key_LOCK_slave_list, "LOCK_slave_list", PSI_FLAG_GLOBAL},
+ { & key_LOCK_active_mi, "LOCK_active_mi", PSI_FLAG_GLOBAL},
+ { & key_LOCK_manager, "LOCK_manager", PSI_FLAG_GLOBAL},
+ { & key_LOCK_global_read_lock, "LOCK_global_read_lock", PSI_FLAG_GLOBAL},
+ { & key_LOCK_global_system_variables, "LOCK_global_system_variables", PSI_FLAG_GLOBAL},
+ { & key_LOCK_user_conn, "LOCK_user_conn", PSI_FLAG_GLOBAL},
+ { & key_LOCK_prepared_stmt_count, "LOCK_prepared_stmt_count", PSI_FLAG_GLOBAL},
+ { & key_LOCK_connection_count, "LOCK_connection_count", PSI_FLAG_GLOBAL},
+ { & key_LOCK_server_started, "LOCK_server_started", PSI_FLAG_GLOBAL},
+ { & key_LOCK_rpl_status, "LOCK_rpl_status", PSI_FLAG_GLOBAL},
+ { & key_LOCK_delete, "LOCK_delete", 0},
+ { & key_hash_filo_lock, "hash_filo::lock", 0},
+ { & key_LOCK_ha_data, "LOCK_ha_data", 0},
+ { & key_LOG_LOCK_log, "LOG::LOCK_log", 0},
+ { & key_BINLOG_LOCK_index, "BINLOG::LOCK_index", 0},
+ { & key_BINLOG_LOCK_prep_xids, "BINLOG::LOCK_prep_xids", 0},
+ { & key_LOCK_logger, "LOCK_logger", PSI_FLAG_GLOBAL},
+ { & key_LOG_INFO_lock, "LOG_INFO_lock", PSI_FLAG_GLOBAL},
+ { & key_LOCK_backupid, "BACKUP_LOG::LOCK_backupid", 0},
+ { & key_structure_guard_mutex, "structure_guard_mutex", PSI_FLAG_GLOBAL},
+ { & key_RLI_run_lock, "RLI_run_lock", PSI_FLAG_GLOBAL},
+ { & key_RLI_data_lock, "RLI_data_lock", PSI_FLAG_GLOBAL},
+ { & key_RLI_log_space_lock, "RLI_log_space_lock", PSI_FLAG_GLOBAL},
+ { & key_mutex_rpl_info_run_lock, "Rpl_info::run_lock", 0},
+ { & key_mutex_rpl_info_data_lock, "Rpl_info::data_lock", 0},
+ { & key_event_scheduler_LOCK_scheduler_state, "Event_scheduler::LOCK_scheduler_state", PSI_FLAG_GLOBAL},
+ { & key_LOCK_event_metadata, "LOCK_event_metadata", PSI_FLAG_GLOBAL},
+ { & key_LOCK_event_queue, "LOCK_event_queue", PSI_FLAG_GLOBAL},
+ { & key_locking_thread_THR_LOCK_thread, "locking_thread::THR_LOCK_thread", 0},
+ { & key_locking_thread_THR_LOCK_caller, "locking_thread::THR_LOCK_caller", 0},
+ { & key_debug_sync_globals_ds_mutex, "DEBUG_SYNC::mutex", PSI_FLAG_GLOBAL},
+ { & key_LOCK_user_locks, "LOCK_user_locks", PSI_FLAG_GLOBAL},
+ { & key_LOCK_mdl, "LOCK_mdl", PSI_FLAG_GLOBAL},
+ { & key_LOCK_thd_add, "LOCK_thd_add", PSI_FLAG_GLOBAL},
+ { & key_LOCK_event_loop, "LOCK_event_loop", PSI_FLAG_GLOBAL},
+ { & key_Cversion_lock, "Cversion_lock", PSI_FLAG_GLOBAL},
+ { & key_LOCK_audit_mask, "LOCK_audit_mask", PSI_FLAG_GLOBAL},
+ { & key_LOCK_xid_cache, "LOCK_xid_cache", PSI_FLAG_GLOBAL},
+ { & key_Delayed_insert_mutex, "Delayed_insert::mutex", 0},
+ { & key_LOCK_plugin, "LOCK_plugin", PSI_FLAG_GLOBAL},
+ { & key_LOCK_gdl, "LOCK_gdl", PSI_FLAG_GLOBAL},
+ { & key_tz_LOCK, "tz_LOCK", PSI_FLAG_GLOBAL},
+ { & key_slave_start, "slave_start", PSI_FLAG_GLOBAL},
+ { & key_hadata_mutex, "hadata::mutex", 0},
+ { & key_mutex_THR_LOCK_BML, "BML_class::THR_LOCK_BML", PSI_FLAG_GLOBAL},
+ { & key_mutex_THR_LOCK_BML_active, "BML_class::THR_LOCK_BML_active", PSI_FLAG_GLOBAL},
+ { & key_mutex_THR_LOCK_BML_get, "BML_class::THR_LOCK_BML_get", PSI_FLAG_GLOBAL},
+ { & key_mutex_slave_reporting_capability_err_lock, "Slave_reporting_capability::err_lock", 0},
+ { & key_mutex_relay_log_info_log_space_lock, "Relay_log_info::log_space_lock", 0}
 };
 
 PSI_rwlock_key key_LOCK_grant;
@@ -9722,18 +9656,12 @@ PSI_rwlock_key key_rwlock_delegate;
 
 static PSI_rwlock_info all_server_rwlocks[]=
 {
-  { & key_LOCK_grant,
-   "LOCK_grant", PSI_FLAG_GLOBAL},
-  { & key_LOCK_sys_init_connect,
-   "LOCK_sys_init_connect", PSI_FLAG_GLOBAL},
-  { & key_LOCK_sys_init_slave,
-   "LOCK_sys_init_slave", PSI_FLAG_GLOBAL},
-  { & key_LOCK_system_variables_hash,
-   "LOCK_system_variables_hash", PSI_FLAG_GLOBAL},
-  { & key_QCQ_lock,
-   "Query_cache_query::lock", 0},
-  { & key_rwlock_delegate,
-   "Delegate::lock", 0}
+  { & key_LOCK_grant, "LOCK_grant", PSI_FLAG_GLOBAL},
+  { & key_LOCK_sys_init_connect, "LOCK_sys_init_connect", PSI_FLAG_GLOBAL},
+  { & key_LOCK_sys_init_slave, "LOCK_sys_init_slave", PSI_FLAG_GLOBAL},
+  { & key_LOCK_system_variables_hash, "LOCK_system_variables_hash", PSI_FLAG_GLOBAL},
+  { & key_QCQ_lock, "Query_cache_query::lock", 0},
+  { & key_rwlock_delegate, "Delegate::lock", 0}
 };
 
 #ifdef HAVE_MMAP
@@ -9782,83 +9710,47 @@ PSI_cond_key key_cond_relay_log_info_log
 static PSI_cond_info all_server_conds[]=
 {
 #ifdef HAVE_MMAP
-  { & key_PAGE_cond,
-   "PAGE::cond", PSI_FLAG_GLOBAL},
-  { & key_COND_active,
-   "COND_active", PSI_FLAG_GLOBAL},
-  { & key_COND_pool,
-   "COND_pool", PSI_FLAG_GLOBAL},
+  { & key_PAGE_cond, "PAGE::cond", PSI_FLAG_GLOBAL},
+  { & key_COND_active, "COND_active", PSI_FLAG_GLOBAL},
+  { & key_COND_pool, "COND_pool", PSI_FLAG_GLOBAL},
 #endif
 
 #if (defined(_WIN32) || defined(HAVE_SMEM)) && !defined(EMBEDDED_LIBRARY)
-  { & key_COND_handler_count,
-   "COND_handler_count", PSI_FLAG_GLOBAL},
+  { & key_COND_handler_count, "COND_handler_count", PSI_FLAG_GLOBAL},
 #endif
 
-  { & key_COND_server_started,
-   "COND_server_started", PSI_FLAG_GLOBAL},
-  { & key_COND_refresh,
-   "COND_refresh", PSI_FLAG_GLOBAL},
-  { & key_COND_thread_count,
-   "COND_thread_count", PSI_FLAG_GLOBAL},
-  { & key_COND_manager,
-   "COND_manager", PSI_FLAG_GLOBAL},
-  { & key_COND_global_read_lock,
-   "COND_global_read_lock", PSI_FLAG_GLOBAL},
-  { & key_COND_thread_cache,
-   "COND_thread_cache", PSI_FLAG_GLOBAL},
-  { & key_COND_flush_thread_cache,
-   "COND_flush_thread_cache", PSI_FLAG_GLOBAL},
-  { & key_COND_rpl_status,
-   "COND_rpl_status", PSI_FLAG_GLOBAL},
-  { & key_BINLOG_COND_prep_xids,
-   "BINLOG::COND_prep_xids", PSI_FLAG_GLOBAL},
-  { & key_BINLOG_update_cond,
-   "BINLOG::update_cond", PSI_FLAG_GLOBAL},
-  { & key_COND_cache_status_changed,
-   "COND_cache_status_changed", PSI_FLAG_GLOBAL},
-  { & key_RLI_data_cond,
-   "RLI_data_cond", PSI_FLAG_GLOBAL},
-  { & key_RLI_start_cond,
-   "RLI_start_cond", PSI_FLAG_GLOBAL},
-  { & key_RLI_stop_cond,
-   "RLI_stop_cond", PSI_FLAG_GLOBAL},
-  { & key_RLI_log_space_cond,
-   "RLI_log_space_cond", PSI_FLAG_GLOBAL},
-  { & key_cond_rpl_info_data_cond,
-   "Rpl_info::data_cond", PSI_FLAG_GLOBAL},
-  { & key_cond_rpl_info_start_cond,
-   "Rpl_info::start_cond", PSI_FLAG_GLOBAL},
-  { & key_cond_rpl_info_stop_cond,
-   "Rpl_info::stop_cond", PSI_FLAG_GLOBAL},
-  { & key_event_scheduler_COND_state,
-   "Event_scheduler::COND_state", PSI_FLAG_GLOBAL},
-  { & key_COND_queue_state,
-   "COND_queue_state", PSI_FLAG_GLOBAL},
-  { & key_locking_thread_COND_thread_wait,
-   "locking_thread::COND_thread_wait", 0},
-  { & key_locking_thread_COND_caller_wait,
-   "locking_thread::COND_caller_wait", 0},
-  { & key_debug_sync_globals_ds_cond,
-   "DEBUG_SYNC::cond", PSI_FLAG_GLOBAL},
-  { & key_ULL_cond,
-   "ULL_cond", PSI_FLAG_GLOBAL},
-  { & key_Item_func_sleep_cond,
-   "Item_func_sleep::cond", PSI_FLAG_GLOBAL},
-  { & key_COND_mdl,
-   "COND_mdl", PSI_FLAG_GLOBAL},
-  { & key_Delayed_insert_cond,
-   "Delayed_insert_cond", PSI_FLAG_GLOBAL},
-  { & key_Delayed_insert_cond_client,
-   "Delayed_insert_cond_client", PSI_FLAG_GLOBAL},
-  { & key_cond_COND_BML,
-   "BML_class::COND_BML", PSI_FLAG_GLOBAL},
-  { & key_cond_COND_BML_registered,
-   "BML_class::COND_BML_registered", PSI_FLAG_GLOBAL},
-  { & key_cond_COND_BML_release,
-   "BML_class::COND_BML_release", PSI_FLAG_GLOBAL},
-  { & key_cond_relay_log_info_log_space_cond,
-   "Relay_log_info::log_space_cond", 0}
+  { & key_COND_server_started, "COND_server_started", PSI_FLAG_GLOBAL},
+  { & key_COND_refresh, "COND_refresh", PSI_FLAG_GLOBAL},
+  { & key_COND_thread_count, "COND_thread_count", PSI_FLAG_GLOBAL},
+  { & key_COND_manager, "COND_manager", PSI_FLAG_GLOBAL},
+  { & key_COND_global_read_lock, "COND_global_read_lock", PSI_FLAG_GLOBAL},
+  { & key_COND_thread_cache, "COND_thread_cache", PSI_FLAG_GLOBAL},
+  { & key_COND_flush_thread_cache, "COND_flush_thread_cache", PSI_FLAG_GLOBAL},
+  { & key_COND_rpl_status, "COND_rpl_status", PSI_FLAG_GLOBAL},
+  { & key_BINLOG_COND_prep_xids, "BINLOG::COND_prep_xids", PSI_FLAG_GLOBAL},
+  { & key_BINLOG_update_cond, "BINLOG::update_cond", PSI_FLAG_GLOBAL},
+  { & key_COND_cache_status_changed, "COND_cache_status_changed", PSI_FLAG_GLOBAL},
+  { & key_RLI_data_cond, "RLI_data_cond", PSI_FLAG_GLOBAL},
+  { & key_RLI_start_cond, "RLI_start_cond", PSI_FLAG_GLOBAL},
+  { & key_RLI_stop_cond, "RLI_stop_cond", PSI_FLAG_GLOBAL},
+  { & key_RLI_log_space_cond, "RLI_log_space_cond", PSI_FLAG_GLOBAL},
+  { & key_cond_rpl_info_data_cond, "Rpl_info::data_cond", PSI_FLAG_GLOBAL},
+  { & key_cond_rpl_info_start_cond, "Rpl_info::start_cond", PSI_FLAG_GLOBAL},
+  { & key_cond_rpl_info_stop_cond, "Rpl_info::stop_cond", PSI_FLAG_GLOBAL},
+  { & key_event_scheduler_COND_state, "Event_scheduler::COND_state", PSI_FLAG_GLOBAL},
+  { & key_COND_queue_state, "COND_queue_state", PSI_FLAG_GLOBAL},
+  { & key_locking_thread_COND_thread_wait, "locking_thread::COND_thread_wait", 0},
+  { & key_locking_thread_COND_caller_wait, "locking_thread::COND_caller_wait", 0},
+  { & key_debug_sync_globals_ds_cond, "DEBUG_SYNC::cond", PSI_FLAG_GLOBAL},
+  { & key_ULL_cond, "ULL_cond", PSI_FLAG_GLOBAL},
+  { & key_Item_func_sleep_cond, "Item_func_sleep::cond", PSI_FLAG_GLOBAL},
+  { & key_COND_mdl, "COND_mdl", PSI_FLAG_GLOBAL},
+  { & key_Delayed_insert_cond, "Delayed_insert_cond", PSI_FLAG_GLOBAL},
+  { & key_Delayed_insert_cond_client, "Delayed_insert_cond_client", PSI_FLAG_GLOBAL},
+  { & key_cond_COND_BML, "BML_class::COND_BML", PSI_FLAG_GLOBAL},
+  { & key_cond_COND_BML_registered, "BML_class::COND_BML_registered", PSI_FLAG_GLOBAL},
+  { & key_cond_COND_BML_release, "BML_class::COND_BML_release", PSI_FLAG_GLOBAL},
+  { & key_cond_relay_log_info_log_space_cond, "Relay_log_info::log_space_cond", 0}
 };
 
 PSI_thread_key key_thread_main;
@@ -9886,48 +9778,28 @@ PSI_thread_key key_thread_delayed_insert
 
 static PSI_thread_info all_server_threads[]=
 {
-  { & key_thread_main,
-   "Main", PSI_FLAG_GLOBAL},
-  { & key_thread_bootstrap,
-   "Bootstrap", PSI_FLAG_GLOBAL},
-  { & key_thread_handle_socket_con,
-   "Listen/Socket", PSI_FLAG_GLOBAL},
-  { & key_thread_handle_con_namedpipes,
-   "Listen/NamedPipes", PSI_FLAG_GLOBAL},
-  { & key_thread_handle_con_sharedmem,
-   "Listen/SharedMemory", PSI_FLAG_GLOBAL},
-  { & key_thread_connection,
-   "Connection", 0},
-  { & key_thread_event_scheduler,
-   "EventScheduler", PSI_FLAG_GLOBAL},
-  { & key_thread_event_worker,
-   "EventWorker", 0},
-  { & key_thread_ndb_binlog,
-   "NdbBinlog", PSI_FLAG_GLOBAL},
-  { & key_thread_ndb_util,
-   "NdbUtil", PSI_FLAG_GLOBAL},
-  { & key_thread_handle_manager,
-   "Manager", PSI_FLAG_GLOBAL},
+  { & key_thread_main, "Main", PSI_FLAG_GLOBAL},
+  { & key_thread_bootstrap, "Bootstrap", PSI_FLAG_GLOBAL},
+  { & key_thread_handle_socket_con, "Listen/Socket", PSI_FLAG_GLOBAL},
+  { & key_thread_handle_con_namedpipes, "Listen/NamedPipes", PSI_FLAG_GLOBAL},
+  { & key_thread_handle_con_sharedmem, "Listen/SharedMemory", PSI_FLAG_GLOBAL},
+  { & key_thread_connection, "Connection", 0},
+  { & key_thread_event_scheduler, "EventScheduler", PSI_FLAG_GLOBAL},
+  { & key_thread_event_worker, "EventWorker", 0},
+  { & key_thread_ndb_binlog, "NdbBinlog", PSI_FLAG_GLOBAL},
+  { & key_thread_ndb_util, "NdbUtil", PSI_FLAG_GLOBAL},
+  { & key_thread_handle_manager, "Manager", PSI_FLAG_GLOBAL},
 #ifdef __WIN__
-  { & key_thread_handle_shutdown,
-   "Shutdown", PSI_FLAG_GLOBAL},
+  { & key_thread_handle_shutdown, "Shutdown", PSI_FLAG_GLOBAL},
 #endif
-  { & key_thread_signal_hand,
-   "Signal", PSI_FLAG_GLOBAL},
-  { & key_thread_one_connection,
-   "OneConnection", 0},
-  { & key_thread_kill_server,
-   "KillServer", 0},
-  { & key_thread_libevent,
-   "LibEvent", 0},
-  { & key_thread_slave_io,
-   "Slave_IO", PSI_FLAG_GLOBAL},
-  { & key_thread_slave_sql,
-   "slave_SQL", PSI_FLAG_GLOBAL},
-  { & key_thread_backup,
-   "backup", 0},
-  { & key_thread_delayed_insert,
-   "delayed_insert", 0}
+  { & key_thread_signal_hand, "Signal", PSI_FLAG_GLOBAL},
+  { & key_thread_one_connection, "OneConnection", 0},
+  { & key_thread_kill_server, "KillServer", 0},
+  { & key_thread_libevent, "LibEvent", 0},
+  { & key_thread_slave_io, "Slave_IO", PSI_FLAG_GLOBAL},
+  { & key_thread_slave_sql, "slave_SQL", PSI_FLAG_GLOBAL},
+  { & key_thread_backup, "backup", 0},
+  { & key_thread_delayed_insert, "delayed_insert", 0}
 };
 
 PSI_file_key key_file_ERRMSG;
@@ -9958,56 +9830,31 @@ PSI_file_key key_file_global_ddl_log;
 
 static PSI_file_info all_server_files[]=
 {
-  { & key_file_ERRMSG,
-   "ERRMSG", PSI_FLAG_GLOBAL},
-  { & key_file_frm,
-   "FRM", 0},
-  { & key_file_init,
-   "Init", PSI_FLAG_GLOBAL},
-  { & key_file_fileparser,
-   "file_parser", 0},
-  { & key_file_dbopt,
-   "DbOpt", 0},
-  { & key_file_binlog,
-   "binlog", 0},
-  { & key_file_binlog_index,
-   "binlog_index", 0},
-  { & key_file_MYSQL_LOG,
-   "MYSQL_LOG", 0},
-  { & key_file_backuplog,
-   "backuplog", 0},
-  { & key_file_tclog,
-   "tclog", 0},
-  { & key_file_loadfile,
-   "LOAD_FILE", 0},
-  { & key_file_log_event_data,
-   "log_event_data", 0},
-  { & key_file_log_event_info,
-   "log_event_info", 0},
-  { & key_file_master_info,
-   "master_info", 0},
-  { & key_file_send_file,
-   "send_file", 0},
-  { & key_file_rli,
-   "relay_log_info", 0},
-  { & key_file_des_key_file,
-   "des_key_file", 0},
-  { & key_file_partition,
-   "partition", 0},
-  { & key_file_load,
-   "load", 0},
-  { & key_file_ndb,
-   "NDB", 0},
-  { & key_file_casetest,
-   "case_test", 0},
-  { & key_file_pid,
-   "pid", 0},
-  { & key_file_map,
-   "map", 0},
-  { & key_file_partition_syntax,
-   "partition_syntax", 0},
-  { & key_file_global_ddl_log,
-   "global_ddl_log", 0}
+  { & key_file_ERRMSG, "ERRMSG", PSI_FLAG_GLOBAL},
+  { & key_file_frm, "FRM", 0},
+  { & key_file_init, "Init", PSI_FLAG_GLOBAL},
+  { & key_file_fileparser, "file_parser", 0},
+  { & key_file_dbopt, "DbOpt", 0},
+  { & key_file_binlog, "binlog", 0},
+  { & key_file_binlog_index, "binlog_index", 0},
+  { & key_file_MYSQL_LOG, "MYSQL_LOG", 0},
+  { & key_file_backuplog, "backuplog", 0},
+  { & key_file_tclog, "tclog", 0},
+  { & key_file_loadfile, "LOAD_FILE", 0},
+  { & key_file_log_event_data, "log_event_data", 0},
+  { & key_file_log_event_info, "log_event_info", 0},
+  { & key_file_master_info, "master_info", 0},
+  { & key_file_send_file, "send_file", 0},
+  { & key_file_rli, "relay_log_info", 0},
+  { & key_file_des_key_file, "des_key_file", 0},
+  { & key_file_partition, "partition", 0},
+  { & key_file_load, "load", 0},
+  { & key_file_ndb, "NDB", 0},
+  { & key_file_casetest, "case_test", 0},
+  { & key_file_pid, "pid", 0},
+  { & key_file_map, "map", 0},
+  { & key_file_partition_syntax, "partition_syntax", 0},
+  { & key_file_global_ddl_log, "global_ddl_log", 0}
 };
 
 void init_server_psi_keys()

=== modified file 'sql/tztime.cc'
--- a/sql/tztime.cc	2009-04-17 18:44:53 +0000
+++ b/sql/tztime.cc	2009-05-07 06:42:31 +0000
@@ -138,11 +138,6 @@ static my_bool prepare_tz_info(TIME_ZONE
 
 #if defined(TZINFO2SQL) || defined(TESTTIME)
 
-#ifdef HAVE_PSI_INTERFACE
-/* TODO: Not instrumented, stand alone main() */
-static PSI_file_key key_file_tzload= 0;
-#endif
-
 /*
   Load time zone description from zoneinfo (TZinfo) file.
 
@@ -163,7 +158,7 @@ tz_load(const char *name, TIME_ZONE_INFO
   uint i;
   MYSQL_FILE *file;
 
-  if (!(file= MYSQL_FOPEN(key_file_tzload, name, O_RDONLY|O_BINARY, MYF(MY_WME))))
+  if (!(file= MYSQL_FOPEN(0, name, O_RDONLY|O_BINARY, MYF(MY_WME))))
     return 1;
   {
     union

=== modified file 'storage/archive/azio.h'
--- a/storage/archive/azio.h	2009-04-17 18:44:53 +0000
+++ b/storage/archive/azio.h	2009-05-07 06:42:31 +0000
@@ -43,9 +43,9 @@
 /* We currently allow this on all platforms */
 #define AZIO_AIO
 
+#include <zlib.h>
 #include "my_global.h"
 #include "my_sys.h"
-#include <zlib.h>
 
 #include <my_dir.h>
 

=== modified file 'storage/archive/ha_archive.cc'
--- a/storage/archive/ha_archive.cc	2009-05-05 23:03:45 +0000
+++ b/storage/archive/ha_archive.cc	2009-05-07 06:42:31 +0000
@@ -21,7 +21,6 @@
 #include <myisam.h>
 
 #include "ha_archive.h"
-#include "azio.h"
 #include <my_dir.h>
 
 #include <mysql/plugin.h>

=== modified file 'storage/example/ha_example.cc'
--- a/storage/example/ha_example.cc	2009-05-05 23:03:45 +0000
+++ b/storage/example/ha_example.cc	2009-05-07 06:42:31 +0000
@@ -126,8 +126,8 @@ static uchar* example_get_key(EXAMPLE_SH
 }
 
 #ifdef HAVE_PSI_INTERFACE
-PSI_mutex_key ex_key_mutex_example_mutex;
-PSI_mutex_key ex_key_mutex_EXAMPLE_SHARE_mutex;
+static PSI_mutex_key ex_key_mutex_example_mutex;
+static PSI_mutex_key ex_key_mutex_EXAMPLE_SHARE_mutex;
 
 static PSI_mutex_info all_example_mutexes[]=
 {

=== modified file 'storage/falcon/ha_falcon.cpp'
--- a/storage/falcon/ha_falcon.cpp	2009-04-17 18:44:53 +0000
+++ b/storage/falcon/ha_falcon.cpp	2009-05-07 06:42:31 +0000
@@ -1050,7 +1050,6 @@ THR_LOCK_DATA **StorageInterface::store_
 		}
 
 	*to++ = &lockData;
-        lockData.m_psi= NULL;
 	DBUG_RETURN(to);
 }
 

=== modified file 'storage/federated/ha_federated.cc'
--- a/storage/federated/ha_federated.cc	2009-05-05 23:03:45 +0000
+++ b/storage/federated/ha_federated.cc	2009-05-07 06:42:31 +0000
@@ -389,8 +389,8 @@
 static HASH federated_open_tables;              // To track open tables
 
 #ifdef HAVE_PSI_INTERFACE
-PSI_mutex_key fe_key_mutex_FEDERATED_SHARE_mutex;
-PSI_mutex_key fe_key_mutex_federated_mutex;
+static PSI_mutex_key fe_key_mutex_FEDERATED_SHARE_mutex;
+static PSI_mutex_key fe_key_mutex_federated_mutex;
 #endif
 
 mysql_mutex_t federated_mutex;                // To init the hash

=== modified file 'storage/federated/ha_federated.h'
--- a/storage/federated/ha_federated.h	2009-04-17 18:44:53 +0000
+++ b/storage/federated/ha_federated.h	2009-05-07 06:42:31 +0000
@@ -38,10 +38,6 @@
 #define FEDERATED_RECORDS_IN_RANGE 2
 #define FEDERATED_MAX_KEY_LENGTH 3500 // Same as innodb
 
-#ifdef HAVE_PSI_INTERFACE
-extern PSI_mutex_key fe_key_mutex_FEDERATED_SHARE_mutex;
-#endif
-
 /*
   FEDERATED_SHARE is a structure that will be shared amoung all open handlers
   The example implements the minimum of what you will probably need.

=== modified file 'storage/innobase/handler/ha_innodb.cc'
--- a/storage/innobase/handler/ha_innodb.cc	2009-05-06 23:00:55 +0000
+++ b/storage/innobase/handler/ha_innodb.cc	2009-05-07 06:42:31 +0000
@@ -7611,7 +7611,6 @@ ha_innobase::store_lock(
 	}
 
 	*to++= &lock;
-        lock.m_psi= NULL;
 
 	return(to);
 }

=== modified file 'storage/maria/ma_dbug.c'
--- a/storage/maria/ma_dbug.c	2009-04-17 18:44:53 +0000
+++ b/storage/maria/ma_dbug.c	2009-05-07 06:42:31 +0000
@@ -41,7 +41,7 @@ void _ma_print_keydata(FILE *stream, reg
   for (; keyseg->type && key < key_end ;keyseg++)
   {
     if (flag++)
-      (void)(fputc('-',stream));
+      (void)(putc('-',stream));
     end= key+ keyseg->length;
     if (keyseg->flag & HA_NULL_PART)
     {

=== modified file 'storage/maria/ma_examine_non_trans_log.c'
--- a/storage/maria/ma_examine_non_trans_log.c	2009-04-17 18:44:53 +0000
+++ b/storage/maria/ma_examine_non_trans_log.c	2009-05-07 06:42:31 +0000
@@ -177,12 +177,12 @@ int ma_examine_log(MA_EXAMINE_LOG_PARAM
                        (MA_LOG_END_SENTINEL <= MA_LOG_BIG_NUMBERS) &&
                       (sizeof(mi_exl->com_count) /
                        sizeof(mi_exl->com_count[0]) == MA_LOG_END_SENTINEL));
-  if ((log_file=MYSQL_OPEN(ma_key_file_examine_log, mi_exl->log_filename,O_RDONLY,MYF(MY_WME))) < 0)
+  if ((log_file=MYSQL_OPEN(ma_key_file_backup_log, mi_exl->log_filename,O_RDONLY,MYF(MY_WME))) < 0)
     DBUG_RETURN(1);
   write_file=0;
   if (mi_exl->write_filename)
   {
-    if (!(write_file=MYSQL_FOPEN(ma_key_file_examine_log, mi_exl->write_filename,O_WRONLY,MYF(MY_WME))))
+    if (!(write_file=MYSQL_FOPEN(ma_key_file_backup_log, mi_exl->write_filename,O_WRONLY,MYF(MY_WME))))
     {
       MYSQL_CLOSE(log_file,MYF(0));
       DBUG_RETURN(1);

=== modified file 'storage/maria/ma_ft_eval.c'
--- a/storage/maria/ma_ft_eval.c	2009-04-17 18:44:53 +0000
+++ b/storage/maria/ma_ft_eval.c	2009-05-07 06:42:31 +0000
@@ -20,7 +20,7 @@
 
 static void print_error(int exit_code, const char *fmt,...);
 static void get_options(int argc, char *argv[]);
-static int create_record(char *pos, MYSQL_FILE *file);
+static int create_record(char *pos, FILE *file);
 static void usage();
 
 static struct my_option my_long_options[] =
@@ -35,12 +35,6 @@ static struct my_option my_long_options[
   { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
 };
 
-#ifdef HAVE_PERFORMANCE_SCHEMA
-static PSI_file_key key_file_unknown= 0;
-#endif
-
-#error "Who builds this code ?"
-
 int main(int argc, char *argv[])
 {
   MARIA_HA *file;
@@ -93,7 +87,7 @@ int main(int argc, char *argv[])
       printf("I= %2d  maria_write: %d  errno: %d\n",i,error,my_errno);
     i++;
   }
-  MYSQL_FCLOSE(df);
+  fclose(df);
 
   if (maria_close(file)) goto err;
   if (!silent)
@@ -151,16 +145,16 @@ get_one_option(int optid, const struct m
     if (stopwordlist && stopwordlist != maria_ft_precompiled_stopwords)
       break;
     {
-      MYSQL_FILE *f; char s[HA_FT_MAXLEN]; int i=0,n=SWL_INIT;
+      FILE *f; char s[HA_FT_MAXLEN]; int i=0,n=SWL_INIT;
 
       if (!(stopwordlist=(const char**) malloc(n*sizeof(char *))))
 	print_error(1,"malloc(%d)",n*sizeof(char *));
-      if (!(f=MYSQL_FOPEN(key_file_unknown, argument,"r")))
-	print_error(1,"MYSQL_FOPEN(%s)",argument);
-      while (!MYSQL_FEOF(f))
+      if (!(f=fopen(argument,"r")))
+	print_error(1,"fopen(%s)",argument);
+      while (!feof(f))
       {
-	if (!(MYSQL_FGETS(s,HA_FT_MAXLEN,f)))
-	  print_error(1,"MYSQL_FGETS(s,%d,%s)",HA_FT_MAXLEN,argument);
+	if (!(fgets(s,HA_FT_MAXLEN,f)))
+	  print_error(1,"fgets(s,%d,%s)",HA_FT_MAXLEN,argument);
 	if (!(stopwordlist[i++]=strdup(s)))
 	  print_error(1,"strdup(%s)",s);
 	if (i >= n)
@@ -171,7 +165,7 @@ get_one_option(int optid, const struct m
 	    print_error(1,"realloc(%d)",n*sizeof(char *));
 	}
       }
-      MYSQL_FCLOSE(f);
+      fclose(f);
       stopwordlist[i]=NULL;
       break;
     }
@@ -198,28 +192,28 @@ static void get_options(int argc, char *
     exit(ho_error);
 
   if (!(d_file=argv[optind])) print_error(1,"No d_file");
-  if (!(df=MYSQL_FOPEN(key_file_unknown, d_file,"r")))
-    print_error(1,"MYSQL_FOPEN(%s)",d_file);
+  if (!(df=fopen(d_file,"r")))
+    print_error(1,"fopen(%s)",d_file);
   if (!(q_file=argv[optind+1])) print_error(1,"No q_file");
-  if (!(qf=MYSQL_FOPEN(key_file_unknown, q_file,"r")))
-    print_error(1,"MYSQL_FOPEN(%s)",q_file);
+  if (!(qf=fopen(q_file,"r")))
+    print_error(1,"fopen(%s)",q_file);
   return;
 } /* get options */
 
 
-static int create_record(char *pos, MYSQL_FILE *file)
+static int create_record(char *pos, FILE *file)
 {
   uint tmp; char *ptr;
 
   bzero((char *)pos,MAX_REC_LENGTH);
 
   /* column 1 - VARCHAR */
-  if (!(MYSQL_FGETS(pos+2,MAX_REC_LENGTH-32,file)))
+  if (!(fgets(pos+2,MAX_REC_LENGTH-32,file)))
   {
-    if (MYSQL_FEOF(file))
+    if (feof(file))
       return 0;
     else
-      print_error(1,"MYSQL_FGETS(docid) - 1");
+      print_error(1,"fgets(docid) - 1");
   }
   tmp=(uint) strlen(pos+2)-1;
   int2store(pos,tmp);
@@ -227,8 +221,8 @@ static int create_record(char *pos, MYSQ
 
   /* column 2 - BLOB */
 
-  if (!(MYSQL_FGETS(blob_record,MAX_BLOB_LENGTH,file)))
-    print_error(1,"MYSQL_FGETS(docid) - 2");
+  if (!(fgets(blob_record,MAX_BLOB_LENGTH,file)))
+    print_error(1,"fgets(docid) - 2");
   tmp=(uint) strlen(blob_record);
   int4store(pos,tmp);
   ptr=blob_record;
@@ -243,9 +237,9 @@ static void print_error(int exit_code, c
   va_list args;
 
   va_start(args,fmt);
-  MYSQL_FPRINTF(mysql_stderr,"%s: error: ",my_progname);
-  (void)(MYSQL_VFPRINTF(mysql_stderr, fmt, args));
-  (void)(MYSQL_FPUTC('\n',mysql_stderr));
+  fprintf(stderr,"%s: error: ",my_progname);
+  (void)(vfprintf(stderr, fmt, args));
+  (void)(fputc('\n',stderr));
   fflush(stderr);
   va_end(args);
   exit(exit_code);

=== modified file 'storage/maria/ma_loghandler.c'
--- a/storage/maria/ma_loghandler.c	2009-04-17 18:44:53 +0000
+++ b/storage/maria/ma_loghandler.c	2009-05-07 06:42:31 +0000
@@ -8368,7 +8368,7 @@ extern void translog_example_table_init(
 static const char *load_default_groups[]= { "maria_dump_log",0 };
 static void get_options(int *argc,char * * *argv);
 #ifdef HAVE_PERFORMANCE_SCHEMA
-static PSI_file_key key_file_dump_log= 0;
+static PSI_file_key key_file_dump_log;
 #endif
 #ifndef DBUG_OFF
 #if defined(__WIN__)

=== modified file 'storage/maria/ma_pagecache.c'
--- a/storage/maria/ma_pagecache.c	2009-04-17 18:44:53 +0000
+++ b/storage/maria/ma_pagecache.c	2009-05-07 06:42:31 +0000
@@ -560,29 +560,29 @@ static long pagecache_thread_id;
            sizeof(PAGECACHE_HASH_LINK)))
 
 #if (defined(PAGECACHE_TIMEOUT) && !defined(__WIN__)) || defined(PAGECACHE_DEBUG)
-static int pagecache_cond_wait(mysql_cond_t *cond,
-                               mysql_mutex_t *mutex);
+static int pagecache_pthread_cond_wait(mysql_cond_t *cond,
+                                       mysql_mutex_t *mutex);
 #else
-#define  pagecache_cond_wait(C,M) MYSQL_COND_WAIT(C,M)
+#define  pagecache_pthread_cond_wait(C,M) MYSQL_COND_WAIT(C,M)
 #endif
 
 #if defined(PAGECACHE_DEBUG)
-static int ___pagecache_mutex_lock(mysql_mutex_t *mutex);
-static void ___pagecache_mutex_unlock(mysql_mutex_t *mutex);
-static int ___pagecache_cond_signal(mysql_cond_t *cond);
-#define pagecache_mutex_lock(M) \
+static int ___pagecache_pthread_mutex_lock(mysql_mutex_t *mutex);
+static void ___pagecache_pthread_mutex_unlock(mysql_mutex_t *mutex);
+static int ___pagecache_pthread_cond_signal(mysql_cond_t *cond);
+#define pagecache_pthread_mutex_lock(M) \
 { DBUG_PRINT("lock", ("mutex lock 0x%lx %u", (ulong)(M), __LINE__)); \
-  ___pagecache_mutex_lock(M);}
-#define pagecache_mutex_unlock(M) \
+  ___pagecache_pthread_mutex_lock(M);}
+#define pagecache_pthread_mutex_unlock(M) \
 { DBUG_PRINT("lock", ("mutex unlock 0x%lx %u", (ulong)(M), __LINE__)); \
-  ___pagecache_mutex_unlock(M);}
-#define pagecache_cond_signal(M) \
+  ___pagecache_pthread_mutex_unlock(M);}
+#define pagecache_pthread_cond_signal(M) \
 { DBUG_PRINT("lock", ("signal 0x%lx %u", (ulong)(M), __LINE__)); \
-  ___pagecache_cond_signal(M);}
+  ___pagecache_pthread_cond_signal(M);}
 #else
-#define pagecache_mutex_lock(M) MYSQL_MUTEX_LOCK(M)
-#define pagecache_mutex_unlock(M) MYSQL_MUTEX_UNLOCK(M)
-#define pagecache_cond_signal(C) MYSQL_COND_SIGNAL(C)
+#define pagecache_pthread_mutex_lock(M) MYSQL_MUTEX_LOCK(M)
+#define pagecache_pthread_mutex_unlock(M) MYSQL_MUTEX_UNLOCK(M)
+#define pagecache_pthread_cond_signal(C) MYSQL_COND_SIGNAL(C)
 #endif /* defined(PAGECACHE_DEBUG) */
 
 extern my_bool translog_flush(TRANSLOG_ADDRESS lsn);
@@ -968,7 +968,7 @@ ulong resize_pagecache(PAGECACHE *pageca
     DBUG_RETURN(pagecache->disk_blocks);
   }
 
-  pagecache_mutex_lock(&pagecache->cache_lock);
+  pagecache_pthread_mutex_lock(&pagecache->cache_lock);
 
 #ifdef THREAD
   wqueue= &pagecache->resize_queue;
@@ -977,7 +977,7 @@ ulong resize_pagecache(PAGECACHE *pageca
 
   while (wqueue->last_thread->next != thread)
   {
-    pagecache_cond_wait(&thread->suspend, &pagecache->cache_lock);
+    pagecache_pthread_cond_wait(&thread->suspend, &pagecache->cache_lock);
   }
 #endif
 
@@ -997,7 +997,7 @@ ulong resize_pagecache(PAGECACHE *pageca
   {
     KEYCACHE_DBUG_PRINT("resize_pagecache: wait",
                         ("suspend thread %ld", thread->id));
-    pagecache_cond_wait(&thread->suspend, &pagecache->cache_lock);
+    pagecache_pthread_cond_wait(&thread->suspend, &pagecache->cache_lock);
   }
 #else
   KEYCACHE_DBUG_ASSERT(pagecache->cnt_for_resize_op == 0);
@@ -1017,10 +1017,10 @@ finish:
   {
     KEYCACHE_DBUG_PRINT("resize_pagecache: signal",
                         ("thread %ld", wqueue->last_thread->next->id));
-    pagecache_cond_signal(&wqueue->last_thread->next->suspend);
+    pagecache_pthread_cond_signal(&wqueue->last_thread->next->suspend);
   }
 #endif
-  pagecache_mutex_unlock(&pagecache->cache_lock);
+  pagecache_pthread_mutex_unlock(&pagecache->cache_lock);
   DBUG_RETURN(blocks);
 }
 #endif /* 0 */
@@ -1048,7 +1048,7 @@ static inline void dec_counter_for_resiz
   {
     KEYCACHE_DBUG_PRINT("dec_counter_for_resize_op: signal",
                         ("thread %ld", last_thread->next->id));
-    pagecache_cond_signal(&last_thread->next->suspend);
+    pagecache_pthread_cond_signal(&last_thread->next->suspend);
   }
 #else
   pagecache->cnt_for_resize_op--;
@@ -1078,14 +1078,14 @@ void change_pagecache_param(PAGECACHE *p
 {
   DBUG_ENTER("change_pagecache_param");
 
-  pagecache_mutex_lock(&pagecache->cache_lock);
+  pagecache_pthread_mutex_lock(&pagecache->cache_lock);
   if (division_limit)
     pagecache->min_warm_blocks= (pagecache->disk_blocks *
 				division_limit / 100 + 1);
   if (age_threshold)
     pagecache->age_threshold=   (pagecache->disk_blocks *
 				age_threshold / 100);
-  pagecache_mutex_unlock(&pagecache->cache_lock);
+  pagecache_pthread_mutex_unlock(&pagecache->cache_lock);
   DBUG_VOID_RETURN;
 }
 
@@ -1275,7 +1275,7 @@ static void link_block(PAGECACHE *pageca
       if ((PAGECACHE_HASH_LINK *) thread->opt_info == hash_link)
       {
         KEYCACHE_DBUG_PRINT("link_block: signal", ("thread: %ld", thread->id));
-        pagecache_cond_signal(&thread->suspend);
+        pagecache_pthread_cond_signal(&thread->suspend);
         wqueue_unlink_from_queue(&pagecache->waiting_for_block, thread);
         block->requests++;
       }
@@ -1494,7 +1494,7 @@ static inline void remove_reader(PAGECAC
   DBUG_ASSERT(block->hash_link->requests > 0);
 #ifdef THREAD
   if (! --block->hash_link->requests && block->condvar)
-    pagecache_cond_signal(block->condvar);
+    pagecache_pthread_cond_signal(block->condvar);
 #else
   --block->hash_link->requests;
 #endif
@@ -1519,7 +1519,7 @@ static inline void wait_for_readers(PAGE
                         ("suspend thread: %ld  block: %u",
                          thread->id, PCBLOCK_NUMBER(pagecache, block)));
     block->condvar= &thread->suspend;
-    pagecache_cond_wait(&thread->suspend, &pagecache->cache_lock);
+    pagecache_pthread_cond_wait(&thread->suspend, &pagecache->cache_lock);
     block->condvar= NULL;
   }
 #else
@@ -1584,7 +1584,7 @@ static void unlink_hash(PAGECACHE *pagec
           page->pageno == hash_link->pageno)
       {
         KEYCACHE_DBUG_PRINT("unlink_hash: signal", ("thread %ld", thread->id));
-        pagecache_cond_signal(&thread->suspend);
+        pagecache_pthread_cond_signal(&thread->suspend);
         wqueue_unlink_from_queue(&pagecache->waiting_for_hash_link, thread);
       }
     }
@@ -1720,7 +1720,8 @@ restart:
       wqueue_link_into_queue(&pagecache->waiting_for_hash_link, thread);
       KEYCACHE_DBUG_PRINT("get_hash_link: wait",
                         ("suspend thread %ld", thread->id));
-      pagecache_cond_wait(&thread->suspend, &pagecache->cache_lock);
+      pagecache_pthread_cond_wait(&thread->suspend,
+                                 &pagecache->cache_lock);
       thread->opt_info= NULL;
 #else
       KEYCACHE_DBUG_ASSERT(0);
@@ -1852,7 +1853,8 @@ restart:
       {
         KEYCACHE_DBUG_PRINT("find_block: wait",
                             ("suspend thread %ld", thread->id));
-        pagecache_cond_wait(&thread->suspend, &pagecache->cache_lock);
+        pagecache_pthread_cond_wait(&thread->suspend,
+                                   &pagecache->cache_lock);
       }
       while(thread->next);
 #else
@@ -1907,7 +1909,8 @@ restart:
         {
           KEYCACHE_DBUG_PRINT("find_block: wait",
                               ("suspend thread %ld", thread->id));
-          pagecache_cond_wait(&thread->suspend, &pagecache->cache_lock);
+          pagecache_pthread_cond_wait(&thread->suspend,
+                                     &pagecache->cache_lock);
         }
         while(thread->next);
 #else
@@ -1991,7 +1994,8 @@ restart:
           {
             KEYCACHE_DBUG_PRINT("find_block: wait",
                                 ("suspend thread %ld", thread->id));
-            pagecache_cond_wait(&thread->suspend, &pagecache->cache_lock);
+            pagecache_pthread_cond_wait(&thread->suspend,
+                                       &pagecache->cache_lock);
           }
           while (thread->next);
           thread->opt_info= NULL;
@@ -2039,7 +2043,7 @@ restart:
 
             KEYCACHE_DBUG_PRINT("find_block", ("block is dirty"));
 
-            pagecache_mutex_unlock(&pagecache->cache_lock);
+            pagecache_pthread_mutex_unlock(&pagecache->cache_lock);
             /*
 	      The call is thread safe because only the current
 	      thread might change the block->hash_link value
@@ -2051,7 +2055,7 @@ restart:
                                     block->hash_link->pageno,
                                     block->type,
                                     pagecache->readwrite_flags);
-            pagecache_mutex_lock(&pagecache->cache_lock);
+            pagecache_pthread_mutex_lock(&pagecache->cache_lock);
 	    pagecache->global_cache_write++;
           }
 
@@ -2248,7 +2252,8 @@ static my_bool pagecache_wait_lock(PAGEC
   {
     KEYCACHE_DBUG_PRINT("get_wrlock: wait",
                         ("suspend thread %ld", thread->id));
-    pagecache_cond_wait(&thread->suspend, &pagecache->cache_lock);
+    pagecache_pthread_cond_wait(&thread->suspend,
+                                &pagecache->cache_lock);
   }
   while(thread->next);
 #else
@@ -2613,7 +2618,7 @@ static void read_block(PAGECACHE *pageca
 
     pagecache->global_cache_read++;
     /* Page is not in buffer yet, is to be read from disk */
-    pagecache_mutex_unlock(&pagecache->cache_lock);
+    pagecache_pthread_mutex_unlock(&pagecache->cache_lock);
     /*
       Here other threads may step in and register as secondary readers.
       They will register in block->wqueue[COND_FOR_REQUESTED].
@@ -2622,7 +2627,7 @@ static void read_block(PAGECACHE *pageca
                            block->buffer,
                            block->hash_link->pageno,
                            pagecache->readwrite_flags);
-    pagecache_mutex_lock(&pagecache->cache_lock);
+    pagecache_pthread_mutex_lock(&pagecache->cache_lock);
     if (error)
     {
       block->status|= PCBLOCK_ERROR;
@@ -2666,7 +2671,8 @@ static void read_block(PAGECACHE *pageca
       {
         DBUG_PRINT("read_block: wait",
                   ("suspend thread %ld", thread->id));
-        pagecache_cond_wait(&thread->suspend, &pagecache->cache_lock);
+        pagecache_pthread_cond_wait(&thread->suspend,
+                                   &pagecache->cache_lock);
       }
       while (thread->next);
 #else
@@ -2763,7 +2769,7 @@ void pagecache_unlock(PAGECACHE *pagecac
   DBUG_ASSERT(lock != PAGECACHE_LOCK_READ);
   DBUG_ASSERT(lock != PAGECACHE_LOCK_WRITE);
 
-  pagecache_mutex_lock(&pagecache->cache_lock);
+  pagecache_pthread_mutex_lock(&pagecache->cache_lock);
   /*
     As soon as we keep lock cache can be used, and we have lock because want
     to unlock.
@@ -2823,7 +2829,7 @@ void pagecache_unlock(PAGECACHE *pagecac
 
   dec_counter_for_resize_op(pagecache);
 
-  pagecache_mutex_unlock(&pagecache->cache_lock);
+  pagecache_pthread_mutex_unlock(&pagecache->cache_lock);
 
   DBUG_VOID_RETURN;
 }
@@ -2852,7 +2858,7 @@ void pagecache_unpin(PAGECACHE *pagecach
   DBUG_ENTER("pagecache_unpin");
   DBUG_PRINT("enter", ("fd: %u  page: %lu",
                        (uint) file->file, (ulong) pageno));
-  pagecache_mutex_lock(&pagecache->cache_lock);
+  pagecache_pthread_mutex_lock(&pagecache->cache_lock);
   /*
     As soon as we keep lock cache can be used, and we have lock bacause want
     aunlock.
@@ -2890,7 +2896,7 @@ void pagecache_unpin(PAGECACHE *pagecach
 
   dec_counter_for_resize_op(pagecache);
 
-  pagecache_mutex_unlock(&pagecache->cache_lock);
+  pagecache_pthread_mutex_unlock(&pagecache->cache_lock);
 
   DBUG_VOID_RETURN;
 }
@@ -2941,13 +2947,13 @@ void pagecache_unlock_by_link(PAGECACHE
   DBUG_ASSERT(pin != PAGECACHE_PIN_LEFT_UNPINNED);
   DBUG_ASSERT(lock != PAGECACHE_LOCK_READ);
   DBUG_ASSERT(lock != PAGECACHE_LOCK_WRITE);
-  pagecache_mutex_lock(&pagecache->cache_lock);
+  pagecache_pthread_mutex_lock(&pagecache->cache_lock);
   if (pin == PAGECACHE_PIN_LEFT_UNPINNED &&
       lock == PAGECACHE_LOCK_READ_UNLOCK)
   {
     if (make_lock_and_pin(pagecache, block, lock, pin, FALSE))
       DBUG_ASSERT(0);                         /* should not happend */
-    pagecache_mutex_unlock(&pagecache->cache_lock);
+    pagecache_pthread_mutex_unlock(&pagecache->cache_lock);
     DBUG_VOID_RETURN;
   }
 
@@ -3016,7 +3022,7 @@ void pagecache_unlock_by_link(PAGECACHE
 
   dec_counter_for_resize_op(pagecache);
 
-  pagecache_mutex_unlock(&pagecache->cache_lock);
+  pagecache_pthread_mutex_unlock(&pagecache->cache_lock);
 
   DBUG_VOID_RETURN;
 }
@@ -3045,7 +3051,7 @@ void pagecache_unpin_by_link(PAGECACHE *
                        (uint) block->hash_link->file.file,
                        (ulong) block->hash_link->pageno));
 
-  pagecache_mutex_lock(&pagecache->cache_lock);
+  pagecache_pthread_mutex_lock(&pagecache->cache_lock);
   /*
     As soon as we keep lock cache can be used, and we have lock because want
     unlock.
@@ -3078,7 +3084,7 @@ void pagecache_unpin_by_link(PAGECACHE *
 
   dec_counter_for_resize_op(pagecache);
 
-  pagecache_mutex_unlock(&pagecache->cache_lock);
+  pagecache_pthread_mutex_unlock(&pagecache->cache_lock);
 
   DBUG_VOID_RETURN;
 }
@@ -3292,10 +3298,10 @@ restart:
     uint status;
     int page_st;
 
-    pagecache_mutex_lock(&pagecache->cache_lock);
+    pagecache_pthread_mutex_lock(&pagecache->cache_lock);
     if (!pagecache->can_be_used)
     {
-      pagecache_mutex_unlock(&pagecache->cache_lock);
+      pagecache_pthread_mutex_unlock(&pagecache->cache_lock);
       goto no_key_cache;
     }
 
@@ -3347,7 +3353,7 @@ restart:
       */
       if (reg_request)
         unreg_request(pagecache, block, 1);
-      pagecache_mutex_unlock(&pagecache->cache_lock);
+      pagecache_pthread_mutex_unlock(&pagecache->cache_lock);
       DBUG_PRINT("info", ("restarting..."));
       goto restart;
     }
@@ -3371,7 +3377,7 @@ restart:
       if (!(status & PCBLOCK_ERROR))
       {
 #if !defined(SERIALIZED_READ_FROM_CACHE)
-        pagecache_mutex_unlock(&pagecache->cache_lock);
+        pagecache_pthread_mutex_unlock(&pagecache->cache_lock);
 #endif
 
         DBUG_ASSERT((pagecache->block_size & 511) == 0);
@@ -3379,7 +3385,7 @@ restart:
         bmove512(buff, block->buffer, pagecache->block_size);
 
 #if !defined(SERIALIZED_READ_FROM_CACHE)
-        pagecache_mutex_lock(&pagecache->cache_lock);
+        pagecache_pthread_mutex_lock(&pagecache->cache_lock);
 #endif
       }
       else
@@ -3407,7 +3413,7 @@ restart:
 
     dec_counter_for_resize_op(pagecache);
 
-    pagecache_mutex_unlock(&pagecache->cache_lock);
+    pagecache_pthread_mutex_unlock(&pagecache->cache_lock);
 
     if (status & PCBLOCK_ERROR)
     {
@@ -3458,7 +3464,7 @@ static my_bool pagecache_delete_internal
 
       KEYCACHE_DBUG_PRINT("find_block", ("block is dirty"));
 
-      pagecache_mutex_unlock(&pagecache->cache_lock);
+      pagecache_pthread_mutex_unlock(&pagecache->cache_lock);
       /*
         The call is thread safe because only the current
         thread might change the block->hash_link value
@@ -3470,7 +3476,7 @@ static my_bool pagecache_delete_internal
                               block->hash_link->pageno,
                               block->type,
                               pagecache->readwrite_flags);
-      pagecache_mutex_lock(&pagecache->cache_lock);
+      pagecache_pthread_mutex_lock(&pagecache->cache_lock);
       pagecache->global_cache_write++;
 
       if (error)
@@ -3539,7 +3545,7 @@ my_bool pagecache_delete_by_link(PAGECAC
 
   if (pagecache->can_be_used)
   {
-    pagecache_mutex_lock(&pagecache->cache_lock);
+    pagecache_pthread_mutex_lock(&pagecache->cache_lock);
     if (!pagecache->can_be_used)
       goto end;
 
@@ -3565,7 +3571,7 @@ my_bool pagecache_delete_by_link(PAGECAC
     error= pagecache_delete_internal(pagecache, block, block->hash_link,
                                      flush);
 end:
-    pagecache_mutex_unlock(&pagecache->cache_lock);
+    pagecache_pthread_mutex_unlock(&pagecache->cache_lock);
   }
 
   DBUG_RETURN(error);
@@ -3656,7 +3662,7 @@ restart:
     reg1 PAGECACHE_BLOCK_LINK *block;
     PAGECACHE_HASH_LINK **unused_start, *page_link;
 
-    pagecache_mutex_lock(&pagecache->cache_lock);
+    pagecache_pthread_mutex_lock(&pagecache->cache_lock);
     if (!pagecache->can_be_used)
       goto end;
 
@@ -3665,7 +3671,7 @@ restart:
     if (!page_link)
     {
       DBUG_PRINT("info", ("There is no such page in the cache"));
-      pagecache_mutex_unlock(&pagecache->cache_lock);
+      pagecache_pthread_mutex_unlock(&pagecache->cache_lock);
       DBUG_RETURN(0);
     }
     block= page_link->block;
@@ -3691,7 +3697,7 @@ restart:
       */
       if (pin == PAGECACHE_PIN)
         unreg_request(pagecache, block, 1);
-      pagecache_mutex_unlock(&pagecache->cache_lock);
+      pagecache_pthread_mutex_unlock(&pagecache->cache_lock);
       DBUG_PRINT("info", ("restarting..."));
       goto restart;
     }
@@ -3701,7 +3707,7 @@ restart:
 
     error= pagecache_delete_internal(pagecache, block, page_link, flush);
 end:
-    pagecache_mutex_unlock(&pagecache->cache_lock);
+    pagecache_pthread_mutex_unlock(&pagecache->cache_lock);
   }
 
   DBUG_RETURN(error);
@@ -3848,10 +3854,10 @@ restart:
     int page_st;
     my_bool need_page_ready_signal= FALSE;
 
-    pagecache_mutex_lock(&pagecache->cache_lock);
+    pagecache_pthread_mutex_lock(&pagecache->cache_lock);
     if (!pagecache->can_be_used)
     {
-      pagecache_mutex_unlock(&pagecache->cache_lock);
+      pagecache_pthread_mutex_unlock(&pagecache->cache_lock);
       goto no_key_cache;
     }
 
@@ -3868,7 +3874,7 @@ restart:
       DBUG_ASSERT(write_mode != PAGECACHE_WRITE_DONE);
       /* It happens only for requests submitted during resize operation */
       dec_counter_for_resize_op(pagecache);
-      pagecache_mutex_unlock(&pagecache->cache_lock);
+      pagecache_pthread_mutex_unlock(&pagecache->cache_lock);
       /* Write to the disk key cache is in resize at the moment*/
       goto no_key_cache;
     }
@@ -3912,7 +3918,7 @@ restart:
       */
       if (reg_request)
         unreg_request(pagecache, block, 1);
-      pagecache_mutex_unlock(&pagecache->cache_lock);
+      pagecache_pthread_mutex_unlock(&pagecache->cache_lock);
       DBUG_PRINT("info", ("restarting..."));
       goto restart;
     }
@@ -4018,7 +4024,7 @@ restart:
 
     dec_counter_for_resize_op(pagecache);
 
-    pagecache_mutex_unlock(&pagecache->cache_lock);
+    pagecache_pthread_mutex_unlock(&pagecache->cache_lock);
 
     goto end;
   }
@@ -4175,14 +4181,14 @@ static int flush_cached_blocks(PAGECACHE
   *first_errno= 0;
 
   /* Don't lock the cache during the flush */
-  pagecache_mutex_unlock(&pagecache->cache_lock);
+  pagecache_pthread_mutex_unlock(&pagecache->cache_lock);
   /*
      As all blocks referred in 'cache' are marked by PCBLOCK_IN_FLUSH
      we are guaranteed that no thread will change them
   */
   qsort((uchar*) cache, count, sizeof(*cache), (qsort_cmp) cmp_sec_link);
 
-  pagecache_mutex_lock(&pagecache->cache_lock);
+  pagecache_pthread_mutex_lock(&pagecache->cache_lock);
   for (; cache != end; cache++)
   {
     PAGECACHE_BLOCK_LINK *block= *cache;
@@ -4218,7 +4224,7 @@ static int flush_cached_blocks(PAGECACHE
     DBUG_PRINT("info", ("block: %u (0x%lx)  to be flushed",
                         PCBLOCK_NUMBER(pagecache, block), (ulong)block));
     PCBLOCK_INFO(block);
-    pagecache_mutex_unlock(&pagecache->cache_lock);
+    pagecache_pthread_mutex_unlock(&pagecache->cache_lock);
     DBUG_PRINT("info", ("block: %u (0x%lx)  pins: %u",
                         PCBLOCK_NUMBER(pagecache, block), (ulong)block,
                         block->pins));
@@ -4238,7 +4244,7 @@ static int flush_cached_blocks(PAGECACHE
                             block->hash_link->pageno,
                             block->type,
                             pagecache->readwrite_flags);
-    pagecache_mutex_lock(&pagecache->cache_lock);
+    pagecache_pthread_mutex_lock(&pagecache->cache_lock);
 
     if (make_lock_and_pin(pagecache, block,
                           PAGECACHE_LOCK_WRITE_UNLOCK,
@@ -4383,7 +4389,8 @@ static int flush_pagecache_blocks_int(PA
       {
         KEYCACHE_DBUG_PRINT("flush_pagecache_blocks_int: wait1",
                             ("suspend thread %ld", thread->id));
-        pagecache_cond_wait(&thread->suspend, &pagecache->cache_lock);
+        pagecache_pthread_cond_wait(&thread->suspend,
+                                    &pagecache->cache_lock);
       }
       while (thread->next);
     }
@@ -4402,11 +4409,11 @@ static int flush_pagecache_blocks_int(PA
         and thus require a table check.
       */
       DBUG_ASSERT(0);
-      pagecache_mutex_unlock(&pagecache->cache_lock);
+      pagecache_pthread_mutex_unlock(&pagecache->cache_lock);
       if (my_thread_var->abort)
         DBUG_RETURN(1);		/* End if aborted by user */
       sleep(10);
-      pagecache_mutex_lock(&pagecache->cache_lock);
+      pagecache_pthread_mutex_lock(&pagecache->cache_lock);
     }
 #endif
 
@@ -4542,7 +4549,8 @@ restart:
         {
           KEYCACHE_DBUG_PRINT("flush_pagecache_blocks_int: wait2",
                               ("suspend thread %ld", thread->id));
-          pagecache_cond_wait(&thread->suspend, &pagecache->cache_lock);
+          pagecache_pthread_cond_wait(&thread->suspend,
+                                     &pagecache->cache_lock);
         }
         while (thread->next);
 #else
@@ -4641,11 +4649,11 @@ int flush_pagecache_blocks_with_filter(P
 
   if (pagecache->disk_blocks <= 0)
     DBUG_RETURN(0);
-  pagecache_mutex_lock(&pagecache->cache_lock);
+  pagecache_pthread_mutex_lock(&pagecache->cache_lock);
   inc_counter_for_resize_op(pagecache);
   res= flush_pagecache_blocks_int(pagecache, file, type, filter, filter_arg);
   dec_counter_for_resize_op(pagecache);
-  pagecache_mutex_unlock(&pagecache->cache_lock);
+  pagecache_pthread_mutex_unlock(&pagecache->cache_lock);
   DBUG_RETURN(res);
 }
 
@@ -4722,7 +4730,7 @@ my_bool pagecache_collect_changed_blocks
     We lock the entire cache but will be quick, just reading/writing a few MBs
     of memory at most.
   */
-  pagecache_mutex_lock(&pagecache->cache_lock);
+  pagecache_pthread_mutex_lock(&pagecache->cache_lock);
 #ifdef THREAD
   for (;;)
   {
@@ -4752,7 +4760,8 @@ my_bool pagecache_collect_changed_blocks
       {
         KEYCACHE_DBUG_PRINT("pagecache_collect_changed_blocks_with_lsn: wait",
                             ("suspend thread %ld", thread->id));
-        pagecache_cond_wait(&thread->suspend, &pagecache->cache_lock);
+        pagecache_pthread_cond_wait(&thread->suspend,
+                                    &pagecache->cache_lock);
       }
       while (thread->next);
     }
@@ -4830,7 +4839,7 @@ my_bool pagecache_collect_changed_blocks
     }
   }
 end:
-  pagecache_mutex_unlock(&pagecache->cache_lock);
+  pagecache_pthread_mutex_unlock(&pagecache->cache_lock);
   *min_rec_lsn= minimum_rec_lsn;
   DBUG_RETURN(error);
 
@@ -4886,7 +4895,7 @@ uchar *pagecache_block_link_to_buffer(PA
 
 static void pagecache_dump(PAGECACHE *pagecache)
 {
-  MYSQL_FILE *pagecache_dump_file=MYSQL_FOPEN(key_file_keycache_dump, KEYCACHE_DUMP_FILE, "w");
+  MYSQL_FILE *pagecache_dump_file=MYSQL_FOPEN(key_file_pagecache_dump, KEYCACHE_DUMP_FILE, "w");
   struct st_my_thread_var *last;
   struct st_my_thread_var *thread;
   PAGECACHE_BLOCK_LINK *block;
@@ -4981,8 +4990,8 @@ static void pagecache_dump(PAGECACHE *pa
 #if defined(PAGECACHE_TIMEOUT) && !defined(__WIN__)
 
 
-static int pagecache_cond_wait(mysql_cond_t *cond,
-                               mysql_mutex_t *mutex)
+static int pagecache_pthread_cond_wait(mysql_cond_t *cond,
+                                       mysql_mutex_t *mutex)
 {
   int rc;
   struct timeval  now;            /* time when we started waiting        */
@@ -5030,8 +5039,8 @@ static int pagecache_cond_wait(mysql_con
 }
 #else
 #if defined(PAGECACHE_DEBUG)
-static int pagecache_cond_wait(mysql_cond_t *cond,
-                               mysql_mutex_t *mutex)
+static int pagecache_pthread_cond_wait(mysql_cond_t *cond,
+                                       mysql_mutex_t *mutex)
 {
   int rc;
   KEYCACHE_THREAD_TRACE_END("started waiting");
@@ -5043,7 +5052,7 @@ static int pagecache_cond_wait(mysql_con
 #endif /* defined(PAGECACHE_TIMEOUT) && !defined(__WIN__) */
 
 #if defined(PAGECACHE_DEBUG)
-static int ___pagecache_mutex_lock(mysql_mutex_t *mutex)
+static int ___pagecache_pthread_mutex_lock(mysql_mutex_t *mutex)
 {
   int rc;
   rc= MYSQL_MUTEX_LOCK(mutex);
@@ -5052,14 +5061,14 @@ static int ___pagecache_mutex_lock(mysql
 }
 
 
-static void ___pagecache_mutex_unlock(mutex_mutex_t *mutex)
+static void ___pagecache_pthread_mutex_unlock(mutex_mutex_t *mutex)
 {
   KEYCACHE_THREAD_TRACE_END("");
   MYSQL_MUTEX_UNLOCK(mutex);
 }
 
 
-static int ___pagecache_cond_signal(mysql_cond_t *cond)
+static int ___pagecache_pthread_cond_signal(mysql_cond_t *cond)
 {
   int rc;
   KEYCACHE_THREAD_TRACE("signal");

=== modified file 'storage/maria/ma_static.c'
--- a/storage/maria/ma_static.c	2009-04-17 18:44:53 +0000
+++ b/storage/maria/ma_static.c	2009-05-07 06:42:31 +0000
@@ -129,46 +129,26 @@ PSI_mutex_key ma_key_mutex_translog_desc
 
 static PSI_mutex_info all_maria_mutexes[]=
 {
-  { & ma_key_mutex_MARIA_SHARE_key_del_lock,
-    "MARIA_SHARE::key_del_lock", 0},
-  { & ma_key_mutex_MARIA_SHARE_close_lock,
-    "MARIA_SHARE::close_lock", 0},
-  { & ma_key_mutex_MARIA_SHARE_intern_lock,
-    "MARIA_SHARE::intern_lock", 0},
-  { & ma_key_mutex_MARIA_FILE_BITMAP_bitmap_lock,
-    "MARIA_FILE_BITMAP::bitmap_lock", PSI_FLAG_GLOBAL},
-  { & ma_key_mutex_MARIA_SORT_INFO_mutex,
-    "MARIA_SORT_INFO::mutex", PSI_FLAG_GLOBAL},
-  { & ma_key_mutex_THR_LOCK_maria,
-    "THR_LOCK_maria", PSI_FLAG_GLOBAL},
-  { & ma_key_mutex_THR_LOCK_maria_log,
-    "THR_LOCK_maria_log", PSI_FLAG_GLOBAL},
-  { & ma_key_mutex_LOCK_trn_list,
-    "LOCK_trn_list", PSI_FLAG_GLOBAL},
-  { & ma_key_mutex_TRN_state_lock,
-    "TRN::state_lock", 0},
-  { & ma_key_mutex_TABLOCKMAN_pool_mutex,
-    "TABLOCKMAN::pool_mutex", PSI_FLAG_GLOBAL},
-  { & ma_key_mutex_LOCKED_TABLE_mutex,
-    "LOCKED_TABLE::mutex", PSI_FLAG_GLOBAL},
-  { & ma_key_mutex_PAGECACHE_cache_lock,
-    "PAGECACHE::cache_lock", PSI_FLAG_GLOBAL},
-  { & ma_key_mutex_LOCK_checkpoint,
-    "LOCK_checkpoint", PSI_FLAG_GLOBAL},
-  { & ma_key_mutex_translog_buffer_mutex,
-    "translog_buffer::mutex", PSI_FLAG_GLOBAL},
-  { & ma_key_mutex_translog_descriptor_sent_to_disk_lock,
-    "translog_d::sent_to_disk", PSI_FLAG_GLOBAL},
-  { & ma_key_mutex_translog_descriptor_file_header_lock,
-    "translog_d::file_header", PSI_FLAG_GLOBAL},
-  { & ma_key_mutex_translog_descriptor_unfinished_files_lock,
-    "translog_d::unfinished_files", PSI_FLAG_GLOBAL},
-  { & ma_key_mutex_translog_descriptor_purger_lock,
-    "translog_d::purger", PSI_FLAG_GLOBAL},
-  { & ma_key_mutex_translog_descriptor_log_flush_lock,
-    "translog_d::log_flush", PSI_FLAG_GLOBAL},
-  { & ma_key_mutex_translog_descriptor_dirty_buffer_mask_lock,
-    "translog_d::dirty_buffer_mask", PSI_FLAG_GLOBAL}
+  { & ma_key_mutex_MARIA_SHARE_key_del_lock, "MARIA_SHARE::key_del_lock", 0},
+  { & ma_key_mutex_MARIA_SHARE_close_lock, "MARIA_SHARE::close_lock", 0},
+  { & ma_key_mutex_MARIA_SHARE_intern_lock, "MARIA_SHARE::intern_lock", 0},
+  { & ma_key_mutex_MARIA_FILE_BITMAP_bitmap_lock, "MARIA_FILE_BITMAP::bitmap_lock", 0},
+  { & ma_key_mutex_MARIA_SORT_INFO_mutex, "MARIA_SORT_INFO::mutex", 0},
+  { & ma_key_mutex_THR_LOCK_maria, "THR_LOCK_maria", PSI_FLAG_GLOBAL},
+  { & ma_key_mutex_THR_LOCK_maria_log, "THR_LOCK_maria_log", PSI_FLAG_GLOBAL},
+  { & ma_key_mutex_LOCK_trn_list, "LOCK_trn_list", PSI_FLAG_GLOBAL},
+  { & ma_key_mutex_TRN_state_lock, "TRN::state_lock", 0},
+  { & ma_key_mutex_TABLOCKMAN_pool_mutex, "TABLOCKMAN::pool_mutex", PSI_FLAG_GLOBAL},
+  { & ma_key_mutex_LOCKED_TABLE_mutex, "LOCKED_TABLE::mutex", 0},
+  { & ma_key_mutex_PAGECACHE_cache_lock, "PAGECACHE::cache_lock", 0},
+  { & ma_key_mutex_LOCK_checkpoint, "LOCK_checkpoint", PSI_FLAG_GLOBAL},
+  { & ma_key_mutex_translog_buffer_mutex, "translog_buffer::mutex", 0},
+  { & ma_key_mutex_translog_descriptor_sent_to_disk_lock, "translog_descriptor::sent_to_disk", 0},
+  { & ma_key_mutex_translog_descriptor_file_header_lock, "translog_descriptor::file_header", 0},
+  { & ma_key_mutex_translog_descriptor_unfinished_files_lock, "translog_descriptor::unfinished_files", 0},
+  { & ma_key_mutex_translog_descriptor_purger_lock, "translog_descriptor::purger", 0},
+  { & ma_key_mutex_translog_descriptor_log_flush_lock, "translog_descriptor::log_flush", 0},
+  { & ma_key_mutex_translog_descriptor_dirty_buffer_mask_lock, "translog_descriptor::dirty_buffer_mask", 0}
 };
 
 PSI_rwlock_key ma_key_rwlock_MARIA_KEYDEF_root_lock;
@@ -177,12 +157,9 @@ PSI_rwlock_key ma_key_rwlock_translog_de
 
 static PSI_rwlock_info all_maria_rwlocks[]=
 {
-  { & ma_key_rwlock_MARIA_KEYDEF_root_lock,
-    "MARIA_KEYDEF::root_lock", 0},
-  { & ma_key_rwlock_MARIA_SHARE_mmap_lock,
-    "MARIA_SHARE::mmap_lock", 0},
-  { & ma_key_rwlock_translog_descriptor_open_files_lock,
-    "translog_d::open_files", PSI_FLAG_GLOBAL}
+  { & ma_key_rwlock_MARIA_KEYDEF_root_lock, "MARIA_KEYDEF::root_lock", 0},
+  { & ma_key_rwlock_MARIA_SHARE_mmap_lock, "MARIA_SHARE::mmap_lock", 0},
+  { & ma_key_rwlock_translog_descriptor_open_files_lock, "translog_descriptor::open_files", 0}
 };
 
 PSI_cond_key ma_key_cond_MARIA_SHARE_intern_cond;
@@ -197,24 +174,15 @@ PSI_cond_key ma_key_cond_backup_cond_loc
 
 static PSI_cond_info all_maria_conds[]=
 {
-  { & ma_key_cond_MARIA_SHARE_intern_cond,
-    "MARIA_SHARE::intern_cond", 0},
-  { & ma_key_cond_MARIA_SHARE_key_del_cond,
-    "MARIA_SHARE::key_del_cond", 0},
-  { & ma_key_cond_MARIA_FILE_BITMAP_bitmap_cond,
-    "MARIA_FILE_BITMAP::bitmap_cond", 0},
-  { & ma_key_cond_MARIA_SORT_INFO_cond,
-    "MARIA_SORT_INFO::cond", 0},
-  { & ma_key_cond_COND_checkpoint,
-    "COND_checkpoint", PSI_FLAG_GLOBAL},
-  { & ma_key_cond_translog_buffer_waiting_filling_buffer,
-    "translog_b::waiting_filling_buffer", PSI_FLAG_GLOBAL},
-  { & ma_key_cond_translog_buffer_prev_sent_to_disk_cond,
-    "translog_b::prev_sent_to_disk", PSI_FLAG_GLOBAL},
-  { & ma_key_cond_translog_descriptor_log_flush_cond,
-    "translog_d::log_flush", PSI_FLAG_GLOBAL},
-  { & ma_key_cond_backup_cond_lock_state,
-    "Backup::COND_lock_state", 0}
+  { & ma_key_cond_MARIA_SHARE_intern_cond, "MARIA_SHARE::intern_cond", 0},
+  { & ma_key_cond_MARIA_SHARE_key_del_cond, "MARIA_SHARE::key_del_cond", 0},
+  { & ma_key_cond_MARIA_FILE_BITMAP_bitmap_cond, "MARIA_FILE_BITMAP::bitmap_cond", 0},
+  { & ma_key_cond_MARIA_SORT_INFO_cond, "MARIA_SORT_INFO::cond", 0},
+  { & ma_key_cond_COND_checkpoint, "COND_checkpoint", PSI_FLAG_GLOBAL},
+  { & ma_key_cond_translog_buffer_waiting_filling_buffer, "translog_buffer::waiting_filling_buffer", 0},
+  { & ma_key_cond_translog_buffer_prev_sent_to_disk_cond, "translog_buffer::prev_sent_to_disk", 0},
+  { & ma_key_cond_translog_descriptor_log_flush_cond, "translog_descriptor::log_flush", 0},
+  { & ma_key_cond_backup_cond_lock_state, "Backup::COND_lock_state", 0}
 };
 
 PSI_thread_key ma_key_thread_find_all_keys;
@@ -223,12 +191,9 @@ PSI_thread_key ma_key_thread_backup;
 
 static PSI_thread_info all_maria_threads[]=
 {
-  { & ma_key_thread_find_all_keys,
-    "find_all_keys", PSI_FLAG_GLOBAL},
-  { & ma_key_thread_find_all_keys,
-    "checkpoint_background", PSI_FLAG_GLOBAL},
-  { & ma_key_thread_backup,
-    "backup", 0}
+  { & ma_key_thread_find_all_keys, "find_all_keys", PSI_FLAG_GLOBAL},
+  { & ma_key_thread_find_all_keys, "checkpoint_background", PSI_FLAG_GLOBAL},
+  { & ma_key_thread_backup, "backup", 0}
 };
 
 PSI_file_key ma_key_file_control;
@@ -236,35 +201,21 @@ PSI_file_key ma_key_file_kfile;
 PSI_file_key ma_key_file_dfile;
 PSI_file_key ma_key_file_datatmp;
 PSI_file_key ma_key_file_indextmp;
-PSI_file_key ma_key_file_iext;
 PSI_file_key ma_key_file_translog;
 PSI_file_key ma_key_file_logdescrdir;
 PSI_file_key ma_key_file_recovery_trace;
-PSI_file_key ma_key_file_examine_log;
 PSI_file_key ma_key_file_backup_log;
 
 static PSI_file_info all_maria_files[]=
 {
-  { & ma_key_file_control,
-    "control", PSI_FLAG_GLOBAL},
-  { & ma_key_file_kfile,
-    "key_file", 0},
-  { & ma_key_file_dfile,
-    "data_file", 0},
-  { & ma_key_file_datatmp,
-    "data_tmp", 0},
-  { & ma_key_file_indextmp,
-    "index_tmp", 0},
-  { & ma_key_file_iext,
-    "iext", 0},
-  { & ma_key_file_logdescrdir,
-    "log_descriptor_directory", 0},
-  { & ma_key_file_recovery_trace,
-    "recovery_trace", 0},
-  { & ma_key_file_examine_log,
-    "examine_log", 0},
-  { & ma_key_file_backup_log,
-    "backup_log", 0}
+  { & ma_key_file_control, "control", PSI_FLAG_GLOBAL},
+  { & ma_key_file_kfile, "key_file", 0},
+  { & ma_key_file_dfile, "data_file", 0},
+  { & ma_key_file_datatmp, "data_tmp", 0},
+  { & ma_key_file_indextmp, "index_tmp", 0},
+  { & ma_key_file_logdescrdir, "log_descriptor_directory", 0},
+  { & ma_key_file_recovery_trace, "recovery_trace", 0},
+  { & ma_key_file_backup_log, "backup_log", 0}
 };
 
 void init_maria_psi_keys()

=== modified file 'storage/maria/ma_test1.c'
--- a/storage/maria/ma_test1.c	2009-04-17 18:44:53 +0000
+++ b/storage/maria/ma_test1.c	2009-05-07 06:42:31 +0000
@@ -89,7 +89,7 @@ int main(int argc,char *argv[])
                     TRANSLOG_DEFAULT_FLAGS, 0) ||
       (transactional && (trnman_init(0) || ma_checkpoint_init(0))))
   {
-    MYSQL_FPRINTF(mysql_stderr, "Error in initialization\n");
+    fprintf(stderr, "Error in initialization\n");
     exit(1);
   }
   if (opt_versioning)
@@ -365,7 +365,7 @@ static int run_test(const char *filename
       /* testing */
       if (remove_count-- == 0)
       {
-        MYSQL_FPRINTF(mysql_stderr,
+        fprintf(stderr,
                 "delete-rows number of rows deleted; Going down hard!\n");
         goto end;
       }
@@ -427,7 +427,7 @@ static int run_test(const char *filename
     printf("- Reading rows with position\n");
   if (maria_scan_init(file))
   {
-    MYSQL_FPRINTF(mysql_stderr, "maria_scan_init failed\n");
+    fprintf(stderr, "maria_scan_init failed\n");
     goto err;
   }
 
@@ -848,7 +848,7 @@ get_one_option(int optid, const struct m
   case 'k':
     if (key_length < 4 || key_length > HA_MAX_KEY_LENGTH)
     {
-      MYSQL_FPRINTF(mysql_stderr,"Wrong key length\n");
+      fprintf(stderr,"Wrong key length\n");
       exit(1);
     }
     break;

=== modified file 'storage/maria/ma_test2.c'
--- a/storage/maria/ma_test2.c	2009-04-17 18:44:53 +0000
+++ b/storage/maria/ma_test2.c	2009-05-07 06:42:31 +0000
@@ -97,7 +97,7 @@ int main(int argc, char *argv[])
 		    TRANSLOG_DEFAULT_FLAGS, 0) ||
       (transactional && (trnman_init(0) || ma_checkpoint_init(0))))
   {
-    MYSQL_FPRINTF(mysql_stderr, "Error in initialization");
+    fprintf(stderr, "Error in initialization");
     exit(1);
   }
   if (opt_versioning)
@@ -1074,7 +1074,7 @@ static void get_options(int argc, char *
     case 'm':				/* records */
       if ((recant=atoi(++pos)) < 10 && testflag > 2)
       {
-	MYSQL_FPRINTF(mysql_stderr,"record count must be >= 10 (if testflag > 2)\n");
+	fprintf(stderr,"record count must be >= 10 (if testflag > 2)\n");
 	exit(1);
       }
       break;
@@ -1083,7 +1083,7 @@ static void get_options(int argc, char *
       if ((maria_block_size= atoi(++pos)) < MARIA_MIN_KEY_BLOCK_LENGTH ||
 	  maria_block_size > MARIA_MAX_KEY_BLOCK_LENGTH)
       {
-	MYSQL_FPRINTF(mysql_stderr,"Wrong maria_block_length\n");
+	fprintf(stderr,"Wrong maria_block_length\n");
 	exit(1);
       }
       maria_block_size= my_round_up_to_next_power(maria_block_size);

=== modified file 'storage/maria/ma_test3.c'
--- a/storage/maria/ma_test3.c	2009-04-17 18:44:53 +0000
+++ b/storage/maria/ma_test3.c	2009-05-07 06:42:31 +0000
@@ -15,10 +15,6 @@
 
 /* Test av locking */
 
-/* For mysql_stderr */
-#include "my_global.h"
-#include "my_sys.h"
-
 #if !(defined (__NETWARE_) || defined (_WIN32)) /*no fork() in Windows*/
 
 #include "maria.h"
@@ -42,6 +38,7 @@
 #define rnd_init(X) srandom(X)
 #endif
 
+
 const char *filename= "test3";
 uint tests=10,forks=10,pagecacheing=0;
 
@@ -67,7 +64,7 @@ int main(int argc,char **argv)
   MY_INIT(argv[0]);
   get_options(argc,argv);
 
-  MYSQL_FPRINTF(mysql_stderr, "WARNING! this program is to test 'external locking'"
+  fprintf(stderr, "WARNING! this program is to test 'external locking'"
           " (when several processes share a table through file locking)"
           " which is not supported by Maria at all; expect errors."
           " We may soon remove this program.\n");
@@ -177,7 +174,7 @@ void start_test(int id)
   if (!(file1=maria_open(filename,O_RDWR,HA_OPEN_WAIT_IF_LOCKED)) ||
       !(file2=maria_open(filename,O_RDWR,HA_OPEN_WAIT_IF_LOCKED)))
   {
-    MYSQL_FPRINTF(mysql_stderr,"Can't open isam-file: %s\n",filename);
+    fprintf(stderr,"Can't open isam-file: %s\n",filename);
     exit(1);
   }
   if (pagecacheing && rnd(2) == 0)
@@ -194,7 +191,7 @@ void start_test(int id)
       if (maria_lock_database(lock=(rnd(2) ? file1 : file2),
 			   lock_type=(rnd(2) == 0 ? F_RDLCK : F_WRLCK)))
       {
-	MYSQL_FPRINTF(mysql_stderr,"%2d: start: Can't lock table %d\n",id,my_errno);
+	fprintf(stderr,"%2d: start: Can't lock table %d\n",id,my_errno);
 	error=1;
 	break;
       }
@@ -237,7 +234,7 @@ int test_read(MARIA_HA *file,int id)
     lock=1;
     if (maria_lock_database(file,F_RDLCK))
     {
-      MYSQL_FPRINTF(mysql_stderr,"%2d: Can't lock table %d\n",id,my_errno);
+      fprintf(stderr,"%2d: Can't lock table %d\n",id,my_errno);
       return 1;
     }
   }
@@ -253,7 +250,7 @@ int test_read(MARIA_HA *file,int id)
     {
       if (my_errno != HA_ERR_KEY_NOT_FOUND)
       {
-	MYSQL_FPRINTF(mysql_stderr,"%2d: Got error %d from read in read\n",id,my_errno);
+	fprintf(stderr,"%2d: Got error %d from read in read\n",id,my_errno);
 	return 1;
       }
       else if (!maria_rnext(file,record.id,1))
@@ -262,7 +259,7 @@ int test_read(MARIA_HA *file,int id)
       {
 	if (my_errno != HA_ERR_END_OF_FILE)
 	{
-	  MYSQL_FPRINTF(mysql_stderr,"%2d: Got error %d from rnext in read\n",id,my_errno);
+	  fprintf(stderr,"%2d: Got error %d from rnext in read\n",id,my_errno);
 	  return 1;
 	}
 	else if (!maria_rprev(file,record.id,1))
@@ -271,7 +268,7 @@ int test_read(MARIA_HA *file,int id)
 	{
 	  if (my_errno != HA_ERR_END_OF_FILE)
 	  {
-	    MYSQL_FPRINTF(mysql_stderr,"%2d: Got error %d from rnext in read\n",
+	    fprintf(stderr,"%2d: Got error %d from rnext in read\n",
 		    id,my_errno);
 	    return 1;
 	  }
@@ -283,7 +280,7 @@ int test_read(MARIA_HA *file,int id)
   {
     if (maria_lock_database(file,F_UNLCK))
     {
-      MYSQL_FPRINTF(mysql_stderr,"%2d: Can't unlock table\n",id);
+      fprintf(stderr,"%2d: Can't unlock table\n",id);
       return 1;
     }
   }
@@ -304,7 +301,7 @@ int test_rrnd(MARIA_HA *file,int id)
     lock=1;
     if (maria_lock_database(file,F_RDLCK))
     {
-      MYSQL_FPRINTF(mysql_stderr,"%2d: Can't lock table (%d)\n",id,my_errno);
+      fprintf(stderr,"%2d: Can't lock table (%d)\n",id,my_errno);
       maria_close(file);
       return 1;
     }
@@ -317,13 +314,13 @@ int test_rrnd(MARIA_HA *file,int id)
   {
     if (my_errno == HA_ERR_END_OF_FILE)
       goto end;
-    MYSQL_FPRINTF(mysql_stderr,"%2d: Can't read first record (%d)\n",id,my_errno);
+    fprintf(stderr,"%2d: Can't read first record (%d)\n",id,my_errno);
     return 1;
   }
   for (count=1 ; !maria_rrnd(file,record.id,HA_OFFSET_ERROR) ;count++) ;
   if (my_errno != HA_ERR_END_OF_FILE)
   {
-    MYSQL_FPRINTF(mysql_stderr,"%2d: Got error %d from rrnd\n",id,my_errno);
+    fprintf(stderr,"%2d: Got error %d from rrnd\n",id,my_errno);
     return 1;
   }
 
@@ -333,7 +330,7 @@ end:
     maria_extra(file,HA_EXTRA_NO_CACHE,0);
     if (maria_lock_database(file,F_UNLCK))
     {
-      MYSQL_FPRINTF(mysql_stderr,"%2d: Can't unlock table\n",id);
+      fprintf(stderr,"%2d: Can't unlock table\n",id);
       exit(0);
     }
   }
@@ -357,7 +354,7 @@ int test_write(MARIA_HA *file,int id,int
 	printf("%2d: write:  deadlock\n",id); fflush(stdout);
 	return 0;
       }
-      MYSQL_FPRINTF(mysql_stderr,"%2d: Can't lock table (%d)\n",id,my_errno);
+      fprintf(stderr,"%2d: Can't lock table (%d)\n",id,my_errno);
       maria_close(file);
       return 1;
     }
@@ -379,7 +376,7 @@ int test_write(MARIA_HA *file,int id,int
     {
       if (my_errno != HA_ERR_FOUND_DUPP_KEY)
       {
-	MYSQL_FPRINTF(mysql_stderr,"%2d: Got error %d (errno %d) from write\n",id,my_errno,
+	fprintf(stderr,"%2d: Got error %d (errno %d) from write\n",id,my_errno,
 		errno);
 	return 1;
       }
@@ -390,7 +387,7 @@ int test_write(MARIA_HA *file,int id,int
     maria_extra(file,HA_EXTRA_NO_CACHE,0);
     if (maria_lock_database(file,F_UNLCK))
     {
-      MYSQL_FPRINTF(mysql_stderr,"%2d: Can't unlock table\n",id);
+      fprintf(stderr,"%2d: Can't unlock table\n",id);
       exit(0);
     }
   }
@@ -417,7 +414,7 @@ int test_update(MARIA_HA *file,int id,in
 	printf("%2d: write:  deadlock\n",id); fflush(stdout);
 	return 0;
       }
-      MYSQL_FPRINTF(mysql_stderr,"%2d: Can't lock table (%d)\n",id,my_errno);
+      fprintf(stderr,"%2d: Can't lock table (%d)\n",id,my_errno);
       return 1;
     }
   }
@@ -436,7 +433,7 @@ int test_update(MARIA_HA *file,int id,in
     {
       if (my_errno != HA_ERR_KEY_NOT_FOUND)
       {
-	MYSQL_FPRINTF(mysql_stderr,"%2d: Got error %d from read in update\n",id,my_errno);
+	fprintf(stderr,"%2d: Got error %d from read in update\n",id,my_errno);
 	return 1;
       }
       else if (!maria_rnext(file,record.id,1))
@@ -445,7 +442,7 @@ int test_update(MARIA_HA *file,int id,in
       {
 	if (my_errno != HA_ERR_END_OF_FILE)
 	{
-	  MYSQL_FPRINTF(mysql_stderr,"%2d: Got error %d from rnext in update\n",
+	  fprintf(stderr,"%2d: Got error %d from rnext in update\n",
 		  id,my_errno);
 	  return 1;
 	}
@@ -455,7 +452,7 @@ int test_update(MARIA_HA *file,int id,in
 	{
 	  if (my_errno != HA_ERR_END_OF_FILE)
 	  {
-	    MYSQL_FPRINTF(mysql_stderr,"%2d: Got error %d from rnext in update\n",
+	    fprintf(stderr,"%2d: Got error %d from rnext in update\n",
 		    id,my_errno);
 	    return 1;
 	  }
@@ -474,7 +471,7 @@ int test_update(MARIA_HA *file,int id,in
 	  my_errno != HA_ERR_RECORD_DELETED &&
 	  my_errno != HA_ERR_FOUND_DUPP_KEY)
       {
-	MYSQL_FPRINTF(mysql_stderr,"%2d: Got error %d from update\n",id,my_errno);
+	fprintf(stderr,"%2d: Got error %d from update\n",id,my_errno);
 	return 1;
       }
     }
@@ -483,7 +480,7 @@ int test_update(MARIA_HA *file,int id,in
   {
     if (maria_lock_database(file,F_UNLCK))
     {
-      MYSQL_FPRINTF(mysql_stderr,"Can't unlock table,id, error%d\n",my_errno);
+      fprintf(stderr,"Can't unlock table,id, error%d\n",my_errno);
       return 1;
     }
   }
@@ -499,7 +496,7 @@ int test_update(MARIA_HA *file,int id,in
 
 int main()
 {
-	MYSQL_FPRINTF(mysql_stderr,"this test has not been ported to Netware or Windows\n");
+	fprintf(stderr,"this test has not been ported to Netware or Windows\n");
 	return 0;
 }
 

=== modified file 'storage/maria/ma_write.c'
--- a/storage/maria/ma_write.c	2009-04-17 18:44:53 +0000
+++ b/storage/maria/ma_write.c	2009-05-07 06:42:31 +0000
@@ -247,7 +247,7 @@ int maria_write(MARIA_HA *info, uchar *r
             old_proc_info= proc_info_hook(0,
                                           "waiting for a resource",
                                           __func__, __FILE__, __LINE__);
-            res= wt_thd_cond_timedwait(info->trn->wt, & blocker->state_lock.m_mutex);
+            res= wt_thd_cond_timedwait(info->trn->wt, & blocker->state_lock);
             proc_info_hook(0, old_proc_info, __func__, __FILE__, __LINE__);
 
             MYSQL_MUTEX_UNLOCK(& blocker->state_lock);

=== modified file 'storage/maria/maria_chk.c'
--- a/storage/maria/maria_chk.c	2009-04-17 18:44:53 +0000
+++ b/storage/maria/maria_chk.c	2009-05-07 06:42:31 +0000
@@ -29,6 +29,11 @@
 #endif
 SET_STACK_SIZE(9000)			/* Minimum stack size for program */
 
+#ifndef USE_RAID
+#define my_raid_create(A,B,C,D,E,F,G) my_create(A,B,C,G)
+#define my_raid_delete(A,B,C) my_delete(A,B)
+#endif
+
 static uint decode_bits;
 static char **default_argv;
 static const char *load_default_groups[]= { "maria_chk", 0 };
@@ -724,7 +729,7 @@ get_one_option(int optid,
       check_param.opt_sort_key= (uint) atoi(argument) - 1;
       if (check_param.opt_sort_key >= MARIA_MAX_KEY)
       {
-	MYSQL_FPRINTF(mysql_stderr,
+	fprintf(stderr,
 		"The value of the sort key is bigger than max key: %d.\n",
 		MARIA_MAX_KEY);
 	exit(1);
@@ -775,7 +780,7 @@ get_one_option(int optid,
     maria_stats_method_str= argument;
     if ((method=find_type(argument, &maria_stats_method_typelib, 2)) <= 0)
     {
-      MYSQL_FPRINTF(mysql_stderr, "Invalid value of stats_method: %s.\n", argument);
+      fprintf(stderr, "Invalid value of stats_method: %s.\n", argument);
       exit(1);
     }
     switch (method-1) {
@@ -847,7 +852,7 @@ static void get_options(register int *ar
   if ((check_param.testflag & T_UNPACK) &&
       (check_param.testflag & (T_QUICK | T_SORT_RECORDS)))
   {
-    (void)(MYSQL_FPRINTF(mysql_stderr,
+    (void)(fprintf(stderr,
 		 "%s: --unpack can't be used with --quick or --sort-records\n",
 		 my_progname_short));
     exit(1);
@@ -857,7 +862,7 @@ static void get_options(register int *ar
        (T_REP_ANY | T_STATISTICS | T_AUTO_INC |
 	T_SORT_RECORDS | T_SORT_INDEX | T_FORCE_CREATE)))
   {
-    (void)(MYSQL_FPRINTF(mysql_stderr,
+    (void)(fprintf(stderr,
 		 "%s: Can't use --readonly when repairing or sorting\n",
 		 my_progname_short));
     exit(1);
@@ -1038,7 +1043,7 @@ static int maria_chk(HA_CHECK *param, ch
       param->language= set_collation->number;
     if (maria_recreate_table(param, &info,filename))
     {
-      (void)(MYSQL_FPRINTF(mysql_stderr,
+      (void)(fprintf(stderr,
 		   "MARIA-table '%s' is not fixed because of errors\n",
 	      filename));
       return(-1);
@@ -1182,7 +1187,7 @@ static int maria_chk(HA_CHECK *param, ch
 #ifndef TO_BE_REMOVED
       if (param->out_flag & O_NEW_DATA)
       {			/* Change temp file to org file */
-        (void) MYSQL_CLOSE(info->dfile.file, MYF(MY_WME)); /* Close new file */
+        (void)(my_close(info->dfile.file, MYF(MY_WME))); /* Close new file */
         error|=maria_change_to_newfile(filename,MARIA_NAME_DEXT,DATA_TMP_EXT,
                                        MYF(0));
         if (_ma_open_datafile(info,info->s, NullS, -1))
@@ -1340,23 +1345,23 @@ end2:
   {
     if (param->testflag & (T_REP_ANY | T_SORT_RECORDS | T_SORT_INDEX))
     {
-      (void)(MYSQL_FPRINTF(mysql_stderr,
+      (void)(fprintf(stderr,
 		   "MARIA-table '%s' is not fixed because of errors\n",
 		   filename));
       if (param->testflag & T_REP_ANY)
-	(void)(MYSQL_FPRINTF(mysql_stderr,
+	(void)(fprintf(stderr,
 		     "Try fixing it by using the --safe-recover (-o), the --force (-f) option or by not using the --quick (-q) flag\n"));
     }
     else if (!(param->error_printed & 2) &&
 	     !(param->testflag & T_FORCE_CREATE))
-      (void)(MYSQL_FPRINTF(mysql_stderr,
+      (void)(fprintf(stderr,
       "MARIA-table '%s' is corrupted\nFix it using switch \"-r\" or \"-o\"\n",
 	      filename));
   }
   else if (param->warning_printed &&
 	   ! (param->testflag & (T_REP_ANY | T_SORT_RECORDS | T_SORT_INDEX |
 			  T_FORCE_CREATE)))
-    (void)(MYSQL_FPRINTF(mysql_stderr, "MARIA-table '%s' is usable but should be fixed\n",
+    (void)(fprintf(stderr, "MARIA-table '%s' is usable but should be fixed\n",
 		 filename));
   (void)(fflush(stderr));
   DBUG_RETURN(error);
@@ -1577,7 +1582,7 @@ static void descript(HA_CHECK *param, re
       for (keyseg=uniqueinfo->seg ; keyseg->type != HA_KEYTYPE_END ; keyseg++)
       {
 	if (new_row)
-	  MYSQL_FPUTS("             ",mysql_stdout);
+	  fputs("             ",stdout);
 	null_bit[0]=null_pos[0]=0;
 	if (keyseg->null_bit)
 	{
@@ -1737,8 +1742,7 @@ static int maria_sort_records(HA_CHECK *
   }
 
   fn_format(param->temp_filename,name,"", MARIA_NAME_DEXT,2+4+32);
-  new_file= MYSQL_CREATE(ma_key_file_datatmp,
-                      fn_format(param->temp_filename,
+  new_file= my_create(fn_format(param->temp_filename,
                                 param->temp_filename,"",
                                 DATA_TMP_EXT,
                                 MY_REPLACE_EXT | MY_UNPACK_FILENAME),
@@ -1761,7 +1765,7 @@ static int maria_sort_records(HA_CHECK *
   for (key=0 ; key < share->base.keys ; key++)
     share->keyinfo[key].flag|= HA_SORT_ALLOWS_SAME;
 
-  if (MYSQL_PREAD(share->kfile.file, temp_buff,
+  if (my_pread(share->kfile.file, temp_buff,
 	       (uint) keyinfo->block_length,
 	       share->state.key_root[sort_key],
 	       MYF(MY_NABP+MY_WME)))
@@ -1797,7 +1801,7 @@ static int maria_sort_records(HA_CHECK *
     goto err;
   }
 
-  (void) MYSQL_CLOSE(info->dfile.file, MYF(MY_WME));
+  (void)(my_close(info->dfile.file, MYF(MY_WME)));
   param->out_flag|=O_NEW_DATA;			/* Data in new file */
   info->dfile.file= new_file;                   /* Use new datafile */
   _ma_set_data_pagecache_callbacks(&info->dfile, info->s);
@@ -1813,7 +1817,7 @@ static int maria_sort_records(HA_CHECK *
 
   if (param->testflag & T_WRITE_LOOP)
   {
-    (void)(MYSQL_FPUTS("          \r",mysql_stdout)); (void)(fflush(stdout));
+    (void)(fputs("          \r",stdout)); (void)(fflush(stdout));
   }
   got_error=0;
 
@@ -1821,7 +1825,7 @@ err:
   if (got_error && new_file >= 0)
   {
     (void)(end_io_cache(&info->rec_cache));
-    (void) MYSQL_CLOSE(new_file, MYF(MY_WME));
+    (void) my_close(new_file,MYF(MY_WME));
     (void) my_delete(param->temp_filename, MYF(MY_WME));
   }
   if (temp_buff)
@@ -1879,7 +1883,7 @@ static int sort_record_index(MARIA_SORT_
     if (nod_flag)
     {
       next_page= _ma_kpos(nod_flag, keypos);
-      if (MYSQL_PREAD(share->kfile.file, (uchar*)temp_buff,
+      if (my_pread(share->kfile.file, (uchar*)temp_buff,
 		  (uint) keyinfo->block_length, next_page,
 		   MYF(MY_NABP+MY_WME)))
       {
@@ -1919,7 +1923,7 @@ static int sort_record_index(MARIA_SORT_
   }
   /* Clear end of block to get better compression if the table is backuped */
   bzero((uchar*) buff+used_length,keyinfo->block_length-used_length);
-  if (MYSQL_PWRITE(share->kfile.file, (uchar*)buff, (uint)keyinfo->block_length,
+  if (my_pwrite(share->kfile.file, (uchar*)buff, (uint)keyinfo->block_length,
 		page,param->myf_rw))
   {
     _ma_check_print_error(param,"%d when updating keyblock",my_errno);

=== modified file 'storage/maria/maria_def.h'
--- a/storage/maria/maria_def.h	2009-05-06 23:00:55 +0000
+++ b/storage/maria/maria_def.h	2009-05-07 06:42:31 +0000
@@ -1403,15 +1403,14 @@ extern PSI_cond_key ma_key_cond_MARIA_SO
 extern PSI_thread_key ma_key_thread_find_all_keys;
 extern PSI_thread_key ma_key_thread_checkpoint_background;
 extern PSI_file_key ma_key_file_control;
+/** Instrumented key for Maria index files (.MAI extension). */
 extern PSI_file_key ma_key_file_kfile;
 extern PSI_file_key ma_key_file_dfile;
 extern PSI_file_key ma_key_file_datatmp;
 extern PSI_file_key ma_key_file_indextmp;
-extern PSI_file_key ma_key_file_iext;
 extern PSI_file_key ma_key_file_translog;
 extern PSI_file_key ma_key_file_logdescrdir;
 extern PSI_file_key ma_key_file_recovery_trace;
-extern PSI_file_key ma_key_file_examine_log;
 extern PSI_file_key ma_key_file_backup_log;
 
 extern PSI_thread_key ma_key_thread_backup;

=== modified file 'storage/maria/maria_pack.c'
--- a/storage/maria/maria_pack.c	2009-04-17 18:44:53 +0000
+++ b/storage/maria/maria_pack.c	2009-05-07 06:42:31 +0000
@@ -411,7 +411,7 @@ static MARIA_HA *open_maria_file(char *n
 			  (opt_wait ? HA_OPEN_WAIT_IF_LOCKED :
 			   HA_OPEN_ABORT_IF_LOCKED))))
   {
-    (void)(MYSQL_FPRINTF(mysql_stderr, "%s gave error %d on open\n", name, my_errno));
+    (void)(fprintf(stderr, "%s gave error %d on open\n", name, my_errno));
     DBUG_RETURN(0);
   }
   share=isam_file->s;
@@ -419,7 +419,7 @@ static MARIA_HA *open_maria_file(char *n
   {
     if (!force_pack)
     {
-      (void)(MYSQL_FPRINTF(mysql_stderr, "%s is already compressed\n", name));
+      (void)(fprintf(stderr, "%s is already compressed\n", name));
       (void)(maria_close(isam_file));
       DBUG_RETURN(0);
     }
@@ -431,7 +431,7 @@ static MARIA_HA *open_maria_file(char *n
       (share->state.state.records <= 1 ||
        share->state.state.data_file_length < 1024))
   {
-    (void)(MYSQL_FPRINTF(mysql_stderr, "%s is too small to compress\n", name));
+    (void)(fprintf(stderr, "%s is too small to compress\n", name));
     (void)(maria_close(isam_file));
     DBUG_RETURN(0);
   }
@@ -478,7 +478,7 @@ static my_bool open_maria_files(PACK_MRG
   return 0;
 
  diff_file:
-  (void)(MYSQL_FPRINTF(mysql_stderr, "%s: Tables '%s' and '%s' are not identical\n",
+  (void)(fprintf(stderr, "%s: Tables '%s' and '%s' are not identical\n",
                my_progname, names[j], names[j+1]));
  error:
   while (i--)
@@ -520,7 +520,7 @@ static int compress(PACK_MRG_INFO *mrg,c
   if (init_pagecache(maria_pagecache, MARIA_MIN_PAGE_CACHE_SIZE, 0, 0,
                      maria_block_size, MY_WME) == 0)
   {
-    MYSQL_FPRINTF(mysql_stderr, "Can't initialize page cache\n");
+    fprintf(stderr, "Can't initialize page cache\n");
     goto err;
   }
 
@@ -531,14 +531,14 @@ static int compress(PACK_MRG_INFO *mrg,c
     uchar *buff;
     strmov(org_name,result_table);		/* Fix error messages */
     (void)(fn_format(new_name,result_table,"",MARIA_NAME_IEXT,2));
-    if ((join_maria_file=MYSQL_CREATE(ma_key_file_iext, new_name,0,tmpfile_createflag,MYF(MY_WME)))
+    if ((join_maria_file=my_create(new_name,0,tmpfile_createflag,MYF(MY_WME)))
 	< 0)
       goto err;
     length=(uint) share->base.keystart;
     if (!(buff= (uchar*) my_malloc(length,MYF(MY_WME))))
       goto err;
-    if (MYSQL_PREAD(share->kfile.file, buff, length, 0L, MYF(MY_WME | MY_NABP)) ||
-	MYSQL_WRITE(join_maria_file,buff,length,
+    if (my_pread(share->kfile.file, buff, length, 0L, MYF(MY_WME | MY_NABP)) ||
+	my_write(join_maria_file,buff,length,
 		 MYF(MY_WME | MY_NABP | MY_WAIT_IF_FULL)))
     {
       my_free(buff,MYF(0));
@@ -551,9 +551,8 @@ static int compress(PACK_MRG_INFO *mrg,c
     (void)(make_new_name(new_name,org_name));
   else
     (void)(fn_format(new_name,org_name,tmp_dir,DATA_TMP_EXT,1+2+4));
-  /* TODO: check which instrument to use here. */
   if (!test_only &&
-      (new_file=MYSQL_CREATE(ma_key_file_datatmp, new_name,0,tmpfile_createflag,MYF(MY_WME))) < 0)
+      (new_file=my_create(new_name,0,tmpfile_createflag,MYF(MY_WME))) < 0)
     goto err;
 
   /* Start calculating statistics */
@@ -629,7 +628,7 @@ static int compress(PACK_MRG_INFO *mrg,c
   */
   file_buffer.pos_in_file=HEAD_LENGTH;
   if (! test_only)
-    (void)(MYSQL_SEEK(new_file,file_buffer.pos_in_file,MY_SEEK_SET,MYF(0)));
+    (void)(my_seek(new_file,file_buffer.pos_in_file,MY_SEEK_SET,MYF(0)));
 
   /*
     Write field infos: field type, pack type, length bits, tree number.
@@ -662,7 +661,7 @@ static int compress(PACK_MRG_INFO *mrg,c
   {
     uchar buff[MEMMAP_EXTRA_MARGIN];		/* End marginal for memmap */
     bzero(buff,sizeof(buff));
-    error=MYSQL_WRITE(file_buffer.file,buff,sizeof(buff),
+    error=my_write(file_buffer.file,buff,sizeof(buff),
 		   MYF(MY_WME | MY_NABP | MY_WAIT_IF_FULL)) != 0;
   }
 
@@ -689,10 +688,10 @@ static int compress(PACK_MRG_INFO *mrg,c
   /* Close source and target file. */
   if (!test_only)
   {
-    error|= MYSQL_CLOSE(new_file, MYF(MY_WME));
+    error|=my_close(new_file,MYF(MY_WME));
     if (!result_table)
     {
-      error|= MYSQL_CLOSE(isam_file->dfile.file, MYF(MY_WME));
+      error|=my_close(isam_file->dfile.file, MYF(MY_WME));
       isam_file->dfile.file= -1;	/* Tell maria_close file is closed */
       isam_file->s->bitmap.file.file= -1;
     }
@@ -746,10 +745,10 @@ static int compress(PACK_MRG_INFO *mrg,c
   }
   error|=mrg_close(mrg);
   if (join_maria_file >= 0)
-    error|= MYSQL_CLOSE(join_maria_file, MYF(MY_WME));
+    error|=my_close(join_maria_file,MYF(MY_WME));
   if (error)
   {
-    (void)(MYSQL_FPRINTF(mysql_stderr, "Aborting: %s is not compressed\n", org_name));
+    (void)(fprintf(stderr, "Aborting: %s is not compressed\n", org_name));
     (void)(my_delete(new_name,MYF(MY_WME)));
     DBUG_RETURN(-1);
   }
@@ -768,11 +767,11 @@ static int compress(PACK_MRG_INFO *mrg,c
   end_pagecache(maria_pagecache, 1);
   free_counts_and_tree_and_queue(huff_trees,trees,huff_counts,fields);
   if (new_file >= 0)
-    (void) MYSQL_CLOSE(new_file, MYF(0));
+    (void)(my_close(new_file,MYF(0)));
   if (join_maria_file >= 0)
-    (void) MYSQL_CLOSE(join_maria_file, MYF(0));
+    (void)(my_close(join_maria_file,MYF(0)));
   mrg_close(mrg);
-  (void)(MYSQL_FPRINTF(mysql_stderr, "Aborted: %s is not compressed\n", org_name));
+  (void)(fprintf(stderr, "Aborted: %s is not compressed\n", org_name));
   DBUG_RETURN(-1);
 }
 
@@ -1086,7 +1085,7 @@ static int get_statistic(PACK_MRG_INFO *
     }
     else if (error != HA_ERR_RECORD_DELETED)
     {
-      (void)(MYSQL_FPRINTF(mysql_stderr, "Got error %d while reading rows\n", error));
+      (void)(fprintf(stderr, "Got error %d while reading rows\n", error));
       break;
     }
 
@@ -2034,8 +2033,8 @@ static int write_header(PACK_MRG_INFO *m
   buff[27]= (uchar) maria_get_pointer_length((ulonglong) filelength,2);
   if (test_only)
     return 0;
-  (void)(MYSQL_SEEK(file_buffer.file,0L,MY_SEEK_SET,MYF(0)));
-  return MYSQL_WRITE(file_buffer.file,(const uchar *) file_buffer.pos,HEAD_LENGTH,
+  (void)(my_seek(file_buffer.file,0L,MY_SEEK_SET,MYF(0)));
+  return my_write(file_buffer.file,(const uchar *) file_buffer.pos,HEAD_LENGTH,
 		  MYF(MY_WME | MY_NABP | MY_WAIT_IF_FULL)) != 0;
 }
 
@@ -2169,7 +2168,7 @@ static my_off_t write_huff_tree(HUFF_TRE
     */
     if (huff_tree->max_offset >= IS_OFFSET)
     {				/* This should be impossible */
-      (void)(MYSQL_FPRINTF(mysql_stderr, "Tree offset got too big: %d, aborted\n",
+      (void)(fprintf(stderr, "Tree offset got too big: %d, aborted\n",
                    huff_tree->max_offset));
       my_afree((uchar*) packed_tree);
       return 0;
@@ -2220,7 +2219,7 @@ static my_off_t write_huff_tree(HUFF_TRE
     length=(uint) (offset-packed_tree);
     if (length != huff_tree->elements*2-2)
     {
-      (void)(MYSQL_FPRINTF(mysql_stderr, "error: Huff-tree-length: %d != calc_length: %d\n",
+      (void)(fprintf(stderr, "error: Huff-tree-length: %d != calc_length: %d\n",
                    length, huff_tree->elements * 2 - 2));
       errors++;
       break;
@@ -2279,7 +2278,7 @@ static my_off_t write_huff_tree(HUFF_TRE
         if (! len)
         {
           (void)(fflush(stdout));
-          (void)(MYSQL_FPRINTF(mysql_stderr, "error: code 0x%s with %u bits not found\n",
+          (void)(fprintf(stderr, "error: code 0x%s with %u bits not found\n",
                        hexdigits(huff_tree->code[i]), huff_tree->code_len[i]));
           errors++;
           break;
@@ -2290,7 +2289,7 @@ static my_off_t write_huff_tree(HUFF_TRE
         if (bits > 8 * sizeof(code))
         {
           (void)(fflush(stdout));
-          (void)(MYSQL_FPRINTF(mysql_stderr, "error: Huffman code too long: %u/%u\n",
+          (void)(fprintf(stderr, "error: Huffman code too long: %u/%u\n",
                        bits, (uint) (8 * sizeof(code))));
           errors++;
           break;
@@ -2299,7 +2298,7 @@ static my_off_t write_huff_tree(HUFF_TRE
         if (idx >= length)
         {
           (void)(fflush(stdout));
-          (void)(MYSQL_FPRINTF(mysql_stderr, "error: illegal tree offset: %u/%u\n",
+          (void)(fprintf(stderr, "error: illegal tree offset: %u/%u\n",
                        idx, length));
           errors++;
           break;
@@ -2316,7 +2315,7 @@ static my_off_t write_huff_tree(HUFF_TRE
       if (packed_tree[idx] != i)
       {
         (void)(fflush(stdout));
-        (void)(MYSQL_FPRINTF(mysql_stderr, "error: decoded value 0x%04x  should be: 0x%04x\n",
+        (void)(fprintf(stderr, "error: decoded value 0x%04x  should be: 0x%04x\n",
                      packed_tree[idx], i));
         errors++;
         break;
@@ -2346,7 +2345,7 @@ static my_off_t write_huff_tree(HUFF_TRE
   my_afree((uchar*) packed_tree);
   if (errors)
   {
-    (void)(MYSQL_FPRINTF(mysql_stderr, "Error: Generated decode trees are corrupt. Stop.\n"));
+    (void)(fprintf(stderr, "Error: Generated decode trees are corrupt. Stop.\n"));
     return 0;
   }
   return elements;
@@ -2791,7 +2790,7 @@ static int compress_maria_file(PACK_MRG_
     error=0;
   else
   {
-    (void)(MYSQL_FPRINTF(mysql_stderr, "%s: Got error %d reading records\n",
+    (void)(fprintf(stderr, "%s: Got error %d reading records\n",
                  my_progname, error));
   }
   if (verbose >= 2)
@@ -2863,7 +2862,7 @@ static int flush_buffer(ulong neaded_len
   file_buffer.pos_in_file+=length;
   if (test_only)
     return 0;
-  if (error_on_write|| MYSQL_WRITE(file_buffer.file,
+  if (error_on_write|| my_write(file_buffer.file,
 				(const uchar*) file_buffer.buffer,
 				length,
 				MYF(MY_WME | MY_NABP | MY_WAIT_IF_FULL)))
@@ -3004,7 +3003,7 @@ static int save_state(MARIA_HA *isam_fil
   share->changed=1;			/* Force write of header */
   share->state.open_count=0;
   share->global_changed=0;
-  (void)(MYSQL_CHSIZE(share->kfile.file, share->base.keystart, 0, MYF(0)));
+  (void)(my_chsize(share->kfile.file, share->base.keystart, 0, MYF(0)));
   if (share->base.keys)
     isamchk_neaded=1;
   DBUG_RETURN(_ma_state_info_write_sub(share, share->kfile.file,

=== modified file 'storage/maria/maria_read_log.c'
--- a/storage/maria/maria_read_log.c	2009-04-17 18:44:53 +0000
+++ b/storage/maria/maria_read_log.c	2009-05-07 06:42:31 +0000
@@ -52,24 +52,24 @@ int main(int argc, char **argv)
 
   if (maria_init())
   {
-    MYSQL_FPRINTF(mysql_stderr, "Can't init Maria engine (%d)\n", errno);
+    fprintf(stderr, "Can't init Maria engine (%d)\n", errno);
     goto err;
   }
   /* we don't want to create a control file, it MUST exist */
   if (ma_control_file_open(FALSE, TRUE))
   {
-    MYSQL_FPRINTF(mysql_stderr, "Can't open control file (%d)\n", errno);
+    fprintf(stderr, "Can't open control file (%d)\n", errno);
     goto err;
   }
   if (last_logno == FILENO_IMPOSSIBLE)
   {
-    MYSQL_FPRINTF(mysql_stderr, "Can't find any log\n");
+    fprintf(stderr, "Can't find any log\n");
     goto err;
   }
   if (init_pagecache(maria_pagecache, opt_page_buffer_size, 0, 0,
                      TRANSLOG_PAGE_SIZE, MY_WME) == 0)
   {
-    MYSQL_FPRINTF(mysql_stderr, "Got error in init_pagecache() (errno: %d)\n", errno);
+    fprintf(stderr, "Got error in init_pagecache() (errno: %d)\n", errno);
     goto err;
   }
   /*
@@ -85,7 +85,7 @@ int main(int argc, char **argv)
                     0, 0, maria_log_pagecache, TRANSLOG_DEFAULT_FLAGS,
                     opt_display_only))
   {
-    MYSQL_FPRINTF(mysql_stderr, "Can't init loghandler (%d)\n", errno);
+    fprintf(stderr, "Can't init loghandler (%d)\n", errno);
     goto err;
   }
 
@@ -96,39 +96,39 @@ int main(int argc, char **argv)
   lsn= translog_first_lsn_in_log();
   if (lsn == LSN_ERROR)
   {
-    MYSQL_FPRINTF(mysql_stderr, "Opening transaction log failed\n");
+    fprintf(stderr, "Opening transaction log failed\n");
     goto end;
   }
   if (lsn == LSN_IMPOSSIBLE)
   {
-     MYSQL_FPRINTF(mysql_stdout, "The transaction log is empty\n");
+     fprintf(stdout, "The transaction log is empty\n");
   }
-  MYSQL_FPRINTF(mysql_stdout, "The transaction log starts from lsn (%lu,0x%lx)\n",
+  fprintf(stdout, "The transaction log starts from lsn (%lu,0x%lx)\n",
           LSN_IN_PARTS(lsn));
 
   if (opt_start_from_lsn)
   {
     if (opt_start_from_lsn < (ulonglong) lsn)
     {
-      MYSQL_FPRINTF(mysql_stderr, "start_from_lsn is too small. Aborting\n");
+      fprintf(stderr, "start_from_lsn is too small. Aborting\n");
       maria_end();
       goto err;
     }
     lsn= (LSN) opt_start_from_lsn;
-    MYSQL_FPRINTF(mysql_stdout, "Starting reading log from lsn (%lu,0x%lx)\n",
+    fprintf(stdout, "Starting reading log from lsn (%lu,0x%lx)\n",
             LSN_IN_PARTS(lsn));
   }
 
-  MYSQL_FPRINTF(mysql_stdout, "TRACE of the last maria_read_log\n");
+  fprintf(stdout, "TRACE of the last maria_read_log\n");
   if (maria_apply_log(lsn, opt_apply ?  MARIA_LOG_APPLY :
                       (opt_check ? MARIA_LOG_CHECK :
-                       MARIA_LOG_DISPLAY_HEADER), opt_silent ? NULL : mysql_stdout,
+                       MARIA_LOG_DISPLAY_HEADER), opt_silent ? NULL : stdout,
                       opt_apply_undo, FALSE, FALSE, &warnings_count))
     goto err;
   if (warnings_count == 0)
-    MYSQL_FPRINTF(mysql_stdout, "%s: SUCCESS\n", my_progname_short);
+    fprintf(stdout, "%s: SUCCESS\n", my_progname_short);
   else
-    MYSQL_FPRINTF(mysql_stdout, "%s: DOUBTFUL (%u warnings, check previous output)\n",
+    fprintf(stdout, "%s: DOUBTFUL (%u warnings, check previous output)\n",
             my_progname_short, warnings_count);
 
 end:
@@ -141,7 +141,7 @@ end:
 
 err:
   /* don't touch anything more, in case we hit a bug */
-  MYSQL_FPRINTF(mysql_stderr, "%s: FAILED\n", my_progname_short);
+  fprintf(stderr, "%s: FAILED\n", my_progname_short);
   free_tmpdir(&maria_chk_tmpdir);
   free_defaults(default_argv);
   exit(1);

=== modified file 'storage/perfschema/pfs_instr.cc'
--- a/storage/perfschema/pfs_instr.cc	2009-05-02 07:15:38 +0000
+++ b/storage/perfschema/pfs_instr.cc	2009-05-07 06:42:31 +0000
@@ -482,7 +482,6 @@ PFS_thread* create_thread(PFS_thread_inf
           pfs->m_thread_id= 0;
           pfs->m_event_id= 1;
           pfs->m_enabled= true;
-          pfs->m_identity= identity;
           pfs->m_info= info;
           pfs->m_wait_locker_count= 0;
           pfs->m_waits_history_full= false;

=== modified file 'storage/perfschema/pfs_instr.h'
--- a/storage/perfschema/pfs_instr.h	2009-05-02 07:15:38 +0000
+++ b/storage/perfschema/pfs_instr.h	2009-05-07 06:42:31 +0000
@@ -162,8 +162,6 @@ struct PFS_thread
   ulonglong m_event_id;
   /** Thread instrumentation flag. */
   bool m_enabled;
-  /** Thread identity, typically a work structure associated with this thread. */
-  const void *m_identity;
   /** Internal thread identifier, unique. */
   ulong m_thread_internal_id;
   /** External (SHOW PROCESSLIST) thread identifier, not unique. */

Thread
bzr push into mysql-6.0-perfschema branch (marc.alff:3134 to 3135) Marc Alff7 May