summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--xlators/performance/io-cache/src/io-cache.c39
1 files changed, 13 insertions, 26 deletions
diff --git a/xlators/performance/io-cache/src/io-cache.c b/xlators/performance/io-cache/src/io-cache.c
index 230842389cc..830386e0206 100644
--- a/xlators/performance/io-cache/src/io-cache.c
+++ b/xlators/performance/io-cache/src/io-cache.c
@@ -1080,7 +1080,6 @@ ioc_readv (call_frame_t *frame, xlator_t *this, fd_t *fd,
ioc_local_t *local = NULL;
uint32_t weight = 0;
ioc_table_t *table = NULL;
- uint32_t num_pages = 0;
int32_t op_errno = -1;
if (!this) {
@@ -1107,29 +1106,6 @@ ioc_readv (call_frame_t *frame, xlator_t *this, fd_t *fd,
goto out;
}
-
- ioc_table_lock (table);
- {
- if (!table->mem_pool) {
-
- num_pages = (table->cache_size / table->page_size)
- + ((table->cache_size % table->page_size)
- ? 1 : 0);
-
- table->mem_pool
- = mem_pool_new (rbthash_entry_t, num_pages);
-
- if (!table->mem_pool) {
- gf_log (this->name, GF_LOG_ERROR,
- "Unable to allocate mem_pool");
- op_errno = ENOMEM;
- ioc_table_unlock (table);
- goto out;
- }
- }
- }
- ioc_table_unlock (table);
-
ioc_inode_lock (ioc_inode);
{
if (!ioc_inode->cache.page_table) {
@@ -1727,6 +1703,7 @@ init (xlator_t *this)
glusterfs_ctx_t *ctx = NULL;
data_t *data = 0;
char *def_val = NULL;
+ uint32_t num_pages = 0;
xl_options = this->options;
@@ -1800,7 +1777,6 @@ init (xlator_t *this)
}
}
-
data = dict_get (xl_options, "cache-timeout");
if (data) {
table->cache_timeout = data_to_uint32 (data);
@@ -1842,7 +1818,6 @@ init (xlator_t *this)
}
}
-
data = dict_get (xl_options, "min-file-size");
if (data)
tmp = data_to_str (data);
@@ -1918,6 +1893,18 @@ init (xlator_t *this)
pthread_mutex_init (&table->table_lock, NULL);
this->private = table;
+
+ num_pages = (table->cache_size / table->page_size)
+ + ((table->cache_size % table->page_size)
+ ? 1 : 0);
+
+ table->mem_pool = mem_pool_new (rbthash_entry_t, num_pages);
+ if (!table->mem_pool) {
+ gf_log (this->name, GF_LOG_ERROR,
+ "Unable to allocate mem_pool");
+ goto out;
+ }
+
ret = 0;
ctx = this->ctx;