Skip to content

Commit

Permalink
Eliminate pre-check for not enough space on do_extend
Browse files Browse the repository at this point in the history
alloc() return None if there is not enough space to satisfy the request.

Signed-off-by: mulhern <[email protected]>
  • Loading branch information
mulkieran committed Nov 15, 2024
1 parent ee90610 commit 4f81cc9
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions src/engine/strat_engine/thinpool/thinpool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1761,16 +1761,7 @@ where
}
}

if 2u64 * meta_growth > backstore.available_in_backstore() {
self.out_of_meta_space = true;
(
self.set_error_mode(),
Err(StratisError::Msg(
"Not enough unallocated space available on the pool to extend metadata device"
.to_string(),
)),
)
} else if meta_growth > Sectors(0) {
if meta_growth > Sectors(0) {
let ext = do_extend(
&mut self.thin_pool,
backstore,
Expand All @@ -1781,8 +1772,17 @@ where
);

match ext {
Ok(Sectors(0)) | Err(_) => (false, ext),
Ok(Sectors(0)) => {
self.out_of_meta_space = true;
(
self.set_error_mode(),
Err(StratisError::Msg(
"Not enough unallocated space available on the pool to extend metadata device".to_string(),
)),
)
}
Ok(_) => (true, ext),
Err(_) => (false, ext),
}
} else {
(false, Ok(Sectors(0)))
Expand Down

0 comments on commit 4f81cc9

Please sign in to comment.