OpenVZ / Virtuozzo kernel development (devel@openvz.org)
 help / color / mirror / Atom feed
From: Andrey Zhadchenko <andrey.zhadchenko@virtuozzo.com>
To: khorenko@virtuozzo.com, alexander.ivanov@virtuozzo.com
Cc: devel@openvz.org
Subject: [Devel] [PATCH hci-8.1 1/2] dm-qcow2: set max discard segments to one
Date: Mon,  9 Nov 2026 18:36:18 +0300	[thread overview]
Message-ID: <20261109153619.277888-2-andrey.zhadchenko@virtuozzo.com> (raw)
In-Reply-To: <20261109153619.277888-1-andrey.zhadchenko@virtuozzo.com>

Discard is a special type of request that can have non-contiguous
bios.
Imagine we have a request with starting sector 0 and length 1024,
so read or write means [0, 1024) range in the file. For discard this
request can have 2 bios [0, 512) and [1024, 1536), but we always
discarded [0, 1024).
Set max_discard_segments to 1 to avoid such merges.

https://virtuozzo.atlassian.net/browse/VSTOR-154159
Fixes: 222b6f1291c1 ("dm-qcow2: Introduce driver to create block devices over QCOW2 files")
Feature: dm-qcow2: block device over QCOW2 files driver
Signed-off-by: Andrey Zhadchenko <andrey.zhadchenko@virtuozzo.com>
---
 drivers/md/dm-qcow2-target.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/md/dm-qcow2-target.c b/drivers/md/dm-qcow2-target.c
index 7c572bd66e1ca..8337efc5c6238 100644
--- a/drivers/md/dm-qcow2-target.c
+++ b/drivers/md/dm-qcow2-target.c
@@ -1053,6 +1053,7 @@ static void qcow2_io_hints(struct dm_target *ti, struct queue_limits *limits)
 	 */
 	limits->discard_granularity = sb->s_blocksize;
 	limits->max_hw_discard_sectors = to_sector(qcow2->clu_size);
+	limits->max_discard_segments = 1;
 
 	limits->logical_block_size = block_size;
 	limits->physical_block_size = block_size;
-- 
2.43.5

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

  reply	other threads:[~2026-11-09 15:42 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-09 15:36 [Devel] [PATCH hci-8.1 0/2] dm-qcow2, dm-ploop: do not merge discards with gaps Andrey Zhadchenko
2026-11-09 15:36 ` Andrey Zhadchenko [this message]
2026-11-09 15:44   ` [Devel] [PATCH hci-8.1 1/2] dm-qcow2: set max discard segments to one no-reply
2026-11-09 15:36 ` [Devel] [PATCH hci-8.1 2/2] dm-ploop: " Andrey Zhadchenko
2026-11-09 15:44   ` no-reply

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=20261109153619.277888-2-andrey.zhadchenko@virtuozzo.com \
    --to=andrey.zhadchenko@virtuozzo.com \
    --cc=alexander.ivanov@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox