Fixed small inaccuracy in calculation of free space in statvfs

This commit is contained in:
Sebastian Messmer 2022-12-25 19:14:21 +01:00
parent 6795d2bc6f
commit f5b50f348c
3 changed files with 5 additions and 3 deletions

View File

@ -2,6 +2,7 @@ Version 0.12.0 (unreleased)
---------------
* Updated to DokanY 1.3.0.1000
* Added a man page for `cryfs-unmount`
* Fixed small inaccuracy in calculation of free space in statvfs
Version 0.11.3
---------------

View File

@ -23,7 +23,7 @@ namespace onblocks {
namespace datanodestore {
DataNodeStore::DataNodeStore(unique_ref<BlockStore> blockstore, uint64_t physicalBlocksizeBytes)
: _blockstore(std::move(blockstore)), _layout(_blockstore->blockSizeFromPhysicalBlockSize(physicalBlocksizeBytes)) {
: _blockstore(std::move(blockstore)), _layout(_blockstore->blockSizeFromPhysicalBlockSize(physicalBlocksizeBytes)), _physicalBlockSizeBytes(physicalBlockSizeBytes) {
}
DataNodeStore::~DataNodeStore() {
@ -127,11 +127,11 @@ uint64_t DataNodeStore::numNodes() const {
}
uint64_t DataNodeStore::estimateSpaceForNumNodesLeft() const {
return _blockstore->estimateNumFreeBytes() / _layout.blocksizeBytes();
return _blockstore->estimateNumFreeBytes() / _physicalBlockSizeBytes;
}
uint64_t DataNodeStore::virtualBlocksizeBytes() const {
return _layout.blocksizeBytes();
return _layout.maxBytesPerLeaf();
}
DataNodeLayout DataNodeStore::layout() const {

View File

@ -57,6 +57,7 @@ private:
cpputils::unique_ref<blockstore::BlockStore> _blockstore;
const DataNodeLayout _layout;
uint64_t _physicalBlockSizeBytes;
DISALLOW_COPY_AND_ASSIGN(DataNodeStore);
};