From 9c7db501bf6f2d7dfa90fbfb9ec5de20e8dc85e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrius=20=C5=A0tikonas?= Date: Sat, 24 Sep 2016 21:09:11 +0100 Subject: [PATCH] Use cached values for resizing volume groups. --- src/core/device.h | 4 ++++ src/ops/resizevolumegroupoperation.cpp | 5 +++-- src/util/externalcommand.cpp | 2 -- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/core/device.h b/src/core/device.h index 08990cb..3fdf0ac 100644 --- a/src/core/device.h +++ b/src/core/device.h @@ -64,6 +64,10 @@ public: virtual bool operator==(const Device& other) const; virtual bool operator!=(const Device& other) const; + virtual QString& name() { + return m_Name; /**< @return the Device's name, usually some manufacturer string */ + } + virtual const QString& name() const { return m_Name; /**< @return the Device's name, usually some manufacturer string */ } diff --git a/src/ops/resizevolumegroupoperation.cpp b/src/ops/resizevolumegroupoperation.cpp index c9e95c1..bac5b77 100644 --- a/src/ops/resizevolumegroupoperation.cpp +++ b/src/ops/resizevolumegroupoperation.cpp @@ -78,8 +78,9 @@ ResizeVolumeGroupOperation::ResizeVolumeGroupOperation(LvmDevice& d, const QList movePE += lvm2PVFs->allocatedPE(); } qint64 growPE = 0; - for (const auto &p : toInsertList) // FIXME: qAsConst - growPE += p->capacity() / LvmDevice::getPeSize(d.name()); + for (const auto &p : toInsertList) { // FIXME: qAsConst + growPE += p->capacity() / device().peSize(); + } if ( movePE > (freePE + growPE)) { // *ABORT* can't move diff --git a/src/util/externalcommand.cpp b/src/util/externalcommand.cpp index 5bfe9f9..dfd80e9 100644 --- a/src/util/externalcommand.cpp +++ b/src/util/externalcommand.cpp @@ -20,8 +20,6 @@ #include "util/report.h" -#include - #include #include