Stop the journal on Sync(), start the journal when a transaction is written. This helps with fs state on shutdown.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39325 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
e5d4255933
commit
82b3bdd45c
@ -137,6 +137,7 @@ Journal::Journal()
|
||||
fFirstLogBlock(1),
|
||||
fLogSize(0),
|
||||
fVersion(0),
|
||||
fIsStarted(false),
|
||||
fLogStart(0),
|
||||
fLogEnd(0),
|
||||
fFreeBlocks(0),
|
||||
@ -175,6 +176,9 @@ Journal::InitCheck()
|
||||
status_t
|
||||
Journal::Uninit()
|
||||
{
|
||||
if (!fIsStarted)
|
||||
return B_OK;
|
||||
|
||||
status_t status = FlushLogAndBlocks();
|
||||
|
||||
if (status == B_OK) {
|
||||
@ -183,6 +187,8 @@ Journal::Uninit()
|
||||
status = _SaveSuperBlock();
|
||||
}
|
||||
|
||||
fIsStarted = false;
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
@ -193,6 +199,7 @@ Journal::StartLog()
|
||||
fLogStart = fFirstLogBlock;
|
||||
fLogEnd = fFirstLogBlock;
|
||||
fFreeBlocks = 0;
|
||||
fIsStarted = true;
|
||||
|
||||
fCurrentCommitID = fFirstCommitID;
|
||||
|
||||
@ -497,6 +504,8 @@ Journal::_WriteTransactionToLog()
|
||||
"the transaction\n");
|
||||
|
||||
fHasSubTransaction = false;
|
||||
if (!fIsStarted)
|
||||
StartLog();
|
||||
|
||||
// Prepare Descriptor block
|
||||
TRACE("Journal::_WriteTransactionToLog(): attempting to allocate space for "
|
||||
|
@ -216,6 +216,7 @@ protected:
|
||||
uint32 fLogSize;
|
||||
uint32 fVersion;
|
||||
|
||||
bool fIsStarted;
|
||||
uint32 fLogStart;
|
||||
uint32 fLogEnd;
|
||||
uint32 fFreeBlocks;
|
||||
|
@ -848,7 +848,7 @@ status_t
|
||||
Volume::Sync()
|
||||
{
|
||||
TRACE("Volume::Sync()\n");
|
||||
return fJournal->FlushLogAndBlocks();
|
||||
return fJournal->Uninit();
|
||||
}
|
||||
|
||||
|
||||
|
@ -176,6 +176,14 @@ ext2_read_fs_info(fs_volume* _volume, struct fs_info* info)
|
||||
}
|
||||
|
||||
|
||||
static status_t
|
||||
ext2_sync(fs_volume* _volume)
|
||||
{
|
||||
Volume* volume = (Volume*)_volume->private_volume;
|
||||
return volume->Sync();
|
||||
}
|
||||
|
||||
|
||||
// #pragma mark -
|
||||
|
||||
|
||||
@ -1598,7 +1606,7 @@ fs_volume_ops gExt2VolumeOps = {
|
||||
&ext2_unmount,
|
||||
&ext2_read_fs_info,
|
||||
NULL, // write_fs_info()
|
||||
NULL, // sync()
|
||||
&ext2_sync,
|
||||
&ext2_get_vnode,
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user