]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
libcephfs: Add lazyio_propogate and lazyio_synchronize methods to libcephfs
authorSidharth Anupkrishnan <sanupkri@redhat.com>
Wed, 26 Jun 2019 13:29:06 +0000 (18:59 +0530)
committerSidharth Anupkrishnan <sanupkri@redhat.com>
Wed, 7 Aug 2019 13:32:38 +0000 (19:02 +0530)
Signed-off-by: Sidharth Anupkrishnan <sanupkri@redhat.com>
src/include/cephfs/libcephfs.h
src/libcephfs.cc

index 36f4c0315d673fdcf2e9fa60c34d0e003e4f7836..6cc5c111b3fccd9d369045ae66dc654e0afd611b 100644 (file)
@@ -1110,6 +1110,28 @@ int ceph_fallocate(struct ceph_mount_info *cmount, int fd, int mode,
  */
 int ceph_lazyio(struct ceph_mount_info *cmount, int fd, int enable);
 
+
+/**
+ * Flushes the write buffer for the file thereby propogating the buffered write to the file.
+ *
+ * @param cmount the ceph mount handle to use for performing the fsync.
+ * @param fd the file descriptor of the file to sync.
+ * @param offset a boolean to enable lazyio or disable lazyio.
+ * @returns 0 on success or a negative error code on failure.
+ */
+int ceph_lazyio_propogate(struct ceph_mount_info *cmount, int fd, int64_t offset, size_t count);
+
+
+/**
+ * Flushes the write buffer for the file and invalidate the read cache. This allows a subsequent read operation to read and cache data directly from the file and hence everyone's propogated writes would be visible. 
+ *
+ * @param cmount the ceph mount handle to use for performing the fsync.
+ * @param fd the file descriptor of the file to sync.
+ * @param offset a boolean to enable lazyio or disable lazyio.
+ * @returns 0 on success or a negative error code on failure.
+ */
+int ceph_lazyio_synchronize(struct ceph_mount_info *cmount, int fd, int64_t offset, size_t count);
+
 /** @} file */
 
 /**
index d3664b1e46788807fdf42b09f73d75c4ad9dbbb0..2283d00882756b8da1c9f976373f1db1f31cf8e7 100644 (file)
@@ -1078,6 +1078,23 @@ extern "C" int ceph_lazyio(class ceph_mount_info *cmount,
   return (cmount->get_client()->lazyio(fd, enable));
 }
 
+extern "C" int ceph_lazyio_propogate(class ceph_mount_info *cmount,
+                           int fd, int64_t offset, size_t count)
+{
+  if (!cmount->is_mounted())
+    return -ENOTCONN;
+  return (cmount->get_client()->lazyio_propogate(fd, offset, count));
+}
+
+extern "C" int ceph_lazyio_synchronize(class ceph_mount_info *cmount,
+                           int fd, int64_t offset, size_t count)
+{
+  if (!cmount->is_mounted())
+    return -ENOTCONN;
+  return (cmount->get_client()->lazyio_synchronize(fd, offset, count));
+}
+
+
 extern "C" int ceph_sync_fs(struct ceph_mount_info *cmount)
 {
   if (!cmount->is_mounted())