Skip to content

Commit

Permalink
mds/FSMap.h: add const and reference
Browse files Browse the repository at this point in the history
Signed-off-by: Michal Jarzabek <[email protected]>
  • Loading branch information
stiopaa1 committed Nov 6, 2016
1 parent ee5a43c commit af7d321
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/mds/FSMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@ class FSMap {
standby_daemons(rhs.standby_daemons),
standby_epochs(rhs.standby_epochs)
{
for (auto &i : rhs.filesystems) {
auto fs = i.second;
for (const auto &i : rhs.filesystems) {
const auto &fs = i.second;
filesystems[fs->fscid] = std::make_shared<Filesystem>(*fs);
}
}
Expand All @@ -148,8 +148,8 @@ class FSMap {
standby_daemons = rhs.standby_daemons;
standby_epochs = rhs.standby_epochs;

for (auto &i : rhs.filesystems) {
auto fs = i.second;
for (const auto &i : rhs.filesystems) {
const auto &fs = i.second;
filesystems[fs->fscid] = std::make_shared<Filesystem>(*fs);
}

Expand Down Expand Up @@ -182,8 +182,8 @@ class FSMap {
}

for (const auto &i : filesystems) {
auto fs_info = i.second->mds_map.get_mds_info();
for (auto j : fs_info) {
const auto &fs_info = i.second->mds_map.get_mds_info();
for (const auto &j : fs_info) {
result[j.first] = j.second;
}
}
Expand Down Expand Up @@ -319,7 +319,7 @@ class FSMap {
assert(info.state == MDSMap::STATE_STANDBY);
standby_epochs[who] = epoch;
} else {
auto fs = filesystems[mds_roles.at(who)];
const auto &fs = filesystems[mds_roles.at(who)];
auto &info = fs->mds_map.mds_info.at(who);
fn(&info);

Expand Down Expand Up @@ -353,7 +353,7 @@ class FSMap {
// but this is a lot simpler because it doesn't require us to
// track the compat versions for standby daemons.
compat = c;
for (auto i : filesystems) {
for (const auto &i : filesystems) {
MDSMap &mds_map = i.second->mds_map;
mds_map.compat = c;
mds_map.epoch = epoch;
Expand Down Expand Up @@ -389,7 +389,7 @@ class FSMap {
std::shared_ptr<const Filesystem> get_filesystem(void) const {return std::const_pointer_cast<const Filesystem>(filesystems.begin()->second);}
std::shared_ptr<const Filesystem> get_filesystem(const std::string &name) const
{
for (auto &i : filesystems) {
for (const auto &i : filesystems) {
if (i.second->mds_map.fs_name == name) {
return std::const_pointer_cast<const Filesystem>(i.second);
}
Expand Down

0 comments on commit af7d321

Please sign in to comment.