]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
pybind: expose fsync in cephfs binding.
authorXiaoxi Chen <xiaoxchen@ebay.com>
Fri, 29 Apr 2016 19:47:42 +0000 (14:47 -0500)
committerRamana Raja <rraja@redhat.com>
Tue, 2 Aug 2016 10:57:57 +0000 (16:27 +0530)
So we don't necessary to syncfs when want to persistent
some file.

Signed-off-by: Xiaoxi Chen <xiaoxchen@ebay.com>
(cherry picked from commit 1c952fbaf0fd393ef2dcb83a3db721a077b4274e)

src/pybind/cephfs/cephfs.pyx

index 4810ba40dcf5fdf0667f56d648229b8b0eace0a2..6d32c40b4486cfd9208bc8985c1a5962977569fa 100644 (file)
@@ -135,6 +135,7 @@ cdef extern from "cephfs/libcephfs.h" nogil:
     int ceph_rmdir(ceph_mount_info *cmount, const char *path)
     const char* ceph_getcwd(ceph_mount_info *cmount)
     int ceph_sync_fs(ceph_mount_info *cmount)
+    int ceph_fsync(ceph_mount_info *cmount, int fd, int syncdataonly)
     int ceph_conf_parse_argv(ceph_mount_info *cmount, int argc, const char **argv)
     void ceph_buffer_free(char *buf)
 
@@ -506,6 +507,13 @@ cdef class LibCephFS(object):
         if ret < 0:
             raise make_ex(ret, "sync_fs failed")
 
+    def fsync(self, int fd, int syncdataonly):
+        self.require_state("mounted")
+        with nogil:
+            ret = ceph_fsync(self.cluster, fd, syncdataonly)
+        if ret < 0:
+            raise make_ex(ret, "fsync failed")
+
     def getcwd(self):
         self.require_state("mounted")
         with nogil: