From: Varsha Rao Date: Thu, 5 Sep 2019 06:38:48 +0000 (+0530) Subject: mds: Reorganize class members in Locker header X-Git-Tag: v15.1.0~1445^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=5249b211e4cbfb05fe14ba3ba0c662d2a9333cd3;p=ceph.git mds: Reorganize class members in Locker header Fixes: https://tracker.ceph.com/issues/41665 Signed-off-by: Varsha Rao --- diff --git a/src/mds/Locker.cc b/src/mds/Locker.cc index 910b048a007b..fd9f194d6715 100644 --- a/src/mds/Locker.cc +++ b/src/mds/Locker.cc @@ -86,7 +86,7 @@ public: }; Locker::Locker(MDSRank *m, MDCache *c) : - mds(m), mdcache(c), need_snapflush_inodes(member_offset(CInode, item_caps)) {} + need_snapflush_inodes(member_offset(CInode, item_caps)), mds(m), mdcache(c) {} void Locker::dispatch(const cref_t &m) diff --git a/src/mds/Locker.h b/src/mds/Locker.h index f1e867a50962..14a020c1401f 100644 --- a/src/mds/Locker.h +++ b/src/mds/Locker.h @@ -27,29 +27,24 @@ #include #include +#include "CInode.h" +#include "SimpleLock.h" +#include "MDSContext.h" +#include "Mutation.h" +#include "messages/MClientReply.h" + +struct SnapRealm; + class MDSRank; class Session; class CDentry; -struct SnapRealm; - class Capability; - class SimpleLock; class ScatterLock; class LocalLock; -#include "CInode.h" -#include "SimpleLock.h" -#include "MDSContext.h" -#include "Mutation.h" -#include "messages/MClientReply.h" - class Locker { -private: - MDSRank *mds; - MDCache *mdcache; - - public: +public: Locker(MDSRank *m, MDCache *c); SimpleLock *get_lock(int lock_type, const MDSCacheObjectInfo &info); @@ -61,13 +56,6 @@ private: void nudge_log(SimpleLock *lock); -protected: - void send_lock_message(SimpleLock *lock, int msg); - void send_lock_message(SimpleLock *lock, int msg, const bufferlist &data); - - // -- locks -- - void _drop_locks(MutationImpl *mut, std::set *pneed_issue, bool drop_rdlocks); -public: void include_snap_rdlocks(CInode *in, MutationImpl::LockOpVec& lov); void include_snap_rdlocks_wlayout(CInode *in, MutationImpl::LockOpVec& lov, file_layout_t **layout); @@ -123,49 +111,21 @@ public: void xlock_export(const MutationImpl::lock_iterator& it, MutationImpl *mut); void xlock_import(SimpleLock *lock); - - // simple -public: void try_simple_eval(SimpleLock *lock); bool simple_rdlock_try(SimpleLock *lock, MDSContext *con); -protected: - void simple_eval(SimpleLock *lock, bool *need_issue); - void handle_simple_lock(SimpleLock *lock, const cref_t &m); -public: bool simple_sync(SimpleLock *lock, bool *need_issue=0); -protected: - void simple_lock(SimpleLock *lock, bool *need_issue=0); - void simple_excl(SimpleLock *lock, bool *need_issue=0); - void simple_xlock(SimpleLock *lock); - - // scatter -public: + // scatter void scatter_eval(ScatterLock *lock, bool *need_issue); // public for MDCache::adjust_subtree_auth() void scatter_tick(); void scatter_nudge(ScatterLock *lock, MDSContext *c, bool forcelockchange=false); -protected: - void handle_scatter_lock(ScatterLock *lock, const cref_t &m); - bool scatter_scatter_fastpath(ScatterLock *lock); - void scatter_scatter(ScatterLock *lock, bool nowait=false); - void scatter_tempsync(ScatterLock *lock, bool *need_issue=0); - - void scatter_writebehind(ScatterLock *lock); - - void scatter_writebehind_finish(ScatterLock *lock, MutationRef& mut); - - xlist updated_scatterlocks; -public: void mark_updated_scatterlock(ScatterLock *lock); - void handle_reqrdlock(SimpleLock *lock, const cref_t &m); - - // caps // when to defer processing client cap release or writeback due to being @@ -183,62 +143,20 @@ public: std::vector get_late_revoking_clients(double timeout) const; -private: - bool any_late_revoking_caps(xlist const &revoking, double timeout) const; - -protected: - bool _need_flush_mdlog(CInode *in, int wanted_caps); - void adjust_cap_wanted(Capability *cap, int wanted, int issue_seq); - void handle_client_caps(const cref_t &m); - void _update_cap_fields(CInode *in, int dirty, const cref_t &m, CInode::mempool_inode *pi); - void _do_snap_update(CInode *in, snapid_t snap, int dirty, snapid_t follows, client_t client, const cref_t &m, const ref_t &ack); - void _do_null_snapflush(CInode *head_in, client_t client, snapid_t last=CEPH_NOSNAP); - bool _do_cap_update(CInode *in, Capability *cap, int dirty, snapid_t follows, const cref_t &m, - const ref_t &ack, bool *need_flush=NULL); - void handle_client_cap_release(const cref_t &m); - void _do_cap_release(client_t client, inodeno_t ino, uint64_t cap_id, ceph_seq_t mseq, ceph_seq_t seq); - void caps_tick(); - - // Maintain a global list to quickly find if any caps are late revoking - xlist revoking_caps; - // Maintain a per-client list to find clients responsible for late ones quickly - std::map > revoking_caps_by_client; - - elist need_snapflush_inodes; -public: void snapflush_nudge(CInode *in); void mark_need_snapflush_inode(CInode *in); bool is_revoking_any_caps_from(client_t client); // local -public: void local_wrlock_grab(LocalLock *lock, MutationRef& mut); -protected: - bool local_wrlock_start(LocalLock *lock, MDRequestRef& mut); - void local_wrlock_finish(const MutationImpl::lock_iterator& it, MutationImpl *mut); - bool local_xlock_start(LocalLock *lock, MDRequestRef& mut); - void local_xlock_finish(const MutationImpl::lock_iterator& it, MutationImpl *mut); - // file -public: void file_eval(ScatterLock *lock, bool *need_issue); -protected: - void handle_file_lock(ScatterLock *lock, const cref_t &m); - void scatter_mix(ScatterLock *lock, bool *need_issue=0); - void file_excl(ScatterLock *lock, bool *need_issue=0); - void file_xsyn(SimpleLock *lock, bool *need_issue=0); - -public: void file_recover(ScatterLock *lock); -private: - xlist updated_filelocks; -public: void mark_updated_Filelock(ScatterLock *lock); // -- file i/o -- -public: version_t issue_file_data_version(CInode *in); Capability* issue_new_caps(CInode *in, int mode, Session *session, SnapRealm *conrealm, bool is_replay); int issue_caps(CInode *in, Capability *only_cap=0); @@ -249,16 +167,8 @@ public: void resume_stale_caps(Session *session); void remove_stale_leases(Session *session); -public: void request_inode_file_caps(CInode *in); -protected: - void handle_inode_file_caps(const cref_t &m); - void file_update_finish(CInode *in, MutationRef& mut, unsigned flags, - client_t client, const ref_t &ack); -private: - uint64_t calc_new_max_size(CInode::mempool_inode *pi, uint64_t size); -public: void calc_new_client_ranges(CInode *in, uint64_t size, bool update, CInode::mempool_inode::client_range_map* new_ranges, bool *max_increased); @@ -267,6 +177,72 @@ public: utime_t mtime=utime_t()); void share_inode_max_size(CInode *in, Capability *only_cap=0); + // -- client leases -- + void handle_client_lease(const cref_t &m); + + void issue_client_lease(CDentry *dn, client_t client, bufferlist &bl, utime_t now, Session *session); + void revoke_client_leases(SimpleLock *lock); + static void encode_lease(bufferlist& bl, const session_info_t& info, const LeaseStat& ls); + +protected: + void send_lock_message(SimpleLock *lock, int msg); + void send_lock_message(SimpleLock *lock, int msg, const bufferlist &data); + + // -- locks -- + void _drop_locks(MutationImpl *mut, std::set *pneed_issue, bool drop_rdlocks); + + void simple_eval(SimpleLock *lock, bool *need_issue); + void handle_simple_lock(SimpleLock *lock, const cref_t &m); + + void simple_lock(SimpleLock *lock, bool *need_issue=0); + void simple_excl(SimpleLock *lock, bool *need_issue=0); + void simple_xlock(SimpleLock *lock); + + void handle_scatter_lock(ScatterLock *lock, const cref_t &m); + bool scatter_scatter_fastpath(ScatterLock *lock); + void scatter_scatter(ScatterLock *lock, bool nowait=false); + void scatter_tempsync(ScatterLock *lock, bool *need_issue=0); + + void scatter_writebehind(ScatterLock *lock); + + void scatter_writebehind_finish(ScatterLock *lock, MutationRef& mut); + + bool _need_flush_mdlog(CInode *in, int wanted_caps); + void adjust_cap_wanted(Capability *cap, int wanted, int issue_seq); + void handle_client_caps(const cref_t &m); + void _update_cap_fields(CInode *in, int dirty, const cref_t &m, CInode::mempool_inode *pi); + void _do_snap_update(CInode *in, snapid_t snap, int dirty, snapid_t follows, client_t client, const cref_t &m, const ref_t &ack); + void _do_null_snapflush(CInode *head_in, client_t client, snapid_t last=CEPH_NOSNAP); + bool _do_cap_update(CInode *in, Capability *cap, int dirty, snapid_t follows, const cref_t &m, + const ref_t &ack, bool *need_flush=NULL); + void handle_client_cap_release(const cref_t &m); + void _do_cap_release(client_t client, inodeno_t ino, uint64_t cap_id, ceph_seq_t mseq, ceph_seq_t seq); + void caps_tick(); + + bool local_wrlock_start(LocalLock *lock, MDRequestRef& mut); + void local_wrlock_finish(const MutationImpl::lock_iterator& it, MutationImpl *mut); + bool local_xlock_start(LocalLock *lock, MDRequestRef& mut); + void local_xlock_finish(const MutationImpl::lock_iterator& it, MutationImpl *mut); + + void handle_file_lock(ScatterLock *lock, const cref_t &m); + void scatter_mix(ScatterLock *lock, bool *need_issue=0); + void file_excl(ScatterLock *lock, bool *need_issue=0); + void file_xsyn(SimpleLock *lock, bool *need_issue=0); + + void handle_inode_file_caps(const cref_t &m); + + void file_update_finish(CInode *in, MutationRef& mut, unsigned flags, + client_t client, const ref_t &ack); + + xlist updated_scatterlocks; + + // Maintain a global list to quickly find if any caps are late revoking + xlist revoking_caps; + // Maintain a per-client list to find clients responsible for late ones quickly + std::map > revoking_caps_by_client; + + elist need_snapflush_inodes; + private: friend class C_MDL_CheckMaxSize; friend class C_MDL_RequestInodeFileCaps; @@ -277,15 +253,11 @@ private: friend class LockerContext; friend class LockerLogContext; - - // -- client leases -- -public: - void handle_client_lease(const cref_t &m); + bool any_late_revoking_caps(xlist const &revoking, double timeout) const; + uint64_t calc_new_max_size(CInode::mempool_inode *pi, uint64_t size); - void issue_client_lease(CDentry *dn, client_t client, bufferlist &bl, utime_t now, Session *session); - void revoke_client_leases(SimpleLock *lock); - static void encode_lease(bufferlist& bl, const session_info_t& info, const LeaseStat& ls); + MDSRank *mds; + MDCache *mdcache; + xlist updated_filelocks; }; - - #endif