[Devel] [PATCH] ploop: Forced clear discard alignment

Kirill Tkhai ktkhai at virtuozzo.com
Tue Jan 12 12:53:16 MSK 2021


On customer node we met configuration:

/dev/mapper/virtuozzo-vz on /vz type ext4 (rw,noatime,lazytime,data=ordered)

virtuozzo-vz: 0 1046470656 linear 8:19 2048
virtuozzo-vz: 1046470656 209707008 linear 8:20 2048

brw-rw----  1 root disk      8,     19 Jan 12 08:51 sdb3
brw-rw----  1 root disk      8,     20 Jan 12 08:51 sdb4

$cat /sys/block/sdb/sdb4/start
1048576171

After that, ploop discard becomes unaligned, and we can't
build whole-cluster requests.

$cat /sys/block/ploop23881/discard_alignment
2560

Since we act on /vz filesystem and since discard frees filesystem
blocks, we should inherit nothing discard-related from underlining
block device. So, we clear inherited discard_alignment.

https://jira.sw.ru/browse/PSBM-124496
Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 include/linux/ploop/ploop.h |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/linux/ploop/ploop.h b/include/linux/ploop/ploop.h
index 766a0e9f3d89..2256eb489a97 100644
--- a/include/linux/ploop/ploop.h
+++ b/include/linux/ploop/ploop.h
@@ -884,6 +884,8 @@ static inline void ploop_set_discard_limits(struct ploop_device *plo)
 	 */
 	q->limits.discard_granularity = cluster_size_in_bytes(plo);
 	q->limits.max_discard_sectors = (1 << plo->cluster_log);
+	q->limits.discard_alignment = 0;
+	q->limits.discard_misaligned = 0;
 }
 struct map_node;
 




More information about the Devel mailing list