Copy filetable more efficiently.

This commit is contained in:
4lDO2
2022-07-08 12:36:36 +02:00
parent 0b67997c7b
commit 59d74689dc
2 changed files with 3 additions and 3 deletions

View File

@@ -251,8 +251,8 @@ impl UserGrants {
let exactly_after_size = holes.remove(&grant.end_address());
// There was a range that began exactly prior to the to-be-freed region, so simply
// increment the size such that it occupies the grant too. If in additional there was a
// grant directly after the grant, include it too in the size.
// increment the size such that it occupies the grant too. If in addition there was a grant
// directly after the grant, include it too in the size.
if let Some((hole_offset, hole_size)) = holes.range_mut(..grant.start_address()).next_back().filter(|(offset, size)| offset.data() + **size == grant.start_address().data()) {
*hole_size = grant.end_address().data() - hole_offset.data() + exactly_after_size.unwrap_or(0);
} else {

View File

@@ -435,7 +435,7 @@ impl Scheme for ProcScheme {
if buf != b"copy" {
return Err(Error::new(EINVAL));
}
let new_filetable = Arc::try_new(RwLock::new(filetable.read().iter().cloned().collect::<Vec<_>>())).map_err(|_| Error::new(ENOMEM))?;
let new_filetable = Arc::try_new(RwLock::new(filetable.read().clone())).map_err(|_| Error::new(ENOMEM))?;
Handle {
info: Info {