2222
2323using TOPNSPC::common::cmd_getval;
2424
25- using std::dec;
26- using std::hex;
2725using std::list;
28- using std::map;
2926using std::make_pair;
3027using std::pair;
3128using std::set;
3229using std::string;
33- using std::to_string ;
30+ using std::string_view ;
3431using std::vector;
32+ using std::ostream;
3533
36- using ceph::bufferlist;
37- using ceph::decode;
38- using ceph::encode;
39- using ceph::ErasureCodeInterfaceRef;
40- using ceph::ErasureCodeProfile;
41- using ceph::Formatter;
42- using ceph::JSONFormatter;
43- using ceph::make_message;
44- using ceph::mono_clock;
45- using ceph::mono_time;
4634
4735class FlagSetHandler : public FileSystemCommandHandler
4836{
@@ -57,7 +45,7 @@ class FlagSetHandler : public FileSystemCommandHandler
5745 FSMap& fsmap,
5846 MonOpRequestRef op,
5947 const cmdmap_t & cmdmap,
60- std:: ostream &ss) override
48+ ostream &ss) override
6149 {
6250 string flag_name;
6351 cmd_getval (cmdmap, " flag_name" , flag_name);
@@ -98,15 +86,15 @@ class FailHandler : public FileSystemCommandHandler
9886 FSMap& fsmap,
9987 MonOpRequestRef op,
10088 const cmdmap_t & cmdmap,
101- std:: ostream& ss) override
89+ ostream& ss) override
10290 {
10391 if (!mon->osdmon ()->is_writeable ()) {
10492 // not allowed to write yet, so retry when we can
10593 mon->osdmon ()->wait_for_writeable (op, new PaxosService::C_RetryMessage (mon->mdsmon (), op));
10694 return -EAGAIN;
10795 }
10896
109- std:: string fs_name;
97+ string fs_name;
11098 if (!cmd_getval (cmdmap, " fs_name" , fs_name) || fs_name.empty ()) {
11199 ss << " Missing filesystem name" ;
112100 return -EINVAL;
@@ -123,7 +111,7 @@ class FailHandler : public FileSystemCommandHandler
123111 };
124112 fsmap.modify_filesystem (fsp->get_fscid (), std::move (f));
125113
126- std:: vector<mds_gid_t > to_fail;
114+ vector<mds_gid_t > to_fail;
127115 for (const auto & p : fsp->get_mds_map ().get_mds_info ()) {
128116 to_fail.push_back (p.first );
129117 }
@@ -155,7 +143,7 @@ class FsNewHandler : public FileSystemCommandHandler
155143 FSMap& fsmap,
156144 MonOpRequestRef op,
157145 const cmdmap_t & cmdmap,
158- std:: ostream &ss) override
146+ ostream &ss) override
159147 {
160148 ceph_assert (m_paxos->is_plugged ());
161149
@@ -225,7 +213,7 @@ class FsNewHandler : public FileSystemCommandHandler
225213 cmd_getval (cmdmap, " allow_dangerous_metadata_overlay" , allow_overlay);
226214
227215 for (const auto & [fscid, fs] : std::as_const (fsmap)) {
228- const std:: vector<int64_t > &data_pools = fs.get_mds_map ().get_data_pools ();
216+ const vector<int64_t > &data_pools = fs.get_mds_map ().get_data_pools ();
229217 if ((std::find (data_pools.begin (), data_pools.end (), data) != data_pools.end ()
230218 || fs.get_mds_map ().get_metadata_pool () == metadata)
231219 && !allow_overlay) {
@@ -325,9 +313,9 @@ class SetHandler : public FileSystemCommandHandler
325313 FSMap& fsmap,
326314 MonOpRequestRef op,
327315 const cmdmap_t & cmdmap,
328- std:: ostream &ss) override
316+ ostream &ss) override
329317 {
330- std:: string fs_name;
318+ string fs_name;
331319 if (!cmd_getval (cmdmap, " fs_name" , fs_name) || fs_name.empty ()) {
332320 ss << " Missing filesystem name" ;
333321 return -EINVAL;
@@ -430,7 +418,7 @@ class SetHandler : public FileSystemCommandHandler
430418 }
431419
432420 if (fsp->get_mds_map ().check_special_bal_rank_mask (val, MDSMap::BAL_RANK_MASK_TYPE_ANY) == false ) {
433- std:: string bin_string;
421+ string bin_string;
434422 int r = fsp->get_mds_map ().hex2bin (val, bin_string, MAX_MDS, ss);
435423 if (r != 0 ) {
436424 return r;
@@ -654,7 +642,7 @@ class SetHandler : public FileSystemCommandHandler
654642 mon->osdmon ()->wait_for_writeable (op, new PaxosService::C_RetryMessage (mon->mdsmon (), op));
655643 return -EAGAIN;
656644 }
657- std:: vector<mds_gid_t > to_fail;
645+ vector<mds_gid_t > to_fail;
658646 for (const auto & [gid, info]: fsp->get_mds_map ().get_mds_info ()) {
659647 if (info.state == MDSMap::STATE_STANDBY_REPLAY) {
660648 to_fail.push_back (gid);
@@ -777,11 +765,11 @@ class CompatSetHandler : public FileSystemCommandHandler
777765 FSMap &fsmap,
778766 MonOpRequestRef op,
779767 const cmdmap_t & cmdmap,
780- std:: ostream &ss) override
768+ ostream &ss) override
781769 {
782- static const std:: set<std:: string> subops = {" rm_incompat" , " rm_compat" , " add_incompat" , " add_compat" };
770+ static const set<string> subops = {" rm_incompat" , " rm_compat" , " add_incompat" , " add_compat" };
783771
784- std:: string fs_name;
772+ string fs_name;
785773 if (!cmd_getval (cmdmap, " fs_name" , fs_name) || fs_name.empty ()) {
786774 ss << " Missing filesystem name" ;
787775 return -EINVAL;
@@ -882,9 +870,9 @@ class RequiredClientFeaturesHandler : public FileSystemCommandHandler
882870 FSMap &fsmap,
883871 MonOpRequestRef op,
884872 const cmdmap_t & cmdmap,
885- std:: ostream &ss) override
873+ ostream &ss) override
886874 {
887- std:: string fs_name;
875+ string fs_name;
888876 if (!cmd_getval (cmdmap, " fs_name" , fs_name) || fs_name.empty ()) {
889877 ss << " Missing filesystem name" ;
890878 return -EINVAL;
@@ -970,14 +958,14 @@ class AddDataPoolHandler : public FileSystemCommandHandler
970958 FSMap& fsmap,
971959 MonOpRequestRef op,
972960 const cmdmap_t & cmdmap,
973- std:: ostream &ss) override
961+ ostream &ss) override
974962 {
975963 ceph_assert (m_paxos->is_plugged ());
976964
977965 string poolname;
978966 cmd_getval (cmdmap, " pool" , poolname);
979967
980- std:: string fs_name;
968+ string fs_name;
981969 if (!cmd_getval (cmdmap, " fs_name" , fs_name)
982970 || fs_name.empty ()) {
983971 ss << " Missing filesystem name" ;
@@ -1049,9 +1037,9 @@ class SetDefaultHandler : public FileSystemCommandHandler
10491037 FSMap& fsmap,
10501038 MonOpRequestRef op,
10511039 const cmdmap_t & cmdmap,
1052- std:: ostream &ss) override
1040+ ostream &ss) override
10531041 {
1054- std:: string fs_name;
1042+ string fs_name;
10551043 cmd_getval (cmdmap, " fs_name" , fs_name);
10561044 auto * fsp = fsmap.get_filesystem (fs_name);
10571045 if (fsp == nullptr ) {
@@ -1076,7 +1064,7 @@ class RemoveFilesystemHandler : public FileSystemCommandHandler
10761064 FSMap& fsmap,
10771065 MonOpRequestRef op,
10781066 const cmdmap_t & cmdmap,
1079- std:: ostream &ss) override
1067+ ostream &ss) override
10801068 {
10811069 /* We may need to blocklist ranks. */
10821070 if (!mon->osdmon ()->is_writeable ()) {
@@ -1116,7 +1104,7 @@ class RemoveFilesystemHandler : public FileSystemCommandHandler
11161104 fsmap.set_legacy_client_fscid (FS_CLUSTER_ID_NONE);
11171105 }
11181106
1119- std:: vector<mds_gid_t > to_fail;
1107+ vector<mds_gid_t > to_fail;
11201108 // There may be standby_replay daemons left here
11211109 for (const auto &i : fsp->get_mds_map ().get_mds_info ()) {
11221110 ceph_assert (i.second .state == MDSMap::STATE_STANDBY_REPLAY);
@@ -1150,7 +1138,7 @@ class ResetFilesystemHandler : public FileSystemCommandHandler
11501138 FSMap& fsmap,
11511139 MonOpRequestRef op,
11521140 const cmdmap_t & cmdmap,
1153- std:: ostream &ss) override
1141+ ostream &ss) override
11541142 {
11551143 string fs_name;
11561144 cmd_getval (cmdmap, " fs_name" , fs_name);
@@ -1196,7 +1184,7 @@ class RenameFilesystemHandler : public FileSystemCommandHandler
11961184 FSMap& fsmap,
11971185 MonOpRequestRef op,
11981186 const cmdmap_t & cmdmap,
1199- std:: ostream &ss) override
1187+ ostream &ss) override
12001188 {
12011189 ceph_assert (m_paxos->is_plugged ());
12021190
@@ -1285,12 +1273,12 @@ class RemoveDataPoolHandler : public FileSystemCommandHandler
12851273 FSMap& fsmap,
12861274 MonOpRequestRef op,
12871275 const cmdmap_t & cmdmap,
1288- std:: ostream &ss) override
1276+ ostream &ss) override
12891277 {
12901278 string poolname;
12911279 cmd_getval (cmdmap, " pool" , poolname);
12921280
1293- std:: string fs_name;
1281+ string fs_name;
12941282 if (!cmd_getval (cmdmap, " fs_name" , fs_name)
12951283 || fs_name.empty ()) {
12961284 ss << " Missing filesystem name" ;
@@ -1349,23 +1337,23 @@ class RemoveDataPoolHandler : public FileSystemCommandHandler
13491337template <typename T>
13501338class AliasHandler : public T
13511339{
1352- std:: string alias_prefix;
1340+ string alias_prefix;
13531341
13541342 public:
1355- explicit AliasHandler (const std:: string &new_prefix)
1343+ explicit AliasHandler (const string &new_prefix)
13561344 : T()
13571345 {
13581346 alias_prefix = new_prefix;
13591347 }
13601348
1361- std:: string const &get_prefix () const override {return alias_prefix;}
1349+ string const &get_prefix () const override {return alias_prefix;}
13621350
13631351 int handle (
13641352 Monitor *mon,
13651353 FSMap& fsmap,
13661354 MonOpRequestRef op,
13671355 const cmdmap_t & cmdmap,
1368- std:: ostream &ss) override
1356+ ostream &ss) override
13691357 {
13701358 return T::handle (mon, fsmap, op, cmdmap, ss);
13711359 }
@@ -1380,8 +1368,8 @@ class MirrorHandlerEnable : public FileSystemCommandHandler
13801368
13811369 int handle (Monitor *mon,
13821370 FSMap &fsmap, MonOpRequestRef op,
1383- const cmdmap_t & cmdmap, std:: ostream &ss) override {
1384- std:: string fs_name;
1371+ const cmdmap_t & cmdmap, ostream &ss) override {
1372+ string fs_name;
13851373 if (!cmd_getval (cmdmap, " fs_name" , fs_name) || fs_name.empty ()) {
13861374 ss << " Missing filesystem name" ;
13871375 return -EINVAL;
@@ -1415,8 +1403,8 @@ class MirrorHandlerDisable : public FileSystemCommandHandler
14151403
14161404 int handle (Monitor *mon,
14171405 FSMap &fsmap, MonOpRequestRef op,
1418- const cmdmap_t & cmdmap, std:: ostream &ss) override {
1419- std:: string fs_name;
1406+ const cmdmap_t & cmdmap, ostream &ss) override {
1407+ string fs_name;
14201408 if (!cmd_getval (cmdmap, " fs_name" , fs_name) || fs_name.empty ()) {
14211409 ss << " Missing filesystem name" ;
14221410 return -EINVAL;
@@ -1448,21 +1436,21 @@ class MirrorHandlerAddPeer : public FileSystemCommandHandler
14481436 : FileSystemCommandHandler(" fs mirror peer_add" )
14491437 {}
14501438
1451- boost::optional<std:: pair<string, string>>
1452- extract_remote_cluster_conf (const std:: string &spec) {
1439+ boost::optional<pair<string, string>>
1440+ extract_remote_cluster_conf (const string &spec) {
14531441 auto pos = spec.find (" @" );
1454- if (pos == std:: string_view::npos) {
1455- return boost::optional<std:: pair<string, string>>();
1442+ if (pos == string_view::npos) {
1443+ return boost::optional<pair<string, string>>();
14561444 }
14571445
14581446 auto client = spec.substr (0 , pos);
14591447 auto cluster = spec.substr (pos+1 );
14601448
1461- return std:: make_pair (client, cluster);
1449+ return make_pair (client, cluster);
14621450 }
14631451
14641452 bool peer_add (FSMap &fsmap, const Filesystem& fs,
1465- const cmdmap_t &cmdmap, std:: ostream &ss) {
1453+ const cmdmap_t &cmdmap, ostream &ss) {
14661454 string peer_uuid;
14671455 string remote_spec;
14681456 string remote_fs_name;
@@ -1497,8 +1485,8 @@ class MirrorHandlerAddPeer : public FileSystemCommandHandler
14971485
14981486 int handle (Monitor *mon,
14991487 FSMap &fsmap, MonOpRequestRef op,
1500- const cmdmap_t & cmdmap, std:: ostream &ss) override {
1501- std:: string fs_name;
1488+ const cmdmap_t & cmdmap, ostream &ss) override {
1489+ string fs_name;
15021490 if (!cmd_getval (cmdmap, " fs_name" , fs_name) || fs_name.empty ()) {
15031491 ss << " Missing filesystem name" ;
15041492 return -EINVAL;
@@ -1532,7 +1520,7 @@ class MirrorHandlerRemovePeer : public FileSystemCommandHandler
15321520 {}
15331521
15341522 bool peer_remove (FSMap &fsmap, const Filesystem& fs,
1535- const cmdmap_t &cmdmap, std:: ostream &ss) {
1523+ const cmdmap_t &cmdmap, ostream &ss) {
15361524 string peer_uuid;
15371525 cmd_getval (cmdmap, " uuid" , peer_uuid);
15381526
@@ -1550,8 +1538,8 @@ class MirrorHandlerRemovePeer : public FileSystemCommandHandler
15501538
15511539 int handle (Monitor *mon,
15521540 FSMap &fsmap, MonOpRequestRef op,
1553- const cmdmap_t & cmdmap, std:: ostream &ss) override {
1554- std:: string fs_name;
1541+ const cmdmap_t & cmdmap, ostream &ss) override {
1542+ string fs_name;
15551543 if (!cmd_getval (cmdmap, " fs_name" , fs_name) || fs_name.empty ()) {
15561544 ss << " Missing filesystem name" ;
15571545 return -EINVAL;
@@ -1577,10 +1565,10 @@ class MirrorHandlerRemovePeer : public FileSystemCommandHandler
15771565 }
15781566};
15791567
1580- std:: list<std::shared_ptr<FileSystemCommandHandler> >
1568+ list<std::shared_ptr<FileSystemCommandHandler> >
15811569FileSystemCommandHandler::load (Paxos *paxos)
15821570{
1583- std:: list<std::shared_ptr<FileSystemCommandHandler> > handlers;
1571+ list<std::shared_ptr<FileSystemCommandHandler> > handlers;
15841572
15851573 handlers.push_back (std::make_shared<SetHandler>());
15861574 handlers.push_back (std::make_shared<FailHandler>());
@@ -1610,7 +1598,7 @@ int FileSystemCommandHandler::_check_pool(
16101598 const int64_t pool_id,
16111599 int type,
16121600 bool force,
1613- std:: ostream *ss,
1601+ ostream *ss,
16141602 bool allow_overlay) const
16151603{
16161604 ceph_assert (ss != NULL );
@@ -1718,7 +1706,7 @@ int FileSystemCommandHandler::_check_pool(
17181706
17191707int FileSystemCommandHandler::is_op_allowed (
17201708 const MonOpRequestRef& op, const FSMap& fsmap, const cmdmap_t & cmdmap,
1721- std:: ostream &ss) const
1709+ ostream &ss) const
17221710{
17231711 string fs_name;
17241712 cmd_getval (cmdmap, " fs_name" , fs_name);
0 commit comments