//inherit and if later access, this auto clean.
right->set_dontneed(left->get_dontneed());
+ right->set_nocache(left->get_nocache());
right->last_write_tid = left->last_write_tid;
right->last_read_tid = left->last_read_tid;
left->last_write = MAX( left->last_write, right->last_write );
left->set_dontneed(right->get_dontneed() ? left->get_dontneed() : false);
+ left->set_nocache(right->get_nocache() ? left->get_nocache() : false);
// waiters
for (map<loff_t, list<Context*> >::iterator p = right->waitfor_read.begin();
if (r >= 0) {
// ok! mark bh clean and error-free
mark_clean(bh);
+ if (bh->get_nocache())
+ bh_lru_rest.lru_bottouch(bh);
hit.push_back(bh);
ldout(cct, 10) << "bh_write_commit clean " << *bh << dendl;
} else {
uint64_t total_bytes_read = 0;
map<uint64_t, bufferlist> stripe_map; // final buffer offset -> substring
bool dontneed = rd->fadvise_flags & LIBRADOS_OP_FLAG_FADVISE_DONTNEED;
+ bool nocache = rd->fadvise_flags & LIBRADOS_OP_FLAG_FADVISE_NOCACHE;
/*
* WARNING: we can only meaningfully return ENOENT if the read request
bh_remove(o, bh_it->second);
delete bh_it->second;
} else {
+ bh_it->second->set_nocache(nocache);
bh_read(bh_it->second, rd->fadvise_flags);
if ((success && onfinish) || last != missing.end())
last = bh_it;
error = bh->error;
bytes_in_cache += bh->length();
- touch_bh(bh);
+ if (bh->get_nocache() && bh->is_clean())
+ bh_lru_rest.lru_bottouch(bh);
+ else
+ touch_bh(bh);
//must be after touch_bh because touch_bh set dontneed false
if (dontneed &&
((loff_t)ex_it->offset <= bh->start() && (bh->end() <= (loff_t)(ex_it->offset + ex_it->length)))) {
uint64_t bytes_written = 0;
uint64_t bytes_written_in_flush = 0;
bool dontneed = wr->fadvise_flags & LIBRADOS_OP_FLAG_FADVISE_DONTNEED;
+ bool nocache = wr->fadvise_flags & LIBRADOS_OP_FLAG_FADVISE_NOCACHE;
for (vector<ObjectExtent>::iterator ex_it = wr->extents.begin();
ex_it != wr->extents.end();
// map it all into a single bufferhead.
BufferHead *bh = o->map_write(wr);
+ bool missing = bh->is_missing();
bh->snapc = wr->snapc;
bytes_written += bh->length();
mark_dirty(bh);
if (dontneed)
bh->set_dontneed(true);
+ else if (nocache && missing)
+ bh->set_nocache(true);
else
touch_bh(bh);
loff_t start, length; // bh extent in object
} ex;
bool dontneed; //indicate bh don't need by anyone
+ bool nocache; //indicate bh don't need by this caller
public:
Object *ob;
state(STATE_MISSING),
ref(0),
dontneed(false),
+ nocache(false),
ob(o),
last_write_tid(0),
last_read_tid(0),
bool get_dontneed() {
return dontneed;
}
+
+ void set_nocache(bool v) {
+ nocache = v;
+ }
+ bool get_nocache() {
+ return nocache;
+ }
};
// ******* Object *********
bh_lru_rest.lru_touch(bh);
bh->set_dontneed(false);
+ bh->set_nocache(false);
touch_ob(bh->ob);
}
void touch_ob(Object *ob) {