block_util: convert aligned_operations to SmallVec

The number of aligned operations can not be larger than the number of
descriptors. Initializing the capacity to 1 is good enough per the
observation that most of time there is only one data descriptor in a
given request.

Signed-off-by: Wei Liu <liuwe@microsoft.com>
This commit is contained in:
Wei Liu 2023-01-29 20:45:17 +00:00 committed by Rob Bradford
parent 1325c76525
commit 427a2bacf5

View File

@ -201,7 +201,7 @@ pub struct Request {
pub data_descriptors: SmallVec<[(GuestAddress, u32); 1]>,
pub status_addr: GuestAddress,
pub writeback: bool,
pub aligned_operations: Vec<AlignedOperation>,
pub aligned_operations: SmallVec<[AlignedOperation; 1]>,
pub start: Instant,
}
@ -233,7 +233,7 @@ impl Request {
data_descriptors: SmallVec::with_capacity(1),
status_addr: GuestAddress(0),
writeback: true,
aligned_operations: Vec::new(),
aligned_operations: SmallVec::with_capacity(1),
start: Instant::now(),
};