BLKDISCARD and FITRIM ioctl calls were being rejected with -EOPNOTSUPP because bdev's max_discard_sectors was set to 0. blk_validate_limits sets max_discard_sectors to the minimum value between max_user_discard_sectors and max_hw_discard_sectors. In our case max_hw_discard_sectors was not set.
https://virtuozzo.atlassian.net/browse/VSTOR-113920 Signed-off-by: Vasileios Almpanis <[email protected]> Feature: dm-qcow2: Re-enable discard support. --- drivers/md/dm-qcow2-target.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/md/dm-qcow2-target.c b/drivers/md/dm-qcow2-target.c index d1b54d8f883e..90f315315976 100644 --- a/drivers/md/dm-qcow2-target.c +++ b/drivers/md/dm-qcow2-target.c @@ -1047,7 +1047,7 @@ static void qcow2_io_hints(struct dm_target *ti, struct queue_limits *limits) * we can free a block on filesystem. */ limits->discard_granularity = sb->s_blocksize; - limits->max_discard_sectors = to_sector(qcow2->clu_size); + limits->max_hw_discard_sectors = to_sector(qcow2->clu_size); limits->logical_block_size = block_size; limits->physical_block_size = block_size; -- 2.43.0 _______________________________________________ Devel mailing list [email protected] https://lists.openvz.org/mailman/listinfo/devel
