Skip to content

Commit

Permalink
"post_create works except that osd_io_cleanup should be changed and s…
Browse files Browse the repository at this point in the history
…etattr

and crdirent should be added"
"get_member_attributes works except for passing cid"



git-svn-id: svn+ssh://137.99.13.219/srv/svn/ofsproject/ofsproject/2.8.4-stock/osd_branch@53 dfcdf660-53a5-499b-8775-f9b82cf2d3b9
  • Loading branch information
cek10006 committed Jan 13, 2012
1 parent ce4e019 commit 3a6ebe1
Show file tree
Hide file tree
Showing 8 changed files with 418 additions and 150 deletions.
167 changes: 34 additions & 133 deletions src/client/sysint/sys-create.sm
Original file line number Diff line number Diff line change
Expand Up @@ -130,25 +130,10 @@ machine pvfs2_client_create_sm
state datafiles_xfer_osd_msgpair_array
{
jump pvfs2_osd_msgpairarray_sm;
/*success => test_fetch_attrs;*/
success => create_setattr_setup_msgpair;
default => crdirent_failure;
}

state test_fetch_attrs
{
run test_fetch_attrs_func;
success => test_fetch_attrs_xfer_msgpair;
default => cleanup;
}

state test_fetch_attrs_xfer_msgpair
{
jump pvfs2_osd_msgpairarray_sm;
success => create_setattr_setup_msgpair;
default => cleanup;
}

state create_setattr_setup_msgpair
{
run create_setattr_setup_msgpair;
Expand Down Expand Up @@ -501,43 +486,6 @@ static int create_comp_fn(void *v_p,
return 0;
}

static int test_fetch_attrs_comp_fn(void *v_p,
struct PVFS_server_resp *resp_p,
int index)
{
gossip_err("test_fetch_attrs_comp_fn\n");
PINT_smcb *smcb = v_p;
PINT_client_sm *sm_p = PINT_sm_frame(smcb, PINT_MSGPAIR_PARENT_SM);
PVFS_error status;
int64_t size[sm_p->msgarray_op.count];
int i;

status = osd_errno_from_status(
sm_p->msgarray_op.msgarray[index].osd_command.status);

if (status != 0)
{
return status;
}

struct osd_command *command = &sm_p->msgarray_op.msgarray[index].osd_command;
int ret = osd_command_attr_resolve(command);
if (ret) {
osd_error_xerrno(ret, "%s: osd_command_attr_resolve failed",
__func__);
return ret;
}

for (i=0; i<sm_p->msgarray_op.count; i++) {
size[i] = get_ntohll(command->attr[i].val);
gossip_err("%lu\n", size[i]);
}

osd_command_attr_free(command);

return 0;
}

static int create_datafiles_comp_fn(void *v_p,
struct PVFS_server_resp *resp_p,
int index)
Expand Down Expand Up @@ -852,103 +800,56 @@ static PINT_sm_action create_datafiles_setup_msgpair_array(
return SM_ACTION_COMPLETE;
}

PINT_msgpair_init(&sm_p->msgarray_op);
msg_p = &sm_p->msgarray_op.msgpair;
if(server_config->post_create) {
PINT_msgpair_init(&sm_p->msgarray_op);
msg_p = &sm_p->msgarray_op.msgpair;

#define CURRENT_COMMAND_PAGE 0xfffffffeUL
#define CURRENT_COMMAND_PAGE_OID 4

if (is_osd) {
struct osd_command *command = &sm_p->msgarray_op.msgarray[0].osd_command;
uint64_t attrval;
struct attribute_list attrs[] = {{ ATTR_GET, CUR_CMD_ATTR_PG,
if (is_osd) {
struct osd_command *command = &sm_p->msgarray_op.msgarray[0].osd_command;
uint64_t attrval;
struct attribute_list attrs[] = {{ ATTR_GET, CUR_CMD_ATTR_PG,
CCAP_OID, NULL, CCAP_OID_LEN },
{ ATTR_SET, USER_COLL_PG, 1, &attrval, 8}};

set_htonll(&attrval, COLLECTION_OID_LB);
set_htonll(&attrval, COLLECTION_OID_LB);

/*
* A hack in PVFS_util_init_defaults has set up an object an the
* low bound of the extent array. So as we create handles, we get
* them in increasing order that satisfies our extent bounds.
*/
ret = osd_command_set_create(command, PVFS_OSD_DATA_PID, 0, 1);
if (ret) {
osd_error_xerrno(ret, "%s: osd_command_set_create failed",
/*
* A hack in PVFS_util_init_defaults has set up an object an the
* low bound of the extent array. So as we create handles, we get
* them in increasing order that satisfies our extent bounds.
*/
ret = osd_command_set_create(command, PVFS_OSD_DATA_PID, 0, 1);
if (ret) {
osd_error_xerrno(ret, "%s: osd_command_set_create failed",
__func__);
js_p->error_code = ret;
return 1;
}
js_p->error_code = ret;
return 1;
}

ret = osd_command_attr_build(command, attrs, 2);
if (ret) {
osd_error_xerrno(ret, "%s: osd_command_attr_build failed",
ret = osd_command_attr_build(command, attrs, 2);
if (ret) {
osd_error_xerrno(ret, "%s: osd_command_attr_build failed",
__func__);
js_p->error_code = ret;
return 1;
}
}

msg_p->fs_id = sm_p->object_ref.fs_id;
msg_p->handle = sm_p->u.create.io_handle_extent_array[0].
extent_array[0].first;
msg_p->retry_flag = PVFS_MSGPAIR_NO_RETRY;
msg_p->comp_fn = create_datafiles_comp_fn;
msg_p->svr_addr = sm_p->u.create.data_server_addrs[0];

PINT_sm_push_frame(smcb, 0, &sm_p->msgarray_op);
return SM_ACTION_COMPLETE;
}

static PINT_sm_action test_fetch_attrs_func(
struct PINT_smcb *smcb, job_status_s *js_p)
{
gossip_err("test_fetch_attrs_func\n");
struct PINT_client_sm *sm_p = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
int ret = -PVFS_EINVAL;
PINT_sm_msgpair_state *msg_p = NULL;
int i;

js_p->error_code = 0;

PINT_msgpair_init(&sm_p->msgarray_op);
msg_p = &sm_p->msgarray_op.msgpair;
js_p->error_code = ret;
return 1;
}
}

msg_p->fs_id = sm_p->object_ref.fs_id;
msg_p->handle = sm_p->u.create.io_handle_extent_array[0].
msg_p->fs_id = sm_p->object_ref.fs_id;
msg_p->handle = sm_p->u.create.io_handle_extent_array[0].
extent_array[0].first;
msg_p->retry_flag = PVFS_MSGPAIR_NO_RETRY;
msg_p->comp_fn = test_fetch_attrs_comp_fn;
msg_p->svr_addr = sm_p->u.create.data_server_addrs[0];

struct attribute_list attr[sm_p->msgarray_op.count];
struct osd_command *command = &sm_p->msgarray_op.msgpair.osd_command;

/* Set attr type, page and number */
for (i = 0; i < sm_p->msgarray_op.count; i++) {
attr[i].type = ATTR_GET;
attr[i].page = 0x1;
attr[i].number = 0x82; /* logical length (not used capacity) */
attr[i].len = sizeof(uint64_t);
}
msg_p->retry_flag = PVFS_MSGPAIR_NO_RETRY;
msg_p->comp_fn = create_datafiles_comp_fn;
msg_p->svr_addr = sm_p->u.create.data_server_addrs[0];

ret = osd_command_set_get_member_attributes(command, PVFS_OSD_DATA_PID, COLLECTION_OID_LB);
if (ret) {
osd_error_xerrno(ret, "%s: osd_command_set_get_member_attributes failed",
__func__);
js_p->error_code = ret;
return 1;
}

ret = osd_command_attr_build(command, attr, sm_p->msgarray_op.count);
if (ret) {
osd_error_xerrno(ret, "%s: osd_command_attr_build failed",
__func__);
js_p->error_code = ret;
return 1;
PINT_sm_push_frame(smcb, 0, &sm_p->msgarray_op);
} else {
js_p->error_code = 0;
}

PINT_sm_push_frame(smcb, 0, &sm_p->msgarray_op);
return SM_ACTION_COMPLETE;
}

Expand Down
13 changes: 11 additions & 2 deletions src/client/sysint/sys-getattr.sm
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ enum
GETATTR_ACACHE_MISS = 1,
GETATTR_NEED_DATAFILE_SIZES = 2,
GETATTR_IO_RETRY = 3,
OSD_MSGPAIR = 2001
OSD_MSGPAIR = 2001,
IO_DO_OSD = 2002
};

/* completion function prototypes */
Expand Down Expand Up @@ -106,6 +107,7 @@ nested machine pvfs2_client_getattr_sm
run getattr_acache_lookup;
GETATTR_ACACHE_MISS => object_getattr_setup_msgpair;
GETATTR_NEED_DATAFILE_SIZES => datafile_get_sizes;
IO_DO_OSD => acache_insert;
default => cleanup;
}

Expand Down Expand Up @@ -359,6 +361,13 @@ static PINT_sm_action getattr_acache_lookup(
&attr_status,
&sm_p->getattr.size,
&size_status);

if(sm_p->u.io.io_type == PVFS_IO_WRITE && !sm_p->getattr.attr.u.meta.dfile_count) {
/* the object that we are trying to write to has not been created */
js_p->error_code = IO_DO_OSD;
return SM_ACTION_COMPLETE;
}

if(ret < 0 || attr_status < 0)
{
gossip_debug(GOSSIP_ACACHE_DEBUG, "acache: clean acache miss: "
Expand Down Expand Up @@ -1428,7 +1437,7 @@ static PINT_sm_action getattr_cleanup(
free(getattr->size_array);

/* cleanup getattr when an error occurs */
if (js_p->error_code)
if (js_p->error_code && js_p->error_code != IO_DO_OSD)
{
if (getattr->attr.mask & PVFS_ATTR_META_DFILES)
{
Expand Down
8 changes: 5 additions & 3 deletions src/client/sysint/sys-io.sm
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,16 @@
#include "PINT-reqproto-encode.h"
#include "pint-util.h"
#include "pvfs2-internal.h"
#include "osd-util/osd-util.h"

#define IO_MAX_SEGMENT_NUM 50
#define IO_ATTR_MASKS (PVFS_ATTR_META_ALL|PVFS_ATTR_COMMON_TYPE)

extern job_context_id pint_client_sm_context;

enum
{
IO_DO_OSD_IO = 2001
enum {
IO_DO_OSD_IO = 2001,
IO_OSD_NOT_CREATED = 2002
};

enum
Expand Down Expand Up @@ -169,6 +170,7 @@ machine pvfs2_client_io_sm
{
jump pvfs2_client_getattr_sm;
success => inspect_attr;
IO_OSD_NOT_CREATED => osd_io;
default => io_cleanup;
}

Expand Down
Loading

0 comments on commit 3a6ebe1

Please sign in to comment.