| 136 | } |
| 137 | virtual void _put() {} |
| 138 | void put(int by) { |
| 139 | #ifdef MDS_REF_SET |
| 140 | if (ref == 0 || ref_map[by] == 0) { |
| 141 | #else |
| 142 | if (ref == 0) { |
| 143 | #endif |
| 144 | bad_put(by); |
| 145 | } else { |
| 146 | ref--; |
| 147 | #ifdef MDS_REF_SET |
| 148 | ref_map[by]--; |
| 149 | #endif |
| 150 | if (ref == 0) |
| 151 | last_put(); |
| 152 | if (state_test(STATE_NOTIFYREF)) |
| 153 | _put(); |
| 154 | } |
| 155 | } |
| 156 | |
| 157 | virtual void first_get() {} |
| 158 | virtual void bad_get(int by) { |
| 159 | #ifdef MDS_REF_SET |
| 160 | ceph_assert(by < 0 || ref_map[by] == 0); |
| 161 | #endif |
| 162 | ceph_abort(); |
| 163 | } |
| 164 | void get(int by) { |
| 165 | if (ref == 0) |
| 166 | first_get(); |
| 167 | ref++; |
| 168 | #ifdef MDS_REF_SET |
| 169 | if (ref_map.find(by) == ref_map.end()) |
| 170 | ref_map[by] = 0; |
| 171 | ref_map[by]++; |
| 172 | #endif |
| 173 | } |
| 174 | |
| 175 | void print_pin_set(std::ostream& out) const { |
| 176 | #ifdef MDS_REF_SET |
| 177 | for(auto const &p : ref_map) { |
| 178 | out << " " << pin_name(p.first) << "=" << p.second; |
| 179 | } |
| 180 | #else |
| 181 | out << " nref=" << ref; |
| 182 | #endif |
| 183 | } |
| 184 | |
| 185 | int get_num_auth_pins() const { return auth_pins; } |
| 186 | #ifdef MDS_AUTHPIN_SET |
| 187 | void print_authpin_set(std::ostream& out) const { |
| 188 | out << " (" << auth_pin_set << ")"; |
| 189 | } |
| 190 | #endif |
| 191 | |
| 192 | void dump_states(ceph::Formatter *f) const; |
| 193 | void dump(ceph::Formatter *f) const; |
| 194 | |
| 195 | // auth pins |