[SSI] openssi/kernel/cluster/ssi/token clitok.c,1.11,1.12

Roger Tsang <[email protected]> Wed, 15 Dec 2010 07:36:27 +0000
Newsgroups gmane.linux.cluster.ssic.cvs
Message-ID <[email protected]>
Update of /cvsroot/ssic-linux/openssi/kernel/cluster/ssi/token
In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv19748/kernel/cluster/ssi/token

Modified Files:
      Tag: OPENSSI-FC
	clitok.c 
Log Message:
cluster/ssi/token/clitok.c
- tok_hold: return -EAGAIN for non-requests. cfstok_req() now looks for -EAGAIN for non-blocking requests.

cluster/ssi/token/clitok.c (#ifdef CLITOK_KMEM_CACHE)
- allocnrreq: don't wait for memory, just panic. this is the original behavior.
- allocnrreq: always inline. only one caller.
- allocnrreq: rename function to _allocnrreq().
- _allocnrrev: don't wait for memory, just panic. this is the original behavior.

cluster/ssi/token/clitok.c (#ifdef TOKEN_FIFO_LINUX_LIST)
- _process_req: invoke NSC_YIELD() if get_hold() was unsuccessful since it implies we should wait.


Index: clitok.c
===================================================================
RCS file: /cvsroot/ssic-linux/openssi/kernel/cluster/ssi/token/clitok.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- clitok.c	25 Oct 2010 04:43:26 -0000	1.11
+++ clitok.c	15 Dec 2010 07:36:25 -0000	1.12
@@ -359,13 +359,15 @@
 /*
  * Pull a request structure off the free list or allocate a new one
  */
-STATIC struct nrreq *
-allocnrreq(void)
+static inline struct nrreq *
+_allocnrreq(void)
 {
 	struct nrreq *reqp;
 
 #ifdef CLITOK_KMEM_CACHE
-	reqp = kmem_cache_alloc(nrreq_cachep, GFP_KERNEL|__GFP_NOFAIL);
+	reqp = kmem_cache_alloc(nrreq_cachep, GFP_KERNEL);
+	if (unlikely(reqp == NULL))
+		panic("%s: can't alloc request struct\n", __FUNCTION__);
 #ifdef TOKEN_FIFO_LINUX_LIST
 	INIT_LIST_HEAD(&reqp->req_list);
 #endif
@@ -454,7 +456,9 @@
 	struct nrrevoke *revp;
 
 #ifdef CLITOK_KMEM_CACHE
-	revp = kmem_cache_alloc(nrrevoke_cachep, GFP_KERNEL|__GFP_NOFAIL);
+	revp = kmem_cache_alloc(nrrevoke_cachep, GFP_KERNEL);
+	if (unlikely(revp == NULL))
+		panic("%s: can't alloc revoke struct\n", __FUNCTION__);
 #else
 	LOCK_SPIN_LOCK(&nrrev_free_lock);
 	if ((revp = nrrev_free)) {
@@ -505,8 +509,10 @@
 {
 	/* Re-process if processing wait list */
 	/* TOK_RECURSIVE flag can't get here, so passing 0 for flag is ok */
-	if (!get_hold(objp, reqp, 0))
+	if (!get_hold(objp, reqp, 0)) {
+		NSC_YIELD();
 		return;	/* Still not done yet */
+	}
 
 	complete_req(objp, reqp);
 }
@@ -700,11 +706,11 @@
 		if (!check_req(objp, tcbp, mode)) {
 DBG(DBGCLI|DBGSIM,("CLI M NOREQUEST_FAIL %s %d %s\n",
 	DSPOBJ(objp,str), agent, MSTR(objp,mode)));
-			return FALSE;
+			return -EAGAIN;
 		}
 	}
 	/* Allocate request structure to give to internal routine */
-	request = allocnrreq();
+	request = _allocnrreq();
 	request->req_mode = mode;
 	request->req_agent = agent;
 #if !defined(__KERNEL__) && SIMUL


------------------------------------------------------------------------------
Lotusphere 2011
Register now for Lotusphere 2011 and learn how
to connect the dots, take your collaborative environment
to the next level, and enter the era of Social Business.
http://p.sf.net/sfu/lotusphere-d2d