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

Function Read

src/libcephsqlite.cc:354–377  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

352}
353
354static int Read(sqlite3_file *file, void *buf, int len, sqlite_int64 off)
355{
356 auto f = (cephsqlite_file*)file;
357 auto start = ceph::coarse_mono_clock::now();
358 df(5) << buf << " " << off << "~" << len << dendl;
359
360 if (int rc = f->io.rs->read(buf, len, off); rc < 0) {
361 df(5) << "read failed: " << cpp_strerror(rc) << dendl;
362 if (rc == -EBLOCKLISTED) {
363 getdata(f->vfs).maybe_reconnect(f->io.cluster);
364 }
365 return SQLITE_IOERR_READ;
366 } else {
367 df(5) << "= " << rc << dendl;
368 auto end = ceph::coarse_mono_clock::now();
369 getdata(f->vfs).logger->tinc(P_OPF_READ, end-start);
370 if (rc < len) {
371 memset((unsigned char*)buf+rc, 0, len-rc);
372 return SQLITE_IOERR_SHORT_READ;
373 } else {
374 return SQLITE_OK;
375 }
376 }
377}
378
379static int Write(sqlite3_file *file, const void *buf, int len, sqlite_int64 off)
380{

Callers

nothing calls this directly

Calls 5

cpp_strerrorFunction · 0.85
maybe_reconnectMethod · 0.80
nowFunction · 0.50
readMethod · 0.45
tincMethod · 0.45

Tested by

no test coverage detected