[Devel] [PATCH RHEL7 COMMIT] ploop: Return maintaince mode ioctls again

Konstantin Khorenko khorenko at virtuozzo.com
Tue May 21 17:44:31 MSK 2019


The commit is pushed to "branch-rh7-3.10.0-957.12.2.vz7.96.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-957.12.2.vz7.96.1
------>
commit 325e7edf4a9901199a5a0d70eebc2ce9da74751a
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date:   Tue May 21 17:44:29 2019 +0300

    ploop: Return maintaince mode ioctls again
    
    Also, move PLOOP_REQ_DISCARD check up in ploop_can_issue_discard(),
    since maintaince mode based discard works independent of native
    discard mode.
    
    Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
    
    =====================
    Patchset description:
    
    ploop: Return maintaince mode
    
    This patch set enables it for vstorage.
    
    Also, added file /sys/block/ploopXXX/pstate/native_discard,
    which shows, whether we should use maintaince-mode based
    discard or not.
    
    https://jira.sw.ru/browse/PSBM-94662
    
    Kirill Tkhai (8):
          Revert "ploop: Remove now unused PLOOP_E_ZERO_INDEX and PLOOP_E_DELTA_ZERO_INDEX branches"
          Revert "ploop: Remove now unused PLOOP_REQ_RELOC_S branches"
          Revert "ploop: Remove now unused PLOOP_REQ_DISCARD branches"
          Revert "ploop: Remove now unused PLOOP_REQ_ZERO branches"
          Revert "ploop: Remove obsolete ioctls"
          Partial revert "ploop: Enable native discard support for kaio engine"
          ploop: Return maintaince mode ioctls again
          ploop: Show whether device supports native discard
---
 drivers/block/ploop/dev.c     | 21 +++++++++++++--------
 drivers/block/ploop/discard.c |  9 ++++++---
 2 files changed, 19 insertions(+), 11 deletions(-)

diff --git a/drivers/block/ploop/dev.c b/drivers/block/ploop/dev.c
index 4bf0240df622..36df41450c4d 100644
--- a/drivers/block/ploop/dev.c
+++ b/drivers/block/ploop/dev.c
@@ -2185,12 +2185,12 @@ 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;
 
+	if (!native_discard_support)
+		return false;
+
 	if (test_bit(PLOOP_S_NO_FALLOC_DISCARD, &plo->state))
 		return false;
 
@@ -4566,7 +4566,8 @@ static int ploop_freeblks_ioc(struct ploop_device *plo, unsigned long arg)
 	int i;
 	int rc = 0;
 
-	return 0;
+	if (!test_bit(PLOOP_S_NO_FALLOC_DISCARD, &plo->state))
+		return -EINVAL;
 
 	if (list_empty(&plo->map.delta_list))
 		return -ENOENT;
@@ -4651,7 +4652,8 @@ static int ploop_fbget_ioc(struct ploop_device *plo, unsigned long arg)
 	struct ploop_freeblks_ctl ctl;
 	int rc = 0;
 
-	return -EINVAL;
+	if (!test_bit(PLOOP_S_NO_FALLOC_DISCARD, &plo->state))
+		return -EINVAL;
 
 	if (list_empty(&plo->map.delta_list))
 		return -ENOENT;
@@ -4677,7 +4679,8 @@ static int ploop_fbfilter_ioc(struct ploop_device *plo, unsigned long arg)
 {
 	int rc = 0;
 
-	return -EINVAL;
+	if (!test_bit(PLOOP_S_NO_FALLOC_DISCARD, &plo->state))
+		return -EINVAL;
 
 	if (plo->maintenance_type != PLOOP_MNTN_DISCARD ||
 	    !test_bit(PLOOP_S_DISCARD_LOADED, &plo->state))
@@ -4766,7 +4769,8 @@ static void ploop_discard_restart(struct ploop_device *plo, int err)
 
 static int ploop_fbdrop_ioc(struct ploop_device *plo)
 {
-	return -EINVAL;
+	if (!test_bit(PLOOP_S_NO_FALLOC_DISCARD, &plo->state))
+		return -EINVAL;
 
 	if (list_empty(&plo->map.delta_list))
 		return -ENOENT;
@@ -4794,7 +4798,8 @@ static int ploop_relocblks_ioc(struct ploop_device *plo, unsigned long arg)
 	int err = 0;
 	int n_free;
 
-	return -EINVAL;
+	if (!test_bit(PLOOP_S_NO_FALLOC_DISCARD, &plo->state))
+		return -EINVAL;
 
 	if (list_empty(&plo->map.delta_list))
 		return -ENOENT;
diff --git a/drivers/block/ploop/discard.c b/drivers/block/ploop/discard.c
index 1920ab05e20b..e27af9baf477 100644
--- a/drivers/block/ploop/discard.c
+++ b/drivers/block/ploop/discard.c
@@ -17,7 +17,8 @@ int ploop_discard_init_ioc(struct ploop_device *plo)
 	struct ploop_freeblks_desc *fbd;
 	struct ploop_delta *delta = ploop_top_delta(plo);
 
-	return -EINVAL;
+	if (!test_bit(PLOOP_S_NO_FALLOC_DISCARD, &plo->state))
+		return -EINVAL;
 
 	if (delta == NULL)
 		return -EINVAL;
@@ -54,7 +55,8 @@ int ploop_discard_fini_ioc(struct ploop_device *plo)
 	struct ploop_request *preq, *tmp;
 	LIST_HEAD(drop_list);
 
-	return -EINVAL;
+	if (!test_bit(PLOOP_S_NO_FALLOC_DISCARD, &plo->state))
+		return -EINVAL;
 
 	if (!test_and_clear_bit(PLOOP_S_DISCARD, &plo->state))
 		return 0;
@@ -94,7 +96,8 @@ int ploop_discard_wait_ioc(struct ploop_device *plo)
 {
 	int err;
 
-	return -EINVAL;
+	if (!test_bit(PLOOP_S_NO_FALLOC_DISCARD, &plo->state))
+		return -EINVAL;
 
 	if (!test_bit(PLOOP_S_DISCARD, &plo->state))
 		return 0;



More information about the Devel mailing list