[Devel] [PATCH RHEL7 COMMIT] ploop: minor rework of ploop_req_delay_fua_possible

Konstantin Khorenko khorenko at virtuozzo.com
Mon Jun 27 00:10:22 PDT 2016


The commit is pushed to "branch-rh7-3.10.0-327.18.2.vz7.14.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-327.18.2.vz7.14.20
------>
commit b91a8b09b478e3c1f8d6b8fd0cf8c1d8f9ed7e84
Author: Maxim Patlasov <mpatlasov at virtuozzo.com>
Date:   Mon Jun 27 11:10:22 2016 +0400

    ploop: minor rework of ploop_req_delay_fua_possible
    
    Patchset description:
    ploop: fix barriers for reloc requests
    
    The series firstly fixes a few issues in handling
    barriers in ordinary requests (what was overlooked
    in previous patch -- see commit c2247f3745).
    
    Then there are a few minor rework w/o functional
    changes that alleviate main patches (last two ones).
    
    And finally the series fixes handling barriers
    for RELOC_A|S requests.
    
    The main complexity comes from the following bug:
    for direct_io it's not enough to send FUA to flush
    all nullified cluster block. See details in
    "fix barriers for PLOOP_E_RELOC_NULLIFY" patch.
    
    Dmitry Monakhov (2):
          ploop: minor rework of ->write_page() io method
          ploop: generalize issue_flush
    
    Maxim Patlasov (6):
          ploop: minor rework of ploop_req_delay_fua_possible
          ploop: resurrect delayed_fua for io_kaio
          ploop: resurrect delay_fua for io_direct
          ploop: remove preflush from dio_submit
          ploop: fix barriers for PLOOP_E_RELOC_NULLIFY
          ploop: fixup barrier handling during relocation
    
    https://jira.sw.ru/browse/PSBM-47107
    
    ========================================================
    This patch description:
    
    No functional changes. The patch simplifies ploop_req_delay_fua_possible
    to make it more suitable for next patch. As was recently discussed,
    "eng_state == E_DATA_WBI" is lesser prone to errors than
    "eng_state != E_COMPLETE".
    
    Note, how the patch makes a bug in kaio_complete_io_state() obvious:
    if !(preq->req_rw & REQ_FUA), it must not matter what
    ploop_req_delay_fua_possible() returns! I.e., eng_state==E_COMPLETE is
    not sufficient ground for post_fsync=1 if no REQ_FUA set.
    
    Signed-off-by: Maxim Patlasov <mpatlasov at virtuozzo.com>
    Acked-by: Dmitry Monakhov <dmonakhov at virtuozzo.com>
---
 drivers/block/ploop/io_direct.c |  2 +-
 drivers/block/ploop/io_kaio.c   |  3 +--
 include/linux/ploop/ploop.h     | 15 ++-------------
 3 files changed, 4 insertions(+), 16 deletions(-)

diff --git a/drivers/block/ploop/io_direct.c b/drivers/block/ploop/io_direct.c
index 50cdbf7..6d1d32a 100644
--- a/drivers/block/ploop/io_direct.c
+++ b/drivers/block/ploop/io_direct.c
@@ -103,7 +103,7 @@ dio_submit(struct ploop_io *io, struct ploop_request * preq,
 	if (test_and_clear_bit(PLOOP_REQ_FORCE_FUA, &preq->state))
 		postfua = 1;
 
-	if (!postfua && ploop_req_delay_fua_possible(rw, preq)) {
+	if (!postfua && ploop_req_delay_fua_possible(preq) && (rw & REQ_FUA)) {
 
 		/* Mark req that delayed flush required */
 		set_bit(PLOOP_REQ_FORCE_FLUSH, &preq->state);
diff --git a/drivers/block/ploop/io_kaio.c b/drivers/block/ploop/io_kaio.c
index 81da1c5..69df456 100644
--- a/drivers/block/ploop/io_kaio.c
+++ b/drivers/block/ploop/io_kaio.c
@@ -84,8 +84,7 @@ static void kaio_complete_io_state(struct ploop_request * preq)
 		post_fsync = 1;
 
 	if (!post_fsync &&
-	    !ploop_req_delay_fua_possible(preq->req_rw, preq) &&
-	    (preq->req_rw & REQ_FUA))
+	    !(ploop_req_delay_fua_possible(preq) && (preq->req_rw & REQ_FUA)))
 		post_fsync = 1;
 
 	preq->req_rw &= ~REQ_FUA;
diff --git a/include/linux/ploop/ploop.h b/include/linux/ploop/ploop.h
index 3441e7e..e1d8686 100644
--- a/include/linux/ploop/ploop.h
+++ b/include/linux/ploop/ploop.h
@@ -613,20 +613,9 @@ void ploop_preq_drop(struct ploop_device * plo, struct list_head *drop_list,
 		      int keep_locked);
 
 
-static inline int ploop_req_delay_fua_possible(unsigned long rw,
-       struct ploop_request *preq)
+static inline int ploop_req_delay_fua_possible(struct ploop_request *preq)
 {
-	int delay_fua = 0;
-
-	/* In case of eng_state != COMPLETE, we'll do FUA in
-	 * ploop_index_update(). Otherwise, we should post
-	 * fua.
-	 */
-	if (rw & REQ_FUA) {
-		if (preq->eng_state != PLOOP_E_COMPLETE)
-			delay_fua = 1;
-	}
-	return delay_fua;
+	return preq->eng_state == PLOOP_E_DATA_WBI;
 }
 
 static inline void ploop_req_set_error(struct ploop_request * preq, int err)


More information about the Devel mailing list