]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
common/AsyncReserver: Mutex -> ceph::mutex
authorSage Weil <sage@redhat.com>
Tue, 16 Oct 2018 14:18:21 +0000 (09:18 -0500)
committerKefu Chai <kchai@redhat.com>
Wed, 21 Nov 2018 03:56:32 +0000 (11:56 +0800)
Signed-off-by: Sage Weil <sage@redhat.com>
src/common/AsyncReserver.h

index c8c57409b4587c35e7e3a214b473fbfe776d8106..c955584b7c051e5f1737a4a53affcc9a27f8e18a 100644 (file)
@@ -33,7 +33,7 @@ class AsyncReserver {
   Finisher *f;
   unsigned max_allowed;
   unsigned min_priority;
-  Mutex lock;
+  ceph::mutex lock = ceph::make_mutex("AsyncReserver::lock");
 
   struct Reservation {
     T item;
@@ -128,23 +128,22 @@ public:
     : cct(cct),
       f(f),
       max_allowed(max_allowed),
-      min_priority(min_priority),
-      lock("AsyncReserver::lock") {}
+      min_priority(min_priority) {}
 
   void set_max(unsigned max) {
-    std::lock_guard<Mutex> l(lock);
+    std::lock_guard l(lock);
     max_allowed = max;
     do_queues();
   }
 
   void set_min_priority(unsigned min) {
-    std::lock_guard<Mutex> l(lock);
+    std::lock_guard l(lock);
     min_priority = min;
     do_queues();
   }
 
   void dump(Formatter *f) {
-    std::lock_guard<Mutex> l(lock);
+    std::lock_guard l(lock);
     _dump(f);
   }
   void _dump(Formatter *f) {
@@ -183,7 +182,7 @@ public:
     unsigned prio,            ///< [in] priority
     Context *on_preempt = 0   ///< [in] callback to be called if we are preempted (optional)
     ) {
-    std::lock_guard<Mutex> l(lock);
+    std::lock_guard l(lock);
     Reservation r(item, prio, on_reserved, on_preempt);
     rdout(10) << __func__ << " queue " << r << dendl;
     ceph_assert(!queue_pointers.count(item) &&
@@ -204,7 +203,7 @@ public:
   void cancel_reservation(
     T item                   ///< [in] key for reservation to cancel
     ) {
-    std::lock_guard<Mutex> l(lock);
+    std::lock_guard l(lock);
     auto i = queue_pointers.find(item);
     if (i != queue_pointers.end()) {
       unsigned prio = i->second.first;
@@ -240,7 +239,7 @@ public:
    * Return true if there are reservations in progress
    */
   bool has_reservation() {
-    std::lock_guard<Mutex> l(lock);
+    std::lock_guard l(lock);
     return !in_progress.empty();
   }
   static const unsigned MAX_PRIORITY = (unsigned)-1;