[Devel] [PATCH RHEL7 COMMIT] Revert "ploop: add a separate queue for discard bio-s (v2)"

Konstantin Khorenko khorenko at odin.com
Wed May 20 04:59:54 PDT 2015


The commit is pushed to "branch-rh7-3.10.0-123.1.2-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-123.1.2.vz7.5.4
------>
commit e9c37e639d34e65b95bd445042eae76f8e70d6a3
Author: Konstantin Khorenko <khorenko at openvz.org>
Date:   Wed May 20 15:58:34 2015 +0400

    Revert "ploop: add a separate queue for discard bio-s (v2)"
    
    This reverts commit fa6f3b8595f13c13eebd452bc0947754ac249c2c.
    
    This patch causes mkfs.ext4 hangs during ploop init =>
    roll it back until we have proper fix.
    
    https://jira.sw.ru/browse/PSBM-33633
    
    Signed-off-by: Andrey Smetanin <asmetanin at virtuozzo.com>
---
 drivers/block/ploop/dev.c      | 54 ++++++++----------------------------------
 drivers/block/ploop/freeblks.c |  5 ----
 drivers/block/ploop/freeblks.h |  1 -
 drivers/block/ploop/sysfs.c    |  6 -----
 include/linux/ploop/ploop.h    |  2 --
 5 files changed, 10 insertions(+), 58 deletions(-)

diff --git a/drivers/block/ploop/dev.c b/drivers/block/ploop/dev.c
index ca6333a..cd91d2c 100644
--- a/drivers/block/ploop/dev.c
+++ b/drivers/block/ploop/dev.c
@@ -119,9 +119,8 @@ static void mitigation_timeout(unsigned long data)
 	spin_lock_irq(&plo->lock);
 	if (test_bit(PLOOP_S_WAIT_PROCESS, &plo->state) &&
 	    (!list_empty(&plo->entry_queue) ||
-	     ((plo->bio_head && !bio_list_empty(&plo->bio_discard_list)) &&
-		!list_empty(&plo->free_list))) &&
-		waitqueue_active(&plo->waitq))
+	     (plo->bio_head && !list_empty(&plo->free_list))) &&
+	    waitqueue_active(&plo->waitq))
 		wake_up_interruptible(&plo->waitq);
 	spin_unlock_irq(&plo->lock);
 }
@@ -240,8 +239,7 @@ void ploop_preq_drop(struct ploop_device * plo, struct list_head *drop_list,
 	if (waitqueue_active(&plo->req_waitq))
 		wake_up(&plo->req_waitq);
 	else if (test_bit(PLOOP_S_WAIT_PROCESS, &plo->state) &&
-		waitqueue_active(&plo->waitq) &&
-		(plo->bio_head || !bio_list_empty(&plo->bio_discard_list)))
+		waitqueue_active(&plo->waitq) && plo->bio_head)
 		wake_up_interruptible(&plo->waitq);
 
 	ploop_uncongest(plo);
@@ -523,7 +521,6 @@ ploop_bio_queue(struct ploop_device * plo, struct bio * bio,
 			BIO_ENDIO(plo->queue, bio, err);
 			list_add(&preq->list, &plo->free_list);
 			plo->bio_qlen--;
-			plo->bio_discard_qlen--;
 			plo->bio_total--;
 			return;
 		}
@@ -761,28 +758,6 @@ static void ploop_unplug(struct blk_plug_cb *cb, bool from_schedule)
 	kfree(cb);
 }
 
-static void
-process_discard_bio_queue(struct ploop_device *plo, struct list_head *drop_list)
-{
-	bool discard = test_bit(PLOOP_S_DISCARD, &plo->state);
-	while (!list_empty(&plo->free_list)) {
-		struct bio *tmp;
-
-		/* Only one discard bio can be handled concurrently */
-		if (discard && ploop_discard_is_inprogress(plo->fbd))
-			return;
-
-		tmp = bio_list_pop(&plo->bio_discard_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);
-	}
-}
-
 static void ploop_make_request(struct request_queue *q, struct bio *bio)
 {
 	struct bio * nbio;
@@ -870,12 +845,6 @@ static void ploop_make_request(struct request_queue *q, struct bio *bio)
 		return;
 	}
 
-	if (bio->bi_rw & REQ_DISCARD) {
-		bio_list_add(&plo->bio_discard_list, bio);
-		plo->bio_discard_qlen++;
-		goto queued;
-	}
-
 	/* Write tracking in fast path does not work at the moment. */
 	if (unlikely(test_bit(PLOOP_S_TRACK, &plo->state) &&
 		     (bio->bi_rw & WRITE)))
@@ -897,6 +866,9 @@ static void ploop_make_request(struct request_queue *q, struct bio *bio)
 	if (unlikely(nbio == NULL))
 		goto queue;
 
+	if (bio->bi_rw & REQ_DISCARD)
+		goto queue;
+
 	/* Try to merge before checking for fastpath. Maybe, this
 	 * is not wise.
 	 */
@@ -978,7 +950,6 @@ queue:
 	/* second chance to merge requests */
 	process_bio_queue(plo, &drop_list);
 
-queued:
 	/* If main thread is waiting for requests, wake it up.
 	 * But try to mitigate wakeups, delaying wakeup for some short
 	 * time.
@@ -1297,9 +1268,7 @@ static void ploop_complete_request(struct ploop_request * preq)
 		if (waitqueue_active(&plo->req_waitq))
 			wake_up(&plo->req_waitq);
 		else if (test_bit(PLOOP_S_WAIT_PROCESS, &plo->state) &&
-			 waitqueue_active(&plo->waitq) &&
-			 (plo->bio_head ||
-			  !bio_list_empty(&plo->bio_discard_list)))
+			 waitqueue_active(&plo->waitq) && plo->bio_head)
 			wake_up_interruptible(&plo->waitq);
 	}
 	plo->bio_total -= nr_completed;
@@ -2571,8 +2540,7 @@ static void ploop_wait(struct ploop_device * plo, int once, struct blk_plug *plu
 			    (!test_bit(PLOOP_S_ATTENTION, &plo->state) ||
 			     !plo->active_reqs))
 				break;
-		} else if (plo->bio_head ||
-				!bio_list_empty(&plo->bio_discard_list)) {
+		} else if (plo->bio_head) {
 			/* ready_queue and entry_queue are empty, but
 			 * bio list not. Obviously, we'd like to process
 			 * bio_list instead of sleeping */
@@ -2672,7 +2640,7 @@ static int ploop_thread(void * data)
 		BUG_ON (!list_empty(&drop_list));
 
 		process_bio_queue(plo, &drop_list);
-		process_discard_bio_queue(plo, &drop_list);
+
 		if (!list_empty(&drop_list)) {
 			spin_unlock_irq(&plo->lock);
 			ploop_preq_drop(plo, &drop_list, 1);
@@ -2748,8 +2716,7 @@ static int ploop_thread(void * data)
 		 * no requests are in process or in entry queue
 		 */
 		if (kthread_should_stop() && !plo->active_reqs &&
-		    list_empty(&plo->entry_queue) && !plo->bio_head &&
-		    bio_list_empty(&plo->bio_discard_list))
+		    list_empty(&plo->entry_queue) && !plo->bio_head)
 			break;
 
 wait_more:
@@ -4634,7 +4601,6 @@ static struct ploop_device *__ploop_dev_alloc(int index)
 	map_init(plo, &plo->map);
 	track_init(plo);
 	KOBJECT_INIT(&plo->kobj, &ploop_ktype);
-	bio_list_init(&plo->bio_discard_list);
 	atomic_inc(&plo_count);
 
 	dk->major		= ploop_major;
diff --git a/drivers/block/ploop/freeblks.c b/drivers/block/ploop/freeblks.c
index cf48d3a..b3a5908 100644
--- a/drivers/block/ploop/freeblks.c
+++ b/drivers/block/ploop/freeblks.c
@@ -1081,8 +1081,3 @@ int ploop_discard_add_bio(struct ploop_freeblks_desc *fbd, struct bio *bio)
 
 	return 0;
 }
-
-int ploop_discard_is_inprogress(struct ploop_freeblks_desc *fbd)
-{
-	return fbd && fbd->fbd_dbl.head != NULL;
-}
diff --git a/drivers/block/ploop/freeblks.h b/drivers/block/ploop/freeblks.h
index 63591d0..5b03eec 100644
--- a/drivers/block/ploop/freeblks.h
+++ b/drivers/block/ploop/freeblks.h
@@ -12,7 +12,6 @@ int ploop_fb_add_reloc_extent(struct ploop_freeblks_desc *fbd, cluster_t clu, ib
 void ploop_fb_lost_range_init(struct ploop_freeblks_desc *fbd, iblock_t first_lost_iblk);
 void ploop_fb_relocation_start(struct ploop_freeblks_desc *fbd, __u32 n_scanned);
 int ploop_discard_add_bio(struct ploop_freeblks_desc *fbd, struct bio *bio);
-int ploop_discard_is_inprogress(struct ploop_freeblks_desc *fbd);
 
 /* avoid direct access to freeblks internals */
 int ploop_fb_get_n_relocated(struct ploop_freeblks_desc *fbd);
diff --git a/drivers/block/ploop/sysfs.c b/drivers/block/ploop/sysfs.c
index 06b2a71..07a4829 100644
--- a/drivers/block/ploop/sysfs.c
+++ b/drivers/block/ploop/sysfs.c
@@ -269,11 +269,6 @@ static u32 show_queued_bios(struct ploop_device * plo)
 	return plo->bio_qlen;
 }
 
-static u32 show_discard_bios(struct ploop_device *plo)
-{
-	return plo->bio_discard_qlen;
-}
-
 static u32 show_active_reqs(struct ploop_device * plo)
 {
 	return plo->active_reqs;
@@ -466,7 +461,6 @@ static struct attribute *state_attributes[] = {
 	_A(fmt_version),
 	_A(total_bios),
 	_A(queued_bios),
-	_A(discard_bios),
 	_A(active_reqs),
 	_A(entry_reqs),
 	_A(entry_read_sync_reqs),
diff --git a/include/linux/ploop/ploop.h b/include/linux/ploop/ploop.h
index b8c7130..0f67d06 100644
--- a/include/linux/ploop/ploop.h
+++ b/include/linux/ploop/ploop.h
@@ -350,8 +350,6 @@ struct ploop_device
 	struct bio		*bio_head;
 	struct bio		*bio_tail;
 	struct bio		*bio_sync;
-	struct bio_list		bio_discard_list;
-	int			bio_discard_qlen;
 	int			bio_qlen;
 	int			bio_total;
 



More information about the Devel mailing list