/** Modify the attributes of a single object. */ PVFS_error PVFS_sys_setattr( PVFS_object_ref ref, PVFS_sys_attr attr, const PVFS_credentials *credentials, PVFS_hint hints) { PVFS_error ret = -PVFS_EINVAL, error = 0; PVFS_sys_op_id op_id; gossip_debug(GOSSIP_CLIENT_DEBUG, "PVFS_sys_setattr entered\n"); ret = PVFS_isys_setattr(ref, attr, credentials, &op_id, hints, NULL); if (ret) { PVFS_perror_gossip("PVFS_isys_setattr call", ret); error = ret; } else { ret = PVFS_sys_wait(op_id, "setattr", &error); if (ret) { PVFS_perror_gossip("PVFS_sys_wait call", ret); error = ret; } } PINT_sys_release(op_id); return error; }
/** Read entries from a directory. * * \param token opaque value used to track position in directory * when more than one read is required. * \param pvfs_dirent_incount maximum number of entries to read, if * available, starting from token. */ PVFS_error PVFS_sys_readdir( PVFS_object_ref ref, PVFS_ds_position token, int32_t pvfs_dirent_incount, const PVFS_credentials *credentials, PVFS_sysresp_readdir *resp, PVFS_hint hints) { PVFS_error ret = -PVFS_EINVAL, error = 0; PVFS_sys_op_id op_id; gossip_debug(GOSSIP_CLIENT_DEBUG, "PVFS_sys_readdir entered\n"); ret = PVFS_isys_readdir(ref, token, pvfs_dirent_incount, credentials, resp, &op_id, hints, NULL); if (ret) { PVFS_perror_gossip("PVFS_isys_readdir call", ret); error = ret; } else { ret = PVFS_sys_wait(op_id, "readdir", &error); if (ret) { PVFS_perror_gossip("PVFS_sys_wait call", ret); error = ret; } } PINT_sys_release(op_id); return error; }
int ADIOI_PVFS2_aio_poll_fn(void *extra_state, MPI_Status *status) { ADIOI_AIO_Request *aio_req; int ret, error; aio_req = (ADIOI_AIO_Request *)extra_state; /* BUG: cannot PVFS_sys_testsome: does not work for a specific request */ ret = PVFS_sys_wait(aio_req->op_id, "ADIOI_PVFS2_aio_poll_fn", &error); if (ret == 0) { aio_req->nbytes = aio_req->resp_io.total_completed; MPI_Grequest_complete(aio_req->req); return MPI_SUCCESS; } else return MPI_UNDEFINED; /* TODO: what's this error? */ }
void ADIOI_PVFS2_AIO_contig(ADIO_File fd, void *buf, int count, MPI_Datatype datatype, int file_ptr_type, ADIO_Offset offset, MPI_Request *request, int flag, int *error_code) { int ret; MPI_Count datatype_size, len; ADIOI_PVFS2_fs *pvfs_fs; ADIOI_AIO_Request *aio_req; static char myname[] = "ADIOI_PVFS2_AIO_contig"; pvfs_fs = (ADIOI_PVFS2_fs*)fd->fs_ptr; aio_req = (ADIOI_AIO_Request*)ADIOI_Calloc(sizeof(ADIOI_AIO_Request), 1); MPI_Type_size_x(datatype, &datatype_size); len = datatype_size * count; ret = PVFS_Request_contiguous(len, PVFS_BYTE, &(aio_req->mem_req)); /* --BEGIN ERROR HANDLING-- */ if (ret != 0) { *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, ADIOI_PVFS2_error_convert(ret), "Error in pvfs_request_contig (memory)", 0); return; } /* --END ERROR HANDLING-- */ ret = PVFS_Request_contiguous(len, PVFS_BYTE, &(aio_req->file_req)); /* --BEGIN ERROR HANDLING-- */ if (ret != 0) { *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, ADIOI_PVFS2_error_convert(ret), "Error in pvfs_request_contig (file)", 0); return; } /* --END ERROR HANDLING-- */ if (file_ptr_type == ADIO_INDIVIDUAL) { /* copy individual file pointer into offset variable, continue */ offset = fd->fp_ind; } if (flag == READ) { #ifdef ADIOI_MPE_LOGGING MPE_Log_event( ADIOI_MPE_iread_a, 0, NULL ); #endif ret = PVFS_isys_read(pvfs_fs->object_ref, aio_req->file_req, offset, buf, aio_req->mem_req, &(pvfs_fs->credentials), &(aio_req->resp_io), &(aio_req->op_id), NULL); #ifdef ADIOI_MPE_LOGGING MPE_Log_event( ADIOI_MPE_iread_b, 0, NULL ); #endif } else if (flag == WRITE) { #ifdef ADIOI_MPE_LOGGING MPE_Log_event( ADIOI_MPE_iwrite_a, 0, NULL ); #endif ret = PVFS_isys_write(pvfs_fs->object_ref, aio_req->file_req, offset, buf, aio_req->mem_req, &(pvfs_fs->credentials), &(aio_req->resp_io), &(aio_req->op_id), NULL); #ifdef ADIOI_MPE_LOGGING MPE_Log_event( ADIOI_MPE_iwrite_b, 0, NULL ); #endif } /* --BEGIN ERROR HANDLING-- */ if (ret < 0 ) { *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, ADIOI_PVFS2_error_convert(ret), "Error in PVFS_isys_io", 0); goto fn_exit; } /* --END ERROR HANDLING-- */ #ifdef HAVE_MPI_GREQUEST_EXTENSIONS /* posted. defered completion */ if (ret == 0) { if (ADIOI_PVFS2_greq_class == 0) { MPIX_Grequest_class_create(ADIOI_GEN_aio_query_fn, ADIOI_PVFS2_aio_free_fn, MPIU_Greq_cancel_fn, ADIOI_PVFS2_aio_poll_fn, ADIOI_PVFS2_aio_wait_fn, &ADIOI_PVFS2_greq_class); } MPIX_Grequest_class_allocate(ADIOI_PVFS2_greq_class, aio_req, request); memcpy(&(aio_req->req), request, sizeof(*request)); } #else /* if generalized request extensions not available, we will have to process * this operation right here */ int error; ret = PVFS_sys_wait(aio_req->op_id, "ADIOI_PVFS2_AIO_Contig", &error); if (ret == 0) { MPIO_Completed_request_create(&fd, len, error_code, request); } #endif /* immediate completion */ if (ret == 1) { MPIO_Completed_request_create(&fd, len, error_code, request); } if (file_ptr_type == ADIO_INDIVIDUAL) { fd->fp_ind += len; } fd->fp_sys_posn = offset + len; *error_code = MPI_SUCCESS; fn_exit: return; }