From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
To: qemu-block@nongnu.org
Cc: qemu-devel@nongnu.org, vsementsov@virtuozzo.com,
hreitz@redhat.com, kwolf@redhat.com
Subject: [PATCH v7 00/11] qcow2: fix parallel rewrite and discard (reqlist)
Date: Sat, 4 Sep 2021 19:24:17 +0300 [thread overview]
Message-ID: <20210904162428.222008-1-vsementsov@virtuozzo.com> (raw)
Hi all!
This is a new (third :)) variant of solving the problem in qcow2 that we
lack synchronisation in reallocating host clusters with refcount=0 and
guest reads/writes that may still be in progress on these clusters.
Previous version was
"[PATCH v6 00/12] qcow2: fix parallel rewrite and discard (lockless)"
Supersedes: <20210422163046.442932-1-vsementsov@virtuozzo.com>
Key features of new solution:
1. Simpler data structure: requests list instead of "dynamic refcount"
concept. What is good is that request list data structure is
implemented and used in other my series. So we can improve and reuse
it.
2. Don't care about discrads: my previous attempts were complicated by
trying to postpone discards when we have in-flight operations on
cluster which refcounts becomes 0. Don't bother with it anymore.
Nothing bad in discard: it similar as when guest does simultaneous
writes into same cluster: we don't care to serialize these writes.
So keep discards as is.
So now the whole fix may be described in one sentence: don't consider a
host cluster "free" (for allocation) if there are still some in-flight
guest operations on it.
What patches are:
1-2: simple additions to reqlist (see also *)
3: test. It's unchanged since previous solution
4-5: simpler refactorings
6-7: implement guest requests tracking in qcow2
8: refactoring for [9]
9: BUG FIX: use request tracking to avoid reallocating clusters under
guest operation
10-11: improvement if request tracking to avoid extra small critical
sections that were added in [7]
[*]:
For this series to work we also need
"[PATCH v2 06/19] block: intoduce reqlist":
Based-on: <20210827181808.311670-7-vsementsov@virtuozzo.com>
Still, note that we use only simple core of reqlist and don't use its
coroutine-related features. That probably means that I should split a
kind of BlockReqListBase data structure out of BlockReqList, and then
will have separate
CoBlockReqList for "[PATCH v2 00/19] Make image fleecing more usable"
series and Qcow2ReqList for this series..
But that a side question.
Vladimir Sementsov-Ogievskiy (11):
block/reqlist: drop extra assertion
block/reqlist: add reqlist_new_req() and reqlist_free_req()
iotests: add qcow2-discard-during-rewrite
qcow2: introduce qcow2_parse_compressed_cluster_descriptor()
qcow2: refactor qcow2_co_preadv_task() to have one return
qcow2: prepare for tracking guest io requests in data_file
qcow2: track guest io requests in data_file
qcow2: introduce is_cluster_free() helper
qcow2: don't reallocate host clusters under guest operation
block/reqlist: implement reqlist_mark_req_invalid()
qcow2: use reqlist_mark_req_invalid()
block/qcow2.h | 15 ++-
include/block/reqlist.h | 33 ++++++
block/qcow2-cluster.c | 45 ++++++-
block/qcow2-refcount.c | 34 +++++-
block/qcow2.c | 112 +++++++++++++-----
block/reqlist.c | 25 +++-
.../tests/qcow2-discard-during-rewrite | 72 +++++++++++
.../tests/qcow2-discard-during-rewrite.out | 21 ++++
8 files changed, 310 insertions(+), 47 deletions(-)
create mode 100755 tests/qemu-iotests/tests/qcow2-discard-during-rewrite
create mode 100644 tests/qemu-iotests/tests/qcow2-discard-during-rewrite.out
--
2.29.2
next reply other threads:[~2021-09-04 16:28 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-04 16:24 Vladimir Sementsov-Ogievskiy [this message]
2021-09-04 16:24 ` [PATCH v7 01/11] block/reqlist: drop extra assertion Vladimir Sementsov-Ogievskiy
2021-09-04 16:24 ` [PATCH v7 02/11] block/reqlist: add reqlist_new_req() and reqlist_free_req() Vladimir Sementsov-Ogievskiy
2021-09-04 16:24 ` [PATCH v7 03/11] iotests: add qcow2-discard-during-rewrite Vladimir Sementsov-Ogievskiy
2021-09-04 16:24 ` [PATCH v7 04/11] qcow2: introduce qcow2_parse_compressed_cluster_descriptor() Vladimir Sementsov-Ogievskiy
2021-09-04 16:24 ` [PATCH v7 05/11] qcow2: refactor qcow2_co_preadv_task() to have one return Vladimir Sementsov-Ogievskiy
2021-09-04 16:24 ` [PATCH v7 06/11] qcow2: prepare for tracking guest io requests in data_file Vladimir Sementsov-Ogievskiy
2021-09-04 16:24 ` [PATCH v7 07/11] qcow2: track " Vladimir Sementsov-Ogievskiy
2021-09-04 16:24 ` [PATCH v7 08/11] qcow2: introduce is_cluster_free() helper Vladimir Sementsov-Ogievskiy
2021-09-04 16:24 ` [PATCH v7 09/11] qcow2: don't reallocate host clusters under guest operation Vladimir Sementsov-Ogievskiy
2021-09-04 16:24 ` [PATCH v7 10/11] block/reqlist: implement reqlist_mark_req_invalid() Vladimir Sementsov-Ogievskiy
2021-09-04 16:24 ` [PATCH v7 11/11] qcow2: use reqlist_mark_req_invalid() Vladimir Sementsov-Ogievskiy
2021-09-22 8:24 ` [PATCH v7 00/11] qcow2: fix parallel rewrite and discard (reqlist) Vladimir Sementsov-Ogievskiy
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=20210904162428.222008-1-vsementsov@virtuozzo.com \
--to=vsementsov@virtuozzo.com \
--cc=hreitz@redhat.com \
--cc=kwolf@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.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).