Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions lib/propolis/src/block/attachment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,11 @@ impl QueueSlot {
}
}

#[derive(Default, Copy, Clone)]
#[derive(Default, Clone)]
struct QueueColState {
associated_qids: Versioned<Bitmap>,
paused: bool,
metric_consumer: Option<Arc<dyn MetricConsumer>>,
}
impl QueueColState {
fn queue_associate(&mut self, qid: QueueId) -> Versioned<Bitmap> {
Expand Down Expand Up @@ -177,11 +178,13 @@ impl QueueCollection {
slot.flush_notifications();
}
fn set_metric_consumer(&self, consumer: Arc<dyn MetricConsumer>) {
let mut state = self.state.lock().unwrap();
for queue in self.queues.iter() {
if let Some(minder) = queue.state.lock().unwrap().minder.as_mut() {
if let Some(minder) = queue.state.lock().unwrap().minder.as_ref() {
minder.set_metric_consumer(consumer.clone());
}
}
state.metric_consumer = Some(consumer);
}
fn associated_qids(&self) -> Versioned<Bitmap> {
self.state.lock().unwrap().associated_qids
Expand Down Expand Up @@ -517,6 +520,11 @@ impl DeviceAttachment {
// associating queues while in such a pause.
minder.pause();
}
if let Some(consumer) = state.metric_consumer.as_ref() {
// Propagate any metric consumer already registered with
// this device to the newly-associating queue.
minder.set_metric_consumer(consumer.clone());
}
slot_state.minder = Some(minder);
drop(slot_state);

Expand Down
Loading