Skip to content

Commit

Permalink
"perf -o metafile is all set except ls after copying a file"
Browse files Browse the repository at this point in the history
git-svn-id: svn+ssh://137.99.13.219/srv/svn/ofsproject/ofsproject/2.8.4-stock/osd_branch@51 dfcdf660-53a5-499b-8775-f9b82cf2d3b9
  • Loading branch information
cek10006 committed Aug 20, 2011
1 parent 459c1aa commit a73feac
Show file tree
Hide file tree
Showing 7 changed files with 1,832 additions and 133 deletions.
3 changes: 3 additions & 0 deletions src/client/sysint/client-state-machine.h
Original file line number Diff line number Diff line change
Expand Up @@ -793,6 +793,9 @@ extern struct PINT_state_machine_s pvfs2_client_datafile_getattr_sizes_sm;
extern struct PINT_state_machine_s pvfs2_client_setattr_sm;
extern struct PINT_state_machine_s pvfs2_client_io_sm;
extern struct PINT_state_machine_s pvfs2_client_osd_io_sm;
extern struct PINT_state_machine_s pvfs2_client_osd_dirops_sm;
extern struct PINT_state_machine_s pvfs2_client_osd_dirops_attr1_sm;
extern struct PINT_state_machine_s pvfs2_client_osd_dirops_attr4_sm;
extern struct PINT_state_machine_s pvfs2_client_small_io_sm;
extern struct PINT_state_machine_s pvfs2_client_flush_sm;
extern struct PINT_state_machine_s pvfs2_client_sysint_readdir_sm;
Expand Down
3 changes: 2 additions & 1 deletion src/client/sysint/module.mk.in
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ CLIENT_SMCGEN := \
$(DIR)/mgmt-create-dirent.c \
$(DIR)/mgmt-get-dirdata-handle.c \
$(DIR)/osdsm.c \
$(DIR)/sys-osd-io.c
$(DIR)/sys-osd-io.c \
$(DIR)/sys-osd-dir.c

# track generated .c files that need to be removed during dist clean, etc.
SMCGEN += $(CLIENT_SMCGEN)
Expand Down
57 changes: 45 additions & 12 deletions src/client/sysint/remove.sm
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,18 @@ nested machine pvfs2_client_remove_helper_sm
state object_remove_setup_msgpair
{
run remove_object_remove_setup_msgpair;
OSD_MSGPAIR => object_remove_xfer_osd_msgpair;
success => object_remove_xfer_msgpair;
default => object_remove_failure;
}

state object_remove_xfer_osd_msgpair
{
jump pvfs2_osd_msgpairarray_sm;
success => remove_helper_cleanup;
default => object_remove_failure;
}

state object_remove_xfer_msgpair
{
jump pvfs2_msgpairarray_sm;
Expand All @@ -123,6 +131,7 @@ nested machine pvfs2_client_remove_helper_sm
static PINT_sm_action remove_getattr_init(
struct PINT_smcb *smcb, job_status_s *js_p)
{
gossip_err("remove_getattr_init\n");
struct PINT_client_sm *sm_p = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
PINT_SM_GETATTR_STATE_FILL(
sm_p->getattr,
Expand All @@ -136,6 +145,7 @@ static PINT_sm_action remove_getattr_init(
static PINT_sm_action remove_getattr_analyze_results(
struct PINT_smcb *smcb, job_status_s *js_p)
{
gossip_err("remove_getattr_analyze_results\n");
struct PINT_client_sm *sm_p = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
PVFS_object_attr *attr = NULL;
attr = &sm_p->getattr.attr;
Expand Down Expand Up @@ -179,6 +189,7 @@ static PINT_sm_action remove_getattr_analyze_results(
static PINT_sm_action remove_datafile_remove_setup_msgpair(
struct PINT_smcb *smcb, job_status_s *js_p)
{
gossip_err("remove_datafile_remove_setup_msgpair\n");
struct PINT_client_sm *sm_p = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
PVFS_object_attr *attr = NULL;
int ret = -PVFS_EINVAL;
Expand Down Expand Up @@ -244,29 +255,19 @@ static PINT_sm_action remove_datafile_remove_setup_msgpair(
static PINT_sm_action remove_object_remove_setup_msgpair(
struct PINT_smcb *smcb, job_status_s *js_p)
{
gossip_err("remove_object_remove_setup_msgpair\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;

gossip_debug(GOSSIP_CLIENT_DEBUG,
"remove state: object_remove_setup_msgpair\n");

js_p->error_code = 0;

PINT_msgpair_init(&sm_p->msgarray_op);
msg_p = &sm_p->msgarray_op.msgpair;

PINT_SERVREQ_REMOVE_FILL(
msg_p->req,
*sm_p->cred_p,
sm_p->object_ref.fs_id,
sm_p->object_ref.handle,
sm_p->hints);

msg_p->fs_id = sm_p->object_ref.fs_id;
msg_p->handle = sm_p->object_ref.handle;
msg_p->retry_flag = PVFS_MSGPAIR_RETRY;
msg_p->comp_fn = NULL;

ret = PINT_cached_config_map_to_server(
&msg_p->svr_addr, msg_p->handle, msg_p->fs_id);
Expand All @@ -277,7 +278,38 @@ static PINT_sm_action remove_object_remove_setup_msgpair(
js_p->error_code = ret;
}

PINT_sm_push_frame(smcb, 0, &sm_p->msgarray_op);
if (server_is_osd(msg_p->svr_addr)) {
/* XXX: if object to remove is a directory, first check if
* it is empty, then do the actual remove. And, worse yet,
* this must be done atomically: check for attrs, meaning
* is the dir empty, then if empty, remove. Hairy.
*/
/* Remove the metafile object */
uint64_t oid = sm_p->object_ref.handle;
struct osd_command *command = &sm_p->msgarray_op.msgpair.osd_command;

ret = osd_command_set_remove(command, PVFS_OSD_META_PID, oid);
if (ret) {
osd_error_xerrno(ret, "%s: osd_command_set_remove failed",
__func__);
js_p->error_code = ret;
return 1;
}
js_p->error_code = OSD_MSGPAIR;
} else {
PINT_SERVREQ_REMOVE_FILL(
msg_p->req,
*sm_p->cred_p,
sm_p->object_ref.fs_id,
sm_p->object_ref.handle,
sm_p->hints);
js_p->error_code = 0;
PINT_sm_push_frame(smcb, 0, &sm_p->msgarray_op);
}

msg_p->retry_flag = PVFS_MSGPAIR_RETRY;
msg_p->comp_fn = NULL;

return SM_ACTION_COMPLETE;
}

Expand Down Expand Up @@ -316,6 +348,7 @@ static PINT_sm_action remove_object_remove_failure(
static PINT_sm_action remove_helper_cleanup(
struct PINT_smcb *smcb, job_status_s *js_p)
{
gossip_err("remove_helper_cleanup\n");
struct PINT_client_sm *sm_p = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
gossip_debug(GOSSIP_CLIENT_DEBUG, "remove state: helper cleanup\n");

Expand Down
Loading

0 comments on commit a73feac

Please sign in to comment.