MCPcopy Create free account
hub / github.com/ceph/ceph / ll_write

Method ll_write

src/client/Client.cc:17258–17296  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17256}
17257
17258int Client::ll_write(Fh *fh, loff_t off, loff_t len, const char *data)
17259{
17260 RWRef_t mref_reader(mount_state, CLIENT_MOUNTING);
17261 if (!mref_reader.is_state_satisfied()) {
17262 return -ENOTCONN;
17263 }
17264
17265#if defined(__linux__)
17266 /* We can't return bytes written larger than INT_MAX, clamp size to
17267 * that or FSCRYPT_MAXIO_SIZE*/
17268 Inode *in = fh->inode.get();
17269 if (in->is_fscrypt_enabled()) {
17270 len = std::min(len, (loff_t)FSCRYPT_MAXIO_SIZE);
17271 } else {
17272 len = std::min(len, (loff_t)INT_MAX);
17273 }
17274#else
17275 len = std::min(len, (loff_t)INT_MAX);
17276#endif
17277 std::scoped_lock lock(client_lock);
17278 if (fh == NULL || !_ll_fh_exists(fh)) {
17279 ldout(cct, 3) << "(fh)" << fh << " is invalid" << dendl;
17280 return -EBADF;
17281 }
17282
17283 ldout(cct, 3) << "ll_write " << fh << " " << fh->inode->ino << " " << off <<
17284 "~" << len << dendl;
17285 tout(cct) << "ll_write" << std::endl;
17286 tout(cct) << (uintptr_t)fh << std::endl;
17287 tout(cct) << off << std::endl;
17288 tout(cct) << len << std::endl;
17289
17290 bufferlist bl;
17291 bl.append(data, len);
17292 int r = _write(fh, off, len, std::move(bl));
17293 ldout(cct, 3) << "ll_write " << fh << " " << off << "~" << len << " = " << r
17294 << dendl;
17295 return r;
17296}
17297
17298int64_t Client::ll_writev(struct Fh *fh, const struct iovec *iov, int iovcnt, int64_t off)
17299{

Callers 3

ceph_ll_writeFunction · 0.80
fuse_ll_writeFunction · 0.80
play_traceMethod · 0.80

Calls 5

is_state_satisfiedMethod · 0.80
_writeFunction · 0.50
getMethod · 0.45
is_fscrypt_enabledMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected