ploop: Prohibit custom discard alignment and granuality

Submitted by Kirill Tkhai on March 14, 2019, 11:31 a.m.

Details

Message ID 155256307215.18948.4980007693802755109.stgit@localhost.localdomain
State New
Series "ploop: Prohibit custom discard alignment and granuality"
Headers show

Commit Message

Kirill Tkhai March 14, 2019, 11:31 a.m.
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@virtuozzo.com>
---
 drivers/block/ploop/sysfs.c |   28 ++--------------------------
 1 file changed, 2 insertions(+), 26 deletions(-)

Patch hide | download patch | download mbox

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
 };