From ec273a46820ba17f46488c082c65cd1aa6739be3 Mon Sep 17 00:00:00 2001 From: Yaniv Kaul Date: Tue, 12 Feb 2019 11:17:37 +0200 Subject: auth-cache.c: minor reduction of work under lock. Minor change to reduce work done under a lock. Also, remove unused variable (unrelated to the above). Compile-tested only! updates: bz#1193929 Signed-off-by: Yaniv Kaul Change-Id: I1dfb55823c3db7c638d8a34288423bd1faa37c32 --- xlators/nfs/server/src/auth-cache.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'xlators/nfs') diff --git a/xlators/nfs/server/src/auth-cache.c b/xlators/nfs/server/src/auth-cache.c index f8e5061dc54..64768646074 100644 --- a/xlators/nfs/server/src/auth-cache.c +++ b/xlators/nfs/server/src/auth-cache.c @@ -40,16 +40,12 @@ make_hashkey(struct nfs3_fh *fh, const char *host) char exportid[256] = { 0, }; - char gfid[256] = { - 0, - }; char mountid[256] = { 0, }; size_t nbytes = 0; gf_uuid_unparse(fh->exportid, exportid); - gf_uuid_unparse(fh->gfid, gfid); gf_uuid_unparse(fh->mountid, mountid); nbytes = strlen(exportid) + strlen(host) + strlen(mountid) + 3; @@ -145,7 +141,7 @@ auth_cache_add(struct auth_cache *cache, char *hashkey, { int ret = -1; data_t *entry_data = NULL; - + int hashkey_len; GF_VALIDATE_OR_GOTO(GF_NFS, cache, out); GF_VALIDATE_OR_GOTO(GF_NFS, cache->cache_dict, out); @@ -168,9 +164,10 @@ auth_cache_add(struct auth_cache *cache, char *hashkey, * auth_cache_entry is released */ entry->data = data_ref(entry_data); + hashkey_len = strlen(hashkey); LOCK(&cache->lock); { - ret = dict_set(cache->cache_dict, hashkey, entry_data); + ret = dict_setn(cache->cache_dict, hashkey, hashkey_len, entry_data); } UNLOCK(&cache->lock); -- cgit