[Pvfs2-cvs] commit by pcarns in pvfs2-1/src/server: create.sm
unstuff.sm
CVS commit program
cvs at parl.clemson.edu
Fri Feb 29 16:33:46 EST 2008
Update of /projects/cvsroot/pvfs2-1/src/server
In directory parlweb1:/tmp/cvs-serv14260/src/server
Modified Files:
Tag: small-file-branch
create.sm unstuff.sm
Log Message:
cutting down on keyvals read by unstuff by relying on what getattr work
nested sm found where possible
Index: create.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/src/server/create.sm,v
diff -p -u -r1.46.6.6 -r1.46.6.7
--- create.sm 28 Feb 2008 14:55:03 -0000 1.46.6.6
+++ create.sm 29 Feb 2008 21:33:46 -0000 1.46.6.7
@@ -403,6 +403,9 @@ static PINT_sm_action write_keyvals(
s_op->key_a[2].buffer = Trove_Common_Keys[METAFILE_LAYOUT_KEY].key;
s_op->key_a[2].buffer_sz = Trove_Common_Keys[METAFILE_LAYOUT_KEY].size;
+ /* TODO: don't we need to store more than just the algorithm? Where
+ * does the server_list go if LAYOUT_LIST was used?
+ */
s_op->val_a[2].buffer =
&s_op->req->u.create.layout.algorithm;
s_op->val_a[2].buffer_sz =
Index: unstuff.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/src/server/Attic/unstuff.sm,v
diff -p -u -r1.1.2.4 -r1.1.2.5
--- unstuff.sm 29 Feb 2008 20:27:06 -0000 1.1.2.4
+++ unstuff.sm 29 Feb 2008 21:33:46 -0000 1.1.2.5
@@ -20,10 +20,7 @@
#include "pvfs2-internal.h"
#include "pint-cached-config.h"
-enum
-{
- ALREADY_BIG
-};
+#define STATE_UNSTUFF 33
%%
@@ -52,7 +49,7 @@ machine pvfs2_unstuff_sm
state getattr_interpret
{
run getattr_interpret;
- success => get_keyvals;
+ STATE_UNSTUFF => get_keyvals;
default => setup_resp;
}
@@ -67,7 +64,6 @@ machine pvfs2_unstuff_sm
{
run inspect_keyvals;
success => get_handles;
- ALREADY_BIG => setup_resp;
default => setup_resp;
}
@@ -125,10 +121,9 @@ static PINT_sm_action get_keyvals(
struct PINT_server_op *s_op = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
int kind = 0;
int ret;
- PVFS_handle *dfile_array;
job_id_t job_id;
- s_op->keyval_count = 4;
+ s_op->keyval_count = 2;
s_op->key_a = malloc(sizeof(*s_op->key_a) * s_op->keyval_count);
if(!s_op->key_a)
{
@@ -149,20 +144,15 @@ static PINT_sm_action get_keyvals(
js_p->error_code = -PVFS_ENOMEM;
goto free_val_array;
}
- memset(s_op->error_a, 0, sizeof(*s_op->free_a) * s_op->keyval_count);
-
- s_op->free_a = malloc(sizeof(*s_op->free_a) * s_op->keyval_count);
- if(!s_op->free_a)
- {
- js_p->error_code = -PVFS_ENOMEM;
- goto free_free_array;
- }
- memset(s_op->free_a, 0, sizeof(*s_op->free_a) * s_op->keyval_count);
+ memset(s_op->error_a, 0, sizeof(*s_op->error_a) * s_op->keyval_count);
/* kind = 0 */
s_op->key_a[kind].buffer = Trove_Common_Keys[METAFILE_LAYOUT_KEY].key;
s_op->key_a[kind].buffer_sz = Trove_Common_Keys[METAFILE_LAYOUT_KEY].size;
+ /* TODO: don't we need to read more than just the algorithm? What about
+ * the server list (if present)?
+ */
s_op->val_a[kind].buffer = &s_op->u.unstuff.algorithm;
s_op->val_a[kind].buffer_sz = sizeof(s_op->u.unstuff.algorithm);
@@ -174,46 +164,6 @@ static PINT_sm_action get_keyvals(
s_op->val_a[kind].buffer = &s_op->u.unstuff.num_dfiles_req;
s_op->val_a[kind].buffer_sz = sizeof(s_op->u.unstuff.num_dfiles_req);
- ++kind;
- /* kind = 3 */
- s_op->key_a[kind].buffer = Trove_Common_Keys[METAFILE_HANDLES_KEY].key;
- s_op->key_a[kind].buffer_sz = Trove_Common_Keys[METAFILE_HANDLES_KEY].size;
-
- /* TODO: does meta.dfile_count know how many handles we have stored here?
- * I think it may be 1 if the file is stuffed...
- */
- /* TODO: should dfile_array pointer be aimed at meta.dfile_array?
- */
- dfile_array = malloc(sizeof(*dfile_array) * s_op->attr.u.meta.dfile_count);
- if(!dfile_array)
- {
- js_p->error_code = -PVFS_ENOMEM;
- goto free_error_array;
- }
-
- s_op->val_a[kind].buffer = dfile_array;
- s_op->val_a[kind].buffer_sz =
- sizeof(*dfile_array) * s_op->attr.u.meta.dfile_count;
- s_op->free_a[kind] = 1;
-
- ++kind;
- /* kind = 4 */
- s_op->key_a[kind].buffer = Trove_Common_Keys[METAFILE_DIST_KEY].key;
- s_op->key_a[kind].buffer_sz = Trove_Common_Keys[METAFILE_DIST_KEY].size;
-
- s_op->val_a[kind].buffer_sz = s_op->attr.u.meta.dist_size;
- s_op->val_a[kind].buffer = malloc(s_op->val_a[kind].buffer_sz);
- if(!s_op->val_a[kind].buffer)
- {
- js_p->error_code = -PVFS_ENOMEM;
- goto free_dfile_array;
- }
- s_op->free_a[kind] = 1;
- s_op->attr.u.meta.dist = s_op->val_a[kind].buffer;
- /* TODO: should we mark free_a for dfile_array and dist, or use
- * free_object_attr()?
- */
-
ret = job_trove_keyval_read_list(
s_op->req->u.unstuff.fs_id,
s_op->req->u.unstuff.handle,
@@ -221,12 +171,6 @@ static PINT_sm_action get_keyvals(
0, NULL, smcb, 0, js_p, &job_id, server_job_context);
return ret;
-free_dfile_array:
- free(dfile_array);
-free_error_array:
- free(s_op->error_a);
-free_free_array:
- free(s_op->free_a);
free_val_array:
free(s_op->val_a);
free_key_array:
@@ -240,14 +184,27 @@ static PINT_sm_action inspect_keyvals(
{
struct PINT_server_op *s_op = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
- if(s_op->error_a[0] != 0)
+ if(js_p->error_code == 0)
{
- /* no layout, so either it was removed (signalling unstuff already
- * occurring, or this file was never stuffed
- */
- js_p->error_code = ALREADY_BIG;
+ /* check keys; we have a big problem if one of them is missing */
+ if(s_op->error_a[0])
+ {
+ js_p->error_code = s_op->error_a[0];
+ }
+ else if(s_op->error_a[1])
+ {
+ js_p->error_code = s_op->error_a[1];
+ }
}
+ /* go ahead and free up keyval structures as soon as we are done with
+ * them
+ */
+ free(s_op->val_a);
+ free(s_op->key_a);
+ free(s_op->error_a);
+
+ /* pass along error code for next state to handle */
return SM_ACTION_COMPLETE;
}
@@ -263,6 +220,9 @@ static PINT_sm_action get_handles(
const char **server_names;
struct PINT_server_op *s_op = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
+ /* TODO: pick back up here; returning early for now */
+ js_p->error_code = -PVFS_ENOSYS;
+ return SM_ACTION_COMPLETE;
layout.algorithm = s_op->u.unstuff.algorithm;
layout.server_list.count = 0;
@@ -379,36 +339,8 @@ static PINT_sm_action cleanup(
struct PINT_smcb *smcb, job_status_s *js_p)
{
struct PINT_server_op *s_op = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
- int i;
-
- if(s_op->error_a)
- {
- free(s_op->error_a);
- }
-
- if(s_op->val_a)
- {
- for(i = 0; i < s_op->keyval_count; ++i)
- {
- if(s_op->free_a[i])
- {
- free(s_op->val_a[i].buffer);
- }
- }
-
- free(s_op->val_a);
- }
-
- if(s_op->free_a)
- {
- free(s_op->free_a);
- }
-
- if(s_op->key_a)
- {
- free(s_op->key_a);
- }
+ PINT_free_object_attr(&s_op->resp.u.getattr.attr);
return (server_state_machine_complete(smcb));
}
@@ -471,9 +403,30 @@ static PINT_sm_action getattr_interpret(
free(getattr_op);
- /* TODO: pick back up here */
- /* exit early for now */
- js_p->error_code = -PVFS_ENOSYS;
+ /* TODO: TEMPORARY!
+ * valgrind seems to think that error_code is uninitialized; need to
+ * track down later
+ */
+ js_p->error_code = 0;
+
+ if(js_p->error_code)
+ {
+ gossip_debug(GOSSIP_SERVER_DEBUG,
+ "unstuff failed to retrieve existing attrs.\n");
+ return(SM_ACTION_COMPLETE);
+ }
+
+ if(s_op->resp.u.unstuff.attr.mask & PVFS_ATTR_META_UNSTUFFED)
+ {
+ gossip_debug(GOSSIP_SERVER_DEBUG,
+ "unstuff found file already unstuffed; return existing attrs.\n");
+ js_p->error_code = 0;
+ return(SM_ACTION_COMPLETE);
+ }
+
+ gossip_debug(GOSSIP_SERVER_DEBUG,
+ "unstuff found stuffed file.\n");
+ js_p->error_code = STATE_UNSTUFF;
return SM_ACTION_COMPLETE;
}
More information about the Pvfs2-cvs
mailing list