vhost_user_backend: Change handle_event as immutable

By changing the mutability of this function, after adapting all
backends, we should be able to implement multithreads with
multiqueues support without hitting a bottleneck on the backend
locking.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
Sebastien Boeuf 2020-04-09 13:14:05 +02:00
parent 8f434df1fb
commit 40e4dc6339
4 changed files with 5 additions and 5 deletions

View File

@ -217,7 +217,7 @@ impl<F: FileSystem + Send + Sync + 'static> VhostUserBackend for VhostUserFsBack
} }
fn handle_event( fn handle_event(
&mut self, &self,
device_event: u16, device_event: u16,
evset: epoll::Events, evset: epoll::Events,
vrings: &[Arc<RwLock<Vring>>], vrings: &[Arc<RwLock<Vring>>],

View File

@ -81,7 +81,7 @@ pub trait VhostUserBackend: Send + Sync + 'static {
/// virtqueues on its own, but does not know what to do with events /// virtqueues on its own, but does not know what to do with events
/// happening on custom listeners. /// happening on custom listeners.
fn handle_event( fn handle_event(
&mut self, &self,
device_event: u16, device_event: u16,
evset: epoll::Events, evset: epoll::Events,
vrings: &[Arc<RwLock<Vring>>], vrings: &[Arc<RwLock<Vring>>],
@ -310,7 +310,7 @@ impl<S: VhostUserBackend> VringEpollHandler<S> {
} }
self.backend self.backend
.write() .read()
.unwrap() .unwrap()
.handle_event(device_event, evset, &self.vrings) .handle_event(device_event, evset, &self.vrings)
.map_err(VringEpollHandlerError::HandleEventBackendHandling) .map_err(VringEpollHandlerError::HandleEventBackendHandling)

View File

@ -277,7 +277,7 @@ impl VhostUserBackend for VhostUserBlkBackend {
} }
fn handle_event( fn handle_event(
&mut self, &self,
device_event: u16, device_event: u16,
evset: epoll::Events, evset: epoll::Events,
vrings: &[Arc<RwLock<Vring>>], vrings: &[Arc<RwLock<Vring>>],

View File

@ -307,7 +307,7 @@ impl VhostUserBackend for VhostUserNetBackend {
} }
fn handle_event( fn handle_event(
&mut self, &self,
device_event: u16, device_event: u16,
evset: epoll::Events, evset: epoll::Events,
vrings: &[Arc<RwLock<Vring>>], vrings: &[Arc<RwLock<Vring>>],