[Devel] [PATCH hci-8.1 1/2] dm-qcow2: set max discard segments to one
Andrey Zhadchenko
andrey.zhadchenko at virtuozzo.com
Mon Nov 9 18:36:18 MSK 2026
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 at 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
More information about the Devel
mailing list