aboutsummaryrefslogtreecommitdiff
path: root/util/iov.c
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2015-12-22 12:03:33 +0100
committerStefan Hajnoczi <stefanha@redhat.com>2016-02-09 13:52:26 +0000
commitad523bca56a7202d2498c550a41be5c986c4d33c (patch)
treeb3b07fcce95eefd07483b22923de1c4ae62b10bb /util/iov.c
parentee8e8f92a730afc17ab8be6e86df6b9a23b8ebc6 (diff)
downloadqemu-ad523bca56a7202d2498c550a41be5c986c4d33c.zip
qemu-ad523bca56a7202d2498c550a41be5c986c4d33c.tar.gz
qemu-ad523bca56a7202d2498c550a41be5c986c4d33c.tar.bz2
iov: avoid memcpy for "simple" iov_from_buf/iov_to_buf
memcpy can take a large amount of time for small reads and writes. For virtio it is a common case that the first iovec can satisfy the whole read or write. In that case, and if bytes is a constant to avoid excessive growth of code, inline the first iteration into the caller. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Message-id: 1450782213-14227-1-git-send-email-pbonzini@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'util/iov.c')
-rw-r--r--util/iov.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/util/iov.c b/util/iov.c
index e802ee1..062f4e5 100644
--- a/util/iov.c
+++ b/util/iov.c
@@ -20,8 +20,8 @@
#include "qemu/iov.h"
#include "qemu/sockets.h"
-size_t iov_from_buf(const struct iovec *iov, unsigned int iov_cnt,
- size_t offset, const void *buf, size_t bytes)
+size_t iov_from_buf_full(const struct iovec *iov, unsigned int iov_cnt,
+ size_t offset, const void *buf, size_t bytes)
{
size_t done;
unsigned int i;
@@ -39,8 +39,8 @@ size_t iov_from_buf(const struct iovec *iov, unsigned int iov_cnt,
return done;
}
-size_t iov_to_buf(const struct iovec *iov, const unsigned int iov_cnt,
- size_t offset, void *buf, size_t bytes)
+size_t iov_to_buf_full(const struct iovec *iov, const unsigned int iov_cnt,
+ size_t offset, void *buf, size_t bytes)
{
size_t done;
unsigned int i;