From 94b55cbb99d100874f619e2502ff3a8051340ead Mon Sep 17 00:00:00 2001 From: "Frank S. Filz" Date: Wed, 11 May 2022 14:34:35 -0700 Subject: [PATCH] Client: Add ll_preadv_pwritev to expose non-blocking I/O to libcephfs Signed-off-by: Frank S. Filz --- src/client/Client.cc | 13 +++++++++++++ src/client/Client.h | 4 ++++ 2 files changed, 17 insertions(+) diff --git a/src/client/Client.cc b/src/client/Client.cc index 20e62f38995..9ac34135d19 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -15511,6 +15511,19 @@ int64_t Client::ll_readv(struct Fh *fh, const struct iovec *iov, int iovcnt, int return _preadv_pwritev_locked(fh, iov, iovcnt, off, false, false); } +int64_t Client::ll_preadv_pwritev(struct Fh *fh, const struct iovec *iov, + int iovcnt, int64_t offset, bool write, + Context *onfinish, bufferlist *bl) +{ + RWRef_t mref_reader(mount_state, CLIENT_MOUNTING); + if (!mref_reader.is_state_satisfied()) + return -CEPHFS_ENOTCONN; + + std::scoped_lock cl(client_lock); + return _preadv_pwritev_locked(fh, iov, iovcnt, offset, write, true, + onfinish, bl); +} + int Client::ll_flush(Fh *fh) { RWRef_t mref_reader(mount_state, CLIENT_MOUNTING); diff --git a/src/client/Client.h b/src/client/Client.h index b8e4a9cec8e..7fb5e68cf5b 100644 --- a/src/client/Client.h +++ b/src/client/Client.h @@ -646,6 +646,10 @@ public: int ll_write(Fh *fh, loff_t off, loff_t len, const char *data); int64_t ll_readv(struct Fh *fh, const struct iovec *iov, int iovcnt, int64_t off); int64_t ll_writev(struct Fh *fh, const struct iovec *iov, int iovcnt, int64_t off); + int64_t ll_preadv_pwritev(struct Fh *fh, const struct iovec *iov, int iovcnt, + int64_t offset, bool write, + Context *onfinish = nullptr, + bufferlist *blp = nullptr); loff_t ll_lseek(Fh *fh, loff_t offset, int whence); int ll_flush(Fh *fh); int ll_fsync(Fh *fh, bool syncdataonly); -- 2.39.5