From b02afc6d008f9959db28244eb2b9dd3b9ef92393 Mon Sep 17 00:00:00 2001 From: Amar Tumballi Date: Tue, 17 Jan 2012 05:28:51 +0530 Subject: 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 BUG: 767229 Reviewed-on: http://review.gluster.com/779 Tested-by: Gluster Build System Reviewed-by: Anand Avati --- libglusterfs/src/globals.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) (limited to 'libglusterfs/src/globals.c') diff --git a/libglusterfs/src/globals.c b/libglusterfs/src/globals.c index 57946f704..8b641123f 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 (); -- cgit