From c8a1324fb5c85656332e548511d7575ce4a5a858 Mon Sep 17 00:00:00 2001 From: John Baublitz Date: Fri, 1 Sep 2023 11:18:02 -0400 Subject: [PATCH] Add ability to set filesystem size limit --- src/engine/strat_engine/thinpool/filesystem.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/engine/strat_engine/thinpool/filesystem.rs b/src/engine/strat_engine/thinpool/filesystem.rs index 2687167242b..2267c6f6b47 100644 --- a/src/engine/strat_engine/thinpool/filesystem.rs +++ b/src/engine/strat_engine/thinpool/filesystem.rs @@ -390,6 +390,20 @@ impl StratFilesystem { Ok(ret_vec) } + pub fn set_size_limit(&mut self, limit: Option) -> 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 { self.size_limit }