[Devel] [PATCH RHEL7 COMMIT] ploop: skip redundant fsync for REQ_FUA in post_submit

Konstantin Khorenko khorenko at virtuozzo.com
Fri Jun 24 03:25:03 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.19
------>
commit 9374d303ce1038ae4af1fcfb018b3b0185b6123e
Author: Dmitry Monakhov <dmonakhov at openvz.org>
Date:   Fri Jun 24 14:25:03 2016 +0400

    ploop: skip redundant fsync for REQ_FUA in post_submit
    
    Signed-off-by: Dmitry Monakhov <dmonakhov at openvz.org>
    Acked-by: Maxim Patlasov <mpatlasov at virtuozzo.com>
---
 drivers/block/ploop/io_direct.c | 24 ++++++++++++++----------
 1 file changed, 14 insertions(+), 10 deletions(-)

diff --git a/drivers/block/ploop/io_direct.c b/drivers/block/ploop/io_direct.c
index 50c0ed1..e92fb64 100644
--- a/drivers/block/ploop/io_direct.c
+++ b/drivers/block/ploop/io_direct.c
@@ -522,27 +522,31 @@ dio_post_submit(struct ploop_io *io, struct ploop_request * preq)
 	struct ploop_device *plo = preq->plo;
 	sector_t sec = (sector_t)preq->iblock << preq->plo->cluster_log;
 	loff_t clu_siz = 1 << (preq->plo->cluster_log + 9);
+	int force_sync = preq->req_rw & REQ_FUA;
 	int err;
 
 	file_start_write(io->files.file);
 
-	/* Here io->io_count is even ... */
-	spin_lock_irq(&plo->lock);
-	io->io_count++;
-	set_bit(PLOOP_IO_FSYNC_DELAYED, &io->io_state);
-	spin_unlock_irq(&plo->lock);
-
+	if (!force_sync) {
+		/* Here io->io_count is even ... */
+		spin_lock_irq(&plo->lock);
+		io->io_count++;
+		set_bit(PLOOP_IO_FSYNC_DELAYED, &io->io_state);
+		spin_unlock_irq(&plo->lock);
+	}
 	err = io->files.file->f_op->fallocate(io->files.file,
 					      FALLOC_FL_CONVERT_UNWRITTEN,
 					      (loff_t)sec << 9, clu_siz);
 
 	/* highly unlikely case: FUA coming to a block not provisioned yet */
-	if (!err && (preq->req_rw & REQ_FUA))
+	if (!err && force_sync)
 		err = io->ops->sync(io);
 
-	spin_lock_irq(&plo->lock);
-	io->io_count++;
-	spin_unlock_irq(&plo->lock);
+	if (!force_sync) {
+		spin_lock_irq(&plo->lock);
+		io->io_count++;
+		spin_unlock_irq(&plo->lock);
+	}
 	/* and here io->io_count is even (+2) again. */
 
 	file_end_write(io->files.file);


More information about the Devel mailing list