if (cct->_conf->client_oc) {
vector<ObjectExtent> ls;
Filer::file_to_extents(cct, in->ino, &in->layout, off, len, ls);
- objectcacher->truncate_set(&in->oset, ls);
+ objectcacher->discard_set(&in->oset, ls);
}
if (ino_invalidate_cb)
}
if (ictx->object_cacher)
- ictx->object_cacher->truncate_set(ictx->object_set, v);
+ ictx->object_cacher->discard_set(ictx->object_set, v);
return total_write;
}
r = 0;
done:
if (ictx->object_cacher)
- ictx->object_cacher->truncate_set(ictx->object_set, v);
+ ictx->object_cacher->discard_set(ictx->object_set, v);
c->finish_adding_completions();
c->put();
/**
- * Truncate an ObjectSet by removing the objects in exls from the in-memory oset.
+ * discard object extents from an ObjectSet by removing the objects in exls from the in-memory oset.
*/
-void ObjectCacher::truncate_set(ObjectSet *oset, vector<ObjectExtent>& exls)
+void ObjectCacher::discard_set(ObjectSet *oset, vector<ObjectExtent>& exls)
{
if (oset->objects.empty()) {
- ldout(cct, 10) << "truncate_set on " << oset << " dne" << dendl;
+ ldout(cct, 10) << "discard_set on " << oset << " dne" << dendl;
return;
}
- ldout(cct, 10) << "truncate_set " << oset << dendl;
+ ldout(cct, 10) << "discard_set " << oset << dendl;
bool were_dirty = oset->dirty_or_tx > 0;
continue;
Object *ob = objects[oset->poolid][soid];
- // purge or truncate?
- if (ex.offset == 0) {
- ldout(cct, 10) << "truncate_set purging " << *ob << dendl;
- purge(ob);
- } else {
- // hrm, truncate object
- ldout(cct, 10) << "truncate_set truncating " << *ob << " at " << ex.offset << dendl;
- ob->truncate(ex.offset);
-
- if (ob->can_close()) {
- ldout(cct, 10) << "truncate_set trimming " << *ob << dendl;
- close_object(ob);
- }
+ ob->discard(ex.offset, ex.length);
+
+ if (ob->can_close()) {
+ ldout(cct, 10) << " closing " << *ob << dendl;
+ close_object(ob);
}
}
loff_t release_set(ObjectSet *oset); // returns # of bytes not released (ie non-clean)
uint64_t release_all();
- void truncate_set(ObjectSet *oset, vector<ObjectExtent>& ex);
+ void discard_set(ObjectSet *oset, vector<ObjectExtent>& ex);
// file functions