[Devel] [PATCH RHEL7 COMMIT] ploop: get rid of FOP_FSYNC

Konstantin Khorenko khorenko at virtuozzo.com
Mon May 23 01:47:00 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.5
------>
commit a15932d4cad507715a4b0c55ff56561145577fb0
Author: Maxim Patlasov <mpatlasov at virtuozzo.com>
Date:   Mon May 23 12:47:00 2016 +0400

    ploop: get rid of FOP_FSYNC
    
    Patchset description:
    
    ploop: clean up fsync mess
    
    There are too many fsync functions in ploop. The patch set gets rid of
    FOP_FSYNC and dio_fsync by accepting the following assumptions:
    
    1) We don't support old kernels (like <2.6.32)
    2) We don't support host file systems without fsync fop
    
    Maxim Patlasov (4):
          ploop: get rid of FOP_FSYNC
          ploop: io_direct: check for fsync fop on startup
          ploop: get rid of dio_fsync()
          ploop: get rid of direct calls to file->f_op->fsync()
    
    ===========================================
    This patch description:
    
    We keep ploop sources as in-tree module of rhel7-based kernel. So we know
    for sure how fsync fop prototype looks like.
    
    Signed-off-by: Maxim Patlasov <mpatlasov at virtuozzo.com>
    Acked-by: Dmitry Monakhov <dmonakhov at openvz.org>
---
 drivers/block/ploop/io_direct.c | 15 +++++++++------
 include/linux/ploop/compat.h    |  6 ------
 2 files changed, 9 insertions(+), 12 deletions(-)

diff --git a/drivers/block/ploop/io_direct.c b/drivers/block/ploop/io_direct.c
index 5a2e12a..583b110 100644
--- a/drivers/block/ploop/io_direct.c
+++ b/drivers/block/ploop/io_direct.c
@@ -406,7 +406,8 @@ try_again:
 			}
 
 			/* flush new i_size to disk */
-			err = io->files.file->f_op->FOP_FSYNC(io->files.file, 0);
+			err = io->files.file->f_op->fsync(io->files.file, 0,
+							  LLONG_MAX, 0);
 			if (err)
 				goto end_write;
 
@@ -524,7 +525,8 @@ dio_post_submit(struct ploop_io *io, struct ploop_request * preq)
 					      FALLOC_FL_CONVERT_UNWRITTEN,
 					      (loff_t)sec << 9, clu_siz);
 	if (!err)
-		err = io->files.file->f_op->FOP_FSYNC(io->files.file, 0);
+		err = io->files.file->f_op->fsync(io->files.file, 0,
+						  LLONG_MAX, 0);
 	file_end_write(io->files.file);
 	if (err) {
 		PLOOP_REQ_SET_ERROR(preq, err);
@@ -815,8 +817,8 @@ static int dio_fsync_thread(void * data)
 
 		err = 0;
 		if (io->files.file->f_op->fsync)
-			err = io->files.file->f_op->FOP_FSYNC(io->files.file,
-							      0);
+			err = io->files.file->f_op->fsync(io->files.file, 0,
+							  LLONG_MAX, 0);
 
 		/* Do we need to invalidate page cache? Not really,
 		 * because we use it only to create full new pages,
@@ -853,7 +855,7 @@ static int dio_fsync(struct file * file)
 	ret = filemap_write_and_wait(mapping);
 	err = 0;
 	if (file->f_op && file->f_op->fsync) {
-		err = file->f_op->FOP_FSYNC(file, 0);
+		err = file->f_op->fsync(file, 0, LLONG_MAX, 0);
 		if (!ret)
 			ret = err;
 	}
@@ -1385,7 +1387,8 @@ static int dio_alloc_sync(struct ploop_io * io, loff_t pos, loff_t len)
 		goto fail;
 
 	if (io->files.file->f_op && io->files.file->f_op->fsync) {
-		err = io->files.file->f_op->FOP_FSYNC(io->files.file, 0);
+		err = io->files.file->f_op->fsync(io->files.file, 0,
+						  LLONG_MAX, 0);
 		if (err)
 			goto fail;
 	}
diff --git a/include/linux/ploop/compat.h b/include/linux/ploop/compat.h
index 03c3ae3..8a36d81 100644
--- a/include/linux/ploop/compat.h
+++ b/include/linux/ploop/compat.h
@@ -58,10 +58,4 @@ static void func(struct bio *bio, int err) {
 
 #endif
 
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,32)
-#define FOP_FSYNC(file, datasync) fsync(file, 0, LLONG_MAX, datasync)
-#else
-#define FOP_FSYNC(file, datasync) fsync(file, F_DENTRY(file), datasync)
-#endif
-
 #endif


More information about the Devel mailing list