[Devel] [PATCH RHEL7 COMMIT] Revert "ploop: Remove now unused PLOOP_REQ_ZERO branches"

Konstantin Khorenko khorenko at virtuozzo.com
Tue May 21 17:44:29 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 adecc8644e2e7c4f0bcf51927eda0b81cf1d8e1a
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date:   Tue May 21 17:44:27 2019 +0300

    Revert "ploop: Remove now unused PLOOP_REQ_ZERO branches"
    
    This reverts commit 7782c0be0c18fe3b27984388cde50dfa04c07f4e.
    
    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    |  5 ++++-
 drivers/block/ploop/events.h |  1 +
 drivers/block/ploop/map.c    | 19 ++++++++++++++++++-
 include/linux/ploop/ploop.h  |  2 ++
 4 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/drivers/block/ploop/dev.c b/drivers/block/ploop/dev.c
index e9239f26e5cd..4d3b62d85251 100644
--- a/drivers/block/ploop/dev.c
+++ b/drivers/block/ploop/dev.c
@@ -244,6 +244,8 @@ void ploop_preq_drop(struct ploop_device * plo, struct list_head *drop_list)
 		put_beancounter(preq->preq_ub);
 		preq->preq_ub = NULL;
 #endif
+
+		BUG_ON (test_bit(PLOOP_REQ_ZERO, &preq->state));
 		ploop_test_and_clear_blockable(plo, preq);
 		drop_qlen++;
 	}
@@ -1774,7 +1776,8 @@ static inline bool preq_is_special(struct ploop_request * preq)
 			PLOOP_REQ_RELOC_A_FL |
 			PLOOP_REQ_RELOC_S_FL |
 			PLOOP_REQ_RELOC_N_FL |
-			PLOOP_REQ_DISCARD_FL);
+			PLOOP_REQ_DISCARD_FL |
+			PLOOP_REQ_ZERO_FL);
 }
 
 void ploop_add_req_to_fsync_queue(struct ploop_request * preq)
diff --git a/drivers/block/ploop/events.h b/drivers/block/ploop/events.h
index 2db09d9ac34b..62144e1b79d6 100644
--- a/drivers/block/ploop/events.h
+++ b/drivers/block/ploop/events.h
@@ -44,6 +44,7 @@
 			{ 1 << PLOOP_REQ_RELOC_A,	"RA"},	\
 			{ 1 << PLOOP_REQ_RELOC_S,	"RS"},	\
 			{ 1 << PLOOP_REQ_RELOC_N,	"RN"},	\
+			{ 1 << PLOOP_REQ_ZERO,		"Z"},	\
 			{ 1 << PLOOP_REQ_DISCARD,	"D"})
 
 #define PREQ_FORMAT "preq=0x%p cluster=0x%x iblock=0x%x size=0x%x eng_state=0x%lx state=%s rw=%s"
diff --git a/drivers/block/ploop/map.c b/drivers/block/ploop/map.c
index e03df205b0ab..b8103cfcc79b 100644
--- a/drivers/block/ploop/map.c
+++ b/drivers/block/ploop/map.c
@@ -913,6 +913,14 @@ void ploop_index_update(struct ploop_request * preq)
 		}
 	}
 
+	BUG_ON (test_bit(PLOOP_REQ_ZERO, &preq->state) && preq->iblock);
+	if (test_bit(PLOOP_REQ_ZERO, &preq->state) && !blk) {
+		printk("Either map_node is corrupted or bug in "
+		       "ploop-balloon (%u)\n", preq->req_cluster);
+		PLOOP_REQ_SET_ERROR(preq, -EIO);
+		goto corrupted;
+	}
+
 	if (blk == preq->iblock && top_delta->level == old_level)
 		goto out;
 
@@ -959,6 +967,7 @@ void ploop_index_update(struct ploop_request * preq)
 
 enomem:
 	PLOOP_REQ_SET_ERROR(preq, -ENOMEM);
+corrupted:
 	set_bit(PLOOP_S_ABORT, &plo->state);
 out:
 	preq->eng_state = PLOOP_E_COMPLETE;
@@ -1078,12 +1087,20 @@ static void map_wb_complete(struct map_node * m, int err)
 				struct ploop_request *pr = preq;
 				int do_levels_update = 0;
 
+				if (unlikely(test_bit(PLOOP_REQ_ZERO, &preq->state))) {
+					BUG_ON (list_empty(&preq->delay_list));
+					pr = list_first_entry(&preq->delay_list,
+							      struct ploop_request,
+							      list);
+				}
+
 				if (m->levels &&  m->levels[idx] != top_delta->level) {
 					spin_lock_irq(&plo->lock);
 					do_levels_update = 1;
 				}
 
-				if (unlikely(test_bit(PLOOP_REQ_RELOC_A, &preq->state)))
+				if (unlikely(test_bit(PLOOP_REQ_RELOC_A, &preq->state) ||
+					     test_bit(PLOOP_REQ_ZERO, &preq->state)))
 					map_idx_swap(m, idx, &pr->iblock,
 						     ploop_map_log(plo));
 				else
diff --git a/include/linux/ploop/ploop.h b/include/linux/ploop/ploop.h
index 942433cc2ce8..1493e4138254 100644
--- a/include/linux/ploop/ploop.h
+++ b/include/linux/ploop/ploop.h
@@ -491,6 +491,7 @@ enum
 	PLOOP_REQ_RELOC_A,	/* 'A' stands for allocate() */
 	PLOOP_REQ_RELOC_S,	/* Obsolete: 'S' stands for submit() */
 	PLOOP_REQ_RELOC_N,	/* 'N' stands for "nullify" */
+	PLOOP_REQ_ZERO,		/* Obsolete */
 	PLOOP_REQ_DISCARD,	/* Obsolete */
 	PLOOP_REQ_RSYNC,
 	PLOOP_REQ_KAIO_FSYNC,	/*force image fsync by KAIO module */
@@ -506,6 +507,7 @@ enum
 #define PLOOP_REQ_RELOC_S_FL (1 << PLOOP_REQ_RELOC_S) /* Obsolete */
 #define PLOOP_REQ_RELOC_N_FL (1 << PLOOP_REQ_RELOC_N)
 #define PLOOP_REQ_DISCARD_FL (1 << PLOOP_REQ_DISCARD)	/* Obsolete */
+#define PLOOP_REQ_ZERO_FL (1 << PLOOP_REQ_ZERO)		/* Obsolete */
 
 enum
 {



More information about the Devel mailing list