client_lock.Unlock();
+ cct->_conf->add_observer(this);
+
AdminSocket* admin_socket = cct->get_admin_socket();
int ret = admin_socket->register_command("mds_requests",
"mds_requests",
{
ldout(cct, 1) << "shutdown" << dendl;
+ cct->_conf->remove_observer(this);
+
AdminSocket* admin_socket = cct->get_admin_socket();
admin_socket->unregister_command("mds_requests");
admin_socket->unregister_command("mds_sessions");
// ===================
// metadata cache stuff
-void Client::trim_cache()
+void Client::trim_cache(bool trim_kernel_dcache)
{
ldout(cct, 20) << "trim_cache size " << lru.lru_get_size() << " max " << lru.lru_get_max() << dendl;
unsigned last = 0;
trim_dentry(dn);
}
+ if (trim_kernel_dcache && lru.lru_get_size() > lru.lru_get_max())
+ _invalidate_kernel_dcache();
+
// hose root?
if (lru.lru_get_size() == 0 && root && root->get_num_ref() == 0 && inode_map.size() == 1 + root_parents.size()) {
ldout(cct, 15) << "trim_cache trimmed root " << root << dendl;
check_caps(in, true);
}
+ trim_cache(true);
}
void Client::renew_caps()
cap_epoch_barrier = e;
}
+const char** Client::get_tracked_conf_keys() const
+{
+ static const char* keys[] = {
+ "client_cache_size",
+ "client_cache_mid",
+ NULL
+ };
+ return keys;
+}
+
+void Client::handle_conf_change(const struct md_config_t *conf,
+ const std::set <std::string> &changed)
+{
+ if (changed.count("client_cache_size") ||
+ changed.count("client_cache_mid")) {
+ lru.lru_set_max(cct->_conf->client_cache_size);
+ lru.lru_set_midpoint(cct->_conf->client_cache_mid);
+ }
+}
+
}
};
-class Client : public Dispatcher {
+class Client : public Dispatcher, public md_config_obs_t {
public:
using Dispatcher::cct;
void touch_dn(Dentry *dn);
// trim cache.
- void trim_cache();
+ void trim_cache(bool trim_kernel_dcache=false);
void trim_cache_for_reconnect(MetaSession *s);
void trim_dentry(Dentry *dn);
void trim_caps(MetaSession *s, int max);
void ll_register_callbacks(struct client_callback_args *args);
int test_dentry_handling(bool can_invalidate);
+
+ virtual const char** get_tracked_conf_keys() const;
+ virtual void handle_conf_change(const struct md_config_t *conf,
+ const std::set <std::string> &changed);
};
#endif