perf(nvme): return harvested tags without repolling queues

This commit is contained in:
Tyler Smith committed 2026-11-04 04:43:35 +00:00
1 parent 77fa5aa289
commit fa00cb9c9e
2 files changed
+27 -1

No files matched your search

+5 -1
View File
@@ -510,7 +510,11 @@ impl Controller {
/// Tag `tag`'s result once its command completed; never waits.
pub(super) fn finish(&mut self, tag: usize) -> Option<Finished> {
self.advance();
// An earlier poll can reap several completions. Only a tag whose
// result is still pending needs another pass over the queues.
if !matches!(self.tags.get(tag), Some(Tag::Done(_))) {
self.advance();
}
if !matches!(self.tags.get(tag)?, Tag::Done(_)) {
return None;
}
@@ -475,6 +475,28 @@ fn queued_commands_run_together_and_complete_in_any_order() {
assert!(disk.start(Command::Flush).is_err());
}
#[test]
fn taking_a_ready_result_leaves_live_deadlines_to_their_poll() {
let _clock = crate::test_clock::virtualize();
let mut fixture = Fixture::new();
let disk = &mut fixture.disk;
let done = disk.start(Command::Flush).unwrap();
let live = disk.start(Command::Flush).unwrap();
let clock = {
let mut controller = disk.controller.borrow_mut();
let id = running_id(&controller, done);
post(&mut controller, id, 0);
controller.advance();
controller.clock
};
crate::test_clock::advance(clock, 1000);
assert_eq!(disk.finish(done), Some(Ok(None)));
assert!(disk.controller.borrow().aborts.is_empty());
assert_eq!(disk.finish(live), None);
assert_eq!(disk.controller.borrow().aborts.len(), 1);
}
#[test]
fn delayed_read_completes_after_submission_ring_wraps() {
let _clock = crate::test_clock::virtualize();