From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
To: qemu-block@nongnu.org
Cc: qemu-devel@nongnu.org, mreitz@redhat.com, kwolf@redhat.com,
den@openvz.org
Subject: Re: [PATCH v4 for-6.0? 0/3] qcow2: fix parallel rewrite and discard (rw-lock)
Date: Thu, 25 Mar 2021 22:12:06 +0300 [thread overview]
Message-ID: <f16e8ea3-5af7-abc2-bf1c-7fd997ecf651@virtuozzo.com> (raw)
In-Reply-To: <20210319100811.342464-1-vsementsov@virtuozzo.com>
ping. Do we want it for 6.0?
19.03.2021 13:08, Vladimir Sementsov-Ogievskiy wrote:
> Look at 03 for the problem and fix. 01 is preparation and 02 is the
> test.
>
> Actually previous version of this thing is
> [PATCH v2(RFC) 0/3] qcow2: fix parallel rewrite and discard
>
> Still
> [PATCH v3 0/6] qcow2: compressed write cache
> includes another fix (more complicated) for the bug, so this is called
> v4.
>
> So, what's new:
>
> It's still a CoRwlock based solution as suggested by Kevin.
>
> Now I think that "writer" of the lock should be code in
> update_refcount() which wants to set refcount to zero. If we consider
> only guest discard request as "writer" we may miss other sources of
> discarding host clusters (like rewriting compressed cluster to normal,
> maybe some snapshot operations, who knows what's more).
>
> And this means that we want to take rw-lock under qcow2 s->lock. And
> this brings ordering restriction for the two locks: if we want both
> locks taken, we should always take s->lock first, and never take s->lock
> when rw-lock is already taken (otherwise we get classic deadlock).
>
> This leads us to taking rd-lock for in-flight writes under s->lock in
> same critical section where cluster is allocated (or just got from
> metadata) and releasing after data writing completion.
>
> This in turn leads to a bit tricky logic around transferring rd-lock to
> task coroutine on normal write path (see 03).. But this is still simpler
> than inflight-write-counters solution in v3..
>
> Vladimir Sementsov-Ogievskiy (3):
> qemu-io: add aio_discard
> iotests: add qcow2-discard-during-rewrite
> block/qcow2: introduce discard_rw_lock: fix discarding host clusters
>
> block/qcow2.h | 20 +++
> block/qcow2-refcount.c | 22 ++++
> block/qcow2.c | 73 +++++++++--
> qemu-io-cmds.c | 117 ++++++++++++++++++
> .../tests/qcow2-discard-during-rewrite | 99 +++++++++++++++
> .../tests/qcow2-discard-during-rewrite.out | 17 +++
> 6 files changed, 341 insertions(+), 7 deletions(-)
> create mode 100755 tests/qemu-iotests/tests/qcow2-discard-during-rewrite
> create mode 100644 tests/qemu-iotests/tests/qcow2-discard-during-rewrite.out
>
--
Best regards,
Vladimir
next prev parent reply other threads:[~2021-03-25 19:14 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-19 10:08 [PATCH v4 0/3] qcow2: fix parallel rewrite and discard (rw-lock) Vladimir Sementsov-Ogievskiy
2021-03-19 10:08 ` [PATCH v4 1/3] qemu-io: add aio_discard Vladimir Sementsov-Ogievskiy
2021-03-19 10:08 ` [PATCH v4 2/3] iotests: add qcow2-discard-during-rewrite Vladimir Sementsov-Ogievskiy
2021-03-19 10:08 ` [PATCH v4 3/3] block/qcow2: introduce discard_rw_lock: fix discarding host clusters Vladimir Sementsov-Ogievskiy
2021-03-25 19:12 ` Vladimir Sementsov-Ogievskiy [this message]
2021-03-30 9:49 ` [PATCH v4 for-6.0? 0/3] qcow2: fix parallel rewrite and discard (rw-lock) Max Reitz
2021-03-30 10:51 ` Vladimir Sementsov-Ogievskiy
2021-03-30 12:51 ` Max Reitz
2021-03-30 13:25 ` Vladimir Sementsov-Ogievskiy
2021-03-30 16:39 ` Max Reitz
2021-03-30 18:33 ` Vladimir Sementsov-Ogievskiy
2021-03-31 6:23 ` 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=f16e8ea3-5af7-abc2-bf1c-7fd997ecf651@virtuozzo.com \
--to=vsementsov@virtuozzo.com \
--cc=den@openvz.org \
--cc=kwolf@redhat.com \
--cc=mreitz@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).