diff options
Diffstat (limited to 'storage/innobase/include/hash0hash.ic')
-rw-r--r-- | storage/innobase/include/hash0hash.ic | 96 |
1 files changed, 1 insertions, 95 deletions
diff --git a/storage/innobase/include/hash0hash.ic b/storage/innobase/include/hash0hash.ic index d6dd104572f..cc717ec8559 100644 --- a/storage/innobase/include/hash0hash.ic +++ b/storage/innobase/include/hash0hash.ic @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 1997, 2015, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2020, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -23,8 +24,6 @@ The simple hash table utility Created 5/20/1997 Heikki Tuuri *******************************************************/ -#include "ut0rnd.h" - /************************************************************//** Gets the nth cell in a hash table. @return pointer to cell */ @@ -182,96 +181,3 @@ hash_get_mutex( return(hash_get_nth_mutex(table, i)); } - -/************************************************************//** -Gets the nth rw_lock in a hash table. -@return rw_lock */ -UNIV_INLINE -rw_lock_t* -hash_get_nth_lock( -/*==============*/ - hash_table_t* table, /*!< in: hash table */ - ulint i) /*!< in: index of the rw_lock */ -{ - ut_ad(table); - ut_ad(table->magic_n == HASH_TABLE_MAGIC_N); - ut_ad(table->type == HASH_TABLE_SYNC_RW_LOCK); - ut_ad(i < table->n_sync_obj); - - return(table->sync_obj.rw_locks + i); -} - -/************************************************************//** -Gets the rw_lock for a fold value in a hash table. -@return rw_lock */ -UNIV_INLINE -rw_lock_t* -hash_get_lock( -/*==========*/ - hash_table_t* table, /*!< in: hash table */ - ulint fold) /*!< in: fold */ -{ - ulint i; - - ut_ad(table); - ut_ad(table->type == HASH_TABLE_SYNC_RW_LOCK); - ut_ad(table->magic_n == HASH_TABLE_MAGIC_N); - - i = hash_get_sync_obj_index(table, fold); - - return(hash_get_nth_lock(table, i)); -} - -/** If not appropriate rw_lock for a fold value in a hash table, -relock S-lock the another rw_lock until appropriate for a fold value. -@param[in] hash_lock latched rw_lock to be confirmed -@param[in] table hash table -@param[in] fold fold value -@return latched rw_lock */ -UNIV_INLINE -rw_lock_t* -hash_lock_s_confirm( - rw_lock_t* hash_lock, - hash_table_t* table, - ulint fold) -{ - ut_ad(rw_lock_own(hash_lock, RW_LOCK_S)); - - rw_lock_t* hash_lock_tmp = hash_get_lock(table, fold); - - while (hash_lock_tmp != hash_lock) { - rw_lock_s_unlock(hash_lock); - hash_lock = hash_lock_tmp; - rw_lock_s_lock(hash_lock); - hash_lock_tmp = hash_get_lock(table, fold); - } - - return(hash_lock); -} - -/** If not appropriate rw_lock for a fold value in a hash table, -relock X-lock the another rw_lock until appropriate for a fold value. -@param[in] hash_lock latched rw_lock to be confirmed -@param[in] table hash table -@param[in] fold fold value -@return latched rw_lock */ -UNIV_INLINE -rw_lock_t* -hash_lock_x_confirm( - rw_lock_t* hash_lock, - hash_table_t* table, - ulint fold) -{ - ut_ad(rw_lock_own(hash_lock, RW_LOCK_X)); - - rw_lock_t* hash_lock_tmp = hash_get_lock(table, fold); - - while (hash_lock_tmp != hash_lock) { - rw_lock_x_unlock(hash_lock); - hash_lock = hash_lock_tmp; - rw_lock_x_lock(hash_lock); - hash_lock_tmp = hash_get_lock(table, fold); - } - - return(hash_lock); -} |