[Devel] [PATCH RHEL7 COMMIT] ploop: do preflush or postfua according force FUA/flush flags, and delay FUA if possible but add force FLUSH to req if so

Konstantin Khorenko khorenko at odin.com
Mon May 18 21:27:14 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.1
------>
commit 8c23b1f03f4249ebf76734408ff4ced909eabbfc
Author: Andrey Smetanin <asmetanin at virtuozzo.com>
Date:   Tue May 19 08:27:14 2015 +0400

    ploop: do preflush or postfua according force FUA/flush flags, and delay FUA if possible but add force FLUSH to req if so
    
    Series description:
    
    During relocation of ploop clusters (resize/baloon) we need to FUA/fsync
    image file after such operations:
     a) new data block wrote
     b) BAT update
     c) nullify old data block for BAT grow. We do this already nullify of old data
    block at format module -> complete_grow callback.
    
    This patch forses fsync(kaio), FUA(direct) of reloc write I/O to image
    by marking such reloc reqs(A|S) with appropriate flags. Kaio/direct modules
    tuned by patch to force fsync/FUA if these flags are set. This code does
    FUA/fsync only for a) and b) cases, while c) already implemented.
    
    Also patch fixes inconsistent bio list FUA processing in direct module.
    The problem is that for bunch of bios we only set FUA at last bio. Its possible
    in case of power outage that last bio will be stored and previos are not
    because they are stored only in cache at the time of power failure.
    To solve problem this patch marking last bio as FLUSH|FUA if more than one bio
    in list.
    
    Moreover for KAIO if fsync possible at BAT update stage we do that like we
    did in direct case instead of 2 fsync's. For direct case if we going to make
    FUA at BAT update only(optimization trick that already exists) then we need
    to mark req to FLUSH previously written(without FUA) data.
    
    Performance:
    Overall(includes EXT4 resize upto 16T) resize performance degradated by -5% of
    time.
    
    https://jira.sw.ru/browse/PSBM-31222
    https://jira.sw.ru/browse/PSBM-31225
    https://jira.sw.ru/browse/PSBM-31321
    
    Signed-off-by: Andrey Smetanin <asmetanin at parallels.com>
    
    Andrey Smetanin (7):
      ploop: define struct ploop_request->state flags to force pre FLUSH
        before write IO and FUA/fsync at I/O complete
      ploop: mark reloc reqs to force FUA/fsync(kaio) for index update I/O
      ploop: mark reloc reqs to force FUA before write of relocated data
      ploop: direct: to support truly FLUSH/FUA of req we need mark first
        bio FLUSH, write all bios and mark last bio as FLUSH/FUA
      ploop: added ploop_req_delay_fua_possible() func that detects possible
        delaying of upcoming FUA to index update stage. This function will
        be lately used in direct/kaio code to detect and delay FUA
      ploop: make image fsync at I/O complete if it's required by FUA/fsync
        force flag or by req->req_rw
      ploop: do preflush or postfua according force FUA/flush flags, and
        delay FUA if possible but add force FLUSH to req if so
    
    This patch description:
    Direct submit needs correct processing of FUA/FLUSH flags.
    
    https://jira.sw.ru/browse/PSBM-31222
    https://jira.sw.ru/browse/PSBM-31225
    https://jira.sw.ru/browse/PSBM-31321
    
    Signed-off-by: Andrey Smetanin <asmetanin at parallels.com>
    
    Reviewed-by: Andrew Vagin <avagin at parallels.com>
---
 drivers/block/ploop/io_direct.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/drivers/block/ploop/io_direct.c b/drivers/block/ploop/io_direct.c
index 2e81d81..2c3581f 100644
--- a/drivers/block/ploop/io_direct.c
+++ b/drivers/block/ploop/io_direct.c
@@ -90,7 +90,23 @@ dio_submit(struct ploop_io *io, struct ploop_request * preq,
 	trace_submit(preq);
 
 	preflush = !!(rw & REQ_FLUSH);
-	rw &= ~REQ_FLUSH;
+
+	if (test_and_clear_bit(PLOOP_REQ_FORCE_FLUSH, &preq->state))
+		preflush = 1;
+
+	if (test_and_clear_bit(PLOOP_REQ_FORCE_FUA, &preq->state))
+		postfua = 1;
+
+	if (!postfua && ploop_req_delay_fua_possible(rw, preq)) {
+
+		/* Mark req that delayed flush required */
+		set_bit(PLOOP_REQ_FORCE_FLUSH, &preq->state);
+	} else if (rw & REQ_FUA) {
+		postfua = 1;
+	}
+
+	rw &= ~(REQ_FLUSH | REQ_FUA);
+
 
 	/* In case of eng_state != COMPLETE, we'll do FUA in
 	 * ploop_index_update(). Otherwise, we should mark



More information about the Devel mailing list