From 8e96db103d2803d861394bd8d1fc6a29fae49e05 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 29 Oct 2024 13:59:52 +0100 Subject: [PATCH] mds/*: forward-declare MDSContext Signed-off-by: Max Kellermann --- src/mds/CDir.h | 18 ++++++++++-------- src/mds/CInode.h | 14 +++++++------- src/mds/Locker.h | 7 ++++--- src/mds/LogSegment.h | 14 ++++++-------- src/mds/MDCache.h | 28 ++++++++++++++-------------- src/mds/MDLog.h | 2 +- src/mds/MDSCacheObject.h | 5 ++--- src/mds/MDSRank.cc | 4 ++++ src/mds/MDSRank.h | 28 +++++++++++++--------------- src/mds/MDSTable.cc | 1 + src/mds/MDSTable.h | 6 +++--- src/mds/MDSTableClient.h | 4 ++-- src/mds/MDSTableServer.cc | 1 + src/mds/Migrator.h | 8 ++++---- src/mds/Mutation.h | 5 ++--- src/mds/OpenFileTable.h | 8 ++++---- src/mds/ScatterLock.h | 5 +++-- src/mds/Server.cc | 6 ++++++ src/mds/Server.h | 10 +++++----- src/mds/SessionMap.h | 13 ++++++++----- src/mds/SimpleLock.h | 8 ++++---- src/mds/SnapClient.h | 3 ++- src/mds/journal.cc | 7 +++++++ 23 files changed, 113 insertions(+), 92 deletions(-) diff --git a/src/mds/CDir.h b/src/mds/CDir.h index fa61b1dc37c0d..c98b893e0f766 100644 --- a/src/mds/CDir.h +++ b/src/mds/CDir.h @@ -22,6 +22,7 @@ #include #include #include +#include #include "common/config.h" #include "include/buffer_fwd.h" @@ -38,6 +39,7 @@ struct session_info_t; class bloom_filter; class CDentry; class MDCache; +class MDSContext; std::ostream& operator<<(std::ostream& out, const class CDir& dir); @@ -402,8 +404,8 @@ public: void try_remove_dentries_for_stray(); bool try_trim_snap_dentry(CDentry *dn, const std::set& snaps); - void split(int bits, std::vector* subs, MDSContext::vec& waiters, bool replay); - void merge(const std::vector& subs, MDSContext::vec& waiters, bool replay); + void split(int bits, std::vector* subs, std::vector& waiters, bool replay); + void merge(const std::vector& subs, std::vector& waiters, bool replay); bool should_split() const; bool should_split_fast() const; @@ -507,10 +509,10 @@ public: return waiting_on_dentry.count(string_snap_t(dname, snap)); } void add_dentry_waiter(std::string_view dentry, snapid_t snap, MDSContext *c); - void take_dentry_waiting(std::string_view dentry, snapid_t first, snapid_t last, MDSContext::vec& ls); + void take_dentry_waiting(std::string_view dentry, snapid_t first, snapid_t last, std::vector& ls); void add_waiter(uint64_t mask, MDSContext *c) override; - void take_waiting(uint64_t mask, MDSContext::vec& ls) override; // may include dentry waiters + void take_waiting(uint64_t mask, std::vector& ls) override; // may include dentry waiters void finish_waiting(uint64_t mask, int result = 0); // ditto // -- import/export -- @@ -754,10 +756,10 @@ protected: /* If you set up the bloom filter, you must keep it accurate! * It's deleted when you mark_complete() and is deliberately not serialized.*/ - mempool::mds_co::compact_map > waiting_for_commit; + mempool::mds_co::compact_map>> waiting_for_commit; // -- waiters -- - mempool::mds_co::map< string_snap_t, MDSContext::vec_alloc > waiting_on_dentry; // FIXME string_snap_t not in mempool + mempool::mds_co::map< string_snap_t, std::vector>> waiting_on_dentry; // FIXME string_snap_t not in mempool private: friend std::ostream& operator<<(std::ostream& out, const class CDir& dir); @@ -778,9 +780,9 @@ private: void remove_null_dentries(); void prepare_new_fragment(bool replay); - void prepare_old_fragment(std::map& dentry_waiters, bool replay); + void prepare_old_fragment(std::map >& dentry_waiters, bool replay); void steal_dentry(CDentry *dn); // from another dir. used by merge/split. - void finish_old_fragment(MDSContext::vec& waiters, bool replay); + void finish_old_fragment(std::vector& waiters, bool replay); void init_fragment_pins(); std::string get_path() const; diff --git a/src/mds/CInode.h b/src/mds/CInode.h index ae85d90f9484c..bddba4c7f1990 100644 --- a/src/mds/CInode.h +++ b/src/mds/CInode.h @@ -33,7 +33,6 @@ #include "include/compact_set.h" #include "MDSCacheObject.h" -#include "MDSContext.h" #include "flock.h" #include "inode_backtrace.h" // for inode_backtrace_t @@ -52,6 +51,7 @@ class CDentry; class CDir; class CInode; class MDCache; +class MDSContext; class LogSegment; struct SnapRealm; class Session; @@ -683,7 +683,7 @@ class CInode : public MDSCacheObject, public InodeStoreBase, public Counter& finished); void clear_ambiguous_auth(); const inode_const_ptr& get_inode() const { @@ -777,12 +777,12 @@ class CInode : public MDSCacheObject, public InodeStoreBase, public Counter& ls); bool is_waiting_for_dir(frag_t fg) { return waiting_on_dir.count(fg); } void add_waiter(uint64_t tag, MDSContext *c) override; - void take_waiting(uint64_t tag, MDSContext::vec& ls) override; + void take_waiting(uint64_t tag, std::vector& ls) override; // -- encode/decode helpers -- void _encode_base(ceph::buffer::list& bl, uint64_t features); @@ -792,7 +792,7 @@ class CInode : public MDSCacheObject, public InodeStoreBase, public Counter& waiters, std::list& eval_locks, bool survivor); // -- import/export -- @@ -957,7 +957,7 @@ class CInode : public MDSCacheObject, public InodeStoreBase, public Counter& finished); void unfreeze_inode(); void freeze_auth_pin(); @@ -1207,7 +1207,7 @@ protected: ceph_lock_state_t *flock_locks = nullptr; // -- waiting -- - mempool::mds_co::compact_map waiting_on_dir; + mempool::mds_co::compact_map> waiting_on_dir; // -- freezing inode -- diff --git a/src/mds/Locker.h b/src/mds/Locker.h index 643dc3354434b..9f030b119cb44 100644 --- a/src/mds/Locker.h +++ b/src/mds/Locker.h @@ -19,12 +19,12 @@ #include #include #include +#include #include "common/ref.h" #include "include/mempool.h" #include "include/types.h" -#include "MDSContext.h" #include "mdstypes.h" // for xattr_map #include "Mutation.h" #include "SimpleLock.h" @@ -39,6 +39,7 @@ class MClientLease; class MClientReply; class MDCache; class MLock; +class MDSContext; class MDSRank; class Session; class CDentry; @@ -96,9 +97,9 @@ public: void eval_lock_caches(Capability *cap); void put_lock_cache(MDLockCache* lock_cache); - void eval_gather(SimpleLock *lock, bool first=false, bool *need_issue=0, MDSContext::vec *pfinishers=0); + void eval_gather(SimpleLock *lock, bool first=false, bool *need_issue=0, std::vector *pfinishers=0); void eval(SimpleLock *lock, bool *need_issue); - void eval_any(SimpleLock *lock, bool *need_issue, MDSContext::vec *pfinishers=0, bool first=false) { + void eval_any(SimpleLock *lock, bool *need_issue, std::vector *pfinishers=0, bool first=false) { if (!lock->is_stable()) eval_gather(lock, first, need_issue, pfinishers); else if (lock->get_parent()->is_auth()) diff --git a/src/mds/LogSegment.h b/src/mds/LogSegment.h index 19b22949e98d6..88f90f6acabfb 100644 --- a/src/mds/LogSegment.h +++ b/src/mds/LogSegment.h @@ -18,7 +18,6 @@ #include "include/elist.h" #include "include/interval_set.h" #include "include/Context.h" -#include "MDSContext.h" #include "mdstypes.h" #include "CInode.h" #include "CDentry.h" @@ -35,6 +34,10 @@ class CDir; class CInode; class CDentry; +class MDSContext; +class C_MDSInternalNoop; +using MDSGather = C_GatherBase; +using MDSGatherBuilder = C_GatherBuilderBase; class MDSRank; struct MDPeerUpdate; @@ -56,12 +59,7 @@ class LogSegment { {} void try_to_expire(MDSRank *mds, MDSGatherBuilder &gather_bld, int op_prio); - void purge_inodes_finish(interval_set& inos){ - purging_inodes.subtract(inos); - if (NULL != purged_cb && - purging_inodes.empty()) - purged_cb->complete(0); - } + void purge_inodes_finish(interval_set& inos); void set_purged_cb(MDSContext* c){ ceph_assert(purged_cb == NULL); purged_cb = c; @@ -107,7 +105,7 @@ class LogSegment { version_t sessionmapv = 0; std::map tablev; - MDSContext::vec expiry_waiters; + std::vector expiry_waiters; }; static inline std::ostream& operator<<(std::ostream& out, const LogSegment& ls) { diff --git a/src/mds/MDCache.h b/src/mds/MDCache.h index 00faba916ca12..b9d4badcb5eea 100644 --- a/src/mds/MDCache.h +++ b/src/mds/MDCache.h @@ -1049,9 +1049,9 @@ private: void encode_replica_inode(CInode *in, mds_rank_t to, bufferlist& bl, uint64_t features); - void decode_replica_dir(CDir *&dir, bufferlist::const_iterator& p, CInode *diri, mds_rank_t from, MDSContext::vec& finished); - void decode_replica_dentry(CDentry *&dn, bufferlist::const_iterator& p, CDir *dir, MDSContext::vec& finished); - void decode_replica_inode(CInode *&in, bufferlist::const_iterator& p, CDentry *dn, MDSContext::vec& finished); + void decode_replica_dir(CDir *&dir, bufferlist::const_iterator& p, CInode *diri, mds_rank_t from, std::vector& finished); + void decode_replica_dentry(CDentry *&dn, bufferlist::const_iterator& p, CDir *dir, std::vector& finished); + void decode_replica_inode(CInode *&in, bufferlist::const_iterator& p, CDentry *dn, std::vector& finished); void encode_replica_stray(CDentry *straydn, mds_rank_t who, bufferlist& bl); void decode_replica_stray(CDentry *&straydn, CInode **in, const bufferlist &bl, mds_rank_t from); @@ -1159,7 +1159,7 @@ private: ceph_tid_t discover_last_tid = 0; // waiters - std::map > waiting_for_base_ino; + std::map > > waiting_for_base_ino; std::map > reconnected_caps; // inode -> client -> snap_follows,realmino std::map > reconnected_snaprealms; // realmino -> client -> realmseq @@ -1206,7 +1206,7 @@ private: uleader() {} std::set peers; LogSegment *ls = nullptr; - MDSContext::vec waiters; + std::vector waiters; bool safe = false; bool committing = false; bool recovering = false; @@ -1217,7 +1217,7 @@ private: mds_rank_t leader; LogSegment *ls = nullptr; MDPeerUpdate *su = nullptr; - MDSContext::vec waiters; + std::vector waiters; }; struct open_ino_info_t { @@ -1234,14 +1234,14 @@ private: version_t tid = 0; int64_t pool = -1; int last_err = 0; - MDSContext::vec waiters; + std::vector waiters; }; ceph_tid_t open_ino_last_tid = 0; std::map opening_inodes; bool open_ino_batch = false; - std::map, MDSContext::vec> > open_ino_batched_fetch; + std::map, std::vector> > open_ino_batched_fetch; friend struct C_MDC_OpenInoTraverseDir; friend struct C_MDC_OpenInoParentOpened; @@ -1400,7 +1400,7 @@ private: std::map > > cap_imports; // ino -> client -> frommds -> capex std::set cap_imports_missing; - std::map cap_reconnect_waiters; + std::map > cap_reconnect_waiters; int cap_imports_num_opening = 0; std::set rejoin_undef_inodes; @@ -1410,7 +1410,7 @@ private: std::vector rejoin_recover_q, rejoin_check_q; std::list rejoin_eval_locks; - MDSContext::vec rejoin_waiters; + std::vector rejoin_waiters; std::unique_ptr rejoin_done; std::unique_ptr resolve_done; @@ -1439,7 +1439,7 @@ private: int bits = 0; bool committed = false; LogSegment *ls = nullptr; - MDSContext::vec waiters; + std::vector waiters; frag_vec_t old_frags; bufferlist rollback; }; @@ -1510,12 +1510,12 @@ private: void trim_non_auth(); // trim out trimmable non-auth items void adjust_dir_fragments(CInode *diri, frag_t basefrag, int bits, - std::vector* frags, MDSContext::vec& waiters, bool replay); + std::vector* frags, std::vector& waiters, bool replay); void adjust_dir_fragments(CInode *diri, const std::vector& srcfrags, frag_t basefrag, int bits, std::vector* resultfrags, - MDSContext::vec& waiters, + std::vector& waiters, bool replay); CDir *force_dir_fragment(CInode *diri, frag_t fg, bool replay=true); void get_force_dirfrag_bound_set(const std::vector& dfs, std::set& bounds); @@ -1572,7 +1572,7 @@ private: std::pair shutdown_export_next; bool opening_root = false, open = false; - MDSContext::vec waiting_for_open; + std::vector waiting_for_open; // -- snaprealms -- SnapRealm *global_snaprealm = nullptr; diff --git a/src/mds/MDLog.h b/src/mds/MDLog.h index b3b0139cc7bc2..2dc657bec61f7 100644 --- a/src/mds/MDLog.h +++ b/src/mds/MDLog.h @@ -272,7 +272,7 @@ protected: bool already_replayed = false; - MDSContext::vec waitfor_replay; + std::vector waitfor_replay; // -- segments -- std::map segments; diff --git a/src/mds/MDSCacheObject.h b/src/mds/MDSCacheObject.h index 003c6fc32d749..62f20349ae81b 100644 --- a/src/mds/MDSCacheObject.h +++ b/src/mds/MDSCacheObject.h @@ -12,7 +12,6 @@ #include "include/types.h" #include "mdstypes.h" -#include "MDSContext.h" #include "include/elist.h" #define MDS_REF_SET // define me for improved debug output, sanity checking @@ -278,10 +277,10 @@ class MDSCacheObject { } waiting.insert(std::pair(seq, waiter{mask, c})); } - virtual void take_waiting(uint64_t mask, MDSContext::vec& ls) { + virtual void take_waiting(uint64_t mask, std::vector& ls) { take_waiting(waitmask_t(mask), ls); } - void take_waiting(waitmask_t mask, MDSContext::vec& ls); + void take_waiting(waitmask_t mask, std::vector& ls); void finish_waiting(uint64_t mask, int result = 0) { finish_waiting(waitmask_t(mask), result); } diff --git a/src/mds/MDSRank.cc b/src/mds/MDSRank.cc index 603c23bb39cc7..6f4adb81be491 100644 --- a/src/mds/MDSRank.cc +++ b/src/mds/MDSRank.cc @@ -1428,6 +1428,10 @@ void MDSRank::send_message(const ref_t& m, const ConnectionRef& c) c->send_message2(m); } +void MDSRank::kick_waiters_for_any_client_connection() { + finish_contexts(g_ceph_context, waiting_for_any_client_connection); +} + class C_MDS_RetrySendMessageMDS : public MDSInternalContext { public: C_MDS_RetrySendMessageMDS(MDSRank* mds, mds_rank_t who, ref_t m) diff --git a/src/mds/MDSRank.h b/src/mds/MDSRank.h index 0c0cf8fe69f48..bc7f5c9628294 100644 --- a/src/mds/MDSRank.h +++ b/src/mds/MDSRank.h @@ -28,7 +28,6 @@ #include "DamageTable.h" #include "MDSMap.h" #include "SessionMap.h" -#include "MDSContext.h" #include "PurgeQueue.h" #include "MetricsHandler.h" #include "mon/MonClient.h" @@ -37,6 +36,7 @@ // benefit of those including this header and using MDSRank::logger #include "common/perf_counters.h" +class MDSContext; class MDSMetaRequest; class MMDSMap; @@ -242,14 +242,14 @@ class MDSRank { finished_queue.push_front(c); progress_thread.signal(); } - void queue_waiters(MDSContext::vec& ls) { - MDSContext::vec v; + void queue_waiters(std::vector& ls) { + std::vector v; v.swap(ls); std::copy(v.begin(), v.end(), std::back_inserter(finished_queue)); progress_thread.signal(); } - void queue_waiters_front(MDSContext::vec& ls) { - MDSContext::vec v; + void queue_waiters_front(std::vector& ls) { + std::vector v; v.swap(ls); std::copy(v.rbegin(), v.rend(), std::front_inserter(finished_queue)); progress_thread.signal(); @@ -333,9 +333,7 @@ class MDSRank { void wait_for_any_client_connection(MDSContext *c) { waiting_for_any_client_connection.push_back(c); } - void kick_waiters_for_any_client_connection(void) { - finish_contexts(g_ceph_context, waiting_for_any_client_connection); - } + void kick_waiters_for_any_client_connection(); void wait_for_active(MDSContext *c) { waiting_for_active.push_back(c); } @@ -604,7 +602,7 @@ class MDSRank { std::unique_ptr metric_aggregator; std::list> waiting_for_nolaggy; - MDSContext::que finished_queue; + std::deque finished_queue; // Dispatch, retry, queues int dispatch_depth = 0; @@ -616,15 +614,15 @@ class MDSRank { ceph_tid_t last_tid = 0; // for mds-initiated requests (e.g. stray rename) - MDSContext::vec waiting_for_active, waiting_for_replay, waiting_for_rejoin, + std::vector waiting_for_active, waiting_for_replay, waiting_for_rejoin, waiting_for_reconnect, waiting_for_resolve; - MDSContext::vec waiting_for_any_client_connection; - MDSContext::que replay_queue; + std::vector waiting_for_any_client_connection; + std::deque replay_queue; bool replaying_requests_done = false; - std::map waiting_for_active_peer; - std::map waiting_for_bootstrapping_peer; - std::map waiting_for_mdsmap; + std::map> waiting_for_active_peer; + std::map> waiting_for_bootstrapping_peer; + std::map> waiting_for_mdsmap; epoch_t osd_epoch_barrier = 0; diff --git a/src/mds/MDSTable.cc b/src/mds/MDSTable.cc index 842447e58d6ea..ccffb5f2c66ff 100644 --- a/src/mds/MDSTable.cc +++ b/src/mds/MDSTable.cc @@ -13,6 +13,7 @@ */ #include "MDSTable.h" +#include "MDSContext.h" #include "MDSRank.h" #include "osdc/Objecter.h" diff --git a/src/mds/MDSTable.h b/src/mds/MDSTable.h index 164f2e02ab002..4c34b74d58ebf 100644 --- a/src/mds/MDSTable.h +++ b/src/mds/MDSTable.h @@ -19,13 +19,13 @@ #include "include/types.h" // for version_t #include "include/cephfs/types.h" // for mds_rank_t -#include "MDSContext.h" - #include #include #include #include +class Context; +class MDSContext; class MDSRank; class MDSTable { @@ -91,6 +91,6 @@ protected: version_t version = 0, committing_version = 0, committed_version = 0, projected_version = 0; - std::map waitfor_save; + std::map > waitfor_save; }; #endif diff --git a/src/mds/MDSTableClient.h b/src/mds/MDSTableClient.h index 86895cec2d380..7b96b50222d01 100644 --- a/src/mds/MDSTableClient.h +++ b/src/mds/MDSTableClient.h @@ -16,7 +16,6 @@ #define CEPH_MDSTABLECLIENT_H #include "include/types.h" -#include "MDSContext.h" #include "mds_table_types.h" #include "mdstypes.h" // for mds_rank_t #include "common/ref.h" // for cref_t @@ -25,6 +24,7 @@ #include #include +class MDSContext; class MMDSTableRequest; class MMDSTableQuery; class MDSRank; @@ -104,6 +104,6 @@ protected: // pending commits std::map pending_commit; - std::map ack_waiters; + std::map > ack_waiters; }; #endif diff --git a/src/mds/MDSTableServer.cc b/src/mds/MDSTableServer.cc index 9983eb5fcb487..505a686db2caf 100644 --- a/src/mds/MDSTableServer.cc +++ b/src/mds/MDSTableServer.cc @@ -13,6 +13,7 @@ */ #include "MDSTableServer.h" +#include "MDSContext.h" #include "MDSRank.h" #include "MDLog.h" #include "msg/Messenger.h" diff --git a/src/mds/Migrator.h b/src/mds/Migrator.h index d8e7c8cb41f79..61adf4c0e7662 100644 --- a/src/mds/Migrator.h +++ b/src/mds/Migrator.h @@ -20,7 +20,6 @@ #include "include/types.h" #include "Capability.h" -#include "MDSContext.h" #include "Mutation.h" // for MDRequestRef #include @@ -29,6 +28,7 @@ #include class MDCache; +class MDSContext; class MDSMap; class MDSRank; class MExportCaps; @@ -215,7 +215,7 @@ public: std::map& exported_client_metadata_map); void finish_export_inode(CInode *in, mds_rank_t target, std::map& peer_imported, - MDSContext::vec& finished); + std::vector& finished); void finish_export_inode_caps(CInode *in, mds_rank_t target, std::map& peer_imported); @@ -227,7 +227,7 @@ public: uint64_t &num_exported); void finish_export_dir(CDir *dir, mds_rank_t target, std::map >& peer_imported, - MDSContext::vec& finished, int *num_dentries); + std::vector& finished, int *num_dentries); void clear_export_proxy_pins(CDir *dir); @@ -360,7 +360,7 @@ protected: void child_export_finish(std::shared_ptr& parent, bool success); void encode_export_prep_trace(bufferlist& bl, CDir *bound, CDir *dir, export_state_t &es, std::set &inodes_added, std::set &dirfrags_added); - void decode_export_prep_trace(bufferlist::const_iterator& blp, mds_rank_t oldauth, MDSContext::vec &finished); + void decode_export_prep_trace(bufferlist::const_iterator& blp, mds_rank_t oldauth, std::vector &finished); void handle_gather_caps(const cref_t &m); diff --git a/src/mds/Mutation.h b/src/mds/Mutation.h index 7a1aece264363..dd80d1e26f929 100644 --- a/src/mds/Mutation.h +++ b/src/mds/Mutation.h @@ -27,8 +27,6 @@ #include "include/elist.h" #include "include/filepath.h" -#include "MDSContext.h" - #include "Capability.h" #include "common/StackStringStream.h" @@ -42,6 +40,7 @@ class CInode; class CDir; class CDentry; class MDSCacheObject; +class MDSContext; class Session; class ScatterLock; class SimpleLock; @@ -345,7 +344,7 @@ struct MDRequestImpl : public MutationImpl { Context *peer_commit = nullptr; ceph::buffer::list rollback_bl; - MDSContext::vec waiting_for_finish; + std::vector waiting_for_finish; std::map quiesce_ops; diff --git a/src/mds/OpenFileTable.h b/src/mds/OpenFileTable.h index 703934fdbf238..ae519df673e6c 100644 --- a/src/mds/OpenFileTable.h +++ b/src/mds/OpenFileTable.h @@ -21,14 +21,14 @@ #include "mdstypes.h" -#include "MDSContext.h" - #include "common/config_proxy.h" // for class ConfigProxy #include "global/global_context.h" // for g_conf() struct inode_backpointer_t; +class Context; class CDir; class CInode; +class MDSContext; class MDSRank; class Anchor; class OpenedAnchor; @@ -139,7 +139,7 @@ protected: std::vector > loaded_journals; std::map loaded_anchor_map; - MDSContext::vec waiting_for_load; + std::vector waiting_for_load; bool load_done = false; enum { @@ -150,7 +150,7 @@ protected: }; unsigned prefetch_state = 0; unsigned num_opening_inodes = 0; - MDSContext::vec waiting_for_prefetch; + std::vector waiting_for_prefetch; std::map > logseg_destroyed_inos; std::set destroyed_inos_set; diff --git a/src/mds/ScatterLock.h b/src/mds/ScatterLock.h index c6b314942f322..4624f612ca449 100644 --- a/src/mds/ScatterLock.h +++ b/src/mds/ScatterLock.h @@ -18,9 +18,10 @@ #include "SimpleLock.h" -#include "MDSContext.h" #include "include/xlist.h" +class MDSContext; + class ScatterLock : public SimpleLock { public: ScatterLock(MDSCacheObject *o, const LockType *lt) : @@ -172,7 +173,7 @@ public: encode(s, bl); } - void decode_state_rejoin(ceph::buffer::list::const_iterator& p, MDSContext::vec& waiters, bool survivor) { + void decode_state_rejoin(ceph::buffer::list::const_iterator& p, std::vector& waiters, bool survivor) { SimpleLock::decode_state_rejoin(p, waiters, survivor); if (is_flushing()) { set_dirty(); diff --git a/src/mds/Server.cc b/src/mds/Server.cc index a6d5bcca1cce2..434f65f4ef7e1 100644 --- a/src/mds/Server.cc +++ b/src/mds/Server.cc @@ -295,6 +295,12 @@ Server::Server(MDSRank *m, MetricsHandler *metrics_handler) : supported_metric_spec = feature_bitset_t(CEPHFS_METRIC_FEATURES_ALL); } +Server::~Server() { + g_ceph_context->get_perfcounters_collection()->remove(logger); + delete logger; + delete reconnect_done; +} + void Server::dispatch(const cref_t &m) { switch (m->get_type()) { diff --git a/src/mds/Server.h b/src/mds/Server.h index 8e0f69ef624b8..44e90d0ce7152 100644 --- a/src/mds/Server.h +++ b/src/mds/Server.h @@ -52,6 +52,10 @@ class LogSegment; class MDCache; class MDLog; class MDSContext; +class C_MDSInternalNoop; +using MDSGather = C_GatherBase; +using MDSGatherBuilder = C_GatherBuilderBase; +class MDSLogContextBase; class MDSRank; class Session; struct SnapInfo; @@ -133,11 +137,7 @@ public: }; explicit Server(MDSRank *m, MetricsHandler *metrics_handler); - ~Server() { - g_ceph_context->get_perfcounters_collection()->remove(logger); - delete logger; - delete reconnect_done; - } + ~Server(); void create_logger(); diff --git a/src/mds/SessionMap.h b/src/mds/SessionMap.h index 7ed36c5876688..eb61fe7b0b573 100644 --- a/src/mds/SessionMap.h +++ b/src/mds/SessionMap.h @@ -32,11 +32,14 @@ #include "mds/MDSAuthCaps.h" #include "common/DecayCounter.h" -#include "MDSContext.h" #include "Mutation.h" // for struct MDRequestImpl #include "msg/Message.h" struct MDRequestImpl; +class MDSContext; +class C_MDSInternalNoop; +using MDSGather = C_GatherBase; +using MDSGatherBuilder = C_GatherBuilderBase; enum { l_mdssm_first = 5500, @@ -278,7 +281,7 @@ public: waitfor_flush[get_push_seq()].push_back(c); return get_push_seq(); } - void finish_flush(version_t seq, MDSContext::vec& ls) { + void finish_flush(version_t seq, std::vector& ls) { while (!waitfor_flush.empty()) { auto it = waitfor_flush.begin(); if (it->first > seq) @@ -486,7 +489,7 @@ private: // -- caps -- uint32_t cap_gen = 0; version_t cap_push_seq = 0; // cap push seq # - std::map waitfor_flush; // flush session messages + std::map > waitfor_flush; // flush session messages // Has completed_requests been modified since the last time we // wrote this session out? @@ -786,11 +789,11 @@ public: MDSRank *mds; std::map*> by_state; - std::map commit_waiters; + std::map> commit_waiters; // -- loading, saving -- inodeno_t ino; - MDSContext::vec waiting_for_load; + std::vector waiting_for_load; protected: void _mark_dirty(Session *session, bool may_save); diff --git a/src/mds/SimpleLock.h b/src/mds/SimpleLock.h index 0f68f0674ea7c..e443fc0748522 100644 --- a/src/mds/SimpleLock.h +++ b/src/mds/SimpleLock.h @@ -24,7 +24,6 @@ #include #include "MDSCacheObject.h" -#include "MDSContext.h" // -- lock types -- // see CEPH_LOCK_* @@ -40,6 +39,7 @@ extern "C" { struct MDLockCache; struct MDLockCacheItem; struct MutationImpl; +class MDSContext; typedef boost::intrusive_ptr MutationRef; struct LockType { @@ -241,7 +241,7 @@ public: void finish_waiters(uint64_t mask, int r=0) { parent->finish_waiting(getmask(mask), r); } - void take_waiting(uint64_t mask, MDSContext::vec& ls) { + void take_waiting(uint64_t mask, std::vector& ls) { parent->take_waiting(getmask(mask), ls); } void add_waiter(uint64_t mask, MDSContext *c) { @@ -265,7 +265,7 @@ public: //assert(!is_stable() || gather_set.size() == 0); // gather should be empty in stable states. return s; } - void set_state_rejoin(int s, MDSContext::vec& waiters, bool survivor) { + void set_state_rejoin(int s, std::vector& waiters, bool survivor) { ceph_assert(!get_parent()->is_auth()); // If lock in the replica object was not in SYNC state when auth mds of the object failed. @@ -502,7 +502,7 @@ public: if (is_new) state = s; } - void decode_state_rejoin(ceph::buffer::list::const_iterator& p, MDSContext::vec& waiters, bool survivor) { + void decode_state_rejoin(ceph::buffer::list::const_iterator& p, std::vector& waiters, bool survivor) { __s16 s; using ceph::decode; decode(s, p); diff --git a/src/mds/SnapClient.h b/src/mds/SnapClient.h index 178c81cd16a61..2baa58e1af0d4 100644 --- a/src/mds/SnapClient.h +++ b/src/mds/SnapClient.h @@ -18,6 +18,7 @@ #include #include #include +#include #include "MDSTableClient.h" #include "snap.h" @@ -107,7 +108,7 @@ private: std::set committing_tids; - std::map waiting_for_version; + std::map > waiting_for_version; uint64_t sync_reqid = 0; bool synced = false; diff --git a/src/mds/journal.cc b/src/mds/journal.cc index 2672e18d208f9..94c215d344a55 100644 --- a/src/mds/journal.cc +++ b/src/mds/journal.cc @@ -370,6 +370,13 @@ void LogSegment::try_to_expire(MDSRank *mds, MDSGatherBuilder &gather_bld, int o } } +void LogSegment::purge_inodes_finish(interval_set& inos){ + purging_inodes.subtract(inos); + if (NULL != purged_cb && + purging_inodes.empty()) + purged_cb->complete(0); +} + // ----------------------- // EMetaBlob -- 2.39.5