]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: PaxosService: drop atomic_t on 'proposing' 315/head
authorJoao Eduardo Luis <joao.luis@inktank.com>
Mon, 6 May 2013 16:10:15 +0000 (17:10 +0100)
committerJoao Eduardo Luis <joao.luis@inktank.com>
Wed, 22 May 2013 17:05:41 +0000 (18:05 +0100)
We don't need this to be atomic -- a simple boolean is enough.

Fixes: #4507
Signed-off-by: Joao Eduardo Luis <joao.luis@inktank.com>
src/mon/PaxosService.cc
src/mon/PaxosService.h

index 8f421ab3d81875bb7628cae78fda33b8e00403c4..719ba48a65cfd1aa89d817bc6a19d9c47ac8fead 100644 (file)
@@ -176,7 +176,7 @@ void PaxosService::propose_pending()
   t.encode(bl);
 
   // apply to paxos
-  proposing.set(1);
+  proposing = true;
   paxos->propose_new_value(bl, new C_Committed(this));
 }
 
@@ -219,7 +219,7 @@ void PaxosService::election_finished()
     discard_pending();
     have_pending = false;
   }
-  proposing.set(0);
+  proposing = false;
 
   finish_contexts(g_ceph_context, waiting_for_finished_proposal, -EAGAIN);
 
index 0e4c9e23b025b3af5e3b9afc52c7067298a743b3..def0a85e7f63bf4673f97a48663d054af331a26b 100644 (file)
@@ -54,7 +54,7 @@ class PaxosService {
    * If we are or have queued anything for proposal, this variable will be true
    * until our proposal has been finished.
    */
-  atomic_t proposing;
+  bool proposing;
 
  protected:
   /**
@@ -167,7 +167,7 @@ protected:
   public:
     C_Committed(PaxosService *p) : ps(p) { }
     void finish(int r) {
-      ps->proposing.set(0);
+      ps->proposing = false;
       if (r >= 0)
        ps->_active();
       else if (r == -ECANCELED || r == -EAGAIN)
@@ -190,6 +190,7 @@ public:
    */
   PaxosService(Monitor *mn, Paxos *p, string name) 
     : mon(mn), paxos(p), service_name(name),
+      proposing(false),
       service_version(0), proposal_timer(0), have_pending(false),
       trim_version(0),
       last_committed_name("last_committed"),
@@ -198,7 +199,6 @@ public:
       mkfs_name("mkfs"),
       full_version_name("full"), full_latest_name("latest")
   {
-    proposing.set(0);
   }
 
   virtual ~PaxosService() {}
@@ -486,7 +486,7 @@ public:
    * @returns true if we are proposing; false otherwise.
    */
   bool is_proposing() {
-    return ((int) proposing.read() == 1);
+    return proposing;
   }
 
   /**