summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGreg Farnum <greg@inktank.com>2013-04-11 17:42:59 -0700
committerGreg Farnum <greg@inktank.com>2013-04-11 17:42:59 -0700
commitf875c0c9138ecfd76d6fd04132e697d4a60bd1a3 (patch)
treeb8ee2637b8a7b8144aedd35eeae32bc6774e5d40
parent9c18fd6735916303d76fcac66c155634133fc1c3 (diff)
downloadceph-f875c0c9138ecfd76d6fd04132e697d4a60bd1a3.tar.gz
mds: only go through the max_size change rigamarole if the client requested it
The previous patch was forcing a new size change even if we were doing it as part of our regular optimistic settings; we don't much want to do that. This is a small optimization, but Sage asked for it and it's very easy. Signed-off-by: Greg Farnum <greg@inktank.com>
-rw-r--r--src/mds/Locker.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/mds/Locker.cc b/src/mds/Locker.cc
index ea923c3eba1..56bd47654ca 100644
--- a/src/mds/Locker.cc
+++ b/src/mds/Locker.cc
@@ -2731,6 +2731,7 @@ bool Locker::_do_cap_update(CInode *in, Capability *cap,
// increase or zero max_size?
uint64_t size = m->get_size();
bool change_max = false;
+ bool forced_change_max = false;
uint64_t old_max = latest->client_ranges.count(client) ? latest->client_ranges[client].range.last : 0;
uint64_t new_max = old_max;
@@ -2743,6 +2744,7 @@ bool Locker::_do_cap_update(CInode *in, Capability *cap,
dout(10) << "client requests file_max " << m->get_max_size()
<< " > max " << old_max << dendl;
change_max = true;
+ forced_change_max = true;
new_max = ROUND_UP_TO((m->get_max_size()+1) << 1, latest->get_layout_size_increment());
} else {
new_max = calc_bounding(size * 2);
@@ -2783,7 +2785,8 @@ bool Locker::_do_cap_update(CInode *in, Capability *cap,
!in->filelock.can_force_wrlock(client)) {
C_MDL_CheckMaxSize *cms = new C_MDL_CheckMaxSize(this, in,
false, 0,
- change_max, new_max,
+ forced_change_max,
+ new_max,
utime_t());
in->filelock.add_waiter(SimpleLock::WAIT_STABLE, cms);