From: Rishabh Dave Date: Wed, 4 Oct 2023 18:16:32 +0000 (+0530) Subject: mon/FSCommands: make use of imported namespace symbols X-Git-Tag: v19.0.0~302^2~1 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=c3a2e678c98298e2ed862c0820bff292c53b3553;p=ceph.git mon/FSCommands: make use of imported namespace symbols There's no need to mention the "home" namespace of a symbol while using it after it has been imported into the current namespace. IOW, no need to write, for example, "std::string" after it has been imported from its namespace; instead simply writing "string" will suffice. Signed-off-by: Rishabh Dave --- diff --git a/src/mon/FSCommands.cc b/src/mon/FSCommands.cc index fff2272bfd6d4..a0e76e5b04c46 100644 --- a/src/mon/FSCommands.cc +++ b/src/mon/FSCommands.cc @@ -93,7 +93,7 @@ class FailHandler : public FileSystemCommandHandler return -EAGAIN; } - std::string fs_name; + string fs_name; if (!cmd_getval(cmdmap, "fs_name", fs_name) || fs_name.empty()) { ss << "Missing filesystem name"; return -EINVAL; @@ -110,7 +110,7 @@ class FailHandler : public FileSystemCommandHandler }; fsmap.modify_filesystem(fsp->get_fscid(), std::move(f)); - std::vector to_fail; + vector to_fail; for (const auto& p : fsp->get_mds_map().get_mds_info()) { to_fail.push_back(p.first); } @@ -212,7 +212,7 @@ class FsNewHandler : public FileSystemCommandHandler cmd_getval(cmdmap, "allow_dangerous_metadata_overlay", allow_overlay); for (const auto& [fscid, fs] : std::as_const(fsmap)) { - const std::vector &data_pools = fs.get_mds_map().get_data_pools(); + const vector &data_pools = fs.get_mds_map().get_data_pools(); if ((std::find(data_pools.begin(), data_pools.end(), data) != data_pools.end() || fs.get_mds_map().get_metadata_pool() == metadata) && !allow_overlay) { @@ -314,7 +314,7 @@ public: const cmdmap_t& cmdmap, std::ostream &ss) override { - std::string fs_name; + string fs_name; if (!cmd_getval(cmdmap, "fs_name", fs_name) || fs_name.empty()) { ss << "Missing filesystem name"; return -EINVAL; @@ -417,7 +417,7 @@ public: } if (fsp->get_mds_map().check_special_bal_rank_mask(val, MDSMap::BAL_RANK_MASK_TYPE_ANY) == false) { - std::string bin_string; + string bin_string; int r = fsp->get_mds_map().hex2bin(val, bin_string, MAX_MDS, ss); if (r != 0) { return r; @@ -641,7 +641,7 @@ public: mon->osdmon()->wait_for_writeable(op, new PaxosService::C_RetryMessage(mon->mdsmon(), op)); return -EAGAIN; } - std::vector to_fail; + vector to_fail; for (const auto& [gid, info]: fsp->get_mds_map().get_mds_info()) { if (info.state == MDSMap::STATE_STANDBY_REPLAY) { to_fail.push_back(gid); @@ -766,9 +766,9 @@ class CompatSetHandler : public FileSystemCommandHandler const cmdmap_t& cmdmap, std::ostream &ss) override { - static const std::set subops = {"rm_incompat", "rm_compat", "add_incompat", "add_compat"}; + static const set subops = {"rm_incompat", "rm_compat", "add_incompat", "add_compat"}; - std::string fs_name; + string fs_name; if (!cmd_getval(cmdmap, "fs_name", fs_name) || fs_name.empty()) { ss << "Missing filesystem name"; return -EINVAL; @@ -871,7 +871,7 @@ class RequiredClientFeaturesHandler : public FileSystemCommandHandler const cmdmap_t& cmdmap, std::ostream &ss) override { - std::string fs_name; + string fs_name; if (!cmd_getval(cmdmap, "fs_name", fs_name) || fs_name.empty()) { ss << "Missing filesystem name"; return -EINVAL; @@ -964,7 +964,7 @@ class AddDataPoolHandler : public FileSystemCommandHandler string poolname; cmd_getval(cmdmap, "pool", poolname); - std::string fs_name; + string fs_name; if (!cmd_getval(cmdmap, "fs_name", fs_name) || fs_name.empty()) { ss << "Missing filesystem name"; @@ -1038,7 +1038,7 @@ class SetDefaultHandler : public FileSystemCommandHandler const cmdmap_t& cmdmap, std::ostream &ss) override { - std::string fs_name; + string fs_name; cmd_getval(cmdmap, "fs_name", fs_name); auto* fsp = fsmap.get_filesystem(fs_name); if (fsp == nullptr) { @@ -1103,7 +1103,7 @@ class RemoveFilesystemHandler : public FileSystemCommandHandler fsmap.set_legacy_client_fscid(FS_CLUSTER_ID_NONE); } - std::vector to_fail; + vector to_fail; // There may be standby_replay daemons left here for (const auto &i : fsp->get_mds_map().get_mds_info()) { ceph_assert(i.second.state == MDSMap::STATE_STANDBY_REPLAY); @@ -1277,7 +1277,7 @@ class RemoveDataPoolHandler : public FileSystemCommandHandler string poolname; cmd_getval(cmdmap, "pool", poolname); - std::string fs_name; + string fs_name; if (!cmd_getval(cmdmap, "fs_name", fs_name) || fs_name.empty()) { ss << "Missing filesystem name"; @@ -1336,16 +1336,16 @@ class RemoveDataPoolHandler : public FileSystemCommandHandler template class AliasHandler : public T { - std::string alias_prefix; + string alias_prefix; public: - explicit AliasHandler(const std::string &new_prefix) + explicit AliasHandler(const string &new_prefix) : T() { alias_prefix = new_prefix; } - std::string const &get_prefix() const override {return alias_prefix;} + string const &get_prefix() const override {return alias_prefix;} int handle( Monitor *mon, @@ -1368,7 +1368,7 @@ public: int handle(Monitor *mon, FSMap &fsmap, MonOpRequestRef op, const cmdmap_t& cmdmap, std::ostream &ss) override { - std::string fs_name; + string fs_name; if (!cmd_getval(cmdmap, "fs_name", fs_name) || fs_name.empty()) { ss << "Missing filesystem name"; return -EINVAL; @@ -1403,7 +1403,7 @@ public: int handle(Monitor *mon, FSMap &fsmap, MonOpRequestRef op, const cmdmap_t& cmdmap, std::ostream &ss) override { - std::string fs_name; + string fs_name; if (!cmd_getval(cmdmap, "fs_name", fs_name) || fs_name.empty()) { ss << "Missing filesystem name"; return -EINVAL; @@ -1435,17 +1435,17 @@ public: : FileSystemCommandHandler("fs mirror peer_add") {} - boost::optional> - extract_remote_cluster_conf(const std::string &spec) { + boost::optional> + extract_remote_cluster_conf(const string &spec) { auto pos = spec.find("@"); - if (pos == std::string_view::npos) { - return boost::optional>(); + if (pos == string_view::npos) { + return boost::optional>(); } auto client = spec.substr(0, pos); auto cluster = spec.substr(pos+1); - return std::make_pair(client, cluster); + return make_pair(client, cluster); } bool peer_add(FSMap &fsmap, const Filesystem& fs, @@ -1485,7 +1485,7 @@ public: int handle(Monitor *mon, FSMap &fsmap, MonOpRequestRef op, const cmdmap_t& cmdmap, std::ostream &ss) override { - std::string fs_name; + string fs_name; if (!cmd_getval(cmdmap, "fs_name", fs_name) || fs_name.empty()) { ss << "Missing filesystem name"; return -EINVAL; @@ -1538,7 +1538,7 @@ public: int handle(Monitor *mon, FSMap &fsmap, MonOpRequestRef op, const cmdmap_t& cmdmap, std::ostream &ss) override { - std::string fs_name; + string fs_name; if (!cmd_getval(cmdmap, "fs_name", fs_name) || fs_name.empty()) { ss << "Missing filesystem name"; return -EINVAL; @@ -1564,10 +1564,10 @@ public: } }; -std::list > +list > FileSystemCommandHandler::load(Paxos *paxos) { - std::list > handlers; + list > handlers; handlers.push_back(std::make_shared()); handlers.push_back(std::make_shared());