From: Xiaoxi Chen Date: Fri, 29 Apr 2016 19:47:42 +0000 (-0500) Subject: pybind: expose fsync in cephfs binding. X-Git-Tag: v11.0.0~565^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=1c952fbaf0fd393ef2dcb83a3db721a077b4274e;p=ceph.git pybind: expose fsync in cephfs binding. So we don't necessary to syncfs when want to persistent some file. Signed-off-by: Xiaoxi Chen --- diff --git a/src/pybind/cephfs/cephfs.pyx b/src/pybind/cephfs/cephfs.pyx index ef505053f814..49a8fe8f802b 100644 --- a/src/pybind/cephfs/cephfs.pyx +++ b/src/pybind/cephfs/cephfs.pyx @@ -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: