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

Method do_readahead

src/client/Client.cc:11792–11812  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11790}
11791
11792void Client::do_readahead(Fh *f, Inode *in, uint64_t off, uint64_t len)
11793{
11794 if(f->readahead.get_min_readahead_size() > 0) {
11795 pair<uint64_t, uint64_t> readahead_extent = f->readahead.update(off, len, in->effective_size());
11796 if (readahead_extent.second > 0) {
11797 ldout(cct, 20) << "readahead " << readahead_extent.first << "~" << readahead_extent.second
11798 << " (caller wants " << off << "~" << len << ")" << dendl;
11799 Context *onfinish2 = new C_Readahead(this, f);
11800 int r2 = objectcacher->file_read(&in->oset, &in->layout, in->snapid,
11801 readahead_extent.first, readahead_extent.second,
11802 NULL, 0, onfinish2);
11803 if (r2 == 0) {
11804 ldout(cct, 20) << "readahead initiated, c " << onfinish2 << dendl;
11805 get_cap_ref(in, CEPH_CAP_FILE_RD | CEPH_CAP_FILE_CACHE);
11806 } else {
11807 ldout(cct, 20) << "readahead was no-op, already cached" << dendl;
11808 delete onfinish2;
11809 }
11810 }
11811 }
11812}
11813
11814void Client::C_Read_Async_Finisher::finish(int r)
11815{

Callers 1

finishMethod · 0.80

Calls 4

file_readMethod · 0.80
updateMethod · 0.45
effective_sizeMethod · 0.45

Tested by

no test coverage detected