summaryrefslogtreecommitdiffstats
path: root/xlators/performance
diff options
context:
space:
mode:
authorRaghavendra G <raghavendra@gluster.com>2012-03-08 07:45:15 +0530
committerVijay Bellur <vijay@gluster.com>2012-03-08 09:10:02 -0800
commit204ab142977163f634cbf4ec92be58754225504a (patch)
tree5482eb90489b36665df7c1e61bcf55474896988c /xlators/performance
parent9ae2f79879b295639b55411c5339eba04e627345 (diff)
performance/io-cache: move mem-pool initialisation to init.
mem-pool is global structure which is stored in ioc-inode-table and hence can be initialised in init. Change-Id: I4bc88fe3e8c729312e41f62c98f665af5fb26a62 BUG: 765340 Signed-off-by: Raghavendra G <raghavendra@gluster.com> Reviewed-on: http://review.gluster.com/2895 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Amar Tumballi <amarts@redhat.com> Reviewed-by: Vijay Bellur <vijay@gluster.com>
Diffstat (limited to 'xlators/performance')
-rw-r--r--xlators/performance/io-cache/src/io-cache.c37
1 files changed, 13 insertions, 24 deletions
diff --git a/xlators/performance/io-cache/src/io-cache.c b/xlators/performance/io-cache/src/io-cache.c
index bea22268b48..823bac38d48 100644
--- a/xlators/performance/io-cache/src/io-cache.c
+++ b/xlators/performance/io-cache/src/io-cache.c
@@ -1091,7 +1091,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) {
@@ -1118,29 +1117,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) {
@@ -1672,6 +1648,7 @@ init (xlator_t *this)
int32_t ret = -1;
glusterfs_ctx_t *ctx = NULL;
data_t *data = 0;
+ uint32_t num_pages = 0;
xl_options = this->options;
@@ -1757,6 +1734,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;