From 54491e317c3cce08973e1ee1520845a7e549164b Mon Sep 17 00:00:00 2001 From: sage Date: Tue, 5 Jul 2005 17:28:24 +0000 Subject: [PATCH] *** empty log message *** git-svn-id: https://ceph.svn.sf.net/svnroot/ceph@398 29311d96-e01e-0410-9327-a35deaab8ce9 --- ceph/config.cc | 3 +++ ceph/config.h | 1 + ceph/mds/MDS.cc | 6 +++++- ceph/mds/MDStore.cc | 14 +++++++------- 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/ceph/config.cc b/ceph/config.cc index 81bce9027b5..4ab5ffa1c76 100644 --- a/ceph/config.cc +++ b/ceph/config.cc @@ -76,6 +76,7 @@ md_config_t g_conf = { mds_bal_interval: 30, // seconds mds_bal_idle_threshold: .1, mds_bal_max: -1, + mds_bal_max_until: -1, mds_commit_on_shutdown: true, @@ -188,6 +189,8 @@ void parse_config_options(int argc, char **argv, g_conf.mds_bal_interval = atoi(argv[++i]); else if (strcmp(argv[i], "--mds_bal_max") == 0) g_conf.mds_bal_max = atoi(argv[++i]); + else if (strcmp(argv[i], "--mds_bal_max_until") == 0) + g_conf.mds_bal_max_until = atoi(argv[++i]); else if (strcmp(argv[i], "--client_cache_size") == 0) g_conf.client_cache_size = atoi(argv[++i]); diff --git a/ceph/config.h b/ceph/config.h index 6a4a84ff8ce..b3bf82b746a 100644 --- a/ceph/config.h +++ b/ceph/config.h @@ -51,6 +51,7 @@ struct md_config_t { int mds_bal_interval; float mds_bal_idle_threshold; int mds_bal_max; + int mds_bal_max_until; bool mds_commit_on_shutdown; bool mds_verify_export_dirauth; // debug flag diff --git a/ceph/mds/MDS.cc b/ceph/mds/MDS.cc index 6420e1ad639..f3440a9de8e 100644 --- a/ceph/mds/MDS.cc +++ b/ceph/mds/MDS.cc @@ -444,8 +444,12 @@ void MDS::my_dispatch(Message *m) // balance? static int num_bal_times = g_conf.mds_bal_max; + static timepair_t first = g_clock.gettimepair(); timepair_t now = g_clock.gettimepair(); - if (true && num_bal_times && whoami == 0 && + timepair_t elapsed = now - first; + if (true && + whoami == 0 && + (num_bal_times || (g_conf.mds_bal_max_until >= 0 && elapsed.first > g_conf.mds_bal_max_until)) && !shutting_down && !shut_down && now.first - last_balancer_heartbeat.first >= g_conf.mds_bal_interval) { last_balancer_heartbeat = now; diff --git a/ceph/mds/MDStore.cc b/ceph/mds/MDStore.cc index a05a7873545..0415cefe926 100644 --- a/ceph/mds/MDStore.cc +++ b/ceph/mds/MDStore.cc @@ -442,21 +442,21 @@ void MDStore::do_commit_dir_2( int result, // dentry if (committed_version > dn->get_parent_dir_version()) { - dout(5) << " dir " << committed_version << " > dn " << dn->get_parent_dir_version() << " still clean " << *dn << endl; + dout(15) << " dir " << committed_version << " > dn " << dn->get_parent_dir_version() << " still clean " << *dn << endl; assert(!dn->is_dirty()); } else if (dn->get_parent_dir_version() == committed_version) { - dout(5) << " dir " << committed_version << " == dn " << dn->get_parent_dir_version() << " now clean " << *dn << endl; + dout(15) << " dir " << committed_version << " == dn " << dn->get_parent_dir_version() << " now clean " << *dn << endl; dn->mark_clean(); // might not but could be dirty // remove, if it's null and unlocked if (dn->is_null() && dn->is_sync()) { - dout(5) << " removing clean and null " << *dn << endl; + dout(15) << " removing clean and null " << *dn << endl; null_clean.push_back(dn); continue; } } else { - dout(5) << " dir " << committed_version << " < dn " << dn->get_parent_dir_version() << " still dirty " << *dn << endl; + dout(15) << " dir " << committed_version << " < dn " << dn->get_parent_dir_version() << " still dirty " << *dn << endl; assert(committed_version < dn->get_parent_dir_version()); assert(dn->is_dirty() || !dn->is_sync()); } @@ -469,14 +469,14 @@ void MDStore::do_commit_dir_2( int result, assert(in->is_auth()); if (committed_version > in->get_parent_dir_version()) { - dout(5) << " dir " << committed_version << " > inode " << in->get_parent_dir_version() << " still clean " << *(in) << endl; + dout(15) << " dir " << committed_version << " > inode " << in->get_parent_dir_version() << " still clean " << *(in) << endl; assert(!in->is_dirty()); } else if (in->get_parent_dir_version() == committed_version) { - dout(5) << " dir " << committed_version << " == inode " << in->get_parent_dir_version() << " now clean " << *(in) << endl; + dout(15) << " dir " << committed_version << " == inode " << in->get_parent_dir_version() << " now clean " << *(in) << endl; in->mark_clean(); // might not but could be dirty } else { - dout(5) << " dir " << committed_version << " < inode " << in->get_parent_dir_version() << " still dirty " << *(in) << endl; + dout(15) << " dir " << committed_version << " < inode " << in->get_parent_dir_version() << " still dirty " << *(in) << endl; assert(committed_version < in->get_parent_dir_version()); assert(in->is_dirty()); }