From bde2c8f111d8276b026a3b1e37a5c9081a498ec9 Mon Sep 17 00:00:00 2001 From: Xiaoxi Chen Date: Fri, 29 Apr 2016 14:47:42 -0500 Subject: [PATCH] pybind: expose fsync in cephfs binding. So we don't necessary to syncfs when want to persistent some file. Signed-off-by: Xiaoxi Chen (cherry picked from commit 1c952fbaf0fd393ef2dcb83a3db721a077b4274e) --- src/pybind/cephfs/cephfs.pyx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/pybind/cephfs/cephfs.pyx b/src/pybind/cephfs/cephfs.pyx index 4810ba40dcf5f..6d32c40b4486c 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: -- 2.39.5