aboutsummaryrefslogtreecommitdiff
path: root/src/block/repair.rs
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2023-09-05 13:43:38 +0200
committerAlex Auvolat <alex@adnab.me>2023-09-06 16:35:28 +0200
commit6c420c0880de742b2b6416da1178df828fd977bf (patch)
tree8fb89048e9d81376dedb22a81d741ea014689bfa /src/block/repair.rs
parent71c0188055e25aa1c00d0226f0ca99ce323310a6 (diff)
downloadgarage-6c420c0880de742b2b6416da1178df828fd977bf.tar.gz
garage-6c420c0880de742b2b6416da1178df828fd977bf.zip
block manager: multi-directory layout computation
Diffstat (limited to 'src/block/repair.rs')
-rw-r--r--src/block/repair.rs10
1 files changed, 2 insertions, 8 deletions
diff --git a/src/block/repair.rs b/src/block/repair.rs
index d5e2e168..0e7fe0df 100644
--- a/src/block/repair.rs
+++ b/src/block/repair.rs
@@ -473,10 +473,7 @@ impl BlockStoreIterator {
.data_layout
.data_dirs
.iter()
- .filter_map(|x| match x.state {
- DataDirState::Active { capacity } => Some(capacity),
- _ => None,
- })
+ .filter_map(|x| x.capacity())
.min()
.unwrap_or(0);
@@ -484,10 +481,7 @@ impl BlockStoreIterator {
.data_layout
.data_dirs
.iter()
- .map(|x| match x.state {
- DataDirState::Active { capacity } => capacity,
- _ => min_cap, // approximation
- })
+ .map(|x| x.capacity().unwrap_or(min_cap /* approximation */))
.sum::<u64>() as u128;
let mut cum_cap = 0;