From bce1e507263640f61cfe585b8dd8dec33f5a6476 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Sun, 28 Sep 2003 19:30:57 +0000 Subject: [PATCH] Some fixes concerning job queue handling. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4845 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../disk_device_manager/KDiskDeviceManager.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/kernel/core/disk_device_manager/KDiskDeviceManager.cpp b/src/kernel/core/disk_device_manager/KDiskDeviceManager.cpp index 1d17ef970b..eb66c8fd21 100644 --- a/src/kernel/core/disk_device_manager/KDiskDeviceManager.cpp +++ b/src/kernel/core/disk_device_manager/KDiskDeviceManager.cpp @@ -951,6 +951,7 @@ KDiskDeviceManager::_RemoveJobQueue(KDiskDeviceJobQueue *jobQueue) KDiskDeviceJob *job = jobQueue->JobAt(i); fJobs->Remove(job->ID()); } + fJobQueues->Erase(it); return true; } @@ -981,7 +982,7 @@ KDiskDeviceManager::_UpdateBusyPartitions(KDiskDevice *device) for (int32 i = jobQueue->ActiveJobIndex(); KDiskDeviceJob *job = jobQueue->JobAt(i); i++) { if (job->Status() != B_DISK_DEVICE_JOB_IN_PROGRESS - && job->Status() == B_DISK_DEVICE_JOB_SCHEDULED) { + && job->Status() != B_DISK_DEVICE_JOB_SCHEDULED) { continue; } KPartition *partition = FindPartition(job->ScopeID()); @@ -992,10 +993,20 @@ KDiskDeviceManager::_UpdateBusyPartitions(KDiskDevice *device) shadow->AddFlags(B_PARTITION_BUSY); } } - // mark all anscestors of busy partitions descendant busy + // mark all anscestors of busy partitions descendant busy and all + // descendants busy struct MarkBusyVisitor : KPartitionVisitor { + virtual bool VisitPre(KPartition *partition) + { + // parent busy => child busy + if (partition->Parent() && partition->Parent()->IsBusy()) + partition->Parent()->AddFlags(B_PARTITION_BUSY); + return false; + } + virtual bool VisitPost(KPartition *partition) { + // child [descendant] busy => parent descendant busy if ((partition->IsBusy() || partition->IsDescendantBusy()) && partition->Parent()) { partition->Parent()->AddFlags(