}
void ImageCtx::aio_read_from_cache(object_t o, 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);
extent.oloc.pool = data_ctx.get_id();
}
void ImageCtx::write_to_cache(object_t o, 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, bl, len, off, onfinish);
+ aio_read_from_cache(o, bl, len, off, onfinish, 0);
mylock.Lock();
while (!done)
cond.Wait(mylock);
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);
+ 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);
+ Context *onfinish, int fadivse_flags);
int read_from_cache(object_t o, bufferlist *bl, size_t len, uint64_t off);
void user_flushed();
void flush_cache_aio(Context *onfinish);
C_AioWrite *req_comp = new C_AioWrite(cct, c);
if (ictx->object_cacher) {
c->add_request();
- ictx->write_to_cache(p->oid, bl, p->length, p->offset, req_comp);
+ ictx->write_to_cache(p->oid, bl, p->length, p->offset, req_comp, op_flags);
} else {
// reverse map this object extent onto the parent
vector<pair<uint64_t,uint64_t> > objectx;
ictx->readahead.inc_pending();
ictx->aio_read_from_cache(q->oid, NULL,
q->length, q->offset,
- req_comp);
+ req_comp, 0);
}
}
ictx->perfcounter->inc(l_librbd_readahead);
C_CacheRead *cache_comp = new C_CacheRead(req);
ictx->aio_read_from_cache(q->oid, &req->data(),
q->length, q->offset,
- cache_comp);
+ cache_comp, op_flags);
} else {
r = req->send();
if (r == -ENOENT)
snapid_t snap;
map<object_t, bufferlist*> read_data; // bits of data as they come back
bufferlist *bl;
- int flags;
- OSDRead(snapid_t s, bufferlist *b, int f) : snap(s), bl(b), flags(f) {}
+ int fadvise_flags;
+ OSDRead(snapid_t s, bufferlist *b, int f) : snap(s), bl(b), fadvise_flags(f) {}
};
OSDRead *prepare_read(snapid_t snap, bufferlist *b, int f) {
SnapContext snapc;
bufferlist bl;
utime_t mtime;
- int flags;
- OSDWrite(const SnapContext& sc, bufferlist& b, utime_t mt, int f) : snapc(sc), bl(b), mtime(mt), flags(f) {}
+ int fadvise_flags;
+ OSDWrite(const SnapContext& sc, bufferlist& b, utime_t mt, int f) : snapc(sc), bl(b), mtime(mt), fadvise_flags(f) {}
};
OSDWrite *prepare_write(const SnapContext& sc, bufferlist &b, utime_t mt, int f) {