return -ENOENT;
}
- void ImageCtx::aio_read_from_cache(object_t o, bufferlist *bl, size_t len,
- uint64_t off, Context *onfinish, int fadvise_flags) {
+ void ImageCtx::aio_read_from_cache(object_t o, uint64_t object_no,
+ bufferlist *bl, size_t len,
- uint64_t off, Context *onfinish) {
++ uint64_t off, Context *onfinish,
++ int fadvise_flags) {
snap_lock.get_read();
- ObjectCacher::OSDRead *rd = object_cacher->prepare_read(snap_id, bl, 0);
+ ObjectCacher::OSDRead *rd = object_cacher->prepare_read(snap_id, bl, fadvise_flags);
snap_lock.put_read();
- ObjectExtent extent(o, 0 /* a lie */, off, len, 0);
+ ObjectExtent extent(o, object_no, off, len, 0);
extent.oloc.pool = data_ctx.get_id();
extent.buffer_extents.push_back(make_pair(0, len));
rd->extents.push_back(extent);
onfinish->complete(r);
}
- void ImageCtx::write_to_cache(object_t o, bufferlist& bl, size_t len,
- uint64_t off, Context *onfinish, int fadvise_flags) {
+ void ImageCtx::write_to_cache(object_t o, const bufferlist& bl, size_t len,
- uint64_t off, Context *onfinish) {
++ uint64_t off, Context *onfinish,
++ int fadvise_flags) {
snap_lock.get_read();
ObjectCacher::OSDWrite *wr = object_cacher->prepare_write(snapc, bl,
- utime_t(), 0);
+ utime_t(), fadvise_flags);
snap_lock.put_read();
ObjectExtent extent(o, 0, off, len, 0);
extent.oloc.pool = data_ctx.get_id();
Cond cond;
bool done;
Context *onfinish = new C_SafeCond(&mylock, &cond, &done, &r);
- aio_read_from_cache(o, object_no, bl, len, off, onfinish);
- aio_read_from_cache(o, bl, len, off, onfinish, 0);
++ aio_read_from_cache(o, object_no, bl, len, off, onfinish, 0);
mylock.Lock();
while (!done)
cond.Wait(mylock);
uint64_t get_parent_snap_id(librados::snap_t in_snap_id) const;
int get_parent_overlap(librados::snap_t in_snap_id,
uint64_t *overlap) const;
- void aio_read_from_cache(object_t o, bufferlist *bl, size_t len,
- uint64_t off, Context *onfinish, int fadvise_flags);
- void write_to_cache(object_t o, bufferlist& bl, size_t len, uint64_t off,
- Context *onfinish, int fadivse_flags);
- int read_from_cache(object_t o, bufferlist *bl, size_t len, uint64_t off);
+ void aio_read_from_cache(object_t o, uint64_t object_no, bufferlist *bl,
- size_t len, uint64_t off, Context *onfinish);
++ size_t len, uint64_t off, Context *onfinish,
++ int fadvise_flags);
+ void write_to_cache(object_t o, const bufferlist& bl, size_t len,
- uint64_t off, Context *onfinish);
++ uint64_t off, Context *onfinish, int fadvise_flags);
+ int read_from_cache(object_t o, uint64_t object_no, bufferlist *bl,
+ size_t len, uint64_t off);
void user_flushed();
void flush_cache_aio(Context *onfinish);
int flush_cache();
Context *req_comp = new C_RBD_Readahead(ictx, q->oid, q->offset, q->length);
ictx->readahead.inc_pending();
- ictx->aio_read_from_cache(q->oid, NULL,
+ ictx->aio_read_from_cache(q->oid, q->objectno, NULL,
q->length, q->offset,
- req_comp);
+ req_comp, 0);
}
}
ictx->perfcounter->inc(l_librbd_readahead);
if (ictx->object_cacher) {
C_CacheRead *cache_comp = new C_CacheRead(req);
- ictx->aio_read_from_cache(q->oid, &req->data(),
+ ictx->aio_read_from_cache(q->oid, q->objectno, &req->data(),
q->length, q->offset,
- cache_comp);
+ cache_comp, op_flags);
} else {
r = req->send();
if (r == -ENOENT)
// get Object cache
sobject_t soid(ex_it->oid, rd->snap);
- Object *o = get_object(soid, oset, ex_it->oloc, ex_it->truncate_size, oset->truncate_seq);
+ Object *o = get_object(soid, ex_it->objectno, oset, ex_it->oloc, ex_it->truncate_size, oset->truncate_seq);
- touch_ob(o);
+ if (external_call)
+ touch_ob(o);
// does not exist and no hits?
if (oset->return_enoent && !o->exists) {
SnapContext snapc;
bufferlist bl;
utime_t mtime;
- int flags;
+ int fadvise_flags;
- OSDWrite(const SnapContext& sc, bufferlist& b, utime_t mt, int f) : snapc(sc), bl(b), mtime(mt), fadvise_flags(f) {}
+ OSDWrite(const SnapContext& sc, const bufferlist& b, utime_t mt, int f)
- : snapc(sc), bl(b), mtime(mt), flags(f) {}
++ : snapc(sc), bl(b), mtime(mt), fadvise_flags(f) {}
};
- OSDWrite *prepare_write(const SnapContext& sc, bufferlist &b, utime_t mt, int f) {
+ OSDWrite *prepare_write(const SnapContext& sc, const bufferlist &b,
+ utime_t mt, int f) {
return new OSDWrite(sc, b, mt, f);
}