From: Varsha Rao Date: Tue, 24 Dec 2019 08:46:28 +0000 (+0530) Subject: mds: Reorganize structure members in flock header X-Git-Tag: v15.1.0~225^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=8ce8caffcfe363d2aa5410b0cc581dc034a58d5b;p=ceph.git mds: Reorganize structure members in flock header Fixes: https://tracker.ceph.com/issues/43418 Signed-off-by: Varsha Rao --- diff --git a/src/mds/flock.h b/src/mds/flock.h index ef1793f46aa8..7166f8783da4 100644 --- a/src/mds/flock.h +++ b/src/mds/flock.h @@ -8,7 +8,6 @@ #include "common/debug.h" #include "mdstypes.h" - inline ostream& operator<<(ostream& out, const ceph_filelock& l) { out << "start: " << l.start << ", length: " << l.length << ", client: " << l.client << ", owner: " << l.owner @@ -70,17 +69,9 @@ inline bool operator!=(const ceph_filelock& l, const ceph_filelock& r) { } class ceph_lock_state_t { - CephContext *cct; - int type; public: explicit ceph_lock_state_t(CephContext *cct_, int type_) : cct(cct_), type(type_) {} ~ceph_lock_state_t(); - multimap held_locks; // current locks - multimap waiting_locks; // locks waiting for other locks - // both of the above are keyed by starting offset - map client_held_lock_counts; - map client_waiting_lock_counts; - /** * Check if a lock is on the waiting_locks list. * @@ -130,6 +121,29 @@ public: list& activated_locks); bool remove_all_from(client_t client); + + void encode(bufferlist& bl) const { + using ceph::encode; + encode(held_locks, bl); + encode(client_held_lock_counts, bl); + } + void decode(bufferlist::const_iterator& bl) { + using ceph::decode; + decode(held_locks, bl); + decode(client_held_lock_counts, bl); + } + bool empty() const { + return held_locks.empty() && waiting_locks.empty() && + client_held_lock_counts.empty() && + client_waiting_lock_counts.empty(); + } + + multimap held_locks; // current locks + multimap waiting_locks; // locks waiting for other locks + // both of the above are keyed by starting offset + map client_held_lock_counts; + map client_waiting_lock_counts; + private: static const unsigned MAX_DEADLK_DEPTH = 5; @@ -249,26 +263,11 @@ private: ceph_filelock *contains_exclusive_lock(list::iterator>& locks); -public: - void encode(bufferlist& bl) const { - using ceph::encode; - encode(held_locks, bl); - encode(client_held_lock_counts, bl); - } - void decode(bufferlist::const_iterator& bl) { - using ceph::decode; - decode(held_locks, bl); - decode(client_held_lock_counts, bl); - } - bool empty() const { - return held_locks.empty() && waiting_locks.empty() && - client_held_lock_counts.empty() && - client_waiting_lock_counts.empty(); - } + CephContext *cct; + int type; }; WRITE_CLASS_ENCODER(ceph_lock_state_t) - inline ostream& operator<<(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()