Skip to content

Commit

Permalink
Include crypt metadata in total_physical_used
Browse files Browse the repository at this point in the history
Signed-off-by: mulhern <[email protected]>
  • Loading branch information
mulkieran committed Aug 27, 2024
1 parent 2870bd8 commit faaf0f0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/engine/strat_engine/backstore/backstore/v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -888,6 +888,12 @@ impl Backstore {
self.data_tier.metadata_size()
}

/// Return the space used for crypt meta data. This space is rather hybrid,
/// because it is a component of allocated space but it is also metadata.
pub fn datatier_crypt_meta_size(&self) -> CryptMetaSize {
self.crypt_meta_allocs.as_slice().into()
}

/// Write the given data to the data tier's devices.
pub fn save_state(&mut self, metadata: &[u8]) -> StratisResult<()> {
self.data_tier.save_state(metadata)
Expand Down
2 changes: 1 addition & 1 deletion src/engine/strat_engine/pool/v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1031,7 +1031,7 @@ impl Pool for StratPool {
// event of, e.g, VDO, the amount will be far too large to be useful.
self.thin_pool
.total_physical_used()
.map(|u| u + self.metadata_size)
.map(|u| u + self.metadata_size + self.backstore.datatier_crypt_meta_size().sectors())
}

fn filesystems(&self) -> Vec<(Name, FilesystemUuid, &dyn Filesystem)> {
Expand Down

0 comments on commit faaf0f0

Please sign in to comment.