Skip to content

Commit 9cc1fbe

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 11e561d commit 9cc1fbe

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
@@ -1759,16 +1759,7 @@ where
17591759
}
17601760
}
17611761

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

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

0 commit comments

Comments
 (0)