CVS: intermezzo/fs25 psdev.c,1.1,1.2 replicator.c,1.2,1.3

Chen Yang <[email protected]> Tue, 30 Sep 2003 08:51:54 -0700
Newsgroups gmane.comp.file-systems.intermezzo.cvs
Message-ID <[email protected]>
Update of /cvsroot/intermezzo/intermezzo/fs25
In directory sc8-pr-cvs1:/tmp/cvs-serv25410/intermezzo/fs25

Modified Files:
	psdev.c replicator.c 
Log Message:
Applied and tested Domen Puncer's patch to fs25/fs24 part code for list related processing
Applied and tested Renaud Duhaut([email protected])'s patch to solve fs24's InterMezzo's SLAB allocator leakage problem, on 2.4 kernel, now it can insmod and run, then rmmod. Insmod again won't cause Oops any more. :-)



Index: psdev.c
===================================================================
RCS file: /cvsroot/intermezzo/intermezzo/fs25/psdev.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -U2 -r1.1 -r1.2
--- psdev.c	11 Oct 2002 22:52:01 -0000	1.1
+++ psdev.c	30 Sep 2003 15:51:52 -0000	1.2
@@ -103,6 +103,5 @@
                 struct upc_req *req;
                 CERROR("WARNING: setpid & processing not empty!\n");
-                lh = &channel->uc_processing;
-                while ( (lh = lh->next) != &channel->uc_processing) {
+		list_for_each(lh, &channel->uc_processing) {
                         req = list_entry(lh, struct upc_req, rq_chain);
                         /* freeing of req and data is done by the sleeper */
@@ -209,6 +208,5 @@
         spin_lock(&channel->uc_lock); 
         /* Look for the message on the processing queue. */
-        lh  = &channel->uc_processing;
-        while ( (lh = lh->next) != &channel->uc_processing ) {
+	list_for_each(lh, &channel->uc_processing) {
                 tmp = list_entry(lh, struct upc_req , rq_chain);
                 if (tmp->rq_unique == hdr.unique) {
@@ -341,6 +339,5 @@
         CDEBUG(D_PSDEV, "Wake up clients sleeping for pending.\n");
         spin_lock(&channel->uc_lock); 
-        lh = &channel->uc_pending;
-        while ( (lh = lh->next) != &channel->uc_pending) {
+	list_for_each(lh, &channel->uc_pending) {
                 req = list_entry(lh, struct upc_req, rq_chain);
 
@@ -355,6 +352,5 @@
 
         CDEBUG(D_PSDEV, "Wake up clients sleeping for processing\n");
-        lh = &channel->uc_processing;
-        while ( (lh = lh->next) != &channel->uc_processing) {
+	list_for_each(lh, &channel->uc_processing) {
                 req = list_entry(lh, struct upc_req, rq_chain);
                 /* freeing of req and data is done by the sleeper */
@@ -422,5 +418,5 @@
         for ( i = 0 ; i < MAX_CHANNEL ; i++ ) {
                 struct upc_channel *channel = &(izo_channels[i]);
-                struct list_head *lh;
+                struct list_head *lh, *next;
 
                 spin_lock(&channel->uc_lock); 
@@ -434,10 +430,8 @@
                         CERROR("Weird, tell Peter: module cleanup and cache listnot empty dev %d\n", i);
                 }
-                lh = channel->uc_pending.next;
-                while ( lh != &channel->uc_pending) {
+		list_for_each_safe(lh, next, &channel->uc_pending) {
                         struct upc_req *req;
 
                         req = list_entry(lh, struct upc_req, rq_chain);
-                        lh = lh->next;
                         if ( req->rq_flags & REQ_ASYNC ) {
                                 list_del(&(req->rq_chain));
@@ -451,6 +445,5 @@
                         }
                 }
-                lh = &channel->uc_processing;
-                while ( (lh = lh->next) != &channel->uc_processing ) {
+		list_for_each(lh, &channel->uc_processing) {
                         struct upc_req *req;
                         req = list_entry(lh, struct upc_req, rq_chain);

Index: replicator.c
===================================================================
RCS file: /cvsroot/intermezzo/intermezzo/fs25/replicator.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -U2 -r1.2 -r1.3
--- replicator.c	26 Jun 2003 06:14:43 -0000	1.2
+++ replicator.c	30 Sep 2003 15:51:52 -0000	1.3
@@ -97,9 +97,8 @@
 izo_rep_cache_find(struct presto_file_set *fset, char *uuid)
 {
-	struct list_head *buck = izo_rep_hash(fset->fset_clients, uuid);
-	struct list_head *tmp = buck;
+	struct list_head *tmp, *buck = izo_rep_hash(fset->fset_clients, uuid);
         struct izo_offset_rec *rec = NULL;
 
-        while ( (tmp = tmp->next) != buck ) {
+	list_for_each(tmp, buck) {
 		rec = list_entry(tmp, struct izo_offset_rec, or_list);
                 if ( memcmp(rec->or_uuid, uuid, sizeof(rec->or_uuid)) == 0 )



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf