]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: use blocks for readability in list_missing
authorSage Weil <sage@newdream.net>
Fri, 24 Feb 2012 19:59:20 +0000 (11:59 -0800)
committerSage Weil <sage@newdream.net>
Fri, 24 Feb 2012 19:59:20 +0000 (11:59 -0800)
Signed-off-by: Sage Weil <sage@newdream.net>
src/osd/ReplicatedPG.cc

index ed5660dfa0813370c0bef57dd1ad44e243cf81c3..8e6331e6d25510519f768228266b3e6a297fc667 100644 (file)
@@ -330,33 +330,41 @@ int ReplicatedPG::do_command(vector<string>& cmd, ostream& ss,
       }
     }
     jf.open_object_section("missing");
-    jf.open_object_section("offset");
-    offset.dump(&jf);
-    jf.close_section();
+    {
+      jf.open_object_section("offset");
+      offset.dump(&jf);
+      jf.close_section();
+    }
     jf.dump_int("num_missing", missing.num_missing());
     jf.dump_int("num_unfound", get_num_unfound());
-    jf.open_array_section("objects");
     map<hobject_t,pg_missing_t::item>::iterator p = missing.missing.upper_bound(offset);
-    uint32_t num = 0;
-    set<int> empty;
-    bufferlist bl;
-    while (p != missing.missing.end() && num < g_conf->osd_command_max_records) {
-      jf.open_object_section("object");
-      jf.open_object_section("oid");
-      p->first.dump(&jf);
-      jf.close_section();
-      p->second.dump(&jf);  // have, need keys
-      jf.open_array_section("locations");
-      map<hobject_t,set<int> >::iterator q = missing_loc.find(p->first);
-      if (q != missing_loc.end())
-       for (set<int>::iterator r = q->second.begin(); r != q->second.end(); ++r)
-         jf.dump_int("osd", *r);
-      jf.close_section();
+    {
+      jf.open_array_section("objects");
+      int32_t num = 0;
+      set<int> empty;
+      bufferlist bl;
+      while (p != missing.missing.end() && num < g_conf->osd_command_max_records) {
+       jf.open_object_section("object");
+       {
+         jf.open_object_section("oid");
+         p->first.dump(&jf);
+         jf.close_section();
+       }
+       p->second.dump(&jf);  // have, need keys
+       {
+         jf.open_array_section("locations");
+         map<hobject_t,set<int> >::iterator q = missing_loc.find(p->first);
+         if (q != missing_loc.end())
+           for (set<int>::iterator r = q->second.begin(); r != q->second.end(); ++r)
+             jf.dump_int("osd", *r);
+         jf.close_section();
+       }
+       jf.close_section();
+       ++p;
+       num++;
+      }
       jf.close_section();
-      ++p;
-      num++;
     }
-    jf.close_section();
     jf.dump_int("more", p != missing.missing.end());
     jf.close_section();
     stringstream jss;