[sefs] Configure larger cache size to improve pfs performance

This commit is contained in:
Shaowei Song 2022-11-03 11:07:18 +08:00 committed by volcano
parent d63b3c561c
commit 588b458268
2 changed files with 12 additions and 4 deletions

@ -5,3 +5,7 @@ pub use self::sgx_uuid_provider::SgxUuidProvider;
mod sgx_storage;
mod sgx_uuid_provider;
// Cache size of underlying SGX-PFS of SEFS
// Default cache size: 0x1000 * 48
const SEFS_CACHE_SIZE: u64 = 0x1000 * 256;

@ -97,9 +97,11 @@ impl Storage for SgxStorage {
let file = match self.encrypt_mode {
EncryptMode::IntegrityOnly(_) => options.open_integrity_only(path)?,
EncryptMode::EncryptWithIntegrity(key, _) | EncryptMode::Encrypt(key) => {
options.open_ex(path, &key)?
options.open_with(path, Some(&key), Some(SEFS_CACHE_SIZE))?
}
EncryptMode::EncryptAutoKey => {
options.open_with(path, None, Some(SEFS_CACHE_SIZE))?
}
EncryptMode::EncryptAutoKey => options.open(path)?,
};
// Check the MAC of the root file against the given root MAC of the storage
@ -132,9 +134,11 @@ impl Storage for SgxStorage {
let file = match self.encrypt_mode {
EncryptMode::IntegrityOnly(_) => options.open_integrity_only(path)?,
EncryptMode::EncryptWithIntegrity(key, _) | EncryptMode::Encrypt(key) => {
options.open_ex(path, &key)?
options.open_with(path, Some(&key), Some(SEFS_CACHE_SIZE))?
}
EncryptMode::EncryptAutoKey => {
options.open_with(path, None, Some(SEFS_CACHE_SIZE))?
}
EncryptMode::EncryptAutoKey => options.open(path)?,
};
Ok(LockedFile(Arc::new(Mutex::new(file))))
})?;