[RHEL7,COMMIT] ploop: Forced clear discard alignment

Submitted by Vasily Averin on Jan. 13, 2021, 10:25 a.m.

Details

Message ID 202101131025.10DAPDo4009540@vz7build.vvs.sw.ru
State New
Series "ploop: Forced clear discard alignment"
Headers show

Commit Message

Vasily Averin Jan. 13, 2021, 10:25 a.m.
The commit is pushed to "branch-rh7-3.10.0-1160.11.1.vz7.172.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-1160.11.1.vz7.172.9
------>
commit cb283d02fc12ee9442331de6c9d8fce56feb57b0
Author: Kirill Tkhai <ktkhai@virtuozzo.com>
Date:   Wed Jan 13 13:25:13 2021 +0300

    ploop: Forced clear discard alignment
    
    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 766a0e9f..2256eb4 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;