Do not call KDiskFreeSpaceInfo::freeSpaceInfo without a non-empty mount point.
This commit is contained in:
parent
eb0c32e9dc
commit
e3214a1b48
|
@ -139,14 +139,14 @@ Partition* LvmDevice::scanPartition(const QString& lvPath, PartitionTable* pTabl
|
|||
mountPoint = FileSystem::detectMountPoint(fs, lvPath);
|
||||
mounted = FileSystem::detectMountStatus(fs, lvPath);
|
||||
|
||||
const KDiskFreeSpaceInfo freeSpaceInfo = KDiskFreeSpaceInfo::freeSpaceInfo(mountPoint);
|
||||
if (logicalSize() > 0 && fs->type() != FileSystem::Luks) {
|
||||
if (mounted && freeSpaceInfo.isValid() && mountPoint != QString()) {
|
||||
fs->setSectorsUsed(freeSpaceInfo.used() / logicalSize());
|
||||
} else if (fs->supportGetUsed() == FileSystem::cmdSupportFileSystem) {
|
||||
fs->setSectorsUsed(qCeil(fs->readUsedCapacity(lvPath) / static_cast<float>(logicalSize())));
|
||||
}
|
||||
if (mountPoint != QString()) {
|
||||
const KDiskFreeSpaceInfo freeSpaceInfo = KDiskFreeSpaceInfo::freeSpaceInfo(mountPoint);
|
||||
if (logicalSize() > 0 && fs->type() != FileSystem::Luks)
|
||||
if (mounted && freeSpaceInfo.isValid() && mountPoint != QString())
|
||||
fs->setSectorsUsed(freeSpaceInfo.used() / logicalSize());
|
||||
}
|
||||
else if (fs->supportGetUsed() == FileSystem::cmdSupportFileSystem)
|
||||
fs->setSectorsUsed(qCeil(fs->readUsedCapacity(lvPath) / static_cast<float>(logicalSize())));
|
||||
}
|
||||
|
||||
if (fs->supportGetLabel() != FileSystem::cmdSupportNone) {
|
||||
|
|
|
@ -194,12 +194,14 @@ static qint64 readSectorsUsedLibParted(PedDisk* pedDisk, const Partition& p)
|
|||
*/
|
||||
static void readSectorsUsed(PedDisk* pedDisk, const Device& d, Partition& p, const QString& mountPoint)
|
||||
{
|
||||
const KDiskFreeSpaceInfo freeSpaceInfo = KDiskFreeSpaceInfo::freeSpaceInfo(mountPoint);
|
||||
if (mountPoint != QString()) {
|
||||
const KDiskFreeSpaceInfo freeSpaceInfo = KDiskFreeSpaceInfo::freeSpaceInfo(mountPoint);
|
||||
|
||||
if (p.isMounted() && freeSpaceInfo.isValid() && mountPoint != QString())
|
||||
p.fileSystem().setSectorsUsed(freeSpaceInfo.used() / d.logicalSize());
|
||||
else if (p.fileSystem().supportGetUsed() == FileSystem::cmdSupportFileSystem)
|
||||
p.fileSystem().setSectorsUsed(p.fileSystem().readUsedCapacity(p.deviceNode()) / d.logicalSize());
|
||||
if (p.isMounted() && freeSpaceInfo.isValid() && mountPoint != QString())
|
||||
p.fileSystem().setSectorsUsed(freeSpaceInfo.used() / d.logicalSize());
|
||||
else if (p.fileSystem().supportGetUsed() == FileSystem::cmdSupportFileSystem)
|
||||
p.fileSystem().setSectorsUsed(p.fileSystem().readUsedCapacity(p.deviceNode()) / d.logicalSize());
|
||||
}
|
||||
#if defined LIBPARTED_FS_RESIZE_LIBRARY_SUPPORT
|
||||
else if (p.fileSystem().supportGetUsed() == FileSystem::cmdSupportCore)
|
||||
p.fileSystem().setSectorsUsed(readSectorsUsedLibParted(pedDisk, p));
|
||||
|
|
Loading…
Reference in New Issue