[RH7,4/5] ploop: Zero discard limits on stop

Submitted by Kirill Tkhai on Aug. 27, 2020, 3:42 p.m.

Details

Message ID 159854295254.335074.16332823614049988409.stgit@localhost.localdomain
State New
Series "Series without cover letter"
Headers show

Commit Message

Kirill Tkhai Aug. 27, 2020, 3:42 p.m.
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.

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 64127fa10c45..d999bffd3681 100644
--- a/drivers/block/ploop/dev.c
+++ b/drivers/block/ploop/dev.c
@@ -4249,6 +4249,7 @@  static int ploop_start(struct ploop_device * plo, struct block_device *bdev)
 
 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;