diff --git a/simulator/runner/file.rs b/simulator/runner/file.rs index 89d50ab6c..c479853a9 100644 --- a/simulator/runner/file.rs +++ b/simulator/runner/file.rs @@ -31,6 +31,8 @@ pub(crate) struct SimulatorFile { pub(crate) rng: RefCell, pub latency_probability: usize, + + pub sync_completion: RefCell>>, } unsafe impl Send for SimulatorFile {} @@ -185,7 +187,9 @@ impl File for SimulatorFile { }; sync_completion.complete = Box::new(new_complete); }; - self.inner.sync(c) + let c = self.inner.sync(c)?; + *self.sync_completion.borrow_mut() = Some(c.clone()); + Ok(c) } fn size(&self) -> Result { diff --git a/simulator/runner/io.rs b/simulator/runner/io.rs index 774ec72a9..30649b3a0 100644 --- a/simulator/runner/io.rs +++ b/simulator/runner/io.rs @@ -85,6 +85,7 @@ impl IO for SimulatorIO { page_size: self.page_size, rng: RefCell::new(ChaCha8Rng::seed_from_u64(self.seed)), latency_probability: self.latency_probability, + sync_completion: RefCell::new(None), }); self.files.borrow_mut().push(file.clone()); Ok(file)