summaryrefslogtreecommitdiffstats
path: root/src/tools/cephfs/MDSUtility.cc
diff options
context:
space:
mode:
authorKefu Chai <kchai@redhat.com>2019-07-07 06:44:47 +0200
committerKefu Chai <kchai@redhat.com>2019-08-03 05:27:20 +0200
commit1fb8a60f23b13469f7c6a372588fddb43478d45f (patch)
treeef8a91c2eb673c9dfdab36cebc1368f0a80ad641 /src/tools/cephfs/MDSUtility.cc
parenttest/os/filestore: s/Mutex/ceph::mutex/ (diff)
downloadceph-1fb8a60f23b13469f7c6a372588fddb43478d45f.tar.xz
ceph-1fb8a60f23b13469f7c6a372588fddb43478d45f.zip
tools/cephfs: s/Mutex/ceph::mutex/
Signed-off-by: Kefu Chai <kchai@redhat.com>
Diffstat (limited to 'src/tools/cephfs/MDSUtility.cc')
-rw-r--r--src/tools/cephfs/MDSUtility.cc25
1 files changed, 12 insertions, 13 deletions
diff --git a/src/tools/cephfs/MDSUtility.cc b/src/tools/cephfs/MDSUtility.cc
index 6e71d21a29c..839b4aea050 100644
--- a/src/tools/cephfs/MDSUtility.cc
+++ b/src/tools/cephfs/MDSUtility.cc
@@ -21,7 +21,6 @@
MDSUtility::MDSUtility() :
Dispatcher(g_ceph_context),
objecter(NULL),
- lock("MDSUtility::lock"),
finisher(g_ceph_context, "MDSUtility", "fn_mds_utility"),
waiting_for_mds_map(NULL),
inited(false)
@@ -91,22 +90,22 @@ int MDSUtility::init()
objecter->wait_for_osd_map();
// Prepare to receive MDS map and request it
- Mutex init_lock("MDSUtility:init");
- Cond cond;
+ ceph::mutex init_lock = ceph::make_mutex("MDSUtility:init");
+ ceph::condition_variable cond;
bool done = false;
ceph_assert(!fsmap->get_epoch());
- lock.Lock();
- waiting_for_mds_map = new C_SafeCond(&init_lock, &cond, &done, NULL);
- lock.Unlock();
+ lock.lock();
+ waiting_for_mds_map = new C_SafeCond(init_lock, cond, &done, NULL);
+ lock.unlock();
monc->sub_want("fsmap", 0, CEPH_SUBSCRIBE_ONETIME);
monc->renew_subs();
// Wait for MDS map
dout(4) << "waiting for MDS map..." << dendl;
- init_lock.Lock();
- while (!done)
- cond.Wait(init_lock);
- init_lock.Unlock();
+ {
+ std::unique_lock locker{init_lock};
+ cond.wait(locker, [&done] { return done; });
+ }
dout(4) << "Got MDS map " << fsmap->get_epoch() << dendl;
finisher.start();
@@ -120,9 +119,9 @@ void MDSUtility::shutdown()
{
finisher.stop();
- lock.Lock();
+ lock.lock();
objecter->shutdown();
- lock.Unlock();
+ lock.unlock();
monc->shutdown();
messenger->shutdown();
messenger->wait();
@@ -131,7 +130,7 @@ void MDSUtility::shutdown()
bool MDSUtility::ms_dispatch(Message *m)
{
- Mutex::Locker locker(lock);
+ std::lock_guard locker{lock};
switch (m->get_type()) {
case CEPH_MSG_FS_MAP:
handle_fs_map((MFSMap*)m);