[Devel] [PATCH rh7 1/4] ploop: get rid of FOP_FSYNC

Maxim Patlasov mpatlasov at virtuozzo.com
Wed May 18 18:22:59 PDT 2016


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>
---
 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