Skip to content

Commit

Permalink
Use total size when calculating integrity metadata
Browse files Browse the repository at this point in the history
This will allot slightly more bytes than actually necessary for the
integrity checksums, but it keeps all the calculations simple.

Signed-off-by: mulhern <[email protected]>
  • Loading branch information
mulkieran committed Aug 16, 2024
1 parent a5cdc20 commit 3d433ab
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/engine/strat_engine/backstore/data_tier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,10 @@ impl DataTier<v2::StratBlockDev> {
pub fn new(mut block_mgr: BlockDevMgr<v2::StratBlockDev>) -> DataTier<v2::StratBlockDev> {
for (_, bd) in block_mgr.blockdevs_mut() {
bd.alloc_raid_meta(raid_meta_space());
bd.alloc_int_meta_back(integrity_meta_space(
// NOTE: Subtracting metadata size works here because the only metadata currently
// recorded in a newly created block device is the BDA. If this becomes untrue in
// the future, this code will no longer work.
bd.total_size().sectors() - bd.metadata_size(),
));
// NOTE: over-allocates integrity metadata slightly. Some of the
// total size of the device will not make use of the integrity
// metadata.
bd.alloc_int_meta_back(integrity_meta_space(bd.total_size().sectors()));
}
DataTier {
block_mgr,
Expand Down

0 comments on commit 3d433ab

Please sign in to comment.