Skip to content

Commit 4f81cc9

Browse files
committed
Eliminate pre-check for not enough space on do_extend
alloc() return None if there is not enough space to satisfy the request. Signed-off-by: mulhern <[email protected]>
1 parent ee90610 commit 4f81cc9

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

src/engine/strat_engine/thinpool/thinpool.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1761,16 +1761,7 @@ where
17611761
}
17621762
}
17631763

1764-
if 2u64 * meta_growth > backstore.available_in_backstore() {
1765-
self.out_of_meta_space = true;
1766-
(
1767-
self.set_error_mode(),
1768-
Err(StratisError::Msg(
1769-
"Not enough unallocated space available on the pool to extend metadata device"
1770-
.to_string(),
1771-
)),
1772-
)
1773-
} else if meta_growth > Sectors(0) {
1764+
if meta_growth > Sectors(0) {
17741765
let ext = do_extend(
17751766
&mut self.thin_pool,
17761767
backstore,
@@ -1781,8 +1772,17 @@ where
17811772
);
17821773

17831774
match ext {
1784-
Ok(Sectors(0)) | Err(_) => (false, ext),
1775+
Ok(Sectors(0)) => {
1776+
self.out_of_meta_space = true;
1777+
(
1778+
self.set_error_mode(),
1779+
Err(StratisError::Msg(
1780+
"Not enough unallocated space available on the pool to extend metadata device".to_string(),
1781+
)),
1782+
)
1783+
}
17851784
Ok(_) => (true, ext),
1785+
Err(_) => (false, ext),
17861786
}
17871787
} else {
17881788
(false, Ok(Sectors(0)))

0 commit comments

Comments
 (0)