[Cbe-oss-dev] [PATCH 07/13]MARS/core: Workload queue fix error handling

Yuji Mano yuji.mano at am.sony.com
Fri Dec 12 15:33:42 EST 2008


This fixes some of the returned error codes and error handling inside the
workload queue implementation.

Signed-off-by: Yuji Mano <yuji.mano at am.sony.com>

---
Index: mars-src/core/src/host/lib/workload_queue.c
===================================================================
--- mars-src.orig/core/src/host/lib/workload_queue.c
+++ mars-src/core/src/host/lib/workload_queue.c
@@ -155,7 +155,7 @@ int mars_workload_queue_destroy(struct m
 	if (!mars)
 		return MARS_ERROR_NULL;
 	if (!mars->workload_queue_ea)
-		return MARS_ERROR_STATE;
+		return MARS_ERROR_PARAMS;
 
 	queue_ea = mars->workload_queue_ea;
 
@@ -195,7 +195,7 @@ int mars_workload_queue_exit(struct mars
 	if (!mars)
 		return MARS_ERROR_NULL;
 	if (!mars->workload_queue_ea)
-		return MARS_ERROR_STATE;
+		return MARS_ERROR_PARAMS;
 
 	queue_ea = mars->workload_queue_ea;
 
@@ -220,7 +220,7 @@ int mars_workload_queue_add_begin(struct
 	if (!mars)
 		return MARS_ERROR_NULL;
 	if (!mars->workload_queue_ea)
-		return MARS_ERROR_STATE;
+		return MARS_ERROR_PARAMS;
 	if (!id)
 		return MARS_ERROR_NULL;
 
@@ -256,12 +256,6 @@ int mars_workload_queue_add_begin(struct
 		bits = mars_ea_get_uint64(bits_ea);
 	}
 
-	/* check for valid state */
-	if (MARS_BITS_GET(&bits, STATE) != MARS_WORKLOAD_STATE_NONE) {
-		mars_mutex_unlock(block_ea);
-		return MARS_ERROR_STATE;
-	}
-
 	/* set state to adding */
 	MARS_BITS_SET(&bits, STATE, MARS_WORKLOAD_STATE_ADDING);
 
@@ -289,7 +283,7 @@ int mars_workload_queue_add_end(struct m
 	if (!mars)
 		return MARS_ERROR_NULL;
 	if (!mars->workload_queue_ea)
-		return MARS_ERROR_STATE;
+		return MARS_ERROR_PARAMS;
 	if (id >= MARS_WORKLOAD_MAX)
 		return MARS_ERROR_PARAMS;
 
@@ -337,7 +331,7 @@ int mars_workload_queue_add_cancel(struc
 	if (!mars)
 		return MARS_ERROR_NULL;
 	if (!mars->workload_queue_ea)
-		return MARS_ERROR_STATE;
+		return MARS_ERROR_PARAMS;
 	if (id >= MARS_WORKLOAD_MAX)
 		return MARS_ERROR_PARAMS;
 
@@ -386,7 +380,7 @@ int mars_workload_queue_remove_begin(str
 	if (!mars)
 		return MARS_ERROR_NULL;
 	if (!mars->workload_queue_ea)
-		return MARS_ERROR_STATE;
+		return MARS_ERROR_PARAMS;
 	if (id >= MARS_WORKLOAD_MAX)
 		return MARS_ERROR_PARAMS;
 
@@ -438,7 +432,7 @@ int mars_workload_queue_remove_end(struc
 	if (!mars)
 		return MARS_ERROR_NULL;
 	if (!mars->workload_queue_ea)
-		return MARS_ERROR_STATE;
+		return MARS_ERROR_PARAMS;
 	if (id >= MARS_WORKLOAD_MAX)
 		return MARS_ERROR_PARAMS;
 
@@ -486,7 +480,7 @@ int mars_workload_queue_remove_cancel(st
 	if (!mars)
 		return MARS_ERROR_NULL;
 	if (!mars->workload_queue_ea)
-		return MARS_ERROR_STATE;
+		return MARS_ERROR_PARAMS;
 	if (id >= MARS_WORKLOAD_MAX)
 		return MARS_ERROR_PARAMS;
 
@@ -535,7 +529,7 @@ int mars_workload_queue_schedule_begin(s
 	if (!mars)
 		return MARS_ERROR_NULL;
 	if (!mars->workload_queue_ea)
-		return MARS_ERROR_STATE;
+		return MARS_ERROR_PARAMS;
 	if (id >= MARS_WORKLOAD_MAX)
 		return MARS_ERROR_PARAMS;
 
@@ -591,7 +585,7 @@ int mars_workload_queue_schedule_end(str
 	if (!mars)
 		return MARS_ERROR_NULL;
 	if (!mars->workload_queue_ea)
-		return MARS_ERROR_STATE;
+		return MARS_ERROR_PARAMS;
 	if (id >= MARS_WORKLOAD_MAX)
 		return MARS_ERROR_PARAMS;
 
@@ -639,7 +633,7 @@ int mars_workload_queue_schedule_cancel(
 	if (!mars)
 		return MARS_ERROR_NULL;
 	if (!mars->workload_queue_ea)
-		return MARS_ERROR_STATE;
+		return MARS_ERROR_PARAMS;
 	if (id >= MARS_WORKLOAD_MAX)
 		return MARS_ERROR_PARAMS;
 
@@ -706,7 +700,7 @@ int mars_workload_queue_wait(struct mars
 	if (!mars)
 		return MARS_ERROR_NULL;
 	if (!mars->workload_queue_ea)
-		return MARS_ERROR_STATE;
+		return MARS_ERROR_PARAMS;
 	if (id >= MARS_WORKLOAD_MAX)
 		return MARS_ERROR_PARAMS;
 
@@ -748,7 +742,7 @@ int mars_workload_queue_try_wait(struct 
 	if (!mars)
 		return MARS_ERROR_NULL;
 	if (!mars->workload_queue_ea)
-		return MARS_ERROR_STATE;
+		return MARS_ERROR_PARAMS;
 	if (id >= MARS_WORKLOAD_MAX)
 		return MARS_ERROR_PARAMS;
 
@@ -793,7 +787,7 @@ int mars_workload_queue_signal_send(stru
 	if (!mars)
 		return MARS_ERROR_NULL;
 	if (!mars->workload_queue_ea)
-		return MARS_ERROR_STATE;
+		return MARS_ERROR_PARAMS;
 	if (id >= MARS_WORKLOAD_MAX)
 		return MARS_ERROR_PARAMS;
 






More information about the cbe-oss-dev mailing list