#include "common/debug.h"
#include "mdstypes.h"
+#include <iostream>
+
#define dout_subsys ceph_subsys_mds
using std::list;
static multimap<ceph_filelock, ceph_lock_state_t*> global_waiting_locks;
+std::ostream& operator<<(std::ostream& out, const ceph_filelock& l) {
+ out << "start: " << l.start << ", length: " << l.length
+ << ", client: " << l.client << ", owner: " << l.owner
+ << ", pid: " << l.pid << ", type: " << (int)l.type
+ << std::endl;
+ return out;
+}
+
static void remove_global_waiting(ceph_filelock &fl, ceph_lock_state_t *lock_state)
{
for (auto p = global_waiting_locks.find(fl);
}
}
+void ceph_lock_state_t::encode(ceph::bufferlist& bl) const {
+ using ceph::encode;
+ encode(held_locks, bl);
+ encode(client_held_lock_counts, bl);
+}
+
+void ceph_lock_state_t::decode(ceph::bufferlist::const_iterator& bl) {
+ using ceph::decode;
+ decode(held_locks, bl);
+ decode(client_held_lock_counts, bl);
+}
+
void ceph_lock_state_t::dump(ceph::Formatter *f) const {
f->dump_int("type", type);
f->dump_int("held_locks", held_locks.size());
}
return NULL;
}
+
+std::ostream& operator<<(std::ostream &out, const ceph_lock_state_t &l) {
+ out << "ceph_lock_state_t. held_locks.size()=" << l.held_locks.size()
+ << ", waiting_locks.size()=" << l.waiting_locks.size()
+ << ", client_held_lock_counts -- " << l.client_held_lock_counts
+ << "\n client_waiting_lock_counts -- " << l.client_waiting_lock_counts
+ << "\n held_locks -- ";
+ for (auto iter = l.held_locks.begin();
+ iter != l.held_locks.end();
+ ++iter)
+ out << iter->second;
+ out << "\n waiting_locks -- ";
+ for (auto iter =l.waiting_locks.begin();
+ iter != l.waiting_locks.end();
+ ++iter)
+ out << iter->second << "\n";
+ return out;
+}
#include "include/types.h" // for client_t
#include <cstdint>
+#include <iosfwd>
#include <list>
#include <map>
-#include <ostream>
-inline std::ostream& operator<<(std::ostream& out, const ceph_filelock& l) {
- out << "start: " << l.start << ", length: " << l.length
- << ", client: " << l.client << ", owner: " << l.owner
- << ", pid: " << l.pid << ", type: " << (int)l.type
- << std::endl;
- return out;
-}
+std::ostream& operator<<(std::ostream& out, const ceph_filelock& l);
inline bool ceph_filelock_owner_equal(const ceph_filelock& l, const ceph_filelock& r)
{
bool remove_all_from(client_t client);
- void encode(ceph::bufferlist& bl) const {
- using ceph::encode;
- encode(held_locks, bl);
- encode(client_held_lock_counts, bl);
- }
- void decode(ceph::bufferlist::const_iterator& bl) {
- using ceph::decode;
- decode(held_locks, bl);
- decode(client_held_lock_counts, bl);
- }
+ void encode(ceph::bufferlist& bl) const;
+ void decode(ceph::bufferlist::const_iterator& bl);
void dump(ceph::Formatter *f) const;
static void generate_test_instances(std::list<ceph_lock_state_t*>& ls);
bool empty() const {
};
WRITE_CLASS_ENCODER(ceph_lock_state_t)
-inline std::ostream& operator<<(std::ostream &out, const ceph_lock_state_t &l) {
- out << "ceph_lock_state_t. held_locks.size()=" << l.held_locks.size()
- << ", waiting_locks.size()=" << l.waiting_locks.size()
- << ", client_held_lock_counts -- " << l.client_held_lock_counts
- << "\n client_waiting_lock_counts -- " << l.client_waiting_lock_counts
- << "\n held_locks -- ";
- for (auto iter = l.held_locks.begin();
- iter != l.held_locks.end();
- ++iter)
- out << iter->second;
- out << "\n waiting_locks -- ";
- for (auto iter =l.waiting_locks.begin();
- iter != l.waiting_locks.end();
- ++iter)
- out << iter->second << "\n";
- return out;
-}
+std::ostream& operator<<(std::ostream &out, const ceph_lock_state_t &l);
#endif