From: Hanna Czenczek <hreitz@redhat.com>
To: qemu-block@nongnu.org
Cc: qemu-devel@nongnu.org, Hanna Czenczek <hreitz@redhat.com>,
Kevin Wolf <kwolf@redhat.com>,
Richard Henderson <richard.henderson@linaro.org>
Subject: [PULL 01/17] util/iov: Make qiov_slice() public
Date: Mon, 5 Jun 2023 17:45:25 +0200 [thread overview]
Message-ID: <20230605154541.1043261-2-hreitz@redhat.com> (raw)
In-Reply-To: <20230605154541.1043261-1-hreitz@redhat.com>
We want to inline qemu_iovec_init_extended() in block/io.c for padding
requests, and having access to qiov_slice() is useful for this. As a
public function, it is renamed to qemu_iovec_slice().
(We will need to count the number of I/O vector elements of a slice
there, and then later process this slice. Without qiov_slice(), we
would need to call qemu_iovec_subvec_niov(), and all further
IOV-processing functions may need to skip prefixing elements to
accomodate for a qiov_offset. Because qemu_iovec_subvec_niov()
internally calls qiov_slice(), we can just have the block/io.c code call
qiov_slice() itself, thus get the number of elements, and also create an
iovec array with the superfluous prefixing elements stripped, so the
following processing functions no longer need to skip them.)
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
Signed-off-by: Hanna Czenczek <hreitz@redhat.com>
Message-Id: <20230411173418.19549-2-hreitz@redhat.com>
---
include/qemu/iov.h | 3 +++
util/iov.c | 14 +++++++-------
2 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/include/qemu/iov.h b/include/qemu/iov.h
index 9330746680..46fadfb27a 100644
--- a/include/qemu/iov.h
+++ b/include/qemu/iov.h
@@ -229,6 +229,9 @@ int qemu_iovec_init_extended(
void *tail_buf, size_t tail_len);
void qemu_iovec_init_slice(QEMUIOVector *qiov, QEMUIOVector *source,
size_t offset, size_t len);
+struct iovec *qemu_iovec_slice(QEMUIOVector *qiov,
+ size_t offset, size_t len,
+ size_t *head, size_t *tail, int *niov);
int qemu_iovec_subvec_niov(QEMUIOVector *qiov, size_t offset, size_t len);
void qemu_iovec_add(QEMUIOVector *qiov, void *base, size_t len);
void qemu_iovec_concat(QEMUIOVector *dst,
diff --git a/util/iov.c b/util/iov.c
index b4be580022..65a70449da 100644
--- a/util/iov.c
+++ b/util/iov.c
@@ -378,15 +378,15 @@ static struct iovec *iov_skip_offset(struct iovec *iov, size_t offset,
}
/*
- * qiov_slice
+ * qemu_iovec_slice
*
* Find subarray of iovec's, containing requested range. @head would
* be offset in first iov (returned by the function), @tail would be
* count of extra bytes in last iovec (returned iov + @niov - 1).
*/
-static struct iovec *qiov_slice(QEMUIOVector *qiov,
- size_t offset, size_t len,
- size_t *head, size_t *tail, int *niov)
+struct iovec *qemu_iovec_slice(QEMUIOVector *qiov,
+ size_t offset, size_t len,
+ size_t *head, size_t *tail, int *niov)
{
struct iovec *iov, *end_iov;
@@ -411,7 +411,7 @@ int qemu_iovec_subvec_niov(QEMUIOVector *qiov, size_t offset, size_t len)
size_t head, tail;
int niov;
- qiov_slice(qiov, offset, len, &head, &tail, &niov);
+ qemu_iovec_slice(qiov, offset, len, &head, &tail, &niov);
return niov;
}
@@ -439,8 +439,8 @@ int qemu_iovec_init_extended(
}
if (mid_len) {
- mid_iov = qiov_slice(mid_qiov, mid_offset, mid_len,
- &mid_head, &mid_tail, &mid_niov);
+ mid_iov = qemu_iovec_slice(mid_qiov, mid_offset, mid_len,
+ &mid_head, &mid_tail, &mid_niov);
}
total_niov = !!head_len + mid_niov + !!tail_len;
--
2.40.1
next prev parent reply other threads:[~2023-06-05 15:47 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-05 15:45 [PULL 00/17] Block patches Hanna Czenczek
2023-06-05 15:45 ` Hanna Czenczek [this message]
2023-06-05 15:45 ` [PULL 02/17] block: Collapse padded I/O vecs exceeding IOV_MAX Hanna Czenczek
2023-06-06 8:00 ` Michael Tokarev
2023-06-06 8:45 ` Hanna Czenczek
2023-06-06 10:47 ` Michael Tokarev
2023-06-08 9:52 ` Peter Maydell
2023-06-09 7:45 ` Hanna Czenczek
2023-06-05 15:45 ` [PULL 03/17] util/iov: Remove qemu_iovec_init_extended() Hanna Czenczek
2023-06-05 15:45 ` [PULL 04/17] iotests/iov-padding: New test Hanna Czenczek
2023-06-05 15:45 ` [PULL 05/17] parallels: Out of image offset in BAT leads to image inflation Hanna Czenczek
2023-06-07 6:51 ` Michael Tokarev
2023-06-07 8:47 ` Michael Tokarev
2023-06-07 15:14 ` Hanna Czenczek
2023-06-09 8:54 ` Denis V. Lunev
2023-06-09 9:05 ` Michael Tokarev
2023-06-05 15:45 ` [PULL 06/17] parallels: Fix high_off calculation in parallels_co_check() Hanna Czenczek
2023-06-05 15:45 ` [PULL 07/17] parallels: Fix image_end_offset and data_end after out-of-image check Hanna Czenczek
2023-06-05 15:45 ` [PULL 08/17] parallels: create parallels_set_bat_entry_helper() to assign BAT value Hanna Czenczek
2023-06-05 15:45 ` [PULL 09/17] parallels: Use generic infrastructure for BAT writing in parallels_co_check() Hanna Czenczek
2023-06-05 15:45 ` [PULL 10/17] parallels: Move check of unclean image to a separate function Hanna Czenczek
2023-06-05 15:45 ` [PULL 11/17] parallels: Move check of cluster outside " Hanna Czenczek
2023-06-05 15:45 ` [PULL 12/17] parallels: Fix statistics calculation Hanna Czenczek
2023-06-05 15:45 ` [PULL 13/17] parallels: Move check of leaks to a separate function Hanna Czenczek
2023-06-05 15:45 ` [PULL 14/17] parallels: Move statistic collection " Hanna Czenczek
2023-06-05 15:45 ` [PULL 15/17] parallels: Replace qemu_co_mutex_lock by WITH_QEMU_LOCK_GUARD Hanna Czenczek
2023-06-05 15:45 ` [PULL 16/17] parallels: Incorrect condition in out-of-image check Hanna Czenczek
2023-06-05 15:45 ` [PULL 17/17] qcow2: add discard-no-unref option Hanna Czenczek
2023-06-05 19:03 ` [PULL 00/17] Block patches Richard Henderson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230605154541.1043261-2-hreitz@redhat.com \
--to=hreitz@redhat.com \
--cc=kwolf@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).