Skip to content

Commit

Permalink
Strengthen the backstore invariant
Browse files Browse the repository at this point in the history
Use the newly revised datatier_allocated_size() method in place of an
expression.

Add a new equality, that depends for correctness on the previous commit.

Signed-off-by: mulhern <[email protected]>
  • Loading branch information
mulkieran committed Aug 28, 2024
1 parent d1bee2d commit 9435cc3
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/engine/strat_engine/backstore/backstore/v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1217,13 +1217,10 @@ mod tests {
_ => panic!("impossible; see first assertion"),
}
);
assert!(
backstore
.allocs
.iter()
.map(|(_, len)| *len)
.sum::<Sectors>()
<= backstore.size()
assert!(backstore.datatier_allocated_size() <= backstore.size());
assert_eq!(
backstore.datatier_allocated_size() + backstore.datatier_crypt_meta_size(),
backstore.data_tier.allocated()
);

backstore.data_tier.invariant();
Expand Down

0 comments on commit 9435cc3

Please sign in to comment.