summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGreg Farnum <greg@inktank.com>2013-04-18 10:39:03 -0700
committerGreg Farnum <greg@inktank.com>2013-04-18 10:39:03 -0700
commitefbe2e8b55ba735673a3fdb925a6304915f333d8 (patch)
treee5134c176711a89e03b0c222b4b1e4ee8417bef1
parent87634d882fda80c4a2e3705c83a38bdfd613763f (diff)
parent7b408ece37cb20452539642c0cc5e2dae9114b4f (diff)
downloadceph-efbe2e8b55ba735673a3fdb925a6304915f333d8.tar.gz
Merge branch 'wip-max_size-3637' into next
Reviewed-by: Sage Weil <sage@inktank.com>
-rw-r--r--src/common/config_opts.h2
-rw-r--r--src/mds/Locker.cc50
-rw-r--r--src/mds/Locker.h4
-rw-r--r--src/mds/MDCache.cc2
4 files changed, 47 insertions, 11 deletions
diff --git a/src/common/config_opts.h b/src/common/config_opts.h
index 3a9cfd70827..2658c2d8785 100644
--- a/src/common/config_opts.h
+++ b/src/common/config_opts.h
@@ -231,7 +231,7 @@ OPTION(client_oc_max_objects, OPT_INT, 1000) // max objects in cache
OPTION(client_debug_force_sync_read, OPT_BOOL, false) // always read synchronously (go to osds)
OPTION(client_debug_inject_tick_delay, OPT_INT, 0) // delay the client tick for a number of seconds
// note: the max amount of "in flight" dirty data is roughly (max - target)
-OPTION(fuse_use_invalidate_cb, OPT_BOOL, true) // use fuse 2.8+ invalidate callback to keep page cache consistent
+OPTION(fuse_use_invalidate_cb, OPT_BOOL, false) // use fuse 2.8+ invalidate callback to keep page cache consistent
OPTION(fuse_allow_other, OPT_BOOL, true)
OPTION(fuse_default_permissions, OPT_BOOL, true)
OPTION(fuse_big_writes, OPT_BOOL, true)
diff --git a/src/mds/Locker.cc b/src/mds/Locker.cc
index bdf346a31e1..c5ddb92d93e 100644
--- a/src/mds/Locker.cc
+++ b/src/mds/Locker.cc
@@ -1961,14 +1961,27 @@ void Locker::handle_inode_file_caps(MInodeFileCaps *m)
class C_MDL_CheckMaxSize : public Context {
Locker *locker;
CInode *in;
+ bool update_size;
+ uint64_t newsize;
+ bool update_max;
+ uint64_t new_max_size;
+ utime_t mtime;
+
public:
- C_MDL_CheckMaxSize(Locker *l, CInode *i) : locker(l), in(i) {
+ C_MDL_CheckMaxSize(Locker *l, CInode *i, bool _update_size, uint64_t _newsize,
+ bool _update_max, uint64_t _new_max_size, utime_t _mtime) :
+ locker(l), in(i),
+ update_size(_update_size), newsize(_newsize),
+ update_max(_update_max), new_max_size(_new_max_size),
+ mtime(_mtime)
+ {
in->get(CInode::PIN_PTRWAITER);
}
void finish(int r) {
in->put(CInode::PIN_PTRWAITER);
if (in->is_auth())
- locker->check_inode_max_size(in);
+ locker->check_inode_max_size(in, false, update_size, newsize,
+ update_max, new_max_size, mtime);
}
};
@@ -2000,7 +2013,9 @@ void Locker::calc_new_client_ranges(CInode *in, uint64_t size, map<client_t,clie
}
bool Locker::check_inode_max_size(CInode *in, bool force_wrlock,
- bool update_size, uint64_t new_size, utime_t new_mtime)
+ bool update_size, uint64_t new_size,
+ bool update_max, uint64_t new_max_size,
+ utime_t new_mtime)
{
assert(in->is_auth());
@@ -2009,9 +2024,11 @@ bool Locker::check_inode_max_size(CInode *in, bool force_wrlock,
uint64_t size = latest->size;
if (update_size)
size = new_size;
- bool new_max = false;
+ bool new_max = update_max;
+
+ uint64_t client_range_size = update_max ? new_max_size : size;
- calc_new_client_ranges(in, size, new_ranges);
+ calc_new_client_ranges(in, client_range_size, new_ranges);
if (latest->client_ranges != new_ranges)
new_max = true;
@@ -2027,7 +2044,11 @@ bool Locker::check_inode_max_size(CInode *in, bool force_wrlock,
if (in->is_frozen()) {
dout(10) << "check_inode_max_size frozen, waiting on " << *in << dendl;
- in->add_waiter(CInode::WAIT_UNFREEZE, new C_MDL_CheckMaxSize(this, in));
+ C_MDL_CheckMaxSize *cms = new C_MDL_CheckMaxSize(this, in,
+ update_size, new_size,
+ update_max, new_max_size,
+ new_mtime);
+ in->add_waiter(CInode::WAIT_UNFREEZE, cms);
return false;
}
if (!force_wrlock && !in->filelock.can_wrlock(in->get_loner())) {
@@ -2040,7 +2061,12 @@ bool Locker::check_inode_max_size(CInode *in, bool force_wrlock,
}
if (!in->filelock.can_wrlock(in->get_loner())) {
// try again later
- in->filelock.add_waiter(SimpleLock::WAIT_STABLE, new C_MDL_CheckMaxSize(this, in));
+ C_MDL_CheckMaxSize *cms = new C_MDL_CheckMaxSize(this, in,
+ update_size, new_size,
+ update_max, new_max_size,
+ new_mtime);
+
+ in->filelock.add_waiter(SimpleLock::WAIT_STABLE, cms);
dout(10) << "check_inode_max_size can't wrlock, waiting on " << *in << dendl;
return false;
}
@@ -2710,6 +2736,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;
@@ -2722,6 +2749,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);
@@ -2760,7 +2788,13 @@ bool Locker::_do_cap_update(CInode *in, Capability *cap,
}
if (!in->filelock.can_wrlock(client) &&
!in->filelock.can_force_wrlock(client)) {
- in->filelock.add_waiter(SimpleLock::WAIT_STABLE, new C_MDL_CheckMaxSize(this, in));
+ C_MDL_CheckMaxSize *cms = new C_MDL_CheckMaxSize(this, in,
+ false, 0,
+ forced_change_max,
+ new_max,
+ utime_t());
+
+ in->filelock.add_waiter(SimpleLock::WAIT_STABLE, cms);
change_max = false;
}
}
diff --git a/src/mds/Locker.h b/src/mds/Locker.h
index d98104fc435..f4d9861a384 100644
--- a/src/mds/Locker.h
+++ b/src/mds/Locker.h
@@ -274,7 +274,9 @@ protected:
MClientCaps *ack);
public:
void calc_new_client_ranges(CInode *in, uint64_t size, map<client_t, client_writeable_range_t>& new_ranges);
- bool check_inode_max_size(CInode *in, bool force_wrlock=false, bool update_size=false, uint64_t newsize=0,
+ bool check_inode_max_size(CInode *in, bool force_wrlock=false,
+ bool update_size=false, uint64_t newsize=0,
+ bool update_max=false, uint64_t newmax=0,
utime_t mtime=utime_t());
void share_inode_max_size(CInode *in, Capability *only_cap=0);
diff --git a/src/mds/MDCache.cc b/src/mds/MDCache.cc
index 3129ed7c267..9df91b47961 100644
--- a/src/mds/MDCache.cc
+++ b/src/mds/MDCache.cc
@@ -5667,7 +5667,7 @@ void MDCache::_recovered(CInode *in, int r, uint64_t size, utime_t mtime)
remove_inode(in);
} else {
// journal
- mds->locker->check_inode_max_size(in, true, true, size, mtime);
+ mds->locker->check_inode_max_size(in, true, true, size, false, 0, mtime);
in->auth_unpin(this);
}