Skip to content

Commit

Permalink
mds/SnapRealm: remove unneeded use of count
Browse files Browse the repository at this point in the history
Signed-off-by: Michal Jarzabek <[email protected]>
  • Loading branch information
stiopaa1 committed Oct 22, 2016
1 parent 62d8e60 commit e710e5a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
7 changes: 4 additions & 3 deletions src/mds/SnapRealm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -332,11 +332,12 @@ void SnapRealm::get_snap_info(map<snapid_t,SnapInfo*>& infomap, snapid_t first,

const string& SnapRealm::get_snapname(snapid_t snapid, inodeno_t atino)
{
if (srnode.snaps.count(snapid)) {
auto srnode_snaps_entry = srnode.snaps.find(snapid);
if (srnode_snaps_entry != srnode.snaps.end()) {
if (atino == inode->ino())
return srnode.snaps[snapid].name;
return srnode_snaps_entry->second.name;
else
return srnode.snaps[snapid].get_long_name();
return srnode_snaps_entry->second.get_long_name();
}

map<snapid_t,snaplink_t>::iterator p = srnode.past_parents.lower_bound(snapid);
Expand Down
8 changes: 5 additions & 3 deletions src/mds/SnapRealm.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,11 @@ struct SnapRealm {
void join(SnapRealm *child);

void add_cap(client_t client, Capability *cap) {
if (client_caps.count(client) == 0)
client_caps[client] = new xlist<Capability*>;
client_caps[client]->push_back(&cap->item_snaprealm_caps);
auto client_caps_entry = client_caps.find(client);
if (client_caps_entry == client_caps.end())
client_caps_entry = client_caps.emplace(client,
new xlist<Capability*>).first;
client_caps_entry->second->push_back(&cap->item_snaprealm_caps);
}
void remove_cap(client_t client, Capability *cap) {
cap->item_snaprealm_caps.remove_myself();
Expand Down

0 comments on commit e710e5a

Please sign in to comment.