Skip to content

Commit

Permalink
Add ability to set filesystem size limit
Browse files Browse the repository at this point in the history
  • Loading branch information
jbaublitz committed Sep 29, 2023
1 parent 2092263 commit c8a1324
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/engine/strat_engine/thinpool/filesystem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,20 @@ impl StratFilesystem {
Ok(ret_vec)
}

pub fn set_size_limit(&mut self, limit: Option<Sectors>) -> StratisResult<()> {
match limit {
Some(lim) if self.thindev_size() > lim => Err(StratisError::Msg(format!(
"Limit requested of {} is smaller than current filesystem size of {}",
lim,
self.thindev_size()
))),
Some(_) | None => {
self.size_limit = limit;
Ok(())
}
}
}

pub fn size_limit(&self) -> Option<Sectors> {
self.size_limit
}
Expand Down

0 comments on commit c8a1324

Please sign in to comment.