remove_all_caps(in);
ldout(cct, 10) << "put_inode deleting " << *in << dendl;
- objectcacher->release_set(&in->oset);
+ bool unclean = objectcacher->release_set(&in->oset);
+ assert(!unclean);
if (in->snapdir_parent)
put_inode(in->snapdir_parent);
inode_map.erase(in->vino());
}
-bool Client::_flush(Inode *in, Context *onfinish)
+class C_Client_PutInode : public Context {
+ Client *client;
+ Inode *in;
+public:
+ C_Client_PutInode(Client *c, Inode *i) : client(c), in(i) {
+ in->get();
+ }
+ void finish(int) {
+ client->put_inode(in);
+ }
+};
+
+
+bool Client::_flush(Inode *in)
{
ldout(cct, 10) << "_flush " << *in << dendl;
return true;
}
- if (!onfinish)
- onfinish = new C_NoopContext;
-
+ Context *onfinish = new C_Client_PutInode(this, in);
bool safe = objectcacher->commit_set(&in->oset, onfinish);
- if (safe && onfinish) {
- onfinish->finish(0);
- delete onfinish;
+ if (safe) {
+ onfinish->complete(0);
}
return safe;
}
void put_inode(Inode *in, int n=1);
void close_dir(Dir *dir);
+ friend class C_Client_PutInode; // calls put_inode()
+
//int get_cache_size() { return lru.lru_get_size(); }
//void set_cache_size(int m) { lru.lru_set_max(m); }
void _invalidate_inode_cache(Inode *in);
void _invalidate_inode_cache(Inode *in, int64_t off, int64_t len);
void _release(Inode *in, bool checkafter=true);
- bool _flush(Inode *in, Context *onfinish=NULL);
+ bool _flush(Inode *in);
void _flushed(Inode *in);
void flush_set_callback(ObjectCacher::ObjectSet *oset);