boost::intrusive_ptr<CephContext> cct;
std::unique_ptr<ObjectStore> os;
+ std::mutex lock;
+ int ref_count;
+
Engine(const thread_data* td);
~Engine();
static Engine engine(td);
return &engine;
}
+
+ void ref() {
+ std::lock_guard<std::mutex> l(lock);
+ ++ref_count;
+ }
+ void deref() {
+ std::lock_guard<std::mutex> l(lock);
+ --ref_count;
+ if (!ref_count) {
+ os->umount();
+ }
+ }
};
-Engine::Engine(const thread_data* td)
+Engine::Engine(const thread_data* td) : ref_count(0)
{
// add the ceph command line arguments
auto o = static_cast<const Options*>(td->eo);
Engine::~Engine()
{
- os->umount();
+ assert(!ref_count);
}
events(td->o.iodepth),
unlink(td->o.unlink)
{
+ engine->ref();
// use the fio thread_number for our unique pool id
const uint64_t pool = Collection::MIN_POOL_ID + td->thread_number;
// apply the entire transaction synchronously
ObjectStore::Sequencer sequencer("job init");
int r = engine->os->apply_transaction(&sequencer, std::move(t));
- if (r)
+ if (r) {
+ engine->deref();
throw std::system_error(r, std::system_category(), "job init");
+ }
}
Job::~Job()
if (r)
derr << "job cleanup failed with " << cpp_strerror(-r) << dendl;
}
+ engine->deref();
}