From 5ac3152dfe5b437ecf2675b623a8f13ba4a9b48f Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Sat, 10 Nov 2007 20:36:30 +0000 Subject: [PATCH] * 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 --- .../disk_device/DiskDeviceJobGenerator.cpp | 26 +++++++++++++++---- .../disk_device/DiskDeviceJobQueue.cpp | 15 ++++++++++- 2 files changed, 35 insertions(+), 6 deletions(-) diff --git a/src/kits/storage/disk_device/DiskDeviceJobGenerator.cpp b/src/kits/storage/disk_device/DiskDeviceJobGenerator.cpp index 34c6fcf263..58381ae1f6 100644 --- a/src/kits/storage/disk_device/DiskDeviceJobGenerator.cpp +++ b/src/kits/storage/disk_device/DiskDeviceJobGenerator.cpp @@ -30,6 +30,11 @@ #include "UninitializeJob.h" +#undef TRACE +//#define TRACE(x...) +#define TRACE(x...) printf(x) + + using std::nothrow; @@ -133,21 +138,32 @@ DiskDeviceJobGenerator::GenerateJobs() // changes, also those that shall be initialized with a disk system. // This simplifies moving and resizing. status_t error = _GenerateCleanupJobs(fDevice); - if (error != B_OK) + if (error != B_OK) { + TRACE("DiskDeviceJobGenerator::GenerateJobs(): _GenerateCleanupJobs() " + "failed\n"); return error; + } // Generate jobs that move and resize the remaining physical partitions // to their final position/size. error = _GeneratePlacementJobs(fDevice); - if (error != B_OK) + if (error != B_OK) { + TRACE("DiskDeviceJobGenerator::GenerateJobs(): " + "_GeneratePlacementJobs() failed\n"); return error; + } // Generate the remaining jobs in one run: initialization, creation of // partitions, and changing of name, content name, type, parameters, and // content parameters. error = _GenerateRemainingJobs(NULL, fDevice); - if (error != B_OK) + if (error != B_OK) { + TRACE("DiskDeviceJobGenerator::GenerateJobs(): " + "_GenerateRemainingJobs() failed\n"); return error; + } + + TRACE("DiskDeviceJobGenerator::GenerateJobs(): succeeded\n"); return B_OK; } @@ -175,7 +191,8 @@ DiskDeviceJobGenerator::_GenerateCleanupJobs(BPartition* partition) // TODO: Depending on how this shall be handled, we might want to unmount // all descendants of a partition to be uninitialized or removed. 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 status_t error = _GenerateUninitializeJob(partition); if (error != B_OK) @@ -368,7 +385,6 @@ DiskDeviceJobGenerator::_GenerateRemainingJobs(BPartition* parent, return error; } else { // partition already exists: set non-content properties - // name if ((changeFlags & B_PARTITION_CHANGED_NAME) diff --git a/src/kits/storage/disk_device/DiskDeviceJobQueue.cpp b/src/kits/storage/disk_device/DiskDeviceJobQueue.cpp index 8e65a90315..304d22a1f9 100644 --- a/src/kits/storage/disk_device/DiskDeviceJobQueue.cpp +++ b/src/kits/storage/disk_device/DiskDeviceJobQueue.cpp @@ -5,9 +5,16 @@ #include "DiskDeviceJobQueue.h" +#include + #include "DiskDeviceJob.h" +#undef TRACE +//#define TRACE(x...) +#define TRACE(x...) printf(x) + + // constructor DiskDeviceJobQueue::DiskDeviceJobQueue() : fJobs(20, true) @@ -39,9 +46,15 @@ DiskDeviceJobQueue::Execute() int32 count = fJobs.CountItems(); for (int32 i = 0; i < count; i++) { DiskDeviceJob* job = fJobs.ItemAt(i); + + TRACE("DiskDeviceJobQueue::Execute(): executing job: %s\n", + typeid(*job).name()); + status_t error = job->Do(); - if (error != B_OK) + if (error != B_OK) { + TRACE("DiskDeviceJobQueue::Execute(): executing job failed\n"); return error; + } } return B_OK;