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

Kirill Tkhai ktkhai at virtuozzo.com
Thu Aug 27 18:42:36 MSK 2020


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 at virtuozzo.com>
---
 drivers/block/ploop/dev.c |    6 ++++++
 1 file changed, 6 insertions(+)

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;




More information about the Devel mailing list