[Devel] [PATCH RHEL7 COMMIT] ploop: fix processing sync bios

Konstantin Khorenko khorenko at virtuozzo.com
Fri Jun 26 04:18:10 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.18
------>
commit 4693de9957f121dc5fdefdcb6627edc16cc683ec
Author: Maxim Patlasov <MPatlasov at openvz.org>
Date:   Fri Jun 26 15:18:10 2015 +0400

    ploop: fix processing sync bios
    
    On 3.10.x, bios marked with REQ_SYNC doesn't affect plug/unplug
    behavior. So, it's OK to propagate REQ_SYNC transparently from
    incoming bios to ploop requests, and then to outgoing bios.
    
    On the other hand, unlike to 2.6.32-*, our ploop_unplug
    callback is called every time as upper layers finish sending
    a batch of bios. Hence, we needn't to wakeup our ploop_thread
    as soon as ploop_make_request queued a REQ_SYNC bio. ploop_unplug
    will do it at proper moment. (*)
    
    The problem that diff-ploop-fix-recognition-of-sync-bio-2 resolved
    for 2.6.32-* is fixed by (*) because now, when ploop_thread is not
    woken up immediately, the first ploop request sits in the entry
    queue for long enough to have all subsequent bios to be merged.
    
    https://jira.sw.ru/browse/PSBM-33630
    
    Signed-off-by: Maxim Patlasov <MPatlasov at openvz.org>
---
 drivers/block/ploop/dev.c       |  6 +++++-
 drivers/block/ploop/io_direct.c | 10 +++++-----
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/drivers/block/ploop/dev.c b/drivers/block/ploop/dev.c
index 95b335c..30eb8a7 100644
--- a/drivers/block/ploop/dev.c
+++ b/drivers/block/ploop/dev.c
@@ -990,7 +990,7 @@ queued:
 	if (test_bit(PLOOP_S_WAIT_PROCESS, &plo->state)) {
 		/* Synchronous requests are not batched. */
 		if (plo->entry_qlen > plo->tune.batch_entry_qlen ||
-			(bio->bi_rw & (REQ_SYNC|REQ_FLUSH|REQ_FUA)) ||
+			(bio->bi_rw & (REQ_FLUSH|REQ_FUA)) ||
 			(!bio_list_empty(&plo->bio_discard_list) &&
 			 !list_empty(&plo->free_list)) ||
 			!current->plug) {
@@ -1972,6 +1972,10 @@ ploop_entry_request(struct ploop_request * preq)
 		return;
 	}
 
+	if (unlikely(test_bit(PLOOP_REQ_SYNC, &preq->state) &&
+		     !(preq->req_rw & REQ_SYNC)))
+		preq->req_rw |= REQ_SYNC;
+
 restart:
 	if (test_bit(PLOOP_REQ_DISCARD, &preq->state)) {
 		err = ploop_entry_discard_req(preq);
diff --git a/drivers/block/ploop/io_direct.c b/drivers/block/ploop/io_direct.c
index a3eb173..793bcc5 100644
--- a/drivers/block/ploop/io_direct.c
+++ b/drivers/block/ploop/io_direct.c
@@ -251,7 +251,7 @@ flush_bio:
 			rw2 |= (REQ_FUA | ((bio_num) ? REQ_FLUSH : 0));
 
 		ploop_acc_ff_out(preq->plo, rw2 | b->bi_rw);
-		submit_bio(rw2 & ~(bl.head ? REQ_SYNC : 0), b);
+		submit_bio(rw2, b);
 		bio_num++;
 	}
 
@@ -618,7 +618,7 @@ flush_bio:
 			preflush = 0;
 		}
 		ploop_acc_ff_out(preq->plo, rw | b->bi_rw);
-		submit_bio(rw & ~(bl.head ? REQ_SYNC : 0), b);
+		submit_bio(rw, b);
 	}
 
 	ploop_complete_io_request(preq);
@@ -1072,7 +1072,7 @@ flush_bio:
 		b->bi_end_io = dio_endio_sync;
 		b->bi_private = &comp;
 		atomic_inc(&comp.count);
-		submit_bio(rw & ~(bl.head ? REQ_SYNC : 0), b);
+		submit_bio(rw, b);
 	}
 
 	if (atomic_dec_and_test(&comp.count))
@@ -1196,7 +1196,7 @@ flush_bio:
 		b->bi_end_io = dio_endio_sync;
 		b->bi_private = &comp;
 		atomic_inc(&comp.count);
-		submit_bio(rw & ~(bl.head ? REQ_SYNC : 0), b);
+		submit_bio(rw, b);
 	}
 
 	if (atomic_dec_and_test(&comp.count))
@@ -1437,7 +1437,7 @@ flush_bio:
 		b->bi_private = preq;
 		atomic_inc(&preq->io_count);
 		ploop_acc_ff_out(preq->plo, rw2 | b->bi_rw);
-		submit_bio(rw2 | (bl.head ? 0 : REQ_SYNC), b);
+		submit_bio(rw2, b);
 		bio_num++;
 	}
 



More information about the Devel mailing list