[RHEL7,COMMIT] ploop: Add native discard support parameter

Submitted by Konstantin Khorenko on April 11, 2019, 10:09 a.m.

Details

Message ID 201904111009.x3BA9ApI012224@finist-ce7.sw.ru
State New
Series "ploop: Add native discard support parameter"
Headers show

Commit Message

Konstantin Khorenko April 11, 2019, 10:09 a.m.
The commit is pushed to "branch-rh7-3.10.0-957.10.1.vz7.94.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-957.10.1.vz7.94.12
------>
commit 00f131b7082dc5a90e8d63c4246e4fed516ab51b
Author: Kirill Tkhai <ktkhai@virtuozzo.com>
Date:   Thu Apr 11 13:09:10 2019 +0300

    ploop: Add native discard support parameter
    
    This adds a possibility to determ whether driver supports
    native discard (without maintaince mode).
    
    Currently, we show features in module parameters
    and this was started since "large_disk_support".
    The patch continues the way, but the parameter
    is made RW to allow prohibit the feature on flight.
    
    https://jira.sw.ru/browse/PSBM-93731
    
    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 01f70c6abec9..815c74438dd6 100644
--- a/drivers/block/ploop/dev.c
+++ b/drivers/block/ploop/dev.c
@@ -59,6 +59,7 @@  static long root_threshold __read_mostly = 2L * 1024 * 1024; /* 2GB in KB */
 static long user_threshold __read_mostly = 4L * 1024 * 1024; /* 4GB in KB */
 
 static int large_disk_support __read_mostly = 1; /* true */
+static int native_discard_support __read_mostly = 1;
 
 static struct rb_root ploop_devices_tree = RB_ROOT;
 static DEFINE_MUTEX(ploop_devices_mutex);
@@ -2184,6 +2185,9 @@  complete_unsupported_discard_req(struct ploop_request * preq)
 static bool ploop_can_issue_discard(struct ploop_device *plo,
 				    struct ploop_request *preq)
 {
+	if (!native_discard_support)
+		return false;
+
 	if (test_bit(PLOOP_REQ_DISCARD, &preq->state))
 		return true;
 
@@ -5637,6 +5641,8 @@  module_param(user_threshold, long, 0644);
 MODULE_PARM_DESC(user_threshold, "Disk space reserved for user (in kilobytes)");
 module_param(large_disk_support, int, 0444);
 MODULE_PARM_DESC(ploop_large_disk_support, "Support of large disks (>2TB)");
+module_param(native_discard_support, int, 0644);
+MODULE_PARM_DESC(native_discard_support, "Native discard support");
 
 static int __init ploop_mod_init(void)
 {