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

Method read

src/client/Client.cc:11349–11389  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11347// blocking osd interface
11348
11349int Client::read(int fd, char *buf, loff_t size, loff_t offset)
11350{
11351 RWRef_t mref_reader(mount_state, CLIENT_MOUNTING);
11352 if (!mref_reader.is_state_satisfied())
11353 return -ENOTCONN;
11354
11355 tout(cct) << "read" << std::endl;
11356 tout(cct) << fd << std::endl;
11357 tout(cct) << size << std::endl;
11358 tout(cct) << offset << std::endl;
11359
11360 std::unique_lock lock(client_lock);
11361 Fh *f = get_filehandle(fd);
11362 if (!f)
11363 return -EBADF;
11364#if defined(__linux__) && defined(O_PATH)
11365 if (f->flags & O_PATH)
11366 return -EBADF;
11367#endif
11368 bufferlist bl;
11369#if defined(__linux__)
11370 /* We can't return bytes written larger than INT_MAX, clamp size to
11371 * that or FSCRYPT_MAXIO_SIZE*/
11372 Inode *in = f->inode.get();
11373 if (in->is_fscrypt_enabled()) {
11374 size = std::min(size, (loff_t)FSCRYPT_MAXIO_SIZE);
11375 } else {
11376 size = std::min(size, (loff_t)INT_MAX);
11377 }
11378#else
11379 size = std::min(size, (loff_t)INT_MAX);
11380#endif
11381 int r = _read(f, offset, size, &bl);
11382 ldout(cct, 3) << "read(" << fd << ", " << (void*)buf << ", " << size << ", " << offset << ") = " << r << dendl;
11383 if (r >= 0) {
11384 lock.unlock();
11385 bl.begin().copy(bl.length(), buf);
11386 r = bl.length();
11387 }
11388 return r;
11389}
11390
11391int Client::preadv(int fd, const struct iovec *iov, int iovcnt, loff_t offset)
11392{

Callers 8

ll_read_blockMethod · 0.45
play_traceMethod · 0.45
read_fileMethod · 0.45
object_rwMethod · 0.45
read_randomMethod · 0.45
read_random_exMethod · 0.45
fooMethod · 0.45
chunk_fileMethod · 0.45

Calls 15

is_state_satisfiedMethod · 0.80
_readFunction · 0.50
getFunction · 0.50
putFunction · 0.50
getMethod · 0.45
is_fscrypt_enabledMethod · 0.45
unlockMethod · 0.45
copyMethod · 0.45
beginMethod · 0.45
lengthMethod · 0.45
finishMethod · 0.45
_readMethod · 0.45

Tested by

no test coverage detected