[SSI] openssi/kernel/cluster/ssi/util rmtfb.c,1.30,1.31

Roger Tsang <[email protected]> Mon, 25 Oct 2010 04:47:02 +0000
Newsgroups gmane.linux.cluster.ssic.cvs
Message-ID <[email protected]>
Update of /cvsroot/ssic-linux/openssi/kernel/cluster/ssi/util
In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv32317/cluster/ssi/util

Modified Files:
      Tag: OPENSSI-FC
	rmtfb.c 
Log Message:
Remote File Block (#ifdef RMTFB_HASH_LOCKLESS):
- In rmtfb_newcli() calculate rmtfb_clitbl hash outside critical section.
- In rmtfb_newsvr() calculate rmtfb_svrtbl hash outside critical section.

 cluster/ssi/util/rmtfb.c |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)


Index: rmtfb.c
===================================================================
RCS file: /cvsroot/ssic-linux/openssi/kernel/cluster/ssi/util/rmtfb.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- rmtfb.c	29 Aug 2010 17:46:50 -0000	1.30
+++ rmtfb.c	25 Oct 2010 04:46:59 -0000	1.31
@@ -1212,7 +1212,7 @@
 {
 static DECLARE_MUTEX(rmtfb_newsvr_lock);
 	struct rmtfb_svr *rfb;
-	unsigned long ino = ftoi(file)->i_ino;
+	unsigned long hash, ino = ftoi(file)->i_ino;
 	char export = !id;
 
 	rfb = rmtfb_svr_alloc(file, id);
@@ -1223,6 +1223,8 @@
 		return ERR_PTR(-ENOMEM);
 	}
 
+	hash = rfbhash(ino);
+
 	down(&rmtfb_newsvr_lock);
 
 	if (export) {
@@ -1239,7 +1241,7 @@
 	}
 
 	spin_lock(&rmtfb_svrtbl_lock);
-	hlist_add_head_rcu(&rfb->common.rfb_hash, &rmtfb_svrtbl[rfbhash(ino)]);
+	hlist_add_head_rcu(&rfb->common.rfb_hash, &rmtfb_svrtbl[hash]);
 	spin_unlock(&rmtfb_svrtbl_lock);
 	up(&rmtfb_newsvr_lock);
 out:
@@ -1363,6 +1365,7 @@
 {
 static DECLARE_MUTEX(rmtfb_newcli_lock);
 	struct rmtfb_cli *rfb;
+	unsigned long hash;
 	int error;
 	char import = !!id;
 
@@ -1389,6 +1392,8 @@
 	} else
 		error = 0;
 
+	hash = rfbhash(id);
+
 	down(&rmtfb_newcli_lock);
 
 	if (import) {
@@ -1435,7 +1440,7 @@
 	 */
 
 	spin_lock(&rmtfb_clitbl_lock);
-	hlist_add_head_rcu(&rfb->common.rfb_hash, &rmtfb_clitbl[rfbhash(id)]);
+	hlist_add_head_rcu(&rfb->common.rfb_hash, &rmtfb_clitbl[hash]);
 	spin_unlock(&rmtfb_clitbl_lock);
 	up(&rmtfb_newcli_lock);
 out:


------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
http://p.sf.net/sfu/nokia-dev2dev