OPTION(journaler_batch_max, 0, OPT_LONGLONG, 0), // max bytes we'll delay flushing; disable, for now....
OPTION(mds_cache_size, 0, OPT_INT, 300000),
OPTION(mds_cache_mid, 0, OPT_FLOAT, .7),
+ OPTION(mds_mem_max, 0, OPT_INT, 1048576), // KB
OPTION(mds_decay_halflife, 0, OPT_FLOAT, 5),
OPTION(mds_beacon_interval, 0, OPT_FLOAT, 4),
OPTION(mds_beacon_grace, 0, OPT_FLOAT, 15),
// mds
int mds_cache_size;
float mds_cache_mid;
+ int mds_mem_max;
float mds_decay_halflife;
}
+void MDCache::check_memory_usage()
+{
+ ifstream f("/proc/self/status");
+ if (!f.is_open()) {
+ dout(0) << "check_memory_usage unable to open /proc/self/status" << dendl;
+ return;
+ }
+
+ int vmsize;
+ int vmrss;
+
+ while (!f.eof()) {
+ string line;
+ getline(f, line);
+
+ if (strncmp(line.c_str(), "VmSize:", 7) == 0)
+ vmsize = atoi(line.c_str() + 10);
+ else if (strncmp(line.c_str(), "VmRSS:", 6) == 0)
+ vmrss = atoi(line.c_str() + 10);
+ }
+
+ dout(10) << "check_memory_usage size " << vmsize << ", rss " << vmrss
+ << ", max " << g_conf.mds_mem_max
+ << dendl;
+
+
+ // check client caps
+ float caps_per_inode = (float)num_caps / (float)inode_map.size();
+ //float cap_rate = (float)num_inodes_with_caps / (float)inode_map.size();
+
+ dout(10) << " " << num_inodes_with_caps << " / " << inode_map.size() << " inodes have caps" << dendl;
+ dout(10) << " " << num_caps << " caps, " << caps_per_inode << " caps per inode" << dendl;
+
+}
+
void MDCache::remove_client_cap(CInode *in, int client, bool eval)
{
r->ttl = ttl;
}
- void trim_client_leases();
-
// -- client caps --
__u64 last_cap_id;
void send_expire_messages(map<int, MCacheExpire*>& expiremap);
void trim_non_auth(); // trim out trimmable non-auth items
+ void trim_client_leases();
+ void check_memory_usage();
+
// shutdown
void shutdown_start();
void shutdown_check();
if (is_active() || is_stopping()) {
mdcache->trim();
mdcache->trim_client_leases();
+ mdcache->check_memory_usage();
mdlog->trim(); // NOT during recovery!
}