All Virtuozzo development lists (kernel + QEMU)
 help / color / mirror / Atom feed
From: Alexander Ivanov <alexander.ivanov@virtuozzo.com>
To: Andrey Zhadchenko <andrey.zhadchenko@virtuozzo.com>,
	khorenko@virtuozzo.com
Cc: devel@openvz.org
Subject: Re: [Devel] [PATCH hci-8.1 0/3] dm-qcow2: do not free a discarded cluster under in-flight writes
Date: Thu, 12 Nov 2026 13:40:23 +0100	[thread overview]
Message-ID: <dd6d485f-ba4c-4070-ae57-66bed95ddbfa@virtuozzo.com> (raw)
In-Reply-To: <20261112111205.736027-1-andrey.zhadchenko@virtuozzo.com>

LGTM

Reviewed-by: Alexander Ivanov <alexander.ivanov@virtuozzo.com>

On 11/12/26 12:12, Andrey Zhadchenko wrote:
> A discard unmapping a cluster locks its L2 index, so requests coming
> later wait until the discard is finished. But a data write, which has
> resolved the index before it was locked, may still be in flight when
> the discard drops the cluster refcount in process_indexes_end(). If
> the cluster is allocated again before this write lands, the write
> corrupts the data or the metadata of the new owner.
>
> Make such a discard wait for these writes before the cluster is freed:
>
> Patch 1 counts in-flight data writes per L2 page in two generations.
> Nobody reads the counters yet, so there is no functional change.
>
> Patch 2 is the fix. The discard switches the generation of its L2 page
> and waits for the previous one to drain right before the refcount is
> dropped. Writes submitted after the switch are counted separately, so
> the wait is bounded by the writes already in flight.
>
> Patch 3 is an optimisation. Discards of clusters mapped by one L2 page
> usually come to process_indexes_end() in one batch. Let them wait for
> the same generation together instead of one by one.
>
> https://virtuozzo.atlassian.net/browse/VSTOR-154659
>
> Andrey Zhadchenko (3):
>    dm-qcow2: count in-flight data writes per L2 page
>    dm-qcow2: wait for in-flight writes before freeing a discarded cluster
>    dm-qcow2: let discards of one L2 page wait for in-flight writes
>      together
>
>   drivers/md/dm-qcow2-map.c    | 118 +++++++++++++++++++++++++++++++++++
>   drivers/md/dm-qcow2-target.c |   6 ++
>   drivers/md/dm-qcow2.h        |  12 ++++
>   3 files changed, 136 insertions(+)
>
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

  parent reply	other threads:[~2026-11-12 12:41 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-12 11:12 Andrey Zhadchenko
2026-11-12 11:12 ` [Devel] [PATCH hci-8.1 1/3] dm-qcow2: count in-flight data writes per L2 page Andrey Zhadchenko
2026-11-12 11:22   ` no-reply
2026-11-12 18:59   ` Konstantin Khorenko
2026-11-12 11:12 ` [Devel] [PATCH hci-8.1 2/3] dm-qcow2: wait for in-flight writes before freeing a discarded cluster Andrey Zhadchenko
2026-11-12 11:26   ` no-reply
2026-11-12 11:47     ` Andrey Zhadchenko
2026-11-12 18:59   ` Konstantin Khorenko
2026-11-12 11:12 ` [Devel] [PATCH hci-8.1 3/3] dm-qcow2: let discards of one L2 page wait for in-flight writes together Andrey Zhadchenko
2026-11-12 11:24   ` no-reply
2026-11-12 18:59   ` Konstantin Khorenko
2026-11-12 12:40 ` Alexander Ivanov [this message]
2026-11-12 18:59 ` [Devel] [PATCH hci-8.1 0/3] dm-qcow2: do not free a discarded cluster under in-flight writes Konstantin Khorenko
2026-11-12 19:00 ` Konstantin Khorenko

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=dd6d485f-ba4c-4070-ae57-66bed95ddbfa@virtuozzo.com \
    --to=alexander.ivanov@virtuozzo.com \
    --cc=andrey.zhadchenko@virtuozzo.com \
    --cc=devel@openvz.org \
    --cc=khorenko@virtuozzo.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.