]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: Reorganize class members in Locker header
authorVarsha Rao <varao@redhat.com>
Thu, 5 Sep 2019 06:38:48 +0000 (12:08 +0530)
committerVarsha Rao <varao@redhat.com>
Mon, 16 Sep 2019 03:39:21 +0000 (23:39 -0400)
Fixes: https://tracker.ceph.com/issues/41665
Signed-off-by: Varsha Rao <varao@redhat.com>
src/mds/Locker.cc
src/mds/Locker.h

index 910b048a007b74ae7df1da776b1adb738f0ec827..fd9f194d6715a349ab1ec1c62ebd6c5f0076db15 100644 (file)
@@ -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<Message> &m)
index f1e867a509627c7dfa04772ad65218da74b16a72..14a020c1401f6b4e66da6af323cd200463309d3c 100644 (file)
 #include <set>
 #include <string_view>
 
+#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<CInode*> *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<MLock> &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<MLock> &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<ScatterLock*> updated_scatterlocks;
-public:
   void mark_updated_scatterlock(ScatterLock *lock);
 
-
   void handle_reqrdlock(SimpleLock *lock, const cref_t<MLock> &m);
 
-
-
   // caps
 
   // when to defer processing client cap release or writeback due to being
@@ -183,62 +143,20 @@ public:
 
   std::vector<client_t> get_late_revoking_clients(double timeout) const;
 
-private:
-  bool any_late_revoking_caps(xlist<Capability*> 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<MClientCaps> &m);
-  void _update_cap_fields(CInode *in, int dirty, const cref_t<MClientCaps> &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<MClientCaps> &m, const ref_t<MClientCaps> &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<MClientCaps> &m,
-                     const ref_t<MClientCaps> &ack, bool *need_flush=NULL);
-  void handle_client_cap_release(const cref_t<MClientCapRelease> &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<Capability*> revoking_caps;
-  // Maintain a per-client list to find clients responsible for late ones quickly
-  std::map<client_t, xlist<Capability*> > revoking_caps_by_client;
-
-  elist<CInode*> 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<MLock> &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<ScatterLock*> 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<MInodeFileCaps> &m);
 
-  void file_update_finish(CInode *in, MutationRef& mut, unsigned flags,
-                         client_t client, const ref_t<MClientCaps> &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<MClientLease> &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<CInode*> *pneed_issue, bool drop_rdlocks);
+
+  void simple_eval(SimpleLock *lock, bool *need_issue);
+  void handle_simple_lock(SimpleLock *lock, const cref_t<MLock> &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<MLock> &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<MClientCaps> &m);
+  void _update_cap_fields(CInode *in, int dirty, const cref_t<MClientCaps> &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<MClientCaps> &m, const ref_t<MClientCaps> &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<MClientCaps> &m,
+                     const ref_t<MClientCaps> &ack, bool *need_flush=NULL);
+  void handle_client_cap_release(const cref_t<MClientCapRelease> &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<MLock> &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<MInodeFileCaps> &m);
+
+  void file_update_finish(CInode *in, MutationRef& mut, unsigned flags,
+                         client_t client, const ref_t<MClientCaps> &ack);
+
+  xlist<ScatterLock*> updated_scatterlocks;
+
+  // Maintain a global list to quickly find if any caps are late revoking
+  xlist<Capability*> revoking_caps;
+  // Maintain a per-client list to find clients responsible for late ones quickly
+  std::map<client_t, xlist<Capability*> > revoking_caps_by_client;
+
+  elist<CInode*> 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<MClientLease> &m);
+  bool any_late_revoking_caps(xlist<Capability*> 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<ScatterLock*> updated_filelocks;
 };
-
-
 #endif