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:
@@ -137,6 +137,7 @@ Journal::Journal()
|
|||||||
fFirstLogBlock(1),
|
fFirstLogBlock(1),
|
||||||
fLogSize(0),
|
fLogSize(0),
|
||||||
fVersion(0),
|
fVersion(0),
|
||||||
|
fIsStarted(false),
|
||||||
fLogStart(0),
|
fLogStart(0),
|
||||||
fLogEnd(0),
|
fLogEnd(0),
|
||||||
fFreeBlocks(0),
|
fFreeBlocks(0),
|
||||||
@@ -175,6 +176,9 @@ Journal::InitCheck()
|
|||||||
status_t
|
status_t
|
||||||
Journal::Uninit()
|
Journal::Uninit()
|
||||||
{
|
{
|
||||||
|
if (!fIsStarted)
|
||||||
|
return B_OK;
|
||||||
|
|
||||||
status_t status = FlushLogAndBlocks();
|
status_t status = FlushLogAndBlocks();
|
||||||
|
|
||||||
if (status == B_OK) {
|
if (status == B_OK) {
|
||||||
@@ -183,6 +187,8 @@ Journal::Uninit()
|
|||||||
status = _SaveSuperBlock();
|
status = _SaveSuperBlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fIsStarted = false;
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -193,6 +199,7 @@ Journal::StartLog()
|
|||||||
fLogStart = fFirstLogBlock;
|
fLogStart = fFirstLogBlock;
|
||||||
fLogEnd = fFirstLogBlock;
|
fLogEnd = fFirstLogBlock;
|
||||||
fFreeBlocks = 0;
|
fFreeBlocks = 0;
|
||||||
|
fIsStarted = true;
|
||||||
|
|
||||||
fCurrentCommitID = fFirstCommitID;
|
fCurrentCommitID = fFirstCommitID;
|
||||||
|
|
||||||
@@ -497,6 +504,8 @@ Journal::_WriteTransactionToLog()
|
|||||||
"the transaction\n");
|
"the transaction\n");
|
||||||
|
|
||||||
fHasSubTransaction = false;
|
fHasSubTransaction = false;
|
||||||
|
if (!fIsStarted)
|
||||||
|
StartLog();
|
||||||
|
|
||||||
// Prepare Descriptor block
|
// Prepare Descriptor block
|
||||||
TRACE("Journal::_WriteTransactionToLog(): attempting to allocate space for "
|
TRACE("Journal::_WriteTransactionToLog(): attempting to allocate space for "
|
||||||
|
|||||||
@@ -216,6 +216,7 @@ protected:
|
|||||||
uint32 fLogSize;
|
uint32 fLogSize;
|
||||||
uint32 fVersion;
|
uint32 fVersion;
|
||||||
|
|
||||||
|
bool fIsStarted;
|
||||||
uint32 fLogStart;
|
uint32 fLogStart;
|
||||||
uint32 fLogEnd;
|
uint32 fLogEnd;
|
||||||
uint32 fFreeBlocks;
|
uint32 fFreeBlocks;
|
||||||
|
|||||||
@@ -848,7 +848,7 @@ status_t
|
|||||||
Volume::Sync()
|
Volume::Sync()
|
||||||
{
|
{
|
||||||
TRACE("Volume::Sync()\n");
|
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 -
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
@@ -1598,7 +1606,7 @@ fs_volume_ops gExt2VolumeOps = {
|
|||||||
&ext2_unmount,
|
&ext2_unmount,
|
||||||
&ext2_read_fs_info,
|
&ext2_read_fs_info,
|
||||||
NULL, // write_fs_info()
|
NULL, // write_fs_info()
|
||||||
NULL, // sync()
|
&ext2_sync,
|
||||||
&ext2_get_vnode,
|
&ext2_get_vnode,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user