ploop: Forced clear discard alignment

Submitted by Kirill Tkhai on Jan. 12, 2021, 9:53 a.m.

Details

Message ID 161044519169.131335.6345106825262565057.stgit@localhost.localdomain
State New
Series "ploop: Forced clear discard alignment"
Headers show

Commit Message

Kirill Tkhai Jan. 12, 2021, 9:53 a.m.
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@virtuozzo.com>
---
 include/linux/ploop/ploop.h |    2 ++
 1 file changed, 2 insertions(+)

Patch hide | download patch | download mbox

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;