From: Frank S. Filz Date: Wed, 11 May 2022 21:34:35 +0000 (-0700) Subject: Client: Add ll_preadv_pwritev to expose non-blocking I/O to libcephfs X-Git-Tag: v19.0.0~814^2~8 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=94b55cbb99d100874f619e2502ff3a8051340ead;p=ceph.git Client: Add ll_preadv_pwritev to expose non-blocking I/O to libcephfs Signed-off-by: Frank S. Filz --- diff --git a/src/client/Client.cc b/src/client/Client.cc index 20e62f389951..9ac34135d19e 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 b8e4a9cec8e0..7fb5e68cf5b8 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);