From b3843ebca40d06754eb3179a9c9b3b2c2f336080 Mon Sep 17 00:00:00 2001 From: dimitr Date: Wed, 19 Aug 2009 08:07:18 +0000 Subject: [PATCH] Cleanup. New nbackup internals don't need this code anymore. --- src/jrd/lck.cpp | 28 ------------------ src/jrd/lck_proto.h | 1 - src/lock/lock.cpp | 68 ------------------------------------------- src/lock/lock_proto.h | 1 - 4 files changed, 98 deletions(-) diff --git a/src/jrd/lck.cpp b/src/jrd/lck.cpp index 2516f2141d..aa831e02a6 100644 --- a/src/jrd/lck.cpp +++ b/src/jrd/lck.cpp @@ -466,34 +466,6 @@ SLONG LCK_get_owner_handle_by_type(thread_db* tdbb, lck_owner_t lck_owner_type) } -bool LCK_set_owner_handle(Jrd::thread_db* tdbb, Jrd::Lock* lock, SLONG owner_handle) -{ -/************************************** - * - * L C K _ s e t _ o w n e r _ h a n d l e - * - ************************************** - * - * Functional description - * Change lock owner, remove request from old owner que and - * grant it onto new one. - * - **************************************/ - SET_TDBB(tdbb); - Database* const dbb = tdbb->getDatabase(); - - fb_assert(LCK_CHECK_LOCK(lock)); - fb_assert(lock->lck_physical > LCK_none); - - const bool result = dbb->dbb_lock_mgr->setOwnerHandle(lock->lck_id, owner_handle); - - if (result) - lock->lck_owner_handle = owner_handle; - - return result; -} - - void LCK_init(thread_db* tdbb, enum lck_owner_t owner_type) { /************************************** diff --git a/src/jrd/lck_proto.h b/src/jrd/lck_proto.h index 2693cf5cc7..061437efe0 100644 --- a/src/jrd/lck_proto.h +++ b/src/jrd/lck_proto.h @@ -38,7 +38,6 @@ void LCK_downgrade(Jrd::thread_db*, Jrd::Lock*); void LCK_fini(Jrd::thread_db*, Jrd::lck_owner_t); SLONG LCK_get_owner_handle(Jrd::thread_db*, Jrd::lck_t); SLONG LCK_get_owner_handle_by_type(Jrd::thread_db*, Jrd::lck_owner_t); -bool LCK_set_owner_handle(Jrd::thread_db*, Jrd::Lock*, SLONG); void LCK_init(Jrd::thread_db*, Jrd::lck_owner_t); bool LCK_lock(Jrd::thread_db*, Jrd::Lock*, USHORT, SSHORT); bool LCK_lock_opt(Jrd::thread_db*, Jrd::Lock*, USHORT, SSHORT); diff --git a/src/lock/lock.cpp b/src/lock/lock.cpp index 9f53dda5ae..03b7d08c40 100644 --- a/src/lock/lock.cpp +++ b/src/lock/lock.cpp @@ -382,74 +382,6 @@ void LockManager::shutdownOwner(thread_db* tdbb, SRQ_PTR* owner_offset) } -bool LockManager::setOwnerHandle(SRQ_PTR request_offset, SRQ_PTR new_owner_offset) -{ -/************************************** - * - * s e t O w n e r H a n d l e - * - ************************************** - * - * Functional description - * Set new owner handle for granted request. - * - **************************************/ - LOCK_TRACE(("LOCK_set_owner_handle (%ld)\n", request_offset)); - - Firebird::MutexLockGuard guard(m_localMutex); - - lrq* request = get_request(request_offset); - - // We need not to change owner - if (request->lrq_owner == new_owner_offset) - return true; - - acquire_shmem(new_owner_offset); - - request = (lrq*) SRQ_ABS_PTR(request_offset); // Re-init after a potential remap -#ifdef DEV_BUILD - own* const old_owner = (own*) SRQ_ABS_PTR(request->lrq_owner); - fb_assert(old_owner->own_pending_request != request_offset); -#endif - own* const new_owner = (own*) SRQ_ABS_PTR(new_owner_offset); - fb_assert(new_owner->own_pending_request != request_offset); -#ifdef DEV_BUILD - const prc* const old_process = (prc*) SRQ_ABS_PTR(old_owner->own_process); - const prc* const new_process = (prc*) SRQ_ABS_PTR(new_owner->own_process); - fb_assert(old_process->prc_process_id == new_process->prc_process_id); -#endif - lbl *lck = (lbl*) SRQ_ABS_PTR(request->lrq_lock); - - // Make sure that change of lock owner is possible - SRQ lock_srq; - SRQ_LOOP(lck->lbl_requests, lock_srq) - { - lrq* granted_request = (lrq*) ((UCHAR*) lock_srq - OFFSET(lrq*, lrq_own_requests)); - // One owner must have the only granted request on the same lock resource - if (granted_request->lrq_owner == new_owner_offset) - { - LOCK_TRACE(("The owner already has a granted request")); - release_shmem(request->lrq_owner); - return false; - } - } - - remove_que(&request->lrq_own_requests); - request->lrq_owner = new_owner_offset; - insert_tail(&new_owner->own_requests, &request->lrq_own_requests); - - if (request->lrq_flags & LRQ_blocking) - { - remove_que(&request->lrq_own_blocks); - insert_tail(&new_owner->own_blocks, &request->lrq_own_blocks); - } - - release_shmem(new_owner_offset); - - return true; -} - - SRQ_PTR LockManager::enqueue(thread_db* tdbb, SRQ_PTR prior_request, SRQ_PTR parent_request, diff --git a/src/lock/lock_proto.h b/src/lock/lock_proto.h index ecc8a57221..b9d308ae8f 100644 --- a/src/lock/lock_proto.h +++ b/src/lock/lock_proto.h @@ -55,7 +55,6 @@ public: bool initializeOwner(thread_db*, LOCK_OWNER_T, UCHAR, SRQ_PTR*); void shutdownOwner(thread_db*, SRQ_PTR*); - bool setOwnerHandle(SRQ_PTR, SRQ_PTR); SLONG enqueue(thread_db*, SRQ_PTR, SRQ_PTR, const USHORT, const UCHAR*, const USHORT, UCHAR, lock_ast_t, void*, SLONG, SSHORT, SRQ_PTR);