Skip to content

Commit 03000c7

Browse files
committed
Minor tweaks
1 parent d1c9853 commit 03000c7

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

upstairs/src/guest.rs

+13-5
Original file line numberDiff line numberDiff line change
@@ -202,12 +202,22 @@ impl GuestWork {
202202
(gw_id, ds_id)
203203
}
204204

205+
/// Low-level function to get next guest work ID
206+
///
207+
/// Normally, `submit_job` should be called instead; this function should
208+
/// only be used to reserve `GuestWorkId`s in advance of submitting the
209+
/// jobs.
205210
pub(crate) fn next_gw_id(&mut self) -> GuestWorkId {
206211
let id = self.next_gw_id;
207212
self.next_gw_id += 1;
208213
GuestWorkId(id)
209214
}
210215

216+
/// Low-level function to insert work into the map
217+
///
218+
/// Normally, `submit_job` should be called instead; this function should
219+
/// only be used if we have reserved the `GuestWorkId` and `JobId` in
220+
/// advance.
211221
pub(crate) fn insert(
212222
&mut self,
213223
gw_id: GuestWorkId,
@@ -536,7 +546,7 @@ impl BlockIO for Guest {
536546
}
537547

538548
async fn get_block_size(&self) -> Result<u64, CrucibleError> {
539-
let bs = self.block_size.load(std::sync::atomic::Ordering::Relaxed);
549+
let bs = self.block_size.load(Ordering::Relaxed);
540550
if bs == 0 {
541551
let data = Arc::new(Mutex::new(0));
542552
let size_query = BlockOp::QueryBlockSize { data: data.clone() };
@@ -546,8 +556,7 @@ impl BlockIO for Guest {
546556
reply.result?;
547557

548558
let bs = *data.lock().await;
549-
self.block_size
550-
.store(bs, std::sync::atomic::Ordering::Relaxed);
559+
self.block_size.store(bs, Ordering::Relaxed);
551560
Ok(bs)
552561
} else {
553562
Ok(bs)
@@ -945,8 +954,7 @@ impl GuestIoHandle {
945954

946955
/// Looks up current backpressure
947956
pub fn backpressure_us(&self) -> u64 {
948-
self.backpressure_us
949-
.load(std::sync::atomic::Ordering::Acquire)
957+
self.backpressure_us.load(Ordering::Acquire)
950958
}
951959

952960
/// Debug function to dump the guest work structure.

0 commit comments

Comments
 (0)