]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
src: Added const references to various function parameters
authorWilson E. Alvarez <wilson.e.alvarez1@gmail.com>
Wed, 28 Mar 2018 02:45:14 +0000 (22:45 -0400)
committerWilson E. Alvarez <wilson.e.alvarez1@gmail.com>
Fri, 6 Apr 2018 21:43:04 +0000 (17:43 -0400)
Added const references to various function parameters in order to avoid
copying data unnecessarily and enhancing performance

Signed-off-by: Wilson E. Alvarez <wilson.e.alvarez1@gmail.com>
90 files changed:
src/auth/AuthAuthorizeHandler.h
src/cls/cephfs/cls_cephfs.h
src/cls/rbd/cls_rbd.cc
src/cls/rbd/cls_rbd_client.cc
src/cls/rbd/cls_rbd_client.h
src/common/Cond.h
src/common/Graylog.cc
src/common/Graylog.h
src/common/TextTable.h
src/common/bit_str.cc
src/common/bit_str.h
src/common/ceph_context.h
src/common/hex.cc
src/erasure-code/lrc/ErasureCodeLrc.cc
src/erasure-code/lrc/ErasureCodeLrc.h
src/kv/MemDB.cc
src/kv/MemDB.h
src/kv/RocksDBStore.cc
src/librbd/api/Group.cc
src/mds/CDir.cc
src/mds/CDir.h
src/mds/FSMap.h
src/mds/MDCache.cc
src/mds/MDCache.h
src/mds/MDSAuthCaps.h
src/mds/Mutation.h
src/mgr/ActivePyModule.h
src/mgr/ActivePyModules.cc
src/mgr/ActivePyModules.h
src/mgr/DaemonServer.cc
src/mgr/MgrClient.h
src/mgr/PyModuleRunner.h
src/mgr/StandbyPyModules.h
src/mon/MonCap.h
src/mon/MonMap.cc
src/mon/MonMap.h
src/mon/PGMap.cc
src/mon/mon_types.h
src/os/ObjectStore.h
src/osd/ECBackend.cc
src/osd/ECBackend.h
src/osd/PGBackend.h
src/osd/ReplicatedBackend.cc
src/osd/ReplicatedBackend.h
src/osd/SnapMapper.h
src/osd/osd_types.cc
src/rbd_replay/ios.cc
src/rbd_replay/ios.hpp
src/rbd_replay/rbd-replay-prep.cc
src/rbd_replay/rbd_loc.cc
src/rbd_replay/rbd_loc.hpp
src/rgw/rgw_admin.cc
src/rgw/rgw_auth.h
src/rgw/rgw_auth_filters.h
src/rgw/rgw_auth_s3.h
src/rgw/rgw_http_client.h
src/rgw/rgw_ldap.cc
src/rgw/rgw_ldap.h
src/rgw/rgw_rest_s3.h
src/rgw/rgw_rest_swift.cc
src/rgw/rgw_swift_auth.h
src/rgw/rgw_sync.cc
src/rgw/rgw_tag_s3.h
src/test/ObjectMap/test_keyvaluedb_iterators.cc
src/test/admin_socket_output.cc
src/test/admin_socket_output.h
src/test/librados/list.cc
src/test/librados/test.cc
src/test/mon/test_mon_workloadgen.cc
src/test/msgr/perf_msgr_client.cc
src/test/msgr/perf_msgr_server.cc
src/test/msgr/test_async_networkstack.cc
src/test/multi_stress_watch.cc
src/test/objectstore/store_test.cc
src/test/old/testfilepath.cc
src/test/osd/Object.h
src/test/osd/RadosModel.h
src/test/osd/types.cc
src/test/osdc/object_cacher_stress.cc
src/test/test_cors.cc
src/test/test_rgw_admin_log.cc
src/test/test_rgw_admin_meta.cc
src/test/test_rgw_admin_opstate.cc
src/tools/cephfs/PgFiles.cc
src/tools/cephfs/PgFiles.h
src/tools/rbd/ArgumentTypes.cc
src/tools/rbd/ArgumentTypes.h
src/tools/rbd/action/Kernel.cc
src/tools/rbd/action/Watch.cc
src/tools/rbd_mirror/image_map/Policy.h

index 2e81f14abde6462c14968419d8353760cbb588af..c53d049fa0a2cdca1ac77caa8fafe26e7d6995f1 100644 (file)
@@ -44,7 +44,7 @@ class AuthAuthorizeHandlerRegistry {
   AuthMethodList supported;
 
 public:
-  AuthAuthorizeHandlerRegistry(CephContext *cct_, std::string methods)
+  AuthAuthorizeHandlerRegistry(CephContext *cct_, const std::string &methods)
     : m_lock("AuthAuthorizeHandlerRegistry::m_lock"), supported(cct_, methods)
   {}
   ~AuthAuthorizeHandlerRegistry();
index dc426c1c93475276612fc95cac25554234f2b6f5..eafaab5b936acb52cf68e5f61a14ce9e95a0d013 100644 (file)
@@ -68,9 +68,9 @@ public:
       uint64_t obj_index_,
       uint64_t obj_size_,
       time_t mtime_,
-      std::string obj_xattr_name_,
-      std::string mtime_xattr_name_,
-      std::string obj_size_xattr_name_)
+      const std::string &obj_xattr_name_,
+      const std::string &mtime_xattr_name_,
+      const std::string &obj_size_xattr_name_)
    : obj_index(obj_index_),
      obj_size(obj_size_),
      mtime(mtime_),
index 328f479ba7b27ad48ee3a0aaf605fb0376e581af..e163f11432c3b311ee1e6aa37105b53362dd073c 100644 (file)
@@ -5191,7 +5191,7 @@ int dir_remove(cls_method_context_t hctx,
 
 static const string RBD_GROUP_SNAP_KEY_PREFIX = "snapshot_";
 
-std::string snap_key(std::string snap_id) {
+std::string snap_key(const std::string &snap_id) {
   ostringstream oss;
   oss << RBD_GROUP_SNAP_KEY_PREFIX << snap_id;
   return oss.str();
@@ -5238,8 +5238,8 @@ int snap_list(cls_method_context_t hctx, cls::rbd::GroupSnapshot start_after,
 }
 
 static int check_duplicate_snap_name(cls_method_context_t hctx,
-                                    std::string snap_name,
-                                    std::string snap_id)
+                                    const std::string &snap_name,
+                                    const std::string &snap_id)
 {
   const int max_read = 1024;
   cls::rbd::GroupSnapshot snap_last;
index c3de9266a0ca95f1b849c3ea8e4e8d69204e9d13..2a702471626eeb580416762f9d28d155f575c721 100644 (file)
@@ -1109,14 +1109,14 @@ namespace librbd {
       return get_id_finish(&it, id);
     }
 
-    void set_id(librados::ObjectWriteOperation *op, const std::string id)
+    void set_id(librados::ObjectWriteOperation *op, const std::string &id)
     {
       bufferlist bl;
       encode(id, bl);
       op->exec("rbd", "set_id", bl);
     }
 
-    int set_id(librados::IoCtx *ioctx, const std::string &oid, std::string id)
+    int set_id(librados::IoCtx *ioctx, const std::string &oid, const std::string &id)
     {
       librados::ObjectWriteOperation op;
       set_id(&op, id);
index 7cedcb6197a84e926773feced79032fba4fbac4e..c842189bd471583db0815bba8f2fd38e9cb96600 100644 (file)
@@ -257,8 +257,8 @@ namespace librbd {
     int get_id_finish(bufferlist::iterator *it, std::string *id);
     int get_id(librados::IoCtx *ioctx, const std::string &oid, std::string *id);
 
-    void set_id(librados::ObjectWriteOperation *op, std::string id);
-    int set_id(librados::IoCtx *ioctx, const std::string &oid, std::string id);
+    void set_id(librados::ObjectWriteOperation *op, const std::string &id);
+    int set_id(librados::IoCtx *ioctx, const std::string &oid, const std::string &id);
 
     // operations on rbd_directory objects
     int dir_get_id(librados::IoCtx *ioctx, const std::string &oid,
index a47b89cda107db56e7c807dead21e3874eb15a74..520a1efeb5799c3fd018c85503307b6239f42798 100644 (file)
@@ -177,7 +177,7 @@ class C_SaferCond : public Context {
   int rval;      ///< return value
 public:
   C_SaferCond() : lock("C_SaferCond"), done(false), rval(0) {}
-  C_SaferCond(std::string name) : lock(name), done(false), rval(0) {}
+  C_SaferCond(const std::string &name) : lock(name), done(false), rval(0) {}
   void finish(int r) override { complete(r); }
 
   /// We overload complete in order to not delete the context
index b5fb2014a41c160f5f5655235d3abc409af1c351..52ef259df7539d9e5fbad101dffdb78cb7c72615 100644 (file)
@@ -10,7 +10,7 @@
 namespace ceph {
 namespace logging {
 
-Graylog::Graylog(const SubsystemMap * const s, std::string logger)
+Graylog::Graylog(const SubsystemMap * const s, const std::string &logger)
     : m_subs(s),
       m_log_dst_valid(false),
       m_hostname(""),
@@ -24,7 +24,7 @@ Graylog::Graylog(const SubsystemMap * const s, std::string logger)
   m_formatter_section = std::unique_ptr<Formatter>(Formatter::create("json"));
 }
 
-Graylog::Graylog(std::string logger)
+Graylog::Graylog(const std::string &logger)
     : m_subs(NULL),
       m_log_dst_valid(false),
       m_hostname(""),
index 7e802a899572feb4f34aa2ebf461460ed95edad0..4f06803855c62b265be4f2d54e859217ac6b54a8 100644 (file)
@@ -37,14 +37,14 @@ class Graylog
    * @param s SubsystemMap
    * @param logger Value for key "_logger" in GELF
    */
-  Graylog(const SubsystemMap * const s, std::string logger);
+  Graylog(const SubsystemMap * const s, const std::string &logger);
 
   /**
    * Create Graylog without SubsystemMap. Logging will not be ready
    * until set_destination is called
    * @param logger Value for key "_logger" in GELF
    */
-  explicit Graylog(std::string logger);
+  explicit Graylog(const std::string &logger);
   virtual ~Graylog();
 
   void set_hostname(const std::string& host);
index 12e8ca1f5a4afae979ad0d294bcce8d35ef2239c..7fe3250603ba163444a5a4bb762def50d176f046 100644 (file)
@@ -45,7 +45,7 @@ private:
     Align col_align;
 
     TextTableColumn() {}
-    TextTableColumn(std::string h, int w, Align ha, Align ca) :
+    TextTableColumn(const std::string &h, int w, Align ha, Align ca) :
                    heading(h), width(w), hd_align(ha), col_align(ca) { }
     ~TextTableColumn() {}
   };
index 1f9ec3bc46b6c35aa61afe679d6e61666a82ba7f..e61e950de57289969db5d0374bd0bbc3d1b823c0 100644 (file)
@@ -56,7 +56,7 @@ static void _dump_bit_str(
 void print_bit_str(
     uint64_t bits,
     std::ostream &out,
-    std::function<const char*(uint64_t)> func,
+    const std::function<const char*(uint64_t)> &func,
     bool dump_bit_val)
 {
   _dump_bit_str(bits, &out, NULL, func, dump_bit_val);
@@ -65,7 +65,7 @@ void print_bit_str(
 void dump_bit_str(
     uint64_t bits,
     ceph::Formatter *f,
-    std::function<const char*(uint64_t)> func,
+    const std::function<const char*(uint64_t)> &func,
     bool dump_bit_val)
 {
   _dump_bit_str(bits, NULL, f, func, dump_bit_val);
index 02c7db951da29cf28768669fb18f2617a276e1ff..c4c24f6a75fb6414b925e45134fe0b322ab3fd67 100644 (file)
@@ -23,13 +23,13 @@ namespace ceph {
 extern void print_bit_str(
     uint64_t bits,
     std::ostream &out,
-    std::function<const char*(uint64_t)> func,
+    const std::function<const char*(uint64_t)> &func,
     bool dump_bit_val = false);
 
 extern void dump_bit_str(
     uint64_t bits,
     ceph::Formatter *f,
-    std::function<const char*(uint64_t)> func,
+    const std::function<const char*(uint64_t)> &func,
     bool dump_bit_val = false);
 
 #endif /* CEPH_COMMON_BIT_STR_H */
index 7ac7c32de71798f86e3fffd72275fa16608d4612..6af282225c24f15f749015e9cf41a35c63ccddda 100644 (file)
@@ -197,7 +197,7 @@ public:
     return _set_gid;
   }
 
-  void set_uid_gid_strings(std::string u, std::string g) {
+  void set_uid_gid_strings(const std::string &u, const std::string &g) {
     _set_uid_string = u;
     _set_gid_string = g;
   }
index 4fcc2158dae608bf5dca97abd9abe323738ced1d..a02e0fd6853959b0b300e010ac765de2fe039fbc 100644 (file)
@@ -26,7 +26,7 @@ void hex2str(const char *s, int len, char *buf, int dest_len)
   }
 }
 
-std::string hexdump(std::string msg, const char *s, int len)
+std::string hexdump(const std::string &msg, const char *s, int len)
 {
   int buf_len = len*4;
   char buf[buf_len];
index 73a0d7e2ab6a85449f375ed99a539f17ee6dba75..54b0b3e22f699378654a84b6d7ce1b1c33a16fd3 100644 (file)
@@ -142,7 +142,7 @@ int ErasureCodeLrc::layers_description(const ErasureCodeProfile &profile,
   return 0;
 }
 
-int ErasureCodeLrc::layers_parse(string description_string,
+int ErasureCodeLrc::layers_parse(const string &description_string,
                                 json_spirit::mArray description,
                                 ostream *ss)
 {
@@ -251,7 +251,7 @@ int ErasureCodeLrc::layers_init(ostream *ss)
   return 0;
 }
 
-int ErasureCodeLrc::layers_sanity_checks(string description_string,
+int ErasureCodeLrc::layers_sanity_checks(const string &description_string,
                                         ostream *ss) const
 {
   int position = 0;
@@ -452,7 +452,7 @@ int ErasureCodeLrc::parse_rule(ErasureCodeProfile &profile,
   return 0;
 }
 
-int ErasureCodeLrc::parse_rule_step(string description_string,
+int ErasureCodeLrc::parse_rule_step(const string &description_string,
                                       json_spirit::mArray description,
                                       ostream *ss)
 {
index ba8ac69a614c2852287f8e902e9f648d5bde64b6..f1addd913f385e5a50a2d714678bf60a6b54f0d3 100644 (file)
@@ -49,7 +49,7 @@ public:
   static const std::string DEFAULT_KML;
 
   struct Layer {
-    explicit Layer(std::string _chunks_map) : chunks_map(_chunks_map) { }
+    explicit Layer(const std::string &_chunks_map) : chunks_map(_chunks_map) { }
     ErasureCodeInterfaceRef erasure_code;
     std::vector<int> data;
     std::vector<int> coding;
@@ -65,7 +65,7 @@ public:
   std::string rule_root;
   std::string rule_device_class;
   struct Step {
-    Step(std::string _op, std::string _type, int _n) :
+    Step(const std::string &_op, const std::string &_type, int _n) :
       op(_op),
       type(_type),
       n(_n) {}
@@ -120,18 +120,18 @@ public:
 
   int parse_rule(ErasureCodeProfile &profile, std::ostream *ss);
 
-  int parse_rule_step(std::string description_string,
+  int parse_rule_step(const std::string &description_string,
                      json_spirit::mArray description,
                      std::ostream *ss);
 
   int layers_description(const ErasureCodeProfile &profile,
                         json_spirit::mArray *description,
                         std::ostream *ss) const;
-  int layers_parse(std::string description_string,
+  int layers_parse(const std::string &description_string,
                   json_spirit::mArray description,
                   std::ostream *ss);
   int layers_init(std::ostream *ss);
-  int layers_sanity_checks(std::string description_string,
+  int layers_sanity_checks(const std::string &description_string,
                           std::ostream *ss) const;
 };
 
index dc5afae45d4e4f3eaa0bbbd5903f9aa8ad858e45..438fe095ba3e4a2b1110c22f70c6b98189555a81 100644 (file)
@@ -318,7 +318,7 @@ int MemDB::_rmkey(ms_op_t &op)
   return m_map.erase(key);
 }
 
-std::shared_ptr<KeyValueDB::MergeOperator> MemDB::_find_merge_op(std::string prefix)
+std::shared_ptr<KeyValueDB::MergeOperator> MemDB::_find_merge_op(const std::string &prefix)
 {
   for (const auto& i : merge_ops) {
     if (i.first == prefix) {
index 864b9940887e82db01b8f836a6848823e91a59e2..e2fa40a2086d9befabaff5e52c82d8571316ead8 100644 (file)
@@ -65,7 +65,7 @@ public:
   int set_merge_operator(const std::string& prefix,
          std::shared_ptr<MergeOperator> mop) override;
 
-  std::shared_ptr<MergeOperator> _find_merge_op(std::string prefix);
+  std::shared_ptr<MergeOperator> _find_merge_op(const std::string &prefix);
 
   static
   int _test_init(const string& dir) { return 0; };
index b81a103bd90b3f14e3d2fb3bbcd83eaa55886261..fe5fd6c7349e408d08c85e913a4339c5463a15ad 100644 (file)
@@ -124,7 +124,7 @@ class RocksDBStore::MergeOperatorLinker
 private:
   std::shared_ptr<KeyValueDB::MergeOperator> mop;
 public:
-  MergeOperatorLinker(std::shared_ptr<KeyValueDB::MergeOperator> o) : mop(o) {}
+  MergeOperatorLinker(const std::shared_ptr<KeyValueDB::MergeOperator> &o) : mop(o) {}
 
   const char *Name() const override {
     return mop->name().c_str();
index 8bd27aa7cc0e2642884db04d3d22afa17153409e..678993b1f9e47fb1309b4535bf51aa401f7697d9 100644 (file)
@@ -100,8 +100,8 @@ int group_snap_list(librados::IoCtx& group_ioctx, const char *group_name,
 }
 
 std::string calc_ind_image_snap_name(uint64_t pool_id,
-                                    std::string group_id,
-                                    std::string snap_id)
+                                    const std::string &group_id,
+                                    const std::string &snap_id)
 {
   std::stringstream ind_snap_name_stream;
   ind_snap_name_stream << ".group." << std::hex << pool_id << "_"
index 4e9ba084c96ba05936631adcf724ce4150ed1c85..11ac663919c34e69e9fdb0ea10690b0159fbe75d 100644 (file)
@@ -2624,7 +2624,7 @@ bool CDir::contains(CDir *x)
 
 /** set_dir_auth
  */
-void CDir::set_dir_auth(mds_authority_t a)
+void CDir::set_dir_auth(const mds_authority_t &a)
 { 
   dout(10) << "setting dir_auth=" << a
           << " from " << dir_auth
index fab780d2fd4f02c0b5ecc7a89b247fb99a50f353..6e44bdd3f64ee61ba6470c6197ecbbdc7680e235 100644 (file)
@@ -521,7 +521,7 @@ private:
  public:
   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(const mds_authority_t &a);
   void set_dir_auth(mds_rank_t a) { set_dir_auth(mds_authority_t(a, CDIR_AUTH_UNKNOWN)); }
   bool is_ambiguous_dir_auth() const {
     return dir_auth.second != CDIR_AUTH_UNKNOWN;
index 4e123367194b58072ba6d1fd8f8cddb3f7288c22..36f8a6f796e4eda6c47cf9beec608963ca674788 100644 (file)
@@ -405,7 +405,7 @@ public:
   /**
    * A daemon has informed us of its offload targets
    */
-  void update_export_targets(mds_gid_t who, const std::set<mds_rank_t> targets)
+  void update_export_targets(mds_gid_t who, const std::set<mds_rank_t> &targets)
   {
     auto fscid = mds_roles.at(who);
     modify_filesystem(fscid, [who, &targets](std::shared_ptr<Filesystem> fs) {
index 9caf909c00e3b5da1ef66cd727769b63ee75710c..ac64312e0a683d2566c158ba0ab9bb0fb9a8d8bf 100644 (file)
@@ -1163,7 +1163,7 @@ void MDCache::get_force_dirfrag_bound_set(vector<dirfrag_t>& dfs, set<CDir*>& bo
   }
 }
 
-void MDCache::adjust_bounded_subtree_auth(CDir *dir, vector<dirfrag_t>& bound_dfs, mds_authority_t auth)
+void MDCache::adjust_bounded_subtree_auth(CDir *dir, vector<dirfrag_t>& bound_dfs, const mds_authority_t &auth)
 {
   dout(7) << "adjust_bounded_subtree_auth " << dir->get_dir_auth() << " -> " << auth
          << " on " << *dir << " bound_dfs " << bound_dfs << dendl;
index 119b38f5a51cbe02fcce4f7cbf008124d7bfb2db..7d747db5d9daf591c1b9810314bdded4cdc1c034 100644 (file)
@@ -323,7 +323,7 @@ public:
   void adjust_bounded_subtree_auth(CDir *dir, set<CDir*>& bounds, mds_rank_t a) {
     adjust_bounded_subtree_auth(dir, bounds, mds_authority_t(a, CDIR_AUTH_UNKNOWN));
   }
-  void adjust_bounded_subtree_auth(CDir *dir, vector<dirfrag_t>& bounds, mds_authority_t auth);
+  void adjust_bounded_subtree_auth(CDir *dir, vector<dirfrag_t>& bounds, const mds_authority_t &auth);
   void adjust_bounded_subtree_auth(CDir *dir, vector<dirfrag_t>& bounds, mds_rank_t a) {
     adjust_bounded_subtree_auth(dir, bounds, mds_authority_t(a, CDIR_AUTH_UNKNOWN));
   }
index 1e6cda68cc2b023d6f3228fd011256d6fd34f658..b867da4f0f9d8d633c009ef27ecba8ab429ddf26 100644 (file)
@@ -76,11 +76,11 @@ struct MDSCapMatch {
 
   MDSCapMatch() : uid(MDS_AUTH_UID_ANY) {}
   MDSCapMatch(int64_t uid_, std::vector<gid_t>& gids_) : uid(uid_), gids(gids_) {}
-  explicit MDSCapMatch(std::string path_)
+  explicit MDSCapMatch(const std::string &path_)
     : uid(MDS_AUTH_UID_ANY), path(path_) {
     normalize_path();
   }
-  MDSCapMatch(std::string path_, int64_t uid_, std::vector<gid_t>& gids_)
+  MDSCapMatch(const std::string& path_, int64_t uid_, std::vector<gid_t>& gids_)
     : uid(uid_), gids(gids_), path(path_) {
     normalize_path();
   }
index 4b116c472dbb19a5e906596b9ba0ae1331379646..d079af418ba3acd29a4a4a18259a3fad725bb82f 100644 (file)
@@ -89,7 +89,7 @@ public:
   // keep our default values synced with MDRequestParam's
   MutationImpl() : TrackedOp(nullptr, utime_t()) {}
   MutationImpl(OpTracker *tracker, utime_t initiated,
-              metareqid_t ri, __u32 att=0, mds_rank_t slave_to=MDS_RANK_NONE)
+              const metareqid_t &ri, __u32 att=0, mds_rank_t slave_to=MDS_RANK_NONE)
     : TrackedOp(tracker, initiated),
       reqid(ri), attempt(att),
       slave_to_mds(slave_to) { }
index 9279f1c8f5d8a7d548038e5c14a8211af4604645..85d50807a053d4fd22a85e7b76e1757ffde579d4 100644 (file)
@@ -43,7 +43,7 @@ private:
   std::string uri;
 
 public:
-  ActivePyModule(PyModuleRef py_module_,
+  ActivePyModule(const PyModuleRef &py_module_,
       LogChannelRef clog_)
     : PyModuleRunner(py_module_, clog_)
   {}
index 7bf51450977921162f44a6da35d4ef90fc36c543..3803addb8d333d6b6c3f6c70cca542c7635331a9 100644 (file)
@@ -552,7 +552,7 @@ PyObject* ActivePyModules::get_counter_python(
 }
 
 PyObject* ActivePyModules::get_perf_schema_python(
-    const std::string svc_type,
+    const std::string &svc_type,
     const std::string &svc_id)
 {
   PyThreadState *tstate = PyEval_SaveThread();
index 60572c25bfcb0223b90b126b6dc0b370093a7d42..c5befc9de2fc35f630a787fc34be771a0d51095b 100644 (file)
@@ -72,7 +72,7 @@ public:
     const std::string &svc_id,
     const std::string &path);
   PyObject *get_perf_schema_python(
-     const std::string svc_type,
+     const std::string &svc_type,
      const std::string &svc_id);
   PyObject *get_context();
   PyObject *get_osdmap();
index 11ba41b3491c88b1fdc40cb6963f163cae551bd1..ae00a7902b78b132d20f192d411d1764b7a74590 100644 (file)
@@ -672,7 +672,7 @@ bool DaemonServer::handle_command(MCommand *m)
     bufferlist from_mon;
     string outs;
 
-    ReplyOnFinish(std::shared_ptr<CommandContext> cmdctx_)
+    ReplyOnFinish(const std::shared_ptr<CommandContext> &cmdctx_)
       : cmdctx(cmdctx_)
     {}
     void finish(int r) override {
index 91618ce201541c62ca475140c0807eb999711386..2a502ecc57e6c2db730eebcb3f4f86a9ed6782c3 100644 (file)
@@ -104,10 +104,10 @@ public:
   bool handle_command_reply(MCommandReply *m);
 
   void send_pgstats();
-  void set_pgstats_cb(std::function<MPGStats*()> cb_)
+  void set_pgstats_cb(std::function<MPGStats*()>&& cb_)
   {
     Mutex::Locker l(lock);
-    pgstats_cb = cb_;
+    pgstats_cb = std::move(cb_);
   }
 
   int start_command(const vector<string>& cmd, const bufferlist& inbl,
index 40b27d11f20668750f372b6d29525bdb085c245e..b4362fae1628682890d41a02dd5b843c8fb19ea8 100644 (file)
@@ -53,7 +53,7 @@ public:
   void log(int level, const std::string &record);
 
   PyModuleRunner(
-      PyModuleRef py_module_,
+      const PyModuleRef &py_module_,
       LogChannelRef clog_)
     : 
       py_module(py_module_),
index 14d968ec3b39c0ea2fdeae330e1bb19971f8292e..6c5286addb528c1d5a922cf145470260360b37e7 100644 (file)
@@ -89,7 +89,7 @@ class StandbyPyModule : public PyModuleRunner
 
   StandbyPyModule(
       StandbyPyModuleState &state_,
-      PyModuleRef py_module_,
+      const PyModuleRef &py_module_,
       LogChannelRef clog_)
     :
       PyModuleRunner(py_module_, clog_),
index 1ff4b831ed1de428273145cff396529d006ca096..4ef57206e89d67017287141cb7992d918789f75a 100644 (file)
@@ -133,7 +133,7 @@ struct MonCap {
   std::vector<MonCapGrant> grants;
 
   MonCap() {}
-  explicit MonCap(std::vector<MonCapGrant> g) : grants(g) {}
+  explicit MonCap(const std::vector<MonCapGrant> &g) : grants(g) {}
 
   string get_str() const {
     return text;
index 74b39e927f6912296724215be7b818ba6f8dfbca..3a32a07d5934fa741d0a9807145a4c5d6e5ac20f 100644 (file)
@@ -343,7 +343,7 @@ void MonMap::dump(Formatter *f) const
 }
 
 
-int MonMap::build_from_host_list(std::string hostlist, std::string prefix)
+int MonMap::build_from_host_list(std::string hostlist, const std::string &prefix)
 {
   vector<entity_addr_t> addrs;
   if (parse_ip_port_vec(hostlist.c_str(), addrs)) {
index 63cc2209021a2e701241786a2fc30fa6eb8e13ba..ffd2e8f88d894c0a67f253bf1a6ee0d3a664fe4b 100644 (file)
@@ -317,7 +317,7 @@ public:
    * @param prefix prefix to prepend to generated mon names
    * @return 0 for success, -errno on error
    */
-  int build_from_host_list(std::string hosts, std::string prefix);
+  int build_from_host_list(std::string hosts, const std::string &prefix);
 
   /**
    * filter monmap given a set of initial members.
index c2fd816f191c953a87fefc6db53ee8c071fb8dd1..931c752dec3552fc075636660c87d53db5c5c7fc 100644 (file)
@@ -2146,13 +2146,13 @@ void PGMap::get_health_checks(
     stuck_cb stuck_since;
     bool invert;
 
-    PgStateResponse(const pg_consequence_t &c, stuck_cb s)
-      : consequence(c), stuck_since(s), invert(false)
+    PgStateResponse(const pg_consequence_t& c, stuck_cb&& s)
+      : consequence(c), stuck_since(std::move(s)), invert(false)
     {
     }
 
-    PgStateResponse(const pg_consequence_t &c, stuck_cb s, bool i)
-      : consequence(c), stuck_since(s), invert(i)
+    PgStateResponse(const pg_consequence_t& c, stuck_cb&& s, bool i)
+      : consequence(c), stuck_since(std::move(s)), invert(i)
     {
     }
   };
index bee9fce176635599b34b49dd3cb50c71a3d49cea..cdd660312ce55da16d282f4a1a9532b3fa4de2e7 100644 (file)
@@ -539,7 +539,7 @@ namespace ceph {
           );
       }
 
-      static inline mon_feature_t get_feature_by_name(std::string n);
+      static inline mon_feature_t get_feature_by_name(const std::string &n);
     }
   }
 }
@@ -561,7 +561,7 @@ static inline const char *ceph::features::mon::get_feature_name(uint64_t b) {
   return "unknown";
 }
 
-inline mon_feature_t ceph::features::mon::get_feature_by_name(std::string n) {
+inline mon_feature_t ceph::features::mon::get_feature_by_name(const std::string &n) {
 
   if (n == "kraken") {
     return FEATURE_KRAKEN;
index 695ca731ff8b39e61694e06c8ef38a7dc449a8c8..5b5d059406aa6edc5d258843a0c17d1093e6b21a 100644 (file)
@@ -1207,7 +1207,7 @@ public:
       _op->cid = _get_coll_id(cid);
       data.ops++;
     }
-    void collection_move(const coll_t& cid, coll_t oldcid, const ghobject_t& oid)
+    void collection_move(const coll_t& cid, const coll_t &oldcid, const ghobject_t& oid)
       __attribute__ ((deprecated)) {
        // NOTE: we encode this as a fixed combo of ADD + REMOVE.  they
        // always appear together, so this is effectively a single MOVE.
@@ -1225,7 +1225,7 @@ public:
        data.ops++;
       }
     void collection_move_rename(const coll_t& oldcid, const ghobject_t& oldoid,
-                               coll_t cid, const ghobject_t& oid) {
+                               const coll_t &cid, const ghobject_t& oid) {
       Op* _op = _get_next_op();
       _op->op = OP_COLL_MOVE_RENAME;
       _op->cid = _get_coll_id(oldcid);
@@ -1234,7 +1234,7 @@ public:
       _op->dest_oid = _get_object_id(oid);
       data.ops++;
     }
-    void try_rename(coll_t cid, const ghobject_t& oldoid,
+    void try_rename(const coll_t &cid, const ghobject_t& oldoid,
                     const ghobject_t& oid) {
       Op* _op = _get_next_op();
       _op->op = OP_TRY_RENAME;
@@ -1246,7 +1246,7 @@ public:
 
     /// Remove omap from oid
     void omap_clear(
-      coll_t cid,           ///< [in] Collection containing oid
+      const coll_t &cid,           ///< [in] Collection containing oid
       const ghobject_t &oid  ///< [in] Object from which to remove omap
       ) {
       Op* _op = _get_next_op();
@@ -1272,7 +1272,7 @@ public:
 
     /// Set keys on an oid omap (bufferlist variant).
     void omap_setkeys(
-      coll_t cid,                           ///< [in] Collection containing oid
+      const coll_t &cid,                           ///< [in] Collection containing oid
       const ghobject_t &oid,                ///< [in] Object to update
       const bufferlist &attrset_bl          ///< [in] Replacement keys and values
       ) {
@@ -1286,7 +1286,7 @@ public:
 
     /// Remove keys from oid omap
     void omap_rmkeys(
-      coll_t cid,             ///< [in] Collection containing oid
+      const coll_t &cid,             ///< [in] Collection containing oid
       const ghobject_t &oid,  ///< [in] Object from which to remove the omap
       const set<string> &keys ///< [in] Keys to clear
       ) {
@@ -1301,7 +1301,7 @@ public:
 
     /// Remove keys from oid omap
     void omap_rmkeys(
-      coll_t cid,             ///< [in] Collection containing oid
+      const coll_t &cid,             ///< [in] Collection containing oid
       const ghobject_t &oid,  ///< [in] Object from which to remove the omap
       const bufferlist &keys_bl ///< [in] Keys to clear
       ) {
@@ -1315,7 +1315,7 @@ public:
 
     /// Remove key range from oid omap
     void omap_rmkeyrange(
-      coll_t cid,             ///< [in] Collection containing oid
+      const coll_t &cid,             ///< [in] Collection containing oid
       const ghobject_t &oid,  ///< [in] Object from which to remove the omap keys
       const string& first,    ///< [in] first key in range
       const string& last      ///< [in] first key past range, range is [first,last)
@@ -1332,7 +1332,7 @@ public:
 
     /// Set omap header
     void omap_setheader(
-      coll_t cid,             ///< [in] Collection containing oid
+      const coll_t &cid,             ///< [in] Collection containing oid
       const ghobject_t &oid,  ///< [in] Object
       const bufferlist &bl    ///< [in] Header value
       ) {
@@ -1348,10 +1348,10 @@ public:
     /// Split collection based on given prefixes, objects matching the specified bits/rem are
     /// moved to the new collection
     void split_collection(
-      coll_t cid,
+      const coll_t &cid,
       uint32_t bits,
       uint32_t rem,
-      coll_t destination) {
+      const coll_t &destination) {
       Op* _op = _get_next_op();
       _op->op = OP_SPLIT_COLLECTION2;
       _op->cid = _get_coll_id(cid);
@@ -1362,7 +1362,7 @@ public:
     }
 
     void collection_set_bits(
-      coll_t cid,
+      const coll_t &cid,
       int bits) {
       Op* _op = _get_next_op();
       _op->op = OP_COLL_SET_BITS;
@@ -1374,7 +1374,7 @@ public:
     /// Set allocation hint for an object
     /// make 0 values(expected_object_size, expected_write_size) noops for all implementations
     void set_alloc_hint(
-      coll_t cid,
+      const coll_t &cid,
       const ghobject_t &oid,
       uint64_t expected_object_size,
       uint64_t expected_write_size,
index 09edb5e89be6a1c200fcb8759013ea236d172148..1a63ed01150d060925efd195c48aa93670309954 100644 (file)
@@ -190,7 +190,7 @@ void ECBackend::RecoveryOp::dump(Formatter *f) const
 
 ECBackend::ECBackend(
   PGBackend::Listener *pg,
-  coll_t coll,
+  const coll_t &coll,
   ObjectStore::CollectionHandle &ch,
   ObjectStore *store,
   CephContext *cct,
index 4de82cba4a98bab06bbd6e8f0a1b4ec4a2745e94..a55bc86324fee162a54e74e47bbcd1478d0cd778 100644 (file)
@@ -626,7 +626,7 @@ public:
 public:
   ECBackend(
     PGBackend::Listener *pg,
-    coll_t coll,
+    const coll_t &coll,
     ObjectStore::CollectionHandle &ch,
     ObjectStore *store,
     CephContext *cct,
index 70c967d0d9efcd4403f4bf997c16b20dcd18571e..1914cb9acaa5aceafabd1e7f01d1ea7abace6111 100644 (file)
@@ -297,7 +297,7 @@ typedef ceph::shared_ptr<const OSDMap> OSDMapRef;
    };
    Listener *parent;
    Listener *get_parent() const { return parent; }
-   PGBackend(CephContext* cct, Listener *l, ObjectStore *store, coll_t coll,
+   PGBackend(CephContext* cct, Listener *l, ObjectStore *store, const coll_t &coll,
             ObjectStore::CollectionHandle &ch) :
      cct(cct),
      store(store),
index 5adaa4af058073c050fe2eb20846a4a1277c2d4b..a5e1f855ee244faf3f467171dfa1a8fc4e64910b 100644 (file)
@@ -100,7 +100,7 @@ static void log_subop_stats(
 
 ReplicatedBackend::ReplicatedBackend(
   PGBackend::Listener *pg,
-  coll_t coll,
+  const coll_t &coll,
   ObjectStore::CollectionHandle &c,
   ObjectStore *store,
   CephContext *cct) :
index a1325a948474cbfbc5bd52902e32345f344c89e3..a54f19933cac7e5e6b0ae5ff4d20b77231777989 100644 (file)
@@ -29,7 +29,7 @@ class ReplicatedBackend : public PGBackend {
 public:
   ReplicatedBackend(
     PGBackend::Listener *pg,
-    coll_t coll,
+    const coll_t &coll,
     ObjectStore::CollectionHandle &ch,
     ObjectStore *store,
     CephContext *cct);
index ef2da3ccc18797b650553009181bfc016507720b..b4361ed7fa6818cfe50caf996668182f5403fd07 100644 (file)
@@ -39,7 +39,7 @@ public:
     ghobject_t hoid;
     ObjectStore::Transaction *t;
     OSTransaction(
-      coll_t cid,
+      const coll_t &cid,
       const ghobject_t &hoid,
       ObjectStore::Transaction *t)
       : cid(cid), hoid(hoid), t(t) {}
index ca5ddc0bea3ccd339efe75b97cfb9762c4a62b9e..9510ec1a6dcfd973a32ec1032c470fe33832c4c2 100644 (file)
@@ -1084,7 +1084,7 @@ class pool_opts_encoder_t : public boost::static_visitor<>
 public:
   explicit pool_opts_encoder_t(bufferlist& bl_) : bl(bl_) {}
 
-  void operator()(std::string s) const {
+  void operator()(const std::string &s) const {
     encode(static_cast<int32_t>(pool_opts_t::STR), bl);
     encode(s, bl);
   }
index 845b69902340ea21cc0afb2ff9eb8c08bf2339d2..77b4f4858b7d4a53b908c536d08e55bd0e88323a 100644 (file)
@@ -47,7 +47,7 @@ action::Dependencies convert_dependencies(uint64_t start_time,
 
 } // anonymous namespace
 
-void IO::write_debug_base(ostream& out, string type) const {
+void IO::write_debug_base(ostream& out, const string &type) const {
   out << m_ionum << ": " << m_start_time / 1000000.0 << ": " << type << ", thread = " << m_thread_id << ", deps = {";
   bool first = true;
   for (io_set_t::iterator itr = m_dependencies.begin(), end = m_dependencies.end(); itr != end; ++itr) {
index d8f586186508a55a48f2ecc698964cf5a5c3d47f..8a105afd2d7e48191eac04cce9e479833f15b34f 100644 (file)
@@ -94,7 +94,7 @@ public:
   virtual void write_debug(std::ostream& out) const = 0;
 
 protected:
-  void write_debug_base(std::ostream& out, std::string iotype) const;
+  void write_debug_base(std::ostream& out, const std::string &iotype) const;
 
 private:
   action_id_t m_ionum;
index 1ece6e9bd61ede60338894a800cb5132e0d3f519..bfcd250657e17c1dc955f443bfc761da610b9aa9 100644 (file)
@@ -88,7 +88,7 @@ private:
 
 class AnonymizedImage {
 public:
-  void init(string image_name, int index) {
+  void init(const string &image_name, int index) {
     assert(m_image_name == "");
     m_image_name = image_name;
     ostringstream oss;
@@ -119,14 +119,14 @@ private:
   map<string, string> m_snaps;
 };
 
-static void usage(string prog) {
+static void usage(const string &prog) {
   std::stringstream str;
   str << "Usage: " << prog << " ";
   std::cout << str.str() << "[ --window <seconds> ] [ --anonymize ] [ --verbose ]" << std::endl
             << std::string(str.str().size(), ' ') << "<trace-input> <replay-output>" << endl;
 }
 
-__attribute__((noreturn)) static void usage_exit(string prog, string msg) {
+__attribute__((noreturn)) static void usage_exit(const string &prog, const string &msg) {
   cerr << msg << endl;
   usage(prog);
   exit(1);
index 86c50ae1a70f05bcd59894f281f12b6c43636cb5..fea73c3836dea8b4fabdc27bf4cde87c3280a3e9 100644 (file)
@@ -23,7 +23,7 @@ using namespace rbd_replay;
 rbd_loc::rbd_loc() {
 }
 
-rbd_loc::rbd_loc(string pool, string image, string snap)
+rbd_loc::rbd_loc(const string &pool, const string &image, const string &snap)
   : pool(pool),
     image(image),
     snap(snap) {
index 9865962fd3ef307d7081a2ba8c0f2258f00690e3..8b7bfac1f2b6f5e6fe713b57066396beb1240b87 100644 (file)
@@ -49,7 +49,7 @@ struct rbd_loc {
   /**
      Constructs an rbd_loc with the given pool, image, and snap.
    */
-  rbd_loc(std::string pool, std::string image, std::string snap);
+  rbd_loc(const std::string &pool, const std::string &image, const std::string &snap);
 
   /**
      Parses an rbd_loc from the given string.
index ea9c4800627cddb2172e975989ae0e87f9d3d966..fb33cc38d09b689f755c0499d927b78fe88898eb 100644 (file)
@@ -2289,7 +2289,7 @@ static void parse_tier_config_param(const string& s, map<string, string, ltstr_n
   }
 }
 
-static int check_pool_support_omap(rgw_pool pool) 
+static int check_pool_support_omap(const rgw_pool& pool)
 {
   librados::IoCtx io_ctx;
   int ret = store->get_rados_handle()->ioctx_create(pool.to_str().c_str(), io_ctx);
index f6744425cf2665b69d9a8151ac3ad00f347e92a6..b0330193ccd4711c5dcd0cb9bed8f38821e4529b 100644 (file)
@@ -431,7 +431,7 @@ public:
     virtual aplptr_t create_apl_remote(CephContext* cct,
                                        const req_state* s,
                                        acl_strategy_t&& extra_acl_strategy,
-                                       const AuthInfo info) const = 0;
+                                       const AuthInfo &info) const = 0;
   };
 };
 
index 78846fc28d914246419e29fb854dc9d7e9ef4eaf..7f90b7027a76b240d4f760e19892ce63b19859b7 100644 (file)
@@ -112,7 +112,7 @@ public:
 
   template <typename U>
   ThirdPartyAccountApplier(RGWRados* const store,
-                           const rgw_user acct_user_override,
+                           const rgw_user &acct_user_override,
                            U&& decoratee)
     : DecoratedApplier<T>(std::move(decoratee)),
       store(store),
@@ -175,7 +175,7 @@ void ThirdPartyAccountApplier<T>::load_acct_info(RGWUserInfo& user_info) const
 
 template <typename T> static inline
 ThirdPartyAccountApplier<T> add_3rdparty(RGWRados* const store,
-                                         const rgw_user acct_user_override,
+                                         const rgw_user &acct_user_override,
                                          T&& t) {
   return ThirdPartyAccountApplier<T>(store, acct_user_override,
                                      std::forward<T>(t));
index a740990ce0d28c4fdc1485b5a46d0c775e9db63f..6bcdebaf1cc2174bb04c639950e89fecd50bb14a 100644 (file)
@@ -47,7 +47,7 @@ class ExternalAuthStrategy : public rgw::auth::Strategy,
   aplptr_t create_apl_remote(CephContext* const cct,
                              const req_state* const s,
                              rgw::auth::RemoteApplier::acl_strategy_t&& acl_alg,
-                             const rgw::auth::RemoteApplier::AuthInfo info
+                             const rgw::auth::RemoteApplier::AuthInfo &info
                             ) const override {
     auto apl = rgw::auth::add_sysreq(cct, store, s,
       rgw::auth::RemoteApplier(cct, store, std::move(acl_alg), info,
index 04ffb80c90e6afd13ba4989d13a014c73c62860d..53bb2905c79db4fc90b8e79554abb0d1e089fa7d 100644 (file)
@@ -143,7 +143,7 @@ public:
   typedef std::set<header_name_t, ltstr_nocase> header_spec_t;
 
   RGWHTTPHeadersCollector(CephContext * const cct,
-                          const header_spec_t relevant_headers)
+                          const header_spec_t &relevant_headers)
     : RGWHTTPClient(cct),
       relevant_headers(relevant_headers) {
   }
index a39afa6c081fd3dfd31a71528858211896990664..185602f1359348a423dc2f96b1ddbb64b4609a86 100644 (file)
@@ -41,7 +41,7 @@ std::string parse_rgw_ldap_bindpw(CephContext* ctx)
 #if defined(HAVE_OPENLDAP)
 namespace rgw {
 
-  int LDAPHelper::auth(const std::string uid, const std::string pwd) {
+  int LDAPHelper::auth(const std::string &uid, const std::string &pwd) {
     int ret;
     std::string filter;
     if (msad) {
index ab84d82b41e5ec3089ab4b8478f6284a5dc3a0cd..2f7316ccf7ac1355b3e1fef318840efee2847d39 100644 (file)
@@ -38,7 +38,7 @@ namespace rgw {
     using lock_guard = std::lock_guard<std::mutex>;
 
     LDAPHelper(std::string _uri, std::string _binddn, std::string _bindpw,
-              std::string _searchdn, std::string _searchfilter, std::string _dnattr)
+              const std::string &_searchdn, const std::string &_searchfilter, const std::string &_dnattr)
       : uri(std::move(_uri)), binddn(std::move(_binddn)),
        bindpw(std::move(_bindpw)), searchdn(_searchdn), searchfilter(_searchfilter), dnattr(_dnattr),
        ldap(nullptr) {
@@ -91,7 +91,7 @@ namespace rgw {
       return ret; // OpenLDAP client error space
     }
 
-    int auth(const std::string uid, const std::string pwd);
+    int auth(const std::string &uid, const std::string &pwd);
 
     ~LDAPHelper() {
       if (ldap)
@@ -105,8 +105,8 @@ namespace rgw {
   class LDAPHelper
   {
   public:
-    LDAPHelper(std::string _uri, std::string _binddn, std::string _bindpw,
-              std::string _searchdn, std::string _searchfilter, std::string _dnattr)
+    LDAPHelper(const std::string &_uri, const std::string &_binddn, const std::string &_bindpw,
+              const std::string &_searchdn, const std::string &_searchfilter, const std::string &_dnattr)
       {}
 
     int init() {
@@ -117,7 +117,7 @@ namespace rgw {
       return -ENOTSUP;
     }
 
-    int auth(const std::string uid, const std::string pwd) {
+    int auth(const std::string &uid, const std::string &pwd) {
       return -EACCES;
     }
 
index 688ec4091025584019dbc54ef9877099d783412b..3b15afa0b8db5efff97715d2120b25f894c1970c 100644 (file)
@@ -904,7 +904,7 @@ public:
   aplptr_t create_apl_remote(CephContext* const cct,
                              const req_state* const s,
                              rgw::auth::RemoteApplier::acl_strategy_t&& acl_alg,
-                             const rgw::auth::RemoteApplier::AuthInfo info
+                             const rgw::auth::RemoteApplier::AuthInfo &info
                             ) const override {
     return aplptr_t(
       new rgw::auth::RemoteApplier(cct, store, std::move(acl_alg), info,
index 9a2551cc86e450e7d05903729d6cf5e6a928aac3..260ee389d709858a1abe52e21c19b634736983e9 100644 (file)
@@ -80,7 +80,7 @@ int RGWListBuckets_ObjStore_SWIFT::get_params()
 
 static void dump_account_metadata(struct req_state * const s,
                                   const RGWUsageStats& global_stats,
-                                  const std::map<std::string, RGWUsageStats> policies_stats,
+                                  const std::map<std::string, RGWUsageStats> &policies_stats,
                                   /* const */map<string, bufferlist>& attrs,
                                   const RGWQuotaInfo& quota,
                                   const RGWAccessControlPolicy_SWIFTAcct &policy)
index cc508202db855fd5e07be02eec58d6df0026d48f..49685068ee6a9a29fc8531d1a2e12f550ada2ec7 100644 (file)
@@ -187,7 +187,7 @@ class DefaultStrategy : public rgw::auth::Strategy,
   aplptr_t create_apl_remote(CephContext* const cct,
                              const req_state* const s,
                              acl_strategy_t&& extra_acl_strategy,
-                             const rgw::auth::RemoteApplier::AuthInfo info) const override {
+                             const rgw::auth::RemoteApplier::AuthInfo &info) const override {
     auto apl = \
       rgw::auth::add_3rdparty(store, s->account_name,
         rgw::auth::add_sysreq(cct, store, s,
index f2de6a76f94625aa4f19a767fcc0648516859441..3a1230ec1447f13b5ab27aa4c29fe764f05f6e81 100644 (file)
@@ -1875,7 +1875,7 @@ class RGWMetaSyncCR : public RGWCoroutine {
   int ret{0};
 
 public:
-  RGWMetaSyncCR(RGWMetaSyncEnv *_sync_env, RGWPeriodHistory::Cursor cursor,
+  RGWMetaSyncCR(RGWMetaSyncEnv *_sync_env, const RGWPeriodHistory::Cursor &cursor,
                 const rgw_meta_sync_status& _sync_status, RGWSyncTraceNodeRef& _tn)
     : RGWCoroutine(_sync_env->cct), sync_env(_sync_env),
       pool(sync_env->store->get_zone_params().log_pool),
index 8e075772290f4fb19c3b699091bfb4a01c17d9ac..57ef398ac09c6976832f14c75b4c17f255a9ad2f 100644 (file)
@@ -28,7 +28,7 @@ class RGWObjTagEntry_S3: public XMLObj
   std::string val;
 public:
   RGWObjTagEntry_S3() {}
-  RGWObjTagEntry_S3(std::string k,std::string v):key(k),val(v) {};
+  RGWObjTagEntry_S3(const std::string &k, const std::string &v):key(k),val(v) {};
   ~RGWObjTagEntry_S3() {}
 
   bool xml_end(const char*) override;
index d041230cb25f2f5109e2431a93a640887e18b7d5..8c2bd0f648608f81cdb0bfa96695a6abca81587a 100644 (file)
@@ -93,8 +93,8 @@ public:
   ::testing::AssertionResult validate_iterator(
                                KeyValueDB::WholeSpaceIterator it,
                                string expected_prefix,
-                               string expected_key,
-                               string expected_value) {
+                               const string &expected_key,
+                               const string &expected_value) {
     if (!it->valid()) {
       return ::testing::AssertionFailure()
              << __func__
@@ -214,13 +214,13 @@ public:
     return str;
   }
 
-  string _gen_val_str(string key) {
+  string _gen_val_str(const string &key) {
     ostringstream ss;
     ss << "##value##" << key << "##";
     return ss.str();
  }
 
-  bufferlist _gen_val(string key) {
+  bufferlist _gen_val(const string &key) {
     bufferlist bl;
     bl.append(_gen_val_str(key));
     return bl;
index 37bd732a5057ceaa8623bd6ba1df8179b0f6e870..7e6651a7c0a07a4cbd51f23ce9a43396886aef3c 100644 (file)
@@ -98,7 +98,7 @@ bool AdminSocketOutput::init_sockets() {
 
 std::pair<std::string, std::string>
 AdminSocketOutput::run_command(AdminSocketClient &client,
-                               const std::string raw_command,
+                               const std::string &raw_command,
                                bool send_untouched) {
   std::cout << "Sending command \"" << raw_command << "\"" << std::endl;
   std::string command;
@@ -188,8 +188,8 @@ bool AdminSocketOutput::gather_socket_output() {
   return true;
 }
 
-std::string AdminSocketOutput::get_result(const std::string target,
-                                          const std::string command) const {
+std::string AdminSocketOutput::get_result(const std::string &target,
+                                          const std::string &command) const {
   const auto& target_results = results.find(target);
   if (target_results == results.end())
     return std::string("");
index 3be7311907fb5d5799e52dd83bc8398a926376c3..e8e65d69ed4f27bcffb9463bd5eba174b49ef400 100644 (file)
@@ -54,10 +54,10 @@ private:
 
   bool init_sockets();
   bool gather_socket_output();
-  std::string get_result(const std::string target, const std::string command) const;
+  std::string get_result(const std::string &target, const std::string &command) const;
 
   std::pair<std::string, std::string>
-  run_command(AdminSocketClient &client, const std::string raw_command,
+  run_command(AdminSocketClient &client, const std::string &raw_command,
               bool send_untouched = false);
 
   bool run_tests() const;
index ab027ad0ed432ff0a10deffc8038e559061c2818..860ccb5b663ab7576ae111e6ffd8e869608e1a6c 100644 (file)
@@ -142,7 +142,7 @@ TEST_F(LibRadosListPP, ListObjectsEndIter) {
 static void check_list(
   std::set<std::string>& myset,
   rados_list_ctx_t& ctx,
-  std::string check_nspace)
+  const std::string &check_nspace)
 {
   const char *entry, *nspace;
   cout << "myset " << myset << std::endl;
@@ -227,7 +227,7 @@ TEST_F(LibRadosList, ListObjectsNS) {
   rados_nobjects_list_close(ctx);
 }
 
-static void check_listpp(std::set<std::string>& myset, IoCtx& ioctx, std::string check_nspace)
+static void check_listpp(std::set<std::string>& myset, IoCtx& ioctx, const std::string &check_nspace)
 {
   NObjectIterator iter(ioctx.nobjects_begin());
   std::set<std::string> orig_set(myset);
index 42269b074bf58666ade58bf3998fa824a7c8b172..04fd0452e66bdbe59a6319111a3da869266d6e70 100644 (file)
@@ -83,7 +83,7 @@ int destroy_ec_profile(rados_t *cluster,
 }
 
 int destroy_ruleset(rados_t *cluster,
-                    std::string ruleset,
+                    const std::string &ruleset,
                     std::ostream &oss)
 {
   char *cmd[2];
@@ -98,7 +98,7 @@ int destroy_ruleset(rados_t *cluster,
 }
 
 int destroy_ec_profile_and_ruleset(rados_t *cluster,
-                                   std::string ruleset,
+                                   const std::string &ruleset,
                                    std::ostream &oss)
 {
   int ret;
@@ -181,7 +181,7 @@ std::string create_one_pool_pp(const std::string &pool_name, Rados &cluster,
 }
 
 int destroy_ruleset_pp(Rados &cluster,
-                       std::string ruleset,
+                       const std::string &ruleset,
                        std::ostream &oss)
 {
   bufferlist inbl;
@@ -204,7 +204,7 @@ int destroy_ec_profile_pp(Rados &cluster, const std::string& pool_name,
 }
 
 int destroy_ec_profile_and_ruleset_pp(Rados &cluster,
-                                      std::string ruleset,
+                                      const std::string &ruleset,
                                       std::ostream &oss)
 {
   int ret;
index 65f1150db3053f2885070841b94bbc8e67fb632e..20d7fbf78ac654369c60eca8bf35b1e46b555ac4 100644 (file)
@@ -67,7 +67,7 @@ using namespace std;
 #define dout_subsys ceph_subsys_
 #undef dout_prefix
 #define dout_prefix _prefix(_dout, get_name())
-static ostream& _prefix(std::ostream *_dout, string n) {
+static ostream& _prefix(std::ostream *_dout, const string &n) {
   return *_dout << " stub(" << n << ") ";
 }
 
index 2cccadfbfe4537616b9a9ea5e4bb81ba6e15fb3c..b7c66ea793870dda59c0d652b0fb3a20319ea554 100644 (file)
@@ -119,7 +119,7 @@ class MessengerClient {
   vector<ClientThread*> clients;
 
  public:
-  MessengerClient(string t, string addr, int delay):
+  MessengerClient(const string &t, const string &addr, int delay):
       type(t), serveraddr(addr), think_time_us(delay) {
   }
   ~MessengerClient() {
index ff1e5e5f0c94931ad8b5e19d40f472ddb15dd203..87ebb6116aaabdc904b60a763f6217253e3006c7 100644 (file)
@@ -113,7 +113,7 @@ class MessengerServer {
   ServerDispatcher dispatcher;
 
  public:
-  MessengerServer(string t, string addr, int threads, int delay):
+  MessengerServer(const string &t, const string &addr, int threads, int delay):
       msgr(NULL), type(t), bindaddr(addr), dispatcher(threads, delay) {
     msgr = Messenger::create(g_ceph_context, type, entity_name_t::OSD(0), "server", 0, 0);
     msgr->set_default_policy(Messenger::Policy::stateless_server(0));
index 01be5b5d107cb91ab16ba336cb9e33d7b910adc5..81a24c31833cb78b2085e6cc1770654c6f6a0fca 100644 (file)
@@ -940,7 +940,7 @@ class StressFactory {
   bool zero_copy_read;
   SocketOptions options;
 
-  explicit StressFactory(std::shared_ptr<NetworkStack> s, const string &addr,
+  explicit StressFactory(const std::shared_ptr<NetworkStack> &s, const string &addr,
                          size_t cli, size_t qd, size_t mc, size_t l, bool zero_copy)
       : stack(s), rs(128), client_num(cli), queue_depth(qd),
         max_message_length(l), message_count(mc), message_left(mc),
index f105c46e9b0a4f10c6c9aa5332823678eab91290..51e8f73850b4130f29a125263090769c6accfea3 100644 (file)
@@ -76,7 +76,7 @@ test_loop(Rados &cluster, std::string pool_name, std::string obj_name)
 #pragma GCC diagnostic warning "-Wpragmas"
 
 void
-test_replicated(Rados &cluster, std::string pool_name, std::string obj_name)
+test_replicated(Rados &cluster, std::string pool_name, const std::string &obj_name)
 {
   // May already exist
   cluster.pool_create(pool_name.c_str());
@@ -85,7 +85,7 @@ test_replicated(Rados &cluster, std::string pool_name, std::string obj_name)
 }
 
 void
-test_erasure(Rados &cluster, std::string pool_name, std::string obj_name)
+test_erasure(Rados &cluster, const std::string &pool_name, const std::string &obj_name)
 {
   string outs;
   bufferlist inbl;
index 2a76a84c6a66c266c0df3a3e72cdb99cb734dbc2..8bad06fd1c3e9b7c23ab1bcbb93e2edb45cb9f78 100644 (file)
@@ -227,7 +227,7 @@ protected:
 
   void do_matrix(const char *matrix[][10],
                 boost::scoped_ptr<ObjectStore>& store,
-                 MatrixTest fn) {
+                 const MatrixTest &fn) {
     map<string,string> old;
     for (unsigned i=0; matrix[i][0]; ++i) {
       old[matrix[i][0]] = matrix_get(matrix[i][0]);
index ac21e106963d9831ce14217c391c632a51703b2a..78ecc197f6d6311047b3b5376a483bd4c0576935 100644 (file)
@@ -3,7 +3,7 @@
 #include <iostream>
 using namespace std;
 
-int print(string s) {
+int print(const string &s) {
   filepath fp = s;
   cout << "s = " << s << "   filepath = " << fp << endl;
   cout << "  depth " << fp.depth() << endl;
index 9edfcb9856d15a53b26ae5a0dee299437c544cda..3c21541ab7bece78c73413a3894b266ee7012bbd 100644 (file)
@@ -333,7 +333,7 @@ public:
       ContentsGenerator::iterator iter;
 
       ContState(
-       ContDesc _cont,
+       const ContDesc &_cont,
        ceph::shared_ptr<ContentsGenerator> _gen,
        ContentsGenerator::iterator _iter)
        : size(_gen->get_length(_cont)), cont(_cont), gen(_gen), iter(_iter) {
index 6f086ddffae9a93aadd259f3803dce56e5073c8a..6ed7cbd17f20c60a404dde0368f958675854d53a 100644 (file)
@@ -500,7 +500,7 @@ public:
     redirect_objs[oid] = target;
   }
 
-  void update_object_chunk_target(const string &oid, uint64_t offset, ChunkDesc info)
+  void update_object_chunk_target(const string &oid, uint64_t offset, const ChunkDesc &info)
   {
     for (map<int, map<string,ObjectDesc> >::const_reverse_iterator i = 
           pool_obj_cont.rbegin();
@@ -2013,7 +2013,7 @@ public:
   ChunkReadOp(int n,
         RadosTestContext *context,
         const string &oid,
-        string tgt_pool_name,
+        const string &tgt_pool_name,
         bool balance_reads,
         TestOpStat *stat = 0)
     : TestOp(n, context, stat),
index 7d4c1845f6644e004a3c556c7f3740c7ebf98eb4..2c8a9b476db22a83f5d0104996e1facf5485aa0b 100644 (file)
@@ -1318,7 +1318,7 @@ using namespace std;
 struct MapPredicate {
   map<int, pair<PastIntervals::osd_state_t, epoch_t>> states;
   MapPredicate(
-    vector<pair<int, pair<PastIntervals::osd_state_t, epoch_t>>> _states)
+    const vector<pair<int, pair<PastIntervals::osd_state_t, epoch_t>>> &_states)
    : states(_states.begin(), _states.end()) {}
   PastIntervals::osd_state_t operator()(epoch_t start, int osd, epoch_t *lost_at) {
     auto val = states.at(osd);
index 68f16cd82772631a8ee2a751928c6ba677b23036..7c1d19d46df9a317089ec7193bfad5163d14bbb2 100644 (file)
@@ -26,7 +26,7 @@
 
 // XXX: Only tests default namespace
 struct op_data {
-  op_data(std::string oid, uint64_t offset, uint64_t len, bool read)
+  op_data(const std::string &oid, uint64_t offset, uint64_t len, bool read)
     : extent(oid, 0, offset, len, 0), is_read(read)
   {
     extent.oloc.pool = 0;
index b362d241ec7ccc92d6cdbace2e6d3bbd91c98aa1..79490e30d4ae48b0578fce0bae9ab48d187d2987 100644 (file)
@@ -170,7 +170,7 @@ static void calc_hmac_sha1(const char *key, int key_len,
   buf_to_hex((unsigned char *)dest, CEPH_CRYPTO_HMACSHA1_DIGESTSIZE, hex_str);
 }
 
-static int get_s3_auth(string method, string creds, string date, string res, string& out){
+static int get_s3_auth(const string &method, string creds, const string &date, const string &res, string& out){
   string aid, secret, auth_hdr;
   size_t off = creds.find(":");
   out = "";
index de08859b7681b9e3dade72f91cbcf5b0c92f7b06..15e4adfa81255c46092c37b8dca620521cd71da0 100644 (file)
@@ -195,7 +195,7 @@ static void calc_hmac_sha1(const char *key, int key_len,
   admin_log::buf_to_hex((unsigned char *)dest, CEPH_CRYPTO_HMACSHA1_DIGESTSIZE, hex_str);
 }
 
-static int get_s3_auth(string method, string creds, string date, string res, string& out){
+static int get_s3_auth(const string &method, string creds, const string &date, string res, string& out){
   string aid, secret, auth_hdr;
   string tmp_res;
   size_t off = creds.find(":");
index 62b8fe8298f67031ef6c46114a4f903be50f189d..9695a3c6d0c92a20d33e695421d22e79320cbcf9 100644 (file)
@@ -189,7 +189,7 @@ static void calc_hmac_sha1(const char *key, int key_len,
   admin_meta::buf_to_hex((unsigned char *)dest, CEPH_CRYPTO_HMACSHA1_DIGESTSIZE, hex_str);
 }
 
-static int get_s3_auth(string method, string creds, string date, string res, string& out){
+static int get_s3_auth(const string &method, string creds, const string &date, string res, string& out){
   string aid, secret, auth_hdr;
   string tmp_res;
   size_t off = creds.find(":");
index 29ca6a7db272b2099254023dc2c10ce361baa3a4..464bd85a86ab2670a093ead68e3163191f86227a 100644 (file)
@@ -192,7 +192,7 @@ static void calc_hmac_sha1(const char *key, int key_len,
   admin_log::buf_to_hex((unsigned char *)dest, CEPH_CRYPTO_HMACSHA1_DIGESTSIZE, hex_str);
 }
 
-static int get_s3_auth(string method, string creds, string date, string res, string& out){
+static int get_s3_auth(const string &method, string creds, const string &date, string res, string& out){
   string aid, secret, auth_hdr;
   string tmp_res;
   size_t off = creds.find(":");
index 0c0436419b8af1a6b67aa5e4a223e8b0434c000e..166e861269c985b01e47c42cc446c2441061fae7 100644 (file)
@@ -33,7 +33,7 @@ int PgFiles::init()
   return ceph_init(cmount);
 }
 
-PgFiles::PgFiles(Objecter *o, std::set<pg_t> pgs_)
+PgFiles::PgFiles(Objecter *o, const std::set<pg_t> &pgs_)
   : objecter(o), pgs(pgs_)
 {
   for (const auto &i : pgs) {
index a99d5298d1bd4458162434cde0ad41b9b8423695..1ba4b3d28f4ee8a58b311b8db9b83c39dac0f6e3 100644 (file)
@@ -40,7 +40,7 @@ private:
 
 
 public:
-  PgFiles(Objecter *o, std::set<pg_t> pgs_);
+  PgFiles(Objecter *o, const std::set<pg_t> &pgs_);
   ~PgFiles();
 
   int init();
index 61b84d199a9525edb15bfb57119c180ec0482777..6d014e83451d86bf8c08202bd719bed3a557a8a5 100644 (file)
@@ -61,7 +61,7 @@ std::string get_description_prefix(ArgumentModifier modifier) {
 }
 
 void add_special_pool_option(po::options_description *opt,
-                            std::string prefix) {
+                            const std::string &prefix) {
   std::string name = prefix + "-" + POOL_NAME;
   std::string description = prefix + " pool name";
 
index 3ae7a6004d6df087f4cc1f3cefc4e2c4689c9c4a..c97edbddb65a3f1aced024f4b63ca98c8f4bdef0 100644 (file)
@@ -128,7 +128,7 @@ std::string get_description_prefix(ArgumentModifier modifier);
 
 
 void add_special_pool_option(boost::program_options::options_description *opt,
-                            std::string prefix);
+                            const std::string &prefix);
 
 void add_all_option(boost::program_options::options_description *opt,
                    std::string description);
index cbcff9c76a3406eb1f58aacb242577dcc048da4d..12a49eb23ae879e627c3b1df652987e48410d423 100644 (file)
@@ -64,7 +64,7 @@ static std::string map_option_int_cb(const char *value_char)
   return stringify(d);
 }
 
-static void put_map_option(const std::string &key, std::string val)
+static void put_map_option(const std::string &key, const std::string &val)
 {
   map_options[key] = val;
 }
index 15710d7735ae1a58822d0872ea489f5c67150b11..1e612512b5e2b1a220a8f87e1c6408082c2fdc3f 100644 (file)
@@ -20,7 +20,7 @@ namespace po = boost::program_options;
 class RbdWatchCtx : public librados::WatchCtx2 {
 public:
   RbdWatchCtx(librados::IoCtx& io_ctx, const char *image_name,
-              std::string header_oid)
+              const std::string &header_oid)
     : m_io_ctx(io_ctx), m_image_name(image_name), m_header_oid(header_oid)
   {
   }
index a4467fac4a93fef367d8fa965643ecfe388aa23f..32fd216018205036f532324a17684afb0f672df4 100644 (file)
@@ -158,7 +158,7 @@ protected:
   RWLock m_map_lock;        // protects m_map, m_shuffled_timestamp
   InstanceToImageMap m_map; // instance_id -> global_id map
 
-  bool is_dead_instance(const std::string instance_id) {
+  bool is_dead_instance(const std::string &instance_id) {
     assert(m_map_lock.is_locked());
     return m_dead_instances.find(instance_id) != m_dead_instances.end();
   }