[Pvfs2-cvs] commit by kunkel in pvfs2/src/io/description: pint-request.h pint-request.c

CVS commit program cvs at parl.clemson.edu
Wed May 23 16:49:00 EDT 2007


Update of /projects/cvsroot/pvfs2/src/io/description
In directory parlweb1:/tmp/cvs-serv20193/src/io/description

Modified Files:
      Tag: pvfs2-kunkel-tas-branch
	pint-request.h pint-request.c 
Log Message:
Merge HEAD changes to TAS-branch.


Index: pint-request.h
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/io/description/pint-request.h,v
diff -p -u -r1.34 -r1.34.22.1
--- pint-request.h	18 May 2006 14:51:44 -0000	1.34
+++ pint-request.h	23 May 2007 20:48:59 -0000	1.34.22.1
@@ -108,9 +108,11 @@ typedef struct PINT_request_file_data_s 
     PVFS_boolean extend_flag;   /* if zero, file will not be extended */
 } PINT_request_file_data;
 
-struct PINT_Request_state *PINT_new_request_state (PINT_Request *request);
-
-void PINT_free_request_state (PINT_Request_state *req);
+struct PINT_Request_state *PINT_new_request_state(PINT_Request *request);
+void PINT_free_request_state(PINT_Request_state *req);
+struct PINT_Request_state *PINT_new_request_states(PINT_Request *request,
+                                                   int n);
+void PINT_free_request_states(PINT_Request_state *reqs);
 
 /* generate offset length pairs from request and dist */
 int PINT_process_request(PINT_Request_state *req,

Index: pint-request.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/io/description/pint-request.c,v
diff -p -u -r1.60 -r1.60.28.1
--- pint-request.c	17 Mar 2006 22:17:37 -0000	1.60
+++ pint-request.c	23 May 2007 20:48:59 -0000	1.60.28.1
@@ -448,49 +448,65 @@ static PVFS_offset PINT_request_disp(PIN
 /* processing a request */
 struct PINT_Request_state *PINT_new_request_state(PINT_Request *request)
 {
-	struct PINT_Request_state *req;
-	int32_t rqdepth;
-	gossip_debug(GOSSIP_REQUEST_DEBUG,"PINT_New_request_state\n");
-	if (!(req = (struct PINT_Request_state *)malloc(sizeof(struct PINT_Request_state))))
-	{
-		gossip_lerr("PINT_New_request_state failed to malloc req !!!!!!!\n");
-		return NULL;
-	}
-	req->lvl = 0;
-	req->bytes = 0;
-	req->type_offset = 0;
-	req->target_offset = 0;
-	req->final_offset = request->aggregate_size;
-	req->eof_flag = 0;
+    return PINT_new_request_states(request, 1);
+}
+
+struct PINT_Request_state *PINT_new_request_states(PINT_Request *request, int n)
+{
+	struct PINT_Request_state *reqs;
+	int rqdepth, i;
+
+	gossip_debug(GOSSIP_REQUEST_DEBUG, "%s n=%d\n", __func__, n);
+
 	/* we assume null request is a contiguous byte range depth 1 */
-	if (request)
-	{
-		rqdepth = request->depth;
-	}
-	else
-	{
-		rqdepth = 1;
-	}
-	if (!(req->cur = (struct PINT_reqstack *)malloc(rqdepth *
-			sizeof(struct PINT_reqstack))))
+    if (request)
+    {
+        rqdepth = request->depth;
+    }
+    else
+    {
+        rqdepth = 1;
+    }
+
+	reqs = malloc(n * (sizeof(*reqs) + rqdepth * sizeof(*reqs->cur)));
+	if (!reqs)
 	{
-		gossip_lerr("PINT_New_request_state failed to malloc rqstack !!!!!!\n");
+		gossip_lerr("%s: malloc failed\n", __func__);
 		return NULL;
 	}
-	req->cur[req->lvl].maxel = 1; /* transfer one instance of request */
-	req->cur[req->lvl].el = 0;
-	req->cur[req->lvl].rq = request;
-	req->cur[req->lvl].rqbase = request;
-	req->cur[req->lvl].blk = 0;
-	req->cur[req->lvl].chunk_offset = 0; /* transfer from inital file offset */
-	return req;
+
+    for (i=0; i<n; i++)
+    {
+        reqs[i].cur = (void *) &reqs[n];
+        reqs[i].cur += i * rqdepth;
+
+        reqs[i].lvl = 0;
+        reqs[i].bytes = 0;
+        reqs[i].type_offset = 0;
+        reqs[i].target_offset = 0;
+        reqs[i].final_offset = request->aggregate_size;
+        reqs[i].eof_flag = 0;
+
+        reqs[i].cur[0].maxel = 1; /* transfer one instance of request */
+        reqs[i].cur[0].el = 0;
+        reqs[i].cur[0].rq = request;
+        reqs[i].cur[0].rqbase = request;
+        reqs[i].cur[0].blk = 0;
+        reqs[i].cur[0].chunk_offset = 0; /* transfer from inital file offset */
+    }
+
+	return reqs;
 }
 
 /* This function frees request state structures */
-void PINT_free_request_state (PINT_Request_state *req)
+void PINT_free_request_state(PINT_Request_state *req)
 {
-	free(req->cur);
 	free(req);
+}
+
+void PINT_free_request_states(PINT_Request_state *reqs)
+{
+	free(reqs);
 }
 
 /**



More information about the Pvfs2-cvs mailing list