From: Sidharth Anupkrishnan Date: Wed, 26 Jun 2019 13:29:06 +0000 (+0530) Subject: libcephfs: Add lazyio_propogate and lazyio_synchronize methods to libcephfs X-Git-Tag: v15.1.0~1421^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=e0722de187d095caa1e5aea549a98cc0ce5b21c4;p=ceph.git libcephfs: Add lazyio_propogate and lazyio_synchronize methods to libcephfs Signed-off-by: Sidharth Anupkrishnan --- diff --git a/src/include/cephfs/libcephfs.h b/src/include/cephfs/libcephfs.h index 36f4c0315d67..6cc5c111b3fc 100644 --- a/src/include/cephfs/libcephfs.h +++ b/src/include/cephfs/libcephfs.h @@ -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 */ /** diff --git a/src/libcephfs.cc b/src/libcephfs.cc index d3664b1e4678..2283d0088275 100644 --- a/src/libcephfs.cc +++ b/src/libcephfs.cc @@ -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())