[RHEL7,COMMIT] ploop: Zero discard limits on stop

Submitted by Vasily Averin on Aug. 28, 2020, 4:38 a.m.

Details

Message ID 202008280438.07S4cAOV009804@vz7build.vvs.sw.ru
State New
Series "Series without cover letter"
Headers show

Commit Message

Vasily Averin Aug. 28, 2020, 4:38 a.m.
The commit is pushed to "branch-rh7-3.10.0-1127.18.2.vz7.163.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-1127.18.2.vz7.163.13
------>
commit d7a0f0fa86d86437fae13afd33de0fe0dbaff1fe
Author: Kirill Tkhai <ktkhai@virtuozzo.com>
Date:   Fri Aug 28 07:38:10 2020 +0300

    ploop: Zero discard limits on stop
    
    So, next start will be able to differ manually set
    parameters from start defaults.
    
    Also add the same on start just to underline they
    are allocated zeroed.
    
    https://jira.sw.ru/browse/PSBM-105347
    Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
---
 drivers/block/ploop/dev.c | 6 ++++++
 1 file changed, 6 insertions(+)

Patch hide | download patch | download mbox

diff --git a/drivers/block/ploop/dev.c b/drivers/block/ploop/dev.c
index 64127fa..d999bff 100644
--- a/drivers/block/ploop/dev.c
+++ b/drivers/block/ploop/dev.c
@@ -4249,6 +4249,7 @@  out_err:
 
 static int ploop_stop(struct ploop_device * plo, struct block_device *bdev)
 {
+	struct request_queue *q = plo->queue;
 	int p, active_reqs;
 	struct ploop_delta * delta;
 	int cnt;
@@ -4309,6 +4310,9 @@  static int ploop_stop(struct ploop_device * plo, struct block_device *bdev)
 
 	plo->tune.trusted = 0;
 
+	q->limits.discard_granularity = 0;
+	q->limits.max_discard_sectors = 0;
+
 	clear_bit(PLOOP_S_PUSH_BACKUP, &plo->state);
 	ploop_pb_stop(plo->pbd, true);
 
@@ -5644,6 +5648,8 @@  static struct ploop_device *__ploop_dev_alloc(int index)
 	KOBJECT_INIT(&plo->kobj, &ploop_ktype);
 	atomic_inc(&plo_count);
 	bio_list_init(&plo->bio_discard_list);
+	plo->queue->limits.discard_granularity = 0;
+	plo->queue->limits.max_discard_sectors = 0;
 
 	dk->major		= ploop_major;
 	dk->first_minor		= index << PLOOP_PART_SHIFT;