[SSI] openssi/kernel/cluster/ssi/token svrtok.c,1.9,1.10
Roger Tsang <[email protected]> Wed, 15 Dec 2010 07:38:31 +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-serv19895/kernel/cluster/ssi/token
Modified Files:
Tag: OPENSSI-FC
svrtok.c
Log Message:
cluster/ssi/token/svrtok.c (#ifdef SSI_CFS_FULLTIMES)
- comment out unused code.
cluster/ssi/token/svrtok.c (#ifdef NRSVRFIFO_LINUX_LIST)
- svrdeletefifo: comment out. no longer used.
- svrtok_clear: remove needless moving back and forth between lists.
- use list_del() instead of list_del_init() where appropriate.
cluster/ssi/token/svrtok.c (#ifdef SVRTOK_KMEM_CACHE)
- allocnrwant: don't wait for memory, just panic. this is the original behavior.
- svrallocnode: don't wait for memory, just panic. this is the original behavior.
Index: svrtok.c
===================================================================
RCS file: /cvsroot/ssic-linux/openssi/kernel/cluster/ssi/token/svrtok.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- svrtok.c 17 Dec 2009 06:43:51 -0000 1.9
+++ svrtok.c 15 Dec 2010 07:38:29 -0000 1.10
@@ -77,7 +77,9 @@
STATIC void freenrwant(struct nrwant *wantp);
STATIC int process_give(object_t *objp, nrsvrtcb_t *tcb, struct node_ent **nodepp);
STATIC struct node_ent *svrallocnode( agent_t agent, int mode, short flags);
+#ifdef SSI_CFS_FULLTIMES
STATIC void query(object_t *objp, nrsvrtcb_t *tcbp, agent_t agent, int mode);
+#endif
STATIC int svrtok_notokens(nrsvrtcb_t *tcbp);
#ifdef SIMUL
@@ -126,6 +128,8 @@
#endif
}
+/* Called with sct_tcblock locked for nd_givefifo */
+/* Called with c_tcblock locked for tok_reqfifo */
#ifdef NRSVRFIFO_LINUX_LIST
static inline void
#else
@@ -151,20 +155,12 @@
#endif
}
+#ifndef NRSVRFIFO_LINUX_LIST
STATIC struct nrwant *
svrdeletefifo(nrsvrfifo_t *fifop)
{
struct nrwant *save_req;
-#ifdef NRSVRFIFO_LINUX_LIST
- struct list_head *pos;
- __list_for_each(pos, fifop) {
- save_req = list_entry(pos, typeof(*save_req), wan_list);
- list_del_init(&save_req->wan_list);
- return save_req;
- }
- return NULL;
-#else
/* If the list is empty return NULL */
if (fifop->fifo_req_begin == NULL)
return NULL;
@@ -174,9 +170,9 @@
if (fifop->fifo_req_begin == NULL)
fifop->fifo_req_end = NULL;
save_req->wan_next = NULL;
-#endif
return(save_req);
}
+#endif /* !NRSVRFIFO_LINUX_LIST */
/*
* Copy a fifo. (NOT GENERAL PURPOSE)
@@ -240,7 +236,9 @@
SSI_ASSERT(agent != 0);
#ifdef SVRTOK_KMEM_CACHE
- newnode = kmem_cache_alloc(node_ent_cachep, GFP_KERNEL|__GFP_NOFAIL);
+ newnode = kmem_cache_alloc(node_ent_cachep, GFP_KERNEL);
+ if (unlikely(newnode == NULL))
+ panic("%s: can't alloc node struct\n", __FUNCTION__);
#else
LOCK_SPIN_LOCK(&node_free_lock);
if ((newnode = node_free)) {
@@ -580,7 +578,7 @@
/* Toss giveback fifo */
list_for_each_entry_safe(wantp, tmp, &((*savepp)->nd_givefifo), wan_list) {
- list_del_init(&wantp->wan_list);
+ list_del(&wantp->wan_list);
freenrwant(wantp);
}
#else
@@ -676,7 +674,9 @@
struct nrwant *wantp;
#ifdef SVRTOK_KMEM_CACHE
- wantp = kmem_cache_alloc(nrwant_cachep, GFP_KERNEL|__GFP_NOFAIL);
+ wantp = kmem_cache_alloc(nrwant_cachep, GFP_KERNEL);
+ if (unlikely(wantp == NULL))
+ panic("%s: can't alloc want struct\n", __FUNCTION__);
#ifdef NRSVRFIFO_LINUX_LIST
INIT_LIST_HEAD(&wantp->wan_list);
#endif
@@ -840,7 +840,7 @@
progress = TRUE;
#ifdef NRSVRFIFO_LINUX_LIST
- list_del_init(&wantp->wan_list);
+ list_del(&wantp->wan_list);
#endif
/* Process giveback */
(*nodepp)->nd_mode = wantp->wan_newmode;
@@ -1225,18 +1225,11 @@
for (nptr = tcbp->tok_ndlist; nptr; nptr = nptr->nd_next) {
if (GT_AGENT(nptr->nd_agent, agent))
break;
- if (EQ_AGENT(agent, nptr->nd_agent)) {
- if (nptr->nd_mode == oldmode) {
- return TRUE;
- } else {
- return FALSE;
- }
- }
+ if (EQ_AGENT(agent, nptr->nd_agent))
+ return (nptr->nd_mode == oldmode);
}
/* Server doesn't have this agent on list, he must have TOK_NOMODE */
- if (oldmode != TOK_NOMODE)
- return FALSE;
- return TRUE;
+ return (oldmode == TOK_NOMODE);
}
int
@@ -1309,7 +1302,6 @@
return;
}
-
wantp = allocnrwant();
wantp->wan_agent = agent;
wantp->wan_oldmode = oldmode;
@@ -1468,6 +1460,7 @@
} else
svrinsertfifo(&tcbp->tok_reqfifo, wantp);
+#ifdef SSI_CFS_FULLTIMES
if (wantp->wan_flags & SVRTOK_QUERY) {
struct node_ent *nptr;
@@ -1488,12 +1481,15 @@
nptr->nd_flags &= ~ND_QUERYDONE;
}
}
+#endif
if (!svrcheck_compat(objp, tcbp, oldmodep)) {
+#ifdef SSI_CFS_FULLTIMES
if (wantp->wan_flags & SVRTOK_QUERY)
query(objp, wantp->wan_tcbp, wantp->wan_agent,
wantp->wan_newmode);
else
+#endif
revoke(objp, wantp->wan_tcbp, wantp->wan_agent,
wantp->wan_newmode);
return FALSE;
@@ -1518,6 +1514,7 @@
char str[DBGSTRLEN];
#endif
+#ifdef SSI_CFS_FULLTIMES
/* The query operation can't test for compat, because
* clients don't RETURN tokens when being queried.
*/
@@ -1563,6 +1560,7 @@
svr_process_req(objp, &fifo);
return TRUE;
}
+#endif /* SSI_CFS_FULLTIMES */
/* If overlapping a range already given away in an
* incompatible way, then revoke it.
@@ -1572,12 +1570,14 @@
return FALSE;
/* We have a compatible entry, so pull from request list */
- wantp = svrdeletefifo(&(tcbp->tok_reqfifo));
-
#ifdef NRSVRFIFO_LINUX_LIST
+ list_del(&wantp->wan_list);
+
INIT_LIST_HEAD(&fifo);
list_splice_init(&tcbp->tok_reqfifo, &fifo);
#else
+ wantp = svrdeletefifo(&tcbp->tok_reqfifo);
+
fifo = tcbp->tok_reqfifo;
svrinitfifo(&(tcbp->tok_reqfifo));
#endif
@@ -1589,7 +1589,7 @@
*/
SSI_ASSERT(ret != YOUGOTIT);
#ifdef NSCTOK_SAFE
- if (!(ret != YOUGOTIT) {
+ if (!(ret != YOUGOTIT)) {
printk(KERN_INFO "request_internal: bad client request\n");
goto out_free;
}
@@ -1705,6 +1705,7 @@
}
}
+#ifdef SSI_CFS_FULLTIMES
/* This routine sends query to all clients with token attached to struct
* NSC_XXX: This has similiar code to compat()
*/
@@ -1745,6 +1746,7 @@
}
SSI_ASSERT(found);
}
+#endif /* SSI_CFS_FULLTIMES */
/* Return TRUE if no outstanding tokens */
STATIC int
@@ -1806,7 +1808,7 @@
/* Clear request list */
#ifdef NRSVRFIFO_LINUX_LIST
list_for_each_entry_safe(wantp, tmp, &tcbp->tok_reqfifo, wan_list) {
- list_del_init(&wantp->wan_list);
+ list_del(&wantp->wan_list);
#else
while((wantp = svrdeletefifo(&(tcbp->tok_reqfifo)))) {
#endif
@@ -1823,7 +1825,7 @@
/* Delete giveback fifo */
#ifdef NRSVRFIFO_LINUX_LIST
list_for_each_entry_safe(wantp, tmp, &tcbp->tok_ndlist->nd_givefifo, wan_list) {
- list_del_init(&wantp->wan_list);
+ list_del(&wantp->wan_list);
freenrwant(wantp);
}
#else
@@ -1950,23 +1952,20 @@
*/
#ifdef NRSVRFIFO_LINUX_LIST
if (_tok_wantptr(tcbp)) {
+ struct nrwant *tmp, *wantp = tok_wantptr(tcbp);
+ int i = 0;
#else
if (tcbp->tok_wantptr) {
-#endif
struct nrwant *wantp;
-#ifdef NRSVRFIFO_LINUX_LIST
- struct nrwant *tmp;
-#endif
nrsvrfifo_t fifo;
/* Rebuild fifo removing down node */
-#ifdef NRSVRFIFO_LINUX_LIST
- INIT_LIST_HEAD(&fifo);
- list_splice_init(&tcbp->tok_reqfifo, &fifo);
-#else
fifo = tcbp->tok_reqfifo;
svrinitfifo(&(tcbp->tok_reqfifo));
-#endif
+
+ /* Remove first entry */
+ wantp = svrdeletefifo(&fifo);
+#endif /* !NRSVRFIFO_LINUX_LIST */
/* If down node is the front of the want list, leave it there
* because we've sent revokes already. We can't have more
@@ -1974,8 +1973,6 @@
* NOAGENT, so when we are able to proceed we won't
* try granting the token to a down node.
*/
- /* Remove first entry */
- wantp = svrdeletefifo(&fifo);
/* The wan_agent value of a query really doesn't
* matter, there is a server thread waiting for the query
@@ -1987,28 +1984,35 @@
wantp->wan_agent = NOAGENT;
}
+#ifdef NRSVRFIFO_LINUX_LIST
+ /* Remove the cleared agent from any other want entries */
+ list_for_each_entry_safe(wantp, tmp,
+ &tcbp->tok_reqfifo, wan_list) {
+ /* Keep first list entry */
+ /* Put place holder at front of list */
+ if (i == 0) {
+ i = 1;
+ continue;
+ }
+ if (!(wantp->wan_flags & SVRTOK_QUERY) &&
+ EQ_AGENT(wantp->wan_agent, agent)) {
+ list_del(&wantp->wan_list);
+ freenrwant(wantp);
+ }
+ }
+#else
/* Put place holder at front of list */
svrinsertfifo(&(tcbp->tok_reqfifo), wantp);
/* Remove the cleared agent from any other want entries */
-#ifdef NRSVRFIFO_LINUX_LIST
- list_for_each_entry_safe(wantp, tmp, &fifo, wan_list) {
-#else
while((wantp = svrdeletefifo(&fifo))) {
-#endif
if (!(wantp->wan_flags & SVRTOK_QUERY) &&
EQ_AGENT(wantp->wan_agent, agent)) {
-#ifdef NRSVRFIFO_LINUX_LIST
- list_del(&wantp->wan_list);
-#endif
freenrwant(wantp);
} else
-#ifdef NRSVRFIFO_LINUX_LIST
- list_move(&wantp->wan_list, &tcbp->tok_reqfifo);
-#else
svrinsertfifo(&(tcbp->tok_reqfifo), wantp);
-#endif
}
+#endif /* !NRSVRFIFO_LINUX_LIST */
}
/* Go through the standard processing for handling RETURN messages */
@@ -2024,6 +2028,7 @@
return svrtok_notokens(tcbp);
}
+#ifdef SSI_CFS_FULLTIMES
/*
* SMP: Caller must prevent another svrtok_*() routine from being
* called until this completes
@@ -2372,6 +2377,7 @@
ret = svrtok_notokens(tcbp);
return ret;
}
+#endif /* SSI_CFS_FULLTIMES */
/*
* svrtok_equal(objp, tcbp1, tcbp2)
------------------------------------------------------------------------------
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