]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
libcephfs_proxy: implement client side async rw operation 61877/head
authorXavi Hernandez <xhernandez@gmail.com>
Tue, 18 Feb 2025 14:28:45 +0000 (14:28 +0000)
committerXavi Hernandez <xhernandez@gmail.com>
Wed, 19 Feb 2025 19:11:24 +0000 (20:11 +0100)
Signed-off-by: Xavi Hernandez <xhernandez@gmail.com>
src/libcephfs_proxy/libcephfs_proxy.c
src/libcephfs_proxy/proxy.h
src/libcephfs_proxy/proxy_requests.h

index b71ba92a2885c8a8b3ad22321503241a2d5e7e1b..cacc5200c19b3ece3e9a713a522adc41f3ce7ba5 100644 (file)
@@ -181,7 +181,7 @@ __public int ceph_create(struct ceph_mount_info **cmount, const char *const id)
        sd = err;
 
        proxy_link_negotiate_init(&ceph_mount->neg, 0, PROXY_FEAT_ALL, 0,
-                                 PROXY_FEAT_ASYNC_CBK);
+                                 PROXY_FEAT_ASYNC_IO);
 
        err = proxy_link_handshake_client(&ceph_mount->link, sd,
                                          &ceph_mount->neg,
@@ -911,3 +911,38 @@ __public UserPerm *ceph_mount_perms(struct ceph_mount_info *cmount)
 
        return value_ptr(ans.userperm);
 }
+
+__public int64_t ceph_ll_nonblocking_readv_writev(
+       struct ceph_mount_info *cmount, struct ceph_ll_io_info *io_info)
+{
+       CEPH_REQ(ceph_ll_nonblocking_readv_writev, req,
+                io_info->write ? io_info->iovcnt : 0, ans, 0);
+       int32_t i, err;
+
+       if ((cmount->neg.v1.enabled & PROXY_FEAT_ASYNC_IO) == 0) {
+               return -EOPNOTSUPP;
+       }
+
+       req.info = ptr_checksum(&cmount->async.random, io_info);
+       req.fh = (uintptr_t)io_info->fh;
+       req.off = io_info->off;
+       req.size = 0;
+       req.write = io_info->write;
+       req.fsync = io_info->fsync;
+       req.syncdataonly = io_info->syncdataonly;
+
+       for (i = 0; i < io_info->iovcnt; i++) {
+               if (io_info->write) {
+                       CEPH_BUFF_ADD(req, io_info->iov[i].iov_base,
+                                     io_info->iov[i].iov_len);
+               }
+               req.size += io_info->iov[i].iov_len;
+       }
+
+       err = CEPH_PROCESS(cmount, LIBCEPHFSD_OP_LL_NONBLOCKING_RW, req, ans);
+       if (err < 0) {
+               return err;
+       }
+
+       return ans.res;
+}
index 699e35ab872359ac5d8b47b141fecd132696d196..8b2ea8abfcf5af1ae951da3b7081e4d3454bddd9 100644 (file)
@@ -26,6 +26,9 @@
        ((_type *)((uintptr_t)(_ptr) - offset_of(_type, _field)))
 
 enum {
+       /* Support for ceph_ll_nonblocking_readv_writev */
+       PROXY_FEAT_ASYNC_IO = 0x00000001,
+
        /* Mask of all features requiring the asynchronous callback handling. */
        PROXY_FEAT_ASYNC_CBK = 0x00000001,
 
index 7552af6b3390dbff03b3b527c664bfbe5c78b9a5..c18a9f7823e3adf4a369d39fbc877b3f3d8ffd63 100644 (file)
@@ -40,7 +40,7 @@
 
 #define CEPH_DATA(_name, _data, _data_count)       \
        proxy_##_name##_##_data##_t _data;         \
-       struct iovec _data##_iov[_data_count + 1]; \
+       struct iovec _data##_iov[(_data_count) + 1]; \
        int32_t _data##_count = 0;                 \
        CEPH_BUFF_ADD(_data, &_data, sizeof(_data))