]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: mark print methods const
authorPatrick Donnelly <pdonnell@redhat.com>
Wed, 19 Jul 2023 15:52:29 +0000 (11:52 -0400)
committerPatrick Donnelly <pdonnell@redhat.com>
Mon, 9 Oct 2023 15:37:39 +0000 (11:37 -0400)
Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
(cherry picked from commit 342d1210de857dcc2460917d5710caddfc13df5d)

src/mds/BatchOp.h
src/mds/CDentry.cc
src/mds/CDentry.h
src/mds/CDir.cc
src/mds/CDir.h
src/mds/CInode.cc
src/mds/CInode.h
src/mds/FSMapUser.cc
src/mds/FSMapUser.h
src/mds/MDSCacheObject.h
src/mds/Server.cc

index bc4e21bcea9591a2fba1433062b604c5f350093a..5277c3d69f8d7bd8df0c15e654283ab319e63817 100644 (file)
@@ -27,7 +27,7 @@ public:
   virtual void add_request(const ceph::ref_t<class MDRequestImpl>& mdr) = 0;
   virtual ceph::ref_t<class MDRequestImpl> find_new_head() = 0;
 
-  virtual void print(std::ostream&) = 0;
+  virtual void print(std::ostream&) const = 0;
 
   void forward(mds_rank_t target);
   void respond(int r);
index aac7c17eda3f693260a5c4794cbe31a6aae93f9f..f189abf8a6287df1a2ca65a51cf62bc4be27554e 100644 (file)
@@ -33,7 +33,7 @@
 
 using namespace std;
 
-ostream& CDentry::print_db_line_prefix(ostream& out)
+ostream& CDentry::print_db_line_prefix(ostream& out) const
 {
   return out << ceph_clock_now() << " mds." << dir->mdcache->mds->get_nodeid() << ".cache.den(" << dir->ino() << " " << name << ") ";
 }
@@ -137,7 +137,7 @@ bool operator<(const CDentry& l, const CDentry& r)
 }
 
 
-void CDentry::print(ostream& out)
+void CDentry::print(ostream& out) const
 {
   out << *this;
 }
index c7f83d1710a254aa4a4bfaae3c95329fcaa0b1d8..6d1b467aff2b9b484b6f3c5103c4231e5ea39e83 100644 (file)
@@ -355,8 +355,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);
 
-  std::ostream& print_db_line_prefix(std::ostream& out) override;
-  void print(std::ostream& out) override;
+  std::ostream& print_db_line_prefix(std::ostream& out) const override;
+  void print(std::ostream& out) const override;
   void dump(ceph::Formatter *f) const;
 
   static void encode_remote(inodeno_t& ino, unsigned char d_type,
index 502651d14ee66447939a33f186ee849012649d1b..069432fb27bfe9771806e394486d771d3256b486 100644 (file)
@@ -180,7 +180,7 @@ ostream& operator<<(ostream& out, const CDir& dir)
 }
 
 
-void CDir::print(ostream& out) 
+void CDir::print(ostream& out) const
 {
   out << *this;
 }
@@ -188,7 +188,7 @@ void CDir::print(ostream& out)
 
 
 
-ostream& CDir::print_db_line_prefix(ostream& out) 
+ostream& CDir::print_db_line_prefix(ostream& out) const
 {
   return out << ceph_clock_now() << " mds." << mdcache->mds->get_nodeid() << ".cache.dir(" << this->dirfrag() << ") ";
 }
index 73475b70a79d6688d438a1a99d5e99eb84453131..b88c1e7b412728145ece7fccbe881d128fde3799 100644 (file)
@@ -608,8 +608,8 @@ public:
   }
   void enable_frozen_inode();
 
-  std::ostream& print_db_line_prefix(std::ostream& out) override;
-  void print(std::ostream& out) override;
+  std::ostream& print_db_line_prefix(std::ostream& out) const override;
+  void print(std::ostream& out) const override;
   void dump(ceph::Formatter *f, int flags = DUMP_DEFAULT) const;
   void dump_load(ceph::Formatter *f);
 
index eba967d6b92ee07b679e27d7a0f6dd02076ddf7c..b5225a667497d241f2e24f5fa843e58753e60cc9 100644 (file)
@@ -131,7 +131,7 @@ std::string_view CInode::pin_name(int p) const
 }
 
 //int cinode_pins[CINODE_NUM_PINS];  // counts
-ostream& CInode::print_db_line_prefix(ostream& out)
+ostream& CInode::print_db_line_prefix(ostream& out) const
 {
   return out << ceph_clock_now() << " mds." << mdcache->mds->get_nodeid() << ".cache.ino(" << ino() << ") ";
 }
@@ -338,7 +338,7 @@ CInode::CInode(MDCache *c, bool auth, snapid_t f, snapid_t l) :
     state_set(STATE_AUTH);
 }
 
-void CInode::print(ostream& out)
+void CInode::print(ostream& out) const
 {
   out << *this;
 }
index 2f7d6d242b896ee7efbf7174843372696a539b04..5c7e1ab2e323843008323b0f96955751bb1347fc 100644 (file)
@@ -423,7 +423,7 @@ class CInode : public MDSCacheObject, public InodeStoreBase, public Counter<CIno
 
   std::string_view pin_name(int p) const override;
 
-  std::ostream& print_db_line_prefix(std::ostream& out) override;
+  std::ostream& print_db_line_prefix(std::ostream& out) const override;
 
   const scrub_info_t *scrub_info() const {
     if (!scrub_infop)
@@ -1032,7 +1032,7 @@ class CInode : public MDSCacheObject, public InodeStoreBase, public Counter<CIno
            state_test(STATE_RANDEPHEMERALPIN);
   }
 
-  void print(std::ostream& out) override;
+  void print(std::ostream& out) const override;
   void dump(ceph::Formatter *f, int flags = DUMP_DEFAULT) const;
 
   /**
index 63a58acc835aa7d07522befcb4de5dbe1273239c..1b58fdbb2f8f62b33f8f14509323cd626323f522 100644 (file)
@@ -62,7 +62,7 @@ void FSMapUser::print(std::ostream& out) const
     out << " id " <<  p.second.cid << " name " << p.second.name << std::endl;
 }
 
-void FSMapUser::print_summary(ceph::Formatter *f, std::ostream *out)
+void FSMapUser::print_summary(ceph::Formatter *f, std::ostream *out) const
 {
   std::map<mds_role_t,std::string> by_rank;
   std::map<std::string,int> by_state;
index a0be8e714aff77588573172033a1e20442b08efe..96ac26d6da947fdecd69429894889e74d1de28e4 100644 (file)
@@ -46,7 +46,7 @@ public:
   void decode(ceph::buffer::list::const_iterator& bl);
 
   void print(std::ostream& out) const;
-  void print_summary(ceph::Formatter *f, std::ostream *out);
+  void print_summary(ceph::Formatter *f, std::ostream *out) const;
 
   static void generate_test_instances(std::list<FSMapUser*>& ls);
 
@@ -57,7 +57,7 @@ public:
 WRITE_CLASS_ENCODER_FEATURES(FSMapUser::fs_info_t)
 WRITE_CLASS_ENCODER_FEATURES(FSMapUser)
 
-inline std::ostream& operator<<(std::ostream& out, FSMapUser& m) {
+inline std::ostream& operator<<(std::ostream& out, const FSMapUser& m) {
   m.print_summary(NULL, &out);
   return out;
 }
index 53d33460bc6f917ecf0b3950e75a3217bac3c0f2..8710102b70d99268881b2af09061b8bbb0f39411 100644 (file)
@@ -98,8 +98,8 @@ class MDSCacheObject {
   std::string_view generic_pin_name(int p) const;
 
   // printing
-  virtual void print(std::ostream& out) = 0;
-  virtual std::ostream& print_db_line_prefix(std::ostream& out) 
+  virtual void print(std::ostream& out) const = 0;
+  virtual std::ostream& print_db_line_prefix(std::ostream& out) const {
     return out << "mdscacheobject(" << this << ") "; 
   }
 
@@ -326,11 +326,7 @@ class MDSCacheObject {
   static uint64_t last_wait_seq;
 };
 
-std::ostream& operator<<(std::ostream& out, const mdsco_db_line_prefix& o);
-// printer
-std::ostream& operator<<(std::ostream& out, const MDSCacheObject &o);
-
-inline std::ostream& operator<<(std::ostream& out, MDSCacheObject &o) {
+inline std::ostream& operator<<(std::ostream& out, const MDSCacheObject& o) {
   o.print(out);
   return out;
 }
index aabf925cb89bd7c8da37dd46680fc015d0da203f..50d1ef198ea1fcf5fee5e6663109b9f980f468c6 100644 (file)
@@ -137,7 +137,7 @@ public:
     batch_reqs.clear();
     server->reply_client_request(mdr, make_message<MClientReply>(*mdr->client_request, r));
   }
-  void print(std::ostream& o) {
+  void print(std::ostream& o) const override {
     o << "[batch front=" << *mdr << "]";
   }
 };