]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- |
2 | // vim: ts=8 sw=2 smarttab | |
3 | ||
4 | #include "MDSCacheObject.h" | |
5 | #include "MDSContext.h" | |
6 | #include "common/Formatter.h" | |
7 | ||
8 | uint64_t MDSCacheObject::last_wait_seq = 0; | |
9 | ||
10 | void MDSCacheObject::finish_waiting(uint64_t mask, int result) { | |
181888fb | 11 | std::list<MDSInternalContextBase*> finished; |
7c673cae FG |
12 | take_waiting(mask, finished); |
13 | finish_contexts(g_ceph_context, finished, result); | |
14 | } | |
15 | ||
16 | void MDSCacheObject::dump(Formatter *f) const | |
17 | { | |
18 | f->dump_bool("is_auth", is_auth()); | |
19 | ||
20 | // Fields only meaningful for auth | |
21 | f->open_object_section("auth_state"); | |
22 | { | |
23 | f->open_object_section("replicas"); | |
181888fb | 24 | for (const auto &it : get_replicas()) { |
7c673cae | 25 | std::ostringstream rank_str; |
181888fb FG |
26 | rank_str << it.first; |
27 | f->dump_int(rank_str.str().c_str(), it.second); | |
7c673cae FG |
28 | } |
29 | f->close_section(); | |
30 | } | |
31 | f->close_section(); // auth_state | |
32 | ||
33 | // Fields only meaningful for replica | |
34 | f->open_object_section("replica_state"); | |
35 | { | |
36 | f->open_array_section("authority"); | |
37 | f->dump_int("first", authority().first); | |
38 | f->dump_int("second", authority().second); | |
39 | f->close_section(); | |
40 | f->dump_unsigned("replica_nonce", get_replica_nonce()); | |
41 | } | |
42 | f->close_section(); // replica_state | |
43 | ||
44 | f->dump_int("auth_pins", auth_pins); | |
45 | f->dump_int("nested_auth_pins", nested_auth_pins); | |
46 | f->dump_bool("is_frozen", is_frozen()); | |
47 | f->dump_bool("is_freezing", is_freezing()); | |
48 | ||
49 | #ifdef MDS_REF_SET | |
50 | f->open_object_section("pins"); | |
51 | for(std::map<int, int>::const_iterator it = ref_map.begin(); | |
52 | it != ref_map.end(); ++it) { | |
53 | f->dump_int(pin_name(it->first), it->second); | |
54 | } | |
55 | f->close_section(); | |
56 | #endif | |
57 | f->dump_int("nref", ref); | |
58 | } | |
59 | ||
60 | /* | |
61 | * Use this in subclasses when printing their specialized | |
62 | * states too. | |
63 | */ | |
64 | void MDSCacheObject::dump_states(Formatter *f) const | |
65 | { | |
66 | if (state_test(STATE_AUTH)) f->dump_string("state", "auth"); | |
67 | if (state_test(STATE_DIRTY)) f->dump_string("state", "dirty"); | |
68 | if (state_test(STATE_NOTIFYREF)) f->dump_string("state", "notifyref"); | |
69 | if (state_test(STATE_REJOINING)) f->dump_string("state", "rejoining"); | |
70 | if (state_test(STATE_REJOINUNDEF)) | |
71 | f->dump_string("state", "rejoinundef"); | |
72 | } | |
73 |