Skip to content

Commit

Permalink
"create object and create collection can get oids from the same exten…
Browse files Browse the repository at this point in the history
…t array. failure of creates is not handled yet. none of the osd functions uses 0 oid"

git-svn-id: svn+ssh://137.99.13.219/srv/svn/ofsproject/ofsproject/2.8.4-stock/osd_branch@56 dfcdf660-53a5-499b-8775-f9b82cf2d3b9
  • Loading branch information
cek10006 committed Mar 16, 2012
1 parent d925a85 commit 0cf3186
Show file tree
Hide file tree
Showing 11 changed files with 71 additions and 59 deletions.
1 change: 1 addition & 0 deletions src/client/sysint/client-state-machine.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ struct PINT_client_mkdir_sm
PVFS_sys_attr sys_attr; /* input parameter */
PVFS_ds_keyval *key_array;
PVFS_ds_keyval *val_array;
PVFS_handle cid;

int retry_count;
int stored_error_code;
Expand Down
1 change: 0 additions & 1 deletion src/client/sysint/sys-create.sm
Original file line number Diff line number Diff line change
Expand Up @@ -830,7 +830,6 @@ static PINT_sm_action create_datafiles_setup_msgpair_array(
* low bound of the extent array. So as we create handles, we get
* them in increasing order that satisfies our extent bounds.
*/
gossip_err("%d\n", sm_p->u.create.datafile_handles[0]);
ret = osd_command_set_create(command, PVFS_OSD_DATA_PID, sm_p->u.create.datafile_handles[0], 1);
if (ret) {
osd_error_xerrno(ret, "%s: osd_command_set_create failed",
Expand Down
13 changes: 7 additions & 6 deletions src/client/sysint/sys-getattr.sm
Original file line number Diff line number Diff line change
Expand Up @@ -369,13 +369,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 && server_config->post_create) {
/* 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 @@ -1439,7 +1439,7 @@ static PINT_sm_action getattr_cleanup(
{
struct PINT_client_sm *sm_p = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
PINT_sm_getattr_state *getattr = &(sm_p->getattr);

gossip_debug(GOSSIP_CLIENT_DEBUG,
"(%p) getattr state: getattr_cleanup\n", sm_p);

Expand Down Expand Up @@ -1475,7 +1475,7 @@ static PINT_sm_action getattr_cleanup(
PINT_dist_free(getattr->attr.u.meta.dist);
}
}/*end if error*/

return SM_ACTION_COMPLETE;
}

Expand All @@ -1491,7 +1491,7 @@ static PINT_sm_action getattr_set_sys_response(
PINT_SET_OP_COMPLETE;
return SM_ACTION_TERMINATE;
}

attr = &sm_p->getattr.attr;
assert(attr);

Expand Down Expand Up @@ -1591,6 +1591,7 @@ static PINT_sm_action getattr_set_sys_response(
sysresp->attr.mask = PVFS_util_object_to_sys_attr_mask(attr->mask);
sysresp->attr.size = 0;
sysresp->attr.objtype = attr->objtype;
sysresp->attr.cid = attr->cid;

if (js_p->error_code == 0)
{
Expand Down Expand Up @@ -1638,7 +1639,7 @@ static PINT_sm_action getattr_set_sys_response(
memset(sm_p->u.getattr.getattr_resp_p,
0, sizeof(PVFS_sysresp_getattr));
}

PINT_SM_GETATTR_STATE_CLEAR(sm_p->getattr);

PINT_SET_OP_COMPLETE;
Expand Down
48 changes: 19 additions & 29 deletions src/client/sysint/sys-mkdir.sm
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ machine pvfs2_client_mkdir_sm
state init
{
run mkdir_init;
CREATE_COLLECTION => create_collection;
default => parent_getattr;
}

Expand Down Expand Up @@ -83,7 +82,7 @@ machine pvfs2_client_mkdir_sm
state mkdir_msg_xfer_msgpair
{
jump pvfs2_msgpairarray_sm;
success => mkdir_seteattr_setup_msgpair;
success => create_collection;
default => mkdir_msg_failure;
}

Expand All @@ -92,6 +91,20 @@ machine pvfs2_client_mkdir_sm
run mkdir_msg_failure;
default => cleanup;
}

state create_collection
{
run create_collection_setup_msgpair;
success => create_collection_xfer_msgpair;
default => mkdir_crdirent_failure;
}

state create_collection_xfer_msgpair
{
jump pvfs2_osd_msgpairarray_sm;
success => mkdir_seteattr_setup_msgpair;
default => mkdir_crdirent_failure;
}

state mkdir_seteattr_setup_msgpair
{
Expand Down Expand Up @@ -128,20 +141,6 @@ machine pvfs2_client_mkdir_sm
default => mkdir_crdirent_failure;
}

state create_collection
{
run create_collection_setup_msgpair;
success => create_collection_xfer_msgpair;
default => mkdir_crdirent_failure;
}

state create_collection_xfer_msgpair
{
jump pvfs2_osd_msgpairarray_sm;
success => parent_getattr;
default => mkdir_crdirent_failure;
}

state mkdir_crdirent_failure
{
run mkdir_crdirent_failure;
Expand Down Expand Up @@ -282,14 +281,6 @@ static PINT_sm_action mkdir_init(
{
struct PINT_client_sm *sm_p = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
job_id_t tmp_id;
struct server_configuration_s *server_config;

server_config = PINT_get_server_config_struct(
sm_p->object_ref.fs_id);
PINT_put_server_config_struct(server_config);

if (server_config->member_attr)
js_p->error_code = CREATE_COLLECTION;

gossip_debug(GOSSIP_CLIENT_DEBUG, "mkdir state: init\n");

Expand Down Expand Up @@ -334,6 +325,7 @@ static int mkdir_msg_comp_fn(void *v_p,

/* otherwise, just stash the newly created meta handle */
sm_p->u.mkdir.metafile_handle = resp_p->u.mkdir.handle;
sm_p->u.mkdir.cid = resp_p->u.mkdir.cid;

/* also insert entry into attr cache */
PINT_CONVERT_ATTR(&attr, &sm_p->u.mkdir.sys_attr, 0);
Expand Down Expand Up @@ -395,8 +387,6 @@ static PINT_sm_action mkdir_msg_setup_msgpair(
return SM_ACTION_COMPLETE;
}

sm_p->u.mkdir.sys_attr.cid = sm_p->object_ref.cid;

PINT_SERVREQ_MKDIR_FILL(
msg_p->req,
*sm_p->cred_p,
Expand Down Expand Up @@ -477,7 +467,7 @@ static PINT_sm_action create_collection_setup_msgpair(
struct attribute_list attr = { ATTR_GET, CUR_CMD_ATTR_PG,
CCAP_OID, NULL, CCAP_OID_LEN };

ret = osd_command_set_create_collection(command, PVFS_OSD_DATA_PID, 0);
ret = osd_command_set_create_collection(command, PVFS_OSD_DATA_PID, sm_p->u.mkdir.cid);

if (ret) {
osd_error_xerrno(ret, "%s: osd_command_set_create_collection failed",
Expand Down Expand Up @@ -527,7 +517,7 @@ static int create_collection_comp_fn(void *v_p,
if (ret) {
osd_error_xerrno(ret, "%s: attr_resolve failed", __func__);
}

sm_p->object_ref.cid = get_ntohll(sm_p->msgarray_op.msgpair.osd_command.attr[0].val);

osd_command_attr_free(&sm_p->msgarray_op.msgpair.osd_command);
Expand Down Expand Up @@ -677,7 +667,7 @@ static PINT_sm_action mkdir_cleanup(

directory_ref.handle = sm_p->u.mkdir.metafile_handle;
directory_ref.fs_id = sm_p->object_ref.fs_id;

sm_p->u.mkdir.mkdir_resp->ref.handle = directory_ref.handle;
sm_p->u.mkdir.mkdir_resp->ref.fs_id = directory_ref.fs_id;

Expand Down
2 changes: 1 addition & 1 deletion src/client/sysint/sys-setattr.sm
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ static PINT_sm_action setattr_msg_setup_msgpair(
gossip_err("Failed to map meta server address\n");
js_p->error_code = ret;
}

PINT_sm_push_frame(smcb, 0, &sm_p->msgarray_op);
return SM_ACTION_COMPLETE;
}
Expand Down
17 changes: 0 additions & 17 deletions src/io/trove/trove-handle-mgmt/trove-handle-mgmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ typedef struct
} handle_ledger_t;

static struct qhash_table *s_fsid_to_ledger_table = NULL;
static struct qhash_table *s_fsid_to_osd_ledger_table = NULL;

/* these are based on code from src/server/request-scheduler.c */
static int hash_fsid(void *fsid, int table_size);
Expand All @@ -58,7 +57,6 @@ static int trove_check_handle_ranges(TROVE_coll_id coll_id,
PINT_llist *extent_list,
struct handle_ledger *ledger)
{
gossip_err("trove_check_handle_ranges\n");
int ret = -1, i = 0, count = 0, op_count = 0;
TROVE_op_id op_id = 0;
TROVE_ds_state state = 0;
Expand Down Expand Up @@ -143,7 +141,6 @@ static int trove_check_handle_ranges(TROVE_coll_id coll_id,
static int trove_map_handle_ranges( PINT_llist *extent_list,
struct handle_ledger *ledger)
{
gossip_err("trove_map_handle_ranges\n");
int ret = -1;
PINT_llist *cur = NULL;
PVFS_handle_extent *cur_extent = NULL;
Expand Down Expand Up @@ -179,7 +176,6 @@ static int trove_map_handle_ranges( PINT_llist *extent_list,

static handle_ledger_t *get_or_add_handle_ledger(TROVE_coll_id coll_id)
{
gossip_err("get_or_add_handle_ledger\n");
handle_ledger_t *ledger = NULL;
struct qlist_head *hash_link = NULL;

Expand Down Expand Up @@ -222,7 +218,6 @@ static handle_ledger_t *get_or_add_handle_ledger(TROVE_coll_id coll_id)
*/
static int hash_fsid(void *fsid, int table_size)
{
gossip_err("hash_fsid\n");
/* TODO: update this later with a better hash function,
* depending on what fsids look like, for now just modding
*
Expand All @@ -245,7 +240,6 @@ static int hash_fsid(void *fsid, int table_size)
*/
static int hash_fsid_compare(void *key, struct qlist_head *link)
{
gossip_err("hash_fsid_compare\n");
handle_ledger_t *ledger = NULL;
TROVE_coll_id *real_fsid = (TROVE_coll_id *)key;

Expand All @@ -261,7 +255,6 @@ static int hash_fsid_compare(void *key, struct qlist_head *link)

int trove_handle_mgmt_initialize()
{
gossip_err("trove_handle_mgmt_initialize\n");
/*
due to weird trove_initialize usages; this will always succeed
unless the hash table initialization really fails.
Expand All @@ -284,7 +277,6 @@ int trove_set_handle_ranges(TROVE_coll_id coll_id,
TROVE_context_id context_id,
char *handle_range_str)
{
gossip_err("trove_set_handle_ranges\n");
int ret = -TROVE_EINVAL;
PINT_llist *extent_list = NULL;
handle_ledger_t *ledger = NULL;
Expand Down Expand Up @@ -342,7 +334,6 @@ int trove_set_handle_timeout(TROVE_coll_id coll_id,
TROVE_context_id context_id,
struct timeval *timeout)
{
gossip_err("trove_set_handle_timeout\n");
int ret = -1;
handle_ledger_t *ledger = NULL;

Expand Down Expand Up @@ -372,7 +363,6 @@ int trove_set_handle_timeout(TROVE_coll_id coll_id,

TROVE_handle trove_handle_alloc(TROVE_coll_id coll_id)
{
gossip_err("trove_handle_alloc\n");
handle_ledger_t *ledger = NULL;
struct qlist_head *hash_link = NULL;
TROVE_handle handle = TROVE_HANDLE_NULL;
Expand All @@ -395,7 +385,6 @@ TROVE_handle trove_handle_alloc_from_range(
TROVE_coll_id coll_id,
TROVE_handle_extent_array *extent_array)
{
gossip_err("trove_handle_alloc_from_range\n");
handle_ledger_t *ledger = NULL;
struct qlist_head *hash_link = NULL;
TROVE_handle handle = TROVE_HANDLE_NULL;
Expand Down Expand Up @@ -429,7 +418,6 @@ int trove_handle_peek(
int max_num_handles,
int *returned_handle_count)
{
gossip_err("trove_handle_peek\n");
int ret = -TROVE_EINVAL;
handle_ledger_t *ledger = NULL;
struct qlist_head *hash_link = NULL;
Expand Down Expand Up @@ -462,7 +450,6 @@ int trove_handle_peek_from_range(
int max_num_handles,
int *returned_handle_count)
{
gossip_err("trove_handle_peek_from_range\n");
int ret = -TROVE_EINVAL, i = 0;
handle_ledger_t *ledger = NULL;
struct qlist_head *hash_link = NULL;
Expand Down Expand Up @@ -503,7 +490,6 @@ int trove_handle_peek_from_range(

int trove_handle_set_used(TROVE_coll_id coll_id, TROVE_handle handle)
{
gossip_err("trove_handle_set_used\n");
int ret = -1;
handle_ledger_t *ledger = NULL;
struct qlist_head *hash_link = NULL;
Expand All @@ -524,7 +510,6 @@ int trove_handle_set_used(TROVE_coll_id coll_id, TROVE_handle handle)

int trove_handle_free(TROVE_coll_id coll_id, TROVE_handle handle)
{
gossip_err("trove_handle_free\n");
int ret = -1;
handle_ledger_t *ledger = NULL;
struct qlist_head *hash_link = NULL;
Expand Down Expand Up @@ -552,7 +537,6 @@ int trove_handle_free(TROVE_coll_id coll_id, TROVE_handle handle)
*/
int trove_handle_get_statistics(TROVE_coll_id coll_id, uint64_t* free_count)
{
gossip_err("trove_handle_get_statistics\n");
handle_ledger_t *ledger = NULL;
struct qlist_head *hash_link = NULL;

Expand Down Expand Up @@ -583,7 +567,6 @@ int trove_handle_get_statistics(TROVE_coll_id coll_id, uint64_t* free_count)

int trove_handle_mgmt_finalize()
{
gossip_err("trove_handle_mgmt_finalize\n");
int i;
handle_ledger_t *ledger = NULL;
struct qlist_head *hash_link = NULL;
Expand Down
6 changes: 4 additions & 2 deletions src/proto/pvfs2-req-proto.h
Original file line number Diff line number Diff line change
Expand Up @@ -793,10 +793,12 @@ do { \
struct PVFS_servresp_mkdir
{
PVFS_handle handle; /* handle of new directory */
PVFS_handle cid;
};
endecode_fields_1_struct(
endecode_fields_2_struct(
PVFS_servresp_mkdir,
PVFS_handle, handle);
PVFS_handle, handle,
PVFS_handle, cid);

/* create dirent ***********************************************/
/* - creates a new entry within an existing directory */
Expand Down
1 change: 1 addition & 0 deletions src/server/create.sm
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "pvfs2-internal.h"
#include "pint-util.h"
#include "pint-cached-config.h"
#include "trove-handle-mgmt.h"

#define REPLACE_DONE 100

Expand Down
Loading

0 comments on commit 0cf3186

Please sign in to comment.