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

Method read

src/blk/kernel/KernelDevice.cc:1428–1474  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1426}
1427
1428int KernelDevice::read(uint64_t off, uint64_t len, bufferlist *pbl,
1429 IOContext *ioc,
1430 bool buffered)
1431{
1432 dout(5) << __func__ << " 0x" << std::hex << off << "~" << len << std::dec
1433 << " " << buffermode(buffered)
1434 << dendl;
1435 ceph_assert(is_valid_io(off, len));
1436
1437 _aio_log_start(ioc, off, len);
1438
1439 auto start1 = mono_clock::now();
1440
1441 auto p = ceph::buffer::ptr_node::create(create_custom_aligned(len, ioc));
1442 int r = ::pread(choose_fd(buffered, WRITE_LIFE_NOT_SET),
1443 p->c_str(), len, off);
1444 auto age = cct->_conf->bdev_debug_aio_log_age;
1445 if (mono_clock::now() - start1 >= make_timespan(age)) {
1446 derr << __func__ << " stalled read "
1447 << " 0x" << std::hex << off << "~" << len << std::dec
1448 << " " << buffermode(buffered)
1449 << " since " << start1 << ", timeout is "
1450 << age
1451 << "s" << dendl;
1452 add_stalled_read_event();
1453 }
1454 if (r < 0) {
1455 if (ioc->allow_eio && is_expected_ioerr(-errno)) {
1456 r = -EIO;
1457 } else {
1458 r = -errno;
1459 }
1460 derr << __func__ << " 0x" << std::hex << off << "~" << std::left
1461 << std::dec << " error: " << cpp_strerror(r) << dendl;
1462 goto out;
1463 }
1464 ceph_assert((uint64_t)r == len);
1465 pbl->push_back(std::move(p));
1466
1467 dout(40) << "data:\n";
1468 pbl->hexdump(*_dout);
1469 *_dout << dendl;
1470
1471 out:
1472 _aio_log_finish(ioc, off, len);
1473 return r < 0 ? r : 0;
1474}
1475
1476int KernelDevice::aio_read(
1477 uint64_t off,

Callers

nothing calls this directly

Calls 11

buffermodeFunction · 0.85
is_valid_ioFunction · 0.85
preadFunction · 0.85
make_timespanFunction · 0.85
is_expected_ioerrFunction · 0.85
cpp_strerrorFunction · 0.85
hexdumpMethod · 0.80
nowFunction · 0.50
createFunction · 0.50
c_strMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected