Fix unallocated space calculation in the presence of LVM RAID partitions.
BUG: 396776
This commit is contained in:
parent
8b28001ae2
commit
4fcbb540e0
|
@ -402,18 +402,26 @@ void PartitionTable::insertUnallocated(const Device& d, PartitionNode* p, qint64
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Take care of the free space between the end of the last child and the end
|
if (d.type() == Device::Type::LVM_Device)
|
||||||
// of the device or the extended partition.
|
{
|
||||||
qint64 parentEnd = lastUsable();
|
const LvmDevice& lvm = static_cast<const LvmDevice&>(d);
|
||||||
|
p->insert(createUnallocated(d, *p, lastEnd, lastEnd + lvm.freePE() - 1));
|
||||||
if (!p->isRoot()) {
|
|
||||||
Partition* extended = dynamic_cast<Partition*>(p);
|
|
||||||
parentEnd = extended ? extended->lastSector() : -1;
|
|
||||||
Q_ASSERT(extended);
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Take care of the free space between the end of the last child and the end
|
||||||
|
// of the device or the extended partition.
|
||||||
|
qint64 parentEnd = lastUsable();
|
||||||
|
|
||||||
if (parentEnd >= firstUsable() && parentEnd >= lastEnd)
|
if (!p->isRoot()) {
|
||||||
p->insert(createUnallocated(d, *p, lastEnd, parentEnd));
|
Partition* extended = dynamic_cast<Partition*>(p);
|
||||||
|
parentEnd = extended ? extended->lastSector() : -1;
|
||||||
|
Q_ASSERT(extended);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (parentEnd >= firstUsable() && parentEnd >= lastEnd)
|
||||||
|
p->insert(createUnallocated(d, *p, lastEnd, parentEnd));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Updates the unallocated Partitions for this PartitionTable.
|
/** Updates the unallocated Partitions for this PartitionTable.
|
||||||
|
|
Loading…
Reference in New Issue