From aa94e9b8f3d20c0d8b47ff64c5e0d90ddee7d4e7 Mon Sep 17 00:00:00 2001 From: Sebastien Boeuf Date: Fri, 6 Dec 2019 18:22:16 -0800 Subject: [PATCH] Revert "vmm: api: Modify FsConfig to be OpenAPI friendly" This reverts commit defc5dcd9cf883178d958ec3260fb886e700d5e1. --- vmm/src/api/openapi/cloud-hypervisor.yaml | 4 ---- vmm/src/config.rs | 10 ++++------ vmm/src/device_manager.rs | 13 +++++-------- 3 files changed, 9 insertions(+), 18 deletions(-) diff --git a/vmm/src/api/openapi/cloud-hypervisor.yaml b/vmm/src/api/openapi/cloud-hypervisor.yaml index c8e059da9..a92af5ca9 100644 --- a/vmm/src/api/openapi/cloud-hypervisor.yaml +++ b/vmm/src/api/openapi/cloud-hypervisor.yaml @@ -321,13 +321,9 @@ components: type: integer queue_size: type: integer - dax: - type: boolean - default: true cache_size: type: integer format: int64 - default: 8589934592 PmemConfig: required: diff --git a/vmm/src/config.rs b/vmm/src/config.rs index 10024f5f5..0ed5d90f4 100644 --- a/vmm/src/config.rs +++ b/vmm/src/config.rs @@ -409,8 +409,7 @@ pub struct FsConfig { pub sock: PathBuf, pub num_queues: usize, pub queue_size: u16, - pub dax: bool, - pub cache_size: u64, + pub cache_size: Option, } impl FsConfig { @@ -445,7 +444,7 @@ impl FsConfig { let mut queue_size: u16 = 1024; let mut dax: bool = true; // Default cache size set to 8Gib. - let mut cache_size: u64 = 0x0002_0000_0000; + let mut cache_size: Option = Some(0x0002_0000_0000); if tag.is_empty() { return Err(Error::ParseFsTagParam); @@ -477,9 +476,9 @@ impl FsConfig { if !cache_size_str.is_empty() { return Err(Error::InvalidCacheSizeWithDaxOff); } - cache_size = 0; + cache_size = None; } else if !cache_size_str.is_empty() { - cache_size = parse_size(cache_size_str)?; + cache_size = Some(parse_size(cache_size_str)?); } Ok(FsConfig { @@ -487,7 +486,6 @@ impl FsConfig { sock: PathBuf::from(sock), num_queues, queue_size, - dax, cache_size, }) } diff --git a/vmm/src/device_manager.rs b/vmm/src/device_manager.rs index 955a30e91..deac35b6f 100644 --- a/vmm/src/device_manager.rs +++ b/vmm/src/device_manager.rs @@ -974,8 +974,8 @@ impl DeviceManager { if let Some(fs_list_cfg) = &vm_info.vm_cfg.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 fs_cache = fs_cfg.cache_size; + let mut cache: Option<(VirtioSharedMemoryList, u64)> = None; + if let Some(fs_cache) = fs_cfg.cache_size { // The memory needs to be 2MiB aligned in order to support // hugepages. let fs_guest_addr = allocator @@ -1020,18 +1020,15 @@ impl DeviceManager { offset: 0, len: fs_cache, }); - - Some(( + cache = Some(( VirtioSharedMemoryList { addr: fs_guest_addr, len: fs_cache as GuestUsize, region_list, }, addr as u64, - )) - } else { - None - }; + )); + } let virtio_fs_device = vm_virtio::vhost_user::Fs::new( fs_sock,