Merge pull request #994 from yuyuyu101/wip-7062

Fix WBThrottle thread disappear problem

Reviewed-by: Sage Weil <sage@inktank.com>
This commit is contained in:
Sage Weil 2013-12-26 21:25:08 -08:00
commit a39226ac9a
3 changed files with 23 additions and 5 deletions

View File

@ -1403,6 +1403,7 @@ int FileStore::mount()
}
}
wbthrottle.start();
sync_thread.create();
ret = journal_replay(initial_op_seq);
@ -1420,6 +1421,8 @@ int FileStore::mount()
lock.Unlock();
sync_thread.join();
wbthrottle.stop();
goto close_current_fd;
}
@ -1469,6 +1472,7 @@ int FileStore::umount()
sync_cond.Signal();
lock.Unlock();
sync_thread.join();
wbthrottle.stop();
op_tp.stop();
journal_stop();

View File

@ -10,7 +10,7 @@ WBThrottle::WBThrottle(CephContext *cct) :
cur_ios(0), cur_size(0),
cct(cct),
logger(NULL),
stopping(false),
stopping(true),
lock("WBThrottle::lock", false, true, false, cct),
fs(XFS)
{
@ -34,20 +34,33 @@ WBThrottle::WBThrottle(CephContext *cct) :
logger->set(i, 0);
cct->_conf->add_observer(this);
create();
}
WBThrottle::~WBThrottle() {
assert(cct);
cct->get_perfcounters_collection()->remove(logger);
delete logger;
cct->_conf->remove_observer(this);
}
void WBThrottle::start()
{
{
Mutex::Locker l(lock);
stopping = false;
}
create();
}
void WBThrottle::stop()
{
{
Mutex::Locker l(lock);
stopping = true;
cond.Signal();
}
join();
cct->get_perfcounters_collection()->remove(logger);
delete logger;
cct->_conf->remove_observer(this);
}
const char** WBThrottle::get_tracked_conf_keys() const

View File

@ -134,6 +134,7 @@ public:
WBThrottle(CephContext *cct);
~WBThrottle();
void stop();
/// Set fs as XFS or BTRFS
void set_fs(FS new_fs) {
Mutex::Locker l(lock);