diff --git a/src/bin/utils/predict_usage.rs b/src/bin/utils/predict_usage.rs index 8785c177ca..a7757fa4b5 100644 --- a/src/bin/utils/predict_usage.rs +++ b/src/bin/utils/predict_usage.rs @@ -13,9 +13,7 @@ use serde_json::{json, Value}; use devicemapper::{Bytes, Sectors}; -use stratisd::engine::{ - crypt_metadata_size, integrity_meta_space, raid_meta_space, ThinPoolSizeParams, BDA, -}; +use stratisd::engine::{crypt_metadata_size, integrity_meta_space, ThinPoolSizeParams, BDA}; // 2^FS_SIZE_START_POWER is the logical size of the smallest Stratis // filesystem for which usage data exists in FSSizeLookup::internal, i.e., @@ -164,7 +162,6 @@ pub fn predict_filesystem_usage( } fn predict_pool_metadata_usage(device_sizes: Vec) -> Result> { - let raid_metadata_alloc = raid_meta_space(); let stratis_metadata_alloc = BDA::default().extended_size().sectors(); let stratis_avail_sizes = device_sizes .iter() @@ -178,9 +175,7 @@ fn predict_pool_metadata_usage(device_sizes: Vec) -> Result for StratBlockDev { uuid: self.uuid(), user_info: self.user_info.clone(), hardware_info: self.hardware_info.clone(), - raid_meta_allocs: Vec::new(), integrity_meta_allocs: Vec::new(), } } diff --git a/src/engine/strat_engine/backstore/blockdev/v2.rs b/src/engine/strat_engine/backstore/blockdev/v2.rs index 70ca42119f..985c110fe6 100644 --- a/src/engine/strat_engine/backstore/blockdev/v2.rs +++ b/src/engine/strat_engine/backstore/blockdev/v2.rs @@ -53,14 +53,6 @@ pub fn integrity_meta_space(total_space: Sectors) -> Sectors { + Bytes::from((*total_space * 32u64 + 4095) & !4095).sectors() } -/// Return the amount of space required for RAID for a device of the given size. -/// -/// This is a slight overestimation for the sake of simplicity. The maximum metadata size is used -/// to leave adequate room for any sized device's metadata. -pub fn raid_meta_space() -> Sectors { - Bytes::from(129 * IEC::Mi).sectors() -} - #[derive(Debug)] pub struct StratBlockDev { dev: Device, @@ -71,7 +63,6 @@ pub struct StratBlockDev { devnode: DevicePath, new_size: Option, blksizes: StratSectorSizes, - raid_meta_allocs: Vec<(Sectors, Sectors)>, integrity_meta_allocs: Vec<(Sectors, Sectors)>, } @@ -103,7 +94,6 @@ impl StratBlockDev { dev: Device, bda: BDA, other_segments: &[(Sectors, Sectors)], - raid_meta_allocs: &[(Sectors, Sectors)], integrity_meta_allocs: &[(Sectors, Sectors)], user_info: Option, hardware_info: Option, @@ -111,7 +101,6 @@ impl StratBlockDev { ) -> BDAResult { let mut segments = vec![(Sectors(0), bda.extended_size().sectors())]; segments.extend(other_segments); - segments.extend(raid_meta_allocs); segments.extend(integrity_meta_allocs); let allocator = match RangeAllocator::new(bda.dev_size(), &segments) { @@ -143,7 +132,6 @@ impl StratBlockDev { devnode, new_size: None, blksizes, - raid_meta_allocs: raid_meta_allocs.to_owned(), integrity_meta_allocs: integrity_meta_allocs.to_owned(), }) } @@ -190,14 +178,6 @@ impl StratBlockDev { Ok(blkdev_size(&File::open(physical_path)?)?.sectors()) } - /// Allocate room for RAID metadata from the back of the device. - pub fn alloc_raid_meta(&mut self, size: Sectors) { - let segs = self.used.alloc_front(size); - for (start, len) in segs.iter() { - self.raid_meta_allocs.push((*start, *len)); - } - } - /// Allocate room for integrity metadata from the back of the device. pub fn alloc_int_meta_back(&mut self, size: Sectors) { let segs = self.used.alloc_back(size); @@ -264,7 +244,6 @@ impl InternalBlockDev for StratBlockDev { fn metadata_size(&self) -> Sectors { self.bda.extended_size().sectors() + self.integrity_meta_allocs.iter().map(|(_, len)| *len).sum() - + self.raid_meta_allocs.iter().map(|(_, len)| *len).sum() } fn max_stratis_metadata_size(&self) -> MDADataSize { @@ -432,7 +411,6 @@ impl Recordable for StratBlockDev { uuid: self.uuid(), user_info: self.user_info.clone(), hardware_info: self.hardware_info.clone(), - raid_meta_allocs: self.raid_meta_allocs.clone(), integrity_meta_allocs: self.integrity_meta_allocs.clone(), } } diff --git a/src/engine/strat_engine/backstore/data_tier.rs b/src/engine/strat_engine/backstore/data_tier.rs index 2fb17c414f..04fd6fc9b5 100644 --- a/src/engine/strat_engine/backstore/data_tier.rs +++ b/src/engine/strat_engine/backstore/data_tier.rs @@ -15,7 +15,7 @@ use crate::{ backstore::{ blockdev::{ v1, - v2::{self, integrity_meta_space, raid_meta_space}, + v2::{self, integrity_meta_space}, InternalBlockDev, }, blockdevmgr::BlockDevMgr, @@ -107,7 +107,6 @@ impl DataTier { /// WARNING: metadata changing event pub fn new(mut block_mgr: BlockDevMgr) -> DataTier { for (_, bd) in block_mgr.blockdevs_mut() { - bd.alloc_raid_meta(raid_meta_space()); // NOTE: over-allocates integrity metadata slightly. Some of the // total size of the device will not make use of the integrity // metadata. @@ -142,7 +141,6 @@ impl DataTier { .collect::>(); assert_eq!(bds.len(), uuids.len()); for bd in bds { - 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 diff --git a/src/engine/strat_engine/backstore/devices.rs b/src/engine/strat_engine/backstore/devices.rs index 5d9aad2b49..d8ff0a8837 100644 --- a/src/engine/strat_engine/backstore/devices.rs +++ b/src/engine/strat_engine/backstore/devices.rs @@ -837,7 +837,7 @@ pub fn initialize_devices( bda.initialize(&mut f)?; - v2::StratBlockDev::new(devno, bda, &[], &[], &[], None, hw_id, devnode).map_err(|(e, _)| e) + v2::StratBlockDev::new(devno, bda, &[], &[], None, hw_id, devnode).map_err(|(e, _)| e) } /// Clean up an unencrypted device after initialization failure. diff --git a/src/engine/strat_engine/backstore/mod.rs b/src/engine/strat_engine/backstore/mod.rs index 32a84fe5c7..58add8867b 100644 --- a/src/engine/strat_engine/backstore/mod.rs +++ b/src/engine/strat_engine/backstore/mod.rs @@ -13,7 +13,7 @@ mod range_alloc; mod shared; pub use self::{ - blockdev::v2::{integrity_meta_space, raid_meta_space}, + blockdev::v2::integrity_meta_space, devices::{find_stratis_devs_by_uuid, get_devno_from_path, ProcessedPathInfos, UnownedDevices}, }; diff --git a/src/engine/strat_engine/liminal/setup.rs b/src/engine/strat_engine/liminal/setup.rs index ff5360168a..ac743912ea 100644 --- a/src/engine/strat_engine/liminal/setup.rs +++ b/src/engine/strat_engine/liminal/setup.rs @@ -547,7 +547,6 @@ fn get_blockdev( // conclusion is metadata corruption. let segments = segment_table.get(&dev_uuid); let meta = data_map.get(&dev_uuid); - let raid = meta.map(|base| &base.1.raid_meta_allocs); let integrity = meta.map(|base| &base.1.integrity_meta_allocs); assert_eq!(info.luks, None); @@ -557,7 +556,6 @@ fn get_blockdev( info.dev_info.device_number, bda, segments.unwrap_or(&vec![]), - raid.unwrap_or(&vec![]), integrity.unwrap_or(&vec![]), bd_save.user_info.clone(), bd_save.hardware_info.clone(), diff --git a/src/engine/strat_engine/mod.rs b/src/engine/strat_engine/mod.rs index 89e68ee352..f9520dd0a6 100644 --- a/src/engine/strat_engine/mod.rs +++ b/src/engine/strat_engine/mod.rs @@ -26,7 +26,7 @@ mod writing; pub use self::{backstore::ProcessedPathInfos, pool::v1::StratPool}; pub use self::{ - backstore::{integrity_meta_space, raid_meta_space}, + backstore::integrity_meta_space, crypt::{ crypt_metadata_size, register_clevis_token, set_up_crypt_logging, CLEVIS_TANG_TRUST_URL, }, diff --git a/src/engine/strat_engine/serde_structs.rs b/src/engine/strat_engine/serde_structs.rs index 794893cf84..aacdb5fa0a 100644 --- a/src/engine/strat_engine/serde_structs.rs +++ b/src/engine/strat_engine/serde_structs.rs @@ -137,9 +137,6 @@ pub struct BaseBlockDevSave { pub uuid: DevUuid, #[serde(skip_serializing_if = "Vec::is_empty")] #[serde(default)] - pub raid_meta_allocs: Vec<(Sectors, Sectors)>, - #[serde(skip_serializing_if = "Vec::is_empty")] - #[serde(default)] pub integrity_meta_allocs: Vec<(Sectors, Sectors)>, #[serde(skip_serializing_if = "Option::is_none")] #[serde(serialize_with = "serialize_option_string")]