summaryrefslogtreecommitdiffstats
path: root/libglusterfs
diff options
context:
space:
mode:
authorshishir gowda <shishirng@gluster.com>2010-08-05 04:00:14 +0000
committerAnand V. Avati <avati@dev.gluster.com>2010-08-06 03:37:36 -0700
commitf9431f330e8f304e82d9b1443018987a926d56b6 (patch)
treee5f91f4f8f0cb9b3387f209944127022d915b598 /libglusterfs
parent767b6b7d3f5b5e96e13f459fae6260d7cb129403 (diff)
mem pool for fd_t
Ran posix compliance test and sanity test Signed-off-by: shishir gowda <shishirng@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 329 (Replacing memory allocation functions with mem-type functions) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=329
Diffstat (limited to 'libglusterfs')
-rw-r--r--libglusterfs/src/fd.c8
-rw-r--r--libglusterfs/src/inode.c7
-rw-r--r--libglusterfs/src/inode.h1
3 files changed, 14 insertions, 2 deletions
diff --git a/libglusterfs/src/fd.c b/libglusterfs/src/fd.c
index 9269e5cf8..231b7c5b0 100644
--- a/libglusterfs/src/fd.c
+++ b/libglusterfs/src/fd.c
@@ -402,6 +402,7 @@ fd_destroy (fd_t *fd)
xlator_t *xl = NULL;
int i = 0;
xlator_t *old_THIS = NULL;
+ struct mem_pool *tmp_pool = NULL;
if (fd == NULL){
gf_log ("xlator", GF_LOG_ERROR, "invalid arugument");
@@ -415,6 +416,8 @@ fd_destroy (fd_t *fd)
if (!fd->_ctx)
goto out;
+ tmp_pool = fd->inode->table->fd_mem_pool;
+
if (IA_ISDIR (fd->inode->ia_type)) {
for (i = 0; i < fd->inode->table->xl->graph->xl_count; i++) {
if (fd->_ctx[i].key) {
@@ -444,7 +447,8 @@ fd_destroy (fd_t *fd)
GF_FREE (fd->_ctx);
inode_unref (fd->inode);
fd->inode = (inode_t *)0xaaaaaaaa;
- GF_FREE (fd);
+ mem_put (tmp_pool,fd);
+ tmp_pool = NULL;
out:
return;
}
@@ -505,7 +509,7 @@ fd_create (inode_t *inode, pid_t pid)
return NULL;
}
- fd = GF_CALLOC (1, sizeof (fd_t), gf_common_mt_fd_t);
+ fd = mem_get (inode->table->fd_mem_pool);
if (!fd)
goto out;
diff --git a/libglusterfs/src/inode.c b/libglusterfs/src/inode.c
index 5d35d4cc3..ad65081dc 100644
--- a/libglusterfs/src/inode.c
+++ b/libglusterfs/src/inode.c
@@ -1098,6 +1098,13 @@ inode_table_new (size_t lru_limit, xlator_t *xl)
return NULL;
}
+ new->fd_mem_pool = mem_pool_new (fd_t, 16384);
+
+ if (!new->fd_mem_pool) {
+ GF_FREE (new->inode_hash);
+ GF_FREE (new);
+ }
+
for (i=0; i<new->hashsize; i++) {
INIT_LIST_HEAD (&new->inode_hash[i]);
}
diff --git a/libglusterfs/src/inode.h b/libglusterfs/src/inode.h
index dbc721546..18081b8f8 100644
--- a/libglusterfs/src/inode.h
+++ b/libglusterfs/src/inode.h
@@ -65,6 +65,7 @@ struct _inode_table {
uint32_t attic_size;
struct mem_pool *inode_pool; /* memory pool for inodes */
struct mem_pool *dentry_pool; /* memory pool for dentrys */
+ struct mem_pool *fd_mem_pool; /* memory pool for fd_t */
};