From 1a91aeab987870b3ccbcf2f1e476fac8b534d449 Mon Sep 17 00:00:00 2001 From: liuchang0812 Date: Wed, 22 Feb 2017 17:53:18 +0800 Subject: [PATCH] mds: add override in headers LLVM has a tool called clang-tidy, that it could do a lot of things base on semantic analyse. We could use following command to add override automatically: clang-tidy -checks="-*, modernize-use-override" a.cpp -- -std=c++11 Signed-off-by: liuchang0812 --- src/mds/Beacon.h | 12 ++++----- src/mds/CDentry.h | 36 +++++++++++++------------- src/mds/CDir.h | 28 ++++++++++----------- src/mds/CInode.cc | 2 +- src/mds/CInode.h | 46 +++++++++++++++++----------------- src/mds/LocalLock.h | 4 +-- src/mds/MDCache.h | 2 +- src/mds/MDLog.h | 6 ++--- src/mds/MDSContext.h | 32 +++++++++++------------ src/mds/MDSDaemon.h | 24 +++++++++--------- src/mds/MDSRank.h | 2 +- src/mds/MDSTableServer.h | 6 ++--- src/mds/Mutation.h | 8 +++--- src/mds/ScatterLock.h | 14 +++++------ src/mds/ScrubStack.h | 4 +-- src/mds/SessionMap.h | 6 ++--- src/mds/SnapClient.h | 4 +-- src/mds/events/ECommitted.h | 12 ++++----- src/mds/events/EExport.h | 12 ++++----- src/mds/events/EFragment.h | 12 ++++----- src/mds/events/EImportFinish.h | 10 ++++---- src/mds/events/EImportStart.h | 14 +++++------ src/mds/events/ENoOp.h | 8 +++--- src/mds/events/EOpen.h | 14 +++++------ src/mds/events/EResetJournal.h | 12 ++++----- src/mds/events/ESession.h | 12 ++++----- src/mds/events/ESessions.h | 12 ++++----- src/mds/events/ESlaveUpdate.h | 12 ++++----- src/mds/events/ESubtreeMap.h | 12 ++++----- src/mds/events/ETableClient.h | 10 ++++---- src/mds/events/ETableServer.h | 12 ++++----- src/mds/events/EUpdate.h | 14 +++++------ 32 files changed, 207 insertions(+), 207 deletions(-) diff --git a/src/mds/Beacon.h b/src/mds/Beacon.h index 17ad0c671182..571f7f559956 100644 --- a/src/mds/Beacon.h +++ b/src/mds/Beacon.h @@ -41,16 +41,16 @@ class Beacon : public Dispatcher { public: Beacon(CephContext *cct_, MonClient *monc_, std::string name); - ~Beacon(); + ~Beacon() override; void init(MDSMap const *mdsmap); void shutdown(); - bool ms_dispatch(Message *m); - void ms_handle_connect(Connection *c) {} - bool ms_handle_reset(Connection *c) {return false;} - void ms_handle_remote_reset(Connection *c) {} - bool ms_handle_refused(Connection *c) {return false;} + bool ms_dispatch(Message *m) override; + void ms_handle_connect(Connection *c) override {} + bool ms_handle_reset(Connection *c) override {return false;} + void ms_handle_remote_reset(Connection *c) override {} + bool ms_handle_refused(Connection *c) override {return false;} void notify_mdsmap(MDSMap const *mdsmap); void notify_health(MDSRank const *mds); diff --git a/src/mds/CDentry.h b/src/mds/CDentry.h index 42c6dcb880a2..3d300237f6a7 100644 --- a/src/mds/CDentry.h +++ b/src/mds/CDentry.h @@ -131,7 +131,7 @@ public: pool.free(p); } - const char *pin_name(int p) const { + const char *pin_name(int p) const override { switch (p) { case PIN_INODEPIN: return "inodepin"; case PIN_FRAGMENTING: return "fragmenting"; @@ -144,9 +144,9 @@ public: // -- wait -- //static const int WAIT_LOCK_OFFSET = 8; - void add_waiter(uint64_t tag, MDSInternalContextBase *c); + void add_waiter(uint64_t tag, MDSInternalContextBase *c) override; - bool is_lt(const MDSCacheObject *r) const { + bool is_lt(const MDSCacheObject *r) const override { return *this < *static_cast(r); } @@ -206,21 +206,21 @@ public: } // ref counts: pin ourselves in the LRU when we're pinned. - void first_get() { + void first_get() override { lru_pin(); } - void last_put() { + void last_put() override { lru_unpin(); } - void _put(); + void _put() override; // auth pins - bool can_auth_pin() const; - void auth_pin(void *by); - void auth_unpin(void *by); + bool can_auth_pin() const override; + void auth_pin(void *by) override; + void auth_unpin(void *by) override; void adjust_nested_auth_pins(int adjustment, int diradj, void *by); - bool is_frozen() const; - bool is_freezing() const; + bool is_frozen() const override; + bool is_freezing() const override; int get_num_dir_auth_pins() const; // remote links @@ -241,7 +241,7 @@ public: version_t get_projected_version() const { return projected_version; } void set_projected_version(version_t v) { projected_version = v; } - mds_authority_t authority() const; + mds_authority_t authority() const override; version_t pre_dirty(version_t min=0); void _mark_dirty(LogSegment *ls); @@ -311,13 +311,13 @@ public: } // -- locking -- - SimpleLock* get_lock(int type) { + SimpleLock* get_lock(int type) override { assert(type == CEPH_LOCK_DN); return &lock; } - void set_object_info(MDSCacheObjectInfo &info); - void encode_lock_state(int type, bufferlist& bl); - void decode_lock_state(int type, bufferlist& bl); + void set_object_info(MDSCacheObjectInfo &info) override; + void encode_lock_state(int type, bufferlist& bl) override; + void decode_lock_state(int type, bufferlist& bl) override; // --------------------------------------------- // replicas (on clients) @@ -347,8 +347,8 @@ public: void remove_client_lease(ClientLease *r, Locker *locker); // returns remaining mask (if any), and kicks locker eval_gathers void remove_client_leases(Locker *locker); - ostream& print_db_line_prefix(ostream& out); - void print(ostream& out); + ostream& print_db_line_prefix(ostream& out) override; + void print(ostream& out) override; void dump(Formatter *f) const; diff --git a/src/mds/CDir.h b/src/mds/CDir.h index 06ae9a487b66..f8d11b389852 100644 --- a/src/mds/CDir.h +++ b/src/mds/CDir.h @@ -76,7 +76,7 @@ public: static const int PIN_EXPORTBOUND = 10; static const int PIN_STICKY = 11; static const int PIN_SUBTREETEMP = 12; // used by MDCache::trim_non_auth() - const char *pin_name(int p) const { + const char *pin_name(int p) const override { switch (p) { case PIN_DNWAITER: return "dnwaiter"; case PIN_INOWAITER: return "inowaiter"; @@ -169,7 +169,7 @@ public: CInode *inode; // my inode frag_t frag; // my frag - bool is_lt(const MDSCacheObject *r) const { + bool is_lt(const MDSCacheObject *r) const override { return dirfrag() < (static_cast(r))->dirfrag(); } @@ -518,7 +518,7 @@ private: std::string get_path() const; public: - mds_authority_t authority() const; + mds_authority_t authority() const override; mds_authority_t get_dir_auth() const { return dir_auth; } void set_dir_auth(mds_authority_t a); void set_dir_auth(mds_rank_t a) { set_dir_auth(mds_authority_t(a, CDIR_AUTH_UNKNOWN)); } @@ -664,8 +664,8 @@ public: // -- reference counting -- - void first_get(); - void last_put(); + void first_get() override; + void last_put() override; void request_pin_get() { if (request_pins == 0) get(PIN_REQUEST); @@ -688,8 +688,8 @@ public: void take_dentry_waiting(const std::string& dentry, snapid_t first, snapid_t last, std::list& ls); void take_sub_waiting(std::list& ls); // dentry or ino - void add_waiter(uint64_t mask, MDSInternalContextBase *c); - void take_waiting(uint64_t mask, std::list& ls); // may include dentry waiters + void add_waiter(uint64_t mask, MDSInternalContextBase *c) override; + void take_waiting(uint64_t mask, std::list& ls) override; // may include dentry waiters void finish_waiting(uint64_t mask, int result = 0); // ditto @@ -702,13 +702,13 @@ public: void decode_import(bufferlist::iterator& blp, utime_t now, LogSegment *ls); // -- auth pins -- - bool can_auth_pin() const { return is_auth() && !(is_frozen() || is_freezing()); } + bool can_auth_pin() const override { return is_auth() && !(is_frozen() || is_freezing()); } int get_cum_auth_pins() const { return auth_pins + nested_auth_pins; } int get_auth_pins() const { return auth_pins; } int get_nested_auth_pins() const { return nested_auth_pins; } int get_dir_auth_pins() const { return dir_auth_pins; } - void auth_pin(void *who); - void auth_unpin(void *who); + void auth_pin(void *who) override; + void auth_unpin(void *who) override; void adjust_nested_auth_pins(int inc, int dirinc, void *by); void verify_fragstat(); @@ -724,12 +724,12 @@ public: void maybe_finish_freeze(); - bool is_freezing() const { return is_freezing_tree() || is_freezing_dir(); } + bool is_freezing() const override { return is_freezing_tree() || is_freezing_dir(); } bool is_freezing_tree() const; bool is_freezing_tree_root() const { return state & STATE_FREEZINGTREE; } bool is_freezing_dir() const { return state & STATE_FREEZINGDIR; } - bool is_frozen() const { return is_frozen_dir() || is_frozen_tree(); } + bool is_frozen() const override { return is_frozen_dir() || is_frozen_tree(); } bool is_frozen_tree() const; bool is_frozen_tree_root() const { return state & STATE_FROZENTREE; } bool is_frozen_dir() const { return state & STATE_FROZENDIR; } @@ -759,8 +759,8 @@ public: CDir *get_frozen_tree_root(); - ostream& print_db_line_prefix(ostream& out); - void print(ostream& out); + ostream& print_db_line_prefix(ostream& out) override; + void print(ostream& out) override; void dump(Formatter *f) const; }; diff --git a/src/mds/CInode.cc b/src/mds/CInode.cc index 1f27f9a22220..89a7eb1f7dc0 100644 --- a/src/mds/CInode.cc +++ b/src/mds/CInode.cc @@ -3755,7 +3755,7 @@ void CInode::validate_disk_state(CInode::validated_data *results, set_callback(DIRFRAGS, static_cast(&ValidationContinuation::_dirfrags)); } - ~ValidationContinuation() { + ~ValidationContinuation() override { delete shadow_in; } diff --git a/src/mds/CInode.h b/src/mds/CInode.h index 484aed549e07..fbcd575ffb08 100644 --- a/src/mds/CInode.h +++ b/src/mds/CInode.h @@ -175,7 +175,7 @@ public: static const int PIN_DIRWAITER = 24; static const int PIN_SCRUBQUEUE = 25; - const char *pin_name(int p) const { + const char *pin_name(int p) const override { switch (p) { case PIN_DIRFRAG: return "dirfrag"; case PIN_CAPS: return "caps"; @@ -240,7 +240,7 @@ public: // misc static const unsigned EXPORT_NONCE = 1; // nonce given to replicas created by export - ostream& print_db_line_prefix(ostream& out); + ostream& print_db_line_prefix(ostream& out) override; public: MDCache *mdcache; @@ -685,7 +685,7 @@ public: state = 0; if (auth) state_set(STATE_AUTH); } - ~CInode() { + ~CInode() override { close_dirfrags(); close_snaprealm(); clear_file_locks(); @@ -730,7 +730,7 @@ public: CDir *get_projected_parent_dir(); CInode *get_parent_inode(); - bool is_lt(const MDSCacheObject *r) const { + bool is_lt(const MDSCacheObject *r) const override { const CInode *o = static_cast(r); return ino() < o->ino() || (ino() == o->ino() && last < o->last); @@ -820,8 +820,8 @@ public: bool is_waiting_for_dir(frag_t fg) { return waiting_on_dir.count(fg); } - void add_waiter(uint64_t tag, MDSInternalContextBase *c); - void take_waiting(uint64_t tag, std::list& ls); + void add_waiter(uint64_t tag, MDSInternalContextBase *c) override; + void take_waiting(uint64_t tag, std::list& ls) override; // -- encode/decode helpers -- void _encode_base(bufferlist& bl, uint64_t features); @@ -877,7 +877,7 @@ public: SimpleLock flocklock; SimpleLock policylock; - SimpleLock* get_lock(int type) { + SimpleLock* get_lock(int type) override { switch (type) { case CEPH_LOCK_IFILE: return &filelock; case CEPH_LOCK_IAUTH: return &authlock; @@ -892,13 +892,13 @@ public: return 0; } - void set_object_info(MDSCacheObjectInfo &info); - void encode_lock_state(int type, bufferlist& bl); - void decode_lock_state(int type, bufferlist& bl); + void set_object_info(MDSCacheObjectInfo &info) override; + void encode_lock_state(int type, bufferlist& bl) override; + void decode_lock_state(int type, bufferlist& bl) override; void _finish_frag_update(CDir *dir, MutationRef& mut); - void clear_dirty_scattered(int type); + void clear_dirty_scattered(int type) override; bool is_dirty_scattered(); void clear_scatter_dirty(); // on rejoin ack @@ -1009,21 +1009,21 @@ public: void replicate_relax_locks(); // -- authority -- - mds_authority_t authority() const; + mds_authority_t authority() const override; // -- auth pins -- void adjust_nested_auth_pins(int a, void *by); - bool can_auth_pin() const; - void auth_pin(void *by); - void auth_unpin(void *by); + bool can_auth_pin() const override; + void auth_pin(void *by) override; + void auth_unpin(void *by) override; // -- freeze -- bool is_freezing_inode() const { return state_test(STATE_FREEZING); } bool is_frozen_inode() const { return state_test(STATE_FROZEN); } bool is_frozen_auth_pin() const { return state_test(STATE_FROZENAUTHPIN); } - bool is_frozen() const; + bool is_frozen() const override; bool is_frozen_dir() const; - bool is_freezing() const; + bool is_freezing() const override; /* Freeze the inode. auth_pin_allowance lets the caller account for any * auth_pins it is itself holding/responsible for. */ @@ -1035,7 +1035,7 @@ public: void unfreeze_auth_pin(); // -- reference counting -- - void bad_put(int by) { + void bad_put(int by) override { generic_dout(0) << " bad put " << *this << " by " << by << " " << pin_name(by) << " was " << ref #ifdef MDS_REF_SET << " (" << ref_map << ")" @@ -1046,7 +1046,7 @@ public: #endif assert(ref > 0); } - void bad_get(int by) { + void bad_get(int by) override { generic_dout(0) << " bad get " << *this << " by " << by << " " << pin_name(by) << " was " << ref #ifdef MDS_REF_SET << " (" << ref_map << ")" @@ -1056,9 +1056,9 @@ public: assert(ref_map[by] >= 0); #endif } - void first_get(); - void last_put(); - void _put(); + void first_get() override; + void last_put() override; + void _put() override; // -- hierarchy stuff -- @@ -1086,7 +1086,7 @@ public: projected_parent.pop_front(); } - void print(ostream& out); + void print(ostream& out) override; void dump(Formatter *f) const; /** diff --git a/src/mds/LocalLock.h b/src/mds/LocalLock.h index e12ab9a7506c..6609827165e7 100644 --- a/src/mds/LocalLock.h +++ b/src/mds/LocalLock.h @@ -27,7 +27,7 @@ public: set_state(LOCK_LOCK); // always. } - bool is_locallock() const { + bool is_locallock() const override { return true; } @@ -52,7 +52,7 @@ public: return last_wrlock_client; } - virtual void print(ostream& out) const { + void print(ostream& out) const override { out << "("; _print(out); if (last_wrlock_client >= 0) diff --git a/src/mds/MDCache.h b/src/mds/MDCache.h index 8f0d4bb02e08..4e146281c328 100644 --- a/src/mds/MDCache.h +++ b/src/mds/MDCache.h @@ -1195,7 +1195,7 @@ class C_MDS_RetryRequest : public MDSInternalContext { MDRequestRef mdr; public: C_MDS_RetryRequest(MDCache *c, MDRequestRef& r); - virtual void finish(int r); + void finish(int r) override; }; #endif diff --git a/src/mds/MDLog.h b/src/mds/MDLog.h index 0060c3a2364e..5579e5abc007 100644 --- a/src/mds/MDLog.h +++ b/src/mds/MDLog.h @@ -89,7 +89,7 @@ protected: MDLog *log; public: explicit ReplayThread(MDLog *l) : log(l) {} - void* entry() { + void* entry() override { log->_replay_thread(); return 0; } @@ -111,7 +111,7 @@ protected: public: void set_completion(MDSInternalContextBase *c) {completion = c;} explicit RecoveryThread(MDLog *l) : log(l), completion(NULL) {} - void* entry() { + void* entry() override { log->_recovery_thread(completion); return 0; } @@ -152,7 +152,7 @@ protected: MDLog *log; public: explicit SubmitThread(MDLog *l) : log(l) {} - void* entry() { + void* entry() override { log->_submit_thread(); return 0; } diff --git a/src/mds/MDSContext.h b/src/mds/MDSContext.h index e021906463a6..ca48ad4a151c 100644 --- a/src/mds/MDSContext.h +++ b/src/mds/MDSContext.h @@ -42,7 +42,7 @@ protected: class MDSInternalContextBase : public MDSContext { public: - void complete(int r); + void complete(int r) override; }; /** @@ -52,7 +52,7 @@ class MDSInternalContext : public MDSInternalContextBase { protected: MDSRank *mds; - virtual MDSRank* get_mds(); + MDSRank* get_mds() override; public: explicit MDSInternalContext(MDSRank *mds_) : mds(mds_) { @@ -69,16 +69,16 @@ class MDSInternalContextWrapper : public MDSInternalContextBase protected: MDSRank *mds; Context *fin; - MDSRank *get_mds(); + MDSRank *get_mds() override; public: MDSInternalContextWrapper(MDSRank *m, Context *c) : mds(m), fin(c) {} - void finish(int r); + void finish(int r) override; }; class MDSIOContextBase : public MDSContext { public: - void complete(int r); + void complete(int r) override; }; /** @@ -105,7 +105,7 @@ class MDSIOContext : public MDSIOContextBase { protected: MDSRank *mds; - virtual MDSRank* get_mds(); + MDSRank* get_mds() override; public: explicit MDSIOContext(MDSRank *mds_) : mds(mds_) { @@ -122,10 +122,10 @@ class MDSIOContextWrapper : public MDSIOContextBase protected: MDSRank *mds; Context *fin; - MDSRank *get_mds(); + MDSRank *get_mds() override; public: MDSIOContextWrapper(MDSRank *m, Context *c) : mds(m), fin(c) {} - void finish(int r); + void finish(int r) override; }; /** @@ -133,10 +133,10 @@ public: */ class C_MDSInternalNoop : public MDSInternalContextBase { - virtual MDSRank* get_mds() {ceph_abort();} + MDSRank* get_mds() override {ceph_abort();} public: - void finish(int r) {} - void complete(int r) {} + void finish(int r) override {} + void complete(int r) override {} }; @@ -149,7 +149,7 @@ class C_IO_Wrapper : public MDSIOContext protected: bool async; MDSInternalContextBase *wrapped; - virtual void finish(int r) { + void finish(int r) override { wrapped->complete(r); wrapped = nullptr; } @@ -159,13 +159,13 @@ public: assert(wrapped != NULL); } - ~C_IO_Wrapper() { + ~C_IO_Wrapper() override { if (wrapped != nullptr) { delete wrapped; wrapped = nullptr; } } - virtual void complete(int r) final; + void complete(int r) final; }; @@ -175,7 +175,7 @@ public: class MDSInternalContextGather : public MDSInternalContextBase { protected: - MDSRank *get_mds(); + MDSRank *get_mds() override; }; @@ -184,7 +184,7 @@ class MDSGather : public C_GatherBase(cct, onfinish) {} protected: - virtual MDSRank *get_mds() {return NULL;} + MDSRank *get_mds() override {return NULL;} }; diff --git a/src/mds/MDSDaemon.h b/src/mds/MDSDaemon.h index 375cf8abaaec..71f861bd8b45 100644 --- a/src/mds/MDSDaemon.h +++ b/src/mds/MDSDaemon.h @@ -91,7 +91,7 @@ class MDSDaemon : public Dispatcher, public md_config_obs_t { public: MDSDaemon(const std::string &n, Messenger *m, MonClient *mc); - ~MDSDaemon(); + ~MDSDaemon() override; int orig_argc; const char **orig_argv; @@ -109,9 +109,9 @@ class MDSDaemon : public Dispatcher, public md_config_obs_t { bool is_clean_shutdown(); // config observer bits - virtual const char** get_tracked_conf_keys() const; - virtual void handle_conf_change(const struct md_config_t *conf, - const std::set &changed); + const char** get_tracked_conf_keys() const override; + void handle_conf_change(const struct md_config_t *conf, + const std::set &changed) override; protected: // tick and other timer fun class C_MDS_Tick; @@ -121,16 +121,16 @@ class MDSDaemon : public Dispatcher, public md_config_obs_t { void wait_for_omap_osds(); private: - bool ms_dispatch(Message *m); - bool ms_get_authorizer(int dest_type, AuthAuthorizer **authorizer, bool force_new); + bool ms_dispatch(Message *m) override; + bool ms_get_authorizer(int dest_type, AuthAuthorizer **authorizer, bool force_new) override; bool ms_verify_authorizer(Connection *con, int peer_type, int protocol, bufferlist& authorizer_data, bufferlist& authorizer_reply, - bool& isvalid, CryptoKey& session_key); - void ms_handle_accept(Connection *con); - void ms_handle_connect(Connection *con); - bool ms_handle_reset(Connection *con); - void ms_handle_remote_reset(Connection *con); - bool ms_handle_refused(Connection *con); + bool& isvalid, CryptoKey& session_key) override; + void ms_handle_accept(Connection *con) override; + void ms_handle_connect(Connection *con) override; + bool ms_handle_reset(Connection *con) override; + void ms_handle_remote_reset(Connection *con) override; + bool ms_handle_refused(Connection *con) override; protected: // admin socket handling diff --git a/src/mds/MDSRank.h b/src/mds/MDSRank.h index 190592eabf5d..4708311c9d6d 100644 --- a/src/mds/MDSRank.h +++ b/src/mds/MDSRank.h @@ -477,7 +477,7 @@ public: assert(m); this->m = m; } - virtual void finish(int r) { + void finish(int r) override { mds->retry_dispatch(m); } }; diff --git a/src/mds/MDSTableServer.h b/src/mds/MDSTableServer.h index ee569392cb42..f7de717c87d8 100644 --- a/src/mds/MDSTableServer.h +++ b/src/mds/MDSTableServer.h @@ -58,7 +58,7 @@ private: MDSTableServer(MDSRank *m, int tab) : MDSTable(m, get_mdstable_name(tab), false), table(tab) {} - virtual ~MDSTableServer() {} + ~MDSTableServer() override {} void handle_request(MMDSTableRequest *m); void do_server_update(bufferlist& bl); @@ -66,11 +66,11 @@ private: virtual void encode_server_state(bufferlist& bl) const = 0; virtual void decode_server_state(bufferlist::iterator& bl) = 0; - void encode_state(bufferlist& bl) const { + void encode_state(bufferlist& bl) const override { encode_server_state(bl); ::encode(pending_for_mds, bl); } - void decode_state(bufferlist::iterator& bl) { + void decode_state(bufferlist::iterator& bl) override { decode_server_state(bl); ::decode(pending_for_mds, bl); } diff --git a/src/mds/Mutation.h b/src/mds/Mutation.h index e5df22d135a9..56b410fe6a73 100644 --- a/src/mds/Mutation.h +++ b/src/mds/Mutation.h @@ -92,7 +92,7 @@ public: : TrackedOp(tracker, initiated), reqid(ri), attempt(att), slave_to_mds(slave_to) { } - virtual ~MutationImpl() { + ~MutationImpl() override { assert(locking == NULL); assert(pins.empty()); assert(auth_pins.empty()); @@ -313,7 +313,7 @@ struct MDRequestImpl : public MutationImpl { if (!params.dispatched.is_zero()) mark_event("dispatched", params.dispatched); } - ~MDRequestImpl(); + ~MDRequestImpl() override; More* more(); bool has_more() const; @@ -339,8 +339,8 @@ struct MDRequestImpl : public MutationImpl { // TrackedOp stuff typedef boost::intrusive_ptr Ref; protected: - void _dump(Formatter *f) const; - void _dump_op_descriptor_unlocked(ostream& stream) const; + void _dump(Formatter *f) const override; + void _dump_op_descriptor_unlocked(ostream& stream) const override; }; typedef boost::intrusive_ptr MDRequestRef; diff --git a/src/mds/ScatterLock.h b/src/mds/ScatterLock.h index 210557837e11..62f01d26976f 100644 --- a/src/mds/ScatterLock.h +++ b/src/mds/ScatterLock.h @@ -64,14 +64,14 @@ public: ScatterLock(MDSCacheObject *o, LockType *lt) : SimpleLock(o, lt), _more(NULL) {} - ~ScatterLock() { + ~ScatterLock() override { if (_more) { _more->item_updated.remove_myself(); // FIXME this should happen sooner, i think... delete _more; } } - bool is_scatterlock() const { + bool is_scatterlock() const override { return true; } @@ -135,13 +135,13 @@ public: return have_more() ? _more->state_flags & UNSCATTER_WANTED : false; } - bool is_dirty() const { + bool is_dirty() const override { return have_more() ? _more->state_flags & DIRTY : false; } - bool is_flushing() const { + bool is_flushing() const override { return have_more() ? _more->state_flags & FLUSHING: false; } - bool is_flushed() const { + bool is_flushed() const override { return have_more() ? _more->state_flags & FLUSHED: false; } bool is_dirty_or_flushing() const { @@ -175,7 +175,7 @@ public: start_flush(); finish_flush(); } - void clear_flushed() { + void clear_flushed() override { if (have_more()) { _more->state_flags &= ~FLUSHED; try_clear_more(); @@ -228,7 +228,7 @@ public: return SimpleLock::remove_replica(from); } - virtual void print(ostream& out) const { + void print(ostream& out) const override { out << "("; _print(out); if (is_dirty()) diff --git a/src/mds/ScrubStack.h b/src/mds/ScrubStack.h index d12b847367c6..c35b1aa9c463 100644 --- a/src/mds/ScrubStack.h +++ b/src/mds/ScrubStack.h @@ -42,8 +42,8 @@ protected: ScrubStack *stack; public: C_KickOffScrubs(MDCache *mdcache, ScrubStack *s); - void finish(int r) { } - void complete(int r) { + void finish(int r) override { } + void complete(int r) override { stack->scrubs_in_progress--; stack->kick_off_scrubs(); // don't delete self diff --git a/src/mds/SessionMap.h b/src/mds/SessionMap.h index 4816b012849f..d4f35083ac64 100644 --- a/src/mds/SessionMap.h +++ b/src/mds/SessionMap.h @@ -329,7 +329,7 @@ public: completed_requests_dirty(false), num_trim_flushes_warnings(0), num_trim_requests_warnings(0) { } - ~Session() { + ~Session() override { assert(!item_session_list.is_on_list()); while (!preopen_out_queue.empty()) { preopen_out_queue.front()->put(); @@ -450,7 +450,7 @@ public: loaded_legacy(false) { } - ~SessionMap() + ~SessionMap() override { for (auto p : by_state) delete p.second; @@ -490,7 +490,7 @@ public: } // sessions - void decode_legacy(bufferlist::iterator& blp); + void decode_legacy(bufferlist::iterator& blp) override; bool empty() const { return session_map.empty(); } const ceph::unordered_map &get_sessions() const { diff --git a/src/mds/SnapClient.h b/src/mds/SnapClient.h index 800538c8b136..64a18e666042 100644 --- a/src/mds/SnapClient.h +++ b/src/mds/SnapClient.h @@ -26,8 +26,8 @@ class SnapClient : public MDSTableClient { public: explicit SnapClient(MDSRank *m) : MDSTableClient(m, TABLE_SNAP) {} - void resend_queries() {} - void handle_query_result(MMDSTableRequest *m) {} + void resend_queries() override {} + void handle_query_result(MMDSTableRequest *m) override {} void prepare_create(inodeno_t dirino, const string& name, utime_t stamp, version_t *pstid, bufferlist *pbl, MDSInternalContextBase *onfinish) { diff --git a/src/mds/events/ECommitted.h b/src/mds/events/ECommitted.h index 67e312c9918b..19868414fc95 100644 --- a/src/mds/events/ECommitted.h +++ b/src/mds/events/ECommitted.h @@ -26,17 +26,17 @@ public: explicit ECommitted(metareqid_t r) : LogEvent(EVENT_COMMITTED), reqid(r) { } - void print(ostream& out) const { + void print(ostream& out) const override { out << "ECommitted " << reqid; } - void encode(bufferlist &bl, uint64_t features) const; - void decode(bufferlist::iterator &bl); - void dump(Formatter *f) const; + void encode(bufferlist &bl, uint64_t features) const override; + void decode(bufferlist::iterator &bl) override; + void dump(Formatter *f) const override; static void generate_test_instances(list& ls); - void update_segment() {} - void replay(MDSRank *mds); + void update_segment() override {} + void replay(MDSRank *mds) override; }; WRITE_CLASS_ENCODER_FEATURES(ECommitted) diff --git a/src/mds/events/EExport.h b/src/mds/events/EExport.h index 0690aec2f5a6..6021240129e1 100644 --- a/src/mds/events/EExport.h +++ b/src/mds/events/EExport.h @@ -38,17 +38,17 @@ public: set &get_bounds() { return bounds; } - void print(ostream& out) const { + void print(ostream& out) const override { out << "EExport " << base << " " << metablob; } - EMetaBlob *get_metablob() { return &metablob; } + EMetaBlob *get_metablob() override { return &metablob; } - void encode(bufferlist& bl, uint64_t features) const; - void decode(bufferlist::iterator &bl); - void dump(Formatter *f) const; + void encode(bufferlist& bl, uint64_t features) const override; + void decode(bufferlist::iterator &bl) override; + void dump(Formatter *f) const override; static void generate_test_instances(list& ls); - void replay(MDSRank *mds); + void replay(MDSRank *mds) override; }; WRITE_CLASS_ENCODER_FEATURES(EExport) diff --git a/src/mds/events/EFragment.h b/src/mds/events/EFragment.h index cb3111c8a3f7..ad6f591ca396 100644 --- a/src/mds/events/EFragment.h +++ b/src/mds/events/EFragment.h @@ -41,7 +41,7 @@ public: LogEvent(EVENT_FRAGMENT), metablob(mdlog), op(o), ino(df.ino), basefrag(df.frag), bits(b) { } - void print(ostream& out) const { + void print(ostream& out) const override { out << "EFragment " << op_name(op) << " " << ino << " " << basefrag << " by " << bits << " " << metablob; } @@ -67,13 +67,13 @@ public: ::encode(*drb, rollback); } - EMetaBlob *get_metablob() { return &metablob; } + EMetaBlob *get_metablob() override { return &metablob; } - void encode(bufferlist &bl, uint64_t features) const; - void decode(bufferlist::iterator &bl); - void dump(Formatter *f) const; + void encode(bufferlist &bl, uint64_t features) const override; + void decode(bufferlist::iterator &bl) override; + void dump(Formatter *f) const override; static void generate_test_instances(list& ls); - void replay(MDSRank *mds); + void replay(MDSRank *mds) override; }; WRITE_CLASS_ENCODER_FEATURES(EFragment) diff --git a/src/mds/events/EImportFinish.h b/src/mds/events/EImportFinish.h index bd04ef516cc9..16c4d931dcd4 100644 --- a/src/mds/events/EImportFinish.h +++ b/src/mds/events/EImportFinish.h @@ -32,7 +32,7 @@ class EImportFinish : public LogEvent { success(s) { } EImportFinish() : LogEvent(EVENT_IMPORTFINISH), base(), success(false) { } - void print(ostream& out) const { + void print(ostream& out) const override { out << "EImportFinish " << base; if (success) out << " success"; @@ -40,12 +40,12 @@ class EImportFinish : public LogEvent { out << " failed"; } - void encode(bufferlist& bl, uint64_t features) const; - void decode(bufferlist::iterator &bl); - void dump(Formatter *f) const; + void encode(bufferlist& bl, uint64_t features) const override; + void decode(bufferlist::iterator &bl) override; + void dump(Formatter *f) const override; static void generate_test_instances(list& ls); - void replay(MDSRank *mds); + void replay(MDSRank *mds) override; }; WRITE_CLASS_ENCODER_FEATURES(EImportFinish) diff --git a/src/mds/events/EImportStart.h b/src/mds/events/EImportStart.h index cebf8481a289..36f07b4510f9 100644 --- a/src/mds/events/EImportStart.h +++ b/src/mds/events/EImportStart.h @@ -41,19 +41,19 @@ protected: metablob(log) { } EImportStart() : LogEvent(EVENT_IMPORTSTART) { } - void print(ostream& out) const { + void print(ostream& out) const override { out << "EImportStart " << base << " " << metablob; } - EMetaBlob *get_metablob() { return &metablob; } + EMetaBlob *get_metablob() override { return &metablob; } - void encode(bufferlist &bl, uint64_t features) const; - void decode(bufferlist::iterator &bl); - void dump(Formatter *f) const; + void encode(bufferlist &bl, uint64_t features) const override; + void decode(bufferlist::iterator &bl) override; + void dump(Formatter *f) const override; static void generate_test_instances(list& ls); - void update_segment(); - void replay(MDSRank *mds); + void update_segment() override; + void replay(MDSRank *mds) override; }; WRITE_CLASS_ENCODER_FEATURES(EImportStart) diff --git a/src/mds/events/ENoOp.h b/src/mds/events/ENoOp.h index 4b26fe6214f4..9a1507043054 100644 --- a/src/mds/events/ENoOp.h +++ b/src/mds/events/ENoOp.h @@ -24,11 +24,11 @@ public: ENoOp() : LogEvent(EVENT_NOOP), pad_size(0) { } explicit ENoOp(uint32_t size_) : LogEvent(EVENT_NOOP), pad_size(size_){ } - void encode(bufferlist& bl, uint64_t features) const; - void decode(bufferlist::iterator& bl); - void dump(Formatter *f) const {} + void encode(bufferlist& bl, uint64_t features) const override; + void decode(bufferlist::iterator& bl) override; + void dump(Formatter *f) const override {} - void replay(MDSRank *mds); + void replay(MDSRank *mds) override; }; WRITE_CLASS_ENCODER_FEATURES(ENoOp) diff --git a/src/mds/events/EOpen.h b/src/mds/events/EOpen.h index 601652a5e951..b529f05c7870 100644 --- a/src/mds/events/EOpen.h +++ b/src/mds/events/EOpen.h @@ -28,11 +28,11 @@ public: explicit EOpen(MDLog *mdlog) : LogEvent(EVENT_OPEN), metablob(mdlog) { } - void print(ostream& out) const { + void print(ostream& out) const override { out << "EOpen " << metablob << ", " << inos.size() << " open files"; } - EMetaBlob *get_metablob() { return &metablob; } + EMetaBlob *get_metablob() override { return &metablob; } void add_clean_inode(CInode *in) { if (!in->is_base()) { @@ -48,13 +48,13 @@ public: inos.push_back(ino); } - void encode(bufferlist& bl, uint64_t features) const; - void decode(bufferlist::iterator& bl); - void dump(Formatter *f) const; + void encode(bufferlist& bl, uint64_t features) const override; + void decode(bufferlist::iterator& bl) override; + void dump(Formatter *f) const override; static void generate_test_instances(list& ls); - void update_segment(); - void replay(MDSRank *mds); + void update_segment() override; + void replay(MDSRank *mds) override; }; WRITE_CLASS_ENCODER_FEATURES(EOpen) diff --git a/src/mds/events/EResetJournal.h b/src/mds/events/EResetJournal.h index 717781e0cd71..be14b608524d 100644 --- a/src/mds/events/EResetJournal.h +++ b/src/mds/events/EResetJournal.h @@ -22,17 +22,17 @@ class EResetJournal : public LogEvent { public: EResetJournal() : LogEvent(EVENT_RESETJOURNAL) { } - ~EResetJournal() {} + ~EResetJournal() override {} - void encode(bufferlist& bl, uint64_t features) const; - void decode(bufferlist::iterator& bl); - void dump(Formatter *f) const; + void encode(bufferlist& bl, uint64_t features) const override; + void decode(bufferlist::iterator& bl) override; + void dump(Formatter *f) const override; static void generate_test_instances(list& ls); - void print(ostream& out) const { + void print(ostream& out) const override { out << "EResetJournal"; } - void replay(MDSRank *mds); + void replay(MDSRank *mds) override; }; WRITE_CLASS_ENCODER_FEATURES(EResetJournal) diff --git a/src/mds/events/ESession.h b/src/mds/events/ESession.h index 9fe6b6fc38b0..83b9a8fc0fd5 100644 --- a/src/mds/events/ESession.h +++ b/src/mds/events/ESession.h @@ -51,12 +51,12 @@ class ESession : public LogEvent { cmapv(v), inos(i), inotablev(iv) { } - void encode(bufferlist& bl, uint64_t features) const; - void decode(bufferlist::iterator& bl); - void dump(Formatter *f) const; + void encode(bufferlist& bl, uint64_t features) const override; + void decode(bufferlist::iterator& bl) override; + void dump(Formatter *f) const override; static void generate_test_instances(list& ls); - void print(ostream& out) const { + void print(ostream& out) const override { if (open) out << "ESession " << client_inst << " open cmapv " << cmapv; else @@ -65,8 +65,8 @@ class ESession : public LogEvent { out << " (" << inos.size() << " inos, v" << inotablev << ")"; } - void update_segment(); - void replay(MDSRank *mds); + void update_segment() override; + void replay(MDSRank *mds) override; entity_inst_t get_client_inst() const {return client_inst;} }; WRITE_CLASS_ENCODER_FEATURES(ESession) diff --git a/src/mds/events/ESessions.h b/src/mds/events/ESessions.h index a9a834c390e8..f784d63eb0c1 100644 --- a/src/mds/events/ESessions.h +++ b/src/mds/events/ESessions.h @@ -38,22 +38,22 @@ public: void mark_old_encoding() { old_style_encode = true; } - void encode(bufferlist &bl, uint64_t features) const; + void encode(bufferlist &bl, uint64_t features) const override; void decode_old(bufferlist::iterator &bl); void decode_new(bufferlist::iterator &bl); - void decode(bufferlist::iterator &bl) { + void decode(bufferlist::iterator &bl) override { if (old_style_encode) decode_old(bl); else decode_new(bl); } - void dump(Formatter *f) const; + void dump(Formatter *f) const override; static void generate_test_instances(list& ls); - void print(ostream& out) const { + void print(ostream& out) const override { out << "ESessions " << client_map.size() << " opens cmapv " << cmapv; } - void update_segment(); - void replay(MDSRank *mds); + void update_segment() override; + void replay(MDSRank *mds) override; }; WRITE_CLASS_ENCODER_FEATURES(ESessions) diff --git a/src/mds/events/ESlaveUpdate.h b/src/mds/events/ESlaveUpdate.h index 8147455fc62a..ea1fa3acf772 100644 --- a/src/mds/events/ESlaveUpdate.h +++ b/src/mds/events/ESlaveUpdate.h @@ -126,7 +126,7 @@ public: master(mastermds), op(o), origop(oo) { } - void print(ostream& out) const { + void print(ostream& out) const override { if (type.length()) out << type << " "; out << " " << (int)op; @@ -137,14 +137,14 @@ public: out << commit; } - EMetaBlob *get_metablob() { return &commit; } + EMetaBlob *get_metablob() override { return &commit; } - void encode(bufferlist& bl, uint64_t features) const; - void decode(bufferlist::iterator& bl); - void dump(Formatter *f) const; + void encode(bufferlist& bl, uint64_t features) const override; + void decode(bufferlist::iterator& bl) override; + void dump(Formatter *f) const override; static void generate_test_instances(list& ls); - void replay(MDSRank *mds); + void replay(MDSRank *mds) override; }; WRITE_CLASS_ENCODER_FEATURES(ESlaveUpdate) diff --git a/src/mds/events/ESubtreeMap.h b/src/mds/events/ESubtreeMap.h index e021ecc114c8..def22a7916fc 100644 --- a/src/mds/events/ESubtreeMap.h +++ b/src/mds/events/ESubtreeMap.h @@ -28,20 +28,20 @@ public: ESubtreeMap() : LogEvent(EVENT_SUBTREEMAP), expire_pos(0), event_seq(0) { } - void print(ostream& out) const { + void print(ostream& out) const override { out << "ESubtreeMap " << subtrees.size() << " subtrees " << ", " << ambiguous_subtrees.size() << " ambiguous " << metablob; } - EMetaBlob *get_metablob() { return &metablob; } + EMetaBlob *get_metablob() override { return &metablob; } - void encode(bufferlist& bl, uint64_t features) const; - void decode(bufferlist::iterator& bl); - void dump(Formatter *f) const; + void encode(bufferlist& bl, uint64_t features) const override; + void decode(bufferlist::iterator& bl) override; + void dump(Formatter *f) const override; static void generate_test_instances(list& ls); - void replay(MDSRank *mds); + void replay(MDSRank *mds) override; }; WRITE_CLASS_ENCODER_FEATURES(ESubtreeMap) diff --git a/src/mds/events/ETableClient.h b/src/mds/events/ETableClient.h index 97b220767a53..7633d9e066fa 100644 --- a/src/mds/events/ETableClient.h +++ b/src/mds/events/ETableClient.h @@ -31,18 +31,18 @@ struct ETableClient : public LogEvent { LogEvent(EVENT_TABLECLIENT), table(t), op(o), tid(ti) { } - void encode(bufferlist& bl, uint64_t features) const; - void decode(bufferlist::iterator& bl); - void dump(Formatter *f) const; + void encode(bufferlist& bl, uint64_t features) const override; + void decode(bufferlist::iterator& bl) override; + void dump(Formatter *f) const override; static void generate_test_instances(list& ls); - void print(ostream& out) const { + void print(ostream& out) const override { out << "ETableClient " << get_mdstable_name(table) << " " << get_mdstableserver_opname(op); if (tid) out << " tid " << tid; } //void update_segment(); - void replay(MDSRank *mds); + void replay(MDSRank *mds) override; }; WRITE_CLASS_ENCODER_FEATURES(ETableClient) diff --git a/src/mds/events/ETableServer.h b/src/mds/events/ETableServer.h index 196905ad17f6..b8dd9dbacfc9 100644 --- a/src/mds/events/ETableServer.h +++ b/src/mds/events/ETableServer.h @@ -36,12 +36,12 @@ struct ETableServer : public LogEvent { LogEvent(EVENT_TABLESERVER), table(t), op(o), reqid(ri), bymds(m), tid(ti), version(v) { } - void encode(bufferlist& bl, uint64_t features) const; - void decode(bufferlist::iterator& bl); - void dump(Formatter *f) const; + void encode(bufferlist& bl, uint64_t features) const override; + void decode(bufferlist::iterator& bl) override; + void dump(Formatter *f) const override; static void generate_test_instances(list& ls); - void print(ostream& out) const { + void print(ostream& out) const override { out << "ETableServer " << get_mdstable_name(table) << " " << get_mdstableserver_opname(op); if (reqid) out << " reqid " << reqid; @@ -51,8 +51,8 @@ struct ETableServer : public LogEvent { if (mutation.length()) out << " mutation=" << mutation.length() << " bytes"; } - void update_segment(); - void replay(MDSRank *mds); + void update_segment() override; + void replay(MDSRank *mds) override; }; WRITE_CLASS_ENCODER_FEATURES(ETableServer) diff --git a/src/mds/events/EUpdate.h b/src/mds/events/EUpdate.h index 7d567e22e763..c4ef5627fd8a 100644 --- a/src/mds/events/EUpdate.h +++ b/src/mds/events/EUpdate.h @@ -32,21 +32,21 @@ public: LogEvent(EVENT_UPDATE), metablob(mdlog), type(s), cmapv(0), had_slaves(false) { } - void print(ostream& out) const { + void print(ostream& out) const override { if (type.length()) out << "EUpdate " << type << " "; out << metablob; } - EMetaBlob *get_metablob() { return &metablob; } + EMetaBlob *get_metablob() override { return &metablob; } - void encode(bufferlist& bl, uint64_t features) const; - void decode(bufferlist::iterator& bl); - void dump(Formatter *f) const; + void encode(bufferlist& bl, uint64_t features) const override; + void decode(bufferlist::iterator& bl) override; + void dump(Formatter *f) const override; static void generate_test_instances(list& ls); - void update_segment(); - void replay(MDSRank *mds); + void update_segment() override; + void replay(MDSRank *mds) override; EMetaBlob const *get_metablob() const {return &metablob;} }; WRITE_CLASS_ENCODER_FEATURES(EUpdate) -- 2.47.3