Skip to content

Commit

Permalink
mds: Using stl min | max, MIN | MAX macros instead
Browse files Browse the repository at this point in the history
Signed-off-by: Shinobu Kinjo <[email protected]>
  • Loading branch information
shinobu-x committed Jan 3, 2018
1 parent 24bc418 commit cf322e6
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/mds/MDBalancer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ double MDBalancer::try_match(balance_state_t& state, mds_rank_t ex, double& maxe
{
if (maxex <= 0 || maxim <= 0) return 0.0;

double howmuch = MIN(maxex, maxim);
double howmuch = std::min(maxex, maxim);
if (howmuch <= 0) return 0.0;

dout(5) << " - mds." << ex << " exports " << howmuch << " to mds." << im << dendl;
Expand Down
2 changes: 1 addition & 1 deletion src/mds/MDCache.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5465,7 +5465,7 @@ void MDCache::rebuild_need_snapflush(CInode *head_in, SnapRealm *realm,
break;

bool need_snapflush = false;
for (auto p = snaps.lower_bound(MAX(in->first, (snapid_t)(follows + 1)));
for (auto p = snaps.lower_bound(std::max<snapid_t>(in->first, (follows + 1)));
p != snaps.end() && *p <= in->last;
++p) {
head_in->add_need_snapflush(in, *p, client);
Expand Down
16 changes: 8 additions & 8 deletions src/mds/Server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1125,7 +1125,7 @@ void Server::recall_client_state(void)
<< ", leases " << session->leases.size()
<< dendl;

uint64_t newlim = MAX(MIN((session->caps.size() * ratio), max_caps_per_client), min_caps_per_client);
uint64_t newlim = std::max(std::min<uint64_t>((session->caps.size() * ratio), max_caps_per_client), min_caps_per_client);
if (session->caps.size() > newlim) {
MClientSession *m = new MClientSession(CEPH_SESSION_RECALL_STATE);
m->head.max_caps = newlim;
Expand Down Expand Up @@ -4138,7 +4138,7 @@ void Server::handle_client_setattr(MDRequestRef& mdr)
// trunc from bigger -> smaller?
inode_t *pi = cur->get_projected_inode();

uint64_t old_size = MAX(pi->size, req->head.args.setattr.old_size);
uint64_t old_size = std::max<uint64_t>(pi->size, req->head.args.setattr.old_size);

// ENOSPC on growing file while full, but allow shrinks
if (is_full && req->head.args.setattr.size > old_size) {
Expand Down Expand Up @@ -4251,7 +4251,7 @@ void Server::do_open_truncate(MDRequestRef& mdr, int cmode)
pi->mtime = pi->ctime = mdr->get_op_stamp();
pi->change_attr++;

uint64_t old_size = MAX(pi->size, mdr->client_request->head.args.open.old_size);
uint64_t old_size = std::max<uint64_t>(pi->size, mdr->client_request->head.args.open.old_size);
if (old_size > 0) {
pi->truncate(old_size, 0);
le->metablob.add_truncate_start(in->ino());
Expand Down Expand Up @@ -5976,7 +5976,7 @@ void Server::handle_client_unlink(MDRequestRef& mdr)
SnapRealm *realm = in->find_snaprealm();
snapid_t follows = realm->get_newest_seq();
if (straydn)
straydn->first = MAX((uint64_t)in->first, follows + 1);
straydn->first = std::max<uint64_t>(in->first, follows + 1);

// yay!
if (in->is_dir() && in->has_subtree_root_dirfrag()) {
Expand Down Expand Up @@ -7296,7 +7296,7 @@ void Server::_rename_prepare(MDRequestRef& mdr,

SnapRealm *src_realm = srci->find_snaprealm();
SnapRealm *dest_realm = destdn->get_dir()->inode->find_snaprealm();
snapid_t next_dest_snap = MAX(dest_realm->get_newest_seq(), src_realm->get_newest_seq()) + 1;
snapid_t next_dest_snap = std::max(dest_realm->get_newest_seq(), src_realm->get_newest_seq()) + 1;

// add it all to the metablob
// target inode
Expand All @@ -7307,7 +7307,7 @@ void Server::_rename_prepare(MDRequestRef& mdr,
// project snaprealm, too
if (oldin->snaprealm || dest_realm->get_newest_seq() + 1 > oldin->get_oldest_snap())
oldin->project_past_snaprealm_parent(straydn->get_dir()->inode->find_snaprealm());
straydn->first = MAX((uint64_t)oldin->first, dest_realm->get_newest_seq() + 1);
straydn->first = std::max<uint64_t>(oldin->first, dest_realm->get_newest_seq() + 1);
metablob->add_primary_dentry(straydn, oldin, true, true);
} else if (force_journal_stray) {
dout(10) << " forced journaling straydn " << *straydn << dendl;
Expand Down Expand Up @@ -7345,7 +7345,7 @@ void Server::_rename_prepare(MDRequestRef& mdr,
mdcache->journal_cow_dentry(mdr.get(), metablob, destdn, CEPH_NOSNAP, 0, destdnl);
else
// FIXME: stray reintegration, do we need to update destdn->first?
destdn->first = MAX(destdn->first, next_dest_snap);
destdn->first = std::max(destdn->first, next_dest_snap);

if (destdn->is_auth())
metablob->add_primary_dentry(destdn, destdnl->get_inode(), true, true);
Expand All @@ -7359,7 +7359,7 @@ void Server::_rename_prepare(MDRequestRef& mdr,
if (destdn->is_auth() && !destdnl->is_null())
mdcache->journal_cow_dentry(mdr.get(), metablob, destdn, CEPH_NOSNAP, 0, destdnl);

destdn->first = MAX(srci->first, next_dest_snap);
destdn->first = std::max(srci->first, next_dest_snap);

if (destdn->is_auth())
metablob->add_primary_dentry(destdn, srci, true, true);
Expand Down
2 changes: 1 addition & 1 deletion src/mds/inode_backtrace.cc
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ void inode_backtrace_t::generate_test_instances(list<inode_backtrace_t*>& ls)
int inode_backtrace_t::compare(const inode_backtrace_t& other,
bool *equivalent, bool *divergent) const
{
int min_size = MIN(ancestors.size(),other.ancestors.size());
int min_size = std::min(ancestors.size(),other.ancestors.size());
*equivalent = true;
*divergent = false;
if (min_size == 0)
Expand Down

0 comments on commit cf322e6

Please sign in to comment.