virtio-devices: fs: avoid unnecessary string allocation

Signed-off-by: Wei Liu <liuwe@microsoft.com>
This commit is contained in:
Wei Liu 2024-04-04 16:55:57 +00:00 committed by Liu Wei
parent f3b0f59646
commit 11c593e3b9

View File

@ -398,8 +398,8 @@ impl Fs {
// Create virtio-fs device configuration.
let mut config = VirtioFsConfig::default();
let tag_bytes_vec = tag.to_string().into_bytes();
config.tag[..tag_bytes_vec.len()].copy_from_slice(tag_bytes_vec.as_slice());
let tag_bytes_slice = tag.as_bytes();
config.tag[..tag_bytes_slice.len()].copy_from_slice(tag_bytes_slice);
config.num_request_queues = req_num_queues as u32;
(