]>
git.proxmox.com Git - ceph.git/blob - ceph/src/mds/MDSCacheObject.cc
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
4 #include "MDSCacheObject.h"
5 #include "MDSContext.h"
6 #include "common/Formatter.h"
8 uint64_t MDSCacheObject::last_wait_seq
= 0;
10 void MDSCacheObject::finish_waiting(uint64_t mask
, int result
) {
11 std::list
<MDSInternalContextBase
*> finished
;
12 take_waiting(mask
, finished
);
13 finish_contexts(g_ceph_context
, finished
, result
);
16 void MDSCacheObject::dump(Formatter
*f
) const
18 f
->dump_bool("is_auth", is_auth());
20 // Fields only meaningful for auth
21 f
->open_object_section("auth_state");
23 f
->open_object_section("replicas");
24 for (const auto &it
: get_replicas()) {
25 std::ostringstream rank_str
;
27 f
->dump_int(rank_str
.str().c_str(), it
.second
);
31 f
->close_section(); // auth_state
33 // Fields only meaningful for replica
34 f
->open_object_section("replica_state");
36 f
->open_array_section("authority");
37 f
->dump_int("first", authority().first
);
38 f
->dump_int("second", authority().second
);
40 f
->dump_unsigned("replica_nonce", get_replica_nonce());
42 f
->close_section(); // replica_state
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());
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
);
57 f
->dump_int("nref", ref
);
61 * Use this in subclasses when printing their specialized
64 void MDSCacheObject::dump_states(Formatter
*f
) const
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");