diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2018-03-14 10:00:19 +0200 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2018-03-16 15:50:05 +0200 |
commit | 27c54b77c1aad3a8a2d4df1dfd9194e128374e2d (patch) | |
tree | 1915d460cd1c4096fd08475082b233ea6242f371 /storage/innobase/lock/lock0lock.cc | |
parent | d2a15092c194f47f54f8f79098747f6f1878fde4 (diff) | |
download | mariadb-git-27c54b77c1aad3a8a2d4df1dfd9194e128374e2d.tar.gz |
Make some locking primitives inline
lock_rec_trx_wait(): Merge to the only caller lock_prdt_rec_move().
lock_rec_reset_nth_bit(), lock_set_lock_and_trx_wait(),
lock_reset_lock_and_trx_wait(): Define in lock0priv.h.
Diffstat (limited to 'storage/innobase/lock/lock0lock.cc')
-rw-r--r-- | storage/innobase/lock/lock0lock.cc | 79 |
1 files changed, 0 insertions, 79 deletions
diff --git a/storage/innobase/lock/lock0lock.cc b/storage/innobase/lock/lock0lock.cc index ae04ed505f7..240510ffa59 100644 --- a/storage/innobase/lock/lock0lock.cc +++ b/storage/innobase/lock/lock0lock.cc @@ -613,42 +613,6 @@ lock_get_size(void) return((ulint) sizeof(lock_t)); } -/*********************************************************************//** -Sets the wait flag of a lock and the back pointer in trx to lock. */ -UNIV_INLINE -void -lock_set_lock_and_trx_wait( -/*=======================*/ - lock_t* lock, /*!< in: lock */ - trx_t* trx) /*!< in/out: trx */ -{ - ut_ad(lock); - ut_ad(lock->trx == trx); - ut_ad(trx->lock.wait_lock == NULL); - ut_ad(lock_mutex_own()); - ut_ad(trx_mutex_own(trx)); - - trx->lock.wait_lock = lock; - lock->type_mode |= LOCK_WAIT; -} - -/**********************************************************************//** -The back pointer to a waiting lock request in the transaction is set to NULL -and the wait bit in lock type_mode is reset. */ -UNIV_INLINE -void -lock_reset_lock_and_trx_wait( -/*=========================*/ - lock_t* lock) /*!< in/out: record lock */ -{ - ut_ad(lock_get_wait(lock)); - ut_ad(lock_mutex_own()); - ut_ad(lock->trx->lock.wait_lock == NULL - || lock->trx->lock.wait_lock == lock); - lock->trx->lock.wait_lock = NULL; - lock->type_mode &= ~LOCK_WAIT; -} - static inline void lock_grant_have_trx_mutex(lock_t* lock) { lock_reset_lock_and_trx_wait(lock); @@ -942,49 +906,6 @@ lock_rec_find_set_bit( return(ULINT_UNDEFINED); } -/** Reset the nth bit of a record lock. -@param[in,out] lock record lock -@param[in] i index of the bit that will be reset -@return previous value of the bit */ -UNIV_INLINE -byte -lock_rec_reset_nth_bit( - lock_t* lock, - ulint i) -{ - ut_ad(lock_get_type_low(lock) == LOCK_REC); - ut_ad(i < lock->un_member.rec_lock.n_bits); - - byte* b = reinterpret_cast<byte*>(&lock[1]) + (i >> 3); - byte mask = static_cast<byte>(1U << (i & 7)); - byte bit = *b & mask; - *b &= ~mask; - - if (bit != 0) { - ut_ad(lock->trx->lock.n_rec_locks > 0); - --lock->trx->lock.n_rec_locks; - } - - return(bit); -} - -/** Reset the nth bit of a record lock. -@param[in,out] lock record lock -@param[in] i index of the bit that will be reset -@param[in] type whether the lock is in wait mode */ -void -lock_rec_trx_wait( - lock_t* lock, - ulint i, - ulint type) -{ - lock_rec_reset_nth_bit(lock, i); - - if (type & LOCK_WAIT) { - lock_reset_lock_and_trx_wait(lock); - } -} - /*********************************************************************//** Determines if there are explicit record locks on a page. @return an explicit record lock on the page, or NULL if there are none */ |