From fa4a9230c6ba68b9b66d1560abb89114caedf74b Mon Sep 17 00:00:00 2001 From: Greg Farnum Date: Thu, 10 Feb 2011 13:23:44 -0800 Subject: [PATCH] MDS: Don't always _commit_full just because we have a complete dir. Instead, commit if a certain percentage of the dentries are dirty. Configurable via mds_dir_commit_ratio! Signed-off-by: Greg Farnum --- src/config.cc | 1 + src/config.h | 1 + src/mds/CDir.cc | 3 ++- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/config.cc b/src/config.cc index b4411c7bf90fc..0d593854bd438 100644 --- a/src/config.cc +++ b/src/config.cc @@ -355,6 +355,7 @@ static struct config_option config_optionsp[] = { OPTION(mds_cache_size, 0, OPT_INT, 100000), OPTION(mds_cache_mid, 0, OPT_FLOAT, .7), OPTION(mds_mem_max, 0, OPT_INT, 1048576), // KB + OPTION(mds_dir_commit_ratio, 0, OPT_FLOAT, .5), OPTION(mds_decay_halflife, 0, OPT_FLOAT, 5), OPTION(mds_beacon_interval, 0, OPT_FLOAT, 4), OPTION(mds_beacon_grace, 0, OPT_FLOAT, 15), diff --git a/src/config.h b/src/config.h index 317c10ca204f5..29b1c3120745e 100644 --- a/src/config.h +++ b/src/config.h @@ -233,6 +233,7 @@ struct md_config_t { int mds_cache_size; float mds_cache_mid; int mds_mem_max; + float mds_dir_commit_ratio; float mds_decay_halflife; diff --git a/src/mds/CDir.cc b/src/mds/CDir.cc index d3b0b88ff5a12..8c720b54fc2c0 100644 --- a/src/mds/CDir.cc +++ b/src/mds/CDir.cc @@ -1744,7 +1744,8 @@ void CDir::_commit(version_t want) } ObjectOperation m; - if (is_complete()) { + if (is_complete() && + (num_dirty > (num_head_items*g_conf.mds_dir_commit_ratio))) { fnode.snap_purged_thru = realm->get_last_destroyed(); _commit_full(m, snaps); } else { -- 2.39.5