[Pvfs2-cvs] commit by slang in pvfs2/src/common/misc:
msgpairarray.h msgpairarray.sm pint-cached-config.c
pint-hint.c pint-hint.h pvfs2-util.c server-config.c
server-config.h state-machine-fns.c
CVS commit program
cvs at parl.clemson.edu
Wed May 21 14:55:11 EDT 2008
Update of /projects/cvsroot/pvfs2/src/common/misc
In directory parlweb1:/tmp/cvs-serv7682/src/common/misc
Modified Files:
Tag: he-branch
msgpairarray.h msgpairarray.sm pint-cached-config.c
pint-hint.c pint-hint.h pvfs2-util.c server-config.c
server-config.h state-machine-fns.c
Log Message:
reverse merge of latest changes from HEAD to he branch.
Index: msgpairarray.h
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/common/misc/msgpairarray.h,v
diff -p -u -r1.11 -r1.11.50.1
--- msgpairarray.h 14 Dec 2005 21:50:19 -0000 1.11
+++ msgpairarray.h 21 May 2008 18:55:10 -0000 1.11.50.1
@@ -22,6 +22,8 @@ extern struct PINT_state_machine_s pvfs2
#define PVFS_MSGPAIR_RETRY 0xFE
#define PVFS_MSGPAIR_NO_RETRY 0xFF
+#define PINT_MSGPAIR_PARENT_SM -1
+
/*
* This structure holds everything that we need for the state of a
* message pair. We need arrays of these in some cases, so it's
@@ -77,7 +79,7 @@ typedef struct PINT_sm_msgpair_state_s
} PINT_sm_msgpair_state;
/* used to pass in parameters that apply to every entry in a msgpair array */
-typedef struct PINT_sm_msgpair_params_s
+typedef struct
{
int job_timeout;
int retry_delay;
@@ -89,14 +91,40 @@ typedef struct PINT_sm_msgpair_params_s
} PINT_sm_msgpair_params;
+typedef struct
+{
+ PINT_sm_msgpair_params params;
+ int count;
+ PINT_sm_msgpair_state *msgarray;
+ PINT_sm_msgpair_state msgpair;
+} PINT_sm_msgarray_op;
+
+#define PINT_msgpair_init(op) \
+ do { \
+ memset(&(op)->msgpair, 0, sizeof(PINT_sm_msgpair_state)); \
+ if((op)->msgarray != &(op)->msgpair) \
+ { \
+ free((op)->msgarray); \
+ (op)->msgarray = NULL; \
+ } \
+ (op)->count = 1; \
+ (op)->msgarray = &(op)->msgpair; \
+ } while(0)
+
+#define foreach_msgpair(__msgarray_op, __msg_p, __i) \
+ for(__i = 0, __msg_p = &((__msgarray_op)->msgarray[__i]); \
+ __i < (__msgarray_op)->count; \
+ ++__i, __msg_p = &((__msgarray_op)->msgarray[__i]))
/* helper functions */
int PINT_msgpairarray_init(
- PINT_sm_msgpair_state ** msgpairarray,
+ PINT_sm_msgarray_op *op,
int count);
-void PINT_msgpairarray_destroy(PINT_sm_msgpair_state * msgpairarray);
+void PINT_msgpairarray_destroy(PINT_sm_msgarray_op *op);
+
+int PINT_msgarray_status(PINT_sm_msgarray_op *op);
int PINT_serv_decode_resp(
PVFS_fs_id fs_id,
@@ -113,9 +141,7 @@ int PINT_serv_free_msgpair_resources(
PVFS_BMI_addr_t *svr_addr_p,
int max_resp_sz);
-int PINT_serv_msgpairarray_resolve_addrs(
- int count,
- PINT_sm_msgpair_state* msgarray);
+int PINT_serv_msgpairarray_resolve_addrs(PINT_sm_msgarray_op *op);
#define PRINT_ENCODING_ERROR(type_str, type) \
do { \
Index: msgpairarray.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/common/misc/msgpairarray.sm,v
diff -p -u -r1.45.4.1 -r1.45.4.2
--- msgpairarray.sm 7 Apr 2008 16:31:03 -0000 1.45.4.1
+++ msgpairarray.sm 21 May 2008 18:55:10 -0000 1.45.4.2
@@ -13,26 +13,6 @@
#include <string.h>
#include <assert.h>
-/* conditionally include different headers to get the type of the state
- * machine struct that contains the msgpair state structs we need to access;
- * this is done to allow the reuse of this nested machine on both client and
- * server side where completely different primary state machine structures
- * are used
- */
-#if defined(__PVFS2_CLIENT__)
-#include "client-state-machine.h"
-#define PARENT_SM PINT_client_sm
-#elif defined(__PVFS2_SERVER__)
-#include "src/server/pvfs2-server.h"
-#define PARENT_SM PINT_server_op
-#else
-/* this condition is only included for dependency building step; will not
- * actually compile cleanly
- */
-#define __SM_CHECK_DEP
-#include "client-state-machine.h"
-#include "src/server/pvfs2-server.h"
-#endif
#include "msgpairarray.h"
#include "pvfs2-debug.h"
#include "pint-cached-config.h"
@@ -43,6 +23,7 @@
#include "pint-util.h"
#include "server-config-mgr.h"
#include "pvfs2-internal.h"
+#include "state-machine.h"
enum
{
@@ -86,6 +67,12 @@ nested machine pvfs2_msgpairarray_sm
run msgpairarray_completion_fn;
MSGPAIRS_RETRY => post_retry;
MSGPAIRS_RETRY_NODELAY => post;
+ default => done;
+ }
+
+ state done
+ {
+ run msgpairarray_done;
default => return;
}
}
@@ -95,23 +82,23 @@ nested machine pvfs2_msgpairarray_sm
static PINT_sm_action msgpairarray_init(
struct PINT_smcb *smcb, job_status_s *js_p)
{
- PARENT_SM *sm_p = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
+ PINT_sm_msgarray_op *mop = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
int i = 0;
PINT_sm_msgpair_state *msg_p = NULL;
gossip_debug(GOSSIP_MSGPAIR_DEBUG, "(%p) msgpairarray state: init "
- "(%d msgpair(s))\n", smcb, sm_p->msgarray_count);
+ "(%d msgpair(s))\n", smcb, mop->count);
- assert(sm_p->msgarray_count > 0);
+ assert(mop->count > 0);
js_p->error_code = 0;
/* set number of operations that must complete. */
- sm_p->msgarray_params.comp_ct = (2 * sm_p->msgarray_count);
+ mop->params.comp_ct = (2 * mop->count);
- for(i = 0; i < sm_p->msgarray_count; i++)
+ for(i = 0; i < mop->count; i++)
{
- msg_p = &sm_p->msgarray[i];
+ msg_p = &mop->msgarray[i];
assert(msg_p);
assert((msg_p->retry_flag == PVFS_MSGPAIR_RETRY) ||
@@ -145,7 +132,7 @@ static PINT_sm_action msgpairarray_init(
static PINT_sm_action msgpairarray_post(
struct PINT_smcb *smcb, job_status_s *js_p)
{
- PARENT_SM *sm_p = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
+ PINT_sm_msgarray_op *mop = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
int ret = -PVFS_EINVAL, i = 0, tmp = 0;
struct server_configuration_s *server_config = NULL;
PVFS_msg_tag_t session_tag;
@@ -157,16 +144,16 @@ static PINT_sm_action msgpairarray_post(
gossip_debug(
GOSSIP_MSGPAIR_DEBUG, "%s: sm %p "
"%d total message(s) with %d incomplete\n", __func__, smcb,
- sm_p->msgarray_count * 2, sm_p->msgarray_params.comp_ct);
+ mop->count * 2, mop->params.comp_ct);
js_p->error_code = 0;
- assert(sm_p->msgarray_count > 0);
- assert(sm_p->msgarray_params.comp_ct >= 2);
+ assert(mop->count > 0);
+ assert(mop->params.comp_ct >= 2);
- for (i = 0; i < sm_p->msgarray_count; i++)
+ for (i = 0; i < mop->count; i++)
{
- msg_p = &sm_p->msgarray[i];
+ msg_p = &mop->msgarray[i];
assert(msg_p);
/*
@@ -263,9 +250,9 @@ static PINT_sm_action msgpairarray_post(
i,
&msg_p->recv_status,
&msg_p->recv_id,
- sm_p->msgarray_params.job_context,
- sm_p->msgarray_params.job_timeout,
- sm_p->hints);
+ mop->params.job_context,
+ mop->params.job_timeout,
+ msg_p->req.hints);
if (ret == 0)
{
/* perform a quick test to see if the recv failed before posting
@@ -275,7 +262,7 @@ static PINT_sm_action msgpairarray_post(
*/
ret = job_test(msg_p->recv_id, &tmp, NULL,
&msg_p->recv_status, 0,
- sm_p->msgarray_params.job_context);
+ mop->params.job_context);
}
if ((ret < 0) || (ret == 1))
@@ -300,7 +287,7 @@ static PINT_sm_action msgpairarray_post(
/* mark send as bad too and don't post it */
msg_p->send_status.error_code = msg_p->recv_status.error_code;
msg_p->op_status = msg_p->recv_status.error_code;
- sm_p->msgarray_params.comp_ct -= 2;
+ mop->params.comp_ct -= 2;
if (local_enc_and_alloc)
{
@@ -333,12 +320,12 @@ static PINT_sm_action msgpairarray_post(
msg_p->encoded_req.buffer_type,
1,
smcb,
- sm_p->msgarray_count+i,
+ mop->count+i,
&msg_p->send_status,
&msg_p->send_id,
- sm_p->msgarray_params.job_context,
- sm_p->msgarray_params.job_timeout,
- sm_p->hints);
+ mop->params.job_context,
+ mop->params.job_timeout,
+ msg_p->req.hints);
if ((ret < 0) ||
((ret == 1) && (msg_p->send_status.error_code != 0)))
@@ -355,26 +342,26 @@ static PINT_sm_action msgpairarray_post(
gossip_err("Send error: cancelling recv.\n");
- job_bmi_cancel(msg_p->recv_id, sm_p->msgarray_params.job_context);
+ job_bmi_cancel(msg_p->recv_id, mop->params.job_context);
/* we still have to wait for recv completion, so just decrement
* comp_ct by one and keep going
*/
msg_p->op_status = msg_p->send_status.error_code;
msg_p->send_id = 0;
- sm_p->msgarray_params.comp_ct--;
+ mop->params.comp_ct--;
}
else if (ret == 1)
{
/* immediate completion */
msg_p->send_id = 0;
/* decrement our count, since send is already done. */
- sm_p->msgarray_params.comp_ct--;
+ mop->params.comp_ct--;
}
/* else: successful post, no immediate completion */
}
- if (sm_p->msgarray_params.comp_ct == 0)
+ if (mop->params.comp_ct == 0)
{
/* everything is completed already (could happen in some failure
* cases); jump straight to final completion function.
@@ -392,36 +379,36 @@ static PINT_sm_action msgpairarray_post(
static PINT_sm_action msgpairarray_post_retry(
struct PINT_smcb *smcb, job_status_s *js_p)
{
- PARENT_SM *sm_p = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
+ PINT_sm_msgarray_op *mop = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
job_id_t tmp_id;
gossip_debug(GOSSIP_MSGPAIR_DEBUG, "%s: sm %p, wait %d ms\n",
- __func__, smcb, sm_p->msgarray_params.retry_delay);
+ __func__, smcb, mop->params.retry_delay);
js_p->error_code = 0; /* do not leak MSGPAIRS_RETRY through to wait */
return job_req_sched_post_timer(
- sm_p->msgarray_params.retry_delay,
+ mop->params.retry_delay,
smcb, 0, js_p, &tmp_id,
- sm_p->msgarray_params.job_context);
+ mop->params.job_context);
}
static PINT_sm_action msgpairarray_complete(
struct PINT_smcb *smcb, job_status_s *js_p)
{
- PARENT_SM *sm_p = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
+ PINT_sm_msgarray_op *mop = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
gossip_debug(GOSSIP_MSGPAIR_DEBUG,
"%s: sm %p status_user_tag %d msgarray_count %d\n",
- __func__, smcb, (int) js_p->status_user_tag, sm_p->msgarray_count);
+ __func__, smcb, (int) js_p->status_user_tag, mop->count);
/* match operation with something in the msgpair array */
/* the first N tags are receives, the second N are sends */
- assert(js_p->status_user_tag < sm_p->msgarray_count*2);
+ assert(js_p->status_user_tag < mop->count*2);
- if (js_p->status_user_tag < sm_p->msgarray_count)
+ if (js_p->status_user_tag < mop->count)
{
PINT_sm_msgpair_state *msg_p =
- &sm_p->msgarray[js_p->status_user_tag];
+ &mop->msgarray[js_p->status_user_tag];
msg_p->recv_id = 0;
msg_p->recv_status = *js_p;
@@ -435,13 +422,13 @@ static PINT_sm_action msgpairarray_compl
/* we got a receive error, but send is still pending. Cancel
* the send
*/
- job_bmi_cancel(msg_p->send_id, sm_p->msgarray_params.job_context);
+ job_bmi_cancel(msg_p->send_id, mop->params.job_context);
}
}
else
{
- PINT_sm_msgpair_state *msg_p = &sm_p->msgarray[
- js_p->status_user_tag - sm_p->msgarray_count];
+ PINT_sm_msgpair_state *msg_p = &mop->msgarray[
+ js_p->status_user_tag - mop->count];
msg_p->send_id = 0;
msg_p->send_status = *js_p;
@@ -455,20 +442,20 @@ static PINT_sm_action msgpairarray_compl
/* we got a send error, but recv is still pending. Cancel
* the recv
*/
- job_bmi_cancel(msg_p->recv_id, sm_p->msgarray_params.job_context);
+ job_bmi_cancel(msg_p->recv_id, mop->params.job_context);
}
}
/* decrement comp_ct until all operations have completed */
- if (--sm_p->msgarray_params.comp_ct > 0)
+ if (--mop->params.comp_ct > 0)
{
gossip_debug(GOSSIP_MSGPAIR_DEBUG,
" msgpairarray: %d operations remain\n",
- sm_p->msgarray_params.comp_ct);
+ mop->params.comp_ct);
return SM_ACTION_DEFERRED;
}
- assert(sm_p->msgarray_params.comp_ct == 0);
+ assert(mop->params.comp_ct == 0);
gossip_debug(GOSSIP_MSGPAIR_DEBUG,
" msgpairarray: all operations complete\n");
@@ -479,7 +466,7 @@ static PINT_sm_action msgpairarray_compl
static PINT_sm_action msgpairarray_completion_fn(
struct PINT_smcb *smcb, job_status_s *js_p)
{
- PARENT_SM *sm_p = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
+ PINT_sm_msgarray_op *mop = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
int ret = -PVFS_EINVAL, i = 0;
int need_retry = 0;
struct PINT_decoded_msg decoded_resp;
@@ -494,9 +481,9 @@ static PINT_sm_action msgpairarray_compl
gossip_debug(GOSSIP_MSGPAIR_DEBUG, "(%p) msgpairarray state: "
"completion_fn\n", smcb);
- for (i = 0; i < sm_p->msgarray_count; i++)
+ for (i = 0; i < mop->count; i++)
{
- PINT_sm_msgpair_state *msg_p = &sm_p->msgarray[i];
+ PINT_sm_msgpair_state *msg_p = &mop->msgarray[i];
assert(msg_p);
/*
@@ -604,21 +591,21 @@ static PINT_sm_action msgpairarray_compl
* of two since they are pairs. If over the count, do not
* retry, just return one of the error codes.
*/
- sm_p->msgarray_params.comp_ct = 0;
+ mop->params.comp_ct = 0;
js_p->error_code = 0;
- for (i=0; i < sm_p->msgarray_count; i++) {
+ for (i=0; i < mop->count; i++) {
- PINT_sm_msgpair_state *msg_p = &sm_p->msgarray[i];
+ PINT_sm_msgpair_state *msg_p = &mop->msgarray[i];
if (msg_p->complete)
continue;
if (msg_p->retry_flag == PVFS_MSGPAIR_RETRY
&& PVFS_ERROR_CLASS(-msg_p->op_status) == PVFS_ERROR_BMI
- && msg_p->retry_count < sm_p->msgarray_params.retry_limit) {
+ && msg_p->retry_count < mop->params.retry_limit) {
++msg_p->retry_count;
- sm_p->msgarray_params.comp_ct += 2;
+ mop->params.comp_ct += 2;
gossip_debug(GOSSIP_MSGPAIR_DEBUG,
"*** %s: msgpair %d failed, retry %d\n",
__func__, i, msg_p->retry_count);
@@ -671,30 +658,57 @@ static PINT_sm_action msgpairarray_compl
return SM_ACTION_COMPLETE;
}
+static PINT_sm_action msgpairarray_done(
+ struct PINT_smcb *smcb, job_status_s *js_p)
+{
+ int task_id, error_code, remaining;
+ PINT_sm_pop_frame(smcb, &task_id, &error_code, &remaining);
+ return SM_ACTION_COMPLETE;
+}
+
/*********************************************************************
* helper functions used in conjunction with state machine defined above
*/
int PINT_msgpairarray_init(
- PINT_sm_msgpair_state ** msgpairarray,
+ PINT_sm_msgarray_op *op,
int count)
{
- *msgpairarray = (PINT_sm_msgpair_state *)malloc(
+ op->msgarray = (PINT_sm_msgpair_state *)malloc(
count * sizeof(PINT_sm_msgpair_state));
- if(!*msgpairarray)
+ if(!op->msgarray)
{
return -PVFS_ENOMEM;
}
- memset(*msgpairarray, 0, (count * sizeof(PINT_sm_msgpair_state)));
+ memset(op->msgarray, 0, (count * sizeof(PINT_sm_msgpair_state)));
+ op->count = count;
return 0;
}
/* we pass in a pointer to the array so that we can set it to NULL */
void PINT_msgpairarray_destroy(
- PINT_sm_msgpair_state * msgpairarray)
+ PINT_sm_msgarray_op *op)
{
- free(msgpairarray);
+ if(op->msgarray && (&op->msgpair) != op->msgarray)
+ {
+ free(op->msgarray);
+ }
+ op->msgarray = NULL;
+ op->count = 0;
+}
+
+int PINT_msgarray_status(PINT_sm_msgarray_op *op)
+{
+ int i;
+ for (i = 0; i < op->count; i++)
+ {
+ if (op->msgarray[i].op_status != 0)
+ {
+ return op->msgarray[i].op_status;
+ }
+ }
+ return 0;
}
int PINT_serv_decode_resp(PVFS_fs_id fs_id,
@@ -769,16 +783,16 @@ int PINT_serv_free_msgpair_resources(
* returns 0 on success, -PVFS_error on failure
*/
int PINT_serv_msgpairarray_resolve_addrs(
- int count, PINT_sm_msgpair_state *msgarray)
+ PINT_sm_msgarray_op *mop)
{
int i = 0;
int ret = -PVFS_EINVAL;
- if ((count > 0) && msgarray)
+ if ((mop->count > 0) && mop->msgarray)
{
- for(i = 0; i < count; i++)
+ for(i = 0; i < mop->count; i++)
{
- PINT_sm_msgpair_state *msg_p = &msgarray[i];
+ PINT_sm_msgpair_state *msg_p = &mop->msgarray[i];
assert(msg_p);
ret = PINT_cached_config_map_to_server(
Index: pint-cached-config.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/common/misc/pint-cached-config.c,v
diff -p -u -r1.23 -r1.23.4.1
--- pint-cached-config.c 14 Feb 2008 00:04:39 -0000 1.23
+++ pint-cached-config.c 21 May 2008 18:55:10 -0000 1.23.4.1
@@ -8,7 +8,10 @@
#include <string.h>
#include <assert.h>
#include <stdlib.h>
+#include <sys/time.h>
#include <time.h>
+#include <sys/types.h>
+#include <unistd.h>
#include "pvfs2-types.h"
#include "pvfs2-attr.h"
@@ -114,12 +117,41 @@ static int io_randomized = 0;
*/
int PINT_cached_config_initialize(void)
{
+ struct timeval tv;
+ unsigned int seed = 0;
+ char hostname[HOST_NAME_MAX];
+ int ret;
+ int i;
+ int hostnamelen;
+
if (!PINT_fsid_config_cache_table)
{
PINT_fsid_config_cache_table =
qhash_init(hash_fsid_compare,hash_fsid,11);
}
- srand((unsigned int)time(NULL));
+
+ /* include time, pid, and hostname in random seed in order to help avoid
+ * collisions on object placement when many clients are launched
+ * concurrently
+ */
+ gettimeofday(&tv, NULL);
+ seed += tv.tv_sec;
+ seed += tv.tv_usec;
+
+ seed += getpid();
+
+ ret = gethostname(hostname, HOST_NAME_MAX);
+ if(ret == 0)
+ {
+ hostnamelen = strlen(hostname);
+ for(i=0; i<hostnamelen; i++)
+ {
+ seed += (hostname[hostnamelen - i - 1] + i*256);
+ }
+ }
+
+ srand(seed);
+
return (PINT_fsid_config_cache_table ? 0 : -PVFS_ENOMEM);
}
@@ -448,9 +480,10 @@ int PINT_cached_config_map_servers(
struct PINT_llist *server_list;
struct host_handle_mapping_s *cur_mapping = NULL;
struct config_fs_cache_s *cur_config_cache = NULL;
- int num_io_servers, i, j, ret;
+ int num_io_servers, i, ret;
int start_index = -1;
int index;
+ int random_attempts;
assert(inout_num_datafiles);
@@ -544,8 +577,13 @@ int PINT_cached_config_map_servers(
break;
case PVFS_SYS_LAYOUT_RANDOM:
+ /* this layout randomizes the order but still uses each server
+ * only once
+ */
- /* all random */
+ /* limit this layout to a number of datafiles no greater than
+ * the number of servers
+ */
if(num_io_servers < *inout_num_datafiles)
{
*inout_num_datafiles = num_io_servers;
@@ -554,34 +592,51 @@ int PINT_cached_config_map_servers(
/* init all the addrs to 0, so we know whether we've set an
* address at a particular index or not
*/
+ memset(addr_array, 0, (*inout_num_datafiles)*sizeof(*addr_array));
+
for(i = 0; i < *inout_num_datafiles; ++i)
{
+ /* go through server list in order */
+ cur_mapping = PINT_llist_head(server_list);
+ assert(cur_mapping);
+ server_list = PINT_llist_next(server_list);
+
+ /* select random index into caller's list */
index = rand() % *inout_num_datafiles;
- for(j = 0; j < i; ++j)
+ random_attempts = 1;
+
+ /* if we have already filled that index, try another random
+ * index
+ */
+ while(addr_array[index] != 0 && random_attempts < 6)
{
- if(addr_array[index] == 0)
- {
- cur_mapping = PINT_llist_head(server_list);
- assert(cur_mapping);
- server_list = PINT_llist_next(server_list);
-
- /* found an unused index */
- ret = BMI_addr_lookup(
- &addr_array[index],
- cur_mapping->alias_mapping->bmi_address);
- if (ret)
- {
- return ret;
- }
-
- if(handle_extent_array)
- {
- handle_extent_array[index].extent_count =
- cur_mapping->handle_extent_array.extent_count;
- handle_extent_array[index].extent_array =
- cur_mapping->handle_extent_array.extent_array;
- }
- }
+ index = rand() % *inout_num_datafiles;
+ random_attempts++;
+ }
+
+ /* if we exhausted a max number of randomization attempts,
+ * then just go linearly through list
+ */
+ while(addr_array[index] != 0)
+ {
+ index = (index + 1) % *inout_num_datafiles;
+ }
+
+ /* found an unused index */
+ ret = BMI_addr_lookup(
+ &addr_array[index],
+ cur_mapping->alias_mapping->bmi_address);
+ if (ret)
+ {
+ return ret;
+ }
+
+ if(handle_extent_array)
+ {
+ handle_extent_array[index].extent_count =
+ cur_mapping->handle_extent_array.extent_count;
+ handle_extent_array[index].extent_array =
+ cur_mapping->handle_extent_array.extent_array;
}
}
break;
Index: pint-hint.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/common/misc/Attic/pint-hint.c,v
diff -p -u -r1.2.2.1 -r1.2.2.2
--- pint-hint.c 7 Apr 2008 19:01:18 -0000 1.2.2.1
+++ pint-hint.c 21 May 2008 18:55:10 -0000 1.2.2.2
@@ -51,15 +51,29 @@ static const struct PINT_hint_info hint_
PVFS_HINT_HANDLE_NAME,
encode_func_uint64_t,
decode_func_uint64_t,
- sizeof(uint32_t)},
+ sizeof(PVFS_handle)},
{PINT_HINT_OP_ID,
- PINT_HINT_TRANSFER,
+ 0,
PVFS_HINT_OP_ID_NAME,
encode_func_uint32_t,
decode_func_uint32_t,
sizeof(uint32_t)},
+ {PINT_HINT_RANK,
+ PINT_HINT_TRANSFER,
+ PVFS_HINT_RANK_NAME,
+ encode_func_uint32_t,
+ decode_func_uint32_t,
+ sizeof(uint32_t)},
+
+ {PINT_HINT_SERVER_ID,
+ PINT_HINT_TRANSFER,
+ PVFS_HINT_SERVER_ID_NAME,
+ encode_func_uint32_t,
+ decode_func_uint32_t,
+ sizeof(uint32_t)},
+
{0}
};
@@ -203,16 +217,19 @@ void encode_PINT_hint(char **pptr, const
while(tmp_hint)
{
/* encode the hint type */
- encode_uint32_t(pptr, &tmp_hint->type);
-
- /* if the type is unknown, encode the type string */
- if(tmp_hint->type == PINT_HINT_UNKNOWN)
+ if(tmp_hint->flags & PINT_HINT_TRANSFER)
{
- encode_string(pptr, &tmp_hint->type_string);
- }
+ encode_uint32_t(pptr, &tmp_hint->type);
- /* encode the hint using the encode function provided */
- tmp_hint->encode(pptr, tmp_hint->value);
+ /* if the type is unknown, encode the type string */
+ if(tmp_hint->type == PINT_HINT_UNKNOWN)
+ {
+ encode_string(pptr, &tmp_hint->type_string);
+ }
+
+ /* encode the hint using the encode function provided */
+ tmp_hint->encode(pptr, tmp_hint->value);
+ }
tmp_hint = tmp_hint->next;
}
Index: pint-hint.h
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/common/misc/pint-hint.h,v
diff -p -u -r1.1.2.1 -r1.1.2.2
--- pint-hint.h 7 Apr 2008 19:01:18 -0000 1.1.2.1
+++ pint-hint.h 21 May 2008 18:55:10 -0000 1.1.2.2
@@ -12,6 +12,8 @@
#define PVFS_HINT_MAX_LENGTH 1024
#define PVFS_HINT_MAX_NAME_LENGTH 512
+#define PINT_HINT_TRANSFER 0x01
+
#include "pvfs2-hint.h"
enum PINT_hint_type
@@ -21,6 +23,8 @@ enum PINT_hint_type
PINT_HINT_CLIENT_ID,
PINT_HINT_HANDLE,
PINT_HINT_OP_ID,
+ PINT_HINT_RANK,
+ PINT_HINT_SERVER_ID
};
typedef struct PVFS_hint_s
@@ -68,6 +72,10 @@ int PVFS_hint_add_internal(
#define PINT_HINT_GET_OP_ID(hints) \
PINT_hint_get_value_by_type(hints, PINT_HINT_OP_ID, NULL) ? \
*(uint32_t *)PINT_hint_get_value_by_type(hints, PINT_HINT_OP_ID, NULL) : 0
+
+#define PINT_HINT_GET_RANK(hints) \
+ PINT_hint_get_value_by_type(hints, PINT_HINT_RANK, NULL) ? \
+ *(uint32_t *)PINT_hint_get_value_by_type(hints, PINT_HINT_RANK, NULL) : 0
#endif /* __PINT_HINT_H__ */
Index: pvfs2-util.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/common/misc/pvfs2-util.c,v
diff -p -u -r1.100 -r1.100.4.1
--- pvfs2-util.c 6 Mar 2008 22:11:50 -0000 1.100
+++ pvfs2-util.c 21 May 2008 18:55:10 -0000 1.100.4.1
@@ -1172,43 +1172,55 @@ int PVFS_util_init_defaults(void)
#define KILOBYTE 1024
#define MEGABYTE (1024 * KILOBYTE)
#define GIGABYTE (1024 * MEGABYTE)
-/*
-#define TERABYTE (1024 * GIGABYTE)
-#define PETABYTE (1024 * TERABYTE)
-#define EXABYTE (1024 * PETABYTE)
-#define ZETTABYTE (1024 * EXABYTE)
-#define YOTTABYTE (1024 * ZETTABYTE)
-*/
+#define TERABYTE (1024llu * GIGABYTE)
+#define PETABYTE (1024llu * TERABYTE)
+#define EXABYTE (1024llu * PETABYTE)
+#define ZETTABYTE (1024llu * EXABYTE)
+#define YOTTABYTE (1024llu * ZETTABYTE)
+
/*****************/
/* si size units */
/*****************/
#define SI_KILOBYTE 1000
#define SI_MEGABYTE (1000 * SI_KILOBYTE)
#define SI_GIGABYTE (1000 * SI_MEGABYTE)
-/*
-#define SI_TERABYTE (1000 * SI_GIGABYTE)
-#define SI_PETABYTE (1000 * SI_TERABYTE)
-#define SI_EXABYTE (1000 * SI_PETABYTE)
-#define SI_ZETTABYTE (1000 * SI_EXABYTE)
-#define SI_YOTTABYTE (1000 * SI_ZETTABYTE)
-*/
-#define NUM_SIZES 3
+#define SI_TERABYTE (1000llu * SI_GIGABYTE)
+#define SI_PETABYTE (1000llu * SI_TERABYTE)
+#define SI_EXABYTE (1000llu * SI_PETABYTE)
+#define SI_ZETTABYTE (1000llu * SI_EXABYTE)
+#define SI_YOTTABYTE (1000llu * SI_ZETTABYTE)
+
+#if SIZEOF_LONG_INT == 8
+#define NUM_SIZES 5
+#else
+#define NUM_SIZES 4
+#endif
static PVFS_size PINT_s_size_table[NUM_SIZES] =
{
- /*YOTTABYTE, ZETTABYTE, EXABYTE, PETABYTE, TERABYTE, */
+ /*YOTTABYTE, ZETTABYTE, EXABYTE, */
+#if SIZEOF_LONG_INT == 8
+ PETABYTE,
+ TERABYTE,
+#endif
GIGABYTE, MEGABYTE, KILOBYTE
};
static PVFS_size PINT_s_si_size_table[NUM_SIZES] =
{
- /*SI_YOTTABYTE, SI_ZETTABYTE, SI_EXABYTE, SI_PETABYTE, SI_TERABYTE, */
+ /*SI_YOTTABYTE, SI_ZETTABYTE, SI_EXABYTE, */
+#if SIZEOF_LONG_INT == 8
+ SI_PETABYTE, SI_TERABYTE,
+#endif
SI_GIGABYTE, SI_MEGABYTE, SI_KILOBYTE
};
static const char *PINT_s_str_size_table[NUM_SIZES] =
{
- /*"Y", "Z", "E", "P","T", */
+ /*"Y", "Z", "E", */
+#if SIZEOF_LONG_INT == 8
+ "P","T",
+#endif
"G", "M", "K"
};
Index: server-config.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/common/misc/server-config.c,v
diff -p -u -r1.106 -r1.106.10.1
--- server-config.c 7 Nov 2007 22:26:07 -0000 1.106
+++ server-config.c 21 May 2008 18:55:10 -0000 1.106.10.1
@@ -140,7 +140,8 @@ static char *get_handle_range_str(
int meta_handle_range);
static host_alias_s *find_host_alias_ptr_by_alias(
struct server_configuration_s *config_s,
- char *alias);
+ char *alias,
+ int *index);
static struct host_handle_mapping_s *get_or_add_handle_mapping(
PINT_llist *list,
char *alias);
@@ -876,6 +877,9 @@ static const configoption_t options[] =
/* This option specifies the method used for trove. Currently the
* dbpf method is the default. Other methods include 'alt-aio'.
*
+ * The null-aio method is an implementation that does no disk I/O at all
+ * and is only useful for development or debugging purposes.
+ *
* Note that this option can be specified in either the <a href="#Defaults">
* Defaults</a> context of the main fs.conf, or in a filesystem specific
* <a href="#StorageHints">StorageHints</a>
@@ -973,7 +977,7 @@ int PINT_parse_config(
{
struct host_alias_s *halias;
halias = find_host_alias_ptr_by_alias(
- config_s, server_alias_name);
+ config_s, server_alias_name, &config_s->host_index);
if (!halias || !halias->bmi_address)
{
gossip_err("Configuration file error. "
@@ -2407,12 +2411,12 @@ DOTCONF_CB(get_range_list)
is_new_handle_mapping = 1;
handle_mapping->alias_mapping =
find_host_alias_ptr_by_alias(
- config_s, cmd->data.list[i-1]);
+ config_s, cmd->data.list[i-1], NULL);
}
assert(handle_mapping->alias_mapping ==
find_host_alias_ptr_by_alias(
- config_s, cmd->data.list[i-1]));
+ config_s, cmd->data.list[i-1], NULL));
if (!handle_mapping->handle_range &&
!handle_mapping->handle_extent_array.extent_array)
@@ -2597,6 +2601,10 @@ DOTCONF_CB(get_trove_method)
{
*method = TROVE_METHOD_DBPF_ALTAIO;
}
+ else if(!strcmp(cmd->data.str, "null-aio"))
+ {
+ *method = TROVE_METHOD_DBPF_NULLAIO;
+ }
else
{
return "Error unknown TroveMethod option\n";
@@ -3133,17 +3141,20 @@ static void copy_filesystem(
static host_alias_s *find_host_alias_ptr_by_alias(
struct server_configuration_s *config_s,
- char *alias)
+ char *alias,
+ int *index)
{
PINT_llist *cur = NULL;
struct host_alias_s *ret = NULL;
struct host_alias_s *cur_alias = NULL;
+ int ind = 0;
if (config_s && alias)
{
cur = config_s->host_aliases;
while(cur)
{
+ ind++;
cur_alias = PINT_llist_head(cur);
if (!cur_alias)
{
@@ -3160,6 +3171,7 @@ static host_alias_s *find_host_alias_ptr
cur = PINT_llist_next(cur);
}
}
+ if(index) *index = ind - 1;
return ret;
}
Index: server-config.h
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/common/misc/server-config.h,v
diff -p -u -r1.60 -r1.60.10.1
--- server-config.h 7 Nov 2007 22:26:07 -0000 1.60
+++ server-config.h 21 May 2008 18:55:10 -0000 1.60.10.1
@@ -135,6 +135,7 @@ typedef struct distribution_configuratio
typedef struct server_configuration_s
{
char *host_id;
+ int host_index;
char *server_alias; /* the command line server-alias parameter */
int my_server_options;
char *storage_path;
Index: state-machine-fns.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/common/misc/state-machine-fns.c,v
diff -p -u -r1.12 -r1.12.4.1
--- state-machine-fns.c 2 Apr 2008 17:00:18 -0000 1.12
+++ state-machine-fns.c 21 May 2008 18:55:10 -0000 1.12.4.1
@@ -16,27 +16,6 @@
#include "state-machine.h"
#include "client-state-machine.h"
-/* STATE-MACHINE-FNS.C
- *
- * This file implements a small collection of functions used when
- * interacting with the state machine system implemented in
- * state-machine.h. Probably you'll only need these functions in one
- * file per instance of a state machine implementation.
- *
- * Note that state-machine.h must be included before this is included.
- * This is usually accomplished through including some *other* file that
- * includes state-machine.h, because state-machine.h needs a key #define
- * before it can be included.
- *
- * The PINT_OP_STATE_TABLE has been replaced with a macro that must be #defined
- * instead: PINT_OP_STATE_GET_MACHINE.
- * This allows the _locate function to be used in the client as well.
- *
- * A good example of this is the pvfs2-server.h in the src/server directory,
- * which includes state-machine.h at the bottom, and server-state-machine.c,
- * which includes first pvfs2-server.h and then state-machine-fns.h.
- */
-
struct PINT_frame_s
{
int task_id;
@@ -657,7 +636,7 @@ void *PINT_sm_frame(struct PINT_smcb *sm
return NULL;
}
prev = smcb->frames.prev;
- while(target--)
+ while(target)
{
target--;
prev = prev->prev;
@@ -685,6 +664,7 @@ int PINT_sm_push_frame(struct PINT_smcb
}
newframe->task_id = task_id;
newframe->frame = frame_p;
+ newframe->error = 0;
qlist_add(&newframe->link, &smcb->frames);
smcb->frame_count++;
return 0;
More information about the Pvfs2-cvs
mailing list