]>
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 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 const compact_map
<mds_rank_t
,unsigned>& replicas
= get_replicas();
25 for (compact_map
<mds_rank_t
,unsigned>::const_iterator i
= replicas
.begin();
26 i
!= replicas
.end(); ++i
) {
27 std::ostringstream rank_str
;
29 f
->dump_int(rank_str
.str().c_str(), i
->second
);
33 f
->close_section(); // auth_state
35 // Fields only meaningful for replica
36 f
->open_object_section("replica_state");
38 f
->open_array_section("authority");
39 f
->dump_int("first", authority().first
);
40 f
->dump_int("second", authority().second
);
42 f
->dump_unsigned("replica_nonce", get_replica_nonce());
44 f
->close_section(); // replica_state
46 f
->dump_int("auth_pins", auth_pins
);
47 f
->dump_int("nested_auth_pins", nested_auth_pins
);
48 f
->dump_bool("is_frozen", is_frozen());
49 f
->dump_bool("is_freezing", is_freezing());
52 f
->open_object_section("pins");
53 for(std::map
<int, int>::const_iterator it
= ref_map
.begin();
54 it
!= ref_map
.end(); ++it
) {
55 f
->dump_int(pin_name(it
->first
), it
->second
);
59 f
->dump_int("nref", ref
);
63 * Use this in subclasses when printing their specialized
66 void MDSCacheObject::dump_states(Formatter
*f
) const
68 if (state_test(STATE_AUTH
)) f
->dump_string("state", "auth");
69 if (state_test(STATE_DIRTY
)) f
->dump_string("state", "dirty");
70 if (state_test(STATE_NOTIFYREF
)) f
->dump_string("state", "notifyref");
71 if (state_test(STATE_REJOINING
)) f
->dump_string("state", "rejoining");
72 if (state_test(STATE_REJOINUNDEF
))
73 f
->dump_string("state", "rejoinundef");