Make sure KDiskFreeSpaceInfo is never used for swap.
This commit is contained in:
parent
a78e6f986e
commit
3c58349561
|
@ -139,11 +139,11 @@ Partition* LvmDevice::scanPartition(const QString& lvPath, PartitionTable* pTabl
|
|||
mountPoint = FileSystem::detectMountPoint(fs, lvPath);
|
||||
mounted = FileSystem::detectMountStatus(fs, lvPath);
|
||||
|
||||
if (mountPoint != QString()) {
|
||||
// KDiskFreeSpaceInfo does not work with swap
|
||||
if (mountPoint != QString() && fs->type() != FileSystem::LinuxSwap) {
|
||||
const KDiskFreeSpaceInfo freeSpaceInfo = KDiskFreeSpaceInfo::freeSpaceInfo(mountPoint);
|
||||
if (logicalSize() > 0 && fs->type() != FileSystem::Luks)
|
||||
if (mounted && freeSpaceInfo.isValid() && mountPoint != QString())
|
||||
fs->setSectorsUsed(freeSpaceInfo.used() / logicalSize());
|
||||
if (logicalSize() > 0 && fs->type() != FileSystem::Luks && mounted && freeSpaceInfo.isValid())
|
||||
fs->setSectorsUsed(freeSpaceInfo.used() / logicalSize());
|
||||
}
|
||||
else if (fs->supportGetUsed() == FileSystem::cmdSupportFileSystem)
|
||||
fs->setSectorsUsed(qCeil(fs->readUsedCapacity(lvPath) / static_cast<float>(logicalSize())));
|
||||
|
|
|
@ -197,7 +197,8 @@ static void readSectorsUsed(PedDisk* pedDisk, const Device& d, Partition& p, con
|
|||
if (mountPoint != QString()) {
|
||||
const KDiskFreeSpaceInfo freeSpaceInfo = KDiskFreeSpaceInfo::freeSpaceInfo(mountPoint);
|
||||
|
||||
if (p.isMounted() && freeSpaceInfo.isValid() && mountPoint != QString())
|
||||
// KDiskFreeSpaceInfo does not work with swap
|
||||
if (p.isMounted() && freeSpaceInfo.isValid() && mountPoint != QString() && p.fileSystem().type() != FileSystem::LinuxSwap)
|
||||
p.fileSystem().setSectorsUsed(freeSpaceInfo.used() / d.logicalSize());
|
||||
else if (p.fileSystem().supportGetUsed() == FileSystem::cmdSupportFileSystem)
|
||||
p.fileSystem().setSectorsUsed(p.fileSystem().readUsedCapacity(p.deviceNode()) / d.logicalSize());
|
||||
|
|
Loading…
Reference in New Issue