From: Patrick Donnelly Date: Tue, 11 Apr 2017 19:00:06 +0000 (-0400) Subject: mds: organize Migrator headers X-Git-Tag: v12.0.3~38^2~35 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=36f3bc067f0971d490ab4aabe4feab2996138275;p=ceph.git mds: organize Migrator headers This follows the coding style guidelines: https://google.github.io/styleguide/cppguide.html#Declaration_Order Signed-off-by: Patrick Donnelly --- diff --git a/src/mds/Migrator.h b/src/mds/Migrator.h index 85ae9cf44104..241faf0a64d6 100644 --- a/src/mds/Migrator.h +++ b/src/mds/Migrator.h @@ -50,11 +50,6 @@ class MGatherCaps; class EImportStart; class Migrator { -private: - MDSRank *mds; - MDCache *cache; - - // -- exports -- public: // export stages. used to clean up intelligently if there's a failure. const static int EXPORT_CANCELLED = 0; // cancelled @@ -82,31 +77,7 @@ public: } } -protected: - // export fun - struct export_state_t { - int state; - mds_rank_t peer; - uint64_t tid; - set warning_ack_waiting; - set notify_ack_waiting; - map > peer_imported; - MutationRef mut; - // for freeze tree deadlock detection - utime_t last_cum_auth_pins_change; - int last_cum_auth_pins; - int num_remote_waiters; // number of remote authpin waiters - export_state_t() : state(0), peer(0), tid(0), mut(), - last_cum_auth_pins(0), num_remote_waiters(0) {} - }; - - map export_state; - - list > export_queue; - - // -- imports -- -public: const static int IMPORT_DISCOVERING = 1; // waiting for prep const static int IMPORT_DISCOVERED = 2; // waiting for prep const static int IMPORT_PREPPING = 3; // opening dirs on bounds @@ -115,7 +86,6 @@ public: const static int IMPORT_ACKING = 6; // logged EImportStart, sent ack, waiting for finish const static int IMPORT_FINISHING = 7; // sent cap imports, waiting for finish const static int IMPORT_ABORTING = 8; // notifying bystanders of an abort before unfreezing - static const char *get_import_statename(int s) { switch (s) { case IMPORT_DISCOVERING: return "discovering"; @@ -130,7 +100,34 @@ public: } } + // -- cons -- + Migrator(MDSRank *m, MDCache *c) : mds(m), cache(c) {} + + + protected: + // export fun + struct export_state_t { + int state; + mds_rank_t peer; + uint64_t tid; + set warning_ack_waiting; + set notify_ack_waiting; + map > peer_imported; + MutationRef mut; + // for freeze tree deadlock detection + utime_t last_cum_auth_pins_change; + int last_cum_auth_pins; + int num_remote_waiters; // number of remote authpin waiters + export_state_t() : state(0), peer(0), tid(0), mut(), + last_cum_auth_pins(0), num_remote_waiters(0) {} + }; + + map export_state; + + list > export_queue; + + // import fun struct import_state_t { int state; mds_rank_t peer; @@ -146,9 +143,66 @@ protected: map import_state; + void handle_export_discover_ack(MExportDirDiscoverAck *m); + void export_frozen(CDir *dir, uint64_t tid); + void handle_export_prep_ack(MExportDirPrepAck *m); + void export_sessions_flushed(CDir *dir, uint64_t tid); + void export_go(CDir *dir); + void export_go_synced(CDir *dir, uint64_t tid); + void export_try_cancel(CDir *dir, bool notify_peer=true); + void export_cancel_finish(CDir *dir); + void export_reverse(CDir *dir); + void export_notify_abort(CDir *dir, set& bounds); + void handle_export_ack(MExportDirAck *m); + void export_logged_finish(CDir *dir); + void handle_export_notify_ack(MExportDirNotifyAck *m); + void export_finish(CDir *dir); + + void handle_gather_caps(MGatherCaps *m); + + friend class C_MDC_ExportFreeze; + friend class C_MDS_ExportFinishLogged; + friend class C_M_ExportGo; + friend class C_M_ExportSessionsFlushed; + friend class MigratorContext; + friend class MigratorLogContext; + + // importer + void handle_export_discover(MExportDirDiscover *m); + void handle_export_cancel(MExportDirCancel *m); + void handle_export_prep(MExportDirPrep *m); + void handle_export_dir(MExportDir *m); + + void import_reverse_discovering(dirfrag_t df); + void import_reverse_discovered(dirfrag_t df, CInode *diri); + void import_reverse_prepping(CDir *dir); + void import_remove_pins(CDir *dir, set& bounds); + void import_reverse_unfreeze(CDir *dir); + void import_reverse_final(CDir *dir); + void import_notify_abort(CDir *dir, set& bounds); + void import_notify_finish(CDir *dir, set& bounds); + void import_logged_start(dirfrag_t df, CDir *dir, mds_rank_t from, + map &imported_client_map, + map& sseqmap); + void handle_export_finish(MExportDirFinish *m); + + void handle_export_caps(MExportCaps *m); + void logged_import_caps(CInode *in, + mds_rank_t from, + map >& cap_imports, + map& client_map, + map& sseqmap); + + + friend class C_MDS_ImportDirLoggedStart; + friend class C_MDS_ImportDirLoggedFinish; + friend class C_M_LoggedImportCaps; + + // bystander + void handle_export_notify(MExportDirNotify *m); + + public: - // -- cons -- - Migrator(MDSRank *m, MDCache *c) : mds(m), cache(c) {} void dispatch(Message*); @@ -230,7 +284,6 @@ public: // -- import/export -- // exporter - public: void dispatch_export_dir(MDRequestRef& mdr); void export_dir(CDir *dir, mds_rank_t dest); void export_empty_import(CDir *dir); @@ -268,38 +321,6 @@ public: void export_caps(CInode *in); - protected: - void handle_export_discover_ack(MExportDirDiscoverAck *m); - void export_frozen(CDir *dir, uint64_t tid); - void handle_export_prep_ack(MExportDirPrepAck *m); - void export_sessions_flushed(CDir *dir, uint64_t tid); - void export_go(CDir *dir); - void export_go_synced(CDir *dir, uint64_t tid); - void export_try_cancel(CDir *dir, bool notify_peer=true); - void export_cancel_finish(CDir *dir); - void export_reverse(CDir *dir); - void export_notify_abort(CDir *dir, set& bounds); - void handle_export_ack(MExportDirAck *m); - void export_logged_finish(CDir *dir); - void handle_export_notify_ack(MExportDirNotifyAck *m); - void export_finish(CDir *dir); - - void handle_gather_caps(MGatherCaps *m); - - friend class C_MDC_ExportFreeze; - friend class C_MDS_ExportFinishLogged; - friend class C_M_ExportGo; - friend class C_M_ExportSessionsFlushed; - friend class MigratorContext; - friend class MigratorLogContext; - - // importer - void handle_export_discover(MExportDirDiscover *m); - void handle_export_cancel(MExportDirCancel *m); - void handle_export_prep(MExportDirPrep *m); - void handle_export_dir(MExportDir *m); - -public: void decode_import_inode(CDentry *dn, bufferlist::iterator& blp, mds_rank_t oldauth, LogSegment *ls, map >& cap_imports, @@ -317,41 +338,13 @@ public: map >& cap_imports, list& updated_scatterlocks, utime_t now); -public: void import_reverse(CDir *dir); -protected: - void import_reverse_discovering(dirfrag_t df); - void import_reverse_discovered(dirfrag_t df, CInode *diri); - void import_reverse_prepping(CDir *dir); - void import_remove_pins(CDir *dir, set& bounds); - void import_reverse_unfreeze(CDir *dir); - void import_reverse_final(CDir *dir); - void import_notify_abort(CDir *dir, set& bounds); - void import_notify_finish(CDir *dir, set& bounds); - void import_logged_start(dirfrag_t df, CDir *dir, mds_rank_t from, - map &imported_client_map, - map& sseqmap); - void handle_export_finish(MExportDirFinish *m); -public: - void import_finish(CDir *dir, bool notify, bool last=true); -protected: - - void handle_export_caps(MExportCaps *m); - void logged_import_caps(CInode *in, - mds_rank_t from, - map >& cap_imports, - map& client_map, - map& sseqmap); - - friend class C_MDS_ImportDirLoggedStart; - friend class C_MDS_ImportDirLoggedFinish; - friend class C_M_LoggedImportCaps; - - // bystander - void handle_export_notify(MExportDirNotify *m); + void import_finish(CDir *dir, bool notify, bool last=true); +private: + MDSRank *mds; + MDCache *cache; }; - #endif