diff options
author | Sage Weil <sage@newdream.net> | 2012-02-24 11:59:20 -0800 |
---|---|---|
committer | Sage Weil <sage@newdream.net> | 2012-02-24 11:59:20 -0800 |
commit | e22adac2249de5564eee4957b957812155105831 (patch) | |
tree | cd345bbd4f6507500bfe9bfb3551bd8238c94136 | |
parent | d3b203af16207797305e5306eafd572f0a0bc6a4 (diff) | |
download | ceph-e22adac2249de5564eee4957b957812155105831.tar.gz |
osd: use blocks for readability in list_missing
Signed-off-by: Sage Weil <sage@newdream.net>
-rw-r--r-- | src/osd/ReplicatedPG.cc | 52 |
1 files changed, 30 insertions, 22 deletions
diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index ed5660dfa08..8e6331e6d25 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -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; |