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 <asmeta...@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: 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. 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 <asmeta...@parallels.com> Reviewed-by: Andrew Vagin <ava...@parallels.com> --- drivers/block/ploop/io_direct.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/drivers/block/ploop/io_direct.c b/drivers/block/ploop/io_direct.c index 5e2e078..2e81d81 100644 --- a/drivers/block/ploop/io_direct.c +++ b/drivers/block/ploop/io_direct.c @@ -85,6 +85,7 @@ dio_submit(struct ploop_io *io, struct ploop_request * preq, int preflush; int postfua = 0; int write = !!(rw & REQ_WRITE); + int bio_num; trace_submit(preq); @@ -215,6 +216,7 @@ flush_bio: } extent_put(em); + bio_num = 0; while (bl.head) { struct bio * b = bl.head; unsigned long rw2 = rw; @@ -230,10 +232,11 @@ flush_bio: preflush = 0; } if (unlikely(postfua && !bl.head)) - rw2 |= REQ_FUA; + 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); + bio_num++; } ploop_complete_io_request(preq); @@ -1341,9 +1344,12 @@ dio_io_page(struct ploop_io * io, unsigned long rw, int err; int off; int postfua; + int bio_num; + int preflush; + preflush = !!(rw & REQ_FLUSH); postfua = !!(rw & REQ_FUA); - rw &= ~REQ_FUA; + rw &= ~(REQ_FUA|REQ_FLUSH); bio_list_init(&bl); bio = NULL; @@ -1396,13 +1402,19 @@ flush_bio: if (em) extent_put(em); + bio_num = 0; while (bl.head) { unsigned long rw2 = rw; struct bio * b = bl.head; bl.head = b->bi_next; + if (unlikely(preflush)) { + rw2 |= REQ_FLUSH; + preflush = 0; + } + if (unlikely(postfua && !bl.head)) - rw2 |= REQ_FUA; + rw2 |= (REQ_FUA | ((bio_num) ? REQ_FLUSH : 0)); b->bi_next = NULL; b->bi_end_io = dio_endio_async; @@ -1410,6 +1422,7 @@ flush_bio: atomic_inc(&preq->io_count); ploop_acc_ff_out(preq->plo, rw2 | b->bi_rw); submit_bio(rw2 | (bl.head ? 0 : REQ_SYNC), b); + bio_num++; } ploop_complete_io_request(preq); -- 1.9.3 _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel