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);
|
mountPoint = FileSystem::detectMountPoint(fs, lvPath);
|
||||||
mounted = FileSystem::detectMountStatus(fs, lvPath);
|
mounted = FileSystem::detectMountStatus(fs, lvPath);
|
||||||
|
|
||||||
const KDiskFreeSpaceInfo freeSpaceInfo = KDiskFreeSpaceInfo::freeSpaceInfo(mountPoint);
|
if (mountPoint != QString()) {
|
||||||
if (logicalSize() > 0 && fs->type() != FileSystem::Luks) {
|
const KDiskFreeSpaceInfo freeSpaceInfo = KDiskFreeSpaceInfo::freeSpaceInfo(mountPoint);
|
||||||
if (mounted && freeSpaceInfo.isValid() && mountPoint != QString()) {
|
if (logicalSize() > 0 && fs->type() != FileSystem::Luks)
|
||||||
fs->setSectorsUsed(freeSpaceInfo.used() / logicalSize());
|
if (mounted && freeSpaceInfo.isValid() && mountPoint != QString())
|
||||||
} else if (fs->supportGetUsed() == FileSystem::cmdSupportFileSystem) {
|
fs->setSectorsUsed(freeSpaceInfo.used() / logicalSize());
|
||||||
fs->setSectorsUsed(qCeil(fs->readUsedCapacity(lvPath) / static_cast<float>(logicalSize())));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
else if (fs->supportGetUsed() == FileSystem::cmdSupportFileSystem)
|
||||||
|
fs->setSectorsUsed(qCeil(fs->readUsedCapacity(lvPath) / static_cast<float>(logicalSize())));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fs->supportGetLabel() != FileSystem::cmdSupportNone) {
|
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)
|
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())
|
if (p.isMounted() && freeSpaceInfo.isValid() && mountPoint != QString())
|
||||||
p.fileSystem().setSectorsUsed(freeSpaceInfo.used() / d.logicalSize());
|
p.fileSystem().setSectorsUsed(freeSpaceInfo.used() / d.logicalSize());
|
||||||
else if (p.fileSystem().supportGetUsed() == FileSystem::cmdSupportFileSystem)
|
else if (p.fileSystem().supportGetUsed() == FileSystem::cmdSupportFileSystem)
|
||||||
p.fileSystem().setSectorsUsed(p.fileSystem().readUsedCapacity(p.deviceNode()) / d.logicalSize());
|
p.fileSystem().setSectorsUsed(p.fileSystem().readUsedCapacity(p.deviceNode()) / d.logicalSize());
|
||||||
|
}
|
||||||
#if defined LIBPARTED_FS_RESIZE_LIBRARY_SUPPORT
|
#if defined LIBPARTED_FS_RESIZE_LIBRARY_SUPPORT
|
||||||
else if (p.fileSystem().supportGetUsed() == FileSystem::cmdSupportCore)
|
else if (p.fileSystem().supportGetUsed() == FileSystem::cmdSupportCore)
|
||||||
p.fileSystem().setSectorsUsed(readSectorsUsedLibParted(pedDisk, p));
|
p.fileSystem().setSectorsUsed(readSectorsUsedLibParted(pedDisk, p));
|
||||||
|
|
Loading…
Reference in New Issue