]> 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)
committerXiaoxi Chen <xiaoxchen@ebay.com>
Fri, 29 Apr 2016 19:48:50 +0000 (14:48 -0500)
So we don't necessary to syncfs when want to persistent
some file.

Signed-off-by: Xiaoxi Chen <xiaoxchen@ebay.com>
src/pybind/cephfs/cephfs.pyx

index ef505053f814900110e11136b866c933a8ca62c8..49a8fe8f802b58dca908f936d52318de47740471 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: