summaryrefslogtreecommitdiff
path: root/store
diff options
context:
space:
mode:
authorMatthias Huetsch <matthias.huetsch@sun.com>2009-10-29 16:00:34 +0100
committerMatthias Huetsch <matthias.huetsch@sun.com>2009-10-29 16:00:34 +0100
commit38370b7cc6371d03cac8132245c1bee5031f758d (patch)
tree8caaa8cf3b5208346e56db4097661c8fa3a4a75a /store
parente656ee2d01ddb88a8d6898f2ec229f1fc220ab9c (diff)
#i71568# Remove unused range locking code.
Diffstat (limited to 'store')
-rw-r--r--store/inc/store/store.hxx7
-rw-r--r--store/source/lockbyte.cxx34
-rw-r--r--store/source/lockbyte.hxx30
-rw-r--r--store/source/storbios.cxx130
-rw-r--r--store/source/storbios.hxx10
-rw-r--r--store/source/stordata.cxx91
-rw-r--r--store/source/stortree.cxx115
-rw-r--r--store/workben/t_base.cxx11
8 files changed, 33 insertions, 395 deletions
diff --git a/store/inc/store/store.hxx b/store/inc/store/store.hxx
index b6301f41f8b3..44540a44cb32 100644
--- a/store/inc/store/store.hxx
+++ b/store/inc/store/store.hxx
@@ -6,9 +6,6 @@
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: store.hxx,v $
- * $Revision: 1.5 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
@@ -29,7 +26,7 @@
************************************************************************/
#ifndef _STORE_STORE_HXX_
-#define _STORE_STORE_HXX_ "$Revision: 1.5 $"
+#define _STORE_STORE_HXX_
#include "sal/types.h"
#include "rtl/ustring.hxx"
@@ -242,7 +239,7 @@ public:
(void) store_acquireHandle (rhs.m_hImpl);
if (m_hImpl)
(void) store_releaseHandle (m_hImpl);
- m_hImpl = rOther.m_hImpl;
+ m_hImpl = rhs.m_hImpl;
return *this;
}
diff --git a/store/source/lockbyte.cxx b/store/source/lockbyte.cxx
index a03628bfb740..551c7c737127 100644
--- a/store/source/lockbyte.cxx
+++ b/store/source/lockbyte.cxx
@@ -156,40 +156,6 @@ storeError ILockBytes::flush()
return flush_Impl();
}
-storeError ILockBytes::lockRange (sal_uInt32 nOffset, sal_uInt32 nBytes)
-{
- OSL_PRECOND(!(nOffset == STORE_PAGE_NULL), "store::ILockBytes::lockRange(): invalid Offset");
- if (nOffset == STORE_PAGE_NULL)
- return store_E_CantSeek;
-
- sal_uInt64 size = nOffset + nBytes;
- if (size > SAL_MAX_UINT32)
- return store_E_CantSeek;
-
-#ifdef STORE_FEATURE_LOCKING
- return lockRange_Impl (nOffset, nBytes);
-#else
- return store_E_None; // E_Unsupported
-#endif /* STORE_FEATURE_LOCKING */
-}
-
-storeError ILockBytes::unlockRange (sal_uInt32 nOffset, sal_uInt32 nBytes)
-{
- OSL_PRECOND(!(nOffset == STORE_PAGE_NULL), "store::ILockBytes::unlockRange(): invalid Offset");
- if (nOffset == STORE_PAGE_NULL)
- return store_E_CantSeek;
-
- sal_uInt64 size = nOffset + nBytes;
- if (size > SAL_MAX_UINT32)
- return store_E_CantSeek;
-
-#ifdef STORE_FEATURE_LOCKING
- return unlockRange_Impl (nOffset, nBytes);
-#else
- return store_E_None; // E_Unsupported
-#endif /* STORE_FEATURE_LOCKING */
-}
-
/*========================================================================
*
* FileLockBytes implementation.
diff --git a/store/source/lockbyte.hxx b/store/source/lockbyte.hxx
index 20a8b0b77073..95f73f289b67 100644
--- a/store/source/lockbyte.hxx
+++ b/store/source/lockbyte.hxx
@@ -128,26 +128,6 @@ public:
*/
storeError flush();
- /**
- @param nOffset [in]
- @param nBytes [in]
- @return store_E_None upon success
- store_E_LockingViolation
- */
- storeError lockRange (
- sal_uInt32 nOffset,
- sal_uInt32 nBytes);
-
- /**
- @param nOffset [in]
- @param nBytes [in]
- @return store_E_None upon success
- store_E_LockingViolation
- */
- storeError unlockRange (
- sal_uInt32 nOffset,
- sal_uInt32 nBytes);
-
private:
/** Implementation (abstract).
*/
@@ -180,16 +160,6 @@ private:
sal_uInt32 nSize) = 0;
virtual storeError flush_Impl() = 0;
-
-#ifdef STORE_FEATURE_LOCKING
- virtual storeError lockRange_Impl (
- sal_uInt32 nOffset,
- sal_uInt32 nBytes) = 0;
-
- virtual storeError unlockRange_Impl (
- sal_uInt32 nOffset,
- sal_uInt32 nBytes) = 0;
-#endif /* STORE_FEATURE_LOCKING */
};
/*========================================================================
diff --git a/store/source/storbios.cxx b/store/source/storbios.cxx
index d1f15dcda247..62852fa3e0cd 100644
--- a/store/source/storbios.cxx
+++ b/store/source/storbios.cxx
@@ -697,22 +697,8 @@ storeError OStorePageBIOS::verify (SuperPage *&rpSuper)
*/
storeError OStorePageBIOS::repair (SuperPage *&rpSuper)
{
- // Acquire Lock.
- storeError eErrCode = acquireLock (0, SuperPage::theSize);
- if (eErrCode != store_E_None)
- return eErrCode;
-
// Verify SuperBlock page (with repair).
- eErrCode = verify (rpSuper);
- if (eErrCode != store_E_None)
- {
- // Failure.
- releaseLock (0, SuperPage::theSize);
- return eErrCode;
- }
-
- // ReleaseLock.
- return releaseLock (0, SuperPage::theSize);
+ return verify (rpSuper);
}
/*
@@ -729,29 +715,16 @@ storeError OStorePageBIOS::create (sal_uInt16 nPageSize)
return store_E_InvalidParameter;
nPageSize = ((nPageSize + STORE_MINIMUM_PAGESIZE - 1) & ~(STORE_MINIMUM_PAGESIZE - 1));
- // Acquire Lock.
- storeError eErrCode = acquireLock (0, nPageSize);
- if (eErrCode != store_E_None)
- return eErrCode;
-
// Allocate SuperBlock page.
delete m_pSuper, m_pSuper = 0;
if ((m_pSuper = new(nPageSize) SuperPage(nPageSize)) == 0)
- {
- // Cleanup and fail.
- releaseLock (0, nPageSize);
return store_E_OutOfMemory;
- }
m_pSuper->guard();
// Create initial page (w/ SuperBlock).
- eErrCode = m_xLockBytes->writeAt (0, m_pSuper, nPageSize);
+ storeError eErrCode = m_xLockBytes->writeAt (0, m_pSuper, nPageSize);
if (eErrCode != store_E_None)
- {
- // Cleanup and fail.
- releaseLock (0, nPageSize);
return eErrCode;
- }
#ifdef STORE_FEATURE_COMMIT
// Commit.
@@ -763,9 +736,7 @@ storeError OStorePageBIOS::create (sal_uInt16 nPageSize)
// Adjust modified state.
m_bModified = (eErrCode != store_E_None);
-
- // Release Lock and finish.
- return releaseLock (0, nPageSize);
+ return eErrCode;
}
/*
@@ -860,36 +831,6 @@ storeError OStorePageBIOS::initialize (
}
/*
- * acquireLock.
- * Low Level: Precond: initialized, exclusive access.
- */
-storeError OStorePageBIOS::acquireLock (
- sal_uInt32 nAddr, sal_uInt32 nSize)
-{
- // Check precond.
- if (!m_xLockBytes.is())
- return store_E_InvalidAccess;
-
- // Acquire Lock.
- return m_xLockBytes->lockRange (nAddr, nSize);
-}
-
-/*
- * releaseLock.
- * Low Level: Precond: initialized, exclusive access.
- */
-storeError OStorePageBIOS::releaseLock (
- sal_uInt32 nAddr, sal_uInt32 nSize)
-{
- // Check precond.
- if (!m_xLockBytes.is())
- return store_E_InvalidAccess;
-
- // Release Lock.
- return m_xLockBytes->unlockRange (nAddr, nSize);
-}
-
-/*
* read.
* Low Level: Precond: initialized, exclusive access.
*/
@@ -1034,18 +975,10 @@ storeError OStorePageBIOS::allocate (
if (!m_bWriteable)
return store_E_AccessViolation;
- // Acquire SuperBlock Lock.
- storeError eErrCode = acquireLock (0, SuperPage::theSize);
- if (eErrCode != store_E_None)
- return eErrCode;
-
// Load SuperBlock and require good health.
- eErrCode = verify (m_pSuper);
+ storeError eErrCode = verify (m_pSuper);
if (eErrCode != store_E_None)
- {
- releaseLock (0, SuperPage::theSize);
return eErrCode;
- }
// Check allocation.
if (eAlloc != ALLOCATE_EOF)
@@ -1061,10 +994,7 @@ storeError OStorePageBIOS::allocate (
// Load PageHead.
eErrCode = peek (aPageHead);
if (eErrCode != store_E_None)
- {
- releaseLock (0, SuperPage::theSize);
return eErrCode;
- }
// Verify FreeList head.
OSL_PRECOND(
@@ -1079,9 +1009,6 @@ storeError OStorePageBIOS::allocate (
// Save SuperBlock page.
eErrCode = m_pSuper->save (*this);
- // Release SuperBlock Lock.
- releaseLock (0, SuperPage::theSize);
-
// Recovery: Allocate from EOF.
if (eErrCode == store_E_None)
return allocate (rPage, ALLOCATE_EOF);
@@ -1096,12 +1023,9 @@ storeError OStorePageBIOS::allocate (
// Save page at PageHead location.
eErrCode = saveObjectAt_Impl (rPage, aPageHead.location());
if (eErrCode != store_E_None)
- {
- releaseLock (0, SuperPage::theSize);
return eErrCode;
- }
- // Save SuperBlock page.
+ // Save SuperBlock page and finish.
m_pSuper->m_aSuperTwo.unusedRemove (aListHead);
m_pSuper->m_aSuperOne = m_pSuper->m_aSuperTwo;
@@ -1109,9 +1033,7 @@ storeError OStorePageBIOS::allocate (
OSL_POSTCOND(
eErrCode == store_E_None,
"OStorePageBIOS::allocate(): SuperBlock save failed");
-
- // Release SuperBlock Lock and finish.
- return releaseLock (0, SuperPage::theSize);
+ return eErrCode;
}
}
@@ -1119,10 +1041,7 @@ storeError OStorePageBIOS::allocate (
sal_uInt32 nPhysLen = STORE_PAGE_NULL;
eErrCode = m_xLockBytes->getSize (nPhysLen);
if (eErrCode != store_E_None)
- {
- releaseLock (0, SuperPage::theSize);
return eErrCode;
- }
// Obtain logical EOF.
OStorePageDescriptor aDescr (m_pSuper->m_aSuperTwo.m_aDescr);
@@ -1141,10 +1060,7 @@ storeError OStorePageBIOS::allocate (
// Mark SuperBlock modified.
eErrCode = m_pSuper->modified (*this);
if (eErrCode != store_E_None)
- {
- releaseLock (0, SuperPage::theSize);
return eErrCode;
- }
}
// Resize.
@@ -1153,21 +1069,15 @@ storeError OStorePageBIOS::allocate (
eErrCode = m_xLockBytes->setSize (nPhysLen);
if (eErrCode != store_E_None)
- {
- releaseLock (0, SuperPage::theSize);
return eErrCode;
- }
}
// Save page at logical EOF.
eErrCode = saveObjectAt_Impl (rPage, nLogLen);
if (eErrCode != store_E_None)
- {
- releaseLock (0, SuperPage::theSize);
return eErrCode;
- }
- // Save SuperBlock page.
+ // Save SuperBlock page and finish.
nLogLen += store::ntohs(aDescr.m_nSize);
aDescr.m_nAddr = store::htonl(nLogLen);
@@ -1178,9 +1088,7 @@ storeError OStorePageBIOS::allocate (
OSL_POSTCOND(
eErrCode == store_E_None,
"OStorePageBIOS::allocate(): SuperBlock save failed");
-
- // Release SuperBlock Lock and finish.
- return releaseLock (0, SuperPage::theSize);
+ return eErrCode;
}
/*
@@ -1198,18 +1106,10 @@ storeError OStorePageBIOS::free (OStorePageData & /* rData */, sal_uInt32 nAddr)
if (!m_bWriteable)
return store_E_AccessViolation;
- // Acquire SuperBlock Lock.
- storeError eErrCode = acquireLock (0, SuperPage::theSize);
- if (eErrCode != store_E_None)
- return eErrCode;
-
// Load SuperBlock and require good health.
- eErrCode = verify (m_pSuper);
+ storeError eErrCode = verify (m_pSuper);
if (eErrCode != store_E_None)
- {
- releaseLock (0, SuperPage::theSize);
return eErrCode;
- }
// Load PageHead.
OStorePageData aPageHead(OStorePageData::theSize);
@@ -1217,10 +1117,7 @@ storeError OStorePageBIOS::free (OStorePageData & /* rData */, sal_uInt32 nAddr)
eErrCode = peek (aPageHead);
if (eErrCode != store_E_None)
- {
- releaseLock (0, SuperPage::theSize);
return eErrCode;
- }
// Invalidate cache.
(void) m_xCache->removePageAt (nAddr);
@@ -1234,12 +1131,9 @@ storeError OStorePageBIOS::free (OStorePageData & /* rData */, sal_uInt32 nAddr)
// Save PageHead.
eErrCode = poke (aPageHead);
if (eErrCode != store_E_None)
- {
- releaseLock (0, SuperPage::theSize);
return eErrCode;
- }
- // Save SuperBlock page.
+ // Save SuperBlock page and finish.
m_pSuper->m_aSuperTwo.unusedInsert (aListHead);
m_pSuper->m_aSuperOne = m_pSuper->m_aSuperTwo;
@@ -1247,9 +1141,7 @@ storeError OStorePageBIOS::free (OStorePageData & /* rData */, sal_uInt32 nAddr)
OSL_POSTCOND(
eErrCode == store_E_None,
"OStorePageBIOS::free(): SuperBlock save failed");
-
- // Release SuperBlock Lock and finish.
- return releaseLock (0, SuperPage::theSize);
+ return eErrCode;
}
/*
diff --git a/store/source/storbios.hxx b/store/source/storbios.hxx
index d9a0f982bd3c..d9d91255742b 100644
--- a/store/source/storbios.hxx
+++ b/store/source/storbios.hxx
@@ -83,16 +83,6 @@ public:
return m_xAllocator;
}
- /** acquireLock.
- */
- storeError acquireLock (
- sal_uInt32 nAddr, sal_uInt32 nSize);
-
- /** releaseLock.
- */
- storeError releaseLock (
- sal_uInt32 nAddr, sal_uInt32 nSize);
-
/** read.
*/
storeError read (
diff --git a/store/source/stordata.cxx b/store/source/stordata.cxx
index 29350f8ebfdd..dd0a8f18211f 100644
--- a/store/source/stordata.cxx
+++ b/store/source/stordata.cxx
@@ -436,17 +436,8 @@ storeError OStoreIndirectionPageObject::truncate (
if (!(nSingle < nLimit))
return store_E_InvalidAccess;
- // Save PageDescriptor.
- OStorePageDescriptor aDescr (rPage.m_aDescr);
- aDescr.m_nAddr = store::ntohl(aDescr.m_nAddr);
- aDescr.m_nSize = store::ntohs(aDescr.m_nSize);
-
- // Acquire Lock.
- storeError eErrCode = rBIOS.acquireLock (aDescr.m_nAddr, aDescr.m_nSize);
- if (eErrCode != store_E_None)
- return eErrCode;
-
// Truncate.
+ storeError eErrCode = store_E_None;
for (sal_uInt16 i = nLimit; i > nSingle; i--)
{
// Obtain data page location.
@@ -457,10 +448,7 @@ storeError OStoreIndirectionPageObject::truncate (
OStorePageData aPageHead;
eErrCode = rBIOS.free (aPageHead, nAddr);
if (eErrCode != store_E_None)
- {
- rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize);
return eErrCode;
- }
// Clear pointer to data page.
rPage.m_pData[i - 1] = STORE_PAGE_NULL;
@@ -473,19 +461,10 @@ storeError OStoreIndirectionPageObject::truncate (
{
// Save this page.
eErrCode = rBIOS.saveObjectAt (*this, location());
- if (eErrCode != store_E_None)
- {
- // Must not happen.
- OSL_TRACE("OStoreIndirectionPageObject::truncate(): save failed");
-
- // Release Lock and Leave.
- rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize);
- return eErrCode;
- }
}
- // Release Lock and Leave.
- return rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize);
+ // Done.
+ return eErrCode;
}
/*
@@ -504,26 +483,14 @@ storeError OStoreIndirectionPageObject::truncate (
if (!((nDouble < nLimit) && (nSingle < nLimit)))
return store_E_InvalidAccess;
- // Save PageDescriptor.
- OStorePageDescriptor aDescr (rPage.m_aDescr);
- aDescr.m_nAddr = store::ntohl(aDescr.m_nAddr);
- aDescr.m_nSize = store::ntohs(aDescr.m_nSize);
-
- // Acquire Lock.
- storeError eErrCode = rBIOS.acquireLock (aDescr.m_nAddr, aDescr.m_nSize);
- if (eErrCode != store_E_None)
- return eErrCode;
-
// Truncate.
+ storeError eErrCode = store_E_None;
for (sal_uInt16 i = nLimit; i > nDouble + 1; i--)
{
// Truncate single indirect page to zero direct pages.
eErrCode = store_truncate_Impl (store::ntohl(rPage.m_pData[i - 1]), 0, rBIOS);
if (eErrCode != store_E_None)
- {
- rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize);
return eErrCode;
- }
// Clear pointer to single indirect page.
rPage.m_pData[i - 1] = STORE_PAGE_NULL;
@@ -533,10 +500,7 @@ storeError OStoreIndirectionPageObject::truncate (
// Truncate last single indirect page to 'nSingle' direct pages.
eErrCode = store_truncate_Impl (store::ntohl(rPage.m_pData[nDouble]), nSingle, rBIOS);
if (eErrCode != store_E_None)
- {
- rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize);
return eErrCode;
- }
// Check for complete truncation.
if (nSingle == 0)
@@ -551,19 +515,10 @@ storeError OStoreIndirectionPageObject::truncate (
{
// Save this page.
eErrCode = rBIOS.saveObjectAt (*this, location());
- if (eErrCode != store_E_None)
- {
- // Must not happen.
- OSL_TRACE("OStoreIndirectionPageObject::truncate(): save failed");
-
- // Release Lock and Leave.
- rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize);
- return eErrCode;
- }
}
- // Release Lock and Leave.
- return rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize);
+ // Done.
+ return eErrCode;
}
/*
@@ -583,26 +538,14 @@ storeError OStoreIndirectionPageObject::truncate (
if (!((nTriple < nLimit) && (nDouble < nLimit) && (nSingle < nLimit)))
return store_E_InvalidAccess;
- // Save PageDescriptor.
- OStorePageDescriptor aDescr (rPage.m_aDescr);
- aDescr.m_nAddr = store::ntohl(aDescr.m_nAddr);
- aDescr.m_nSize = store::ntohs(aDescr.m_nSize);
-
- // Acquire Lock.
- storeError eErrCode = rBIOS.acquireLock (aDescr.m_nAddr, aDescr.m_nSize);
- if (eErrCode != store_E_None)
- return eErrCode;
-
// Truncate.
+ storeError eErrCode = store_E_None;
for (sal_uInt16 i = nLimit; i > nTriple + 1; i--)
{
// Truncate double indirect page to zero single indirect pages.
eErrCode = store_truncate_Impl (store::ntohl(rPage.m_pData[i - 1]), 0, 0, rBIOS);
if (eErrCode != store_E_None)
- {
- rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize);
return eErrCode;
- }
// Clear pointer to double indirect page.
rPage.m_pData[i - 1] = STORE_PAGE_NULL;
@@ -612,10 +555,7 @@ storeError OStoreIndirectionPageObject::truncate (
// Truncate last double indirect page to 'nDouble', 'nSingle' pages.
eErrCode = store_truncate_Impl (store::ntohl(rPage.m_pData[nTriple]), nDouble, nSingle, rBIOS);
if (eErrCode != store_E_None)
- {
- rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize);
return eErrCode;
- }
// Check for complete truncation.
if ((nDouble + nSingle) == 0)
@@ -630,19 +570,10 @@ storeError OStoreIndirectionPageObject::truncate (
{
// Save this page.
eErrCode = rBIOS.saveObjectAt (*this, location());
- if (eErrCode != store_E_None)
- {
- // Must not happen.
- OSL_TRACE("OStoreIndirectionPageObject::truncate(): save failed");
-
- // Release Lock and Leave.
- rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize);
- return eErrCode;
- }
}
- // Release Lock and Leave.
- return rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize);
+ // Done.
+ return eErrCode;
}
/*========================================================================
@@ -1132,8 +1063,8 @@ storeError OStoreDirectoryPageObject::truncate (
if (nAddr == STORE_PAGE_NULL) continue;
// Free data page.
- OStoreDataPageData aData;
- eErrCode = rBIOS.free (aData, nAddr);
+ OStorePageData aPageHead;
+ eErrCode = rBIOS.free (aPageHead, nAddr);
if (eErrCode != store_E_None)
break;
diff --git a/store/source/stortree.cxx b/store/source/stortree.cxx
index 614b995aba72..3f4f4b21c68b 100644
--- a/store/source/stortree.cxx
+++ b/store/source/stortree.cxx
@@ -205,25 +205,10 @@ storeError OStoreBTreeNodeObject::split (
if (!rxPageL->querySplit())
return store_E_None;
- // Save PageDescriptor.
- OStorePageDescriptor aDescr (xPage->m_aDescr);
- aDescr.m_nAddr = store::ntohl(aDescr.m_nAddr);
- aDescr.m_nSize = store::ntohs(aDescr.m_nSize);
-
- // Acquire Lock.
- storeError eErrCode = rBIOS.acquireLock (aDescr.m_nAddr, aDescr.m_nSize);
- if (eErrCode != store_E_None)
- return eErrCode;
-
- // [Begin PageL Lock (NYI)]
-
// Construct right page.
PageHolderObject< page > xPageR;
if (!xPageR.construct (rBIOS.allocator()))
- {
- rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize);
return store_E_OutOfMemory;
- }
// Split right page off left page.
xPageR->split (*rxPageL);
@@ -231,12 +216,9 @@ storeError OStoreBTreeNodeObject::split (
// Allocate right page.
self aNodeR (xPageR.get());
- eErrCode = rBIOS.allocate (aNodeR);
+ storeError eErrCode = rBIOS.allocate (aNodeR);
if (eErrCode != store_E_None)
- {
- rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize);
return eErrCode;
- }
// Truncate left page.
rxPageL->truncate (rxPageL->capacityCount() / 2);
@@ -245,35 +227,14 @@ storeError OStoreBTreeNodeObject::split (
self aNodeL (rxPageL.get());
eErrCode = rBIOS.saveObjectAt (aNodeL, aNodeL.location());
if (eErrCode != store_E_None)
- {
- // Must not happen.
- OSL_TRACE("OStoreBTreeNodeObject::split(): save() failed");
-
- // Release Lock and Leave.
- rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize);
return eErrCode;
- }
-
- // [End PageL Lock (NYI)]
// Insert right page.
OStorePageLink aLink (xPageR->location());
xPage->insert (nIndexL + 1, T(xPageR->m_pData[0].m_aKey, aLink));
- // Save this page.
- eErrCode = rBIOS.saveObjectAt (*this, location());
- if (eErrCode != store_E_None)
- {
- // Must not happen.
- OSL_TRACE("OStoreBTreeNodeObject::split(): save() failed");
-
- // Release Lock and Leave.
- rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize);
- return eErrCode;
- }
-
- // Release Lock and Leave.
- return rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize);
+ // Save this page and leave.
+ return rBIOS.saveObjectAt (*this, location());
}
/*
@@ -287,43 +248,25 @@ storeError OStoreBTreeNodeObject::remove (
PageHolderObject< page > xImpl (m_xPage);
page & rPage = (*xImpl);
- // Save PageDescriptor.
- OStorePageDescriptor aDescr (rPage.m_aDescr);
- aDescr.m_nAddr = store::ntohl(aDescr.m_nAddr);
- aDescr.m_nSize = store::ntohs(aDescr.m_nSize);
-
- // Acquire Lock.
- storeError eErrCode = rBIOS.acquireLock (aDescr.m_nAddr, aDescr.m_nSize);
- if (eErrCode != store_E_None)
- return eErrCode;
-
// Check depth.
+ storeError eErrCode = store_E_None;
if (rPage.depth())
{
// Check link entry.
T const aEntryL (rPage.m_pData[nIndexL]);
if (!(rEntryL.compare (aEntryL) == T::COMPARE_EQUAL))
- {
- rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize);
return store_E_InvalidAccess;
- }
// Load link node.
self aNodeL;
eErrCode = rBIOS.loadObjectAt (aNodeL, aEntryL.m_aLink.location());
if (eErrCode != store_E_None)
- {
- rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize);
return eErrCode;
- }
// Recurse: remove from link node.
eErrCode = aNodeL.remove (0, rEntryL, rBIOS);
if (eErrCode != store_E_None)
- {
- rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize);
return eErrCode;
- }
// Check resulting link node usage.
PageHolderObject< page > xPageL (aNodeL.get());
@@ -333,10 +276,7 @@ storeError OStoreBTreeNodeObject::remove (
OStorePageData aPageHead;
eErrCode = rBIOS.free (aPageHead, xPageL->location());
if (eErrCode != store_E_None)
- {
- rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize);
return eErrCode;
- }
// Remove index.
rPage.remove (nIndexL);
@@ -373,10 +313,7 @@ storeError OStoreBTreeNodeObject::remove (
{
// Check leaf entry.
if (!(rEntryL.compare (rPage.m_pData[nIndexL]) == T::COMPARE_EQUAL))
- {
- rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize);
return store_E_NotExists;
- }
// Save leaf entry.
rEntryL = rPage.m_pData[nIndexL];
@@ -391,19 +328,10 @@ storeError OStoreBTreeNodeObject::remove (
{
// Save this page.
eErrCode = rBIOS.saveObjectAt (*this, location());
- if (eErrCode != store_E_None)
- {
- // Must not happen.
- OSL_TRACE("OStoreBTreeNodeObject::remove(): save() failed");
-
- // Release Lock and Leave.
- rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize);
- return eErrCode;
- }
}
- // Release Lock and Leave.
- return rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize);
+ // Done.
+ return eErrCode;
}
/*========================================================================
@@ -457,33 +385,17 @@ storeError OStoreBTreeRootObject::change (
PageHolderObject< page > xPage (m_xPage);
(void) testInvariant("OStoreBTreeRootObject::change(): enter");
- // Save PageDescriptor.
- OStorePageDescriptor aDescr (xPage->m_aDescr);
- aDescr.m_nAddr = store::ntohl(aDescr.m_nAddr);
- aDescr.m_nSize = store::ntohs(aDescr.m_nSize);
-
// Save root location.
sal_uInt32 const nRootAddr = xPage->location();
- // Acquire Lock.
- storeError eErrCode = rBIOS.acquireLock (aDescr.m_nAddr, aDescr.m_nSize);
- if (eErrCode != store_E_None)
- return eErrCode;
-
// Construct new root.
if (!rxPageL.construct (rBIOS.allocator()))
- {
- rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize);
return store_E_OutOfMemory;
- }
// Save this as prev root.
- eErrCode = rBIOS.allocate (*this);
+ storeError eErrCode = rBIOS.allocate (*this);
if (eErrCode != store_E_None)
- {
- rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize);
return store_E_OutOfMemory;
- }
// Setup new root.
rxPageL->depth (xPage->depth() + 1);
@@ -500,22 +412,13 @@ storeError OStoreBTreeRootObject::change (
// Save this as new root.
eErrCode = rBIOS.saveObjectAt (*this, nRootAddr);
- if (eErrCode != store_E_None)
- {
- // Must not happen.
- OSL_TRACE("OStoreBTreeRootObject::change(): save() failed");
-
- // Release Lock and Leave.
- rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize);
- return eErrCode;
- }
// Flush for robustness.
(void) rBIOS.flush();
- // Done. Release Lock and Leave.
+ // Done.
(void) testInvariant("OStoreBTreeRootObject::change(): leave");
- return rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize);
+ return eErrCode;
}
/*
diff --git a/store/workben/t_base.cxx b/store/workben/t_base.cxx
index 593736e4d57b..02d283c7e31e 100644
--- a/store/workben/t_base.cxx
+++ b/store/workben/t_base.cxx
@@ -365,19 +365,8 @@ int SAL_CALL main (int argc, char **argv)
rtl_zeroMemory (pBuffer, sizeof (pBuffer));
rtl_copyMemory (pBuffer, argv[0], rtl_str_getLength(argv[0]) + 1);
- eErrCode = xBIOS->acquireLock (TEST_PAGESIZE, sizeof(pBuffer));
- if (eErrCode != store_E_None)
- return eErrCode;
-
eErrCode = xBIOS->write (TEST_PAGESIZE, pBuffer, sizeof (pBuffer));
if (eErrCode != store_E_None)
- {
- xBIOS->releaseLock (TEST_PAGESIZE, sizeof(pBuffer));
- return eErrCode;
- }
-
- eErrCode = xBIOS->releaseLock (TEST_PAGESIZE, sizeof(pBuffer));
- if (eErrCode != store_E_None)
return eErrCode;
xBIOS.clear();