diff --git a/src/fs/luks.cpp b/src/fs/luks.cpp index e1ec4b5..9a72c12 100644 --- a/src/fs/luks.cpp +++ b/src/fs/luks.cpp @@ -32,6 +32,7 @@ #include #include +#include #include #include @@ -374,6 +375,11 @@ bool luks::mount(Report& report, const QString& deviceNode, const QString& mount if (m_innerFs->mount(report, mapperNode, mountPoint)) { m_isMounted = true; + + const KDiskFreeSpaceInfo freeSpaceInfo = KDiskFreeSpaceInfo::freeSpaceInfo(mountPoint); + if (freeSpaceInfo.isValid() && mountPoint != QString()) + setSectorsUsed(freeSpaceInfo.used() / m_logicalSectorSize + getPayloadOffset(deviceNode)); + return true; } } diff --git a/src/plugins/libparted/libpartedbackend.cpp b/src/plugins/libparted/libpartedbackend.cpp index 76b870d..c277d52 100644 --- a/src/plugins/libparted/libpartedbackend.cpp +++ b/src/plugins/libparted/libpartedbackend.cpp @@ -46,8 +46,8 @@ #include #include -#include -#include +#include +#include #include #include @@ -373,10 +373,7 @@ void LibPartedBackend::scanDevicePartitions(Device& d, PedDisk* pedDisk) mountPoints.findByDevice(mapperNode)->mountPoint() : QString(); // We cannot use libparted to check the mounted status because - // we don't have a PedPartition for the mapper device, so we use - // check_mount_point from util-linux instead, defined in the - // private header ismounted.h and copied into KPMcore & wrapped - // in helpers.h for convenience. + // we don't have a PedPartition for the mapper device, so we use lsblk mounted = isMounted(mapperNode); } else { mounted = false; @@ -392,7 +389,8 @@ void LibPartedBackend::scanDevicePartitions(Device& d, PedDisk* pedDisk) Partition* part = new Partition(parent, d, PartitionRole(r), fs, pedPartition->geom.start, pedPartition->geom.end, node, availableFlags(pedPartition), mountPoint, mounted, activeFlags(pedPartition)); - readSectorsUsed(pedDisk, d, *part, mountPoint); + if (!part->roles().has(PartitionRole::Luks)) + readSectorsUsed(pedDisk, d, *part, mountPoint); if (fs->supportGetLabel() != FileSystem::cmdSupportNone) fs->setLabel(fs->readLabel(part->deviceNode()));