* 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:
parent
0bad839702
commit
4e64310788
@ -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
|
||||
all blocks of a transaction have been flushed to disk.
|
||||
This lets us keep track of completed transactions, and update
|
||||
|
@ -32,6 +32,8 @@ public:
|
||||
status_t ReplayLog();
|
||||
|
||||
Transaction* CurrentTransaction() const { return fOwner; }
|
||||
size_t CurrentTransactionSize() const;
|
||||
bool CurrentTransactionTooLarge() const;
|
||||
|
||||
status_t FlushLogAndBlocks();
|
||||
Volume* GetVolume() const { return fVolume; }
|
||||
@ -44,7 +46,9 @@ public:
|
||||
#endif
|
||||
|
||||
private:
|
||||
bool _HasSubTransaction() { return fHasSubtransaction; }
|
||||
bool _HasSubTransaction() const
|
||||
{ return fHasSubtransaction; }
|
||||
|
||||
status_t _FlushLog(bool canWait, bool flushBlocks);
|
||||
uint32 _TransactionSize() const;
|
||||
status_t _WriteTransactionToLog();
|
||||
@ -127,7 +131,7 @@ public:
|
||||
return status;
|
||||
}
|
||||
|
||||
bool HasParent()
|
||||
bool HasParent() const
|
||||
{
|
||||
if (fJournal != NULL)
|
||||
return fJournal->CurrentTransaction() == this;
|
||||
@ -135,6 +139,11 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
bool IsTooLarge() const
|
||||
{
|
||||
return fJournal->CurrentTransactionTooLarge();
|
||||
}
|
||||
|
||||
status_t WriteBlocks(off_t blockNumber, const uint8* buffer,
|
||||
size_t numBlocks = 1)
|
||||
{
|
||||
@ -159,7 +168,13 @@ public:
|
||||
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; }
|
||||
int32 ID() const
|
||||
{ return fJournal->TransactionID(); }
|
||||
|
Loading…
Reference in New Issue
Block a user