[PVFS2-CVS]
commit by bradles in pvfs2/src/io/description: dist-basic.c
dist-simple-stripe.c pint-distribution.h pint-request.c
pint-request.h pvfs-distribution.h pvfs-request.c
CVS commit program
cvs at parl.clemson.edu
Thu Jul 7 12:34:41 EDT 2005
Update of /projects/cvsroot/pvfs2/src/io/description
In directory parlweb:/tmp/cvs-serv18205/src/io/description
Modified Files:
dist-basic.c dist-simple-stripe.c pint-distribution.h
pint-request.c pint-request.h pvfs-distribution.h
pvfs-request.c
Log Message:
Updating request and distribution code to allow for secondary data servers.
Also converted naming of functions in pint-request.h to the PVFS2 standard.
Index: dist-basic.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/io/description/dist-basic.c,v
diff -p -u -r1.7 -r1.8
--- dist-basic.c 6 Aug 2004 18:26:53 -0000 1.7
+++ dist-basic.c 7 Jul 2005 15:34:40 -0000 1.8
@@ -17,32 +17,28 @@
/* in this distribution all data is stored on a single server */
static PVFS_offset logical_to_physical_offset(void* params,
- uint32_t server_nr,
- uint32_t server_ct,
+ PINT_request_file_data* fd,
PVFS_offset logical_offset)
{
return logical_offset;
}
static PVFS_offset physical_to_logical_offset(void* params,
- uint32_t server_nr,
- uint32_t server_ct,
+ PINT_request_file_data* fd,
PVFS_offset physical_offset)
{
return physical_offset;
}
static PVFS_offset next_mapped_offset(void* params,
- uint32_t server_nr,
- uint32_t server_ct,
+ PINT_request_file_data* fd,
PVFS_offset logical_offset)
{
return logical_offset;
}
static PVFS_size contiguous_length(void* params,
- uint32_t server_nr,
- uint32_t server_ct,
+ PINT_request_file_data* fd,
PVFS_offset physical_offset)
{
return CONTIGBLOCKSZ;
Index: dist-simple-stripe.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/io/description/dist-simple-stripe.c,v
diff -p -u -r1.8 -r1.9
--- dist-simple-stripe.c 29 Jun 2005 14:58:49 -0000 1.8
+++ dist-simple-stripe.c 7 Jul 2005 15:34:40 -0000 1.9
@@ -14,14 +14,15 @@
#include "pvfs2-dist-simple-stripe.h"
static PVFS_offset logical_to_physical_offset (void* params,
- uint32_t server_nr,
- uint32_t server_ct,
+ PINT_request_file_data* fd,
PVFS_offset logical_offset)
{
PVFS_offset ret_offset = 0;
int full_stripes = 0;
PVFS_size leftover = 0;
PVFS_simple_stripe_params* dparam = (PVFS_simple_stripe_params*)params;
+ uint32_t server_nr = fd->server_nr;
+ uint32_t server_ct = fd->server_ct;
/* how many complete stripes are in there? */
full_stripes = logical_offset / (dparam->strip_size*server_ct);
@@ -41,11 +42,12 @@ static PVFS_offset logical_to_physical_o
}
static PVFS_offset physical_to_logical_offset (void* params,
- uint32_t server_nr,
- uint32_t server_ct,
+ PINT_request_file_data* fd,
PVFS_offset physical_offset)
{
PVFS_simple_stripe_params* dparam = (PVFS_simple_stripe_params*)params;
+ uint32_t server_nr = fd->server_nr;
+ uint32_t server_ct = fd->server_ct;
PVFS_size strips_div = physical_offset / dparam->strip_size;
PVFS_size strips_mod = physical_offset % dparam->strip_size;
PVFS_offset acc = 0;
@@ -65,14 +67,15 @@ static PVFS_offset physical_to_logical_o
}
static PVFS_offset next_mapped_offset (void* params,
- uint32_t server_nr,
- uint32_t server_ct,
+ PINT_request_file_data* fd,
PVFS_offset logical_offset)
{
PVFS_offset diff; /* distance of loff from beginning of strip in this stripe */
PVFS_size stripe_size; /* not to be confused with strip size */
PVFS_offset server_starting_offset; /* offset of strip from start of stripe */
PVFS_simple_stripe_params* dparam = (PVFS_simple_stripe_params*)params;
+ uint32_t server_nr = fd->server_nr;
+ uint32_t server_ct = fd->server_ct;
server_starting_offset = server_nr * dparam->strip_size;
stripe_size = server_ct * dparam->strip_size;
@@ -90,8 +93,7 @@ static PVFS_offset next_mapped_offset (v
}
static PVFS_size contiguous_length(void* params,
- uint32_t server_nr,
- uint32_t server_ct,
+ PINT_request_file_data* fd,
PVFS_offset physical_offset)
{
PVFS_simple_stripe_params* dparam = (PVFS_simple_stripe_params*)params;
@@ -107,13 +109,19 @@ static PVFS_size logical_file_size(void*
PVFS_size tmp_max = 0;
int s = 0;
PVFS_simple_stripe_params* dparam = (PVFS_simple_stripe_params*)params;
+ PINT_request_file_data file_data;
if (!psizes)
return -1;
+
+ /* Initialize file data struct */
+ memset(&file_data, 0, sizeof(file_data));
+ file_data.server_ct = server_ct;
+
for (s = 0; s < server_ct; s++)
{
- tmp_max = physical_to_logical_offset(dparam,
- s, server_ct, psizes[s]);
+ file_data.server_nr = s;
+ tmp_max = physical_to_logical_offset(dparam, &file_data, psizes[s]);
if(tmp_max > max)
max = tmp_max;
}
@@ -134,7 +142,7 @@ static void decode_lebf(char **pptr, voi
static void registration_init(void* params)
{
- PINT_dist_register_param("simple_stripe", "strip_size",
+ PINT_dist_register_param(PVFS_DIST_SIMPLE_STRIPE_NAME, "strip_size",
PVFS_simple_stripe_params, strip_size);
}
Index: pint-distribution.h
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/io/description/pint-distribution.h,v
diff -p -u -r1.11 -r1.12
--- pint-distribution.h 2 Dec 2004 18:11:18 -0000 1.11
+++ pint-distribution.h 7 Jul 2005 15:34:40 -0000 1.12
@@ -7,47 +7,44 @@
#ifndef __PINT_DISTRIBUTION_H
#define __PINT_DISTRIBUTION_H
+#include "pint-request.h"
#include "pvfs2-types.h"
/* Distribution table size limits */
#define PINT_DIST_NAME_SZ 32
/* Distribution functions that must be supplied by each dist implmentation */
-typedef struct PINT_dist_methods_s {
-
+typedef struct PINT_dist_methods_s
+{
/* Returns the physical storage offset for a logical file offset */
PVFS_offset (*logical_to_physical_offset)(void* params,
- uint32_t server_nr,
- uint32_t server_ct,
+ PINT_request_file_data* rf_data,
PVFS_offset logical_offset);
/* Returns the logical file offset for a given physical storage offset */
PVFS_offset (*physical_to_logical_offset)(void* params,
- uint32_t server_nr,
- uint32_t server_ct,
+ PINT_request_file_data* rf_data,
PVFS_offset physical_offset);
/* Returns the next physical offset for the file on server_nr given an
* arbitraty logical offset (i.e. an offset anywhere in the file) */
PVFS_offset (*next_mapped_offset)(void* params,
- uint32_t server_nr,
- uint32_t server_ct,
+ PINT_request_file_data* rf_data,
PVFS_offset logical_offset);
/* Returns the contiguous length of file data starting at physical_offset*/
PVFS_size (*contiguous_length)(void* params,
- uint32_t server_nr,
- uint32_t server_ct,
+ PINT_request_file_data* rf_data,
PVFS_offset physical_offset);
/* Returns the logical file size */
PVFS_size (*logical_file_size)(void* params,
- uint32_t server_ct,
+ uint32_t num_handles,
PVFS_size *psizes);
/* Returns the number of data file objects to use for a file */
int (*get_num_dfiles)(void* params,
- uint32_t num_servers_requested,
+ uint32_t num_servers_available,
uint32_t num_dfiles_requested);
/* Sets the parameter designated by name to the given value */
Index: pint-request.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/io/description/pint-request.c,v
diff -p -u -r1.50 -r1.51
--- pint-request.c 27 May 2005 19:27:04 -0000 1.50
+++ pint-request.c 7 Jul 2005 15:34:40 -0000 1.51
@@ -4,6 +4,7 @@
* See COPYING in top-level directory.
*/
+#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
@@ -13,7 +14,7 @@
#include <pint-request.h>
#include <pint-distribution.h>
-static int PINT_Request_disp(PINT_Request *request);
+static int PINT_request_disp(PINT_Request *request);
/* this macro is only used in this file to add a segment to the
* result list.
@@ -58,10 +59,9 @@ do { \
/* chunks are done. Returns the number of bytes processed. It */
/* is assumed caller we retry if this is less than the total bytes */
/* in the request */
-
-int PINT_Process_request(PINT_Request_state *req,
+int PINT_process_request(PINT_Request_state *req,
PINT_Request_state *mem,
- PINT_Request_file_data *rfdata,
+ PINT_request_file_data *rfdata,
PINT_Request_result *result,
int mode)
{
@@ -70,26 +70,26 @@ int PINT_Process_request(PINT_Request_st
PVFS_offset contig_offset; /* temp for offset of a contig region */
PVFS_size contig_size; /* temp for size of a contig region */
PVFS_size retval; /* return value from calls to distribute */
- gossip_debug(GOSSIP_REQUEST_DEBUG,"PINT_Process_request\n");
+ gossip_debug(GOSSIP_REQUEST_DEBUG,"PINT_process_request\n");
/* do very basic error checking here */
if (!req)
{
- gossip_lerr("PINT_Process_request: Bad PINT_Request_state!\n");
+ gossip_lerr("PINT_process_request: Bad PINT_Request_state!\n");
return -1;
}
if (!result || !result->segmax || !result->bytemax)
{
- gossip_lerr("PINT_Process_request: NULL segmax or bytemax!\n");
+ gossip_lerr("PINT_process_request: NULL segmax or bytemax!\n");
return -1;
}
if (result->segs >= result->segmax || result->bytes >= result->bytemax)
{
- gossip_lerr("PINT_Process_request: no segments or bytes requested!\n");
+ gossip_lerr("PINT_process_request: no segments or bytes requested!\n");
return -1;
}
if (!PINT_IS_CKSIZE(mode) && (!result->offset_array || !result->size_array))
{
- gossip_lerr("PINT_Process_request: NULL offset or size array!\n");
+ gossip_lerr("PINT_process_request: NULL offset or size array!\n");
return -1;
}
/* initialize some variables */
@@ -98,7 +98,7 @@ int PINT_Process_request(PINT_Request_st
if (req->start_offset == -1)
{
/* this indicates we already finished the request */
- gossip_lerr("PINT_Process_request: start offset -1!\n");
+ gossip_lerr("PINT_process_request: start offset -1!\n");
return 0;
}
#endif
@@ -222,7 +222,7 @@ int PINT_Process_request(PINT_Request_st
gossip_debug(GOSSIP_REQUEST_DEBUG,"\tbasic type or contiguous data\n");
contig_offset = req->cur[req->lvl].rq->offset +
req->cur[req->lvl].chunk_offset + req->bytes +
- PINT_Request_disp(req->cur[req->lvl].rq);
+ PINT_request_disp(req->cur[req->lvl].rq);
contig_size = (req->cur[req->lvl].maxel *
req->cur[req->lvl].rq->aggregate_size) - req->bytes;
lvl_flag = 1;
@@ -240,7 +240,7 @@ int PINT_Process_request(PINT_Request_st
req->cur[req->lvl].rqbase->lb)) +
req->cur[req->lvl].rq->offset + (req->cur[req->lvl].rq->stride *
req->cur[req->lvl].blk) + req->bytes +
- PINT_Request_disp(req->cur[req->lvl].rq);
+ PINT_request_disp(req->cur[req->lvl].rq);
contig_size = (req->cur[req->lvl].rq->ereq->aggregate_size *
req->cur[req->lvl].rq->num_ereqs) - req->bytes;
lvl_flag = 0;
@@ -252,7 +252,7 @@ int PINT_Process_request(PINT_Request_st
if (!req->cur[req->lvl].rq->ereq ||
req->lvl+1 >= req->cur[0].rqbase->depth)
{
- gossip_lerr("PINT_Process_request exceeded request depth - possibly corrupted request or request state\n");
+ gossip_lerr("PINT_process_request exceeded request depth - possibly corrupted request or request state\n");
return -1;
}
req->cur[req->lvl+1].el = 0;
@@ -350,9 +350,21 @@ int PINT_Process_request(PINT_Request_st
else
{
/* we process the whole thing at once */
- gossip_debug(GOSSIP_REQUEST_DEBUG,"\tcalling distribute\n");
- retval = PINT_Distribute(contig_offset, sz,
- rfdata, mem, result, &req->eof_flag, mode);
+ gossip_debug(GOSSIP_REQUEST_DEBUG,
+ "\tcalling distribute\n");
+ retval = PINT_distribute(contig_offset, sz,
+ rfdata, mem, result,
+ &req->eof_flag, mode);
+
+ if (-1 == retval)
+ {
+ gossip_debug(GOSSIP_REQUEST_DEBUG,
+ "\tDistribute returned -1\n");
+ req->type_offset = req->final_offset;
+ result->segs = 0;
+ result->bytes = 0;
+ return 0;
+ }
}
}
/*** AFTER CALLING DISTRIBUTE ***/
@@ -474,7 +486,7 @@ int PINT_Process_request(PINT_Request_st
/* this function runs down the ereq list and adds up the offsets */
/* present in the request records */
-static int PINT_Request_disp(PINT_Request *request)
+static int PINT_request_disp(PINT_Request *request)
{
int disp = 0;
PINT_Request *r;
@@ -488,7 +500,7 @@ static int PINT_Request_disp(PINT_Reques
/* This function creates a request state and sets it up to begin */
/* processing a request */
-struct PINT_Request_state *PINT_New_request_state (PINT_Request *request)
+struct PINT_Request_state *PINT_new_request_state(PINT_Request *request)
{
struct PINT_Request_state *req;
int32_t rqdepth;
@@ -531,15 +543,19 @@ struct PINT_Request_state *PINT_New_requ
}
/* 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);
}
-/* This function should return the byte displacement from the input argument
- * offset to the last byte in the segment processed regardless of
- * whether that byte is in the current distribution or not.
+/**
+ * Returns:
+ * - If the distribute finds file data on the server, then the byte
+ * displacement from the input argument offset to the last byte
+ * in the segment processed regardless of whether that byte is in
+ * the current distribution or not
+ * - -1 if there is no distribution data available on the server
* Inputs:
* - offset and size are the contiguous region in logical file
* space we are to process
@@ -558,187 +574,230 @@ void PINT_Free_request_state (PINT_Reque
* segment offsets are computed based on buffer offset in
* offset_array[*segs]
*/
-PVFS_size PINT_Distribute(PVFS_offset offset, PVFS_size size,
- PINT_Request_file_data *rfdata, PINT_Request_state *mem,
- PINT_Request_result *result, PVFS_boolean *eof_flag, int mode)
-{
- PVFS_offset orig_offset;
- PVFS_size orig_size;
- PVFS_offset loff; /* next logical offset within requested region */
- PVFS_offset diff; /* difference between loff and offset of region */
- PVFS_offset poff; /* physical offste corresponding to loff */
- PVFS_size sz; /* number of bytes in requested region after loff */
- PVFS_size fraglen; /* length of physical strip contiguous on server */
-
- gossip_debug(GOSSIP_REQUEST_DEBUG,"\tPINT_Distribute\n");
- gossip_debug(GOSSIP_REQUEST_DEBUG,
- "\t\tof %lld sz %lld ix %d sm %d by %lld bm %lld "
- "fsz %lld exfl %d\n",
- Ld(offset), Ld(size), result->segs, result->segmax, Ld(result->bytes),
- Ld(result->bytemax),
- Ld(rfdata->fsize), rfdata->extend_flag);
- orig_offset = offset;
- orig_size = size;
- *eof_flag = 0;
- /* check if we have maxed out result */
- if ((!PINT_IS_CKSIZE(mode) && (result->segs >= result->segmax)) ||
- result->bytes >= result->bytemax || size == 0)
- {
- /* not an error, but we didn't process any bytes */
- gossip_debug(GOSSIP_REQUEST_DEBUG,"\t\trequested zero segs or zero bytes\n");
- return 0;
- }
- /* verify some critical pointers */
- if (!rfdata || !rfdata->dist || !rfdata->dist->methods ||
- !rfdata->dist->params)
- {
- if (!rfdata)
- gossip_debug(GOSSIP_REQUEST_DEBUG,"rfdata is NULL\n");
- else if (!rfdata->dist)
- gossip_debug(GOSSIP_REQUEST_DEBUG,"rfdata->dist is NULL\n");
- else if (!rfdata->dist->methods)
- gossip_debug(GOSSIP_REQUEST_DEBUG,"rfdata->dist->methods is NULL\n");
- else if (!rfdata->dist->params)
- gossip_debug(GOSSIP_REQUEST_DEBUG,"rfdata->dist->params is NULL\n");
- gossip_lerr("Bad Distribution! Bailing out!\n");
- return 0;
- }
- /* find next logical offset on this server */
- loff = (*rfdata->dist->methods->next_mapped_offset)
- (rfdata->dist->params, rfdata->server_nr, rfdata->server_ct, offset);
- /* make sure loff is still within requested region */
- while ((diff = loff - offset) < size)
- {
- gossip_debug(GOSSIP_REQUEST_DEBUG,"\t\tbegin iteration loff: %lld\n", Ld(loff));
- /* find physical offset for this loff */
- poff = (*rfdata->dist->methods->logical_to_physical_offset)
- (rfdata->dist->params, rfdata->server_nr, rfdata->server_ct, loff);
- /* find how much of requested region remains after loff */
- sz = size - diff;
- /* find how much data after loff/poff is on this server */
- fraglen = (*rfdata->dist->methods->contiguous_length)
- (rfdata->dist->params, rfdata->server_nr, rfdata->server_ct, poff);
- /* compare that amount to amount of data in requested region */
- if (sz > fraglen && rfdata->server_ct != 1)
- {
- /* frag extends beyond this strip */
- gossip_debug(GOSSIP_REQUEST_DEBUG,"\t\tfrag extends beyond strip\n");
- sz = fraglen;
- }
- /* check to see if exceeds bytemax */
- if (result->bytes + sz > result->bytemax)
- {
- /* contiguous segment extends beyond byte limit */
- gossip_debug(GOSSIP_REQUEST_DEBUG,"\t\tsegment exceeds byte limit\n");
- sz = result->bytemax - result->bytes;
- }
- /* check to se if exceeds end of file */
- if (poff+sz > rfdata->fsize)
- {
- /* check for append */
- if (rfdata->extend_flag)
- {
+PVFS_size PINT_distribute(PVFS_offset offset,
+ PVFS_size size,
+ PINT_request_file_data *rfdata,
+ PINT_Request_state *mem,
+ PINT_Request_result *result,
+ PVFS_boolean *eof_flag,
+ int mode)
+{
+ PVFS_offset orig_offset;
+ PVFS_size orig_size;
+ PVFS_offset loff; /* next logical offset within requested region */
+ PVFS_offset diff; /* difference between loff and offset of region */
+ PVFS_offset poff; /* physical offste corresponding to loff */
+ PVFS_size sz; /* number of bytes in requested region after loff */
+ PVFS_size fraglen; /* length of physical strip contiguous on server */
+
+ gossip_debug(GOSSIP_REQUEST_DEBUG,"\tPINT_distribute\n");
+ gossip_debug(GOSSIP_REQUEST_DEBUG,
+ "\t\tof %lld sz %lld ix %d sm %d by %lld bm %lld "
+ "fsz %lld exfl %d\n",
+ Ld(offset), Ld(size), result->segs, result->segmax,
+ Ld(result->bytes),
+ Ld(result->bytemax),
+ Ld(rfdata->fsize), rfdata->extend_flag);
+ orig_offset = offset;
+ orig_size = size;
+ *eof_flag = 0;
+
+ /* check if we have maxed out result */
+ if ((!PINT_IS_CKSIZE(mode) && (result->segs >= result->segmax)) ||
+ result->bytes >= result->bytemax || size == 0)
+ {
+ /* not an error, but we didn't process any bytes */
+ gossip_debug(GOSSIP_REQUEST_DEBUG,
+ "\t\trequested zero segs or zero bytes\n");
+ return 0;
+ }
+
+ /* verify some critical pointers */
+ if (!rfdata || !rfdata->dist || !rfdata->dist->methods ||
+ !rfdata->dist->params)
+ {
+ if (!rfdata)
+ gossip_debug(GOSSIP_REQUEST_DEBUG,"rfdata is NULL\n");
+ else if (!rfdata->dist)
+ gossip_debug(GOSSIP_REQUEST_DEBUG,"rfdata->dist is NULL\n");
+ else if (!rfdata->dist->methods)
+ gossip_debug(GOSSIP_REQUEST_DEBUG,"rfdata->dist->methods is NULL\n");
+ else if (!rfdata->dist->params)
+ gossip_debug(GOSSIP_REQUEST_DEBUG,"rfdata->dist->params is NULL\n");
+ gossip_lerr("Bad Distribution! Bailing out!\n");
+ return 0;
+ }
+
+ /* find next logical offset on this server */
+ loff = (*rfdata->dist->methods->next_mapped_offset)(rfdata->dist->params,
+ rfdata,
+ offset);
+
+ /* If there is no data on this server, immediately return */
+ if (-1 == loff)
+ {
+ return -1;
+ }
+
+ /* make sure loff is still within requested region */
+ while ((diff = loff - offset) < size)
+ {
+ gossip_debug(GOSSIP_REQUEST_DEBUG,"\t\tbegin iteration loff: %lld\n",
+ Ld(loff));
+
+ /* find physical offset for this loff */
+ poff = (*rfdata->dist->methods->logical_to_physical_offset)
+ (rfdata->dist->params,
+ rfdata,
+ loff);
+
+ /* find how much of requested region remains after loff */
+ sz = size - diff;
+
+ /* find how much data after loff/poff is on this server */
+ fraglen = (*rfdata->dist->methods->contiguous_length)
+ (rfdata->dist->params,
+ rfdata,
+ poff);
+
+ /* compare that amount to amount of data in requested region */
+ if (sz > fraglen && rfdata->server_ct != 1)
+ {
+ /* frag extends beyond this strip */
+ gossip_debug(GOSSIP_REQUEST_DEBUG,"\t\tfrag extends beyond strip\n");
+ sz = fraglen;
+ }
+ /* check to see if exceeds bytemax */
+ if (result->bytes + sz > result->bytemax)
+ {
+ /* contiguous segment extends beyond byte limit */
+ gossip_debug(GOSSIP_REQUEST_DEBUG,"\t\tsegment exceeds byte limit\n");
+ sz = result->bytemax - result->bytes;
+ }
+ /* check to se if exceeds end of file */
+ if (poff+sz > rfdata->fsize)
+ {
+ /* check for append */
+ if (rfdata->extend_flag)
+ {
/* update the file size info */
- gossip_debug(GOSSIP_REQUEST_DEBUG,"\t\tfile being extended\n");
- rfdata->fsize = poff + sz;
- }
- else
- {
- /* hit end of file */
- gossip_debug(GOSSIP_REQUEST_DEBUG,
- "\t\thit end of file: po %lld sz %lld fsz %lld\n",
- Ld(poff), Ld(sz), Ld(rfdata->fsize));
- *eof_flag = 1;
- sz = rfdata->fsize - poff;
- if (sz <= 0)
- {
- /* not even any more bytes before EOF */
- gossip_debug(GOSSIP_REQUEST_DEBUG,
- "\t\tend of file and no more bytes\n");
- break;
- }
- }
- }
- /* process a segment */
- if (PINT_IS_CLIENT(mode))
- {
- poff = result->offset_array[result->segs] + diff;
- gossip_debug(GOSSIP_REQUEST_DEBUG,"\tclient lstof %lld diff %lld sgof %lld\n",
- Ld(result->offset_array[result->segs]), Ld(diff), Ld(poff));
- }
- /* else poff is the offset of the segment */
- if (PINT_IS_CLIENT(mode) && mem)
- {
- /* call request processor to decode request type */
- /* sequential offset is offset_array[*segs] */
- /* size is sz */
- gossip_debug(GOSSIP_REQUEST_DEBUG,"**********CALL***PROCESS*********\n");
- gossip_debug(GOSSIP_REQUEST_DEBUG,"\t\tsegment of %lld sz %lld\n", Ld(poff), Ld(sz));
- PINT_REQUEST_STATE_SET_TARGET(mem, poff);
- PINT_REQUEST_STATE_SET_FINAL(mem, poff + sz);
- PINT_Process_request (mem, NULL, rfdata, result, mode|PINT_MEMREQ);
- sz = mem->type_offset - poff;
- gossip_debug(GOSSIP_REQUEST_DEBUG,"*****RETURN***FROM***PROCESS*****\n");
- }
- else
- {
- PINT_ADD_SEGMENT(result, poff, sz, mode);
- }
- /* this is used by client code */
- if (PINT_IS_CLIENT(mode) && result->segs < result->segmax)
- {
- result->offset_array[result->segs] =
- result->offset_array[result->segs - 1] +
- result->size_array[result->segs - 1];
- }
- /* prepare for next iteration */
- loff += sz;
- size -= loff - offset;
- offset = loff;
- /* find next logical offset on this server */
- loff = (*rfdata->dist->methods->next_mapped_offset)
- (rfdata->dist->params, rfdata->server_nr, rfdata->server_ct, offset);
- gossip_debug(GOSSIP_REQUEST_DEBUG,"\t\tend iteration\n");
- /* see if we are finished */
- if (result->bytes >= result->bytemax ||
- (!PINT_IS_CKSIZE(mode) && (result->segs >= result->segmax)))
- {
- gossip_debug(GOSSIP_REQUEST_DEBUG,"\t\tdone with segments or bytes\n");
- break;
- }
- }
- gossip_debug(GOSSIP_REQUEST_DEBUG,"\t\tfinished\n");
- gossip_debug(GOSSIP_REQUEST_DEBUG,
- "\t\t\tof %lld sz %lld sg %d sm %d by %lld bm %lld\n",
- Ld(offset), Ld(size), result->segs, result->segmax, Ld(result->bytes),
- Ld(result->bytemax));
- /* find physical offset for this loff */
- poff = (*rfdata->dist->methods->logical_to_physical_offset)
- (rfdata->dist->params, rfdata->server_nr, rfdata->server_ct, loff);
- gossip_debug(GOSSIP_REQUEST_DEBUG,
- "\t\t\tnext loff: %lld next poff: %lld\n", Ld(loff), Ld(poff));
-
- if (poff >= rfdata->fsize && !rfdata->extend_flag)
- {
- /* end of file - thus end of request */
- *eof_flag = 1;
- gossip_debug(GOSSIP_REQUEST_DEBUG,"\t\t\t[return value] %lld (EOF)\n",
- Ld(orig_size));
- return orig_size;
- }
- if (loff >= orig_offset + orig_size)
- {
- gossip_debug(GOSSIP_REQUEST_DEBUG,
- "\t\t\t(return value) %lld%s\n", Ld(orig_size),
- *eof_flag ? " (EOF)" : "");
- return orig_size;
- }
- else
- {
- gossip_debug(GOSSIP_REQUEST_DEBUG,"\t\t\treturn value %lld%s\n",
- Ld(offset - orig_offset), *eof_flag ? " (EOF)" : "");
- return (offset - orig_offset);
- }
+ gossip_debug(GOSSIP_REQUEST_DEBUG,"\t\tfile being extended\n");
+ rfdata->fsize = poff + sz;
+ }
+ else
+ {
+ /* hit end of file */
+ gossip_debug(GOSSIP_REQUEST_DEBUG,
+ "\t\thit end of file: po %lld sz %lld fsz %lld\n",
+ Ld(poff), Ld(sz), Ld(rfdata->fsize));
+ *eof_flag = 1;
+ sz = rfdata->fsize - poff;
+ if (sz <= 0)
+ {
+ /* not even any more bytes before EOF */
+ gossip_debug(GOSSIP_REQUEST_DEBUG,
+ "\t\tend of file and no more bytes\n");
+ break;
+ }
+ }
+ }
+ /* process a segment */
+ if (PINT_IS_CLIENT(mode))
+ {
+ poff = result->offset_array[result->segs] + diff;
+ gossip_debug(GOSSIP_REQUEST_DEBUG,
+ "\tclient lstof %lld diff %lld sgof %lld\n",
+ Ld(result->offset_array[result->segs]), Ld(diff),
+ Ld(poff));
+ }
+ /* else poff is the offset of the segment */
+ if (PINT_IS_CLIENT(mode) && mem)
+ {
+ gossip_debug(GOSSIP_REQUEST_DEBUG,
+ "**********CALL***PROCESS*********\n");
+ gossip_debug(GOSSIP_REQUEST_DEBUG,"\t\tsegment of %lld sz %lld\n",
+ Ld(poff), Ld(sz));
+
+ /* call request processor to decode request type */
+ /* sequential offset is offset_array[*segs] */
+ /* size is sz */
+ PINT_REQUEST_STATE_SET_TARGET(mem, poff);
+ PINT_REQUEST_STATE_SET_FINAL(mem, poff + sz);
+ PINT_process_request(mem, NULL, rfdata, result, mode|PINT_MEMREQ);
+ sz = mem->type_offset - poff;
+
+ gossip_debug(GOSSIP_REQUEST_DEBUG,
+ "*****RETURN***FROM***PROCESS*****\n");
+ }
+ else
+ {
+ PINT_ADD_SEGMENT(result, poff, sz, mode);
+ }
+ /* this is used by client code */
+ if (PINT_IS_CLIENT(mode) && result->segs < result->segmax)
+ {
+ result->offset_array[result->segs] =
+ result->offset_array[result->segs - 1] +
+ result->size_array[result->segs - 1];
+ }
+ /* prepare for next iteration */
+ loff += sz;
+ size -= loff - offset;
+ offset = loff;
+ /* find next logical offset on this server */
+ loff = (*rfdata->dist->methods->next_mapped_offset)
+ (rfdata->dist->params,
+ rfdata,
+ offset);
+ assert(-1 != loff);
+
+ gossip_debug(GOSSIP_REQUEST_DEBUG,"\t\tend iteration\n");
+ /* see if we are finished */
+ if (result->bytes >= result->bytemax ||
+ (!PINT_IS_CKSIZE(mode) && (result->segs >= result->segmax)))
+ {
+ gossip_debug(GOSSIP_REQUEST_DEBUG,
+ "\t\tdone with segments or bytes\n");
+ break;
+ }
+ }
+
+ gossip_debug(GOSSIP_REQUEST_DEBUG,"\t\tfinished\n");
+ gossip_debug(GOSSIP_REQUEST_DEBUG,
+ "\t\t\tof %lld sz %lld sg %d sm %d by %lld bm %lld\n",
+ Ld(offset), Ld(size), result->segs, result->segmax,
+ Ld(result->bytes),
+ Ld(result->bytemax));
+
+ /* find physical offset for this loff */
+ poff = (*rfdata->dist->methods->logical_to_physical_offset)
+ (rfdata->dist->params, rfdata, loff);
+
+ gossip_debug(GOSSIP_REQUEST_DEBUG,
+ "\t\t\tnext loff: %lld next poff: %lld\n",
+ Ld(loff), Ld(poff));
+
+ if (poff >= rfdata->fsize && !rfdata->extend_flag)
+ {
+ /* end of file - thus end of request */
+ *eof_flag = 1;
+ gossip_debug(GOSSIP_REQUEST_DEBUG,"\t\t\t[return value] %lld (EOF)\n",
+ Ld(orig_size));
+ return orig_size;
+ }
+ if (loff >= orig_offset + orig_size)
+ {
+ gossip_debug(GOSSIP_REQUEST_DEBUG,
+ "\t\t\t(return value) %lld%s\n", Ld(orig_size),
+ *eof_flag ? " (EOF)" : "");
+ return orig_size;
+ }
+ else
+ {
+ gossip_debug(GOSSIP_REQUEST_DEBUG,"\t\t\treturn value %lld%s\n",
+ Ld(offset - orig_offset), *eof_flag ? " (EOF)" : "");
+ return (offset - orig_offset);
+ }
}
/* Function: PINT_Request_commit
@@ -750,14 +809,14 @@ PVFS_size PINT_Distribute(PVFS_offset of
* offsets must reflect the current offsets and then write each struct
* to the contiguous memory region
*/
-int PINT_Request_commit(PINT_Request *region, PINT_Request *node)
+int PINT_request_commit(PINT_Request *region, PINT_Request *node)
{
- int32_t index = 0;
- PINT_Do_Request_commit(region, node, &index, 0);
- return 0;
+ int32_t index = 0;
+ PINT_do_request_commit(region, node, &index, 0);
+ return 0;
}
-int PINT_Do_clear_commit(PINT_Request *node, int32_t depth)
+int PINT_do_clear_commit(PINT_Request *node, int32_t depth)
{
if (node == NULL)
return -1;
@@ -769,16 +828,16 @@ int PINT_Do_clear_commit(PINT_Request *n
if (node->ereq)
{
- PINT_Do_clear_commit(node->ereq, depth+1);
+ PINT_do_clear_commit(node->ereq, depth+1);
}
if (node->sreq)
{
- PINT_Do_clear_commit(node->sreq, depth+1);
+ PINT_do_clear_commit(node->sreq, depth+1);
}
return 0;
}
-PINT_Request *PINT_Do_Request_commit(PINT_Request *region, PINT_Request *node,
+PINT_Request *PINT_do_request_commit(PINT_Request *region, PINT_Request *node,
int32_t *index, int32_t depth)
{
int node_was_committed = 0;
@@ -813,7 +872,7 @@ PINT_Request *PINT_Do_Request_commit(PIN
if (node->ereq)
{
region[node->committed].ereq =
- PINT_Do_Request_commit(region, node->ereq, index, depth+1);
+ PINT_do_request_commit(region, node->ereq, index, depth+1);
}
else
{
@@ -824,7 +883,7 @@ PINT_Request *PINT_Do_Request_commit(PIN
if (node->sreq)
{
region[node->committed].sreq =
- PINT_Do_Request_commit(region, node->sreq, index, depth+1);
+ PINT_do_request_commit(region, node->sreq, index, depth+1);
}
else
{
@@ -834,7 +893,7 @@ PINT_Request *PINT_Do_Request_commit(PIN
if (depth == 0)
{
gossip_debug(GOSSIP_REQUEST_DEBUG,"clearing tree\n");
- PINT_Do_clear_commit(node, 0);
+ PINT_do_clear_commit(node, 0);
/* this indicates the region is packed */
region->committed = -1;
/* if the original request was committed, this restores that */
@@ -851,7 +910,7 @@ PINT_Request *PINT_Do_Request_commit(PIN
/* This function converts pointers to array indexes for transport
* The input Request MUST be committed
*/
-int PINT_Request_encode(struct PINT_Request *req)
+int PINT_request_encode(struct PINT_Request *req)
{
int r;
if (!PINT_REQUEST_IS_PACKED(req))
@@ -873,7 +932,7 @@ int PINT_Request_encode(struct PINT_Requ
/* This function coverts array indexes back to pointers after transport
* The input Request MUST be committed
*/
-int PINT_Request_decode(struct PINT_Request *req)
+int PINT_request_decode(struct PINT_Request *req)
{
int r;
if (!PINT_REQUEST_IS_PACKED(req))
@@ -894,18 +953,18 @@ int PINT_Request_decode(struct PINT_Requ
}
-void PINT_Dump_packed_request(PINT_Request *req)
+void PINT_dump_packed_request(PINT_Request *req)
{
int i;
if (!PINT_REQUEST_IS_PACKED(req))
return;
for (i = 0; i < PINT_REQUEST_NEST_SIZE(req)+1; i++)
{
- PINT_Dump_request(req+i);
+ PINT_dump_request(req+i);
}
}
-void PINT_Dump_request(PINT_Request *req)
+void PINT_dump_request(PINT_Request *req)
{
gossip_debug(GOSSIP_REQUEST_DEBUG,"**********************\n");
gossip_debug(GOSSIP_REQUEST_DEBUG,"address:\t%p\n",req);
@@ -925,3 +984,14 @@ void PINT_Dump_request(PINT_Request *req
gossip_debug(GOSSIP_REQUEST_DEBUG,"sreq:\t\t%p\n",req->sreq);
gossip_debug(GOSSIP_REQUEST_DEBUG,"**********************\n");
}
+
+
+/*
+ * Local variables:
+ * mode: c
+ * c-indent-level: 4
+ * c-basic-offset: 4
+ * End:
+ *
+ * vim: ft=c ts=8 sts=4 sw=4 expandtab
+ */
Index: pint-request.h
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/io/description/pint-request.h,v
diff -p -u -r1.30 -r1.31
--- pint-request.h 14 Jun 2005 23:35:12 -0000 1.30
+++ pint-request.h 7 Jul 2005 15:34:40 -0000 1.31
@@ -7,10 +7,12 @@
#ifndef __PINT_REQUEST_H
#define __PINT_REQUEST_H
-#include "pint-distribution.h"
-#include <pvfs2-types.h>
+#include "pvfs2-types.h"
-/* modes for PINT_Process_request and PINT_Distribute */
+/* Forward declarations */
+struct PINT_dist_s;
+
+/* modes for PINT_Process_request and PINT_distribute */
#define PINT_SERVER 000001
#define PINT_CLIENT 000002
#define PINT_CKSIZE 000004
@@ -139,56 +141,56 @@ typedef struct PINT_Request_state {
*/
typedef struct PINT_Request_result {
- PVFS_offset *offset_array;/* array of offsets for each segment output */
- PVFS_size *size_array; /* array of sizes for each segment output */
- int32_t segmax; /* maximum number of segments to output */
- int32_t segs; /* number of segments output */
- PVFS_size bytemax; /* maximum number of bytes to output */
- PVFS_size bytes; /* number of bytes output */
+ PVFS_offset *offset_array;/* array of offsets for each segment output */
+ PVFS_size *size_array; /* array of sizes for each segment output */
+ int32_t segmax; /* maximum number of segments to output */
+ int32_t segs; /* number of segments output */
+ PVFS_size bytemax; /* maximum number of bytes to output */
+ PVFS_size bytes; /* number of bytes output */
} PINT_Request_result;
-typedef struct PINT_Request_file_data {
- PVFS_size fsize; /* actual size of local storage object */
- uint32_t server_nr; /* ordinal number of THIS server for this file */
- uint32_t server_ct; /* number of servers for this file */
- PINT_dist *dist; /* dist struct for the file */
- PVFS_boolean extend_flag; /* if zero, file will not be extended */
-} PINT_Request_file_data;
+typedef struct PINT_request_file_data_s {
+ PVFS_size fsize; /* actual size of local storage object */
+ uint32_t server_nr; /* ordinal number of THIS server for this file */
+ uint32_t server_ct; /* number of servers for this file */
+ struct PINT_dist_s *dist; /* dist struct for the file */
+ 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);
+struct PINT_Request_state *PINT_new_request_state (PINT_Request *request);
-void PINT_Free_request_state (PINT_Request_state *req);
+void PINT_free_request_state (PINT_Request_state *req);
/* generate offset length pairs from request and dist */
-int PINT_Process_request(PINT_Request_state *req,
+int PINT_process_request(PINT_Request_state *req,
PINT_Request_state *mem,
- PINT_Request_file_data *rfdata,
+ PINT_request_file_data *rfdata,
PINT_Request_result *result,
int mode);
/* internal function */
-PVFS_size PINT_Distribute(PVFS_offset offset,
- PVFS_size size,
- PINT_Request_file_data *rfdata,
- PINT_Request_state *mem,
- PINT_Request_result *result,
- PVFS_boolean *eof_flag,
- int mode);
+PVFS_size PINT_distribute(PVFS_offset offset,
+ PVFS_size size,
+ PINT_request_file_data *rfdata,
+ PINT_Request_state *mem,
+ PINT_Request_result *result,
+ PVFS_boolean *eof_flag,
+ int mode);
/* pack request from node into a contiguous buffer pointed to by region */
-int PINT_Request_commit(PINT_Request *region, PINT_Request *node);
-PINT_Request *PINT_Do_Request_commit(PINT_Request *region, PINT_Request *node,
+int PINT_request_commit(PINT_Request *region, PINT_Request *node);
+PINT_Request *PINT_do_request_commit(PINT_Request *region, PINT_Request *node,
int32_t *index, int32_t depth);
-int PINT_Do_clear_commit(PINT_Request *node, int32_t depth);
+int PINT_do_clear_commit(PINT_Request *node, int32_t depth);
/* encode packed request in place for sending over wire */
-int PINT_Request_encode(struct PINT_Request *req);
+int PINT_request_encode(struct PINT_Request *req);
/* decode packed request in place after receiving from wire */
-int PINT_Request_decode(struct PINT_Request *req);
+int PINT_request_decode(struct PINT_Request *req);
-void PINT_Dump_packed_request(struct PINT_Request *req);
-void PINT_Dump_request(struct PINT_Request *req);
+void PINT_dump_packed_request(struct PINT_Request *req);
+void PINT_dump_request(struct PINT_Request *req);
/********* macros for accessing key fields in a request *********/
@@ -298,3 +300,14 @@ void PINT_Dump_request(struct PINT_Reque
} while(0)
#endif /* __PINT_REQUEST_H */
+
+
+/*
+ * Local variables:
+ * mode: c
+ * c-indent-level: 4
+ * c-basic-offset: 4
+ * End:
+ *
+ * vim: ft=c ts=8 sts=4 sw=4 expandtab
+ */
Index: pvfs-distribution.h
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/io/description/pvfs-distribution.h,v
diff -p -u -r1.10 -r1.11
--- pvfs-distribution.h 13 May 2004 14:46:37 -0000 1.10
+++ pvfs-distribution.h 7 Jul 2005 15:34:40 -0000 1.11
@@ -9,81 +9,21 @@
#include "pvfs2-types.h"
-/* each particular distribution implementation will define this for itself */
-typedef struct {
- PVFS_offset (*logical_to_physical_offset)(void* params,
- uint32_t server_nr,
- uint32_t server_ct,
- PVFS_offset logical_offset);
- PVFS_offset (*physical_to_logical_offset)(void* params,
- uint32_t server_nr,
- uint32_t server_ct,
- PVFS_offset physical_offset);
- PVFS_offset (*next_mapped_offset)(void* params,
- uint32_t server_nr,
- uint32_t server_ct,
- PVFS_offset logical_offset);
- PVFS_size (*contiguous_length)(void* params,
- uint32_t server_nr,
- uint32_t server_ct,
- PVFS_offset physical_offset);
- PVFS_size (*logical_file_size)(void* params,
- uint32_t server_ct,
- PVFS_size *psizes);
- void (*encode)(void* params, void *buffer);
- void (*decode)(void* params, void *buffer);
- void (*encode_lebf)(char **pptr, void* params);
- void (*decode_lebf)(char **pptr, void* params);
-} PVFS_Dist_methods;
-
-/* this struct is used to define a distribution to PVFS */
-typedef struct PINT_dist_s {
- char *dist_name;
- int32_t name_size;
- int32_t param_size;
- void *params;
- PVFS_Dist_methods *methods;
-} PINT_dist;
-
-#ifdef __PINT_REQPROTO_ENCODE_FUNCS_C
-#define encode_PVFS_Dist(pptr,x) do { PINT_dist *px = *(x); \
- encode_string(pptr, &px->dist_name); \
- if (!px->methods) { \
- gossip_err("%s: encode_PVFS_Dist: methods is null\n", __func__); \
- exit(1); \
- } \
- (px->methods->encode_lebf) (pptr, px->params); \
-} while (0)
-#define decode_PVFS_Dist(pptr,x) do { PINT_dist tmp_dist; PINT_dist *px; \
- extern int PINT_Dist_lookup(PINT_dist *dist); \
- decode_string(pptr, &tmp_dist.dist_name); \
- tmp_dist.params = 0; \
- tmp_dist.methods = 0; \
- /* bizzare lookup function fills in most fields */ \
- PINT_Dist_lookup(&tmp_dist); \
- if (!tmp_dist.methods) { \
- gossip_err("%s: decode_PVFS_Dist: methods is null\n", __func__); \
- exit(1); \
- } \
- /* later routines assume dist is a big contiguous thing, do so */ \
- *(x) = px = decode_malloc(PINT_DIST_PACK_SIZE(&tmp_dist)); \
- memcpy(px, &tmp_dist, sizeof(*px)); \
- px->dist_name = (char *) px + roundup8(sizeof(*px)); \
- memcpy(px->dist_name, tmp_dist.dist_name, tmp_dist.name_size); \
- px->params = (void *)(px->dist_name + roundup8(px->name_size)); \
- (px->methods->decode_lebf) (pptr, px->params); \
-} while (0)
-#endif
-
extern PINT_dist *PVFS_dist_create(const char *name);
extern int PVFS_dist_free(PINT_dist *dist);
extern PINT_dist *PVFS_Dist_copy(const PINT_dist *dist);
-extern int PINT_dist_getparams(void *buf, const PINT_dist *dist);
-extern int PINT_dist_setparams(PINT_dist *dist, const void *buf);
+extern int PVFS_dist_getparams(void *buf, const PINT_dist *dist);
+extern int PVFS_dist_setparams(PINT_dist *dist, const void *buf);
-/******** macros for access to dist struct ***********/
-
-#define PINT_DIST_PACK_SIZE(d) \
- (roundup8(sizeof(*(d))) + roundup8((d)->name_size) + roundup8((d)->param_size))
#endif /* __PVFS_DISTRIBUTION_H */
+
+/*
+ * Local variables:
+ * mode: c
+ * c-indent-level: 4
+ * c-basic-offset: 4
+ * End:
+ *
+ * vim: ft=c ts=8 sts=4 sw=4 expandtab
+ */
Index: pvfs-request.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/io/description/pvfs-request.c,v
diff -p -u -r1.21 -r1.22
--- pvfs-request.c 27 May 2005 19:27:04 -0000 1.21
+++ pvfs-request.c 7 Jul 2005 15:34:40 -0000 1.22
@@ -413,7 +413,7 @@ int PVFS_Request_commit(PVFS_Request * r
return PVFS_ERR_REQ;
}
/* pack the request */
- PINT_Request_commit(region, req);
+ PINT_request_commit(region, req);
}
/* return the pointer to the memory region */
*reqp = region;
More information about the PVFS2-CVS
mailing list