* Some preparations to be able to split transactions if they become too large
for the log. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31860 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -599,6 +599,26 @@ Journal::ReplayLog()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
size_t
|
||||||
|
Journal::CurrentTransactionSize() const
|
||||||
|
{
|
||||||
|
if (_HasSubTransaction()) {
|
||||||
|
return cache_blocks_in_sub_transaction(fVolume->BlockCache(),
|
||||||
|
fTransactionID);
|
||||||
|
}
|
||||||
|
|
||||||
|
return cache_blocks_in_main_transaction(fVolume->BlockCache(),
|
||||||
|
fTransactionID);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
Journal::CurrentTransactionTooLarge() const
|
||||||
|
{
|
||||||
|
return CurrentTransactionSize() > fLogSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*! This is a callback function that is called by the cache, whenever
|
/*! This is a callback function that is called by the cache, whenever
|
||||||
all blocks of a transaction have been flushed to disk.
|
all blocks of a transaction have been flushed to disk.
|
||||||
This lets us keep track of completed transactions, and update
|
This lets us keep track of completed transactions, and update
|
||||||
|
|||||||
@@ -32,6 +32,8 @@ public:
|
|||||||
status_t ReplayLog();
|
status_t ReplayLog();
|
||||||
|
|
||||||
Transaction* CurrentTransaction() const { return fOwner; }
|
Transaction* CurrentTransaction() const { return fOwner; }
|
||||||
|
size_t CurrentTransactionSize() const;
|
||||||
|
bool CurrentTransactionTooLarge() const;
|
||||||
|
|
||||||
status_t FlushLogAndBlocks();
|
status_t FlushLogAndBlocks();
|
||||||
Volume* GetVolume() const { return fVolume; }
|
Volume* GetVolume() const { return fVolume; }
|
||||||
@@ -44,7 +46,9 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool _HasSubTransaction() { return fHasSubtransaction; }
|
bool _HasSubTransaction() const
|
||||||
|
{ return fHasSubtransaction; }
|
||||||
|
|
||||||
status_t _FlushLog(bool canWait, bool flushBlocks);
|
status_t _FlushLog(bool canWait, bool flushBlocks);
|
||||||
uint32 _TransactionSize() const;
|
uint32 _TransactionSize() const;
|
||||||
status_t _WriteTransactionToLog();
|
status_t _WriteTransactionToLog();
|
||||||
@@ -127,7 +131,7 @@ public:
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool HasParent()
|
bool HasParent() const
|
||||||
{
|
{
|
||||||
if (fJournal != NULL)
|
if (fJournal != NULL)
|
||||||
return fJournal->CurrentTransaction() == this;
|
return fJournal->CurrentTransaction() == this;
|
||||||
@@ -135,6 +139,11 @@ public:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool IsTooLarge() const
|
||||||
|
{
|
||||||
|
return fJournal->CurrentTransactionTooLarge();
|
||||||
|
}
|
||||||
|
|
||||||
status_t WriteBlocks(off_t blockNumber, const uint8* buffer,
|
status_t WriteBlocks(off_t blockNumber, const uint8* buffer,
|
||||||
size_t numBlocks = 1)
|
size_t numBlocks = 1)
|
||||||
{
|
{
|
||||||
@@ -159,7 +168,13 @@ public:
|
|||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
Volume *GetVolume()
|
void Split()
|
||||||
|
{
|
||||||
|
cache_start_sub_transaction(fJournal->GetVolume()->BlockCache(),
|
||||||
|
fJournal->TransactionID());
|
||||||
|
}
|
||||||
|
|
||||||
|
Volume* GetVolume() const
|
||||||
{ return fJournal != NULL ? fJournal->GetVolume() : NULL; }
|
{ return fJournal != NULL ? fJournal->GetVolume() : NULL; }
|
||||||
int32 ID() const
|
int32 ID() const
|
||||||
{ return fJournal->TransactionID(); }
|
{ return fJournal->TransactionID(); }
|
||||||
|
|||||||
Reference in New Issue
Block a user