[Devel] [PATCH RHEL7 COMMIT] ploop: Prohibit custom discard alignment and granuality

Konstantin Khorenko khorenko at virtuozzo.com
Thu Mar 14 15:18:54 MSK 2019


The commit is pushed to "branch-rh7-3.10.0-957.5.1.vz7.84.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-957.5.1.vz7.84.9
------>
commit d4f5da05efa80cec292a81784617137b760e681a
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date:   Thu Mar 14 15:18:52 2019 +0300

    ploop: Prohibit custom discard alignment and granuality
    
    We can zero ploop1 fmt index only in case of full block
    discarding is requested. Correct limits are already set
    in ploop_set_discard_limits(), so this patch prohibits
    custom ones.
    
    Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 drivers/block/ploop/sysfs.c | 28 ++--------------------------
 1 file changed, 2 insertions(+), 26 deletions(-)

diff --git a/drivers/block/ploop/sysfs.c b/drivers/block/ploop/sysfs.c
index 11326613d75c..b2203d152c2c 100644
--- a/drivers/block/ploop/sysfs.c
+++ b/drivers/block/ploop/sysfs.c
@@ -367,35 +367,11 @@ static u32 show_discard_granularity(struct ploop_device * plo)
 	return plo->queue->limits.discard_granularity;
 }
 
-static int store_discard_granularity(struct ploop_device * plo, u32 val)
-{
-	int q = ilog2(val);
-
-	/* look at kaio_fill_zero_submit */
-	if (1 << q != val || val > PAGE_SIZE || val < 512)
-		return -EINVAL;
-
-	plo->queue->limits.discard_granularity = val;
-	return 0;
-}
-
 static u32 show_discard_alignment(struct ploop_device * plo)
 {
 	return plo->queue->limits.discard_alignment;
 }
 
-static int store_discard_alignment(struct ploop_device * plo, u32 val)
-{
-	int q = ilog2(val);
-
-	/* look at kaio_fill_zero_submit */
-	if (1 << q != val || val > PAGE_SIZE || val < 512)
-		return -EINVAL;
-
-	plo->queue->limits.discard_alignment = val;
-	return 0;
-}
-
 static u32 show_discard_zeroes_data(struct ploop_device * plo)
 {
 	return plo->queue->limits.discard_zeroes_data;
@@ -616,8 +592,8 @@ static struct attribute *tune_attributes[] = {
 	_A2(congestion_low_watermark),
 	_A2(max_active_requests),
 	_A2(push_backup_timeout),
-	_A2(discard_granularity),
-	_A2(discard_alignment),
+	_A(discard_granularity),
+	_A(discard_alignment),
 	_A2(discard_zeroes_data),
 	NULL
 };



More information about the Devel mailing list