Patchwork [BUG:1948,1/3] core: Use lru_limit as count for inode and dentry mempool

login
register
Submitter Shehjar Tikoo
Date 2010-10-26 12:09:06
Message ID <1288094948-22843-1-git-send-email-shehjart@gluster.com>
Download mbox | patch
Permalink /patch/5575/
State Accepted
Headers show

Comments

Shehjar Tikoo - 2010-10-26 12:09:06
From: Shehjar Tikoo <shehjart@gluster.com>


Signed-off-by: Shehjar Tikoo <shehjart@gluster.com>
---
 libglusterfs/src/inode.c |    8 ++++++--
 libglusterfs/src/inode.h |    1 +
 2 files changed, 7 insertions(+), 2 deletions(-)

Patch

diff --git a/libglusterfs/src/inode.c b/libglusterfs/src/inode.c
index 04e4560..57a3c35 100644
--- a/libglusterfs/src/inode.c
+++ b/libglusterfs/src/inode.c
@@ -1047,14 +1047,18 @@  inode_table_new (size_t lru_limit, xlator_t *xl)
 
         new->hashsize = 14057; /* TODO: Random Number?? */
 
-        new->inode_pool = mem_pool_new (inode_t, 204654);
+        /* In case FUSE is initing the inode table. */
+        if (lru_limit == 0)
+                lru_limit = DEFAULT_INODE_MEMPOOL_ENTRIES;
+
+        new->inode_pool = mem_pool_new (inode_t, lru_limit);
 
         if (!new->inode_pool) {
                 GF_FREE (new);
                 return NULL;
         }
 
-        new->dentry_pool = mem_pool_new (dentry_t, 204654);
+        new->dentry_pool = mem_pool_new (dentry_t, lru_limit);
 
         if (!new->dentry_pool) {
                 GF_FREE (new);
diff --git a/libglusterfs/src/inode.h b/libglusterfs/src/inode.h
index de423d8..15a4f98 100644
--- a/libglusterfs/src/inode.h
+++ b/libglusterfs/src/inode.h
@@ -28,6 +28,7 @@ 
 #include <stdint.h>
 #include <sys/types.h>
 
+#define DEFAULT_INODE_MEMPOOL_ENTRIES   16384
 struct _inode_table;
 typedef struct _inode_table inode_table_t;