* Improved error reporting when mounting a volume failed, especially when

the log couldn't be replayed.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24400 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2008-03-15 16:21:57 +00:00
parent 5a32be6b84
commit 6cc5885822
2 changed files with 22 additions and 15 deletions

View File

@ -359,15 +359,21 @@ Volume::Mount(const char *deviceName, uint32 flags)
return B_ERROR;
fJournal = new Journal(this);
// replaying the log is the first thing we will do on this disk
if ((fJournal != NULL && fJournal->InitCheck() < B_OK)
|| fBlockAllocator.Initialize() < B_OK) {
// ToDo: improve error reporting for a bad journal
FATAL(("could not initialize journal/block bitmap allocator!\n"));
if (fJournal == NULL)
return B_NO_MEMORY;
// replaying the log is the first thing we will do on this disk
status_t status = fJournal->InitCheck();
if (status < B_OK) {
FATAL(("could not initialize journal: %s!\n", strerror(status)));
return status;
}
status_t status = B_OK;
status = fBlockAllocator.Initialize();
if (status < B_OK) {
FATAL(("could not initialize block bitmap allocator!\n"));
return status;
}
fRootNode = new Inode(this, ToVnode(Root()));
if (fRootNode && fRootNode->InitCheck() == B_OK) {

View File

@ -114,17 +114,18 @@ bfs_mount(dev_t mountID, const char *device, uint32 flags, const char *args,
if (volume == NULL)
return B_NO_MEMORY;
status_t status;
if ((status = volume->Mount(device, flags)) == B_OK) {
*_data = volume;
*_rootID = volume->ToVnode(volume->Root());
INFORM(("mounted \"%s\" (root node at %Ld, device = %s)\n",
volume->Name(), *_rootID, device));
}
else
status_t status = volume->Mount(device, flags);
if (status != B_OK) {
delete volume;
RETURN_ERROR(status);
}
RETURN_ERROR(status);
*_data = volume;
*_rootID = volume->ToVnode(volume->Root());
INFORM(("mounted \"%s\" (root node at %Ld, device = %s)\n",
volume->Name(), *_rootID, device));
return B_OK;
}