]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: minor refactor of SimpleLock
authorPatrick Donnelly <pdonnell@redhat.com>
Wed, 24 Jan 2018 23:32:18 +0000 (15:32 -0800)
committerPatrick Donnelly <pdonnell@redhat.com>
Tue, 20 Feb 2018 02:06:54 +0000 (18:06 -0800)
Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
(cherry picked from commit e9be29c6aac1bc111271c383bcef32a70e4064e7)

src/mds/SimpleLock.cc
src/mds/SimpleLock.h

index 1ec23f449f3f04f92038c14064e8fcfae8c6e453..8167ad1d16e3395469c3d54b4662a6ec81cb80b3 100644 (file)
@@ -24,9 +24,8 @@ void SimpleLock::dump(Formatter *f) const {
 
   f->open_array_section("gather_set");
   if (have_more()) {
-    for(std::set<int32_t>::iterator i = more()->gather_set.begin();
-        i != more()->gather_set.end(); ++i) {
-      f->dump_int("rank", *i);
+    for(const auto &i : more()->gather_set) {
+      f->dump_int("rank", i);
     }
   }
   f->close_section();
index 10692bfcfda628cc966177c94f551718b9b119de..2c0ff9327c3a48d8425c4601a032babb36b69277 100644 (file)
@@ -182,10 +182,10 @@ private:
     set<__s32> gather_set;  // auth+rep.  >= 0 is mds, < 0 is client
 
     // local state
-    int num_wrlock, num_xlock;
+    int num_wrlock = 0, num_xlock = 0;
     MutationRef xlock_by;
-    client_t xlock_by_client;
-    client_t excl_client;
+    client_t xlock_by_client = -1;
+    client_t excl_client = -1;
 
     bool empty() {
       return
@@ -197,11 +197,7 @@ private:
        excl_client == -1;
     }
 
-    unstable_bits_t() : num_wrlock(0),
-                       num_xlock(0),
-                       xlock_by(),
-                       xlock_by_client(-1),
-                       excl_client(-1) {}
+    unstable_bits_t() {}
   };
 
   mutable std::unique_ptr<unstable_bits_t> _unstable;