return _preadv_pwritev(fd, iov, iovcnt, offset, true);
}
-int Client::_preadv_pwritev(int fd, const struct iovec *iov, unsigned iovcnt, int64_t offset, bool write)
+int64_t Client::_preadv_pwritev_locked(Fh *fh, const struct iovec *iov,
+ unsigned iovcnt, int64_t offset, bool write)
{
- Mutex::Locker lock(client_lock);
- tout(cct) << fd << std::endl;
- tout(cct) << offset << std::endl;
-
- if (unmounting)
- return -ENOTCONN;
-
- Fh *fh = get_filehandle(fd);
- if (!fh)
- return -EBADF;
#if defined(__linux__) && defined(O_PATH)
if (fh->flags & O_PATH)
return -EBADF;
}
if (write) {
int64_t w = _write(fh, offset, totallen, NULL, iov, iovcnt);
- ldout(cct, 3) << "pwritev(" << fd << ", \"...\", " << totallen << ", " << offset << ") = " << w << dendl;
+ ldout(cct, 3) << "pwritev(" << fh << ", \"...\", " << totallen << ", " << offset << ") = " << w << dendl;
return w;
} else {
bufferlist bl;
int64_t r = _read(fh, offset, totallen, &bl);
- ldout(cct, 3) << "preadv(" << fd << ", " << offset << ") = " << r << dendl;
+ ldout(cct, 3) << "preadv(" << fh << ", " << offset << ") = " << r << dendl;
if (r <= 0)
return r;
}
}
+int Client::_preadv_pwritev(int fd, const struct iovec *iov, unsigned iovcnt, int64_t offset, bool write)
+{
+ Mutex::Locker lock(client_lock);
+ tout(cct) << fd << std::endl;
+ tout(cct) << offset << std::endl;
+
+ if (unmounting)
+ return -ENOTCONN;
+
+ Fh *fh = get_filehandle(fd);
+ if (!fh)
+ return -EBADF;
+ return _preadv_pwritev_locked(fh, iov, iovcnt, offset, write);
+}
+
int64_t Client::_write(Fh *f, int64_t offset, uint64_t size, const char *buf,
const struct iovec *iov, int iovcnt)
{
* change out from under us.
*/
if (f->flags & O_APPEND) {
- int64_t r = _lseek(f, 0, SEEK_END);
+ int r = _lseek(f, 0, SEEK_END);
if (r < 0) {
unlock_fh_pos(f);
return r;
return r;
}
+int64_t Client::ll_writev(struct Fh *fh, const struct iovec *iov, int iovcnt, int64_t off)
+{
+ Mutex::Locker lock(client_lock);
+ if (unmounting)
+ return -ENOTCONN;
+ return _preadv_pwritev_locked(fh, iov, iovcnt, off, true);
+}
+
+int64_t Client::ll_readv(struct Fh *fh, const struct iovec *iov, int iovcnt, int64_t off)
+{
+ Mutex::Locker lock(client_lock);
+ if (unmounting)
+ return -ENOTCONN;
+ return _preadv_pwritev_locked(fh, iov, iovcnt, off, false);
+}
+
int Client::ll_flush(Fh *fh)
{
Mutex::Locker lock(client_lock);
int64_t _read(Fh *fh, int64_t offset, uint64_t size, bufferlist *bl);
int64_t _write(Fh *fh, int64_t offset, uint64_t size, const char *buf,
const struct iovec *iov, int iovcnt);
+ int64_t _preadv_pwritev_locked(Fh *f, const struct iovec *iov, unsigned iovcnt, int64_t offset, bool write);
int _preadv_pwritev(int fd, const struct iovec *iov, unsigned iovcnt, int64_t offset, bool write);
int _flush(Fh *fh);
int _fsync(Fh *fh, bool syncdataonly);
int ll_read(Fh *fh, loff_t off, loff_t len, bufferlist *bl);
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);
loff_t ll_lseek(Fh *fh, loff_t offset, int whence);
int ll_flush(Fh *fh);
int ll_fsync(Fh *fh, bool syncdataonly);
struct Fh *fh, const struct iovec *iov,
int iovcnt, int64_t off)
{
- return -1; // TODO: implement
+ return (cmount->get_client()->ll_readv(fh, iov, iovcnt, off));
}
extern "C" int64_t ceph_ll_writev(class ceph_mount_info *cmount,
struct Fh *fh, const struct iovec *iov,
int iovcnt, int64_t off)
{
- return -1; // TODO: implement
+ return (cmount->get_client()->ll_writev(fh, iov, iovcnt, off));
}
extern "C" int ceph_ll_close(class ceph_mount_info *cmount, Fh* fh)