* Added some debug output.
* Don't generate an uninitialize job, when there's the partition wasn't initialized anyway (the syscall would fail in this case). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22883 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -30,6 +30,11 @@
|
|||||||
#include "UninitializeJob.h"
|
#include "UninitializeJob.h"
|
||||||
|
|
||||||
|
|
||||||
|
#undef TRACE
|
||||||
|
//#define TRACE(x...)
|
||||||
|
#define TRACE(x...) printf(x)
|
||||||
|
|
||||||
|
|
||||||
using std::nothrow;
|
using std::nothrow;
|
||||||
|
|
||||||
|
|
||||||
@@ -133,21 +138,32 @@ DiskDeviceJobGenerator::GenerateJobs()
|
|||||||
// changes, also those that shall be initialized with a disk system.
|
// changes, also those that shall be initialized with a disk system.
|
||||||
// This simplifies moving and resizing.
|
// This simplifies moving and resizing.
|
||||||
status_t error = _GenerateCleanupJobs(fDevice);
|
status_t error = _GenerateCleanupJobs(fDevice);
|
||||||
if (error != B_OK)
|
if (error != B_OK) {
|
||||||
|
TRACE("DiskDeviceJobGenerator::GenerateJobs(): _GenerateCleanupJobs() "
|
||||||
|
"failed\n");
|
||||||
return error;
|
return error;
|
||||||
|
}
|
||||||
|
|
||||||
// Generate jobs that move and resize the remaining physical partitions
|
// Generate jobs that move and resize the remaining physical partitions
|
||||||
// to their final position/size.
|
// to their final position/size.
|
||||||
error = _GeneratePlacementJobs(fDevice);
|
error = _GeneratePlacementJobs(fDevice);
|
||||||
if (error != B_OK)
|
if (error != B_OK) {
|
||||||
|
TRACE("DiskDeviceJobGenerator::GenerateJobs(): "
|
||||||
|
"_GeneratePlacementJobs() failed\n");
|
||||||
return error;
|
return error;
|
||||||
|
}
|
||||||
|
|
||||||
// Generate the remaining jobs in one run: initialization, creation of
|
// Generate the remaining jobs in one run: initialization, creation of
|
||||||
// partitions, and changing of name, content name, type, parameters, and
|
// partitions, and changing of name, content name, type, parameters, and
|
||||||
// content parameters.
|
// content parameters.
|
||||||
error = _GenerateRemainingJobs(NULL, fDevice);
|
error = _GenerateRemainingJobs(NULL, fDevice);
|
||||||
if (error != B_OK)
|
if (error != B_OK) {
|
||||||
|
TRACE("DiskDeviceJobGenerator::GenerateJobs(): "
|
||||||
|
"_GenerateRemainingJobs() failed\n");
|
||||||
return error;
|
return error;
|
||||||
|
}
|
||||||
|
|
||||||
|
TRACE("DiskDeviceJobGenerator::GenerateJobs(): succeeded\n");
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
@@ -175,7 +191,8 @@ DiskDeviceJobGenerator::_GenerateCleanupJobs(BPartition* partition)
|
|||||||
// TODO: Depending on how this shall be handled, we might want to unmount
|
// TODO: Depending on how this shall be handled, we might want to unmount
|
||||||
// all descendants of a partition to be uninitialized or removed.
|
// all descendants of a partition to be uninitialized or removed.
|
||||||
if (BMutablePartition* shadow = _GetMutablePartition(partition)) {
|
if (BMutablePartition* shadow = _GetMutablePartition(partition)) {
|
||||||
if (shadow->ChangeFlags() & B_PARTITION_CHANGED_INITIALIZATION) {
|
if ((shadow->ChangeFlags() & B_PARTITION_CHANGED_INITIALIZATION)
|
||||||
|
&& partition->fPartitionData->content_type) {
|
||||||
// partition changes initialization
|
// partition changes initialization
|
||||||
status_t error = _GenerateUninitializeJob(partition);
|
status_t error = _GenerateUninitializeJob(partition);
|
||||||
if (error != B_OK)
|
if (error != B_OK)
|
||||||
@@ -369,7 +386,6 @@ DiskDeviceJobGenerator::_GenerateRemainingJobs(BPartition* parent,
|
|||||||
} else {
|
} else {
|
||||||
// partition already exists: set non-content properties
|
// partition already exists: set non-content properties
|
||||||
|
|
||||||
|
|
||||||
// name
|
// name
|
||||||
if ((changeFlags & B_PARTITION_CHANGED_NAME)
|
if ((changeFlags & B_PARTITION_CHANGED_NAME)
|
||||||
|| compare_string(partition->Name(), partitionData->name)) {
|
|| compare_string(partition->Name(), partitionData->name)) {
|
||||||
|
|||||||
@@ -5,9 +5,16 @@
|
|||||||
|
|
||||||
#include "DiskDeviceJobQueue.h"
|
#include "DiskDeviceJobQueue.h"
|
||||||
|
|
||||||
|
#include <typeinfo>
|
||||||
|
|
||||||
#include "DiskDeviceJob.h"
|
#include "DiskDeviceJob.h"
|
||||||
|
|
||||||
|
|
||||||
|
#undef TRACE
|
||||||
|
//#define TRACE(x...)
|
||||||
|
#define TRACE(x...) printf(x)
|
||||||
|
|
||||||
|
|
||||||
// constructor
|
// constructor
|
||||||
DiskDeviceJobQueue::DiskDeviceJobQueue()
|
DiskDeviceJobQueue::DiskDeviceJobQueue()
|
||||||
: fJobs(20, true)
|
: fJobs(20, true)
|
||||||
@@ -39,9 +46,15 @@ DiskDeviceJobQueue::Execute()
|
|||||||
int32 count = fJobs.CountItems();
|
int32 count = fJobs.CountItems();
|
||||||
for (int32 i = 0; i < count; i++) {
|
for (int32 i = 0; i < count; i++) {
|
||||||
DiskDeviceJob* job = fJobs.ItemAt(i);
|
DiskDeviceJob* job = fJobs.ItemAt(i);
|
||||||
|
|
||||||
|
TRACE("DiskDeviceJobQueue::Execute(): executing job: %s\n",
|
||||||
|
typeid(*job).name());
|
||||||
|
|
||||||
status_t error = job->Do();
|
status_t error = job->Do();
|
||||||
if (error != B_OK)
|
if (error != B_OK) {
|
||||||
|
TRACE("DiskDeviceJobQueue::Execute(): executing job failed\n");
|
||||||
return error;
|
return error;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
|
|||||||
Reference in New Issue
Block a user