mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-07-15 13:47:14 +00:00
vhost_user_blk: Simplify the code by removing VringWorker
There is no need for retrieving the VringWorker since we don't need to register some extra file descriptors to the epoll loop. Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
parent
ea82632c70
commit
808586ece7
@ -32,7 +32,7 @@ use std::time::Instant;
|
|||||||
use std::vec::Vec;
|
use std::vec::Vec;
|
||||||
use std::{convert, error, fmt, io};
|
use std::{convert, error, fmt, io};
|
||||||
use vhost_rs::vhost_user::message::*;
|
use vhost_rs::vhost_user::message::*;
|
||||||
use vhost_user_backend::{VhostUserBackend, VhostUserDaemon, Vring, VringWorker};
|
use vhost_user_backend::{VhostUserBackend, VhostUserDaemon, Vring};
|
||||||
use virtio_bindings::bindings::virtio_blk::*;
|
use virtio_bindings::bindings::virtio_blk::*;
|
||||||
use virtio_bindings::bindings::virtio_ring::VIRTIO_RING_F_EVENT_IDX;
|
use virtio_bindings::bindings::virtio_ring::VIRTIO_RING_F_EVENT_IDX;
|
||||||
use vm_memory::{Bytes, GuestMemoryError, GuestMemoryMmap};
|
use vm_memory::{Bytes, GuestMemoryError, GuestMemoryMmap};
|
||||||
@ -98,7 +98,6 @@ impl convert::From<Error> for io::Error {
|
|||||||
|
|
||||||
pub struct VhostUserBlkThread {
|
pub struct VhostUserBlkThread {
|
||||||
mem: Option<GuestMemoryMmap>,
|
mem: Option<GuestMemoryMmap>,
|
||||||
vring_worker: Option<Arc<VringWorker>>,
|
|
||||||
disk_image: Box<dyn DiskFile>,
|
disk_image: Box<dyn DiskFile>,
|
||||||
disk_image_id: Vec<u8>,
|
disk_image_id: Vec<u8>,
|
||||||
disk_nsectors: u64,
|
disk_nsectors: u64,
|
||||||
@ -147,7 +146,6 @@ impl VhostUserBlkThread {
|
|||||||
|
|
||||||
Ok(VhostUserBlkThread {
|
Ok(VhostUserBlkThread {
|
||||||
mem: None,
|
mem: None,
|
||||||
vring_worker: None,
|
|
||||||
disk_image: image,
|
disk_image: image,
|
||||||
disk_image_id: image_id,
|
disk_image_id: image_id,
|
||||||
disk_nsectors: nsectors,
|
disk_nsectors: nsectors,
|
||||||
@ -215,10 +213,6 @@ impl VhostUserBlkThread {
|
|||||||
|
|
||||||
used_any
|
used_any
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_vring_worker(&mut self, vring_worker: Option<Arc<VringWorker>>) {
|
|
||||||
self.vring_worker = vring_worker;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct VhostUserBlkBackend {
|
pub struct VhostUserBlkBackend {
|
||||||
@ -450,15 +444,6 @@ pub fn start_block_backend(backend_command: &str) {
|
|||||||
.unwrap();
|
.unwrap();
|
||||||
debug!("blk_daemon is created!\n");
|
debug!("blk_daemon is created!\n");
|
||||||
|
|
||||||
let vring_worker = blk_daemon.get_vring_workers();
|
|
||||||
blk_backend
|
|
||||||
.write()
|
|
||||||
.unwrap()
|
|
||||||
.thread
|
|
||||||
.lock()
|
|
||||||
.unwrap()
|
|
||||||
.set_vring_worker(Some(vring_worker[0].clone()));
|
|
||||||
|
|
||||||
if let Err(e) = blk_daemon.start() {
|
if let Err(e) = blk_daemon.start() {
|
||||||
error!(
|
error!(
|
||||||
"Failed to start daemon for vhost-user-block with error: {:?}\n",
|
"Failed to start daemon for vhost-user-block with error: {:?}\n",
|
||||||
|
Loading…
Reference in New Issue
Block a user