[PVFS2-CVS] commit by pcarns in pvfs2/src/io/flow/flowproto-bmi-trove: flowproto-multiqueue.c

CVS commit program cvs at parl.clemson.edu
Thu Feb 12 16:37:32 EST 2004


Update of /projects/cvsroot/pvfs2/src/io/flow/flowproto-bmi-trove
In directory parlweb:/tmp/cvs-serv10626/src/io/flow/flowproto-bmi-trove

Modified Files:
	flowproto-multiqueue.c 
Log Message:
more progress on flow error cleanup, cancel called for all pending bmi ops


Index: flowproto-multiqueue.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/io/flow/flowproto-bmi-trove/flowproto-multiqueue.c,v
diff -p -u -r1.52 -r1.53
--- flowproto-multiqueue.c	12 Feb 2004 20:51:32 -0000	1.52
+++ flowproto-multiqueue.c	12 Feb 2004 21:37:32 -0000	1.53
@@ -394,6 +394,7 @@ static void bmi_recv_callback_fn(void *u
     /* remove from current queue */
     qlist_del(&q_item->list_link);
     /* add to dest queue */
+    q_item->posted_id = 0;
     qlist_add_tail(&q_item->list_link, &flow_data->dest_list);
     result_tmp = &q_item->result_chain;
     do{
@@ -438,6 +439,7 @@ static void bmi_recv_callback_fn(void *u
 	q_item = qlist_entry(flow_data->empty_list.next,
 	    struct fp_queue_item, list_link);
 	qlist_del(&q_item->list_link);
+	q_item->posted_id = 0;
 	qlist_add_tail(&q_item->list_link, &flow_data->src_list);
 
 	if(!q_item->buffer)
@@ -491,6 +493,9 @@ static void bmi_recv_callback_fn(void *u
 	if(bytes_processed == 0)
 	{	
 	    gen_mutex_unlock(&flow_data->flow_mutex);
+	    qlist_del(&q_item->list_link);
+	    q_item->posted_id = 0;
+	    qlist_add_tail(&q_item->list_link, &flow_data->empty_list);
 	    return;
 	}
 
@@ -562,6 +567,7 @@ static void trove_read_callback_fn(void 
 
     /* remove from current queue */
     qlist_del(&q_item->list_link);
+    q_item->posted_id = 0;
     /* add to dest queue */
     qlist_add_tail(&q_item->list_link, &flow_data->dest_list);
 
@@ -708,6 +714,7 @@ static int bmi_send_callback_fn(void *us
     }
     
     /* add to src queue */
+    q_item->posted_id = 0;
     qlist_add_tail(&q_item->list_link, &flow_data->src_list);
 
     result_tmp = &q_item->result_chain;
@@ -908,6 +915,7 @@ static void trove_write_callback_fn(void
     if(qlist_empty(&flow_data->src_list))
     {
 	/* ready to post new recv! */
+	q_item->posted_id = 0;
 	qlist_add_tail(&q_item->list_link, &flow_data->src_list);
 	
 	result_tmp = &q_item->result_chain;
@@ -983,6 +991,7 @@ static void trove_write_callback_fn(void
     }
     else
     {
+	q_item->posted_id = 0;
 	qlist_add_tail(&q_item->list_link, 
 	    &(flow_data->empty_list));
     }
@@ -1493,22 +1502,30 @@ static int cancel_pending_bmi(struct qli
 {
     struct qlist_head* tmp_link;
     struct fp_queue_item* q_item = NULL;
+    int ret = 0;
+    int count = 0;
 
     /* run down the chain of pending operations */
     qlist_for_each(tmp_link, list)
     {
 	q_item = qlist_entry(tmp_link, struct fp_queue_item,
 	    list_link);
-	/* TODO: fill this in */
-
-	/* TODO: do something about the fact that not all of the BMI
-	 * operations on the list were necessarily posted; see use of "seq"
-	 * and "next_seq_to_send" elsewhere in code
-	 */
+	/* skip anything that is in the queue but not actually posted */
+	if(q_item->posted_id)
+	{
+	    count++;
+	    gossip_debug(GOSSIP_FLOW_PROTO_DEBUG,
+		"flowprotocol cleanup: unposting BMI operation.\n");
+	    ret = PINT_thread_mgr_bmi_cancel(q_item->posted_id,
+		&q_item->bmi_callback);
+	    if(ret < 0)
+	    {
+		gossip_err("WARNING: BMI cancel failed, proceeding anyway.\n");
+	    }
+	}
     }
 
-    assert(0);
-    return (0);
+    return (count);
 }
 
 /*



More information about the PVFS2-CVS mailing list