* Nested transactions didn't really work in combination with the separate
transaction mechanism. Now we keep track of the parent transactions, and restore fOwner on Journal::Unlock(). * This closes bug #4155 again. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33883 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -956,6 +956,9 @@ Journal::Lock(Transaction* owner, bool separateSubTransactions)
|
|||||||
if (separateSubTransactions)
|
if (separateSubTransactions)
|
||||||
fSeparateSubTransactions = true;
|
fSeparateSubTransactions = true;
|
||||||
|
|
||||||
|
if (owner != NULL)
|
||||||
|
owner->SetParent(fOwner);
|
||||||
|
|
||||||
fOwner = owner;
|
fOwner = owner;
|
||||||
|
|
||||||
// TODO: we need a way to find out how big the current transaction is;
|
// TODO: we need a way to find out how big the current transaction is;
|
||||||
@@ -992,7 +995,7 @@ Journal::Unlock(Transaction* owner, bool success)
|
|||||||
// we only end the transaction if we would really unlock it
|
// we only end the transaction if we would really unlock it
|
||||||
// TODO: what about failing transactions that do not unlock?
|
// TODO: what about failing transactions that do not unlock?
|
||||||
// (they must make the parent fail, too)
|
// (they must make the parent fail, too)
|
||||||
if (fOwner != NULL) {
|
if (owner != NULL) {
|
||||||
status_t status = _TransactionDone(success);
|
status_t status = _TransactionDone(success);
|
||||||
if (status != B_OK)
|
if (status != B_OK)
|
||||||
return status;
|
return status;
|
||||||
@@ -1002,12 +1005,14 @@ Journal::Unlock(Transaction* owner, bool success)
|
|||||||
// closed.
|
// closed.
|
||||||
bool separateSubTransactions = fSeparateSubTransactions;
|
bool separateSubTransactions = fSeparateSubTransactions;
|
||||||
fSeparateSubTransactions = true;
|
fSeparateSubTransactions = true;
|
||||||
fOwner->UnlockInodes(success);
|
owner->UnlockInodes(success);
|
||||||
fSeparateSubTransactions = separateSubTransactions;
|
fSeparateSubTransactions = separateSubTransactions;
|
||||||
}
|
|
||||||
|
fOwner = owner->Parent();
|
||||||
|
} else
|
||||||
|
fOwner = NULL;
|
||||||
|
|
||||||
fTimestamp = system_time();
|
fTimestamp = system_time();
|
||||||
fOwner = NULL;
|
|
||||||
|
|
||||||
if (fSeparateSubTransactions
|
if (fSeparateSubTransactions
|
||||||
&& recursive_lock_get_recursion(&fLock) == 1)
|
&& recursive_lock_get_recursion(&fLock) == 1)
|
||||||
|
|||||||
@@ -90,21 +90,24 @@ class Transaction {
|
|||||||
public:
|
public:
|
||||||
Transaction(Volume* volume, off_t refBlock)
|
Transaction(Volume* volume, off_t refBlock)
|
||||||
:
|
:
|
||||||
fJournal(NULL)
|
fJournal(NULL),
|
||||||
|
fParent(NULL)
|
||||||
{
|
{
|
||||||
Start(volume, refBlock);
|
Start(volume, refBlock);
|
||||||
}
|
}
|
||||||
|
|
||||||
Transaction(Volume* volume, block_run refRun)
|
Transaction(Volume* volume, block_run refRun)
|
||||||
:
|
:
|
||||||
fJournal(NULL)
|
fJournal(NULL),
|
||||||
|
fParent(NULL)
|
||||||
{
|
{
|
||||||
Start(volume, volume->ToBlock(refRun));
|
Start(volume, volume->ToBlock(refRun));
|
||||||
}
|
}
|
||||||
|
|
||||||
Transaction()
|
Transaction()
|
||||||
:
|
:
|
||||||
fJournal(NULL)
|
fJournal(NULL),
|
||||||
|
fParent(NULL)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -130,10 +133,7 @@ public:
|
|||||||
|
|
||||||
bool HasParent() const
|
bool HasParent() const
|
||||||
{
|
{
|
||||||
if (fJournal != NULL)
|
return fParent != NULL;
|
||||||
return fJournal->CurrentTransaction() == this;
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsTooLarge() const
|
bool IsTooLarge() const
|
||||||
@@ -182,13 +182,19 @@ public:
|
|||||||
void UnlockInodes(bool success);
|
void UnlockInodes(bool success);
|
||||||
void MoveInodesTo(Transaction* transaction);
|
void MoveInodesTo(Transaction* transaction);
|
||||||
|
|
||||||
|
void SetParent(Transaction* parent)
|
||||||
|
{ fParent = parent; }
|
||||||
|
Transaction* Parent() const
|
||||||
|
{ return fParent; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Transaction(const Transaction& other);
|
Transaction(const Transaction& other);
|
||||||
Transaction& operator=(const Transaction& other);
|
Transaction& operator=(const Transaction& other);
|
||||||
// no implementation
|
// no implementation
|
||||||
|
|
||||||
Journal* fJournal;
|
Journal* fJournal;
|
||||||
InodeList fLockedInodes;
|
InodeList fLockedInodes;
|
||||||
|
Transaction* fParent;
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef BFS_DEBUGGER_COMMANDS
|
#ifdef BFS_DEBUGGER_COMMANDS
|
||||||
|
|||||||
Reference in New Issue
Block a user