From: Patrick Donnelly Date: Fri, 11 Nov 2016 23:54:03 +0000 (-0500) Subject: mds: organize Capability class members X-Git-Tag: v11.1.0~199^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=d966a42dd8eb9af3184b7592cf39fffe244f0d11;p=ceph.git mds: organize Capability class members This amends the code to follow our C++ style guidelines with the goal of increasing header readability. Signed-off-by: Patrick Donnelly --- diff --git a/src/mds/Capability.h b/src/mds/Capability.h index 30b308549a9f..b8ea0a1e732b 100644 --- a/src/mds/Capability.h +++ b/src/mds/Capability.h @@ -64,18 +64,6 @@ namespace ceph { } class Capability { -private: - static boost::pool<> pool; -public: - static void *operator new(size_t num_bytes) { - void *n = pool.malloc(); - if (!n) - throw std::bad_alloc(); - return n; - } - void operator delete(void *p) { - pool.free(p); - } public: struct Export { int64_t cap_id; @@ -105,23 +93,6 @@ public: void decode(bufferlist::iterator &p); void dump(Formatter *f) const; }; - -private: - CInode *inode; - client_t client; - - uint64_t cap_id; - - __u32 _wanted; // what the client wants (ideally) - - utime_t last_issue_stamp; - utime_t last_revoke_stamp; - unsigned num_revoke_warnings; - - // track in-flight caps -------------- - // - add new caps to _pending - // - track revocations in _revokes list -public: struct revoke_info { __u32 before; ceph_seq_t seq, last_issue; @@ -132,11 +103,47 @@ public: void dump(Formatter *f) const; static void generate_test_instances(list& ls); }; -private: - __u32 _pending, _issued; - list _revokes; -public: + + const static unsigned STATE_STALE = (1<<0); + const static unsigned STATE_NEW = (1<<1); + + + Capability(CInode *i = NULL, uint64_t id = 0, client_t c = 0) : + client_follows(0), client_xattr_version(0), + client_inline_version(0), + last_rbytes(0), last_rsize(0), + item_session_caps(this), item_snaprealm_caps(this), + item_revoking_caps(this), item_client_revoking_caps(this), + inode(i), client(c), + cap_id(id), + _wanted(0), num_revoke_warnings(0), + _pending(0), _issued(0), + last_sent(0), + last_issue(0), + mseq(0), + suppress(0), state(0) { + g_num_cap++; + g_num_capa++; + } + Capability(const Capability& other); // no copying + ~Capability() { + g_num_cap--; + g_num_caps++; + } + + + static void *operator new(size_t num_bytes) { + void *n = pool.malloc(); + if (!n) + throw std::bad_alloc(); + return n; + } + void operator delete(void *p) { + pool.free(p); + } + const Capability& operator=(const Capability& other); // no copying + int pending() { return _pending; } int issued() { return _issued; } bool is_null() { return !_pending && _revokes.empty(); } @@ -217,56 +224,6 @@ public: } } } - - -private: - ceph_seq_t last_sent; - ceph_seq_t last_issue; - ceph_seq_t mseq; - - int suppress; - unsigned state; - - const static unsigned STATE_STALE = (1<<0); - const static unsigned STATE_NEW = (1<<1); - -public: - snapid_t client_follows; - version_t client_xattr_version; - version_t client_inline_version; - int64_t last_rbytes; - int64_t last_rsize; - - xlist::item item_session_caps; - xlist::item item_snaprealm_caps; - xlist::item item_revoking_caps; - xlist::item item_client_revoking_caps; - - Capability(CInode *i = NULL, uint64_t id = 0, client_t c = 0) : - inode(i), client(c), - cap_id(id), - _wanted(0), num_revoke_warnings(0), - _pending(0), _issued(0), - last_sent(0), - last_issue(0), - mseq(0), - suppress(0), state(0), - client_follows(0), client_xattr_version(0), - client_inline_version(0), - last_rbytes(0), last_rsize(0), - item_session_caps(this), item_snaprealm_caps(this), - item_revoking_caps(this), item_client_revoking_caps(this) { - g_num_cap++; - g_num_capa++; - } - ~Capability() { - g_num_cap--; - g_num_caps++; - } - - Capability(const Capability& other); // no copying - const Capability& operator=(const Capability& other); // no copying - ceph_seq_t get_mseq() { return mseq; } void inc_mseq() { mseq++; } @@ -368,6 +325,42 @@ public: void dump(Formatter *f) const; static void generate_test_instances(list& ls); + snapid_t client_follows; + version_t client_xattr_version; + version_t client_inline_version; + int64_t last_rbytes; + int64_t last_rsize; + + xlist::item item_session_caps; + xlist::item item_snaprealm_caps; + xlist::item item_revoking_caps; + xlist::item item_client_revoking_caps; + +private: + static boost::pool<> pool; + CInode *inode; + client_t client; + + uint64_t cap_id; + + __u32 _wanted; // what the client wants (ideally) + + utime_t last_issue_stamp; + utime_t last_revoke_stamp; + unsigned num_revoke_warnings; + + // track in-flight caps -------------- + // - add new caps to _pending + // - track revocations in _revokes list + __u32 _pending, _issued; + list _revokes; + + ceph_seq_t last_sent; + ceph_seq_t last_issue; + ceph_seq_t mseq; + + int suppress; + unsigned state; }; WRITE_CLASS_ENCODER(Capability::Export)