summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src/globals.c
diff options
context:
space:
mode:
authorAmar Tumballi <amar@gluster.com>2012-01-17 05:28:51 +0530
committerAnand Avati <avati@gluster.com>2012-01-24 20:14:17 -0800
commitb02afc6d008f9959db28244eb2b9dd3b9ef92393 (patch)
treec0bad790fb34f8ab2747b480d334cf9af75c5514 /libglusterfs/src/globals.c
parent0694749c3e5039be327110a64dd66619b5d9121c (diff)
core: change lk-owner as a 1k buffer
so, NLM can send the lk-owner field directly to the locks translators, while doing the same effort, also enabled sending maximum of 500 aux gid over protocol. Change-Id: I87c2514392748416f7ffe21d5154faad2e413969 Signed-off-by: Amar Tumballi <amar@gluster.com> BUG: 767229 Reviewed-on: http://review.gluster.com/779 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@gluster.com>
Diffstat (limited to 'libglusterfs/src/globals.c')
-rw-r--r--libglusterfs/src/globals.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/libglusterfs/src/globals.c b/libglusterfs/src/globals.c
index 57946f70480..8b641123f15 100644
--- a/libglusterfs/src/globals.c
+++ b/libglusterfs/src/globals.c
@@ -293,6 +293,43 @@ glusterfs_uuid_buf_get ()
return buf;
}
+/* LKOWNER_BUFFER */
+
+static pthread_key_t lkowner_buf_key;
+static char global_lkowner_buf[GF_LKOWNER_BUF_SIZE];
+void
+glusterfs_lkowner_buf_destroy (void *ptr)
+{
+ if (ptr)
+ FREE (ptr);
+}
+
+int
+glusterfs_lkowner_buf_init ()
+{
+ int ret = 0;
+
+ ret = pthread_key_create (&lkowner_buf_key,
+ glusterfs_lkowner_buf_destroy);
+ return ret;
+}
+
+char *
+glusterfs_lkowner_buf_get ()
+{
+ char *buf;
+ int ret = 0;
+
+ buf = pthread_getspecific (lkowner_buf_key);
+ if(!buf) {
+ buf = MALLOC (GF_LKOWNER_BUF_SIZE);
+ ret = pthread_setspecific (lkowner_buf_key, (void *) buf);
+ if(ret)
+ buf = global_lkowner_buf;
+ }
+ return buf;
+}
+
int
glusterfs_globals_init ()
{
@@ -323,6 +360,13 @@ glusterfs_globals_init ()
goto out;
}
+ ret = glusterfs_lkowner_buf_init ();
+ if(ret) {
+ gf_log ("", GF_LOG_CRITICAL,
+ "ERROR: glusterfs lkowner buffer init failed");
+ goto out;
+ }
+
gf_mem_acct_enable_set ();
ret = synctask_init ();