Skip to content

Commit

Permalink
Initial implementation of readdirplus for collection object represent…
Browse files Browse the repository at this point in the history
…ing a directory

* Works for single dir object in /mnt/pvfs2 for now
* Some attributes (timestamps) are not set, are not returned
* Collection object is in meta_pid, it can't call get_member_attributes for object in data_pid
* Handle_index needs to be fixed for more than one objects
* Regular case, directory object, should be still there for future performance comparison
  • Loading branch information
cek10006 committed Oct 2, 2012
1 parent 130724b commit aaba35a
Show file tree
Hide file tree
Showing 14 changed files with 447 additions and 283 deletions.
2 changes: 1 addition & 1 deletion config.save
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@ s,@ECHO_C@,,;t t
s,@ECHO_N@,-n,;t t
s,@ECHO_T@,,;t t
s,@LIBS@, -lcrypto -lssl -ldl,;t t
s,@PVFS2_VERSION@,2.8.6-orangefs-2012-09-17-172331,;t t
s,@PVFS2_VERSION@,2.8.6-orangefs-2012-10-01-160125,;t t
s,@PVFS2_VERSION_MAJOR@,2,;t t
s,@PVFS2_VERSION_MINOR@,8,;t t
s,@PVFS2_VERSION_SUB@,6,;t t
Expand Down
2 changes: 2 additions & 0 deletions src/apps/admin/pvfs2-ls.c
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,7 @@ void print_entry_attr(
if ((attr->objtype == PVFS_TYPE_METAFILE) &&
(attr->mask & PVFS_ATTR_SYS_SIZE))
{
printf("in_here\n");
size = attr->size;
}
else if ((attr->objtype == PVFS_TYPE_SYMLINK) &&
Expand Down Expand Up @@ -1093,6 +1094,7 @@ static void usage(int argc, char** argv)

int main(int argc, char **argv)
{
printf("START_LIST\n");
int ret = -1, i = 0;
char pvfs_path[MAX_NUM_PATHS][PVFS_NAME_MAX];
PVFS_fs_id fs_id_array[MAX_NUM_PATHS] = {0};
Expand Down
9 changes: 4 additions & 5 deletions src/client/sysint/osd.c
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@ int PINT_copy_osd_object_attr(PVFS_object_attr *attr, struct osd_command *cmd)
if (mask & PVFS_ATTR_META_DFILES) {
/* u.meta.dfile_count */
attr->u.meta.dfile_count = cmd->attr[6].outlen/sizeof(PVFS_handle);

/* u.meta.dfile_array */
df_array_size = cmd->attr[6].outlen;
if (df_array_size) {
Expand Down Expand Up @@ -185,9 +184,9 @@ int PINT_copy_osd_object_attr(PVFS_object_attr *attr, struct osd_command *cmd)
attr->u.meta.hint.flags = 0;

/* convert ms to sec */
attr->ctime = get_ntohtime(cmd->attr[7].val) / 1000;
/*attr->ctime = get_ntohtime(cmd->attr[7].val) / 1000;
attr->atime = get_ntohtime(cmd->attr[8].val) / 1000;
attr->mtime = get_ntohtime(cmd->attr[9].val) / 1000;
attr->mtime = get_ntohtime(cmd->attr[9].val) / 1000;*/

return 0;
}
Expand Down Expand Up @@ -222,9 +221,9 @@ int PINT_copy_osd_dir_attr(PVFS_object_attr *attr, struct osd_command *cmd)
attr->u.meta.hint.flags = 0;

/* convert ms to sec */
attr->ctime = get_ntohtime(cmd->attr[7].val) / 1000;
/*attr->ctime = get_ntohtime(cmd->attr[7].val) / 1000;
attr->atime = get_ntohtime(cmd->attr[8].val) / 1000;
attr->mtime = get_ntohtime(cmd->attr[9].val) / 1000;
attr->mtime = get_ntohtime(cmd->attr[9].val) / 1000;*/

return 0;
}
Expand Down
17 changes: 10 additions & 7 deletions src/client/sysint/remove.sm
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,7 @@ static PINT_sm_action remove_getattr_analyze_results(
switch(attr->objtype)
{
case PVFS_TYPE_METAFILE:
//assert(attr->mask & PVFS_ATTR_META_DFILES);
//assert(attr->u.meta.dfile_count > 0);
assert(attr->mask & PVFS_ATTR_META_DFILES);

gossip_debug(GOSSIP_CLIENT_DEBUG, "%s: must remove %d datafiles\n",
__func__, attr->u.meta.dfile_count);
Expand Down Expand Up @@ -241,7 +240,7 @@ static PINT_sm_action remove_datafile_remove_setup_msgpair(
if (attr->u.meta.dfile_array)
ret = osd_command_set_remove(command, PVFS_OSD_DATA_PID,
attr->u.meta.dfile_array[0]);
else
else
ret = osd_command_set_remove(command, PVFS_OSD_DATA_PID,
sm_p->object_ref.handle);

Expand Down Expand Up @@ -294,7 +293,7 @@ static PINT_sm_action remove_object_remove_setup_msgpair(
gossip_debug(GOSSIP_CLIENT_DEBUG,
"remove state: object_remove_setup_msgpair\n");

if (is_osd_md && (sm_p->getattr.attr.objtype != PVFS_TYPE_DIRECTORY)) {
if (is_osd_md) {
/* no mdfile to remove */
js_p->error_code = OSD_MDFILE_MSGPAIR;
return SM_ACTION_COMPLETE;
Expand Down Expand Up @@ -360,18 +359,19 @@ static PINT_sm_action remove_collection(
PINT_llist *cur = NULL;
struct host_alias_s *cur_alias;
PVFS_BMI_addr_t addr;
int is_osd_md = fsid_is_osd_md(sm_p->object_ref.fs_id);

js_p->error_code = 0;

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) || sm_p->getattr.attr.objtype != PVFS_TYPE_DIRECTORY) {
if ((!is_osd_md && (!(server_config->member_attr) || sm_p->getattr.attr.objtype != PVFS_TYPE_DIRECTORY)) || (sm_p->getattr.attr.objtype != PVFS_TYPE_DIRECTORY && is_osd_md)) {
js_p->error_code = SKIP_COLLECTION_REMOVAL;
return SM_ACTION_COMPLETE;
}

cur = server_config->host_aliases;
while(cur)
{
Expand All @@ -397,7 +397,10 @@ static PINT_sm_action remove_collection(

struct osd_command *command = &sm_p->msgarray_op.msgpair.osd_command;

ret = osd_command_set_remove_collection(command, PVFS_OSD_DATA_PID, sm_p->getattr.attr.cid, 0);
if (is_osd_md)
ret = osd_command_set_remove_collection(command, PVFS_OSD_META_PID, sm_p->object_ref.handle, 0);
else
ret = osd_command_set_remove_collection(command, PVFS_OSD_DATA_PID, sm_p->getattr.attr.cid, 0);

if (ret) {
osd_error_xerrno(ret, "%s: osd_command_set_remove_collection failed",
Expand Down
16 changes: 9 additions & 7 deletions src/client/sysint/sys-create.sm
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,8 @@ static int create_datafiles_comp_fn(void *v_p,
oid = get_ntohll(sm_p->msgarray_op.msgarray[index].osd_command.attr[6].val);
sm_p->u.create.datafile_handles[index] = oid;
}

gossip_err("create_oid: %d\n", oid);

if (oid < first || oid > last)
gossip_err("%s: OSD-assigned oid %llu out of range %llu-%llu\n",
Expand Down Expand Up @@ -823,7 +825,7 @@ static PINT_sm_action create_datafiles_setup_msgpair_array(
PVFS_ATTR_COMMON_CTIME |
PVFS_ATTR_COMMON_MTIME |
PVFS_ATTR_META_DIST |
//PVFS_ATTR_META_DFILES |
PVFS_ATTR_META_DFILES |
PVFS_ATTR_COMMON_TYPE;

sm_p->u.create.attr.objtype = PVFS_TYPE_METAFILE;
Expand All @@ -839,7 +841,7 @@ static PINT_sm_action create_datafiles_setup_msgpair_array(

for (i = 0; i < 6; i++) {
attrs[i].type = ATTR_SET;
attrs[i].page = PVFS_USEROBJECT_ATTR_PG;
attrs[i].page = ANY_PG + PVFS_USEROBJECT_ATTR_PG;
attrs[i].number = i;
}

Expand All @@ -857,25 +859,25 @@ static PINT_sm_action create_datafiles_setup_msgpair_array(

attrs[4].val = &sm_p->u.create.attr.objtype;
attrs[4].len = sizeof(PVFS_ds_type);

attrs[5].val = dist_buf;
attrs[5].len = PINT_DIST_PACK_SIZE(sm_p->u.create.dist);

if(!sm_p->getattr.attr.cid) {
sm_p->getattr.attr.cid = COLLECTION_OID_LB; /* root directory */
sm_p->getattr.attr.cid = sm_p->object_ref.handle; /* root directory */
}
set_htonll(&attrval, sm_p->getattr.attr.cid);

attrs[7].type = ATTR_SET;
attrs[7].page = USER_COLL_PG;
attrs[7].page = ANY_PG + USER_COLL_PG;
attrs[7].number = 7;
attrs[7].val = &attrval;
attrs[7].len = 8;

if (sm_p->u.create.datafile_handles)
{
attrs[6].type = ATTR_SET;
attrs[6].page = PVFS_USEROBJECT_ATTR_PG;
attrs[6].page = ANY_PG + PVFS_USEROBJECT_ATTR_PG;
attrs[6].number = 6;
attrs[6].val = sm_p->u.create.datafile_handles;
attrs[6].len = sizeof(PVFS_handle) * sm_p->u.create.num_data_files;
Expand Down Expand Up @@ -911,7 +913,7 @@ static PINT_sm_action create_datafiles_setup_msgpair_array(
}
else
{
struct attribute_list attrs = {ATTR_SET, USER_COLL_PG, 1, &attrval, 8};
struct attribute_list attrs = {ATTR_SET, ANY_PG + USER_COLL_PG, 1, &attrval, 8};

if(!sm_p->getattr.attr.cid) {
sm_p->getattr.attr.cid = COLLECTION_OID_LB; /* root directory */
Expand Down
18 changes: 8 additions & 10 deletions src/client/sysint/sys-getattr.sm
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@ static PINT_sm_action getattr_object_getattr_setup_msgpair(
/* Set attr type, page and number */
for (i = 0; i < numattrs - 3; i++) {
attrl[i].type = ATTR_GET;
attrl[i].page = PVFS_USEROBJECT_ATTR_PG;
attrl[i].page = ANY_PG + PVFS_USEROBJECT_ATTR_PG;
attrl[i].number = i;
}

Expand All @@ -561,17 +561,17 @@ static PINT_sm_action getattr_object_getattr_setup_msgpair(

/* ctime, atime & mtime */
attrl[7].type = ATTR_GET;
attrl[7].page = USER_TMSTMP_PG;
attrl[7].page = ANY_PG + USER_TMSTMP_PG;
attrl[7].number = UTSAP_CTIME;
attrl[7].len = UTSAP_CTIME_LEN;

attrl[8].type = ATTR_GET;
attrl[8].page = USER_TMSTMP_PG;
attrl[8].page = ANY_PG + USER_TMSTMP_PG;
attrl[8].number = UTSAP_DATA_ATIME;
attrl[8].len = UTSAP_DATA_ATIME_LEN;

attrl[9].type = ATTR_GET;
attrl[9].page = USER_TMSTMP_PG;
attrl[9].page = ANY_PG + USER_TMSTMP_PG;
attrl[9].number = UTSAP_DATA_MTIME;
attrl[9].len = UTSAP_DATA_MTIME_LEN;

Expand Down Expand Up @@ -789,10 +789,8 @@ static int getattr_object_getattr_comp_fn(
/* if we requested the datafile handles for the file, did
* the datafile array get populated?
*/
gossip_err("milan\n");
assert(attr->u.meta.dfile_array &&
(attr->u.meta.dfile_count > 0));
gossip_err("baros\n");
//assert(attr->u.meta.dfile_array &&
// (attr->u.meta.dfile_count > 0));

gossip_debug(GOSSIP_GETATTR_DEBUG,
"getattr_object_getattr_comp_fn: "
Expand Down Expand Up @@ -964,7 +962,7 @@ static PINT_sm_action getattr_datafile_getattr_setup_msgpairarray(
struct osd_command *command = &sm_p->msgarray_op.msgarray[i].osd_command;
struct attribute_list id = {
.type = ATTR_GET,
.page = 0x1,
.page = ANY_PG + 0x1,
.number = 0x82, /* logical length (not used capacity) */
.len = sizeof(uint64_t),
};
Expand Down Expand Up @@ -1377,7 +1375,7 @@ static PINT_sm_action getattr_datafile_getattr_cleanup(

static PINT_sm_action getattr_acache_insert(
struct PINT_smcb *smcb, job_status_s *js_p)
{
{
struct PINT_client_sm *sm_p = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
PVFS_size* tmp_size = NULL;

Expand Down
2 changes: 1 addition & 1 deletion src/client/sysint/sys-lookup.sm
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,7 @@ static PINT_sm_action lookup_segment_setup_msgpair(struct PINT_smcb *smcb,
seg_to_lookup = cur_seg->seg_name;

attr.type = ATTR_GET;
attr.page = PVFS_USEROBJECT_DIR_PG;
attr.page = ANY_PG + PVFS_USEROBJECT_DIR_PG;
attr.number = jenkins_one_at_a_time_hash((uint8_t *)seg_to_lookup,
strlen(seg_to_lookup) + 1);
attr.len = 1024;
Expand Down
Loading

0 comments on commit aaba35a

Please sign in to comment.