[Devel] [PATCH RHEL7 COMMIT] ploop: Allow FUSE to avoid maintaince mode based discard

Vasily Averin vvs at virtuozzo.com
Fri Sep 4 10:31:14 MSK 2020


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.16
------>
commit d7329e04617ddaaf9bbf270a617e697ebc388d40
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date:   Fri Sep 4 10:31:14 2020 +0300

    ploop: Allow FUSE to avoid maintaince mode based discard
    
    Check whether delta stack configuration allows fallocate
    based discard, and enable it if so when requested.
    
    https://jira.sw.ru/browse/PSBM-107598
    Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 drivers/block/ploop/sysfs.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/block/ploop/sysfs.c b/drivers/block/ploop/sysfs.c
index b6875ba..4cb5d9d 100644
--- a/drivers/block/ploop/sysfs.c
+++ b/drivers/block/ploop/sysfs.c
@@ -386,6 +386,11 @@ static int store_discard_granularity(struct ploop_device *plo, u32 val)
 		goto unlock;
 	}
 
+	if (!may_allow_falloc_discard(plo)) {
+		ret = -EINVAL;
+		goto unlock;
+	}
+
 	q = plo->queue;
 	if (val == q->limits.discard_granularity)
 		goto unlock;
@@ -397,6 +402,7 @@ static int store_discard_granularity(struct ploop_device *plo, u32 val)
 	}
 
 	if (val == cluster_size_in_bytes(plo)) {
+		clear_bit(PLOOP_S_NO_FALLOC_DISCARD, &plo->state);
 		ploop_set_discard_limits(plo);
 		plo->force_split_discard_reqs = false;
 		goto unlock;
@@ -408,6 +414,7 @@ static int store_discard_granularity(struct ploop_device *plo, u32 val)
 		goto unlock;
 	}
 
+	clear_bit(PLOOP_S_NO_FALLOC_DISCARD, &plo->state);
 	q->limits.discard_granularity = val;
 	/*
 	 * There is no a way to force block engine to split a request


More information about the Devel mailing list