From 27d151a771a708d3dba0c3d6e4083f32e533c659 Mon Sep 17 00:00:00 2001 From: mulhern Date: Wed, 18 Dec 2024 20:54:10 -0500 Subject: [PATCH] tag size to tag spec Signed-off-by: mulhern --- src/bin/utils/predict_usage.rs | 8 ++++---- src/dbus_api/api/manager_3_8/methods.rs | 6 +++--- src/engine/engine.rs | 2 +- src/engine/strat_engine/backstore/blockdev/v2.rs | 4 ++-- src/engine/strat_engine/backstore/data_tier.rs | 2 +- src/engine/strat_engine/engine.rs | 4 ++-- src/engine/strat_engine/pool/v2.rs | 4 ++-- 7 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/bin/utils/predict_usage.rs b/src/bin/utils/predict_usage.rs index 81cfa9645e..3caa5205b7 100644 --- a/src/bin/utils/predict_usage.rs +++ b/src/bin/utils/predict_usage.rs @@ -167,7 +167,7 @@ pub fn predict_filesystem_usage( fn predict_pool_metadata_usage( device_sizes: Vec, journal_size: Sectors, - tag_size: IntegrityTagSpec, + tag_spec: IntegrityTagSpec, ) -> Result> { let stratis_metadata_alloc = BDA::default().extended_size().sectors(); let stratis_avail_sizes = device_sizes @@ -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 @@ -214,7 +214,7 @@ pub fn predict_pool_usage( device_sizes: Vec, filesystem_sizes: Option>, journal_size: Sectors, - tag_size: IntegrityTagSpec, + tag_spec: IntegrityTagSpec, log_level: LevelFilter, ) -> Result<(), Box> { Builder::new().filter(None, log_level).init(); @@ -226,7 +226,7 @@ pub fn predict_pool_usage( let device_sizes = device_sizes.iter().map(|s| s.sectors()).collect::>(); 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(); diff --git a/src/dbus_api/api/manager_3_8/methods.rs b/src/dbus_api/api/manager_3_8/methods.rs index ec1e17c9cb..2d3411862d 100644 --- a/src/dbus_api/api/manager_3_8/methods.rs +++ b/src/dbus_api/api/manager_3_8/methods.rs @@ -158,7 +158,7 @@ pub fn create_pool(m: &MethodInfo<'_, MTSync, 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(); @@ -188,7 +188,7 @@ pub fn create_pool(m: &MethodInfo<'_, MTSync, 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() { @@ -207,7 +207,7 @@ pub fn create_pool(m: &MethodInfo<'_, MTSync, TData>) -> MethodResult { &devs.map(Path::new).collect::>(), 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 { diff --git a/src/engine/engine.rs b/src/engine/engine.rs index 8ffdfe51cf..5b08d62417 100644 --- a/src/engine/engine.rs +++ b/src/engine/engine.rs @@ -383,7 +383,7 @@ pub trait Engine: Debug + Report + Send + Sync { blockdev_paths: &[&Path], encryption_info: Option<&EncryptionInfo>, journal_size: Option, - tag_size: Option, + tag_spec: Option, ) -> StratisResult>; /// Handle a libudev event. diff --git a/src/engine/strat_engine/backstore/blockdev/v2.rs b/src/engine/strat_engine/backstore/blockdev/v2.rs index 56fa474f2d..d21b02863e 100644 --- a/src/engine/strat_engine/backstore/blockdev/v2.rs +++ b/src/engine/strat_engine/backstore/blockdev/v2.rs @@ -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() } diff --git a/src/engine/strat_engine/backstore/data_tier.rs b/src/engine/strat_engine/backstore/data_tier.rs index a66f35fc44..7a46e0a363 100644 --- a/src/engine/strat_engine/backstore/data_tier.rs +++ b/src/engine/strat_engine/backstore/data_tier.rs @@ -47,7 +47,7 @@ pub struct DataTier { integrity_journal_size: Option, /// Integrity block size. integrity_block_size: Option, - /// Integrity tag size. + /// Integrity tag spec. integrity_tag_spec: Option, } diff --git a/src/engine/strat_engine/engine.rs b/src/engine/strat_engine/engine.rs index fc7961a9ab..b626281994 100644 --- a/src/engine/strat_engine/engine.rs +++ b/src/engine/strat_engine/engine.rs @@ -496,7 +496,7 @@ impl Engine for StratEngine { blockdev_paths: &[&Path], encryption_info: Option<&EncryptionInfo>, journal_size: Option, - tag_size: Option, + tag_spec: Option, ) -> StratisResult> { validate_name(name)?; let name = Name::new(name.to_owned()); @@ -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)); diff --git a/src/engine/strat_engine/pool/v2.rs b/src/engine/strat_engine/pool/v2.rs index b6d306a1b1..1034840c98 100644 --- a/src/engine/strat_engine/pool/v2.rs +++ b/src/engine/strat_engine/pool/v2.rs @@ -154,7 +154,7 @@ impl StratPool { devices: UnownedDevices, encryption_info: Option<&EncryptionInfo>, journal_size: Option, - tag_size: Option, + tag_spec: Option, ) -> StratisResult<(PoolUuid, StratPool)> { let pool_uuid = PoolUuid::new_v4(); @@ -167,7 +167,7 @@ impl StratPool { MDADataSize::default(), encryption_info, journal_size, - tag_size, + tag_spec, )?; let thinpool = ThinPool::::new(