summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libglusterfs/src/inode.c21
-rw-r--r--libglusterfs/src/inode.h6
-rw-r--r--libglusterfs/src/xlator.c19
-rw-r--r--libglusterfs/src/xlator.h3
-rw-r--r--xlators/protocol/server/src/server.c10
5 files changed, 59 insertions, 0 deletions
diff --git a/libglusterfs/src/inode.c b/libglusterfs/src/inode.c
index d4eade8ba88..373ba9beb39 100644
--- a/libglusterfs/src/inode.c
+++ b/libglusterfs/src/inode.c
@@ -1238,6 +1238,27 @@ inode_path (inode_t *inode, const char *name, char **bufp)
return ret;
}
+void
+__inode_table_set_lru_limit (inode_table_t *table, uint32_t lru_limit)
+{
+ table->lru_limit = lru_limit;
+ return;
+}
+
+
+void
+inode_table_set_lru_limit (inode_table_t *table, uint32_t lru_limit)
+{
+ pthread_mutex_lock (&table->lock);
+ {
+ __inode_table_set_lru_limit (table, lru_limit);
+ }
+ pthread_mutex_unlock (&table->lock);
+
+ inode_table_prune (table);
+
+ return;
+}
static int
inode_table_prune (inode_table_t *table)
diff --git a/libglusterfs/src/inode.h b/libglusterfs/src/inode.h
index 60adba68425..5d373fcaec9 100644
--- a/libglusterfs/src/inode.h
+++ b/libglusterfs/src/inode.h
@@ -251,4 +251,10 @@ inode_ctx_put(inode_t *inode, xlator_t *this, uint64_t v)
gf_boolean_t
__is_root_gfid (uuid_t gfid);
+void
+__inode_table_set_lru_limit (inode_table_t *table, uint32_t lru_limit);
+
+void
+inode_table_set_lru_limit (inode_table_t *table, uint32_t lru_limit);
+
#endif /* _INODE_H */
diff --git a/libglusterfs/src/xlator.c b/libglusterfs/src/xlator.c
index 4f8b8b21f95..7b873fcc79d 100644
--- a/libglusterfs/src/xlator.c
+++ b/libglusterfs/src/xlator.c
@@ -291,6 +291,25 @@ xlator_set_type (xlator_t *xl, const char *type)
return ret;
}
+void
+xlator_set_inode_lru_limit (xlator_t *this, void *data)
+{
+ int inode_lru_limit = 0;
+
+ if (this->itable) {
+ if (!data) {
+ gf_log (this->name, GF_LOG_WARNING, "input data is "
+ "NULL. Cannot update the lru limit of the inode"
+ " table. Continuing with older value");
+ goto out;
+ }
+ inode_lru_limit = *(int *)data;
+ inode_table_set_lru_limit (this->itable, inode_lru_limit);
+ }
+
+out:
+ return;
+}
void
xlator_foreach (xlator_t *this,
diff --git a/libglusterfs/src/xlator.h b/libglusterfs/src/xlator.h
index 47ae6cdd6b6..0c4e820c2d3 100644
--- a/libglusterfs/src/xlator.h
+++ b/libglusterfs/src/xlator.h
@@ -935,6 +935,9 @@ void xlator_foreach_depth_first (xlator_t *this,
xlator_t *xlator_search_by_name (xlator_t *any, const char *name);
+void
+xlator_set_inode_lru_limit (xlator_t *this, void *data);
+
void inode_destroy_notify (inode_t *inode, const char *xlname);
int loc_copy (loc_t *dst, loc_t *src);
diff --git a/xlators/protocol/server/src/server.c b/xlators/protocol/server/src/server.c
index 04faee290ea..60092a557de 100644
--- a/xlators/protocol/server/src/server.c
+++ b/xlators/protocol/server/src/server.c
@@ -677,6 +677,8 @@ reconfigure (xlator_t *this, dict_t *options)
data_t *data;
int ret = 0;
char *statedump_path = NULL;
+ xlator_t *xl = NULL;
+
conf = this->private;
if (!conf) {
@@ -687,6 +689,14 @@ reconfigure (xlator_t *this, dict_t *options)
conf->inode_lru_limit = inode_lru_limit;
gf_log (this->name, GF_LOG_TRACE, "Reconfigured inode-lru-limit"
" to %d", conf->inode_lru_limit);
+
+ /* traverse through the xlator graph. For each xlator in the
+ graph check whether it is a bound_xl or not (bound_xl means
+ the xlator will have its itable pointer set). If so, then
+ set the lru limit for the itable.
+ */
+ xlator_foreach (this, xlator_set_inode_lru_limit,
+ &inode_lru_limit);
}
data = dict_get (options, "trace");