[Devel] [PATCH RHEL7 COMMIT] ploop: added ploop_req_delay_fua_possible() func that detects possible delaying of upcoming FUA to index update stage

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

    ploop: added ploop_req_delay_fua_possible() func that detects possible delaying of upcoming FUA to index update stage
    
    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:
    
    This function will be lately used in direct/kaio code to detect and delay FUA.
    
    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>
---
 include/linux/ploop/ploop.h | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/include/linux/ploop/ploop.h b/include/linux/ploop/ploop.h
index eacd36a..d8b83a6 100644
--- a/include/linux/ploop/ploop.h
+++ b/include/linux/ploop/ploop.h
@@ -577,6 +577,23 @@ void ploop_fail_request(struct ploop_request * preq, int err);
 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)
+{
+	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;
+}
+
 static inline void ploop_set_error(struct ploop_request * preq, int err)
 {
 	if (!preq->error) {



More information about the Devel mailing list