mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
vmm, virtio: fs: Move freeing of mappped region into device
Move the release of the managed memory region from the DeviceManager to the vhost-user-fs device. This ensures that the memory will be freed when the device is unplugged which will lead to it being Drop()ed. Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
@@ -1331,7 +1331,7 @@ impl DeviceManager {
|
||||
if let Some(fs_list_cfg) = &self.config.lock().unwrap().fs {
|
||||
for fs_cfg in fs_list_cfg.iter() {
|
||||
if let Some(fs_sock) = fs_cfg.sock.to_str() {
|
||||
let cache: Option<(VirtioSharedMemoryList, u64)> = if fs_cfg.dax {
|
||||
let cache = if fs_cfg.dax {
|
||||
let fs_cache = fs_cfg.cache_size;
|
||||
// The memory needs to be 2MiB aligned in order to support
|
||||
// hugepages.
|
||||
@@ -1356,8 +1356,6 @@ impl DeviceManager {
|
||||
.map_err(DeviceManagerError::NewMmapRegion)?;
|
||||
let addr: u64 = mmap_region.as_ptr() as u64;
|
||||
|
||||
self._mmap_regions.push(mmap_region);
|
||||
|
||||
self.memory_manager
|
||||
.lock()
|
||||
.unwrap()
|
||||
@@ -1383,6 +1381,7 @@ impl DeviceManager {
|
||||
region_list,
|
||||
},
|
||||
addr,
|
||||
mmap_region,
|
||||
))
|
||||
} else {
|
||||
None
|
||||
|
||||
Reference in New Issue
Block a user