Skip to content

Commit

Permalink
tag size to tag spec
Browse files Browse the repository at this point in the history
Signed-off-by: mulhern <[email protected]>
  • Loading branch information
mulkieran committed Dec 20, 2024
1 parent 36b2b66 commit e3c98b3
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 15 deletions.
8 changes: 4 additions & 4 deletions src/bin/utils/predict_usage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ pub fn predict_filesystem_usage(
fn predict_pool_metadata_usage(
device_sizes: Vec<Sectors>,
journal_size: Sectors,
tag_size: IntegrityTagSpec,
tag_spec: IntegrityTagSpec,
) -> Result<Sectors, Box<dyn Error>> {
let stratis_metadata_alloc = BDA::default().extended_size().sectors();
let stratis_avail_sizes = device_sizes
Expand All @@ -176,7 +176,7 @@ fn predict_pool_metadata_usage(
info!("Total size of device: {:}", s);

let integrity_deduction =
integrity_meta_space(s, journal_size, DEFAULT_INTEGRITY_BLOCK_SIZE, tag_size);
integrity_meta_space(s, journal_size, DEFAULT_INTEGRITY_BLOCK_SIZE, tag_spec);
info!(
"Deduction for stratis metadata: {:}",
stratis_metadata_alloc
Expand Down Expand Up @@ -214,7 +214,7 @@ pub fn predict_pool_usage(
device_sizes: Vec<Bytes>,
filesystem_sizes: Option<Vec<Bytes>>,
journal_size: Sectors,
tag_size: IntegrityTagSpec,
tag_spec: IntegrityTagSpec,
log_level: LevelFilter,
) -> Result<(), Box<dyn Error>> {
Builder::new().filter(None, log_level).init();
Expand All @@ -226,7 +226,7 @@ pub fn predict_pool_usage(
let device_sizes = device_sizes.iter().map(|s| s.sectors()).collect::<Vec<_>>();
let total_size: Sectors = device_sizes.iter().cloned().sum();

let non_metadata_size = predict_pool_metadata_usage(device_sizes, journal_size, tag_size)?;
let non_metadata_size = predict_pool_metadata_usage(device_sizes, journal_size, tag_spec)?;

let size_params = ThinPoolSizeParams::new(non_metadata_size)?;
let total_non_data = 2usize * size_params.meta_size() + size_params.mdv_size();
Expand Down
6 changes: 3 additions & 3 deletions src/dbus_api/api/manager_3_8/methods.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ pub fn create_pool(m: &MethodInfo<'_, MTSync<TData>, TData>) -> MethodResult {
Some(get_next_arg(&mut iter, 3)?),
);
let journal_size_tuple: (bool, u64) = get_next_arg(&mut iter, 4)?;
let tag_size_tuple: (bool, String) = get_next_arg(&mut iter, 5)?;
let tag_spec_tuple: (bool, String) = get_next_arg(&mut iter, 5)?;

let return_message = message.method_return();

Expand Down Expand Up @@ -188,7 +188,7 @@ pub fn create_pool(m: &MethodInfo<'_, MTSync<TData>, TData>) -> MethodResult {
};

let journal_size = tuple_to_option(journal_size_tuple).map(Bytes::from);
let tag_size = match tuple_to_option(tag_size_tuple)
let tag_spec = match tuple_to_option(tag_spec_tuple)
.map(|s| IntegrityTagSpec::try_from(s.as_str()))
.transpose()
{
Expand All @@ -207,7 +207,7 @@ pub fn create_pool(m: &MethodInfo<'_, MTSync<TData>, TData>) -> MethodResult {
&devs.map(Path::new).collect::<Vec<&Path>>(),
EncryptionInfo::from_options((key_desc, clevis_info)).as_ref(),
journal_size,
tag_size,
tag_spec,
)));
match create_result {
Ok(pool_uuid_action) => match pool_uuid_action {
Expand Down
2 changes: 1 addition & 1 deletion src/engine/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ pub trait Engine: Debug + Report + Send + Sync {
blockdev_paths: &[&Path],
encryption_info: Option<&EncryptionInfo>,
journal_size: Option<Bytes>,
tag_size: Option<IntegrityTagSpec>,
tag_spec: Option<IntegrityTagSpec>,
) -> StratisResult<CreateAction<PoolUuid>>;

/// Handle a libudev event.
Expand Down
4 changes: 2 additions & 2 deletions src/engine/strat_engine/backstore/blockdev/v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@ pub fn integrity_meta_space(
total_space: Sectors,
journal_size: Sectors,
block_size: Bytes,
tag_size: IntegrityTagSpec,
tag_spec: IntegrityTagSpec,
) -> Sectors {
Bytes(4096).sectors()
+ journal_size
+ Bytes::from(
(*((total_space.bytes() / block_size) * tag_size.as_bytes_ceil()) + 4095) & !4095,
(*((total_space.bytes() / block_size) * tag_spec.as_bytes_ceil()) + 4095) & !4095,
)
.sectors()
}
Expand Down
2 changes: 1 addition & 1 deletion src/engine/strat_engine/backstore/data_tier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ pub struct DataTier<B> {
integrity_journal_size: Option<Sectors>,
/// Integrity block size.
integrity_block_size: Option<Bytes>,
/// Integrity tag size.
/// Integrity tag spec.
integrity_tag_spec: Option<IntegrityTagSpec>,
}

Expand Down
4 changes: 2 additions & 2 deletions src/engine/strat_engine/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ impl Engine for StratEngine {
blockdev_paths: &[&Path],
encryption_info: Option<&EncryptionInfo>,
journal_size: Option<Bytes>,
tag_size: Option<IntegrityTagSpec>,
tag_spec: Option<IntegrityTagSpec>,
) -> StratisResult<CreateAction<PoolUuid>> {
validate_name(name)?;
let name = Name::new(name.to_owned());
Expand Down Expand Up @@ -571,7 +571,7 @@ impl Engine for StratEngine {
unowned_devices,
cloned_enc_info.as_ref(),
rounded_journal_size,
tag_size,
tag_spec,
)
})??;
pools.insert(Name::new(name.to_string()), pool_uuid, AnyPool::V2(pool));
Expand Down
4 changes: 2 additions & 2 deletions src/engine/strat_engine/pool/v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ impl StratPool {
devices: UnownedDevices,
encryption_info: Option<&EncryptionInfo>,
journal_size: Option<Sectors>,
tag_size: Option<IntegrityTagSpec>,
tag_spec: Option<IntegrityTagSpec>,
) -> StratisResult<(PoolUuid, StratPool)> {
let pool_uuid = PoolUuid::new_v4();

Expand All @@ -167,7 +167,7 @@ impl StratPool {
MDADataSize::default(),
encryption_info,
journal_size,
tag_size,
tag_spec,
)?;

let thinpool = ThinPool::<Backstore>::new(
Expand Down

0 comments on commit e3c98b3

Please sign in to comment.