OpenVZ / Virtuozzo kernel development (devel@openvz.org)
 help / color / mirror / Atom feed
From: no-reply@sashiko.virtuozzo.com
To: Andrey Zhadchenko <andrey.zhadchenko@virtuozzo.com>,
	alexander.ivanov@virtuozzo.com, ptikhomirov@virtuozzo.com
Cc: devel@openvz.org
Subject: Re: [Devel] [PATCH hci-8.1 3/7] drivers/md/dm-qcow2: prepare process_one_qio() for fastpath
Date: Thu, 29 Oct 2026 14:16:05 +0000	[thread overview]
Message-ID: <010701a188049c1f-d7ab8632-58e7-4c14-8a77-a2519d0725b5-000000@eu-central-1.amazonses.com> (raw)
In-Reply-To: <20261029140346.465768-4-andrey.zhadchenko@virtuozzo.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] dm-qcow2: undocumented magic return codes 0/1/2 in handle_metadata()
--

commit c3720b83541dd3fa0f6258c37f4dfb59dfae2146
Author: Andrey Zhadchenko <andrey.zhadchenko@virtuozzo.com>

drivers/md/dm-qcow2: prepare process_one_qio() for fastpath

This patch adds an avoid_metadata_changes flag to handle_metadata() and
process_one_qio(). When the flag is set and the qio would need a
metadata change or touches a compressed cluster, the functions return a
new code (2 from handle_metadata(), 1 from process_one_qio()) so that
the caller can fall back to the main kwork. process_deferred_qios()
passes false, so its behaviour is unchanged.

Link: https://virtuozzo.atlassian.net/browse/VSTOR-95494

> diff --git a/drivers/md/dm-qcow2-map.c b/drivers/md/dm-qcow2-map.c
> --- a/drivers/md/dm-qcow2-map.c
> +++ b/drivers/md/dm-qcow2-map.c

[ ... ]

> @@ -3543,15 +3543,20 @@ static int handle_metadata(struct qcow2 *qcow2, struct qio **qio,
>  	ret = parse_metadata(qcow2, qio, map);
>  	if (ret < 0 || !*qio) /* Error or postponed */
>  		goto check_err;
>  
> +	if (avoid_metadata_changes && map->compressed)
> +		return 2;
> +

[Severity: Low]
This isn't a functional bug, but handle_metadata() now returns the bare
literal 2 here and at several other sites. Its existing return value 1
means "continue processing", and the new 2 means "needs the slow path".

Could these be given named constants, or could the return contract be
documented in a comment above handle_metadata()?

[ ... ]

> -static void process_one_qio(struct qcow2 *qcow2, struct qio *qio)
> +static int process_one_qio(struct qcow2 *qcow2, struct qio *qio, bool avoid_metadata_changes)
>  {
>  	struct qcow2_map map = { .qcow2 = qcow2, };
>  	bool write;
> +	int ret;
>  
> -	if (!handle_metadata(qcow2, &qio, &map))
> -		return;
> +	ret = handle_metadata(qcow2, &qio, &map, avoid_metadata_changes);
> +	if (!ret)
> +		return 0;
> +	else if (ret == 2)
> +		return 1;

[Severity: Low]
Here the value 2 from handle_metadata() is turned into a return value of
1 from process_one_qio(), which means "not handled, requeue". The same
number 1 therefore means "continue" in handle_metadata() and "requeue" in
process_one_qio().

Would named constants or a comment describing the return values of
process_one_qio() make this clearer?

This isn't a bug, but the new process_one_qio() signature is also longer
than 80 columns:

static int process_one_qio(struct qcow2 *qcow2, struct qio *qio, bool avoid_metadata_changes)

Could it be wrapped?

[ ... ]

-- 
Sashiko AI review · https://sashiko.vzint.dev/#/patchset/20261029140346.465768-1-andrey.zhadchenko@virtuozzo.com?part=3

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

  reply	other threads:[~2026-10-29 14:17 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-29 14:03 [Devel] [PATCH 0/7] drivers/md/dm-qcow2: per-qio fast path Andrey Zhadchenko
2026-10-29 14:03 ` [Devel] [PATCH hci-8.1 1/7] drivers/md/dm-qcow2: repeat md page lookup if it was inserted in parallel Andrey Zhadchenko
2026-10-29 14:13   ` no-reply
2026-11-04 21:35   ` Konstantin Khorenko
2026-10-29 14:03 ` [Devel] [PATCH hci-8.1 2/7] drivers/md/dm-qcow2: check MD_DIRTY and md->wbd under lock in perform_rw_mapped() Andrey Zhadchenko
2026-10-29 14:13   ` no-reply
2026-11-04 21:35   ` Konstantin Khorenko
2026-10-29 14:03 ` [Devel] [PATCH hci-8.1 3/7] drivers/md/dm-qcow2: prepare process_one_qio() for fastpath Andrey Zhadchenko
2026-10-29 14:16   ` no-reply [this message]
2026-11-02 17:28   ` Alexander Ivanov
2026-11-04 21:35   ` Konstantin Khorenko
2026-10-29 14:03 ` [Devel] [PATCH hci-8.1 4/7] drivers/md/dm-qcow2: add per-qio work infrastructure Andrey Zhadchenko
2026-10-29 14:18   ` no-reply
2026-11-04 21:35   ` Konstantin Khorenko
2026-10-29 14:03 ` [Devel] [PATCH hci-8.1 5/7] drivers/md/dm-qcow2: implement per-qio fast processing Andrey Zhadchenko
2026-10-29 14:22   ` no-reply
2026-11-04 21:35   ` Konstantin Khorenko
2026-10-29 14:03 ` [Devel] [PATCH hci-8.1 6/7] drivers/md/dm-qcow2: declare DM_TARGET_NOWAIT Andrey Zhadchenko
2026-10-29 14:19   ` no-reply
2026-11-03  8:33   ` Alexander Ivanov
2026-11-04 21:35   ` Konstantin Khorenko
2026-10-29 14:03 ` [Devel] [PATCH hci-8.1 7/7] drivers/md/dm-qcow2: process fast path qios in per-cpu batches on a workqueue Andrey Zhadchenko
2026-10-29 14:22   ` no-reply
2026-11-02 10:49     ` Andrey Zhadchenko
2026-11-04 21:35   ` Konstantin Khorenko
2026-11-03  9:36 ` [Devel] [PATCH 0/7] drivers/md/dm-qcow2: per-qio fast path Alexander Ivanov
2026-11-04 21:35 ` 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=010701a188049c1f-d7ab8632-58e7-4c14-8a77-a2519d0725b5-000000@eu-central-1.amazonses.com \
    --to=no-reply@sashiko.virtuozzo.com \
    --cc=alexander.ivanov@virtuozzo.com \
    --cc=andrey.zhadchenko@virtuozzo.com \
    --cc=devel@openvz.org \
    --cc=ptikhomirov@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox