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

Method write

src/client/Client.cc:12089–12125  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

12087}
12088
12089int Client::write(int fd, const char *buf, loff_t size, loff_t offset)
12090{
12091 RWRef_t mref_reader(mount_state, CLIENT_MOUNTING);
12092 if (!mref_reader.is_state_satisfied())
12093 return -ENOTCONN;
12094
12095 tout(cct) << "write" << std::endl;
12096 tout(cct) << fd << std::endl;
12097 tout(cct) << size << std::endl;
12098 tout(cct) << offset << std::endl;
12099
12100 std::scoped_lock lock(client_lock);
12101 Fh *fh = get_filehandle(fd);
12102 if (!fh)
12103 return -EBADF;
12104#if defined(__linux__) && defined(O_PATH)
12105 if (fh->flags & O_PATH)
12106 return -EBADF;
12107#endif
12108#if defined(__linux__)
12109 /* We can't return bytes written larger than INT_MAX, clamp size to
12110 * that or FSCRYPT_MAXIO_SIZE*/
12111 Inode *in = fh->inode.get();
12112 if (in->is_fscrypt_enabled()) {
12113 size = std::min(size, (loff_t)FSCRYPT_MAXIO_SIZE);
12114 } else {
12115 size = std::min(size, (loff_t)INT_MAX);
12116 }
12117#else
12118 size = std::min(size, (loff_t)INT_MAX);
12119#endif
12120 bufferlist bl;
12121 bl.append(buf, size);
12122 int r = _write(fh, offset, size, std::move(bl));
12123 ldout(cct, 3) << "write(" << fd << ", \"...\", " << size << ", " << offset << ") = " << r << dendl;
12124 return r;
12125}
12126
12127int Client::pwritev(int fd, const struct iovec *iov, int iovcnt, int64_t offset)
12128{

Callers 11

uninline_dataMethod · 0.45
ll_write_blockMethod · 0.45
play_traceMethod · 0.45
write_fileMethod · 0.45
write_fdMethod · 0.45
create_objectsMethod · 0.45
read_randomMethod · 0.45
read_random_exMethod · 0.45
fooMethod · 0.45
import_findMethod · 0.45
mksnapfileMethod · 0.45

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