mds: avoid propagating nestlock more frequently than mds_dirstat_min_interval

Instead, add the lock to the update_scatterlock list, as usual.
This commit is contained in:
Sage Weil 2009-08-24 14:01:14 -07:00
parent 9114e6fccb
commit 03411a1565
5 changed files with 37 additions and 1 deletions

View File

@ -407,6 +407,7 @@ static struct config_option config_optionsp[] = {
OPTION(mds_reconnect_timeout, 0, OPT_FLOAT, 45), // seconds to wait for clients during mds restart
// make it (mds_session_timeout - mds_beacon_grace)
OPTION(mds_tick_interval, 0, OPT_FLOAT, 5),
OPTION(mds_dirstat_min_interval, 0, OPT_FLOAT, 1), // try to avoid propagating more often than this
OPTION(mds_scatter_nudge_interval, 0, OPT_FLOAT, 5), // how quickly dirstat changes propagate up the hierarchy
OPTION(mds_client_prealloc_inos, 0, OPT_INT, 1000),
OPTION(mds_early_reply, 0, OPT_BOOL, true),

View File

@ -198,6 +198,7 @@ struct md_config_t {
float mds_reconnect_timeout;
float mds_tick_interval;
float mds_dirstat_min_interval;
float mds_scatter_nudge_interval;
int mds_client_prealloc_inos;

View File

@ -2546,6 +2546,12 @@ bool Locker::simple_sync(SimpleLock *lock, bool *need_issue)
gather++;
}
if (!gather && lock->is_updated()) {
lock->get_parent()->auth_pin(lock);
scatter_writebehind((ScatterLock*)lock);
return false;
}
if (gather) {
lock->get_parent()->auth_pin(lock);
return false;
@ -2664,8 +2670,9 @@ void Locker::simple_lock(SimpleLock *lock, bool *need_issue)
}
if (!gather && lock->is_updated()) {
lock->get_parent()->auth_pin(lock);
scatter_writebehind((ScatterLock*)lock);
gather++;
return;
}
if (gather) {

View File

@ -1667,6 +1667,7 @@ void MDCache::predirty_journal_parents(Mutation *mut, EMetaBlob *blob,
list<CInode*> lsi;
CInode *cur = in;
CDentry *parentdn = cur->get_projected_parent_dn();
bool first = true;
while (parent) {
//assert(cur->is_auth() || !primary_dn); // this breaks the rename auth twiddle hack
assert(parent->is_auth());
@ -1749,6 +1750,26 @@ void MDCache::predirty_journal_parents(Mutation *mut, EMetaBlob *blob,
dout(10) << "predirty_journal_parents !auth or ambig on " << *pin << dendl;
stop = true;
}
// delay propagating until later?
if (!stop && !first &&
g_conf.mds_dirstat_min_interval > 0) {
if (pin->last_dirstat_prop.sec() > 0) {
double since_last_prop = mut->now - pin->last_dirstat_prop;
if (since_last_prop < g_conf.mds_dirstat_min_interval) {
dout(10) << "predirty_journal_parents last prop " << since_last_prop
<< " < " << g_conf.mds_dirstat_min_interval
<< ", stopping" << dendl;
stop = true;
} else {
dout(10) << "predirty_journal_parents last prop " << since_last_prop << " ago, continuing" << dendl;
}
} else {
dout(10) << "predirty_journal_parents last prop never, stopping" << dendl;
stop = true;
}
}
if (!stop &&
mut->wrlocks.count(&pin->nestlock) == 0 &&
(!pin->can_auth_pin() ||
@ -1772,6 +1793,8 @@ void MDCache::predirty_journal_parents(Mutation *mut, EMetaBlob *blob,
assert(mut->wrlocks.count(&pin->nestlock) ||
mut->is_slave());
pin->last_dirstat_prop = mut->now;
// dirfrag -> diri
mut->auth_pin(pin);
@ -1827,6 +1850,7 @@ void MDCache::predirty_journal_parents(Mutation *mut, EMetaBlob *blob,
linkunlink = 0;
do_parent_mtime = false;
primary_dn = true;
first = false;
}
// now, stick it in the blob

View File

@ -39,6 +39,9 @@ public:
void clear_scatter_wanted() { scatter_wanted = false; }
bool get_scatter_wanted() { return scatter_wanted; }
bool is_updated() {
return dirty;
}
void mark_dirty() {
if (!dirty) {
if (!flushing)