Device: Consider VSA when calculating logical disk size

When the underlying disk driver has VSA access the total size must be
calculated with respect to the VSA offset.
pull/56/head
Kyle Schwarz 2022-12-19 01:09:01 -05:00
parent f4e4a103ad
commit 41a569fc2d
2 changed files with 7 additions and 1 deletions

View File

@ -642,7 +642,12 @@ std::optional<uint64_t> Device::getLogicalDiskSize() {
return std::nullopt;
}
return info->getReportedSize();
const auto reportedSize = info->getReportedSize();
if (diskReadDriver->getAccess() == Disk::Access::VSA)
return reportedSize - diskReadDriver->getVSAOffset();
return reportedSize;
}
std::optional<uint64_t> Device::getVSAOffsetInLogicalDisk() {

View File

@ -33,6 +33,7 @@ public:
virtual std::pair<uint32_t, uint32_t> getBlockSizeBounds() const = 0;
void setVSAOffset(uint64_t offset) { vsaOffset = offset; }
uint64_t getVSAOffset() const { return vsaOffset; }
protected:
uint64_t vsaOffset = 0;