[Devel] [PATCH 3/6] ploop: Remove now unused PLOOP_REQ_DISCARD branches

Kirill Tkhai ktkhai at virtuozzo.com
Tue Apr 30 13:03:40 MSK 2019


This flag is never set anymore, so the patch
kills all unused branches under it.

Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 drivers/block/ploop/dev.c        |   14 +-------------
 drivers/block/ploop/events.h     |    3 +--
 drivers/block/ploop/fmt_ploop1.c |    4 +---
 include/linux/ploop/ploop.h      |    5 -----
 4 files changed, 3 insertions(+), 23 deletions(-)

diff --git a/drivers/block/ploop/dev.c b/drivers/block/ploop/dev.c
index 6fcd942004a1..eb9df4369488 100644
--- a/drivers/block/ploop/dev.c
+++ b/drivers/block/ploop/dev.c
@@ -791,9 +791,6 @@ process_discard_bio_queue(struct ploop_device * plo, struct list_head *drop_list
 		if (tmp == NULL)
 			break;
 
-		/* If PLOOP_S_DISCARD isn't set, ploop_bio_queue
-		 * will complete it with a proper error.
-		 */
 		ploop_bio_queue(plo, tmp, drop_list, 0);
 	}
 }
@@ -1773,8 +1770,7 @@ static inline bool preq_is_special(struct ploop_request * preq)
 	return state & (PLOOP_REQ_MERGE_FL |
 			PLOOP_REQ_RELOC_A_FL |
 			PLOOP_REQ_RELOC_S_FL |
-			PLOOP_REQ_RELOC_N_FL |
-			PLOOP_REQ_DISCARD_FL);
+			PLOOP_REQ_RELOC_N_FL);
 }
 
 void ploop_add_req_to_fsync_queue(struct ploop_request * preq)
@@ -1805,9 +1801,6 @@ static bool ploop_can_issue_discard(struct ploop_device *plo,
 	if (!native_discard_support)
 		return false;
 
-	if (test_bit(PLOOP_REQ_DISCARD, &preq->state))
-		return true;
-
 	if (test_bit(PLOOP_S_NO_FALLOC_DISCARD, &plo->state))
 		return false;
 
@@ -2719,11 +2712,6 @@ static int ploop_thread(void * data)
 			plo->active_reqs++;
 			ploop_entry_qlen_dec(preq);
 
-			if (test_bit(PLOOP_REQ_DISCARD, &preq->state)) {
-				BUG_ON(plo->maintenance_type != PLOOP_MNTN_DISCARD);
-				atomic_inc(&plo->maintenance_cnt);
-			}
-
 			if (test_bit(PLOOP_REQ_SORTED, &preq->state)) {
 				rb_erase(&preq->lockout_link, req_entry_tree(plo, preq->req_rw));
 				__clear_bit(PLOOP_REQ_SORTED, &preq->state);
diff --git a/drivers/block/ploop/events.h b/drivers/block/ploop/events.h
index 2db09d9ac34b..57f72e6b3b80 100644
--- a/drivers/block/ploop/events.h
+++ b/drivers/block/ploop/events.h
@@ -43,8 +43,7 @@
 			{ 1 << PLOOP_REQ_MERGE,		"M"},	\
 			{ 1 << PLOOP_REQ_RELOC_A,	"RA"},	\
 			{ 1 << PLOOP_REQ_RELOC_S,	"RS"},	\
-			{ 1 << PLOOP_REQ_RELOC_N,	"RN"},	\
-			{ 1 << PLOOP_REQ_DISCARD,	"D"})
+			{ 1 << PLOOP_REQ_RELOC_N,	"RN"})
 
 #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/fmt_ploop1.c b/drivers/block/ploop/fmt_ploop1.c
index 2ae22179c9c5..a09a52c651ea 100644
--- a/drivers/block/ploop/fmt_ploop1.c
+++ b/drivers/block/ploop/fmt_ploop1.c
@@ -356,10 +356,8 @@ ploop1_allocate(struct ploop_delta * delta, struct ploop_request * preq,
 static void
 ploop1_allocate_complete(struct ploop_delta * delta, struct ploop_request * preq)
 {
-	if ((preq->req_rw & REQ_DISCARD) &&
-	    !test_bit(PLOOP_REQ_DISCARD, &preq->state)) {
+	if (preq->req_rw & REQ_DISCARD)
 		preq->iblock = 0;
-	}
 
 	ploop_index_update(preq);
 }
diff --git a/include/linux/ploop/ploop.h b/include/linux/ploop/ploop.h
index 752da47e471e..7066857e2b3b 100644
--- a/include/linux/ploop/ploop.h
+++ b/include/linux/ploop/ploop.h
@@ -53,9 +53,6 @@ enum {
 				 * consumed by userspace yet */
 	PLOOP_S_CONGESTED,	/* Too many bios submitted to us */
 	PLOOP_S_NO_FALLOC_DISCARD, /* FIXME: Remove this: Unable to handle discard requests by fallocate */
-	PLOOP_S_DISCARD,	/* Obsolete: ploop is ready to handle discard request */
-	PLOOP_S_DISCARD_LOADED,	/* Obsolete: A discard request was handled and
-				   free blocks loaded */
 	PLOOP_S_LOCKED,	        /* ploop is locked by userspace
 				   (for minor mgmt only) */
 	PLOOP_S_ONCE,	        /* An event (e.g. printk once) happened */
@@ -491,7 +488,6 @@ 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_DISCARD,	/* Obsolete */
 	PLOOP_REQ_RSYNC,
 	PLOOP_REQ_KAIO_FSYNC,	/*force image fsync by KAIO module */
 	PLOOP_REQ_POST_SUBMIT, /* preq needs post_submit processing */
@@ -505,7 +501,6 @@ enum
 #define PLOOP_REQ_RELOC_A_FL (1 << PLOOP_REQ_RELOC_A)
 #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 */
 
 enum
 {



More information about the Devel mailing list